@phis/ui 0.8.2 → 0.8.3
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/components/calendar/gregory-calendar-adapter-client.js +1 -0
- package/components/controls/phi-accordion-control.d.ts +6 -0
- package/components/controls/phi-accordion-control.js +8 -13
- package/components/controls/phi-background-control.js +2 -5
- package/components/controls/phi-builder-insert-picker-control-labels.d.ts +2 -0
- package/components/controls/phi-builder-insert-picker-control-labels.js +1 -0
- package/components/controls/phi-builder-insert-picker-control.js +10 -11
- package/components/controls/phi-cascader-control.d.ts +9 -3
- package/components/controls/phi-cascader-control.js +38 -10
- package/components/controls/phi-checkbox-group-control.d.ts +3 -1
- package/components/controls/phi-checkbox-group-control.js +2 -2
- package/components/controls/phi-collapse-control.d.ts +9 -2
- package/components/controls/phi-collapse-control.js +14 -2
- package/components/controls/phi-color-control.d.ts +3 -1
- package/components/controls/phi-color-control.js +2 -2
- package/components/controls/phi-color-field-control.d.ts +6 -1
- package/components/controls/phi-color-field-control.js +2 -2
- package/components/controls/phi-confirm-control.d.ts +1 -1
- package/components/controls/phi-confirm-control.js +71 -2
- package/components/controls/phi-confirm-dialog.js +2 -1
- package/components/controls/phi-date-picker-control.js +1 -1
- package/components/controls/phi-dimension-control.d.ts +3 -1
- package/components/controls/phi-dimension-control.js +2 -2
- package/components/controls/phi-geometry-control.js +1 -1
- package/components/controls/phi-length-control.d.ts +6 -1
- package/components/controls/phi-length-control.js +3 -2
- package/components/controls/phi-multi-select-control.d.ts +6 -1
- package/components/controls/phi-multi-select-control.js +3 -3
- package/components/controls/phi-segmented-control.d.ts +6 -1
- package/components/controls/phi-segmented-control.js +3 -3
- package/components/controls/phi-switch-control.d.ts +3 -1
- package/components/controls/phi-switch-control.js +3 -3
- package/components/controls/phi-table-control.d.ts +8 -1
- package/components/controls/phi-table-control.js +8 -2
- package/components/forms/compound-form-controls.js +16 -1
- package/components/layouts/clients/phi-collapsible-layout-client.js +2 -6
- package/components/media/media-widget-labels.d.ts +2 -0
- package/components/media/media-widget-labels.js +2 -0
- package/components/media/phi-asset-inspector-section.js +19 -1
- package/components/regions/presets/phi-area-shell-preset-nodes.js +2 -0
- package/components/shell/phi-builder-icon.js +9 -1
- package/components/tables/phi-table-surface.d.ts +25 -0
- package/components/tables/phi-table-surface.js +25 -0
- package/components/widgets/builder/phi-static-rows-editor.js +4 -1
- package/components/widgets/client/shared/phi-choice-controller.d.ts +8 -1
- package/components/widgets/client/shared/phi-choice-controller.js +16 -1
- package/components/widgets/config/choice-shared.d.ts +2 -0
- package/components/widgets/config/choice-shared.js +1 -0
- package/components/widgets/config/image-variant-options.d.ts +4 -1
- package/components/widgets/config/image-variant-options.js +27 -14
- package/components/widgets/inspector-field-row.d.ts +14 -1
- package/components/widgets/inspector-field-row.js +21 -1
- package/components/widgets/label-sets/builder-chrome.js +2 -0
- package/components/widgets/label-sets/inspector.js +10 -0
- package/components/widgets/label-sets/security.js +2 -0
- package/components/widgets/label-types/inspector.d.ts +5 -0
- package/components/widgets/label-types/inspector.js +5 -0
- package/components/widgets/label-types/security.d.ts +2 -0
- package/components/widgets/signals/signal-endpoint-list.js +4 -1
- package/helpers/cms-inspector-drawer.d.ts +15 -0
- package/helpers/cms-inspector-drawer.js +37 -0
- package/helpers/cms-layout-defaults.js +1 -1
- package/helpers/preset-tree-contract-check.js +56 -0
- package/helpers/text-source.js +2 -0
- package/package.json +4 -4
- package/plugins/runtime-modules/accounting/definition.d.ts +1 -1
- package/plugins/runtime-modules/accounting/definition.js +0 -1
- package/plugins/runtime-modules/accounting/ids.d.ts +4 -4
- package/plugins/runtime-modules/accounting/ids.js +4 -2
- package/plugins/runtime-modules/accounting/module.d.ts +1 -1
- package/plugins/runtime-modules/accounting/trees/accounting-customer-file-label-set.js +2 -1
- package/plugins/runtime-modules/accounting/trees/phi-default-accounting-customer-file-page-tree.d.ts +5 -4
- package/plugins/runtime-modules/accounting/trees/phi-default-accounting-customer-file-page-tree.js +80 -38
- package/plugins/runtime-modules/admin/definition.d.ts +1 -1
- package/plugins/runtime-modules/admin/definition.js +0 -1
- package/plugins/runtime-modules/admin/module.d.ts +1 -1
- package/plugins/runtime-modules/app/definition.d.ts +1 -1
- package/plugins/runtime-modules/app/definition.js +0 -1
- package/plugins/runtime-modules/app/module.d.ts +1 -1
- package/plugins/runtime-modules/area-base-definition.d.ts +19 -1
- package/plugins/runtime-modules/area-base-definition.js +18 -0
- package/plugins/runtime-modules/area-definitions.d.ts +8 -8
- package/plugins/runtime-modules/area-definitions.js +4 -3
- package/plugins/runtime-modules/area-root-route.d.ts +8 -0
- package/plugins/runtime-modules/area-root-route.js +11 -1
- package/plugins/runtime-modules/asset/labels.js +4 -0
- package/plugins/runtime-modules/asset/metadata-form.d.ts +0 -28
- package/plugins/runtime-modules/asset/metadata-form.js +6 -10
- package/plugins/runtime-modules/asset/services/options.d.ts +3 -2
- package/plugins/runtime-modules/asset/services/options.js +4 -3
- package/plugins/runtime-modules/asset/trees/phi-default-admin-media-settings-page-tree.js +2 -1
- package/plugins/runtime-modules/asset/trees/phi-default-builder-media-page-tree.js +3 -3
- package/plugins/runtime-modules/auth/widgets/security/client.js +2 -2
- package/plugins/runtime-modules/builder/addresses.d.ts +1 -1
- package/plugins/runtime-modules/builder/addresses.js +1 -1
- package/plugins/runtime-modules/builder/area-settings-form.js +1 -1
- package/plugins/runtime-modules/builder/clients/inspector-condition-group.d.ts +16 -0
- package/plugins/runtime-modules/builder/clients/inspector-condition-group.js +9 -0
- package/plugins/runtime-modules/builder/clients/inspector-config-field.js +97 -10
- package/plugins/runtime-modules/builder/clients/pages-header.js +7 -6
- package/plugins/runtime-modules/builder/clients/region-visibility-fields.js +1 -1
- package/plugins/runtime-modules/builder/controller/workspace-controller.js +7 -4
- package/plugins/runtime-modules/builder/definition.d.ts +1 -1
- package/plugins/runtime-modules/builder/definition.js +0 -1
- package/plugins/runtime-modules/builder/offered-page-catalog.d.ts +10 -4
- package/plugins/runtime-modules/builder/offered-page-catalog.js +35 -8
- package/plugins/runtime-modules/builder/page-meta-form.js +5 -2
- package/plugins/runtime-modules/builder/plugin-meta-labels.js +8 -0
- package/plugins/runtime-modules/builder/trees/phi-builder-inspector-area-overlay-tree.server.js +4 -2
- package/plugins/runtime-modules/builder/trees/phi-default-builder-area-preset-tree.js +20 -13
- package/plugins/runtime-modules/builder/workspace-catalog-actions.js +8 -1
- package/plugins/runtime-modules/cdn/trees/phi-default-admin-cdn-page-tree.js +26 -14
- package/plugins/runtime-modules/core/authoring-widgets.js +2 -1
- package/plugins/runtime-modules/core/messaging/label-defaults.d.ts +49 -0
- package/plugins/runtime-modules/core/messaging/label-defaults.js +48 -0
- package/plugins/runtime-modules/core/messaging/labels.d.ts +2 -28
- package/plugins/runtime-modules/core/messaging/labels.js +52 -23
- package/plugins/runtime-modules/core/widgets/card/config.d.ts +14 -0
- package/plugins/runtime-modules/core/widgets/command-toolbar/config.d.ts +14 -0
- package/plugins/runtime-modules/core/widgets/description/config.d.ts +14 -0
- package/plugins/runtime-modules/core/widgets/entry-list/config.d.ts +14 -0
- package/plugins/runtime-modules/core/widgets/float-button/config.d.ts +14 -0
- package/plugins/runtime-modules/core/widgets/gallery/config.d.ts +14 -0
- package/plugins/runtime-modules/core/widgets/markdown/config.d.ts +14 -0
- package/plugins/runtime-modules/core/widgets/result/config.d.ts +14 -0
- package/plugins/runtime-modules/core/widgets/select-box/client.js +13 -4
- package/plugins/runtime-modules/core/widgets/select-box/config.js +1 -0
- package/plugins/runtime-modules/core/widgets/simple-text/config.d.ts +14 -0
- package/plugins/runtime-modules/core/widgets/table/client.js +11 -4
- package/plugins/runtime-modules/core/widgets/table/config.d.ts +1 -1143
- package/plugins/runtime-modules/core/widgets/table/config.js +144 -125
- package/plugins/runtime-modules/core/widgets/thread-conversation/authoring.d.ts +2 -0
- package/plugins/runtime-modules/core/widgets/thread-conversation/authoring.js +76 -0
- package/plugins/runtime-modules/core/widgets/thread-conversation/client.d.ts +44 -1
- package/plugins/runtime-modules/core/widgets/thread-conversation/client.js +28 -13
- package/plugins/runtime-modules/editor/definition.d.ts +1 -1
- package/plugins/runtime-modules/editor/definition.js +0 -1
- package/plugins/runtime-modules/editor/module.d.ts +1 -1
- package/plugins/runtime-modules/phi-default-site-area-preset-tree.js +16 -8
- package/plugins/runtime-modules/public/definition.d.ts +1 -1
- package/plugins/runtime-modules/public/definition.js +0 -1
- package/plugins/runtime-modules/public/module.d.ts +1 -1
- package/plugins/runtime-modules/theme/widgets/brand-controls/client.js +109 -86
- package/plugins/runtime-modules/threads/controller/client.js +10 -12
- package/plugins/runtime-modules/threads/controller/definition.d.ts +6 -0
- package/plugins/runtime-modules/threads/controller/definition.js +17 -6
- package/styles/controls.css +49 -1
- package/styles/layout.css +3 -2
- package/types/calendar.d.ts +5 -0
- package/types/cms-plugins.d.ts +30 -10
- package/types/table-widget.d.ts +6 -0
|
@@ -133,7 +133,7 @@ export function PhiGeometryControl({ value, config, disabled = false, mode = "co
|
|
|
133
133
|
offsetTop: nextValue ?? 0,
|
|
134
134
|
}), style: { width: "100%", maxWidth: 120, minWidth: 0 } }))
|
|
135
135
|
: null, showSticky || showOffsetTop ? _jsx(Divider, { dashed: true, size: "small" }) : null, showProfiles
|
|
136
|
-
? renderGeometryRow(labels.fields.profile, _jsx(PhiSegmentedControl, { value: selectedProfile,
|
|
136
|
+
? renderGeometryRow(labels.fields.profile, _jsx(PhiSegmentedControl, { value: selectedProfile, block: true, options: PHI_GEOMETRY_PROFILES.map((option) => ({
|
|
137
137
|
value: option,
|
|
138
138
|
label: labels.profiles[option],
|
|
139
139
|
})), onChange: (next) => setSelectedProfile(next) }))
|
|
@@ -3,6 +3,11 @@ import { type PhiControlSize, type PhiCssLength } from "../../types";
|
|
|
3
3
|
export type PhiLengthControlProps = {
|
|
4
4
|
value?: PhiCssLength | null;
|
|
5
5
|
label?: string;
|
|
6
|
+
/**
|
|
7
|
+
* The accessible name where no visible label stands beside the field; it takes precedence over the
|
|
8
|
+
* placeholder and `label`. The unit list is named after it.
|
|
9
|
+
*/
|
|
10
|
+
ariaLabel?: string;
|
|
6
11
|
placeholder?: string;
|
|
7
12
|
min?: number;
|
|
8
13
|
max?: number;
|
|
@@ -19,4 +24,4 @@ export type PhiLengthControlProps = {
|
|
|
19
24
|
getPopupContainer?: (triggerNode: HTMLElement) => HTMLElement;
|
|
20
25
|
onChange?: (value: PhiCssLength | null) => void;
|
|
21
26
|
};
|
|
22
|
-
export declare function PhiLengthControl({ value, label, placeholder, min, max, step, precision, disabled, readOnly, size, style, getPopupContainer, onChange, }: PhiLengthControlProps): import("react").JSX.Element;
|
|
27
|
+
export declare function PhiLengthControl({ value, label, ariaLabel, placeholder, min, max, step, precision, disabled, readOnly, size, style, getPopupContainer, onChange, }: PhiLengthControlProps): import("react").JSX.Element;
|
|
@@ -5,7 +5,7 @@ import { useState } from "react";
|
|
|
5
5
|
import { PHI_CSS_LENGTH_UNITS, readPhiCssLengthPart, serializePhiCssLength, } from "../../types";
|
|
6
6
|
import { PhiLabeledControl } from "./phi-labeled-control";
|
|
7
7
|
import { PhiCompactGroupControl } from "./phi-compact-group-control";
|
|
8
|
-
export function PhiLengthControl({ value, label, placeholder, min, max, step, precision, disabled = false, readOnly = false, size, style, getPopupContainer, onChange, }) {
|
|
8
|
+
export function PhiLengthControl({ value, label, ariaLabel, placeholder, min, max, step, precision, disabled = false, readOnly = false, size, style, getPopupContainer, onChange, }) {
|
|
9
9
|
const part = readPhiCssLengthPart(value);
|
|
10
10
|
/**
|
|
11
11
|
* A unit is only expressible together with a number, so an empty field would otherwise force the
|
|
@@ -20,7 +20,8 @@ export function PhiLengthControl({ value, label, placeholder, min, max, step, pr
|
|
|
20
20
|
* is kept shut and its change ignored instead.
|
|
21
21
|
*/
|
|
22
22
|
const controlDisabled = disabled || (!onChange && !readOnly);
|
|
23
|
-
const
|
|
23
|
+
const accessibleName = ariaLabel ?? placeholder ?? label ?? "Length";
|
|
24
|
+
const control = (_jsxs(PhiCompactGroupControl, { block: true, size: size, style: { width: "100%", minWidth: 0, ...style }, children: [_jsx(InputNumber, { "aria-label": accessibleName, controls: false, disabled: controlDisabled, readOnly: readOnly, min: min, max: max, step: step, precision: precision, placeholder: placeholder, value: part?.value ?? null, style: { flex: "1 1 0", minWidth: 0 }, onChange: (nextValue) => onChange?.(typeof nextValue === "number" ? serializePhiCssLength(nextValue, unit) : null) }), _jsx(Select, { "aria-label": `${accessibleName} unit`, disabled: controlDisabled, open: readOnly ? false : undefined, options: PHI_CSS_LENGTH_UNITS.map((option) => ({ value: option, label: option })), popupMatchSelectWidth: false, getPopupContainer: getPopupContainer, showSearch: false, suffix: null, variant: "filled", value: unit, style: { flex: "0 0 38px", width: 38 }, styles: {
|
|
24
25
|
root: { paddingInline: 4 },
|
|
25
26
|
content: { justifyContent: "center", textAlign: "center" },
|
|
26
27
|
}, onChange: (nextUnit) => {
|
|
@@ -8,6 +8,11 @@ export type PhiMultiSelectControlProps<TValue extends string | number = string>
|
|
|
8
8
|
value?: readonly TValue[];
|
|
9
9
|
label?: string;
|
|
10
10
|
description?: ReactNode;
|
|
11
|
+
/**
|
|
12
|
+
* The accessible name where no visible label stands beside the field -- a filter in a picker's header.
|
|
13
|
+
* It takes precedence over `label`, as on `PhiSelectControl`.
|
|
14
|
+
*/
|
|
15
|
+
ariaLabel?: string;
|
|
11
16
|
placeholder?: string;
|
|
12
17
|
disabled?: boolean;
|
|
13
18
|
readOnly?: boolean;
|
|
@@ -23,4 +28,4 @@ export type PhiMultiSelectControlProps<TValue extends string | number = string>
|
|
|
23
28
|
onBlur?: () => void;
|
|
24
29
|
onChange?: (value: TValue[]) => void;
|
|
25
30
|
};
|
|
26
|
-
export declare function PhiMultiSelectControl<TValue extends string | number = string>({ id, value, label, description, placeholder, disabled, readOnly, allowCustom, allowClear, options, maxTagCount, size, variant, popupMatchSelectWidth, style, onFocus, onBlur, onChange, }: PhiMultiSelectControlProps<TValue>): import("react").JSX.Element;
|
|
31
|
+
export declare function PhiMultiSelectControl<TValue extends string | number = string>({ id, value, label, description, ariaLabel, placeholder, disabled, readOnly, allowCustom, allowClear, options, maxTagCount, size, variant, popupMatchSelectWidth, style, onFocus, onBlur, onChange, }: PhiMultiSelectControlProps<TValue>): import("react").JSX.Element;
|
|
@@ -5,8 +5,8 @@ import { Select } from "antd";
|
|
|
5
5
|
import { PhiControlOptionContent } from "./phi-control-option-content";
|
|
6
6
|
import { PhiLabeledControl, usePhiControlLabel } from "./phi-labeled-control";
|
|
7
7
|
import { groupPhiSelectOptions } from "./phi-select-control";
|
|
8
|
-
export function PhiMultiSelectControl({ id, value, label, description, placeholder, disabled, readOnly, allowCustom, allowClear, options, maxTagCount, size, variant, popupMatchSelectWidth = false, style, onFocus, onBlur, onChange, }) {
|
|
9
|
-
const { labelId, labelledBy } = usePhiControlLabel(label);
|
|
8
|
+
export function PhiMultiSelectControl({ id, value, label, description, ariaLabel, placeholder, disabled, readOnly, allowCustom, allowClear, options, maxTagCount, size, variant, popupMatchSelectWidth = false, style, onFocus, onBlur, onChange, }) {
|
|
9
|
+
const { labelId, labelledBy } = usePhiControlLabel(label, ariaLabel);
|
|
10
10
|
// Options that name a group are listed under its heading, as the Select lists them.
|
|
11
11
|
const selectOptions = useMemo(() => groupPhiSelectOptions(options.map((option) => ({
|
|
12
12
|
value: option.value,
|
|
@@ -16,7 +16,7 @@ export function PhiMultiSelectControl({ id, value, label, description, placehold
|
|
|
16
16
|
option,
|
|
17
17
|
disabled: option.disabled,
|
|
18
18
|
}))), [options]);
|
|
19
|
-
const control = (_jsx(Select, { id: id, "aria-labelledby": labelledBy, mode: allowCustom ? "tags" : "multiple", allowClear: allowClear, value: [...(value ?? [])], placeholder: placeholder, disabled: disabled || readOnly || !onChange, options: selectOptions, optionFilterProp: ["searchLabel", "value"], optionRender: (option) => {
|
|
19
|
+
const control = (_jsx(Select, { id: id, "aria-label": ariaLabel, "aria-labelledby": labelledBy, mode: allowCustom ? "tags" : "multiple", allowClear: allowClear, value: [...(value ?? [])], placeholder: placeholder, disabled: disabled || readOnly || !onChange, options: selectOptions, optionFilterProp: ["searchLabel", "value"], optionRender: (option) => {
|
|
20
20
|
/*
|
|
21
21
|
* With `allowCustom` the Select offers what is being typed as an option of its own, and that one
|
|
22
22
|
* carries no Phi option: it is a value nobody declared yet, drawn as the text it is.
|
|
@@ -8,6 +8,11 @@ export type PhiSegmentedControlProps<TValue extends string | number = string> =
|
|
|
8
8
|
*/
|
|
9
9
|
value?: TValue | null;
|
|
10
10
|
label?: string;
|
|
11
|
+
/**
|
|
12
|
+
* The accessible name of the group where no visible label stands beside it; it takes precedence over
|
|
13
|
+
* `label`. It names the radio group, not a segment.
|
|
14
|
+
*/
|
|
15
|
+
ariaLabel?: string;
|
|
11
16
|
options: readonly PhiControlOption<TValue>[];
|
|
12
17
|
disabled?: boolean;
|
|
13
18
|
readOnly?: boolean;
|
|
@@ -19,4 +24,4 @@ export type PhiSegmentedControlProps<TValue extends string | number = string> =
|
|
|
19
24
|
onBlur?: () => void;
|
|
20
25
|
onChange?: (value: TValue) => void;
|
|
21
26
|
};
|
|
22
|
-
export declare function PhiSegmentedControl<TValue extends string | number = string>({ value, label, options, disabled, readOnly, block, size, gradient, onFocus, onBlur, onChange, }: PhiSegmentedControlProps<TValue>): import("react").JSX.Element;
|
|
27
|
+
export declare function PhiSegmentedControl<TValue extends string | number = string>({ value, label, ariaLabel, options, disabled, readOnly, block, size, gradient, onFocus, onBlur, onChange, }: PhiSegmentedControlProps<TValue>): import("react").JSX.Element;
|
|
@@ -11,10 +11,10 @@ const PHI_SEGMENT_LABEL_STYLE = {
|
|
|
11
11
|
textOverflow: "ellipsis",
|
|
12
12
|
whiteSpace: "nowrap",
|
|
13
13
|
};
|
|
14
|
-
export function PhiSegmentedControl({ value, label, options, disabled, readOnly, block, size, gradient, onFocus, onBlur, onChange, }) {
|
|
15
|
-
const { labelId, labelledBy } = usePhiControlLabel(label);
|
|
14
|
+
export function PhiSegmentedControl({ value, label, ariaLabel, options, disabled, readOnly, block, size, gradient, onFocus, onBlur, onChange, }) {
|
|
15
|
+
const { labelId, labelledBy } = usePhiControlLabel(label, ariaLabel);
|
|
16
16
|
const gradientVars = gradient ? PHI_THEME_GRADIENT_CSS_VARS[gradient] : null;
|
|
17
|
-
const control = (_jsx(Segmented, { "aria-labelledby": labelledBy, block: block, value: value, disabled: disabled || readOnly || !onChange, options: options.map((option) => ({
|
|
17
|
+
const control = (_jsx(Segmented, { "aria-label": ariaLabel, "aria-labelledby": labelledBy, block: block, value: value, disabled: disabled || readOnly || !onChange, options: options.map((option) => ({
|
|
18
18
|
value: option.value,
|
|
19
19
|
/*
|
|
20
20
|
* A segment too narrow for its words shows them whole in the house tooltip, and only then. A
|
|
@@ -6,6 +6,8 @@ export type PhiSwitchControlProps = {
|
|
|
6
6
|
id?: string;
|
|
7
7
|
checked?: boolean;
|
|
8
8
|
label?: ReactNode;
|
|
9
|
+
/** The accessible name where no visible label stands beside the field; it takes precedence over `label`. */
|
|
10
|
+
ariaLabel?: string;
|
|
9
11
|
disabled?: boolean;
|
|
10
12
|
readOnly?: boolean;
|
|
11
13
|
loading?: boolean;
|
|
@@ -18,4 +20,4 @@ export type PhiSwitchControlProps = {
|
|
|
18
20
|
gradient?: PhiThemeGradientKey;
|
|
19
21
|
onChange?: (checked: boolean) => void;
|
|
20
22
|
};
|
|
21
|
-
export declare function PhiSwitchControl({ id, checked, label, disabled, readOnly, loading, checkedLabel, uncheckedLabel, size, gradient, onChange, }: PhiSwitchControlProps): import("react").JSX.Element;
|
|
23
|
+
export declare function PhiSwitchControl({ id, checked, label, ariaLabel, disabled, readOnly, loading, checkedLabel, uncheckedLabel, size, gradient, onChange, }: PhiSwitchControlProps): import("react").JSX.Element;
|
|
@@ -3,9 +3,9 @@ import { jsx as _jsx } from "react/jsx-runtime";
|
|
|
3
3
|
import { Switch } from "antd";
|
|
4
4
|
import { PHI_THEME_GRADIENT_CSS_VARS } from "../../theme/phi-theme-gradients";
|
|
5
5
|
import { PhiLabeledControl, usePhiControlLabel } from "./phi-labeled-control";
|
|
6
|
-
export function PhiSwitchControl({ id, checked, label, disabled, readOnly, loading, checkedLabel, uncheckedLabel, size, gradient, onChange, }) {
|
|
7
|
-
const { labelId, labelledBy } = usePhiControlLabel(label);
|
|
8
|
-
return (_jsx(PhiLabeledControl, { label: label, labelId: labelId, children: _jsx(Switch, { id: id, "aria-labelledby": labelledBy, checked: checked, disabled: disabled || readOnly || !onChange, loading: loading, checkedChildren: checkedLabel, unCheckedChildren: uncheckedLabel, size: size, onChange: onChange, ...(gradient
|
|
6
|
+
export function PhiSwitchControl({ id, checked, label, ariaLabel, disabled, readOnly, loading, checkedLabel, uncheckedLabel, size, gradient, onChange, }) {
|
|
7
|
+
const { labelId, labelledBy } = usePhiControlLabel(label, ariaLabel);
|
|
8
|
+
return (_jsx(PhiLabeledControl, { label: label, labelId: labelId, children: _jsx(Switch, { id: id, "aria-label": ariaLabel, "aria-labelledby": labelledBy, checked: checked, disabled: disabled || readOnly || !onChange, loading: loading, checkedChildren: checkedLabel, unCheckedChildren: uncheckedLabel, size: size, onChange: onChange, ...(gradient
|
|
9
9
|
? {
|
|
10
10
|
className: "phi-switch-gradient",
|
|
11
11
|
style: { "--phi-control-gradient": `var(${PHI_THEME_GRADIENT_CSS_VARS[gradient].paint})` },
|
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
import { type CSSProperties, type DragEvent, type ReactNode } from "react";
|
|
2
2
|
import type { PhiControlSize, PhiControlVariant } from "../../types/control";
|
|
3
3
|
import type { PhiCalendarAdapterKey } from "../../types/calendar";
|
|
4
|
+
import { type PhiTableSurface } from "../tables/phi-table-surface";
|
|
4
5
|
import type { PhiTableColumnEditorControl, PhiTableProviderFieldType, PhiTableRowIdentity, PhiTableSort, PhiTableColumnSizing, PhiTableLayoutConfig } from "../../types/table-widget";
|
|
5
6
|
import type { PhiControlOption } from "./phi-control-options";
|
|
6
7
|
export type PhiTableControlCellEditor = {
|
|
@@ -129,6 +130,12 @@ export type PhiTableControlProps<TRow extends Record<string, unknown>> = {
|
|
|
129
130
|
*/
|
|
130
131
|
loadingRows?: number;
|
|
131
132
|
bordered?: boolean;
|
|
133
|
+
/**
|
|
134
|
+
* The Table's ground, from the Surface vocabulary (`components/tables/phi-table-surface.ts`). Absent is
|
|
135
|
+
* the Table's own ground; `null` is none -- the rows' lines and nothing under them, header and footer
|
|
136
|
+
* included -- which is what an inspector's Table is (`PHI_INSPECTOR_TABLE_CONTROL_PROPS`).
|
|
137
|
+
*/
|
|
138
|
+
surface?: PhiTableSurface;
|
|
132
139
|
striped?: boolean;
|
|
133
140
|
showHeader?: boolean;
|
|
134
141
|
/**
|
|
@@ -155,4 +162,4 @@ export type PhiTableControlProps<TRow extends Record<string, unknown>> = {
|
|
|
155
162
|
onExternalDrop?: (event: DragEvent<HTMLDivElement>) => void;
|
|
156
163
|
};
|
|
157
164
|
export declare function readPhiTableControlValue(row: Record<string, unknown>, path: string): unknown;
|
|
158
|
-
export declare function PhiTableControl<TRow extends Record<string, unknown>>({ rows, rowIdentityPath, columns, columnOrder, sortingMode, sorts, onSortsChange, columnReordering, onColumnOrderChange, rowSelection, pagination, tree, rowReordering, editing, loading, loadingRows: loadingRowCount, bordered, striped, stickyHeader, showHeader, footer, summary, size, emptyText, layout, rowStyle, onRowActivate, onExternalRowDragOver, onExternalRowDrop, onExternalDragOver, onExternalDrop, }: PhiTableControlProps<TRow>): import("react").JSX.Element;
|
|
165
|
+
export declare function PhiTableControl<TRow extends Record<string, unknown>>({ rows, rowIdentityPath, columns, columnOrder, sortingMode, sorts, onSortsChange, columnReordering, onColumnOrderChange, rowSelection, pagination, tree, rowReordering, editing, loading, loadingRows: loadingRowCount, bordered, surface, striped, stickyHeader, showHeader, footer, summary, size, emptyText, layout, rowStyle, onRowActivate, onExternalRowDragOver, onExternalRowDrop, onExternalDragOver, onExternalDrop, }: PhiTableControlProps<TRow>): import("react").JSX.Element;
|
|
@@ -10,6 +10,7 @@ import { Children, cloneElement, createContext, isValidElement, useCallback, use
|
|
|
10
10
|
import { PHI_GREGORY_CALENDAR_ADAPTER_KEY } from "../../types/calendar-keys";
|
|
11
11
|
import { PHI_VISUAL_ANCHOR_PART_ATTRIBUTE } from "../../types/visual-anchors";
|
|
12
12
|
import { PHI_TABLE_LOADING_ROWS, PHI_TABLE_LOADING_ROWS_MAX } from "../../constants/table-loading";
|
|
13
|
+
import { resolvePhiTableSurfaceGround } from "../tables/phi-table-surface";
|
|
13
14
|
import { PhiTruncatedHoverText } from "./phi-truncated-hover-text";
|
|
14
15
|
import { PhiColorControl } from "./phi-color-control";
|
|
15
16
|
import { PhiCheckboxControl } from "./phi-checkbox-control";
|
|
@@ -379,7 +380,7 @@ const PHI_TABLE_COLUMN_TITLE_STYLE = { display: "block", minWidth: 0, overflow:
|
|
|
379
380
|
function renderPhiTableColumnTitle(title) {
|
|
380
381
|
return (_jsx(PhiTruncatedHoverText, { title: title, children: _jsx("span", { style: PHI_TABLE_COLUMN_TITLE_STYLE, children: title }) }));
|
|
381
382
|
}
|
|
382
|
-
export function PhiTableControl({ rows, rowIdentityPath, columns, columnOrder, sortingMode, sorts, onSortsChange, columnReordering = false, onColumnOrderChange, rowSelection, pagination = false, tree, rowReordering, editing, loading = false, loadingRows: loadingRowCount = PHI_TABLE_LOADING_ROWS, bordered, striped = false, stickyHeader = false, showHeader, footer, summary, size, emptyText, layout, rowStyle, onRowActivate, onExternalRowDragOver, onExternalRowDrop, onExternalDragOver, onExternalDrop, }) {
|
|
383
|
+
export function PhiTableControl({ rows, rowIdentityPath, columns, columnOrder, sortingMode, sorts, onSortsChange, columnReordering = false, onColumnOrderChange, rowSelection, pagination = false, tree, rowReordering, editing, loading = false, loadingRows: loadingRowCount = PHI_TABLE_LOADING_ROWS, bordered, surface, striped = false, stickyHeader = false, showHeader, footer, summary, size, emptyText, layout, rowStyle, onRowActivate, onExternalRowDragOver, onExternalRowDrop, onExternalDragOver, onExternalDrop, }) {
|
|
383
384
|
const { token } = usePhiConfig();
|
|
384
385
|
const [editingRowIdentityState, setEditingRowIdentity] = useState(null);
|
|
385
386
|
const [rowEditPatch, setRowEditPatch] = useState({});
|
|
@@ -1053,9 +1054,14 @@ export function PhiTableControl({ rows, rowIdentityPath, columns, columnOrder, s
|
|
|
1053
1054
|
// No rows, nothing measured: the sticky header's fixed layout would have no widths to fix.
|
|
1054
1055
|
!loading && dataSource.length === 0 ? "phi-table-control--empty" : null,
|
|
1055
1056
|
loading ? "phi-table-control--loading" : null,
|
|
1057
|
+
surface !== undefined ? "phi-table-control--surface" : null,
|
|
1056
1058
|
]
|
|
1057
1059
|
.filter(Boolean)
|
|
1058
|
-
.join(" "), style: {
|
|
1060
|
+
.join(" "), style: {
|
|
1061
|
+
"--phi-table-striped-row-background": token.colorFillAlter,
|
|
1062
|
+
// A stated Surface is the Table's only ground (`styles/controls.css`, "A Table that states its Surface").
|
|
1063
|
+
...(surface !== undefined ? { "--phi-table-surface-ground": resolvePhiTableSurfaceGround(surface) } : {}),
|
|
1064
|
+
}, rowKey: (row) => loading
|
|
1059
1065
|
? `__phi_table_loading_${String(row[PHI_TABLE_LOADING_ROW])}`
|
|
1060
1066
|
: String(readIdentity(row, rowIdentityPath)), columns: renderedColumns, dataSource: loading ? loadingRows : dataSource, bordered: bordered, showHeader: showHeader, tableLayout: layout.mode, size: size, rowClassName: (_row, index) => striped && index % 2 === 1 ? "phi-table-control__row--striped" : "", rowSelection: loading ? loadingRowSelection : antdRowSelection, components: rowReordering?.enabled && !loading ? { body: { row: PhiTableSortableRow } } : undefined, scroll: layout.overflowX === "auto" ? { x: true } : undefined, sticky: stickyHeader && showHeader !== false ? true : undefined, pagination: pagination === false ? false : {
|
|
1061
1067
|
...{ [PHI_VISUAL_ANCHOR_PART_ATTRIBUTE]: "pagination" },
|
|
@@ -11,6 +11,7 @@ import { readPhiDotPath as readPath } from "../../helpers/dot-path";
|
|
|
11
11
|
import { movePhiTableBindingRows } from "../../helpers/table-binding";
|
|
12
12
|
import { PhiIcon } from "../shell/phi-icon";
|
|
13
13
|
import { readPhiFormTableFieldText as readTableFieldText } from "./table-field-text";
|
|
14
|
+
import { isPhiTableSurfaceDrawable } from "../tables/phi-table-surface";
|
|
14
15
|
function readRecords(value) {
|
|
15
16
|
return Array.isArray(value)
|
|
16
17
|
? value.filter((entry) => isPhiRecord(entry)).map((entry) => ({ ...entry }))
|
|
@@ -111,6 +112,20 @@ function applyMove(rows, identityPath, parentPath, move) {
|
|
|
111
112
|
? setPath(row, parentPath, parentIdentity)
|
|
112
113
|
: row);
|
|
113
114
|
}
|
|
115
|
+
/**
|
|
116
|
+
* A table field's `surface`: the Table's ground (`components/tables/phi-table-surface.ts`). Left out, the
|
|
117
|
+
* Table's own; `null`, none -- an inspector's Form says so through `PHI_INSPECTOR_TABLE_CONTROL_PROPS`.
|
|
118
|
+
* A Surface the Table cannot draw is a mistake in the descriptor and is said as one.
|
|
119
|
+
*/
|
|
120
|
+
function readTableFieldSurface(value, fieldKey) {
|
|
121
|
+
if (value === undefined)
|
|
122
|
+
return undefined;
|
|
123
|
+
if (value === null)
|
|
124
|
+
return null;
|
|
125
|
+
if (isPhiRecord(value) && isPhiTableSurfaceDrawable(value))
|
|
126
|
+
return value;
|
|
127
|
+
throw new Error(`The table field "${fieldKey}" states a surface a Table cannot draw: null, or one colour of ground and nothing else.`);
|
|
128
|
+
}
|
|
114
129
|
export function PhiCompoundTableFormControl({ field, label, description, value, onChange, disabled, readOnly, formContext, labels, }) {
|
|
115
130
|
const rows = useMemo(() => readRecords(value), [value]);
|
|
116
131
|
const nextRowSequenceRef = useRef(0);
|
|
@@ -197,7 +212,7 @@ export function PhiCompoundTableFormControl({ field, label, description, value,
|
|
|
197
212
|
icon: _jsx(PhiIcon, { name: "plus", size: "inherit" }),
|
|
198
213
|
type: "primary",
|
|
199
214
|
}], compact: true, showLabels: true, size: "small", disabled: locked, onActivate: (key) => { if (key === "add")
|
|
200
|
-
appendRow(); } })) : null }), _jsx(PhiTableControl, { rows: rows, rowIdentityPath: identityPath, columns: renderedColumns, columnOrder: columnOrder, sortingMode: "none", sorts: [], bordered: config.bordered === true, striped: config.striped === true, size: "small", emptyText: emptyText, layout: layout, rowReordering: config.reorder === true && !locked ? {
|
|
215
|
+
appendRow(); } })) : null }), _jsx(PhiTableControl, { rows: rows, rowIdentityPath: identityPath, columns: renderedColumns, columnOrder: columnOrder, sortingMode: "none", sorts: [], bordered: config.bordered === true, surface: readTableFieldSurface(config.surface, field.key), stickyHeader: config.stickyHeader === true, striped: config.striped === true, size: "small", emptyText: emptyText, layout: layout, rowReordering: config.reorder === true && !locked ? {
|
|
201
216
|
enabled: true,
|
|
202
217
|
onMove: (move) => onChange?.(applyMove(rows, identityPath, typeof config.parentRowIdentityPath === "string" ? config.parentRowIdentityPath : null, move)),
|
|
203
218
|
} : undefined })] }));
|
|
@@ -6,8 +6,6 @@ import { createPhiSignalAddress } from "../../../types/signals";
|
|
|
6
6
|
import { usePhiSignalDispatcher, usePhiSignalListener } from "../../runtime/runtime-signal-bus";
|
|
7
7
|
import { usePhiSignalIdentity } from "../../runtime/runtime-signal-identity";
|
|
8
8
|
import { PhiLayoutAnchoredOverlay } from "./phi-layout-anchored-overlay";
|
|
9
|
-
import { PhiDescriptionHint } from "../../controls/phi-description-tooltip-icon";
|
|
10
|
-
import { PHI_SPACE } from "../../../theme/antd-css-var-contract";
|
|
11
9
|
import { PhiCollapseControl, } from "../../controls/phi-collapse-control";
|
|
12
10
|
import { PhiBaseLayoutSlotStateProvider, usePhiBaseLayoutSlotStates, PhiBaseLayoutSlotScope, } from "./phi-base-layout-client";
|
|
13
11
|
import { resolvePhiBaseLayoutChrome, } from "../phi-layout-view-model";
|
|
@@ -372,12 +370,10 @@ function PhiCollapsibleLayoutBody({ blockId, slots, slotKeys, slotMeta, panelMin
|
|
|
372
370
|
cursor: "text",
|
|
373
371
|
}, children: title }))
|
|
374
372
|
: title;
|
|
375
|
-
const description = slotDescriptions?.[slotIndex]?.trim();
|
|
376
373
|
return {
|
|
377
374
|
key: slotKey,
|
|
378
|
-
label
|
|
379
|
-
|
|
380
|
-
: label,
|
|
375
|
+
label,
|
|
376
|
+
description: slotDescriptions?.[slotIndex]?.trim() || undefined,
|
|
381
377
|
forceRender: isEditMode || isHiddenSlot,
|
|
382
378
|
hidden: isHiddenSlot,
|
|
383
379
|
children: childContent
|
|
@@ -83,6 +83,8 @@ export type PhiAssetInspectorWidgetLabels = {
|
|
|
83
83
|
logoVariantLabel: string;
|
|
84
84
|
landscapeVariantLabel: string;
|
|
85
85
|
portraitVariantLabel: string;
|
|
86
|
+
iconVariantLabel: string;
|
|
87
|
+
shareVariantLabel: string;
|
|
86
88
|
publicUrlLabel: string;
|
|
87
89
|
contentTypeLabel: string;
|
|
88
90
|
originalNameLabel: string;
|
|
@@ -87,6 +87,8 @@ export const PHI_ASSET_MODULE_DEFAULT_LABELS = {
|
|
|
87
87
|
logoVariantLabel: "Logo",
|
|
88
88
|
landscapeVariantLabel: "Landscape",
|
|
89
89
|
portraitVariantLabel: "Portrait",
|
|
90
|
+
iconVariantLabel: "Icon",
|
|
91
|
+
shareVariantLabel: "Share",
|
|
90
92
|
publicUrlLabel: "Public URL",
|
|
91
93
|
contentTypeLabel: "Content type",
|
|
92
94
|
originalNameLabel: "Original name",
|
|
@@ -14,6 +14,24 @@ import { resolvePhiImagePresentation } from "./image-presentation";
|
|
|
14
14
|
import { PhiFlexControl } from "../controls/phi-flex-control";
|
|
15
15
|
import { PhiTypographyControl } from "../controls/phi-typography-control";
|
|
16
16
|
import { PhiIcon } from "../shell/phi-icon";
|
|
17
|
+
/**
|
|
18
|
+
* The Inspector label of every variant the contracts name. Typed against the contracts' names, so a variant
|
|
19
|
+
* added there without a label here fails the typecheck instead of drawing an empty option.
|
|
20
|
+
*/
|
|
21
|
+
const PHI_ASSET_VARIANT_LABEL_KEYS = {
|
|
22
|
+
thumbnail: "thumbnailVariantLabel",
|
|
23
|
+
preview: "previewVariantLabel",
|
|
24
|
+
banner: "bannerVariantLabel",
|
|
25
|
+
header: "headerVariantLabel",
|
|
26
|
+
card: "cardVariantLabel",
|
|
27
|
+
hero: "heroVariantLabel",
|
|
28
|
+
avatar: "avatarVariantLabel",
|
|
29
|
+
logo: "logoVariantLabel",
|
|
30
|
+
landscape: "landscapeVariantLabel",
|
|
31
|
+
portrait: "portraitVariantLabel",
|
|
32
|
+
icon: "iconVariantLabel",
|
|
33
|
+
share: "shareVariantLabel",
|
|
34
|
+
};
|
|
17
35
|
function formatBytes(bytes) {
|
|
18
36
|
if (typeof bytes !== "number" || !Number.isFinite(bytes) || bytes <= 0)
|
|
19
37
|
return null;
|
|
@@ -127,7 +145,7 @@ export function PhiAssetInspectorSection({ section, asset, selectedVariantKey, s
|
|
|
127
145
|
{ value: "original", label: labels.inspector.originalVariantLabel },
|
|
128
146
|
...Object.entries(PhiImageAssetVariantKeyName).map(([value, variantName]) => ({
|
|
129
147
|
value,
|
|
130
|
-
label: labels.inspector[
|
|
148
|
+
label: labels.inspector[PHI_ASSET_VARIANT_LABEL_KEYS[variantName]],
|
|
131
149
|
})),
|
|
132
150
|
], onChange: (value) => onVariantKeyChange(value === "original" ? null : Number(value)), style: { width: "100%" } })) : null] }));
|
|
133
151
|
}
|
|
@@ -45,6 +45,8 @@ export function buildPhiAreaShellHeaderNodes({ nodes, runtime, labelPrefix, ids,
|
|
|
45
45
|
label: `${labelPrefix} header top three column`,
|
|
46
46
|
config: {
|
|
47
47
|
balancedSides: true,
|
|
48
|
+
// Three equal columns: the page title in the middle never needs more than a third.
|
|
49
|
+
sideShare: 33,
|
|
48
50
|
contentAlign: "center",
|
|
49
51
|
paddingLeft: PHI_SPACE.base,
|
|
50
52
|
paddingRight: PHI_SPACE.base,
|
|
@@ -1,11 +1,19 @@
|
|
|
1
1
|
"use client";
|
|
2
2
|
import { jsx as _jsx, jsxs as _jsxs, Fragment as _Fragment } from "react/jsx-runtime";
|
|
3
|
+
import { usePhiConfig } from "../root/phi-config-provider";
|
|
3
4
|
const ICON_BOX = {
|
|
4
5
|
display: "inline-flex",
|
|
5
6
|
color: "currentColor",
|
|
6
7
|
};
|
|
7
8
|
function Frame({ size, children, }) {
|
|
8
|
-
|
|
9
|
+
/*
|
|
10
|
+
* The Theme's small radius, as every small box beside it has -- the Insert picker's entries, a colour
|
|
11
|
+
* swatch. The frame is drawn in a 16-unit box, so a size in pixels converts the radius into those
|
|
12
|
+
* units and the corner is the Theme's on screen; a size in another unit cannot be converted here, and
|
|
13
|
+
* the radius stands at the icon's drawn 16px and scales with it.
|
|
14
|
+
*/
|
|
15
|
+
const themeRadius = usePhiConfig().token.borderRadiusSM;
|
|
16
|
+
const radius = typeof size === "number" && size > 0 ? (themeRadius * 16) / size : themeRadius;
|
|
9
17
|
return (_jsxs("svg", { viewBox: "0 0 16 16", fill: "none", "aria-hidden": "true", style: { ...ICON_BOX, width: size, height: size }, children: [_jsx("rect", { x: "1", y: "1", width: "14", height: "14", rx: radius, stroke: "currentColor", strokeWidth: "1" }), children] }));
|
|
10
18
|
}
|
|
11
19
|
function ContentMotif() {
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
import type { PhiSurface } from "../../types/surface";
|
|
2
|
+
/**
|
|
3
|
+
* A Table's ground, in the Surface vocabulary every box uses (`types/surface.ts`, LAYOUTING.md "Surface").
|
|
4
|
+
*
|
|
5
|
+
* A Table draws the part of a Surface that a table can carry -- its ground -- and nothing else:
|
|
6
|
+
*
|
|
7
|
+
* - absent: the Table's own ground, as Ant Design draws it -- the Theme's container ground under the rows,
|
|
8
|
+
* the header and footer fills over it. The default.
|
|
9
|
+
* - `null`: "None", as the Surface switch says it -- no ground at all. The Table is its row lines on
|
|
10
|
+
* whatever it stands on: the header, the footer and a summary row paint nothing either. An inspector's
|
|
11
|
+
* Tables take this one (`PHI_INSPECTOR_TABLE_PRESENTATION`, `helpers/cms-inspector-drawer.ts`).
|
|
12
|
+
* - a Surface whose ground is one colour, with no line, no depth, no mode of its own and no ground per
|
|
13
|
+
* mode -- `PHI_SURFACE_WASH` is one. The whole Table stands on that colour, its header and footer too.
|
|
14
|
+
*
|
|
15
|
+
* A line, a shadow or a picture is a box around the Table, not the Table's ground: a Table that wants one
|
|
16
|
+
* stands in a Layout or a Widget slot that draws it. The outer frame stays `bordered` / `presentation.borders`.
|
|
17
|
+
*/
|
|
18
|
+
export type PhiTableSurface = PhiSurface | null;
|
|
19
|
+
/** Whether a stated Surface is one a Table can draw: one colour of ground and nothing else. */
|
|
20
|
+
export declare function isPhiTableSurfaceDrawable(surface: PhiSurface): boolean;
|
|
21
|
+
/**
|
|
22
|
+
* The colour a Table with a stated Surface stands on: the Surface's ground colour, or `transparent` for
|
|
23
|
+
* "None" and a Surface that paints none.
|
|
24
|
+
*/
|
|
25
|
+
export declare function resolvePhiTableSurfaceGround(surface: PhiTableSurface): string;
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
/** Whether a stated Surface is one a Table can draw: one colour of ground and nothing else. */
|
|
2
|
+
export function isPhiTableSurfaceDrawable(surface) {
|
|
3
|
+
if (surface.backgroundDark != null)
|
|
4
|
+
return false;
|
|
5
|
+
if (surface.tone != null && surface.tone !== "inherit")
|
|
6
|
+
return false;
|
|
7
|
+
if (surface.shadow != null && surface.shadow !== "none")
|
|
8
|
+
return false;
|
|
9
|
+
if (surface.border != null || (surface.borderSource != null && surface.borderSource !== "none"))
|
|
10
|
+
return false;
|
|
11
|
+
const background = surface.background;
|
|
12
|
+
if (background == null)
|
|
13
|
+
return true;
|
|
14
|
+
if (background.overlay != null || background.filter != null || background.motion != null)
|
|
15
|
+
return false;
|
|
16
|
+
return background.base.kind === "color" || background.base.kind === "none";
|
|
17
|
+
}
|
|
18
|
+
/**
|
|
19
|
+
* The colour a Table with a stated Surface stands on: the Surface's ground colour, or `transparent` for
|
|
20
|
+
* "None" and a Surface that paints none.
|
|
21
|
+
*/
|
|
22
|
+
export function resolvePhiTableSurfaceGround(surface) {
|
|
23
|
+
const base = surface?.background?.base;
|
|
24
|
+
return base?.kind === "color" ? base.color : "transparent";
|
|
25
|
+
}
|
|
@@ -16,6 +16,7 @@ import { PhiFlexControl } from "../../controls/phi-flex-control";
|
|
|
16
16
|
import { PhiCollectionHeaderControl } from "../../controls/phi-collection-header-control";
|
|
17
17
|
import { PhiToolbarControl } from "../../controls/phi-toolbar-control";
|
|
18
18
|
import { PHI_SPACE } from "../../../theme/antd-css-var-contract";
|
|
19
|
+
import { PHI_INSPECTOR_TABLE_CONTROL_PROPS } from "../../../helpers/cms-inspector-drawer";
|
|
19
20
|
const ROW_ID = "rowId";
|
|
20
21
|
function readRowName(row, spec) {
|
|
21
22
|
return String(row[spec.nameField] || row[spec.keyField] || "");
|
|
@@ -119,7 +120,9 @@ function PhiStaticRowsTable({ spec, providerKey, resource, disabled, }) {
|
|
|
119
120
|
* Add stands over the table, as every collection's tools do (TABLES.md, "Collection Header"): a
|
|
120
121
|
* compact toolbar on the right, `space.sm` above the table.
|
|
121
122
|
*/
|
|
122
|
-
return _jsxs(_Fragment, { children: [binding.error ? _jsx(PhiAlertControl, { level: "error", showIcon: true, title: binding.error.message }) : null, _jsxs(PhiFlexControl, { vertical: true, gap: PHI_SPACE.sm, style: { width: "100%", minWidth: 0 }, children: [_jsx(PhiCollectionHeaderControl, { toolbar: (_jsx(PhiToolbarControl, { compact: true, size: "small", disabled: disabled, items: [{ key: "add", label: labels.add, showLabel: true, icon: _jsx(PhiIcon, { name: "plus", size: "inherit" }) }], onActivate: () => { void binding.executeAction({ kind: "action", actionKey: "add", selectedRowIdentities: [], query: binding.resolvedQuery }); } })) }), _jsx(PhiTableBindingControl
|
|
123
|
+
return _jsxs(_Fragment, { children: [binding.error ? _jsx(PhiAlertControl, { level: "error", showIcon: true, title: binding.error.message }) : null, _jsxs(PhiFlexControl, { vertical: true, gap: PHI_SPACE.sm, style: { width: "100%", minWidth: 0 }, children: [_jsx(PhiCollectionHeaderControl, { toolbar: (_jsx(PhiToolbarControl, { compact: true, size: "small", disabled: disabled, items: [{ key: "add", label: labels.add, showLabel: true, icon: _jsx(PhiIcon, { name: "plus", size: "inherit" }) }], onActivate: () => { void binding.executeAction({ kind: "action", actionKey: "add", selectedRowIdentities: [], query: binding.resolvedQuery }); } })) }), _jsx(PhiTableBindingControl
|
|
124
|
+
// An inspector's Table, in the dialog its field opens: lines only (BUILDER.md "Inspector contract").
|
|
125
|
+
, { ...PHI_INSPECTOR_TABLE_CONTROL_PROPS, rows: binding.rows, fields: binding.resource?.fields ?? [], columns: columns, rowIdentityPath: ROW_ID, columnOrder: [...spec.columns.map((column) => column.key), "actions"], sortingMode: "none", sorts: [], pagination: false, size: "small", emptyText: labels.empty, layout: { mode: "fixed", overflowX: "auto" }, loading: binding.loading, rowReordering: { enabled: !disabled, onMove: (move) => { void binding.moveRow({ kind: "row-move", ...move }); } } })] })] });
|
|
123
126
|
}
|
|
124
127
|
/** A Widget's static rows: a tool button that opens them in a dialog and hands back the applied rows. */
|
|
125
128
|
export function PhiStaticRowsToolButton({ spec, rows: storedRows, disabled = false, onApply, }) {
|
|
@@ -18,10 +18,17 @@ export type PhiChoiceControllerResult = {
|
|
|
18
18
|
emitFocus: () => void;
|
|
19
19
|
emitBlur: () => void;
|
|
20
20
|
publish: (nextValue: string) => void;
|
|
21
|
+
/**
|
|
22
|
+
* What is typed into the select, for an Options Provider that searches on the server (`loadMode:
|
|
23
|
+
* "server"`, `search`); absent where the source declares no search, so the select narrows what it holds.
|
|
24
|
+
*/
|
|
25
|
+
onSearch?: (search: string) => void;
|
|
26
|
+
/** `false` where the provider's answer is already the result of the search. */
|
|
27
|
+
filterOptionsLocally: boolean;
|
|
21
28
|
};
|
|
22
29
|
export declare function usePhiChoiceController<TConfig extends PhiChoiceControlConfig>({ config, signalsEnabled, typeKey, defaultKey, sender, }: PhiChoiceControllerOptions<TConfig>): PhiChoiceControllerResult;
|
|
23
30
|
export type PhiStackChoiceControllerOptions<TConfig extends PhiStackChoiceControlConfig> = PhiChoiceControllerOptions<TConfig>;
|
|
24
|
-
export type PhiStackChoiceControllerResult = Omit<PhiChoiceControllerResult, "publish" | "options"> & {
|
|
31
|
+
export type PhiStackChoiceControllerResult = Omit<PhiChoiceControllerResult, "publish" | "options" | "onSearch" | "filterOptionsLocally"> & {
|
|
25
32
|
options: PhiControlOption[];
|
|
26
33
|
stackMode: boolean;
|
|
27
34
|
publish: (nextValue: string) => void;
|
|
@@ -19,12 +19,25 @@ function readPhiChoiceHeldValue(picked, configuredValue) {
|
|
|
19
19
|
export function usePhiChoiceController({ config, signalsEnabled = true, typeKey, defaultKey, sender, }) {
|
|
20
20
|
// A pick, held against the fallback it replaced; declared first so the provider hears it.
|
|
21
21
|
const [picked, setPicked] = useState(null);
|
|
22
|
+
/*
|
|
23
|
+
* What is typed, handed to the provider as a Form field and a Table filter hand it: the hook debounces it
|
|
24
|
+
* and holds it to the declared minimum, so a provider answering one page of a longer list -- the Site's
|
|
25
|
+
* members -- is searched by its route rather than inside the page it answered.
|
|
26
|
+
*/
|
|
27
|
+
const [searchDraft, setSearchDraft] = useState("");
|
|
22
28
|
const resolvedOptions = usePhiControlOptionsProvider({
|
|
23
29
|
options: config?.options,
|
|
24
30
|
optionsProvider: config?.optionsProvider,
|
|
31
|
+
searchDraft,
|
|
25
32
|
selectedValues: readPhiChoiceHeldValue(picked, config?.value),
|
|
26
33
|
});
|
|
27
|
-
|
|
34
|
+
/*
|
|
35
|
+
* Without a value of its own a choice holds its first option -- except a select that may be emptied
|
|
36
|
+
* (`allowClear`), which starts as it ends when cleared: with nothing chosen. A member picker that held
|
|
37
|
+
* the first member of the list showed a choice nobody made, and picking that member then changed nothing.
|
|
38
|
+
*/
|
|
39
|
+
const fallbackValue = config?.value ?? resolvedOptions.value ??
|
|
40
|
+
(config?.allowClear === true ? "" : resolvedOptions.options.at(0)?.value) ?? "";
|
|
28
41
|
const readOnly = config?.readOnly === true;
|
|
29
42
|
const value = picked?.source === fallbackValue ? picked.value : fallbackValue;
|
|
30
43
|
/*
|
|
@@ -78,6 +91,8 @@ export function usePhiChoiceController({ config, signalsEnabled = true, typeKey,
|
|
|
78
91
|
emitFocus: controlSignals.emitFocus,
|
|
79
92
|
emitBlur: controlSignals.emitBlur,
|
|
80
93
|
publish,
|
|
94
|
+
onSearch: resolvedOptions.search.enabled ? setSearchDraft : undefined,
|
|
95
|
+
filterOptionsLocally: resolvedOptions.search.filterLocally,
|
|
81
96
|
};
|
|
82
97
|
}
|
|
83
98
|
function mapPhiStackSlotsToChoiceOptions(message) {
|
|
@@ -12,6 +12,8 @@ export type PhiChoiceControlConfig = PhiControlConfig & PhiChoiceOptionsConfig &
|
|
|
12
12
|
placeholder?: string;
|
|
13
13
|
presentation?: "select" | "autocomplete";
|
|
14
14
|
allowCustom?: boolean;
|
|
15
|
+
/** A select that may be emptied again: its clear button announces the empty value. */
|
|
16
|
+
allowClear?: boolean;
|
|
15
17
|
};
|
|
16
18
|
/**
|
|
17
19
|
* The choice Controls that switch a stack -- Segmented, Steps, Tab Bar: options, a value and the Control's
|
|
@@ -59,6 +59,7 @@ export function parsePhiChoiceControlConfig(config) {
|
|
|
59
59
|
placeholder: reader.string("placeholder"),
|
|
60
60
|
presentation: reader.oneOf("presentation", ["select", "autocomplete"]) ?? "select",
|
|
61
61
|
allowCustom: reader.boolean("allowCustom"),
|
|
62
|
+
allowClear: reader.boolean("allowClear"),
|
|
62
63
|
...parsePhiChoiceOptionsConfig(config),
|
|
63
64
|
};
|
|
64
65
|
}
|
|
@@ -1,3 +1,6 @@
|
|
|
1
1
|
import type { PhiControlOption } from "../../controls/phi-control-options";
|
|
2
|
-
/**
|
|
2
|
+
/**
|
|
3
|
+
* The renditions an Asset is offered in, for every field that picks one; stored as the number the key is.
|
|
4
|
+
* Built from the contracts' list, so every picker offers every variant the server renders.
|
|
5
|
+
*/
|
|
3
6
|
export declare const PHI_IMAGE_VARIANT_OPTIONS: PhiControlOption<number>[];
|
|
@@ -1,14 +1,27 @@
|
|
|
1
|
-
import {
|
|
2
|
-
/**
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
1
|
+
import { PhiImageAssetVariantKeyName } from "../../../constants/media";
|
|
2
|
+
/**
|
|
3
|
+
* The name every variant the contracts know is shown by. Typed against the contracts' names, so a variant
|
|
4
|
+
* added there without a name here fails the typecheck instead of being missing from every picker.
|
|
5
|
+
*/
|
|
6
|
+
const PHI_IMAGE_VARIANT_LABELS = {
|
|
7
|
+
thumbnail: "Thumbnail",
|
|
8
|
+
preview: "Preview",
|
|
9
|
+
banner: "Banner",
|
|
10
|
+
header: "Header",
|
|
11
|
+
card: "Card",
|
|
12
|
+
hero: "Hero",
|
|
13
|
+
avatar: "Avatar",
|
|
14
|
+
logo: "Logo",
|
|
15
|
+
landscape: "Landscape",
|
|
16
|
+
portrait: "Portrait",
|
|
17
|
+
icon: "Icon",
|
|
18
|
+
share: "Share",
|
|
19
|
+
};
|
|
20
|
+
/**
|
|
21
|
+
* The renditions an Asset is offered in, for every field that picks one; stored as the number the key is.
|
|
22
|
+
* Built from the contracts' list, so every picker offers every variant the server renders.
|
|
23
|
+
*/
|
|
24
|
+
export const PHI_IMAGE_VARIANT_OPTIONS = Object.entries(PhiImageAssetVariantKeyName).map(([value, name]) => ({
|
|
25
|
+
value: Number(value),
|
|
26
|
+
label: PHI_IMAGE_VARIANT_LABELS[name],
|
|
27
|
+
}));
|
|
@@ -1,6 +1,19 @@
|
|
|
1
|
-
import type
|
|
1
|
+
import { type ReactNode } from "react";
|
|
2
2
|
/** The label column every Inspector row shares, so a control that draws its own header lines up with the rest. */
|
|
3
3
|
export declare const PHI_INSPECTOR_FIELD_LABEL_WIDTH = 140;
|
|
4
|
+
/**
|
|
5
|
+
* The label's share of an Inspector row inside a dialog -- the Overlay a list is edited in: the medium
|
|
6
|
+
* tier of the house Form layout, ten of twenty-four tracks, so a row there splits 10 : 14 as a Form in a
|
|
7
|
+
* one-column dialog does (owner, 2026-11-25). Read from the Form layout rather than restated, so the two
|
|
8
|
+
* cannot drift apart. The narrow Inspector column keeps its fixed `PHI_INSPECTOR_FIELD_LABEL_WIDTH`.
|
|
9
|
+
*/
|
|
10
|
+
export declare const PHI_INSPECTOR_DIALOG_FIELD_LABEL_SHARE: number;
|
|
11
|
+
/**
|
|
12
|
+
* Whether Inspector rows stand in a dialog rather than in the Inspector column. The dialog that holds
|
|
13
|
+
* them says so; a row reads it for its split, and a collection reads it to edit its entries in place
|
|
14
|
+
* instead of opening a second dialog over the first.
|
|
15
|
+
*/
|
|
16
|
+
export declare const PhiInspectorDialogContext: import("react").Context<boolean>;
|
|
4
17
|
export declare function PhiInspectorFieldRow({ label, children, labelWidth, }: {
|
|
5
18
|
label: ReactNode;
|
|
6
19
|
children: ReactNode;
|