@cosmicdrift/kumiko-headless 0.202.0 → 0.204.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/package.json +2 -2
- package/src/index.ts +1 -0
- package/src/view-model/edit.ts +14 -0
- package/src/view-model/index.ts +1 -0
- package/src/view-model/types.ts +17 -1
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@cosmicdrift/kumiko-headless",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.204.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.
|
|
39
|
+
"@cosmicdrift/kumiko-framework": "0.204.0",
|
|
40
40
|
"temporal-polyfill": "^0.3.2",
|
|
41
41
|
"zod": "^4.4.3"
|
|
42
42
|
},
|
package/src/index.ts
CHANGED
package/src/view-model/edit.ts
CHANGED
|
@@ -6,6 +6,7 @@ import type {
|
|
|
6
6
|
import {
|
|
7
7
|
evalFieldCondition,
|
|
8
8
|
isExtensionEditSection,
|
|
9
|
+
isFieldsEditSection,
|
|
9
10
|
normalizeEditField,
|
|
10
11
|
parseRefTarget,
|
|
11
12
|
} from "@cosmicdrift/kumiko-framework/ui-types";
|
|
@@ -73,6 +74,19 @@ export function computeEditViewModel<
|
|
|
73
74
|
component: sectionSpec.component,
|
|
74
75
|
};
|
|
75
76
|
}
|
|
77
|
+
if (!isFieldsEditSection(sectionSpec)) {
|
|
78
|
+
// relatedList runs its own query — nothing here to resolve against
|
|
79
|
+
// entity/values, the spec passes through verbatim (fw#2166).
|
|
80
|
+
return {
|
|
81
|
+
kind: "relatedList" as const,
|
|
82
|
+
title: translate(sectionSpec.title),
|
|
83
|
+
query: sectionSpec.query,
|
|
84
|
+
...(sectionSpec.parentParam !== undefined && { parentParam: sectionSpec.parentParam }),
|
|
85
|
+
columns: sectionSpec.columns,
|
|
86
|
+
...(sectionSpec.pageSize !== undefined && { pageSize: sectionSpec.pageSize }),
|
|
87
|
+
...(sectionSpec.rowClick !== undefined && { rowClick: sectionSpec.rowClick }),
|
|
88
|
+
};
|
|
89
|
+
}
|
|
76
90
|
const fields: EditFieldViewModel[] = sectionSpec.fields.map((fieldSpec) => {
|
|
77
91
|
const normalized = normalizeEditField(fieldSpec);
|
|
78
92
|
const fieldDef = entity.fields[normalized.field];
|
package/src/view-model/index.ts
CHANGED
package/src/view-model/types.ts
CHANGED
|
@@ -228,7 +228,10 @@ export type EditFieldViewModel = {
|
|
|
228
228
|
// Discriminated by `kind` — mirrors EditSectionSpec on the engine side.
|
|
229
229
|
// The builder always emits `kind` explicitly (no defaulting), so the
|
|
230
230
|
// renderer narrows with a strict equality check.
|
|
231
|
-
export type EditSectionViewModel =
|
|
231
|
+
export type EditSectionViewModel =
|
|
232
|
+
| EditFieldsSectionViewModel
|
|
233
|
+
| EditExtensionSectionViewModel
|
|
234
|
+
| EditRelatedListSectionViewModel;
|
|
232
235
|
|
|
233
236
|
export type EditFieldsSectionViewModel = {
|
|
234
237
|
readonly kind: "fields";
|
|
@@ -251,6 +254,19 @@ export type EditExtensionSectionViewModel = {
|
|
|
251
254
|
readonly component: PlatformComponent;
|
|
252
255
|
};
|
|
253
256
|
|
|
257
|
+
// Mirrors EditRelatedListSection verbatim — no per-row/query resolution
|
|
258
|
+
// happens in the view-model builder, the renderer's RelatedListSection
|
|
259
|
+
// runs the query itself (fw#2166).
|
|
260
|
+
export type EditRelatedListSectionViewModel = {
|
|
261
|
+
readonly kind: "relatedList";
|
|
262
|
+
readonly title: string;
|
|
263
|
+
readonly query: string;
|
|
264
|
+
readonly parentParam?: string;
|
|
265
|
+
readonly columns: readonly ListColumnSpec[];
|
|
266
|
+
readonly pageSize?: number;
|
|
267
|
+
readonly rowClick?: { readonly entity: string; readonly idColumn?: string };
|
|
268
|
+
};
|
|
269
|
+
|
|
254
270
|
export type EditViewModel = {
|
|
255
271
|
readonly screenId: string;
|
|
256
272
|
readonly entityName: string;
|