@macrostrat/data-sheet 4.9.1 → 4.10.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (63) hide show
  1. package/CHANGELOG.md +71 -31
  2. package/dist/actions/selection.cjs +5 -1
  3. package/dist/actions/selection.cjs.map +1 -1
  4. package/dist/actions/selection.d.ts +7 -1
  5. package/dist/actions/selection.js +5 -1
  6. package/dist/actions/selection.js.map +1 -1
  7. package/dist/components/data-editor.cjs +11 -3
  8. package/dist/components/data-editor.cjs.map +1 -1
  9. package/dist/components/data-editor.js +11 -3
  10. package/dist/components/data-editor.js.map +1 -1
  11. package/dist/components/editor-actions.cjs +1 -1
  12. package/dist/components/editor-actions.cjs.map +1 -1
  13. package/dist/components/editor-actions.js +2 -2
  14. package/dist/components/editor-actions.js.map +1 -1
  15. package/dist/components/indicators/unified-filters.cjs +3 -0
  16. package/dist/components/indicators/unified-filters.cjs.map +1 -1
  17. package/dist/components/indicators/unified-filters.js +3 -0
  18. package/dist/components/indicators/unified-filters.js.map +1 -1
  19. package/dist/components/toolbars/actions-toolbar.cjs +5 -2
  20. package/dist/components/toolbars/actions-toolbar.cjs.map +1 -1
  21. package/dist/components/toolbars/actions-toolbar.js +6 -3
  22. package/dist/components/toolbars/actions-toolbar.js.map +1 -1
  23. package/dist/data-sheet.cjs +4 -0
  24. package/dist/data-sheet.cjs.map +1 -1
  25. package/dist/data-sheet.css +38 -22
  26. package/dist/data-sheet.js +4 -0
  27. package/dist/data-sheet.js.map +1 -1
  28. package/dist/index.cjs +15 -14
  29. package/dist/index.cjs.map +1 -1
  30. package/dist/index.js +2 -1
  31. package/dist/main.module.sass.cjs +14 -14
  32. package/dist/main.module.sass.js +14 -14
  33. package/dist/provider/column-spec.cjs.map +1 -1
  34. package/dist/provider/column-spec.d.ts +8 -0
  35. package/dist/provider/column-spec.js.map +1 -1
  36. package/dist/provider/types.cjs.map +1 -1
  37. package/dist/provider/types.d.ts +6 -0
  38. package/dist/provider/types.js.map +1 -1
  39. package/dist/provider/zustand-store.cjs +9 -2
  40. package/dist/provider/zustand-store.cjs.map +1 -1
  41. package/dist/provider/zustand-store.js +9 -2
  42. package/dist/provider/zustand-store.js.map +1 -1
  43. package/dist/renderers/cell-renderer.cjs +9 -2
  44. package/dist/renderers/cell-renderer.cjs.map +1 -1
  45. package/dist/renderers/cell-renderer.js +9 -2
  46. package/dist/renderers/cell-renderer.js.map +1 -1
  47. package/dist/utils/key-handling.cjs +6 -5
  48. package/dist/utils/key-handling.cjs.map +1 -1
  49. package/dist/utils/key-handling.js +2 -1
  50. package/dist/utils/key-handling.js.map +1 -1
  51. package/package.json +2 -2
  52. package/src/actions/selection.ts +11 -2
  53. package/src/components/data-editor.ts +17 -2
  54. package/src/components/editor-actions.ts +5 -2
  55. package/src/components/indicators/unified-filters.ts +3 -0
  56. package/src/components/toolbars/actions-toolbar.ts +10 -4
  57. package/src/data-sheet.ts +6 -0
  58. package/src/main.module.sass +14 -0
  59. package/src/provider/column-spec.ts +8 -0
  60. package/src/provider/types.ts +10 -1
  61. package/src/provider/zustand-store.ts +9 -2
  62. package/src/renderers/cell-renderer.ts +12 -0
  63. package/src/utils/key-handling.ts +2 -1
