@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.
Files changed (117) hide show
  1. package/components/controls/phi-form-control.d.ts +3 -1
  2. package/components/controls/phi-form-control.js +4 -4
  3. package/components/forms/auth-admin-settings-labels.d.ts +1 -1
  4. package/components/forms/auth-admin-settings-labels.js +2 -2
  5. package/components/forms/form-descriptor-contract.d.ts +1 -1
  6. package/components/forms/form-descriptor-contract.js +1 -1
  7. package/components/forms/form-descriptor-runtime-client.d.ts +4 -1
  8. package/components/forms/form-descriptor-runtime-client.js +33 -11
  9. package/components/forms/form-media-limits.d.ts +12 -0
  10. package/components/forms/form-media-limits.js +14 -0
  11. package/components/forms/form-provider-registry.d.ts +8 -0
  12. package/components/forms/form-record-title.d.ts +14 -0
  13. package/components/forms/form-record-title.js +38 -0
  14. package/components/forms/form-widget-config.d.ts +3 -0
  15. package/components/forms/form-widget-config.js +2 -0
  16. package/components/forms/phi-form-widget.d.ts +1 -1
  17. package/components/forms/phi-form-widget.js +4 -0
  18. package/components/overlays/phi-overlay-container-client.js +8 -8
  19. package/components/overlays/phi-overlay-title.d.ts +7 -0
  20. package/components/overlays/phi-overlay-title.js +21 -0
  21. package/components/tables/client/phi-table-binding.d.ts +3 -1
  22. package/components/tables/client/phi-table-binding.js +90 -49
  23. package/components/tables/client/phi-table-filter-options.d.ts +27 -0
  24. package/components/tables/client/phi-table-filter-options.js +35 -0
  25. package/components/widgets/accessible-areas.d.ts +1 -1
  26. package/components/widgets/accessible-areas.js +1 -1
  27. package/components/widgets/client/shared/phi-rendered-value.d.ts +10 -0
  28. package/components/widgets/client/shared/phi-rendered-value.js +49 -1
  29. package/components/widgets/client/shared/phi-table-provider.d.ts +10 -1
  30. package/components/widgets/client/shared/phi-table-provider.js +22 -0
  31. package/components/widgets/label-sets/admin-users.d.ts +15 -0
  32. package/components/widgets/label-sets/admin-users.js +31 -0
  33. package/constants/core-data-provider-keys.d.ts +7 -0
  34. package/constants/core-data-provider-keys.js +7 -0
  35. package/constants/phi-base-role-metadata.d.ts +2 -2
  36. package/constants/phi-base-role-metadata.js +1 -1
  37. package/constants/runtime-module-ownership.js +3 -0
  38. package/forms.d.ts +1 -1
  39. package/forms.js +1 -1
  40. package/gateway/capability-media-limits.d.ts +10 -0
  41. package/gateway/capability-media-limits.js +40 -0
  42. package/gateway/server-capabilities.js +4 -0
  43. package/helpers/preset-tree-contract-check.d.ts +3 -2
  44. package/helpers/preset-tree-contract-check.js +60 -0
  45. package/helpers/record-title.d.ts +7 -0
  46. package/helpers/record-title.js +25 -0
  47. package/helpers/record-widget.d.ts +15 -0
  48. package/helpers/record-widget.js +57 -0
  49. package/package.json +2 -2
  50. package/plugins/runtime-modules/accounting/client-data-providers.d.ts +7 -0
  51. package/plugins/runtime-modules/accounting/client-data-providers.js +9 -0
  52. package/plugins/runtime-modules/accounting/data-providers.d.ts +63 -0
  53. package/plugins/runtime-modules/accounting/data-providers.js +127 -0
  54. package/plugins/runtime-modules/accounting/definition.d.ts +54 -2
  55. package/plugins/runtime-modules/accounting/definition.js +5 -3
  56. package/plugins/runtime-modules/accounting/ids.d.ts +20 -0
  57. package/plugins/runtime-modules/accounting/ids.js +27 -0
  58. package/plugins/runtime-modules/accounting/module.d.ts +52 -0
  59. package/plugins/runtime-modules/accounting/presets.js +23 -4
  60. package/plugins/runtime-modules/accounting/services/products-table.d.ts +93 -0
  61. package/plugins/runtime-modules/accounting/services/products-table.js +158 -0
  62. package/plugins/runtime-modules/accounting/trees/accounting-products-label-set.d.ts +86 -0
  63. package/plugins/runtime-modules/accounting/trees/accounting-products-label-set.js +123 -0
  64. package/plugins/runtime-modules/accounting/trees/phi-default-accounting-products-page-tree.d.ts +21 -0
  65. package/plugins/runtime-modules/accounting/trees/phi-default-accounting-products-page-tree.js +435 -0
  66. package/plugins/runtime-modules/area-definitions.js +2 -2
  67. package/plugins/runtime-modules/asset/media-asset-field.d.ts +15 -0
  68. package/plugins/runtime-modules/asset/media-asset-field.js +21 -0
  69. package/plugins/runtime-modules/asset/media-asset-form-control.d.ts +4 -0
  70. package/plugins/runtime-modules/asset/media-asset-form-control.js +10 -5
  71. package/plugins/runtime-modules/asset/media-assets-field.d.ts +8 -0
  72. package/plugins/runtime-modules/asset/media-assets-field.js +10 -0
  73. package/plugins/runtime-modules/asset/media-assets-form-control.d.ts +5 -0
  74. package/plugins/runtime-modules/asset/media-assets-form-control.js +15 -6
  75. package/plugins/runtime-modules/auth/admin-settings-forms.js +1 -1
  76. package/plugins/runtime-modules/client-manifests/accounting.js +5 -1
  77. package/plugins/runtime-modules/core/cards.js +2 -2
  78. package/plugins/runtime-modules/core/client-data-providers.js +5 -0
  79. package/plugins/runtime-modules/core/data-providers.js +14 -0
  80. package/plugins/runtime-modules/core/services/site-members-options.d.ts +27 -0
  81. package/plugins/runtime-modules/core/services/site-members-options.js +55 -0
  82. package/plugins/runtime-modules/core/widgets/form/config.d.ts +5 -0
  83. package/plugins/runtime-modules/core/widgets/form/config.js +3 -0
  84. package/plugins/runtime-modules/core/widgets/record/actions.d.ts +20 -0
  85. package/plugins/runtime-modules/core/widgets/record/actions.js +77 -0
  86. package/plugins/runtime-modules/core/widgets/record/client.js +71 -8
  87. package/plugins/runtime-modules/core/widgets/record/config.d.ts +66 -1
  88. package/plugins/runtime-modules/core/widgets/record/config.js +71 -2
  89. package/plugins/runtime-modules/core/widgets/table/client.js +33 -29
  90. package/plugins/runtime-modules/core/widgets/table/config.js +5 -1
  91. package/plugins/runtime-modules/groups/data-providers.js +1 -1
  92. package/plugins/runtime-modules/groups/definition.js +1 -1
  93. package/plugins/runtime-modules/groups/page-visibility.d.ts +1 -1
  94. package/plugins/runtime-modules/groups/page-visibility.js +1 -1
  95. package/plugins/runtime-modules/groups/presets.js +1 -1
  96. package/plugins/runtime-modules/groups/services/options.js +1 -1
  97. package/plugins/runtime-modules/groups/services/table.js +1 -1
  98. package/plugins/runtime-modules/groups/trees/phi-default-app-groups-page-tree.js +2 -2
  99. package/plugins/runtime-modules/user-management/addon-roles.d.ts +60 -4
  100. package/plugins/runtime-modules/user-management/addon-roles.js +92 -8
  101. package/plugins/runtime-modules/user-management/addresses.d.ts +1 -1
  102. package/plugins/runtime-modules/user-management/controller/client.js +1 -1
  103. package/plugins/runtime-modules/user-management/data-providers.js +1 -0
  104. package/plugins/runtime-modules/user-management/forms.js +22 -0
  105. package/plugins/runtime-modules/user-management/presets.js +2 -2
  106. package/plugins/runtime-modules/user-management/services/options.d.ts +4 -0
  107. package/plugins/runtime-modules/user-management/services/options.js +14 -6
  108. package/plugins/runtime-modules/user-management/services/table.js +12 -3
  109. package/plugins/runtime-modules/user-management/trees/phi-default-admin-users-page-tree.js +9 -4
  110. package/types/access.d.ts +1 -1
  111. package/types/access.js +7 -7
  112. package/types/core-widget-placements.d.ts +7 -0
  113. package/types/form-descriptor.d.ts +1 -1
  114. package/types/record-widget.d.ts +35 -0
  115. package/types/server-capabilities.d.ts +1 -1
  116. package/types/table-widget.d.ts +20 -0
  117. package/types/table-widget.js +44 -0
