@dxos/react-ui-table 0.8.3-main.7f5a14c → 0.8.3
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-U6LL2AVU.mjs → chunk-TL7CKQQV.mjs} +4 -3
- package/dist/lib/browser/chunk-TL7CKQQV.mjs.map +7 -0
- package/dist/lib/browser/index.mjs +252 -125
- 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-CXDGXPM6.cjs → chunk-O2VPBNS5.cjs} +6 -5
- package/dist/lib/node/chunk-O2VPBNS5.cjs.map +7 -0
- package/dist/lib/node/index.cjs +252 -127
- 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-EFSM52KQ.mjs → chunk-GBT6GD4G.mjs} +4 -3
- package/dist/lib/node-esm/chunk-GBT6GD4G.mjs.map +7 -0
- package/dist/lib/node-esm/index.mjs +252 -125
- 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/DynamicTable.stories.d.ts.map +1 -1
- package/dist/types/src/components/Table/Table.d.ts +2 -0
- package/dist/types/src/components/Table/Table.d.ts.map +1 -1
- package/dist/types/src/components/Table/Table.stories.d.ts.map +1 -1
- package/dist/types/src/components/Table/relations.stories.d.ts.map +1 -1
- package/dist/types/src/components/TableCellEditor/CellValidationMessage.d.ts +7 -0
- package/dist/types/src/components/TableCellEditor/CellValidationMessage.d.ts.map +1 -0
- package/dist/types/src/components/TableCellEditor/TableCellEditor.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 +2 -2
- 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/table-model.d.ts +7 -0
- package/dist/types/src/model/table-model.d.ts.map +1 -1
- package/dist/types/src/types/table.d.ts +5 -4
- package/dist/types/src/types/table.d.ts.map +1 -1
- package/dist/types/src/util/dynamic-table.d.ts.map +1 -1
- package/package.json +34 -34
- package/src/components/Table/DynamicTable.stories.tsx +3 -2
- package/src/components/Table/Table.stories.tsx +15 -7
- package/src/components/Table/Table.tsx +13 -3
- package/src/components/Table/relations.stories.tsx +15 -10
- package/src/components/TableCellEditor/CellValidationMessage.tsx +38 -0
- package/src/components/TableCellEditor/TableCellEditor.stories.tsx +2 -1
- package/src/components/TableCellEditor/TableCellEditor.tsx +54 -22
- package/src/components/testing.ts +5 -4
- package/src/hooks/useTableModel.ts +8 -1
- package/src/model/table-model.test.ts +3 -2
- package/src/model/table-model.ts +88 -39
- package/src/model/table-presentation.test.ts +3 -2
- package/src/model/table-presentation.ts +1 -1
- package/src/types/table.ts +3 -2
- package/src/util/dynamic-table.ts +2 -2
- package/src/util/table.ts +11 -10
- package/dist/lib/browser/chunk-U6LL2AVU.mjs.map +0 -7
- package/dist/lib/node/chunk-CXDGXPM6.cjs.map +0 -7
- package/dist/lib/node-esm/chunk-EFSM52KQ.mjs.map +0 -7
|
@@ -171,7 +171,7 @@ export class TablePresentation<T extends TableRow = TableRow> {
|
|
|
171
171
|
const targetObj = getValue(obj, field.path)?.target;
|
|
172
172
|
if (targetObj) {
|
|
173
173
|
const dxn = getObjectDXN(targetObj)?.toString();
|
|
174
|
-
cell.accessoryHtml = `<dx-ref-tag refId=${dxn} class="dx-button
|
|
174
|
+
cell.accessoryHtml = `<dx-ref-tag refId=${dxn} class="dx-button is-6 pli-[3px] pbe-[2px] min-bs-0 absolute inline-end-1"><dx-icon icon="ph--link-simple--regular"/></dx-ref-tag>`;
|
|
175
175
|
}
|
|
176
176
|
}
|
|
177
177
|
|
package/src/types/table.ts
CHANGED
|
@@ -5,7 +5,8 @@
|
|
|
5
5
|
import { Schema } from 'effect';
|
|
6
6
|
|
|
7
7
|
// import { ThreadType } from '@dxos/plugin-space/types';
|
|
8
|
-
import {
|
|
8
|
+
import { Type } from '@dxos/echo';
|
|
9
|
+
import { ObjectId, Ref, Expando, LabelAnnotation } from '@dxos/echo-schema';
|
|
9
10
|
import { ViewType } from '@dxos/schema';
|
|
10
11
|
|
|
11
12
|
export const TableSchema = Schema.Struct({
|
|
@@ -18,7 +19,7 @@ export const TableSchema = Schema.Struct({
|
|
|
18
19
|
|
|
19
20
|
// TODO(burdon): Move out of react-ui-xxx.
|
|
20
21
|
export const TableType = TableSchema.pipe(
|
|
21
|
-
|
|
22
|
+
Type.Obj({
|
|
22
23
|
typename: 'dxos.org/type/Table',
|
|
23
24
|
version: '0.1.0',
|
|
24
25
|
}),
|
|
@@ -4,9 +4,9 @@
|
|
|
4
4
|
|
|
5
5
|
import { type Schema } from 'effect';
|
|
6
6
|
|
|
7
|
+
import { Obj, Ref } from '@dxos/echo';
|
|
7
8
|
import { getTypename, toJsonSchema } from '@dxos/echo-schema';
|
|
8
9
|
import type { JsonSchemaType, SortDirectionType } from '@dxos/echo-schema';
|
|
9
|
-
import { live, makeRef } from '@dxos/live-object';
|
|
10
10
|
import {
|
|
11
11
|
createView,
|
|
12
12
|
getSchemaFromPropertyDefinitions,
|
|
@@ -69,7 +69,7 @@ export const makeDynamicTable = ({
|
|
|
69
69
|
...(properties && { fields: properties.map((property) => property.name) }),
|
|
70
70
|
});
|
|
71
71
|
|
|
72
|
-
const table =
|
|
72
|
+
const table = Obj.make(TableType, { name: 'dynamic-table', view: Ref.make(view) });
|
|
73
73
|
const projection = new ViewProjection(jsonSchema, view);
|
|
74
74
|
if (properties && view.fields) {
|
|
75
75
|
setProperties(view, projection, properties);
|
package/src/util/table.ts
CHANGED
|
@@ -56,7 +56,7 @@ export const initializeTable = async ({
|
|
|
56
56
|
|
|
57
57
|
return schema;
|
|
58
58
|
} else {
|
|
59
|
-
const [schema] = await space.db.schemaRegistry.register([
|
|
59
|
+
const [schema] = await space.db.schemaRegistry.register([createContactSchema()]);
|
|
60
60
|
const fields = ContactFields;
|
|
61
61
|
|
|
62
62
|
table.view = Ref.make(
|
|
@@ -79,15 +79,16 @@ export const initializeTable = async ({
|
|
|
79
79
|
}
|
|
80
80
|
};
|
|
81
81
|
|
|
82
|
-
const
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
})
|
|
82
|
+
const createContactSchema = () =>
|
|
83
|
+
TypedObject({
|
|
84
|
+
typename: `example.com/type/${PublicKey.random().truncate()}`,
|
|
85
|
+
version: '0.1.0',
|
|
86
|
+
})({
|
|
87
|
+
name: Schema.optional(Schema.String).annotations({ title: 'Name' }),
|
|
88
|
+
active: Schema.optional(Schema.Boolean).annotations({ title: 'Active' }),
|
|
89
|
+
email: Schema.optional(Format.Email),
|
|
90
|
+
salary: Schema.optional(Format.Currency()).annotations({ title: 'Salary' }),
|
|
91
|
+
});
|
|
91
92
|
|
|
92
93
|
const ContactFields = ['name', 'email', 'salary', 'active'];
|
|
93
94
|
|
|
@@ -1,7 +0,0 @@
|
|
|
1
|
-
{
|
|
2
|
-
"version": 3,
|
|
3
|
-
"sources": ["../../../src/types/table.ts"],
|
|
4
|
-
"sourcesContent": ["//\n// Copyright 2024 DXOS.org\n//\n\nimport { Schema } from 'effect';\n\n// import { ThreadType } from '@dxos/plugin-space/types';\nimport { ObjectId, Ref, Expando, EchoObject, LabelAnnotation } from '@dxos/echo-schema';\nimport { ViewType } from '@dxos/schema';\n\nexport const TableSchema = Schema.Struct({\n id: ObjectId,\n name: Schema.optional(Schema.String),\n view: Schema.optional(Ref(ViewType)),\n // TODO(burdon): Document why threads is included here?\n threads: Schema.optional(Schema.Array(Ref(Expando /* ThreadType */))),\n}).pipe(LabelAnnotation.set(['name']));\n\n// TODO(burdon): Move out of react-ui-xxx.\nexport const TableType = TableSchema.pipe(\n EchoObject({\n typename: 'dxos.org/type/Table',\n version: '0.1.0',\n }),\n);\nexport interface TableType extends Schema.Schema.Type<typeof TableType> {}\n"],
|
|
5
|
-
"mappings": ";AAIA,SAASA,cAAc;AAGvB,SAASC,UAAUC,KAAKC,SAASC,YAAYC,uBAAuB;AACpE,SAASC,gBAAgB;AAElB,IAAMC,cAAcC,OAAOC,OAAO;EACvCC,IAAIC;EACJC,MAAMJ,OAAOK,SAASL,OAAOM,MAAM;EACnCC,MAAMP,OAAOK,SAASG,IAAIC,QAAAA,CAAAA;;EAE1BC,SAASV,OAAOK,SAASL,OAAOW,MAAMH;IAAII;;EAAsB,CAAA,CAAA;AAClE,CAAA,EAAGC,KAAKC,gBAAgBC,IAAI;EAAC;CAAO,CAAA;AAG7B,IAAMC,YAAYjB,YAAYc,KACnCI,WAAW;EACTC,UAAU;EACVC,SAAS;AACX,CAAA,CAAA;",
|
|
6
|
-
"names": ["Schema", "ObjectId", "Ref", "Expando", "EchoObject", "LabelAnnotation", "ViewType", "TableSchema", "Schema", "Struct", "id", "ObjectId", "name", "optional", "String", "view", "Ref", "ViewType", "threads", "Array", "Expando", "pipe", "LabelAnnotation", "set", "TableType", "EchoObject", "typename", "version"]
|
|
7
|
-
}
|
|
@@ -1,7 +0,0 @@
|
|
|
1
|
-
{
|
|
2
|
-
"version": 3,
|
|
3
|
-
"sources": ["../../../src/types/table.ts"],
|
|
4
|
-
"sourcesContent": ["//\n// Copyright 2024 DXOS.org\n//\n\nimport { Schema } from 'effect';\n\n// import { ThreadType } from '@dxos/plugin-space/types';\nimport { ObjectId, Ref, Expando, EchoObject, LabelAnnotation } from '@dxos/echo-schema';\nimport { ViewType } from '@dxos/schema';\n\nexport const TableSchema = Schema.Struct({\n id: ObjectId,\n name: Schema.optional(Schema.String),\n view: Schema.optional(Ref(ViewType)),\n // TODO(burdon): Document why threads is included here?\n threads: Schema.optional(Schema.Array(Ref(Expando /* ThreadType */))),\n}).pipe(LabelAnnotation.set(['name']));\n\n// TODO(burdon): Move out of react-ui-xxx.\nexport const TableType = TableSchema.pipe(\n EchoObject({\n typename: 'dxos.org/type/Table',\n version: '0.1.0',\n }),\n);\nexport interface TableType extends Schema.Schema.Type<typeof TableType> {}\n"],
|
|
5
|
-
"mappings": ";;;;;;;;;;;;;;;;;;;;;;;;AAIA,oBAAuB;AAGvB,yBAAoE;AACpE,oBAAyB;AAElB,IAAMA,cAAcC,qBAAOC,OAAO;EACvCC,IAAIC;EACJC,MAAMJ,qBAAOK,SAASL,qBAAOM,MAAM;EACnCC,MAAMP,qBAAOK,aAASG,wBAAIC,sBAAAA,CAAAA;;EAE1BC,SAASV,qBAAOK,SAASL,qBAAOW,UAAMH;IAAII;;EAAsB,CAAA,CAAA;AAClE,CAAA,EAAGC,KAAKC,mCAAgBC,IAAI;EAAC;CAAO,CAAA;AAG7B,IAAMC,YAAYjB,YAAYc,SACnCI,+BAAW;EACTC,UAAU;EACVC,SAAS;AACX,CAAA,CAAA;",
|
|
6
|
-
"names": ["TableSchema", "Schema", "Struct", "id", "ObjectId", "name", "optional", "String", "view", "Ref", "ViewType", "threads", "Array", "Expando", "pipe", "LabelAnnotation", "set", "TableType", "EchoObject", "typename", "version"]
|
|
7
|
-
}
|
|
@@ -1,7 +0,0 @@
|
|
|
1
|
-
{
|
|
2
|
-
"version": 3,
|
|
3
|
-
"sources": ["../../../src/types/table.ts"],
|
|
4
|
-
"sourcesContent": ["//\n// Copyright 2024 DXOS.org\n//\n\nimport { Schema } from 'effect';\n\n// import { ThreadType } from '@dxos/plugin-space/types';\nimport { ObjectId, Ref, Expando, EchoObject, LabelAnnotation } from '@dxos/echo-schema';\nimport { ViewType } from '@dxos/schema';\n\nexport const TableSchema = Schema.Struct({\n id: ObjectId,\n name: Schema.optional(Schema.String),\n view: Schema.optional(Ref(ViewType)),\n // TODO(burdon): Document why threads is included here?\n threads: Schema.optional(Schema.Array(Ref(Expando /* ThreadType */))),\n}).pipe(LabelAnnotation.set(['name']));\n\n// TODO(burdon): Move out of react-ui-xxx.\nexport const TableType = TableSchema.pipe(\n EchoObject({\n typename: 'dxos.org/type/Table',\n version: '0.1.0',\n }),\n);\nexport interface TableType extends Schema.Schema.Type<typeof TableType> {}\n"],
|
|
5
|
-
"mappings": ";;;AAIA,SAASA,cAAc;AAGvB,SAASC,UAAUC,KAAKC,SAASC,YAAYC,uBAAuB;AACpE,SAASC,gBAAgB;AAElB,IAAMC,cAAcC,OAAOC,OAAO;EACvCC,IAAIC;EACJC,MAAMJ,OAAOK,SAASL,OAAOM,MAAM;EACnCC,MAAMP,OAAOK,SAASG,IAAIC,QAAAA,CAAAA;;EAE1BC,SAASV,OAAOK,SAASL,OAAOW,MAAMH;IAAII;;EAAsB,CAAA,CAAA;AAClE,CAAA,EAAGC,KAAKC,gBAAgBC,IAAI;EAAC;CAAO,CAAA;AAG7B,IAAMC,YAAYjB,YAAYc,KACnCI,WAAW;EACTC,UAAU;EACVC,SAAS;AACX,CAAA,CAAA;",
|
|
6
|
-
"names": ["Schema", "ObjectId", "Ref", "Expando", "EchoObject", "LabelAnnotation", "ViewType", "TableSchema", "Schema", "Struct", "id", "ObjectId", "name", "optional", "String", "view", "Ref", "ViewType", "threads", "Array", "Expando", "pipe", "LabelAnnotation", "set", "TableType", "EchoObject", "typename", "version"]
|
|
7
|
-
}
|