@@ -1 +1 @@
1
- {"version":3,"file":"actions-toolbar.cjs","sources":["../../../src/components/toolbars/actions-toolbar.ts"],"sourcesContent":["import { Button, ButtonGroup, PopoverNext } from \"@blueprintjs/core\";\nimport { type ReactNode, useCallback, useMemo, useState } from \"react\";\nimport h from \"./actions-toolbar.module.sass\";\nimport { ctx, selectionAtom, useSelector } from \"../../provider\";\nimport {\n getApplicableActions,\n getSelectionCardinality,\n mergeColumnActions,\n buildActionContext,\n TableActionContext,\n runActionWrapper,\n type TableAction,\n} from \"../../actions\";\nimport { RegionCardinality } from \"@blueprintjs/table\";\nimport { useToaster } from \"../../notifications.ts\";\nimport type { ColumnSpec } from \"../../provider\";\nimport { SelectionIndicator } from \"../index.ts\";\n\n/** Toolbar that renders the actions/controls applicable to the current\n * selection cardinality (modal by selection) and edit mode. Actions with a\n * `render` show their live control; others show a button (with an optional\n * `detailsForm` popover). Column-specific actions from `ColumnSpec.actions`\n * are merged when their columns are selected. A capsule on the left shows the\n * current selection polarity. */\nexport function ActionsToolbar<T>({\n actions: _actions,\n children,\n className,\n compact = false,\n}: {\n actions: TableAction<T>[];\n tableName?: string;\n children: ReactNode;\n className?: string;\n compact: boolean;\n}) {\n const selection = ctx.useValue(selectionAtom);\n const editable = useSelector((state) => state.editable);\n const columnSpec = useSelector((state) => state.columnSpec);\n\n const actionIDs = new Set(_actions.map((a) => a.id));\n const actions = useMemo(() => _actions, [actionIDs]);\n\n const cardinality = useMemo(\n () => getSelectionCardinality(selection) ?? RegionCardinality.FULL_TABLE,\n [selection],\n );\n\n // Merge global actions with column-specific actions from the selection\n const allActions = useMemo(\n () => mergeColumnActions(actions, columnSpec, selection),\n [actions, columnSpec, selection],\n );\n\n const applicableActions = useMemo(\n () => getApplicableActions(allActions, cardinality, editable),\n [allActions, cardinality, editable],\n );\n\n const store = ctx.useStore();\n // Context for `render`-style controls (they subscribe to the store\n // themselves; this resolves the selected column/rows).\n const actionContext = useMemo(() => {\n return buildActionContext(store.get, store.set);\n }, [allActions]);\n\n // The toolbar is for actions that AREN'T keyboard-accessible: any action\n // with a `hotkey` (copy/cut/paste, etc.) is reachable from the keyboard and\n // is omitted here (it still works via its shortcut). Then refine by selection\n // shape beyond cardinality (e.g. single column only).\n const shownActions = applicableActions.filter(\n (action: TableAction<T, any>) =>\n action.hotkey == null &&\n (action.appliesTo?.(actionContext as any) ?? true),\n );\n\n const toolbarIsShown = useMemo(\n () => hasAnyDisplayableActions(actions, columnSpec),\n [actions, columnSpec],\n );\n\n // Render whenever there are displayable actions OR the consumer supplied\n // custom toolbar chrome (`children`) — a facet-less panel (e.g. a card list\n // with only a search box) still needs its toolbar slot to appear.\n if (!toolbarIsShown && children == null) {\n return null;\n }\n\n // Order left→right by generality: actions that require editing\n // are \"global\" and sit after a spacer on the right (Save /\n // Reset); everything else is contextual and stays on the left. So the left\n // edge tracks the selection and the right edge is constant.\n const isGlobal = (a: TableAction<T>) =>\n a.placement === \"end\" ||\n ((a.targets.includes(RegionCardinality.FULL_TABLE) ||\n a.targets.includes(\"none\" as any)) &&\n a.requiresEditable);\n const contextual = shownActions.filter((a) => !isGlobal(a));\n // Order the built-in global actions least→most impactful, left→right: reset\n // changes, then save. Any other global actions keep their natural order to\n // the left of these (stable sort, rank 0).\n\n const globalActions = shownActions.filter(isGlobal);\n\n return h(\"div.actions-toolbar\", { className }, [\n h(SelectionIndicator, { minimal: compact }),\n h(\n \"div.toolbar-group.contextual\",\n contextual.map((action) =>\n h(ActionButton, { key: action.id, action, ctx: actionContext }),\n ),\n ),\n children,\n h(\"div.toolbar-spacer\", { style: { flex: 1 } }),\n h(\n ButtonGroup,\n { minimal: true },\n globalActions.map((action) =>\n h(ActionButton, { key: action.id, action, ctx: actionContext }),\n ),\n ),\n ]);\n}\n\nfunction isActionDisabled(action: TableAction, state: any): boolean {\n if (typeof action.disabled === \"boolean\") return action.disabled;\n if (typeof action.disabled === \"function\") {\n return action.disabled(state);\n }\n return false;\n}\n\n/** Dispatcher: a live control (`action.render`) or a run/detailsForm button.\n * Kept hook-free so the two paths don't share a hook order. */\nfunction ActionButton<T>({\n action,\n ctx,\n}: {\n action: TableAction<T>;\n ctx: TableActionContext<T>;\n}) {\n if (action.render != null) {\n return action.render(ctx) as any;\n }\n return h(RunActionButton, { action });\n}\n\n/** A run/detailsForm action rendered as a button. */\nfunction RunActionButton<T>({ action }: { action: TableAction<T> }) {\n const store = ctx.useStore();\n const toaster = useToaster();\n\n // Reactive disabled check — re-renders when relevant state changes\n const isDisabled = useSelector((state) => {\n return isActionDisabled(action, state);\n });\n\n const runAction = useCallback(\n (configState?: any) => {\n runActionWrapper(action, store.get, store.set, toaster, configState);\n },\n [action, toaster],\n );\n\n if (action.detailsForm != null) {\n return h(ActionButtonWithForm, { action, runAction, isDisabled });\n }\n\n return h(\n Button,\n {\n // Minimal + small to match the toolbar's other controls (scroll-to-row,\n // sort/filter tags) — the compact, minimal house style.\n minimal: true,\n small: true,\n icon: action.icon,\n intent: action.intent,\n disabled: isDisabled,\n onClick() {\n runAction();\n },\n },\n action.name,\n );\n}\n\n/** Action button that opens a popover for pre-run configuration. */\nfunction ActionButtonWithForm<T, S>({\n action,\n runAction,\n isDisabled,\n}: {\n action: TableAction<T, S>;\n runAction: (configState?: S) => void;\n isDisabled: boolean;\n}) {\n const [configState, setConfigState] = useState<S>(\n action.defaultState ?? (null as S),\n );\n const [isOpen, setIsOpen] = useState(false);\n\n let ready = true;\n if (action.isReady != null) {\n ready = action.isReady(configState);\n }\n\n return h(\n PopoverNext,\n {\n isOpen,\n onClose: () => setIsOpen(false),\n content: h(\"div.action-popover-content\", [\n h.if(action.description != null)(\"p.description\", action.description),\n h(action.detailsForm as any, {\n state: configState,\n setState: setConfigState,\n }),\n h(\n Button,\n {\n className: \"run-button\",\n intent: action.intent ?? \"primary\",\n icon: \"play\",\n disabled: !ready,\n fill: true,\n onClick() {\n runAction(configState);\n setIsOpen(false);\n },\n },\n \"Run\",\n ),\n ]),\n placement: \"bottom-start\",\n enforceFocus: false,\n autoFocus: false,\n },\n h(\n Button,\n {\n minimal: true,\n small: true,\n icon: action.icon,\n intent: action.intent,\n disabled: isDisabled,\n onClick: () => setIsOpen(!isOpen),\n },\n action.name,\n ),\n );\n}\n\nfunction hasAnyDisplayableActions(\n actions: TableAction[],\n columnSpec: ColumnSpec[],\n) {\n /** Check whether there are any actions that can be displayed in the toolbar.\n * for the entire table. This is used to determine whether the toolbar should\n * be rendered. If any actions are available, the toolbar is rendered in ALL\n * selection modes to avoid flickering\n */\n const allActions = [\n ...actions,\n ...columnSpec.flatMap((c) => c.actions ?? []),\n ];\n\n if (allActions.length === 0) {\n return false;\n }\n // Check whether any action doesn't have hotkey and is not disabled\n return allActions.some(\n (action) => action.hotkey == null && !isActionDisabled(action, {}),\n );\n}\n"],"names":["selection","ctx","selectionAtom","useSelector","useMemo","getSelectionCardinality","RegionCardinality","mergeColumnActions","getApplicableActions","buildActionContext","h","SelectionIndicator","ButtonGroup","useToaster","useCallback","runActionWrapper","Button","useState","PopoverNext"],"mappings":";;;;;;;;;;;;AAwBO,SAAS,eAAkB;AAAA,EAChC,SAAS;AAAA,EACT;AAAA,EACA;AAAA,EACA,UAAU;AACZ,GAMG;AACD,QAAMA,cAAYC,KAAAA,IAAI,SAASC,uBAAa;AAC5C,QAAM,WAAWC,KAAAA,YAAY,CAAC,UAAU,MAAM,QAAQ;AACtD,QAAM,aAAaA,KAAAA,YAAY,CAAC,UAAU,MAAM,UAAU;AAE1D,QAAM,YAAY,IAAI,IAAI,SAAS,IAAI,CAAC,MAAM,EAAE,EAAE,CAAC;AACnD,QAAM,UAAUC,MAAAA,QAAQ,MAAM,UAAU,CAAC,SAAS,CAAC;AAEnD,QAAM,cAAcA,MAAAA;AAAAA,IAClB,MAAMC,oCAAwBL,WAAS,KAAKM,MAAAA,kBAAkB;AAAA,IAC9D,CAACN,WAAS;AAAA,EAAA;AAIZ,QAAM,aAAaI,MAAAA;AAAAA,IACjB,MAAMG,+BAAmB,SAAS,YAAYP,WAAS;AAAA,IACvD,CAAC,SAAS,YAAYA,WAAS;AAAA,EAAA;AAGjC,QAAM,oBAAoBI,MAAAA;AAAAA,IACxB,MAAMI,iCAAqB,YAAY,aAAa,QAAQ;AAAA,IAC5D,CAAC,YAAY,aAAa,QAAQ;AAAA,EAAA;AAGpC,QAAM,QAAQP,KAAAA,IAAI,SAAA;AAGlB,QAAM,gBAAgBG,MAAAA,QAAQ,MAAM;AAClC,WAAOK,QAAAA,mBAAmB,MAAM,KAAK,MAAM,GAAG;AAAA,EAChD,GAAG,CAAC,UAAU,CAAC;AAMf,QAAM,eAAe,kBAAkB;AAAA,IACrC,CAAC,WACC,OAAO,UAAU,SAChB,OAAO,YAAY,aAAoB,KAAK;AAAA,EAAA;AAGjD,QAAM,iBAA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R,sBAAAA,QAAE,8BAA8B;AAAA,QACvCA,8BAAE,GAAG,OAAO,eAAe,IAAI,EAAE,iBAAiB,OAAO,WAAW;AAAA,QACpEA,sBAAAA,QAAE,OAAO,aAAoB;AAAA,UAC3B,OAAO;AAAA,UACP,UAAU;AAAA,QAAA,CACX;AAAA,QACDA,sBAAAA;AAAAA,UACEM,OAAAA;AAAAA,UACA;AAAA,YACE,WAAW;AAAA,YACX,QAAQ,OAAO,UAAU;AAAA,YACzB,MAAM;AAAA,YACN,UAAU,CAAC;AAAA,YACX,MAAM;AAAA,YACN,UAAU;AACR,wBAAU,WAAW;AACrB,wBAAU,KAAK;AAAA,YACjB;AAAA,UAAA;AAAA,UAEF;AAAA,QAAA;AAAA,MACF,CACD;AAAA,MACD,WAAW;AAAA,MACX,cAAc;AAAA,MACd,WAAW;AAAA,IAAA;AAAA,IAEbN,sBAAAA;AAAAA,MACEM,OAAAA;AAAAA,MACA;AAAA,QACE,SAAS;AAAA,QACT,OAAO;AAAA,QACP,MAAM,OAAO;AAAA,QACb,QAAQ,OAAO;AAAA,QACf,UAAU;AAAA,QACV,SAAS,MAAM,UAAU,CAAC,MAAM;AAAA,MAAA;AAAA,MAElC,OAAO;AAAA,IAAA;AAAA,EACT;AAEJ;AAEA,SAAS,yBACP,SACA,YACA;AAMA,QAAM,aAAa;AAAA,IACjB,GAAG;AAAA,IACH,GAAG,WAAW,QAAQ,CAAC,MAAM,EAAE,WAAW,CAAA,CAAE;AAAA,EAAA;AAG9C,MAAI,WAAW,WAAW,GAAG;AAC3B,WAAO;AAAA,EACT;AAEA,SAAO,WAAW;AAAA,IAChB,CAAC,WAAW,OAAO,UAAU,QAAQ,CAAC,iBAAiB,QAAQ,CAAA,CAAE;AAAA,EAAA;AAErE;;"}
1
+ {"version":3,"file":"actions-toolbar.cjs","sources":["../../../src/components/toolbars/actions-toolbar.ts"],"sourcesContent":["import { Button, ButtonGroup, PopoverNext } from \"@blueprintjs/core\";\nimport { type ReactNode, useCallback, useMemo, useState } from \"react\";\nimport h from \"./actions-toolbar.module.sass\";\nimport { ctx, selectionAtom, useSelector } from \"../../provider\";\nimport {\n actionRequiresEditable,\n getApplicableActions,\n getSelectionCardinality,\n mergeColumnActions,\n buildActionContext,\n TableActionContext,\n runActionWrapper,\n type TableAction,\n} from \"../../actions\";\nimport { RegionCardinality } from \"@blueprintjs/table\";\nimport { useToaster } from \"../../notifications.ts\";\nimport type { ColumnSpec } from \"../../provider\";\nimport { SelectionIndicator } from \"../index.ts\";\n\n/** Toolbar that renders the actions/controls applicable to the current\n * selection cardinality (modal by selection) and edit mode. Actions with a\n * `render` show their live control; others show a button (with an optional\n * `detailsForm` popover). Column-specific actions from `ColumnSpec.actions`\n * are merged when their columns are selected. A capsule on the left shows the\n * current selection polarity. */\nexport function ActionsToolbar<T>({\n actions: _actions,\n children,\n className,\n compact = false,\n}: {\n actions: TableAction<T>[];\n tableName?: string;\n children: ReactNode;\n className?: string;\n compact: boolean;\n}) {\n const selection = ctx.useValue(selectionAtom);\n const editable = useSelector((state) => state.editable);\n const columnSpec = useSelector((state) => state.columnSpec);\n\n const actionIDs = new Set(_actions.map((a) => a.id));\n const actions = useMemo(() => _actions, [actionIDs]);\n\n const cardinality = useMemo(\n () => getSelectionCardinality(selection) ?? RegionCardinality.FULL_TABLE,\n [selection],\n );\n\n // Merge global actions with column-specific actions from the selection\n const allActions = useMemo(\n () => mergeColumnActions(actions, columnSpec, selection),\n [actions, columnSpec, selection],\n );\n\n const applicableActions = useMemo(\n () => getApplicableActions(allActions, cardinality, editable),\n [allActions, cardinality, editable],\n );\n\n const store = ctx.useStore();\n // The context snapshots the store, so it is rebuilt when what it resolves\n // changes: the selection (through `allActions`), and the rows. Keyed on the\n // selection alone, a selection made together with new rows — an inserted\n // row, selected as it arrives — resolved against the rows before it.\n const data = useSelector((state) => state.data);\n const updatedData = useSelector((state) => state.updatedData);\n const filteredRowIndices = useSelector((state) => state.filteredRowIndices);\n const actionContext = useMemo(() => {\n return buildActionContext(store.get, store.set);\n }, [allActions, data, updatedData, filteredRowIndices]);\n\n // The toolbar is for actions that AREN'T keyboard-accessible: any action\n // with a `hotkey` (copy/cut/paste, etc.) is reachable from the keyboard and\n // is omitted here (it still works via its shortcut). Then refine by selection\n // shape beyond cardinality (e.g. single column only).\n const shownActions = applicableActions.filter(\n (action: TableAction<T, any>) =>\n action.hotkey == null &&\n (action.appliesTo?.(actionContext as any) ?? true),\n );\n\n const toolbarIsShown = useMemo(\n () => hasAnyDisplayableActions(actions, columnSpec),\n [actions, columnSpec],\n );\n\n // Render whenever there are displayable actions OR the consumer supplied\n // custom toolbar chrome (`children`) — a facet-less panel (e.g. a card list\n // with only a search box) still needs its toolbar slot to appear.\n if (!toolbarIsShown && children == null) {\n return null;\n }\n\n // Order left→right by generality: actions that require editing\n // are \"global\" and sit after a spacer on the right (Save /\n // Reset); everything else is contextual and stays on the left. So the left\n // edge tracks the selection and the right edge is constant.\n const isGlobal = (a: TableAction<T>) =>\n a.placement === \"end\" ||\n ((a.targets.includes(RegionCardinality.FULL_TABLE) ||\n a.targets.includes(\"none\" as any)) &&\n actionRequiresEditable(a));\n const contextual = shownActions.filter((a) => !isGlobal(a));\n // Order the built-in global actions least→most impactful, left→right: reset\n // changes, then save. Any other global actions keep their natural order to\n // the left of these (stable sort, rank 0).\n\n const globalActions = shownActions.filter(isGlobal);\n\n return h(\"div.actions-toolbar\", { className }, [\n h(SelectionIndicator, { minimal: compact }),\n h(\n \"div.toolbar-group.contextual\",\n contextual.map((action) =>\n h(ActionButton, { key: action.id, action, ctx: actionContext }),\n ),\n ),\n children,\n h(\"div.toolbar-spacer\", { style: { flex: 1 } }),\n h(\n ButtonGroup,\n { minimal: true },\n globalActions.map((action) =>\n h(ActionButton, { key: action.id, action, ctx: actionContext }),\n ),\n ),\n ]);\n}\n\nfunction isActionDisabled(action: TableAction, state: any): boolean {\n if (typeof action.disabled === \"boolean\") return action.disabled;\n if (typeof action.disabled === \"function\") {\n return action.disabled(state);\n }\n return false;\n}\n\n/** Dispatcher: a live control (`action.render`) or a run/detailsForm button.\n * Kept hook-free so the two paths don't share a hook order. */\nfunction ActionButton<T>({\n action,\n ctx,\n}: {\n action: TableAction<T>;\n ctx: TableActionContext<T>;\n}) {\n if (action.render != null) {\n return action.render(ctx) as any;\n }\n return h(RunActionButton, { action });\n}\n\n/** A run/detailsForm action rendered as a button. */\nfunction RunActionButton<T>({ action }: { action: TableAction<T> }) {\n const store = ctx.useStore();\n const toaster = useToaster();\n\n // Reactive disabled check — re-renders when relevant state changes\n const isDisabled = useSelector((state) => {\n return isActionDisabled(action, state);\n });\n\n const runAction = useCallback(\n (configState?: any) => {\n runActionWrapper(action, store.get, store.set, toaster, configState);\n },\n [action, toaster],\n );\n\n if (action.detailsForm != null) {\n return h(ActionButtonWithForm, { action, runAction, isDisabled });\n }\n\n return h(\n Button,\n {\n // Minimal + small to match the toolbar's other controls (scroll-to-row,\n // sort/filter tags) — the compact, minimal house style.\n minimal: true,\n small: true,\n icon: action.icon,\n intent: action.intent,\n disabled: isDisabled,\n onClick() {\n runAction();\n },\n },\n action.name,\n );\n}\n\n/** Action button that opens a popover for pre-run configuration. */\nfunction ActionButtonWithForm<T, S>({\n action,\n runAction,\n isDisabled,\n}: {\n action: TableAction<T, S>;\n runAction: (configState?: S) => void;\n isDisabled: boolean;\n}) {\n const [configState, setConfigState] = useState<S>(\n action.defaultState ?? (null as S),\n );\n const [isOpen, setIsOpen] = useState(false);\n\n let ready = true;\n if (action.isReady != null) {\n ready = action.isReady(configState);\n }\n\n return h(\n PopoverNext,\n {\n isOpen,\n onClose: () => setIsOpen(false),\n content: h(\"div.action-popover-content\", [\n h.if(action.description != null)(\"p.description\", action.description),\n h(action.detailsForm as any, {\n state: configState,\n setState: setConfigState,\n }),\n h(\n Button,\n {\n className: \"run-button\",\n intent: action.intent ?? \"primary\",\n icon: \"play\",\n disabled: !ready,\n fill: true,\n onClick() {\n runAction(configState);\n setIsOpen(false);\n },\n },\n \"Run\",\n ),\n ]),\n placement: \"bottom-start\",\n enforceFocus: false,\n autoFocus: false,\n },\n h(\n Button,\n {\n minimal: true,\n small: true,\n icon: action.icon,\n intent: action.intent,\n disabled: isDisabled,\n onClick: () => setIsOpen(!isOpen),\n },\n action.name,\n ),\n );\n}\n\nfunction hasAnyDisplayableActions(\n actions: TableAction[],\n columnSpec: ColumnSpec[],\n) {\n /** Check whether there are any actions that can be displayed in the toolbar.\n * for the entire table. This is used to determine whether the toolbar should\n * be rendered. If any actions are available, the toolbar is rendered in ALL\n * selection modes to avoid flickering\n */\n const allActions = [\n ...actions,\n ...columnSpec.flatMap((c) => c.actions ?? []),\n ];\n\n if (allActions.length === 0) {\n return false;\n }\n // Check whether any action doesn't have hotkey and is not disabled\n return allActions.some(\n (action) => action.hotkey == null && !isActionDisabled(action, {}),\n );\n}\n"],"names":["selection","ctx","selectionAtom","useSelector","useMemo","getSelectionCardinality","RegionCardinality","mergeColumnActions","getApplicableActions","buildActionContext","actionRequiresEditable","h","SelectionIndicator","ButtonGroup","useToaster","useCallback","runActionWrapper","Button","useState","PopoverNext"],"mappings":";;;;;;;;;;;;AAyBO,SAAS,eAAkB;AAAA,EAChC,SAAS;AAAA,EACT;AAAA,EACA;AAAA,EACA,UAAU;AACZ,GAMG;AACD,QAAMA,cAAYC,KAAAA,IAAI,SAASC,uBAAa;AAC5C,QAAM,WAAWC,KAAAA,YAAY,CAAC,UAAU,MAAM,QAAQ;AACtD,QAAM,aAAaA,KAAAA,YAAY,CAAC,UAAU,MAAM,UAAU;AAE1D,QAAM,YAAY,IAAI,IAAI,SAAS,IAAI,CAAC,MAAM,EAAE,EAAE,CAAC;AACnD,QAAM,UAAUC,MAAAA,QAAQ,MAAM,UAAU,CAAC,SAAS,CAAC;AAEnD,QAAM,cAAcA,MAAAA;AAAAA,IAClB,MAAMC,oCAAwBL,WAAS,KAAKM,MAAAA,kBAAkB;AAAA,IAC9D,CAACN,WAAS;AAAA,EAAA;AAIZ,QAAM,aAAaI,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AAW;AAAA,MACX,cAAc;AAAA,MACd,WAAW;AAAA,IAAA;AAAA,IAEbN,sBAAAA;AAAAA,MACEM,OAAAA;AAAAA,MACA;AAAA,QACE,SAAS;AAAA,QACT,OAAO;AAAA,QACP,MAAM,OAAO;AAAA,QACb,QAAQ,OAAO;AAAA,QACf,UAAU;AAAA,QACV,SAAS,MAAM,UAAU,CAAC,MAAM;AAAA,MAAA;AAAA,MAElC,OAAO;AAAA,IAAA;AAAA,EACT;AAEJ;AAEA,SAAS,yBACP,SACA,YACA;AAMA,QAAM,aAAa;AAAA,IACjB,GAAG;AAAA,IACH,GAAG,WAAW,QAAQ,CAAC,MAAM,EAAE,WAAW,CAAA,CAAE;AAAA,EAAA;AAG9C,MAAI,WAAW,WAAW,GAAG;AAC3B,WAAO;AAAA,EACT;AAEA,SAAO,WAAW;AAAA,IAChB,CAAC,WAAW,OAAO,UAAU,QAAQ,CAAC,iBAAiB,QAAQ,CAAA,CAAE;AAAA,EAAA;AAErE;;"}
@@ -3,7 +3,7 @@ import { useMemo, useCallback, useState } from "react";
3
3
  import h from "./actions-toolbar.module.sass.js";
