@dxos/react-ui-table 0.7.5-main.9d26e3a → 0.7.5-main.9d2a38b
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/{chunk-AT7O4RAD.mjs → chunk-T7CTRLHA.mjs} +2 -2
- package/dist/lib/browser/{chunk-AT7O4RAD.mjs.map → chunk-T7CTRLHA.mjs.map} +1 -1
- package/dist/lib/browser/index.mjs +425 -280
- package/dist/lib/browser/index.mjs.map +4 -4
- package/dist/lib/browser/meta.json +1 -1
- package/dist/lib/browser/types/index.mjs +1 -1
- package/dist/lib/node/{chunk-YSBXNBDJ.cjs → chunk-XQRKYO7Q.cjs} +6 -6
- package/dist/lib/node/chunk-XQRKYO7Q.cjs.map +7 -0
- package/dist/lib/node/index.cjs +417 -266
- package/dist/lib/node/index.cjs.map +4 -4
- package/dist/lib/node/meta.json +1 -1
- package/dist/lib/node/types/index.cjs +3 -3
- package/dist/lib/node/types/index.cjs.map +1 -1
- package/dist/lib/node-esm/{chunk-6OH2NHUX.mjs → chunk-6HE6MLBK.mjs} +2 -2
- package/dist/lib/node-esm/{chunk-6OH2NHUX.mjs.map → chunk-6HE6MLBK.mjs.map} +1 -1
- package/dist/lib/node-esm/index.mjs +425 -280
- package/dist/lib/node-esm/index.mjs.map +4 -4
- package/dist/lib/node-esm/meta.json +1 -1
- package/dist/lib/node-esm/types/index.mjs +1 -1
- 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/TableToolbar/TableToolbar.d.ts +18 -0
- package/dist/types/src/components/TableToolbar/TableToolbar.d.ts.map +1 -0
- package/dist/types/src/components/TableToolbar/index.d.ts +2 -0
- package/dist/types/src/components/TableToolbar/index.d.ts.map +1 -0
- package/dist/types/src/components/index.d.ts +1 -1
- package/dist/types/src/components/index.d.ts.map +1 -1
- package/dist/types/src/components/testing.d.ts +1 -1
- package/dist/types/src/model/table-model.d.ts +11 -19
- package/dist/types/src/model/table-model.d.ts.map +1 -1
- package/dist/types/src/model/table-presentation.d.ts.map +1 -1
- package/dist/types/src/model/table-sorting.d.ts +53 -0
- package/dist/types/src/model/table-sorting.d.ts.map +1 -0
- package/dist/types/src/translations.d.ts +2 -1
- package/dist/types/src/translations.d.ts.map +1 -1
- package/dist/types/src/types/table.d.ts +3 -3
- package/dist/types/src/types/table.d.ts.map +1 -1
- package/dist/types/src/util/table-buttons.d.ts +15 -1
- package/dist/types/src/util/table-buttons.d.ts.map +1 -1
- package/dist/types/src/util/table.d.ts +2 -1
- package/dist/types/src/util/table.d.ts.map +1 -1
- package/dist/types/tsconfig.tsbuildinfo +1 -1
- package/package.json +30 -29
- package/src/components/Table/ColumnActionsMenu.tsx +4 -4
- package/src/components/Table/Table.stories.tsx +33 -21
- package/src/components/Table/Table.tsx +4 -0
- package/src/components/TableToolbar/TableToolbar.tsx +72 -0
- package/src/components/{Toolbar → TableToolbar}/index.ts +1 -1
- package/src/components/index.ts +1 -1
- package/src/model/table-model.test.ts +0 -5
- package/src/model/table-model.ts +40 -98
- package/src/model/table-presentation.ts +12 -3
- package/src/model/table-sorting.ts +201 -0
- package/src/playwright/smoke.spec.ts +18 -11
- package/src/translations.ts +2 -1
- package/src/types/table.ts +1 -1
- package/src/util/table-buttons.ts +33 -3
- package/src/util/table.ts +78 -52
- package/dist/lib/node/chunk-YSBXNBDJ.cjs.map +0 -7
- package/dist/types/src/components/Toolbar/Toolbar.d.ts +0 -21
- package/dist/types/src/components/Toolbar/Toolbar.d.ts.map +0 -1
- package/dist/types/src/components/Toolbar/common.d.ts +0 -14
- package/dist/types/src/components/Toolbar/common.d.ts.map +0 -1
- package/dist/types/src/components/Toolbar/index.d.ts +0 -2
- package/dist/types/src/components/Toolbar/index.d.ts.map +0 -1
- package/src/components/Toolbar/Toolbar.tsx +0 -87
- package/src/components/Toolbar/common.tsx +0 -71
|
@@ -20,7 +20,7 @@ export declare const TableSchema: S.Struct<{
|
|
|
20
20
|
status: S.optional<S.Union<[S.Literal<["staged"]>, S.Literal<["active"]>, S.Literal<["resolved"]>]>>;
|
|
21
21
|
messages: S.mutable<S.Array$<import("@dxos/echo-schema").Ref$<import("packages/core/echo/echo-schema/dist/types/src/object/common").TypedObjectFields<{
|
|
22
22
|
timestamp: typeof S.String;
|
|
23
|
-
state: S.optional<S.Enums<typeof import("@dxos/plugin-space").MessageState>>;
|
|
23
|
+
state: S.optional<S.Enums<typeof import("@dxos/plugin-space/types").MessageState>>;
|
|
24
24
|
sender: S.mutable<S.Struct<{
|
|
25
25
|
contact: S.optional<import("@dxos/echo-schema").Ref$<import("packages/core/echo/echo-schema/dist/types/src/object/common").TypedObjectFields<{
|
|
26
26
|
name: S.optional<typeof S.String>;
|
|
@@ -61,7 +61,7 @@ declare const TableType_base: import("@dxos/echo-schema").TypedObjectPrototype<i
|
|
|
61
61
|
status: S.optional<S.Union<[S.Literal<["staged"]>, S.Literal<["active"]>, S.Literal<["resolved"]>]>>;
|
|
62
62
|
messages: S.mutable<S.Array$<import("@dxos/echo-schema").Ref$<import("packages/core/echo/echo-schema/dist/types/src/object/common").TypedObjectFields<{
|
|
63
63
|
timestamp: typeof S.String;
|
|
64
|
-
state: S.optional<S.Enums<typeof import("@dxos/plugin-space").MessageState>>;
|
|
64
|
+
state: S.optional<S.Enums<typeof import("@dxos/plugin-space/types").MessageState>>;
|
|
65
65
|
sender: S.mutable<S.Struct<{
|
|
66
66
|
contact: S.optional<import("@dxos/echo-schema").Ref$<import("packages/core/echo/echo-schema/dist/types/src/object/common").TypedObjectFields<{
|
|
67
67
|
name: S.optional<typeof S.String>;
|
|
@@ -101,7 +101,7 @@ declare const TableType_base: import("@dxos/echo-schema").TypedObjectPrototype<i
|
|
|
101
101
|
status: S.optional<S.Union<[S.Literal<["staged"]>, S.Literal<["active"]>, S.Literal<["resolved"]>]>>;
|
|
102
102
|
messages: S.mutable<S.Array$<import("@dxos/echo-schema").Ref$<import("packages/core/echo/echo-schema/dist/types/src/object/common").TypedObjectFields<{
|
|
103
103
|
timestamp: typeof S.String;
|
|
104
|
-
state: S.optional<S.Enums<typeof import("@dxos/plugin-space").MessageState>>;
|
|
104
|
+
state: S.optional<S.Enums<typeof import("@dxos/plugin-space/types").MessageState>>;
|
|
105
105
|
sender: S.mutable<S.Struct<{
|
|
106
106
|
contact: S.optional<import("@dxos/echo-schema").Ref$<import("packages/core/echo/echo-schema/dist/types/src/object/common").TypedObjectFields<{
|
|
107
107
|
name: S.optional<typeof S.String>;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"table.d.ts","sourceRoot":"","sources":["../../../../src/types/table.ts"],"names":[],"mappings":"AAIA,OAAO,EAAiB,CAAC,EAAe,MAAM,mBAAmB,CAAC;AAIlE,eAAO,MAAM,WAAW;;;;
|
|
1
|
+
{"version":3,"file":"table.d.ts","sourceRoot":"","sources":["../../../../src/types/table.ts"],"names":[],"mappings":"AAIA,OAAO,EAAiB,CAAC,EAAe,MAAM,mBAAmB,CAAC;AAIlE,eAAO,MAAM,WAAW;;;;cAcmB,EAAG,WAAW;eAAoP,EAAG,MAAM;gBAAmI,EAAG,QAAQ,CAAC,EAAE,MAAM;gBAAgJ,EAAG,OAAO,CAAC,EAAE,MAAM,CAAC,EAAE,OAAO,CAAC,EAAE,MAAM;uBAAqB,EAAG,MAAM;kBAAe,EAAG,MAAM;qBAA6C,EAAG,QAAQ,QAAO,EAAG,OAAO;kBAAgB,EAAG,QAAQ,QAAO,EAAG,MAAM;2BAAyB,EAAG,QAAQ,CAAC,EAAE,MAAM;;;;cAA0vG,EAAG,QAAQ,QAAO,EAAG,MAAM;gBAAqD,EAAG,QAAQ,QAAO,EAAG,MAAM;gBAAc,EAAG,QAAQ,CAAC,EAAE,KAAK,EAAE,EAAE,OAAO,cAAa,EAAG,OAAO,cAAa,EAAG,OAAO;kBAAgC,EAAG,OAAO,CAAC,EAAE,MAAM,QAAQ,mBAAmB,cAAc,6DAA6D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cAAc,6DAA6D;8BAAyG,EAAG,MAAM;mBAA8C,EAAG,QAAQ,CAAC,EAAE,KAAK;oBAAsF,EAAG,OAAO,CAAC,EAAE,MAAM;yBAAuB,EAAG,QAAQ,QAAQ,mBAAmB,cAAc,6DAA6D;0BAA2C,EAAG,QAAQ,QAAO,EAAG,MAAM;iCAA+B,EAAG,OAAO,CAAC,EAAE,MAAM,CAAC,EAAE,MAAM;qCAAmC,EAAG,MAAM;sCAAmC,EAAG,MAAM;;0BAA8C,6DAA6D;6BAAiD,EAAG,QAAQ,QAAO,EAAG,MAAM;uBAAqB,EAAG,QAAQ,QAAO,EAAG,MAAM;sBAAoB,EAAG,QAAQ,QAAO,EAAG,MAAM;;yBAAgF,EAAG,MAAM;mBAA+F,EAAG,QAAQ,CAAC,EAAE,OAAO,CAAC,EAAE,MAAM,QAAQ,mBAAmB;wBAAsI,EAAG,QAAQ,CAAC,EAAE,OAAO,CAAC,EAAE,OAAO,QAAO,EAAG,MAAM,SAAQ,EAAG,GAAG;qBAAyF,EAAG,QAAQ,QAAQ,mBAAmB;kBAAgC,6DAA6D;;;AAJr9L,qBAAa,SAAU,SAAQ,cAGT;CAAG"}
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
export type TableButton = 'columnSettings' | 'rowMenu' | 'newColumn' | 'referencedCell';
|
|
1
|
+
export type TableButton = 'columnSettings' | 'rowMenu' | 'newColumn' | 'referencedCell' | 'sort';
|
|
2
2
|
export declare const BUTTON_IDENTIFIERS: {
|
|
3
3
|
[K in TableButton]: string;
|
|
4
4
|
};
|
|
@@ -15,6 +15,10 @@ type ButtonData = {
|
|
|
15
15
|
} | {
|
|
16
16
|
type: 'rowMenu';
|
|
17
17
|
rowIndex: number;
|
|
18
|
+
} | {
|
|
19
|
+
type: 'sort';
|
|
20
|
+
fieldId: string;
|
|
21
|
+
direction?: 'asc' | 'desc';
|
|
18
22
|
};
|
|
19
23
|
export declare const tableButtons: {
|
|
20
24
|
readonly addColumn: {
|
|
@@ -57,6 +61,16 @@ export declare const tableButtons: {
|
|
|
57
61
|
type: "rowMenu";
|
|
58
62
|
}>;
|
|
59
63
|
};
|
|
64
|
+
readonly sort: {
|
|
65
|
+
readonly attr: string;
|
|
66
|
+
readonly icon: "ph--sort-ascending--regular";
|
|
67
|
+
readonly render: ({ fieldId, direction }: Omit<Extract<ButtonData, {
|
|
68
|
+
type: "sort";
|
|
69
|
+
}>, "type">) => string;
|
|
70
|
+
readonly getData: (el: HTMLElement) => Extract<ButtonData, {
|
|
71
|
+
type: "sort";
|
|
72
|
+
}>;
|
|
73
|
+
};
|
|
60
74
|
};
|
|
61
75
|
export {};
|
|
62
76
|
//# sourceMappingURL=table-buttons.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"table-buttons.d.ts","sourceRoot":"","sources":["../../../../src/util/table-buttons.ts"],"names":[],"mappings":"AAIA,MAAM,MAAM,WAAW,GAAG,gBAAgB,GAAG,SAAS,GAAG,WAAW,GAAG,gBAAgB,CAAC;
|
|
1
|
+
{"version":3,"file":"table-buttons.d.ts","sourceRoot":"","sources":["../../../../src/util/table-buttons.ts"],"names":[],"mappings":"AAIA,MAAM,MAAM,WAAW,GAAG,gBAAgB,GAAG,SAAS,GAAG,WAAW,GAAG,gBAAgB,GAAG,MAAM,CAAC;AAEjG,eAAO,MAAM,kBAAkB,EAAE;KAAG,CAAC,IAAI,WAAW,GAAG,MAAM;CAMnD,CAAC;AAEX,KAAK,UAAU,GACX;IAAE,IAAI,EAAE,gBAAgB,CAAC;IAAC,OAAO,EAAE,MAAM,CAAA;CAAE,GAC3C;IAAE,IAAI,EAAE,WAAW,CAAC;IAAC,QAAQ,CAAC,EAAE,OAAO,CAAA;CAAE,GACzC;IAAE,IAAI,EAAE,gBAAgB,CAAC;IAAC,QAAQ,EAAE,MAAM,CAAC;IAAC,QAAQ,EAAE,MAAM,CAAA;CAAE,GAC9D;IAAE,IAAI,EAAE,SAAS,CAAC;IAAC,QAAQ,EA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space;
|
|
6
6
|
table: TableType;
|
|
7
7
|
initialRow?: boolean;
|
|
8
|
+
initialSchema?: string;
|
|
8
9
|
};
|
|
9
|
-
export declare const initializeTable: ({ space, table, initialRow, }: InitialiseTableProps) => Promise<EchoSchema>;
|
|
10
|
+
export declare const initializeTable: ({ space, table, initialRow, initialSchema, }: InitialiseTableProps) => Promise<EchoSchema>;
|
|
10
11
|
export {};
|
|
11
12
|
//# sourceMappingURL=table.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"table.d.ts","sourceRoot":"","sources":["../../../../src/util/table.ts"],"names":[],"mappings":"AAIA,OAAO,EAML,KAAK,UAAU,EAIhB,MAAM,mBAAmB,CAAC;
|
|
1
|
+
{"version":3,"file":"table.d.ts","sourceRoot":"","sources":["../../../../src/util/table.ts"],"names":[],"mappings":"AAIA,OAAO,EAML,KAAK,UAAU,EAIhB,MAAM,mBAAmB,CAAC;AAE3B,OAAO,EAAmB,KAAK,KAAK,EAAE,MAAM,yBAAyB,CAAC;AAGtE,OAAO,EAAE,KAAK,SAAS,EAAE,MAAM,UAAU,CAAC;AAE1C,KAAK,oBAAoB,GAAG;IAC1B,KAAK,EAAE,KAAK,CAAC;IACb,KAAK,EAAE,SAAS,CAAC;IACjB,UAAU,CAAC,EAAE,OAAO,CAAC;IACrB,aAAa,CAAC,EAAE,MAAM,CAAC;CACxB,CAAC;AAMF,eAAO,MAAM,eAAe,iDAKzB,oBAAoB,KAAG,OAAO,CAAC,UAAU,CAiF3C,CAAC"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":"5.7.
|
|
1
|
+
{"version":"5.7.3"}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@dxos/react-ui-table",
|
|
3
|
-
"version": "0.7.5-main.
|
|
3
|
+
"version": "0.7.5-main.9d2a38b",
|
|
4
4
|
"description": "A table component.",
|
|
5
5
|
"homepage": "https://dxos.org",
|
|
6
6
|
"bugs": "https://github.com/dxos/dxos/issues",
|
|
@@ -53,26 +53,27 @@
|
|
|
53
53
|
"@tanstack/react-virtual": "^3.9.0",
|
|
54
54
|
"date-fns": "^3.3.1",
|
|
55
55
|
"lodash.orderby": "^4.6.0",
|
|
56
|
-
"@dxos/context": "0.7.5-main.
|
|
57
|
-
"@dxos/debug": "0.7.5-main.
|
|
58
|
-
"@dxos/echo-schema": "0.7.5-main.
|
|
59
|
-
"@dxos/invariant": "0.7.5-main.
|
|
60
|
-
"@dxos/
|
|
61
|
-
"@dxos/
|
|
62
|
-
"@dxos/
|
|
63
|
-
"@dxos/
|
|
64
|
-
"@dxos/plugin-space": "0.7.5-main.
|
|
65
|
-
"@dxos/
|
|
66
|
-
"@dxos/
|
|
67
|
-
"@dxos/react-ui-form": "0.7.5-main.
|
|
68
|
-
"@dxos/react-
|
|
69
|
-
"@dxos/react-ui-
|
|
70
|
-
"@dxos/react-ui-
|
|
71
|
-
"@dxos/react-ui-
|
|
72
|
-
"@dxos/react-ui-
|
|
73
|
-
"@dxos/react-ui-types": "0.7.5-main.
|
|
74
|
-
"@dxos/schema": "0.7.5-main.
|
|
75
|
-
"@dxos/util": "0.7.5-main.
|
|
56
|
+
"@dxos/context": "0.7.5-main.9d2a38b",
|
|
57
|
+
"@dxos/debug": "0.7.5-main.9d2a38b",
|
|
58
|
+
"@dxos/echo-schema": "0.7.5-main.9d2a38b",
|
|
59
|
+
"@dxos/invariant": "0.7.5-main.9d2a38b",
|
|
60
|
+
"@dxos/keys": "0.7.5-main.9d2a38b",
|
|
61
|
+
"@dxos/lit-grid": "0.7.5-main.9d2a38b",
|
|
62
|
+
"@dxos/live-object": "0.7.5-main.9d2a38b",
|
|
63
|
+
"@dxos/plugin-search": "0.7.5-main.9d2a38b",
|
|
64
|
+
"@dxos/plugin-space": "0.7.5-main.9d2a38b",
|
|
65
|
+
"@dxos/react-client": "0.7.5-main.9d2a38b",
|
|
66
|
+
"@dxos/log": "0.7.5-main.9d2a38b",
|
|
67
|
+
"@dxos/react-ui-form": "0.7.5-main.9d2a38b",
|
|
68
|
+
"@dxos/react-ui-searchlist": "0.7.5-main.9d2a38b",
|
|
69
|
+
"@dxos/react-ui-menu": "0.7.5-main.9d2a38b",
|
|
70
|
+
"@dxos/react-ui-stack": "0.7.5-main.9d2a38b",
|
|
71
|
+
"@dxos/react-ui-syntax-highlighter": "0.7.5-main.9d2a38b",
|
|
72
|
+
"@dxos/react-ui-grid": "0.7.5-main.9d2a38b",
|
|
73
|
+
"@dxos/react-ui-types": "0.7.5-main.9d2a38b",
|
|
74
|
+
"@dxos/schema": "0.7.5-main.9d2a38b",
|
|
75
|
+
"@dxos/util": "0.7.5-main.9d2a38b",
|
|
76
|
+
"@dxos/react-ui-attention": "0.7.5-main.9d2a38b"
|
|
76
77
|
},
|
|
77
78
|
"devDependencies": {
|
|
78
79
|
"@phosphor-icons/react": "^2.1.5",
|
|
@@ -83,19 +84,19 @@
|
|
|
83
84
|
"react": "~18.2.0",
|
|
84
85
|
"react-dom": "~18.2.0",
|
|
85
86
|
"vite": "5.4.7",
|
|
86
|
-
"@dxos/
|
|
87
|
-
"@dxos/
|
|
88
|
-
"@dxos/react-ui": "0.7.5-main.
|
|
89
|
-
"@dxos/storybook-utils": "0.7.5-main.
|
|
90
|
-
"@dxos/test-utils": "0.7.5-main.
|
|
91
|
-
"@dxos/react-ui
|
|
87
|
+
"@dxos/echo-signals": "0.7.5-main.9d2a38b",
|
|
88
|
+
"@dxos/random": "0.7.5-main.9d2a38b",
|
|
89
|
+
"@dxos/react-ui-theme": "0.7.5-main.9d2a38b",
|
|
90
|
+
"@dxos/storybook-utils": "0.7.5-main.9d2a38b",
|
|
91
|
+
"@dxos/test-utils": "0.7.5-main.9d2a38b",
|
|
92
|
+
"@dxos/react-ui": "0.7.5-main.9d2a38b"
|
|
92
93
|
},
|
|
93
94
|
"peerDependencies": {
|
|
94
95
|
"@phosphor-icons/react": "^2.1.5",
|
|
95
96
|
"react": "~18.2.0",
|
|
96
97
|
"react-dom": "~18.2.0",
|
|
97
|
-
"@dxos/react-ui": "0.7.5-main.
|
|
98
|
-
"@dxos/react-ui-theme": "0.7.5-main.
|
|
98
|
+
"@dxos/react-ui": "0.7.5-main.9d2a38b",
|
|
99
|
+
"@dxos/react-ui-theme": "0.7.5-main.9d2a38b"
|
|
99
100
|
},
|
|
100
101
|
"publishConfig": {
|
|
101
102
|
"access": "public"
|
|
@@ -18,7 +18,7 @@ export const ColumnActionsMenu = ({ model, modals }: ColumnActionsMenuProps) =>
|
|
|
18
18
|
return null;
|
|
19
19
|
}
|
|
20
20
|
|
|
21
|
-
const currentSort = model.sorting;
|
|
21
|
+
const currentSort = model.sorting?.sorting;
|
|
22
22
|
const isCurrentColumnSorted = currentSort?.fieldId === state.fieldId;
|
|
23
23
|
|
|
24
24
|
return (
|
|
@@ -30,7 +30,7 @@ export const ColumnActionsMenu = ({ model, modals }: ColumnActionsMenuProps) =>
|
|
|
30
30
|
{(!isCurrentColumnSorted || currentSort?.direction === 'asc') && (
|
|
31
31
|
<DropdownMenu.Item
|
|
32
32
|
data-testid='column-sort-descending'
|
|
33
|
-
onClick={() => model.setSort(state.fieldId, 'desc')}
|
|
33
|
+
onClick={() => model.sorting?.setSort(state.fieldId, 'desc')}
|
|
34
34
|
>
|
|
35
35
|
{t('column action sort descending')}
|
|
36
36
|
</DropdownMenu.Item>
|
|
@@ -38,13 +38,13 @@ export const ColumnActionsMenu = ({ model, modals }: ColumnActionsMenuProps) =>
|
|
|
38
38
|
{(!isCurrentColumnSorted || currentSort?.direction === 'desc') && (
|
|
39
39
|
<DropdownMenu.Item
|
|
40
40
|
data-testid='column-sort-ascending'
|
|
41
|
-
onClick={() => model.setSort(state.fieldId, 'asc')}
|
|
41
|
+
onClick={() => model.sorting?.setSort(state.fieldId, 'asc')}
|
|
42
42
|
>
|
|
43
43
|
{t('column action sort ascending')}
|
|
44
44
|
</DropdownMenu.Item>
|
|
45
45
|
)}
|
|
46
46
|
{isCurrentColumnSorted && (
|
|
47
|
-
<DropdownMenu.Item data-testid='column-clear-sort' onClick={() => model.clearSort()}>
|
|
47
|
+
<DropdownMenu.Item data-testid='column-clear-sort' onClick={() => model.sorting?.clearSort()}>
|
|
48
48
|
{t('column action clear sorting')}
|
|
49
49
|
</DropdownMenu.Item>
|
|
50
50
|
)}
|
|
@@ -25,7 +25,7 @@ import { TablePresentation } from '../../model';
|
|
|
25
25
|
import translations from '../../translations';
|
|
26
26
|
import { TableType } from '../../types';
|
|
27
27
|
import { initializeTable } from '../../util';
|
|
28
|
-
import {
|
|
28
|
+
import { TableToolbar } from '../TableToolbar';
|
|
29
29
|
import { createItems, createTable, type SimulatorProps, useSimulator } from '../testing';
|
|
30
30
|
|
|
31
31
|
// NOTE(ZaymonFC): We rely on this seed being 0 in the smoke tests.
|
|
@@ -84,21 +84,6 @@ const DefaultStory = () => {
|
|
|
84
84
|
[table, projection],
|
|
85
85
|
);
|
|
86
86
|
|
|
87
|
-
const handleAction = useCallback(
|
|
88
|
-
(action: { type: string }) => {
|
|
89
|
-
switch (action.type) {
|
|
90
|
-
case 'on-thread-create': {
|
|
91
|
-
console.log('Thread creation triggered');
|
|
92
|
-
break;
|
|
93
|
-
}
|
|
94
|
-
case 'add-row': {
|
|
95
|
-
handleInsertRow();
|
|
96
|
-
}
|
|
97
|
-
}
|
|
98
|
-
},
|
|
99
|
-
[table],
|
|
100
|
-
);
|
|
101
|
-
|
|
102
87
|
const tableRef = useRef<TableController>(null);
|
|
103
88
|
const handleCellUpdate = useCallback((cell: any) => {
|
|
104
89
|
tableRef.current?.update?.(cell);
|
|
@@ -125,6 +110,36 @@ const DefaultStory = () => {
|
|
|
125
110
|
}
|
|
126
111
|
}, [model]);
|
|
127
112
|
|
|
113
|
+
const handleAction = useCallback(
|
|
114
|
+
(action: { type: string }) => {
|
|
115
|
+
switch (action.type) {
|
|
116
|
+
case 'on-thread-create': {
|
|
117
|
+
console.log('Thread creation triggered');
|
|
118
|
+
break;
|
|
119
|
+
}
|
|
120
|
+
case 'add-row': {
|
|
121
|
+
handleInsertRow();
|
|
122
|
+
break;
|
|
123
|
+
}
|
|
124
|
+
case 'save-view': {
|
|
125
|
+
model?.saveView();
|
|
126
|
+
break;
|
|
127
|
+
}
|
|
128
|
+
}
|
|
129
|
+
},
|
|
130
|
+
[table, model],
|
|
131
|
+
);
|
|
132
|
+
|
|
133
|
+
const onTypenameChanged = useCallback(
|
|
134
|
+
(typename: string) => {
|
|
135
|
+
if (table?.view?.target) {
|
|
136
|
+
schema?.updateTypename(typename);
|
|
137
|
+
table.view.target.query.type = typename;
|
|
138
|
+
}
|
|
139
|
+
},
|
|
140
|
+
[table?.view?.target, schema],
|
|
141
|
+
);
|
|
142
|
+
|
|
128
143
|
if (!schema || !table) {
|
|
129
144
|
return <div />;
|
|
130
145
|
}
|
|
@@ -132,11 +147,7 @@ const DefaultStory = () => {
|
|
|
132
147
|
return (
|
|
133
148
|
<div className='grow grid grid-cols-[1fr_350px]'>
|
|
134
149
|
<div className='grid grid-rows-[min-content_1fr] min-bs-0 overflow-hidden'>
|
|
135
|
-
<
|
|
136
|
-
<Toolbar.Editing />
|
|
137
|
-
<Toolbar.Separator />
|
|
138
|
-
<Toolbar.Actions />
|
|
139
|
-
</Toolbar.Root>
|
|
150
|
+
<TableToolbar classNames='border-b border-separator' onAction={handleAction} />
|
|
140
151
|
<Table.Root>
|
|
141
152
|
<Table.Main ref={tableRef} model={model} presentation={presentation} ignoreAttention />
|
|
142
153
|
</Table.Root>
|
|
@@ -147,6 +158,7 @@ const DefaultStory = () => {
|
|
|
147
158
|
registry={space?.db.schemaRegistry}
|
|
148
159
|
schema={schema}
|
|
149
160
|
view={table.view.target!}
|
|
161
|
+
onTypenameChanged={onTypenameChanged}
|
|
150
162
|
onDelete={handleDeleteColumn}
|
|
151
163
|
/>
|
|
152
164
|
)}
|
|
@@ -0,0 +1,72 @@
|
|
|
1
|
+
//
|
|
2
|
+
// Copyright 2024 DXOS.org
|
|
3
|
+
//
|
|
4
|
+
|
|
5
|
+
import React, { useCallback, useMemo } from 'react';
|
|
6
|
+
|
|
7
|
+
import { create } from '@dxos/live-object';
|
|
8
|
+
import { type ThemedClassName } from '@dxos/react-ui';
|
|
9
|
+
import {
|
|
10
|
+
createGapSeparator,
|
|
11
|
+
createMenuAction,
|
|
12
|
+
type MenuAction,
|
|
13
|
+
type MenuActionHandler,
|
|
14
|
+
MenuProvider,
|
|
15
|
+
ToolbarMenu,
|
|
16
|
+
useMenuActions,
|
|
17
|
+
} from '@dxos/react-ui-menu';
|
|
18
|
+
|
|
19
|
+
import { translationKey } from '../../translations';
|
|
20
|
+
|
|
21
|
+
export type TableToolbarActionProperties = { type: TableToolbarActionType };
|
|
22
|
+
|
|
23
|
+
export type TableToolbarAction = MenuAction<TableToolbarActionProperties>;
|
|
24
|
+
|
|
25
|
+
export type TableToolbarActionType = 'add-row' | 'comment' | 'save-view';
|
|
26
|
+
|
|
27
|
+
type TableToolbarState = Partial<{ viewDirty: boolean }>;
|
|
28
|
+
|
|
29
|
+
export type TableToolbarProps = ThemedClassName<
|
|
30
|
+
TableToolbarState & { onAction?: MenuActionHandler<TableToolbarAction>; attendableId?: string }
|
|
31
|
+
>;
|
|
32
|
+
|
|
33
|
+
const createTableToolbarActions = (state: TableToolbarState) => {
|
|
34
|
+
const add = createMenuAction<TableToolbarActionProperties>('add-row', {
|
|
35
|
+
type: 'add-row',
|
|
36
|
+
icon: 'ph--plus--regular',
|
|
37
|
+
label: ['add row', { ns: translationKey }],
|
|
38
|
+
testId: 'table.toolbar.add-row',
|
|
39
|
+
});
|
|
40
|
+
const save = createMenuAction<TableToolbarActionProperties>('save-view', {
|
|
41
|
+
type: 'save-view',
|
|
42
|
+
icon: 'ph--floppy-disk--regular',
|
|
43
|
+
label: ['save view label', { ns: translationKey }],
|
|
44
|
+
testId: 'table.toolbar.save-view',
|
|
45
|
+
iconOnly: false,
|
|
46
|
+
hidden: !state.viewDirty,
|
|
47
|
+
});
|
|
48
|
+
const gap = createGapSeparator();
|
|
49
|
+
const comment = createMenuAction('comment', {
|
|
50
|
+
type: 'comment',
|
|
51
|
+
icon: 'ph--chat-text--regular',
|
|
52
|
+
label: ['create comment', { ns: translationKey }],
|
|
53
|
+
testId: 'table.toolbar.comment',
|
|
54
|
+
});
|
|
55
|
+
const nodes = [add, save, ...gap.nodes, comment];
|
|
56
|
+
return {
|
|
57
|
+
nodes,
|
|
58
|
+
edges: nodes.map(({ id: target }) => ({ source: 'root', target })),
|
|
59
|
+
};
|
|
60
|
+
};
|
|
61
|
+
|
|
62
|
+
export const TableToolbar = ({ classNames, viewDirty, attendableId, onAction }: TableToolbarProps) => {
|
|
63
|
+
const state = useMemo(() => create<TableToolbarState>({ viewDirty }), []);
|
|
64
|
+
const actionsCreator = useCallback(() => createTableToolbarActions(state), [state]);
|
|
65
|
+
const menu = useMenuActions(actionsCreator);
|
|
66
|
+
|
|
67
|
+
return (
|
|
68
|
+
<MenuProvider {...menu} attendableId={attendableId} onAction={onAction as MenuActionHandler}>
|
|
69
|
+
<ToolbarMenu classNames={classNames} />
|
|
70
|
+
</MenuProvider>
|
|
71
|
+
);
|
|
72
|
+
};
|
package/src/components/index.ts
CHANGED
|
@@ -37,11 +37,6 @@ describe('TableModel', () => {
|
|
|
37
37
|
});
|
|
38
38
|
|
|
39
39
|
describe('methods', () => {
|
|
40
|
-
it('should set sorting', () => {
|
|
41
|
-
model.setSort('col2', 'asc');
|
|
42
|
-
expect(model.sorting).toEqual([{ columnId: 'col2', direction: 'asc' }]);
|
|
43
|
-
});
|
|
44
|
-
|
|
45
40
|
it('should pin a row', () => {
|
|
46
41
|
model.pinRow(1, 'top');
|
|
47
42
|
expect(model.pinnedRows.top).toContain(1);
|