@dxos/react-ui-table 0.7.5-main.9d2a38b → 0.7.5-main.c41020f

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 (87) hide show
  1. package/dist/lib/browser/{chunk-T7CTRLHA.mjs → chunk-3FR6NHPD.mjs} +6 -4
  2. package/dist/lib/browser/chunk-3FR6NHPD.mjs.map +7 -0
  3. package/dist/lib/browser/index.mjs +57 -8
  4. package/dist/lib/browser/index.mjs.map +3 -3
  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-XQRKYO7Q.cjs → chunk-NB3SFHGA.cjs} +8 -6
  8. package/dist/lib/node/chunk-NB3SFHGA.cjs.map +7 -0
  9. package/dist/lib/node/index.cjs +59 -10
  10. package/dist/lib/node/index.cjs.map +3 -3
  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-6HE6MLBK.mjs → chunk-RLVVOZW5.mjs} +6 -4
  15. package/dist/lib/node-esm/chunk-RLVVOZW5.mjs.map +7 -0
  16. package/dist/lib/node-esm/index.mjs +57 -8
  17. package/dist/lib/node-esm/index.mjs.map +3 -3
  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/_deprecated/components/Cell/Cell.d.ts +2 -2
  21. package/dist/types/src/_deprecated/components/Cell/Cell.d.ts.map +1 -1
  22. package/dist/types/src/_deprecated/components/Cell/CellCombobox.d.ts +1 -2
  23. package/dist/types/src/_deprecated/components/Cell/CellCombobox.d.ts.map +1 -1
  24. package/dist/types/src/_deprecated/components/ColumnMenu/ColumnMenu.d.ts +2 -3
  25. package/dist/types/src/_deprecated/components/ColumnMenu/ColumnMenu.d.ts.map +1 -1
  26. package/dist/types/src/_deprecated/components/ColumnMenu/ColumnMenu.stories.d.ts +6 -7
  27. package/dist/types/src/_deprecated/components/ColumnMenu/ColumnMenu.stories.d.ts.map +1 -1
  28. package/dist/types/src/_deprecated/components/ColumnMenu/ColumnSettings.d.ts +1 -2
  29. package/dist/types/src/_deprecated/components/ColumnMenu/ColumnSettings.d.ts.map +1 -1
  30. package/dist/types/src/_deprecated/components/ColumnMenu/ColumnSettings.stories.d.ts +6 -7
  31. package/dist/types/src/_deprecated/components/ColumnMenu/ColumnSettings.stories.d.ts.map +1 -1
  32. package/dist/types/src/_deprecated/components/Table/Table.d.ts +5 -5
  33. package/dist/types/src/_deprecated/components/Table/Table.d.ts.map +1 -1
  34. package/dist/types/src/_deprecated/components/Table/Table.stories.d.ts +8 -9
  35. package/dist/types/src/_deprecated/components/Table/Table.stories.d.ts.map +1 -1
  36. package/dist/types/src/_deprecated/components/Table/TableBody.d.ts +1 -2
  37. package/dist/types/src/_deprecated/components/Table/TableBody.d.ts.map +1 -1
  38. package/dist/types/src/_deprecated/components/Table/TableContext.d.ts +1 -1
  39. package/dist/types/src/_deprecated/components/Table/TableContext.d.ts.map +1 -1
  40. package/dist/types/src/_deprecated/components/Table/TableHead.d.ts +1 -2
  41. package/dist/types/src/_deprecated/components/Table/TableHead.d.ts.map +1 -1
  42. package/dist/types/src/_deprecated/schema/Schema.stories.d.ts +2 -3
  43. package/dist/types/src/_deprecated/schema/Schema.stories.d.ts.map +1 -1
  44. package/dist/types/src/components/Table/ColumnActionsMenu.d.ts +1 -2
  45. package/dist/types/src/components/Table/ColumnActionsMenu.d.ts.map +1 -1
  46. package/dist/types/src/components/Table/ColumnSettings.d.ts +1 -2
  47. package/dist/types/src/components/Table/ColumnSettings.d.ts.map +1 -1
  48. package/dist/types/src/components/Table/CreateRefPanel.d.ts +1 -2
  49. package/dist/types/src/components/Table/CreateRefPanel.d.ts.map +1 -1
  50. package/dist/types/src/components/Table/RefPanel.d.ts +1 -2
  51. package/dist/types/src/components/Table/RefPanel.d.ts.map +1 -1
  52. package/dist/types/src/components/Table/RowActionsMenu.d.ts +1 -2
  53. package/dist/types/src/components/Table/RowActionsMenu.d.ts.map +1 -1
  54. package/dist/types/src/components/Table/Table.d.ts +1 -1
  55. package/dist/types/src/components/Table/Table.stories.d.ts +1 -4
  56. package/dist/types/src/components/Table/Table.stories.d.ts.map +1 -1
  57. package/dist/types/src/components/TableCellEditor/TableCellEditor.d.ts +1 -2
  58. package/dist/types/src/components/TableCellEditor/TableCellEditor.d.ts.map +1 -1
  59. package/dist/types/src/components/TableToolbar/TableToolbar.d.ts +1 -2
  60. package/dist/types/src/components/TableToolbar/TableToolbar.d.ts.map +1 -1
  61. package/dist/types/src/components/testing.d.ts +12 -35
  62. package/dist/types/src/components/testing.d.ts.map +1 -1
  63. package/dist/types/src/hooks/useTableModel.d.ts.map +1 -1
  64. package/dist/types/src/model/table-presentation.d.ts.map +1 -1
  65. package/dist/types/src/model/table-sorting.d.ts.map +1 -1
  66. package/dist/types/src/types/table.d.ts +21 -90
  67. package/dist/types/src/types/table.d.ts.map +1 -1
  68. package/dist/types/src/util/table.d.ts.map +1 -1
  69. package/package.json +36 -35
  70. package/src/_deprecated/schema/Schema.stories.tsx +1 -1
  71. package/src/components/Table/Table.stories.tsx +23 -24
  72. package/src/components/TableCellEditor/TableCellEditor.stories.tsx +1 -1
  73. package/src/hooks/useTableModel.ts +21 -0
  74. package/src/model/table-model.ts +1 -1
  75. package/src/model/table-presentation.ts +13 -1
  76. package/src/model/table-sorting.ts +14 -0
  77. package/src/playwright/smoke.spec.ts +3 -3
  78. package/src/types/table.ts +3 -3
  79. package/src/util/table-buttons.ts +1 -1
  80. package/src/util/table-controls.ts +2 -2
  81. package/src/util/table.ts +9 -2
  82. package/dist/lib/browser/chunk-T7CTRLHA.mjs.map +0 -7
  83. package/dist/lib/node/chunk-XQRKYO7Q.cjs.map +0 -7
  84. package/dist/lib/node-esm/chunk-6HE6MLBK.mjs.map +0 -7
  85. package/dist/types/src/playwright/playwright.config.d.ts +0 -3
  86. package/dist/types/src/playwright/playwright.config.d.ts.map +0 -1
  87. /package/src/playwright/{playwright.config.ts → playwright.config.cts} +0 -0