4
4
  import { RegionCardinality } from "@blueprintjs/table";
5
5
  import { useToaster } from "../../notifications.js";
6
- import { getSelectionCardinality, mergeColumnActions, getApplicableActions } from "../../actions/selection.js";
6
+ import { getSelectionCardinality, mergeColumnActions, getApplicableActions, actionRequiresEditable } from "../../actions/selection.js";
7
7
  import { buildActionContext, runActionWrapper } from "../../actions/context.js";
8
8
  import { SelectionIndicator } from "../indicators/selection.js";
9
9
  import { ctx, useSelector } from "../../provider/core.js";
@@ -32,9 +32,12 @@ function ActionsToolbar({
32
32
  [allActions, cardinality, editable]
33
33
  );
34
34
  const store = ctx.useStore();
35
+ const data = useSelector((state) => state.data);
36
+ const updatedData = useSelector((state) => state.updatedData);
37
+ const filteredRowIndices = useSelector((state) => state.filteredRowIndices);
35
38
  const actionContext = useMemo(() => {
36
39
  return buildActionContext(store.get, store.set);
37
- }, [allActions]);
40
+ }, [allActions, data, updatedData, filteredRowIndices]);
38
41
  const shownActions = applicableActions.filter(
39
42
  (action) => action.hotkey == null && (action.appliesTo?.(actionContext) ?? true)
40
43
  );
