@phis/ui 0.7.7 → 0.8.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/components/controls/phi-address-control.d.ts +23 -0
- package/components/controls/phi-address-control.js +43 -0
- package/components/controls/phi-color-control.d.ts +3 -1
- package/components/controls/phi-color-control.js +2 -2
- package/components/controls/phi-country-select-control.d.ts +22 -0
- package/components/controls/phi-country-select-control.js +16 -0
- package/components/controls/phi-dialog-control.d.ts +1 -1
- package/components/controls/phi-drawer-control-adapter.d.ts +1 -1
- package/components/controls/phi-drawer-control-adapter.js +5 -3
- package/components/controls/phi-drawer-control.d.ts +7 -5
- package/components/controls/phi-float-button-control.d.ts +8 -1
- package/components/controls/phi-float-button-control.js +19 -3
- package/components/controls/phi-form-control.js +64 -9
- package/components/controls/phi-modal-control-adapter.d.ts +1 -1
- package/components/controls/phi-modal-control-adapter.js +14 -37
- package/components/controls/phi-modal-control.d.ts +5 -5
- package/components/controls/phi-options-provider.d.ts +1 -0
- package/components/controls/phi-options-provider.js +1 -0
- package/components/controls/phi-overlay-control-contract.d.ts +52 -17
- package/components/controls/phi-overlay-control-contract.js +55 -30
- package/components/controls/phi-reveal-once-dialog-control.d.ts +21 -0
- package/components/controls/phi-reveal-once-dialog-control.js +52 -0
- package/components/controls/phi-reveal-once-dialog-labels.d.ts +10 -0
- package/components/controls/phi-reveal-once-dialog-labels.js +5 -0
- package/components/forms/extended-form-field-controls.d.ts +1 -1
- package/components/forms/extended-form-field-controls.js +23 -7
- package/components/forms/flags-field.d.ts +22 -0
- package/components/forms/flags-field.js +58 -0
- package/components/forms/form-option-flags.d.ts +20 -0
- package/components/forms/form-option-flags.js +38 -0
- package/components/forms/form-provider-contract.d.ts +28 -0
- package/components/forms/form-provider-contract.js +45 -2
- package/components/forms/form-provider-registry.d.ts +11 -1
- package/components/forms/money-field-currency-key.d.ts +6 -0
- package/components/forms/money-field-currency-key.js +14 -0
- package/components/forms/money-field.d.ts +26 -3
- package/components/forms/money-field.js +54 -4
- package/components/forms/shared-form-provider-registry.js +13 -0
- package/components/forms/structured-field-labels.d.ts +24 -0
- package/components/forms/structured-field-labels.js +43 -0
- package/components/forms/structured-form-field-controls.d.ts +12 -0
- package/components/forms/structured-form-field-controls.js +65 -0
- package/components/overlays/phi-overlay-container-client.js +2 -2
- package/components/regions/phi-cms-region-shell.js +2 -2
- package/components/regions/presets/content-entry-editor-page-tree.js +12 -3
- package/components/regions/presets/navigation-redirect.d.ts +4 -1
- package/components/regions/presets/navigation-redirect.js +6 -3
- package/components/regions/presets/phi-settings-page-shell-tree.d.ts +6 -2
- package/components/regions/presets/phi-settings-page-shell-tree.js +1 -1
- package/components/root/phi-root-theme-resolver.js +3 -0
- package/components/shell/phi-antd-icon.d.ts +1 -8
- package/components/shell/phi-antd-icon.js +1 -227
- package/components/shell/phi-icon-names.d.ts +19 -0
- package/components/shell/phi-icon-names.js +264 -0
- package/components/shell/phi-icon.d.ts +2 -11
- package/components/shell/phi-icon.js +4 -32
- package/components/widgets/client/shared/phi-command-buttons.d.ts +13 -2
- package/components/widgets/client/shared/phi-command-buttons.js +10 -4
- package/components/widgets/client/shared/phi-rendered-value.js +32 -6
- package/components/widgets/client/shared/phi-table-provider-refusal.d.ts +13 -0
- package/components/widgets/client/shared/phi-table-provider-refusal.js +13 -0
- package/components/widgets/config/background.d.ts +3 -2
- package/components/widgets/config/choice-shared.d.ts +10 -1
- package/components/widgets/config/choice-shared.js +8 -2
- package/components/widgets/label-sets/admin-locales.js +1 -1
- package/components/widgets/label-sets/admin-users.d.ts +2 -5
- package/components/widgets/label-sets/admin-users.js +4 -10
- package/components/widgets/label-sets/effects.js +2 -4
- package/components/widgets/label-sets/profile.d.ts +13 -0
- package/components/widgets/label-sets/profile.js +28 -0
- package/components/widgets/label-sets/search-results.js +2 -4
- package/components/widgets/label-sets/table.js +9 -0
- package/components/widgets/label-types/effects.d.ts +3 -2
- package/components/widgets/label-types/effects.js +1 -2
- package/components/widgets/label-types/search-results.d.ts +2 -2
- package/components/widgets/label-types/search-results.js +1 -2
- package/components/widgets/label-types/table.d.ts +3 -0
- package/components/widgets/label-types/table.js +2 -0
- package/components/widgets/server/builder-chrome.d.ts +4 -1
- package/components/widgets/server/builder-chrome.js +2 -2
- package/components/widgets/shared/markdown-body-client.d.ts +26 -0
- package/components/widgets/shared/markdown-body-client.js +31 -1
- package/components/widgets/shared/markdown-render.d.ts +10 -2
- package/components/widgets/shared/markdown-render.js +35 -13
- package/constants/countries.d.ts +9 -0
- package/constants/countries.js +28 -0
- package/constants/customer-file.d.ts +25 -0
- package/constants/customer-file.js +26 -0
- package/constants/record-field-kinds.d.ts +15 -0
- package/constants/record-field-kinds.js +13 -0
- package/constants/runtime-module-ownership.js +12 -0
- package/constants/runtime-render-client-types.d.ts +5 -0
- package/constants/runtime-render-client-types.js +5 -0
- package/{plugins/runtime-modules/threads/controller/address.js → constants/threads-controller-address.js} +1 -1
- package/constants.d.ts +1 -0
- package/constants.js +2 -0
- package/gateway/form-handler-request.d.ts +22 -0
- package/gateway/form-handler-request.js +40 -0
- package/gateway/label-set.d.ts +15 -2
- package/gateway/label-set.js +60 -22
- package/gateway/site-form-route.js +11 -2
- package/helpers/address-field.d.ts +43 -0
- package/helpers/address-field.js +68 -0
- package/helpers/cms-dialog.d.ts +5 -20
- package/helpers/cms-dialog.js +8 -13
- package/helpers/cms-page-catalog.d.ts +10 -0
- package/helpers/cms-page-catalog.js +19 -0
- package/helpers/cms-preset-nodes.d.ts +4 -4
- package/helpers/cms-preset-nodes.js +1 -1
- package/helpers/cms-region-keys.d.ts +1 -1
- package/helpers/country-names.d.ts +12 -0
- package/helpers/country-names.js +14 -0
- package/helpers/money-amount.d.ts +7 -0
- package/helpers/money-amount.js +15 -0
- package/helpers/phi-metadata.d.ts +33 -1
- package/helpers/phi-metadata.js +62 -1
- package/helpers/preset-table-check.d.ts +34 -0
- package/helpers/preset-table-check.js +124 -0
- package/helpers/preset-text-source-check.d.ts +4 -1
- package/helpers/preset-text-source-check.js +6 -1
- package/helpers/preset-tree-contract-check.d.ts +3 -2
- package/helpers/preset-tree-contract-check.js +30 -5
- package/helpers/public-route-claims.d.ts +9 -1
- package/helpers/public-route-claims.js +23 -3
- package/helpers/record-fields.d.ts +1 -5
- package/helpers/record-fields.js +15 -6
- package/helpers/route-address-check.d.ts +22 -2
- package/helpers/route-address-check.js +29 -8
- package/helpers/site-address-row.d.ts +23 -0
- package/helpers/site-address-row.js +36 -0
- package/helpers/surface-style.d.ts +8 -1
- package/helpers/surface-style.js +12 -2
- package/helpers/thread-inbox-row.d.ts +20 -0
- package/helpers/thread-inbox-row.js +26 -0
- package/helpers/translation-format.d.ts +26 -0
- package/helpers/translation-format.js +31 -0
- package/module-labels.d.ts +1 -1
- package/module-labels.js +1 -1
- package/module-page-check.d.ts +1 -0
- package/module-page-check.js +1 -0
- package/module-records.d.ts +2 -2
- package/module-records.js +1 -0
- package/next/area-route.js +34 -1
- package/next/root-route.js +4 -5
- package/package.json +2 -2
- package/plugins/runtime-modules/accounting/customer-file-access.d.ts +11 -0
- package/plugins/runtime-modules/accounting/customer-file-access.js +12 -0
- package/plugins/runtime-modules/accounting/data-providers.js +1 -1
- package/plugins/runtime-modules/accounting/ids.d.ts +11 -0
- package/plugins/runtime-modules/accounting/ids.js +23 -0
- package/plugins/runtime-modules/accounting/presets.js +32 -5
- package/plugins/runtime-modules/accounting/trees/accounting-customer-file-label-set.d.ts +66 -0
- package/plugins/runtime-modules/accounting/trees/accounting-customer-file-label-set.js +122 -0
- package/plugins/runtime-modules/accounting/trees/accounting-products-label-set.js +2 -2
- package/plugins/runtime-modules/accounting/trees/phi-default-accounting-customer-file-page-tree.d.ts +26 -0
- package/plugins/runtime-modules/accounting/trees/phi-default-accounting-customer-file-page-tree.js +381 -0
- package/plugins/runtime-modules/accounting/trees/phi-default-accounting-products-page-tree.js +4 -0
- package/plugins/runtime-modules/app/client-data-providers.d.ts +7 -0
- package/plugins/runtime-modules/app/client-data-providers.js +9 -0
- package/plugins/runtime-modules/app/data-providers.d.ts +98 -0
- package/plugins/runtime-modules/app/data-providers.js +80 -0
- package/plugins/runtime-modules/app/definition.d.ts +131 -0
- package/plugins/runtime-modules/app/definition.js +2 -0
- package/plugins/runtime-modules/app/forms.d.ts +46 -1
- package/plugins/runtime-modules/app/forms.js +195 -1
- package/plugins/runtime-modules/app/ids.d.ts +7 -0
- package/plugins/runtime-modules/app/ids.js +8 -0
- package/plugins/runtime-modules/app/module.d.ts +131 -0
- package/plugins/runtime-modules/app/presets.js +3 -6
- package/plugins/runtime-modules/app/services/addresses-table.d.ts +135 -0
- package/plugins/runtime-modules/app/services/addresses-table.js +101 -0
- package/plugins/runtime-modules/app/trees/account-addresses-panel.d.ts +17 -0
- package/plugins/runtime-modules/app/trees/account-addresses-panel.js +179 -0
- package/plugins/runtime-modules/app/trees/addresses-label-set.d.ts +62 -0
- package/plugins/runtime-modules/app/trees/addresses-label-set.js +108 -0
- package/plugins/runtime-modules/app/trees/phi-default-app-area-preset-tree.d.ts +3 -6
- package/plugins/runtime-modules/app/trees/phi-default-app-area-preset-tree.js +4 -7
- package/plugins/runtime-modules/app/trees/phi-default-app-profile-page-tree.js +27 -2
- package/plugins/runtime-modules/app/trees/profile-label-set.d.ts +1 -0
- package/plugins/runtime-modules/app/trees/profile-label-set.js +3 -0
- package/plugins/runtime-modules/asset/presets.d.ts +4 -0
- package/plugins/runtime-modules/asset/trees/phi-default-builder-media-page-tree.js +4 -2
- package/plugins/runtime-modules/auth/trees/phi-auth-area-overlay-tree.server.js +4 -2
- package/plugins/runtime-modules/auth/trees/phi-default-admin-auth-settings-page-tree.js +2 -2
- package/plugins/runtime-modules/auth/widgets/logout/client.d.ts +1 -1
- package/plugins/runtime-modules/auth/widgets/logout/client.js +2 -2
- package/plugins/runtime-modules/auth/widgets/security/client.d.ts +5 -1
- package/plugins/runtime-modules/auth/widgets/security/client.js +12 -10
- package/plugins/runtime-modules/avatar/overlay-tree.server.js +1 -1
- package/plugins/runtime-modules/blog/presets.d.ts +4 -0
- package/plugins/runtime-modules/builder/clients/inspector-image-field.d.ts +2 -1
- package/plugins/runtime-modules/builder/clients/inspector-image-field.js +3 -2
- package/plugins/runtime-modules/builder/clients/metadata-table-provider-stand-ins.d.ts +23 -0
- package/plugins/runtime-modules/builder/clients/metadata-table-provider-stand-ins.js +38 -0
- package/plugins/runtime-modules/builder/clients/mode-switch.d.ts +4 -1
- package/plugins/runtime-modules/builder/clients/mode-switch.js +2 -15
- package/plugins/runtime-modules/builder/clients/pages-workspace.js +2 -0
- package/plugins/runtime-modules/builder/clients/runtime-module-authoring-boundary.js +2 -1
- package/plugins/runtime-modules/builder/controller/client.d.ts +5 -5
- package/plugins/runtime-modules/builder/controller/client.js +2 -1
- package/plugins/runtime-modules/builder/controller/definition.d.ts +4 -4
- package/plugins/runtime-modules/builder/controller/definition.js +7 -0
- package/plugins/runtime-modules/builder/controller/draft-command-controller.d.ts +3 -1
- package/plugins/runtime-modules/builder/controller/draft-command-controller.js +2 -1
- package/plugins/runtime-modules/builder/controller/draft-status-controller.js +72 -18
- package/plugins/runtime-modules/builder/controller/server-definition.d.ts +4 -4
- package/plugins/runtime-modules/builder/controller/workspace-controller.d.ts +3 -1
- package/plugins/runtime-modules/builder/controller/workspace-controller.js +8 -10
- package/plugins/runtime-modules/builder/developer-workspace-store.d.ts +10 -0
- package/plugins/runtime-modules/builder/developer-workspace-store.js +35 -1
- package/plugins/runtime-modules/builder/developer-workspace-types.d.ts +5 -0
- package/plugins/runtime-modules/builder/offered-page-catalog.d.ts +6 -0
- package/plugins/runtime-modules/builder/offered-page-catalog.js +35 -6
- package/plugins/runtime-modules/builder/page-presets.server.d.ts +7 -0
- package/plugins/runtime-modules/builder/page-presets.server.js +10 -1
- package/plugins/runtime-modules/builder/persistence.d.ts +4 -1
- package/plugins/runtime-modules/builder/persistence.js +14 -3
- package/plugins/runtime-modules/builder/public-route-collisions.js +8 -3
- package/plugins/runtime-modules/builder/trees/phi-builder-inspector-area-overlay-tree.server.js +3 -1
- package/plugins/runtime-modules/builder/trees/phi-default-builder-area-preset-tree.js +33 -6
- package/plugins/runtime-modules/builder/widgets/chrome/config.d.ts +6 -4
- package/plugins/runtime-modules/builder/widgets/chrome/config.js +11 -1
- package/plugins/runtime-modules/builder/widgets/inspector-header/authoring.d.ts +2 -2
- package/plugins/runtime-modules/builder/widgets/inspector-header/plugin.d.ts +2 -2
- package/plugins/runtime-modules/builder/widgets/mode-switch/plugin.js +1 -1
- package/plugins/runtime-modules/builder/widgets/structure-region/built-in.js +2 -2
- package/plugins/runtime-modules/client-manifests/app.js +3 -0
- package/plugins/runtime-modules/client-manifests/builder.js +10 -0
- package/plugins/runtime-modules/content-entry-routes.d.ts +4 -0
- package/plugins/runtime-modules/contracts.js +31 -1
- package/plugins/runtime-modules/core/definition.d.ts +28 -0
- package/plugins/runtime-modules/core/form-providers.d.ts +28 -0
- package/plugins/runtime-modules/core/messaging/thread-inbox-table.d.ts +0 -17
- package/plugins/runtime-modules/core/messaging/thread-inbox-table.js +2 -23
- package/plugins/runtime-modules/core/widgets/card/config.d.ts +0 -1
- package/plugins/runtime-modules/core/widgets/card/config.js +0 -1
- package/plugins/runtime-modules/core/widgets/card/editor.js +1 -1
- package/plugins/runtime-modules/core/widgets/command-toolbar/client.js +3 -0
- package/plugins/runtime-modules/core/widgets/command-toolbar/config.d.ts +316 -1
- package/plugins/runtime-modules/core/widgets/command-toolbar/config.js +4 -4
- package/plugins/runtime-modules/core/widgets/dimension/config.d.ts +1 -1
- package/plugins/runtime-modules/core/widgets/float-button/client.js +4 -1
- package/plugins/runtime-modules/core/widgets/float-button/config.d.ts +326 -3
- package/plugins/runtime-modules/core/widgets/float-button/config.js +5 -2
- package/plugins/runtime-modules/core/widgets/header-navigation/client.js +1 -1
- package/plugins/runtime-modules/core/widgets/length/config.d.ts +1 -1
- package/plugins/runtime-modules/core/widgets/markdown/plugin.js +20 -7
- package/plugins/runtime-modules/core/widgets/markdown/server.d.ts +6 -2
- package/plugins/runtime-modules/core/widgets/markdown/server.js +2 -2
- package/plugins/runtime-modules/core/widgets/markdown/table-embeds.server.d.ts +12 -0
- package/plugins/runtime-modules/core/widgets/markdown/table-embeds.server.js +68 -0
- package/plugins/runtime-modules/core/widgets/number-input/config.d.ts +1 -1
- package/plugins/runtime-modules/core/widgets/simple-text/config.js +1 -1
- package/plugins/runtime-modules/core/widgets/simple-text/plugin.js +2 -1
- package/plugins/runtime-modules/core/widgets/spacer/client.js +3 -3
- package/plugins/runtime-modules/core/widgets/table/client.js +20 -5
- package/plugins/runtime-modules/core/widgets/table/config.js +6 -0
- package/plugins/runtime-modules/core/widgets/table/reader-query.d.ts +17 -0
- package/plugins/runtime-modules/core/widgets/table/reader-query.js +33 -0
- package/plugins/runtime-modules/dashboard/trees/dashboard-cards-page-tree.js +3 -1
- package/plugins/runtime-modules/descriptor-compiler.d.ts +19 -3
- package/plugins/runtime-modules/descriptor-compiler.js +44 -16
- package/plugins/runtime-modules/editor/presets.d.ts +4 -0
- package/plugins/runtime-modules/editor/trees/phi-default-editor-releases-page-tree.js +3 -1
- package/plugins/runtime-modules/groups/trees/phi-default-admin-groups-page-tree.js +5 -1
- package/plugins/runtime-modules/groups/trees/phi-default-app-groups-page-tree.js +5 -1
- package/plugins/runtime-modules/localization/presets.d.ts +4 -0
- package/plugins/runtime-modules/localization/trees/phi-default-admin-locales-page-tree.js +3 -1
- package/plugins/runtime-modules/localization/trees/phi-default-editor-translations-page-tree.js +4 -2
- package/plugins/runtime-modules/news/presets.d.ts +4 -0
- package/plugins/runtime-modules/observability/trees/phi-default-admin-logs-page-tree.js +6 -2
- package/plugins/runtime-modules/phi-default-site-area-preset-tree.js +46 -39
- package/plugins/runtime-modules/preset-contracts/pub-area.d.ts +1 -1
- package/plugins/runtime-modules/preset-contracts/pub-area.js +1 -0
- package/plugins/runtime-modules/resolver.js +17 -0
- package/plugins/runtime-modules/revisions/controller/client.js +50 -46
- package/plugins/runtime-modules/revisions/controller/draft-context-target.d.ts +25 -0
- package/plugins/runtime-modules/revisions/controller/draft-context-target.js +33 -0
- package/plugins/runtime-modules/revisions/presets.d.ts +4 -0
- package/plugins/runtime-modules/revisions/services/table.js +16 -5
- package/plugins/runtime-modules/revisions/trees/phi-default-builder-revisions-page-tree.js +3 -1
- package/plugins/runtime-modules/search/widgets/search-results/client.js +4 -2
- package/plugins/runtime-modules/theme/presets.d.ts +4 -0
- package/plugins/runtime-modules/theme/widgets/brand-controls/client.js +76 -4
- package/plugins/runtime-modules/theme/widgets/brand-controls/config.d.ts +3 -2
- package/plugins/runtime-modules/theme/widgets/brand-controls/config.js +2 -2
- package/plugins/runtime-modules/theme/widgets/brand-controls/plugin.js +19 -7
- package/plugins/runtime-modules/threads/client-data-providers.js +5 -0
- package/plugins/runtime-modules/threads/controller/definition.js +1 -1
- package/plugins/runtime-modules/threads/data-providers.d.ts +115 -2
- package/plugins/runtime-modules/threads/data-providers.js +85 -0
- package/plugins/runtime-modules/threads/definition.d.ts +115 -2
- package/plugins/runtime-modules/threads/definition.js +1 -1
- package/plugins/runtime-modules/threads/ids.d.ts +2 -0
- package/plugins/runtime-modules/threads/ids.js +3 -0
- package/plugins/runtime-modules/threads/services/customer-file-table.d.ts +192 -0
- package/plugins/runtime-modules/threads/services/customer-file-table.js +164 -0
- package/plugins/runtime-modules/threads/trees/phi-default-threads-page-tree.js +5 -3
- package/plugins/runtime-modules/user-management/client-data-providers.js +5 -0
- package/plugins/runtime-modules/user-management/data-providers.d.ts +159 -0
- package/plugins/runtime-modules/user-management/data-providers.js +101 -3
- package/plugins/runtime-modules/user-management/definition.d.ts +159 -0
- package/plugins/runtime-modules/user-management/ids.d.ts +9 -0
- package/plugins/runtime-modules/user-management/ids.js +9 -0
- package/plugins/runtime-modules/user-management/presets.js +17 -1
- package/plugins/runtime-modules/user-management/services/users-access-table.d.ts +378 -0
- package/plugins/runtime-modules/user-management/services/users-access-table.js +132 -0
- package/plugins/runtime-modules/user-management/trees/admin-users-access-label-set.d.ts +86 -0
- package/plugins/runtime-modules/user-management/trees/admin-users-access-label-set.js +118 -0
- package/plugins/runtime-modules/user-management/trees/phi-default-admin-users-access-page-tree.d.ts +20 -0
- package/plugins/runtime-modules/user-management/trees/phi-default-admin-users-access-page-tree.js +166 -0
- package/plugins/runtime-modules/user-management/trees/phi-default-admin-users-page-tree.js +19 -18
- package/server-helpers/cms-page-record.d.ts +9 -1
- package/server-helpers/cms-page-record.js +11 -1
- package/server-helpers/cms-request.js +8 -5
- package/server-helpers/link-preview-image.d.ts +30 -0
- package/server-helpers/link-preview-image.js +57 -0
- package/server-helpers/search-text.js +3 -0
- package/server-helpers.d.ts +1 -1
- package/server-helpers.js +1 -1
- package/styles/builder-scaffold.css +7 -1
- package/styles/layout-authoring-scaffold.css +27 -0
- package/styles/shell.css +30 -6
- package/theme/phi-theme-composition.js +9 -0
- package/theme/phi-theme-inverse-ground.d.ts +39 -0
- package/theme/phi-theme-inverse-ground.js +103 -0
- package/theme/phi-theme-tokens.d.ts +2 -1
- package/theme/phi-theme-tokens.js +2 -0
- package/types/cms-module-descriptors.d.ts +14 -0
- package/types/cms-overlay.d.ts +13 -6
- package/types/cms-overlay.js +6 -22
- package/types/cms-plugins.d.ts +14 -2
- package/types/cms.d.ts +10 -0
- package/types/core-widget-placements.d.ts +3 -3
- package/types/link-preview.d.ts +19 -0
- package/types/link-preview.js +19 -0
- package/types/record-provider.d.ts +22 -1
- package/types/site-theme.d.ts +27 -0
- package/types/table-embed.d.ts +48 -0
- package/types/table-embed.js +1 -0
- package/types/table-widget.d.ts +14 -0
- package/types/widget-runtime.d.ts +3 -0
- package/types.d.ts +1 -0
- /package/{plugins/runtime-modules/threads/controller/address.d.ts → constants/threads-controller-address.d.ts} +0 -0
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* The Form field a money field takes its currency from, or `null` for one that states its own: what the
|
|
3
|
+
* Form watches for it, read as loosely as a list of watched keys needs and as strictly as the field's
|
|
4
|
+
* own Control reads it once drawn.
|
|
5
|
+
*/
|
|
6
|
+
export declare function readPhiMoneyFieldCurrencyFieldKey(config: Readonly<Record<string, unknown>> | undefined): string | null;
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
/*
|
|
2
|
+
* Apart from `money-field.ts` because the Form reads it for every field it draws, to know what to
|
|
3
|
+
* watch: that file brings the currency table and the config reader, which a Form without a money field
|
|
4
|
+
* has no use for.
|
|
5
|
+
*/
|
|
6
|
+
/**
|
|
7
|
+
* The Form field a money field takes its currency from, or `null` for one that states its own: what the
|
|
8
|
+
* Form watches for it, read as loosely as a list of watched keys needs and as strictly as the field's
|
|
9
|
+
* own Control reads it once drawn.
|
|
10
|
+
*/
|
|
11
|
+
export function readPhiMoneyFieldCurrencyFieldKey(config) {
|
|
12
|
+
const key = config?.currencyField;
|
|
13
|
+
return typeof key === "string" && key !== "" ? key : null;
|
|
14
|
+
}
|
|
@@ -1,9 +1,14 @@
|
|
|
1
1
|
import type { PhisPaymentMoney } from "@phis/contracts/payments";
|
|
2
|
+
export { readPhiMoneyFieldCurrencyFieldKey } from "./money-field-currency-key";
|
|
2
3
|
export type PhiMoneyFieldConfig = {
|
|
3
4
|
/** The one currency of a single amount, or absent for a list. */
|
|
4
5
|
currency?: string;
|
|
5
|
-
/** The currencies of a list, in the order they are shown
|
|
6
|
+
/** The currencies of a list, in the order they are shown; absent for a single amount and for a list from the options. */
|
|
6
7
|
currencies?: readonly string[];
|
|
8
|
+
/** A price list whose currencies are the options' values: the field has an `optionsProvider` and neither of the two. */
|
|
9
|
+
currenciesFromOptions?: true;
|
|
10
|
+
/** The key of the Form field whose value is the one amount's currency, in place of `currency`. */
|
|
11
|
+
currencyField?: string;
|
|
7
12
|
/** The least and the most an amount may be, in minor units; every entry of a list is held to them. */
|
|
8
13
|
min?: string;
|
|
9
14
|
max?: string;
|
|
@@ -12,9 +17,27 @@ export type PhiMoneyFieldConfig = {
|
|
|
12
17
|
export type PhiMoneyFieldAmounts = Readonly<Record<string, string>>;
|
|
13
18
|
/**
|
|
14
19
|
* The field's config, read strictly (`strict-config-reader.ts`): a value present and wrong is a
|
|
15
|
-
* `PhiConfigError` naming the field, never a default put in its place.
|
|
20
|
+
* `PhiConfigError` naming the field, never a default put in its place. `hasOptionsProvider` says whether
|
|
21
|
+
* the field names an `optionsProvider`; with one, neither `currency` nor `currencies` may be set, because
|
|
22
|
+
* a list given twice would leave open which one counts.
|
|
16
23
|
*/
|
|
17
|
-
export declare function readPhiMoneyFieldConfig(config: Readonly<Record<string, unknown>> | undefined
|
|
24
|
+
export declare function readPhiMoneyFieldConfig(config: Readonly<Record<string, unknown>> | undefined, { hasOptionsProvider }?: {
|
|
25
|
+
hasOptionsProvider?: boolean;
|
|
26
|
+
}): PhiMoneyFieldConfig;
|
|
27
|
+
/**
|
|
28
|
+
* The currencies of a list from the options: each option's value an ISO 4217 code a payment accepts, in
|
|
29
|
+
* the Provider's order, then every currency the value holds that the options leave out. An option that
|
|
30
|
+
* is not such a code throws -- the Provider answered something that is not a currency, and guessing past
|
|
31
|
+
* it would show a price under the wrong name.
|
|
32
|
+
*/
|
|
33
|
+
export declare function readPhiMoneyFieldOptionCurrencies(options: readonly {
|
|
34
|
+
value: unknown;
|
|
35
|
+
}[] | undefined, value: unknown): readonly string[];
|
|
36
|
+
/**
|
|
37
|
+
* The currency a `currencyField` amount is in: the other field's value, `null` while it names none. A
|
|
38
|
+
* value that is a code a payment does not accept throws, as a config naming one does.
|
|
39
|
+
*/
|
|
40
|
+
export declare function readPhiMoneyFieldLinkedCurrency(currencyField: string, values: Readonly<Record<string, unknown>> | null | undefined): string | null;
|
|
18
41
|
/**
|
|
19
42
|
* The value a single-amount field was given, or `null` for none. Anything else -- another currency, an
|
|
20
43
|
* amount that is not a canonical minor string -- is a record that does not fit the Form, and saying so
|
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
import { isPhiRecord } from "../../helpers/is-record";
|
|
2
2
|
import { comparePhiMinorAmounts, isPhiMinorAmount, PHI_MINOR_AMOUNT_MAX, readPhiCurrencyExponent, } from "../../helpers/money-amount";
|
|
3
3
|
import { createPhiConfigReader } from "../widgets/config/strict-config-reader";
|
|
4
|
+
export { readPhiMoneyFieldCurrencyFieldKey } from "./money-field-currency-key";
|
|
4
5
|
function readCurrency(reader, key, value) {
|
|
5
6
|
return typeof value === "string" && readPhiCurrencyExponent(value) !== undefined
|
|
6
7
|
? value
|
|
@@ -15,14 +16,21 @@ function readMinorBound(reader, key) {
|
|
|
15
16
|
}
|
|
16
17
|
/**
|
|
17
18
|
* The field's config, read strictly (`strict-config-reader.ts`): a value present and wrong is a
|
|
18
|
-
* `PhiConfigError` naming the field, never a default put in its place.
|
|
19
|
+
* `PhiConfigError` naming the field, never a default put in its place. `hasOptionsProvider` says whether
|
|
20
|
+
* the field names an `optionsProvider`; with one, neither `currency` nor `currencies` may be set, because
|
|
21
|
+
* a list given twice would leave open which one counts.
|
|
19
22
|
*/
|
|
20
|
-
export function readPhiMoneyFieldConfig(config) {
|
|
23
|
+
export function readPhiMoneyFieldConfig(config, { hasOptionsProvider = false } = {}) {
|
|
21
24
|
const reader = createPhiConfigReader(config ?? {}, "config");
|
|
22
25
|
const hasCurrency = reader.has("currency");
|
|
23
26
|
const hasCurrencies = reader.has("currencies");
|
|
24
|
-
|
|
25
|
-
|
|
27
|
+
const hasCurrencyField = reader.has("currencyField");
|
|
28
|
+
const set = [hasCurrency, hasCurrencies, hasCurrencyField, hasOptionsProvider].filter(Boolean).length;
|
|
29
|
+
if (set !== 1) {
|
|
30
|
+
const key = hasOptionsProvider
|
|
31
|
+
? (hasCurrency ? "currency" : hasCurrencies ? "currencies" : "currencyField")
|
|
32
|
+
: hasCurrencyField && (hasCurrency || hasCurrencies) ? "currencyField" : "currency";
|
|
33
|
+
return reader.fail(key, "exactly one of `currency` (one amount), `currencyField` (one amount in the currency another field holds), `currencies` (one amount per currency) or an `optionsProvider` naming the currencies", config?.[key]);
|
|
26
34
|
}
|
|
27
35
|
const min = readMinorBound(reader, "min");
|
|
28
36
|
const max = readMinorBound(reader, "max");
|
|
@@ -30,6 +38,12 @@ export function readPhiMoneyFieldConfig(config) {
|
|
|
30
38
|
reader.fail("max", `at least the minimum ${min}`);
|
|
31
39
|
}
|
|
32
40
|
const bounds = { ...(min === undefined ? {} : { min }), ...(max === undefined ? {} : { max }) };
|
|
41
|
+
if (hasOptionsProvider)
|
|
42
|
+
return { currenciesFromOptions: true, ...bounds };
|
|
43
|
+
if (hasCurrencyField) {
|
|
44
|
+
const currencyField = reader.string("currencyField");
|
|
45
|
+
return currencyField ? { currencyField, ...bounds } : reader.fail("currencyField", "the key of another field of the Form", currencyField);
|
|
46
|
+
}
|
|
33
47
|
if (hasCurrency) {
|
|
34
48
|
return { currency: readCurrency(reader, "currency", reader.string("currency")), ...bounds };
|
|
35
49
|
}
|
|
@@ -41,6 +55,42 @@ export function readPhiMoneyFieldConfig(config) {
|
|
|
41
55
|
reader.fail("currencies", "each currency once");
|
|
42
56
|
return { currencies, ...bounds };
|
|
43
57
|
}
|
|
58
|
+
/**
|
|
59
|
+
* The currencies of a list from the options: each option's value an ISO 4217 code a payment accepts, in
|
|
60
|
+
* the Provider's order, then every currency the value holds that the options leave out. An option that
|
|
61
|
+
* is not such a code throws -- the Provider answered something that is not a currency, and guessing past
|
|
62
|
+
* it would show a price under the wrong name.
|
|
63
|
+
*/
|
|
64
|
+
export function readPhiMoneyFieldOptionCurrencies(options, value) {
|
|
65
|
+
const currencies = [];
|
|
66
|
+
for (const option of options ?? []) {
|
|
67
|
+
const code = option.value;
|
|
68
|
+
if (typeof code !== "string" || readPhiCurrencyExponent(code) === undefined) {
|
|
69
|
+
throw new Error(`A money field's options name ${describe(code)}; each option's value is an ISO 4217 currency code a payment accepts.`);
|
|
70
|
+
}
|
|
71
|
+
if (!currencies.includes(code))
|
|
72
|
+
currencies.push(code);
|
|
73
|
+
}
|
|
74
|
+
if (isPhiRecord(value)) {
|
|
75
|
+
for (const code of Object.keys(value)) {
|
|
76
|
+
if (!currencies.includes(code) && readPhiCurrencyExponent(code) !== undefined)
|
|
77
|
+
currencies.push(code);
|
|
78
|
+
}
|
|
79
|
+
}
|
|
80
|
+
return currencies;
|
|
81
|
+
}
|
|
82
|
+
/**
|
|
83
|
+
* The currency a `currencyField` amount is in: the other field's value, `null` while it names none. A
|
|
84
|
+
* value that is a code a payment does not accept throws, as a config naming one does.
|
|
85
|
+
*/
|
|
86
|
+
export function readPhiMoneyFieldLinkedCurrency(currencyField, values) {
|
|
87
|
+
const code = values?.[currencyField];
|
|
88
|
+
if (code === undefined || code === null || code === "")
|
|
89
|
+
return null;
|
|
90
|
+
if (typeof code === "string" && readPhiCurrencyExponent(code) !== undefined)
|
|
91
|
+
return code;
|
|
92
|
+
throw new Error(`A money field takes its currency from "${currencyField}", which holds ${describe(code)}; it holds an ISO 4217 currency code a payment accepts.`);
|
|
93
|
+
}
|
|
44
94
|
function describe(value) {
|
|
45
95
|
return JSON.stringify(value) ?? String(value);
|
|
46
96
|
}
|
|
@@ -14,6 +14,10 @@ const PhiLazySegmentedFormControl = lazyPhiFormFieldControl(() => import("./choi
|
|
|
14
14
|
const PhiLazyNumberFormControl = lazyPhiFormFieldControl(() => import("./extended-form-field-controls").then((module) => module.PhiNumberFormControl));
|
|
15
15
|
const PhiLazyStorageSizeFormControl = lazyPhiFormFieldControl(() => import("./extended-form-field-controls").then((module) => module.PhiStorageSizeFormControl));
|
|
16
16
|
const PhiLazyMoneyFormControl = lazyPhiFormFieldControl(() => import("./extended-form-field-controls").then((module) => module.PhiMoneyFormControl));
|
|
17
|
+
const PhiLazyCountryFormControl = lazyPhiFormFieldControl(() => import("./structured-form-field-controls").then((module) => module.PhiCountryFormControl));
|
|
18
|
+
// Eight parts in six rows.
|
|
19
|
+
const PhiLazyAddressFormControl = lazyPhiFormFieldControl(() => import("./structured-form-field-controls").then((module) => module.PhiAddressFormControl), 6);
|
|
20
|
+
const PhiLazyFlagsFormControl = lazyPhiFormFieldControl(() => import("./structured-form-field-controls").then((module) => module.PhiFlagsFormControl), 2);
|
|
17
21
|
const PhiLazySliderFormControl = lazyPhiFormFieldControl(() => import("./extended-form-field-controls").then((module) => module.PhiSliderFormControl));
|
|
18
22
|
const PhiLazyCascaderFormControl = lazyPhiFormFieldControl(() => import("./extended-form-field-controls").then((module) => module.PhiCascaderFormControl));
|
|
19
23
|
const PhiLazyDateTimeFormControl = lazyPhiFormFieldControl(() => import("./datetime-form-control").then((module) => module.PhiDateTimeFormControl));
|
|
@@ -128,6 +132,15 @@ export const PHI_SHARED_FORM_PROVIDER_REGISTRY = createPhiFormProviderRegistry({
|
|
|
128
132
|
phiSharedFieldType(PHI_FORM_FIELD_PROVIDER_KEYS.money, {
|
|
129
133
|
Control: PhiLazyMoneyFormControl,
|
|
130
134
|
}),
|
|
135
|
+
phiSharedFieldType(PHI_FORM_FIELD_PROVIDER_KEYS.country, {
|
|
136
|
+
Control: PhiLazyCountryFormControl,
|
|
137
|
+
}),
|
|
138
|
+
phiSharedFieldType(PHI_FORM_FIELD_PROVIDER_KEYS.address, {
|
|
139
|
+
Control: PhiLazyAddressFormControl,
|
|
140
|
+
}),
|
|
141
|
+
phiSharedFieldType(PHI_FORM_FIELD_PROVIDER_KEYS.flags, {
|
|
142
|
+
Control: PhiLazyFlagsFormControl,
|
|
143
|
+
}),
|
|
131
144
|
],
|
|
132
145
|
validationRules: [
|
|
133
146
|
phiSharedValidationRule(PHI_FORM_VALIDATION_PROVIDER_KEYS.required, {
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* The `address` field's own wording, read from the Form's Label Set under these keys and falling back to
|
|
3
|
+
* English, as the Media fields' are: one label per part, the sentence for each required part left empty,
|
|
4
|
+
* one for a part longer than Core stores (`%1` the part's label, `%2` the most characters) and one for a
|
|
5
|
+
* country that is no code of the list. A Form that places an address field states them in its Label Set.
|
|
6
|
+
*/
|
|
7
|
+
export declare const PHI_FORM_ADDRESS_LABEL_KEYS: {
|
|
8
|
+
readonly name: "addressName";
|
|
9
|
+
readonly companyName: "addressCompanyName";
|
|
10
|
+
readonly line1: "addressLine1";
|
|
11
|
+
readonly line2: "addressLine2";
|
|
12
|
+
readonly postalCode: "addressPostalCode";
|
|
13
|
+
readonly city: "addressCity";
|
|
14
|
+
readonly region: "addressRegion";
|
|
15
|
+
readonly country: "addressCountry";
|
|
16
|
+
readonly nameRequired: "addressNameRequired";
|
|
17
|
+
readonly line1Required: "addressLine1Required";
|
|
18
|
+
readonly cityRequired: "addressCityRequired";
|
|
19
|
+
readonly countryRequired: "addressCountryRequired";
|
|
20
|
+
readonly tooLong: "addressTooLong";
|
|
21
|
+
};
|
|
22
|
+
export type PhiFormAddressLabels = Record<keyof typeof PHI_FORM_ADDRESS_LABEL_KEYS, string>;
|
|
23
|
+
/** The address field's words from the Form's Label Set, each empty one in English. */
|
|
24
|
+
export declare function readPhiFormAddressLabels(labels: Readonly<Record<string, string>> | undefined): PhiFormAddressLabels;
|
|
@@ -0,0 +1,43 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* The `address` field's own wording, read from the Form's Label Set under these keys and falling back to
|
|
3
|
+
* English, as the Media fields' are: one label per part, the sentence for each required part left empty,
|
|
4
|
+
* one for a part longer than Core stores (`%1` the part's label, `%2` the most characters) and one for a
|
|
5
|
+
* country that is no code of the list. A Form that places an address field states them in its Label Set.
|
|
6
|
+
*/
|
|
7
|
+
export const PHI_FORM_ADDRESS_LABEL_KEYS = {
|
|
8
|
+
name: "addressName",
|
|
9
|
+
companyName: "addressCompanyName",
|
|
10
|
+
line1: "addressLine1",
|
|
11
|
+
line2: "addressLine2",
|
|
12
|
+
postalCode: "addressPostalCode",
|
|
13
|
+
city: "addressCity",
|
|
14
|
+
region: "addressRegion",
|
|
15
|
+
country: "addressCountry",
|
|
16
|
+
nameRequired: "addressNameRequired",
|
|
17
|
+
line1Required: "addressLine1Required",
|
|
18
|
+
cityRequired: "addressCityRequired",
|
|
19
|
+
countryRequired: "addressCountryRequired",
|
|
20
|
+
tooLong: "addressTooLong",
|
|
21
|
+
};
|
|
22
|
+
const PHI_FORM_ADDRESS_DEFAULT_LABELS = {
|
|
23
|
+
name: "Name",
|
|
24
|
+
companyName: "Company",
|
|
25
|
+
line1: "Street and number",
|
|
26
|
+
line2: "Address line 2",
|
|
27
|
+
postalCode: "Postal code",
|
|
28
|
+
city: "City",
|
|
29
|
+
region: "Region",
|
|
30
|
+
country: "Country",
|
|
31
|
+
nameRequired: "Enter the name the address is made out to.",
|
|
32
|
+
line1Required: "Enter the street and number.",
|
|
33
|
+
cityRequired: "Enter the city.",
|
|
34
|
+
countryRequired: "Choose the country.",
|
|
35
|
+
tooLong: "%1 takes at most %2 characters.",
|
|
36
|
+
};
|
|
37
|
+
/** The address field's words from the Form's Label Set, each empty one in English. */
|
|
38
|
+
export function readPhiFormAddressLabels(labels) {
|
|
39
|
+
return Object.fromEntries(Object.keys(PHI_FORM_ADDRESS_LABEL_KEYS).map((key) => [
|
|
40
|
+
key,
|
|
41
|
+
labels?.[PHI_FORM_ADDRESS_LABEL_KEYS[key]]?.trim() || PHI_FORM_ADDRESS_DEFAULT_LABELS[key],
|
|
42
|
+
]));
|
|
43
|
+
}
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
import { type ComponentType } from "react";
|
|
2
|
+
import type { PhiFormFieldProviderProps } from "./form-provider-registry";
|
|
3
|
+
export declare const PhiCountryFormControl: ComponentType<PhiFormFieldProviderProps>;
|
|
4
|
+
/**
|
|
5
|
+
* One address, `PhisSiteAddressInput`, as one value. Each part is held to what Core takes -- the four
|
|
6
|
+
* required parts, the column widths, a country of the list -- and while one is not, the field holds the
|
|
7
|
+
* Form's submit with the first sentence (`formContext.holdSubmit`); a part says what is wrong with it once
|
|
8
|
+
* it has been left.
|
|
9
|
+
*/
|
|
10
|
+
export declare const PhiAddressFormControl: ComponentType<PhiFormFieldProviderProps>;
|
|
11
|
+
/** Several yes-or-no answers as one bit-flag number (`flags-field.ts`). */
|
|
12
|
+
export declare const PhiFlagsFormControl: ComponentType<PhiFormFieldProviderProps>;
|
|
@@ -0,0 +1,65 @@
|
|
|
1
|
+
"use client";
|
|
2
|
+
import { jsx as _jsx } from "react/jsx-runtime";
|
|
3
|
+
import { useCallback, useEffect, useMemo, useState } from "react";
|
|
4
|
+
import { PhiAddressControl } from "../controls/phi-address-control";
|
|
5
|
+
import { PhiCheckboxGroupControl } from "../controls/phi-checkbox-group-control";
|
|
6
|
+
import { PhiCountrySelectControl } from "../controls/phi-country-select-control";
|
|
7
|
+
import { PHI_ADDRESS_PARTS, findPhiAddressProblems, readPhiAddressFieldValue, } from "../../helpers/address-field";
|
|
8
|
+
import { readPhiFlagsFieldConfig, readPhiFlagsFieldValue, writePhiFlagsFieldValue } from "./flags-field";
|
|
9
|
+
import { readPhiFormAddressLabels } from "./structured-field-labels";
|
|
10
|
+
/*
|
|
11
|
+
* The fields whose value has a shape of its own -- a country code, an address, a bit-flag number --
|
|
12
|
+
* loaded only where one is rendered.
|
|
13
|
+
*/
|
|
14
|
+
export const PhiCountryFormControl = ({ id, field, value, onChange, placeholder, disabled, readOnly, }) => (_jsx(PhiCountrySelectControl, { id: id, value: typeof value === "string" ? value : null, placeholder: placeholder, allowClear: field.config?.allowClear === true, disabled: disabled, readOnly: readOnly, onChange: (code) => onChange?.(code ?? undefined) }));
|
|
15
|
+
function describeProblem(problem, labels) {
|
|
16
|
+
if (problem.kind === "tooLong") {
|
|
17
|
+
return labels.tooLong.replace("%1", labels[problem.part]).replace("%2", String(problem.max));
|
|
18
|
+
}
|
|
19
|
+
switch (problem.part) {
|
|
20
|
+
case "name": return labels.nameRequired;
|
|
21
|
+
case "line1": return labels.line1Required;
|
|
22
|
+
case "city": return labels.cityRequired;
|
|
23
|
+
default: return labels.countryRequired;
|
|
24
|
+
}
|
|
25
|
+
}
|
|
26
|
+
/**
|
|
27
|
+
* One address, `PhisSiteAddressInput`, as one value. Each part is held to what Core takes -- the four
|
|
28
|
+
* required parts, the column widths, a country of the list -- and while one is not, the field holds the
|
|
29
|
+
* Form's submit with the first sentence (`formContext.holdSubmit`); a part says what is wrong with it once
|
|
30
|
+
* it has been left.
|
|
31
|
+
*/
|
|
32
|
+
export const PhiAddressFormControl = ({ id, field, value, onChange, labels, disabled, readOnly, formContext, }) => {
|
|
33
|
+
const address = readPhiAddressFieldValue(value);
|
|
34
|
+
const words = useMemo(() => readPhiFormAddressLabels(labels), [labels]);
|
|
35
|
+
const problems = findPhiAddressProblems(address);
|
|
36
|
+
const [left, setLeft] = useState(() => new Set());
|
|
37
|
+
const hold = problems[0] ? describeProblem(problems[0], words) : null;
|
|
38
|
+
const holdSubmit = formContext?.holdSubmit;
|
|
39
|
+
/*
|
|
40
|
+
* A refused submit leaves every part, so each wrong part says its own sentence under itself. Written
|
|
41
|
+
* under the whole field as well, the first sentence stood a second time below the country.
|
|
42
|
+
*/
|
|
43
|
+
const showEveryPart = useCallback(() => setLeft(new Set(PHI_ADDRESS_PARTS)), [setLeft]);
|
|
44
|
+
useEffect(() => {
|
|
45
|
+
holdSubmit?.(field.key, hold, showEveryPart);
|
|
46
|
+
}, [field.key, hold, holdSubmit, showEveryPart]);
|
|
47
|
+
useEffect(() => () => holdSubmit?.(field.key, null), [field.key, holdSubmit]);
|
|
48
|
+
const errors = {};
|
|
49
|
+
for (const problem of problems) {
|
|
50
|
+
if (left.has(problem.part) && !errors[problem.part])
|
|
51
|
+
errors[problem.part] = describeProblem(problem, words);
|
|
52
|
+
}
|
|
53
|
+
return (_jsx(PhiAddressControl, { id: id, value: address, labels: Object.fromEntries(PHI_ADDRESS_PARTS.map((part) => [part, words[part]])), errors: errors, disabled: disabled, readOnly: readOnly, onChange: (next) => onChange?.(next), onPartBlur: (part) => setLeft((current) => (current.has(part) ? current : new Set([...current, part]))) }));
|
|
54
|
+
};
|
|
55
|
+
/** Several yes-or-no answers as one bit-flag number (`flags-field.ts`). */
|
|
56
|
+
export const PhiFlagsFormControl = ({ field, value, onChange, options, disabled, readOnly, }) => {
|
|
57
|
+
const offered = useMemo(() => options ?? [], [options]);
|
|
58
|
+
const config = useMemo(() => readPhiFlagsFieldConfig(field.config, offered), [field.config, offered]);
|
|
59
|
+
const mask = readPhiFlagsFieldValue(value);
|
|
60
|
+
const checked = offered.filter((option) => (mask & (config.bits.get(option.value) ?? 0)) !== 0).map((option) => option.value);
|
|
61
|
+
return (_jsx(PhiCheckboxGroupControl, { vertical: true, value: checked, disabled: disabled, readOnly: readOnly, options: offered.map((option) => {
|
|
62
|
+
const needed = config.requires.get(config.bits.get(option.value) ?? 0);
|
|
63
|
+
return needed !== undefined && (mask & needed) === 0 ? { ...option, disabled: true } : option;
|
|
64
|
+
}), onChange: (next) => onChange?.(writePhiFlagsFieldValue(config, mask, next)) }));
|
|
65
|
+
};
|
|
@@ -279,7 +279,7 @@ export function PhiOverlayContainerClient({ overlayId, overlayType, config: rawC
|
|
|
279
279
|
*/
|
|
280
280
|
const surfaceStyle = { ...resolvePhiCmsContainerSurface(config).style, padding: 0 };
|
|
281
281
|
if (overlayType === "drawer") {
|
|
282
|
-
return (_jsxs(_Fragment, { children: [zoneControllers, _jsx(PhiDrawerControl, { open: open, title: runtimeTitle, header: renderZone(zones?.header), body: renderZone(zones?.body), footer: renderZone(zones?.footer), closable: behaviour.closable, keyboard: behaviour.keyboard, mask: behaviour.mask, mountPolicy: config.mountPolicy, placement: config.placement, size: config.size, maxSize: config.maxSize, resizable: behaviour.resizable, push: behaviour.push, containerStyle: surfaceStyle, onDismiss: requestClose, panelRef: panelRef })] }));
|
|
282
|
+
return (_jsxs(_Fragment, { children: [zoneControllers, _jsx(PhiDrawerControl, { open: open, title: runtimeTitle, header: renderZone(zones?.header), body: renderZone(zones?.body), footer: renderZone(zones?.footer), closable: behaviour.closable, keyboard: behaviour.keyboard, mask: behaviour.mask, mountPolicy: config.mountPolicy, placement: config.placement, size: config.size, minSize: config.minSize, maxSize: config.maxSize, resizable: behaviour.resizable, push: behaviour.push, containerStyle: surfaceStyle, onDismiss: requestClose, panelRef: panelRef })] }));
|
|
283
283
|
}
|
|
284
|
-
return (_jsxs(_Fragment, { children: [zoneControllers, _jsx(PhiModalControl, { open: open, title: runtimeTitle, header: renderZone(zones?.header), body: renderZone(zones?.body == null ? null : _jsx(PhiDialogBodyProvider, { children: zones.body })), footer: renderZone(zones?.footer), closable: behaviour.closable, keyboard: behaviour.keyboard, mask: behaviour.mask, mountPolicy: config.mountPolicy, centered: behaviour.centered, controlSize: runtimeControlSize ?? config.controlSize, size:
|
|
284
|
+
return (_jsxs(_Fragment, { children: [zoneControllers, _jsx(PhiModalControl, { open: open, title: runtimeTitle, header: renderZone(zones?.header), body: renderZone(zones?.body == null ? null : _jsx(PhiDialogBodyProvider, { children: zones.body })), footer: renderZone(zones?.footer), closable: behaviour.closable, keyboard: behaviour.keyboard, mask: behaviour.mask, mountPolicy: config.mountPolicy, centered: behaviour.centered, controlSize: runtimeControlSize ?? config.controlSize, size: config.size, minSize: config.minSize, maxSize: config.maxSize, toldSize: runtimeSize, containerStyle: surfaceStyle, onDismiss: requestClose, panelRef: panelRef })] }));
|
|
285
285
|
}
|
|
@@ -7,7 +7,7 @@ import { resolveRenderableBlockEffectsAttributes, resolveRenderableBlockEffectsS
|
|
|
7
7
|
import { resolvePhiShellRegionChrome, resolvePhiShellRegionGroundStyle, resolvePhiShellRegionTypography, resolvePhiShellRegionZIndex, resolvePhiShellSiderCollapsedWidth, resolvePhiShellSiderWidth, } from "../../helpers/shell-region-style";
|
|
8
8
|
import { PhiCmsFlags } from "../../constants/phi-cms";
|
|
9
9
|
import { resolvePhiCmsBorderSource } from "../../types/cms-border-source";
|
|
10
|
-
import {
|
|
10
|
+
import { resolvePhiSurfaceToneGround, phiSurfaceTakesToneGround, } from "../../helpers/surface-style";
|
|
11
11
|
import { resolvePhiRenderableBlockGeometry } from "../../types/renderable-block-geometry";
|
|
12
12
|
import { createPhiSignalAddress } from "../../types/signals";
|
|
13
13
|
import { readPhiCmsRegionReveal } from "../../helpers/region-page-scope";
|
|
@@ -280,7 +280,7 @@ export function resolvePhiCmsRegionShell({ regionKey, config, shellTheme, paint,
|
|
|
280
280
|
: toneGround
|
|
281
281
|
? {
|
|
282
282
|
...(surfaceBackground ? resolvePhiBackgroundWidgetStyle(surfaceBackground) : {}),
|
|
283
|
-
backgroundColor:
|
|
283
|
+
backgroundColor: resolvePhiSurfaceToneGround(surface?.tone),
|
|
284
284
|
}
|
|
285
285
|
: backgroundConfig == null || ground != null
|
|
286
286
|
? null
|
|
@@ -1,8 +1,8 @@
|
|
|
1
|
-
import { PHI_TEXT_SOURCE_PRESET } from "../../../helpers/text-source";
|
|
1
|
+
import { PHI_TEXT_SOURCE_PRESET, PHI_TEXT_SOURCE_SITE } from "../../../helpers/text-source";
|
|
2
2
|
import { PHI_CMS_DEFAULT_SLOT_INDEX, PHI_CMS_SEQUENTIAL_LAYOUT_SLOTS, } from "../../../constants/cms-layout-types";
|
|
3
3
|
import { PHI_CORE_RUNTIME_DATA_PROVIDER_KEYS } from "../../../constants/core-data-provider-keys";
|
|
4
4
|
import { canPhiViewerAccess, PHI_VIEWER_ACCESS_PUBLISHING } from "../../../types/access";
|
|
5
|
-
import { PhiCmsPageType } from "../../../constants/phi-cms";
|
|
5
|
+
import { PhiCmsFlags, PhiCmsPageType } from "../../../constants/phi-cms";
|
|
6
6
|
import { createPhiCmsPresetNodes } from "../../../helpers/cms-preset-nodes";
|
|
7
7
|
import { readPhiServerApiCredentials } from "../../../helpers/phis-server-credentials";
|
|
8
8
|
import { createPhiPresetCmsInstanceIdMap } from "../../../types/cms-instance-id";
|
|
@@ -90,7 +90,7 @@ function buildEntryDialogNodes(nodes, input) {
|
|
|
90
90
|
config: {
|
|
91
91
|
title: input.title,
|
|
92
92
|
// Every Form of an entry is one column (helpers/cms-dialog.ts).
|
|
93
|
-
width: PHI_DIALOG_WIDTH_SINGLE_COLUMN,
|
|
93
|
+
size: { width: PHI_DIALOG_WIDTH_SINGLE_COLUMN },
|
|
94
94
|
mountPolicy: "remount",
|
|
95
95
|
/*
|
|
96
96
|
* `immediate`: there is nobody to ask. `request` exists so a Controller can refuse while a save
|
|
@@ -141,9 +141,11 @@ function buildEntryDialogNodes(nodes, input) {
|
|
|
141
141
|
typeKey: "form",
|
|
142
142
|
slotIndex: PHI_CMS_DEFAULT_SLOT_INDEX,
|
|
143
143
|
sortOrder: 10,
|
|
144
|
+
...(input.formConfigWords === "label-set" ? { flags: PhiCmsFlags.NoTranslate } : {}),
|
|
144
145
|
label: `${input.routePrefix} ${input.key} form`,
|
|
145
146
|
config: {
|
|
146
147
|
formId: input.formId,
|
|
148
|
+
...(input.formConfigWords === "site" ? { textSource: PHI_TEXT_SOURCE_SITE } : {}),
|
|
147
149
|
/*
|
|
148
150
|
* The Table's own resource, so the Form reads the row that was pressed rather than asking Core a
|
|
149
151
|
* second time, and `openActionKey` decides which action it reads for. A Form with no source has
|
|
@@ -315,6 +317,7 @@ export async function buildPhiContentEntryEditorPageTree({ page, runtime, kind,
|
|
|
315
317
|
openActionKey: "new",
|
|
316
318
|
bindsRecord: false,
|
|
317
319
|
formConfig: entryFormConfig,
|
|
320
|
+
formConfigWords: "site",
|
|
318
321
|
saveLabel: widgetLabels.form.save,
|
|
319
322
|
cancelLabel: widgetLabels.form.cancel,
|
|
320
323
|
ids: {
|
|
@@ -333,6 +336,7 @@ export async function buildPhiContentEntryEditorPageTree({ page, runtime, kind,
|
|
|
333
336
|
openActionKey: "edit",
|
|
334
337
|
bindsRecord: true,
|
|
335
338
|
formConfig: entryFormConfig,
|
|
339
|
+
formConfigWords: "site",
|
|
336
340
|
saveLabel: widgetLabels.form.save,
|
|
337
341
|
cancelLabel: widgetLabels.form.cancel,
|
|
338
342
|
ids: {
|
|
@@ -386,6 +390,8 @@ export async function buildPhiContentEntryEditorPageTree({ page, runtime, kind,
|
|
|
386
390
|
typeKey: "table",
|
|
387
391
|
slotIndex: PHI_CMS_SEQUENTIAL_LAYOUT_SLOTS[1].slotIndex,
|
|
388
392
|
sortOrder: 10,
|
|
393
|
+
// The kind's Label Set, translated already.
|
|
394
|
+
flags: PhiCmsFlags.NoTranslate,
|
|
389
395
|
label: kindLabels.widgetLabel,
|
|
390
396
|
config: {
|
|
391
397
|
source,
|
|
@@ -620,6 +626,7 @@ function buildPublisherParts({ nodes, ids, kind, routePrefix, entryShared, widge
|
|
|
620
626
|
[PHI_CONTENT_ENTRY_CURATION_NONE_CONFIG_KEYS.author]: widgetLabels.curation.authorNone,
|
|
621
627
|
[PHI_CONTENT_ENTRY_CURATION_NONE_CONFIG_KEYS.category]: widgetLabels.curation.categoryNone,
|
|
622
628
|
},
|
|
629
|
+
formConfigWords: "label-set",
|
|
623
630
|
saveLabel: widgetLabels.form.save,
|
|
624
631
|
cancelLabel: widgetLabels.form.cancel,
|
|
625
632
|
ids: {
|
|
@@ -670,6 +677,8 @@ function buildPublisherParts({ nodes, ids, kind, routePrefix, entryShared, widge
|
|
|
670
677
|
typeKey: "table",
|
|
671
678
|
slotIndex: PHI_CMS_SEQUENTIAL_LAYOUT_SLOTS[2].slotIndex,
|
|
672
679
|
sortOrder: 20,
|
|
680
|
+
// The kind's Label Set, translated already.
|
|
681
|
+
flags: PhiCmsFlags.NoTranslate,
|
|
673
682
|
label: labels.widgetLabel,
|
|
674
683
|
config: {
|
|
675
684
|
source: categoriesSource,
|
|
@@ -16,7 +16,10 @@ import type { PhiCmsPageNode, PhiResolvedCmsPageTree } from "../../../types/cms"
|
|
|
16
16
|
* external address nor another Area's root is a place in the Area. Neither is the path the redirecting page itself answers: an Area root whose sidebar still carries an item pointing
|
|
17
17
|
* at "/" would forward to itself forever, which is the whole reason `skipPath` exists.
|
|
18
18
|
*/
|
|
19
|
-
export declare function findFirstPhiCmsNavigationLinkPath(items: readonly PhiCmsResolvedNavigationItem[], skipPath?: string
|
|
19
|
+
export declare function findFirstPhiCmsNavigationLinkPath(items: readonly PhiCmsResolvedNavigationItem[], skipPath?: string, options?: {
|
|
20
|
+
isVisible?: (item: PhiCmsResolvedNavigationItem) => boolean;
|
|
21
|
+
acceptsPath?: (path: string) => boolean;
|
|
22
|
+
}): string | null;
|
|
20
23
|
/**
|
|
21
24
|
* A page that resolves by forwarding.
|
|
22
25
|
*
|
|
@@ -16,15 +16,18 @@ import { readPhiCmsNavigationTargetPath } from "../../../helpers/navigation-targ
|
|
|
16
16
|
* external address nor another Area's root is a place in the Area. Neither is the path the redirecting page itself answers: an Area root whose sidebar still carries an item pointing
|
|
17
17
|
* at "/" would forward to itself forever, which is the whole reason `skipPath` exists.
|
|
18
18
|
*/
|
|
19
|
-
export function findFirstPhiCmsNavigationLinkPath(items, skipPath) {
|
|
19
|
+
export function findFirstPhiCmsNavigationLinkPath(items, skipPath, options) {
|
|
20
20
|
for (const item of items) {
|
|
21
|
+
if (options?.isVisible && !options.isVisible(item)) {
|
|
22
|
+
continue;
|
|
23
|
+
}
|
|
21
24
|
const path = (item.target?.kind === "custom" && item.target.external === true) || item.target?.kind === "area"
|
|
22
25
|
? null
|
|
23
26
|
: readPhiCmsNavigationTargetPath(item.target);
|
|
24
|
-
if (item.kind === "link" && path && path !== skipPath) {
|
|
27
|
+
if (item.kind === "link" && path && path !== skipPath && (options?.acceptsPath?.(path) ?? true)) {
|
|
25
28
|
return path;
|
|
26
29
|
}
|
|
27
|
-
const childPath = findFirstPhiCmsNavigationLinkPath(item.children, skipPath);
|
|
30
|
+
const childPath = findFirstPhiCmsNavigationLinkPath(item.children, skipPath, options);
|
|
28
31
|
if (childPath) {
|
|
29
32
|
return childPath;
|
|
30
33
|
}
|
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import type { PhiCmsPageNode, PhiResolvedCmsPageTree } from "../../../types/cms";
|
|
2
2
|
import type { PhiRuntimeModuleId } from "../../../types/cms-module-descriptors";
|
|
3
|
+
import type { PhiRenderableBlockSize } from "../../../types/renderable-block";
|
|
3
4
|
import type { PhiFormWidgetPlacement, PhiWidgetPlacementSignalRoutes } from "../../../types/core-widget-placements";
|
|
4
5
|
import type { PhiFormId } from "../../../types/form-id";
|
|
5
6
|
export type PhiSettingsPageShellWidgetSection = {
|
|
@@ -117,8 +118,11 @@ export type PhiSettingsPageShellOverlay = {
|
|
|
117
118
|
*/
|
|
118
119
|
submitLabel?: string;
|
|
119
120
|
cancelLabel?: string;
|
|
120
|
-
/**
|
|
121
|
-
|
|
121
|
+
/**
|
|
122
|
+
* The Modal's `size`, for a Form that needs more or less than the Modal's own default: a block's pair,
|
|
123
|
+
* a dialog's width as `{ width: PHI_DIALOG_WIDTH_SINGLE_COLUMN }` (OVERLAYS.md, "Presentation config").
|
|
124
|
+
*/
|
|
125
|
+
size?: PhiRenderableBlockSize;
|
|
122
126
|
};
|
|
123
127
|
/**
|
|
124
128
|
* One Collapsible panel of a Settings page: the panel title becomes the Collapsible slot title, the
|
|
@@ -369,7 +369,7 @@ export function buildPhiSettingsPageShellTree({ page, ownerModuleId, presetKey,
|
|
|
369
369
|
label: overlay.title,
|
|
370
370
|
config: {
|
|
371
371
|
title: overlay.title,
|
|
372
|
-
...(overlay.
|
|
372
|
+
...(overlay.size === undefined ? {} : { size: overlay.size }),
|
|
373
373
|
/*
|
|
374
374
|
* `remount` rather than `lazy-keep`: a dialog that creates a record and one that edits a row
|
|
375
375
|
* both start from what they were given, and a body kept from the last time would open showing
|
|
@@ -8,6 +8,7 @@ import { applyPhiButtonShadowComponentTokens } from "../../theme/phi-button-shad
|
|
|
8
8
|
import { buildPhiThemeGradientTokens, readPhiThemeGradientKey } from "../../theme/phi-theme-gradients";
|
|
9
9
|
import { buildPhiThemeLinkTokens } from "../../theme/phi-link-mark";
|
|
10
10
|
import { buildPhiSurfaceShadowTokens } from "../../theme/phi-surface-shadow";
|
|
11
|
+
import { buildPhiThemeInverseGroundTokens } from "../../theme/phi-theme-inverse-ground";
|
|
11
12
|
import { buildPhiThemeCustomColorTokens } from "../../theme/phi-theme-palette";
|
|
12
13
|
import { applyPhiControlShapeComponentTokens, applyPhiSurfaceShapeComponentTokens, resolvePhiControlShape, } from "../../theme/phi-control-shape";
|
|
13
14
|
const PHI_DEFAULT_DARK_NAV_BACKGROUND = "#001529";
|
|
@@ -100,6 +101,8 @@ export function resolvePhiRootTheme({ siteTheme, mode, fonts, presets, }) {
|
|
|
100
101
|
}),
|
|
101
102
|
...buildPhiThemeLinkTokens(siteTheme?.links),
|
|
102
103
|
...buildPhiSurfaceShadowTokens(siteTheme?.shadows, mode),
|
|
104
|
+
// What an inverse box stands on in this mode: the Theme's stated colour, else this mode's container ground.
|
|
105
|
+
...buildPhiThemeInverseGroundTokens(siteTheme?.root?.inverse, mode, effectiveThemeTokens),
|
|
103
106
|
};
|
|
104
107
|
return {
|
|
105
108
|
mode,
|
|
@@ -127,15 +127,8 @@ export type PhiAntdIconPresentation = {
|
|
|
127
127
|
ariaLabel?: string;
|
|
128
128
|
twoToneColor?: string;
|
|
129
129
|
};
|
|
130
|
-
|
|
131
|
-
* The names `PhiIcon` resolves to an Ant Design icon, bare or after `antd:`.
|
|
132
|
-
*
|
|
133
|
-
* The navigation and management names (`dashboard`, `team`, `translation`, ...) used to sit in a second,
|
|
134
|
-
* separately loaded registry; with every icon its own chunk there is nothing left to keep apart.
|
|
135
|
-
*/
|
|
136
|
-
export declare const PHI_ANTD_ICON_NAMES: Readonly<Record<string, PhiAntdIconKey>>;
|
|
130
|
+
export { PHI_ANTD_ICON_NAMES } from "./phi-icon-names";
|
|
137
131
|
export declare function PhiAntdIcon({ icon, size, style, className, title, ariaLabel, twoToneColor, }: {
|
|
138
132
|
icon: PhiAntdIconKey;
|
|
139
133
|
size?: number | string;
|
|
140
134
|
} & PhiAntdIconPresentation): import("react").JSX.Element;
|
|
141
|
-
export {};
|