@dxos/react-ui-table 0.5.1-next.2ad6c47 → 0.5.1-next.5e6b3f6
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/dist/lib/browser/index.mjs +95 -83
- package/dist/lib/browser/index.mjs.map +4 -4
- package/dist/lib/browser/meta.json +1 -1
- package/dist/types/src/components/ColumnMenu/ColumnMenu.d.ts +1 -4
- package/dist/types/src/components/ColumnMenu/ColumnMenu.d.ts.map +1 -1
- package/dist/types/src/components/ColumnMenu/ColumnSettingsForm.d.ts.map +1 -1
- package/dist/types/src/components/Table/Table.d.ts.map +1 -1
- package/dist/types/src/components/Table/props.d.ts +2 -1
- package/dist/types/src/components/Table/props.d.ts.map +1 -1
- package/dist/types/src/hooks/useColumnSorting.d.ts +9 -3
- package/dist/types/src/hooks/useColumnSorting.d.ts.map +1 -1
- package/package.json +15 -15
- package/src/components/ColumnMenu/ColumnMenu.tsx +15 -33
- package/src/components/ColumnMenu/ColumnSettingsForm.tsx +6 -1
- package/src/components/Table/Table.tsx +5 -2
- package/src/components/Table/props.ts +2 -1
- package/src/hooks/useColumnSorting.ts +34 -24
|
@@ -1 +1 @@
|
|
|
1
|
-
{"inputs":{"packages/ui/react-ui-table/src/translations.ts":{"bytes":2343,"imports":[],"format":"esm"},"packages/ui/react-ui-table/src/components/Cell/CellCombobox.tsx":{"bytes":11696,"imports":[{"path":"@phosphor-icons/react","kind":"import-statement","external":true},{"path":"react","kind":"import-statement","external":true},{"path":"@dxos/react-ui","kind":"import-statement","external":true},{"path":"@dxos/react-ui-searchlist","kind":"import-statement","external":true},{"path":"@dxos/react-ui-theme","kind":"import-statement","external":true},{"path":"packages/ui/react-ui-table/src/translations.ts","kind":"import-statement","original":"../../translations"}],"format":"esm"},"packages/ui/react-ui-table/src/components/Cell/index.ts":{"bytes":494,"imports":[{"path":"packages/ui/react-ui-table/src/components/Cell/CellCombobox.tsx","kind":"import-statement","original":"./CellCombobox"}],"format":"esm"},"packages/ui/react-ui-table/src/components/ColumnMenu/ColumnSettingsForm.tsx":{"bytes":24959,"imports":[{"path":"@phosphor-icons/react","kind":"import-statement","external":true},{"path":"react","kind":"import-statement","external":true},{"path":"@dxos/react-ui","kind":"import-statement","external":true},{"path":"@dxos/react-ui-theme","kind":"import-statement","external":true},{"path":"@dxos/util","kind":"import-statement","external":true},{"path":"packages/ui/react-ui-table/src/translations.ts","kind":"import-statement","original":"../../translations"}],"format":"esm"},"packages/ui/react-ui-table/src/hooks/useColumnSizing.ts":{"bytes":5013,"imports":[{"path":"react","kind":"import-statement","external":true},{"path":"@dxos/react-ui","kind":"import-statement","external":true}],"format":"esm"},"packages/ui/react-ui-table/src/hooks/useColumnSorting.ts":{"bytes":5069,"imports":[{"path":"react","kind":"import-statement","external":true}],"format":"esm"},"packages/ui/react-ui-table/src/hooks/usePinLastRow.ts":{"bytes":6297,"imports":[{"path":"react","kind":"import-statement","external":true},{"path":"packages/ui/react-ui-table/src/components/index.ts","kind":"import-statement","original":"../components"}],"format":"esm"},"packages/ui/react-ui-table/src/hooks/useRowSelection.ts":{"bytes":5030,"imports":[{"path":"@radix-ui/react-use-controllable-state","kind":"import-statement","external":true},{"path":"react","kind":"import-statement","external":true}],"format":"esm"},"packages/ui/react-ui-table/src/hooks/index.ts":{"bytes":811,"imports":[{"path":"packages/ui/react-ui-table/src/hooks/useColumnSizing.ts","kind":"import-statement","original":"./useColumnSizing"},{"path":"packages/ui/react-ui-table/src/hooks/useColumnSorting.ts","kind":"import-statement","original":"./useColumnSorting"},{"path":"packages/ui/react-ui-table/src/hooks/usePinLastRow.ts","kind":"import-statement","original":"./usePinLastRow"},{"path":"packages/ui/react-ui-table/src/hooks/useRowSelection.ts","kind":"import-statement","original":"./useRowSelection"}],"format":"esm"},"packages/ui/react-ui-table/src/components/ColumnMenu/ColumnMenu.tsx":{"bytes":18877,"imports":[{"path":"@phosphor-icons/react","kind":"import-statement","external":true},{"path":"react","kind":"import-statement","external":true},{"path":"@dxos/react-ui","kind":"import-statement","external":true},{"path":"@dxos/react-ui-theme","kind":"import-statement","external":true},{"path":"packages/ui/react-ui-table/src/components/ColumnMenu/ColumnSettingsForm.tsx","kind":"import-statement","original":"./ColumnSettingsForm"},{"path":"packages/ui/react-ui-table/src/hooks/index.ts","kind":"import-statement","original":"../../hooks"}],"format":"esm"},"packages/ui/react-ui-table/src/components/ColumnMenu/index.ts":{"bytes":608,"imports":[{"path":"packages/ui/react-ui-table/src/components/ColumnMenu/ColumnMenu.tsx","kind":"import-statement","original":"./ColumnMenu"},{"path":"packages/ui/react-ui-table/src/components/ColumnMenu/ColumnSettingsForm.tsx","kind":"import-statement","original":"./ColumnSettingsForm"}],"format":"esm"},"packages/ui/react-ui-table/src/components/Table/TableContext.tsx":{"bytes":3140,"imports":[{"path":"react","kind":"import-statement","external":true}],"format":"esm"},"packages/ui/react-ui-table/src/components/Table/TableRootContext.ts":{"bytes":3903,"imports":[{"path":"@tanstack/react-virtual","kind":"import-statement","external":true},{"path":"react","kind":"import-statement","external":true}],"format":"esm"},"packages/ui/react-ui-table/src/theme.ts":{"bytes":10262,"imports":[{"path":"@dxos/react-ui-theme","kind":"import-statement","external":true}],"format":"esm"},"packages/ui/react-ui-table/src/components/Cell/Cell.tsx":{"bytes":4842,"imports":[{"path":"@fluentui/react-tabster","kind":"import-statement","external":true},{"path":"react","kind":"import-statement","external":true},{"path":"packages/ui/react-ui-table/src/theme.ts","kind":"import-statement","original":"../../theme"},{"path":"packages/ui/react-ui-table/src/components/Table/TableContext.tsx","kind":"import-statement","original":"../Table/TableContext"}],"format":"esm"},"packages/ui/react-ui-table/src/components/Table/TableBody.tsx":{"bytes":8850,"imports":[{"path":"@fluentui/react-tabster","kind":"import-statement","external":true},{"path":"@tanstack/react-table","kind":"import-statement","external":true},{"path":"react","kind":"import-statement","external":true},{"path":"packages/ui/react-ui-table/src/components/Table/TableContext.tsx","kind":"import-statement","original":"./TableContext"},{"path":"packages/ui/react-ui-table/src/components/Table/TableRootContext.ts","kind":"import-statement","original":"./TableRootContext"},{"path":"packages/ui/react-ui-table/src/theme.ts","kind":"import-statement","original":"../../theme"},{"path":"packages/ui/react-ui-table/src/components/Cell/Cell.tsx","kind":"import-statement","original":"../Cell/Cell"}],"format":"esm"},"packages/ui/react-ui-table/src/components/Table/TableFooter.tsx":{"bytes":4638,"imports":[{"path":"@tanstack/react-table","kind":"import-statement","external":true},{"path":"react","kind":"import-statement","external":true},{"path":"packages/ui/react-ui-table/src/components/Table/TableContext.tsx","kind":"import-statement","original":"./TableContext"},{"path":"packages/ui/react-ui-table/src/theme.ts","kind":"import-statement","original":"../../theme"}],"format":"esm"},"packages/ui/react-ui-table/src/components/Table/TableHead.tsx":{"bytes":7863,"imports":[{"path":"@tanstack/react-table","kind":"import-statement","external":true},{"path":"react","kind":"import-statement","external":true},{"path":"packages/ui/react-ui-table/src/components/Table/TableContext.tsx","kind":"import-statement","original":"./TableContext"},{"path":"packages/ui/react-ui-table/src/theme.ts","kind":"import-statement","original":"../../theme"}],"format":"esm"},"packages/ui/react-ui-table/src/components/Table/Table.tsx":{"bytes":30127,"imports":[{"path":"@radix-ui/react-slot","kind":"import-statement","external":true},{"path":"@tanstack/react-table","kind":"import-statement","external":true},{"path":"react","kind":"import-statement","external":true},{"path":"@dxos/react-ui","kind":"import-statement","external":true},{"path":"@dxos/react-ui-theme","kind":"import-statement","external":true},{"path":"packages/ui/react-ui-table/src/components/Table/TableBody.tsx","kind":"import-statement","original":"./TableBody"},{"path":"packages/ui/react-ui-table/src/components/Table/TableContext.tsx","kind":"import-statement","original":"./TableContext"},{"path":"packages/ui/react-ui-table/src/components/Table/TableFooter.tsx","kind":"import-statement","original":"./TableFooter"},{"path":"packages/ui/react-ui-table/src/components/Table/TableHead.tsx","kind":"import-statement","original":"./TableHead"},{"path":"packages/ui/react-ui-table/src/components/Table/TableRootContext.ts","kind":"import-statement","original":"./TableRootContext"},{"path":"packages/ui/react-ui-table/src/hooks/index.ts","kind":"import-statement","original":"../../hooks"},{"path":"packages/ui/react-ui-table/src/theme.ts","kind":"import-statement","original":"../../theme"}],"format":"esm"},"packages/ui/react-ui-table/src/components/Table/props.ts":{"bytes":2679,"imports":[],"format":"esm"},"packages/ui/react-ui-table/src/components/Table/index.ts":{"bytes":669,"imports":[{"path":"packages/ui/react-ui-table/src/components/Table/Table.tsx","kind":"import-statement","original":"./Table"},{"path":"packages/ui/react-ui-table/src/components/Table/props.ts","kind":"import-statement","original":"./props"},{"path":"packages/ui/react-ui-table/src/components/Table/TableRootContext.ts","kind":"import-statement","original":"./TableRootContext"}],"format":"esm"},"packages/ui/react-ui-table/src/components/index.ts":{"bytes":644,"imports":[{"path":"packages/ui/react-ui-table/src/components/Cell/index.ts","kind":"import-statement","original":"./Cell"},{"path":"packages/ui/react-ui-table/src/components/ColumnMenu/index.ts","kind":"import-statement","original":"./ColumnMenu"},{"path":"packages/ui/react-ui-table/src/components/Table/index.ts","kind":"import-statement","original":"./Table"}],"format":"esm"},"packages/ui/react-ui-table/src/helpers.tsx":{"bytes":54890,"imports":[{"path":"@fluentui/react-tabster","kind":"import-statement","external":true},{"path":"@phosphor-icons/react","kind":"import-statement","external":true},{"path":"@tanstack/react-table","kind":"import-statement","external":true},{"path":"date-fns/format","kind":"import-statement","external":true},{"path":"date-fns/formatDistanceToNow","kind":"import-statement","external":true},{"path":"react","kind":"import-statement","external":true},{"path":"@dxos/log","kind":"import-statement","external":true},{"path":"@dxos/react-ui","kind":"import-statement","external":true},{"path":"@dxos/react-ui-theme","kind":"import-statement","external":true},{"path":"packages/ui/react-ui-table/src/components/index.ts","kind":"import-statement","original":"./components"},{"path":"packages/ui/react-ui-table/src/components/Table/TableContext.tsx","kind":"import-statement","original":"./components/Table/TableContext"},{"path":"packages/ui/react-ui-table/src/theme.ts","kind":"import-statement","original":"./theme"}],"format":"esm"},"packages/ui/react-ui-table/src/schema/schema.ts":{"bytes":9419,"imports":[{"path":"@effect/schema/AST","kind":"import-statement","external":true}],"format":"esm"},"packages/ui/react-ui-table/src/schema/schemaToColumns.ts":{"bytes":5160,"imports":[{"path":"packages/ui/react-ui-table/src/schema/schema.ts","kind":"import-statement","original":"./schema"},{"path":"packages/ui/react-ui-table/src/helpers.tsx","kind":"import-statement","original":"../helpers"}],"format":"esm"},"packages/ui/react-ui-table/src/schema/types.ts":{"bytes":1117,"imports":[],"format":"esm"},"packages/ui/react-ui-table/src/schema/index.ts":{"bytes":573,"imports":[{"path":"packages/ui/react-ui-table/src/schema/schemaToColumns.ts","kind":"import-statement","original":"./schemaToColumns"},{"path":"packages/ui/react-ui-table/src/schema/types.ts","kind":"import-statement","original":"./types"}],"format":"esm"},"packages/ui/react-ui-table/src/types.ts":{"bytes":1830,"imports":[],"format":"esm"},"packages/ui/react-ui-table/src/index.ts":{"bytes":1102,"imports":[{"path":"packages/ui/react-ui-table/src/translations.ts","kind":"import-statement","original":"./translations"},{"path":"packages/ui/react-ui-table/src/components/index.ts","kind":"import-statement","original":"./components"},{"path":"packages/ui/react-ui-table/src/helpers.tsx","kind":"import-statement","original":"./helpers"},{"path":"packages/ui/react-ui-table/src/hooks/index.ts","kind":"import-statement","original":"./hooks"},{"path":"packages/ui/react-ui-table/src/schema/index.ts","kind":"import-statement","original":"./schema"},{"path":"packages/ui/react-ui-table/src/theme.ts","kind":"import-statement","original":"./theme"},{"path":"packages/ui/react-ui-table/src/types.ts","kind":"import-statement","original":"./types"}],"format":"esm"}},"outputs":{"packages/ui/react-ui-table/dist/lib/browser/index.mjs.map":{"imports":[],"exports":[],"inputs":{},"bytes":116547},"packages/ui/react-ui-table/dist/lib/browser/index.mjs":{"imports":[{"path":"@phosphor-icons/react","kind":"import-statement","external":true},{"path":"react","kind":"import-statement","external":true},{"path":"@dxos/react-ui","kind":"import-statement","external":true},{"path":"@dxos/react-ui-searchlist","kind":"import-statement","external":true},{"path":"@dxos/react-ui-theme","kind":"import-statement","external":true},{"path":"@phosphor-icons/react","kind":"import-statement","external":true},{"path":"react","kind":"import-statement","external":true},{"path":"@dxos/react-ui","kind":"import-statement","external":true},{"path":"@dxos/react-ui-theme","kind":"import-statement","external":true},{"path":"@phosphor-icons/react","kind":"import-statement","external":true},{"path":"react","kind":"import-statement","external":true},{"path":"@dxos/react-ui","kind":"import-statement","external":true},{"path":"@dxos/react-ui-theme","kind":"import-statement","external":true},{"path":"@dxos/util","kind":"import-statement","external":true},{"path":"react","kind":"import-statement","external":true},{"path":"@dxos/react-ui","kind":"import-statement","external":true},{"path":"react","kind":"import-statement","external":true},{"path":"react","kind":"import-statement","external":true},{"path":"@radix-ui/react-use-controllable-state","kind":"import-statement","external":true},{"path":"react","kind":"import-statement","external":true},{"path":"@radix-ui/react-slot","kind":"import-statement","external":true},{"path":"@tanstack/react-table","kind":"import-statement","external":true},{"path":"react","kind":"import-statement","external":true},{"path":"@dxos/react-ui","kind":"import-statement","external":true},{"path":"@dxos/react-ui-theme","kind":"import-statement","external":true},{"path":"@fluentui/react-tabster","kind":"import-statement","external":true},{"path":"@tanstack/react-table","kind":"import-statement","external":true},{"path":"react","kind":"import-statement","external":true},{"path":"react","kind":"import-statement","external":true},{"path":"@tanstack/react-virtual","kind":"import-statement","external":true},{"path":"react","kind":"import-statement","external":true},{"path":"@dxos/react-ui-theme","kind":"import-statement","external":true},{"path":"@fluentui/react-tabster","kind":"import-statement","external":true},{"path":"react","kind":"import-statement","external":true},{"path":"@tanstack/react-table","kind":"import-statement","external":true},{"path":"react","kind":"import-statement","external":true},{"path":"@tanstack/react-table","kind":"import-statement","external":true},{"path":"react","kind":"import-statement","external":true},{"path":"@fluentui/react-tabster","kind":"import-statement","external":true},{"path":"@phosphor-icons/react","kind":"import-statement","external":true},{"path":"@tanstack/react-table","kind":"import-statement","external":true},{"path":"date-fns/format","kind":"import-statement","external":true},{"path":"date-fns/formatDistanceToNow","kind":"import-statement","external":true},{"path":"react","kind":"import-statement","external":true},{"path":"@dxos/log","kind":"import-statement","external":true},{"path":"@dxos/react-ui","kind":"import-statement","external":true},{"path":"@dxos/react-ui-theme","kind":"import-statement","external":true},{"path":"@effect/schema/AST","kind":"import-statement","external":true}],"exports":["CellCombobox","ColumnBuilder","ColumnMenu","ColumnSettingsForm","ColumnSettingsPanel","MemoizedVirtualisedTableContent","SortIndicator","Table","TablePrimitive","TableRootContext","createColumnBuilder","currentRow","flushPadding","gridCellFocusRing","groupTh","headPadding","schemaToColumnDefs","selectedRow","tableRoot","tbodyRoot","tbodyTr","tdContent","tdRoot","textPadding","tfootRoot","tfootTh","tfootTr","theadResizeRoot","theadRoot","theadTh","theadTr","translations","useColumnResizing","useColumnSorting","usePinLastRow","useRowSelection","useTableRootContext"],"entryPoint":"packages/ui/react-ui-table/src/index.ts","inputs":{"packages/ui/react-ui-table/src/translations.ts":{"bytesInOutput":611},"packages/ui/react-ui-table/src/index.ts":{"bytesInOutput":0},"packages/ui/react-ui-table/src/components/Cell/CellCombobox.tsx":{"bytesInOutput":2989},"packages/ui/react-ui-table/src/components/Cell/index.ts":{"bytesInOutput":0},"packages/ui/react-ui-table/src/components/index.ts":{"bytesInOutput":0},"packages/ui/react-ui-table/src/components/ColumnMenu/ColumnMenu.tsx":{"bytesInOutput":5419},"packages/ui/react-ui-table/src/components/ColumnMenu/ColumnSettingsForm.tsx":{"bytesInOutput":6917},"packages/ui/react-ui-table/src/hooks/useColumnSizing.ts":{"bytesInOutput":1068},"packages/ui/react-ui-table/src/hooks/index.ts":{"bytesInOutput":0},"packages/ui/react-ui-table/src/hooks/useColumnSorting.ts":{"bytesInOutput":1082},"packages/ui/react-ui-table/src/hooks/usePinLastRow.ts":{"bytesInOutput":1381},"packages/ui/react-ui-table/src/hooks/useRowSelection.ts":{"bytesInOutput":1055},"packages/ui/react-ui-table/src/components/ColumnMenu/index.ts":{"bytesInOutput":0},"packages/ui/react-ui-table/src/components/Table/Table.tsx":{"bytesInOutput":7309},"packages/ui/react-ui-table/src/components/Table/TableBody.tsx":{"bytesInOutput":1983},"packages/ui/react-ui-table/src/components/Table/TableContext.tsx":{"bytesInOutput":358},"packages/ui/react-ui-table/src/components/Table/TableRootContext.ts":{"bytesInOutput":758},"packages/ui/react-ui-table/src/theme.ts":{"bytesInOutput":2205},"packages/ui/react-ui-table/src/components/Cell/Cell.tsx":{"bytesInOutput":973},"packages/ui/react-ui-table/src/components/Table/TableFooter.tsx":{"bytesInOutput":1015},"packages/ui/react-ui-table/src/components/Table/TableHead.tsx":{"bytesInOutput":1739},"packages/ui/react-ui-table/src/components/Table/index.ts":{"bytesInOutput":0},"packages/ui/react-ui-table/src/helpers.tsx":{"bytesInOutput":13550},"packages/ui/react-ui-table/src/schema/schema.ts":{"bytesInOutput":1957},"packages/ui/react-ui-table/src/schema/schemaToColumns.ts":{"bytesInOutput":1047},"packages/ui/react-ui-table/src/schema/index.ts":{"bytesInOutput":0}},"bytes":55470}}}
|
|
1
|
+
{"inputs":{"packages/ui/react-ui-table/src/translations.ts":{"bytes":2343,"imports":[],"format":"esm"},"packages/ui/react-ui-table/src/components/Cell/CellCombobox.tsx":{"bytes":11696,"imports":[{"path":"@phosphor-icons/react","kind":"import-statement","external":true},{"path":"react","kind":"import-statement","external":true},{"path":"@dxos/react-ui","kind":"import-statement","external":true},{"path":"@dxos/react-ui-searchlist","kind":"import-statement","external":true},{"path":"@dxos/react-ui-theme","kind":"import-statement","external":true},{"path":"packages/ui/react-ui-table/src/translations.ts","kind":"import-statement","original":"../../translations"}],"format":"esm"},"packages/ui/react-ui-table/src/components/Cell/index.ts":{"bytes":494,"imports":[{"path":"packages/ui/react-ui-table/src/components/Cell/CellCombobox.tsx","kind":"import-statement","original":"./CellCombobox"}],"format":"esm"},"packages/ui/react-ui-table/src/components/ColumnMenu/ColumnSettingsForm.tsx":{"bytes":25192,"imports":[{"path":"@phosphor-icons/react","kind":"import-statement","external":true},{"path":"react","kind":"import-statement","external":true},{"path":"@dxos/react-ui","kind":"import-statement","external":true},{"path":"@dxos/react-ui-theme","kind":"import-statement","external":true},{"path":"@dxos/util","kind":"import-statement","external":true},{"path":"packages/ui/react-ui-table/src/translations.ts","kind":"import-statement","original":"../../translations"}],"format":"esm"},"packages/ui/react-ui-table/src/hooks/useColumnSizing.ts":{"bytes":5013,"imports":[{"path":"react","kind":"import-statement","external":true},{"path":"@dxos/react-ui","kind":"import-statement","external":true}],"format":"esm"},"packages/ui/react-ui-table/src/components/Table/TableContext.tsx":{"bytes":3140,"imports":[{"path":"react","kind":"import-statement","external":true}],"format":"esm"},"packages/ui/react-ui-table/src/hooks/useColumnSorting.ts":{"bytes":6741,"imports":[{"path":"react","kind":"import-statement","external":true},{"path":"packages/ui/react-ui-table/src/components/Table/TableContext.tsx","kind":"import-statement","original":"../components/Table/TableContext"}],"format":"esm"},"packages/ui/react-ui-table/src/hooks/usePinLastRow.ts":{"bytes":6297,"imports":[{"path":"react","kind":"import-statement","external":true},{"path":"packages/ui/react-ui-table/src/components/index.ts","kind":"import-statement","original":"../components"}],"format":"esm"},"packages/ui/react-ui-table/src/hooks/useRowSelection.ts":{"bytes":5030,"imports":[{"path":"@radix-ui/react-use-controllable-state","kind":"import-statement","external":true},{"path":"react","kind":"import-statement","external":true}],"format":"esm"},"packages/ui/react-ui-table/src/hooks/index.ts":{"bytes":811,"imports":[{"path":"packages/ui/react-ui-table/src/hooks/useColumnSizing.ts","kind":"import-statement","original":"./useColumnSizing"},{"path":"packages/ui/react-ui-table/src/hooks/useColumnSorting.ts","kind":"import-statement","original":"./useColumnSorting"},{"path":"packages/ui/react-ui-table/src/hooks/usePinLastRow.ts","kind":"import-statement","original":"./usePinLastRow"},{"path":"packages/ui/react-ui-table/src/hooks/useRowSelection.ts","kind":"import-statement","original":"./useRowSelection"}],"format":"esm"},"packages/ui/react-ui-table/src/components/ColumnMenu/ColumnMenu.tsx":{"bytes":17662,"imports":[{"path":"@phosphor-icons/react","kind":"import-statement","external":true},{"path":"react","kind":"import-statement","external":true},{"path":"@dxos/react-ui","kind":"import-statement","external":true},{"path":"@dxos/react-ui-theme","kind":"import-statement","external":true},{"path":"packages/ui/react-ui-table/src/components/ColumnMenu/ColumnSettingsForm.tsx","kind":"import-statement","original":"./ColumnSettingsForm"},{"path":"packages/ui/react-ui-table/src/hooks/index.ts","kind":"import-statement","original":"../../hooks"}],"format":"esm"},"packages/ui/react-ui-table/src/components/ColumnMenu/index.ts":{"bytes":608,"imports":[{"path":"packages/ui/react-ui-table/src/components/ColumnMenu/ColumnMenu.tsx","kind":"import-statement","original":"./ColumnMenu"},{"path":"packages/ui/react-ui-table/src/components/ColumnMenu/ColumnSettingsForm.tsx","kind":"import-statement","original":"./ColumnSettingsForm"}],"format":"esm"},"packages/ui/react-ui-table/src/components/Table/TableRootContext.ts":{"bytes":3903,"imports":[{"path":"@tanstack/react-virtual","kind":"import-statement","external":true},{"path":"react","kind":"import-statement","external":true}],"format":"esm"},"packages/ui/react-ui-table/src/theme.ts":{"bytes":10262,"imports":[{"path":"@dxos/react-ui-theme","kind":"import-statement","external":true}],"format":"esm"},"packages/ui/react-ui-table/src/components/Cell/Cell.tsx":{"bytes":4842,"imports":[{"path":"@fluentui/react-tabster","kind":"import-statement","external":true},{"path":"react","kind":"import-statement","external":true},{"path":"packages/ui/react-ui-table/src/theme.ts","kind":"import-statement","original":"../../theme"},{"path":"packages/ui/react-ui-table/src/components/Table/TableContext.tsx","kind":"import-statement","original":"../Table/TableContext"}],"format":"esm"},"packages/ui/react-ui-table/src/components/Table/TableBody.tsx":{"bytes":8850,"imports":[{"path":"@fluentui/react-tabster","kind":"import-statement","external":true},{"path":"@tanstack/react-table","kind":"import-statement","external":true},{"path":"react","kind":"import-statement","external":true},{"path":"packages/ui/react-ui-table/src/components/Table/TableContext.tsx","kind":"import-statement","original":"./TableContext"},{"path":"packages/ui/react-ui-table/src/components/Table/TableRootContext.ts","kind":"import-statement","original":"./TableRootContext"},{"path":"packages/ui/react-ui-table/src/theme.ts","kind":"import-statement","original":"../../theme"},{"path":"packages/ui/react-ui-table/src/components/Cell/Cell.tsx","kind":"import-statement","original":"../Cell/Cell"}],"format":"esm"},"packages/ui/react-ui-table/src/components/Table/TableFooter.tsx":{"bytes":4638,"imports":[{"path":"@tanstack/react-table","kind":"import-statement","external":true},{"path":"react","kind":"import-statement","external":true},{"path":"packages/ui/react-ui-table/src/components/Table/TableContext.tsx","kind":"import-statement","original":"./TableContext"},{"path":"packages/ui/react-ui-table/src/theme.ts","kind":"import-statement","original":"../../theme"}],"format":"esm"},"packages/ui/react-ui-table/src/components/Table/TableHead.tsx":{"bytes":7863,"imports":[{"path":"@tanstack/react-table","kind":"import-statement","external":true},{"path":"react","kind":"import-statement","external":true},{"path":"packages/ui/react-ui-table/src/components/Table/TableContext.tsx","kind":"import-statement","original":"./TableContext"},{"path":"packages/ui/react-ui-table/src/theme.ts","kind":"import-statement","original":"../../theme"}],"format":"esm"},"packages/ui/react-ui-table/src/components/Table/Table.tsx":{"bytes":30597,"imports":[{"path":"@radix-ui/react-slot","kind":"import-statement","external":true},{"path":"@tanstack/react-table","kind":"import-statement","external":true},{"path":"react","kind":"import-statement","external":true},{"path":"@dxos/react-ui","kind":"import-statement","external":true},{"path":"@dxos/react-ui-theme","kind":"import-statement","external":true},{"path":"packages/ui/react-ui-table/src/components/Table/TableBody.tsx","kind":"import-statement","original":"./TableBody"},{"path":"packages/ui/react-ui-table/src/components/Table/TableContext.tsx","kind":"import-statement","original":"./TableContext"},{"path":"packages/ui/react-ui-table/src/components/Table/TableFooter.tsx","kind":"import-statement","original":"./TableFooter"},{"path":"packages/ui/react-ui-table/src/components/Table/TableHead.tsx","kind":"import-statement","original":"./TableHead"},{"path":"packages/ui/react-ui-table/src/components/Table/TableRootContext.ts","kind":"import-statement","original":"./TableRootContext"},{"path":"packages/ui/react-ui-table/src/hooks/index.ts","kind":"import-statement","original":"../../hooks"},{"path":"packages/ui/react-ui-table/src/theme.ts","kind":"import-statement","original":"../../theme"}],"format":"esm"},"packages/ui/react-ui-table/src/components/Table/props.ts":{"bytes":2771,"imports":[],"format":"esm"},"packages/ui/react-ui-table/src/components/Table/index.ts":{"bytes":669,"imports":[{"path":"packages/ui/react-ui-table/src/components/Table/Table.tsx","kind":"import-statement","original":"./Table"},{"path":"packages/ui/react-ui-table/src/components/Table/props.ts","kind":"import-statement","original":"./props"},{"path":"packages/ui/react-ui-table/src/components/Table/TableRootContext.ts","kind":"import-statement","original":"./TableRootContext"}],"format":"esm"},"packages/ui/react-ui-table/src/components/index.ts":{"bytes":644,"imports":[{"path":"packages/ui/react-ui-table/src/components/Cell/index.ts","kind":"import-statement","original":"./Cell"},{"path":"packages/ui/react-ui-table/src/components/ColumnMenu/index.ts","kind":"import-statement","original":"./ColumnMenu"},{"path":"packages/ui/react-ui-table/src/components/Table/index.ts","kind":"import-statement","original":"./Table"}],"format":"esm"},"packages/ui/react-ui-table/src/helpers.tsx":{"bytes":54890,"imports":[{"path":"@fluentui/react-tabster","kind":"import-statement","external":true},{"path":"@phosphor-icons/react","kind":"import-statement","external":true},{"path":"@tanstack/react-table","kind":"import-statement","external":true},{"path":"date-fns/format","kind":"import-statement","external":true},{"path":"date-fns/formatDistanceToNow","kind":"import-statement","external":true},{"path":"react","kind":"import-statement","external":true},{"path":"@dxos/log","kind":"import-statement","external":true},{"path":"@dxos/react-ui","kind":"import-statement","external":true},{"path":"@dxos/react-ui-theme","kind":"import-statement","external":true},{"path":"packages/ui/react-ui-table/src/components/index.ts","kind":"import-statement","original":"./components"},{"path":"packages/ui/react-ui-table/src/components/Table/TableContext.tsx","kind":"import-statement","original":"./components/Table/TableContext"},{"path":"packages/ui/react-ui-table/src/theme.ts","kind":"import-statement","original":"./theme"}],"format":"esm"},"packages/ui/react-ui-table/src/schema/schema.ts":{"bytes":9419,"imports":[{"path":"@effect/schema/AST","kind":"import-statement","external":true}],"format":"esm"},"packages/ui/react-ui-table/src/schema/schemaToColumns.ts":{"bytes":5160,"imports":[{"path":"packages/ui/react-ui-table/src/schema/schema.ts","kind":"import-statement","original":"./schema"},{"path":"packages/ui/react-ui-table/src/helpers.tsx","kind":"import-statement","original":"../helpers"}],"format":"esm"},"packages/ui/react-ui-table/src/schema/types.ts":{"bytes":1117,"imports":[],"format":"esm"},"packages/ui/react-ui-table/src/schema/index.ts":{"bytes":573,"imports":[{"path":"packages/ui/react-ui-table/src/schema/schemaToColumns.ts","kind":"import-statement","original":"./schemaToColumns"},{"path":"packages/ui/react-ui-table/src/schema/types.ts","kind":"import-statement","original":"./types"}],"format":"esm"},"packages/ui/react-ui-table/src/types.ts":{"bytes":1830,"imports":[],"format":"esm"},"packages/ui/react-ui-table/src/index.ts":{"bytes":1102,"imports":[{"path":"packages/ui/react-ui-table/src/translations.ts","kind":"import-statement","original":"./translations"},{"path":"packages/ui/react-ui-table/src/components/index.ts","kind":"import-statement","original":"./components"},{"path":"packages/ui/react-ui-table/src/helpers.tsx","kind":"import-statement","original":"./helpers"},{"path":"packages/ui/react-ui-table/src/hooks/index.ts","kind":"import-statement","original":"./hooks"},{"path":"packages/ui/react-ui-table/src/schema/index.ts","kind":"import-statement","original":"./schema"},{"path":"packages/ui/react-ui-table/src/theme.ts","kind":"import-statement","original":"./theme"},{"path":"packages/ui/react-ui-table/src/types.ts","kind":"import-statement","original":"./types"}],"format":"esm"}},"outputs":{"packages/ui/react-ui-table/dist/lib/browser/index.mjs.map":{"imports":[],"exports":[],"inputs":{},"bytes":117265},"packages/ui/react-ui-table/dist/lib/browser/index.mjs":{"imports":[{"path":"@phosphor-icons/react","kind":"import-statement","external":true},{"path":"react","kind":"import-statement","external":true},{"path":"@dxos/react-ui","kind":"import-statement","external":true},{"path":"@dxos/react-ui-searchlist","kind":"import-statement","external":true},{"path":"@dxos/react-ui-theme","kind":"import-statement","external":true},{"path":"@phosphor-icons/react","kind":"import-statement","external":true},{"path":"react","kind":"import-statement","external":true},{"path":"@dxos/react-ui","kind":"import-statement","external":true},{"path":"@dxos/react-ui-theme","kind":"import-statement","external":true},{"path":"@phosphor-icons/react","kind":"import-statement","external":true},{"path":"react","kind":"import-statement","external":true},{"path":"@dxos/react-ui","kind":"import-statement","external":true},{"path":"@dxos/react-ui-theme","kind":"import-statement","external":true},{"path":"@dxos/util","kind":"import-statement","external":true},{"path":"react","kind":"import-statement","external":true},{"path":"@dxos/react-ui","kind":"import-statement","external":true},{"path":"react","kind":"import-statement","external":true},{"path":"react","kind":"import-statement","external":true},{"path":"react","kind":"import-statement","external":true},{"path":"@radix-ui/react-use-controllable-state","kind":"import-statement","external":true},{"path":"react","kind":"import-statement","external":true},{"path":"@radix-ui/react-slot","kind":"import-statement","external":true},{"path":"@tanstack/react-table","kind":"import-statement","external":true},{"path":"react","kind":"import-statement","external":true},{"path":"@dxos/react-ui","kind":"import-statement","external":true},{"path":"@dxos/react-ui-theme","kind":"import-statement","external":true},{"path":"@fluentui/react-tabster","kind":"import-statement","external":true},{"path":"@tanstack/react-table","kind":"import-statement","external":true},{"path":"react","kind":"import-statement","external":true},{"path":"@tanstack/react-virtual","kind":"import-statement","external":true},{"path":"react","kind":"import-statement","external":true},{"path":"@dxos/react-ui-theme","kind":"import-statement","external":true},{"path":"@fluentui/react-tabster","kind":"import-statement","external":true},{"path":"react","kind":"import-statement","external":true},{"path":"@tanstack/react-table","kind":"import-statement","external":true},{"path":"react","kind":"import-statement","external":true},{"path":"@tanstack/react-table","kind":"import-statement","external":true},{"path":"react","kind":"import-statement","external":true},{"path":"@fluentui/react-tabster","kind":"import-statement","external":true},{"path":"@phosphor-icons/react","kind":"import-statement","external":true},{"path":"@tanstack/react-table","kind":"import-statement","external":true},{"path":"date-fns/format","kind":"import-statement","external":true},{"path":"date-fns/formatDistanceToNow","kind":"import-statement","external":true},{"path":"react","kind":"import-statement","external":true},{"path":"@dxos/log","kind":"import-statement","external":true},{"path":"@dxos/react-ui","kind":"import-statement","external":true},{"path":"@dxos/react-ui-theme","kind":"import-statement","external":true},{"path":"@effect/schema/AST","kind":"import-statement","external":true}],"exports":["CellCombobox","ColumnBuilder","ColumnMenu","ColumnSettingsForm","MemoizedVirtualisedTableContent","SortIndicator","Table","TablePrimitive","TableRootContext","createColumnBuilder","currentRow","flushPadding","gridCellFocusRing","groupTh","headPadding","schemaToColumnDefs","selectedRow","tableRoot","tbodyRoot","tbodyTr","tdContent","tdRoot","textPadding","tfootRoot","tfootTh","tfootTr","theadResizeRoot","theadRoot","theadTh","theadTr","translations","useColumnResizing","useColumnSorting","usePinLastRow","useRowSelection","useSortColumn","useTableRootContext"],"entryPoint":"packages/ui/react-ui-table/src/index.ts","inputs":{"packages/ui/react-ui-table/src/translations.ts":{"bytesInOutput":611},"packages/ui/react-ui-table/src/index.ts":{"bytesInOutput":0},"packages/ui/react-ui-table/src/components/Cell/CellCombobox.tsx":{"bytesInOutput":2989},"packages/ui/react-ui-table/src/components/Cell/index.ts":{"bytesInOutput":0},"packages/ui/react-ui-table/src/components/index.ts":{"bytesInOutput":0},"packages/ui/react-ui-table/src/components/ColumnMenu/ColumnMenu.tsx":{"bytesInOutput":5190},"packages/ui/react-ui-table/src/components/ColumnMenu/ColumnSettingsForm.tsx":{"bytesInOutput":6982},"packages/ui/react-ui-table/src/hooks/useColumnSizing.ts":{"bytesInOutput":1068},"packages/ui/react-ui-table/src/hooks/index.ts":{"bytesInOutput":0},"packages/ui/react-ui-table/src/hooks/useColumnSorting.ts":{"bytesInOutput":1472},"packages/ui/react-ui-table/src/components/Table/TableContext.tsx":{"bytesInOutput":358},"packages/ui/react-ui-table/src/hooks/usePinLastRow.ts":{"bytesInOutput":1381},"packages/ui/react-ui-table/src/hooks/useRowSelection.ts":{"bytesInOutput":1055},"packages/ui/react-ui-table/src/components/ColumnMenu/index.ts":{"bytesInOutput":0},"packages/ui/react-ui-table/src/components/Table/Table.tsx":{"bytesInOutput":7413},"packages/ui/react-ui-table/src/components/Table/TableBody.tsx":{"bytesInOutput":1983},"packages/ui/react-ui-table/src/components/Table/TableRootContext.ts":{"bytesInOutput":758},"packages/ui/react-ui-table/src/theme.ts":{"bytesInOutput":2205},"packages/ui/react-ui-table/src/components/Cell/Cell.tsx":{"bytesInOutput":973},"packages/ui/react-ui-table/src/components/Table/TableFooter.tsx":{"bytesInOutput":1015},"packages/ui/react-ui-table/src/components/Table/TableHead.tsx":{"bytesInOutput":1739},"packages/ui/react-ui-table/src/components/Table/index.ts":{"bytesInOutput":0},"packages/ui/react-ui-table/src/helpers.tsx":{"bytesInOutput":13550},"packages/ui/react-ui-table/src/schema/schema.ts":{"bytesInOutput":1957},"packages/ui/react-ui-table/src/schema/schemaToColumns.ts":{"bytesInOutput":1047},"packages/ui/react-ui-table/src/schema/index.ts":{"bytesInOutput":0}},"bytes":55855}}}
|
|
@@ -9,11 +9,8 @@ export type ColumnMenuProps<TData extends RowData, TValue> = {
|
|
|
9
9
|
onDelete?: (id: string) => void;
|
|
10
10
|
};
|
|
11
11
|
export declare const ColumnMenu: <TData extends unknown, TValue>({ column, ...props }: ColumnMenuProps<TData, TValue>) => JSX.Element;
|
|
12
|
-
export declare const ColumnSettingsPanel: <TData extends unknown, TValue>({ tableDefs, tableDef, column, onUpdate, onDelete, onClose, }: ColumnMenuProps<TData, TValue> & {
|
|
13
|
-
onClose: () => void;
|
|
14
|
-
}) => JSX.Element;
|
|
15
12
|
export declare const SortIndicator: ({ direction, onClick, }: {
|
|
16
|
-
direction: SortDirection |
|
|
13
|
+
direction: SortDirection | undefined;
|
|
17
14
|
onClick: (e: any) => void;
|
|
18
15
|
}) => JSX.Element | null;
|
|
19
16
|
//# sourceMappingURL=ColumnMenu.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"ColumnMenu.d.ts","sourceRoot":"","sources":["../../../../../src/components/ColumnMenu/ColumnMenu.tsx"],"names":[],"mappings":"AAKA,OAAO,EAAE,KAAK,aAAa,EAAE,KAAK,aAAa,EAAE,KAAK,OAAO,EAAE,MAAM,uBAAuB,CAAC;AAQ7F,OAAO,EAAE,KAAK,QAAQ,EAAE,KAAK,WAAW,EAAE,MAAM,cAAc,CAAC;AAE/D,MAAM,MAAM,eAAe,CAAC,KAAK,SAAS,OAAO,EAAE,MAAM,IAAI;IAC3D,OAAO,EAAE,aAAa,CAAC,KAAK,EAAE,MAAM,CAAC,CAAC;IACtC,SAAS,EAAE,QAAQ,EAAE,CAAC;IACtB,QAAQ,EAAE,QAAQ,CAAC;IACnB,MAAM,EAAE,WAAW,CAAC;IACpB,QAAQ,CAAC,EAAE,CAAC,EAAE,EAAE,MAAM,EAAE,MAAM,EAAE,WAAW,KAAK,IAAI,CAAC;IACrD,QAAQ,CAAC,EAAE,CAAC,EAAE,EAAE,MAAM,KAAK,IAAI,CAAC;CACjC,CAAC;AAEF,eAAO,MAAM,UAAU,
|
|
1
|
+
{"version":3,"file":"ColumnMenu.d.ts","sourceRoot":"","sources":["../../../../../src/components/ColumnMenu/ColumnMenu.tsx"],"names":[],"mappings":"AAKA,OAAO,EAAE,KAAK,aAAa,EAAE,KAAK,aAAa,EAAE,KAAK,OAAO,EAAE,MAAM,uBAAuB,CAAC;AAQ7F,OAAO,EAAE,KAAK,QAAQ,EAAE,KAAK,WAAW,EAAE,MAAM,cAAc,CAAC;AAE/D,MAAM,MAAM,eAAe,CAAC,KAAK,SAAS,OAAO,EAAE,MAAM,IAAI;IAC3D,OAAO,EAAE,aAAa,CAAC,KAAK,EAAE,MAAM,CAAC,CAAC;IACtC,SAAS,EAAE,QAAQ,EAAE,CAAC;IACtB,QAAQ,EAAE,QAAQ,CAAC;IACnB,MAAM,EAAE,WAAW,CAAC;IACpB,QAAQ,CAAC,EAAE,CAAC,EAAE,EAAE,MAAM,EAAE,MAAM,EAAE,WAAW,KAAK,IAAI,CAAC;IACrD,QAAQ,CAAC,EAAE,CAAC,EAAE,EAAE,MAAM,KAAK,IAAI,CAAC;CACjC,CAAC;AAEF,eAAO,MAAM,UAAU,sGAgGtB,CAAC;AAEF,eAAO,MAAM,aAAa;eAIb,aAAa,GAAG,SAAS;iBACvB,GAAG,KAAK,IAAI;wBAsB1B,CAAC"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"ColumnSettingsForm.d.ts","sourceRoot":"","sources":["../../../../../src/components/ColumnMenu/ColumnSettingsForm.tsx"],"names":[],"mappings":"AAUA,OAAO,EAAE,KAAK,QAAQ,EAAE,KAAK,WAAW,EAAmB,MAAM,cAAc,CAAC;AAShF,MAAM,MAAM,uBAAuB,GAAG;IACpC,MAAM,EAAE,WAAW,CAAC;IACpB,QAAQ,EAAE,QAAQ,CAAC;IACnB,SAAS,EAAE,QAAQ,EAAE,CAAC;IACtB,QAAQ,CAAC,EAAE,CAAC,CAAC,EAAE,EAAE,MAAM,EAAE,MAAM,EAAE,WAAW,KAAK,IAAI,CAAC,GAAG,SAAS,CAAC;IACnE,QAAQ,CAAC,EAAE,CAAC,CAAC,EAAE,EAAE,MAAM,KAAK,IAAI,CAAC,GAAG,SAAS,CAAC;IAC9C,OAAO,CAAC,EAAE,MAAM,IAAI,CAAC;CACtB,CAAC;AAEF,eAAO,MAAM,kBAAkB,kEAO5B,uBAAuB,
|
|
1
|
+
{"version":3,"file":"ColumnSettingsForm.d.ts","sourceRoot":"","sources":["../../../../../src/components/ColumnMenu/ColumnSettingsForm.tsx"],"names":[],"mappings":"AAUA,OAAO,EAAE,KAAK,QAAQ,EAAE,KAAK,WAAW,EAAmB,MAAM,cAAc,CAAC;AAShF,MAAM,MAAM,uBAAuB,GAAG;IACpC,MAAM,EAAE,WAAW,CAAC;IACpB,QAAQ,EAAE,QAAQ,CAAC;IACnB,SAAS,EAAE,QAAQ,EAAE,CAAC;IACtB,QAAQ,CAAC,EAAE,CAAC,CAAC,EAAE,EAAE,MAAM,EAAE,MAAM,EAAE,WAAW,KAAK,IAAI,CAAC,GAAG,SAAS,CAAC;IACnE,QAAQ,CAAC,EAAE,CAAC,CAAC,EAAE,EAAE,MAAM,KAAK,IAAI,CAAC,GAAG,SAAS,CAAC;IAC9C,OAAO,CAAC,EAAE,MAAM,IAAI,CAAC;CACtB,CAAC;AAEF,eAAO,MAAM,kBAAkB,kEAO5B,uBAAuB,gBAuLzB,CAAC"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Table.d.ts","sourceRoot":"","sources":["../../../../../src/components/Table/Table.tsx"],"names":[],"mappings":"AAGA,OAAO,EAAE,KAAK,SAAS,EAAE,MAAM,2BAA2B,CAAC;AAY3D,OAAO,KAAK,EAAE,EAAE,KAAK,wBAAwB,EAA0D,MAAM,OAAO,CAAC;AAErH,OAAO,EAAE,KAAK,eAAe,EAAmB,MAAM,gBAAgB,CAAC;AAQvE,OAAO,EAAE,KAAK,UAAU,EAAE,MAAM,SAAS,CAAC;AAI1C,KAAK,cAAc,GAAG;IAAE,QAAQ,EAAE,KAAK,CAAC,SAAS,CAAA;CAAE,CAAC;AAOpD,KAAK,kBAAkB,GAAG,eAAe,CAAC,wBAAwB,CAAC,OAAO,SAAS,CAAC,GAAG,CAAC,CAAC,GAAG;IAC1F,OAAO,CAAC,EAAE,OAAO,CAAC;CACnB,CAAC;AAkBF,eAAO,MAAM,cAAc,
|
|
1
|
+
{"version":3,"file":"Table.d.ts","sourceRoot":"","sources":["../../../../../src/components/Table/Table.tsx"],"names":[],"mappings":"AAGA,OAAO,EAAE,KAAK,SAAS,EAAE,MAAM,2BAA2B,CAAC;AAY3D,OAAO,KAAK,EAAE,EAAE,KAAK,wBAAwB,EAA0D,MAAM,OAAO,CAAC;AAErH,OAAO,EAAE,KAAK,eAAe,EAAmB,MAAM,gBAAgB,CAAC;AAQvE,OAAO,EAAE,KAAK,UAAU,EAAE,MAAM,SAAS,CAAC;AAI1C,KAAK,cAAc,GAAG;IAAE,QAAQ,EAAE,KAAK,CAAC,SAAS,CAAA;CAAE,CAAC;AAOpD,KAAK,kBAAkB,GAAG,eAAe,CAAC,wBAAwB,CAAC,OAAO,SAAS,CAAC,GAAG,CAAC,CAAC,GAAG;IAC1F,OAAO,CAAC,EAAE,OAAO,CAAC;CACnB,CAAC;AAkBF,eAAO,MAAM,cAAc,kEAwG1B,CAAC;AAyFF,eAAO,MAAM,+BAA+B,8CAAsC,CAAC;AAkCnF,eAAO,MAAM,KAAK;yBA5Pe,cAAc;;4DASqB,kBAAkB;CAuPrF,CAAC"}
|
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import { type RowData, type RowSelectionState, type Table, type VisibilityState } from '@tanstack/react-table';
|
|
2
2
|
import { type ClassNameValue } from '@dxos/react-ui-types';
|
|
3
|
+
import { type ColumnSorting } from '../../hooks';
|
|
3
4
|
import { type KeyValue, type TableColumnDef } from '../../types';
|
|
4
5
|
export type TableFlags = Partial<{
|
|
5
6
|
role: 'table' | 'grid' | 'treegrid';
|
|
@@ -37,5 +38,5 @@ export type { RowSelectionState, VisibilityState, TableColumnDef, KeyValue };
|
|
|
37
38
|
export type TableContextValue<TData> = TableFlags & TableCurrent<TData> & Pick<TableProps<TData>, 'keyAccessor'> & {
|
|
38
39
|
table: Table<TData>;
|
|
39
40
|
isGrid: boolean;
|
|
40
|
-
};
|
|
41
|
+
} & ColumnSorting;
|
|
41
42
|
//# sourceMappingURL=props.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"props.d.ts","sourceRoot":"","sources":["../../../../../src/components/Table/props.ts"],"names":[],"mappings":"AAIA,OAAO,EAAE,KAAK,OAAO,EAAE,KAAK,iBAAiB,EAAE,KAAK,KAAK,EAAE,KAAK,eAAe,EAAE,MAAM,uBAAuB,CAAC;AAE/G,OAAO,EAAE,KAAK,cAAc,EAAE,MAAM,sBAAsB,CAAC;AAE3D,OAAO,EAAE,KAAK,QAAQ,EAAE,KAAK,cAAc,EAAE,MAAM,aAAa,CAAC;AAEjE,MAAM,MAAM,UAAU,GAAG,OAAO,CAAC;IAC/B,IAAI,EAAE,OAAO,GAAG,MAAM,GAAG,UAAU,CAAC;IACpC,QAAQ,EAAE,MAAM,EAAE,CAAC;IACnB,MAAM,EAAE,OAAO,CAAC;IAChB,MAAM,EAAE,OAAO,CAAC;IAChB,MAAM,EAAE,OAAO,CAAC;IAChB,SAAS,EAAE,OAAO,CAAC;IACnB,KAAK,EAAE,OAAO,CAAC;IACf,MAAM,EAAE,OAAO,CAAC;IAChB,YAAY,EAAE,OAAO,CAAC;IACtB,cAAc,EAAE,OAAO,GAAG,OAAO,CAAC;CACnC,CAAC,CAAC;AAEH;;GAEG;AACH,MAAM,MAAM,YAAY,CAAC,KAAK,SAAS,OAAO,IAAI,OAAO,CAAC;IAExD,YAAY,EAAE,KAAK,CAAC;IACpB,YAAY,EAAE,CAAC,KAAK,EAAE,KAAK,KAAK,IAAI,CAAC;CACtC,CAAC,CAAC;AAEH,MAAM,MAAM,UAAU,CAAC,KAAK,SAAS,OAAO,IAAI,UAAU,GACxD,YAAY,CAAC,KAAK,CAAC,GACnB,OAAO,CAAC;IACN,WAAW,EAAE,QAAQ,CAAC,KAAK,CAAC,CAAC;IAC7B,IAAI,EAAE,KAAK,EAAE,CAAC;IACd,OAAO,EAAE,cAAc,CAAC,KAAK,CAAC,EAAE,CAAC;IACjC,cAAc,EAAE,CAAC,KAAK,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,KAAK,IAAI,CAAC;IACxD,gBAAgB,EAAE,eAAe,CAAC;IAElC,YAAY,EAAE,iBAAiB,CAAC;IAChC,mBAAmB,EAAE,iBAAiB,CAAC;IACvC,oBAAoB,EAAE,CAAC,YAAY,EAAE,iBAAiB,KAAK,IAAI,CAAC;IAEhE,qBAAqB,EAAE,CAAC,aAAa,EAAE,KAAK,EAAE,KAAK,IAAI,CAAC;IAExD,UAAU,EAAE,cAAc,CAAC;IAC3B,UAAU,EAAE,OAAO,CAAC;CACrB,CAAC,CAAC;AAEL,YAAY,EAAE,iBAAiB,EAAE,eAAe,EAAE,cAAc,EAAE,QAAQ,EAAE,CAAC;AAE7E,MAAM,MAAM,iBAAiB,CAAC,KAAK,IAAI,UAAU,GAC/C,YAAY,CAAC,KAAK,CAAC,GACnB,IAAI,CAAC,UAAU,CAAC,KAAK,CAAC,EAAE,aAAa,CAAC,GAAG;IACvC,KAAK,EAAE,KAAK,CAAC,KAAK,CAAC,CAAC;IACpB,MAAM,EAAE,OAAO,CAAC;CACjB,CAAC"}
|
|
1
|
+
{"version":3,"file":"props.d.ts","sourceRoot":"","sources":["../../../../../src/components/Table/props.ts"],"names":[],"mappings":"AAIA,OAAO,EAAE,KAAK,OAAO,EAAE,KAAK,iBAAiB,EAAE,KAAK,KAAK,EAAE,KAAK,eAAe,EAAE,MAAM,uBAAuB,CAAC;AAE/G,OAAO,EAAE,KAAK,cAAc,EAAE,MAAM,sBAAsB,CAAC;AAE3D,OAAO,EAAE,KAAK,aAAa,EAAE,MAAM,aAAa,CAAC;AACjD,OAAO,EAAE,KAAK,QAAQ,EAAE,KAAK,cAAc,EAAE,MAAM,aAAa,CAAC;AAEjE,MAAM,MAAM,UAAU,GAAG,OAAO,CAAC;IAC/B,IAAI,EAAE,OAAO,GAAG,MAAM,GAAG,UAAU,CAAC;IACpC,QAAQ,EAAE,MAAM,EAAE,CAAC;IACnB,MAAM,EAAE,OAAO,CAAC;IAChB,MAAM,EAAE,OAAO,CAAC;IAChB,MAAM,EAAE,OAAO,CAAC;IAChB,SAAS,EAAE,OAAO,CAAC;IACnB,KAAK,EAAE,OAAO,CAAC;IACf,MAAM,EAAE,OAAO,CAAC;IAChB,YAAY,EAAE,OAAO,CAAC;IACtB,cAAc,EAAE,OAAO,GAAG,OAAO,CAAC;CACnC,CAAC,CAAC;AAEH;;GAEG;AACH,MAAM,MAAM,YAAY,CAAC,KAAK,SAAS,OAAO,IAAI,OAAO,CAAC;IAExD,YAAY,EAAE,KAAK,CAAC;IACpB,YAAY,EAAE,CAAC,KAAK,EAAE,KAAK,KAAK,IAAI,CAAC;CACtC,CAAC,CAAC;AAEH,MAAM,MAAM,UAAU,CAAC,KAAK,SAAS,OAAO,IAAI,UAAU,GACxD,YAAY,CAAC,KAAK,CAAC,GACnB,OAAO,CAAC;IACN,WAAW,EAAE,QAAQ,CAAC,KAAK,CAAC,CAAC;IAC7B,IAAI,EAAE,KAAK,EAAE,CAAC;IACd,OAAO,EAAE,cAAc,CAAC,KAAK,CAAC,EAAE,CAAC;IACjC,cAAc,EAAE,CAAC,KAAK,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,KAAK,IAAI,CAAC;IACxD,gBAAgB,EAAE,eAAe,CAAC;IAElC,YAAY,EAAE,iBAAiB,CAAC;IAChC,mBAAmB,EAAE,iBAAiB,CAAC;IACvC,oBAAoB,EAAE,CAAC,YAAY,EAAE,iBAAiB,KAAK,IAAI,CAAC;IAEhE,qBAAqB,EAAE,CAAC,aAAa,EAAE,KAAK,EAAE,KAAK,IAAI,CAAC;IAExD,UAAU,EAAE,cAAc,CAAC;IAC3B,UAAU,EAAE,OAAO,CAAC;CACrB,CAAC,CAAC;AAEL,YAAY,EAAE,iBAAiB,EAAE,eAAe,EAAE,cAAc,EAAE,QAAQ,EAAE,CAAC;AAE7E,MAAM,MAAM,iBAAiB,CAAC,KAAK,IAAI,UAAU,GAC/C,YAAY,CAAC,KAAK,CAAC,GACnB,IAAI,CAAC,UAAU,CAAC,KAAK,CAAC,EAAE,aAAa,CAAC,GAAG;IACvC,KAAK,EAAE,KAAK,CAAC,KAAK,CAAC,CAAC;IACpB,MAAM,EAAE,OAAO,CAAC;CACjB,GAAG,aAAa,CAAC"}
|
|
@@ -1,7 +1,13 @@
|
|
|
1
|
-
import { type SortDirection, type Column } from '@tanstack/react-table';
|
|
2
|
-
export declare const useColumnSorting: (
|
|
1
|
+
import { type SortDirection, type Column, type ColumnSort } from '@tanstack/react-table';
|
|
2
|
+
export declare const useColumnSorting: () => {
|
|
3
|
+
sorting: ColumnSort[];
|
|
4
|
+
sortColumn: (columnId: string, sortDirection: SortDirection) => void;
|
|
5
|
+
clearColumnSorting: () => void;
|
|
6
|
+
};
|
|
7
|
+
export type ColumnSorting = ReturnType<typeof useColumnSorting>;
|
|
8
|
+
export declare const useSortColumn: (column: Column<any>) => {
|
|
3
9
|
canSort: boolean;
|
|
4
|
-
sortDirection:
|
|
10
|
+
sortDirection: "asc" | "desc" | undefined;
|
|
5
11
|
onSelectSort: (direction: SortDirection) => void;
|
|
6
12
|
onToggleSort: () => void;
|
|
7
13
|
onClearSort: () => void;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"useColumnSorting.d.ts","sourceRoot":"","sources":["../../../../src/hooks/useColumnSorting.ts"],"names":[],"mappings":"AAIA,OAAO,EAAE,KAAK,aAAa,EAAE,KAAK,MAAM,EAAE,MAAM,uBAAuB,CAAC;
|
|
1
|
+
{"version":3,"file":"useColumnSorting.d.ts","sourceRoot":"","sources":["../../../../src/hooks/useColumnSorting.ts"],"names":[],"mappings":"AAIA,OAAO,EAAE,KAAK,aAAa,EAAE,KAAK,MAAM,EAAE,KAAK,UAAU,EAAE,MAAM,uBAAuB,CAAC;AAKzF,eAAO,MAAM,gBAAgB;;2BAGG,MAAM,iBAAiB,aAAa;;CASnE,CAAC;AAEF,MAAM,MAAM,aAAa,GAAG,UAAU,CAAC,OAAO,gBAAgB,CAAC,CAAC;AAEhE,eAAO,MAAM,aAAa,WAAY,OAAO,GAAG,CAAC;;;8BA2Bd,aAAa;;;CAW/C,CAAC"}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@dxos/react-ui-table",
|
|
3
|
-
"version": "0.5.1-next.
|
|
3
|
+
"version": "0.5.1-next.5e6b3f6",
|
|
4
4
|
"description": "A table component.",
|
|
5
5
|
"homepage": "https://dxos.org",
|
|
6
6
|
"bugs": "https://github.com/dxos/dxos/issues",
|
|
@@ -26,15 +26,15 @@
|
|
|
26
26
|
"@tanstack/react-virtual": "^3.0.1",
|
|
27
27
|
"date-fns": "^3.3.1",
|
|
28
28
|
"effect": "2.4.9",
|
|
29
|
-
"@dxos/
|
|
30
|
-
"@dxos/
|
|
31
|
-
"@dxos/
|
|
32
|
-
"@dxos/log": "0.5.1-next.
|
|
33
|
-
"@dxos/react-ui
|
|
34
|
-
"@dxos/react-ui-
|
|
35
|
-
"@dxos/react-ui-types": "0.5.1-next.
|
|
36
|
-
"@dxos/util": "0.5.1-next.
|
|
37
|
-
"@dxos/react-ui": "0.5.1-next.
|
|
29
|
+
"@dxos/invariant": "0.5.1-next.5e6b3f6",
|
|
30
|
+
"@dxos/keys": "0.5.1-next.5e6b3f6",
|
|
31
|
+
"@dxos/async": "0.5.1-next.5e6b3f6",
|
|
32
|
+
"@dxos/log": "0.5.1-next.5e6b3f6",
|
|
33
|
+
"@dxos/react-ui": "0.5.1-next.5e6b3f6",
|
|
34
|
+
"@dxos/react-ui-searchlist": "0.5.1-next.5e6b3f6",
|
|
35
|
+
"@dxos/react-ui-types": "0.5.1-next.5e6b3f6",
|
|
36
|
+
"@dxos/util": "0.5.1-next.5e6b3f6",
|
|
37
|
+
"@dxos/react-ui-theme": "0.5.1-next.5e6b3f6"
|
|
38
38
|
},
|
|
39
39
|
"devDependencies": {
|
|
40
40
|
"@phosphor-icons/react": "^2.1.5",
|
|
@@ -45,11 +45,11 @@
|
|
|
45
45
|
"react-dom": "^18.2.0",
|
|
46
46
|
"vite": "^5.2.9",
|
|
47
47
|
"vite-plugin-turbosnap": "^1.0.2",
|
|
48
|
-
"@dxos/echo-schema": "0.5.1-next.
|
|
49
|
-
"@dxos/
|
|
50
|
-
"@dxos/react-ui-theme": "0.5.1-next.
|
|
51
|
-
"@dxos/
|
|
52
|
-
"@dxos/
|
|
48
|
+
"@dxos/echo-schema": "0.5.1-next.5e6b3f6",
|
|
49
|
+
"@dxos/echo-signals": "0.5.1-next.5e6b3f6",
|
|
50
|
+
"@dxos/react-ui-theme": "0.5.1-next.5e6b3f6",
|
|
51
|
+
"@dxos/random": "0.5.1-next.5e6b3f6",
|
|
52
|
+
"@dxos/storybook-utils": "0.5.1-next.5e6b3f6"
|
|
53
53
|
},
|
|
54
54
|
"peerDependencies": {
|
|
55
55
|
"@phosphor-icons/react": "^2.0.5",
|
|
@@ -10,7 +10,7 @@ import { Button, DensityProvider, Popover, DropdownMenu } from '@dxos/react-ui';
|
|
|
10
10
|
import { getSize, mx } from '@dxos/react-ui-theme';
|
|
11
11
|
|
|
12
12
|
import { ColumnSettingsForm } from './ColumnSettingsForm';
|
|
13
|
-
import {
|
|
13
|
+
import { useSortColumn } from '../../hooks';
|
|
14
14
|
import { type TableDef, type ColumnProps } from '../../schema';
|
|
15
15
|
|
|
16
16
|
export type ColumnMenuProps<TData extends RowData, TValue> = {
|
|
@@ -26,7 +26,7 @@ export const ColumnMenu = <TData extends RowData, TValue>({ column, ...props }:
|
|
|
26
26
|
const title = column.label?.length ? column.label : column.id;
|
|
27
27
|
const header = props.context.header;
|
|
28
28
|
|
|
29
|
-
const { canSort, sortDirection, onSelectSort, onToggleSort, onClearSort } =
|
|
29
|
+
const { canSort, sortDirection, onSelectSort, onToggleSort, onClearSort } = useSortColumn(header.column);
|
|
30
30
|
|
|
31
31
|
const columnSettingsAnchorRef = useRef<any>(null);
|
|
32
32
|
|
|
@@ -83,7 +83,7 @@ export const ColumnMenu = <TData extends RowData, TValue>({ column, ...props }:
|
|
|
83
83
|
<ArrowDown className={getSize(4)} />
|
|
84
84
|
</span>
|
|
85
85
|
</DropdownMenu.Item>
|
|
86
|
-
{sortDirection
|
|
86
|
+
{sortDirection && (
|
|
87
87
|
<DropdownMenu.Item onClick={onClearSort}>
|
|
88
88
|
<span className='grow'>Clear sort</span>
|
|
89
89
|
<span className='opacity-50'>
|
|
@@ -104,48 +104,30 @@ export const ColumnMenu = <TData extends RowData, TValue>({ column, ...props }:
|
|
|
104
104
|
</DropdownMenu.Content>
|
|
105
105
|
</DropdownMenu.Portal>
|
|
106
106
|
|
|
107
|
-
<
|
|
107
|
+
<Popover.Portal>
|
|
108
|
+
<Popover.Content>
|
|
109
|
+
<Popover.Viewport classNames='w-60'>
|
|
110
|
+
<DensityProvider density='fine'>
|
|
111
|
+
<ColumnSettingsForm {...props} column={column} onClose={() => setIsColumnSettingsOpen(false)} />
|
|
112
|
+
</DensityProvider>
|
|
113
|
+
</Popover.Viewport>
|
|
114
|
+
<Popover.Arrow />
|
|
115
|
+
</Popover.Content>
|
|
116
|
+
</Popover.Portal>
|
|
108
117
|
</Popover.Root>
|
|
109
118
|
</DropdownMenu.Root>
|
|
110
119
|
</div>
|
|
111
120
|
);
|
|
112
121
|
};
|
|
113
122
|
|
|
114
|
-
export const ColumnSettingsPanel = <TData extends RowData, TValue>({
|
|
115
|
-
tableDefs,
|
|
116
|
-
tableDef,
|
|
117
|
-
column,
|
|
118
|
-
onUpdate,
|
|
119
|
-
onDelete,
|
|
120
|
-
onClose,
|
|
121
|
-
}: ColumnMenuProps<TData, TValue> & { onClose: () => void }) => (
|
|
122
|
-
<Popover.Portal>
|
|
123
|
-
<Popover.Content>
|
|
124
|
-
<Popover.Viewport classNames='w-60'>
|
|
125
|
-
<DensityProvider density='fine'>
|
|
126
|
-
<ColumnSettingsForm
|
|
127
|
-
column={column}
|
|
128
|
-
tableDefs={tableDefs}
|
|
129
|
-
tableDef={tableDef}
|
|
130
|
-
onUpdate={onUpdate}
|
|
131
|
-
onDelete={onDelete}
|
|
132
|
-
onClose={onClose}
|
|
133
|
-
/>
|
|
134
|
-
</DensityProvider>
|
|
135
|
-
</Popover.Viewport>
|
|
136
|
-
<Popover.Arrow />
|
|
137
|
-
</Popover.Content>
|
|
138
|
-
</Popover.Portal>
|
|
139
|
-
);
|
|
140
|
-
|
|
141
123
|
export const SortIndicator = ({
|
|
142
124
|
direction,
|
|
143
125
|
onClick,
|
|
144
126
|
}: {
|
|
145
|
-
direction: SortDirection |
|
|
127
|
+
direction: SortDirection | undefined;
|
|
146
128
|
onClick: (e: any) => void;
|
|
147
129
|
}) => {
|
|
148
|
-
if (direction ===
|
|
130
|
+
if (direction === undefined) {
|
|
149
131
|
return null;
|
|
150
132
|
}
|
|
151
133
|
|
|
@@ -82,6 +82,11 @@ export const ColumnSettingsForm = ({
|
|
|
82
82
|
onClose?.();
|
|
83
83
|
};
|
|
84
84
|
|
|
85
|
+
const handleDelete = () => {
|
|
86
|
+
onDelete?.(column.id);
|
|
87
|
+
onClose?.();
|
|
88
|
+
};
|
|
89
|
+
|
|
85
90
|
return (
|
|
86
91
|
<div className='flex flex-col gap-1'>
|
|
87
92
|
<Section>
|
|
@@ -203,7 +208,7 @@ export const ColumnSettingsForm = ({
|
|
|
203
208
|
<div className='grow' />
|
|
204
209
|
<X className={getSize(5)} />
|
|
205
210
|
</Button>
|
|
206
|
-
<Button classNames='is-full flex gap-2' onClick={
|
|
211
|
+
<Button classNames='is-full flex gap-2' onClick={handleDelete}>
|
|
207
212
|
<span>{t('delete label')}</span>
|
|
208
213
|
<div className='grow' />
|
|
209
214
|
<Trash className={getSize(5)} />
|
|
@@ -24,7 +24,7 @@ import { TableFooter } from './TableFooter';
|
|
|
24
24
|
import { TableHead } from './TableHead';
|
|
25
25
|
import { TableRootContext, useTableRootContext } from './TableRootContext';
|
|
26
26
|
import { type TableProps } from './props';
|
|
27
|
-
import { useColumnResizing, usePinLastRow, useRowSelection } from '../../hooks';
|
|
27
|
+
import { useColumnResizing, useColumnSorting, usePinLastRow, useRowSelection } from '../../hooks';
|
|
28
28
|
import { groupTh, tableRoot } from '../../theme';
|
|
29
29
|
|
|
30
30
|
type TableRootProps = { children: React.ReactNode };
|
|
@@ -87,6 +87,8 @@ export const TablePrimitive = <TData extends RowData>(props: TableProps<TData>)
|
|
|
87
87
|
const [grouping, handleGroupingChange] = useState<GroupingState>(props.grouping ?? []);
|
|
88
88
|
useEffect(() => handleGroupingChange(props.grouping ?? []), [handleGroupingChange, props.grouping]);
|
|
89
89
|
|
|
90
|
+
const columnSorting = useColumnSorting();
|
|
91
|
+
|
|
90
92
|
const table = useReactTable({
|
|
91
93
|
// Data
|
|
92
94
|
meta: {},
|
|
@@ -104,6 +106,7 @@ export const TablePrimitive = <TData extends RowData>(props: TableProps<TData>)
|
|
|
104
106
|
columnVisibility,
|
|
105
107
|
columnSizing,
|
|
106
108
|
columnSizingInfo,
|
|
109
|
+
sorting: columnSorting.sorting,
|
|
107
110
|
rowSelection,
|
|
108
111
|
grouping,
|
|
109
112
|
},
|
|
@@ -146,7 +149,7 @@ export const TablePrimitive = <TData extends RowData>(props: TableProps<TData>)
|
|
|
146
149
|
|
|
147
150
|
return (
|
|
148
151
|
<TableProvider
|
|
149
|
-
{...props}
|
|
152
|
+
{...{ ...props, ...columnSorting }}
|
|
150
153
|
table={table}
|
|
151
154
|
header={header}
|
|
152
155
|
expand={expand}
|
|
@@ -6,6 +6,7 @@ import { type RowData, type RowSelectionState, type Table, type VisibilityState
|
|
|
6
6
|
|
|
7
7
|
import { type ClassNameValue } from '@dxos/react-ui-types';
|
|
8
8
|
|
|
9
|
+
import { type ColumnSorting } from '../../hooks';
|
|
9
10
|
import { type KeyValue, type TableColumnDef } from '../../types';
|
|
10
11
|
|
|
11
12
|
export type TableFlags = Partial<{
|
|
@@ -56,4 +57,4 @@ export type TableContextValue<TData> = TableFlags &
|
|
|
56
57
|
Pick<TableProps<TData>, 'keyAccessor'> & {
|
|
57
58
|
table: Table<TData>;
|
|
58
59
|
isGrid: boolean;
|
|
59
|
-
};
|
|
60
|
+
} & ColumnSorting;
|
|
@@ -2,52 +2,62 @@
|
|
|
2
2
|
// Copyright 2024 DXOS.org
|
|
3
3
|
//
|
|
4
4
|
|
|
5
|
-
import { type SortDirection, type Column } from '@tanstack/react-table';
|
|
5
|
+
import { type SortDirection, type Column, type ColumnSort } from '@tanstack/react-table';
|
|
6
6
|
import { useState } from 'react';
|
|
7
7
|
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
8
|
+
import { useTableContext } from '../components/Table/TableContext';
|
|
9
|
+
|
|
10
|
+
export const useColumnSorting = () => {
|
|
11
|
+
const [columnSorting, setColumnSorting] = useState<ColumnSort[]>([]);
|
|
12
|
+
|
|
13
|
+
const sortColumn = (columnId: string, sortDirection: SortDirection) => {
|
|
14
|
+
setColumnSorting([{ id: columnId, desc: sortDirection === 'desc' }]);
|
|
15
|
+
};
|
|
16
|
+
|
|
17
|
+
const clearColumnSorting = () => {
|
|
18
|
+
setColumnSorting([]);
|
|
19
|
+
};
|
|
20
|
+
|
|
21
|
+
return { sorting: columnSorting, sortColumn, clearColumnSorting };
|
|
22
|
+
};
|
|
23
|
+
|
|
24
|
+
export type ColumnSorting = ReturnType<typeof useColumnSorting>;
|
|
25
|
+
|
|
26
|
+
export const useSortColumn = (column: Column<any>) => {
|
|
27
|
+
const { sorting, sortColumn, clearColumnSorting } = useTableContext();
|
|
28
|
+
const [initialSortDirection, setInitialSortDirection] = useState<SortDirection | undefined>();
|
|
29
|
+
|
|
30
|
+
const columnSort = sorting.find((s) => s.id === column.id);
|
|
31
|
+
const sortDirection = columnSort ? (columnSort.desc ? ('desc' as const) : ('asc' as const)) : undefined;
|
|
11
32
|
|
|
12
33
|
const canSort = column.getCanSort();
|
|
13
34
|
|
|
14
|
-
const updateColumnSort = (direction: SortDirection
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
switch (direction) {
|
|
18
|
-
case false:
|
|
19
|
-
column.clearSorting();
|
|
20
|
-
break;
|
|
21
|
-
case 'asc':
|
|
22
|
-
column.toggleSorting(false); // descending false
|
|
23
|
-
break;
|
|
24
|
-
case 'desc':
|
|
25
|
-
column.toggleSorting(true); // descending true
|
|
26
|
-
break;
|
|
27
|
-
}
|
|
35
|
+
const updateColumnSort = (direction: SortDirection) => {
|
|
36
|
+
sortColumn(column.id, direction);
|
|
28
37
|
};
|
|
29
38
|
|
|
30
39
|
// Whichever sort is explicitly set first, will be the first sort direction
|
|
31
40
|
// When toggling, we always go to the other direction, and then to unsorted.
|
|
32
41
|
const onToggleSort = () => {
|
|
33
|
-
if (sortDirection ===
|
|
42
|
+
if (sortDirection === undefined) {
|
|
34
43
|
return;
|
|
35
44
|
}
|
|
36
45
|
|
|
37
|
-
if (sortDirection ===
|
|
38
|
-
updateColumnSort(
|
|
46
|
+
if (sortDirection === initialSortDirection) {
|
|
47
|
+
updateColumnSort(initialSortDirection === 'asc' ? 'desc' : 'asc');
|
|
39
48
|
} else {
|
|
40
|
-
|
|
49
|
+
clearColumnSorting();
|
|
41
50
|
}
|
|
42
51
|
};
|
|
43
52
|
|
|
44
53
|
const onSelectSort = (direction: SortDirection) => {
|
|
45
|
-
|
|
54
|
+
clearColumnSorting();
|
|
55
|
+
setInitialSortDirection(direction);
|
|
46
56
|
updateColumnSort(direction);
|
|
47
57
|
};
|
|
48
58
|
|
|
49
59
|
const onClearSort = () => {
|
|
50
|
-
|
|
60
|
+
clearColumnSorting();
|
|
51
61
|
};
|
|
52
62
|
|
|
53
63
|
return { canSort, sortDirection, onSelectSort, onToggleSort, onClearSort };
|