@phis/ui 0.4.3 → 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-anchor-nav-control.js +4 -1
- package/components/controls/phi-background-control.d.ts +6 -1
- package/components/controls/phi-background-control.js +30 -7
- package/components/controls/phi-bullet-list-control.d.ts +7 -2
- package/components/controls/phi-bullet-list-control.js +4 -3
- package/components/controls/phi-button-control.d.ts +13 -1
- package/components/controls/phi-button-control.js +21 -3
- package/components/controls/phi-color-control.js +4 -2
- package/components/controls/phi-drawer-control-adapter.js +3 -2
- package/components/controls/phi-dropdown-control.js +2 -2
- package/components/controls/phi-inline-text-editor.js +7 -1
- package/components/controls/phi-length-control.js +1 -1
- 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 +16 -4
- package/components/controls/phi-ribbon-control.js +14 -8
- package/components/controls/phi-ribbon-wrap-control.d.ts +32 -0
- package/components/controls/phi-ribbon-wrap-control.js +31 -0
- package/components/controls/phi-segmented-control.d.ts +4 -1
- package/components/controls/phi-segmented-control.js +13 -2
- package/components/controls/phi-select-control.js +5 -2
- package/components/controls/phi-series-chart-control.d.ts +48 -0
- package/components/controls/phi-series-chart-control.js +82 -0
- 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/controls/phi-text-control.js +57 -3
- package/components/controls/phi-tree-control.js +1 -1
- package/components/controls/phi-truncated-hover-text.d.ts +15 -0
- package/components/controls/phi-truncated-hover-text.js +25 -0
- package/components/forms/link-target-form-control.d.ts +1 -1
- package/components/forms/link-target-form-control.js +2 -45
- package/components/forms/phi-form-widget-frame.js +4 -2
- package/components/layouts/clients/phi-three-column-layout-client.js +10 -1
- package/components/layouts/phi-layout-view-model.js +10 -1
- package/components/navigation/phi-link.js +6 -1
- package/components/regions/clients/cms-region-container-client.js +16 -1
- package/components/regions/phi-cms-region-container.js +7 -0
- package/components/regions/phi-cms-region-shell.d.ts +22 -1
- package/components/regions/phi-cms-region-shell.js +131 -23
- package/components/root/phi-config-provider.d.ts +13 -0
- package/components/root/phi-config-provider.js +12 -1
- package/components/root/phi-root-background.d.ts +7 -0
- package/components/root/phi-root-background.js +20 -1
- 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 +15 -1
- package/components/root/phi-shell-chrome-overlay.d.ts +18 -1
- package/components/root/phi-shell-chrome-overlay.js +26 -4
- package/components/runtime/runtime-module-context.d.ts +12 -1
- package/components/runtime/runtime-module-context.js +6 -1
- package/components/shell/phi-antd-icon.d.ts +1 -0
- package/components/shell/phi-antd-icon.js +3 -0
- 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/shell/use-phi-shell-sticky-top.js +61 -16
- package/components/surface/phi-surface-tone.d.ts +13 -0
- package/components/surface/phi-surface-tone.js +21 -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/bullet-list-entries-editor.js +7 -1
- package/components/widgets/client/html-editor.js +1 -1
- 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/client/shared/use-page-reference-options.d.ts +17 -0
- package/components/widgets/client/shared/use-page-reference-options.js +57 -0
- package/components/widgets/config/background.d.ts +52 -1
- package/components/widgets/config/background.js +85 -4
- 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 +4 -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 +2 -0
- package/components/widgets/label-types/background.js +2 -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/bullet-list-vocabulary.d.ts +10 -0
- package/components/widgets/shared/bullet-list-vocabulary.js +5 -2
- package/components/widgets/shared/card-body-client.d.ts +16 -3
- package/components/widgets/shared/card-body-client.js +79 -8
- package/components/widgets/shared/card-vocabulary.d.ts +12 -2
- package/components/widgets/shared/card-vocabulary.js +7 -0
- 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-body-client.js +39 -10
- 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-container-chrome.js +6 -1
- 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/locale.d.ts +8 -0
- package/helpers/locale.js +18 -0
- package/helpers/mode-paint.d.ts +4 -0
- package/helpers/mode-paint.js +47 -0
- package/helpers/shell-region-style.js +2 -1
- package/helpers/surface-style.d.ts +12 -1
- package/helpers/surface-style.js +60 -12
- package/module-dashboard-cards.d.ts +2 -1
- package/module-dashboard-cards.js +2 -1
- package/module-records.d.ts +7 -0
- package/module-records.js +6 -0
- package/package.json +1 -1
- package/plugins/runtime-modules/area-definitions.d.ts +0 -42
- package/plugins/runtime-modules/area-definitions.js +3 -8
- package/plugins/runtime-modules/builder/clients/inspector-config-field.js +21 -2
- package/plugins/runtime-modules/builder/clients/inspector-surface-labels.js +1 -0
- package/plugins/runtime-modules/builder/clients/layout-scaffold-overlays.js +10 -5
- 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/edit-scaffold-drawer.js +3 -2
- package/plugins/runtime-modules/builder/persistence.d.ts +3 -0
- package/plugins/runtime-modules/builder/persistence.js +9 -1
- package/plugins/runtime-modules/builder/render-root-node-scaffold.js +25 -15
- package/plugins/runtime-modules/builder/trees/phi-default-builder-area-preset-tree.js +4 -0
- package/plugins/runtime-modules/builder/widgets/structure-region/built-in.js +15 -4
- package/plugins/runtime-modules/client-authoring-module.d.ts +8 -1
- package/plugins/runtime-modules/client-authoring-module.js +13 -3
- 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/brand/client.d.ts +12 -3
- package/plugins/runtime-modules/core/widgets/brand/client.js +3 -11
- package/plugins/runtime-modules/core/widgets/brand/home.d.ts +15 -0
- package/plugins/runtime-modules/core/widgets/brand/home.js +18 -0
- package/plugins/runtime-modules/core/widgets/brand/plugin.js +3 -2
- package/plugins/runtime-modules/core/widgets/brand/server.d.ts +2 -2
- package/plugins/runtime-modules/core/widgets/brand/server.js +2 -2
- 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 +100 -1
- package/plugins/runtime-modules/core/widgets/card/config.js +57 -3
- package/plugins/runtime-modules/core/widgets/card/editor.js +21 -4
- package/plugins/runtime-modules/core/widgets/card/server.js +5 -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/description/client.js +3 -3
- package/plugins/runtime-modules/core/widgets/description/config.d.ts +1 -0
- package/plugins/runtime-modules/core/widgets/description/editor.js +3 -2
- package/plugins/runtime-modules/core/widgets/description/server.js +3 -2
- 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/config.d.ts +1 -0
- 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/config.d.ts +1 -0
- 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/header-navigation/client.js +2 -2
- package/plugins/runtime-modules/core/widgets/html/client.js +1 -1
- package/plugins/runtime-modules/core/widgets/markdown/config.d.ts +320 -2
- package/plugins/runtime-modules/core/widgets/markdown/config.js +18 -4
- package/plugins/runtime-modules/core/widgets/markdown/editor.js +9 -1
- package/plugins/runtime-modules/core/widgets/markdown-toc/client.js +6 -1
- package/plugins/runtime-modules/core/widgets/markdown-toc/config.d.ts +14 -0
- package/plugins/runtime-modules/core/widgets/markdown-toc/config.js +14 -2
- package/plugins/runtime-modules/core/widgets/quick-links/authoring.js +7 -2
- package/plugins/runtime-modules/core/widgets/quick-links/client.js +2 -2
- package/plugins/runtime-modules/core/widgets/quick-links/items.d.ts +0 -2
- package/plugins/runtime-modules/core/widgets/quick-links/items.js +0 -15
- 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/result/config.d.ts +1 -0
- 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/sidebar-navigation/authoring.js +1 -1
- package/plugins/runtime-modules/core/widgets/sidebar-navigation/client.js +1 -1
- package/plugins/runtime-modules/core/widgets/simple-text/client.js +8 -3
- package/plugins/runtime-modules/core/widgets/simple-text/config.d.ts +1 -0
- package/plugins/runtime-modules/core/widgets/simple-text/editor.js +2 -2
- 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/config.d.ts +3 -0
- 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/dashboard/card-rows.d.ts +3 -1
- package/plugins/runtime-modules/dashboard/card-rows.js +30 -2
- package/plugins/runtime-modules/dashboard/clients/dashboard-card-view.js +29 -7
- package/plugins/runtime-modules/dashboard/trees/phi-default-builder-dashboard-page-tree.js +5 -40
- 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 +157 -22
- package/plugins/runtime-modules/theme/widgets/brand-controls/config.js +5 -9
- package/runtime-data-provider-client.d.ts +2 -0
- package/runtime-data-provider-client.js +7 -0
- package/server-helpers/cms-link-targets.js +6 -0
- package/styles/controls.css +74 -7
- package/styles/gradients.css +101 -0
- package/styles/layout.css +45 -2
- package/styles/root.css +18 -0
- package/styles/shell.css +137 -0
- package/theme/phi-antd-token-resolver.js +20 -1
- 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 +6 -2
- package/theme/phi-theme-tokens.js +15 -0
- package/theme/phi-theme.d.ts +5 -0
- package/theme/phi-theme.js +21 -0
- package/theme/phi-tokens.d.ts +16 -15
- package/theme/phi-tokens.js +16 -15
- package/types/cms-plugins.d.ts +2 -0
- package/types/cms-presets.d.ts +7 -0
- package/types/core-widget-placements.d.ts +3 -0
- package/types/dashboard-cards.d.ts +39 -4
- package/types/dashboard-cards.js +6 -0
- package/types/layout-style.d.ts +9 -8
- package/types/layout-style.js +9 -8
- package/types/site-theme.d.ts +10 -2
- package/types/surface.d.ts +4 -0
- package/types/surface.js +4 -0
- package/types.d.ts +1 -1
- package/types.js +1 -1
|
@@ -39,9 +39,11 @@ export declare const PHI_MARKDOWN_TOC_WIDGET_DEFINITION: {
|
|
|
39
39
|
filter?: undefined;
|
|
40
40
|
placeholder?: undefined;
|
|
41
41
|
visibleWhen?: undefined;
|
|
42
|
+
description?: undefined;
|
|
42
43
|
min?: undefined;
|
|
43
44
|
max?: undefined;
|
|
44
45
|
precision?: undefined;
|
|
46
|
+
prefix?: undefined;
|
|
45
47
|
} | {
|
|
46
48
|
key: string;
|
|
47
49
|
type: "choice";
|
|
@@ -55,13 +57,16 @@ export declare const PHI_MARKDOWN_TOC_WIDGET_DEFINITION: {
|
|
|
55
57
|
equals: string;
|
|
56
58
|
};
|
|
57
59
|
options?: undefined;
|
|
60
|
+
description?: undefined;
|
|
58
61
|
min?: undefined;
|
|
59
62
|
max?: undefined;
|
|
60
63
|
precision?: undefined;
|
|
64
|
+
prefix?: undefined;
|
|
61
65
|
} | {
|
|
62
66
|
key: string;
|
|
63
67
|
type: "string";
|
|
64
68
|
label: string;
|
|
69
|
+
description: string;
|
|
65
70
|
visibleWhen: {
|
|
66
71
|
field: string;
|
|
67
72
|
equals: string;
|
|
@@ -72,6 +77,7 @@ export declare const PHI_MARKDOWN_TOC_WIDGET_DEFINITION: {
|
|
|
72
77
|
min?: undefined;
|
|
73
78
|
max?: undefined;
|
|
74
79
|
precision?: undefined;
|
|
80
|
+
prefix?: undefined;
|
|
75
81
|
} | {
|
|
76
82
|
key: string;
|
|
77
83
|
type: "string";
|
|
@@ -80,9 +86,11 @@ export declare const PHI_MARKDOWN_TOC_WIDGET_DEFINITION: {
|
|
|
80
86
|
filter?: undefined;
|
|
81
87
|
placeholder?: undefined;
|
|
82
88
|
visibleWhen?: undefined;
|
|
89
|
+
description?: undefined;
|
|
83
90
|
min?: undefined;
|
|
84
91
|
max?: undefined;
|
|
85
92
|
precision?: undefined;
|
|
93
|
+
prefix?: undefined;
|
|
86
94
|
} | {
|
|
87
95
|
key: string;
|
|
88
96
|
type: "number";
|
|
@@ -94,10 +102,14 @@ export declare const PHI_MARKDOWN_TOC_WIDGET_DEFINITION: {
|
|
|
94
102
|
filter?: undefined;
|
|
95
103
|
placeholder?: undefined;
|
|
96
104
|
visibleWhen?: undefined;
|
|
105
|
+
description?: undefined;
|
|
106
|
+
prefix?: undefined;
|
|
97
107
|
} | {
|
|
98
108
|
key: string;
|
|
99
109
|
type: "number";
|
|
100
110
|
label: string;
|
|
111
|
+
description: string;
|
|
112
|
+
prefix: string;
|
|
101
113
|
options?: undefined;
|
|
102
114
|
filter?: undefined;
|
|
103
115
|
placeholder?: undefined;
|
|
@@ -113,9 +125,11 @@ export declare const PHI_MARKDOWN_TOC_WIDGET_DEFINITION: {
|
|
|
113
125
|
filter?: undefined;
|
|
114
126
|
placeholder?: undefined;
|
|
115
127
|
visibleWhen?: undefined;
|
|
128
|
+
description?: undefined;
|
|
116
129
|
min?: undefined;
|
|
117
130
|
max?: undefined;
|
|
118
131
|
precision?: undefined;
|
|
132
|
+
prefix?: undefined;
|
|
119
133
|
})[];
|
|
120
134
|
parseConfig: typeof parsePhiCmsMarkdownTocWidgetConfig;
|
|
121
135
|
};
|
|
@@ -58,11 +58,23 @@ export const PHI_MARKDOWN_TOC_WIDGET_DEFINITION = {
|
|
|
58
58
|
placeholder: "Select widget",
|
|
59
59
|
visibleWhen: { field: "bindingMode", equals: "target" },
|
|
60
60
|
},
|
|
61
|
-
{
|
|
61
|
+
{
|
|
62
|
+
key: "tocKey",
|
|
63
|
+
type: "string",
|
|
64
|
+
label: "TOC Key",
|
|
65
|
+
description: "The TOC Key of the Markdown widget whose headings this table of contents lists, as set in that widget's settings. Useful when a page has several Markdown texts; a Markdown Widget picked above narrows it to that one.",
|
|
66
|
+
visibleWhen: { field: "bindingMode", equals: "target" },
|
|
67
|
+
},
|
|
62
68
|
{ key: "title", type: "string", label: "Title" },
|
|
63
69
|
{ key: "minLevel", type: "number", label: "Min Heading Level", min: 1, max: 6, precision: 0 },
|
|
64
70
|
{ key: "maxLevel", type: "number", label: "Max Heading Level", min: 1, max: 6, precision: 0 },
|
|
65
|
-
{
|
|
71
|
+
{
|
|
72
|
+
key: "offsetTop",
|
|
73
|
+
type: "number",
|
|
74
|
+
label: "Offset Top",
|
|
75
|
+
description: "How far below the window's top edge a heading stands after a click in the contents, in pixels. Set it to the height of whatever stays fixed at the top, such as a sticky header, so the heading is not hidden beneath it.",
|
|
76
|
+
prefix: "px",
|
|
77
|
+
},
|
|
66
78
|
{ key: "showTitle", type: "boolean", label: "Show Title" },
|
|
67
79
|
],
|
|
68
80
|
parseConfig: parsePhiCmsMarkdownTocWidgetConfig,
|
|
@@ -4,7 +4,8 @@ import { resolvePhiBuilderAreaAsCmsArea, } from "../../../../../constants/cms-ar
|
|
|
4
4
|
import { getPhiBuilderNavigationDefaultScopeKey, createPhiBuilderNavigationPageLookup, resolvePhiBuilderNavigationPageTargets, } from "../../../../../helpers/cms-navigation-catalog";
|
|
5
5
|
import { PhiQuickLinksWidgetClient } from "./client";
|
|
6
6
|
import { PHI_QUICK_LINKS_WIDGET_DEFINITION } from "./config";
|
|
7
|
-
import {
|
|
7
|
+
import { mapPhiNavItemsToQuickLinksItems } from "./items";
|
|
8
|
+
import { mapPhiBuilderNavigationItemsToNavItems } from "../../../../../components/widgets/builder/navigation-items";
|
|
8
9
|
function PhiQuickLinksWidgetBuilderEditor({ runtime, config, canvas, }) {
|
|
9
10
|
if (!canvas.catalogHydrated) {
|
|
10
11
|
return null;
|
|
@@ -15,7 +16,11 @@ function PhiQuickLinksWidgetBuilderEditor({ runtime, config, canvas, }) {
|
|
|
15
16
|
if (!navigation) {
|
|
16
17
|
return null;
|
|
17
18
|
}
|
|
18
|
-
|
|
19
|
+
/*
|
|
20
|
+
* The live render's path: the draft's items as the navigation the Site would serve -- hidden ones left
|
|
21
|
+
* out -- then mapped to links the way the server maps them, so the canvas shows what the page shows.
|
|
22
|
+
*/
|
|
23
|
+
const items = mapPhiNavItemsToQuickLinksItems(mapPhiBuilderNavigationItemsToNavItems(resolvePhiBuilderNavigationPageTargets(currentCmsArea, navigation.items, createPhiBuilderNavigationPageLookup(canvas.pageCatalogForArea))), runtime.locale.current, currentCmsArea, false);
|
|
19
24
|
return (_jsx(PhiQuickLinksWidgetClient, { labels: { title: config.title }, config: {
|
|
20
25
|
columns: config.columns ?? 2,
|
|
21
26
|
separator: config.separator ?? true,
|
|
@@ -76,8 +76,8 @@ export function PhiQuickLinksWidgetClient({ labels, config, }) {
|
|
|
76
76
|
width: "100%",
|
|
77
77
|
minWidth: 0,
|
|
78
78
|
color: "inherit",
|
|
79
|
-
fontSize: token.
|
|
80
|
-
lineHeight: token.
|
|
79
|
+
fontSize: token.fontSize,
|
|
80
|
+
lineHeight: token.lineHeight,
|
|
81
81
|
}, children: labels.title })) : null, _jsx("div", { style: {
|
|
82
82
|
display: "grid",
|
|
83
83
|
gridTemplateColumns: `repeat(${groupedItems.length}, minmax(0, 1fr))`,
|
|
@@ -1,5 +1,3 @@
|
|
|
1
|
-
import { type PhiBuilderNavigationItem } from "../../../../../helpers/cms-navigation-catalog";
|
|
2
1
|
import type { PhiNavItem } from "../../../../../components/shell/shell-types";
|
|
3
2
|
import type { PhiQuickLinksWidgetItem } from "./client";
|
|
4
3
|
export declare function mapPhiNavItemsToQuickLinksItems(items: PhiNavItem[], locale: string, area: string, interactive?: boolean): PhiQuickLinksWidgetItem[];
|
|
5
|
-
export declare function mapPhiBuilderNavigationItemsToQuickLinksItems(items: PhiBuilderNavigationItem[], locale: string, area: string): PhiQuickLinksWidgetItem[];
|
|
@@ -1,5 +1,4 @@
|
|
|
1
1
|
import { resolvePhiNavHref } from "../../../../../helpers/locale";
|
|
2
|
-
import {} from "../../../../../helpers/cms-navigation-catalog";
|
|
3
2
|
export function mapPhiNavItemsToQuickLinksItems(items, locale, area, interactive = true) {
|
|
4
3
|
return items
|
|
5
4
|
.filter((item) => !item.separator && Boolean(item.href))
|
|
@@ -11,17 +10,3 @@ export function mapPhiNavItemsToQuickLinksItems(items, locale, area, interactive
|
|
|
11
10
|
newTab: interactive ? item.newTab : false,
|
|
12
11
|
}));
|
|
13
12
|
}
|
|
14
|
-
function flattenPhiBuilderNavigationItems(items) {
|
|
15
|
-
return items.flatMap((item) => [item, ...(Array.isArray(item.children) ? flattenPhiBuilderNavigationItems(item.children) : [])]);
|
|
16
|
-
}
|
|
17
|
-
export function mapPhiBuilderNavigationItemsToQuickLinksItems(items, locale, area) {
|
|
18
|
-
return flattenPhiBuilderNavigationItems(items)
|
|
19
|
-
.filter((item) => item.href !== null)
|
|
20
|
-
.map((item) => ({
|
|
21
|
-
label: item.label,
|
|
22
|
-
href: resolvePhiNavHref(locale, area, item.href),
|
|
23
|
-
icon: item.icon ?? undefined,
|
|
24
|
-
external: false,
|
|
25
|
-
newTab: false,
|
|
26
|
-
}));
|
|
27
|
-
}
|
|
@@ -1,7 +1,10 @@
|
|
|
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 PhiRecordWidgetClientProps = {
|
|
4
5
|
config: PhiRecordWidgetConfig;
|
|
5
6
|
labels?: PhiRecordWidgetLabels;
|
|
7
|
+
/** Where this draws, which decides who reads a failed read: the author, or only the log. */
|
|
8
|
+
renderMode: PhiRenderableBlockRenderMode;
|
|
6
9
|
};
|
|
7
|
-
export declare function PhiRecordWidgetClient({ config, labels, }: PhiRecordWidgetClientProps): import("react").JSX.Element;
|
|
10
|
+
export declare function PhiRecordWidgetClient({ config, labels, renderMode, }: PhiRecordWidgetClientProps): import("react").JSX.Element;
|
|
@@ -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",
|
|
@@ -21,7 +21,7 @@ function PhiSidebarNavigationWidgetEditor({ runtime, config, canvas, }) {
|
|
|
21
21
|
export const PHI_SIDEBAR_NAVIGATION_WIDGET_BUILDER_PLUGIN = {
|
|
22
22
|
...PHI_SIDEBAR_NAVIGATION_WIDGET_DEFINITION,
|
|
23
23
|
renderEditor: ({ runtime, config, authoring }) => authoring ? (_jsx(PhiSidebarNavigationWidgetEditor, { runtime: runtime, config: config, canvas: authoring.canvas })) : null,
|
|
24
|
-
renderEditorTools: ({ config, authoring }) => authoring?.updateConfig ? (_jsx(PhiWidgetTypographyToolButton, { fontFamily: config.fontFamily, fontSize: config.fontSize, defaultFontSize: "
|
|
24
|
+
renderEditorTools: ({ config, authoring }) => authoring?.updateConfig ? (_jsx(PhiWidgetTypographyToolButton, { fontFamily: config.fontFamily, fontSize: config.fontSize, defaultFontSize: "base", ariaLabel: "Sidebar navigation typography", onChange: ({ fontFamily, fontSize }) => authoring.updateConfig?.({
|
|
25
25
|
...(fontFamily !== undefined ? { fontFamily: fontFamily ?? undefined } : {}),
|
|
26
26
|
...(fontSize !== undefined ? { fontSize: fontSize ?? undefined } : {}),
|
|
27
27
|
}) })) : null,
|
|
@@ -33,7 +33,7 @@ function usePhiSidebarMenuPresentation(config) {
|
|
|
33
33
|
const sider = usePhiSiderContext();
|
|
34
34
|
return {
|
|
35
35
|
fontFamily: resolvePhiWidgetFontFamily(config?.fontFamily, fonts, token),
|
|
36
|
-
fontSize: resolvePhiWidgetFontSize(config?.fontSize, token, "
|
|
36
|
+
fontSize: resolvePhiWidgetFontSize(config?.fontSize, token, "base"),
|
|
37
37
|
collapsed: sider?.collapsed ?? false,
|
|
38
38
|
collapsedWidth: sider?.collapsedWidth ?? 40,
|
|
39
39
|
};
|
|
@@ -50,7 +50,7 @@ export function PhiSimpleTextWidgetClient({ blockId, labels, config, }) {
|
|
|
50
50
|
const resolvedFontFamily = styleValue.code
|
|
51
51
|
? token.fontFamilyCode
|
|
52
52
|
: resolvePhiWidgetFontFamily(fontFamilyValue, fonts, token);
|
|
53
|
-
const resolvedFontSize = resolvePhiWidgetFontSize(fontSizeValue, token, "
|
|
53
|
+
const resolvedFontSize = resolvePhiWidgetFontSize(fontSizeValue, token, "base");
|
|
54
54
|
const receiver = createPhiRenderableBlockReceiver("widget", blockId);
|
|
55
55
|
usePhiRenderableBlockSignalListener(receiver, (signal) => {
|
|
56
56
|
if (signal.channel === "text") {
|
|
@@ -105,16 +105,21 @@ export function PhiSimpleTextWidgetClient({ blockId, labels, config, }) {
|
|
|
105
105
|
code: typeof stylePayload.code === "boolean" ? stylePayload.code : current.code,
|
|
106
106
|
}));
|
|
107
107
|
});
|
|
108
|
+
/*
|
|
109
|
+
* A linked text's colour is the link's (`PhiLink`), which answers the pointer; the words inside inherit
|
|
110
|
+
* it. Stated on them as well, the colour stood over the link's and the hover never showed.
|
|
111
|
+
*/
|
|
112
|
+
const contentColor = hasHref ? undefined : textColor;
|
|
108
113
|
const contentNode = (_jsxs(PhiFlexControl, { align: "center", gap: 8, style: {
|
|
109
114
|
width: "fit-content",
|
|
110
115
|
maxWidth: "100%",
|
|
111
116
|
minWidth: 0,
|
|
112
117
|
fontSize: resolvedFontSize ?? "inherit",
|
|
113
118
|
lineHeight: resolvedFontSize ? PHI_LINE_HEIGHT_LG : "inherit",
|
|
114
|
-
color:
|
|
119
|
+
color: contentColor ?? undefined,
|
|
115
120
|
fontFamily: resolvedFontFamily,
|
|
116
121
|
}, children: [iconValue ? _jsx(PhiIcon, { name: iconValue, size: "1.25em" }) : null, _jsx(PhiTypographyControl, { type: config?.tone, strong: styleValue.strong, italic: styleValue.italic, underline: styleValue.underline, delete: styleValue.delete, disabled: styleValue.disabled, code: styleValue.code, style: {
|
|
117
|
-
color:
|
|
122
|
+
color: contentColor ?? "inherit",
|
|
118
123
|
fontSize: resolvedFontSize ?? "inherit",
|
|
119
124
|
lineHeight: resolvedFontSize ? PHI_LINE_HEIGHT_LG : "inherit",
|
|
120
125
|
...(resolvedFontFamily ? { fontFamily: resolvedFontFamily } : {}),
|
|
@@ -43,7 +43,7 @@ export function PhiSimpleTextWidgetColorButton({ config, onChange, }) {
|
|
|
43
43
|
}
|
|
44
44
|
export function PhiSimpleTextWidgetTypographyButton({ config, onChange, }) {
|
|
45
45
|
const labels = usePhiAuthoringToolsLabels();
|
|
46
|
-
return (_jsx(PhiWidgetTypographyToolButton, { fontFamily: config?.fontFamily, fontSize: config?.fontSize, defaultFontSize: "
|
|
46
|
+
return (_jsx(PhiWidgetTypographyToolButton, { fontFamily: config?.fontFamily, fontSize: config?.fontSize, defaultFontSize: "base", ariaLabel: labels.text.typography, onChange: ({ fontFamily, fontSize }) => onChange({
|
|
47
47
|
...(fontFamily !== undefined ? { fontFamily: fontFamily ?? undefined } : {}),
|
|
48
48
|
...(fontSize !== undefined ? { fontSize: fontSize ?? undefined } : {}),
|
|
49
49
|
}) }));
|
|
@@ -71,7 +71,7 @@ export function PhiSimpleTextWidgetEditor({ text, config, onChangeText, }) {
|
|
|
71
71
|
const resolvedFontFamily = hasPhiSimpleTextMark(config, "code")
|
|
72
72
|
? token.fontFamilyCode
|
|
73
73
|
: resolvePhiWidgetFontFamily(config?.fontFamily, fonts, token);
|
|
74
|
-
const resolvedFontSize = resolvePhiWidgetFontSize(config?.fontSize, token, "
|
|
74
|
+
const resolvedFontSize = resolvePhiWidgetFontSize(config?.fontSize, token, "base");
|
|
75
75
|
return (_jsxs(PhiFlexControl, { align: "center", gap: 8, style: {
|
|
76
76
|
width: "fit-content",
|
|
77
77
|
maxWidth: "100%",
|
|
@@ -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,
|
|
@@ -73,6 +73,7 @@ export declare const PHI_TABLE_WIDGET_DEFINITION: {
|
|
|
73
73
|
} & {
|
|
74
74
|
type: "string" | "url" | "icon";
|
|
75
75
|
emptyValue?: "";
|
|
76
|
+
placeholder?: string;
|
|
76
77
|
}) | ({
|
|
77
78
|
key: string;
|
|
78
79
|
label: string;
|
|
@@ -373,6 +374,7 @@ export declare const PHI_TABLE_WIDGET_DEFINITION: {
|
|
|
373
374
|
heading?: string;
|
|
374
375
|
type: "string" | "url" | "icon";
|
|
375
376
|
emptyValue?: "";
|
|
377
|
+
placeholder?: string;
|
|
376
378
|
} | {
|
|
377
379
|
visibleWhen: {
|
|
378
380
|
field: string;
|
|
@@ -738,6 +740,7 @@ export declare const PHI_TABLE_WIDGET_DEFINITION: {
|
|
|
738
740
|
heading?: string;
|
|
739
741
|
type: "string" | "url" | "icon";
|
|
740
742
|
emptyValue?: "";
|
|
743
|
+
placeholder?: string;
|
|
741
744
|
} | {
|
|
742
745
|
visibleWhen: {
|
|
743
746
|
field: string;
|