@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.
Files changed (56) hide show
  1. package/dist/lib/browser/{chunk-U6LL2AVU.mjs → chunk-TL7CKQQV.mjs} +4 -3
  2. package/dist/lib/browser/chunk-TL7CKQQV.mjs.map +7 -0
  3. package/dist/lib/browser/index.mjs +252 -125
  4. package/dist/lib/browser/index.mjs.map +4 -4
  5. package/dist/lib/browser/meta.json +1 -1
  6. package/dist/lib/browser/types/index.mjs +1 -1
  7. package/dist/lib/node/{chunk-CXDGXPM6.cjs → chunk-O2VPBNS5.cjs} +6 -5
  8. package/dist/lib/node/chunk-O2VPBNS5.cjs.map +7 -0
  9. package/dist/lib/node/index.cjs +252 -127
  10. package/dist/lib/node/index.cjs.map +4 -4
  11. package/dist/lib/node/meta.json +1 -1
  12. package/dist/lib/node/types/index.cjs +3 -3
  13. package/dist/lib/node/types/index.cjs.map +1 -1
  14. package/dist/lib/node-esm/{chunk-EFSM52KQ.mjs → chunk-GBT6GD4G.mjs} +4 -3
  15. package/dist/lib/node-esm/chunk-GBT6GD4G.mjs.map +7 -0
  16. package/dist/lib/node-esm/index.mjs +252 -125
  17. package/dist/lib/node-esm/index.mjs.map +4 -4
  18. package/dist/lib/node-esm/meta.json +1 -1
  19. package/dist/lib/node-esm/types/index.mjs +1 -1
  20. package/dist/types/src/components/Table/DynamicTable.stories.d.ts.map +1 -1
  21. package/dist/types/src/components/Table/Table.d.ts +2 -0
  22. package/dist/types/src/components/Table/Table.d.ts.map +1 -1
  23. package/dist/types/src/components/Table/Table.stories.d.ts.map +1 -1
  24. package/dist/types/src/components/Table/relations.stories.d.ts.map +1 -1
  25. package/dist/types/src/components/TableCellEditor/CellValidationMessage.d.ts +7 -0
  26. package/dist/types/src/components/TableCellEditor/CellValidationMessage.d.ts.map +1 -0
  27. package/dist/types/src/components/TableCellEditor/TableCellEditor.d.ts.map +1 -1
  28. package/dist/types/src/components/TableCellEditor/TableCellEditor.stories.d.ts.map +1 -1
  29. package/dist/types/src/components/testing.d.ts +2 -2
  30. package/dist/types/src/components/testing.d.ts.map +1 -1
  31. package/dist/types/src/hooks/useTableModel.d.ts.map +1 -1
  32. package/dist/types/src/model/table-model.d.ts +7 -0
  33. package/dist/types/src/model/table-model.d.ts.map +1 -1
  34. package/dist/types/src/types/table.d.ts +5 -4
  35. package/dist/types/src/types/table.d.ts.map +1 -1
  36. package/dist/types/src/util/dynamic-table.d.ts.map +1 -1
  37. package/package.json +34 -34
  38. package/src/components/Table/DynamicTable.stories.tsx +3 -2
  39. package/src/components/Table/Table.stories.tsx +15 -7
  40. package/src/components/Table/Table.tsx +13 -3
  41. package/src/components/Table/relations.stories.tsx +15 -10
  42. package/src/components/TableCellEditor/CellValidationMessage.tsx +38 -0
  43. package/src/components/TableCellEditor/TableCellEditor.stories.tsx +2 -1
  44. package/src/components/TableCellEditor/TableCellEditor.tsx +54 -22
  45. package/src/components/testing.ts +5 -4
  46. package/src/hooks/useTableModel.ts +8 -1
  47. package/src/model/table-model.test.ts +3 -2
  48. package/src/model/table-model.ts +88 -39
  49. package/src/model/table-presentation.test.ts +3 -2
  50. package/src/model/table-presentation.ts +1 -1
  51. package/src/types/table.ts +3 -2
  52. package/src/util/dynamic-table.ts +2 -2
  53. package/src/util/table.ts +11 -10
  54. package/dist/lib/browser/chunk-U6LL2AVU.mjs.map +0 -7
  55. package/dist/lib/node/chunk-CXDGXPM6.cjs.map +0 -7
  56. 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 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>`;
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
 
@@ -5,7 +5,8 @@
5
5
  import { Schema } from 'effect';
6
6
 
7
7
  // import { ThreadType } from '@dxos/plugin-space/types';
8
- import { ObjectId, Ref, Expando, EchoObject, LabelAnnotation } from '@dxos/echo-schema';
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
- EchoObject({
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 = live(TableType, { name: 'dynamic-table', view: makeRef(view) });
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([ContactSchema]);
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 ContactSchema = TypedObject({
83
- typename: `example.com/type/${PublicKey.random().truncate()}`,
84
- version: '0.1.0',
85
- })({
86
- name: Schema.optional(Schema.String).annotations({ title: 'Name' }),
87
- active: Schema.optional(Schema.Boolean),
88
- email: Schema.optional(Format.Email),
89
- salary: Schema.optional(Format.Currency()).annotations({ title: 'Salary' }),
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
- }