@phis/ui 0.8.0 → 0.8.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/components/cms/phi-cms-layout-renderer.js +15 -7
- package/components/cms/phi-cms-render-diagnostic-client.d.ts +3 -1
- package/components/cms/phi-cms-render-diagnostic-client.js +4 -3
- package/components/cms/phi-cms-render-diagnostic.d.ts +8 -2
- package/components/cms/phi-cms-render-diagnostic.js +12 -2
- package/components/cms/phi-cms-render-error-boundary.d.ts +2 -0
- package/components/cms/phi-cms-render-error-boundary.js +1 -1
- package/components/cms/phi-cms-root-layout.js +3 -1
- package/components/controls/phi-media-picker-control.d.ts +9 -0
- package/components/controls/phi-media-picker-control.js +1 -1
- package/components/controls/phi-popover-control.js +4 -1
- package/components/controls/phi-table-control.d.ts +7 -1
- package/components/controls/phi-table-control.js +23 -8
- package/components/forms/form-descriptor-field-check.d.ts +18 -0
- package/components/forms/form-descriptor-field-check.js +41 -0
- package/components/forms/form-descriptor-runtime-client.js +11 -10
- package/components/forms/form-record-source.d.ts +38 -0
- package/components/forms/form-record-source.js +48 -0
- package/components/forms/shared-form-descriptors.d.ts +0 -34
- package/components/forms/shared-form-descriptors.js +0 -6
- package/components/forms/shared-form-ids.d.ts +1 -1
- package/components/forms/shared-form-ids.js +1 -1
- package/components/media/media-settings-labels.d.ts +1 -0
- package/components/media/media-settings-labels.js +2 -0
- package/components/media/phi-media-picker-binding.d.ts +41 -33
- package/components/media/phi-media-picker-binding.js +2 -1
- package/components/media/use-media-library-add-picker.d.ts +33 -32
- package/components/overlays/phi-overlay-container-client.js +11 -9
- package/components/regions/presets/phi-settings-page-shell-tree.d.ts +7 -0
- package/components/regions/presets/phi-settings-page-shell-tree.js +3 -3
- package/components/shell/phi-icon-names.d.ts +3 -0
- package/components/shell/phi-icon-names.js +3 -0
- package/components/shell/phi-icon.d.ts +5 -7
- package/components/shell/phi-icon.js +8 -21
- package/components/tables/client/phi-table-binding-params.d.ts +24 -0
- package/components/tables/client/phi-table-binding-params.js +39 -0
- package/components/tables/client/phi-table-binding.d.ts +1 -3
- package/components/tables/client/phi-table-binding.js +5 -9
- package/components/widgets/client/shared/phi-button-icons.d.ts +6 -4
- package/components/widgets/client/shared/phi-button-icons.js +8 -12
- package/components/widgets/client/shared/phi-collection-binding-params.d.ts +8 -0
- package/components/widgets/client/shared/phi-collection-binding-params.js +13 -0
- package/components/widgets/client/shared/phi-collection-provider.d.ts +11 -1
- package/components/widgets/client/shared/phi-collection-provider.js +5 -0
- package/components/widgets/client/shared/phi-collection-view-binding.d.ts +1 -0
- package/components/widgets/client/shared/phi-command-buttons.d.ts +16 -0
- package/components/widgets/client/shared/phi-command-buttons.js +9 -1
- package/components/widgets/label-sets/admin-users.d.ts +1 -0
- package/components/widgets/label-sets/admin-users.js +2 -0
- package/components/widgets/label-sets/builder-modules.js +4 -0
- package/components/widgets/label-sets/profile.d.ts +0 -16
- package/components/widgets/label-sets/profile.js +0 -37
- package/components/widgets/label-sets/registration.d.ts +0 -1
- package/components/widgets/label-sets/registration.js +0 -2
- package/components/widgets/label-sets/revisions.js +2 -0
- package/components/widgets/label-sets/signals.js +2 -0
- package/components/widgets/label-types/builder-modules.d.ts +4 -0
- package/components/widgets/label-types/builder-modules.js +2 -0
- package/components/widgets/label-types/revisions.d.ts +2 -0
- package/components/widgets/label-types/revisions.js +2 -1
- package/components/widgets/label-types/signals.d.ts +2 -0
- package/components/widgets/label-types/signals.js +1 -0
- package/components/widgets/shared/widget-failure-audience.d.ts +7 -0
- package/components/widgets/shared/widget-failure-audience.js +21 -0
- package/components/widgets/shared/widget-failure-client.js +5 -2
- package/components/widgets/shared/widget-failure-notice-client.d.ts +6 -0
- package/components/widgets/shared/widget-failure-notice-client.js +10 -0
- package/components/widgets/shared/widget-failure-notice.d.ts +6 -0
- package/components/widgets/shared/widget-failure-notice.js +17 -0
- package/components/widgets/shared/widget-failure-staff.d.ts +3 -0
- package/components/widgets/shared/widget-failure-staff.js +18 -0
- package/components/widgets/shared/widget-failure.d.ts +9 -6
- package/components/widgets/shared/widget-failure.js +0 -9
- package/components/widgets/shared/widget-failure.server.d.ts +4 -2
- package/components/widgets/shared/widget-failure.server.js +8 -3
- package/constants/customer-file.d.ts +12 -3
- package/constants/customer-file.js +12 -3
- package/constants/runtime-module-ownership.js +4 -3
- package/constants/site-address.d.ts +9 -0
- package/constants/site-address.js +10 -0
- package/constants/table-loading.d.ts +14 -0
- package/constants/table-loading.js +14 -0
- package/constants.d.ts +2 -1
- package/constants.js +3 -1
- package/gateway/site-cms-write-validation.js +19 -3
- package/helpers/announced-action.d.ts +17 -0
- package/helpers/announced-action.js +29 -0
- package/helpers/phi-metadata.d.ts +0 -8
- package/helpers/phi-metadata.js +1 -10
- package/helpers/phi-site-description.d.ts +11 -0
- package/helpers/phi-site-description.js +13 -0
- package/helpers/preset-form-check.d.ts +14 -0
- package/helpers/preset-form-check.js +12 -0
- package/helpers/preset-table-check.d.ts +19 -15
- package/helpers/preset-table-check.js +33 -39
- package/helpers/record-widget-binding.d.ts +10 -0
- package/helpers/record-widget-binding.js +35 -0
- package/helpers/record-widget.d.ts +1 -10
- package/helpers/record-widget.js +4 -33
- package/helpers/table-widget-binding.d.ts +12 -0
- package/helpers/table-widget-binding.js +296 -0
- package/helpers/tree-widget-binding.d.ts +19 -0
- package/helpers/tree-widget-binding.js +72 -0
- package/helpers/typed-confirmation.d.ts +9 -0
- package/helpers/typed-confirmation.js +13 -0
- package/helpers/widget-binding-check.d.ts +22 -0
- package/helpers/widget-binding-check.js +91 -0
- package/module-page-check.d.ts +2 -0
- package/module-page-check.js +2 -0
- package/next/root-route.js +2 -1
- package/package.json +1 -1
- package/plugins/runtime-modules/accounting/ids.d.ts +7 -4
- package/plugins/runtime-modules/accounting/ids.js +14 -3
- package/plugins/runtime-modules/accounting/trees/accounting-customer-file-label-set.d.ts +21 -9
- package/plugins/runtime-modules/accounting/trees/accounting-customer-file-label-set.js +29 -15
- package/plugins/runtime-modules/accounting/trees/phi-default-accounting-customer-file-page-tree.d.ts +11 -8
- package/plugins/runtime-modules/accounting/trees/phi-default-accounting-customer-file-page-tree.js +206 -137
- package/plugins/runtime-modules/app/client-data-providers.js +1 -1
- package/plugins/runtime-modules/app/data-providers.d.ts +14 -69
- package/plugins/runtime-modules/app/data-providers.js +19 -54
- package/plugins/runtime-modules/app/definition.d.ts +8 -80
- package/plugins/runtime-modules/app/forms.d.ts +1 -16
- package/plugins/runtime-modules/app/forms.js +0 -59
- package/plugins/runtime-modules/app/ids.d.ts +2 -1
- package/plugins/runtime-modules/app/ids.js +3 -2
- package/plugins/runtime-modules/app/module.d.ts +8 -80
- package/plugins/runtime-modules/app/services/addresses-collection.d.ts +59 -0
- package/plugins/runtime-modules/app/services/{addresses-table.js → addresses-collection.js} +23 -19
- package/plugins/runtime-modules/app/trees/account-addresses-panel.d.ts +10 -6
- package/plugins/runtime-modules/app/trees/account-addresses-panel.js +37 -73
- package/plugins/runtime-modules/app/trees/addresses-label-set.d.ts +0 -5
- package/plugins/runtime-modules/app/trees/addresses-label-set.js +2 -6
- package/plugins/runtime-modules/app/trees/phi-default-app-profile-page-tree.d.ts +1 -2
- package/plugins/runtime-modules/app/trees/phi-default-app-profile-page-tree.js +1 -17
- package/plugins/runtime-modules/app/trees/profile-label-set.d.ts +0 -2
- package/plugins/runtime-modules/app/trees/profile-label-set.js +2 -14
- package/plugins/runtime-modules/asset/trees/phi-default-admin-media-settings-page-tree.js +5 -0
- package/plugins/runtime-modules/builder/clients/inspector-config-field.js +16 -6
- package/plugins/runtime-modules/builder/clients/inspector-image-field.js +3 -1
- package/plugins/runtime-modules/builder/clients/inspector-section-widget.js +3 -1
- package/plugins/runtime-modules/builder/controller/signal-wiring-controller.js +5 -1
- package/plugins/runtime-modules/builder/signal-wiring-options.js +9 -2
- package/plugins/runtime-modules/builder/trees/phi-builder-inspector-area-overlay-tree.server.js +5 -0
- package/plugins/runtime-modules/builder/trees/phi-default-builder-area-preset-tree.js +14 -1
- package/plugins/runtime-modules/client-manifests/common.js +6 -0
- package/plugins/runtime-modules/core/widgets/card/config.d.ts +1 -1
- package/plugins/runtime-modules/core/widgets/collection-view/client.js +5 -2
- package/plugins/runtime-modules/core/widgets/collection-view/config.js +8 -0
- package/plugins/runtime-modules/core/widgets/collection-view/site-address-binding.d.ts +55 -0
- package/plugins/runtime-modules/core/widgets/collection-view/site-address-binding.js +173 -0
- package/plugins/runtime-modules/core/widgets/collection-view/site-address-tiles.d.ts +48 -0
- package/plugins/runtime-modules/core/widgets/collection-view/site-address-tiles.js +67 -0
- package/plugins/runtime-modules/core/widgets/command-toolbar/config.d.ts +1 -1
- package/plugins/runtime-modules/core/widgets/description/config.d.ts +1 -1
- package/plugins/runtime-modules/core/widgets/entry-list/config.d.ts +1 -1
- package/plugins/runtime-modules/core/widgets/float-button/config.d.ts +1 -1
- package/plugins/runtime-modules/core/widgets/form/config.d.ts +1 -1
- package/plugins/runtime-modules/core/widgets/form/config.js +14 -1
- package/plugins/runtime-modules/core/widgets/gallery/config.d.ts +1 -1
- package/plugins/runtime-modules/core/widgets/markdown/config.d.ts +1 -1
- package/plugins/runtime-modules/core/widgets/record/client.js +2 -6
- package/plugins/runtime-modules/core/widgets/result/config.d.ts +1 -1
- package/plugins/runtime-modules/core/widgets/simple-text/config.d.ts +1 -1
- package/plugins/runtime-modules/core/widgets/table/client.js +30 -48
- package/plugins/runtime-modules/core/widgets/table/config.d.ts +3 -3
- package/plugins/runtime-modules/core/widgets/table/config.js +3 -0
- package/plugins/runtime-modules/core/widgets/thread-conversation/client.js +2 -2
- package/plugins/runtime-modules/core/widgets/thread-conversation/config.d.ts +6 -2
- package/plugins/runtime-modules/core/widgets/thread-conversation/config.js +6 -1
- package/plugins/runtime-modules/core/widgets/thread-widget-config.d.ts +10 -0
- package/plugins/runtime-modules/core/widgets/thread-widget-config.js +6 -0
- package/plugins/runtime-modules/core/widgets/tree/client.js +6 -6
- package/plugins/runtime-modules/localization/trees/editor-translations-widget-label-set.d.ts +2 -0
- package/plugins/runtime-modules/localization/trees/editor-translations-widget-label-set.js +2 -0
- package/plugins/runtime-modules/localization/trees/phi-default-editor-translations-page-tree.js +5 -0
- package/plugins/runtime-modules/revisions/controller/binding.d.ts +37 -0
- package/plugins/runtime-modules/revisions/controller/binding.js +75 -0
- package/plugins/runtime-modules/revisions/controller/client.d.ts +5 -0
- package/plugins/runtime-modules/revisions/controller/client.js +74 -50
- package/plugins/runtime-modules/revisions/controller/definition.d.ts +5 -0
- package/plugins/runtime-modules/revisions/controller/definition.js +10 -0
- package/plugins/runtime-modules/revisions/forms.js +1 -1
- package/plugins/runtime-modules/revisions/page-ids.d.ts +1 -1
- package/plugins/runtime-modules/revisions/page-ids.js +4 -1
- package/plugins/runtime-modules/revisions/services/options.js +14 -4
- package/plugins/runtime-modules/revisions/services/table.js +41 -21
- package/plugins/runtime-modules/revisions/trees/phi-default-builder-revisions-page-tree.js +76 -3
- package/plugins/runtime-modules/theme/controller/runtime.js +14 -2
- package/plugins/runtime-modules/theme/widgets/brand-controls/client.js +39 -13
- package/plugins/runtime-modules/threads/client-data-providers.js +5 -0
- package/plugins/runtime-modules/threads/controller/client.js +62 -2
- package/plugins/runtime-modules/threads/controller/definition.js +48 -0
- package/plugins/runtime-modules/threads/data-providers.d.ts +22 -37
- package/plugins/runtime-modules/threads/data-providers.js +35 -24
- package/plugins/runtime-modules/threads/definition.d.ts +22 -37
- package/plugins/runtime-modules/threads/ids.d.ts +2 -0
- package/plugins/runtime-modules/threads/ids.js +2 -0
- package/plugins/runtime-modules/threads/services/customer-file-addresses.d.ts +30 -0
- package/plugins/runtime-modules/threads/services/customer-file-addresses.js +59 -0
- package/plugins/runtime-modules/threads/services/customer-file-read.d.ts +22 -0
- package/plugins/runtime-modules/threads/services/customer-file-read.js +101 -0
- package/plugins/runtime-modules/threads/services/customer-file-table.d.ts +14 -80
- package/plugins/runtime-modules/threads/services/customer-file-table.js +27 -112
- package/plugins/runtime-modules/user-management/trees/admin-users-access-label-set.d.ts +4 -0
- package/plugins/runtime-modules/user-management/trees/admin-users-access-label-set.js +4 -0
- package/plugins/runtime-modules/user-management/trees/phi-default-admin-users-access-page-tree.js +15 -0
- package/plugins/runtime-modules/user-management/trees/phi-default-admin-users-page-tree.js +5 -0
- package/server-helpers/runtime.js +0 -1
- package/styles/controls.css +4 -2
- package/styles/layout.css +7 -0
- package/theme/phi-antd-token-resolver.d.ts +8 -0
- package/theme/phi-antd-token-resolver.js +10 -0
- package/theme/phi-theme-color.d.ts +19 -0
- package/theme/phi-theme-color.js +42 -0
- package/theme/phi-theme-gradients.js +4 -22
- package/theme/phi-theme-palette-defaults.d.ts +16 -0
- package/theme/phi-theme-palette-defaults.js +103 -0
- package/types/cms-plugins.d.ts +6 -1
- package/types/collection-provider.d.ts +27 -0
- package/types/collection-signal-values.d.ts +2 -0
- package/types/collection-signal-values.js +23 -0
- package/types/collection-view-widget.d.ts +9 -0
- package/types/core-widget-placements.d.ts +6 -0
- package/types/signals.d.ts +2 -0
- package/types/signals.js +2 -0
- package/types/table-widget.d.ts +15 -1
- package/types/table-widget.js +0 -282
- package/types/tree-widget.d.ts +0 -1
- package/types/tree-widget.js +0 -60
- package/types/widget-runtime.d.ts +0 -1
- package/types.d.ts +1 -1
- package/types.js +1 -1
- package/plugins/runtime-modules/app/services/addresses-table.d.ts +0 -135
|
@@ -117,10 +117,14 @@ function resolveLayoutRegistryType(type) {
|
|
|
117
117
|
* A block that cannot be drawn, said to the person who can do something about it.
|
|
118
118
|
*
|
|
119
119
|
* In a workspace that is the author: the diagnostic sits in the block's own place, names the type and
|
|
120
|
-
* the Module, and the hole is visible where it has to be repaired. On a live page it is
|
|
121
|
-
*
|
|
122
|
-
*
|
|
123
|
-
*
|
|
120
|
+
* the Module, and the hole is visible where it has to be repaired. On a live page it is Staff, who see
|
|
121
|
+
* the same card without the notification (`PhiCmsRenderDiagnostic` with `live`): a config that slipped
|
|
122
|
+
* past the checks where configs are made, a renderer that failed, a node the tree does not hold is a
|
|
123
|
+
* failure nobody would see otherwise (owner, 2026-11-24). A Module switched off in the Area is not one
|
|
124
|
+
* -- its blocks leave with it on purpose -- and stays absent for everybody. A visitor sees nothing: they
|
|
125
|
+
* cannot switch a Module back on and have no business reading a Module id off a page, so the block is
|
|
126
|
+
* simply absent and the rest of the page stands. The warning is written either way, which is where an
|
|
127
|
+
* operator finds it.
|
|
124
128
|
*/
|
|
125
129
|
function renderCmsDiagnostic(issue, renderMode, error) {
|
|
126
130
|
logRuntimeEvent("warn", "cms.render.block_not_renderable", {
|
|
@@ -131,7 +135,9 @@ function renderCmsDiagnostic(issue, renderMode, error) {
|
|
|
131
135
|
error,
|
|
132
136
|
meta: { code: issue.code, detail: issue.detail ?? null, renderMode },
|
|
133
137
|
});
|
|
134
|
-
|
|
138
|
+
if (renderMode !== "live")
|
|
139
|
+
return _jsx(PhiCmsRenderDiagnostic, { issue: issue });
|
|
140
|
+
return issue.code === "missing-module" ? null : _jsx(PhiCmsRenderDiagnostic, { issue: issue, live: true });
|
|
135
141
|
}
|
|
136
142
|
/**
|
|
137
143
|
* A node whose condition reads a Module that could not be asked, said in the node's place.
|
|
@@ -551,6 +557,8 @@ function wrapPhiRenderedSlotChild(node, options) {
|
|
|
551
557
|
if (!isRenderableNode(node)) {
|
|
552
558
|
return node;
|
|
553
559
|
}
|
|
560
|
+
// On a live page a failed block's diagnostic is Staff's alone (`PhiCmsRenderDiagnostic`).
|
|
561
|
+
const live = readPhiRuntimeTreeRenderMode((options.config ?? {})) === "live";
|
|
554
562
|
if (isThenable(node)) {
|
|
555
563
|
/*
|
|
556
564
|
* A Widget that fails while rendering on the server fails alone.
|
|
@@ -562,9 +570,9 @@ function wrapPhiRenderedSlotChild(node, options) {
|
|
|
562
570
|
* which Widget it was. Caught here, where the rejection is, it becomes the same diagnostic the
|
|
563
571
|
* Client Boundary shows -- and everything else on the page still renders on the server.
|
|
564
572
|
*/
|
|
565
|
-
return node.then((resolvedNode) => wrapPhiRenderedSlotChild(resolvedNode, options), (error) => wrapPhiRenderedSlotChild(_jsx(PhiCmsRenderDiagnostic, { issue: buildPhiRenderFailureIssue(error, options) }), options));
|
|
573
|
+
return node.then((resolvedNode) => wrapPhiRenderedSlotChild(resolvedNode, options), (error) => wrapPhiRenderedSlotChild(_jsx(PhiCmsRenderDiagnostic, { issue: buildPhiRenderFailureIssue(error, options), live: live }), options));
|
|
566
574
|
}
|
|
567
|
-
const framed = (_jsx(PhiSlotChildFrame, { kind: options.kind, slotSizePolicy: options.slotSizePolicy, surfacePolicy: options.surfacePolicy, blockId: options.blockId, config: options.config, runtime: options.signalRuntime, signalScope: options.signalScope, signalParticipant: options.signalParticipant, children: _jsx(PhiCmsRenderErrorBoundary, { kind: options.kind, blockId: options.blockId, typeKey: options.typeKey, moduleId: options.moduleId, children: node }) }, options.key));
|
|
575
|
+
const framed = (_jsx(PhiSlotChildFrame, { kind: options.kind, slotSizePolicy: options.slotSizePolicy, surfacePolicy: options.surfacePolicy, blockId: options.blockId, config: options.config, runtime: options.signalRuntime, signalScope: options.signalScope, signalParticipant: options.signalParticipant, children: _jsx(PhiCmsRenderErrorBoundary, { kind: options.kind, blockId: options.blockId, typeKey: options.typeKey, moduleId: options.moduleId, live: live, children: node }) }, options.key));
|
|
568
576
|
/*
|
|
569
577
|
* The gate goes outside the slot frame, so a node that stays away takes its frame with it. Inside it,
|
|
570
578
|
* the frame would still be in the slot -- an empty box between two visible ones, which a Layout with
|
|
@@ -1,4 +1,6 @@
|
|
|
1
1
|
import type { PhiCmsRenderIssue } from "../../types/cms-plugins";
|
|
2
|
-
|
|
2
|
+
/** `quiet` draws the card without the notification, for Staff reading a live page. */
|
|
3
|
+
export declare function PhiCmsRenderDiagnostic({ issue, quiet }: {
|
|
3
4
|
issue: PhiCmsRenderIssue;
|
|
5
|
+
quiet?: boolean;
|
|
4
6
|
}): import("react").JSX.Element;
|
|
@@ -36,7 +36,8 @@ function buildIssueDescription(issue) {
|
|
|
36
36
|
function buildIssueKey(issue) {
|
|
37
37
|
return [issue.kind, issue.type, issue.code, issue.moduleId ?? "unknown"].join(":");
|
|
38
38
|
}
|
|
39
|
-
|
|
39
|
+
/** `quiet` draws the card without the notification, for Staff reading a live page. */
|
|
40
|
+
export function PhiCmsRenderDiagnostic({ issue, quiet = false }) {
|
|
40
41
|
const { showNotification } = usePhiApplicationFeedback();
|
|
41
42
|
const issueKey = buildIssueKey(issue);
|
|
42
43
|
const title = buildIssueTitle(issue);
|
|
@@ -44,7 +45,7 @@ export function PhiCmsRenderDiagnostic({ issue }) {
|
|
|
44
45
|
useEffect(() => {
|
|
45
46
|
console.warn(`[phi-cms-render-diagnostic] ${title}: ${description} ` +
|
|
46
47
|
`(code=${issue.code}, blockId=${issue.blockId ?? "unknown"})`);
|
|
47
|
-
if (issue.code === "missing-module") {
|
|
48
|
+
if (quiet || issue.code === "missing-module") {
|
|
48
49
|
return;
|
|
49
50
|
}
|
|
50
51
|
if (notifiedIssueKeys.has(issueKey)) {
|
|
@@ -58,7 +59,7 @@ export function PhiCmsRenderDiagnostic({ issue }) {
|
|
|
58
59
|
placement: "bottomRight",
|
|
59
60
|
durationSeconds: 6,
|
|
60
61
|
});
|
|
61
|
-
}, [description, issue.blockId, issue.code, issue.detail, issue.kind, issue.moduleId, issue.type, issueKey, showNotification, title]);
|
|
62
|
+
}, [description, issue.blockId, issue.code, issue.detail, issue.kind, issue.moduleId, issue.type, issueKey, quiet, showNotification, title]);
|
|
62
63
|
return (_jsx("div", { "data-phi-cms-render-diagnostic": issue.kind, "data-phi-cms-render-diagnostic-code": issue.code, "data-phi-cms-render-diagnostic-type": issue.type, "data-phi-cms-render-diagnostic-block-id": issue.blockId ?? undefined, "data-phi-cms-render-diagnostic-module": issue.moduleId ?? undefined, children: _jsx(PhiAlertControl, { level: "error", showIcon: true, title: title, description: (_jsxs("div", { children: [_jsx(PhiTypographyControl, { code: true, children: issue.type }), _jsx("br", {}), _jsx(PhiTypographyControl, { children: issue.code === "missing-module"
|
|
63
64
|
? issue.moduleId
|
|
64
65
|
? `Missing module: ${issue.moduleId}`
|
|
@@ -1,4 +1,10 @@
|
|
|
1
1
|
import type { PhiCmsRenderIssue } from "../../types/cms-plugins";
|
|
2
|
-
|
|
2
|
+
/**
|
|
3
|
+
* `live` for a block that failed on a live page: drawn for Staff only (`usePhiWidgetFailureStaff`), in
|
|
4
|
+
* its place and without the notification a workspace raises, and for a visitor not at all -- the chunk
|
|
5
|
+
* is not even fetched.
|
|
6
|
+
*/
|
|
7
|
+
export declare function PhiCmsRenderDiagnostic({ issue, live }: {
|
|
3
8
|
issue: PhiCmsRenderIssue;
|
|
4
|
-
|
|
9
|
+
live?: boolean;
|
|
10
|
+
}): import("react").JSX.Element | null;
|
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
"use client";
|
|
2
2
|
import { jsx as _jsx } from "react/jsx-runtime";
|
|
3
3
|
import { lazy, Suspense } from "react";
|
|
4
|
+
import { usePhiWidgetFailureStaff } from "../widgets/shared/widget-failure-audience";
|
|
4
5
|
/**
|
|
5
6
|
* Lazy boundary for the render diagnostic. The layout renderer references the diagnostic from
|
|
6
7
|
* the server graph on every route, so a direct implementation here would put its antd surface
|
|
@@ -10,6 +11,15 @@ import { lazy, Suspense } from "react";
|
|
|
10
11
|
const PhiCmsRenderDiagnosticImplementation = lazy(async () => ({
|
|
11
12
|
default: (await import("./phi-cms-render-diagnostic-client")).PhiCmsRenderDiagnostic,
|
|
12
13
|
}));
|
|
13
|
-
|
|
14
|
-
|
|
14
|
+
/**
|
|
15
|
+
* `live` for a block that failed on a live page: drawn for Staff only (`usePhiWidgetFailureStaff`), in
|
|
16
|
+
* its place and without the notification a workspace raises, and for a visitor not at all -- the chunk
|
|
17
|
+
* is not even fetched.
|
|
18
|
+
*/
|
|
19
|
+
export function PhiCmsRenderDiagnostic({ issue, live = false }) {
|
|
20
|
+
const staff = usePhiWidgetFailureStaff();
|
|
21
|
+
if (live && !staff) {
|
|
22
|
+
return null;
|
|
23
|
+
}
|
|
24
|
+
return (_jsx(Suspense, { fallback: null, children: _jsx(PhiCmsRenderDiagnosticImplementation, { issue: issue, quiet: live }) }));
|
|
15
25
|
}
|
|
@@ -14,6 +14,8 @@ export type PhiCmsRenderErrorBoundaryProps = {
|
|
|
14
14
|
* be taken out of the tree it broke.
|
|
15
15
|
*/
|
|
16
16
|
renderDiagnostic?: (diagnostic: ReactNode) => ReactNode;
|
|
17
|
+
/** The block is on a live page, where only Staff read its diagnostic (`PhiCmsRenderDiagnostic`). */
|
|
18
|
+
live?: boolean;
|
|
17
19
|
children: ReactNode;
|
|
18
20
|
};
|
|
19
21
|
type PhiCmsRenderErrorBoundaryState = {
|
|
@@ -27,7 +27,7 @@ export class PhiCmsRenderErrorBoundary extends Component {
|
|
|
27
27
|
blockId: this.props.blockId,
|
|
28
28
|
moduleId: this.props.moduleId,
|
|
29
29
|
detail: this.state.error.message,
|
|
30
|
-
} });
|
|
30
|
+
}, live: this.props.live });
|
|
31
31
|
return this.props.renderDiagnostic ? this.props.renderDiagnostic(diagnostic) : diagnostic;
|
|
32
32
|
}
|
|
33
33
|
return this.props.children;
|
|
@@ -19,6 +19,8 @@ import { resolvePhiUnauthenticatedLoginHref, } from "../../server-helpers/public
|
|
|
19
19
|
import { isPhiCmsGatewayAuthError } from "../../gateway/errors";
|
|
20
20
|
import { PhiRuntimeControllerServerHost } from "../runtime/runtime-controller-server-host";
|
|
21
21
|
import { PhiRuntimeModuleProvider } from "../runtime/runtime-module-context";
|
|
22
|
+
import { PhiWidgetFailureAudienceProvider } from "../widgets/shared/widget-failure-audience";
|
|
23
|
+
import { canPhiViewerReadWidgetFailures } from "../widgets/shared/widget-failure-staff";
|
|
22
24
|
import { PhiModuleIconsProvider } from "../shell/phi-module-icons";
|
|
23
25
|
import { collectPhiModuleIconSets } from "../../helpers/module-icons";
|
|
24
26
|
import { PhiRuntimeModuleDataProviderHost } from "../runtime/runtime-module-data-provider-host";
|
|
@@ -172,7 +174,7 @@ export async function PhiCmsAreaBoundary({ root, cmsBridge, children, path, page
|
|
|
172
174
|
...runtimeModuleScope.moduleSet.mediaSourceDescriptorsByKey.values(),
|
|
173
175
|
], videoProviderDescriptors: [
|
|
174
176
|
...runtimeModuleScope.moduleSet.videoProviderDescriptorsByKey.values(),
|
|
175
|
-
], children: _jsx(PhiModuleIconsProvider, { sets: collectPhiModuleIconSets(runtimeModuleScope.moduleSet.moduleDefinitionsById.values()), children: _jsxs(PhiRuntimeModuleDataProviderHost, { providerKeys: [...scope.runtimeRegistry.dataProviderDescriptorsByKey.keys()], children: [areaControllers.registeredControllerSettings && areaControllers.registeredControllerSettings.length > 0 ? (_jsx(PhiRuntimeControllerServerHost, { controllers: areaControllers.registeredControllerSettings, runtime: runtime, registry: areaControllers.controllerDefinitionsByType, controllerModuleIdsByType: runtimeModuleScope.moduleSet.ownerModuleIdByControllerType, runtimeModuleCatalog: scope.runtimeRegistry.runtimeModuleCatalog, serverCapabilities: scope.runtimeRegistry.serverCapabilities })) : null, children, filteredLayoutTree ? (_jsx(PhiCmsOverlayRenderer, { tree: filteredLayoutTree, runtime: runtime, registry: scope.runtimeRegistry, signalScope: "area", deferredOrigin: { area: runtime.area, root, path: path ?? pagePath ?? null } })) : null] }) }) }) }));
|
|
177
|
+
], children: _jsx(PhiModuleIconsProvider, { sets: collectPhiModuleIconSets(runtimeModuleScope.moduleSet.moduleDefinitionsById.values()), children: _jsx(PhiWidgetFailureAudienceProvider, { staff: canPhiViewerReadWidgetFailures(runtime.viewer), children: _jsxs(PhiRuntimeModuleDataProviderHost, { providerKeys: [...scope.runtimeRegistry.dataProviderDescriptorsByKey.keys()], children: [areaControllers.registeredControllerSettings && areaControllers.registeredControllerSettings.length > 0 ? (_jsx(PhiRuntimeControllerServerHost, { controllers: areaControllers.registeredControllerSettings, runtime: runtime, registry: areaControllers.controllerDefinitionsByType, controllerModuleIdsByType: runtimeModuleScope.moduleSet.ownerModuleIdByControllerType, runtimeModuleCatalog: scope.runtimeRegistry.runtimeModuleCatalog, serverCapabilities: scope.runtimeRegistry.serverCapabilities })) : null, children, filteredLayoutTree ? (_jsx(PhiCmsOverlayRenderer, { tree: filteredLayoutTree, runtime: runtime, registry: scope.runtimeRegistry, signalScope: "area", deferredOrigin: { area: runtime.area, root, path: path ?? pagePath ?? null } })) : null] }) }) }) }) }));
|
|
176
178
|
}
|
|
177
179
|
/**
|
|
178
180
|
* The Area-owned Regions around a Page, or nothing but the grid they share.
|
|
@@ -49,6 +49,15 @@ export type PhiMediaPickerControlProps = PhiPickerTransactionCallbacks<number |
|
|
|
49
49
|
loading?: boolean;
|
|
50
50
|
disabled?: boolean;
|
|
51
51
|
readOnly?: boolean;
|
|
52
|
+
/**
|
|
53
|
+
* Where the picker opens, which the host decides: it knows where the room is. A panel at the window's
|
|
54
|
+
* right, the Builder Inspector, says `left`, towards the canvas. Absent, it opens centred below: the
|
|
55
|
+
* library is wider than most panels, and opened beside a panel at the window's left it ran past the
|
|
56
|
+
* window's edge and the page scrolled sideways (the Theme's Link preview, 2026-11-24). Ant Design's
|
|
57
|
+
* overflow adjustment is on for every placement (`PhiPopoverControl`), and the width is capped to the
|
|
58
|
+
* window; centred below it slides sideways and upwards into the window, which a corner placement such
|
|
59
|
+
* as `bottomLeft` does not.
|
|
60
|
+
*/
|
|
52
61
|
placement?: PhiPickerPlacement;
|
|
53
62
|
showSearchBar?: boolean;
|
|
54
63
|
showFolderFilter?: boolean;
|
|
@@ -17,7 +17,7 @@ import { PhiSliderControl } from "./phi-slider-control";
|
|
|
17
17
|
import { PhiTextControl } from "./phi-text-control";
|
|
18
18
|
import { usePhiImmediatePicker } from "./use-phi-immediate-picker";
|
|
19
19
|
import { PhiIcon } from "../shell/phi-icon";
|
|
20
|
-
export function PhiMediaPickerControl({ open, value = null, assets, spaces = [], spaceValue = null, sources = [], sourceValue = "", sourceItems = [], sourceHasMore = false, importingItemId = null, sourceNotice = null, uploadPanel, uploadNotice = null, folders = [], folderValue = "/", query = "", page = 1, pageSize = 20, total = assets.length, minColumnWidth = PHI_MEDIA_PICKER_DEFAULT_COLUMN_WIDTH, loading, disabled, readOnly, placement = "
|
|
20
|
+
export function PhiMediaPickerControl({ open, value = null, assets, spaces = [], spaceValue = null, sources = [], sourceValue = "", sourceItems = [], sourceHasMore = false, importingItemId = null, sourceNotice = null, uploadPanel, uploadNotice = null, folders = [], folderValue = "/", query = "", page = 1, pageSize = 20, total = assets.length, minColumnWidth = PHI_MEDIA_PICKER_DEFAULT_COLUMN_WIDTH, loading, disabled, readOnly, placement = "bottom", showSearchBar = true, showFolderFilter = true, showPagination = true, trigger, isAssetSelectable, labels, getPopupContainer, popupRootClassName, onOpenChange, onQueryChange, onSpaceChange, onSourceChange, onSourceItemSelect, onSourceLoadMore, onFolderChange, onPageChange, onMinColumnWidthChange, onReload, onChange, onCommit, onDiscard, }) {
|
|
21
21
|
const { token } = usePhiConfig();
|
|
22
22
|
const locked = disabled || readOnly;
|
|
23
23
|
const resolvedMinColumnWidth = normalizePhiMediaPickerMinColumnWidth(minColumnWidth);
|
|
@@ -3,7 +3,10 @@ import { jsx as _jsx } from "react/jsx-runtime";
|
|
|
3
3
|
import { Popover } from "antd";
|
|
4
4
|
import { PHI_SPACE } from "../../theme/antd-css-var-contract";
|
|
5
5
|
export function PhiPopoverControl({ open, content, children, title, trigger = "click", placement, disabled = false, destroyOnHidden = false, arrow, padding = "sm", popupContentStyle, zIndex, getPopupContainer, rootClassName, onOpenChange, }) {
|
|
6
|
-
return (_jsx(Popover, { open: disabled ? false : open, content: content, title: title, trigger: trigger, placement: (placement === "auto" ? undefined : placement),
|
|
6
|
+
return (_jsx(Popover, { open: disabled ? false : open, content: content, title: title, trigger: trigger, placement: (placement === "auto" ? undefined : placement),
|
|
7
|
+
// Stated rather than left to the default: a popup wider than the room beside its trigger is moved
|
|
8
|
+
// into the window instead of pushing the page into a sideways scroll.
|
|
9
|
+
autoAdjustOverflow: true, destroyOnHidden: destroyOnHidden, arrow: arrow === false ? false : arrow === "point-at-center" ? { pointAtCenter: true } : undefined, styles: {
|
|
7
10
|
container: {
|
|
8
11
|
...popupContentStyle,
|
|
9
12
|
padding: PHI_SPACE[padding],
|
|
@@ -122,6 +122,12 @@ export type PhiTableControlProps<TRow extends Record<string, unknown>> = {
|
|
|
122
122
|
rowReordering?: PhiTableControlRowReordering;
|
|
123
123
|
editing?: PhiTableControlRowEditing<TRow>;
|
|
124
124
|
loading?: boolean;
|
|
125
|
+
/**
|
|
126
|
+
* How many skeleton rows stand in for the rows while they load: three unless a Table says otherwise
|
|
127
|
+
* (`PHI_TABLE_LOADING_ROWS`). Few on purpose -- a Table grows when its rows arrive rather than shrinks,
|
|
128
|
+
* and most Tables hold a handful of rows (TABLES.md, "Loading").
|
|
129
|
+
*/
|
|
130
|
+
loadingRows?: number;
|
|
125
131
|
bordered?: boolean;
|
|
126
132
|
striped?: boolean;
|
|
127
133
|
showHeader?: boolean;
|
|
@@ -149,4 +155,4 @@ export type PhiTableControlProps<TRow extends Record<string, unknown>> = {
|
|
|
149
155
|
onExternalDrop?: (event: DragEvent<HTMLDivElement>) => void;
|
|
150
156
|
};
|
|
151
157
|
export declare function readPhiTableControlValue(row: Record<string, unknown>, path: string): unknown;
|
|
152
|
-
export declare function PhiTableControl<TRow extends Record<string, unknown>>({ rows, rowIdentityPath, columns, columnOrder, sortingMode, sorts, onSortsChange, columnReordering, onColumnOrderChange, rowSelection, pagination, tree, rowReordering, editing, loading, bordered, striped, stickyHeader, showHeader, footer, summary, size, emptyText, layout, rowStyle, onRowActivate, onExternalRowDragOver, onExternalRowDrop, onExternalDragOver, onExternalDrop, }: PhiTableControlProps<TRow>): import("react").JSX.Element;
|
|
158
|
+
export declare function PhiTableControl<TRow extends Record<string, unknown>>({ rows, rowIdentityPath, columns, columnOrder, sortingMode, sorts, onSortsChange, columnReordering, onColumnOrderChange, rowSelection, pagination, tree, rowReordering, editing, loading, loadingRows: loadingRowCount, bordered, striped, stickyHeader, showHeader, footer, summary, size, emptyText, layout, rowStyle, onRowActivate, onExternalRowDragOver, onExternalRowDrop, onExternalDragOver, onExternalDrop, }: PhiTableControlProps<TRow>): import("react").JSX.Element;
|
|
@@ -9,6 +9,7 @@ import { flushSync } from "react-dom";
|
|
|
9
9
|
import { Children, cloneElement, createContext, isValidElement, useCallback, useContext, useEffect, useMemo, useRef, useState, } from "react";
|
|
10
10
|
import { PHI_GREGORY_CALENDAR_ADAPTER_KEY } from "../../types/calendar-keys";
|
|
11
11
|
import { PHI_VISUAL_ANCHOR_PART_ATTRIBUTE } from "../../types/visual-anchors";
|
|
12
|
+
import { PHI_TABLE_LOADING_ROWS, PHI_TABLE_LOADING_ROWS_MAX } from "../../constants/table-loading";
|
|
12
13
|
import { PhiTruncatedHoverText } from "./phi-truncated-hover-text";
|
|
13
14
|
import { PhiColorControl } from "./phi-color-control";
|
|
14
15
|
import { PhiCheckboxControl } from "./phi-checkbox-control";
|
|
@@ -207,8 +208,9 @@ function buildColumnStyle(sizing) {
|
|
|
207
208
|
};
|
|
208
209
|
}
|
|
209
210
|
function buildLoadingSkeletonStyle(width, cellPaddingInline) {
|
|
211
|
+
// A column that sizes to its content gets a skeleton a short word wide, so it does not collapse to nothing.
|
|
210
212
|
if (width == null)
|
|
211
|
-
return { display: "block", width: "100%", minWidth:
|
|
213
|
+
return { display: "block", width: "100%", minWidth: 48 };
|
|
212
214
|
const contentWidth = typeof width === "number"
|
|
213
215
|
? Math.max(24, width - cellPaddingInline * 2)
|
|
214
216
|
: `max(24px, calc(${width} - ${cellPaddingInline * 2}px))`;
|
|
@@ -377,7 +379,7 @@ const PHI_TABLE_COLUMN_TITLE_STYLE = { display: "block", minWidth: 0, overflow:
|
|
|
377
379
|
function renderPhiTableColumnTitle(title) {
|
|
378
380
|
return (_jsx(PhiTruncatedHoverText, { title: title, children: _jsx("span", { style: PHI_TABLE_COLUMN_TITLE_STYLE, children: title }) }));
|
|
379
381
|
}
|
|
380
|
-
export function PhiTableControl({ rows, rowIdentityPath, columns, columnOrder, sortingMode, sorts, onSortsChange, columnReordering = false, onColumnOrderChange, rowSelection, pagination = false, tree, rowReordering, editing, loading = false, bordered, striped = false, stickyHeader = false, showHeader, footer, summary, size, emptyText, layout, rowStyle, onRowActivate, onExternalRowDragOver, onExternalRowDrop, onExternalDragOver, onExternalDrop, }) {
|
|
382
|
+
export function PhiTableControl({ rows, rowIdentityPath, columns, columnOrder, sortingMode, sorts, onSortsChange, columnReordering = false, onColumnOrderChange, rowSelection, pagination = false, tree, rowReordering, editing, loading = false, loadingRows: loadingRowCount = PHI_TABLE_LOADING_ROWS, bordered, striped = false, stickyHeader = false, showHeader, footer, summary, size, emptyText, layout, rowStyle, onRowActivate, onExternalRowDragOver, onExternalRowDrop, onExternalDragOver, onExternalDrop, }) {
|
|
381
383
|
const { token } = usePhiConfig();
|
|
382
384
|
const [editingRowIdentityState, setEditingRowIdentity] = useState(null);
|
|
383
385
|
const [rowEditPatch, setRowEditPatch] = useState({});
|
|
@@ -709,9 +711,8 @@ export function PhiTableControl({ rows, rowIdentityPath, columns, columnOrder, s
|
|
|
709
711
|
const visibleRows = useMemo(() => tree
|
|
710
712
|
? flattenVisibleTreeRows(dataSource, rowIdentityPath, tree.expandedRowIdentities)
|
|
711
713
|
: dataSource, [dataSource, rowIdentityPath, tree]);
|
|
712
|
-
|
|
713
|
-
|
|
714
|
-
: Math.min(8, Math.max(3, pagination.pageSize));
|
|
714
|
+
// Never more than a page holds: a Table that pages by five does not load as ten.
|
|
715
|
+
const loadingSkeletonRows = Math.max(1, Math.min(Math.trunc(loadingRowCount), pagination === false ? PHI_TABLE_LOADING_ROWS_MAX : pagination.pageSize)) || PHI_TABLE_LOADING_ROWS;
|
|
715
716
|
const loadingRows = useMemo(() => Array.from({ length: loadingSkeletonRows }, (_, index) => ({
|
|
716
717
|
[PHI_TABLE_LOADING_ROW]: index,
|
|
717
718
|
})), [loadingSkeletonRows]);
|
|
@@ -737,12 +738,13 @@ export function PhiTableControl({ rows, rowIdentityPath, columns, columnOrder, s
|
|
|
737
738
|
const controlColumns = useMemo(() => {
|
|
738
739
|
return [
|
|
739
740
|
...rowDragColumn,
|
|
740
|
-
|
|
741
|
+
// Kept while loading, its controls disabled, so the columns do not move when the rows arrive.
|
|
742
|
+
...(rowSelection ? [Table.SELECTION_COLUMN] : []),
|
|
741
743
|
...antdColumns,
|
|
742
744
|
...rowEditingColumn,
|
|
743
745
|
...fallbackRowOrderingColumn,
|
|
744
746
|
];
|
|
745
|
-
}, [antdColumns, fallbackRowOrderingColumn,
|
|
747
|
+
}, [antdColumns, fallbackRowOrderingColumn, rowDragColumn, rowEditingColumn, rowSelection]);
|
|
746
748
|
const loadingSkeletonWidths = useMemo(() => new Map(orderedColumns.flatMap((column) => {
|
|
747
749
|
const width = column.sizing?.mode === "fixed"
|
|
748
750
|
? column.sizing.width
|
|
@@ -1004,6 +1006,18 @@ export function PhiTableControl({ rows, rowIdentityPath, columns, columnOrder, s
|
|
|
1004
1006
|
getCheckboxProps: (row) => ({ disabled: rowSelection.isRowDisabled?.(row) ?? false }),
|
|
1005
1007
|
}
|
|
1006
1008
|
: undefined;
|
|
1009
|
+
/*
|
|
1010
|
+
* The selection column of a loading Table: the same column, nothing chosen and nothing to choose, so
|
|
1011
|
+
* the skeleton has the width the rows will have.
|
|
1012
|
+
*/
|
|
1013
|
+
const loadingRowSelection = antdRowSelection
|
|
1014
|
+
? {
|
|
1015
|
+
type: antdRowSelection.type,
|
|
1016
|
+
fixed: antdRowSelection.fixed,
|
|
1017
|
+
selectedRowKeys: [],
|
|
1018
|
+
getCheckboxProps: () => ({ disabled: true }),
|
|
1019
|
+
}
|
|
1020
|
+
: undefined;
|
|
1007
1021
|
/*
|
|
1008
1022
|
* Whether something of the Table's own stands at its bottom edge. A sticky-top summary does not: it
|
|
1009
1023
|
* rides above the rows and leaves the last row to end the Table.
|
|
@@ -1038,11 +1052,12 @@ export function PhiTableControl({ rows, rowIdentityPath, columns, columnOrder, s
|
|
|
1038
1052
|
stickyHeader && showHeader !== false ? "phi-table-control--sticky-header" : null,
|
|
1039
1053
|
// No rows, nothing measured: the sticky header's fixed layout would have no widths to fix.
|
|
1040
1054
|
!loading && dataSource.length === 0 ? "phi-table-control--empty" : null,
|
|
1055
|
+
loading ? "phi-table-control--loading" : null,
|
|
1041
1056
|
]
|
|
1042
1057
|
.filter(Boolean)
|
|
1043
1058
|
.join(" "), style: { "--phi-table-striped-row-background": token.colorFillAlter }, rowKey: (row) => loading
|
|
1044
1059
|
? `__phi_table_loading_${String(row[PHI_TABLE_LOADING_ROW])}`
|
|
1045
|
-
: String(readIdentity(row, rowIdentityPath)), columns: renderedColumns, dataSource: loading ? loadingRows : dataSource, bordered: bordered, showHeader: showHeader, tableLayout: layout.mode, size: size, rowClassName: (_row, index) => striped && index % 2 === 1 ? "phi-table-control__row--striped" : "", rowSelection: loading ?
|
|
1060
|
+
: String(readIdentity(row, rowIdentityPath)), columns: renderedColumns, dataSource: loading ? loadingRows : dataSource, bordered: bordered, showHeader: showHeader, tableLayout: layout.mode, size: size, rowClassName: (_row, index) => striped && index % 2 === 1 ? "phi-table-control__row--striped" : "", rowSelection: loading ? loadingRowSelection : antdRowSelection, components: rowReordering?.enabled && !loading ? { body: { row: PhiTableSortableRow } } : undefined, scroll: layout.overflowX === "auto" ? { x: true } : undefined, sticky: stickyHeader && showHeader !== false ? true : undefined, pagination: pagination === false ? false : {
|
|
1046
1061
|
...{ [PHI_VISUAL_ANCHOR_PART_ATTRIBUTE]: "pagination" },
|
|
1047
1062
|
current: pagination.page,
|
|
1048
1063
|
pageSize: pagination.pageSize,
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
import type { PhiFormDescriptor } from "@phis/contracts/forms";
|
|
2
|
+
/**
|
|
3
|
+
* What a Form's fields break of the rules their Controls read them by, as messages, checked where the
|
|
4
|
+
* Form is made (owner, 2026-11-24) rather than when a Control throws on a live page:
|
|
5
|
+
*
|
|
6
|
+
* - a `money` field's config: exactly one of `currency`, `currencies`, `currencyField` or an
|
|
7
|
+
* `optionsProvider`, every currency stated an ISO 4217 code a payment accepts, the bounds whole minor
|
|
8
|
+
* units (`readPhiMoneyFieldConfig`); and a `currencyField` naming another field of the same Form;
|
|
9
|
+
* - a `flags` field with options written out: each option's value a bit, none twice, and `requires`
|
|
10
|
+
* naming two of its options (`readPhiFlagsFieldConfig`). Options an Options Provider answers are only
|
|
11
|
+
* known once it answers, and are read by the Control then.
|
|
12
|
+
*
|
|
13
|
+
* A validation rule naming a Provider nobody declares is refused by catalog construction, which knows
|
|
14
|
+
* the Area's Providers (`plugins/runtime-modules/resolver.ts`); this check knows only the descriptor.
|
|
15
|
+
* It runs at verify time, from `checkPhiPresetForms` (`@phis/ui/module/page-check`) in a package's tests
|
|
16
|
+
* and phis-ui's own: a Site never loads it, and the Controls still read their configs strictly.
|
|
17
|
+
*/
|
|
18
|
+
export declare function checkPhiFormDescriptorFields(descriptor: Pick<PhiFormDescriptor, "fields">): string[];
|
|
@@ -0,0 +1,41 @@
|
|
|
1
|
+
import { readPhiFlagsFieldConfig } from "./flags-field";
|
|
2
|
+
import { readPhiMoneyFieldConfig } from "./money-field";
|
|
3
|
+
import { PHI_FORM_FIELD_PROVIDER_KEYS } from "./form-provider-contract";
|
|
4
|
+
/**
|
|
5
|
+
* What a Form's fields break of the rules their Controls read them by, as messages, checked where the
|
|
6
|
+
* Form is made (owner, 2026-11-24) rather than when a Control throws on a live page:
|
|
7
|
+
*
|
|
8
|
+
* - a `money` field's config: exactly one of `currency`, `currencies`, `currencyField` or an
|
|
9
|
+
* `optionsProvider`, every currency stated an ISO 4217 code a payment accepts, the bounds whole minor
|
|
10
|
+
* units (`readPhiMoneyFieldConfig`); and a `currencyField` naming another field of the same Form;
|
|
11
|
+
* - a `flags` field with options written out: each option's value a bit, none twice, and `requires`
|
|
12
|
+
* naming two of its options (`readPhiFlagsFieldConfig`). Options an Options Provider answers are only
|
|
13
|
+
* known once it answers, and are read by the Control then.
|
|
14
|
+
*
|
|
15
|
+
* A validation rule naming a Provider nobody declares is refused by catalog construction, which knows
|
|
16
|
+
* the Area's Providers (`plugins/runtime-modules/resolver.ts`); this check knows only the descriptor.
|
|
17
|
+
* It runs at verify time, from `checkPhiPresetForms` (`@phis/ui/module/page-check`) in a package's tests
|
|
18
|
+
* and phis-ui's own: a Site never loads it, and the Controls still read their configs strictly.
|
|
19
|
+
*/
|
|
20
|
+
export function checkPhiFormDescriptorFields(descriptor) {
|
|
21
|
+
const findings = [];
|
|
22
|
+
const keys = new Set(descriptor.fields.map((field) => field.key));
|
|
23
|
+
for (const field of descriptor.fields) {
|
|
24
|
+
const where = `Field "${field.key}"`;
|
|
25
|
+
try {
|
|
26
|
+
if (field.fieldProviderKey === PHI_FORM_FIELD_PROVIDER_KEYS.money) {
|
|
27
|
+
const money = readPhiMoneyFieldConfig(field.config, { hasOptionsProvider: field.optionsProvider != null });
|
|
28
|
+
if (money.currencyField !== undefined && (money.currencyField === field.key || !keys.has(money.currencyField))) {
|
|
29
|
+
findings.push(`${where} takes its currency from "${money.currencyField}", which is no other field of its Form.`);
|
|
30
|
+
}
|
|
31
|
+
}
|
|
32
|
+
else if (field.fieldProviderKey === PHI_FORM_FIELD_PROVIDER_KEYS.flags && field.options && !field.optionsProvider) {
|
|
33
|
+
readPhiFlagsFieldConfig(field.config, field.options);
|
|
34
|
+
}
|
|
35
|
+
}
|
|
36
|
+
catch (error) {
|
|
37
|
+
findings.push(`${where}: ${error instanceof Error ? error.message : String(error)}`);
|
|
38
|
+
}
|
|
39
|
+
}
|
|
40
|
+
return findings;
|
|
41
|
+
}
|
|
@@ -2,14 +2,13 @@
|
|
|
2
2
|
import { jsx as _jsx, Fragment as _Fragment, jsxs as _jsxs } from "react/jsx-runtime";
|
|
3
3
|
import { isPhiRecord } from "../../helpers/is-record";
|
|
4
4
|
import { useCallback, useEffect, useMemo, useRef, useState } from "react";
|
|
5
|
-
import { readPhiTableActionSignalValue } from "../../types/table-signal-values";
|
|
6
5
|
import { usePhiSignalListener } from "../runtime/runtime-signal-bus";
|
|
7
6
|
import { createPhiSignalCorrelationId } from "../runtime/runtime-signal-bus";
|
|
8
7
|
import { emitPhiSignalCapability, usePhiSignalEmitter, usePhiSignalIdentity, } from "../runtime/runtime-signal-identity";
|
|
9
8
|
import { isPhiControllerSignalAddress } from "../../types/signals";
|
|
10
9
|
import { readPhiRuntimeConditionStateSignalValue } from "../../types/runtime-condition";
|
|
11
10
|
import { collectPhiRuntimeValueConditions } from "../../types/runtime-condition";
|
|
12
|
-
import {
|
|
11
|
+
import { readPhiFormRecordOpenKey, usePhiFormRecordSource } from "./form-record-source";
|
|
13
12
|
import { usePhiIntlLocale, usePhiIntlTimeZone } from "../root/phi-intl-locale";
|
|
14
13
|
import { PhiFormControl } from "../controls/phi-form-control";
|
|
15
14
|
import { readPhiRuntimeFormValuesSignalValue } from "./runtime-form-state";
|
|
@@ -41,7 +40,8 @@ export function PhiFormDescriptorRuntimeClient({ descriptor, labels, loadedIniti
|
|
|
41
40
|
const inDialogBody = usePhiInDialogBody();
|
|
42
41
|
const emitSignal = usePhiSignalEmitter(identity.sender);
|
|
43
42
|
const source = widgetConfig?.source ?? null;
|
|
44
|
-
|
|
43
|
+
// A Table resource's or a Collection resource's, whichever Provider answers the source's key.
|
|
44
|
+
const recordSource = usePhiFormRecordSource(source);
|
|
45
45
|
/*
|
|
46
46
|
* Sent with the record read, but held in a ref rather than made part of what starts one: a Form's
|
|
47
47
|
* values are what somebody is editing, and a language switch that read the record again would throw
|
|
@@ -175,17 +175,17 @@ export function PhiFormDescriptorRuntimeClient({ descriptor, labels, loadedIniti
|
|
|
175
175
|
if (!source) {
|
|
176
176
|
return configuredInitialValues;
|
|
177
177
|
}
|
|
178
|
-
if (
|
|
179
|
-
throw new Error(
|
|
178
|
+
if (!recordSource.read) {
|
|
179
|
+
throw new Error(recordSource.error ?? `Resource "${source.resourceKey}" is not a Form record read source.`);
|
|
180
180
|
}
|
|
181
|
-
return
|
|
181
|
+
return recordSource.read({
|
|
182
182
|
resourceKey: source.resourceKey,
|
|
183
183
|
rowIdentity,
|
|
184
184
|
params: source.params,
|
|
185
185
|
...intlRef.current,
|
|
186
186
|
signal,
|
|
187
187
|
});
|
|
188
|
-
}, [
|
|
188
|
+
}, [configuredInitialValues, recordSource, source]);
|
|
189
189
|
/*
|
|
190
190
|
* The one record read in flight. Every new read aborts the one before it, and unmount aborts the
|
|
191
191
|
* last: two reads racing meant the slower one wrote `record` and `recordIdentityRef` last, so a Form
|
|
@@ -270,11 +270,12 @@ export function PhiFormDescriptorRuntimeClient({ descriptor, labels, loadedIniti
|
|
|
270
270
|
if (!route)
|
|
271
271
|
return;
|
|
272
272
|
if (route.capabilityId === "recordOpen") {
|
|
273
|
-
|
|
274
|
-
|
|
273
|
+
// A Table's row action or a Collection View's item action, whichever the route carries.
|
|
274
|
+
const recordKey = readPhiFormRecordOpenKey(route.valueSchema, signal.value, widgetConfig?.openActionKey ?? "edit");
|
|
275
|
+
if (recordKey == null)
|
|
275
276
|
return;
|
|
276
277
|
announceRecordTitle(null, signal.correlationId);
|
|
277
|
-
void loadRecord(
|
|
278
|
+
void loadRecord(recordKey, signal.correlationId);
|
|
278
279
|
emitCapability("conditionStateRequest", null, signal.correlationId);
|
|
279
280
|
}
|
|
280
281
|
else if (route.capabilityId === "close") {
|
|
@@ -0,0 +1,38 @@
|
|
|
1
|
+
import type { PhiProviderResourceSource } from "../../types/runtime-data-provider";
|
|
2
|
+
import type { PhiTableProviderRecordRequest } from "../../types/table-widget";
|
|
3
|
+
import type { PhiSignalValueSchema } from "../../types/signals";
|
|
4
|
+
type RecordReader = (request: PhiTableProviderRecordRequest) => Promise<Record<string, unknown>>;
|
|
5
|
+
type ProviderLookup = {
|
|
6
|
+
provider: {
|
|
7
|
+
readRecord?: RecordReader;
|
|
8
|
+
} | null;
|
|
9
|
+
resource: {
|
|
10
|
+
recordRead?: boolean;
|
|
11
|
+
} | null;
|
|
12
|
+
bindingError: string | null;
|
|
13
|
+
};
|
|
14
|
+
/**
|
|
15
|
+
* Where a record-bound Form reads its record (`source`): a Table Provider's resource, or a Collection
|
|
16
|
+
* Provider's, whichever of the two the Area mounted under the source's key -- a Provider key names one
|
|
17
|
+
* kind, so at most one answers. Either reads through its Client's `readRecord`, in the one request shape
|
|
18
|
+
* (`PhiTableProviderRecordRequest`), and only for a resource that declares `recordRead: true`.
|
|
19
|
+
*
|
|
20
|
+
* `read` is null where there is nothing to read with, and `error` then says why; both are null without a
|
|
21
|
+
* source, which is a Form that starts from its placement's values.
|
|
22
|
+
*/
|
|
23
|
+
export declare function resolvePhiFormRecordSource(source: PhiProviderResourceSource | null, table: ProviderLookup, collection: ProviderLookup): {
|
|
24
|
+
read: RecordReader | null;
|
|
25
|
+
error: string | null;
|
|
26
|
+
};
|
|
27
|
+
export declare function usePhiFormRecordSource(source: PhiProviderResourceSource | null): {
|
|
28
|
+
read: RecordReader | null;
|
|
29
|
+
error: string | null;
|
|
30
|
+
};
|
|
31
|
+
/**
|
|
32
|
+
* The record a `recordOpen` asks for, or null where it is not meant for this Form: a Table's row action
|
|
33
|
+
* (`table-action`, its `rowIdentity`) or a Collection View's item action (`collection-action`, its
|
|
34
|
+
* `itemKey`), named by the Form's `openActionKey` and carrying a record. Which of the two arrived is the
|
|
35
|
+
* route's schema; anything else opens nothing.
|
|
36
|
+
*/
|
|
37
|
+
export declare function readPhiFormRecordOpenKey(valueSchema: PhiSignalValueSchema | null | undefined, value: unknown, openActionKey: string): string | number | null;
|
|
38
|
+
export {};
|
|
@@ -0,0 +1,48 @@
|
|
|
1
|
+
"use client";
|
|
2
|
+
import { useMemo } from "react";
|
|
3
|
+
import { usePhiTableProvider } from "../widgets/client/shared/phi-table-provider";
|
|
4
|
+
import { usePhiCollectionProvider } from "../widgets/client/shared/phi-collection-provider";
|
|
5
|
+
import { readPhiAnnouncedAction } from "../../helpers/announced-action";
|
|
6
|
+
/**
|
|
7
|
+
* Where a record-bound Form reads its record (`source`): a Table Provider's resource, or a Collection
|
|
8
|
+
* Provider's, whichever of the two the Area mounted under the source's key -- a Provider key names one
|
|
9
|
+
* kind, so at most one answers. Either reads through its Client's `readRecord`, in the one request shape
|
|
10
|
+
* (`PhiTableProviderRecordRequest`), and only for a resource that declares `recordRead: true`.
|
|
11
|
+
*
|
|
12
|
+
* `read` is null where there is nothing to read with, and `error` then says why; both are null without a
|
|
13
|
+
* source, which is a Form that starts from its placement's values.
|
|
14
|
+
*/
|
|
15
|
+
export function resolvePhiFormRecordSource(source, table, collection) {
|
|
16
|
+
if (!source)
|
|
17
|
+
return { read: null, error: null };
|
|
18
|
+
const lookup = table.provider ? table : collection.provider ? collection : null;
|
|
19
|
+
if (!lookup)
|
|
20
|
+
return { read: null, error: table.bindingError };
|
|
21
|
+
if (lookup.bindingError)
|
|
22
|
+
return { read: null, error: lookup.bindingError };
|
|
23
|
+
const readRecord = lookup.provider?.readRecord;
|
|
24
|
+
if (lookup.resource?.recordRead !== true || !readRecord) {
|
|
25
|
+
return {
|
|
26
|
+
read: null,
|
|
27
|
+
error: `${lookup === table ? "Table" : "Collection"} resource "${source.resourceKey}" is not a Form record read source.`,
|
|
28
|
+
};
|
|
29
|
+
}
|
|
30
|
+
return { read: readRecord, error: null };
|
|
31
|
+
}
|
|
32
|
+
export function usePhiFormRecordSource(source) {
|
|
33
|
+
const { provider: tableProvider, resource: tableResource, bindingError: tableError } = usePhiTableProvider(source);
|
|
34
|
+
const { provider: collectionProvider, resource: collectionResource, bindingError: collectionError, } = usePhiCollectionProvider(source);
|
|
35
|
+
return useMemo(() => resolvePhiFormRecordSource(source, { provider: tableProvider, resource: tableResource, bindingError: tableError }, { provider: collectionProvider, resource: collectionResource, bindingError: collectionError }), [collectionError, collectionProvider, collectionResource, source, tableError, tableProvider, tableResource]);
|
|
36
|
+
}
|
|
37
|
+
/**
|
|
38
|
+
* The record a `recordOpen` asks for, or null where it is not meant for this Form: a Table's row action
|
|
39
|
+
* (`table-action`, its `rowIdentity`) or a Collection View's item action (`collection-action`, its
|
|
40
|
+
* `itemKey`), named by the Form's `openActionKey` and carrying a record. Which of the two arrived is the
|
|
41
|
+
* route's schema; anything else opens nothing.
|
|
42
|
+
*/
|
|
43
|
+
export function readPhiFormRecordOpenKey(valueSchema, value, openActionKey) {
|
|
44
|
+
const announced = readPhiAnnouncedAction(valueSchema, value);
|
|
45
|
+
if (!announced || announced.actionKey !== openActionKey)
|
|
46
|
+
return null;
|
|
47
|
+
return announced.recordKey;
|
|
48
|
+
}
|
|
@@ -226,40 +226,6 @@ export declare const PHI_REGISTRATION_FORM_DESCRIPTOR: {
|
|
|
226
226
|
readonly fallback: "/terms-and-conditions";
|
|
227
227
|
};
|
|
228
228
|
};
|
|
229
|
-
}, {
|
|
230
|
-
readonly key: "newsletter";
|
|
231
|
-
readonly fieldProviderKey: `${string}/${string}`;
|
|
232
|
-
readonly controlLabel: PhiFormTextDescriptor;
|
|
233
|
-
readonly placement: {
|
|
234
|
-
readonly label: {
|
|
235
|
-
readonly compact: {
|
|
236
|
-
readonly start: 1;
|
|
237
|
-
readonly end: number;
|
|
238
|
-
};
|
|
239
|
-
readonly medium: {
|
|
240
|
-
readonly start: 1;
|
|
241
|
-
readonly end: number;
|
|
242
|
-
};
|
|
243
|
-
readonly wide: {
|
|
244
|
-
readonly start: 1;
|
|
245
|
-
readonly end: number;
|
|
246
|
-
};
|
|
247
|
-
};
|
|
248
|
-
readonly control: {
|
|
249
|
-
readonly compact: {
|
|
250
|
-
readonly start: 1;
|
|
251
|
-
readonly end: number;
|
|
252
|
-
};
|
|
253
|
-
readonly medium: {
|
|
254
|
-
readonly start: 1;
|
|
255
|
-
readonly end: number;
|
|
256
|
-
};
|
|
257
|
-
readonly wide: {
|
|
258
|
-
readonly start: 1;
|
|
259
|
-
readonly end: number;
|
|
260
|
-
};
|
|
261
|
-
};
|
|
262
|
-
};
|
|
263
229
|
}];
|
|
264
230
|
readonly success: {
|
|
265
231
|
readonly title: PhiFormTextDescriptor;
|
|
@@ -176,12 +176,6 @@ export const PHI_REGISTRATION_FORM_DESCRIPTOR = {
|
|
|
176
176
|
href: { kind: "config", key: "termsHref", fallback: "/terms-and-conditions" },
|
|
177
177
|
},
|
|
178
178
|
},
|
|
179
|
-
{
|
|
180
|
-
key: "newsletter",
|
|
181
|
-
fieldProviderKey: PHI_FORM_FIELD_PROVIDER_KEYS.checkbox,
|
|
182
|
-
controlLabel: label("consent.newsletter", "Send me product and platform updates."),
|
|
183
|
-
placement: PHI_FORM_STACKED_FULL,
|
|
184
|
-
},
|
|
185
179
|
],
|
|
186
180
|
success: {
|
|
187
181
|
title: label("feedback.successTitle", "Account created"),
|
|
@@ -26,7 +26,7 @@ export declare const PHI_SHARED_FORM_IDS: {
|
|
|
26
26
|
/**
|
|
27
27
|
* The two credentials a signed-in person changes about themselves.
|
|
28
28
|
*
|
|
29
|
-
* They belong beside the sign-in Forms rather than with the profile's name and
|
|
29
|
+
* They belong beside the sign-in Forms rather than with the profile's name and language, for the
|
|
30
30
|
* same reason the security Page belongs to this Module: a password and the address it is tied to are
|
|
31
31
|
* how somebody proves who they are, and whoever answers that question owns the Forms that change it.
|
|
32
32
|
*/
|
|
@@ -28,7 +28,7 @@ export const PHI_SHARED_FORM_IDS = {
|
|
|
28
28
|
/**
|
|
29
29
|
* The two credentials a signed-in person changes about themselves.
|
|
30
30
|
*
|
|
31
|
-
* They belong beside the sign-in Forms rather than with the profile's name and
|
|
31
|
+
* They belong beside the sign-in Forms rather than with the profile's name and language, for the
|
|
32
32
|
* same reason the security Page belongs to this Module: a password and the address it is tied to are
|
|
33
33
|
* how somebody proves who they are, and whoever answers that question owns the Forms that change it.
|
|
34
34
|
*/
|