@macrostrat/data-sheet 2.1.0 → 2.2.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 +10 -0
- package/dist/esm/{data-sheet.e09ffc66.js → data-sheet.2521a9d7.js} +4 -6
- package/dist/esm/data-sheet.2521a9d7.js.map +1 -0
- package/dist/esm/data-sheet.410c5122.js.map +1 -1
- package/dist/esm/{data-sheet.2773da15.js → data-sheet.aa2b4902.js} +18 -6
- package/dist/esm/data-sheet.aa2b4902.js.map +1 -0
- package/dist/esm/data-sheet.b4098761.js.map +1 -1
- package/dist/esm/{data-sheet.e37b4bd3.js → data-sheet.ce2a3218.js} +4 -2
- package/dist/esm/data-sheet.ce2a3218.js.map +1 -0
- package/dist/esm/{data-sheet.00171fc5.js → data-sheet.e09e2546.js} +63 -15
- package/dist/esm/data-sheet.e09e2546.js.map +1 -0
- package/dist/esm/index.d.ts +66 -20
- package/dist/esm/index.d.ts.map +1 -1
- package/dist/esm/index.js +7 -3
- package/dist/esm/index.js.map +1 -1
- package/dist/node/data-sheet.22cde343.js +2 -0
- package/dist/node/data-sheet.22cde343.js.map +1 -0
- package/dist/node/data-sheet.52753d1d.js +2 -0
- package/dist/node/data-sheet.52753d1d.js.map +1 -0
- package/dist/node/data-sheet.7bbad640.js.map +1 -1
- package/dist/node/data-sheet.820e5bc3.js +2 -0
- package/dist/node/data-sheet.820e5bc3.js.map +1 -0
- package/dist/node/data-sheet.846d5f8f.js +2 -0
- package/dist/node/data-sheet.846d5f8f.js.map +1 -0
- package/dist/node/data-sheet.86550c41.js +2 -0
- package/dist/node/data-sheet.86550c41.js.map +1 -0
- package/dist/node/data-sheet.cbbc8d31.js +2 -0
- package/dist/node/data-sheet.cbbc8d31.js.map +1 -0
- package/dist/node/index.js +1 -1
- package/dist/node/index.js.map +1 -1
- package/package.json +4 -4
- package/src/components/index.ts +1 -0
- package/src/core.ts +2 -7
- package/src/index.ts +2 -0
- package/src/postgrest-table/data-loaders.ts +27 -8
- package/src/postgrest-table/index.ts +72 -12
- package/src/provider.ts +4 -2
- package/src/utils/column-spec.ts +3 -1
- package/dist/esm/data-sheet.00171fc5.js.map +0 -1
- package/dist/esm/data-sheet.2773da15.js.map +0 -1
- package/dist/esm/data-sheet.e09ffc66.js.map +0 -1
- package/dist/esm/data-sheet.e37b4bd3.js.map +0 -1
- package/dist/node/data-sheet.0f66147e.js +0 -2
- package/dist/node/data-sheet.0f66147e.js.map +0 -1
- package/dist/node/data-sheet.47e3f95c.js +0 -2
- package/dist/node/data-sheet.47e3f95c.js.map +0 -1
- package/dist/node/data-sheet.599efaa9.js +0 -2
- package/dist/node/data-sheet.599efaa9.js.map +0 -1
- package/dist/node/data-sheet.95445483.js +0 -2
- package/dist/node/data-sheet.95445483.js.map +0 -1
- package/dist/node/data-sheet.c3eefdc9.js +0 -2
- package/dist/node/data-sheet.c3eefdc9.js.map +0 -1
- package/dist/node/data-sheet.e6e07d4a.js +0 -2
- package/dist/node/data-sheet.e6e07d4a.js.map +0 -1
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"mappings":"A,M,2C,A,O,2C,A,O,2C,A,Q,mB,C,C,e,C,C,U,C,C,U,C,C,c,C,K,mB,A,Q,U,C,C,iB,C,C,U,C,C,Q,C,K,oB,A,O,sC,A,Q,M,mB,A,Q,M,qB,A,Q,W,C,C,e,C,C,a,C,C,Y,C,K,O,C,S,E,C,C,C,C,C,C,C,E,O,c,C,E,E,C,I,E,I,E,W,C,E,a,C,C,E,C,ICsCY,E,E,W,E,C,E,E,C,E,E,E,iB,A,O,I,A,C,E,S,C,E,G,K,E,O,C,C,E,C,O,C,G,K,E,C,I,E,C,C,E,A,Q,C,C,E,C,I,E,C,G,E,Q,C,C,E,O,C,C,E,C,E,E,I,C,E,O,C,E,E,O,E,E,O,A,C,I,E,A,M,uB,E,I,O,E,I,C,mB,C,C,E,Q,C,S,C,C,C,E,C,C,E,C,C,E,E,iB,C,G,E,Q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X,CACF,GACA,EACE,EACA,CACE,KAAM,cACN,UAEE,EAAY,AADA,SAAS,GACH,EACpB,CACF,EACA,iBAEH,CACH,CAEA,SAAS,IAEP,OAAO,EACL,EACA,CACE,KAAM,OACN,QALW,AAAA,CAAA,EAAA,EAAA,WAAU,AAAV,EAAY,AAAC,GAAU,EAAM,MAAM,CAMhD,EACA,UAEJ,CAEO,SAAS,EAAS,CAAA,SAAE,CAAQ,CAAA,MAAE,CAAK,CAAE,GAAG,EAAM,EACnD,OAAO,EACL,EACA,CACE,YAAa,CAAA,EACb,GAAG,CAAI,AACT,EACA,EAEJ,CAIO,SAAS,EAAgB,CAAS,EACvC,IAAI,EAAuB,EAAE,CAC7B,IAAK,IAAM,KAAO,EAAW,CAE3B,GAAgB,MAAZ,EAAI,IAAI,EACR,AAAY,MAAZ,EAAI,IAAI,CADU,SAEtB,GAAM,CAAC,EAAY,EAAS,CAAG,EAAI,IAAI,CACvC,IAAK,IAAI,EAAI,EAAY,GAAK,EAAU,IACtC,EAAW,IAAI,CAAC,EAEpB,CACA,OAAO,CACT,Q,K,gB,C,K,S,C,K,e,C,K,Q,C,K,kB,C,K,I","sources":["<anon>","packages/data-sheet/src/core.ts"],"sourcesContent":["import \"./data-sheet.86550c41.js\";\nimport \"./data-sheet.f0223f39.js\";\nimport \"./data-sheet.52753d1d.js\";\nimport {HotkeysProvider as $oH60h$HotkeysProvider, ButtonGroup as $oH60h$ButtonGroup, Button as $oH60h$Button, Intent as $oH60h$Intent, InputGroup as $oH60h$InputGroup} from \"@blueprintjs/core\";\nimport {Table2 as $oH60h$Table2, RowHeaderCell as $oH60h$RowHeaderCell, Column as $oH60h$Column, Cell as $963b78d65282413b$import$5573889ca4ff9ca2$f6f0c3fe4ec306ea} from \"@blueprintjs/table\";\nimport \"@blueprintjs/table/lib/css/table.css\";\nimport $oH60h$macrostrathyper from \"@macrostrat/hyper\";\nimport $oH60h$immutabilityhelper from \"immutability-helper\";\nimport {useMemo as $oH60h$useMemo, useCallback as $oH60h$useCallback, useEffect as $oH60h$useEffect, useState as $oH60h$useState} from \"react\";\n\n\nfunction $parcel$interopDefault(a) {\n return a && a.__esModule ? a.default : a;\n}\n\nfunction $parcel$export(e, n, v, s) {\n Object.defineProperty(e, n, {get: v, set: s, enumerable: true, configurable: true});\n}\n\n var $parcel$global = globalThis;\n \nvar $parcel$modules = {};\nvar $parcel$inits = {};\n\nvar parcelRequire = $parcel$global[\"parcelRequirea149\"];\n\nif (parcelRequire == null) {\n parcelRequire = function(id) {\n if (id in $parcel$modules) {\n return $parcel$modules[id].exports;\n }\n if (id in $parcel$inits) {\n var init = $parcel$inits[id];\n delete $parcel$inits[id];\n var module = {id: id, exports: {}};\n $parcel$modules[id] = module;\n init.call(module.exports, module, module.exports);\n return module.exports;\n }\n var err = new Error(\"Cannot find module '\" + id + \"'\");\n err.code = 'MODULE_NOT_FOUND';\n throw err;\n };\n\n parcelRequire.register = function register(id, init) {\n $parcel$inits[id] = init;\n };\n\n $parcel$global[\"parcelRequirea149\"] = parcelRequire;\n}\n\nvar parcelRegister = parcelRequire.register;\nvar $963b78d65282413b$exports = {};\n\n$parcel$export($963b78d65282413b$exports, \"DataSheetDensity\", () => $963b78d65282413b$export$b556effaa3ad7d4a);\n$parcel$export($963b78d65282413b$exports, \"DataSheet\", () => $963b78d65282413b$export$dea56b0125f0282d);\n$parcel$export($963b78d65282413b$exports, \"getRowsToDelete\", () => $963b78d65282413b$export$222fa1b971ddc36);\n$parcel$export($963b78d65282413b$exports, \"BaseCell\", () => $963b78d65282413b$export$41ad0bbfa4755cac);\n$parcel$export($963b78d65282413b$exports, \"ScrollToRowControl\", () => $963b78d65282413b$export$e7db3202e96fc463);\n$parcel$export($963b78d65282413b$exports, \"Cell\", () => $963b78d65282413b$import$5573889ca4ff9ca2$f6f0c3fe4ec306ea);\n\n\n\n\n\n\n\nvar $gZfn5 = parcelRequire(\"gZfn5\");\n\nvar $kwt8s = parcelRequire(\"kwt8s\");\n\nvar $kib2Q = parcelRequire(\"kib2Q\");\nconst $963b78d65282413b$var$h = (0, $oH60h$macrostrathyper).styled((0, (/*@__PURE__*/$parcel$interopDefault($kwt8s))));\nvar $963b78d65282413b$export$b556effaa3ad7d4a = /*#__PURE__*/ function(DataSheetDensity) {\n DataSheetDensity[\"HIGH\"] = \"high\";\n DataSheetDensity[\"MEDIUM\"] = \"medium\";\n DataSheetDensity[\"LOW\"] = \"low\";\n return DataSheetDensity;\n}({});\nfunction $963b78d65282413b$export$dea56b0125f0282d(props) {\n const { data: data, columnSpec: columnSpec, columnSpecOptions: columnSpecOptions, editable: editable = true, enableColumnReordering: enableColumnReordering = false, enableFocusedCell: enableFocusedCell = false, ...rest } = props;\n return $963b78d65282413b$var$h((0, $oH60h$HotkeysProvider), $963b78d65282413b$var$h((0, $kib2Q.DataSheetProvider), {\n data: data,\n columnSpec: columnSpec,\n columnSpecOptions: columnSpecOptions,\n enableColumnReordering: enableColumnReordering,\n editable: editable,\n ...rest\n }, $963b78d65282413b$var$h($963b78d65282413b$var$_DataSheet, {\n ...rest,\n editable: editable,\n enableColumnReordering: enableColumnReordering,\n enableFocusedCell: enableFocusedCell\n })));\n}\nfunction $963b78d65282413b$var$_DataSheet({ onVisibleCellsChange: onVisibleCellsChange, enableColumnReordering: enableColumnReordering, onSaveData: onSaveData, onUpdateData: onUpdateData, onDeleteRows: onDeleteRows, verbose: verbose = false, dataSheetActions: dataSheetActions = null, enableFocusedCell: enableFocusedCell, autoFocusEditor: autoFocusEditor = true, density: density = \"high\" }) {\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 */ // 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 selection = (0, $kib2Q.useSelector)((state)=>state.selection);\n const data = (0, $kib2Q.useSelector)((state)=>state.data);\n const editable = (0, $kib2Q.useSelector)((state)=>state.editable);\n const deletedRows = (0, $kib2Q.useSelector)((state)=>state.deletedRows);\n const focusedCell = (0, $kib2Q.useSelector)((state)=>state.focusedCell);\n const ref = (0, $kib2Q.useSelector)((state)=>state.tableRef);\n const columnSpec = (0, $kib2Q.useSelector)((state)=>state.columnSpec);\n // A sparse array to hold updates\n // TODO: create a \"changeset\" concept to facilitate undo/redo\n const updatedData = (0, $kib2Q.useSelector)((state)=>state.updatedData);\n const setUpdatedData = (0, $kib2Q.useSelector)((state)=>state.setUpdatedData);\n const onSelection = (0, $kib2Q.useSelector)((state)=>state.onSelection);\n const storeAPI = (0, $kib2Q.useStoreAPI)();\n const _onSaveData = (0, $oH60h$useMemo)(()=>{\n if (onSaveData == null) return null;\n return ()=>{\n onSaveData(updatedData, data);\n setUpdatedData([]);\n };\n }, [\n updatedData,\n data,\n onSaveData\n ]);\n const setVisibleCells = (0, $kib2Q.useSelector)((state)=>state.setVisibleCells);\n const _onVisibleCellsChange = (0, $oH60h$useCallback)((visibleCells)=>{\n setVisibleCells(visibleCells);\n onVisibleCellsChange?.(visibleCells);\n }, [\n onVisibleCellsChange,\n setVisibleCells\n ]);\n const onAddRow = (0, $oH60h$useCallback)(()=>{\n setUpdatedData((updatedData)=>{\n const ix = Math.max(updatedData.length, data.length);\n const addRowSpec = {\n [ix]: {\n $set: {}\n }\n };\n const newUpdatedData = (0, $oH60h$immutabilityhelper)(updatedData, addRowSpec);\n return newUpdatedData;\n });\n }, [\n setUpdatedData\n ]);\n const deleteSelectedRows = (0, $kib2Q.useSelector)((state)=>state.deleteSelectedRows);\n const _onDeleteRows = (0, $oH60h$useCallback)(()=>{\n deleteSelectedRows();\n onDeleteRows?.(selection);\n }, [\n onDeleteRows,\n selection,\n deleteSelectedRows\n ]);\n (0, $oH60h$useEffect)(()=>{\n if (!verbose) return;\n console.log(\"Updated data\", updatedData);\n }, [\n updatedData\n ]);\n (0, $oH60h$useEffect)(()=>{\n onUpdateData?.(updatedData, data);\n }, [\n onUpdateData,\n data,\n updatedData\n ]);\n (0, $oH60h$useEffect)(()=>{\n if (!verbose) return;\n console.log(\"Selection\", selection);\n }, [\n selection\n ]);\n if (data == null) return null;\n const nDeletionCandidates = $963b78d65282413b$export$222fa1b971ddc36(selection).length;\n const numRows = Math.max(updatedData.length, data.length);\n let className = `${density}-density`;\n let rowHeight = 20;\n let defaultColumnWidth = 150;\n let style = {\n \"--data-sheet-row-height\": \"20px\",\n \"--data-sheet-font-size\": \"12px\"\n };\n if (density === \"medium\") {\n rowHeight = 24;\n style = {\n \"--data-sheet-row-height\": \"24px\",\n \"--data-sheet-font-size\": \"14px\"\n };\n } else if (density === \"low\") {\n rowHeight = 30;\n style = {\n \"--data-sheet-row-height\": \"30px\",\n \"--data-sheet-font-size\": \"18px\"\n };\n }\n return $963b78d65282413b$var$h(\"div.data-sheet-container\", {\n className: className,\n style: style\n }, [\n $963b78d65282413b$var$h.if(editable)($963b78d65282413b$var$DataSheetEditToolbar, {\n onSaveData: _onSaveData,\n onAddRow: onAddRow,\n onDeleteRows: nDeletionCandidates > 0 ? _onDeleteRows : null\n }),\n dataSheetActions,\n $963b78d65282413b$var$h(\"div.data-sheet-holder\", {\n onKeyDown (e) {\n // General key event\n if (e.key === \"Escape\") {\n // Clear selection on Escape\n storeAPI.getState().setSelection([]);\n e.preventDefault();\n }\n // Clear selection on Backspace or Delete\n if (e.key === \"Backspace\" || e.key === \"Delete\") {\n // Clear selection on Backspace or Delete\n storeAPI.getState().clearSelection();\n e.preventDefault();\n }\n // Handle arrow keys for navigation\n if (e.key.startsWith(\"Arrow\")) {\n // Handle arrow key navigation\n const direction = e.key.replace(\"Arrow\", \"\").toLowerCase();\n const state = storeAPI.getState();\n state.moveFocusedCell(direction);\n // Prevent default scrolling behavior\n e.preventDefault();\n }\n }\n }, [\n $963b78d65282413b$var$h((0, $oH60h$Table2), {\n ref: ref,\n numRows: numRows,\n className: \"data-sheet\",\n enableFocusedCell: enableFocusedCell,\n enableColumnReordering: enableColumnReordering,\n focusedCell: //onColumnsReordered,\n focusedCell,\n selectedRegions: selection,\n defaultRowHeight: rowHeight,\n minRowHeight: rowHeight,\n columnWidths: columnSpec.map((col)=>col.width ?? defaultColumnWidth),\n onSelection: onSelection,\n // The cell renderer is memoized internally based on these data dependencies\n cellRendererDependencies: [\n data,\n selection,\n updatedData,\n focusedCell,\n deletedRows\n ],\n onVisibleCellsChange: _onVisibleCellsChange,\n rowHeaderCellRenderer: (rowIndex)=>{\n let style = null;\n let intent = undefined;\n if (deletedRows.has(rowIndex)) style = {\n opacity: 0.5,\n textDecoration: \"line-through\"\n };\n return $963b78d65282413b$var$h((0, $oH60h$RowHeaderCell), {\n index: rowIndex,\n name: `${rowIndex + 1}`,\n style: style\n });\n }\n }, columnSpec.map((col, colIndex)=>{\n return $963b78d65282413b$var$h((0, $oH60h$Column), {\n name: col.name,\n cellRenderer: (rowIndex)=>{\n const state = storeAPI.getState();\n return $963b78d65282413b$var$basicCellRenderer(rowIndex, colIndex, col, state, autoFocusEditor);\n }\n });\n }))\n ])\n ]);\n}\nfunction $963b78d65282413b$var$basicCellRenderer(rowIndex, colIndex, columnSpec, state, autoFocusEditor = true) {\n const data = state.data;\n const updatedData = state.updatedData;\n const isDeleted = state.deletedRows.has(rowIndex);\n const row = data[rowIndex] ?? updatedData[rowIndex];\n const loading = row == null;\n const col = columnSpec;\n const focusedCell = state.focusedCell;\n const _topLeftCell = state.topLeftCell;\n const onCellEdited = state.onCellEdited;\n const clearSelection = state.clearSelection;\n const value = updatedData[rowIndex]?.[col.key] ?? data[rowIndex]?.[col.key];\n const _renderedValue = col.valueRenderer?.(value) ?? value;\n let cellContents = _renderedValue;\n const editable = (col.editable ?? state.editable) && !isDeleted;\n let style = col.style ?? {};\n if (isDeleted) style = {\n ...style,\n opacity: 0.5,\n textDecoration: \"line-through\"\n };\n const focused = focusedCell?.col === colIndex && focusedCell?.row === rowIndex;\n // Top left cell of a ranged selection\n const topLeft = _topLeftCell?.col === colIndex && _topLeftCell?.row === rowIndex;\n if (!editable && state.editable) // If the cell is not editable but the sheet is editable, we want to differentiate\n // between editable and non-editable cells.\n style.color = \"var(--secondary-color)\";\n const edited = updatedData[rowIndex]?.[col.key] != null;\n let intent = edited ? \"success\" : undefined;\n if (isDeleted) intent = \"danger\";\n const _Cell = col.cellComponent ?? $963b78d65282413b$export$41ad0bbfa4755cac;\n let inlineEditor = editable ? col.inlineEditor ?? true : false;\n if (!topLeft) // This should be the case for every cell except the focused one\n return $963b78d65282413b$var$h(_Cell, {\n intent: intent,\n loading: loading,\n value: value,\n style: style,\n isDeleted: isDeleted\n }, cellContents);\n // The rest is for the top-left cell of a selection or the focused cell\n if (!editable) {\n // Most cells are not focused and don't need to be editable.\n // This will be the rendering logic for almost all cells\n if (col.dataEditor != null) cellContents = $963b78d65282413b$var$h((0, $gZfn5.EditorPopup), {\n autoFocus: autoFocusEditor,\n content: $963b78d65282413b$var$h(col.dataEditor, {\n value: value\n }),\n valueViewer: _renderedValue\n });\n return $963b78d65282413b$var$h(_Cell, {\n intent: intent,\n value: value,\n style: style\n }, [\n $963b78d65282413b$var$h.if(!focused)(\"input.hidden-input\", {\n autoFocus: true,\n onKeyDown (e) {\n if (e.key == \"Backspace\" || e.key == \"Delete\") clearSelection();\n e.preventDefault();\n }\n }),\n cellContents\n ]);\n // Could probably put the hidden input elsewhere,\n }\n /* The remaining logic covers cells that are focused and editable */ const onChange = (e)=>{\n if (!editable) return;\n if (value === e.target.value) return;\n onCellEdited(rowIndex, col.key, e.target.value);\n };\n let _inlineEditor = null;\n if (typeof inlineEditor == \"boolean\") {\n let _value = value;\n if (typeof _renderedValue === \"string\" || typeof _renderedValue === \"number\" || _renderedValue == null) _value = _renderedValue;\n _inlineEditor = $963b78d65282413b$var$h(\"input.main-editor\", {\n value: _value ?? \"\",\n autoFocus: autoFocusEditor,\n onChange: onChange,\n onKeyDown (e) {\n console.log(\"Key down in inline editor\", e.key);\n if (e.key == \"Enter\") e.target.blur();\n if (e.key == \"Escape\") {\n e.target.blur();\n e.preventDefault();\n return;\n }\n const shouldPropagate = (0, $gZfn5.handleSpecialKeys)(e, e.target);\n if (!shouldPropagate) e.stopPropagation();\n else e.target.blur();\n }\n });\n } else // If inlineEditor is a ReactNode, we use it directly\n _inlineEditor = inlineEditor;\n let className = null;\n if (col.dataEditor != null) {\n className = \"editor-cell\";\n cellContents = $963b78d65282413b$var$h([\n $963b78d65282413b$var$h((0, $gZfn5.EditorPopup), {\n autoFocus: autoFocusEditor,\n content: $963b78d65282413b$var$h(col.dataEditor, {\n value: value,\n onChange (value) {\n if (!editable) return;\n onCellEdited(rowIndex, col.key, value);\n }\n }),\n valueViewer: _renderedValue\n })\n ]);\n } else if (_inlineEditor != null) {\n cellContents = _inlineEditor;\n className = \"input-cell\";\n }\n const isSingleCellSelection = (0, $kib2Q.singleFocusedCell)(state.selection) != null;\n // Hidden html input\n return $963b78d65282413b$var$h(_Cell, {\n intent: intent,\n value: value,\n className: className,\n style: style\n }, [\n cellContents,\n $963b78d65282413b$var$h.if(editable && isSingleCellSelection)($963b78d65282413b$var$DragHandle, {\n focusedCell: focusedCell\n })\n ]);\n}\nfunction $963b78d65282413b$var$DragHandle({ focusedCell: focusedCell }) {\n // TODO: we might want to drag multiple columns in some cases\n // This should be on the last cell of a selection\n const onDragValue = (0, $kib2Q.useSelector)((state)=>state.onDragValue);\n return $963b78d65282413b$var$h(\"div.corner-drag-handle\", {\n onMouseDown (e) {\n onDragValue(focusedCell);\n e.preventDefault();\n }\n });\n}\nfunction $963b78d65282413b$var$DataSheetEditToolbar({ onSaveData: onSaveData, onDeleteRows: onDeleteRows }) {\n const selection = (0, $kib2Q.useSelector)((state)=>state.selection);\n const resetChanges = (0, $kib2Q.useSelector)((state)=>state.resetChanges);\n const hasUpdates = (0, $kib2Q.useSelector)((state)=>state.hasUpdates);\n return $963b78d65282413b$var$h(\"div.data-sheet-toolbar\", [\n $963b78d65282413b$var$h((0, $oH60h$ButtonGroup), {\n minimal: true\n }, [\n $963b78d65282413b$var$h($963b78d65282413b$var$AddRowButton),\n $963b78d65282413b$var$h((0, $oH60h$Button), {\n intent: (0, $oH60h$Intent).DANGER,\n disabled: onDeleteRows == null,\n onClick () {\n onDeleteRows?.();\n }\n }, \"Delete\")\n ]),\n $963b78d65282413b$var$h(\"div.spacer\"),\n $963b78d65282413b$var$h((0, $oH60h$ButtonGroup), [\n $963b78d65282413b$var$h((0, $oH60h$Button), {\n intent: (0, $oH60h$Intent).WARNING,\n disabled: !hasUpdates,\n onClick: resetChanges\n }, \"Reset\"),\n $963b78d65282413b$var$h.if(onSaveData != null)((0, $oH60h$Button), {\n intent: (0, $oH60h$Intent).SUCCESS,\n icon: \"floppy-disk\",\n disabled: !hasUpdates,\n onClick: onSaveData\n }, \"Save\")\n ])\n ]);\n}\nfunction $963b78d65282413b$export$e7db3202e96fc463() {\n const [value, setValue] = (0, $oH60h$useState)(\"\");\n const scrollToRow = (0, $kib2Q.useSelector)((state)=>state.scrollToRow);\n return $963b78d65282413b$var$h((0, $gZfn5.DataSheetAction), [\n $963b78d65282413b$var$h((0, $oH60h$InputGroup), {\n type: \"number\",\n placeholder: \"Row number\",\n value: value,\n onValueChange (value) {\n setValue(value);\n }\n }),\n $963b78d65282413b$var$h((0, $oH60h$Button), {\n icon: \"arrow-right\",\n onClick () {\n const row = parseInt(value);\n scrollToRow(row - 1);\n }\n }, \"Scroll to row\")\n ]);\n}\nfunction $963b78d65282413b$var$AddRowButton() {\n const addRow = (0, $kib2Q.useSelector)((state)=>state.addRow);\n return $963b78d65282413b$var$h((0, $oH60h$Button), {\n icon: \"plus\",\n onClick: addRow\n }, \"Add row\");\n}\nfunction $963b78d65282413b$export$41ad0bbfa4755cac({ children: children, value: value, ...rest }) {\n return $963b78d65282413b$var$h((0, $963b78d65282413b$import$5573889ca4ff9ca2$f6f0c3fe4ec306ea), {\n interactive: true,\n ...rest\n }, children);\n}\nfunction $963b78d65282413b$export$222fa1b971ddc36(selection) {\n let rowIndices = [];\n for (const sel of selection){\n // This isn't a full-row selection\n if (sel.cols != null) continue;\n if (sel.rows == null) continue;\n const [startIndex, endIndex] = sel.rows;\n for(let i = startIndex; i <= endIndex; i++)rowIndices.push(i);\n }\n return rowIndices;\n}\n\n\nexport {$963b78d65282413b$export$b556effaa3ad7d4a as DataSheetDensity, $963b78d65282413b$export$dea56b0125f0282d as DataSheet, $963b78d65282413b$export$222fa1b971ddc36 as getRowsToDelete, $963b78d65282413b$export$41ad0bbfa4755cac as BaseCell, $963b78d65282413b$export$e7db3202e96fc463 as ScrollToRowControl, $963b78d65282413b$import$5573889ca4ff9ca2$f6f0c3fe4ec306ea as Cell};\n//# sourceMappingURL=data-sheet.820e5bc3.js.map\n","import {\n Button,\n ButtonGroup,\n HotkeysProvider,\n InputGroup,\n Intent,\n} from \"@blueprintjs/core\";\nimport {\n Cell,\n Column,\n Region,\n RowHeaderCell,\n Table2,\n} from \"@blueprintjs/table\";\nimport \"@blueprintjs/table/lib/css/table.css\";\nimport hyper from \"@macrostrat/hyper\";\nimport update from \"immutability-helper\";\nimport { ReactNode, useCallback, useEffect, useMemo, useState } from \"react\";\nimport { EditorPopup, handleSpecialKeys, DataSheetAction } from \"./components\";\nimport styles from \"./main.module.sass\";\nimport {\n ColumnSpec,\n DataSheetProvider,\n DataSheetProviderProps,\n DataSheetStore,\n singleFocusedCell,\n useSelector,\n useStoreAPI,\n VisibleCells,\n} from \"./provider\";\n\nconst h = hyper.styled(styles);\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\nexport enum DataSheetDensity {\n HIGH = \"high\",\n MEDIUM = \"medium\",\n LOW = \"low\",\n}\n\ninterface DataSheetInternalProps<T> {\n onVisibleCellsChange?: (visibleCells: VisibleCells) => void;\n onSaveData?: (updatedData: any[], data: T[]) => void;\n onUpdateData?: (updatedData: any[], data: T[]) => void;\n onDeleteRows?: (selection: Region[]) => void;\n verbose?: boolean;\n enableColumnReordering?: boolean;\n enableFocusedCell?: boolean;\n dataSheetActions?: ReactNode | null;\n editable?: boolean;\n autoFocusEditor?: boolean;\n density?: DataSheetDensity;\n}\n\ntype DataSheetProps<T> = DataSheetProviderProps<T> & DataSheetInternalProps<T>;\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 ...rest\n } = props;\n\n return h(\n HotkeysProvider,\n h(\n DataSheetProvider<T>,\n {\n data,\n columnSpec,\n columnSpecOptions: columnSpecOptions,\n enableColumnReordering,\n editable,\n ...rest,\n },\n h(_DataSheet, {\n ...rest,\n editable,\n enableColumnReordering,\n enableFocusedCell,\n }),\n ),\n );\n}\n\nfunction _DataSheet<T>({\n onVisibleCellsChange,\n enableColumnReordering,\n onSaveData,\n onUpdateData,\n onDeleteRows,\n verbose = false,\n dataSheetActions = null,\n enableFocusedCell,\n autoFocusEditor = true,\n density = DataSheetDensity.HIGH,\n}: DataSheetInternalProps<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 // 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 selection = useSelector<T>((state) => state.selection);\n\n const data = useSelector((state) => state.data);\n const editable = useSelector((state) => state.editable);\n\n const deletedRows = useSelector((state) => state.deletedRows);\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 const setUpdatedData = useSelector((state) => state.setUpdatedData);\n\n const onSelection = useSelector((state) => state.onSelection);\n\n const storeAPI = useStoreAPI<T>();\n\n const _onSaveData = useMemo(() => {\n if (onSaveData == null) return null;\n return () => {\n onSaveData(updatedData, data);\n setUpdatedData([]);\n };\n }, [updatedData, data, onSaveData]);\n\n const setVisibleCells = useSelector((state) => state.setVisibleCells);\n\n const _onVisibleCellsChange = useCallback(\n (visibleCells: VisibleCells) => {\n setVisibleCells(visibleCells);\n onVisibleCellsChange?.(visibleCells);\n },\n [onVisibleCellsChange, setVisibleCells],\n );\n\n const onAddRow = useCallback(() => {\n setUpdatedData((updatedData: any[]): any[] => {\n const ix = Math.max(updatedData.length, data.length);\n const addRowSpec = { [ix]: { $set: {} } };\n const newUpdatedData = update(updatedData, addRowSpec);\n return newUpdatedData;\n });\n }, [setUpdatedData]);\n\n const deleteSelectedRows = useSelector((state) => state.deleteSelectedRows);\n const _onDeleteRows = useCallback(() => {\n deleteSelectedRows();\n onDeleteRows?.(selection);\n }, [onDeleteRows, selection, deleteSelectedRows]);\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(\"Selection\", selection);\n }, [selection]);\n\n if (data == null) return null;\n\n const nDeletionCandidates = getRowsToDelete(selection).length;\n\n const numRows = Math.max(updatedData.length, data.length);\n\n let className = `${density}-density`;\n\n let rowHeight = 20;\n let defaultColumnWidth = 150;\n let style = {\n \"--data-sheet-row-height\": \"20px\",\n \"--data-sheet-font-size\": \"12px\",\n };\n if (density === DataSheetDensity.MEDIUM) {\n rowHeight = 24;\n style = {\n \"--data-sheet-row-height\": \"24px\",\n \"--data-sheet-font-size\": \"14px\",\n };\n } else if (density === DataSheetDensity.LOW) {\n rowHeight = 30;\n style = {\n \"--data-sheet-row-height\": \"30px\",\n \"--data-sheet-font-size\": \"18px\",\n };\n }\n\n return h(\"div.data-sheet-container\", { className, style }, [\n h.if(editable)(DataSheetEditToolbar, {\n onSaveData: _onSaveData,\n onAddRow,\n onDeleteRows: nDeletionCandidates > 0 ? _onDeleteRows : null,\n }),\n dataSheetActions,\n h(\n \"div.data-sheet-holder\",\n {\n onKeyDown(e) {\n // General key event\n if (e.key === \"Escape\") {\n // Clear selection on Escape\n storeAPI.getState().setSelection([]);\n e.preventDefault();\n }\n // Clear selection on Backspace or Delete\n if (e.key === \"Backspace\" || e.key === \"Delete\") {\n // Clear selection on Backspace or Delete\n storeAPI.getState().clearSelection();\n e.preventDefault();\n }\n // Handle arrow keys for navigation\n if (e.key.startsWith(\"Arrow\")) {\n // Handle arrow key navigation\n const direction = e.key.replace(\"Arrow\", \"\").toLowerCase();\n const state = storeAPI.getState();\n state.moveFocusedCell(direction);\n // Prevent default scrolling behavior\n e.preventDefault();\n }\n },\n },\n [\n h(\n Table2,\n {\n ref,\n numRows,\n className: \"data-sheet\",\n enableFocusedCell,\n enableColumnReordering,\n //onColumnsReordered,\n focusedCell,\n selectedRegions: selection,\n defaultRowHeight: rowHeight,\n minRowHeight: rowHeight,\n columnWidths: columnSpec.map(\n (col) => col.width ?? defaultColumnWidth,\n ),\n onSelection,\n // The cell renderer is memoized internally based on these data dependencies\n cellRendererDependencies: [\n data,\n selection,\n updatedData,\n focusedCell,\n deletedRows,\n ],\n onVisibleCellsChange: _onVisibleCellsChange,\n rowHeaderCellRenderer: (rowIndex) => {\n let style = null;\n let intent = undefined;\n if (deletedRows.has(rowIndex)) {\n style = {\n opacity: 0.5,\n textDecoration: \"line-through\",\n };\n }\n return h(RowHeaderCell, {\n index: rowIndex,\n name: `${rowIndex + 1}`,\n style,\n });\n },\n },\n columnSpec.map((col, colIndex) => {\n return h(Column, {\n name: col.name,\n cellRenderer: (rowIndex) => {\n const state = storeAPI.getState();\n return basicCellRenderer<T>(\n rowIndex,\n colIndex,\n col,\n state,\n autoFocusEditor,\n );\n },\n });\n }),\n ),\n ],\n ),\n ]);\n}\n\nfunction basicCellRenderer<T>(\n rowIndex: number,\n colIndex: number,\n columnSpec: ColumnSpec,\n state: DataSheetStore<T>,\n autoFocusEditor = true,\n): any {\n const data = state.data;\n const updatedData = state.updatedData;\n\n const isDeleted = state.deletedRows.has(rowIndex);\n\n const row = data[rowIndex] ?? updatedData[rowIndex];\n const loading = row == null;\n const col = columnSpec;\n\n const focusedCell = state.focusedCell;\n const _topLeftCell = state.topLeftCell;\n const onCellEdited = state.onCellEdited;\n const clearSelection = state.clearSelection;\n\n const value = updatedData[rowIndex]?.[col.key] ?? data[rowIndex]?.[col.key];\n const _renderedValue = col.valueRenderer?.(value) ?? value;\n let cellContents: ReactNode = _renderedValue;\n const editable = (col.editable ?? state.editable) && !isDeleted;\n\n let style = col.style ?? {};\n if (isDeleted) {\n style = {\n ...style,\n opacity: 0.5,\n textDecoration: \"line-through\",\n };\n }\n\n const focused =\n focusedCell?.col === colIndex && focusedCell?.row === rowIndex;\n // Top left cell of a ranged selection\n const topLeft =\n _topLeftCell?.col === colIndex && _topLeftCell?.row === rowIndex;\n\n if (!editable && state.editable) {\n // If the cell is not editable but the sheet is editable, we want to differentiate\n // between editable and non-editable cells.\n style.color = \"var(--secondary-color)\";\n }\n\n const edited = updatedData[rowIndex]?.[col.key] != null;\n let intent = edited ? \"success\" : undefined;\n if (isDeleted) {\n intent = \"danger\";\n }\n\n const _Cell = col.cellComponent ?? BaseCell;\n\n let inlineEditor = editable ? (col.inlineEditor ?? true) : false;\n\n if (!topLeft) {\n // This should be the case for every cell except the focused one\n return h(\n _Cell,\n {\n intent,\n loading,\n value,\n style,\n isDeleted,\n },\n cellContents,\n );\n }\n\n // The rest is for the top-left cell of a selection or the focused cell\n\n if (!editable) {\n // Most cells are not focused and don't need to be editable.\n // This will be the rendering logic for almost all cells\n\n if (col.dataEditor != null) {\n cellContents = h(EditorPopup, {\n autoFocus: autoFocusEditor,\n content: h(col.dataEditor, {\n value,\n }),\n valueViewer: _renderedValue,\n });\n }\n\n return h(\n _Cell,\n {\n intent,\n value,\n style,\n },\n [\n h.if(!focused)(\"input.hidden-input\", {\n autoFocus: true,\n onKeyDown(e) {\n if (e.key == \"Backspace\" || e.key == \"Delete\") {\n clearSelection();\n }\n e.preventDefault();\n },\n }),\n cellContents,\n ],\n );\n // Could probably put the hidden input elsewhere,\n }\n\n /* The remaining logic covers cells that are focused and editable */\n\n const onChange = (e) => {\n if (!editable) return;\n if (value === e.target.value) return;\n onCellEdited(rowIndex, col.key, e.target.value);\n };\n\n let _inlineEditor: ReactNode = null;\n if (typeof inlineEditor == \"boolean\") {\n let _value = value;\n if (\n typeof _renderedValue === \"string\" ||\n typeof _renderedValue === \"number\" ||\n _renderedValue == null\n ) {\n _value = _renderedValue;\n }\n _inlineEditor = h(\"input.main-editor\", {\n value: _value ?? \"\",\n autoFocus: autoFocusEditor,\n onChange,\n onKeyDown(e) {\n console.log(\"Key down in inline editor\", e.key);\n if (e.key == \"Enter\") {\n e.target.blur();\n }\n\n if (e.key == \"Escape\") {\n e.target.blur();\n e.preventDefault();\n return;\n }\n\n const shouldPropagate = handleSpecialKeys(e, e.target);\n if (!shouldPropagate) {\n e.stopPropagation();\n } else {\n e.target.blur();\n //e.target.parentNode.dispatchEvent(new KeyboardEvent(\"keydown\", e));\n }\n },\n });\n } else {\n // If inlineEditor is a ReactNode, we use it directly\n _inlineEditor = inlineEditor as ReactNode;\n }\n\n let className = null;\n\n if (col.dataEditor != null) {\n className = \"editor-cell\";\n cellContents = h([\n h(EditorPopup, {\n autoFocus: autoFocusEditor,\n content: h(col.dataEditor, {\n value,\n onChange(value) {\n if (!editable) return;\n onCellEdited(rowIndex, col.key, value);\n },\n }),\n valueViewer: _renderedValue,\n }),\n ]);\n } else if (_inlineEditor != null) {\n cellContents = _inlineEditor;\n className = \"input-cell\";\n }\n\n const isSingleCellSelection = singleFocusedCell(state.selection) != null;\n\n // Hidden html input\n return h(\n _Cell,\n {\n intent,\n value,\n className,\n style,\n //truncated: false,\n },\n [\n cellContents,\n h.if(editable && isSingleCellSelection)(DragHandle, {\n focusedCell,\n }),\n ],\n );\n}\n\nfunction DragHandle({ focusedCell }) {\n // TODO: we might want to drag multiple columns in some cases\n // This should be on the last cell of a selection\n const onDragValue = useSelector((state) => state.onDragValue);\n\n return h(\"div.corner-drag-handle\", {\n onMouseDown(e) {\n onDragValue(focusedCell);\n e.preventDefault();\n },\n });\n}\n\nfunction DataSheetEditToolbar({ onSaveData, onDeleteRows }) {\n const selection = useSelector((state) => state.selection);\n const resetChanges = useSelector((state) => state.resetChanges);\n const hasUpdates = useSelector((state) => state.hasUpdates);\n\n return h(\"div.data-sheet-toolbar\", [\n h(ButtonGroup, { minimal: true }, [\n h(AddRowButton),\n h(\n Button,\n {\n intent: Intent.DANGER,\n disabled: onDeleteRows == null,\n onClick() {\n onDeleteRows?.();\n },\n },\n \"Delete\",\n ),\n ]),\n h(\"div.spacer\"),\n h(ButtonGroup, [\n h(\n Button,\n {\n intent: Intent.WARNING,\n disabled: !hasUpdates,\n onClick: resetChanges,\n },\n \"Reset\",\n ),\n h.if(onSaveData != null)(\n Button,\n {\n intent: Intent.SUCCESS,\n icon: \"floppy-disk\",\n disabled: !hasUpdates,\n onClick: onSaveData,\n },\n \"Save\",\n ),\n ]),\n ]);\n}\n\nexport function ScrollToRowControl() {\n const [value, setValue] = useState(\"\");\n const scrollToRow = useSelector((state) => state.scrollToRow);\n\n return h(DataSheetAction, [\n h(InputGroup, {\n type: \"number\",\n placeholder: \"Row number\",\n value,\n onValueChange(value) {\n setValue(value);\n },\n }),\n h(\n Button,\n {\n icon: \"arrow-right\",\n onClick() {\n const row = parseInt(value);\n scrollToRow(row - 1);\n },\n },\n \"Scroll to row\",\n ),\n ]);\n}\n\nfunction AddRowButton() {\n const addRow = useSelector((state) => state.addRow);\n return h(\n Button,\n {\n icon: \"plus\",\n onClick: addRow,\n },\n \"Add row\",\n );\n}\n\nexport function BaseCell({ children, value, ...rest }) {\n return h(\n Cell,\n {\n interactive: true,\n ...rest,\n },\n children,\n );\n}\n\nexport { Cell };\n\nexport function getRowsToDelete(selection) {\n let rowIndices: number[] = [];\n for (const sel of selection) {\n // This isn't a full-row selection\n if (sel.cols != null) continue;\n if (sel.rows == null) continue;\n const [startIndex, endIndex] = sel.rows;\n for (let i = startIndex; i <= endIndex; i++) {\n rowIndices.push(i);\n }\n }\n return rowIndices;\n}\n"],"names":["HotkeysProvider","$oH60h$HotkeysProvider","ButtonGroup","$oH60h$ButtonGroup","Button","$oH60h$Button","Intent","$oH60h$Intent","InputGroup","$oH60h$InputGroup","Table2","$oH60h$Table2","RowHeaderCell","$oH60h$RowHeaderCell","Column","$oH60h$Column","Cell","$963b78d65282413b$import$5573889ca4ff9ca2$f6f0c3fe4ec306ea","$oH60h$macrostrathyper","$oH60h$immutabilityhelper","useMemo","$oH60h$useMemo","useCallback","$oH60h$useCallback","useEffect","$oH60h$useEffect","useState","$oH60h$useState","$parcel$export","e","n","v","s","Object","defineProperty","get","set","enumerable","configurable","DataSheetDensity","$parcel$global","globalThis","$parcel$modules","$parcel$inits","parcelRequire","id","exports","init","module","call","err","Error","code","register","$963b78d65282413b$exports","$963b78d65282413b$export$b556effaa3ad7d4a","$963b78d65282413b$export$dea56b0125f0282d","$963b78d65282413b$export$222fa1b971ddc36","$963b78d65282413b$export$41ad0bbfa4755cac","$963b78d65282413b$export$e7db3202e96fc463","$gZfn5","$kwt8s","$kib2Q","$963b78d65282413b$var$h","styled","a","__esModule","default","props","data","columnSpec","columnSpecOptions","editable","enableColumnReordering","enableFocusedCell","rest","DataSheetProvider","$963b78d65282413b$var$_DataSheet","onVisibleCellsChange","onSaveData","onUpdateData","onDeleteRows","verbose","dataSheetActions","autoFocusEditor","density","selection","useSelector","state","deletedRows","focusedCell","ref","tableRef","updatedData","setUpdatedData","onSelection","storeAPI","useStoreAPI","_onSaveData","setVisibleCells","_onVisibleCellsChange","visibleCells","onAddRow","ix","Math","max","length","$set","deleteSelectedRows","_onDeleteRows","console","log","nDeletionCandidates","numRows","className","rowHeight","style","if","$963b78d65282413b$var$DataSheetEditToolbar","onKeyDown","key","getState","setSelection","preventDefault","clearSelection","startsWith","direction","replace","toLowerCase","moveFocusedCell","selectedRegions","defaultRowHeight","minRowHeight","columnWidths","map","col","width","cellRendererDependencies","rowHeaderCellRenderer","rowIndex","has","opacity","textDecoration","index","name","colIndex","cellRenderer","$963b78d65282413b$var$basicCellRenderer","isDeleted","row","_topLeftCell","topLeftCell","onCellEdited","value","_renderedValue","valueRenderer","cellContents","focused","topLeft","color","intent","edited","undefined","_Cell","cellComponent","inlineEditor","loading","dataEditor","EditorPopup","autoFocus","content","valueViewer","_inlineEditor","_value","onChange","target","blur","handleSpecialKeys","stopPropagation","isSingleCellSelection","singleFocusedCell","$963b78d65282413b$var$DragHandle","onDragValue","onMouseDown","resetChanges","hasUpdates","minimal","$963b78d65282413b$var$AddRowButton","DANGER","disabled","onClick","WARNING","SUCCESS","icon","setValue","scrollToRow","DataSheetAction","type","placeholder","onValueChange","parseInt","addRow","children","interactive","rowIndices","sel","cols","rows","startIndex","endIndex","i","push","DataSheet","getRowsToDelete","BaseCell","ScrollToRowControl"],"version":3,"file":"data-sheet.820e5bc3.js.map","sourceRoot":"../../../../"}
|
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
import{useAsyncEffect as e}from"@macrostrat/ui-components";import{debounce as t}from"underscore";import{useMemo as r,useReducer as n,useRef as o,useCallback as l}from"react";import a from"immutability-helper";import{PostgrestClient as i}from"@supabase/postgrest-js";function s(e,t){switch(console.log(t),t.type){case"start-loading":return{...e,loading:!0,initialized:!0};case"set-visible":return{...e,visibleRegion:t.region};case"update-data":return{...e,loading:!1,data:a(e.data,t.changes)};case"loaded":var r,n;let o=(r=e.data,null==(n=t.totalSize)||r.length===n?r:(r.length>n&&(r=r.slice(0,n)),[...r,...Array(n-r.length).fill(null)]));return o=[...o.slice(0,t.offset),...t.data,...o.slice(t.offset+t.data.length)],{...e,data:o,loading:!1};case"reset":return{data:[],loading:!1,error:null,visibleRegion:{rowIndexStart:0,rowIndexEnd:0},initialized:!1};case"error":return{...e,error:t.error,loading:!1};default:return e}}Object.defineProperty({},"usePostgRESTLazyLoader",{get:()=>f,set:void 0,enumerable:!0,configurable:!0});var d,u=((d=u||{})[d.up=0]="up",d[d.down=1]="down",d);let c=t(function(e,t,r,n){let o=function(e,t){for(let r=t.rowIndexStart;r<t.rowIndexEnd;r++)if(null==e[r])return r;return null}(r.data,r.visibleRegion);if((r.loading||null==o)&&r.initialized)return;let{chunkSize:l=100,...a}=t,i=t.order?.key??"id",s={...a,limit:l,offset:null},d=!r.initialized;d&&(s.count="exact"),d||(s.after=r.data[o-1]?.[i],null==s.after&&(s.offset=o)),n({type:"start-loading"}),(function(e,t){let r,{columns:n="*",count:o}=t;console.log("config",t),r=Array.isArray(n)?n.join(", "):n??"*";let l=e.select(r,{count:o});if(t.filter&&(l=t.filter(l)),console.log("query",l.url.search),null!=t.order){let{key:e,...r}=t.order;l=l.order(e,r),null!=t.after&&(l=l[r.ascending??!0?"gt":"lt"](e,t.after))}return null!=t.limit&&(null!=t.offset?(l=l.range(t.offset,t.offset+t.limit-1),console.log(`Random seek from ${t.offset}, this will be slow`)):l=l.limit(t.limit)),l})(e,s).then(e=>{let{data:t,count:r}=e;n({type:"loaded",data:t,offset:o,totalSize:r})})},100);function f(a,d,u={}){let g=r(()=>new i(a).from(d),[a,d]),[m,b]=n(s,{data:[],loading:!1,error:null,visibleRegion:{rowIndexStart:0,rowIndexEnd:0},initialized:!1}),{data:p,loading:w}=m;e(async()=>{c(g,u,m,b)},[p,m.visibleRegion.rowIndexStart,m.visibleRegion.rowIndexEnd]);let y=o(null);return{data:p,loading:w,onScroll:l(t(e=>{(e.rowIndexEnd!=y.current?.rowIndexEnd||e.rowIndexStart!=y.current?.rowIndexStart)&&(console.log("Visible cells changed",e),b({type:"set-visible",region:e}),y.current=e)},500),[b]),dispatch:b,client:g}}export{f as usePostgRESTLazyLoader};
|
|
2
|
+
//# sourceMappingURL=data-sheet.846d5f8f.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"mappings":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,EAAG,CACD,EACA,EAAM,aAAa,CAAC,aAAa,CACjC,EAAM,aAAa,CAAC,WAAW,CAChC,EAGD,IAAM,EAAM,AAAA,EAAO,MAoBnB,MAAO,CACL,KAAA,EACA,QAAA,EACA,SArBe,AAAA,EACf,AAAA,EAAS,AAAC,IAEN,CAAA,EAAa,WAAW,EAAI,EAAI,OAAO,EAAE,aACzC,EAAa,aAAa,EAAI,EAAI,OAAO,EAAE,aAAA,IAI7C,QAAQ,GAAG,CAAC,wBAAyB,GACrC,EAAS,CACP,KAAM,cACN,OAAQ,CACV,GACA,EAAI,OAAO,CAAG,EAChB,EAAG,KACH,CAAC,EAAS,EAOV,SAAA,EACA,OAAA,CACF,CACF,Q,K,sB","sources":["<anon>","packages/data-sheet/src/postgrest-table/data-loaders.ts"],"sourcesContent":["import {useAsyncEffect as $iD4eM$useAsyncEffect} from \"@macrostrat/ui-components\";\nimport {debounce as $iD4eM$debounce} from \"underscore\";\nimport {useMemo as $iD4eM$useMemo, useReducer as $iD4eM$useReducer, useRef as $iD4eM$useRef, useCallback as $iD4eM$useCallback} from \"react\";\nimport $iD4eM$immutabilityhelper from \"immutability-helper\";\nimport {PostgrestClient as $iD4eM$PostgrestClient} from \"@supabase/postgrest-js\";\n\n\nfunction $parcel$export(e, n, v, s) {\n Object.defineProperty(e, n, {get: v, set: s, enumerable: true, configurable: true});\n}\nvar $07d30ec9100abcaa$exports = {};\n\n$parcel$export($07d30ec9100abcaa$exports, \"usePostgRESTLazyLoader\", () => $07d30ec9100abcaa$export$4dffb9bb65ef8b2);\n/** Lazy loading of data from a PostgREST endpoint */ \n\n\n\n\nfunction $07d30ec9100abcaa$var$adjustArraySize(arr, newSize) {\n if (newSize == null || arr.length === newSize) return arr;\n else if (arr.length > newSize) // Trim the array\n arr = arr.slice(0, newSize);\n return [\n ...arr,\n ...Array(newSize - arr.length).fill(null)\n ];\n}\nfunction $07d30ec9100abcaa$var$lazyLoadingReducer(state, action) {\n console.log(action);\n switch(action.type){\n case \"start-loading\":\n return {\n ...state,\n loading: true,\n initialized: true\n };\n case \"set-visible\":\n return {\n ...state,\n visibleRegion: action.region\n };\n case \"update-data\":\n return {\n ...state,\n loading: false,\n data: (0, $iD4eM$immutabilityhelper)(state.data, action.changes)\n };\n case \"loaded\":\n let data = $07d30ec9100abcaa$var$adjustArraySize(state.data, action.totalSize);\n data = [\n ...data.slice(0, action.offset),\n ...action.data,\n ...data.slice(action.offset + action.data.length)\n ];\n return {\n ...state,\n data: data,\n loading: false\n };\n case \"reset\":\n return {\n data: [],\n loading: false,\n error: null,\n visibleRegion: {\n rowIndexStart: 0,\n rowIndexEnd: 0\n },\n initialized: false\n };\n case \"error\":\n return {\n ...state,\n error: action.error,\n loading: false\n };\n default:\n return state;\n }\n}\nvar $07d30ec9100abcaa$var$LoadDirection = /*#__PURE__*/ function(LoadDirection) {\n LoadDirection[LoadDirection[\"up\"] = 0] = \"up\";\n LoadDirection[LoadDirection[\"down\"] = 1] = \"down\";\n return LoadDirection;\n}($07d30ec9100abcaa$var$LoadDirection || {});\nfunction $07d30ec9100abcaa$var$overlapsNulls(data, region) {\n for(let i = region.rowIndexStart; i < region.rowIndexEnd; i++){\n if (data[i] == null) return true;\n }\n return false;\n}\nfunction $07d30ec9100abcaa$var$distanceToNextNonEmptyRow(data, start, direction, limit) {\n let i = start;\n while(i < data.length && i > 0 && limit > 0){\n if (data[i] != null) return i;\n i += direction === 1 ? 1 : -1;\n limit -= 1;\n }\n return i;\n}\nfunction $07d30ec9100abcaa$var$buildQuery(client, config) {\n const { columns: columns = \"*\", count: count } = config;\n const opts = {\n count: count\n };\n console.log(\"config\", config);\n let cols;\n if (Array.isArray(columns)) cols = columns.join(\", \");\n else cols = columns ?? \"*\";\n let query = client.select(cols, opts);\n if (config.filter) query = config.filter(query);\n console.log(\"query\", query.url.search);\n if (config.order != null) {\n const { key: orderKey, ...rest } = config.order;\n query = query.order(orderKey, rest);\n if (config.after != null) {\n const op = rest.ascending ?? true ? \"gt\" : \"lt\";\n query = query[op](orderKey, config.after);\n }\n }\n if (config.limit != null) {\n if (config.offset != null) {\n query = query.range(config.offset, config.offset + config.limit - 1);\n console.log(`Random seek from ${config.offset}, this will be slow`);\n } else query = query.limit(config.limit);\n }\n return query;\n}\nfunction $07d30ec9100abcaa$var$_loadMoreData(client, config, state, dispatch) {\n const rowIndex = $07d30ec9100abcaa$var$indexOfFirstNullInRegion(state.data, state.visibleRegion);\n if (state.loading || rowIndex == null) {\n if (state.initialized) return;\n }\n const { chunkSize: chunkSize = 100, ...rest } = config;\n const sortKey = config.order?.key ?? \"id\";\n let cfg = {\n ...rest,\n limit: chunkSize,\n offset: null\n };\n // Allows random seeking\n const isInitialQuery = !state.initialized;\n if (isInitialQuery) cfg.count = \"exact\";\n // This only works for forward queries\n if (!isInitialQuery) {\n cfg.after = state.data[rowIndex - 1]?.[sortKey];\n if (cfg.after == null) cfg.offset = rowIndex;\n }\n dispatch({\n type: \"start-loading\"\n });\n const query = $07d30ec9100abcaa$var$buildQuery(client, cfg);\n query.then((res)=>{\n const { data: data, count: count } = res;\n dispatch({\n type: \"loaded\",\n data: data,\n offset: rowIndex,\n totalSize: count\n });\n });\n}\n// Ensure only one data load is in progress at a time\nconst $07d30ec9100abcaa$var$loadMoreData = (0, $iD4eM$debounce)($07d30ec9100abcaa$var$_loadMoreData, 100);\nfunction $07d30ec9100abcaa$export$4dffb9bb65ef8b2(endpoint, table, config = {}) {\n const initialState = {\n data: [],\n loading: false,\n error: null,\n visibleRegion: {\n rowIndexStart: 0,\n rowIndexEnd: 0\n },\n initialized: false\n };\n const client = (0, $iD4eM$useMemo)(()=>{\n return new (0, $iD4eM$PostgrestClient)(endpoint).from(table);\n }, [\n endpoint,\n table\n ]);\n const [state, dispatch] = (0, $iD4eM$useReducer)($07d30ec9100abcaa$var$lazyLoadingReducer, initialState);\n const { data: data, loading: loading } = state;\n (0, $iD4eM$useAsyncEffect)(async ()=>{\n $07d30ec9100abcaa$var$loadMoreData(client, config, state, dispatch);\n }, [\n data,\n state.visibleRegion.rowIndexStart,\n state.visibleRegion.rowIndexEnd\n ]);\n // Reference to hold onto the scroll position\n const ref = (0, $iD4eM$useRef)(null);\n const onScroll = (0, $iD4eM$useCallback)((0, $iD4eM$debounce)((visibleCells)=>{\n if (visibleCells.rowIndexEnd == ref.current?.rowIndexEnd && visibleCells.rowIndexStart == ref.current?.rowIndexStart) return;\n console.log(\"Visible cells changed\", visibleCells);\n dispatch({\n type: \"set-visible\",\n region: visibleCells\n });\n ref.current = visibleCells;\n }, 500), [\n dispatch\n ]);\n return {\n data: data,\n loading: loading,\n onScroll: onScroll,\n dispatch: dispatch,\n client: client\n };\n}\nfunction $07d30ec9100abcaa$var$getRowIndexToLoadFrom(data, visibleRegion, chunkSize) {\n return $07d30ec9100abcaa$var$indexOfFirstNullInRegion(data, visibleRegion);\n}\nfunction $07d30ec9100abcaa$var$indexOfFirstNullInRegion(data, region) {\n for(let i = region.rowIndexStart; i < region.rowIndexEnd; i++){\n if (data[i] == null) return i;\n }\n return null;\n}\n\n\nexport {$07d30ec9100abcaa$export$4dffb9bb65ef8b2 as usePostgRESTLazyLoader};\n//# sourceMappingURL=data-sheet.846d5f8f.js.map\n","/** Lazy loading of data from a PostgREST endpoint */\n\nimport { useAsyncEffect } from \"@macrostrat/ui-components\";\nimport { debounce } from \"underscore\";\nimport { useCallback, useMemo, useReducer, useRef, useEffect } from \"react\";\nimport update, { Spec } from \"immutability-helper\";\n\ninterface ChunkIndex {\n startRow: number;\n endRow: number;\n lastValue: any;\n}\n\nimport {\n PostgrestClient,\n PostgrestQueryBuilder,\n PostgrestFilterBuilder,\n} from \"@supabase/postgrest-js\";\n\ninterface LazyLoaderState<T> {\n data: (T | null)[];\n loading: boolean;\n error: Error | null;\n visibleRegion: RowRegion;\n initialized: boolean;\n}\n\nexport interface PostgrestOrder<T> {\n key: string;\n ascending?: boolean;\n nullsFirst?: boolean;\n}\n\ntype LazyLoaderAction<T> =\n | { type: \"start-loading\" }\n | { type: \"loaded\"; data: T[]; offset: number; totalSize: number }\n | { type: \"error\"; error: Error }\n | { type: \"set-visible\"; region: RowRegion }\n | { type: \"update-data\"; changes: Spec<T[]> }\n | { type: \"reset\" };\n\nfunction adjustArraySize<T>(arr: T[], newSize: number) {\n if (newSize == null || arr.length === newSize) {\n return arr;\n } else if (arr.length > newSize) {\n // Trim the array\n arr = arr.slice(0, newSize);\n }\n return [...arr, ...Array(newSize - arr.length).fill(null)];\n}\n\nfunction lazyLoadingReducer<T>(\n state: LazyLoaderState<T>,\n action: LazyLoaderAction<T>,\n): LazyLoaderState<T> {\n console.log(action);\n switch (action.type) {\n case \"start-loading\":\n return {\n ...state,\n loading: true,\n initialized: true,\n };\n case \"set-visible\":\n return {\n ...state,\n visibleRegion: action.region,\n };\n case \"update-data\":\n return {\n ...state,\n loading: false,\n data: update(state.data, action.changes),\n };\n case \"loaded\":\n let data = adjustArraySize(state.data, action.totalSize);\n data = [\n ...data.slice(0, action.offset),\n ...action.data,\n ...data.slice(action.offset + action.data.length),\n ];\n\n return {\n ...state,\n data,\n loading: false,\n };\n\n case \"reset\":\n return {\n data: [],\n loading: false,\n error: null,\n visibleRegion: { rowIndexStart: 0, rowIndexEnd: 0 },\n initialized: false,\n };\n case \"error\":\n return {\n ...state,\n error: action.error,\n loading: false,\n };\n default:\n return state;\n }\n}\n\ninterface RowRegion {\n rowIndexStart: number;\n rowIndexEnd: number;\n}\n\nenum LoadDirection {\n \"up\",\n \"down\",\n}\n\nfunction overlapsNulls(data: any[], region: RowRegion) {\n for (let i = region.rowIndexStart; i < region.rowIndexEnd; i++) {\n if (data[i] == null) {\n return true;\n }\n }\n return false;\n}\n\nfunction distanceToNextNonEmptyRow(\n data: any[],\n start: number,\n direction: LoadDirection,\n limit: number,\n): number {\n let i = start;\n while (i < data.length && i > 0 && limit > 0) {\n if (data[i] != null) {\n return i;\n }\n i += direction === LoadDirection.down ? 1 : -1;\n limit -= 1;\n }\n return i;\n}\n\ninterface QueryConfig {\n columns?: string | string[];\n count?: \"exact\" | \"estimated\";\n limit?: number;\n offset?: number;\n order?: PostgrestOrder<any>;\n after?: any;\n fullTextSearch?: string;\n filter?: (\n query: PostgrestFilterBuilder<any, any, any>,\n ) => PostgrestFilterBuilder<any, any, any>;\n}\n\nfunction buildQuery<T>(\n client: PostgrestQueryBuilder<T, any>,\n config: QueryConfig,\n) {\n const { columns = \"*\", count } = config;\n const opts = { count };\n\n console.log(\"config\", config);\n\n let cols: string;\n if (Array.isArray(columns)) {\n cols = columns.join(\", \");\n } else {\n cols = columns ?? \"*\";\n }\n\n let query = client.select(cols, opts);\n\n if (config.filter) {\n query = config.filter(query);\n }\n console.log(\"query\", query.url.search);\n\n if (config.order != null) {\n const { key: orderKey, ...rest } = config.order;\n query = query.order(orderKey, rest);\n if (config.after != null) {\n const op = (rest.ascending ?? true) ? \"gt\" : \"lt\";\n query = query[op](orderKey, config.after);\n }\n }\n if (config.limit != null) {\n if (config.offset != null) {\n query = query.range(config.offset, config.offset + config.limit - 1);\n console.log(`Random seek from ${config.offset}, this will be slow`);\n } else {\n query = query.limit(config.limit);\n }\n }\n return query;\n}\n\nfunction _loadMoreData<T>(\n client: PostgrestQueryBuilder<T, any>,\n config: QueryConfig & { chunkSize: number },\n state: LazyLoaderState<T>,\n dispatch: any,\n) {\n const rowIndex = indexOfFirstNullInRegion(state.data, state.visibleRegion);\n if (state.loading || rowIndex == null) {\n if (state.initialized) {\n return;\n }\n }\n\n const { chunkSize = 100, ...rest } = config;\n\n const sortKey = config.order?.key ?? \"id\";\n\n let cfg: QueryConfig = {\n ...rest,\n limit: chunkSize,\n offset: null,\n };\n\n // Allows random seeking\n const isInitialQuery = !state.initialized;\n if (isInitialQuery) {\n cfg.count = \"exact\";\n }\n\n // This only works for forward queries\n if (!isInitialQuery) {\n cfg.after = state.data[rowIndex - 1]?.[sortKey];\n if (cfg.after == null) {\n cfg.offset = rowIndex;\n }\n }\n\n dispatch({ type: \"start-loading\" });\n\n const query = buildQuery(client, cfg);\n\n query.then((res) => {\n const { data, count } = res;\n dispatch({\n type: \"loaded\",\n data,\n offset: rowIndex,\n totalSize: count,\n });\n });\n}\n\n// Ensure only one data load is in progress at a time\nconst loadMoreData = debounce(_loadMoreData, 100);\n\ntype LazyLoaderOptions = Omit<QueryConfig, \"count\" | \"offset\" | \"limit\"> & {\n chunkSize?: number;\n sortKey?: string;\n filter?: (\n query: PostgrestFilterBuilder<any, any, any>,\n ) => PostgrestFilterBuilder<any, any, any>;\n};\n\nexport function usePostgRESTLazyLoader(\n endpoint: string,\n table: string,\n config: LazyLoaderOptions = {},\n) {\n const initialState: LazyLoaderState<any> = {\n data: [],\n loading: false,\n error: null,\n visibleRegion: { rowIndexStart: 0, rowIndexEnd: 0 },\n initialized: false,\n };\n\n const client = useMemo(() => {\n return new PostgrestClient(endpoint).from(table);\n }, [endpoint, table]);\n\n const [state, dispatch] = useReducer(lazyLoadingReducer, initialState);\n const { data, loading } = state;\n\n useAsyncEffect(async () => {\n loadMoreData(client, config, state, dispatch);\n }, [\n data,\n state.visibleRegion.rowIndexStart,\n state.visibleRegion.rowIndexEnd,\n ]);\n\n // Reference to hold onto the scroll position\n const ref = useRef(null);\n\n const onScroll = useCallback(\n debounce((visibleCells: RowRegion) => {\n if (\n visibleCells.rowIndexEnd == ref.current?.rowIndexEnd &&\n visibleCells.rowIndexStart == ref.current?.rowIndexStart\n ) {\n return;\n }\n console.log(\"Visible cells changed\", visibleCells);\n dispatch({\n type: \"set-visible\",\n region: visibleCells,\n });\n ref.current = visibleCells;\n }, 500),\n [dispatch],\n );\n\n return {\n data,\n loading,\n onScroll,\n dispatch,\n client,\n };\n}\n\nfunction getRowIndexToLoadFrom<T>(\n data: (T | null)[],\n visibleRegion: RowRegion,\n chunkSize: number,\n) {\n return indexOfFirstNullInRegion(data, visibleRegion);\n}\n\nfunction indexOfFirstNullInRegion(\n data: any[],\n region: RowRegion,\n): number | null {\n for (let i = region.rowIndexStart; i < region.rowIndexEnd; i++) {\n if (data[i] == null) {\n return i;\n }\n }\n return null;\n}\n"],"names":["useAsyncEffect","$iD4eM$useAsyncEffect","debounce","$iD4eM$debounce","useMemo","$iD4eM$useMemo","useReducer","$iD4eM$useReducer","useRef","$iD4eM$useRef","useCallback","$iD4eM$useCallback","$iD4eM$immutabilityhelper","PostgrestClient","$iD4eM$PostgrestClient","$07d30ec9100abcaa$var$lazyLoadingReducer","state","action","console","log","type","loading","initialized","visibleRegion","region","data","changes","arr","newSize","totalSize","length","slice","Array","fill","offset","error","rowIndexStart","rowIndexEnd","Object","defineProperty","get","$07d30ec9100abcaa$export$4dffb9bb65ef8b2","set","s","enumerable","configurable","LoadDirection","$07d30ec9100abcaa$var$LoadDirection","$07d30ec9100abcaa$var$loadMoreData","client","config","dispatch","rowIndex","$07d30ec9100abcaa$var$indexOfFirstNullInRegion","i","chunkSize","rest","sortKey","order","key","cfg","limit","isInitialQuery","count","after","query","$07d30ec9100abcaa$var$buildQuery","cols","columns","isArray","join","select","filter","url","search","orderKey","ascending","range","then","res","endpoint","table","from","ref","onScroll","visibleCells","current","usePostgRESTLazyLoader"],"version":3,"file":"data-sheet.846d5f8f.js.map","sourceRoot":"../../../../"}
|
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
import"./data-sheet.1a487c3c.js";import"./data-sheet.171105c1.js";import"./data-sheet.a65463ef.js";import"./data-sheet.cbbc8d31.js";function e(e,a){return Object.keys(a).forEach(function(t){"default"===t||"__esModule"===t||Object.prototype.hasOwnProperty.call(e,t)||Object.defineProperty(e,t,{enumerable:!0,get:function(){return a[t]}})}),e}var a=globalThis,t={},r={},o=a.parcelRequirea149;null==o&&((o=function(e){if(e in t)return t[e].exports;if(e in r){var a=r[e];delete r[e];var o={id:e,exports:{}};return t[e]=o,a.call(o.exports,o,o.exports),o.exports}var c=Error("Cannot find module '"+e+"'");throw c.code="MODULE_NOT_FOUND",c}).register=function(e,a){r[e]=a},a.parcelRequirea149=o),o.register;var c={},b=o("iAm7N"),d=o("lxTDx"),i=o("6A7pE"),s=o("gweiS");e(c,b),e(c,d),e(c,i),e(c,s);export{$36eead336b938625$export$2a7e60c8443c1751 as EditorPopup,$827916362b958415$export$24aecfe8a925020d as ColorCell,$827916362b958415$export$e5f546a5ba915f1c as colorSwatchRenderer,$827916362b958415$export$9feb1bc2e5f1ccb3 as ColorPicker,$1b3be825da79eb57$export$b8e68c321a6269f1 as EditableTextArea,$1b3be825da79eb57$export$52c8c5a1aad17e2a as handleSpecialKeys,$bec5b73cd6722b6b$export$b215fe4466d8f847 as DataSheetActionsRow,$bec5b73cd6722b6b$export$c2c7070a9fc246e1 as DataSheetAction};
|
|
2
|
+
//# sourceMappingURL=data-sheet.86550c41.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"mappings":"A,M,2C,A,O,2C,A,O,2C,A,O,2C,C,S,E,C,C,C,E,O,O,I,C,G,O,C,S,C,E,Y,G,A,e,G,O,S,C,c,C,I,C,E,I,O,c,C,E,E,C,W,C,E,I,W,O,C,C,E,A,C,E,G,C,C,I,E,W,E,C,E,E,C,E,E,E,iB,A,O,I,A,C,E,S,C,E,G,K,E,O,C,C,E,C,O,C,G,K,E,C,I,E,C,C,E,A,Q,C,C,E,C,I,E,C,G,E,Q,C,C,E,O,C,C,E,C,E,E,I,C,E,O,C,E,E,O,E,E,O,A,C,I,E,A,M,uB,E,I,O,E,I,C,mB,C,C,E,Q,C,S,C,C,C,E,C,C,E,C,C,E,E,iB,C,G,E,Q,C,I,E,C,E,E,E,S,E,E,S,E,E,S,E,E,S,E,E,G,E,E,G,E,E,G,E,E,U,6C,W,C,6C,S,C,6C,mB,C,6C,W,C,6C,gB,C,6C,iB,C,6C,mB,C,6C,e","sources":["<anon>","packages/data-sheet/src/components/index.ts"],"sourcesContent":["import \"./data-sheet.1a487c3c.js\";\nimport \"./data-sheet.171105c1.js\";\nimport \"./data-sheet.a65463ef.js\";\nimport \"./data-sheet.cbbc8d31.js\";\n\n\nfunction $parcel$exportWildcard(dest, source) {\n Object.keys(source).forEach(function(key) {\n if (key === 'default' || key === '__esModule' || Object.prototype.hasOwnProperty.call(dest, key)) {\n return;\n }\n\n Object.defineProperty(dest, key, {\n enumerable: true,\n get: function get() {\n return source[key];\n }\n });\n });\n\n return dest;\n}\n\n var $parcel$global = globalThis;\n \nvar $parcel$modules = {};\nvar $parcel$inits = {};\n\nvar parcelRequire = $parcel$global[\"parcelRequirea149\"];\n\nif (parcelRequire == null) {\n parcelRequire = function(id) {\n if (id in $parcel$modules) {\n return $parcel$modules[id].exports;\n }\n if (id in $parcel$inits) {\n var init = $parcel$inits[id];\n delete $parcel$inits[id];\n var module = {id: id, exports: {}};\n $parcel$modules[id] = module;\n init.call(module.exports, module, module.exports);\n return module.exports;\n }\n var err = new Error(\"Cannot find module '\" + id + \"'\");\n err.code = 'MODULE_NOT_FOUND';\n throw err;\n };\n\n parcelRequire.register = function register(id, init) {\n $parcel$inits[id] = init;\n };\n\n $parcel$global[\"parcelRequirea149\"] = parcelRequire;\n}\n\nvar parcelRegister = parcelRequire.register;\nvar $da5924ac21f1a7d5$exports = {};\n\nvar $iAm7N = parcelRequire(\"iAm7N\");\n\nvar $lxTDx = parcelRequire(\"lxTDx\");\n\nvar $6A7pE = parcelRequire(\"6A7pE\");\n\nvar $gweiS = parcelRequire(\"gweiS\");\n$parcel$exportWildcard($da5924ac21f1a7d5$exports, $iAm7N);\n$parcel$exportWildcard($da5924ac21f1a7d5$exports, $lxTDx);\n$parcel$exportWildcard($da5924ac21f1a7d5$exports, $6A7pE);\n$parcel$exportWildcard($da5924ac21f1a7d5$exports, $gweiS);\n\n\nexport {$36eead336b938625$export$2a7e60c8443c1751 as EditorPopup, $827916362b958415$export$24aecfe8a925020d as ColorCell, $827916362b958415$export$e5f546a5ba915f1c as colorSwatchRenderer, $827916362b958415$export$9feb1bc2e5f1ccb3 as ColorPicker, $1b3be825da79eb57$export$b8e68c321a6269f1 as EditableTextArea, $1b3be825da79eb57$export$52c8c5a1aad17e2a as handleSpecialKeys, $bec5b73cd6722b6b$export$b215fe4466d8f847 as DataSheetActionsRow, $bec5b73cd6722b6b$export$c2c7070a9fc246e1 as DataSheetAction};\n//# sourceMappingURL=data-sheet.86550c41.js.map\n","export * from \"./editor-popup\";\nexport * from \"./colors\";\nexport * from \"./text-areas\";\nexport * from \"./actions\";\n"],"names":["$parcel$exportWildcard","dest","source","Object","keys","forEach","key","prototype","hasOwnProperty","call","defineProperty","enumerable","get","$parcel$global","globalThis","$parcel$modules","$parcel$inits","parcelRequire","id","exports","init","module","err","Error","code","register","$da5924ac21f1a7d5$exports","$iAm7N","$lxTDx","$6A7pE","$gweiS","$36eead336b938625$export$2a7e60c8443c1751","EditorPopup","$827916362b958415$export$24aecfe8a925020d","ColorCell","$827916362b958415$export$e5f546a5ba915f1c","colorSwatchRenderer","$827916362b958415$export$9feb1bc2e5f1ccb3","ColorPicker","$1b3be825da79eb57$export$b8e68c321a6269f1","EditableTextArea","$1b3be825da79eb57$export$52c8c5a1aad17e2a","handleSpecialKeys","$bec5b73cd6722b6b$export$b215fe4466d8f847","DataSheetActionsRow","$bec5b73cd6722b6b$export$c2c7070a9fc246e1","DataSheetAction"],"version":3,"file":"data-sheet.86550c41.js.map","sourceRoot":"../../../../"}
|
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
import"./data-sheet.2cac1a8c.js";import e from"@macrostrat/hyper";function t(e,t,r,a){Object.defineProperty(e,t,{get:r,set:a,enumerable:!0,configurable:!0})}var r=globalThis,a={},o={},n=r.parcelRequirea149;null==n&&((n=function(e){if(e in a)return a[e].exports;if(e in o){var t=o[e];delete o[e];var r={id:e,exports:{}};return a[e]=r,t.call(r.exports,r,r.exports),r.exports}var n=Error("Cannot find module '"+e+"'");throw n.code="MODULE_NOT_FOUND",n}).register=function(e,t){o[e]=t},r.parcelRequirea149=n),n.register;var i={};t(i,"DataSheetActionsRow",()=>s),t(i,"DataSheetAction",()=>b);var c=n("kjz8q");let l=e.styled(c&&c.__esModule?c.default:c);function s(e){return l("div.table-actions",e.children)}function b(e){return l("div.table-action",e.children)}export{s as DataSheetActionsRow,b as DataSheetAction};
|
|
2
|
+
//# sourceMappingURL=data-sheet.cbbc8d31.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"mappings":"A,M,2C,A,Q,M,mB,C,S,E,C,C,C,C,C,C,C,E,O,c,C,E,E,C,I,E,I,E,W,C,E,a,C,C,E,C,I,E,W,E,C,E,E,C,E,E,E,iB,A,O,I,A,C,E,S,C,E,G,K,E,O,C,C,E,C,O,C,G,K,E,C,I,E,C,C,E,A,Q,C,C,E,C,I,E,C,G,E,Q,C,C,E,O,C,C,E,C,E,E,I,C,E,O,C,E,E,O,E,E,O,A,C,I,E,A,M,uB,E,I,O,E,I,C,mB,C,C,E,Q,C,S,C,C,C,E,C,C,E,C,C,E,E,iB,C,G,E,Q,C,I,E,C,E,E,E,sB,I,G,E,E,kB,I,G,I,E,E,SCEA,IAAM,EAAI,AAAA,EAAM,MAAM,C,AAAC,G,AAAA,E,U,C,AAAA,E,O,CAAA,GAEhB,SAAS,EAAoB,CAAK,EACvC,OAAO,EAAE,oBAAqB,EAAM,QAAQ,CAC9C,CAEO,SAAS,EAAgB,CAAK,EACnC,OAAO,EAAE,mBAAoB,EAAM,QAAQ,CAC7C,Q,K,mB,C,K,e","sources":["<anon>","packages/data-sheet/src/components/actions.ts"],"sourcesContent":["import \"./data-sheet.2cac1a8c.js\";\nimport $bfhB5$macrostrathyper from \"@macrostrat/hyper\";\n\n\nfunction $parcel$interopDefault(a) {\n return a && a.__esModule ? a.default : a;\n}\n\nfunction $parcel$export(e, n, v, s) {\n Object.defineProperty(e, n, {get: v, set: s, enumerable: true, configurable: true});\n}\n\n var $parcel$global = globalThis;\n \nvar $parcel$modules = {};\nvar $parcel$inits = {};\n\nvar parcelRequire = $parcel$global[\"parcelRequirea149\"];\n\nif (parcelRequire == null) {\n parcelRequire = function(id) {\n if (id in $parcel$modules) {\n return $parcel$modules[id].exports;\n }\n if (id in $parcel$inits) {\n var init = $parcel$inits[id];\n delete $parcel$inits[id];\n var module = {id: id, exports: {}};\n $parcel$modules[id] = module;\n init.call(module.exports, module, module.exports);\n return module.exports;\n }\n var err = new Error(\"Cannot find module '\" + id + \"'\");\n err.code = 'MODULE_NOT_FOUND';\n throw err;\n };\n\n parcelRequire.register = function register(id, init) {\n $parcel$inits[id] = init;\n };\n\n $parcel$global[\"parcelRequirea149\"] = parcelRequire;\n}\n\nvar parcelRegister = parcelRequire.register;\nvar $bec5b73cd6722b6b$exports = {};\n\n$parcel$export($bec5b73cd6722b6b$exports, \"DataSheetActionsRow\", () => $bec5b73cd6722b6b$export$b215fe4466d8f847);\n$parcel$export($bec5b73cd6722b6b$exports, \"DataSheetAction\", () => $bec5b73cd6722b6b$export$c2c7070a9fc246e1);\n\n\nvar $kjz8q = parcelRequire(\"kjz8q\");\nconst $bec5b73cd6722b6b$var$h = (0, $bfhB5$macrostrathyper).styled((0, (/*@__PURE__*/$parcel$interopDefault($kjz8q))));\nfunction $bec5b73cd6722b6b$export$b215fe4466d8f847(props) {\n return $bec5b73cd6722b6b$var$h(\"div.table-actions\", props.children);\n}\nfunction $bec5b73cd6722b6b$export$c2c7070a9fc246e1(props) {\n return $bec5b73cd6722b6b$var$h(\"div.table-action\", props.children);\n}\n\n\nexport {$bec5b73cd6722b6b$export$b215fe4466d8f847 as DataSheetActionsRow, $bec5b73cd6722b6b$export$c2c7070a9fc246e1 as DataSheetAction};\n//# sourceMappingURL=data-sheet.cbbc8d31.js.map\n","import hyper from \"@macrostrat/hyper\";\nimport style from \"./actions.module.sass\";\nconst h = hyper.styled(style);\n\nexport function DataSheetActionsRow(props) {\n return h(\"div.table-actions\", props.children);\n}\n\nexport function DataSheetAction(props) {\n return h(\"div.table-action\", props.children);\n}\n"],"names":["$bfhB5$macrostrathyper","$parcel$export","e","n","v","s","Object","defineProperty","get","set","enumerable","configurable","$parcel$global","globalThis","$parcel$modules","$parcel$inits","parcelRequire","id","exports","init","module","call","err","Error","code","register","$bec5b73cd6722b6b$exports","$bec5b73cd6722b6b$export$b215fe4466d8f847","$bec5b73cd6722b6b$export$c2c7070a9fc246e1","$kjz8q","$bec5b73cd6722b6b$var$h","styled","a","__esModule","default","props","children","DataSheetActionsRow","DataSheetAction"],"version":3,"file":"data-sheet.cbbc8d31.js.map","sourceRoot":"../../../../"}
|
package/dist/node/index.js
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import"./data-sheet.
|
|
1
|
+
import"./data-sheet.820e5bc3.js";import"./data-sheet.22cde343.js";import"./data-sheet.86550c41.js";import"./data-sheet.52753d1d.js";function e(e,a){return Object.keys(a).forEach(function(t){"default"===t||"__esModule"===t||Object.prototype.hasOwnProperty.call(e,t)||Object.defineProperty(e,t,{enumerable:!0,get:function(){return a[t]}})}),e}var a=globalThis,t={},r={},o=a.parcelRequirea149;null==o&&((o=function(e){if(e in t)return t[e].exports;if(e in r){var a=r[e];delete r[e];var o={id:e,exports:{}};return t[e]=o,a.call(o.exports,o,o.exports),o.exports}var $=Error("Cannot find module '"+e+"'");throw $.code="MODULE_NOT_FOUND",$}).register=function(e,a){r[e]=a},a.parcelRequirea149=o),o.register;var $={},d=o("1ehpN"),b=o("gxLKL"),c=o("gZfn5"),f=o("kib2Q");e($,d),e($,b),e($,c),e($,f);export{$963b78d65282413b$export$b556effaa3ad7d4a as DataSheetDensity,$963b78d65282413b$export$dea56b0125f0282d as DataSheet,$963b78d65282413b$export$222fa1b971ddc36 as getRowsToDelete,$963b78d65282413b$export$41ad0bbfa4755cac as BaseCell,$963b78d65282413b$export$e7db3202e96fc463 as ScrollToRowControl,$963b78d65282413b$import$5573889ca4ff9ca2$f6f0c3fe4ec306ea as Cell,$4d256d31a726a84a$export$34ce2a614f5dd320 as PostgRESTTableView,$4d256d31a726a84a$export$2022c252b5885348 as wrapWithErrorHandling,$4d256d31a726a84a$export$a346ab8a0cc01d91 as SearchAction,$4d256d31a726a84a$export$48a1a02e95eff0a2 as notifyOnError,$4d256d31a726a84a$export$85a23c82145eafdb as LongTextViewer,$4d256d31a726a84a$export$8d4d3113a9b124d2 as IntervalCell,$4d256d31a726a84a$export$2ad73a796d2d3eb as lithologyRenderer,$4d256d31a726a84a$export$5da000845ac52c4f as ExpandedLithologies,$07d30ec9100abcaa$export$4dffb9bb65ef8b2 as usePostgRESTLazyLoader,$36eead336b938625$export$2a7e60c8443c1751 as EditorPopup,$827916362b958415$export$24aecfe8a925020d as ColorCell,$827916362b958415$export$e5f546a5ba915f1c as colorSwatchRenderer,$827916362b958415$export$9feb1bc2e5f1ccb3 as ColorPicker,$1b3be825da79eb57$export$b8e68c321a6269f1 as EditableTextArea,$1b3be825da79eb57$export$52c8c5a1aad17e2a as handleSpecialKeys,$bec5b73cd6722b6b$export$b215fe4466d8f847 as DataSheetActionsRow,$bec5b73cd6722b6b$export$c2c7070a9fc246e1 as DataSheetAction,$7e5384423bc0f425$export$135c527978291360 as DataSheetProvider,$7e5384423bc0f425$export$de0bb697976d7dcb as singleFocusedCell,$7e5384423bc0f425$export$54fc6f5c8f914926 as useStoreAPI,$7e5384423bc0f425$export$2105062e25df4afe as useSelector,$7e5384423bc0f425$export$88b0ba8661dc41b4 as topLeftCell};
|
|
2
2
|
//# sourceMappingURL=index.js.map
|
package/dist/node/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"mappings":"A,M,2C,A,O,2C,C,S,E,C,C,C,E,O,O,I,C,G,O,C,S,C,E,Y,G,A,e,G,O,S,C,c,C,I,C,E,I,O,c,C,E,E,C,W,C,E,I,W,O,C,C,E,A,C,E,G,C,C,I,E,W,E,C,E,E,C,E,E,E,iB,A,O,I,A,C,E,S,C,E,G,K,E,O,C,C,E,C,O,C,G,K,E,C,I,E,C,C,E,A,Q,C,C,E,C,I,E,C,G,E,Q,C,C,E,O,C,C,E,C,E,E,I,C,E,O,C,E,E,O,E,E,O,A,C,I,E,A,M,uB,E,I,O,E,I,C,mB,C,C,E,Q,C,S,C,C,C,E,C,C,E,C,C,E,E,iB,C,G,E,Q,C,I,E,C,E,E,E,S,E,E,S,E,E,G,E,E,U,6C,gB,C,6C,S,C,4C,e,C,6C,Q,C,6C,kB,C,8D,I,C,6C,
|
|
1
|
+
{"mappings":"A,M,2C,A,O,2C,A,O,2C,A,O,2C,C,S,E,C,C,C,E,O,O,I,C,G,O,C,S,C,E,Y,G,A,e,G,O,S,C,c,C,I,C,E,I,O,c,C,E,E,C,W,C,E,I,W,O,C,C,E,A,C,E,G,C,C,I,E,W,E,C,E,E,C,E,E,E,iB,A,O,I,A,C,E,S,C,E,G,K,E,O,C,C,E,C,O,C,G,K,E,C,I,E,C,C,E,A,Q,C,C,E,C,I,E,C,G,E,Q,C,C,E,O,C,C,E,C,E,E,I,C,E,O,C,E,E,O,E,E,O,A,C,I,E,A,M,uB,E,I,O,E,I,C,mB,C,C,E,Q,C,S,C,C,C,E,C,C,E,C,C,E,E,iB,C,G,E,Q,C,I,E,C,E,E,E,S,E,E,S,E,E,S,E,E,S,E,E,G,E,E,G,E,E,G,E,E,U,6C,gB,C,6C,S,C,4C,e,C,6C,Q,C,6C,kB,C,8D,I,C,6C,kB,C,6C,qB,C,6C,Y,C,6C,a,C,6C,c,C,6C,Y,C,4C,iB,C,6C,mB,C,4C,sB,C,6C,W,C,6C,S,C,6C,mB,C,6C,W,C,6C,gB,C,6C,iB,C,6C,mB,C,6C,e,C,6C,iB,C,6C,iB,C,6C,W,C,6C,W,C,6C,W","sources":["<anon>","packages/data-sheet/src/index.ts"],"sourcesContent":["import \"./data-sheet.820e5bc3.js\";\nimport \"./data-sheet.22cde343.js\";\nimport \"./data-sheet.86550c41.js\";\nimport \"./data-sheet.52753d1d.js\";\n\n\nfunction $parcel$exportWildcard(dest, source) {\n Object.keys(source).forEach(function(key) {\n if (key === 'default' || key === '__esModule' || Object.prototype.hasOwnProperty.call(dest, key)) {\n return;\n }\n\n Object.defineProperty(dest, key, {\n enumerable: true,\n get: function get() {\n return source[key];\n }\n });\n });\n\n return dest;\n}\n\n var $parcel$global = globalThis;\n \nvar $parcel$modules = {};\nvar $parcel$inits = {};\n\nvar parcelRequire = $parcel$global[\"parcelRequirea149\"];\n\nif (parcelRequire == null) {\n parcelRequire = function(id) {\n if (id in $parcel$modules) {\n return $parcel$modules[id].exports;\n }\n if (id in $parcel$inits) {\n var init = $parcel$inits[id];\n delete $parcel$inits[id];\n var module = {id: id, exports: {}};\n $parcel$modules[id] = module;\n init.call(module.exports, module, module.exports);\n return module.exports;\n }\n var err = new Error(\"Cannot find module '\" + id + \"'\");\n err.code = 'MODULE_NOT_FOUND';\n throw err;\n };\n\n parcelRequire.register = function register(id, init) {\n $parcel$inits[id] = init;\n };\n\n $parcel$global[\"parcelRequirea149\"] = parcelRequire;\n}\n\nvar parcelRegister = parcelRequire.register;\nvar $c65828dbe869c24d$exports = {};\n\nvar $1ehpN = parcelRequire(\"1ehpN\");\n\nvar $gxLKL = parcelRequire(\"gxLKL\");\n\nvar $gZfn5 = parcelRequire(\"gZfn5\");\n\nvar $kib2Q = parcelRequire(\"kib2Q\");\n$parcel$exportWildcard($c65828dbe869c24d$exports, $1ehpN);\n$parcel$exportWildcard($c65828dbe869c24d$exports, $gxLKL);\n$parcel$exportWildcard($c65828dbe869c24d$exports, $gZfn5);\n$parcel$exportWildcard($c65828dbe869c24d$exports, $kib2Q);\n\n\nexport {$963b78d65282413b$export$b556effaa3ad7d4a as DataSheetDensity, $963b78d65282413b$export$dea56b0125f0282d as DataSheet, $963b78d65282413b$export$222fa1b971ddc36 as getRowsToDelete, $963b78d65282413b$export$41ad0bbfa4755cac as BaseCell, $963b78d65282413b$export$e7db3202e96fc463 as ScrollToRowControl, $963b78d65282413b$import$5573889ca4ff9ca2$f6f0c3fe4ec306ea as Cell, $4d256d31a726a84a$export$34ce2a614f5dd320 as PostgRESTTableView, $4d256d31a726a84a$export$2022c252b5885348 as wrapWithErrorHandling, $4d256d31a726a84a$export$a346ab8a0cc01d91 as SearchAction, $4d256d31a726a84a$export$48a1a02e95eff0a2 as notifyOnError, $4d256d31a726a84a$export$85a23c82145eafdb as LongTextViewer, $4d256d31a726a84a$export$8d4d3113a9b124d2 as IntervalCell, $4d256d31a726a84a$export$2ad73a796d2d3eb as lithologyRenderer, $4d256d31a726a84a$export$5da000845ac52c4f as ExpandedLithologies, $07d30ec9100abcaa$export$4dffb9bb65ef8b2 as usePostgRESTLazyLoader, $36eead336b938625$export$2a7e60c8443c1751 as EditorPopup, $827916362b958415$export$24aecfe8a925020d as ColorCell, $827916362b958415$export$e5f546a5ba915f1c as colorSwatchRenderer, $827916362b958415$export$9feb1bc2e5f1ccb3 as ColorPicker, $1b3be825da79eb57$export$b8e68c321a6269f1 as EditableTextArea, $1b3be825da79eb57$export$52c8c5a1aad17e2a as handleSpecialKeys, $bec5b73cd6722b6b$export$b215fe4466d8f847 as DataSheetActionsRow, $bec5b73cd6722b6b$export$c2c7070a9fc246e1 as DataSheetAction, $7e5384423bc0f425$export$135c527978291360 as DataSheetProvider, $7e5384423bc0f425$export$de0bb697976d7dcb as singleFocusedCell, $7e5384423bc0f425$export$54fc6f5c8f914926 as useStoreAPI, $7e5384423bc0f425$export$2105062e25df4afe as useSelector, $7e5384423bc0f425$export$88b0ba8661dc41b4 as topLeftCell};\n//# sourceMappingURL=index.js.map\n","export * from \"./core\";\nexport * from \"./postgrest-table\";\nexport * from \"./components\";\nexport * from \"./provider\";\n"],"names":["$parcel$exportWildcard","dest","source","Object","keys","forEach","key","prototype","hasOwnProperty","call","defineProperty","enumerable","get","$parcel$global","globalThis","$parcel$modules","$parcel$inits","parcelRequire","id","exports","init","module","err","Error","code","register","$c65828dbe869c24d$exports","$1ehpN","$gxLKL","$gZfn5","$kib2Q","$963b78d65282413b$export$b556effaa3ad7d4a","DataSheetDensity","$963b78d65282413b$export$dea56b0125f0282d","DataSheet","$963b78d65282413b$export$222fa1b971ddc36","getRowsToDelete","$963b78d65282413b$export$41ad0bbfa4755cac","BaseCell","$963b78d65282413b$export$e7db3202e96fc463","ScrollToRowControl","$963b78d65282413b$import$5573889ca4ff9ca2$f6f0c3fe4ec306ea","Cell","$4d256d31a726a84a$export$34ce2a614f5dd320","PostgRESTTableView","$4d256d31a726a84a$export$2022c252b5885348","wrapWithErrorHandling","$4d256d31a726a84a$export$a346ab8a0cc01d91","SearchAction","$4d256d31a726a84a$export$48a1a02e95eff0a2","notifyOnError","$4d256d31a726a84a$export$85a23c82145eafdb","LongTextViewer","$4d256d31a726a84a$export$8d4d3113a9b124d2","IntervalCell","$4d256d31a726a84a$export$2ad73a796d2d3eb","lithologyRenderer","$4d256d31a726a84a$export$5da000845ac52c4f","ExpandedLithologies","$07d30ec9100abcaa$export$4dffb9bb65ef8b2","usePostgRESTLazyLoader","$36eead336b938625$export$2a7e60c8443c1751","EditorPopup","$827916362b958415$export$24aecfe8a925020d","ColorCell","$827916362b958415$export$e5f546a5ba915f1c","colorSwatchRenderer","$827916362b958415$export$9feb1bc2e5f1ccb3","ColorPicker","$1b3be825da79eb57$export$b8e68c321a6269f1","EditableTextArea","$1b3be825da79eb57$export$52c8c5a1aad17e2a","handleSpecialKeys","$bec5b73cd6722b6b$export$b215fe4466d8f847","DataSheetActionsRow","$bec5b73cd6722b6b$export$c2c7070a9fc246e1","DataSheetAction","$7e5384423bc0f425$export$135c527978291360","DataSheetProvider","$7e5384423bc0f425$export$de0bb697976d7dcb","singleFocusedCell","$7e5384423bc0f425$export$54fc6f5c8f914926","useStoreAPI","$7e5384423bc0f425$export$2105062e25df4afe","useSelector","$7e5384423bc0f425$export$88b0ba8661dc41b4","topLeftCell"],"version":3,"file":"index.js.map","sourceRoot":"../../../../"}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@macrostrat/data-sheet",
|
|
3
|
-
"version": "2.
|
|
3
|
+
"version": "2.2.0",
|
|
4
4
|
"description": "Scalable data sheet with optional editing capabilities",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"source": "src/index.ts",
|
|
@@ -31,9 +31,9 @@
|
|
|
31
31
|
"@blueprintjs/core": "^5.10.2",
|
|
32
32
|
"@blueprintjs/table": "^5.1.4",
|
|
33
33
|
"@macrostrat/color-utils": "^1.1.1",
|
|
34
|
-
"@macrostrat/data-components": "^0.2.
|
|
34
|
+
"@macrostrat/data-components": "^0.2.1",
|
|
35
35
|
"@macrostrat/hyper": "^3.0.6",
|
|
36
|
-
"@macrostrat/ui-components": "^4.
|
|
36
|
+
"@macrostrat/ui-components": "^4.4.6",
|
|
37
37
|
"@supabase/postgrest-js": "^1.17.7",
|
|
38
38
|
"chroma-js": "^2.4.2",
|
|
39
39
|
"classnames": "^2.3.1",
|
|
@@ -56,6 +56,6 @@
|
|
|
56
56
|
},
|
|
57
57
|
"devDependencies": {
|
|
58
58
|
"@types/underscore": "^1.13.0",
|
|
59
|
-
"parcel": "^2.
|
|
59
|
+
"parcel": "^2.16.0"
|
|
60
60
|
}
|
|
61
61
|
}
|
package/src/components/index.ts
CHANGED
package/src/core.ts
CHANGED
|
@@ -16,11 +16,10 @@ import "@blueprintjs/table/lib/css/table.css";
|
|
|
16
16
|
import hyper from "@macrostrat/hyper";
|
|
17
17
|
import update from "immutability-helper";
|
|
18
18
|
import { ReactNode, useCallback, useEffect, useMemo, useState } from "react";
|
|
19
|
-
import { EditorPopup, handleSpecialKeys } from "./components";
|
|
19
|
+
import { EditorPopup, handleSpecialKeys, DataSheetAction } from "./components";
|
|
20
20
|
import styles from "./main.module.sass";
|
|
21
21
|
import {
|
|
22
22
|
ColumnSpec,
|
|
23
|
-
ColumnSpecOptions,
|
|
24
23
|
DataSheetProvider,
|
|
25
24
|
DataSheetProviderProps,
|
|
26
25
|
DataSheetStore,
|
|
@@ -29,10 +28,6 @@ import {
|
|
|
29
28
|
useStoreAPI,
|
|
30
29
|
VisibleCells,
|
|
31
30
|
} from "./provider";
|
|
32
|
-
import { DataSheetAction } from "./components/actions";
|
|
33
|
-
|
|
34
|
-
export type { ColumnSpec, ColumnSpecOptions };
|
|
35
|
-
export * from "./components";
|
|
36
31
|
|
|
37
32
|
const h = hyper.styled(styles);
|
|
38
33
|
|
|
@@ -157,7 +152,7 @@ function _DataSheet<T>({
|
|
|
157
152
|
);
|
|
158
153
|
|
|
159
154
|
const onAddRow = useCallback(() => {
|
|
160
|
-
setUpdatedData((updatedData) => {
|
|
155
|
+
setUpdatedData((updatedData: any[]): any[] => {
|
|
161
156
|
const ix = Math.max(updatedData.length, data.length);
|
|
162
157
|
const addRowSpec = { [ix]: { $set: {} } };
|
|
163
158
|
const newUpdatedData = update(updatedData, addRowSpec);
|
package/src/index.ts
CHANGED
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
|
|
3
3
|
import { useAsyncEffect } from "@macrostrat/ui-components";
|
|
4
4
|
import { debounce } from "underscore";
|
|
5
|
-
import { useCallback, useMemo, useReducer, useRef } from "react";
|
|
5
|
+
import { useCallback, useMemo, useReducer, useRef, useEffect } from "react";
|
|
6
6
|
import update, { Spec } from "immutability-helper";
|
|
7
7
|
|
|
8
8
|
interface ChunkIndex {
|
|
@@ -25,12 +25,19 @@ interface LazyLoaderState<T> {
|
|
|
25
25
|
initialized: boolean;
|
|
26
26
|
}
|
|
27
27
|
|
|
28
|
+
export interface PostgrestOrder<T> {
|
|
29
|
+
key: string;
|
|
30
|
+
ascending?: boolean;
|
|
31
|
+
nullsFirst?: boolean;
|
|
32
|
+
}
|
|
33
|
+
|
|
28
34
|
type LazyLoaderAction<T> =
|
|
29
35
|
| { type: "start-loading" }
|
|
30
36
|
| { type: "loaded"; data: T[]; offset: number; totalSize: number }
|
|
31
37
|
| { type: "error"; error: Error }
|
|
32
38
|
| { type: "set-visible"; region: RowRegion }
|
|
33
|
-
| { type: "update-data"; changes: Spec<T[]> }
|
|
39
|
+
| { type: "update-data"; changes: Spec<T[]> }
|
|
40
|
+
| { type: "reset" };
|
|
34
41
|
|
|
35
42
|
function adjustArraySize<T>(arr: T[], newSize: number) {
|
|
36
43
|
if (newSize == null || arr.length === newSize) {
|
|
@@ -78,6 +85,15 @@ function lazyLoadingReducer<T>(
|
|
|
78
85
|
data,
|
|
79
86
|
loading: false,
|
|
80
87
|
};
|
|
88
|
+
|
|
89
|
+
case "reset":
|
|
90
|
+
return {
|
|
91
|
+
data: [],
|
|
92
|
+
loading: false,
|
|
93
|
+
error: null,
|
|
94
|
+
visibleRegion: { rowIndexStart: 0, rowIndexEnd: 0 },
|
|
95
|
+
initialized: false,
|
|
96
|
+
};
|
|
81
97
|
case "error":
|
|
82
98
|
return {
|
|
83
99
|
...state,
|
|
@@ -130,8 +146,9 @@ interface QueryConfig {
|
|
|
130
146
|
count?: "exact" | "estimated";
|
|
131
147
|
limit?: number;
|
|
132
148
|
offset?: number;
|
|
133
|
-
order?:
|
|
149
|
+
order?: PostgrestOrder<any>;
|
|
134
150
|
after?: any;
|
|
151
|
+
fullTextSearch?: string;
|
|
135
152
|
filter?: (
|
|
136
153
|
query: PostgrestFilterBuilder<any, any, any>,
|
|
137
154
|
) => PostgrestFilterBuilder<any, any, any>;
|
|
@@ -144,6 +161,8 @@ function buildQuery<T>(
|
|
|
144
161
|
const { columns = "*", count } = config;
|
|
145
162
|
const opts = { count };
|
|
146
163
|
|
|
164
|
+
console.log("config", config);
|
|
165
|
+
|
|
147
166
|
let cols: string;
|
|
148
167
|
if (Array.isArray(columns)) {
|
|
149
168
|
cols = columns.join(", ");
|
|
@@ -156,14 +175,14 @@ function buildQuery<T>(
|
|
|
156
175
|
if (config.filter) {
|
|
157
176
|
query = config.filter(query);
|
|
158
177
|
}
|
|
178
|
+
console.log("query", query.url.search);
|
|
159
179
|
|
|
160
180
|
if (config.order != null) {
|
|
161
|
-
|
|
162
|
-
|
|
163
|
-
});
|
|
181
|
+
const { key: orderKey, ...rest } = config.order;
|
|
182
|
+
query = query.order(orderKey, rest);
|
|
164
183
|
if (config.after != null) {
|
|
165
|
-
const op =
|
|
166
|
-
query = query[op](
|
|
184
|
+
const op = (rest.ascending ?? true) ? "gt" : "lt";
|
|
185
|
+
query = query[op](orderKey, config.after);
|
|
167
186
|
}
|
|
168
187
|
}
|
|
169
188
|
if (config.limit != null) {
|
|
@@ -1,16 +1,17 @@
|
|
|
1
1
|
import { Toaster, HotkeysProvider } from "@blueprintjs/core";
|
|
2
2
|
import hyper from "@macrostrat/hyper";
|
|
3
3
|
import styles from "./main.module.sass";
|
|
4
|
-
import { DataSheet,
|
|
4
|
+
import { DataSheet, getRowsToDelete } from "../core"; //getRowsToDelete
|
|
5
5
|
import { LithologyTag, Tag, TagSize } from "@macrostrat/data-components";
|
|
6
|
-
import { usePostgRESTLazyLoader } from "./data-loaders";
|
|
7
|
-
import { Spinner } from "@blueprintjs/core";
|
|
6
|
+
import { PostgrestOrder, usePostgRESTLazyLoader } from "./data-loaders";
|
|
7
|
+
import { Spinner, InputGroup } from "@blueprintjs/core";
|
|
8
8
|
|
|
9
9
|
export * from "./data-loaders";
|
|
10
|
-
import { useCallback } from "react";
|
|
10
|
+
import { useCallback, useState, useRef } from "react";
|
|
11
11
|
import {
|
|
12
12
|
ErrorBoundary,
|
|
13
13
|
ToasterContext,
|
|
14
|
+
useAPIResult,
|
|
14
15
|
useToaster,
|
|
15
16
|
} from "@macrostrat/ui-components";
|
|
16
17
|
import { Spec } from "immutability-helper";
|
|
@@ -21,6 +22,7 @@ import type {
|
|
|
21
22
|
GenericTable,
|
|
22
23
|
GenericView,
|
|
23
24
|
} from "@supabase/postgrest-js/dist/cjs/types";
|
|
25
|
+
import { ColorCell } from "../components";
|
|
24
26
|
|
|
25
27
|
const h = hyper.styled(styles);
|
|
26
28
|
|
|
@@ -35,9 +37,12 @@ interface PostgRESTTableViewProps<T extends object>
|
|
|
35
37
|
endpoint: string;
|
|
36
38
|
table: string;
|
|
37
39
|
columnOptions?: any;
|
|
38
|
-
order?:
|
|
40
|
+
order?: PostgrestOrder<T>;
|
|
39
41
|
columns?: string;
|
|
40
42
|
editable?: boolean;
|
|
43
|
+
identityKey?: string;
|
|
44
|
+
enableFullTableSearch?: boolean;
|
|
45
|
+
dataSheetActions?: any;
|
|
41
46
|
filter(
|
|
42
47
|
query: PostgrestFilterBuilder<T, any, any>,
|
|
43
48
|
): PostgrestFilterBuilder<T, any, any>;
|
|
@@ -59,15 +64,37 @@ function _PostgRESTTableView<T>({
|
|
|
59
64
|
order,
|
|
60
65
|
columns,
|
|
61
66
|
editable = false,
|
|
62
|
-
filter,
|
|
67
|
+
filter = undefined,
|
|
68
|
+
enableFullTableSearch = false,
|
|
69
|
+
dataSheetActions,
|
|
63
70
|
identityKey = "id",
|
|
64
71
|
...rest
|
|
65
72
|
}: PostgRESTTableViewProps<T>) {
|
|
73
|
+
const [input, setInput] = useState("");
|
|
74
|
+
|
|
75
|
+
if (enableFullTableSearch) {
|
|
76
|
+
const columnList = columns ?? getColumnList(endpoint, table);
|
|
77
|
+
|
|
78
|
+
filter = (query) => {
|
|
79
|
+
const urlParams = new URLSearchParams(query.url.search);
|
|
80
|
+
urlParams.delete("or");
|
|
81
|
+
query.url.search = urlParams.toString() ? `?${urlParams.toString()}` : "";
|
|
82
|
+
|
|
83
|
+
if (input.length > 2 && enableFullTableSearch) {
|
|
84
|
+
const conditions = columnList?.map((col) => `${col}.ilike.*${input}*`);
|
|
85
|
+
|
|
86
|
+
return query.or(conditions.join(","));
|
|
87
|
+
}
|
|
88
|
+
|
|
89
|
+
return query;
|
|
90
|
+
};
|
|
91
|
+
}
|
|
92
|
+
|
|
66
93
|
const { data, onScroll, dispatch, client } = usePostgRESTLazyLoader(
|
|
67
94
|
endpoint,
|
|
68
95
|
table,
|
|
69
96
|
{
|
|
70
|
-
order,
|
|
97
|
+
order: order ?? { key: identityKey, ascending: true },
|
|
71
98
|
columns,
|
|
72
99
|
filter,
|
|
73
100
|
},
|
|
@@ -97,6 +124,9 @@ function _PostgRESTTableView<T>({
|
|
|
97
124
|
return h("div.data-sheet-outer", [
|
|
98
125
|
h(DataSheet, {
|
|
99
126
|
...rest,
|
|
127
|
+
dataSheetActions: enableFullTableSearch
|
|
128
|
+
? h(SearchAction, { input, setInput, dispatch })
|
|
129
|
+
: dataSheetActions,
|
|
100
130
|
data,
|
|
101
131
|
columnSpecOptions: columnOptions ?? {},
|
|
102
132
|
editable,
|
|
@@ -216,11 +246,11 @@ export function ExpandedLithologies({ value, onChange }) {
|
|
|
216
246
|
h(
|
|
217
247
|
"td.basis-col",
|
|
218
248
|
d.basis_col?.map((d) => {
|
|
219
|
-
return h(Tag, {
|
|
220
|
-
|
|
221
|
-
|
|
222
|
-
h("code", d),
|
|
223
|
-
|
|
249
|
+
return h(Tag, {
|
|
250
|
+
size: TagSize.Small,
|
|
251
|
+
key: d,
|
|
252
|
+
name: h([h("span.tag-header", "Column"), " ", h("code", d)]),
|
|
253
|
+
});
|
|
224
254
|
}),
|
|
225
255
|
),
|
|
226
256
|
]);
|
|
@@ -229,3 +259,33 @@ export function ExpandedLithologies({ value, onChange }) {
|
|
|
229
259
|
]),
|
|
230
260
|
]);
|
|
231
261
|
}
|
|
262
|
+
|
|
263
|
+
export function SearchAction({ input, setInput, dispatch }) {
|
|
264
|
+
return h(InputGroup, {
|
|
265
|
+
type: "search",
|
|
266
|
+
placeholder: "Search table...",
|
|
267
|
+
value: input,
|
|
268
|
+
onChange(event) {
|
|
269
|
+
const search = event.target.value;
|
|
270
|
+
if (search.length > 2 || (input.length === 3 && search.length < 3)) {
|
|
271
|
+
dispatch({ type: "reset" });
|
|
272
|
+
}
|
|
273
|
+
setInput(search.toLowerCase());
|
|
274
|
+
},
|
|
275
|
+
});
|
|
276
|
+
}
|
|
277
|
+
|
|
278
|
+
function getColumnList(endpoint: string, table: string) {
|
|
279
|
+
const url = `${endpoint}/${table}?select=*&limit=1`;
|
|
280
|
+
const res = useAPIResult(url);
|
|
281
|
+
|
|
282
|
+
if (!res || !Array.isArray(res) || res.length === 0) return [];
|
|
283
|
+
|
|
284
|
+
const sampleRow = res[0];
|
|
285
|
+
|
|
286
|
+
return Object.entries(sampleRow)
|
|
287
|
+
.filter(([_, value]) => {
|
|
288
|
+
return typeof value === "string";
|
|
289
|
+
})
|
|
290
|
+
.map(([key]) => key);
|
|
291
|
+
}
|
package/src/provider.ts
CHANGED
|
@@ -61,10 +61,12 @@ export interface DataSheetComputedStore {
|
|
|
61
61
|
|
|
62
62
|
type DataSheetVals<T> = DataSheetState<T> & DataSheetCoreProps<T>;
|
|
63
63
|
|
|
64
|
+
type StateUpdater<T> = T[] | ((state: T[]) => T[]);
|
|
65
|
+
|
|
64
66
|
export interface DataSheetStore<T> extends DataSheetVals<T> {
|
|
65
67
|
setSelection(selection: Region[]): void;
|
|
66
68
|
onDragValue(cell: FocusedCellCoordinates | null): void;
|
|
67
|
-
setUpdatedData(data: T
|
|
69
|
+
setUpdatedData(data: StateUpdater<T>): void;
|
|
68
70
|
onCellEdited(rowIndex: number, columnName: string, value: any): void;
|
|
69
71
|
onColumnsReordered(oldIndex: number, newIndex: number, length: number): void;
|
|
70
72
|
moveFocusedCell(direction: "up" | "down" | "left" | "right"): void;
|
|
@@ -178,7 +180,7 @@ export function DataSheetProvider<T>({
|
|
|
178
180
|
};
|
|
179
181
|
});
|
|
180
182
|
},
|
|
181
|
-
setUpdatedData(data: T
|
|
183
|
+
setUpdatedData(data: StateUpdater<T>) {
|
|
182
184
|
if (Array.isArray(data)) {
|
|
183
185
|
set({ updatedData: data });
|
|
184
186
|
} else {
|
package/src/utils/column-spec.ts
CHANGED
|
@@ -1,3 +1,5 @@
|
|
|
1
|
+
import type { ColumnSpec, ColumnSpecOptions } from "../provider";
|
|
2
|
+
|
|
1
3
|
const defaultRenderers = {
|
|
2
4
|
string: (d) => d,
|
|
3
5
|
number: (d) => d?.toFixed(2),
|
|
@@ -104,7 +106,7 @@ export function generateDefaultColumnSpec<T>(
|
|
|
104
106
|
|
|
105
107
|
export function generateColumnSpec<T>(
|
|
106
108
|
data: T[],
|
|
107
|
-
options: ColumnSpecOptions
|
|
109
|
+
options: ColumnSpecOptions<T>,
|
|
108
110
|
): ColumnSpec[] {
|
|
109
111
|
/** Generate a column spec from a dataset */
|
|
110
112
|
const { overrides = {}, nRows = 10, omitColumns, includeColumns } = options;
|