@phis/ui 0.8.0 → 0.8.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/components/cms/phi-cms-layout-renderer.js +15 -7
- package/components/cms/phi-cms-render-diagnostic-client.d.ts +3 -1
- package/components/cms/phi-cms-render-diagnostic-client.js +4 -3
- package/components/cms/phi-cms-render-diagnostic.d.ts +8 -2
- package/components/cms/phi-cms-render-diagnostic.js +12 -2
- package/components/cms/phi-cms-render-error-boundary.d.ts +2 -0
- package/components/cms/phi-cms-render-error-boundary.js +1 -1
- package/components/cms/phi-cms-root-layout.js +3 -1
- package/components/controls/phi-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 +23 -8
- 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/phi-media-picker-binding.d.ts +41 -33
- package/components/media/phi-media-picker-binding.js +2 -1
- package/components/media/use-media-library-add-picker.d.ts +33 -32
- package/components/overlays/phi-overlay-container-client.js +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/tables/client/phi-table-binding-params.d.ts +24 -0
- package/components/tables/client/phi-table-binding-params.js +39 -0
- package/components/tables/client/phi-table-binding.d.ts +1 -3
- package/components/tables/client/phi-table-binding.js +5 -9
- package/components/widgets/client/shared/phi-button-icons.d.ts +6 -4
- package/components/widgets/client/shared/phi-button-icons.js +8 -12
- package/components/widgets/client/shared/phi-collection-binding-params.d.ts +8 -0
- package/components/widgets/client/shared/phi-collection-binding-params.js +13 -0
- package/components/widgets/client/shared/phi-collection-provider.d.ts +11 -1
- package/components/widgets/client/shared/phi-collection-provider.js +5 -0
- package/components/widgets/client/shared/phi-collection-view-binding.d.ts +1 -0
- package/components/widgets/client/shared/phi-command-buttons.d.ts +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/customer-file.d.ts +12 -3
- package/constants/customer-file.js +12 -3
- package/constants/runtime-module-ownership.js +4 -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/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/next/root-route.js +2 -1
- package/package.json +1 -1
- 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/asset/trees/phi-default-admin-media-settings-page-tree.js +5 -0
- 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/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/client.js +5 -2
- package/plugins/runtime-modules/core/widgets/collection-view/config.js +8 -0
- package/plugins/runtime-modules/core/widgets/collection-view/site-address-binding.d.ts +55 -0
- package/plugins/runtime-modules/core/widgets/collection-view/site-address-binding.js +173 -0
- package/plugins/runtime-modules/core/widgets/collection-view/site-address-tiles.d.ts +48 -0
- package/plugins/runtime-modules/core/widgets/collection-view/site-address-tiles.js +67 -0
- package/plugins/runtime-modules/core/widgets/command-toolbar/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 +30 -48
- 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 +15 -1
- package/types/table-widget.js +0 -282
- package/types/tree-widget.d.ts +0 -1
- package/types/tree-widget.js +0 -60
- package/types/widget-runtime.d.ts +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
|
@@ -64,6 +64,7 @@ const PHI_MEDIA_SETTINGS_PAGE_LABEL_SET = definePhiLabelSet({
|
|
|
64
64
|
spaces_used: "Used",
|
|
65
65
|
spaces_search: "Search",
|
|
66
66
|
spaces_empty: definePhiMessageLabel("No Space of this kind exists yet."),
|
|
67
|
+
spaces_footer: "%1 Spaces",
|
|
67
68
|
},
|
|
68
69
|
});
|
|
69
70
|
export async function getPhiMediaSettingsPageLabels(options) {
|
|
@@ -139,6 +140,7 @@ export async function getPhiMediaSettingsPageLabels(options) {
|
|
|
139
140
|
used: labels.spaces_used,
|
|
140
141
|
search: labels.spaces_search,
|
|
141
142
|
empty: labels.spaces_empty,
|
|
143
|
+
footer: labels.spaces_footer,
|
|
142
144
|
},
|
|
143
145
|
submitLabel: labels.submit_label,
|
|
144
146
|
};
|
|
@@ -3,6 +3,7 @@ import { type PhisMediaSourceItem } from "@phis/contracts/media-source";
|
|
|
3
3
|
import type { PhiMediaAssetTile } from "../../types/media";
|
|
4
4
|
import type { PhiCmsMediaPickerWidgetConfig } from "../../types/media";
|
|
5
5
|
import type { PhiSearchWidgetLabels } from "../widgets/label-types/search";
|
|
6
|
+
import type { PhiPickerPlacement } from "../controls/phi-picker-control-contract";
|
|
6
7
|
import type { PhiAssetWidgetLabels } from "./media-widget-labels";
|
|
7
8
|
/**
|
|
8
9
|
* Where a file uploaded in the picker goes, as the binding hands it to the host's upload surface
|
|
@@ -48,6 +49,12 @@ export type PhiMediaPickerBindingProps = {
|
|
|
48
49
|
onDiscard?: (originalAssetId: number | null) => void;
|
|
49
50
|
onPopupOpenChange?: (open: boolean) => void;
|
|
50
51
|
trigger?: ReactNode;
|
|
52
|
+
/**
|
|
53
|
+
* Where the picker opens beside its trigger, which only the host can know: the Builder Inspector, a
|
|
54
|
+
* panel at the window's right, opens it to the left over the canvas; absent, the Control's default,
|
|
55
|
+
* centred below (`PhiMediaPickerControlProps.placement`).
|
|
56
|
+
*/
|
|
57
|
+
placement?: PhiPickerPlacement;
|
|
51
58
|
getPopupContainer?: (triggerNode: HTMLElement) => HTMLElement;
|
|
52
59
|
popupRootClassName?: string;
|
|
53
60
|
/**
|
|
@@ -80,7 +87,40 @@ export type PhiMediaPickerBindingProps = {
|
|
|
80
87
|
complete: boolean;
|
|
81
88
|
}>) | null;
|
|
82
89
|
};
|
|
83
|
-
export declare function usePhiMediaPickerBinding({ config, labels, searchLabels, value: controlledValue, onAssetSelect, onAssetClear, open: controlledOpen, onOpenChange, onCommit, onDiscard, onPopupOpenChange, trigger, getPopupContainer, popupRootClassName, siteSpaceOnly, isAssetSelectable, upload, openOnFolder, }: PhiMediaPickerBindingProps): {
|
|
90
|
+
export declare function usePhiMediaPickerBinding({ config, labels, searchLabels, value: controlledValue, onAssetSelect, onAssetClear, open: controlledOpen, onOpenChange, onCommit, onDiscard, onPopupOpenChange, trigger, placement, getPopupContainer, popupRootClassName, siteSpaceOnly, isAssetSelectable, upload, openOnFolder, }: PhiMediaPickerBindingProps): {
|
|
91
|
+
labels: {
|
|
92
|
+
trigger: string;
|
|
93
|
+
title: string;
|
|
94
|
+
search: string;
|
|
95
|
+
folder: string;
|
|
96
|
+
space: string;
|
|
97
|
+
empty: string;
|
|
98
|
+
sourceEmpty: string;
|
|
99
|
+
clear: string;
|
|
100
|
+
reload: string;
|
|
101
|
+
tileSize: string;
|
|
102
|
+
source: string;
|
|
103
|
+
importing: string;
|
|
104
|
+
loadMore: string;
|
|
105
|
+
upload: string;
|
|
106
|
+
};
|
|
107
|
+
getPopupContainer: ((triggerNode: HTMLElement) => HTMLElement) | undefined;
|
|
108
|
+
popupRootClassName: string | undefined;
|
|
109
|
+
isAssetSelectable: ((asset: PhiMediaAssetTile) => boolean) | undefined;
|
|
110
|
+
onOpenChange: (next: boolean) => void;
|
|
111
|
+
onCommit: ((assetId: number | null, originalAssetId: number | null) => void) | undefined;
|
|
112
|
+
onDiscard: ((originalAssetId: number | null) => void) | undefined;
|
|
113
|
+
onQueryChange: (nextQuery: string) => void;
|
|
114
|
+
onSpaceChange: (nextSpace: string) => void;
|
|
115
|
+
onSourceChange: (nextSource: string) => void;
|
|
116
|
+
onSourceItemSelect: (item: PhisMediaSourceItem) => Promise<PhiMediaAssetTile | null>;
|
|
117
|
+
onSourceLoadMore: () => void;
|
|
118
|
+
onFolderChange: (nextFolder: string) => void;
|
|
119
|
+
onPageChange: (nextPage: number, nextPageSize: number) => void;
|
|
120
|
+
onMinColumnWidthChange: import("react").Dispatch<import("react").SetStateAction<number>>;
|
|
121
|
+
onReload: () => void;
|
|
122
|
+
onChange: (assetId: number | null) => void;
|
|
123
|
+
placement?: "top" | "right" | "bottom" | "left" | "topLeft" | "topRight" | "bottomRight" | "bottomLeft" | "auto" | "leftTop" | "leftBottom" | "rightTop" | "rightBottom" | undefined;
|
|
84
124
|
open: boolean;
|
|
85
125
|
value: number | null;
|
|
86
126
|
assets: PhiMediaAssetTile[];
|
|
@@ -120,37 +160,5 @@ export declare function usePhiMediaPickerBinding({ config, labels, searchLabels,
|
|
|
120
160
|
showFolderFilter: boolean;
|
|
121
161
|
showPagination: boolean;
|
|
122
162
|
trigger: ReactNode;
|
|
123
|
-
labels: {
|
|
124
|
-
trigger: string;
|
|
125
|
-
title: string;
|
|
126
|
-
search: string;
|
|
127
|
-
folder: string;
|
|
128
|
-
space: string;
|
|
129
|
-
empty: string;
|
|
130
|
-
sourceEmpty: string;
|
|
131
|
-
clear: string;
|
|
132
|
-
reload: string;
|
|
133
|
-
tileSize: string;
|
|
134
|
-
source: string;
|
|
135
|
-
importing: string;
|
|
136
|
-
loadMore: string;
|
|
137
|
-
upload: string;
|
|
138
|
-
};
|
|
139
|
-
getPopupContainer: ((triggerNode: HTMLElement) => HTMLElement) | undefined;
|
|
140
|
-
popupRootClassName: string | undefined;
|
|
141
|
-
isAssetSelectable: ((asset: PhiMediaAssetTile) => boolean) | undefined;
|
|
142
|
-
onOpenChange: (next: boolean) => void;
|
|
143
|
-
onCommit: ((assetId: number | null, originalAssetId: number | null) => void) | undefined;
|
|
144
|
-
onDiscard: ((originalAssetId: number | null) => void) | undefined;
|
|
145
|
-
onQueryChange: (nextQuery: string) => void;
|
|
146
|
-
onSpaceChange: (nextSpace: string) => void;
|
|
147
|
-
onSourceChange: (nextSource: string) => void;
|
|
148
|
-
onSourceItemSelect: (item: PhisMediaSourceItem) => Promise<PhiMediaAssetTile | null>;
|
|
149
|
-
onSourceLoadMore: () => void;
|
|
150
|
-
onFolderChange: (nextFolder: string) => void;
|
|
151
|
-
onPageChange: (nextPage: number, nextPageSize: number) => void;
|
|
152
|
-
onMinColumnWidthChange: import("react").Dispatch<import("react").SetStateAction<number>>;
|
|
153
|
-
onReload: () => void;
|
|
154
|
-
onChange: (assetId: number | null) => void;
|
|
155
163
|
};
|
|
156
164
|
export declare function PhiMediaPickerBinding(props: PhiMediaPickerBindingProps): import("react").JSX.Element;
|
|
@@ -17,7 +17,7 @@ import { buildPhiMediaSpaceOptions, usePhiMediaSpaceSelectionAllowed, } from "./
|
|
|
17
17
|
import { isPhiRecord } from "../../helpers/is-record";
|
|
18
18
|
import { readPhiMediaSourceImportErrorMessage, usePhiMediaSources, } from "./phi-media-sources";
|
|
19
19
|
import { usePhiCollectionProviderAction } from "../widgets/client/shared/phi-collection-provider";
|
|
20
|
-
export function usePhiMediaPickerBinding({ config, labels, searchLabels, value: controlledValue, onAssetSelect, onAssetClear, open: controlledOpen, onOpenChange, onCommit, onDiscard, onPopupOpenChange, trigger, getPopupContainer, popupRootClassName, siteSpaceOnly = false, isAssetSelectable, upload, openOnFolder, }) {
|
|
20
|
+
export function usePhiMediaPickerBinding({ config, labels, searchLabels, value: controlledValue, onAssetSelect, onAssetClear, open: controlledOpen, onOpenChange, onCommit, onDiscard, onPopupOpenChange, trigger, placement, getPopupContainer, popupRootClassName, siteSpaceOnly = false, isAssetSelectable, upload, openOnFolder, }) {
|
|
21
21
|
const [localOpen, setLocalOpen] = useState(false);
|
|
22
22
|
const [localValue, setLocalValue] = useState(controlledValue ?? null);
|
|
23
23
|
const [searchQuery, setSearchQuery] = useState("");
|
|
@@ -445,6 +445,7 @@ export function usePhiMediaPickerBinding({ config, labels, searchLabels, value:
|
|
|
445
445
|
showFolderFilter: config?.showFolderFilter ?? true,
|
|
446
446
|
showPagination: config?.showPagination ?? true,
|
|
447
447
|
trigger,
|
|
448
|
+
...(placement ? { placement } : {}),
|
|
448
449
|
labels: { trigger: labels.picker.triggerLabel, title: labels.picker.popoverTitle, search: labels.tool.searchPlaceholder ?? searchLabels.placeholder, folder: labels.tool.folderLabel, space: labels.space.label, empty: bindingError ?? (loadFailed ? labels.picker.loadFailedDescription : labels.picker.emptyDescription), sourceEmpty: sourceFailed ? labels.picker.sourceFailedText : labels.picker.emptyDescription, clear: labels.picker.clearLabel, reload: labels.tool.reloadLabel, tileSize: labels.picker.tileSizeLabel, source: labels.picker.sourceLabel, importing: labels.picker.importingLabel, loadMore: labels.picker.loadMoreLabel, upload: labels.upload.uploadToggleLabel },
|
|
449
450
|
getPopupContainer,
|
|
450
451
|
popupRootClassName,
|
|
@@ -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,
|
|
@@ -1,9 +1,11 @@
|
|
|
1
1
|
import type { ReactNode } from "react";
|
|
2
2
|
/**
|
|
3
|
-
* The icon a Button, a Table action or a Command Toolbar names, or null where
|
|
3
|
+
* The icon a Button, a Table action or a Command Toolbar names, as an element, or null where it names
|
|
4
|
+
* none.
|
|
4
5
|
*
|
|
5
|
-
* The same
|
|
6
|
-
*
|
|
7
|
-
*
|
|
6
|
+
* The same names as `PhiIcon`: a short name is the Ant Design icon of that name, one name per icon. The
|
|
7
|
+
* name is not looked up here: a preset's is checked by its tests and the Builder's by its save
|
|
8
|
+
* (`isPhiIconNameKnown`), so a live page draws what it was handed, and a name that names nothing draws
|
|
9
|
+
* nothing.
|
|
8
10
|
*/
|
|
9
11
|
export declare function resolvePhiButtonIcon(icon: string | null | undefined): ReactNode;
|
|
@@ -1,20 +1,16 @@
|
|
|
1
1
|
"use client";
|
|
2
2
|
import { jsx as _jsx } from "react/jsx-runtime";
|
|
3
|
-
import {
|
|
3
|
+
import { PhiIcon } from "../../../shell/phi-icon";
|
|
4
4
|
/**
|
|
5
|
-
* The icon a Button, a Table action or a Command Toolbar names, or null where
|
|
5
|
+
* The icon a Button, a Table action or a Command Toolbar names, as an element, or null where it names
|
|
6
|
+
* none.
|
|
6
7
|
*
|
|
7
|
-
* The same
|
|
8
|
-
*
|
|
9
|
-
*
|
|
8
|
+
* The same names as `PhiIcon`: a short name is the Ant Design icon of that name, one name per icon. The
|
|
9
|
+
* name is not looked up here: a preset's is checked by its tests and the Builder's by its save
|
|
10
|
+
* (`isPhiIconNameKnown`), so a live page draws what it was handed, and a name that names nothing draws
|
|
11
|
+
* nothing.
|
|
10
12
|
*/
|
|
11
13
|
export function resolvePhiButtonIcon(icon) {
|
|
12
14
|
const name = icon?.trim();
|
|
13
|
-
|
|
14
|
-
return null;
|
|
15
|
-
if (!isPhiIconNameKnown(name)) {
|
|
16
|
-
reportPhiUnknownIconName(name);
|
|
17
|
-
return null;
|
|
18
|
-
}
|
|
19
|
-
return _jsx(PhiIcon, { name: name, size: "1em" });
|
|
15
|
+
return name ? _jsx(PhiIcon, { name: name, size: "1em" }) : null;
|
|
20
16
|
}
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* A Collection View's binding params after a `bindingParamsChange` (`{ params }`): the received ones laid
|
|
3
|
+
* over the ones it has, or `null` where that changes nothing -- the same set again is no new set, so it
|
|
4
|
+
* neither starts the list over nor asks the Provider again. This is what lets another Widget's choice
|
|
5
|
+
* filter a Collection through a Controller that forwards it on every change of the choice
|
|
6
|
+
* (COLLECTIONS.md, "Filtered by another Widget's choice"). Imports nothing.
|
|
7
|
+
*/
|
|
8
|
+
export declare function layPhiCollectionBindingParams(current: Readonly<Record<string, unknown>>, received: Readonly<Record<string, unknown>>): Record<string, unknown> | null;
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* A Collection View's binding params after a `bindingParamsChange` (`{ params }`): the received ones laid
|
|
3
|
+
* over the ones it has, or `null` where that changes nothing -- the same set again is no new set, so it
|
|
4
|
+
* neither starts the list over nor asks the Provider again. This is what lets another Widget's choice
|
|
5
|
+
* filter a Collection through a Controller that forwards it on every change of the choice
|
|
6
|
+
* (COLLECTIONS.md, "Filtered by another Widget's choice"). Imports nothing.
|
|
7
|
+
*/
|
|
8
|
+
export function layPhiCollectionBindingParams(current, received) {
|
|
9
|
+
const next = { ...current, ...received };
|
|
10
|
+
const unchanged = Object.keys(next).length === Object.keys(current).length &&
|
|
11
|
+
Object.entries(next).every(([key, value]) => JSON.stringify(value) === JSON.stringify(current[key]));
|
|
12
|
+
return unchanged ? null : next;
|
|
13
|
+
}
|