package/package.json CHANGED
@@ -1,12 +1,13 @@
1
1
  {
2
2
  "name": "@dxos/react-ui-table",
3
- "version": "0.7.5-main.9d2a38b",
3
+ "version": "0.7.5-main.c41020f",
4
4
  "description": "A table component.",
5
5
  "homepage": "https://dxos.org",
6
6
  "bugs": "https://github.com/dxos/dxos/issues",
7
7
  "license": "MIT",
8
8
  "author": "DXOS.org",
9
9
  "sideEffects": true,
10
+ "type": "module",
10
11
  "exports": {
11
12
  "./deprecated": {
12
13
  "types": "./dist/types/src/_deprecated/index.d.ts",
@@ -43,37 +44,37 @@
43
44
  "@codemirror/autocomplete": "^6.18.1",
44
45
  "@codemirror/state": "^6.4.1",
45
46
  "@codemirror/view": "^6.34.1",
46
- "@fluentui/react-tabster": "^9.19.0",
47
+ "@fluentui/react-tabster": "9.23.3",
47
48
  "@preact/signals-core": "^1.6.0",
48
- "@radix-ui/react-context": "^1.0.0",
49
- "@radix-ui/react-primitive": "^1.0.2",
50
- "@radix-ui/react-slot": "^1.0.1",
51
- "@radix-ui/react-use-controllable-state": "^1.0.0",
49
+ "@radix-ui/react-context": "1.1.1",
50
+ "@radix-ui/react-primitive": "2.0.2",
51
+ "@radix-ui/react-slot": "1.1.2",
52
+ "@radix-ui/react-use-controllable-state": "1.1.0",
52
53
  "@tanstack/react-table": "^8.13.2",
53
54
  "@tanstack/react-virtual": "^3.9.0",
54
55
  "date-fns": "^3.3.1",
55
56
  "lodash.orderby": "^4.6.0",
56
- "@dxos/context": "0.7.5-main.9d2a38b",
57
- "@dxos/debug": "0.7.5-main.9d2a38b",
58
- "@dxos/echo-schema": "0.7.5-main.9d2a38b",
59
- "@dxos/invariant": "0.7.5-main.9d2a38b",
60
- "@dxos/keys": "0.7.5-main.9d2a38b",
61
- "@dxos/lit-grid": "0.7.5-main.9d2a38b",
62
- "@dxos/live-object": "0.7.5-main.9d2a38b",
63
- "@dxos/plugin-search": "0.7.5-main.9d2a38b",
64
- "@dxos/plugin-space": "0.7.5-main.9d2a38b",
65
- "@dxos/react-client": "0.7.5-main.9d2a38b",
66
- "@dxos/log": "0.7.5-main.9d2a38b",
67
- "@dxos/react-ui-form": "0.7.5-main.9d2a38b",
68
- "@dxos/react-ui-searchlist": "0.7.5-main.9d2a38b",
69
- "@dxos/react-ui-menu": "0.7.5-main.9d2a38b",
70
- "@dxos/react-ui-stack": "0.7.5-main.9d2a38b",
71
- "@dxos/react-ui-syntax-highlighter": "0.7.5-main.9d2a38b",
72
- "@dxos/react-ui-grid": "0.7.5-main.9d2a38b",
73
- "@dxos/react-ui-types": "0.7.5-main.9d2a38b",
74
- "@dxos/schema": "0.7.5-main.9d2a38b",
75
- "@dxos/util": "0.7.5-main.9d2a38b",
76
- "@dxos/react-ui-attention": "0.7.5-main.9d2a38b"
57
+ "@dxos/context": "0.7.5-main.c41020f",
58
+ "@dxos/debug": "0.7.5-main.c41020f",
59
+ "@dxos/invariant": "0.7.5-main.c41020f",
60
+ "@dxos/echo-schema": "0.7.5-main.c41020f",
61
+ "@dxos/keys": "0.7.5-main.c41020f",
62
+ "@dxos/lit-grid": "0.7.5-main.c41020f",
63
+ "@dxos/log": "0.7.5-main.c41020f",
64
+ "@dxos/live-object": "0.7.5-main.c41020f",
65
+ "@dxos/plugin-search": "0.7.5-main.c41020f",
66
+ "@dxos/react-client": "0.7.5-main.c41020f",
67
+ "@dxos/plugin-space": "0.7.5-main.c41020f",
68
+ "@dxos/react-ui-grid": "0.7.5-main.c41020f",
69
+ "@dxos/react-ui-menu": "0.7.5-main.c41020f",
70
+ "@dxos/react-ui-attention": "0.7.5-main.c41020f",
71
+ "@dxos/react-ui-form": "0.7.5-main.c41020f",
72
+ "@dxos/react-ui-searchlist": "0.7.5-main.c41020f",
73
+ "@dxos/react-ui-syntax-highlighter": "0.7.5-main.c41020f",
74
+ "@dxos/react-ui-stack": "0.7.5-main.c41020f",
75
+ "@dxos/react-ui-types": "0.7.5-main.c41020f",
76
+ "@dxos/schema": "0.7.5-main.c41020f",
77
+ "@dxos/util": "0.7.5-main.c41020f"
77
78
  },
78
79
  "devDependencies": {
79
80
  "@phosphor-icons/react": "^2.1.5",
@@ -84,19 +85,19 @@
84
85
  "react": "~18.2.0",
85
86
  "react-dom": "~18.2.0",
86
87
  "vite": "5.4.7",
87
- "@dxos/echo-signals": "0.7.5-main.9d2a38b",
88
- "@dxos/random": "0.7.5-main.9d2a38b",
89
- "@dxos/react-ui-theme": "0.7.5-main.9d2a38b",
90
- "@dxos/storybook-utils": "0.7.5-main.9d2a38b",
91
- "@dxos/test-utils": "0.7.5-main.9d2a38b",
92
- "@dxos/react-ui": "0.7.5-main.9d2a38b"
88
+ "@dxos/echo-signals": "0.7.5-main.c41020f",
89
+ "@dxos/random": "0.7.5-main.c41020f",
90
+ "@dxos/react-ui": "0.7.5-main.c41020f",
91
+ "@dxos/react-ui-theme": "0.7.5-main.c41020f",
92
+ "@dxos/storybook-utils": "0.7.5-main.c41020f",
93
+ "@dxos/test-utils": "0.7.5-main.c41020f"
93
94
  },
94
95
  "peerDependencies": {
95
96
  "@phosphor-icons/react": "^2.1.5",
96
97
  "react": "~18.2.0",
97
98
  "react-dom": "~18.2.0",
98
- "@dxos/react-ui": "0.7.5-main.9d2a38b",
99
- "@dxos/react-ui-theme": "0.7.5-main.9d2a38b"
99
+ "@dxos/react-ui": "0.7.5-main.c41020f",
100
+ "@dxos/react-ui-theme": "0.7.5-main.c41020f"
100
101
  },
101
102
  "publishConfig": {
102
103
  "access": "public"
@@ -15,7 +15,7 @@ import { schemaToColumnDefs } from './column-utils';
15
15
  import { Table } from '../components';
16
16
 
17
17
  export default {
18
- title: 'ui/react-ui-table/Schema',
18
+ title: 'ui/react-ui-table/deprecated/Schema',
19
19
  decorators: [withTheme, withLayout()],
20
20
  };
21
21
 
@@ -1,17 +1,16 @@
1
1
  //
2
- // Copyright 2024 DXOS.org
2
+ // Copyright 2025 DXOS.org
3
3
  //
4
4
 
5
5
  import '@dxos-theme';
6
6
 
7
- import { type StoryObj, type Meta } from '@storybook/react';
7
+ import { type Meta } from '@storybook/react';
8
8
  import React, { useCallback, useEffect, useMemo, useRef, useState } from 'react';
9
9
 
10
- import { type EchoSchema } from '@dxos/echo-schema';
11
10
  import { invariant } from '@dxos/invariant';
12
11
  import { useGlobalFilteredObjects } from '@dxos/plugin-search';
13
12
  import { faker } from '@dxos/random';
14
- import { Filter, useQuery, create } from '@dxos/react-client/echo';
13
+ import { Filter, useQuery, useSchema, create } from '@dxos/react-client/echo';
15
14
  import { useClientProvider, withClientProvider } from '@dxos/react-client/testing';
16
15
  import { useDefaultValue } from '@dxos/react-ui';
17
16
  import { ViewEditor } from '@dxos/react-ui-form';
@@ -41,13 +40,13 @@ const DefaultStory = () => {
41
40
 
42
41
  const tables = useQuery(space, Filter.schema(TableType));
43
42
  const [table, setTable] = useState<TableType>();
44
- const [schema, setSchema] = useState<EchoSchema>();
43
+ const schema = useSchema(space, table?.view?.target?.query.type);
44
+
45
45
  useEffect(() => {
46
46
  if (space && tables.length && !table) {
47
47
  const table = tables[0];
48
48
  invariant(table.view);
49
49
  setTable(table);
50
- setSchema(space.db.schemaRegistry.getSchema(table.view.target!.query.type));
51
50
  }
52
51
  }, [space, tables]);
53
52
 
@@ -175,7 +174,7 @@ type StoryProps = {
175
174
  rows?: number;
176
175
  } & Pick<SimulatorProps, 'insertInterval' | 'updateInterval'>;
177
176
 
178
- const TablePerformanceStory = (props: StoryProps) => {
177
+ const _TablePerformanceStory = (props: StoryProps) => {
179
178
  const getDefaultRows = useCallback(() => 10, []);
180
179
  const rows = useDefaultValue(props.rows, getDefaultRows);
181
180
  const table = useMemo(() => createTable(), []);
@@ -248,22 +247,22 @@ const meta: Meta<StoryProps> = {
248
247
 
249
248
  export default meta;
250
249
 
251
- type Story = StoryObj<StoryProps>;
252
-
253
250
  export const Default = {};
254
251
 
255
- export const Mutations: Story = {
256
- render: TablePerformanceStory,
257
- args: {
258
- rows: 1000,
259
- updateInterval: 1,
260
- },
261
- };
262
-
263
- export const RapidInsertions: Story = {
264
- render: TablePerformanceStory,
265
- args: {
266
- rows: 0,
267
- insertInterval: 100,
268
- },
269
- };
252
+ // TODO(ZaymonFC): Restore the performance stories.
253
+ // type Story = StoryObj<StoryProps>;
254
+ // export const Mutations: Story = {
255
+ // render: TablePerformanceStory,
256
+ // args: {
257
+ // rows: 1000,
258
+ // updateInterval: 1,
259
+ // },
260
+ // };
261
+
262
+ // export const RapidInsertions: Story = {
263
+ // render: TablePerformanceStory,
264
+ // args: {
265
+ // rows: 0,
266
+ // insertInterval: 100,
267
+ // },
268
+ // };
@@ -38,7 +38,7 @@ const DefaultStory = ({ editing }: StoryProps) => {
38
38
  const table = tables[0];
39
39
  invariant(table.view);
40
40
  setTable(table);
41
- setSchema(space.db.schemaRegistry.getSchema(table.view.target!.query.type));
41
+ setSchema(space.db.schemaRegistry.getSchema(table.view.target!.query.type!));
42
42
  }
43
43
  }, [space, tables]);
44
44
 
@@ -2,10 +2,13 @@
2
2
  // Copyright 2024 DXOS.org
3
3
  //
4
4
 
5
+ import { effect } from '@preact/signals-core';
5
6
  import { useEffect, useState } from 'react';
6
7
 
7
8
  import { type ReactiveObject } from '@dxos/react-client/echo';
9
+ import { useSelectionActions } from '@dxos/react-ui-attention';
8
10
  import { type ViewProjection } from '@dxos/schema';
11
+ import { isNonNullable } from '@dxos/util';
9
12
 
10
13
  import { type BaseTableRow, TableModel, type TableModelProps } from '../model';
11
14
  import { type TableType } from '../types';
@@ -48,5 +51,23 @@ export const useTableModel = <T extends BaseTableRow = { id: string }>({
48
51
  }
49
52
  }, [model, objects]);
50
53
 
54
+ const { select, clear } = useSelectionActions([table?.id, table?.view?.target?.query.type].filter(isNonNullable));
55
+
56
+ useEffect(() => {
57
+ if (!model) {
58
+ return;
59
+ }
60
+
61
+ const unsubscribe = effect(() => {
62
+ select([...model.selection.selection.value]);
63
+ });
64
+
65
+ // Maybe clear the selection here?
66
+ return () => {
67
+ clear();
68
+ unsubscribe();
69
+ };
70
+ }, [model]);
71
+
51
72
  return model;
52
73
  };
@@ -1,5 +1,5 @@
1
1
  //
2
- // Copyright 2024 DXOS.org
2
+ // Copyright 2025 DXOS.org
3
3
  //
4
4
 
5
5
  import { computed, effect, signal, type ReadonlySignal } from '@preact/signals-core';
@@ -68,7 +68,8 @@ export class TablePresentation<T extends BaseTableRow = { id: string }> {
68
68
  }
69
69
 
70
70
  switch (props.format) {
71
- case FormatEnum.Boolean: {
71
+ case FormatEnum.Boolean:
72
+ case FormatEnum.SingleSelect: {
72
73
  return '';
73
74
  }
74
75
  case FormatEnum.Ref: {
@@ -119,6 +120,17 @@ export class TablePresentation<T extends BaseTableRow = { id: string }> {
119
120
  cell.readonly = true;
120
121
  }
121
122
 
123
+ if (props.format === FormatEnum.SingleSelect) {
124
+ const value = getValue(obj, field.path);
125
+ const options = this.model.projection.getFieldProjection(field.id).props.options;
126
+ if (options) {
127
+ const option = options.find((o) => o.id === value);
128
+ if (option) {
129
+ cell.accessoryHtml = `<span class="dx-tag" data-hue="${option.color}">${option.title}</span>`;
130
+ }
131
+ }
132
+ }
133
+
122
134
  const idx = toPlaneCellIndex({ col: colIndex, row: displayIndex });
123
135
  cells[idx] = cell;
124
136
  };
@@ -188,6 +188,20 @@ export class TableSorting<T extends BaseTableRow> {
188
188
  return value;
189
189
  }
190
190
 
191
+ /**
192
+ * For single select fields, the sort value is determined by the index of the option in the
193
+ * options array. This ensures sort order matches the configured option order.
194
+ */
195
+ if (format === FormatEnum.SingleSelect) {
196
+ const options = props.options;
197
+ if (!options) {
198
+ return undefined;
199
+ }
200
+
201
+ const option = options.find((option) => option.id === value);
202
+ return option ? options.indexOf(option) : undefined;
203
+ }
204
+
191
205
  // TODO(ZaymonFC): Should we format this returned value for display based on the referenced prop format?
192
206
  // Right now we're going to be sorting based on the raw values.
193
207
  // Maybe we need to recurse this function with the referenced prop format and field?
@@ -145,7 +145,7 @@ test.describe('Table', () => {
145
145
  await page.getByRole('option', { name: 'Anita Mayer' }).click();
146
146
 
147
147
  // Assert that the value is shown in the cell.
148
- await expect(page.getByRole('gridcell', { name: 'Anita Mayer' })).toBeVisible();
148
+ await expect(page.getByRole('gridcell', { name: 'Anita Mayer' }).first()).toBeVisible();
149
149
 
150
150
  // Create new object.
151
151
  await table.grid.cell(4, 1, 'grid').click();
@@ -157,7 +157,7 @@ test.describe('Table', () => {
157
157
  await page.getByTestId('save-button').click();
158
158
 
159
159
  // Scroll to the left.
160
- await page.getByRole('gridcell', { name: 'test' }).click();
160
+ await page.getByRole('gridcell', { name: 'test' }).first().click();
161
161
 
162
162
  await page.close();
163
163
  });
@@ -173,7 +173,7 @@ test.describe('Table', () => {
173
173
  await page.getByTestId('table-switch').nth(7).click();
174
174
 
175
175
  // Test that checks are durable in the data model by sorting.
176
- await table.sortColumn(1, 'descending');
176
+ await table.sortColumn(3, 'descending');
177
177
 
178
178
  // Assert the first two switch checkboxes are checked.
179
179
  await expect(page.getByTestId('table-switch').first()).toBeChecked();
@@ -2,8 +2,8 @@
2
2
  // Copyright 2024 DXOS.org
3
3
  //
4
4
 
5
- import { Ref, ObjectId, S, TypedObject } from '@dxos/echo-schema';
6
- import { ThreadType } from '@dxos/plugin-space/types';
5
+ import { Ref, ObjectId, S, TypedObject, Expando } from '@dxos/echo-schema';
6
+ // import { ThreadType } from '@dxos/plugin-space/types';
7
7
  import { ViewType } from '@dxos/schema';
8
8
 
9
9
  export const TableSchema = S.Struct({
@@ -11,7 +11,7 @@ export const TableSchema = S.Struct({
11
11
  name: S.optional(S.String),
12
12
  view: S.optional(Ref(ViewType)),
13
13
  // TODO(burdon): Should not import from plugin. Either factor out type or use reverse deps when supported.
14
- threads: S.optional(S.Array(Ref(ThreadType))),
14
+ threads: S.optional(S.Array(Ref(Expando /* ThreadType */))), // TODO(dmaretskyi): Breaks edge because plugin-space depends on react-client.
15
15
  });
16
16
 
17
17
  // type TableType = S.Schema.Type<typeof TableSchema>;
@@ -39,7 +39,7 @@ const createButton = ({
39
39
  .join(' ');
40
40
 
41
41
  const positionClass = type === 'primary' ? 'inline-end-2' : 'inline-end-9';
42
- return `<button ${attr} data-testid="${testId}" class="ch-button is-6 pli-0.5 min-bs-0 absolute inset-block-1 ${positionClass}" ${dataAttrs} ${disabled ? 'disabled' : ''}><svg><use href="/icons.svg#${icon}"/></svg></button>`;
42
+ return `<button ${attr} data-testid="${testId}" class="dx-button is-6 pli-0.5 min-bs-0 absolute inset-block-1 ${positionClass}" ${dataAttrs} ${disabled ? 'disabled' : ''}><svg><use href="/icons.svg#${icon}"/></svg></button>`;
43
43
  };
44
44
 
45
45
  const addColumnButton = {
@@ -23,8 +23,8 @@ export const CONTROL_IDENTIFIERS = {
23
23
  } as const;
24
24
 
25
25
  const BASE_CLASSES = {
26
- checkbox: 'absolute inset-block-[.375rem] inline-end-[.375rem] ch-checkbox',
27
- switch: 'absolute inset-block-[.25rem] inline-end-[.25rem] ch-checkbox--switch',
26
+ checkbox: 'absolute inset-block-[.375rem] inline-end-[.375rem] dx-checkbox',
27
+ switch: 'absolute inset-block-[.25rem] inline-end-[.25rem] dx-checkbox--switch',
28
28
  } as const;
29
29
 
30
30
  const renderAttributes = (data: Record<string, string>) => {
package/src/util/table.ts CHANGED
@@ -46,7 +46,7 @@ export const initializeTable = async ({
46
46
  // We need to get the schema properties here. For now, only simple types and refs, not compound types
47
47
  // are going to be supported.
48
48
  const fields = getSchemaProperties(schema.ast)
49
- .filter((prop) => prop.type !== 'object' || prop.format === FormatEnum.Ref)
49
+ .filter((prop) => prop.format !== FormatEnum.Ref)
50
50
  .map((prop) => prop.name);
51
51
 
52
52
  table.view = makeRef(
@@ -82,7 +82,7 @@ export const initializeTable = async ({
82
82
  name: 'View',
83
83
  typename: contactSchema.typename,
84
84
  jsonSchema: contactSchema.jsonSchema,
85
- fields: ['name', 'active', 'email', 'salary'],
85
+ fields: ['name', 'email', 'salary', 'active'],
86
86
  }),
87
87
  );
88
88
 
@@ -94,6 +94,13 @@ export const initializeTable = async ({
94
94
  size: 150,
95
95
  },
96
96
  });
97
+ projection.setFieldProjection({
98
+ field: {
99
+ id: table.view.target!.fields.find((f) => f.path === 'active')!.id,
100
+ path: 'active' as JsonPath,
101
+ size: 100,
102
+ },
103
+ });
97
104
 
98
105
  projection.setFieldProjection({
99
106
  field: {
@@ -1,7 +0,0 @@
1
- {
2
- "version": 3,
3
- "sources": ["../../../src/types/table.ts"],
4
- "sourcesContent": ["//\n// Copyright 2024 DXOS.org\n//\n\nimport { Ref, ObjectId, S, TypedObject } from '@dxos/echo-schema';\nimport { ThreadType } from '@dxos/plugin-space/types';\nimport { ViewType } from '@dxos/schema';\n\nexport const TableSchema = S.Struct({\n id: ObjectId, // TODO(burdon): Where should this be?\n name: S.optional(S.String),\n view: S.optional(Ref(ViewType)),\n // TODO(burdon): Should not import from plugin. Either factor out type or use reverse deps when supported.\n threads: S.optional(S.Array(Ref(ThreadType))),\n});\n\n// type TableType = S.Schema.Type<typeof TableSchema>;\n\nexport class TableType extends TypedObject({\n typename: 'dxos.org/type/Table',\n version: '0.1.0',\n})(TableSchema.fields) {}\n"],
5
- "mappings": ";AAIA,SAASA,KAAKC,UAAUC,GAAGC,mBAAmB;AAC9C,SAASC,kBAAkB;AAC3B,SAASC,gBAAgB;AAElB,IAAMC,cAAcC,EAAEC,OAAO;EAClCC,IAAIC;EACJC,MAAMJ,EAAEK,SAASL,EAAEM,MAAM;EACzBC,MAAMP,EAAEK,SAASG,IAAIC,QAAAA,CAAAA;;EAErBC,SAASV,EAAEK,SAASL,EAAEW,MAAMH,IAAII,UAAAA,CAAAA,CAAAA;AAClC,CAAA;AAIO,IAAMC,YAAN,cAAwBC,YAAY;EACzCC,UAAU;EACVC,SAAS;AACX,CAAA,EAAGjB,YAAYkB,MAAM,EAAA;AAAG;",
6
- "names": ["Ref", "ObjectId", "S", "TypedObject", "ThreadType", "ViewType", "TableSchema", "S", "Struct", "id", "ObjectId", "name", "optional", "String", "view", "Ref", "ViewType", "threads", "Array", "ThreadType", "TableType", "TypedObject", "typename", "version", "fields"]
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 { Ref, ObjectId, S, TypedObject } from '@dxos/echo-schema';\nimport { ThreadType } from '@dxos/plugin-space/types';\nimport { ViewType } from '@dxos/schema';\n\nexport const TableSchema = S.Struct({\n id: ObjectId, // TODO(burdon): Where should this be?\n name: S.optional(S.String),\n view: S.optional(Ref(ViewType)),\n // TODO(burdon): Should not import from plugin. Either factor out type or use reverse deps when supported.\n threads: S.optional(S.Array(Ref(ThreadType))),\n});\n\n// type TableType = S.Schema.Type<typeof TableSchema>;\n\nexport class TableType extends TypedObject({\n typename: 'dxos.org/type/Table',\n version: '0.1.0',\n})(TableSchema.fields) {}\n"],
5
- "mappings": ";;;;;;;;;;;;;;;;;;;;;;;;AAIA,yBAA8C;AAC9C,mBAA2B;AAC3B,oBAAyB;AAElB,IAAMA,cAAcC,qBAAEC,OAAO;EAClCC,IAAIC;EACJC,MAAMJ,qBAAEK,SAASL,qBAAEM,MAAM;EACzBC,MAAMP,qBAAEK,aAASG,wBAAIC,sBAAAA,CAAAA;;EAErBC,SAASV,qBAAEK,SAASL,qBAAEW,UAAMH,wBAAII,uBAAAA,CAAAA,CAAAA;AAClC,CAAA;AAIO,IAAMC,YAAN,kBAAwBC,gCAAY;EACzCC,UAAU;EACVC,SAAS;AACX,CAAA,EAAGjB,YAAYkB,MAAM,EAAA;AAAG;",
6
- "names": ["TableSchema", "S", "Struct", "id", "ObjectId", "name", "optional", "String", "view", "Ref", "ViewType", "threads", "Array", "ThreadType", "TableType", "TypedObject", "typename", "version", "fields"]
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 { Ref, ObjectId, S, TypedObject } from '@dxos/echo-schema';\nimport { ThreadType } from '@dxos/plugin-space/types';\nimport { ViewType } from '@dxos/schema';\n\nexport const TableSchema = S.Struct({\n id: ObjectId, // TODO(burdon): Where should this be?\n name: S.optional(S.String),\n view: S.optional(Ref(ViewType)),\n // TODO(burdon): Should not import from plugin. Either factor out type or use reverse deps when supported.\n threads: S.optional(S.Array(Ref(ThreadType))),\n});\n\n// type TableType = S.Schema.Type<typeof TableSchema>;\n\nexport class TableType extends TypedObject({\n typename: 'dxos.org/type/Table',\n version: '0.1.0',\n})(TableSchema.fields) {}\n"],
5
- "mappings": ";;;AAIA,SAASA,KAAKC,UAAUC,GAAGC,mBAAmB;AAC9C,SAASC,kBAAkB;AAC3B,SAASC,gBAAgB;AAElB,IAAMC,cAAcC,EAAEC,OAAO;EAClCC,IAAIC;EACJC,MAAMJ,EAAEK,SAASL,EAAEM,MAAM;EACzBC,MAAMP,EAAEK,SAASG,IAAIC,QAAAA,CAAAA;;EAErBC,SAASV,EAAEK,SAASL,EAAEW,MAAMH,IAAII,UAAAA,CAAAA,CAAAA;AAClC,CAAA;AAIO,IAAMC,YAAN,cAAwBC,YAAY;EACzCC,UAAU;EACVC,SAAS;AACX,CAAA,EAAGjB,YAAYkB,MAAM,EAAA;AAAG;",
6
- "names": ["Ref", "ObjectId", "S", "TypedObject", "ThreadType", "ViewType", "TableSchema", "S", "Struct", "id", "ObjectId", "name", "optional", "String", "view", "Ref", "ViewType", "threads", "Array", "ThreadType", "TableType", "TypedObject", "typename", "version", "fields"]
7
- }
@@ -1,3 +0,0 @@
1
- declare const _default: import("@playwright/test").PlaywrightTestConfig<{}, {}>;
2
- export default _default;
3
- //# sourceMappingURL=playwright.config.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"playwright.config.d.ts","sourceRoot":"","sources":["../../../../src/playwright/playwright.config.ts"],"names":[],"mappings":";AASA,wBAQG"}