@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
@@ -149,6 +149,40 @@ export function readPhiTableProviderMutationResult(value) {
149
149
  message: value.message,
150
150
  };
151
151
  }
152
+ /**
153
+ * Whether a Provider action may be asked for as stated: declared by the resource, with the row or the
154
+ * selection its scope needs, and a value of the type it declares. The one check every Widget that runs a
155
+ * Provider action makes before the Provider Client is called -- the Table's Binding and the record
156
+ * Widget alike -- answered as the error the Widget shows, or null.
157
+ */
158
+ export function checkPhiTableProviderActionRequest(resource, request) {
159
+ const action = resource?.actions?.find((candidate) => candidate.key === request.actionKey);
160
+ if (!action) {
161
+ return new PhiTableProviderError("action-not-declared", `Table action "${request.actionKey}" is not declared by resource "${resource?.resourceKey ?? "unknown"}".`);
162
+ }
163
+ const hasRow = request.rowIdentity != null;
164
+ const hasSelection = (request.selectedRowIdentities?.length ?? 0) > 0;
165
+ if ((action.scope === "row" && !hasRow) || (action.scope === "selection" && !hasSelection)) {
166
+ return new PhiTableProviderError("action-scope-invalid", `Table action "${request.actionKey}" requires ${action.scope} identity context.`);
167
+ }
168
+ const value = request.actionValue;
169
+ const valueValid = action.valueType === undefined || action.valueType === "none"
170
+ ? value === undefined || value === null
171
+ : action.valueType === "string"
172
+ ? typeof value === "string"
173
+ : action.valueType === "number"
174
+ ? typeof value === "number" && Number.isFinite(value)
175
+ : action.valueType === "boolean"
176
+ ? typeof value === "boolean"
177
+ : action.valueType === "string[]"
178
+ ? Array.isArray(value) && value.every((entry) => typeof entry === "string")
179
+ : action.valueType === "number[]"
180
+ ? Array.isArray(value) && value.every((entry) => typeof entry === "number" && Number.isFinite(entry))
181
+ : isPhiRecord(value);
182
+ return valueValid
183
+ ? null
184
+ : new PhiTableProviderError("action-value-invalid", `Table action "${request.actionKey}" received an incompatible value.`);
185
+ }
152
186
  /**
153
187
  * The choices a row offers for a field that declares `rowOptionsPath`, or null when the row offers none.
154
188
  * A generic reader: an entry without a string value and a string label is dropped, not repaired.
@@ -312,6 +346,15 @@ export function validatePhiTableWidgetBinding(config, resource) {
312
346
  errors.push(`Table column "${column.key}" icon field "${column.iconFieldKey}" must be an icon field.`);
313
347
  }
314
348
  }
349
+ if (column.imageFieldKey !== undefined) {
350
+ const imageField = fieldsByKey.get(column.imageFieldKey);
351
+ if (!imageField) {
352
+ errors.push(`Table column "${column.key}" references undeclared image field "${column.imageFieldKey}".`);
353
+ }
354
+ else if (imageField.type !== "string") {
355
+ errors.push(`Table column "${column.key}" image field "${column.imageFieldKey}" must be a string field.`);
356
+ }
357
+ }
315
358
  if (column.editor && field?.type === "json") {
316
359
  errors.push(`Table column "${column.key}" cannot use an implicit JSON editor.`);
317
360
  }
@@ -331,6 +374,7 @@ export function validatePhiTableWidgetBinding(config, resource) {
331
374
  (column.renderer === "switch" && field?.type === "boolean") ||
332
375
  (column.renderer === "checkbox" && field?.type === "boolean") ||
333
376
  (column.renderer === "icon" && field?.type === "icon") ||
377
+ (column.renderer === "image" && field?.type === "string") ||
334
378
  ((column.renderer === "date" || column.renderer === "datetime") && field?.type === column.renderer) ||
335
379
  (column.renderer === "json" && field?.type === "json") ||
336
380
  (column.renderer === "tags" && (field?.type === "json" || field?.type === "enum[]")) ||