@asteby/metacore-runtime-react 28.3.7 → 28.5.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.
Files changed (46) hide show
  1. package/CHANGELOG.md +57 -0
  2. package/dist/action-modal-dispatcher.js +1 -1
  3. package/dist/dashboard-grid.d.ts.map +1 -1
  4. package/dist/dashboard-grid.js +5 -1
  5. package/dist/dialogs/dynamic-record.d.ts +20 -1
  6. package/dist/dialogs/dynamic-record.d.ts.map +1 -1
  7. package/dist/dialogs/dynamic-record.js +95 -23
  8. package/dist/dynamic-form-schema.d.ts +26 -1
  9. package/dist/dynamic-form-schema.d.ts.map +1 -1
  10. package/dist/dynamic-form-schema.js +41 -0
  11. package/dist/dynamic-form.d.ts +10 -1
  12. package/dist/dynamic-form.d.ts.map +1 -1
  13. package/dist/dynamic-form.js +60 -7
  14. package/dist/dynamic-relation.d.ts +12 -0
  15. package/dist/dynamic-relation.d.ts.map +1 -1
  16. package/dist/dynamic-relation.js +12 -6
  17. package/dist/dynamic-relations.d.ts +9 -1
  18. package/dist/dynamic-relations.d.ts.map +1 -1
  19. package/dist/dynamic-relations.js +5 -4
  20. package/dist/form-layout-ui.d.ts +25 -0
  21. package/dist/form-layout-ui.d.ts.map +1 -0
  22. package/dist/form-layout-ui.js +39 -0
  23. package/dist/form-layout.d.ts +54 -0
  24. package/dist/form-layout.d.ts.map +1 -0
  25. package/dist/form-layout.js +81 -0
  26. package/dist/index.d.ts +3 -1
  27. package/dist/index.d.ts.map +1 -1
  28. package/dist/index.js +3 -1
  29. package/dist/types.d.ts +47 -0
  30. package/dist/types.d.ts.map +1 -1
  31. package/package.json +1 -1
  32. package/src/__tests__/dynamic-record-hidden-submit.test.tsx +78 -0
  33. package/src/__tests__/dynamic-relation-subtable-context.test.tsx +74 -0
  34. package/src/__tests__/form-layout.test.ts +113 -0
  35. package/src/__tests__/visible-when.test.ts +63 -0
  36. package/src/action-modal-dispatcher.tsx +1 -1
  37. package/src/dashboard-grid.tsx +5 -1
  38. package/src/dialogs/dynamic-record.tsx +189 -50
  39. package/src/dynamic-form-schema.ts +47 -1
  40. package/src/dynamic-form.tsx +126 -17
  41. package/src/dynamic-relation.tsx +25 -8
  42. package/src/dynamic-relations.tsx +16 -1
  43. package/src/form-layout-ui.tsx +117 -0
  44. package/src/form-layout.ts +116 -0
  45. package/src/index.ts +4 -0
  46. package/src/types.ts +48 -0
package/src/types.ts CHANGED
@@ -295,6 +295,23 @@ export interface ColumnDefinition {
295
295
  itemFields?: ColumnItemField[]
296
296
  /** snake_case alias served by the kernel for `itemFields`. */
297
297
  item_fields?: ColumnItemField[]
298
+ /**
299
+ * Conditional visibility in the create/edit modal: render this field only
300
+ * when a sibling field's current value matches the predicate. Mirrors the
301
+ * kernel v3 `Column.visible_when` (projected onto the served ColumnDef).
302
+ * Tolerates the camelCase alias. Absent = always visible; a hidden field is
303
+ * skipped by the required-gate so it never blocks submit. See
304
+ * `evaluateVisibleWhen`.
305
+ */
306
+ visible_when?: VisibleWhen
307
+ /** camelCase alias for `visible_when`. */
308
+ visibleWhen?: VisibleWhen
309
+ /**
310
+ * Form-layout membership: the key of the `form_layout` section this column's
311
+ * modal field belongs to (kernel PR #230). Absent → the default group. See
312
+ * `groupFieldsBySection`.
313
+ */
314
+ section?: string
298
315
  }
299
316
 
300
317
  /**
@@ -317,6 +334,21 @@ export interface ActionCondition {
317
334
  value: string | string[]
318
335
  }
319
336
 
337
+ /**
338
+ * Conditional-visibility predicate for a create/edit form field. Mirrors the
339
+ * kernel v3 `visible_when` block (json `visible_when`): the owning field is
340
+ * rendered only when the SIBLING field named by `field` holds a value that
341
+ * matches — either equal to `equals` (exact string) OR a member of `in`
342
+ * (any-of). When both are set `in` wins. Absent = the field is always visible
343
+ * (retrocompat). Evaluated by `evaluateVisibleWhen` against the live form
344
+ * values; a hidden field never gates submit (its required-check is skipped).
345
+ */
346
+ export interface VisibleWhen {
347
+ field: string
348
+ equals?: string
349
+ in?: string[]
350
+ }
351
+
320
352
  // Mirrors `ValidationRule` from packages/sdk/src/generated/manifest.ts. Kept
321
353
  // inline here so runtime-react does not import generated kernel types directly
322
354
  // — apps and addons author ActionFieldDef literals.
@@ -493,6 +525,22 @@ export interface ActionFieldDef {
493
525
  storagePath?: string
494
526
  /** snake_case alias served by the kernel manifest for `storagePath`. */
495
527
  storage_path?: string
528
+ /**
529
+ * Conditional visibility: render this field only when a sibling field's
530
+ * current value matches the predicate. Mirrors the kernel v3
531
+ * `ActionField.visible_when`. Tolerates the camelCase alias. Absent = always
532
+ * visible; a hidden field is skipped by the required-gate so it never blocks
533
+ * submit. See `evaluateVisibleWhen`.
534
+ */
535
+ visible_when?: VisibleWhen
536
+ /** camelCase alias for `visible_when`. */
537
+ visibleWhen?: VisibleWhen
538
+ /**
539
+ * Form-layout membership: the key of the `form_layout` section this field
540
+ * belongs to (kernel PR #230). Absent → the field lands in the default
541
+ * group. See `groupFieldsBySection`.
542
+ */
543
+ section?: string
496
544
  }
497
545
 
498
546
  /**