@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
|
@@ -7,4 +7,10 @@ export const PHI_GALLERY_WIDGET_DEFAULT_LABELS = {
|
|
|
7
7
|
region: "Pictures",
|
|
8
8
|
pages: "Choose pictures",
|
|
9
9
|
unavailable: "The pictures could not be read.",
|
|
10
|
+
canvasFolder: "The public pictures of the chosen media folder, read when the page is drawn.",
|
|
11
|
+
canvasNoFolder: "No folder chosen yet. Pick one in the inspector; its public pictures are read when the page is drawn.",
|
|
12
|
+
canvasRecordField: 'The pictures of the page record\'s field "%1", read when the page is drawn.',
|
|
10
13
|
};
|
|
14
|
+
export function formatPhiGalleryWidgetLabel(template, value) {
|
|
15
|
+
return template.replace("%1", value);
|
|
16
|
+
}
|
|
@@ -103,6 +103,7 @@ export type PhiInspectorFieldLabels = {
|
|
|
103
103
|
selectTableResource: string;
|
|
104
104
|
selectCalendar: string;
|
|
105
105
|
selectVideoProvider: string;
|
|
106
|
+
selectRecordField: string;
|
|
106
107
|
linkTarget: PhiInspectorLinkTargetLabels;
|
|
107
108
|
};
|
|
108
109
|
export declare const PHI_INSPECTOR_WIDGET_DEFAULT_LABELS: PhiInspectorWidgetLabels;
|
|
@@ -72,6 +72,7 @@ export const PHI_INSPECTOR_WIDGET_DEFAULT_LABELS = {
|
|
|
72
72
|
selectTableResource: "Select a Table resource",
|
|
73
73
|
selectCalendar: "Select a calendar",
|
|
74
74
|
selectVideoProvider: "Select a video provider",
|
|
75
|
+
selectRecordField: "Select a field of the page's record",
|
|
75
76
|
linkTarget: {
|
|
76
77
|
none: "None",
|
|
77
78
|
page: "Page",
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
import type { PhiIntervalUnit, PhiIntervalValue } from "../../../types/table-widget";
|
|
2
|
+
/**
|
|
3
|
+
* How Core says a period, per unit: for one of it ("per month") and for several, with `%1` for the
|
|
4
|
+
* count ("every %1 months"). Words from a Label Set rather than `Intl`'s unit names, because `Intl`
|
|
5
|
+
* says "3 months" -- a length -- where a price needs "every 3 months", and a translator can reach a
|
|
6
|
+
* Label Set where nobody can reach `Intl`.
|
|
7
|
+
*/
|
|
8
|
+
export type PhiIntervalLabels = Readonly<Record<PhiIntervalUnit, {
|
|
9
|
+
one: string;
|
|
10
|
+
many: string;
|
|
11
|
+
}>>;
|
|
12
|
+
export declare const PHI_INTERVAL_DEFAULT_LABELS: PhiIntervalLabels;
|
|
13
|
+
/** `value` as a period, or `null` where it is not one: a known unit and a whole count of one or more. */
|
|
14
|
+
export declare function readPhiIntervalValue(value: unknown): PhiIntervalValue | null;
|
|
15
|
+
/** A period in Core's words: `{ unit: "month", count: 1 }` is "per month", `count: 3` "every 3 months". */
|
|
16
|
+
export declare function formatPhiInterval(value: PhiIntervalValue, labels: PhiIntervalLabels): string;
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
export const PHI_INTERVAL_DEFAULT_LABELS = {
|
|
2
|
+
day: { one: "per day", many: "every %1 days" },
|
|
3
|
+
week: { one: "per week", many: "every %1 weeks" },
|
|
4
|
+
month: { one: "per month", many: "every %1 months" },
|
|
5
|
+
year: { one: "per year", many: "every %1 years" },
|
|
6
|
+
};
|
|
7
|
+
const PHI_INTERVAL_UNITS = ["day", "week", "month", "year"];
|
|
8
|
+
/** `value` as a period, or `null` where it is not one: a known unit and a whole count of one or more. */
|
|
9
|
+
export function readPhiIntervalValue(value) {
|
|
10
|
+
if (typeof value !== "object" || value === null || Array.isArray(value))
|
|
11
|
+
return null;
|
|
12
|
+
const { unit, count } = value;
|
|
13
|
+
return typeof unit === "string" && PHI_INTERVAL_UNITS.includes(unit) && Number.isSafeInteger(count) && count >= 1
|
|
14
|
+
? { unit: unit, count: count }
|
|
15
|
+
: null;
|
|
16
|
+
}
|
|
17
|
+
/** A period in Core's words: `{ unit: "month", count: 1 }` is "per month", `count: 3` "every 3 months". */
|
|
18
|
+
export function formatPhiInterval(value, labels) {
|
|
19
|
+
const words = labels[value.unit];
|
|
20
|
+
return value.count === 1 ? words.one : words.many.replace("%1", String(value.count));
|
|
21
|
+
}
|
|
@@ -1,8 +1,11 @@
|
|
|
1
|
+
import { type PhiIntervalLabels } from "./interval";
|
|
1
2
|
export type PhiRecordWidgetLabels = {
|
|
2
3
|
empty: string;
|
|
3
4
|
missingBinding: string;
|
|
4
5
|
recordReadUnsupported: string;
|
|
5
6
|
loadFailed: string;
|
|
7
|
+
/** The words of the `interval` renderer, from their own Label Set. */
|
|
8
|
+
interval: PhiIntervalLabels;
|
|
6
9
|
};
|
|
7
10
|
export declare const PHI_RECORD_WIDGET_DEFAULT_LABELS: PhiRecordWidgetLabels;
|
|
8
11
|
export declare function formatPhiRecordWidgetLabel(template: string, value: string | number): string;
|
|
@@ -1,8 +1,10 @@
|
|
|
1
|
+
import { PHI_INTERVAL_DEFAULT_LABELS } from "./interval";
|
|
1
2
|
export const PHI_RECORD_WIDGET_DEFAULT_LABELS = {
|
|
2
3
|
empty: "Open a row to read it here.",
|
|
3
4
|
missingBinding: "Record provider binding is missing.",
|
|
4
5
|
recordReadUnsupported: 'Table resource "%1" does not offer single records.',
|
|
5
6
|
loadFailed: "The record could not be loaded.",
|
|
7
|
+
interval: PHI_INTERVAL_DEFAULT_LABELS,
|
|
6
8
|
};
|
|
7
9
|
export function formatPhiRecordWidgetLabel(template, value) {
|
|
8
10
|
return template.replace("%1", String(value));
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* What the slot upload field says. The refusals of the upload it runs are not here: they are the shared
|
|
3
|
+
* reading of `PHI_MEDIA_UPLOAD_DEFAULT_LABELS`, the same as on every other Media upload surface.
|
|
4
|
+
*/
|
|
5
|
+
export type PhiSlotUploadWidgetLabels = {
|
|
6
|
+
/** The field names no Add-on, table or slot, so there is nowhere to put a file. */
|
|
7
|
+
unconfigured: string;
|
|
8
|
+
/** No row has arrived yet, so there is nothing to upload to. */
|
|
9
|
+
noRow: string;
|
|
10
|
+
choose: string;
|
|
11
|
+
empty: string;
|
|
12
|
+
remove: string;
|
|
13
|
+
/** A file of the slot, `%1` its content type and `%2` its size in bytes. */
|
|
14
|
+
fileTitle: string;
|
|
15
|
+
/** `%1` is the slot name the field was configured with. */
|
|
16
|
+
slotMissing: string;
|
|
17
|
+
/** `%1` is the HTTP status the server answered with. */
|
|
18
|
+
serverAnswered: string;
|
|
19
|
+
unreachable: string;
|
|
20
|
+
removeFailed: string;
|
|
21
|
+
};
|
|
22
|
+
export declare const PHI_SLOT_UPLOAD_WIDGET_DEFAULT_LABELS: PhiSlotUploadWidgetLabels;
|
|
23
|
+
/** Fills `%1`, `%2`, ... of a slot upload template in order. */
|
|
24
|
+
export declare function formatPhiSlotUploadWidgetLabel(template: string, ...values: readonly (string | number)[]): string;
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
export const PHI_SLOT_UPLOAD_WIDGET_DEFAULT_LABELS = {
|
|
2
|
+
unconfigured: "This field names no Add-on, table or slot.",
|
|
3
|
+
noRow: "Nothing selected.",
|
|
4
|
+
choose: "Choose a file",
|
|
5
|
+
empty: "Nothing here yet.",
|
|
6
|
+
remove: "Remove this file",
|
|
7
|
+
fileTitle: "%1 — %2 bytes",
|
|
8
|
+
slotMissing: 'This table declares no slot named "%1".',
|
|
9
|
+
serverAnswered: "The server answered %1.",
|
|
10
|
+
unreachable: "Unreachable.",
|
|
11
|
+
removeFailed: "That file stayed.",
|
|
12
|
+
};
|
|
13
|
+
/** Fills `%1`, `%2`, ... of a slot upload template in order. */
|
|
14
|
+
export function formatPhiSlotUploadWidgetLabel(template, ...values) {
|
|
15
|
+
return values.reduce((text, value, index) => text.replace(`%${index + 1}`, String(value)), template);
|
|
16
|
+
}
|
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import { type PhiIntervalLabels } from "./interval";
|
|
1
2
|
export type PhiTableWidgetLabels = {
|
|
2
3
|
search: string;
|
|
3
4
|
reset: string;
|
|
@@ -17,6 +18,8 @@ export type PhiTableWidgetLabels = {
|
|
|
17
18
|
dragRow: string;
|
|
18
19
|
moveRowUp: string;
|
|
19
20
|
moveRowDown: string;
|
|
21
|
+
/** The words of the `interval` renderer, from their own Label Set. */
|
|
22
|
+
interval: PhiIntervalLabels;
|
|
20
23
|
};
|
|
21
24
|
export declare const PHI_TABLE_WIDGET_DEFAULT_LABELS: PhiTableWidgetLabels;
|
|
22
25
|
export declare function formatPhiTableWidgetLabel(template: string, value: string | number): string;
|
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import { PHI_INTERVAL_DEFAULT_LABELS } from "./interval";
|
|
1
2
|
export const PHI_TABLE_WIDGET_DEFAULT_LABELS = {
|
|
2
3
|
search: "Search",
|
|
3
4
|
reset: "Reset",
|
|
@@ -17,6 +18,7 @@ export const PHI_TABLE_WIDGET_DEFAULT_LABELS = {
|
|
|
17
18
|
dragRow: "Drag row",
|
|
18
19
|
moveRowUp: "Move row up",
|
|
19
20
|
moveRowDown: "Move row down",
|
|
21
|
+
interval: PHI_INTERVAL_DEFAULT_LABELS,
|
|
20
22
|
};
|
|
21
23
|
export function formatPhiTableWidgetLabel(template, value) {
|
|
22
24
|
return template.replace("%1", String(value));
|
|
@@ -24,7 +24,7 @@ import { PHI_THEME_HEADING_FONT_VARIABLE } from "../../../theme/phi-theme-typogr
|
|
|
24
24
|
import { PHI_CARD_IMAGE_SIZES, PHI_CARD_TEXT_SLOTS, readPhiCardBillingPeriod } from "./card-vocabulary";
|
|
25
25
|
/**
|
|
26
26
|
* The layer over a card's picture. A colour or a gradient is drawn as CSS, each colour mixed down to the
|
|
27
|
-
* Overlay's opacity, so a Theme variable (`var(--
|
|
27
|
+
* Overlay's opacity, so a Theme variable (`var(--phi-color-bg-container)`) resolves and the picture fades
|
|
28
28
|
* into the card's own ground in either mode; a Background draws the same Overlay into an SVG picture,
|
|
29
29
|
* where no variable reaches. A pattern or noise is drawn as a Background draws it.
|
|
30
30
|
*/
|
|
@@ -4,7 +4,7 @@ import { PhiButtonControl } from "../../controls/phi-button-control";
|
|
|
4
4
|
import { PhiResultControl } from "../../controls/phi-result-control";
|
|
5
5
|
export function PhiResultWidgetBody({ config, code, title, subTitle, homeHref, homeLinkLabel, }) {
|
|
6
6
|
const renderedTitle = code && title && code !== title
|
|
7
|
-
? (_jsxs("span", { style: { display: "inline-flex", flexDirection: "column", gap: "var(--
|
|
7
|
+
? (_jsxs("span", { style: { display: "inline-flex", flexDirection: "column", gap: "var(--phi-padding-xxs)" }, children: [_jsx("span", { children: code }), _jsx("span", { style: { fontSize: "var(--phi-font-size-lg)", fontWeight: 400 }, children: title })] }))
|
|
8
8
|
: (title || code || "Information");
|
|
9
9
|
return (_jsx(PhiResultControl, { status: config?.status ?? "info", title: renderedTitle, subTitle: subTitle, extra: config?.homeLink
|
|
10
10
|
? _jsx(PhiButtonControl, { href: homeHref, label: homeLinkLabel, type: "primary" })
|
|
@@ -19,9 +19,16 @@
|
|
|
19
19
|
export declare const PHI_MEDIA_LIBRARY_DATA_PROVIDER_KEYS: {
|
|
20
20
|
readonly collection: `${string}/${string}`;
|
|
21
21
|
readonly folders: `${string}/${string}`;
|
|
22
|
+
/**
|
|
23
|
+
* Every Folder of the Site Space as a choice, loaded by the choice itself. The Asset Module answers it,
|
|
24
|
+
* and the Builder reads it in any Area (`availableToAuthoringChrome`); the folder pictures Provider
|
|
25
|
+
* names it for its Folder setting.
|
|
26
|
+
*/
|
|
27
|
+
readonly folderChoices: `${string}/${string}`;
|
|
22
28
|
/**
|
|
23
29
|
* The public pictures of one Folder, read on the server while the page is drawn (a `record`
|
|
24
|
-
* Provider).
|
|
30
|
+
* Provider). Served by Core, not by the Asset Module: showing what is public needs no Media
|
|
31
|
+
* management in the Area, as an Image Widget does not. The Gallery Widget starts bound to it.
|
|
25
32
|
*/
|
|
26
33
|
readonly folderImages: `${string}/${string}`;
|
|
27
34
|
};
|
|
@@ -20,9 +20,16 @@ import { createPhiSharedRuntimeDataProviderKey, createPhiSharedRuntimeItemRender
|
|
|
20
20
|
export const PHI_MEDIA_LIBRARY_DATA_PROVIDER_KEYS = {
|
|
21
21
|
collection: createPhiSharedRuntimeDataProviderKey("collections", "media"),
|
|
22
22
|
folders: createPhiSharedRuntimeDataProviderKey("options", "media-folders"),
|
|
23
|
+
/**
|
|
24
|
+
* Every Folder of the Site Space as a choice, loaded by the choice itself. The Asset Module answers it,
|
|
25
|
+
* and the Builder reads it in any Area (`availableToAuthoringChrome`); the folder pictures Provider
|
|
26
|
+
* names it for its Folder setting.
|
|
27
|
+
*/
|
|
28
|
+
folderChoices: createPhiSharedRuntimeDataProviderKey("options", "media-folder-choices"),
|
|
23
29
|
/**
|
|
24
30
|
* The public pictures of one Folder, read on the server while the page is drawn (a `record`
|
|
25
|
-
* Provider).
|
|
31
|
+
* Provider). Served by Core, not by the Asset Module: showing what is public needs no Media
|
|
32
|
+
* management in the Area, as an Image Widget does not. The Gallery Widget starts bound to it.
|
|
26
33
|
*/
|
|
27
34
|
folderImages: createPhiSharedRuntimeDataProviderKey("records", "media-folder-images"),
|
|
28
35
|
};
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* The kinds a field of a record can be. Closed: a Widget says which of them it draws, and the Builder offers
|
|
3
|
+
* only those. Here rather than beside the record types, so that reading the list at runtime does not load them.
|
|
4
|
+
*/
|
|
5
|
+
export declare const PHI_RECORD_FIELD_KINDS: readonly ["text", "markdown", "picture", "pictures", "list", "tag", "date", "number", "money", "link"];
|
|
6
|
+
export type PhiRecordFieldKind = (typeof PHI_RECORD_FIELD_KINDS)[number];
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* The kinds a field of a record can be. Closed: a Widget says which of them it draws, and the Builder offers
|
|
3
|
+
* only those. Here rather than beside the record types, so that reading the list at runtime does not load them.
|
|
4
|
+
*/
|
|
5
|
+
export const PHI_RECORD_FIELD_KINDS = [
|
|
6
|
+
"text", "markdown", "picture", "pictures", "list", "tag", "date", "number", "money", "link",
|
|
7
|
+
];
|
|
@@ -47,6 +47,7 @@ const PHI_RUNTIME_MODULE_OWNERSHIP = {
|
|
|
47
47
|
"form-field/email": ["core", "email"],
|
|
48
48
|
"form-field/hidden": ["core", "hidden"],
|
|
49
49
|
"form-field/honeypot": ["core", "honeypot"],
|
|
50
|
+
"form-field/money": ["core", "money"],
|
|
50
51
|
"form-field/multi-select": ["core", "multi-select"],
|
|
51
52
|
"form-field/number": ["core", "number"],
|
|
52
53
|
"form-field/password": ["core", "password"],
|
|
@@ -244,7 +245,7 @@ const PHI_RUNTIME_MODULE_OWNERSHIP = {
|
|
|
244
245
|
// One published entry with its relatives, read on the server (`types/record-provider.ts`).
|
|
245
246
|
"records/content-entry": ["core", "content-entry"],
|
|
246
247
|
// The public pictures of a Media Folder, for a Gallery that shows a Folder.
|
|
247
|
-
"records/media-folder-images": ["
|
|
248
|
+
"records/media-folder-images": ["core", "media-folder-images"],
|
|
248
249
|
"signals/tour-availability": ["tour", "availability"],
|
|
249
250
|
"signals/tour-progress": ["tour", "progress"],
|
|
250
251
|
"signals/tree-action": ["core", "tree-action"],
|
package/controls.d.ts
CHANGED
|
@@ -4,6 +4,13 @@ export type { PhiTextControlPresentation, PhiTextControlProps, } from "./compone
|
|
|
4
4
|
export type { PhiTextInputType } from "./components/controls/phi-text-types";
|
|
5
5
|
export { PHI_CONTROL_SIZES, PHI_FEEDBACK_LEVELS, readPhiControlSize, } from "./types/control";
|
|
6
6
|
export type { PhiControlPresentationConfig, PhiControlSize, PhiFeedbackLevel, } from "./types/control";
|
|
7
|
+
export { PhiCompactGroupControl } from "./components/controls/phi-compact-group-control";
|
|
8
|
+
export type { PhiCompactGroupControlProps } from "./components/controls/phi-compact-group-control";
|
|
9
|
+
export { PhiViewportVisibilityControl } from "./components/controls/phi-viewport-visibility-control";
|
|
10
|
+
export { PhiEntryListControl } from "./components/controls/phi-entry-list-control";
|
|
11
|
+
export type { PhiEntryListControlProps, PhiEntryListEntry } from "./components/controls/phi-entry-list-control";
|
|
12
|
+
export { PhiPlacementMatrixControl } from "./components/controls/phi-placement-matrix-control";
|
|
13
|
+
export type { PhiPlacementMatrixControlProps } from "./components/controls/phi-placement-matrix-control";
|
|
7
14
|
export { PhiNumberControl } from "./components/controls/phi-number-control";
|
|
8
15
|
export type { PhiNumberControlProps } from "./components/controls/phi-number-control";
|
|
9
16
|
export { PhiPopoverControl } from "./components/controls/phi-popover-control";
|
package/controls.js
CHANGED
|
@@ -1,6 +1,10 @@
|
|
|
1
1
|
export { PhiTextControl } from "./components/controls/phi-text-control";
|
|
2
2
|
export { PhiLabeledControl } from "./components/controls/phi-labeled-control";
|
|
3
3
|
export { PHI_CONTROL_SIZES, PHI_FEEDBACK_LEVELS, readPhiControlSize, } from "./types/control";
|
|
4
|
+
export { PhiCompactGroupControl } from "./components/controls/phi-compact-group-control";
|
|
5
|
+
export { PhiViewportVisibilityControl } from "./components/controls/phi-viewport-visibility-control";
|
|
6
|
+
export { PhiEntryListControl } from "./components/controls/phi-entry-list-control";
|
|
7
|
+
export { PhiPlacementMatrixControl } from "./components/controls/phi-placement-matrix-control";
|
|
4
8
|
export { PhiNumberControl } from "./components/controls/phi-number-control";
|
|
5
9
|
export { PhiPopoverControl } from "./components/controls/phi-popover-control";
|
|
6
10
|
export { PHI_PICKER_PLACEMENTS } from "./components/controls/phi-picker-control-contract";
|
|
@@ -13,9 +13,9 @@ type PhiBorderWidgetStyleFallback = {
|
|
|
13
13
|
* has to add this to the sum, and a `1px` typed into that calculation is the same second answer as one
|
|
14
14
|
* typed into a border.
|
|
15
15
|
*/
|
|
16
|
-
export declare const PHI_THEME_BORDER_WIDTH = "var(--
|
|
16
|
+
export declare const PHI_THEME_BORDER_WIDTH = "var(--phi-line-width, 1px)";
|
|
17
17
|
/** The Site's own line: its border colour at its line width. One string, so nobody types a second. */
|
|
18
|
-
export declare const PHI_THEME_BORDER_LINE = "var(--
|
|
18
|
+
export declare const PHI_THEME_BORDER_LINE = "var(--phi-line-width, 1px) solid var(--phi-color-border)";
|
|
19
19
|
/**
|
|
20
20
|
* The same line at a colour the caller names.
|
|
21
21
|
*
|
|
@@ -5,9 +5,9 @@
|
|
|
5
5
|
* has to add this to the sum, and a `1px` typed into that calculation is the same second answer as one
|
|
6
6
|
* typed into a border.
|
|
7
7
|
*/
|
|
8
|
-
export const PHI_THEME_BORDER_WIDTH = "var(--
|
|
8
|
+
export const PHI_THEME_BORDER_WIDTH = "var(--phi-line-width, 1px)";
|
|
9
9
|
/** The Site's own line: its border colour at its line width. One string, so nobody types a second. */
|
|
10
|
-
export const PHI_THEME_BORDER_LINE = `${PHI_THEME_BORDER_WIDTH} solid var(--
|
|
10
|
+
export const PHI_THEME_BORDER_LINE = `${PHI_THEME_BORDER_WIDTH} solid var(--phi-color-border)`;
|
|
11
11
|
/**
|
|
12
12
|
* The same line at a colour the caller names.
|
|
13
13
|
*
|
package/helpers/cms-dialog.d.ts
CHANGED
|
@@ -1,13 +1,14 @@
|
|
|
1
|
+
import { type PhiFormDescriptor } from "@phis/contracts/forms";
|
|
1
2
|
/** The body Layout's config: a vertical Flex with the `panel` creation preset under it. */
|
|
2
3
|
export declare const PHI_DIALOG_BODY_CONFIG: {
|
|
3
|
-
readonly gap: "var(--
|
|
4
|
+
readonly gap: "var(--phi-padding-sm)";
|
|
4
5
|
readonly margin: 0;
|
|
5
|
-
readonly padding: "var(--
|
|
6
|
+
readonly padding: "var(--phi-padding)";
|
|
6
7
|
readonly surface: {
|
|
7
8
|
readonly background: {
|
|
8
9
|
readonly base: {
|
|
9
10
|
readonly kind: "color";
|
|
10
|
-
readonly color: "var(--
|
|
11
|
+
readonly color: "var(--phi-color-fill-quaternary)";
|
|
11
12
|
};
|
|
12
13
|
readonly overlay: null;
|
|
13
14
|
readonly filter: null;
|
|
@@ -24,7 +25,7 @@ export declare const PHI_DIALOG_BLEED_BODY_CONFIG: {
|
|
|
24
25
|
readonly background: {
|
|
25
26
|
readonly base: {
|
|
26
27
|
readonly kind: "color";
|
|
27
|
-
readonly color: "var(--
|
|
28
|
+
readonly color: "var(--phi-color-fill-quaternary)";
|
|
28
29
|
};
|
|
29
30
|
readonly overlay: null;
|
|
30
31
|
readonly filter: null;
|
|
@@ -40,12 +41,47 @@ export declare const PHI_DIALOG_COMMANDS_CONFIG: {
|
|
|
40
41
|
readonly controlSize: "medium";
|
|
41
42
|
};
|
|
42
43
|
/**
|
|
43
|
-
* A dialog's width where it names none: the reading measure, which is also
|
|
44
|
-
* so a Form fills the dialog it opens in. A wider one -- a table, a preview
|
|
45
|
-
* width from the same sequence (`PHI_LAYOUT`).
|
|
44
|
+
* A dialog's width where it names none and its Form needs two columns: the reading measure, which is also
|
|
45
|
+
* where a Form's own cap lies, so a Form fills the dialog it opens in. A wider one -- a table, a preview
|
|
46
|
+
* -- says so, and takes its width from the same sequence (`PHI_LAYOUT`).
|
|
46
47
|
*/
|
|
47
48
|
export declare const PHI_DIALOG_WIDTH: {
|
|
48
49
|
readonly compact: "calc(100vw - 32px)";
|
|
49
50
|
readonly medium: 610;
|
|
50
51
|
readonly wide: 610;
|
|
51
52
|
};
|
|
53
|
+
/**
|
|
54
|
+
* A dialog's width where its Form stands in one column.
|
|
55
|
+
*
|
|
56
|
+
* The reading measure is the room two columns need; one column in it is a strip of labels and a run of
|
|
57
|
+
* inputs far longer than anything typed into them. The narrow width is not `contentMaxNarrow` itself,
|
|
58
|
+
* though: that is where a Form turns `medium` and puts its labels beside the fields
|
|
59
|
+
* (`PHI_FORM_RESPONSIVE_MIN_WIDTH.medium`, the same 377), and the Form stands inside the body's inset.
|
|
60
|
+
* So it is that measure plus the inset on both sides -- the Theme's `base` step, whatever it is set to.
|
|
61
|
+
*/
|
|
62
|
+
export declare const PHI_DIALOG_WIDTH_SINGLE_COLUMN: {
|
|
63
|
+
readonly compact: "calc(100vw - 32px)";
|
|
64
|
+
readonly medium: "calc(377px + 2 * var(--phi-padding))";
|
|
65
|
+
readonly wide: "calc(377px + 2 * var(--phi-padding))";
|
|
66
|
+
};
|
|
67
|
+
/**
|
|
68
|
+
* Whether a Form stands in one column wherever it can stand in two.
|
|
69
|
+
*
|
|
70
|
+
* Read off the descriptor at the two widths that put labels beside fields, `medium` and `wide`: a field
|
|
71
|
+
* whose label and control together leave part of the row free leaves room for a field beside it, and
|
|
72
|
+
* that is a Form of two columns -- whether a second field stands there or not, since the half was meant
|
|
73
|
+
* for one. A field takes the layout's label column into its extent even where it draws no label, as it
|
|
74
|
+
* does on the grid (`labelSlot` in `resolvePhiFormGridPlacement`), so a checkbox under the inputs is
|
|
75
|
+
* still a field of the one column. At `compact` every Form is one column, and it says nothing.
|
|
76
|
+
*/
|
|
77
|
+
export declare function isPhiFormSingleColumn(descriptor: PhiFormDescriptor): boolean;
|
|
78
|
+
/** The width a dialog takes for the Form in its body: `PHI_DIALOG_WIDTH_SINGLE_COLUMN` or `PHI_DIALOG_WIDTH`. */
|
|
79
|
+
export declare function resolvePhiDialogFormWidth(descriptor: PhiFormDescriptor): {
|
|
80
|
+
readonly compact: "calc(100vw - 32px)";
|
|
81
|
+
readonly medium: 610;
|
|
82
|
+
readonly wide: 610;
|
|
83
|
+
} | {
|
|
84
|
+
readonly compact: "calc(100vw - 32px)";
|
|
85
|
+
readonly medium: "calc(377px + 2 * var(--phi-padding))";
|
|
86
|
+
readonly wide: "calc(377px + 2 * var(--phi-padding))";
|
|
87
|
+
};
|
package/helpers/cms-dialog.js
CHANGED
|
@@ -1,3 +1,5 @@
|
|
|
1
|
+
import { PHI_FORM_GRID_LAST_LINE, resolvePhiFormLayout, } from "@phis/contracts/forms";
|
|
2
|
+
import { resolvePhiFormFieldExtent, resolvePhiFormFieldRanges } from "../components/forms/form-descriptor-contract";
|
|
1
3
|
import { PHI_SPACE } from "../theme/antd-css-var-contract";
|
|
2
4
|
import { PHI_SURFACE_WASH } from "./surface-presets";
|
|
3
5
|
import { PHI_LAYOUT } from "../theme/phi-tokens";
|
|
@@ -17,7 +19,9 @@ import { PHI_LAYOUT } from "../theme/phi-tokens";
|
|
|
17
19
|
* instead: the same ground, no inset, and its content draws no corner of its own either.
|
|
18
20
|
* - The actions are one compact group, labelled, at the medium size: a dialog asks one question and its
|
|
19
21
|
* answers belong together.
|
|
20
|
-
* - The width is the reading measure
|
|
22
|
+
* - The width is as wide as its Form needs: the reading measure for a Form of two columns, the narrowest
|
|
23
|
+
* width that keeps a Form's labels beside its fields for one of one column, full width less the gutter
|
|
24
|
+
* on a phone either way. A table or an editor states a wider one.
|
|
21
25
|
*/
|
|
22
26
|
/** The body Layout's config: a vertical Flex with the `panel` creation preset under it. */
|
|
23
27
|
export const PHI_DIALOG_BODY_CONFIG = {
|
|
@@ -39,12 +43,50 @@ export const PHI_DIALOG_COMMANDS_CONFIG = {
|
|
|
39
43
|
controlSize: "medium",
|
|
40
44
|
};
|
|
41
45
|
/**
|
|
42
|
-
* A dialog's width where it names none: the reading measure, which is also
|
|
43
|
-
* so a Form fills the dialog it opens in. A wider one -- a table, a preview
|
|
44
|
-
* width from the same sequence (`PHI_LAYOUT`).
|
|
46
|
+
* A dialog's width where it names none and its Form needs two columns: the reading measure, which is also
|
|
47
|
+
* where a Form's own cap lies, so a Form fills the dialog it opens in. A wider one -- a table, a preview
|
|
48
|
+
* -- says so, and takes its width from the same sequence (`PHI_LAYOUT`).
|
|
45
49
|
*/
|
|
46
50
|
export const PHI_DIALOG_WIDTH = {
|
|
47
51
|
compact: "calc(100vw - 32px)",
|
|
48
52
|
medium: PHI_LAYOUT.contentMax,
|
|
49
53
|
wide: PHI_LAYOUT.contentMax,
|
|
50
54
|
};
|
|
55
|
+
/**
|
|
56
|
+
* A dialog's width where its Form stands in one column.
|
|
57
|
+
*
|
|
58
|
+
* The reading measure is the room two columns need; one column in it is a strip of labels and a run of
|
|
59
|
+
* inputs far longer than anything typed into them. The narrow width is not `contentMaxNarrow` itself,
|
|
60
|
+
* though: that is where a Form turns `medium` and puts its labels beside the fields
|
|
61
|
+
* (`PHI_FORM_RESPONSIVE_MIN_WIDTH.medium`, the same 377), and the Form stands inside the body's inset.
|
|
62
|
+
* So it is that measure plus the inset on both sides -- the Theme's `base` step, whatever it is set to.
|
|
63
|
+
*/
|
|
64
|
+
export const PHI_DIALOG_WIDTH_SINGLE_COLUMN = {
|
|
65
|
+
compact: PHI_DIALOG_WIDTH.compact,
|
|
66
|
+
medium: `calc(${PHI_LAYOUT.contentMaxNarrow}px + 2 * ${PHI_DIALOG_BODY_CONFIG.padding})`,
|
|
67
|
+
wide: `calc(${PHI_LAYOUT.contentMaxNarrow}px + 2 * ${PHI_DIALOG_BODY_CONFIG.padding})`,
|
|
68
|
+
};
|
|
69
|
+
/** The widths at which a Form's labels stand beside its fields, and so the ones that have columns. */
|
|
70
|
+
const PHI_DIALOG_FORM_COLUMN_MODES = ["medium", "wide"];
|
|
71
|
+
/**
|
|
72
|
+
* Whether a Form stands in one column wherever it can stand in two.
|
|
73
|
+
*
|
|
74
|
+
* Read off the descriptor at the two widths that put labels beside fields, `medium` and `wide`: a field
|
|
75
|
+
* whose label and control together leave part of the row free leaves room for a field beside it, and
|
|
76
|
+
* that is a Form of two columns -- whether a second field stands there or not, since the half was meant
|
|
77
|
+
* for one. A field takes the layout's label column into its extent even where it draws no label, as it
|
|
78
|
+
* does on the grid (`labelSlot` in `resolvePhiFormGridPlacement`), so a checkbox under the inputs is
|
|
79
|
+
* still a field of the one column. At `compact` every Form is one column, and it says nothing.
|
|
80
|
+
*/
|
|
81
|
+
export function isPhiFormSingleColumn(descriptor) {
|
|
82
|
+
const layout = resolvePhiFormLayout(descriptor.layout);
|
|
83
|
+
return descriptor.fields.every((field) => PHI_DIALOG_FORM_COLUMN_MODES.every((mode) => {
|
|
84
|
+
const ranges = resolvePhiFormFieldRanges(layout, field.placement, mode, `fields.${field.key}`);
|
|
85
|
+
const extent = resolvePhiFormFieldExtent(ranges.label, ranges.control);
|
|
86
|
+
return extent.start === 1 && extent.end === PHI_FORM_GRID_LAST_LINE;
|
|
87
|
+
}));
|
|
88
|
+
}
|
|
89
|
+
/** The width a dialog takes for the Form in its body: `PHI_DIALOG_WIDTH_SINGLE_COLUMN` or `PHI_DIALOG_WIDTH`. */
|
|
90
|
+
export function resolvePhiDialogFormWidth(descriptor) {
|
|
91
|
+
return isPhiFormSingleColumn(descriptor) ? PHI_DIALOG_WIDTH_SINGLE_COLUMN : PHI_DIALOG_WIDTH;
|
|
92
|
+
}
|
|
@@ -8,7 +8,7 @@ export declare const PHI_SPLIT_CARD_LAYOUT_CREATION_CONFIG: {
|
|
|
8
8
|
readonly background: {
|
|
9
9
|
readonly base: {
|
|
10
10
|
readonly kind: "color";
|
|
11
|
-
readonly color: "var(--
|
|
11
|
+
readonly color: "var(--phi-color-bg-container)";
|
|
12
12
|
};
|
|
13
13
|
readonly overlay: null;
|
|
14
14
|
readonly filter: null;
|
|
@@ -17,7 +17,7 @@ export declare const PHI_SPLIT_CARD_LAYOUT_CREATION_CONFIG: {
|
|
|
17
17
|
readonly border: {
|
|
18
18
|
readonly borderWidth: 1;
|
|
19
19
|
readonly borderStyle: "solid";
|
|
20
|
-
readonly borderColor: "var(--
|
|
20
|
+
readonly borderColor: "var(--phi-color-border-secondary)";
|
|
21
21
|
};
|
|
22
22
|
readonly shadow: "soft";
|
|
23
23
|
};
|
|
@@ -1,9 +1,14 @@
|
|
|
1
1
|
import { type PhiBuilderAreaKey } from "../constants/cms-areas";
|
|
2
2
|
import type { PhiCmsPresetSource } from "../types/cms-module-descriptors";
|
|
3
|
+
import type { PhiRuntimeDataProviderKey } from "../types/runtime-data-provider";
|
|
3
4
|
import { type PhiPageReference } from "../types/references";
|
|
4
5
|
export type PhiPresetPageNode = {
|
|
5
6
|
key: string;
|
|
6
7
|
title: string;
|
|
8
|
+
/** The record Provider of the record this Page is about, where its route names one. */
|
|
9
|
+
pageRecord?: {
|
|
10
|
+
providerKey: PhiRuntimeDataProviderKey;
|
|
11
|
+
};
|
|
7
12
|
/** The address the Page answers on, including the package namespace outside Public. */
|
|
8
13
|
storagePath?: string;
|
|
9
14
|
/**
|
|
@@ -46,6 +51,14 @@ export type PhiBuilderModulePresetPagesByArea = Record<PhiBuilderPageCatalogArea
|
|
|
46
51
|
export declare function createEmptyPhiBuilderModulePresetPagesByArea(): PhiBuilderModulePresetPagesByArea;
|
|
47
52
|
export type PhiBuilderPageCatalogArea = PhiBuilderAreaKey;
|
|
48
53
|
export declare function findPhiPageNodePath(pages: PhiPresetPageNode[], targetKey: string, prefix?: PhiPresetPageNode[]): PhiPresetPageNode[] | null;
|
|
54
|
+
/**
|
|
55
|
+
* The Page a requested key stands for, or `null` where the catalog knows no such key.
|
|
56
|
+
*
|
|
57
|
+
* A folder is no Page: `/shop/p/:slug` made the folders `shop` and `p`, and a workspace opened on one drew
|
|
58
|
+
* a Page with empty Regions. A folder's key -- from the picker of old, or an address somebody kept -- stands
|
|
59
|
+
* for the first Page inside it.
|
|
60
|
+
*/
|
|
61
|
+
export declare function resolvePhiBuilderRequestedPageKey(requestedPageKey: string | null | undefined, pages: readonly PhiPresetPageNode[]): string | null;
|
|
49
62
|
export declare function resolvePhiBuilderActivePageKey(requestedPageKey: string | null | undefined, pages: readonly PhiPresetPageNode[]): string | null;
|
|
50
63
|
export declare function resolvePhiBuilderPagePresetSource(pageKey: string, pages: readonly PhiPresetPageNode[]): PhiCmsPresetSource | null;
|
|
51
64
|
export declare function resolvePhiBuilderPageDefaultFlags(pageKey: string, pages: readonly PhiPresetPageNode[]): number;
|
|
@@ -100,10 +100,26 @@ function findFirstPhiBuilderPageNodeKey(pages) {
|
|
|
100
100
|
}
|
|
101
101
|
return null;
|
|
102
102
|
}
|
|
103
|
-
|
|
103
|
+
/**
|
|
104
|
+
* The Page a requested key stands for, or `null` where the catalog knows no such key.
|
|
105
|
+
*
|
|
106
|
+
* A folder is no Page: `/shop/p/:slug` made the folders `shop` and `p`, and a workspace opened on one drew
|
|
107
|
+
* a Page with empty Regions. A folder's key -- from the picker of old, or an address somebody kept -- stands
|
|
108
|
+
* for the first Page inside it.
|
|
109
|
+
*/
|
|
110
|
+
export function resolvePhiBuilderRequestedPageKey(requestedPageKey, pages) {
|
|
104
111
|
const normalizedPageKey = requestedPageKey?.trim() ?? "";
|
|
105
|
-
|
|
112
|
+
const requested = normalizedPageKey ? readPhiPageNodePath(pages, normalizedPageKey)?.at(-1) : null;
|
|
113
|
+
if (!requested)
|
|
114
|
+
return null;
|
|
115
|
+
if (requested.storagePath)
|
|
106
116
|
return normalizedPageKey;
|
|
117
|
+
return requested.children ? findFirstPhiBuilderPageNodeKey(requested.children) : null;
|
|
118
|
+
}
|
|
119
|
+
export function resolvePhiBuilderActivePageKey(requestedPageKey, pages) {
|
|
120
|
+
const requested = resolvePhiBuilderRequestedPageKey(requestedPageKey, pages);
|
|
121
|
+
if (requested) {
|
|
122
|
+
return requested;
|
|
107
123
|
}
|
|
108
124
|
/*
|
|
109
125
|
* Not `pages[0]`: since a Module's routes live under its package, the first root node is the folder
|
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import type { PhiFormDescriptor } from "@phis/contracts/forms";
|
|
1
2
|
import { buildPhiCmsLayoutNode, type PhiCmsWidgetNodeFactoryCommon, type PhiCmsWidgetPlacementFields } from "./cms-node-factories";
|
|
2
3
|
import type { PhiCommandToolbarWidgetPlacement } from "../types/core-widget-placements";
|
|
3
4
|
import type { PhiCmsContentWidgetNode, PhiCmsLayoutNode, PhiCmsOverlayNode, PhiCmsPageNode, PhiCmsRegionNode } from "../types/cms";
|
|
@@ -65,20 +66,29 @@ export type PhiCmsPresetOverlayInput = {
|
|
|
65
66
|
*
|
|
66
67
|
* What it decides is what differs between dialogs: its ids, its title and wiring, what extra the body
|
|
67
68
|
* Layout carries (a form's label column, say), and its buttons. How the body and the actions look is the
|
|
68
|
-
* one answer every dialog shares (`helpers/cms-dialog.ts`), so it is not an input.
|
|
69
|
+
* one answer every dialog shares (`helpers/cms-dialog.ts`), so it is not an input. Nor is the width, as
|
|
70
|
+
* long as the dialog can see the Form it holds: given `body.form`, it takes the width that Form needs
|
|
71
|
+
* (`resolvePhiDialogFormWidth`); given none, `PHI_DIALOG_WIDTH`. A width in `config` is the caller's
|
|
72
|
+
* own, for a table or an editor that needs more.
|
|
69
73
|
*/
|
|
70
74
|
export type PhiCmsPresetDialogInput = {
|
|
71
75
|
id: PhiCmsInstanceId;
|
|
72
76
|
bodyLayoutNodeId: PhiCmsInstanceId;
|
|
73
77
|
sortOrder: number;
|
|
74
78
|
label: string | null;
|
|
75
|
-
/** The Overlay's config: title, mount and close policy, open action, routes. `width`
|
|
79
|
+
/** The Overlay's config: title, mount and close policy, open action, routes. `width` follows `body.form`. */
|
|
76
80
|
config: Record<string, unknown>;
|
|
77
81
|
headerLayoutNodeId?: PhiCmsInstanceId | null;
|
|
78
|
-
/**
|
|
82
|
+
/**
|
|
83
|
+
* The body Layout: its label, the config it carries besides the dialog's own (anything but its gap,
|
|
84
|
+
* padding and ground), and the Form the Preset places in it, which the dialog takes its width from.
|
|
85
|
+
*/
|
|
79
86
|
body?: {
|
|
80
87
|
label?: string;
|
|
81
88
|
config?: Record<string, unknown>;
|
|
89
|
+
form?: {
|
|
90
|
+
descriptor: PhiFormDescriptor;
|
|
91
|
+
};
|
|
82
92
|
};
|
|
83
93
|
/** The actions, where the dialog has any. */
|
|
84
94
|
commands?: {
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { buildPhiCmsLayoutNode, buildPhiCmsWidgetNode, } from "./cms-node-factories";
|
|
2
2
|
import { PhiCmsStatus } from "../constants/phi-cms";
|
|
3
|
-
import { PHI_DIALOG_BODY_CONFIG, PHI_DIALOG_COMMANDS_CONFIG, PHI_DIALOG_WIDTH } from "./cms-dialog";
|
|
3
|
+
import { PHI_DIALOG_BODY_CONFIG, PHI_DIALOG_COMMANDS_CONFIG, PHI_DIALOG_WIDTH, resolvePhiDialogFormWidth, } from "./cms-dialog";
|
|
4
4
|
export function createPhiCmsPresetNodes(defaults) {
|
|
5
5
|
const nodes = createPhiCmsPresetNodeSet(defaults);
|
|
6
6
|
return "pageType" in defaults ? createPhiCmsPresetPageNodeSet(defaults, nodes) : nodes;
|
|
@@ -81,7 +81,8 @@ function createPhiCmsPresetNodeSet(defaults) {
|
|
|
81
81
|
creationPreset: { layoutKind: "verticalflex", preset: "panel" },
|
|
82
82
|
config: { ...input.body?.config, ...PHI_DIALOG_BODY_CONFIG },
|
|
83
83
|
});
|
|
84
|
-
const
|
|
84
|
+
const form = input.body?.form;
|
|
85
|
+
const config = { width: form ? resolvePhiDialogFormWidth(form.descriptor) : PHI_DIALOG_WIDTH, ...input.config };
|
|
85
86
|
const commands = input.commands;
|
|
86
87
|
if (!commands) {
|
|
87
88
|
return {
|
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
import type { PhiPresetPageNode } from "./cms-page-catalog";
|
|
2
2
|
import type { PhiCmsActiveRouteTable } from "../types/cms-module-descriptors";
|
|
3
3
|
import type { PhiRuntimeModuleId } from "../types";
|
|
4
|
+
import type { PhiRuntimeDataProviderKey } from "../types/runtime-data-provider";
|
|
4
5
|
/**
|
|
5
6
|
* Puts one Module route into a Page tree, under the folders its path names.
|
|
6
7
|
*
|
|
@@ -16,6 +17,9 @@ export declare function insertPhiPresetPageTarget(roots: PhiPresetPageNode[], ta
|
|
|
16
17
|
presetVersion: number;
|
|
17
18
|
defaultPageFlags?: number;
|
|
18
19
|
landingPage?: true;
|
|
20
|
+
pageRecord?: {
|
|
21
|
+
providerKey: PhiRuntimeDataProviderKey;
|
|
22
|
+
};
|
|
19
23
|
}): void;
|
|
20
24
|
/**
|
|
21
25
|
* The Module Pages one Area answers on today, as catalog nodes.
|