@@ -1,5 +1,7 @@
1
1
  import { resolvePhiCmsWidgetPluginKey } from "../../../../../constants/cms-widget-types";
2
2
  import { readBoolean, readInteger, readString } from "../../../../../components/widgets/config/parser-primitives";
3
+ import { createPhiConfigReader } from "../../../../../components/widgets/config/strict-config-reader";
4
+ import { readPhiRecordWidgetTitleFromRecord } from "../../../../../helpers/record-widget";
3
5
  import { isPhiRuntimeDataProviderKey } from "../../../../../types/runtime-data-provider";
4
6
  import { PHI_SIGNAL_VALUE_SCHEMAS, readPhiSignalRouteSet } from "../../../../../types/signals";
5
7
  import { PHI_TABLE_TAG_VARIANTS, } from "../../../../../types/table-widget";
@@ -17,6 +19,7 @@ const PHI_RECORD_VALUE_RENDERERS = [
17
19
  "switch",
18
20
  "checkbox",
19
21
  "icon",
22
+ "image",
20
23
  "money",
21
24
  "interval",
22
25
  ];
@@ -59,12 +62,31 @@ function readRecordField(value) {
59
62
  full: readBoolean(value.full),
60
63
  };
61
64
  }
65
+ /** A required text: absent is as wrong as the wrong type, because the entry means nothing without it. */
66
+ function requireText(reader, key) {
67
+ return reader.string(key)?.trim() || reader.fail(key, "a text", reader.record[key]);
68
+ }
69
+ function readRecordAction(reader) {
70
+ const confirm = reader.object("confirm", (confirmReader) => ({
71
+ title: requireText(confirmReader, "title"),
72
+ description: confirmReader.string("description"),
73
+ okText: confirmReader.string("okText"),
74
+ cancelText: confirmReader.string("cancelText"),
75
+ }));
76
+ return {
77
+ key: requireText(reader, "key"),
78
+ mode: reader.oneOf("mode", ["normal", "danger"]) ?? "normal",
79
+ ...(confirm ? { confirm } : {}),
80
+ };
81
+ }
62
82
  function parsePhiRecordWidgetConfig(rawConfig) {
63
83
  const source = isPhiRecord(rawConfig.source) ? rawConfig.source : {};
64
84
  const providerKey = typeof source.providerKey === "string" ? source.providerKey : "";
65
85
  const resourceKey = readString(source.resourceKey)?.trim() ?? "";
66
86
  const presentation = isPhiRecord(rawConfig.presentation) ? rawConfig.presentation : {};
67
87
  const columns = readInteger(presentation.columns);
88
+ // Strict, as every newer key: an action stated wrong is the author's to correct, not to drop.
89
+ const reader = createPhiConfigReader(rawConfig);
68
90
  return {
69
91
  source: isPhiRuntimeDataProviderKey(providerKey) && resourceKey
70
92
  ? {
@@ -85,6 +107,8 @@ function parsePhiRecordWidgetConfig(rawConfig) {
85
107
  })
86
108
  : [],
87
109
  },
110
+ actions: reader.list("actions", readRecordAction) ?? [],
111
+ titleFromRecord: readPhiRecordWidgetTitleFromRecord(rawConfig.titleFromRecord),
88
112
  signalRoutes: readPhiSignalRouteSet(rawConfig.signalRoutes),
89
113
  };
