@phis/ui 0.4.10 → 0.4.13
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/components/cms/phi-cms-area-access-guard.js +9 -1
- package/components/cms/phi-cms-area-render-scope.d.ts +8 -4
- package/components/cms/phi-cms-area-render-scope.js +26 -11
- package/components/cms/phi-cms-root-layout.js +4 -2
- package/components/controls/phi-background-control.js +2 -1
- package/components/controls/phi-border-control.d.ts +1 -1
- package/components/controls/phi-border-control.js +5 -2
- package/components/controls/phi-color-control.d.ts +5 -0
- package/components/controls/phi-color-control.js +28 -4
- package/components/controls/phi-color-field-control.d.ts +3 -1
- package/components/controls/phi-color-field-control.js +2 -2
- package/components/controls/use-phi-color-control-presets.d.ts +11 -1
- package/components/controls/use-phi-color-control-presets.js +20 -1
- package/components/forms/auth-admin-settings-labels.d.ts +35 -0
- package/components/forms/auth-admin-settings-labels.js +27 -0
- package/components/layouts/clients/phi-flex-layout-client.js +7 -1
- package/components/root/phi-root-theme-resolver.js +5 -1
- package/components/runtime/runtime-controller-server-host.js +20 -9
- package/components/shell/phi-antd-icon.d.ts +3 -0
- package/components/shell/phi-antd-icon.js +9 -0
- package/components/tables/phi-plain-table.d.ts +4 -0
- package/components/tables/phi-plain-table.js +1 -1
- package/components/widgets/client/shared/phi-widget-tool-buttons.js +1 -1
- package/components/widgets/shared/markdown-body-client.d.ts +7 -0
- package/components/widgets/shared/markdown-body-client.js +2 -0
- package/components/widgets/shared/markdown-render.js +48 -1
- package/controls.d.ts +2 -0
- package/controls.js +3 -0
- package/helpers/cms-region-keys.d.ts +1 -1
- package/helpers/page-layout-check.d.ts +17 -0
- package/helpers/page-layout-check.js +121 -0
- package/helpers.d.ts +1 -0
- package/helpers.js +2 -0
- package/package.json +2 -2
- package/plugins/runtime-modules/auth/data-providers.d.ts +5 -0
- package/plugins/runtime-modules/auth/data-providers.js +3 -0
- package/plugins/runtime-modules/auth/definition.d.ts +5 -0
- package/plugins/runtime-modules/auth/services/installations-table.js +3 -1
- package/plugins/runtime-modules/auth/trees/phi-default-admin-auth-settings-page-tree.js +24 -9
- package/plugins/runtime-modules/auth/widgets/security/client.js +5 -1
- package/plugins/runtime-modules/builder/clients/inspector-config-field.js +1 -1
- package/plugins/runtime-modules/builder/render-root-node-scaffold.js +0 -1
- package/plugins/runtime-modules/client-authoring-module.js +18 -1
- package/plugins/runtime-modules/core/widgets/collection-view/asset-binding.js +1 -1
- package/plugins/runtime-modules/core/widgets/result/config.d.ts +3 -0
- package/plugins/runtime-modules/core/widgets/result/config.js +15 -10
- package/plugins/runtime-modules/core/widgets/result/server.js +1 -1
- package/plugins/runtime-modules/core/widgets/table/client.js +1 -1
- package/plugins/runtime-modules/core/widgets/tree/client.js +1 -1
- package/plugins/runtime-modules/phi-default-site-area-preset-tree.js +4 -109
- package/plugins/runtime-modules/preset-contracts/pub-area.d.ts +2 -2
- package/plugins/runtime-modules/preset-contracts/pub-area.js +0 -4
- package/plugins/runtime-modules/pub-area-preset.js +0 -20
- package/plugins/runtime-modules/public/trees/phi-default-pub-error-page-tree.js +5 -5
- package/plugins/runtime-modules/theme/widgets/brand-controls/client.js +5 -3
- package/plugins/runtime-modules/threads/trees/phi-default-threads-page-tree.js +8 -6
- package/plugins/runtime-modules/user-management/trees/phi-default-admin-users-page-tree.js +1 -1
- package/server-helpers/cms-root.js +21 -13
- package/server-helpers/runtime.js +0 -1
- package/styles/controls.css +11 -0
- package/styles/shell.css +11 -1
- package/theme/antd-css-var-contract.d.ts +24 -1
- package/theme/antd-css-var-contract.js +33 -1
- package/theme/phi-theme-palette.d.ts +6 -0
- package/theme/phi-theme-palette.js +13 -0
- package/theme/phi-theme-tokens.d.ts +3 -2
- package/theme/phi-theme-tokens.js +12 -1
- package/types/site-config.d.ts +0 -4
- package/types/widget-runtime.d.ts +0 -3
|
@@ -12,5 +12,5 @@ import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
|
12
12
|
* variants are to be shared with the Table Control once that has them.
|
|
13
13
|
*/
|
|
14
14
|
export function PhiPlainTable({ columns, rows, }) {
|
|
15
|
-
return (_jsx("div", { className: "phi-plain-table__scroll", children: _jsxs("table", { className: "phi-plain-table", children: [_jsx("thead", { children: _jsx("tr", { children: columns.map((column) => (_jsx("th", { scope: "col", style: column.align ? { textAlign: column.align } : undefined, children: column.title }, column.key))) }) }), _jsx("tbody", { children: rows.map((row) => (_jsx("tr", { children: columns.map((column, columnIndex) => (_jsx("td", { style: column.align ? { textAlign: column.align } : undefined, children: row.cells[columnIndex] ?? null }, column.key))) }, row.key))) })] }) }));
|
|
15
|
+
return (_jsx("div", { className: "phi-plain-table__scroll", children: _jsxs("table", { className: "phi-plain-table", children: [columns.some((column) => column.width) ? (_jsx("colgroup", { children: columns.map((column) => (_jsx("col", { style: column.width ? { width: column.width } : undefined }, column.key))) })) : null, _jsx("thead", { children: _jsx("tr", { children: columns.map((column) => (_jsx("th", { scope: "col", className: column.nowrap ? "phi-plain-table__nowrap" : undefined, style: column.align ? { textAlign: column.align } : undefined, children: column.title }, column.key))) }) }), _jsx("tbody", { children: rows.map((row) => (_jsx("tr", { children: columns.map((column, columnIndex) => (_jsx("td", { className: column.nowrap ? "phi-plain-table__nowrap" : undefined, style: column.align ? { textAlign: column.align } : undefined, children: row.cells[columnIndex] ?? null }, column.key))) }, row.key))) })] }) }));
|
|
16
16
|
}
|
|
@@ -59,7 +59,7 @@ export function PhiWidgetColorToolButton({ value, ariaLabel, onChange, }) {
|
|
|
59
59
|
const labels = usePhiAuthoringToolsLabels();
|
|
60
60
|
const currentColor = typeof value === "string" && value.trim().length > 0 ? value : undefined;
|
|
61
61
|
const popup = usePhiWidgetScaffoldPopup();
|
|
62
|
-
return (_jsx(PhiColorFieldControl, { value: currentColor, defaultValue: currentColor ?? "#1677ff", allowClear: true, getPopupContainer: popup.getPopupContainer, popupClassName: popup.rootClassName, onOpenChange: popup.setOpen, renderPanel: (panel) => (_jsx("div", { onClick: stopPhiOverlayEvent, onMouseDown: preserveEditorSelectionMouseEvent, onPointerDown: stopPhiOverlayEvent, onKeyDown: stopPhiOverlayEvent, children: panel })), onChange: (css) => {
|
|
62
|
+
return (_jsx(PhiColorFieldControl, { value: currentColor, defaultValue: currentColor ?? "#1677ff", allowClear: true, storeThemeRoles: true, getPopupContainer: popup.getPopupContainer, popupClassName: popup.rootClassName, onOpenChange: popup.setOpen, renderPanel: (panel) => (_jsx("div", { onClick: stopPhiOverlayEvent, onMouseDown: preserveEditorSelectionMouseEvent, onPointerDown: stopPhiOverlayEvent, onKeyDown: stopPhiOverlayEvent, children: panel })), onChange: (css) => {
|
|
63
63
|
onChange(css);
|
|
64
64
|
}, onClear: () => {
|
|
65
65
|
onChange(null);
|
|
@@ -87,6 +87,13 @@ export type PhiMarkdownBlock = {
|
|
|
87
87
|
rows: PhiMarkdownInline[][][];
|
|
88
88
|
/** One entry per column, from the GFM delimiter row; `null` where the column states none. */
|
|
89
89
|
align: PhiMarkdownTableAlign[];
|
|
90
|
+
/**
|
|
91
|
+
* Each column's share of the width in percent, from the lengths of the delimiter row's dashes, or
|
|
92
|
+
* `null` when they are all equal and the browser decides.
|
|
93
|
+
*/
|
|
94
|
+
widths: number[] | null;
|
|
95
|
+
/** One entry per column: kept on one line because every text in it is short. */
|
|
96
|
+
nowrap: boolean[];
|
|
90
97
|
} | {
|
|
91
98
|
kind: "divider";
|
|
92
99
|
} | {
|
|
@@ -143,6 +143,8 @@ function renderBlocks(blocks, token, paragraphStyle, headingStyle, lists, atStar
|
|
|
143
143
|
key: `column-${columnIndex}`,
|
|
144
144
|
title: renderInlineNodes(header),
|
|
145
145
|
align: block.align[columnIndex] ?? null,
|
|
146
|
+
width: block.widths?.[columnIndex] != null ? `${block.widths[columnIndex]}%` : undefined,
|
|
147
|
+
nowrap: block.nowrap[columnIndex] ?? false,
|
|
146
148
|
})), rows: block.rows.map((cells, rowIndex) => ({
|
|
147
149
|
key: `row-${rowIndex}`,
|
|
148
150
|
cells: cells.map((cell) => renderInlineNodes(cell)),
|
|
@@ -516,7 +516,11 @@ function mapBlockNodes(nodes, context, inlineMap) {
|
|
|
516
516
|
const cells = tableRows.map((row) => (row.children ?? []).map((cell) => inlineMap.get(cell) ?? mapInlineNodes(cell.children)));
|
|
517
517
|
const header = cells[0] ?? [];
|
|
518
518
|
const align = header.map((_, columnIndex) => readMarkdownTableAlign(node.align?.[columnIndex]));
|
|
519
|
-
|
|
519
|
+
const widths = readMarkdownTableWidths(node, context.sourceLines, header.length);
|
|
520
|
+
const nowrap = widths
|
|
521
|
+
? header.map(() => false)
|
|
522
|
+
: header.map((_, columnIndex) => isMarkdownTableColumnShort(cells, columnIndex));
|
|
523
|
+
blocks.push({ kind: "table", header, rows: cells.slice(1), align, widths, nowrap });
|
|
520
524
|
break;
|
|
521
525
|
}
|
|
522
526
|
}
|
|
@@ -606,6 +610,7 @@ async function resolveMarkdownRenderDataFromSource(markdown, translate, headingI
|
|
|
606
610
|
figures = await projectInternalMarkdownNodes(tree, runtime);
|
|
607
611
|
}
|
|
608
612
|
const context = {
|
|
613
|
+
sourceLines: markdown.split(/\r?\n/),
|
|
609
614
|
headings: [],
|
|
610
615
|
headingIdCounts: new Map(),
|
|
611
616
|
headingIdPrefix,
|
|
@@ -615,6 +620,48 @@ async function resolveMarkdownRenderDataFromSource(markdown, translate, headingI
|
|
|
615
620
|
const blocks = promoteMarkdownFigures(protectMarkdownMail(mapBlockNodes(tree.children, context, inlineMap)), figures, imageDefaults);
|
|
616
621
|
return { blocks, headings: context.headings };
|
|
617
622
|
}
|
|
623
|
+
/*
|
|
624
|
+
* How wide a table's columns are, when the text says so.
|
|
625
|
+
*
|
|
626
|
+
* Markdown has no syntax for a column's width, and GFM asks only for at least three dashes per cell of
|
|
627
|
+
* the delimiter row. Their number is free, so it carries the width here: `|---|------|` is one part to
|
|
628
|
+
* two, and every other renderer still reads an ordinary table. Equal dashes say nothing -- the way almost
|
|
629
|
+
* every table is written -- and leave the widths to the browser, as before.
|
|
630
|
+
*
|
|
631
|
+
* The tree keeps no dashes, so the row is read from the source: the line after the table's first. A
|
|
632
|
+
* quote's or a list's markers before it are stepped over; a row that does not read as one cell per
|
|
633
|
+
* column gives no widths rather than wrong ones.
|
|
634
|
+
*/
|
|
635
|
+
function readMarkdownTableWidths(node, sourceLines, columnCount) {
|
|
636
|
+
const startLine = node.position?.start.line;
|
|
637
|
+
if (!startLine || columnCount < 2)
|
|
638
|
+
return null;
|
|
639
|
+
const line = sourceLines[startLine];
|
|
640
|
+
if (line === undefined)
|
|
641
|
+
return null;
|
|
642
|
+
const row = line.replace(/^\s*(?:>\s*)*(?:(?:[-*+]|\d+[.)])\s+)?/, "").trim().replace(/^\|/, "").replace(/\|$/, "");
|
|
643
|
+
const cells = row.split("|").map((cell) => cell.trim());
|
|
644
|
+
if (cells.length !== columnCount || !cells.every((cell) => /^:?-{3,}:?$/.test(cell)))
|
|
645
|
+
return null;
|
|
646
|
+
const dashes = cells.map((cell) => cell.replace(/:/g, "").length);
|
|
647
|
+
if (dashes.every((count) => count === dashes[0]))
|
|
648
|
+
return null;
|
|
649
|
+
const total = dashes.reduce((sum, count) => sum + count, 0);
|
|
650
|
+
return dashes.map((count) => Math.round((count / total) * 1000) / 10);
|
|
651
|
+
}
|
|
652
|
+
/**
|
|
653
|
+
* The longest text a column may hold and still be kept on one line. Names, versions, commands and short
|
|
654
|
+
* labels fit; a sentence does not, and wraps as before.
|
|
655
|
+
*/
|
|
656
|
+
const MARKDOWN_TABLE_SHORT_COLUMN_CHARACTERS = 24;
|
|
657
|
+
/*
|
|
658
|
+
* Whether a column holds only short texts, heading included, so it is set without a line break: it then
|
|
659
|
+
* takes the width of its longest entry and leaves the rest of the row to the columns that need it.
|
|
660
|
+
* Measured on the text as shown, after translation.
|
|
661
|
+
*/
|
|
662
|
+
function isMarkdownTableColumnShort(cells, columnIndex) {
|
|
663
|
+
return cells.every((row) => getInlineText(row[columnIndex] ?? []).trim().length <= MARKDOWN_TABLE_SHORT_COLUMN_CHARACTERS);
|
|
664
|
+
}
|
|
618
665
|
/** remark-gfm states `left`, `center`, `right` or nothing; nothing else can come out of its parser. */
|
|
619
666
|
function readMarkdownTableAlign(value) {
|
|
620
667
|
if (value === "left" || value === "center" || value === "right") {
|
package/controls.d.ts
CHANGED
|
@@ -47,6 +47,8 @@ export { PhiSurfaceControl } from "./components/controls/phi-surface-control";
|
|
|
47
47
|
export type { PhiSurfaceControlLabels, PhiSurfaceControlProps } from "./components/controls/phi-surface-control";
|
|
48
48
|
export { PhiImageControl } from "./components/controls/phi-image-control";
|
|
49
49
|
export type { PhiImageControlProps, PhiImageControlSource } from "./components/controls/phi-image-control";
|
|
50
|
+
export { resolvePhiImagePresentation } from "./components/media/image-presentation";
|
|
51
|
+
export type { PhiImagePresentation, PhiImagePresentationFit, PhiImagePresentationInput, } from "./components/media/image-presentation";
|
|
50
52
|
export { PhiGeometryControl } from "./components/controls/phi-geometry-control";
|
|
51
53
|
export type { PhiGeometryControlProps } from "./components/controls/phi-geometry-control";
|
|
52
54
|
export { PhiSliderControl } from "./components/controls/phi-slider-control";
|
package/controls.js
CHANGED
|
@@ -23,6 +23,9 @@ export { PhiPaddingControl } from "./components/controls/phi-padding-control";
|
|
|
23
23
|
export { PhiShadowControl } from "./components/controls/phi-shadow-control";
|
|
24
24
|
export { PhiSurfaceControl } from "./components/controls/phi-surface-control";
|
|
25
25
|
export { PhiImageControl } from "./components/controls/phi-image-control";
|
|
26
|
+
// The answer `PhiImageControl` draws: a Module showing a picture of its own asks the same resolver the
|
|
27
|
+
// Image and Card Widgets ask, instead of composing an address and a framing of its own.
|
|
28
|
+
export { resolvePhiImagePresentation } from "./components/media/image-presentation";
|
|
26
29
|
export { PhiGeometryControl } from "./components/controls/phi-geometry-control";
|
|
27
30
|
export { PhiSliderControl } from "./components/controls/phi-slider-control";
|
|
28
31
|
export { PhiRateControl } from "./components/controls/phi-rate-control";
|
|
@@ -32,5 +32,5 @@ export type PhiCmsRegionOwnership = "shell" | "page";
|
|
|
32
32
|
* know is not a placement anybody chose -- refusing it would hide Widgets over a typo.
|
|
33
33
|
*/
|
|
34
34
|
export declare function phiCmsRegionAcceptsWidget(regionKey: string | null | undefined, required: PhiCmsRegionOwnership | null | undefined): boolean;
|
|
35
|
-
export declare function resolvePhiCmsRegionType(regionKey: string | null | undefined):
|
|
35
|
+
export declare function resolvePhiCmsRegionType(regionKey: string | null | undefined): 21 | 10 | 40 | 12 | 50 | 11 | 20 | 25 | 30 | 39 | 41;
|
|
36
36
|
export declare function resolvePhiCmsRegionKey(regionType: number | null | undefined): "content" | "header_top" | "header_main" | "header_bottom" | "sider_left" | "sider_right" | "hero" | "footer_top" | "footer_main" | "footer_bottom" | "drawer_right" | undefined;
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
import type { PhiResolvedCmsPageTree } from "../types/cms";
|
|
2
|
+
/**
|
|
3
|
+
* The Page rule as a check (THIRD_PARTY_MODULES.md, "6b. Laying out a Page").
|
|
4
|
+
*
|
|
5
|
+
* For presets -- what a package or Core writes in code, by hand or by an agent. A package runs it over the
|
|
6
|
+
* trees its route presets build, in its own verify step, and treats a finding as an error. It is never run
|
|
7
|
+
* on what an author saves in the Builder: there the scale is what the Inspector offers, and a value off it
|
|
8
|
+
* is the author's to choose.
|
|
9
|
+
*
|
|
10
|
+
* It reads the stated config only and resolves nothing: a distance is a step of `PHI_SPACE` or nothing.
|
|
11
|
+
*/
|
|
12
|
+
export type PhiPageLayoutFinding = {
|
|
13
|
+
/** The node's label, or its id where it has none. */
|
|
14
|
+
node: string;
|
|
15
|
+
message: string;
|
|
16
|
+
};
|
|
17
|
+
export declare function checkPhiPagePresetLayout(tree: PhiResolvedCmsPageTree): PhiPageLayoutFinding[];
|
|
@@ -0,0 +1,121 @@
|
|
|
1
|
+
import { PhiCmsRegionType } from "../constants/phi-cms";
|
|
2
|
+
import { PHI_SPACE } from "../theme/antd-css-var-contract";
|
|
3
|
+
import { readPhiSurface } from "../types/surface";
|
|
4
|
+
const SPACING_KEYS = ["padding", "paddingTop", "paddingRight", "paddingBottom", "paddingLeft", "gap"];
|
|
5
|
+
const PADDING_KEYS = SPACING_KEYS.filter((key) => key !== "gap");
|
|
6
|
+
/** The steps a preset may use for any distance; above them is the author's emphasis. */
|
|
7
|
+
const PRESET_STEPS = ["xxs", "xs", "sm", "base", "md"];
|
|
8
|
+
const EMPHASIS_STEPS = ["lg", "xl", "xxl"];
|
|
9
|
+
/** Layouts that bring a padding of their own by default (LAYOUTING.md): stated, or they keep it. */
|
|
10
|
+
const DEFAULT_PADDED_LAYOUTS = new Set(["grid", "masonry", "three-column"]);
|
|
11
|
+
function stepOf(value) {
|
|
12
|
+
if (value === 0 || value === "0")
|
|
13
|
+
return "none";
|
|
14
|
+
for (const [step, reference] of Object.entries(PHI_SPACE)) {
|
|
15
|
+
if (value === reference)
|
|
16
|
+
return step;
|
|
17
|
+
}
|
|
18
|
+
return null;
|
|
19
|
+
}
|
|
20
|
+
function typeKeyOf(node) {
|
|
21
|
+
return node.widgetType.split("/").at(-1) ?? node.widgetType;
|
|
22
|
+
}
|
|
23
|
+
function nameOf(node) {
|
|
24
|
+
return node.label?.trim() || String(node.id);
|
|
25
|
+
}
|
|
26
|
+
function hasPadding(config) {
|
|
27
|
+
return PADDING_KEYS.some((key) => {
|
|
28
|
+
const step = stepOf(config[key]);
|
|
29
|
+
return config[key] != null && step !== "none";
|
|
30
|
+
});
|
|
31
|
+
}
|
|
32
|
+
export function checkPhiPagePresetLayout(tree) {
|
|
33
|
+
const findings = [];
|
|
34
|
+
const contentRegion = tree.regions.find((region) => region.regionType === PhiCmsRegionType.Content);
|
|
35
|
+
const heroRegion = tree.regions.find((region) => region.regionType === PhiCmsRegionType.Hero);
|
|
36
|
+
const regionConfig = (contentRegion?.config ?? {});
|
|
37
|
+
const heroOverlap = heroRegion ? regionConfig.heroOverlap : undefined;
|
|
38
|
+
if (contentRegion) {
|
|
39
|
+
const edge = stepOf(regionConfig.padding);
|
|
40
|
+
if (edge !== "md") {
|
|
41
|
+
findings.push({
|
|
42
|
+
node: `region ${contentRegion.id}`,
|
|
43
|
+
message: "The content Region is the Page's edge and states `padding: PHI_SPACE.md`.",
|
|
44
|
+
});
|
|
45
|
+
}
|
|
46
|
+
if (heroOverlap != null && stepOf(heroOverlap) == null) {
|
|
47
|
+
findings.push({ node: `region ${contentRegion.id}`, message: "`heroOverlap` is a step of `PHI_SPACE`." });
|
|
48
|
+
}
|
|
49
|
+
}
|
|
50
|
+
const byId = new Map(tree.layoutNodes.map((node) => [node.id, node]));
|
|
51
|
+
const childrenOf = (id) => tree.layoutNodes.filter((node) => node.parentLayoutNodeId === id);
|
|
52
|
+
// The Page column: the content Region's root Layout holds one vertical Flex.
|
|
53
|
+
const contentRoot = contentRegion ? byId.get(contentRegion.rootLayoutNodeId) : undefined;
|
|
54
|
+
if (contentRoot) {
|
|
55
|
+
const column = typeKeyOf(contentRoot) === "content" ? childrenOf(contentRoot.id)[0] : contentRoot;
|
|
56
|
+
if (!column || typeKeyOf(column) !== "flex-vertical") {
|
|
57
|
+
findings.push({
|
|
58
|
+
node: nameOf(contentRoot),
|
|
59
|
+
message: "The Page column under the content Region is one `flex-vertical`.",
|
|
60
|
+
});
|
|
61
|
+
}
|
|
62
|
+
}
|
|
63
|
+
const heroRootId = heroRegion?.rootLayoutNodeId;
|
|
64
|
+
// A band under the Header keeps its sides on the small step without a Surface; nothing above or below.
|
|
65
|
+
const headerBottomRootId = tree.regions
|
|
66
|
+
.find((region) => region.regionType === PhiCmsRegionType.HeaderBottom)?.rootLayoutNodeId;
|
|
67
|
+
for (const node of tree.layoutNodes) {
|
|
68
|
+
const config = (node.config ?? {});
|
|
69
|
+
const typeKey = typeKeyOf(node);
|
|
70
|
+
const surface = readPhiSurface(config.surface);
|
|
71
|
+
for (const key of SPACING_KEYS) {
|
|
72
|
+
const value = config[key];
|
|
73
|
+
if (value == null)
|
|
74
|
+
continue;
|
|
75
|
+
const step = stepOf(value);
|
|
76
|
+
if (step == null) {
|
|
77
|
+
findings.push({
|
|
78
|
+
node: nameOf(node),
|
|
79
|
+
message: `\`${key}\` is \`${String(value)}\`; a preset names a step of \`PHI_SPACE\`, never a number, a string or \`clamp()\`.`,
|
|
80
|
+
});
|
|
81
|
+
continue;
|
|
82
|
+
}
|
|
83
|
+
if (EMPHASIS_STEPS.includes(step)) {
|
|
84
|
+
const heroBottom = node.id === heroRootId && key === "paddingBottom" && heroOverlap != null;
|
|
85
|
+
if (!heroBottom) {
|
|
86
|
+
findings.push({
|
|
87
|
+
node: nameOf(node),
|
|
88
|
+
message: `\`${key}\` is \`${step}\`. Above \`md\` is the author's emphasis; a preset stays at ${PRESET_STEPS.join(", ")} -- but a Hero's bottom beside \`heroOverlap\`.`,
|
|
89
|
+
});
|
|
90
|
+
}
|
|
91
|
+
}
|
|
92
|
+
}
|
|
93
|
+
if (node.id === headerBottomRootId) {
|
|
94
|
+
const sideSteps = ["paddingLeft", "paddingRight"].map((key) => stepOf(config[key]));
|
|
95
|
+
const blocks = ["paddingTop", "paddingBottom"].map((key) => stepOf(config[key]));
|
|
96
|
+
if (sideSteps.some((step) => step !== "sm") || blocks.some((step) => step != null && step !== "none")
|
|
97
|
+
|| (config.padding != null && stepOf(config.padding) !== "none")) {
|
|
98
|
+
findings.push({
|
|
99
|
+
node: nameOf(node),
|
|
100
|
+
message: "A band under the Header states `padding: 0` and its sides `PHI_SPACE.sm`.",
|
|
101
|
+
});
|
|
102
|
+
}
|
|
103
|
+
continue;
|
|
104
|
+
}
|
|
105
|
+
if (!surface && typeKey !== "content") {
|
|
106
|
+
if (hasPadding(config)) {
|
|
107
|
+
findings.push({
|
|
108
|
+
node: nameOf(node),
|
|
109
|
+
message: "Has a padding but no Surface. A Layout without a Surface only arranges; padding belongs to an edge one can see.",
|
|
110
|
+
});
|
|
111
|
+
}
|
|
112
|
+
else if (DEFAULT_PADDED_LAYOUTS.has(typeKey) && config.padding == null) {
|
|
113
|
+
findings.push({
|
|
114
|
+
node: nameOf(node),
|
|
115
|
+
message: `States no padding, so the ${typeKey} keeps its default inset; without a Surface it states \`padding: 0\`.`,
|
|
116
|
+
});
|
|
117
|
+
}
|
|
118
|
+
}
|
|
119
|
+
}
|
|
120
|
+
return findings;
|
|
121
|
+
}
|
package/helpers.d.ts
CHANGED
|
@@ -10,6 +10,7 @@ export * from "./helpers/widget-dimension-plugin-fields";
|
|
|
10
10
|
export * from "./helpers/translation-format";
|
|
11
11
|
export { buildPhiCmsLayoutNode, buildPhiCmsWidgetNode, } from "./helpers/cms-node-factories";
|
|
12
12
|
export * from "./helpers/cms-preset-nodes";
|
|
13
|
+
export { checkPhiPagePresetLayout, type PhiPageLayoutFinding } from "./helpers/page-layout-check";
|
|
13
14
|
export * from "./helpers/cms-dialog";
|
|
14
15
|
export { buildPhiSettingsPageShellTree, type PhiSettingsPageShellFormSection, type PhiSettingsPageShellOverlay, type PhiSettingsPageShellPanel, type PhiSettingsPageShellSection, type PhiSettingsPageShellWidgetSection, } from "./components/regions/presets/phi-settings-page-shell-tree";
|
|
15
16
|
export * from "./helpers/format-date-time";
|
package/helpers.js
CHANGED
|
@@ -10,6 +10,8 @@ export * from "./helpers/widget-dimension-plugin-fields";
|
|
|
10
10
|
export * from "./helpers/translation-format";
|
|
11
11
|
export { buildPhiCmsLayoutNode, buildPhiCmsWidgetNode, } from "./helpers/cms-node-factories";
|
|
12
12
|
export * from "./helpers/cms-preset-nodes";
|
|
13
|
+
/* The Page rule as a check, for a package to run over the trees its presets build (THIRD_PARTY_MODULES.md 6b). */
|
|
14
|
+
export { checkPhiPagePresetLayout } from "./helpers/page-layout-check";
|
|
13
15
|
export * from "./helpers/cms-dialog";
|
|
14
16
|
/*
|
|
15
17
|
* The one Settings page shell (SETTINGS.md section 4). Public because the contract holds for every
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@phis/ui",
|
|
3
|
-
"version": "0.4.
|
|
3
|
+
"version": "0.4.13",
|
|
4
4
|
"license": "Apache-2.0",
|
|
5
5
|
"publishConfig": {
|
|
6
6
|
"access": "public"
|
|
@@ -503,7 +503,7 @@
|
|
|
503
503
|
"@lexical/rich-text": "0.50.0",
|
|
504
504
|
"@lexical/selection": "0.50.0",
|
|
505
505
|
"@lexical/utils": "0.50.0",
|
|
506
|
-
"@phis/contracts": "^0.7.
|
|
506
|
+
"@phis/contracts": "^0.7.6",
|
|
507
507
|
"dayjs": "^1.11.23",
|
|
508
508
|
"dom-serializer": "^2.0.0",
|
|
509
509
|
"htmlparser2": "^10.1.0",
|
|
@@ -11,6 +11,11 @@ export declare const PHI_AUTH_RUNTIME_DATA_PROVIDER_DESCRIPTORS: {
|
|
|
11
11
|
title: string;
|
|
12
12
|
rowIdentityPath: string;
|
|
13
13
|
recordRead: true;
|
|
14
|
+
summaryFields: {
|
|
15
|
+
key: string;
|
|
16
|
+
title: string;
|
|
17
|
+
type: "number";
|
|
18
|
+
}[];
|
|
14
19
|
fields: ({
|
|
15
20
|
key: string;
|
|
16
21
|
title: string;
|
|
@@ -15,6 +15,9 @@ export const PHI_AUTH_RUNTIME_DATA_PROVIDER_DESCRIPTORS = [
|
|
|
15
15
|
title: "Provider installations",
|
|
16
16
|
rowIdentityPath: "installationKey",
|
|
17
17
|
recordRead: true,
|
|
18
|
+
summaryFields: [
|
|
19
|
+
{ key: "loginEnabledCount", title: "Offered on login", type: "number" },
|
|
20
|
+
],
|
|
18
21
|
fields: [
|
|
19
22
|
{ key: "installationKey", title: "Installation", type: "string", required: true },
|
|
20
23
|
{ key: "providerKey", title: "Provider", type: "string", required: true },
|
|
@@ -269,6 +269,11 @@ export declare const PHI_AUTH_RUNTIME_MODULE_DEFINITION: {
|
|
|
269
269
|
title: string;
|
|
270
270
|
rowIdentityPath: string;
|
|
271
271
|
recordRead: true;
|
|
272
|
+
summaryFields: {
|
|
273
|
+
key: string;
|
|
274
|
+
title: string;
|
|
275
|
+
type: "number";
|
|
276
|
+
}[];
|
|
272
277
|
fields: ({
|
|
273
278
|
key: string;
|
|
274
279
|
title: string;
|
|
@@ -44,7 +44,9 @@ async function queryInstallations({ resourceKey, signal, }) {
|
|
|
44
44
|
throw new PhiTableProviderError("resource-not-found", `Unknown Auth resource "${resourceKey}".`);
|
|
45
45
|
}
|
|
46
46
|
const rows = await loadInstallations(signal);
|
|
47
|
-
|
|
47
|
+
// What the footer counts beside the rows: the installations the sign-in page actually offers.
|
|
48
|
+
const loginEnabledCount = rows.filter((row) => row.loginEnabled === true).length;
|
|
49
|
+
return { rows, total: rows.length, summary: { loginEnabledCount } };
|
|
48
50
|
}
|
|
49
51
|
async function readInstallationRecord({ rowIdentity, signal }) {
|
|
50
52
|
const installationKey = typeof rowIdentity === "string" ? rowIdentity.trim() : "";
|
|
@@ -33,6 +33,7 @@ export async function buildPhiDefaultAdminAuthSettingsPageTree({ page, runtime,
|
|
|
33
33
|
"overlayInstallationEdit",
|
|
34
34
|
"overlayInstallationEditForm",
|
|
35
35
|
]);
|
|
36
|
+
const columns = labels.installations.columns;
|
|
36
37
|
const tableAddress = createPhiSignalAddress("cms", widgetIds.widgetInstallationsTable);
|
|
37
38
|
const editFormAddress = createPhiSignalAddress("cms", widgetIds.overlayInstallationEditForm);
|
|
38
39
|
const createOverlayAddress = createPhiSignalAddress("cms", widgetIds.overlayInstallationCreate);
|
|
@@ -109,8 +110,12 @@ export async function buildPhiDefaultAdminAuthSettingsPageTree({ page, runtime,
|
|
|
109
110
|
controlSize: "small",
|
|
110
111
|
borders: true,
|
|
111
112
|
layout: { mode: "auto", overflowX: "auto" },
|
|
113
|
+
/*
|
|
114
|
+
* Short heads, the explanation in each head's hint: nine columns under their full names were
|
|
115
|
+
* wider than the panel and were cut at the top.
|
|
116
|
+
*/
|
|
112
117
|
columns: [
|
|
113
|
-
{ key: "installationKey", fieldKey: "installationKey", title:
|
|
118
|
+
{ key: "installationKey", fieldKey: "installationKey", title: columns.key.title, description: columns.key.hint, sizing: { mode: "content" }, sticky: "left" },
|
|
114
119
|
{
|
|
115
120
|
key: "providerKey",
|
|
116
121
|
fieldKey: "providerKey",
|
|
@@ -119,13 +124,14 @@ export async function buildPhiDefaultAdminAuthSettingsPageTree({ page, runtime,
|
|
|
119
124
|
sizing: { mode: "content" },
|
|
120
125
|
tagColorMap: { google: "processing", apple: "default", github: "default", microsoft: "processing" },
|
|
121
126
|
},
|
|
122
|
-
{ key: "enabled", fieldKey: "enabled", title:
|
|
123
|
-
{ key: "loginEnabled", fieldKey: "loginEnabled", title:
|
|
124
|
-
{ key: "sortOrder", fieldKey: "sortOrder", title:
|
|
127
|
+
{ key: "enabled", fieldKey: "enabled", title: columns.enabled.title, description: columns.enabled.hint, renderer: "switch", editor: { control: "switch" }, sizing: { mode: "content" } },
|
|
128
|
+
{ key: "loginEnabled", fieldKey: "loginEnabled", title: columns.login.title, description: columns.login.hint, renderer: "switch", editor: { control: "switch" }, sizing: { mode: "content" } },
|
|
129
|
+
{ key: "sortOrder", fieldKey: "sortOrder", title: columns.order.title, description: columns.order.hint, sizing: { mode: "content" } },
|
|
125
130
|
{
|
|
126
131
|
key: "secretStatus",
|
|
127
132
|
fieldKey: "secretStatus",
|
|
128
|
-
title:
|
|
133
|
+
title: columns.secret.title,
|
|
134
|
+
description: columns.secret.hint,
|
|
129
135
|
renderer: "badge",
|
|
130
136
|
sizing: { mode: "content" },
|
|
131
137
|
tagColorMap: { configured: "success", missing: "error" },
|
|
@@ -133,15 +139,24 @@ export async function buildPhiDefaultAdminAuthSettingsPageTree({ page, runtime,
|
|
|
133
139
|
{
|
|
134
140
|
key: "validationStatus",
|
|
135
141
|
fieldKey: "validationStatus",
|
|
136
|
-
title:
|
|
142
|
+
title: columns.validation.title,
|
|
143
|
+
description: columns.validation.hint,
|
|
137
144
|
renderer: "badge",
|
|
138
145
|
sizing: { mode: "content" },
|
|
139
146
|
tagColorMap: { ok: "success", failed: "error", "not-testable": "default", untested: "warning" },
|
|
140
147
|
},
|
|
141
|
-
{ key: "linkedIdentities", fieldKey: "linkedIdentities", title:
|
|
142
|
-
{ key: "callbackUri", fieldKey: "callbackUri", title:
|
|
148
|
+
{ key: "linkedIdentities", fieldKey: "linkedIdentities", title: columns.linked.title, description: columns.linked.hint, sizing: { mode: "content" } },
|
|
149
|
+
{ key: "callbackUri", fieldKey: "callbackUri", title: columns.callback.title, description: columns.callback.hint, sizing: { mode: "fill" } },
|
|
143
150
|
],
|
|
144
|
-
emptyState: labels.installations.empty,
|
|
151
|
+
emptyState: { title: labels.installations.empty },
|
|
152
|
+
footer: {
|
|
153
|
+
template: labels.installations.footer,
|
|
154
|
+
values: [
|
|
155
|
+
{ key: "installations", value: { source: "core", fieldKey: "totalRows" } },
|
|
156
|
+
{ key: "loginEnabled", value: { source: "provider", fieldKey: "loginEnabledCount" } },
|
|
157
|
+
],
|
|
158
|
+
align: "start",
|
|
159
|
+
},
|
|
145
160
|
},
|
|
146
161
|
features: {
|
|
147
162
|
pagination: { enabled: false },
|
|
@@ -28,7 +28,11 @@ export function PhiAuthSecurityWidgetClient({ apiPath = "/api/auth/account/secur
|
|
|
28
28
|
setLoading(true);
|
|
29
29
|
try {
|
|
30
30
|
const { ok, payload: next } = await requestPhiJson(apiPath, { signal });
|
|
31
|
-
|
|
31
|
+
/*
|
|
32
|
+
* The HTTP status is the answer. The body is the account's state and carries no `ok` of its own:
|
|
33
|
+
* asking it for one refused every answer, and the panel said "could not be loaded" to everybody.
|
|
34
|
+
*/
|
|
35
|
+
if (!ok || !next || !Array.isArray(next.sessions))
|
|
32
36
|
throw new Error(labels.errors.loadFailed);
|
|
33
37
|
setPayload(next);
|
|
34
38
|
setError(null);
|
|
@@ -714,7 +714,7 @@ function renderPhiInspectorConfigFieldBody({ field, value, defaultValue, config,
|
|
|
714
714
|
return (_jsx(PhiInspectorCollectionFieldControl, { field: field, config: config, labels: fieldLabels, value: value, defaultValue: defaultValue, disabled: disabled || !onChange, widgetReferenceOptions: widgetReferenceOptions ?? [], paddingLabels: paddingLabels, backgroundLabels: backgroundLabels, borderLabels: borderLabels, renderMediaPicker: renderMediaPicker, colorPickerLabels: colorPickerLabels, iconPickerLabels: iconPickerLabels, dataProviderDescriptors: dataProviderDescriptors, calendarAdapterDescriptors: calendarAdapterDescriptors, videoProviderDescriptors: videoProviderDescriptors, onChange: onChange }, field.key));
|
|
715
715
|
}
|
|
716
716
|
if (field.type === "color") {
|
|
717
|
-
return renderPhiInspectorConfigFieldControl(field, _jsx(PhiColorFieldControl, { value: value, defaultValue: defaultValue, ...(field.defaultToken ? { defaultToken: field.defaultToken } : {}), disabled: disabled || !onChange, mode: resolveInspectorColorMode(field.mode), placement: "left", labels: colorPickerLabels, onChange: (nextValue) => onChange?.({ [field.key]: nextValue || undefined }) }));
|
|
717
|
+
return renderPhiInspectorConfigFieldControl(field, _jsx(PhiColorFieldControl, { value: value, defaultValue: defaultValue, ...(field.defaultToken ? { defaultToken: field.defaultToken } : {}), disabled: disabled || !onChange, mode: resolveInspectorColorMode(field.mode), placement: "left", labels: colorPickerLabels, storeThemeRoles: true, onChange: (nextValue) => onChange?.({ [field.key]: nextValue || undefined }) }));
|
|
718
718
|
}
|
|
719
719
|
if (field.type === "surface") {
|
|
720
720
|
return renderPhiInspectorConfigFieldBlock(field, _jsx(PhiSurfaceControl, { disabled: disabled || !onChange, value: value === null ? null : readPhiSurface(value) ?? readPhiSurface(defaultValue), tone: field.tone !== false,
|
|
@@ -2,9 +2,26 @@
|
|
|
2
2
|
import { jsx as _jsx } from "react/jsx-runtime";
|
|
3
3
|
import { createContext, lazy, useCallback, useContext, useMemo, } from "react";
|
|
4
4
|
const PhiRuntimeModuleAuthoringContext = createContext(new Map());
|
|
5
|
+
/*
|
|
6
|
+
* `lazy` keeps a rejected import for as long as the component lives, so one dropped connection would
|
|
7
|
+
* leave a layout broken until the page is reloaded. The import is therefore tried again before the
|
|
8
|
+
* failure is handed to React; a chunk that is really gone still fails, a moment later.
|
|
9
|
+
*/
|
|
10
|
+
const AUTHORING_LAYOUT_RETRY_DELAYS_MS = [400, 1200];
|
|
11
|
+
async function loadPhiAuthoringLayoutWithRetry(load) {
|
|
12
|
+
for (const delay of AUTHORING_LAYOUT_RETRY_DELAYS_MS) {
|
|
13
|
+
try {
|
|
14
|
+
return await load();
|
|
15
|
+
}
|
|
16
|
+
catch {
|
|
17
|
+
await new Promise((resolve) => setTimeout(resolve, delay));
|
|
18
|
+
}
|
|
19
|
+
}
|
|
20
|
+
return load();
|
|
21
|
+
}
|
|
5
22
|
function createPhiLazyAuthoringLayout(load) {
|
|
6
23
|
return lazy(async () => {
|
|
7
|
-
const plugin = await load
|
|
24
|
+
const plugin = await loadPhiAuthoringLayoutWithRetry(load);
|
|
8
25
|
return {
|
|
9
26
|
default: function PhiLoadedAuthoringLayout({ children }) {
|
|
10
27
|
return children(plugin);
|
|
@@ -245,7 +245,7 @@ export function PhiAssetCollectionViewBinding({ config, binding, labels: rawLabe
|
|
|
245
245
|
const display = action.display ?? "icon";
|
|
246
246
|
const label = action.label ?? (action.key === "upload" ? labels.tool.uploadToggleLabel : action.key);
|
|
247
247
|
return (_jsx(PhiButtonControl, { label: display === "icon" ? undefined : label, ariaLabel: label, tooltip: action.description, icon: display === "label" || !action.icon ? undefined : resolvePhiButtonIcon(action.icon), type: action.mode === "primary" ? "primary" : "default", danger: action.mode === "danger", size: controlSize, onClick: action.key === "upload" ? () => binding.setOpenPanelKey(state.uploadPanelOpen ? null : "upload") : undefined }, action.key));
|
|
248
|
-
}), features.tools.reset ? (_jsx(PhiButtonControl, { ariaLabel: labels.tool.resetLabel, tooltip: labels.tool.resetLabel, icon: resolvePhiButtonIcon("
|
|
248
|
+
}), features.tools.reset ? (_jsx(PhiButtonControl, { ariaLabel: labels.tool.resetLabel, tooltip: labels.tool.resetLabel, icon: resolvePhiButtonIcon("antd:clear-outlined"), size: controlSize, onClick: () => binding.setQuery({
|
|
249
249
|
...(config.initialQuery ?? {}),
|
|
250
250
|
page: config.initialQuery?.page ?? 1,
|
|
251
251
|
pageSize: config.initialQuery?.pageSize ?? features.pagination?.pageSize ?? 20,
|
|
@@ -8,6 +8,8 @@ export type PhiCmsResultWidgetConfig = PhiCmsWidgetConfigBase & {
|
|
|
8
8
|
subTitle?: string;
|
|
9
9
|
homeLink?: boolean;
|
|
10
10
|
homeLinkLabel?: string;
|
|
11
|
+
/** Where the link goes: the root of the Area the result renders in, or the Site's public home. */
|
|
12
|
+
homeLinkTarget?: PhiResultHomeLinkTarget;
|
|
11
13
|
/** Whose words `title`, `subTitle` and `homeLinkLabel` are (`helpers/text-source.ts`). */
|
|
12
14
|
textSource?: PhiTextSource;
|
|
13
15
|
};
|
|
@@ -22,6 +24,7 @@ export type PhiCmsResultWidgetConfig = PhiCmsWidgetConfigBase & {
|
|
|
22
24
|
* On by default. A Result ends something, and a page that ends something should say where to go next;
|
|
23
25
|
* the presets that want silence say so, which is the rarer case and the one worth spelling out.
|
|
24
26
|
*/
|
|
27
|
+
export type PhiResultHomeLinkTarget = "area" | "site";
|
|
25
28
|
export declare const PHI_RESULT_HOME_LINK_SOURCE_LABEL: "Back to homepage";
|
|
26
29
|
declare function parsePhiCmsResultWidgetConfig(config: Record<string, unknown>): PhiCmsResultWidgetConfig;
|
|
27
30
|
export declare const PHI_RESULT_WIDGET_DEFINITION: {
|
|
@@ -2,17 +2,12 @@ import { resolvePhiCmsWidgetPluginKey } from "../../../../../constants/cms-widge
|
|
|
2
2
|
import { PHI_RENDERABLE_BLOCK_GEOMETRY_FIELDS } from "../../../../../helpers/renderable-block-plugin-fields";
|
|
3
3
|
import { readPhiTextSource } from "../../../../../helpers/text-source";
|
|
4
4
|
import { readBoolean, readRenderableBlockConfig, readString, } from "../../../../../components/widgets/config/parser-primitives";
|
|
5
|
-
|
|
6
|
-
*
|
|
7
|
-
*
|
|
8
|
-
*
|
|
9
|
-
* left on a page with nothing to press. The target is not configured because there is only one sensible
|
|
10
|
-
* answer -- the root of the Area the result was rendered in -- and asking a Site to state it would
|
|
11
|
-
* invite a broken one.
|
|
12
|
-
*
|
|
13
|
-
* On by default. A Result ends something, and a page that ends something should say where to go next;
|
|
14
|
-
* the presets that want silence say so, which is the rarer case and the one worth spelling out.
|
|
5
|
+
/*
|
|
6
|
+
* Two answers, both resolved rather than typed: the Area's own root, or the Site's public home. A refusal
|
|
7
|
+
* needs the second -- the root of the Area that refused is the same door again -- and the public home is
|
|
8
|
+
* the one page every visitor may open.
|
|
15
9
|
*/
|
|
10
|
+
const PHI_RESULT_HOME_LINK_TARGETS = ["area", "site"];
|
|
16
11
|
export const PHI_RESULT_HOME_LINK_SOURCE_LABEL = "Back to homepage";
|
|
17
12
|
const PHI_RESULT_STATUS_OPTIONS = [
|
|
18
13
|
{ value: "success", label: "Success" },
|
|
@@ -37,6 +32,7 @@ function parsePhiCmsResultWidgetConfig(config) {
|
|
|
37
32
|
subTitle: readString(config.subTitle),
|
|
38
33
|
homeLink: readBoolean(config.homeLink) ?? true,
|
|
39
34
|
homeLinkLabel: readString(config.homeLinkLabel),
|
|
35
|
+
homeLinkTarget: PHI_RESULT_HOME_LINK_TARGETS.find((target) => target === config.homeLinkTarget) ?? "area",
|
|
40
36
|
textSource: readPhiTextSource(config.textSource),
|
|
41
37
|
};
|
|
42
38
|
}
|
|
@@ -71,6 +67,15 @@ export const PHI_RESULT_WIDGET_DEFINITION = {
|
|
|
71
67
|
{ key: "subTitle", type: "string", label: "Subtitle" },
|
|
72
68
|
{ key: "homeLink", type: "boolean", label: "Show Home Link" },
|
|
73
69
|
{ key: "homeLinkLabel", type: "string", label: "Home Link Label" },
|
|
70
|
+
{
|
|
71
|
+
key: "homeLinkTarget",
|
|
72
|
+
type: "choice",
|
|
73
|
+
label: "Home Link Target",
|
|
74
|
+
options: [
|
|
75
|
+
{ value: "area", label: "This Area's start" },
|
|
76
|
+
{ value: "site", label: "The site's homepage" },
|
|
77
|
+
],
|
|
78
|
+
},
|
|
74
79
|
],
|
|
75
80
|
defaultConfig: {
|
|
76
81
|
status: "info",
|
|
@@ -47,7 +47,7 @@ export async function PhiResultWidget({ config, runtime, translate }) {
|
|
|
47
47
|
* locale it was rendered for. `localizeAreaPath` is the same answer the navigation gives.
|
|
48
48
|
*/
|
|
49
49
|
const homeHref = config?.homeLink
|
|
50
|
-
? localizeAreaPath(runtime.locale.current, runtime.area, "/")
|
|
50
|
+
? localizeAreaPath(runtime.locale.current, config.homeLinkTarget === "site" ? "public" : runtime.area, "/")
|
|
51
51
|
: undefined;
|
|
52
52
|
return (_jsx(PhiResultWidgetBody, { config: config, code: code, title: title, subTitle: subTitle, homeHref: homeHref, homeLinkLabel: homeLinkLabel }));
|
|
53
53
|
}
|
|
@@ -781,7 +781,7 @@ export function PhiTableWidgetClient({ config: inputConfig, renderMode, external
|
|
|
781
781
|
return null;
|
|
782
782
|
const disabled = findMatchingCondition(null, action.disabledWhen, conditionSources);
|
|
783
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);
|
|
784
|
-
}), hasQueryTools && features.tools?.reset !== false ? (_jsx(PhiButtonControl, { icon: _jsx(PhiIcon, { name: "
|
|
784
|
+
}), hasQueryTools && features.tools?.reset !== false ? (_jsx(PhiButtonControl, { icon: _jsx(PhiIcon, { name: "clear-outlined", size: "inherit" }), ariaLabel: labels.reset, tooltip: labels.reset, size: resolvedControlSize, onClick: resetQuery })) : null, features.tools?.reload ? (_jsx(PhiButtonControl, { icon: _jsx(PhiIcon, { name: "reload", size: "inherit" }), ariaLabel: labels.reload, tooltip: labels.reload, size: resolvedControlSize, onClick: reload })) : null] })) : null;
|
|
785
785
|
/*
|
|
786
786
|
* The source's failures end the Table here: a binding that does not hold, a resource the
|
|
787
787
|
* configuration does not fit, a read that failed. A refused edit is not one of them -- it stays in
|