@object-ui/core 17.6.0 → 18.0.0
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/CHANGELOG.md +7260 -0
- package/README.md +228 -14
- package/dist/actions/ActionEngine.d.ts +4 -2
- package/dist/actions/ActionEngine.js +13 -8
- package/dist/actions/ActionRunner.d.ts +473 -69
- package/dist/actions/ActionRunner.js +792 -125
- package/dist/actions/TransactionManager.d.ts +7 -2
- package/dist/actions/UndoManager.d.ts +8 -13
- package/dist/actions/actionKeys.d.ts +9 -7
- package/dist/actions/actionKeys.js +67 -14
- package/dist/actions/actionResponse.js +2 -2
- package/dist/actions/index.d.ts +2 -0
- package/dist/actions/index.js +2 -0
- package/dist/actions/navigationTarget.d.ts +41 -0
- package/dist/actions/navigationTarget.js +20 -0
- package/dist/actions/recordDelete.d.ts +154 -0
- package/dist/actions/recordDelete.js +110 -0
- package/dist/adapters/ApiDataSource.d.ts +8 -4
- package/dist/adapters/ApiDataSource.js +19 -7
- package/dist/adapters/ValueDataSource.d.ts +6 -1
- package/dist/adapters/ValueDataSource.js +1090 -98
- package/dist/adapters/batchTransaction.d.ts +1 -1
- package/dist/adapters/batchTransaction.js +1 -1
- package/dist/adapters/resolveDataSource.d.ts +9 -6
- package/dist/adapters/resolveDataSource.js +9 -12
- package/dist/builder/schema-builder.d.ts +38 -81
- package/dist/builder/schema-builder.js +33 -152
- package/dist/data-scope/ViewDataProvider.d.ts +8 -25
- package/dist/data-scope/ViewDataProvider.js +27 -54
- package/dist/data-scope/element-data-source.d.ts +261 -7
- package/dist/data-scope/element-data-source.js +342 -52
- package/dist/data-scope/index.d.ts +9 -4
- package/dist/data-scope/index.js +9 -4
- package/dist/evaluator/ExpressionEvaluator.d.ts +86 -0
- package/dist/evaluator/ExpressionEvaluator.js +184 -12
- package/dist/evaluator/FormulaFunctions.d.ts +0 -10
- package/dist/evaluator/FormulaFunctions.js +166 -27
- package/dist/evaluator/deadlineSettled.d.ts +40 -0
- package/dist/evaluator/deadlineSettled.js +45 -0
- package/dist/evaluator/declaredPredicate.d.ts +93 -9
- package/dist/evaluator/declaredPredicate.js +117 -16
- package/dist/evaluator/fieldRules.d.ts +88 -4
- package/dist/evaluator/fieldRules.js +208 -31
- package/dist/evaluator/index.d.ts +2 -0
- package/dist/evaluator/index.js +2 -0
- package/dist/evaluator/listConditional.d.ts +103 -34
- package/dist/evaluator/listConditional.js +127 -50
- package/dist/evaluator/optionRules.d.ts +77 -6
- package/dist/evaluator/optionRules.js +87 -10
- package/dist/evaluator/predicateInput.d.ts +15 -4
- package/dist/evaluator/predicateInput.js +35 -2
- package/dist/evaluator/rowPredicateCanon.d.ts +7 -18
- package/dist/evaluator/rowPredicateCanon.js +65 -115
- package/dist/evaluator/subjectPermissions.d.ts +105 -0
- package/dist/evaluator/subjectPermissions.js +86 -0
- package/dist/evaluator/unevaluablePredicate.d.ts +57 -0
- package/dist/evaluator/unevaluablePredicate.js +70 -0
- package/dist/index.d.ts +15 -0
- package/dist/index.js +83 -2
- package/dist/protocols/index.d.ts +0 -1
- package/dist/protocols/index.js +9 -1
- package/dist/registry/Registry.d.ts +382 -34
- package/dist/registry/Registry.js +247 -12
- package/dist/registry/WidgetRegistry.js +7 -3
- package/dist/registry/html-tier-intrinsics.d.ts +90 -0
- package/dist/registry/html-tier-intrinsics.js +110 -0
- package/dist/registry/public-blocks.d.ts +8 -0
- package/dist/registry/public-blocks.js +57 -0
- package/dist/theme/ThemeEngine.js +1 -1
- package/dist/utils/affordanceGrants.d.ts +371 -0
- package/dist/utils/affordanceGrants.js +252 -0
- package/dist/utils/chart-category-key.d.ts +82 -0
- package/dist/utils/chart-category-key.js +84 -0
- package/dist/utils/chart-measure-key.d.ts +64 -0
- package/dist/utils/chart-measure-key.js +65 -0
- package/dist/utils/chart-presentation.d.ts +95 -112
- package/dist/utils/chart-presentation.js +169 -104
- package/dist/utils/chart-series.d.ts +165 -5
- package/dist/utils/chart-series.js +123 -18
- package/dist/utils/column-sortability.d.ts +157 -0
- package/dist/utils/column-sortability.js +217 -0
- package/dist/utils/dashboard-filters.d.ts +38 -6
- package/dist/utils/dashboard-filters.js +107 -61
- package/dist/utils/dataset-format.d.ts +211 -30
- package/dist/utils/dataset-format.js +389 -46
- package/dist/utils/date-display.d.ts +346 -0
- package/dist/utils/date-display.js +644 -0
- package/dist/utils/date-macros.js +7 -0
- package/dist/utils/drill-down.d.ts +78 -0
- package/dist/utils/drill-down.js +93 -0
- package/dist/utils/emptiness.d.ts +96 -0
- package/dist/utils/emptiness.js +101 -0
- package/dist/utils/expand-fields.d.ts +81 -9
- package/dist/utils/expand-fields.js +81 -9
- package/dist/utils/extract-records.d.ts +65 -5
- package/dist/utils/extract-records.js +65 -8
- package/dist/utils/filter-converter.d.ts +158 -6
- package/dist/utils/filter-converter.js +1098 -24
- package/dist/utils/filter-tokens.d.ts +49 -5
- package/dist/utils/filter-tokens.js +105 -33
- package/dist/utils/grouping-fields.d.ts +61 -0
- package/dist/utils/grouping-fields.js +84 -0
- package/dist/utils/managedBy.d.ts +3 -3
- package/dist/utils/managedBy.js +5 -5
- package/dist/utils/native-date-value.d.ts +48 -0
- package/dist/utils/native-date-value.js +167 -0
- package/dist/utils/non-grid-row-ceiling.d.ts +143 -0
- package/dist/utils/non-grid-row-ceiling.js +141 -0
- package/dist/utils/normalize-list-view.d.ts +135 -11
- package/dist/utils/normalize-list-view.js +243 -64
- package/dist/utils/number-display.d.ts +63 -14
- package/dist/utils/number-display.js +34 -12
- package/dist/utils/object-aggregate-query.d.ts +113 -0
- package/dist/utils/object-aggregate-query.js +50 -0
- package/dist/utils/parent-scope.d.ts +123 -0
- package/dist/utils/parent-scope.js +140 -0
- package/dist/utils/predicate-fields.d.ts +45 -12
- package/dist/utils/predicate-fields.js +141 -12
- package/dist/utils/record-color.d.ts +75 -0
- package/dist/utils/record-color.js +65 -0
- package/dist/utils/record-source.d.ts +298 -0
- package/dist/utils/record-source.js +331 -0
- package/dist/utils/record-title.d.ts +148 -8
- package/dist/utils/record-title.js +220 -26
- package/dist/utils/reference-keys.d.ts +21 -22
- package/dist/utils/reference-keys.js +532 -29
- package/dist/utils/sort-query.d.ts +115 -15
- package/dist/utils/sort-query.js +240 -13
- package/dist/utils/text-comparand.d.ts +92 -0
- package/dist/utils/text-comparand.js +99 -0
- package/dist/utils/without-denied-fields.d.ts +49 -0
- package/dist/utils/without-denied-fields.js +52 -0
- package/dist/validation/index.d.ts +8 -4
- package/dist/validation/index.js +8 -4
- package/dist/validation/schema-validator.d.ts +1 -1
- package/dist/validation/schema-validator.js +225 -83
- package/dist/validation/server-owned-value.d.ts +5 -1
- package/dist/validation/server-owned-value.js +5 -1
- package/dist/validation/validators/object-validation-engine.d.ts +1 -1
- package/dist/validation/validators/object-validation-engine.js +14 -3
- package/package.json +8 -9
- package/dist/data-scope/DataScopeManager.d.ts +0 -127
- package/dist/data-scope/DataScopeManager.js +0 -229
- package/dist/protocols/ResponsiveProtocol.d.ts +0 -73
- package/dist/protocols/ResponsiveProtocol.js +0 -158
- package/dist/validation/validation-engine.d.ts +0 -88
- package/dist/validation/validation-engine.js +0 -434
|
@@ -8,7 +8,7 @@
|
|
|
8
8
|
* Client-side emulation of {@link DataSource.batchTransaction} for adapters
|
|
9
9
|
* that lack a server-side transactional batch endpoint. This is the single,
|
|
10
10
|
* tested home for the non-atomic fallback (ObjectStack objectui #2679 /
|
|
11
|
-
*
|
|
11
|
+
* objectstack-ai/objectstack#1604 / ADR-0034 item 4): components call `runBatchTransaction`
|
|
12
12
|
* unconditionally and never orchestrate cross-object writes themselves.
|
|
13
13
|
*
|
|
14
14
|
* The emulation runs operations sequentially — NOT the old `bulk('create')`
|
|
@@ -8,7 +8,7 @@
|
|
|
8
8
|
* Client-side emulation of {@link DataSource.batchTransaction} for adapters
|
|
9
9
|
* that lack a server-side transactional batch endpoint. This is the single,
|
|
10
10
|
* tested home for the non-atomic fallback (ObjectStack objectui #2679 /
|
|
11
|
-
*
|
|
11
|
+
* objectstack-ai/objectstack#1604 / ADR-0034 item 4): components call `runBatchTransaction`
|
|
12
12
|
* unconditionally and never orchestrate cross-object writes themselves.
|
|
13
13
|
*
|
|
14
14
|
* The emulation runs operations sequentially — NOT the old `bulk('create')`
|
|
@@ -9,10 +9,6 @@
|
|
|
9
9
|
*/
|
|
10
10
|
import type { DataSource, ViewData } from '@object-ui/types';
|
|
11
11
|
export interface ResolveDataSourceOptions {
|
|
12
|
-
/** Custom fetch implementation passed to ApiDataSource */
|
|
13
|
-
fetch?: (input: RequestInfo | URL, init?: RequestInit) => Promise<Response>;
|
|
14
|
-
/** Default headers for API requests */
|
|
15
|
-
defaultHeaders?: Record<string, string>;
|
|
16
12
|
/** Custom ID field for ValueDataSource */
|
|
17
13
|
idField?: string;
|
|
18
14
|
}
|
|
@@ -20,9 +16,16 @@ export interface ResolveDataSourceOptions {
|
|
|
20
16
|
* Resolve a ViewData configuration into a concrete DataSource instance.
|
|
21
17
|
*
|
|
22
18
|
* - `provider: 'object'` → returns `fallback` (the context DataSource — typically ObjectStackAdapter)
|
|
23
|
-
* - `provider: 'api'` → returns a new `ApiDataSource`
|
|
24
19
|
* - `provider: 'value'` → returns a new `ValueDataSource`
|
|
25
20
|
*
|
|
21
|
+
* There is no `provider: 'api'` arm. The view-level `api` data source is
|
|
22
|
+
* retired in `@objectstack/spec` (objectstack#23082, ADR-0049): a view binds
|
|
23
|
+
* its object or static rows, and a metadata-declared API call is the page
|
|
24
|
+
* element's `dataSource` binding. A view block that still says `api` is an
|
|
25
|
+
* unknown provider here and gets the same answer as one, so no request is
|
|
26
|
+
* ever built from its `read` / `write` (objectui#12325). Code that needs raw
|
|
27
|
+
* HTTP constructs `ApiDataSource` itself, from an `ApiDataSourceConfig`.
|
|
28
|
+
*
|
|
26
29
|
* @param viewData - The ViewData configuration from the schema
|
|
27
30
|
* @param fallback - The default DataSource from context (for `provider: 'object'`)
|
|
28
31
|
* @param options - Additional options for adapter construction
|
|
@@ -31,7 +34,7 @@ export interface ResolveDataSourceOptions {
|
|
|
31
34
|
* @example
|
|
32
35
|
* ```ts
|
|
33
36
|
* const ds = resolveDataSource(
|
|
34
|
-
* { provider: '
|
|
37
|
+
* { provider: 'value', items: [{ id: '1', name: 'Ada' }] },
|
|
35
38
|
* contextDataSource,
|
|
36
39
|
* );
|
|
37
40
|
* const result = await ds.find('users');
|
|
@@ -7,15 +7,21 @@
|
|
|
7
7
|
*
|
|
8
8
|
* Factory function to create the right DataSource from a ViewData config.
|
|
9
9
|
*/
|
|
10
|
-
import { ApiDataSource } from './ApiDataSource.js';
|
|
11
10
|
import { ValueDataSource } from './ValueDataSource.js';
|
|
12
11
|
/**
|
|
13
12
|
* Resolve a ViewData configuration into a concrete DataSource instance.
|
|
14
13
|
*
|
|
15
14
|
* - `provider: 'object'` → returns `fallback` (the context DataSource — typically ObjectStackAdapter)
|
|
16
|
-
* - `provider: 'api'` → returns a new `ApiDataSource`
|
|
17
15
|
* - `provider: 'value'` → returns a new `ValueDataSource`
|
|
18
16
|
*
|
|
17
|
+
* There is no `provider: 'api'` arm. The view-level `api` data source is
|
|
18
|
+
* retired in `@objectstack/spec` (objectstack#23082, ADR-0049): a view binds
|
|
19
|
+
* its object or static rows, and a metadata-declared API call is the page
|
|
20
|
+
* element's `dataSource` binding. A view block that still says `api` is an
|
|
21
|
+
* unknown provider here and gets the same answer as one, so no request is
|
|
22
|
+
* ever built from its `read` / `write` (objectui#12325). Code that needs raw
|
|
23
|
+
* HTTP constructs `ApiDataSource` itself, from an `ApiDataSourceConfig`.
|
|
24
|
+
*
|
|
19
25
|
* @param viewData - The ViewData configuration from the schema
|
|
20
26
|
* @param fallback - The default DataSource from context (for `provider: 'object'`)
|
|
21
27
|
* @param options - Additional options for adapter construction
|
|
@@ -24,7 +30,7 @@ import { ValueDataSource } from './ValueDataSource.js';
|
|
|
24
30
|
* @example
|
|
25
31
|
* ```ts
|
|
26
32
|
* const ds = resolveDataSource(
|
|
27
|
-
* { provider: '
|
|
33
|
+
* { provider: 'value', items: [{ id: '1', name: 'Ada' }] },
|
|
28
34
|
* contextDataSource,
|
|
29
35
|
* );
|
|
30
36
|
* const result = await ds.find('users');
|
|
@@ -38,15 +44,6 @@ export function resolveDataSource(viewData, fallback, options) {
|
|
|
38
44
|
case 'object':
|
|
39
45
|
// Delegate to the context DataSource (ObjectStackAdapter, etc.)
|
|
40
46
|
return fallback ?? null;
|
|
41
|
-
case 'api': {
|
|
42
|
-
const config = {
|
|
43
|
-
read: viewData.read,
|
|
44
|
-
write: viewData.write,
|
|
45
|
-
fetch: options?.fetch,
|
|
46
|
-
defaultHeaders: options?.defaultHeaders,
|
|
47
|
-
};
|
|
48
|
-
return new ApiDataSource(config);
|
|
49
|
-
}
|
|
50
47
|
case 'value':
|
|
51
48
|
return new ValueDataSource({
|
|
52
49
|
items: (viewData.items ?? []),
|
|
@@ -14,7 +14,7 @@
|
|
|
14
14
|
* @module builder
|
|
15
15
|
* @packageDocumentation
|
|
16
16
|
*/
|
|
17
|
-
import type { BaseSchema, FormSchema, FormField,
|
|
17
|
+
import type { BaseSchema, DeclaredNode, FormSchema, FormField, ButtonSchema, InputSchema, CardSchema, GridSchema, FlexLayoutProps } from '@object-ui/types';
|
|
18
18
|
/**
|
|
19
19
|
* Base builder class
|
|
20
20
|
*/
|
|
@@ -84,68 +84,6 @@ export declare class FormBuilder extends SchemaBuilder<FormSchema> {
|
|
|
84
84
|
*/
|
|
85
85
|
onSubmit(handler: (data: Record<string, any>) => void | Promise<void>): this;
|
|
86
86
|
}
|
|
87
|
-
/**
|
|
88
|
-
* CRUD builder
|
|
89
|
-
*/
|
|
90
|
-
export declare class CRUDBuilder extends SchemaBuilder<CRUDSchema> {
|
|
91
|
-
constructor();
|
|
92
|
-
/**
|
|
93
|
-
* Set resource name
|
|
94
|
-
*/
|
|
95
|
-
resource(resource: string): this;
|
|
96
|
-
/**
|
|
97
|
-
* Set API endpoint
|
|
98
|
-
*/
|
|
99
|
-
api(api: string): this;
|
|
100
|
-
/**
|
|
101
|
-
* Set title
|
|
102
|
-
*/
|
|
103
|
-
title(title: string): this;
|
|
104
|
-
/**
|
|
105
|
-
* Set description
|
|
106
|
-
*/
|
|
107
|
-
description(description: string): this;
|
|
108
|
-
/**
|
|
109
|
-
* Add a column
|
|
110
|
-
*/
|
|
111
|
-
column(column: TableColumn): this;
|
|
112
|
-
/**
|
|
113
|
-
* Set all columns
|
|
114
|
-
*/
|
|
115
|
-
columns(columns: TableColumn[]): this;
|
|
116
|
-
/**
|
|
117
|
-
* Set form fields
|
|
118
|
-
*/
|
|
119
|
-
fields(fields: FormField[]): this;
|
|
120
|
-
/**
|
|
121
|
-
* Enable create operation
|
|
122
|
-
*/
|
|
123
|
-
enableCreate(label?: string): this;
|
|
124
|
-
/**
|
|
125
|
-
* Enable update operation
|
|
126
|
-
*/
|
|
127
|
-
enableUpdate(label?: string): this;
|
|
128
|
-
/**
|
|
129
|
-
* Enable delete operation
|
|
130
|
-
*/
|
|
131
|
-
enableDelete(label?: string, confirmText?: string): this;
|
|
132
|
-
/**
|
|
133
|
-
* Set pagination
|
|
134
|
-
*/
|
|
135
|
-
pagination(pageSize?: number): this;
|
|
136
|
-
/**
|
|
137
|
-
* Enable row selection
|
|
138
|
-
*/
|
|
139
|
-
selectable(mode?: 'single' | 'multiple'): this;
|
|
140
|
-
/**
|
|
141
|
-
* Add a batch action
|
|
142
|
-
*/
|
|
143
|
-
batchAction(action: ActionSchema): this;
|
|
144
|
-
/**
|
|
145
|
-
* Add a row action
|
|
146
|
-
*/
|
|
147
|
-
rowAction(action: ActionSchema): this;
|
|
148
|
-
}
|
|
149
87
|
/**
|
|
150
88
|
* Button builder
|
|
151
89
|
*/
|
|
@@ -220,9 +158,10 @@ export declare class CardBuilder extends SchemaBuilder<CardSchema> {
|
|
|
220
158
|
*/
|
|
221
159
|
description(description: string): this;
|
|
222
160
|
/**
|
|
223
|
-
* Set card content
|
|
161
|
+
* Set card content: a node of a declared type, or a list of them
|
|
162
|
+
* (objectui#11466). Each node is checked against its own type's keys.
|
|
224
163
|
*/
|
|
225
|
-
content(content:
|
|
164
|
+
content(content: DeclaredNode | DeclaredNode[]): this;
|
|
226
165
|
/**
|
|
227
166
|
* Set card variant
|
|
228
167
|
*/
|
|
@@ -238,26 +177,43 @@ export declare class CardBuilder extends SchemaBuilder<CardSchema> {
|
|
|
238
177
|
export declare class GridBuilder extends SchemaBuilder<GridSchema> {
|
|
239
178
|
constructor();
|
|
240
179
|
/**
|
|
241
|
-
* Set number of columns
|
|
180
|
+
* Set number of columns — one of the counts the `grid` renderer maps
|
|
181
|
+
* (objectui#11491); the parameter is the declaration's own bare-count arm,
|
|
182
|
+
* so `tsc` refuses any other number.
|
|
242
183
|
*/
|
|
243
|
-
columns(columns: number): this;
|
|
184
|
+
columns(columns: Extract<NonNullable<GridSchema['columns']>, number>): this;
|
|
244
185
|
/**
|
|
245
|
-
* Set gap
|
|
186
|
+
* Set gap — one of the steps the `grid` renderer maps (objectui#11474); the
|
|
187
|
+
* parameter is the declaration's own set, so `tsc` refuses any other number.
|
|
246
188
|
*/
|
|
247
|
-
gap(gap:
|
|
189
|
+
gap(gap: NonNullable<GridSchema['gap']>): this;
|
|
248
190
|
/**
|
|
249
|
-
* Add a child
|
|
191
|
+
* Add a child: a node of a declared type (`DeclaredNode`, objectui#11466),
|
|
192
|
+
* checked against its own type's keys like a child written inline.
|
|
250
193
|
*/
|
|
251
|
-
child(child:
|
|
194
|
+
child(child: DeclaredNode): this;
|
|
252
195
|
/**
|
|
253
|
-
* Set all children
|
|
196
|
+
* Set all children: nodes of declared types (objectui#11466).
|
|
254
197
|
*/
|
|
255
|
-
children(children:
|
|
198
|
+
children(children: DeclaredNode[]): this;
|
|
256
199
|
}
|
|
257
200
|
/**
|
|
258
201
|
* Flex builder
|
|
202
|
+
*
|
|
203
|
+
* Builds an AUTHORED `flex` node: its props in the `properties` bag
|
|
204
|
+
* (objectui#11276, the maintainer's ruling A on objectui#11300) —
|
|
205
|
+
* `{ type: 'flex', properties: { direction, justify, align, gap, children } }`,
|
|
206
|
+
* the spelling `@objectstack/spec`'s page component declares and
|
|
207
|
+
* `@object-ui/types`' authoring faces accept. A `flex` prop written flat on the
|
|
208
|
+
* node is refused there by name, so the builder never writes one. The base
|
|
209
|
+
* setters (`id`, `className`, `visible`, …) stay on the node. The bag's members
|
|
210
|
+
* are `FlexLayoutProps`; `SchemaRenderer` hoists them onto the node before the
|
|
211
|
+
* `flex` renderer reads them.
|
|
259
212
|
*/
|
|
260
|
-
export declare class FlexBuilder extends SchemaBuilder<
|
|
213
|
+
export declare class FlexBuilder extends SchemaBuilder<BaseSchema & {
|
|
214
|
+
type: 'flex';
|
|
215
|
+
properties: FlexLayoutProps;
|
|
216
|
+
}> {
|
|
261
217
|
constructor();
|
|
262
218
|
/**
|
|
263
219
|
* Set flex direction
|
|
@@ -272,20 +228,21 @@ export declare class FlexBuilder extends SchemaBuilder<FlexSchema> {
|
|
|
272
228
|
*/
|
|
273
229
|
align(align: 'start' | 'end' | 'center' | 'baseline' | 'stretch'): this;
|
|
274
230
|
/**
|
|
275
|
-
* Set gap
|
|
231
|
+
* Set gap — one of the steps the `flex` renderer maps (objectui#11474); the
|
|
232
|
+
* parameter is the declaration's own set, so `tsc` refuses any other number.
|
|
276
233
|
*/
|
|
277
|
-
gap(gap:
|
|
234
|
+
gap(gap: NonNullable<FlexLayoutProps['gap']>): this;
|
|
278
235
|
/**
|
|
279
|
-
* Add a child
|
|
236
|
+
* Add a child: a node of a declared type (`DeclaredNode`, objectui#11466),
|
|
237
|
+
* checked against its own type's keys like a child written inline.
|
|
280
238
|
*/
|
|
281
|
-
child(child:
|
|
239
|
+
child(child: DeclaredNode): this;
|
|
282
240
|
/**
|
|
283
|
-
* Set all children
|
|
241
|
+
* Set all children: nodes of declared types (objectui#11466).
|
|
284
242
|
*/
|
|
285
|
-
children(children:
|
|
243
|
+
children(children: DeclaredNode[]): this;
|
|
286
244
|
}
|
|
287
245
|
export declare const form: () => FormBuilder;
|
|
288
|
-
export declare const crud: () => CRUDBuilder;
|
|
289
246
|
export declare const button: () => ButtonBuilder;
|
|
290
247
|
export declare const input: () => InputBuilder;
|
|
291
248
|
export declare const card: () => CardBuilder;
|
|
@@ -125,141 +125,6 @@ export class FormBuilder extends SchemaBuilder {
|
|
|
125
125
|
return this;
|
|
126
126
|
}
|
|
127
127
|
}
|
|
128
|
-
/**
|
|
129
|
-
* CRUD builder
|
|
130
|
-
*/
|
|
131
|
-
export class CRUDBuilder extends SchemaBuilder {
|
|
132
|
-
constructor() {
|
|
133
|
-
super('crud');
|
|
134
|
-
this.schema.columns = [];
|
|
135
|
-
}
|
|
136
|
-
/**
|
|
137
|
-
* Set resource name
|
|
138
|
-
*/
|
|
139
|
-
resource(resource) {
|
|
140
|
-
this.schema.resource = resource;
|
|
141
|
-
return this;
|
|
142
|
-
}
|
|
143
|
-
/**
|
|
144
|
-
* Set API endpoint
|
|
145
|
-
*/
|
|
146
|
-
api(api) {
|
|
147
|
-
this.schema.api = api;
|
|
148
|
-
return this;
|
|
149
|
-
}
|
|
150
|
-
/**
|
|
151
|
-
* Set title
|
|
152
|
-
*/
|
|
153
|
-
title(title) {
|
|
154
|
-
this.schema.title = title;
|
|
155
|
-
return this;
|
|
156
|
-
}
|
|
157
|
-
/**
|
|
158
|
-
* Set description
|
|
159
|
-
*/
|
|
160
|
-
description(description) {
|
|
161
|
-
this.schema.description = description;
|
|
162
|
-
return this;
|
|
163
|
-
}
|
|
164
|
-
/**
|
|
165
|
-
* Add a column
|
|
166
|
-
*/
|
|
167
|
-
column(column) {
|
|
168
|
-
this.schema.columns = [...(this.schema.columns || []), column];
|
|
169
|
-
return this;
|
|
170
|
-
}
|
|
171
|
-
/**
|
|
172
|
-
* Set all columns
|
|
173
|
-
*/
|
|
174
|
-
columns(columns) {
|
|
175
|
-
this.schema.columns = columns;
|
|
176
|
-
return this;
|
|
177
|
-
}
|
|
178
|
-
/**
|
|
179
|
-
* Set form fields
|
|
180
|
-
*/
|
|
181
|
-
fields(fields) {
|
|
182
|
-
this.schema.fields = fields;
|
|
183
|
-
return this;
|
|
184
|
-
}
|
|
185
|
-
/**
|
|
186
|
-
* Enable create operation
|
|
187
|
-
*/
|
|
188
|
-
enableCreate(label) {
|
|
189
|
-
if (!this.schema.operations)
|
|
190
|
-
this.schema.operations = {};
|
|
191
|
-
this.schema.operations.create = {
|
|
192
|
-
enabled: true,
|
|
193
|
-
label: label || 'Create',
|
|
194
|
-
api: this.schema.api,
|
|
195
|
-
method: 'POST'
|
|
196
|
-
};
|
|
197
|
-
return this;
|
|
198
|
-
}
|
|
199
|
-
/**
|
|
200
|
-
* Enable update operation
|
|
201
|
-
*/
|
|
202
|
-
enableUpdate(label) {
|
|
203
|
-
if (!this.schema.operations)
|
|
204
|
-
this.schema.operations = {};
|
|
205
|
-
this.schema.operations.update = {
|
|
206
|
-
enabled: true,
|
|
207
|
-
label: label || 'Update',
|
|
208
|
-
api: `${this.schema.api}/\${id}`,
|
|
209
|
-
method: 'PUT'
|
|
210
|
-
};
|
|
211
|
-
return this;
|
|
212
|
-
}
|
|
213
|
-
/**
|
|
214
|
-
* Enable delete operation
|
|
215
|
-
*/
|
|
216
|
-
enableDelete(label, confirmText) {
|
|
217
|
-
if (!this.schema.operations)
|
|
218
|
-
this.schema.operations = {};
|
|
219
|
-
this.schema.operations.delete = {
|
|
220
|
-
enabled: true,
|
|
221
|
-
label: label || 'Delete',
|
|
222
|
-
api: `${this.schema.api}/\${id}`,
|
|
223
|
-
method: 'DELETE',
|
|
224
|
-
confirmText: confirmText || 'Are you sure?'
|
|
225
|
-
};
|
|
226
|
-
return this;
|
|
227
|
-
}
|
|
228
|
-
/**
|
|
229
|
-
* Set pagination
|
|
230
|
-
*/
|
|
231
|
-
pagination(pageSize = 20) {
|
|
232
|
-
this.schema.pagination = {
|
|
233
|
-
enabled: true,
|
|
234
|
-
pageSize,
|
|
235
|
-
pageSizeOptions: [10, 20, 50, 100],
|
|
236
|
-
showTotal: true,
|
|
237
|
-
showSizeChanger: true
|
|
238
|
-
};
|
|
239
|
-
return this;
|
|
240
|
-
}
|
|
241
|
-
/**
|
|
242
|
-
* Enable row selection
|
|
243
|
-
*/
|
|
244
|
-
selectable(mode = 'multiple') {
|
|
245
|
-
this.schema.selectable = mode;
|
|
246
|
-
return this;
|
|
247
|
-
}
|
|
248
|
-
/**
|
|
249
|
-
* Add a batch action
|
|
250
|
-
*/
|
|
251
|
-
batchAction(action) {
|
|
252
|
-
this.schema.batchActions = [...(this.schema.batchActions || []), action];
|
|
253
|
-
return this;
|
|
254
|
-
}
|
|
255
|
-
/**
|
|
256
|
-
* Add a row action
|
|
257
|
-
*/
|
|
258
|
-
rowAction(action) {
|
|
259
|
-
this.schema.rowActions = [...(this.schema.rowActions || []), action];
|
|
260
|
-
return this;
|
|
261
|
-
}
|
|
262
|
-
}
|
|
263
128
|
/**
|
|
264
129
|
* Button builder
|
|
265
130
|
*/
|
|
@@ -382,7 +247,8 @@ export class CardBuilder extends SchemaBuilder {
|
|
|
382
247
|
return this;
|
|
383
248
|
}
|
|
384
249
|
/**
|
|
385
|
-
* Set card content
|
|
250
|
+
* Set card content: a node of a declared type, or a list of them
|
|
251
|
+
* (objectui#11466). Each node is checked against its own type's keys.
|
|
386
252
|
*/
|
|
387
253
|
content(content) {
|
|
388
254
|
this.schema.content = content;
|
|
@@ -412,21 +278,25 @@ export class GridBuilder extends SchemaBuilder {
|
|
|
412
278
|
this.schema.children = [];
|
|
413
279
|
}
|
|
414
280
|
/**
|
|
415
|
-
* Set number of columns
|
|
281
|
+
* Set number of columns — one of the counts the `grid` renderer maps
|
|
282
|
+
* (objectui#11491); the parameter is the declaration's own bare-count arm,
|
|
283
|
+
* so `tsc` refuses any other number.
|
|
416
284
|
*/
|
|
417
285
|
columns(columns) {
|
|
418
286
|
this.schema.columns = columns;
|
|
419
287
|
return this;
|
|
420
288
|
}
|
|
421
289
|
/**
|
|
422
|
-
* Set gap
|
|
290
|
+
* Set gap — one of the steps the `grid` renderer maps (objectui#11474); the
|
|
291
|
+
* parameter is the declaration's own set, so `tsc` refuses any other number.
|
|
423
292
|
*/
|
|
424
293
|
gap(gap) {
|
|
425
294
|
this.schema.gap = gap;
|
|
426
295
|
return this;
|
|
427
296
|
}
|
|
428
297
|
/**
|
|
429
|
-
* Add a child
|
|
298
|
+
* Add a child: a node of a declared type (`DeclaredNode`, objectui#11466),
|
|
299
|
+
* checked against its own type's keys like a child written inline.
|
|
430
300
|
*/
|
|
431
301
|
child(child) {
|
|
432
302
|
const children = Array.isArray(this.schema.children) ? this.schema.children : [];
|
|
@@ -434,7 +304,7 @@ export class GridBuilder extends SchemaBuilder {
|
|
|
434
304
|
return this;
|
|
435
305
|
}
|
|
436
306
|
/**
|
|
437
|
-
* Set all children
|
|
307
|
+
* Set all children: nodes of declared types (objectui#11466).
|
|
438
308
|
*/
|
|
439
309
|
children(children) {
|
|
440
310
|
this.schema.children = children;
|
|
@@ -443,59 +313,70 @@ export class GridBuilder extends SchemaBuilder {
|
|
|
443
313
|
}
|
|
444
314
|
/**
|
|
445
315
|
* Flex builder
|
|
316
|
+
*
|
|
317
|
+
* Builds an AUTHORED `flex` node: its props in the `properties` bag
|
|
318
|
+
* (objectui#11276, the maintainer's ruling A on objectui#11300) —
|
|
319
|
+
* `{ type: 'flex', properties: { direction, justify, align, gap, children } }`,
|
|
320
|
+
* the spelling `@objectstack/spec`'s page component declares and
|
|
321
|
+
* `@object-ui/types`' authoring faces accept. A `flex` prop written flat on the
|
|
322
|
+
* node is refused there by name, so the builder never writes one. The base
|
|
323
|
+
* setters (`id`, `className`, `visible`, …) stay on the node. The bag's members
|
|
324
|
+
* are `FlexLayoutProps`; `SchemaRenderer` hoists them onto the node before the
|
|
325
|
+
* `flex` renderer reads them.
|
|
446
326
|
*/
|
|
447
327
|
export class FlexBuilder extends SchemaBuilder {
|
|
448
328
|
constructor() {
|
|
449
329
|
super('flex');
|
|
450
|
-
this.schema.
|
|
330
|
+
this.schema.properties = { children: [] };
|
|
451
331
|
}
|
|
452
332
|
/**
|
|
453
333
|
* Set flex direction
|
|
454
334
|
*/
|
|
455
335
|
direction(direction) {
|
|
456
|
-
this.schema.direction = direction;
|
|
336
|
+
this.schema.properties.direction = direction;
|
|
457
337
|
return this;
|
|
458
338
|
}
|
|
459
339
|
/**
|
|
460
340
|
* Set justify content
|
|
461
341
|
*/
|
|
462
342
|
justify(justify) {
|
|
463
|
-
this.schema.justify = justify;
|
|
343
|
+
this.schema.properties.justify = justify;
|
|
464
344
|
return this;
|
|
465
345
|
}
|
|
466
346
|
/**
|
|
467
347
|
* Set align items
|
|
468
348
|
*/
|
|
469
349
|
align(align) {
|
|
470
|
-
this.schema.align = align;
|
|
350
|
+
this.schema.properties.align = align;
|
|
471
351
|
return this;
|
|
472
352
|
}
|
|
473
353
|
/**
|
|
474
|
-
* Set gap
|
|
354
|
+
* Set gap — one of the steps the `flex` renderer maps (objectui#11474); the
|
|
355
|
+
* parameter is the declaration's own set, so `tsc` refuses any other number.
|
|
475
356
|
*/
|
|
476
357
|
gap(gap) {
|
|
477
|
-
this.schema.gap = gap;
|
|
358
|
+
this.schema.properties.gap = gap;
|
|
478
359
|
return this;
|
|
479
360
|
}
|
|
480
361
|
/**
|
|
481
|
-
* Add a child
|
|
362
|
+
* Add a child: a node of a declared type (`DeclaredNode`, objectui#11466),
|
|
363
|
+
* checked against its own type's keys like a child written inline.
|
|
482
364
|
*/
|
|
483
365
|
child(child) {
|
|
484
|
-
const children = Array.isArray(this.schema.children) ? this.schema.children : [];
|
|
485
|
-
this.schema.children = [...children, child];
|
|
366
|
+
const children = Array.isArray(this.schema.properties.children) ? this.schema.properties.children : [];
|
|
367
|
+
this.schema.properties.children = [...children, child];
|
|
486
368
|
return this;
|
|
487
369
|
}
|
|
488
370
|
/**
|
|
489
|
-
* Set all children
|
|
371
|
+
* Set all children: nodes of declared types (objectui#11466).
|
|
490
372
|
*/
|
|
491
373
|
children(children) {
|
|
492
|
-
this.schema.children = children;
|
|
374
|
+
this.schema.properties.children = children;
|
|
493
375
|
return this;
|
|
494
376
|
}
|
|
495
377
|
}
|
|
496
378
|
// Export factory functions
|
|
497
379
|
export const form = () => new FormBuilder();
|
|
498
|
-
export const crud = () => new CRUDBuilder();
|
|
499
380
|
export const button = () => new ButtonBuilder();
|
|
500
381
|
export const input = () => new InputBuilder();
|
|
501
382
|
export const card = () => new CardBuilder();
|
|
@@ -9,11 +9,14 @@
|
|
|
9
9
|
* @object-ui/core - View Data Provider
|
|
10
10
|
*
|
|
11
11
|
* Resolves @objectstack/spec ViewData discriminated union into
|
|
12
|
-
* a unified data access interface. Supports
|
|
12
|
+
* a unified data access interface. Supports two data modes:
|
|
13
13
|
*
|
|
14
14
|
* 1. 'object' — Metadata-driven via ObjectStack API (object name → fields/records)
|
|
15
|
-
* 2. '
|
|
16
|
-
*
|
|
15
|
+
* 2. 'value' — Static data (pre-loaded items array)
|
|
16
|
+
*
|
|
17
|
+
* The view-level `'api'` mode is retired in `@objectstack/spec`
|
|
18
|
+
* (objectstack#23082, ADR-0049) and has no arm here (objectui#12325): a
|
|
19
|
+
* config that still names it resolves as an unknown provider, with an error.
|
|
17
20
|
*
|
|
18
21
|
* @module data-scope
|
|
19
22
|
* @packageDocumentation
|
|
@@ -23,18 +26,6 @@ import { type ElementDataSourceConfig, type ElementSavedView } from './element-d
|
|
|
23
26
|
export type ViewDataConfig = {
|
|
24
27
|
provider: 'object';
|
|
25
28
|
object: string;
|
|
26
|
-
} | {
|
|
27
|
-
provider: 'api';
|
|
28
|
-
read: {
|
|
29
|
-
url: string;
|
|
30
|
-
method?: string;
|
|
31
|
-
headers?: Record<string, string>;
|
|
32
|
-
};
|
|
33
|
-
write?: {
|
|
34
|
-
url: string;
|
|
35
|
-
method?: string;
|
|
36
|
-
headers?: Record<string, string>;
|
|
37
|
-
};
|
|
38
29
|
} | {
|
|
39
30
|
provider: 'value';
|
|
40
31
|
items: any[];
|
|
@@ -72,19 +63,13 @@ export interface DataFetcher {
|
|
|
72
63
|
required?: boolean;
|
|
73
64
|
}>;
|
|
74
65
|
}>;
|
|
75
|
-
/** Fetch from a custom API URL */
|
|
76
|
-
fetchUrl?(url: string, options?: {
|
|
77
|
-
method?: string;
|
|
78
|
-
headers?: Record<string, string>;
|
|
79
|
-
body?: any;
|
|
80
|
-
}): Promise<any>;
|
|
81
66
|
/**
|
|
82
67
|
* Fetch the object's saved views, so an `ElementDataSource.view` name can be
|
|
83
68
|
* resolved to real columns / filter / sort (objectstack#5576).
|
|
84
69
|
*
|
|
85
70
|
* Optional because most fetchers only read records. A fetcher WITHOUT it
|
|
86
71
|
* cannot honour a named view, and {@link ViewDataProvider.resolveElementDataSource}
|
|
87
|
-
* says so in `error` rather than dropping the key — the whole point of #5576
|
|
72
|
+
* says so in `error` rather than dropping the key — the whole point of objectstack-ai/objectstack#5576
|
|
88
73
|
* is that a `view` the runtime cannot apply must never look applied.
|
|
89
74
|
*
|
|
90
75
|
* Either shape stored views come in is accepted: a map keyed by view id, or
|
|
@@ -110,7 +95,7 @@ export interface ResolvedData {
|
|
|
110
95
|
}>;
|
|
111
96
|
};
|
|
112
97
|
/** Provider type */
|
|
113
|
-
provider: 'object' | '
|
|
98
|
+
provider: 'object' | 'value';
|
|
114
99
|
/** Loading state */
|
|
115
100
|
loading: boolean;
|
|
116
101
|
/** Error */
|
|
@@ -143,8 +128,6 @@ export declare class ViewDataProvider {
|
|
|
143
128
|
}): Promise<ResolvedData>;
|
|
144
129
|
/** Resolve static value data */
|
|
145
130
|
private resolveValue;
|
|
146
|
-
/** Resolve API-based data */
|
|
147
|
-
private resolveApi;
|
|
148
131
|
/** Resolve object-based data (metadata-driven) */
|
|
149
132
|
private resolveObject;
|
|
150
133
|
/**
|