@object-ui/plugin-form 17.7.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 +804 -0
- package/README.md +148 -38
- package/dist/DrawerForm.d.ts +13 -2
- package/dist/DrawerForm.d.ts.map +1 -1
- package/dist/LineItemsPanel.d.ts.map +1 -1
- package/dist/MasterDetailForm.d.ts +49 -29
- package/dist/MasterDetailForm.d.ts.map +1 -1
- package/dist/ModalForm.d.ts +13 -2
- package/dist/ModalForm.d.ts.map +1 -1
- package/dist/ObjectForm.d.ts.map +1 -1
- package/dist/SplitForm.d.ts +13 -2
- package/dist/SplitForm.d.ts.map +1 -1
- package/dist/TabbedForm.d.ts +11 -3
- package/dist/TabbedForm.d.ts.map +1 -1
- package/dist/WizardForm.d.ts +5 -3
- package/dist/WizardForm.d.ts.map +1 -1
- package/dist/autoLayout.d.ts +101 -5
- package/dist/autoLayout.d.ts.map +1 -1
- package/dist/deriveMasterDetail.d.ts +53 -24
- package/dist/deriveMasterDetail.d.ts.map +1 -1
- package/dist/fieldGroups.d.ts +14 -1
- package/dist/fieldGroups.d.ts.map +1 -1
- package/dist/fieldWriteGate.d.ts +31 -11
- package/dist/fieldWriteGate.d.ts.map +1 -1
- package/dist/index.d.ts +32 -7
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +2206 -1896
- package/dist/index.umd.cjs +1 -1
- package/dist/initialFieldFocus.d.ts +23 -0
- package/dist/initialFieldFocus.d.ts.map +1 -0
- package/dist/sanitize.d.ts +88 -3
- package/dist/sanitize.d.ts.map +1 -1
- package/dist/schemaDefaults.d.ts +80 -6
- package/dist/schemaDefaults.d.ts.map +1 -1
- package/dist/sectionFields.d.ts +17 -6
- package/dist/sectionFields.d.ts.map +1 -1
- package/dist/submitTarget.d.ts +17 -0
- package/dist/submitTarget.d.ts.map +1 -1
- package/dist/writePayload.d.ts +24 -5
- package/dist/writePayload.d.ts.map +1 -1
- package/package.json +10 -10
package/README.md
CHANGED
|
@@ -66,7 +66,9 @@ The package entry exports these — components, their prop/schema types, the
|
|
|
66
66
|
layout helpers, the two create-payload rules a second form renderer needs
|
|
67
67
|
(see [`required` + a runtime default](#required-or-requiredwhen--a-runtime-default))
|
|
68
68
|
and the section-group resolver a third one needs
|
|
69
|
-
(see [Resolving `sections[].group` outside this package](#resolving-sectionsgroup-outside-this-package))
|
|
69
|
+
(see [Resolving `sections[].group` outside this package](#resolving-sectionsgroup-outside-this-package)),
|
|
70
|
+
with `sectionEntryName` to read the entries it returns
|
|
71
|
+
(see [What a section's `fields` entries draw](#what-a-sections-fields-entries-draw)).
|
|
70
72
|
There is no aggregate map among them:
|
|
71
73
|
|
|
72
74
|
```typescript
|
|
@@ -99,7 +101,9 @@ import {
|
|
|
99
101
|
resolveInlineMode,
|
|
100
102
|
omitServerResolvedDefaults,
|
|
101
103
|
isRequiredInForm,
|
|
104
|
+
optionListDefault,
|
|
102
105
|
resolveSectionGroupReferences,
|
|
106
|
+
sectionEntryName,
|
|
103
107
|
} from '@object-ui/plugin-form';
|
|
104
108
|
|
|
105
109
|
import type {
|
|
@@ -134,6 +138,29 @@ import type {
|
|
|
134
138
|
} from '@object-ui/plugin-form';
|
|
135
139
|
```
|
|
136
140
|
|
|
141
|
+
### Deriving a master-detail grid outside the form
|
|
142
|
+
|
|
143
|
+
`deriveDetail` and `deriveColumns` build a child collection's grid columns from
|
|
144
|
+
the child object's schema. A `boolean` or `toggle` child field becomes a select
|
|
145
|
+
column whose two options store `'true'` and `'false'`; their labels are the
|
|
146
|
+
session's word for each value, so both functions require a `booleanLabel`. Pass
|
|
147
|
+
the one `@object-ui/fields` publishes for this, called in your component:
|
|
148
|
+
|
|
149
|
+
```tsx
|
|
150
|
+
import { useBooleanValueLabel } from '@object-ui/fields';
|
|
151
|
+
import { deriveDetail, type ChildObjectSchemaLike } from '@object-ui/plugin-form';
|
|
152
|
+
|
|
153
|
+
declare const childSchema: ChildObjectSchemaLike; // as your DataSource's getObjectSchema serves it
|
|
154
|
+
|
|
155
|
+
export function useInvoiceLines() {
|
|
156
|
+
const booleanLabel = useBooleanValueLabel(); // common.yes / common.no
|
|
157
|
+
return deriveDetail('invoice_line', childSchema, 'invoice', { booleanLabel });
|
|
158
|
+
}
|
|
159
|
+
```
|
|
160
|
+
|
|
161
|
+
There is no default: an English one would label the options in English for a
|
|
162
|
+
session in any other language.
|
|
163
|
+
|
|
137
164
|
### Registering a component under your own key
|
|
138
165
|
|
|
139
166
|
To put one of these components on a schema type of your own, register the
|
|
@@ -197,16 +224,17 @@ unknown-component placeholder.
|
|
|
197
224
|
| `onSubmit` / `onChange` / `onDirtyChange` / `onCancel` | callbacks | **TypeScript-authored schemas only** — a JSON metadata document cannot carry a function. Metadata pages go through the object-form route instead |
|
|
198
225
|
| `className`, `id`, `hidden`, … | — | inherited from `BaseSchema` |
|
|
199
226
|
|
|
200
|
-
|
|
201
|
-
(
|
|
202
|
-
|
|
203
|
-
|
|
204
|
-
|
|
227
|
+
`FormSchema` extends `BaseSchema`, which declares no index signature
|
|
228
|
+
(objectui#8347), so an invented or misspelled key in a form schema literal
|
|
229
|
+
annotated with its type is a compile error. That is why every example below is
|
|
230
|
+
annotated with its real type: an un-annotated `const schema = { … }` type-checks
|
|
231
|
+
whatever is written in it. (`fields` entries are `FormField`s, which still carry
|
|
232
|
+
their own index signature — see below.)
|
|
205
233
|
|
|
206
234
|
### Form Field
|
|
207
235
|
|
|
208
|
-
`FormField` (`packages/types/src/form.ts`)
|
|
209
|
-
|
|
236
|
+
`FormField` (`packages/types/src/form.ts`): `name` is the only **required**
|
|
237
|
+
key:
|
|
210
238
|
|
|
211
239
|
| Key | Type | What it does |
|
|
212
240
|
|---|---|---|
|
|
@@ -226,19 +254,19 @@ only **required** one:
|
|
|
226
254
|
| `validation` | `FieldValidationRules` | **an object keyed by rule name** — see below |
|
|
227
255
|
| `condition` | `FieldCondition` | legacy `{ field, equals, notEquals, in }` matcher (`custom` is retired, objectui#7759: nothing ran it) |
|
|
228
256
|
| `visibleWhen` / `readonlyWhen` / `requiredWhen` | `string \| { dialect?, source }` | CEL predicates over the live record, evaluated by `@objectstack/formula` — the same engine and dialect the server uses. Fail open |
|
|
229
|
-
| `visibleOn` | `string \| { dialect?, source }` | view-level visibility predicate (spec `
|
|
257
|
+
| `visibleOn` | `string \| { dialect?, source }` | view-level visibility predicate: objectui's runtime slot (not a spec key) a form view field's `visibleWhen` is carried into, ANDed with the field's own `visibleWhen` above. A form **view** field writes `visibleWhen` (its old `visibleOn` spelling is retired in `@objectstack/spec` 18 and is not read), and a section entry written as a bare field name carries no view-level predicate |
|
|
230
258
|
| `dependsOn` | `DependsOnInput` | cascading parent(s): a bare name, a list of names, or `{ field, param }` entries |
|
|
231
259
|
| `span` | `'auto' \| 'full'` | relative width, independent of the column count (preferred) |
|
|
232
260
|
| `colSpan` | `number` | legacy column span (1–4), clamped to the current column count |
|
|
261
|
+
| `className` | `string` | the classes of the element the field's type renders (its control, or a `section-divider` row's divider), joined with that element's own classes; never the field row: `span` / `colSpan` for width, `FormSchema.fieldContainerClass` for the grid |
|
|
233
262
|
| `field` | `Record<string, any>` | the resolved object-field **metadata object**, stashed by the object-bound paths so widgets can read `precision`, `currency`, `reference`, … In the *spec* form-view vocabulary `field` is a string (the referenced field name); that shape ends at `normalizeSectionField` and never reaches a runtime `FormField` |
|
|
234
263
|
|
|
235
|
-
`FormField`
|
|
236
|
-
|
|
264
|
+
`FormField` declares its own `[key: string]: any`, so an invented key on a field
|
|
265
|
+
still type-checks. One that a reader might expect, and that is **not** declared:
|
|
237
266
|
|
|
238
267
|
| Not a `FormField` key | Write this instead |
|
|
239
268
|
|---|---|
|
|
240
269
|
| `defaultValue` | `FormSchema.defaultValues` at form level. An object-bound form seeds from the object field's own declared `defaultValue` — see [What a create form opens with](#what-a-create-form-opens-with) |
|
|
241
|
-
| `className` | `span` / `colSpan` for width, `FormSchema.fieldContainerClass` for the grid. (An undeclared key still rides the props spread down to whichever component the field resolves to, so a field-level `className` can visibly land on a built-in control — but nothing in the contract promises that, and a registered widget honours it only if it happens to spread its leftover props. The renderer reads it *explicitly* nowhere: it used to stamp the `type: 'section-divider'` pseudo-field from an authored section's `className`, and that read was **retired** in objectstack#13626 — see [Section styling is not authorable](#section-styling-is-not-authorable).) |
|
|
242
270
|
|
|
243
271
|
There is no `ValidationRule` type in this repo, under any spelling.
|
|
244
272
|
|
|
@@ -252,7 +280,7 @@ There is no `ValidationRule` type in this repo, under any spelling.
|
|
|
252
280
|
| `required` | `string \| boolean` | supplies the required **message** only. Whether the field is required is decided by `required` / `requiredWhen` **on the field** |
|
|
253
281
|
| `minLength` / `maxLength` | `{ value: number; message: string }` | `message` is not optional when you author the rule by hand |
|
|
254
282
|
| `min` / `max` | `{ value: number; message: string }` | numeric range |
|
|
255
|
-
| `pattern` | `{ value:
|
|
283
|
+
| `pattern` | `{ value: RegExp; message: string }` | pass a **RegExp** in a hand-authored schema: react-hook-form only applies a pattern whose value `instanceof RegExp`, and nothing compiles a string into one. An object field has no `pattern` key: a regex check on an object is its `format` validation rule, which the server runs on save |
|
|
256
284
|
| `validate` | `(value) => boolean \| string \| Promise<boolean \| string>` | custom check; TypeScript-authored schemas only |
|
|
257
285
|
|
|
258
286
|
There is no `email` rule name — an email check is a `pattern`, which is exactly
|
|
@@ -261,7 +289,7 @@ what `buildValidationRules` emits for an object field of type `email`.
|
|
|
261
289
|
**Why the array spelling fails silently.** The only reader of this key is the
|
|
262
290
|
basic form renderer, which spreads it into the rule object handed to
|
|
263
291
|
react-hook-form — `const rules: any = { ...validation }`
|
|
264
|
-
(`packages/components/src/renderers/form/form.tsx
|
|
292
|
+
(`renderFormField` in `packages/components/src/renderers/form/form.tsx`). Spreading an **array**
|
|
265
293
|
into an object literal produces numeric keys (`{ '0': …, '1': … }`), which
|
|
266
294
|
react-hook-form does not recognise: every rule is dropped, nothing throws, and
|
|
267
295
|
the form looks validated while validating nothing.
|
|
@@ -269,29 +297,60 @@ the form looks validated while validating nothing.
|
|
|
269
297
|
### What a create form opens with
|
|
270
298
|
|
|
271
299
|
A create form has no persisted record, so its opening values come from the
|
|
272
|
-
object schema's declared field `defaultValue
|
|
300
|
+
object schema's declared defaults: a field's `defaultValue`, or the option its
|
|
301
|
+
option list marks `default: true`. Every object-form container
|
|
273
302
|
(`ObjectForm`, `ModalForm`, `DrawerForm`, `TabbedForm`, `SplitForm`,
|
|
274
303
|
`WizardForm`) resolves them the same way, through `schemaDefaults`:
|
|
275
304
|
|
|
276
305
|
| Declared | Create form opens with | Why |
|
|
277
306
|
|---|---|---|
|
|
278
307
|
| `defaultValue: 'draft'` (any static literal) | `draft`, preselected and submittable | the value is known; making the user pick it is busywork, and on a status-like field every wrong option is one click away |
|
|
279
|
-
| `defaultValue: 'NOW()'` / `'current_user'` (a runtime token) | empty | the token is an *instruction*, not a value. The server resolves it at insert — but only for fields that arrive empty, so seeding the literal text would suppress it |
|
|
280
|
-
| `defaultValue: cel\`today()\`` (an Expression envelope) | empty | same reason: the server evaluates it per insert |
|
|
281
|
-
| an option's `default: true` |
|
|
308
|
+
| `defaultValue: 'NOW()'` / `'current_user'` (a runtime token) | empty, with *Set automatically when saved.* under it | the token is an *instruction*, not a value. The server resolves it at insert — but only for fields that arrive empty, so seeding the literal text would suppress it |
|
|
309
|
+
| `defaultValue: cel\`today()\`` (an Expression envelope) | empty, with *Set automatically when saved.* under it | same reason: the server evaluates it per insert |
|
|
310
|
+
| an option's `default: true`, and no `defaultValue` | that option, preselected and submittable | the server stores the marked option when the field is omitted; see below |
|
|
282
311
|
| nothing | empty | no default is invented |
|
|
283
312
|
|
|
284
313
|
`initialData` / `initialValues` passed by the caller always outrank a schema
|
|
285
314
|
default — a lookup prefill or a "duplicate this record" seed is the more
|
|
286
315
|
specific instruction.
|
|
287
316
|
|
|
288
|
-
|
|
289
|
-
|
|
290
|
-
|
|
291
|
-
|
|
292
|
-
|
|
293
|
-
|
|
294
|
-
|
|
317
|
+
**The "set on save" hint (objectui#12108).** A field left empty for the server
|
|
318
|
+
is not left unexplained: the form renderer draws *Set automatically when saved.*
|
|
319
|
+
(locale key `form.serverDefaultHint`) in the field's description slot, after any
|
|
320
|
+
`description` the field declares, and the control's `aria-describedby` already
|
|
321
|
+
names that element. It is drawn exactly while the submit would omit the key — the
|
|
322
|
+
field is server-owned (`isServerOwnedValue` from `@object-ui/core`, the classifier
|
|
323
|
+
the `required` suppression below reads) and its value is empty by
|
|
324
|
+
`isMissingForRequired`, the predicate `omitServerResolvedDefaults` drops a key by.
|
|
325
|
+
So a value the user types removes it, and the hint never names the value, since the
|
|
326
|
+
client cannot evaluate the expression. It is not drawn:
|
|
327
|
+
|
|
328
|
+
- on an edit form, where the default was resolved at insert;
|
|
329
|
+
- on a control that takes no input (disabled or read-only). The containers send
|
|
330
|
+
`previousValues` in edit mode only, so the renderer reads a `mode: 'view'` form
|
|
331
|
+
as create, and this is what keeps the hint off it.
|
|
332
|
+
|
|
333
|
+
A boolean is no exception (objectui#12121). The renderer starts an unsupplied
|
|
334
|
+
two-state control at `false` (cloud#972) only when the field is not
|
|
335
|
+
server-owned, so a boolean with a runtime default opens unchecked with the hint
|
|
336
|
+
under it, and an untouched one is omitted from the submit. A value the user
|
|
337
|
+
sets, `false` included, is submitted as usual.
|
|
338
|
+
|
|
339
|
+
An option's `default: true` is read the way the server's insert path reads it
|
|
340
|
+
(`ObjectQL.applyFieldDefaults`, which falls back to the marked option), so the
|
|
341
|
+
form preselects exactly what omitting the field would store:
|
|
342
|
+
|
|
343
|
+
- only when the field declares no `defaultValue` — a field-level default,
|
|
344
|
+
static or runtime, always wins, and the flag is then not seeded at all;
|
|
345
|
+
- a single-valued field takes the **first** marked option;
|
|
346
|
+
- a multi-valued field (`@objectstack/spec`'s `isMultiValueField`: `multiselect`,
|
|
347
|
+
or `select` with `multiple: true`) takes **every** marked option, as an array.
|
|
348
|
+
|
|
349
|
+
That reading is published as `optionListDefault` (its parameter type is
|
|
350
|
+
`OptionListFieldLike`), so a host with its own form renderer seeds the same
|
|
351
|
+
option instead of re-deriving it (objectui#13049). The console's public form page
|
|
352
|
+
(`/f/:slug`) calls it. The `defaultValue` gate stays the caller's: call it only
|
|
353
|
+
for a field whose `defaultValue` is absent or `null`, as the containers do.
|
|
295
354
|
|
|
296
355
|
**Edit forms are never seeded.** An edit form shows the row as the server holds
|
|
297
356
|
it; folding a default in over a column the record leaves unset would arm a
|
|
@@ -337,8 +396,9 @@ remind_at: Field.datetime({ requiredWhen: 'record.status == "scheduled"', defaul
|
|
|
337
396
|
|
|
338
397
|
The required marker and `aria-required` go with the rule in the create case,
|
|
339
398
|
since one verdict drives all three — in that mode the user genuinely is not
|
|
340
|
-
required to provide the value.
|
|
341
|
-
non-authoritative preview, is a separate
|
|
399
|
+
required to provide the value. The hint above says *that* the server supplies it;
|
|
400
|
+
showing *what* it will supply, as a non-authoritative preview, is a separate
|
|
401
|
+
follow-up.
|
|
342
402
|
|
|
343
403
|
The two halves of that verdict are importable, so a host with its own form
|
|
344
404
|
renderer applies the same rule rather than re-deriving it (objectui#6059):
|
|
@@ -432,6 +492,32 @@ directly would have to re-spell the `collapse` enum onto its own boolean pair an
|
|
|
432
492
|
pass `visibleWhen` through by hand, which is the duplication this export exists to
|
|
433
493
|
prevent.
|
|
434
494
|
|
|
495
|
+
### What a section's `fields` entries draw
|
|
496
|
+
|
|
497
|
+
A section's `fields` takes three entry shapes, and every `formType` draws them
|
|
498
|
+
the same way: a field **name** and the form view's `{ field, … }` entry (which
|
|
499
|
+
overrides that object field) are resolved against the object schema, while an
|
|
500
|
+
inline runtime `FormField` keyed by `name` carries its own definition and is
|
|
501
|
+
drawn as it stands.
|
|
502
|
+
|
|
503
|
+
On the default (`simple`) form the two named shapes resolve against the form's
|
|
504
|
+
parent field pool — top-level `fields` when given, else the object's fields,
|
|
505
|
+
plus `customFields` — so a named member the pool does not hold is dropped
|
|
506
|
+
(reported once when the object declares it: `fields` and `sections`
|
|
507
|
+
intersect). An inline entry names nothing to resolve, so it is drawn whatever
|
|
508
|
+
the pool holds, exactly as the other five layouts draw it (objectui#11615). A
|
|
509
|
+
`simple` form whose sections list only inline entries is therefore a
|
|
510
|
+
self-contained collector, like the inline wizard below — see
|
|
511
|
+
[What a form submits to](#what-a-form-submits-to).
|
|
512
|
+
|
|
513
|
+
Code that reads a section's entries — a host holding the sections
|
|
514
|
+
`resolveSectionGroupReferences` returns, say — names each one with
|
|
515
|
+
`sectionEntryName(entry)`: the string itself, the `{ field }` entry's `field`,
|
|
516
|
+
the inline entry's `name` (`undefined` when the entry names nothing). Narrowing
|
|
517
|
+
by hand and reading `.name` off every object entry reads `undefined` off a
|
|
518
|
+
`{ field }` entry, and `ObjectFormSection.fields` now types that read as an
|
|
519
|
+
error.
|
|
520
|
+
|
|
435
521
|
### Column width of a sectioned form
|
|
436
522
|
|
|
437
523
|
A sectioned form renders as ONE grid, and two keys decide its shape:
|
|
@@ -800,8 +886,8 @@ const wizard: WizardFormSchema = {
|
|
|
800
886
|
```
|
|
801
887
|
|
|
802
888
|
`WizardFormSchema` declares no index signature, so an invented key on *this*
|
|
803
|
-
type is a real compile error —
|
|
804
|
-
`
|
|
889
|
+
type is a real compile error — and since objectui#8347 removed `BaseSchema`'s
|
|
890
|
+
`[key: string]: any`, the same holds for `ObjectFormSchema`.
|
|
805
891
|
|
|
806
892
|
One more route exists and is worth knowing about rather than reinventing: a flat
|
|
807
893
|
`object-form` can be turned into a stepper on small viewports with
|
|
@@ -891,6 +977,13 @@ through the wizard, and the parent operation of a master-detail form, whose
|
|
|
891
977
|
header is a simple or a `tabbed` form. A master-detail child row already worked
|
|
892
978
|
this way (objectui#10108), and all of them use the same comparison.
|
|
893
979
|
|
|
980
|
+
A master-detail edit reads each collection's lines in their stored order:
|
|
981
|
+
ascending by the child's sort field (the one its line grid stamps with each
|
|
982
|
+
line's position), the record id breaking ties (objectui#12286). The grid
|
|
983
|
+
renumbers that field only when a line is added, removed, duplicated or moved; a
|
|
984
|
+
cell edit leaves every line's position as it was read. So editing one line
|
|
985
|
+
sends one update, and moving a line sends only the lines whose position changed.
|
|
986
|
+
|
|
894
987
|
Before that comparison, every layout strips what a form never writes: the
|
|
895
988
|
server-owned columns (record identity, audit provenance, ownership and tenancy
|
|
896
989
|
— the roster in `sanitize.ts`, plus any field the object marks `system`),
|
|
@@ -911,6 +1004,21 @@ what refuses the save.
|
|
|
911
1004
|
A `wizard` disables Next and its final submit button, and its step indicator does
|
|
912
1005
|
not jump forward, while Cancel and Back stay usable.
|
|
913
1006
|
|
|
1007
|
+
**The record's owner is the one exception, and only on an edit
|
|
1008
|
+
(objectui#12205).** `owner_id` is in the server-owned roster, so a form never
|
|
1009
|
+
echoes it back: the platform refuses an echoed owner from every role without
|
|
1010
|
+
the transfer grant (objectui#10108). The spec declares it `system` but not
|
|
1011
|
+
`readonly`, because ownership is transferable from a form. So an edit save adds
|
|
1012
|
+
it back when, and only when, its value differs from the record the form read: a
|
|
1013
|
+
new owner is sent as its id, and a cleared one as `null`. Field-level security,
|
|
1014
|
+
a `readonly` declaration on the object and the unknown-key strip still keep it
|
|
1015
|
+
off the wire. A create never sends it, and neither does a form with no record
|
|
1016
|
+
read of its own (listed below). The server decides whether the caller may make
|
|
1017
|
+
the change, and the form shows a refusal as its error. The business-unit and
|
|
1018
|
+
tenant columns are not reassignable from a form and are never sent. The
|
|
1019
|
+
master-detail form's batch still strips the owner from the header operation, so
|
|
1020
|
+
an owner changed in a master-detail header is not saved.
|
|
1021
|
+
|
|
914
1022
|
The comparison sends every field it cannot prove unchanged, because a field
|
|
915
1023
|
wrongly judged unchanged would lose the user's edit while the server still
|
|
916
1024
|
answers 200:
|
|
@@ -1011,7 +1119,8 @@ only — the basic `form` node has no `mode` (retired by objectui#10286, see
|
|
|
1011
1119
|
A bare `form` never fetches or saves by itself: it has no object name and no
|
|
1012
1120
|
query, so there is nothing for it to call an adapter *with*. It collects values
|
|
1013
1121
|
and hands them to your `onSubmit`, which the renderer awaits
|
|
1014
|
-
(`
|
|
1122
|
+
(`await onSubmitProp(formData)` in the submit handler of
|
|
1123
|
+
`packages/components/src/renderers/form/form.tsx`). Any persistence is
|
|
1015
1124
|
whatever that function does:
|
|
1016
1125
|
|
|
1017
1126
|
```typescript
|
|
@@ -1042,9 +1151,9 @@ a JSON metadata document cannot carry one. Metadata pages take the `object-form`
|
|
|
1042
1151
|
route above.
|
|
1043
1152
|
|
|
1044
1153
|
What the adapter on the context still does for a bare `form` is supply the
|
|
1045
|
-
**field widgets**: the renderer reads it
|
|
1154
|
+
**field widgets**: the renderer reads it
|
|
1046
1155
|
(`const contextDataSource = schemaCtx?.dataSource ?? null`) and passes it down
|
|
1047
|
-
per field
|
|
1156
|
+
per field (`dataSource: contextDataSource`), which is how a lookup or cascading select loads its
|
|
1048
1157
|
options. Nothing else about the form is wired to it.
|
|
1049
1158
|
|
|
1050
1159
|
### Keys that look like wiring but are not
|
|
@@ -1054,12 +1163,13 @@ nothing:
|
|
|
1054
1163
|
|
|
1055
1164
|
| Written on a form schema | What actually happens |
|
|
1056
1165
|
|---|---|
|
|
1057
|
-
| `dataSource` | **Discarded.** The basic form
|
|
1166
|
+
| `dataSource` | **Discarded.** The basic form drops it in both directions — the built-in branches hand their control an allowlist (`toFormControlDomProps`) that does not name it, and the renderer's own props destructure takes it off the node — so it never reaches a widget and never reaches the DOM. The adapter the fields receive is the context one |
|
|
1058
1167
|
| `resource` | **Never read.** It is not declared on `FormSchema` or `ObjectFormSchema` at all. It used to exist elsewhere in the protocol — on `CRUDSchema`, where `CRUDBuilder` set it — but objectui#5373 retired both under ADR-0049, so today the key names nothing anywhere in this package's surface, and no form renderer reads it under any spelling |
|
|
1059
1168
|
|
|
1060
|
-
Both
|
|
1061
|
-
|
|
1062
|
-
|
|
1169
|
+
Both survived compilation while `FormSchema` and `ObjectFormSchema` extended a
|
|
1170
|
+
`BaseSchema` that declared `[key: string]: any`: an invented key was not a type
|
|
1171
|
+
error, it was simply never read. objectui#8347 removed that signature, so both are
|
|
1172
|
+
compile errors in an annotated literal now. That is also why the
|
|
1063
1173
|
older version of this section looked like it worked: its `onSubmit` genuinely ran
|
|
1064
1174
|
and genuinely saved, but through the adapter its closure captured. The `dataSource`
|
|
1065
1175
|
and `resource` keys sitting beside it in the same object were inert. Delete them and
|
|
@@ -1069,11 +1179,11 @@ anything.
|
|
|
1069
1179
|
> A top-level `dataSource` **does** mean something on a schema node, but it is not
|
|
1070
1180
|
> an adapter: it is the spec's element **binding** (`PageComponentSchema.dataSource`,
|
|
1071
1181
|
> objectstack#6953) — a descriptor such as `{ object: 'users' }` — resolved by
|
|
1072
|
-
> `useElementDataSource` (`packages/react/src/hooks/useElementDataSource.ts
|
|
1182
|
+
> `useElementDataSource` (`packages/react/src/hooks/useElementDataSource.ts`).
|
|
1073
1183
|
> `object-form` passes through that gate, and honours the binding's `object` key
|
|
1074
1184
|
> only. Handing that slot a live adapter is rejected on purpose: the predicate
|
|
1075
1185
|
> refuses any value carrying a `find` method
|
|
1076
|
-
> (`packages/core/src/data-scope/element-data-source.ts
|
|
1186
|
+
> (`isElementDataSourceConfig` in `packages/core/src/data-scope/element-data-source.ts`), so an adapter written
|
|
1077
1187
|
> there is ignored rather than mistaken for a binding. Pass adapters through the
|
|
1078
1188
|
> provider above.
|
|
1079
1189
|
|
package/dist/DrawerForm.d.ts
CHANGED
|
@@ -1,11 +1,16 @@
|
|
|
1
1
|
import { default as React } from 'react';
|
|
2
|
-
import { FormField, DataSource, ObjectFormSchema } from '@object-ui/types';
|
|
2
|
+
import { FormField, DataSource, ObjectFormSchema, ObjectFormSection } from '@object-ui/types';
|
|
3
3
|
export interface DrawerFormSectionConfig {
|
|
4
4
|
name?: string;
|
|
5
5
|
label?: string;
|
|
6
6
|
description?: string;
|
|
7
7
|
columns?: 1 | 2 | 3 | 4;
|
|
8
|
-
|
|
8
|
+
/**
|
|
9
|
+
* The same three entry shapes as `ObjectFormSection.fields`, by reference:
|
|
10
|
+
* a field name, the form view's `{ field, … }` entry, or an inline
|
|
11
|
+
* `FormField` (objectui#11615).
|
|
12
|
+
*/
|
|
13
|
+
fields: NonNullable<ObjectFormSection['fields']>;
|
|
9
14
|
collapsible?: boolean;
|
|
10
15
|
collapsed?: boolean;
|
|
11
16
|
/**
|
|
@@ -17,6 +22,12 @@ export interface DrawerFormSectionConfig {
|
|
|
17
22
|
dialect?: string;
|
|
18
23
|
source: string;
|
|
19
24
|
};
|
|
25
|
+
/**
|
|
26
|
+
* The fault direction of {@link visibleWhen}, by reference to
|
|
27
|
+
* `ObjectFormSection.visibleWhenFault` (objectui#13055): `'hidden'` (a field
|
|
28
|
+
* group's predicate) hides the section when it cannot be evaluated.
|
|
29
|
+
*/
|
|
30
|
+
visibleWhenFault?: ObjectFormSection['visibleWhenFault'];
|
|
20
31
|
/** Custom CSS class for the section's divider header. */
|
|
21
32
|
className?: string;
|
|
22
33
|
}
|
package/dist/DrawerForm.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"DrawerForm.d.ts","sourceRoot":"","sources":["../src/DrawerForm.tsx"],"names":[],"mappings":"AAAA;;;;;;GAMG;AAEH;;;;;GAKG;AAEH,OAAO,
|
|
1
|
+
{"version":3,"file":"DrawerForm.d.ts","sourceRoot":"","sources":["../src/DrawerForm.tsx"],"names":[],"mappings":"AAAA;;;;;;GAMG;AAEH;;;;;GAKG;AAEH,OAAO,KAA8F,MAAM,OAAO,CAAC;AACnH,OAAO,KAAK,EAAE,SAAS,EAAc,UAAU,EAAE,gBAAgB,EAAE,iBAAiB,EAAE,MAAM,kBAAkB,CAAC;AAyF/G,MAAM,WAAW,uBAAuB;IACtC,IAAI,CAAC,EAAE,MAAM,CAAC;IACd,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,WAAW,CAAC,EAAE,MAAM,CAAC;IACrB,OAAO,CAAC,EAAE,CAAC,GAAG,CAAC,GAAG,CAAC,GAAG,CAAC,CAAC;IACxB;;;;OAIG;IACH,MAAM,EAAE,WAAW,CAAC,iBAAi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F,eAAe,UAAU,CAAC"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"LineItemsPanel.d.ts","sourceRoot":"","sources":["../src/LineItemsPanel.tsx"],"names":[],"mappings":"AAAA;;;;;;GAMG;AAEH;;;;;;;;;GASG;AAEH,OAAO,KAA4D,MAAM,OAAO,CAAC;AASjF,OAAO,
|
|
1
|
+
{"version":3,"file":"LineItemsPanel.d.ts","sourceRoot":"","sources":["../src/LineItemsPanel.tsx"],"names":[],"mappings":"AAAA;;;;;;GAMG;AAEH;;;;;;;;;GASG;AAEH,OAAO,KAA4D,MAAM,OAAO,CAAC;AASjF,OAAO,EAAwC,KAAK,UAAU,EAAE,MAAM,mBAAmB,CAAC;AAkE1F,MAAM,WAAW,oBAAoB;IACnC,IAAI,CAAC,EAAE,mBAAmB,CAAC;IAC3B,WAAW,EAAE,MAAM,CAAC;IACpB,iBAAiB,EAAE,MAAM,CAAC;IAC1B,OAAO,EAAE,UAAU,EAAE,CAAC;IACtB,YAAY,CAAC,EAAE,MAAM,CAAC;IACtB,QAAQ,CAAC,EAAE,MAAM,CAAC;IAClB,QAAQ,CAAC,EAAE,MAAM,CAAC;IAClB,iFAAiF;IACjF,WAAW,CAAC,EAAE,MAAM,CAAC;IACrB,0EAA0E;IAC1E,UAAU,CAAC,EAAE,MAAM,CAAC;IACpB,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,QAAQ,CAAC,EAAE,OAAO,CAAC;IACnB,OAAO,CAAC,EAAE,MAAM,CAAC;IACjB,OAAO,CAAC,EAAE,MAAM,CAAC;IACjB;;;;;;;;;;;;OAYG;IACH,MAAM,CAAC,EAAE,GAAG,EAAE,GAAG,MAAM,CAAC,MAAM,EAAE,GAAG,CAAC,CAAC;IACrC;;;;OAIG;IACH,IAAI,CAAC,EAAE,KAAK,CAAC;QAAE,KAAK,CAAC,EAAE,MAAM,CAAC;QAAC,KAAK,CAAC,EAAE,KAAK,GAAG,MAAM,CAAA;KAAE,CAAC,CAAC;IACzD;;;;OAIG;IACH,KAAK,CAAC,EAAE,MAAM,CAAC;CAChB;AAED;;;GAGG;AACH,eAAO,MAAM,wBAAwB,MAAM,CAAC;AAsE5C,eAAO,MAAM,cAAc,EAAE,KAAK,CAAC,EAAE,CAAC;IAAE,MAAM,EAAE,oBAAoB,CAAA;CAAE,CAsrBrE,CAAC"}
|
|
@@ -1,34 +1,54 @@
|
|
|
1
1
|
import { default as React } from 'react';
|
|
2
2
|
import { DataSource, I18nLabel } from '@object-ui/types';
|
|
3
|
-
import {
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
3
|
+
import { ObjectMasterDetailFormProps } from '@objectstack/spec/ui';
|
|
4
|
+
/**
|
|
5
|
+
* One detail collection: the `details` entry of
|
|
6
|
+
* `ComponentPropsMap['object-master-detail-form']` in `@objectstack/spec`, on
|
|
7
|
+
* its authoring face (`z.input`, what a document writes), taken by reference
|
|
8
|
+
* rather than restated here (objectui#11396). Since 17.6.0 the spec judges that
|
|
9
|
+
* entry as a closed shape (objectstack-ai/objectstack#21215): `childObject`
|
|
10
|
+
* required, every other member optional, `columns` the spec's inline grid
|
|
11
|
+
* column (the type the line grid's `GridColumn` is), an undeclared key refused
|
|
12
|
+
* by name. `@object-ui/types` takes the whole props row by reference, so
|
|
13
|
+
* `objectui validate` gives the spec's verdict on an entry; this is the
|
|
14
|
+
* TypeScript face of that entry, and
|
|
15
|
+
* `__tests__/masterDetailDetailsMembers-8071.test.tsx` holds the two equal at
|
|
16
|
+
* compile time.
|
|
17
|
+
*
|
|
18
|
+
* ONE key is left off, and it is no longer a fork: `sortField`. This form
|
|
19
|
+
* reads no such member — objectui#11070 round 9 retired the authored override:
|
|
20
|
+
* the child field the grid stamps with each line's position is DERIVED from
|
|
21
|
+
* the child object (`deriveDetail` picks its `position` / `sort_order` / …
|
|
22
|
+
* field) and carried on the resolved entry, and row 2c of that test pins that a
|
|
23
|
+
* written `sortField` is read by nothing. Through 17.6.0 the spec entry still
|
|
24
|
+
* declared it; `@objectstack/spec` 17.7.0 retires it — a `retiredKey()`
|
|
25
|
+
* tombstone on the entry (objectstack-ai/objectstack#21589, landed by PR
|
|
26
|
+
* objectstack-ai/objectstack#21632 as `6ec54f00`) — so both published zod faces
|
|
27
|
+
* refuse an authored `sortField` with the spec's retired-key message
|
|
28
|
+
* (objectui#11717). The entry still LISTS the key as that tombstone, and the
|
|
29
|
+
* omission below keeps it off this face rather than offer a member whose only
|
|
30
|
+
* legal value is absence. That omission is the whole of what is hand-written
|
|
31
|
+
* about the shape.
|
|
32
|
+
*
|
|
33
|
+
* Where each member lands — the renderer's reading, which the spec's
|
|
34
|
+
* description does not carry:
|
|
35
|
+
* - `childObject` names the child object; `relationshipField` is the FK on the
|
|
36
|
+
* child back to the parent, auto-detected from the child's `master_detail` /
|
|
37
|
+
* `lookup` field that references the parent when omitted.
|
|
38
|
+
* - `columns` are the line grid's editable columns, derived from the child's
|
|
39
|
+
* fields (via `DataSource.getObjectSchema`) when omitted; `formFields` are
|
|
40
|
+
* the per-row expand form's field names (broader than `columns`: rich types
|
|
41
|
+
* included), derived likewise.
|
|
42
|
+
* - `inlineMode`: `grid` = editable cells, `form` = read-only list + per-row
|
|
43
|
+
* full form; resolved from the relationship's `inlineEdit` (incl. the smart
|
|
44
|
+
* default) when omitted.
|
|
45
|
+
* - `amountField` is the CHILD column summed, and reaches the grid as its
|
|
46
|
+
* `totalField`; `totalField` is the PARENT field the sum is saved to, and is
|
|
47
|
+
* not forwarded to the grid.
|
|
48
|
+
* - `title` heads the collection's section (`Line Items` when unset);
|
|
49
|
+
* `minRows`, `maxRows` and `addLabel` reach the grid under the same names.
|
|
50
|
+
*/
|
|
51
|
+
export type MasterDetailDetailConfig = Omit<NonNullable<ObjectMasterDetailFormProps['details']>[number], 'sortField'>;
|
|
32
52
|
export interface MasterDetailFormSchema {
|
|
33
53
|
type?: 'object-master-detail-form';
|
|
34
54
|
/** Parent object name, e.g. 'expense_claim'. */
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"MasterDetailForm.d.ts","sourceRoot":"","sources":["../src/MasterDetailForm.tsx"],"names":[],"mappings":"AAAA;;;;;;GAMG;AAEH;;;;;;;;;;;;;;;;;;;;;;GAsBG;AAEH,OAAO,KAA4D,MAAM,OAAO,CAAC;AACjF,OAAO,KAAK,EAA6B,UAAU,
|
|
1
|
+
{"version":3,"file":"MasterDetailForm.d.ts","sourceRoot":"","sources":["../src/MasterDetailForm.tsx"],"names":[],"mappings":"AAAA;;;;;;GAMG;AAEH;;;;;;;;;;;;;;;;;;;;;;GAsBG;AAEH,OAAO,KAA4D,MAAM,OAAO,CAAC;AACjF,OAAO,KAAK,EAA6B,UAAU,EAAqB,SAAS,EAAE,MAAM,kBAAkB,CAAC;AAmC5G,OAAO,KAAK,EAAE,2BAA2B,EAAE,MAAM,sBAAsB,CAAC;AAExE;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA8CG;AACH,MAAM,MAAM,wBAAwB,GAAG,IAAI,CACzC,WAAW,CAAC,2BAA2B,CAAC,SAAS,CAAC,CAAC,CAAC,MAAM,CAAC,EAC3D,WAAW,CACZ,CAAC;AAEF,MAAM,WAAW,sBAAsB;IACrC,IAAI,CAAC,EAAE,2BAA2B,CAAC;IACnC,gDAAgD;IAChD,UAAU,EAAE,MAAM,CAAC;IACnB,IAAI,CAAC,EAAE,QAAQ,GAAG,MAAM,CAAC;IACzB;;;;;;OAMG;IACH,QAAQ,CAAC,EAA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{ FormField, DataSource, ObjectFormSchema } from '@object-ui/types';
|
|
2
|
+
import { FormField, DataSource, ObjectFormSchema, ObjectFormSection } from '@object-ui/types';
|
|
3
3
|
export interface ModalFormSectionConfig {
|
|
4
4
|
name?: string;
|
|
5
5
|
label?: string;
|
|
6
6
|
description?: string;
|
|
7
7
|
columns?: 1 | 2 | 3 | 4;
|
|
8
|
-
|
|
8
|
+
/**
|
|
9
|
+
* The same three entry shapes as `ObjectFormSection.fields`, by reference:
|
|
10
|
+
* a field name, the form view's `{ field, … }` entry, or an inline
|
|
11
|
+
* `FormField` (objectui#11615).
|
|
12
|
+
*/
|
|
13
|
+
fields: NonNullable<ObjectFormSection['fields']>;
|
|
9
14
|
/**
|
|
10
15
|
* Whether the section can be collapsed — spec `FormSection.collapsible`.
|
|
11
16
|
* `collapsed: true` implies it (objectui#9780). The control lives on the
|
|
@@ -26,6 +31,12 @@ export interface ModalFormSectionConfig {
|
|
|
26
31
|
dialect?: string;
|
|
27
32
|
source: string;
|
|
28
33
|
};
|
|
34
|
+
/**
|
|
35
|
+
* The fault direction of {@link visibleWhen}, by reference to
|
|
36
|
+
* `ObjectFormSection.visibleWhenFault` (objectui#13055): `'hidden'` (a field
|
|
37
|
+
* group's predicate) hides the section when it cannot be evaluated.
|
|
38
|
+
*/
|
|
39
|
+
visibleWhenFault?: ObjectFormSection['visibleWhenFault'];
|
|
29
40
|
/** Custom CSS class for the section's header row (stacked layout). */
|
|
30
41
|
className?: string;
|
|
31
42
|
/**
|
package/dist/ModalForm.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"ModalForm.d.ts","sourceRoot":"","sources":["../src/ModalForm.tsx"],"names":[],"mappings":"AAAA;;;;;;GAMG;AAEH;;;;;GAKG;AAEH,OAAO,
|
|
1
|
+
{"version":3,"file":"ModalForm.d.ts","sourceRoot":"","sources":["../src/ModalForm.tsx"],"names":[],"mappings":"AAAA;;;;;;GAMG;AAEH;;;;;GAKG;AAEH,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MAAM,CAAC;QACpB,iBAAiB,CAAC,EAAE,MAAM,CAAC;QAC3B,OAAO,CAAC,EAAE,GAAG,EAAE,CAAC;QAChB,WAAW,CAAC,EAAE,MAAM,CAAC;QACrB,UAAU,CAAC,EAAE,MAAM,CAAC;QACpB,KAAK,CAAC,EAAE,MAAM,CAAC;QACf,QAAQ,CAAC,EAAE,MAAM,CAAC;QAClB,OAAO,CAAC,EAAE,MAAM,CAAC;QACjB,OAAO,CAAC,EAAE,MAAM,CAAC;KAClB,CAAC,CAAC;CACJ;AAED,MAAM,WAAW,cAAc;IAC7B,MAAM,EAAE,eAAe,CAAC;IACxB,UAAU,CAAC,EAAE,UAAU,CAAC;IACxB,SAAS,CAAC,EAAE,MAAM,CAAC;CACpB;AAkDD,eAAO,MAAM,SAAS,EAAE,KAAK,CAAC,EAAE,CAAC,cAAc,CAm8B9C,CAAC;AA2CF,eAAe,SAAS,CAAC"}
|
package/dist/ObjectForm.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"ObjectForm.d.ts","sourceRoot":"","sources":["../src/ObjectForm.tsx"],"names":[],"mappings":"AAAA;;;;;;GAMG;AAEH;;;;;GAKG;AAEH,OAAO,KAAoD,MAAM,OAAO,CAAC;AACzE,OAAO,KAAK,EAAE,gBAAgB,EAAyB,UAAU,EAAE,MAAM,kBAAkB,CAAC;
|
|
1
|
+
{"version":3,"file":"ObjectForm.d.ts","sourceRoot":"","sources":["../src/ObjectForm.tsx"],"names":[],"mappings":"AAAA;;;;;;GAMG;AAEH;;;;;GAKG;AAEH,OAAO,KAAoD,MAAM,OAAO,CAAC;AACzE,OAAO,KAAK,EAAE,gBAAgB,EAAyB,UAAU,EAAE,MAAM,kBAAkB,CAAC;AA8D5F;;;;;;;;;;;;;;;GAeG;AACH,MAAM,WAAW,wBAAwB;IACvC;;OAEG;IACH,MAAM,EAAE,gBAAgB,CAAC;IAEzB;;;OAGG;IACH,UAAU,CAAC,EAAE,UAAU,CAAC;IAExB;;OAEG;IACH,SAAS,CAAC,EAAE,MAAM,CAAC;CACpB;AAwFD;;;;;;;;;;;;;;;;;GAiBG;AACH,eAAO,MAAM,UAAU,EAAE,KAAK,CAAC,EAAE,CAAC,wBAAwB,CAwZzD,CAAC"}
|
package/dist/SplitForm.d.ts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { default as React } from 'react';
|
|
2
|
-
import { FormField, DataSource, ObjectFormSchema } from '@object-ui/types';
|
|
2
|
+
import { FormField, DataSource, ObjectFormSchema, ObjectFormSection } from '@object-ui/types';
|
|
3
3
|
export interface SplitFormSectionConfig {
|
|
4
4
|
name?: string;
|
|
5
5
|
label?: string;
|
|
@@ -12,7 +12,12 @@ export interface SplitFormSectionConfig {
|
|
|
12
12
|
* positional rule (first section 'primary', every other 'secondary').
|
|
13
13
|
*/
|
|
14
14
|
pane?: 'primary' | 'secondary';
|
|
15
|
-
|
|
15
|
+
/**
|
|
16
|
+
* The same three entry shapes as `ObjectFormSection.fields`, by reference:
|
|
17
|
+
* a field name, the form view's `{ field, … }` entry, or an inline
|
|
18
|
+
* `FormField` (objectui#11615).
|
|
19
|
+
*/
|
|
20
|
+
fields: NonNullable<ObjectFormSection['fields']>;
|
|
16
21
|
/**
|
|
17
22
|
* ADR-0089 `FormSection.visibleWhen` — conditional visibility for the
|
|
18
23
|
* section's divider HEADER, evaluated by the form renderer with the canonical
|
|
@@ -22,6 +27,12 @@ export interface SplitFormSectionConfig {
|
|
|
22
27
|
dialect?: string;
|
|
23
28
|
source: string;
|
|
24
29
|
};
|
|
30
|
+
/**
|
|
31
|
+
* The fault direction of {@link visibleWhen}, by reference to
|
|
32
|
+
* `ObjectFormSection.visibleWhenFault` (objectui#13055): `'hidden'` (a field
|
|
33
|
+
* group's predicate) hides the section when it cannot be evaluated.
|
|
34
|
+
*/
|
|
35
|
+
visibleWhenFault?: ObjectFormSection['visibleWhenFault'];
|
|
25
36
|
/** Custom CSS class for the section's header row. */
|
|
26
37
|
className?: string;
|
|
27
38
|
/**
|
package/dist/SplitForm.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"SplitForm.d.ts","sourceRoot":"","sources":["../src/SplitForm.tsx"],"names":[],"mappings":"AAAA;;;;;;GAMG;AAEH;;;;;;;;;;;;;;;GAeG;AAEH,OAAO,KAA4D,MAAM,OAAO,CAAC;AACjF,OAAO,KAAK,EAAE,SAAS,EAAc,UAAU,EAAE,gBAAgB,EAAE,MAAM,kBAAkB,CAAC;
|
|
1
|
+
{"version":3,"file":"SplitForm.d.ts","sourceRoot":"","sources":["../src/SplitForm.tsx"],"names":[],"mappings":"AAAA;;;;;;GAMG;AAEH;;;;;;;;;;;;;;;GAeG;AAEH,OAAO,KAA4D,MAAM,OAAO,CAAC;AACjF,OAAO,KAAK,EAAE,SAAS,EAAc,UAAU,EAAE,gBAAgB,EAAE,iBAAiB,EAAE,MAAM,kBAAkB,CAAC;AAyB/G,MAAM,WAAW,sBAAsB;IACrC,IAAI,CAAC,EAAE,MAAM,CAAC;IACd,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,WAAW,CAAC,EAAE,MAAM,CAAC;IACrB,OAAO,CAAC,EAAE,CAAC,GAAG,CAAC,GAAG,CAAC,GAAG,CAAC,CAAC;IACxB;;;;;OAKG;IACH,IAAI,CAAC,EAAE,SAAS,GAAG,WAAW,CAAC;IAC/B;;;;OAIG;IACH,MAAM,EAAE,WAAW,CAAC,iBAAiB,CAAC,QAAQ,CAAC,CAAC,CAAC;IACjD;;;;OAIG;IACH,WAAW,CAAC,EAAE,MAAM,GAAG;QAAE,OAAO,CAAC,EAAE,MAAM,CAAC;QAAC,MAAM,EAAE,MAAM,CAAA;KAAE,CAAC;IAC5D;;;;OAIG;IACH,gBAAgB,CAAC,EAAE,iBAAiB,CAAC,kBAAkB,CAAC,CAAC;IACzD,qDAAqD;IACrD,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB;;;;;OAKG;IACH,aA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