@phis/ui 0.5.2 → 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/README.md +1 -1
- package/components/controls/phi-border-control.js +1 -1
- package/components/controls/phi-bound-radius-control.js +9 -9
- package/components/controls/phi-brand-control.js +1 -1
- package/components/controls/phi-cascader-control.d.ts +9 -1
- package/components/controls/phi-cascader-control.js +25 -3
- package/components/controls/phi-drawer-control-adapter.js +4 -4
- package/components/controls/phi-dropdown-control.js +2 -2
- package/components/controls/phi-form-control.js +1 -1
- package/components/controls/phi-image-control.js +1 -1
- package/components/controls/phi-mask-picker-control.js +6 -6
- 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/controls/phi-select-control.js +1 -1
- package/components/controls/phi-theme-scope-control.js +1 -1
- package/components/controls/use-phi-color-control-presets.js +2 -2
- package/components/forms/compound-form-controls.js +2 -2
- package/components/forms/extended-form-field-controls.d.ts +1 -0
- package/components/forms/extended-form-field-controls.js +24 -2
- 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 +6 -2
- package/components/layouts/clients/phi-flex-layout-client.js +4 -4
- package/components/layouts/clients/phi-grid-layout-client.js +3 -3
- package/components/layouts/clients/phi-sequence-slot-editor.js +1 -1
- package/components/layouts/layout-definitions.d.ts +4 -4
- package/components/layouts/phi-page-region-layout.js +1 -1
- package/components/layouts/phi-structure-region-layout.js +3 -3
- package/components/media/phi-asset-focal-rect-widget.js +4 -4
- package/components/media/phi-asset-inspector-section.js +1 -1
- package/components/media/phi-media-kind-icon.js +2 -2
- package/components/media/phi-media-picker-binding.js +6 -1
- package/components/media/phi-media-restricted-icon.js +1 -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/overlays/phi-overlay-container-client.js +1 -1
- package/components/regions/presets/content-entry-editor-page-tree.js +3 -1
- package/components/regions/presets/phi-base-page-column.js +6 -2
- package/components/root/phi-config-provider.js +1 -1
- package/components/root/phi-root-background.js +1 -1
- package/components/root/phi-root-theme-resolver.js +1 -1
- package/components/shell/phi-module-icons.js +1 -1
- package/components/tables/client/phi-table-binding.js +16 -3
- package/components/trees/client/phi-tree-binding.js +6 -2
- package/components/widgets/built-in/builder-workspace-preview.js +8 -8
- package/components/widgets/client/bullet-list-entries-editor.js +2 -2
- package/components/widgets/client/external-document-editor.js +1 -1
- package/components/widgets/client/html-editor.js +3 -3
- 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/background.d.ts +1 -1
- package/components/widgets/config/background.js +1 -1
- package/components/widgets/config/choice-shared.d.ts +2 -2
- package/components/widgets/inspector-field-row.js +1 -1
- package/components/widgets/label-sets/gallery.js +6 -0
- package/components/widgets/label-sets/inspector.js +2 -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/inspector.d.ts +1 -0
- package/components/widgets/label-types/inspector.js +1 -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/components/widgets/shared/card-body-client.js +1 -1
- package/components/widgets/shared/result-body-client.js +1 -1
- package/constants/media-library-provider-keys.d.ts +8 -1
- package/constants/media-library-provider-keys.js +8 -1
- package/constants/record-field-kinds.d.ts +6 -0
- package/constants/record-field-kinds.js +7 -0
- package/constants/runtime-module-ownership.js +2 -1
- package/controls.d.ts +7 -0
- package/controls.js +4 -0
- package/helpers/border-widget-style.d.ts +2 -2
- package/helpers/border-widget-style.js +2 -2
- package/helpers/cms-dialog.d.ts +43 -7
- package/helpers/cms-dialog.js +46 -4
- package/helpers/cms-layout-defaults.d.ts +2 -2
- package/helpers/cms-page-catalog.d.ts +13 -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/cms-preset-page-tree.d.ts +4 -0
- package/helpers/cms-preset-page-tree.js +2 -0
- package/helpers/layout-style.d.ts +2 -2
- package/helpers/money-amount.d.ts +48 -0
- package/helpers/money-amount.js +131 -0
- package/helpers/page-layout-check.d.ts +4 -1
- package/helpers/page-layout-check.js +41 -2
- package/helpers/record-fields.d.ts +22 -0
- package/helpers/record-fields.js +109 -0
- package/helpers/surface-presets.d.ts +6 -6
- package/helpers/surface-style.d.ts +1 -1
- package/helpers.d.ts +0 -1
- package/helpers.js +0 -2
- package/module-page-check.d.ts +12 -0
- package/module-page-check.js +12 -0
- package/module-records.d.ts +7 -2
- package/module-records.js +5 -1
- package/next/antd-form-context-loader.mjs +31 -0
- package/next/config.d.mts +2 -0
- package/next/config.mjs +36 -3
- package/package.json +11 -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/data-providers.d.ts +0 -65
- package/plugins/runtime-modules/asset/data-providers.js +0 -40
- package/plugins/runtime-modules/asset/definition.d.ts +0 -60
- package/plugins/runtime-modules/asset/ids.d.ts +0 -1
- package/plugins/runtime-modules/asset/ids.js +1 -2
- package/plugins/runtime-modules/asset/presets.d.ts +1 -0
- package/plugins/runtime-modules/asset/server.js +0 -5
- 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/blog/presets.d.ts +1 -0
- package/plugins/runtime-modules/builder/clients/inspector-config-field.d.ts +4 -1
- package/plugins/runtime-modules/builder/clients/inspector-config-field.js +13 -4
- package/plugins/runtime-modules/builder/clients/inspector-link-target-field.js +1 -1
- package/plugins/runtime-modules/builder/clients/inspector-section-widget.js +14 -1
- package/plugins/runtime-modules/builder/clients/inspector-signal-section.js +2 -2
- package/plugins/runtime-modules/builder/clients/layout-inspector.js +1 -1
- package/plugins/runtime-modules/builder/clients/layout-scaffold-buttons.js +4 -4
- package/plugins/runtime-modules/builder/clients/layout-scaffold-overlays.js +1 -1
- package/plugins/runtime-modules/builder/clients/region-inspector.js +1 -1
- package/plugins/runtime-modules/builder/clients/region-visibility-fields.js +1 -1
- package/plugins/runtime-modules/builder/clients/shells-workspace.js +1 -1
- package/plugins/runtime-modules/builder/clients/structure-canvas.js +2 -2
- package/plugins/runtime-modules/builder/clients/widget-effects-editor.js +1 -1
- package/plugins/runtime-modules/builder/clients/widget-inspector.d.ts +4 -1
- package/plugins/runtime-modules/builder/clients/widget-inspector.js +3 -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/page-presets.server.d.ts +6 -0
- package/plugins/runtime-modules/builder/page-presets.server.js +8 -0
- package/plugins/runtime-modules/builder/pages-workspace.js +12 -1
- package/plugins/runtime-modules/builder/render-root-node-scaffold.js +5 -5
- package/plugins/runtime-modules/builder/structure-dnd.js +2 -2
- package/plugins/runtime-modules/builder/trees/phi-default-builder-area-preset-tree.js +6 -3
- package/plugins/runtime-modules/builder/widgets/test-block/client.js +1 -1
- package/plugins/runtime-modules/content-entry-routes.d.ts +1 -0
- package/plugins/runtime-modules/contracts.js +41 -1
- package/plugins/runtime-modules/core/data-providers.d.ts +60 -0
- package/plugins/runtime-modules/core/data-providers.js +41 -0
- package/plugins/runtime-modules/core/definition.d.ts +98 -0
- package/plugins/runtime-modules/core/form-providers.d.ts +43 -0
- package/plugins/runtime-modules/core/server.js +5 -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 +34 -0
- package/plugins/runtime-modules/core/widgets/button/config.js +16 -0
- package/plugins/runtime-modules/core/widgets/button/plugin.js +37 -6
- package/plugins/runtime-modules/core/widgets/card/config.d.ts +13 -2
- 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 +13 -2
- package/plugins/runtime-modules/core/widgets/description/editor.js +13 -13
- package/plugins/runtime-modules/core/widgets/entry-list/config.d.ts +11 -0
- package/plugins/runtime-modules/core/widgets/gallery/authoring.js +12 -3
- package/plugins/runtime-modules/core/widgets/gallery/client.d.ts +4 -1
- package/plugins/runtime-modules/core/widgets/gallery/client.js +38 -21
- package/plugins/runtime-modules/core/widgets/gallery/config.d.ts +18 -0
- package/plugins/runtime-modules/core/widgets/gallery/config.js +24 -0
- package/plugins/runtime-modules/core/widgets/gallery/server.d.ts +1 -1
- package/plugins/runtime-modules/core/widgets/gallery/server.js +11 -0
- package/plugins/runtime-modules/core/widgets/image/config.d.ts +35 -0
- package/plugins/runtime-modules/core/widgets/image/config.js +8 -0
- package/plugins/runtime-modules/core/widgets/image/plugin.js +19 -1
- package/plugins/runtime-modules/core/widgets/image/server.d.ts +3 -1
- package/plugins/runtime-modules/core/widgets/image/server.js +2 -2
- package/plugins/runtime-modules/core/widgets/markdown/config.d.ts +13 -0
- package/plugins/runtime-modules/core/widgets/markdown/config.js +8 -0
- package/plugins/runtime-modules/core/widgets/markdown/editor.js +7 -7
- package/plugins/runtime-modules/core/widgets/markdown/plugin.js +20 -7
- package/plugins/runtime-modules/core/widgets/multi-select/config.d.ts +1 -1
- package/plugins/runtime-modules/core/widgets/record/authoring.js +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 +11 -0
- 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 +13 -0
- package/plugins/runtime-modules/core/widgets/simple-text/config.js +9 -0
- package/plugins/runtime-modules/core/widgets/simple-text/editor.js +1 -1
- package/plugins/runtime-modules/core/widgets/simple-text/plugin.js +14 -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/spacer/client.js +1 -1
- 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 +37 -0
- 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 +57 -8
- package/plugins/runtime-modules/editor/presets.d.ts +1 -0
- 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/localization/presets.d.ts +1 -0
- package/plugins/runtime-modules/news/presets.d.ts +1 -0
- package/plugins/runtime-modules/public/module.d.ts +1 -1
- package/plugins/runtime-modules/resolver.js +7 -0
- package/plugins/runtime-modules/revisions/presets.d.ts +1 -0
- package/plugins/runtime-modules/revisions/trees/phi-default-builder-revisions-page-tree.js +2 -2
- package/plugins/runtime-modules/theme/presets.d.ts +1 -0
- package/plugins/runtime-modules/theme/widgets/brand-controls/client.js +25 -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 +26 -0
- package/server-helpers/cms-page-record.js +52 -0
- package/server-helpers/cms-request.js +48 -4
- package/server-helpers/record-fields.d.ts +62 -0
- package/server-helpers/record-fields.js +86 -0
- package/server-helpers/record-samples.d.ts +21 -0
- package/server-helpers/record-samples.js +49 -0
- package/styles/builder-scaffold.css +19 -19
- package/styles/controls.css +109 -109
- package/styles/gradients.css +23 -23
- package/styles/layout-affordances.css +15 -15
- package/styles/layout-authoring-scaffold.css +20 -20
- package/styles/layout.css +9 -9
- package/styles/root.css +4 -4
- package/styles/shell.css +48 -17
- package/theme/antd-css-var-contract.d.ts +86 -80
- package/theme/antd-css-var-contract.js +92 -81
- package/theme/phi-control-shape.d.ts +1 -1
- package/theme/phi-theme-gradients.d.ts +2 -2
- package/theme/phi-theme-gradients.js +14 -14
- package/theme/phi-theme-palette.d.ts +1 -1
- package/theme/phi-theme-palette.js +2 -2
- package/theme/phi-theme-tokens.d.ts +8 -5
- package/theme/phi-theme-tokens.js +59 -28
- package/theme/phi-theme.d.ts +14 -2
- package/theme/phi-theme.js +14 -1
- package/theme/phi-tokens.d.ts +5 -0
- package/theme/phi-tokens.js +9 -0
- package/types/cms-module-descriptors.d.ts +9 -0
- package/types/cms-plugins.d.ts +27 -1
- package/types/collection-provider.d.ts +7 -0
- package/types/core-widget-placements.d.ts +42 -0
- package/types/record-provider.d.ts +109 -1
- 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 +5 -0
- package/types.d.ts +1 -0
- /package/plugins/runtime-modules/{asset/services/folder-images.server.d.ts → core/services/media-folder-images.server.d.ts} +0 -0
- /package/plugins/runtime-modules/{asset/services/folder-images.server.js → core/services/media-folder-images.server.js} +0 -0
|
@@ -335,6 +335,61 @@ export declare const PHI_CORE_RUNTIME_MODULE_DEFINITION: {
|
|
|
335
335
|
options?: undefined;
|
|
336
336
|
})[];
|
|
337
337
|
resources?: undefined;
|
|
338
|
+
} | {
|
|
339
|
+
key: `${string}/${string}`;
|
|
340
|
+
ownerModuleId: "@phis/ui/modules/core";
|
|
341
|
+
kind: "record";
|
|
342
|
+
executionMode: "live";
|
|
343
|
+
authoringMode: "none";
|
|
344
|
+
title: string;
|
|
345
|
+
description: string;
|
|
346
|
+
settingsFields: ({
|
|
347
|
+
key: string;
|
|
348
|
+
type: "choice";
|
|
349
|
+
heading: string;
|
|
350
|
+
label: string;
|
|
351
|
+
optionsProvider: {
|
|
352
|
+
providerKey: `${string}/${string}`;
|
|
353
|
+
};
|
|
354
|
+
description?: undefined;
|
|
355
|
+
options?: undefined;
|
|
356
|
+
min?: undefined;
|
|
357
|
+
max?: undefined;
|
|
358
|
+
} | {
|
|
359
|
+
key: string;
|
|
360
|
+
type: "boolean";
|
|
361
|
+
label: string;
|
|
362
|
+
description: string;
|
|
363
|
+
heading?: undefined;
|
|
364
|
+
optionsProvider?: undefined;
|
|
365
|
+
options?: undefined;
|
|
366
|
+
min?: undefined;
|
|
367
|
+
max?: undefined;
|
|
368
|
+
} | {
|
|
369
|
+
key: string;
|
|
370
|
+
type: "choice";
|
|
371
|
+
label: string;
|
|
372
|
+
options: {
|
|
373
|
+
value: string;
|
|
374
|
+
label: string;
|
|
375
|
+
}[];
|
|
376
|
+
heading?: undefined;
|
|
377
|
+
optionsProvider?: undefined;
|
|
378
|
+
description?: undefined;
|
|
379
|
+
min?: undefined;
|
|
380
|
+
max?: undefined;
|
|
381
|
+
} | {
|
|
382
|
+
key: string;
|
|
383
|
+
type: "number";
|
|
384
|
+
label: string;
|
|
385
|
+
min: number;
|
|
386
|
+
max: number;
|
|
387
|
+
heading?: undefined;
|
|
388
|
+
optionsProvider?: undefined;
|
|
389
|
+
description?: undefined;
|
|
390
|
+
options?: undefined;
|
|
391
|
+
})[];
|
|
392
|
+
resources?: undefined;
|
|
338
393
|
})[];
|
|
339
394
|
formProviders: {
|
|
340
395
|
readonly fieldTypes: ({
|
|
@@ -662,6 +717,49 @@ export declare const PHI_CORE_RUNTIME_MODULE_DEFINITION: {
|
|
|
662
717
|
readonly label: "Area";
|
|
663
718
|
readonly description: "Whose Pages are offered; Public when empty.";
|
|
664
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
|
+
}];
|
|
665
763
|
})[];
|
|
666
764
|
readonly validationRules: ({
|
|
667
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";
|
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import { PHI_CORE_RUNTIME_DATA_PROVIDER_KEYS } from "../../../constants/core-data-provider-keys";
|
|
2
|
+
import { PHI_MEDIA_LIBRARY_DATA_PROVIDER_KEYS } from "../../../constants/media-library-provider-keys";
|
|
2
3
|
import { PHI_CORE_RUNTIME_MODULE_THEMES } from "./themes";
|
|
3
4
|
import { definePhiRuntimeModuleServerAreaContribution } from "../area-contributions";
|
|
4
5
|
import { PHI_CORE_RUNTIME_MODULE_DEFINITION } from "./definition";
|
|
@@ -26,6 +27,10 @@ export function createPhiCoreRuntimeModuleServerAreaContribution() {
|
|
|
26
27
|
recordProviders: [{
|
|
27
28
|
key: PHI_CORE_RUNTIME_DATA_PROVIDER_KEYS.contentEntry,
|
|
28
29
|
load: () => import("./content-entries/record.server").then((module) => module.resolvePhiContentEntryRecord),
|
|
30
|
+
}, {
|
|
31
|
+
// Showing a Folder's public pictures needs no Media management in the Area, as an Image does not.
|
|
32
|
+
key: PHI_MEDIA_LIBRARY_DATA_PROVIDER_KEYS.folderImages,
|
|
33
|
+
load: () => import("./services/media-folder-images.server").then((module) => module.resolvePhiMediaFolderImagesRecord),
|
|
29
34
|
}],
|
|
30
35
|
load: () => import("./module").then((module) => module.PHI_CORE_RUNTIME_MODULE),
|
|
31
36
|
},
|
|
@@ -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
|
}
|
|
@@ -32,6 +32,10 @@ export type PhiButtonWidgetConfig = PhiCmsWidgetConfigBase & PhiControlBadgeConf
|
|
|
32
32
|
*/
|
|
33
33
|
linkTarget?: PhiLinkTarget;
|
|
34
34
|
danger?: boolean;
|
|
35
|
+
/** A text field of the page record that is the signal value instead of `value`. */
|
|
36
|
+
valueRecordField?: string;
|
|
37
|
+
/** A link field of the page record that is where the Button leads instead of `linkTarget`. */
|
|
38
|
+
linkRecordField?: string;
|
|
35
39
|
};
|
|
36
40
|
declare function parsePhiButtonWidgetConfig(config: Record<string, unknown>): PhiButtonWidgetConfig;
|
|
37
41
|
export declare const PHI_BUTTON_WIDGET_DEFINITION: {
|
|
@@ -161,6 +165,7 @@ export declare const PHI_BUTTON_WIDGET_DEFINITION: {
|
|
|
161
165
|
visibleWhen?: undefined;
|
|
162
166
|
emptyValue?: undefined;
|
|
163
167
|
editorPlacement?: undefined;
|
|
168
|
+
kinds?: undefined;
|
|
164
169
|
heading?: undefined;
|
|
165
170
|
} | {
|
|
166
171
|
key: string;
|
|
@@ -178,6 +183,7 @@ export declare const PHI_BUTTON_WIDGET_DEFINITION: {
|
|
|
178
183
|
};
|
|
179
184
|
emptyValue?: undefined;
|
|
180
185
|
editorPlacement?: undefined;
|
|
186
|
+
kinds?: undefined;
|
|
181
187
|
heading?: undefined;
|
|
182
188
|
} | {
|
|
183
189
|
key: string;
|
|
@@ -189,6 +195,7 @@ export declare const PHI_BUTTON_WIDGET_DEFINITION: {
|
|
|
189
195
|
placeholder?: undefined;
|
|
190
196
|
visibleWhen?: undefined;
|
|
191
197
|
editorPlacement?: undefined;
|
|
198
|
+
kinds?: undefined;
|
|
192
199
|
heading?: undefined;
|
|
193
200
|
} | {
|
|
194
201
|
key: string;
|
|
@@ -200,6 +207,7 @@ export declare const PHI_BUTTON_WIDGET_DEFINITION: {
|
|
|
200
207
|
visibleWhen?: undefined;
|
|
201
208
|
emptyValue?: undefined;
|
|
202
209
|
editorPlacement?: undefined;
|
|
210
|
+
kinds?: undefined;
|
|
203
211
|
heading?: undefined;
|
|
204
212
|
} | {
|
|
205
213
|
key: string;
|
|
@@ -211,6 +219,19 @@ export declare const PHI_BUTTON_WIDGET_DEFINITION: {
|
|
|
211
219
|
placeholder?: undefined;
|
|
212
220
|
visibleWhen?: undefined;
|
|
213
221
|
emptyValue?: undefined;
|
|
222
|
+
kinds?: undefined;
|
|
223
|
+
heading?: undefined;
|
|
224
|
+
} | {
|
|
225
|
+
key: string;
|
|
226
|
+
type: "record-field";
|
|
227
|
+
label: string;
|
|
228
|
+
description: string;
|
|
229
|
+
kinds: "text"[];
|
|
230
|
+
options?: undefined;
|
|
231
|
+
placeholder?: undefined;
|
|
232
|
+
visibleWhen?: undefined;
|
|
233
|
+
emptyValue?: undefined;
|
|
234
|
+
editorPlacement?: undefined;
|
|
214
235
|
heading?: undefined;
|
|
215
236
|
} | {
|
|
216
237
|
key: string;
|
|
@@ -226,6 +247,19 @@ export declare const PHI_BUTTON_WIDGET_DEFINITION: {
|
|
|
226
247
|
placeholder?: undefined;
|
|
227
248
|
emptyValue?: undefined;
|
|
228
249
|
editorPlacement?: undefined;
|
|
250
|
+
kinds?: undefined;
|
|
251
|
+
} | {
|
|
252
|
+
key: string;
|
|
253
|
+
type: "record-field";
|
|
254
|
+
label: string;
|
|
255
|
+
description: string;
|
|
256
|
+
kinds: "link"[];
|
|
257
|
+
options?: undefined;
|
|
258
|
+
placeholder?: undefined;
|
|
259
|
+
visibleWhen?: undefined;
|
|
260
|
+
emptyValue?: undefined;
|
|
261
|
+
editorPlacement?: undefined;
|
|
262
|
+
heading?: undefined;
|
|
229
263
|
})[];
|
|
230
264
|
defaultConfig: {
|
|
231
265
|
key: string;
|
|
@@ -26,6 +26,8 @@ function parsePhiButtonWidgetConfig(config) {
|
|
|
26
26
|
gradient: readPhiThemeGradientKey(config.gradient),
|
|
27
27
|
linkTarget: readPhiLinkTarget(config.linkTarget) ?? undefined,
|
|
28
28
|
danger: readBoolean(config.danger),
|
|
29
|
+
valueRecordField: readString(config.valueRecordField),
|
|
30
|
+
linkRecordField: readString(config.linkRecordField),
|
|
29
31
|
};
|
|
30
32
|
}
|
|
31
33
|
const PHI_BUTTON_DEFAULT_CONFIG = {
|
|
@@ -87,6 +89,13 @@ export const PHI_BUTTON_WIDGET_DEFINITION = {
|
|
|
87
89
|
{ key: "tooltip", type: "string", label: "Tooltip" },
|
|
88
90
|
{ key: "icon", type: "icon", label: "Icon", editorPlacement: "toolbar" },
|
|
89
91
|
{ key: "value", type: "string", label: "Signal Value" },
|
|
92
|
+
{
|
|
93
|
+
key: "valueRecordField",
|
|
94
|
+
type: "record-field",
|
|
95
|
+
label: "Signal Value from record",
|
|
96
|
+
description: "Sends a field of the record this page is about as the signal value, instead of the value above.",
|
|
97
|
+
kinds: ["text"],
|
|
98
|
+
},
|
|
90
99
|
/* Above Danger, so Danger stands with the state switches below it. */
|
|
91
100
|
...PHI_CONTROL_PRESENTATION_FIELDS,
|
|
92
101
|
{ key: "danger", type: "boolean", label: "Danger" },
|
|
@@ -102,6 +111,13 @@ export const PHI_BUTTON_WIDGET_DEFINITION = {
|
|
|
102
111
|
label: "Link target",
|
|
103
112
|
visibleWhen: { field: "signalRoutes.emits", equals: null },
|
|
104
113
|
},
|
|
114
|
+
{
|
|
115
|
+
key: "linkRecordField",
|
|
116
|
+
type: "record-field",
|
|
117
|
+
label: "Link from record",
|
|
118
|
+
description: "Leads where a field of the record this page is about leads, instead of the target above.",
|
|
119
|
+
kinds: ["link"],
|
|
120
|
+
},
|
|
105
121
|
...PHI_CONTROL_BADGE_FIELDS,
|
|
106
122
|
],
|
|
107
123
|
defaultConfig: PHI_BUTTON_DEFAULT_CONFIG,
|
|
@@ -5,8 +5,10 @@ import { PhiCmsWidgetType } from "../../../../../constants/cms-widget-types";
|
|
|
5
5
|
import { PhiRuntimeModuleRenderClientHost } from "../../../../../components/runtime/runtime-module-render-client-manifest";
|
|
6
6
|
import { PHI_BUTTON_WIDGET_DEFINITION } from "./config";
|
|
7
7
|
import { getPhiCommonControlLabelsForRuntime } from "../../../../../components/widgets/label-sets/common-controls";
|
|
8
|
+
import { isPhiExternalHref } from "../../../../../helpers/external-href";
|
|
8
9
|
import { resolvePhiLinkHref } from "../../../../../helpers/link-target";
|
|
9
10
|
import { trBulkForLocale } from "../../../../../server-helpers/translate";
|
|
11
|
+
import { resolvePhiWidgetRecordField } from "../../../../../server-helpers/record-fields";
|
|
10
12
|
/**
|
|
11
13
|
* The Button's own words in the reader's language.
|
|
12
14
|
*
|
|
@@ -26,6 +28,24 @@ async function translatePhiButtonConfig(config, runtime, translate) {
|
|
|
26
28
|
...Object.fromEntries(entries.map(([key, text], index) => [key, translated[index]?.trim() || text])),
|
|
27
29
|
};
|
|
28
30
|
}
|
|
31
|
+
/**
|
|
32
|
+
* What the page record says of the Button, where it names a field for its value or its link: a Button on
|
|
33
|
+
* a template sends what the record it stands beside is called and leads where that record leads, not a
|
|
34
|
+
* value or a target frozen into the Page. A record without a field the Button names leaves it without
|
|
35
|
+
* that part of its own, so it is not drawn.
|
|
36
|
+
*/
|
|
37
|
+
async function resolvePhiButtonRecordConfig(config, runtime, registry) {
|
|
38
|
+
const valueField = await resolvePhiWidgetRecordField({ registry, runtime, key: config.valueRecordField, kinds: ["text"] });
|
|
39
|
+
const linkField = await resolvePhiWidgetRecordField({ registry, runtime, key: config.linkRecordField, kinds: ["link"] });
|
|
40
|
+
if (valueField.bound && !valueField.field?.value)
|
|
41
|
+
return null;
|
|
42
|
+
if (linkField.bound && !linkField.field)
|
|
43
|
+
return null;
|
|
44
|
+
return {
|
|
45
|
+
config: valueField.bound && valueField.field ? { ...config, value: valueField.field.value } : config,
|
|
46
|
+
link: linkField.bound && linkField.field ? linkField.field.value : null,
|
|
47
|
+
};
|
|
48
|
+
}
|
|
29
49
|
export const PHI_BUTTON_WIDGET_PLUGIN = {
|
|
30
50
|
...PHI_BUTTON_WIDGET_DEFINITION,
|
|
31
51
|
/*
|
|
@@ -33,12 +53,23 @@ export const PHI_BUTTON_WIDGET_PLUGIN = {
|
|
|
33
53
|
* nothing in a browser -- which address it answers on is the server's to know, and it resolved every
|
|
34
54
|
* target on this page in one pass before anything drew.
|
|
35
55
|
*/
|
|
36
|
-
render: async ({ widget, config, runtime, links }) =>
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
56
|
+
render: async ({ widget, config: stored, runtime, links, registry }) => {
|
|
57
|
+
const bound = await resolvePhiButtonRecordConfig(stored, runtime, registry);
|
|
58
|
+
if (!bound)
|
|
59
|
+
return null;
|
|
60
|
+
const { link: recordLink } = bound;
|
|
61
|
+
const translated = await translatePhiButtonConfig(bound.config, runtime, !hasPhiFlag(widget.flags, PhiCmsFlags.NoTranslate));
|
|
62
|
+
/* The record's words stand in for an empty label only, and are the record's own: not translated. */
|
|
63
|
+
const config = recordLink?.label && !translated.label?.trim() ? { ...translated, label: recordLink.label } : translated;
|
|
64
|
+
return (_jsx(PhiRuntimeModuleRenderClientHost, { type: PhiCmsWidgetType.Button, componentProps: {
|
|
65
|
+
blockId: widget.id,
|
|
66
|
+
config,
|
|
67
|
+
labels: await getPhiCommonControlLabelsForRuntime(runtime),
|
|
68
|
+
link: recordLink
|
|
69
|
+
? { href: recordLink.href, newTab: false, external: isPhiExternalHref(recordLink.href) }
|
|
70
|
+
: resolvePhiLinkHref(bound.config.linkTarget, links),
|
|
71
|
+
} }));
|
|
72
|
+
},
|
|
42
73
|
renderPreview: async ({ widget, config, runtime, links }) => (_jsx(PhiRuntimeModuleRenderClientHost, { type: PhiCmsWidgetType.Button, componentProps: {
|
|
43
74
|
blockId: widget.id,
|
|
44
75
|
config: await translatePhiButtonConfig(config, runtime, !hasPhiFlag(widget.flags, PhiCmsFlags.NoTranslate)),
|
|
@@ -136,7 +136,7 @@ export declare const PHI_CARD_WIDGET_DEFINITION: {
|
|
|
136
136
|
readonly background: {
|
|
137
137
|
readonly base: {
|
|
138
138
|
readonly kind: "color";
|
|
139
|
-
readonly color: "var(--
|
|
139
|
+
readonly color: "var(--phi-color-bg-container)";
|
|
140
140
|
};
|
|
141
141
|
readonly overlay: null;
|
|
142
142
|
readonly filter: null;
|
|
@@ -145,7 +145,7 @@ export declare const PHI_CARD_WIDGET_DEFINITION: {
|
|
|
145
145
|
readonly border: {
|
|
146
146
|
readonly borderWidth: 1;
|
|
147
147
|
readonly borderStyle: "solid";
|
|
148
|
-
readonly borderColor: "var(--
|
|
148
|
+
readonly borderColor: "var(--phi-color-border-secondary)";
|
|
149
149
|
};
|
|
150
150
|
readonly shadow: "soft";
|
|
151
151
|
};
|
|
@@ -230,6 +230,17 @@ export declare const PHI_CARD_WIDGET_DEFINITION: {
|
|
|
230
230
|
editorPlacement?: "inspector" | "geometry" | "toolbar";
|
|
231
231
|
visibleWhen?: import("../../../../../types").PhiCmsConfigFieldVisibilityRule | readonly import("../../../../../types").PhiCmsConfigFieldVisibilityRule[];
|
|
232
232
|
heading?: string;
|
|
233
|
+
} & {
|
|
234
|
+
type: "record-field";
|
|
235
|
+
kinds: readonly import("../../../../../module-records").PhiRecordFieldKind[];
|
|
236
|
+
}) | ({
|
|
237
|
+
key: string;
|
|
238
|
+
label: string;
|
|
239
|
+
description?: string;
|
|
240
|
+
required?: boolean;
|
|
241
|
+
editorPlacement?: "inspector" | "geometry" | "toolbar";
|
|
242
|
+
visibleWhen?: import("../../../../../types").PhiCmsConfigFieldVisibilityRule | readonly import("../../../../../types").PhiCmsConfigFieldVisibilityRule[];
|
|
243
|
+
heading?: string;
|
|
233
244
|
} & {
|
|
234
245
|
type: "dimension";
|
|
235
246
|
widthKey?: 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
|
};
|
|
@@ -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
|
},
|
|
@@ -49,7 +49,7 @@ export declare const PHI_CHECKBOX_GROUP_WIDGET_DEFINITION: {
|
|
|
49
49
|
key: string;
|
|
50
50
|
type: "collection";
|
|
51
51
|
label: string;
|
|
52
|
-
editorPlacement: "
|
|
52
|
+
editorPlacement: "inspector" | "toolbar";
|
|
53
53
|
itemKeyField: string;
|
|
54
54
|
itemLabelField: string;
|
|
55
55
|
defaultItem: {
|