@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,391 @@
|
|
|
1
|
+
import type { ReactNode } from 'react'
|
|
2
|
+
|
|
3
|
+
import {
|
|
4
|
+
collectionChromeIconIds,
|
|
5
|
+
collectionChromeSlotProjectionAnnotationName,
|
|
6
|
+
createCollectionChromeSlotRendererRegistry,
|
|
7
|
+
findPresentationInputForm,
|
|
8
|
+
findPresentationQueryForm,
|
|
9
|
+
getCollectionChromeSlotRendererRegistryKeys,
|
|
10
|
+
resolveCollectionChromeSlotRenderer,
|
|
11
|
+
type CollectionChromeSlotDefinition,
|
|
12
|
+
} from '@cohesivesystems/presentation-core'
|
|
13
|
+
import {
|
|
14
|
+
renderPresentationIcon,
|
|
15
|
+
} from './presentation-icon-registry'
|
|
16
|
+
import type {
|
|
17
|
+
ProjectedCollectionChromeSlotRenderContext,
|
|
18
|
+
} from './projected-collection-view'
|
|
19
|
+
import {
|
|
20
|
+
ProjectedCollectionRowActions,
|
|
21
|
+
ProjectedCollectionSelectionActionToolbar,
|
|
22
|
+
} from './projected-collection-view'
|
|
23
|
+
import {
|
|
24
|
+
collectionChromeSlotKinds,
|
|
25
|
+
collectionChromeSlotPlacements,
|
|
26
|
+
} from '@cohesivesystems/presentation-contracts'
|
|
27
|
+
|
|
28
|
+
/**
|
|
29
|
+
* Default shadcn-backed renderers for the semantic collection chrome slots
|
|
30
|
+
* projected by Cohesive.Presentation.
|
|
31
|
+
*
|
|
32
|
+
* The registry is keyed by slot kind and optional placement so callers can
|
|
33
|
+
* override individual semantic slots while preserving the standard behavior
|
|
34
|
+
* for the rest of the collection surface.
|
|
35
|
+
*/
|
|
36
|
+
export const standardCollectionChromeSlotRenderers =
|
|
37
|
+
createCollectionChromeSlotRendererRegistry<
|
|
38
|
+
ProjectedCollectionChromeSlotRenderContext<object>,
|
|
39
|
+
ReactNode
|
|
40
|
+
>([
|
|
41
|
+
{
|
|
42
|
+
kind: collectionChromeSlotKinds.queryForm,
|
|
43
|
+
render: renderStandardCollectionQueryForm,
|
|
44
|
+
},
|
|
45
|
+
{
|
|
46
|
+
kind: collectionChromeSlotKinds.summary,
|
|
47
|
+
render: renderStandardCollectionSummary,
|
|
48
|
+
},
|
|
49
|
+
{
|
|
50
|
+
kind: collectionChromeSlotKinds.pagination,
|
|
51
|
+
placement: collectionChromeSlotPlacements.footer,
|
|
52
|
+
render: renderStandardCollectionPaginationFooter,
|
|
53
|
+
},
|
|
54
|
+
{
|
|
55
|
+
kind: collectionChromeSlotKinds.selectionActions,
|
|
56
|
+
placement: collectionChromeSlotPlacements.toolbar,
|
|
57
|
+
render: renderStandardCollectionSelectionActionsToolbar,
|
|
58
|
+
},
|
|
59
|
+
{
|
|
60
|
+
kind: collectionChromeSlotKinds.detail,
|
|
61
|
+
render: renderStandardCollectionDetail,
|
|
62
|
+
},
|
|
63
|
+
{
|
|
64
|
+
kind: collectionChromeSlotKinds.rowActions,
|
|
65
|
+
placement: collectionChromeSlotPlacements.inline,
|
|
66
|
+
render: renderStandardCollectionRowActions,
|
|
67
|
+
},
|
|
68
|
+
{
|
|
69
|
+
kind: collectionChromeSlotKinds.body,
|
|
70
|
+
placement: collectionChromeSlotPlacements.inline,
|
|
71
|
+
render: renderStandardCollectionBody,
|
|
72
|
+
},
|
|
73
|
+
])
|
|
74
|
+
|
|
75
|
+
/**
|
|
76
|
+
* Registry keys exposed for diagnostics, documentation, and composition with
|
|
77
|
+
* custom collection chrome slot renderer registries.
|
|
78
|
+
*/
|
|
79
|
+
export const standardCollectionChromeSlotRendererKeys =
|
|
80
|
+
getCollectionChromeSlotRendererRegistryKeys(standardCollectionChromeSlotRenderers)
|
|
81
|
+
|
|
82
|
+
/**
|
|
83
|
+
* Renders a collection chrome slot with the standard renderer matching the
|
|
84
|
+
* slot's semantic kind and placement.
|
|
85
|
+
*
|
|
86
|
+
* @param context Rendering context for the projected collection slot.
|
|
87
|
+
* @returns The rendered chrome node, or `null` when no standard renderer
|
|
88
|
+
* matches the slot or the matching renderer elects not to render.
|
|
89
|
+
*/
|
|
90
|
+
export function renderStandardCollectionChromeSlot(
|
|
91
|
+
context: ProjectedCollectionChromeSlotRenderContext<object>,
|
|
92
|
+
) {
|
|
93
|
+
const renderer = resolveCollectionChromeSlotRenderer(
|
|
94
|
+
standardCollectionChromeSlotRenderers,
|
|
95
|
+
context.slot,
|
|
96
|
+
)
|
|
97
|
+
return renderer?.(context) ?? null
|
|
98
|
+
}
|
|
99
|
+
|
|
100
|
+
/**
|
|
101
|
+
* Renders footer pagination from the collection runtime paging window.
|
|
102
|
+
*
|
|
103
|
+
* The slot is omitted when pagination is disabled, no page window is available,
|
|
104
|
+
* or the slot requests suppression of the standard projection.
|
|
105
|
+
*/
|
|
106
|
+
function renderStandardCollectionPaginationFooter({
|
|
107
|
+
collectionRuntime,
|
|
108
|
+
componentSet,
|
|
109
|
+
componentSystem,
|
|
110
|
+
module,
|
|
111
|
+
slot,
|
|
112
|
+
viewId,
|
|
113
|
+
}: ProjectedCollectionChromeSlotRenderContext<object>) {
|
|
114
|
+
if (shouldSuppressStandardCollectionChromeSlot(slot)) {
|
|
115
|
+
return null
|
|
116
|
+
}
|
|
117
|
+
|
|
118
|
+
const pagination = collectionRuntime.pagination
|
|
119
|
+
const window = pagination.window
|
|
120
|
+
if (!pagination.isFooterEnabled || !window) {
|
|
121
|
+
return null
|
|
122
|
+
}
|
|
123
|
+
|
|
124
|
+
const pageInfo = window.pageInfo
|
|
125
|
+
const isFetching = pagination.isFetching
|
|
126
|
+
const pageLabel = pageInfo.totalPageCount
|
|
127
|
+
? `Page ${(pageInfo.pageIndex + 1).toLocaleString()} of ${pageInfo.totalPageCount.toLocaleString()}`
|
|
128
|
+
: `Page ${(pageInfo.pageIndex + 1).toLocaleString()}`
|
|
129
|
+
const totalLabel = typeof pageInfo.totalCount === 'number'
|
|
130
|
+
? `${pageInfo.totalCount.toLocaleString()} total`
|
|
131
|
+
: `${pageInfo.itemCount.toLocaleString()} shown`
|
|
132
|
+
|
|
133
|
+
return componentSystem.collectionChrome.CollectionPaginationBar({
|
|
134
|
+
canGoNextPage: window.canGoNextPage,
|
|
135
|
+
canGoPreviousPage: window.canGoPreviousPage,
|
|
136
|
+
firstIcon: renderPresentationIcon({
|
|
137
|
+
componentSet,
|
|
138
|
+
icon: collectionChromeIconIds.paginationFirstPage,
|
|
139
|
+
module,
|
|
140
|
+
subject: slot,
|
|
141
|
+
}),
|
|
142
|
+
isFetching,
|
|
143
|
+
loadingIcon: renderPresentationIcon({
|
|
144
|
+
className: 'size-3.5 animate-spin text-sky-700',
|
|
145
|
+
componentSet,
|
|
146
|
+
icon: collectionChromeIconIds.paginationLoading,
|
|
147
|
+
module,
|
|
148
|
+
subject: slot,
|
|
149
|
+
}),
|
|
150
|
+
nextIcon: renderPresentationIcon({
|
|
151
|
+
componentSet,
|
|
152
|
+
icon: collectionChromeIconIds.paginationNextPage,
|
|
153
|
+
module,
|
|
154
|
+
subject: slot,
|
|
155
|
+
}),
|
|
156
|
+
onFirstPage: window.goToFirstPage,
|
|
157
|
+
onNextPage: window.goToNextPage,
|
|
158
|
+
onPreviousPage: window.goToPreviousPage,
|
|
159
|
+
pageLabel,
|
|
160
|
+
pageSizeLabel: `${pageInfo.pageSize.toLocaleString()} per page`,
|
|
161
|
+
previousIcon: renderPresentationIcon({
|
|
162
|
+
componentSet,
|
|
163
|
+
icon: collectionChromeIconIds.paginationPreviousPage,
|
|
164
|
+
module,
|
|
165
|
+
subject: slot,
|
|
166
|
+
}),
|
|
167
|
+
shownLabel: `${pageInfo.itemCount.toLocaleString()} shown`,
|
|
168
|
+
slotId: slot.Id,
|
|
169
|
+
totalLabel,
|
|
170
|
+
viewId,
|
|
171
|
+
})
|
|
172
|
+
}
|
|
173
|
+
|
|
174
|
+
/**
|
|
175
|
+
* Renders the collection query form chrome around the projected query form.
|
|
176
|
+
*
|
|
177
|
+
* Query forms without a backing input form are rendered without the standard
|
|
178
|
+
* chrome wrapper so the backend projection can supply a fully custom surface.
|
|
179
|
+
*/
|
|
180
|
+
function renderStandardCollectionQueryForm({
|
|
181
|
+
componentSystem,
|
|
182
|
+
module,
|
|
183
|
+
renderQueryFormSlot,
|
|
184
|
+
slot,
|
|
185
|
+
viewId,
|
|
186
|
+
}: ProjectedCollectionChromeSlotRenderContext<object>) {
|
|
187
|
+
if (shouldSuppressStandardCollectionChromeSlot(slot)) {
|
|
188
|
+
return null
|
|
189
|
+
}
|
|
190
|
+
|
|
191
|
+
if (shouldRenderQueryFormWithoutChrome({ module, slot })) {
|
|
192
|
+
return renderQueryFormSlot?.(slot) ?? null
|
|
193
|
+
}
|
|
194
|
+
|
|
195
|
+
const children = renderQueryFormSlot?.(slot) ?? null
|
|
196
|
+
if (children === null || children === undefined || children === false) {
|
|
197
|
+
return null
|
|
198
|
+
}
|
|
199
|
+
|
|
200
|
+
return componentSystem.collectionChrome.CollectionQueryFormSlot({
|
|
201
|
+
children,
|
|
202
|
+
slotId: slot.Id,
|
|
203
|
+
viewId,
|
|
204
|
+
})
|
|
205
|
+
}
|
|
206
|
+
|
|
207
|
+
/**
|
|
208
|
+
* Determines whether a query-form slot represents a custom projection rather
|
|
209
|
+
* than a standard input form projection.
|
|
210
|
+
*/
|
|
211
|
+
function shouldRenderQueryFormWithoutChrome({
|
|
212
|
+
module,
|
|
213
|
+
slot,
|
|
214
|
+
}: Pick<ProjectedCollectionChromeSlotRenderContext<object>, 'module' | 'slot'>) {
|
|
215
|
+
if (!slot.QueryFormId) {
|
|
216
|
+
return false
|
|
217
|
+
}
|
|
218
|
+
|
|
219
|
+
const queryForm = findPresentationQueryForm(module ?? null, slot.QueryFormId)
|
|
220
|
+
return Boolean(
|
|
221
|
+
queryForm &&
|
|
222
|
+
!findPresentationInputForm(module ?? null, queryForm.FormId),
|
|
223
|
+
)
|
|
224
|
+
}
|
|
225
|
+
|
|
226
|
+
/**
|
|
227
|
+
* Renders the summary slot using the component system's collection chrome
|
|
228
|
+
* wrapper and the caller-provided summary projection.
|
|
229
|
+
*/
|
|
230
|
+
function renderStandardCollectionSummary({
|
|
231
|
+
componentSystem,
|
|
232
|
+
renderSummarySlot,
|
|
233
|
+
slot,
|
|
234
|
+
viewId,
|
|
235
|
+
}: ProjectedCollectionChromeSlotRenderContext<object>) {
|
|
236
|
+
if (shouldSuppressStandardCollectionChromeSlot(slot)) {
|
|
237
|
+
return null
|
|
238
|
+
}
|
|
239
|
+
|
|
240
|
+
return componentSystem.collectionChrome.CollectionSummarySlot({
|
|
241
|
+
children: renderSummarySlot?.(slot) ?? null,
|
|
242
|
+
slotId: slot.Id,
|
|
243
|
+
viewId,
|
|
244
|
+
})
|
|
245
|
+
}
|
|
246
|
+
|
|
247
|
+
/**
|
|
248
|
+
* Renders the toolbar surface for actions that target the current collection
|
|
249
|
+
* selection.
|
|
250
|
+
*/
|
|
251
|
+
function renderStandardCollectionSelectionActionsToolbar({
|
|
252
|
+
canExecuteAction,
|
|
253
|
+
collectionRuntime,
|
|
254
|
+
componentSet,
|
|
255
|
+
componentSystem,
|
|
256
|
+
executeAction,
|
|
257
|
+
module,
|
|
258
|
+
renderActionIcon,
|
|
259
|
+
slot,
|
|
260
|
+
}: ProjectedCollectionChromeSlotRenderContext<object>) {
|
|
261
|
+
if (shouldSuppressStandardCollectionChromeSlot(slot)) {
|
|
262
|
+
return null
|
|
263
|
+
}
|
|
264
|
+
|
|
265
|
+
return (
|
|
266
|
+
<ProjectedCollectionSelectionActionToolbar
|
|
267
|
+
canExecuteAction={canExecuteAction}
|
|
268
|
+
collectionRuntime={collectionRuntime}
|
|
269
|
+
componentSet={componentSet}
|
|
270
|
+
componentSystem={componentSystem}
|
|
271
|
+
executeAction={executeAction}
|
|
272
|
+
module={module}
|
|
273
|
+
renderActionIcon={renderActionIcon}
|
|
274
|
+
slot={slot}
|
|
275
|
+
/>
|
|
276
|
+
)
|
|
277
|
+
}
|
|
278
|
+
|
|
279
|
+
/**
|
|
280
|
+
* Renders the detail slot using the component system's collection chrome
|
|
281
|
+
* wrapper and the caller-provided detail projection.
|
|
282
|
+
*/
|
|
283
|
+
function renderStandardCollectionDetail({
|
|
284
|
+
componentSystem,
|
|
285
|
+
renderDetailSlot,
|
|
286
|
+
slot,
|
|
287
|
+
viewId,
|
|
288
|
+
}: ProjectedCollectionChromeSlotRenderContext<object>) {
|
|
289
|
+
if (shouldSuppressStandardCollectionChromeSlot(slot)) {
|
|
290
|
+
return null
|
|
291
|
+
}
|
|
292
|
+
|
|
293
|
+
return componentSystem.collectionChrome.CollectionDetailSlot({
|
|
294
|
+
children: renderDetailSlot?.(slot) ?? null,
|
|
295
|
+
slotId: slot.Id,
|
|
296
|
+
viewId,
|
|
297
|
+
})
|
|
298
|
+
}
|
|
299
|
+
|
|
300
|
+
/**
|
|
301
|
+
* Renders the body slot using the component system's collection chrome wrapper
|
|
302
|
+
* and the caller-provided body projection.
|
|
303
|
+
*/
|
|
304
|
+
function renderStandardCollectionBody({
|
|
305
|
+
componentSystem,
|
|
306
|
+
renderBodySlot,
|
|
307
|
+
slot,
|
|
308
|
+
viewId,
|
|
309
|
+
}: ProjectedCollectionChromeSlotRenderContext<object>) {
|
|
310
|
+
if (shouldSuppressStandardCollectionChromeSlot(slot)) {
|
|
311
|
+
return null
|
|
312
|
+
}
|
|
313
|
+
|
|
314
|
+
return componentSystem.collectionChrome.CollectionBodySlot({
|
|
315
|
+
children: renderBodySlot?.(slot) ?? null,
|
|
316
|
+
slotId: slot.Id,
|
|
317
|
+
viewId,
|
|
318
|
+
})
|
|
319
|
+
}
|
|
320
|
+
|
|
321
|
+
/**
|
|
322
|
+
* Renders row-scoped actions for the current collection row.
|
|
323
|
+
*
|
|
324
|
+
* A caller-provided row action slot renderer takes precedence over the standard
|
|
325
|
+
* projected row action component. The slot is skipped outside row context.
|
|
326
|
+
*/
|
|
327
|
+
function renderStandardCollectionRowActions({
|
|
328
|
+
canExecuteAction,
|
|
329
|
+
collectionRuntime,
|
|
330
|
+
componentSet,
|
|
331
|
+
componentSystem,
|
|
332
|
+
executeAction,
|
|
333
|
+
module,
|
|
334
|
+
renderActionIcon,
|
|
335
|
+
renderRowActionsSlot,
|
|
336
|
+
row,
|
|
337
|
+
rowLabel,
|
|
338
|
+
slot,
|
|
339
|
+
viewId,
|
|
340
|
+
}: ProjectedCollectionChromeSlotRenderContext<object>) {
|
|
341
|
+
if (shouldSuppressStandardCollectionChromeSlot(slot) || !row) {
|
|
342
|
+
return null
|
|
343
|
+
}
|
|
344
|
+
|
|
345
|
+
return renderRowActionsSlot?.(slot, row, rowLabel ?? null) ?? (
|
|
346
|
+
<ProjectedCollectionRowActions
|
|
347
|
+
canExecuteAction={canExecuteAction}
|
|
348
|
+
collectionRuntime={collectionRuntime}
|
|
349
|
+
componentSet={componentSet}
|
|
350
|
+
componentSystem={componentSystem}
|
|
351
|
+
executeAction={executeAction}
|
|
352
|
+
module={module}
|
|
353
|
+
renderActionIcon={renderActionIcon}
|
|
354
|
+
row={row}
|
|
355
|
+
rowLabel={rowLabel ?? null}
|
|
356
|
+
slot={slot}
|
|
357
|
+
viewId={viewId}
|
|
358
|
+
/>
|
|
359
|
+
)
|
|
360
|
+
}
|
|
361
|
+
|
|
362
|
+
/**
|
|
363
|
+
* Checks whether a slot's projection annotation opts out of the standard
|
|
364
|
+
* renderer.
|
|
365
|
+
*
|
|
366
|
+
* A boolean annotation value suppresses directly. Object annotation values use
|
|
367
|
+
* `suppressDefaultRenderer` so other projection options can share the same
|
|
368
|
+
* annotation payload.
|
|
369
|
+
*/
|
|
370
|
+
function shouldSuppressStandardCollectionChromeSlot(
|
|
371
|
+
slot: CollectionChromeSlotDefinition,
|
|
372
|
+
) {
|
|
373
|
+
return slot.Annotations.some((annotation) => {
|
|
374
|
+
if (annotation.Name.toLocaleLowerCase() !== collectionChromeSlotProjectionAnnotationName) {
|
|
375
|
+
return false
|
|
376
|
+
}
|
|
377
|
+
|
|
378
|
+
const value = annotation.Value
|
|
379
|
+
if (typeof value === 'boolean') {
|
|
380
|
+
return value
|
|
381
|
+
}
|
|
382
|
+
|
|
383
|
+
if (!value || typeof value !== 'object') {
|
|
384
|
+
return false
|
|
385
|
+
}
|
|
386
|
+
|
|
387
|
+
return Boolean(
|
|
388
|
+
(value as Readonly<Record<string, unknown>>).suppressDefaultRenderer,
|
|
389
|
+
)
|
|
390
|
+
})
|
|
391
|
+
}
|