@dxos/react-ui-table 0.8.4-main.bc674ce → 0.8.4-main.bcb3aa67d6
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-OZBLY7XM.mjs → chunk-BF54SSNL.mjs} +12 -18
- package/dist/lib/browser/chunk-BF54SSNL.mjs.map +7 -0
- package/dist/lib/browser/{chunk-I5IFW7UF.mjs → chunk-EK6D2CVM.mjs} +37 -32
- package/dist/lib/browser/chunk-EK6D2CVM.mjs.map +7 -0
- package/dist/lib/browser/index.mjs +200 -173
- package/dist/lib/browser/index.mjs.map +4 -4
- package/dist/lib/browser/meta.json +1 -1
- package/dist/lib/browser/testing/index.mjs +4 -4
- package/dist/lib/browser/testing/index.mjs.map +2 -2
- package/dist/lib/browser/types/index.mjs +1 -1
- package/dist/lib/node-esm/{chunk-DDJKYJFY.mjs → chunk-LYYDF6JP.mjs} +37 -32
- package/dist/lib/node-esm/chunk-LYYDF6JP.mjs.map +7 -0
- package/dist/lib/node-esm/{chunk-WNZSKIRF.mjs → chunk-SIRDIPHZ.mjs} +12 -18
- package/dist/lib/node-esm/chunk-SIRDIPHZ.mjs.map +7 -0
- package/dist/lib/node-esm/index.mjs +200 -173
- package/dist/lib/node-esm/index.mjs.map +4 -4
- package/dist/lib/node-esm/meta.json +1 -1
- package/dist/lib/node-esm/testing/index.mjs +4 -4
- package/dist/lib/node-esm/testing/index.mjs.map +2 -2
- package/dist/lib/node-esm/types/index.mjs +1 -1
- package/dist/types/src/components/Table/ColumnSettings.d.ts.map +1 -1
- package/dist/types/src/components/Table/DynamicTable.d.ts +5 -4
- package/dist/types/src/components/Table/DynamicTable.d.ts.map +1 -1
- package/dist/types/src/components/Table/DynamicTable.stories.d.ts +20 -22
- package/dist/types/src/components/Table/DynamicTable.stories.d.ts.map +1 -1
- package/dist/types/src/components/Table/Relations.stories.d.ts +80 -82
- package/dist/types/src/components/Table/Relations.stories.d.ts.map +1 -1
- package/dist/types/src/components/Table/Table.d.ts +28 -21
- package/dist/types/src/components/Table/Table.d.ts.map +1 -1
- package/dist/types/src/components/Table/Table.stories.d.ts +82 -84
- package/dist/types/src/components/Table/Table.stories.d.ts.map +1 -1
- package/dist/types/src/components/Table/TableContent.d.ts +21 -0
- package/dist/types/src/components/Table/TableContent.d.ts.map +1 -0
- package/dist/types/src/components/Table/TableToolbar.d.ts +25 -0
- package/dist/types/src/components/Table/TableToolbar.d.ts.map +1 -0
- package/dist/types/src/components/TableCellEditor/FormCellEditor.d.ts +3 -3
- package/dist/types/src/components/TableCellEditor/FormCellEditor.d.ts.map +1 -1
- package/dist/types/src/components/TableCellEditor/TableCellEditor.d.ts +2 -2
- package/dist/types/src/components/TableCellEditor/TableCellEditor.d.ts.map +1 -1
- package/dist/types/src/components/TableCellEditor/TableCellEditor.stories.d.ts +22 -24
- package/dist/types/src/components/TableCellEditor/TableCellEditor.stories.d.ts.map +1 -1
- package/dist/types/src/components/index.d.ts +0 -1
- package/dist/types/src/components/index.d.ts.map +1 -1
- package/dist/types/src/hooks/useAddRow.d.ts +1 -1
- package/dist/types/src/hooks/useAddRow.d.ts.map +1 -1
- package/dist/types/src/hooks/useProjectionModel.d.ts +1 -1
- package/dist/types/src/hooks/useProjectionModel.d.ts.map +1 -1
- package/dist/types/src/hooks/useTableModel.d.ts +1 -1
- package/dist/types/src/model/table-model.d.ts +5 -4
- 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/playwright/TableManager.d.ts +2 -1
- package/dist/types/src/playwright/TableManager.d.ts.map +1 -1
- package/dist/types/src/testing/useTestTableModel.d.ts +2 -2
- package/dist/types/src/testing/useTestTableModel.d.ts.map +1 -1
- package/dist/types/src/translations.d.ts +19 -21
- package/dist/types/src/translations.d.ts.map +1 -1
- package/dist/types/src/types/Table.d.ts +1 -6
- package/dist/types/src/types/Table.d.ts.map +1 -1
- package/dist/types/src/util/dynamic-table.d.ts +6 -5
- package/dist/types/src/util/dynamic-table.d.ts.map +1 -1
- package/dist/types/src/util/dynamic-table.test.d.ts +2 -0
- package/dist/types/src/util/dynamic-table.test.d.ts.map +1 -0
- package/dist/types/src/util/query-ast.d.ts.map +1 -1
- package/dist/types/tsconfig.tsbuildinfo +1 -1
- package/package.json +43 -43
- package/src/components/Table/ColumnActionsMenu.tsx +5 -5
- package/src/components/Table/ColumnSettings.tsx +3 -4
- package/src/components/Table/DynamicTable.stories.tsx +6 -5
- package/src/components/Table/DynamicTable.tsx +13 -19
- package/src/components/Table/Relations.stories.tsx +35 -25
- package/src/components/Table/Table.stories.tsx +61 -40
- package/src/components/Table/Table.tsx +41 -434
- package/src/components/Table/TableContent.tsx +422 -0
- package/src/components/{TableToolbar → Table}/TableToolbar.tsx +35 -42
- package/src/components/TableCellEditor/CellValidationMessage.tsx +4 -4
- package/src/components/TableCellEditor/FormCellEditor.tsx +12 -6
- package/src/components/TableCellEditor/TableCellEditor.stories.tsx +6 -5
- package/src/components/TableCellEditor/TableCellEditor.tsx +10 -5
- package/src/components/index.ts +0 -1
- package/src/components/testing.ts +1 -1
- package/src/hooks/useAddRow.ts +1 -1
- package/src/hooks/useProjectionModel.ts +3 -3
- package/src/hooks/useTableModel.ts +1 -1
- package/src/model/table-model.test.ts +5 -5
- package/src/model/table-model.ts +13 -12
- package/src/model/table-presentation.test.ts +5 -5
- package/src/model/table-presentation.ts +12 -11
- package/src/playwright/TableManager.ts +10 -3
- package/src/playwright/playwright.config.ts +1 -1
- package/src/playwright/smoke.spec.ts +45 -2
- package/src/testing/useTestTableModel.ts +4 -4
- package/src/translations.ts +19 -21
- package/src/types/Table.ts +11 -22
- package/src/util/dynamic-table.test.ts +70 -0
- package/src/util/dynamic-table.ts +17 -16
- package/src/util/query-ast.ts +3 -0
- package/src/util/table-buttons.ts +1 -1
- package/src/util/table-controls.ts +2 -2
- package/dist/lib/browser/chunk-I5IFW7UF.mjs.map +0 -7
- package/dist/lib/browser/chunk-OZBLY7XM.mjs.map +0 -7
- package/dist/lib/node-esm/chunk-DDJKYJFY.mjs.map +0 -7
- package/dist/lib/node-esm/chunk-WNZSKIRF.mjs.map +0 -7
- package/dist/types/src/components/TableToolbar/TableToolbar.d.ts +0 -21
- package/dist/types/src/components/TableToolbar/TableToolbar.d.ts.map +0 -1
- package/dist/types/src/components/TableToolbar/index.d.ts +0 -2
- package/dist/types/src/components/TableToolbar/index.d.ts.map +0 -1
- package/src/components/TableToolbar/index.ts +0 -5
|
@@ -8,29 +8,32 @@ var __export = (target, all) => {
|
|
|
8
8
|
var Table_exports = {};
|
|
9
9
|
__export(Table_exports, {
|
|
10
10
|
Table: () => Table,
|
|
11
|
-
TableV1: () => TableV1,
|
|
12
11
|
make: () => make
|
|
13
12
|
});
|
|
14
13
|
import * as Match from "effect/Match";
|
|
15
14
|
import * as Schema from "effect/Schema";
|
|
16
15
|
import * as SchemaAST from "effect/SchemaAST";
|
|
17
|
-
import { Obj, Ref, Type } from "@dxos/echo";
|
|
16
|
+
import { Annotation, JsonSchema, Obj, Ref, Type } from "@dxos/echo";
|
|
17
|
+
import { View } from "@dxos/echo";
|
|
18
18
|
import { FormInputAnnotation, LabelAnnotation } from "@dxos/echo/internal";
|
|
19
|
-
import {
|
|
19
|
+
import { ViewAnnotation } from "@dxos/schema";
|
|
20
20
|
var Table = Schema.Struct({
|
|
21
21
|
name: Schema.String.pipe(Schema.optional),
|
|
22
|
-
view:
|
|
22
|
+
view: Ref.Ref(View.View).pipe(FormInputAnnotation.set(false)),
|
|
23
23
|
sizes: Schema.Record({
|
|
24
24
|
// TODO(wittjosiah): Should be JsonPath.
|
|
25
25
|
key: Schema.String,
|
|
26
26
|
value: Schema.Number
|
|
27
27
|
}).pipe(Schema.mutable, FormInputAnnotation.set(false))
|
|
28
28
|
}).pipe(Type.object({
|
|
29
|
-
typename: "dxos.
|
|
30
|
-
version: "0.
|
|
29
|
+
typename: "org.dxos.type.table",
|
|
30
|
+
version: "0.1.0"
|
|
31
31
|
}), LabelAnnotation.set([
|
|
32
32
|
"name"
|
|
33
|
-
]), ViewAnnotation.set(true)
|
|
33
|
+
]), ViewAnnotation.set(true), Annotation.IconAnnotation.set({
|
|
34
|
+
icon: "ph--table--regular",
|
|
35
|
+
hue: "green"
|
|
36
|
+
}));
|
|
34
37
|
var make = ({ name, sizes = {}, view, jsonSchema }) => {
|
|
35
38
|
const table = Obj.make(Table, {
|
|
36
39
|
name,
|
|
@@ -38,7 +41,7 @@ var make = ({ name, sizes = {}, view, jsonSchema }) => {
|
|
|
38
41
|
sizes
|
|
39
42
|
});
|
|
40
43
|
if (jsonSchema) {
|
|
41
|
-
const schema =
|
|
44
|
+
const schema = JsonSchema.toEffectSchema(jsonSchema);
|
|
42
45
|
const properties = SchemaAST.getPropertySignatures(schema.ast);
|
|
43
46
|
for (const property of properties) {
|
|
44
47
|
const name2 = property.name.toString();
|
|
@@ -60,17 +63,8 @@ var make = ({ name, sizes = {}, view, jsonSchema }) => {
|
|
|
60
63
|
}
|
|
61
64
|
return table;
|
|
62
65
|
};
|
|
63
|
-
var TableV1 = Schema.Struct({
|
|
64
|
-
sizes: Schema.Record({
|
|
65
|
-
key: Schema.String,
|
|
66
|
-
value: Schema.Number
|
|
67
|
-
}).pipe(Schema.mutable)
|
|
68
|
-
}).pipe(Type.object({
|
|
69
|
-
typename: "dxos.org/type/Table",
|
|
70
|
-
version: "0.1.0"
|
|
71
|
-
}));
|
|
72
66
|
|
|
73
67
|
export {
|
|
74
68
|
Table_exports
|
|
75
69
|
};
|
|
76
|
-
//# sourceMappingURL=chunk-
|
|
70
|
+
//# sourceMappingURL=chunk-BF54SSNL.mjs.map
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
{
|
|
2
|
+
"version": 3,
|
|
3
|
+
"sources": ["../../../src/types/Table.ts"],
|
|
4
|
+
"sourcesContent": ["//\n// Copyright 2025 DXOS.org\n//\n\nimport * as Match from 'effect/Match';\nimport * as Schema from 'effect/Schema';\nimport * as SchemaAST from 'effect/SchemaAST';\n\nimport { Annotation, JsonSchema, Obj, Ref, Type } from '@dxos/echo';\nimport { View } from '@dxos/echo';\nimport { FormInputAnnotation, type JsonPath, type JsonSchemaType, LabelAnnotation } from '@dxos/echo/internal';\nimport { ViewAnnotation } from '@dxos/schema';\n\nexport const Table = Schema.Struct({\n name: Schema.String.pipe(Schema.optional),\n\n view: Ref.Ref(View.View).pipe(FormInputAnnotation.set(false)),\n\n sizes: Schema.Record({\n // TODO(wittjosiah): Should be JsonPath.\n key: Schema.String,\n value: Schema.Number,\n }).pipe(Schema.mutable, FormInputAnnotation.set(false)),\n}).pipe(\n Type.object({\n typename: 'org.dxos.type.table',\n version: '0.1.0',\n }),\n LabelAnnotation.set(['name']),\n ViewAnnotation.set(true),\n Annotation.IconAnnotation.set({\n icon: 'ph--table--regular',\n hue: 'green',\n }),\n);\n\nexport interface Table extends Schema.Schema.Type<typeof Table> {}\n\ntype MakeProps = {\n name?: string;\n sizes?: Record<string, number>;\n view: View.View;\n /** Required to auto-size columns. */\n jsonSchema?: JsonSchemaType;\n};\n\n/**\n * Make a table as a view of a data set.\n */\nexport const make = ({ name, sizes = {}, view, jsonSchema }: MakeProps): Table => {\n const table = Obj.make(Table, { name, view: Ref.make(view), sizes } as Obj.MakeProps<typeof Table>);\n\n // Preset sizes.\n if (jsonSchema) {\n const schema = JsonSchema.toEffectSchema(jsonSchema);\n const properties = SchemaAST.getPropertySignatures(schema.ast);\n for (const property of properties) {\n const name = property.name.toString() as JsonPath;\n if (sizes?.[name]) {\n table.sizes[name] = sizes[name];\n continue;\n }\n\n Match.type<SchemaAST.AST>().pipe(\n Match.when({ _tag: 'BooleanKeyword' }, () => {\n table.sizes[name] = 100;\n }),\n Match.when({ _tag: 'NumberKeyword' }, () => {\n table.sizes[name] = 100;\n }),\n Match.orElse(() => {\n // Noop.\n }),\n )(property.type);\n }\n }\n\n return table;\n};\n"],
|
|
5
|
+
"mappings": ";;;;;;;AAAA;;;;;AAIA,YAAYA,WAAW;AACvB,YAAYC,YAAY;AACxB,YAAYC,eAAe;AAE3B,SAASC,YAAYC,YAAYC,KAAKC,KAAKC,YAAY;AACvD,SAASC,YAAY;AACrB,SAASC,qBAAyDC,uBAAuB;AACzF,SAASC,sBAAsB;AAExB,IAAMC,QAAeC,cAAO;EACjCC,MAAaC,cAAOC,KAAYC,eAAQ;EAExCC,MAAMC,IAAIA,IAAIC,KAAKA,IAAI,EAAEJ,KAAKK,oBAAoBC,IAAI,KAAA,CAAA;EAEtDC,OAAcC,cAAO;;IAEnBC,KAAYV;IACZW,OAAcC;EAChB,CAAA,EAAGX,KAAYY,gBAASP,oBAAoBC,IAAI,KAAA,CAAA;AAClD,CAAA,EAAGN,KACDa,KAAKC,OAAO;EACVC,UAAU;EACVC,SAAS;AACX,CAAA,GACAC,gBAAgBX,IAAI;EAAC;CAAO,GAC5BY,eAAeZ,IAAI,IAAA,GACnBa,WAAWC,eAAed,IAAI;EAC5Be,MAAM;EACNC,KAAK;AACP,CAAA,CAAA;AAgBK,IAAMC,OAAO,CAAC,EAAEzB,MAAMS,QAAQ,CAAC,GAAGL,MAAMsB,WAAU,MAAa;AACpE,QAAMC,QAAQC,IAAIH,KAAK3B,OAAO;IAAEE;IAAMI,MAAMC,IAAIoB,KAAKrB,IAAAA;IAAOK;EAAM,CAAA;AAGlE,MAAIiB,YAAY;AACd,UAAMG,SAASC,WAAWC,eAAeL,UAAAA;AACzC,UAAMM,aAAuBC,gCAAsBJ,OAAOK,GAAG;AAC7D,eAAWC,YAAYH,YAAY;AACjC,YAAMhC,QAAOmC,SAASnC,KAAKoC,SAAQ;AACnC,UAAI3B,QAAQT,KAAAA,GAAO;AACjB2B,cAAMlB,MAAMT,KAAAA,IAAQS,MAAMT,KAAAA;AAC1B;MACF;AAEAqC,MAAMC,WAAI,EAAkBpC,KACpBqC,WAAK;QAAEC,MAAM;MAAiB,GAAG,MAAA;AACrCb,cAAMlB,MAAMT,KAAAA,IAAQ;MACtB,CAAA,GACMuC,WAAK;QAAEC,MAAM;MAAgB,GAAG,MAAA;AACpCb,cAAMlB,MAAMT,KAAAA,IAAQ;MACtB,CAAA,GACMyC,aAAO,MAAA;MAEb,CAAA,CAAA,EACAN,SAASG,IAAI;IACjB;EACF;AAEA,SAAOX;AACT;",
|
|
6
|
+
"names": ["Match", "Schema", "SchemaAST", "Annotation", "JsonSchema", "Obj", "Ref", "Type", "View", "FormInputAnnotation", "LabelAnnotation", "ViewAnnotation", "Table", "Struct", "name", "String", "pipe", "optional", "view", "Ref", "View", "FormInputAnnotation", "set", "sizes", "Record", "key", "value", "Number", "mutable", "Type", "object", "typename", "version", "LabelAnnotation", "ViewAnnotation", "Annotation", "IconAnnotation", "icon", "hue", "make", "jsonSchema", "table", "Obj", "schema", "JsonSchema", "toEffectSchema", "properties", "getPropertySignatures", "ast", "property", "toString", "Match", "type", "when", "_tag", "orElse"]
|
|
7
|
+
}
|
|
@@ -6,6 +6,9 @@ var extractOrder = (queryAst) => {
|
|
|
6
6
|
if (queryAst.type === "options") {
|
|
7
7
|
return extractOrder(queryAst.query);
|
|
8
8
|
}
|
|
9
|
+
if (queryAst.type === "from") {
|
|
10
|
+
return extractOrder(queryAst.query);
|
|
11
|
+
}
|
|
9
12
|
return void 0;
|
|
10
13
|
};
|
|
11
14
|
|
|
@@ -69,7 +72,7 @@ var BUTTON_IDENTIFIERS = {
|
|
|
69
72
|
};
|
|
70
73
|
var createButton = ({ attr, data, disabled = false, icon, testId, type: _type = "primary" }) => {
|
|
71
74
|
const dataAttrs = Object.entries(data).map(([k, v]) => `${k}="${v}"`).join(" ");
|
|
72
|
-
return `<button ${attr} data-testid="${testId}" class="dx-button
|
|
75
|
+
return `<button ${attr} data-testid="${testId}" class="dx-button w-6 aspect-square px-0.5 min-h-0" ${dataAttrs} ${disabled ? "disabled" : ""} data-dx-grid-action="accessory"><svg data-size="4"><use href="/icons.svg#${icon}"/></svg></button>`;
|
|
73
76
|
};
|
|
74
77
|
var addColumnButton = {
|
|
75
78
|
attr: BUTTON_IDENTIFIERS.newColumn,
|
|
@@ -182,8 +185,8 @@ var CONTROL_IDENTIFIERS = {
|
|
|
182
185
|
switch: "data-table-switch"
|
|
183
186
|
};
|
|
184
187
|
var BASE_CLASSES = {
|
|
185
|
-
checkbox: "absolute inset-
|
|
186
|
-
switch: "absolute inset-
|
|
188
|
+
checkbox: "absolute inset-y-[.375rem] end-[.375rem] dx-checkbox",
|
|
189
|
+
switch: "absolute inset-y-[.25rem] end-[.25rem] dx-checkbox--switch"
|
|
187
190
|
};
|
|
188
191
|
var renderAttributes = (data) => {
|
|
189
192
|
return Object.entries(data).map(([k, v]) => `${k}="${v}"`).join(" ");
|
|
@@ -410,7 +413,7 @@ var TableModel = class extends Resource2 {
|
|
|
410
413
|
_visibleRange;
|
|
411
414
|
_onInsertRow;
|
|
412
415
|
_onDeleteRows;
|
|
413
|
-
|
|
416
|
+
_onColumnDelete;
|
|
414
417
|
_onCellUpdate;
|
|
415
418
|
_onRowOrderChange;
|
|
416
419
|
_onRowAction;
|
|
@@ -436,7 +439,7 @@ var TableModel = class extends Resource2 {
|
|
|
436
439
|
constructor({ registry, object, projection, db, change, features = {}, initialSelection = [], pinnedRows = {
|
|
437
440
|
top: [],
|
|
438
441
|
bottom: []
|
|
439
|
-
}, rowActions = [], onCellUpdate,
|
|
442
|
+
}, rowActions = [], onCellUpdate, onColumnDelete, onDeleteRows, onInsertRow, onRowOrderChange, onRowAction }) {
|
|
440
443
|
super();
|
|
441
444
|
this._registry = registry;
|
|
442
445
|
this._object = object;
|
|
@@ -450,7 +453,7 @@ var TableModel = class extends Resource2 {
|
|
|
450
453
|
};
|
|
451
454
|
invariant(!(this._features.dataEditable && this._features.selection.enabled && this._features.selection.mode === "single"), "Single selection is not compatible with editable tables.", {
|
|
452
455
|
F: __dxlog_file,
|
|
453
|
-
L:
|
|
456
|
+
L: 197,
|
|
454
457
|
S: this,
|
|
455
458
|
A: [
|
|
456
459
|
"!(this._features.dataEditable && this._features.selection.enabled && this._features.selection.mode === 'single')",
|
|
@@ -529,7 +532,7 @@ var TableModel = class extends Resource2 {
|
|
|
529
532
|
this._rowActions = rowActions;
|
|
530
533
|
this._onInsertRow = onInsertRow;
|
|
531
534
|
this._onDeleteRows = onDeleteRows;
|
|
532
|
-
this.
|
|
535
|
+
this._onColumnDelete = onColumnDelete;
|
|
533
536
|
this._onCellUpdate = onCellUpdate;
|
|
534
537
|
this._onRowOrderChange = onRowOrderChange;
|
|
535
538
|
this._onRowAction = onRowAction;
|
|
@@ -541,7 +544,7 @@ var TableModel = class extends Resource2 {
|
|
|
541
544
|
const view = this._object.view.target;
|
|
542
545
|
invariant(view, "Table model not initialized", {
|
|
543
546
|
F: __dxlog_file,
|
|
544
|
-
L:
|
|
547
|
+
L: 308,
|
|
545
548
|
S: this,
|
|
546
549
|
A: [
|
|
547
550
|
"view",
|
|
@@ -609,7 +612,7 @@ var TableModel = class extends Resource2 {
|
|
|
609
612
|
get columnMeta() {
|
|
610
613
|
invariant(this._columnMeta, void 0, {
|
|
611
614
|
F: __dxlog_file,
|
|
612
|
-
L:
|
|
615
|
+
L: 381,
|
|
613
616
|
S: this,
|
|
614
617
|
A: [
|
|
615
618
|
"this._columnMeta",
|
|
@@ -636,7 +639,7 @@ var TableModel = class extends Resource2 {
|
|
|
636
639
|
initializeColumnMeta() {
|
|
637
640
|
invariant(this._object.view.target, "View must be loaded before initializing column meta", {
|
|
638
641
|
F: __dxlog_file,
|
|
639
|
-
L:
|
|
642
|
+
L: 405,
|
|
640
643
|
S: this,
|
|
641
644
|
A: [
|
|
642
645
|
"this._object.view.target",
|
|
@@ -906,19 +909,21 @@ var TableModel = class extends Resource2 {
|
|
|
906
909
|
const currentRow = this._registry.get(this._rows)[row];
|
|
907
910
|
invariant(currentRow, "Invalid row index", {
|
|
908
911
|
F: __dxlog_file,
|
|
909
|
-
L:
|
|
912
|
+
L: 693,
|
|
910
913
|
S: this,
|
|
911
914
|
A: [
|
|
912
915
|
"currentRow",
|
|
913
916
|
"'Invalid row index'"
|
|
914
917
|
]
|
|
915
918
|
});
|
|
916
|
-
const snapshot =
|
|
919
|
+
const snapshot = {
|
|
920
|
+
...getSnapshot(currentRow)
|
|
921
|
+
};
|
|
917
922
|
setValue(snapshot, field.path, transformedValue);
|
|
918
923
|
const schema = Obj.getSchema(currentRow);
|
|
919
924
|
invariant(schema, void 0, {
|
|
920
925
|
F: __dxlog_file,
|
|
921
|
-
L:
|
|
926
|
+
L: 699,
|
|
922
927
|
S: this,
|
|
923
928
|
A: [
|
|
924
929
|
"schema",
|
|
@@ -930,7 +935,7 @@ var TableModel = class extends Resource2 {
|
|
|
930
935
|
const error = validationResult[0];
|
|
931
936
|
invariant(error.path === field.path, void 0, {
|
|
932
937
|
F: __dxlog_file,
|
|
933
|
-
L:
|
|
938
|
+
L: 704,
|
|
934
939
|
S: this,
|
|
935
940
|
A: [
|
|
936
941
|
"error.path === field.path",
|
|
@@ -1021,8 +1026,8 @@ var TableModel = class extends Resource2 {
|
|
|
1021
1026
|
return;
|
|
1022
1027
|
}
|
|
1023
1028
|
const field = this._projection?.getFields().find((field2) => field2.id === fieldId);
|
|
1024
|
-
if (field && this.
|
|
1025
|
-
this.
|
|
1029
|
+
if (field && this._onColumnDelete) {
|
|
1030
|
+
this._onColumnDelete(field.id);
|
|
1026
1031
|
}
|
|
1027
1032
|
}
|
|
1028
1033
|
//
|
|
@@ -1100,13 +1105,13 @@ var TableModel = class extends Resource2 {
|
|
|
1100
1105
|
const field = this._projection.getFields().find((f) => f.id === inMemorySort.fieldId);
|
|
1101
1106
|
if (field) {
|
|
1102
1107
|
const newQuery = baseQuery.orderBy(Order.property(field.path, inMemorySort.direction));
|
|
1103
|
-
Obj.change(view, (
|
|
1104
|
-
|
|
1108
|
+
Obj.change(view, (obj) => {
|
|
1109
|
+
obj.query.ast = newQuery.ast;
|
|
1105
1110
|
});
|
|
1106
1111
|
}
|
|
1107
1112
|
} else {
|
|
1108
|
-
Obj.change(view, (
|
|
1109
|
-
|
|
1113
|
+
Obj.change(view, (obj) => {
|
|
1114
|
+
obj.query.ast = baseQuery.ast;
|
|
1110
1115
|
});
|
|
1111
1116
|
}
|
|
1112
1117
|
this._registry.set(this._inMemorySort, void 0);
|
|
@@ -1314,7 +1319,7 @@ var TablePresentation = class {
|
|
|
1314
1319
|
const targetObj = getValue2(obj, field.path)?.target;
|
|
1315
1320
|
if (targetObj) {
|
|
1316
1321
|
const dxn = Obj2.getDXN(targetObj)?.toString();
|
|
1317
|
-
cell.accessoryHtml = `<div role="none" class="absolute
|
|
1322
|
+
cell.accessoryHtml = `<div role="none" class="absolute end-0 inset-y-0 p-(--dx-grid-cell-content-padding-block)"><dx-anchor dxn=${dxn} class="dx-button w-6 aspect-square min-h-0" data-dx-grid-action="accessory"><dx-icon icon="ph--link-simple--regular"/></dx-anchor></div>`;
|
|
1318
1323
|
}
|
|
1319
1324
|
}
|
|
1320
1325
|
if (props.format === Format3.TypeFormat.Boolean) {
|
|
@@ -1428,7 +1433,7 @@ var TablePresentation = class {
|
|
|
1428
1433
|
value: "",
|
|
1429
1434
|
resizeHandle: "col",
|
|
1430
1435
|
accessoryHtml: `
|
|
1431
|
-
<span class="grow min-
|
|
1436
|
+
<span class="grow min-w-0 truncate">${props.title ?? field.path}</span>
|
|
1432
1437
|
${direction !== void 0 ? tableButtons.sort.render({
|
|
1433
1438
|
fieldId: field.id,
|
|
1434
1439
|
direction
|
|
@@ -1437,7 +1442,7 @@ var TablePresentation = class {
|
|
|
1437
1442
|
fieldId: field.id
|
|
1438
1443
|
})}
|
|
1439
1444
|
`,
|
|
1440
|
-
className: "!bg-
|
|
1445
|
+
className: "!bg-toolbar-surface text-description! [&>div]:flex [&>div]:items-stretch"
|
|
1441
1446
|
};
|
|
1442
1447
|
}
|
|
1443
1448
|
return cells;
|
|
@@ -1488,7 +1493,7 @@ var TablePresentation = class {
|
|
|
1488
1493
|
col: 0,
|
|
1489
1494
|
row: 0
|
|
1490
1495
|
})]: {
|
|
1491
|
-
className: "!bg-
|
|
1496
|
+
className: "!bg-toolbar-surface",
|
|
1492
1497
|
readonly: true,
|
|
1493
1498
|
value: ""
|
|
1494
1499
|
}
|
|
@@ -1504,7 +1509,7 @@ var TablePresentation = class {
|
|
|
1504
1509
|
header: true,
|
|
1505
1510
|
checked: this.model.selection.allRowsSelected
|
|
1506
1511
|
}),
|
|
1507
|
-
className: "!bg-
|
|
1512
|
+
className: "!bg-toolbar-surface",
|
|
1508
1513
|
readonly: true,
|
|
1509
1514
|
value: ""
|
|
1510
1515
|
}
|
|
@@ -1519,7 +1524,7 @@ var TablePresentation = class {
|
|
|
1519
1524
|
accessoryHtml: this.model.features.schemaEditable ? tableButtons.addColumn.render({
|
|
1520
1525
|
disabled: (this.model.projection?.getFields()?.length ?? 0) >= VIEW_FIELD_LIMIT
|
|
1521
1526
|
}) : void 0,
|
|
1522
|
-
className: "!bg-
|
|
1527
|
+
className: "!bg-toolbar-surface",
|
|
1523
1528
|
readonly: true,
|
|
1524
1529
|
value: ""
|
|
1525
1530
|
}
|
|
@@ -1577,7 +1582,7 @@ var cellClassesForRowSelection = (selected, selectionMode) => {
|
|
|
1577
1582
|
if (!selected) {
|
|
1578
1583
|
if (selectionMode === "single") {
|
|
1579
1584
|
return [
|
|
1580
|
-
"
|
|
1585
|
+
"cursor-pointer!"
|
|
1581
1586
|
];
|
|
1582
1587
|
} else {
|
|
1583
1588
|
return void 0;
|
|
@@ -1586,11 +1591,11 @@ var cellClassesForRowSelection = (selected, selectionMode) => {
|
|
|
1586
1591
|
switch (selectionMode) {
|
|
1587
1592
|
case "single":
|
|
1588
1593
|
return [
|
|
1589
|
-
"
|
|
1594
|
+
"dx-grid__cell--no-focus-unfurl !bg-current-surface hover:bg-hover-surface cursor-pointer!"
|
|
1590
1595
|
];
|
|
1591
1596
|
case "multiple":
|
|
1592
1597
|
return [
|
|
1593
|
-
"!bg-
|
|
1598
|
+
"!bg-grid-cell-selected"
|
|
1594
1599
|
];
|
|
1595
1600
|
}
|
|
1596
1601
|
};
|
|
@@ -1617,7 +1622,7 @@ var useAddRow = ({ db, schema }) => {
|
|
|
1617
1622
|
|
|
1618
1623
|
// src/hooks/useProjectionModel.ts
|
|
1619
1624
|
import { useState } from "react";
|
|
1620
|
-
import { Type } from "@dxos/echo";
|
|
1625
|
+
import { JsonSchema, Type } from "@dxos/echo";
|
|
1621
1626
|
import { useAsyncEffect } from "@dxos/react-ui";
|
|
1622
1627
|
import { ProjectionModel, createEchoChangeCallback as createEchoChangeCallback2 } from "@dxos/schema";
|
|
1623
1628
|
var useProjectionModel = (schema, table, registry) => {
|
|
@@ -1625,7 +1630,7 @@ var useProjectionModel = (schema, table, registry) => {
|
|
|
1625
1630
|
useAsyncEffect(async () => {
|
|
1626
1631
|
if (schema && table) {
|
|
1627
1632
|
const view = await table.view.load();
|
|
1628
|
-
const jsonSchema = Type.isMutable(schema) ? schema.jsonSchema :
|
|
1633
|
+
const jsonSchema = Type.isMutable(schema) ? schema.jsonSchema : JsonSchema.toJsonSchema(schema);
|
|
1629
1634
|
const change = createEchoChangeCallback2(view, Type.isMutable(schema) ? schema : void 0);
|
|
1630
1635
|
const projection2 = new ProjectionModel({
|
|
1631
1636
|
registry,
|
|
@@ -1743,4 +1748,4 @@ export {
|
|
|
1743
1748
|
useProjectionModel,
|
|
1744
1749
|
useTableModel
|
|
1745
1750
|
};
|
|
1746
|
-
//# sourceMappingURL=chunk-
|
|
1751
|
+
//# sourceMappingURL=chunk-EK6D2CVM.mjs.map
|