@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
|
@@ -325,6 +325,49 @@ export declare const PHI_CORE_FORM_PROVIDER_DESCRIPTORS: {
|
|
|
325
325
|
readonly label: "Area";
|
|
326
326
|
readonly description: "Whose Pages are offered; Public when empty.";
|
|
327
327
|
}];
|
|
328
|
+
} | {
|
|
329
|
+
ownerModuleId: "@phis/ui/modules/core";
|
|
330
|
+
key: `${string}/${string}`;
|
|
331
|
+
title: "Money";
|
|
332
|
+
valueType: "json";
|
|
333
|
+
presentation: "control";
|
|
334
|
+
settingsFields: readonly [{
|
|
335
|
+
readonly key: "currency";
|
|
336
|
+
readonly type: "choice";
|
|
337
|
+
readonly mode: "single";
|
|
338
|
+
readonly valueType: "string";
|
|
339
|
+
readonly label: "Currency";
|
|
340
|
+
readonly description: "The currency of one amount.";
|
|
341
|
+
readonly options: {
|
|
342
|
+
value: string;
|
|
343
|
+
label: string;
|
|
344
|
+
}[];
|
|
345
|
+
}, {
|
|
346
|
+
readonly key: "currencies";
|
|
347
|
+
readonly type: "choice";
|
|
348
|
+
readonly mode: "multiple";
|
|
349
|
+
readonly valueType: "string[]";
|
|
350
|
+
readonly label: "Currencies";
|
|
351
|
+
readonly description: "One amount per currency, instead of a single currency.";
|
|
352
|
+
readonly options: {
|
|
353
|
+
value: string;
|
|
354
|
+
label: string;
|
|
355
|
+
}[];
|
|
356
|
+
}, {
|
|
357
|
+
readonly key: "min";
|
|
358
|
+
readonly type: "number";
|
|
359
|
+
readonly label: "Minimum";
|
|
360
|
+
readonly description: "In minor units: 100 is 1.00 CHF.";
|
|
361
|
+
readonly min: 0;
|
|
362
|
+
readonly precision: 0;
|
|
363
|
+
}, {
|
|
364
|
+
readonly key: "max";
|
|
365
|
+
readonly type: "number";
|
|
366
|
+
readonly label: "Maximum";
|
|
367
|
+
readonly description: "In minor units.";
|
|
368
|
+
readonly min: 0;
|
|
369
|
+
readonly precision: 0;
|
|
370
|
+
}];
|
|
328
371
|
})[];
|
|
329
372
|
readonly validationRules: ({
|
|
330
373
|
ownerModuleId: "@phis/ui/modules/core";
|
|
@@ -8,11 +8,14 @@ export type PhiBreadcrumbWidgetProps = PhiClientBlockBaseProps<PhiBreadcrumbWidg
|
|
|
8
8
|
pagePath?: string | null;
|
|
9
9
|
/** The folders of `pagePath` whose address leads to a Page, as the server found them. */
|
|
10
10
|
linkedFolderPaths?: readonly string[];
|
|
11
|
+
/** The title of the record the Page is about, finished text, where the server found one: the trail's last item. */
|
|
12
|
+
pageTitle?: string | null;
|
|
11
13
|
};
|
|
12
|
-
export declare function PhiBreadcrumbWidget({ config, runtime, pagePath, linkedFolderPaths }: PhiBreadcrumbWidgetProps): import("react").JSX.Element;
|
|
14
|
+
export declare function PhiBreadcrumbWidget({ config, runtime, pagePath, linkedFolderPaths, pageTitle }: PhiBreadcrumbWidgetProps): import("react").JSX.Element;
|
|
13
15
|
/**
|
|
14
16
|
* One item per segment of the Page's path. A folder segment links to the visitor's own address up to that
|
|
15
17
|
* folder -- the locale and Area prefix kept as the visitor has them -- when the server found that its
|
|
16
|
-
* folder address leads to a Page; every other segment, and the Page itself, is text.
|
|
18
|
+
* folder address leads to a Page; every other segment, and the Page itself, is text. The last item, the
|
|
19
|
+
* Page itself, carries `pageTitle` where there is one -- the record's title -- and its segment otherwise.
|
|
17
20
|
*/
|
|
18
|
-
export declare function buildPhiBreadcrumbPathItems(visitorPathname: string, pagePath: string, linkedFolderPaths: readonly string[]): PhiBreadcrumbControlItem[];
|
|
21
|
+
export declare function buildPhiBreadcrumbPathItems(visitorPathname: string, pagePath: string, linkedFolderPaths: readonly string[], pageTitle?: string | null): PhiBreadcrumbControlItem[];
|
|
@@ -3,7 +3,7 @@ import { jsx as _jsx } from "react/jsx-runtime";
|
|
|
3
3
|
import { PhiBreadcrumbControl } from "../../../../../components/controls/phi-breadcrumb-control";
|
|
4
4
|
import { PhiFlexControl } from "../../../../../components/controls/phi-flex-control";
|
|
5
5
|
import { usePhiPathname } from "../../../../../components/runtime/use-phi-pathname";
|
|
6
|
-
export function PhiBreadcrumbWidget({ config, runtime, pagePath, linkedFolderPaths }) {
|
|
6
|
+
export function PhiBreadcrumbWidget({ config, runtime, pagePath, linkedFolderPaths, pageTitle }) {
|
|
7
7
|
const pathname = usePhiPathname();
|
|
8
8
|
const head = [
|
|
9
9
|
{ title: config?.rootLabel?.trim() || runtime?.site.name?.trim() || runtime?.site.key || "Site" },
|
|
@@ -13,23 +13,24 @@ export function PhiBreadcrumbWidget({ config, runtime, pagePath, linkedFolderPat
|
|
|
13
13
|
if (config?.showPath !== false) {
|
|
14
14
|
tail = config?.pathLabel?.trim() || !pagePath || pagePath === "/"
|
|
15
15
|
? [{ title: config?.pathLabel?.trim() || pathname || "/" }]
|
|
16
|
-
: buildPhiBreadcrumbPathItems(pathname, pagePath, linkedFolderPaths ?? []);
|
|
16
|
+
: buildPhiBreadcrumbPathItems(pathname, pagePath, linkedFolderPaths ?? [], pageTitle);
|
|
17
17
|
}
|
|
18
18
|
return (_jsx(PhiFlexControl, { align: config?.align ?? "center", justify: config?.justify ?? "flex-start", gap: 12, wrap: "wrap", children: _jsx(PhiBreadcrumbControl, { items: [...head, ...tail], separator: config?.separator }) }));
|
|
19
19
|
}
|
|
20
20
|
/**
|
|
21
21
|
* One item per segment of the Page's path. A folder segment links to the visitor's own address up to that
|
|
22
22
|
* folder -- the locale and Area prefix kept as the visitor has them -- when the server found that its
|
|
23
|
-
* folder address leads to a Page; every other segment, and the Page itself, is text.
|
|
23
|
+
* folder address leads to a Page; every other segment, and the Page itself, is text. The last item, the
|
|
24
|
+
* Page itself, carries `pageTitle` where there is one -- the record's title -- and its segment otherwise.
|
|
24
25
|
*/
|
|
25
|
-
export function buildPhiBreadcrumbPathItems(visitorPathname, pagePath, linkedFolderPaths) {
|
|
26
|
+
export function buildPhiBreadcrumbPathItems(visitorPathname, pagePath, linkedFolderPaths, pageTitle) {
|
|
26
27
|
const segments = pagePath.split("/").filter(Boolean);
|
|
27
28
|
const base = visitorPathname.endsWith(pagePath) ? visitorPathname.slice(0, -pagePath.length) : null;
|
|
28
29
|
const linked = new Set(linkedFolderPaths);
|
|
29
30
|
return segments.map((segment, index) => {
|
|
30
31
|
const folder = `/${segments.slice(0, index + 1).join("/")}`;
|
|
31
32
|
const isFolder = index < segments.length - 1;
|
|
32
|
-
const title = decodeSegment(segment);
|
|
33
|
+
const title = !isFolder && pageTitle?.trim() ? pageTitle.trim() : decodeSegment(segment);
|
|
33
34
|
return isFolder && base !== null && linked.has(folder)
|
|
34
35
|
? { key: folder, title, href: `${base}${folder}` }
|
|
35
36
|
: { key: folder, title };
|
|
@@ -4,6 +4,6 @@ import { PhiBreadcrumbWidget } from "./server";
|
|
|
4
4
|
import { PHI_BREADCRUMB_WIDGET_DEFINITION, PHI_BREADCRUMB_WIDGET_PLUGIN_TYPE, } from "./config";
|
|
5
5
|
export const PHI_BREADCRUMB_WIDGET_PLUGIN = {
|
|
6
6
|
...PHI_BREADCRUMB_WIDGET_DEFINITION,
|
|
7
|
-
...definePhiPassiveWidgetRenderers(({ widget, runtime, config }) => (_jsx(PhiBreadcrumbWidget, { runtime: runtime, config: config }, `widget-${widget.id}`))),
|
|
7
|
+
...definePhiPassiveWidgetRenderers(({ widget, runtime, config, registry }) => (_jsx(PhiBreadcrumbWidget, { runtime: runtime, registry: registry, config: config }, `widget-${widget.id}`))),
|
|
8
8
|
};
|
|
9
9
|
export { PHI_BREADCRUMB_WIDGET_PLUGIN_TYPE };
|
|
@@ -1,5 +1,13 @@
|
|
|
1
|
+
import { resolvePhiWidgetRecordField } from "../../../../../server-helpers/record-fields";
|
|
2
|
+
import type { PhiBlockRuntime } from "../../../../../types";
|
|
1
3
|
import type { PhiBreadcrumbWidgetProps } from "./client";
|
|
4
|
+
export type PhiBreadcrumbWidgetServerProps = Omit<PhiBreadcrumbWidgetProps, "runtime"> & {
|
|
5
|
+
/** The whole runtime of the render: the record read needs more of it than the client does. */
|
|
6
|
+
runtime: PhiBlockRuntime;
|
|
7
|
+
/** Where the page record is answered; absent outside a page render, where nothing is bound. */
|
|
8
|
+
registry?: Parameters<typeof resolvePhiWidgetRecordField>[0]["registry"];
|
|
9
|
+
};
|
|
2
10
|
export type { PhiBreadcrumbWidgetConfig, PhiBreadcrumbWidgetLabels, PhiBreadcrumbWidgetProps, } from "./client";
|
|
3
11
|
/** The folders a Page path lies in, outermost first: `/docs/guides/a` gives `/docs` and `/docs/guides`. */
|
|
4
12
|
export declare function listPhiBreadcrumbFolderPaths(pagePath: string): string[];
|
|
5
|
-
export declare function PhiBreadcrumbWidget(props:
|
|
13
|
+
export declare function PhiBreadcrumbWidget({ registry, ...props }: PhiBreadcrumbWidgetServerProps): Promise<import("react").JSX.Element>;
|
|
@@ -3,6 +3,7 @@ import { PhiCmsWidgetType } from "../../../../../constants/cms-widget-types";
|
|
|
3
3
|
import { PhiRuntimeModuleRenderClientHost } from "../../../../../components/runtime/runtime-module-render-client-manifest";
|
|
4
4
|
import { fetchSiteNavigationFolderTarget } from "../../../../../gateway/site-nav";
|
|
5
5
|
import { readPhiServerApiCredentials } from "../../../../../helpers/phis-server-credentials";
|
|
6
|
+
import { resolvePhiWidgetRecordField } from "../../../../../server-helpers/record-fields";
|
|
6
7
|
/** The folders a Page path lies in, outermost first: `/docs/guides/a` gives `/docs` and `/docs/guides`. */
|
|
7
8
|
export function listPhiBreadcrumbFolderPaths(pagePath) {
|
|
8
9
|
const segments = pagePath.split("/").filter(Boolean);
|
|
@@ -35,7 +36,32 @@ async function resolveLinkedFolderPaths(props) {
|
|
|
35
36
|
}).catch(() => null)));
|
|
36
37
|
return folders.filter((_path, index) => answers[index] != null);
|
|
37
38
|
}
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
39
|
+
/**
|
|
40
|
+
* The title of the record the Page is about, for the trail's last item; `null` leaves the path segment.
|
|
41
|
+
*
|
|
42
|
+
* The field is the one the route's `pageRecord` made the Page's title (`runtime.page.record.titleField`),
|
|
43
|
+
* read like any Widget bound to a field of the page record: the memoised read Core made for the title, so
|
|
44
|
+
* this costs the Provider no second one. No `titleField`, no record, a record that is missing or
|
|
45
|
+
* unavailable, no registry, a field that is empty and a failure of any kind all give `null`: the trail
|
|
46
|
+
* never fails for it.
|
|
47
|
+
*/
|
|
48
|
+
async function resolvePageTitle({ config, runtime, registry }) {
|
|
49
|
+
const titleField = runtime?.page?.record?.titleField;
|
|
50
|
+
if (!titleField || !registry || config?.showPath === false || config?.pathLabel?.trim()) {
|
|
51
|
+
return null;
|
|
52
|
+
}
|
|
53
|
+
try {
|
|
54
|
+
const answer = await resolvePhiWidgetRecordField({ registry, runtime, key: titleField, kinds: ["text"] });
|
|
55
|
+
return (answer.bound && answer.field?.value.trim()) || null;
|
|
56
|
+
}
|
|
57
|
+
catch {
|
|
58
|
+
return null;
|
|
59
|
+
}
|
|
60
|
+
}
|
|
61
|
+
export async function PhiBreadcrumbWidget({ registry, ...props }) {
|
|
62
|
+
const [linkedFolderPaths, pageTitle] = await Promise.all([
|
|
63
|
+
resolveLinkedFolderPaths({ registry, ...props }),
|
|
64
|
+
resolvePageTitle({ registry, ...props }),
|
|
65
|
+
]);
|
|
66
|
+
return (_jsx(PhiRuntimeModuleRenderClientHost, { type: PhiCmsWidgetType.Breadcrumb, componentProps: { ...props, pagePath: props.runtime?.page?.path ?? null, linkedFolderPaths, pageTitle } }));
|
|
41
67
|
}
|
|
@@ -1,33 +1,11 @@
|
|
|
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
4
|
import { PHI_BUTTON_WIDGET_DEFINITION } from "./config";
|
|
7
5
|
import { getPhiCommonControlLabelsForRuntime } from "../../../../../components/widgets/label-sets/common-controls";
|
|
8
6
|
import { isPhiExternalHref } from "../../../../../helpers/external-href";
|
|
9
7
|
import { resolvePhiLinkHref } from "../../../../../helpers/link-target";
|
|
10
|
-
import { trBulkForLocale } from "../../../../../server-helpers/translate";
|
|
11
8
|
import { resolvePhiWidgetRecordField } from "../../../../../server-helpers/record-fields";
|
|
12
|
-
/**
|
|
13
|
-
* The Button's own words in the reader's language.
|
|
14
|
-
*
|
|
15
|
-
* Every Widget translates the text written into it itself; nothing does it for them on the way in. The
|
|
16
|
-
* common control labels beside it are a global label set and arrive translated already.
|
|
17
|
-
*/
|
|
18
|
-
async function translatePhiButtonConfig(config, runtime, translate) {
|
|
19
|
-
if (!translate)
|
|
20
|
-
return config;
|
|
21
|
-
const entries = [["label", config.label], ["tooltip", config.tooltip]]
|
|
22
|
-
.filter((entry) => Boolean(entry[1]?.trim()));
|
|
23
|
-
if (entries.length === 0)
|
|
24
|
-
return config;
|
|
25
|
-
const translated = await trBulkForLocale(runtime.locale.current, entries.map(([, text]) => text));
|
|
26
|
-
return {
|
|
27
|
-
...config,
|
|
28
|
-
...Object.fromEntries(entries.map(([key, text], index) => [key, translated[index]?.trim() || text])),
|
|
29
|
-
};
|
|
30
|
-
}
|
|
31
9
|
/**
|
|
32
10
|
* What the page record says of the Button, where it names a field for its value or its link: a Button on
|
|
33
11
|
* a template sends what the record it stands beside is called and leads where that record leads, not a
|
|
@@ -58,8 +36,11 @@ export const PHI_BUTTON_WIDGET_PLUGIN = {
|
|
|
58
36
|
if (!bound)
|
|
59
37
|
return null;
|
|
60
38
|
const { link: recordLink } = bound;
|
|
61
|
-
|
|
62
|
-
|
|
39
|
+
/*
|
|
40
|
+
* The Button's own words arrive translated (server-helpers/cms-widget-texts.ts). The record's stand
|
|
41
|
+
* in for an empty label only, and are the record's own: not translated.
|
|
42
|
+
*/
|
|
43
|
+
const translated = bound.config;
|
|
63
44
|
const config = recordLink?.label && !translated.label?.trim() ? { ...translated, label: recordLink.label } : translated;
|
|
64
45
|
return (_jsx(PhiRuntimeModuleRenderClientHost, { type: PhiCmsWidgetType.Button, componentProps: {
|
|
65
46
|
blockId: widget.id,
|
|
@@ -72,7 +53,7 @@ export const PHI_BUTTON_WIDGET_PLUGIN = {
|
|
|
72
53
|
},
|
|
73
54
|
renderPreview: async ({ widget, config, runtime, links }) => (_jsx(PhiRuntimeModuleRenderClientHost, { type: PhiCmsWidgetType.Button, componentProps: {
|
|
74
55
|
blockId: widget.id,
|
|
75
|
-
config
|
|
56
|
+
config,
|
|
76
57
|
labels: await getPhiCommonControlLabelsForRuntime(runtime),
|
|
77
58
|
link: resolvePhiLinkHref(config.linkTarget, links),
|
|
78
59
|
disabled: true,
|
|
@@ -102,7 +102,22 @@ export declare const PHI_CARD_WIDGET_DEFINITION: {
|
|
|
102
102
|
description: string;
|
|
103
103
|
icon: string;
|
|
104
104
|
iconFamily: string;
|
|
105
|
-
|
|
105
|
+
configTexts: ({
|
|
106
|
+
key: string;
|
|
107
|
+
register: "label";
|
|
108
|
+
item?: undefined;
|
|
109
|
+
values?: undefined;
|
|
110
|
+
} | {
|
|
111
|
+
key: string;
|
|
112
|
+
register: "message";
|
|
113
|
+
item?: undefined;
|
|
114
|
+
values?: undefined;
|
|
115
|
+
} | {
|
|
116
|
+
key: string;
|
|
117
|
+
item: string;
|
|
118
|
+
values: string;
|
|
119
|
+
register: "message";
|
|
120
|
+
})[];
|
|
106
121
|
slotSizePolicy: "fill";
|
|
107
122
|
surface: "own";
|
|
108
123
|
runtimeSignals: {
|
|
@@ -169,6 +184,7 @@ export declare const PHI_CARD_WIDGET_DEFINITION: {
|
|
|
169
184
|
type: "string" | "url" | "icon";
|
|
170
185
|
emptyValue?: "";
|
|
171
186
|
placeholder?: string;
|
|
187
|
+
text?: false | "label" | "message";
|
|
172
188
|
}) | ({
|
|
173
189
|
key: string;
|
|
174
190
|
label: string;
|
|
@@ -232,7 +248,7 @@ export declare const PHI_CARD_WIDGET_DEFINITION: {
|
|
|
232
248
|
heading?: string;
|
|
233
249
|
} & {
|
|
234
250
|
type: "record-field";
|
|
235
|
-
kinds: readonly import("../../../../../
|
|
251
|
+
kinds: readonly import("../../../../../module-records").PhiRecordFieldKind[];
|
|
236
252
|
}) | ({
|
|
237
253
|
key: string;
|
|
238
254
|
label: string;
|
|
@@ -94,7 +94,22 @@ export const PHI_CARD_WIDGET_DEFINITION = {
|
|
|
94
94
|
description: "Content card with a picture or an icon, a heading or a figure, and a link.",
|
|
95
95
|
icon: "antd:idcard-outlined",
|
|
96
96
|
iconFamily: "basic",
|
|
97
|
-
|
|
97
|
+
/*
|
|
98
|
+
* The card's words are written on the canvas, not in Inspector fields, so the card names them for the
|
|
99
|
+
* renderer's translation (TRANSLATIONS.md, "Widget config text"); a plan line's values stay out of it.
|
|
100
|
+
*/
|
|
101
|
+
configTexts: [
|
|
102
|
+
{ key: "eyebrow", register: "label" },
|
|
103
|
+
{ key: "title", register: "label" },
|
|
104
|
+
{ key: "description", register: "message" },
|
|
105
|
+
{ key: "meta", register: "label" },
|
|
106
|
+
{ key: "actionLabel", register: "label" },
|
|
107
|
+
{ key: "badge", register: "label" },
|
|
108
|
+
{ key: "pricePeriod", register: "label" },
|
|
109
|
+
{ key: "pricePeriodYearly", register: "label" },
|
|
110
|
+
{ key: "alt", register: "label" },
|
|
111
|
+
{ key: "features", item: "text", values: "values", register: "message" },
|
|
112
|
+
],
|
|
98
113
|
/*
|
|
99
114
|
* A card fills its slot both ways, as a Layout does.
|
|
100
115
|
*
|
|
@@ -1,7 +1,4 @@
|
|
|
1
1
|
import { jsx as _jsx } from "react/jsx-runtime";
|
|
2
|
-
import { PhiCmsFlags } from "../../../../../constants/phi-cms";
|
|
3
|
-
import { hasPhiFlag } from "../../../../../helpers/flags";
|
|
4
|
-
import { translatePhiSearchWidgetTexts } from "../../../../../server-helpers/search-text";
|
|
5
2
|
import { PhiCardWidget } from "./server";
|
|
6
3
|
import { PHI_CARD_WIDGET_DEFINITION, PHI_CARD_WIDGET_PLUGIN_TYPE } from "./config";
|
|
7
4
|
function renderPhiCard({ widget, config, runtime, links }, preview) {
|
|
@@ -11,17 +8,17 @@ function renderPhiCard({ widget, config, runtime, links }, preview) {
|
|
|
11
8
|
description: config.description,
|
|
12
9
|
meta: config.meta,
|
|
13
10
|
actionLabel: config.actionLabel,
|
|
14
|
-
}, config: config, runtime: runtime, links: links,
|
|
11
|
+
}, config: config, runtime: runtime, links: links, preview: preview }, `widget-${widget.id}`));
|
|
15
12
|
}
|
|
16
13
|
export const PHI_CARD_WIDGET_PLUGIN = {
|
|
17
14
|
...PHI_CARD_WIDGET_DEFINITION,
|
|
18
15
|
/*
|
|
19
|
-
* The card's words as the render draws them (SEARCH.md):
|
|
20
|
-
*
|
|
16
|
+
* The card's words as the render draws them (SEARCH.md): they arrive translated by the same pass the
|
|
17
|
+
* render's do; the figure and the prices as written, which the render never translates either.
|
|
21
18
|
*/
|
|
22
|
-
searchText:
|
|
19
|
+
searchText: ({ config }) => {
|
|
23
20
|
const plan = config.body === "plan";
|
|
24
|
-
|
|
21
|
+
return [
|
|
25
22
|
config.eyebrow,
|
|
26
23
|
config.title,
|
|
27
24
|
config.description,
|
|
@@ -29,8 +26,9 @@ export const PHI_CARD_WIDGET_PLUGIN = {
|
|
|
29
26
|
config.badge,
|
|
30
27
|
config.actionEnabled ? config.actionLabel : undefined,
|
|
31
28
|
...(plan ? (config.features ?? []).map((entry) => entry.text) : []),
|
|
32
|
-
|
|
33
|
-
|
|
29
|
+
config.value,
|
|
30
|
+
...(plan ? [config.price, config.priceYearly] : []),
|
|
31
|
+
].filter((text) => typeof text === "string" && text.trim().length > 0);
|
|
34
32
|
},
|
|
35
33
|
/*
|
|
36
34
|
* Not the passive renderers' preview: that one is inert, and an inert card answers no pointer, so its
|
|
@@ -14,8 +14,7 @@ export type PhiCardWidgetLabels = {
|
|
|
14
14
|
export type PhiCardWidgetProps = PhiServerBlockBaseProps<PhiCardWidgetLabels, PhiCmsCardWidgetConfig> & {
|
|
15
15
|
links?: PhiResolvedLinkTargets | null;
|
|
16
16
|
};
|
|
17
|
-
export declare function PhiCardWidget({ labels, config, runtime, links,
|
|
18
|
-
translate: boolean;
|
|
17
|
+
export declare function PhiCardWidget({ labels, config, runtime, links, preview, }: PhiCardWidgetProps & {
|
|
19
18
|
/**
|
|
20
19
|
* The Builder's preview: the card answers the pointer as it will live -- its hover effect is what the
|
|
21
20
|
* author is looking at -- but leads nowhere and says nothing, so a click cannot leave the Builder.
|
|
@@ -10,8 +10,7 @@ import { PhiRuntimeModuleRenderClientHost } from "../../../../../components/runt
|
|
|
10
10
|
import { getPhiCardWidgetLabelsForRuntime } from "../../../../../components/widgets/label-sets/card";
|
|
11
11
|
import { PhiBulletListControl } from "../../../../../components/controls/phi-bullet-list-control";
|
|
12
12
|
import { buildPhiBulletListTree, resolvePhiBulletListStyle, } from "../../../../../components/widgets/shared/bullet-list-vocabulary";
|
|
13
|
-
|
|
14
|
-
export async function PhiCardWidget({ labels, config, runtime, links, translate, preview = false, }) {
|
|
13
|
+
export async function PhiCardWidget({ labels, config, runtime, links, preview = false, }) {
|
|
15
14
|
/*
|
|
16
15
|
* The button's words: the author's, or none where they emptied them for an icon-only button, or the
|
|
17
16
|
* label set's when they never wrote any -- which is translated there, not here.
|
|
@@ -24,7 +23,17 @@ export async function PhiCardWidget({ labels, config, runtime, links, translate,
|
|
|
24
23
|
const resolvedAsset = config?.sourceKind === "asset" && typeof config.assetId === "number"
|
|
25
24
|
? await resolvePhiPublicAssetReference({ runtime, assetId: config.assetId }).catch(() => null)
|
|
26
25
|
: null;
|
|
27
|
-
|
|
26
|
+
/*
|
|
27
|
+
* The card's own words arrive translated, `{site.name}` and a plan line's values filled in
|
|
28
|
+
* (server-helpers/cms-widget-texts.ts, the Card's `configTexts`). Only the Media library's
|
|
29
|
+
* description of an Asset is read here, and translated in the Site's store like every Asset's.
|
|
30
|
+
*/
|
|
31
|
+
const ownAlt = config?.alt?.trim();
|
|
32
|
+
const assetAlt = !ownAlt ? resolvedAsset?.altText?.trim() : undefined;
|
|
33
|
+
const alt = ownAlt || (assetAlt
|
|
34
|
+
? (await (runtime?.locale.current ? trBulkForLocale(runtime.locale.current, [assetAlt]) : trBulk([assetAlt])))[0]?.trim() || assetAlt
|
|
35
|
+
: undefined);
|
|
36
|
+
const translatedByKey = new Map([
|
|
28
37
|
["eyebrow", labels.eyebrow ?? config?.eyebrow],
|
|
29
38
|
["title", labels.title ?? config?.title],
|
|
30
39
|
["description", labels.description ?? config?.description],
|
|
@@ -33,33 +42,12 @@ export async function PhiCardWidget({ labels, config, runtime, links, translate,
|
|
|
33
42
|
["badge", labels.badge ?? config?.badge],
|
|
34
43
|
["pricePeriod", plan ? labels.pricePeriod ?? config?.pricePeriod : undefined],
|
|
35
44
|
["pricePeriodYearly", plan ? labels.pricePeriodYearly ?? config?.pricePeriodYearly : undefined],
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
];
|
|
39
|
-
/*
|
|
40
|
-
* A plan's features, masked as every list entry is: their values stand as `%1` onwards and never reach
|
|
41
|
-
* a translator, and `{site.name}` is filled after (`helpers/text-placeholders.ts`).
|
|
42
|
-
*/
|
|
43
|
-
const features = plan ? (config?.features ?? []).filter((entry) => Boolean(entry.text)) : [];
|
|
44
|
-
const maskedFeatures = features.map((entry) => maskPhiTextPlaceholders(entry.text, entry.values?.length ?? 0));
|
|
45
|
-
const sourceTexts = [...textEntries.map(([, value]) => value ?? ""), ...maskedFeatures.map((masked) => masked.text)];
|
|
46
|
-
const translatedTexts = translate
|
|
47
|
-
? await (runtime?.locale.current
|
|
48
|
-
? trBulkForLocale(runtime.locale.current, sourceTexts)
|
|
49
|
-
: trBulk(sourceTexts))
|
|
50
|
-
: sourceTexts;
|
|
51
|
-
const translatedByKey = new Map(textEntries.map(([key], index) => [key, translatedTexts[index] || undefined]));
|
|
52
|
-
const translatedFeatures = features.map((entry, index) => ({
|
|
53
|
-
...entry,
|
|
54
|
-
text: resolvePhiTextPlaceholders(translatedTexts[textEntries.length + index] ?? entry.text, maskedFeatures[index].names, runtime, entry.values),
|
|
55
|
-
}));
|
|
45
|
+
["alt", alt],
|
|
46
|
+
]);
|
|
47
|
+
const translatedFeatures = plan ? (config?.features ?? []).filter((entry) => Boolean(entry.text)) : [];
|
|
56
48
|
/* Drawn here, so the list Control never reaches the browser with the Card (`listContent`). */
|
|
57
49
|
const featureList = translatedFeatures.length > 0 ? (_jsx(PhiBulletListControl, { listStyle: resolvePhiBulletListStyle(config?.featureList), items: buildPhiBulletListTree(translatedFeatures, (entry) => entry.text) })) : null;
|
|
58
|
-
|
|
59
|
-
* The figure is left out of the translation on purpose: a Site's own number is not a word, and
|
|
60
|
-
* `translate` is a per-Widget switch, so a stat card that turned it off to protect the figure would
|
|
61
|
-
* lose its title's translation with it.
|
|
62
|
-
*/
|
|
50
|
+
// The figure is not translated: a Site's own number is not a word (`value` is no text field).
|
|
63
51
|
const value = config?.value;
|
|
64
52
|
const presentation = resolvePhiImagePresentation({
|
|
65
53
|
sourceKind: config?.sourceKind,
|
|
@@ -4,14 +4,14 @@ export declare const PHI_CASCADER_WIDGET_BUILDER_PLUGIN: {
|
|
|
4
4
|
surface?: import("../../../../../types/surface").PhiSurfacePolicy | undefined;
|
|
5
5
|
title: string;
|
|
6
6
|
kind: "widget";
|
|
7
|
-
icon?: string | undefined;
|
|
8
7
|
category: import("../../../../../cms").PhiCmsPluginCategory;
|
|
9
|
-
tags?: string[] | undefined;
|
|
10
8
|
description?: string | undefined;
|
|
9
|
+
tags?: string[] | undefined;
|
|
10
|
+
defaultConfig?: Partial<PhiCascaderWidgetConfig> | undefined;
|
|
11
|
+
icon?: string | undefined;
|
|
11
12
|
iconFamily?: string | undefined;
|
|
12
13
|
pluginKey: string;
|
|
13
14
|
runtimeSignals?: (import("../../../../../types").PhiSignalPluginMeta | null) | undefined;
|
|
14
|
-
defaultConfig?: Partial<PhiCascaderWidgetConfig> | undefined;
|
|
15
15
|
typeKey: string;
|
|
16
16
|
iconName?: string | undefined;
|
|
17
17
|
commercial?: import("../../../../../types").PhiCmsPluginCommercialMeta | undefined;
|
|
@@ -20,6 +20,7 @@ export declare const PHI_CASCADER_WIDGET_BUILDER_PLUGIN: {
|
|
|
20
20
|
requiredDataProviders?: readonly import("@phis/contracts/controls").PhiRuntimeDataProviderKey[] | undefined;
|
|
21
21
|
contentBinding?: (import("../../../../../types").PhiCmsWidgetContentBinding | null) | undefined;
|
|
22
22
|
translatesOwnText?: true | undefined;
|
|
23
|
+
configTexts?: readonly import("../../../../../types/cms-plugins").PhiCmsWidgetConfigText[] | undefined;
|
|
23
24
|
slotSizePolicy: import("../../../../../types").PhiSlotSizePolicy;
|
|
24
25
|
requiredRegionOwnership?: import("../../../../../helpers/cms-region-keys").PhiCmsRegionOwnership | undefined;
|
|
25
26
|
creationConfig?: Partial<PhiCascaderWidgetConfig> | undefined;
|
|
@@ -48,5 +48,5 @@ export function PhiCascaderWidget({ config, signalsEnabled = true, }) {
|
|
|
48
48
|
});
|
|
49
49
|
controlSignals.emitChange(normalizedNextValue);
|
|
50
50
|
}
|
|
51
|
-
return (_jsx("div", { style: { minWidth, width: "100%" }, children: _jsx(PhiCascaderControl, { label: config?.label, allowRoot: config?.allowRoot ?? true, separator: separator, rootValue: rootValue, normalize: normalize, disabled: controlSignals.disabled, readOnly: controlSignals.readOnly, size: config?.controlSize, options: resolvedOptions.options, placeholder: config?.placeholder, value: value, onChange: publish, onFocus: controlSignals.emitFocus, onBlur: controlSignals.emitBlur }) }));
|
|
51
|
+
return (_jsx("div", { style: { minWidth, width: "100%" }, children: _jsx(PhiCascaderControl, { label: config?.label, allowRoot: config?.allowRoot ?? true, separator: separator, rootValue: rootValue, normalize: normalize, expandTrigger: config?.expandTrigger ?? "click", select: config?.select ?? "any", disabled: controlSignals.disabled, readOnly: controlSignals.readOnly, size: config?.controlSize, options: resolvedOptions.options, placeholder: config?.placeholder, value: value, onChange: publish, onFocus: controlSignals.emitFocus, onBlur: controlSignals.emitBlur }) }));
|
|
52
52
|
}
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import type { PhiCascaderNormalizeMode, PhiCascaderOption } from "../../../../../components/controls/phi-cascader-control";
|
|
1
|
+
import type { PhiCascaderNormalizeMode, PhiCascaderOption, PhiCascaderSelect } from "../../../../../components/controls/phi-cascader-control";
|
|
2
2
|
import { type PhiControlConfig } from "../../../../../components/widgets/config/control-signal-config";
|
|
3
3
|
import { type PhiChoiceOptionsConfig } from "../../../../../components/widgets/config/choice-shared";
|
|
4
4
|
export type PhiCascaderWidgetConfig = PhiControlConfig & PhiChoiceOptionsConfig & {
|
|
@@ -9,6 +9,10 @@ export type PhiCascaderWidgetConfig = PhiControlConfig & PhiChoiceOptionsConfig
|
|
|
9
9
|
separator?: string;
|
|
10
10
|
rootValue?: string;
|
|
11
11
|
normalize?: PhiCascaderNormalizeMode;
|
|
12
|
+
/** How a level opens: on a click (the default) or under the pointer. */
|
|
13
|
+
expandTrigger: "click" | "hover";
|
|
14
|
+
/** What a click may choose: every level, or only a value the options name (`PhiCascaderControl`). */
|
|
15
|
+
select: PhiCascaderSelect;
|
|
12
16
|
options: PhiCascaderOption[];
|
|
13
17
|
};
|
|
14
18
|
declare function parsePhiCascaderWidgetConfig(config: Record<string, unknown>): PhiCascaderWidgetConfig;
|
|
@@ -59,7 +63,7 @@ export declare const PHI_CASCADER_WIDGET_DEFINITION: {
|
|
|
59
63
|
key: string;
|
|
60
64
|
type: "collection";
|
|
61
65
|
label: string;
|
|
62
|
-
editorPlacement: "
|
|
66
|
+
editorPlacement: "inspector" | "toolbar";
|
|
63
67
|
itemKeyField: string;
|
|
64
68
|
itemLabelField: string;
|
|
65
69
|
defaultItem: {
|
|
@@ -113,6 +117,8 @@ export declare const PHI_CASCADER_WIDGET_DEFINITION: {
|
|
|
113
117
|
separator: string;
|
|
114
118
|
rootValue: string;
|
|
115
119
|
normalize: "raw";
|
|
120
|
+
expandTrigger: "click";
|
|
121
|
+
select: "any";
|
|
116
122
|
optionsProvider: null;
|
|
117
123
|
options: never[];
|
|
118
124
|
};
|
|
@@ -19,6 +19,8 @@ function parsePhiCascaderWidgetConfig(config) {
|
|
|
19
19
|
separator: readString(config.separator) ?? "/",
|
|
20
20
|
rootValue: readString(config.rootValue) ?? "/",
|
|
21
21
|
normalize: readNormalizeMode(config.normalize),
|
|
22
|
+
expandTrigger: readString(config.expandTrigger) === "hover" ? "hover" : "click",
|
|
23
|
+
select: readString(config.select) === "options" ? "options" : "any",
|
|
22
24
|
...parsePhiChoiceOptionsConfig(config),
|
|
23
25
|
};
|
|
24
26
|
}
|
|
@@ -51,6 +53,24 @@ export const PHI_CASCADER_WIDGET_DEFINITION = {
|
|
|
51
53
|
{ value: "path", label: "Path" },
|
|
52
54
|
],
|
|
53
55
|
},
|
|
56
|
+
{
|
|
57
|
+
key: "expandTrigger",
|
|
58
|
+
type: "choice",
|
|
59
|
+
label: "Opens",
|
|
60
|
+
options: [
|
|
61
|
+
{ value: "click", label: "On click" },
|
|
62
|
+
{ value: "hover", label: "On hover" },
|
|
63
|
+
],
|
|
64
|
+
},
|
|
65
|
+
{
|
|
66
|
+
key: "select",
|
|
67
|
+
type: "choice",
|
|
68
|
+
label: "Choosable",
|
|
69
|
+
options: [
|
|
70
|
+
{ value: "any", label: "Every level" },
|
|
71
|
+
{ value: "options", label: "Only the options" },
|
|
72
|
+
],
|
|
73
|
+
},
|
|
54
74
|
...PHI_CONTROL_PRESENTATION_FIELDS,
|
|
55
75
|
...PHI_CONTROL_STATE_FIELDS,
|
|
56
76
|
],
|
|
@@ -60,6 +80,8 @@ export const PHI_CASCADER_WIDGET_DEFINITION = {
|
|
|
60
80
|
separator: "/",
|
|
61
81
|
rootValue: "/",
|
|
62
82
|
normalize: "raw",
|
|
83
|
+
expandTrigger: "click",
|
|
84
|
+
select: "any",
|
|
63
85
|
optionsProvider: null,
|
|
64
86
|
options: [],
|
|
65
87
|
},
|
|
@@ -14,7 +14,13 @@ export declare const PHI_CHECKBOX_GROUP_WIDGET_DEFINITION: {
|
|
|
14
14
|
kind: "widget";
|
|
15
15
|
pluginKey: string;
|
|
16
16
|
typeKey: string;
|
|
17
|
-
slotSizePolicy:
|
|
17
|
+
slotSizePolicy: {
|
|
18
|
+
configField: string;
|
|
19
|
+
byValue: {
|
|
20
|
+
true: "intrinsic";
|
|
21
|
+
};
|
|
22
|
+
otherwise: "fill-inline";
|
|
23
|
+
};
|
|
18
24
|
title: string;
|
|
19
25
|
description: string;
|
|
20
26
|
category: "form";
|
|
@@ -49,7 +55,7 @@ export declare const PHI_CHECKBOX_GROUP_WIDGET_DEFINITION: {
|
|
|
49
55
|
key: string;
|
|
50
56
|
type: "collection";
|
|
51
57
|
label: string;
|
|
52
|
-
editorPlacement: "
|
|
58
|
+
editorPlacement: "inspector" | "toolbar";
|
|
53
59
|
itemKeyField: string;
|
|
54
60
|
itemLabelField: string;
|
|
55
61
|
defaultItem: {
|
|
@@ -18,7 +18,7 @@ export const PHI_CHECKBOX_GROUP_WIDGET_DEFINITION = {
|
|
|
18
18
|
kind: "widget",
|
|
19
19
|
pluginKey: resolvePhiCmsWidgetPluginKey("checkbox-group"),
|
|
20
20
|
typeKey: "checkbox-group",
|
|
21
|
-
slotSizePolicy: "intrinsic",
|
|
21
|
+
slotSizePolicy: { configField: "vertical", byValue: { true: "intrinsic" }, otherwise: "fill-inline" },
|
|
22
22
|
title: "Checkbox Group",
|
|
23
23
|
description: "Reusable multi-choice checkbox group with static or provider-backed options.",
|
|
24
24
|
category: "form",
|
|
@@ -40,6 +40,7 @@ export declare const PHI_DESCRIPTION_WIDGET_DEFINITION: {
|
|
|
40
40
|
type: "string" | "url" | "icon";
|
|
41
41
|
emptyValue?: "";
|
|
42
42
|
placeholder?: string;
|
|
43
|
+
text?: false | "label" | "message";
|
|
43
44
|
}) | ({
|
|
44
45
|
key: string;
|
|
45
46
|
label: string;
|
|
@@ -103,7 +104,7 @@ export declare const PHI_DESCRIPTION_WIDGET_DEFINITION: {
|
|
|
103
104
|
heading?: string;
|
|
104
105
|
} & {
|
|
105
106
|
type: "record-field";
|
|
106
|
-
kinds: readonly import("../../../../../
|
|
107
|
+
kinds: readonly import("../../../../../module-records").PhiRecordFieldKind[];
|
|
107
108
|
}) | ({
|
|
108
109
|
key: string;
|
|
109
110
|
label: string;
|
|
@@ -69,7 +69,6 @@ export declare const PHI_ENTRY_LIST_WIDGET_DEFINITION: {
|
|
|
69
69
|
description: string;
|
|
70
70
|
category: "content";
|
|
71
71
|
tags: string[];
|
|
72
|
-
translatesOwnText: true;
|
|
73
72
|
icon: string;
|
|
74
73
|
slotSizePolicy: "fill-inline";
|
|
75
74
|
fields: (({
|
|
@@ -84,6 +83,7 @@ export declare const PHI_ENTRY_LIST_WIDGET_DEFINITION: {
|
|
|
84
83
|
type: "string" | "url" | "icon";
|
|
85
84
|
emptyValue?: "";
|
|
86
85
|
placeholder?: string;
|
|
86
|
+
text?: false | "label" | "message";
|
|
87
87
|
}) | ({
|
|
88
88
|
key: string;
|
|
89
89
|
label: string;
|
|
@@ -147,7 +147,7 @@ export declare const PHI_ENTRY_LIST_WIDGET_DEFINITION: {
|
|
|
147
147
|
heading?: string;
|
|
148
148
|
} & {
|
|
149
149
|
type: "record-field";
|
|
150
|
-
kinds: readonly import("../../../../../
|
|
150
|
+
kinds: readonly import("../../../../../module-records").PhiRecordFieldKind[];
|
|
151
151
|
}) | ({
|
|
152
152
|
key: string;
|
|
153
153
|
label: string;
|