@phis/ui 0.6.3 → 0.6.5
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 +11 -2
- package/components/controls/phi-multi-select-control.js +4 -2
- package/components/controls/phi-options-provider.d.ts +1 -0
- package/components/controls/phi-options-provider.js +1 -0
- package/components/controls/phi-segmented-control.js +15 -1
- package/components/controls/phi-select-control.d.ts +21 -0
- package/components/controls/phi-select-control.js +2 -2
- package/components/controls/phi-status-dot-control.d.ts +15 -0
- package/components/controls/phi-status-dot-control.js +25 -0
- package/components/controls/phi-table-control.js +8 -1
- package/components/controls/phi-tree-control.js +5 -4
- package/components/controls/phi-tree-select-control.js +1 -0
- package/components/layouts/clients/phi-split-card-half.d.ts +4 -1
- package/components/layouts/clients/phi-split-card-half.js +2 -2
- package/components/layouts/clients/phi-split-card-layout-client.d.ts +6 -3
- package/components/layouts/clients/phi-split-card-layout-client.js +5 -3
- package/components/layouts/clients/phi-three-column-layout-client.d.ts +20 -1
- package/components/layouts/clients/phi-three-column-layout-client.js +31 -15
- package/components/layouts/layout-definitions.d.ts +96 -0
- package/components/layouts/layout-definitions.js +40 -2
- package/components/layouts/plugins/split-card-layout-plugin.js +1 -1
- package/components/layouts/plugins/three-column-layout-plugin.js +1 -1
- package/components/layouts/split-card-geometry.d.ts +9 -4
- package/components/layouts/split-card-geometry.js +29 -13
- package/components/media/media-folder-options.d.ts +10 -0
- package/components/media/media-folder-options.js +14 -0
- package/components/shell/phi-antd-icon.d.ts +1 -0
- package/components/shell/phi-antd-icon.js +3 -0
- package/components/widgets/inspector-field-row.js +4 -1
- package/components/widgets/label-sets/admin-users.d.ts +3 -0
- package/components/widgets/label-sets/admin-users.js +8 -2
- package/components/widgets/label-sets/gallery.js +2 -2
- package/components/widgets/label-sets/inspector.js +4 -0
- package/components/widgets/label-sets/observability-logs.js +2 -2
- package/components/widgets/label-sets/profile.js +2 -1
- package/components/widgets/label-types/gallery.d.ts +2 -3
- package/components/widgets/label-types/gallery.js +1 -4
- package/components/widgets/label-types/inspector.d.ts +4 -0
- package/components/widgets/label-types/inspector.js +2 -0
- package/components/widgets/shared/markdown-image-vocabulary.js +1 -1
- package/constants/cms-layout-proportions.d.ts +6 -0
- package/constants/cms-layout-proportions.js +17 -0
- package/constants/runtime-module-ownership.js +1 -0
- package/helpers/page-reference-tree.js +8 -0
- package/helpers/table-action-links.d.ts +11 -0
- package/helpers/table-action-links.js +14 -0
- package/helpers/table-action-row-link.d.ts +8 -0
- package/helpers/table-action-row-link.js +14 -0
- package/package.json +2 -2
- package/plugins/factories/widget-renderers.d.ts +7 -1
- package/plugins/factories/widget-renderers.js +12 -2
- package/plugins/runtime-modules/asset/authoring-widgets.js +2 -2
- package/plugins/runtime-modules/asset/data-providers.js +1 -1
- package/plugins/runtime-modules/asset/services/options.js +7 -11
- package/plugins/runtime-modules/asset/widgets/area-upload/plugin.js +0 -2
- package/plugins/runtime-modules/asset/widgets/asset-focal-rect/plugin.js +0 -2
- package/plugins/runtime-modules/asset/widgets/image-inspector/plugin.js +0 -2
- package/plugins/runtime-modules/asset/widgets/media-picker/plugin.js +0 -2
- package/plugins/runtime-modules/asset/widgets.js +4 -4
- package/plugins/runtime-modules/auth/authoring-widgets.js +4 -8
- package/plugins/runtime-modules/auth/services/installations-table.js +3 -1
- package/plugins/runtime-modules/auth/widgets/auth-workflow/plugin.js +0 -6
- package/plugins/runtime-modules/auth/widgets/logout/plugin.js +0 -2
- package/plugins/runtime-modules/auth/widgets/security/plugin.js +0 -2
- package/plugins/runtime-modules/auth/widgets.js +5 -3
- package/plugins/runtime-modules/avatar/authoring-widgets.js +2 -2
- package/plugins/runtime-modules/avatar/widgets/account-avatar/plugin.js +0 -2
- package/plugins/runtime-modules/avatar/widgets/account-avatar-picker/plugin.js +0 -2
- package/plugins/runtime-modules/avatar/widgets.js +2 -2
- package/plugins/runtime-modules/builder/authoring-widgets.js +1 -1
- package/plugins/runtime-modules/builder/clients/inspector-choice-cascader.d.ts +28 -0
- package/plugins/runtime-modules/builder/clients/inspector-choice-cascader.js +98 -0
- package/plugins/runtime-modules/builder/clients/inspector-config-field.js +27 -3
- package/plugins/runtime-modules/builder/clients/inspector-record-field-options.d.ts +17 -0
- package/plugins/runtime-modules/builder/clients/inspector-record-field-options.js +21 -0
- package/plugins/runtime-modules/builder/clients/inspector-translate-switch.d.ts +24 -0
- package/plugins/runtime-modules/builder/clients/inspector-translate-switch.js +29 -0
- package/plugins/runtime-modules/builder/clients/layout-inspector.d.ts +1 -1
- package/plugins/runtime-modules/builder/clients/layout-inspector.js +4 -2
- package/plugins/runtime-modules/builder/clients/widget-inspector.d.ts +1 -1
- package/plugins/runtime-modules/builder/clients/widget-inspector.js +6 -6
- package/plugins/runtime-modules/builder/plugin-meta-labels.js +17 -0
- package/plugins/runtime-modules/builder/render-root-node-scaffold.js +12 -2
- package/plugins/runtime-modules/builder/widgets/structure-region/plugin.js +0 -2
- package/plugins/runtime-modules/builder/widgets.js +3 -3
- package/plugins/runtime-modules/contracts.js +8 -4
- package/plugins/runtime-modules/core/authoring-widgets.js +2 -2
- package/plugins/runtime-modules/core/data-providers.d.ts +7 -3
- package/plugins/runtime-modules/core/data-providers.js +11 -1
- package/plugins/runtime-modules/core/definition.d.ts +7 -3
- package/plugins/runtime-modules/core/widgets/cascader/authoring.d.ts +1 -1
- package/plugins/runtime-modules/core/widgets/draft-status/client.d.ts +2 -1
- package/plugins/runtime-modules/core/widgets/draft-status/client.js +4 -3
- package/plugins/runtime-modules/core/widgets/gallery/authoring.js +6 -8
- package/plugins/runtime-modules/core/widgets/gallery/client.js +4 -0
- package/plugins/runtime-modules/core/widgets/gallery/config.js +1 -1
- package/plugins/runtime-modules/core/widgets/gallery/server.d.ts +5 -1
- package/plugins/runtime-modules/core/widgets/gallery/server.js +8 -4
- package/plugins/runtime-modules/core/widgets/image/config.js +1 -1
- package/plugins/runtime-modules/core/widgets/markdown/config.d.ts +11 -0
- package/plugins/runtime-modules/core/widgets/markdown/config.js +24 -22
- package/plugins/runtime-modules/core/widgets/simple-text/client.d.ts +9 -5
- package/plugins/runtime-modules/core/widgets/simple-text/client.js +5 -7
- package/plugins/runtime-modules/core/widgets/simple-text/config.d.ts +63 -4
- package/plugins/runtime-modules/core/widgets/simple-text/config.js +45 -11
- package/plugins/runtime-modules/core/widgets/simple-text/editor.js +2 -2
- package/plugins/runtime-modules/core/widgets/simple-text/plugin.d.ts +13 -0
- package/plugins/runtime-modules/core/widgets/simple-text/plugin.js +23 -4
- package/plugins/runtime-modules/core/widgets/simple-text/server.d.ts +4 -2
- package/plugins/runtime-modules/core/widgets/simple-text/server.js +7 -6
- package/plugins/runtime-modules/core/widgets/table/client.js +4 -4
- package/plugins/runtime-modules/core/widgets/table/config.js +11 -3
- package/plugins/runtime-modules/core/widgets/table/plugin.js +21 -1
- package/plugins/runtime-modules/core/widgets/thread-conversation/plugin.js +0 -2
- package/plugins/runtime-modules/core/widgets/tree/config.js +2 -1
- package/plugins/runtime-modules/core/widgets/tree/plugin.js +16 -1
- package/plugins/runtime-modules/core/widgets.js +1 -1
- package/plugins/runtime-modules/editor/services/releases-table.js +4 -1
- package/plugins/runtime-modules/observability/data-providers.js +1 -1
- package/plugins/runtime-modules/observability/services/table.js +3 -1
- package/plugins/runtime-modules/theme/authoring-widgets.js +5 -5
- package/plugins/runtime-modules/theme/widgets/brand-controls/plugin.js +0 -5
- package/plugins/runtime-modules/theme/widgets.js +4 -4
- package/plugins/runtime-modules/user-management/addon-roles.d.ts +28 -7
- package/plugins/runtime-modules/user-management/addon-roles.js +42 -17
- package/plugins/runtime-modules/user-management/client-data-providers.js +6 -0
- package/plugins/runtime-modules/user-management/data-providers.js +11 -2
- package/plugins/runtime-modules/user-management/forms.js +40 -1
- package/plugins/runtime-modules/user-management/ids.d.ts +1 -0
- package/plugins/runtime-modules/user-management/ids.js +1 -0
- package/plugins/runtime-modules/user-management/services/options.d.ts +14 -3
- package/plugins/runtime-modules/user-management/services/options.js +52 -16
- package/plugins/runtime-modules/user-management/services/table.js +11 -25
- package/plugins/runtime-modules/user-management/services/users-query.d.ts +9 -0
- package/plugins/runtime-modules/user-management/services/users-query.js +29 -0
- package/plugins/runtime-modules/video/widgets/embed/plugin.js +0 -2
- package/plugins/runtime-modules/video/widgets.js +1 -1
- package/styles/layout.css +4 -4
- package/types/cms-config.d.ts +12 -4
- package/types/cms-config.js +3 -0
- package/types/cms-plugins.d.ts +26 -4
- package/types/core-widget-placements.d.ts +4 -4
- package/types/table-widget.d.ts +17 -1
- package/types/tree.d.ts +2 -0
- package/plugins/runtime-modules/asset/widgets/asset-focal-rect/authoring.d.ts +0 -2
- package/plugins/runtime-modules/asset/widgets/asset-focal-rect/authoring.js +0 -6
- package/plugins/runtime-modules/asset/widgets/image-inspector/authoring.d.ts +0 -2
- package/plugins/runtime-modules/asset/widgets/image-inspector/authoring.js +0 -6
- package/plugins/runtime-modules/auth/widgets/auth-methods/authoring.d.ts +0 -7
- package/plugins/runtime-modules/auth/widgets/auth-methods/authoring.js +0 -12
- package/plugins/runtime-modules/auth/widgets/auth-workflow/authoring.d.ts +0 -7
- package/plugins/runtime-modules/auth/widgets/auth-workflow/authoring.js +0 -12
- package/plugins/runtime-modules/auth/widgets/logout/authoring.d.ts +0 -3
- package/plugins/runtime-modules/auth/widgets/logout/authoring.js +0 -8
- package/plugins/runtime-modules/auth/widgets/security/authoring.d.ts +0 -3
- package/plugins/runtime-modules/auth/widgets/security/authoring.js +0 -8
- package/plugins/runtime-modules/avatar/widgets/account-avatar/authoring.d.ts +0 -2
- package/plugins/runtime-modules/avatar/widgets/account-avatar/authoring.js +0 -6
- package/plugins/runtime-modules/avatar/widgets/account-avatar-picker/authoring.d.ts +0 -2
- package/plugins/runtime-modules/avatar/widgets/account-avatar-picker/authoring.js +0 -6
- package/plugins/runtime-modules/builder/widgets/structure-region/internal-builder.d.ts +0 -22
- package/plugins/runtime-modules/builder/widgets/structure-region/internal-builder.js +0 -8
- package/plugins/runtime-modules/core/widgets/form-preview/authoring.d.ts +0 -10
- package/plugins/runtime-modules/core/widgets/form-preview/authoring.js +0 -15
- package/plugins/runtime-modules/core/widgets/thread-conversation/authoring.d.ts +0 -3
- package/plugins/runtime-modules/core/widgets/thread-conversation/authoring.js +0 -9
- package/plugins/runtime-modules/theme/widgets/brand-controls/authoring.d.ts +0 -76
- package/plugins/runtime-modules/theme/widgets/brand-controls/authoring.js +0 -30
|
@@ -3,6 +3,8 @@ import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
|
3
3
|
import { useEffect } from "react";
|
|
4
4
|
import { usePhiBaseLayoutOwnSlotController } from "../../../../components/layouts/phi-layout-slot-state";
|
|
5
5
|
import { PhiSurfaceControl } from "../../../../components/controls/phi-surface-control";
|
|
6
|
+
import { PHI_INSPECTOR_WIDGET_DEFAULT_LABELS } from "../../../../components/widgets/label-types/inspector";
|
|
7
|
+
import { isPhiInspectorTranslateSwitchShown } from "./inspector-translate-switch";
|
|
6
8
|
import { PhiViewportVisibilityControl } from "../../../../components/controls/phi-viewport-visibility-control";
|
|
7
9
|
import { PhiPlacementMatrixControl } from "../../../../components/controls/phi-placement-matrix-control";
|
|
8
10
|
import { PhiInspectorSectionContent } from "./inspector-section-content";
|
|
@@ -165,10 +167,10 @@ export function PhiDeveloperBuilderLayoutInspectorWidgetClient({ section, builde
|
|
|
165
167
|
slots: textSlots,
|
|
166
168
|
disabled: isPreviewMode,
|
|
167
169
|
onChange: onConfigPatch,
|
|
168
|
-
})), selectedStructurePlugin
|
|
170
|
+
})), isPhiInspectorTranslateSwitchShown(selectedStructurePlugin, currentDraftRecord)
|
|
169
171
|
? renderPhiInspectorSwitchRow({
|
|
170
172
|
key: "translate-text",
|
|
171
|
-
label:
|
|
173
|
+
label: (fieldLabels ?? PHI_INSPECTOR_WIDGET_DEFAULT_LABELS.fields).translateText,
|
|
172
174
|
checked: !hasPhiFlag(currentDraft?.node.flags ?? 0, PhiCmsFlags.NoTranslate),
|
|
173
175
|
disabled: isPreviewMode,
|
|
174
176
|
...(onTranslateChange ? { onChange: onTranslateChange } : {}),
|
|
@@ -17,7 +17,7 @@ import type { PhiRecordFieldDescriptor } from "../../../../types/record-provider
|
|
|
17
17
|
import type { PhiBuilderWidgetMeta } from "../../../../types/builder";
|
|
18
18
|
import type { PhiSignalRoute } from "../../../../types/signals";
|
|
19
19
|
import { type PhiInspectorWidgetReferenceOption } from "./inspector-config-field";
|
|
20
|
-
import type
|
|
20
|
+
import { type PhiInspectorWidgetLabels } from "../../../../components/widgets/label-types/inspector";
|
|
21
21
|
type PhiDeveloperBuilderWidgetInspectorWidgetClientProps = {
|
|
22
22
|
section?: string;
|
|
23
23
|
builderMode?: PhiDeveloperBuilderMode;
|
|
@@ -15,6 +15,8 @@ import { buildPhiInspectorConfigPathPatch, isPhiInspectorConfigFieldVisible, rea
|
|
|
15
15
|
import { PhiTypographyControl } from "../../../../components/controls/phi-typography-control";
|
|
16
16
|
import { PhiCmsFlags } from "../../../../constants/phi-cms";
|
|
17
17
|
import { hasPhiFlag } from "../../../../helpers/flags";
|
|
18
|
+
import { PHI_INSPECTOR_WIDGET_DEFAULT_LABELS } from "../../../../components/widgets/label-types/inspector";
|
|
19
|
+
import { isPhiInspectorTranslateSwitchShown, resolvePhiInspectorTranslateSwitchIndex } from "./inspector-translate-switch";
|
|
18
20
|
const PHI_GAP_SM = "var(--phi-padding-sm)";
|
|
19
21
|
export function PhiDeveloperBuilderWidgetInspectorWidgetClient({ section, builderMode = "editor", selectedStructureNodeKey = null, selectedStructureNodeKind = null, selectedStructureNodeTitle = null, selectedStructureWidgetMeta = null, currentDraft = null, widgetReferenceOptions = [], signalRouteScope = "widget", onConfigChange, onGeometryChange, onSurfaceChange, onTranslateChange, geometryLabels, surfaceLabels, backgroundLabels, borderLabels, renderMediaPicker, signalsLabels, colorPickerLabels, iconPickerLabels, fieldLabels, dataProviderDescriptors = [], calendarAdapterDescriptors = [], videoProviderDescriptors = [], pageRecordFields = [], }) {
|
|
20
22
|
const isPreviewMode = builderMode === "preview";
|
|
@@ -58,9 +60,7 @@ export function PhiDeveloperBuilderWidgetInspectorWidgetClient({ section, builde
|
|
|
58
60
|
if (ownSlot.state === "hidden")
|
|
59
61
|
ownSlot.show();
|
|
60
62
|
}, [ownSlot, section, surfaceSectionHidden]);
|
|
61
|
-
|
|
62
|
-
const headedFieldIndex = settingsFields.findIndex((field, index) => index > 0 && field.heading != null);
|
|
63
|
-
const firstHeadedFieldIndex = headedFieldIndex === -1 ? settingsFields.length : headedFieldIndex;
|
|
63
|
+
const translateSwitchIndex = resolvePhiInspectorTranslateSwitchIndex(settingsFields);
|
|
64
64
|
const renderSettingsField = (field) => {
|
|
65
65
|
const lock = resolvePhiInspectorFieldLock(field, selectedStructureWidgetMeta?.fields ?? [], currentWidgetSettingsConfigRecord);
|
|
66
66
|
return renderPhiInspectorConfigField({
|
|
@@ -108,15 +108,15 @@ export function PhiDeveloperBuilderWidgetInspectorWidgetClient({ section, builde
|
|
|
108
108
|
{
|
|
109
109
|
key: "settings",
|
|
110
110
|
title: "Settings",
|
|
111
|
-
children: selectedStructureWidgetMeta == null ? (_jsxs(PhiTypographyControl, { type: "danger", children: ["Widget metadata for ", selectedStructureNodeKey ?? selectedStructureNodeTitle ?? "this widget", " is not available from the active Canvas modules."] })) : settingsFields.length === 0 ? (_jsx(PhiTypographyControl, { type: "secondary", children: "This widget does not declare configurable settings." })) : (_jsxs("div", { style: { display: "grid", gap: PHI_GAP_SM, width: "100%" }, children: [settingsFields.slice(0,
|
|
111
|
+
children: selectedStructureWidgetMeta == null ? (_jsxs(PhiTypographyControl, { type: "danger", children: ["Widget metadata for ", selectedStructureNodeKey ?? selectedStructureNodeTitle ?? "this widget", " is not available from the active Canvas modules."] })) : settingsFields.length === 0 ? (_jsx(PhiTypographyControl, { type: "secondary", children: "This widget does not declare configurable settings." })) : (_jsxs("div", { style: { display: "grid", gap: PHI_GAP_SM, width: "100%" }, children: [settingsFields.slice(0, translateSwitchIndex).map(renderSettingsField), isPhiInspectorTranslateSwitchShown(selectedStructureWidgetMeta, currentDraft?.config)
|
|
112
112
|
? renderPhiInspectorSwitchRow({
|
|
113
113
|
key: "translate-text",
|
|
114
|
-
label:
|
|
114
|
+
label: (fieldLabels ?? PHI_INSPECTOR_WIDGET_DEFAULT_LABELS.fields).translateText,
|
|
115
115
|
checked: !hasPhiFlag(currentDraft?.flags ?? 0, PhiCmsFlags.NoTranslate),
|
|
116
116
|
disabled: isPreviewMode,
|
|
117
117
|
...(onTranslateChange ? { onChange: onTranslateChange } : {}),
|
|
118
118
|
})
|
|
119
|
-
: null, settingsFields.slice(
|
|
119
|
+
: null, settingsFields.slice(translateSwitchIndex).map(renderSettingsField)] })),
|
|
120
120
|
},
|
|
121
121
|
{
|
|
122
122
|
key: "geometry",
|
|
@@ -54,6 +54,23 @@ function mapPhiConfigFieldText(field, mapText) {
|
|
|
54
54
|
...(mapped.placeholder == null ? {} : { placeholder: mapOptionalText(mapped.placeholder, mapText) }),
|
|
55
55
|
};
|
|
56
56
|
}
|
|
57
|
+
/* What a field shows while it is empty is read like its label, so it is translated with it. */
|
|
58
|
+
if (mapped.type === "string" || mapped.type === "url" || mapped.type === "icon") {
|
|
59
|
+
return mapped.placeholder == null ? mapped : { ...mapped, placeholder: mapOptionalText(mapped.placeholder, mapText) };
|
|
60
|
+
}
|
|
61
|
+
if (mapped.type === "dimension") {
|
|
62
|
+
return {
|
|
63
|
+
...mapped,
|
|
64
|
+
...(mapped.widthPlaceholder == null ? {} : { widthPlaceholder: mapOptionalText(mapped.widthPlaceholder, mapText) }),
|
|
65
|
+
...(mapped.heightPlaceholder == null ? {} : { heightPlaceholder: mapOptionalText(mapped.heightPlaceholder, mapText) }),
|
|
66
|
+
};
|
|
67
|
+
}
|
|
68
|
+
if (mapped.type === "flags") {
|
|
69
|
+
return {
|
|
70
|
+
...mapped,
|
|
71
|
+
options: mapped.options.map((option) => ({ ...option, label: mapOptionalText(option.label, mapText) ?? option.label })),
|
|
72
|
+
};
|
|
73
|
+
}
|
|
57
74
|
if (mapped.type === "collection") {
|
|
58
75
|
return {
|
|
59
76
|
...mapped,
|
|
@@ -26,6 +26,7 @@ import { buildPhiBuilderPreviewPageNode, buildPhiBuilderRootLayoutRenderNode, bu
|
|
|
26
26
|
import { resolvePhiRenderableBlockGeometry } from "../../../types/renderable-block-geometry";
|
|
27
27
|
import { resolvePhiRootScaffoldProperties } from "./builder-geometry";
|
|
28
28
|
import { PhiWidgetPreviewFallback } from "../../../components/widgets/built-in/widget-preview";
|
|
29
|
+
import { PhiWidgetEditorPlaceholder } from "../../../components/widgets/builder/widget-editor-placeholder";
|
|
29
30
|
import { splitPhiCmsLayoutNamespacedTypeKey } from "../../../constants/cms-layout-types";
|
|
30
31
|
import { PhiBuilderDemandControllerRegistration } from "./demand-controller-registration";
|
|
31
32
|
import { buildPhiBuilderRootNodeRenderableTree } from "./root-node-renderable-tree";
|
|
@@ -570,14 +571,23 @@ function resolvePhiAuthoringLayoutRenderer(plugin, definition, renderMode) {
|
|
|
570
571
|
? plugin.render
|
|
571
572
|
: null;
|
|
572
573
|
}
|
|
574
|
+
/**
|
|
575
|
+
* The house placeholder on the canvas, for a Widget that leaves `renderEditor` out: its name, its type
|
|
576
|
+
* and its description, still. Leaving it out is the declaration; nothing else falls back to it.
|
|
577
|
+
*/
|
|
578
|
+
function renderPhiAuthoringWidgetPlaceholder(plugin) {
|
|
579
|
+
return function PhiAuthoringWidgetPlaceholder({ widget }) {
|
|
580
|
+
return _jsx(PhiWidgetEditorPlaceholder, { widget: widget, pluginTitle: plugin.title, summary: plugin.description });
|
|
581
|
+
};
|
|
582
|
+
}
|
|
573
583
|
function resolvePhiAuthoringWidgetRenderer(plugin, definition) {
|
|
574
584
|
switch (definition.renderPolicies.authoring) {
|
|
575
585
|
case "custom":
|
|
576
|
-
return plugin.renderEditor;
|
|
586
|
+
return plugin.renderEditor ?? renderPhiAuthoringWidgetPlaceholder(plugin);
|
|
577
587
|
case "usePreview":
|
|
578
588
|
// `loadAuthoring` supplies the explicit client-safe preview adapter. It is never the server
|
|
579
589
|
// plugin's `renderPreview()` implementation or an implicit runtime fallback.
|
|
580
|
-
return plugin.renderEditor;
|
|
590
|
+
return plugin.renderEditor ?? renderPhiAuthoringWidgetPlaceholder(plugin);
|
|
581
591
|
}
|
|
582
592
|
}
|
|
583
593
|
function resolvePhiAuthoringLayoutConfigParser(plugin) {
|
|
@@ -1,6 +1,5 @@
|
|
|
1
1
|
import { jsx as _jsx } from "react/jsx-runtime";
|
|
2
2
|
import { buildPhiWidgetLabelTranslatorOptions } from "../../../../../components/widgets/label-sets/runtime-options";
|
|
3
|
-
import { renderPhiWidgetPreviewPlaceholder } from "../../../../../plugins/factories/widget-renderers";
|
|
4
3
|
import { getPhiEffectsWidgetLabels } from "../../../../../components/widgets/label-sets/effects";
|
|
5
4
|
import { getPhiAuthoringToolsLabels } from "../../../../../components/widgets/label-sets/authoring-tools";
|
|
6
5
|
import { getPhiMediaWidgetLabels } from "../../../../../components/media/label-sets/media";
|
|
@@ -79,5 +78,4 @@ export const PHI_STRUCTURE_REGION_WIDGET_PLUGIN = {
|
|
|
79
78
|
fallbackMinHeight: config.fallbackMinHeight,
|
|
80
79
|
}, structureDraftsByArea: structureDraftsByArea, pageDraftsByScope: pageDraftsByScope, effectsLabels: effectsLabels, authoringToolsLabels: authoringToolsLabels, serverPreview: _jsx(PhiBuilderRegionServerPreview, { snapshot: snapshot, draft: resolvedPreviewDraft, regionKey: regionKey, runtime: runtime, registry: registry }) }) }));
|
|
81
80
|
},
|
|
82
|
-
renderPreview: ({ widget }) => renderPhiWidgetPreviewPlaceholder(widget),
|
|
83
81
|
};
|
|
@@ -31,14 +31,14 @@ export const PHI_RUNTIME_MODULE_WIDGETS = [
|
|
|
31
31
|
definePhiFirstPartyWidget({
|
|
32
32
|
definition: PHI_BUILDER_PAGES_WORKSPACE_WIDGET_DEFINITION,
|
|
33
33
|
ownerModuleId: PHI_BUILDER_RUNTIME_MODULE_ID,
|
|
34
|
-
renderPolicies: { "runtime": "custom", "preview": "
|
|
34
|
+
renderPolicies: { "runtime": "custom", "preview": "custom", "authoring": "usePreview" },
|
|
35
35
|
loadRuntime: () => import("./widgets/pages-workspace/plugin").then((module) => module.PHI_BUILDER_PAGES_WORKSPACE_WIDGET_PLUGIN),
|
|
36
36
|
loadPreview: () => import("./widgets/pages-workspace/preview-plugin").then((module) => module.PHI_BUILDER_PAGES_WORKSPACE_WIDGET_PREVIEW_PLUGIN),
|
|
37
37
|
}),
|
|
38
38
|
definePhiFirstPartyWidget({
|
|
39
39
|
definition: PHI_BUILDER_SHELLS_WORKSPACE_WIDGET_DEFINITION,
|
|
40
40
|
ownerModuleId: PHI_BUILDER_RUNTIME_MODULE_ID,
|
|
41
|
-
renderPolicies: { "runtime": "custom", "preview": "
|
|
41
|
+
renderPolicies: { "runtime": "custom", "preview": "custom", "authoring": "usePreview" },
|
|
42
42
|
loadRuntime: () => import("./widgets/shells-workspace/plugin").then((module) => module.PHI_BUILDER_SHELLS_WORKSPACE_WIDGET_PLUGIN),
|
|
43
43
|
loadPreview: () => import("./widgets/shells-workspace/preview-plugin").then((module) => module.PHI_BUILDER_SHELLS_WORKSPACE_WIDGET_PREVIEW_PLUGIN),
|
|
44
44
|
}),
|
|
@@ -59,7 +59,7 @@ export const PHI_RUNTIME_MODULE_WIDGETS = [
|
|
|
59
59
|
definePhiFirstPartyWidget({
|
|
60
60
|
definition: PHI_STRUCTURE_REGION_WIDGET_DEFINITION,
|
|
61
61
|
ownerModuleId: PHI_BUILDER_RUNTIME_MODULE_ID,
|
|
62
|
-
renderPolicies: { "runtime": "custom", "preview": "
|
|
62
|
+
renderPolicies: { "runtime": "custom", "preview": "visualPlaceholder", "authoring": "custom" },
|
|
63
63
|
loadRuntime: () => import("./widgets/structure-region/plugin").then((module) => module.PHI_STRUCTURE_REGION_WIDGET_PLUGIN),
|
|
64
64
|
loadPreview: () => import("./widgets/structure-region/plugin").then((module) => module.PHI_STRUCTURE_REGION_WIDGET_PLUGIN),
|
|
65
65
|
}),
|
|
@@ -428,16 +428,20 @@ function assertPhiRuntimeModuleServerBinding(definition) {
|
|
|
428
428
|
throw new Error(`${definition.moduleId}: required server capabilities must be unique versioned namespaced ids.`);
|
|
429
429
|
}
|
|
430
430
|
}
|
|
431
|
-
function assertPhiRuntimeModuleRenderPolicies(moduleId, type, policies) {
|
|
431
|
+
function assertPhiRuntimeModuleRenderPolicies(moduleId, type, policies, kind) {
|
|
432
432
|
if (!policies || typeof policies !== "object") {
|
|
433
433
|
throw new Error(`${moduleId}: artifact "${type}" has no render policies.`);
|
|
434
434
|
}
|
|
435
435
|
if (policies.runtime !== "custom") {
|
|
436
436
|
throw new Error(`${moduleId}: artifact "${type}" declares an invalid Runtime render policy.`);
|
|
437
437
|
}
|
|
438
|
-
if (!["custom", "runtimeReadOnly", "
|
|
438
|
+
if (!["custom", "runtimeReadOnly", "visualPlaceholder"].includes(policies.preview)) {
|
|
439
439
|
throw new Error(`${moduleId}: artifact "${type}" declares an invalid Preview render policy.`);
|
|
440
440
|
}
|
|
441
|
+
// The house placeholder stands in for a Widget; a Layout holds Regions and has no such stand-in.
|
|
442
|
+
if (kind === "layout" && policies.preview === "visualPlaceholder") {
|
|
443
|
+
throw new Error(`${moduleId}: layout "${type}" declares the Widget-only Preview policy "visualPlaceholder".`);
|
|
444
|
+
}
|
|
441
445
|
if (!["custom", "usePreview"].includes(policies.authoring)) {
|
|
442
446
|
throw new Error(`${moduleId}: artifact "${type}" declares an invalid Authoring render policy.`);
|
|
443
447
|
}
|
|
@@ -876,7 +880,7 @@ function assertPhiRuntimeModuleArtifacts(widgets, layouts, moduleId, ownerProvid
|
|
|
876
880
|
if (typeof widget.loadRuntime !== "function" || typeof widget.loadPreview !== "function") {
|
|
877
881
|
throw new Error(`${moduleId}: owned widget "${type}" must declare Runtime and Preview loaders.`);
|
|
878
882
|
}
|
|
879
|
-
assertPhiRuntimeModuleRenderPolicies(moduleId, type, widget.renderPolicies);
|
|
883
|
+
assertPhiRuntimeModuleRenderPolicies(moduleId, type, widget.renderPolicies, "widget");
|
|
880
884
|
assertPhiSignalPluginMetaContract(widget.definition.runtimeSignals, `${type}.runtimeSignals`);
|
|
881
885
|
assertOwnedAccessPolicy(moduleId, ownerProviderId, widget.accessPolicy, `widget "${type}"`);
|
|
882
886
|
widgetTypes.add(type);
|
|
@@ -902,7 +906,7 @@ function assertPhiRuntimeModuleArtifacts(widgets, layouts, moduleId, ownerProvid
|
|
|
902
906
|
if (typeof layout.loadRuntime !== "function") {
|
|
903
907
|
throw new Error(`${moduleId}: owned layout "${type}" must declare a Runtime loader.`);
|
|
904
908
|
}
|
|
905
|
-
assertPhiRuntimeModuleRenderPolicies(moduleId, type, layout.renderPolicies);
|
|
909
|
+
assertPhiRuntimeModuleRenderPolicies(moduleId, type, layout.renderPolicies, "layout");
|
|
906
910
|
assertPhiSignalPluginMetaContract(layout.definition.runtimeSignals, `${type}.runtimeSignals`);
|
|
907
911
|
assertOwnedAccessPolicy(moduleId, ownerProviderId, layout.accessPolicy, `layout "${type}"`);
|
|
908
912
|
layoutTypes.add(type);
|
|
@@ -73,7 +73,7 @@ export default createPhiAuthoringWidgetModule([
|
|
|
73
73
|
definePhiAuthoringWidgetModuleLoader(PHI_DIMENSION_WIDGET_DEFINITION, () => import("./widgets/dimension/authoring").then((module) => module.PHI_DIMENSION_WIDGET_BUILDER_PLUGIN)),
|
|
74
74
|
definePhiAuthoringWidgetModuleLoader(PHI_LENGTH_WIDGET_DEFINITION, () => import("./widgets/length/authoring").then((module) => module.PHI_LENGTH_WIDGET_BUILDER_PLUGIN)),
|
|
75
75
|
definePhiAuthoringWidgetModuleLoader(PHI_FORM_WIDGET_DEFINITION, () => import("./widgets/form/authoring").then((module) => module.PHI_FORM_WIDGET_BUILDER_PLUGIN)),
|
|
76
|
-
definePhiAuthoringWidgetModuleLoader(PHI_FORM_PREVIEW_WIDGET_DEFINITION, () =>
|
|
76
|
+
definePhiAuthoringWidgetModuleLoader(PHI_FORM_PREVIEW_WIDGET_DEFINITION, () => Promise.resolve(PHI_FORM_PREVIEW_WIDGET_DEFINITION)),
|
|
77
77
|
definePhiAuthoringWidgetModuleLoader(PHI_HEADER_NAVIGATION_WIDGET_DEFINITION, () => import("./widgets/header-navigation/authoring").then((module) => module.PHI_HEADER_NAVIGATION_WIDGET_BUILDER_PLUGIN)),
|
|
78
78
|
definePhiAuthoringWidgetModuleLoader(PHI_HTML_WIDGET_DEFINITION, () => import("./widgets/html/authoring").then((module) => module.PHI_HTML_WIDGET_BUILDER_PLUGIN)),
|
|
79
79
|
definePhiAuthoringWidgetModuleLoader(PHI_ICON_WIDGET_DEFINITION, () => import("./widgets/icon/authoring").then((module) => module.PHI_ICON_WIDGET_BUILDER_PLUGIN)),
|
|
@@ -106,7 +106,7 @@ export default createPhiAuthoringWidgetModule([
|
|
|
106
106
|
definePhiAuthoringWidgetModuleLoader(PHI_ENTRY_LIST_WIDGET_DEFINITION, () => import("./widgets/entry-list/authoring").then((module) => module.PHI_ENTRY_LIST_WIDGET_BUILDER_PLUGIN)),
|
|
107
107
|
definePhiAuthoringWidgetModuleLoader(PHI_ENTRY_DETAIL_WIDGET_DEFINITION, () => import("./widgets/entry-detail/authoring").then((module) => module.PHI_ENTRY_DETAIL_WIDGET_BUILDER_PLUGIN)),
|
|
108
108
|
definePhiAuthoringWidgetModuleLoader(PHI_ENTRY_HEADER_WIDGET_DEFINITION, () => import("./widgets/entry-header/authoring").then((module) => module.PHI_ENTRY_HEADER_WIDGET_BUILDER_PLUGIN)),
|
|
109
|
-
definePhiAuthoringWidgetModuleLoader(PHI_THREAD_CONVERSATION_WIDGET_DEFINITION, () =>
|
|
109
|
+
definePhiAuthoringWidgetModuleLoader(PHI_THREAD_CONVERSATION_WIDGET_DEFINITION, () => Promise.resolve(PHI_THREAD_CONVERSATION_WIDGET_DEFINITION)),
|
|
110
110
|
definePhiAuthoringWidgetModuleLoader(PHI_FLOAT_BUTTON_WIDGET_DEFINITION, () => import("./widgets/float-button/authoring").then((module) => module.PHI_FLOAT_BUTTON_WIDGET_BUILDER_PLUGIN)),
|
|
111
111
|
definePhiAuthoringWidgetModuleLoader(PHI_SPACER_WIDGET_DEFINITION, () => import("./widgets/spacer/authoring").then((module) => module.PHI_SPACER_WIDGET_BUILDER_PLUGIN)),
|
|
112
112
|
definePhiAuthoringWidgetModuleLoader(PHI_SWITCH_WIDGET_DEFINITION, () => import("./widgets/switch/authoring").then((module) => module.PHI_SWITCH_WIDGET_BUILDER_PLUGIN)),
|
|
@@ -342,10 +342,11 @@ export declare const PHI_CORE_RUNTIME_DATA_PROVIDER_DESCRIPTORS: ({
|
|
|
342
342
|
type: "choice";
|
|
343
343
|
heading: string;
|
|
344
344
|
label: string;
|
|
345
|
+
description: string;
|
|
346
|
+
presentation: "cascader";
|
|
345
347
|
optionsProvider: {
|
|
346
348
|
providerKey: `${string}/${string}`;
|
|
347
349
|
};
|
|
348
|
-
description?: undefined;
|
|
349
350
|
options?: undefined;
|
|
350
351
|
min?: undefined;
|
|
351
352
|
max?: undefined;
|
|
@@ -355,6 +356,7 @@ export declare const PHI_CORE_RUNTIME_DATA_PROVIDER_DESCRIPTORS: ({
|
|
|
355
356
|
label: string;
|
|
356
357
|
description: string;
|
|
357
358
|
heading?: undefined;
|
|
359
|
+
presentation?: undefined;
|
|
358
360
|
optionsProvider?: undefined;
|
|
359
361
|
options?: undefined;
|
|
360
362
|
min?: undefined;
|
|
@@ -363,24 +365,26 @@ export declare const PHI_CORE_RUNTIME_DATA_PROVIDER_DESCRIPTORS: ({
|
|
|
363
365
|
key: string;
|
|
364
366
|
type: "choice";
|
|
365
367
|
label: string;
|
|
368
|
+
description: string;
|
|
366
369
|
options: {
|
|
367
370
|
value: string;
|
|
368
371
|
label: string;
|
|
369
372
|
}[];
|
|
370
373
|
heading?: undefined;
|
|
374
|
+
presentation?: undefined;
|
|
371
375
|
optionsProvider?: undefined;
|
|
372
|
-
description?: undefined;
|
|
373
376
|
min?: undefined;
|
|
374
377
|
max?: undefined;
|
|
375
378
|
} | {
|
|
376
379
|
key: string;
|
|
377
380
|
type: "number";
|
|
378
381
|
label: string;
|
|
382
|
+
description: string;
|
|
379
383
|
min: number;
|
|
380
384
|
max: number;
|
|
381
385
|
heading?: undefined;
|
|
386
|
+
presentation?: undefined;
|
|
382
387
|
optionsProvider?: undefined;
|
|
383
|
-
description?: undefined;
|
|
384
388
|
options?: undefined;
|
|
385
389
|
})[];
|
|
386
390
|
resources?: undefined;
|
|
@@ -262,6 +262,8 @@ export const PHI_CORE_RUNTIME_DATA_PROVIDER_DESCRIPTORS = [
|
|
|
262
262
|
type: "choice",
|
|
263
263
|
heading: "Folder",
|
|
264
264
|
label: "Folder",
|
|
265
|
+
description: "The media folder whose public pictures are shown.",
|
|
266
|
+
presentation: "cascader",
|
|
265
267
|
optionsProvider: { providerKey: PHI_MEDIA_LIBRARY_DATA_PROVIDER_KEYS.folderChoices },
|
|
266
268
|
},
|
|
267
269
|
{ key: "topLevelOnly", type: "boolean", label: "This folder only", description: "Leave the pictures in its subfolders out." },
|
|
@@ -269,12 +271,20 @@ export const PHI_CORE_RUNTIME_DATA_PROVIDER_DESCRIPTORS = [
|
|
|
269
271
|
key: "sort",
|
|
270
272
|
type: "choice",
|
|
271
273
|
label: "Order",
|
|
274
|
+
description: "The order the pictures follow.",
|
|
272
275
|
options: [
|
|
273
276
|
{ value: "name_asc", label: "By file name" },
|
|
274
277
|
{ value: "created_at_desc", label: "Newest first" },
|
|
275
278
|
],
|
|
276
279
|
},
|
|
277
|
-
{
|
|
280
|
+
{
|
|
281
|
+
key: "limit",
|
|
282
|
+
type: "number",
|
|
283
|
+
label: "At most",
|
|
284
|
+
description: `How many pictures are shown at most. ${PHI_MEDIA_FOLDER_IMAGES_DEFAULT_LIMIT} when left empty, ${PHI_MEDIA_FOLDER_IMAGES_MAX_LIMIT} at the very most.`,
|
|
285
|
+
min: 1,
|
|
286
|
+
max: PHI_MEDIA_FOLDER_IMAGES_MAX_LIMIT,
|
|
287
|
+
},
|
|
278
288
|
],
|
|
279
289
|
},
|
|
280
290
|
];
|
|
@@ -348,10 +348,11 @@ export declare const PHI_CORE_RUNTIME_MODULE_DEFINITION: {
|
|
|
348
348
|
type: "choice";
|
|
349
349
|
heading: string;
|
|
350
350
|
label: string;
|
|
351
|
+
description: string;
|
|
352
|
+
presentation: "cascader";
|
|
351
353
|
optionsProvider: {
|
|
352
354
|
providerKey: `${string}/${string}`;
|
|
353
355
|
};
|
|
354
|
-
description?: undefined;
|
|
355
356
|
options?: undefined;
|
|
356
357
|
min?: undefined;
|
|
357
358
|
max?: undefined;
|
|
@@ -361,6 +362,7 @@ export declare const PHI_CORE_RUNTIME_MODULE_DEFINITION: {
|
|
|
361
362
|
label: string;
|
|
362
363
|
description: string;
|
|
363
364
|
heading?: undefined;
|
|
365
|
+
presentation?: undefined;
|
|
364
366
|
optionsProvider?: undefined;
|
|
365
367
|
options?: undefined;
|
|
366
368
|
min?: undefined;
|
|
@@ -369,24 +371,26 @@ export declare const PHI_CORE_RUNTIME_MODULE_DEFINITION: {
|
|
|
369
371
|
key: string;
|
|
370
372
|
type: "choice";
|
|
371
373
|
label: string;
|
|
374
|
+
description: string;
|
|
372
375
|
options: {
|
|
373
376
|
value: string;
|
|
374
377
|
label: string;
|
|
375
378
|
}[];
|
|
376
379
|
heading?: undefined;
|
|
380
|
+
presentation?: undefined;
|
|
377
381
|
optionsProvider?: undefined;
|
|
378
|
-
description?: undefined;
|
|
379
382
|
min?: undefined;
|
|
380
383
|
max?: undefined;
|
|
381
384
|
} | {
|
|
382
385
|
key: string;
|
|
383
386
|
type: "number";
|
|
384
387
|
label: string;
|
|
388
|
+
description: string;
|
|
385
389
|
min: number;
|
|
386
390
|
max: number;
|
|
387
391
|
heading?: undefined;
|
|
392
|
+
presentation?: undefined;
|
|
388
393
|
optionsProvider?: undefined;
|
|
389
|
-
description?: undefined;
|
|
390
394
|
options?: undefined;
|
|
391
395
|
})[];
|
|
392
396
|
resources?: undefined;
|
|
@@ -27,5 +27,5 @@ export declare const PHI_CASCADER_WIDGET_BUILDER_PLUGIN: {
|
|
|
27
27
|
fields: import("../../../../../types").PhiCmsConfigField[];
|
|
28
28
|
parseConfig: (raw: Record<string, unknown>) => PhiCascaderWidgetConfig;
|
|
29
29
|
editorInteraction?: import("../../../../../types").PhiCmsBuilderWidgetEditorInteraction;
|
|
30
|
-
renderEditor
|
|
30
|
+
renderEditor?: ((args_0: import("../../../../../types").PhiCmsBuilderWidgetRenderArgs<PhiCascaderWidgetConfig>) => import("react").ReactNode) | undefined;
|
|
31
31
|
};
|
|
@@ -1,7 +1,8 @@
|
|
|
1
1
|
import { type PhiDraftStatusWidgetLabels } from "../../../../../components/widgets/label-types/draft-status";
|
|
2
2
|
import type { PhiDraftStatusWidgetConfig } from "./config";
|
|
3
3
|
/**
|
|
4
|
-
* The draft state a Controller states, drawn as a
|
|
4
|
+
* The draft state a Controller states, drawn as a dot in the Theme's status colours; its word is the
|
|
5
|
+
* tooltip over the row, path and dot alike.
|
|
5
6
|
*
|
|
6
7
|
* Nothing is read here and nothing is worked out. The Controller the placement names is asked once,
|
|
7
8
|
* when this mounts, and answers to this address; every change after reaches it as a broadcast from
|
|
@@ -6,7 +6,7 @@ import { readPhiDraftStatusSignalValue } from "../../../../../types/draft-status
|
|
|
6
6
|
import { usePhiConfig } from "../../../../../components/root/phi-config-provider";
|
|
7
7
|
import { usePhiSignalDispatcher, usePhiSignalListener } from "../../../../../components/runtime/runtime-signal-bus";
|
|
8
8
|
import { usePhiSignalIdentity } from "../../../../../components/runtime/runtime-signal-identity";
|
|
9
|
-
import {
|
|
9
|
+
import { PhiStatusDotControl } from "../../../../../components/controls/phi-status-dot-control";
|
|
10
10
|
import { PhiFlexControl } from "../../../../../components/controls/phi-flex-control";
|
|
11
11
|
import { PhiTypographyControl } from "../../../../../components/controls/phi-typography-control";
|
|
12
12
|
import { PHI_DRAFT_STATUS_WIDGET_DEFAULT_LABELS, formatPhiDraftStatusRevisionLabel, } from "../../../../../components/widgets/label-types/draft-status";
|
|
@@ -28,7 +28,8 @@ function buildStatusLabel(state, labels) {
|
|
|
28
28
|
return labels.unavailable;
|
|
29
29
|
}
|
|
30
30
|
/**
|
|
31
|
-
* The draft state a Controller states, drawn as a
|
|
31
|
+
* The draft state a Controller states, drawn as a dot in the Theme's status colours; its word is the
|
|
32
|
+
* tooltip over the row, path and dot alike.
|
|
32
33
|
*
|
|
33
34
|
* Nothing is read here and nothing is worked out. The Controller the placement names is asked once,
|
|
34
35
|
* when this mounts, and answers to this address; every change after reaches it as a broadcast from
|
|
@@ -114,5 +115,5 @@ export function PhiDraftStatusWidget({ config, labels = PHI_DRAFT_STATUS_WIDGET_
|
|
|
114
115
|
? token.colorSuccess
|
|
115
116
|
: token.colorError;
|
|
116
117
|
const error = state?.status === "error" ? state.error ?? labels.readFailed : null;
|
|
117
|
-
return (_jsxs(PhiFlexControl, { align: "center", justify: "space-between", gap: 12, wrap: "wrap", style: { width: "100%" }, children: [
|
|
118
|
+
return (_jsxs(PhiFlexControl, { align: "center", justify: "space-between", gap: 12, wrap: "wrap", style: { width: "100%" }, children: [_jsx(PhiStatusDotControl, { color: color, label: buildStatusLabel(state, labels), children: state?.subject ? (_jsx(PhiTypographyControl, { code: true, children: state.subject })) : null }), error ? (_jsx(PhiTypographyControl, { type: "danger", children: error })) : null] }));
|
|
118
119
|
}
|
|
@@ -8,7 +8,7 @@ import { PHI_GALLERY_WIDGET_DEFINITION, } from "./config";
|
|
|
8
8
|
import { resolvePhiSpacingScaleValue } from "../../../../../components/widgets/config/spacing-options";
|
|
9
9
|
import { PHI_SEQUENCE_SETTINGS_DEFAULTS } from "../../../../../components/widgets/config/sequence-settings";
|
|
10
10
|
import { resolvePhiGalleryFrame } from "./defaults";
|
|
11
|
-
import {
|
|
11
|
+
import { PHI_GALLERY_WIDGET_DEFAULT_LABELS, } from "../../../../../components/widgets/label-types/gallery";
|
|
12
12
|
/** How many dots stand for "more than one page" on the canvas, which does not know how many pictures there are. */
|
|
13
13
|
const EDITOR_DOT_COUNT = 3;
|
|
14
14
|
/**
|
|
@@ -30,14 +30,12 @@ function PhiGalleryWidgetEditor({ config }) {
|
|
|
30
30
|
const hasFolder = folderId != null && folderId !== "";
|
|
31
31
|
const recordField = config?.recordField;
|
|
32
32
|
/*
|
|
33
|
-
* Where a field of the page record is named, the pictures are that field's and the
|
|
34
|
-
*
|
|
35
|
-
* that decides nothing.
|
|
33
|
+
* Where a field of the page record is named, the pictures are that field's and the Inspector already
|
|
34
|
+
* says which: the canvas adds no sentence. Saying "no folder chosen" there sent the author looking for
|
|
35
|
+
* a setting that decides nothing, so the Folder hints are for a Gallery that reads a Folder only.
|
|
36
36
|
*/
|
|
37
37
|
const labels = PHI_GALLERY_WIDGET_DEFAULT_LABELS;
|
|
38
|
-
const hint = recordField
|
|
39
|
-
? formatPhiGalleryWidgetLabel(labels.canvasRecordField, recordField)
|
|
40
|
-
: hasFolder ? labels.canvasFolder : labels.canvasNoFolder;
|
|
38
|
+
const hint = recordField ? null : hasFolder ? labels.canvasFolder : labels.canvasNoFolder;
|
|
41
39
|
const { aspectRatio } = resolvePhiGalleryFrame(config);
|
|
42
40
|
const arrowStyle = {
|
|
43
41
|
position: "absolute",
|
|
@@ -74,6 +72,6 @@ function PhiGalleryWidgetEditor({ config }) {
|
|
|
74
72
|
height: token.marginXS,
|
|
75
73
|
borderRadius: token.borderRadiusSM,
|
|
76
74
|
background: page === 0 ? token.colorPrimary : token.colorFill,
|
|
77
|
-
} }, page))) })) : null, _jsx(PhiTypographyControl, { type: "secondary", style: { fontSize: token.fontSizeSM }, children: hint })] }));
|
|
75
|
+
} }, page))) })) : null, hint ? (_jsx(PhiTypographyControl, { type: "secondary", style: { fontSize: token.fontSizeSM }, children: hint })) : null] }));
|
|
78
76
|
}
|
|
79
77
|
export const PHI_GALLERY_WIDGET_BUILDER_PLUGIN = createPhiCmsBuilderWidgetPlugin(PHI_GALLERY_WIDGET_DEFINITION, ({ config }) => _jsx(PhiGalleryWidgetEditor, { config: config ?? undefined }));
|
|
@@ -3,6 +3,7 @@ import { jsx as _jsx } from "react/jsx-runtime";
|
|
|
3
3
|
import { usePhiConfig } from "../../../../../components/root/phi-config-provider";
|
|
4
4
|
import { useMemo } from "react";
|
|
5
5
|
import { PhiSequenceRun, resolvePhiSequenceRunSpan } from "../../../../../components/motion/phi-sequence-run";
|
|
6
|
+
import { PhiEmptyControl } from "../../../../../components/controls/phi-empty-control";
|
|
6
7
|
import { PhiImageControl } from "../../../../../components/controls/phi-image-control";
|
|
7
8
|
import { readPhiAspectRatio, resolvePhiImagePresentation } from "../../../../../components/media/image-presentation";
|
|
8
9
|
import { PHI_GALLERY_WIDGET_DEFAULT_LABELS, } from "../../../../../components/widgets/label-types/gallery";
|
|
@@ -68,5 +69,8 @@ export function PhiGalleryWidget({ config, images: imagesInput, pictures, labels
|
|
|
68
69
|
borderRadius: token.borderRadius,
|
|
69
70
|
overflow: "hidden",
|
|
70
71
|
};
|
|
72
|
+
if (items.length === 0) {
|
|
73
|
+
return _jsx(PhiEmptyControl, { description: labels.empty });
|
|
74
|
+
}
|
|
71
75
|
return (_jsx(PhiSequenceRun, { items: items.map((item) => (_jsx(GalleryPicture, { item: item, variantKey: config?.variantKey, fit: fit, preview: config?.preview === true, sizes: sizes, aspectRatio: aspectRatio }, item.key))), settings: config, labels: labels, itemStyle: frameStyle, thumbnails: thumbnails, thumbnailWidth: PHI_GALLERY_THUMBNAIL_WIDTH }));
|
|
72
76
|
}
|
|
@@ -98,7 +98,7 @@ export const PHI_GALLERY_WIDGET_DEFINITION = {
|
|
|
98
98
|
{
|
|
99
99
|
key: "recordField",
|
|
100
100
|
type: "record-field",
|
|
101
|
-
label: "
|
|
101
|
+
label: "Record",
|
|
102
102
|
description: "Shows the pictures of a field of the record this page is about, instead of the Folder's.",
|
|
103
103
|
kinds: ["pictures"],
|
|
104
104
|
},
|
|
@@ -17,5 +17,9 @@ export type PhiGalleryWidgetServerProps = {
|
|
|
17
17
|
* they are in the HTML and the window knows what to load before anything is on screen. A record of
|
|
18
18
|
* another shape is somebody else's Provider bound here by mistake. Either failure is the author's to
|
|
19
19
|
* read and is nothing on a live page, rather than an empty gallery anywhere.
|
|
20
|
+
*
|
|
21
|
+
* Having no picture is not a failure: a product without pictures, an empty Folder, a Gallery with no
|
|
22
|
+
* Folder chosen. The Gallery says so itself, in the Foundation's empty state, so a page never needs a
|
|
23
|
+
* second Widget standing by for the case.
|
|
20
24
|
*/
|
|
21
|
-
export declare function PhiGalleryWidgetServer({ runtime, registry, config, widgetId, translate }: PhiGalleryWidgetServerProps): Promise<import("react").JSX.Element
|
|
25
|
+
export declare function PhiGalleryWidgetServer({ runtime, registry, config, widgetId, translate }: PhiGalleryWidgetServerProps): Promise<import("react").JSX.Element>;
|
|
@@ -19,19 +19,23 @@ function isPublicAssetReference(value) {
|
|
|
19
19
|
* they are in the HTML and the window knows what to load before anything is on screen. A record of
|
|
20
20
|
* another shape is somebody else's Provider bound here by mistake. Either failure is the author's to
|
|
21
21
|
* read and is nothing on a live page, rather than an empty gallery anywhere.
|
|
22
|
+
*
|
|
23
|
+
* Having no picture is not a failure: a product without pictures, an empty Folder, a Gallery with no
|
|
24
|
+
* Folder chosen. The Gallery says so itself, in the Foundation's empty state, so a page never needs a
|
|
25
|
+
* second Widget standing by for the case.
|
|
22
26
|
*/
|
|
23
27
|
export async function PhiGalleryWidgetServer({ runtime, registry, config, widgetId, translate = true }) {
|
|
24
28
|
const labels = await getPhiGalleryWidgetLabels(buildPhiWidgetLabelTranslatorOptions(runtime));
|
|
25
29
|
const renderMode = readPhiRuntimeTreeRenderMode(config);
|
|
26
30
|
/*
|
|
27
31
|
* Where the Page has a record and the Widget names a field of it, the record's pictures take the place
|
|
28
|
-
* of the Folder's -- by their address, in the page's language already -- and a record without any
|
|
29
|
-
*
|
|
32
|
+
* of the Folder's -- by their address, in the page's language already -- and a record without any shows
|
|
33
|
+
* the empty state. A Page about no record draws the Folder, which stands in for the field.
|
|
30
34
|
*/
|
|
31
35
|
const recordField = await resolvePhiWidgetRecordField({ registry, runtime, key: config.recordField, kinds: ["pictures"] });
|
|
32
36
|
if (recordField.bound) {
|
|
33
37
|
const pictures = recordField.field?.value ?? [];
|
|
34
|
-
return
|
|
38
|
+
return (_jsx(PhiRuntimeModuleRenderClientHost, { type: PhiCmsWidgetType.Gallery, componentProps: { config, pictures, labels } }));
|
|
35
39
|
}
|
|
36
40
|
const result = registry && config.source
|
|
37
41
|
? await resolvePhiRecordSource({ registry, runtime, binding: config.source })
|
|
@@ -46,7 +50,7 @@ export async function PhiGalleryWidgetServer({ runtime, registry, config, widget
|
|
|
46
50
|
return (_jsx(PhiWidgetFailureServer, { renderMode: renderMode, widgetType: PhiCmsWidgetType.Gallery, widgetId: widgetId, title: labels.unavailable, description: `The record bound from "${config.source?.providerKey ?? ""}" is not a list of images.` }));
|
|
47
51
|
}
|
|
48
52
|
if (!images || images.length === 0) {
|
|
49
|
-
return
|
|
53
|
+
return (_jsx(PhiRuntimeModuleRenderClientHost, { type: PhiCmsWidgetType.Gallery, componentProps: { config, images: [], labels } }));
|
|
50
54
|
}
|
|
51
55
|
/*
|
|
52
56
|
* Each picture's description from the Media library, in the page's language: the Library's text is
|
|
@@ -103,7 +103,7 @@ export const PHI_IMAGE_WIDGET_DEFINITION = {
|
|
|
103
103
|
{
|
|
104
104
|
key: "recordField",
|
|
105
105
|
type: "record-field",
|
|
106
|
-
label: "Record
|
|
106
|
+
label: "Record",
|
|
107
107
|
description: "Shows a picture of the record this page is about instead of the picture chosen here, which stands in where the page has no record.",
|
|
108
108
|
kinds: ["picture"],
|
|
109
109
|
},
|
|
@@ -417,6 +417,7 @@ export declare const PHI_MARKDOWN_WIDGET_DEFINITION: {
|
|
|
417
417
|
}) | {
|
|
418
418
|
key: string;
|
|
419
419
|
type: "choice";
|
|
420
|
+
heading: string;
|
|
420
421
|
label: string;
|
|
421
422
|
emptyOption: {
|
|
422
423
|
value: string;
|
|
@@ -426,6 +427,16 @@ export declare const PHI_MARKDOWN_WIDGET_DEFINITION: {
|
|
|
426
427
|
value: PhiMarkdownImageFloat;
|
|
427
428
|
label: string;
|
|
428
429
|
}[];
|
|
430
|
+
} | {
|
|
431
|
+
key: string;
|
|
432
|
+
type: "choice";
|
|
433
|
+
heading: string;
|
|
434
|
+
label: string;
|
|
435
|
+
options: {
|
|
436
|
+
value: "xxs" | "xs" | "sm" | "base" | "md" | "lg" | "xl" | "xxl" | "none";
|
|
437
|
+
label: "xxs" | "xs" | "sm" | "base" | "md" | "lg" | "xl" | "xxl" | "none";
|
|
438
|
+
}[];
|
|
439
|
+
emptyOption?: undefined;
|
|
429
440
|
})[];
|
|
430
441
|
parseConfig: typeof parsePhiCmsMarkdownWidgetConfig;
|
|
431
442
|
};
|