@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
|
@@ -23,7 +23,7 @@ function renderOverlayZonesFailure(failure) {
|
|
|
23
23
|
return (_jsx(PhiAlertControl, { level: "error", title: "This content could not be shown.", description: failure }));
|
|
24
24
|
}
|
|
25
25
|
/** Stands where the body will be while the zones are on their way, so the shell opens at once. */
|
|
26
|
-
const PHI_OVERLAY_ZONES_PENDING = (_jsx("div", { "aria-busy": "true", style: { minBlockSize: "calc(var(--
|
|
26
|
+
const PHI_OVERLAY_ZONES_PENDING = (_jsx("div", { "aria-busy": "true", style: { minBlockSize: "calc(var(--phi-control-height) * 3)" } }));
|
|
27
27
|
/**
|
|
28
28
|
* Whether an `open` carried on a Table's action channel is meant for this Overlay.
|
|
29
29
|
*
|
|
@@ -11,7 +11,7 @@ import { PHI_SIGNAL_VALUE_SCHEMAS, createPhiSignalAddress, } from "../../../type
|
|
|
11
11
|
import { PHI_CONTENT_ENTRY_SOURCE_LOCALE_PLACEHOLDER_CONFIG_KEY } from "../../forms/content-entry-forms";
|
|
12
12
|
import { PHI_CONTENT_ENTRY_CURATION_NONE_CONFIG_KEYS } from "../../forms/content-entry-curation-config";
|
|
13
13
|
import { PHI_SITE_LOCALES_CONFIG_KEY } from "../../forms/site-locales-config";
|
|
14
|
-
import { PHI_DIALOG_BODY_CONFIG, PHI_DIALOG_COMMANDS_CONFIG } from "../../../helpers/cms-dialog";
|
|
14
|
+
import { PHI_DIALOG_BODY_CONFIG, PHI_DIALOG_COMMANDS_CONFIG, PHI_DIALOG_WIDTH_SINGLE_COLUMN, } from "../../../helpers/cms-dialog";
|
|
15
15
|
/**
|
|
16
16
|
* The node keys of an editor Page. They make its instance ids together with the Module and the preset
|
|
17
17
|
* key, so they are part of every stored placement and do not change.
|
|
@@ -88,6 +88,8 @@ function buildEntryDialogNodes(nodes, input) {
|
|
|
88
88
|
label: `${input.routePrefix} ${input.key} modal`,
|
|
89
89
|
config: {
|
|
90
90
|
title: input.title,
|
|
91
|
+
// Every Form of an entry is one column (helpers/cms-dialog.ts).
|
|
92
|
+
width: PHI_DIALOG_WIDTH_SINGLE_COLUMN,
|
|
91
93
|
mountPolicy: "remount",
|
|
92
94
|
/*
|
|
93
95
|
* `immediate`: there is nobody to ask. `request` exists so a Controller can refuse while a save
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { PHI_CMS_DEFAULT_SLOT_INDEX } from "../../../constants/cms-layout-types";
|
|
2
2
|
import { createPhiCmsPresetNodes } from "../../../helpers/cms-preset-nodes";
|
|
3
3
|
import { PHI_SURFACE_WASH } from "../../../helpers/surface-presets";
|
|
4
|
-
import { PHI_SPACE } from "../../../theme/antd-css-var-contract";
|
|
4
|
+
import { PHI_PAGE, PHI_SPACE } from "../../../theme/antd-css-var-contract";
|
|
5
5
|
import { buildPhiBasePageContentScaffold, PHI_BASE_PAGE_LAYOUT_NODE_ID, } from "./phi-base-page-layout";
|
|
6
6
|
/**
|
|
7
7
|
* A module Page's content as one column on the base scaffold: the Region, the scaffold, and a vertical
|
|
@@ -32,7 +32,11 @@ export function buildPhiBasePageColumnFrame({ page, regionId, columnId, label, m
|
|
|
32
32
|
config: {
|
|
33
33
|
maxSize: { width: maxWidth },
|
|
34
34
|
surface: PHI_SURFACE_WASH,
|
|
35
|
-
padding
|
|
35
|
+
// The Theme's Page inset for the screen it is drawn on (`PHI_PAGE.padding`); a Layout's own wins.
|
|
36
|
+
paddingTop: PHI_PAGE.padding.top,
|
|
37
|
+
paddingRight: PHI_PAGE.padding.right,
|
|
38
|
+
paddingBottom: PHI_PAGE.padding.bottom,
|
|
39
|
+
paddingLeft: PHI_PAGE.padding.left,
|
|
36
40
|
// The house step between a preset's children; the Widgets keep their own air inside.
|
|
37
41
|
gap: PHI_SPACE.sm,
|
|
38
42
|
},
|
|
@@ -40,7 +40,7 @@ function PhiConfigValueProvider({ children, customColors, fonts, fontFamilies, h
|
|
|
40
40
|
}, [controlShapeVars]);
|
|
41
41
|
/*
|
|
42
42
|
* The typefaces, for the same reason. The font catalogue's classes are what define
|
|
43
|
-
* `--phi-font-source-*`, which the Theme's `--
|
|
43
|
+
* `--phi-font-source-*`, which the Theme's `--phi-font-family` points at; a Drawer or a Modal on
|
|
44
44
|
* `document.body` found the variable undefined and fell back to the browser's sans-serif.
|
|
45
45
|
*/
|
|
46
46
|
useEffect(() => {
|
|
@@ -115,7 +115,7 @@ export function resolvePhiRootBackgroundFrameStyle() {
|
|
|
115
115
|
* The fallback ground as a longhand, never as the `background` shorthand: it is the colour under
|
|
116
116
|
* every Picture, including the moment before the first one shows.
|
|
117
117
|
*/
|
|
118
|
-
backgroundColor: "var(--
|
|
118
|
+
backgroundColor: "var(--phi-color-bg-layout)",
|
|
119
119
|
};
|
|
120
120
|
}
|
|
121
121
|
/** The last `url(...)` of a background, which is the base picture: overlays are listed before it. */
|
|
@@ -112,7 +112,7 @@ export function resolvePhiRootTheme({ siteTheme, mode, fonts, presets, }) {
|
|
|
112
112
|
hashed: false,
|
|
113
113
|
zeroRuntime: true,
|
|
114
114
|
cssVar: {
|
|
115
|
-
prefix: "
|
|
115
|
+
prefix: "phi",
|
|
116
116
|
/*
|
|
117
117
|
* Named after what the tokens are resolved from, not after the tokens: the same Theme record,
|
|
118
118
|
* fonts, palette block and mode always resolve to the same tokens, and the record is a fraction
|
|
@@ -29,7 +29,7 @@ export function PhiModuleIcon({ name, size, style, className, title, ariaLabel,
|
|
|
29
29
|
* In the Builder the name stays visible as the mark's title: the Module is not active in the target
|
|
30
30
|
* Area, or does not register that name. Live, a missing icon is nothing, as an unknown `antd:` is.
|
|
31
31
|
*/
|
|
32
|
-
return flagUnavailable ? (_jsx(PhiAntdIcon, { icon: "WarningOutlined", size: size, title: name, className: className ? `phi-module-icon-unavailable ${className}` : "phi-module-icon-unavailable", style: { color: "var(--
|
|
32
|
+
return flagUnavailable ? (_jsx(PhiAntdIcon, { icon: "WarningOutlined", size: size, title: name, className: className ? `phi-module-icon-unavailable ${className}` : "phi-module-icon-unavailable", style: { color: "var(--phi-color-warning)", ...style } })) : null;
|
|
33
33
|
}
|
|
34
34
|
const { drawing } = icon;
|
|
35
35
|
return (_jsx("span", { role: "img", "aria-label": ariaLabel ?? icon.name, title: title, className: className ? `anticon ${className}` : "anticon", style: size === "1em" ? style : { fontSize: size, ...style }, children: _jsx("svg", { viewBox: drawing.viewBox, width: "1em", height: "1em", fill: "currentColor", "aria-hidden": "true", focusable: "false", children: drawing.paths.map((path, index) => (_jsx("path", { d: path, fillRule: drawing.fillRule }, index))) }) }));
|
|
@@ -4,6 +4,7 @@ import { useCallback, useEffect, useMemo, useRef, useState, } from "react";
|
|
|
4
4
|
import { PhiTableProviderError, readPhiTableProviderError, readPhiTableProviderMutationResult, readPhiTableProviderQueryResult, validatePhiTableProviderFieldValue, } from "../../../types/table-widget";
|
|
5
5
|
import { mergePhiTableQueryFilters, movePhiTableBindingRows, movePhiTableBindingTreeRows, patchPhiTableBindingRows, readPhiTableRowIdentity, readPhiTableRowValue, restorePhiTableBindingRowOrder, } from "../../../helpers/table-binding";
|
|
6
6
|
import { usePhiTableProvider } from "../../widgets/client/shared/phi-table-provider";
|
|
7
|
+
import { usePhiIntlLocale, usePhiIntlTimeZone } from "../../root/phi-intl-locale";
|
|
7
8
|
function validateProviderSummary(resource, summary) {
|
|
8
9
|
if (!summary)
|
|
9
10
|
return null;
|
|
@@ -65,6 +66,12 @@ function resolvePhiTableQuery(query, externalQuery, externalSearch, expandedRowI
|
|
|
65
66
|
}
|
|
66
67
|
export function usePhiTableBinding({ source, initialQuery = {}, externalQuery, fixedFilters, externalSearch, defaultPageSize = 20, refreshKey, preserveSelectedRowIdentities = false, initialExpandedRowIdentities = [], onData, onMutation, validateResource, }) {
|
|
67
68
|
const { provider, resource, bindingError } = usePhiTableProvider(source);
|
|
69
|
+
/*
|
|
70
|
+
* The reader's language and the Site's zone go with every query, and into what decides that a query
|
|
71
|
+
* is new: a Provider that wrote "per month" into its rows has to write them again after a switch.
|
|
72
|
+
*/
|
|
73
|
+
const locale = usePhiIntlLocale();
|
|
74
|
+
const timeZone = usePhiIntlTimeZone();
|
|
68
75
|
const resourceError = resource ? validateResource?.(resource) ?? null : null;
|
|
69
76
|
const [query, setQuery] = useState(() => ({
|
|
70
77
|
page: initialQuery.page ?? 1,
|
|
@@ -239,6 +246,8 @@ export function usePhiTableBinding({ source, initialQuery = {}, externalQuery, f
|
|
|
239
246
|
resourceError,
|
|
240
247
|
resolvedQueryKey,
|
|
241
248
|
refreshKey,
|
|
249
|
+
locale,
|
|
250
|
+
timeZone,
|
|
242
251
|
};
|
|
243
252
|
return;
|
|
244
253
|
}
|
|
@@ -249,9 +258,11 @@ export function usePhiTableBinding({ source, initialQuery = {}, externalQuery, f
|
|
|
249
258
|
previous.source === source &&
|
|
250
259
|
previous.resourceError === resourceError &&
|
|
251
260
|
previous.resolvedQueryKey === resolvedQueryKey &&
|
|
252
|
-
previous.refreshKey === refreshKey
|
|
261
|
+
previous.refreshKey === refreshKey &&
|
|
262
|
+
previous.locale === locale &&
|
|
263
|
+
previous.timeZone === timeZone;
|
|
253
264
|
const background = refreshRequest.background && sameQueryInputs && rowsRef.current.length > 0;
|
|
254
|
-
previousQueryInputs.current = { provider, resource, source, resourceError, resolvedQueryKey, refreshKey };
|
|
265
|
+
previousQueryInputs.current = { provider, resource, source, resourceError, resolvedQueryKey, refreshKey, locale, timeZone };
|
|
255
266
|
const abortController = new AbortController();
|
|
256
267
|
queueMicrotask(() => {
|
|
257
268
|
if (!abortController.signal.aborted) {
|
|
@@ -265,6 +276,8 @@ export function usePhiTableBinding({ source, initialQuery = {}, externalQuery, f
|
|
|
265
276
|
resourceKey: source.resourceKey,
|
|
266
277
|
query: resolvedQuery,
|
|
267
278
|
params: source.params,
|
|
279
|
+
locale,
|
|
280
|
+
timeZone,
|
|
268
281
|
signal: abortController.signal,
|
|
269
282
|
}).then((value) => {
|
|
270
283
|
const data = readPhiTableProviderQueryResult(value);
|
|
@@ -303,7 +316,7 @@ export function usePhiTableBinding({ source, initialQuery = {}, externalQuery, f
|
|
|
303
316
|
}
|
|
304
317
|
});
|
|
305
318
|
return () => abortController.abort();
|
|
306
|
-
}, [applyData, expandedRowIdentities, externalQuery, externalSearch, provider, query, refreshKey, refreshRequest, resolvedQuery, resolvedQueryKey, resource, resourceError, source, stableFixedFilters]);
|
|
319
|
+
}, [applyData, expandedRowIdentities, externalQuery, externalSearch, locale, provider, query, refreshKey, refreshRequest, resolvedQuery, resolvedQueryKey, resource, resourceError, source, stableFixedFilters, timeZone]);
|
|
307
320
|
const reload = useCallback(() => setRefreshRequest((current) => ({
|
|
308
321
|
revision: current.revision + 1,
|
|
309
322
|
background: false,
|
|
@@ -3,6 +3,7 @@ import { useCallback, useEffect, useMemo, useRef, useState } from "react";
|
|
|
3
3
|
import { PhiTreeProviderError, readPhiTreeNodePath as readPath, readPhiTreeProviderError, readPhiTreeProviderMutationResult, readPhiTreeProviderQueryResult, } from "../../../types/tree-widget";
|
|
4
4
|
import { validatePhiTableProviderFieldValue } from "../../../types/table-widget";
|
|
5
5
|
import { usePhiTreeProvider } from "../../widgets/client/shared/phi-tree-provider";
|
|
6
|
+
import { usePhiIntlLocale, usePhiIntlTimeZone } from "../../root/phi-intl-locale";
|
|
6
7
|
function patchNode(nodes, identityPath, identity, patch) {
|
|
7
8
|
return nodes.map((node) => String(readPath(node, identityPath)) === String(identity) ? { ...node, ...patch } : node);
|
|
8
9
|
}
|
|
@@ -81,6 +82,9 @@ const PHI_TREE_DEFAULT_INITIAL_QUERY = Object.freeze({});
|
|
|
81
82
|
const PHI_TREE_DEFAULT_EXPANDED_NODE_IDENTITIES = Object.freeze([]);
|
|
82
83
|
export function usePhiTreeBinding({ source, initialQuery = PHI_TREE_DEFAULT_INITIAL_QUERY, defaultExpandedNodeIdentities = PHI_TREE_DEFAULT_EXPANDED_NODE_IDENTITIES, defaultExpandAll = false, }) {
|
|
83
84
|
const { provider, resource, bindingError } = usePhiTreeProvider(source);
|
|
85
|
+
// Sent with every query and part of what makes one new, so a live language switch asks again.
|
|
86
|
+
const locale = usePhiIntlLocale();
|
|
87
|
+
const timeZone = usePhiIntlTimeZone();
|
|
84
88
|
const [query, setQuery] = useState(initialQuery);
|
|
85
89
|
const [nodes, setNodes] = useState([]);
|
|
86
90
|
const nodesRef = useRef(nodes);
|
|
@@ -143,7 +147,7 @@ export function usePhiTreeBinding({ source, initialQuery = PHI_TREE_DEFAULT_INIT
|
|
|
143
147
|
setQueryFailure(null);
|
|
144
148
|
}
|
|
145
149
|
});
|
|
146
|
-
void provider.query({ resourceKey: source.resourceKey, query, params: source.params, signal: controller.signal })
|
|
150
|
+
void provider.query({ resourceKey: source.resourceKey, query, params: source.params, locale, timeZone, signal: controller.signal })
|
|
147
151
|
.then((value) => {
|
|
148
152
|
if (controller.signal.aborted)
|
|
149
153
|
return;
|
|
@@ -174,7 +178,7 @@ export function usePhiTreeBinding({ source, initialQuery = PHI_TREE_DEFAULT_INIT
|
|
|
174
178
|
}
|
|
175
179
|
});
|
|
176
180
|
return () => controller.abort();
|
|
177
|
-
}, [defaultExpandAll, provider, query, refreshRevision, resource, source]);
|
|
181
|
+
}, [defaultExpandAll, locale, provider, query, refreshRevision, resource, source, timeZone]);
|
|
178
182
|
/*
|
|
179
183
|
* One change, shown before it is confirmed where the caller passes what it will look like.
|
|
180
184
|
*
|
|
@@ -1,21 +1,21 @@
|
|
|
1
1
|
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
2
2
|
const frameStyle = {
|
|
3
3
|
display: "grid",
|
|
4
|
-
gap: "var(--
|
|
4
|
+
gap: "var(--phi-padding-xs)",
|
|
5
5
|
gridTemplateRows: "auto auto minmax(5rem, 1fr) auto",
|
|
6
6
|
minHeight: "10rem",
|
|
7
7
|
width: "100%",
|
|
8
8
|
height: "100%",
|
|
9
|
-
padding: "var(--
|
|
10
|
-
border: "1px solid var(--
|
|
11
|
-
borderRadius: "var(--
|
|
12
|
-
background: "var(--
|
|
9
|
+
padding: "var(--phi-padding-sm)",
|
|
10
|
+
border: "1px solid var(--phi-color-border-secondary)",
|
|
11
|
+
borderRadius: "var(--phi-border-radius-lg)",
|
|
12
|
+
background: "var(--phi-color-bg-layout)",
|
|
13
13
|
boxSizing: "border-box",
|
|
14
14
|
};
|
|
15
15
|
const regionStyle = {
|
|
16
16
|
minHeight: "1.25rem",
|
|
17
|
-
borderRadius: "var(--
|
|
18
|
-
background: "var(--
|
|
17
|
+
borderRadius: "var(--phi-border-radius-sm)",
|
|
18
|
+
background: "var(--phi-color-fill-secondary)",
|
|
19
19
|
};
|
|
20
20
|
function Region({ style }) {
|
|
21
21
|
return _jsx("div", { "aria-hidden": true, style: { ...regionStyle, ...style } });
|
|
@@ -23,7 +23,7 @@ function Region({ style }) {
|
|
|
23
23
|
export function PhiBuilderWorkspacePreviewSkeleton({ kind, }) {
|
|
24
24
|
return (_jsxs("div", { "aria-label": kind === "pages" ? "Pages workspace preview" : "Shells workspace preview", "data-phi-builder-workspace-preview": kind, style: frameStyle, children: [_jsx(Region, {}), _jsx(Region, { style: { minHeight: kind === "pages" ? "2rem" : "1.5rem" } }), _jsxs("div", { style: {
|
|
25
25
|
display: "grid",
|
|
26
|
-
gap: "var(--
|
|
26
|
+
gap: "var(--phi-padding-xs)",
|
|
27
27
|
gridTemplateColumns: kind === "pages" ? "minmax(0, 1fr) 22%" : "22% minmax(0, 1fr)",
|
|
28
28
|
minHeight: 0,
|
|
29
29
|
}, children: [_jsx(Region, {}), _jsx(Region, {})] }), _jsx(Region, {})] }));
|
|
@@ -75,7 +75,7 @@ export function PhiBulletListEntriesEditor({ entries, listStyle, onCommit, state
|
|
|
75
75
|
}
|
|
76
76
|
return (_jsx("div", { ref: listRef, style: { width: "100%", minWidth: 0 }, children: _jsx(PhiBulletListControl, { listStyle: listStyle,
|
|
77
77
|
// Each entry is a borderless text field, whose first line stands at the field's height.
|
|
78
|
-
markerLineHeight: "var(--
|
|
78
|
+
markerLineHeight: "var(--phi-control-height)", items: buildPhiBulletListTree(shown, (item, index) => (_jsx(PhiTextControl, { presentation: "textarea", value: item.text, readOnly: !onCommit, variant: "borderless", placeholder: `Item ${index + 1}`, autoSize: { minRows: 1, maxRows: 6 }, onChange: (value) => updateText(index, value ?? ""), onBlur: () => commit(shown), onKeyDown: (event) => {
|
|
79
79
|
if (!onCommit)
|
|
80
80
|
return;
|
|
81
81
|
if (event.key === "Tab") {
|
|
@@ -105,5 +105,5 @@ export function PhiBulletListEntriesEditor({ entries, listStyle, onCommit, state
|
|
|
105
105
|
* first line's middle is the marker's (`markerLineHeight` above). That is the padding the
|
|
106
106
|
* field had from Ant Design already; stated, the clear button can find the line too.
|
|
107
107
|
*/
|
|
108
|
-
inputStyle: { paddingBlock: "calc((var(--
|
|
108
|
+
inputStyle: { paddingBlock: "calc((var(--phi-control-height) - 1lh) / 2)" } })), states && onCommit ? (_entry, index) => stepState(index) : undefined) }) }));
|
|
109
109
|
}
|
|
@@ -43,5 +43,5 @@ export function PhiExternalDocumentEditor({ format, sourceUrl, sourceLocale, onS
|
|
|
43
43
|
});
|
|
44
44
|
return () => controller.abort();
|
|
45
45
|
}, [canReport, format, sourceLocale, sourceUrl]);
|
|
46
|
-
return (_jsx("div", { style: { width: 520, height: 260, maxWidth: "100%", minWidth: 0, minHeight: 0, display: "flex" }, children: _jsx(PhiAlertControl, { level: "info", showIcon: true, title: `External ${format} source`, description: _jsxs(PhiFlexControl, { vertical: true, gap: "var(--
|
|
46
|
+
return (_jsx("div", { style: { width: 520, height: 260, maxWidth: "100%", minWidth: 0, minHeight: 0, display: "flex" }, children: _jsx(PhiAlertControl, { level: "info", showIcon: true, title: `External ${format} source`, description: _jsxs(PhiFlexControl, { vertical: true, gap: "var(--phi-padding-xs)", style: { width: "100%", minWidth: 0 }, children: [_jsx(PhiTypographyControl, { children: "This widget renders the configured external document. Edit its URL and source locale in the widget settings." }), _jsx(PhiTypographyControl, { code: true, copyable: { text: sourceUrl }, style: { wordBreak: "break-all" }, children: sourceUrl || "No Source URL configured." })] }) }) }));
|
|
47
47
|
}
|
|
@@ -64,8 +64,8 @@ const PHI_HTML_WIDGET_EDITOR_LIVE_STYLE = `
|
|
|
64
64
|
}
|
|
65
65
|
|
|
66
66
|
.phi-html-widget-editor__text--code {
|
|
67
|
-
font-family: var(--
|
|
68
|
-
background: var(--
|
|
67
|
+
font-family: var(--phi-font-family-code, ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, Liberation Mono, monospace);
|
|
68
|
+
background: var(--phi-color-fill-secondary, rgba(0, 0, 0, 0.04));
|
|
69
69
|
border-radius: 4px;
|
|
70
70
|
padding: 0 0.2em;
|
|
71
71
|
}
|
|
@@ -436,7 +436,7 @@ export function PhiHtmlWidgetEditor({ blockId, html, fontFamily, fontSize, onCha
|
|
|
436
436
|
width: "100%",
|
|
437
437
|
minWidth: 0,
|
|
438
438
|
maxWidth: "100%",
|
|
439
|
-
border: "1px solid var(--
|
|
439
|
+
border: "1px solid var(--phi-color-border, rgba(0, 0, 0, 0.12))",
|
|
440
440
|
borderRadius: 0,
|
|
441
441
|
overflow: "hidden",
|
|
442
442
|
backgroundColor: "rgba(255,255,255,0.84)",
|
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
"use client";
|
|
2
2
|
import { useCallback, useEffect, useMemo, useRef, useState } from "react";
|
|
3
|
+
import { usePhiIntlLocale, usePhiIntlTimeZone } from "../../../root/phi-intl-locale";
|
|
3
4
|
import { usePhiCollectionProvider } from "./phi-collection-provider";
|
|
4
5
|
function buildInitialQuery(initialQuery, pageSize) {
|
|
5
6
|
return {
|
|
@@ -11,6 +12,9 @@ function buildInitialQuery(initialQuery, pageSize) {
|
|
|
11
12
|
}
|
|
12
13
|
export function usePhiCollectionViewBinding({ source, initialQuery, pageSize, }) {
|
|
13
14
|
const { provider, resource, bindingError } = usePhiCollectionProvider(source);
|
|
15
|
+
// Sent with every query and part of its key, so a live language switch asks again.
|
|
16
|
+
const locale = usePhiIntlLocale();
|
|
17
|
+
const timeZone = usePhiIntlTimeZone();
|
|
14
18
|
const [query, setQuery] = useState(() => buildInitialQuery(initialQuery, pageSize));
|
|
15
19
|
const [data, setData] = useState(null);
|
|
16
20
|
const [loading, setLoading] = useState(false);
|
|
@@ -40,8 +44,10 @@ export function usePhiCollectionViewBinding({ source, initialQuery, pageSize, })
|
|
|
40
44
|
source?.resourceKey ?? null,
|
|
41
45
|
source?.params ?? null,
|
|
42
46
|
query,
|
|
47
|
+
locale,
|
|
48
|
+
timeZone,
|
|
43
49
|
refreshToken,
|
|
44
|
-
]), [query, refreshToken, source]);
|
|
50
|
+
]), [locale, query, refreshToken, source, timeZone]);
|
|
45
51
|
useEffect(() => {
|
|
46
52
|
const nextQuery = JSON.parse(initialQueryKey);
|
|
47
53
|
const timer = window.setTimeout(() => {
|
|
@@ -70,6 +76,8 @@ export function usePhiCollectionViewBinding({ source, initialQuery, pageSize, })
|
|
|
70
76
|
resourceKey: source.resourceKey,
|
|
71
77
|
query,
|
|
72
78
|
params: source.params,
|
|
79
|
+
locale,
|
|
80
|
+
timeZone,
|
|
73
81
|
signal: abortController.signal,
|
|
74
82
|
}).then((nextData) => {
|
|
75
83
|
if (!isCurrent())
|
|
@@ -92,7 +100,7 @@ export function usePhiCollectionViewBinding({ source, initialQuery, pageSize, })
|
|
|
92
100
|
window.clearTimeout(loadingTimer);
|
|
93
101
|
abortController.abort();
|
|
94
102
|
};
|
|
95
|
-
}, [bindingError, provider, query, requestKey, source]);
|
|
103
|
+
}, [bindingError, locale, provider, query, requestKey, source, timeZone]);
|
|
96
104
|
const reload = useCallback(() => setRefreshToken((current) => current + 1), []);
|
|
97
105
|
const activate = useCallback(async (request) => {
|
|
98
106
|
if (!provider || !source || bindingError) {
|
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import type { ReactNode } from "react";
|
|
2
|
+
import { type PhiIntervalLabels } from "../../label-types/interval";
|
|
2
3
|
import type { PhiTableTagColor, PhiTableTagVariant, PhiTableValueRenderer } from "../../../../types/table-widget";
|
|
3
4
|
/**
|
|
4
5
|
* How one value out of a Provider is drawn: a date as a date, an address as a link, a set of words as
|
|
@@ -17,6 +18,13 @@ export type PhiRenderedValueDefinition = {
|
|
|
17
18
|
tagColorMap?: Readonly<Record<string, PhiTableTagColor>>;
|
|
18
19
|
tagVariant?: PhiTableTagVariant;
|
|
19
20
|
};
|
|
21
|
+
/**
|
|
22
|
+
* The words a renderer needs that are not in the value: Core's, from a Label Set the Widget's server
|
|
23
|
+
* half read in the page's language. Only `interval` has any.
|
|
24
|
+
*/
|
|
25
|
+
export type PhiRenderedValueLabels = {
|
|
26
|
+
interval: PhiIntervalLabels;
|
|
27
|
+
};
|
|
20
28
|
/**
|
|
21
29
|
* Where the value stands, which only `json` cares about.
|
|
22
30
|
*
|
|
@@ -26,4 +34,4 @@ export type PhiRenderedValueDefinition = {
|
|
|
26
34
|
* it could not have simply called the table's renderer.
|
|
27
35
|
*/
|
|
28
36
|
export type PhiRenderedValuePresentation = "cell" | "block";
|
|
29
|
-
export declare function renderPhiValueContent(value: unknown, definition: PhiRenderedValueDefinition, presentation?: PhiRenderedValuePresentation): ReactNode;
|
|
37
|
+
export declare function renderPhiValueContent(value: unknown, definition: PhiRenderedValueDefinition, labels: PhiRenderedValueLabels, presentation?: PhiRenderedValuePresentation): ReactNode;
|
|
@@ -1,6 +1,9 @@
|
|
|
1
1
|
"use client";
|
|
2
2
|
import { jsx as _jsx } from "react/jsx-runtime";
|
|
3
|
+
import { formatPhisMoney } from "@phis/contracts/payments";
|
|
3
4
|
import { formatPhiDate, formatPhiDateTime } from "../../../../helpers/format-date-time";
|
|
5
|
+
import { readPhiMoneyValue } from "../../../../helpers/money-amount";
|
|
6
|
+
import { formatPhiInterval, readPhiIntervalValue } from "../../label-types/interval";
|
|
4
7
|
import { usePhiIntlLocale, usePhiIntlTimeZone } from "../../../root/phi-intl-locale";
|
|
5
8
|
import { PhiFlexControl } from "../../../controls/phi-flex-control";
|
|
6
9
|
import { PhiTagControl } from "../../../controls/phi-tag-control";
|
|
@@ -39,9 +42,25 @@ function PhiRenderedDate({ value, withTime }) {
|
|
|
39
42
|
const timeZone = usePhiIntlTimeZone();
|
|
40
43
|
return withTime ? formatPhiDateTime(value, locale, timeZone) : formatPhiDate(value, locale, timeZone);
|
|
41
44
|
}
|
|
42
|
-
|
|
45
|
+
/** The reader's locale, not the server's or the browser's, and the currency's own places. */
|
|
46
|
+
function PhiRenderedMoney({ value }) {
|
|
47
|
+
return formatPhisMoney(value, usePhiIntlLocale());
|
|
48
|
+
}
|
|
49
|
+
export function renderPhiValueContent(value, definition, labels, presentation = "cell") {
|
|
43
50
|
if (value == null || value === "")
|
|
44
51
|
return null;
|
|
52
|
+
/*
|
|
53
|
+
* Read before anything is stringified: both are objects, and a value that is not one of them draws
|
|
54
|
+
* nothing rather than its JSON -- a cell that says `{"currency":"CHF"}` is no amount of money.
|
|
55
|
+
*/
|
|
56
|
+
if (definition.renderer === "money") {
|
|
57
|
+
const money = readPhiMoneyValue(value);
|
|
58
|
+
return money ? _jsx(PhiRenderedMoney, { value: money }) : null;
|
|
59
|
+
}
|
|
60
|
+
if (definition.renderer === "interval") {
|
|
61
|
+
const interval = readPhiIntervalValue(value);
|
|
62
|
+
return interval ? formatPhiInterval(interval, labels.interval) : null;
|
|
63
|
+
}
|
|
45
64
|
const normalizedValue = normalizePhiRenderedText(value);
|
|
46
65
|
const displayValue = definition.valueMap?.[normalizedValue] ?? normalizedValue;
|
|
47
66
|
if (definition.renderer === "email" || definition.renderer === "link") {
|
|
@@ -88,7 +88,7 @@ export declare const PHI_BACKGROUND_BASE_KINDS: readonly PhiCmsBackgroundWidgetC
|
|
|
88
88
|
* ground (`PHI_SURFACE_TONE_GROUND`), and what a `theme` ground falls back to where the Theme's Overlay
|
|
89
89
|
* is not published.
|
|
90
90
|
*/
|
|
91
|
-
export declare const PHI_BACKGROUND_CONTAINER_GROUND = "var(--
|
|
91
|
+
export declare const PHI_BACKGROUND_CONTAINER_GROUND = "var(--phi-color-bg-container)";
|
|
92
92
|
/**
|
|
93
93
|
* What a `theme` Base paints: the Shell Chrome Overlay's custom properties, the same ones the Shell's
|
|
94
94
|
* chrome panes paint from (components/shell/phi-cms-shell.tsx).
|
|
@@ -37,7 +37,7 @@ export const PHI_BACKGROUND_BASE_KINDS = [
|
|
|
37
37
|
* ground (`PHI_SURFACE_TONE_GROUND`), and what a `theme` ground falls back to where the Theme's Overlay
|
|
38
38
|
* is not published.
|
|
39
39
|
*/
|
|
40
|
-
export const PHI_BACKGROUND_CONTAINER_GROUND = "var(--
|
|
40
|
+
export const PHI_BACKGROUND_CONTAINER_GROUND = "var(--phi-color-bg-container)";
|
|
41
41
|
/**
|
|
42
42
|
* What a `theme` Base paints: the Shell Chrome Overlay's custom properties, the same ones the Shell's
|
|
43
43
|
* chrome panes paint from (components/shell/phi-cms-shell.tsx).
|
|
@@ -20,7 +20,7 @@ export declare function buildPhiChoiceControlOptionFields(editorPlacement?: "ins
|
|
|
20
20
|
key: string;
|
|
21
21
|
type: "collection";
|
|
22
22
|
label: string;
|
|
23
|
-
editorPlacement: "
|
|
23
|
+
editorPlacement: "inspector" | "toolbar";
|
|
24
24
|
itemKeyField: string;
|
|
25
25
|
itemLabelField: string;
|
|
26
26
|
defaultItem: {
|
|
@@ -68,7 +68,7 @@ export declare const PHI_CHOICE_CONTROL_OPTION_FIELDS: ({
|
|
|
68
68
|
key: string;
|
|
69
69
|
type: "collection";
|
|
70
70
|
label: string;
|
|
71
|
-
editorPlacement: "
|
|
71
|
+
editorPlacement: "inspector" | "toolbar";
|
|
72
72
|
itemKeyField: string;
|
|
73
73
|
itemLabelField: string;
|
|
74
74
|
defaultItem: {
|
|
@@ -5,5 +5,5 @@ import { PhiTypographyControl } from "../controls/phi-typography-control";
|
|
|
5
5
|
/** The label column every Inspector row shares, so a control that draws its own header lines up with the rest. */
|
|
6
6
|
export const PHI_INSPECTOR_FIELD_LABEL_WIDTH = 140;
|
|
7
7
|
export function PhiInspectorFieldRow({ label, children, labelWidth = PHI_INSPECTOR_FIELD_LABEL_WIDTH, }) {
|
|
8
|
-
return (_jsxs(PhiFlexControl, { align: "flex-start", gap: 12, wrap: false, style: { width: "100%" }, children: [_jsx(PhiTypographyControl, { style: { flex: `0 0 ${labelWidth}px`, minWidth: 0, overflow: "hidden", textOverflow: "ellipsis", whiteSpace: "nowrap", lineHeight: "var(--
|
|
8
|
+
return (_jsxs(PhiFlexControl, { align: "flex-start", gap: 12, wrap: false, style: { width: "100%" }, children: [_jsx(PhiTypographyControl, { style: { flex: `0 0 ${labelWidth}px`, minWidth: 0, overflow: "hidden", textOverflow: "ellipsis", whiteSpace: "nowrap", lineHeight: "var(--phi-control-height)" }, children: label }), _jsx("div", { style: { flex: "1 1 auto", minWidth: 0 }, children: children })] }));
|
|
9
9
|
}
|
|
@@ -14,6 +14,9 @@ const PHI_GALLERY_WIDGET_LABEL_SET = definePhiLabelSet({
|
|
|
14
14
|
region: PHI_GALLERY_WIDGET_DEFAULT_LABELS.region,
|
|
15
15
|
pages: definePhiMessageLabel(PHI_GALLERY_WIDGET_DEFAULT_LABELS.pages),
|
|
16
16
|
unavailable: definePhiMessageLabel(PHI_GALLERY_WIDGET_DEFAULT_LABELS.unavailable),
|
|
17
|
+
canvas_folder: definePhiMessageLabel(PHI_GALLERY_WIDGET_DEFAULT_LABELS.canvasFolder),
|
|
18
|
+
canvas_no_folder: definePhiMessageLabel(PHI_GALLERY_WIDGET_DEFAULT_LABELS.canvasNoFolder),
|
|
19
|
+
canvas_record_field: definePhiMessageLabel(PHI_GALLERY_WIDGET_DEFAULT_LABELS.canvasRecordField),
|
|
17
20
|
},
|
|
18
21
|
});
|
|
19
22
|
export async function getPhiGalleryWidgetLabels(options) {
|
|
@@ -27,5 +30,8 @@ export async function getPhiGalleryWidgetLabels(options) {
|
|
|
27
30
|
region: labels.region,
|
|
28
31
|
pages: labels.pages,
|
|
29
32
|
unavailable: labels.unavailable,
|
|
33
|
+
canvasFolder: labels.canvas_folder,
|
|
34
|
+
canvasNoFolder: labels.canvas_no_folder,
|
|
35
|
+
canvasRecordField: labels.canvas_record_field,
|
|
30
36
|
};
|
|
31
37
|
}
|
|
@@ -69,6 +69,7 @@ const PHI_INSPECTOR_WIDGET_LABEL_SET = definePhiLabelSet({
|
|
|
69
69
|
field_select_table_resource: PHI_INSPECTOR_WIDGET_DEFAULT_LABELS.fields.selectTableResource,
|
|
70
70
|
field_select_calendar: PHI_INSPECTOR_WIDGET_DEFAULT_LABELS.fields.selectCalendar,
|
|
71
71
|
field_select_video_provider: PHI_INSPECTOR_WIDGET_DEFAULT_LABELS.fields.selectVideoProvider,
|
|
72
|
+
field_select_record_field: PHI_INSPECTOR_WIDGET_DEFAULT_LABELS.fields.selectRecordField,
|
|
72
73
|
link_none: PHI_INSPECTOR_WIDGET_DEFAULT_LABELS.fields.linkTarget.none,
|
|
73
74
|
link_page: PHI_INSPECTOR_WIDGET_DEFAULT_LABELS.fields.linkTarget.page,
|
|
74
75
|
link_external: PHI_INSPECTOR_WIDGET_DEFAULT_LABELS.fields.linkTarget.external,
|
|
@@ -158,6 +159,7 @@ export async function getPhiInspectorWidgetLabels(options) {
|
|
|
158
159
|
selectTableResource: labels.field_select_table_resource,
|
|
159
160
|
selectCalendar: labels.field_select_calendar,
|
|
160
161
|
selectVideoProvider: labels.field_select_video_provider,
|
|
162
|
+
selectRecordField: labels.field_select_record_field,
|
|
161
163
|
linkTarget: {
|
|
162
164
|
none: labels.link_none,
|
|
163
165
|
page: labels.link_page,
|
|
@@ -0,0 +1,4 @@
|
|
|
1
|
+
import "server-only";
|
|
2
|
+
import { type PhiGlobalTranslatorOptions } from "../../../gateway/tr";
|
|
3
|
+
import { type PhiIntervalLabels } from "../label-types/interval";
|
|
4
|
+
export declare function getPhiIntervalLabels(options: PhiGlobalTranslatorOptions): Promise<PhiIntervalLabels>;
|
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
import "server-only";
|
|
2
|
+
import { PHI_TR_CTX_WEB_UI_LABEL } from "../../../gateway/tr";
|
|
3
|
+
import { definePhiLabelSet, getPhiLabelSet } from "../../../gateway/label-set";
|
|
4
|
+
import { PHI_INTERVAL_DEFAULT_LABELS } from "../label-types/interval";
|
|
5
|
+
/**
|
|
6
|
+
* The words of the `interval` value renderer. One set, not one per Widget, so that a Table and a record
|
|
7
|
+
* of the same rows say "every 3 months" the same way and a translator says it once.
|
|
8
|
+
*/
|
|
9
|
+
const PHI_INTERVAL_LABEL_SET = definePhiLabelSet({
|
|
10
|
+
key: "value:interval",
|
|
11
|
+
ctx: PHI_TR_CTX_WEB_UI_LABEL,
|
|
12
|
+
labels: {
|
|
13
|
+
day_one: PHI_INTERVAL_DEFAULT_LABELS.day.one,
|
|
14
|
+
day_many: PHI_INTERVAL_DEFAULT_LABELS.day.many,
|
|
15
|
+
week_one: PHI_INTERVAL_DEFAULT_LABELS.week.one,
|
|
16
|
+
week_many: PHI_INTERVAL_DEFAULT_LABELS.week.many,
|
|
17
|
+
month_one: PHI_INTERVAL_DEFAULT_LABELS.month.one,
|
|
18
|
+
month_many: PHI_INTERVAL_DEFAULT_LABELS.month.many,
|
|
19
|
+
year_one: PHI_INTERVAL_DEFAULT_LABELS.year.one,
|
|
20
|
+
year_many: PHI_INTERVAL_DEFAULT_LABELS.year.many,
|
|
21
|
+
},
|
|
22
|
+
});
|
|
23
|
+
export async function getPhiIntervalLabels(options) {
|
|
24
|
+
const labels = await getPhiLabelSet(options, PHI_INTERVAL_LABEL_SET);
|
|
25
|
+
return {
|
|
26
|
+
day: { one: labels.day_one, many: labels.day_many },
|
|
27
|
+
week: { one: labels.week_one, many: labels.week_many },
|
|
28
|
+
month: { one: labels.month_one, many: labels.month_many },
|
|
29
|
+
year: { one: labels.year_one, many: labels.year_many },
|
|
30
|
+
};
|
|
31
|
+
}
|
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
import "server-only";
|
|
2
2
|
import { PHI_TR_CTX_WEB_UI_LABEL } from "../../../gateway/tr";
|
|
3
3
|
import { definePhiLabelSet, definePhiMessageLabel, getPhiLabelSet } from "../../../gateway/label-set";
|
|
4
|
+
import { getPhiIntervalLabels } from "./interval";
|
|
4
5
|
const PHI_RECORD_WIDGET_LABEL_SET = definePhiLabelSet({
|
|
5
6
|
key: "widget:record",
|
|
6
7
|
ctx: PHI_TR_CTX_WEB_UI_LABEL,
|
|
@@ -13,11 +14,15 @@ const PHI_RECORD_WIDGET_LABEL_SET = definePhiLabelSet({
|
|
|
13
14
|
},
|
|
14
15
|
});
|
|
15
16
|
export async function getPhiRecordWidgetLabels(options) {
|
|
16
|
-
const labels = await
|
|
17
|
+
const [labels, interval] = await Promise.all([
|
|
18
|
+
getPhiLabelSet(options, PHI_RECORD_WIDGET_LABEL_SET),
|
|
19
|
+
getPhiIntervalLabels(options),
|
|
20
|
+
]);
|
|
17
21
|
return {
|
|
18
22
|
empty: labels.empty,
|
|
19
23
|
missingBinding: labels.missing_binding,
|
|
20
24
|
recordReadUnsupported: labels.record_read_unsupported,
|
|
21
25
|
loadFailed: labels.load_failed,
|
|
26
|
+
interval,
|
|
22
27
|
};
|
|
23
28
|
}
|
|
@@ -0,0 +1,4 @@
|
|
|
1
|
+
import "server-only";
|
|
2
|
+
import { type PhiGlobalTranslatorOptions } from "../../../gateway/tr";
|
|
3
|
+
import { type PhiSlotUploadWidgetLabels } from "../label-types/slot-upload";
|
|
4
|
+
export declare function getPhiSlotUploadWidgetLabels(options: PhiGlobalTranslatorOptions): Promise<PhiSlotUploadWidgetLabels>;
|
|
@@ -0,0 +1,36 @@
|
|
|
1
|
+
import "server-only";
|
|
2
|
+
import { definePhiLabelSet, definePhiMessageLabel, getPhiLabelSet } from "../../../gateway/label-set";
|
|
3
|
+
import { PHI_TR_CTX_WEB_UI_LABEL } from "../../../gateway/tr";
|
|
4
|
+
import { PHI_SLOT_UPLOAD_WIDGET_DEFAULT_LABELS, } from "../label-types/slot-upload";
|
|
5
|
+
const DEFAULTS = PHI_SLOT_UPLOAD_WIDGET_DEFAULT_LABELS;
|
|
6
|
+
const PHI_SLOT_UPLOAD_WIDGET_LABEL_SET = definePhiLabelSet({
|
|
7
|
+
key: "widget:slot-upload",
|
|
8
|
+
ctx: PHI_TR_CTX_WEB_UI_LABEL,
|
|
9
|
+
labels: {
|
|
10
|
+
choose: DEFAULTS.choose,
|
|
11
|
+
remove: DEFAULTS.remove,
|
|
12
|
+
unconfigured: definePhiMessageLabel(DEFAULTS.unconfigured),
|
|
13
|
+
no_row: definePhiMessageLabel(DEFAULTS.noRow),
|
|
14
|
+
empty: definePhiMessageLabel(DEFAULTS.empty),
|
|
15
|
+
file_title: definePhiMessageLabel(DEFAULTS.fileTitle),
|
|
16
|
+
slot_missing: definePhiMessageLabel(DEFAULTS.slotMissing),
|
|
17
|
+
server_answered: definePhiMessageLabel(DEFAULTS.serverAnswered),
|
|
18
|
+
unreachable: definePhiMessageLabel(DEFAULTS.unreachable),
|
|
19
|
+
remove_failed: definePhiMessageLabel(DEFAULTS.removeFailed),
|
|
20
|
+
},
|
|
21
|
+
});
|
|
22
|
+
export async function getPhiSlotUploadWidgetLabels(options) {
|
|
23
|
+
const labels = await getPhiLabelSet(options, PHI_SLOT_UPLOAD_WIDGET_LABEL_SET);
|
|
24
|
+
return {
|
|
25
|
+
unconfigured: labels.unconfigured,
|
|
26
|
+
noRow: labels.no_row,
|
|
27
|
+
choose: labels.choose,
|
|
28
|
+
empty: labels.empty,
|
|
29
|
+
remove: labels.remove,
|
|
30
|
+
fileTitle: labels.file_title,
|
|
31
|
+
slotMissing: labels.slot_missing,
|
|
32
|
+
serverAnswered: labels.server_answered,
|
|
33
|
+
unreachable: labels.unreachable,
|
|
34
|
+
removeFailed: labels.remove_failed,
|
|
35
|
+
};
|
|
36
|
+
}
|
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
import "server-only";
|
|
2
2
|
import { PHI_TR_CTX_WEB_UI_LABEL } from "../../../gateway/tr";
|
|
3
3
|
import { definePhiLabelSet, definePhiMessageLabel, getPhiLabelSet } from "../../../gateway/label-set";
|
|
4
|
+
import { getPhiIntervalLabels } from "./interval";
|
|
4
5
|
const PHI_TABLE_WIDGET_LABEL_SET = definePhiLabelSet({
|
|
5
6
|
key: "widget:table",
|
|
6
7
|
ctx: PHI_TR_CTX_WEB_UI_LABEL,
|
|
@@ -27,7 +28,10 @@ const PHI_TABLE_WIDGET_LABEL_SET = definePhiLabelSet({
|
|
|
27
28
|
},
|
|
28
29
|
});
|
|
29
30
|
export async function getPhiTableWidgetLabels(options) {
|
|
30
|
-
const labels = await
|
|
31
|
+
const [labels, interval] = await Promise.all([
|
|
32
|
+
getPhiLabelSet(options, PHI_TABLE_WIDGET_LABEL_SET),
|
|
33
|
+
getPhiIntervalLabels(options),
|
|
34
|
+
]);
|
|
31
35
|
return {
|
|
32
36
|
search: labels.search,
|
|
33
37
|
reset: labels.reset,
|
|
@@ -47,5 +51,6 @@ export async function getPhiTableWidgetLabels(options) {
|
|
|
47
51
|
dragRow: labels.drag_row,
|
|
48
52
|
moveRowUp: labels.move_row_up,
|
|
49
53
|
moveRowDown: labels.move_row_down,
|
|
54
|
+
interval,
|
|
50
55
|
};
|
|
51
56
|
}
|
|
@@ -1,5 +1,12 @@
|
|
|
1
1
|
import type { PhiSequenceControlLabels } from "./sequence";
|
|
2
2
|
export type PhiGalleryWidgetLabels = PhiSequenceControlLabels & {
|
|
3
3
|
unavailable: string;
|
|
4
|
+
/** The Builder canvas's hint under a Gallery whose Folder is chosen. */
|
|
5
|
+
canvasFolder: string;
|
|
6
|
+
/** The Builder canvas's hint under a Gallery whose Folder is not chosen yet. */
|
|
7
|
+
canvasNoFolder: string;
|
|
8
|
+
/** The Builder canvas's hint under a Gallery bound to a field of the page record, `%1` the field. */
|
|
9
|
+
canvasRecordField: string;
|
|
4
10
|
};
|
|
5
11
|
export declare const PHI_GALLERY_WIDGET_DEFAULT_LABELS: PhiGalleryWidgetLabels;
|
|
12
|
+
export declare function formatPhiGalleryWidgetLabel(template: string, value: string): string;
|