@phis/ui 0.8.0 → 0.8.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +9 -2
- 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-media-picker-control.d.ts +9 -0
- package/components/controls/phi-media-picker-control.js +1 -1
- package/components/controls/phi-popover-control.js +4 -1
- package/components/controls/phi-table-control.d.ts +7 -1
- package/components/controls/phi-table-control.js +26 -11
- 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-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/media/media-settings-labels.d.ts +1 -0
- package/components/media/media-settings-labels.js +2 -0
- package/components/media/media-upload-flow.d.ts +62 -5
- package/components/media/media-upload-flow.js +62 -24
- package/components/media/phi-area-upload-widget.d.ts +44 -1
- package/components/media/phi-area-upload-widget.js +32 -7
- package/components/media/phi-media-picker-binding.d.ts +41 -33
- package/components/media/phi-media-picker-binding.js +2 -1
- package/components/media/phi-media-upload.d.ts +10 -3
- package/components/media/phi-media-upload.js +11 -8
- package/components/media/use-media-library-add-picker.d.ts +33 -32
- package/components/overlays/phi-overlay-container-client.js +11 -9
- package/components/regions/presets/phi-settings-page-shell-tree.d.ts +7 -0
- package/components/regions/presets/phi-settings-page-shell-tree.js +3 -3
- package/components/shell/phi-icon-names.d.ts +3 -0
- package/components/shell/phi-icon-names.js +3 -0
- package/components/shell/phi-icon.d.ts +5 -7
- package/components/shell/phi-icon.js +8 -21
- package/components/shell/phi-widget-icon.js +1 -0
- 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/html-editor-link-node.d.ts +12 -0
- package/components/widgets/client/html-editor-link-node.js +60 -0
- package/components/widgets/client/html-editor.js +10 -6
- 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-collection-view-binding.js +33 -26
- package/components/widgets/client/shared/phi-command-buttons.d.ts +16 -0
- package/components/widgets/client/shared/phi-command-buttons.js +9 -1
- package/components/widgets/label-sets/admin-users.d.ts +1 -0
- package/components/widgets/label-sets/admin-users.js +2 -0
- package/components/widgets/label-sets/builder-modules.js +4 -0
- package/components/widgets/label-sets/profile.d.ts +0 -16
- package/components/widgets/label-sets/profile.js +0 -37
- 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/signals.js +2 -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/revisions.d.ts +2 -0
- package/components/widgets/label-types/revisions.js +2 -1
- package/components/widgets/label-types/signals.d.ts +2 -0
- package/components/widgets/label-types/signals.js +1 -0
- 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/cms-widget-types.d.ts +1 -0
- package/constants/cms-widget-types.js +3 -0
- package/constants/customer-file.d.ts +12 -3
- package/constants/customer-file.js +12 -3
- package/constants/runtime-module-ownership.js +5 -3
- 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/constants.d.ts +2 -1
- package/constants.js +3 -1
- package/gateway/site-cms-write-validation.js +19 -3
- package/gateway/site-proxy.d.ts +12 -0
- package/gateway/site-proxy.js +20 -0
- package/helpers/announced-action.d.ts +17 -0
- package/helpers/announced-action.js +29 -0
- package/helpers/phi-metadata.d.ts +0 -8
- package/helpers/phi-metadata.js +1 -10
- 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 +19 -15
- package/helpers/preset-table-check.js +33 -39
- 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/table-widget-binding.d.ts +12 -0
- package/helpers/table-widget-binding.js +296 -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-page-check.d.ts +2 -0
- package/module-page-check.js +2 -0
- package/net/phi-next-proxy.d.ts +7 -0
- package/net/phi-next-proxy.js +1 -1
- package/next/root-route.js +2 -1
- package/package.json +27 -14
- package/plugins/runtime-modules/accounting/ids.d.ts +7 -4
- package/plugins/runtime-modules/accounting/ids.js +14 -3
- package/plugins/runtime-modules/accounting/trees/accounting-customer-file-label-set.d.ts +21 -9
- package/plugins/runtime-modules/accounting/trees/accounting-customer-file-label-set.js +29 -15
- package/plugins/runtime-modules/accounting/trees/phi-default-accounting-customer-file-page-tree.d.ts +11 -8
- package/plugins/runtime-modules/accounting/trees/phi-default-accounting-customer-file-page-tree.js +206 -137
- package/plugins/runtime-modules/app/client-data-providers.js +1 -1
- package/plugins/runtime-modules/app/data-providers.d.ts +14 -69
- package/plugins/runtime-modules/app/data-providers.js +19 -54
- package/plugins/runtime-modules/app/definition.d.ts +8 -80
- package/plugins/runtime-modules/app/forms.d.ts +1 -16
- package/plugins/runtime-modules/app/forms.js +0 -59
- package/plugins/runtime-modules/app/ids.d.ts +2 -1
- package/plugins/runtime-modules/app/ids.js +3 -2
- package/plugins/runtime-modules/app/module.d.ts +8 -80
- package/plugins/runtime-modules/app/services/addresses-collection.d.ts +59 -0
- package/plugins/runtime-modules/app/services/{addresses-table.js → addresses-collection.js} +23 -19
- package/plugins/runtime-modules/app/trees/account-addresses-panel.d.ts +10 -6
- package/plugins/runtime-modules/app/trees/account-addresses-panel.js +37 -73
- package/plugins/runtime-modules/app/trees/addresses-label-set.d.ts +0 -5
- package/plugins/runtime-modules/app/trees/addresses-label-set.js +2 -6
- 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 +1 -17
- package/plugins/runtime-modules/app/trees/profile-label-set.d.ts +0 -2
- package/plugins/runtime-modules/app/trees/profile-label-set.js +2 -14
- package/plugins/runtime-modules/area-contributions/admin.d.ts +1 -1
- package/plugins/runtime-modules/area-contributions/admin.js +2 -0
- package/plugins/runtime-modules/asset/trees/phi-default-admin-media-settings-page-tree.js +5 -0
- package/plugins/runtime-modules/avatar/addresses.d.ts +1 -1
- package/plugins/runtime-modules/builder/clients/inspector-config-field.js +16 -6
- package/plugins/runtime-modules/builder/clients/inspector-image-field.js +3 -1
- package/plugins/runtime-modules/builder/clients/inspector-section-widget.js +3 -1
- package/plugins/runtime-modules/builder/controller/signal-wiring-controller.js +5 -1
- 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 +5 -0
- package/plugins/runtime-modules/builder/trees/phi-default-builder-area-preset-tree.js +14 -1
- package/plugins/runtime-modules/cdn/authoring-widgets.d.ts +3 -0
- package/plugins/runtime-modules/cdn/authoring-widgets.js +7 -0
- package/plugins/runtime-modules/cdn/authoring.d.ts +1 -0
- package/plugins/runtime-modules/cdn/authoring.js +8 -0
- package/plugins/runtime-modules/cdn/bytes.d.ts +5 -0
- package/plugins/runtime-modules/cdn/bytes.js +17 -0
- package/plugins/runtime-modules/cdn/client-data-providers.d.ts +7 -0
- package/plugins/runtime-modules/cdn/client-data-providers.js +9 -0
- package/plugins/runtime-modules/cdn/data-providers.d.ts +134 -0
- package/plugins/runtime-modules/cdn/data-providers.js +117 -0
- package/plugins/runtime-modules/cdn/definition.d.ts +140 -0
- package/plugins/runtime-modules/cdn/definition.js +23 -0
- package/plugins/runtime-modules/cdn/ids.d.ts +18 -0
- package/plugins/runtime-modules/cdn/ids.js +20 -0
- package/plugins/runtime-modules/cdn/module.d.ts +131 -0
- package/plugins/runtime-modules/cdn/module.js +4 -0
- package/plugins/runtime-modules/cdn/platform.d.ts +25 -0
- package/plugins/runtime-modules/cdn/platform.js +73 -0
- package/plugins/runtime-modules/cdn/presets.d.ts +2 -0
- package/plugins/runtime-modules/cdn/presets.js +20 -0
- package/plugins/runtime-modules/cdn/server.d.ts +1 -0
- package/plugins/runtime-modules/cdn/server.js +14 -0
- package/plugins/runtime-modules/cdn/services/table.d.ts +11 -0
- package/plugins/runtime-modules/cdn/services/table.js +296 -0
- package/plugins/runtime-modules/cdn/services/upload.d.ts +20 -0
- package/plugins/runtime-modules/cdn/services/upload.js +146 -0
- package/plugins/runtime-modules/cdn/table-params.d.ts +10 -0
- package/plugins/runtime-modules/cdn/table-params.js +10 -0
- package/plugins/runtime-modules/cdn/trees/admin-cdn-label-set.d.ts +95 -0
- package/plugins/runtime-modules/cdn/trees/admin-cdn-label-set.js +156 -0
- package/plugins/runtime-modules/cdn/trees/phi-default-admin-cdn-page-tree.d.ts +18 -0
- package/plugins/runtime-modules/cdn/trees/phi-default-admin-cdn-page-tree.js +479 -0
- package/plugins/runtime-modules/cdn/widgets/upload/client.d.ts +12 -0
- package/plugins/runtime-modules/cdn/widgets/upload/client.js +138 -0
- package/plugins/runtime-modules/cdn/widgets/upload/config.d.ts +29 -0
- package/plugins/runtime-modules/cdn/widgets/upload/config.js +43 -0
- package/plugins/runtime-modules/cdn/widgets/upload/label-types.d.ts +24 -0
- package/plugins/runtime-modules/cdn/widgets/upload/label-types.js +1 -0
- package/plugins/runtime-modules/cdn/widgets/upload/labels.d.ts +4 -0
- package/plugins/runtime-modules/cdn/widgets/upload/labels.js +72 -0
- package/plugins/runtime-modules/cdn/widgets/upload/plugin.d.ts +3 -0
- package/plugins/runtime-modules/cdn/widgets/upload/plugin.js +7 -0
- package/plugins/runtime-modules/cdn/widgets/upload/server.d.ts +8 -0
- package/plugins/runtime-modules/cdn/widgets/upload/server.js +17 -0
- package/plugins/runtime-modules/cdn/widgets.d.ts +2 -0
- package/plugins/runtime-modules/cdn/widgets.js +13 -0
- package/plugins/runtime-modules/client-authoring-providers/admin.d.ts +1 -1
- package/plugins/runtime-modules/client-authoring-providers/admin.js +6 -0
- package/plugins/runtime-modules/client-manifests/admin.js +11 -1
- package/plugins/runtime-modules/client-manifests/common.js +6 -0
- package/plugins/runtime-modules/core/widgets/card/config.d.ts +1 -1
- package/plugins/runtime-modules/core/widgets/collection-view/asset-binding.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 +175 -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/config.d.ts +1 -1
- package/plugins/runtime-modules/core/widgets/description/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/config.d.ts +1 -1
- 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/markdown/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/table/client.js +36 -52
- package/plugins/runtime-modules/core/widgets/table/config.d.ts +3 -3
- package/plugins/runtime-modules/core/widgets/table/config.js +3 -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/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-editor-translations-page-tree.js +5 -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 +74 -50
- 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/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/services/options.js +14 -4
- package/plugins/runtime-modules/revisions/services/table.js +41 -21
- package/plugins/runtime-modules/revisions/trees/phi-default-builder-revisions-page-tree.js +76 -3
- package/plugins/runtime-modules/theme/controller/runtime.js +14 -2
- package/plugins/runtime-modules/theme/widgets/brand-controls/client.js +39 -13
- package/plugins/runtime-modules/threads/client-data-providers.js +5 -0
- package/plugins/runtime-modules/threads/controller/client.js +62 -2
- package/plugins/runtime-modules/threads/controller/definition.js +48 -0
- package/plugins/runtime-modules/threads/data-providers.d.ts +22 -37
- package/plugins/runtime-modules/threads/data-providers.js +35 -24
- package/plugins/runtime-modules/threads/definition.d.ts +22 -37
- package/plugins/runtime-modules/threads/ids.d.ts +2 -0
- package/plugins/runtime-modules/threads/ids.js +2 -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 +14 -80
- package/plugins/runtime-modules/threads/services/customer-file-table.js +27 -112
- package/plugins/runtime-modules/user-management/trees/admin-users-access-label-set.d.ts +4 -0
- package/plugins/runtime-modules/user-management/trees/admin-users-access-label-set.js +4 -0
- package/plugins/runtime-modules/user-management/trees/phi-default-admin-users-access-page-tree.js +15 -0
- package/plugins/runtime-modules/user-management/trees/phi-default-admin-users-page-tree.js +5 -0
- package/server-helpers/runtime.js +0 -1
- package/styles/controls.css +4 -2
- package/styles/layout.css +7 -0
- 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-gradients.js +4 -22
- package/theme/phi-theme-palette-defaults.d.ts +16 -0
- package/theme/phi-theme-palette-defaults.js +103 -0
- package/types/cms-plugins.d.ts +6 -1
- 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 +6 -0
- package/types/signals.d.ts +2 -0
- package/types/signals.js +2 -0
- package/types/table-widget.d.ts +17 -3
- 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 +0 -1
- package/types.d.ts +1 -1
- package/types.js +1 -1
- package/plugins/runtime-modules/app/services/addresses-table.d.ts +0 -135
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
import { isPhiRecord } from "../helpers/is-record";
|
|
2
|
+
/*
|
|
3
|
+
* What a Collection View says on its `actionActivate` output, read by whoever listens: a record-bound
|
|
4
|
+
* Form, the Overlay container (which opens on an action) and Module Controllers. The Overlay container is
|
|
5
|
+
* on every page, so the reader lives apart from the Collection Provider's contract and imports nothing
|
|
6
|
+
* else, as the Table's readers do (`table-signal-values.ts`).
|
|
7
|
+
*/
|
|
8
|
+
export function readPhiCollectionActionSignalValue(value) {
|
|
9
|
+
if (!isPhiRecord(value) || typeof value.actionKey !== "string" || !value.actionKey.trim()) {
|
|
10
|
+
return null;
|
|
11
|
+
}
|
|
12
|
+
const itemKey = value.itemKey;
|
|
13
|
+
if (itemKey !== undefined && itemKey !== null &&
|
|
14
|
+
!(typeof itemKey === "string" && itemKey.trim()) &&
|
|
15
|
+
!(typeof itemKey === "number" && Number.isFinite(itemKey))) {
|
|
16
|
+
return null;
|
|
17
|
+
}
|
|
18
|
+
return {
|
|
19
|
+
actionKey: value.actionKey.trim(),
|
|
20
|
+
...(itemKey == null ? {} : { itemKey: itemKey }),
|
|
21
|
+
...(isPhiRecord(value.query) ? { query: value.query } : {}),
|
|
22
|
+
};
|
|
23
|
+
}
|
|
@@ -71,6 +71,15 @@ export type PhiCmsCollectionViewWidgetConfig = PhiCmsWidgetConfigBase & {
|
|
|
71
71
|
/** The one kind the upload takes and the picker lists. Absent: the upload takes every kind, the picker lists images. */
|
|
72
72
|
mediaType?: PhiMediaKindValue;
|
|
73
73
|
};
|
|
74
|
+
/**
|
|
75
|
+
* Choosing an item, prepared for the Shop's checkout (an address to deliver to) and read by the address
|
|
76
|
+
* renderer (`PHI_SITE_ADDRESS_ITEM_RENDERER_KEY`) only: `single` lets one tile be chosen, and the choice
|
|
77
|
+
* goes out on the Widget's `selection` output as `{ addressId }` (`site-address-selection`, the
|
|
78
|
+
* resource's `selectionValueSchema`). Absent: nothing is chosen. Nothing reads the choice yet.
|
|
79
|
+
*/
|
|
80
|
+
selection?: {
|
|
81
|
+
mode: "single";
|
|
82
|
+
};
|
|
74
83
|
pagination?: {
|
|
75
84
|
enabled: boolean;
|
|
76
85
|
pageSize?: number;
|
|
@@ -466,6 +466,12 @@ export type PhiCommandToolbarWidgetPlacement = PhiWidgetPlacementBase & PhiContr
|
|
|
466
466
|
*/
|
|
467
467
|
export type PhiThreadConversationWidgetPlacement = PhiWidgetPlacementBase & {
|
|
468
468
|
reply?: boolean;
|
|
469
|
+
/** The heading in place of the conversation's subject, for a placement that shows one kind and names it. */
|
|
470
|
+
title?: string;
|
|
471
|
+
/** What the Reply says where the placement offers it as something else ("Add note"). */
|
|
472
|
+
replyLabel?: string;
|
|
473
|
+
/** The sentence while no conversation is chosen, in place of the Widget's own. */
|
|
474
|
+
emptyDescription?: string;
|
|
469
475
|
padding?: number | string;
|
|
470
476
|
};
|
|
471
477
|
export type PhiThemeModeSwitchSize = "small" | "medium";
|
package/types/signals.d.ts
CHANGED
|
@@ -47,6 +47,8 @@ export declare const PHI_SIGNAL_VALUE_SCHEMAS: {
|
|
|
47
47
|
readonly runtimeConditionState: `${string}/signals/${string}`;
|
|
48
48
|
readonly runtimeNavigation: `${string}/signals/${string}`;
|
|
49
49
|
readonly runtimeTheme: `${string}/signals/${string}`;
|
|
50
|
+
/** One address of a Site's book chosen among the address tiles: `{ addressId }` (COLLECTIONS.md, "The address renderer"). */
|
|
51
|
+
readonly siteAddressSelection: `${string}/signals/${string}`;
|
|
50
52
|
readonly authWorkflowState: `${string}/signals/${string}`;
|
|
51
53
|
readonly stackMeta: `${string}/signals/${string}`;
|
|
52
54
|
readonly tableAction: `${string}/signals/${string}`;
|
package/types/signals.js
CHANGED
|
@@ -64,6 +64,8 @@ export const PHI_SIGNAL_VALUE_SCHEMAS = {
|
|
|
64
64
|
runtimeConditionState: createPhiSharedSignalValueSchema("runtime-condition-state"),
|
|
65
65
|
runtimeNavigation: createPhiSharedSignalValueSchema("runtime-navigation"),
|
|
66
66
|
runtimeTheme: createPhiSharedSignalValueSchema("runtime-theme"),
|
|
67
|
+
/** One address of a Site's book chosen among the address tiles: `{ addressId }` (COLLECTIONS.md, "The address renderer"). */
|
|
68
|
+
siteAddressSelection: createPhiSharedSignalValueSchema("site-address-selection"),
|
|
67
69
|
authWorkflowState: createPhiSharedSignalValueSchema("auth-workflow-state"),
|
|
68
70
|
stackMeta: createPhiSharedSignalValueSchema("stack-meta"),
|
|
69
71
|
tableAction: createPhiSharedSignalValueSchema("table-action"),
|
package/types/table-widget.d.ts
CHANGED
|
@@ -338,8 +338,8 @@ export type PhiTableFooterValueBinding = {
|
|
|
338
338
|
* The template fills placeholders and nothing else, so a sentence that changes with the state -- "3 of 5
|
|
339
339
|
* left" against "Used up" -- is two templates, not one with a condition inside. The first variant whose
|
|
340
340
|
* `when` holds replaces `template` and `values`; none holding leaves the footer as declared. A variant
|
|
341
|
-
* may name no values: "Used up" has nothing to fill in. An empty template
|
|
342
|
-
*
|
|
341
|
+
* may name no values: "Used up" has nothing to fill in. An empty template clears the text while
|
|
342
|
+
* retaining the closing bar; only `footerOmitted` explicitly removes that bar.
|
|
343
343
|
*/
|
|
344
344
|
export type PhiTableFooterVariant = {
|
|
345
345
|
when: {
|
|
@@ -384,6 +384,21 @@ export type PhiTableWidgetPresentation = PhiControlPresentationConfig & {
|
|
|
384
384
|
/** Whether the header row stays at the top while the rows scroll under it; on unless this says `false`. */
|
|
385
385
|
stickyHeader?: boolean;
|
|
386
386
|
footer?: PhiTableFooterConfig;
|
|
387
|
+
/**
|
|
388
|
+
* Why a Table that shows its header has no footer, said by the preset that placed it: a reason for the
|
|
389
|
+
* next person reading the preset, never drawn and never translated. A Table with a header ends in its
|
|
390
|
+
* footer (TABLES.md, "Footer and summary"); one without a header needs neither, so this is only for the
|
|
391
|
+
* rare Table that has a header and nothing a footer could say -- the one setting of a panel, edited in its
|
|
392
|
+
* cell. `checkPhiPresetTables` takes it in place of the footer and refuses it beside one.
|
|
393
|
+
*/
|
|
394
|
+
footerOmitted?: string;
|
|
395
|
+
/**
|
|
396
|
+
* How many skeleton rows stand in for the rows while they load: three where this says nothing
|
|
397
|
+
* (`PHI_TABLE_LOADING_ROWS`), at most `PHI_TABLE_LOADING_ROWS_MAX` and never more than a page holds. Few by
|
|
398
|
+
* default so a Table grows when its rows arrive rather than shrinks; a paged listing known to fill its
|
|
399
|
+
* page may say so (TABLES.md, "Loading").
|
|
400
|
+
*/
|
|
401
|
+
loadingRows?: number;
|
|
387
402
|
summary?: PhiTableSummaryConfig;
|
|
388
403
|
row?: {
|
|
389
404
|
striped?: boolean;
|
|
@@ -702,6 +717,5 @@ export declare function readPhiTableRowOptions(row: Readonly<Record<string, unkn
|
|
|
702
717
|
* options accepts only one of them, which is what keeps a Select limited to its choices on write.
|
|
703
718
|
*/
|
|
704
719
|
export declare function validatePhiTableProviderFieldValue(field: PhiTableProviderFieldDefinition, value: unknown, row?: Readonly<Record<string, unknown>> | null): string | null;
|
|
705
|
-
export declare function validatePhiTableWidgetBinding(config: PhiTableWidgetConfig, resource: PhiTableProviderResourceDescriptor): string[];
|
|
706
720
|
export declare function readPhiTableProviderError(error: unknown): PhiTableProviderError;
|
|
707
721
|
export {};
|
package/types/table-widget.js
CHANGED
|
@@ -292,288 +292,6 @@ export function validatePhiTableProviderFieldValue(field, value, row) {
|
|
|
292
292
|
return `Table field "${field.key}" requires a serializable JSON value.`;
|
|
293
293
|
}
|
|
294
294
|
}
|
|
295
|
-
export function validatePhiTableWidgetBinding(config, resource) {
|
|
296
|
-
const errors = [];
|
|
297
|
-
/*
|
|
298
|
-
* A count shown needs a count given. The rows of one page are not the query's, so a Table that says
|
|
299
|
-
* how many there are, or how many pages, is bound to a resource that counts -- or one that does not
|
|
300
|
-
* page and so answers every row at once (`query.total`).
|
|
301
|
-
*/
|
|
302
|
-
const resourceCounts = resource.query.total === true ||
|
|
303
|
-
(resource.query.pagination !== "offset" && resource.query.pagination !== "cursor");
|
|
304
|
-
if (!resourceCounts) {
|
|
305
|
-
const footer = config.presentation.footer;
|
|
306
|
-
const shownSources = [
|
|
307
|
-
...(footer?.values ?? []).map((item) => item.value),
|
|
308
|
-
...(footer?.variants ?? []).flatMap((variant) => [variant.when.value, ...(variant.values ?? []).map((item) => item.value)]),
|
|
309
|
-
...(config.presentation.summary?.rows ?? []).flatMap((row) => row.cells.map((cell) => cell.item.value)),
|
|
310
|
-
];
|
|
311
|
-
const counted = shownSources.find((source) => source.source === "core" && (source.fieldKey === "totalRows" || source.fieldKey === "pageCount"));
|
|
312
|
-
if (counted) {
|
|
313
|
-
errors.push(`Table shows "${counted.fieldKey}", but resource "${resource.resourceKey}" pages without a count ` +
|
|
314
|
-
"(declare query.total on a resource that answers total).");
|
|
315
|
-
}
|
|
316
|
-
}
|
|
317
|
-
const fields = new Set(resource.fields.map((field) => field.key));
|
|
318
|
-
const fieldsByKey = new Map(resource.fields.map((field) => [field.key, field]));
|
|
319
|
-
const columns = config.presentation.columns;
|
|
320
|
-
const columnKeys = new Set();
|
|
321
|
-
for (const column of columns) {
|
|
322
|
-
if (!column.key.trim() || columnKeys.has(column.key)) {
|
|
323
|
-
errors.push("Table columns require unique non-empty keys.");
|
|
324
|
-
break;
|
|
325
|
-
}
|
|
326
|
-
columnKeys.add(column.key);
|
|
327
|
-
if (!column.fieldKey.trim() || !fields.has(column.fieldKey)) {
|
|
328
|
-
errors.push(`Table column "${column.key}" references undeclared field "${column.fieldKey}".`);
|
|
329
|
-
}
|
|
330
|
-
if (column.sortable && !fields.has(column.sortField ?? column.fieldKey)) {
|
|
331
|
-
errors.push(`Table column "${column.key}" references an undeclared sort field.`);
|
|
332
|
-
}
|
|
333
|
-
const field = fieldsByKey.get(column.fieldKey);
|
|
334
|
-
if (column.editor && !field?.mutable) {
|
|
335
|
-
errors.push(`Table column "${column.key}" cannot edit read-only field "${column.fieldKey}".`);
|
|
336
|
-
}
|
|
337
|
-
if (column.titleDisplay === "icon" && !column.titleIcon) {
|
|
338
|
-
errors.push(`Table column "${column.key}" hides its title without a title icon.`);
|
|
339
|
-
}
|
|
340
|
-
if (column.iconFieldKey !== undefined) {
|
|
341
|
-
const iconField = fieldsByKey.get(column.iconFieldKey);
|
|
342
|
-
if (!iconField) {
|
|
343
|
-
errors.push(`Table column "${column.key}" references undeclared icon field "${column.iconFieldKey}".`);
|
|
344
|
-
}
|
|
345
|
-
else if (iconField.type !== "icon") {
|
|
346
|
-
errors.push(`Table column "${column.key}" icon field "${column.iconFieldKey}" must be an icon field.`);
|
|
347
|
-
}
|
|
348
|
-
}
|
|
349
|
-
if (column.imageFieldKey !== undefined) {
|
|
350
|
-
const imageField = fieldsByKey.get(column.imageFieldKey);
|
|
351
|
-
if (!imageField) {
|
|
352
|
-
errors.push(`Table column "${column.key}" references undeclared image field "${column.imageFieldKey}".`);
|
|
353
|
-
}
|
|
354
|
-
else if (imageField.type !== "string") {
|
|
355
|
-
errors.push(`Table column "${column.key}" image field "${column.imageFieldKey}" must be a string field.`);
|
|
356
|
-
}
|
|
357
|
-
}
|
|
358
|
-
if (column.editor && field?.type === "json") {
|
|
359
|
-
errors.push(`Table column "${column.key}" cannot use an implicit JSON editor.`);
|
|
360
|
-
}
|
|
361
|
-
const editorControlCompatible = !column.editor?.control ||
|
|
362
|
-
(field?.type === "boolean" && (column.editor.control === "switch" || column.editor.control === "checkbox")) ||
|
|
363
|
-
(field?.type === "icon" && column.editor.control === "icon-picker") ||
|
|
364
|
-
(field?.type === "enum" && (column.editor.control === "select" || column.editor.control === "radio" ||
|
|
365
|
-
column.editor.control === "segmented")) ||
|
|
366
|
-
(field?.type === "string" && Boolean(field.rowOptionsPath) && column.editor.control === "select") ||
|
|
367
|
-
(field?.type === "string" && column.editor.control === "textarea") ||
|
|
368
|
-
(field?.type === "enum[]" && (column.editor.control === "multi-select" ||
|
|
369
|
-
column.editor.control === "checkbox-group"));
|
|
370
|
-
if (column.editor && !editorControlCompatible) {
|
|
371
|
-
errors.push(`Table column "${column.key}" editor is incompatible with field "${column.fieldKey}".`);
|
|
372
|
-
}
|
|
373
|
-
const rendererCompatible = !column.renderer || column.renderer === "text" ||
|
|
374
|
-
(column.renderer === "switch" && field?.type === "boolean") ||
|
|
375
|
-
(column.renderer === "checkbox" && field?.type === "boolean") ||
|
|
376
|
-
(column.renderer === "icon" && field?.type === "icon") ||
|
|
377
|
-
(column.renderer === "image" && field?.type === "string") ||
|
|
378
|
-
((column.renderer === "date" || column.renderer === "datetime") && field?.type === column.renderer) ||
|
|
379
|
-
(column.renderer === "json" && field?.type === "json") ||
|
|
380
|
-
(column.renderer === "tags" && (field?.type === "json" || field?.type === "enum[]")) ||
|
|
381
|
-
((column.renderer === "money" || column.renderer === "interval") && field?.type === "json") ||
|
|
382
|
-
((column.renderer === "email" || column.renderer === "link" || column.renderer === "code" ||
|
|
383
|
-
column.renderer === "badge") && (field?.type === "string" || field?.type === "enum"));
|
|
384
|
-
if (!rendererCompatible) {
|
|
385
|
-
errors.push(`Table column "${column.key}" renderer is incompatible with field "${column.fieldKey}".`);
|
|
386
|
-
}
|
|
387
|
-
if (config.presentation.layout.mode === "fixed" && column.sizing?.mode === "content") {
|
|
388
|
-
errors.push(`Table column "${column.key}" cannot use content sizing with fixed Table layout.`);
|
|
389
|
-
}
|
|
390
|
-
if (!column.hidden && column.sticky && config.presentation.layout.overflowX !== "auto") {
|
|
391
|
-
errors.push(`Sticky Table column "${column.key}" requires automatic horizontal overflow.`);
|
|
392
|
-
}
|
|
393
|
-
}
|
|
394
|
-
const summaryFields = new Set(resource.summaryFields?.map((field) => field.key) ?? []);
|
|
395
|
-
const validateSummaryItem = (item, owner) => {
|
|
396
|
-
if (!item.key.trim())
|
|
397
|
-
errors.push(`${owner} requires a non-empty item key.`);
|
|
398
|
-
if (item.value.source === "provider" && !summaryFields.has(item.value.fieldKey)) {
|
|
399
|
-
errors.push(`${owner} references undeclared Provider summary field "${item.value.fieldKey}".`);
|
|
400
|
-
}
|
|
401
|
-
};
|
|
402
|
-
const footerValueKeys = new Set();
|
|
403
|
-
const footer = config.presentation.footer;
|
|
404
|
-
for (const binding of footer?.values ?? []) {
|
|
405
|
-
if (footerValueKeys.has(binding.key))
|
|
406
|
-
errors.push("Table footer value keys must be unique.");
|
|
407
|
-
footerValueKeys.add(binding.key);
|
|
408
|
-
validateSummaryItem({ key: binding.key, value: binding.value }, `Table footer value "${binding.key}"`);
|
|
409
|
-
}
|
|
410
|
-
if (footer) {
|
|
411
|
-
const placeholderIndexes = new Set([...footer.template.matchAll(/%([1-9]\d*)/g)].map((match) => Number(match[1])));
|
|
412
|
-
if (!footer.template.trim() || footer.values.length === 0 ||
|
|
413
|
-
footer.values.some((_value, index) => !placeholderIndexes.has(index + 1)) ||
|
|
414
|
-
[...placeholderIndexes].some((index) => index > footer.values.length)) {
|
|
415
|
-
errors.push("Table footer template placeholders must match its ordered values.");
|
|
416
|
-
}
|
|
417
|
-
}
|
|
418
|
-
const summaryRowKeys = new Set();
|
|
419
|
-
for (const row of config.presentation.summary?.rows ?? []) {
|
|
420
|
-
if (!row.key.trim() || summaryRowKeys.has(row.key)) {
|
|
421
|
-
errors.push("Table summary rows require unique non-empty keys.");
|
|
422
|
-
}
|
|
423
|
-
summaryRowKeys.add(row.key);
|
|
424
|
-
const cellKeys = new Set();
|
|
425
|
-
const occupiedColumns = new Set();
|
|
426
|
-
for (const cell of row.cells) {
|
|
427
|
-
if (!cell.key.trim() || cellKeys.has(cell.key)) {
|
|
428
|
-
errors.push(`Table summary row "${row.key}" requires unique non-empty cell keys.`);
|
|
429
|
-
}
|
|
430
|
-
cellKeys.add(cell.key);
|
|
431
|
-
if (!columnKeys.has(cell.columnKey) || cell.throughColumnKey && !columnKeys.has(cell.throughColumnKey)) {
|
|
432
|
-
errors.push(`Table summary cell "${cell.key}" references an undeclared column.`);
|
|
433
|
-
}
|
|
434
|
-
else {
|
|
435
|
-
const start = columns.findIndex((column) => column.key === cell.columnKey);
|
|
436
|
-
const end = cell.throughColumnKey
|
|
437
|
-
? columns.findIndex((column) => column.key === cell.throughColumnKey)
|
|
438
|
-
: start;
|
|
439
|
-
if (end < start) {
|
|
440
|
-
errors.push(`Table summary cell "${cell.key}" has a backwards column span.`);
|
|
441
|
-
}
|
|
442
|
-
else {
|
|
443
|
-
for (const column of columns.slice(start, end + 1)) {
|
|
444
|
-
if (occupiedColumns.has(column.key)) {
|
|
445
|
-
errors.push(`Table summary row "${row.key}" contains overlapping cells.`);
|
|
446
|
-
break;
|
|
447
|
-
}
|
|
448
|
-
occupiedColumns.add(column.key);
|
|
449
|
-
}
|
|
450
|
-
}
|
|
451
|
-
}
|
|
452
|
-
validateSummaryItem(cell.item, `Table summary cell "${cell.key}"`);
|
|
453
|
-
}
|
|
454
|
-
}
|
|
455
|
-
if (config.presentation.layout.mode === "fixed" &&
|
|
456
|
-
columns.every((column) => column.hidden || (column.sizing?.mode ?? "content") !== "fill")) {
|
|
457
|
-
errors.push("Fixed Table layout requires at least one visible fill column.");
|
|
458
|
-
}
|
|
459
|
-
if (config.presentation.layout.mode !== "fixed" && columns.some((column) => column.ellipsis)) {
|
|
460
|
-
errors.push("Ellipsis requires fixed Table layout.");
|
|
461
|
-
}
|
|
462
|
-
const sortingMode = config.features.sorting?.mode ?? "none";
|
|
463
|
-
const providerSorting = resource.query.sorting ?? "none";
|
|
464
|
-
if (sortingMode !== "none" && providerSorting === "none") {
|
|
465
|
-
errors.push(`Table resource "${resource.resourceKey}" does not support sorting.`);
|
|
466
|
-
}
|
|
467
|
-
else if (sortingMode === "multiple" && providerSorting !== "multiple") {
|
|
468
|
-
errors.push(`Table resource "${resource.resourceKey}" does not support multiple sorting.`);
|
|
469
|
-
}
|
|
470
|
-
if (config.features.search?.enabled && resource.query.search !== true) {
|
|
471
|
-
errors.push(`Table resource "${resource.resourceKey}" does not support search.`);
|
|
472
|
-
}
|
|
473
|
-
if (config.features.pagination?.enabled !== false && resource.query.pagination === "none") {
|
|
474
|
-
errors.push(`Table resource "${resource.resourceKey}" does not support pagination.`);
|
|
475
|
-
}
|
|
476
|
-
for (const sort of config.features.sorting?.defaultSorts ?? []) {
|
|
477
|
-
if (!fields.has(sort.key))
|
|
478
|
-
errors.push(`Table default sort "${sort.key}" is not declared by the resource.`);
|
|
479
|
-
}
|
|
480
|
-
const filterFields = new Set(resource.query.filterFields ?? []);
|
|
481
|
-
for (const filter of config.features.filters ?? []) {
|
|
482
|
-
const keys = filter.type === "dateRange" ? [filter.startKey, filter.endKey] : [filter.key];
|
|
483
|
-
for (const key of keys) {
|
|
484
|
-
if (!filterFields.has(key))
|
|
485
|
-
errors.push(`Table filter "${key}" is not declared by the resource.`);
|
|
486
|
-
}
|
|
487
|
-
}
|
|
488
|
-
const structure = config.features.structure;
|
|
489
|
-
if (structure?.mode === "tree" &&
|
|
490
|
-
resource.hierarchy?.parentRowIdentityPath !== structure.parentRowIdentityPath) {
|
|
491
|
-
errors.push(`Table resource "${resource.resourceKey}" does not declare the selected hierarchy.`);
|
|
492
|
-
}
|
|
493
|
-
if (structure?.mode === "tree" && !columns.some((column) => column.key === structure.expandColumnKey && !column.hidden)) {
|
|
494
|
-
errors.push(`Table tree expand column "${structure.expandColumnKey}" is not a visible configured column.`);
|
|
495
|
-
}
|
|
496
|
-
if (resource.hierarchy?.canAcceptChildrenField) {
|
|
497
|
-
const acceptanceField = fieldsByKey.get(resource.hierarchy.canAcceptChildrenField);
|
|
498
|
-
if (acceptanceField?.type !== "boolean") {
|
|
499
|
-
errors.push(`Table resource "${resource.resourceKey}" child-acceptance field must be a declared boolean field.`);
|
|
500
|
-
}
|
|
501
|
-
}
|
|
502
|
-
if (config.features.editing?.mode === "none" && columns.some((column) => column.editor)) {
|
|
503
|
-
errors.push("Editable Table columns require cell editing mode.");
|
|
504
|
-
}
|
|
505
|
-
if (config.features.rowReordering?.enabled) {
|
|
506
|
-
const requiredOrdering = structure?.mode === "tree" ? "tree" : "flat";
|
|
507
|
-
if (resource.rowOrdering !== requiredOrdering) {
|
|
508
|
-
errors.push(`Table resource "${resource.resourceKey}" does not support ${requiredOrdering} row ordering.`);
|
|
509
|
-
}
|
|
510
|
-
}
|
|
511
|
-
const providerActions = new Map(resource.actions?.map((action) => [action.key, action]) ?? []);
|
|
512
|
-
const bindingFields = new Map(resource.bindingFields?.map((field) => [field.key, field]) ?? []);
|
|
513
|
-
const configuredBindingKeys = new Set();
|
|
514
|
-
for (const bindingTool of config.features.tools?.bindingFields ?? []) {
|
|
515
|
-
if (configuredBindingKeys.has(bindingTool.key)) {
|
|
516
|
-
errors.push(`Table binding field "${bindingTool.key}" is configured more than once.`);
|
|
517
|
-
continue;
|
|
518
|
-
}
|
|
519
|
-
configuredBindingKeys.add(bindingTool.key);
|
|
520
|
-
const bindingField = bindingFields.get(bindingTool.key);
|
|
521
|
-
if (!bindingField) {
|
|
522
|
-
errors.push(`Table binding field "${bindingTool.key}" is not declared by resource "${resource.resourceKey}".`);
|
|
523
|
-
continue;
|
|
524
|
-
}
|
|
525
|
-
if (bindingField.create) {
|
|
526
|
-
const action = providerActions.get(bindingField.create.actionKey);
|
|
527
|
-
if (!action || action.scope !== "resource" || action.valueType !== "string") {
|
|
528
|
-
errors.push(`Table binding field "${bindingTool.key}" create action must be a declared string-valued resource action.`);
|
|
529
|
-
}
|
|
530
|
-
if (!bindingTool.create)
|
|
531
|
-
errors.push(`Table binding field "${bindingTool.key}" needs Widget create-tool presentation.`);
|
|
532
|
-
else if (!bindingTool.create.display) {
|
|
533
|
-
errors.push(`Table binding field "${bindingTool.key}" create tool requires explicit display presentation.`);
|
|
534
|
-
}
|
|
535
|
-
}
|
|
536
|
-
else if (bindingTool.create) {
|
|
537
|
-
errors.push(`Table binding field "${bindingTool.key}" configures create presentation without a Provider create capability.`);
|
|
538
|
-
}
|
|
539
|
-
if (bindingTool.create && (bindingTool.create.display === "icon" || bindingTool.create.display === "icon-label") &&
|
|
540
|
-
!bindingTool.create.icon?.trim()) {
|
|
541
|
-
errors.push(`Table binding field "${bindingTool.key}" create tool needs an icon for display "${bindingTool.create.display}".`);
|
|
542
|
-
}
|
|
543
|
-
}
|
|
544
|
-
for (const [scope, actions] of [
|
|
545
|
-
["resource", config.features.actions?.toolbar ?? []],
|
|
546
|
-
["row", config.features.actions?.row ?? []],
|
|
547
|
-
["selection", config.features.actions?.bulk ?? []],
|
|
548
|
-
]) {
|
|
549
|
-
for (const action of actions) {
|
|
550
|
-
if (!action.display) {
|
|
551
|
-
errors.push(`Table action "${action.key}" requires explicit display presentation.`);
|
|
552
|
-
}
|
|
553
|
-
if ((action.display === "icon" || action.display === "icon-label") && !action.icon?.trim()) {
|
|
554
|
-
errors.push(`Table action "${action.key}" needs an icon for display "${action.display}".`);
|
|
555
|
-
}
|
|
556
|
-
if (action.execution !== "provider")
|
|
557
|
-
continue;
|
|
558
|
-
const capability = providerActions.get(action.key);
|
|
559
|
-
if (!capability) {
|
|
560
|
-
errors.push(`Table action "${action.key}" is not declared by resource "${resource.resourceKey}".`);
|
|
561
|
-
}
|
|
562
|
-
else if (capability.scope !== scope) {
|
|
563
|
-
errors.push(`Table action "${action.key}" cannot be placed in the ${scope} action scope.`);
|
|
564
|
-
}
|
|
565
|
-
else {
|
|
566
|
-
if (capability.confirmation === "required" && !action.confirm?.title.trim()) {
|
|
567
|
-
errors.push(`Table action "${action.key}" requires Widget confirmation presentation.`);
|
|
568
|
-
}
|
|
569
|
-
if (capability.intent === "destructive" && action.mode !== "danger") {
|
|
570
|
-
errors.push(`Destructive Table action "${action.key}" requires danger presentation.`);
|
|
571
|
-
}
|
|
572
|
-
}
|
|
573
|
-
}
|
|
574
|
-
}
|
|
575
|
-
return errors;
|
|
576
|
-
}
|
|
577
295
|
export function readPhiTableProviderError(error) {
|
|
578
296
|
return error instanceof PhiTableProviderError
|
|
579
297
|
? error
|
package/types/tree-widget.d.ts
CHANGED
|
@@ -212,5 +212,4 @@ export declare function readPhiTreeNodePath(node: Record<string, unknown>, path:
|
|
|
212
212
|
export declare function readPhiTreeProviderQueryResult(value: unknown): PhiTreeProviderQueryResult | null;
|
|
213
213
|
export declare function readPhiTreeProviderMutationResult(value: unknown): PhiTreeProviderMutationResult | null;
|
|
214
214
|
export declare function readPhiTreeProviderError(error: unknown): PhiTreeProviderError;
|
|
215
|
-
export declare function validatePhiTreeWidgetBinding(config: PhiTreeWidgetConfig, resource: PhiTreeProviderResourceDescriptor): string[];
|
|
216
215
|
export {};
|
package/types/tree-widget.js
CHANGED
|
@@ -46,63 +46,3 @@ export function readPhiTreeProviderError(error) {
|
|
|
46
46
|
? error
|
|
47
47
|
: new PhiTreeProviderError("provider-error", error instanceof Error ? error.message : "Tree Provider failed.");
|
|
48
48
|
}
|
|
49
|
-
export function validatePhiTreeWidgetBinding(config, resource) {
|
|
50
|
-
const errors = [];
|
|
51
|
-
const fieldKeys = new Set(resource.fields.map((field) => field.key));
|
|
52
|
-
for (const key of [
|
|
53
|
-
config.presentation.node.titleFieldKey,
|
|
54
|
-
config.presentation.node.descriptionFieldKey,
|
|
55
|
-
config.presentation.node.iconFieldKey,
|
|
56
|
-
].filter((value) => Boolean(value))) {
|
|
57
|
-
if (!fieldKeys.has(key))
|
|
58
|
-
errors.push(`Tree presentation references undeclared field "${key}".`);
|
|
59
|
-
}
|
|
60
|
-
for (const tool of config.features.tools?.bindingFields ?? []) {
|
|
61
|
-
if (!resource.bindingFields?.some((field) => field.key === tool.key)) {
|
|
62
|
-
errors.push(`Tree binding tool references undeclared field "${tool.key}".`);
|
|
63
|
-
}
|
|
64
|
-
}
|
|
65
|
-
if (config.features.search?.enabled && !resource.query.search) {
|
|
66
|
-
errors.push("Tree search requires Provider query search capability.");
|
|
67
|
-
}
|
|
68
|
-
if (config.features.editing?.enabled) {
|
|
69
|
-
for (const key of [
|
|
70
|
-
config.presentation.node.titleEditor?.enabled ? config.presentation.node.titleFieldKey : null,
|
|
71
|
-
config.presentation.node.iconEditor?.enabled ? config.presentation.node.iconFieldKey : null,
|
|
72
|
-
].filter((value) => Boolean(value))) {
|
|
73
|
-
if (!resource.fields.find((field) => field.key === key)?.mutable) {
|
|
74
|
-
errors.push(`Tree editor requires mutable Provider field "${key}".`);
|
|
75
|
-
}
|
|
76
|
-
}
|
|
77
|
-
}
|
|
78
|
-
const providerActions = new Map(resource.actions?.map((action) => [action.key, action]) ?? []);
|
|
79
|
-
for (const [scope, actions] of [
|
|
80
|
-
["resource", config.features.actions?.toolbar ?? []],
|
|
81
|
-
["node", config.features.actions?.node ?? []],
|
|
82
|
-
["selection", config.features.actions?.selection ?? []],
|
|
83
|
-
]) {
|
|
84
|
-
for (const action of actions) {
|
|
85
|
-
const capability = providerActions.get(action.key);
|
|
86
|
-
if (action.execution === "provider" && !capability) {
|
|
87
|
-
errors.push(`Tree action references undeclared Provider capability "${action.key}".`);
|
|
88
|
-
}
|
|
89
|
-
else if (action.execution === "provider" && capability?.scope !== scope) {
|
|
90
|
-
errors.push(`Tree action "${action.key}" requires Provider scope "${scope}".`);
|
|
91
|
-
}
|
|
92
|
-
else if (action.execution === "provider" && capability?.confirmation === "required" && !action.confirm) {
|
|
93
|
-
errors.push(`Tree action "${action.key}" requires confirmation presentation.`);
|
|
94
|
-
}
|
|
95
|
-
}
|
|
96
|
-
}
|
|
97
|
-
const dndMode = config.features.dnd?.mode ?? "none";
|
|
98
|
-
if ((dndMode === "source" || dndMode === "source-reorder") && !resource.dragSources?.length) {
|
|
99
|
-
errors.push("Tree source DnD requires a declared Provider drag source.");
|
|
100
|
-
}
|
|
101
|
-
if (config.features.dnd?.payloadType && !resource.dragSources?.some((source) => source.payloadType === config.features.dnd?.payloadType)) {
|
|
102
|
-
errors.push(`Tree DnD references undeclared payload type "${config.features.dnd.payloadType}".`);
|
|
103
|
-
}
|
|
104
|
-
if ((dndMode === "reorder" || dndMode === "source-reorder") && resource.nodeOrdering !== "tree") {
|
|
105
|
-
errors.push("Tree reorder DnD requires Provider nodeOrdering \"tree\".");
|
|
106
|
-
}
|
|
107
|
-
return errors;
|
|
108
|
-
}
|
|
@@ -91,7 +91,6 @@ export type PhiBlockRuntimeViewer = {
|
|
|
91
91
|
* the session until it is set, and each Page shows the change in front of itself.
|
|
92
92
|
*/
|
|
93
93
|
mustChangePassword?: boolean;
|
|
94
|
-
newsletterOptIn?: boolean | null;
|
|
95
94
|
profile?: {
|
|
96
95
|
firstName?: string | null;
|
|
97
96
|
lastName?: string | null;
|
package/types.d.ts
CHANGED
|
@@ -34,7 +34,7 @@ export type * from "./types/collection-provider";
|
|
|
34
34
|
export type * from "./types/form-descriptor";
|
|
35
35
|
export * from "./types/form-id";
|
|
36
36
|
export { PhiTableProviderError, readPhiTableProviderError, readPhiTableQuery, } from "./types/table-widget";
|
|
37
|
-
export { PhiTreeProviderError, readPhiTreeProviderError, readPhiTreeProviderQueryResult, readPhiTreeProviderMutationResult,
|
|
37
|
+
export { PhiTreeProviderError, readPhiTreeProviderError, readPhiTreeProviderQueryResult, readPhiTreeProviderMutationResult, } from "./types/tree-widget";
|
|
38
38
|
export type * from "./types/media";
|
|
39
39
|
export type * from "./types/threads";
|
|
40
40
|
export type * from "./types/thread-widget";
|
package/types.js
CHANGED
|
@@ -18,7 +18,7 @@ export * from "./types/access";
|
|
|
18
18
|
export { isPhiRuntimeDataProviderKey, readPhiRuntimeDataProviderBinding } from "./types/runtime-data-provider";
|
|
19
19
|
export * from "./types/form-id";
|
|
20
20
|
export { PhiTableProviderError, readPhiTableProviderError, readPhiTableQuery, } from "./types/table-widget";
|
|
21
|
-
export { PhiTreeProviderError, readPhiTreeProviderError, readPhiTreeProviderQueryResult, readPhiTreeProviderMutationResult,
|
|
21
|
+
export { PhiTreeProviderError, readPhiTreeProviderError, readPhiTreeProviderQueryResult, readPhiTreeProviderMutationResult, } from "./types/tree-widget";
|
|
22
22
|
export { readPhiThreadSignalValue } from "./types/thread-widget";
|
|
23
23
|
export * from "./types/runtime-module-locale";
|
|
24
24
|
export * from "./types/server-capabilities";
|
|
@@ -1,135 +0,0 @@
|
|
|
1
|
-
import { type PhiTableProviderMutationRequest, type PhiTableProviderQueryRequest, type PhiTableProviderRecordRequest } from "../../../../types/table-widget";
|
|
2
|
-
/** The account's own address book (phis-server `/api/site/account/addresses`). */
|
|
3
|
-
export declare const PHI_APP_ADDRESSES_PATH = "/api/site/account/addresses";
|
|
4
|
-
declare function queryAddresses({ resourceKey, signal }: PhiTableProviderQueryRequest): Promise<{
|
|
5
|
-
rows: {
|
|
6
|
-
createdAt: {} | null;
|
|
7
|
-
flags: number;
|
|
8
|
-
billing: boolean;
|
|
9
|
-
shipping: boolean;
|
|
10
|
-
defaultBilling: boolean;
|
|
11
|
-
defaultShipping: boolean;
|
|
12
|
-
address: {
|
|
13
|
-
[k: string]: string | null;
|
|
14
|
-
};
|
|
15
|
-
lines: string;
|
|
16
|
-
purposes: ("billing" | "shipping" | "defaultBilling" | "defaultShipping")[];
|
|
17
|
-
id: unknown;
|
|
18
|
-
}[];
|
|
19
|
-
total: number;
|
|
20
|
-
}>;
|
|
21
|
-
declare function readAddressRecord({ resourceKey, rowIdentity, signal }: PhiTableProviderRecordRequest): Promise<{
|
|
22
|
-
createdAt: {} | null;
|
|
23
|
-
flags: number;
|
|
24
|
-
billing: boolean;
|
|
25
|
-
shipping: boolean;
|
|
26
|
-
defaultBilling: boolean;
|
|
27
|
-
defaultShipping: boolean;
|
|
28
|
-
address: {
|
|
29
|
-
[k: string]: string | null;
|
|
30
|
-
};
|
|
31
|
-
lines: string;
|
|
32
|
-
purposes: ("billing" | "shipping" | "defaultBilling" | "defaultShipping")[];
|
|
33
|
-
id: unknown;
|
|
34
|
-
}>;
|
|
35
|
-
/** The request that gives a listed address the default it asks for, or throws where it has none listed. */
|
|
36
|
-
export declare function buildPhiAppAddressDefaultRequest(address: Record<string, unknown>, actionKey: "makeDefaultBilling" | "makeDefaultShipping"): {
|
|
37
|
-
address: {
|
|
38
|
-
[k: string]: {} | null;
|
|
39
|
-
};
|
|
40
|
-
flags: number;
|
|
41
|
-
};
|
|
42
|
-
declare function mutateAddresses(request: PhiTableProviderMutationRequest): Promise<{
|
|
43
|
-
status: "accepted";
|
|
44
|
-
invalidation: "view";
|
|
45
|
-
}>;
|
|
46
|
-
export declare const PHI_APP_ADDRESSES_TABLE_PROVIDER_REGISTRATION: {
|
|
47
|
-
key: `${string}/${string}`;
|
|
48
|
-
resources: {
|
|
49
|
-
resourceKey: string;
|
|
50
|
-
title: string;
|
|
51
|
-
rowIdentityPath: string;
|
|
52
|
-
recordRead: true;
|
|
53
|
-
fields: ({
|
|
54
|
-
key: string;
|
|
55
|
-
title: string;
|
|
56
|
-
type: "number";
|
|
57
|
-
required: true;
|
|
58
|
-
options?: undefined;
|
|
59
|
-
} | {
|
|
60
|
-
key: string;
|
|
61
|
-
title: string;
|
|
62
|
-
type: "string";
|
|
63
|
-
required?: undefined;
|
|
64
|
-
options?: undefined;
|
|
65
|
-
} | {
|
|
66
|
-
key: string;
|
|
67
|
-
title: string;
|
|
68
|
-
type: "enum[]";
|
|
69
|
-
options: {
|
|
70
|
-
value: "billing" | "shipping" | "defaultBilling" | "defaultShipping";
|
|
71
|
-
label: "billing" | "shipping" | "defaultBilling" | "defaultShipping";
|
|
72
|
-
}[];
|
|
73
|
-
required?: undefined;
|
|
74
|
-
} | {
|
|
75
|
-
key: string;
|
|
76
|
-
title: string;
|
|
77
|
-
type: "boolean";
|
|
78
|
-
required?: undefined;
|
|
79
|
-
options?: undefined;
|
|
80
|
-
} | {
|
|
81
|
-
key: string;
|
|
82
|
-
title: string;
|
|
83
|
-
type: "datetime";
|
|
84
|
-
required?: undefined;
|
|
85
|
-
options?: undefined;
|
|
86
|
-
} | {
|
|
87
|
-
key: string;
|
|
88
|
-
title: string;
|
|
89
|
-
type: "json";
|
|
90
|
-
required?: undefined;
|
|
91
|
-
options?: undefined;
|
|
92
|
-
} | {
|
|
93
|
-
key: string;
|
|
94
|
-
title: string;
|
|
95
|
-
type: "number";
|
|
96
|
-
required?: undefined;
|
|
97
|
-
options?: undefined;
|
|
98
|
-
})[];
|
|
99
|
-
query: {
|
|
100
|
-
search: false;
|
|
101
|
-
filterFields: never[];
|
|
102
|
-
sorting: "none";
|
|
103
|
-
pagination: "none";
|
|
104
|
-
};
|
|
105
|
-
actions: ({
|
|
106
|
-
key: string;
|
|
107
|
-
title: string;
|
|
108
|
-
scope: "row";
|
|
109
|
-
intent: "write";
|
|
110
|
-
disabledWhen: {
|
|
111
|
-
match: "any";
|
|
112
|
-
conditions: {
|
|
113
|
-
source: "row";
|
|
114
|
-
valuePath: string;
|
|
115
|
-
operator: "truthy";
|
|
116
|
-
}[];
|
|
117
|
-
};
|
|
118
|
-
confirmation?: undefined;
|
|
119
|
-
} | {
|
|
120
|
-
key: string;
|
|
121
|
-
title: string;
|
|
122
|
-
scope: "row";
|
|
123
|
-
intent: "destructive";
|
|
124
|
-
confirmation: "required";
|
|
125
|
-
disabledWhen?: undefined;
|
|
126
|
-
})[];
|
|
127
|
-
}[];
|
|
128
|
-
query: typeof queryAddresses;
|
|
129
|
-
readRecord: typeof readAddressRecord;
|
|
130
|
-
mutate: typeof mutateAddresses;
|
|
131
|
-
};
|
|
132
|
-
export declare const PhiAppAddressesTableProviderClient: import("react").ComponentType<{
|
|
133
|
-
children: import("react").ReactNode;
|
|
134
|
-
}>;
|
|
135
|
-
export {};
|