@phis/ui 0.8.1 → 0.8.3
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/README.md +9 -2
- package/components/calendar/gregory-calendar-adapter-client.js +1 -0
- package/components/controls/phi-accordion-control.d.ts +6 -0
- package/components/controls/phi-accordion-control.js +8 -13
- package/components/controls/phi-background-control.js +2 -5
- package/components/controls/phi-builder-insert-picker-control-labels.d.ts +2 -0
- package/components/controls/phi-builder-insert-picker-control-labels.js +1 -0
- package/components/controls/phi-builder-insert-picker-control.js +10 -11
- package/components/controls/phi-cascader-control.d.ts +9 -3
- package/components/controls/phi-cascader-control.js +38 -10
- package/components/controls/phi-checkbox-group-control.d.ts +3 -1
- package/components/controls/phi-checkbox-group-control.js +2 -2
- package/components/controls/phi-collapse-control.d.ts +9 -2
- package/components/controls/phi-collapse-control.js +14 -2
- package/components/controls/phi-color-control.d.ts +3 -1
- package/components/controls/phi-color-control.js +2 -2
- package/components/controls/phi-color-field-control.d.ts +6 -1
- package/components/controls/phi-color-field-control.js +2 -2
- package/components/controls/phi-confirm-control.d.ts +1 -1
- package/components/controls/phi-confirm-control.js +71 -2
- package/components/controls/phi-confirm-dialog.js +2 -1
- package/components/controls/phi-date-picker-control.js +1 -1
- package/components/controls/phi-dimension-control.d.ts +3 -1
- package/components/controls/phi-dimension-control.js +2 -2
- package/components/controls/phi-geometry-control.js +1 -1
- package/components/controls/phi-length-control.d.ts +6 -1
- package/components/controls/phi-length-control.js +3 -2
- package/components/controls/phi-multi-select-control.d.ts +6 -1
- package/components/controls/phi-multi-select-control.js +3 -3
- package/components/controls/phi-segmented-control.d.ts +6 -1
- package/components/controls/phi-segmented-control.js +3 -3
- package/components/controls/phi-switch-control.d.ts +3 -1
- package/components/controls/phi-switch-control.js +3 -3
- package/components/controls/phi-table-control.d.ts +8 -1
- package/components/controls/phi-table-control.js +11 -5
- package/components/forms/compound-form-controls.js +16 -1
- package/components/layouts/clients/phi-collapsible-layout-client.js +2 -6
- package/components/media/media-upload-flow.d.ts +62 -5
- package/components/media/media-upload-flow.js +62 -24
- package/components/media/media-widget-labels.d.ts +2 -0
- package/components/media/media-widget-labels.js +2 -0
- package/components/media/phi-area-upload-widget.d.ts +44 -1
- package/components/media/phi-area-upload-widget.js +32 -7
- package/components/media/phi-asset-inspector-section.js +19 -1
- package/components/media/phi-media-upload.d.ts +10 -3
- package/components/media/phi-media-upload.js +11 -8
- package/components/regions/presets/phi-area-shell-preset-nodes.js +2 -0
- package/components/shell/phi-builder-icon.js +9 -1
- package/components/shell/phi-widget-icon.js +1 -0
- package/components/tables/phi-table-surface.d.ts +25 -0
- package/components/tables/phi-table-surface.js +25 -0
- package/components/widgets/builder/phi-static-rows-editor.js +4 -1
- package/components/widgets/client/html-editor-link-node.d.ts +12 -0
- package/components/widgets/client/html-editor-link-node.js +60 -0
- package/components/widgets/client/html-editor.js +10 -6
- package/components/widgets/client/shared/phi-choice-controller.d.ts +8 -1
- package/components/widgets/client/shared/phi-choice-controller.js +16 -1
- package/components/widgets/client/shared/phi-collection-view-binding.js +33 -26
- package/components/widgets/config/choice-shared.d.ts +2 -0
- package/components/widgets/config/choice-shared.js +1 -0
- package/components/widgets/config/image-variant-options.d.ts +4 -1
- package/components/widgets/config/image-variant-options.js +27 -14
- package/components/widgets/inspector-field-row.d.ts +14 -1
- package/components/widgets/inspector-field-row.js +21 -1
- package/components/widgets/label-sets/builder-chrome.js +2 -0
- package/components/widgets/label-sets/inspector.js +10 -0
- package/components/widgets/label-sets/security.js +2 -0
- package/components/widgets/label-types/inspector.d.ts +5 -0
- package/components/widgets/label-types/inspector.js +5 -0
- package/components/widgets/label-types/security.d.ts +2 -0
- package/components/widgets/signals/signal-endpoint-list.js +4 -1
- package/constants/cms-widget-types.d.ts +1 -0
- package/constants/cms-widget-types.js +3 -0
- package/constants/runtime-module-ownership.js +1 -0
- package/gateway/site-proxy.d.ts +12 -0
- package/gateway/site-proxy.js +20 -0
- package/helpers/cms-inspector-drawer.d.ts +15 -0
- package/helpers/cms-inspector-drawer.js +37 -0
- package/helpers/cms-layout-defaults.js +1 -1
- package/helpers/preset-tree-contract-check.js +56 -0
- package/helpers/text-source.js +2 -0
- package/net/phi-next-proxy.d.ts +7 -0
- package/net/phi-next-proxy.js +1 -1
- package/package.json +27 -14
- package/plugins/runtime-modules/accounting/definition.d.ts +1 -1
- package/plugins/runtime-modules/accounting/definition.js +0 -1
- package/plugins/runtime-modules/accounting/ids.d.ts +4 -4
- package/plugins/runtime-modules/accounting/ids.js +4 -2
- package/plugins/runtime-modules/accounting/module.d.ts +1 -1
- package/plugins/runtime-modules/accounting/trees/accounting-customer-file-label-set.js +2 -1
- package/plugins/runtime-modules/accounting/trees/phi-default-accounting-customer-file-page-tree.d.ts +5 -4
- package/plugins/runtime-modules/accounting/trees/phi-default-accounting-customer-file-page-tree.js +80 -38
- package/plugins/runtime-modules/admin/definition.d.ts +1 -1
- package/plugins/runtime-modules/admin/definition.js +0 -1
- package/plugins/runtime-modules/admin/module.d.ts +1 -1
- package/plugins/runtime-modules/app/definition.d.ts +1 -1
- package/plugins/runtime-modules/app/definition.js +0 -1
- package/plugins/runtime-modules/app/module.d.ts +1 -1
- package/plugins/runtime-modules/area-base-definition.d.ts +19 -1
- package/plugins/runtime-modules/area-base-definition.js +18 -0
- package/plugins/runtime-modules/area-contributions/admin.d.ts +1 -1
- package/plugins/runtime-modules/area-contributions/admin.js +2 -0
- package/plugins/runtime-modules/area-definitions.d.ts +8 -8
- package/plugins/runtime-modules/area-definitions.js +4 -3
- package/plugins/runtime-modules/area-root-route.d.ts +8 -0
- package/plugins/runtime-modules/area-root-route.js +11 -1
- package/plugins/runtime-modules/asset/labels.js +4 -0
- package/plugins/runtime-modules/asset/metadata-form.d.ts +0 -28
- package/plugins/runtime-modules/asset/metadata-form.js +6 -10
- package/plugins/runtime-modules/asset/services/options.d.ts +3 -2
- package/plugins/runtime-modules/asset/services/options.js +4 -3
- package/plugins/runtime-modules/asset/trees/phi-default-admin-media-settings-page-tree.js +2 -1
- package/plugins/runtime-modules/asset/trees/phi-default-builder-media-page-tree.js +3 -3
- package/plugins/runtime-modules/auth/widgets/security/client.js +2 -2
- package/plugins/runtime-modules/avatar/addresses.d.ts +1 -1
- package/plugins/runtime-modules/builder/addresses.d.ts +1 -1
- package/plugins/runtime-modules/builder/addresses.js +1 -1
- package/plugins/runtime-modules/builder/area-settings-form.js +1 -1
- package/plugins/runtime-modules/builder/clients/inspector-condition-group.d.ts +16 -0
- package/plugins/runtime-modules/builder/clients/inspector-condition-group.js +9 -0
- package/plugins/runtime-modules/builder/clients/inspector-config-field.js +97 -10
- package/plugins/runtime-modules/builder/clients/pages-header.js +7 -6
- package/plugins/runtime-modules/builder/clients/region-visibility-fields.js +1 -1
- package/plugins/runtime-modules/builder/controller/workspace-controller.js +7 -4
- package/plugins/runtime-modules/builder/definition.d.ts +1 -1
- package/plugins/runtime-modules/builder/definition.js +0 -1
- package/plugins/runtime-modules/builder/offered-page-catalog.d.ts +10 -4
- package/plugins/runtime-modules/builder/offered-page-catalog.js +35 -8
- package/plugins/runtime-modules/builder/page-meta-form.js +5 -2
- package/plugins/runtime-modules/builder/plugin-meta-labels.js +8 -0
- package/plugins/runtime-modules/builder/trees/phi-builder-inspector-area-overlay-tree.server.js +4 -2
- package/plugins/runtime-modules/builder/trees/phi-default-builder-area-preset-tree.js +20 -13
- package/plugins/runtime-modules/builder/workspace-catalog-actions.js +8 -1
- package/plugins/runtime-modules/cdn/authoring-widgets.d.ts +3 -0
- package/plugins/runtime-modules/cdn/authoring-widgets.js +7 -0
- package/plugins/runtime-modules/cdn/authoring.d.ts +1 -0
- package/plugins/runtime-modules/cdn/authoring.js +8 -0
- package/plugins/runtime-modules/cdn/bytes.d.ts +5 -0
- package/plugins/runtime-modules/cdn/bytes.js +17 -0
- package/plugins/runtime-modules/cdn/client-data-providers.d.ts +7 -0
- package/plugins/runtime-modules/cdn/client-data-providers.js +9 -0
- package/plugins/runtime-modules/cdn/data-providers.d.ts +134 -0
- package/plugins/runtime-modules/cdn/data-providers.js +117 -0
- package/plugins/runtime-modules/cdn/definition.d.ts +140 -0
- package/plugins/runtime-modules/cdn/definition.js +23 -0
- package/plugins/runtime-modules/cdn/ids.d.ts +18 -0
- package/plugins/runtime-modules/cdn/ids.js +20 -0
- package/plugins/runtime-modules/cdn/module.d.ts +131 -0
- package/plugins/runtime-modules/cdn/module.js +4 -0
- package/plugins/runtime-modules/cdn/platform.d.ts +25 -0
- package/plugins/runtime-modules/cdn/platform.js +73 -0
- package/plugins/runtime-modules/cdn/presets.d.ts +2 -0
- package/plugins/runtime-modules/cdn/presets.js +20 -0
- package/plugins/runtime-modules/cdn/server.d.ts +1 -0
- package/plugins/runtime-modules/cdn/server.js +14 -0
- package/plugins/runtime-modules/cdn/services/table.d.ts +11 -0
- package/plugins/runtime-modules/cdn/services/table.js +296 -0
- package/plugins/runtime-modules/cdn/services/upload.d.ts +20 -0
- package/plugins/runtime-modules/cdn/services/upload.js +146 -0
- package/plugins/runtime-modules/cdn/table-params.d.ts +10 -0
- package/plugins/runtime-modules/cdn/table-params.js +10 -0
- package/plugins/runtime-modules/cdn/trees/admin-cdn-label-set.d.ts +95 -0
- package/plugins/runtime-modules/cdn/trees/admin-cdn-label-set.js +156 -0
- package/plugins/runtime-modules/cdn/trees/phi-default-admin-cdn-page-tree.d.ts +18 -0
- package/plugins/runtime-modules/cdn/trees/phi-default-admin-cdn-page-tree.js +491 -0
- package/plugins/runtime-modules/cdn/widgets/upload/client.d.ts +12 -0
- package/plugins/runtime-modules/cdn/widgets/upload/client.js +138 -0
- package/plugins/runtime-modules/cdn/widgets/upload/config.d.ts +29 -0
- package/plugins/runtime-modules/cdn/widgets/upload/config.js +43 -0
- package/plugins/runtime-modules/cdn/widgets/upload/label-types.d.ts +24 -0
- package/plugins/runtime-modules/cdn/widgets/upload/label-types.js +1 -0
- package/plugins/runtime-modules/cdn/widgets/upload/labels.d.ts +4 -0
- package/plugins/runtime-modules/cdn/widgets/upload/labels.js +72 -0
- package/plugins/runtime-modules/cdn/widgets/upload/plugin.d.ts +3 -0
- package/plugins/runtime-modules/cdn/widgets/upload/plugin.js +7 -0
- package/plugins/runtime-modules/cdn/widgets/upload/server.d.ts +8 -0
- package/plugins/runtime-modules/cdn/widgets/upload/server.js +17 -0
- package/plugins/runtime-modules/cdn/widgets.d.ts +2 -0
- package/plugins/runtime-modules/cdn/widgets.js +13 -0
- package/plugins/runtime-modules/client-authoring-providers/admin.d.ts +1 -1
- package/plugins/runtime-modules/client-authoring-providers/admin.js +6 -0
- package/plugins/runtime-modules/client-manifests/admin.js +11 -1
- package/plugins/runtime-modules/core/authoring-widgets.js +2 -1
- package/plugins/runtime-modules/core/messaging/label-defaults.d.ts +49 -0
- package/plugins/runtime-modules/core/messaging/label-defaults.js +48 -0
- package/plugins/runtime-modules/core/messaging/labels.d.ts +2 -28
- package/plugins/runtime-modules/core/messaging/labels.js +52 -23
- package/plugins/runtime-modules/core/widgets/card/config.d.ts +14 -0
- package/plugins/runtime-modules/core/widgets/collection-view/asset-binding.js +1 -1
- package/plugins/runtime-modules/core/widgets/collection-view/site-address-binding.js +3 -1
- package/plugins/runtime-modules/core/widgets/command-toolbar/config.d.ts +14 -0
- package/plugins/runtime-modules/core/widgets/description/config.d.ts +14 -0
- package/plugins/runtime-modules/core/widgets/entry-list/config.d.ts +14 -0
- package/plugins/runtime-modules/core/widgets/float-button/config.d.ts +14 -0
- package/plugins/runtime-modules/core/widgets/gallery/config.d.ts +14 -0
- package/plugins/runtime-modules/core/widgets/markdown/config.d.ts +14 -0
- package/plugins/runtime-modules/core/widgets/result/config.d.ts +14 -0
- package/plugins/runtime-modules/core/widgets/select-box/client.js +13 -4
- package/plugins/runtime-modules/core/widgets/select-box/config.js +1 -0
- package/plugins/runtime-modules/core/widgets/simple-text/config.d.ts +14 -0
- package/plugins/runtime-modules/core/widgets/table/client.js +17 -8
- package/plugins/runtime-modules/core/widgets/table/config.d.ts +1 -1143
- package/plugins/runtime-modules/core/widgets/table/config.js +144 -125
- package/plugins/runtime-modules/core/widgets/thread-conversation/authoring.d.ts +2 -0
- package/plugins/runtime-modules/core/widgets/thread-conversation/authoring.js +76 -0
- package/plugins/runtime-modules/core/widgets/thread-conversation/client.d.ts +44 -1
- package/plugins/runtime-modules/core/widgets/thread-conversation/client.js +28 -13
- package/plugins/runtime-modules/editor/definition.d.ts +1 -1
- package/plugins/runtime-modules/editor/definition.js +0 -1
- package/plugins/runtime-modules/editor/module.d.ts +1 -1
- package/plugins/runtime-modules/phi-default-site-area-preset-tree.js +16 -8
- package/plugins/runtime-modules/public/definition.d.ts +1 -1
- package/plugins/runtime-modules/public/definition.js +0 -1
- package/plugins/runtime-modules/public/module.d.ts +1 -1
- package/plugins/runtime-modules/theme/widgets/brand-controls/client.js +109 -86
- package/plugins/runtime-modules/threads/controller/client.js +10 -12
- package/plugins/runtime-modules/threads/controller/definition.d.ts +6 -0
- package/plugins/runtime-modules/threads/controller/definition.js +17 -6
- package/styles/controls.css +49 -1
- package/styles/layout.css +3 -2
- package/types/calendar.d.ts +5 -0
- package/types/cms-plugins.d.ts +30 -10
- package/types/table-widget.d.ts +8 -2
|
@@ -12,6 +12,7 @@ import { readPhiLengthValue } from "../../../../../types/length";
|
|
|
12
12
|
import { parsePhiControlOptionsProviderConfig } from "../../../../../components/controls/phi-control-options";
|
|
13
13
|
import { readPhiRuntimeConditionExpression, resolvePhiRuntimeConditionControllerRequirements, } from "../../../../../types/runtime-condition";
|
|
14
14
|
import { isPhiRecord } from "../../../../../helpers/is-record";
|
|
15
|
+
import { isPhiTableSurfaceDrawable } from "../../../../../components/tables/phi-table-surface";
|
|
15
16
|
const PHI_TABLE_DISABLED_CONDITION_CONFIG_FIELDS = [
|
|
16
17
|
{ key: "source", type: "choice", label: "Source", options: [
|
|
17
18
|
{ value: "row", label: "Row" },
|
|
@@ -28,29 +29,21 @@ const PHI_TABLE_DISABLED_CONDITION_CONFIG_FIELDS = [
|
|
|
28
29
|
{ key: "value", type: "string", label: "String Value" },
|
|
29
30
|
{ key: "reason", type: "string", label: "Disabled Reason", text: "message" },
|
|
30
31
|
];
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
itemKeyField: "valuePath",
|
|
47
|
-
itemLabelField: "valuePath",
|
|
48
|
-
addLabel: "Add condition",
|
|
49
|
-
emptyLabel,
|
|
50
|
-
defaultItem: { source: "row", valuePath: match === "all" ? "visible" : "disabled", operator: "truthy" },
|
|
51
|
-
itemFields: PHI_TABLE_DISABLED_CONDITION_CONFIG_FIELDS,
|
|
52
|
-
},
|
|
53
|
-
];
|
|
32
|
+
/*
|
|
33
|
+
* A group of conditions is one field (`condition-group`): the Inspector writes `{ match, conditions }`
|
|
34
|
+
* only in a shape `readCondition` accepts. Its label and an Edit button at the Widget's own level, in
|
|
35
|
+
* place inside a column's or an action's entry.
|
|
36
|
+
*/
|
|
37
|
+
function buildPhiTableConditionGroupField(key, label, match, emptyLabel) {
|
|
38
|
+
return {
|
|
39
|
+
key,
|
|
40
|
+
type: "condition-group",
|
|
41
|
+
label,
|
|
42
|
+
addLabel: "Add condition",
|
|
43
|
+
emptyLabel,
|
|
44
|
+
defaultCondition: { source: "row", valuePath: match === "all" ? "visible" : "disabled", operator: "truthy" },
|
|
45
|
+
conditionFields: PHI_TABLE_DISABLED_CONDITION_CONFIG_FIELDS,
|
|
46
|
+
};
|
|
54
47
|
}
|
|
55
48
|
const PHI_TABLE_FOOTER_VALUE_CONFIG_FIELDS = [
|
|
56
49
|
{ key: "key", type: "string", label: "Key", required: true },
|
|
@@ -115,8 +108,8 @@ const PHI_TABLE_ACTION_CONFIG_FIELDS = [
|
|
|
115
108
|
},
|
|
116
109
|
/* For a row's own address only: an address chosen as the target says whether it opens a new tab itself. */
|
|
117
110
|
{ key: "newTab", type: "boolean", label: "Open In New Tab", visibleWhen: { field: "execution", equals: "link" } },
|
|
118
|
-
|
|
119
|
-
|
|
111
|
+
buildPhiTableConditionGroupField("visibleWhen", "Visible Conditions", "all", "Always visible"),
|
|
112
|
+
buildPhiTableConditionGroupField("disabledWhen", "Disabled Conditions", "any", "No disabled conditions"),
|
|
120
113
|
{ key: "reveal.title", type: "string", label: "Shown Once Title", visibleWhen: { field: "execution", equals: "provider" } },
|
|
121
114
|
{ key: "reveal.description", type: "string", label: "Shown Once Description", visibleWhen: { field: "execution", equals: "provider" } },
|
|
122
115
|
{ key: "confirm.title", type: "string", label: "Confirm Title" },
|
|
@@ -419,6 +412,16 @@ function readBindingField(reader) {
|
|
|
419
412
|
create,
|
|
420
413
|
};
|
|
421
414
|
}
|
|
415
|
+
/**
|
|
416
|
+
* The Table's ground, in the Surface vocabulary (TABLES.md "Surface"): `null` is None and is kept -- the
|
|
417
|
+
* strict reader takes `null` for absent, and absent is the Table's own ground -- and a stated Surface has
|
|
418
|
+
* to be one the Table can draw.
|
|
419
|
+
*/
|
|
420
|
+
function readTableSurface(presentation) {
|
|
421
|
+
if (presentation.record.surface === null)
|
|
422
|
+
return null;
|
|
423
|
+
return presentation.value("surface", "null or a Surface of one ground colour, with no line, depth or mode", (value) => isPhiRecord(value) && isPhiTableSurfaceDrawable(value) ? value : undefined);
|
|
424
|
+
}
|
|
422
425
|
export function parsePhiTableWidgetConfig(config) {
|
|
423
426
|
const root = createPhiConfigReader(config);
|
|
424
427
|
const section = (reader, key) => reader.object(key, (nested) => nested) ?? createPhiConfigReader({}, reader.path ? `${reader.path}.${key}` : key);
|
|
@@ -471,6 +474,7 @@ export function parsePhiTableWidgetConfig(config) {
|
|
|
471
474
|
description: emptyState.string("description"),
|
|
472
475
|
},
|
|
473
476
|
borders: presentation.boolean("borders"),
|
|
477
|
+
surface: readTableSurface(presentation),
|
|
474
478
|
header: presentation.boolean("header"),
|
|
475
479
|
stickyHeader: presentation.boolean("stickyHeader"),
|
|
476
480
|
footer: presentation.object("footer", readTableFooter),
|
|
@@ -580,36 +584,32 @@ export const PHI_TABLE_WIDGET_DEFINITION = {
|
|
|
580
584
|
{ id: "conditionStateChange", channel: "condition", action: "change", valueType: "json", valueSchema: PHI_SIGNAL_VALUE_SCHEMAS.runtimeConditionState },
|
|
581
585
|
],
|
|
582
586
|
},
|
|
587
|
+
/*
|
|
588
|
+
* The dividers group the settings by what they answer: where the rows come from, the lists that are
|
|
589
|
+
* edited in their own Overlay (columns, filters, actions) standing together as one group of Edit rows,
|
|
590
|
+
* the words, the tools above the table, sorting and paging, what a visitor may select and edit, the look,
|
|
591
|
+
* and what stands under the rows. A heading sits on a field that is always shown, so a group never
|
|
592
|
+
* loses its divider to a hidden first field.
|
|
593
|
+
*/
|
|
583
594
|
fields: [
|
|
584
|
-
{ key: "presentation.title", type: "string", label: "Title" },
|
|
585
|
-
{ key: "presentation.description", type: "string", label: "Description" },
|
|
586
|
-
{
|
|
587
|
-
key: "presentation.layout.mode",
|
|
588
|
-
type: "choice",
|
|
589
|
-
label: "Table Layout",
|
|
590
|
-
description: "Auto follows content; fixed gives deterministic fixed/fill column distribution.",
|
|
591
|
-
options: [
|
|
592
|
-
{ value: "auto", label: "Auto" },
|
|
593
|
-
{ value: "fixed", label: "Fixed" },
|
|
594
|
-
],
|
|
595
|
-
},
|
|
596
|
-
{
|
|
597
|
-
key: "presentation.layout.overflowX",
|
|
598
|
-
type: "choice",
|
|
599
|
-
label: "Horizontal Overflow",
|
|
600
|
-
options: [
|
|
601
|
-
{ value: "auto", label: "Scroll when needed" },
|
|
602
|
-
{ value: "visible", label: "Visible" },
|
|
603
|
-
],
|
|
604
|
-
},
|
|
605
595
|
{
|
|
606
596
|
key: "source",
|
|
597
|
+
heading: "Data",
|
|
607
598
|
type: "data-provider",
|
|
608
599
|
providerKind: "table",
|
|
609
600
|
label: "Table Provider",
|
|
610
601
|
},
|
|
602
|
+
{ key: "features.structure.mode", type: "choice", label: "Structure", options: [
|
|
603
|
+
{ value: "flat", label: "Flat" },
|
|
604
|
+
{ value: "tree", label: "Tree" },
|
|
605
|
+
] },
|
|
606
|
+
{ key: "features.structure.parentRowIdentityPath", type: "string", label: "Parent Row Identity Path", visibleWhen: { field: "features.structure.mode", equals: "tree" } },
|
|
607
|
+
{ key: "features.structure.expandColumnKey", type: "string", label: "Expand Column", visibleWhen: { field: "features.structure.mode", equals: "tree" } },
|
|
608
|
+
{ key: "features.structure.expandRowByClick", type: "boolean", label: "Expand Row By Click", visibleWhen: { field: "features.structure.mode", equals: "tree" } },
|
|
609
|
+
{ key: "features.structure.indentSize", type: "number", label: "Tree Indent", min: 0, precision: 0, visibleWhen: { field: "features.structure.mode", equals: "tree" } },
|
|
611
610
|
{
|
|
612
611
|
key: "presentation.columns",
|
|
612
|
+
heading: "Columns and actions",
|
|
613
613
|
type: "collection",
|
|
614
614
|
presentation: "overlay",
|
|
615
615
|
label: "Columns",
|
|
@@ -746,7 +746,7 @@ export const PHI_TABLE_WIDGET_DEFINITION = {
|
|
|
746
746
|
label: "Editor Unit",
|
|
747
747
|
visibleWhen: { field: "editor.enabled", equals: true },
|
|
748
748
|
},
|
|
749
|
-
...
|
|
749
|
+
{ ...buildPhiTableConditionGroupField("editor.disabledWhen", "Editor Disabled Conditions", "any", "No disabled conditions"), visibleWhen: { field: "editor.enabled", equals: true } },
|
|
750
750
|
{ key: "hidden", type: "boolean", label: "Hidden" },
|
|
751
751
|
{ key: "ellipsis", type: "boolean", label: "Ellipsis" },
|
|
752
752
|
],
|
|
@@ -807,52 +807,6 @@ export const PHI_TABLE_WIDGET_DEFINITION = {
|
|
|
807
807
|
{ key: "endPlaceholder", type: "string", label: "End Placeholder", visibleWhen: { field: "type", equals: "dateRange" } },
|
|
808
808
|
],
|
|
809
809
|
},
|
|
810
|
-
{ key: "features.search.enabled", type: "boolean", label: "Search" },
|
|
811
|
-
{ key: "features.search.placeholder", type: "string", label: "Search Placeholder", visibleWhen: { field: "features.search.enabled", equals: true } },
|
|
812
|
-
{ key: "features.search.debounceMs", type: "number", label: "Search Debounce", min: 0, precision: 0, visibleWhen: { field: "features.search.enabled", equals: true } },
|
|
813
|
-
{ key: "features.pagination.enabled", type: "boolean", label: "Pagination" },
|
|
814
|
-
{ key: "features.pagination.pageSize", type: "number", label: "Page Size", min: 1, precision: 0, visibleWhen: { field: "features.pagination.enabled", equals: true } },
|
|
815
|
-
{ key: "features.pagination.pageSizes", type: "number-list", label: "Page Sizes", min: 1, visibleWhen: { field: "features.pagination.enabled", equals: true } },
|
|
816
|
-
{
|
|
817
|
-
key: "features.sorting.mode",
|
|
818
|
-
type: "choice",
|
|
819
|
-
label: "Sorting",
|
|
820
|
-
options: [
|
|
821
|
-
{ value: "none", label: "None" },
|
|
822
|
-
{ value: "single", label: "Single" },
|
|
823
|
-
{ value: "multiple", label: "Multiple" },
|
|
824
|
-
],
|
|
825
|
-
},
|
|
826
|
-
{
|
|
827
|
-
key: "features.sorting.defaultSorts",
|
|
828
|
-
type: "collection",
|
|
829
|
-
label: "Default Sorts",
|
|
830
|
-
itemKeyField: "key",
|
|
831
|
-
itemLabelField: "key",
|
|
832
|
-
addLabel: "Add sort",
|
|
833
|
-
emptyLabel: "No default sorts",
|
|
834
|
-
defaultItem: { key: "column", direction: "ascending" },
|
|
835
|
-
visibleWhen: { field: "features.sorting.mode", notEquals: "none" },
|
|
836
|
-
itemFields: [
|
|
837
|
-
{ key: "key", type: "string", label: "Provider Sort Field", required: true },
|
|
838
|
-
{ key: "direction", type: "choice", label: "Direction", options: [
|
|
839
|
-
{ value: "ascending", label: "Ascending" },
|
|
840
|
-
{ value: "descending", label: "Descending" },
|
|
841
|
-
] },
|
|
842
|
-
],
|
|
843
|
-
},
|
|
844
|
-
{
|
|
845
|
-
key: "features.rowSelection.mode",
|
|
846
|
-
type: "choice",
|
|
847
|
-
label: "Row Selection",
|
|
848
|
-
options: [
|
|
849
|
-
{ value: "none", label: "None" },
|
|
850
|
-
{ value: "single", label: "Single" },
|
|
851
|
-
{ value: "multiple", label: "Multiple" },
|
|
852
|
-
],
|
|
853
|
-
},
|
|
854
|
-
{ key: "features.rowSelection.preserveSelectedRowIdentities", type: "boolean", label: "Preserve Selection", visibleWhen: { field: "features.rowSelection.mode", notEquals: "none" } },
|
|
855
|
-
...buildPhiTableConditionExpressionConfigFields("features.rowSelection.disabledWhen", "Selection Disabled Conditions", "any", "No disabled conditions").map((field) => ({ ...field, visibleWhen: { field: "features.rowSelection.mode", notEquals: "none" } })),
|
|
856
810
|
{
|
|
857
811
|
key: "features.actions.toolbar",
|
|
858
812
|
type: "collection",
|
|
@@ -865,15 +819,6 @@ export const PHI_TABLE_WIDGET_DEFINITION = {
|
|
|
865
819
|
defaultItem: { key: "action", label: "Action", execution: "provider", display: "label", mode: "normal" },
|
|
866
820
|
itemFields: PHI_TABLE_ACTION_CONFIG_FIELDS,
|
|
867
821
|
},
|
|
868
|
-
{
|
|
869
|
-
key: "features.actions.rowLayout",
|
|
870
|
-
type: "choice",
|
|
871
|
-
label: "Row Action Layout",
|
|
872
|
-
options: [
|
|
873
|
-
{ value: "spaced", label: "Spaced" },
|
|
874
|
-
{ value: "compact", label: "Compact" },
|
|
875
|
-
],
|
|
876
|
-
},
|
|
877
822
|
{
|
|
878
823
|
key: "features.actions.row",
|
|
879
824
|
type: "collection",
|
|
@@ -898,14 +843,13 @@ export const PHI_TABLE_WIDGET_DEFINITION = {
|
|
|
898
843
|
defaultItem: { key: "action", label: "Action", execution: "provider", display: "label", mode: "normal" },
|
|
899
844
|
itemFields: PHI_TABLE_ACTION_CONFIG_FIELDS,
|
|
900
845
|
},
|
|
901
|
-
{ key: "
|
|
902
|
-
{ key: "
|
|
903
|
-
{ key: "
|
|
904
|
-
|
|
905
|
-
|
|
906
|
-
|
|
907
|
-
|
|
908
|
-
...buildPhiTableConditionExpressionConfigFields("features.editing.disabledWhen", "Editing Disabled Conditions", "any", "No disabled conditions"),
|
|
846
|
+
{ key: "presentation.title", type: "string", heading: "Text", label: "Title" },
|
|
847
|
+
{ key: "presentation.description", type: "string", label: "Description" },
|
|
848
|
+
{ key: "presentation.emptyState.title", type: "string", label: "Empty Title" },
|
|
849
|
+
{ key: "presentation.emptyState.description", type: "string", label: "Empty Description" },
|
|
850
|
+
{ key: "features.search.enabled", type: "boolean", heading: "Search and tools", label: "Search" },
|
|
851
|
+
{ key: "features.search.placeholder", type: "string", label: "Search Placeholder", visibleWhen: { field: "features.search.enabled", equals: true } },
|
|
852
|
+
{ key: "features.search.debounceMs", type: "number", label: "Search Debounce", min: 0, precision: 0, visibleWhen: { field: "features.search.enabled", equals: true } },
|
|
909
853
|
{ key: "features.tools.mode", type: "choice", label: "Global Tools", options: [
|
|
910
854
|
{ value: "self-contained", label: "Self-contained" },
|
|
911
855
|
{ value: "external", label: "External" },
|
|
@@ -977,17 +921,99 @@ export const PHI_TABLE_WIDGET_DEFINITION = {
|
|
|
977
921
|
label: "Reload Control",
|
|
978
922
|
visibleWhen: { field: "features.tools.mode", equals: "self-contained" },
|
|
979
923
|
},
|
|
980
|
-
{
|
|
981
|
-
|
|
982
|
-
|
|
924
|
+
{
|
|
925
|
+
key: "features.sorting.mode",
|
|
926
|
+
heading: "Sorting and paging",
|
|
927
|
+
type: "choice",
|
|
928
|
+
label: "Sorting",
|
|
929
|
+
options: [
|
|
930
|
+
{ value: "none", label: "None" },
|
|
931
|
+
{ value: "single", label: "Single" },
|
|
932
|
+
{ value: "multiple", label: "Multiple" },
|
|
933
|
+
],
|
|
934
|
+
},
|
|
935
|
+
{
|
|
936
|
+
key: "features.sorting.defaultSorts",
|
|
937
|
+
type: "collection",
|
|
938
|
+
presentation: "overlay",
|
|
939
|
+
label: "Default Sorts",
|
|
940
|
+
itemKeyField: "key",
|
|
941
|
+
itemLabelField: "key",
|
|
942
|
+
addLabel: "Add sort",
|
|
943
|
+
emptyLabel: "No default sorts",
|
|
944
|
+
defaultItem: { key: "column", direction: "ascending" },
|
|
945
|
+
visibleWhen: { field: "features.sorting.mode", notEquals: "none" },
|
|
946
|
+
itemFields: [
|
|
947
|
+
{ key: "key", type: "string", label: "Provider Sort Field", required: true },
|
|
948
|
+
{ key: "direction", type: "choice", label: "Direction", options: [
|
|
949
|
+
{ value: "ascending", label: "Ascending" },
|
|
950
|
+
{ value: "descending", label: "Descending" },
|
|
951
|
+
] },
|
|
952
|
+
],
|
|
953
|
+
},
|
|
954
|
+
{ key: "features.pagination.enabled", type: "boolean", label: "Pagination" },
|
|
955
|
+
{ key: "features.pagination.pageSize", type: "number", label: "Page Size", min: 1, precision: 0, visibleWhen: { field: "features.pagination.enabled", equals: true } },
|
|
956
|
+
{ key: "features.pagination.pageSizes", type: "number-list", label: "Page Sizes", min: 1, visibleWhen: { field: "features.pagination.enabled", equals: true } },
|
|
957
|
+
{
|
|
958
|
+
key: "features.rowSelection.mode",
|
|
959
|
+
heading: "Selection and editing",
|
|
960
|
+
type: "choice",
|
|
961
|
+
label: "Row Selection",
|
|
962
|
+
options: [
|
|
963
|
+
{ value: "none", label: "None" },
|
|
964
|
+
{ value: "single", label: "Single" },
|
|
965
|
+
{ value: "multiple", label: "Multiple" },
|
|
966
|
+
],
|
|
967
|
+
},
|
|
968
|
+
{ key: "features.rowSelection.preserveSelectedRowIdentities", type: "boolean", label: "Preserve Selection", visibleWhen: { field: "features.rowSelection.mode", notEquals: "none" } },
|
|
969
|
+
{ ...buildPhiTableConditionGroupField("features.rowSelection.disabledWhen", "Selection Disabled Conditions", "any", "No disabled conditions"), visibleWhen: { field: "features.rowSelection.mode", notEquals: "none" } },
|
|
970
|
+
{ key: "features.editing.mode", type: "choice", label: "Editing", options: [
|
|
971
|
+
{ value: "none", label: "None" },
|
|
972
|
+
{ value: "cell", label: "Cell" },
|
|
973
|
+
{ value: "row", label: "Row" },
|
|
983
974
|
] },
|
|
984
|
-
|
|
985
|
-
{ key: "features.
|
|
986
|
-
{ key: "features.
|
|
987
|
-
{
|
|
975
|
+
buildPhiTableConditionGroupField("features.editing.disabledWhen", "Editing Disabled Conditions", "any", "No disabled conditions"),
|
|
976
|
+
{ key: "features.columnReordering.enabled", type: "boolean", label: "Visitor Column Reordering" },
|
|
977
|
+
{ key: "features.rowReordering.enabled", type: "boolean", label: "Provider Row Reordering" },
|
|
978
|
+
{ ...PHI_CONTROL_SIZE_FIELD, key: "presentation.controlSize", heading: "Appearance" },
|
|
979
|
+
{
|
|
980
|
+
key: "presentation.layout.mode",
|
|
981
|
+
type: "choice",
|
|
982
|
+
label: "Table Layout",
|
|
983
|
+
description: "Auto follows content; fixed gives deterministic fixed/fill column distribution.",
|
|
984
|
+
options: [
|
|
985
|
+
{ value: "auto", label: "Auto" },
|
|
986
|
+
{ value: "fixed", label: "Fixed" },
|
|
987
|
+
],
|
|
988
|
+
},
|
|
989
|
+
{
|
|
990
|
+
key: "presentation.layout.overflowX",
|
|
991
|
+
type: "choice",
|
|
992
|
+
label: "Horizontal Overflow",
|
|
993
|
+
options: [
|
|
994
|
+
{ value: "auto", label: "Scroll when needed" },
|
|
995
|
+
{ value: "visible", label: "Visible" },
|
|
996
|
+
],
|
|
997
|
+
},
|
|
998
|
+
{ key: "presentation.header", type: "boolean", label: "Header" },
|
|
999
|
+
{ key: "presentation.stickyHeader", type: "boolean", label: "Sticky Header" },
|
|
1000
|
+
{ key: "presentation.borders", type: "boolean", label: "Borders" },
|
|
1001
|
+
{ key: "presentation.row.striped", type: "boolean", label: "Striped Rows" },
|
|
1002
|
+
{
|
|
1003
|
+
key: "features.actions.rowLayout",
|
|
1004
|
+
type: "choice",
|
|
1005
|
+
label: "Row Action Layout",
|
|
1006
|
+
options: [
|
|
1007
|
+
{ value: "spaced", label: "Spaced" },
|
|
1008
|
+
{ value: "compact", label: "Compact" },
|
|
1009
|
+
],
|
|
1010
|
+
},
|
|
1011
|
+
buildPhiTableConditionGroupField("presentation.row.mutedWhen", "Muted Row Conditions", "any", "No muted rows"),
|
|
988
1012
|
{
|
|
989
1013
|
key: "presentation.footer.values",
|
|
1014
|
+
heading: "Footer and summary",
|
|
990
1015
|
type: "collection",
|
|
1016
|
+
presentation: "overlay",
|
|
991
1017
|
label: "Footer Values",
|
|
992
1018
|
itemKeyField: "key",
|
|
993
1019
|
itemLabelField: "label",
|
|
@@ -1013,6 +1039,7 @@ export const PHI_TABLE_WIDGET_DEFINITION = {
|
|
|
1013
1039
|
{
|
|
1014
1040
|
key: "presentation.summary.rows",
|
|
1015
1041
|
type: "collection",
|
|
1042
|
+
presentation: "overlay",
|
|
1016
1043
|
label: "Summary Rows",
|
|
1017
1044
|
itemKeyField: "key",
|
|
1018
1045
|
itemLabelField: "key",
|
|
@@ -1039,14 +1066,6 @@ export const PHI_TABLE_WIDGET_DEFINITION = {
|
|
|
1039
1066
|
},
|
|
1040
1067
|
],
|
|
1041
1068
|
},
|
|
1042
|
-
{ key: "presentation.emptyState.title", type: "string", label: "Empty Title" },
|
|
1043
|
-
{ key: "presentation.emptyState.description", type: "string", label: "Empty Description" },
|
|
1044
|
-
{ ...PHI_CONTROL_SIZE_FIELD, key: "presentation.controlSize" },
|
|
1045
|
-
{ key: "presentation.borders", type: "boolean", label: "Borders" },
|
|
1046
|
-
{ key: "presentation.header", type: "boolean", label: "Header" },
|
|
1047
|
-
{ key: "presentation.stickyHeader", type: "boolean", label: "Sticky Header" },
|
|
1048
|
-
{ key: "presentation.row.striped", type: "boolean", label: "Striped Rows" },
|
|
1049
|
-
...buildPhiTableConditionExpressionConfigFields("presentation.row.mutedWhen", "Muted Row Conditions", "any", "No muted rows"),
|
|
1050
1069
|
],
|
|
1051
1070
|
defaultConfig: {
|
|
1052
1071
|
presentation: {
|
|
@@ -0,0 +1,76 @@
|
|
|
1
|
+
"use client";
|
|
2
|
+
import { jsx as _jsx } from "react/jsx-runtime";
|
|
3
|
+
import { PhisThreadKind, PhisThreadMessageFlag, PhisThreadParticipantFlag, PhisThreadStatus } from "../../../../../constants/threads";
|
|
4
|
+
import { createPhiCmsBuilderWidgetPlugin } from "../../../../../plugins/factories/widget-builder-plugin";
|
|
5
|
+
import { PHI_THREAD_CONVERSATION_DEFAULT_LABELS as labels, } from "../../messaging/label-defaults";
|
|
6
|
+
import { PHI_THREAD_CONVERSATION_WIDGET_DEFINITION } from "./config";
|
|
7
|
+
import { PhiThreadConversationView } from "./client";
|
|
8
|
+
/*
|
|
9
|
+
* The canvas draws the reader itself, with a made-up conversation, the way the live Widget draws one it
|
|
10
|
+
* has read: the canvas may not read anybody's conversation, and the one a Page shows arrives with a
|
|
11
|
+
* selection that never happens here. The words are the Label Set's, in its source language, as the
|
|
12
|
+
* Builder shows every text, and a tag on the heading says it is a sample. Its Reply and its attachment
|
|
13
|
+
* lead nowhere; nothing is fetched.
|
|
14
|
+
*
|
|
15
|
+
* A placement that names its conversation (`title`) is one whose conversation Core opens without a
|
|
16
|
+
* subject -- a customer file -- so it gets staff's notes under that name; any other gets an exchange
|
|
17
|
+
* under a subject, with the people in it.
|
|
18
|
+
*/
|
|
19
|
+
const SAMPLE_THREAD_ID = -1;
|
|
20
|
+
const member = { userId: -1, displayName: labels.sample.memberName, companyName: null };
|
|
21
|
+
const staff = { userId: -2, displayName: labels.sample.staffName, companyName: null };
|
|
22
|
+
function sampleMessage(id, author, bodyText, createdAt, options = {}) {
|
|
23
|
+
return {
|
|
24
|
+
id,
|
|
25
|
+
author: { kind: "user", user: author },
|
|
26
|
+
bodyText,
|
|
27
|
+
bodyMarkdown: null,
|
|
28
|
+
sourceLang: null,
|
|
29
|
+
flags: options.internal ? PhisThreadMessageFlag.Internal : 0,
|
|
30
|
+
assets: options.attachment ? [{
|
|
31
|
+
assetId: id,
|
|
32
|
+
fileName: options.attachment,
|
|
33
|
+
contentType: "application/pdf",
|
|
34
|
+
byteSize: 0,
|
|
35
|
+
flags: 0,
|
|
36
|
+
href: "#",
|
|
37
|
+
}] : [],
|
|
38
|
+
createdAt,
|
|
39
|
+
updatedAt: createdAt,
|
|
40
|
+
};
|
|
41
|
+
}
|
|
42
|
+
function sampleThread(kind, sample) {
|
|
43
|
+
const file = kind === "file";
|
|
44
|
+
const messages = file ? [
|
|
45
|
+
sampleMessage(-1, staff, sample.fileCall, "2026-03-02T09:14:00Z", { internal: true }),
|
|
46
|
+
sampleMessage(-2, staff, sample.fileAddress, "2026-03-09T14:40:00Z", { internal: true }),
|
|
47
|
+
sampleMessage(-3, staff, sample.fileContract, "2026-03-12T10:05:00Z", { internal: true, attachment: sample.fileAttachment }),
|
|
48
|
+
] : [
|
|
49
|
+
sampleMessage(-1, member, sample.question, "2026-03-02T09:14:00Z"),
|
|
50
|
+
sampleMessage(-2, staff, sample.note, "2026-03-02T10:31:00Z", { internal: true }),
|
|
51
|
+
sampleMessage(-3, staff, sample.answer, "2026-03-02T10:47:00Z", { attachment: sample.answerAttachment }),
|
|
52
|
+
];
|
|
53
|
+
const latest = messages.at(-1)?.createdAt ?? null;
|
|
54
|
+
return {
|
|
55
|
+
thread: {
|
|
56
|
+
id: SAMPLE_THREAD_ID,
|
|
57
|
+
kind: file ? PhisThreadKind.File : PhisThreadKind.Support,
|
|
58
|
+
status: PhisThreadStatus.Open,
|
|
59
|
+
flags: 0,
|
|
60
|
+
subject: file ? null : sample.subject,
|
|
61
|
+
createdAt: messages[0]?.createdAt ?? "",
|
|
62
|
+
updatedAt: latest ?? "",
|
|
63
|
+
latestMessageAt: latest,
|
|
64
|
+
unread: false,
|
|
65
|
+
},
|
|
66
|
+
participants: file ? [] : [
|
|
67
|
+
{ kind: "user", user: member, flags: PhisThreadParticipantFlag.Requester },
|
|
68
|
+
{ kind: "user", user: staff, flags: 0 },
|
|
69
|
+
],
|
|
70
|
+
messages,
|
|
71
|
+
hasMoreMessages: false,
|
|
72
|
+
};
|
|
73
|
+
}
|
|
74
|
+
const SAMPLE_FILE = sampleThread("file", labels.sample);
|
|
75
|
+
const SAMPLE_CONVERSATION = sampleThread("conversation", labels.sample);
|
|
76
|
+
export const PHI_THREAD_CONVERSATION_WIDGET_BUILDER_PLUGIN = createPhiCmsBuilderWidgetPlugin(PHI_THREAD_CONVERSATION_WIDGET_DEFINITION, ({ config, runtime }) => (_jsx(PhiThreadConversationView, { detail: config?.title ? SAMPLE_FILE : SAMPLE_CONVERSATION, labels: labels, config: config, locale: runtime.locale.current, sampleLabel: labels.sample.tag })));
|
|
@@ -1,10 +1,53 @@
|
|
|
1
1
|
import type { PhiBlockRuntime, PhiClientBlockBaseProps } from "../../../../../types";
|
|
2
2
|
import type { PhisThreadDetail } from "../../../../../types/threads";
|
|
3
3
|
import { type PhiThreadWidgetConfig } from "../thread-widget-config";
|
|
4
|
-
import type { PhiThreadConversationLabels } from "../../messaging/
|
|
4
|
+
import type { PhiThreadConversationLabels } from "../../messaging/label-defaults";
|
|
5
5
|
export type PhiThreadConversationWidgetClientProps = PhiClientBlockBaseProps<PhiThreadConversationLabels, PhiThreadWidgetConfig, Pick<PhiBlockRuntime, "site" | "locale" | "viewer">> & {
|
|
6
6
|
runtime: Pick<PhiBlockRuntime, "site" | "locale" | "viewer">;
|
|
7
7
|
};
|
|
8
|
+
/**
|
|
9
|
+
* What became of one message's translation.
|
|
10
|
+
*
|
|
11
|
+
* `visible` is on the ready entry rather than in a set of its own, because "show the original" is the
|
|
12
|
+
* same control and not a second feature -- pressing it back must not throw away what was already paid
|
|
13
|
+
* for. Keyed by message id, which is unique across threads, so switching conversations and returning
|
|
14
|
+
* does not ask again. The Area ending unmounts this and with it the whole cache.
|
|
15
|
+
*/
|
|
16
|
+
type PhiMessageTranslation = {
|
|
17
|
+
status: "pending";
|
|
18
|
+
} | {
|
|
19
|
+
status: "failed";
|
|
20
|
+
} | {
|
|
21
|
+
status: "ready";
|
|
22
|
+
text: string;
|
|
23
|
+
sourceLocale: string | null;
|
|
24
|
+
visible: boolean;
|
|
25
|
+
};
|
|
8
26
|
export declare function PhiThreadConversationWidgetClient({ runtime, labels, config, }: PhiThreadConversationWidgetClientProps): import("react").JSX.Element;
|
|
27
|
+
/**
|
|
28
|
+
* One conversation as it is read, once it is there: the Card with its heading and Reply, and the messages.
|
|
29
|
+
*
|
|
30
|
+
* Drawn from what it is handed and nothing else, so the live Widget and the Builder canvas -- which
|
|
31
|
+
* hands it a made-up conversation (`authoring.tsx`) -- draw the same thing. Fetching, marking read and
|
|
32
|
+
* translating stay with the live Widget; here they are callbacks.
|
|
33
|
+
*/
|
|
34
|
+
export declare function PhiThreadConversationView({ detail, labels, config, locale, error, loadingOlder, onLoadOlder, onReply, translations, canTranslate, onTranslate, formatLanguage, sampleLabel, }: {
|
|
35
|
+
detail: PhisThreadDetail;
|
|
36
|
+
labels: PhiThreadConversationLabels;
|
|
37
|
+
config: PhiThreadWidgetConfig | null | undefined;
|
|
38
|
+
/** The locale every date is written in. */
|
|
39
|
+
locale: string;
|
|
40
|
+
error?: string | null;
|
|
41
|
+
loadingOlder?: boolean;
|
|
42
|
+
onLoadOlder?: () => void;
|
|
43
|
+
onReply?: () => void;
|
|
44
|
+
translations?: Readonly<Record<number, PhiMessageTranslation>>;
|
|
45
|
+
canTranslate?: boolean;
|
|
46
|
+
onTranslate?: (messageId: number) => void;
|
|
47
|
+
formatLanguage?: (locale: string | null) => string | null;
|
|
48
|
+
/** A tag on the heading saying the conversation is a sample, where it is one. */
|
|
49
|
+
sampleLabel?: string;
|
|
50
|
+
}): import("react").JSX.Element;
|
|
9
51
|
/** Whether Core takes new messages into this conversation; `PhisThreadFlag.Locked` says it does not. */
|
|
10
52
|
export declare function isPhiThreadLocked(detail: Pick<PhisThreadDetail, "thread">): boolean;
|
|
53
|
+
export {};
|
|
@@ -15,6 +15,7 @@ import { readPhiThreadSignalValue } from "../../../../../types/thread-widget";
|
|
|
15
15
|
import { buildPhiThreadListenFilter, findPhiThreadListenRoute, readPhiThreadAddressId, } from "../thread-widget-config";
|
|
16
16
|
import { PhiFlexControl } from "../../../../../components/controls/phi-flex-control";
|
|
17
17
|
import { PhiTypographyControl } from "../../../../../components/controls/phi-typography-control";
|
|
18
|
+
import { usePhiConfig } from "../../../../../components/root/phi-config-provider";
|
|
18
19
|
/** How much of a conversation is fetched at once; older messages are asked for by the button. */
|
|
19
20
|
const PHI_THREAD_MESSAGE_WINDOW = 50;
|
|
20
21
|
/**
|
|
@@ -419,17 +420,6 @@ export function PhiThreadConversationWidgetClient({ runtime, labels, config, })
|
|
|
419
420
|
}
|
|
420
421
|
};
|
|
421
422
|
}, [readingLocale]);
|
|
422
|
-
const currentLocale = runtime.locale.current;
|
|
423
|
-
const formatTime = useMemo(() => {
|
|
424
|
-
const formatter = new Intl.DateTimeFormat(currentLocale, {
|
|
425
|
-
dateStyle: "medium",
|
|
426
|
-
timeStyle: "short",
|
|
427
|
-
});
|
|
428
|
-
return (value) => {
|
|
429
|
-
const parsed = new Date(value);
|
|
430
|
-
return Number.isNaN(parsed.getTime()) ? value : formatter.format(parsed);
|
|
431
|
-
};
|
|
432
|
-
}, [currentLocale]);
|
|
433
423
|
/*
|
|
434
424
|
* The box is a Card, and the Card is the box.
|
|
435
425
|
*
|
|
@@ -458,9 +448,34 @@ export function PhiThreadConversationWidgetClient({ runtime, labels, config, })
|
|
|
458
448
|
if (!detail) {
|
|
459
449
|
return (_jsx(PhiCardControl, { padding: config?.padding, children: _jsx(PhiTypographyControl, { type: "secondary", children: labels.loadingText }) }));
|
|
460
450
|
}
|
|
451
|
+
return (_jsx(PhiThreadConversationView, { detail: detail, labels: labels, config: config, locale: runtime.locale.current, error: error, loadingOlder: loadingOlder, onLoadOlder: () => void loadOlder(), onReply: reply, translations: translations, canTranslate: translationTarget != null, onTranslate: translate, formatLanguage: formatLanguage }));
|
|
452
|
+
}
|
|
453
|
+
/**
|
|
454
|
+
* One conversation as it is read, once it is there: the Card with its heading and Reply, and the messages.
|
|
455
|
+
*
|
|
456
|
+
* Drawn from what it is handed and nothing else, so the live Widget and the Builder canvas -- which
|
|
457
|
+
* hands it a made-up conversation (`authoring.tsx`) -- draw the same thing. Fetching, marking read and
|
|
458
|
+
* translating stay with the live Widget; here they are callbacks.
|
|
459
|
+
*/
|
|
460
|
+
export function PhiThreadConversationView({ detail, labels, config, locale, error = null, loadingOlder = false, onLoadOlder, onReply, translations = {}, canTranslate = false, onTranslate, formatLanguage, sampleLabel, }) {
|
|
461
|
+
const { token } = usePhiConfig();
|
|
462
|
+
const formatTime = useMemo(() => {
|
|
463
|
+
const formatter = new Intl.DateTimeFormat(locale, {
|
|
464
|
+
dateStyle: "medium",
|
|
465
|
+
timeStyle: "short",
|
|
466
|
+
});
|
|
467
|
+
return (value) => {
|
|
468
|
+
const parsed = new Date(value);
|
|
469
|
+
return Number.isNaN(parsed.getTime()) ? value : formatter.format(parsed);
|
|
470
|
+
};
|
|
471
|
+
}, [locale]);
|
|
461
472
|
const archived = detail.thread.status === PhisThreadStatus.Archived;
|
|
462
473
|
const locked = isPhiThreadLocked(detail);
|
|
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" }),
|
|
474
|
+
return (_jsx(_Fragment, { children: _jsx(PhiCardControl, { size: "small", padding: config?.padding ?? token.padding, style: { minWidth: 0, width: "100%" }, toolbar: config?.reply && !archived && !locked ? (_jsx(PhiButtonControl, { label: config?.replyLabel ?? labels.replyLabel, icon: _jsx(PhiIcon, { name: "antd:message-outlined", size: "inherit" }), onClick: onReply })) : undefined, title: _jsxs(PhiFlexControl, { align: "center", gap: "small", wrap: true, children: [config?.title ?? readThreadTitle(detail, labels), sampleLabel ? _jsx(PhiTagControl, { color: "blue", children: sampleLabel }) : null, 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: onLoadOlder })) : 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 ?? readNoLanguage, translation: translations[message.id] ?? null, canTranslate: canTranslate, onTranslate: onTranslate })] }, message.id))))] }) }) }));
|
|
475
|
+
}
|
|
476
|
+
/** No language named, where nobody can say one. */
|
|
477
|
+
function readNoLanguage() {
|
|
478
|
+
return null;
|
|
464
479
|
}
|
|
465
480
|
/** Whether Core takes new messages into this conversation; `PhisThreadFlag.Locked` says it does not. */
|
|
466
481
|
export function isPhiThreadLocked(detail) {
|
|
@@ -520,5 +535,5 @@ function PhiThreadMessageRow({ message, labels, formatTime, formatLanguage, tran
|
|
|
520
535
|
const confidential = (message.flags & PhisThreadMessageFlag.Confidential) !== 0;
|
|
521
536
|
const shown = translation?.status === "ready" && translation.visible ? translation : null;
|
|
522
537
|
const offerTranslation = canTranslate && !confidential && message.bodyText != null;
|
|
523
|
-
return (_jsxs(PhiFlexControl, { vertical: true, gap: 4, children: [_jsxs(PhiFlexControl, { align: "center", gap: "small", wrap: true, children: [_jsx(PhiTypographyControl, { strong: true, children: readAuthorName(message.author, labels) }), message.author.kind === "integration" ? (_jsx(PhiTagControl, { children: message.author.providerId })) : null, internal ? _jsx(PhiTagControl, { color: "orange", children: labels.internalLabel }) : null, _jsx(PhiTypographyControl, { type: "secondary", children: formatTime(message.createdAt) }), offerTranslation ? (_jsx(PhiButtonControl, { label: shown ? labels.originalLabel : labels.translateLabel, type: "link", size: "small", loading: translation?.status === "pending", onClick: () => onTranslate(message.id) })) : null] }), message.bodyText == null ? (_jsx(PhiTypographyControl, { type: "secondary", italic: true, children: redacted ? labels.redactedText : labels.withheldText })) : (_jsx(PhiTypographyControl, { presentation: "paragraph", style: { margin: 0, whiteSpace: "pre-wrap" }, children: shown ? shown.text : message.bodyText })), shown ? (_jsxs(PhiFlexControl, { align: "center", gap: "small", wrap: true, children: [_jsx(PhiTagControl, { color: "blue", children: labels.machineTranslationLabel }), formatLanguage(shown.sourceLocale) ? (_jsx(PhiTagControl, { children: formatLanguage(shown.sourceLocale) })) : null] })) : null, translation?.status === "failed" ? (_jsx(PhiTypographyControl, { type: "secondary", children: labels.feedback.errorTranslation })) : null, message.assets.length > 0 ? (_jsx(PhiFlexControl, { wrap: true, gap: "small", children: message.assets.map((asset) => (_jsx(PhiButtonControl, { label: asset.fileName, type: "link", href: asset.href, newTab: true }, asset.assetId))) })) : null] }));
|
|
538
|
+
return (_jsxs(PhiFlexControl, { vertical: true, gap: 4, children: [_jsxs(PhiFlexControl, { align: "center", gap: "small", wrap: true, children: [_jsx(PhiTypographyControl, { strong: true, children: readAuthorName(message.author, labels) }), message.author.kind === "integration" ? (_jsx(PhiTagControl, { children: message.author.providerId })) : null, internal ? _jsx(PhiTagControl, { color: "orange", children: labels.internalLabel }) : null, _jsx(PhiTypographyControl, { type: "secondary", children: formatTime(message.createdAt) }), offerTranslation ? (_jsx(PhiButtonControl, { label: shown ? labels.originalLabel : labels.translateLabel, type: "link", size: "small", loading: translation?.status === "pending", onClick: () => onTranslate?.(message.id) })) : null] }), message.bodyText == null ? (_jsx(PhiTypographyControl, { type: "secondary", italic: true, children: redacted ? labels.redactedText : labels.withheldText })) : (_jsx(PhiTypographyControl, { presentation: "paragraph", style: { margin: 0, whiteSpace: "pre-wrap" }, children: shown ? shown.text : message.bodyText })), shown ? (_jsxs(PhiFlexControl, { align: "center", gap: "small", wrap: true, children: [_jsx(PhiTagControl, { color: "blue", children: labels.machineTranslationLabel }), formatLanguage(shown.sourceLocale) ? (_jsx(PhiTagControl, { children: formatLanguage(shown.sourceLocale) })) : null] })) : null, translation?.status === "failed" ? (_jsx(PhiTypographyControl, { type: "secondary", children: labels.feedback.errorTranslation })) : null, message.assets.length > 0 ? (_jsx(PhiFlexControl, { wrap: true, gap: "small", children: message.assets.map((asset) => (_jsx(PhiButtonControl, { label: asset.fileName, type: "link", href: asset.href, newTab: true }, asset.assetId))) })) : null] }));
|
|
524
539
|
}
|
|
@@ -2,7 +2,6 @@ export declare const PHI_EDITOR_RUNTIME_MODULE_DEFINITION: Omit<{
|
|
|
2
2
|
serverBinding: import("../../../types").PhiRuntimeModuleServerBinding;
|
|
3
3
|
description: string;
|
|
4
4
|
category: "foundation";
|
|
5
|
-
iconFamily: string;
|
|
6
5
|
dataProviders: {
|
|
7
6
|
key: `${string}/${string}`;
|
|
8
7
|
ownerModuleId: "@phis/ui/modules/editor";
|
|
@@ -83,4 +82,5 @@ export declare const PHI_EDITOR_RUNTIME_MODULE_DEFINITION: Omit<{
|
|
|
83
82
|
kind: "module";
|
|
84
83
|
eligibleAreas: readonly ["public" | "app" | "admin" | "builder" | "editor" | "accounting"];
|
|
85
84
|
title: "Public Base" | "App Base" | "Accounting Base" | "Admin Base" | "Builder Base" | "Editor Base";
|
|
85
|
+
icon: string;
|
|
86
86
|
};
|
|
@@ -8,6 +8,5 @@ export const PHI_EDITOR_RUNTIME_MODULE_DEFINITION = definePhiAreaBaseRuntimeModu
|
|
|
8
8
|
serverBinding: PHI_CORE_SERVER_BINDING,
|
|
9
9
|
description: "Locked Editor Area shell, content editor widgets, data, and workflows.",
|
|
10
10
|
category: "foundation",
|
|
11
|
-
iconFamily: "editor",
|
|
12
11
|
dataProviders: PHI_EDITOR_RUNTIME_DATA_PROVIDER_DESCRIPTORS,
|
|
13
12
|
});
|
|
@@ -82,8 +82,8 @@ export declare const PHI_EDITOR_RUNTIME_MODULE: {
|
|
|
82
82
|
})[];
|
|
83
83
|
}[];
|
|
84
84
|
}[];
|
|
85
|
-
iconFamily: string;
|
|
86
85
|
kind: "module";
|
|
87
86
|
eligibleAreas: readonly ["public" | "app" | "admin" | "builder" | "editor" | "accounting"];
|
|
88
87
|
title: "Public Base" | "App Base" | "Accounting Base" | "Admin Base" | "Builder Base" | "Editor Base";
|
|
88
|
+
icon: string;
|
|
89
89
|
};
|