@dxos/react-ui-table 0.4.8-main.c67d72c → 0.4.8-main.cd60bd2
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 +275 -191
- package/dist/lib/browser/index.mjs.map +4 -4
- package/dist/lib/browser/meta.json +1 -1
- package/dist/types/src/components/Cell/Cell.d.ts.map +1 -1
- package/dist/types/src/components/ColumnMenu.d.ts.map +1 -1
- package/dist/types/src/components/ColumnMenu.stories.d.ts +10 -1
- package/dist/types/src/components/ColumnMenu.stories.d.ts.map +1 -1
- package/dist/types/src/components/SortButton.d.ts +8 -0
- package/dist/types/src/components/SortButton.d.ts.map +1 -0
- package/dist/types/src/components/Table/Table.d.ts +2 -0
- package/dist/types/src/components/Table/Table.d.ts.map +1 -1
- package/dist/types/src/components/Table/Table.stories.d.ts.map +1 -1
- package/dist/types/src/components/Table/TableBody.d.ts.map +1 -1
- package/dist/types/src/components/Table/TableHead.d.ts.map +1 -1
- package/dist/types/src/components/Table/props.d.ts +1 -0
- package/dist/types/src/components/Table/props.d.ts.map +1 -1
- package/dist/types/src/helpers.d.ts.map +1 -1
- package/dist/types/src/theme.d.ts +1 -1
- package/dist/types/src/theme.d.ts.map +1 -1
- package/package.json +15 -15
- package/src/components/Cell/Cell.tsx +4 -1
- package/src/components/ColumnMenu.stories.tsx +13 -6
- package/src/components/ColumnMenu.tsx +13 -4
- package/src/components/SortButton.tsx +34 -0
- package/src/components/Table/Table.stories.tsx +51 -62
- package/src/components/Table/Table.tsx +65 -41
- package/src/components/Table/TableBody.tsx +1 -0
- package/src/components/Table/TableHead.tsx +4 -2
- package/src/components/Table/props.ts +1 -0
- package/src/helpers.tsx +61 -45
- package/src/theme.ts +3 -1
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Cell.d.ts","sourceRoot":"","sources":["../../../../../src/components/Cell/Cell.tsx"],"names":[],"mappings":"AAKA,OAAO,EAAE,KAAK,IAAI,IAAI,QAAQ,EAAE,KAAK,OAAO,EAAE,MAAM,uBAAuB,CAAC;AAC5E,OAAc,EAAE,KAAK,iBAAiB,EAAE,MAAM,OAAO,CAAC;AAKtD,KAAK,SAAS,CAAC,KAAK,SAAS,OAAO,EAAE,MAAM,IAAI,iBAAiB,CAAC;IAChE,IAAI,EAAE,QAAQ,CAAC,KAAK,EAAE,MAAM,CAAC,CAAC;CAC/B,CAAC,CAAC;
|
|
1
|
+
{"version":3,"file":"Cell.d.ts","sourceRoot":"","sources":["../../../../../src/components/Cell/Cell.tsx"],"names":[],"mappings":"AAKA,OAAO,EAAE,KAAK,IAAI,IAAI,QAAQ,EAAE,KAAK,OAAO,EAAE,MAAM,uBAAuB,CAAC;AAC5E,OAAc,EAAE,KAAK,iBAAiB,EAAE,MAAM,OAAO,CAAC;AAKtD,KAAK,SAAS,CAAC,KAAK,SAAS,OAAO,EAAE,MAAM,IAAI,iBAAiB,CAAC;IAChE,IAAI,EAAE,QAAQ,CAAC,KAAK,EAAE,MAAM,CAAC,CAAC;CAC/B,CAAC,CAAC;AAsBH,QAAA,MAAM,IAAI;;;CAIT,CAAC;AAIF,OAAO,EAAE,IAAI,EAAE,CAAC;AAEhB,YAAY,EAAE,SAAS,EAAE,CAAC"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"ColumnMenu.d.ts","sourceRoot":"","sources":["../../../../src/components/ColumnMenu.tsx"],"names":[],"mappings":"AAKA,OAAO,EAAE,KAAK,aAAa,EAAE,KAAK,OAAO,EAAE,MAAM,uBAAuB,CAAC;
|
|
1
|
+
{"version":3,"file":"ColumnMenu.d.ts","sourceRoot":"","sources":["../../../../src/components/ColumnMenu.tsx"],"names":[],"mappings":"AAKA,OAAO,EAAE,KAAK,aAAa,EAAE,KAAK,OAAO,EAAE,MAAM,uBAAuB,CAAC;AAQzE,OAAO,EAAE,KAAK,QAAQ,EAAE,KAAK,WAAW,EAAmB,MAAM,WAAW,CAAC;AAG7E,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,sGAoBtB,CAAC;AAQF,eAAO,MAAM,WAAW,+IAkMvB,CAAC"}
|
|
@@ -2,13 +2,22 @@ import '@dxosTheme';
|
|
|
2
2
|
import { type ColumnProps } from '../schema';
|
|
3
3
|
declare const _default: {
|
|
4
4
|
title: string;
|
|
5
|
-
component: <TData extends unknown, TValue>({
|
|
5
|
+
component: <TData extends unknown, TValue>({ column, ...props }: import("./ColumnMenu").ColumnMenuProps<TData, TValue>) => JSX.Element;
|
|
6
6
|
decorators: import("@storybook/react").Decorator[];
|
|
7
7
|
};
|
|
8
8
|
export default _default;
|
|
9
9
|
export declare const Default: {
|
|
10
10
|
args: {
|
|
11
11
|
column: ColumnProps;
|
|
12
|
+
context: {
|
|
13
|
+
header: {
|
|
14
|
+
column: {
|
|
15
|
+
getCanSort: () => boolean;
|
|
16
|
+
getToggleSortingHandler: () => () => void;
|
|
17
|
+
getIsSorted: () => boolean;
|
|
18
|
+
};
|
|
19
|
+
};
|
|
20
|
+
};
|
|
12
21
|
};
|
|
13
22
|
decorators: ((Story: any) => JSX.Element)[];
|
|
14
23
|
parameters: {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"ColumnMenu.stories.d.ts","sourceRoot":"","sources":["../../../../src/components/ColumnMenu.stories.tsx"],"names":[],"mappings":"AAIA,OAAO,YAAY,CAAC;AAOpB,OAAO,EAAE,KAAK,WAAW,EAAE,MAAM,WAAW,CAAC;;;;;;AAE7C,wBAIE;AAEF,eAAO,MAAM,OAAO
|
|
1
|
+
{"version":3,"file":"ColumnMenu.stories.d.ts","sourceRoot":"","sources":["../../../../src/components/ColumnMenu.stories.tsx"],"names":[],"mappings":"AAIA,OAAO,YAAY,CAAC;AAOpB,OAAO,EAAE,KAAK,WAAW,EAAE,MAAM,WAAW,CAAC;;;;;;AAE7C,wBAIE;AAEF,eAAO,MAAM,OAAO;;;;;;;;;;;;;yBAiBR,GAAG;;;;CASd,CAAC"}
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
import { type SortDirection } from '@tanstack/react-table';
|
|
2
|
+
type SortButtonProps = {
|
|
3
|
+
sortDirection: false | SortDirection;
|
|
4
|
+
onClick: (e: any) => void;
|
|
5
|
+
};
|
|
6
|
+
export declare const SortButton: ({ sortDirection, onClick }: SortButtonProps) => JSX.Element;
|
|
7
|
+
export {};
|
|
8
|
+
//# sourceMappingURL=SortButton.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"SortButton.d.ts","sourceRoot":"","sources":["../../../../src/components/SortButton.tsx"],"names":[],"mappings":"AAKA,OAAO,EAAE,KAAK,aAAa,EAAE,MAAM,uBAAuB,CAAC;AAM3D,KAAK,eAAe,GAAG;IAAE,aAAa,EAAE,KAAK,GAAG,aAAa,CAAC;IAAC,OAAO,EAAE,CAAC,CAAC,EAAE,GAAG,KAAK,IAAI,CAAA;CAAE,CAAC;AAE3F,eAAO,MAAM,UAAU,+BAAgC,eAAe,gBAoBrE,CAAC"}
|
|
@@ -1,3 +1,5 @@
|
|
|
1
|
+
import { type VirtualizerOptions } from '@tanstack/react-virtual';
|
|
1
2
|
import { type TableProps } from './props';
|
|
2
3
|
export declare const Table: <TData extends unknown>(props: TableProps<TData>) => JSX.Element;
|
|
4
|
+
export declare const MemoizedVirtualisedTableContent: ({ getScrollElement, }: Pick<VirtualizerOptions<Element, Element>, 'getScrollElement'>) => JSX.Element;
|
|
3
5
|
//# sourceMappingURL=Table.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Table.d.ts","sourceRoot":"","sources":["../../../../../src/components/Table/Table.tsx"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"Table.d.ts","sourceRoot":"","sources":["../../../../../src/components/Table/Table.tsx"],"names":[],"mappings":"AAiBA,OAAO,EAAkB,KAAK,kBAAkB,EAAE,MAAM,yBAAyB,CAAC;AAUlF,OAAO,EAAE,KAAK,UAAU,EAAE,MAAM,SAAS,CAAC;AAG1C,eAAO,MAAM,KAAK,kEAuJjB,CAAC;AA+FF,eAAO,MAAM,+BAA+B,0BA1CzC,KAAK,mBAAmB,OAAO,EAAE,OAAO,CAAC,EAAE,kBAAkB,CAAC,gBA0CmD,CAAC"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Table.stories.d.ts","sourceRoot":"","sources":["../../../../../src/components/Table/Table.stories.tsx"],"names":[],"mappings":"AAIA,OAAO,YAAY,CAAC;AAMpB,OAAO,EAAE,SAAS,EAAE,MAAM,YAAY,CAAC;AAQvC,OAAO,EAAE,KAAK,cAAc,EAAE,MAAM,aAAa,CAAC;AAKlD,KAAK,IAAI,GAAG;IACV,SAAS,EAAE,SAAS,CAAC;IACrB,IAAI,EAAE,MAAM,CAAC;IACb,OAAO,CAAC,EAAE,MAAM,CAAC;IACjB,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,OAAO,CAAC,EAAE,IAAI,CAAC;IACf,QAAQ,CAAC,EAAE,OAAO,CAAC;CACpB,CAAC;;;;;;
|
|
1
|
+
{"version":3,"file":"Table.stories.d.ts","sourceRoot":"","sources":["../../../../../src/components/Table/Table.stories.tsx"],"names":[],"mappings":"AAIA,OAAO,YAAY,CAAC;AAMpB,OAAO,EAAE,SAAS,EAAE,MAAM,YAAY,CAAC;AAQvC,OAAO,EAAE,KAAK,cAAc,EAAE,MAAM,aAAa,CAAC;AAKlD,KAAK,IAAI,GAAG;IACV,SAAS,EAAE,SAAS,CAAC;IACrB,IAAI,EAAE,MAAM,CAAC;IACb,OAAO,CAAC,EAAE,MAAM,CAAC;IACjB,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,OAAO,CAAC,EAAE,IAAI,CAAC;IACf,QAAQ,CAAC,EAAE,OAAO,CAAC;CACpB,CAAC;;;;;;4BA4FsB,IAAI;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAL5B,wBAuCE;AAEF,eAAO,MAAM,OAAO;;;;;CAKnB,CAAC;AAEF,eAAO,MAAM,SAAS;;;;;CAKrB,CAAC;AAEF,eAAO,MAAM,UAAU;;;;;;;;;CAMtB,CAAC;AAEF,eAAO,MAAM,KAAK;;;;CAIjB,CAAC;AAEF,eAAO,MAAM,OAAO;;CAmCnB,CAAC;AAEF,eAAO,MAAM,QAAQ;;CA4BpB,CAAC;AAEF,eAAO,MAAM,SAAS;;CAyBrB,CAAC;AAEF,eAAO,MAAM,eAAe;;CA4B3B,CAAC"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"TableBody.d.ts","sourceRoot":"","sources":["../../../../../src/components/Table/TableBody.tsx"],"names":[],"mappings":"AAKA,OAAO,EAAc,KAAK,GAAG,EAAE,KAAK,OAAO,EAAE,MAAM,uBAAuB,CAAC;AAS3E,KAAK,cAAc,CAAC,KAAK,SAAS,OAAO,IAAI;IAC3C,IAAI,EAAE,GAAG,CAAC,KAAK,CAAC,EAAE,CAAC;CACpB,CAAC;AAEF,QAAA,MAAM,SAAS;;;
|
|
1
|
+
{"version":3,"file":"TableBody.d.ts","sourceRoot":"","sources":["../../../../../src/components/Table/TableBody.tsx"],"names":[],"mappings":"AAKA,OAAO,EAAc,KAAK,GAAG,EAAE,KAAK,OAAO,EAAE,MAAM,uBAAuB,CAAC;AAS3E,KAAK,cAAc,CAAC,KAAK,SAAS,OAAO,IAAI;IAC3C,IAAI,EAAE,GAAG,CAAC,KAAK,CAAC,EAAE,CAAC;CACpB,CAAC;AAEF,QAAA,MAAM,SAAS;;;CA+Cd,CAAC;AAIF,OAAO,EAAE,SAAS,EAAE,CAAC;AAErB,YAAY,EAAE,cAAc,EAAE,CAAC"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"TableHead.d.ts","sourceRoot":"","sources":["../../../../../src/components/Table/TableHead.tsx"],"names":[],"mappings":"AAcA,KAAK,cAAc,GAAG,EAAE,CAAC;AAEzB,QAAA,MAAM,SAAS;oCAAmC,cAAc;;
|
|
1
|
+
{"version":3,"file":"TableHead.d.ts","sourceRoot":"","sources":["../../../../../src/components/Table/TableHead.tsx"],"names":[],"mappings":"AAcA,KAAK,cAAc,GAAG,EAAE,CAAC;AAEzB,QAAA,MAAM,SAAS;oCAAmC,cAAc;;CA4D/D,CAAC;AAIF,OAAO,EAAE,SAAS,EAAE,CAAC;AAErB,YAAY,EAAE,cAAc,EAAE,CAAC"}
|
|
@@ -32,6 +32,7 @@ export type TableProps<TData extends RowData, ScrollElement extends Element | Wi
|
|
|
32
32
|
onRowSelectionChange: (rowSelection: RowSelectionState) => void;
|
|
33
33
|
onDataSelectionChange: (dataSelection: TData[]) => void;
|
|
34
34
|
classNames: ClassNameValue;
|
|
35
|
+
pinLastRow: boolean;
|
|
35
36
|
} & Pick<VirtualizerOptions<ScrollElement, ItemElement>, 'getScrollElement'>>;
|
|
36
37
|
export type { RowSelectionState, VisibilityState, TableColumnDef, KeyValue };
|
|
37
38
|
export type TableContextValue<TData extends RowData> = TableFlags & TableCurrent<TData> & Pick<TableProps<TData>, 'keyAccessor'> & {
|
|
@@ -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,eAA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AAS,CAAC,CAC/B,CAAC,CAAC,CAAC;IA0BJ;;OAEG;IACH,MAAM,CAAC,EAAE,KAAK,EAAE,UAAU,EAAE,QAAQ,EAAE,GAAG,KAAK,EAAE,GAAE,mBAAmB,CAAC,KAAK,CAAM,GAAG,OAAO,CACzF,SAAS,CAAC,KAAK,EAAE,OAAO,CAAC,CAC1B;IAaD;;OAEG;IACH,IAAI,CAAC,EAAE,KAAK,EAAE,IAAI,EAAE,EAAE,EAAE,GAAG,EAAE,GAAG,KAAK,EAAE,GAAE,iBAAiB,CAAC,KAAK,CAAM,GAAG,OAAO,CAAC,SAAS,CAAC,KAAK,EAAE,OAAO,CAAC,CAAC;CAqB5G"}
|
|
@@ -6,7 +6,7 @@ export declare const selectedRow = "!bg-primary-100 dark:!bg-primary-700";
|
|
|
6
6
|
export declare const flushPadding = "pli-0 plb-0";
|
|
7
7
|
export declare const textPadding = "pli-2 plb-0.5";
|
|
8
8
|
export declare const headPadding = "pli-2 plb-1.5";
|
|
9
|
-
export declare const gridCellFocusRing = "focus:z-[11] focus:outline outline-2 outline-primary-500 dark:outline-primary-400";
|
|
9
|
+
export declare const gridCellFocusRing = "focus-within:z-[11] focus-within:outline outline-2 outline-primary-500 dark:outline-primary-400";
|
|
10
10
|
export type TableStyleProps = Partial<TableContextValue<any>>;
|
|
11
11
|
export declare const tableRoot: ComponentFunction<TableStyleProps>;
|
|
12
12
|
export declare const groupTh: ComponentFunction<TableStyleProps>;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"theme.d.ts","sourceRoot":"","sources":["../../../src/theme.ts"],"names":[],"mappings":"AAIA,OAAO,EAAE,KAAK,WAAW,EAAE,MAAM,uBAAuB,CAAC;AAWzD,OAAO,EAAE,KAAK,iBAAiB,EAAE,MAAM,sBAAsB,CAAC;AAE9D,OAAO,EAAE,KAAK,iBAAiB,EAAE,KAAK,UAAU,EAAE,MAAM,cAAc,CAAC;AAEvE,eAAO,MAAM,UAAU,wCAAwC,CAA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O,MAAM,gBAAgB,EAAE,iBAAiB,CAAC,eAAe,CACQ,CAAC;AAMzE,MAAM,MAAM,eAAe,GAAG,OAAO,CAAC,iBAAiB,CAAC,GAAG,CAAC,CAAC,CAAC;AAC9D,eAAO,MAAM,SAAS,EAAE,iBAAiB,CAAC,eAAe,CAAkC,CAAC;AAE5F,MAAM,MAAM,iBAAiB,GAAG,OAAO,CAAC;IAAE,YAAY,CAAC,EAAE,OAAO,CAAA;CAAE,CAAC,CAAC;AACpE,eAAO,MAAM,OAAO,EAAE,iBAAiB,CAAC,iBAAiB,CAOtD,CAAC;AAMJ,eAAO,MAAM,MAAM,EAAE,iBAAiB,CAAC,eAAe,CACwD,CAAC;AAE/G,eAAO,MAAM,SAAS,EAAE,iBAAiB,CAAC,WAAW,CAAC,GAAG,EAAE,GAAG,CAAC,CAAkC,CAAC;AAMlG,MAAM,MAAM,eAAe,GAAG,OAAO,CAAC,iBAAiB,CAAC,GAAG,CAAC,CAAC,CAAC;AAE9D,eAAO,MAAM,SAAS,EAAE,iBAAiB,CAAC,eAAe,CACJ,CAAC;AAEtD,eAAO,MAAM,OAAO,EAAE,iBAAiB,CAAC,eAAe,CAAkC,CAAC;AAE1F,eAAO,MAAM,OAAO,EAAE,iBAAiB,CAAC,eAAe,CACO,CAAC"}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@dxos/react-ui-table",
|
|
3
|
-
"version": "0.4.8-main.
|
|
3
|
+
"version": "0.4.8-main.cd60bd2",
|
|
4
4
|
"description": "A table component.",
|
|
5
5
|
"homepage": "https://dxos.org",
|
|
6
6
|
"bugs": "https://github.com/dxos/dxos/issues",
|
|
@@ -19,18 +19,18 @@
|
|
|
19
19
|
"@fluentui/react-tabster": "^9.19.0",
|
|
20
20
|
"@radix-ui/react-context": "^1.0.0",
|
|
21
21
|
"@radix-ui/react-use-controllable-state": "^1.0.0",
|
|
22
|
-
"@tanstack/react-table": "^8.
|
|
22
|
+
"@tanstack/react-table": "^8.13.2",
|
|
23
23
|
"@tanstack/react-virtual": "^3.0.1",
|
|
24
24
|
"date-fns": "^3.3.1",
|
|
25
|
-
"@dxos/async": "0.4.8-main.
|
|
26
|
-
"@dxos/invariant": "0.4.8-main.
|
|
27
|
-
"@dxos/keys": "0.4.8-main.
|
|
28
|
-
"@dxos/react-ui": "0.4.8-main.
|
|
29
|
-
"@dxos/
|
|
30
|
-
"@dxos/
|
|
31
|
-
"@dxos/
|
|
32
|
-
"@dxos/react-ui-
|
|
33
|
-
"@dxos/
|
|
25
|
+
"@dxos/async": "0.4.8-main.cd60bd2",
|
|
26
|
+
"@dxos/invariant": "0.4.8-main.cd60bd2",
|
|
27
|
+
"@dxos/keys": "0.4.8-main.cd60bd2",
|
|
28
|
+
"@dxos/react-ui": "0.4.8-main.cd60bd2",
|
|
29
|
+
"@dxos/react-ui-types": "0.4.8-main.cd60bd2",
|
|
30
|
+
"@dxos/util": "0.4.8-main.cd60bd2",
|
|
31
|
+
"@dxos/log": "0.4.8-main.cd60bd2",
|
|
32
|
+
"@dxos/react-ui-searchlist": "0.4.8-main.cd60bd2",
|
|
33
|
+
"@dxos/react-ui-theme": "0.4.8-main.cd60bd2"
|
|
34
34
|
},
|
|
35
35
|
"devDependencies": {
|
|
36
36
|
"@phosphor-icons/react": "^2.0.5",
|
|
@@ -40,10 +40,10 @@
|
|
|
40
40
|
"react-dom": "^18.2.0",
|
|
41
41
|
"vite": "^5.1.5",
|
|
42
42
|
"vite-plugin-turbosnap": "^1.0.2",
|
|
43
|
-
"@dxos/
|
|
44
|
-
"@dxos/
|
|
45
|
-
"@dxos/react-ui-theme": "0.4.8-main.
|
|
46
|
-
"@dxos/
|
|
43
|
+
"@dxos/random": "0.4.8-main.cd60bd2",
|
|
44
|
+
"@dxos/echo-schema": "0.4.8-main.cd60bd2",
|
|
45
|
+
"@dxos/react-ui-theme": "0.4.8-main.cd60bd2",
|
|
46
|
+
"@dxos/storybook-utils": "0.4.8-main.cd60bd2"
|
|
47
47
|
},
|
|
48
48
|
"peerDependencies": {
|
|
49
49
|
"@phosphor-icons/react": "^2.0.5",
|
|
@@ -18,8 +18,11 @@ const CELL_NAME = 'Cell';
|
|
|
18
18
|
const FocusableCell = <TData extends RowData, TValue>({ cell, children }: CellProps<TData, TValue>) => {
|
|
19
19
|
const tableContext = useTableContext(CELL_NAME);
|
|
20
20
|
const domAttributes = useFocusableGroup({ tabBehavior: 'limited' });
|
|
21
|
+
|
|
22
|
+
const className = tdRoot(tableContext, cell.column.columnDef.meta?.cell?.classNames);
|
|
23
|
+
|
|
21
24
|
return (
|
|
22
|
-
<td tabIndex={0} {...domAttributes} className={
|
|
25
|
+
<td tabIndex={0} {...domAttributes} className={className}>
|
|
23
26
|
{children}
|
|
24
27
|
</td>
|
|
25
28
|
);
|
|
@@ -8,12 +8,12 @@ import React from 'react';
|
|
|
8
8
|
|
|
9
9
|
import { withTheme } from '@dxos/storybook-utils';
|
|
10
10
|
|
|
11
|
-
import {
|
|
11
|
+
import { ColumnMenu } from './ColumnMenu';
|
|
12
12
|
import { type ColumnProps } from '../schema';
|
|
13
13
|
|
|
14
14
|
export default {
|
|
15
|
-
title: 'react-ui-table/
|
|
16
|
-
component:
|
|
15
|
+
title: 'react-ui-table/ColumnMenu',
|
|
16
|
+
component: ColumnMenu,
|
|
17
17
|
decorators: [withTheme],
|
|
18
18
|
};
|
|
19
19
|
|
|
@@ -23,13 +23,20 @@ export const Default = {
|
|
|
23
23
|
id: 'test',
|
|
24
24
|
label: 'test',
|
|
25
25
|
} as ColumnProps,
|
|
26
|
+
context: {
|
|
27
|
+
header: {
|
|
28
|
+
column: {
|
|
29
|
+
getCanSort: () => true,
|
|
30
|
+
getToggleSortingHandler: () => () => console.log('toggleSort'),
|
|
31
|
+
getIsSorted: () => false,
|
|
32
|
+
},
|
|
33
|
+
},
|
|
34
|
+
},
|
|
26
35
|
},
|
|
27
36
|
decorators: [
|
|
28
37
|
(Story: any) => (
|
|
29
38
|
<div className='flex flex-col items-center h-screen w-full overflow-hidden'>
|
|
30
|
-
<
|
|
31
|
-
<Story />
|
|
32
|
-
</div>
|
|
39
|
+
<Story />
|
|
33
40
|
</div>
|
|
34
41
|
),
|
|
35
42
|
],
|
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
// Copyright 2023 DXOS.org
|
|
3
3
|
//
|
|
4
4
|
|
|
5
|
-
import { Check,
|
|
5
|
+
import { Check, Trash, X, GearSix } from '@phosphor-icons/react';
|
|
6
6
|
import { type HeaderContext, type RowData } from '@tanstack/react-table';
|
|
7
7
|
import React, { type FC, type PropsWithChildren, useRef, useState } from 'react';
|
|
8
8
|
|
|
@@ -10,6 +10,7 @@ import { Button, DensityProvider, Input, Popover, Select, Separator, useTranslat
|
|
|
10
10
|
import { getSize, mx } from '@dxos/react-ui-theme';
|
|
11
11
|
import { safeParseInt } from '@dxos/util';
|
|
12
12
|
|
|
13
|
+
import { SortButton } from './SortButton';
|
|
13
14
|
import { type TableDef, type ColumnProps, type ColumnType } from '../schema';
|
|
14
15
|
import { translationKey } from '../translations';
|
|
15
16
|
|
|
@@ -24,12 +25,20 @@ export type ColumnMenuProps<TData extends RowData, TValue> = {
|
|
|
24
25
|
|
|
25
26
|
export const ColumnMenu = <TData extends RowData, TValue>({ column, ...props }: ColumnMenuProps<TData, TValue>) => {
|
|
26
27
|
const title = column.label?.length ? column.label : column.id;
|
|
28
|
+
|
|
29
|
+
const header = props.context.header;
|
|
30
|
+
|
|
31
|
+
const canSort = header.column.getCanSort();
|
|
32
|
+
const sortDirection = header.column.getIsSorted();
|
|
33
|
+
const toggleSort = header.column.getToggleSortingHandler();
|
|
34
|
+
|
|
27
35
|
return (
|
|
28
36
|
<div className='flex items-center gap-2'>
|
|
29
37
|
<div className='flex-1 min-is-0 truncate' title={title}>
|
|
30
38
|
{title}
|
|
31
39
|
</div>
|
|
32
|
-
<div className='flex
|
|
40
|
+
<div className='flex gap-0'>
|
|
41
|
+
{canSort && toggleSort && <SortButton sortDirection={sortDirection} onClick={toggleSort} />}
|
|
33
42
|
<ColumnPanel {...props} column={column} />
|
|
34
43
|
</div>
|
|
35
44
|
</div>
|
|
@@ -99,8 +108,8 @@ export const ColumnPanel = <TData extends RowData, TValue>({
|
|
|
99
108
|
return (
|
|
100
109
|
<Popover.Root open={open} onOpenChange={(nextOpen) => setOpen(nextOpen)}>
|
|
101
110
|
<Popover.Trigger asChild>
|
|
102
|
-
<Button variant='ghost'
|
|
103
|
-
<
|
|
111
|
+
<Button variant='ghost'>
|
|
112
|
+
<GearSix className={mx(getSize(4), 'rotate-90')} />
|
|
104
113
|
</Button>
|
|
105
114
|
</Popover.Trigger>
|
|
106
115
|
<Popover.Portal>
|
|
@@ -0,0 +1,34 @@
|
|
|
1
|
+
//
|
|
2
|
+
// Copyright 2024 DXOS.org
|
|
3
|
+
//
|
|
4
|
+
|
|
5
|
+
import { CaretUpDown, SortAscending, SortDescending } from '@phosphor-icons/react';
|
|
6
|
+
import { type SortDirection } from '@tanstack/react-table';
|
|
7
|
+
import React, { type ReactElement } from 'react';
|
|
8
|
+
|
|
9
|
+
import { Button } from '@dxos/react-ui';
|
|
10
|
+
import { getSize } from '@dxos/react-ui-theme';
|
|
11
|
+
|
|
12
|
+
type SortButtonProps = { sortDirection: false | SortDirection; onClick: (e: any) => void };
|
|
13
|
+
|
|
14
|
+
export const SortButton = ({ sortDirection, onClick }: SortButtonProps) => {
|
|
15
|
+
let icon: ReactElement;
|
|
16
|
+
const size = getSize(4);
|
|
17
|
+
|
|
18
|
+
switch (sortDirection) {
|
|
19
|
+
case 'asc':
|
|
20
|
+
icon = <SortAscending className={size} />;
|
|
21
|
+
break;
|
|
22
|
+
case 'desc':
|
|
23
|
+
icon = <SortDescending className={size} />;
|
|
24
|
+
break;
|
|
25
|
+
default:
|
|
26
|
+
icon = <CaretUpDown className={size} />;
|
|
27
|
+
}
|
|
28
|
+
|
|
29
|
+
return (
|
|
30
|
+
<Button variant='ghost' onClick={onClick}>
|
|
31
|
+
{icon}
|
|
32
|
+
</Button>
|
|
33
|
+
);
|
|
34
|
+
};
|
|
@@ -5,12 +5,12 @@
|
|
|
5
5
|
import '@dxosTheme';
|
|
6
6
|
|
|
7
7
|
import { Plugs, PlugsConnected } from '@phosphor-icons/react';
|
|
8
|
-
import React, { useEffect, useRef, useState } from 'react';
|
|
8
|
+
import React, { useCallback, useEffect, useMemo, useRef, useState } from 'react';
|
|
9
9
|
|
|
10
10
|
import * as E from '@dxos/echo-schema/schema';
|
|
11
11
|
import { PublicKey } from '@dxos/keys';
|
|
12
12
|
import { faker } from '@dxos/random';
|
|
13
|
-
import {
|
|
13
|
+
import { AnchoredOverflow, DensityProvider } from '@dxos/react-ui';
|
|
14
14
|
import { withTheme } from '@dxos/storybook-utils';
|
|
15
15
|
import { range } from '@dxos/util';
|
|
16
16
|
|
|
@@ -72,7 +72,7 @@ const tableStorySelectModel: SearchListQueryModel<Item> = {
|
|
|
72
72
|
|
|
73
73
|
const { helper, builder } = createColumnBuilder<Item>();
|
|
74
74
|
|
|
75
|
-
const
|
|
75
|
+
const makeColumns = (onUpdate?: ValueUpdater<Item, any>): TableColumnDef<Item, any>[] => [
|
|
76
76
|
helper.display(builder.selectRow()),
|
|
77
77
|
helper.accessor((item) => item.publicKey, { id: 'key', ...builder.key({ tooltip: true }) }),
|
|
78
78
|
helper.accessor(
|
|
@@ -90,26 +90,14 @@ const columns = (onUpdate?: ValueUpdater<Item, any>): TableColumnDef<Item, any>[
|
|
|
90
90
|
builder.number({
|
|
91
91
|
label: 'Count',
|
|
92
92
|
meta: { resizable: true },
|
|
93
|
-
// TODO(burdon): Sorting.
|
|
94
|
-
getGroupingValue: (row) => (row.count ? (row.count < 2_000 ? 'A' : row.count < 5_000 ? 'B' : 'C') : 'D'),
|
|
95
|
-
}),
|
|
96
|
-
),
|
|
97
|
-
helper.accessor(
|
|
98
|
-
'company',
|
|
99
|
-
builder.combobox({
|
|
100
|
-
label: 'Company',
|
|
101
|
-
model: tableStorySelectModel,
|
|
102
93
|
onUpdate,
|
|
94
|
+
getGroupingValue: (row) => (row.count ? (row.count < 2000 ? 'A' : row.count < 5000 ? 'B' : 'C') : 'D'),
|
|
103
95
|
}),
|
|
104
96
|
),
|
|
97
|
+
helper.accessor('company', builder.combobox({ label: 'Company', model: tableStorySelectModel, onUpdate })),
|
|
105
98
|
helper.accessor(
|
|
106
99
|
'complete',
|
|
107
|
-
builder.switch({
|
|
108
|
-
// enableGrouping: true,
|
|
109
|
-
getGroupingValue: (row) => row.complete === true,
|
|
110
|
-
label: '',
|
|
111
|
-
onUpdate,
|
|
112
|
-
}),
|
|
100
|
+
builder.switch({ getGroupingValue: (row) => row.complete === true, label: '', onUpdate }),
|
|
113
101
|
),
|
|
114
102
|
helper.accessor('complete', builder.icon({ id: 'done', label: '' })),
|
|
115
103
|
helper.accessor(
|
|
@@ -135,18 +123,10 @@ export default {
|
|
|
135
123
|
keyAccessor: (item: Item) => item.publicKey.toHex(),
|
|
136
124
|
},
|
|
137
125
|
argTypes: {
|
|
138
|
-
header: {
|
|
139
|
-
|
|
140
|
-
},
|
|
141
|
-
|
|
142
|
-
control: 'boolean',
|
|
143
|
-
},
|
|
144
|
-
border: {
|
|
145
|
-
control: 'boolean',
|
|
146
|
-
},
|
|
147
|
-
fullWidth: {
|
|
148
|
-
control: 'boolean',
|
|
149
|
-
},
|
|
126
|
+
header: { control: 'boolean' },
|
|
127
|
+
footer: { control: 'boolean' },
|
|
128
|
+
border: { control: 'boolean' },
|
|
129
|
+
fullWidth: { control: 'boolean' },
|
|
150
130
|
grouping: {
|
|
151
131
|
control: 'select',
|
|
152
132
|
options: ['none', 'complete', 'count'],
|
|
@@ -164,10 +144,7 @@ export default {
|
|
|
164
144
|
limited: { key: false, started: false },
|
|
165
145
|
},
|
|
166
146
|
},
|
|
167
|
-
rowsSelectable: {
|
|
168
|
-
control: 'select',
|
|
169
|
-
options: [false, true, 'multi'],
|
|
170
|
-
},
|
|
147
|
+
rowsSelectable: { control: 'select', options: [false, true, 'multi'] },
|
|
171
148
|
},
|
|
172
149
|
decorators: [
|
|
173
150
|
withTheme,
|
|
@@ -181,21 +158,21 @@ export default {
|
|
|
181
158
|
|
|
182
159
|
export const Default = {
|
|
183
160
|
args: {
|
|
184
|
-
columns:
|
|
161
|
+
columns: makeColumns(),
|
|
185
162
|
data: createItems(20),
|
|
186
163
|
},
|
|
187
164
|
};
|
|
188
165
|
|
|
189
166
|
export const Scrolling = {
|
|
190
167
|
args: {
|
|
191
|
-
columns:
|
|
168
|
+
columns: makeColumns(),
|
|
192
169
|
data: createItems(200),
|
|
193
170
|
},
|
|
194
171
|
};
|
|
195
172
|
|
|
196
173
|
export const Visibility = {
|
|
197
174
|
args: {
|
|
198
|
-
columns:
|
|
175
|
+
columns: makeColumns(),
|
|
199
176
|
data: createItems(10),
|
|
200
177
|
columnVisibility: { key: false, started: false },
|
|
201
178
|
},
|
|
@@ -203,7 +180,7 @@ export const Visibility = {
|
|
|
203
180
|
|
|
204
181
|
export const Empty = {
|
|
205
182
|
args: {
|
|
206
|
-
columns:
|
|
183
|
+
columns: makeColumns(),
|
|
207
184
|
},
|
|
208
185
|
};
|
|
209
186
|
|
|
@@ -211,6 +188,7 @@ export const Dynamic = {
|
|
|
211
188
|
render: () => {
|
|
212
189
|
const containerRef = useRef<HTMLDivElement | null>(null);
|
|
213
190
|
const [items, setItems] = useState<Item[]>(createItems(50));
|
|
191
|
+
|
|
214
192
|
useEffect(() => {
|
|
215
193
|
const interval = setInterval(() => {
|
|
216
194
|
setItems((items) => {
|
|
@@ -223,12 +201,14 @@ export const Dynamic = {
|
|
|
223
201
|
return () => clearInterval(interval);
|
|
224
202
|
}, []);
|
|
225
203
|
|
|
204
|
+
const columns = useMemo(() => makeColumns(), []);
|
|
205
|
+
|
|
226
206
|
return (
|
|
227
207
|
<AnchoredOverflow.Root classNames='max-bs-[80dvh]' ref={containerRef}>
|
|
228
208
|
<Table<Item>
|
|
229
209
|
rowsSelectable='multi'
|
|
230
210
|
keyAccessor={(row) => row.publicKey.toHex()}
|
|
231
|
-
columns={columns
|
|
211
|
+
columns={columns}
|
|
232
212
|
data={items}
|
|
233
213
|
fullWidth
|
|
234
214
|
footer
|
|
@@ -245,9 +225,13 @@ export const Editable = {
|
|
|
245
225
|
render: () => {
|
|
246
226
|
const containerRef = useRef<HTMLDivElement | null>(null);
|
|
247
227
|
const [items, setItems] = useState<Item[]>(createItems(200));
|
|
248
|
-
|
|
249
|
-
|
|
250
|
-
|
|
228
|
+
|
|
229
|
+
const onUpdate: ValueUpdater<Item, any> = useCallback(
|
|
230
|
+
(item, prop, value) => setItems((items) => updateItems(items, item.publicKey, prop, value)),
|
|
231
|
+
[setItems],
|
|
232
|
+
);
|
|
233
|
+
|
|
234
|
+
const columns = useMemo(() => makeColumns(onUpdate), [onUpdate]);
|
|
251
235
|
|
|
252
236
|
return (
|
|
253
237
|
<div ref={containerRef} className='fixed inset-0 overflow-auto'>
|
|
@@ -255,7 +239,7 @@ export const Editable = {
|
|
|
255
239
|
role='grid'
|
|
256
240
|
rowsSelectable='multi'
|
|
257
241
|
keyAccessor={(row) => row.publicKey.toHex()}
|
|
258
|
-
columns={columns
|
|
242
|
+
columns={columns}
|
|
259
243
|
data={items}
|
|
260
244
|
fullWidth
|
|
261
245
|
stickyHeader
|
|
@@ -269,25 +253,27 @@ export const Editable = {
|
|
|
269
253
|
|
|
270
254
|
export const Resizable = {
|
|
271
255
|
render: () => {
|
|
256
|
+
const containerRef = useRef<HTMLDivElement | null>(null);
|
|
272
257
|
const [items, setItems] = useState<Item[]>(createItems(10));
|
|
273
|
-
const onUpdate: ValueUpdater<Item, any> = (item, prop, value) => {
|
|
274
|
-
setItems((items) => updateItems(items, item.publicKey, prop, value));
|
|
275
|
-
};
|
|
276
258
|
|
|
277
|
-
|
|
278
|
-
|
|
279
|
-
|
|
259
|
+
const onUpdate: ValueUpdater<Item, any> = useCallback(
|
|
260
|
+
(item, prop, value) => setItems((items) => updateItems(items, item.publicKey, prop, value)),
|
|
261
|
+
[setItems],
|
|
262
|
+
);
|
|
280
263
|
|
|
281
264
|
return (
|
|
282
|
-
<
|
|
283
|
-
|
|
284
|
-
|
|
285
|
-
|
|
286
|
-
|
|
287
|
-
|
|
288
|
-
|
|
289
|
-
|
|
290
|
-
|
|
265
|
+
<div ref={containerRef} className='fixed inset-0 overflow-auto'>
|
|
266
|
+
<Table<Item>
|
|
267
|
+
rowsSelectable='multi'
|
|
268
|
+
keyAccessor={(row) => row.publicKey.toHex()}
|
|
269
|
+
columns={makeColumns(onUpdate)}
|
|
270
|
+
data={items}
|
|
271
|
+
fullWidth
|
|
272
|
+
stickyHeader
|
|
273
|
+
getScrollElement={() => containerRef.current}
|
|
274
|
+
// onColumnResize={handleColumnResize}
|
|
275
|
+
/>
|
|
276
|
+
</div>
|
|
291
277
|
);
|
|
292
278
|
},
|
|
293
279
|
};
|
|
@@ -297,9 +283,12 @@ export const TenThousandRows = {
|
|
|
297
283
|
const containerRef = useRef<HTMLDivElement | null>(null);
|
|
298
284
|
const [items, setItems] = useState<Item[]>(createItems(10000));
|
|
299
285
|
|
|
300
|
-
const onUpdate: ValueUpdater<Item, any> = (
|
|
301
|
-
setItems((items) => updateItems(items, item.publicKey, prop, value))
|
|
302
|
-
|
|
286
|
+
const onUpdate: ValueUpdater<Item, any> = useCallback(
|
|
287
|
+
(item, prop, value) => setItems((items) => updateItems(items, item.publicKey, prop, value)),
|
|
288
|
+
[setItems],
|
|
289
|
+
);
|
|
290
|
+
|
|
291
|
+
const columns = useMemo(() => makeColumns(onUpdate), [onUpdate]);
|
|
303
292
|
|
|
304
293
|
return (
|
|
305
294
|
<div ref={containerRef} className='fixed inset-0 overflow-auto'>
|
|
@@ -307,7 +296,7 @@ export const TenThousandRows = {
|
|
|
307
296
|
role='grid'
|
|
308
297
|
rowsSelectable='multi'
|
|
309
298
|
keyAccessor={(row) => row.publicKey.toHex()}
|
|
310
|
-
columns={columns
|
|
299
|
+
columns={columns}
|
|
311
300
|
data={items}
|
|
312
301
|
fullWidth
|
|
313
302
|
stickyHeader
|