@cosmicdrift/kumiko-headless 0.331.0 → 0.333.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.
@@ -84,6 +84,13 @@ function stripUntouchedEmptyStrings(values, initial, forceIncludeEmpty) {
84
84
  function freezeSnapshot(snapshot) {
85
85
  return Object.freeze(snapshot);
86
86
  }
87
+ function omitPayloadFields(payload, omitFields) {
88
+ if (!omitFields || omitFields.length === 0)
89
+ return payload;
90
+ if (typeof payload !== "object" || payload === null || Array.isArray(payload))
91
+ return payload;
92
+ return Object.fromEntries(Object.entries(payload).filter(([key]) => !omitFields.includes(key)));
93
+ }
87
94
  export function createFormController(options) {
88
95
  // Shallow copy so mutating the input after creation doesn't bleed into
89
96
  // the controller's internal state. `initial` stays fixed across the
@@ -340,6 +347,7 @@ export function createFormController(options) {
340
347
  else {
341
348
  payload = stripUntouchedEmptyStrings(submittedValues, submittedSnapshot.initial, forceIncludeEmpty);
342
349
  }
350
+ payload = omitPayloadFields(payload, submitCfg.omitFields);
343
351
  // Only enforced here, right before the write actually happens — a
344
352
  // form that never reaches this point (blocked by validation, or a
345
353
  // clean payloadMode "changes" no-op) must not throw just because no
@@ -53,6 +53,10 @@ export type SubmitConfig<TValues extends FormValues = FormValues> = {
53
53
  * "values" doc for why the stripping exists. Default `true` (current
54
54
  * behavior). Set `false` to send those fields as `""` unchanged. */
55
55
  readonly stripEmptySeeds?: boolean;
56
+ /** Top-level payload keys removed right before dispatch, for fields that
57
+ * are shown or validated but must not reach the write handler. Applied
58
+ * to the built payload only when it is a plain object. */
59
+ readonly omitFields?: readonly string[];
56
60
  readonly buildPayload?: (snapshot: FormSnapshot<TValues>) => unknown;
57
61
  readonly serverFieldPathPrefix?: string;
58
62
  /** Restricts submit()'s internal validate() call to these field names —
@@ -63,6 +63,9 @@ export function computeRelatedListSectionViewModel(sectionSpec, translate) {
63
63
  ...(sectionSpec.facets !== undefined && { facets: sectionSpec.facets }),
64
64
  ...(sectionSpec.rowClick !== undefined && { rowClick: sectionSpec.rowClick }),
65
65
  ...(sectionSpec.rowActions !== undefined && { rowActions: sectionSpec.rowActions }),
66
+ ...(sectionSpec.rowActionMode !== undefined && { rowActionMode: sectionSpec.rowActionMode }),
67
+ ...(sectionSpec.groupBy !== undefined && { groupBy: sectionSpec.groupBy }),
68
+ ...(sectionSpec.rowTone !== undefined && { rowTone: sectionSpec.rowTone }),
66
69
  ...(sectionSpec.toolbarActions !== undefined && { toolbarActions: sectionSpec.toolbarActions }),
67
70
  ...(sectionSpec.actions !== undefined && { actions: sectionSpec.actions }),
68
71
  ...(sectionSpec.emptyState !== undefined && {
@@ -378,6 +381,7 @@ export function computeEditViewModel(input) {
378
381
  ...(sectionSpec.description !== undefined && {
379
382
  description: translate(sectionSpec.description),
380
383
  }),
384
+ ...(sectionSpec.subtitle !== undefined && { subtitle: translate(sectionSpec.subtitle) }),
381
385
  columns: sectionSpec.columns ?? defaultColumns,
382
386
  fields,
383
387
  ...(groups !== undefined && { groups }),
@@ -1,4 +1,4 @@
1
- import type { EditFieldSpec, EditSectionSpec, FieldIconKey, FieldRenderer, IconKey, ListColumnSpec, ListFacetSpec, ListSortSpec, PlatformComponent, RelatedListToolbarAction, RowAction, ScreenSlots, SelectOptionTone } from "@cosmicdrift/kumiko-framework/ui-types";
1
+ import type { EditFieldSpec, EditSectionSpec, FieldIconKey, FieldRenderer, IconKey, ListColumnSpec, ListFacetSpec, ListSortSpec, PlatformComponent, RelatedListGroupBy, RelatedListRowTone, RelatedListToolbarAction, RowAction, RowActionMode, ScreenSlots, SelectOptionTone } from "@cosmicdrift/kumiko-framework/ui-types";
2
2
  export type RuntimeRenderer = (value: unknown, row?: Readonly<Record<string, unknown>>) => string;
3
3
  export type ListColumnViewModel = {
4
4
  readonly field: string;
@@ -221,6 +221,8 @@ export type EditFieldsSectionViewModel = {
221
221
  /** Translated help text under the block heading, from
222
222
  * `EditFieldsSection.description`. Renders even without `title`. */
223
223
  readonly description?: string;
224
+ /** Translated `EditFieldsSection.subtitle` (wizard step rail / up-next box). */
225
+ readonly subtitle?: string;
224
226
  readonly columns: number;
225
227
  readonly fields: readonly EditFieldViewModel[];
226
228
  /** From `EditFieldsSection.groups` — each entry's `fields` are the same
@@ -272,6 +274,9 @@ export type EditRelatedListSectionViewModel = {
272
274
  readonly idColumn?: string;
273
275
  };
274
276
  readonly rowActions?: readonly RowAction[];
277
+ readonly rowActionMode?: RowActionMode;
278
+ readonly groupBy?: RelatedListGroupBy;
279
+ readonly rowTone?: RelatedListRowTone;
275
280
  readonly toolbarActions?: readonly RelatedListToolbarAction[];
276
281
  /** From `EditRelatedListSection.actions` — rendered in the
277
282
  * Section's title row, distinct from `toolbarActions` (which render
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@cosmicdrift/kumiko-headless",
3
- "version": "0.331.0",
3
+ "version": "0.333.0",
4
4
  "description": "Headless UI logic for Kumiko — Dispatcher contract, Form-Controller, View-Model, Nav-Resolver. Plattform- und React-frei; jeder Renderer (renderer, renderer-web, renderer-native, …) komponiert darauf.",
5
5
  "license": "BUSL-1.1",
6
6
  "author": "Marc Frost <marc@cosmicdriftgamestudio.com>",
@@ -36,7 +36,7 @@
36
36
  }
37
37
  },
38
38
  "dependencies": {
39
- "@cosmicdrift/kumiko-framework": "0.331.0",
39
+ "@cosmicdrift/kumiko-framework": "0.333.0",
40
40
  "temporal-polyfill": "^0.3.2",
41
41
  "zod": "^4.4.3"
42
42
  },