@cosmicdrift/kumiko-renderer 0.385.0 → 0.386.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.
@@ -6,6 +6,7 @@ import { useClientActionRuntime } from "../app/client-actions.js";
6
6
  import { ErrorReference } from "../app/error-reference.js";
7
7
  import { buildFilterFacets, buildFilterPayload, mergeReferenceFacetOptions, resolveProjectionFacetSpecs, } from "../app/list-facets.js";
8
8
  import { useNav } from "../app/nav.js";
9
+ import { SYNTHESIZED_FIELD_PII_REASON } from "../app/projection-list-shim.js";
9
10
  import { ReferenceFacetBridges, } from "../app/reference-facet-bridge.js";
10
11
  import { navigateWithReturnTo, useReturnHost } from "../app/return-to.js";
11
12
  import { buildDefaultEditRowAction, buildProjectionRowActions, buildProjectionToolbarActions, buildRecordActions, findRowClickAction, runDrawerRowAction, runProjectionRowNavigate, } from "../app/row-actions.js";
@@ -21,6 +22,9 @@ import { usePrimitives, } from "../primitives.js";
21
22
  import { sortByAccessor } from "../sort-by-accessor.js";
22
23
  import { RenderEditActionButton } from "./render-edit-action-button.js";
23
24
  import { RenderList } from "./render-list.js";
25
+ function isSortableCapable(field) {
26
+ return "sortable" in field;
27
+ }
24
28
  const RELATED_LIST_PSEUDO_ENTITY = "__related-list__";
25
29
  // Minimal EntityDefinition from the section's own columns — same shape as
26
30
  // projection-list-shim's synthesizeProjectionEntity, but sortable is read
@@ -36,11 +40,30 @@ function synthesizeRelatedListEntity(columns, sourceEntity) {
36
40
  const sortable = normalized.sortable === true;
37
41
  const sourceField = sourceEntity?.fields[normalized.field];
38
42
  fields[normalized.field] =
39
- sourceField !== undefined
40
- ? { ...sourceField, sortable }
41
- : { type: normalized.valueType ?? "text", sortable };
43
+ sourceField === undefined
44
+ ? valueTypeField(normalized.valueType, sortable)
45
+ : isSortableCapable(sourceField)
46
+ ? Object.assign({}, sourceField, { sortable })
47
+ : sourceField;
48
+ }
49
+ return {
50
+ fields,
51
+ ...(sourceEntity?.derivedFields !== undefined && { derivedFields: sourceEntity.derivedFields }),
52
+ };
53
+ }
54
+ function valueTypeField(valueType, sortable) {
55
+ switch (valueType) {
56
+ case "number":
57
+ // decimal renders through the same number formatter; digits come from the column spec, not scale
58
+ case "decimal":
59
+ return { type: "number", sortable };
60
+ case "bigInt":
61
+ return { type: "bigInt", sortable };
62
+ case "money":
63
+ return { type: "money", sortable };
64
+ case undefined:
65
+ return { type: "text", allowPlaintext: SYNTHESIZED_FIELD_PII_REASON, sortable };
42
66
  }
43
- return { ...sourceEntity, fields };
44
67
  }
45
68
  // Mirrors row-actions.ts's own warnDrawerActionDropped (module-private
46
69
  // there, so not reusable directly) — a drawer-kind emptyState.action with no
@@ -6,7 +6,7 @@ import { type DataTableDateRangeFacet, type DataTableFacet, type DataTableProps,
6
6
  import { type ListEmptyStateContent } from "./list-empty-state.tsx";
7
7
  export type RenderListProps = {
8
8
  readonly screen: EntityListScreenDefinition;
9
- readonly entity: EntityDefinition;
9
+ readonly entity: Pick<EntityDefinition, "fields" | "derivedFields">;
10
10
  readonly rows: readonly Readonly<Record<string, unknown>>[];
11
11
  readonly featureName: string;
12
12
  readonly translate?: Translate;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@cosmicdrift/kumiko-renderer",
3
- "version": "0.385.0",
3
+ "version": "0.386.0",
4
4
  "description": "React renderer for Kumiko screens. The root export holds the platform-agnostic logic (primitives contract, hooks, KumikoScreen, navigation and SSE abstractions); ./headless the DOM-free UI logic, ./live the HTTP dispatcher, ./web the browser bindings (HTML primitives, history navigation, EventSource live events, createKumikoApp).",
5
5
  "license": "BUSL-1.1",
6
6
  "author": "Marc Frost <marc@cosmicdriftgamestudio.com>",
@@ -48,8 +48,8 @@
48
48
  }
49
49
  },
50
50
  "dependencies": {
51
- "@cosmicdrift/kumiko-framework": "0.385.0",
52
- "@cosmicdrift/kumiko-types": "0.385.0",
51
+ "@cosmicdrift/kumiko-framework": "0.386.0",
52
+ "@cosmicdrift/kumiko-types": "0.386.0",
53
53
  "@radix-ui/react-dialog": "^1.1.15",
54
54
  "@radix-ui/react-dropdown-menu": "^2.1.16",
55
55
  "@radix-ui/react-label": "^2.1.8",
@@ -92,8 +92,8 @@
92
92
  }
93
93
  },
94
94
  "devDependencies": {
95
- "@cosmicdrift/kumiko-locale-de": "0.385.0",
96
- "@cosmicdrift/kumiko-testing": "0.385.0",
95
+ "@cosmicdrift/kumiko-locale-de": "0.386.0",
96
+ "@cosmicdrift/kumiko-testing": "0.386.0",
97
97
  "@tailwindcss/cli": "^4.3.0",
98
98
  "@testing-library/react": "^16.3.2",
99
99
  "@testing-library/user-event": "^14.6.1",