@phis/ui 0.5.3 → 0.5.4
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/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/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 +3 -1
- package/components/tables/client/phi-table-binding.js +16 -3
- package/components/trees/client/phi-tree-binding.js +6 -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 +2 -2
- 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/money-amount.d.ts +48 -0
- package/helpers/money-amount.js +131 -0
- package/helpers/page-layout-check.js +15 -2
- package/helpers/record-fields.d.ts +18 -5
- package/helpers/record-fields.js +38 -13
- package/module-records.d.ts +6 -3
- package/module-records.js +4 -2
- package/package.json +2 -2
- package/plugins/runtime-modules/accounting/module.d.ts +1 -1
- 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/offered-page-catalog.js +3 -3
- package/plugins/runtime-modules/builder/options-providers.js +7 -0
- package/plugins/runtime-modules/builder/trees/phi-default-builder-area-preset-tree.js +6 -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/card/config.d.ts +1 -1
- package/plugins/runtime-modules/core/widgets/cascader/authoring.d.ts +3 -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 +1 -1
- package/plugins/runtime-modules/core/widgets/description/config.d.ts +1 -1
- package/plugins/runtime-modules/core/widgets/entry-list/config.d.ts +1 -1
- package/plugins/runtime-modules/core/widgets/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 +3 -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/markdown/config.d.ts +1 -1
- package/plugins/runtime-modules/core/widgets/multi-select/config.d.ts +1 -1
- 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 +1 -1
- 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 +1 -1
- package/plugins/runtime-modules/core/widgets/simple-text/plugin.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 +12 -4
- package/plugins/runtime-modules/core/widgets/slot-upload/config.js +18 -1
- package/plugins/runtime-modules/core/widgets/slot-upload/plugin.js +4 -2
- package/plugins/runtime-modules/core/widgets/slot-upload/server.d.ts +9 -3
- package/plugins/runtime-modules/core/widgets/slot-upload/server.js +17 -3
- package/plugins/runtime-modules/core/widgets/steps/config.d.ts +1 -1
- package/plugins/runtime-modules/core/widgets/table/client.js +4 -4
- package/plugins/runtime-modules/core/widgets/table/config.d.ts +3 -3
- package/plugins/runtime-modules/core/widgets/table/config.js +3 -0
- package/plugins/runtime-modules/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 +6 -4
- package/plugins/runtime-modules/public/module.d.ts +1 -1
- package/plugins/runtime-modules/resolver.js +5 -0
- package/plugins/runtime-modules/revisions/trees/phi-default-builder-revisions-page-tree.js +2 -2
- package/plugins/runtime-modules/threads/trees/phi-default-threads-page-tree.js +4 -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 +3 -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/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/types/cms-module-descriptors.d.ts +3 -0
- package/types/cms-plugins.d.ts +8 -0
- package/types/collection-provider.d.ts +7 -0
- package/types/core-widget-placements.d.ts +32 -0
- package/types/record-provider.d.ts +19 -3
- 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
package/helpers/record-fields.js
CHANGED
|
@@ -1,3 +1,6 @@
|
|
|
1
|
+
import { formatPhisMoney } from "@phis/contracts/payments";
|
|
2
|
+
import { formatPhiDate } from "./format-date-time";
|
|
3
|
+
import { isPhiMinorAmount, readPhiCurrencyExponent } from "./money-amount";
|
|
1
4
|
/*
|
|
2
5
|
* A record field's value, checked against its declared kind (`types/record-provider.ts`).
|
|
3
6
|
*
|
|
@@ -40,6 +43,13 @@ function readLink(value) {
|
|
|
40
43
|
return undefined;
|
|
41
44
|
return typeof value.label === "string" && value.label ? { href, label: value.label } : { href };
|
|
42
45
|
}
|
|
46
|
+
/** The contract's money exactly: a currency a payment accepts and `minor` as an integer string. */
|
|
47
|
+
function readMoney(value) {
|
|
48
|
+
if (!isRecord(value) || typeof value.currency !== "string" || readPhiCurrencyExponent(value.currency) === undefined) {
|
|
49
|
+
return undefined;
|
|
50
|
+
}
|
|
51
|
+
return isPhiMinorAmount(value.minor) ? { currency: value.currency, minor: value.minor } : undefined;
|
|
52
|
+
}
|
|
43
53
|
function readAll(value, read) {
|
|
44
54
|
if (!Array.isArray(value))
|
|
45
55
|
return undefined;
|
|
@@ -63,22 +73,37 @@ export function readPhiRecordFieldValue(kind, value) {
|
|
|
63
73
|
return typeof value === "string" && !Number.isNaN(Date.parse(value)) ? value : undefined;
|
|
64
74
|
case "number":
|
|
65
75
|
return typeof value === "number" && Number.isFinite(value) ? value : undefined;
|
|
76
|
+
case "money":
|
|
77
|
+
return readMoney(value);
|
|
66
78
|
case "link":
|
|
67
79
|
return readLink(value);
|
|
68
80
|
}
|
|
69
81
|
}
|
|
70
|
-
/**
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
82
|
+
/**
|
|
83
|
+
* The kinds a line of text can show: a text as it is, a number, a date and an amount of money in the
|
|
84
|
+
* page's language.
|
|
85
|
+
*/
|
|
86
|
+
export const PHI_RECORD_TEXT_FIELD_KINDS = ["text", "number", "date", "money"];
|
|
87
|
+
/**
|
|
88
|
+
* A text, number, date or money field as the words a page shows, written for `locale`; a date on the
|
|
89
|
+
* calendar of the Site's `timeZone`, as every other date the page shows (`formatPhiDate`).
|
|
90
|
+
*/
|
|
91
|
+
export function formatPhiRecordFieldText(field, locale, timeZone) {
|
|
92
|
+
switch (field.kind) {
|
|
93
|
+
case "text":
|
|
94
|
+
return field.value;
|
|
95
|
+
case "number":
|
|
96
|
+
return new Intl.NumberFormat(locale).format(field.value);
|
|
97
|
+
case "date":
|
|
98
|
+
return formatPhiDate(field.value, locale, timeZone);
|
|
99
|
+
case "money":
|
|
100
|
+
return formatPhisMoney(field.value, locale);
|
|
83
101
|
}
|
|
84
102
|
}
|
|
103
|
+
/**
|
|
104
|
+
* The declarations of the `record` Providers these Modules describe, by key: what a render's registry
|
|
105
|
+
* answers a record's fields from (`recordDeclarationsByKey`).
|
|
106
|
+
*/
|
|
107
|
+
export function buildPhiRecordDeclarationsByKey(entries) {
|
|
108
|
+
return new Map(entries.flatMap((entry) => (entry.definition.dataProviders ?? []).flatMap((provider) => provider.kind === "record" && provider.record ? [[provider.key, provider.record]] : [])));
|
|
109
|
+
}
|
package/module-records.d.ts
CHANGED
|
@@ -7,7 +7,9 @@
|
|
|
7
7
|
* types say what it is asked with, `fetchPhiSiteApi` asks Core with the credentials the context carries,
|
|
8
8
|
* and `resolvePhiRecordSource` is how one of the package's Server Widgets reads the record its binding
|
|
9
9
|
* names -- once per request, however many Widgets are bound to it. `resolvePhiPageRecordFields` reads the
|
|
10
|
-
* declared fields of the record the Page is about, through the same read
|
|
10
|
+
* declared fields of the record the Page is about, through the same read; `readPhiPageRecordField` picks
|
|
11
|
+
* one of them by kind, and `resolvePhiWidgetRecordField` is the whole step a bound Widget takes -- the
|
|
12
|
+
* same one Core's own Widgets take.
|
|
11
13
|
*
|
|
12
14
|
* `PhiWidgetFailureServer` is what such a Widget renders when that read, or its binding, fails: the error
|
|
13
15
|
* card in the Builder, nothing on a live page, and the `cms.widget.unavailable` warning either way. It is
|
|
@@ -15,9 +17,10 @@
|
|
|
15
17
|
* in `@phis/ui/runtime/data-provider-client`.
|
|
16
18
|
*/
|
|
17
19
|
import "server-only";
|
|
18
|
-
export type {
|
|
20
|
+
export type { PhiRecordFieldKind } from "./constants/record-field-kinds";
|
|
21
|
+
export type { PhiRecordField, PhiRecordFieldValueByKind, PhiRecordLink, PhiRecordPicture, PhiRecordSample, PhiRecordTag, PhiRuntimeModuleRecordProviderServerDefinition, PhiRuntimeRecordFieldsReader, PhiRuntimeRecordProviderContext, PhiRuntimeRecordProviderResolver, PhiRuntimeRecordSamplesReader, } from "./types/record-provider";
|
|
19
22
|
export { resolvePhiRecordSource, type PhiRecordSourceResult } from "./server-helpers/record-source";
|
|
20
|
-
export { resolvePhiPageRecordFields, type PhiPageRecordFieldsResult } from "./server-helpers/record-fields";
|
|
23
|
+
export { readPhiPageRecordField, resolvePhiPageRecordFields, resolvePhiWidgetRecordField, type PhiPageRecordFieldsResult, type PhiWidgetRecordField, } from "./server-helpers/record-fields";
|
|
21
24
|
export { fetchPhiSiteApi, type PhiSiteApiRequest } from "./gateway/site-api-request";
|
|
22
25
|
export { PhiWidgetFailureServer } from "./components/widgets/shared/widget-failure.server";
|
|
23
26
|
export type { PhiWidgetFailureProps } from "./components/widgets/shared/widget-failure";
|
package/module-records.js
CHANGED
|
@@ -7,7 +7,9 @@
|
|
|
7
7
|
* types say what it is asked with, `fetchPhiSiteApi` asks Core with the credentials the context carries,
|
|
8
8
|
* and `resolvePhiRecordSource` is how one of the package's Server Widgets reads the record its binding
|
|
9
9
|
* names -- once per request, however many Widgets are bound to it. `resolvePhiPageRecordFields` reads the
|
|
10
|
-
* declared fields of the record the Page is about, through the same read
|
|
10
|
+
* declared fields of the record the Page is about, through the same read; `readPhiPageRecordField` picks
|
|
11
|
+
* one of them by kind, and `resolvePhiWidgetRecordField` is the whole step a bound Widget takes -- the
|
|
12
|
+
* same one Core's own Widgets take.
|
|
11
13
|
*
|
|
12
14
|
* `PhiWidgetFailureServer` is what such a Widget renders when that read, or its binding, fails: the error
|
|
13
15
|
* card in the Builder, nothing on a live page, and the `cms.widget.unavailable` warning either way. It is
|
|
@@ -16,6 +18,6 @@
|
|
|
16
18
|
*/
|
|
17
19
|
import "server-only";
|
|
18
20
|
export { resolvePhiRecordSource } from "./server-helpers/record-source";
|
|
19
|
-
export { resolvePhiPageRecordFields } from "./server-helpers/record-fields";
|
|
21
|
+
export { readPhiPageRecordField, resolvePhiPageRecordFields, resolvePhiWidgetRecordField, } from "./server-helpers/record-fields";
|
|
20
22
|
export { fetchPhiSiteApi } from "./gateway/site-api-request";
|
|
21
23
|
export { PhiWidgetFailureServer } from "./components/widgets/shared/widget-failure.server";
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@phis/ui",
|
|
3
|
-
"version": "0.5.
|
|
3
|
+
"version": "0.5.4",
|
|
4
4
|
"license": "Apache-2.0",
|
|
5
5
|
"publishConfig": {
|
|
6
6
|
"access": "public"
|
|
@@ -516,7 +516,7 @@
|
|
|
516
516
|
"@lexical/rich-text": "0.50.0",
|
|
517
517
|
"@lexical/selection": "0.50.0",
|
|
518
518
|
"@lexical/utils": "0.50.0",
|
|
519
|
-
"@phis/contracts": "^0.7.
|
|
519
|
+
"@phis/contracts": "^0.7.9",
|
|
520
520
|
"dayjs": "^1.11.23",
|
|
521
521
|
"dom-serializer": "^2.0.0",
|
|
522
522
|
"htmlparser2": "^10.1.0",
|
|
@@ -4,10 +4,10 @@
|
|
|
4
4
|
* to the Core Runtime Controller; a Module's own goes into that Module's Controller, mounted on demand.
|
|
5
5
|
*/
|
|
6
6
|
export declare const PHI_ACCOUNTING_RUNTIME_MODULE: {
|
|
7
|
-
icon: string;
|
|
8
7
|
moduleId: "@phis/ui/modules/accounting";
|
|
9
8
|
category: "foundation";
|
|
10
9
|
description: string;
|
|
10
|
+
icon: string;
|
|
11
11
|
serverBinding: import("../../../types").PhiRuntimeModuleServerBinding;
|
|
12
12
|
kind: "module";
|
|
13
13
|
eligibleAreas: readonly ["public" | "app" | "admin" | "builder" | "editor" | "accounting"];
|
|
@@ -4,10 +4,10 @@
|
|
|
4
4
|
* to the Core Runtime Controller; a Module's own goes into that Module's Controller, mounted on demand.
|
|
5
5
|
*/
|
|
6
6
|
export declare const PHI_APP_RUNTIME_MODULE: {
|
|
7
|
-
icon: string;
|
|
8
7
|
moduleId: "@phis/ui/modules/app";
|
|
9
8
|
category: "foundation";
|
|
10
9
|
description: string;
|
|
10
|
+
icon: string;
|
|
11
11
|
serverBinding: import("../../../types").PhiRuntimeModuleServerBinding;
|
|
12
12
|
formProviders: {
|
|
13
13
|
handlers: ({
|
|
@@ -48,6 +48,7 @@ function buildMediaQuery(query) {
|
|
|
48
48
|
search.set("until", until);
|
|
49
49
|
return search;
|
|
50
50
|
}
|
|
51
|
+
/** The Media library answers file names and sizes, nothing in a language, so it reads neither `locale` nor `timeZone`. */
|
|
51
52
|
async function queryMediaCollection(request) {
|
|
52
53
|
if (request.resourceKey !== "assets") {
|
|
53
54
|
throw new Error(`Unknown Asset collection "${request.resourceKey}".`);
|
|
@@ -12,7 +12,7 @@ import { createPhiRuntimeFormControllerAddress } from "../../../../components/fo
|
|
|
12
12
|
import { PHI_ASSET_RUNTIME_DATA_PROVIDER_KEYS } from "../ids";
|
|
13
13
|
import { PHI_ASSET_FOLDER_FORM_ID, PHI_ASSET_METADATA_FORM_ID } from "../metadata-form";
|
|
14
14
|
import { PHI_ASSET_INSPECTOR_LAYOUT_IDS, PHI_ASSET_INSPECTOR_OVERLAY_IDS, PHI_ASSET_INSPECTOR_WIDGET_IDS, PHI_ASSET_MEDIA_PAGE_LAYOUT_IDS, PHI_ASSET_MEDIA_PAGE_WIDGET_IDS, } from "../media-page-ids";
|
|
15
|
-
import { PHI_DIALOG_BLEED_BODY_CONFIG, PHI_DIALOG_BODY_CONFIG, PHI_DIALOG_COMMANDS_CONFIG } from "../../../../helpers/cms-dialog";
|
|
15
|
+
import { PHI_DIALOG_BLEED_BODY_CONFIG, PHI_DIALOG_BODY_CONFIG, PHI_DIALOG_COMMANDS_CONFIG, PHI_DIALOG_WIDTH_SINGLE_COLUMN, } from "../../../../helpers/cms-dialog";
|
|
16
16
|
import { buildPhiWidgetLabelTranslatorOptions } from "../../../../components/widgets/label-sets/runtime-options";
|
|
17
17
|
const PHI_ASSET_MEDIA_PAGE_REGION_IDS = {
|
|
18
18
|
regionHeaderBottom: -511,
|
|
@@ -209,7 +209,7 @@ export async function buildPhiDefaultBuilderMediaPageTree({ page, runtime, }) {
|
|
|
209
209
|
config: {
|
|
210
210
|
title: mediaLabels?.editor.createFolderTitle ?? "Create folder",
|
|
211
211
|
controlSize: "medium",
|
|
212
|
-
width:
|
|
212
|
+
width: PHI_DIALOG_WIDTH_SINGLE_COLUMN,
|
|
213
213
|
flags: PhiCmsFlags.Centered,
|
|
214
214
|
mountPolicy: "remount",
|
|
215
215
|
closeMode: "immediate",
|
|
@@ -8,6 +8,7 @@ import { PHI_SIGNAL_VALUE_SCHEMAS, createPhiSignalAddress } from "../../../../ty
|
|
|
8
8
|
import { buildPhiSettingsPageShellTree } from "../../../../components/regions/presets/phi-settings-page-shell-tree";
|
|
9
9
|
import { readPhiServerApiCredentials } from "../../../../helpers/phis-server-credentials";
|
|
10
10
|
import { buildPhiWidgetLabelTranslatorOptions } from "../../../../components/widgets/label-sets/runtime-options";
|
|
11
|
+
import { PHI_DIALOG_WIDTH_SINGLE_COLUMN } from "../../../../helpers/cms-dialog";
|
|
11
12
|
const SYNTHETIC_AUTH_SETTINGS_REGION_IDS = {
|
|
12
13
|
regionContent: -482,
|
|
13
14
|
};
|
|
@@ -272,6 +273,7 @@ export async function buildPhiDefaultAdminAuthSettingsPageTree({ page, runtime,
|
|
|
272
273
|
title: labels.installations.createTitle,
|
|
273
274
|
openActionKey: "create",
|
|
274
275
|
formId: PHI_AUTH_ADMIN_SETTINGS_FORM_IDS.installationCreate,
|
|
276
|
+
width: PHI_DIALOG_WIDTH_SINGLE_COLUMN,
|
|
275
277
|
label: labels.installations.createTitle,
|
|
276
278
|
submitLabel: labels.submitLabel,
|
|
277
279
|
cancelLabel: labels.installations.confirmCancel,
|
|
@@ -296,6 +298,7 @@ export async function buildPhiDefaultAdminAuthSettingsPageTree({ page, runtime,
|
|
|
296
298
|
title: labels.installations.editTitle,
|
|
297
299
|
openActionKey: "edit",
|
|
298
300
|
formId: PHI_AUTH_ADMIN_SETTINGS_FORM_IDS.installationEdit,
|
|
301
|
+
width: PHI_DIALOG_WIDTH_SINGLE_COLUMN,
|
|
299
302
|
label: labels.installations.editTitle,
|
|
300
303
|
submitLabel: labels.submitLabel,
|
|
301
304
|
cancelLabel: labels.installations.confirmCancel,
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
"use client";
|
|
2
2
|
import { resolvePhiBuilderAreaAsCmsArea } from "../../../constants/cms-areas";
|
|
3
3
|
import { choosePhiAreaRootApplicant, resolvePhiAreaLandingSelection, } from "../../../helpers/cms-area-config";
|
|
4
|
-
import { findPhiBuilderPageKeyFromStoragePath, normalizePhiBuilderCmsCatalogPath, resolvePhiBuilderActivePageCatalog, resolvePhiBuilderActivePageKey, resolvePhiBuilderPageKeyFromCatalogPath, } from "../../../helpers/cms-page-catalog";
|
|
4
|
+
import { findPhiBuilderPageKeyFromStoragePath, normalizePhiBuilderCmsCatalogPath, resolvePhiBuilderActivePageCatalog, resolvePhiBuilderActivePageKey, resolvePhiBuilderRequestedPageKey, resolvePhiBuilderPageKeyFromCatalogPath, } from "../../../helpers/cms-page-catalog";
|
|
5
5
|
import { findFirstPhiCmsNavigationLinkPath } from "../../../components/regions/presets/navigation-redirect";
|
|
6
6
|
import { resolvePhiRuntimeAreaDefinition } from "../area-definitions";
|
|
7
7
|
import { resolvePhiAreaRootRouteNavKey } from "../area-root-route";
|
|
@@ -201,8 +201,8 @@ function findPageKeyByReference(nodes, reference) {
|
|
|
201
201
|
*/
|
|
202
202
|
export function resolvePhiBuilderOfferedPageKey(state, area, requestedPageKey) {
|
|
203
203
|
const pages = resolvePhiBuilderOfferedPageCatalog(state, area);
|
|
204
|
-
const requested = requestedPageKey
|
|
205
|
-
if (requested
|
|
204
|
+
const requested = resolvePhiBuilderRequestedPageKey(requestedPageKey, pages);
|
|
205
|
+
if (requested) {
|
|
206
206
|
return { pages, pageKey: requested };
|
|
207
207
|
}
|
|
208
208
|
const rootRoute = readPhiBuilderStoredAreaRootRoute(state, area);
|
|
@@ -22,6 +22,13 @@ function resolveProviderArea(context) {
|
|
|
22
22
|
}
|
|
23
23
|
function collectPageOptions(area, nodes) {
|
|
24
24
|
return nodes.flatMap((node) => {
|
|
25
|
+
/*
|
|
26
|
+
* A folder is offered as its Pages only. The picker chooses only what it is offered
|
|
27
|
+
* (`select: "options"`), so the folder the Cascader draws for them opens and chooses nothing.
|
|
28
|
+
*/
|
|
29
|
+
if (!node.storagePath) {
|
|
30
|
+
return collectPageOptions(area, node.children ?? []);
|
|
31
|
+
}
|
|
25
32
|
const path = resolvePhiBuilderCatalogPathForCatalog(area, node.key, nodes);
|
|
26
33
|
/*
|
|
27
34
|
* The root reads as the address, not as the title of whatever Page is standing in it.
|
|
@@ -27,7 +27,7 @@ import { PHI_BUILDER_AREA_SETTINGS_LAYOUT_IDS, PHI_BUILDER_AREA_SETTINGS_OVERLAY
|
|
|
27
27
|
import { PHI_BUILDER_PAGE_META_FORM_ID } from "../page-meta-form";
|
|
28
28
|
import { PHI_BUILDER_AREA_SETTINGS_FORM_ID } from "../area-settings-form";
|
|
29
29
|
import { getPhiBuilderNavigationPageLabels } from "./builder-navigation-label-set";
|
|
30
|
-
import { PHI_DIALOG_BODY_CONFIG, PHI_DIALOG_COMMANDS_CONFIG } from "../../../../helpers/cms-dialog";
|
|
30
|
+
import { PHI_DIALOG_BODY_CONFIG, PHI_DIALOG_COMMANDS_CONFIG, PHI_DIALOG_WIDTH_SINGLE_COLUMN, } from "../../../../helpers/cms-dialog";
|
|
31
31
|
import { buildPhiWidgetLabelTranslatorOptions } from "../../../../components/widgets/label-sets/runtime-options";
|
|
32
32
|
const SYNTHETIC_DEV_REGION_IDS = {
|
|
33
33
|
regionHeaderTop: -509,
|
|
@@ -724,7 +724,7 @@ async function buildPhiDefaultBuilderPagePresetTemplateTree({ page, runtime, pre
|
|
|
724
724
|
label: "Builder area settings",
|
|
725
725
|
config: {
|
|
726
726
|
title: labels.areaSettings.title,
|
|
727
|
-
width:
|
|
727
|
+
width: PHI_DIALOG_WIDTH_SINGLE_COLUMN,
|
|
728
728
|
/*
|
|
729
729
|
* Mounted with the Page rather than on first open, because the controls inside show state
|
|
730
730
|
* rather than ask for it.
|
|
@@ -754,7 +754,7 @@ async function buildPhiDefaultBuilderPagePresetTemplateTree({ page, runtime, pre
|
|
|
754
754
|
label: "Builder page metadata",
|
|
755
755
|
config: {
|
|
756
756
|
title: labels.pages.pageMeta,
|
|
757
|
-
width:
|
|
757
|
+
width: PHI_DIALOG_WIDTH_SINGLE_COLUMN,
|
|
758
758
|
mountPolicy: "lazy-keep",
|
|
759
759
|
closeMode: "immediate",
|
|
760
760
|
signalRoutes: {
|
|
@@ -1398,6 +1398,9 @@ async function buildPhiDefaultBuilderPagePresetTemplateTree({ page, runtime, pre
|
|
|
1398
1398
|
label: "dev pages select",
|
|
1399
1399
|
config: {
|
|
1400
1400
|
key: "pageSelect",
|
|
1401
|
+
// Folders open under the pointer and choose nothing: only a Page is offered.
|
|
1402
|
+
expandTrigger: "hover",
|
|
1403
|
+
select: "options",
|
|
1401
1404
|
signalRoutes: {
|
|
1402
1405
|
emits: [
|
|
1403
1406
|
{
|
|
@@ -5,7 +5,7 @@ export type { PhiCmsAreaShellPresetDescriptor, PhiCmsRoutePresetDescriptor, PhiC
|
|
|
5
5
|
export declare function buildPhiRuntimeModuleDataProviderDescriptor(definition: PhiRuntimeModuleDataProviderDescriptor): {
|
|
6
6
|
key: `${string}/${string}`;
|
|
7
7
|
ownerModuleId: `${string}/${string}`;
|
|
8
|
-
kind: "
|
|
8
|
+
kind: "table" | "tree" | "options" | "collection" | "timeline" | "record";
|
|
9
9
|
executionMode: import("../../types").PhiRuntimeDataProviderExecutionMode;
|
|
10
10
|
authoringMode: import("../../types").PhiRuntimeDataProviderAuthoringMode;
|
|
11
11
|
title: string;
|
|
@@ -717,6 +717,49 @@ export declare const PHI_CORE_RUNTIME_MODULE_DEFINITION: {
|
|
|
717
717
|
readonly label: "Area";
|
|
718
718
|
readonly description: "Whose Pages are offered; Public when empty.";
|
|
719
719
|
}];
|
|
720
|
+
} | {
|
|
721
|
+
ownerModuleId: "@phis/ui/modules/core";
|
|
722
|
+
key: `${string}/${string}`;
|
|
723
|
+
title: "Money";
|
|
724
|
+
valueType: "json";
|
|
725
|
+
presentation: "control";
|
|
726
|
+
settingsFields: readonly [{
|
|
727
|
+
readonly key: "currency";
|
|
728
|
+
readonly type: "choice";
|
|
729
|
+
readonly mode: "single";
|
|
730
|
+
readonly valueType: "string";
|
|
731
|
+
readonly label: "Currency";
|
|
732
|
+
readonly description: "The currency of one amount.";
|
|
733
|
+
readonly options: {
|
|
734
|
+
value: string;
|
|
735
|
+
label: string;
|
|
736
|
+
}[];
|
|
737
|
+
}, {
|
|
738
|
+
readonly key: "currencies";
|
|
739
|
+
readonly type: "choice";
|
|
740
|
+
readonly mode: "multiple";
|
|
741
|
+
readonly valueType: "string[]";
|
|
742
|
+
readonly label: "Currencies";
|
|
743
|
+
readonly description: "One amount per currency, instead of a single currency.";
|
|
744
|
+
readonly options: {
|
|
745
|
+
value: string;
|
|
746
|
+
label: string;
|
|
747
|
+
}[];
|
|
748
|
+
}, {
|
|
749
|
+
readonly key: "min";
|
|
750
|
+
readonly type: "number";
|
|
751
|
+
readonly label: "Minimum";
|
|
752
|
+
readonly description: "In minor units: 100 is 1.00 CHF.";
|
|
753
|
+
readonly min: 0;
|
|
754
|
+
readonly precision: 0;
|
|
755
|
+
}, {
|
|
756
|
+
readonly key: "max";
|
|
757
|
+
readonly type: "number";
|
|
758
|
+
readonly label: "Maximum";
|
|
759
|
+
readonly description: "In minor units.";
|
|
760
|
+
readonly min: 0;
|
|
761
|
+
readonly precision: 0;
|
|
762
|
+
}];
|
|
720
763
|
})[];
|
|
721
764
|
readonly validationRules: ({
|
|
722
765
|
ownerModuleId: "@phis/ui/modules/core";
|
|
@@ -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
|
}
|
|
@@ -232,7 +232,7 @@ export declare const PHI_CARD_WIDGET_DEFINITION: {
|
|
|
232
232
|
heading?: string;
|
|
233
233
|
} & {
|
|
234
234
|
type: "record-field";
|
|
235
|
-
kinds: readonly import("../../../../../
|
|
235
|
+
kinds: readonly import("../../../../../module-records").PhiRecordFieldKind[];
|
|
236
236
|
}) | ({
|
|
237
237
|
key: string;
|
|
238
238
|
label: string;
|
|
@@ -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;
|
|
@@ -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
|
};
|