@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.
Files changed (124) hide show
  1. package/components/controls/phi-form-control.d.ts +3 -1
  2. package/components/controls/phi-form-control.js +5 -4
  3. package/components/controls/phi-options-provider.d.ts +14 -1
  4. package/components/controls/phi-options-provider.js +73 -2
  5. package/components/forms/auth-admin-settings-labels.d.ts +1 -1
  6. package/components/forms/auth-admin-settings-labels.js +2 -2
  7. package/components/forms/form-descriptor-contract.d.ts +1 -1
  8. package/components/forms/form-descriptor-contract.js +1 -1
  9. package/components/forms/form-descriptor-runtime-client.d.ts +4 -1
  10. package/components/forms/form-descriptor-runtime-client.js +33 -11
  11. package/components/forms/form-media-limits.d.ts +12 -0
  12. package/components/forms/form-media-limits.js +14 -0
  13. package/components/forms/form-provider-registry.d.ts +8 -0
  14. package/components/forms/form-record-title.d.ts +14 -0
  15. package/components/forms/form-record-title.js +38 -0
  16. package/components/forms/form-widget-config.d.ts +3 -0
  17. package/components/forms/form-widget-config.js +2 -0
  18. package/components/forms/phi-form-widget.d.ts +1 -1
  19. package/components/forms/phi-form-widget.js +4 -0
  20. package/components/overlays/phi-overlay-container-client.js +8 -8
  21. package/components/overlays/phi-overlay-title.d.ts +7 -0
  22. package/components/overlays/phi-overlay-title.js +21 -0
  23. package/components/tables/client/phi-table-binding.d.ts +3 -1
  24. package/components/tables/client/phi-table-binding.js +90 -49
  25. package/components/tables/client/phi-table-filter-options.d.ts +27 -0
  26. package/components/tables/client/phi-table-filter-options.js +35 -0
  27. package/components/widgets/accessible-areas.d.ts +1 -1
  28. package/components/widgets/accessible-areas.js +1 -1
  29. package/components/widgets/client/shared/phi-choice-controller.js +22 -15
  30. package/components/widgets/client/shared/phi-rendered-value.d.ts +10 -0
  31. package/components/widgets/client/shared/phi-rendered-value.js +49 -1
  32. package/components/widgets/client/shared/phi-table-provider.d.ts +10 -1
  33. package/components/widgets/client/shared/phi-table-provider.js +22 -0
  34. package/components/widgets/label-sets/admin-users.d.ts +15 -0
  35. package/components/widgets/label-sets/admin-users.js +31 -0
  36. package/constants/core-data-provider-keys.d.ts +7 -0
  37. package/constants/core-data-provider-keys.js +7 -0
  38. package/constants/phi-base-role-metadata.d.ts +2 -2
  39. package/constants/phi-base-role-metadata.js +1 -1
  40. package/constants/runtime-module-ownership.js +3 -0
  41. package/forms.d.ts +1 -1
  42. package/forms.js +1 -1
  43. package/gateway/capability-media-limits.d.ts +10 -0
  44. package/gateway/capability-media-limits.js +40 -0
  45. package/gateway/server-capabilities.js +4 -0
  46. package/helpers/preset-tree-contract-check.d.ts +3 -2
  47. package/helpers/preset-tree-contract-check.js +60 -0
  48. package/helpers/record-title.d.ts +7 -0
  49. package/helpers/record-title.js +25 -0
  50. package/helpers/record-widget.d.ts +15 -0
  51. package/helpers/record-widget.js +57 -0
  52. package/package.json +2 -2
  53. package/plugins/runtime-modules/accounting/client-data-providers.d.ts +7 -0
  54. package/plugins/runtime-modules/accounting/client-data-providers.js +9 -0
  55. package/plugins/runtime-modules/accounting/data-providers.d.ts +63 -0
  56. package/plugins/runtime-modules/accounting/data-providers.js +127 -0
  57. package/plugins/runtime-modules/accounting/definition.d.ts +54 -2
  58. package/plugins/runtime-modules/accounting/definition.js +5 -3
  59. package/plugins/runtime-modules/accounting/ids.d.ts +20 -0
  60. package/plugins/runtime-modules/accounting/ids.js +27 -0
  61. package/plugins/runtime-modules/accounting/module.d.ts +52 -0
  62. package/plugins/runtime-modules/accounting/presets.js +23 -4
  63. package/plugins/runtime-modules/accounting/services/products-table.d.ts +93 -0
  64. package/plugins/runtime-modules/accounting/services/products-table.js +158 -0
  65. package/plugins/runtime-modules/accounting/trees/accounting-products-label-set.d.ts +86 -0
  66. package/plugins/runtime-modules/accounting/trees/accounting-products-label-set.js +123 -0
  67. package/plugins/runtime-modules/accounting/trees/phi-default-accounting-products-page-tree.d.ts +21 -0
  68. package/plugins/runtime-modules/accounting/trees/phi-default-accounting-products-page-tree.js +435 -0
  69. package/plugins/runtime-modules/area-definitions.js +2 -2
  70. package/plugins/runtime-modules/asset/media-asset-field.d.ts +15 -0
  71. package/plugins/runtime-modules/asset/media-asset-field.js +21 -0
  72. package/plugins/runtime-modules/asset/media-asset-form-control.d.ts +4 -0
  73. package/plugins/runtime-modules/asset/media-asset-form-control.js +10 -5
  74. package/plugins/runtime-modules/asset/media-assets-field.d.ts +8 -0
  75. package/plugins/runtime-modules/asset/media-assets-field.js +10 -0
  76. package/plugins/runtime-modules/asset/media-assets-form-control.d.ts +5 -0
  77. package/plugins/runtime-modules/asset/media-assets-form-control.js +15 -6
  78. package/plugins/runtime-modules/auth/admin-settings-forms.js +1 -1
  79. package/plugins/runtime-modules/builder/clients/inspector-config-field.js +11 -6
  80. package/plugins/runtime-modules/client-manifests/accounting.js +5 -1
  81. package/plugins/runtime-modules/core/cards.js +2 -2
  82. package/plugins/runtime-modules/core/client-data-providers.js +5 -0
  83. package/plugins/runtime-modules/core/data-providers.js +14 -0
  84. package/plugins/runtime-modules/core/services/site-members-options.d.ts +27 -0
  85. package/plugins/runtime-modules/core/services/site-members-options.js +55 -0
  86. package/plugins/runtime-modules/core/widgets/cascader/client.js +13 -12
  87. package/plugins/runtime-modules/core/widgets/checkbox-group/client.js +5 -4
  88. package/plugins/runtime-modules/core/widgets/form/config.d.ts +5 -0
  89. package/plugins/runtime-modules/core/widgets/form/config.js +3 -0
  90. package/plugins/runtime-modules/core/widgets/multi-select/client.js +6 -4
  91. package/plugins/runtime-modules/core/widgets/record/actions.d.ts +20 -0
  92. package/plugins/runtime-modules/core/widgets/record/actions.js +77 -0
  93. package/plugins/runtime-modules/core/widgets/record/client.js +71 -8
  94. package/plugins/runtime-modules/core/widgets/record/config.d.ts +66 -1
  95. package/plugins/runtime-modules/core/widgets/record/config.js +71 -2
  96. package/plugins/runtime-modules/core/widgets/table/client.js +33 -29
  97. package/plugins/runtime-modules/core/widgets/table/config.js +5 -1
  98. package/plugins/runtime-modules/groups/data-providers.js +1 -1
  99. package/plugins/runtime-modules/groups/definition.js +1 -1
  100. package/plugins/runtime-modules/groups/page-visibility.d.ts +1 -1
  101. package/plugins/runtime-modules/groups/page-visibility.js +1 -1
  102. package/plugins/runtime-modules/groups/presets.js +1 -1
  103. package/plugins/runtime-modules/groups/services/options.js +1 -1
  104. package/plugins/runtime-modules/groups/services/table.js +1 -1
  105. package/plugins/runtime-modules/groups/trees/phi-default-app-groups-page-tree.js +2 -2
  106. package/plugins/runtime-modules/user-management/addon-roles.d.ts +60 -4
  107. package/plugins/runtime-modules/user-management/addon-roles.js +92 -8
  108. package/plugins/runtime-modules/user-management/addresses.d.ts +1 -1
  109. package/plugins/runtime-modules/user-management/controller/client.js +1 -1
  110. package/plugins/runtime-modules/user-management/data-providers.js +1 -0
  111. package/plugins/runtime-modules/user-management/forms.js +22 -0
  112. package/plugins/runtime-modules/user-management/presets.js +2 -2
  113. package/plugins/runtime-modules/user-management/services/options.d.ts +4 -0
  114. package/plugins/runtime-modules/user-management/services/options.js +14 -6
  115. package/plugins/runtime-modules/user-management/services/table.js +12 -3
  116. package/plugins/runtime-modules/user-management/trees/phi-default-admin-users-page-tree.js +9 -4
  117. package/types/access.d.ts +1 -1
  118. package/types/access.js +7 -7
  119. package/types/core-widget-placements.d.ts +7 -0
  120. package/types/form-descriptor.d.ts +1 -1
  121. package/types/record-widget.d.ts +35 -0
  122. package/types/server-capabilities.d.ts +1 -1
  123. package/types/table-widget.d.ts +20 -0
  124. package/types/table-widget.js +44 -0
