@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,15 @@
|
|
|
1
|
+
import { type ReactNode } from 'react';
|
|
2
|
+
import type { ViewChromeSlotDefinition, ViewChromeSlotPlacement, ViewDefinition } from '@cohesivesystems/presentation-core';
|
|
3
|
+
import type { PresentationShadcnComponentSystem as PresentationComponentSystem } from './presentation-shadcn-component-system.js';
|
|
4
|
+
export interface ProjectedViewChromeProps {
|
|
5
|
+
readonly className?: string;
|
|
6
|
+
readonly componentSystem: PresentationComponentSystem;
|
|
7
|
+
readonly placement: ViewChromeSlotPlacement | string | number;
|
|
8
|
+
readonly renderContainer?: (children: ReactNode) => ReactNode;
|
|
9
|
+
readonly renderSlot: (slot: ViewChromeSlotDefinition) => ReactNode;
|
|
10
|
+
readonly view: ViewDefinition | null;
|
|
11
|
+
}
|
|
12
|
+
export declare function ProjectedViewChrome({ className, componentSystem, placement, renderContainer, renderSlot, view, }: ProjectedViewChromeProps): 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;
|
|
13
|
+
export declare function resolveViewChromeSlots(view: ViewDefinition | null, placement: ViewChromeSlotPlacement | string | number): ViewChromeSlotDefinition[];
|
|
14
|
+
export declare function resolveViewChromeSlotPlacement(slot: ViewChromeSlotDefinition): ViewChromeSlotPlacement;
|
|
15
|
+
//# sourceMappingURL=projected-view-chrome.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"projected-view-chrome.d.ts","sourceRoot":"","sources":["../src/projected-view-chrome.tsx"],"names":[],"mappings":"AAAA,OAAO,EAAW,KAAK,SAAS,EAAE,MAAM,OAAO,CAAA;AAE/C,OAAO,KAAK,EACV,wBAAwB,EACxB,uBAAuB,EACvB,cAAc,EACf,MAAM,oCAAoC,CAAA;AAC3C,OAAO,KAAK,EACV,iCAAiC,IAAI,2BAA2B,EACjE,MAAM,wCAAwC,CAAA;AAkB/C,MAAM,WAAW,wBAAwB;IACvC,QAAQ,CAAC,SAAS,CAAC,EAAE,MAAM,CAAA;IAC3B,QAAQ,CAAC,eAAe,EAAE,2BAA2B,CAAA;IACrD,QAAQ,CAAC,SAAS,EAAE,uBAAuB,GAAG,MAAM,GAAG,MAAM,CAAA;IAC7D,QAAQ,CAAC,eAAe,CAAC,EAAE,CAAC,QAAQ,EAAE,SAAS,KAAK,SAAS,CAAA;IAC7D,QAAQ,CAAC,UAAU,EAAE,CAAC,IAAI,EAAE,wBAAwB,KAAK,SAAS,CAAA;IAClE,QAAQ,CAAC,IAAI,EAAE,cAAc,GAAG,IAAI,CAAA;CACrC;AAED,wBAAgB,mBAAmB,CAAC,EAClC,SAAS,EACT,eAAe,EACf,SAAS,EACT,eAAe,EACf,UAAU,EACV,IAAI,GACL,EAAE,wBAAwB,2UAyD1B;AAED,wBAAgB,sBAAsB,CACpC,IAAI,EAAE,cAAc,GAAG,IAAI,EAC3B,SAAS,EAAE,uBAAuB,GAAG,MAAM,GAAG,MAAM,8BAOrD;AAED,wBAAgB,8BAA8B,CAC5C,IAAI,EAAE,wBAAwB,GAC7B,uBAAuB,CAwBzB"}
|
|
@@ -0,0 +1,67 @@
|
|
|
1
|
+
import { jsx as _jsx, Fragment as _Fragment } from "react/jsx-runtime";
|
|
2
|
+
import { useMemo } from 'react';
|
|
3
|
+
import { isViewChromeSlotKind, isViewChromeSlotPlacementValue, resolveViewChromeIconSubjects, } from '@cohesivesystems/presentation-core';
|
|
4
|
+
import { projectPresentationIconDiagnostics, } from './presentation-icon-diagnostics.js';
|
|
5
|
+
import { usePresentationModule, useRegisterPresentationProjectionDiagnostics, } from '@cohesivesystems/presentation-react';
|
|
6
|
+
import { viewChromeSlotKinds, viewChromeSlotPlacements, } from '@cohesivesystems/presentation-contracts';
|
|
7
|
+
export function ProjectedViewChrome({ className, componentSystem, placement, renderContainer, renderSlot, view, }) {
|
|
8
|
+
const module = usePresentationModule();
|
|
9
|
+
const slots = useMemo(() => resolveViewChromeSlots(view, placement), [placement, view]);
|
|
10
|
+
const iconDiagnostics = useMemo(() => projectPresentationIconDiagnostics({
|
|
11
|
+
icons: resolveViewChromeIconSubjects(slots),
|
|
12
|
+
module,
|
|
13
|
+
source: `projected-view-chrome-icons:${view?.Id ?? 'unknown'}:${String(placement)}`,
|
|
14
|
+
surfaceId: view?.Id,
|
|
15
|
+
surfaceName: view?.Name,
|
|
16
|
+
}), [
|
|
17
|
+
module,
|
|
18
|
+
placement,
|
|
19
|
+
slots,
|
|
20
|
+
view?.Id,
|
|
21
|
+
view?.Name,
|
|
22
|
+
]);
|
|
23
|
+
useRegisterPresentationProjectionDiagnostics(`projected-view-chrome-icons:${view?.Id ?? 'unknown'}:${String(placement)}`, iconDiagnostics);
|
|
24
|
+
const ViewChromeSlot = componentSystem.viewChrome.ViewChromeSlot;
|
|
25
|
+
const renderedSlots = slots
|
|
26
|
+
.map((slot) => {
|
|
27
|
+
const rendered = renderSlot(slot);
|
|
28
|
+
return isRenderableNode(rendered) ? (_jsx(ViewChromeSlot, { placement: placement, slot: slot, viewId: view?.Id ?? null, children: rendered }, slot.Id)) : null;
|
|
29
|
+
})
|
|
30
|
+
.filter(isRenderableNode);
|
|
31
|
+
if (renderedSlots.length === 0) {
|
|
32
|
+
return null;
|
|
33
|
+
}
|
|
34
|
+
if (renderContainer) {
|
|
35
|
+
return renderContainer(renderedSlots);
|
|
36
|
+
}
|
|
37
|
+
return className ? (_jsx("div", { className: cn(className), children: renderedSlots })) : (_jsx(_Fragment, { children: renderedSlots }));
|
|
38
|
+
}
|
|
39
|
+
export function resolveViewChromeSlots(view, placement) {
|
|
40
|
+
return (view?.Chrome?.Slots ?? []).filter((slot) => isViewChromeSlotPlacementValue(resolveViewChromeSlotPlacement(slot), placement));
|
|
41
|
+
}
|
|
42
|
+
export function resolveViewChromeSlotPlacement(slot) {
|
|
43
|
+
if (slot.Placement !== undefined && slot.Placement !== null) {
|
|
44
|
+
return slot.Placement;
|
|
45
|
+
}
|
|
46
|
+
if (isViewChromeSlotKind(slot, viewChromeSlotKinds.actions) ||
|
|
47
|
+
isViewChromeSlotKind(slot, viewChromeSlotKinds.viewSwitch) ||
|
|
48
|
+
isViewChromeSlotKind(slot, viewChromeSlotKinds.layoutSwitch) ||
|
|
49
|
+
isViewChromeSlotKind(slot, viewChromeSlotKinds.headingTrailing) ||
|
|
50
|
+
isViewChromeSlotKind(slot, viewChromeSlotKinds.status)) {
|
|
51
|
+
return viewChromeSlotPlacements.header;
|
|
52
|
+
}
|
|
53
|
+
if (isViewChromeSlotKind(slot, viewChromeSlotKinds.badgeStrip)) {
|
|
54
|
+
return viewChromeSlotPlacements.beforeContent;
|
|
55
|
+
}
|
|
56
|
+
if (isViewChromeSlotKind(slot, viewChromeSlotKinds.metricStrip)) {
|
|
57
|
+
return viewChromeSlotPlacements.afterContent;
|
|
58
|
+
}
|
|
59
|
+
return viewChromeSlotPlacements.none;
|
|
60
|
+
}
|
|
61
|
+
function isRenderableNode(node) {
|
|
62
|
+
return node !== null && node !== undefined && node !== false;
|
|
63
|
+
}
|
|
64
|
+
function cn(...values) {
|
|
65
|
+
return values.filter(Boolean).join(' ');
|
|
66
|
+
}
|
|
67
|
+
//# sourceMappingURL=projected-view-chrome.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"projected-view-chrome.js","sourceRoot":"","sources":["../src/projected-view-chrome.tsx"],"names":[],"mappings":";AAAA,OAAO,EAAE,OAAO,EAAkB,MAAM,OAAO,CAAA;AAU/C,OAAO,EACL,oBAAoB,EACpB,8BAA8B,EAC9B,6BAA6B,GAC9B,MAAM,oCAAoC,CAAA;AAC3C,OAAO,EACL,kCAAkC,GACnC,MAAM,iCAAiC,CAAA;AACxC,OAAO,EACL,qBAAqB,EACrB,4CAA4C,GAC7C,MAAM,qCAAqC,CAAA;AAC5C,OAAO,EACL,mBAAmB,EACnB,wBAAwB,GACzB,MAAM,yCAAyC,CAAA;AAWhD,MAAM,UAAU,mBAAmB,CAAC,EAClC,SAAS,EACT,eAAe,EACf,SAAS,EACT,eAAe,EACf,UAAU,EACV,IAAI,GACqB;IACzB,MAAM,MAAM,GAAG,qBAAq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IAAI,EAAE,mBAAmB,CAAC,WAAW,CAAC,EAAE,CAAC;QAChE,OAAO,wBAAwB,CAAC,YAAY,CAAA;IAC9C,CAAC;IAED,OAAO,wBAAwB,CAAC,IAAI,CAAA;AACtC,CAAC;AAED,SAAS,gBAAgB,CAAC,IAAe;IACvC,OAAO,IAAI,KAAK,IAAI,IAAI,IAAI,KAAK,SAAS,IAAI,IAAI,KAAK,KAAK,CAAA;AAC9D,CAAC;AAED,SAAS,EAAE,CAAC,GAAG,MAAsD;IACnE,OAAO,MAAM,CAAC,MAAM,CAAC,OAAO,CAAC,CAAC,IAAI,CAAC,GAAG,CAAC,CAAA;AACzC,CAAC"}
|
|
@@ -0,0 +1,34 @@
|
|
|
1
|
+
import type { ReactNode } from 'react';
|
|
2
|
+
import { type ViewChromeSlotDefinition, type ViewDefinition } from '@cohesivesystems/presentation-core';
|
|
3
|
+
import type { PresentationShadcnComponentSystem as PresentationComponentSystem } from './presentation-shadcn-component-system.js';
|
|
4
|
+
import type { PresentationViewSurfaceContentTopInset, PresentationViewSurfaceVerticalResizeOptions } from './presentation-component-groups.js';
|
|
5
|
+
interface ProjectedViewSurfaceProps {
|
|
6
|
+
readonly action?: ReactNode;
|
|
7
|
+
readonly children?: ReactNode;
|
|
8
|
+
readonly className?: string;
|
|
9
|
+
readonly chromeAfterContentClassName?: string;
|
|
10
|
+
readonly chromeBeforeContentClassName?: string;
|
|
11
|
+
readonly chromeFooterClassName?: string;
|
|
12
|
+
readonly chromeHeaderClassName?: string;
|
|
13
|
+
readonly collapsible?: boolean;
|
|
14
|
+
readonly collapsed?: boolean;
|
|
15
|
+
readonly collapseLabel?: string;
|
|
16
|
+
readonly componentSystem: PresentationComponentSystem;
|
|
17
|
+
readonly contentClassName?: string;
|
|
18
|
+
readonly contentTopInset?: PresentationViewSurfaceContentTopInset | null;
|
|
19
|
+
readonly defaultCollapsed?: boolean;
|
|
20
|
+
readonly description?: string;
|
|
21
|
+
readonly eyebrow?: string;
|
|
22
|
+
readonly onCollapsedChange?: (collapsed: boolean) => void;
|
|
23
|
+
readonly renderChromeSlot?: ProjectedViewSurfaceChromeSlotRenderer;
|
|
24
|
+
readonly title?: string;
|
|
25
|
+
readonly verticalResize?: boolean | PresentationViewSurfaceVerticalResizeOptions | null;
|
|
26
|
+
readonly view?: ViewDefinition | null;
|
|
27
|
+
readonly viewId?: string;
|
|
28
|
+
}
|
|
29
|
+
export type ProjectedViewSurfaceChromeSlotRenderer = (slot: ViewChromeSlotDefinition, view: ViewDefinition | null) => ReactNode;
|
|
30
|
+
export type ProjectedViewSurfaceContentTopInset = PresentationViewSurfaceContentTopInset;
|
|
31
|
+
export type ProjectedViewSurfaceVerticalResizeOptions = PresentationViewSurfaceVerticalResizeOptions;
|
|
32
|
+
export declare function ProjectedViewSurface({ action, children, chromeAfterContentClassName, chromeBeforeContentClassName, chromeFooterClassName, chromeHeaderClassName, collapsible, componentSystem, renderChromeSlot, title, view: viewOverride, viewId, ...props }: ProjectedViewSurfaceProps): ReactNode;
|
|
33
|
+
export {};
|
|
34
|
+
//# sourceMappingURL=projected-view-surface.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"projected-view-surface.d.ts","sourceRoot":"","sources":["../src/projected-view-surface.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,OAAO,CAAA;AAEtC,OAAO,EAEL,KAAK,wBAAwB,EAE7B,KAAK,cAAc,EACpB,MAAM,oCAAoC,CAAA;AAC3C,OAAO,KAAK,EACV,iCAAiC,IAAI,2BAA2B,EACjE,MAAM,wCAAwC,CAAA;AAC/C,OAAO,KAAK,EACV,sCAAsC,EACtC,4CAA4C,EAC7C,MAAM,iCAAiC,CAAA;AAQxC,UAAU,yBAAyB;IACjC,QAAQ,CAAC,MAAM,CAAC,EAAE,SAAS,CAAA;IAC3B,QAAQ,CAAC,QAAQ,CAAC,EAAE,SAAS,CAAA;IAC7B,QAAQ,CAAC,SAAS,CA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AA;AAExC,MAAM,MAAM,yCAAyC,GACnD,4CAA4C,CAAA;AAE9C,wBAAgB,oBAAoB,CAAC,EACnC,MAAM,EACN,QAAQ,EACR,2BAA2B,EAC3B,4BAA4B,EAC5B,qBAAqB,EACrB,qBAAqB,EACrB,WAAW,EACX,eAAe,EACf,gBAAgB,EAChB,KAAK,EACL,IAAI,EAAE,YAAY,EAClB,MAAM,EACN,GAAG,KAAK,EACT,EAAE,yBAAyB,aA0D3B"}
|
|
@@ -0,0 +1,40 @@
|
|
|
1
|
+
import { jsx as _jsx } from "react/jsx-runtime";
|
|
2
|
+
import { findPresentationView, } from '@cohesivesystems/presentation-core';
|
|
3
|
+
import { usePresentationModule } from '@cohesivesystems/presentation-react';
|
|
4
|
+
import { ProjectedViewChrome, resolveViewChromeSlots, } from './projected-view-chrome.js';
|
|
5
|
+
import { viewChromeSlotPlacements } from '@cohesivesystems/presentation-contracts';
|
|
6
|
+
export function ProjectedViewSurface({ action, children, chromeAfterContentClassName, chromeBeforeContentClassName, chromeFooterClassName, chromeHeaderClassName, collapsible, componentSystem, renderChromeSlot, title, view: viewOverride, viewId, ...props }) {
|
|
7
|
+
const module = usePresentationModule();
|
|
8
|
+
const view = viewOverride ?? (viewId
|
|
9
|
+
? findPresentationView(module, viewId)
|
|
10
|
+
: null);
|
|
11
|
+
const renderChromePlacement = (placement, className) => renderChromeSlot && resolveViewChromeSlots(view, placement).length > 0 ? (_jsx(ProjectedViewChrome, { componentSystem: componentSystem, placement: placement, renderContainer: (children) => componentSystem.surfaces.ViewSurfaceChromePlacement({
|
|
12
|
+
children,
|
|
13
|
+
className,
|
|
14
|
+
placement,
|
|
15
|
+
viewId: view?.Id ?? null,
|
|
16
|
+
}), renderSlot: (slot) => renderChromeSlot(slot, view), view: view })) : null;
|
|
17
|
+
const headerChrome = renderChromePlacement(viewChromeSlotPlacements.header, chromeHeaderClassName);
|
|
18
|
+
const beforeContentChrome = renderChromePlacement(viewChromeSlotPlacements.beforeContent, chromeBeforeContentClassName);
|
|
19
|
+
const afterContentChrome = renderChromePlacement(viewChromeSlotPlacements.afterContent, chromeAfterContentClassName);
|
|
20
|
+
const footerChrome = renderChromePlacement(viewChromeSlotPlacements.footer, chromeFooterClassName);
|
|
21
|
+
return componentSystem.surfaces.ViewSurface({
|
|
22
|
+
...props,
|
|
23
|
+
action: componentSystem.surfaces.ViewSurfaceHeaderActions({
|
|
24
|
+
action,
|
|
25
|
+
chrome: headerChrome,
|
|
26
|
+
viewId: view?.Id ?? null,
|
|
27
|
+
}),
|
|
28
|
+
children: componentSystem.surfaces.ViewSurfaceContent({
|
|
29
|
+
afterContentChrome,
|
|
30
|
+
beforeContentChrome,
|
|
31
|
+
children,
|
|
32
|
+
footerChrome,
|
|
33
|
+
viewId: view?.Id ?? null,
|
|
34
|
+
}),
|
|
35
|
+
collapsible: collapsible ?? view?.Chrome?.Collapsible,
|
|
36
|
+
title: title ?? view?.Name,
|
|
37
|
+
viewId: view?.Id ?? null,
|
|
38
|
+
});
|
|
39
|
+
}
|
|
40
|
+
//# sourceMappingURL=projected-view-surface.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"projected-view-surface.js","sourceRoot":"","sources":["../src/projected-view-surface.tsx"],"names":[],"mappings":";AAEA,OAAO,EACL,oBAAoB,GAIrB,MAAM,oCAAoC,CAAA;AAQ3C,OAAO,EAAE,qBAAqB,EAAE,MAAM,qCAAqC,CAAA;AAC3E,OAAO,EACL,mBAAmB,EACnB,sBAAsB,GACvB,MAAM,yBAAyB,CAAA;AAChC,OAAO,EAAE,wBAAwB,EAAE,MAAM,yCAAyC,CAAA;AAsClF,MAAM,UAAU,oBAAoB,CAAC,EACnC,MAAM,EACN,QAAQ,EACR,2BAA2B,EAC3B,4BAA4B,EAC5B,qBAAqB,EACrB,qBAAqB,EACrB,WAAW,EACX,eAAe,EACf,gBAAgB,EAChB,KAAK,EACL,IAAI,EAAE,YAAY,EAClB,MAAM,EACN,GAAG,KAAK,EACkB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YACxD,MAAM;YACN,MAAM,EAAE,YAAY;YACpB,MAAM,EAAE,IAAI,EAAE,EAAE,IAAI,IAAI;SACzB,CAAC;QACF,QAAQ,EAAE,eAAe,CAAC,QAAQ,CAAC,kBAAkB,CAAC;YACpD,kBAAkB;YAClB,mBAAmB;YACnB,QAAQ;YACR,YAAY;YACZ,MAAM,EAAE,IAAI,EAAE,EAAE,IAAI,IAAI;SACzB,CAAC;QACF,WAAW,EAAE,WAAW,IAAI,IAAI,EAAE,MAAM,EAAE,WAAW;QACrD,KAAK,EAAE,KAAK,IAAI,IAAI,EAAE,IAAI;QAC1B,MAAM,EAAE,IAAI,EAAE,EAAE,IAAI,IAAI;KACzB,CAAC,CAAA;AACJ,CAAC"}
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
import type { ReactNode } from 'react';
|
|
2
|
+
import type { ProjectedCollectionChromeSlotRenderContext } from './projected-collection-view.js';
|
|
3
|
+
/**
|
|
4
|
+
* Default shadcn-backed renderers for the semantic collection chrome slots
|
|
5
|
+
* projected by Cohesive.Presentation.
|
|
6
|
+
*
|
|
7
|
+
* The registry is keyed by slot kind and optional placement so callers can
|
|
8
|
+
* override individual semantic slots while preserving the standard behavior
|
|
9
|
+
* for the rest of the collection surface.
|
|
10
|
+
*/
|
|
11
|
+
export declare const standardCollectionChromeSlotRenderers: Readonly<Record<string, import("@cohesivesystems/presentation-core").CollectionChromeSlotRenderer<ProjectedCollectionChromeSlotRenderContext<object>, ReactNode>>>;
|
|
12
|
+
/**
|
|
13
|
+
* Registry keys exposed for diagnostics, documentation, and composition with
|
|
14
|
+
* custom collection chrome slot renderer registries.
|
|
15
|
+
*/
|
|
16
|
+
export declare const standardCollectionChromeSlotRendererKeys: string[];
|
|
17
|
+
/**
|
|
18
|
+
* Renders a collection chrome slot with the standard renderer matching the
|
|
19
|
+
* slot's semantic kind and placement.
|
|
20
|
+
*
|
|
21
|
+
* @param context Rendering context for the projected collection slot.
|
|
22
|
+
* @returns The rendered chrome node, or `null` when no standard renderer
|
|
23
|
+
* matches the slot or the matching renderer elects not to render.
|
|
24
|
+
*/
|
|
25
|
+
export declare function renderStandardCollectionChromeSlot(context: ProjectedCollectionChromeSlotRenderContext<object>): string | number | bigint | boolean | import("react").ReactElement<unknown, string | import("react").JSXElementConstructor<any>> | Iterable<ReactNode> | Promise<string | number | bigint | boolean | import("react").ReactPortal | import("react").ReactElement<unknown, string | import("react").JSXElementConstructor<any>> | Iterable<ReactNode> | null | undefined> | null;
|
|
26
|
+
//# sourceMappingURL=standard-collection-chrome-slot-renderers.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"standard-collection-chrome-slot-renderers.d.ts","sourceRoot":"","sources":["../src/standard-collection-chrome-slot-renderers.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,OAAO,CAAA;AAetC,OAAO,KAAK,EACV,0CAA0C,EAC3C,MAAM,6BAA6B,CAAA;AAUpC;;;;;;;GAOG;AACH,eAAO,MAAM,qCAAqC,oKAqC9C,CAAA;AAEJ;;;GAGG;AACH,eAAO,MAAM,wCAAwC,UAC+B,CAAA;AAEpF;;;;;;;GAOG;AACH,wBAAgB,kCAAkC,CAChD,OAAO,EAAE,0CAA0C,CAAC,MAAM,CAAC,kXAO5D"}
|
|
@@ -0,0 +1,250 @@
|
|
|
1
|
+
import { jsx as _jsx } from "react/jsx-runtime";
|
|
2
|
+
import { collectionChromeIconIds, collectionChromeSlotProjectionAnnotationName, createCollectionChromeSlotRendererRegistry, findPresentationInputForm, findPresentationQueryForm, getCollectionChromeSlotRendererRegistryKeys, resolveCollectionChromeSlotRenderer, } from '@cohesivesystems/presentation-core';
|
|
3
|
+
import { renderPresentationIcon, } from './presentation-icon-registry.js';
|
|
4
|
+
import { ProjectedCollectionRowActions, ProjectedCollectionSelectionActionToolbar, } from './projected-collection-view.js';
|
|
5
|
+
import { collectionChromeSlotKinds, collectionChromeSlotPlacements, } from '@cohesivesystems/presentation-contracts';
|
|
6
|
+
/**
|
|
7
|
+
* Default shadcn-backed renderers for the semantic collection chrome slots
|
|
8
|
+
* projected by Cohesive.Presentation.
|
|
9
|
+
*
|
|
10
|
+
* The registry is keyed by slot kind and optional placement so callers can
|
|
11
|
+
* override individual semantic slots while preserving the standard behavior
|
|
12
|
+
* for the rest of the collection surface.
|
|
13
|
+
*/
|
|
14
|
+
export const standardCollectionChromeSlotRenderers = createCollectionChromeSlotRendererRegistry([
|
|
15
|
+
{
|
|
16
|
+
kind: collectionChromeSlotKinds.queryForm,
|
|
17
|
+
render: renderStandardCollectionQueryForm,
|
|
18
|
+
},
|
|
19
|
+
{
|
|
20
|
+
kind: collectionChromeSlotKinds.summary,
|
|
21
|
+
render: renderStandardCollectionSummary,
|
|
22
|
+
},
|
|
23
|
+
{
|
|
24
|
+
kind: collectionChromeSlotKinds.pagination,
|
|
25
|
+
placement: collectionChromeSlotPlacements.footer,
|
|
26
|
+
render: renderStandardCollectionPaginationFooter,
|
|
27
|
+
},
|
|
28
|
+
{
|
|
29
|
+
kind: collectionChromeSlotKinds.selectionActions,
|
|
30
|
+
placement: collectionChromeSlotPlacements.toolbar,
|
|
31
|
+
render: renderStandardCollectionSelectionActionsToolbar,
|
|
32
|
+
},
|
|
33
|
+
{
|
|
34
|
+
kind: collectionChromeSlotKinds.detail,
|
|
35
|
+
render: renderStandardCollectionDetail,
|
|
36
|
+
},
|
|
37
|
+
{
|
|
38
|
+
kind: collectionChromeSlotKinds.rowActions,
|
|
39
|
+
placement: collectionChromeSlotPlacements.inline,
|
|
40
|
+
render: renderStandardCollectionRowActions,
|
|
41
|
+
},
|
|
42
|
+
{
|
|
43
|
+
kind: collectionChromeSlotKinds.body,
|
|
44
|
+
placement: collectionChromeSlotPlacements.inline,
|
|
45
|
+
render: renderStandardCollectionBody,
|
|
46
|
+
},
|
|
47
|
+
]);
|
|
48
|
+
/**
|
|
49
|
+
* Registry keys exposed for diagnostics, documentation, and composition with
|
|
50
|
+
* custom collection chrome slot renderer registries.
|
|
51
|
+
*/
|
|
52
|
+
export const standardCollectionChromeSlotRendererKeys = getCollectionChromeSlotRendererRegistryKeys(standardCollectionChromeSlotRenderers);
|
|
53
|
+
/**
|
|
54
|
+
* Renders a collection chrome slot with the standard renderer matching the
|
|
55
|
+
* slot's semantic kind and placement.
|
|
56
|
+
*
|
|
57
|
+
* @param context Rendering context for the projected collection slot.
|
|
58
|
+
* @returns The rendered chrome node, or `null` when no standard renderer
|
|
59
|
+
* matches the slot or the matching renderer elects not to render.
|
|
60
|
+
*/
|
|
61
|
+
export function renderStandardCollectionChromeSlot(context) {
|
|
62
|
+
const renderer = resolveCollectionChromeSlotRenderer(standardCollectionChromeSlotRenderers, context.slot);
|
|
63
|
+
return renderer?.(context) ?? null;
|
|
64
|
+
}
|
|
65
|
+
/**
|
|
66
|
+
* Renders footer pagination from the collection runtime paging window.
|
|
67
|
+
*
|
|
68
|
+
* The slot is omitted when pagination is disabled, no page window is available,
|
|
69
|
+
* or the slot requests suppression of the standard projection.
|
|
70
|
+
*/
|
|
71
|
+
function renderStandardCollectionPaginationFooter({ collectionRuntime, componentSet, componentSystem, module, slot, viewId, }) {
|
|
72
|
+
if (shouldSuppressStandardCollectionChromeSlot(slot)) {
|
|
73
|
+
return null;
|
|
74
|
+
}
|
|
75
|
+
const pagination = collectionRuntime.pagination;
|
|
76
|
+
const window = pagination.window;
|
|
77
|
+
if (!pagination.isFooterEnabled || !window) {
|
|
78
|
+
return null;
|
|
79
|
+
}
|
|
80
|
+
const pageInfo = window.pageInfo;
|
|
81
|
+
const isFetching = pagination.isFetching;
|
|
82
|
+
const pageLabel = pageInfo.totalPageCount
|
|
83
|
+
? `Page ${(pageInfo.pageIndex + 1).toLocaleString()} of ${pageInfo.totalPageCount.toLocaleString()}`
|
|
84
|
+
: `Page ${(pageInfo.pageIndex + 1).toLocaleString()}`;
|
|
85
|
+
const totalLabel = typeof pageInfo.totalCount === 'number'
|
|
86
|
+
? `${pageInfo.totalCount.toLocaleString()} total`
|
|
87
|
+
: `${pageInfo.itemCount.toLocaleString()} shown`;
|
|
88
|
+
return componentSystem.collectionChrome.CollectionPaginationBar({
|
|
89
|
+
canGoNextPage: window.canGoNextPage,
|
|
90
|
+
canGoPreviousPage: window.canGoPreviousPage,
|
|
91
|
+
firstIcon: renderPresentationIcon({
|
|
92
|
+
componentSet,
|
|
93
|
+
icon: collectionChromeIconIds.paginationFirstPage,
|
|
94
|
+
module,
|
|
95
|
+
subject: slot,
|
|
96
|
+
}),
|
|
97
|
+
isFetching,
|
|
98
|
+
loadingIcon: renderPresentationIcon({
|
|
99
|
+
className: 'size-3.5 animate-spin text-sky-700',
|
|
100
|
+
componentSet,
|
|
101
|
+
icon: collectionChromeIconIds.paginationLoading,
|
|
102
|
+
module,
|
|
103
|
+
subject: slot,
|
|
104
|
+
}),
|
|
105
|
+
nextIcon: renderPresentationIcon({
|
|
106
|
+
componentSet,
|
|
107
|
+
icon: collectionChromeIconIds.paginationNextPage,
|
|
108
|
+
module,
|
|
109
|
+
subject: slot,
|
|
110
|
+
}),
|
|
111
|
+
onFirstPage: window.goToFirstPage,
|
|
112
|
+
onNextPage: window.goToNextPage,
|
|
113
|
+
onPreviousPage: window.goToPreviousPage,
|
|
114
|
+
pageLabel,
|
|
115
|
+
pageSizeLabel: `${pageInfo.pageSize.toLocaleString()} per page`,
|
|
116
|
+
previousIcon: renderPresentationIcon({
|
|
117
|
+
componentSet,
|
|
118
|
+
icon: collectionChromeIconIds.paginationPreviousPage,
|
|
119
|
+
module,
|
|
120
|
+
subject: slot,
|
|
121
|
+
}),
|
|
122
|
+
shownLabel: `${pageInfo.itemCount.toLocaleString()} shown`,
|
|
123
|
+
slotId: slot.Id,
|
|
124
|
+
totalLabel,
|
|
125
|
+
viewId,
|
|
126
|
+
});
|
|
127
|
+
}
|
|
128
|
+
/**
|
|
129
|
+
* Renders the collection query form chrome around the projected query form.
|
|
130
|
+
*
|
|
131
|
+
* Query forms without a backing input form are rendered without the standard
|
|
132
|
+
* chrome wrapper so the backend projection can supply a fully custom surface.
|
|
133
|
+
*/
|
|
134
|
+
function renderStandardCollectionQueryForm({ componentSystem, module, renderQueryFormSlot, slot, viewId, }) {
|
|
135
|
+
if (shouldSuppressStandardCollectionChromeSlot(slot)) {
|
|
136
|
+
return null;
|
|
137
|
+
}
|
|
138
|
+
if (shouldRenderQueryFormWithoutChrome({ module, slot })) {
|
|
139
|
+
return renderQueryFormSlot?.(slot) ?? null;
|
|
140
|
+
}
|
|
141
|
+
const children = renderQueryFormSlot?.(slot) ?? null;
|
|
142
|
+
if (children === null || children === undefined || children === false) {
|
|
143
|
+
return null;
|
|
144
|
+
}
|
|
145
|
+
return componentSystem.collectionChrome.CollectionQueryFormSlot({
|
|
146
|
+
children,
|
|
147
|
+
slotId: slot.Id,
|
|
148
|
+
viewId,
|
|
149
|
+
});
|
|
150
|
+
}
|
|
151
|
+
/**
|
|
152
|
+
* Determines whether a query-form slot represents a custom projection rather
|
|
153
|
+
* than a standard input form projection.
|
|
154
|
+
*/
|
|
155
|
+
function shouldRenderQueryFormWithoutChrome({ module, slot, }) {
|
|
156
|
+
if (!slot.QueryFormId) {
|
|
157
|
+
return false;
|
|
158
|
+
}
|
|
159
|
+
const queryForm = findPresentationQueryForm(module ?? null, slot.QueryFormId);
|
|
160
|
+
return Boolean(queryForm &&
|
|
161
|
+
!findPresentationInputForm(module ?? null, queryForm.FormId));
|
|
162
|
+
}
|
|
163
|
+
/**
|
|
164
|
+
* Renders the summary slot using the component system's collection chrome
|
|
165
|
+
* wrapper and the caller-provided summary projection.
|
|
166
|
+
*/
|
|
167
|
+
function renderStandardCollectionSummary({ componentSystem, renderSummarySlot, slot, viewId, }) {
|
|
168
|
+
if (shouldSuppressStandardCollectionChromeSlot(slot)) {
|
|
169
|
+
return null;
|
|
170
|
+
}
|
|
171
|
+
return componentSystem.collectionChrome.CollectionSummarySlot({
|
|
172
|
+
children: renderSummarySlot?.(slot) ?? null,
|
|
173
|
+
slotId: slot.Id,
|
|
174
|
+
viewId,
|
|
175
|
+
});
|
|
176
|
+
}
|
|
177
|
+
/**
|
|
178
|
+
* Renders the toolbar surface for actions that target the current collection
|
|
179
|
+
* selection.
|
|
180
|
+
*/
|
|
181
|
+
function renderStandardCollectionSelectionActionsToolbar({ canExecuteAction, collectionRuntime, componentSet, componentSystem, executeAction, module, renderActionIcon, slot, }) {
|
|
182
|
+
if (shouldSuppressStandardCollectionChromeSlot(slot)) {
|
|
183
|
+
return null;
|
|
184
|
+
}
|
|
185
|
+
return (_jsx(ProjectedCollectionSelectionActionToolbar, { canExecuteAction: canExecuteAction, collectionRuntime: collectionRuntime, componentSet: componentSet, componentSystem: componentSystem, executeAction: executeAction, module: module, renderActionIcon: renderActionIcon, slot: slot }));
|
|
186
|
+
}
|
|
187
|
+
/**
|
|
188
|
+
* Renders the detail slot using the component system's collection chrome
|
|
189
|
+
* wrapper and the caller-provided detail projection.
|
|
190
|
+
*/
|
|
191
|
+
function renderStandardCollectionDetail({ componentSystem, renderDetailSlot, slot, viewId, }) {
|
|
192
|
+
if (shouldSuppressStandardCollectionChromeSlot(slot)) {
|
|
193
|
+
return null;
|
|
194
|
+
}
|
|
195
|
+
return componentSystem.collectionChrome.CollectionDetailSlot({
|
|
196
|
+
children: renderDetailSlot?.(slot) ?? null,
|
|
197
|
+
slotId: slot.Id,
|
|
198
|
+
viewId,
|
|
199
|
+
});
|
|
200
|
+
}
|
|
201
|
+
/**
|
|
202
|
+
* Renders the body slot using the component system's collection chrome wrapper
|
|
203
|
+
* and the caller-provided body projection.
|
|
204
|
+
*/
|
|
205
|
+
function renderStandardCollectionBody({ componentSystem, renderBodySlot, slot, viewId, }) {
|
|
206
|
+
if (shouldSuppressStandardCollectionChromeSlot(slot)) {
|
|
207
|
+
return null;
|
|
208
|
+
}
|
|
209
|
+
return componentSystem.collectionChrome.CollectionBodySlot({
|
|
210
|
+
children: renderBodySlot?.(slot) ?? null,
|
|
211
|
+
slotId: slot.Id,
|
|
212
|
+
viewId,
|
|
213
|
+
});
|
|
214
|
+
}
|
|
215
|
+
/**
|
|
216
|
+
* Renders row-scoped actions for the current collection row.
|
|
217
|
+
*
|
|
218
|
+
* A caller-provided row action slot renderer takes precedence over the standard
|
|
219
|
+
* projected row action component. The slot is skipped outside row context.
|
|
220
|
+
*/
|
|
221
|
+
function renderStandardCollectionRowActions({ canExecuteAction, collectionRuntime, componentSet, componentSystem, executeAction, module, renderActionIcon, renderRowActionsSlot, row, rowLabel, slot, viewId, }) {
|
|
222
|
+
if (shouldSuppressStandardCollectionChromeSlot(slot) || !row) {
|
|
223
|
+
return null;
|
|
224
|
+
}
|
|
225
|
+
return renderRowActionsSlot?.(slot, row, rowLabel ?? null) ?? (_jsx(ProjectedCollectionRowActions, { canExecuteAction: canExecuteAction, collectionRuntime: collectionRuntime, componentSet: componentSet, componentSystem: componentSystem, executeAction: executeAction, module: module, renderActionIcon: renderActionIcon, row: row, rowLabel: rowLabel ?? null, slot: slot, viewId: viewId }));
|
|
226
|
+
}
|
|
227
|
+
/**
|
|
228
|
+
* Checks whether a slot's projection annotation opts out of the standard
|
|
229
|
+
* renderer.
|
|
230
|
+
*
|
|
231
|
+
* A boolean annotation value suppresses directly. Object annotation values use
|
|
232
|
+
* `suppressDefaultRenderer` so other projection options can share the same
|
|
233
|
+
* annotation payload.
|
|
234
|
+
*/
|
|
235
|
+
function shouldSuppressStandardCollectionChromeSlot(slot) {
|
|
236
|
+
return slot.Annotations.some((annotation) => {
|
|
237
|
+
if (annotation.Name.toLocaleLowerCase() !== collectionChromeSlotProjectionAnnotationName) {
|
|
238
|
+
return false;
|
|
239
|
+
}
|
|
240
|
+
const value = annotation.Value;
|
|
241
|
+
if (typeof value === 'boolean') {
|
|
242
|
+
return value;
|
|
243
|
+
}
|
|
244
|
+
if (!value || typeof value !== 'object') {
|
|
245
|
+
return false;
|
|
246
|
+
}
|
|
247
|
+
return Boolean(value.suppressDefaultRenderer);
|
|
248
|
+
});
|
|
249
|
+
}
|
|
250
|
+
//# sourceMappingURL=standard-collection-chrome-slot-renderers.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"standard-collection-chrome-slot-renderers.js","sourceRoot":"","sources":["../src/standard-collection-chrome-slot-renderers.tsx"],"names":[],"mappings":";AAEA,OAAO,EACL,uBAAuB,EACvB,4CAA4C,EAC5C,0CAA0C,EAC1C,yBAAyB,EACzB,yBAAyB,EACzB,2CAA2C,EAC3C,mCAAmC,GAEpC,MAAM,oCAAoC,CAAA;AAC3C,OAAO,EACL,sBAAsB,GACvB,MAAM,8BAA8B,CAAA;AAIrC,OAAO,EACL,6BAA6B,EAC7B,yCAAyC,GAC1C,MAAM,6BAA6B,CAAA;AACpC,OAAO,EACL,yBAAyB,EACzB,8BAA8B,GAC/B,MAAM,yCAAyC,CAAA;AAEhD;;;;;;;GAOG;AACH,MAAM,CAAC,MAAM,qCAAqC,GAChD,0CAA0C,CAGxC;IACA;QACE,IAAI,EAAE,yBAAyB,CAAC,SAAS;QACzC,MAAM,EAAE,iCAAiC;KAC1C;IACD;QACE,IAAI,EAAE,yBAAyB,CAAC,OAAO;QACvC,MAAM,EAAE,+BAA+B;KACxC;IACD;QACE,IAAI,EAAE,yBAAyB,CAAC,UAAU;QAC1C,SAAS,EAAE,8BAA8B,CAAC,MAAM;QAChD,MAAM,EAAE,wCAAwC;KACjD;IACD;QACE,IAAI,EAAE,yBAAyB,CAAC,gBAAgB;QAChD,SAAS,EAAE,8BAA8B,CAAC,OAAO;QACjD,MAAM,EAAE,+CAA+C;KACxD;IACD;QACE,IAAI,EAAE,yBAAyB,CAAC,MAAM;QACtC,MAAM,EAAE,8BAA8B;KACvC;IACD;QACE,IAAI,EAAE,yBAAyB,CAAC,UAAU;QAC1C,SAAS,EAAE,8BAA8B,CAAC,MAAM;QAChD,MAAM,EAAE,kCAAkC;KAC3C;IACD;QACE,IAAI,EAAE,yBAAyB,CAAC,IAAI;QACpC,SAAS,EAAE,8BAA8B,CA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AAC;QAED,IAAI,CAAC,KAAK,IAAI,OAAO,KAAK,KAAK,QAAQ,EAAE,CAAC;YACxC,OAAO,KAAK,CAAA;QACd,CAAC;QAED,OAAO,OAAO,CACX,KAA2C,CAAC,uBAAuB,CACrE,CAAA;IACH,CAAC,CAAC,CAAA;AACJ,CAAC"}
|
|
@@ -0,0 +1,57 @@
|
|
|
1
|
+
import { type ReactNode } from 'react';
|
|
2
|
+
import { type NavigationRouteParameters, type DocumentEditorLayout, type PresentationBadgeDefinition, type PresentationDataSourceResolver, type PresentationModuleDefinition, type ProjectedDocumentActionStatusMap, type ProjectedDocumentFieldDefinitionLike, type ViewChromeSlotDefinition, type ViewDefinition } from '@cohesivesystems/presentation-core';
|
|
3
|
+
import { type PresentationActionGroupOptions } from './presentation-action-group.js';
|
|
4
|
+
import type { PresentationShadcnComponentSystem as PresentationComponentSystem } from './presentation-shadcn-component-system.js';
|
|
5
|
+
import type { PresentationDesignSystem } from '@cohesivesystems/presentation-tailwind';
|
|
6
|
+
import { type PresentationBadgeTargetInterpreterRegistry } from './presentation-badge-target-interpreter.js';
|
|
7
|
+
import { type ProjectedMetricValue } from './projected-metric-strip.js';
|
|
8
|
+
export type ProjectedViewChromeMetadataRole = string;
|
|
9
|
+
export type ProjectedViewChromeMetadataBadgeRoleReader = (badge: Pick<PresentationBadgeDefinition, 'Annotations'>, field: Pick<ProjectedDocumentFieldDefinitionLike, 'Annotations'> | null | undefined) => ProjectedViewChromeMetadataRole | null;
|
|
10
|
+
export type ProjectedViewChromeMetadataFieldRoleReader = (field: Pick<ProjectedDocumentFieldDefinitionLike, 'Annotations'> | null | undefined) => ProjectedViewChromeMetadataRole | null;
|
|
11
|
+
export interface ProjectedViewChromeSlotRenderContext<TActionContext> {
|
|
12
|
+
readonly actionContext: TActionContext;
|
|
13
|
+
readonly actionGroupOptions?: PresentationActionGroupOptions<TActionContext>;
|
|
14
|
+
readonly actionStatuses?: ProjectedDocumentActionStatusMap;
|
|
15
|
+
readonly activeViewId?: string | null;
|
|
16
|
+
readonly componentSystem: PresentationComponentSystem;
|
|
17
|
+
readonly createHref?: (routeId: string, parameters?: NavigationRouteParameters) => string | null;
|
|
18
|
+
readonly dataSourceResolver: PresentationDataSourceResolver;
|
|
19
|
+
readonly designSystem: PresentationDesignSystem;
|
|
20
|
+
readonly documentViewIds?: readonly string[];
|
|
21
|
+
readonly badgeInterpreters?: PresentationBadgeTargetInterpreterRegistry;
|
|
22
|
+
readonly layout?: DocumentEditorLayout | null;
|
|
23
|
+
readonly metadataEntityReferenceRole?: ProjectedViewChromeMetadataRole | null;
|
|
24
|
+
readonly metricMessage?: ReactNode;
|
|
25
|
+
readonly metricValues?: Readonly<Record<string, ProjectedMetricValue>>;
|
|
26
|
+
readonly module: PresentationModuleDefinition | null;
|
|
27
|
+
readonly navigateHref?: (href: string) => void;
|
|
28
|
+
readonly onActiveViewIdChange?: (viewId: string) => void;
|
|
29
|
+
readonly onLayoutChange?: (layout: DocumentEditorLayout) => void;
|
|
30
|
+
readonly readMetadataBadgeRole?: ProjectedViewChromeMetadataBadgeRoleReader;
|
|
31
|
+
readonly readMetadataFieldRole?: ProjectedViewChromeMetadataFieldRoleReader;
|
|
32
|
+
readonly resource?: unknown;
|
|
33
|
+
readonly slot: ViewChromeSlotDefinition;
|
|
34
|
+
readonly view: ViewDefinition | null;
|
|
35
|
+
readonly workspaceView?: ViewDefinition | null;
|
|
36
|
+
}
|
|
37
|
+
export declare const standardViewChromeSlotRenderers: Readonly<Record<string, import("@cohesivesystems/presentation-core").ViewChromeSlotRenderer<ProjectedViewChromeSlotRenderContext<object>, ReactNode>>>;
|
|
38
|
+
export declare const standardViewChromeSlotRendererKeys: string[];
|
|
39
|
+
export declare function renderStandardViewChromeSlot<TActionContext>(context: ProjectedViewChromeSlotRenderContext<TActionContext>): string | number | bigint | boolean | import("react").ReactElement<unknown, string | import("react").JSXElementConstructor<any>> | Iterable<ReactNode> | Promise<string | number | bigint | boolean | import("react").ReactPortal | import("react").ReactElement<unknown, string | import("react").JSXElementConstructor<any>> | Iterable<ReactNode> | null | undefined> | null;
|
|
40
|
+
export declare function ProjectedViewBadgeStrip({ badges, componentSystem, createHref, designSystem, badgeInterpreters, fieldIds, metadataEntityReferenceRole, module, navigateHref, readMetadataBadgeRole, readMetadataFieldRole, resource, slotId, viewId, viewName, }: {
|
|
41
|
+
readonly badges?: readonly PresentationBadgeDefinition[];
|
|
42
|
+
readonly componentSystem: PresentationComponentSystem;
|
|
43
|
+
readonly createHref?: (routeId: string, parameters?: NavigationRouteParameters) => string | null;
|
|
44
|
+
readonly designSystem: PresentationDesignSystem;
|
|
45
|
+
readonly badgeInterpreters?: PresentationBadgeTargetInterpreterRegistry;
|
|
46
|
+
readonly fieldIds: readonly string[];
|
|
47
|
+
readonly metadataEntityReferenceRole?: ProjectedViewChromeMetadataRole | null;
|
|
48
|
+
readonly module: PresentationModuleDefinition | null;
|
|
49
|
+
readonly navigateHref?: (href: string) => void;
|
|
50
|
+
readonly readMetadataBadgeRole?: ProjectedViewChromeMetadataBadgeRoleReader;
|
|
51
|
+
readonly readMetadataFieldRole?: ProjectedViewChromeMetadataFieldRoleReader;
|
|
52
|
+
readonly resource: unknown;
|
|
53
|
+
readonly slotId?: string;
|
|
54
|
+
readonly viewId?: string | null;
|
|
55
|
+
readonly viewName?: string | null;
|
|
56
|
+
}): ReactNode;
|
|
57
|
+
//# sourceMappingURL=standard-view-chrome-slot-renderers.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"standard-view-chrome-slot-renderers.d.ts","sourceRoot":"","sources":["../src/standard-view-chrome-slot-renderers.tsx"],"names":[],"mappings":"AAAA,OAAO,EAAW,KAAK,SAAS,EAAE,MAAM,OAAO,CAAA;AAE/C,OAAO,EASL,KAAK,yBAAyB,EAQ9B,KAAK,oBAAoB,EACzB,KAAK,2BAA2B,EAChC,KAAK,8BAA8B,EACnC,KAAK,4BAA4B,EAEjC,KAAK,gCAAgC,EACrC,KAAK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