90
114
  }
@@ -93,13 +117,22 @@ export const PHI_RECORD_WIDGET_DEFINITION = {
93
117
  pluginKey: resolvePhiCmsWidgetPluginKey("record"),
94
118
  typeKey: "record",
95
119
  title: "Record",
96
- description: "Shows one row of a Table Provider as named values, opened by a row action.",
120
+ description: "Shows one row of a Table Provider as named values, opened by a row action, and runs its Provider row actions on a press.",
97
121
  category: "data",
98
122
  tags: ["record", "detail", "data"],
99
123
  icon: "antd:profile",
100
124
  slotSizePolicy: "fill-inline",
101
125
  runtimeSignals: {
102
- emits: [],
126
+ emits: [
127
+ /*
128
+ * An action of `actions` went through on the record shown: which one, on which row. A dialog
129
+ * closes on it and the Table beside it reads again -- each a route of its own, `dialog/close:none`
130
+ * and `reload/activate:none`, which carry nothing of the value.
131
+ */
132
+ { id: "actionSuccess", action: "activate", valueType: "json", valueSchema: PHI_SIGNAL_VALUE_SCHEMAS.tableAction },
133
+ // The title the record gives the dialog, after every read (`titleFromRecord`), for the Overlay's `title`.
134
+ { id: "recordTitle", action: "change", valueType: "string" },
135
+ ],
103
136
  listens: [
104
137
  {
105
138
  id: "recordOpen",
@@ -109,6 +142,11 @@ export const PHI_RECORD_WIDGET_DEFINITION = {
109
142
  valueSchema: PHI_SIGNAL_VALUE_SCHEMAS.tableAction,
110
143
  },
111
144
  { id: "close", channel: "state", action: "change", valueType: "boolean" },
145
+ /*
146
+ * Run one of `actions` on the record shown: the value is the action's key, the words this command
147
+ * channel answers. A footer button sends it; the row is the one the Widget holds.
148
+ */
149
+ { id: "actionActivate", channel: "action", action: "activate", valueType: "string" },
112
150
  ],
113
151
  },
114
152
  fields: [
@@ -181,6 +219,7 @@ export const PHI_RECORD_WIDGET_DEFINITION = {
181
219
  { value: "switch", label: "Switch" },
182
220
  { value: "checkbox", label: "Checkbox" },
183
221
  { value: "icon", label: "Icon" },
222
+ { value: "image", label: "Image" },
184
223
  { value: "money", label: "Money" },
185
224
  { value: "interval", label: "Interval" },
186
225
  ],
@@ -204,10 +243,40 @@ export const PHI_RECORD_WIDGET_DEFINITION = {
204
243
  },
205
244
  ],
206
245
  },
246
+ {
247
+ key: "actions",
248
+ type: "collection",
249
+ presentation: "overlay",
250
+ label: "Actions",
251
+ description: "Provider row actions of the source, run on the record shown when their key arrives on action/activate.",
252
+ itemKeyField: "key",
253
+ itemLabelField: "key",
254
+ addLabel: "Add action",
255
+ emptyLabel: "No actions",
256
+ editLabel: "Edit actions",
257
+ defaultItem: { key: "action", mode: "normal" },
258
+ itemFields: [
259
+ { key: "key", type: "string", label: "Provider Action", required: true },
260
+ {
261
+ key: "mode",
262
+ type: "choice",
263
+ label: "Mode",
264
+ options: [
265
+ { value: "normal", label: "Normal" },
266
+ { value: "danger", label: "Danger" },
267
+ ],
268
+ },
269
+ { key: "confirm.title", type: "string", label: "Confirm Title" },
270
+ { key: "confirm.description", type: "string", label: "Confirm Description" },
271
+ { key: "confirm.okText", type: "string", label: "Confirm OK Text" },
272
+ { key: "confirm.cancelText", type: "string", label: "Confirm Cancel Text" },
273
+ ],
274
+ },
207
275
  ],