@@ -18,6 +18,7 @@ import { PhiDrawerControl } from "../controls/phi-drawer-control";
18
18
  import { PhiAlertControl } from "../controls/phi-alert-control";
19
19
  import { usePhiOverlayZonesLoaderIfAny } from "./phi-overlay-zones-loader";
20
20
  import { PhiDialogBodyProvider } from "./phi-dialog-body-context";
21
+ import { usePhiOverlayTitle } from "./phi-overlay-title";
21
22
  import { usePhiPathname } from "../runtime/use-phi-pathname";
22
23
  function renderOverlayZonesFailure(failure) {
23
24
  return (_jsx(PhiAlertControl, { level: "error", title: "This content could not be shown.", description: failure }));
@@ -59,7 +60,7 @@ export function PhiOverlayContainerClient({ overlayId, overlayType, config: rawC
59
60
  const [hasOpened, setHasOpened] = useState(false);
60
61
  const [runtimeControlSizeOverride, setRuntimeControlSizeOverride] = useState(null);
61
62
  const [runtimeSizeOverride, setRuntimeSizeOverride] = useState(null);
62
- const [runtimeTitleOverride, setRuntimeTitleOverride] = useState(null);
63
+ const { title: runtimeTitle, tell: tellTitle, forget: forgetTitle } = usePhiOverlayTitle(config);
63
64
  /*
64
65
  * Whether work the Overlay holds is under way -- a Form in the Body saving. While it is, a reader's
65
66
  * dismissal (close button, mask, Escape) is not taken: closing would abandon the save's answer. A
@@ -73,9 +74,6 @@ export function PhiOverlayContainerClient({ overlayId, overlayType, config: rawC
73
74
  const runtimeSize = runtimeSizeOverride?.config === config
74
75
  ? runtimeSizeOverride.value
75
76
  : null;
76
- const runtimeTitle = runtimeTitleOverride?.config === config
77
- ? runtimeTitleOverride.value
78
- : config.title;
79
77
  const emittedOpenRef = useRef(false);
80
78
  const openedAtPathname = useRef(null);
81
79
  const pathname = usePhiPathname();
@@ -116,8 +114,11 @@ export function PhiOverlayContainerClient({ overlayId, overlayType, config: rawC
116
114
  // A closed Overlay holds no work; a busy state left behind would refuse the next dismissal.
117
115
  if (!nextOpen)
118
116
  setBusy(false);
117
+ // Nor a title told for the opening that ends: the next one starts from its own (`usePhiOverlayTitle`).
118
+ if (!nextOpen)
119
+ forgetTitle();
119
120
  setOpen(nextOpen);
120
- }, []);
121
+ }, [forgetTitle]);
121
122
  /*
122
123
  * The zones of a deferred Overlay, asked for when it opens and kept afterwards.
123
124
  *
@@ -217,8 +218,7 @@ export function PhiOverlayContainerClient({ overlayId, overlayType, config: rawC
217
218
  updateOpen(typeof signal.value === "boolean" ? signal.value : !open);
218
219
  }
219
220
  else if (route.capabilityId === "title" && signal.valueType === "string") {
220
- const nextTitle = typeof signal.value === "string" ? signal.value.trim() : "";
221
- setRuntimeTitleOverride({ config, value: nextTitle || null });
221
+ tellTitle(signal.value);
222
222
  }
223
223
  else if (route.capabilityId === "controlSize" && overlayType === "modal") {
224
224
  const nextControlSize = readPhiControlSize(signal.value);
@@ -237,7 +237,7 @@ export function PhiOverlayContainerClient({ overlayId, overlayType, config: rawC
237
237
  if (nextSize)
238
238
  setRuntimeSizeOverride({ config, value: nextSize });
239
239
  }
240
- }, [config, listenRoutes, open, overlayType, receiver, updateOpen]), useMemo(() => ({
240
+ }, [config, listenRoutes, open, overlayType, receiver, tellTitle, updateOpen]), useMemo(() => ({
241
241
  scopes: [signalScope],
242
242
  receiver,
243
243
  }), [receiver, signalScope]), receiver);
@@ -0,0 +1,7 @@
1
+ export declare function usePhiOverlayTitle<TConfig extends {
2
+ title: string | null;
3
+ }>(config: TConfig): {
4
+ title: string | null;
5
+ tell: (value: unknown) => void;
6
+ forget: () => void;
7
+ };
@@ -0,0 +1,21 @@
1
+ import { useCallback, useState } from "react";
2
+ /*
3
+ * The title an Overlay shows: the one its config states, or one it was told on its `title` input.
4
+ *
5
+ * A told title stands for the opening it was told for: closing forgets it, so the next opening -- for
6
+ * another row, with a Form that has not read that row yet -- starts from the Overlay's own title rather
7
+ * than from the last row's name. A title told while the Overlay is closed is for the opening that comes
8
+ * next, which is how a Controller names the mode it is about to open in. An empty title is no title:
9
+ * the Overlay shows its own again, which is what a Form answers for a record that has no value to name
10
+ * it by. A changed config, or a remount, starts from the config's title as well.
11
+ */
12
+ export function usePhiOverlayTitle(config) {
13
+ const [told, setTold] = useState(null);
14
+ const title = told?.config === config ? told.value : config.title;
15
+ const tell = useCallback((value) => {
16
+ const next = typeof value === "string" ? value.trim() : "";
17
+ setTold(next ? { config, value: next } : null);
18
+ }, [config]);
19
+ const forget = useCallback(() => setTold(null), []);
20
+ return { title, tell, forget };
21
+ }
@@ -1,8 +1,9 @@
1
1
  import type { PhiTableProviderActionMutationRequest, PhiTableProviderDropMutationRequest, PhiTableProviderFieldMutationRequest, PhiTableProviderMutationRequest, PhiTableProviderMutationResult, PhiTableProviderQueryResult, PhiTableProviderResourceDescriptor, PhiTableProviderRowMoveMutationRequest, PhiTableProviderRowPatchMutationRequest, PhiTableQuery, PhiTableQueryValue, PhiTableRowIdentity, PhiTableSummaryValue } from "../../../types/table-widget";
2
2
  import type { PhiProviderResourceSource } from "../../../types/runtime-data-provider";
3
3
  import { PhiTableProviderError } from "../../../types/table-widget";
4
+ import { type PhiTableProviderMutationInput } from "../../widgets/client/shared/phi-table-provider";
4
5
  type TableRow = Record<string, unknown>;
5
- type MutationInput<TRequest extends PhiTableProviderMutationRequest> = TRequest extends unknown ? Omit<TRequest, "resourceKey" | "params" | "signal"> : never;
6
+ type MutationInput<TRequest extends PhiTableProviderMutationRequest> = PhiTableProviderMutationInput<TRequest>;
6
7
  export type PhiTableBindingInput = {
7
8
  source: PhiProviderResourceSource | null;
8
9
  initialQuery?: PhiTableQuery;
@@ -32,6 +33,7 @@ export declare function usePhiTableBinding({ source, initialQuery, externalQuery
32
33
  query: PhiTableQuery;
33
34
  resolvedQuery: PhiTableQuery;
34
35
  setQuery: import("react").Dispatch<import("react").SetStateAction<PhiTableQuery>>;
36
+ changePage: (page: number, pageSize: number) => void;
35
37
  selectedRowIdentities: readonly PhiTableRowIdentity[];
36
38
  setSelectedRowIdentities: import("react").Dispatch<import("react").SetStateAction<readonly PhiTableRowIdentity[]>>;
37
39
  expandedRowIdentities: readonly PhiTableRowIdentity[];
@@ -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, readPhiTableProviderMutationResult, readPhiTableProviderQueryResult, validatePhiTableProviderFieldValue, } from "../../../types/table-widget";
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
- const applyData = useCallback((data) => {
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
- const pageSize = data.pageSize ?? resolvedQuery.pageSize;
222
- setHasMore(data.nextCursor != null || (data.total == null && pageSize != null && data.rows.length >= pageSize));
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 rawResult = await provider.mutate({
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 action = resource?.actions?.find((candidate) => candidate.key === request.actionKey);
455
- if (!action) {
456
- const actionError = new PhiTableProviderError("action-not-declared", `Table action "${request.actionKey}" is not declared by resource "${resource?.resourceKey ?? "unknown"}".`);
457
- setError(actionError);
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 Developer holds `Structure authoring`, `Content editing` and
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 Developer holds `Structure authoring`, `Content editing` and
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.
@@ -7,18 +7,26 @@ import { isPhiStackSignalMessage, PHI_STACK_META_SIGNAL_CHANNEL, readPhiStackSig
7
7
  import { usePhiSignalListener } from "../../../runtime/runtime-signal-bus";
8
8
  import { usePhiControlSignalController } from "./phi-control-signals";
9
9
  import { usePhiControlOptionsProvider } from "../../../controls/phi-options-provider";
10
+ /**
11
+ * What a choice holds, as far as known before its options resolve: a configured value is the fallback a
12
+ * pick holds against. Without one the fallback is the provider's own answer, so only a pick is told.
13
+ */
14
+ function readPhiChoiceHeldValue(picked, configuredValue) {
15
+ if (configuredValue == null)
16
+ return picked?.value;
17
+ return picked?.source === configuredValue ? picked.value : configuredValue;
18
+ }
10
19
  export function usePhiChoiceController({ config, signalsEnabled = true, typeKey, defaultKey, sender, }) {
20
+ // A pick, held against the fallback it replaced; declared first so the provider hears it.
21
+ const [picked, setPicked] = useState(null);
11
22
  const resolvedOptions = usePhiControlOptionsProvider({
12
23
  options: config?.options,
13
24
  optionsProvider: config?.optionsProvider,
25
+ selectedValues: readPhiChoiceHeldValue(picked, config?.value),
14
26
  });
15
27
  const fallbackValue = config?.value ?? resolvedOptions.value ?? resolvedOptions.options.at(0)?.value ?? "";
16
28
  const readOnly = config?.readOnly === true;
17
- const [state, setState] = useState(() => ({
18
- source: fallbackValue,
19
- value: fallbackValue,
20
- }));
21
- const value = state.source === fallbackValue ? state.value : fallbackValue;
29
+ const value = picked?.source === fallbackValue ? picked.value : fallbackValue;
22
30
  /*
23
31
  * Options a sender replaced, held against the configured list they replaced. When the configuration
24
32
  * brings a different list, that one is what the Control was given last, so the sent one steps aside.
@@ -38,7 +46,7 @@ export function usePhiChoiceController({ config, signalsEnabled = true, typeKey,
38
46
  initialDisabled: config?.disabled === true,
39
47
  initialReadOnly: readOnly,
40
48
  clearValue: fallbackValue,
41
- onSetValue: (nextValue) => setState({ source: fallbackValue, value: nextValue }),
49
+ onSetValue: (nextValue) => setPicked({ source: fallbackValue, value: nextValue }),
42
50
  onReceiveCapability: (capabilityId, signal) => {
43
51
  if (capabilityId !== "options") {
44
52
  return false;
@@ -55,7 +63,7 @@ export function usePhiChoiceController({ config, signalsEnabled = true, typeKey,
55
63
  if (readOnly) {
56
64
  return;
57
65
  }
58
- setState({
66
+ setPicked({
59
67
  source: fallbackValue,
60
68
  value: nextValue,
61
69
  });
@@ -84,19 +92,18 @@ function mapPhiStackSlotsToChoiceOptions(message) {
84
92
  }));
85
93
  }
86
94
  export function usePhiStackChoiceController({ config, signalsEnabled = true, typeKey, defaultKey, sender, }) {
95
+ // A pick, held against the fallback it replaced; declared first so the provider hears it.
96
+ const [picked, setPicked] = useState(null);
87
97
  const resolvedOptions = usePhiControlOptionsProvider({
88
98
  options: config?.options,
89
99
  optionsProvider: config?.optionsProvider,
100
+ selectedValues: readPhiChoiceHeldValue(picked, config?.value),
90
101
  });
91
102
  const stackMode = config?.valueMode === "stack-slot-index";
92
103
  const fallbackValue = config?.value ?? resolvedOptions.value ?? resolvedOptions.options.at(0)?.value ?? "";
93
104
  const readOnly = config?.readOnly === true;
94
- const [state, setState] = useState(() => ({
95
- source: fallbackValue,
96
- value: fallbackValue,
97
- }));
98
105
  const [stackOptions, setStackOptions] = useState([]);
99
- const value = state.source === fallbackValue ? state.value : fallbackValue;
106
+ const value = picked?.source === fallbackValue ? picked.value : fallbackValue;
100
107
  const stackMetaListenRoute = findPhiSignalRoutesByCapabilityId(config?.signalRoutes?.listens, "stackMeta")[0] ?? null;
101
108
  /*
102
109
  * The Stack this Choice follows: the one its `stackMeta` request is addressed to. Every Stack answers
@@ -114,7 +121,7 @@ export function usePhiStackChoiceController({ config, signalsEnabled = true, typ
114
121
  initialDisabled: config?.disabled === true,
115
122
  initialReadOnly: readOnly,
116
123
  clearValue: fallbackValue,
117
- onSetValue: (nextValue) => setState({ source: fallbackValue, value: nextValue }),
124
+ onSetValue: (nextValue) => setPicked({ source: fallbackValue, value: nextValue }),
118
125
  coerceValue: (nextValue) => (typeof nextValue === "string" ? nextValue : nextValue == null ? "" : String(nextValue)),
119
126
  });
120
127
  const emitControlCapability = controlSignals.emitCapability;
@@ -140,7 +147,7 @@ export function usePhiStackChoiceController({ config, signalsEnabled = true, typ
140
147
  }
141
148
  setStackOptions(mapPhiStackSlotsToChoiceOptions(message) ?? []);
142
149
  const nextValue = String(message.value.activeSlotIndex);
143
- setState((current) => current.source === fallbackValue && current.value === nextValue
150
+ setPicked((current) => current?.source === fallbackValue && current.value === nextValue
144
151
  ? current
145
152
  : { source: fallbackValue, value: nextValue });
146
153
  }, useMemo(() => ({
@@ -151,7 +158,7 @@ export function usePhiStackChoiceController({ config, signalsEnabled = true, typ
151
158
  if (readOnly) {
152
159
  return;
153
160
  }
154
- setState({
161
+ setPicked({
155
162
  source: fallbackValue,
156
163
  value: nextValue,
157
164
  });
@@ -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 { PhiTableProviderMutationRequest, PhiTableProviderMutationResult, PhiTableProviderRecordRequest, PhiTableProviderQueryRequest, PhiTableProviderQueryResult, PhiTableProviderResourceDescriptor } from "../../../../types/table-widget";
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>;