@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
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import type { PhiMediaKindValue } from "../../types/media";
|
|
2
2
|
import type { PhiAreaUploadWidgetLabels } from "./media-widget-labels";
|
|
3
3
|
import type { PhiMediaUploadLabels } from "./media-upload-labels";
|
|
4
|
-
import { type PhiMediaUploadSessionRunner, type PhiMediaUploadInitOptions } from "./media-upload-flow";
|
|
4
|
+
import { type PhiMediaUploadSessionRunner, type PhiMediaUploadInitOptions, type PhiUploadPhase } from "./media-upload-flow";
|
|
5
5
|
/**
|
|
6
6
|
* What a surface accepts, stated by the Module that offers it.
|
|
7
7
|
*
|
|
@@ -42,6 +42,8 @@ type PhiMediaUploadItem = {
|
|
|
42
42
|
localId: string;
|
|
43
43
|
file: File;
|
|
44
44
|
progress: number;
|
|
45
|
+
/** Where a file on its way stands (`PhiUploadPhase`); null before the session says. */
|
|
46
|
+
phase: PhiUploadPhase | null;
|
|
45
47
|
status: "uploading" | "done" | "error";
|
|
46
48
|
error: string | null;
|
|
47
49
|
assetId: number | null;
|
|
@@ -69,7 +71,7 @@ type PhiMediaUploadItem = {
|
|
|
69
71
|
* whatever would act on the incomplete value.
|
|
70
72
|
*/
|
|
71
73
|
export declare function usePhiMediaUpload<TAsset extends {
|
|
72
|
-
id
|
|
74
|
+
id?: unknown;
|
|
73
75
|
} = {
|
|
74
76
|
id: number;
|
|
75
77
|
}>(input: {
|
|
@@ -92,13 +94,18 @@ export declare function usePhiMediaUpload<TAsset extends {
|
|
|
92
94
|
*/
|
|
93
95
|
onUploaded?: (asset: TAsset, file: File) => void | Promise<void>;
|
|
94
96
|
onRejected?: (message: string, file: File) => void;
|
|
97
|
+
/**
|
|
98
|
+
* The sentence a failure is shown with, for a runner whose target words its own refusals -- Core's CDN
|
|
99
|
+
* routes answer `{ error, message }` in a person's words. Null falls back to the Media refusals.
|
|
100
|
+
*/
|
|
101
|
+
readError?: (error: unknown) => string | null;
|
|
95
102
|
}): {
|
|
96
103
|
accept: string;
|
|
97
104
|
items: readonly PhiMediaUploadItem[];
|
|
98
105
|
uploading: boolean;
|
|
99
106
|
upload: (file: File, fileInitOptions?: PhiMediaUploadInitOptions) => Promise<TAsset | null>;
|
|
100
107
|
retry: (localId: string) => Promise<TAsset | null>;
|
|
101
|
-
cancel: () => void;
|
|
108
|
+
cancel: (reason?: unknown) => void;
|
|
102
109
|
reset: () => void;
|
|
103
110
|
};
|
|
104
111
|
export {};
|
|
@@ -104,7 +104,8 @@ export function readPhiMediaUploadErrorMessage(error, labels) {
|
|
|
104
104
|
* whatever would act on the incomplete value.
|
|
105
105
|
*/
|
|
106
106
|
export function usePhiMediaUpload(input) {
|
|
107
|
-
const { labels, acceptance, initOptions, onUploaded, onRejected } = input;
|
|
107
|
+
const { labels, acceptance, initOptions, onUploaded, onRejected, readError } = input;
|
|
108
|
+
const readFailure = useCallback((error) => readError?.(error) ?? readPhiMediaUploadErrorMessage(error, labels), [labels, readError]);
|
|
108
109
|
const runSession = input.runSession
|
|
109
110
|
?? runPhiMediaUploadSession;
|
|
110
111
|
const [items, setItems] = useState([]);
|
|
@@ -138,6 +139,7 @@ export function usePhiMediaUpload(input) {
|
|
|
138
139
|
localId,
|
|
139
140
|
file,
|
|
140
141
|
progress: 0,
|
|
142
|
+
phase: null,
|
|
141
143
|
status: "uploading",
|
|
142
144
|
error: null,
|
|
143
145
|
assetId: null,
|
|
@@ -148,14 +150,14 @@ export function usePhiMediaUpload(input) {
|
|
|
148
150
|
running.current.add(controller);
|
|
149
151
|
let asset;
|
|
150
152
|
try {
|
|
151
|
-
({ asset } = await runSession(file, (progress) => patch(localId, { progress }), fileInitOptions ?? initOptions, controller.signal));
|
|
153
|
+
({ asset } = await runSession(file, (progress) => patch(localId, { progress }), fileInitOptions ?? initOptions, controller.signal, (phase) => patch(localId, { phase })));
|
|
152
154
|
}
|
|
153
155
|
catch (error) {
|
|
154
156
|
if (controller.signal.aborted || isPhiMediaUploadCancelled(error)) {
|
|
155
157
|
setItems((current) => current.filter((item) => item.localId !== localId));
|
|
156
158
|
return null;
|
|
157
159
|
}
|
|
158
|
-
const message =
|
|
160
|
+
const message = readFailure(error);
|
|
159
161
|
patch(localId, { progress: 100, status: "error", error: message });
|
|
160
162
|
onRejected?.(message, file);
|
|
161
163
|
return null;
|
|
@@ -166,27 +168,28 @@ export function usePhiMediaUpload(input) {
|
|
|
166
168
|
// Stopped while finalize was answering: the Asset exists, but nobody is waiting to enter it.
|
|
167
169
|
if (controller.signal.aborted)
|
|
168
170
|
return null;
|
|
169
|
-
patch(localId, { progress: 100, status: "done", assetId: asset.id });
|
|
171
|
+
patch(localId, { progress: 100, status: "done", assetId: typeof asset.id === "number" ? asset.id : null });
|
|
170
172
|
try {
|
|
171
173
|
await onUploaded?.(asset, file);
|
|
172
174
|
}
|
|
173
175
|
catch (error) {
|
|
174
|
-
const message =
|
|
176
|
+
const message = readFailure(error);
|
|
175
177
|
patch(localId, { status: "error", error: message });
|
|
176
178
|
onRejected?.(message, file);
|
|
177
179
|
return null;
|
|
178
180
|
}
|
|
179
181
|
return asset;
|
|
180
|
-
}, [acceptance, initOptions, labels, onRejected, onUploaded, patch, runSession]);
|
|
182
|
+
}, [acceptance, initOptions, labels, onRejected, onUploaded, patch, readFailure, runSession]);
|
|
181
183
|
const upload = useCallback((file, fileInitOptions) => run(file, undefined, fileInitOptions), [run]);
|
|
182
184
|
/** Starts a failed item's file again, in the place it had. */
|
|
183
185
|
const retry = useCallback((localId) => {
|
|
184
186
|
const failed = items.find((item) => item.localId === localId && item.status === "error");
|
|
185
187
|
return failed ? run(failed.file, localId, failed.initOptions) : Promise.resolve(null);
|
|
186
188
|
}, [items, run]);
|
|
187
|
-
|
|
189
|
+
/** Stops what is on its way; `reason` reaches the runner as the signal's (a target may read it). */
|
|
190
|
+
const cancel = useCallback((reason) => {
|
|
188
191
|
for (const controller of running.current)
|
|
189
|
-
controller.abort();
|
|
192
|
+
controller.abort(reason);
|
|
190
193
|
}, []);
|
|
191
194
|
const reset = useCallback(() => setItems([]), []);
|
|
192
195
|
const uploading = items.some((item) => item.status === "uploading");
|
|
@@ -20,6 +20,39 @@ export declare function usePhiMediaLibraryAddPicker({ mediaType, labels, folderP
|
|
|
20
20
|
isAssetSelectable?: (asset: PhiMediaAssetTile) => boolean;
|
|
21
21
|
onAssetSelect: (asset: PhiMediaAssetTile) => void;
|
|
22
22
|
}): {
|
|
23
|
+
labels: {
|
|
24
|
+
trigger: string;
|
|
25
|
+
title: string;
|
|
26
|
+
search: string;
|
|
27
|
+
folder: string;
|
|
28
|
+
space: string;
|
|
29
|
+
empty: string;
|
|
30
|
+
sourceEmpty: string;
|
|
31
|
+
clear: string;
|
|
32
|
+
reload: string;
|
|
33
|
+
tileSize: string;
|
|
34
|
+
source: string;
|
|
35
|
+
importing: string;
|
|
36
|
+
loadMore: string;
|
|
37
|
+
upload: string;
|
|
38
|
+
};
|
|
39
|
+
getPopupContainer: ((triggerNode: HTMLElement) => HTMLElement) | undefined;
|
|
40
|
+
popupRootClassName: string | undefined;
|
|
41
|
+
isAssetSelectable: ((asset: PhiMediaAssetTile) => boolean) | undefined;
|
|
42
|
+
onOpenChange: (next: boolean) => void;
|
|
43
|
+
onCommit: ((assetId: number | null, originalAssetId: number | null) => void) | undefined;
|
|
44
|
+
onDiscard: ((originalAssetId: number | null) => void) | undefined;
|
|
45
|
+
onQueryChange: (nextQuery: string) => void;
|
|
46
|
+
onSpaceChange: (nextSpace: string) => void;
|
|
47
|
+
onSourceChange: (nextSource: string) => void;
|
|
48
|
+
onSourceItemSelect: (item: import("@phis/contracts/media-source").PhisMediaSourceItem) => Promise<PhiMediaAssetTile | null>;
|
|
49
|
+
onSourceLoadMore: () => void;
|
|
50
|
+
onFolderChange: (nextFolder: string) => void;
|
|
51
|
+
onPageChange: (nextPage: number, nextPageSize: number) => void;
|
|
52
|
+
onMinColumnWidthChange: import("react").Dispatch<import("react").SetStateAction<number>>;
|
|
53
|
+
onReload: () => void;
|
|
54
|
+
onChange: (assetId: number | null) => void;
|
|
55
|
+
placement?: "top" | "right" | "bottom" | "left" | "topLeft" | "topRight" | "bottomRight" | "bottomLeft" | "auto" | "leftTop" | "leftBottom" | "rightTop" | "rightBottom" | undefined;
|
|
23
56
|
open: boolean;
|
|
24
57
|
value: number | null;
|
|
25
58
|
assets: PhiMediaAssetTile[];
|
|
@@ -59,36 +92,4 @@ export declare function usePhiMediaLibraryAddPicker({ mediaType, labels, folderP
|
|
|
59
92
|
showFolderFilter: boolean;
|
|
60
93
|
showPagination: boolean;
|
|
61
94
|
trigger: import("react").ReactNode;
|
|
62
|
-
labels: {
|
|
63
|
-
trigger: string;
|
|
64
|
-
title: string;
|
|
65
|
-
search: string;
|
|
66
|
-
folder: string;
|
|
67
|
-
space: string;
|
|
68
|
-
empty: string;
|
|
69
|
-
sourceEmpty: string;
|
|
70
|
-
clear: string;
|
|
71
|
-
reload: string;
|
|
72
|
-
tileSize: string;
|
|
73
|
-
source: string;
|
|
74
|
-
importing: string;
|
|
75
|
-
loadMore: string;
|
|
76
|
-
upload: string;
|
|
77
|
-
};
|
|
78
|
-
getPopupContainer: ((triggerNode: HTMLElement) => HTMLElement) | undefined;
|
|
79
|
-
popupRootClassName: string | undefined;
|
|
80
|
-
isAssetSelectable: ((asset: PhiMediaAssetTile) => boolean) | undefined;
|
|
81
|
-
onOpenChange: (next: boolean) => void;
|
|
82
|
-
onCommit: ((assetId: number | null, originalAssetId: number | null) => void) | undefined;
|
|
83
|
-
onDiscard: ((originalAssetId: number | null) => void) | undefined;
|
|
84
|
-
onQueryChange: (nextQuery: string) => void;
|
|
85
|
-
onSpaceChange: (nextSpace: string) => void;
|
|
86
|
-
onSourceChange: (nextSource: string) => void;
|
|
87
|
-
onSourceItemSelect: (item: import("@phis/contracts/media-source").PhisMediaSourceItem) => Promise<PhiMediaAssetTile | null>;
|
|
88
|
-
onSourceLoadMore: () => void;
|
|
89
|
-
onFolderChange: (nextFolder: string) => void;
|
|
90
|
-
onPageChange: (nextPage: number, nextPageSize: number) => void;
|
|
91
|
-
onMinColumnWidthChange: import("react").Dispatch<import("react").SetStateAction<number>>;
|
|
92
|
-
onReload: () => void;
|
|
93
|
-
onChange: (assetId: number | null) => void;
|
|
94
95
|
};
|
|
@@ -6,8 +6,8 @@ import { parsePhiCmsOverlayConfig, resolvePhiCmsOverlayBehaviour, } from "../../
|
|
|
6
6
|
import { readPhiControlSize } from "../../types/control";
|
|
7
7
|
import { readPhiDimensionValue } from "../../types/dimension";
|
|
8
8
|
import { resolvePhiCmsContainerSurface } from "../../helpers/cms-container-chrome";
|
|
9
|
-
import {
|
|
10
|
-
import {
|
|
9
|
+
import { createPhiSignalAddress, findPhiSignalRoutesByCapabilityId, } from "../../types/signals";
|
|
10
|
+
import { readPhiAnnouncedAction } from "../../helpers/announced-action";
|
|
11
11
|
import { emitPhiSignalCapability, usePhiSignalEmitter, PhiSignalIdentityProvider, } from "../runtime/runtime-signal-identity";
|
|
12
12
|
import { usePhiSignalListener } from "../runtime/runtime-signal-bus";
|
|
13
13
|
import { registerPhiSignalInstance } from "../runtime/runtime-signal-registry";
|
|
@@ -26,22 +26,24 @@ function renderOverlayZonesFailure(failure) {
|
|
|
26
26
|
/** Stands where the body will be while the zones are on their way, so the shell opens at once. */
|
|
27
27
|
const PHI_OVERLAY_ZONES_PENDING = (_jsx("div", { "aria-busy": "true", style: { minBlockSize: "calc(var(--phi-control-height) * 3)" } }));
|
|
28
28
|
/**
|
|
29
|
-
* Whether an `open` carried on
|
|
29
|
+
* Whether an `open` carried on an action channel is meant for this Overlay.
|
|
30
30
|
*
|
|
31
|
-
* A Table announces every action on one channel and names the action in the message, so
|
|
32
|
-
* subscribed to
|
|
33
|
-
*
|
|
31
|
+
* A Table announces every action on one channel and names the action in the message, and so does a
|
|
32
|
+
* Collection View (`collection-action`), so an Overlay subscribed to either hears `test` and `delete` as
|
|
33
|
+
* loudly as the one it is for. `openActionKey` is the filter, and it is the same field the Form and
|
|
34
|
+
* Record Widgets read for the same reason.
|
|
34
35
|
*
|
|
35
36
|
* Every other `open` passes untouched: a `dialog` route carries no value and has nothing to match on.
|
|
36
|
-
*
|
|
37
|
+
* An action-shaped `open` without a key opens for nothing rather than for everything -- the quiet failure
|
|
37
38
|
* is a dialog that will not come up, not one that comes up whenever a row is deleted.
|
|
38
39
|
*/
|
|
39
40
|
function matchesOpenAction(signal, route, openActionKey) {
|
|
40
|
-
|
|
41
|
+
const announced = readPhiAnnouncedAction(route.valueSchema, signal.value);
|
|
42
|
+
if (announced === undefined)
|
|
41
43
|
return true;
|
|
42
44
|
if (!openActionKey)
|
|
43
45
|
return false;
|
|
44
|
-
return
|
|
46
|
+
return announced?.actionKey === openActionKey;
|
|
45
47
|
}
|
|
46
48
|
function matchesRoute(signal, route) {
|
|
47
49
|
return route.receiver === signal.receiver &&
|
|
@@ -3,6 +3,7 @@ import type { PhiRuntimeModuleId } from "../../../types/cms-module-descriptors";
|
|
|
3
3
|
import type { PhiRenderableBlockSize } from "../../../types/renderable-block";
|
|
4
4
|
import type { PhiFormWidgetPlacement, PhiWidgetPlacementSignalRoutes } from "../../../types/core-widget-placements";
|
|
5
5
|
import type { PhiFormId } from "../../../types/form-id";
|
|
6
|
+
import { PHI_SIGNAL_VALUE_SCHEMAS } from "../../../types/signals";
|
|
6
7
|
export type PhiSettingsPageShellWidgetSection = {
|
|
7
8
|
kind?: "widget";
|
|
8
9
|
/** Preset-locally unique node key for the section's Widget instance id. */
|
|
@@ -104,6 +105,12 @@ export type PhiSettingsPageShellOverlay = {
|
|
|
104
105
|
* derives from `nodeKey`, which the caller derives the same way -- the preset identity is shared.
|
|
105
106
|
*/
|
|
106
107
|
openActionKey: string;
|
|
108
|
+
/**
|
|
109
|
+
* Who announces that action: a Table (`tableAction`, the default) or a Collection View
|
|
110
|
+
* (`collectionAction`, an item's or the toolbar's action). The Overlay listens under that schema and
|
|
111
|
+
* filters by `openActionKey` either way.
|
|
112
|
+
*/
|
|
113
|
+
openValueSchema?: typeof PHI_SIGNAL_VALUE_SCHEMAS.tableAction | typeof PHI_SIGNAL_VALUE_SCHEMAS.collectionAction;
|
|
107
114
|
formId: PhiFormId;
|
|
108
115
|
label: string;
|
|
109
116
|
formConfig?: Record<string, unknown>;
|
|
@@ -385,8 +385,8 @@ export function buildPhiSettingsPageShellTree({ page, ownerModuleId, presetKey,
|
|
|
385
385
|
signalRoutes: {
|
|
386
386
|
listens: [
|
|
387
387
|
/*
|
|
388
|
-
* The Table's own action channel, filtered by `openActionKey`.
|
|
389
|
-
* Overlay would open for every action
|
|
388
|
+
* The Table's own action channel, or the Collection View's, filtered by `openActionKey`.
|
|
389
|
+
* Without the filter this Overlay would open for every action announced, delete included.
|
|
390
390
|
*/
|
|
391
391
|
{
|
|
392
392
|
routeKey: `${overlay.nodeKey}-open`,
|
|
@@ -395,7 +395,7 @@ export function buildPhiSettingsPageShellTree({ page, ownerModuleId, presetKey,
|
|
|
395
395
|
channel: "action",
|
|
396
396
|
action: "activate",
|
|
397
397
|
valueType: "json",
|
|
398
|
-
valueSchema: PHI_SIGNAL_VALUE_SCHEMAS.tableAction,
|
|
398
|
+
valueSchema: overlay.openValueSchema ?? PHI_SIGNAL_VALUE_SCHEMAS.tableAction,
|
|
399
399
|
receiver: createPhiSignalAddress("cms", overlayIds[overlay.nodeKey]),
|
|
400
400
|
},
|
|
401
401
|
{
|
|
@@ -15,5 +15,8 @@ export declare function isPhiBuilderIconNamespace(namespace: string): boolean;
|
|
|
15
15
|
* preset: there are no aliases (`add`, `cancel`, `trash`) beside it, and case counts. `module:`,
|
|
16
16
|
* `iconify:`, `asset:` and the Builder's motif namespaces are drawn by their own owners, which say for
|
|
17
17
|
* themselves whether the name exists, so here they count as known.
|
|
18
|
+
*
|
|
19
|
+
* Asked where a name is chosen -- a preset's checks, the Builder's save (`helpers/widget-binding-check.ts`)
|
|
20
|
+
* -- and not by `PhiIcon` on a live page, which draws what it was handed (owner, 2026-11-24).
|
|
18
21
|
*/
|
|
19
22
|
export declare function isPhiIconNameKnown(name: string): boolean;
|
|
@@ -243,6 +243,9 @@ export function isPhiBuilderIconNamespace(namespace) {
|
|
|
243
243
|
* preset: there are no aliases (`add`, `cancel`, `trash`) beside it, and case counts. `module:`,
|
|
244
244
|
* `iconify:`, `asset:` and the Builder's motif namespaces are drawn by their own owners, which say for
|
|
245
245
|
* themselves whether the name exists, so here they count as known.
|
|
246
|
+
*
|
|
247
|
+
* Asked where a name is chosen -- a preset's checks, the Builder's save (`helpers/widget-binding-check.ts`)
|
|
248
|
+
* -- and not by `PhiIcon` on a live page, which draws what it was handed (owner, 2026-11-24).
|
|
246
249
|
*/
|
|
247
250
|
export function isPhiIconNameKnown(name) {
|
|
248
251
|
const [namespace, ...rest] = name.split(":");
|
|
@@ -1,6 +1,4 @@
|
|
|
1
1
|
import { type PhiAntdIconPresentation } from "./phi-antd-icon";
|
|
2
|
-
import { isPhiIconNameKnown } from "./phi-icon-names";
|
|
3
|
-
export { isPhiIconNameKnown };
|
|
4
2
|
/**
|
|
5
3
|
* `style`, `className`, `title`, `ariaLabel` and `twoToneColor` reach the Ant Design icons, which is
|
|
6
4
|
* where the house draws its interface icons, and all but `twoToneColor` a Module's own icon
|
|
@@ -11,11 +9,11 @@ type PhiIconProps = {
|
|
|
11
9
|
size?: number | string;
|
|
12
10
|
} & PhiAntdIconPresentation;
|
|
13
11
|
/**
|
|
14
|
-
*
|
|
12
|
+
* The icon a name names, or nothing.
|
|
15
13
|
*
|
|
16
|
-
*
|
|
17
|
-
*
|
|
18
|
-
*
|
|
14
|
+
* A name is not looked up against the vocabulary first: where it is chosen -- a preset, a Builder save
|
|
15
|
+
* -- it is checked (`isPhiIconNameKnown`, owner 2026-11-24), and a live page trusts it. A name that names
|
|
16
|
+
* nothing still draws nothing, because each namespace below answers only what it has.
|
|
19
17
|
*/
|
|
20
|
-
export declare function reportPhiUnknownIconName(name: string): void;
|
|
21
18
|
export declare function PhiIcon({ name, size, ...presentation }: PhiIconProps): import("react").JSX.Element | null;
|
|
19
|
+
export {};
|
|
@@ -3,8 +3,7 @@ import { jsx as _jsx } from "react/jsx-runtime";
|
|
|
3
3
|
import { lazy, Suspense, useEffect, useState, } from "react";
|
|
4
4
|
import { PHI_MODULE_ICON_NAMESPACE } from "../../constants/module-identity";
|
|
5
5
|
import { PhiAntdIcon } from "./phi-antd-icon";
|
|
6
|
-
import { isPhiBuilderIconNamespace,
|
|
7
|
-
export { isPhiIconNameKnown };
|
|
6
|
+
import { isPhiBuilderIconNamespace, PHI_ANTD_ICON_NAMES } from "./phi-icon-names";
|
|
8
7
|
import { PhiModuleIcon } from "./phi-module-icons";
|
|
9
8
|
let iconifyComponentLoader = null;
|
|
10
9
|
function loadIconifyComponent() {
|
|
@@ -30,21 +29,6 @@ function renderIconFallback(size) {
|
|
|
30
29
|
height: size,
|
|
31
30
|
} }));
|
|
32
31
|
}
|
|
33
|
-
const reportedUnknownIconNames = new Set();
|
|
34
|
-
/**
|
|
35
|
-
* Says once per name that it names no icon, where somebody reads it.
|
|
36
|
-
*
|
|
37
|
-
* An unknown name draws nothing -- no word, no placeholder -- so without this a typo is a blank nobody
|
|
38
|
-
* notices. Rendered on the server the warning lands in the Site service's journal, in the browser in its
|
|
39
|
-
* console. `validate-preset-icon-vocabulary` catches the same mistake in a preset before it ships.
|
|
40
|
-
*/
|
|
41
|
-
export function reportPhiUnknownIconName(name) {
|
|
42
|
-
if (reportedUnknownIconNames.has(name))
|
|
43
|
-
return;
|
|
44
|
-
reportedUnknownIconNames.add(name);
|
|
45
|
-
console.warn(`[phi-icon] "${name}" names no icon and draws nothing. Use a name from PHI_ANTD_ICON_NAMES `
|
|
46
|
-
+ "(components/shell/phi-icon-names.ts), with or without `antd:`, or a `module:`, `iconify:` or `asset:` name.");
|
|
47
|
-
}
|
|
48
32
|
function renderAntdIcon(key, size, presentation) {
|
|
49
33
|
const icon = PHI_ANTD_ICON_NAMES[key];
|
|
50
34
|
return icon ? _jsx(PhiAntdIcon, { icon: icon, size: size, ...presentation }) : null;
|
|
@@ -85,14 +69,17 @@ function PhiIconifyIcon({ icon, size }) {
|
|
|
85
69
|
}
|
|
86
70
|
return _jsx(IconifyIcon, { icon: icon, width: size, height: size, inline: true });
|
|
87
71
|
}
|
|
72
|
+
/**
|
|
73
|
+
* The icon a name names, or nothing.
|
|
74
|
+
*
|
|
75
|
+
* A name is not looked up against the vocabulary first: where it is chosen -- a preset, a Builder save
|
|
76
|
+
* -- it is checked (`isPhiIconNameKnown`, owner 2026-11-24), and a live page trusts it. A name that names
|
|
77
|
+
* nothing still draws nothing, because each namespace below answers only what it has.
|
|
78
|
+
*/
|
|
88
79
|
export function PhiIcon({ name, size = 16, ...presentation }) {
|
|
89
80
|
if (!name) {
|
|
90
81
|
return null;
|
|
91
82
|
}
|
|
92
|
-
if (!isPhiIconNameKnown(name)) {
|
|
93
|
-
reportPhiUnknownIconName(name);
|
|
94
|
-
return null;
|
|
95
|
-
}
|
|
96
83
|
const resolvedSize = size === "inherit" ? "1em" : size;
|
|
97
84
|
const [namespace, ...rest] = name.split(":");
|
|
98
85
|
const value = rest.join(":");
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* A Table's binding params: what its source was configured with, and what its reader, its binding tools
|
|
3
|
+
* or a signal set since.
|
|
4
|
+
*
|
|
5
|
+
* What was set is tagged with the configuration it was set against. A Builder edit of the configured
|
|
6
|
+
* params is a new starting point; the reader's earlier choice belonged to the old one and would
|
|
7
|
+
* otherwise outlive it.
|
|
8
|
+
*
|
|
9
|
+
* `changeBindingParams` merges a change into the params as they stand after the last change -- ahead of
|
|
10
|
+
* the render that shows them -- and answers the params it made, or null where nothing changed. Both
|
|
11
|
+
* matter to a Table read by a Controller:
|
|
12
|
+
* - two binding tools that answer in the same commit each wrote their value over the params of that
|
|
13
|
+
* render, so the second put back what the first had changed, and the first answered again on the next
|
|
14
|
+
* render -- each answer a new source, a new read and a `bindingParamsChange` handed on;
|
|
15
|
+
* - the same params again were a new object, so a new source and a new read, and handed on again: a
|
|
16
|
+
* Controller that hands its scope on every change of what it reads from read the same history up to
|
|
17
|
+
* six times on opening the Builder's Revisions. The same params are no change at all now.
|
|
18
|
+
*/
|
|
19
|
+
export declare function usePhiTableBindingParams(configured: Record<string, unknown>): {
|
|
20
|
+
bindingParams: Record<string, unknown>;
|
|
21
|
+
changeBindingParams: (patch: Record<string, unknown>) => {
|
|
22
|
+
[x: string]: unknown;
|
|
23
|
+
} | null;
|
|
24
|
+
};
|
|
@@ -0,0 +1,39 @@
|
|
|
1
|
+
"use client";
|
|
2
|
+
import { useCallback, useLayoutEffect, useRef, useState } from "react";
|
|
3
|
+
/**
|
|
4
|
+
* A Table's binding params: what its source was configured with, and what its reader, its binding tools
|
|
5
|
+
* or a signal set since.
|
|
6
|
+
*
|
|
7
|
+
* What was set is tagged with the configuration it was set against. A Builder edit of the configured
|
|
8
|
+
* params is a new starting point; the reader's earlier choice belonged to the old one and would
|
|
9
|
+
* otherwise outlive it.
|
|
10
|
+
*
|
|
11
|
+
* `changeBindingParams` merges a change into the params as they stand after the last change -- ahead of
|
|
12
|
+
* the render that shows them -- and answers the params it made, or null where nothing changed. Both
|
|
13
|
+
* matter to a Table read by a Controller:
|
|
14
|
+
* - two binding tools that answer in the same commit each wrote their value over the params of that
|
|
15
|
+
* render, so the second put back what the first had changed, and the first answered again on the next
|
|
16
|
+
* render -- each answer a new source, a new read and a `bindingParamsChange` handed on;
|
|
17
|
+
* - the same params again were a new object, so a new source and a new read, and handed on again: a
|
|
18
|
+
* Controller that hands its scope on every change of what it reads from read the same history up to
|
|
19
|
+
* six times on opening the Builder's Revisions. The same params are no change at all now.
|
|
20
|
+
*/
|
|
21
|
+
export function usePhiTableBindingParams(configured) {
|
|
22
|
+
const seed = JSON.stringify(configured);
|
|
23
|
+
const [chosen, setChosen] = useState(null);
|
|
24
|
+
const bindingParams = chosen?.seed === seed ? chosen.params : configured;
|
|
25
|
+
const latest = useRef(bindingParams);
|
|
26
|
+
useLayoutEffect(() => {
|
|
27
|
+
latest.current = bindingParams;
|
|
28
|
+
}, [bindingParams]);
|
|
29
|
+
const changeBindingParams = useCallback((patch) => {
|
|
30
|
+
const current = latest.current;
|
|
31
|
+
const next = { ...current, ...patch };
|
|
32
|
+
if (JSON.stringify(next) === JSON.stringify(current))
|
|
33
|
+
return null;
|
|
34
|
+
latest.current = next;
|
|
35
|
+
setChosen({ seed, params: next });
|
|
36
|
+
return next;
|
|
37
|
+
}, [seed]);
|
|
38
|
+
return { bindingParams, changeBindingParams };
|
|
39
|
+
}
|
|
@@ -17,16 +17,14 @@ export type PhiTableBindingInput = {
|
|
|
17
17
|
initialExpandedRowIdentities?: readonly PhiTableRowIdentity[];
|
|
18
18
|
onData?: (data: PhiTableProviderQueryResult) => void;
|
|
19
19
|
onMutation?: (result: PhiTableProviderMutationResult) => void;
|
|
20
|
-
validateResource?: (resource: PhiTableProviderResourceDescriptor) => string | null;
|
|
21
20
|
};
|
|
22
|
-
export declare function usePhiTableBinding({ source, initialQuery, externalQuery, fixedFilters, externalSearch, defaultPageSize, refreshKey, preserveSelectedRowIdentities, initialExpandedRowIdentities, onData, onMutation,
|
|
21
|
+
export declare function usePhiTableBinding({ source, initialQuery, externalQuery, fixedFilters, externalSearch, defaultPageSize, refreshKey, preserveSelectedRowIdentities, initialExpandedRowIdentities, onData, onMutation, }: PhiTableBindingInput): {
|
|
23
22
|
resource: PhiTableProviderResourceDescriptor | null;
|
|
24
23
|
bindingError: string | null;
|
|
25
24
|
rows: readonly TableRow[];
|
|
26
25
|
total: number | null;
|
|
27
26
|
hasMore: boolean;
|
|
28
27
|
summary: Readonly<Record<string, PhiTableSummaryValue>>;
|
|
29
|
-
contractError: string | null;
|
|
30
28
|
loading: boolean;
|
|
31
29
|
error: PhiTableProviderError | null;
|
|
32
30
|
queryError: PhiTableProviderError | null;
|
|
@@ -94,7 +94,7 @@ function resolvePhiTableQuery(query, externalQuery, externalSearch, expandedRowI
|
|
|
94
94
|
expandedRowIdentities,
|
|
95
95
|
};
|
|
96
96
|
}
|
|
97
|
-
export function usePhiTableBinding({ source, initialQuery = {}, externalQuery, fixedFilters, externalSearch, defaultPageSize = 20, refreshKey, preserveSelectedRowIdentities = false, initialExpandedRowIdentities = [], onData, onMutation,
|
|
97
|
+
export function usePhiTableBinding({ source, initialQuery = {}, externalQuery, fixedFilters, externalSearch, defaultPageSize = 20, refreshKey, preserveSelectedRowIdentities = false, initialExpandedRowIdentities = [], onData, onMutation, }) {
|
|
98
98
|
const { provider, resource, bindingError } = usePhiTableProvider(source);
|
|
99
99
|
/*
|
|
100
100
|
* The reader's language and the Site's zone go with every query, and into what decides that a query
|
|
@@ -102,7 +102,6 @@ export function usePhiTableBinding({ source, initialQuery = {}, externalQuery, f
|
|
|
102
102
|
*/
|
|
103
103
|
const locale = usePhiIntlLocale();
|
|
104
104
|
const timeZone = usePhiIntlTimeZone();
|
|
105
|
-
const resourceError = resource ? validateResource?.(resource) ?? null : null;
|
|
106
105
|
const [query, setQuery] = useState(() => ({
|
|
107
106
|
page: initialQuery.page ?? 1,
|
|
108
107
|
pageSize: initialQuery.pageSize ?? defaultPageSize,
|
|
@@ -284,7 +283,7 @@ export function usePhiTableBinding({ source, initialQuery = {}, externalQuery, f
|
|
|
284
283
|
onDataRef.current?.(data);
|
|
285
284
|
}, [preserveSelectedRowIdentities, resolvedQuery.pageSize, resource, sourceKey]);
|
|
286
285
|
useEffect(() => {
|
|
287
|
-
if (!source || !provider || !resource
|
|
286
|
+
if (!source || !provider || !resource)
|
|
288
287
|
return;
|
|
289
288
|
if (acceptedResolvedQuery.current?.queryKey === resolvedQueryKey &&
|
|
290
289
|
acceptedResolvedQuery.current.refreshRevision === refreshRequest.revision) {
|
|
@@ -293,7 +292,6 @@ export function usePhiTableBinding({ source, initialQuery = {}, externalQuery, f
|
|
|
293
292
|
provider,
|
|
294
293
|
resource,
|
|
295
294
|
source,
|
|
296
|
-
resourceError,
|
|
297
295
|
resolvedQueryKey,
|
|
298
296
|
refreshKey,
|
|
299
297
|
locale,
|
|
@@ -306,13 +304,12 @@ export function usePhiTableBinding({ source, initialQuery = {}, externalQuery, f
|
|
|
306
304
|
previous.provider === provider &&
|
|
307
305
|
previous.resource === resource &&
|
|
308
306
|
previous.source === source &&
|
|
309
|
-
previous.resourceError === resourceError &&
|
|
310
307
|
previous.resolvedQueryKey === resolvedQueryKey &&
|
|
311
308
|
previous.refreshKey === refreshKey &&
|
|
312
309
|
previous.locale === locale &&
|
|
313
310
|
previous.timeZone === timeZone;
|
|
314
311
|
const background = refreshRequest.background && sameQueryInputs && rowsRef.current.length > 0;
|
|
315
|
-
previousQueryInputs.current = { provider, resource, source,
|
|
312
|
+
previousQueryInputs.current = { provider, resource, source, resolvedQueryKey, refreshKey, locale, timeZone };
|
|
316
313
|
const abortController = new AbortController();
|
|
317
314
|
queueMicrotask(() => {
|
|
318
315
|
if (!abortController.signal.aborted) {
|
|
@@ -368,7 +365,7 @@ export function usePhiTableBinding({ source, initialQuery = {}, externalQuery, f
|
|
|
368
365
|
}
|
|
369
366
|
});
|
|
370
367
|
return () => abortController.abort();
|
|
371
|
-
}, [applyData, expandedRowIdentities, externalQuery, externalSearch, locale, provider, query, refreshKey, refreshRequest, resolvedQuery, resolvedQueryKey, resource,
|
|
368
|
+
}, [applyData, expandedRowIdentities, externalQuery, externalSearch, locale, provider, query, refreshKey, refreshRequest, resolvedQuery, resolvedQueryKey, resource, source, stableFixedFilters, timeZone]);
|
|
372
369
|
const reload = useCallback(() => setRefreshRequest((current) => ({
|
|
373
370
|
revision: current.revision + 1,
|
|
374
371
|
background: false,
|
|
@@ -601,8 +598,7 @@ export function usePhiTableBinding({ source, initialQuery = {}, externalQuery, f
|
|
|
601
598
|
total,
|
|
602
599
|
hasMore,
|
|
603
600
|
summary,
|
|
604
|
-
|
|
605
|
-
loading: queryLoading && !bindingError && !resourceError,
|
|
601
|
+
loading: queryLoading && !bindingError,
|
|
606
602
|
error,
|
|
607
603
|
queryError: queryFailure,
|
|
608
604
|
query,
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
import { LinkNode, type SerializedLinkNode } from "@lexical/link";
|
|
2
|
+
import { type DOMConversionMap, type LexicalNodeReplacement } from "lexical";
|
|
3
|
+
/** Keeps Page identity in authoring HTML; only the server render resolves it to an address. */
|
|
4
|
+
export declare class PhiHtmlLinkNode extends LinkNode {
|
|
5
|
+
static getType(): string;
|
|
6
|
+
static clone(node: PhiHtmlLinkNode): PhiHtmlLinkNode;
|
|
7
|
+
static importJSON(serializedNode: SerializedLinkNode): PhiHtmlLinkNode;
|
|
8
|
+
static importDOM(): DOMConversionMap;
|
|
9
|
+
sanitizeUrl(url: string): string;
|
|
10
|
+
}
|
|
11
|
+
/** Factories, commands and imports must all create the same node, including LinkNode transforms. */
|
|
12
|
+
export declare const PHI_HTML_LINK_NODE_REPLACEMENT: LexicalNodeReplacement;
|
|
@@ -0,0 +1,60 @@
|
|
|
1
|
+
import { LinkNode } from "@lexical/link";
|
|
2
|
+
import { $applyNodeReplacement } from "lexical";
|
|
3
|
+
import { createPhiPageUri, readPhiInternalReference } from "../../../types/references";
|
|
4
|
+
/** Keeps Page identity in authoring HTML; only the server render resolves it to an address. */
|
|
5
|
+
export class PhiHtmlLinkNode extends LinkNode {
|
|
6
|
+
static getType() {
|
|
7
|
+
return "phi-html-link";
|
|
8
|
+
}
|
|
9
|
+
static clone(node) {
|
|
10
|
+
return new PhiHtmlLinkNode(node.__url, {
|
|
11
|
+
rel: node.__rel,
|
|
12
|
+
target: node.__target,
|
|
13
|
+
title: node.__title,
|
|
14
|
+
}, node.__key);
|
|
15
|
+
}
|
|
16
|
+
static importJSON(serializedNode) {
|
|
17
|
+
return $applyNodeReplacement(new PhiHtmlLinkNode()).updateFromJSON(serializedNode);
|
|
18
|
+
}
|
|
19
|
+
static importDOM() {
|
|
20
|
+
return {
|
|
21
|
+
a: () => ({
|
|
22
|
+
priority: 2,
|
|
23
|
+
conversion: (element) => {
|
|
24
|
+
if (!(element instanceof HTMLAnchorElement))
|
|
25
|
+
return null;
|
|
26
|
+
return {
|
|
27
|
+
node: $applyNodeReplacement(new PhiHtmlLinkNode(element.getAttribute("href") ?? "", {
|
|
28
|
+
rel: element.getAttribute("rel"),
|
|
29
|
+
target: element.getAttribute("target"),
|
|
30
|
+
title: element.getAttribute("title"),
|
|
31
|
+
})),
|
|
32
|
+
};
|
|
33
|
+
},
|
|
34
|
+
}),
|
|
35
|
+
};
|
|
36
|
+
}
|
|
37
|
+
sanitizeUrl(url) {
|
|
38
|
+
const reference = readPhiInternalReference(url);
|
|
39
|
+
if (reference?.kind === "page") {
|
|
40
|
+
try {
|
|
41
|
+
if (createPhiPageUri(reference.reference, reference.fragment) === url)
|
|
42
|
+
return url;
|
|
43
|
+
}
|
|
44
|
+
catch {
|
|
45
|
+
// A malformed Unicode fragment cannot be emitted by the canonical factory.
|
|
46
|
+
}
|
|
47
|
+
}
|
|
48
|
+
return super.sanitizeUrl(url);
|
|
49
|
+
}
|
|
50
|
+
}
|
|
51
|
+
/** Factories, commands and imports must all create the same node, including LinkNode transforms. */
|
|
52
|
+
export const PHI_HTML_LINK_NODE_REPLACEMENT = {
|
|
53
|
+
replace: LinkNode,
|
|
54
|
+
with: (node) => new PhiHtmlLinkNode(node.getURL(), {
|
|
55
|
+
rel: node.getRel(),
|
|
56
|
+
target: node.getTarget(),
|
|
57
|
+
title: node.getTitle(),
|
|
58
|
+
}),
|
|
59
|
+
withKlass: PhiHtmlLinkNode,
|
|
60
|
+
};
|