@phis/ui 0.7.4 → 0.7.7
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 +5 -4
- package/components/controls/phi-options-provider.d.ts +14 -1
- package/components/controls/phi-options-provider.js +73 -2
- package/components/forms/auth-admin-settings-labels.d.ts +1 -1
- package/components/forms/auth-admin-settings-labels.js +2 -2
- 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-registry.d.ts +8 -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/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/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-choice-controller.js +22 -15
- package/components/widgets/client/shared/phi-rendered-value.d.ts +10 -0
- package/components/widgets/client/shared/phi-rendered-value.js +49 -1
- 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/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/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/clients/inspector-config-field.js +11 -6
- 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/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/cascader/client.js +13 -12
- package/plugins/runtime-modules/core/widgets/checkbox-group/client.js +5 -4
- 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/multi-select/client.js +6 -4
- 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/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/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/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,7 @@
|
|
|
2
2
|
import { jsx as _jsx } from "react/jsx-runtime";
|
|
3
3
|
import { createContext, createElement, useContext, useMemo, } from "react";
|
|
4
4
|
import { isPhiRuntimeDataProviderKey, } from "../../../../types/runtime-data-provider";
|
|
5
|
+
import { PhiTableProviderError, readPhiTableProviderMutationResult, } from "../../../../types/table-widget";
|
|
5
6
|
const EMPTY_TABLE_PROVIDER_REGISTRY = new Map();
|
|
6
7
|
const PhiTableProviderRegistryContext = createContext(EMPTY_TABLE_PROVIDER_REGISTRY);
|
|
7
8
|
export function createPhiTableProviderClient(registration) {
|
|
@@ -69,3 +70,24 @@ export function usePhiTableProvider(source) {
|
|
|
69
70
|
: null,
|
|
70
71
|
};
|
|
71
72
|
}
|
|
73
|
+
/**
|
|
74
|
+
* One mutation through a bound source's Provider Client, and its answer read strictly: a Provider without
|
|
75
|
+
* `mutate` is read-only, and an answer outside `PhiTableProviderMutationResult` is the Provider's failure,
|
|
76
|
+
* not an accepted change. What the answer then means for what is on screen -- rows patched, a view read
|
|
77
|
+
* again, a dialog closed -- is the caller's: the Table's Binding and the record Widget both ask here.
|
|
78
|
+
*/
|
|
79
|
+
export async function requestPhiTableProviderMutation(provider, source, request, signal) {
|
|
80
|
+
if (!provider.mutate) {
|
|
81
|
+
throw new PhiTableProviderError("provider-read-only", `Table Provider "${source.providerKey}" is read-only.`);
|
|
82
|
+
}
|
|
83
|
+
const result = readPhiTableProviderMutationResult(await provider.mutate({
|
|
84
|
+
...request,
|
|
85
|
+
resourceKey: source.resourceKey,
|
|
86
|
+
params: source.params,
|
|
87
|
+
signal,
|
|
88
|
+
}));
|
|
89
|
+
if (!result) {
|
|
90
|
+
throw new PhiTableProviderError("invalid-mutation-result", "Table Provider returned an invalid mutation result.");
|
|
91
|
+
}
|
|
92
|
+
return result;
|
|
93
|
+
}
|
|
@@ -16,6 +16,19 @@ export declare function getPhiAdminUsersTableWidgetLabels(options: PhiGlobalTran
|
|
|
16
16
|
addonRoles: {
|
|
17
17
|
all: string;
|
|
18
18
|
};
|
|
19
|
+
addonRoleTexts: {
|
|
20
|
+
via: string;
|
|
21
|
+
impliedBy: string;
|
|
22
|
+
siteAccess: {
|
|
23
|
+
"site-maintenance": string;
|
|
24
|
+
"structure-authoring": string;
|
|
25
|
+
"content-editing": string;
|
|
26
|
+
publishing: string;
|
|
27
|
+
"site-media": string;
|
|
28
|
+
support: string;
|
|
29
|
+
accounting: string;
|
|
30
|
+
};
|
|
31
|
+
};
|
|
19
32
|
filters: {
|
|
20
33
|
addonRole: string;
|
|
21
34
|
addonRoleHint: string;
|
|
@@ -71,6 +84,8 @@ export declare function getPhiAdminUsersTableWidgetLabels(options: PhiGlobalTran
|
|
|
71
84
|
addonRoles: string;
|
|
72
85
|
addonRolesPlaceholder: string;
|
|
73
86
|
addonRolesHint: string;
|
|
87
|
+
impliedAddonRoles: string;
|
|
88
|
+
impliedAddonRolesHint: string;
|
|
74
89
|
changePassword: string;
|
|
75
90
|
createPasswordHint: string;
|
|
76
91
|
authOnlyHint: string;
|
|
@@ -26,6 +26,15 @@ const PHI_ADMIN_USERS_TABLE_WIDGET_LABEL_SET = definePhiLabelSet({
|
|
|
26
26
|
column_roles: "Roles",
|
|
27
27
|
column_addon_roles: "Add-on roles",
|
|
28
28
|
addon_roles_all: "all roles",
|
|
29
|
+
addon_role_via: "%1 (via %2)",
|
|
30
|
+
addon_role_implied_by: "Implied by %1",
|
|
31
|
+
site_access_site_maintenance: "Site maintenance",
|
|
32
|
+
site_access_structure_authoring: "Structure authoring",
|
|
33
|
+
site_access_content_editing: "Content editing",
|
|
34
|
+
site_access_publishing: "Publishing",
|
|
35
|
+
site_access_site_media: "Site media",
|
|
36
|
+
site_access_support: "Support",
|
|
37
|
+
site_access_accounting: "Accounting",
|
|
29
38
|
filter_addon_role: "Add-on",
|
|
30
39
|
filter_addon_role_hint: definePhiMessageLabel("Show users who hold any role of an Add-on. Site Admins hold every role."),
|
|
31
40
|
column_user_flags: "User flags",
|
|
@@ -62,6 +71,8 @@ const PHI_ADMIN_USERS_TABLE_WIDGET_LABEL_SET = definePhiLabelSet({
|
|
|
62
71
|
editor_addon_roles: "Add-on roles",
|
|
63
72
|
editor_addon_roles_placeholder: "Choose Add-on roles",
|
|
64
73
|
editor_addon_roles_hint: definePhiMessageLabel("A Site Admin holds every Add-on role. Your own Add-on roles cannot be changed here."),
|
|
74
|
+
editor_implied_addon_roles: "Add-on roles through Core roles",
|
|
75
|
+
editor_implied_addon_roles_hint: definePhiMessageLabel("Held without a grant while the person has the Core role that implies them. They cannot be removed here."),
|
|
65
76
|
editor_change_password: "Require password reset",
|
|
66
77
|
editor_create_password_hint: definePhiMessageLabel("New users are created with a temporary password and receive a reset link."),
|
|
67
78
|
editor_auth_only_hint: definePhiMessageLabel("Leave roles empty for an auth-only account."),
|
|
@@ -110,6 +121,24 @@ export async function getPhiAdminUsersTableWidgetLabels(options) {
|
|
|
110
121
|
addonRoles: {
|
|
111
122
|
all: labels.addon_roles_all,
|
|
112
123
|
},
|
|
124
|
+
/*
|
|
125
|
+
* The words for an Add-on role held through a Site access (`PhiAddonRoleTexts`), which the users page
|
|
126
|
+
* preset hands to the Table's and the edit form's Providers. One word per Site access an Add-on may hang a
|
|
127
|
+
* role on: every one but site-admin, who holds every role already.
|
|
128
|
+
*/
|
|
129
|
+
addonRoleTexts: {
|
|
130
|
+
via: labels.addon_role_via,
|
|
131
|
+
impliedBy: labels.addon_role_implied_by,
|
|
132
|
+
siteAccess: {
|
|
133
|
+
"site-maintenance": labels.site_access_site_maintenance,
|
|
134
|
+
"structure-authoring": labels.site_access_structure_authoring,
|
|
135
|
+
"content-editing": labels.site_access_content_editing,
|
|
136
|
+
publishing: labels.site_access_publishing,
|
|
137
|
+
"site-media": labels.site_access_site_media,
|
|
138
|
+
support: labels.site_access_support,
|
|
139
|
+
accounting: labels.site_access_accounting,
|
|
140
|
+
},
|
|
141
|
+
},
|
|
113
142
|
filters: {
|
|
114
143
|
addonRole: labels.filter_addon_role,
|
|
115
144
|
addonRoleHint: labels.filter_addon_role_hint,
|
|
@@ -165,6 +194,8 @@ export async function getPhiAdminUsersTableWidgetLabels(options) {
|
|
|
165
194
|
addonRoles: labels.editor_addon_roles,
|
|
166
195
|
addonRolesPlaceholder: labels.editor_addon_roles_placeholder,
|
|
167
196
|
addonRolesHint: labels.editor_addon_roles_hint,
|
|
197
|
+
impliedAddonRoles: labels.editor_implied_addon_roles,
|
|
198
|
+
impliedAddonRolesHint: labels.editor_implied_addon_roles_hint,
|
|
168
199
|
changePassword: labels.editor_change_password,
|
|
169
200
|
createPasswordHint: labels.editor_create_password_hint,
|
|
170
201
|
authOnlyHint: labels.editor_auth_only_hint,
|
|
@@ -21,4 +21,11 @@ export declare const PHI_CORE_RUNTIME_DATA_PROVIDER_KEYS: {
|
|
|
21
21
|
readonly contentEntryCategories: `${string}/${string}`;
|
|
22
22
|
/** One published entry and its relatives, read on the server; the binding names the kind and slug. */
|
|
23
23
|
readonly contentEntry: `${string}/${string}`;
|
|
24
|
+
/**
|
|
25
|
+
* The Site's members, for a select that names a person by user id -- a licence granted on somebody's
|
|
26
|
+
* behalf: searched by name or address on the server, a page at a time, each option the user id as
|
|
27
|
+
* text and the name the person is shown under. For staff holding the Site access `accounting` or
|
|
28
|
+
* `support`; anybody else is refused by Core and gets no options (FORMS.md, "Options providers").
|
|
29
|
+
*/
|
|
30
|
+
readonly siteMembers: `${string}/${string}`;
|
|
24
31
|
};
|
|
@@ -22,4 +22,11 @@ export const PHI_CORE_RUNTIME_DATA_PROVIDER_KEYS = {
|
|
|
22
22
|
contentEntryCategories: createPhiSharedRuntimeDataProviderKey("tables", "content-entry-categories"),
|
|
23
23
|
/** One published entry and its relatives, read on the server; the binding names the kind and slug. */
|
|
24
24
|
contentEntry: createPhiSharedRuntimeDataProviderKey("records", "content-entry"),
|
|
25
|
+
/**
|
|
26
|
+
* The Site's members, for a select that names a person by user id -- a licence granted on somebody's
|
|
27
|
+
* behalf: searched by name or address on the server, a page at a time, each option the user id as
|
|
28
|
+
* text and the name the person is shown under. For staff holding the Site access `accounting` or
|
|
29
|
+
* `support`; anybody else is refused by Core and gets no options (FORMS.md, "Options providers").
|
|
30
|
+
*/
|
|
31
|
+
siteMembers: createPhiSharedRuntimeDataProviderKey("options", "core-site-members"),
|
|
25
32
|
};
|
|
@@ -3,8 +3,8 @@ export declare const PHI_BASE_ROLE_OPTIONS: readonly [{
|
|
|
3
3
|
readonly value: "admin";
|
|
4
4
|
readonly flag: number;
|
|
5
5
|
}, {
|
|
6
|
-
readonly label: "
|
|
7
|
-
readonly value: "
|
|
6
|
+
readonly label: "Maintainer";
|
|
7
|
+
readonly value: "maintainer";
|
|
8
8
|
readonly flag: number;
|
|
9
9
|
}, {
|
|
10
10
|
readonly label: "Builder";
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { PhiBaseRole } from "./phi-base-roles";
|
|
2
2
|
export const PHI_BASE_ROLE_OPTIONS = [
|
|
3
3
|
{ label: "Admin", value: "admin", flag: PhiBaseRole.Admin },
|
|
4
|
-
{ label: "
|
|
4
|
+
{ label: "Maintainer", value: "maintainer", flag: PhiBaseRole.Maintainer },
|
|
5
5
|
{ label: "Builder", value: "builder", flag: PhiBaseRole.Builder },
|
|
6
6
|
{ label: "Author", value: "author", flag: PhiBaseRole.Author },
|
|
7
7
|
{ label: "Publisher", value: "publisher", flag: PhiBaseRole.Publisher },
|
|
@@ -170,6 +170,7 @@ const PHI_RUNTIME_MODULE_OWNERSHIP = {
|
|
|
170
170
|
"forms/user-management/edit": ["user-management", "edit"],
|
|
171
171
|
"options/admin-site-locales": ["localization", "admin-site-locales"],
|
|
172
172
|
"options/core-site-locales": ["core", "site-locales"],
|
|
173
|
+
"options/core-site-members": ["core", "site-members"],
|
|
173
174
|
"options/user-management-addon-roles": ["user-management", "addon-roles"],
|
|
174
175
|
"options/user-management-addon-role-choices": ["user-management", "addon-role-choices"],
|
|
175
176
|
"options/builder-area-root-route": ["builder", "area-root-route"],
|
|
@@ -257,6 +258,8 @@ const PHI_RUNTIME_MODULE_OWNERSHIP = {
|
|
|
257
258
|
"signals/timeline-binding-params": ["core", "timeline-binding-params"],
|
|
258
259
|
"signals/tree-mutation": ["core", "tree-mutation"],
|
|
259
260
|
"signals/tree-state": ["core", "tree-state"],
|
|
261
|
+
// The Site's product directory, the Accounting Area's own Page.
|
|
262
|
+
"tables/accounting-products": ["accounting", "products"],
|
|
260
263
|
"tables/builder-navigation": ["builder", "navigation"],
|
|
261
264
|
"tables/runtime-modules": ["builder", "runtime-modules"],
|
|
262
265
|
"tables/builder-signal-routes": ["builder", "signal-routes"],
|
package/forms.d.ts
CHANGED
|
@@ -12,7 +12,7 @@ export { PHI_FORM_CONTROLLER_KEY, PHI_FORM_SIGNAL_CHANNELS, PHI_RUNTIME_FORM_CON
|
|
|
12
12
|
export { PHI_FORM_BUILDER_CONTROLLER_INSTANCE_KEY, PHI_FORM_BUILDER_CONTROLLER_KEY, PHI_FORM_BUILDER_CONTROLLER_PLUGIN_KEY, PHI_FORM_BUILDER_CONTROLLER_TYPE, createPhiFormBuilderControllerAddress, } from "./components/forms/form-builder-controller-address";
|
|
13
13
|
export { PHI_FORM_BUILDER_CONTROLLER_DEFINITION, parsePhiFormBuilderControllerConfig, } from "./components/forms/form-builder-controller-definition";
|
|
14
14
|
export { PHI_AUTH_FORM_FIELD_PROVIDER_KEYS, PHI_FORM_FIELD_PROVIDER_KEYS, PHI_FORM_HANDLER_PROVIDER_KEYS, PHI_FORM_VALIDATION_PROVIDER_KEYS, PHI_SHARED_FORM_FIELD_TYPE_PROVIDER_DESCRIPTORS, PHI_SHARED_FORM_VALIDATION_PROVIDER_DESCRIPTORS, createPhiSharedFormProviderKey, } from "./components/forms/form-provider-contract";
|
|
15
|
-
export { PHI_FORM_DEFAULT_LAYOUT, PHI_FORM_GRID_LAST_LINE, PHI_FORM_RESPONSIVE_MIN_WIDTH, PHI_FORM_RESPONSIVE_MODES, assertPhiFormLabelSetKey, createPhiFormLabelText, createPhiFormLiteralText, resolvePhiFormFieldExtent, resolvePhiFormFieldRanges, phiFormGridColumn, resolvePhiFormGridPlacement, phiFormGridRangesOverlap, resolvePhiFormLayout, resolvePhiFormResponsiveGridRange, resolvePhiFormText, parsePhiFormDescriptor, } from "./components/forms/form-descriptor-contract";
|
|
15
|
+
export { PHI_FORM_DEFAULT_LAYOUT, PHI_FORM_GRID_LAST_LINE, PHI_FORM_RESPONSIVE_MIN_WIDTH, PHI_FORM_RESPONSIVE_MODES, assertPhiFormLabelSetKey, createPhiFormLabelText, createPhiFormLiteralText, resolvePhiFormFieldExtent, resolvePhiFormFieldRanges, phiFormGridColumn, resolvePhiFormGridPlacement, phiFormGridRangesOverlap, resolvePhiFormLayout, resolvePhiFormResponsiveGridRange, resolvePhiFormErrorText, resolvePhiFormText, parsePhiFormDescriptor, } from "./components/forms/form-descriptor-contract";
|
|
16
16
|
export { PHI_CONFIRM_FORM_DESCRIPTOR, PHI_CONTACT_FORM_DESCRIPTOR, PHI_FORM_LABEL_SET_KEYS, PHI_LOGIN_FORM_DESCRIPTOR, PHI_REGISTRATION_FORM_DESCRIPTOR, PHI_RESET_PASSWORD_CONFIRM_FORM_DESCRIPTOR, PHI_RESET_PASSWORD_FORM_DESCRIPTOR, PHI_UNSUBSCRIBE_FORM_DESCRIPTOR, } from "./components/forms/shared-form-descriptors";
|
|
17
17
|
export { PHI_SHARED_FORM_IDS } from "./components/forms/shared-form-ids";
|
|
18
18
|
export { flattenPhiFormLabels } from "./components/forms/form-labels";
|
package/forms.js
CHANGED
|
@@ -7,7 +7,7 @@ export { PHI_FORM_CONTROLLER_KEY, PHI_FORM_SIGNAL_CHANNELS, PHI_RUNTIME_FORM_CON
|
|
|
7
7
|
export { PHI_FORM_BUILDER_CONTROLLER_INSTANCE_KEY, PHI_FORM_BUILDER_CONTROLLER_KEY, PHI_FORM_BUILDER_CONTROLLER_PLUGIN_KEY, PHI_FORM_BUILDER_CONTROLLER_TYPE, createPhiFormBuilderControllerAddress, } from "./components/forms/form-builder-controller-address";
|
|
8
8
|
export { PHI_FORM_BUILDER_CONTROLLER_DEFINITION, parsePhiFormBuilderControllerConfig, } from "./components/forms/form-builder-controller-definition";
|
|
9
9
|
export { PHI_AUTH_FORM_FIELD_PROVIDER_KEYS, PHI_FORM_FIELD_PROVIDER_KEYS, PHI_FORM_HANDLER_PROVIDER_KEYS, PHI_FORM_VALIDATION_PROVIDER_KEYS, PHI_SHARED_FORM_FIELD_TYPE_PROVIDER_DESCRIPTORS, PHI_SHARED_FORM_VALIDATION_PROVIDER_DESCRIPTORS, createPhiSharedFormProviderKey, } from "./components/forms/form-provider-contract";
|
|
10
|
-
export { PHI_FORM_DEFAULT_LAYOUT, PHI_FORM_GRID_LAST_LINE, PHI_FORM_RESPONSIVE_MIN_WIDTH, PHI_FORM_RESPONSIVE_MODES, assertPhiFormLabelSetKey, createPhiFormLabelText, createPhiFormLiteralText, resolvePhiFormFieldExtent, resolvePhiFormFieldRanges, phiFormGridColumn, resolvePhiFormGridPlacement, phiFormGridRangesOverlap, resolvePhiFormLayout, resolvePhiFormResponsiveGridRange, resolvePhiFormText, parsePhiFormDescriptor, } from "./components/forms/form-descriptor-contract";
|
|
10
|
+
export { PHI_FORM_DEFAULT_LAYOUT, PHI_FORM_GRID_LAST_LINE, PHI_FORM_RESPONSIVE_MIN_WIDTH, PHI_FORM_RESPONSIVE_MODES, assertPhiFormLabelSetKey, createPhiFormLabelText, createPhiFormLiteralText, resolvePhiFormFieldExtent, resolvePhiFormFieldRanges, phiFormGridColumn, resolvePhiFormGridPlacement, phiFormGridRangesOverlap, resolvePhiFormLayout, resolvePhiFormResponsiveGridRange, resolvePhiFormErrorText, resolvePhiFormText, parsePhiFormDescriptor, } from "./components/forms/form-descriptor-contract";
|
|
11
11
|
export { PHI_CONFIRM_FORM_DESCRIPTOR, PHI_CONTACT_FORM_DESCRIPTOR, PHI_FORM_LABEL_SET_KEYS, PHI_LOGIN_FORM_DESCRIPTOR, PHI_REGISTRATION_FORM_DESCRIPTOR, PHI_RESET_PASSWORD_CONFIRM_FORM_DESCRIPTOR, PHI_RESET_PASSWORD_FORM_DESCRIPTOR, PHI_UNSUBSCRIBE_FORM_DESCRIPTOR, } from "./components/forms/shared-form-descriptors";
|
|
12
12
|
export { PHI_SHARED_FORM_IDS } from "./components/forms/shared-form-ids";
|
|
13
13
|
/*
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import type { PhiAddonMediaLimits } from "../types/server-capabilities";
|
|
2
|
+
/**
|
|
3
|
+
* The Media limits of a provider in the capability snapshot (`PhiCapabilityProvider.media`), read as
|
|
4
|
+
* strictly as phis-server admits them from the manifest: absent is no limit of the Add-on's own; anything
|
|
5
|
+
* stated is an object with no other keys, `maxFileBytes` and `maxPerField` positive whole numbers, and
|
|
6
|
+
* `kinds` a non-empty list of `PhiMediaKind` values without duplicates. Anything else throws, as every
|
|
7
|
+
* other malformed part of the snapshot does -- a limit read past would be a Media field that takes what
|
|
8
|
+
* the Add-on refuses on save.
|
|
9
|
+
*/
|
|
10
|
+
export declare function readPhiCapabilityProviderMediaLimits(value: unknown): PhiAddonMediaLimits | undefined;
|
|
@@ -0,0 +1,40 @@
|
|
|
1
|
+
import { PhiMediaKind } from "../constants/media";
|
|
2
|
+
import { isPhiRecord } from "../helpers/is-record";
|
|
3
|
+
const MEDIA_LIMIT_KEYS = new Set(["maxFileBytes", "kinds", "maxPerField"]);
|
|
4
|
+
const MEDIA_KINDS = new Set(Object.values(PhiMediaKind));
|
|
5
|
+
function isPositiveWholeNumber(value) {
|
|
6
|
+
return typeof value === "number" && Number.isSafeInteger(value) && value > 0;
|
|
7
|
+
}
|
|
8
|
+
/**
|
|
9
|
+
* The Media limits of a provider in the capability snapshot (`PhiCapabilityProvider.media`), read as
|
|
10
|
+
* strictly as phis-server admits them from the manifest: absent is no limit of the Add-on's own; anything
|
|
11
|
+
* stated is an object with no other keys, `maxFileBytes` and `maxPerField` positive whole numbers, and
|
|
12
|
+
* `kinds` a non-empty list of `PhiMediaKind` values without duplicates. Anything else throws, as every
|
|
13
|
+
* other malformed part of the snapshot does -- a limit read past would be a Media field that takes what
|
|
14
|
+
* the Add-on refuses on save.
|
|
15
|
+
*/
|
|
16
|
+
export function readPhiCapabilityProviderMediaLimits(value) {
|
|
17
|
+
if (value === undefined)
|
|
18
|
+
return undefined;
|
|
19
|
+
if (!isPhiRecord(value)) {
|
|
20
|
+
throw new Error("Invalid server capability provider media limits.");
|
|
21
|
+
}
|
|
22
|
+
const record = value;
|
|
23
|
+
if (Object.keys(record).some((key) => !MEDIA_LIMIT_KEYS.has(key))) {
|
|
24
|
+
throw new Error("Invalid server capability provider media limits.");
|
|
25
|
+
}
|
|
26
|
+
const { maxFileBytes, kinds, maxPerField } = record;
|
|
27
|
+
if ((maxFileBytes !== undefined && !isPositiveWholeNumber(maxFileBytes)) ||
|
|
28
|
+
(maxPerField !== undefined && !isPositiveWholeNumber(maxPerField)) ||
|
|
29
|
+
(kinds !== undefined && (!Array.isArray(kinds) ||
|
|
30
|
+
kinds.length === 0 ||
|
|
31
|
+
kinds.some((kind) => typeof kind !== "string" || !MEDIA_KINDS.has(kind)) ||
|
|
32
|
+
new Set(kinds).size !== kinds.length))) {
|
|
33
|
+
throw new Error("Invalid server capability provider media limits.");
|
|
34
|
+
}
|
|
35
|
+
return {
|
|
36
|
+
...(maxFileBytes !== undefined ? { maxFileBytes } : {}),
|
|
37
|
+
...(kinds !== undefined ? { kinds: [...kinds] } : {}),
|
|
38
|
+
...(maxPerField !== undefined ? { maxPerField } : {}),
|
|
39
|
+
};
|
|
40
|
+
}
|
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import "server-only";
|
|
2
|
+
import { readPhiCapabilityProviderMediaLimits } from "./capability-media-limits";
|
|
2
3
|
import { fetchPhiSiteApi } from "./site-api-request";
|
|
3
4
|
import { readPhiSiteReadCache } from "./site-read-cache";
|
|
4
5
|
const PROVIDER_ID_PATTERN = /^@[^/]+\/[^/]+(?:\/[^/]+)*$/;
|
|
@@ -40,11 +41,14 @@ function parseProvider(value) {
|
|
|
40
41
|
!Array.isArray(record.capabilities)) {
|
|
41
42
|
throw new Error("Invalid server capability provider.");
|
|
42
43
|
}
|
|
44
|
+
// The Add-on's manifest `media`, which the Media fields of its Module apply (FORMS.md); absent for Core.
|
|
45
|
+
const media = readPhiCapabilityProviderMediaLimits(record.media);
|
|
43
46
|
return {
|
|
44
47
|
providerId: record.providerId,
|
|
45
48
|
state: record.state,
|
|
46
49
|
diagnosticCode: record.diagnosticCode,
|
|
47
50
|
capabilities: record.capabilities.map(parseCapability),
|
|
51
|
+
...(media ? { media } : {}),
|
|
48
52
|
};
|
|
49
53
|
}
|
|
50
54
|
function parseSnapshot(value) {
|
|
@@ -11,8 +11,9 @@ import type { PhiCmsPageNode, PhiResolvedCmsPageTree } from "../types/cms";
|
|
|
11
11
|
* The rules: every node a preset instance id, none twice, every parent, Region root, Overlay root and Page
|
|
12
12
|
* root resolved; the base page layout node only as the canonical scaffold; an actions Footer the canonical
|
|
13
13
|
* Flex preset; a modal's body and actions the dialog's (`helpers/cms-dialog.ts`), and a modal at the default
|
|
14
|
-
* `PHI_DIALOG_WIDTH` not holding only Forms of one column
|
|
15
|
-
* to throw them, so its first is the
|
|
14
|
+
* `PHI_DIALOG_WIDTH` not holding only Forms of one column; a Form's or a record Widget's title from its
|
|
15
|
+
* record read, sent, and heard where it goes. The findings come in the order the compiler used to throw them, so its first is the
|
|
16
|
+
* error it always gave.
|
|
16
17
|
*
|
|
17
18
|
* `page` is the Page the tree was asked for: a tree whose Page or Regions belong to another is refused.
|
|
18
19
|
* `forms` are the Forms the caller can see, by id or as definitions; a Form not among them -- one stored on
|
|
@@ -4,6 +4,8 @@ import { PhiCmsWidgetType } from "../constants/cms-widget-types";
|
|
|
4
4
|
import { isPhiCmsInstanceId, readPhiCmsInstanceIdDescriptor } from "../types/cms-instance-id";
|
|
5
5
|
import { PHI_DIALOG_BLEED_BODY_CONFIG, PHI_DIALOG_BODY_CONFIG, PHI_DIALOG_COMMANDS_CONFIG, PHI_DIALOG_WIDTH, isPhiFormSingleColumn, } from "./cms-dialog";
|
|
6
6
|
import { resolvePhiLayoutCreationPreset } from "./cms-layout-defaults";
|
|
7
|
+
import { PHI_FORM_RECORD_TITLE_CAPABILITY, readPhiFormWidgetTitleFromRecord, } from "../components/forms/form-record-title";
|
|
8
|
+
import { readPhiRecordWidgetTitleFromRecord } from "./record-widget";
|
|
7
9
|
function stablePresetNodeJson(value) {
|
|
8
10
|
if (Array.isArray(value)) {
|
|
9
11
|
return `[${value.map(stablePresetNodeJson).join(",")}]`;
|
|
@@ -112,6 +114,7 @@ export function checkPhiPresetTreeContract(tree, options = {}) {
|
|
|
112
114
|
if (forms)
|
|
113
115
|
checkDialogWidth(overlay, tree, forms, report);
|
|
114
116
|
}
|
|
117
|
+
checkRecordTitles(tree, forms, report);
|
|
115
118
|
for (const rootLayoutNodeId of [
|
|
116
119
|
tree.page.heroRootLayoutNodeId,
|
|
117
120
|
tree.page.headerBottomRootLayoutNodeId,
|
|
@@ -209,3 +212,60 @@ function checkDialogWidth(overlay, tree, forms, report) {
|
|
|
209
212
|
"(PHI_DIALOG_WIDTH). Hand the Form to `dialog` as `body.form`, or state `width: PHI_DIALOG_WIDTH_SINGLE_COLUMN`.");
|
|
210
213
|
}
|
|
211
214
|
}
|
|
215
|
+
function readRoutes(config, side) {
|
|
216
|
+
const routes = config.signalRoutes?.[side];
|
|
217
|
+
return Array.isArray(routes) ? routes.filter((route) => route != null && typeof route === "object") : [];
|
|
218
|
+
}
|
|
219
|
+
/*
|
|
220
|
+
* A title from the record shown (`helpers/record-title.ts`), end to end, for the record Form and the record
|
|
221
|
+
* Widget alike, since every break is silent: no `source` reads nothing, no `recordTitle` route names
|
|
222
|
+
* nothing, a route without the option carries nothing, an Overlay not listening on `title` drops it. Where
|
|
223
|
+
* the Form is known, the field is one of its own -- a record answers for the Form's fields; a record
|
|
224
|
+
* Widget reads the whole row its Provider answers, so any field of it may name the dialog.
|
|
225
|
+
*/
|
|
226
|
+
function checkRecordTitles(tree, forms, report) {
|
|
227
|
+
const overlaysById = new Map(tree.overlays.map((overlay) => [`cms:${overlay.id}`, overlay]));
|
|
228
|
+
for (const widget of tree.contentWidgets) {
|
|
229
|
+
const isForm = widget.widgetType === PhiCmsWidgetType.Form;
|
|
230
|
+
if (!isForm && widget.widgetType !== PhiCmsWidgetType.Record)
|
|
231
|
+
continue;
|
|
232
|
+
const name = `Preset ${isForm ? "Form" : "Record"} "${widget.id}"`;
|
|
233
|
+
const routes = readRoutes(widget.config, "emits").filter((route) => route.capabilityId === PHI_FORM_RECORD_TITLE_CAPABILITY);
|
|
234
|
+
let title;
|
|
235
|
+
try {
|
|
236
|
+
title = isForm
|
|
237
|
+
? readPhiFormWidgetTitleFromRecord(widget.config.titleFromRecord)
|
|
238
|
+
: readPhiRecordWidgetTitleFromRecord(widget.config.titleFromRecord);
|
|
239
|
+
}
|
|
240
|
+
catch (error) {
|
|
241
|
+
report(widget.id, `${name}: ${error.message}`);
|
|
242
|
+
continue;
|
|
243
|
+
}
|
|
244
|
+
if (!title) {
|
|
245
|
+
if (routes.length > 0)
|
|
246
|
+
report(widget.id, `${name} routes "recordTitle" but takes no titleFromRecord, so it announces nothing.`);
|
|
247
|
+
continue;
|
|
248
|
+
}
|
|
249
|
+
if (widget.config.source == null)
|
|
250
|
+
report(widget.id, `${name} takes its title from a record it never reads: titleFromRecord needs a source.`);
|
|
251
|
+
if (routes.length === 0)
|
|
252
|
+
report(widget.id, `${name} takes a titleFromRecord that goes nowhere: no route on "recordTitle".`);
|
|
253
|
+
const formId = String(widget.config.formId);
|
|
254
|
+
const descriptor = isForm ? forms?.get(formId)?.descriptor : undefined;
|
|
255
|
+
if (descriptor && !descriptor.fields.some((field) => field.key === title.field)) {
|
|
256
|
+
report(widget.id, `${name} takes its title from "${title.field}", which is no field of "${formId}".`);
|
|
257
|
+
}
|
|
258
|
+
for (const route of routes) {
|
|
259
|
+
if (route.action !== "change" || route.valueType !== "string") {
|
|
260
|
+
report(widget.id, `${name} route "${String(route.routeKey)}" must carry "recordTitle" as change/string.`);
|
|
261
|
+
continue;
|
|
262
|
+
}
|
|
263
|
+
// An Overlay of this tree hears it on its `title` input; another receiver is the Page's choice.
|
|
264
|
+
const overlay = overlaysById.get(String(route.receiver));
|
|
265
|
+
const keys = ["receiver", "scope", "channel", "action", "valueType"];
|
|
266
|
+
if (overlay && !readRoutes(overlay.config, "listens").some((listen) => listen.capabilityId === "title" && keys.every((key) => listen[key] === route[key]))) {
|
|
267
|
+
report(widget.id, `${name} sends its title to Overlay "${overlay.id}", which has no "title" route on ${String(route.scope)} ${String(route.channel)}/change.`);
|
|
268
|
+
}
|
|
269
|
+
}
|
|
270
|
+
}
|
|
271
|
+
}
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
/** The sentence's rule: `%1` exactly once and no other placeholder, or the reason it is refused. */
|
|
2
|
+
export declare function checkPhiRecordTitleTemplate(source: string): string | null;
|
|
3
|
+
/**
|
|
4
|
+
* The sentence with the record's value in it, or "" where the record has no text or number there: an
|
|
5
|
+
* empty title is the Overlay's own. The value goes in as it is -- never translated, `$` and `%1` included.
|
|
6
|
+
*/
|
|
7
|
+
export declare function fillPhiRecordTitle(template: string, value: unknown): string;
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
/*
|
|
2
|
+
* A dialog named by the record it shows ("Gallery: Private Cloud", "Terms: @acme/books:pro"): a sentence
|
|
3
|
+
* with `%1` once, and the value of one field of the record standing there. The record Form and the record
|
|
4
|
+
* Widget both announce it on `recordTitle` after every read (FORMS.md, TABLES.md); they differ only in
|
|
5
|
+
* where the sentence comes from -- a Form text, or the record Widget's own placement -- so the two rules
|
|
6
|
+
* they share are here.
|
|
7
|
+
*/
|
|
8
|
+
/** The sentence's rule: `%1` exactly once and no other placeholder, or the reason it is refused. */
|
|
9
|
+
export function checkPhiRecordTitleTemplate(source) {
|
|
10
|
+
const placeholders = source.match(/%\d+/gu) ?? [];
|
|
11
|
+
return placeholders.length === 1 && placeholders[0] === "%1"
|
|
12
|
+
? null
|
|
13
|
+
: `must hold %1 exactly once and no other placeholder: ${JSON.stringify(source)}.`;
|
|
14
|
+
}
|
|
15
|
+
/**
|
|
16
|
+
* The sentence with the record's value in it, or "" where the record has no text or number there: an
|
|
17
|
+
* empty title is the Overlay's own. The value goes in as it is -- never translated, `$` and `%1` included.
|
|
18
|
+
*/
|
|
19
|
+
export function fillPhiRecordTitle(template, value) {
|
|
20
|
+
const text = typeof value === "string"
|
|
21
|
+
? value.trim()
|
|
22
|
+
: typeof value === "number" && Number.isFinite(value) ? String(value) : "";
|
|
23
|
+
// A replacer, so a `$` in the value stays the value.
|
|
24
|
+
return text ? template.replace("%1", () => text) : "";
|
|
25
|
+
}
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
import type { PhiRecordWidgetConfig, PhiRecordWidgetTitleFromRecord } from "../types/record-widget";
|
|
2
|
+
import type { PhiTableProviderResourceDescriptor } from "../types/table-widget";
|
|
3
|
+
/**
|
|
4
|
+
* The placement's `titleFromRecord`, or null where it states none. Strict, as the Form's: no field, or a
|
|
5
|
+
* sentence without exactly one `%1`, is refused rather than read as no title.
|
|
6
|
+
*/
|
|
7
|
+
export declare function readPhiRecordWidgetTitleFromRecord(value: unknown): PhiRecordWidgetTitleFromRecord | null;
|
|
8
|
+
/**
|
|
9
|
+
* What the record Widget's actions ask of its resource, as the errors it shows instead of the record --
|
|
10
|
+
* the Table's binding check (`validatePhiTableWidgetBinding`) for the one scope a record has. Each action
|
|
11
|
+
* is the resource's, of scope `row`, named once, and drawn as the danger a destructive one is. A
|
|
12
|
+
* confirmation the resource requires is not asked for here: the record on screen, named in the dialog's
|
|
13
|
+
* title, and the press beside it are that confirmation, and a `confirm` would ask a second time.
|
|
14
|
+
*/
|
|
15
|
+
export declare function validatePhiRecordWidgetBinding(config: Pick<PhiRecordWidgetConfig, "actions">, resource: Pick<PhiTableProviderResourceDescriptor, "resourceKey" | "actions">): string[];
|
|
@@ -0,0 +1,57 @@
|
|
|
1
|
+
import { isPhiRecord } from "./is-record";
|
|
2
|
+
import { checkPhiRecordTitleTemplate } from "./record-title";
|
|
3
|
+
/*
|
|
4
|
+
* The record Widget's two readers that the descriptor compiler and the Widget share: its title from the
|
|
5
|
+
* record and its actions against the resource (TABLES.md, "The record Widget"). Apart from
|
|
6
|
+
* `types/record-widget.ts`, so the type stays a type for everything that only names it.
|
|
7
|
+
*/
|
|
8
|
+
/**
|
|
9
|
+
* The placement's `titleFromRecord`, or null where it states none. Strict, as the Form's: no field, or a
|
|
10
|
+
* sentence without exactly one `%1`, is refused rather than read as no title.
|
|
11
|
+
*/
|
|
12
|
+
export function readPhiRecordWidgetTitleFromRecord(value) {
|
|
13
|
+
if (value == null)
|
|
14
|
+
return null;
|
|
15
|
+
if (!isPhiRecord(value))
|
|
16
|
+
throw new Error(`Record titleFromRecord ${JSON.stringify(value)} is no { template, field }.`);
|
|
17
|
+
const field = typeof value.field === "string" ? value.field.trim() : "";
|
|
18
|
+
if (!field)
|
|
19
|
+
throw new Error("Record titleFromRecord.field must name the record field the title takes its value from.");
|
|
20
|
+
const template = typeof value.template === "string" ? value.template.trim() : "";
|
|
21
|
+
if (!template)
|
|
22
|
+
throw new Error("Record titleFromRecord.template must be the sentence the title is made of.");
|
|
23
|
+
const templateError = checkPhiRecordTitleTemplate(template);
|
|
24
|
+
if (templateError)
|
|
25
|
+
throw new Error(`Record titleFromRecord.template ${templateError}`);
|
|
26
|
+
return { template, field };
|
|
27
|
+
}
|
|
28
|
+
/**
|
|
29
|
+
* What the record Widget's actions ask of its resource, as the errors it shows instead of the record --
|
|
30
|
+
* the Table's binding check (`validatePhiTableWidgetBinding`) for the one scope a record has. Each action
|
|
31
|
+
* is the resource's, of scope `row`, named once, and drawn as the danger a destructive one is. A
|
|
32
|
+
* confirmation the resource requires is not asked for here: the record on screen, named in the dialog's
|
|
33
|
+
* title, and the press beside it are that confirmation, and a `confirm` would ask a second time.
|
|
34
|
+
*/
|
|
35
|
+
export function validatePhiRecordWidgetBinding(config, resource) {
|
|
36
|
+
const errors = [];
|
|
37
|
+
const declared = new Map(resource.actions?.map((action) => [action.key, action]) ?? []);
|
|
38
|
+
const seen = new Set();
|
|
39
|
+
for (const action of config.actions) {
|
|
40
|
+
if (seen.has(action.key)) {
|
|
41
|
+
errors.push(`Record action "${action.key}" is configured more than once.`);
|
|
42
|
+
continue;
|
|
43
|
+
}
|
|
44
|
+
seen.add(action.key);
|
|
45
|
+
const capability = declared.get(action.key);
|
|
46
|
+
if (!capability) {
|
|
47
|
+
errors.push(`Record action "${action.key}" is not declared by resource "${resource.resourceKey}".`);
|
|
48
|
+
}
|
|
49
|
+
else if (capability.scope !== "row") {
|
|
50
|
+
errors.push(`Record action "${action.key}" cannot run on a record: its scope is "${capability.scope}".`);
|
|
51
|
+
}
|
|
52
|
+
else if (capability.intent === "destructive" && action.mode !== "danger") {
|
|
53
|
+
errors.push(`Destructive Record action "${action.key}" requires danger presentation.`);
|
|
54
|
+
}
|
|
55
|
+
}
|
|
56
|
+
return errors;
|
|
57
|
+
}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@phis/ui",
|
|
3
|
-
"version": "0.7.
|
|
3
|
+
"version": "0.7.7",
|
|
4
4
|
"license": "Apache-2.0",
|
|
5
5
|
"publishConfig": {
|
|
6
6
|
"access": "public"
|
|
@@ -521,7 +521,7 @@
|
|
|
521
521
|
"@lexical/rich-text": "0.50.0",
|
|
522
522
|
"@lexical/selection": "0.50.0",
|
|
523
523
|
"@lexical/utils": "0.50.0",
|
|
524
|
-
"@phis/contracts": "^0.8.
|
|
524
|
+
"@phis/contracts": "^0.8.9",
|
|
525
525
|
"dayjs": "^1.11.23",
|
|
526
526
|
"dom-serializer": "^2.0.0",
|
|
527
527
|
"htmlparser2": "^10.1.0",
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
export declare const PHI_ACCOUNTING_RUNTIME_DATA_PROVIDER_CLIENT_DEFINITIONS: readonly [{
|
|
2
|
+
readonly key: `${string}/${string}`;
|
|
3
|
+
readonly ownerModuleId: "@phis/ui/modules/accounting";
|
|
4
|
+
readonly loadLive: () => Promise<import("react").ComponentType<{
|
|
5
|
+
children: import("react").ReactNode;
|
|
6
|
+
}>>;
|
|
7
|
+
}];
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
"use client";
|
|
2
|
+
import { PHI_ACCOUNTING_PRODUCTS_DATA_PROVIDER_KEY, PHI_ACCOUNTING_RUNTIME_MODULE_ID } from "./ids";
|
|
3
|
+
export const PHI_ACCOUNTING_RUNTIME_DATA_PROVIDER_CLIENT_DEFINITIONS = [
|
|
4
|
+
{
|
|
5
|
+
key: PHI_ACCOUNTING_PRODUCTS_DATA_PROVIDER_KEY,
|
|
6
|
+
ownerModuleId: PHI_ACCOUNTING_RUNTIME_MODULE_ID,
|
|
7
|
+
loadLive: async () => (await import("./services/products-table")).PhiAccountingProductsTableProviderClient,
|
|
8
|
+
},
|
|
9
|
+
];
|
|
@@ -0,0 +1,63 @@
|
|
|
1
|
+
import type { PhiTableProviderFieldDefinition } from "../../../types/table-widget";
|
|
2
|
+
/**
|
|
3
|
+
* The Site's product directory (phis-server SERVER_ADDONS.md, `products:v1`), as the operator
|
|
4
|
+
* administers it: every product of every supplier Add-on, in every state.
|
|
5
|
+
*
|
|
6
|
+
* `live` and `authoringMode: "none"`: the Builder has no business reading a Site's products while somebody
|
|
7
|
+
* composes a Page. The rows come from `GET /api/site/products` and the three acts go to
|
|
8
|
+
* `POST /api/site/products/{id}/release|lock|unlock`, behind Core's Accounting guard; Core refuses them to
|
|
9
|
+
* anybody else whatever a Table offers. Nothing a supplier says of its product -- title, summary, picture
|
|
10
|
+
* -- is edited here: that stays the supplier's.
|
|
11
|
+
*/
|
|
12
|
+
export declare const PHI_ACCOUNTING_RUNTIME_DATA_PROVIDER_DESCRIPTORS: {
|
|
13
|
+
key: `${string}/${string}`;
|
|
14
|
+
ownerModuleId: "@phis/ui/modules/accounting";
|
|
15
|
+
kind: "table";
|
|
16
|
+
executionMode: "live";
|
|
17
|
+
authoringMode: "none";
|
|
18
|
+
title: string;
|
|
19
|
+
description: string;
|
|
20
|
+
resources: {
|
|
21
|
+
resourceKey: string;
|
|
22
|
+
title: string;
|
|
23
|
+
rowIdentityPath: string;
|
|
24
|
+
fields: PhiTableProviderFieldDefinition[];
|
|
25
|
+
query: {
|
|
26
|
+
search: true;
|
|
27
|
+
filterFields: string[];
|
|
28
|
+
sorting: "none";
|
|
29
|
+
pagination: "offset";
|
|
30
|
+
total: true;
|
|
31
|
+
};
|
|
32
|
+
recordRead: true;
|
|
33
|
+
actions: ({
|
|
34
|
+
key: string;
|
|
35
|
+
title: string;
|
|
36
|
+
scope: "row";
|
|
37
|
+
intent: "write";
|
|
38
|
+
confirmation: "required";
|
|
39
|
+
disabledWhen: {
|
|
40
|
+
match: "any";
|
|
41
|
+
conditions: {
|
|
42
|
+
source: "row";
|
|
43
|
+
valuePath: string;
|
|
44
|
+
operator: "falsy";
|
|
45
|
+
}[];
|
|
46
|
+
};
|
|
47
|
+
} | {
|
|
48
|
+
key: string;
|
|
49
|
+
title: string;
|
|
50
|
+
scope: "row";
|
|
51
|
+
intent: "destructive";
|
|
52
|
+
confirmation: "required";
|
|
53
|
+
disabledWhen: {
|
|
54
|
+
match: "any";
|
|
55
|
+
conditions: {
|
|
56
|
+
source: "row";
|
|
57
|
+
valuePath: string;
|
|
58
|
+
operator: "truthy";
|
|
59
|
+
}[];
|
|
60
|
+
};
|
|
61
|
+
})[];
|
|
62
|
+
}[];
|
|
63
|
+
}[];
|