@dxos/react-ui-table 0.8.4-main.9735255 → 0.8.4-main.abd8ff62ef
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-FBURZBPH.mjs} +17 -23
- package/dist/lib/browser/chunk-FBURZBPH.mjs.map +7 -0
- package/dist/lib/browser/chunk-J5LGTIGS.mjs +10 -0
- package/dist/lib/browser/chunk-J5LGTIGS.mjs.map +7 -0
- package/dist/lib/browser/{chunk-I5IFW7UF.mjs → chunk-YGC7LZJN.mjs} +39 -90
- package/dist/lib/browser/chunk-YGC7LZJN.mjs.map +7 -0
- package/dist/lib/browser/index.mjs +198 -235
- package/dist/lib/browser/index.mjs.map +4 -4
- package/dist/lib/browser/meta.json +1 -1
- package/dist/lib/browser/testing/index.mjs +7 -6
- 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-WNZSKIRF.mjs → chunk-DKKMSVKP.mjs} +17 -23
- package/dist/lib/node-esm/chunk-DKKMSVKP.mjs.map +7 -0
- package/dist/lib/node-esm/{chunk-DDJKYJFY.mjs → chunk-GKIWDEZ7.mjs} +39 -90
- package/dist/lib/node-esm/chunk-GKIWDEZ7.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/index.mjs +198 -235
- 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 +7 -6
- 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.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 +82 -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 +84 -84
- package/dist/types/src/components/Table/Table.stories.d.ts.map +1 -1
- package/dist/types/src/components/Table/TableContent.d.ts +17 -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 +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/components/testing.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/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 +7 -6
- 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/playwright/playwright.config.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/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 +59 -62
- package/src/components/Table/ColumnActionsMenu.tsx +7 -6
- package/src/components/Table/ColumnSettings.tsx +3 -4
- package/src/components/Table/DynamicTable.stories.tsx +19 -18
- package/src/components/Table/DynamicTable.tsx +13 -20
- package/src/components/Table/Relations.stories.tsx +78 -34
- package/src/components/Table/RowActionsMenu.tsx +3 -2
- package/src/components/Table/Table.stories.tsx +72 -52
- package/src/components/Table/Table.tsx +41 -435
- package/src/components/Table/TableContent.tsx +421 -0
- package/src/components/{TableToolbar → Table}/TableToolbar.tsx +36 -43
- package/src/components/TableCellEditor/CellValidationMessage.tsx +4 -4
- package/src/components/TableCellEditor/FormCellEditor.tsx +14 -7
- package/src/components/TableCellEditor/TableCellEditor.stories.tsx +13 -12
- package/src/components/TableCellEditor/TableCellEditor.tsx +12 -10
- package/src/components/index.ts +0 -1
- package/src/components/testing.ts +10 -10
- package/src/hooks/useAddRow.ts +1 -1
- package/src/hooks/useProjectionModel.ts +3 -3
- package/src/hooks/useTableModel.ts +1 -1
- package/src/index.ts +0 -4
- package/src/model/table-model.test.ts +5 -6
- package/src/model/table-model.ts +18 -17
- package/src/model/table-presentation.test.ts +13 -7
- package/src/model/table-presentation.ts +12 -12
- package/src/playwright/TableManager.ts +10 -3
- package/src/playwright/playwright.config.ts +1 -1
- package/src/playwright/smoke.spec.ts +48 -5
- package/src/testing/useTestTableModel.ts +6 -6
- package/src/translations.ts +19 -21
- package/src/types/Table.ts +12 -23
- package/src/util/dynamic-table.test.ts +77 -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
|
@@ -7,8 +7,9 @@ import React from 'react';
|
|
|
7
7
|
|
|
8
8
|
import { DropdownMenu, toLocalizedString, useTranslation } from '@dxos/react-ui';
|
|
9
9
|
|
|
10
|
+
import { translationKey } from '#translations';
|
|
11
|
+
|
|
10
12
|
import { type ModalController, type TableModel } from '../../model';
|
|
11
|
-
import { translationKey } from '../../translations';
|
|
12
13
|
|
|
13
14
|
type RowActionsMenuProps = { model: TableModel; modals: ModalController };
|
|
14
15
|
|
|
@@ -47,7 +48,7 @@ export const RowActionsMenu = ({ model, modals }: RowActionsMenuProps) => {
|
|
|
47
48
|
{/* Default actions */}
|
|
48
49
|
{model.features.dataEditable !== false && (
|
|
49
50
|
<DropdownMenu.Item data-testid='row-menu-delete' onClick={() => model.deleteRow(state.rowIndex)}>
|
|
50
|
-
{t(hasSelection ? 'bulk
|
|
51
|
+
{t(hasSelection ? 'bulk-delete-row.label' : 'delete-row.label')}
|
|
51
52
|
</DropdownMenu.Item>
|
|
52
53
|
)}
|
|
53
54
|
</DropdownMenu.Viewport>
|
|
@@ -6,24 +6,26 @@ import { type Meta, type StoryObj } from '@storybook/react-vite';
|
|
|
6
6
|
import * as Schema from 'effect/Schema';
|
|
7
7
|
import React, { useCallback } from 'react';
|
|
8
8
|
|
|
9
|
-
import { Annotation, type Database, Format, Obj, type QueryAST, Type } from '@dxos/echo';
|
|
9
|
+
import { Annotation, type Database, Format, Obj, type QueryAST, Ref, Type } from '@dxos/echo';
|
|
10
|
+
import { View } from '@dxos/echo';
|
|
10
11
|
import { type Mutable, PropertyMetaAnnotationId } from '@dxos/echo/internal';
|
|
11
12
|
import { invariant } from '@dxos/invariant';
|
|
12
|
-
import {
|
|
13
|
+
import { random } from '@dxos/random';
|
|
13
14
|
import { PublicKey } from '@dxos/react-client';
|
|
14
15
|
import { withClientProvider } from '@dxos/react-client/testing';
|
|
15
|
-
import {
|
|
16
|
-
import { ViewEditor
|
|
17
|
-
import {
|
|
18
|
-
import {
|
|
16
|
+
import { Panel, ScrollArea } from '@dxos/react-ui';
|
|
17
|
+
import { ViewEditor } from '@dxos/react-ui-form';
|
|
18
|
+
import { translations as formTranslations } from '@dxos/react-ui-form/translations';
|
|
19
|
+
import { JsonHighlighter } from '@dxos/react-ui-syntax-highlighter';
|
|
20
|
+
import { withLayout, withTheme } from '@dxos/react-ui/testing';
|
|
21
|
+
import { ViewModel, getSchemaFromPropertyDefinitions, getTypenameFromQuery } from '@dxos/schema';
|
|
19
22
|
import { TestSchema, createObjectFactory } from '@dxos/schema/testing';
|
|
20
23
|
import { withRegistry } from '@dxos/storybook-utils';
|
|
21
24
|
|
|
25
|
+
import { translations } from '#translations';
|
|
26
|
+
|
|
22
27
|
import { useTestTableModel } from '../../testing';
|
|
23
|
-
import { translations } from '../../translations';
|
|
24
28
|
import { Table } from '../../types';
|
|
25
|
-
import { TableToolbar } from '../TableToolbar';
|
|
26
|
-
|
|
27
29
|
import { Table as TableComponent } from './Table';
|
|
28
30
|
|
|
29
31
|
const Example = Schema.Struct({
|
|
@@ -47,11 +49,11 @@ const Example = Schema.Struct({
|
|
|
47
49
|
}),
|
|
48
50
|
),
|
|
49
51
|
description: Schema.optional(Schema.String).annotations({ title: 'Description' }),
|
|
50
|
-
parent: Schema.optional(Schema.suspend(():
|
|
52
|
+
parent: Schema.optional(Schema.suspend((): Ref.RefSchema<Example> => Ref.Ref(Example))).annotations({
|
|
51
53
|
title: 'Parent',
|
|
52
54
|
}),
|
|
53
55
|
}).pipe(
|
|
54
|
-
Type.object({ typename: `example.
|
|
56
|
+
Type.object({ typename: `com.example.type.${PublicKey.random().truncate()}`, version: '0.1.0' }),
|
|
55
57
|
Annotation.LabelAnnotation.set(['name']),
|
|
56
58
|
);
|
|
57
59
|
interface Example extends Schema.Schema.Type<typeof Example> {}
|
|
@@ -73,8 +75,8 @@ const StoryViewEditor = ({
|
|
|
73
75
|
invariant(Type.isMutable(schema));
|
|
74
76
|
schema.updateTypename(getTypenameFromQuery(newQuery));
|
|
75
77
|
invariant(view);
|
|
76
|
-
Obj.
|
|
77
|
-
|
|
78
|
+
Obj.update(view, (view) => {
|
|
79
|
+
view.query.ast = newQuery as Mutable<typeof newQuery>;
|
|
78
80
|
});
|
|
79
81
|
},
|
|
80
82
|
[schema, view],
|
|
@@ -103,47 +105,65 @@ const DefaultStory = () => {
|
|
|
103
105
|
const { db, schema, table, tableRef, model, presentation, handleInsertRow, handleSaveView, handleDeleteColumn } =
|
|
104
106
|
useTestTableModel();
|
|
105
107
|
|
|
108
|
+
const handleRowClick = useCallback(
|
|
109
|
+
(row: any) => {
|
|
110
|
+
if (model?.getDraftRowCount() === 0 && ['frozenRowsEnd', 'fixedEndStart', 'fixedEndEnd'].includes(row?.plane)) {
|
|
111
|
+
handleInsertRow();
|
|
112
|
+
}
|
|
113
|
+
},
|
|
114
|
+
[model, handleInsertRow],
|
|
115
|
+
);
|
|
116
|
+
|
|
106
117
|
if (!schema || !table?.view.target) {
|
|
107
118
|
return <div />;
|
|
108
119
|
}
|
|
109
120
|
|
|
110
121
|
return (
|
|
111
122
|
<div className='grow grid grid-cols-[1fr_350px]'>
|
|
112
|
-
<
|
|
113
|
-
<
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
123
|
+
<TableComponent.Root ref={tableRef}>
|
|
124
|
+
<Panel.Root>
|
|
125
|
+
<Panel.Toolbar asChild>
|
|
126
|
+
<TableComponent.Toolbar
|
|
127
|
+
classNames='border-b border-subdued-separator'
|
|
128
|
+
onAdd={handleInsertRow}
|
|
129
|
+
onSave={handleSaveView}
|
|
130
|
+
/>
|
|
131
|
+
</Panel.Toolbar>
|
|
132
|
+
<Panel.Content asChild>
|
|
133
|
+
<TableComponent.Content
|
|
134
|
+
schema={schema}
|
|
135
|
+
model={model}
|
|
136
|
+
presentation={presentation}
|
|
137
|
+
onRowClick={handleRowClick}
|
|
138
|
+
ignoreAttention
|
|
139
|
+
/>
|
|
140
|
+
</Panel.Content>
|
|
141
|
+
</Panel.Root>
|
|
142
|
+
</TableComponent.Root>
|
|
143
|
+
<ScrollArea.Root orientation='vertical' classNames='border-l border-separator'>
|
|
144
|
+
<ScrollArea.Viewport>
|
|
145
|
+
<StoryViewEditor view={table.view.target} schema={schema} db={db} handleDeleteColumn={handleDeleteColumn} />
|
|
146
|
+
<JsonHighlighter data={{ view: table.view.target, schema }} classNames='text-xs' />
|
|
147
|
+
</ScrollArea.Viewport>
|
|
148
|
+
</ScrollArea.Root>
|
|
130
149
|
</div>
|
|
131
150
|
);
|
|
132
151
|
};
|
|
133
152
|
|
|
134
|
-
type
|
|
153
|
+
type DefaultStoryProps = { rows?: number };
|
|
135
154
|
|
|
136
155
|
//
|
|
137
156
|
// Story definitions.
|
|
138
157
|
//
|
|
139
158
|
|
|
140
|
-
// TODO(burdon): Need
|
|
159
|
+
// TODO(burdon): Need simpler story.
|
|
141
160
|
|
|
142
161
|
const meta = {
|
|
143
162
|
title: 'ui/react-ui-table/Table',
|
|
144
163
|
render: DefaultStory,
|
|
145
164
|
decorators: [
|
|
146
|
-
withTheme,
|
|
165
|
+
withTheme(),
|
|
166
|
+
withLayout({ layout: 'fullscreen' }),
|
|
147
167
|
withRegistry,
|
|
148
168
|
withClientProvider({
|
|
149
169
|
types: [View.View, Table.Table],
|
|
@@ -151,12 +171,12 @@ const meta = {
|
|
|
151
171
|
createSpace: true,
|
|
152
172
|
onCreateSpace: async ({ space }) => {
|
|
153
173
|
const [schema] = await space.db.schemaRegistry.register([Example]);
|
|
154
|
-
const { view, jsonSchema } = await
|
|
174
|
+
const { view, jsonSchema } = await ViewModel.makeFromDatabase({ db: space.db, typename: schema.typename });
|
|
155
175
|
const table = Table.make({ view, jsonSchema });
|
|
156
|
-
Obj.
|
|
157
|
-
|
|
158
|
-
|
|
159
|
-
...
|
|
176
|
+
Obj.update(view, (view) => {
|
|
177
|
+
view.projection.fields = [
|
|
178
|
+
view.projection.fields.find((field) => field.path === 'name')!,
|
|
179
|
+
...view.projection.fields.filter((field) => field.path !== 'name'),
|
|
160
180
|
];
|
|
161
181
|
});
|
|
162
182
|
|
|
@@ -165,9 +185,9 @@ const meta = {
|
|
|
165
185
|
Array.from({ length: 10 }).map(() => {
|
|
166
186
|
return space.db.add(
|
|
167
187
|
Obj.make(schema, {
|
|
168
|
-
name:
|
|
169
|
-
status:
|
|
170
|
-
description:
|
|
188
|
+
name: random.lorem.sentence(),
|
|
189
|
+
status: random.helpers.arrayElement(['todo', 'in-progress', 'done'] as const),
|
|
190
|
+
description: random.lorem.paragraph(),
|
|
171
191
|
}),
|
|
172
192
|
);
|
|
173
193
|
});
|
|
@@ -197,14 +217,14 @@ export const StaticSchema: StoryObj = {
|
|
|
197
217
|
createIdentity: true,
|
|
198
218
|
createSpace: true,
|
|
199
219
|
onCreateSpace: async ({ space }) => {
|
|
200
|
-
const { view, jsonSchema } = await
|
|
220
|
+
const { view, jsonSchema } = await ViewModel.makeFromDatabase({
|
|
201
221
|
db: space.db,
|
|
202
222
|
typename: TestSchema.Person.typename,
|
|
203
223
|
});
|
|
204
224
|
const table = Table.make({ view, jsonSchema });
|
|
205
225
|
space.db.add(table);
|
|
206
226
|
|
|
207
|
-
const factory = createObjectFactory(space.db,
|
|
227
|
+
const factory = createObjectFactory(space.db, random as any);
|
|
208
228
|
await factory([
|
|
209
229
|
{ type: TestSchema.Person, count: 10 },
|
|
210
230
|
// { type: TestSchema.Organization, count: 1 },
|
|
@@ -230,7 +250,7 @@ const ContactWithArrayOfEmails = Schema.Struct({
|
|
|
230
250
|
),
|
|
231
251
|
}).pipe(
|
|
232
252
|
Type.object({
|
|
233
|
-
typename: 'dxos.
|
|
253
|
+
typename: 'org.dxos.type.contactWithArrayOfEmails',
|
|
234
254
|
version: '0.1.0',
|
|
235
255
|
}),
|
|
236
256
|
);
|
|
@@ -243,14 +263,14 @@ export const ArrayOfObjects: StoryObj = {
|
|
|
243
263
|
createIdentity: true,
|
|
244
264
|
createSpace: true,
|
|
245
265
|
onCreateSpace: async ({ space }) => {
|
|
246
|
-
const { view, jsonSchema } = await
|
|
266
|
+
const { view, jsonSchema } = await ViewModel.makeFromDatabase({
|
|
247
267
|
db: space.db,
|
|
248
268
|
typename: ContactWithArrayOfEmails.typename,
|
|
249
269
|
});
|
|
250
270
|
const table = Table.make({ view, jsonSchema });
|
|
251
271
|
space.db.add(table);
|
|
252
272
|
|
|
253
|
-
const factory = createObjectFactory(space.db,
|
|
273
|
+
const factory = createObjectFactory(space.db, random as any);
|
|
254
274
|
await factory([
|
|
255
275
|
// { type: TestSchema.Person, count: 10 },
|
|
256
276
|
// { type: TestSchema.Organization, count: 1 },
|
|
@@ -265,7 +285,7 @@ export const ArrayOfObjects: StoryObj = {
|
|
|
265
285
|
},
|
|
266
286
|
};
|
|
267
287
|
|
|
268
|
-
export const Tags: Meta<
|
|
288
|
+
export const Tags: Meta<DefaultStoryProps> = {
|
|
269
289
|
title: 'ui/react-ui-table/Table',
|
|
270
290
|
render: DefaultStory,
|
|
271
291
|
decorators: [
|
|
@@ -275,7 +295,7 @@ export const Tags: Meta<StoryProps> = {
|
|
|
275
295
|
createSpace: true,
|
|
276
296
|
onCreateSpace: async ({ space }) => {
|
|
277
297
|
// Configure schema.
|
|
278
|
-
const typename = 'example.
|
|
298
|
+
const typename = 'com.example.type.single-select';
|
|
279
299
|
const selectOptions = [
|
|
280
300
|
{ id: 'one', title: 'One', color: 'emerald' },
|
|
281
301
|
{ id: 'two', title: 'Two', color: 'blue' },
|
|
@@ -301,7 +321,7 @@ export const Tags: Meta<StoryProps> = {
|
|
|
301
321
|
const [storedSchema] = await space.db.schemaRegistry.register([schema]);
|
|
302
322
|
|
|
303
323
|
// Initialize table.
|
|
304
|
-
const { view, jsonSchema } = await
|
|
324
|
+
const { view, jsonSchema } = await ViewModel.makeFromDatabase({ db: space.db, typename });
|
|
305
325
|
const table = Table.make({ view, jsonSchema });
|
|
306
326
|
space.db.add(table);
|
|
307
327
|
|
|
@@ -309,8 +329,8 @@ export const Tags: Meta<StoryProps> = {
|
|
|
309
329
|
Array.from({ length: 10 }).map(() => {
|
|
310
330
|
return space.db.add(
|
|
311
331
|
Obj.make(storedSchema, {
|
|
312
|
-
single:
|
|
313
|
-
multiple:
|
|
332
|
+
single: random.helpers.arrayElement([...selectOptionIds, undefined]),
|
|
333
|
+
multiple: random.helpers.randomSubset(selectOptionIds),
|
|
314
334
|
}),
|
|
315
335
|
);
|
|
316
336
|
});
|