@dxos/react-ui-table 0.8.4-main.d05673bc65 → 0.8.4-main.d9fc60f731
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/LICENSE +102 -5
- package/dist/lib/browser/chunk-J5LGTIGS.mjs +10 -0
- package/dist/lib/browser/chunk-J5LGTIGS.mjs.map +7 -0
- package/dist/lib/browser/{chunk-PTHMYAAM.mjs → chunk-X7A7G6RR.mjs} +28 -83
- package/dist/lib/browser/chunk-X7A7G6RR.mjs.map +7 -0
- package/dist/lib/browser/{chunk-BF54SSNL.mjs → chunk-YURROGGF.mjs} +12 -15
- package/dist/lib/browser/chunk-YURROGGF.mjs.map +7 -0
- package/dist/lib/browser/index.mjs +230 -280
- package/dist/lib/browser/index.mjs.map +4 -4
- package/dist/lib/browser/meta.json +1 -1
- package/dist/lib/browser/testing/index.mjs +10 -9
- package/dist/lib/browser/testing/index.mjs.map +3 -3
- package/dist/lib/browser/translations.mjs +36 -0
- package/dist/lib/browser/translations.mjs.map +7 -0
- package/dist/lib/browser/types/index.mjs +2 -1
- package/dist/lib/node-esm/{chunk-SIRDIPHZ.mjs → chunk-DLAGRBKD.mjs} +12 -15
- package/dist/lib/node-esm/chunk-DLAGRBKD.mjs.map +7 -0
- package/dist/lib/node-esm/chunk-HSLMI22Q.mjs +11 -0
- package/dist/lib/node-esm/chunk-HSLMI22Q.mjs.map +7 -0
- package/dist/lib/node-esm/{chunk-GI72MQSG.mjs → chunk-Q4HSBRJJ.mjs} +28 -83
- package/dist/lib/node-esm/chunk-Q4HSBRJJ.mjs.map +7 -0
- package/dist/lib/node-esm/index.mjs +230 -280
- package/dist/lib/node-esm/index.mjs.map +4 -4
- package/dist/lib/node-esm/meta.json +1 -1
- package/dist/lib/node-esm/testing/index.mjs +10 -9
- package/dist/lib/node-esm/testing/index.mjs.map +3 -3
- package/dist/lib/node-esm/translations.mjs +37 -0
- package/dist/lib/node-esm/translations.mjs.map +7 -0
- package/dist/lib/node-esm/types/index.mjs +2 -1
- package/dist/types/src/components/Table/ColumnActionsMenu.d.ts.map +1 -1
- package/dist/types/src/components/Table/ColumnSettings.d.ts +2 -2
- package/dist/types/src/components/Table/ColumnSettings.d.ts.map +1 -1
- package/dist/types/src/components/Table/DynamicTable.d.ts +3 -4
- package/dist/types/src/components/Table/DynamicTable.d.ts.map +1 -1
- package/dist/types/src/components/Table/DynamicTable.stories.d.ts +21 -22
- package/dist/types/src/components/Table/DynamicTable.stories.d.ts.map +1 -1
- package/dist/types/src/components/Table/Relations.stories.d.ts +83 -82
- package/dist/types/src/components/Table/Relations.stories.d.ts.map +1 -1
- package/dist/types/src/components/Table/RowActionsMenu.d.ts.map +1 -1
- package/dist/types/src/components/Table/Table.d.ts +20 -21
- package/dist/types/src/components/Table/Table.d.ts.map +1 -1
- package/dist/types/src/components/Table/Table.stories.d.ts +85 -84
- package/dist/types/src/components/Table/Table.stories.d.ts.map +1 -1
- package/dist/types/src/components/Table/TableContent.d.ts +18 -0
- package/dist/types/src/components/Table/TableContent.d.ts.map +1 -0
- package/dist/types/src/components/Table/TableToolbar.d.ts +21 -0
- package/dist/types/src/components/Table/TableToolbar.d.ts.map +1 -0
- package/dist/types/src/components/TableCellEditor/CellValidationMessage.d.ts.map +1 -1
- package/dist/types/src/components/TableCellEditor/FormCellEditor.d.ts +1 -1
- package/dist/types/src/components/TableCellEditor/FormCellEditor.d.ts.map +1 -1
- 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/components/testing.d.ts.map +1 -1
- package/dist/types/src/hooks/useAddRow.d.ts.map +1 -1
- package/dist/types/src/hooks/useProjectionModel.d.ts.map +1 -1
- package/dist/types/src/hooks/useTableModel.d.ts.map +1 -1
- package/dist/types/src/index.d.ts +0 -2
- package/dist/types/src/index.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 +1 -1
- package/dist/types/src/model/selection-model.d.ts.map +1 -1
- package/dist/types/src/model/table-model.d.ts +4 -5
- 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.map +1 -1
- package/dist/types/src/playwright/playwright.config.d.ts.map +1 -1
- package/dist/types/src/testing/useTestTableModel.d.ts +1 -1
- 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 +11 -5
- package/dist/types/src/types/Table.d.ts.map +1 -1
- package/dist/types/src/util/dynamic-table.d.ts +6 -6
- package/dist/types/src/util/dynamic-table.d.ts.map +1 -1
- package/dist/types/src/util/query-ast.d.ts.map +1 -1
- package/dist/types/src/util/schema.d.ts.map +1 -1
- package/dist/types/src/util/signals.d.ts.map +1 -1
- package/dist/types/src/util/sort.d.ts.map +1 -1
- package/dist/types/src/util/table-buttons.d.ts +20 -20
- package/dist/types/src/util/table-buttons.d.ts.map +1 -1
- package/dist/types/src/util/table-controls.d.ts +4 -4
- package/dist/types/src/util/table-controls.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 +55 -64
- package/src/components/Table/ColumnActionsMenu.tsx +7 -6
- package/src/components/Table/ColumnSettings.tsx +2 -2
- package/src/components/Table/DynamicTable.stories.tsx +19 -19
- package/src/components/Table/DynamicTable.tsx +13 -22
- package/src/components/Table/Relations.stories.tsx +76 -34
- package/src/components/Table/RowActionsMenu.tsx +3 -2
- package/src/components/Table/Table.stories.tsx +46 -51
- package/src/components/Table/Table.tsx +37 -426
- package/src/components/Table/TableContent.tsx +426 -0
- package/src/components/{TableToolbar → Table}/TableToolbar.tsx +34 -41
- package/src/components/TableCellEditor/CellValidationMessage.tsx +1 -2
- package/src/components/TableCellEditor/FormCellEditor.tsx +7 -6
- package/src/components/TableCellEditor/TableCellEditor.stories.tsx +14 -12
- package/src/components/TableCellEditor/TableCellEditor.tsx +10 -8
- package/src/components/index.ts +0 -1
- package/src/components/testing.ts +11 -16
- package/src/hooks/useProjectionModel.ts +5 -6
- package/src/hooks/useTableModel.ts +1 -1
- package/src/index.ts +0 -4
- package/src/model/table-model.test.ts +4 -10
- package/src/model/table-model.ts +15 -15
- package/src/model/table-presentation.test.ts +4 -10
- package/src/model/table-presentation.ts +5 -7
- package/src/playwright/smoke.spec.ts +3 -3
- package/src/testing/useTestTableModel.ts +7 -8
- package/src/translations.ts +19 -21
- package/src/types/Table.ts +12 -13
- package/src/util/dynamic-table.test.ts +13 -20
- package/src/util/dynamic-table.ts +21 -20
- package/dist/lib/browser/chunk-BF54SSNL.mjs.map +0 -7
- package/dist/lib/browser/chunk-PTHMYAAM.mjs.map +0 -7
- package/dist/lib/node-esm/chunk-GI72MQSG.mjs.map +0 -7
- package/dist/lib/node-esm/chunk-SIRDIPHZ.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
package/LICENSE
CHANGED
|
@@ -1,8 +1,105 @@
|
|
|
1
|
-
|
|
2
|
-
Copyright (c) 2022 DXOS
|
|
1
|
+
# Functional Source License, Version 1.1, ALv2 Future License
|
|
3
2
|
|
|
4
|
-
|
|
3
|
+
## Abbreviation
|
|
5
4
|
|
|
6
|
-
|
|
5
|
+
FSL-1.1-Apache-2.0
|
|
7
6
|
|
|
8
|
-
|
|
7
|
+
## Notice
|
|
8
|
+
|
|
9
|
+
Copyright 2026 DXOS
|
|
10
|
+
|
|
11
|
+
## Terms and Conditions
|
|
12
|
+
|
|
13
|
+
### Licensor ("We")
|
|
14
|
+
|
|
15
|
+
The party offering the Software under these Terms and Conditions.
|
|
16
|
+
|
|
17
|
+
### The Software
|
|
18
|
+
|
|
19
|
+
The "Software" is each version of the software that we make available under
|
|
20
|
+
these Terms and Conditions, as indicated by our inclusion of these Terms and
|
|
21
|
+
Conditions with the Software.
|
|
22
|
+
|
|
23
|
+
### License Grant
|
|
24
|
+
|
|
25
|
+
Subject to your compliance with this License Grant and the Patents,
|
|
26
|
+
Redistribution and Trademark clauses below, we hereby grant you the right to
|
|
27
|
+
use, copy, modify, create derivative works, publicly perform, publicly display
|
|
28
|
+
and redistribute the Software for any Permitted Purpose identified below.
|
|
29
|
+
|
|
30
|
+
### Permitted Purpose
|
|
31
|
+
|
|
32
|
+
A Permitted Purpose is any purpose other than a Competing Use. A Competing Use
|
|
33
|
+
means making the Software available to others in a commercial product or
|
|
34
|
+
service that:
|
|
35
|
+
|
|
36
|
+
1. substitutes for the Software;
|
|
37
|
+
|
|
38
|
+
2. substitutes for any other product or service we offer using the Software
|
|
39
|
+
that exists as of the date we make the Software available; or
|
|
40
|
+
|
|
41
|
+
3. offers the same or substantially similar functionality as the Software.
|
|
42
|
+
|
|
43
|
+
Permitted Purposes specifically include using the Software:
|
|
44
|
+
|
|
45
|
+
1. for your internal use and access;
|
|
46
|
+
|
|
47
|
+
2. for non-commercial education;
|
|
48
|
+
|
|
49
|
+
3. for non-commercial research; and
|
|
50
|
+
|
|
51
|
+
4. in connection with professional services that you provide to a licensee
|
|
52
|
+
using the Software in accordance with these Terms and Conditions.
|
|
53
|
+
|
|
54
|
+
### Patents
|
|
55
|
+
|
|
56
|
+
To the extent your use for a Permitted Purpose would necessarily infringe our
|
|
57
|
+
patents, the license grant above includes a license under our patents. If you
|
|
58
|
+
make a claim against any party that the Software infringes or contributes to
|
|
59
|
+
the infringement of any patent, then your patent license to the Software ends
|
|
60
|
+
immediately.
|
|
61
|
+
|
|
62
|
+
### Redistribution
|
|
63
|
+
|
|
64
|
+
The Terms and Conditions apply to all copies, modifications and derivatives of
|
|
65
|
+
the Software.
|
|
66
|
+
|
|
67
|
+
If you redistribute any copies, modifications or derivatives of the Software,
|
|
68
|
+
you must include a copy of or a link to these Terms and Conditions and not
|
|
69
|
+
remove any copyright notices provided in or with the Software.
|
|
70
|
+
|
|
71
|
+
### Disclaimer
|
|
72
|
+
|
|
73
|
+
THE SOFTWARE IS PROVIDED "AS IS" AND WITHOUT WARRANTIES OF ANY KIND, EXPRESS OR
|
|
74
|
+
IMPLIED, INCLUDING WITHOUT LIMITATION WARRANTIES OF FITNESS FOR A PARTICULAR
|
|
75
|
+
PURPOSE, MERCHANTABILITY, TITLE OR NON-INFRINGEMENT.
|
|
76
|
+
|
|
77
|
+
IN NO EVENT WILL WE HAVE ANY LIABILITY TO YOU ARISING OUT OF OR RELATED TO THE
|
|
78
|
+
SOFTWARE, INCLUDING INDIRECT, SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES,
|
|
79
|
+
EVEN IF WE HAVE BEEN INFORMED OF THEIR POSSIBILITY IN ADVANCE.
|
|
80
|
+
|
|
81
|
+
### Trademarks
|
|
82
|
+
|
|
83
|
+
Except for displaying the License Details and identifying us as the origin of
|
|
84
|
+
the Software, you have no right under these Terms and Conditions to use our
|
|
85
|
+
trademarks, trade names, service marks or product names.
|
|
86
|
+
|
|
87
|
+
## Grant of Future License
|
|
88
|
+
|
|
89
|
+
We hereby irrevocably grant you an additional license to use the Software under
|
|
90
|
+
the Apache License, Version 2.0 that is effective on the second anniversary of
|
|
91
|
+
the date we make the Software available. On or after that date, you may use the
|
|
92
|
+
Software under the Apache License, Version 2.0, in which case the following
|
|
93
|
+
will apply:
|
|
94
|
+
|
|
95
|
+
Licensed under the Apache License, Version 2.0 (the "License"); you may not use
|
|
96
|
+
this file except in compliance with the License.
|
|
97
|
+
|
|
98
|
+
You may obtain a copy of the License at
|
|
99
|
+
|
|
100
|
+
http://www.apache.org/licenses/LICENSE-2.0
|
|
101
|
+
|
|
102
|
+
Unless required by applicable law or agreed to in writing, software distributed
|
|
103
|
+
under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR
|
|
104
|
+
CONDITIONS OF ANY KIND, either express or implied. See the License for the
|
|
105
|
+
specific language governing permissions and limitations under the License.
|
|
@@ -237,12 +237,12 @@ var tableControls = {
|
|
|
237
237
|
// src/model/table-model.ts
|
|
238
238
|
import { Atom as Atom2 } from "@effect-atom/atom-react";
|
|
239
239
|
import { Resource as Resource2 } from "@dxos/context";
|
|
240
|
-
import { Format as Format2, Obj, Order, Query, Ref } from "@dxos/echo";
|
|
240
|
+
import { Format as Format2, Obj, Order, Query, Ref, Type } from "@dxos/echo";
|
|
241
241
|
import { toEffectSchema } from "@dxos/echo/internal";
|
|
242
242
|
import { getSnapshot } from "@dxos/echo/internal";
|
|
243
243
|
import { getValue, setValue } from "@dxos/effect";
|
|
244
244
|
import { invariant } from "@dxos/invariant";
|
|
245
|
-
import {
|
|
245
|
+
import { EntityId } from "@dxos/keys";
|
|
246
246
|
import { formatForEditing, parseValue } from "@dxos/react-ui-form";
|
|
247
247
|
import { validateSchema } from "@dxos/schema";
|
|
248
248
|
|
|
@@ -383,10 +383,10 @@ var SelectionModel = class extends Resource {
|
|
|
383
383
|
// src/model/table-model.ts
|
|
384
384
|
var __dxlog_file = "/__w/dxos/dxos/packages/ui/react-ui-table/src/model/table-model.ts";
|
|
385
385
|
var createEchoChangeCallback = (table) => ({
|
|
386
|
-
table: (mutate) => Obj.
|
|
386
|
+
table: (mutate) => Obj.update(table, (table2) => mutate(table2)),
|
|
387
387
|
row: (row, mutate) => {
|
|
388
388
|
if (Obj.isObject(row)) {
|
|
389
|
-
Obj.
|
|
389
|
+
Obj.update(row, (row2) => mutate(row2));
|
|
390
390
|
} else {
|
|
391
391
|
mutate(row);
|
|
392
392
|
}
|
|
@@ -451,15 +451,7 @@ var TableModel = class extends Resource2 {
|
|
|
451
451
|
...defaultFeatures,
|
|
452
452
|
...features
|
|
453
453
|
};
|
|
454
|
-
invariant(!(this._features.dataEditable && this._features.selection.enabled && this._features.selection.mode === "single"), "Single selection is not compatible with editable tables.", {
|
|
455
|
-
F: __dxlog_file,
|
|
456
|
-
L: 197,
|
|
457
|
-
S: this,
|
|
458
|
-
A: [
|
|
459
|
-
"!(this._features.dataEditable && this._features.selection.enabled && this._features.selection.mode === 'single')",
|
|
460
|
-
"'Single selection is not compatible with editable tables.'"
|
|
461
|
-
]
|
|
462
|
-
});
|
|
454
|
+
invariant(!(this._features.dataEditable && this._features.selection.enabled && this._features.selection.mode === "single"), "Single selection is not compatible with editable tables.", { "~LogMeta": "~LogMeta", F: __dxlog_file, L: 94, S: this, A: ["!(this._features.dataEditable && this._features.selection.enabled && this._features.selection.mode === 'single')", "'Single selection is not compatible with editable tables.'"] });
|
|
463
455
|
this._visibleRange = Atom2.make({
|
|
464
456
|
start: {
|
|
465
457
|
row: 0,
|
|
@@ -538,19 +530,11 @@ var TableModel = class extends Resource2 {
|
|
|
538
530
|
this._onRowAction = onRowAction;
|
|
539
531
|
}
|
|
540
532
|
get id() {
|
|
541
|
-
return Obj.
|
|
533
|
+
return Obj.getURI(this._object);
|
|
542
534
|
}
|
|
543
535
|
get view() {
|
|
544
536
|
const view = this._object.view.target;
|
|
545
|
-
invariant(view, "Table model not initialized", {
|
|
546
|
-
F: __dxlog_file,
|
|
547
|
-
L: 308,
|
|
548
|
-
S: this,
|
|
549
|
-
A: [
|
|
550
|
-
"view",
|
|
551
|
-
"'Table model not initialized'"
|
|
552
|
-
]
|
|
553
|
-
});
|
|
537
|
+
invariant(view, "Table model not initialized", { "~LogMeta": "~LogMeta", F: __dxlog_file, L: 186, S: this, A: ["view", "'Table model not initialized'"] });
|
|
554
538
|
return view;
|
|
555
539
|
}
|
|
556
540
|
get table() {
|
|
@@ -610,15 +594,7 @@ var TableModel = class extends Resource2 {
|
|
|
610
594
|
return this._pinnedRows;
|
|
611
595
|
}
|
|
612
596
|
get columnMeta() {
|
|
613
|
-
invariant(this._columnMeta, void 0, {
|
|
614
|
-
F: __dxlog_file,
|
|
615
|
-
L: 381,
|
|
616
|
-
S: this,
|
|
617
|
-
A: [
|
|
618
|
-
"this._columnMeta",
|
|
619
|
-
""
|
|
620
|
-
]
|
|
621
|
-
});
|
|
597
|
+
invariant(this._columnMeta, void 0, { "~LogMeta": "~LogMeta", F: __dxlog_file, L: 240, S: this, A: ["this._columnMeta", ""] });
|
|
622
598
|
return this._columnMeta;
|
|
623
599
|
}
|
|
624
600
|
get selection() {
|
|
@@ -637,15 +613,7 @@ var TableModel = class extends Resource2 {
|
|
|
637
613
|
await this._selection.open(this._ctx);
|
|
638
614
|
}
|
|
639
615
|
initializeColumnMeta() {
|
|
640
|
-
invariant(this._object.view.target, "View must be loaded before initializing column meta", {
|
|
641
|
-
F: __dxlog_file,
|
|
642
|
-
L: 405,
|
|
643
|
-
S: this,
|
|
644
|
-
A: [
|
|
645
|
-
"this._object.view.target",
|
|
646
|
-
"'View must be loaded before initializing column meta'"
|
|
647
|
-
]
|
|
648
|
-
});
|
|
616
|
+
invariant(this._object.view.target, "View must be loaded before initializing column meta", { "~LogMeta": "~LogMeta", F: __dxlog_file, L: 259, S: this, A: ["this._object.view.target", "'View must be loaded before initializing column meta'"] });
|
|
649
617
|
this._columnMeta = Atom2.make((get) => {
|
|
650
618
|
const fields = get(this._projection.fields);
|
|
651
619
|
const meta = Object.fromEntries(fields.map((field, index) => [
|
|
@@ -756,7 +724,7 @@ var TableModel = class extends Resource2 {
|
|
|
756
724
|
return;
|
|
757
725
|
}
|
|
758
726
|
const draftData = {
|
|
759
|
-
id:
|
|
727
|
+
id: EntityId.random()
|
|
760
728
|
};
|
|
761
729
|
const validationErrors = this.validateDraftRowData(draftData);
|
|
762
730
|
const draftRow = {
|
|
@@ -907,41 +875,18 @@ var TableModel = class extends Resource2 {
|
|
|
907
875
|
};
|
|
908
876
|
} else {
|
|
909
877
|
const currentRow = this._registry.get(this._rows)[row];
|
|
910
|
-
invariant(currentRow, "Invalid row index", {
|
|
911
|
-
F: __dxlog_file,
|
|
912
|
-
L: 693,
|
|
913
|
-
S: this,
|
|
914
|
-
A: [
|
|
915
|
-
"currentRow",
|
|
916
|
-
"'Invalid row index'"
|
|
917
|
-
]
|
|
918
|
-
});
|
|
878
|
+
invariant(currentRow, "Invalid row index", { "~LogMeta": "~LogMeta", F: __dxlog_file, L: 533, S: this, A: ["currentRow", "'Invalid row index'"] });
|
|
919
879
|
const snapshot = {
|
|
920
880
|
...getSnapshot(currentRow)
|
|
921
881
|
};
|
|
922
882
|
setValue(snapshot, field.path, transformedValue);
|
|
923
|
-
const
|
|
924
|
-
invariant(
|
|
925
|
-
|
|
926
|
-
L: 699,
|
|
927
|
-
S: this,
|
|
928
|
-
A: [
|
|
929
|
-
"schema",
|
|
930
|
-
""
|
|
931
|
-
]
|
|
932
|
-
});
|
|
883
|
+
const type = Obj.getType(currentRow);
|
|
884
|
+
invariant(type, void 0, { "~LogMeta": "~LogMeta", F: __dxlog_file, L: 539, S: this, A: ["type", ""] });
|
|
885
|
+
const schema = Type.getSchema(type);
|
|
933
886
|
const validationResult = validateSchema(schema, snapshot);
|
|
934
887
|
if (validationResult && validationResult.length > 0) {
|
|
935
888
|
const error = validationResult[0];
|
|
936
|
-
invariant(error.path === field.path, void 0, {
|
|
937
|
-
F: __dxlog_file,
|
|
938
|
-
L: 704,
|
|
939
|
-
S: this,
|
|
940
|
-
A: [
|
|
941
|
-
"error.path === field.path",
|
|
942
|
-
""
|
|
943
|
-
]
|
|
944
|
-
});
|
|
889
|
+
invariant(error.path === field.path, void 0, { "~LogMeta": "~LogMeta", F: __dxlog_file, L: 544, S: this, A: ["error.path === field.path", ""] });
|
|
945
890
|
return {
|
|
946
891
|
valid: false,
|
|
947
892
|
error: error.message
|
|
@@ -1105,13 +1050,13 @@ var TableModel = class extends Resource2 {
|
|
|
1105
1050
|
const field = this._projection.getFields().find((f) => f.id === inMemorySort.fieldId);
|
|
1106
1051
|
if (field) {
|
|
1107
1052
|
const newQuery = baseQuery.orderBy(Order.property(field.path, inMemorySort.direction));
|
|
1108
|
-
Obj.
|
|
1109
|
-
|
|
1053
|
+
Obj.update(view, (view2) => {
|
|
1054
|
+
view2.query.ast = newQuery.ast;
|
|
1110
1055
|
});
|
|
1111
1056
|
}
|
|
1112
1057
|
} else {
|
|
1113
|
-
Obj.
|
|
1114
|
-
|
|
1058
|
+
Obj.update(view, (view2) => {
|
|
1059
|
+
view2.query.ast = baseQuery.ast;
|
|
1115
1060
|
});
|
|
1116
1061
|
}
|
|
1117
1062
|
this._registry.set(this._inMemorySort, void 0);
|
|
@@ -1318,8 +1263,8 @@ var TablePresentation = class {
|
|
|
1318
1263
|
if (props.format === Format3.TypeFormat.Ref && props.referenceSchema) {
|
|
1319
1264
|
const targetObj = getValue2(obj, field.path)?.target;
|
|
1320
1265
|
if (targetObj) {
|
|
1321
|
-
const
|
|
1322
|
-
cell.accessoryHtml = `<div role="none" class="absolute end-0 inset-y-0 p-(--dx-grid-cell-content-padding-block)"><dx-anchor
|
|
1266
|
+
const uri = Obj2.getURI(targetObj);
|
|
1267
|
+
cell.accessoryHtml = `<div role="none" class="absolute end-0 inset-y-0 p-(--dx-grid-cell-content-padding-block)"><dx-anchor uri=${uri} 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>`;
|
|
1323
1268
|
}
|
|
1324
1269
|
}
|
|
1325
1270
|
if (props.format === Format3.TypeFormat.Boolean) {
|
|
@@ -1591,11 +1536,11 @@ var cellClassesForRowSelection = (selected, selectionMode) => {
|
|
|
1591
1536
|
switch (selectionMode) {
|
|
1592
1537
|
case "single":
|
|
1593
1538
|
return [
|
|
1594
|
-
"dx-grid__cell--no-focus-unfurl
|
|
1539
|
+
"dx-grid__cell--no-focus-unfurl bg-current-surface! hover:bg-hover-surface cursor-pointer!"
|
|
1595
1540
|
];
|
|
1596
1541
|
case "multiple":
|
|
1597
1542
|
return [
|
|
1598
|
-
"
|
|
1543
|
+
"bg-grid-cell-selected!"
|
|
1599
1544
|
];
|
|
1600
1545
|
}
|
|
1601
1546
|
};
|
|
@@ -1622,7 +1567,7 @@ var useAddRow = ({ db, schema }) => {
|
|
|
1622
1567
|
|
|
1623
1568
|
// src/hooks/useProjectionModel.ts
|
|
1624
1569
|
import { useState } from "react";
|
|
1625
|
-
import {
|
|
1570
|
+
import { Type as Type2 } from "@dxos/echo";
|
|
1626
1571
|
import { useAsyncEffect } from "@dxos/react-ui";
|
|
1627
1572
|
import { ProjectionModel, createEchoChangeCallback as createEchoChangeCallback2 } from "@dxos/schema";
|
|
1628
1573
|
var useProjectionModel = (schema, table, registry) => {
|
|
@@ -1630,8 +1575,8 @@ var useProjectionModel = (schema, table, registry) => {
|
|
|
1630
1575
|
useAsyncEffect(async () => {
|
|
1631
1576
|
if (schema && table) {
|
|
1632
1577
|
const view = await table.view.load();
|
|
1633
|
-
const jsonSchema =
|
|
1634
|
-
const change = createEchoChangeCallback2(view,
|
|
1578
|
+
const jsonSchema = schema.jsonSchema;
|
|
1579
|
+
const change = createEchoChangeCallback2(view, Type2.getDatabase(schema) != null ? schema : void 0);
|
|
1635
1580
|
const projection2 = new ProjectionModel({
|
|
1636
1581
|
registry,
|
|
1637
1582
|
view,
|
|
@@ -1657,7 +1602,7 @@ import { useSelected, useSelectionActions } from "@dxos/react-ui-attention";
|
|
|
1657
1602
|
import { isNonNullable } from "@dxos/util";
|
|
1658
1603
|
var useTableModel = ({ object, projection, db, rows, rowActions, features, onSelectionChanged, onRowAction, ...props }) => {
|
|
1659
1604
|
const registry = useContext(RegistryContext);
|
|
1660
|
-
const selected = useSelected(object && Obj4.
|
|
1605
|
+
const selected = useSelected(object && Obj4.getURI(object), "multi");
|
|
1661
1606
|
const initialSelection = useMemo(() => selected, [
|
|
1662
1607
|
object
|
|
1663
1608
|
]);
|
|
@@ -1748,4 +1693,4 @@ export {
|
|
|
1748
1693
|
useProjectionModel,
|
|
1749
1694
|
useTableModel
|
|
1750
1695
|
};
|
|
1751
|
-
//# sourceMappingURL=chunk-
|
|
1696
|
+
//# sourceMappingURL=chunk-X7A7G6RR.mjs.map
|