@phis/ui 0.8.0 → 0.8.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/components/cms/phi-cms-layout-renderer.js +15 -7
- package/components/cms/phi-cms-render-diagnostic-client.d.ts +3 -1
- package/components/cms/phi-cms-render-diagnostic-client.js +4 -3
- package/components/cms/phi-cms-render-diagnostic.d.ts +8 -2
- package/components/cms/phi-cms-render-diagnostic.js +12 -2
- package/components/cms/phi-cms-render-error-boundary.d.ts +2 -0
- package/components/cms/phi-cms-render-error-boundary.js +1 -1
- package/components/cms/phi-cms-root-layout.js +3 -1
- package/components/controls/phi-media-picker-control.d.ts +9 -0
- package/components/controls/phi-media-picker-control.js +1 -1
- package/components/controls/phi-popover-control.js +4 -1
- package/components/controls/phi-table-control.d.ts +7 -1
- package/components/controls/phi-table-control.js +23 -8
- package/components/forms/form-descriptor-field-check.d.ts +18 -0
- package/components/forms/form-descriptor-field-check.js +41 -0
- package/components/forms/form-descriptor-runtime-client.js +11 -10
- package/components/forms/form-record-source.d.ts +38 -0
- package/components/forms/form-record-source.js +48 -0
- package/components/forms/shared-form-descriptors.d.ts +0 -34
- package/components/forms/shared-form-descriptors.js +0 -6
- package/components/forms/shared-form-ids.d.ts +1 -1
- package/components/forms/shared-form-ids.js +1 -1
- package/components/media/media-settings-labels.d.ts +1 -0
- package/components/media/media-settings-labels.js +2 -0
- package/components/media/phi-media-picker-binding.d.ts +41 -33
- package/components/media/phi-media-picker-binding.js +2 -1
- package/components/media/use-media-library-add-picker.d.ts +33 -32
- package/components/overlays/phi-overlay-container-client.js +11 -9
- package/components/regions/presets/phi-settings-page-shell-tree.d.ts +7 -0
- package/components/regions/presets/phi-settings-page-shell-tree.js +3 -3
- package/components/shell/phi-icon-names.d.ts +3 -0
- package/components/shell/phi-icon-names.js +3 -0
- package/components/shell/phi-icon.d.ts +5 -7
- package/components/shell/phi-icon.js +8 -21
- package/components/tables/client/phi-table-binding-params.d.ts +24 -0
- package/components/tables/client/phi-table-binding-params.js +39 -0
- package/components/tables/client/phi-table-binding.d.ts +1 -3
- package/components/tables/client/phi-table-binding.js +5 -9
- package/components/widgets/client/shared/phi-button-icons.d.ts +6 -4
- package/components/widgets/client/shared/phi-button-icons.js +8 -12
- package/components/widgets/client/shared/phi-collection-binding-params.d.ts +8 -0
- package/components/widgets/client/shared/phi-collection-binding-params.js +13 -0
- package/components/widgets/client/shared/phi-collection-provider.d.ts +11 -1
- package/components/widgets/client/shared/phi-collection-provider.js +5 -0
- package/components/widgets/client/shared/phi-collection-view-binding.d.ts +1 -0
- package/components/widgets/client/shared/phi-command-buttons.d.ts +16 -0
- package/components/widgets/client/shared/phi-command-buttons.js +9 -1
- package/components/widgets/label-sets/admin-users.d.ts +1 -0
- package/components/widgets/label-sets/admin-users.js +2 -0
- package/components/widgets/label-sets/builder-modules.js +4 -0
- package/components/widgets/label-sets/profile.d.ts +0 -16
- package/components/widgets/label-sets/profile.js +0 -37
- package/components/widgets/label-sets/registration.d.ts +0 -1
- package/components/widgets/label-sets/registration.js +0 -2
- package/components/widgets/label-sets/revisions.js +2 -0
- package/components/widgets/label-sets/signals.js +2 -0
- package/components/widgets/label-types/builder-modules.d.ts +4 -0
- package/components/widgets/label-types/builder-modules.js +2 -0
- package/components/widgets/label-types/revisions.d.ts +2 -0
- package/components/widgets/label-types/revisions.js +2 -1
- package/components/widgets/label-types/signals.d.ts +2 -0
- package/components/widgets/label-types/signals.js +1 -0
- package/components/widgets/shared/widget-failure-audience.d.ts +7 -0
- package/components/widgets/shared/widget-failure-audience.js +21 -0
- package/components/widgets/shared/widget-failure-client.js +5 -2
- package/components/widgets/shared/widget-failure-notice-client.d.ts +6 -0
- package/components/widgets/shared/widget-failure-notice-client.js +10 -0
- package/components/widgets/shared/widget-failure-notice.d.ts +6 -0
- package/components/widgets/shared/widget-failure-notice.js +17 -0
- package/components/widgets/shared/widget-failure-staff.d.ts +3 -0
- package/components/widgets/shared/widget-failure-staff.js +18 -0
- package/components/widgets/shared/widget-failure.d.ts +9 -6
- package/components/widgets/shared/widget-failure.js +0 -9
- package/components/widgets/shared/widget-failure.server.d.ts +4 -2
- package/components/widgets/shared/widget-failure.server.js +8 -3
- package/constants/customer-file.d.ts +12 -3
- package/constants/customer-file.js +12 -3
- package/constants/runtime-module-ownership.js +4 -3
- package/constants/site-address.d.ts +9 -0
- package/constants/site-address.js +10 -0
- package/constants/table-loading.d.ts +14 -0
- package/constants/table-loading.js +14 -0
- package/constants.d.ts +2 -1
- package/constants.js +3 -1
- package/gateway/site-cms-write-validation.js +19 -3
- package/helpers/announced-action.d.ts +17 -0
- package/helpers/announced-action.js +29 -0
- package/helpers/phi-metadata.d.ts +0 -8
- package/helpers/phi-metadata.js +1 -10
- package/helpers/phi-site-description.d.ts +11 -0
- package/helpers/phi-site-description.js +13 -0
- package/helpers/preset-form-check.d.ts +14 -0
- package/helpers/preset-form-check.js +12 -0
- package/helpers/preset-table-check.d.ts +19 -15
- package/helpers/preset-table-check.js +33 -39
- package/helpers/record-widget-binding.d.ts +10 -0
- package/helpers/record-widget-binding.js +35 -0
- package/helpers/record-widget.d.ts +1 -10
- package/helpers/record-widget.js +4 -33
- package/helpers/table-widget-binding.d.ts +12 -0
- package/helpers/table-widget-binding.js +296 -0
- package/helpers/tree-widget-binding.d.ts +19 -0
- package/helpers/tree-widget-binding.js +72 -0
- package/helpers/typed-confirmation.d.ts +9 -0
- package/helpers/typed-confirmation.js +13 -0
- package/helpers/widget-binding-check.d.ts +22 -0
- package/helpers/widget-binding-check.js +91 -0
- package/module-page-check.d.ts +2 -0
- package/module-page-check.js +2 -0
- package/next/root-route.js +2 -1
- package/package.json +1 -1
- package/plugins/runtime-modules/accounting/ids.d.ts +7 -4
- package/plugins/runtime-modules/accounting/ids.js +14 -3
- package/plugins/runtime-modules/accounting/trees/accounting-customer-file-label-set.d.ts +21 -9
- package/plugins/runtime-modules/accounting/trees/accounting-customer-file-label-set.js +29 -15
- package/plugins/runtime-modules/accounting/trees/phi-default-accounting-customer-file-page-tree.d.ts +11 -8
- package/plugins/runtime-modules/accounting/trees/phi-default-accounting-customer-file-page-tree.js +206 -137
- package/plugins/runtime-modules/app/client-data-providers.js +1 -1
- package/plugins/runtime-modules/app/data-providers.d.ts +14 -69
- package/plugins/runtime-modules/app/data-providers.js +19 -54
- package/plugins/runtime-modules/app/definition.d.ts +8 -80
- package/plugins/runtime-modules/app/forms.d.ts +1 -16
- package/plugins/runtime-modules/app/forms.js +0 -59
- package/plugins/runtime-modules/app/ids.d.ts +2 -1
- package/plugins/runtime-modules/app/ids.js +3 -2
- package/plugins/runtime-modules/app/module.d.ts +8 -80
- package/plugins/runtime-modules/app/services/addresses-collection.d.ts +59 -0
- package/plugins/runtime-modules/app/services/{addresses-table.js → addresses-collection.js} +23 -19
- package/plugins/runtime-modules/app/trees/account-addresses-panel.d.ts +10 -6
- package/plugins/runtime-modules/app/trees/account-addresses-panel.js +37 -73
- package/plugins/runtime-modules/app/trees/addresses-label-set.d.ts +0 -5
- package/plugins/runtime-modules/app/trees/addresses-label-set.js +2 -6
- package/plugins/runtime-modules/app/trees/phi-default-app-profile-page-tree.d.ts +1 -2
- package/plugins/runtime-modules/app/trees/phi-default-app-profile-page-tree.js +1 -17
- package/plugins/runtime-modules/app/trees/profile-label-set.d.ts +0 -2
- package/plugins/runtime-modules/app/trees/profile-label-set.js +2 -14
- package/plugins/runtime-modules/asset/trees/phi-default-admin-media-settings-page-tree.js +5 -0
- package/plugins/runtime-modules/builder/clients/inspector-config-field.js +16 -6
- package/plugins/runtime-modules/builder/clients/inspector-image-field.js +3 -1
- package/plugins/runtime-modules/builder/clients/inspector-section-widget.js +3 -1
- package/plugins/runtime-modules/builder/controller/signal-wiring-controller.js +5 -1
- package/plugins/runtime-modules/builder/signal-wiring-options.js +9 -2
- package/plugins/runtime-modules/builder/trees/phi-builder-inspector-area-overlay-tree.server.js +5 -0
- package/plugins/runtime-modules/builder/trees/phi-default-builder-area-preset-tree.js +14 -1
- package/plugins/runtime-modules/client-manifests/common.js +6 -0
- package/plugins/runtime-modules/core/widgets/card/config.d.ts +1 -1
- package/plugins/runtime-modules/core/widgets/collection-view/client.js +5 -2
- package/plugins/runtime-modules/core/widgets/collection-view/config.js +8 -0
- package/plugins/runtime-modules/core/widgets/collection-view/site-address-binding.d.ts +55 -0
- package/plugins/runtime-modules/core/widgets/collection-view/site-address-binding.js +173 -0
- package/plugins/runtime-modules/core/widgets/collection-view/site-address-tiles.d.ts +48 -0
- package/plugins/runtime-modules/core/widgets/collection-view/site-address-tiles.js +67 -0
- package/plugins/runtime-modules/core/widgets/command-toolbar/config.d.ts +1 -1
- package/plugins/runtime-modules/core/widgets/description/config.d.ts +1 -1
- package/plugins/runtime-modules/core/widgets/entry-list/config.d.ts +1 -1
- package/plugins/runtime-modules/core/widgets/float-button/config.d.ts +1 -1
- package/plugins/runtime-modules/core/widgets/form/config.d.ts +1 -1
- package/plugins/runtime-modules/core/widgets/form/config.js +14 -1
- package/plugins/runtime-modules/core/widgets/gallery/config.d.ts +1 -1
- package/plugins/runtime-modules/core/widgets/markdown/config.d.ts +1 -1
- package/plugins/runtime-modules/core/widgets/record/client.js +2 -6
- package/plugins/runtime-modules/core/widgets/result/config.d.ts +1 -1
- package/plugins/runtime-modules/core/widgets/simple-text/config.d.ts +1 -1
- package/plugins/runtime-modules/core/widgets/table/client.js +30 -48
- package/plugins/runtime-modules/core/widgets/table/config.d.ts +3 -3
- package/plugins/runtime-modules/core/widgets/table/config.js +3 -0
- package/plugins/runtime-modules/core/widgets/thread-conversation/client.js +2 -2
- package/plugins/runtime-modules/core/widgets/thread-conversation/config.d.ts +6 -2
- package/plugins/runtime-modules/core/widgets/thread-conversation/config.js +6 -1
- package/plugins/runtime-modules/core/widgets/thread-widget-config.d.ts +10 -0
- package/plugins/runtime-modules/core/widgets/thread-widget-config.js +6 -0
- package/plugins/runtime-modules/core/widgets/tree/client.js +6 -6
- package/plugins/runtime-modules/localization/trees/editor-translations-widget-label-set.d.ts +2 -0
- package/plugins/runtime-modules/localization/trees/editor-translations-widget-label-set.js +2 -0
- package/plugins/runtime-modules/localization/trees/phi-default-editor-translations-page-tree.js +5 -0
- package/plugins/runtime-modules/revisions/controller/binding.d.ts +37 -0
- package/plugins/runtime-modules/revisions/controller/binding.js +75 -0
- package/plugins/runtime-modules/revisions/controller/client.d.ts +5 -0
- package/plugins/runtime-modules/revisions/controller/client.js +74 -50
- package/plugins/runtime-modules/revisions/controller/definition.d.ts +5 -0
- package/plugins/runtime-modules/revisions/controller/definition.js +10 -0
- package/plugins/runtime-modules/revisions/forms.js +1 -1
- package/plugins/runtime-modules/revisions/page-ids.d.ts +1 -1
- package/plugins/runtime-modules/revisions/page-ids.js +4 -1
- package/plugins/runtime-modules/revisions/services/options.js +14 -4
- package/plugins/runtime-modules/revisions/services/table.js +41 -21
- package/plugins/runtime-modules/revisions/trees/phi-default-builder-revisions-page-tree.js +76 -3
- package/plugins/runtime-modules/theme/controller/runtime.js +14 -2
- package/plugins/runtime-modules/theme/widgets/brand-controls/client.js +39 -13
- package/plugins/runtime-modules/threads/client-data-providers.js +5 -0
- package/plugins/runtime-modules/threads/controller/client.js +62 -2
- package/plugins/runtime-modules/threads/controller/definition.js +48 -0
- package/plugins/runtime-modules/threads/data-providers.d.ts +22 -37
- package/plugins/runtime-modules/threads/data-providers.js +35 -24
- package/plugins/runtime-modules/threads/definition.d.ts +22 -37
- package/plugins/runtime-modules/threads/ids.d.ts +2 -0
- package/plugins/runtime-modules/threads/ids.js +2 -0
- package/plugins/runtime-modules/threads/services/customer-file-addresses.d.ts +30 -0
- package/plugins/runtime-modules/threads/services/customer-file-addresses.js +59 -0
- package/plugins/runtime-modules/threads/services/customer-file-read.d.ts +22 -0
- package/plugins/runtime-modules/threads/services/customer-file-read.js +101 -0
- package/plugins/runtime-modules/threads/services/customer-file-table.d.ts +14 -80
- package/plugins/runtime-modules/threads/services/customer-file-table.js +27 -112
- package/plugins/runtime-modules/user-management/trees/admin-users-access-label-set.d.ts +4 -0
- package/plugins/runtime-modules/user-management/trees/admin-users-access-label-set.js +4 -0
- package/plugins/runtime-modules/user-management/trees/phi-default-admin-users-access-page-tree.js +15 -0
- package/plugins/runtime-modules/user-management/trees/phi-default-admin-users-page-tree.js +5 -0
- package/server-helpers/runtime.js +0 -1
- package/styles/controls.css +4 -2
- package/styles/layout.css +7 -0
- package/theme/phi-antd-token-resolver.d.ts +8 -0
- package/theme/phi-antd-token-resolver.js +10 -0
- package/theme/phi-theme-color.d.ts +19 -0
- package/theme/phi-theme-color.js +42 -0
- package/theme/phi-theme-gradients.js +4 -22
- package/theme/phi-theme-palette-defaults.d.ts +16 -0
- package/theme/phi-theme-palette-defaults.js +103 -0
- package/types/cms-plugins.d.ts +6 -1
- package/types/collection-provider.d.ts +27 -0
- package/types/collection-signal-values.d.ts +2 -0
- package/types/collection-signal-values.js +23 -0
- package/types/collection-view-widget.d.ts +9 -0
- package/types/core-widget-placements.d.ts +6 -0
- package/types/signals.d.ts +2 -0
- package/types/signals.js +2 -0
- package/types/table-widget.d.ts +15 -1
- package/types/table-widget.js +0 -282
- package/types/tree-widget.d.ts +0 -1
- package/types/tree-widget.js +0 -60
- package/types/widget-runtime.d.ts +0 -1
- package/types.d.ts +1 -1
- package/types.js +1 -1
- package/plugins/runtime-modules/app/services/addresses-table.d.ts +0 -135
|
@@ -34,13 +34,14 @@ import { emitPhiSignalCapability, usePhiSignalEmitter, usePhiSignalIdentity } fr
|
|
|
34
34
|
import { usePhiVisualAnchorParts } from "../../../../../components/runtime/runtime-visual-anchors";
|
|
35
35
|
import { usePhiApplicationFeedback } from "../../../../../components/runtime/use-phi-application-feedback";
|
|
36
36
|
import { usePhiTableBinding } from "../../../../../components/tables/client/phi-table-binding";
|
|
37
|
+
import { usePhiTableBindingParams } from "../../../../../components/tables/client/phi-table-binding-params";
|
|
37
38
|
import { PhiTableBindingControl } from "../../../../../components/tables/client/phi-table-binding-control";
|
|
38
39
|
import { usePhiTableFilterOptions } from "../../../../../components/tables/client/phi-table-filter-options";
|
|
39
40
|
import { isTableQueryNarrowedByReader } from "./reader-query";
|
|
40
41
|
import { clearPhiDataDragPayload, readPhiDataDragPayload } from "../../../../../components/runtime/client/phi-data-dnd";
|
|
41
42
|
import { renderPhiValueContent, renderPhiValueWithLead, } from "../../../../../components/widgets/client/shared/phi-rendered-value";
|
|
42
43
|
import { formatPhiTranslation } from "../../../../../helpers/translation-format";
|
|
43
|
-
import { readPhiTableFilters, readPhiTableQuery, readPhiTableRowOptions,
|
|
44
|
+
import { readPhiTableFilters, readPhiTableQuery, readPhiTableRowOptions, } from "../../../../../types/table-widget";
|
|
44
45
|
import { readPhiTableColumnOrderSignalValue, readPhiTableBindingParamsSignalValue, readPhiTableExpansionSignalValue, readPhiTableActionSignalValue, isPhiTableQueryValue, } from "../../../../../types/table-signal-values";
|
|
45
46
|
import { collectPhiRuntimeValueConditions, combinePhiRuntimeConditionExpressions, evaluatePhiRuntimeConditionExpression, readPhiRuntimeConditionStateSignalValue, } from "../../../../../types/runtime-condition";
|
|
46
47
|
import { isPhiControllerSignalAddress, } from "../../../../../types/signals";
|
|
@@ -227,17 +228,13 @@ export function PhiTableWidgetClient({ config: inputConfig, renderMode, external
|
|
|
227
228
|
const config = useMemo(() => JSON.parse(configKey), [configKey]);
|
|
228
229
|
const { presentation, features, source } = config;
|
|
229
230
|
/*
|
|
230
|
-
* What the reader set, tagged with the configuration it was set against.
|
|
231
|
-
* configured params or columns is a new starting point; the reader's earlier
|
|
232
|
-
* one and would otherwise outlive it -- an order missing the new column,
|
|
233
|
-
* refused.
|
|
231
|
+
* What the reader set, tagged with the configuration it was set against (`usePhiTableBindingParams`).
|
|
232
|
+
* A Builder edit of the configured params or columns is a new starting point; the reader's earlier
|
|
233
|
+
* choice belonged to the old one and would otherwise outlive it -- an order missing the new column,
|
|
234
|
+
* which every reorder then refused.
|
|
234
235
|
*/
|
|
235
236
|
const configuredBindingParams = useMemo(() => isPhiRecord(source?.params) ? source.params : {}, [source]);
|
|
236
|
-
const
|
|
237
|
-
const [chosenBindingParams, setChosenBindingParams] = useState(null);
|
|
238
|
-
const bindingParams = chosenBindingParams?.seed === bindingParamsSeed
|
|
239
|
-
? chosenBindingParams.params
|
|
240
|
-
: configuredBindingParams;
|
|
237
|
+
const { bindingParams, changeBindingParams } = usePhiTableBindingParams(configuredBindingParams);
|
|
241
238
|
const resolvedSource = useMemo(() => source ? { ...source, params: bindingParams } : null, [bindingParams, source]);
|
|
242
239
|
const resolvedControlSize = presentation.controlSize ??
|
|
243
240
|
(features.tools?.mode !== "external" ? "small" : undefined);
|
|
@@ -274,22 +271,6 @@ export function PhiTableWidgetClient({ config: inputConfig, renderMode, external
|
|
|
274
271
|
* signal it received, absent when the operator drove it from the Table itself, which begins one.
|
|
275
272
|
*/
|
|
276
273
|
const emitCapability = useCallback((capabilityId, value, correlationId) => emitPhiSignalCapability(emitSignal, emitRoutes, capabilityId, value, correlationId), [emitRoutes, emitSignal]);
|
|
277
|
-
const validateResource = useCallback((candidate) => {
|
|
278
|
-
const contractError = validatePhiTableWidgetBinding(config, candidate)[0];
|
|
279
|
-
if (contractError)
|
|
280
|
-
return contractError;
|
|
281
|
-
const iconAction = [
|
|
282
|
-
...(config.features.actions?.toolbar ?? []),
|
|
283
|
-
...(config.features.actions?.row ?? []),
|
|
284
|
-
...(config.features.actions?.bulk ?? []),
|
|
285
|
-
].find((action) => action.display !== "label" && action.icon && !resolvePhiButtonIcon(action.icon));
|
|
286
|
-
if (iconAction)
|
|
287
|
-
return `Table action "${iconAction.key}" references an unavailable icon.`;
|
|
288
|
-
const iconBindingTool = config.features.tools?.bindingFields?.find((tool) => tool.create?.display !== "label" && tool.create?.icon && !resolvePhiButtonIcon(tool.create.icon));
|
|
289
|
-
return iconBindingTool
|
|
290
|
-
? `Table binding field "${iconBindingTool.key}" create tool references an unavailable icon.`
|
|
291
|
-
: null;
|
|
292
|
-
}, [config]);
|
|
293
274
|
const binding = usePhiTableBinding({
|
|
294
275
|
source: resolvedSource,
|
|
295
276
|
initialQuery: { ...initialQuery, sorts: defaultSorts, filters: initialFilters },
|
|
@@ -323,9 +304,8 @@ export function PhiTableWidgetClient({ config: inputConfig, renderMode, external
|
|
|
323
304
|
const { revealValue: _shownOnce, ...announced } = result;
|
|
324
305
|
emitCapability("mutationChange", announced);
|
|
325
306
|
},
|
|
326
|
-
validateResource,
|
|
327
307
|
});
|
|
328
|
-
const { resource, bindingError,
|
|
308
|
+
const { resource, bindingError, rows, total, hasMore, summary, loading, error, queryError, query, resolvedQuery, setQuery, changePage, selectedRowIdentities, setSelectedRowIdentities, expandedRowIdentities, setExpandedRowIdentities, reload, executeAction, commitField, commitRow, isFieldMutationPending, moveRow, drop, } = binding;
|
|
329
309
|
const toolbarActions = useMemo(() => resolveTableActions(features.actions?.toolbar, resource?.actions), [features.actions?.toolbar, resource?.actions]);
|
|
330
310
|
const rowActions = useMemo(() => resolveTableActions(features.actions?.row, resource?.actions), [features.actions?.row, resource?.actions]);
|
|
331
311
|
const bulkActions = useMemo(() => resolveTableActions(features.actions?.bulk, resource?.actions), [features.actions?.bulk, resource?.actions]);
|
|
@@ -348,7 +328,7 @@ export function PhiTableWidgetClient({ config: inputConfig, renderMode, external
|
|
|
348
328
|
.flatMap((condition) => condition.source === "controller" && condition.controllerAddress
|
|
349
329
|
? [condition.controllerAddress]
|
|
350
330
|
: [])), [bulkActions, features.editing?.disabledWhen, features.rowSelection?.disabledWhen, presentation.columns, presentation.row?.mutedWhen, resource?.fields, rowActions, toolbarActions]);
|
|
351
|
-
const effectiveLoading = loading && !bindingError
|
|
331
|
+
const effectiveLoading = loading && !bindingError;
|
|
352
332
|
useEffect(() => {
|
|
353
333
|
if (features.search?.enabled !== true || query.search === searchDraft)
|
|
354
334
|
return undefined;
|
|
@@ -421,8 +401,11 @@ export function PhiTableWidgetClient({ config: inputConfig, renderMode, external
|
|
|
421
401
|
return;
|
|
422
402
|
emitSelection(selectedRowIdentities);
|
|
423
403
|
}, [emitFields, emitSelection, readSelectedRows, selectedRowIdentities]);
|
|
424
|
-
|
|
425
|
-
|
|
404
|
+
/* A change to the params; the same params again change nothing and hand nothing on. */
|
|
405
|
+
const updateBindingParams = useCallback((patch, correlationId) => {
|
|
406
|
+
const next = changeBindingParams(patch);
|
|
407
|
+
if (!next)
|
|
408
|
+
return;
|
|
426
409
|
setQuery((current) => ({ ...current, page: 1, cursor: null }));
|
|
427
410
|
setSelectedRowIdentities([]);
|
|
428
411
|
setExpandedRowIdentities([]);
|
|
@@ -436,24 +419,22 @@ export function PhiTableWidgetClient({ config: inputConfig, renderMode, external
|
|
|
436
419
|
: [];
|
|
437
420
|
})),
|
|
438
421
|
}, correlationId);
|
|
439
|
-
}, [
|
|
422
|
+
}, [changeBindingParams, configuredBindingFields, emitCapability, setExpandedRowIdentities, setQuery, setSelectedRowIdentities]);
|
|
440
423
|
useEffect(() => {
|
|
441
424
|
if (!resource?.bindingFields?.length)
|
|
442
425
|
return;
|
|
443
|
-
const
|
|
444
|
-
let changed = false;
|
|
426
|
+
const defaults = {};
|
|
445
427
|
for (const field of resource.bindingFields) {
|
|
446
|
-
if (
|
|
447
|
-
|
|
448
|
-
changed = true;
|
|
428
|
+
if (bindingParams[field.key] === undefined && field.defaultValue !== undefined) {
|
|
429
|
+
defaults[field.key] = field.defaultValue;
|
|
449
430
|
}
|
|
450
431
|
}
|
|
451
|
-
if (
|
|
432
|
+
if (Object.keys(defaults).length === 0)
|
|
452
433
|
return;
|
|
453
434
|
let cancelled = false;
|
|
454
435
|
queueMicrotask(() => {
|
|
455
436
|
if (!cancelled)
|
|
456
|
-
updateBindingParams(
|
|
437
|
+
updateBindingParams(defaults);
|
|
457
438
|
});
|
|
458
439
|
return () => { cancelled = true; };
|
|
459
440
|
}, [bindingParams, resource?.bindingFields, updateBindingParams]);
|
|
@@ -520,7 +501,7 @@ export function PhiTableWidgetClient({ config: inputConfig, renderMode, external
|
|
|
520
501
|
else if (route.capabilityId === "bindingParamsChange") {
|
|
521
502
|
const next = readPhiTableBindingParamsSignalValue(signal.value);
|
|
522
503
|
if (next)
|
|
523
|
-
updateBindingParams(
|
|
504
|
+
updateBindingParams(next.params, signal.correlationId);
|
|
524
505
|
}
|
|
525
506
|
else if (route.capabilityId === "reload") {
|
|
526
507
|
reload();
|
|
@@ -576,7 +557,7 @@ export function PhiTableWidgetClient({ config: inputConfig, renderMode, external
|
|
|
576
557
|
setConditionControllerStates((current) => ({ ...current, [signal.sender]: next.state }));
|
|
577
558
|
}
|
|
578
559
|
}
|
|
579
|
-
}, [activateAction,
|
|
560
|
+
}, [activateAction, bulkActions, conditionControllerAddresses, confirm, listenRoutes, reload, resource, rowActions, rows, setQuery, signalIdentity.receiver, toolbarActions, updateBindingParams, updateColumnOrder, updateExpandedRows, updateSelection]), useMemo(() => resolvePhiSignalListenFilter(listenRoutes), [listenRoutes]), signalIdentity.receiver);
|
|
580
561
|
useEffect(() => {
|
|
581
562
|
if (conditionControllerAddresses.size > 0) {
|
|
582
563
|
emitCapability("conditionStateRequest", null);
|
|
@@ -760,7 +741,7 @@ export function PhiTableWidgetClient({ config: inputConfig, renderMode, external
|
|
|
760
741
|
filters: initialFilters,
|
|
761
742
|
}));
|
|
762
743
|
};
|
|
763
|
-
const collectionFilters = hasSelfContainedTools && (configuredBindingFields.length > 0 || hasQueryTools) ? (_jsxs(PhiFlexControl, { align: "end", gap: token.paddingSM, wrap: true, children: [configuredBindingFields.map(({ field, tool }) => (_jsx(TableBindingTool, { field: field, tool: tool, sourceConfig: bindingParams, value: bindingParams[field.key], size: resolvedControlSize, onChange: (value) => updateBindingParams({
|
|
744
|
+
const collectionFilters = hasSelfContainedTools && (configuredBindingFields.length > 0 || hasQueryTools) ? (_jsxs(PhiFlexControl, { align: "end", gap: token.paddingSM, wrap: true, children: [configuredBindingFields.map(({ field, tool }) => (_jsx(TableBindingTool, { field: field, tool: tool, sourceConfig: bindingParams, value: bindingParams[field.key], size: resolvedControlSize, onChange: (value) => updateBindingParams({ [field.key]: value }), onCreate: field.create && tool.create ? async (value) => {
|
|
764
745
|
const result = await executeAction({
|
|
765
746
|
kind: "action",
|
|
766
747
|
actionKey: field.create.actionKey,
|
|
@@ -772,7 +753,7 @@ export function PhiTableWidgetClient({ config: inputConfig, renderMode, external
|
|
|
772
753
|
(typeof result.canonicalValue !== "string" && typeof result.canonicalValue !== "number")) {
|
|
773
754
|
return null;
|
|
774
755
|
}
|
|
775
|
-
updateBindingParams({
|
|
756
|
+
updateBindingParams({ [field.key]: result.canonicalValue });
|
|
776
757
|
return result.canonicalValue;
|
|
777
758
|
} : undefined }, field.key))), features.filters?.map((filter) => {
|
|
778
759
|
const control = (_jsx(TableFilter, { filter: filter, field: resource?.fields.find((field) => field.key === filter.key), sourceConfig: bindingParams, value: readTableFilterValue(filter, resolvedQuery.filters), labels: labels, size: resolvedControlSize, onChange: (value) => {
|
|
@@ -808,12 +789,13 @@ export function PhiTableWidgetClient({ config: inputConfig, renderMode, external
|
|
|
808
789
|
return _jsx(TableAction, { action: action, size: resolvedControlSize, disabled: selectedRowIdentities.length === 0 || Boolean(disabled), disabledReason: disabled && "reason" in disabled ? disabled.reason : undefined, templateValue: selectedRowIdentities.length, onActivate: () => activateAction(action, undefined, selectedRowIdentities) }, action.key);
|
|
809
790
|
}), hasQueryTools && features.tools?.reset !== false ? (_jsx(PhiButtonControl, { icon: _jsx(PhiIcon, { name: "rollback-outlined", size: "inherit" }), ariaLabel: labels.reset, tooltip: labels.reset, size: resolvedControlSize, onClick: resetQuery })) : null, features.tools?.reload ? (_jsx(PhiButtonControl, { icon: _jsx(PhiIcon, { name: "reload", size: "inherit" }), ariaLabel: labels.reload, tooltip: labels.reload, size: resolvedControlSize, onClick: reload })) : null] })) : null;
|
|
810
791
|
/*
|
|
811
|
-
* The source's failures end the Table here: a
|
|
812
|
-
*
|
|
813
|
-
*
|
|
792
|
+
* The source's failures end the Table here: a Provider the Area does not offer, a read that failed.
|
|
793
|
+
* A refused edit is not one of them -- it stays in `error` alone and is said above the rows to the
|
|
794
|
+
* person who made it. Whether the configuration fits the resource is not asked here: that is checked
|
|
795
|
+
* where the config is made (`checkPhiPresetTables`, the Builder's save), and a live Table trusts it.
|
|
814
796
|
*/
|
|
815
797
|
const refusal = isPhiTableProviderRefusal(queryError) ? queryError : null;
|
|
816
|
-
const sourceFailure = bindingError ??
|
|
798
|
+
const sourceFailure = bindingError ?? (refusal ? null : queryError?.message) ?? null;
|
|
817
799
|
if (sourceFailure) {
|
|
818
800
|
return (_jsx(PhiWidgetFailure, { renderMode: renderMode, widgetType: PhiCmsWidgetType.Table, title: sourceFailure, error: queryError }));
|
|
819
801
|
}
|
|
@@ -960,7 +942,7 @@ export function PhiTableWidgetClient({ config: inputConfig, renderMode, external
|
|
|
960
942
|
afterRowIdentity: null,
|
|
961
943
|
}).catch(() => undefined).finally(clearPhiDataDragPayload);
|
|
962
944
|
}
|
|
963
|
-
: undefined, loading: effectiveLoading, bordered: presentation.borders, striped: presentation.row?.striped, showHeader: presentation.header, stickyHeader: presentation.stickyHeader !== false, size: resolvedControlSize, emptyText: (_jsxs(PhiFlexControl, { vertical: true, gap: "small", children: [_jsx(PhiTypographyControl, { strong: true, children: refusal?.message ?? presentation.emptyState?.title ?? labels.emptyTitle }), emptyDescription && !refusal ? _jsx(PhiTypographyControl, { type: "secondary", children: emptyDescription }) : null] })), layout: presentation.layout, footer: footer, summary: tableSummary })] }));
|
|
945
|
+
: undefined, loading: effectiveLoading, loadingRows: presentation.loadingRows, bordered: presentation.borders, striped: presentation.row?.striped, showHeader: presentation.header, stickyHeader: presentation.stickyHeader !== false, size: resolvedControlSize, emptyText: (_jsxs(PhiFlexControl, { vertical: true, gap: "small", children: [_jsx(PhiTypographyControl, { strong: true, children: refusal?.message ?? presentation.emptyState?.title ?? labels.emptyTitle }), emptyDescription && !refusal ? _jsx(PhiTypographyControl, { type: "secondary", children: emptyDescription }) : null] })), layout: presentation.layout, footer: footer, summary: tableSummary })] }));
|
|
964
946
|
}
|
|
965
947
|
function TableAction({ action, disabled = false, disabledReason, templateValue, size, onActivate }) {
|
|
966
948
|
const icon = action.icon ? resolvePhiButtonIcon(action.icon) : null;
|
|
@@ -106,7 +106,7 @@ export declare const PHI_TABLE_WIDGET_DEFINITION: {
|
|
|
106
106
|
heading?: string;
|
|
107
107
|
} & {
|
|
108
108
|
type: "data-provider";
|
|
109
|
-
providerKind?: import("../../../../../types").PhiRuntimeDataProviderKind;
|
|
109
|
+
providerKind?: import("../../../../../types").PhiRuntimeDataProviderKind | readonly import("../../../../../types").PhiRuntimeDataProviderKind[];
|
|
110
110
|
providerKey?: import("@phis/contracts/controls").PhiRuntimeDataProviderKey;
|
|
111
111
|
}) | ({
|
|
112
112
|
key: string;
|
|
@@ -435,7 +435,7 @@ export declare const PHI_TABLE_WIDGET_DEFINITION: {
|
|
|
435
435
|
editorPlacement?: "inspector" | "geometry" | "toolbar";
|
|
436
436
|
heading?: string;
|
|
437
437
|
type: "data-provider";
|
|
438
|
-
providerKind?: import("../../../../../types").PhiRuntimeDataProviderKind;
|
|
438
|
+
providerKind?: import("../../../../../types").PhiRuntimeDataProviderKind | readonly import("../../../../../types").PhiRuntimeDataProviderKind[];
|
|
439
439
|
providerKey?: import("@phis/contracts/controls").PhiRuntimeDataProviderKey;
|
|
440
440
|
} | {
|
|
441
441
|
visibleWhen: {
|
|
@@ -827,7 +827,7 @@ export declare const PHI_TABLE_WIDGET_DEFINITION: {
|
|
|
827
827
|
editorPlacement?: "inspector" | "geometry" | "toolbar";
|
|
828
828
|
heading?: string;
|
|
829
829
|
type: "data-provider";
|
|
830
|
-
providerKind?: import("../../../../../types").PhiRuntimeDataProviderKind;
|
|
830
|
+
providerKind?: import("../../../../../types").PhiRuntimeDataProviderKind | readonly import("../../../../../types").PhiRuntimeDataProviderKind[];
|
|
831
831
|
providerKey?: import("@phis/contracts/controls").PhiRuntimeDataProviderKey;
|
|
832
832
|
} | {
|
|
833
833
|
visibleWhen: {
|
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import { resolvePhiCmsWidgetPluginKey } from "../../../../../constants/cms-widget-types";
|
|
2
|
+
import { PHI_TABLE_LOADING_ROWS_MAX } from "../../../../../constants/table-loading";
|
|
2
3
|
import { readPhiProviderResourceSource } from "../../../../../types/runtime-data-provider";
|
|
3
4
|
import { PHI_TABLE_TAG_COLORS, PHI_TABLE_TAG_VARIANTS, readPhiTableQuery, } from "../../../../../types/table-widget";
|
|
4
5
|
import { PHI_SIGNAL_VALUE_SCHEMAS, readPhiSignalRouteSet } from "../../../../../types/signals";
|
|
@@ -473,6 +474,8 @@ export function parsePhiTableWidgetConfig(config) {
|
|
|
473
474
|
header: presentation.boolean("header"),
|
|
474
475
|
stickyHeader: presentation.boolean("stickyHeader"),
|
|
475
476
|
footer: presentation.object("footer", readTableFooter),
|
|
477
|
+
footerOmitted: presentation.string("footerOmitted"),
|
|
478
|
+
loadingRows: presentation.value("loadingRows", `a whole number from 1 to ${PHI_TABLE_LOADING_ROWS_MAX}`, (value) => typeof value === "number" && Number.isInteger(value) && value >= 1 && value <= PHI_TABLE_LOADING_ROWS_MAX ? value : undefined),
|
|
476
479
|
summary: presentation.object("summary", readTableSummary),
|
|
477
480
|
row: {
|
|
478
481
|
striped: row.boolean("striped"),
|
|
@@ -450,7 +450,7 @@ export function PhiThreadConversationWidgetClient({ runtime, labels, config, })
|
|
|
450
450
|
* the frame instead -- a box around a box, and the sign that the Card was missing the prop.
|
|
451
451
|
*/
|
|
452
452
|
if (threadId == null) {
|
|
453
|
-
return (_jsx(PhiCardControl, { padding: config?.padding, children: _jsx(PhiTypographyControl, { type: "secondary", children: labels.noThreadText }) }));
|
|
453
|
+
return (_jsx(PhiCardControl, { padding: config?.padding, children: _jsx(PhiTypographyControl, { type: "secondary", children: config?.emptyDescription ?? labels.noThreadText }) }));
|
|
454
454
|
}
|
|
455
455
|
if (error && !detail) {
|
|
456
456
|
return (_jsx(PhiCardControl, { padding: config?.padding, children: _jsx(PhiAlertControl, { level: "error", title: labels.feedback.errorTitle, description: error }) }));
|
|
@@ -460,7 +460,7 @@ export function PhiThreadConversationWidgetClient({ runtime, labels, config, })
|
|
|
460
460
|
}
|
|
461
461
|
const archived = detail.thread.status === PhisThreadStatus.Archived;
|
|
462
462
|
const locked = isPhiThreadLocked(detail);
|
|
463
|
-
return (_jsx(_Fragment, { children: _jsx(PhiCardControl, { padding: config?.padding, toolbar: config?.reply && !archived && !locked ? (_jsx(PhiButtonControl, { label: labels.replyLabel, icon: _jsx(PhiIcon, { name: "antd:message-outlined", size: "inherit" }), size: "small", onClick: reply })) : undefined, title: _jsxs(PhiFlexControl, { align: "center", gap: "small", wrap: true, children: [readThreadTitle(detail, labels), archived ? (_jsx(PhiTagControl, { children: labels.archivedLabel })) : null, locked ? (_jsxs(PhiTagControl, { color: "warning", children: [_jsx(PhiIcon, { name: "antd:lock", size: "inherit" }), " ", labels.lockedLabel] })) : null] }), children: _jsxs(PhiFlexControl, { vertical: true, gap: "middle", children: [detail.thread.subject?.trim() && detail.participants.length > 0 ? (_jsx(PhiTypographyControl, { type: "secondary", children: `${labels.participantsLabel}: ${readParticipantNames(detail, labels).join(", ")}` })) : null, config?.reply && locked && !archived ? (_jsx(PhiAlertControl, { level: "info", showIcon: true, title: labels.lockedText })) : null, error ? (_jsx(PhiAlertControl, { level: "error", title: labels.feedback.errorTitle, description: error })) : null, detail.hasMoreMessages ? (_jsx(PhiButtonControl, { label: labels.olderLabel, type: "link", loading: loadingOlder, onClick: () => void loadOlder() })) : null, detail.messages.length === 0 ? (_jsx(PhiTypographyControl, { type: "secondary", children: labels.emptyText })) : (detail.messages.map((message, index) => (_jsxs(Fragment, { children: [index > 0 ? _jsx(PhiDividerControl, { style: { margin: 0 } }) : null, _jsx(PhiThreadMessageRow, { message: message, labels: labels, formatTime: formatTime, formatLanguage: formatLanguage, translation: translations[message.id] ?? null, canTranslate: translationTarget != null, onTranslate: translate })] }, message.id))))] }) }) }));
|
|
463
|
+
return (_jsx(_Fragment, { children: _jsx(PhiCardControl, { padding: config?.padding, toolbar: config?.reply && !archived && !locked ? (_jsx(PhiButtonControl, { label: config?.replyLabel ?? labels.replyLabel, icon: _jsx(PhiIcon, { name: "antd:message-outlined", size: "inherit" }), size: "small", onClick: reply })) : undefined, title: _jsxs(PhiFlexControl, { align: "center", gap: "small", wrap: true, children: [config?.title ?? readThreadTitle(detail, labels), archived ? (_jsx(PhiTagControl, { children: labels.archivedLabel })) : null, locked ? (_jsxs(PhiTagControl, { color: "warning", children: [_jsx(PhiIcon, { name: "antd:lock", size: "inherit" }), " ", labels.lockedLabel] })) : null] }), children: _jsxs(PhiFlexControl, { vertical: true, gap: "middle", children: [detail.thread.subject?.trim() && detail.participants.length > 0 ? (_jsx(PhiTypographyControl, { type: "secondary", children: `${labels.participantsLabel}: ${readParticipantNames(detail, labels).join(", ")}` })) : null, config?.reply && locked && !archived ? (_jsx(PhiAlertControl, { level: "info", showIcon: true, title: labels.lockedText })) : null, error ? (_jsx(PhiAlertControl, { level: "error", title: labels.feedback.errorTitle, description: error })) : null, detail.hasMoreMessages ? (_jsx(PhiButtonControl, { label: labels.olderLabel, type: "link", loading: loadingOlder, onClick: () => void loadOlder() })) : null, detail.messages.length === 0 ? (_jsx(PhiTypographyControl, { type: "secondary", children: labels.emptyText })) : (detail.messages.map((message, index) => (_jsxs(Fragment, { children: [index > 0 ? _jsx(PhiDividerControl, { style: { margin: 0 } }) : null, _jsx(PhiThreadMessageRow, { message: message, labels: labels, formatTime: formatTime, formatLanguage: formatLanguage, translation: translations[message.id] ?? null, canTranslate: translationTarget != null, onTranslate: translate })] }, message.id))))] }) }) }));
|
|
464
464
|
}
|
|
465
465
|
/** Whether Core takes new messages into this conversation; `PhisThreadFlag.Locked` says it does not. */
|
|
466
466
|
export function isPhiThreadLocked(detail) {
|
|
@@ -46,10 +46,14 @@ export declare const PHI_THREAD_CONVERSATION_WIDGET_DEFINITION: {
|
|
|
46
46
|
valueSchema: `${string}/signals/${string}`;
|
|
47
47
|
})[];
|
|
48
48
|
};
|
|
49
|
-
fields: {
|
|
49
|
+
fields: ({
|
|
50
50
|
key: string;
|
|
51
51
|
type: "boolean";
|
|
52
52
|
label: string;
|
|
53
|
-
}
|
|
53
|
+
} | {
|
|
54
|
+
key: string;
|
|
55
|
+
type: "string";
|
|
56
|
+
label: string;
|
|
57
|
+
})[];
|
|
54
58
|
parseConfig: typeof parsePhiThreadWidgetConfig;
|
|
55
59
|
};
|
|
@@ -60,6 +60,11 @@ export const PHI_THREAD_CONVERSATION_WIDGET_DEFINITION = {
|
|
|
60
60
|
{ id: "reply", action: "activate", valueType: "json", valueSchema: PHI_SIGNAL_VALUE_SCHEMAS.tableAction },
|
|
61
61
|
],
|
|
62
62
|
},
|
|
63
|
-
fields: [
|
|
63
|
+
fields: [
|
|
64
|
+
{ key: "reply", type: "boolean", label: "Offer a reply" },
|
|
65
|
+
{ key: "replyLabel", type: "string", label: "Reply label" },
|
|
66
|
+
{ key: "title", type: "string", label: "Heading" },
|
|
67
|
+
{ key: "emptyDescription", type: "string", label: "Text without a conversation" },
|
|
68
|
+
],
|
|
64
69
|
parseConfig: parsePhiThreadWidgetConfig,
|
|
65
70
|
};
|
|
@@ -19,6 +19,16 @@ export type PhiThreadWidgetConfig = {
|
|
|
19
19
|
* conversation, which takes no new messages.
|
|
20
20
|
*/
|
|
21
21
|
reply?: boolean;
|
|
22
|
+
/**
|
|
23
|
+
* The heading in place of the conversation's own subject, for a placement that always shows one kind of
|
|
24
|
+
* conversation and names it -- a customer file's File, which Core opens without a subject. Already in the
|
|
25
|
+
* reader's language.
|
|
26
|
+
*/
|
|
27
|
+
title?: string;
|
|
28
|
+
/** What the Reply says, where the placement offers it as something else -- "Add note" in a file. */
|
|
29
|
+
replyLabel?: string;
|
|
30
|
+
/** The sentence where no conversation is chosen yet, in place of the Widget's own. */
|
|
31
|
+
emptyDescription?: string;
|
|
22
32
|
signalRoutes?: PhiSignalRouteSet | null;
|
|
23
33
|
};
|
|
24
34
|
export declare function parsePhiThreadWidgetConfig(rawConfig: Record<string, unknown> | null | undefined): PhiThreadWidgetConfig;
|
|
@@ -1,11 +1,17 @@
|
|
|
1
1
|
import { readPhiSignalRouteSet, } from "../../../../types/signals";
|
|
2
2
|
import { findPhiControlListenRoute } from "../../../../components/widgets/client/shared/phi-control-signal-routing";
|
|
3
|
+
function readText(value) {
|
|
4
|
+
return typeof value === "string" && value.trim() ? value.trim() : undefined;
|
|
5
|
+
}
|
|
3
6
|
export function parsePhiThreadWidgetConfig(rawConfig) {
|
|
4
7
|
const raw = rawConfig ?? {};
|
|
5
8
|
const padding = raw.padding;
|
|
6
9
|
return {
|
|
7
10
|
padding: typeof padding === "number" || typeof padding === "string" ? padding : undefined,
|
|
8
11
|
reply: raw.reply === true,
|
|
12
|
+
title: readText(raw.title),
|
|
13
|
+
replyLabel: readText(raw.replyLabel),
|
|
14
|
+
emptyDescription: readText(raw.emptyDescription),
|
|
9
15
|
signalRoutes: readPhiSignalRouteSet(raw.signalRoutes),
|
|
10
16
|
};
|
|
11
17
|
}
|
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
import { jsx as _jsx, Fragment as _Fragment, jsxs as _jsxs } from "react/jsx-runtime";
|
|
3
3
|
import { isPhiRecord } from "../../../../../helpers/is-record";
|
|
4
4
|
import { useCallback, useEffect, useMemo, useState } from "react";
|
|
5
|
-
import { readPhiTreeProviderError
|
|
5
|
+
import { readPhiTreeProviderError } from "../../../../../types/tree-widget";
|
|
6
6
|
import { usePhiTreeBinding } from "../../../../../components/trees/client/phi-tree-binding";
|
|
7
7
|
import { PhiTreeActionButton, PhiTreeControl } from "../../../../../components/controls/phi-tree-control";
|
|
8
8
|
import { PhiTextControl } from "../../../../../components/controls/phi-text-control";
|
|
@@ -84,7 +84,6 @@ export function PhiTreeWidgetClient({ config, labels, renderMode }) {
|
|
|
84
84
|
binding.setQuery({ ...(config.initialQuery ?? {}) });
|
|
85
85
|
emitCapability("bindingParamsChange", { params: nextParams });
|
|
86
86
|
}, [binding, config.initialQuery, config.source?.params, emitCapability, setBindingParams]);
|
|
87
|
-
const contractError = binding.resource ? validatePhiTreeWidgetBinding(config, binding.resource)[0] ?? null : null;
|
|
88
87
|
const treeQuery = binding.query;
|
|
89
88
|
const setTreeQuery = binding.setQuery;
|
|
90
89
|
const activate = useCallback((action, identity, correlationId) => {
|
|
@@ -186,11 +185,12 @@ export function PhiTreeWidgetClient({ config, labels, renderMode }) {
|
|
|
186
185
|
hasResettableQuery && tools?.reset !== false ||
|
|
187
186
|
tools?.reload === true) ? (_jsxs(PhiToolbarControl, { size: controlSize, compact: true, children: [(config.features.actions?.toolbar ?? []).map((action) => (_jsx(PhiTreeActionButton, { action: action, size: controlSize, onActivate: () => activate(action) }, action.key))), (config.features.actions?.selection ?? []).map((action) => (_jsx(PhiTreeActionButton, { action: action, size: controlSize, disabled: binding.selectedNodeIdentities.length === 0, onActivate: () => activate(action) }, action.key))), hasResettableQuery && tools?.reset !== false ? (_jsx(PhiButtonControl, { icon: _jsx(PhiIcon, { name: "rollback-outlined", size: "inherit" }), ariaLabel: labels.reset, tooltip: labels.reset, size: controlSize, onClick: resetTools })) : null, tools?.reload ? (_jsx(PhiButtonControl, { icon: _jsx(PhiIcon, { name: "reload", size: "inherit" }), ariaLabel: labels.reload, tooltip: labels.reload, size: controlSize, onClick: binding.reload })) : null] })) : null;
|
|
188
187
|
/*
|
|
189
|
-
* The source's failures end the Tree here: a
|
|
190
|
-
*
|
|
191
|
-
*
|
|
188
|
+
* The source's failures end the Tree here: a Provider the Area does not offer, a read that failed. A
|
|
189
|
+
* refused change stays in `binding.error` alone, said above the nodes to the person who made it. The
|
|
190
|
+
* configuration against the resource is checked where it is made (`checkPhiPresetTables`, the
|
|
191
|
+
* Builder's save), not here.
|
|
192
192
|
*/
|
|
193
|
-
const sourceFailure = binding.bindingError ??
|
|
193
|
+
const sourceFailure = binding.bindingError ?? binding.queryError?.message ?? null;
|
|
194
194
|
if (sourceFailure) {
|
|
195
195
|
return (_jsx(PhiWidgetFailure, { renderMode: renderMode, widgetType: PhiCmsWidgetType.Tree, title: sourceFailure, error: binding.queryError }));
|
|
196
196
|
}
|
|
@@ -37,6 +37,7 @@ const PHI_EDITOR_TRANSLATIONS_WIDGET_LABEL_SET = definePhiRuntimeModuleLabelSet(
|
|
|
37
37
|
delete_description: definePhiMessageLabel("Delete this translated variant?"),
|
|
38
38
|
empty_title: definePhiMessageLabel("No translations found."),
|
|
39
39
|
empty_text: definePhiMessageLabel("No source messages match the current filters."),
|
|
40
|
+
footer_count: "%1 source messages",
|
|
40
41
|
load_error: definePhiMessageLabel("Failed to load translations."),
|
|
41
42
|
save_error: definePhiMessageLabel("Failed to save translation."),
|
|
42
43
|
required_translation: definePhiMessageLabel("A translation is required."),
|
|
@@ -91,6 +92,7 @@ export async function getPhiEditorTranslationsWidgetLabels(options) {
|
|
|
91
92
|
title: labels.empty_title,
|
|
92
93
|
text: labels.empty_text,
|
|
93
94
|
},
|
|
95
|
+
footer: labels.footer_count,
|
|
94
96
|
feedback: {
|
|
95
97
|
saveSuccess: labels.save_success,
|
|
96
98
|
deleteSuccess: labels.delete_success,
|
package/plugins/runtime-modules/localization/trees/phi-default-editor-translations-page-tree.js
CHANGED
|
@@ -162,6 +162,11 @@ export async function buildPhiDefaultEditorTranslationsPageTree({ page, runtime,
|
|
|
162
162
|
{ key: "updatedAt", fieldKey: "updatedAt", title: widgetLabels.columns.updated, renderer: "datetime", sizing: { mode: "content", minWidth: 168 } },
|
|
163
163
|
],
|
|
164
164
|
emptyState: { title: widgetLabels.empty.title, description: widgetLabels.empty.text },
|
|
165
|
+
footer: {
|
|
166
|
+
template: widgetLabels.footer,
|
|
167
|
+
values: [{ key: "messages", value: { source: "core", fieldKey: "totalRows" } }],
|
|
168
|
+
align: "start",
|
|
169
|
+
},
|
|
165
170
|
controlSize: "small",
|
|
166
171
|
},
|
|
167
172
|
features: {
|
|
@@ -0,0 +1,37 @@
|
|
|
1
|
+
import { type PhiBuilderAreaKey } from "../../../../constants/cms-areas";
|
|
2
|
+
import type { PhiWorkspaceCatalogState } from "../../../../components/workspace/catalog-state";
|
|
3
|
+
import { type PhiCmsReviewKind } from "../../../../helpers/cms-scope-search-params";
|
|
4
|
+
/** The scope the Revisions Controller hands the history Table: the one binding the Table reads by. */
|
|
5
|
+
export type PhiRevisionsTableBinding = {
|
|
6
|
+
area: PhiBuilderAreaKey;
|
|
7
|
+
kind: PhiCmsReviewKind;
|
|
8
|
+
scopeKey: string;
|
|
9
|
+
};
|
|
10
|
+
type CatalogState = Pick<PhiWorkspaceCatalogState, "area" | "pageKey" | "catalogHydrated" | "pageCatalogHydratedByArea" | "modulePresetPagesByArea" | "customPages" | "persistedPageCatalogByArea">;
|
|
11
|
+
/**
|
|
12
|
+
* Whether the workspace catalog stands for the Area the address names.
|
|
13
|
+
*
|
|
14
|
+
* Before the Builder has read the address, the catalog answers its default Area (`public`) with whatever
|
|
15
|
+
* it holds of it; a scope resolved then belongs to another Area -- a Module Page of the App was asked for
|
|
16
|
+
* as a Public Page and, handed to the Table, written back into the address as the Public Area. So nothing
|
|
17
|
+
* is resolved until the preload is in, the open Area is the one the address names, and its Pages are read.
|
|
18
|
+
*/
|
|
19
|
+
export declare function isPhiRevisionsCatalogReady(state: CatalogState, search: URLSearchParams): boolean;
|
|
20
|
+
/** The kind the address names, the Area where it names none. */
|
|
21
|
+
export declare function readPhiRevisionsAddressKind(search: URLSearchParams): PhiCmsReviewKind;
|
|
22
|
+
/**
|
|
23
|
+
* The scope the address names, resolved against the workspace catalog -- or null while the catalog does
|
|
24
|
+
* not stand for that address yet (`isPhiRevisionsCatalogReady`), which is a moment, not a fault.
|
|
25
|
+
*/
|
|
26
|
+
export declare function resolvePhiRevisionsControllerBinding(state: CatalogState, search: URLSearchParams): PhiRevisionsTableBinding | null;
|
|
27
|
+
/**
|
|
28
|
+
* The binding a Table request carries, when it carries a whole one.
|
|
29
|
+
*
|
|
30
|
+
* The history Table mounts with its labels and nothing to ask about; the Controller hands it the scope
|
|
31
|
+
* once the catalog stands for the address. Until then -- and while a kind chosen in the Table's own
|
|
32
|
+
* select still stands beside the scope of the kind before it, until the scope select answers -- there is
|
|
33
|
+
* no question, and a request that asked one anyway asked for the wrong history and was thrown away a
|
|
34
|
+
* moment later: the flicker of the Table on every open.
|
|
35
|
+
*/
|
|
36
|
+
export declare function readPhiRevisionsTableBinding(params: unknown): PhiRevisionsTableBinding | null;
|
|
37
|
+
export {};
|
|
@@ -0,0 +1,75 @@
|
|
|
1
|
+
import { isPhiBuilderAreaKey } from "../../../../constants/cms-areas";
|
|
2
|
+
import { PHI_BUILDER_AREA_SEARCH_PARAM, PHI_BUILDER_NAVIGATION_KEY_SEARCH_PARAM, PHI_BUILDER_PAGE_SEARCH_PARAM, PHI_BUILDER_REVISIONS_KIND_SEARCH_PARAM, PHI_BUILDER_REVISIONS_SCOPE_SEARCH_PARAM, PHI_BUILDER_THEME_KEY_SEARCH_PARAM, normalizePhiBuilderAreaSearchParam, normalizePhiBuilderPageSearchParam, normalizePhiBuilderRevisionsKindSearchParam, } from "../../../../helpers/cms-scope-search-params";
|
|
3
|
+
import { resolvePhiBuilderActivePageCatalog, resolvePhiBuilderActivePageKey, } from "../../../../helpers/cms-page-catalog";
|
|
4
|
+
import { resolvePhiBuilderRevisionNavScopeKey } from "../../../../helpers/cms-navigation-scope-key";
|
|
5
|
+
import { resolvePhiBuilderRevisionPagePath } from "../types";
|
|
6
|
+
import { isPhiRecord } from "../../../../helpers/is-record";
|
|
7
|
+
/**
|
|
8
|
+
* Whether the workspace catalog stands for the Area the address names.
|
|
9
|
+
*
|
|
10
|
+
* Before the Builder has read the address, the catalog answers its default Area (`public`) with whatever
|
|
11
|
+
* it holds of it; a scope resolved then belongs to another Area -- a Module Page of the App was asked for
|
|
12
|
+
* as a Public Page and, handed to the Table, written back into the address as the Public Area. So nothing
|
|
13
|
+
* is resolved until the preload is in, the open Area is the one the address names, and its Pages are read.
|
|
14
|
+
*/
|
|
15
|
+
export function isPhiRevisionsCatalogReady(state, search) {
|
|
16
|
+
if (!state.catalogHydrated || state.pageCatalogHydratedByArea[state.area] !== true)
|
|
17
|
+
return false;
|
|
18
|
+
const area = normalizePhiBuilderAreaSearchParam(search.get(PHI_BUILDER_AREA_SEARCH_PARAM));
|
|
19
|
+
return area == null || area === state.area;
|
|
20
|
+
}
|
|
21
|
+
/** The kind the address names, the Area where it names none. */
|
|
22
|
+
export function readPhiRevisionsAddressKind(search) {
|
|
23
|
+
return normalizePhiBuilderRevisionsKindSearchParam(search.get(PHI_BUILDER_REVISIONS_KIND_SEARCH_PARAM)) ?? "area";
|
|
24
|
+
}
|
|
25
|
+
/**
|
|
26
|
+
* The scope the address names, resolved against the workspace catalog -- or null while the catalog does
|
|
27
|
+
* not stand for that address yet (`isPhiRevisionsCatalogReady`), which is a moment, not a fault.
|
|
28
|
+
*/
|
|
29
|
+
export function resolvePhiRevisionsControllerBinding(state, search) {
|
|
30
|
+
if (!isPhiRevisionsCatalogReady(state, search))
|
|
31
|
+
return null;
|
|
32
|
+
const pages = resolvePhiBuilderActivePageCatalog(state.area, state.modulePresetPagesByArea, state.customPages, state.persistedPageCatalogByArea);
|
|
33
|
+
const pageKey = resolvePhiBuilderActivePageKey(normalizePhiBuilderPageSearchParam(search.get(PHI_BUILDER_PAGE_SEARCH_PARAM)) ?? state.pageKey, pages);
|
|
34
|
+
if (!pageKey)
|
|
35
|
+
return null;
|
|
36
|
+
const kind = readPhiRevisionsAddressKind(search);
|
|
37
|
+
const requestedScope = search.get(PHI_BUILDER_REVISIONS_SCOPE_SEARCH_PARAM)?.trim() ?? "";
|
|
38
|
+
const scopeKey = kind === "page"
|
|
39
|
+
? requestedScope.startsWith("/")
|
|
40
|
+
? requestedScope
|
|
41
|
+
: resolvePhiBuilderRevisionPagePath(state.area, pageKey, pages)
|
|
42
|
+
: kind === "navigation"
|
|
43
|
+
? requestedScope.includes(":")
|
|
44
|
+
? requestedScope
|
|
45
|
+
: resolvePhiBuilderRevisionNavScopeKey(state.area, search.get(PHI_BUILDER_NAVIGATION_KEY_SEARCH_PARAM))
|
|
46
|
+
: kind === "theme"
|
|
47
|
+
? requestedScope || search.get(PHI_BUILDER_THEME_KEY_SEARCH_PARAM) || "default"
|
|
48
|
+
: normalizePhiBuilderAreaSearchParam(requestedScope) ?? state.area;
|
|
49
|
+
return { area: state.area, kind, scopeKey };
|
|
50
|
+
}
|
|
51
|
+
/**
|
|
52
|
+
* The binding a Table request carries, when it carries a whole one.
|
|
53
|
+
*
|
|
54
|
+
* The history Table mounts with its labels and nothing to ask about; the Controller hands it the scope
|
|
55
|
+
* once the catalog stands for the address. Until then -- and while a kind chosen in the Table's own
|
|
56
|
+
* select still stands beside the scope of the kind before it, until the scope select answers -- there is
|
|
57
|
+
* no question, and a request that asked one anyway asked for the wrong history and was thrown away a
|
|
58
|
+
* moment later: the flicker of the Table on every open.
|
|
59
|
+
*/
|
|
60
|
+
export function readPhiRevisionsTableBinding(params) {
|
|
61
|
+
if (!isPhiRecord(params) || !isPhiBuilderAreaKey(params.area))
|
|
62
|
+
return null;
|
|
63
|
+
const kind = normalizePhiBuilderRevisionsKindSearchParam(params.kind);
|
|
64
|
+
const scopeKey = typeof params.scopeKey === "string" ? params.scopeKey.trim() : "";
|
|
65
|
+
if (!kind || !scopeKey)
|
|
66
|
+
return null;
|
|
67
|
+
const fits = kind === "area"
|
|
68
|
+
? isPhiBuilderAreaKey(scopeKey)
|
|
69
|
+
: kind === "page"
|
|
70
|
+
? scopeKey.startsWith("/")
|
|
71
|
+
: kind === "navigation"
|
|
72
|
+
? scopeKey.includes(":")
|
|
73
|
+
: !isPhiBuilderAreaKey(scopeKey);
|
|
74
|
+
return fits ? { area: params.area, kind, scopeKey } : null;
|
|
75
|
+
}
|
|
@@ -23,6 +23,11 @@ export declare const PHI_REVISIONS_RUNTIME_CONTROLLER_PLUGIN: {
|
|
|
23
23
|
action: "change";
|
|
24
24
|
valueType: "string";
|
|
25
25
|
valueSchema?: undefined;
|
|
26
|
+
} | {
|
|
27
|
+
id: string;
|
|
28
|
+
action: "change";
|
|
29
|
+
valueType: "boolean";
|
|
30
|
+
valueSchema?: undefined;
|
|
26
31
|
} | {
|
|
27
32
|
id: string;
|
|
28
33
|
action: "activate";
|