@phis/ui 0.7.8 → 0.8.1
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 +15 -7
- package/components/cms/phi-cms-render-diagnostic-client.d.ts +3 -1
- package/components/cms/phi-cms-render-diagnostic-client.js +4 -3
- package/components/cms/phi-cms-render-diagnostic.d.ts +8 -2
- package/components/cms/phi-cms-render-diagnostic.js +12 -2
- package/components/cms/phi-cms-render-error-boundary.d.ts +2 -0
- package/components/cms/phi-cms-render-error-boundary.js +1 -1
- package/components/cms/phi-cms-root-layout.js +3 -1
- 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 +52 -8
- package/components/controls/phi-media-picker-control.d.ts +9 -0
- package/components/controls/phi-media-picker-control.js +1 -1
- 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-popover-control.js +4 -1
- 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/controls/phi-table-control.d.ts +7 -1
- package/components/controls/phi-table-control.js +23 -8
- package/components/forms/flags-field.d.ts +22 -0
- package/components/forms/flags-field.js +58 -0
- package/components/forms/form-descriptor-field-check.d.ts +18 -0
- package/components/forms/form-descriptor-field-check.js +41 -0
- package/components/forms/form-descriptor-runtime-client.js +11 -10
- 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 +23 -0
- package/components/forms/form-provider-contract.js +36 -0
- package/components/forms/form-provider-registry.d.ts +5 -1
- package/components/forms/form-record-source.d.ts +38 -0
- package/components/forms/form-record-source.js +48 -0
- package/components/forms/shared-form-descriptors.d.ts +0 -34
- package/components/forms/shared-form-descriptors.js +0 -6
- package/components/forms/shared-form-ids.d.ts +1 -1
- package/components/forms/shared-form-ids.js +1 -1
- 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/media/media-settings-labels.d.ts +1 -0
- package/components/media/media-settings-labels.js +2 -0
- package/components/media/phi-media-picker-binding.d.ts +41 -33
- package/components/media/phi-media-picker-binding.js +2 -1
- package/components/media/use-media-library-add-picker.d.ts +33 -32
- package/components/overlays/phi-overlay-container-client.js +13 -11
- 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/phi-settings-page-shell-tree.d.ts +13 -2
- package/components/regions/presets/phi-settings-page-shell-tree.js +4 -4
- 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 +22 -0
- package/components/shell/phi-icon-names.js +267 -0
- package/components/shell/phi-icon.d.ts +4 -15
- package/components/shell/phi-icon.js +9 -50
- package/components/tables/client/phi-table-binding-params.d.ts +24 -0
- package/components/tables/client/phi-table-binding-params.js +39 -0
- package/components/tables/client/phi-table-binding.d.ts +1 -3
- package/components/tables/client/phi-table-binding.js +5 -9
- package/components/widgets/client/shared/phi-button-icons.d.ts +6 -4
- package/components/widgets/client/shared/phi-button-icons.js +8 -12
- package/components/widgets/client/shared/phi-collection-binding-params.d.ts +8 -0
- package/components/widgets/client/shared/phi-collection-binding-params.js +13 -0
- package/components/widgets/client/shared/phi-collection-provider.d.ts +11 -1
- package/components/widgets/client/shared/phi-collection-provider.js +5 -0
- package/components/widgets/client/shared/phi-collection-view-binding.d.ts +1 -0
- package/components/widgets/client/shared/phi-command-buttons.d.ts +29 -2
- package/components/widgets/client/shared/phi-command-buttons.js +19 -5
- package/components/widgets/client/shared/phi-rendered-value.js +27 -3
- 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 +3 -5
- package/components/widgets/label-sets/admin-users.js +6 -10
- package/components/widgets/label-sets/builder-modules.js +4 -0
- package/components/widgets/label-sets/effects.js +2 -4
- package/components/widgets/label-sets/profile.d.ts +13 -16
- package/components/widgets/label-sets/profile.js +24 -33
- package/components/widgets/label-sets/registration.d.ts +0 -1
- package/components/widgets/label-sets/registration.js +0 -2
- package/components/widgets/label-sets/revisions.js +2 -0
- package/components/widgets/label-sets/search-results.js +2 -4
- package/components/widgets/label-sets/signals.js +2 -0
- package/components/widgets/label-sets/table.js +9 -0
- package/components/widgets/label-types/builder-modules.d.ts +4 -0
- package/components/widgets/label-types/builder-modules.js +2 -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/revisions.d.ts +2 -0
- package/components/widgets/label-types/revisions.js +2 -1
- 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/signals.d.ts +2 -0
- package/components/widgets/label-types/signals.js +1 -0
- 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/components/widgets/shared/widget-failure-audience.d.ts +7 -0
- package/components/widgets/shared/widget-failure-audience.js +21 -0
- package/components/widgets/shared/widget-failure-client.js +5 -2
- package/components/widgets/shared/widget-failure-notice-client.d.ts +6 -0
- package/components/widgets/shared/widget-failure-notice-client.js +10 -0
- package/components/widgets/shared/widget-failure-notice.d.ts +6 -0
- package/components/widgets/shared/widget-failure-notice.js +17 -0
- package/components/widgets/shared/widget-failure-staff.d.ts +3 -0
- package/components/widgets/shared/widget-failure-staff.js +18 -0
- package/components/widgets/shared/widget-failure.d.ts +9 -6
- package/components/widgets/shared/widget-failure.js +0 -9
- package/components/widgets/shared/widget-failure.server.d.ts +4 -2
- package/components/widgets/shared/widget-failure.server.js +8 -3
- package/constants/countries.d.ts +9 -0
- package/constants/countries.js +28 -0
- package/constants/customer-file.d.ts +34 -0
- package/constants/customer-file.js +35 -0
- package/constants/record-field-kinds.d.ts +15 -0
- package/constants/record-field-kinds.js +13 -0
- package/constants/runtime-module-ownership.js +15 -2
- package/constants/runtime-render-client-types.d.ts +5 -0
- package/constants/runtime-render-client-types.js +5 -0
- package/constants/site-address.d.ts +9 -0
- package/constants/site-address.js +10 -0
- package/constants/table-loading.d.ts +14 -0
- package/constants/table-loading.js +14 -0
- package/{plugins/runtime-modules/threads/controller/address.js → constants/threads-controller-address.js} +1 -1
- package/constants.d.ts +2 -0
- package/constants.js +4 -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-cms-write-validation.js +19 -3
- 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/announced-action.d.ts +17 -0
- package/helpers/announced-action.js +29 -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/phi-metadata.d.ts +25 -1
- package/helpers/phi-metadata.js +53 -1
- package/helpers/phi-site-description.d.ts +11 -0
- package/helpers/phi-site-description.js +13 -0
- package/helpers/preset-form-check.d.ts +14 -0
- package/helpers/preset-form-check.js +12 -0
- package/helpers/preset-table-check.d.ts +38 -0
- package/helpers/preset-table-check.js +118 -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/record-widget-binding.d.ts +10 -0
- package/helpers/record-widget-binding.js +35 -0
- package/helpers/record-widget.d.ts +1 -10
- package/helpers/record-widget.js +4 -33
- 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/table-widget-binding.d.ts +12 -0
- package/helpers/table-widget-binding.js +296 -0
- 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/helpers/tree-widget-binding.d.ts +19 -0
- package/helpers/tree-widget-binding.js +72 -0
- package/helpers/typed-confirmation.d.ts +9 -0
- package/helpers/typed-confirmation.js +13 -0
- package/helpers/widget-binding-check.d.ts +22 -0
- package/helpers/widget-binding-check.js +91 -0
- package/module-labels.d.ts +1 -1
- package/module-labels.js +1 -1
- package/module-page-check.d.ts +3 -0
- package/module-page-check.js +3 -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 -4
- 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 +14 -0
- package/plugins/runtime-modules/accounting/ids.js +34 -0
- package/plugins/runtime-modules/accounting/presets.js +32 -5
- package/plugins/runtime-modules/accounting/trees/accounting-customer-file-label-set.d.ts +78 -0
- package/plugins/runtime-modules/accounting/trees/accounting-customer-file-label-set.js +136 -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 +29 -0
- package/plugins/runtime-modules/accounting/trees/phi-default-accounting-customer-file-page-tree.js +450 -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 +43 -0
- package/plugins/runtime-modules/app/data-providers.js +45 -0
- package/plugins/runtime-modules/app/definition.d.ts +60 -1
- package/plugins/runtime-modules/app/definition.js +2 -0
- package/plugins/runtime-modules/app/forms.d.ts +33 -3
- package/plugins/runtime-modules/app/forms.js +166 -31
- package/plugins/runtime-modules/app/ids.d.ts +8 -0
- package/plugins/runtime-modules/app/ids.js +9 -0
- package/plugins/runtime-modules/app/module.d.ts +60 -1
- package/plugins/runtime-modules/app/services/addresses-collection.d.ts +59 -0
- package/plugins/runtime-modules/app/services/addresses-collection.js +105 -0
- package/plugins/runtime-modules/app/trees/account-addresses-panel.d.ts +21 -0
- package/plugins/runtime-modules/app/trees/account-addresses-panel.js +143 -0
- package/plugins/runtime-modules/app/trees/addresses-label-set.d.ts +57 -0
- package/plugins/runtime-modules/app/trees/addresses-label-set.js +104 -0
- package/plugins/runtime-modules/app/trees/phi-default-app-profile-page-tree.d.ts +1 -2
- package/plugins/runtime-modules/app/trees/phi-default-app-profile-page-tree.js +28 -19
- package/plugins/runtime-modules/app/trees/profile-label-set.d.ts +1 -2
- package/plugins/runtime-modules/app/trees/profile-label-set.js +5 -14
- package/plugins/runtime-modules/asset/presets.d.ts +4 -0
- package/plugins/runtime-modules/asset/trees/phi-default-admin-media-settings-page-tree.js +5 -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-config-field.js +16 -6
- package/plugins/runtime-modules/builder/clients/inspector-image-field.d.ts +2 -1
- package/plugins/runtime-modules/builder/clients/inspector-image-field.js +6 -3
- package/plugins/runtime-modules/builder/clients/inspector-section-widget.js +3 -1
- 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/draft-status-controller.js +28 -1
- package/plugins/runtime-modules/builder/controller/signal-wiring-controller.js +5 -1
- package/plugins/runtime-modules/builder/developer-workspace-types.d.ts +5 -0
- 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.js +4 -0
- package/plugins/runtime-modules/builder/public-route-collisions.js +8 -3
- package/plugins/runtime-modules/builder/signal-wiring-options.js +9 -2
- package/plugins/runtime-modules/builder/trees/phi-builder-inspector-area-overlay-tree.server.js +8 -1
- package/plugins/runtime-modules/builder/trees/phi-default-builder-area-preset-tree.js +47 -7
- 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/client-manifests/common.js +6 -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 +23 -0
- package/plugins/runtime-modules/core/form-providers.d.ts +23 -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 +1 -2
- 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/collection-view/client.js +5 -2
- package/plugins/runtime-modules/core/widgets/collection-view/config.js +8 -0
- package/plugins/runtime-modules/core/widgets/collection-view/site-address-binding.d.ts +55 -0
- package/plugins/runtime-modules/core/widgets/collection-view/site-address-binding.js +173 -0
- package/plugins/runtime-modules/core/widgets/collection-view/site-address-tiles.d.ts +48 -0
- package/plugins/runtime-modules/core/widgets/collection-view/site-address-tiles.js +67 -0
- 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/description/config.d.ts +1 -1
- package/plugins/runtime-modules/core/widgets/dimension/config.d.ts +1 -1
- package/plugins/runtime-modules/core/widgets/entry-list/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/form/config.d.ts +1 -1
- package/plugins/runtime-modules/core/widgets/form/config.js +14 -1
- package/plugins/runtime-modules/core/widgets/gallery/config.d.ts +1 -1
- 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/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/record/client.js +2 -6
- package/plugins/runtime-modules/core/widgets/result/config.d.ts +1 -1
- package/plugins/runtime-modules/core/widgets/simple-text/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/table/client.js +48 -51
- package/plugins/runtime-modules/core/widgets/table/config.d.ts +3 -3
- package/plugins/runtime-modules/core/widgets/table/config.js +9 -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/core/widgets/thread-conversation/client.js +2 -2
- package/plugins/runtime-modules/core/widgets/thread-conversation/config.d.ts +6 -2
- package/plugins/runtime-modules/core/widgets/thread-conversation/config.js +6 -1
- package/plugins/runtime-modules/core/widgets/thread-widget-config.d.ts +10 -0
- package/plugins/runtime-modules/core/widgets/thread-widget-config.js +6 -0
- package/plugins/runtime-modules/core/widgets/tree/client.js +6 -6
- 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/editor-translations-widget-label-set.d.ts +2 -0
- package/plugins/runtime-modules/localization/trees/editor-translations-widget-label-set.js +2 -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 +9 -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/resolver.js +17 -0
- package/plugins/runtime-modules/revisions/controller/binding.d.ts +37 -0
- package/plugins/runtime-modules/revisions/controller/binding.js +75 -0
- package/plugins/runtime-modules/revisions/controller/client.d.ts +5 -0
- package/plugins/runtime-modules/revisions/controller/client.js +86 -60
- package/plugins/runtime-modules/revisions/controller/definition.d.ts +5 -0
- package/plugins/runtime-modules/revisions/controller/definition.js +10 -0
- 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/forms.js +1 -1
- package/plugins/runtime-modules/revisions/page-ids.d.ts +1 -1
- package/plugins/runtime-modules/revisions/page-ids.js +4 -1
- package/plugins/runtime-modules/revisions/presets.d.ts +4 -0
- package/plugins/runtime-modules/revisions/services/options.js +14 -4
- package/plugins/runtime-modules/revisions/services/table.js +54 -25
- package/plugins/runtime-modules/revisions/trees/phi-default-builder-revisions-page-tree.js +79 -4
- package/plugins/runtime-modules/search/widgets/search-results/client.js +4 -2
- package/plugins/runtime-modules/theme/controller/runtime.js +14 -2
- package/plugins/runtime-modules/theme/presets.d.ts +4 -0
- package/plugins/runtime-modules/theme/widgets/brand-controls/client.js +105 -7
- 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 +10 -0
- package/plugins/runtime-modules/threads/controller/client.js +62 -2
- package/plugins/runtime-modules/threads/controller/definition.js +49 -1
- package/plugins/runtime-modules/threads/data-providers.d.ts +100 -2
- package/plugins/runtime-modules/threads/data-providers.js +96 -0
- package/plugins/runtime-modules/threads/definition.d.ts +100 -2
- package/plugins/runtime-modules/threads/definition.js +1 -1
- package/plugins/runtime-modules/threads/ids.d.ts +4 -0
- package/plugins/runtime-modules/threads/ids.js +5 -0
- package/plugins/runtime-modules/threads/services/customer-file-addresses.d.ts +30 -0
- package/plugins/runtime-modules/threads/services/customer-file-addresses.js +59 -0
- package/plugins/runtime-modules/threads/services/customer-file-read.d.ts +22 -0
- package/plugins/runtime-modules/threads/services/customer-file-read.js +101 -0
- package/plugins/runtime-modules/threads/services/customer-file-table.d.ts +126 -0
- package/plugins/runtime-modules/threads/services/customer-file-table.js +79 -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 +90 -0
- package/plugins/runtime-modules/user-management/trees/admin-users-access-label-set.js +122 -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 +181 -0
- package/plugins/runtime-modules/user-management/trees/phi-default-admin-users-page-tree.js +24 -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/runtime.js +0 -1
- package/server-helpers/search-text.js +3 -0
- package/server-helpers.d.ts +1 -1
- package/server-helpers.js +1 -1
- package/styles/controls.css +4 -2
- package/styles/layout.css +7 -0
- package/styles/shell.css +30 -6
- package/theme/phi-antd-token-resolver.d.ts +8 -0
- package/theme/phi-antd-token-resolver.js +10 -0
- package/theme/phi-theme-color.d.ts +19 -0
- package/theme/phi-theme-color.js +42 -0
- package/theme/phi-theme-composition.js +9 -0
- package/theme/phi-theme-gradients.js +4 -22
- package/theme/phi-theme-inverse-ground.d.ts +39 -0
- package/theme/phi-theme-inverse-ground.js +103 -0
- package/theme/phi-theme-palette-defaults.d.ts +16 -0
- package/theme/phi-theme-palette-defaults.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 +20 -3
- package/types/cms.d.ts +10 -0
- package/types/collection-provider.d.ts +27 -0
- package/types/collection-signal-values.d.ts +2 -0
- package/types/collection-signal-values.js +23 -0
- package/types/collection-view-widget.d.ts +9 -0
- package/types/core-widget-placements.d.ts +9 -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/signals.d.ts +2 -0
- package/types/signals.js +2 -0
- 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 +29 -1
- package/types/table-widget.js +0 -282
- package/types/tree-widget.d.ts +0 -1
- package/types/tree-widget.js +0 -60
- package/types/widget-runtime.d.ts +3 -1
- package/types.d.ts +2 -1
- package/types.js +1 -1
- /package/{plugins/runtime-modules/threads/controller/address.d.ts → constants/threads-controller-address.d.ts} +0 -0
|
@@ -0,0 +1,296 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* A Table's config against the resource its Provider declares: columns, filters, sorting, the counted
|
|
3
|
+
* footer, every Provider action in its scope with the confirmation and danger the resource asks for
|
|
4
|
+
* (TABLES.md, "Checked where it is made").
|
|
5
|
+
*
|
|
6
|
+
* Checked where a config is made -- a package's preset tests (`checkPhiPresetTables`), `pnpm verify`, the
|
|
7
|
+
* Builder's save (`gateway/site-cms-write-validation.ts`) -- and never in the browser or the render of a
|
|
8
|
+
* request: a live Table trusts the config it is handed, and this file is kept out of every live Client
|
|
9
|
+
* graph for that reason.
|
|
10
|
+
*/
|
|
11
|
+
export function validatePhiTableWidgetBinding(config, resource) {
|
|
12
|
+
const errors = [];
|
|
13
|
+
/*
|
|
14
|
+
* A count shown needs a count given. The rows of one page are not the query's, so a Table that says
|
|
15
|
+
* how many there are, or how many pages, is bound to a resource that counts -- or one that does not
|
|
16
|
+
* page and so answers every row at once (`query.total`).
|
|
17
|
+
*/
|
|
18
|
+
const resourceCounts = resource.query.total === true ||
|
|
19
|
+
(resource.query.pagination !== "offset" && resource.query.pagination !== "cursor");
|
|
20
|
+
if (!resourceCounts) {
|
|
21
|
+
const footer = config.presentation.footer;
|
|
22
|
+
const shownSources = [
|
|
23
|
+
...(footer?.values ?? []).map((item) => item.value),
|
|
24
|
+
...(footer?.variants ?? []).flatMap((variant) => [variant.when.value, ...(variant.values ?? []).map((item) => item.value)]),
|
|
25
|
+
...(config.presentation.summary?.rows ?? []).flatMap((row) => row.cells.map((cell) => cell.item.value)),
|
|
26
|
+
];
|
|
27
|
+
const counted = shownSources.find((source) => source.source === "core" && (source.fieldKey === "totalRows" || source.fieldKey === "pageCount"));
|
|
28
|
+
if (counted) {
|
|
29
|
+
errors.push(`Table shows "${counted.fieldKey}", but resource "${resource.resourceKey}" pages without a count ` +
|
|
30
|
+
"(declare query.total on a resource that answers total).");
|
|
31
|
+
}
|
|
32
|
+
}
|
|
33
|
+
const fields = new Set(resource.fields.map((field) => field.key));
|
|
34
|
+
const fieldsByKey = new Map(resource.fields.map((field) => [field.key, field]));
|
|
35
|
+
const columns = config.presentation.columns;
|
|
36
|
+
const columnKeys = new Set();
|
|
37
|
+
for (const column of columns) {
|
|
38
|
+
if (!column.key.trim() || columnKeys.has(column.key)) {
|
|
39
|
+
errors.push("Table columns require unique non-empty keys.");
|
|
40
|
+
break;
|
|
41
|
+
}
|
|
42
|
+
columnKeys.add(column.key);
|
|
43
|
+
if (!column.fieldKey.trim() || !fields.has(column.fieldKey)) {
|
|
44
|
+
errors.push(`Table column "${column.key}" references undeclared field "${column.fieldKey}".`);
|
|
45
|
+
}
|
|
46
|
+
if (column.sortable && !fields.has(column.sortField ?? column.fieldKey)) {
|
|
47
|
+
errors.push(`Table column "${column.key}" references an undeclared sort field.`);
|
|
48
|
+
}
|
|
49
|
+
const field = fieldsByKey.get(column.fieldKey);
|
|
50
|
+
if (column.editor && !field?.mutable) {
|
|
51
|
+
errors.push(`Table column "${column.key}" cannot edit read-only field "${column.fieldKey}".`);
|
|
52
|
+
}
|
|
53
|
+
if (column.titleDisplay === "icon" && !column.titleIcon) {
|
|
54
|
+
errors.push(`Table column "${column.key}" hides its title without a title icon.`);
|
|
55
|
+
}
|
|
56
|
+
if (column.iconFieldKey !== undefined) {
|
|
57
|
+
const iconField = fieldsByKey.get(column.iconFieldKey);
|
|
58
|
+
if (!iconField) {
|
|
59
|
+
errors.push(`Table column "${column.key}" references undeclared icon field "${column.iconFieldKey}".`);
|
|
60
|
+
}
|
|
61
|
+
else if (iconField.type !== "icon") {
|
|
62
|
+
errors.push(`Table column "${column.key}" icon field "${column.iconFieldKey}" must be an icon field.`);
|
|
63
|
+
}
|
|
64
|
+
}
|
|
65
|
+
if (column.imageFieldKey !== undefined) {
|
|
66
|
+
const imageField = fieldsByKey.get(column.imageFieldKey);
|
|
67
|
+
if (!imageField) {
|
|
68
|
+
errors.push(`Table column "${column.key}" references undeclared image field "${column.imageFieldKey}".`);
|
|
69
|
+
}
|
|
70
|
+
else if (imageField.type !== "string") {
|
|
71
|
+
errors.push(`Table column "${column.key}" image field "${column.imageFieldKey}" must be a string field.`);
|
|
72
|
+
}
|
|
73
|
+
}
|
|
74
|
+
if (column.editor && field?.type === "json") {
|
|
75
|
+
errors.push(`Table column "${column.key}" cannot use an implicit JSON editor.`);
|
|
76
|
+
}
|
|
77
|
+
const editorControlCompatible = !column.editor?.control ||
|
|
78
|
+
(field?.type === "boolean" && (column.editor.control === "switch" || column.editor.control === "checkbox")) ||
|
|
79
|
+
(field?.type === "icon" && column.editor.control === "icon-picker") ||
|
|
80
|
+
(field?.type === "enum" && (column.editor.control === "select" || column.editor.control === "radio" ||
|
|
81
|
+
column.editor.control === "segmented")) ||
|
|
82
|
+
// A string chosen from a list: the row's options, or the placement's own (`editor.options`).
|
|
83
|
+
(field?.type === "string" && (Boolean(field.rowOptionsPath) || column.editor.options !== undefined) &&
|
|
84
|
+
column.editor.control === "select") ||
|
|
85
|
+
(field?.type === "string" && column.editor.control === "textarea") ||
|
|
86
|
+
(field?.type === "enum[]" && (column.editor.control === "multi-select" ||
|
|
87
|
+
column.editor.control === "checkbox-group"));
|
|
88
|
+
if (column.editor && !editorControlCompatible) {
|
|
89
|
+
errors.push(`Table column "${column.key}" editor is incompatible with field "${column.fieldKey}".`);
|
|
90
|
+
}
|
|
91
|
+
const rendererCompatible = !column.renderer || column.renderer === "text" ||
|
|
92
|
+
(column.renderer === "switch" && field?.type === "boolean") ||
|
|
93
|
+
(column.renderer === "checkbox" && field?.type === "boolean") ||
|
|
94
|
+
(column.renderer === "icon" && field?.type === "icon") ||
|
|
95
|
+
(column.renderer === "image" && field?.type === "string") ||
|
|
96
|
+
((column.renderer === "date" || column.renderer === "datetime") && field?.type === column.renderer) ||
|
|
97
|
+
(column.renderer === "json" && field?.type === "json") ||
|
|
98
|
+
(column.renderer === "tags" && (field?.type === "json" || field?.type === "enum[]")) ||
|
|
99
|
+
((column.renderer === "money" || column.renderer === "interval") && field?.type === "json") ||
|
|
100
|
+
((column.renderer === "email" || column.renderer === "link" || column.renderer === "code" ||
|
|
101
|
+
column.renderer === "badge") && (field?.type === "string" || field?.type === "enum"));
|
|
102
|
+
if (!rendererCompatible) {
|
|
103
|
+
errors.push(`Table column "${column.key}" renderer is incompatible with field "${column.fieldKey}".`);
|
|
104
|
+
}
|
|
105
|
+
if (config.presentation.layout.mode === "fixed" && column.sizing?.mode === "content") {
|
|
106
|
+
errors.push(`Table column "${column.key}" cannot use content sizing with fixed Table layout.`);
|
|
107
|
+
}
|
|
108
|
+
if (!column.hidden && column.sticky && config.presentation.layout.overflowX !== "auto") {
|
|
109
|
+
errors.push(`Sticky Table column "${column.key}" requires automatic horizontal overflow.`);
|
|
110
|
+
}
|
|
111
|
+
}
|
|
112
|
+
const summaryFields = new Set(resource.summaryFields?.map((field) => field.key) ?? []);
|
|
113
|
+
const validateSummaryItem = (item, owner) => {
|
|
114
|
+
if (!item.key.trim())
|
|
115
|
+
errors.push(`${owner} requires a non-empty item key.`);
|
|
116
|
+
if (item.value.source === "provider" && !summaryFields.has(item.value.fieldKey)) {
|
|
117
|
+
errors.push(`${owner} references undeclared Provider summary field "${item.value.fieldKey}".`);
|
|
118
|
+
}
|
|
119
|
+
};
|
|
120
|
+
const footerValueKeys = new Set();
|
|
121
|
+
const footer = config.presentation.footer;
|
|
122
|
+
for (const binding of footer?.values ?? []) {
|
|
123
|
+
if (footerValueKeys.has(binding.key))
|
|
124
|
+
errors.push("Table footer value keys must be unique.");
|
|
125
|
+
footerValueKeys.add(binding.key);
|
|
126
|
+
validateSummaryItem({ key: binding.key, value: binding.value }, `Table footer value "${binding.key}"`);
|
|
127
|
+
}
|
|
128
|
+
if (footer) {
|
|
129
|
+
const placeholderIndexes = new Set([...footer.template.matchAll(/%([1-9]\d*)/g)].map((match) => Number(match[1])));
|
|
130
|
+
// A sentence of its own is a footer too (the reader and PhiTableFooterVariant allow `values: []`):
|
|
131
|
+
// only its placeholders and its values must match.
|
|
132
|
+
if (!footer.template.trim() ||
|
|
133
|
+
footer.values.some((_value, index) => !placeholderIndexes.has(index + 1)) ||
|
|
134
|
+
[...placeholderIndexes].some((index) => index > footer.values.length)) {
|
|
135
|
+
errors.push("Table footer template placeholders must match its ordered values.");
|
|
136
|
+
}
|
|
137
|
+
}
|
|
138
|
+
const summaryRowKeys = new Set();
|
|
139
|
+
for (const row of config.presentation.summary?.rows ?? []) {
|
|
140
|
+
if (!row.key.trim() || summaryRowKeys.has(row.key)) {
|
|
141
|
+
errors.push("Table summary rows require unique non-empty keys.");
|
|
142
|
+
}
|
|
143
|
+
summaryRowKeys.add(row.key);
|
|
144
|
+
const cellKeys = new Set();
|
|
145
|
+
const occupiedColumns = new Set();
|
|
146
|
+
for (const cell of row.cells) {
|
|
147
|
+
if (!cell.key.trim() || cellKeys.has(cell.key)) {
|
|
148
|
+
errors.push(`Table summary row "${row.key}" requires unique non-empty cell keys.`);
|
|
149
|
+
}
|
|
150
|
+
cellKeys.add(cell.key);
|
|
151
|
+
if (!columnKeys.has(cell.columnKey) || cell.throughColumnKey && !columnKeys.has(cell.throughColumnKey)) {
|
|
152
|
+
errors.push(`Table summary cell "${cell.key}" references an undeclared column.`);
|
|
153
|
+
}
|
|
154
|
+
else {
|
|
155
|
+
const start = columns.findIndex((column) => column.key === cell.columnKey);
|
|
156
|
+
const end = cell.throughColumnKey
|
|
157
|
+
? columns.findIndex((column) => column.key === cell.throughColumnKey)
|
|
158
|
+
: start;
|
|
159
|
+
if (end < start) {
|
|
160
|
+
errors.push(`Table summary cell "${cell.key}" has a backwards column span.`);
|
|
161
|
+
}
|
|
162
|
+
else {
|
|
163
|
+
for (const column of columns.slice(start, end + 1)) {
|
|
164
|
+
if (occupiedColumns.has(column.key)) {
|
|
165
|
+
errors.push(`Table summary row "${row.key}" contains overlapping cells.`);
|
|
166
|
+
break;
|
|
167
|
+
}
|
|
168
|
+
occupiedColumns.add(column.key);
|
|
169
|
+
}
|
|
170
|
+
}
|
|
171
|
+
}
|
|
172
|
+
validateSummaryItem(cell.item, `Table summary cell "${cell.key}"`);
|
|
173
|
+
}
|
|
174
|
+
}
|
|
175
|
+
if (config.presentation.layout.mode === "fixed" &&
|
|
176
|
+
columns.every((column) => column.hidden || (column.sizing?.mode ?? "content") !== "fill")) {
|
|
177
|
+
errors.push("Fixed Table layout requires at least one visible fill column.");
|
|
178
|
+
}
|
|
179
|
+
if (config.presentation.layout.mode !== "fixed" && columns.some((column) => column.ellipsis)) {
|
|
180
|
+
errors.push("Ellipsis requires fixed Table layout.");
|
|
181
|
+
}
|
|
182
|
+
const sortingMode = config.features.sorting?.mode ?? "none";
|
|
183
|
+
const providerSorting = resource.query.sorting ?? "none";
|
|
184
|
+
if (sortingMode !== "none" && providerSorting === "none") {
|
|
185
|
+
errors.push(`Table resource "${resource.resourceKey}" does not support sorting.`);
|
|
186
|
+
}
|
|
187
|
+
else if (sortingMode === "multiple" && providerSorting !== "multiple") {
|
|
188
|
+
errors.push(`Table resource "${resource.resourceKey}" does not support multiple sorting.`);
|
|
189
|
+
}
|
|
190
|
+
if (config.features.search?.enabled && resource.query.search !== true) {
|
|
191
|
+
errors.push(`Table resource "${resource.resourceKey}" does not support search.`);
|
|
192
|
+
}
|
|
193
|
+
if (config.features.pagination?.enabled !== false && resource.query.pagination === "none") {
|
|
194
|
+
errors.push(`Table resource "${resource.resourceKey}" does not support pagination.`);
|
|
195
|
+
}
|
|
196
|
+
for (const sort of config.features.sorting?.defaultSorts ?? []) {
|
|
197
|
+
if (!fields.has(sort.key))
|
|
198
|
+
errors.push(`Table default sort "${sort.key}" is not declared by the resource.`);
|
|
199
|
+
}
|
|
200
|
+
const filterFields = new Set(resource.query.filterFields ?? []);
|
|
201
|
+
for (const filter of config.features.filters ?? []) {
|
|
202
|
+
const keys = filter.type === "dateRange" ? [filter.startKey, filter.endKey] : [filter.key];
|
|
203
|
+
for (const key of keys) {
|
|
204
|
+
if (!filterFields.has(key))
|
|
205
|
+
errors.push(`Table filter "${key}" is not declared by the resource.`);
|
|
206
|
+
}
|
|
207
|
+
}
|
|
208
|
+
const structure = config.features.structure;
|
|
209
|
+
if (structure?.mode === "tree" &&
|
|
210
|
+
resource.hierarchy?.parentRowIdentityPath !== structure.parentRowIdentityPath) {
|
|
211
|
+
errors.push(`Table resource "${resource.resourceKey}" does not declare the selected hierarchy.`);
|
|
212
|
+
}
|
|
213
|
+
if (structure?.mode === "tree" && !columns.some((column) => column.key === structure.expandColumnKey && !column.hidden)) {
|
|
214
|
+
errors.push(`Table tree expand column "${structure.expandColumnKey}" is not a visible configured column.`);
|
|
215
|
+
}
|
|
216
|
+
if (resource.hierarchy?.canAcceptChildrenField) {
|
|
217
|
+
const acceptanceField = fieldsByKey.get(resource.hierarchy.canAcceptChildrenField);
|
|
218
|
+
if (acceptanceField?.type !== "boolean") {
|
|
219
|
+
errors.push(`Table resource "${resource.resourceKey}" child-acceptance field must be a declared boolean field.`);
|
|
220
|
+
}
|
|
221
|
+
}
|
|
222
|
+
if (config.features.editing?.mode === "none" && columns.some((column) => column.editor)) {
|
|
223
|
+
errors.push("Editable Table columns require cell editing mode.");
|
|
224
|
+
}
|
|
225
|
+
if (config.features.rowReordering?.enabled) {
|
|
226
|
+
const requiredOrdering = structure?.mode === "tree" ? "tree" : "flat";
|
|
227
|
+
if (resource.rowOrdering !== requiredOrdering) {
|
|
228
|
+
errors.push(`Table resource "${resource.resourceKey}" does not support ${requiredOrdering} row ordering.`);
|
|
229
|
+
}
|
|
230
|
+
}
|
|
231
|
+
const providerActions = new Map(resource.actions?.map((action) => [action.key, action]) ?? []);
|
|
232
|
+
const bindingFields = new Map(resource.bindingFields?.map((field) => [field.key, field]) ?? []);
|
|
233
|
+
const configuredBindingKeys = new Set();
|
|
234
|
+
for (const bindingTool of config.features.tools?.bindingFields ?? []) {
|
|
235
|
+
if (configuredBindingKeys.has(bindingTool.key)) {
|
|
236
|
+
errors.push(`Table binding field "${bindingTool.key}" is configured more than once.`);
|
|
237
|
+
continue;
|
|
238
|
+
}
|
|
239
|
+
configuredBindingKeys.add(bindingTool.key);
|
|
240
|
+
const bindingField = bindingFields.get(bindingTool.key);
|
|
241
|
+
if (!bindingField) {
|
|
242
|
+
errors.push(`Table binding field "${bindingTool.key}" is not declared by resource "${resource.resourceKey}".`);
|
|
243
|
+
continue;
|
|
244
|
+
}
|
|
245
|
+
if (bindingField.create) {
|
|
246
|
+
const action = providerActions.get(bindingField.create.actionKey);
|
|
247
|
+
if (!action || action.scope !== "resource" || action.valueType !== "string") {
|
|
248
|
+
errors.push(`Table binding field "${bindingTool.key}" create action must be a declared string-valued resource action.`);
|
|
249
|
+
}
|
|
250
|
+
if (!bindingTool.create)
|
|
251
|
+
errors.push(`Table binding field "${bindingTool.key}" needs Widget create-tool presentation.`);
|
|
252
|
+
else if (!bindingTool.create.display) {
|
|
253
|
+
errors.push(`Table binding field "${bindingTool.key}" create tool requires explicit display presentation.`);
|
|
254
|
+
}
|
|
255
|
+
}
|
|
256
|
+
else if (bindingTool.create) {
|
|
257
|
+
errors.push(`Table binding field "${bindingTool.key}" configures create presentation without a Provider create capability.`);
|
|
258
|
+
}
|
|
259
|
+
if (bindingTool.create && (bindingTool.create.display === "icon" || bindingTool.create.display === "icon-label") &&
|
|
260
|
+
!bindingTool.create.icon?.trim()) {
|
|
261
|
+
errors.push(`Table binding field "${bindingTool.key}" create tool needs an icon for display "${bindingTool.create.display}".`);
|
|
262
|
+
}
|
|
263
|
+
}
|
|
264
|
+
for (const [scope, actions] of [
|
|
265
|
+
["resource", config.features.actions?.toolbar ?? []],
|
|
266
|
+
["row", config.features.actions?.row ?? []],
|
|
267
|
+
["selection", config.features.actions?.bulk ?? []],
|
|
268
|
+
]) {
|
|
269
|
+
for (const action of actions) {
|
|
270
|
+
if (!action.display) {
|
|
271
|
+
errors.push(`Table action "${action.key}" requires explicit display presentation.`);
|
|
272
|
+
}
|
|
273
|
+
if ((action.display === "icon" || action.display === "icon-label") && !action.icon?.trim()) {
|
|
274
|
+
errors.push(`Table action "${action.key}" needs an icon for display "${action.display}".`);
|
|
275
|
+
}
|
|
276
|
+
if (action.execution !== "provider")
|
|
277
|
+
continue;
|
|
278
|
+
const capability = providerActions.get(action.key);
|
|
279
|
+
if (!capability) {
|
|
280
|
+
errors.push(`Table action "${action.key}" is not declared by resource "${resource.resourceKey}".`);
|
|
281
|
+
}
|
|
282
|
+
else if (capability.scope !== scope) {
|
|
283
|
+
errors.push(`Table action "${action.key}" cannot be placed in the ${scope} action scope.`);
|
|
284
|
+
}
|
|
285
|
+
else {
|
|
286
|
+
if (capability.confirmation === "required" && !action.confirm?.title.trim()) {
|
|
287
|
+
errors.push(`Table action "${action.key}" requires Widget confirmation presentation.`);
|
|
288
|
+
}
|
|
289
|
+
if (capability.intent === "destructive" && action.mode !== "danger") {
|
|
290
|
+
errors.push(`Destructive Table action "${action.key}" requires danger presentation.`);
|
|
291
|
+
}
|
|
292
|
+
}
|
|
293
|
+
}
|
|
294
|
+
}
|
|
295
|
+
return errors;
|
|
296
|
+
}
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* What a cell shows and what a condition reads, neither of which is a flag.
|
|
3
|
+
*
|
|
4
|
+
* `state` is the name a badge draws and `archived` and `locked` the answers a row action asks for; the
|
|
5
|
+
* enum values are strings because that is what an enum column and a condition compare against. The
|
|
6
|
+
* status itself stays on the row, because the filter above is written against what the route takes.
|
|
7
|
+
*
|
|
8
|
+
* One badge, so one state wins: archived over everything, then unread -- a message waiting to be read is
|
|
9
|
+
* what the reader acts on, and a lock is read in the conversation once it is open -- then locked.
|
|
10
|
+
*
|
|
11
|
+
* Foundation, because two listings read Core's inbox rows: Core's thread inbox and the threads Module's
|
|
12
|
+
* customer file.
|
|
13
|
+
*/
|
|
14
|
+
export declare function readPhiThreadInboxRow(row: Record<string, unknown>): {
|
|
15
|
+
kind: string;
|
|
16
|
+
status: string;
|
|
17
|
+
archived: boolean;
|
|
18
|
+
locked: boolean;
|
|
19
|
+
state: string;
|
|
20
|
+
};
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
import { PhisThreadFlag, PhisThreadStatus } from "../constants/threads";
|
|
2
|
+
/**
|
|
3
|
+
* What a cell shows and what a condition reads, neither of which is a flag.
|
|
4
|
+
*
|
|
5
|
+
* `state` is the name a badge draws and `archived` and `locked` the answers a row action asks for; the
|
|
6
|
+
* enum values are strings because that is what an enum column and a condition compare against. The
|
|
7
|
+
* status itself stays on the row, because the filter above is written against what the route takes.
|
|
8
|
+
*
|
|
9
|
+
* One badge, so one state wins: archived over everything, then unread -- a message waiting to be read is
|
|
10
|
+
* what the reader acts on, and a lock is read in the conversation once it is open -- then locked.
|
|
11
|
+
*
|
|
12
|
+
* Foundation, because two listings read Core's inbox rows: Core's thread inbox and the threads Module's
|
|
13
|
+
* customer file.
|
|
14
|
+
*/
|
|
15
|
+
export function readPhiThreadInboxRow(row) {
|
|
16
|
+
const archived = row.status === PhisThreadStatus.Archived;
|
|
17
|
+
const locked = typeof row.flags === "number" && (row.flags & PhisThreadFlag.Locked) !== 0;
|
|
18
|
+
return {
|
|
19
|
+
...row,
|
|
20
|
+
kind: String(row.kind),
|
|
21
|
+
status: String(row.status),
|
|
22
|
+
archived,
|
|
23
|
+
locked,
|
|
24
|
+
state: archived ? "archived" : row.unread === true ? "unread" : locked ? "locked" : "open",
|
|
25
|
+
};
|
|
26
|
+
}
|
|
@@ -7,3 +7,29 @@ export type PhiTranslationParams = Record<string, PhiTranslationParamValue> | Ph
|
|
|
7
7
|
* as it is.
|
|
8
8
|
*/
|
|
9
9
|
export declare function formatPhiTranslation(input: string, params?: PhiTranslationParams): string;
|
|
10
|
+
/** A plural category as CLDR names it and `Intl.PluralRules` answers it. */
|
|
11
|
+
export type PhiPluralCategory = "zero" | "one" | "two" | "few" | "many" | "other";
|
|
12
|
+
/**
|
|
13
|
+
* A text that says a count, one template per plural category (TRANSLATIONS.md, "Count labels").
|
|
14
|
+
*
|
|
15
|
+
* `other` is required and is what every category the label does not state reads. The source language is
|
|
16
|
+
* English, which states `one` and `other`; a locale with more categories -- Polish `few` and `many`, Arabic
|
|
17
|
+
* `zero` and `two` -- reads `other` for those until a label states them. Every template carries the count
|
|
18
|
+
* as `%1`, the `one` template too: `one` is not the number 1 everywhere (French reads 0 as `one`, Russian
|
|
19
|
+
* 21), so "1 page" written out would be wrong in the very locales the category exists for.
|
|
20
|
+
*/
|
|
21
|
+
export type PhiCountLabel = {
|
|
22
|
+
readonly [C in Exclude<PhiPluralCategory, "other">]?: string;
|
|
23
|
+
} & {
|
|
24
|
+
readonly other: string;
|
|
25
|
+
};
|
|
26
|
+
/** The categories in CLDR order, the order a count label's templates are read and translated in. */
|
|
27
|
+
export declare const PHI_PLURAL_CATEGORIES: readonly PhiPluralCategory[];
|
|
28
|
+
/**
|
|
29
|
+
* The count in words: the template of the category `count` falls in for `locale`, with the count as `%1`,
|
|
30
|
+
* written as `locale` writes numbers. `locale` is the reader's -- the page's Intl locale
|
|
31
|
+
* (`usePhiIntlLocale()` in a Client, the request locale on the server) -- never the browser's, so the
|
|
32
|
+
* server's render and the hydrated page say the same words. A Provider answers the scalar count; which
|
|
33
|
+
* words it takes is decided here and nowhere else.
|
|
34
|
+
*/
|
|
35
|
+
export declare function formatPhiCountLabel(label: PhiCountLabel, count: number, locale: string): string;
|
|
@@ -23,3 +23,34 @@ export function formatPhiTranslation(input, params = 0) {
|
|
|
23
23
|
}
|
|
24
24
|
return text.replace(INDEXED_TOKEN_PATTERN, (token, position, index) => position === "1" || index === "0" ? String(params) : token);
|
|
25
25
|
}
|
|
26
|
+
/** The categories in CLDR order, the order a count label's templates are read and translated in. */
|
|
27
|
+
export const PHI_PLURAL_CATEGORIES = ["zero", "one", "two", "few", "many", "other"];
|
|
28
|
+
const pluralRulesByLocale = new Map();
|
|
29
|
+
const countFormatByLocale = new Map();
|
|
30
|
+
function readPluralRules(locale) {
|
|
31
|
+
let rules = pluralRulesByLocale.get(locale);
|
|
32
|
+
if (!rules) {
|
|
33
|
+
rules = new Intl.PluralRules(locale);
|
|
34
|
+
pluralRulesByLocale.set(locale, rules);
|
|
35
|
+
}
|
|
36
|
+
return rules;
|
|
37
|
+
}
|
|
38
|
+
function readCountFormat(locale) {
|
|
39
|
+
let format = countFormatByLocale.get(locale);
|
|
40
|
+
if (!format) {
|
|
41
|
+
format = new Intl.NumberFormat(locale);
|
|
42
|
+
countFormatByLocale.set(locale, format);
|
|
43
|
+
}
|
|
44
|
+
return format;
|
|
45
|
+
}
|
|
46
|
+
/**
|
|
47
|
+
* The count in words: the template of the category `count` falls in for `locale`, with the count as `%1`,
|
|
48
|
+
* written as `locale` writes numbers. `locale` is the reader's -- the page's Intl locale
|
|
49
|
+
* (`usePhiIntlLocale()` in a Client, the request locale on the server) -- never the browser's, so the
|
|
50
|
+
* server's render and the hydrated page say the same words. A Provider answers the scalar count; which
|
|
51
|
+
* words it takes is decided here and nowhere else.
|
|
52
|
+
*/
|
|
53
|
+
export function formatPhiCountLabel(label, count, locale) {
|
|
54
|
+
const template = label[readPluralRules(locale).select(count)] ?? label.other;
|
|
55
|
+
return formatPhiTranslation(template, [readCountFormat(locale).format(count)]);
|
|
56
|
+
}
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
import type { PhiTreeProviderResourceDescriptor, PhiTreeWidgetConfig } from "../types/tree-widget";
|
|
2
|
+
/**
|
|
3
|
+
* The parts of a Tree's config its binding reads. A preset states its config as the Tree reads it and
|
|
4
|
+
* may leave out what it does not use, so every part is optional here; a parsed config is one too.
|
|
5
|
+
*/
|
|
6
|
+
export type PhiTreeWidgetBindingConfig = {
|
|
7
|
+
presentation?: Partial<Pick<PhiTreeWidgetConfig["presentation"], "node">>;
|
|
8
|
+
features?: Partial<PhiTreeWidgetConfig["features"]>;
|
|
9
|
+
};
|
|
10
|
+
/**
|
|
11
|
+
* A Tree's config against the resource its Provider declares: the node fields it shows and edits, its
|
|
12
|
+
* binding tools, search, every Provider action in its scope with the confirmation the resource asks for,
|
|
13
|
+
* and drag and drop (TREES.md).
|
|
14
|
+
*
|
|
15
|
+
* Checked where a config is made, as the Table's is (`helpers/table-widget-binding.ts`): a package's
|
|
16
|
+
* preset tests (`checkPhiPresetTables`), `pnpm verify` and the Builder's save, never in the browser or
|
|
17
|
+
* the render of a request. A live Tree trusts the config it is handed.
|
|
18
|
+
*/
|
|
19
|
+
export declare function validatePhiTreeWidgetBinding(config: PhiTreeWidgetBindingConfig, resource: PhiTreeProviderResourceDescriptor): string[];
|
|
@@ -0,0 +1,72 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* A Tree's config against the resource its Provider declares: the node fields it shows and edits, its
|
|
3
|
+
* binding tools, search, every Provider action in its scope with the confirmation the resource asks for,
|
|
4
|
+
* and drag and drop (TREES.md).
|
|
5
|
+
*
|
|
6
|
+
* Checked where a config is made, as the Table's is (`helpers/table-widget-binding.ts`): a package's
|
|
7
|
+
* preset tests (`checkPhiPresetTables`), `pnpm verify` and the Builder's save, never in the browser or
|
|
8
|
+
* the render of a request. A live Tree trusts the config it is handed.
|
|
9
|
+
*/
|
|
10
|
+
export function validatePhiTreeWidgetBinding(config, resource) {
|
|
11
|
+
const errors = [];
|
|
12
|
+
const node = config.presentation?.node;
|
|
13
|
+
const features = config.features ?? {};
|
|
14
|
+
const fieldKeys = new Set(resource.fields.map((field) => field.key));
|
|
15
|
+
for (const key of [
|
|
16
|
+
node?.titleFieldKey,
|
|
17
|
+
node?.descriptionFieldKey,
|
|
18
|
+
node?.iconFieldKey,
|
|
19
|
+
].filter((value) => Boolean(value))) {
|
|
20
|
+
if (!fieldKeys.has(key))
|
|
21
|
+
errors.push(`Tree presentation references undeclared field "${key}".`);
|
|
22
|
+
}
|
|
23
|
+
for (const tool of features.tools?.bindingFields ?? []) {
|
|
24
|
+
if (!resource.bindingFields?.some((field) => field.key === tool.key)) {
|
|
25
|
+
errors.push(`Tree binding tool references undeclared field "${tool.key}".`);
|
|
26
|
+
}
|
|
27
|
+
}
|
|
28
|
+
if (features.search?.enabled && !resource.query.search) {
|
|
29
|
+
errors.push("Tree search requires Provider query search capability.");
|
|
30
|
+
}
|
|
31
|
+
if (features.editing?.enabled) {
|
|
32
|
+
for (const key of [
|
|
33
|
+
node?.titleEditor?.enabled ? node.titleFieldKey : null,
|
|
34
|
+
node?.iconEditor?.enabled ? node.iconFieldKey : null,
|
|
35
|
+
].filter((value) => Boolean(value))) {
|
|
36
|
+
if (!resource.fields.find((field) => field.key === key)?.mutable) {
|
|
37
|
+
errors.push(`Tree editor requires mutable Provider field "${key}".`);
|
|
38
|
+
}
|
|
39
|
+
}
|
|
40
|
+
}
|
|
41
|
+
const providerActions = new Map(resource.actions?.map((action) => [action.key, action]) ?? []);
|
|
42
|
+
for (const [scope, actions] of [
|
|
43
|
+
["resource", features.actions?.toolbar ?? []],
|
|
44
|
+
["node", features.actions?.node ?? []],
|
|
45
|
+
["selection", features.actions?.selection ?? []],
|
|
46
|
+
]) {
|
|
47
|
+
for (const action of actions) {
|
|
48
|
+
const capability = providerActions.get(action.key);
|
|
49
|
+
if (action.execution === "provider" && !capability) {
|
|
50
|
+
errors.push(`Tree action references undeclared Provider capability "${action.key}".`);
|
|
51
|
+
}
|
|
52
|
+
else if (action.execution === "provider" && capability?.scope !== scope) {
|
|
53
|
+
errors.push(`Tree action "${action.key}" requires Provider scope "${scope}".`);
|
|
54
|
+
}
|
|
55
|
+
else if (action.execution === "provider" && capability?.confirmation === "required" && !action.confirm) {
|
|
56
|
+
errors.push(`Tree action "${action.key}" requires confirmation presentation.`);
|
|
57
|
+
}
|
|
58
|
+
}
|
|
59
|
+
}
|
|
60
|
+
const dndMode = features.dnd?.mode ?? "none";
|
|
61
|
+
if ((dndMode === "source" || dndMode === "source-reorder") && !resource.dragSources?.length) {
|
|
62
|
+
errors.push("Tree source DnD requires a declared Provider drag source.");
|
|
63
|
+
}
|
|
64
|
+
const payloadType = features.dnd?.payloadType;
|
|
65
|
+
if (payloadType && !resource.dragSources?.some((source) => source.payloadType === payloadType)) {
|
|
66
|
+
errors.push(`Tree DnD references undeclared payload type "${payloadType}".`);
|
|
67
|
+
}
|
|
68
|
+
if ((dndMode === "reorder" || dndMode === "source-reorder") && resource.nodeOrdering !== "tree") {
|
|
69
|
+
errors.push("Tree reorder DnD requires Provider nodeOrdering \"tree\".");
|
|
70
|
+
}
|
|
71
|
+
return errors;
|
|
72
|
+
}
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Whether what somebody typed to confirm an act is the word they were asked for.
|
|
3
|
+
*
|
|
4
|
+
* A threshold against reflex, not a password: the word is shown to them to type (or copy), so its case
|
|
5
|
+
* and the spaces a copy brings along around it are not what is being checked. Asked to write "app" out,
|
|
6
|
+
* "App" or " app " was refused -- the person had done exactly what was asked and was told it was wrong.
|
|
7
|
+
* Every type-to-confirm in this package compares through here, so they all accept the same answers.
|
|
8
|
+
*/
|
|
9
|
+
export declare function matchesPhiTypedConfirmation(typed: unknown, expected: string): boolean;
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Whether what somebody typed to confirm an act is the word they were asked for.
|
|
3
|
+
*
|
|
4
|
+
* A threshold against reflex, not a password: the word is shown to them to type (or copy), so its case
|
|
5
|
+
* and the spaces a copy brings along around it are not what is being checked. Asked to write "app" out,
|
|
6
|
+
* "App" or " app " was refused -- the person had done exactly what was asked and was told it was wrong.
|
|
7
|
+
* Every type-to-confirm in this package compares through here, so they all accept the same answers.
|
|
8
|
+
*/
|
|
9
|
+
export function matchesPhiTypedConfirmation(typed, expected) {
|
|
10
|
+
const word = expected.trim();
|
|
11
|
+
return typeof typed === "string" && word.length > 0 &&
|
|
12
|
+
typed.trim().toLocaleLowerCase("en") === word.toLocaleLowerCase("en");
|
|
13
|
+
}
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
import type { PhiCmsConfigField } from "../types/cms-plugins";
|
|
2
|
+
/** A data Provider as its Module declares it: the key a Widget binds to and the resources it offers. */
|
|
3
|
+
export type PhiBindingCheckProvider = {
|
|
4
|
+
key: string;
|
|
5
|
+
kind?: string;
|
|
6
|
+
resources?: readonly unknown[];
|
|
7
|
+
};
|
|
8
|
+
/**
|
|
9
|
+
* What a Table, a Tree or a record Widget's config breaks of the resource it is bound to, as messages; an
|
|
10
|
+
* empty list for any other Widget, for one without a source, and for one bound to a Provider not among
|
|
11
|
+
* `providers` -- a Provider whose Module is not there is the Area's state, not the config's. `config` is
|
|
12
|
+
* the config the Widget reads: a preset's as it states it, or what the Widget's own `parseConfig` made
|
|
13
|
+
* of a stored one.
|
|
14
|
+
*/
|
|
15
|
+
export declare function checkPhiWidgetBinding(widgetType: string, config: Readonly<Record<string, unknown>>, providers: ReadonlyMap<string, PhiBindingCheckProvider>): string[];
|
|
16
|
+
/**
|
|
17
|
+
* Every icon a Widget's config names in a field its Inspector offers as an icon (`type: "icon"`, in a
|
|
18
|
+
* collection's entries too) that `PhiIcon` does not know: a Button's, a Collection View action's, a
|
|
19
|
+
* Card's. A live Widget no longer looks a name up before it draws it, so an unknown one is refused where
|
|
20
|
+
* the author chose it, by the Builder's save.
|
|
21
|
+
*/
|
|
22
|
+
export declare function checkPhiWidgetConfigIcons(fields: readonly PhiCmsConfigField[] | undefined, config: Readonly<Record<string, unknown>>): string[];
|
|
@@ -0,0 +1,91 @@
|
|
|
1
|
+
import { PhiCmsWidgetType } from "../constants/cms-widget-types";
|
|
2
|
+
import { isPhiIconNameKnown } from "../components/shell/phi-icon-names";
|
|
3
|
+
import { readPhiDotPath } from "./dot-path";
|
|
4
|
+
import { isPhiRecord } from "./is-record";
|
|
5
|
+
import { validatePhiRecordWidgetBinding } from "./record-widget-binding";
|
|
6
|
+
import { validatePhiTableWidgetBinding } from "./table-widget-binding";
|
|
7
|
+
import { validatePhiTreeWidgetBinding } from "./tree-widget-binding";
|
|
8
|
+
function findResource(provider, resourceKey) {
|
|
9
|
+
return provider.resources?.find((candidate) => candidate.resourceKey === resourceKey);
|
|
10
|
+
}
|
|
11
|
+
function readSource(config) {
|
|
12
|
+
const source = config.source;
|
|
13
|
+
return isPhiRecord(source) && typeof source.providerKey === "string" ? source : null;
|
|
14
|
+
}
|
|
15
|
+
/** The icons a Table's actions and binding tools draw: those shown with an icon, named and unknown. */
|
|
16
|
+
function checkTableIcons(config) {
|
|
17
|
+
const findings = [];
|
|
18
|
+
const actions = [
|
|
19
|
+
...(config.features?.actions?.toolbar ?? []),
|
|
20
|
+
...(config.features?.actions?.row ?? []),
|
|
21
|
+
...(config.features?.actions?.bulk ?? []),
|
|
22
|
+
];
|
|
23
|
+
for (const action of actions) {
|
|
24
|
+
if (action.display !== "label" && action.icon && !isPhiIconNameKnown(action.icon.trim())) {
|
|
25
|
+
findings.push(`Table action "${action.key}" names the icon "${action.icon}", which PhiIcon does not know.`);
|
|
26
|
+
}
|
|
27
|
+
}
|
|
28
|
+
for (const tool of config.features?.tools?.bindingFields ?? []) {
|
|
29
|
+
if (tool.create?.display !== "label" && tool.create?.icon && !isPhiIconNameKnown(tool.create.icon.trim())) {
|
|
30
|
+
findings.push(`Table binding field "${tool.key}" names the create icon "${tool.create.icon}", which PhiIcon does not know.`);
|
|
31
|
+
}
|
|
32
|
+
}
|
|
33
|
+
return findings;
|
|
34
|
+
}
|
|
35
|
+
/**
|
|
36
|
+
* What a Table, a Tree or a record Widget's config breaks of the resource it is bound to, as messages; an
|
|
37
|
+
* empty list for any other Widget, for one without a source, and for one bound to a Provider not among
|
|
38
|
+
* `providers` -- a Provider whose Module is not there is the Area's state, not the config's. `config` is
|
|
39
|
+
* the config the Widget reads: a preset's as it states it, or what the Widget's own `parseConfig` made
|
|
40
|
+
* of a stored one.
|
|
41
|
+
*/
|
|
42
|
+
export function checkPhiWidgetBinding(widgetType, config, providers) {
|
|
43
|
+
if (widgetType !== PhiCmsWidgetType.Table &&
|
|
44
|
+
widgetType !== PhiCmsWidgetType.Tree &&
|
|
45
|
+
widgetType !== PhiCmsWidgetType.Record) {
|
|
46
|
+
return [];
|
|
47
|
+
}
|
|
48
|
+
const source = readSource(config);
|
|
49
|
+
const provider = source ? providers.get(source.providerKey) : undefined;
|
|
50
|
+
if (!source || !provider)
|
|
51
|
+
return [];
|
|
52
|
+
const kind = widgetType === PhiCmsWidgetType.Table ? "Table" : widgetType === PhiCmsWidgetType.Tree ? "Tree" : "Record";
|
|
53
|
+
const missing = `${kind} is bound to resource "${String(source.resourceKey)}", which "${provider.key}" does not declare.`;
|
|
54
|
+
if (widgetType === PhiCmsWidgetType.Tree) {
|
|
55
|
+
const resource = findResource(provider, source.resourceKey);
|
|
56
|
+
return resource ? validatePhiTreeWidgetBinding(config, resource) : [missing];
|
|
57
|
+
}
|
|
58
|
+
const resource = findResource(provider, source.resourceKey);
|
|
59
|
+
if (!resource)
|
|
60
|
+
return [missing];
|
|
61
|
+
if (widgetType === PhiCmsWidgetType.Record) {
|
|
62
|
+
return validatePhiRecordWidgetBinding(config, resource);
|
|
63
|
+
}
|
|
64
|
+
const table = config;
|
|
65
|
+
return [...validatePhiTableWidgetBinding(table, resource), ...checkTableIcons(table)];
|
|
66
|
+
}
|
|
67
|
+
function checkFieldIcons(fields, value, where, findings) {
|
|
68
|
+
for (const field of fields) {
|
|
69
|
+
const fieldValue = readPhiDotPath(value, field.key);
|
|
70
|
+
if (field.type === "icon") {
|
|
71
|
+
const name = typeof fieldValue === "string" ? fieldValue.trim() : "";
|
|
72
|
+
if (name && !isPhiIconNameKnown(name)) {
|
|
73
|
+
findings.push(`${where}${field.key} names the icon "${name}", which PhiIcon does not know.`);
|
|
74
|
+
}
|
|
75
|
+
}
|
|
76
|
+
else if (field.type === "collection" && Array.isArray(fieldValue)) {
|
|
77
|
+
fieldValue.forEach((item, index) => checkFieldIcons(field.itemFields, item, `${where}${field.key}[${index}].`, findings));
|
|
78
|
+
}
|
|
79
|
+
}
|
|
80
|
+
}
|
|
81
|
+
/**
|
|
82
|
+
* Every icon a Widget's config names in a field its Inspector offers as an icon (`type: "icon"`, in a
|
|
83
|
+
* collection's entries too) that `PhiIcon` does not know: a Button's, a Collection View action's, a
|
|
84
|
+
* Card's. A live Widget no longer looks a name up before it draws it, so an unknown one is refused where
|
|
85
|
+
* the author chose it, by the Builder's save.
|
|
86
|
+
*/
|
|
87
|
+
export function checkPhiWidgetConfigIcons(fields, config) {
|
|
88
|
+
const findings = [];
|
|
89
|
+
checkFieldIcons(fields ?? [], config, "", findings);
|
|
90
|
+
return findings;
|
|
91
|
+
}
|