208
276
  defaultConfig: {
209
277
  source: null,
210
278
  openActionKey: "view",
279
+ actions: [],
211
280
  presentation: {
212
281
  appearance: "grid",
213
282
  columns: 2,
@@ -1,5 +1,5 @@
1
1
  "use client";
2
- import { jsx as _jsx, jsxs as _jsxs, Fragment as _Fragment } from "react/jsx-runtime";
2
+ import { Fragment as _Fragment, jsxs as _jsxs, jsx as _jsx } from "react/jsx-runtime";
3
3
  import { PHI_TABLE_WIDGET_DEFAULT_LABELS } from "../../../../../components/widgets/label-types/table";
4
4
  import { formatPhiTableWidgetLabel } from "../../../../../components/widgets/label-types/table";
5
5
  import { PhiNameControl } from "../../../../../components/controls/phi-name-control";
@@ -34,8 +34,9 @@ import { usePhiVisualAnchorParts } from "../../../../../components/runtime/runti
34
34
  import { usePhiApplicationFeedback } from "../../../../../components/runtime/use-phi-application-feedback";
35
35
  import { usePhiTableBinding } from "../../../../../components/tables/client/phi-table-binding";
36
36
  import { PhiTableBindingControl } from "../../../../../components/tables/client/phi-table-binding-control";
37
+ import { usePhiTableFilterOptions } from "../../../../../components/tables/client/phi-table-filter-options";
37
38
  import { clearPhiDataDragPayload, readPhiDataDragPayload } from "../../../../../components/runtime/client/phi-data-dnd";
38
- import { renderPhiValueContent } from "../../../../../components/widgets/client/shared/phi-rendered-value";
39
+ import { renderPhiValueContent, renderPhiValueWithLead, } from "../../../../../components/widgets/client/shared/phi-rendered-value";
39
40
  import { formatPhiTranslation } from "../../../../../helpers/translation-format";
40
41
  import { readPhiTableFilters, readPhiTableQuery, readPhiTableRowOptions, validatePhiTableWidgetBinding, } from "../../../../../types/table-widget";
41
42
  import { readPhiTableColumnOrderSignalValue, readPhiTableBindingParamsSignalValue, readPhiTableExpansionSignalValue, readPhiTableActionSignalValue, isPhiTableQueryValue, } from "../../../../../types/table-signal-values";
@@ -60,14 +61,10 @@ function formatTableActionTemplate(value, templateValue) {
60
61
  }
61
62
  function renderTableValue(value, column, row, labels) {
62
63
  const content = renderPhiValueContent(value, column, labels);
63
- if (!column.iconFieldKey) {
64
- return content;
65
- }
66
- const iconName = row?.[column.iconFieldKey];
67
- if (typeof iconName !== "string" || !iconName.trim()) {
68
- return content;
69
- }
70
- return (_jsxs(PhiFlexControl, { align: "center", gap: 6, style: { display: "inline-flex" }, children: [_jsx(PhiIcon, { name: iconName }), content] }));
64
+ return renderPhiValueWithLead(content, {
65
+ icon: column.iconFieldKey ? row?.[column.iconFieldKey] : undefined,
66
+ image: column.imageFieldKey ? row?.[column.imageFieldKey] : undefined,
67
+ });
71
68
  }
72
69
  function renderTableSummaryItem(item, value) {
73
70
  const renderedValue = value == null ? "—" : String(value);
@@ -120,11 +117,20 @@ function buildQueryFilters(filters, values) {
120
117
  else if ((typeof value === "string" && value !== "") ||
121
118
  typeof value === "boolean" ||
122
119
  (Array.isArray(value) && value.length > 0)) {
123
- result[filter.key] = Array.isArray(value) ? [...value] : value;
120
+ result[filter.key] = Array.isArray(value) ? value.slice() : value;
124
121
  }
125
122
  }
126
123
  return result;
127
124
  }
125
+ /** A multiple select filter's values, all of one kind as the query holds a list. */
126
+ function readTableFilterChoices(value) {
127
+ if (!Array.isArray(value))
128
+ return [];
129
+ const numbers = value.filter((entry) => typeof entry === "number" && Number.isFinite(entry));
130
+ return numbers.length > 0 && numbers.length === value.length
131
+ ? numbers
132
+ : value.filter((entry) => typeof entry === "string");
133
+ }
128
134
  function readTableFilterValue(filter, filters) {
129
135
  if (filter.type === "dateRange") {
130
136
  const start = filters?.[filter.startKey];
@@ -137,9 +143,10 @@ function readTableFilterValue(filter, filters) {
137
143
  const value = filters?.[filter.key];
138
144
  if (filter.type === "boolean")
139
145
  return typeof value === "boolean" ? value : undefined;
140
- if (filter.type === "select" && filter.multiple) {
141
- return Array.isArray(value) ? value.filter((entry) => typeof entry === "string") : [];
142
- }
146
+ if (filter.type === "select" && filter.multiple)
147
+ return readTableFilterChoices(value);
148
+ if (filter.type === "select" && typeof value === "number" && Number.isFinite(value))
149
+ return value;
143
150
  return typeof value === "string" ? value : undefined;
144
151
  }
145
152
  function updateTableQueryFilters(current, filter, value) {
@@ -159,9 +166,10 @@ function updateTableQueryFilters(current, filter, value) {
159
166
  return next;
160
167
  }
161
168
  if ((typeof value === "string" && value !== "") ||
169
+ (typeof value === "number" && Number.isFinite(value)) ||
162
170
  typeof value === "boolean" ||
163
171
  (Array.isArray(value) && value.length > 0)) {
164
- next[filter.key] = Array.isArray(value) ? [...value] : value;
172
+ next[filter.key] = Array.isArray(value) ? value.slice() : value;
165
173
  }
166
174
  else {
167
175
  delete next[filter.key];
@@ -310,7 +318,7 @@ export function PhiTableWidgetClient({ config: inputConfig, renderMode, external
310
318
  },
311
319
  validateResource,
312
320
  });
313
- const { resource, bindingError, contractError, rows, total, hasMore, summary, loading, error, queryError, query, resolvedQuery, setQuery, selectedRowIdentities, setSelectedRowIdentities, expandedRowIdentities, setExpandedRowIdentities, reload, executeAction, commitField, commitRow, isFieldMutationPending, moveRow, drop, } = binding;
321
+ const { resource, bindingError, contractError, rows, total, hasMore, summary, loading, error, queryError, query, resolvedQuery, setQuery, changePage, selectedRowIdentities, setSelectedRowIdentities, expandedRowIdentities, setExpandedRowIdentities, reload, executeAction, commitField, commitRow, isFieldMutationPending, moveRow, drop, } = binding;
314
322
  const toolbarActions = useMemo(() => resolveTableActions(features.actions?.toolbar, resource?.actions), [features.actions?.toolbar, resource?.actions]);
315
323
  const rowActions = useMemo(() => resolveTableActions(features.actions?.row, resource?.actions), [features.actions?.row, resource?.actions]);
316
324
  const bulkActions = useMemo(() => resolveTableActions(features.actions?.bulk, resource?.actions), [features.actions?.bulk, resource?.actions]);
@@ -843,11 +851,15 @@ export function PhiTableWidgetClient({ config: inputConfig, renderMode, external
843
851
  } : undefined, pagination: features.pagination?.enabled === false ? false : {
844
852
  page: resolvedQuery.page ?? 1,
845
853
  pageSize: resolvedQuery.pageSize ?? 20,
846
- total: total ?? undefined,
854
+ /*
855
+ * A cursor-paged list is paged back and forward even where it is counted: a count says how many
856
+ * pages there are, not where page 7 begins, so no page number past the next is offered.
857
+ */
858
+ total: resource?.query.pagination === "cursor" ? undefined : total ?? undefined,
847
859
  hasMore,
848
860
  pageSizeOptions: features.pagination?.pageSizes,
849
861
  showSizeChanger: (features.pagination?.pageSizes?.length ?? 0) > 0,
850
- onChange: (page, pageSize) => setQuery((current) => ({ ...current, page, pageSize, cursor: null })),
862
+ onChange: changePage,
851
863
  }, tree: structure ? {
852
864
  parentRowIdentityPath: structure.parentRowIdentityPath,
853
865
  expandColumnKey: structure.expandColumnKey,
@@ -1021,18 +1033,10 @@ function TableFilter({ filter, field, sourceConfig, value, size, onChange, label
1021
1033
  // A label with nowhere to go still has something to say: it becomes the Control's placeholder, so a
1022
1034
  // cleared filter reads as the question it asks rather than as an empty box.
1023
1035
  const hiddenLabelPlaceholder = filter.labelPlacement === "none" ? filter.label : undefined;
1024
- const fieldWithOptions = field?.type === "enum" || field?.type === "enum[]" ? field : null;
1025
- const resolvedOptions = usePhiControlOptionsProvider({
1026
- options: filter.type === "select" && (filter.options?.length ?? 0) > 0
1027
- ? filter.options
1028
- : fieldWithOptions?.options,
1029
- optionsProvider: filter.type === "select"
1030
- ? filter.optionsProvider ?? fieldWithOptions?.optionsProvider
1031
- : undefined,
1032
- sourceConfig,
1033
- });
1036
+ // Searched and named as a Form field's choices are (`usePhiTableFilterOptions`).
1037
+ const resolvedOptions = usePhiTableFilterOptions({ filter, field, sourceConfig, value });
1034
1038
  if (filter.type === "select") {
1035
- return filter.multiple ? (_jsx(PhiMultiSelectControl, { allowClear: true, value: Array.isArray(value) ? value.filter((entry) => typeof entry === "string") : [], disabled: Boolean(resolvedOptions.warning), options: resolvedOptions.options, size: size, placeholder: hiddenLabelPlaceholder, onChange: onChange, style: { minWidth: 180 } })) : (_jsx(PhiSelectControl, { allowClear: true, value: typeof value === "string" ? value : undefined, disabled: Boolean(resolvedOptions.warning), options: resolvedOptions.options, size: size, placeholder: hiddenLabelPlaceholder, onChange: onChange, style: { minWidth: 180 } }));
1039
+ return filter.multiple ? (_jsx(PhiMultiSelectControl, { allowClear: true, value: readTableFilterChoices(value), disabled: Boolean(resolvedOptions.warning), options: resolvedOptions.options, size: size, placeholder: hiddenLabelPlaceholder, onChange: (next) => onChange(readTableFilterChoices(next)), style: { minWidth: 180 } })) : (_jsx(PhiSelectControl, { allowClear: true, value: typeof value === "string" || typeof value === "number" ? value : undefined, disabled: Boolean(resolvedOptions.warning), options: resolvedOptions.options, size: size, onSearch: resolvedOptions.onSearch, filterOptionsLocally: resolvedOptions.filterOptionsLocally, placeholder: hiddenLabelPlaceholder, onChange: onChange, style: { minWidth: 180 } }));
1036
1040
  }
1037
1041
  if (filter.type === "boolean") {
1038
1042
  if (filter.control === "switch") {
@@ -131,7 +131,7 @@ const PHI_TABLE_ACTION_CONFIG_FIELDS = [
131
131
  ];
132
132
  const PHI_TABLE_COLUMN_RENDERERS = [
133
133
  "text", "email", "date", "datetime", "badge", "tags", "link", "code", "json", "switch", "checkbox", "icon",
134
- "money", "interval",
134
+ "image", "money", "interval",
135
135
  ];
136
136
  const PHI_TABLE_COLUMN_EDITOR_CONTROLS = [
137
137
  "switch", "checkbox", "select", "radio", "segmented", "multi-select", "checkbox-group", "icon-picker", "textarea",
@@ -267,6 +267,7 @@ function readColumn(reader) {
267
267
  fieldKey: requireString(reader, "fieldKey"),
268
268
  sortField: reader.string("sortField"),
269
269
  iconFieldKey: reader.string("iconFieldKey"),
270
+ imageFieldKey: reader.string("imageFieldKey"),
270
271
  titleIcon: reader.string("titleIcon"),
271
272
  titleDisplay: reader.oneOf("titleDisplay", ["icon"]),
272
273
  description: reader.string("description"),
@@ -625,6 +626,8 @@ export const PHI_TABLE_WIDGET_DEFINITION = {
625
626
  { key: "title", type: "string", label: "Title", required: true },
626
627
  { key: "description", type: "string", label: "Hint" },
627
628
  { key: "sortField", type: "string", label: "Provider Sort Field" },
629
+ { key: "iconFieldKey", type: "string", label: "Icon Field" },
630
+ { key: "imageFieldKey", type: "string", label: "Image Field" },
628
631
  {
629
632
  key: "renderer",
630
633
  type: "choice",
@@ -642,6 +645,7 @@ export const PHI_TABLE_WIDGET_DEFINITION = {
642
645
  { value: "switch", label: "Switch" },
643
646
  { value: "checkbox", label: "Checkbox" },
644
647
  { value: "icon", label: "Icon" },
648
+ { value: "image", label: "Image" },
645
649
  { value: "money", label: "Money" },
646
650
  { value: "interval", label: "Interval" },
647
651
  ],
@@ -134,7 +134,7 @@ export const PHI_GROUPS_RUNTIME_DATA_PROVIDER_DESCRIPTORS = [
134
134
  /*
135
135
  * Only here, never on the App's own list: a retired group grants nothing, so it cannot appear
136
136
  * among the groups someone is in. The way back therefore sits where retired groups are
137
- * visible at all -- which is the Site-wide scope, and that scope is Developer or Admin.
137
+ * visible at all -- which is the Site-wide scope, and that scope is Maintainer or Admin.
138
138
  */
139
139
  {
140
140
  key: "reactivate", title: "Reactivate", scope: "row",
@@ -23,7 +23,7 @@ export const PHI_GROUPS_RUNTIME_MODULE_DEFINITION = {
23
23
  eligibleAreas: ["admin", "app"],
24
24
  serverBinding: PHI_CORE_SERVER_BINDING,
25
25
  // No Module-wide policy: the two Areas answer different questions and carry their own. Administration
26
- // is Developer and Admin; the App page is for anyone signed in, because "you are in no group" is an
26
+ // is Maintainer and Admin; the App page is for anyone signed in, because "you are in no group" is an
27
27
  // answer too.
28
28
  controllerType: PHI_GROUPS_CONTROLLER_TYPE,
29
29
  controller: buildPhiRuntimeModuleControllerDescriptor(PHI_GROUPS_RUNTIME_CONTROLLER_DEFINITION),
@@ -4,7 +4,7 @@ import type { PhiViewerGroupClaim } from "../../../types/access";
4
4
  *
5
5
  * Answered while the Page is built rather than by a condition on each control, because it is one answer
6
6
  * for the whole table: someone who manages nothing would only ever see controls they cannot touch, and
7
- * a control that can only be refused is worse than no control. A Manager of any group -- and Developer
7
+ * a control that can only be refused is worse than no control. A Manager of any group -- and Maintainer
8
8
  * and Admin, who administer every group -- gets them. Which of the listed rows they may actually act on
9
9
  * is a second, per-row question the control plane answers with `manages`.
10
10
  */
@@ -4,7 +4,7 @@ import { PhiGroupMembershipFlags } from "../../../constants/site-groups";
4
4
  *
5
5
  * Answered while the Page is built rather than by a condition on each control, because it is one answer
6
6
  * for the whole table: someone who manages nothing would only ever see controls they cannot touch, and
7
- * a control that can only be refused is worse than no control. A Manager of any group -- and Developer
7
+ * a control that can only be refused is worse than no control. A Manager of any group -- and Maintainer
8
8
  * and Admin, who administer every group -- gets them. Which of the listed rows they may actually act on
9
9
  * is a second, per-row question the control plane answers with `manages`.
10
10
  */
@@ -7,7 +7,7 @@ export const PHI_GROUPS_RUNTIME_MODULE_ROUTES = [
7
7
  ownerModuleId: PHI_GROUPS_RUNTIME_MODULE_ID,
8
8
  presetKey: "admin-groups-page",
9
9
  title: "Groups",
10
- // Entry is Developer, which the Core Admin override widens to Admin -- a group is an authorization
10
+ // Entry is Maintainer, which the Core Admin override widens to Admin -- a group is an authorization
11
11
  // unit Pages, Navigation, and Assets refer to, so making one is Site administration. A group's own
12
12
  // Manager administers their group where they work, not here.
13
13
  path: "/groups",
@@ -50,7 +50,7 @@ function readOptionValue(row, key) {
50
50
  }
51
51
  /*
52
52
  * Candidates come from the group-manager route rather than the Site's user list, which is
53
- * Developer-only: a Manager has to be able to find a colleague without being an administrator. The
53
+ * Maintainer-only: a Manager has to be able to find a colleague without being an administrator. The
54
54
  * answer carries the name and the company, never the address -- and the company is what tells two
55
55
  * people of the same name apart.
56
56
  *
@@ -14,7 +14,7 @@ import { readPhiTableProviderResponse, } from "../../../../components/widgets/cl
14
14
  */
15
15
  /*
16
16
  * One address for the resource; the scope says which question is being asked. `?scope=site` is every
17
- * group on the Site and needs Developer or Admin; the bare route is the groups this actor is in.
17
+ * group on the Site and needs Maintainer or Admin; the bare route is the groups this actor is in.
18
18
  */
19
19
  const API_PATH = "/api/site/groups";
20
20
  // Administration is the one surface that asks for retired groups: the key stays taken, so the place
@@ -10,7 +10,7 @@ import { buildPhiBasePageContentScaffold, PHI_BASE_PAGE_LAYOUT_NODE_ID } from ".
10
10
  import { getPhiGroupFormLabels } from "../labels";
11
11
  import { buildPhiGroupLevelValueMap, buildPhiGroupMembersTable, buildPhiGroupRetireAction, buildPhiGroupSettingColumns, buildPhiGroupsFooter, } from "./group-tables";
12
12
  import { canPhiViewerManageSomeGroup } from "../page-visibility";
13
- import { canPhiViewerAccess, PHI_VIEWER_ACCESS_DEVELOPER_TOOLS } from "../../../../types/access";
13
+ import { canPhiViewerAccess, PHI_VIEWER_ACCESS_SITE_MAINTENANCE } from "../../../../types/access";
14
14
  import { PHI_GROUPS_FORM_IDS } from "../forms";
15
15
  import { buildPhiWidgetLabelTranslatorOptions } from "../../../../components/widgets/label-sets/runtime-options";
16
16
  const SYNTHETIC_APP_GROUPS_REGION_IDS = {
@@ -31,7 +31,7 @@ export async function buildPhiDefaultAppGroupsPageTree({ page, runtime, }) {
31
31
  const membersTableAddress = createPhiSignalAddress("cms", PHI_APP_GROUPS_PAGE_WIDGET_IDS.widgetMembersTable);
32
32
  const membershipFormAddress = createPhiSignalAddress("cms", PHI_APP_GROUPS_PAGE_WIDGET_IDS.widgetMembershipForm);
33
33
  const managesSomeGroup = canPhiViewerManageSomeGroup({
34
- siteWide: canPhiViewerAccess(runtime.viewer, PHI_VIEWER_ACCESS_DEVELOPER_TOOLS),
34
+ siteWide: canPhiViewerAccess(runtime.viewer, PHI_VIEWER_ACCESS_SITE_MAINTENANCE),
35
35
  groupClaims: runtime.viewer.groupClaims,
36
36
  });
37
37
  const levelOptions = buildPhiGroupLevelValueMap(labels);
@@ -1,6 +1,10 @@
1
1
  export type PhiAddonRole = {
2
2
  name: string;
3
3
  description?: string;
4
+ /** The Site access whose holders hold the role without a grant, as the manifest declares it. */
5
+ impliedBy?: {
6
+ siteAccess: string;
7
+ };
4
8
  /** Whether the acting person may hand this role out, as the Core decided it for this request. */
5
9
  grantable: boolean;
6
10
  };
@@ -14,18 +18,52 @@ export type PhiAddonRoleAssignment = {
14
18
  addonId: string;
15
19
  role: string;
16
20
  };
21
+ /**
22
+ * A role somebody holds without a stored grant, because they hold the Site access it is `impliedBy` (or one
23
+ * that includes it is): the Core's `implied` / `impliedAddonRoles` entry `{ addonId, role, through: {
24
+ * siteAccess } }`. Shown as held, never sent back by a save -- only the access gives it and takes it away.
25
+ */
26
+ export type PhiAddonRoleHeldThroughSiteAccess = PhiAddonRoleAssignment & {
27
+ siteAccess: string;
28
+ };
29
+ /**
30
+ * Where a placement names the words for Add-on roles held through a Site access, in its language: the edit
31
+ * form's `formConfig` and the users Table's `source.params` carry them under this key, written by the users
32
+ * page preset from the Module's Label Set. The options and Table Providers are Client code without a Label
33
+ * Set; the placement has one (the curation Form's "Nobody" reaches its Provider the same way).
34
+ */
35
+ export declare const PHI_USER_MANAGEMENT_ADDON_ROLE_TEXTS_KEY = "addonRoleTexts";
36
+ /**
37
+ * The `params.list` value under which the edit form's choices Provider answers the roles held through a Site
38
+ * access instead of the roles to choose.
39
+ */
40
+ export declare const PHI_USER_MANAGEMENT_ADDON_ROLE_IMPLIED_LIST = "implied";
41
+ export type PhiAddonRoleTexts = {
42
+ /** A role (or an Add-on's roles, `%1`) and the Site access (`%2`) it is held through: "%1 (via %2)". */
43
+ via: string;
44
+ /** What a role in the catalog that a Site access implies says of it: "Implied by %1". */
45
+ impliedBy: string;
46
+ /** What each Site access is called; one not named here is shown by its key. */
47
+ siteAccess: Readonly<Record<string, string>>;
48
+ };
49
+ /** The words a placement named under `PHI_USER_MANAGEMENT_ADDON_ROLE_TEXTS_KEY`; the source text where none. */
50
+ export declare function readPhiAddonRoleTexts(value: unknown): PhiAddonRoleTexts;
17
51
  /** The catalog of an `GET /api/site/addon-roles` answer; entries and roles that do not read are left out. */
18
52
  export declare function readPhiAddonRoleCatalog(payload: unknown): PhiAddonRoleCatalogEntry[];
19
53
  /** The stored assignments in a user row's `addonRoles` or an answer's `held`. */
20
54
  export declare function readPhiAddonRoleAssignments(value: unknown): PhiAddonRoleAssignment[];
55
+ /** The Core's `implied` (an answer of `/api/site/addon-roles`) or a user row's `impliedAddonRoles`. */
56
+ export declare function readPhiAddonRolesHeldThroughSiteAccess(value: unknown): PhiAddonRoleHeldThroughSiteAccess[];
21
57
  /** The tag a Site Admin's row carries in place of single roles; the Table maps it to its label. */
22
58
  export declare const PHI_USER_MANAGEMENT_ADDON_ALL_ROLES_TAG = "all";
23
59
  /**
24
60
  * The tags of a row's Add-on roles column: one tag per Add-on with its stored roles, so the column stays
25
- * narrow, and for a Site Admin the one tag that says every role is held. Stored assignments for a Site Admin
26
- * are not listed (they apply when the person is no longer one; the dialog shows them).
61
+ * narrow, then one per Add-on and Site access with the roles held through that access ("@acme/books:
62
+ * licence-manager (via Accounting)"), and for a Site Admin the one tag that says every role is held. Stored
63
+ * assignments for a Site Admin are not listed (they apply when the person is no longer one; the dialog shows
64
+ * them). A role both stored and held through an access is in both tags: taking the grant back leaves it held.
27
65
  */
28
- export declare function buildPhiAddonRoleTags(row: Record<string, unknown>): string[];
66
+ export declare function buildPhiAddonRoleTags(row: Record<string, unknown>, texts?: PhiAddonRoleTexts): string[];
29
67
  /**
30
68
  * The users Table filter's options: one per Add-on, never a single role -- choosing one finds whoever holds
31
69
  * any of its roles (the Core's `addonId` filter). The label is the Add-on's title; the id is the description,
@@ -36,6 +74,8 @@ export declare function buildPhiAddonFilterOptions(catalog: readonly PhiAddonRol
36
74
  value: string;
37
75
  label: string;
38
76
  }[];
77
+ /** One role as the user save names it: `"<addonId>:<role>"`, which the Core splits at the last colon. */
78
+ export declare function formatPhiAddonRoleValue(addonId: string, role: string): string;
39
79
  /**
40
80
  * The edit form's Add-on role choices, under one heading per Add-on: every role the acting person may grant,
41
81
  * and the ones the person edited holds that the actor may not grant, disabled.
@@ -46,11 +86,27 @@ export declare function buildPhiAddonFilterOptions(catalog: readonly PhiAddonRol
46
86
  * standing over. As a disabled option it stays in the value as a tag nobody can remove, and the save sends it
47
87
  * unchanged. `held` is null where the Core did not say what the person holds; every role the actor may not
48
88
  * grant is listed disabled then, so whichever of them the person holds is kept the same way.
89
+ *
90
+ * A role a Site access implies says so in its description ("Implied by Accounting"): choosing it stores a
91
+ * grant beside the access, which keeps the role once the access is gone.
49
92
  */
50
- export declare function buildPhiAddonRoleChoiceOptions(catalog: readonly PhiAddonRoleCatalogEntry[], held: readonly PhiAddonRoleAssignment[] | null): {
93
+ export declare function buildPhiAddonRoleChoiceOptions(catalog: readonly PhiAddonRoleCatalogEntry[], held: readonly PhiAddonRoleAssignment[] | null, texts?: PhiAddonRoleTexts): {
51
94
  disabled?: boolean | undefined;
52
95
  group: string;
53
96
  description?: string | undefined;
54
97
  value: string;
55
98
  label: string;
56
99
  }[];
100
+ /**
101
+ * The options of the edit form's read-only list of roles held through a Site access: one per role, labelled
102
+ * with the access ("licence-manager (via Accounting)") so the tag says why it is there, under its Add-on's
103
+ * name, and disabled -- nobody removes a role an access gives. Valued as the save names roles; the save
104
+ * carries the list under its own key, which the Core does not read, so the stored grants stay the other
105
+ * field's alone.
106
+ */
107
+ export declare function buildPhiAddonRoleImpliedOptions(catalog: readonly PhiAddonRoleCatalogEntry[], implied: readonly PhiAddonRoleHeldThroughSiteAccess[], texts?: PhiAddonRoleTexts): {
108
+ value: string;
109
+ label: string;
110
+ group: string;
111
+ disabled: boolean;
112
+ }[];