diff --git a/.github/workflows/checks.yml b/.github/workflows/checks.yml index 6aa6f765..10973187 100644 --- a/.github/workflows/checks.yml +++ b/.github/workflows/checks.yml @@ -3,7 +3,7 @@ on: push: branches: [main] pull_request: - branches: "*" + branches: "**" merge_group: workflow_dispatch: diff --git a/.github/workflows/deploy-ghpage.yml b/.github/workflows/deploy-ghpage.yml index 60b9eb35..d9211ba6 100644 --- a/.github/workflows/deploy-ghpage.yml +++ b/.github/workflows/deploy-ghpage.yml @@ -6,22 +6,25 @@ on: - main pull_request: branches: -# - 'none-never' - - '*' + - '**' jobs: build: runs-on: ubuntu-latest steps: - - name: Checkout - uses: actions/checkout@v6 - uses: actions/checkout@v6 - uses: pnpm/action-setup@v4 with: - run_install: true - package_json_file: packages/package.json + version: 9.10.0 + - uses: actions/setup-node@v6 + with: + cache: 'pnpm' + cache-dependency-path: 'packages/pnpm-lock.yaml' + - name: Install pnpm dependencies + working-directory: packages + run: pnpm install --frozen-lockfile - uses: astral-sh/setup-uv@v7 - - name: Run tests + - name: Build storybook working-directory: ./packages/buckaroo-js-core run: | pnpm build-storybook diff --git a/.github/workflows/publish-storybook.yml b/.github/workflows/publish-storybook.yml index 161cb25f..4ad04b83 100644 --- a/.github/workflows/publish-storybook.yml +++ b/.github/workflows/publish-storybook.yml @@ -7,14 +7,14 @@ on: - main pull_request: - branches: "*" + branches: "**" permissions: contents: read pages: write id-token: write - + # List of jobs jobs: TestPython: @@ -26,10 +26,15 @@ jobs: - uses: actions/checkout@v6 - uses: pnpm/action-setup@v4 with: - run_install: true - package_json_file: packages/package.json - - uses: astral-sh/setup-uv@v7 - - name: Run tests + version: 9.10.0 + - uses: actions/setup-node@v6 + with: + cache: 'pnpm' + cache-dependency-path: 'packages/pnpm-lock.yaml' + - name: Install pnpm dependencies + working-directory: packages + run: pnpm install --frozen-lockfile + - name: Build storybook working-directory: ./packages/buckaroo-js-core run: | pnpm build-storybook diff --git a/.gitignore b/.gitignore index dbc8f310..bd049728 100644 --- a/.gitignore +++ b/.gitignore @@ -159,6 +159,7 @@ ipydatagrid/nbextension/* buckaroo/nbextension/* buckaroo/labextension/* buckaroo/static/*.js +buckaroo/static/*.js.map buckaroo/static/*.css docs/*.js docs/*.js.map diff --git a/packages/buckaroo-js-core/jest.config.ts b/packages/buckaroo-js-core/jest.config.ts index f9886be4..fbdadc2b 100644 --- a/packages/buckaroo-js-core/jest.config.ts +++ b/packages/buckaroo-js-core/jest.config.ts @@ -8,6 +8,7 @@ export default { "\\.(css|less|sass|scss)$": "identity-obj-proxy", "^.+\\.svg$": "jest-transformer-svg", "^@/(.*)$": "/src/$1", + "^lodash-es$": "lodash", }, testMatch: ["!**/*.spec.ts", "**/*.test.ts", "**/*.test.tsx"], diff --git a/packages/buckaroo-js-core/package.json b/packages/buckaroo-js-core/package.json index 04263a03..fa66f569 100644 --- a/packages/buckaroo-js-core/package.json +++ b/packages/buckaroo-js-core/package.json @@ -30,14 +30,14 @@ "/dist" ], "dependencies": { - "@ag-grid-community/client-side-row-model": "^32.3.3", - "@ag-grid-community/core": "^32.3.3", - "@ag-grid-community/infinite-row-model": "^32.3.3", - "@ag-grid-community/react": "^32.3.3", - "@ag-grid-community/styles": "^32.3.3", - "@ag-grid-community/theming": "^32.3.3", + "@ag-grid-community/client-side-row-model": "^32.3.9", + "@ag-grid-community/core": "^32.3.9", + "@ag-grid-community/infinite-row-model": "^32.3.9", + "@ag-grid-community/react": "^32.3.9", + "@ag-grid-community/styles": "^32.3.9", + "@ag-grid-community/theming": "^32.3.9", "hyparquet": "^1.8.2", - "lodash": "^4.17.21", + "lodash-es": "^4.17.21", "recharts": "^2.13.1" }, "devDependencies": { @@ -55,7 +55,8 @@ "@testing-library/jest-dom": "^6.6.3", "@testing-library/react": "^16.1.0", "@types/jest": "^29.5.14", - "@types/lodash": "^4.17.13", + "@types/lodash-es": "^4.17.12", + "lodash": "^4.17.21", "@types/node": "^22.15.3", "@types/react": "^18.3.12", "@types/react-dom": "^18.3.1", diff --git a/packages/buckaroo-js-core/src/components/BuckarooWidgetInfinite.tsx b/packages/buckaroo-js-core/src/components/BuckarooWidgetInfinite.tsx index b71858b5..0b3c06fb 100644 --- a/packages/buckaroo-js-core/src/components/BuckarooWidgetInfinite.tsx +++ b/packages/buckaroo-js-core/src/components/BuckarooWidgetInfinite.tsx @@ -1,5 +1,4 @@ import React, { useMemo, useState } from "react"; -import _ from "lodash"; import { OperationResult } from "./DependentTabs"; import { ColumnsEditor } from "./ColumnsEditor"; diff --git a/packages/buckaroo-js-core/src/components/DCFCell.tsx b/packages/buckaroo-js-core/src/components/DCFCell.tsx index 7a859d97..d78cc4b0 100644 --- a/packages/buckaroo-js-core/src/components/DCFCell.tsx +++ b/packages/buckaroo-js-core/src/components/DCFCell.tsx @@ -1,5 +1,4 @@ import React, { useState } from "react"; -import _ from "lodash"; import { OperationResult } from "./DependentTabs"; import { ColumnsEditor } from "./ColumnsEditor"; diff --git a/packages/buckaroo-js-core/src/components/DFViewerParts/ChartCell.tsx b/packages/buckaroo-js-core/src/components/DFViewerParts/ChartCell.tsx index b480e604..042666de 100644 --- a/packages/buckaroo-js-core/src/components/DFViewerParts/ChartCell.tsx +++ b/packages/buckaroo-js-core/src/components/DFViewerParts/ChartCell.tsx @@ -1,4 +1,4 @@ -import _ from "lodash"; +import { isArray } from "lodash-es"; import React from "react"; import { createPortal } from "react-dom"; @@ -125,7 +125,7 @@ export const getChartCell = (multiChartCellProps: ChartDisplayerA) => { const potentialHistogramArr = props.value; //for key "index", the value is "histogram" // this causes ReChart to blow up, so we check to see if it's an array - if (potentialHistogramArr === undefined || !_.isArray(potentialHistogramArr)) { + if (potentialHistogramArr === undefined || !isArray(potentialHistogramArr)) { return ; } const histogramArr = potentialHistogramArr as LineObservation[]; diff --git a/packages/buckaroo-js-core/src/components/DFViewerParts/DFViewerDataHelper.ts b/packages/buckaroo-js-core/src/components/DFViewerParts/DFViewerDataHelper.ts index 016b144b..c782d280 100644 --- a/packages/buckaroo-js-core/src/components/DFViewerParts/DFViewerDataHelper.ts +++ b/packages/buckaroo-js-core/src/components/DFViewerParts/DFViewerDataHelper.ts @@ -1,5 +1,5 @@ import { IDatasource, IGetRowsParams } from "@ag-grid-community/core"; -import _ from "lodash"; +import { keys, times, reduce } from "lodash-es"; export type RawDataWrapper = { data: any[]; @@ -48,11 +48,11 @@ export const createDatasourceWrapper = (data: DFData, delay_in_milliseconds: num }; export const dictOfArraystoDFData = (dict: Record): DFData => { - const keys = _.keys(dict); - const length = dict[keys[0]].length; + const dictKeys = keys(dict); + const length = dict[dictKeys[0]].length; - return _.times(length, index => { - return _.reduce(keys, (result, key) => { + return times(length, index => { + return reduce(dictKeys, (result, key) => { result[key] = dict[key][index]; return result; }, {} as Record); diff --git a/packages/buckaroo-js-core/src/components/DFViewerParts/DFViewerInfinite.tsx b/packages/buckaroo-js-core/src/components/DFViewerParts/DFViewerInfinite.tsx index bc44eb74..e5ce757c 100644 --- a/packages/buckaroo-js-core/src/components/DFViewerParts/DFViewerInfinite.tsx +++ b/packages/buckaroo-js-core/src/components/DFViewerParts/DFViewerInfinite.tsx @@ -4,7 +4,6 @@ import { useEffect, useRef, } from "react"; -import _ from "lodash"; import { DFData, DFDataRow, DFViewerConfig, SDFT } from "./DFWhole"; import { getCellRendererSelector, dfToAgrid, extractPinnedRows, extractSDFT } from "./gridUtils"; diff --git a/packages/buckaroo-js-core/src/components/DFViewerParts/DFWhole.ts b/packages/buckaroo-js-core/src/components/DFViewerParts/DFWhole.ts index b454b2dd..19f29c9f 100644 --- a/packages/buckaroo-js-core/src/components/DFViewerParts/DFWhole.ts +++ b/packages/buckaroo-js-core/src/components/DFViewerParts/DFWhole.ts @@ -1,7 +1,6 @@ // I'm not sure about adding underlying types too import { ColDef, ColGroupDef, GridOptions } from "@ag-grid-community/core"; -import _ from "lodash"; type AGGrid_ColDef = ColDef; export type ColDefOrGroup = ColDef|ColGroupDef diff --git a/packages/buckaroo-js-core/src/components/DFViewerParts/Displayer.ts b/packages/buckaroo-js-core/src/components/DFViewerParts/Displayer.ts index e362eae9..7363862d 100644 --- a/packages/buckaroo-js-core/src/components/DFViewerParts/Displayer.ts +++ b/packages/buckaroo-js-core/src/components/DFViewerParts/Displayer.ts @@ -8,7 +8,7 @@ import { StringDisplayerA, ObjDisplayerA, } from "./DFWhole"; -import * as _ from "lodash"; +import { includes, isArray, isBoolean, isDate, isObject, map } from "lodash-es"; import { HistogramCell } from "./HistogramCell"; import { Base64PNGDisplayer, LinkCellRenderer, SVGDisplayer } from "./OtherRenderers"; @@ -43,12 +43,12 @@ export const getStringFormatter = (args: StringDisplayerA) => { }; const dictDisplayer = (val: Record): string => { - const objBody = _.map(val, (value, key) => `'${key}': ${objDisplayer(value)}`).join(","); + const objBody = map(val, (value, key) => `'${key}': ${objDisplayer(value)}`).join(","); return `{ ${objBody} }`; }; export const isValidDate = (possibleDate: any): boolean => { - if (_.isDate(possibleDate) && isFinite(possibleDate.getTime())) { + if (isDate(possibleDate) && isFinite(possibleDate.getTime())) { return true; } return false; @@ -72,11 +72,11 @@ export const dateDisplayerDefault = (d: Date): string => { const objDisplayer = (val: any | any[]): string => { if (val === undefined || val === null) { return "None"; - } else if (_.isArray(val)) { + } else if (isArray(val)) { return `[ ${val.map(objDisplayer).join(", ")}]`; - } else if (_.isBoolean(val)) { + } else if (isBoolean(val)) { return boolDisplayer(val); - } else if (_.isObject(val)) { + } else if (isObject(val)) { return dictDisplayer(val); } else { return val.toString(); @@ -138,7 +138,7 @@ export const getFloatFormatter = (hint: FloatDisplayerA) => { } const res: string = floatFormatter.format(params.value); - if (!_.includes(res, ".")) { + if (!includes(res, ".")) { const padLength = res.length + hint.max_fraction_digits + 1; return res.padEnd(padLength); } else { @@ -220,7 +220,7 @@ export function getCellRenderer(crArgs: CellRendererArgs) { } export function getFormatterFromArgs(dispArgs: DisplayerArgs) { - if (_.includes(cellRendererDisplayers, dispArgs.displayer)) { + if (includes(cellRendererDisplayers, dispArgs.displayer)) { return undefined; } const fArgs = dispArgs as FormatterArgs; diff --git a/packages/buckaroo-js-core/src/components/DFViewerParts/HistogramCell.tsx b/packages/buckaroo-js-core/src/components/DFViewerParts/HistogramCell.tsx index 495d8397..7db70948 100644 --- a/packages/buckaroo-js-core/src/components/DFViewerParts/HistogramCell.tsx +++ b/packages/buckaroo-js-core/src/components/DFViewerParts/HistogramCell.tsx @@ -1,4 +1,4 @@ -import _ from "lodash"; +import { isArray } from "lodash-es"; import React from "react"; import { createPortal } from "react-dom"; @@ -91,7 +91,7 @@ export const HistogramCell = (props: const potentialHistogramArr = props.value; //for key "index", the value is "histogram" // this causes ReChart to blow up, so we check to see if it's an array - if (potentialHistogramArr === undefined || !_.isArray(potentialHistogramArr)) { + if (potentialHistogramArr === undefined || !isArray(potentialHistogramArr)) { return ; } const histogramArr = potentialHistogramArr as HistogramBar[]; diff --git a/packages/buckaroo-js-core/src/components/DFViewerParts/OtherRenderers.tsx b/packages/buckaroo-js-core/src/components/DFViewerParts/OtherRenderers.tsx index a5ab41cc..2af4ebe2 100644 --- a/packages/buckaroo-js-core/src/components/DFViewerParts/OtherRenderers.tsx +++ b/packages/buckaroo-js-core/src/components/DFViewerParts/OtherRenderers.tsx @@ -1,4 +1,3 @@ -import _ from "lodash"; import { ValueFormatterFunc } from "@ag-grid-community/core"; export const getTextCellRenderer = (formatter: ValueFormatterFunc) => { diff --git a/packages/buckaroo-js-core/src/components/DFViewerParts/SmartRowCache.test.ts b/packages/buckaroo-js-core/src/components/DFViewerParts/SmartRowCache.test.ts index d26490ca..8e7f59a9 100644 --- a/packages/buckaroo-js-core/src/components/DFViewerParts/SmartRowCache.test.ts +++ b/packages/buckaroo-js-core/src/components/DFViewerParts/SmartRowCache.test.ts @@ -1,4 +1,3 @@ -import * as _ from "lodash"; //import { describe, expect } from 'jest'; import { Segment, diff --git a/packages/buckaroo-js-core/src/components/DFViewerParts/SmartRowCache.ts b/packages/buckaroo-js-core/src/components/DFViewerParts/SmartRowCache.ts index 67b354fd..622c3099 100644 --- a/packages/buckaroo-js-core/src/components/DFViewerParts/SmartRowCache.ts +++ b/packages/buckaroo-js-core/src/components/DFViewerParts/SmartRowCache.ts @@ -1,4 +1,4 @@ -import * as _ from "lodash"; +import { fromPairs, has, map, sum } from "lodash-es"; import { DFData, } from "./DFWhole"; @@ -494,12 +494,12 @@ export class KeyAwareSmartRowCache { public usedSize(): number { - return _.sum(Array.from(this.srcAccesses.values()).map((x) => x.usedSize())) + return sum(Array.from(this.srcAccesses.values()).map((x) => x.usedSize())) } public debugCacheState():void { - _.map( - _.fromPairs( + map( + fromPairs( Array.from(this.srcAccesses.entries())), (k, _c) => {console.log(k, k.safeGetExtents())}); } @@ -640,7 +640,7 @@ export class KeyAwareSmartRowCache { } else { src.addRows(seg, resp.data) } - if (_.has(this.waitingCallbacks, cbKey)) { + if (has(this.waitingCallbacks, cbKey)) { const [success, fail] = this.waitingCallbacks[cbKey]; if(verifyResp(resp)) { success(this.getRows(resp.key), src.sentLength); @@ -654,7 +654,7 @@ export class KeyAwareSmartRowCache { public addErrorResponse(resp: PayloadResponse) { const cbKey = getPayloadKey(resp.key) - if (_.has(this.waitingCallbacks, cbKey)) { + if (has(this.waitingCallbacks, cbKey)) { const [_success, fail] = this.waitingCallbacks[cbKey]; fail() delete this.waitingCallbacks[cbKey] diff --git a/packages/buckaroo-js-core/src/components/DFViewerParts/TableInfinite.tsx b/packages/buckaroo-js-core/src/components/DFViewerParts/TableInfinite.tsx index 5711dc50..e11f9e06 100644 --- a/packages/buckaroo-js-core/src/components/DFViewerParts/TableInfinite.tsx +++ b/packages/buckaroo-js-core/src/components/DFViewerParts/TableInfinite.tsx @@ -11,7 +11,7 @@ import { } from "./gridUtils"; //import { InfiniteViewer } from "./InfiniteViewerImpl"; import { Operation } from "../OperationUtils"; -import _ from "lodash"; +import { filter, map } from "lodash-es"; import { PayloadResponse } from "./SmartRowCache"; const data: [string, Operation[]][] = [ @@ -51,21 +51,21 @@ const MySelect = ({ }; function addSequentialIndex(list: Record[]) { - return _.map(list, (item, index) => ({ + return map(list, (item, index) => ({ ...item, idx: index + 1, // Adding 1 to start the index from 1 })); } function addUniqueIndex(list: Record[]) { - return _.map(list, (item, _index) => ({ + return map(list, (item, _index) => ({ ...item, agIdx: `${item.idx}-${item.sport}`, })); } function filterBySport(list: any[], sport: string): any[] { - return _.filter(list, { sport: sport }); + return filter(list, { sport: sport }); } const getDataset = (sportName: string) => { diff --git a/packages/buckaroo-js-core/src/components/DFViewerParts/gridUtils.test.ts b/packages/buckaroo-js-core/src/components/DFViewerParts/gridUtils.test.ts index e04e086b..913de6db 100644 --- a/packages/buckaroo-js-core/src/components/DFViewerParts/gridUtils.test.ts +++ b/packages/buckaroo-js-core/src/components/DFViewerParts/gridUtils.test.ts @@ -11,7 +11,7 @@ import { multiIndexColToColDef, } from './gridUtils'; -import * as _ from "lodash"; +import { omit } from "lodash-es"; import { DFData, DFViewerConfig, NormalColumnConfig, MultiIndexColumnConfig, PinnedRowConfig, ColumnConfig } from "./DFWhole"; import { getFloatFormatter } from './Displayer'; import { ColDef, ValueFormatterParams } from '@ag-grid-community/core'; @@ -309,14 +309,14 @@ describe("testing multi index organiztion ", () => { it("childColDef should return proper subset", () => { - expect(_.omit(childColDef(SUPER__SUB_A, 1), "valueFormatter")).toStrictEqual({ + expect(omit(childColDef(SUPER__SUB_A, 1), "valueFormatter")).toStrictEqual({ "cellDataType": false, "cellStyle": undefined, "field": "a", "headerName": "sub_a", }); - expect(_.omit(childColDef(SUPER__SUB_A2, 1), "valueFormatter")).toStrictEqual({ + expect(omit(childColDef(SUPER__SUB_A2, 1), "valueFormatter")).toStrictEqual({ "cellDataType": false, "cellStyle": undefined, "field": "a", diff --git a/packages/buckaroo-js-core/src/components/DFViewerParts/gridUtils.ts b/packages/buckaroo-js-core/src/components/DFViewerParts/gridUtils.ts index 89982bc6..3b89fb03 100644 --- a/packages/buckaroo-js-core/src/components/DFViewerParts/gridUtils.ts +++ b/packages/buckaroo-js-core/src/components/DFViewerParts/gridUtils.ts @@ -23,7 +23,7 @@ import { ColDefOrGroup, } from "./DFWhole"; -import * as _ from "lodash"; +import { cloneDeep, filter, find, get, has, includes, indexOf, isArray, keys, map, pick, union, without, zipObject } from "lodash-es"; import { getTextCellRenderer } from "./OtherRenderers"; import { getStyler } from "./Styler"; import { DFData, SDFMeasure, SDFT } from "./DFWhole"; @@ -50,7 +50,7 @@ export function getCellRendererorFormatter( return colDefExtras; } - if (_.includes(cellRendererDisplayers, dispArgs.displayer)) { + if (includes(cellRendererDisplayers, dispArgs.displayer)) { const crArgs: CellRendererArgs = dispArgs as CellRendererArgs; return { cellRenderer: getCellRenderer(crArgs), @@ -62,7 +62,7 @@ export function getCellRendererorFormatter( export function extractPinnedRows(sdf: DFData, prc: PinnedRowConfig[]) { - return _.map(_.map(prc, "primary_key_val"), (x) => _.find(sdf, { index: x })); + return map(map(prc, "primary_key_val"), (x) => find(sdf, { index: x })); } export function extractSingleSeriesSummary( @@ -87,15 +87,15 @@ export function extractSingleSeriesSummary( ] }, - data: _.filter( - _.map(full_summary_stats_df, (row) => _.pick(row, ["index", col_name])), + data: filter( + map(full_summary_stats_df, (row) => pick(row, ["index", col_name])), { index: "dtype" }, ), }; } export const getFieldVal = (f:ColumnConfig) : string => { - if(_.has(f, 'col_path')){ + if(has(f, 'col_path')){ return (f as MultiIndexColumnConfig).field; } return (f as NormalColumnConfig).col_name; @@ -125,12 +125,12 @@ export function normalColToColDef (f:NormalColumnConfig) : ColDef { export const getSubChildren = (arr:ColumnConfig[], level:number): ColumnConfig[][] => { const keyFunc = (x:ColumnConfig) => { - if(_.has(x, 'col_path')) { + if(has(x, 'col_path')) { const xMICC: MultiIndexColumnConfig = x as MultiIndexColumnConfig return xMICC.col_path[level] } const xNCC: NormalColumnConfig = x as NormalColumnConfig; - return xNCC.col_name + "!&single" + _.indexOf(arr, x).toString(); // bad magic value + return xNCC.col_name + "!&single" + indexOf(arr, x).toString(); // bad magic value } return arr.reduce((acc: ColumnConfig[][], curr:ColumnConfig) => { @@ -179,7 +179,7 @@ export function multiIndexColToColDef (f:MultiIndexColumnConfig[], level:number= if(rootDepth == 1) { const colDef: ColGroupDef = { //headerName: rootHeader, - children: _.map(f, (x) => childColDef(x, 0)), + children: map(f, (x) => childColDef(x, 0)), ...(f[0].ag_grid_specs) }; @@ -190,7 +190,7 @@ export function multiIndexColToColDef (f:MultiIndexColumnConfig[], level:number= if (childLevel == (rootDepth -1)) { const colDef: ColGroupDef = { headerName: rootHeader, - children: _.map(f, (x) => childColDef(x, childLevel)), + children: map(f, (x) => childColDef(x, childLevel)), ...(f[0].ag_grid_specs) }; console.log(" colDef from multiIndexColToColDef", colDef) @@ -199,7 +199,7 @@ export function multiIndexColToColDef (f:MultiIndexColumnConfig[], level:number= const groupedColumnConfigs = getSubChildren(f, childLevel); const colDef: ColGroupDef = { headerName: rootHeader, - children: _.map(groupedColumnConfigs, (x) => multiIndexColToColDef(x as MultiIndexColumnConfig[], childLevel)), + children: map(groupedColumnConfigs, (x) => multiIndexColToColDef(x as MultiIndexColumnConfig[], childLevel)), ...(f[0].ag_grid_specs) }; console.log(" colDef from multiIndexColToColDef", colDef) @@ -213,7 +213,7 @@ const switchToColDef = (x:ColumnConfig[]): ColDef|ColGroupDef => { //neverp throw new Error("x shouldn't be empty"); } - if(_.has(x[0], 'col_path')) { + if(has(x[0], 'col_path')) { return multiIndexColToColDef(x as MultiIndexColumnConfig[]) } else { if (x.length > 1) { @@ -224,7 +224,7 @@ const switchToColDef = (x:ColumnConfig[]): ColDef|ColGroupDef => { } export function mergeCellClass( cOrig:ColDef|ColGroupDef, classSpec:"headerClass"|"cellClass", extraClass:string) : ColDef|ColGroupDef { - const c = _.cloneDeep(cOrig); + const c = cloneDeep(cOrig); //@ts-ignore if(c[classSpec] === undefined) { //@ts-ignore @@ -232,7 +232,7 @@ export function mergeCellClass( } else { console.log("c", c, classSpec) //@ts-ignore - if(_.isArray(c[classSpec])) { + if(isArray(c[classSpec])) { //@ts-ignore c[classSpec].push(extraClass) } else { @@ -297,11 +297,11 @@ export function getCellRendererSelector(pinned_rows: PinnedRowConfig[], column_c return (params: ICellRendererParams): CellRendererSelectorResult | undefined => { if (params.node.rowPinned) { - const pk = _.get(params.node.data, "index"); + const pk = get(params.node.data, "index"); if (pk === undefined) { return anyRenderer; // default renderer } - const maybePrc: PinnedRowConfig | undefined = _.find(pinned_rows, { + const maybePrc: PinnedRowConfig | undefined = find(pinned_rows, { primary_key_val: pk, }); if (maybePrc === undefined) { @@ -311,7 +311,7 @@ export function getCellRendererSelector(pinned_rows: PinnedRowConfig[], column_c const currentCol = params.column?.getColId(); if ( (prc.default_renderer_columns === undefined && currentCol === "index") || - _.includes(prc.default_renderer_columns, currentCol) + includes(prc.default_renderer_columns, currentCol) ) { return anyRenderer; } @@ -348,19 +348,19 @@ export function extractSDFT(summaryStatsDf: DFData): SDFT { /* histogram_bins are special cased because of how they are passed to rendereres in pinned_rows I think */ - const maybeHistogramBins = _.find(summaryStatsDf, { index: "histogram_bins" }) || {}; - const maybeHistogramLogBins = _.find(summaryStatsDf, { index: "histogram_log_bins" }) || {}; - const allColumns: string[] = _.without( - _.union(_.keys(maybeHistogramBins), _.keys(maybeHistogramLogBins)), + const maybeHistogramBins = find(summaryStatsDf, { index: "histogram_bins" }) || {}; + const maybeHistogramLogBins = find(summaryStatsDf, { index: "histogram_log_bins" }) || {}; + const allColumns: string[] = without( + union(keys(maybeHistogramBins), keys(maybeHistogramLogBins)), "index", ); - const vals: SDFMeasure[] = _.map(allColumns, (colName) => { + const vals: SDFMeasure[] = map(allColumns, (colName) => { return { - histogram_bins: _.get(maybeHistogramBins, colName, []) as number[], - histogram_log_bins: _.get(maybeHistogramLogBins, colName, []) as number[], + histogram_bins: get(maybeHistogramBins, colName, []) as number[], + histogram_log_bins: get(maybeHistogramLogBins, colName, []) as number[], }; }); - return _.zipObject(allColumns, vals) as SDFT; + return zipObject(allColumns, vals) as SDFT; } export const getPayloadKey = (payloadArgs: PayloadArgs): string => { diff --git a/packages/buckaroo-js-core/src/components/DependentTabs.tsx b/packages/buckaroo-js-core/src/components/DependentTabs.tsx index 8318cb04..be6f34b8 100644 --- a/packages/buckaroo-js-core/src/components/DependentTabs.tsx +++ b/packages/buckaroo-js-core/src/components/DependentTabs.tsx @@ -1,6 +1,5 @@ import React, { useState, CSSProperties, Dispatch, SetStateAction } from "react"; import { DFWhole, EmptyDf } from "./DFViewerParts/DFWhole"; -import _ from "lodash"; import { Operation } from "./OperationUtils"; export function OperationDisplayer({ diff --git a/packages/buckaroo-js-core/src/components/OperationDetail.tsx b/packages/buckaroo-js-core/src/components/OperationDetail.tsx index 60f684a8..fe65b606 100644 --- a/packages/buckaroo-js-core/src/components/OperationDetail.tsx +++ b/packages/buckaroo-js-core/src/components/OperationDetail.tsx @@ -1,4 +1,4 @@ -import _ from "lodash"; +import { get, isArray, isEqual, isString } from "lodash-es"; import { Operation, SettableArg, OperationEventFunc } from "./OperationUtils"; import { ActualArg, CommandArgSpec } from "./CommandUtils"; import { objWithoutNull, replaceAtIdx, replaceAtKey } from "./utils"; @@ -20,10 +20,10 @@ export const OperationDetail = ({ const commandName = command[0]["symbol"]; const pattern = commandPatterns[commandName]; - if (!_.isArray(pattern)) { + if (!isArray(pattern)) { //we shouldn't get here return

