@dxos/react-ui-table 0.8.1-main.ba2dec9 → 0.8.1-staging.5be625a
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-3FR6NHPD.mjs → chunk-5MKYB7NF.mjs} +5 -7
- package/dist/lib/browser/chunk-5MKYB7NF.mjs.map +7 -0
- package/dist/lib/browser/{_deprecated → deprecated}/index.mjs +26 -26
- package/dist/lib/{node-esm/_deprecated → browser/deprecated}/index.mjs.map +4 -4
- package/dist/lib/browser/index.mjs +394 -192
- 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-NB3SFHGA.cjs → chunk-NRFKBRPV.cjs} +7 -9
- package/dist/lib/node/chunk-NRFKBRPV.cjs.map +7 -0
- package/dist/lib/node/{_deprecated → deprecated}/index.cjs +5 -5
- package/dist/lib/node/{_deprecated → deprecated}/index.cjs.map +4 -4
- package/dist/lib/node/index.cjs +386 -188
- 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-RLVVOZW5.mjs → chunk-SU4D55KI.mjs} +5 -7
- package/dist/lib/node-esm/chunk-SU4D55KI.mjs.map +7 -0
- package/dist/lib/node-esm/{_deprecated → deprecated}/index.mjs +26 -26
- package/dist/lib/node-esm/deprecated/index.mjs.map +7 -0
- package/dist/lib/node-esm/index.mjs +394 -192
- 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/ColumnActionsMenu.d.ts.map +1 -1
- package/dist/types/src/components/Table/ColumnSettings.d.ts.map +1 -1
- package/dist/types/src/components/Table/DynamicTable.d.ts +19 -0
- package/dist/types/src/components/Table/DynamicTable.d.ts.map +1 -0
- package/dist/types/src/components/Table/RowActionsMenu.d.ts.map +1 -1
- package/dist/types/src/components/Table/Table.d.ts +1 -0
- package/dist/types/src/components/Table/Table.d.ts.map +1 -1
- package/dist/types/src/components/Table/Table.stories.d.ts +3 -1
- package/dist/types/src/components/Table/Table.stories.d.ts.map +1 -1
- package/dist/types/src/components/Table/index.d.ts +1 -0
- package/dist/types/src/components/Table/index.d.ts.map +1 -1
- package/dist/types/src/components/TableCellEditor/TableCellEditor.stories.d.ts.map +1 -1
- package/dist/types/src/components/testing.d.ts +7 -7
- package/dist/types/src/components/testing.d.ts.map +1 -1
- package/dist/types/src/deprecated/components/Cell/Cell.d.ts.map +1 -0
- package/dist/types/src/deprecated/components/Cell/CellCombobox.d.ts.map +1 -0
- package/dist/types/src/deprecated/components/Cell/index.d.ts.map +1 -0
- package/dist/types/src/deprecated/components/ColumnMenu/ColumnMenu.d.ts.map +1 -0
- package/dist/types/src/deprecated/components/ColumnMenu/ColumnMenu.stories.d.ts.map +1 -0
- package/dist/types/src/deprecated/components/ColumnMenu/ColumnSettings.d.ts.map +1 -0
- package/dist/types/src/deprecated/components/ColumnMenu/ColumnSettings.stories.d.ts.map +1 -0
- package/dist/types/src/deprecated/components/ColumnMenu/index.d.ts.map +1 -0
- package/dist/types/src/deprecated/components/Table/Table.d.ts.map +1 -0
- package/dist/types/src/deprecated/components/Table/Table.stories.d.ts.map +1 -0
- package/dist/types/src/deprecated/components/Table/TableBody.d.ts.map +1 -0
- package/dist/types/src/deprecated/components/Table/TableContext.d.ts.map +1 -0
- package/dist/types/src/deprecated/components/Table/TableHead.d.ts.map +1 -0
- package/dist/types/src/deprecated/components/Table/TableRootContext.d.ts.map +1 -0
- package/dist/types/src/deprecated/components/Table/index.d.ts.map +1 -0
- package/dist/types/src/deprecated/components/Table/props.d.ts.map +1 -0
- package/dist/types/src/deprecated/components/index.d.ts.map +1 -0
- package/dist/types/src/deprecated/helpers.d.ts.map +1 -0
- package/dist/types/src/deprecated/hooks/index.d.ts.map +1 -0
- package/dist/types/src/deprecated/hooks/useColumnSizing.d.ts.map +1 -0
- package/dist/types/src/deprecated/hooks/useColumnSorting.d.ts.map +1 -0
- package/dist/types/src/deprecated/hooks/usePinLastRow.d.ts.map +1 -0
- package/dist/types/src/deprecated/hooks/useRowSelection.d.ts.map +1 -0
- package/dist/types/src/deprecated/index.d.ts.map +1 -0
- package/dist/types/src/deprecated/schema/Schema.stories.d.ts.map +1 -0
- package/dist/types/src/deprecated/schema/column-utils.d.ts.map +1 -0
- package/dist/types/src/deprecated/schema/index.d.ts.map +1 -0
- package/dist/types/src/deprecated/schema/types.d.ts.map +1 -0
- package/dist/types/src/deprecated/theme.d.ts.map +1 -0
- package/dist/types/src/deprecated/translations.d.ts.map +1 -0
- package/dist/types/src/deprecated/types.d.ts.map +1 -0
- package/dist/types/src/hooks/useTableModel.d.ts +6 -3
- package/dist/types/src/hooks/useTableModel.d.ts.map +1 -1
- package/dist/types/src/model/table-model.d.ts +34 -7
- 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.map +1 -1
- package/dist/types/src/types/table.d.ts +7 -33
- package/dist/types/src/types/table.d.ts.map +1 -1
- package/dist/types/src/util/dynamic-table.d.ts +40 -0
- package/dist/types/src/util/dynamic-table.d.ts.map +1 -0
- package/dist/types/src/util/index.d.ts +1 -0
- package/dist/types/src/util/index.d.ts.map +1 -1
- package/dist/types/src/util/table.d.ts +5 -3
- package/dist/types/src/util/table.d.ts.map +1 -1
- package/package.json +35 -35
- package/src/components/Table/ColumnActionsMenu.tsx +6 -4
- package/src/components/Table/ColumnSettings.tsx +5 -6
- package/src/components/Table/CreateRefPanel.tsx +3 -3
- package/src/components/Table/DynamicTable.tsx +86 -0
- package/src/components/Table/RefPanel.tsx +3 -3
- package/src/components/Table/RowActionsMenu.tsx +18 -3
- package/src/components/Table/Table.stories.tsx +71 -20
- package/src/components/Table/Table.tsx +30 -10
- package/src/components/Table/index.ts +1 -0
- package/src/components/TableCellEditor/TableCellEditor.stories.tsx +9 -4
- package/src/components/testing.ts +1 -0
- package/src/{_deprecated → deprecated}/components/Cell/Cell.tsx +2 -2
- package/src/{_deprecated → deprecated}/components/Table/TableBody.tsx +2 -2
- package/src/{_deprecated → deprecated}/helpers.tsx +2 -2
- package/src/hooks/useTableModel.ts +28 -7
- package/src/model/table-model.test.ts +1 -1
- package/src/model/table-model.ts +97 -21
- package/src/model/table-presentation.test.ts +1 -1
- package/src/model/table-presentation.ts +30 -12
- package/src/model/table-sorting.ts +1 -0
- package/src/types/table.ts +5 -7
- package/src/util/dynamic-table.ts +71 -0
- package/src/util/index.ts +1 -0
- package/src/util/table.ts +67 -65
- package/dist/lib/browser/_deprecated/index.mjs.map +0 -7
- package/dist/lib/browser/chunk-3FR6NHPD.mjs.map +0 -7
- package/dist/lib/node/chunk-NB3SFHGA.cjs.map +0 -7
- package/dist/lib/node-esm/chunk-RLVVOZW5.mjs.map +0 -7
- package/dist/types/src/_deprecated/components/Cell/Cell.d.ts.map +0 -1
- package/dist/types/src/_deprecated/components/Cell/CellCombobox.d.ts.map +0 -1
- package/dist/types/src/_deprecated/components/Cell/index.d.ts.map +0 -1
- package/dist/types/src/_deprecated/components/ColumnMenu/ColumnMenu.d.ts.map +0 -1
- package/dist/types/src/_deprecated/components/ColumnMenu/ColumnMenu.stories.d.ts.map +0 -1
- package/dist/types/src/_deprecated/components/ColumnMenu/ColumnSettings.d.ts.map +0 -1
- package/dist/types/src/_deprecated/components/ColumnMenu/ColumnSettings.stories.d.ts.map +0 -1
- package/dist/types/src/_deprecated/components/ColumnMenu/index.d.ts.map +0 -1
- package/dist/types/src/_deprecated/components/Table/Table.d.ts.map +0 -1
- package/dist/types/src/_deprecated/components/Table/Table.stories.d.ts.map +0 -1
- package/dist/types/src/_deprecated/components/Table/TableBody.d.ts.map +0 -1
- package/dist/types/src/_deprecated/components/Table/TableContext.d.ts.map +0 -1
- package/dist/types/src/_deprecated/components/Table/TableHead.d.ts.map +0 -1
- package/dist/types/src/_deprecated/components/Table/TableRootContext.d.ts.map +0 -1
- package/dist/types/src/_deprecated/components/Table/index.d.ts.map +0 -1
- package/dist/types/src/_deprecated/components/Table/props.d.ts.map +0 -1
- package/dist/types/src/_deprecated/components/index.d.ts.map +0 -1
- package/dist/types/src/_deprecated/helpers.d.ts.map +0 -1
- package/dist/types/src/_deprecated/hooks/index.d.ts.map +0 -1
- package/dist/types/src/_deprecated/hooks/useColumnSizing.d.ts.map +0 -1
- package/dist/types/src/_deprecated/hooks/useColumnSorting.d.ts.map +0 -1
- package/dist/types/src/_deprecated/hooks/usePinLastRow.d.ts.map +0 -1
- package/dist/types/src/_deprecated/hooks/useRowSelection.d.ts.map +0 -1
- package/dist/types/src/_deprecated/index.d.ts.map +0 -1
- package/dist/types/src/_deprecated/schema/Schema.stories.d.ts.map +0 -1
- package/dist/types/src/_deprecated/schema/column-utils.d.ts.map +0 -1
- package/dist/types/src/_deprecated/schema/index.d.ts.map +0 -1
- package/dist/types/src/_deprecated/schema/types.d.ts.map +0 -1
- package/dist/types/src/_deprecated/theme.d.ts.map +0 -1
- package/dist/types/src/_deprecated/translations.d.ts.map +0 -1
- package/dist/types/src/_deprecated/types.d.ts.map +0 -1
- /package/dist/types/src/{_deprecated → deprecated}/components/Cell/Cell.d.ts +0 -0
- /package/dist/types/src/{_deprecated → deprecated}/components/Cell/CellCombobox.d.ts +0 -0
- /package/dist/types/src/{_deprecated → deprecated}/components/Cell/index.d.ts +0 -0
- /package/dist/types/src/{_deprecated → deprecated}/components/ColumnMenu/ColumnMenu.d.ts +0 -0
- /package/dist/types/src/{_deprecated → deprecated}/components/ColumnMenu/ColumnMenu.stories.d.ts +0 -0
- /package/dist/types/src/{_deprecated → deprecated}/components/ColumnMenu/ColumnSettings.d.ts +0 -0
- /package/dist/types/src/{_deprecated → deprecated}/components/ColumnMenu/ColumnSettings.stories.d.ts +0 -0
- /package/dist/types/src/{_deprecated → deprecated}/components/ColumnMenu/index.d.ts +0 -0
- /package/dist/types/src/{_deprecated → deprecated}/components/Table/Table.d.ts +0 -0
- /package/dist/types/src/{_deprecated → deprecated}/components/Table/Table.stories.d.ts +0 -0
- /package/dist/types/src/{_deprecated → deprecated}/components/Table/TableBody.d.ts +0 -0
- /package/dist/types/src/{_deprecated → deprecated}/components/Table/TableContext.d.ts +0 -0
- /package/dist/types/src/{_deprecated → deprecated}/components/Table/TableHead.d.ts +0 -0
- /package/dist/types/src/{_deprecated → deprecated}/components/Table/TableRootContext.d.ts +0 -0
- /package/dist/types/src/{_deprecated → deprecated}/components/Table/index.d.ts +0 -0
- /package/dist/types/src/{_deprecated → deprecated}/components/Table/props.d.ts +0 -0
- /package/dist/types/src/{_deprecated → deprecated}/components/index.d.ts +0 -0
- /package/dist/types/src/{_deprecated → deprecated}/helpers.d.ts +0 -0
- /package/dist/types/src/{_deprecated → deprecated}/hooks/index.d.ts +0 -0
- /package/dist/types/src/{_deprecated → deprecated}/hooks/useColumnSizing.d.ts +0 -0
- /package/dist/types/src/{_deprecated → deprecated}/hooks/useColumnSorting.d.ts +0 -0
- /package/dist/types/src/{_deprecated → deprecated}/hooks/usePinLastRow.d.ts +0 -0
- /package/dist/types/src/{_deprecated → deprecated}/hooks/useRowSelection.d.ts +0 -0
- /package/dist/types/src/{_deprecated → deprecated}/index.d.ts +0 -0
- /package/dist/types/src/{_deprecated → deprecated}/schema/Schema.stories.d.ts +0 -0
- /package/dist/types/src/{_deprecated → deprecated}/schema/column-utils.d.ts +0 -0
- /package/dist/types/src/{_deprecated → deprecated}/schema/index.d.ts +0 -0
- /package/dist/types/src/{_deprecated → deprecated}/schema/types.d.ts +0 -0
- /package/dist/types/src/{_deprecated → deprecated}/theme.d.ts +0 -0
- /package/dist/types/src/{_deprecated → deprecated}/translations.d.ts +0 -0
- /package/dist/types/src/{_deprecated → deprecated}/types.d.ts +0 -0
- /package/src/{_deprecated → deprecated}/components/Cell/CellCombobox.tsx +0 -0
- /package/src/{_deprecated → deprecated}/components/Cell/index.ts +0 -0
- /package/src/{_deprecated → deprecated}/components/ColumnMenu/ColumnMenu.stories.tsx +0 -0
- /package/src/{_deprecated → deprecated}/components/ColumnMenu/ColumnMenu.tsx +0 -0
- /package/src/{_deprecated → deprecated}/components/ColumnMenu/ColumnSettings.stories.tsx +0 -0
- /package/src/{_deprecated → deprecated}/components/ColumnMenu/ColumnSettings.tsx +0 -0
- /package/src/{_deprecated → deprecated}/components/ColumnMenu/index.ts +0 -0
- /package/src/{_deprecated → deprecated}/components/Table/Table.stories.tsx +0 -0
- /package/src/{_deprecated → deprecated}/components/Table/Table.tsx +0 -0
- /package/src/{_deprecated → deprecated}/components/Table/TableContext.tsx +0 -0
- /package/src/{_deprecated → deprecated}/components/Table/TableHead.tsx +0 -0
- /package/src/{_deprecated → deprecated}/components/Table/TableRootContext.ts +0 -0
- /package/src/{_deprecated → deprecated}/components/Table/index.ts +0 -0
- /package/src/{_deprecated → deprecated}/components/Table/props.ts +0 -0
- /package/src/{_deprecated → deprecated}/components/index.ts +0 -0
- /package/src/{_deprecated → deprecated}/hooks/index.ts +0 -0
- /package/src/{_deprecated → deprecated}/hooks/useColumnSizing.ts +0 -0
- /package/src/{_deprecated → deprecated}/hooks/useColumnSorting.ts +0 -0
- /package/src/{_deprecated → deprecated}/hooks/usePinLastRow.ts +0 -0
- /package/src/{_deprecated → deprecated}/hooks/useRowSelection.ts +0 -0
- /package/src/{_deprecated → deprecated}/index.ts +0 -0
- /package/src/{_deprecated → deprecated}/schema/Schema.stories.tsx +0 -0
- /package/src/{_deprecated → deprecated}/schema/column-utils.ts +0 -0
- /package/src/{_deprecated → deprecated}/schema/index.ts +0 -0
- /package/src/{_deprecated → deprecated}/schema/types.ts +0 -0
- /package/src/{_deprecated → deprecated}/theme.ts +0 -0
- /package/src/{_deprecated → deprecated}/translations.ts +0 -0
- /package/src/{_deprecated → deprecated}/types.ts +0 -0
package/dist/lib/node/index.cjs
CHANGED
|
@@ -30,14 +30,16 @@ var node_exports = {};
|
|
|
30
30
|
__export(node_exports, {
|
|
31
31
|
BUTTON_IDENTIFIERS: () => BUTTON_IDENTIFIERS,
|
|
32
32
|
CONTROL_IDENTIFIERS: () => CONTROL_IDENTIFIERS,
|
|
33
|
+
DynamicTable: () => DynamicTable,
|
|
33
34
|
ModalController: () => ModalController,
|
|
34
35
|
Table: () => Table,
|
|
35
36
|
TableModel: () => TableModel,
|
|
36
37
|
TablePresentation: () => TablePresentation,
|
|
37
|
-
TableSchema: () =>
|
|
38
|
+
TableSchema: () => import_chunk_NRFKBRPV.TableSchema,
|
|
38
39
|
TableToolbar: () => TableToolbar,
|
|
39
|
-
TableType: () =>
|
|
40
|
+
TableType: () => import_chunk_NRFKBRPV.TableType,
|
|
40
41
|
initializeTable: () => initializeTable,
|
|
42
|
+
makeDynamicTable: () => makeDynamicTable,
|
|
41
43
|
renderCheckbox: () => renderCheckbox,
|
|
42
44
|
renderSwitch: () => renderSwitch,
|
|
43
45
|
tableButtons: () => tableButtons,
|
|
@@ -47,7 +49,7 @@ __export(node_exports, {
|
|
|
47
49
|
useTableModel: () => useTableModel
|
|
48
50
|
});
|
|
49
51
|
module.exports = __toCommonJS(node_exports);
|
|
50
|
-
var
|
|
52
|
+
var import_chunk_NRFKBRPV = require("./chunk-NRFKBRPV.cjs");
|
|
51
53
|
var import_react = __toESM(require("react"));
|
|
52
54
|
var import_echo_schema = require("@dxos/echo-schema");
|
|
53
55
|
var import_invariant = require("@dxos/invariant");
|
|
@@ -60,17 +62,15 @@ var import_util = require("@dxos/util");
|
|
|
60
62
|
var import_react2 = __toESM(require("react"));
|
|
61
63
|
var import_react_ui2 = require("@dxos/react-ui");
|
|
62
64
|
var import_react3 = __toESM(require("react"));
|
|
63
|
-
var import_echo2 = require("@dxos/react-client/echo");
|
|
64
65
|
var import_react_ui3 = require("@dxos/react-ui");
|
|
65
66
|
var import_react_ui_form = require("@dxos/react-ui-form");
|
|
66
67
|
var import_react4 = __toESM(require("react"));
|
|
67
68
|
var import_echo_schema2 = require("@dxos/echo-schema");
|
|
68
|
-
var
|
|
69
|
+
var import_echo2 = require("@dxos/react-client/echo");
|
|
69
70
|
var import_react_ui4 = require("@dxos/react-ui");
|
|
70
71
|
var import_react_ui_form2 = require("@dxos/react-ui-form");
|
|
71
72
|
var import_react_ui_grid2 = require("@dxos/react-ui-grid");
|
|
72
73
|
var import_react5 = __toESM(require("react"));
|
|
73
|
-
var import_echo4 = require("@dxos/react-client/echo");
|
|
74
74
|
var import_react_ui5 = require("@dxos/react-ui");
|
|
75
75
|
var import_react_ui_form3 = require("@dxos/react-ui-form");
|
|
76
76
|
var import_react6 = __toESM(require("react"));
|
|
@@ -80,14 +80,15 @@ var import_context = require("@dxos/context");
|
|
|
80
80
|
var import_echo_schema3 = require("@dxos/echo-schema");
|
|
81
81
|
var import_invariant2 = require("@dxos/invariant");
|
|
82
82
|
var import_live_object = require("@dxos/live-object");
|
|
83
|
-
var import_react_client = require("@dxos/react-client");
|
|
84
83
|
var import_react_ui_form4 = require("@dxos/react-ui-form");
|
|
85
84
|
var import_signals_core2 = require("@preact/signals-core");
|
|
86
85
|
var import_context2 = require("@dxos/context");
|
|
87
|
-
var
|
|
88
|
-
var import_react_client2 = require("@dxos/react-client");
|
|
89
|
-
var import_echo5 = require("@dxos/react-client/echo");
|
|
86
|
+
var import_live_object2 = require("@dxos/live-object");
|
|
90
87
|
var import_schema = require("@dxos/schema");
|
|
88
|
+
var import_echo_schema4 = require("@dxos/echo-schema");
|
|
89
|
+
var import_react_client = require("@dxos/react-client");
|
|
90
|
+
var import_echo3 = require("@dxos/react-client/echo");
|
|
91
|
+
var import_schema2 = require("@dxos/schema");
|
|
91
92
|
var import_signals_core3 = require("@preact/signals-core");
|
|
92
93
|
var import_lodash = __toESM(require("lodash.orderby"));
|
|
93
94
|
var import_echo_schema5 = require("@dxos/echo-schema");
|
|
@@ -99,7 +100,7 @@ var import_echo_schema6 = require("@dxos/echo-schema");
|
|
|
99
100
|
var import_react_ui_form6 = require("@dxos/react-ui-form");
|
|
100
101
|
var import_react_ui_grid3 = require("@dxos/react-ui-grid");
|
|
101
102
|
var import_react_ui_theme2 = require("@dxos/react-ui-theme");
|
|
102
|
-
var
|
|
103
|
+
var import_schema3 = require("@dxos/schema");
|
|
103
104
|
var import_react7 = __toESM(require("react"));
|
|
104
105
|
var import_echo_schema7 = require("@dxos/echo-schema");
|
|
105
106
|
var import_invariant3 = require("@dxos/invariant");
|
|
@@ -107,12 +108,15 @@ var import_react_ui_grid4 = require("@dxos/react-ui-grid");
|
|
|
107
108
|
var import_autocomplete = require("@codemirror/autocomplete");
|
|
108
109
|
var import_view = require("@codemirror/view");
|
|
109
110
|
var import_react8 = __toESM(require("react"));
|
|
110
|
-
var
|
|
111
|
-
var import_react_ui_menu = require("@dxos/react-ui-menu");
|
|
111
|
+
var import_react_ui_theme3 = require("@dxos/react-ui-theme");
|
|
112
112
|
var import_signals_core6 = require("@preact/signals-core");
|
|
113
113
|
var import_react9 = require("react");
|
|
114
|
+
var import_echo4 = require("@dxos/react-client/echo");
|
|
114
115
|
var import_react_ui_attention2 = require("@dxos/react-ui-attention");
|
|
115
116
|
var import_util2 = require("@dxos/util");
|
|
117
|
+
var import_react10 = __toESM(require("react"));
|
|
118
|
+
var import_live_object3 = require("@dxos/live-object");
|
|
119
|
+
var import_react_ui_menu = require("@dxos/react-ui-menu");
|
|
116
120
|
var translationKey = "table";
|
|
117
121
|
var translations_default = [
|
|
118
122
|
{
|
|
@@ -166,10 +170,10 @@ var ColumnActionsMenu = ({ model, modals }) => {
|
|
|
166
170
|
}, t("column action sort ascending")), isCurrentColumnSorted && /* @__PURE__ */ import_react2.default.createElement(import_react_ui2.DropdownMenu.Item, {
|
|
167
171
|
"data-testid": "column-clear-sort",
|
|
168
172
|
onClick: () => model.sorting?.clearSort()
|
|
169
|
-
}, t("column action clear sorting")), model.getColumnCount() > 1 && /* @__PURE__ */ import_react2.default.createElement(import_react_ui2.DropdownMenu.Item, {
|
|
173
|
+
}, t("column action clear sorting")), model.getColumnCount() > 1 && model.features.schemaEditable && /* @__PURE__ */ import_react2.default.createElement(import_react_ui2.DropdownMenu.Item, {
|
|
170
174
|
"data-testid": "column-delete",
|
|
171
175
|
onClick: () => model.deleteColumn(state.fieldId)
|
|
172
|
-
}, t("column action delete")), /* @__PURE__ */ import_react2.default.createElement(import_react_ui2.DropdownMenu.Item, {
|
|
176
|
+
}, t("column action delete")), model.features.schemaEditable && /* @__PURE__ */ import_react2.default.createElement(import_react_ui2.DropdownMenu.Item, {
|
|
173
177
|
"data-testid": "column-settings",
|
|
174
178
|
onClick: () => modals.openColumnSettings()
|
|
175
179
|
}, t("column action settings"))), /* @__PURE__ */ import_react2.default.createElement(import_react_ui2.DropdownMenu.Arrow, null))));
|
|
@@ -177,7 +181,7 @@ var ColumnActionsMenu = ({ model, modals }) => {
|
|
|
177
181
|
var ColumnSettings = ({ model, modals, onNewColumn }) => {
|
|
178
182
|
const [newField, setNewField] = (0, import_react3.useState)();
|
|
179
183
|
const state = modals.state.value;
|
|
180
|
-
const space =
|
|
184
|
+
const space = model?.space;
|
|
181
185
|
(0, import_react3.useEffect)(() => {
|
|
182
186
|
if (state?.type === "columnSettings" && state.mode.type === "create" && model?.projection) {
|
|
183
187
|
setNewField(model.projection.createFieldProjection());
|
|
@@ -195,12 +199,12 @@ var ColumnSettings = ({ model, modals, onNewColumn }) => {
|
|
|
195
199
|
if (state?.type === "columnSettings") {
|
|
196
200
|
const { mode } = state;
|
|
197
201
|
if (mode.type === "edit") {
|
|
198
|
-
return model?.
|
|
202
|
+
return model?.view?.fields.find((f) => f.id === mode.fieldId);
|
|
199
203
|
}
|
|
200
204
|
}
|
|
201
205
|
return void 0;
|
|
202
206
|
}, [
|
|
203
|
-
model?.
|
|
207
|
+
model?.view?.fields,
|
|
204
208
|
state
|
|
205
209
|
]);
|
|
206
210
|
const field = existingField ?? newField;
|
|
@@ -218,7 +222,7 @@ var ColumnSettings = ({ model, modals, onNewColumn }) => {
|
|
|
218
222
|
state,
|
|
219
223
|
newField
|
|
220
224
|
]);
|
|
221
|
-
if (!model?.
|
|
225
|
+
if (!model?.view || !model.projection || !field) {
|
|
222
226
|
return null;
|
|
223
227
|
}
|
|
224
228
|
return /* @__PURE__ */ import_react3.default.createElement(import_react_ui3.DropdownMenu.Root, {
|
|
@@ -229,7 +233,7 @@ var ColumnSettings = ({ model, modals, onNewColumn }) => {
|
|
|
229
233
|
}), /* @__PURE__ */ import_react3.default.createElement(import_react_ui3.DropdownMenu.Portal, null, /* @__PURE__ */ import_react3.default.createElement(import_react_ui3.DropdownMenu.Content, {
|
|
230
234
|
classNames: "md:is-64"
|
|
231
235
|
}, /* @__PURE__ */ import_react3.default.createElement(import_react_ui3.DropdownMenu.Viewport, null, /* @__PURE__ */ import_react3.default.createElement(import_react_ui_form.FieldEditor, {
|
|
232
|
-
view: model.
|
|
236
|
+
view: model.view,
|
|
233
237
|
projection: model.projection,
|
|
234
238
|
field,
|
|
235
239
|
registry: space?.db.schemaRegistry,
|
|
@@ -239,7 +243,7 @@ var ColumnSettings = ({ model, modals, onNewColumn }) => {
|
|
|
239
243
|
};
|
|
240
244
|
var CreateRefPanel = ({ model, modals, __gridScope }) => {
|
|
241
245
|
const { id: gridId } = (0, import_react_ui_grid2.useGridContext)("TableCellEditor", __gridScope);
|
|
242
|
-
const space =
|
|
246
|
+
const space = model?.space;
|
|
243
247
|
const state = modals.state.value;
|
|
244
248
|
const schema = (0, import_react4.useMemo)(() => {
|
|
245
249
|
if (!space || state?.type !== "createRefPanel") {
|
|
@@ -264,7 +268,7 @@ var CreateRefPanel = ({ model, modals, __gridScope }) => {
|
|
|
264
268
|
typename: state.typename
|
|
265
269
|
}).runSync();
|
|
266
270
|
if (schema2) {
|
|
267
|
-
const obj = space.db.add((0,
|
|
271
|
+
const obj = space.db.add((0, import_echo2.create)(schema2, values));
|
|
268
272
|
state.onCreate?.(obj);
|
|
269
273
|
}
|
|
270
274
|
void modals.close();
|
|
@@ -280,7 +284,7 @@ var CreateRefPanel = ({ model, modals, __gridScope }) => {
|
|
|
280
284
|
}, [
|
|
281
285
|
modals
|
|
282
286
|
]);
|
|
283
|
-
if (!model?.
|
|
287
|
+
if (!model?.view || !model.projection) {
|
|
284
288
|
return null;
|
|
285
289
|
}
|
|
286
290
|
return /* @__PURE__ */ import_react4.default.createElement(import_react_ui4.Popover.Root, {
|
|
@@ -312,10 +316,10 @@ var getRefTargetObj = (space, id) => {
|
|
|
312
316
|
};
|
|
313
317
|
var RefPanel = ({ model, modals }) => {
|
|
314
318
|
const state = modals.state.value;
|
|
315
|
-
const space =
|
|
319
|
+
const space = model?.space;
|
|
316
320
|
const targetObj = getRefTargetObj(space, state?.type === "refPanel" ? state.targetId : void 0);
|
|
317
321
|
const schema = space && state?.type === "refPanel" ? space.db.schemaRegistry.getSchema(state.typename) : void 0;
|
|
318
|
-
if (!model.
|
|
322
|
+
if (!model.view || !model.projection) {
|
|
319
323
|
return null;
|
|
320
324
|
}
|
|
321
325
|
return /* @__PURE__ */ import_react5.default.createElement(import_react_ui5.Popover.Root, {
|
|
@@ -349,22 +353,78 @@ var RowActionsMenu = ({ model, modals }) => {
|
|
|
349
353
|
onOpenChange: modals.close
|
|
350
354
|
}, /* @__PURE__ */ import_react6.default.createElement(import_react_ui6.DropdownMenu.VirtualTrigger, {
|
|
351
355
|
virtualRef: modals.trigger
|
|
352
|
-
}), /* @__PURE__ */ import_react6.default.createElement(import_react_ui6.DropdownMenu.Content, null, /* @__PURE__ */ import_react6.default.createElement(import_react_ui6.DropdownMenu.Viewport, null, /* @__PURE__ */ import_react6.default.createElement(import_react_ui6.DropdownMenu.Item, {
|
|
356
|
+
}), /* @__PURE__ */ import_react6.default.createElement(import_react_ui6.DropdownMenu.Content, null, /* @__PURE__ */ import_react6.default.createElement(import_react_ui6.DropdownMenu.Viewport, null, model.features.dataEditable !== false && /* @__PURE__ */ import_react6.default.createElement(import_react_ui6.DropdownMenu.Item, {
|
|
353
357
|
"data-testid": "row-menu-delete",
|
|
354
358
|
onClick: () => model.deleteRow(state.rowIndex)
|
|
355
|
-
}, t(hasSelection ? "bulk delete row label" : "delete row label"))
|
|
359
|
+
}, t(hasSelection ? "bulk delete row label" : "delete row label")), model.rowActions?.map((action) => /* @__PURE__ */ import_react6.default.createElement(import_react_ui6.DropdownMenu.Item, {
|
|
360
|
+
key: action.id,
|
|
361
|
+
"data-testid": `row-action-${action.id}`,
|
|
362
|
+
onClick: () => {
|
|
363
|
+
modals.close();
|
|
364
|
+
model.handleRowAction(action.id, state.rowIndex);
|
|
365
|
+
}
|
|
366
|
+
}, t(action.translationKey)))), /* @__PURE__ */ import_react6.default.createElement(import_react_ui6.DropdownMenu.Arrow, null)));
|
|
367
|
+
};
|
|
368
|
+
var makeDynamicTable = (typename, properties) => {
|
|
369
|
+
const table = (0, import_live_object2.create)(import_chunk_NRFKBRPV.TableType, {
|
|
370
|
+
name: "dynamic-table"
|
|
371
|
+
});
|
|
372
|
+
const echoSchema = (0, import_schema.echoSchemaFromPropertyDefinitions)(typename, properties);
|
|
373
|
+
const propertyNames = properties.map((property) => property.name);
|
|
374
|
+
const view = (0, import_schema.createView)({
|
|
375
|
+
name: "dynamic-table",
|
|
376
|
+
typename: echoSchema.typename,
|
|
377
|
+
jsonSchema: echoSchema.jsonSchema,
|
|
378
|
+
fields: propertyNames
|
|
379
|
+
});
|
|
380
|
+
table.view = (0, import_live_object2.makeRef)(view);
|
|
381
|
+
const viewProjection = new import_schema.ViewProjection(echoSchema, view);
|
|
382
|
+
for (const property of properties) {
|
|
383
|
+
if (!view.fields) {
|
|
384
|
+
continue;
|
|
385
|
+
}
|
|
386
|
+
const field = view.fields.find((field2) => field2.path === property.name);
|
|
387
|
+
if (field) {
|
|
388
|
+
if (property.size !== void 0) {
|
|
389
|
+
field.size = property.size;
|
|
390
|
+
}
|
|
391
|
+
if (property.title !== void 0) {
|
|
392
|
+
const fieldProjection = viewProjection.getFieldProjection(field.id);
|
|
393
|
+
viewProjection.setFieldProjection({
|
|
394
|
+
...fieldProjection,
|
|
395
|
+
props: {
|
|
396
|
+
...fieldProjection.props,
|
|
397
|
+
title: property.title
|
|
398
|
+
}
|
|
399
|
+
});
|
|
400
|
+
}
|
|
401
|
+
if (property.sort) {
|
|
402
|
+
const fieldId = field.id;
|
|
403
|
+
view.query.sort = [
|
|
404
|
+
{
|
|
405
|
+
fieldId,
|
|
406
|
+
direction: property.sort
|
|
407
|
+
}
|
|
408
|
+
];
|
|
409
|
+
}
|
|
410
|
+
}
|
|
411
|
+
}
|
|
412
|
+
return {
|
|
413
|
+
table,
|
|
414
|
+
schema: echoSchema,
|
|
415
|
+
view,
|
|
416
|
+
viewProjection
|
|
417
|
+
};
|
|
356
418
|
};
|
|
357
419
|
var touch = (value) => value;
|
|
358
|
-
var initializeTable = async ({ space, table, initialRow = true
|
|
359
|
-
if (
|
|
360
|
-
const schema = await space.db.
|
|
361
|
-
typename: initialSchema
|
|
362
|
-
}).firstOrUndefined();
|
|
420
|
+
var initializeTable = async ({ client, space, table, typename, initialRow = true }) => {
|
|
421
|
+
if (typename) {
|
|
422
|
+
const schema = await space.db.graph.getSchemaByTypename(typename, space.db);
|
|
363
423
|
if (!schema) {
|
|
364
|
-
throw new Error(`Schema not found: ${
|
|
424
|
+
throw new Error(`Schema not found: ${typename}`);
|
|
365
425
|
}
|
|
366
|
-
const fields = (0,
|
|
367
|
-
table.view = (0,
|
|
426
|
+
const fields = (0, import_schema2.getSchemaProperties)(schema.ast).filter((prop) => prop.format !== import_echo_schema4.FormatEnum.Ref).map((prop) => prop.name);
|
|
427
|
+
table.view = (0, import_echo3.makeRef)((0, import_schema2.createView)({
|
|
368
428
|
// TODO(ZaymonFC): Don't hardcode name?
|
|
369
429
|
name: "View",
|
|
370
430
|
typename: schema.typename,
|
|
@@ -373,68 +433,74 @@ var initializeTable = async ({ space, table, initialRow = true, initialSchema })
|
|
|
373
433
|
}));
|
|
374
434
|
return schema;
|
|
375
435
|
} else {
|
|
376
|
-
const
|
|
377
|
-
typename: `example.com/type/${import_react_client2.PublicKey.random().truncate()}`,
|
|
378
|
-
version: "0.1.0"
|
|
379
|
-
})({
|
|
380
|
-
name: import_echo_schema4.S.optional(import_echo_schema4.S.String).annotations({
|
|
381
|
-
[import_echo_schema4.AST.TitleAnnotationId]: "Name"
|
|
382
|
-
}),
|
|
383
|
-
active: import_echo_schema4.S.optional(import_echo_schema4.S.Boolean),
|
|
384
|
-
email: import_echo_schema4.S.optional(import_echo_schema4.Format.Email),
|
|
385
|
-
salary: import_echo_schema4.S.optional(import_echo_schema4.Format.Currency()).annotations({
|
|
386
|
-
[import_echo_schema4.AST.TitleAnnotationId]: "Salary"
|
|
387
|
-
})
|
|
388
|
-
});
|
|
389
|
-
const [contactSchema] = await space.db.schemaRegistry.register([
|
|
436
|
+
const [schema] = await space.db.schemaRegistry.register([
|
|
390
437
|
ContactSchema
|
|
391
438
|
]);
|
|
392
|
-
|
|
439
|
+
const fields = ContactFields;
|
|
440
|
+
table.view = (0, import_echo3.makeRef)((0, import_schema2.createView)({
|
|
393
441
|
name: "View",
|
|
394
|
-
typename:
|
|
395
|
-
jsonSchema:
|
|
396
|
-
fields
|
|
397
|
-
"name",
|
|
398
|
-
"email",
|
|
399
|
-
"salary",
|
|
400
|
-
"active"
|
|
401
|
-
]
|
|
442
|
+
typename: schema.typename,
|
|
443
|
+
jsonSchema: schema.jsonSchema,
|
|
444
|
+
fields
|
|
402
445
|
}));
|
|
403
|
-
|
|
404
|
-
projection.setFieldProjection({
|
|
405
|
-
field: {
|
|
406
|
-
id: table.view.target.fields.find((f) => f.path === "salary").id,
|
|
407
|
-
path: "salary",
|
|
408
|
-
size: 150
|
|
409
|
-
}
|
|
410
|
-
});
|
|
411
|
-
projection.setFieldProjection({
|
|
412
|
-
field: {
|
|
413
|
-
id: table.view.target.fields.find((f) => f.path === "active").id,
|
|
414
|
-
path: "active",
|
|
415
|
-
size: 100
|
|
416
|
-
}
|
|
417
|
-
});
|
|
418
|
-
projection.setFieldProjection({
|
|
419
|
-
field: {
|
|
420
|
-
id: (0, import_schema.createFieldId)(),
|
|
421
|
-
path: "manager",
|
|
422
|
-
referencePath: "name"
|
|
423
|
-
},
|
|
424
|
-
props: {
|
|
425
|
-
property: "manager",
|
|
426
|
-
type: import_echo_schema4.TypeEnum.Ref,
|
|
427
|
-
format: import_echo_schema4.FormatEnum.Ref,
|
|
428
|
-
referenceSchema: contactSchema.typename,
|
|
429
|
-
title: "Manager"
|
|
430
|
-
}
|
|
431
|
-
});
|
|
446
|
+
createProjection(schema, table.view.target);
|
|
432
447
|
if (initialRow) {
|
|
433
|
-
space.db.add((0,
|
|
448
|
+
space.db.add((0, import_echo3.create)(schema, {}));
|
|
434
449
|
}
|
|
435
|
-
return
|
|
450
|
+
return schema;
|
|
436
451
|
}
|
|
437
452
|
};
|
|
453
|
+
var ContactSchema = (0, import_echo_schema4.TypedObject)({
|
|
454
|
+
typename: `example.com/type/${import_react_client.PublicKey.random().truncate()}`,
|
|
455
|
+
version: "0.1.0"
|
|
456
|
+
})({
|
|
457
|
+
name: import_echo_schema4.S.optional(import_echo_schema4.S.String).annotations({
|
|
458
|
+
[import_echo_schema4.AST.TitleAnnotationId]: "Name"
|
|
459
|
+
}),
|
|
460
|
+
active: import_echo_schema4.S.optional(import_echo_schema4.S.Boolean),
|
|
461
|
+
email: import_echo_schema4.S.optional(import_echo_schema4.Format.Email),
|
|
462
|
+
salary: import_echo_schema4.S.optional(import_echo_schema4.Format.Currency()).annotations({
|
|
463
|
+
[import_echo_schema4.AST.TitleAnnotationId]: "Salary"
|
|
464
|
+
})
|
|
465
|
+
});
|
|
466
|
+
var ContactFields = [
|
|
467
|
+
"name",
|
|
468
|
+
"email",
|
|
469
|
+
"salary",
|
|
470
|
+
"active"
|
|
471
|
+
];
|
|
472
|
+
var createProjection = (schema, view) => {
|
|
473
|
+
const projection = new import_schema2.ViewProjection(schema, view);
|
|
474
|
+
projection.setFieldProjection({
|
|
475
|
+
field: {
|
|
476
|
+
id: view.fields.find((f) => f.path === "salary").id,
|
|
477
|
+
path: "salary",
|
|
478
|
+
size: 150
|
|
479
|
+
}
|
|
480
|
+
});
|
|
481
|
+
projection.setFieldProjection({
|
|
482
|
+
field: {
|
|
483
|
+
id: view.fields.find((f) => f.path === "active").id,
|
|
484
|
+
path: "active",
|
|
485
|
+
size: 100
|
|
486
|
+
}
|
|
487
|
+
});
|
|
488
|
+
projection.setFieldProjection({
|
|
489
|
+
field: {
|
|
490
|
+
id: (0, import_schema2.createFieldId)(),
|
|
491
|
+
path: "manager",
|
|
492
|
+
referencePath: "name"
|
|
493
|
+
},
|
|
494
|
+
props: {
|
|
495
|
+
property: "manager",
|
|
496
|
+
type: import_echo_schema4.TypeEnum.Ref,
|
|
497
|
+
format: import_echo_schema4.FormatEnum.Ref,
|
|
498
|
+
referenceSchema: schema.typename,
|
|
499
|
+
title: "Manager"
|
|
500
|
+
}
|
|
501
|
+
});
|
|
502
|
+
return projection;
|
|
503
|
+
};
|
|
438
504
|
var BUTTON_IDENTIFIERS = {
|
|
439
505
|
columnSettings: "data-table-column-settings-button",
|
|
440
506
|
newColumn: "data-table-new-column-button",
|
|
@@ -839,13 +905,17 @@ var TableSorting = class {
|
|
|
839
905
|
}
|
|
840
906
|
};
|
|
841
907
|
var __dxlog_file = "/home/runner/work/dxos/dxos/packages/ui/react-ui-table/src/model/table-model.ts";
|
|
908
|
+
var defaultFeatures = {
|
|
909
|
+
selection: true,
|
|
910
|
+
dataEditable: false,
|
|
911
|
+
schemaEditable: false
|
|
912
|
+
};
|
|
842
913
|
var TableModel = class extends import_context.Resource {
|
|
843
|
-
constructor({
|
|
914
|
+
constructor({ id, space, view, projection, features = {}, sorting = [], pinnedRows = {
|
|
844
915
|
top: [],
|
|
845
916
|
bottom: []
|
|
846
|
-
}, onCellUpdate, onDeleteColumn, onDeleteRows, onInsertRow, onRowOrderChanged }) {
|
|
917
|
+
}, onCellUpdate, onDeleteColumn, onDeleteRows, onInsertRow, onRowOrderChanged, rowActions = [], onRowAction }) {
|
|
847
918
|
super();
|
|
848
|
-
this.id = `table-model-${import_react_client.PublicKey.random().truncate()}`;
|
|
849
919
|
this._visibleRange = (0, import_signals_core.signal)({
|
|
850
920
|
start: {
|
|
851
921
|
row: 0,
|
|
@@ -861,7 +931,7 @@ var TableModel = class extends import_context.Resource {
|
|
|
861
931
|
this._rows.value = obj;
|
|
862
932
|
};
|
|
863
933
|
this.getRowCount = () => this._rows.value.length;
|
|
864
|
-
this.getColumnCount = () => this.
|
|
934
|
+
this.getColumnCount = () => this._view?.fields.length ?? 0;
|
|
865
935
|
this.insertRow = (rowIndex) => {
|
|
866
936
|
const row = rowIndex !== void 0 ? this._sorting.getDataIndex(rowIndex) : this._rows.value.length;
|
|
867
937
|
this._onInsertRow?.(row);
|
|
@@ -878,8 +948,18 @@ var TableModel = class extends import_context.Resource {
|
|
|
878
948
|
}
|
|
879
949
|
this._onDeleteRows?.(row, objectsToDelete);
|
|
880
950
|
};
|
|
951
|
+
this.handleRowAction = (actionId, rowIndex) => {
|
|
952
|
+
if (!this._onRowAction) {
|
|
953
|
+
return;
|
|
954
|
+
}
|
|
955
|
+
const row = this._sorting.getDataIndex(rowIndex);
|
|
956
|
+
const data = this._rows.value[row];
|
|
957
|
+
if (data) {
|
|
958
|
+
this._onRowAction(actionId, data);
|
|
959
|
+
}
|
|
960
|
+
};
|
|
881
961
|
this.getCellData = ({ col, row }) => {
|
|
882
|
-
const fields = this.
|
|
962
|
+
const fields = this._view?.fields ?? [];
|
|
883
963
|
if (col < 0 || col >= fields.length) {
|
|
884
964
|
return void 0;
|
|
885
965
|
}
|
|
@@ -908,7 +988,7 @@ var TableModel = class extends import_context.Resource {
|
|
|
908
988
|
};
|
|
909
989
|
this.setCellData = ({ col, row }, value) => {
|
|
910
990
|
const rowIdx = this._sorting.getDataIndex(row);
|
|
911
|
-
const fields = this.
|
|
991
|
+
const fields = this._view?.fields ?? [];
|
|
912
992
|
if (col < 0 || col >= fields.length) {
|
|
913
993
|
return;
|
|
914
994
|
}
|
|
@@ -931,9 +1011,15 @@ var TableModel = class extends import_context.Resource {
|
|
|
931
1011
|
}
|
|
932
1012
|
}
|
|
933
1013
|
};
|
|
934
|
-
this.
|
|
1014
|
+
this._id = id;
|
|
1015
|
+
this._space = space;
|
|
1016
|
+
this._view = view;
|
|
935
1017
|
this._projection = projection;
|
|
936
|
-
this.
|
|
1018
|
+
this._features = {
|
|
1019
|
+
...defaultFeatures,
|
|
1020
|
+
...features
|
|
1021
|
+
};
|
|
1022
|
+
this._sorting = new TableSorting(this._rows, this._view, projection);
|
|
937
1023
|
if (sorting.length > 0) {
|
|
938
1024
|
const [sort] = sorting;
|
|
939
1025
|
this._sorting.setSort(sort.fieldId, sort.direction);
|
|
@@ -944,9 +1030,17 @@ var TableModel = class extends import_context.Resource {
|
|
|
944
1030
|
this._onDeleteColumn = onDeleteColumn;
|
|
945
1031
|
this._onCellUpdate = onCellUpdate;
|
|
946
1032
|
this._onRowOrderChanged = onRowOrderChanged;
|
|
1033
|
+
this._rowActions = rowActions;
|
|
1034
|
+
this._onRowAction = onRowAction;
|
|
1035
|
+
}
|
|
1036
|
+
get id() {
|
|
1037
|
+
return this._id;
|
|
947
1038
|
}
|
|
948
|
-
get
|
|
949
|
-
return this.
|
|
1039
|
+
get space() {
|
|
1040
|
+
return this._space;
|
|
1041
|
+
}
|
|
1042
|
+
get view() {
|
|
1043
|
+
return this._view;
|
|
950
1044
|
}
|
|
951
1045
|
get projection() {
|
|
952
1046
|
return this._projection;
|
|
@@ -954,19 +1048,31 @@ var TableModel = class extends import_context.Resource {
|
|
|
954
1048
|
get rows() {
|
|
955
1049
|
return this._sorting.sortedRows;
|
|
956
1050
|
}
|
|
1051
|
+
get features() {
|
|
1052
|
+
return this._features;
|
|
1053
|
+
}
|
|
957
1054
|
/**
|
|
958
1055
|
* @reactive
|
|
959
1056
|
*/
|
|
960
1057
|
get sorting() {
|
|
961
1058
|
return this._sorting;
|
|
962
1059
|
}
|
|
1060
|
+
/**
|
|
1061
|
+
* Gets the row data at the specified display index.
|
|
1062
|
+
*/
|
|
1063
|
+
getRowAt(displayIndex) {
|
|
1064
|
+
if (displayIndex < 0 || displayIndex >= this._sorting.sortedRows.value.length) {
|
|
1065
|
+
return void 0;
|
|
1066
|
+
}
|
|
1067
|
+
return this._sorting.sortedRows.value[displayIndex];
|
|
1068
|
+
}
|
|
963
1069
|
get pinnedRows() {
|
|
964
1070
|
return this._pinnedRows;
|
|
965
1071
|
}
|
|
966
1072
|
get columnMeta() {
|
|
967
1073
|
(0, import_invariant2.invariant)(this._columnMeta, void 0, {
|
|
968
1074
|
F: __dxlog_file,
|
|
969
|
-
L:
|
|
1075
|
+
L: 176,
|
|
970
1076
|
S: this,
|
|
971
1077
|
A: [
|
|
972
1078
|
"this._columnMeta",
|
|
@@ -982,6 +1088,9 @@ var TableModel = class extends import_context.Resource {
|
|
|
982
1088
|
get isViewDirty() {
|
|
983
1089
|
return this._sorting.isDirty;
|
|
984
1090
|
}
|
|
1091
|
+
get rowActions() {
|
|
1092
|
+
return this._rowActions;
|
|
1093
|
+
}
|
|
985
1094
|
//
|
|
986
1095
|
// Initialisation
|
|
987
1096
|
//
|
|
@@ -993,7 +1102,7 @@ var TableModel = class extends import_context.Resource {
|
|
|
993
1102
|
}
|
|
994
1103
|
initializeColumnMeta() {
|
|
995
1104
|
this._columnMeta = (0, import_signals_core.computed)(() => {
|
|
996
|
-
const fields = this.
|
|
1105
|
+
const fields = this._view?.fields ?? [];
|
|
997
1106
|
const meta = Object.fromEntries(fields.map((field, index) => [
|
|
998
1107
|
index,
|
|
999
1108
|
{
|
|
@@ -1030,7 +1139,7 @@ var TableModel = class extends import_context.Resource {
|
|
|
1030
1139
|
for (let row = start.row; row <= end.row; row++) {
|
|
1031
1140
|
rowEffects.push((0, import_signals_core.effect)(() => {
|
|
1032
1141
|
const obj = this._sorting.sortedRows.value[row];
|
|
1033
|
-
this?.
|
|
1142
|
+
this._view?.fields.forEach((field) => touch((0, import_echo_schema3.getValue)(obj, field.path)));
|
|
1034
1143
|
this._onCellUpdate?.({
|
|
1035
1144
|
row,
|
|
1036
1145
|
col: start.col,
|
|
@@ -1049,7 +1158,7 @@ var TableModel = class extends import_context.Resource {
|
|
|
1049
1158
|
*/
|
|
1050
1159
|
updateCellData({ col, row }, update) {
|
|
1051
1160
|
const dataRow = this._sorting.getDataIndex(row);
|
|
1052
|
-
const fields = this.
|
|
1161
|
+
const fields = this._view?.fields ?? [];
|
|
1053
1162
|
const field = fields[col];
|
|
1054
1163
|
const value = (0, import_echo_schema3.getValue)(this._rows.value[dataRow], field.path);
|
|
1055
1164
|
const updatedValue = update(value);
|
|
@@ -1059,10 +1168,10 @@ var TableModel = class extends import_context.Resource {
|
|
|
1059
1168
|
// Column Operations
|
|
1060
1169
|
//
|
|
1061
1170
|
deleteColumn(fieldId) {
|
|
1062
|
-
if (!this.
|
|
1171
|
+
if (!this._view) {
|
|
1063
1172
|
return;
|
|
1064
1173
|
}
|
|
1065
|
-
const field = this.
|
|
1174
|
+
const field = this._view?.fields.find((field2) => field2.id === fieldId);
|
|
1066
1175
|
if (field && this._onDeleteColumn) {
|
|
1067
1176
|
this._onDeleteColumn(field.id);
|
|
1068
1177
|
}
|
|
@@ -1071,7 +1180,7 @@ var TableModel = class extends import_context.Resource {
|
|
|
1071
1180
|
// Resize
|
|
1072
1181
|
//
|
|
1073
1182
|
setColumnWidth(columnIndex, width) {
|
|
1074
|
-
const fields = this.
|
|
1183
|
+
const fields = this._view?.fields ?? [];
|
|
1075
1184
|
if (columnIndex < fields.length) {
|
|
1076
1185
|
const newWidth = Math.max(0, width);
|
|
1077
1186
|
const field = fields[columnIndex];
|
|
@@ -1197,27 +1306,40 @@ var TablePresentation = class {
|
|
|
1197
1306
|
this._visibleRange = _visibleRange;
|
|
1198
1307
|
}
|
|
1199
1308
|
getCells(range, plane) {
|
|
1309
|
+
let cells;
|
|
1200
1310
|
switch (plane) {
|
|
1201
1311
|
case "grid":
|
|
1202
1312
|
this._visibleRange.value = range;
|
|
1203
|
-
|
|
1313
|
+
cells = this.getMainGridCells(range);
|
|
1314
|
+
break;
|
|
1204
1315
|
case "frozenRowsStart":
|
|
1205
|
-
|
|
1316
|
+
cells = this.getHeaderCells(range);
|
|
1317
|
+
break;
|
|
1206
1318
|
case "frozenColsStart":
|
|
1207
|
-
|
|
1319
|
+
cells = this.getSelectionColumnCells(range);
|
|
1320
|
+
break;
|
|
1208
1321
|
case "frozenColsEnd":
|
|
1209
|
-
|
|
1322
|
+
cells = this.getActionColumnCells(range);
|
|
1323
|
+
break;
|
|
1210
1324
|
case "fixedStartStart":
|
|
1211
|
-
|
|
1325
|
+
cells = this.getSelectAllCell();
|
|
1326
|
+
break;
|
|
1212
1327
|
case "fixedStartEnd":
|
|
1213
|
-
|
|
1328
|
+
cells = this.getNewColumnCell();
|
|
1329
|
+
break;
|
|
1214
1330
|
default:
|
|
1215
|
-
|
|
1331
|
+
cells = {};
|
|
1216
1332
|
}
|
|
1333
|
+
if (plane === "grid" && this.model.features.dataEditable === false) {
|
|
1334
|
+
Object.values(cells).forEach((cell) => {
|
|
1335
|
+
cell.readonly = true;
|
|
1336
|
+
});
|
|
1337
|
+
}
|
|
1338
|
+
return cells;
|
|
1217
1339
|
}
|
|
1218
1340
|
getMainGridCells(range) {
|
|
1219
1341
|
const cells = {};
|
|
1220
|
-
const fields = this.model.
|
|
1342
|
+
const fields = this.model.view?.fields ?? [];
|
|
1221
1343
|
const addCell = (obj, field, colIndex, displayIndex) => {
|
|
1222
1344
|
const { props } = this.model.projection.getFieldProjection(field.id);
|
|
1223
1345
|
const cell = {
|
|
@@ -1309,7 +1431,7 @@ var TablePresentation = class {
|
|
|
1309
1431
|
}
|
|
1310
1432
|
getHeaderCells(range) {
|
|
1311
1433
|
const cells = {};
|
|
1312
|
-
const fields = this.model.
|
|
1434
|
+
const fields = this.model.view?.fields ?? [];
|
|
1313
1435
|
for (let col = range.start.col; col <= range.end.col && col < fields.length; col++) {
|
|
1314
1436
|
const { field, props } = this.model.projection.getFieldProjection(fields[col].id);
|
|
1315
1437
|
const sorting = this.model.sorting?.sorting;
|
|
@@ -1398,9 +1520,9 @@ var TablePresentation = class {
|
|
|
1398
1520
|
col: 0,
|
|
1399
1521
|
row: 0
|
|
1400
1522
|
})]: {
|
|
1401
|
-
accessoryHtml: tableButtons.addColumn.render({
|
|
1402
|
-
disabled: (this.model.
|
|
1403
|
-
}),
|
|
1523
|
+
accessoryHtml: this.model.features.schemaEditable ? tableButtons.addColumn.render({
|
|
1524
|
+
disabled: (this.model.view?.fields?.length ?? 0) >= import_schema3.VIEW_FIELD_LIMIT
|
|
1525
|
+
}) : void 0,
|
|
1404
1526
|
className: "!bg-gridHeader",
|
|
1405
1527
|
readonly: true,
|
|
1406
1528
|
value: ""
|
|
@@ -1612,22 +1734,24 @@ var determineNavigationDelta = ({ key, shift }) => {
|
|
|
1612
1734
|
var __dxlog_file4 = "/home/runner/work/dxos/dxos/packages/ui/react-ui-table/src/components/Table/Table.tsx";
|
|
1613
1735
|
var inlineEndLine = "[&>.dx-grid]:relative [&>.dx-grid]:after:absolute [&>.dx-grid]:after:inset-block-0 [&>.dx-grid]:after:-inline-end-px [&>.dx-grid]:after:is-px [&>.dx-grid]:after:bg-separator";
|
|
1614
1736
|
var blockEndLine = "[&>.dx-grid]:before:absolute [&>.dx-grid]:before:inset-inline-0 [&>.dx-grid]:before:-block-end-px [&>.dx-grid]:before:bs-px [&>.dx-grid]:before:bg-separator";
|
|
1615
|
-
var frozen = {
|
|
1616
|
-
frozenRowsStart: 1,
|
|
1617
|
-
frozenColsStart: 1,
|
|
1618
|
-
frozenColsEnd: 1
|
|
1619
|
-
};
|
|
1620
1737
|
var TableRoot = ({ children, role }) => {
|
|
1621
1738
|
return /* @__PURE__ */ import_react.default.createElement("div", {
|
|
1622
1739
|
role: "none",
|
|
1623
1740
|
className: (0, import_react_ui_theme.mx)("relative border-bs !border-separator", role === "section" ? "attention-surface overflow-hidden [&_.dx-grid]:max-is-[--dx-grid-content-inline-size]" : "flex flex-col [&_.dx-grid]:grow [&_.dx-grid]:max-is-[--dx-grid-content-inline-size] [&_.dx-grid]:bs-0 [&_.dx-grid]:max-bs-[--dx-grid-content-block-size]")
|
|
1624
1741
|
}, children);
|
|
1625
1742
|
};
|
|
1626
|
-
var TableMain = /* @__PURE__ */ (0, import_react.forwardRef)(({ model, presentation, ignoreAttention }, forwardedRef) => {
|
|
1743
|
+
var TableMain = /* @__PURE__ */ (0, import_react.forwardRef)(({ model, presentation, ignoreAttention, onRowClicked }, forwardedRef) => {
|
|
1627
1744
|
const [dxGrid, setDxGrid] = (0, import_react.useState)(null);
|
|
1628
|
-
const { hasAttention } = (0, import_react_ui_attention.useAttention)(model?.
|
|
1745
|
+
const { hasAttention } = (0, import_react_ui_attention.useAttention)(model?.id ?? "table");
|
|
1629
1746
|
const { t } = (0, import_react_ui.useTranslation)(translationKey);
|
|
1630
1747
|
const modals = (0, import_react.useMemo)(() => new ModalController(), []);
|
|
1748
|
+
const frozen = (0, import_react.useMemo)(() => ({
|
|
1749
|
+
frozenRowsStart: 1,
|
|
1750
|
+
frozenColsStart: model?.features.selection ? 1 : 0,
|
|
1751
|
+
frozenColsEnd: 1
|
|
1752
|
+
}), [
|
|
1753
|
+
model
|
|
1754
|
+
]);
|
|
1631
1755
|
(0, import_react.useImperativeHandle)(forwardedRef, () => {
|
|
1632
1756
|
if (!presentation || !dxGrid) {
|
|
1633
1757
|
return {};
|
|
@@ -1648,6 +1772,13 @@ var TableMain = /* @__PURE__ */ (0, import_react.forwardRef)(({ model, presentat
|
|
|
1648
1772
|
dxGrid
|
|
1649
1773
|
]);
|
|
1650
1774
|
const handleGridClick = (0, import_react.useCallback)((event) => {
|
|
1775
|
+
if (onRowClicked) {
|
|
1776
|
+
const rowIndex = (0, import_util.safeParseInt)(event.target.ariaRowIndex ?? "");
|
|
1777
|
+
if (rowIndex != null) {
|
|
1778
|
+
const row = model?.getRowAt(rowIndex);
|
|
1779
|
+
row && onRowClicked(row);
|
|
1780
|
+
}
|
|
1781
|
+
}
|
|
1651
1782
|
if (!modals) {
|
|
1652
1783
|
return;
|
|
1653
1784
|
}
|
|
@@ -1724,6 +1855,9 @@ var TableMain = /* @__PURE__ */ (0, import_react.forwardRef)(({ model, presentat
|
|
|
1724
1855
|
dxGrid
|
|
1725
1856
|
]);
|
|
1726
1857
|
const handleEnter = (0, import_react.useCallback)((cell) => {
|
|
1858
|
+
if (!model?.features.dataEditable) {
|
|
1859
|
+
return;
|
|
1860
|
+
}
|
|
1727
1861
|
if (model && cell.row === model.getRowCount() - 1) {
|
|
1728
1862
|
model.insertRow(cell.row);
|
|
1729
1863
|
if (dxGrid) {
|
|
@@ -1738,6 +1872,9 @@ var TableMain = /* @__PURE__ */ (0, import_react.forwardRef)(({ model, presentat
|
|
|
1738
1872
|
dxGrid
|
|
1739
1873
|
]);
|
|
1740
1874
|
const handleKeyDown = (0, import_react.useCallback)((event) => {
|
|
1875
|
+
if (!model?.features.dataEditable) {
|
|
1876
|
+
return;
|
|
1877
|
+
}
|
|
1741
1878
|
const cell = (0, import_react_ui_grid.closestCell)(event.target);
|
|
1742
1879
|
if (!model || !cell) {
|
|
1743
1880
|
return;
|
|
@@ -1779,10 +1916,10 @@ var TableMain = /* @__PURE__ */ (0, import_react.forwardRef)(({ model, presentat
|
|
|
1779
1916
|
]);
|
|
1780
1917
|
const handleQuery = (0, import_react.useCallback)(async ({ field, props }, text) => {
|
|
1781
1918
|
if (model && props.referenceSchema && field.referencePath) {
|
|
1782
|
-
const space =
|
|
1919
|
+
const space = model.space;
|
|
1783
1920
|
(0, import_invariant.invariant)(space, void 0, {
|
|
1784
1921
|
F: __dxlog_file4,
|
|
1785
|
-
L:
|
|
1922
|
+
L: 284,
|
|
1786
1923
|
S: void 0,
|
|
1787
1924
|
A: [
|
|
1788
1925
|
"space",
|
|
@@ -1815,7 +1952,8 @@ var TableMain = /* @__PURE__ */ (0, import_react.forwardRef)(({ model, presentat
|
|
|
1815
1952
|
}
|
|
1816
1953
|
return [];
|
|
1817
1954
|
}, [
|
|
1818
|
-
model
|
|
1955
|
+
model,
|
|
1956
|
+
t
|
|
1819
1957
|
]);
|
|
1820
1958
|
if (!model || !modals) {
|
|
1821
1959
|
return /* @__PURE__ */ import_react.default.createElement("span", {
|
|
@@ -1824,7 +1962,7 @@ var TableMain = /* @__PURE__ */ (0, import_react.forwardRef)(({ model, presentat
|
|
|
1824
1962
|
});
|
|
1825
1963
|
}
|
|
1826
1964
|
return /* @__PURE__ */ import_react.default.createElement(import_react_ui_grid.Grid.Root, {
|
|
1827
|
-
id: model.
|
|
1965
|
+
id: model.id ?? "table-grid"
|
|
1828
1966
|
}, /* @__PURE__ */ import_react.default.createElement(TableCellEditor, {
|
|
1829
1967
|
model,
|
|
1830
1968
|
modals,
|
|
@@ -1837,7 +1975,7 @@ var TableMain = /* @__PURE__ */ (0, import_react.forwardRef)(({ model, presentat
|
|
|
1837
1975
|
frozen,
|
|
1838
1976
|
columns: model.columnMeta.value,
|
|
1839
1977
|
limitRows: model.getRowCount() ?? 0,
|
|
1840
|
-
limitColumns: model.
|
|
1978
|
+
limitColumns: model.view?.fields?.length ?? 0,
|
|
1841
1979
|
onAxisResize: handleAxisResize,
|
|
1842
1980
|
onClick: handleGridClick,
|
|
1843
1981
|
onKeyDown: handleKeyDown,
|
|
@@ -1865,6 +2003,118 @@ var Table = {
|
|
|
1865
2003
|
Root: TableRoot,
|
|
1866
2004
|
Main: TableMain
|
|
1867
2005
|
};
|
|
2006
|
+
var useTableModel = ({ objects, table, projection, features, onSelectionChanged, rowActions, onRowAction, ...props }) => {
|
|
2007
|
+
const [model, setModel] = (0, import_react9.useState)();
|
|
2008
|
+
(0, import_react9.useEffect)(() => {
|
|
2009
|
+
if (!table || !projection) {
|
|
2010
|
+
return;
|
|
2011
|
+
}
|
|
2012
|
+
let model2;
|
|
2013
|
+
const t = setTimeout(async () => {
|
|
2014
|
+
model2 = new TableModel({
|
|
2015
|
+
id: (0, import_echo4.fullyQualifiedId)(table),
|
|
2016
|
+
space: (0, import_echo4.getSpace)(table),
|
|
2017
|
+
view: table.view?.target,
|
|
2018
|
+
projection,
|
|
2019
|
+
features,
|
|
2020
|
+
rowActions,
|
|
2021
|
+
onRowAction,
|
|
2022
|
+
...props
|
|
2023
|
+
});
|
|
2024
|
+
await model2.open();
|
|
2025
|
+
setModel(model2);
|
|
2026
|
+
});
|
|
2027
|
+
return () => {
|
|
2028
|
+
clearTimeout(t);
|
|
2029
|
+
void model2?.close();
|
|
2030
|
+
};
|
|
2031
|
+
}, [
|
|
2032
|
+
table,
|
|
2033
|
+
projection,
|
|
2034
|
+
table?.view?.target,
|
|
2035
|
+
features,
|
|
2036
|
+
rowActions
|
|
2037
|
+
]);
|
|
2038
|
+
(0, import_react9.useEffect)(() => {
|
|
2039
|
+
if (objects) {
|
|
2040
|
+
model?.setRows(objects);
|
|
2041
|
+
}
|
|
2042
|
+
}, [
|
|
2043
|
+
model,
|
|
2044
|
+
objects
|
|
2045
|
+
]);
|
|
2046
|
+
const { select, clear } = (0, import_react_ui_attention2.useSelectionActions)([
|
|
2047
|
+
table?.id,
|
|
2048
|
+
table?.view?.target?.query.typename
|
|
2049
|
+
].filter(import_util2.isNonNullable));
|
|
2050
|
+
(0, import_react9.useEffect)(() => {
|
|
2051
|
+
if (!model) {
|
|
2052
|
+
return;
|
|
2053
|
+
}
|
|
2054
|
+
const unsubscribe = (0, import_signals_core6.effect)(() => {
|
|
2055
|
+
const selectedItems = [
|
|
2056
|
+
...model.selection.selection.value
|
|
2057
|
+
];
|
|
2058
|
+
select(selectedItems);
|
|
2059
|
+
onSelectionChanged?.(selectedItems);
|
|
2060
|
+
});
|
|
2061
|
+
return () => {
|
|
2062
|
+
clear();
|
|
2063
|
+
unsubscribe();
|
|
2064
|
+
};
|
|
2065
|
+
}, [
|
|
2066
|
+
model,
|
|
2067
|
+
onSelectionChanged
|
|
2068
|
+
]);
|
|
2069
|
+
return model;
|
|
2070
|
+
};
|
|
2071
|
+
var DynamicTable = ({ data, properties, classNames, tableName = "com.example/dynamic_table", onRowClicked, rowActions, onRowAction }) => {
|
|
2072
|
+
const { table, viewProjection } = (0, import_react8.useMemo)(() => {
|
|
2073
|
+
return makeDynamicTable(tableName, properties);
|
|
2074
|
+
}, [
|
|
2075
|
+
tableName,
|
|
2076
|
+
properties
|
|
2077
|
+
]);
|
|
2078
|
+
const tableRef = (0, import_react8.useRef)(null);
|
|
2079
|
+
const handleCellUpdate = (0, import_react8.useCallback)((cell) => {
|
|
2080
|
+
tableRef.current?.update?.(cell);
|
|
2081
|
+
}, []);
|
|
2082
|
+
const handleRowOrderChanged = (0, import_react8.useCallback)(() => {
|
|
2083
|
+
tableRef.current?.update?.();
|
|
2084
|
+
}, []);
|
|
2085
|
+
const features = (0, import_react8.useMemo)(() => ({
|
|
2086
|
+
selection: false,
|
|
2087
|
+
dataEditable: false
|
|
2088
|
+
}), []);
|
|
2089
|
+
const model = useTableModel({
|
|
2090
|
+
table,
|
|
2091
|
+
objects: data,
|
|
2092
|
+
projection: viewProjection,
|
|
2093
|
+
features,
|
|
2094
|
+
onCellUpdate: handleCellUpdate,
|
|
2095
|
+
onRowOrderChanged: handleRowOrderChanged,
|
|
2096
|
+
rowActions,
|
|
2097
|
+
onRowAction
|
|
2098
|
+
});
|
|
2099
|
+
const presentation = (0, import_react8.useMemo)(() => {
|
|
2100
|
+
if (model) {
|
|
2101
|
+
return new TablePresentation(model);
|
|
2102
|
+
}
|
|
2103
|
+
}, [
|
|
2104
|
+
model
|
|
2105
|
+
]);
|
|
2106
|
+
return /* @__PURE__ */ import_react8.default.createElement("div", {
|
|
2107
|
+
className: (0, import_react_ui_theme3.mx)("is-full bs-full grow grid", classNames)
|
|
2108
|
+
}, /* @__PURE__ */ import_react8.default.createElement("div", {
|
|
2109
|
+
className: "grid min-bs-0 overflow-hidden"
|
|
2110
|
+
}, /* @__PURE__ */ import_react8.default.createElement(Table.Root, null, /* @__PURE__ */ import_react8.default.createElement(Table.Main, {
|
|
2111
|
+
ref: tableRef,
|
|
2112
|
+
model,
|
|
2113
|
+
presentation,
|
|
2114
|
+
onRowClicked,
|
|
2115
|
+
ignoreAttention: true
|
|
2116
|
+
}))));
|
|
2117
|
+
};
|
|
1868
2118
|
var createTableToolbarActions = (state) => {
|
|
1869
2119
|
const add = (0, import_react_ui_menu.createMenuAction)("add-row", {
|
|
1870
2120
|
type: "add-row",
|
|
@@ -1917,79 +2167,26 @@ var createTableToolbarActions = (state) => {
|
|
|
1917
2167
|
};
|
|
1918
2168
|
};
|
|
1919
2169
|
var TableToolbar = ({ classNames, viewDirty, attendableId, onAction }) => {
|
|
1920
|
-
const state = (0,
|
|
2170
|
+
const state = (0, import_react10.useMemo)(() => (0, import_live_object3.create)({
|
|
1921
2171
|
viewDirty
|
|
1922
2172
|
}), []);
|
|
1923
|
-
const actionsCreator = (0,
|
|
2173
|
+
const actionsCreator = (0, import_react10.useCallback)(() => createTableToolbarActions(state), [
|
|
1924
2174
|
state
|
|
1925
2175
|
]);
|
|
1926
2176
|
const menu = (0, import_react_ui_menu.useMenuActions)(actionsCreator);
|
|
1927
|
-
return /* @__PURE__ */
|
|
2177
|
+
return /* @__PURE__ */ import_react10.default.createElement(import_react_ui_menu.MenuProvider, {
|
|
1928
2178
|
...menu,
|
|
1929
2179
|
attendableId,
|
|
1930
2180
|
onAction
|
|
1931
|
-
}, /* @__PURE__ */
|
|
2181
|
+
}, /* @__PURE__ */ import_react10.default.createElement(import_react_ui_menu.ToolbarMenu, {
|
|
1932
2182
|
classNames
|
|
1933
2183
|
}));
|
|
1934
2184
|
};
|
|
1935
|
-
var useTableModel = ({ objects, table, projection, ...props }) => {
|
|
1936
|
-
const [model, setModel] = (0, import_react9.useState)();
|
|
1937
|
-
(0, import_react9.useEffect)(() => {
|
|
1938
|
-
if (!table || !projection) {
|
|
1939
|
-
return;
|
|
1940
|
-
}
|
|
1941
|
-
let model2;
|
|
1942
|
-
const t = setTimeout(async () => {
|
|
1943
|
-
model2 = new TableModel({
|
|
1944
|
-
table,
|
|
1945
|
-
projection,
|
|
1946
|
-
...props
|
|
1947
|
-
});
|
|
1948
|
-
await model2.open();
|
|
1949
|
-
setModel(model2);
|
|
1950
|
-
});
|
|
1951
|
-
return () => {
|
|
1952
|
-
clearTimeout(t);
|
|
1953
|
-
void model2?.close();
|
|
1954
|
-
};
|
|
1955
|
-
}, [
|
|
1956
|
-
table,
|
|
1957
|
-
projection
|
|
1958
|
-
]);
|
|
1959
|
-
(0, import_react9.useEffect)(() => {
|
|
1960
|
-
if (objects) {
|
|
1961
|
-
model?.setRows(objects);
|
|
1962
|
-
}
|
|
1963
|
-
}, [
|
|
1964
|
-
model,
|
|
1965
|
-
objects
|
|
1966
|
-
]);
|
|
1967
|
-
const { select, clear } = (0, import_react_ui_attention2.useSelectionActions)([
|
|
1968
|
-
table?.id,
|
|
1969
|
-
table?.view?.target?.query.typename
|
|
1970
|
-
].filter(import_util2.isNonNullable));
|
|
1971
|
-
(0, import_react9.useEffect)(() => {
|
|
1972
|
-
if (!model) {
|
|
1973
|
-
return;
|
|
1974
|
-
}
|
|
1975
|
-
const unsubscribe = (0, import_signals_core6.effect)(() => {
|
|
1976
|
-
select([
|
|
1977
|
-
...model.selection.selection.value
|
|
1978
|
-
]);
|
|
1979
|
-
});
|
|
1980
|
-
return () => {
|
|
1981
|
-
clear();
|
|
1982
|
-
unsubscribe();
|
|
1983
|
-
};
|
|
1984
|
-
}, [
|
|
1985
|
-
model
|
|
1986
|
-
]);
|
|
1987
|
-
return model;
|
|
1988
|
-
};
|
|
1989
2185
|
// Annotate the CommonJS export names for ESM import in node:
|
|
1990
2186
|
0 && (module.exports = {
|
|
1991
2187
|
BUTTON_IDENTIFIERS,
|
|
1992
2188
|
CONTROL_IDENTIFIERS,
|
|
2189
|
+
DynamicTable,
|
|
1993
2190
|
ModalController,
|
|
1994
2191
|
Table,
|
|
1995
2192
|
TableModel,
|
|
@@ -1998,6 +2195,7 @@ var useTableModel = ({ objects, table, projection, ...props }) => {
|
|
|
1998
2195
|
TableToolbar,
|
|
1999
2196
|
TableType,
|
|
2000
2197
|
initializeTable,
|
|
2198
|
+
makeDynamicTable,
|
|
2001
2199
|
renderCheckbox,
|
|
2002
2200
|
renderSwitch,
|
|
2003
2201
|
tableButtons,
|