@svgrid/enterprise 2.6.0 → 2.6.1

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/schema.d.ts CHANGED
@@ -268,6 +268,19 @@ export type FormSection = {
268
268
  fields: string[];
269
269
  /** Show the section only while this holds - see `EntityField.when`. */
270
270
  visibleWhen?: PredicateExpr;
271
+ /**
272
+ * Let the user fold this group away. Turns the heading into a disclosure
273
+ * button, so a long form opens at a readable length instead of a wall of
274
+ * inputs.
275
+ *
276
+ * A collapsed section is still **filled in and still validated** - it is a
277
+ * display state, not a condition. Use `visibleWhen` to actually drop fields
278
+ * from the form. If a collapsed section holds an error the panel opens it, so
279
+ * a failed submit can never point at something the user cannot see.
280
+ */
281
+ collapsible?: boolean;
282
+ /** Start folded. Only meaningful with `collapsible`. */
283
+ collapsed?: boolean;
271
284
  };
272
285
  /**
273
286
  * How the entity's form is laid out. Lives on the schema rather than on the
@@ -281,6 +294,25 @@ export type FormSection = {
281
294
  export type FormLayout = {
282
295
  columns?: 1 | 2 | 3;
283
296
  sections?: FormSection[];
297
+ /**
298
+ * Ask one section at a time, with Back / Next and a progress line - an intake
299
+ * form or an onboarding flow rather than a page of inputs.
300
+ *
301
+ * Each section is a step, so the sections ARE the design: no second list to
302
+ * keep in sync. **Next validates only the step you are on**, so a long form
303
+ * fails early and locally instead of dumping every error at the end. A section
304
+ * hidden by `visibleWhen` is skipped rather than shown empty, so the step count
305
+ * follows the answers.
306
+ *
307
+ * Needs sections (with none, it is one page and this does nothing) and makes
308
+ * `collapsible` moot - a step is already one group at a time.
309
+ *
310
+ * A server-rendered screen renders the steps as ordinary sections: stepping
311
+ * through a `<form>` with no JavaScript would mean a round-trip per step and
312
+ * somewhere to keep the half-finished record. The server still validates
313
+ * everything either way.
314
+ */
315
+ steps?: boolean;
284
316
  };
285
317
  /** Normalized descriptor the edit panel renders from (one per visible-in-form field). */
286
318
  export type FormFieldDescriptor = {
@@ -325,6 +357,13 @@ export declare function titleCase(field: string): string;
325
357
  * `getRowId`, edit panel, adapters) needs a stable key.
326
358
  */
327
359
  export declare function resolveIdField<TData extends RowData>(schema: EntitySchema<TData>): string;
360
+ /**
361
+ * Whether a field is hidden from one surface. Public because the `hidden`
362
+ * union (`true` means both surfaces, an object names them) is exactly the kind
363
+ * of logic that drifts when every caller re-derives it - the form builder's
364
+ * "Hidden from this form" tray is one such caller.
365
+ */
366
+ export declare function isFieldHidden(field: Pick<EntityField, 'hidden'>, surface: 'grid' | 'form'): boolean;
328
367
  /**
329
368
  * Derive grid columns from a schema. Read-only fields become non-editable
330
369
  * columns; `enum` carries its options through as `editorOptions`. The
package/dist/schema.js CHANGED
@@ -75,6 +75,15 @@ function hiddenFor(field, surface) {
75
75
  return field.hidden[surface] === true;
76
76
  return false;
77
77
  }
78
+ /**
79
+ * Whether a field is hidden from one surface. Public because the `hidden`
80
+ * union (`true` means both surfaces, an object names them) is exactly the kind
81
+ * of logic that drifts when every caller re-derives it - the form builder's
82
+ * "Hidden from this form" tray is one such caller.
83
+ */
84
+ export function isFieldHidden(field, surface) {
85
+ return hiddenFor(field, surface);
86
+ }
78
87
  /**
79
88
  * Derive grid columns from a schema. Read-only fields become non-editable
80
89
  * columns; `enum` carries its options through as `editorOptions`. The