unknown command {commandName}

; - } else if (_.isEqual(pattern, [null])) { + } else if (isEqual(pattern, [null])) { return
; } else { const fullPattern = pattern as ActualArg[]; @@ -92,7 +92,7 @@ const ArgGetter = ({ const [_argPos, label, argType, lastArg] = argProps; const defaultShim = (event: { target: { value: SettableArg } }) => setter(event.target.value); - if (argType === "enum" && _.isArray(lastArg)) { + if (argType === "enum" && isArray(lastArg)) { return (
@@ -155,7 +155,7 @@ const ArgGetter = ({ const widgetRow = columns.map((colName: string) => { const colSetter = (event: { target: { value: any } }) => { const newColVal = event.target.value; - if (_.isString(newColVal)) { + if (isString(newColVal)) { const updatedColDict = replaceAtKey( val as Record, colName, @@ -164,8 +164,8 @@ const ArgGetter = ({ setter(objWithoutNull(updatedColDict, ["null"])); } }; - const colVal = _.get(val, colName, "null"); - if (!_.isArray(lastArg)) { + const colVal = get(val, colName, "null"); + if (!isArray(lastArg)) { return

arg error

; } return ( diff --git a/packages/buckaroo-js-core/src/components/OperationUtils.ts b/packages/buckaroo-js-core/src/components/OperationUtils.ts index 29a51326..0bb55227 100644 --- a/packages/buckaroo-js-core/src/components/OperationUtils.ts +++ b/packages/buckaroo-js-core/src/components/OperationUtils.ts @@ -1,7 +1,6 @@ /* used for manipulating the JSON Flavored lisp of operations and commands */ -import _ from "lodash"; import { SymbolT, ColEnumArgs, SymbolDf, symDf } from "./CommandUtils"; export const sym = (symbolName: string) => { diff --git a/packages/buckaroo-js-core/src/components/Operations.tsx b/packages/buckaroo-js-core/src/components/Operations.tsx index 91558522..5cebd4cb 100644 --- a/packages/buckaroo-js-core/src/components/Operations.tsx +++ b/packages/buckaroo-js-core/src/components/Operations.tsx @@ -1,5 +1,5 @@ import { useState } from "react"; -import _ from "lodash"; +import { keys, map, merge } from "lodash-es"; import { Operation, SetOperationsFunc, OperationEventFunc } from "./OperationUtils"; import { CommandConfigT } from "./CommandUtils"; import { replaceInArr } from "./utils"; @@ -32,7 +32,7 @@ export const OperationAdder = ({
Column: {column}
- {_.keys(defaultArgs).map((optionVal) => ( + {keys(defaultArgs).map((optionVal) => (