@macrostrat/data-sheet 4.2.0 → 4.3.0
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.
- package/CHANGELOG.md +95 -0
- package/dist/actions/types.d.ts +10 -0
- package/dist/components/indicators/filter-and-sort.cjs +47 -6
- package/dist/components/indicators/filter-and-sort.cjs.map +1 -1
- package/dist/components/indicators/filter-and-sort.d.ts +28 -6
- package/dist/components/indicators/filter-and-sort.js +48 -7
- package/dist/components/indicators/filter-and-sort.js.map +1 -1
- package/dist/components/indicators/filter-and-sort.module.sass.cjs +5 -3
- package/dist/components/indicators/filter-and-sort.module.sass.cjs.map +1 -1
- package/dist/components/indicators/filter-and-sort.module.sass.js +5 -3
- package/dist/components/indicators/filter-and-sort.module.sass.js.map +1 -1
- package/dist/components/indicators/unified-filters.cjs +36 -22
- package/dist/components/indicators/unified-filters.cjs.map +1 -1
- package/dist/components/indicators/unified-filters.d.ts +10 -8
- package/dist/components/indicators/unified-filters.js +37 -23
- package/dist/components/indicators/unified-filters.js.map +1 -1
- package/dist/components/indicators/view-info.cjs +11 -5
- package/dist/components/indicators/view-info.cjs.map +1 -1
- package/dist/components/indicators/view-info.d.ts +6 -1
- package/dist/components/indicators/view-info.js +12 -6
- package/dist/components/indicators/view-info.js.map +1 -1
- package/dist/components/toolbars/actions-toolbar.cjs +7 -1
- package/dist/components/toolbars/actions-toolbar.cjs.map +1 -1
- package/dist/components/toolbars/actions-toolbar.js +7 -1
- package/dist/components/toolbars/actions-toolbar.js.map +1 -1
- package/dist/data-panel.cjs +53 -8
- package/dist/data-panel.cjs.map +1 -1
- package/dist/data-panel.d.ts +1 -1
- package/dist/data-panel.js +54 -9
- package/dist/data-panel.js.map +1 -1
- package/dist/data-panel.module.sass.cjs +24 -21
- package/dist/data-panel.module.sass.cjs.map +1 -1
- package/dist/data-panel.module.sass.js +24 -21
- package/dist/data-panel.module.sass.js.map +1 -1
- package/dist/data-sheet.cjs +9 -2
- package/dist/data-sheet.cjs.map +1 -1
- package/dist/data-sheet.css +56 -35
- package/dist/data-sheet.d.ts +1 -1
- package/dist/data-sheet.js +9 -2
- package/dist/data-sheet.js.map +1 -1
- package/dist/index.cjs +2 -0
- package/dist/index.cjs.map +1 -1
- package/dist/index.js +3 -1
- package/dist/postgrest-table/data-loaders.cjs +20 -3
- package/dist/postgrest-table/data-loaders.cjs.map +1 -1
- package/dist/postgrest-table/data-loaders.d.ts +10 -0
- package/dist/postgrest-table/data-loaders.js +21 -4
- package/dist/postgrest-table/data-loaders.js.map +1 -1
- package/dist/provider/core.cjs +27 -56
- package/dist/provider/core.cjs.map +1 -1
- package/dist/provider/core.d.ts +7 -9
- package/dist/provider/core.js +19 -48
- package/dist/provider/core.js.map +1 -1
- package/dist/provider/interactions.d.ts +1 -1
- package/dist/provider/selection.d.ts +1 -1
- package/dist/types.cjs.map +1 -1
- package/dist/types.d.ts +4 -0
- package/dist/types.js.map +1 -1
- package/package.json +6 -7
- package/src/actions/types.ts +11 -0
- package/src/components/indicators/filter-and-sort.module.sass +7 -0
- package/src/components/indicators/filter-and-sort.ts +71 -11
- package/src/components/indicators/unified-filters.ts +66 -29
- package/src/components/indicators/view-info.ts +15 -5
- package/src/components/toolbars/actions-toolbar.ts +10 -1
- package/src/data-panel.module.sass +18 -1
- package/src/data-panel.ts +67 -8
- package/src/data-sheet.ts +18 -2
- package/src/postgrest-table/data-loaders.ts +40 -4
- package/src/provider/core.ts +29 -53
- package/src/types.ts +4 -0
|
@@ -1,30 +1,33 @@
|
|
|
1
1
|
import h$1 from "@macrostrat/hyper";
|
|
2
|
-
const sentinel = "
|
|
3
|
-
const spacer = "
|
|
4
|
-
const selected = "
|
|
5
|
-
const selectable = "
|
|
2
|
+
const sentinel = "_sentinel_23o7r_84";
|
|
3
|
+
const spacer = "_spacer_23o7r_106";
|
|
4
|
+
const selected = "_selected_23o7r_125";
|
|
5
|
+
const selectable = "_selectable_23o7r_134";
|
|
6
6
|
const styles = {
|
|
7
|
-
"data-panel": "_data-
|
|
8
|
-
"data-panel-main": "_data-panel-
|
|
9
|
-
"data-panel-sidebar-container": "_data-panel-sidebar-
|
|
10
|
-
"data-panel-body": "_data-panel-
|
|
11
|
-
"content-footer-holder": "_content-footer-
|
|
12
|
-
"data-panel-
|
|
13
|
-
"
|
|
7
|
+
"data-panel": "_data-panel_23o7r_5",
|
|
8
|
+
"data-panel-main": "_data-panel-main_23o7r_19",
|
|
9
|
+
"data-panel-sidebar-container": "_data-panel-sidebar-container_23o7r_25",
|
|
10
|
+
"data-panel-body": "_data-panel-body_23o7r_34",
|
|
11
|
+
"content-footer-holder": "_content-footer-holder_23o7r_54",
|
|
12
|
+
"data-panel-item-container": "_data-panel-item-container_23o7r_62",
|
|
13
|
+
"is-skeleton": "_is-skeleton_23o7r_62",
|
|
14
|
+
"data-panel-skeleton": "_data-panel-skeleton_23o7r_66",
|
|
15
|
+
"data-panel-list": "_data-panel-list_23o7r_72",
|
|
16
|
+
"data-panel-item": "_data-panel-item_23o7r_62",
|
|
14
17
|
sentinel,
|
|
15
|
-
"data-panel-toolbar-content": "_data-panel-toolbar-
|
|
16
|
-
"data-panel-footer": "_data-panel-
|
|
17
|
-
"data-panel-footer-content": "_data-panel-footer-
|
|
18
|
+
"data-panel-toolbar-content": "_data-panel-toolbar-content_23o7r_94",
|
|
19
|
+
"data-panel-footer": "_data-panel-footer_23o7r_98",
|
|
20
|
+
"data-panel-footer-content": "_data-panel-footer-content_23o7r_102",
|
|
18
21
|
spacer,
|
|
19
|
-
"data-panel-status-bar": "_data-panel-status-
|
|
20
|
-
"data-card": "_data-
|
|
22
|
+
"data-panel-status-bar": "_data-panel-status-bar_23o7r_110",
|
|
23
|
+
"data-card": "_data-card_23o7r_116",
|
|
21
24
|
selected,
|
|
22
25
|
selectable,
|
|
23
|
-
"toolbar-style-bordered": "_toolbar-style-
|
|
24
|
-
"data-panel-toolbar": "_data-panel-
|
|
25
|
-
"toolbar-style-floating": "_toolbar-style-
|
|
26
|
-
"toolbar-style-fade": "_toolbar-style-
|
|
27
|
-
"is-scrolled": "_is-
|
|
26
|
+
"toolbar-style-bordered": "_toolbar-style-bordered_23o7r_139",
|
|
27
|
+
"data-panel-toolbar": "_data-panel-toolbar_23o7r_94",
|
|
28
|
+
"toolbar-style-floating": "_toolbar-style-floating_23o7r_148",
|
|
29
|
+
"toolbar-style-fade": "_toolbar-style-fade_23o7r_190",
|
|
30
|
+
"is-scrolled": "_is-scrolled_23o7r_190"
|
|
28
31
|
};
|
|
29
32
|
let h = h$1.styled(styles);
|
|
30
33
|
Object.assign(h, styles);
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"data-panel.module.sass.js","sources":[],"sourcesContent":[],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"data-panel.module.sass.js","sources":[],"sourcesContent":[],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;"}
|
package/dist/data-sheet.cjs
CHANGED
|
@@ -54,6 +54,7 @@ function DataSheetRenderer({
|
|
|
54
54
|
provider,
|
|
55
55
|
pageSize,
|
|
56
56
|
fetchMode,
|
|
57
|
+
filterDebounce,
|
|
57
58
|
onVisibleCellsChange,
|
|
58
59
|
onUpdateData,
|
|
59
60
|
onEdit,
|
|
@@ -173,6 +174,9 @@ function DataSheetRenderer({
|
|
|
173
174
|
};
|
|
174
175
|
}
|
|
175
176
|
const onColumnsReordered = core.useSelector((state) => state.onColumnsReordered);
|
|
177
|
+
const enableColumnReordering = core.useSelector(
|
|
178
|
+
(state) => state.enableColumnReordering
|
|
179
|
+
);
|
|
176
180
|
const hasSortableOrFilterable = react.useMemo(
|
|
177
181
|
() => columnSpec.some(
|
|
178
182
|
(col) => col.sortable || col.filterable || Array.isArray(col.filters) && col.filters.length > 0
|
|
@@ -280,7 +284,7 @@ function DataSheetRenderer({
|
|
|
280
284
|
const defaultLabel = `${dataRowIndex + 1}`;
|
|
281
285
|
let name2 = defaultLabel;
|
|
282
286
|
if (rowHeaderRenderer != null) {
|
|
283
|
-
|
|
287
|
+
const custom = rowHeaderRenderer({
|
|
284
288
|
rowIndex: dataRowIndex,
|
|
285
289
|
visibleIndex: rowIndex,
|
|
286
290
|
row: data[dataRowIndex] ?? updatedData[dataRowIndex],
|
|
@@ -288,6 +292,7 @@ function DataSheetRenderer({
|
|
|
288
292
|
isDeleted: statusVal === types.TableElementStatus.DELETED,
|
|
289
293
|
defaultLabel
|
|
290
294
|
});
|
|
295
|
+
if (custom != null) name2 = custom;
|
|
291
296
|
}
|
|
292
297
|
return main_module.default(table.RowHeaderCell, {
|
|
293
298
|
enableRowReordering: false,
|
|
@@ -330,7 +335,8 @@ function DataSheetRenderer({
|
|
|
330
335
|
key: "__data_loader",
|
|
331
336
|
fetchData: activeProvider.fetchData,
|
|
332
337
|
pageSize: isLocalProvider ? Math.max(localCount, 1) : pageSize,
|
|
333
|
-
fetchMode: isLocalProvider ? void 0 : fetchMode
|
|
338
|
+
fetchMode: isLocalProvider ? void 0 : fetchMode,
|
|
339
|
+
filterDebounce
|
|
334
340
|
});
|
|
335
341
|
}
|
|
336
342
|
const showFilterBar = filters != null && filters.length > 0 || hasSortableOrFilterable;
|
|
@@ -361,6 +367,7 @@ function DataSheetRenderer({
|
|
|
361
367
|
numRows,
|
|
362
368
|
className: "data-sheet",
|
|
363
369
|
enableFocusedCell,
|
|
370
|
+
enableColumnReordering,
|
|
364
371
|
onColumnsReordered,
|
|
365
372
|
focusedCell,
|
|
366
373
|
selectedRegions,
|
package/dist/data-sheet.cjs.map
CHANGED
|
@@ -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 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\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 let name: string = defaultLabel;\n if (rowHeaderRenderer != null) {\n return 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 }\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 });\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 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) {\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,GAAG;AAAA,EAAA,IACD;AAEJ,QAAM,CAAC,eAAe,aAAa,IAAIA,4BAA0B;AAAA,IAC/D,GAAG;AAAA,IACH,UAAUC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UACL,2BAA2B;AAAA,UAC3B,0BAA0B;AAAA,QAAA;AAAA,MAC5B;AAAA,EACF;AAEN;AAIA,SAAS,mBAA4B;AAAA,EACnC;AAAA,EACA,GAAG;AACL,GAEsB;AACpBwC,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 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 });\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) {\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,GAAG;AAAA,EAAA,IACD;AAEJ,QAAM,CAAC,eAAe,aAAa,IAAIA,4BAA0B;AAAA,IAC/D,GAAG;AAAA,IACH,UAAUC,aAAAA,qBAAqB;AAAA,EAAA,CAChC;AACD,SAAOC,YAAAA;AAAAA,IACLC,KAAAA;AAAAA,IACA;AAAA,IACAD,YAAAA,QAAE,mBAAwB,aAAa;AAAA,EAAA;AAE3C;AAEA,MAAM,cAAcE,MAAAA,KAAK,KAAK;AAKvB,SAAS,kBAAqB;AAAA,EACnC;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA,aAAa;AAAA,EACb,WAAW;AAAA;AAAA;AAAA;AAAA,EAIX,UAAU;AAAA,EACV;AAAA,EACA,cAAc;AAAA,EACd;AAAA,E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 0.5em;
|
|
1213
1213
|
gap: 0.5em;
|
|
1214
1214
|
background-color: var(--panel-secondary-background-color);
|
|
1215
|
-
}._filter-form-
|
|
1215
|
+
}._filter-form-container_11itq_1 {
|
|
1216
1216
|
display: flex;
|
|
1217
1217
|
flex-direction: column;
|
|
1218
1218
|
gap: 6px;
|
|
@@ -1220,12 +1220,19 @@
|
|
|
1220
1220
|
padding: 6px;
|
|
1221
1221
|
}
|
|
1222
1222
|
|
|
1223
|
-
span.
|
|
1223
|
+
span._sep_11itq_9:first-child, span._sep_11itq_9:last-child {
|
|
1224
1224
|
display: none;
|
|
1225
1225
|
}
|
|
1226
1226
|
|
|
1227
|
-
._filter-
|
|
1227
|
+
._filter-value_11itq_13 {
|
|
1228
1228
|
font-style: oblique;
|
|
1229
|
+
}
|
|
1230
|
+
|
|
1231
|
+
._menu-inline-filter_11itq_17 {
|
|
1232
|
+
list-style: none;
|
|
1233
|
+
}
|
|
1234
|
+
._menu-inline-filter_11itq_17 ._menu-inline-filter-body_11itq_20 {
|
|
1235
|
+
min-width: 240px;
|
|
1229
1236
|
}._interaction-barrier_19ibd_1 {
|
|
1230
1237
|
pointer-events: all;
|
|
1231
1238
|
}
|
|
@@ -1471,7 +1478,7 @@ span._sep_jip9h_9:first-child, span._sep_jip9h_9:last-child {
|
|
|
1471
1478
|
--data-panel-content-padding: 0px;
|
|
1472
1479
|
}
|
|
1473
1480
|
|
|
1474
|
-
._data-
|
|
1481
|
+
._data-panel_23o7r_5 {
|
|
1475
1482
|
display: flex;
|
|
1476
1483
|
flex: 1 1 auto;
|
|
1477
1484
|
min-height: 0;
|
|
@@ -1485,13 +1492,13 @@ span._sep_jip9h_9:first-child, span._sep_jip9h_9:last-child {
|
|
|
1485
1492
|
--data-panel-selected-background: rgba(45, 114, 210, 0.1);
|
|
1486
1493
|
}
|
|
1487
1494
|
|
|
1488
|
-
._data-panel-
|
|
1495
|
+
._data-panel-main_23o7r_19 {
|
|
1489
1496
|
display: flex;
|
|
1490
1497
|
flex-direction: column;
|
|
1491
1498
|
flex: 1 1 auto;
|
|
1492
1499
|
}
|
|
1493
1500
|
|
|
1494
|
-
._data-panel-sidebar-
|
|
1501
|
+
._data-panel-sidebar-container_23o7r_25 {
|
|
1495
1502
|
flex: 0 0 auto;
|
|
1496
1503
|
width: var(--data-panel-sidebar-width, 240px);
|
|
1497
1504
|
min-height: 0;
|
|
@@ -1500,7 +1507,7 @@ span._sep_jip9h_9:first-child, span._sep_jip9h_9:last-child {
|
|
|
1500
1507
|
border-left: 1px solid var(--panel-rule-color);
|
|
1501
1508
|
}
|
|
1502
1509
|
|
|
1503
|
-
._data-panel-
|
|
1510
|
+
._data-panel-body_23o7r_34 {
|
|
1504
1511
|
flex: 1 1 auto;
|
|
1505
1512
|
min-height: 0;
|
|
1506
1513
|
min-width: 0;
|
|
@@ -1508,35 +1515,49 @@ span._sep_jip9h_9:first-child, span._sep_jip9h_9:last-child {
|
|
|
1508
1515
|
padding: var(--data-panel-content-padding);
|
|
1509
1516
|
}
|
|
1510
1517
|
|
|
1511
|
-
._data-panel-
|
|
1518
|
+
._data-panel-main_23o7r_19 > * {
|
|
1512
1519
|
display: flex;
|
|
1513
1520
|
flex-direction: column;
|
|
1514
1521
|
align-items: center;
|
|
1515
1522
|
}
|
|
1516
|
-
._data-panel-
|
|
1523
|
+
._data-panel-main_23o7r_19 > * > * {
|
|
1517
1524
|
flex: 1;
|
|
1518
1525
|
max-width: var(--data-panel-content-width, 100%);
|
|
1519
1526
|
width: var(--data-panel-content-width, 100%);
|
|
1520
1527
|
min-width: 0;
|
|
1521
1528
|
}
|
|
1522
1529
|
|
|
1523
|
-
._content-footer-
|
|
1530
|
+
._content-footer-holder_23o7r_54 {
|
|
1524
1531
|
flex: 0 0 auto;
|
|
1532
|
+
min-height: 44px;
|
|
1533
|
+
display: flex;
|
|
1534
|
+
align-items: center;
|
|
1535
|
+
justify-content: center;
|
|
1536
|
+
}
|
|
1537
|
+
|
|
1538
|
+
._data-panel-item-container_23o7r_62._is-skeleton_23o7r_62 {
|
|
1539
|
+
pointer-events: none;
|
|
1540
|
+
}
|
|
1541
|
+
|
|
1542
|
+
._data-panel-skeleton_23o7r_66 {
|
|
1543
|
+
width: 100%;
|
|
1544
|
+
min-height: 3.25em;
|
|
1545
|
+
border-radius: 4px;
|
|
1525
1546
|
}
|
|
1526
1547
|
|
|
1527
|
-
._data-panel-
|
|
1548
|
+
._data-panel-list_23o7r_72 {
|
|
1528
1549
|
display: flex;
|
|
1529
1550
|
flex-direction: column;
|
|
1530
1551
|
gap: var(--data-panel-item-gap, 8px);
|
|
1531
1552
|
flex-grow: 1;
|
|
1532
1553
|
}
|
|
1533
1554
|
|
|
1534
|
-
._data-panel-
|
|
1555
|
+
._data-panel-item_23o7r_62 {
|
|
1535
1556
|
user-select: none;
|
|
1536
1557
|
break-inside: avoid;
|
|
1537
1558
|
}
|
|
1538
1559
|
|
|
1539
|
-
.
|
|
1560
|
+
._sentinel_23o7r_84 {
|
|
1540
1561
|
display: flex;
|
|
1541
1562
|
align-items: center;
|
|
1542
1563
|
justify-content: center;
|
|
@@ -1546,29 +1567,29 @@ span._sep_jip9h_9:first-child, span._sep_jip9h_9:last-child {
|
|
|
1546
1567
|
font-size: 13px;
|
|
1547
1568
|
}
|
|
1548
1569
|
|
|
1549
|
-
._data-panel-toolbar-
|
|
1570
|
+
._data-panel-toolbar-content_23o7r_94 {
|
|
1550
1571
|
max-width: var(--data-panel-content-width);
|
|
1551
1572
|
}
|
|
1552
1573
|
|
|
1553
|
-
._data-panel-
|
|
1574
|
+
._data-panel-footer_23o7r_98 {
|
|
1554
1575
|
color: var(--text-subtle, #738091);
|
|
1555
1576
|
}
|
|
1556
1577
|
|
|
1557
|
-
._data-panel-footer-
|
|
1578
|
+
._data-panel-footer-content_23o7r_102 {
|
|
1558
1579
|
gap: var(--data-panel-item-gap, 8px);
|
|
1559
1580
|
padding: 0.2em var(--data-panel-content-padding);
|
|
1560
1581
|
}
|
|
1561
|
-
._data-panel-footer-
|
|
1582
|
+
._data-panel-footer-content_23o7r_102 ._spacer_23o7r_106 {
|
|
1562
1583
|
flex: 1;
|
|
1563
1584
|
}
|
|
1564
1585
|
|
|
1565
|
-
._data-panel-status-
|
|
1586
|
+
._data-panel-status-bar_23o7r_110 {
|
|
1566
1587
|
display: flex;
|
|
1567
1588
|
flex-direction: row;
|
|
1568
1589
|
align-items: center;
|
|
1569
1590
|
}
|
|
1570
1591
|
|
|
1571
|
-
._data-
|
|
1592
|
+
._data-card_23o7r_116 {
|
|
1572
1593
|
display: flex;
|
|
1573
1594
|
gap: var(--data-panel-item-gap, 1em);
|
|
1574
1595
|
padding: var(--data-panel-card-padding, 1em);
|
|
@@ -1577,71 +1598,71 @@ span._sep_jip9h_9:first-child, span._sep_jip9h_9:last-child {
|
|
|
1577
1598
|
background: var(--card-background-color);
|
|
1578
1599
|
cursor: pointer;
|
|
1579
1600
|
}
|
|
1580
|
-
._data-
|
|
1601
|
+
._data-card_23o7r_116._selected_23o7r_125 {
|
|
1581
1602
|
background: var(--data-panel-selected-background);
|
|
1582
1603
|
outline: 1.5px solid var(--data-panel-selected-color);
|
|
1583
1604
|
}
|
|
1584
|
-
._data-
|
|
1605
|
+
._data-card_23o7r_116._selected_23o7r_125:hover {
|
|
1585
1606
|
background: var(--data-panel-selected-background);
|
|
1586
1607
|
border-color: var(--data-panel-selected-color);
|
|
1587
1608
|
outline-width: 2px;
|
|
1588
1609
|
}
|
|
1589
|
-
._data-
|
|
1610
|
+
._data-card_23o7r_116._selectable_23o7r_134:not(._selected_23o7r_125):hover {
|
|
1590
1611
|
border-color: rgba(128, 128, 128, 0.5);
|
|
1591
1612
|
background: rgba(128, 128, 128, 0.08);
|
|
1592
1613
|
}
|
|
1593
1614
|
|
|
1594
|
-
._data-
|
|
1615
|
+
._data-panel_23o7r_5._toolbar-style-bordered_23o7r_139 ._data-panel-toolbar_23o7r_94, ._data-panel_23o7r_5._toolbar-style-bordered_23o7r_139 ._data-panel-footer_23o7r_98 {
|
|
1595
1616
|
background-color: var(--panel-secondary-background-color);
|
|
1596
1617
|
}
|
|
1597
|
-
._data-
|
|
1618
|
+
._data-panel_23o7r_5._toolbar-style-bordered_23o7r_139 ._data-panel-toolbar_23o7r_94 {
|
|
1598
1619
|
border-bottom: 1px solid var(--panel-rule-color);
|
|
1599
1620
|
}
|
|
1600
|
-
._data-
|
|
1621
|
+
._data-panel_23o7r_5._toolbar-style-bordered_23o7r_139 ._data-panel-footer_23o7r_98 {
|
|
1601
1622
|
border-top: 1px solid var(--panel-rule-color);
|
|
1602
1623
|
}
|
|
1603
|
-
._data-
|
|
1624
|
+
._data-panel_23o7r_5._toolbar-style-floating_23o7r_148 {
|
|
1604
1625
|
--data-panel-top-margin: calc(var(--data-panel-toolbar-height, 40px) + 2 * var(--data-panel-content-padding, 12px));
|
|
1605
1626
|
}
|
|
1606
|
-
._data-
|
|
1627
|
+
._data-panel_23o7r_5._toolbar-style-floating_23o7r_148 ._data-panel-toolbar_23o7r_94, ._data-panel_23o7r_5._toolbar-style-floating_23o7r_148 ._data-panel-footer_23o7r_98 {
|
|
1607
1628
|
border-radius: 4px;
|
|
1608
1629
|
}
|
|
1609
|
-
._data-
|
|
1630
|
+
._data-panel_23o7r_5._toolbar-style-floating_23o7r_148 ._data-panel-footer_23o7r_98, ._data-panel_23o7r_5._toolbar-style-floating_23o7r_148 ._data-panel-toolbar_23o7r_94 {
|
|
1610
1631
|
z-index: 10;
|
|
1611
1632
|
min-width: 0;
|
|
1612
1633
|
max-width: fit-content;
|
|
1613
1634
|
position: absolute;
|
|
1614
1635
|
width: var(--data-panel-content-width, 100%);
|
|
1615
1636
|
}
|
|
1616
|
-
._data-
|
|
1637
|
+
._data-panel_23o7r_5._toolbar-style-floating_23o7r_148 ._data-panel-footer_23o7r_98 > *, ._data-panel_23o7r_5._toolbar-style-floating_23o7r_148 ._data-panel-toolbar_23o7r_94 > * {
|
|
1617
1638
|
max-width: unset;
|
|
1618
1639
|
flex-grow: unset;
|
|
1619
1640
|
width: unset;
|
|
1620
1641
|
}
|
|
1621
|
-
._data-
|
|
1642
|
+
._data-panel_23o7r_5._toolbar-style-floating_23o7r_148 ._data-panel-toolbar_23o7r_94 {
|
|
1622
1643
|
left: 50%;
|
|
1623
1644
|
transform: translateX(calc(var(--data-panel-content-width, 100%) / -2 - 4px));
|
|
1624
1645
|
top: var(--data-panel-content-padding, 12px);
|
|
1625
1646
|
background-color: var(--panel-secondary-background-color);
|
|
1626
1647
|
box-shadow: 0 0 0 1px var(--panel-rule-color);
|
|
1627
1648
|
}
|
|
1628
|
-
._data-
|
|
1649
|
+
._data-panel_23o7r_5._toolbar-style-floating_23o7r_148 ._data-panel-toolbar_23o7r_94 ._data-panel-toolbar-content_23o7r_94 {
|
|
1629
1650
|
padding-left: 6px;
|
|
1630
1651
|
padding-right: 6px;
|
|
1631
1652
|
}
|
|
1632
|
-
._data-
|
|
1653
|
+
._data-panel_23o7r_5._toolbar-style-floating_23o7r_148 ._data-panel-toolbar_23o7r_94 ._data-panel-toolbar-content_23o7r_94 > *:empty {
|
|
1633
1654
|
display: none;
|
|
1634
1655
|
}
|
|
1635
|
-
._data-
|
|
1656
|
+
._data-panel_23o7r_5._toolbar-style-floating_23o7r_148 ._data-panel-footer_23o7r_98 {
|
|
1636
1657
|
bottom: var(--data-panel-content-padding, 12px);
|
|
1637
1658
|
height: fit-content;
|
|
1638
1659
|
right: var(--data-panel-content-padding, 12px);
|
|
1639
1660
|
background-color: var(--background-color);
|
|
1640
1661
|
}
|
|
1641
|
-
._data-
|
|
1662
|
+
._data-panel_23o7r_5._toolbar-style-floating_23o7r_148 ._data-panel-body_23o7r_34 {
|
|
1642
1663
|
padding-top: var(--data-panel-top-margin);
|
|
1643
1664
|
mask-image: linear-gradient(to bottom, transparent 4px, var(--background-color) var(--data-panel-top-margin));
|
|
1644
1665
|
}
|
|
1645
|
-
._data-
|
|
1666
|
+
._data-panel_23o7r_5._toolbar-style-fade_23o7r_190 ._data-panel-body_23o7r_34._is-scrolled_23o7r_190 {
|
|
1646
1667
|
mask-image: linear-gradient(to bottom, transparent 0, var(--background-color) 20px);
|
|
1647
1668
|
}
|
package/dist/data-sheet.d.ts
CHANGED
|
@@ -10,7 +10,7 @@ export declare function DataSheet<T>(props: DataSheetProps<T>): import('react').
|
|
|
10
10
|
/** The table (cell-grid) renderer. Assumes it is rendered inside a
|
|
11
11
|
* `DataSheetProvider` (the `DataSheet` wrapper, or `DataView`). Exported so a
|
|
12
12
|
* shared-store `DataView` can mount it directly alongside `_DataPanel`. */
|
|
13
|
-
export declare function DataSheetRenderer<T>({ fetchData, provider, pageSize, fetchMode, onVisibleCellsChange, onUpdateData, onEdit, onSave, updatedData: updatedDataProp, rowStatus: rowStatusProp, identity: _identity, deriveOverlay, refreshToken: _refreshToken, onDeleteRows, name, verbose, debug, enableFocusedCell, autoFocusEditor, cellInteraction, enableClipboard, density, selectionModes, actions, filters, columnHeaderCellRenderer, statusBar, rowStatusStyles, rowHeaderRenderer, children, ...tableProps }: DataSheetRendererProps<T>): import('react').FunctionComponentElement<any> | import('react').ReactElement<{
|
|
13
|
+
export declare function DataSheetRenderer<T>({ fetchData, provider, pageSize, fetchMode, filterDebounce, onVisibleCellsChange, onUpdateData, onEdit, onSave, updatedData: updatedDataProp, rowStatus: rowStatusProp, identity: _identity, deriveOverlay, refreshToken: _refreshToken, onDeleteRows, name, verbose, debug, enableFocusedCell, autoFocusEditor, cellInteraction, enableClipboard, density, selectionModes, actions, filters, columnHeaderCellRenderer, statusBar, rowStatusStyles, rowHeaderRenderer, children, ...tableProps }: DataSheetRendererProps<T>): import('react').FunctionComponentElement<any> | import('react').ReactElement<{
|
|
14
14
|
className: string;
|
|
15
15
|
style: Record<string, string>;
|
|
16
16
|
}, string | import('react').JSXElementConstructor<any>>;
|
package/dist/data-sheet.js
CHANGED
|
@@ -52,6 +52,7 @@ function DataSheetRenderer({
|
|
|
52
52
|
provider,
|
|
53
53
|
pageSize,
|
|
54
54
|
fetchMode,
|
|
55
|
+
filterDebounce,
|
|
55
56
|
onVisibleCellsChange,
|
|
56
57
|
onUpdateData,
|
|
57
58
|
onEdit,
|
|
@@ -171,6 +172,9 @@ function DataSheetRenderer({
|
|
|
171
172
|
};
|
|
172
173
|
}
|
|
173
174
|
const onColumnsReordered = useSelector((state) => state.onColumnsReordered);
|
|
175
|
+
const enableColumnReordering = useSelector(
|
|
176
|
+
(state) => state.enableColumnReordering
|
|
177
|
+
);
|
|
174
178
|
const hasSortableOrFilterable = useMemo(
|
|
175
179
|
() => columnSpec.some(
|
|
176
180
|
(col) => col.sortable || col.filterable || Array.isArray(col.filters) && col.filters.length > 0
|
|
@@ -278,7 +282,7 @@ function DataSheetRenderer({
|
|
|
278
282
|
const defaultLabel = `${dataRowIndex + 1}`;
|
|
279
283
|
let name2 = defaultLabel;
|
|
280
284
|
if (rowHeaderRenderer != null) {
|
|
281
|
-
|
|
285
|
+
const custom = rowHeaderRenderer({
|
|
282
286
|
rowIndex: dataRowIndex,
|
|
283
287
|
visibleIndex: rowIndex,
|
|
284
288
|
row: data[dataRowIndex] ?? updatedData[dataRowIndex],
|
|
@@ -286,6 +290,7 @@ function DataSheetRenderer({
|
|
|
286
290
|
isDeleted: statusVal === TableElementStatus.DELETED,
|
|
287
291
|
defaultLabel
|
|
288
292
|
});
|
|
293
|
+
if (custom != null) name2 = custom;
|
|
289
294
|
}
|
|
290
295
|
return h(RowHeaderCell, {
|
|
291
296
|
enableRowReordering: false,
|
|
@@ -328,7 +333,8 @@ function DataSheetRenderer({
|
|
|
328
333
|
key: "__data_loader",
|
|
329
334
|
fetchData: activeProvider.fetchData,
|
|
330
335
|
pageSize: isLocalProvider ? Math.max(localCount, 1) : pageSize,
|
|
331
|
-
fetchMode: isLocalProvider ? void 0 : fetchMode
|
|
336
|
+
fetchMode: isLocalProvider ? void 0 : fetchMode,
|
|
337
|
+
filterDebounce
|
|
332
338
|
});
|
|
333
339
|
}
|
|
334
340
|
const showFilterBar = filters != null && filters.length > 0 || hasSortableOrFilterable;
|
|
@@ -359,6 +365,7 @@ function DataSheetRenderer({
|
|
|
359
365
|
numRows,
|
|
360
366
|
className: "data-sheet",
|
|
361
367
|
enableFocusedCell,
|
|
368
|
+
enableColumnReordering,
|
|
362
369
|
onColumnsReordered,
|
|
363
370
|
focusedCell,
|
|
364
371
|
selectedRegions,
|