@phis/ui 0.5.3 → 0.5.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 +17 -7
- package/components/controls/phi-cascader-control.d.ts +9 -1
- package/components/controls/phi-cascader-control.js +25 -3
- package/components/controls/phi-money-control.d.ts +39 -0
- package/components/controls/phi-money-control.js +34 -0
- package/components/controls/phi-number-control.d.ts +6 -1
- package/components/controls/phi-number-control.js +3 -3
- package/components/controls/phi-options-provider.d.ts +7 -0
- package/components/controls/phi-options-provider.js +11 -0
- package/components/forms/extended-form-field-controls.d.ts +1 -0
- package/components/forms/extended-form-field-controls.js +23 -1
- package/components/forms/form-descriptor-runtime-client.js +13 -0
- package/components/forms/form-provider-contract.d.ts +43 -0
- package/components/forms/form-provider-contract.js +40 -0
- package/components/forms/money-field.d.ts +27 -0
- package/components/forms/money-field.js +78 -0
- package/components/forms/shared-form-provider-registry.js +4 -0
- package/components/layouts/clients/phi-flex-layout-client.js +17 -2
- package/components/layouts/clients/phi-layout-anchored-overlay.d.ts +2 -0
- package/components/layouts/clients/phi-layout-anchored-overlay.js +2 -0
- package/components/media/phi-media-picker-binding.js +6 -1
- package/components/media/phi-site-font-assets.js +6 -1
- package/components/motion/phi-sequence-run.d.ts +14 -1
- package/components/motion/phi-sequence-run.js +22 -3
- package/components/motion/phi-sequence-viewport.js +3 -1
- package/components/regions/presets/content-entry-editor-page-tree.js +5 -1
- package/components/regions/presets/content-entry-public-page-trees.js +2 -0
- package/components/tables/client/phi-table-binding.js +16 -3
- package/components/trees/client/phi-tree-binding.js +6 -2
- package/components/widgets/builder/stack-tabs.d.ts +2 -1
- package/components/widgets/builder/stack-tabs.js +18 -2
- package/components/widgets/client/shared/phi-collection-view-binding.js +10 -2
- package/components/widgets/client/shared/phi-rendered-value.d.ts +9 -1
- package/components/widgets/client/shared/phi-rendered-value.js +20 -1
- package/components/widgets/config/choice-shared.d.ts +1 -49
- package/components/widgets/config/choice-shared.js +0 -1
- package/components/widgets/config/stack-tabs.js +4 -3
- package/components/widgets/label-sets/gallery.js +6 -0
- package/components/widgets/label-sets/interval.d.ts +4 -0
- package/components/widgets/label-sets/interval.js +31 -0
- package/components/widgets/label-sets/record.js +6 -1
- package/components/widgets/label-sets/slot-upload.d.ts +4 -0
- package/components/widgets/label-sets/slot-upload.js +36 -0
- package/components/widgets/label-sets/table.js +6 -1
- package/components/widgets/label-types/gallery.d.ts +7 -0
- package/components/widgets/label-types/gallery.js +6 -0
- package/components/widgets/label-types/interval.d.ts +16 -0
- package/components/widgets/label-types/interval.js +21 -0
- package/components/widgets/label-types/record.d.ts +3 -0
- package/components/widgets/label-types/record.js +2 -0
- package/components/widgets/label-types/slot-upload.d.ts +24 -0
- package/components/widgets/label-types/slot-upload.js +16 -0
- package/components/widgets/label-types/table.d.ts +3 -0
- package/components/widgets/label-types/table.js +2 -0
- package/constants/record-field-kinds.d.ts +1 -1
- package/constants/record-field-kinds.js +1 -1
- package/constants/runtime-module-ownership.js +1 -0
- package/controls.d.ts +7 -0
- package/controls.js +4 -0
- package/helpers/cms-dialog.d.ts +39 -3
- package/helpers/cms-dialog.js +46 -4
- package/helpers/cms-page-catalog.d.ts +8 -0
- package/helpers/cms-page-catalog.js +18 -2
- package/helpers/cms-preset-nodes.d.ts +13 -3
- package/helpers/cms-preset-nodes.js +3 -2
- package/helpers/config-text-fields.d.ts +49 -0
- package/helpers/config-text-fields.js +122 -0
- package/helpers/money-amount.d.ts +48 -0
- package/helpers/money-amount.js +131 -0
- package/helpers/page-layout-check.js +15 -2
- package/helpers/preset-text-source-check.d.ts +22 -0
- package/helpers/preset-text-source-check.js +45 -0
- package/helpers/record-fields.d.ts +18 -5
- package/helpers/record-fields.js +38 -13
- package/helpers/text-source.d.ts +14 -5
- package/helpers/text-source.js +16 -3
- package/module-page-check.d.ts +1 -0
- package/module-page-check.js +1 -0
- package/module-records.d.ts +6 -3
- package/module-records.js +4 -2
- package/package.json +2 -2
- package/plugins/runtime/phi-slot-child-frame-view.js +1 -1
- package/plugins/runtime/slot-size-policy.d.ts +8 -2
- package/plugins/runtime/slot-size-policy.js +51 -16
- package/plugins/runtime-modules/accounting/module.d.ts +1 -1
- package/plugins/runtime-modules/accounting/trees/phi-default-accounting-page-tree.js +2 -0
- package/plugins/runtime-modules/app/module.d.ts +1 -1
- package/plugins/runtime-modules/asset/services/collection.js +1 -0
- package/plugins/runtime-modules/asset/trees/phi-default-builder-media-page-tree.js +2 -2
- package/plugins/runtime-modules/auth/trees/phi-default-admin-auth-settings-page-tree.js +3 -0
- package/plugins/runtime-modules/builder/clients/widget-inspector.js +2 -2
- package/plugins/runtime-modules/builder/offered-page-catalog.js +3 -3
- package/plugins/runtime-modules/builder/options-providers.js +7 -0
- package/plugins/runtime-modules/builder/trees/phi-builder-inspector-area-overlay-tree.server.js +3 -0
- package/plugins/runtime-modules/builder/trees/phi-default-builder-area-preset-tree.js +17 -3
- package/plugins/runtime-modules/contracts.d.ts +1 -1
- package/plugins/runtime-modules/core/definition.d.ts +43 -0
- package/plugins/runtime-modules/core/form-providers.d.ts +43 -0
- package/plugins/runtime-modules/core/widgets/breadcrumb/client.d.ts +6 -3
- package/plugins/runtime-modules/core/widgets/breadcrumb/client.js +6 -5
- package/plugins/runtime-modules/core/widgets/breadcrumb/plugin.js +1 -1
- package/plugins/runtime-modules/core/widgets/breadcrumb/server.d.ts +9 -1
- package/plugins/runtime-modules/core/widgets/breadcrumb/server.js +29 -3
- package/plugins/runtime-modules/core/widgets/button/config.d.ts +0 -1
- package/plugins/runtime-modules/core/widgets/button/config.js +0 -1
- package/plugins/runtime-modules/core/widgets/button/plugin.js +6 -25
- package/plugins/runtime-modules/core/widgets/card/config.d.ts +18 -2
- package/plugins/runtime-modules/core/widgets/card/config.js +16 -1
- package/plugins/runtime-modules/core/widgets/card/plugin.js +8 -10
- package/plugins/runtime-modules/core/widgets/card/server.d.ts +1 -2
- package/plugins/runtime-modules/core/widgets/card/server.js +16 -28
- package/plugins/runtime-modules/core/widgets/cascader/authoring.d.ts +4 -3
- package/plugins/runtime-modules/core/widgets/cascader/client.js +1 -1
- package/plugins/runtime-modules/core/widgets/cascader/config.d.ts +8 -2
- package/plugins/runtime-modules/core/widgets/cascader/config.js +22 -0
- package/plugins/runtime-modules/core/widgets/checkbox-group/config.d.ts +8 -2
- package/plugins/runtime-modules/core/widgets/checkbox-group/config.js +1 -1
- package/plugins/runtime-modules/core/widgets/description/config.d.ts +2 -1
- package/plugins/runtime-modules/core/widgets/entry-list/config.d.ts +2 -2
- package/plugins/runtime-modules/core/widgets/entry-list/config.js +0 -1
- package/plugins/runtime-modules/core/widgets/entry-list/plugin.js +1 -3
- package/plugins/runtime-modules/core/widgets/entry-list/server.d.ts +1 -3
- package/plugins/runtime-modules/core/widgets/entry-list/server.js +3 -3
- package/plugins/runtime-modules/core/widgets/gallery/authoring.js +12 -3
- package/plugins/runtime-modules/core/widgets/gallery/client.js +10 -1
- package/plugins/runtime-modules/core/widgets/gallery/config.d.ts +4 -1
- package/plugins/runtime-modules/core/widgets/gallery/config.js +8 -0
- package/plugins/runtime-modules/core/widgets/gallery/server.d.ts +1 -1
- package/plugins/runtime-modules/core/widgets/image/server.js +5 -9
- package/plugins/runtime-modules/core/widgets/markdown/config.d.ts +2 -1
- package/plugins/runtime-modules/core/widgets/markdown-toc/server.js +3 -5
- package/plugins/runtime-modules/core/widgets/multi-select/config.d.ts +1 -1
- package/plugins/runtime-modules/core/widgets/quick-links/plugin.js +2 -4
- package/plugins/runtime-modules/core/widgets/quick-links/server.d.ts +2 -5
- package/plugins/runtime-modules/core/widgets/quick-links/server.js +2 -6
- package/plugins/runtime-modules/core/widgets/record/client.js +8 -2
- package/plugins/runtime-modules/core/widgets/record/config.js +4 -0
- package/plugins/runtime-modules/core/widgets/result/config.d.ts +2 -2
- package/plugins/runtime-modules/core/widgets/result/config.js +0 -1
- package/plugins/runtime-modules/core/widgets/result/plugin.js +2 -4
- package/plugins/runtime-modules/core/widgets/result/server.d.ts +2 -3
- package/plugins/runtime-modules/core/widgets/result/server.js +11 -33
- package/plugins/runtime-modules/core/widgets/segmented/config.d.ts +1 -1
- package/plugins/runtime-modules/core/widgets/select-box/config.d.ts +1 -1
- package/plugins/runtime-modules/core/widgets/simple-text/config.d.ts +2 -1
- package/plugins/runtime-modules/core/widgets/simple-text/plugin.js +1 -1
- package/plugins/runtime-modules/core/widgets/slider/config.d.ts +11 -0
- package/plugins/runtime-modules/core/widgets/slider/config.js +1 -1
- package/plugins/runtime-modules/core/widgets/slot-upload/authoring.js +2 -1
- package/plugins/runtime-modules/core/widgets/slot-upload/client.d.ts +3 -1
- package/plugins/runtime-modules/core/widgets/slot-upload/client.js +45 -24
- package/plugins/runtime-modules/core/widgets/slot-upload/config.d.ts +11 -4
- package/plugins/runtime-modules/core/widgets/slot-upload/config.js +16 -1
- package/plugins/runtime-modules/core/widgets/slot-upload/plugin.js +2 -2
- package/plugins/runtime-modules/core/widgets/slot-upload/server.d.ts +8 -3
- package/plugins/runtime-modules/core/widgets/slot-upload/server.js +9 -3
- package/plugins/runtime-modules/core/widgets/spacer/config.d.ts +1 -1
- package/plugins/runtime-modules/core/widgets/spacer/config.js +1 -1
- package/plugins/runtime-modules/core/widgets/steps/config.d.ts +8 -3
- package/plugins/runtime-modules/core/widgets/steps/config.js +1 -2
- package/plugins/runtime-modules/core/widgets/steps/plugin.js +6 -30
- package/plugins/runtime-modules/core/widgets/table/client.js +4 -4
- package/plugins/runtime-modules/core/widgets/table/config.d.ts +6 -3
- package/plugins/runtime-modules/core/widgets/table/config.js +4 -1
- package/plugins/runtime-modules/core/widgets/timeline/config.d.ts +8 -1
- package/plugins/runtime-modules/core/widgets/timeline/config.js +1 -2
- package/plugins/runtime-modules/core/widgets/timeline/plugin.js +6 -37
- package/plugins/runtime-modules/descriptor-compiler.d.ts +11 -1
- package/plugins/runtime-modules/descriptor-compiler.js +49 -8
- package/plugins/runtime-modules/groups/definition.d.ts +1 -1
- package/plugins/runtime-modules/groups/forms.d.ts +18 -0
- package/plugins/runtime-modules/groups/forms.js +2 -2
- package/plugins/runtime-modules/groups/trees/phi-default-admin-groups-page-tree.js +8 -4
- package/plugins/runtime-modules/groups/trees/phi-default-app-groups-page-tree.js +2 -0
- package/plugins/runtime-modules/localization/trees/phi-default-editor-translations-page-tree.js +3 -0
- package/plugins/runtime-modules/page-preset-overlays.d.ts +18 -0
- package/plugins/runtime-modules/page-preset-overlays.js +70 -0
- package/plugins/runtime-modules/public/module.d.ts +1 -1
- package/plugins/runtime-modules/public/trees/phi-default-pub-welcome-page-tree.js +1 -0
- package/plugins/runtime-modules/resolver.js +5 -0
- package/plugins/runtime-modules/revisions/trees/phi-default-builder-revisions-page-tree.js +5 -2
- package/plugins/runtime-modules/search/widgets/search-box/server.js +3 -5
- package/plugins/runtime-modules/search/widgets/search-results/server.js +3 -5
- package/plugins/runtime-modules/theme/trees/phi-default-builder-theme-page-tree.js +4 -0
- package/plugins/runtime-modules/threads/trees/phi-default-threads-page-tree.js +6 -2
- package/plugins/runtime-modules/user-management/controller/client.js +6 -1
- package/plugins/runtime-modules/user-management/trees/phi-default-admin-users-page-tree.js +5 -3
- package/runtime-render-client.d.ts +1 -1
- package/runtime-render-client.js +2 -1
- package/server-helpers/cms-page-record.d.ts +2 -2
- package/server-helpers/cms-page-record.js +15 -5
- package/server-helpers/cms-request.js +34 -12
- package/server-helpers/cms-widget-texts.d.ts +14 -0
- package/server-helpers/cms-widget-texts.js +117 -0
- package/server-helpers/record-fields.d.ts +1 -1
- package/server-helpers/record-fields.js +1 -2
- package/server-helpers/record-samples.d.ts +4 -4
- package/server-helpers/record-samples.js +10 -2
- package/server-helpers/search-index.js +12 -3
- package/styles/root.css +6 -2
- package/types/cms-module-descriptors.d.ts +3 -0
- package/types/cms-plugins.d.ts +38 -5
- package/types/collection-provider.d.ts +7 -0
- package/types/core-widget-placements.d.ts +37 -0
- package/types/record-provider.d.ts +19 -3
- package/types/slot-size-policy.d.ts +19 -2
- package/types/table-widget.d.ts +33 -1
- package/types/table-widget.js +1 -0
- package/types/tree-widget.d.ts +7 -0
- package/types/widget-runtime.d.ts +1 -1
- package/types.d.ts +1 -0
|
@@ -3,13 +3,14 @@ import { jsx as _jsx, Fragment as _Fragment, jsxs as _jsxs } from "react/jsx-run
|
|
|
3
3
|
import { PhiTextControl } from "../../../../../controls";
|
|
4
4
|
import { PHI_SLOT_UPLOAD_WIDGET_DEFINITION } from "./config";
|
|
5
5
|
import { PhiSlotUploadWidgetClient } from "./client";
|
|
6
|
+
import { PHI_SLOT_UPLOAD_WIDGET_DEFAULT_LABELS } from "../../../../../components/widgets/label-types/slot-upload";
|
|
6
7
|
/**
|
|
7
8
|
* What an author states: where the file goes. What it takes is not among the fields, because the slot
|
|
8
9
|
* declares that and Core answers with it -- offering it here would be offering a way to disagree.
|
|
9
10
|
*/
|
|
10
11
|
export const PHI_SLOT_UPLOAD_WIDGET_BUILDER_PLUGIN = {
|
|
11
12
|
...PHI_SLOT_UPLOAD_WIDGET_DEFINITION,
|
|
12
|
-
renderEditor: ({ config }) => _jsx(PhiSlotUploadWidgetClient, { config: config }),
|
|
13
|
+
renderEditor: ({ config }) => (_jsx(PhiSlotUploadWidgetClient, { config: config, labels: PHI_SLOT_UPLOAD_WIDGET_DEFAULT_LABELS })),
|
|
13
14
|
renderEditorTools: ({ config, authoring }) => {
|
|
14
15
|
const updateConfig = authoring?.updateConfig;
|
|
15
16
|
if (!updateConfig) {
|
|
@@ -1,5 +1,7 @@
|
|
|
1
1
|
import type { PhiSlotUploadWidgetConfig } from "./config";
|
|
2
|
+
import { type PhiSlotUploadWidgetLabels } from "../../../../../components/widgets/label-types/slot-upload";
|
|
2
3
|
export type PhiSlotUploadWidgetClientProps = {
|
|
3
4
|
config?: PhiSlotUploadWidgetConfig;
|
|
5
|
+
labels: PhiSlotUploadWidgetLabels;
|
|
4
6
|
};
|
|
5
|
-
export declare function PhiSlotUploadWidgetClient({ config }: PhiSlotUploadWidgetClientProps): import("react").JSX.Element;
|
|
7
|
+
export declare function PhiSlotUploadWidgetClient({ config, labels }: PhiSlotUploadWidgetClientProps): import("react").JSX.Element;
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
"use client";
|
|
2
|
-
import { jsx as _jsx,
|
|
2
|
+
import { jsx as _jsx, jsxs as _jsxs, Fragment as _Fragment } from "react/jsx-runtime";
|
|
3
3
|
import { PhiEntryListControl } from "../../../../../components/controls/phi-entry-list-control";
|
|
4
4
|
import { PhiProgressControl } from "../../../../../components/controls/phi-progress-control";
|
|
5
5
|
import { PhiButtonControl } from "../../../../../components/controls/phi-button-control";
|
|
@@ -11,10 +11,29 @@ import { usePhiSignalListener } from "../../../../../components/runtime/runtime-
|
|
|
11
11
|
import { emitPhiSignalCapability, usePhiSignalEmitter, usePhiSignalIdentity, } from "../../../../../components/runtime/runtime-signal-identity";
|
|
12
12
|
import { readPhiTableBindingParamsSignalValue } from "../../../../../types/table-signal-values";
|
|
13
13
|
import { findPhiSignalListenRoute } from "../../../../../helpers/signal-listen-routes";
|
|
14
|
+
import { formatPhiSlotUploadWidgetLabel, } from "../../../../../components/widgets/label-types/slot-upload";
|
|
14
15
|
import { PhiFlexControl } from "../../../../../components/controls/phi-flex-control";
|
|
15
16
|
import { PhiTypographyControl } from "../../../../../components/controls/phi-typography-control";
|
|
16
17
|
import { PhiIcon } from "../../../../../components/shell/phi-icon";
|
|
17
|
-
|
|
18
|
+
import { PhiImageControl } from "../../../../../components/controls/phi-image-control";
|
|
19
|
+
import { PhiLabeledControl } from "../../../../../components/controls/phi-labeled-control";
|
|
20
|
+
import { resolvePhiImagePresentation } from "../../../../../components/media/image-presentation";
|
|
21
|
+
import { PhiMediaKind, resolvePhiMediaKindFromContentType } from "../../../../../constants/media";
|
|
22
|
+
/** The side of the square a picture of the slot is shown at, beside its type and size. */
|
|
23
|
+
const THUMBNAIL_SIZE = 48;
|
|
24
|
+
/*
|
|
25
|
+
* A picture is shown, everything else is named: its type and size are said either way, because a
|
|
26
|
+
* thumbnail tells which picture it is but not whether it is the 40 MB original somebody meant to shrink.
|
|
27
|
+
* The address is Core's delivery path for the file, drawn as it is rather than through the optimiser:
|
|
28
|
+
* a slot's file is not a public Asset, so the optimiser may not take its bytes.
|
|
29
|
+
*/
|
|
30
|
+
function SlotFileTitle({ file, text }) {
|
|
31
|
+
if (resolvePhiMediaKindFromContentType(file.contentType) !== PhiMediaKind.Image) {
|
|
32
|
+
return text;
|
|
33
|
+
}
|
|
34
|
+
return (_jsxs(PhiFlexControl, { align: "center", gap: 8, children: [_jsx(PhiImageControl, { presentation: resolvePhiImagePresentation({ sourceKind: "url", sourceUrl: file.contentPath, fit: "cover" }), source: "url", alt: "", width: THUMBNAIL_SIZE, height: THUMBNAIL_SIZE, loading: "lazy", style: { flex: "none", borderRadius: "var(--phi-border-radius-sm)", overflow: "hidden" } }), _jsx("span", { children: text })] }));
|
|
35
|
+
}
|
|
36
|
+
export function PhiSlotUploadWidgetClient({ config, labels }) {
|
|
18
37
|
const addon = config?.addon?.trim() ?? "";
|
|
19
38
|
const table = config?.table?.trim() ?? "";
|
|
20
39
|
const slotName = config?.slot?.trim() ?? "";
|
|
@@ -55,10 +74,12 @@ export function PhiSlotUploadWidgetClient({ config }) {
|
|
|
55
74
|
});
|
|
56
75
|
const body = await response.json().catch(() => null);
|
|
57
76
|
if (!response.ok) {
|
|
58
|
-
throw new Error(typeof body?.error === "string"
|
|
77
|
+
throw new Error(typeof body?.error === "string"
|
|
78
|
+
? body.error
|
|
79
|
+
: formatPhiSlotUploadWidgetLabel(labels.serverAnswered, response.status));
|
|
59
80
|
}
|
|
60
81
|
return body ?? {};
|
|
61
|
-
}, []);
|
|
82
|
+
}, [labels.serverAnswered]);
|
|
62
83
|
usePhiSignalListener(useCallback((signal) => {
|
|
63
84
|
if (!findPhiSignalListenRoute(listenRoutes, signal, signalIdentity.receiver))
|
|
64
85
|
return;
|
|
@@ -89,14 +110,14 @@ export function PhiSlotUploadWidgetClient({ config }) {
|
|
|
89
110
|
const declared = (body.slots ?? [])
|
|
90
111
|
.find((entry) => entry.name === slotName);
|
|
91
112
|
setSlot(declared ?? null);
|
|
92
|
-
setSlotFailure(declared ? null :
|
|
113
|
+
setSlotFailure(declared ? null : formatPhiSlotUploadWidgetLabel(labels.slotMissing, slotName));
|
|
93
114
|
})
|
|
94
115
|
.catch((error) => {
|
|
95
116
|
if (live)
|
|
96
|
-
setSlotFailure(error instanceof Error ? error.message :
|
|
117
|
+
setSlotFailure(error instanceof Error ? error.message : labels.unreachable);
|
|
97
118
|
});
|
|
98
119
|
return () => { live = false; };
|
|
99
|
-
}, [base, read, slotName]);
|
|
120
|
+
}, [base, labels.slotMissing, labels.unreachable, read, slotName]);
|
|
100
121
|
// Reads rather than stores: what to do with the answer belongs to whoever asked, and an effect that
|
|
101
122
|
// only subscribes is one the rules about effects are happy with.
|
|
102
123
|
const readFiles = useCallback(async (owner) => {
|
|
@@ -117,9 +138,9 @@ export function PhiSlotUploadWidgetClient({ config }) {
|
|
|
117
138
|
setLoaded({ ownerId, files: await readFiles(ownerId) });
|
|
118
139
|
}
|
|
119
140
|
catch (error) {
|
|
120
|
-
setFailure(error instanceof Error ? error.message :
|
|
141
|
+
setFailure(error instanceof Error ? error.message : labels.unreachable);
|
|
121
142
|
}
|
|
122
|
-
}, [ownerId, readFiles]);
|
|
143
|
+
}, [labels.unreachable, ownerId, readFiles]);
|
|
123
144
|
useEffect(() => {
|
|
124
145
|
if (!base || !ownerId) {
|
|
125
146
|
return;
|
|
@@ -130,10 +151,10 @@ export function PhiSlotUploadWidgetClient({ config }) {
|
|
|
130
151
|
setLoaded({ ownerId, files }); })
|
|
131
152
|
.catch((error) => {
|
|
132
153
|
if (live)
|
|
133
|
-
setFailure(error instanceof Error ? error.message :
|
|
154
|
+
setFailure(error instanceof Error ? error.message : labels.unreachable);
|
|
134
155
|
});
|
|
135
156
|
return () => { live = false; };
|
|
136
|
-
}, [base, ownerId, readFiles]);
|
|
157
|
+
}, [base, labels.unreachable, ownerId, readFiles]);
|
|
137
158
|
/*
|
|
138
159
|
* The session, begun and settled at the Add-on's root; the transfer between them is Core's own and
|
|
139
160
|
* the same one every Media surface runs, progress and refusals included.
|
|
@@ -201,23 +222,23 @@ export function PhiSlotUploadWidgetClient({ config }) {
|
|
|
201
222
|
await read(`${base}/${encodeURIComponent(ownerId)}/${encodeURIComponent(id)}`, { method: "DELETE" });
|
|
202
223
|
}
|
|
203
224
|
catch {
|
|
204
|
-
setFailure(
|
|
225
|
+
setFailure(labels.removeFailed);
|
|
205
226
|
return;
|
|
206
227
|
}
|
|
207
228
|
announceChanged();
|
|
208
229
|
await reload();
|
|
209
|
-
}, [announceChanged, base, ownerId, read, reload]);
|
|
230
|
+
}, [announceChanged, base, labels.removeFailed, ownerId, read, reload]);
|
|
210
231
|
if (!base || !slotName) {
|
|
211
|
-
return _jsx(
|
|
232
|
+
return (_jsx(PhiLabeledControl, { label: config?.label, children: _jsx(PhiTypographyControl, { type: "secondary", children: labels.unconfigured }) }));
|
|
212
233
|
}
|
|
213
|
-
return (_jsxs(PhiFlexControl, { vertical: true, gap: 8, "data-phis-slot-upload": slotName, children: [ownerId === null ? (_jsx(PhiTypographyControl, { type: "secondary", children:
|
|
214
|
-
|
|
215
|
-
|
|
216
|
-
|
|
217
|
-
|
|
218
|
-
|
|
219
|
-
|
|
220
|
-
|
|
221
|
-
|
|
222
|
-
|
|
234
|
+
return (_jsx(PhiLabeledControl, { label: config?.label, fill: true, children: _jsxs(PhiFlexControl, { vertical: true, gap: 8, "data-phis-slot-upload": slotName, children: [ownerId === null ? (_jsx(PhiTypographyControl, { type: "secondary", children: labels.noRow })) : (_jsxs(_Fragment, { children: [_jsx("input", { ref: fileInputRef, type: "file", hidden: true, multiple: slot?.cardinality === "many", accept: slot?.contentTypes.join(","), onChange: (event) => {
|
|
235
|
+
for (const file of Array.from(event.target.files ?? []))
|
|
236
|
+
void upload.upload(file);
|
|
237
|
+
// Cleared so choosing the same file again is a change, and uploads again.
|
|
238
|
+
event.target.value = "";
|
|
239
|
+
} }), _jsx(PhiButtonControl, { icon: _jsx(PhiIcon, { name: "upload", size: "inherit" }), label: labels.choose, onClick: () => fileInputRef.current?.click() })] })), upload.items.filter((item) => item.status === "uploading").map((item) => (_jsx(PhiProgressControl, { percent: item.progress, size: "small" }, item.localId))), slotFailure ?? failure ? (_jsx(PhiTypographyControl, { type: "danger", role: "alert", children: slotFailure ?? failure })) : null, _jsx(PhiEntryListControl, { emptyDescription: labels.empty, entries: [...files].map((file) => ({
|
|
240
|
+
key: String(file.id),
|
|
241
|
+
title: (_jsx(SlotFileTitle, { file: file, text: formatPhiSlotUploadWidgetLabel(labels.fileTitle, file.contentType, file.byteSize) })),
|
|
242
|
+
action: (_jsx(PhiButtonControl, { size: "small", icon: _jsx(PhiIcon, { name: "delete", size: "inherit" }), ariaLabel: labels.remove, tooltip: labels.remove, onClick: () => { void remove(file.id); } })),
|
|
243
|
+
})) })] }) }));
|
|
223
244
|
}
|
|
@@ -2,6 +2,8 @@ import { type PhiSignalRouteSet } from "../../../../../types/signals";
|
|
|
2
2
|
import { type PhiCmsWidgetConfigBase } from "../../../../../widget-config";
|
|
3
3
|
export declare const PHI_SLOT_UPLOAD_WIDGET_TYPE: string;
|
|
4
4
|
export type PhiSlotUploadWidgetConfig = PhiCmsWidgetConfigBase & {
|
|
5
|
+
/** What the field is called where it stands -- "Cover picture", "Further pictures". Absent draws none. */
|
|
6
|
+
label?: string;
|
|
5
7
|
/** The Add-on that owns the table, by package name -- `@scope/name`. */
|
|
6
8
|
addon?: string;
|
|
7
9
|
table?: string;
|
|
@@ -11,7 +13,7 @@ export type PhiSlotUploadWidgetConfig = PhiCmsWidgetConfigBase & {
|
|
|
11
13
|
/** How the row reaches this field. Wired where the widget is placed, like every other Signal. */
|
|
12
14
|
signalRoutes?: PhiSignalRouteSet | null;
|
|
13
15
|
};
|
|
14
|
-
declare function parsePhiSlotUploadWidgetConfig(config: Record<string, unknown>): PhiSlotUploadWidgetConfig;
|
|
16
|
+
export declare function parsePhiSlotUploadWidgetConfig(config: Record<string, unknown>): PhiSlotUploadWidgetConfig;
|
|
15
17
|
export declare const PHI_SLOT_UPLOAD_WIDGET_DEFINITION: {
|
|
16
18
|
kind: "widget";
|
|
17
19
|
pluginKey: string;
|
|
@@ -21,11 +23,17 @@ export declare const PHI_SLOT_UPLOAD_WIDGET_DEFINITION: {
|
|
|
21
23
|
category: "media";
|
|
22
24
|
description: string;
|
|
23
25
|
iconFamily: string;
|
|
24
|
-
fields: {
|
|
26
|
+
fields: ({
|
|
25
27
|
key: string;
|
|
26
28
|
type: "string";
|
|
27
29
|
label: string;
|
|
28
|
-
|
|
30
|
+
description: string;
|
|
31
|
+
} | {
|
|
32
|
+
key: string;
|
|
33
|
+
type: "string";
|
|
34
|
+
label: string;
|
|
35
|
+
description?: undefined;
|
|
36
|
+
})[];
|
|
29
37
|
defaultConfig: {
|
|
30
38
|
ownerParam: string;
|
|
31
39
|
};
|
|
@@ -45,4 +53,3 @@ export declare const PHI_SLOT_UPLOAD_WIDGET_DEFINITION: {
|
|
|
45
53
|
}[];
|
|
46
54
|
};
|
|
47
55
|
};
|
|
48
|
-
export {};
|
|
@@ -15,9 +15,23 @@ import { readRenderableBlockConfig, readString, } from "../../../../../widget-co
|
|
|
15
15
|
const PHI_SLOT_UPLOAD_WIDGET_TYPE_KEY = "slot-upload";
|
|
16
16
|
const PHI_SLOT_UPLOAD_WIDGET_PLUGIN_KEY = resolvePhiCmsWidgetPluginKey(PHI_SLOT_UPLOAD_WIDGET_TYPE_KEY);
|
|
17
17
|
export const PHI_SLOT_UPLOAD_WIDGET_TYPE = buildPhiCmsWidgetNamespacedTypeKey(PHI_SLOT_UPLOAD_WIDGET_PLUGIN_KEY, PHI_SLOT_UPLOAD_WIDGET_TYPE_KEY);
|
|
18
|
-
|
|
18
|
+
/*
|
|
19
|
+
* The label is read strictly: a stored value that is not text is a mistake in the document, and a field
|
|
20
|
+
* that renders anyway hides it. Absent, null and blank all mean the field carries no label.
|
|
21
|
+
*/
|
|
22
|
+
function readLabel(value) {
|
|
23
|
+
if (value === undefined || value === null)
|
|
24
|
+
return undefined;
|
|
25
|
+
if (typeof value !== "string") {
|
|
26
|
+
throw new Error(`Invalid Slot upload label ${JSON.stringify(value)}. Expected text.`);
|
|
27
|
+
}
|
|
28
|
+
return value.trim() || undefined;
|
|
29
|
+
}
|
|
30
|
+
export function parsePhiSlotUploadWidgetConfig(config) {
|
|
31
|
+
const label = readLabel(config.label);
|
|
19
32
|
return {
|
|
20
33
|
...readRenderableBlockConfig(config),
|
|
34
|
+
...(label === undefined ? {} : { label }),
|
|
21
35
|
addon: readString(config.addon),
|
|
22
36
|
table: readString(config.table),
|
|
23
37
|
slot: readString(config.slot),
|
|
@@ -35,6 +49,7 @@ export const PHI_SLOT_UPLOAD_WIDGET_DEFINITION = {
|
|
|
35
49
|
description: "Puts a file into a declared slot on a row of an Add-on's table.",
|
|
36
50
|
iconFamily: "media",
|
|
37
51
|
fields: [
|
|
52
|
+
{ key: "label", type: "string", label: "Label", description: "What the field is called where it stands." },
|
|
38
53
|
{ key: "addon", type: "string", label: "Add-on" },
|
|
39
54
|
{ key: "table", type: "string", label: "Table" },
|
|
40
55
|
{ key: "slot", type: "string", label: "Slot" },
|
|
@@ -3,6 +3,6 @@ import { PHI_SLOT_UPLOAD_WIDGET_DEFINITION } from "./config";
|
|
|
3
3
|
import { PhiSlotUploadWidget } from "./server";
|
|
4
4
|
export const PHI_SLOT_UPLOAD_WIDGET_PLUGIN = {
|
|
5
5
|
...PHI_SLOT_UPLOAD_WIDGET_DEFINITION,
|
|
6
|
-
render: ({ config }) => _jsx(PhiSlotUploadWidget, { config: config }),
|
|
7
|
-
renderPreview: ({ config }) => (_jsx(PhiSlotUploadWidget, { config: { ...config, renderMode: "preview" } })),
|
|
6
|
+
render: ({ config, runtime }) => _jsx(PhiSlotUploadWidget, { config: config, runtime: runtime }),
|
|
7
|
+
renderPreview: ({ config, runtime }) => (_jsx(PhiSlotUploadWidget, { config: { ...config, renderMode: "preview" }, runtime: runtime })),
|
|
8
8
|
};
|
|
@@ -1,8 +1,13 @@
|
|
|
1
|
+
import "server-only";
|
|
2
|
+
import type { PhiBlockRuntime } from "../../../../../types";
|
|
1
3
|
import { type PhiSlotUploadWidgetConfig } from "./config";
|
|
2
4
|
/**
|
|
3
5
|
* Handed to the Render Client by type: what a slot holds depends on who is asking and on which row a
|
|
4
|
-
* surface is about, and neither is knowable where a page is rendered for a cache.
|
|
6
|
+
* surface is about, and neither is knowable where a page is rendered for a cache. Its texts are read
|
|
7
|
+
* here, in the page's language, and travel with it: the field's own captions from its Label Set; the
|
|
8
|
+
* label somebody wrote into the config arrives translated (server-helpers/cms-widget-texts.ts).
|
|
5
9
|
*/
|
|
6
|
-
export declare function PhiSlotUploadWidget({ config }: {
|
|
10
|
+
export declare function PhiSlotUploadWidget({ config, runtime, }: {
|
|
7
11
|
config?: PhiSlotUploadWidgetConfig;
|
|
8
|
-
|
|
12
|
+
runtime: PhiBlockRuntime;
|
|
13
|
+
}): Promise<import("react").JSX.Element>;
|
|
@@ -1,10 +1,16 @@
|
|
|
1
1
|
import { jsx as _jsx } from "react/jsx-runtime";
|
|
2
|
+
import "server-only";
|
|
2
3
|
import { PhiRuntimeModuleRenderClientHost } from "../../../../../runtime-render-client";
|
|
4
|
+
import { getPhiSlotUploadWidgetLabels } from "../../../../../components/widgets/label-sets/slot-upload";
|
|
5
|
+
import { buildPhiWidgetLabelTranslatorOptions } from "../../../../../components/widgets/label-sets/runtime-options";
|
|
3
6
|
import { PHI_SLOT_UPLOAD_WIDGET_TYPE } from "./config";
|
|
4
7
|
/**
|
|
5
8
|
* Handed to the Render Client by type: what a slot holds depends on who is asking and on which row a
|
|
6
|
-
* surface is about, and neither is knowable where a page is rendered for a cache.
|
|
9
|
+
* surface is about, and neither is knowable where a page is rendered for a cache. Its texts are read
|
|
10
|
+
* here, in the page's language, and travel with it: the field's own captions from its Label Set; the
|
|
11
|
+
* label somebody wrote into the config arrives translated (server-helpers/cms-widget-texts.ts).
|
|
7
12
|
*/
|
|
8
|
-
export function PhiSlotUploadWidget({ config }) {
|
|
9
|
-
|
|
13
|
+
export async function PhiSlotUploadWidget({ config, runtime, }) {
|
|
14
|
+
const labels = await getPhiSlotUploadWidgetLabels(buildPhiWidgetLabelTranslatorOptions(runtime));
|
|
15
|
+
return (_jsx(PhiRuntimeModuleRenderClientHost, { type: PHI_SLOT_UPLOAD_WIDGET_TYPE, componentProps: { config, labels } }));
|
|
10
16
|
}
|
|
@@ -10,7 +10,7 @@ export declare const PHI_SPACER_WIDGET_DEFINITION: {
|
|
|
10
10
|
category: "structure";
|
|
11
11
|
icon: string;
|
|
12
12
|
iconFamily: string;
|
|
13
|
-
slotSizePolicy: "
|
|
13
|
+
slotSizePolicy: "rest";
|
|
14
14
|
fields: never[];
|
|
15
15
|
parseConfig: (config: Record<string, unknown>) => PhiSpacerWidgetConfig;
|
|
16
16
|
};
|
|
@@ -9,7 +9,7 @@ export const PHI_SPACER_WIDGET_DEFINITION = {
|
|
|
9
9
|
category: "structure",
|
|
10
10
|
icon: "antd:column-width-outlined",
|
|
11
11
|
iconFamily: "layout",
|
|
12
|
-
slotSizePolicy: "
|
|
12
|
+
slotSizePolicy: "rest",
|
|
13
13
|
fields: [],
|
|
14
14
|
parseConfig: (config) => readRenderableBlockConfig(config),
|
|
15
15
|
};
|
|
@@ -18,13 +18,18 @@ export declare const PHI_STEPS_WIDGET_DEFINITION: {
|
|
|
18
18
|
kind: "widget";
|
|
19
19
|
pluginKey: string;
|
|
20
20
|
typeKey: string;
|
|
21
|
-
translatesOwnText: true;
|
|
22
21
|
title: string;
|
|
23
22
|
description: string;
|
|
24
23
|
category: "content";
|
|
25
24
|
icon: string;
|
|
26
25
|
iconFamily: string;
|
|
27
|
-
slotSizePolicy:
|
|
26
|
+
slotSizePolicy: {
|
|
27
|
+
configField: string;
|
|
28
|
+
byValue: {
|
|
29
|
+
vertical: "intrinsic";
|
|
30
|
+
};
|
|
31
|
+
otherwise: "fill-inline";
|
|
32
|
+
};
|
|
28
33
|
runtimeSignals: {
|
|
29
34
|
emits: ({
|
|
30
35
|
id: string;
|
|
@@ -79,7 +84,7 @@ export declare const PHI_STEPS_WIDGET_DEFINITION: {
|
|
|
79
84
|
key: string;
|
|
80
85
|
type: "collection";
|
|
81
86
|
label: string;
|
|
82
|
-
editorPlacement: "
|
|
87
|
+
editorPlacement: "inspector" | "toolbar";
|
|
83
88
|
itemKeyField: string;
|
|
84
89
|
itemLabelField: string;
|
|
85
90
|
defaultItem: {
|
|
@@ -15,13 +15,12 @@ export const PHI_STEPS_WIDGET_DEFINITION = {
|
|
|
15
15
|
kind: "widget",
|
|
16
16
|
pluginKey: resolvePhiCmsWidgetPluginKey("steps"),
|
|
17
17
|
typeKey: "steps",
|
|
18
|
-
translatesOwnText: true,
|
|
19
18
|
title: "Steps",
|
|
20
19
|
description: "Where a sequence stands, as numbered steps; can follow and drive a Stack.",
|
|
21
20
|
category: "content",
|
|
22
21
|
icon: "antd:ordered-list-outlined",
|
|
23
22
|
iconFamily: "basic",
|
|
24
|
-
slotSizePolicy: "intrinsic",
|
|
23
|
+
slotSizePolicy: { configField: "orientation", byValue: { vertical: "intrinsic" }, otherwise: "fill-inline" },
|
|
25
24
|
runtimeSignals: {
|
|
26
25
|
...PHI_SELECT_CONTROL_SIGNALS,
|
|
27
26
|
},
|
|
@@ -1,38 +1,14 @@
|
|
|
1
1
|
import { jsx as _jsx } from "react/jsx-runtime";
|
|
2
|
-
import { PhiCmsFlags } from "../../../../../constants/phi-cms";
|
|
3
|
-
import { hasPhiFlag } from "../../../../../helpers/flags";
|
|
4
2
|
import { PhiCmsWidgetType } from "../../../../../constants/cms-widget-types";
|
|
5
3
|
import { PhiRuntimeModuleRenderClientHost } from "../../../../../components/runtime/runtime-module-render-client-manifest";
|
|
6
|
-
import { trBulkForLocale } from "../../../../../server-helpers/translate";
|
|
7
4
|
import { PHI_STEPS_WIDGET_DEFINITION } from "./config";
|
|
8
|
-
|
|
9
|
-
* The steps'
|
|
10
|
-
* they are
|
|
11
|
-
* at runtime, and those are the Stack's to translate.
|
|
5
|
+
/*
|
|
6
|
+
* The steps' titles and the lines under them arrive translated (server-helpers/cms-widget-texts.ts); the
|
|
7
|
+
* values stay as they are, they are what the steps send. Steps that follow a Stack take their titles
|
|
8
|
+
* from its slots at runtime, and those are the Stack's to translate.
|
|
12
9
|
*/
|
|
13
|
-
async function translatePhiStepsConfig(config, runtime, translate) {
|
|
14
|
-
if (!translate || config.options.length === 0)
|
|
15
|
-
return config;
|
|
16
|
-
const texts = config.options.flatMap((option) => [option.label, option.description ?? ""]);
|
|
17
|
-
const translated = await trBulkForLocale(runtime.locale.current, texts);
|
|
18
|
-
return {
|
|
19
|
-
...config,
|
|
20
|
-
options: config.options.map((option, index) => ({
|
|
21
|
-
...option,
|
|
22
|
-
label: translated[index * 2]?.trim() || option.label,
|
|
23
|
-
...(option.description ? { description: translated[index * 2 + 1]?.trim() || option.description } : {}),
|
|
24
|
-
})),
|
|
25
|
-
};
|
|
26
|
-
}
|
|
27
10
|
export const PHI_STEPS_WIDGET_PLUGIN = {
|
|
28
11
|
...PHI_STEPS_WIDGET_DEFINITION,
|
|
29
|
-
render:
|
|
30
|
-
|
|
31
|
-
config: await translatePhiStepsConfig(config, runtime, !hasPhiFlag(widget.flags, PhiCmsFlags.NoTranslate)),
|
|
32
|
-
} })),
|
|
33
|
-
renderPreview: async ({ widget, config, runtime }) => (_jsx(PhiRuntimeModuleRenderClientHost, { type: PhiCmsWidgetType.Steps, componentProps: {
|
|
34
|
-
blockId: widget.id,
|
|
35
|
-
config: await translatePhiStepsConfig(config, runtime, !hasPhiFlag(widget.flags, PhiCmsFlags.NoTranslate)),
|
|
36
|
-
signalsEnabled: false,
|
|
37
|
-
} })),
|
|
12
|
+
render: ({ widget, config }) => (_jsx(PhiRuntimeModuleRenderClientHost, { type: PhiCmsWidgetType.Steps, componentProps: { blockId: widget.id, config } })),
|
|
13
|
+
renderPreview: ({ widget, config }) => (_jsx(PhiRuntimeModuleRenderClientHost, { type: PhiCmsWidgetType.Steps, componentProps: { blockId: widget.id, config, signalsEnabled: false } })),
|
|
38
14
|
};
|
|
@@ -56,8 +56,8 @@ const PHI_TABLE_ACTION_BUTTON_STYLE = { whiteSpace: "nowrap" };
|
|
|
56
56
|
function formatTableActionTemplate(value, templateValue) {
|
|
57
57
|
return value && templateValue != null ? formatPhiTableWidgetLabel(value, templateValue) : value;
|
|
58
58
|
}
|
|
59
|
-
function renderTableValue(value, column, row) {
|
|
60
|
-
const content = renderPhiValueContent(value, column);
|
|
59
|
+
function renderTableValue(value, column, row, labels) {
|
|
60
|
+
const content = renderPhiValueContent(value, column, labels);
|
|
61
61
|
if (!column.iconFieldKey) {
|
|
62
62
|
return content;
|
|
63
63
|
}
|
|
@@ -640,7 +640,7 @@ export function PhiTableWidgetClient({ config: inputConfig, renderMode, external
|
|
|
640
640
|
proposedValue,
|
|
641
641
|
}).catch(() => undefined);
|
|
642
642
|
} : undefined,
|
|
643
|
-
render: (value, row) => renderTableValue(value, column, row),
|
|
643
|
+
render: (value, row) => renderTableValue(value, column, row, labels),
|
|
644
644
|
}));
|
|
645
645
|
if (rowActions.length || features.rowReordering?.enabled) {
|
|
646
646
|
result.push({
|
|
@@ -665,7 +665,7 @@ export function PhiTableWidgetClient({ config: inputConfig, renderMode, external
|
|
|
665
665
|
});
|
|
666
666
|
}
|
|
667
667
|
return result;
|
|
668
|
-
}, [activateAction, commitField, conditionSources, features.actions?.rowLayout, features.editing?.disabledWhen, features.editing?.mode, features.rowReordering?.enabled, isFieldMutationPending, labels
|
|
668
|
+
}, [activateAction, commitField, conditionSources, features.actions?.rowLayout, features.editing?.disabledWhen, features.editing?.mode, features.rowReordering?.enabled, isFieldMutationPending, labels, loading, presentation.columns, resolvedControlSize, resource, rowActions]);
|
|
669
669
|
const resolveSummaryValue = useCallback((item) => {
|
|
670
670
|
if (item.value.source === "provider")
|
|
671
671
|
return summary[item.value.fieldKey];
|
|
@@ -74,6 +74,7 @@ export declare const PHI_TABLE_WIDGET_DEFINITION: {
|
|
|
74
74
|
type: "string" | "url" | "icon";
|
|
75
75
|
emptyValue?: "";
|
|
76
76
|
placeholder?: string;
|
|
77
|
+
text?: false | "label" | "message";
|
|
77
78
|
}) | ({
|
|
78
79
|
key: string;
|
|
79
80
|
label: string;
|
|
@@ -137,7 +138,7 @@ export declare const PHI_TABLE_WIDGET_DEFINITION: {
|
|
|
137
138
|
heading?: string;
|
|
138
139
|
} & {
|
|
139
140
|
type: "record-field";
|
|
140
|
-
kinds: readonly import("../../../../../
|
|
141
|
+
kinds: readonly import("../../../../../module-records").PhiRecordFieldKind[];
|
|
141
142
|
}) | ({
|
|
142
143
|
key: string;
|
|
143
144
|
label: string;
|
|
@@ -386,6 +387,7 @@ export declare const PHI_TABLE_WIDGET_DEFINITION: {
|
|
|
386
387
|
type: "string" | "url" | "icon";
|
|
387
388
|
emptyValue?: "";
|
|
388
389
|
placeholder?: string;
|
|
390
|
+
text?: false | "label" | "message";
|
|
389
391
|
} | {
|
|
390
392
|
visibleWhen: {
|
|
391
393
|
field: string;
|
|
@@ -461,7 +463,7 @@ export declare const PHI_TABLE_WIDGET_DEFINITION: {
|
|
|
461
463
|
editorPlacement?: "inspector" | "geometry" | "toolbar";
|
|
462
464
|
heading?: string;
|
|
463
465
|
type: "record-field";
|
|
464
|
-
kinds: readonly import("../../../../../
|
|
466
|
+
kinds: readonly import("../../../../../module-records").PhiRecordFieldKind[];
|
|
465
467
|
} | {
|
|
466
468
|
visibleWhen: {
|
|
467
469
|
field: string;
|
|
@@ -765,6 +767,7 @@ export declare const PHI_TABLE_WIDGET_DEFINITION: {
|
|
|
765
767
|
type: "string" | "url" | "icon";
|
|
766
768
|
emptyValue?: "";
|
|
767
769
|
placeholder?: string;
|
|
770
|
+
text?: false | "label" | "message";
|
|
768
771
|
} | {
|
|
769
772
|
visibleWhen: {
|
|
770
773
|
field: string;
|
|
@@ -840,7 +843,7 @@ export declare const PHI_TABLE_WIDGET_DEFINITION: {
|
|
|
840
843
|
editorPlacement?: "inspector" | "geometry" | "toolbar";
|
|
841
844
|
heading?: string;
|
|
842
845
|
type: "record-field";
|
|
843
|
-
kinds: readonly import("../../../../../
|
|
846
|
+
kinds: readonly import("../../../../../module-records").PhiRecordFieldKind[];
|
|
844
847
|
} | {
|
|
845
848
|
visibleWhen: {
|
|
846
849
|
field: string;
|
|
@@ -24,7 +24,7 @@ const PHI_TABLE_DISABLED_CONDITION_CONFIG_FIELDS = [
|
|
|
24
24
|
{ value: "contains", label: "Contains" },
|
|
25
25
|
] },
|
|
26
26
|
{ key: "value", type: "string", label: "String Value" },
|
|
27
|
-
{ key: "reason", type: "string", label: "Disabled Reason" },
|
|
27
|
+
{ key: "reason", type: "string", label: "Disabled Reason", text: "message" },
|
|
28
28
|
];
|
|
29
29
|
function buildPhiTableConditionExpressionConfigFields(key, label, match, emptyLabel) {
|
|
30
30
|
return [
|
|
@@ -123,6 +123,7 @@ const PHI_TABLE_ACTION_CONFIG_FIELDS = [
|
|
|
123
123
|
];
|
|
124
124
|
const PHI_TABLE_COLUMN_RENDERERS = [
|
|
125
125
|
"text", "email", "date", "datetime", "badge", "tags", "link", "code", "json", "switch", "checkbox", "icon",
|
|
126
|
+
"money", "interval",
|
|
126
127
|
];
|
|
127
128
|
const PHI_TABLE_COLUMN_EDITOR_CONTROLS = [
|
|
128
129
|
"switch", "checkbox", "select", "radio", "segmented", "multi-select", "checkbox-group", "icon-picker", "textarea",
|
|
@@ -633,6 +634,8 @@ export const PHI_TABLE_WIDGET_DEFINITION = {
|
|
|
633
634
|
{ value: "switch", label: "Switch" },
|
|
634
635
|
{ value: "checkbox", label: "Checkbox" },
|
|
635
636
|
{ value: "icon", label: "Icon" },
|
|
637
|
+
{ value: "money", label: "Money" },
|
|
638
|
+
{ value: "interval", label: "Interval" },
|
|
636
639
|
],
|
|
637
640
|
},
|
|
638
641
|
{
|
|
@@ -17,7 +17,6 @@ export declare const PHI_TIMELINE_WIDGET_DEFINITION: {
|
|
|
17
17
|
kind: "widget";
|
|
18
18
|
pluginKey: string;
|
|
19
19
|
typeKey: string;
|
|
20
|
-
translatesOwnText: true;
|
|
21
20
|
title: string;
|
|
22
21
|
description: string;
|
|
23
22
|
category: "content";
|
|
@@ -52,11 +51,19 @@ export declare const PHI_TIMELINE_WIDGET_DEFINITION: {
|
|
|
52
51
|
type: "string";
|
|
53
52
|
label: string;
|
|
54
53
|
required: true;
|
|
54
|
+
text?: undefined;
|
|
55
55
|
} | {
|
|
56
56
|
key: string;
|
|
57
57
|
type: "string";
|
|
58
58
|
label: string;
|
|
59
59
|
required?: undefined;
|
|
60
|
+
text?: undefined;
|
|
61
|
+
} | {
|
|
62
|
+
key: string;
|
|
63
|
+
type: "string";
|
|
64
|
+
label: string;
|
|
65
|
+
text: "message";
|
|
66
|
+
required?: undefined;
|
|
60
67
|
})[];
|
|
61
68
|
providerKind?: undefined;
|
|
62
69
|
heading?: undefined;
|
|
@@ -26,7 +26,6 @@ export const PHI_TIMELINE_WIDGET_DEFINITION = {
|
|
|
26
26
|
kind: "widget",
|
|
27
27
|
pluginKey: resolvePhiCmsWidgetPluginKey("timeline"),
|
|
28
28
|
typeKey: "timeline",
|
|
29
|
-
translatesOwnText: true,
|
|
30
29
|
title: "Timeline",
|
|
31
30
|
description: "What happened, in order: entries with a time, a title and a line of text.",
|
|
32
31
|
category: "content",
|
|
@@ -63,7 +62,7 @@ export const PHI_TIMELINE_WIDGET_DEFINITION = {
|
|
|
63
62
|
itemFields: [
|
|
64
63
|
{ key: "key", type: "string", label: "Key", required: true },
|
|
65
64
|
{ key: "title", type: "string", label: "Title" },
|
|
66
|
-
{ key: "content", type: "string", label: "Text" },
|
|
65
|
+
{ key: "content", type: "string", label: "Text", text: "message" },
|
|
67
66
|
],
|
|
68
67
|
},
|
|
69
68
|
{ key: "entriesProvider", type: "data-provider", providerKind: "timeline", label: "Entries Source" },
|
|
@@ -1,45 +1,14 @@
|
|
|
1
1
|
import { jsx as _jsx } from "react/jsx-runtime";
|
|
2
|
-
import { PhiCmsFlags } from "../../../../../constants/phi-cms";
|
|
3
|
-
import { hasPhiFlag } from "../../../../../helpers/flags";
|
|
4
2
|
import { PhiCmsWidgetType } from "../../../../../constants/cms-widget-types";
|
|
5
3
|
import { PhiRuntimeModuleRenderClientHost } from "../../../../../components/runtime/runtime-module-render-client-manifest";
|
|
6
|
-
import { trBulkForLocale } from "../../../../../server-helpers/translate";
|
|
7
4
|
import { PHI_TIMELINE_WIDGET_DEFINITION } from "./config";
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
*
|
|
11
|
-
*
|
|
5
|
+
/*
|
|
6
|
+
* The entries' own words arrive translated (server-helpers/cms-widget-texts.ts), the time among them: an
|
|
7
|
+
* author writes "Yesterday" or "Spring 2026" as often as a date. A Provider's entries are its own to
|
|
8
|
+
* translate, as an options Provider's are.
|
|
12
9
|
*/
|
|
13
|
-
async function translatePhiTimelineConfig(config, runtime, translate) {
|
|
14
|
-
/* A Provider's entries are its own to translate, as an options Provider's are. */
|
|
15
|
-
if (!translate || config.entriesProvider || config.entries.length === 0)
|
|
16
|
-
return config;
|
|
17
|
-
const texts = config.entries.flatMap((entry) => PHI_TIMELINE_TRANSLATED_FIELDS.map((field) => entry[field] ?? ""));
|
|
18
|
-
const translated = await trBulkForLocale(runtime.locale.current, texts);
|
|
19
|
-
const width = PHI_TIMELINE_TRANSLATED_FIELDS.length;
|
|
20
|
-
return {
|
|
21
|
-
...config,
|
|
22
|
-
entries: config.entries.map((entry, index) => {
|
|
23
|
-
const next = { ...entry };
|
|
24
|
-
PHI_TIMELINE_TRANSLATED_FIELDS.forEach((field, offset) => {
|
|
25
|
-
const source = entry[field];
|
|
26
|
-
if (source)
|
|
27
|
-
next[field] = translated[index * width + offset]?.trim() || source;
|
|
28
|
-
});
|
|
29
|
-
return next;
|
|
30
|
-
}),
|
|
31
|
-
};
|
|
32
|
-
}
|
|
33
10
|
export const PHI_TIMELINE_WIDGET_PLUGIN = {
|
|
34
11
|
...PHI_TIMELINE_WIDGET_DEFINITION,
|
|
35
|
-
render:
|
|
36
|
-
|
|
37
|
-
config: await translatePhiTimelineConfig(config, runtime, !hasPhiFlag(widget.flags, PhiCmsFlags.NoTranslate)),
|
|
38
|
-
locale: runtime.locale.current,
|
|
39
|
-
} })),
|
|
40
|
-
renderPreview: async ({ widget, config, runtime }) => (_jsx(PhiRuntimeModuleRenderClientHost, { type: PhiCmsWidgetType.Timeline, componentProps: {
|
|
41
|
-
blockId: widget.id,
|
|
42
|
-
config: await translatePhiTimelineConfig(config, runtime, !hasPhiFlag(widget.flags, PhiCmsFlags.NoTranslate)),
|
|
43
|
-
locale: runtime.locale.current,
|
|
44
|
-
} })),
|
|
12
|
+
render: ({ widget, config, runtime }) => (_jsx(PhiRuntimeModuleRenderClientHost, { type: PhiCmsWidgetType.Timeline, componentProps: { blockId: widget.id, config, locale: runtime.locale.current } })),
|
|
13
|
+
renderPreview: ({ widget, config, runtime }) => (_jsx(PhiRuntimeModuleRenderClientHost, { type: PhiCmsWidgetType.Timeline, componentProps: { blockId: widget.id, config, locale: runtime.locale.current } })),
|
|
45
14
|
};
|