@dxos/react-ui-table 0.8.2-main.5885341 → 0.8.2-main.600d381
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-UGGYKLOH.mjs +28 -0
- package/dist/lib/browser/chunk-UGGYKLOH.mjs.map +7 -0
- package/dist/lib/browser/index.mjs +19 -18
- package/dist/lib/browser/index.mjs.map +3 -3
- package/dist/lib/browser/meta.json +1 -1
- package/dist/lib/browser/types/index.mjs +1 -1
- package/dist/lib/node/{chunk-TGG6OZ54.cjs → chunk-2QLLIPZK.cjs} +13 -11
- package/dist/lib/node/chunk-2QLLIPZK.cjs.map +7 -0
- package/dist/lib/node/index.cjs +69 -68
- package/dist/lib/node/index.cjs.map +3 -3
- 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-KKLP54L3.mjs → chunk-N2RRVR7F.mjs} +11 -9
- package/dist/lib/node-esm/chunk-N2RRVR7F.mjs.map +7 -0
- package/dist/lib/node-esm/index.mjs +19 -18
- package/dist/lib/node-esm/index.mjs.map +3 -3
- 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/CreateRefPanel.d.ts.map +1 -1
- package/dist/types/src/components/Table/DynamicTable.d.ts +0 -2
- package/dist/types/src/components/Table/DynamicTable.d.ts.map +1 -1
- package/dist/types/src/components/Table/RowActionsMenu.d.ts.map +1 -1
- package/dist/types/src/components/Table/Table.stories.d.ts.map +1 -1
- package/dist/types/src/components/Table/relations.stories.d.ts.map +1 -1
- package/dist/types/src/components/TableCellEditor/TableCellEditor.d.ts.map +1 -1
- package/dist/types/src/components/TableCellEditor/extension.d.ts.map +1 -1
- package/dist/types/src/components/TableToolbar/TableToolbar.d.ts +2 -2
- package/dist/types/src/components/TableToolbar/TableToolbar.d.ts.map +1 -1
- package/dist/types/src/components/testing.d.ts +39 -39
- package/dist/types/src/components/testing.d.ts.map +1 -1
- package/dist/types/src/hooks/useTableModel.d.ts.map +1 -1
- package/dist/types/src/model/modal-controller.d.ts.map +1 -1
- package/dist/types/src/model/selection-model.d.ts.map +1 -1
- 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/types/table.d.ts +42 -42
- package/dist/types/src/types/table.d.ts.map +1 -1
- package/dist/types/src/util/dynamic-table.d.ts.map +1 -1
- package/dist/types/src/util/signals.d.ts.map +1 -1
- package/dist/types/src/util/table-controls.d.ts.map +1 -1
- package/dist/types/src/util/table.d.ts +2 -2
- package/dist/types/src/util/table.d.ts.map +1 -1
- package/dist/types/src/util/tag.d.ts.map +1 -1
- package/dist/types/tsconfig.tsbuildinfo +1 -1
- package/package.json +35 -33
- package/src/components/Table/CreateRefPanel.tsx +3 -3
- package/src/components/Table/DynamicTable.stories.tsx +1 -1
- package/src/components/Table/DynamicTable.tsx +0 -2
- package/src/components/Table/Table.stories.tsx +4 -5
- package/src/components/Table/relations.stories.tsx +11 -10
- package/src/components/TableCellEditor/TableCellEditor.stories.tsx +1 -1
- package/src/components/TableToolbar/TableToolbar.tsx +10 -11
- package/src/components/testing.ts +7 -6
- package/src/model/table-model.test.ts +4 -3
- package/src/model/table-presentation.test.ts +4 -3
- package/src/types/table.ts +16 -8
- package/src/util/table.ts +7 -7
- package/dist/lib/browser/chunk-YWNRUF4J.mjs +0 -26
- package/dist/lib/browser/chunk-YWNRUF4J.mjs.map +0 -7
- package/dist/lib/node/chunk-TGG6OZ54.cjs.map +0 -7
- package/dist/lib/node-esm/chunk-KKLP54L3.mjs.map +0 -7
package/dist/lib/node/index.cjs
CHANGED
|
@@ -37,9 +37,9 @@ __export(node_exports, {
|
|
|
37
37
|
Table: () => Table,
|
|
38
38
|
TableModel: () => TableModel,
|
|
39
39
|
TablePresentation: () => TablePresentation,
|
|
40
|
-
TableSchema: () =>
|
|
40
|
+
TableSchema: () => import_chunk_2QLLIPZK.TableSchema,
|
|
41
41
|
TableToolbar: () => TableToolbar,
|
|
42
|
-
TableType: () =>
|
|
42
|
+
TableType: () => import_chunk_2QLLIPZK.TableType,
|
|
43
43
|
cellClassesForRowSelection: () => cellClassesForRowSelection,
|
|
44
44
|
getBaseSchems: () => getBaseSchems,
|
|
45
45
|
initializeTable: () => initializeTable,
|
|
@@ -51,7 +51,7 @@ __export(node_exports, {
|
|
|
51
51
|
useTableModel: () => useTableModel
|
|
52
52
|
});
|
|
53
53
|
module.exports = __toCommonJS(node_exports);
|
|
54
|
-
var
|
|
54
|
+
var import_chunk_2QLLIPZK = require("./chunk-2QLLIPZK.cjs");
|
|
55
55
|
var import_react = __toESM(require("react"));
|
|
56
56
|
var import_echo_schema = require("@dxos/echo-schema");
|
|
57
57
|
var import_invariant = require("@dxos/invariant");
|
|
@@ -66,8 +66,8 @@ var import_react_ui2 = require("@dxos/react-ui");
|
|
|
66
66
|
var import_react3 = __toESM(require("react"));
|
|
67
67
|
var import_react_ui3 = require("@dxos/react-ui");
|
|
68
68
|
var import_react_ui_form = require("@dxos/react-ui-form");
|
|
69
|
+
var import_effect = require("effect");
|
|
69
70
|
var import_react4 = __toESM(require("react"));
|
|
70
|
-
var import_echo_schema2 = require("@dxos/echo-schema");
|
|
71
71
|
var import_echo2 = require("@dxos/react-client/echo");
|
|
72
72
|
var import_react_ui4 = require("@dxos/react-ui");
|
|
73
73
|
var import_react_ui_form2 = require("@dxos/react-ui-form");
|
|
@@ -76,7 +76,7 @@ var import_react5 = __toESM(require("react"));
|
|
|
76
76
|
var import_react_ui5 = require("@dxos/react-ui");
|
|
77
77
|
var import_signals_core = require("@preact/signals-core");
|
|
78
78
|
var import_context = require("@dxos/context");
|
|
79
|
-
var
|
|
79
|
+
var import_echo_schema2 = require("@dxos/echo-schema");
|
|
80
80
|
var import_invariant2 = require("@dxos/invariant");
|
|
81
81
|
var import_live_object = require("@dxos/live-object");
|
|
82
82
|
var import_react_ui_form3 = require("@dxos/react-ui-form");
|
|
@@ -84,24 +84,25 @@ var import_signals_core2 = require("@preact/signals-core");
|
|
|
84
84
|
var import_context2 = require("@dxos/context");
|
|
85
85
|
var import_live_object2 = require("@dxos/live-object");
|
|
86
86
|
var import_schema = require("@dxos/schema");
|
|
87
|
-
var
|
|
87
|
+
var import_effect2 = require("effect");
|
|
88
|
+
var import_echo_schema3 = require("@dxos/echo-schema");
|
|
88
89
|
var import_react_client = require("@dxos/react-client");
|
|
89
90
|
var import_echo3 = require("@dxos/react-client/echo");
|
|
90
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
|
-
var
|
|
94
|
+
var import_echo_schema4 = require("@dxos/echo-schema");
|
|
94
95
|
var import_react_ui_form4 = require("@dxos/react-ui-form");
|
|
95
96
|
var import_signals_core4 = require("@preact/signals-core");
|
|
96
97
|
var import_log = require("@dxos/log");
|
|
97
98
|
var import_signals_core5 = require("@preact/signals-core");
|
|
98
|
-
var
|
|
99
|
+
var import_echo_schema5 = require("@dxos/echo-schema");
|
|
99
100
|
var import_react_ui_form5 = 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
103
|
var import_schema3 = require("@dxos/schema");
|
|
103
104
|
var import_react6 = __toESM(require("react"));
|
|
104
|
-
var
|
|
105
|
+
var import_echo_schema6 = require("@dxos/echo-schema");
|
|
105
106
|
var import_invariant3 = require("@dxos/invariant");
|
|
106
107
|
var import_react_ui6 = require("@dxos/react-ui");
|
|
107
108
|
var import_react_ui_editor = require("@dxos/react-ui-editor");
|
|
@@ -256,7 +257,7 @@ var CreateRefPanel = ({ model, modals, __gridScope }) => {
|
|
|
256
257
|
typename: state.typename
|
|
257
258
|
}).runSync();
|
|
258
259
|
if (schema2) {
|
|
259
|
-
const omit =
|
|
260
|
+
const omit = import_effect.Schema.omit("id");
|
|
260
261
|
return omit(schema2);
|
|
261
262
|
}
|
|
262
263
|
}, [
|
|
@@ -365,7 +366,7 @@ var makeDynamicTable = ({ typename, jsonSchema, properties }) => {
|
|
|
365
366
|
fields: properties.map((property) => property.name)
|
|
366
367
|
}
|
|
367
368
|
});
|
|
368
|
-
const table = (0, import_live_object2.live)(
|
|
369
|
+
const table = (0, import_live_object2.live)(import_chunk_2QLLIPZK.TableType, {
|
|
369
370
|
name: "dynamic-table",
|
|
370
371
|
view: (0, import_live_object2.makeRef)(view)
|
|
371
372
|
});
|
|
@@ -441,17 +442,17 @@ var initializeTable = async ({ client, space, table, typename, initialRow = true
|
|
|
441
442
|
return schema;
|
|
442
443
|
}
|
|
443
444
|
};
|
|
444
|
-
var ContactSchema = (0,
|
|
445
|
+
var ContactSchema = (0, import_echo_schema3.TypedObject)({
|
|
445
446
|
typename: `example.com/type/${import_react_client.PublicKey.random().truncate()}`,
|
|
446
447
|
version: "0.1.0"
|
|
447
448
|
})({
|
|
448
|
-
name:
|
|
449
|
-
[
|
|
449
|
+
name: import_effect2.Schema.optional(import_effect2.Schema.String).annotations({
|
|
450
|
+
[import_effect2.SchemaAST.TitleAnnotationId]: "Name"
|
|
450
451
|
}),
|
|
451
|
-
active:
|
|
452
|
-
email:
|
|
453
|
-
salary:
|
|
454
|
-
[
|
|
452
|
+
active: import_effect2.Schema.optional(import_effect2.Schema.Boolean),
|
|
453
|
+
email: import_effect2.Schema.optional(import_echo_schema3.Format.Email),
|
|
454
|
+
salary: import_effect2.Schema.optional(import_echo_schema3.Format.Currency()).annotations({
|
|
455
|
+
[import_effect2.SchemaAST.TitleAnnotationId]: "Salary"
|
|
455
456
|
})
|
|
456
457
|
});
|
|
457
458
|
var ContactFields = [
|
|
@@ -484,8 +485,8 @@ var createProjection = (schema, view) => {
|
|
|
484
485
|
},
|
|
485
486
|
props: {
|
|
486
487
|
property: "manager",
|
|
487
|
-
type:
|
|
488
|
-
format:
|
|
488
|
+
type: import_echo_schema3.TypeEnum.Ref,
|
|
489
|
+
format: import_echo_schema3.FormatEnum.Ref,
|
|
489
490
|
referenceSchema: schema.typename,
|
|
490
491
|
title: "Manager"
|
|
491
492
|
}
|
|
@@ -827,7 +828,7 @@ var TableSorting = class {
|
|
|
827
828
|
const { props } = this._projection.getFieldProjection(field.id);
|
|
828
829
|
const dataWithIndices = this._rows.value.map((item, index) => {
|
|
829
830
|
const sortValue = this.getSortValue(props, field, item);
|
|
830
|
-
const isEmpty = !(props.type ===
|
|
831
|
+
const isEmpty = !(props.type === import_echo_schema4.TypeEnum.Boolean) && (sortValue == null || sortValue === "");
|
|
831
832
|
return {
|
|
832
833
|
item,
|
|
833
834
|
index,
|
|
@@ -852,17 +853,17 @@ var TableSorting = class {
|
|
|
852
853
|
}
|
|
853
854
|
getSortValue(props, field, item) {
|
|
854
855
|
const { type, format } = props;
|
|
855
|
-
const value = (0,
|
|
856
|
-
if (type ===
|
|
856
|
+
const value = (0, import_echo_schema4.getValue)(item, field.path);
|
|
857
|
+
if (type === import_echo_schema4.TypeEnum.Boolean) {
|
|
857
858
|
return !!value;
|
|
858
859
|
}
|
|
859
|
-
if (type ===
|
|
860
|
+
if (type === import_echo_schema4.TypeEnum.Number) {
|
|
860
861
|
return value;
|
|
861
862
|
}
|
|
862
863
|
if (value == null) {
|
|
863
864
|
return value;
|
|
864
865
|
}
|
|
865
|
-
if (format ===
|
|
866
|
+
if (format === import_echo_schema4.FormatEnum.SingleSelect) {
|
|
866
867
|
const options = props.options;
|
|
867
868
|
if (!options) {
|
|
868
869
|
return void 0;
|
|
@@ -870,8 +871,8 @@ var TableSorting = class {
|
|
|
870
871
|
const option = options.find((option2) => option2.id === value);
|
|
871
872
|
return option ? options.indexOf(option) : void 0;
|
|
872
873
|
}
|
|
873
|
-
if (format ===
|
|
874
|
-
const refValue = (0,
|
|
874
|
+
if (format === import_echo_schema4.FormatEnum.Ref && field.referencePath) {
|
|
875
|
+
const refValue = (0, import_echo_schema4.getValue)(value.target, field.referencePath);
|
|
875
876
|
return refValue;
|
|
876
877
|
}
|
|
877
878
|
return (0, import_react_ui_form4.formatForDisplay)({
|
|
@@ -959,17 +960,17 @@ var TableModel = class extends import_context.Resource {
|
|
|
959
960
|
}
|
|
960
961
|
const field = fields[col];
|
|
961
962
|
const dataIndex = this._sorting.getDataIndex(row);
|
|
962
|
-
const value = (0,
|
|
963
|
+
const value = (0, import_echo_schema2.getValue)(this._rows.value[dataIndex], field.path);
|
|
963
964
|
if (value == null) {
|
|
964
965
|
return "";
|
|
965
966
|
}
|
|
966
967
|
const { props } = this._projection.getFieldProjection(field.id);
|
|
967
968
|
switch (props.format) {
|
|
968
|
-
case
|
|
969
|
+
case import_echo_schema2.FormatEnum.Ref: {
|
|
969
970
|
if (!field.referencePath) {
|
|
970
971
|
return "";
|
|
971
972
|
}
|
|
972
|
-
return (0,
|
|
973
|
+
return (0, import_echo_schema2.getValue)(value.target, field.referencePath);
|
|
973
974
|
}
|
|
974
975
|
default: {
|
|
975
976
|
return (0, import_react_ui_form3.formatForEditing)({
|
|
@@ -989,28 +990,28 @@ var TableModel = class extends import_context.Resource {
|
|
|
989
990
|
const field = fields[col];
|
|
990
991
|
const { props } = this._projection.getFieldProjection(field.id);
|
|
991
992
|
switch (props.format) {
|
|
992
|
-
case
|
|
993
|
+
case import_echo_schema2.FormatEnum.Ref: {
|
|
993
994
|
if ((0, import_live_object.isLiveObject)(value)) {
|
|
994
|
-
(0,
|
|
995
|
+
(0, import_echo_schema2.setValue)(this._rows.value[rowIdx], field.path, (0, import_live_object.makeRef)(value));
|
|
995
996
|
}
|
|
996
997
|
break;
|
|
997
998
|
}
|
|
998
|
-
case
|
|
999
|
+
case import_echo_schema2.FormatEnum.SingleSelect: {
|
|
999
1000
|
const ids = extractTagIds(value);
|
|
1000
1001
|
if (ids && ids.length > 0) {
|
|
1001
|
-
(0,
|
|
1002
|
+
(0, import_echo_schema2.setValue)(this._rows.value[rowIdx], field.path, ids[0]);
|
|
1002
1003
|
}
|
|
1003
1004
|
break;
|
|
1004
1005
|
}
|
|
1005
|
-
case
|
|
1006
|
+
case import_echo_schema2.FormatEnum.MultiSelect: {
|
|
1006
1007
|
const ids = extractTagIds(value);
|
|
1007
1008
|
if (ids) {
|
|
1008
|
-
(0,
|
|
1009
|
+
(0, import_echo_schema2.setValue)(this._rows.value[rowIdx], field.path, ids);
|
|
1009
1010
|
}
|
|
1010
1011
|
break;
|
|
1011
1012
|
}
|
|
1012
1013
|
default: {
|
|
1013
|
-
(0,
|
|
1014
|
+
(0, import_echo_schema2.setValue)(this._rows.value[rowIdx], field.path, (0, import_react_ui_form3.parseValue)({
|
|
1014
1015
|
type: props.type,
|
|
1015
1016
|
format: props.format,
|
|
1016
1017
|
value
|
|
@@ -1156,7 +1157,7 @@ var TableModel = class extends import_context.Resource {
|
|
|
1156
1157
|
for (let row = start.row; row <= end.row; row++) {
|
|
1157
1158
|
rowEffects.push((0, import_signals_core.effect)(() => {
|
|
1158
1159
|
const obj = this._sorting.sortedRows.value[row];
|
|
1159
|
-
this._view?.fields.forEach((field) => touch((0,
|
|
1160
|
+
this._view?.fields.forEach((field) => touch((0, import_echo_schema2.getValue)(obj, field.path)));
|
|
1160
1161
|
this._onCellUpdate?.({
|
|
1161
1162
|
row,
|
|
1162
1163
|
col: start.col,
|
|
@@ -1177,9 +1178,9 @@ var TableModel = class extends import_context.Resource {
|
|
|
1177
1178
|
const dataRow = this._sorting.getDataIndex(row);
|
|
1178
1179
|
const fields = this._view?.fields ?? [];
|
|
1179
1180
|
const field = fields[col];
|
|
1180
|
-
const value = (0,
|
|
1181
|
+
const value = (0, import_echo_schema2.getValue)(this._rows.value[dataRow], field.path);
|
|
1181
1182
|
const updatedValue = update(value);
|
|
1182
|
-
(0,
|
|
1183
|
+
(0, import_echo_schema2.setValue)(this._rows.value[dataRow], field.path, updatedValue);
|
|
1183
1184
|
}
|
|
1184
1185
|
//
|
|
1185
1186
|
// Column Operations
|
|
@@ -1361,21 +1362,21 @@ var TablePresentation = class {
|
|
|
1361
1362
|
const { props } = this.model.projection.getFieldProjection(field.id);
|
|
1362
1363
|
const cell = {
|
|
1363
1364
|
get value() {
|
|
1364
|
-
const value = (0,
|
|
1365
|
+
const value = (0, import_echo_schema5.getValue)(obj, field.path);
|
|
1365
1366
|
if (value == null) {
|
|
1366
1367
|
return "";
|
|
1367
1368
|
}
|
|
1368
1369
|
switch (props.format) {
|
|
1369
|
-
case
|
|
1370
|
-
case
|
|
1371
|
-
case
|
|
1370
|
+
case import_echo_schema5.FormatEnum.Boolean:
|
|
1371
|
+
case import_echo_schema5.FormatEnum.SingleSelect:
|
|
1372
|
+
case import_echo_schema5.FormatEnum.MultiSelect: {
|
|
1372
1373
|
return "";
|
|
1373
1374
|
}
|
|
1374
|
-
case
|
|
1375
|
+
case import_echo_schema5.FormatEnum.Ref: {
|
|
1375
1376
|
if (!field.referencePath) {
|
|
1376
1377
|
return "";
|
|
1377
1378
|
}
|
|
1378
|
-
return (0,
|
|
1379
|
+
return (0, import_echo_schema5.getValue)(value.target, field.referencePath);
|
|
1379
1380
|
}
|
|
1380
1381
|
default: {
|
|
1381
1382
|
return (0, import_react_ui_form5.formatForDisplay)({
|
|
@@ -1402,15 +1403,15 @@ var TablePresentation = class {
|
|
|
1402
1403
|
if (classes.length > 0) {
|
|
1403
1404
|
cell.className = (0, import_react_ui_theme2.mx)(classes.flat());
|
|
1404
1405
|
}
|
|
1405
|
-
if (props.format ===
|
|
1406
|
-
const targetObj = (0,
|
|
1406
|
+
if (props.format === import_echo_schema5.FormatEnum.Ref && props.referenceSchema) {
|
|
1407
|
+
const targetObj = (0, import_echo_schema5.getValue)(obj, field.path)?.target;
|
|
1407
1408
|
if (targetObj) {
|
|
1408
|
-
const dxn = (0,
|
|
1409
|
+
const dxn = (0, import_echo_schema5.getDXN)(targetObj)?.toString();
|
|
1409
1410
|
cell.accessoryHtml = `<dx-ref-tag ref=${dxn} class="dx-button block is-6 pli-[3px] plb-[3px] pbe-[2px] min-bs-0 absolute inline-end-1"><dx-icon icon="ph--link-simple--regular"/></dx-ref-tag>`;
|
|
1410
1411
|
}
|
|
1411
1412
|
}
|
|
1412
|
-
if (props.format ===
|
|
1413
|
-
const value = (0,
|
|
1413
|
+
if (props.format === import_echo_schema5.FormatEnum.Boolean) {
|
|
1414
|
+
const value = (0, import_echo_schema5.getValue)(obj, field.path);
|
|
1414
1415
|
cell.accessoryHtml = tableControls.switch.render({
|
|
1415
1416
|
colIndex,
|
|
1416
1417
|
rowIndex: displayIndex,
|
|
@@ -1418,8 +1419,8 @@ var TablePresentation = class {
|
|
|
1418
1419
|
});
|
|
1419
1420
|
cell.readonly = "no-text-select";
|
|
1420
1421
|
}
|
|
1421
|
-
if (props.format ===
|
|
1422
|
-
const value = (0,
|
|
1422
|
+
if (props.format === import_echo_schema5.FormatEnum.SingleSelect) {
|
|
1423
|
+
const value = (0, import_echo_schema5.getValue)(obj, field.path);
|
|
1423
1424
|
const options = this.model.projection.getFieldProjection(field.id).props.options;
|
|
1424
1425
|
if (options) {
|
|
1425
1426
|
const option = options.find((o) => o.id === value);
|
|
@@ -1428,8 +1429,8 @@ var TablePresentation = class {
|
|
|
1428
1429
|
}
|
|
1429
1430
|
}
|
|
1430
1431
|
}
|
|
1431
|
-
if (props.format ===
|
|
1432
|
-
const values = (0,
|
|
1432
|
+
if (props.format === import_echo_schema5.FormatEnum.MultiSelect) {
|
|
1433
|
+
const values = (0, import_echo_schema5.getValue)(obj, field.path);
|
|
1433
1434
|
const options = this.model.projection.getFieldProjection(field.id).props.options;
|
|
1434
1435
|
if (options && values && values.length > 0) {
|
|
1435
1436
|
const tags = values.map((value) => {
|
|
@@ -1724,12 +1725,12 @@ var TableCellEditor = ({ model, modals, onEnter, onFocus, onQuery, __gridScope }
|
|
|
1724
1725
|
})
|
|
1725
1726
|
];
|
|
1726
1727
|
const format = fieldProjection.props.format;
|
|
1727
|
-
if (format ===
|
|
1728
|
+
if (format === import_echo_schema6.FormatEnum.SingleSelect || format === import_echo_schema6.FormatEnum.MultiSelect) {
|
|
1728
1729
|
extension2.push((0, import_react_ui_editor.createMarkdownExtensions)({
|
|
1729
1730
|
themeMode
|
|
1730
1731
|
}));
|
|
1731
1732
|
const options = fieldProjection.props.options || [];
|
|
1732
|
-
const mode = format ===
|
|
1733
|
+
const mode = format === import_echo_schema6.FormatEnum.SingleSelect ? "single-select" : "multi-select";
|
|
1733
1734
|
extension2.push((0, import_react_ui_tag_picker.tagPickerExtension)({
|
|
1734
1735
|
mode,
|
|
1735
1736
|
inGrid: true,
|
|
@@ -1756,7 +1757,7 @@ var TableCellEditor = ({ model, modals, onEnter, onFocus, onQuery, __gridScope }
|
|
|
1756
1757
|
}
|
|
1757
1758
|
if (onQuery) {
|
|
1758
1759
|
switch (fieldProjection.props.format) {
|
|
1759
|
-
case
|
|
1760
|
+
case import_echo_schema6.FormatEnum.Ref: {
|
|
1760
1761
|
extension2.push([
|
|
1761
1762
|
completion({
|
|
1762
1763
|
onQuery: (text) => onQuery(fieldProjection, text),
|
|
@@ -1798,11 +1799,11 @@ var TableCellEditor = ({ model, modals, onEnter, onFocus, onQuery, __gridScope }
|
|
|
1798
1799
|
const { col } = cell;
|
|
1799
1800
|
const field = model.projection.view.fields[col];
|
|
1800
1801
|
const fieldProjection2 = model.projection.getFieldProjection(field.id);
|
|
1801
|
-
if (fieldProjection2?.props.format ===
|
|
1802
|
+
if (fieldProjection2?.props.format === import_echo_schema6.FormatEnum.SingleSelect || fieldProjection2?.props.format === import_echo_schema6.FormatEnum.MultiSelect) {
|
|
1802
1803
|
const value2 = model.getCellData(cell);
|
|
1803
1804
|
if (value2 !== void 0) {
|
|
1804
1805
|
const options = fieldProjection2.props.options || [];
|
|
1805
|
-
if (fieldProjection2.props.format ===
|
|
1806
|
+
if (fieldProjection2.props.format === import_echo_schema6.FormatEnum.MultiSelect && Array.isArray(value2)) {
|
|
1806
1807
|
const tagItems = value2.map((id) => {
|
|
1807
1808
|
const option = options.find((o) => o.id === id);
|
|
1808
1809
|
if (option) {
|
|
@@ -2277,8 +2278,8 @@ var DynamicTable = ({ classNames, name = "example.com/dynamic-table", rows, prop
|
|
|
2277
2278
|
onRowClick
|
|
2278
2279
|
}))));
|
|
2279
2280
|
};
|
|
2280
|
-
var createTableToolbarActions = (state) => {
|
|
2281
|
-
const add = (0, import_react_ui_menu.createMenuAction)("add-row", {
|
|
2281
|
+
var createTableToolbarActions = (state, onAction) => {
|
|
2282
|
+
const add = (0, import_react_ui_menu.createMenuAction)("add-row", () => onAction(add), {
|
|
2282
2283
|
type: "add-row",
|
|
2283
2284
|
icon: "ph--plus--regular",
|
|
2284
2285
|
label: [
|
|
@@ -2289,7 +2290,7 @@ var createTableToolbarActions = (state) => {
|
|
|
2289
2290
|
],
|
|
2290
2291
|
testId: "table.toolbar.add-row"
|
|
2291
2292
|
});
|
|
2292
|
-
const save = (0, import_react_ui_menu.createMenuAction)("save-view", {
|
|
2293
|
+
const save = (0, import_react_ui_menu.createMenuAction)("save-view", () => onAction(save), {
|
|
2293
2294
|
type: "save-view",
|
|
2294
2295
|
icon: "ph--floppy-disk--regular",
|
|
2295
2296
|
label: [
|
|
@@ -2303,7 +2304,7 @@ var createTableToolbarActions = (state) => {
|
|
|
2303
2304
|
hidden: !state.viewDirty
|
|
2304
2305
|
});
|
|
2305
2306
|
const gap = (0, import_react_ui_menu.createGapSeparator)();
|
|
2306
|
-
const comment = (0, import_react_ui_menu.createMenuAction)("comment", {
|
|
2307
|
+
const comment = (0, import_react_ui_menu.createMenuAction)("comment", () => onAction(comment), {
|
|
2307
2308
|
type: "comment",
|
|
2308
2309
|
icon: "ph--chat-text--regular",
|
|
2309
2310
|
label: [
|
|
@@ -2332,14 +2333,14 @@ var TableToolbar = ({ classNames, viewDirty, attendableId, onAction }) => {
|
|
|
2332
2333
|
const state = (0, import_react9.useMemo)(() => (0, import_live_object3.live)({
|
|
2333
2334
|
viewDirty
|
|
2334
2335
|
}), []);
|
|
2335
|
-
const actionsCreator = (0, import_react9.useCallback)(() => createTableToolbarActions(state), [
|
|
2336
|
-
state
|
|
2336
|
+
const actionsCreator = (0, import_react9.useCallback)(() => createTableToolbarActions(state, onAction), [
|
|
2337
|
+
state,
|
|
2338
|
+
onAction
|
|
2337
2339
|
]);
|
|
2338
2340
|
const menu = (0, import_react_ui_menu.useMenuActions)(actionsCreator);
|
|
2339
2341
|
return /* @__PURE__ */ import_react9.default.createElement(import_react_ui_menu.MenuProvider, {
|
|
2340
2342
|
...menu,
|
|
2341
|
-
attendableId
|
|
2342
|
-
onAction
|
|
2343
|
+
attendableId
|
|
2343
2344
|
}, /* @__PURE__ */ import_react9.default.createElement(import_react_ui_menu.ToolbarMenu, {
|
|
2344
2345
|
classNames
|
|
2345
2346
|
}));
|