@phis/ui 0.7.5 → 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 +4 -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/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-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/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/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/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
|
@@ -1,9 +1,8 @@
|
|
|
1
1
|
"use client";
|
|
2
|
-
import { isPhiRecord } from "../../../helpers/is-record";
|
|
3
2
|
import { useCallback, useEffect, useMemo, useRef, useState, } from "react";
|
|
4
|
-
import { PhiTableProviderError, readPhiTableProviderError,
|
|
3
|
+
import { checkPhiTableProviderActionRequest, PhiTableProviderError, readPhiTableProviderError, readPhiTableProviderQueryResult, validatePhiTableProviderFieldValue, } from "../../../types/table-widget";
|
|
5
4
|
import { mergePhiTableQueryFilters, movePhiTableBindingRows, movePhiTableBindingTreeRows, patchPhiTableBindingRows, readPhiTableRowIdentity, readPhiTableRowValue, restorePhiTableBindingRowOrder, } from "../../../helpers/table-binding";
|
|
6
|
-
import { usePhiTableProvider } from "../../widgets/client/shared/phi-table-provider";
|
|
5
|
+
import { requestPhiTableProviderMutation, usePhiTableProvider, } from "../../widgets/client/shared/phi-table-provider";
|
|
7
6
|
import { usePhiIntlLocale, usePhiIntlTimeZone } from "../../root/phi-intl-locale";
|
|
8
7
|
function validateProviderSummary(resource, summary) {
|
|
9
8
|
if (!summary)
|
|
@@ -54,6 +53,37 @@ function createPhiTableQueryKey(query) {
|
|
|
54
53
|
expandedRowIdentities: query.expandedRowIdentities ?? [],
|
|
55
54
|
});
|
|
56
55
|
}
|
|
56
|
+
/*
|
|
57
|
+
* The list a page of a cursor-paged resource belongs to: the source and the query without its page. A
|
|
58
|
+
* cursor is a place in that list and in no other, so a new search, sort, filter, page size, source or
|
|
59
|
+
* binding param starts a list whose cursors are not known yet -- only its first page is.
|
|
60
|
+
*/
|
|
61
|
+
function createPhiTablePagingKey(sourceKey, query) {
|
|
62
|
+
const filters = Object.fromEntries(Object.entries(query.filters ?? {}).sort(([left], [right]) => left.localeCompare(right)));
|
|
63
|
+
return JSON.stringify({
|
|
64
|
+
sourceKey,
|
|
65
|
+
pageSize: query.pageSize ?? null,
|
|
66
|
+
search: query.search ?? "",
|
|
67
|
+
sorts: query.sorts ?? [],
|
|
68
|
+
filters,
|
|
69
|
+
});
|
|
70
|
+
}
|
|
71
|
+
/**
|
|
72
|
+
* What a cursor-paged list knows of its pages once one of them answered.
|
|
73
|
+
*
|
|
74
|
+
* The page keeps the cursor it was read with, and the page after it is the `nextCursor` it answered --
|
|
75
|
+
* or none, where it answered none. The pages after that follow from the next page's own answer, so they
|
|
76
|
+
* are let go: going back to page 2 and forward again reads page 3 with what page 2 says now.
|
|
77
|
+
*/
|
|
78
|
+
function rememberPhiTablePageCursors(known, pagingKey, page, cursor, nextCursor) {
|
|
79
|
+
const cursors = new Map(known?.pagingKey === pagingKey
|
|
80
|
+
? [...known.cursors].filter(([knownPage]) => knownPage < page)
|
|
81
|
+
: [[1, null]]);
|
|
82
|
+
cursors.set(page, cursor);
|
|
83
|
+
if (nextCursor !== null)
|
|
84
|
+
cursors.set(page + 1, nextCursor);
|
|
85
|
+
return { pagingKey, cursors };
|
|
86
|
+
}
|
|
57
87
|
function resolvePhiTableQuery(query, externalQuery, externalSearch, expandedRowIdentities, fixedFilters) {
|
|
58
88
|
return {
|
|
59
89
|
...query,
|
|
@@ -116,6 +146,16 @@ export function usePhiTableBinding({ source, initialQuery = {}, externalQuery, f
|
|
|
116
146
|
const rowsRef = useRef(rows);
|
|
117
147
|
const onDataRef = useRef(onData);
|
|
118
148
|
const onMutationRef = useRef(onMutation);
|
|
149
|
+
/*
|
|
150
|
+
* The cursor each page of a cursor-paged resource was read with (`rememberPhiTablePageCursors`).
|
|
151
|
+
*
|
|
152
|
+
* Such a Provider cannot be asked for page 3 by its number; it reads on from where a page ended. So
|
|
153
|
+
* turning the page hands it the cursor remembered for that page, and "back" the one the earlier page
|
|
154
|
+
* was read with. Held with the list it belongs to (`createPhiTablePagingKey`) rather than cleared at
|
|
155
|
+
* each place that starts another list, so a search, a sort, a filter, a page size or a source -- from
|
|
156
|
+
* the Table's own tools, a signal or the host -- leaves no cursor of the old list behind.
|
|
157
|
+
*/
|
|
158
|
+
const pageCursors = useRef(null);
|
|
119
159
|
const sourceKey = useMemo(() => JSON.stringify(source), [source]);
|
|
120
160
|
useEffect(() => { onDataRef.current = onData; }, [onData]);
|
|
121
161
|
useEffect(() => { onMutationRef.current = onMutation; }, [onMutation]);
|
|
@@ -166,6 +206,7 @@ export function usePhiTableBinding({ source, initialQuery = {}, externalQuery, f
|
|
|
166
206
|
const stableFixedFilters = useMemo(() => JSON.parse(fixedFiltersKey) ?? undefined, [fixedFiltersKey]);
|
|
167
207
|
const resolvedQuery = useMemo(() => resolvePhiTableQuery(query, externalQuery, externalSearch, expandedRowIdentities, stableFixedFilters), [expandedRowIdentities, externalQuery, externalSearch, stableFixedFilters, query]);
|
|
168
208
|
const resolvedQueryKey = useMemo(() => createPhiTableQueryKey(resolvedQuery), [resolvedQuery]);
|
|
209
|
+
const pagingKey = useMemo(() => createPhiTablePagingKey(sourceKey, resolvedQuery), [resolvedQuery, sourceKey]);
|
|
169
210
|
const updateMutationTargetPending = useCallback((targetKey, pending) => {
|
|
170
211
|
const current = pendingMutationCountsByTarget.current.get(targetKey) ?? 0;
|
|
171
212
|
const next = pending ? current + 1 : Math.max(0, current - 1);
|
|
@@ -185,7 +226,8 @@ export function usePhiTableBinding({ source, initialQuery = {}, externalQuery, f
|
|
|
185
226
|
});
|
|
186
227
|
}
|
|
187
228
|
}, []);
|
|
188
|
-
|
|
229
|
+
/** `answeredQuery`: the query the rows answer -- the request's, with the Provider's `resolvedQuery` merged in. */
|
|
230
|
+
const applyData = useCallback((data, answeredQuery) => {
|
|
189
231
|
if (!resource)
|
|
190
232
|
return;
|
|
191
233
|
if (data.rows.some((row) => readPhiTableRowIdentity(row, resource.rowIdentityPath) == null)) {
|
|
@@ -218,8 +260,16 @@ export function usePhiTableBinding({ source, initialQuery = {}, externalQuery, f
|
|
|
218
260
|
// A resource that does not page answers every row at once, so its rows are its count.
|
|
219
261
|
const pages = resource.query.pagination === "offset" || resource.query.pagination === "cursor";
|
|
220
262
|
setTotal(data.total ?? (pages ? null : data.rows.length));
|
|
221
|
-
|
|
222
|
-
|
|
263
|
+
if (resource.query.pagination === "cursor") {
|
|
264
|
+
// A page follows exactly where a cursor to it came back: a full page without one is the last.
|
|
265
|
+
const nextCursor = data.nextCursor ?? null;
|
|
266
|
+
pageCursors.current = rememberPhiTablePageCursors(pageCursors.current, createPhiTablePagingKey(sourceKey, answeredQuery), answeredQuery.page ?? 1, answeredQuery.cursor ?? null, nextCursor);
|
|
267
|
+
setHasMore(nextCursor !== null);
|
|
268
|
+
}
|
|
269
|
+
else {
|
|
270
|
+
const pageSize = data.pageSize ?? resolvedQuery.pageSize;
|
|
271
|
+
setHasMore(data.nextCursor != null || (data.total == null && pageSize != null && data.rows.length >= pageSize));
|
|
272
|
+
}
|
|
223
273
|
setSummary(data.summary ?? {});
|
|
224
274
|
setQueryLoading(false);
|
|
225
275
|
setError(null);
|
|
@@ -232,7 +282,7 @@ export function usePhiTableBinding({ source, initialQuery = {}, externalQuery, f
|
|
|
232
282
|
setSelectedRowIdentities((current) => current.filter((identity) => available.has(String(identity))));
|
|
233
283
|
}
|
|
234
284
|
onDataRef.current?.(data);
|
|
235
|
-
}, [preserveSelectedRowIdentities, resolvedQuery.pageSize, resource]);
|
|
285
|
+
}, [preserveSelectedRowIdentities, resolvedQuery.pageSize, resource, sourceKey]);
|
|
236
286
|
useEffect(() => {
|
|
237
287
|
if (!source || !provider || !resource || resourceError)
|
|
238
288
|
return;
|
|
@@ -286,9 +336,11 @@ export function usePhiTableBinding({ source, initialQuery = {}, externalQuery, f
|
|
|
286
336
|
}
|
|
287
337
|
if (!abortController.signal.aborted) {
|
|
288
338
|
const resolvedQueryPatch = data.resolvedQuery;
|
|
339
|
+
let answeredQuery = resolvedQuery;
|
|
289
340
|
if (resolvedQueryPatch) {
|
|
290
341
|
const canonicalInternalQuery = mergePhiTableQuery(query, resolvedQueryPatch);
|
|
291
342
|
const canonicalQuery = resolvePhiTableQuery(canonicalInternalQuery, externalQuery, externalSearch, expandedRowIdentities, stableFixedFilters);
|
|
343
|
+
answeredQuery = canonicalQuery;
|
|
292
344
|
const canonicalQueryKey = createPhiTableQueryKey(canonicalQuery);
|
|
293
345
|
if (canonicalQueryKey !== resolvedQueryKey) {
|
|
294
346
|
acceptedResolvedQuery.current = {
|
|
@@ -298,7 +350,7 @@ export function usePhiTableBinding({ source, initialQuery = {}, externalQuery, f
|
|
|
298
350
|
setQuery((current) => mergePhiTableQuery(current, resolvedQueryPatch));
|
|
299
351
|
}
|
|
300
352
|
}
|
|
301
|
-
applyData(data);
|
|
353
|
+
applyData(data, answeredQuery);
|
|
302
354
|
}
|
|
303
355
|
}).catch((queryError) => {
|
|
304
356
|
if (!abortController.signal.aborted) {
|
|
@@ -325,6 +377,30 @@ export function usePhiTableBinding({ source, initialQuery = {}, externalQuery, f
|
|
|
325
377
|
revision: current.revision + 1,
|
|
326
378
|
background: true,
|
|
327
379
|
})), []);
|
|
380
|
+
/*
|
|
381
|
+
* Turning the page, as the pagination reports it: the page and the page size.
|
|
382
|
+
*
|
|
383
|
+
* An offset-paged resource is asked for the page by its number. A cursor-paged one is handed the
|
|
384
|
+
* cursor that page was read with (`pageCursors`), so only a page it has a cursor for can be reached --
|
|
385
|
+
* the first, those read before, and the one after the page shown where it answered a `nextCursor`. A
|
|
386
|
+
* page without one is not a place in the list, and asking for it does nothing. Another page size is
|
|
387
|
+
* another list, and starts at its first page.
|
|
388
|
+
*/
|
|
389
|
+
const changePage = useCallback((page, pageSize) => {
|
|
390
|
+
if (resource?.query.pagination !== "cursor") {
|
|
391
|
+
setQuery((current) => ({ ...current, page, pageSize, cursor: null }));
|
|
392
|
+
return;
|
|
393
|
+
}
|
|
394
|
+
if (pageSize !== resolvedQuery.pageSize) {
|
|
395
|
+
setQuery((current) => ({ ...current, page: 1, pageSize, cursor: null }));
|
|
396
|
+
return;
|
|
397
|
+
}
|
|
398
|
+
const known = pageCursors.current?.pagingKey === pagingKey ? pageCursors.current.cursors : null;
|
|
399
|
+
const cursor = page === 1 ? null : known?.get(page);
|
|
400
|
+
if (cursor === undefined)
|
|
401
|
+
return;
|
|
402
|
+
setQuery((current) => ({ ...current, page, pageSize, cursor }));
|
|
403
|
+
}, [pagingKey, resolvedQuery.pageSize, resource]);
|
|
328
404
|
const runMutation = useCallback(async (request, targetKey, optimisticRows) => {
|
|
329
405
|
if (bindingError || !provider || !resource || !source) {
|
|
330
406
|
throw new PhiTableProviderError("provider-unavailable", bindingError ?? "Table Provider is unavailable.");
|
|
@@ -373,16 +449,7 @@ export function usePhiTableBinding({ source, initialQuery = {}, externalQuery, f
|
|
|
373
449
|
setRows(restored);
|
|
374
450
|
};
|
|
375
451
|
try {
|
|
376
|
-
const
|
|
377
|
-
...request,
|
|
378
|
-
resourceKey: source.resourceKey,
|
|
379
|
-
params: source.params,
|
|
380
|
-
signal: abortController.signal,
|
|
381
|
-
});
|
|
382
|
-
const result = readPhiTableProviderMutationResult(rawResult);
|
|
383
|
-
if (!result) {
|
|
384
|
-
throw new PhiTableProviderError("invalid-mutation-result", "Table Provider returned an invalid mutation result.");
|
|
385
|
-
}
|
|
452
|
+
const result = await requestPhiTableProviderMutation(provider, source, request, abortController.signal);
|
|
386
453
|
const summaryError = validateProviderSummary(resource, result.summaryPatch);
|
|
387
454
|
if (summaryError) {
|
|
388
455
|
throw new PhiTableProviderError("invalid-summary-patch", summaryError);
|
|
@@ -451,37 +518,10 @@ export function usePhiTableBinding({ source, initialQuery = {}, externalQuery, f
|
|
|
451
518
|
}
|
|
452
519
|
}, [bindingError, provider, resolvedQuery.filters, resolvedQuery.sorts, resource, revalidate, source, updateMutationTargetPending]);
|
|
453
520
|
const executeAction = useCallback((request) => {
|
|
454
|
-
const
|
|
455
|
-
if (
|
|
456
|
-
|
|
457
|
-
|
|
458
|
-
return Promise.reject(actionError);
|
|
459
|
-
}
|
|
460
|
-
const hasRow = request.rowIdentity != null;
|
|
461
|
-
const hasSelection = (request.selectedRowIdentities?.length ?? 0) > 0;
|
|
462
|
-
if ((action.scope === "row" && !hasRow) || (action.scope === "selection" && !hasSelection)) {
|
|
463
|
-
const scopeError = new PhiTableProviderError("action-scope-invalid", `Table action "${request.actionKey}" requires ${action.scope} identity context.`);
|
|
464
|
-
setError(scopeError);
|
|
465
|
-
return Promise.reject(scopeError);
|
|
466
|
-
}
|
|
467
|
-
const value = request.actionValue;
|
|
468
|
-
const valueValid = action.valueType === undefined || action.valueType === "none"
|
|
469
|
-
? value === undefined || value === null
|
|
470
|
-
: action.valueType === "string"
|
|
471
|
-
? typeof value === "string"
|
|
472
|
-
: action.valueType === "number"
|
|
473
|
-
? typeof value === "number" && Number.isFinite(value)
|
|
474
|
-
: action.valueType === "boolean"
|
|
475
|
-
? typeof value === "boolean"
|
|
476
|
-
: action.valueType === "string[]"
|
|
477
|
-
? Array.isArray(value) && value.every((entry) => typeof entry === "string")
|
|
478
|
-
: action.valueType === "number[]"
|
|
479
|
-
? Array.isArray(value) && value.every((entry) => typeof entry === "number" && Number.isFinite(entry))
|
|
480
|
-
: isPhiRecord(value);
|
|
481
|
-
if (!valueValid) {
|
|
482
|
-
const valueError = new PhiTableProviderError("action-value-invalid", `Table action "${request.actionKey}" received an incompatible value.`);
|
|
483
|
-
setError(valueError);
|
|
484
|
-
return Promise.reject(valueError);
|
|
521
|
+
const requestError = checkPhiTableProviderActionRequest(resource, request);
|
|
522
|
+
if (requestError) {
|
|
523
|
+
setError(requestError);
|
|
524
|
+
return Promise.reject(requestError);
|
|
485
525
|
}
|
|
486
526
|
return runMutation(request, `action:${request.actionKey}:${String(request.rowIdentity ?? "")}:${(request.selectedRowIdentities ?? []).map(String).join(",")}`);
|
|
487
527
|
}, [resource, runMutation]);
|
|
@@ -568,6 +608,7 @@ export function usePhiTableBinding({ source, initialQuery = {}, externalQuery, f
|
|
|
568
608
|
query,
|
|
569
609
|
resolvedQuery,
|
|
570
610
|
setQuery,
|
|
611
|
+
changePage,
|
|
571
612
|
selectedRowIdentities,
|
|
572
613
|
setSelectedRowIdentities,
|
|
573
614
|
expandedRowIdentities,
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
import type { PhiTableFilterDefinition, PhiTableProviderFieldDefinition } from "../../../types/table-widget";
|
|
2
|
+
/**
|
|
3
|
+
* The choices of one Table filter, resolved the way a Form field resolves its own.
|
|
4
|
+
*
|
|
5
|
+
* A select filter takes its static `options`, or its field's, or one Options Provider binding -- its
|
|
6
|
+
* own or its field's. The options hook (`usePhiControlOptionsProvider`) is asked as `PhiFormControl`
|
|
7
|
+
* asks it: with what the person typed into the filter's search box, debounced and held to the declared
|
|
8
|
+
* minimum there, and with the value the filter holds as `selected`. So an Options Provider that answers
|
|
9
|
+
* one page of a longer list (`loadMode: "server"`, `search`) is searched by the route rather than inside
|
|
10
|
+
* the page it answered, and names a chosen value that is on no such page; the hook keeps the name a
|
|
11
|
+
* chosen value was last seen with while a search leaves it out.
|
|
12
|
+
*
|
|
13
|
+
* `onSearch` is there only where the source declares a search; without one the filter narrows what it
|
|
14
|
+
* holds, as before.
|
|
15
|
+
*/
|
|
16
|
+
export declare function usePhiTableFilterOptions({ filter, field, sourceConfig, value, }: {
|
|
17
|
+
filter: PhiTableFilterDefinition;
|
|
18
|
+
field?: PhiTableProviderFieldDefinition;
|
|
19
|
+
sourceConfig?: Record<string, unknown>;
|
|
20
|
+
/** What the filter holds now, as the Table's query holds it: one value, a list, or nothing. */
|
|
21
|
+
value: unknown;
|
|
22
|
+
}): {
|
|
23
|
+
options: import("@phis/contracts/controls").PhiControlOption<string | number>[];
|
|
24
|
+
warning: string | undefined;
|
|
25
|
+
onSearch: import("react").Dispatch<import("react").SetStateAction<string>> | undefined;
|
|
26
|
+
filterOptionsLocally: boolean;
|
|
27
|
+
};
|
|
@@ -0,0 +1,35 @@
|
|
|
1
|
+
"use client";
|
|
2
|
+
import { useState } from "react";
|
|
3
|
+
import { usePhiControlOptionsProvider } from "../../controls/phi-options-provider";
|
|
4
|
+
/**
|
|
5
|
+
* The choices of one Table filter, resolved the way a Form field resolves its own.
|
|
6
|
+
*
|
|
7
|
+
* A select filter takes its static `options`, or its field's, or one Options Provider binding -- its
|
|
8
|
+
* own or its field's. The options hook (`usePhiControlOptionsProvider`) is asked as `PhiFormControl`
|
|
9
|
+
* asks it: with what the person typed into the filter's search box, debounced and held to the declared
|
|
10
|
+
* minimum there, and with the value the filter holds as `selected`. So an Options Provider that answers
|
|
11
|
+
* one page of a longer list (`loadMode: "server"`, `search`) is searched by the route rather than inside
|
|
12
|
+
* the page it answered, and names a chosen value that is on no such page; the hook keeps the name a
|
|
13
|
+
* chosen value was last seen with while a search leaves it out.
|
|
14
|
+
*
|
|
15
|
+
* `onSearch` is there only where the source declares a search; without one the filter narrows what it
|
|
16
|
+
* holds, as before.
|
|
17
|
+
*/
|
|
18
|
+
export function usePhiTableFilterOptions({ filter, field, sourceConfig, value, }) {
|
|
19
|
+
const [searchDraft, setSearchDraft] = useState("");
|
|
20
|
+
const select = filter.type === "select" ? filter : null;
|
|
21
|
+
const fieldWithOptions = field?.type === "enum" || field?.type === "enum[]" ? field : null;
|
|
22
|
+
const resolved = usePhiControlOptionsProvider({
|
|
23
|
+
options: select && (select.options?.length ?? 0) > 0 ? select.options : fieldWithOptions?.options,
|
|
24
|
+
optionsProvider: select ? select.optionsProvider ?? fieldWithOptions?.optionsProvider : undefined,
|
|
25
|
+
sourceConfig,
|
|
26
|
+
searchDraft,
|
|
27
|
+
selectedValues: select ? value : undefined,
|
|
28
|
+
});
|
|
29
|
+
return {
|
|
30
|
+
options: resolved.options,
|
|
31
|
+
warning: resolved.warning,
|
|
32
|
+
onSearch: resolved.search.enabled ? setSearchDraft : undefined,
|
|
33
|
+
filterOptionsLocally: resolved.search.filterLocally,
|
|
34
|
+
};
|
|
35
|
+
}
|
|
@@ -6,7 +6,7 @@ import type { PhiAccountAreaEntry } from "../shell/shell-types";
|
|
|
6
6
|
* filtered by `canPhiViewerAccess` against its own `accessPolicy`.
|
|
7
7
|
*
|
|
8
8
|
* It must not re-derive visibility from base roles. That answered the question a second way and
|
|
9
|
-
* disagreed with the policies — a
|
|
9
|
+
* disagreed with the policies — a Maintainer holds `Structure authoring`, `Content editing` and
|
|
10
10
|
* `Accounting`, yet saw neither Builder nor Editor nor Accounting. And it must not consult
|
|
11
11
|
* `viewer.resolvedArea`, which ACCESS.md defines as a landing destination, not an authorization
|
|
12
12
|
* boundary; in the old menu it papered over the incomplete role check for one Area per viewer.
|
|
@@ -6,7 +6,7 @@ import { canPhiViewerAccess } from "../../types/access";
|
|
|
6
6
|
* filtered by `canPhiViewerAccess` against its own `accessPolicy`.
|
|
7
7
|
*
|
|
8
8
|
* It must not re-derive visibility from base roles. That answered the question a second way and
|
|
9
|
-
* disagreed with the policies — a
|
|
9
|
+
* disagreed with the policies — a Maintainer holds `Structure authoring`, `Content editing` and
|
|
10
10
|
* `Accounting`, yet saw neither Builder nor Editor nor Accounting. And it must not consult
|
|
11
11
|
* `viewer.resolvedArea`, which ACCESS.md defines as a landing destination, not an authorization
|
|
12
12
|
* boundary; in the old menu it papered over the incomplete role check for one Area per viewer.
|
|
@@ -34,4 +34,14 @@ export type PhiRenderedValueLabels = {
|
|
|
34
34
|
* it could not have simply called the table's renderer.
|
|
35
35
|
*/
|
|
36
36
|
export type PhiRenderedValuePresentation = "cell" | "block";
|
|
37
|
+
/**
|
|
38
|
+
* What stands ahead of a value: a named icon (`iconFieldKey`) and a picture (`imageFieldKey`), read off
|
|
39
|
+
* the same row. A name and the mark standing for it read as one thing, not as two columns that happen to
|
|
40
|
+
* be adjacent. Neither there, the value is returned as it was.
|
|
41
|
+
*/
|
|
42
|
+
export type PhiRenderedValueLead = {
|
|
43
|
+
icon?: unknown;
|
|
44
|
+
image?: unknown;
|
|
45
|
+
};
|
|
46
|
+
export declare function renderPhiValueWithLead(content: ReactNode, lead: PhiRenderedValueLead): ReactNode;
|
|
37
47
|
export declare function renderPhiValueContent(value: unknown, definition: PhiRenderedValueDefinition, labels: PhiRenderedValueLabels, presentation?: PhiRenderedValuePresentation): ReactNode;
|
|
@@ -1,7 +1,8 @@
|
|
|
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 { formatPhisMoney } from "@phis/contracts/payments";
|
|
4
4
|
import { formatPhiDate, formatPhiDateTime } from "../../../../helpers/format-date-time";
|
|
5
|
+
import { readPhiInternalPath } from "../../../../helpers/internal-path";
|
|
5
6
|
import { readPhiMoneyValue } from "../../../../helpers/money-amount";
|
|
6
7
|
import { formatPhiInterval, readPhiIntervalValue } from "../../label-types/interval";
|
|
7
8
|
import { usePhiIntlLocale, usePhiIntlTimeZone } from "../../../root/phi-intl-locale";
|
|
@@ -10,6 +11,7 @@ import { PhiTagControl } from "../../../controls/phi-tag-control";
|
|
|
10
11
|
import { PhiTypographyControl } from "../../../controls/phi-typography-control";
|
|
11
12
|
import { PhiLink } from "../../../navigation/phi-link";
|
|
12
13
|
import { PhiIcon } from "../../../shell/phi-icon";
|
|
14
|
+
import { usePhiConfig } from "../../../root/phi-config-provider";
|
|
13
15
|
import { isPhiRecord } from "../../../../helpers/is-record";
|
|
14
16
|
/**
|
|
15
17
|
* **A flag being read is a mark, not a switch.**
|
|
@@ -46,6 +48,50 @@ function PhiRenderedDate({ value, withTime }) {
|
|
|
46
48
|
function PhiRenderedMoney({ value }) {
|
|
47
49
|
return formatPhisMoney(value, usePhiIntlLocale());
|
|
48
50
|
}
|
|
51
|
+
/**
|
|
52
|
+
* The square a picture is drawn in, in a cell and in a record alike: a line of a list. The server's `icon`
|
|
53
|
+
* variant is 64 x 64, two device pixels for each of these on a high-density screen.
|
|
54
|
+
*/
|
|
55
|
+
const PHI_RENDERED_IMAGE_SIZE = 32;
|
|
56
|
+
/**
|
|
57
|
+
* **A picture in a list is the address the server answered, drawn as it is.**
|
|
58
|
+
*
|
|
59
|
+
* The value is a Site-relative address that already names a variant cut to size and carries its cache
|
|
60
|
+
* revision, so the browser loads it once and keeps it; anything else -- an absolute address, another
|
|
61
|
+
* host, an Asset id -- draws nothing, so a Provider cannot make a list load pictures from elsewhere. A
|
|
62
|
+
* plain `<img>` and not `next/image`: the variant is already the size it is shown at, and the optimiser
|
|
63
|
+
* would fetch it again without the reader's session and cut it a second time. Lazy and decoded off the
|
|
64
|
+
* main thread, because a page of a hundred rows holds a hundred of them.
|
|
65
|
+
*
|
|
66
|
+
* The `alt` is empty: in a list the picture stands beside the name it belongs to -- ahead of the value it
|
|
67
|
+
* illustrates, or in a column whose heading says what it is, with the row's name in its own cell --
|
|
68
|
+
* so it is decorative, and a screen reader that read a name again for it would read every row twice.
|
|
69
|
+
* Fitted whole, never cropped: an icon or a logo that loses an edge is another mark. The corner is the
|
|
70
|
+
* small step of the scale, as for any element inside a surface (THEME.md, "Control shape").
|
|
71
|
+
*/
|
|
72
|
+
function PhiRenderedImage({ address }) {
|
|
73
|
+
const { token } = usePhiConfig();
|
|
74
|
+
return (_jsx("img", { alt: "", src: address, width: PHI_RENDERED_IMAGE_SIZE, height: PHI_RENDERED_IMAGE_SIZE, loading: "lazy", decoding: "async", style: {
|
|
75
|
+
display: "block",
|
|
76
|
+
flexShrink: 0,
|
|
77
|
+
width: PHI_RENDERED_IMAGE_SIZE,
|
|
78
|
+
height: PHI_RENDERED_IMAGE_SIZE,
|
|
79
|
+
objectFit: "contain",
|
|
80
|
+
borderRadius: token.borderRadiusSM,
|
|
81
|
+
} }));
|
|
82
|
+
}
|
|
83
|
+
/** The picture an address names, or nothing for a value that is no address on this Site. */
|
|
84
|
+
function renderPhiImage(value) {
|
|
85
|
+
const address = readPhiInternalPath(value);
|
|
86
|
+
return address ? _jsx(PhiRenderedImage, { address: address }) : null;
|
|
87
|
+
}
|
|
88
|
+
export function renderPhiValueWithLead(content, lead) {
|
|
89
|
+
const icon = typeof lead.icon === "string" && lead.icon.trim() ? _jsx(PhiIcon, { name: lead.icon }) : null;
|
|
90
|
+
const image = renderPhiImage(lead.image);
|
|
91
|
+
if (!icon && !image)
|
|
92
|
+
return content;
|
|
93
|
+
return (_jsxs(PhiFlexControl, { align: "center", gap: 6, style: { display: "inline-flex" }, children: [image, icon, content] }));
|
|
94
|
+
}
|
|
49
95
|
export function renderPhiValueContent(value, definition, labels, presentation = "cell") {
|
|
50
96
|
if (value == null || value === "")
|
|
51
97
|
return null;
|
|
@@ -61,6 +107,8 @@ export function renderPhiValueContent(value, definition, labels, presentation =
|
|
|
61
107
|
const interval = readPhiIntervalValue(value);
|
|
62
108
|
return interval ? formatPhiInterval(interval, labels.interval) : null;
|
|
63
109
|
}
|
|
110
|
+
if (definition.renderer === "image")
|
|
111
|
+
return renderPhiImage(value);
|
|
64
112
|
const normalizedValue = normalizePhiRenderedText(value);
|
|
65
113
|
const displayValue = definition.valueMap?.[normalizedValue] ?? normalizedValue;
|
|
66
114
|
if (definition.renderer === "email" || definition.renderer === "link") {
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { type ComponentType, type ReactNode } from "react";
|
|
2
2
|
import { type PhiRuntimeDataProviderKey } from "../../../../types/runtime-data-provider";
|
|
3
|
-
import type
|
|
3
|
+
import { type PhiTableProviderMutationRequest, type PhiTableProviderMutationResult, type PhiTableProviderRecordRequest, type PhiTableProviderQueryRequest, type PhiTableProviderQueryResult, type PhiTableProviderResourceDescriptor } from "../../../../types/table-widget";
|
|
4
4
|
import type { PhiProviderResourceSource } from "../../../../types/runtime-data-provider";
|
|
5
5
|
export type PhiTableProviderRegistration = {
|
|
6
6
|
key: PhiRuntimeDataProviderKey;
|
|
@@ -24,3 +24,12 @@ export declare function usePhiTableProvider(source: PhiProviderResourceSource |
|
|
|
24
24
|
resource: PhiTableProviderResourceDescriptor | null;
|
|
25
25
|
bindingError: string | null;
|
|
26
26
|
};
|
|
27
|
+
/** A mutation as a Widget states it: the source it is bound to adds the resource, its params and the abort. */
|
|
28
|
+
export type PhiTableProviderMutationInput<TRequest extends PhiTableProviderMutationRequest = PhiTableProviderMutationRequest> = TRequest extends unknown ? Omit<TRequest, "resourceKey" | "params" | "signal"> : never;
|
|
29
|
+
/**
|
|
30
|
+
* One mutation through a bound source's Provider Client, and its answer read strictly: a Provider without
|
|
31
|
+
* `mutate` is read-only, and an answer outside `PhiTableProviderMutationResult` is the Provider's failure,
|
|
32
|
+
* not an accepted change. What the answer then means for what is on screen -- rows patched, a view read
|
|
33
|
+
* again, a dialog closed -- is the caller's: the Table's Binding and the record Widget both ask here.
|
|
34
|
+
*/
|
|
35
|
+
export declare function requestPhiTableProviderMutation(provider: PhiTableProviderRegistration, source: PhiProviderResourceSource, request: PhiTableProviderMutationInput, signal: AbortSignal): Promise<PhiTableProviderMutationResult>;
|
|
@@ -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";
|