@phis/ui 0.7.5 → 0.7.8
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/components/controls/phi-form-control.d.ts +3 -1
- package/components/controls/phi-form-control.js +15 -4
- package/components/forms/auth-admin-settings-labels.d.ts +1 -1
- package/components/forms/auth-admin-settings-labels.js +2 -2
- package/components/forms/extended-form-field-controls.d.ts +1 -1
- package/components/forms/extended-form-field-controls.js +23 -7
- package/components/forms/form-descriptor-contract.d.ts +1 -1
- package/components/forms/form-descriptor-contract.js +1 -1
- package/components/forms/form-descriptor-runtime-client.d.ts +4 -1
- package/components/forms/form-descriptor-runtime-client.js +33 -11
- package/components/forms/form-media-limits.d.ts +12 -0
- package/components/forms/form-media-limits.js +14 -0
- package/components/forms/form-provider-contract.d.ts +5 -0
- package/components/forms/form-provider-contract.js +9 -2
- package/components/forms/form-provider-registry.d.ts +14 -0
- package/components/forms/form-record-title.d.ts +14 -0
- package/components/forms/form-record-title.js +38 -0
- package/components/forms/form-widget-config.d.ts +3 -0
- package/components/forms/form-widget-config.js +2 -0
- package/components/forms/money-field-currency-key.d.ts +6 -0
- package/components/forms/money-field-currency-key.js +14 -0
- package/components/forms/money-field.d.ts +26 -3
- package/components/forms/money-field.js +54 -4
- package/components/forms/phi-form-widget.d.ts +1 -1
- package/components/forms/phi-form-widget.js +4 -0
- package/components/overlays/phi-overlay-container-client.js +8 -8
- package/components/overlays/phi-overlay-title.d.ts +7 -0
- package/components/overlays/phi-overlay-title.js +21 -0
- package/components/regions/presets/navigation-redirect.d.ts +4 -1
- package/components/regions/presets/navigation-redirect.js +6 -3
- package/components/tables/client/phi-table-binding.d.ts +3 -1
- package/components/tables/client/phi-table-binding.js +90 -49
- package/components/tables/client/phi-table-filter-options.d.ts +27 -0
- package/components/tables/client/phi-table-filter-options.js +35 -0
- package/components/widgets/accessible-areas.d.ts +1 -1
- package/components/widgets/accessible-areas.js +1 -1
- package/components/widgets/client/shared/phi-rendered-value.d.ts +10 -0
- package/components/widgets/client/shared/phi-rendered-value.js +54 -4
- package/components/widgets/client/shared/phi-table-provider.d.ts +10 -1
- package/components/widgets/client/shared/phi-table-provider.js +22 -0
- package/components/widgets/label-sets/admin-users.d.ts +15 -0
- package/components/widgets/label-sets/admin-users.js +31 -0
- package/constants/core-data-provider-keys.d.ts +7 -0
- package/constants/core-data-provider-keys.js +7 -0
- package/constants/phi-base-role-metadata.d.ts +2 -2
- package/constants/phi-base-role-metadata.js +1 -1
- package/constants/runtime-module-ownership.js +3 -0
- package/forms.d.ts +1 -1
- package/forms.js +1 -1
- package/gateway/capability-media-limits.d.ts +10 -0
- package/gateway/capability-media-limits.js +40 -0
- package/gateway/server-capabilities.js +4 -0
- package/helpers/money-amount.d.ts +7 -0
- package/helpers/money-amount.js +15 -0
- package/helpers/preset-tree-contract-check.d.ts +3 -2
- package/helpers/preset-tree-contract-check.js +60 -0
- package/helpers/record-title.d.ts +7 -0
- package/helpers/record-title.js +25 -0
- package/helpers/record-widget.d.ts +15 -0
- package/helpers/record-widget.js +57 -0
- package/package.json +2 -2
- package/plugins/runtime-modules/accounting/client-data-providers.d.ts +7 -0
- package/plugins/runtime-modules/accounting/client-data-providers.js +9 -0
- package/plugins/runtime-modules/accounting/data-providers.d.ts +63 -0
- package/plugins/runtime-modules/accounting/data-providers.js +127 -0
- package/plugins/runtime-modules/accounting/definition.d.ts +54 -2
- package/plugins/runtime-modules/accounting/definition.js +5 -3
- package/plugins/runtime-modules/accounting/ids.d.ts +20 -0
- package/plugins/runtime-modules/accounting/ids.js +27 -0
- package/plugins/runtime-modules/accounting/module.d.ts +52 -0
- package/plugins/runtime-modules/accounting/presets.js +23 -4
- package/plugins/runtime-modules/accounting/services/products-table.d.ts +93 -0
- package/plugins/runtime-modules/accounting/services/products-table.js +158 -0
- package/plugins/runtime-modules/accounting/trees/accounting-products-label-set.d.ts +86 -0
- package/plugins/runtime-modules/accounting/trees/accounting-products-label-set.js +123 -0
- package/plugins/runtime-modules/accounting/trees/phi-default-accounting-products-page-tree.d.ts +21 -0
- package/plugins/runtime-modules/accounting/trees/phi-default-accounting-products-page-tree.js +435 -0
- package/plugins/runtime-modules/app/presets.js +3 -6
- package/plugins/runtime-modules/app/trees/phi-default-app-area-preset-tree.d.ts +3 -6
- package/plugins/runtime-modules/app/trees/phi-default-app-area-preset-tree.js +4 -7
- package/plugins/runtime-modules/area-definitions.js +2 -2
- package/plugins/runtime-modules/asset/media-asset-field.d.ts +15 -0
- package/plugins/runtime-modules/asset/media-asset-field.js +21 -0
- package/plugins/runtime-modules/asset/media-asset-form-control.d.ts +4 -0
- package/plugins/runtime-modules/asset/media-asset-form-control.js +10 -5
- package/plugins/runtime-modules/asset/media-assets-field.d.ts +8 -0
- package/plugins/runtime-modules/asset/media-assets-field.js +10 -0
- package/plugins/runtime-modules/asset/media-assets-form-control.d.ts +5 -0
- package/plugins/runtime-modules/asset/media-assets-form-control.js +15 -6
- package/plugins/runtime-modules/auth/admin-settings-forms.js +1 -1
- package/plugins/runtime-modules/builder/controller/client.d.ts +5 -5
- package/plugins/runtime-modules/builder/controller/client.js +2 -1
- package/plugins/runtime-modules/builder/controller/definition.d.ts +4 -4
- package/plugins/runtime-modules/builder/controller/definition.js +7 -0
- package/plugins/runtime-modules/builder/controller/draft-command-controller.d.ts +3 -1
- package/plugins/runtime-modules/builder/controller/draft-command-controller.js +2 -1
- package/plugins/runtime-modules/builder/controller/draft-status-controller.js +44 -17
- package/plugins/runtime-modules/builder/controller/server-definition.d.ts +4 -4
- package/plugins/runtime-modules/builder/controller/workspace-controller.d.ts +3 -1
- package/plugins/runtime-modules/builder/controller/workspace-controller.js +8 -10
- package/plugins/runtime-modules/builder/developer-workspace-store.d.ts +10 -0
- package/plugins/runtime-modules/builder/developer-workspace-store.js +35 -1
- package/plugins/runtime-modules/builder/offered-page-catalog.d.ts +6 -0
- package/plugins/runtime-modules/builder/offered-page-catalog.js +35 -6
- package/plugins/runtime-modules/builder/persistence.d.ts +4 -1
- package/plugins/runtime-modules/builder/persistence.js +10 -3
- package/plugins/runtime-modules/client-manifests/accounting.js +5 -1
- package/plugins/runtime-modules/core/cards.js +2 -2
- package/plugins/runtime-modules/core/client-data-providers.js +5 -0
- package/plugins/runtime-modules/core/data-providers.js +14 -0
- package/plugins/runtime-modules/core/definition.d.ts +5 -0
- package/plugins/runtime-modules/core/form-providers.d.ts +5 -0
- package/plugins/runtime-modules/core/services/site-members-options.d.ts +27 -0
- package/plugins/runtime-modules/core/services/site-members-options.js +55 -0
- package/plugins/runtime-modules/core/widgets/form/config.d.ts +5 -0
- package/plugins/runtime-modules/core/widgets/form/config.js +3 -0
- package/plugins/runtime-modules/core/widgets/record/actions.d.ts +20 -0
- package/plugins/runtime-modules/core/widgets/record/actions.js +77 -0
- package/plugins/runtime-modules/core/widgets/record/client.js +71 -8
- package/plugins/runtime-modules/core/widgets/record/config.d.ts +66 -1
- package/plugins/runtime-modules/core/widgets/record/config.js +71 -2
- package/plugins/runtime-modules/core/widgets/spacer/client.js +3 -3
- package/plugins/runtime-modules/core/widgets/table/client.js +33 -29
- package/plugins/runtime-modules/core/widgets/table/config.js +5 -1
- package/plugins/runtime-modules/groups/data-providers.js +1 -1
- package/plugins/runtime-modules/groups/definition.js +1 -1
- package/plugins/runtime-modules/groups/page-visibility.d.ts +1 -1
- package/plugins/runtime-modules/groups/page-visibility.js +1 -1
- package/plugins/runtime-modules/groups/presets.js +1 -1
- package/plugins/runtime-modules/groups/services/options.js +1 -1
- package/plugins/runtime-modules/groups/services/table.js +1 -1
- package/plugins/runtime-modules/groups/trees/phi-default-app-groups-page-tree.js +2 -2
- package/plugins/runtime-modules/phi-default-site-area-preset-tree.js +46 -39
- package/plugins/runtime-modules/preset-contracts/pub-area.d.ts +1 -1
- package/plugins/runtime-modules/preset-contracts/pub-area.js +1 -0
- package/plugins/runtime-modules/revisions/controller/client.js +48 -46
- package/plugins/runtime-modules/revisions/services/table.js +3 -1
- package/plugins/runtime-modules/user-management/addon-roles.d.ts +60 -4
- package/plugins/runtime-modules/user-management/addon-roles.js +92 -8
- package/plugins/runtime-modules/user-management/addresses.d.ts +1 -1
- package/plugins/runtime-modules/user-management/controller/client.js +1 -1
- package/plugins/runtime-modules/user-management/data-providers.js +1 -0
- package/plugins/runtime-modules/user-management/forms.js +22 -0
- package/plugins/runtime-modules/user-management/presets.js +2 -2
- package/plugins/runtime-modules/user-management/services/options.d.ts +4 -0
- package/plugins/runtime-modules/user-management/services/options.js +14 -6
- package/plugins/runtime-modules/user-management/services/table.js +12 -3
- package/plugins/runtime-modules/user-management/trees/phi-default-admin-users-page-tree.js +9 -4
- package/styles/builder-scaffold.css +7 -1
- package/styles/layout-authoring-scaffold.css +27 -0
- package/types/access.d.ts +1 -1
- package/types/access.js +7 -7
- package/types/core-widget-placements.d.ts +7 -0
- package/types/form-descriptor.d.ts +1 -1
- package/types/record-widget.d.ts +35 -0
- package/types/server-capabilities.d.ts +1 -1
- package/types/table-widget.d.ts +20 -0
- package/types/table-widget.js +44 -0
|
@@ -2,6 +2,8 @@ import type { PhiCmsContentWidgetNode, PhiCmsLayoutNode } from "../../../types/c
|
|
|
2
2
|
import { type PhiCmsInstanceId } from "../../../types/cms-instance-id";
|
|
3
3
|
import type { PhiDeveloperBuilderArea, PhiDeveloperBuilderRegionDraft, PhiDeveloperBuilderWorkspaceState } from "./developer-workspace-types";
|
|
4
4
|
import type { PhiCmsWidgetContentBinding } from "../../../types/cms-plugins";
|
|
5
|
+
import type { PhiAccessViewer } from "../../../types/access";
|
|
6
|
+
import { type PhiBuilderOfferedCatalogState } from "./offered-page-catalog";
|
|
5
7
|
import { type PhiPresetPageNode } from "../../../helpers/cms-page-catalog";
|
|
6
8
|
import type { PhiCmsPresetIdentity, PhiCmsPresetSource } from "../../../types/cms-module-descriptors";
|
|
7
9
|
import type { PhiBuilderPluginMeta, PhiBuilderWidgetMeta } from "../../../types/builder";
|
|
@@ -132,7 +134,8 @@ export declare function createPhiDeveloperBuilderPageDraft(input: {
|
|
|
132
134
|
nextNodeSequence: number;
|
|
133
135
|
previewHref: string | null;
|
|
134
136
|
}>;
|
|
135
|
-
export declare function previewPhiDeveloperBuilderDraft(state: Pick<PhiDeveloperBuilderWorkspaceState, "area" | "pageKey" | "
|
|
137
|
+
export declare function previewPhiDeveloperBuilderDraft(state: Pick<PhiDeveloperBuilderWorkspaceState, "area" | "pageKey" | "areaPresetSourcesByArea"> & PhiBuilderOfferedCatalogState, workspaceKind: PhiDeveloperBuilderWorkspaceKind, options: {
|
|
138
|
+
viewer: PhiAccessViewer;
|
|
136
139
|
pathname?: string | null;
|
|
137
140
|
scope?: {
|
|
138
141
|
area: PhiDeveloperBuilderArea;
|
|
@@ -10,6 +10,7 @@ import { stripPhiResolvedAssetProjections } from "../../../components/media/imag
|
|
|
10
10
|
import { resolvePhiBuilderCmsStoragePath } from "../../../helpers/cms-paths";
|
|
11
11
|
import { resolvePhiCmsWidgetContentBindingForConfig } from "../../../helpers/cms-content-binding";
|
|
12
12
|
import { resolvePhiCmsRegionType } from "../../../helpers/cms-region-keys";
|
|
13
|
+
import { resolvePhiBuilderShellPreviewPage } from "./offered-page-catalog";
|
|
13
14
|
import { resolvePhiAuthUiProviderModuleId, resolvePhiDeclaredMediaSpaces, resolvePhiDeclaredSeeds, isPhiRuntimeModuleSelectable, resolvePhiDeclaredThreadKinds, resolvePhiRuntimeModuleIdsForArea, } from "../../../plugins/runtime-modules/settings";
|
|
14
15
|
import { createPhiBuilderDraftAllocationKey } from "./draft-allocation-key";
|
|
15
16
|
import { clearPhiBuilderDraftAllocation, storePhiBuilderDraftAllocation, commitPhiDeveloperBuilderAreaConfig, readPhiBuilderEffectiveAreaRootRoute, readPhiBuilderEffectiveAreaMeta, } from "./developer-workspace-store";
|
|
@@ -783,9 +784,15 @@ export async function createPhiDeveloperBuilderPageDraft(input) {
|
|
|
783
784
|
};
|
|
784
785
|
}
|
|
785
786
|
export async function previewPhiDeveloperBuilderDraft(state, workspaceKind, options) {
|
|
786
|
-
const area = options
|
|
787
|
-
const
|
|
788
|
-
|
|
787
|
+
const area = options.scope?.area ?? state.area;
|
|
788
|
+
const shellPreview = workspaceKind === "structure"
|
|
789
|
+
? resolvePhiBuilderShellPreviewPage(state, area, options.viewer)
|
|
790
|
+
: null;
|
|
791
|
+
if (shellPreview?.pageKey === null) {
|
|
792
|
+
throw new Error(`No linked page in the ${area} Area is available for the shell preview.`);
|
|
793
|
+
}
|
|
794
|
+
const pageKey = shellPreview?.pageKey ?? options.scope?.pageKey ?? state.pageKey;
|
|
795
|
+
const pages = shellPreview?.pages ?? resolvePhiBuilderActivePageCatalog(area, state.modulePresetPagesByArea, state.customPages, state.persistedPageCatalogByArea);
|
|
789
796
|
const pagePresetSource = resolvePhiBuilderPagePresetSource(pageKey, pages);
|
|
790
797
|
const areaPresetSource = state.areaPresetSourcesByArea[area] ?? null;
|
|
791
798
|
const draft = workspaceKind === "structure"
|
|
@@ -4,10 +4,14 @@ import { PHI_ACCOUNTING_RUNTIME_MODULE_CONTROLLER_CLIENT_AREA_CONTRIBUTIONS } fr
|
|
|
4
4
|
import { PHI_COMMON_RUNTIME_MODULE_RENDER_CLIENT_MANIFEST } from "./common";
|
|
5
5
|
import { PHI_COMMON_RUNTIME_MODULE_DATA_PROVIDER_CLIENT_MANIFEST } from "./common-data-providers";
|
|
6
6
|
import { extendPhiRuntimeModuleDataProviderClientManifest } from "../../../components/runtime/runtime-module-data-provider-client-manifest";
|
|
7
|
+
import { PHI_ACCOUNTING_RUNTIME_DATA_PROVIDER_CLIENT_DEFINITIONS } from "../accounting/client-data-providers";
|
|
7
8
|
import { PHI_DASHBOARD_RUNTIME_DATA_PROVIDER_CLIENT_DEFINITIONS } from "../dashboard/client-data-providers";
|
|
8
9
|
export { PHI_COMMON_RUNTIME_MODULE_CALENDAR_ADAPTER_CLIENT_MANIFEST as PHI_ACCOUNTING_RUNTIME_MODULE_CALENDAR_ADAPTER_CLIENT_MANIFEST } from "./common";
|
|
9
10
|
export { PHI_COMMON_RUNTIME_MODULE_MEDIA_SOURCE_CLIENT_MANIFEST as PHI_ACCOUNTING_RUNTIME_MODULE_MEDIA_SOURCE_CLIENT_MANIFEST } from "./common";
|
|
10
11
|
export { PHI_COMMON_RUNTIME_MODULE_UI_PROVIDER_CLIENT_MANIFEST as PHI_ACCOUNTING_RUNTIME_MODULE_UI_PROVIDER_CLIENT_MANIFEST } from "./common";
|
|
11
12
|
export const PHI_ACCOUNTING_RUNTIME_MODULE_CONTROLLER_CLIENT_MANIFEST = createPhiRuntimeModuleControllerClientManifestFromAreaContributions(PHI_ACCOUNTING_RUNTIME_MODULE_CONTROLLER_CLIENT_AREA_CONTRIBUTIONS);
|
|
12
13
|
export const PHI_ACCOUNTING_RUNTIME_MODULE_RENDER_CLIENT_MANIFEST = PHI_COMMON_RUNTIME_MODULE_RENDER_CLIENT_MANIFEST;
|
|
13
|
-
export const PHI_ACCOUNTING_RUNTIME_MODULE_DATA_PROVIDER_CLIENT_MANIFEST = extendPhiRuntimeModuleDataProviderClientManifest(PHI_COMMON_RUNTIME_MODULE_DATA_PROVIDER_CLIENT_MANIFEST,
|
|
14
|
+
export const PHI_ACCOUNTING_RUNTIME_MODULE_DATA_PROVIDER_CLIENT_MANIFEST = extendPhiRuntimeModuleDataProviderClientManifest(PHI_COMMON_RUNTIME_MODULE_DATA_PROVIDER_CLIENT_MANIFEST, [
|
|
15
|
+
...PHI_ACCOUNTING_RUNTIME_DATA_PROVIDER_CLIENT_DEFINITIONS,
|
|
16
|
+
...PHI_DASHBOARD_RUNTIME_DATA_PROVIDER_CLIENT_DEFINITIONS,
|
|
17
|
+
]);
|
|
@@ -8,8 +8,8 @@ import { PHI_CORE_RUNTIME_MODULE_ID } from "./ids";
|
|
|
8
8
|
* The runtime the Site itself is running in.
|
|
9
9
|
*
|
|
10
10
|
* It belongs to the platform Module rather than to Observability, and the reason is who sees it: the
|
|
11
|
-
* Admin Dashboard showed this figure to every administrator, and Observability is gated on
|
|
12
|
-
*
|
|
11
|
+
* Admin Dashboard showed this figure to every administrator, and Observability is gated on Site
|
|
12
|
+
* maintenance. Moving the card there would have taken it away from most of the people who had it, which is a
|
|
13
13
|
* change nobody asked for. What the figure is has not changed either -- the card resolves in the Site
|
|
14
14
|
* process, which is the process this uptime is of.
|
|
15
15
|
*/
|
|
@@ -33,6 +33,11 @@ export const PHI_CORE_RUNTIME_DATA_PROVIDER_CLIENT_DEFINITIONS = [
|
|
|
33
33
|
ownerModuleId: PHI_CORE_RUNTIME_MODULE_ID,
|
|
34
34
|
loadLive: async () => (await import("./content-entries/tags")).PhiContentEntryTagsOptionsProviderClient,
|
|
35
35
|
},
|
|
36
|
+
{
|
|
37
|
+
key: PHI_CORE_RUNTIME_DATA_PROVIDER_KEYS.siteMembers,
|
|
38
|
+
ownerModuleId: PHI_CORE_RUNTIME_MODULE_ID,
|
|
39
|
+
loadLive: async () => (await import("./services/site-members-options")).PhiSiteMembersOptionsProviderClient,
|
|
40
|
+
},
|
|
36
41
|
{
|
|
37
42
|
key: PHI_CORE_RUNTIME_DATA_PROVIDER_KEYS.contentEntryAuthors,
|
|
38
43
|
ownerModuleId: PHI_CORE_RUNTIME_MODULE_ID,
|
|
@@ -163,6 +163,20 @@ export const PHI_CORE_RUNTIME_DATA_PROVIDER_DESCRIPTORS = [
|
|
|
163
163
|
title: "Content entry tags",
|
|
164
164
|
description: "The tags one content kind's entries already carry; the field names the kind.",
|
|
165
165
|
},
|
|
166
|
+
/*
|
|
167
|
+
* The Site's members by user id, for any Module's Form that names a person (a grant on their behalf).
|
|
168
|
+
* Core's and not User Management's: that Module is the Admin Area's, and the staff who act on a member's
|
|
169
|
+
* behalf work in Accounting and Support, where only Core is sure to be active.
|
|
170
|
+
*/
|
|
171
|
+
{
|
|
172
|
+
key: PHI_CORE_RUNTIME_DATA_PROVIDER_KEYS.siteMembers,
|
|
173
|
+
ownerModuleId: PHI_CORE_RUNTIME_MODULE_ID,
|
|
174
|
+
kind: "options",
|
|
175
|
+
executionMode: "live",
|
|
176
|
+
authoringMode: "none",
|
|
177
|
+
title: "Site members",
|
|
178
|
+
description: "The Site's members by user id, searched by name or address, for staff acting on a member's behalf.",
|
|
179
|
+
},
|
|
166
180
|
/*
|
|
167
181
|
* The offer the curation Form picks from: who may be named as an entry's author, and the categories it
|
|
168
182
|
* may be filed under. One endpoint answers both, so they read it under one load key.
|
|
@@ -738,6 +738,11 @@ export declare const PHI_CORE_RUNTIME_MODULE_DEFINITION: {
|
|
|
738
738
|
value: string;
|
|
739
739
|
label: string;
|
|
740
740
|
}[];
|
|
741
|
+
}, {
|
|
742
|
+
readonly key: "currencyField";
|
|
743
|
+
readonly type: "string";
|
|
744
|
+
readonly label: "Currency field";
|
|
745
|
+
readonly description: "The key of the field whose value is the currency of one amount, instead of a fixed currency.";
|
|
741
746
|
}, {
|
|
742
747
|
readonly key: "currencies";
|
|
743
748
|
readonly type: "choice";
|
|
@@ -342,6 +342,11 @@ export declare const PHI_CORE_FORM_PROVIDER_DESCRIPTORS: {
|
|
|
342
342
|
value: string;
|
|
343
343
|
label: string;
|
|
344
344
|
}[];
|
|
345
|
+
}, {
|
|
346
|
+
readonly key: "currencyField";
|
|
347
|
+
readonly type: "string";
|
|
348
|
+
readonly label: "Currency field";
|
|
349
|
+
readonly description: "The key of the field whose value is the currency of one amount, instead of a fixed currency.";
|
|
345
350
|
}, {
|
|
346
351
|
readonly key: "currencies";
|
|
347
352
|
readonly type: "choice";
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
/** Core's member picker route (phis-server `GET /api/site/members`). */
|
|
2
|
+
export declare const PHI_SITE_MEMBERS_PATH = "/api/site/members";
|
|
3
|
+
/** The one page a picker asks for: as many as the route answers at once. */
|
|
4
|
+
export declare const PHI_SITE_MEMBERS_PAGE_SIZE = 50;
|
|
5
|
+
/** The request for what is typed: the first page of the members whose name or address matches. */
|
|
6
|
+
export declare function resolvePhiSiteMembersRequestPath(search: string): string;
|
|
7
|
+
/**
|
|
8
|
+
* The options in an answer: the user id as text -- what a select holds -- and the name the person is
|
|
9
|
+
* shown under, which Core answers as `#<id>` where they have none. A row that is not a member's (no
|
|
10
|
+
* positive whole id, no name) is no option; an answer that is not `{ items }` holds none.
|
|
11
|
+
*/
|
|
12
|
+
export declare function readPhiSiteMembersOptions(payload: unknown): {
|
|
13
|
+
value: string;
|
|
14
|
+
label: string;
|
|
15
|
+
}[];
|
|
16
|
+
/**
|
|
17
|
+
* The Site's members as a select's options, for any Module's Form that names a person by user id.
|
|
18
|
+
*
|
|
19
|
+
* The search happens where the people are: what is typed goes into the request, and the route answers
|
|
20
|
+
* the first page of the matches, so a person is findable on a Site with more members than one answer
|
|
21
|
+
* carries. A field using it declares `loadMode: "server"` and `search: { enabled: true, minChars }` on its
|
|
22
|
+
* options provider, as the Groups Module's member field does. Core decides who may ask -- the holders of
|
|
23
|
+
* the Site access `accounting` or `support` -- and a refusal is a failed load, not an empty Site.
|
|
24
|
+
*/
|
|
25
|
+
export declare const PhiSiteMembersOptionsProviderClient: import("react").ComponentType<{
|
|
26
|
+
children: import("react").ReactNode;
|
|
27
|
+
}>;
|
|
@@ -0,0 +1,55 @@
|
|
|
1
|
+
"use client";
|
|
2
|
+
import { createPhiControlOptionsProviderClient, } from "../../../../components/controls/phi-options-provider";
|
|
3
|
+
import { PHI_CORE_RUNTIME_DATA_PROVIDER_KEYS } from "../../../../constants/core-data-provider-keys";
|
|
4
|
+
import { requestPhiJson } from "../../../../helpers/client-json-request";
|
|
5
|
+
import { isPhiRecord } from "../../../../helpers/is-record";
|
|
6
|
+
/** Core's member picker route (phis-server `GET /api/site/members`). */
|
|
7
|
+
export const PHI_SITE_MEMBERS_PATH = "/api/site/members";
|
|
8
|
+
/** The one page a picker asks for: as many as the route answers at once. */
|
|
9
|
+
export const PHI_SITE_MEMBERS_PAGE_SIZE = 50;
|
|
10
|
+
/** The request for what is typed: the first page of the members whose name or address matches. */
|
|
11
|
+
export function resolvePhiSiteMembersRequestPath(search) {
|
|
12
|
+
const params = new URLSearchParams({ pageSize: String(PHI_SITE_MEMBERS_PAGE_SIZE) });
|
|
13
|
+
const query = search.trim();
|
|
14
|
+
if (query)
|
|
15
|
+
params.set("q", query);
|
|
16
|
+
return `${PHI_SITE_MEMBERS_PATH}?${params}`;
|
|
17
|
+
}
|
|
18
|
+
/**
|
|
19
|
+
* The options in an answer: the user id as text -- what a select holds -- and the name the person is
|
|
20
|
+
* shown under, which Core answers as `#<id>` where they have none. A row that is not a member's (no
|
|
21
|
+
* positive whole id, no name) is no option; an answer that is not `{ items }` holds none.
|
|
22
|
+
*/
|
|
23
|
+
export function readPhiSiteMembersOptions(payload) {
|
|
24
|
+
const items = isPhiRecord(payload) && Array.isArray(payload.items) ? payload.items : [];
|
|
25
|
+
return items.flatMap((item) => {
|
|
26
|
+
if (!isPhiRecord(item))
|
|
27
|
+
return [];
|
|
28
|
+
const { userId, displayName } = item;
|
|
29
|
+
if (typeof userId !== "number" || !Number.isSafeInteger(userId) || userId <= 0)
|
|
30
|
+
return [];
|
|
31
|
+
if (typeof displayName !== "string" || !displayName.trim())
|
|
32
|
+
return [];
|
|
33
|
+
return [{ value: String(userId), label: displayName.trim() }];
|
|
34
|
+
});
|
|
35
|
+
}
|
|
36
|
+
/**
|
|
37
|
+
* The Site's members as a select's options, for any Module's Form that names a person by user id.
|
|
38
|
+
*
|
|
39
|
+
* The search happens where the people are: what is typed goes into the request, and the route answers
|
|
40
|
+
* the first page of the matches, so a person is findable on a Site with more members than one answer
|
|
41
|
+
* carries. A field using it declares `loadMode: "server"` and `search: { enabled: true, minChars }` on its
|
|
42
|
+
* options provider, as the Groups Module's member field does. Core decides who may ask -- the holders of
|
|
43
|
+
* the Site access `accounting` or `support` -- and a refusal is a failed load, not an empty Site.
|
|
44
|
+
*/
|
|
45
|
+
export const PhiSiteMembersOptionsProviderClient = createPhiControlOptionsProviderClient({
|
|
46
|
+
key: PHI_CORE_RUNTIME_DATA_PROVIDER_KEYS.siteMembers,
|
|
47
|
+
load: async (context) => {
|
|
48
|
+
const reply = await requestPhiJson(resolvePhiSiteMembersRequestPath(context.search));
|
|
49
|
+
if (!reply.ok)
|
|
50
|
+
throw new Error("Failed to load the Site's members.");
|
|
51
|
+
return reply.payload;
|
|
52
|
+
},
|
|
53
|
+
resolveLoadKey: (context) => `core-site-members:${context.search.trim()}`,
|
|
54
|
+
resolve: (context) => ({ options: readPhiSiteMembersOptions(context.asyncData) }),
|
|
55
|
+
});
|
|
@@ -46,6 +46,11 @@ export declare const PHI_FORM_WIDGET_DEFINITION: {
|
|
|
46
46
|
action: "reload";
|
|
47
47
|
valueType: "none";
|
|
48
48
|
valueSchema?: undefined;
|
|
49
|
+
} | {
|
|
50
|
+
id: string;
|
|
51
|
+
action: "change";
|
|
52
|
+
valueType: "string";
|
|
53
|
+
valueSchema?: undefined;
|
|
49
54
|
})[];
|
|
50
55
|
listens: ({
|
|
51
56
|
id: string;
|
|
@@ -3,6 +3,7 @@ import { PhiCmsWidgetType } from "../../../../../constants/cms-widget-types";
|
|
|
3
3
|
import { PHI_SIGNAL_VALUE_SCHEMAS } from "../../../../../types/signals";
|
|
4
4
|
import { requirePhiRuntimeFormControllerForWidget } from "../../../../../components/forms/runtime-form-controller-requirement";
|
|
5
5
|
import { parsePhiFormWidgetConfig, } from "../../../../../components/forms/form-widget-config";
|
|
6
|
+
import { PHI_FORM_RECORD_TITLE_CAPABILITY } from "../../../../../components/forms/form-record-title";
|
|
6
7
|
import { PHI_LAYOUT } from "../../../../../theme/phi-tokens";
|
|
7
8
|
import { PHI_AUTHORING_OPTION_PROVIDER_KEYS } from "../../../../../constants/authoring-option-provider-keys";
|
|
8
9
|
export const PHI_FORM_WIDGET_DEFINITION = {
|
|
@@ -83,6 +84,8 @@ export const PHI_FORM_WIDGET_DEFINITION = {
|
|
|
83
84
|
* has to ask rather than be told.
|
|
84
85
|
*/
|
|
85
86
|
{ id: "valuesRequest", action: "reload", valueType: "none" },
|
|
87
|
+
// The title its record gives the dialog, after every read (`titleFromRecord`), for the Overlay's `title`.
|
|
88
|
+
{ id: PHI_FORM_RECORD_TITLE_CAPABILITY, action: "change", valueType: "string" },
|
|
86
89
|
],
|
|
87
90
|
listens: [
|
|
88
91
|
{ id: "submit", channel: "submit", action: "activate", valueType: "none" },
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
import { type PhiTableProviderRegistration } from "../../../../../components/widgets/client/shared/phi-table-provider";
|
|
2
|
+
import type { PhiProviderResourceSource } from "../../../../../types/runtime-data-provider";
|
|
3
|
+
import type { PhiRecordWidgetAction } from "../../../../../types/record-widget";
|
|
4
|
+
import { type PhiTableProviderMutationResult, type PhiTableProviderResourceDescriptor, type PhiTableRowIdentity } from "../../../../../types/table-widget";
|
|
5
|
+
export type PhiRecordWidgetActionsInput = {
|
|
6
|
+
actions: readonly PhiRecordWidgetAction[];
|
|
7
|
+
provider: PhiTableProviderRegistration | null;
|
|
8
|
+
resource: PhiTableProviderResourceDescriptor | null;
|
|
9
|
+
source: PhiProviderResourceSource | null;
|
|
10
|
+
/** The record shown, by identity; null while none is, and nothing runs then. */
|
|
11
|
+
rowIdentity: PhiTableRowIdentity | null;
|
|
12
|
+
/** What the Provider accepted, for the Widget to say and announce. */
|
|
13
|
+
onAccepted: (result: PhiTableProviderMutationResult, action: PhiRecordWidgetAction, rowIdentity: PhiTableRowIdentity, correlationId: string | undefined) => void;
|
|
14
|
+
};
|
|
15
|
+
export declare function usePhiRecordWidgetActions({ actions, provider, resource, source, rowIdentity, onAccepted, }: PhiRecordWidgetActionsInput): {
|
|
16
|
+
activate: (actionKey: string, correlationId?: string) => void;
|
|
17
|
+
error: string | null;
|
|
18
|
+
forget: () => void;
|
|
19
|
+
confirmDialog: import("react").JSX.Element;
|
|
20
|
+
};
|
|
@@ -0,0 +1,77 @@
|
|
|
1
|
+
"use client";
|
|
2
|
+
import { useCallback, useEffect, useRef, useState } from "react";
|
|
3
|
+
import { usePhiConfirmDialog } from "../../../../../components/controls/phi-confirm-dialog";
|
|
4
|
+
import { requestPhiTableProviderMutation, } from "../../../../../components/widgets/client/shared/phi-table-provider";
|
|
5
|
+
import { formatPhiRecordWidgetLabel } from "../../../../../components/widgets/label-types/record";
|
|
6
|
+
import { checkPhiTableProviderActionRequest, readPhiTableProviderError, } from "../../../../../types/table-widget";
|
|
7
|
+
/*
|
|
8
|
+
* Running a Provider action on the record shown (TABLES.md, "The record Widget").
|
|
9
|
+
*
|
|
10
|
+
* The record Widget holds a row identity and a bound source, which is all a row action of that source
|
|
11
|
+
* needs: the same request the Table's Binding sends (`checkPhiTableProviderActionRequest`, then
|
|
12
|
+
* `requestPhiTableProviderMutation`), with the identity it holds rather than one a signal names, and no
|
|
13
|
+
* query, because a record is not a view of rows. A key it does not list, a press while nothing is shown,
|
|
14
|
+
* and a second press while the first runs do nothing. A refusal -- the Provider's `rejected`, or a
|
|
15
|
+
* failure on the way -- is said above the record as the Table says it above its rows, and stands until the
|
|
16
|
+
* next press or the next record.
|
|
17
|
+
*/
|
|
18
|
+
export function usePhiRecordWidgetActions({ actions, provider, resource, source, rowIdentity, onAccepted, }) {
|
|
19
|
+
const { confirm, confirmDialog } = usePhiConfirmDialog();
|
|
20
|
+
const [error, setError] = useState(null);
|
|
21
|
+
const runningRef = useRef(null);
|
|
22
|
+
useEffect(() => () => runningRef.current?.abort(), []);
|
|
23
|
+
const run = useCallback(async (action, identity, correlationId) => {
|
|
24
|
+
// Without a binding no record was read, so nothing is shown to act on.
|
|
25
|
+
if (runningRef.current || !provider || !source)
|
|
26
|
+
return;
|
|
27
|
+
const request = { kind: "action", actionKey: action.key, rowIdentity: identity, selectedRowIdentities: [], query: {} };
|
|
28
|
+
const requestError = checkPhiTableProviderActionRequest(resource, request);
|
|
29
|
+
setError(requestError?.message ?? null);
|
|
30
|
+
if (requestError)
|
|
31
|
+
return;
|
|
32
|
+
const abortController = new AbortController();
|
|
33
|
+
runningRef.current = abortController;
|
|
34
|
+
try {
|
|
35
|
+
const result = await requestPhiTableProviderMutation(provider, source, request, abortController.signal);
|
|
36
|
+
if (abortController.signal.aborted)
|
|
37
|
+
return;
|
|
38
|
+
if (result.status === "rejected") {
|
|
39
|
+
setError(result.message ?? "Table change was rejected.");
|
|
40
|
+
return;
|
|
41
|
+
}
|
|
42
|
+
onAccepted(result, action, identity, correlationId);
|
|
43
|
+
}
|
|
44
|
+
catch (runError) {
|
|
45
|
+
if (!abortController.signal.aborted)
|
|
46
|
+
setError(readPhiTableProviderError(runError).message);
|
|
47
|
+
}
|
|
48
|
+
finally {
|
|
49
|
+
if (runningRef.current === abortController)
|
|
50
|
+
runningRef.current = null;
|
|
51
|
+
}
|
|
52
|
+
}, [onAccepted, provider, resource, source]);
|
|
53
|
+
const activate = useCallback((actionKey, correlationId) => {
|
|
54
|
+
const action = actions.find((candidate) => candidate.key === actionKey);
|
|
55
|
+
if (!action || rowIdentity == null || runningRef.current)
|
|
56
|
+
return;
|
|
57
|
+
if (!action.confirm) {
|
|
58
|
+
void run(action, rowIdentity, correlationId);
|
|
59
|
+
return;
|
|
60
|
+
}
|
|
61
|
+
confirm({
|
|
62
|
+
title: formatPhiRecordWidgetLabel(action.confirm.title, rowIdentity),
|
|
63
|
+
content: action.confirm.description ? formatPhiRecordWidgetLabel(action.confirm.description, rowIdentity) : undefined,
|
|
64
|
+
confirmLabel: action.confirm.okText,
|
|
65
|
+
cancelLabel: action.confirm.cancelText,
|
|
66
|
+
danger: action.mode === "danger",
|
|
67
|
+
onConfirm: () => run(action, rowIdentity, correlationId),
|
|
68
|
+
});
|
|
69
|
+
}, [actions, confirm, rowIdentity, run]);
|
|
70
|
+
/** A new record, or none: what was said of the last one is not said of it. */
|
|
71
|
+
const forget = useCallback(() => {
|
|
72
|
+
runningRef.current?.abort();
|
|
73
|
+
runningRef.current = null;
|
|
74
|
+
setError(null);
|
|
75
|
+
}, []);
|
|
76
|
+
return { activate, error, forget, confirmDialog };
|
|
77
|
+
}
|
|
@@ -1,19 +1,26 @@
|
|
|
1
1
|
"use client";
|
|
2
|
-
import { jsx as _jsx } from "react/jsx-runtime";
|
|
2
|
+
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
3
3
|
import { useCallback, useEffect, useMemo, useRef, useState } from "react";
|
|
4
4
|
import { readPhiDotPath } from "../../../../../helpers/dot-path";
|
|
5
|
+
import { PhiAlertControl } from "../../../../../components/controls/phi-alert-control";
|
|
5
6
|
import { PhiDescriptionListControl } from "../../../../../components/controls/phi-description-list-control";
|
|
6
7
|
import { PhiEmptyControl } from "../../../../../components/controls/phi-empty-control";
|
|
8
|
+
import { PhiFlexControl } from "../../../../../components/controls/phi-flex-control";
|
|
9
|
+
import { usePhiConfig } from "../../../../../components/root/phi-config-provider";
|
|
7
10
|
import { PhiSkeletonControl } from "../../../../../components/controls/phi-skeleton-control";
|
|
8
11
|
import { usePhiIntlLocale, usePhiIntlTimeZone } from "../../../../../components/root/phi-intl-locale";
|
|
9
12
|
import { usePhiSignalListener } from "../../../../../components/runtime/runtime-signal-bus";
|
|
10
|
-
import { usePhiSignalIdentity } from "../../../../../components/runtime/runtime-signal-identity";
|
|
13
|
+
import { emitPhiSignalCapability, usePhiSignalEmitter, usePhiSignalIdentity, } from "../../../../../components/runtime/runtime-signal-identity";
|
|
14
|
+
import { usePhiApplicationFeedback } from "../../../../../components/runtime/use-phi-application-feedback";
|
|
11
15
|
import { renderPhiValueContent } from "../../../../../components/widgets/client/shared/phi-rendered-value";
|
|
12
16
|
import { usePhiTableProvider } from "../../../../../components/widgets/client/shared/phi-table-provider";
|
|
13
17
|
import { PHI_RECORD_WIDGET_DEFAULT_LABELS, formatPhiRecordWidgetLabel, } from "../../../../../components/widgets/label-types/record";
|
|
14
18
|
import { PhiWidgetFailure } from "../../../../../components/widgets/shared/widget-failure-client";
|
|
15
19
|
import { PhiCmsWidgetType } from "../../../../../constants/cms-widget-types";
|
|
20
|
+
import { fillPhiRecordTitle } from "../../../../../helpers/record-title";
|
|
21
|
+
import { validatePhiRecordWidgetBinding } from "../../../../../helpers/record-widget";
|
|
16
22
|
import { readPhiTableActionSignalValue } from "../../../../../types/table-signal-values";
|
|
23
|
+
import { usePhiRecordWidgetActions } from "./actions";
|
|
17
24
|
export function PhiRecordWidgetClient({ config, labels = PHI_RECORD_WIDGET_DEFAULT_LABELS, renderMode, }) {
|
|
18
25
|
/*
|
|
19
26
|
* Which record to show arrives as a signal, and is not read out of a store this Widget knows about.
|
|
@@ -24,13 +31,20 @@ export function PhiRecordWidgetClient({ config, labels = PHI_RECORD_WIDGET_DEFAU
|
|
|
24
31
|
* first open, so the row action that opens it is addressed to a Widget that does not exist yet, and
|
|
25
32
|
* the bus holds an addressed signal until its receiver appears.
|
|
26
33
|
*/
|
|
34
|
+
const { token } = usePhiConfig();
|
|
27
35
|
const signalIdentity = usePhiSignalIdentity();
|
|
28
36
|
/*
|
|
29
37
|
* Memoised because the `?? []` hands out a fresh array whenever no routes are declared, and the
|
|
30
38
|
* subscription below is keyed on it: without this the Widget would resubscribe on every render.
|
|
31
39
|
*/
|
|
32
40
|
const listenRoutes = useMemo(() => config.signalRoutes?.listens ?? [], [config.signalRoutes?.listens]);
|
|
41
|
+
const emitRoutes = useMemo(() => config.signalRoutes?.emits ?? [], [config.signalRoutes?.emits]);
|
|
42
|
+
const emitSignal = usePhiSignalEmitter(signalIdentity.sender);
|
|
43
|
+
const emitCapability = useCallback((capabilityId, value, correlationId) => emitPhiSignalCapability(emitSignal, emitRoutes, capabilityId, value, correlationId), [emitRoutes, emitSignal]);
|
|
44
|
+
const { showMessage } = usePhiApplicationFeedback();
|
|
33
45
|
const { provider, resource, bindingError } = usePhiTableProvider(config.source);
|
|
46
|
+
// The actions measured against the resource, said where the record would stand (Table: contractError).
|
|
47
|
+
const contractError = useMemo(() => resource ? validatePhiRecordWidgetBinding(config, resource)[0] ?? null : null, [config, resource]);
|
|
34
48
|
// Sent with the read and part of what makes one new: an open record is read again after a switch.
|
|
35
49
|
const locale = usePhiIntlLocale();
|
|
36
50
|
const timeZone = usePhiIntlTimeZone();
|
|
@@ -38,7 +52,25 @@ export function PhiRecordWidgetClient({ config, labels = PHI_RECORD_WIDGET_DEFAU
|
|
|
38
52
|
const [record, setRecord] = useState(null);
|
|
39
53
|
const [loading, setLoading] = useState(false);
|
|
40
54
|
const [error, setError] = useState(null);
|
|
55
|
+
/*
|
|
56
|
+
* Asks for the shown record again: after an action went through, what it shows has changed. A count
|
|
57
|
+
* beside the identity rather than a call, so a record closed in the meantime is not read for nobody.
|
|
58
|
+
*/
|
|
59
|
+
const [readSequence, setReadSequence] = useState(0);
|
|
41
60
|
const requestRef = useRef(null);
|
|
61
|
+
// The exchange the record was opened in, which its title answers.
|
|
62
|
+
const openCorrelationRef = useRef(undefined);
|
|
63
|
+
/*
|
|
64
|
+
* The title the record gives the dialog, where the placement takes one (`titleFromRecord`): announced
|
|
65
|
+
* after every read, and empty as a row is asked for, so the last row's name does not stand over the
|
|
66
|
+
* next one while it loads. Empty is the Overlay's own title.
|
|
67
|
+
*/
|
|
68
|
+
const titleFromRecord = config.titleFromRecord;
|
|
69
|
+
const announceRecordTitle = useCallback((loaded, correlationId) => {
|
|
70
|
+
if (!titleFromRecord)
|
|
71
|
+
return;
|
|
72
|
+
emitCapability("recordTitle", fillPhiRecordTitle(titleFromRecord.template, loaded ? readPhiDotPath(loaded, titleFromRecord.field) : undefined), correlationId);
|
|
73
|
+
}, [emitCapability, titleFromRecord]);
|
|
42
74
|
useEffect(() => () => requestRef.current?.abort(), []);
|
|
43
75
|
const loadRecord = useCallback(async (rowIdentity) => {
|
|
44
76
|
requestRef.current?.abort();
|
|
@@ -73,6 +105,7 @@ export function PhiRecordWidgetClient({ config, labels = PHI_RECORD_WIDGET_DEFAU
|
|
|
73
105
|
});
|
|
74
106
|
if (!abortController.signal.aborted) {
|
|
75
107
|
setRecord(loaded);
|
|
108
|
+
announceRecordTitle(loaded, openCorrelationRef.current);
|
|
76
109
|
}
|
|
77
110
|
}
|
|
78
111
|
catch (readError) {
|
|
@@ -91,7 +124,24 @@ export function PhiRecordWidgetClient({ config, labels = PHI_RECORD_WIDGET_DEFAU
|
|
|
91
124
|
setLoading(false);
|
|
92
125
|
}
|
|
93
126
|
}
|
|
94
|
-
}, [bindingError, config.source, labels, locale, provider, resource?.recordRead, timeZone]);
|
|
127
|
+
}, [announceRecordTitle, bindingError, config.source, labels, locale, provider, resource?.recordRead, timeZone]);
|
|
128
|
+
const onActionAccepted = useCallback((result, action, rowIdentity, correlationId) => {
|
|
129
|
+
// What the Provider has to say about what it did, as the Table says it: only where it says something.
|
|
130
|
+
if (result.message?.trim())
|
|
131
|
+
showMessage({ level: "info", content: result.message.trim() });
|
|
132
|
+
emitCapability("actionSuccess", { actionKey: action.key, rowIdentity, selectedRowIdentities: [] }, correlationId);
|
|
133
|
+
setReadSequence((current) => current + 1);
|
|
134
|
+
}, [emitCapability, showMessage]);
|
|
135
|
+
const recordActions = usePhiRecordWidgetActions({
|
|
136
|
+
actions: config.actions,
|
|
137
|
+
provider,
|
|
138
|
+
resource,
|
|
139
|
+
source: config.source,
|
|
140
|
+
rowIdentity: record ? selectedRowIdentity : null,
|
|
141
|
+
onAccepted: onActionAccepted,
|
|
142
|
+
});
|
|
143
|
+
const forgetActionOutcome = recordActions.forget;
|
|
144
|
+
const activateAction = recordActions.activate;
|
|
95
145
|
usePhiSignalListener(useCallback((signal) => {
|
|
96
146
|
const route = listenRoutes.find((candidate) => candidate.channel === signal.channel &&
|
|
97
147
|
candidate.action === signal.action &&
|
|
@@ -103,14 +153,21 @@ export function PhiRecordWidgetClient({ config, labels = PHI_RECORD_WIDGET_DEFAU
|
|
|
103
153
|
const action = readPhiTableActionSignalValue(signal.value);
|
|
104
154
|
if (!action || action.actionKey !== config.openActionKey || action.rowIdentity == null)
|
|
105
155
|
return;
|
|
156
|
+
openCorrelationRef.current = signal.correlationId;
|
|
157
|
+
announceRecordTitle(null, signal.correlationId);
|
|
158
|
+
forgetActionOutcome();
|
|
106
159
|
setSelectedRowIdentity(action.rowIdentity);
|
|
107
160
|
}
|
|
108
161
|
else if (route.capabilityId === "close" && signal.value === false) {
|
|
162
|
+
forgetActionOutcome();
|
|
109
163
|
setSelectedRowIdentity(null);
|
|
110
164
|
setRecord(null);
|
|
111
165
|
setError(null);
|
|
112
166
|
}
|
|
113
|
-
|
|
167
|
+
else if (route.capabilityId === "actionActivate" && typeof signal.value === "string") {
|
|
168
|
+
activateAction(signal.value.trim(), signal.correlationId);
|
|
169
|
+
}
|
|
170
|
+
}, [activateAction, announceRecordTitle, config.openActionKey, forgetActionOutcome, listenRoutes, signalIdentity.receiver]), useMemo(() => {
|
|
114
171
|
if (listenRoutes.length === 0)
|
|
115
172
|
return null;
|
|
116
173
|
return {
|
|
@@ -125,7 +182,7 @@ export function PhiRecordWidgetClient({ config, labels = PHI_RECORD_WIDGET_DEFAU
|
|
|
125
182
|
}
|
|
126
183
|
const timer = window.setTimeout(() => void loadRecord(selectedRowIdentity), 0);
|
|
127
184
|
return () => window.clearTimeout(timer);
|
|
128
|
-
}, [loadRecord, selectedRowIdentity]);
|
|
185
|
+
}, [loadRecord, readSequence, selectedRowIdentity]);
|
|
129
186
|
if (loading) {
|
|
130
187
|
return _jsx(PhiSkeletonControl, { lines: config.presentation.fields.length || 7, withTitle: true });
|
|
131
188
|
}
|
|
@@ -133,16 +190,22 @@ export function PhiRecordWidgetClient({ config, labels = PHI_RECORD_WIDGET_DEFAU
|
|
|
133
190
|
* Every error here is the source's -- no binding, a resource that reads no single records, a read that
|
|
134
191
|
* failed -- and none of them is the reader's to fix, so it goes the way of every such failure.
|
|
135
192
|
*/
|
|
136
|
-
|
|
137
|
-
|
|
193
|
+
const failure = contractError ?? error;
|
|
194
|
+
if (failure) {
|
|
195
|
+
return _jsx(PhiWidgetFailure, { renderMode: renderMode, widgetType: PhiCmsWidgetType.Record, title: failure });
|
|
138
196
|
}
|
|
139
197
|
if (!record) {
|
|
140
198
|
return _jsx(PhiEmptyControl, { description: labels.empty });
|
|
141
199
|
}
|
|
142
|
-
|
|
200
|
+
/*
|
|
201
|
+
* A refused action is not the source's failure: the record still stands, and the person who pressed
|
|
202
|
+
* reads why above it, as a Table says a refused action above its rows.
|
|
203
|
+
*/
|
|
204
|
+
const list = (_jsx(PhiDescriptionListControl, { presentation: config.presentation.appearance, columns: config.presentation.columns, items: config.presentation.fields.map((field) => ({
|
|
143
205
|
key: field.key,
|
|
144
206
|
label: field.label,
|
|
145
207
|
full: field.full,
|
|
146
208
|
value: renderPhiValueContent(readPhiDotPath(record, field.fieldKey), field, labels, "block"),
|
|
147
209
|
})) }));
|
|
210
|
+
return config.actions.length === 0 ? list : (_jsxs(PhiFlexControl, { vertical: true, gap: token.paddingSM, style: { minWidth: 0, width: "100%" }, children: [recordActions.confirmDialog, recordActions.error ? _jsx(PhiAlertControl, { level: "error", showIcon: true, title: recordActions.error }) : null, list] }));
|
|
148
211
|
}
|
|
@@ -11,7 +11,17 @@ export declare const PHI_RECORD_WIDGET_DEFINITION: {
|
|
|
11
11
|
icon: string;
|
|
12
12
|
slotSizePolicy: "fill-inline";
|
|
13
13
|
runtimeSignals: {
|
|
14
|
-
emits:
|
|
14
|
+
emits: ({
|
|
15
|
+
id: string;
|
|
16
|
+
action: "activate";
|
|
17
|
+
valueType: "json";
|
|
18
|
+
valueSchema: `${string}/signals/${string}`;
|
|
19
|
+
} | {
|
|
20
|
+
id: string;
|
|
21
|
+
action: "change";
|
|
22
|
+
valueType: "string";
|
|
23
|
+
valueSchema?: undefined;
|
|
24
|
+
})[];
|
|
15
25
|
listens: ({
|
|
16
26
|
id: string;
|
|
17
27
|
channel: string;
|
|
@@ -24,6 +34,12 @@ export declare const PHI_RECORD_WIDGET_DEFINITION: {
|
|
|
24
34
|
action: "change";
|
|
25
35
|
valueType: "boolean";
|
|
26
36
|
valueSchema?: undefined;
|
|
37
|
+
} | {
|
|
38
|
+
id: string;
|
|
39
|
+
channel: string;
|
|
40
|
+
action: "activate";
|
|
41
|
+
valueType: "string";
|
|
42
|
+
valueSchema?: undefined;
|
|
27
43
|
})[];
|
|
28
44
|
};
|
|
29
45
|
fields: ({
|
|
@@ -121,6 +137,7 @@ export declare const PHI_RECORD_WIDGET_DEFINITION: {
|
|
|
121
137
|
label: string;
|
|
122
138
|
renderer: string;
|
|
123
139
|
full: boolean;
|
|
140
|
+
mode?: undefined;
|
|
124
141
|
};
|
|
125
142
|
itemFields: ({
|
|
126
143
|
key: string;
|
|
@@ -171,10 +188,58 @@ export declare const PHI_RECORD_WIDGET_DEFINITION: {
|
|
|
171
188
|
min?: undefined;
|
|
172
189
|
max?: undefined;
|
|
173
190
|
precision?: undefined;
|
|
191
|
+
} | {
|
|
192
|
+
key: string;
|
|
193
|
+
type: "collection";
|
|
194
|
+
presentation: "overlay";
|
|
195
|
+
label: string;
|
|
196
|
+
description: string;
|
|
197
|
+
itemKeyField: string;
|
|
198
|
+
itemLabelField: string;
|
|
199
|
+
addLabel: string;
|
|
200
|
+
emptyLabel: string;
|
|
201
|
+
editLabel: string;
|
|
202
|
+
defaultItem: {
|
|
203
|
+
key: string;
|
|
204
|
+
mode: string;
|
|
205
|
+
fieldKey?: undefined;
|
|
206
|
+
label?: undefined;
|
|
207
|
+
renderer?: undefined;
|
|
208
|
+
full?: undefined;
|
|
209
|
+
};
|
|
210
|
+
itemFields: ({
|
|
211
|
+
key: string;
|
|
212
|
+
type: "string";
|
|
213
|
+
label: string;
|
|
214
|
+
required: true;
|
|
215
|
+
options?: undefined;
|
|
216
|
+
} | {
|
|
217
|
+
key: string;
|
|
218
|
+
type: "choice";
|
|
219
|
+
label: string;
|
|
220
|
+
options: {
|
|
221
|
+
value: string;
|
|
222
|
+
label: string;
|
|
223
|
+
}[];
|
|
224
|
+
required?: undefined;
|
|
225
|
+
} | {
|
|
226
|
+
key: string;
|
|
227
|
+
type: "string";
|
|
228
|
+
label: string;
|
|
229
|
+
required?: undefined;
|
|
230
|
+
options?: undefined;
|
|
231
|
+
})[];
|
|
232
|
+
providerKind?: undefined;
|
|
233
|
+
required?: undefined;
|
|
234
|
+
options?: undefined;
|
|
235
|
+
min?: undefined;
|
|
236
|
+
max?: undefined;
|
|
237
|
+
precision?: undefined;
|
|
174
238
|
})[];
|
|
175
239
|
defaultConfig: {
|
|
176
240
|
source: null;
|
|
177
241
|
openActionKey: string;
|
|
242
|
+
actions: never[];
|
|
178
243
|
presentation: {
|
|
179
244
|
appearance: "grid";
|
|
180
245
|
columns: number;
|