@phis/ui 0.5.3 → 0.5.5
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/components/cms/phi-cms-layout-renderer.js +17 -7
- package/components/controls/phi-cascader-control.d.ts +9 -1
- package/components/controls/phi-cascader-control.js +25 -3
- package/components/controls/phi-money-control.d.ts +39 -0
- package/components/controls/phi-money-control.js +34 -0
- package/components/controls/phi-number-control.d.ts +6 -1
- package/components/controls/phi-number-control.js +3 -3
- package/components/controls/phi-options-provider.d.ts +7 -0
- package/components/controls/phi-options-provider.js +11 -0
- package/components/forms/extended-form-field-controls.d.ts +1 -0
- package/components/forms/extended-form-field-controls.js +23 -1
- package/components/forms/form-descriptor-runtime-client.js +13 -0
- package/components/forms/form-provider-contract.d.ts +43 -0
- package/components/forms/form-provider-contract.js +40 -0
- package/components/forms/money-field.d.ts +27 -0
- package/components/forms/money-field.js +78 -0
- package/components/forms/shared-form-provider-registry.js +4 -0
- package/components/layouts/clients/phi-flex-layout-client.js +17 -2
- package/components/layouts/clients/phi-layout-anchored-overlay.d.ts +2 -0
- package/components/layouts/clients/phi-layout-anchored-overlay.js +2 -0
- package/components/media/phi-media-picker-binding.js +6 -1
- package/components/media/phi-site-font-assets.js +6 -1
- package/components/motion/phi-sequence-run.d.ts +14 -1
- package/components/motion/phi-sequence-run.js +22 -3
- package/components/motion/phi-sequence-viewport.js +3 -1
- package/components/regions/presets/content-entry-editor-page-tree.js +5 -1
- package/components/regions/presets/content-entry-public-page-trees.js +2 -0
- package/components/tables/client/phi-table-binding.js +16 -3
- package/components/trees/client/phi-tree-binding.js +6 -2
- package/components/widgets/builder/stack-tabs.d.ts +2 -1
- package/components/widgets/builder/stack-tabs.js +18 -2
- package/components/widgets/client/shared/phi-collection-view-binding.js +10 -2
- package/components/widgets/client/shared/phi-rendered-value.d.ts +9 -1
- package/components/widgets/client/shared/phi-rendered-value.js +20 -1
- package/components/widgets/config/choice-shared.d.ts +1 -49
- package/components/widgets/config/choice-shared.js +0 -1
- package/components/widgets/config/stack-tabs.js +4 -3
- package/components/widgets/label-sets/gallery.js +6 -0
- package/components/widgets/label-sets/interval.d.ts +4 -0
- package/components/widgets/label-sets/interval.js +31 -0
- package/components/widgets/label-sets/record.js +6 -1
- package/components/widgets/label-sets/slot-upload.d.ts +4 -0
- package/components/widgets/label-sets/slot-upload.js +36 -0
- package/components/widgets/label-sets/table.js +6 -1
- package/components/widgets/label-types/gallery.d.ts +7 -0
- package/components/widgets/label-types/gallery.js +6 -0
- package/components/widgets/label-types/interval.d.ts +16 -0
- package/components/widgets/label-types/interval.js +21 -0
- package/components/widgets/label-types/record.d.ts +3 -0
- package/components/widgets/label-types/record.js +2 -0
- package/components/widgets/label-types/slot-upload.d.ts +24 -0
- package/components/widgets/label-types/slot-upload.js +16 -0
- package/components/widgets/label-types/table.d.ts +3 -0
- package/components/widgets/label-types/table.js +2 -0
- package/constants/record-field-kinds.d.ts +1 -1
- package/constants/record-field-kinds.js +1 -1
- package/constants/runtime-module-ownership.js +1 -0
- package/controls.d.ts +7 -0
- package/controls.js +4 -0
- package/helpers/cms-dialog.d.ts +39 -3
- package/helpers/cms-dialog.js +46 -4
- package/helpers/cms-page-catalog.d.ts +8 -0
- package/helpers/cms-page-catalog.js +18 -2
- package/helpers/cms-preset-nodes.d.ts +13 -3
- package/helpers/cms-preset-nodes.js +3 -2
- package/helpers/config-text-fields.d.ts +49 -0
- package/helpers/config-text-fields.js +122 -0
- package/helpers/money-amount.d.ts +48 -0
- package/helpers/money-amount.js +131 -0
- package/helpers/page-layout-check.js +15 -2
- package/helpers/preset-text-source-check.d.ts +22 -0
- package/helpers/preset-text-source-check.js +45 -0
- package/helpers/record-fields.d.ts +18 -5
- package/helpers/record-fields.js +38 -13
- package/helpers/text-source.d.ts +14 -5
- package/helpers/text-source.js +16 -3
- package/module-page-check.d.ts +1 -0
- package/module-page-check.js +1 -0
- package/module-records.d.ts +6 -3
- package/module-records.js +4 -2
- package/package.json +2 -2
- package/plugins/runtime/phi-slot-child-frame-view.js +1 -1
- package/plugins/runtime/slot-size-policy.d.ts +8 -2
- package/plugins/runtime/slot-size-policy.js +51 -16
- package/plugins/runtime-modules/accounting/module.d.ts +1 -1
- package/plugins/runtime-modules/accounting/trees/phi-default-accounting-page-tree.js +2 -0
- package/plugins/runtime-modules/app/module.d.ts +1 -1
- package/plugins/runtime-modules/asset/services/collection.js +1 -0
- package/plugins/runtime-modules/asset/trees/phi-default-builder-media-page-tree.js +2 -2
- package/plugins/runtime-modules/auth/trees/phi-default-admin-auth-settings-page-tree.js +3 -0
- package/plugins/runtime-modules/builder/clients/widget-inspector.js +2 -2
- package/plugins/runtime-modules/builder/offered-page-catalog.js +3 -3
- package/plugins/runtime-modules/builder/options-providers.js +7 -0
- package/plugins/runtime-modules/builder/trees/phi-builder-inspector-area-overlay-tree.server.js +3 -0
- package/plugins/runtime-modules/builder/trees/phi-default-builder-area-preset-tree.js +17 -3
- package/plugins/runtime-modules/contracts.d.ts +1 -1
- package/plugins/runtime-modules/core/definition.d.ts +43 -0
- package/plugins/runtime-modules/core/form-providers.d.ts +43 -0
- package/plugins/runtime-modules/core/widgets/breadcrumb/client.d.ts +6 -3
- package/plugins/runtime-modules/core/widgets/breadcrumb/client.js +6 -5
- package/plugins/runtime-modules/core/widgets/breadcrumb/plugin.js +1 -1
- package/plugins/runtime-modules/core/widgets/breadcrumb/server.d.ts +9 -1
- package/plugins/runtime-modules/core/widgets/breadcrumb/server.js +29 -3
- package/plugins/runtime-modules/core/widgets/button/config.d.ts +0 -1
- package/plugins/runtime-modules/core/widgets/button/config.js +0 -1
- package/plugins/runtime-modules/core/widgets/button/plugin.js +6 -25
- package/plugins/runtime-modules/core/widgets/card/config.d.ts +18 -2
- package/plugins/runtime-modules/core/widgets/card/config.js +16 -1
- package/plugins/runtime-modules/core/widgets/card/plugin.js +8 -10
- package/plugins/runtime-modules/core/widgets/card/server.d.ts +1 -2
- package/plugins/runtime-modules/core/widgets/card/server.js +16 -28
- package/plugins/runtime-modules/core/widgets/cascader/authoring.d.ts +4 -3
- package/plugins/runtime-modules/core/widgets/cascader/client.js +1 -1
- package/plugins/runtime-modules/core/widgets/cascader/config.d.ts +8 -2
- package/plugins/runtime-modules/core/widgets/cascader/config.js +22 -0
- package/plugins/runtime-modules/core/widgets/checkbox-group/config.d.ts +8 -2
- package/plugins/runtime-modules/core/widgets/checkbox-group/config.js +1 -1
- package/plugins/runtime-modules/core/widgets/description/config.d.ts +2 -1
- package/plugins/runtime-modules/core/widgets/entry-list/config.d.ts +2 -2
- package/plugins/runtime-modules/core/widgets/entry-list/config.js +0 -1
- package/plugins/runtime-modules/core/widgets/entry-list/plugin.js +1 -3
- package/plugins/runtime-modules/core/widgets/entry-list/server.d.ts +1 -3
- package/plugins/runtime-modules/core/widgets/entry-list/server.js +3 -3
- package/plugins/runtime-modules/core/widgets/gallery/authoring.js +12 -3
- package/plugins/runtime-modules/core/widgets/gallery/client.js +10 -1
- package/plugins/runtime-modules/core/widgets/gallery/config.d.ts +4 -1
- package/plugins/runtime-modules/core/widgets/gallery/config.js +8 -0
- package/plugins/runtime-modules/core/widgets/gallery/server.d.ts +1 -1
- package/plugins/runtime-modules/core/widgets/image/server.js +5 -9
- package/plugins/runtime-modules/core/widgets/markdown/config.d.ts +2 -1
- package/plugins/runtime-modules/core/widgets/markdown-toc/server.js +3 -5
- package/plugins/runtime-modules/core/widgets/multi-select/config.d.ts +1 -1
- package/plugins/runtime-modules/core/widgets/quick-links/plugin.js +2 -4
- package/plugins/runtime-modules/core/widgets/quick-links/server.d.ts +2 -5
- package/plugins/runtime-modules/core/widgets/quick-links/server.js +2 -6
- package/plugins/runtime-modules/core/widgets/record/client.js +8 -2
- package/plugins/runtime-modules/core/widgets/record/config.js +4 -0
- package/plugins/runtime-modules/core/widgets/result/config.d.ts +2 -2
- package/plugins/runtime-modules/core/widgets/result/config.js +0 -1
- package/plugins/runtime-modules/core/widgets/result/plugin.js +2 -4
- package/plugins/runtime-modules/core/widgets/result/server.d.ts +2 -3
- package/plugins/runtime-modules/core/widgets/result/server.js +11 -33
- package/plugins/runtime-modules/core/widgets/segmented/config.d.ts +1 -1
- package/plugins/runtime-modules/core/widgets/select-box/config.d.ts +1 -1
- package/plugins/runtime-modules/core/widgets/simple-text/config.d.ts +2 -1
- package/plugins/runtime-modules/core/widgets/simple-text/plugin.js +1 -1
- package/plugins/runtime-modules/core/widgets/slider/config.d.ts +11 -0
- package/plugins/runtime-modules/core/widgets/slider/config.js +1 -1
- package/plugins/runtime-modules/core/widgets/slot-upload/authoring.js +2 -1
- package/plugins/runtime-modules/core/widgets/slot-upload/client.d.ts +3 -1
- package/plugins/runtime-modules/core/widgets/slot-upload/client.js +45 -24
- package/plugins/runtime-modules/core/widgets/slot-upload/config.d.ts +11 -4
- package/plugins/runtime-modules/core/widgets/slot-upload/config.js +16 -1
- package/plugins/runtime-modules/core/widgets/slot-upload/plugin.js +2 -2
- package/plugins/runtime-modules/core/widgets/slot-upload/server.d.ts +8 -3
- package/plugins/runtime-modules/core/widgets/slot-upload/server.js +9 -3
- package/plugins/runtime-modules/core/widgets/spacer/config.d.ts +1 -1
- package/plugins/runtime-modules/core/widgets/spacer/config.js +1 -1
- package/plugins/runtime-modules/core/widgets/steps/config.d.ts +8 -3
- package/plugins/runtime-modules/core/widgets/steps/config.js +1 -2
- package/plugins/runtime-modules/core/widgets/steps/plugin.js +6 -30
- package/plugins/runtime-modules/core/widgets/table/client.js +4 -4
- package/plugins/runtime-modules/core/widgets/table/config.d.ts +6 -3
- package/plugins/runtime-modules/core/widgets/table/config.js +4 -1
- package/plugins/runtime-modules/core/widgets/timeline/config.d.ts +8 -1
- package/plugins/runtime-modules/core/widgets/timeline/config.js +1 -2
- package/plugins/runtime-modules/core/widgets/timeline/plugin.js +6 -37
- package/plugins/runtime-modules/descriptor-compiler.d.ts +11 -1
- package/plugins/runtime-modules/descriptor-compiler.js +49 -8
- package/plugins/runtime-modules/groups/definition.d.ts +1 -1
- package/plugins/runtime-modules/groups/forms.d.ts +18 -0
- package/plugins/runtime-modules/groups/forms.js +2 -2
- package/plugins/runtime-modules/groups/trees/phi-default-admin-groups-page-tree.js +8 -4
- package/plugins/runtime-modules/groups/trees/phi-default-app-groups-page-tree.js +2 -0
- package/plugins/runtime-modules/localization/trees/phi-default-editor-translations-page-tree.js +3 -0
- package/plugins/runtime-modules/page-preset-overlays.d.ts +18 -0
- package/plugins/runtime-modules/page-preset-overlays.js +70 -0
- package/plugins/runtime-modules/public/module.d.ts +1 -1
- package/plugins/runtime-modules/public/trees/phi-default-pub-welcome-page-tree.js +1 -0
- package/plugins/runtime-modules/resolver.js +5 -0
- package/plugins/runtime-modules/revisions/trees/phi-default-builder-revisions-page-tree.js +5 -2
- package/plugins/runtime-modules/search/widgets/search-box/server.js +3 -5
- package/plugins/runtime-modules/search/widgets/search-results/server.js +3 -5
- package/plugins/runtime-modules/theme/trees/phi-default-builder-theme-page-tree.js +4 -0
- package/plugins/runtime-modules/threads/trees/phi-default-threads-page-tree.js +6 -2
- package/plugins/runtime-modules/user-management/controller/client.js +6 -1
- package/plugins/runtime-modules/user-management/trees/phi-default-admin-users-page-tree.js +5 -3
- package/runtime-render-client.d.ts +1 -1
- package/runtime-render-client.js +2 -1
- package/server-helpers/cms-page-record.d.ts +2 -2
- package/server-helpers/cms-page-record.js +15 -5
- package/server-helpers/cms-request.js +34 -12
- package/server-helpers/cms-widget-texts.d.ts +14 -0
- package/server-helpers/cms-widget-texts.js +117 -0
- package/server-helpers/record-fields.d.ts +1 -1
- package/server-helpers/record-fields.js +1 -2
- package/server-helpers/record-samples.d.ts +4 -4
- package/server-helpers/record-samples.js +10 -2
- package/server-helpers/search-index.js +12 -3
- package/styles/root.css +6 -2
- package/types/cms-module-descriptors.d.ts +3 -0
- package/types/cms-plugins.d.ts +38 -5
- package/types/collection-provider.d.ts +7 -0
- package/types/core-widget-placements.d.ts +37 -0
- package/types/record-provider.d.ts +19 -3
- package/types/slot-size-policy.d.ts +19 -2
- package/types/table-widget.d.ts +33 -1
- package/types/table-widget.js +1 -0
- package/types/tree-widget.d.ts +7 -0
- package/types/widget-runtime.d.ts +1 -1
- package/types.d.ts +1 -0
|
@@ -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
|
}
|
|
@@ -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;
|
|
@@ -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
|
+
}
|
|
@@ -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));
|
|
@@ -2,5 +2,5 @@
|
|
|
2
2
|
* The kinds a field of a record can be. Closed: a Widget says which of them it draws, and the Builder offers
|
|
3
3
|
* only those. Here rather than beside the record types, so that reading the list at runtime does not load them.
|
|
4
4
|
*/
|
|
5
|
-
export declare const PHI_RECORD_FIELD_KINDS: readonly ["text", "markdown", "picture", "pictures", "list", "tag", "date", "number", "link"];
|
|
5
|
+
export declare const PHI_RECORD_FIELD_KINDS: readonly ["text", "markdown", "picture", "pictures", "list", "tag", "date", "number", "money", "link"];
|
|
6
6
|
export type PhiRecordFieldKind = (typeof PHI_RECORD_FIELD_KINDS)[number];
|
|
@@ -3,5 +3,5 @@
|
|
|
3
3
|
* only those. Here rather than beside the record types, so that reading the list at runtime does not load them.
|
|
4
4
|
*/
|
|
5
5
|
export const PHI_RECORD_FIELD_KINDS = [
|
|
6
|
-
"text", "markdown", "picture", "pictures", "list", "tag", "date", "number", "link",
|
|
6
|
+
"text", "markdown", "picture", "pictures", "list", "tag", "date", "number", "money", "link",
|
|
7
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"],
|
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";
|
package/helpers/cms-dialog.d.ts
CHANGED
|
@@ -1,3 +1,4 @@
|
|
|
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
4
|
readonly gap: "var(--phi-padding-sm)";
|
|
@@ -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
|
+
}
|
|
@@ -51,6 +51,14 @@ export type PhiBuilderModulePresetPagesByArea = Record<PhiBuilderPageCatalogArea
|
|
|
51
51
|
export declare function createEmptyPhiBuilderModulePresetPagesByArea(): PhiBuilderModulePresetPagesByArea;
|
|
52
52
|
export type PhiBuilderPageCatalogArea = PhiBuilderAreaKey;
|
|
53
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;
|
|
54
62
|
export declare function resolvePhiBuilderActivePageKey(requestedPageKey: string | null | undefined, pages: readonly PhiPresetPageNode[]): string | null;
|
|
55
63
|
export declare function resolvePhiBuilderPagePresetSource(pageKey: string, pages: readonly PhiPresetPageNode[]): PhiCmsPresetSource | null;
|
|
56
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 {
|