@phis/ui 0.4.4 → 0.4.5
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 -3
- package/cms/plugins.d.ts +1 -0
- package/cms/plugins.js +2 -0
- package/components/cms/phi-cms-root-layout.js +30 -1
- package/components/controls/phi-background-control.d.ts +6 -1
- package/components/controls/phi-background-control.js +12 -4
- package/components/controls/phi-button-control.d.ts +13 -1
- package/components/controls/phi-button-control.js +21 -3
- package/components/controls/phi-dropdown-control.js +2 -2
- package/components/controls/phi-media-asset-tile-control.js +10 -10
- package/components/controls/phi-progress-control.d.ts +10 -2
- package/components/controls/phi-progress-control.js +6 -2
- package/components/controls/phi-ribbon-control.d.ts +4 -1
- package/components/controls/phi-ribbon-control.js +5 -3
- package/components/controls/phi-ribbon-wrap-control.d.ts +7 -1
- package/components/controls/phi-ribbon-wrap-control.js +8 -2
- package/components/controls/phi-segmented-control.d.ts +4 -1
- package/components/controls/phi-segmented-control.js +13 -2
- package/components/controls/phi-surface-control.d.ts +2 -0
- package/components/controls/phi-surface-control.js +16 -1
- package/components/controls/phi-switch-control.d.ts +4 -1
- package/components/controls/phi-switch-control.js +8 -2
- package/components/controls/phi-tag-control.d.ts +4 -1
- package/components/controls/phi-tag-control.js +11 -3
- package/components/layouts/phi-layout-view-model.js +10 -1
- package/components/regions/clients/cms-region-container-client.js +11 -1
- package/components/regions/phi-cms-region-container.js +5 -1
- package/components/regions/phi-cms-region-shell.d.ts +10 -0
- package/components/regions/phi-cms-region-shell.js +53 -7
- package/components/root/phi-root-layout.d.ts +1 -0
- package/components/root/phi-root-layout.js +1 -0
- package/components/root/phi-root-theme-resolver.js +12 -1
- package/components/root/phi-shell-chrome-overlay.d.ts +6 -0
- package/components/root/phi-shell-chrome-overlay.js +7 -1
- package/components/runtime/runtime-module-context.d.ts +12 -1
- package/components/runtime/runtime-module-context.js +6 -1
- package/components/shell/phi-cms-shell.d.ts +7 -1
- package/components/shell/phi-cms-shell.js +4 -2
- package/components/shell/use-phi-shell-header-bands.d.ts +5 -0
- package/components/shell/use-phi-shell-header-bands.js +64 -0
- package/components/shell/use-phi-shell-sticky-bottom.d.ts +18 -0
- package/components/shell/use-phi-shell-sticky-bottom.js +54 -0
- package/components/tables/client/phi-table-binding.d.ts +1 -0
- package/components/tables/client/phi-table-binding.js +22 -3
- package/components/trees/client/phi-tree-binding.d.ts +1 -0
- package/components/trees/client/phi-tree-binding.js +11 -2
- package/components/widgets/client/shared/phi-collection-provider.js +4 -3
- package/components/widgets/client/shared/phi-collection-view-binding.d.ts +1 -0
- package/components/widgets/client/shared/phi-collection-view-binding.js +16 -2
- package/components/widgets/client/shared/phi-command-buttons.js +6 -2
- package/components/widgets/config/background.d.ts +20 -0
- package/components/widgets/config/background.js +44 -2
- package/components/widgets/config/button-variant.d.ts +22 -4
- package/components/widgets/config/button-variant.js +24 -5
- package/components/widgets/config/common-action-field.d.ts +1 -1
- package/components/widgets/config/parser-primitives.js +4 -2
- package/components/widgets/config/theme-gradient.d.ts +11 -0
- package/components/widgets/config/theme-gradient.js +12 -0
- package/components/widgets/label-sets/background.js +2 -0
- package/components/widgets/label-sets/geometry.js +2 -0
- package/components/widgets/label-sets/inspector.js +4 -0
- package/components/widgets/label-types/background.d.ts +1 -0
- package/components/widgets/label-types/background.js +1 -0
- package/components/widgets/label-types/common-controls.js +2 -2
- package/components/widgets/label-types/geometry.d.ts +1 -0
- package/components/widgets/label-types/geometry.js +1 -0
- package/components/widgets/label-types/inspector.d.ts +4 -0
- package/components/widgets/label-types/inspector.js +2 -0
- package/components/widgets/shared/card-body-client.d.ts +11 -0
- package/components/widgets/shared/card-body-client.js +32 -4
- package/components/widgets/shared/collection-source-failure.d.ts +26 -0
- package/components/widgets/shared/collection-source-failure.js +42 -0
- package/components/widgets/shared/markdown-render.js +16 -3
- package/components/widgets/shared/widget-failure-client.d.ts +10 -0
- package/components/widgets/shared/widget-failure-client.js +20 -0
- package/components/widgets/shared/widget-failure.d.ts +31 -0
- package/components/widgets/shared/widget-failure.js +20 -0
- package/components/widgets/shared/widget-failure.server.d.ts +9 -0
- package/components/widgets/shared/widget-failure.server.js +12 -0
- package/gateway/dashboard-card-memo.d.ts +3 -0
- package/gateway/dashboard-card-memo.js +25 -0
- package/helpers/cms-region-keys.d.ts +1 -1
- package/helpers/layout-style.d.ts +8 -4
- package/helpers/layout-style.js +3 -2
- package/helpers/mode-paint.d.ts +4 -0
- package/helpers/mode-paint.js +47 -0
- package/helpers/surface-style.js +33 -11
- package/module-dashboard-cards.d.ts +1 -0
- package/module-dashboard-cards.js +1 -0
- package/module-records.d.ts +7 -0
- package/module-records.js +6 -0
- package/package.json +1 -1
- package/plugins/runtime-modules/builder/clients/inspector-config-field.js +1 -1
- package/plugins/runtime-modules/builder/clients/inspector-surface-labels.js +1 -0
- package/plugins/runtime-modules/builder/clients/region-inspector.js +47 -2
- package/plugins/runtime-modules/builder/clients/runtime-module-authoring-boundary.js +1 -1
- package/plugins/runtime-modules/builder/controller/draft-command-controller.js +7 -4
- package/plugins/runtime-modules/builder/controller/page-controller.js +7 -0
- package/plugins/runtime-modules/builder/persistence.d.ts +3 -0
- package/plugins/runtime-modules/builder/persistence.js +9 -1
- package/plugins/runtime-modules/core/content-entries/record-source.server.d.ts +3 -1
- package/plugins/runtime-modules/core/content-entries/record-source.server.js +7 -4
- package/plugins/runtime-modules/core/widgets/button/client.js +2 -2
- package/plugins/runtime-modules/core/widgets/button/config.d.ts +40 -4
- package/plugins/runtime-modules/core/widgets/button/config.js +12 -0
- package/plugins/runtime-modules/core/widgets/card/config.d.ts +94 -0
- package/plugins/runtime-modules/core/widgets/card/config.js +38 -0
- package/plugins/runtime-modules/core/widgets/card/editor.js +8 -1
- package/plugins/runtime-modules/core/widgets/card/server.js +4 -0
- package/plugins/runtime-modules/core/widgets/collection-view/asset-binding.d.ts +4 -1
- package/plugins/runtime-modules/core/widgets/collection-view/asset-binding.js +10 -3
- package/plugins/runtime-modules/core/widgets/collection-view/authoring.js +1 -1
- package/plugins/runtime-modules/core/widgets/collection-view/client.d.ts +3 -0
- package/plugins/runtime-modules/core/widgets/collection-view/client.js +47 -11
- package/plugins/runtime-modules/core/widgets/collection-view/image-preview-grid.d.ts +4 -1
- package/plugins/runtime-modules/core/widgets/collection-view/image-preview-grid.js +2 -2
- package/plugins/runtime-modules/core/widgets/collection-view/plugin.js +3 -2
- package/plugins/runtime-modules/core/widgets/collection-view/server.d.ts +6 -1
- package/plugins/runtime-modules/core/widgets/collection-view/server.js +21 -3
- package/plugins/runtime-modules/core/widgets/entry-detail/plugin.js +1 -1
- package/plugins/runtime-modules/core/widgets/entry-detail/server.d.ts +3 -1
- package/plugins/runtime-modules/core/widgets/entry-detail/server.js +5 -2
- package/plugins/runtime-modules/core/widgets/entry-header/plugin.js +1 -1
- package/plugins/runtime-modules/core/widgets/entry-header/server.d.ts +3 -1
- package/plugins/runtime-modules/core/widgets/entry-header/server.js +5 -2
- package/plugins/runtime-modules/core/widgets/entry-list/plugin.js +1 -1
- package/plugins/runtime-modules/core/widgets/entry-list/server.d.ts +6 -3
- package/plugins/runtime-modules/core/widgets/entry-list/server.js +13 -6
- package/plugins/runtime-modules/core/widgets/gallery/plugin.js +1 -1
- package/plugins/runtime-modules/core/widgets/gallery/server.d.ts +5 -3
- package/plugins/runtime-modules/core/widgets/gallery/server.js +8 -6
- package/plugins/runtime-modules/core/widgets/record/client.d.ts +4 -1
- package/plugins/runtime-modules/core/widgets/record/client.js +8 -3
- package/plugins/runtime-modules/core/widgets/record/plugin.js +3 -2
- package/plugins/runtime-modules/core/widgets/record/server.d.ts +3 -1
- package/plugins/runtime-modules/core/widgets/record/server.js +2 -2
- package/plugins/runtime-modules/core/widgets/segmented/client.js +1 -1
- package/plugins/runtime-modules/core/widgets/segmented/config.d.ts +21 -1
- package/plugins/runtime-modules/core/widgets/segmented/config.js +11 -1
- package/plugins/runtime-modules/core/widgets/switch/client.js +1 -1
- package/plugins/runtime-modules/core/widgets/switch/config.d.ts +19 -0
- package/plugins/runtime-modules/core/widgets/switch/config.js +11 -0
- package/plugins/runtime-modules/core/widgets/table/authoring.js +1 -1
- package/plugins/runtime-modules/core/widgets/table/client.d.ts +4 -1
- package/plugins/runtime-modules/core/widgets/table/client.js +16 -3
- package/plugins/runtime-modules/core/widgets/table/plugin.js +3 -2
- package/plugins/runtime-modules/core/widgets/table/server.d.ts +3 -1
- package/plugins/runtime-modules/core/widgets/table/server.js +2 -2
- package/plugins/runtime-modules/core/widgets/table/static-resource-editor.js +2 -1
- package/plugins/runtime-modules/core/widgets/timeline/authoring.js +1 -1
- package/plugins/runtime-modules/core/widgets/timeline/client.d.ts +1 -3
- package/plugins/runtime-modules/core/widgets/timeline/client.js +14 -4
- package/plugins/runtime-modules/core/widgets/tree/authoring.js +1 -1
- package/plugins/runtime-modules/core/widgets/tree/client.d.ts +4 -1
- package/plugins/runtime-modules/core/widgets/tree/client.js +13 -2
- package/plugins/runtime-modules/core/widgets/tree/plugin.js +3 -2
- package/plugins/runtime-modules/core/widgets/tree/server.d.ts +3 -1
- package/plugins/runtime-modules/core/widgets/tree/server.js +2 -2
- package/plugins/runtime-modules/theme/presets.d.ts +9 -1
- package/plugins/runtime-modules/theme/tour.d.ts +9 -1
- package/plugins/runtime-modules/theme/tour.js +10 -1
- package/plugins/runtime-modules/theme/widgets/brand-controls/client.js +138 -7
- package/runtime-data-provider-client.d.ts +2 -0
- package/runtime-data-provider-client.js +7 -0
- package/styles/controls.css +10 -5
- package/styles/gradients.css +101 -0
- package/styles/root.css +18 -0
- package/styles/shell.css +64 -0
- package/theme/phi-button-shadow.d.ts +6 -0
- package/theme/phi-theme-gradients.d.ts +96 -0
- package/theme/phi-theme-gradients.js +245 -0
- package/theme/phi-theme-presets.d.ts +3 -0
- package/theme/phi-theme-presets.js +3 -0
- package/theme/phi-theme-tokens.d.ts +5 -1
- package/theme/phi-theme-tokens.js +14 -0
- package/types/cms-presets.d.ts +7 -0
- package/types/core-widget-placements.d.ts +3 -0
- package/types/layout-style.d.ts +9 -8
- package/types/layout-style.js +9 -8
- package/types/surface.d.ts +4 -0
- package/types/surface.js +4 -0
- package/types.d.ts +1 -1
- package/types.js +1 -1
|
@@ -2,7 +2,6 @@
|
|
|
2
2
|
import { jsx as _jsx } from "react/jsx-runtime";
|
|
3
3
|
import { useCallback, useEffect, useMemo, useRef, useState } from "react";
|
|
4
4
|
import { readPhiDotPath } from "../../../../../helpers/dot-path";
|
|
5
|
-
import { PhiAlertControl } from "../../../../../components/controls/phi-alert-control";
|
|
6
5
|
import { PhiDescriptionListControl } from "../../../../../components/controls/phi-description-list-control";
|
|
7
6
|
import { PhiEmptyControl } from "../../../../../components/controls/phi-empty-control";
|
|
8
7
|
import { PhiSkeletonControl } from "../../../../../components/controls/phi-skeleton-control";
|
|
@@ -11,8 +10,10 @@ import { usePhiSignalIdentity } from "../../../../../components/runtime/runtime-
|
|
|
11
10
|
import { renderPhiValueContent } from "../../../../../components/widgets/client/shared/phi-rendered-value";
|
|
12
11
|
import { usePhiTableProvider } from "../../../../../components/widgets/client/shared/phi-table-provider";
|
|
13
12
|
import { PHI_RECORD_WIDGET_DEFAULT_LABELS, formatPhiRecordWidgetLabel, } from "../../../../../components/widgets/label-types/record";
|
|
13
|
+
import { PhiWidgetFailure } from "../../../../../components/widgets/shared/widget-failure-client";
|
|
14
|
+
import { PhiCmsWidgetType } from "../../../../../constants/cms-widget-types";
|
|
14
15
|
import { readPhiTableActionSignalValue } from "../../../../../types/table-signal-values";
|
|
15
|
-
export function PhiRecordWidgetClient({ config, labels = PHI_RECORD_WIDGET_DEFAULT_LABELS, }) {
|
|
16
|
+
export function PhiRecordWidgetClient({ config, labels = PHI_RECORD_WIDGET_DEFAULT_LABELS, renderMode, }) {
|
|
16
17
|
/*
|
|
17
18
|
* Which record to show arrives as a signal, and is not read out of a store this Widget knows about.
|
|
18
19
|
*
|
|
@@ -122,8 +123,12 @@ export function PhiRecordWidgetClient({ config, labels = PHI_RECORD_WIDGET_DEFAU
|
|
|
122
123
|
if (loading) {
|
|
123
124
|
return _jsx(PhiSkeletonControl, { lines: config.presentation.fields.length || 7, withTitle: true });
|
|
124
125
|
}
|
|
126
|
+
/*
|
|
127
|
+
* Every error here is the source's -- no binding, a resource that reads no single records, a read that
|
|
128
|
+
* failed -- and none of them is the reader's to fix, so it goes the way of every such failure.
|
|
129
|
+
*/
|
|
125
130
|
if (error) {
|
|
126
|
-
return _jsx(
|
|
131
|
+
return _jsx(PhiWidgetFailure, { renderMode: renderMode, widgetType: PhiCmsWidgetType.Record, title: error });
|
|
127
132
|
}
|
|
128
133
|
if (!record) {
|
|
129
134
|
return _jsx(PhiEmptyControl, { description: labels.empty });
|
|
@@ -2,16 +2,17 @@ import { jsx as _jsx } from "react/jsx-runtime";
|
|
|
2
2
|
import { definePhiPassiveWidgetRenderers } from "../../../../../plugins/factories/widget-renderers";
|
|
3
3
|
import { phiRuntime } from "../../../../../server-helpers/phi-runtime";
|
|
4
4
|
import { getPhiRecordWidgetLabels } from "../../../../../components/widgets/label-sets/record";
|
|
5
|
+
import { readPhiRuntimeTreeRenderMode } from "../../../render-mode";
|
|
5
6
|
import { PHI_RECORD_WIDGET_DEFINITION } from "./config";
|
|
6
7
|
import { PhiRecordWidget } from "./server";
|
|
7
|
-
async function PhiRecordWidgetPluginServer({ config, runtime, }) {
|
|
8
|
+
async function PhiRecordWidgetPluginServer({ widget, config, runtime, }) {
|
|
8
9
|
const rt = phiRuntime(runtime);
|
|
9
10
|
const labels = await getPhiRecordWidgetLabels({
|
|
10
11
|
apiBaseUrl: rt.apiBaseUrl,
|
|
11
12
|
internalToken: rt.internalToken,
|
|
12
13
|
locale: runtime.locale.current,
|
|
13
14
|
});
|
|
14
|
-
return _jsx(PhiRecordWidget, { config: config, labels: labels });
|
|
15
|
+
return _jsx(PhiRecordWidget, { config: config, labels: labels, renderMode: readPhiRuntimeTreeRenderMode(widget.config) });
|
|
15
16
|
}
|
|
16
17
|
export const PHI_RECORD_WIDGET_PLUGIN = {
|
|
17
18
|
...PHI_RECORD_WIDGET_DEFINITION,
|
|
@@ -1,7 +1,9 @@
|
|
|
1
1
|
import type { PhiRecordWidgetLabels } from "../../../../../components/widgets/label-types/record";
|
|
2
2
|
import type { PhiRecordWidgetConfig } from "../../../../../types/record-widget";
|
|
3
|
+
import type { PhiRenderableBlockRenderMode } from "../../../../../types/renderable-block";
|
|
3
4
|
export type PhiRecordWidgetProps = {
|
|
4
5
|
config: PhiRecordWidgetConfig;
|
|
5
6
|
labels: PhiRecordWidgetLabels;
|
|
7
|
+
renderMode: PhiRenderableBlockRenderMode;
|
|
6
8
|
};
|
|
7
|
-
export declare function PhiRecordWidget({ config, labels }: PhiRecordWidgetProps): import("react").JSX.Element;
|
|
9
|
+
export declare function PhiRecordWidget({ config, labels, renderMode }: PhiRecordWidgetProps): import("react").JSX.Element;
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { jsx as _jsx } from "react/jsx-runtime";
|
|
2
2
|
import { PhiCmsWidgetType } from "../../../../../constants/cms-widget-types";
|
|
3
3
|
import { PhiRuntimeModuleRenderClientHost } from "../../../../../components/runtime/runtime-module-render-client-manifest";
|
|
4
|
-
export function PhiRecordWidget({ config, labels }) {
|
|
5
|
-
return (_jsx(PhiRuntimeModuleRenderClientHost, { type: PhiCmsWidgetType.Record, componentProps: { config, labels } }));
|
|
4
|
+
export function PhiRecordWidget({ config, labels, renderMode }) {
|
|
5
|
+
return (_jsx(PhiRuntimeModuleRenderClientHost, { type: PhiCmsWidgetType.Record, componentProps: { config, labels, renderMode } }));
|
|
6
6
|
}
|
|
@@ -14,7 +14,7 @@ export function PhiSegmentedWidget({ config, signalsEnabled = true, mode = "prev
|
|
|
14
14
|
if (choice.options.length === 0 && emptyHint) {
|
|
15
15
|
return _jsx(PhiEmptyControl, { description: emptyHint });
|
|
16
16
|
}
|
|
17
|
-
return (_jsx(PhiSegmentedControl, { block: fill, label: config?.label, value: choice.value || undefined, disabled: choice.disabled, readOnly: choice.readOnly, size: config?.controlSize, options: choice.options, onChange: (resolvedValue) => {
|
|
17
|
+
return (_jsx(PhiSegmentedControl, { block: fill, label: config?.label, value: choice.value || undefined, disabled: choice.disabled, readOnly: choice.readOnly, size: config?.controlSize, ...(config?.gradient ? { gradient: config.gradient } : {}), options: choice.options, onChange: (resolvedValue) => {
|
|
18
18
|
onChange?.(resolvedValue);
|
|
19
19
|
choice.publish(resolvedValue);
|
|
20
20
|
}, onFocus: choice.emitFocus, onBlur: choice.emitBlur }));
|
|
@@ -1,5 +1,9 @@
|
|
|
1
|
+
import { type PhiThemeGradientKey } from "../../../../../theme/phi-theme-gradients";
|
|
1
2
|
import { type PhiStackChoiceControlConfig } from "../../../../../components/widgets/config/choice-shared";
|
|
2
|
-
export type PhiSegmentedWidgetConfig = PhiStackChoiceControlConfig
|
|
3
|
+
export type PhiSegmentedWidgetConfig = PhiStackChoiceControlConfig & {
|
|
4
|
+
/** A Theme gradient slot the selected segment is filled with; absent, Ant Design's selected ground. */
|
|
5
|
+
gradient?: PhiThemeGradientKey;
|
|
6
|
+
};
|
|
3
7
|
declare function parsePhiSegmentedWidgetConfig(config: Record<string, unknown>): PhiSegmentedWidgetConfig;
|
|
4
8
|
export declare const PHI_SEGMENTED_WIDGET_DEFINITION: {
|
|
5
9
|
kind: "widget";
|
|
@@ -111,6 +115,22 @@ export declare const PHI_SEGMENTED_WIDGET_DEFINITION: {
|
|
|
111
115
|
key: string;
|
|
112
116
|
type: "string";
|
|
113
117
|
label: string;
|
|
118
|
+
description?: undefined;
|
|
119
|
+
options?: undefined;
|
|
120
|
+
emptyOption?: undefined;
|
|
121
|
+
} | {
|
|
122
|
+
key: string;
|
|
123
|
+
type: "choice";
|
|
124
|
+
label: string;
|
|
125
|
+
description: string;
|
|
126
|
+
options: {
|
|
127
|
+
value: "gradient1" | "gradient2" | "gradient3";
|
|
128
|
+
label: string;
|
|
129
|
+
}[];
|
|
130
|
+
emptyOption: {
|
|
131
|
+
value: string;
|
|
132
|
+
label: string;
|
|
133
|
+
};
|
|
114
134
|
})[];
|
|
115
135
|
defaultConfig: {
|
|
116
136
|
key: string;
|
|
@@ -1,8 +1,10 @@
|
|
|
1
|
+
import { readPhiThemeGradientKey } from "../../../../../theme/phi-theme-gradients";
|
|
2
|
+
import { PHI_THEME_GRADIENT_FIELD_OPTIONS } from "../../../../../components/widgets/config/theme-gradient";
|
|
1
3
|
import { resolvePhiCmsWidgetPluginKey } from "../../../../../constants/cms-widget-types";
|
|
2
4
|
import { buildPhiChoiceControlOptionFields, PHI_CHOICE_CONTROL_CONFIG_FIELDS, PHI_CHOICE_CONTROL_VALUE_MODE_FIELD, parsePhiStackChoiceControlConfig, } from "../../../../../components/widgets/config/choice-shared";
|
|
3
5
|
import { PHI_SELECT_CONTROL_SIGNALS } from "../../../../../components/widgets/signals/control-signal-capabilities";
|
|
4
6
|
function parsePhiSegmentedWidgetConfig(config) {
|
|
5
|
-
return parsePhiStackChoiceControlConfig(config);
|
|
7
|
+
return { ...parsePhiStackChoiceControlConfig(config), gradient: readPhiThemeGradientKey(config.gradient) };
|
|
6
8
|
}
|
|
7
9
|
export const PHI_SEGMENTED_WIDGET_DEFINITION = {
|
|
8
10
|
kind: "widget",
|
|
@@ -22,6 +24,14 @@ export const PHI_SEGMENTED_WIDGET_DEFINITION = {
|
|
|
22
24
|
PHI_CHOICE_CONTROL_VALUE_MODE_FIELD,
|
|
23
25
|
...buildPhiChoiceControlOptionFields("toolbar"),
|
|
24
26
|
...PHI_CHOICE_CONTROL_CONFIG_FIELDS,
|
|
27
|
+
{
|
|
28
|
+
key: "gradient",
|
|
29
|
+
type: "choice",
|
|
30
|
+
label: "Gradient",
|
|
31
|
+
description: "Fills the selected segment with one of the Theme's gradients.",
|
|
32
|
+
options: [...PHI_THEME_GRADIENT_FIELD_OPTIONS],
|
|
33
|
+
emptyOption: { value: "", label: "None" },
|
|
34
|
+
},
|
|
25
35
|
],
|
|
26
36
|
defaultConfig: {
|
|
27
37
|
key: "segmented",
|
|
@@ -35,5 +35,5 @@ export function PhiSwitchWidget({ config, disabled, readOnly, checked: controlle
|
|
|
35
35
|
onChange?.(nextChecked);
|
|
36
36
|
controlSignals.emitChange(nextChecked);
|
|
37
37
|
}
|
|
38
|
-
return (_jsx(PhiSwitchControl, { checked: checked, disabled: resolvedDisabled, readOnly: controlSignals.readOnly, size: config?.controlSize, label: config?.label, checkedLabel: config?.checkedLabel, uncheckedLabel: config?.uncheckedLabel, onChange: publish }));
|
|
38
|
+
return (_jsx(PhiSwitchControl, { checked: checked, disabled: resolvedDisabled, readOnly: controlSignals.readOnly, size: config?.controlSize, label: config?.label, checkedLabel: config?.checkedLabel, uncheckedLabel: config?.uncheckedLabel, ...(config?.gradient ? { gradient: config.gradient } : {}), onChange: publish }));
|
|
39
39
|
}
|
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import { type PhiThemeGradientKey } from "../../../../../theme/phi-theme-gradients";
|
|
1
2
|
import { type PhiControlConfig } from "../../../../../components/widgets/config/control-signal-config";
|
|
2
3
|
type PhiSwitchControlSize = "small" | "medium";
|
|
3
4
|
export type PhiSwitchWidgetConfig = PhiControlConfig<PhiSwitchControlSize> & {
|
|
@@ -5,6 +6,8 @@ export type PhiSwitchWidgetConfig = PhiControlConfig<PhiSwitchControlSize> & {
|
|
|
5
6
|
defaultChecked?: boolean;
|
|
6
7
|
checkedLabel?: string;
|
|
7
8
|
uncheckedLabel?: string;
|
|
9
|
+
/** A Theme gradient slot the switch is filled with while on; absent, the primary colour. */
|
|
10
|
+
gradient?: PhiThemeGradientKey;
|
|
8
11
|
};
|
|
9
12
|
declare function parsePhiSwitchWidgetConfig(config: Record<string, unknown>): PhiSwitchWidgetConfig;
|
|
10
13
|
export declare const PHI_SWITCH_WIDGET_DEFINITION: {
|
|
@@ -50,6 +53,22 @@ export declare const PHI_SWITCH_WIDGET_DEFINITION: {
|
|
|
50
53
|
key: string;
|
|
51
54
|
type: "string";
|
|
52
55
|
label: string;
|
|
56
|
+
description?: undefined;
|
|
57
|
+
options?: undefined;
|
|
58
|
+
emptyOption?: undefined;
|
|
59
|
+
} | {
|
|
60
|
+
key: string;
|
|
61
|
+
type: "choice";
|
|
62
|
+
label: string;
|
|
63
|
+
description: string;
|
|
64
|
+
options: {
|
|
65
|
+
value: "gradient1" | "gradient2" | "gradient3";
|
|
66
|
+
label: string;
|
|
67
|
+
}[];
|
|
68
|
+
emptyOption: {
|
|
69
|
+
value: string;
|
|
70
|
+
label: string;
|
|
71
|
+
};
|
|
53
72
|
})[];
|
|
54
73
|
defaultConfig: {
|
|
55
74
|
defaultChecked: false;
|
|
@@ -1,3 +1,5 @@
|
|
|
1
|
+
import { readPhiThemeGradientKey } from "../../../../../theme/phi-theme-gradients";
|
|
2
|
+
import { PHI_THEME_GRADIENT_FIELD_OPTIONS } from "../../../../../components/widgets/config/theme-gradient";
|
|
1
3
|
import { resolvePhiCmsWidgetPluginKey } from "../../../../../constants/cms-widget-types";
|
|
2
4
|
import { readBoolean, readString } from "../../../../../components/widgets/config/parser-primitives";
|
|
3
5
|
import { PHI_BOOLEAN_CONTROL_SIGNALS } from "../../../../../components/widgets/signals/control-signal-capabilities";
|
|
@@ -10,6 +12,7 @@ function parsePhiSwitchWidgetConfig(config) {
|
|
|
10
12
|
defaultChecked: readBoolean(config.defaultChecked) ?? false,
|
|
11
13
|
checkedLabel: readString(config.checkedLabel),
|
|
12
14
|
uncheckedLabel: readString(config.uncheckedLabel),
|
|
15
|
+
gradient: readPhiThemeGradientKey(config.gradient),
|
|
13
16
|
};
|
|
14
17
|
}
|
|
15
18
|
export const PHI_SWITCH_WIDGET_DEFINITION = {
|
|
@@ -37,6 +40,14 @@ export const PHI_SWITCH_WIDGET_DEFINITION = {
|
|
|
37
40
|
{ key: "checkedLabel", type: "string", label: "Checked Text" },
|
|
38
41
|
{ key: "uncheckedLabel", type: "string", label: "Unchecked Text" },
|
|
39
42
|
...PHI_COMPACT_CONTROL_PRESENTATION_FIELDS,
|
|
43
|
+
{
|
|
44
|
+
key: "gradient",
|
|
45
|
+
type: "choice",
|
|
46
|
+
label: "Gradient",
|
|
47
|
+
description: "Fills the switch with one of the Theme's gradients while it is on.",
|
|
48
|
+
options: [...PHI_THEME_GRADIENT_FIELD_OPTIONS],
|
|
49
|
+
emptyOption: { value: "", label: "None" },
|
|
50
|
+
},
|
|
40
51
|
...PHI_CONTROL_STATE_FIELDS,
|
|
41
52
|
],
|
|
42
53
|
defaultConfig: {
|
|
@@ -4,4 +4,4 @@ import { createPhiCmsBuilderWidgetPlugin } from "../../../../../plugins/factorie
|
|
|
4
4
|
import { PHI_TABLE_WIDGET_DEFINITION } from "./config";
|
|
5
5
|
import { PhiTableWidgetClient } from "./client";
|
|
6
6
|
import { PHI_TABLE_WIDGET_DEFAULT_LABELS } from "../../../../../components/widgets/label-types/table";
|
|
7
|
-
export const PHI_TABLE_WIDGET_BUILDER_PLUGIN = createPhiCmsBuilderWidgetPlugin(PHI_TABLE_WIDGET_DEFINITION, ({ config }) => _jsx(PhiTableWidgetClient, { config: config, labels: PHI_TABLE_WIDGET_DEFAULT_LABELS }));
|
|
7
|
+
export const PHI_TABLE_WIDGET_BUILDER_PLUGIN = createPhiCmsBuilderWidgetPlugin(PHI_TABLE_WIDGET_DEFINITION, ({ config }) => _jsx(PhiTableWidgetClient, { config: config, renderMode: "editor", labels: PHI_TABLE_WIDGET_DEFAULT_LABELS }));
|
|
@@ -1,8 +1,11 @@
|
|
|
1
1
|
import type { PhiTableWidgetLabels } from "../../../../../components/widgets/label-types/table";
|
|
2
|
+
import type { PhiRenderableBlockRenderMode } from "../../../../../types/renderable-block";
|
|
2
3
|
import { type PhiTableActionDefinition, type PhiTableProviderMutationResult, type PhiTableProviderQueryResult, type PhiTableQuery, type PhiTableRowIdentity, type PhiTableWidgetConfig, type PhiTableWidgetState } from "../../../../../types/table-widget";
|
|
3
4
|
type TableRow = Record<string, unknown>;
|
|
4
5
|
export type PhiTableWidgetClientProps = {
|
|
5
6
|
config: PhiTableWidgetConfig;
|
|
7
|
+
/** Where this draws, which decides who reads a failure of the source: the author, or only the log. */
|
|
8
|
+
renderMode: PhiRenderableBlockRenderMode;
|
|
6
9
|
externalSearch?: string;
|
|
7
10
|
externalQuery?: PhiTableQuery;
|
|
8
11
|
refreshKey?: string | number;
|
|
@@ -17,5 +20,5 @@ export type PhiTableWidgetClientProps = {
|
|
|
17
20
|
selectedRowIdentities?: readonly PhiTableRowIdentity[];
|
|
18
21
|
}) => boolean | void;
|
|
19
22
|
};
|
|
20
|
-
export declare function PhiTableWidgetClient({ config: inputConfig, externalSearch, externalQuery, refreshKey, onData, onMutation, onStateChange, labels, onAction, }: PhiTableWidgetClientProps): import("react").JSX.Element;
|
|
23
|
+
export declare function PhiTableWidgetClient({ config: inputConfig, renderMode, externalSearch, externalQuery, refreshKey, onData, onMutation, onStateChange, labels, onAction, }: PhiTableWidgetClientProps): import("react").JSX.Element;
|
|
21
24
|
export {};
|
|
@@ -7,6 +7,8 @@ import { PhiDescriptionHint } from "../../../../../components/controls/phi-descr
|
|
|
7
7
|
import { Fragment, useCallback, useEffect, useEffectEvent, useMemo, useRef, useState } from "react";
|
|
8
8
|
import { PhiMultiSelectControl } from "../../../../../components/controls/phi-multi-select-control";
|
|
9
9
|
import { PhiAlertControl } from "../../../../../components/controls/phi-alert-control";
|
|
10
|
+
import { PhiWidgetFailure } from "../../../../../components/widgets/shared/widget-failure-client";
|
|
11
|
+
import { PhiCmsWidgetType } from "../../../../../constants/cms-widget-types";
|
|
10
12
|
import { usePhiConfirmDialog } from "../../../../../components/controls/phi-confirm-dialog";
|
|
11
13
|
import { PhiCascaderControl } from "../../../../../components/controls/phi-cascader-control";
|
|
12
14
|
import { PhiCollectionHeaderControl } from "../../../../../components/controls/phi-collection-header-control";
|
|
@@ -198,7 +200,7 @@ function resolveTableActions(definitions, capabilities) {
|
|
|
198
200
|
}
|
|
199
201
|
return result;
|
|
200
202
|
}
|
|
201
|
-
export function PhiTableWidgetClient({ config: inputConfig, externalSearch, externalQuery, refreshKey, onData, onMutation, onStateChange, labels = PHI_TABLE_WIDGET_DEFAULT_LABELS, onAction, }) {
|
|
203
|
+
export function PhiTableWidgetClient({ config: inputConfig, renderMode, externalSearch, externalQuery, refreshKey, onData, onMutation, onStateChange, labels = PHI_TABLE_WIDGET_DEFAULT_LABELS, onAction, }) {
|
|
202
204
|
const { token } = usePhiConfig();
|
|
203
205
|
const { showMessage } = usePhiApplicationFeedback();
|
|
204
206
|
/*
|
|
@@ -306,7 +308,7 @@ export function PhiTableWidgetClient({ config: inputConfig, externalSearch, exte
|
|
|
306
308
|
},
|
|
307
309
|
validateResource,
|
|
308
310
|
});
|
|
309
|
-
const { resource, bindingError, contractError, rows, total, hasMore, summary, loading, error, query, resolvedQuery, setQuery, selectedRowIdentities, setSelectedRowIdentities, expandedRowIdentities, setExpandedRowIdentities, reload, executeAction, commitField, commitRow, isFieldMutationPending, moveRow, drop, } = binding;
|
|
311
|
+
const { resource, bindingError, contractError, rows, total, hasMore, summary, loading, error, queryError, query, resolvedQuery, setQuery, selectedRowIdentities, setSelectedRowIdentities, expandedRowIdentities, setExpandedRowIdentities, reload, executeAction, commitField, commitRow, isFieldMutationPending, moveRow, drop, } = binding;
|
|
310
312
|
const toolbarActions = useMemo(() => resolveTableActions(features.actions?.toolbar, resource?.actions), [features.actions?.toolbar, resource?.actions]);
|
|
311
313
|
const rowActions = useMemo(() => resolveTableActions(features.actions?.row, resource?.actions), [features.actions?.row, resource?.actions]);
|
|
312
314
|
const bulkActions = useMemo(() => resolveTableActions(features.actions?.bulk, resource?.actions), [features.actions?.bulk, resource?.actions]);
|
|
@@ -780,12 +782,23 @@ export function PhiTableWidgetClient({ config: inputConfig, externalSearch, exte
|
|
|
780
782
|
const disabled = findMatchingCondition(null, action.disabledWhen, conditionSources);
|
|
781
783
|
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);
|
|
782
784
|
}), hasQueryTools && features.tools?.reset !== false ? (_jsx(PhiButtonControl, { icon: _jsx(PhiIcon, { name: "undo", size: "inherit" }), ariaLabel: 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;
|
|
785
|
+
/*
|
|
786
|
+
* The source's failures end the Table here: a binding that does not hold, a resource the
|
|
787
|
+
* configuration does not fit, a read that failed. A refused edit is not one of them -- it stays in
|
|
788
|
+
* `error` alone and is said above the rows to the person who made it.
|
|
789
|
+
*/
|
|
790
|
+
const sourceFailure = bindingError ?? contractError ?? queryError?.message ?? null;
|
|
791
|
+
if (sourceFailure) {
|
|
792
|
+
return (_jsx(PhiWidgetFailure, { renderMode: renderMode, widgetType: PhiCmsWidgetType.Table, title: sourceFailure, error: queryError }));
|
|
793
|
+
}
|
|
783
794
|
return (_jsxs(PhiFlexControl, { vertical: true, gap: selfContainedTools ? token.paddingSM : token.padding, style: { minWidth: 0, width: "100%" }, children: [confirmDialog, _jsx(PhiCollectionHeaderControl, { title: presentation.title, description: presentation.description, filters: collectionFilters, toolbar: collectionToolbar }), !selfContainedTools && bulkActions.length && selectedRowIdentities.length > 0 ? (_jsx(PhiAlertControl, { level: "info", title: (_jsxs(PhiFlexControl, { align: "center", justify: "space-between", gap: "small", wrap: true, children: [_jsx("span", { children: formatPhiTableWidgetLabel(labels.selected, selectedRowIdentities.length) }), _jsx(PhiFlexControl, { align: "center", gap: "small", children: bulkActions.map((action) => {
|
|
784
795
|
if (!matchesAllConditions(null, action.visibleWhen, conditionSources))
|
|
785
796
|
return null;
|
|
786
797
|
const disabled = findMatchingCondition(null, action.disabledWhen, conditionSources);
|
|
787
798
|
return _jsx(TableAction, { action: action, size: resolvedControlSize, disabled: Boolean(disabled), disabledReason: disabled && "reason" in disabled ? disabled.reason : undefined, onActivate: () => activateAction(action, undefined, selectedRowIdentities) }, action.key);
|
|
788
|
-
}) })] })) })) : null,
|
|
799
|
+
}) })] })) })) : null, error ? _jsx(PhiAlertControl, { level: "error", showIcon: true, title: error.message }) : null, _jsx(PhiTableBindingControl, { rows: rows, fields: resource?.fields ?? [], sourceConfig: bindingParams,
|
|
800
|
+
/* Options an editor could not be given: the rows still stand, the author reads why. */
|
|
801
|
+
renderDiagnostics: (warnings) => warnings.map((warning) => (_jsx(PhiWidgetFailure, { renderMode: renderMode, widgetType: PhiCmsWidgetType.Table, title: warning }, warning))), rowIdentityPath: resource?.rowIdentityPath ?? "id", columns: columns, columnOrder: columnOrder, sortingMode: features.sorting?.mode ?? "none", sorts: resolvedQuery.sorts ?? [], onSortsChange: (sorts) => setQuery((current) => ({ ...current, page: 1, cursor: null, sorts })), columnReordering: features.columnReordering?.enabled === true, onColumnOrderChange: updateColumnOrder, rowSelection: features.rowSelection?.mode && features.rowSelection.mode !== "none" ? {
|
|
789
802
|
mode: features.rowSelection.mode,
|
|
790
803
|
selectedRowIdentities,
|
|
791
804
|
preserveSelectedRowIdentities: features.rowSelection.preserveSelectedRowIdentities,
|
|
@@ -1,17 +1,18 @@
|
|
|
1
1
|
import { jsx as _jsx } from "react/jsx-runtime";
|
|
2
2
|
import { definePhiPassiveWidgetRenderers } from "../../../../../plugins/factories/widget-renderers";
|
|
3
3
|
import { phiRuntime } from "../../../../../server-helpers/phi-runtime";
|
|
4
|
+
import { readPhiRuntimeTreeRenderMode } from "../../../render-mode";
|
|
4
5
|
import { PHI_TABLE_WIDGET_DEFINITION } from "./config";
|
|
5
6
|
import { PhiTableWidget } from "./server";
|
|
6
7
|
import { getPhiTableWidgetLabels } from "../../../../../components/widgets/label-sets/table";
|
|
7
|
-
async function PhiTableWidgetPluginServer({ config, runtime, }) {
|
|
8
|
+
async function PhiTableWidgetPluginServer({ widget, config, runtime, }) {
|
|
8
9
|
const rt = phiRuntime(runtime);
|
|
9
10
|
const labels = await getPhiTableWidgetLabels({
|
|
10
11
|
apiBaseUrl: rt.apiBaseUrl,
|
|
11
12
|
internalToken: rt.internalToken,
|
|
12
13
|
locale: runtime.locale.current,
|
|
13
14
|
});
|
|
14
|
-
return _jsx(PhiTableWidget, { config: config, labels: labels });
|
|
15
|
+
return _jsx(PhiTableWidget, { config: config, labels: labels, renderMode: readPhiRuntimeTreeRenderMode(widget.config) });
|
|
15
16
|
}
|
|
16
17
|
export const PHI_TABLE_WIDGET_PLUGIN = {
|
|
17
18
|
...PHI_TABLE_WIDGET_DEFINITION,
|
|
@@ -1,7 +1,9 @@
|
|
|
1
1
|
import type { PhiTableWidgetConfig } from "../../../../../types";
|
|
2
2
|
import type { PhiTableWidgetLabels } from "../../../../../components/widgets/label-types/table";
|
|
3
|
+
import type { PhiRenderableBlockRenderMode } from "../../../../../types/renderable-block";
|
|
3
4
|
export type PhiTableWidgetProps = {
|
|
4
5
|
config: PhiTableWidgetConfig;
|
|
5
6
|
labels: PhiTableWidgetLabels;
|
|
7
|
+
renderMode: PhiRenderableBlockRenderMode;
|
|
6
8
|
};
|
|
7
|
-
export declare function PhiTableWidget({ config, labels }: PhiTableWidgetProps): import("react").JSX.Element;
|
|
9
|
+
export declare function PhiTableWidget({ config, labels, renderMode }: PhiTableWidgetProps): import("react").JSX.Element;
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { jsx as _jsx } from "react/jsx-runtime";
|
|
2
2
|
import { PhiCmsWidgetType } from "../../../../../constants/cms-widget-types";
|
|
3
3
|
import { PhiRuntimeModuleRenderClientHost } from "../../../../../components/runtime/runtime-module-render-client-manifest";
|
|
4
|
-
export function PhiTableWidget({ config, labels }) {
|
|
5
|
-
return (_jsx(PhiRuntimeModuleRenderClientHost, { type: PhiCmsWidgetType.Table, componentProps: { config, labels } }));
|
|
4
|
+
export function PhiTableWidget({ config, labels, renderMode }) {
|
|
5
|
+
return (_jsx(PhiRuntimeModuleRenderClientHost, { type: PhiCmsWidgetType.Table, componentProps: { config, labels, renderMode } }));
|
|
6
6
|
}
|
|
@@ -6,5 +6,6 @@ export function PhiStaticTableResourceEditor({ config, labels = PHI_TABLE_WIDGET
|
|
|
6
6
|
if (!config.source) {
|
|
7
7
|
throw new Error("Static Table resource authoring requires a Provider resource binding.");
|
|
8
8
|
}
|
|
9
|
-
|
|
9
|
+
// An authoring surface: what does not hold is the author's to read.
|
|
10
|
+
return _jsx(PhiTableWidgetClient, { config: config, renderMode: "editor", labels: labels });
|
|
10
11
|
}
|
|
@@ -5,7 +5,7 @@ import { PHI_TIMELINE_WIDGET_DEFINITION } from "./config";
|
|
|
5
5
|
import { PhiStaticTimelineToolButton } from "../../../../../components/widgets/builder/phi-static-timeline-picker";
|
|
6
6
|
export const PHI_TIMELINE_WIDGET_BUILDER_PLUGIN = {
|
|
7
7
|
...PHI_TIMELINE_WIDGET_DEFINITION,
|
|
8
|
-
renderEditor: ({ widget, config, runtime }) => (_jsx(PhiTimelineWidget, { blockId: widget.id, config: config, locale: runtime.locale.current
|
|
8
|
+
renderEditor: ({ widget, config, runtime }) => (_jsx(PhiTimelineWidget, { blockId: widget.id, config: config, locale: runtime.locale.current })),
|
|
9
9
|
/* The Widget's own entries, only while no Provider answers in their place. */
|
|
10
10
|
renderEditorTools: ({ config, authoring }) => authoring?.updateConfig && !config.entriesProvider ? (_jsx(PhiStaticTimelineToolButton, { entries: config.entries, onApply: (entries) => authoring.updateConfig?.({ entries }) })) : null,
|
|
11
11
|
};
|
|
@@ -1,10 +1,8 @@
|
|
|
1
1
|
import type { PhiTimelineWidgetConfig } from "./config";
|
|
2
2
|
import type { PhiCmsInstanceId } from "../../../../../types/cms-instance-id";
|
|
3
|
-
export declare function PhiTimelineWidget({ config, blockId, locale,
|
|
3
|
+
export declare function PhiTimelineWidget({ config, blockId, locale, }: {
|
|
4
4
|
config?: PhiTimelineWidgetConfig | null;
|
|
5
5
|
blockId?: PhiCmsInstanceId | null;
|
|
6
6
|
/** The page's locale, which a date is formatted in; never the browser's. */
|
|
7
7
|
locale?: string;
|
|
8
|
-
/** In the Builder an author sees why a Provider answers nothing; a reader sees an empty Timeline. */
|
|
9
|
-
showProviderErrors?: boolean;
|
|
10
8
|
}): import("react").JSX.Element;
|
|
@@ -1,13 +1,15 @@
|
|
|
1
1
|
"use client";
|
|
2
|
-
import { jsx as _jsx
|
|
2
|
+
import { jsx as _jsx } from "react/jsx-runtime";
|
|
3
3
|
import { useMemo, useState } from "react";
|
|
4
4
|
import { createPhiSignalAddress } from "../../../../../types/signals";
|
|
5
5
|
import { isPhiRecord } from "../../../../../helpers/is-record";
|
|
6
6
|
import { formatPhiDate, formatPhiDateTime, formatPhiRelativeTime } from "../../../../../helpers/format-date-time";
|
|
7
|
-
import { PhiAlertControl } from "../../../../../components/controls/phi-alert-control";
|
|
8
7
|
import { PhiTimelineControl } from "../../../../../components/controls/phi-timeline-control";
|
|
9
8
|
import { usePhiControlSignalController } from "../../../../../components/widgets/client/shared/phi-control-signals";
|
|
10
9
|
import { usePhiTimelineProviderEntries } from "../../../../../components/widgets/client/shared/phi-timeline-provider";
|
|
10
|
+
import { PhiWidgetFailure } from "../../../../../components/widgets/shared/widget-failure-client";
|
|
11
|
+
import { PhiCmsWidgetType } from "../../../../../constants/cms-widget-types";
|
|
12
|
+
import { readPhiRuntimeTreeRenderMode } from "../../../render-mode";
|
|
11
13
|
function formatEntryTime(entry, format, locale) {
|
|
12
14
|
/* Words the entry states are shown as written; a date is formatted for the reader. */
|
|
13
15
|
if (entry.time)
|
|
@@ -18,7 +20,7 @@ function formatEntryTime(entry, format, locale) {
|
|
|
18
20
|
return formatPhiRelativeTime(entry.at, locale);
|
|
19
21
|
return format === "datetime" ? formatPhiDateTime(entry.at, locale) : formatPhiDate(entry.at, locale);
|
|
20
22
|
}
|
|
21
|
-
export function PhiTimelineWidget({ config, blockId, locale = "en",
|
|
23
|
+
export function PhiTimelineWidget({ config, blockId, locale = "en", }) {
|
|
22
24
|
/*
|
|
23
25
|
* Params a signal chose, over the stored ones. Kept with the binding they were chosen for, so a
|
|
24
26
|
* Provider changed in the Inspector starts from its own stored params again.
|
|
@@ -71,5 +73,13 @@ export function PhiTimelineWidget({ config, blockId, locale = "en", showProvider
|
|
|
71
73
|
tone: entry.tone,
|
|
72
74
|
pending: entry.pending,
|
|
73
75
|
}));
|
|
74
|
-
|
|
76
|
+
/*
|
|
77
|
+
* A Provider that is not there or did not answer leaves nothing to draw, and an empty Timeline would
|
|
78
|
+
* say there was nothing to tell. The config carries where it draws, so the author reads why and a
|
|
79
|
+
* reader is shown nothing.
|
|
80
|
+
*/
|
|
81
|
+
if (provided.error) {
|
|
82
|
+
return (_jsx(PhiWidgetFailure, { renderMode: readPhiRuntimeTreeRenderMode(config ?? {}), widgetType: PhiCmsWidgetType.Timeline, widgetId: blockId, title: provided.error }));
|
|
83
|
+
}
|
|
84
|
+
return _jsx(PhiTimelineControl, { items: items, placement: config?.placement });
|
|
75
85
|
}
|
|
@@ -4,4 +4,4 @@ import { createPhiCmsBuilderWidgetPlugin } from "../../../../../plugins/factorie
|
|
|
4
4
|
import { PHI_TREE_WIDGET_DEFINITION } from "./config";
|
|
5
5
|
import { PhiTreeWidgetClient } from "./client";
|
|
6
6
|
import { PHI_TREE_WIDGET_DEFAULT_LABELS } from "../../../../../components/widgets/label-types/tree";
|
|
7
|
-
export const PHI_TREE_WIDGET_BUILDER_PLUGIN = createPhiCmsBuilderWidgetPlugin(PHI_TREE_WIDGET_DEFINITION, ({ config }) => _jsx(PhiTreeWidgetClient, { config: config, labels: PHI_TREE_WIDGET_DEFAULT_LABELS }));
|
|
7
|
+
export const PHI_TREE_WIDGET_BUILDER_PLUGIN = createPhiCmsBuilderWidgetPlugin(PHI_TREE_WIDGET_DEFINITION, ({ config }) => _jsx(PhiTreeWidgetClient, { config: config, renderMode: "editor", labels: PHI_TREE_WIDGET_DEFAULT_LABELS }));
|
|
@@ -1,6 +1,9 @@
|
|
|
1
1
|
import type { PhiTreeWidgetLabels } from "../../../../../components/widgets/label-types/tree";
|
|
2
2
|
import type { PhiTreeWidgetConfig } from "../../../../../types/tree-widget";
|
|
3
|
-
|
|
3
|
+
import type { PhiRenderableBlockRenderMode } from "../../../../../types/renderable-block";
|
|
4
|
+
export declare function PhiTreeWidgetClient({ config, labels, renderMode }: {
|
|
4
5
|
config: PhiTreeWidgetConfig;
|
|
5
6
|
labels: PhiTreeWidgetLabels;
|
|
7
|
+
/** Where this draws, which decides who reads a failure of the source: the author, or only the log. */
|
|
8
|
+
renderMode: PhiRenderableBlockRenderMode;
|
|
6
9
|
}): import("react").JSX.Element;
|
|
@@ -11,6 +11,8 @@ import { PhiButtonControl } from "../../../../../components/controls/phi-button-
|
|
|
11
11
|
import { PhiCollectionHeaderControl } from "../../../../../components/controls/phi-collection-header-control";
|
|
12
12
|
import { PhiToolbarControl } from "../../../../../components/controls/phi-toolbar-control";
|
|
13
13
|
import { PhiAlertControl } from "../../../../../components/controls/phi-alert-control";
|
|
14
|
+
import { PhiWidgetFailure } from "../../../../../components/widgets/shared/widget-failure-client";
|
|
15
|
+
import { PhiCmsWidgetType } from "../../../../../constants/cms-widget-types";
|
|
14
16
|
import { usePhiControlOptionsProvider } from "../../../../../components/controls/phi-options-provider";
|
|
15
17
|
import { usePhiConfig } from "../../../../../components/root/phi-config-provider";
|
|
16
18
|
import { clearPhiDataDragPayload, readPhiDataDragPayload, startPhiDataDragAutoScroll, writePhiDataDragPayload, } from "../../../../../components/runtime/client/phi-data-dnd";
|
|
@@ -31,7 +33,7 @@ function TreeBindingTool({ field, label, placeholder, presentation, width, sourc
|
|
|
31
33
|
});
|
|
32
34
|
return (_jsx(PhiSelectControl, { label: label, placeholder: placeholder, presentation: presentation, value: typeof value === "string" || typeof value === "number" ? value : undefined, options: options.options, disabled: Boolean(options.warning), size: controlSize, onChange: onChange, style: { width: width ?? 180, minWidth: 0 } }));
|
|
33
35
|
}
|
|
34
|
-
export function PhiTreeWidgetClient({ config, labels }) {
|
|
36
|
+
export function PhiTreeWidgetClient({ config, labels, renderMode }) {
|
|
35
37
|
const { token } = usePhiConfig();
|
|
36
38
|
/*
|
|
37
39
|
* What the reader set, tagged with the configured params it was set against: a Builder edit of those
|
|
@@ -183,6 +185,15 @@ export function PhiTreeWidgetClient({ config, labels }) {
|
|
|
183
185
|
(config.features.actions?.toolbar?.length ?? 0) > 0 ||
|
|
184
186
|
hasResettableQuery && tools?.reset !== false ||
|
|
185
187
|
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: "undo", size: "inherit" }), ariaLabel: 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
|
+
/*
|
|
189
|
+
* The source's failures end the Tree here: a binding that does not hold, a resource the configuration
|
|
190
|
+
* does not fit, a read that failed. A refused change stays in `binding.error` alone, said above the
|
|
191
|
+
* nodes to the person who made it.
|
|
192
|
+
*/
|
|
193
|
+
const sourceFailure = binding.bindingError ?? contractError ?? binding.queryError?.message ?? null;
|
|
194
|
+
if (sourceFailure) {
|
|
195
|
+
return (_jsx(PhiWidgetFailure, { renderMode: renderMode, widgetType: PhiCmsWidgetType.Tree, title: sourceFailure, error: binding.queryError }));
|
|
196
|
+
}
|
|
186
197
|
return (_jsxs("div", { style: {
|
|
187
198
|
display: "flex",
|
|
188
199
|
flexDirection: "column",
|
|
@@ -190,7 +201,7 @@ export function PhiTreeWidgetClient({ config, labels }) {
|
|
|
190
201
|
width: config.presentation.width ?? "100%",
|
|
191
202
|
minWidth: config.presentation.minWidth,
|
|
192
203
|
maxWidth: config.presentation.maxWidth,
|
|
193
|
-
}, children: [_jsx(PhiCollectionHeaderControl, { title: config.presentation.title, description: config.presentation.description, filters: queryControls, toolbar: toolbar }), binding.
|
|
204
|
+
}, children: [_jsx(PhiCollectionHeaderControl, { title: config.presentation.title, description: config.presentation.description, filters: queryControls, toolbar: toolbar }), binding.error ? _jsx(PhiAlertControl, { level: "error", title: binding.error.message }) : null, !binding.loading && !binding.error && binding.nodes.length === 0 ? (_jsx(PhiTypographyControl, { type: "secondary", children: labels.empty })) : null, _jsx(PhiTreeControl, { nodes: binding.nodes, nodeIdentityPath: binding.resource?.nodeIdentityPath ?? "id", parentNodeIdentityPath: binding.resource?.parentNodeIdentityPath ?? "parentId", presentation: config.presentation, loading: binding.loading, controlSize: controlSize, selectionMode: config.features.selection?.mode, selectedNodeIdentities: binding.selectedNodeIdentities, checkedNodeIdentities: binding.checkedNodeIdentities, checking: config.features.checking?.enabled, checkStrictly: config.features.checking?.strict, expandedNodeIdentities: binding.expandedNodeIdentities, editing: config.features.editing?.enabled, nodeActions: config.features.actions?.node, draggable: canSourceDrag || canReorder, onSelectionChange: (identities) => {
|
|
194
205
|
binding.setSelectedNodeIdentities(identities);
|
|
195
206
|
emitCapability("selectionChange", identities.map(String));
|
|
196
207
|
}, onCheckingChange: (identities) => {
|
|
@@ -1,13 +1,14 @@
|
|
|
1
1
|
import { jsx as _jsx } from "react/jsx-runtime";
|
|
2
2
|
import { definePhiPassiveWidgetRenderers } from "../../../../../plugins/factories/widget-renderers";
|
|
3
3
|
import { phiRuntime } from "../../../../../server-helpers/phi-runtime";
|
|
4
|
+
import { readPhiRuntimeTreeRenderMode } from "../../../render-mode";
|
|
4
5
|
import { PHI_TREE_WIDGET_DEFINITION } from "./config";
|
|
5
6
|
import { PhiTreeWidget } from "./server";
|
|
6
7
|
import { getPhiTreeWidgetLabels } from "../../../../../components/widgets/label-sets/tree";
|
|
7
|
-
async function PhiTreeWidgetPluginServer({ config, runtime }) {
|
|
8
|
+
async function PhiTreeWidgetPluginServer({ widget, config, runtime }) {
|
|
8
9
|
const rt = phiRuntime(runtime);
|
|
9
10
|
const labels = await getPhiTreeWidgetLabels({ apiBaseUrl: rt.apiBaseUrl, internalToken: rt.internalToken, locale: runtime.locale.current });
|
|
10
|
-
return _jsx(PhiTreeWidget, { config: config, labels: labels });
|
|
11
|
+
return _jsx(PhiTreeWidget, { config: config, labels: labels, renderMode: readPhiRuntimeTreeRenderMode(widget.config) });
|
|
11
12
|
}
|
|
12
13
|
export const PHI_TREE_WIDGET_PLUGIN = {
|
|
13
14
|
...PHI_TREE_WIDGET_DEFINITION,
|
|
@@ -1,6 +1,8 @@
|
|
|
1
1
|
import type { PhiTreeWidgetConfig } from "../../../../../types";
|
|
2
2
|
import type { PhiTreeWidgetLabels } from "../../../../../components/widgets/label-types/tree";
|
|
3
|
-
|
|
3
|
+
import type { PhiRenderableBlockRenderMode } from "../../../../../types/renderable-block";
|
|
4
|
+
export declare function PhiTreeWidget({ config, labels, renderMode }: {
|
|
4
5
|
config: PhiTreeWidgetConfig;
|
|
5
6
|
labels: PhiTreeWidgetLabels;
|
|
7
|
+
renderMode: PhiRenderableBlockRenderMode;
|
|
6
8
|
}): import("react").JSX.Element;
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { jsx as _jsx } from "react/jsx-runtime";
|
|
2
2
|
import { PhiCmsWidgetType } from "../../../../../constants/cms-widget-types";
|
|
3
3
|
import { PhiRuntimeModuleRenderClientHost } from "../../../../../components/runtime/runtime-module-render-client-manifest";
|
|
4
|
-
export function PhiTreeWidget({ config, labels }) {
|
|
5
|
-
return _jsx(PhiRuntimeModuleRenderClientHost, { type: PhiCmsWidgetType.Tree, componentProps: { config, labels } });
|
|
4
|
+
export function PhiTreeWidget({ config, labels, renderMode }) {
|
|
5
|
+
return _jsx(PhiRuntimeModuleRenderClientHost, { type: PhiCmsWidgetType.Tree, componentProps: { config, labels, renderMode } });
|
|
6
6
|
}
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
export declare const PHI_THEME_RUNTIME_MODULE_ROUTES: {
|
|
2
2
|
tour: {
|
|
3
3
|
readonly id: "@phis/ui/modules/theme/workspace";
|
|
4
|
-
readonly version:
|
|
4
|
+
readonly version: 2;
|
|
5
5
|
readonly steps: readonly [{
|
|
6
6
|
readonly key: "theme-choice";
|
|
7
7
|
readonly target: `cms:${import("@phis/contracts/cms").PhiCmsInstanceId}`;
|
|
@@ -22,6 +22,14 @@ export declare const PHI_THEME_RUNTIME_MODULE_ROUTES: {
|
|
|
22
22
|
readonly placement: "right";
|
|
23
23
|
readonly prepare: readonly [import("../../../types").PhiTourStepSignal];
|
|
24
24
|
readonly release: readonly [import("../../../types").PhiTourStepSignal];
|
|
25
|
+
}, {
|
|
26
|
+
readonly key: "gradients";
|
|
27
|
+
readonly target: `cms:${import("@phis/contracts/cms").PhiCmsInstanceId}:gradients`;
|
|
28
|
+
readonly title: "Three gradients";
|
|
29
|
+
readonly description: "Below the colours, three runs that Buttons, badges, ribbons, tags and switches can be filled with: the brand, an accent and one for the chrome. Each starts from the palette's colours and follows them until you set its stops and direction yourself, separately for light and dark. Its labels take the theme's light or dark text, whichever reads better unless you choose; the preview shows a Button, its hover and a badge, and a note says where a label would read poorly.";
|
|
30
|
+
readonly placement: "right";
|
|
31
|
+
readonly prepare: readonly [import("../../../types").PhiTourStepSignal];
|
|
32
|
+
readonly release: readonly [import("../../../types").PhiTourStepSignal];
|
|
25
33
|
}, {
|
|
26
34
|
readonly key: string;
|
|
27
35
|
readonly target: `cms:${import("@phis/contracts/cms").PhiCmsInstanceId}`;
|
|
@@ -9,7 +9,7 @@ import type { PhiTourStepSignal } from "../../../types/tours";
|
|
|
9
9
|
*/
|
|
10
10
|
export declare const PHI_THEME_WORKSPACE_TOUR: {
|
|
11
11
|
readonly id: "@phis/ui/modules/theme/workspace";
|
|
12
|
-
readonly version:
|
|
12
|
+
readonly version: 2;
|
|
13
13
|
readonly steps: readonly [{
|
|
14
14
|
readonly key: "theme-choice";
|
|
15
15
|
readonly target: `cms:${PhiCmsInstanceId}`;
|
|
@@ -30,6 +30,14 @@ export declare const PHI_THEME_WORKSPACE_TOUR: {
|
|
|
30
30
|
readonly placement: "right";
|
|
31
31
|
readonly prepare: readonly [PhiTourStepSignal];
|
|
32
32
|
readonly release: readonly [PhiTourStepSignal];
|
|
33
|
+
}, {
|
|
34
|
+
readonly key: "gradients";
|
|
35
|
+
readonly target: `cms:${PhiCmsInstanceId}:gradients`;
|
|
36
|
+
readonly title: "Three gradients";
|
|
37
|
+
readonly description: "Below the colours, three runs that Buttons, badges, ribbons, tags and switches can be filled with: the brand, an accent and one for the chrome. Each starts from the palette's colours and follows them until you set its stops and direction yourself, separately for light and dark. Its labels take the theme's light or dark text, whichever reads better unless you choose; the preview shows a Button, its hover and a badge, and a note says where a label would read poorly.";
|
|
38
|
+
readonly placement: "right";
|
|
39
|
+
readonly prepare: readonly [PhiTourStepSignal];
|
|
40
|
+
readonly release: readonly [PhiTourStepSignal];
|
|
33
41
|
}, {
|
|
34
42
|
readonly key: string;
|
|
35
43
|
readonly target: `cms:${PhiCmsInstanceId}`;
|