@cohesivesystems/presentation-react-shadcn 0.1.0-alpha.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/LICENSE +55 -0
- package/dist/document-workspace-surface-slot-renderers.d.ts +58 -0
- package/dist/document-workspace-surface-slot-renderers.d.ts.map +1 -0
- package/dist/document-workspace-surface-slot-renderers.js +206 -0
- package/dist/document-workspace-surface-slot-renderers.js.map +1 -0
- package/dist/index.d.ts +53 -0
- package/dist/index.d.ts.map +1 -0
- package/dist/index.js +53 -0
- package/dist/index.js.map +1 -0
- package/dist/navigation-shell-frame-renderer-registry.d.ts +8 -0
- package/dist/navigation-shell-frame-renderer-registry.d.ts.map +1 -0
- package/dist/navigation-shell-frame-renderer-registry.js +2 -0
- package/dist/navigation-shell-frame-renderer-registry.js.map +1 -0
- package/dist/navigation-shell-slot-renderer-registry.d.ts +9 -0
- package/dist/navigation-shell-slot-renderer-registry.d.ts.map +1 -0
- package/dist/navigation-shell-slot-renderer-registry.js +2 -0
- package/dist/navigation-shell-slot-renderer-registry.js.map +1 -0
- package/dist/page-host-unavailable-renderer.d.ts +10 -0
- package/dist/page-host-unavailable-renderer.d.ts.map +1 -0
- package/dist/page-host-unavailable-renderer.js +27 -0
- package/dist/page-host-unavailable-renderer.js.map +1 -0
- package/dist/presentation-action-group.d.ts +99 -0
- package/dist/presentation-action-group.d.ts.map +1 -0
- package/dist/presentation-action-group.js +214 -0
- package/dist/presentation-action-group.js.map +1 -0
- package/dist/presentation-badge-target-interpreter.d.ts +26 -0
- package/dist/presentation-badge-target-interpreter.d.ts.map +1 -0
- package/dist/presentation-badge-target-interpreter.js +17 -0
- package/dist/presentation-badge-target-interpreter.js.map +1 -0
- package/dist/presentation-component-groups.d.ts +968 -0
- package/dist/presentation-component-groups.d.ts.map +1 -0
- package/dist/presentation-component-groups.js +505 -0
- package/dist/presentation-component-groups.js.map +1 -0
- package/dist/presentation-component-system-diagnostics.d.ts +27 -0
- package/dist/presentation-component-system-diagnostics.d.ts.map +1 -0
- package/dist/presentation-component-system-diagnostics.js +399 -0
- package/dist/presentation-component-system-diagnostics.js.map +1 -0
- package/dist/presentation-component-system.d.ts +31 -0
- package/dist/presentation-component-system.d.ts.map +1 -0
- package/dist/presentation-component-system.js +61 -0
- package/dist/presentation-component-system.js.map +1 -0
- package/dist/presentation-icon-diagnostics.d.ts +12 -0
- package/dist/presentation-icon-diagnostics.d.ts.map +1 -0
- package/dist/presentation-icon-diagnostics.js +17 -0
- package/dist/presentation-icon-diagnostics.js.map +1 -0
- package/dist/presentation-icon-registry.d.ts +28 -0
- package/dist/presentation-icon-registry.d.ts.map +1 -0
- package/dist/presentation-icon-registry.js +80 -0
- package/dist/presentation-icon-registry.js.map +1 -0
- package/dist/presentation-projection-trace-panel.d.ts +10 -0
- package/dist/presentation-projection-trace-panel.d.ts.map +1 -0
- package/dist/presentation-projection-trace-panel.js +48 -0
- package/dist/presentation-projection-trace-panel.js.map +1 -0
- package/dist/presentation-routed-surface-host.d.ts +19 -0
- package/dist/presentation-routed-surface-host.d.ts.map +1 -0
- package/dist/presentation-routed-surface-host.js +12 -0
- package/dist/presentation-routed-surface-host.js.map +1 -0
- package/dist/presentation-shadcn-component-system.d.ts +22 -0
- package/dist/presentation-shadcn-component-system.d.ts.map +1 -0
- package/dist/presentation-shadcn-component-system.js +2 -0
- package/dist/presentation-shadcn-component-system.js.map +1 -0
- package/dist/presentation-standard-renderers.d.ts +168 -0
- package/dist/presentation-standard-renderers.d.ts.map +1 -0
- package/dist/presentation-standard-renderers.js +440 -0
- package/dist/presentation-standard-renderers.js.map +1 -0
- package/dist/presentation-surface-renderer.d.ts +23 -0
- package/dist/presentation-surface-renderer.d.ts.map +1 -0
- package/dist/presentation-surface-renderer.js +119 -0
- package/dist/presentation-surface-renderer.js.map +1 -0
- package/dist/presentation-value-renderers.d.ts +10 -0
- package/dist/presentation-value-renderers.d.ts.map +1 -0
- package/dist/presentation-value-renderers.js +14 -0
- package/dist/presentation-value-renderers.js.map +1 -0
- package/dist/process-task-icons.d.ts +49 -0
- package/dist/process-task-icons.d.ts.map +1 -0
- package/dist/process-task-icons.js +154 -0
- package/dist/process-task-icons.js.map +1 -0
- package/dist/projected-activity-state.d.ts +17 -0
- package/dist/projected-activity-state.d.ts.map +1 -0
- package/dist/projected-activity-state.js +22 -0
- package/dist/projected-activity-state.js.map +1 -0
- package/dist/projected-collection-action-runtime-diagnostics.d.ts +4 -0
- package/dist/projected-collection-action-runtime-diagnostics.d.ts.map +1 -0
- package/dist/projected-collection-action-runtime-diagnostics.js +9 -0
- package/dist/projected-collection-action-runtime-diagnostics.js.map +1 -0
- package/dist/projected-collection-view.d.ts +90 -0
- package/dist/projected-collection-view.d.ts.map +1 -0
- package/dist/projected-collection-view.js +532 -0
- package/dist/projected-collection-view.js.map +1 -0
- package/dist/projected-document-action-status-notices.d.ts +15 -0
- package/dist/projected-document-action-status-notices.d.ts.map +1 -0
- package/dist/projected-document-action-status-notices.js +33 -0
- package/dist/projected-document-action-status-notices.js.map +1 -0
- package/dist/projected-document-badges.d.ts +24 -0
- package/dist/projected-document-badges.d.ts.map +1 -0
- package/dist/projected-document-badges.js +53 -0
- package/dist/projected-document-badges.js.map +1 -0
- package/dist/projected-document-editor-surface.d.ts +46 -0
- package/dist/projected-document-editor-surface.d.ts.map +1 -0
- package/dist/projected-document-editor-surface.js +399 -0
- package/dist/projected-document-editor-surface.js.map +1 -0
- package/dist/projected-document-workspace-notices.d.ts +24 -0
- package/dist/projected-document-workspace-notices.d.ts.map +1 -0
- package/dist/projected-document-workspace-notices.js +14 -0
- package/dist/projected-document-workspace-notices.js.map +1 -0
- package/dist/projected-document-workspace-prompt-child-view-registry.d.ts +25 -0
- package/dist/projected-document-workspace-prompt-child-view-registry.d.ts.map +1 -0
- package/dist/projected-document-workspace-prompt-child-view-registry.js +41 -0
- package/dist/projected-document-workspace-prompt-child-view-registry.js.map +1 -0
- package/dist/projected-document-workspace-prompt-child-view-renderers.d.ts +32 -0
- package/dist/projected-document-workspace-prompt-child-view-renderers.d.ts.map +1 -0
- package/dist/projected-document-workspace-prompt-child-view-renderers.js +77 -0
- package/dist/projected-document-workspace-prompt-child-view-renderers.js.map +1 -0
- package/dist/projected-document-workspace-shell.d.ts +100 -0
- package/dist/projected-document-workspace-shell.d.ts.map +1 -0
- package/dist/projected-document-workspace-shell.js +153 -0
- package/dist/projected-document-workspace-shell.js.map +1 -0
- package/dist/projected-document-workspace.d.ts +39 -0
- package/dist/projected-document-workspace.d.ts.map +1 -0
- package/dist/projected-document-workspace.js +63 -0
- package/dist/projected-document-workspace.js.map +1 -0
- package/dist/projected-field-value-rendering.d.ts +94 -0
- package/dist/projected-field-value-rendering.d.ts.map +1 -0
- package/dist/projected-field-value-rendering.js +377 -0
- package/dist/projected-field-value-rendering.js.map +1 -0
- package/dist/projected-inline-list.d.ts +20 -0
- package/dist/projected-inline-list.d.ts.map +1 -0
- package/dist/projected-inline-list.js +149 -0
- package/dist/projected-inline-list.js.map +1 -0
- package/dist/projected-input-form.d.ts +143 -0
- package/dist/projected-input-form.d.ts.map +1 -0
- package/dist/projected-input-form.js +612 -0
- package/dist/projected-input-form.js.map +1 -0
- package/dist/projected-metric-dashboard.d.ts +26 -0
- package/dist/projected-metric-dashboard.d.ts.map +1 -0
- package/dist/projected-metric-dashboard.js +20 -0
- package/dist/projected-metric-dashboard.js.map +1 -0
- package/dist/projected-metric-strip.d.ts +20 -0
- package/dist/projected-metric-strip.d.ts.map +1 -0
- package/dist/projected-metric-strip.js +131 -0
- package/dist/projected-metric-strip.js.map +1 -0
- package/dist/projected-navigation-shell-view-host.d.ts +34 -0
- package/dist/projected-navigation-shell-view-host.d.ts.map +1 -0
- package/dist/projected-navigation-shell-view-host.js +75 -0
- package/dist/projected-navigation-shell-view-host.js.map +1 -0
- package/dist/projected-navigation-shell.d.ts +33 -0
- package/dist/projected-navigation-shell.d.ts.map +1 -0
- package/dist/projected-navigation-shell.js +112 -0
- package/dist/projected-navigation-shell.js.map +1 -0
- package/dist/projected-presentation-badges.d.ts +34 -0
- package/dist/projected-presentation-badges.d.ts.map +1 -0
- package/dist/projected-presentation-badges.js +22 -0
- package/dist/projected-presentation-badges.js.map +1 -0
- package/dist/projected-presentation-diagnostics.d.ts +10 -0
- package/dist/projected-presentation-diagnostics.d.ts.map +1 -0
- package/dist/projected-presentation-diagnostics.js +40 -0
- package/dist/projected-presentation-diagnostics.js.map +1 -0
- package/dist/projected-presentation-flow-layer.d.ts +33 -0
- package/dist/projected-presentation-flow-layer.d.ts.map +1 -0
- package/dist/projected-presentation-flow-layer.js +71 -0
- package/dist/projected-presentation-flow-layer.js.map +1 -0
- package/dist/projected-process-task-notices.d.ts +37 -0
- package/dist/projected-process-task-notices.d.ts.map +1 -0
- package/dist/projected-process-task-notices.js +225 -0
- package/dist/projected-process-task-notices.js.map +1 -0
- package/dist/projected-prompt-child-view-renderer.d.ts +101 -0
- package/dist/projected-prompt-child-view-renderer.d.ts.map +1 -0
- package/dist/projected-prompt-child-view-renderer.js +442 -0
- package/dist/projected-prompt-child-view-renderer.js.map +1 -0
- package/dist/projected-prompt-document-preview.d.ts +39 -0
- package/dist/projected-prompt-document-preview.d.ts.map +1 -0
- package/dist/projected-prompt-document-preview.js +50 -0
- package/dist/projected-prompt-document-preview.js.map +1 -0
- package/dist/projected-prompt-view.d.ts +35 -0
- package/dist/projected-prompt-view.d.ts.map +1 -0
- package/dist/projected-prompt-view.js +292 -0
- package/dist/projected-prompt-view.js.map +1 -0
- package/dist/projected-query-form.d.ts +56 -0
- package/dist/projected-query-form.d.ts.map +1 -0
- package/dist/projected-query-form.js +100 -0
- package/dist/projected-query-form.js.map +1 -0
- package/dist/projected-record-details.d.ts +20 -0
- package/dist/projected-record-details.d.ts.map +1 -0
- package/dist/projected-record-details.js +60 -0
- package/dist/projected-record-details.js.map +1 -0
- package/dist/projected-routed-surface-runtime.d.ts +86 -0
- package/dist/projected-routed-surface-runtime.d.ts.map +1 -0
- package/dist/projected-routed-surface-runtime.js +332 -0
- package/dist/projected-routed-surface-runtime.js.map +1 -0
- package/dist/projected-tabs-view.d.ts +21 -0
- package/dist/projected-tabs-view.d.ts.map +1 -0
- package/dist/projected-tabs-view.js +140 -0
- package/dist/projected-tabs-view.js.map +1 -0
- package/dist/projected-view-chrome.d.ts +15 -0
- package/dist/projected-view-chrome.d.ts.map +1 -0
- package/dist/projected-view-chrome.js +67 -0
- package/dist/projected-view-chrome.js.map +1 -0
- package/dist/projected-view-surface.d.ts +34 -0
- package/dist/projected-view-surface.d.ts.map +1 -0
- package/dist/projected-view-surface.js +40 -0
- package/dist/projected-view-surface.js.map +1 -0
- package/dist/standard-collection-chrome-slot-renderers.d.ts +26 -0
- package/dist/standard-collection-chrome-slot-renderers.d.ts.map +1 -0
- package/dist/standard-collection-chrome-slot-renderers.js +250 -0
- package/dist/standard-collection-chrome-slot-renderers.js.map +1 -0
- package/dist/standard-view-chrome-slot-renderers.d.ts +57 -0
- package/dist/standard-view-chrome-slot-renderers.d.ts.map +1 -0
- package/dist/standard-view-chrome-slot-renderers.js +614 -0
- package/dist/standard-view-chrome-slot-renderers.js.map +1 -0
- package/package.json +68 -0
- package/src/document-workspace-surface-slot-renderers.tsx +395 -0
- package/src/index.ts +53 -0
- package/src/navigation-shell-frame-renderer-registry.ts +29 -0
- package/src/navigation-shell-slot-renderer-registry.ts +46 -0
- package/src/page-host-unavailable-renderer.tsx +79 -0
- package/src/presentation-action-group.tsx +475 -0
- package/src/presentation-badge-target-interpreter.ts +54 -0
- package/src/presentation-component-groups.ts +2505 -0
- package/src/presentation-component-system-diagnostics.ts +848 -0
- package/src/presentation-component-system.ts +365 -0
- package/src/presentation-icon-diagnostics.ts +53 -0
- package/src/presentation-icon-registry.tsx +181 -0
- package/src/presentation-projection-trace-panel.tsx +140 -0
- package/src/presentation-routed-surface-host.tsx +48 -0
- package/src/presentation-shadcn-component-system.ts +102 -0
- package/src/presentation-standard-renderers.tsx +1290 -0
- package/src/presentation-surface-renderer.tsx +263 -0
- package/src/presentation-value-renderers.tsx +40 -0
- package/src/process-task-icons.tsx +258 -0
- package/src/projected-activity-state.tsx +63 -0
- package/src/projected-collection-action-runtime-diagnostics.ts +22 -0
- package/src/projected-collection-view.tsx +1273 -0
- package/src/projected-document-action-status-notices.tsx +66 -0
- package/src/projected-document-badges.tsx +134 -0
- package/src/projected-document-editor-surface.tsx +808 -0
- package/src/projected-document-workspace-notices.tsx +77 -0
- package/src/projected-document-workspace-prompt-child-view-registry.ts +99 -0
- package/src/projected-document-workspace-prompt-child-view-renderers.tsx +205 -0
- package/src/projected-document-workspace-shell.tsx +427 -0
- package/src/projected-document-workspace.tsx +216 -0
- package/src/projected-field-value-rendering.tsx +704 -0
- package/src/projected-inline-list.tsx +434 -0
- package/src/projected-input-form.tsx +1218 -0
- package/src/projected-metric-dashboard.tsx +106 -0
- package/src/projected-metric-strip.tsx +244 -0
- package/src/projected-navigation-shell-view-host.tsx +177 -0
- package/src/projected-navigation-shell.tsx +219 -0
- package/src/projected-presentation-badges.tsx +95 -0
- package/src/projected-presentation-diagnostics.tsx +120 -0
- package/src/projected-presentation-flow-layer.tsx +186 -0
- package/src/projected-process-task-notices.tsx +501 -0
- package/src/projected-prompt-child-view-renderer.tsx +698 -0
- package/src/projected-prompt-document-preview.tsx +197 -0
- package/src/projected-prompt-view.tsx +592 -0
- package/src/projected-query-form.tsx +286 -0
- package/src/projected-record-details.tsx +133 -0
- package/src/projected-routed-surface-runtime.tsx +713 -0
- package/src/projected-tabs-view.tsx +308 -0
- package/src/projected-view-chrome.tsx +148 -0
- package/src/projected-view-surface.tsx +131 -0
- package/src/standard-collection-chrome-slot-renderers.tsx +391 -0
- package/src/standard-view-chrome-slot-renderers.tsx +1064 -0
|
@@ -0,0 +1,94 @@
|
|
|
1
|
+
import type { ReactNode } from 'react';
|
|
2
|
+
import type { FieldPresentationDefinition, NavigationRouteParameters, PresentationModuleDefinition } from '@cohesivesystems/presentation-core';
|
|
3
|
+
import type { PresentationTextBadgeTone } from '@cohesivesystems/presentation-tailwind';
|
|
4
|
+
import type { PresentationShadcnComponentSystem as PresentationComponentSystem } from './presentation-shadcn-component-system.js';
|
|
5
|
+
/**
|
|
6
|
+
* Runtime inputs required to render a projected field value through the
|
|
7
|
+
* shadcn-oriented presentation component system.
|
|
8
|
+
*/
|
|
9
|
+
export interface ProjectedFieldValueRenderContext {
|
|
10
|
+
/** Component-system implementation used for scalar, code, JSON, and composite field value chrome. */
|
|
11
|
+
readonly componentSystem: PresentationComponentSystem;
|
|
12
|
+
/** Optional route-to-href adapter used when entity-reference fields declare navigation bindings. */
|
|
13
|
+
readonly createHref?: ((routeId: string, parameters?: NavigationRouteParameters) => string | null) | undefined;
|
|
14
|
+
/** Fallback node used when the value is absent and the field has no modeled empty-value label. */
|
|
15
|
+
readonly emptyValueFallback: ReactNode;
|
|
16
|
+
/** Presentation field definition that declares display kind, formatting, fallbacks, badges, and navigation. */
|
|
17
|
+
readonly field: FieldPresentationDefinition;
|
|
18
|
+
/** Optional caller formatter for values that need host-specific text or node rendering. */
|
|
19
|
+
readonly formatValue?: (context: ProjectedFieldValueFormatContext) => ReactNode;
|
|
20
|
+
/** Presentation module fragment used to resolve target bindings and icon definitions. */
|
|
21
|
+
readonly module: Pick<PresentationModuleDefinition, 'Targets'> | null;
|
|
22
|
+
/** Optional navigation callback invoked for resolved entity-reference links. */
|
|
23
|
+
readonly navigateHref?: (href: string) => void;
|
|
24
|
+
/** Current resource object that field paths, supporting values, and navigation bindings read from. */
|
|
25
|
+
readonly resource: unknown;
|
|
26
|
+
/** Default rendering style for entity references that do not resolve to a navigation binding. */
|
|
27
|
+
readonly unboundEntityReferenceStyle?: 'badge' | 'code';
|
|
28
|
+
/** Raw field value supplied by the caller before display fallbacks are applied. */
|
|
29
|
+
readonly value: unknown;
|
|
30
|
+
}
|
|
31
|
+
/**
|
|
32
|
+
* Value formatting context passed to host-provided field value formatters.
|
|
33
|
+
*/
|
|
34
|
+
export interface ProjectedFieldValueFormatContext {
|
|
35
|
+
/** Presentation field definition associated with the value being formatted. */
|
|
36
|
+
readonly field: FieldPresentationDefinition;
|
|
37
|
+
/** Resource object that owns the rendered field. */
|
|
38
|
+
readonly resource: unknown;
|
|
39
|
+
/** Field value after display fallback resolution. */
|
|
40
|
+
readonly value: unknown;
|
|
41
|
+
}
|
|
42
|
+
/**
|
|
43
|
+
* Renders a projected presentation field value as React content.
|
|
44
|
+
*
|
|
45
|
+
* The renderer applies modeled display fallbacks, supporting values, inline
|
|
46
|
+
* badges, entity-reference navigation bindings, value labels, tones, icons,
|
|
47
|
+
* and scalar formatting before delegating chrome to the component system.
|
|
48
|
+
*/
|
|
49
|
+
export declare function renderProjectedFieldValue({ componentSystem, createHref, emptyValueFallback, field, formatValue, module, navigateHref, resource, unboundEntityReferenceStyle, value, }: ProjectedFieldValueRenderContext): string | number | bigint | boolean | Iterable<ReactNode> | Promise<string | number | bigint | boolean | import("react").ReactPortal | import("react").ReactElement<unknown, string | import("react").JSXElementConstructor<any>> | Iterable<ReactNode> | null | undefined> | import("react/jsx-runtime").JSX.Element | null | undefined;
|
|
50
|
+
/**
|
|
51
|
+
* Returns whether the standard shadcn field-value renderer understands the
|
|
52
|
+
* supplied field's modeled display semantics.
|
|
53
|
+
*/
|
|
54
|
+
export declare function canRenderProjectedFieldValue(field: FieldPresentationDefinition): boolean;
|
|
55
|
+
/**
|
|
56
|
+
* Runtime inputs for rendering a projected entity-reference field value.
|
|
57
|
+
*/
|
|
58
|
+
export interface ProjectedEntityReferenceValueRenderContext {
|
|
59
|
+
/** Component-system implementation used for fallback code, text, and badge rendering. */
|
|
60
|
+
readonly componentSystem: PresentationComponentSystem;
|
|
61
|
+
/** Optional route-to-href adapter used to resolve modeled navigation bindings. */
|
|
62
|
+
readonly createHref?: ((routeId: string, parameters?: NavigationRouteParameters) => string | null) | undefined;
|
|
63
|
+
/** Entity-reference field definition. */
|
|
64
|
+
readonly field: FieldPresentationDefinition;
|
|
65
|
+
/** Presentation module fragment containing target bindings used by navigation projection. */
|
|
66
|
+
readonly module: Pick<PresentationModuleDefinition, 'Targets'> | null;
|
|
67
|
+
/** Optional callback invoked when a resolved entity-reference link is activated. */
|
|
68
|
+
readonly navigateHref?: (href: string) => void;
|
|
69
|
+
/** Resource object that owns the entity-reference value. */
|
|
70
|
+
readonly resource: unknown;
|
|
71
|
+
/** Caller fallback style used when the field does not declare its own fallback style. */
|
|
72
|
+
readonly unboundEntityReferenceStyle: 'badge' | 'code';
|
|
73
|
+
/** Entity-reference scalar value to render. */
|
|
74
|
+
readonly value: unknown;
|
|
75
|
+
}
|
|
76
|
+
/**
|
|
77
|
+
* Renders an entity-reference field as a navigation badge when the modeled
|
|
78
|
+
* binding resolves, or as the field's configured fallback style otherwise.
|
|
79
|
+
*/
|
|
80
|
+
export declare function renderProjectedEntityReferenceValue({ componentSystem, createHref, field, module, navigateHref, resource, unboundEntityReferenceStyle: fallbackStyle, value, }: ProjectedEntityReferenceValueRenderContext): import("react/jsx-runtime").JSX.Element | null;
|
|
81
|
+
/**
|
|
82
|
+
* Resolves the visual tone for a projected field value badge or scalar chip.
|
|
83
|
+
*
|
|
84
|
+
* Value-specific tone rules take precedence over the field's general design
|
|
85
|
+
* tone, and the result is coerced into the shadcn badge tone set.
|
|
86
|
+
*/
|
|
87
|
+
export declare function resolveProjectedFieldBadgeTone(field: FieldPresentationDefinition, resource?: unknown, value?: unknown): PresentationTextBadgeTone;
|
|
88
|
+
/**
|
|
89
|
+
* Resolves the fallback rendering style declared for an entity-reference field.
|
|
90
|
+
*
|
|
91
|
+
* Returns `null` when the field leaves fallback style selection to the caller.
|
|
92
|
+
*/
|
|
93
|
+
export declare function resolveProjectedEntityReferenceFallbackStyle(field: FieldPresentationDefinition): 'badge' | 'code' | 'text' | null;
|
|
94
|
+
//# sourceMappingURL=projected-field-value-rendering.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"projected-field-value-rendering.d.ts","sourceRoot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e,EACf,UAAU,EACV,KAAK,EACL,MAAM,EACN,YAAY,EACZ,QAAQ,EACR,2BAA2B,EAAE,aAAa,EAC1C,KAAK,GACN,EAAE,0CAA0C,kDAwC5C;AAED;;;;;GAKG;AACH,wBAAgB,8BAA8B,CAC5C,KAAK,EAAE,2BAA2B,EAClC,QAAQ,CAAC,EAAE,OAAO,EAClB,KAAK,CAAC,EAAE,OAAO,GACd,yBAAyB,CAO3B;AA4DD;;;;GAIG;AACH,wBAAgB,4CAA4C,CAC1D,KAAK,EAAE,2BAA2B,GACjC,OAAO,GAAG,MAAM,GAAG,MAAM,GAAG,IAAI,CAelC"}
|
|
@@ -0,0 +1,377 @@
|
|
|
1
|
+
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
2
|
+
import { ResourceLinkBadge, TextBadge, } from './projected-document-badges.js';
|
|
3
|
+
import { resolvePresentationFieldValueLabel, resolvePresentationFieldValueIcon, resolvePresentationFieldValueTone, } from '@cohesivesystems/presentation-core';
|
|
4
|
+
import { renderPresentationIcon, } from './presentation-icon-registry.js';
|
|
5
|
+
import { formatBadgeValue } from '@cohesivesystems/presentation-core';
|
|
6
|
+
import { projectDocumentFieldNavigationBinding, } from '@cohesivesystems/presentation-core';
|
|
7
|
+
import { readObjectPath, } from '@cohesivesystems/presentation-core';
|
|
8
|
+
import { isProjectedDocumentBadgeField, isProjectedDocumentEntityReferenceField, matchesFieldDisplayKind, } from '@cohesivesystems/presentation-core';
|
|
9
|
+
import { fieldEntityReferenceFallbackKinds, fieldDisplayKinds, fieldJsonDisplayModes, formatKinds, } from '@cohesivesystems/presentation-contracts';
|
|
10
|
+
/**
|
|
11
|
+
* Renders a projected presentation field value as React content.
|
|
12
|
+
*
|
|
13
|
+
* The renderer applies modeled display fallbacks, supporting values, inline
|
|
14
|
+
* badges, entity-reference navigation bindings, value labels, tones, icons,
|
|
15
|
+
* and scalar formatting before delegating chrome to the component system.
|
|
16
|
+
*/
|
|
17
|
+
export function renderProjectedFieldValue({ componentSystem, createHref, emptyValueFallback, field, formatValue, module, navigateHref, resource, unboundEntityReferenceStyle = 'code', value, }) {
|
|
18
|
+
const displayValue = resolveProjectedDisplayValue(field, resource, value);
|
|
19
|
+
const supportingValues = readProjectedSupportingFieldValues(field, resource);
|
|
20
|
+
const inlineBadges = renderProjectedInlineBadges(componentSystem, field, resource);
|
|
21
|
+
if (isAbsentValue(displayValue)) {
|
|
22
|
+
if (supportingValues.length > 0 || inlineBadges.length > 0) {
|
|
23
|
+
return renderProjectedCompositeValue({
|
|
24
|
+
componentSystem,
|
|
25
|
+
inlineBadges,
|
|
26
|
+
primaryValue: null,
|
|
27
|
+
supportingValues,
|
|
28
|
+
});
|
|
29
|
+
}
|
|
30
|
+
return renderEmptyValueFallback(componentSystem, field, emptyValueFallback);
|
|
31
|
+
}
|
|
32
|
+
const primaryValue = renderProjectedFieldPrimaryValue({
|
|
33
|
+
componentSystem,
|
|
34
|
+
createHref,
|
|
35
|
+
field,
|
|
36
|
+
formatValue,
|
|
37
|
+
module,
|
|
38
|
+
navigateHref,
|
|
39
|
+
resource,
|
|
40
|
+
unboundEntityReferenceStyle,
|
|
41
|
+
value: displayValue,
|
|
42
|
+
});
|
|
43
|
+
return supportingValues.length > 0 || inlineBadges.length > 0
|
|
44
|
+
? renderProjectedCompositeValue({
|
|
45
|
+
componentSystem,
|
|
46
|
+
inlineBadges,
|
|
47
|
+
primaryValue,
|
|
48
|
+
supportingValues,
|
|
49
|
+
})
|
|
50
|
+
: primaryValue;
|
|
51
|
+
}
|
|
52
|
+
function renderProjectedFieldPrimaryValue({ componentSystem, createHref, field, formatValue, module, navigateHref, resource, unboundEntityReferenceStyle = 'code', value, }) {
|
|
53
|
+
if (isProjectedDocumentEntityReferenceField(field)) {
|
|
54
|
+
return renderProjectedEntityReferenceValue({
|
|
55
|
+
componentSystem,
|
|
56
|
+
createHref,
|
|
57
|
+
field,
|
|
58
|
+
module,
|
|
59
|
+
navigateHref,
|
|
60
|
+
resource,
|
|
61
|
+
unboundEntityReferenceStyle,
|
|
62
|
+
value,
|
|
63
|
+
});
|
|
64
|
+
}
|
|
65
|
+
if (matchesFieldDisplayKind(field, fieldDisplayKinds.code, 'Code')) {
|
|
66
|
+
return renderCodeValue(componentSystem, formatProjectedScalarValue(value, field, resource));
|
|
67
|
+
}
|
|
68
|
+
if (isProjectedDocumentBadgeField(field)) {
|
|
69
|
+
const text = formatValue?.({ field, resource, value }) ??
|
|
70
|
+
formatProjectedScalarValue(value, field, resource);
|
|
71
|
+
const icon = renderProjectedFieldValueIcon({ field, module, value });
|
|
72
|
+
return (_jsx(TextBadge, { componentSystem: componentSystem, tone: resolveProjectedFieldBadgeTone(field, resource, value), children: icon ? (_jsxs("span", { className: "inline-flex min-w-0 items-center gap-1", children: [icon, _jsx("span", { className: "truncate", children: text })] })) : text }));
|
|
73
|
+
}
|
|
74
|
+
if (matchesFieldDisplayKind(field, fieldDisplayKinds.date, 'Date') ||
|
|
75
|
+
matchesFieldDisplayKind(field, fieldDisplayKinds.dateTime, 'DateTime')) {
|
|
76
|
+
return formatProjectedDateTime(componentSystem, String(value), field);
|
|
77
|
+
}
|
|
78
|
+
if (matchesFieldDisplayKind(field, fieldDisplayKinds.boolean, 'Boolean')) {
|
|
79
|
+
return renderScalarValue(componentSystem, value ? 'Yes' : 'No', {
|
|
80
|
+
tone: resolveProjectedFieldBadgeTone(field, resource),
|
|
81
|
+
});
|
|
82
|
+
}
|
|
83
|
+
if (matchesFieldDisplayKind(field, fieldDisplayKinds.json, 'Json')) {
|
|
84
|
+
return renderJsonValue(componentSystem, value, field, resource);
|
|
85
|
+
}
|
|
86
|
+
return renderScalarValue(componentSystem, formatProjectedScalarValue(value, field, resource), {
|
|
87
|
+
tone: resolveProjectedFieldBadgeTone(field, resource),
|
|
88
|
+
});
|
|
89
|
+
}
|
|
90
|
+
/**
|
|
91
|
+
* Returns whether the standard shadcn field-value renderer understands the
|
|
92
|
+
* supplied field's modeled display semantics.
|
|
93
|
+
*/
|
|
94
|
+
export function canRenderProjectedFieldValue(field) {
|
|
95
|
+
return isProjectedDocumentEntityReferenceField(field) ||
|
|
96
|
+
isProjectedDocumentBadgeField(field) ||
|
|
97
|
+
matchesFieldDisplayKind(field, fieldDisplayKinds.code, 'Code') ||
|
|
98
|
+
matchesFieldDisplayKind(field, fieldDisplayKinds.date, 'Date') ||
|
|
99
|
+
matchesFieldDisplayKind(field, fieldDisplayKinds.dateTime, 'DateTime') ||
|
|
100
|
+
matchesFieldDisplayKind(field, fieldDisplayKinds.boolean, 'Boolean') ||
|
|
101
|
+
matchesFieldDisplayKind(field, fieldDisplayKinds.json, 'Json') ||
|
|
102
|
+
matchesFieldDisplayKind(field, fieldDisplayKinds.text, 'Text') ||
|
|
103
|
+
matchesFieldDisplayKind(field, fieldDisplayKinds.number, 'Number');
|
|
104
|
+
}
|
|
105
|
+
/**
|
|
106
|
+
* Renders an entity-reference field as a navigation badge when the modeled
|
|
107
|
+
* binding resolves, or as the field's configured fallback style otherwise.
|
|
108
|
+
*/
|
|
109
|
+
export function renderProjectedEntityReferenceValue({ componentSystem, createHref, field, module, navigateHref, resource, unboundEntityReferenceStyle: fallbackStyle, value, }) {
|
|
110
|
+
const unboundEntityReferenceStyle = resolveProjectedEntityReferenceFallbackStyle(field) ?? fallbackStyle;
|
|
111
|
+
const binding = projectDocumentFieldNavigationBinding({
|
|
112
|
+
createHref,
|
|
113
|
+
field,
|
|
114
|
+
module,
|
|
115
|
+
resource,
|
|
116
|
+
value,
|
|
117
|
+
});
|
|
118
|
+
const label = binding?.label ?? formatProjectedScalarValue(value, field, resource);
|
|
119
|
+
if (!label) {
|
|
120
|
+
return null;
|
|
121
|
+
}
|
|
122
|
+
if (binding && navigateHref) {
|
|
123
|
+
return (_jsx(ResourceLinkBadge, { componentSystem: componentSystem, disabled: !binding.href, label: binding.label, onClick: () => {
|
|
124
|
+
if (binding.href) {
|
|
125
|
+
navigateHref(binding.href);
|
|
126
|
+
}
|
|
127
|
+
}, prefix: binding.prefix }));
|
|
128
|
+
}
|
|
129
|
+
if (unboundEntityReferenceStyle === 'badge') {
|
|
130
|
+
return _jsx(TextBadge, { componentSystem: componentSystem, tone: "sky", children: label });
|
|
131
|
+
}
|
|
132
|
+
if (unboundEntityReferenceStyle === 'text') {
|
|
133
|
+
return _jsx("span", { className: "wrap-break-word", children: label });
|
|
134
|
+
}
|
|
135
|
+
return renderCodeValue(componentSystem, label);
|
|
136
|
+
}
|
|
137
|
+
/**
|
|
138
|
+
* Resolves the visual tone for a projected field value badge or scalar chip.
|
|
139
|
+
*
|
|
140
|
+
* Value-specific tone rules take precedence over the field's general design
|
|
141
|
+
* tone, and the result is coerced into the shadcn badge tone set.
|
|
142
|
+
*/
|
|
143
|
+
export function resolveProjectedFieldBadgeTone(field, resource, value) {
|
|
144
|
+
const fieldValue = value ?? resolveFieldValue(field, resource);
|
|
145
|
+
return coerceProjectedTextBadgeTone(resolvePresentationFieldValueTone(field, fieldValue, resource) ??
|
|
146
|
+
field.Design?.Tone);
|
|
147
|
+
}
|
|
148
|
+
function renderProjectedFieldValueIcon({ field, module, value, }) {
|
|
149
|
+
const icon = resolvePresentationFieldValueIcon(field, value);
|
|
150
|
+
if (!icon) {
|
|
151
|
+
return null;
|
|
152
|
+
}
|
|
153
|
+
return renderPresentationIcon({
|
|
154
|
+
className: 'size-3 shrink-0',
|
|
155
|
+
icon,
|
|
156
|
+
module,
|
|
157
|
+
});
|
|
158
|
+
}
|
|
159
|
+
function coerceProjectedTextBadgeTone(tone) {
|
|
160
|
+
switch (tone?.toLocaleLowerCase()) {
|
|
161
|
+
case 'accent':
|
|
162
|
+
case 'primary':
|
|
163
|
+
case 'violet':
|
|
164
|
+
return 'violet';
|
|
165
|
+
case 'amber':
|
|
166
|
+
case 'warning':
|
|
167
|
+
return 'amber';
|
|
168
|
+
case 'danger':
|
|
169
|
+
case 'error':
|
|
170
|
+
case 'red':
|
|
171
|
+
return 'red';
|
|
172
|
+
case 'info':
|
|
173
|
+
case 'sky':
|
|
174
|
+
return 'sky';
|
|
175
|
+
case 'success':
|
|
176
|
+
case 'teal':
|
|
177
|
+
return 'teal';
|
|
178
|
+
default:
|
|
179
|
+
return 'slate';
|
|
180
|
+
}
|
|
181
|
+
}
|
|
182
|
+
function renderEmptyValueFallback(componentSystem, field, fallback) {
|
|
183
|
+
if (!field.Display?.EmptyValueLabel) {
|
|
184
|
+
return fallback;
|
|
185
|
+
}
|
|
186
|
+
const FieldValueEmpty = componentSystem.fieldValues.FieldValueEmpty;
|
|
187
|
+
return _jsx(FieldValueEmpty, { label: field.Display.EmptyValueLabel });
|
|
188
|
+
}
|
|
189
|
+
/**
|
|
190
|
+
* Resolves the fallback rendering style declared for an entity-reference field.
|
|
191
|
+
*
|
|
192
|
+
* Returns `null` when the field leaves fallback style selection to the caller.
|
|
193
|
+
*/
|
|
194
|
+
export function resolveProjectedEntityReferenceFallbackStyle(field) {
|
|
195
|
+
const fallback = field.Display?.EntityReferenceFallback;
|
|
196
|
+
if (fallback === null || fallback === undefined) {
|
|
197
|
+
return null;
|
|
198
|
+
}
|
|
199
|
+
if (matchesGeneratedEnum(fallback, fieldEntityReferenceFallbackKinds.badge, 'Badge')) {
|
|
200
|
+
return 'badge';
|
|
201
|
+
}
|
|
202
|
+
if (matchesGeneratedEnum(fallback, fieldEntityReferenceFallbackKinds.text, 'Text')) {
|
|
203
|
+
return 'text';
|
|
204
|
+
}
|
|
205
|
+
return 'code';
|
|
206
|
+
}
|
|
207
|
+
function renderCodeValue(componentSystem, value) {
|
|
208
|
+
const FieldValueCode = componentSystem.fieldValues.FieldValueCode;
|
|
209
|
+
return _jsx(FieldValueCode, { value: value });
|
|
210
|
+
}
|
|
211
|
+
function resolveProjectedDisplayValue(field, resource, value) {
|
|
212
|
+
if (!isAbsentValue(value)) {
|
|
213
|
+
return value;
|
|
214
|
+
}
|
|
215
|
+
for (const fallbackFieldPath of field.Display?.FallbackFieldPaths ?? []) {
|
|
216
|
+
const fallbackValue = readObjectPath(resource, fallbackFieldPath);
|
|
217
|
+
if (!isAbsentValue(fallbackValue)) {
|
|
218
|
+
return fallbackValue;
|
|
219
|
+
}
|
|
220
|
+
}
|
|
221
|
+
return value;
|
|
222
|
+
}
|
|
223
|
+
function readProjectedSupportingFieldValues(field, resource) {
|
|
224
|
+
const pathValues = (field.Display?.SupportingFieldPaths ?? []).flatMap((fieldPath) => {
|
|
225
|
+
const value = readObjectPath(resource, fieldPath);
|
|
226
|
+
if (isAbsentValue(value)) {
|
|
227
|
+
return [];
|
|
228
|
+
}
|
|
229
|
+
const label = formatProjectedSupportingValue(value);
|
|
230
|
+
return label ? [label] : [];
|
|
231
|
+
});
|
|
232
|
+
const definedValues = (field.Display?.SupportingValues ?? []).flatMap((definition) => {
|
|
233
|
+
const value = readObjectPath(resource, definition.FieldPath);
|
|
234
|
+
if (isAbsentValue(value)) {
|
|
235
|
+
return [];
|
|
236
|
+
}
|
|
237
|
+
const label = formatProjectedSupportingValue(value, definition.Separator ?? undefined);
|
|
238
|
+
return label
|
|
239
|
+
? [`${definition.Prefix ?? ''}${label}${definition.Suffix ?? ''}`]
|
|
240
|
+
: [];
|
|
241
|
+
});
|
|
242
|
+
return [...pathValues, ...definedValues];
|
|
243
|
+
}
|
|
244
|
+
function renderProjectedCompositeValue({ componentSystem, inlineBadges, primaryValue, supportingValues, }) {
|
|
245
|
+
const FieldValueComposite = componentSystem.fieldValues.FieldValueComposite;
|
|
246
|
+
const FieldValueSupportingValue = componentSystem.fieldValues.FieldValueSupportingValue;
|
|
247
|
+
return (_jsx(FieldValueComposite, { inlineBadges: inlineBadges, primaryValue: primaryValue, supportingValues: supportingValues.map((value, index) => (_jsx(FieldValueSupportingValue, { children: value }, `${value}:${index}`))) }));
|
|
248
|
+
}
|
|
249
|
+
function renderProjectedInlineBadges(componentSystem, field, resource) {
|
|
250
|
+
return (field.Display?.InlineBadges ?? []).flatMap((badge) => {
|
|
251
|
+
const value = readObjectPath(resource, badge.FieldPath);
|
|
252
|
+
if (isAbsentValue(value)) {
|
|
253
|
+
return [];
|
|
254
|
+
}
|
|
255
|
+
const label = formatProjectedSupportingValue(value);
|
|
256
|
+
if (!label) {
|
|
257
|
+
return [];
|
|
258
|
+
}
|
|
259
|
+
const tone = badge.ToneFieldPath
|
|
260
|
+
? readOptionalString(readObjectPath(resource, badge.ToneFieldPath))
|
|
261
|
+
: null;
|
|
262
|
+
return [
|
|
263
|
+
_jsx(TextBadge, { componentSystem: componentSystem, tone: coerceProjectedTextBadgeTone(tone ?? badge.Tone), children: label }, badge.FieldPath),
|
|
264
|
+
];
|
|
265
|
+
});
|
|
266
|
+
}
|
|
267
|
+
function formatProjectedSupportingValue(value, separator = ', ') {
|
|
268
|
+
if (Array.isArray(value)) {
|
|
269
|
+
const items = value
|
|
270
|
+
.map((item) => formatProjectedSupportingValue(item, separator))
|
|
271
|
+
.filter((item) => Boolean(item));
|
|
272
|
+
return items.length > 0 ? items.join(separator) : null;
|
|
273
|
+
}
|
|
274
|
+
const scalarValue = formatBadgeValue(value);
|
|
275
|
+
if (scalarValue !== null) {
|
|
276
|
+
return scalarValue;
|
|
277
|
+
}
|
|
278
|
+
try {
|
|
279
|
+
return JSON.stringify(value);
|
|
280
|
+
}
|
|
281
|
+
catch {
|
|
282
|
+
return String(value);
|
|
283
|
+
}
|
|
284
|
+
}
|
|
285
|
+
function formatProjectedScalarValue(value, field, resource) {
|
|
286
|
+
const label = readFirstDisplayFieldPathValue(field.Display?.LabelFieldPaths, resource) ??
|
|
287
|
+
resolvePresentationFieldValueLabel(field, value) ??
|
|
288
|
+
formatBadgeValue(value);
|
|
289
|
+
if (label === null || label === undefined) {
|
|
290
|
+
return String(value);
|
|
291
|
+
}
|
|
292
|
+
return field.Display?.ValuePrefix
|
|
293
|
+
? `${field.Display.ValuePrefix}${label}`
|
|
294
|
+
: label;
|
|
295
|
+
}
|
|
296
|
+
function readFirstDisplayFieldPathValue(fieldPaths, resource) {
|
|
297
|
+
if (!resource) {
|
|
298
|
+
return null;
|
|
299
|
+
}
|
|
300
|
+
for (const fieldPath of fieldPaths ?? []) {
|
|
301
|
+
const value = readObjectPath(resource, fieldPath);
|
|
302
|
+
if (!isAbsentValue(value)) {
|
|
303
|
+
return formatProjectedSupportingValue(value);
|
|
304
|
+
}
|
|
305
|
+
}
|
|
306
|
+
return null;
|
|
307
|
+
}
|
|
308
|
+
function isAbsentValue(value) {
|
|
309
|
+
return value === null || value === undefined || value === '';
|
|
310
|
+
}
|
|
311
|
+
function resolveFieldValue(field, resource) {
|
|
312
|
+
return readObjectPath(resource, field.Field);
|
|
313
|
+
}
|
|
314
|
+
function renderJsonValue(componentSystem, value, field, resource) {
|
|
315
|
+
const formattedValue = JSON.stringify(value) ?? String(value);
|
|
316
|
+
if (matchesGeneratedEnum(field.Display?.JsonMode, fieldJsonDisplayModes.inline, 'Inline')) {
|
|
317
|
+
return renderScalarValue(componentSystem, formattedValue, {
|
|
318
|
+
tone: resolveProjectedFieldBadgeTone(field, resource),
|
|
319
|
+
});
|
|
320
|
+
}
|
|
321
|
+
const tone = resolveProjectedFieldBadgeTone(field, resource);
|
|
322
|
+
const FieldValueJson = componentSystem.fieldValues.FieldValueJson;
|
|
323
|
+
return (_jsx(FieldValueJson, { formattedValue: JSON.stringify(value, null, 2) ?? String(value), tone: tone }));
|
|
324
|
+
}
|
|
325
|
+
function renderScalarValue(componentSystem, value, options = {}) {
|
|
326
|
+
const FieldValueScalar = componentSystem.fieldValues.FieldValueScalar;
|
|
327
|
+
return (_jsx(FieldValueScalar, { title: options.title, tone: options.tone, children: value }));
|
|
328
|
+
}
|
|
329
|
+
function formatProjectedDateTime(componentSystem, value, field) {
|
|
330
|
+
const parsed = new Date(value);
|
|
331
|
+
if (Number.isNaN(parsed.getTime())) {
|
|
332
|
+
return renderScalarValue(componentSystem, value);
|
|
333
|
+
}
|
|
334
|
+
const text = formatDateTimeValue(parsed, field);
|
|
335
|
+
return renderScalarValue(componentSystem, text, { title: value });
|
|
336
|
+
}
|
|
337
|
+
function formatDateTimeValue(value, field) {
|
|
338
|
+
if (field.Format?.Pattern === 'iso') {
|
|
339
|
+
return value.toISOString();
|
|
340
|
+
}
|
|
341
|
+
const options = {
|
|
342
|
+
dateStyle: 'medium',
|
|
343
|
+
};
|
|
344
|
+
const formatKind = field.Format?.Kind;
|
|
345
|
+
const dateOnly = matchesGeneratedEnum(formatKind, formatKinds.date, 'Date') ||
|
|
346
|
+
matchesFieldDisplayKind(field, fieldDisplayKinds.date, 'Date');
|
|
347
|
+
const timeZone = normalizeTimeZone(field.Format?.TimeZone);
|
|
348
|
+
if (!dateOnly) {
|
|
349
|
+
options.timeStyle = 'short';
|
|
350
|
+
}
|
|
351
|
+
if (timeZone) {
|
|
352
|
+
options.timeZone = timeZone;
|
|
353
|
+
}
|
|
354
|
+
try {
|
|
355
|
+
return new Intl.DateTimeFormat(undefined, options).format(value);
|
|
356
|
+
}
|
|
357
|
+
catch {
|
|
358
|
+
return dateOnly
|
|
359
|
+
? value.toLocaleDateString()
|
|
360
|
+
: value.toLocaleString();
|
|
361
|
+
}
|
|
362
|
+
}
|
|
363
|
+
function normalizeTimeZone(value) {
|
|
364
|
+
if (!value) {
|
|
365
|
+
return undefined;
|
|
366
|
+
}
|
|
367
|
+
return value.toLocaleLowerCase() === 'utc' ? 'UTC' : value;
|
|
368
|
+
}
|
|
369
|
+
function matchesGeneratedEnum(value, numericValue, label) {
|
|
370
|
+
return value === numericValue ||
|
|
371
|
+
String(value) === String(numericValue) ||
|
|
372
|
+
value?.toString().toLocaleLowerCase() === label.toLocaleLowerCase();
|
|
373
|
+
}
|
|
374
|
+
function readOptionalString(value) {
|
|
375
|
+
return typeof value === 'string' && value.length > 0 ? value : null;
|
|
376
|
+
}
|
|
377
|
+
//# sourceMappingURL=projected-field-value-rendering.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"projected-field-value-rendering.js","sourceRoot":"","sources":["../src/projected-field-value-rendering.tsx"],"names":[],"mappings":";AAOA,O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SAAS,EAAE,OAAO,CAAC,CAAC,MAAM,CAAC,KAAK,CAAC,CAAA;IAClE,CAAC;IAAC,MAAM,CAAC;QACP,OAAO,QAAQ;YACb,CAAC,CAAC,KAAK,CAAC,kBAAkB,EAAE;YAC5B,CAAC,CAAC,KAAK,CAAC,cAAc,EAAE,CAAA;IAC5B,CAAC;AACH,CAAC;AAED,SAAS,iBAAiB,CAAC,KAAgC;IACzD,IAAI,CAAC,KAAK,EAAE,CAAC;QACX,OAAO,SAAS,CAAA;IAClB,CAAC;IAED,OAAO,KAAK,CAAC,iBAAiB,EAAE,KAAK,KAAK,CAAC,CAAC,CAAC,KAAK,CAAC,CAAC,CAAC,KAAK,CAAA;AAC5D,CAAC;AAED,SAAS,oBAAoB,CAC3B,KAAyC,EACzC,YAA6B,EAC7B,KAAa;IAEb,OAAO,KAAK,KAAK,YAAY;QAC3B,MAAM,CAAC,KAAK,CAAC,KAAK,MAAM,CAAC,YAAY,CAAC;QACtC,KAAK,EAAE,QAAQ,EAAE,CAAC,iBAAiB,EAAE,KAAK,KAAK,CAAC,iBAAiB,EAAE,CAAA;AACvE,CAAC;AAED,SAAS,kBAAkB,CAAC,KAAc;IACxC,OAAO,OAAO,KAAK,KAAK,QAAQ,IAAI,KAAK,CAAC,MAAM,GAAG,CAAC,CAAC,CAAC,CAAC,KAAK,CAAC,CAAC,CAAC,IAAI,CAAA;AACrE,CAAC"}
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
import { type ReactNode } from 'react';
|
|
2
|
+
import { type NavigationRouteParameters, type PresentationActionRuntimeBinding, type ProjectedCollectionActionExecutionContext } from '@cohesivesystems/presentation-core';
|
|
3
|
+
import type { PresentationShadcnComponentSystem as PresentationComponentSystem } from './presentation-shadcn-component-system.js';
|
|
4
|
+
import { type ProjectedActionPlacementLike, type ProjectedFieldRenderContext } from './projected-collection-view.js';
|
|
5
|
+
export interface ProjectedInlineListProps<TData extends object> {
|
|
6
|
+
readonly actionRuntimeBindings?: readonly PresentationActionRuntimeBinding<ProjectedCollectionActionExecutionContext<TData>, ReactNode>[];
|
|
7
|
+
readonly createHref?: (routeId: string, parameters?: NavigationRouteParameters) => string | null;
|
|
8
|
+
readonly componentSet?: string;
|
|
9
|
+
readonly data: readonly TData[];
|
|
10
|
+
readonly emptyMessage?: string | null;
|
|
11
|
+
readonly componentSystem: PresentationComponentSystem;
|
|
12
|
+
readonly fieldRenderers?: Record<string, (context: ProjectedFieldRenderContext<TData>) => ReactNode>;
|
|
13
|
+
readonly getRowLabel?: (row: TData) => string;
|
|
14
|
+
readonly navigateHref?: (href: string) => void;
|
|
15
|
+
readonly renderActionIcon?: (placement: ProjectedActionPlacementLike) => ReactNode;
|
|
16
|
+
readonly title?: string | null;
|
|
17
|
+
readonly viewId: string;
|
|
18
|
+
}
|
|
19
|
+
export declare function ProjectedInlineList<TData extends object>({ actionRuntimeBindings, componentSet, componentSystem, createHref: createHrefOverride, data, emptyMessage, fieldRenderers, getRowLabel, navigateHref: navigateHrefOverride, renderActionIcon, title, viewId, }: ProjectedInlineListProps<TData>): import("react/jsx-runtime").JSX.Element | null;
|
|
20
|
+
//# sourceMappingURL=projected-inline-list.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"projected-inline-list.d.ts","sourceRoot":"","sources":["../src/projected-inline-list.tsx"],"names":[],"mappings":"AAAA,OAAO,EAAwB,KAAK,SAAS,EAAE,MAAM,OAAO,CAAA;AAE5D,OAAO,EAWL,KAAK,yBAAyB,EAC9B,KAAK,gCAAgC,EACrC,KAAK,yCAAyC,EAI/C,MAAM,oCAAoC,CAAA;AAI3C,OAAO,KAAK,EACV,iCAAiC,IAAI,2BAA2B,EACjE,MAAM,wCAAwC,CAAA;AAO/C,OAAO,EAEL,KAAK,4BAA4B,EACjC,KAAK,2BAA2B,EACjC,MAAM,6BAA6B,CAAA;AAWpC,MAAM,WAAW,wBAAwB,CAAC,KAAK,SAAS,MAAM;IAC5D,QAAQ,CAAC,qBAA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