@@ -45,7 +48,7 @@ function ActionsToolbar({
45
48
  if (!toolbarIsShown && children == null) {
46
49
  return null;
47
50
  }
48
- const isGlobal = (a) => a.placement === "end" || (a.targets.includes(RegionCardinality.FULL_TABLE) || a.targets.includes("none")) && a.requiresEditable;
51
+ const isGlobal = (a) => a.placement === "end" || (a.targets.includes(RegionCardinality.FULL_TABLE) || a.targets.includes("none")) && actionRequiresEditable(a);
49
52
  const contextual = shownActions.filter((a) => !isGlobal(a));
50
53
  const globalActions = shownActions.filter(isGlobal);
51
54
  return h("div.actions-toolbar", { className }, [
@@ -1 +1 @@
1
- {"version":3,"file":"actions-toolbar.js","sources":["../../../src/components/toolbars/actions-toolbar.ts"],"sourcesContent":["import { Button, ButtonGroup, PopoverNext } from \"@blueprintjs/core\";\nimport { type ReactNode, useCallback, useMemo, useState } from \"react\";\nimport h from \"./actions-toolbar.module.sass\";\nimport { ctx, selectionAtom, useSelector } from \"../../provider\";\nimport {\n getApplicableActions,\n getSelectionCardinality,\n mergeColumnActions,\n buildActionContext,\n TableActionContext,\n runActionWrapper,\n type TableAction,\n} from \"../../actions\";\nimport { RegionCardinality } from \"@blueprintjs/table\";\nimport { useToaster } from \"../../notifications.ts\";\nimport type { ColumnSpec } from \"../../provider\";\nimport { SelectionIndicator } from \"../index.ts\";\n\n/** Toolbar that renders the actions/controls applicable to the current\n * selection cardinality (modal by selection) and edit mode. Actions with a\n * `render` show their live control; others show a button (with an optional\n * `detailsForm` popover). Column-specific actions from `ColumnSpec.actions`\n * are merged when their columns are selected. A capsule on the left shows the\n * current selection polarity. */\nexport function ActionsToolbar<T>({\n actions: _actions,\n children,\n className,\n compact = false,\n}: {\n actions: TableAction<T>[];\n tableName?: string;\n children: ReactNode;\n className?: string;\n compact: boolean;\n}) {\n const selection = ctx.useValue(selectionAtom);\n const editable = useSelector((state) => state.editable);\n const columnSpec = useSelector((state) => state.columnSpec);\n\n const actionIDs = new Set(_actions.map((a) => a.id));\n const actions = useMemo(() => _actions, [actionIDs]);\n\n const cardinality = useMemo(\n () => getSelectionCardinality(selection) ?? RegionCardinality.FULL_TABLE,\n [selection],\n );\n\n // Merge global actions with column-specific actions from the selection\n const allActions = useMemo(\n () => mergeColumnActions(actions, columnSpec, selection),\n [actions, columnSpec, selection],\n );\n\n const applicableActions = useMemo(\n () => getApplicableActions(allActions, cardinality, editable),\n [allActions, cardinality, editable],\n );\n\n const store = ctx.useStore();\n // Context for `render`-style controls (they subscribe to the store\n // themselves; this resolves the selected column/rows).\n const actionContext = useMemo(() => {\n return buildActionContext(store.get, store.set);\n }, [allActions]);\n\n // The toolbar is for actions that AREN'T keyboard-accessible: any action\n // with a `hotkey` (copy/cut/paste, etc.) is reachable from the keyboard and\n // is omitted here (it still works via its shortcut). Then refine by selection\n // shape beyond cardinality (e.g. single column only).\n const shownActions = applicableActions.filter(\n (action: TableAction<T, any>) =>\n action.hotkey == null &&\n (action.appliesTo?.(actionContext as any) ?? true),\n );\n\n const toolbarIsShown = useMemo(\n () => hasAnyDisplayableActions(actions, columnSpec),\n [actions, columnSpec],\n );\n\n // Render whenever there are displayable actions OR the consumer supplied\n // custom toolbar chrome (`children`) — a facet-less panel (e.g. a card list\n // with only a search box) still needs its toolbar slot to appear.\n if (!toolbarIsShown && children == null) {\n return null;\n }\n\n // Order left→right by generality: actions that require editing\n // are \"global\" and sit after a spacer on the right (Save /\n // Reset); everything else is contextual and stays on the left. So the left\n // edge tracks the selection and the right edge is constant.\n const isGlobal = (a: TableAction<T>) =>\n a.placement === \"end\" ||\n ((a.targets.includes(RegionCardinality.FULL_TABLE) ||\n a.targets.includes(\"none\" as any)) &&\n a.requiresEditable);\n const contextual = shownActions.filter((a) => !isGlobal(a));\n // Order the built-in global actions least→most impactful, left→right: reset\n // changes, then save. Any other global actions keep their natural order to\n // the left of these (stable sort, rank 0).\n\n const globalActions = shownActions.filter(isGlobal);\n\n return h(\"div.actions-toolbar\", { className }, [\n h(SelectionIndicator, { minimal: compact }),\n h(\n \"div.toolbar-group.contextual\",\n contextual.map((action) =>\n h(ActionButton, { key: action.id, action, ctx: actionContext }),\n ),\n ),\n children,\n h(\"div.toolbar-spacer\", { style: { flex: 1 } }),\n h(\n ButtonGroup,\n { minimal: true },\n globalActions.map((action) =>\n h(ActionButton, { key: action.id, action, ctx: actionContext }),\n ),\n ),\n ]);\n}\n\nfunction isActionDisabled(action: TableAction, state: any): boolean {\n if (typeof action.disabled === \"boolean\") return action.disabled;\n if (typeof action.disabled === \"function\") {\n return action.disabled(state);\n }\n return false;\n}\n\n/** Dispatcher: a live control (`action.render`) or a run/detailsForm button.\n * Kept hook-free so the two paths don't share a hook order. */\nfunction ActionButton<T>({\n action,\n ctx,\n}: {\n action: TableAction<T>;\n ctx: TableActionContext<T>;\n}) {\n if (action.render != null) {\n return action.render(ctx) as any;\n }\n return h(RunActionButton, { action });\n}\n\n/** A run/detailsForm action rendered as a button. */\nfunction RunActionButton<T>({ action }: { action: TableAction<T> }) {\n const store = ctx.useStore();\n const toaster = useToaster();\n\n // Reactive disabled check — re-renders when relevant state changes\n const isDisabled = useSelector((state) => {\n return isActionDisabled(action, state);\n });\n\n const runAction = useCallback(\n (configState?: any) => {\n runActionWrapper(action, store.get, store.set, toaster, configState);\n },\n [action, toaster],\n );\n\n if (action.detailsForm != null) {\n return h(ActionButtonWithForm, { action, runAction, isDisabled });\n }\n\n return h(\n Button,\n {\n // Minimal + small to match the toolbar's other controls (scroll-to-row,\n // sort/filter tags) — the compact, minimal house style.\n minimal: true,\n small: true,\n icon: action.icon,\n intent: action.intent,\n disabled: isDisabled,\n onClick() {\n runAction();\n },\n },\n action.name,\n );\n}\n\n/** Action button that opens a popover for pre-run configuration. */\nfunction ActionButtonWithForm<T, S>({\n action,\n runAction,\n isDisabled,\n}: {\n action: TableAction<T, S>;\n runAction: (configState?: S) => void;\n isDisabled: boolean;\n}) {\n const [configState, setConfigState] = useState<S>(\n action.defaultState ?? (null as S),\n );\n const [isOpen, setIsOpen] = useState(false);\n\n let ready = true;\n if (action.isReady != null) {\n ready = action.isReady(configState);\n }\n\n return h(\n PopoverNext,\n {\n isOpen,\n onClose: () => setIsOpen(false),\n content: h(\"div.action-popover-content\", [\n h.if(action.description != null)(\"p.description\", action.description),\n h(action.detailsForm as any, {\n state: configState,\n setState: setConfigState,\n }),\n h(\n Button,\n {\n className: \"run-button\",\n intent: action.intent ?? \"primary\",\n icon: \"play\",\n disabled: !ready,\n fill: true,\n onClick() {\n runAction(configState);\n setIsOpen(false);\n },\n },\n \"Run\",\n ),\n ]),\n placement: \"bottom-start\",\n enforceFocus: false,\n autoFocus: false,\n },\n h(\n Button,\n {\n minimal: true,\n small: true,\n icon: action.icon,\n intent: action.intent,\n disabled: isDisabled,\n onClick: () => setIsOpen(!isOpen),\n },\n action.name,\n ),\n );\n}\n\nfunction hasAnyDisplayableActions(\n actions: TableAction[],\n columnSpec: ColumnSpec[],\n) {\n /** Check whether there are any actions that can be displayed in the toolbar.\n * for the entire table. This is used to determine whether the toolbar should\n * be rendered. If any actions are available, the toolbar is rendered in ALL\n * selection modes to avoid flickering\n */\n const allActions = [\n ...actions,\n ...columnSpec.flatMap((c) => c.actions ?? []),\n ];\n\n if (allActions.length === 0) {\n return false;\n }\n // Check whether any action doesn't have hotkey and is not disabled\n return allActions.some(\n (action) => action.hotkey == null && !isActionDisabled(action, {}),\n );\n}\n"],"names":["ctx"],"mappings":";;;;;;;;;;AAwBO,SAAS,eAAkB;AAAA,EAChC,SAAS;AAAA,EACT;AAAA,EACA;AAAA,EACA,UAAU;AACZ,GAMG;AACD,QAAM,YAAY,IAAI,SAAS,aAAa;AAC5C,QAAM,WAAW,YAAY,CAAC,UAAU,MAAM,QAAQ;AACtD,QAAM,aAAa,YAAY,CAAC,UAAU,MAAM,UAAU;AAE1D,QAAM,YAAY,IAAI,IAAI,SA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;AAEA,SAAS,yBACP,SACA,YACA;AAMA,QAAM,aAAa;AAAA,IACjB,GAAG;AAAA,IACH,GAAG,WAAW,QAAQ,CAAC,MAAM,EAAE,WAAW,CAAA,CAAE;AAAA,EAAA;AAG9C,MAAI,WAAW,WAAW,GAAG;AAC3B,WAAO;AAAA,EACT;AAEA,SAAO,WAAW;AAAA,IAChB,CAAC,WAAW,OAAO,UAAU,QAAQ,CAAC,iBAAiB,QAAQ,CAAA,CAAE;AAAA,EAAA;AAErE;"}
1
+ {"version":3,"file":"actions-toolbar.js","sources":["../../../src/components/toolbars/actions-toolbar.ts"],"sourcesContent":["import { Button, ButtonGroup, PopoverNext } from \"@blueprintjs/core\";\nimport { type ReactNode, useCallback, useMemo, useState } from \"react\";\nimport h from \"./actions-toolbar.module.sass\";\nimport { ctx, selectionAtom, useSelector } from \"../../provider\";\nimport {\n actionRequiresEditable,\n getApplicableActions,\n getSelectionCardinality,\n mergeColumnActions,\n buildActionContext,\n TableActionContext,\n runActionWrapper,\n type TableAction,\n} from \"../../actions\";\nimport { RegionCardinality } from \"@blueprintjs/table\";\nimport { useToaster } from \"../../notifications.ts\";\nimport type { ColumnSpec } from \"../../provider\";\nimport { SelectionIndicator } from \"../index.ts\";\n\n/** Toolbar that renders the actions/controls applicable to the current\n * selection cardinality (modal by selection) and edit mode. Actions with a\n * `render` show their live control; others show a button (with an optional\n * `detailsForm` popover). Column-specific actions from `ColumnSpec.actions`\n * are merged when their columns are selected. A capsule on the left shows the\n * current selection polarity. */\nexport function ActionsToolbar<T>({\n actions: _actions,\n children,\n className,\n compact = false,\n}: {\n actions: TableAction<T>[];\n tableName?: string;\n children: ReactNode;\n className?: string;\n compact: boolean;\n}) {\n const selection = ctx.useValue(selectionAtom);\n const editable = useSelector((state) => state.editable);\n const columnSpec = useSelector((state) => state.columnSpec);\n\n const actionIDs = new Set(_actions.map((a) => a.id));\n const actions = useMemo(() => _actions, [actionIDs]);\n\n const cardinality = useMemo(\n () => getSelectionCardinality(selection) ?? RegionCardinality.FULL_TABLE,\n [selection],\n );\n\n // Merge global actions with column-specific actions from the selection\n const allActions = useMemo(\n () => mergeColumnActions(actions, columnSpec, selection),\n [actions, columnSpec, selection],\n );\n\n const applicableActions = useMemo(\n () => getApplicableActions(allActions, cardinality, editable),\n [allActions, cardinality, editable],\n );\n\n const store = ctx.useStore();\n // The context snapshots the store, so it is rebuilt when what it resolves\n // changes: the selection (through `allActions`), and the rows. Keyed on the\n // selection alone, a selection made together with new rows — an inserted\n // row, selected as it arrives — resolved against the rows before it.\n const data = useSelector((state) => state.data);\n const updatedData = useSelector((state) => state.updatedData);\n const filteredRowIndices = useSelector((state) => state.filteredRowIndices);\n const actionContext = useMemo(() => {\n return buildActionContext(store.get, store.set);\n }, [allActions, data, updatedData, filteredRowIndices]);\n\n // The toolbar is for actions that AREN'T keyboard-accessible: any action\n // with a `hotkey` (copy/cut/paste, etc.) is reachable from the keyboard and\n // is omitted here (it still works via its shortcut). Then refine by selection\n // shape beyond cardinality (e.g. single column only).\n const shownActions = applicableActions.filter(\n (action: TableAction<T, any>) =>\n action.hotkey == null &&\n (action.appliesTo?.(actionContext as any) ?? true),\n );\n\n const toolbarIsShown = useMemo(\n () => hasAnyDisplayableActions(actions, columnSpec),\n [actions, columnSpec],\n );\n\n // Render whenever there are displayable actions OR the consumer supplied\n // custom toolbar chrome (`children`) — a facet-less panel (e.g. a card list\n // with only a search box) still needs its toolbar slot to appear.\n if (!toolbarIsShown && children == null) {\n return null;\n }\n\n // Order left→right by generality: actions that require editing\n // are \"global\" and sit after a spacer on the right (Save /\n // Reset); everything else is contextual and stays on the left. So the left\n // edge tracks the selection and the right edge is constant.\n const isGlobal = (a: TableAction<T>) =>\n a.placement === \"end\" ||\n ((a.targets.includes(RegionCardinality.FULL_TABLE) ||\n a.targets.includes(\"none\" as any)) &&\n actionRequiresEditable(a));\n const contextual = shownActions.filter((a) => !isGlobal(a));\n // Order the built-in global actions least→most impactful, left→right: reset\n // changes, then save. Any other global actions keep their natural order to\n // the left of these (stable sort, rank 0).\n\n const globalActions = shownActions.filter(isGlobal);\n\n return h(\"div.actions-toolbar\", { className }, [\n h(SelectionIndicator, { minimal: compact }),\n h(\n \"div.toolbar-group.contextual\",\n contextual.map((action) =>\n h(ActionButton, { key: action.id, action, ctx: actionContext }),\n ),\n ),\n children,\n h(\"div.toolbar-spacer\", { style: { flex: 1 } }),\n h(\n ButtonGroup,\n { minimal: true },\n globalActions.map((action) =>\n h(ActionButton, { key: action.id, action, ctx: actionContext }),\n ),\n ),\n ]);\n}\n\nfunction isActionDisabled(action: TableAction, state: any): boolean {\n if (typeof action.disabled === \"boolean\") return action.disabled;\n if (typeof action.disabled === \"function\") {\n return action.disabled(state);\n }\n return false;\n}\n\n/** Dispatcher: a live control (`action.render`) or a run/detailsForm button.\n * Kept hook-free so the two paths don't share a hook order. */\nfunction ActionButton<T>({\n action,\n ctx,\n}: {\n action: TableAction<T>;\n ctx: TableActionContext<T>;\n}) {\n if (action.render != null) {\n return action.render(ctx) as any;\n }\n return h(RunActionButton, { action });\n}\n\n/** A run/detailsForm action rendered as a button. */\nfunction RunActionButton<T>({ action }: { action: TableAction<T> }) {\n const store = ctx.useStore();\n const toaster = useToaster();\n\n // Reactive disabled check — re-renders when relevant state changes\n const isDisabled = useSelector((state) => {\n return isActionDisabled(action, state);\n });\n\n const runAction = useCallback(\n (configState?: any) => {\n runActionWrapper(action, store.get, store.set, toaster, configState);\n },\n [action, toaster],\n );\n\n if (action.detailsForm != null) {\n return h(ActionButtonWithForm, { action, runAction, isDisabled });\n }\n\n return h(\n Button,\n {\n // Minimal + small to match the toolbar's other controls (scroll-to-row,\n // sort/filter tags) — the compact, minimal house style.\n minimal: true,\n small: true,\n icon: action.icon,\n intent: action.intent,\n disabled: isDisabled,\n onClick() {\n runAction();\n },\n },\n action.name,\n );\n}\n\n/** Action button that opens a popover for pre-run configuration. */\nfunction ActionButtonWithForm<T, S>({\n action,\n runAction,\n isDisabled,\n}: {\n action: TableAction<T, S>;\n runAction: (configState?: S) => void;\n isDisabled: boolean;\n}) {\n const [configState, setConfigState] = useState<S>(\n action.defaultState ?? (null as S),\n );\n const [isOpen, setIsOpen] = useState(false);\n\n let ready = true;\n if (action.isReady != null) {\n ready = action.isReady(configState);\n }\n\n return h(\n PopoverNext,\n {\n isOpen,\n onClose: () => setIsOpen(false),\n content: h(\"div.action-popover-content\", [\n h.if(action.description != null)(\"p.description\", action.description),\n h(action.detailsForm as any, {\n state: configState,\n setState: setConfigState,\n }),\n h(\n Button,\n {\n className: \"run-button\",\n intent: action.intent ?? \"primary\",\n icon: \"play\",\n disabled: !ready,\n fill: true,\n onClick() {\n runAction(configState);\n setIsOpen(false);\n },\n },\n \"Run\",\n ),\n ]),\n placement: \"bottom-start\",\n enforceFocus: false,\n autoFocus: false,\n },\n h(\n Button,\n {\n minimal: true,\n small: true,\n icon: action.icon,\n intent: action.intent,\n disabled: isDisabled,\n onClick: () => setIsOpen(!isOpen),\n },\n action.name,\n ),\n );\n}\n\nfunction hasAnyDisplayableActions(\n actions: TableAction[],\n columnSpec: ColumnSpec[],\n) {\n /** Check whether there are any actions that can be displayed in the toolbar.\n * for the entire table. This is used to determine whether the toolbar should\n * be rendered. If any actions are available, the toolbar is rendered in ALL\n * selection modes to avoid flickering\n */\n const allActions = [\n ...actions,\n ...columnSpec.flatMap((c) => c.actions ?? []),\n ];\n\n if (allActions.length === 0) {\n return false;\n }\n // Check whether any action doesn't have hotkey and is not disabled\n return allActions.some(\n (action) => action.hotkey == null && !isActionDisabled(action, {}),\n );\n}\n"],"names":["ctx"],"mappings":";;;;;;;;;;AAyBO,SAAS,eAAkB;AAAA,EAChC,SAAS;AAAA,EACT;AAAA,EACA;AAAA,EACA,UAAU;AACZ,GAMG;AACD,QAAM,YAAY,IAAI,SAAS,aAAa;AAC5C,QAAM,WAAW,YAAY,CAAC,UAAU,MAAM,QAAQ;AACtD,QAAM,aAAa,YAAY,CAAC,UAAU,MAAM,UAAU;AAE1D,Q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ACE;AAAA,MACA;AAAA,QACE,SAAS;AAAA,QACT,OAAO;AAAA,QACP,MAAM,OAAO;AAAA,QACb,QAAQ,OAAO;AAAA,QACf,UAAU;AAAA,QACV,SAAS,MAAM,UAAU,CAAC,MAAM;AAAA,MAAA;AAAA,MAElC,OAAO;AAAA,IAAA;AAAA,EACT;AAEJ;AAEA,SAAS,yBACP,SACA,YACA;AAMA,QAAM,aAAa;AAAA,IACjB,GAAG;AAAA,IACH,GAAG,WAAW,QAAQ,CAAC,MAAM,EAAE,WAAW,CAAA,CAAE;AAAA,EAAA;AAG9C,MAAI,WAAW,WAAW,GAAG;AAC3B,WAAO;AAAA,EACT;AAEA,SAAO,WAAW;AAAA,IAChB,CAAC,WAAW,OAAO,UAAU,QAAQ,CAAC,iBAAiB,QAAQ,CAAA,CAAE;AAAA,EAAA;AAErE;"}
@@ -194,6 +194,10 @@ function DataSheetRenderer({
194
194
  react.useEffect(() => {
195
195
  storeState.setState({ tableElement: tableElementRef.current });
196
196
  }, [storeState]);
197
+ const densityRowHeight = styleParamsForDensity(density).rowHeight;
198
+ react.useEffect(() => {
199
+ storeState.setState({ rowHeight: densityRowHeight });
200
+ }, [storeState, densityRowHeight]);
197
201
  react.useEffect(() => {
198
202
  storeState.setState({ onEdit });
199
203
  }, [storeState, onEdit]);
@@ -1 +1 @@
1
- {"version":3,"file":"data-sheet.cjs","sources":["../src/data-sheet.ts"],"sourcesContent":["import { useHotkeys } from \"@blueprintjs/core\";\nimport {\n Column,\n RegionCardinality,\n RowHeaderCell,\n Table,\n} from \"@blueprintjs/table\";\nimport \"@blueprintjs/table/lib/css/table.css\";\nimport {\n CSSProperties,\n ReactNode,\n useCallback,\n useEffect,\n useMemo,\n useRef,\n} from \"react\";\nimport {\n LoadProgressIndicator,\n ActionsToolbar,\n ActiveFiltersList,\n} from \"./components\";\nimport { basicCellRenderer, renderColumnHeaderCell } from \"./renderers\";\nimport h from \"./main.module.sass\";\nimport {\n columnSpecAtom,\n ctx,\n dataProviderAtom,\n dataRefreshTokenAtom,\n DataSheetProvider,\n DataViewRendererType,\n DEFAULT_ROW_STATUS_STYLES,\n FetchData,\n persistViaProvider,\n RowStatusStyles,\n splitDataProviderProps,\n storeAtom,\n tableActionsAtom,\n TableElementStatus,\n useSelector,\n useStoreAPI,\n VisibleCells,\n} from \"./provider\";\nimport { atom } from \"jotai\";\nimport { CellRendererDebugOverlay, tableHotkeysAtom } from \"./utils\";\nimport {\n clipboardActions,\n columnControlActions,\n createSaveAction,\n resetChangesAction,\n TableAction,\n TableActionContext,\n} from \"./actions\";\nimport {\n tableFooterAtom,\n useDataLoader,\n useScrollHandler,\n} from \"./postgrest-table\";\nimport {\n CellInteraction,\n DataSheetDensity,\n DataSheetProps,\n DataSheetRendererProps,\n FetchDataOptions,\n} from \"./types.ts\";\nimport { ErrorCallout } from \"@macrostrat/ui-components\";\n\n// More on component templates: https://storybook.js.org/docs/react/writing-stories/introduction#using-args\n\n// TODO: add a \"copy to selection\" tool (the little square in the bottom right corner of a cell)\n// This should copy the value of a cell (or a set of cells in the same row) downwards.\n\n/** Approximate column-header + scrollbar allowance, used to size the table to\n * its content in paged mode. */\nconst COLUMN_HEADER_HEIGHT = 34;\n\nexport function DataSheet<T>(props: DataSheetProps<T>) {\n const {\n data,\n columnSpec,\n columnSpecOptions,\n editable = true,\n enableColumnReordering = false,\n enableFocusedCell = false,\n defaultColumnWidth = 150,\n children,\n name,\n ...rest\n } = props;\n\n const [providerProps, rendererProps] = splitDataProviderProps<T>({\n ...props,\n viewType: DataViewRendererType.TABLE,\n });\n return h(\n DataSheetProvider<T>,\n providerProps,\n h(DataSheetRenderer<any>, rendererProps),\n );\n}\n\nconst verboseAtom = atom(false);\n\n/** The table (cell-grid) renderer. Assumes it is rendered inside a\n * `DataSheetProvider` (the `DataSheet` wrapper, or `DataView`). Exported so a\n * shared-store `DataView` can mount it directly alongside `_DataPanel`. */\nexport function DataSheetRenderer<T>({\n fetchData,\n provider,\n pageSize,\n fetchMode,\n filterDebounce,\n initialData,\n onVisibleCellsChange,\n onUpdateData,\n onEdit,\n onSave,\n updatedData: updatedDataProp,\n rowStatus: rowStatusProp,\n // Identity/canDeleteRows sync (was here) is now handled by the provider\n // (`DataSheetProviderInner`); still destructured so `identity`/`refreshToken`\n // don't leak into `...rest` (spread onto the Blueprint `Table` below).\n identity: _identity,\n deriveOverlay,\n refreshToken: _refreshToken,\n onDeleteRows,\n name,\n verbose = false,\n debug = false,\n enableFocusedCell,\n autoFocusEditor = true,\n cellInteraction,\n enableClipboard = true,\n density = DataSheetDensity.HIGH,\n selectionModes,\n actions,\n filters,\n columnHeaderCellRenderer,\n statusBar,\n rowStatusStyles,\n rowHeaderRenderer,\n children,\n ...tableProps\n}: DataSheetRendererProps<T>) {\n /**\n * @param data: The data to be displayed in the table\n * @param columnSpec: The specification for all columns in the table. If not provided, the column spec will be generated from the data.\n * @param columnSpecOptions: Options for generating a column spec from data\n */\n\n ctx.useSync(verboseAtom, verbose);\n\n const editable = useSelector((state) => state.editable);\n\n // The active data source is resolved in the wrapper (`DataSheet`) and held in\n // the provider layer; read it here rather than resolving per render.\n const {\n provider: activeProvider,\n isLocalProvider,\n localCount,\n } = ctx.useValue(dataProviderAtom);\n\n // When an explicit provider owns persistence, its methods drive the built-in\n // Save (batch: edits→saveRows, added→insertRow, deleted→deleteRows), then a\n // refresh. Otherwise the loose `onSave` handler is used.\n const bumpRefresh = ctx.useSet(dataRefreshTokenAtom);\n const providerSave = useMemo(() => {\n const p = provider;\n if (\n p == null ||\n (p.saveRows == null && p.deleteRows == null && p.insertRow == null)\n ) {\n return null;\n }\n return async (actionCtx: TableActionContext<T>) => {\n await persistViaProvider(p, actionCtx);\n bumpRefresh((v) => v + 1);\n };\n }, [provider, bumpRefresh]);\n const saveHandler = onSave ?? providerSave;\n\n // Sync table actions to atom. Consumer actions come first (they override a\n // built-in by reusing its id); the built-in column controls (sort/filter)\n // fill in the rest — so both the toolbar and the header dropdown source from\n // one registry. Built-ins self-gate (single sortable/filterable column).\n const _actions: TableAction[] = useMemo(() => {\n const _actions: TableAction[] = [];\n const add = (list: TableAction[]) => {\n for (const a of list) {\n if (!_actions.some((x) => x.id === a.id)) _actions.push(a);\n }\n };\n if (actions != null) add(actions);\n add(columnControlActions);\n if (enableClipboard) add(clipboardActions);\n // Save/reset last — they're the most significant actions — and present for\n // every cardinality (editable), so the toolbar stays mounted regardless of\n // selection.\n if (editable) {\n if (saveHandler != null) add([createSaveAction(saveHandler)]);\n add([resetChangesAction]);\n }\n return _actions;\n }, [actions, enableClipboard, editable, saveHandler]);\n\n /*** TODO: generalize this, probably shouldn't need 'set' */\n ctx.useSync(tableActionsAtom, _actions);\n const getHotkeys = ctx.useSet(tableHotkeysAtom);\n\n // This is quite hacky!\n const hotkeysConfig = useMemo(() => {\n return getHotkeys();\n }, [_actions]);\n\n const { handleKeyDown, handleKeyUp } = useHotkeys(hotkeysConfig);\n\n // For now, we only consider a single cell \"focused\" when we have one cell selected.\n // Multi-cell selections have a different set of \"bulk\" actions.\n const selectedRegions = useSelector<T>((state) => state.selection ?? []);\n\n const data = useSelector((state) => state.data);\n\n const rowStatus = useSelector((state) => state.rowStatus);\n\n const focusedCell = useSelector((state) => state.focusedCell);\n\n const ref = useSelector((state) => state.tableRef);\n\n const columnSpec = useSelector((state) => state.columnSpec);\n\n // A sparse array to hold updates\n // TODO: create a \"changeset\" concept to facilitate undo/redo\n const updatedData = useSelector((state) => state.updatedData);\n\n const onSelection = useSelector((state) => state.onSelection);\n\n const storeAPI = useStoreAPI<T>();\n\n const onScroll = useScrollHandler();\n const _onVisibleCellsChange = useCallback(\n (visibleCells: VisibleCells) => {\n onScroll(visibleCells);\n onVisibleCellsChange?.(visibleCells);\n },\n [onVisibleCellsChange, onScroll],\n );\n\n useEffect(() => {\n if (!verbose) return;\n console.log(\"Updated data\", updatedData);\n }, [updatedData]);\n\n useEffect(() => {\n onUpdateData?.(updatedData, data);\n }, [onUpdateData, data, updatedData]);\n\n useEffect(() => {\n if (!verbose) return;\n console.log(\"Selected regions\", selectedRegions);\n }, [selectedRegions]);\n\n const tableElementRef = useRef<HTMLElement>(null);\n useEffect(() => {\n // Return the focus to the table\n tableElementRef.current?.focus();\n }, [focusedCell]);\n\n const columnWidths = ctx.useValue(columnWidthsAtom);\n\n // When filters are active, only show matching rows\n const filteredRowIndices = useSelector((state) => state.filteredRowIndices);\n const totalRows = Math.max(updatedData.length, data.length);\n const numRows =\n filteredRowIndices != null ? filteredRowIndices.length : totalRows;\n\n let className = `${density}-density`;\n\n const { rowHeight, style } = styleParamsForDensity(density);\n\n // In paged mode the row count is small and fixed, so let the table size to\n // its content (header + rows) instead of filling the viewport.\n const footerInfo = ctx.useValue(tableFooterAtom);\n let holderStyle: CSSProperties | undefined = undefined;\n if (footerInfo.mode === \"paged\") {\n holderStyle = {\n flex: \"0 0 auto\" as const,\n height: numRows * rowHeight + COLUMN_HEADER_HEIGHT,\n };\n }\n\n const onColumnsReordered = useSelector((state) => state.onColumnsReordered);\n // Whether table-level column drag-reordering is enabled. Held in the store\n // (set from the `enableColumnReordering` prop by the provider); it must reach\n // the Blueprint `Table` — the `onColumnsReordered` handler alone doesn't turn\n // on the drag affordance.\n const enableColumnReordering = useSelector(\n (state) => state.enableColumnReordering,\n );\n\n // Auto-detect if any columns have sortable/filterable set.\n // If so and no explicit columnHeaderCellRenderer was provided,\n // use the built-in client-side sort/filter header.\n const hasSortableOrFilterable = useMemo(\n () =>\n columnSpec.some(\n (col) =>\n col.sortable ||\n col.filterable ||\n (Array.isArray(col.filters) && col.filters.length > 0),\n ),\n [columnSpec],\n );\n\n const columnSorts = useSelector((state) => state.columnSorts);\n const activeFilters = useSelector((state) => state.activeFilters);\n\n // Cell activation mode, defaulting from the legacy `autoFocusEditor` boolean\n // so existing consumers are unaffected. Synced into the store so the cell\n // renderer, editors, and key handlers all read it consistently.\n const cellInteractionMode: CellInteraction =\n cellInteraction ?? (autoFocusEditor ? \"auto\" : \"manual\");\n\n const storeState = storeAPI;\n useEffect(() => {\n storeState.setState({ cellInteraction: cellInteractionMode });\n }, [storeState, cellInteractionMode]);\n\n useEffect(() => {\n // Give the store a handle to the focusable holder so editors can return\n // keyboard focus to the table when the cursor leaves them.\n storeState.setState({ tableElement: tableElementRef.current });\n }, [storeState]);\n\n useEffect(() => {\n storeState.setState({ onEdit });\n }, [storeState, onEdit]);\n\n useEffect(() => {\n // Controlled overlay: mirror the caller's edited state into the store as\n // the source of truth. Optimistic in-table edits are superseded on the\n // next render when the caller passes an updated value back. When the caller\n // controls it, the loader-boundary identity remap steps aside.\n const controlled =\n updatedDataProp !== undefined ||\n rowStatusProp !== undefined ||\n deriveOverlay != null;\n const patch: Record<string, unknown> = { controlledOverlay: controlled };\n if (updatedDataProp !== undefined) patch.updatedData = updatedDataProp;\n if (rowStatusProp !== undefined) patch.rowStatus = rowStatusProp;\n storeState.setState(patch);\n }, [storeState, updatedDataProp, rowStatusProp, deriveOverlay]);\n\n // Derived controlled overlay: the library owns the loaded rows, so it runs\n // the consumer's `deriveOverlay(rows)` here and pushes the result. Re-derives\n // when the rows load/change or the function's identity changes (close it over\n // your external edit state). The `controlledOverlay` flag above suppresses the\n // loader-boundary identity remap so this derivation is authoritative.\n useEffect(() => {\n if (deriveOverlay == null) return;\n const overlay = deriveOverlay(data);\n storeState.setState({\n updatedData: overlay.updatedData,\n rowStatus: overlay.rowStatus,\n });\n }, [deriveOverlay, data, storeState]);\n\n // Function `columnSpec` derivation is hoisted to the provider\n // (`DataSheetProviderInner`), shared by both renderers.\n\n // Identity and canDeleteRows sync are hoisted to the provider\n // (`DataSheetProviderInner`), shared with `_DataPanel` — both depend only on\n // the resolved data provider, not any sheet-specific state.\n\n // Merge consumer `rowStatusStyles` over the built-in defaults and hand the\n // result to the store, where the cell renderer and row-header renderer read\n // it. Merged (not replaced) so overriding one status doesn't drop the rest.\n const mergedRowStatusStyles = useMemo<RowStatusStyles>(\n () => ({ ...DEFAULT_ROW_STATUS_STYLES, ...rowStatusStyles }),\n [rowStatusStyles],\n );\n useEffect(() => {\n storeState.setState({ rowStatusStyles: mergedRowStatusStyles });\n }, [storeState, mergedRowStatusStyles]);\n\n const realizedColumns = useMemo(() => {\n return columnSpec.map((col, colIndex) => {\n let fn =\n col.headerRenderer ??\n columnHeaderCellRenderer ??\n renderColumnHeaderCell;\n let activeSort: any = null;\n let activeFilter: any = null;\n if (col.sortable) {\n activeSort = columnSorts?.find((s) => s.key === col.key);\n }\n // The active filter for this column is whichever active filter targets\n // it (a rich `col.filters` filter or the generic operator filter) — match\n // by columnKey rather than a fixed id.\n for (const entry of activeFilters?.values() ?? []) {\n if ((entry as any)?.filter?.columnKey === col.key) {\n activeFilter = entry;\n break;\n }\n }\n\n const _columnHeaderCellRenderer: any = (colIndex) => {\n return fn(\n {\n col,\n colIndex,\n activeSort,\n activeFilter,\n },\n colIndex,\n );\n };\n\n return h(Column, {\n id: col.key,\n name: col.name,\n columnHeaderCellRenderer: _columnHeaderCellRenderer as any,\n cellRenderer: (rowIndex) => {\n const state = storeAPI.getState();\n return basicCellRenderer<T>(\n rowIndex,\n colIndex,\n col,\n state,\n filteredRowIndices,\n );\n },\n });\n });\n }, [\n columnSpec,\n columnSorts,\n activeFilters,\n storeAPI,\n filteredRowIndices,\n columnHeaderCellRenderer,\n ]);\n\n const onColumnWidthChanged = useSelector(\n (state) => state.onColumnWidthChanged,\n );\n\n const rowHeaderCellRenderer = useCallback(\n (rowIndex: number) => {\n let dataRowIndex = rowIndex;\n if (filteredRowIndices != null) {\n dataRowIndex = filteredRowIndices[rowIndex] ?? rowIndex;\n }\n const statusVal = rowStatus[dataRowIndex];\n let style: CSSProperties | undefined;\n if (statusVal != null) {\n style = mergedRowStatusStyles[statusVal]?.headerStyle;\n }\n\n const defaultLabel = `${dataRowIndex + 1}`;\n // A custom renderer supplies the header's *name* content (a group-key\n // label, an omit indicator, …); a nullish return keeps the default\n // 1-based label. Either way the node is wrapped in a `RowHeaderCell` so\n // status styling and the row index are always applied — the renderer is\n // not responsible for producing the whole cell.\n let name: ReactNode = defaultLabel;\n if (rowHeaderRenderer != null) {\n const custom = rowHeaderRenderer({\n rowIndex: dataRowIndex,\n visibleIndex: rowIndex,\n row: data[dataRowIndex] ?? updatedData[dataRowIndex],\n status: statusVal,\n isDeleted: statusVal === TableElementStatus.DELETED,\n defaultLabel,\n });\n if (custom != null) name = custom;\n }\n\n return h(RowHeaderCell, {\n enableRowReordering: false,\n index: rowIndex,\n name,\n style,\n });\n },\n [\n rowStatus,\n filteredRowIndices,\n mergedRowStatusStyles,\n rowHeaderRenderer,\n data,\n updatedData,\n ],\n );\n\n // Done with hooks!\n /** Guard for unacceptable state combinations:\n * editable = true requires selectionModes to include cells, else the user cannot select a cell to edit.\n * TODO: make this an impossible state to enter.\n */\n if (\n editable &&\n selectionModes &&\n !selectionModes.includes(RegionCardinality.CELLS)\n ) {\n return h(ErrorCallout, {\n title: \"Invalid selection mode\",\n description: \"Editable sheet requires cell selection\",\n });\n }\n\n // TODO: hoist this\n let _selectionModes = selectionModes;\n if (\n editable &&\n _selectionModes != null &&\n !_selectionModes.includes(RegionCardinality.CELLS)\n ) {\n _selectionModes = [..._selectionModes, RegionCardinality.CELLS];\n // Ensure selection mode includes \"cells\"\n }\n\n const cellRendererDependencies = [\n data,\n updatedData,\n focusedCell,\n rowStatus,\n filteredRowIndices,\n ];\n\n // Drive the table from the active provider's `fetchData`. A local (in-memory)\n // provider loads the whole array at once; a remote one uses the `pageSize` /\n // `fetchMode` props and shows load progress.\n let _showLoadProgress: boolean = false;\n let dataLoader: ReactNode = null;\n if (activeProvider != null) {\n _showLoadProgress = !isLocalProvider;\n // A local (in-memory) source loads all its rows in one page; its count\n // rides on the resolved provider (`localCount`), so `_DataSheet` no longer\n // takes a `data` prop — live rows come only from the store.\n dataLoader = h(_DataLoaderManager, {\n key: \"__data_loader\",\n fetchData: activeProvider.fetchData,\n pageSize: isLocalProvider ? Math.max(localCount, 1) : pageSize,\n fetchMode: isLocalProvider ? undefined : fetchMode,\n filterDebounce,\n initialData,\n });\n }\n const showFilterBar =\n (filters != null && filters.length > 0) || hasSortableOrFilterable;\n\n let filterStatus: ReactNode = null;\n if (showFilterBar) {\n filterStatus = h(ActiveFiltersList, { filters: filters ?? [] });\n }\n\n return h(\"div.data-sheet-container\", { className, style }, [\n // The actions/tools toolbar (selection-modal). Table-scoped controls like\n // scroll-to-row / full-text search live here as ordinary actions.\n h(ActionsToolbar, { actions: _actions }),\n dataLoader,\n children,\n h(\n \"div.data-sheet-holder\",\n {\n tabIndex: 0,\n onKeyDown: handleKeyDown,\n onKeyUp: handleKeyUp,\n ref: tableElementRef,\n style: holderStyle,\n },\n h(\n Table as any, // Some sort of hyperscript type error\n {\n ref,\n numRows,\n className: \"data-sheet\",\n enableFocusedCell,\n enableColumnReordering,\n onColumnsReordered,\n focusedCell,\n selectedRegions,\n defaultRowHeight: rowHeight,\n columnWidths,\n onColumnWidthChanged,\n onSelection,\n /** TODO: we could enable this if we had a use-case */\n enableRowReordering: false,\n enableRowResizing: false,\n // The cell renderer is memoized internally based on these data dependencies\n cellRendererDependencies,\n onVisibleCellsChange: _onVisibleCellsChange,\n rowHeaderCellRenderer,\n selectionModes: _selectionModes,\n ...tableProps,\n getCellClipboardData: null,\n },\n realizedColumns,\n ),\n ),\n h(\"div.status-bar\", [\n filterStatus,\n statusBar,\n h(\"div.spacer\"),\n h.if(_showLoadProgress)(LoadProgressIndicator),\n ]),\n h.if(debug)(CellRendererDebugOverlay, {\n cellRendererDependencies,\n names: [\n \"data\",\n \"updatedData\",\n \"focusedCell\",\n \"rowStatus\",\n \"filteredRowIndices\",\n ],\n }),\n ]);\n}\n\nconst EMPTY_MAP = new Map<string, number>();\n\nconst columnWidthsIndexAtom = atom(\n (get) => get(storeAtom)?.columnWidthsIndex ?? EMPTY_MAP,\n);\nconst defaultColumnWidthAtom = atom(\n (get) => get(storeAtom)?.defaultColumnWidth ?? 150,\n);\n\nconst columnWidthsAtom = atom((get) => {\n const ix = get(columnWidthsIndexAtom);\n return get(columnSpecAtom).map(\n (col) => ix.get(col.key) ?? col.width ?? get(defaultColumnWidthAtom),\n );\n});\n\nfunction styleParamsForDensity(density: DataSheetDensity): {\n rowHeight: number;\n style: Record<string, string>;\n} {\n switch (density) {\n case DataSheetDensity.MEDIUM:\n return {\n rowHeight: 24,\n style: {\n \"--data-sheet-row-height\": \"24px\",\n \"--data-sheet-font-size\": \"14px\",\n },\n };\n case DataSheetDensity.LOW:\n return {\n rowHeight: 30,\n style: {\n \"--data-sheet-row-height\": \"30px\",\n \"--data-sheet-font-size\": \"18px\",\n },\n };\n case DataSheetDensity.HIGH:\n default:\n return {\n rowHeight: 20,\n style: {\n \"--data-sheet-row-height\": \"20px\",\n \"--data-sheet-font-size\": \"12px\",\n },\n };\n }\n}\n\n/** Convenience component: runs `useChunkLoader` from inside a `DataSheet`.\n * Render as a child of `DataSheet` (it renders nothing itself). */\nfunction _DataLoaderManager<T = any>({\n fetchData,\n ...rest\n}: {\n fetchData: FetchData<T>;\n} & FetchDataOptions<any>) {\n useDataLoader(fetchData, rest);\n return null;\n}\n"],"names":["splitDataProviderProps","DataViewRendererType","h","DataSheetProvider","atom","DataSheetDensity","ctx","useSelector","dataProviderAtom","dataRefreshTokenAtom","useMemo","persistViaProvider","_actions","columnControlActions","clipboardActions","createSaveAction","resetChangesAction","tableActionsAtom","tableHotkeysAtom","useHotkeys","useStoreAPI","useScrollHandler","useCallback","useEffect","useRef","tableFooterAtom","activeFilters","DEFAULT_ROW_STATUS_STYLES","renderColumnHeaderCell","colIndex","Column","basicCellRenderer","style","name","TableElementStatus","RowHeaderCell","RegionCardinality","ErrorCallout","ActiveFiltersList","ActionsToolbar","Table","LoadProgressIndicator","CellRendererDebugOverlay","storeAtom","columnSpecAtom","useDataLoader"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;AAyEA,MAAM,uBAAuB;AAEtB,SAAS,UAAa,OAA0B;AACrD,QAAM;AAAA,IACJ;AAAA,IACA;AAAA,IACA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IACN,KAAKvC,QAAAA,iBAAiB;AACpB,aAAO;AAAA,QACL,WAAW;AAAA,QACX,OAAO;AAAA,UACL,2BAA2B;AAAA,UAC3B,0BAA0B;AAAA,QAAA;AAAA,MAC5B;AAAA,IAEJ,KAAKA,QAAAA,iBAAiB;AACpB,aAAO;AAAA,QACL,WAAW;AAAA,QACX,OAAO;AAAA,UACL,2BAA2B;AAAA,UAC3B,0BAA0B;AAAA,QAAA;AAAA,MAC5B;AAAA,IAEJ,KAAKA,QAAAA,iBAAiB;AAAA,IACtB;AACE,aAAO;AAAA,QACL,WAAW;AAAA,QACX,OAAO;AAAA,UACL,2BAA2B;AAAA,UAC3B,0BAA0B;AAAA,QAAA;AAAA,MAC5B;AAAA,EACF;AAEN;AAIA,SAAS,mBAA4B;AAAA,EACnC;AAAA,EACA,GAAG;AACL,GAE2B;AACzBwC,cAAAA,cAAc,WAAW,IAAI;AAC7B,SAAO;AACT;;;"}
1
+ {"version":3,"file":"data-sheet.cjs","sources":["../src/data-sheet.ts"],"sourcesContent":["import { useHotkeys } from \"@blueprintjs/core\";\nimport {\n Column,\n RegionCardinality,\n RowHeaderCell,\n Table,\n} from \"@blueprintjs/table\";\nimport \"@blueprintjs/table/lib/css/table.css\";\nimport {\n CSSProperties,\n ReactNode,\n useCallback,\n useEffect,\n useMemo,\n useRef,\n} from \"react\";\nimport {\n LoadProgressIndicator,\n ActionsToolbar,\n ActiveFiltersList,\n} from \"./components\";\nimport { basicCellRenderer, renderColumnHeaderCell } from \"./renderers\";\nimport h from \"./main.module.sass\";\nimport {\n columnSpecAtom,\n ctx,\n dataProviderAtom,\n dataRefreshTokenAtom,\n DataSheetProvider,\n DataViewRendererType,\n DEFAULT_ROW_STATUS_STYLES,\n FetchData,\n persistViaProvider,\n RowStatusStyles,\n splitDataProviderProps,\n storeAtom,\n tableActionsAtom,\n TableElementStatus,\n useSelector,\n useStoreAPI,\n VisibleCells,\n} from \"./provider\";\nimport { atom } from \"jotai\";\nimport { CellRendererDebugOverlay, tableHotkeysAtom } from \"./utils\";\nimport {\n clipboardActions,\n columnControlActions,\n createSaveAction,\n resetChangesAction,\n TableAction,\n TableActionContext,\n} from \"./actions\";\nimport {\n tableFooterAtom,\n useDataLoader,\n useScrollHandler,\n} from \"./postgrest-table\";\nimport {\n CellInteraction,\n DataSheetDensity,\n DataSheetProps,\n DataSheetRendererProps,\n FetchDataOptions,\n} from \"./types.ts\";\nimport { ErrorCallout } from \"@macrostrat/ui-components\";\n\n// More on component templates: https://storybook.js.org/docs/react/writing-stories/introduction#using-args\n\n// TODO: add a \"copy to selection\" tool (the little square in the bottom right corner of a cell)\n// This should copy the value of a cell (or a set of cells in the same row) downwards.\n\n/** Approximate column-header + scrollbar allowance, used to size the table to\n * its content in paged mode. */\nconst COLUMN_HEADER_HEIGHT = 34;\n\nexport function DataSheet<T>(props: DataSheetProps<T>) {\n const {\n data,\n columnSpec,\n columnSpecOptions,\n editable = true,\n enableColumnReordering = false,\n enableFocusedCell = false,\n defaultColumnWidth = 150,\n children,\n name,\n ...rest\n } = props;\n\n const [providerProps, rendererProps] = splitDataProviderProps<T>({\n ...props,\n viewType: DataViewRendererType.TABLE,\n });\n return h(\n DataSheetProvider<T>,\n providerProps,\n h(DataSheetRenderer<any>, rendererProps),\n );\n}\n\nconst verboseAtom = atom(false);\n\n/** The table (cell-grid) renderer. Assumes it is rendered inside a\n * `DataSheetProvider` (the `DataSheet` wrapper, or `DataView`). Exported so a\n * shared-store `DataView` can mount it directly alongside `_DataPanel`. */\nexport function DataSheetRenderer<T>({\n fetchData,\n provider,\n pageSize,\n fetchMode,\n filterDebounce,\n initialData,\n onVisibleCellsChange,\n onUpdateData,\n onEdit,\n onSave,\n updatedData: updatedDataProp,\n rowStatus: rowStatusProp,\n // Identity/canDeleteRows sync (was here) is now handled by the provider\n // (`DataSheetProviderInner`); still destructured so `identity`/`refreshToken`\n // don't leak into `...rest` (spread onto the Blueprint `Table` below).\n identity: _identity,\n deriveOverlay,\n refreshToken: _refreshToken,\n onDeleteRows,\n name,\n verbose = false,\n debug = false,\n enableFocusedCell,\n autoFocusEditor = true,\n cellInteraction,\n enableClipboard = true,\n density = DataSheetDensity.HIGH,\n selectionModes,\n actions,\n filters,\n columnHeaderCellRenderer,\n statusBar,\n rowStatusStyles,\n rowHeaderRenderer,\n children,\n ...tableProps\n}: DataSheetRendererProps<T>) {\n /**\n * @param data: The data to be displayed in the table\n * @param columnSpec: The specification for all columns in the table. If not provided, the column spec will be generated from the data.\n * @param columnSpecOptions: Options for generating a column spec from data\n */\n\n ctx.useSync(verboseAtom, verbose);\n\n const editable = useSelector((state) => state.editable);\n\n // The active data source is resolved in the wrapper (`DataSheet`) and held in\n // the provider layer; read it here rather than resolving per render.\n const {\n provider: activeProvider,\n isLocalProvider,\n localCount,\n } = ctx.useValue(dataProviderAtom);\n\n // When an explicit provider owns persistence, its methods drive the built-in\n // Save (batch: edits→saveRows, added→insertRow, deleted→deleteRows), then a\n // refresh. Otherwise the loose `onSave` handler is used.\n const bumpRefresh = ctx.useSet(dataRefreshTokenAtom);\n const providerSave = useMemo(() => {\n const p = provider;\n if (\n p == null ||\n (p.saveRows == null && p.deleteRows == null && p.insertRow == null)\n ) {\n return null;\n }\n return async (actionCtx: TableActionContext<T>) => {\n await persistViaProvider(p, actionCtx);\n bumpRefresh((v) => v + 1);\n };\n }, [provider, bumpRefresh]);\n const saveHandler = onSave ?? providerSave;\n\n // Sync table actions to atom. Consumer actions come first (they override a\n // built-in by reusing its id); the built-in column controls (sort/filter)\n // fill in the rest — so both the toolbar and the header dropdown source from\n // one registry. Built-ins self-gate (single sortable/filterable column).\n const _actions: TableAction[] = useMemo(() => {\n const _actions: TableAction[] = [];\n const add = (list: TableAction[]) => {\n for (const a of list) {\n if (!_actions.some((x) => x.id === a.id)) _actions.push(a);\n }\n };\n if (actions != null) add(actions);\n add(columnControlActions);\n if (enableClipboard) add(clipboardActions);\n // Save/reset last — they're the most significant actions — and present for\n // every cardinality (editable), so the toolbar stays mounted regardless of\n // selection.\n if (editable) {\n if (saveHandler != null) add([createSaveAction(saveHandler)]);\n add([resetChangesAction]);\n }\n return _actions;\n }, [actions, enableClipboard, editable, saveHandler]);\n\n /*** TODO: generalize this, probably shouldn't need 'set' */\n ctx.useSync(tableActionsAtom, _actions);\n const getHotkeys = ctx.useSet(tableHotkeysAtom);\n\n // This is quite hacky!\n const hotkeysConfig = useMemo(() => {\n return getHotkeys();\n }, [_actions]);\n\n const { handleKeyDown, handleKeyUp } = useHotkeys(hotkeysConfig);\n\n // For now, we only consider a single cell \"focused\" when we have one cell selected.\n // Multi-cell selections have a different set of \"bulk\" actions.\n const selectedRegions = useSelector<T>((state) => state.selection ?? []);\n\n const data = useSelector((state) => state.data);\n\n const rowStatus = useSelector((state) => state.rowStatus);\n\n const focusedCell = useSelector((state) => state.focusedCell);\n\n const ref = useSelector((state) => state.tableRef);\n\n const columnSpec = useSelector((state) => state.columnSpec);\n\n // A sparse array to hold updates\n // TODO: create a \"changeset\" concept to facilitate undo/redo\n const updatedData = useSelector((state) => state.updatedData);\n\n const onSelection = useSelector((state) => state.onSelection);\n\n const storeAPI = useStoreAPI<T>();\n\n const onScroll = useScrollHandler();\n const _onVisibleCellsChange = useCallback(\n (visibleCells: VisibleCells) => {\n onScroll(visibleCells);\n onVisibleCellsChange?.(visibleCells);\n },\n [onVisibleCellsChange, onScroll],\n );\n\n useEffect(() => {\n if (!verbose) return;\n console.log(\"Updated data\", updatedData);\n }, [updatedData]);\n\n useEffect(() => {\n onUpdateData?.(updatedData, data);\n }, [onUpdateData, data, updatedData]);\n\n useEffect(() => {\n if (!verbose) return;\n console.log(\"Selected regions\", selectedRegions);\n }, [selectedRegions]);\n\n const tableElementRef = useRef<HTMLElement>(null);\n useEffect(() => {\n // Return the focus to the table\n tableElementRef.current?.focus();\n }, [focusedCell]);\n\n const columnWidths = ctx.useValue(columnWidthsAtom);\n\n // When filters are active, only show matching rows\n const filteredRowIndices = useSelector((state) => state.filteredRowIndices);\n const totalRows = Math.max(updatedData.length, data.length);\n const numRows =\n filteredRowIndices != null ? filteredRowIndices.length : totalRows;\n\n let className = `${density}-density`;\n\n const { rowHeight, style } = styleParamsForDensity(density);\n\n // In paged mode the row count is small and fixed, so let the table size to\n // its content (header + rows) instead of filling the viewport.\n const footerInfo = ctx.useValue(tableFooterAtom);\n let holderStyle: CSSProperties | undefined = undefined;\n if (footerInfo.mode === \"paged\") {\n holderStyle = {\n flex: \"0 0 auto\" as const,\n height: numRows * rowHeight + COLUMN_HEADER_HEIGHT,\n };\n }\n\n const onColumnsReordered = useSelector((state) => state.onColumnsReordered);\n // Whether table-level column drag-reordering is enabled. Held in the store\n // (set from the `enableColumnReordering` prop by the provider); it must reach\n // the Blueprint `Table` — the `onColumnsReordered` handler alone doesn't turn\n // on the drag affordance.\n const enableColumnReordering = useSelector(\n (state) => state.enableColumnReordering,\n );\n\n // Auto-detect if any columns have sortable/filterable set.\n // If so and no explicit columnHeaderCellRenderer was provided,\n // use the built-in client-side sort/filter header.\n const hasSortableOrFilterable = useMemo(\n () =>\n columnSpec.some(\n (col) =>\n col.sortable ||\n col.filterable ||\n (Array.isArray(col.filters) && col.filters.length > 0),\n ),\n [columnSpec],\n );\n\n const columnSorts = useSelector((state) => state.columnSorts);\n const activeFilters = useSelector((state) => state.activeFilters);\n\n // Cell activation mode, defaulting from the legacy `autoFocusEditor` boolean\n // so existing consumers are unaffected. Synced into the store so the cell\n // renderer, editors, and key handlers all read it consistently.\n const cellInteractionMode: CellInteraction =\n cellInteraction ?? (autoFocusEditor ? \"auto\" : \"manual\");\n\n const storeState = storeAPI;\n useEffect(() => {\n storeState.setState({ cellInteraction: cellInteractionMode });\n }, [storeState, cellInteractionMode]);\n\n useEffect(() => {\n // Give the store a handle to the focusable holder so editors can return\n // keyboard focus to the table when the cursor leaves them.\n storeState.setState({ tableElement: tableElementRef.current });\n }, [storeState]);\n\n // The row height is the density's; cells report it to their renderers\n const densityRowHeight = styleParamsForDensity(density).rowHeight;\n useEffect(() => {\n storeState.setState({ rowHeight: densityRowHeight });\n }, [storeState, densityRowHeight]);\n\n useEffect(() => {\n storeState.setState({ onEdit });\n }, [storeState, onEdit]);\n\n useEffect(() => {\n // Controlled overlay: mirror the caller's edited state into the store as\n // the source of truth. Optimistic in-table edits are superseded on the\n // next render when the caller passes an updated value back. When the caller\n // controls it, the loader-boundary identity remap steps aside.\n const controlled =\n updatedDataProp !== undefined ||\n rowStatusProp !== undefined ||\n deriveOverlay != null;\n const patch: Record<string, unknown> = { controlledOverlay: controlled };\n if (updatedDataProp !== undefined) patch.updatedData = updatedDataProp;\n if (rowStatusProp !== undefined) patch.rowStatus = rowStatusProp;\n storeState.setState(patch);\n }, [storeState, updatedDataProp, rowStatusProp, deriveOverlay]);\n\n // Derived controlled overlay: the library owns the loaded rows, so it runs\n // the consumer's `deriveOverlay(rows)` here and pushes the result. Re-derives\n // when the rows load/change or the function's identity changes (close it over\n // your external edit state). The `controlledOverlay` flag above suppresses the\n // loader-boundary identity remap so this derivation is authoritative.\n useEffect(() => {\n if (deriveOverlay == null) return;\n const overlay = deriveOverlay(data);\n storeState.setState({\n updatedData: overlay.updatedData,\n rowStatus: overlay.rowStatus,\n });\n }, [deriveOverlay, data, storeState]);\n\n // Function `columnSpec` derivation is hoisted to the provider\n // (`DataSheetProviderInner`), shared by both renderers.\n\n // Identity and canDeleteRows sync are hoisted to the provider\n // (`DataSheetProviderInner`), shared with `_DataPanel` — both depend only on\n // the resolved data provider, not any sheet-specific state.\n\n // Merge consumer `rowStatusStyles` over the built-in defaults and hand the\n // result to the store, where the cell renderer and row-header renderer read\n // it. Merged (not replaced) so overriding one status doesn't drop the rest.\n const mergedRowStatusStyles = useMemo<RowStatusStyles>(\n () => ({ ...DEFAULT_ROW_STATUS_STYLES, ...rowStatusStyles }),\n [rowStatusStyles],\n );\n useEffect(() => {\n storeState.setState({ rowStatusStyles: mergedRowStatusStyles });\n }, [storeState, mergedRowStatusStyles]);\n\n const realizedColumns = useMemo(() => {\n return columnSpec.map((col, colIndex) => {\n let fn =\n col.headerRenderer ??\n columnHeaderCellRenderer ??\n renderColumnHeaderCell;\n let activeSort: any = null;\n let activeFilter: any = null;\n if (col.sortable) {\n activeSort = columnSorts?.find((s) => s.key === col.key);\n }\n // The active filter for this column is whichever active filter targets\n // it (a rich `col.filters` filter or the generic operator filter) — match\n // by columnKey rather than a fixed id.\n for (const entry of activeFilters?.values() ?? []) {\n if ((entry as any)?.filter?.columnKey === col.key) {\n activeFilter = entry;\n break;\n }\n }\n\n const _columnHeaderCellRenderer: any = (colIndex) => {\n return fn(\n {\n col,\n colIndex,\n activeSort,\n activeFilter,\n },\n colIndex,\n );\n };\n\n return h(Column, {\n id: col.key,\n name: col.name,\n columnHeaderCellRenderer: _columnHeaderCellRenderer as any,\n cellRenderer: (rowIndex) => {\n const state = storeAPI.getState();\n return basicCellRenderer<T>(\n rowIndex,\n colIndex,\n col,\n state,\n filteredRowIndices,\n );\n },\n });\n });\n }, [\n columnSpec,\n columnSorts,\n activeFilters,\n storeAPI,\n filteredRowIndices,\n columnHeaderCellRenderer,\n ]);\n\n const onColumnWidthChanged = useSelector(\n (state) => state.onColumnWidthChanged,\n );\n\n const rowHeaderCellRenderer = useCallback(\n (rowIndex: number) => {\n let dataRowIndex = rowIndex;\n if (filteredRowIndices != null) {\n dataRowIndex = filteredRowIndices[rowIndex] ?? rowIndex;\n }\n const statusVal = rowStatus[dataRowIndex];\n let style: CSSProperties | undefined;\n if (statusVal != null) {\n style = mergedRowStatusStyles[statusVal]?.headerStyle;\n }\n\n const defaultLabel = `${dataRowIndex + 1}`;\n // A custom renderer supplies the header's *name* content (a group-key\n // label, an omit indicator, …); a nullish return keeps the default\n // 1-based label. Either way the node is wrapped in a `RowHeaderCell` so\n // status styling and the row index are always applied — the renderer is\n // not responsible for producing the whole cell.\n let name: ReactNode = defaultLabel;\n if (rowHeaderRenderer != null) {\n const custom = rowHeaderRenderer({\n rowIndex: dataRowIndex,\n visibleIndex: rowIndex,\n row: data[dataRowIndex] ?? updatedData[dataRowIndex],\n status: statusVal,\n isDeleted: statusVal === TableElementStatus.DELETED,\n defaultLabel,\n });\n if (custom != null) name = custom;\n }\n\n return h(RowHeaderCell, {\n enableRowReordering: false,\n index: rowIndex,\n name,\n style,\n });\n },\n [\n rowStatus,\n filteredRowIndices,\n mergedRowStatusStyles,\n rowHeaderRenderer,\n data,\n updatedData,\n ],\n );\n\n // Done with hooks!\n /** Guard for unacceptable state combinations:\n * editable = true requires selectionModes to include cells, else the user cannot select a cell to edit.\n * TODO: make this an impossible state to enter.\n */\n if (\n editable &&\n selectionModes &&\n !selectionModes.includes(RegionCardinality.CELLS)\n ) {\n return h(ErrorCallout, {\n title: \"Invalid selection mode\",\n description: \"Editable sheet requires cell selection\",\n });\n }\n\n // TODO: hoist this\n let _selectionModes = selectionModes;\n if (\n editable &&\n _selectionModes != null &&\n !_selectionModes.includes(RegionCardinality.CELLS)\n ) {\n _selectionModes = [..._selectionModes, RegionCardinality.CELLS];\n // Ensure selection mode includes \"cells\"\n }\n\n const cellRendererDependencies = [\n data,\n updatedData,\n focusedCell,\n rowStatus,\n filteredRowIndices,\n ];\n\n // Drive the table from the active provider's `fetchData`. A local (in-memory)\n // provider loads the whole array at once; a remote one uses the `pageSize` /\n // `fetchMode` props and shows load progress.\n let _showLoadProgress: boolean = false;\n let dataLoader: ReactNode = null;\n if (activeProvider != null) {\n _showLoadProgress = !isLocalProvider;\n // A local (in-memory) source loads all its rows in one page; its count\n // rides on the resolved provider (`localCount`), so `_DataSheet` no longer\n // takes a `data` prop — live rows come only from the store.\n dataLoader = h(_DataLoaderManager, {\n key: \"__data_loader\",\n fetchData: activeProvider.fetchData,\n pageSize: isLocalProvider ? Math.max(localCount, 1) : pageSize,\n fetchMode: isLocalProvider ? undefined : fetchMode,\n filterDebounce,\n initialData,\n });\n }\n const showFilterBar =\n (filters != null && filters.length > 0) || hasSortableOrFilterable;\n\n let filterStatus: ReactNode = null;\n if (showFilterBar) {\n filterStatus = h(ActiveFiltersList, { filters: filters ?? [] });\n }\n\n return h(\"div.data-sheet-container\", { className, style }, [\n // The actions/tools toolbar (selection-modal). Table-scoped controls like\n // scroll-to-row / full-text search live here as ordinary actions.\n h(ActionsToolbar, { actions: _actions }),\n dataLoader,\n children,\n h(\n \"div.data-sheet-holder\",\n {\n tabIndex: 0,\n onKeyDown: handleKeyDown,\n onKeyUp: handleKeyUp,\n ref: tableElementRef,\n style: holderStyle,\n },\n h(\n Table as any, // Some sort of hyperscript type error\n {\n ref,\n numRows,\n className: \"data-sheet\",\n enableFocusedCell,\n enableColumnReordering,\n onColumnsReordered,\n focusedCell,\n selectedRegions,\n defaultRowHeight: rowHeight,\n columnWidths,\n onColumnWidthChanged,\n onSelection,\n /** TODO: we could enable this if we had a use-case */\n enableRowReordering: false,\n enableRowResizing: false,\n // The cell renderer is memoized internally based on these data dependencies\n cellRendererDependencies,\n onVisibleCellsChange: _onVisibleCellsChange,\n rowHeaderCellRenderer,\n selectionModes: _selectionModes,\n ...tableProps,\n getCellClipboardData: null,\n },\n realizedColumns,\n ),\n ),\n h(\"div.status-bar\", [\n filterStatus,\n statusBar,\n h(\"div.spacer\"),\n h.if(_showLoadProgress)(LoadProgressIndicator),\n ]),\n h.if(debug)(CellRendererDebugOverlay, {\n cellRendererDependencies,\n names: [\n \"data\",\n \"updatedData\",\n \"focusedCell\",\n \"rowStatus\",\n \"filteredRowIndices\",\n ],\n }),\n ]);\n}\n\nconst EMPTY_MAP = new Map<string, number>();\n\nconst columnWidthsIndexAtom = atom(\n (get) => get(storeAtom)?.columnWidthsIndex ?? EMPTY_MAP,\n);\nconst defaultColumnWidthAtom = atom(\n (get) => get(storeAtom)?.defaultColumnWidth ?? 150,\n);\n\nconst columnWidthsAtom = atom((get) => {\n const ix = get(columnWidthsIndexAtom);\n return get(columnSpecAtom).map(\n (col) => ix.get(col.key) ?? col.width ?? get(defaultColumnWidthAtom),\n );\n});\n\nfunction styleParamsForDensity(density: DataSheetDensity): {\n rowHeight: number;\n style: Record<string, string>;\n} {\n switch (density) {\n case DataSheetDensity.MEDIUM:\n return {\n rowHeight: 24,\n style: {\n \"--data-sheet-row-height\": \"24px\",\n \"--data-sheet-font-size\": \"14px\",\n },\n };\n case DataSheetDensity.LOW:\n return {\n rowHeight: 30,\n style: {\n \"--data-sheet-row-height\": \"30px\",\n \"--data-sheet-font-size\": \"18px\",\n },\n };\n case DataSheetDensity.HIGH:\n default:\n return {\n rowHeight: 20,\n style: {\n \"--data-sheet-row-height\": \"20px\",\n \"--data-sheet-font-size\": \"12px\",\n },\n };\n }\n}\n\n/** Convenience component: runs `useChunkLoader` from inside a `DataSheet`.\n * Render as a child of `DataSheet` (it renders nothing itself). */\nfunction _DataLoaderManager<T = any>({\n fetchData,\n ...rest\n}: {\n fetchData: FetchData<T>;\n} & FetchDataOptions<any>) {\n useDataLoader(fetchData, rest);\n return null;\n}\n"],"names":["splitDataProviderProps","DataViewRendererType","h","DataSheetProvider","atom","DataSheetDensity","ctx","useSelector","dataProviderAtom","dataRefreshTokenAtom","useMemo","persistViaProvider","_actions","columnControlActions","clipboardActions","createSaveAction","resetChangesAction","tableActionsAtom","tableHotkeysAtom","useHotkeys","useStoreAPI","useScrollHandler","useCallback","useEffect","useRef","tableFooterAtom","activeFilters","DEFAULT_ROW_STATUS_STYLES","renderColumnHeaderCell","colIndex","Column","basicCellRenderer","style","name","TableElementStatus","RowHeaderCell","RegionCardinality","ErrorCallout","ActiveFiltersList","ActionsToolbar","Table","LoadProgressIndicator","CellRendererDebugOverlay","storeAtom","columnSpecAtom","useDataLoader"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;AAyEA,MAAM,uBAAuB;AAEtB,SAAS,UAAa,OAA0B;AACrD,QAAM;AAAA,IACJ;AAAA,IACA;AAAA,IACA;AAAA,IACA,WAAW;AAAA,IACX,yBAAyB;AAAA,IACzB,oBAAoB;AAAA,IACpB,qBAAqB;AAAA,IACrB;AAAA,IACA;AAAA,IACA,GAA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,sBAAsB,SAG7B;AACA,UAAQ,SAAA;AAAA,IACN,KAAKvC,QAAAA,iBAAiB;AACpB,aAAO;AAAA,QACL,WAAW;AAAA,QACX,OAAO;AAAA,UACL,2BAA2B;AAAA,UAC3B,0BAA0B;AAAA,QAAA;AAAA,MAC5B;AAAA,IAEJ,KAAKA,QAAAA,iBAAiB;AACpB,aAAO;AAAA,QACL,WAAW;AAAA,QACX,OAAO;AAAA,UACL,2BAA2B;AAAA,UAC3B,0BAA0B;AAAA,QAAA;AAAA,MAC5B;AAAA,IAEJ,KAAKA,QAAAA,iBAAiB;AAAA,IACtB;AACE,aAAO;AAAA,QACL,WAAW;AAAA,QACX,OAAO;AAAA,UACL,2BAA2B;AAAA,UAC3B,0BAA0B;AAAA,QAAA;AAAA,MAC5B;AAAA,EACF;AAEN;AAIA,SAAS,mBAA4B;AAAA,EACnC;AAAA,EACA,GAAG;AACL,GAE2B;AACzBwC,cAAAA,cAAc,WAAW,IAAI;AAC7B,SAAO;AACT;;;"}
@@ -1094,35 +1094,51 @@
1094
1094
  .bp6-table-no-layout{
1095
1095
  display:inline-block;
1096
1096
  position:absolute;
1097
- }._data-sheet-container_1xwuq_1, ._data-sheet-holder_1xwuq_1 {
1097
+ }/*
1098
+ * Copyright 2023 Palantir Technologies, Inc. All rights reserved.
1099
+ */
1100
+ .bp6-dark ._data-sheet-container_14j1s_4, .bp6-dark ._data-sheet-holder_14j1s_4 {
1101
+ --data-sheet-cell-background-color-internal: var(--data-sheet-cell-background-color, #2f343c);
1102
+ --data-sheet-divider-color-internal: var(--data-sheet-divider-color, rgba(17, 20, 24, 0.4));
1103
+ }
1104
+
1105
+ ._data-sheet-container_14j1s_4, ._data-sheet-holder_14j1s_4 {
1098
1106
  flex: 1;
1099
1107
  min-height: 0;
1100
1108
  font-size: var(--data-sheet-font-size, 12px);
1101
1109
  line-height: var(--data-sheet-row-height, 20px);
1102
1110
  --data-sheet-cell-padding: 0px 8px;
1111
+ --data-sheet-divider-color-internal: var(--data-sheet-divider-color, rgba(17, 20, 24, 0.15));
1112
+ --data-sheet-cell-background-color-internal: var(--data-sheet-cell-background-color, #edeff2);
1103
1113
  }
1104
- ._data-sheet-container_1xwuq_1 .bp6-table-cell, ._data-sheet-holder_1xwuq_1 .bp6-table-cell {
1114
+ ._data-sheet-container_14j1s_4 .bp6-table-cell, ._data-sheet-holder_14j1s_4 .bp6-table-cell {
1105
1115
  --tag-line-height: 1.25;
1106
1116
  --tag-picker-height: calc(var(--data-sheet-row-height) - 1px);
1107
1117
  --tag-picker-overflow: hidden;
1108
1118
  --tag-row-wrap: nowrap;
1109
1119
  padding: var(--data-sheet-cell-padding);
1110
1120
  }
1111
- ._data-sheet-container_1xwuq_1 .bp6-table-cell:not([class*=bp6-intent-]):not(.bp6-loading), ._data-sheet-holder_1xwuq_1 .bp6-table-cell:not([class*=bp6-intent-]):not(.bp6-loading) {
1121
+ ._data-sheet-container_14j1s_4 .bp6-table-cell:not([class*=bp6-intent-]):not(.bp6-loading), ._data-sheet-holder_14j1s_4 .bp6-table-cell:not([class*=bp6-intent-]):not(.bp6-loading) {
1112
1122
  color: var(--text-color);
1113
1123
  }
1114
- ._data-sheet-container_1xwuq_1 .bp6-table-cell, ._data-sheet-container_1xwuq_1 .bp6-table-row-name, ._data-sheet-holder_1xwuq_1 .bp6-table-cell, ._data-sheet-holder_1xwuq_1 .bp6-table-row-name {
1124
+ ._data-sheet-container_14j1s_4 .bp6-table-cell, ._data-sheet-container_14j1s_4 .bp6-table-row-name, ._data-sheet-holder_14j1s_4 .bp6-table-cell, ._data-sheet-holder_14j1s_4 .bp6-table-row-name {
1115
1125
  font-size: var(--data-sheet-font-size);
1116
1126
  line-height: var(--data-sheet-row-height);
1117
1127
  }
1118
- ._data-sheet-container_1xwuq_1 .bp6-table-row-name, ._data-sheet-holder_1xwuq_1 .bp6-table-row-name {
1128
+ ._data-sheet-container_14j1s_4 .bp6-table-cell, ._data-sheet-holder_14j1s_4 .bp6-table-cell {
1129
+ box-shadow: inset 0 -1px 0 var(--data-sheet-divider-color-internal), inset -1px 0 0 var(--data-sheet-divider-color-internal);
1130
+ }
1131
+ ._data-sheet-container_14j1s_4 .bp6-table-cell-client, ._data-sheet-holder_14j1s_4 .bp6-table-cell-client {
1132
+ background-color: var(--data-sheet-cell-background-color-internal);
1133
+ }
1134
+ ._data-sheet-container_14j1s_4 .bp6-table-row-name, ._data-sheet-holder_14j1s_4 .bp6-table-row-name {
1119
1135
  color: var(--secondary-color);
1120
1136
  }
1121
- ._data-sheet-container_1xwuq_1 .bp6-table-column-name, ._data-sheet-holder_1xwuq_1 .bp6-table-column-name {
1137
+ ._data-sheet-container_14j1s_4 .bp6-table-column-name, ._data-sheet-holder_14j1s_4 .bp6-table-column-name {
1122
1138
  font-size: 1.2em;
1123
1139
  }
1124
1140
 
1125
- ._data-sheet-container_1xwuq_1 {
1141
+ ._data-sheet-container_14j1s_4 {
1126
1142
  display: flex;
1127
1143
  position: relative;
1128
1144
  height: 100%;
@@ -1131,14 +1147,14 @@
1131
1147
  max-width: 100%;
1132
1148
  }
1133
1149
 
1134
- ._data-sheet_1xwuq_1 {
1150
+ ._data-sheet_14j1s_4 {
1135
1151
  height: 100%;
1136
1152
  }
1137
- ._data-sheet_1xwuq_1 .bp6-table-quadrant {
1153
+ ._data-sheet_14j1s_4 .bp6-table-quadrant {
1138
1154
  background-color: var(--panel-secondary-background-color);
1139
1155
  }
1140
1156
 
1141
- ._input-cell_1xwuq_45 input {
1157
+ ._input-cell_14j1s_61 input {
1142
1158
  width: 100%;
1143
1159
  height: 100%;
1144
1160
  padding: 0;
@@ -1151,16 +1167,16 @@
1151
1167
  font-family: inherit;
1152
1168
  font-size: inherit;
1153
1169
  }
1154
- ._input-cell_1xwuq_45 input:focus {
1170
+ ._input-cell_14j1s_61 input:focus {
1155
1171
  outline: none;
1156
1172
  }
1157
1173
 
1158
- ._derived-cell_1xwuq_62 {
1174
+ ._derived-cell_14j1s_78 {
1159
1175
  color: var(--pz-text-subtle-color, var(--secondary-color)) !important;
1160
1176
  font-style: italic;
1161
1177
  }
1162
1178
 
1163
- ._value-viewer-cell_1xwuq_67 .bp6-popover-target {
1179
+ ._value-viewer-cell_14j1s_83 .bp6-popover-target {
1164
1180
  width: 100%;
1165
1181
  height: var(--data-sheet-row-height);
1166
1182
  position: relative;
@@ -1168,11 +1184,11 @@
1168
1184
  margin: calc(var(--data-sheet-cell-padding) * -1);
1169
1185
  }
1170
1186
 
1171
- ._editor-cell_1xwuq_75 {
1187
+ ._editor-cell_14j1s_91 {
1172
1188
  --tag-outline: 0 0 0 1px rgba(128, 128, 128, 0.35);
1173
1189
  }
1174
1190
 
1175
- ._editor-cell_1xwuq_75 .bp6-popover-target {
1191
+ ._editor-cell_14j1s_91 .bp6-popover-target {
1176
1192
  position: absolute;
1177
1193
  top: 0;
1178
1194
  left: 0;
@@ -1180,20 +1196,20 @@
1180
1196
  height: 100%;
1181
1197
  }
1182
1198
 
1183
- ._hidden-input_1xwuq_87 {
1199
+ ._hidden-input_14j1s_103 {
1184
1200
  opacity: 0;
1185
1201
  position: absolute;
1186
1202
  width: 0;
1187
1203
  }
1188
1204
 
1189
- ._data-editor-anchor_1xwuq_93 {
1205
+ ._data-editor-anchor_14j1s_109 {
1190
1206
  width: 100%;
1191
1207
  height: 100%;
1192
1208
  margin: 0;
1193
1209
  pointer-events: none;
1194
1210
  }
1195
1211
 
1196
- ._corner-drag-handle_1xwuq_100 {
1212
+ ._corner-drag-handle_14j1s_116 {
1197
1213
  position: absolute;
1198
1214
  bottom: 0;
1199
1215
  right: 0;
@@ -1203,23 +1219,23 @@
1203
1219
  background-color: dodgerblue;
1204
1220
  }
1205
1221
 
1206
- ._data-sheet-toolbar_1xwuq_110 {
1222
+ ._data-sheet-toolbar_14j1s_126 {
1207
1223
  display: flex;
1208
1224
  flex-direction: row;
1209
1225
  margin-bottom: 4px;
1210
1226
  }
1211
1227
 
1212
- ._spacer_1xwuq_116 {
1228
+ ._spacer_14j1s_132 {
1213
1229
  flex-grow: 1;
1214
1230
  }
1215
1231
 
1216
- ._table-control_1xwuq_120 {
1232
+ ._table-control_14j1s_136 {
1217
1233
  display: flex;
1218
1234
  flex-direction: row;
1219
1235
  margin-bottom: 0.25em;
1220
1236
  }
1221
1237
 
1222
- ._status-bar_1xwuq_126 {
1238
+ ._status-bar_14j1s_142 {
1223
1239
  display: flex;
1224
1240
  flex-direction: row;
1225
1241
  padding: 0.2em 0.5em;
@@ -192,6 +192,10 @@ function DataSheetRenderer({
192
192
  useEffect(() => {
193
193
  storeState.setState({ tableElement: tableElementRef.current });
194
194
  }, [storeState]);
195
+ const densityRowHeight = styleParamsForDensity(density).rowHeight;
196
+ useEffect(() => {
197
+ storeState.setState({ rowHeight: densityRowHeight });
198
+ }, [storeState, densityRowHeight]);
195
199
  useEffect(() => {
196
200
  storeState.setState({ onEdit });
197
201
  }, [storeState, onEdit]);