@phis/ui 0.7.0 → 0.7.2
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-layout-renderer.d.ts +1 -0
- package/components/cms/phi-cms-layout-renderer.js +35 -6
- package/components/controls/use-phi-color-control-presets.d.ts +2 -2
- package/components/controls/use-phi-color-control-presets.js +16 -2
- package/components/layouts/clients/phi-flex-layout-client.js +12 -2
- package/components/media/media-folder-name-path.d.ts +17 -0
- package/components/media/media-folder-name-path.js +36 -0
- package/components/media/media-upload-flow.d.ts +30 -0
- package/components/media/media-upload-flow.js +104 -4
- package/components/media/media-upload-refusals.js +5 -2
- package/components/media/phi-area-upload-widget.js +4 -0
- package/components/widgets/client/shared/phi-command-buttons.d.ts +12 -0
- package/components/widgets/client/shared/phi-command-buttons.js +23 -3
- package/components/widgets/config/command-buttons.js +3 -0
- package/components/widgets/label-sets/color-picker.js +2 -0
- package/components/widgets/label-types/color-picker.d.ts +1 -0
- package/components/widgets/label-types/color-picker.js +1 -0
- package/controls.d.ts +45 -1
- package/controls.js +30 -1
- package/helpers/cms-content-binding.d.ts +7 -1
- package/helpers/cms-content-binding.js +10 -2
- package/helpers/cms-node-visibility.d.ts +25 -0
- package/helpers/cms-node-visibility.js +35 -1
- package/media.d.ts +2 -0
- package/media.js +2 -0
- package/package.json +2 -2
- package/plugins/runtime-modules/accounting/definition.js +1 -1
- package/plugins/runtime-modules/accounting/presets.js +5 -12
- package/plugins/runtime-modules/area-definitions.d.ts +9 -39
- package/plugins/runtime-modules/area-definitions.js +8 -8
- package/plugins/runtime-modules/asset/controller/runtime.js +1 -6
- package/plugins/runtime-modules/asset/definition.d.ts +1 -1
- package/plugins/runtime-modules/asset/definition.js +2 -1
- package/plugins/runtime-modules/asset/widgets/area-upload/config.js +7 -1
- package/plugins/runtime-modules/builder/data-providers.js +1 -0
- package/plugins/runtime-modules/builder/services/runtime-modules-table.d.ts +1 -0
- package/plugins/runtime-modules/builder/services/runtime-modules-table.js +4 -0
- package/plugins/runtime-modules/builder/trees/phi-default-builder-area-preset-tree.js +6 -5
- package/plugins/runtime-modules/core/widgets/image/config.d.ts +1 -0
- package/plugins/runtime-modules/core/widgets/image/config.js +1 -0
- package/plugins/runtime-modules/core/widgets/markdown/config.d.ts +1 -1
- package/plugins/runtime-modules/core/widgets/markdown/config.js +1 -0
- package/plugins/runtime-modules/core/widgets/markdown/plugin.js +0 -1
- package/plugins/runtime-modules/core/widgets/simple-text/config.d.ts +1 -0
- package/plugins/runtime-modules/core/widgets/simple-text/config.js +1 -0
- package/plugins/runtime-modules/core/widgets/table/client.js +8 -1
- package/plugins/runtime-modules/theme/widgets/brand-controls/client.js +2 -1
- package/server-helpers/cms-node-record.d.ts +18 -0
- package/server-helpers/cms-node-record.js +28 -0
- package/server-helpers/search-index.js +7 -1
- package/types/cms-plugins.d.ts +6 -0
- package/types/core-widget-placements.d.ts +6 -0
- package/plugins/runtime-modules/accounting/trees/phi-default-accounting-page-tree.d.ts +0 -6
- package/plugins/runtime-modules/accounting/trees/phi-default-accounting-page-tree.js +0 -49
package/controls.d.ts
CHANGED
|
@@ -129,10 +129,54 @@ export { PhiTreeControl, PhiTreeActionButton } from "./components/controls/phi-t
|
|
|
129
129
|
export type { PhiTreeControlDropRequest, PhiTreeControlExternalDropRequest, } from "./components/controls/phi-tree-control";
|
|
130
130
|
export { PhiTreeSelectControl } from "./components/controls/phi-tree-select-control";
|
|
131
131
|
export type { PhiTreeSelectControlProps } from "./components/controls/phi-tree-select-control";
|
|
132
|
-
export { PhiCascaderControl, normalizePhiCascaderValue, } from "./components/controls/phi-cascader-control";
|
|
132
|
+
export { PhiCascaderControl, PhiTreeCascaderControl, normalizePhiCascaderValue, } from "./components/controls/phi-cascader-control";
|
|
133
133
|
export type { PhiCascaderNormalizeMode, PhiCascaderOption, } from "./components/controls/phi-cascader-control";
|
|
134
134
|
export { PhiDimensionControl } from "./components/controls/phi-dimension-control";
|
|
135
135
|
export type { PhiDimensionControlProps } from "./components/controls/phi-dimension-control";
|
|
136
136
|
export { PhiLengthControl } from "./components/controls/phi-length-control";
|
|
137
137
|
export type { PhiLengthControlProps } from "./components/controls/phi-length-control";
|
|
138
138
|
export type { PhiControlOption, PhiControlOptionPreview, PhiControlOptionsProviderConfig, PhiControlOptionsProviderLoadMode, PhiControlOptionsProviderSearchConfig, } from "./components/controls/phi-control-options";
|
|
139
|
+
export { PhiAccordionControl } from "./components/controls/phi-accordion-control";
|
|
140
|
+
export type { PhiAccordionControlProps, PhiAccordionControlSection } from "./components/controls/phi-accordion-control";
|
|
141
|
+
export { PhiAnchorNavControl } from "./components/controls/phi-anchor-nav-control";
|
|
142
|
+
export type { PhiAnchorNavControlItem, PhiAnchorNavControlProps } from "./components/controls/phi-anchor-nav-control";
|
|
143
|
+
export { PhiAvatarControl } from "./components/controls/phi-avatar-control";
|
|
144
|
+
export type { PhiAvatarControlProps } from "./components/controls/phi-avatar-control";
|
|
145
|
+
export { PHI_RADIUS_CONTROL_DEFAULT_LABELS, PhiBoundRadiusControl } from "./components/controls/phi-bound-radius-control";
|
|
146
|
+
export type { PhiBoundRadiusControlProps, PhiBoundRadiusValue, PhiRadiusControlLabels, PhiRadiusOptionValue, } from "./components/controls/phi-bound-radius-control";
|
|
147
|
+
export { PhiBreadcrumbControl } from "./components/controls/phi-breadcrumb-control";
|
|
148
|
+
export type { PhiBreadcrumbControlItem, PhiBreadcrumbControlProps } from "./components/controls/phi-breadcrumb-control";
|
|
149
|
+
export { PhiBulletListControl } from "./components/controls/phi-bullet-list-control";
|
|
150
|
+
export type { PhiBulletListControlProps } from "./components/controls/phi-bullet-list-control";
|
|
151
|
+
export type { PhiBulletListEntryState, PhiBulletListNode } from "./components/widgets/shared/bullet-list-vocabulary";
|
|
152
|
+
export { PhiCollapseControl } from "./components/controls/phi-collapse-control";
|
|
153
|
+
export type { PhiCollapseControlProps, PhiCollapseControlSection } from "./components/controls/phi-collapse-control";
|
|
154
|
+
export { PhiColorFieldControl } from "./components/controls/phi-color-field-control";
|
|
155
|
+
export type { PhiColorFieldControlProps } from "./components/controls/phi-color-field-control";
|
|
156
|
+
export { PhiDescriptionListControl } from "./components/controls/phi-description-list-control";
|
|
157
|
+
export type { PhiDescriptionListControlProps, PhiDescriptionListItem } from "./components/controls/phi-description-list-control";
|
|
158
|
+
export { PhiDividerControl } from "./components/controls/phi-divider-control";
|
|
159
|
+
export type { PhiDividerControlProps } from "./components/controls/phi-divider-control";
|
|
160
|
+
export { PhiMoneyControl } from "./components/controls/phi-money-control";
|
|
161
|
+
export type { PhiMoneyControlProps } from "./components/controls/phi-money-control";
|
|
162
|
+
export { PhiNameControl } from "./components/controls/phi-name-control";
|
|
163
|
+
export type { PhiNameControlProps } from "./components/controls/phi-name-control";
|
|
164
|
+
export { PhiPresetSizeControl } from "./components/controls/phi-preset-size-control";
|
|
165
|
+
export type { PhiPresetSizeControlProps, PhiPresetSizeOption } from "./components/controls/phi-preset-size-control";
|
|
166
|
+
export { PhiProgressControl } from "./components/controls/phi-progress-control";
|
|
167
|
+
export type { PhiProgressControlProps } from "./components/controls/phi-progress-control";
|
|
168
|
+
export { PhiQrCodeControl } from "./components/controls/phi-qr-code-control";
|
|
169
|
+
export type { PhiQrCodeControlProps } from "./components/controls/phi-qr-code-control";
|
|
170
|
+
export { PhiResultControl } from "./components/controls/phi-result-control";
|
|
171
|
+
export type { PhiResultControlProps } from "./components/controls/phi-result-control";
|
|
172
|
+
export { PhiRibbonControl } from "./components/controls/phi-ribbon-control";
|
|
173
|
+
export type { PhiRibbonControlProps } from "./components/controls/phi-ribbon-control";
|
|
174
|
+
export { PhiRibbonWrapControl } from "./components/controls/phi-ribbon-wrap-control";
|
|
175
|
+
export type { PhiRibbonWrapControlProps } from "./components/controls/phi-ribbon-wrap-control";
|
|
176
|
+
export { PhiSeriesChartControl } from "./components/controls/phi-series-chart-control";
|
|
177
|
+
export type { PhiSeriesChartControlProps, PhiSeriesChartControlSeries } from "./components/controls/phi-series-chart-control";
|
|
178
|
+
export { PhiSpinControl } from "./components/controls/phi-spin-control";
|
|
179
|
+
export type { PhiSpinControlProps } from "./components/controls/phi-spin-control";
|
|
180
|
+
export { PhiStatisticControl } from "./components/controls/phi-statistic-control";
|
|
181
|
+
export type { PhiStatisticControlProps } from "./components/controls/phi-statistic-control";
|
|
182
|
+
export { PhiStatusDotControl } from "./components/controls/phi-status-dot-control";
|
package/controls.js
CHANGED
|
@@ -81,6 +81,35 @@ export { PhiTimelineControl } from "./components/controls/phi-timeline-control";
|
|
|
81
81
|
export { PhiTableControl, readPhiTableControlValue } from "./components/controls/phi-table-control";
|
|
82
82
|
export { PhiTreeControl, PhiTreeActionButton } from "./components/controls/phi-tree-control";
|
|
83
83
|
export { PhiTreeSelectControl } from "./components/controls/phi-tree-select-control";
|
|
84
|
-
export { PhiCascaderControl, normalizePhiCascaderValue, } from "./components/controls/phi-cascader-control";
|
|
84
|
+
export { PhiCascaderControl, PhiTreeCascaderControl, normalizePhiCascaderValue, } from "./components/controls/phi-cascader-control";
|
|
85
85
|
export { PhiDimensionControl } from "./components/controls/phi-dimension-control";
|
|
86
86
|
export { PhiLengthControl } from "./components/controls/phi-length-control";
|
|
87
|
+
/*
|
|
88
|
+
* The Controls a Module's own Widget draws with, beside the ones above: lists, figures, outcomes,
|
|
89
|
+
* sections that fold, money, codes and charts, and the labelled colour field. A dialog in code is
|
|
90
|
+
* `PhiDialogControl`; the Modal and Drawer shells under it stay the Overlay container's. A Module draws
|
|
91
|
+
* them rather than Ant Design or bare elements, so they wear the Theme like the house's own. A Widget
|
|
92
|
+
* that only places them on a Page needs none of this: it names the Core Widget in its preset.
|
|
93
|
+
*/
|
|
94
|
+
export { PhiAccordionControl } from "./components/controls/phi-accordion-control";
|
|
95
|
+
export { PhiAnchorNavControl } from "./components/controls/phi-anchor-nav-control";
|
|
96
|
+
export { PhiAvatarControl } from "./components/controls/phi-avatar-control";
|
|
97
|
+
export { PHI_RADIUS_CONTROL_DEFAULT_LABELS, PhiBoundRadiusControl } from "./components/controls/phi-bound-radius-control";
|
|
98
|
+
export { PhiBreadcrumbControl } from "./components/controls/phi-breadcrumb-control";
|
|
99
|
+
export { PhiBulletListControl } from "./components/controls/phi-bullet-list-control";
|
|
100
|
+
export { PhiCollapseControl } from "./components/controls/phi-collapse-control";
|
|
101
|
+
export { PhiColorFieldControl } from "./components/controls/phi-color-field-control";
|
|
102
|
+
export { PhiDescriptionListControl } from "./components/controls/phi-description-list-control";
|
|
103
|
+
export { PhiDividerControl } from "./components/controls/phi-divider-control";
|
|
104
|
+
export { PhiMoneyControl } from "./components/controls/phi-money-control";
|
|
105
|
+
export { PhiNameControl } from "./components/controls/phi-name-control";
|
|
106
|
+
export { PhiPresetSizeControl } from "./components/controls/phi-preset-size-control";
|
|
107
|
+
export { PhiProgressControl } from "./components/controls/phi-progress-control";
|
|
108
|
+
export { PhiQrCodeControl } from "./components/controls/phi-qr-code-control";
|
|
109
|
+
export { PhiResultControl } from "./components/controls/phi-result-control";
|
|
110
|
+
export { PhiRibbonControl } from "./components/controls/phi-ribbon-control";
|
|
111
|
+
export { PhiRibbonWrapControl } from "./components/controls/phi-ribbon-wrap-control";
|
|
112
|
+
export { PhiSeriesChartControl } from "./components/controls/phi-series-chart-control";
|
|
113
|
+
export { PhiSpinControl } from "./components/controls/phi-spin-control";
|
|
114
|
+
export { PhiStatisticControl } from "./components/controls/phi-statistic-control";
|
|
115
|
+
export { PhiStatusDotControl } from "./components/controls/phi-status-dot-control";
|
|
@@ -9,5 +9,11 @@ export declare function resolvePhiCmsWidgetContentBindingForConfig(binding: PhiC
|
|
|
9
9
|
* Whether a bound Widget has nothing to show on the live Site: no published content and no value of its
|
|
10
10
|
* own. That is a Widget the Site created whose content was never published -- the Builder's placeholder
|
|
11
11
|
* is not live until somebody publishes it. A preset node keeps its shipped value and is never empty.
|
|
12
|
+
*
|
|
13
|
+
* A Widget that names a field of the page record (`binding.recordField`) on a Page about a record is
|
|
14
|
+
* not judged: it shows the record's field there, not content of its own, and draws nothing itself where
|
|
15
|
+
* the record lacks the field. Its own content only stands in on a Page about no record, and is judged there.
|
|
12
16
|
*/
|
|
13
|
-
export declare function isPhiCmsWidgetContentUnpublished(binding: PhiCmsWidgetContentBinding | null | undefined, widget: Pick<PhiCmsContentWidgetNode, "config" | "resolvedContent"
|
|
17
|
+
export declare function isPhiCmsWidgetContentUnpublished(binding: PhiCmsWidgetContentBinding | null | undefined, widget: Pick<PhiCmsContentWidgetNode, "config" | "resolvedContent">, page: {
|
|
18
|
+
aboutRecord: boolean;
|
|
19
|
+
}): boolean;
|
|
@@ -25,8 +25,16 @@ export function resolvePhiCmsWidgetContentBindingForConfig(binding, config) {
|
|
|
25
25
|
* Whether a bound Widget has nothing to show on the live Site: no published content and no value of its
|
|
26
26
|
* own. That is a Widget the Site created whose content was never published -- the Builder's placeholder
|
|
27
27
|
* is not live until somebody publishes it. A preset node keeps its shipped value and is never empty.
|
|
28
|
+
*
|
|
29
|
+
* A Widget that names a field of the page record (`binding.recordField`) on a Page about a record is
|
|
30
|
+
* not judged: it shows the record's field there, not content of its own, and draws nothing itself where
|
|
31
|
+
* the record lacks the field. Its own content only stands in on a Page about no record, and is judged there.
|
|
28
32
|
*/
|
|
29
|
-
export function isPhiCmsWidgetContentUnpublished(binding, widget) {
|
|
33
|
+
export function isPhiCmsWidgetContentUnpublished(binding, widget, page) {
|
|
30
34
|
const applied = resolvePhiCmsWidgetContentBindingForConfig(binding, widget.config);
|
|
31
|
-
|
|
35
|
+
if (applied == null)
|
|
36
|
+
return false;
|
|
37
|
+
if (page.aboutRecord && applied.recordField && hasConfigValue(widget.config, applied.recordField))
|
|
38
|
+
return false;
|
|
39
|
+
return widget.resolvedContent == null && !hasConfigValue(widget.config, applied.sourceField);
|
|
32
40
|
}
|
|
@@ -25,5 +25,30 @@ export declare function collectPhiCmsNodeFeatureNamespaces(visibleWhen: PhiRunti
|
|
|
25
25
|
* wrongly on the server.
|
|
26
26
|
*/
|
|
27
27
|
export declare function readPhiCmsServerPageConditionState(runtime: Pick<PhiBlockRuntime, "page" | "request">): PhiRuntimePageConditionState | null;
|
|
28
|
+
/** Whether a condition reads the record the Page is about, which only the server can answer. */
|
|
29
|
+
export declare function readsPhiCmsNodeRecord(visibleWhen: PhiRuntimeConditionExpression | null): boolean;
|
|
30
|
+
/**
|
|
31
|
+
* What a `record` condition is judged against in one render.
|
|
32
|
+
*
|
|
33
|
+
* `fields` is the record the Page is about, each field as the value it has -- the same fields, by the same
|
|
34
|
+
* keys, a Widget's `recordField` reads -- or null on a Page that is about no record. `live` is whether the
|
|
35
|
+
* node renders for the live Site: there, a node that asks about a record that is not there stays away.
|
|
36
|
+
* In the Builder it is drawn, because a template open without a record is still to be edited, and its
|
|
37
|
+
* bound Widgets show their own content in the record's place.
|
|
38
|
+
*/
|
|
39
|
+
export type PhiCmsNodeRecordConditionState = {
|
|
40
|
+
fields: Readonly<Record<string, unknown>> | null;
|
|
41
|
+
live: boolean;
|
|
42
|
+
};
|
|
43
|
+
/**
|
|
44
|
+
* A node's condition with every `record` part answered, before anything else of it is.
|
|
45
|
+
*
|
|
46
|
+
* `false` is a condition that cannot hold whatever the rest of it says, `null` one that holds whatever
|
|
47
|
+
* the rest says (or no condition at all), and an expression is what is left to answer -- the parts that
|
|
48
|
+
* do not read the record, as `resolvePhiCmsNodeVisibility` and, where it has to, the gate take them.
|
|
49
|
+
* The record is answered here and taken out, not handed on: the gate runs in the browser, which never
|
|
50
|
+
* sees the record, so a part about it would leave the node waiting for an answer nobody can give.
|
|
51
|
+
*/
|
|
52
|
+
export declare function settlePhiCmsNodeRecordConditions(visibleWhen: PhiRuntimeConditionExpression | null, record: PhiCmsNodeRecordConditionState): PhiRuntimeConditionExpression | null | false;
|
|
28
53
|
export type PhiCmsNodeVisibility = "render" | "omit" | "gate";
|
|
29
54
|
export declare function resolvePhiCmsNodeVisibility(visibleWhen: PhiRuntimeConditionExpression | null, page: PhiRuntimePageConditionState | null, features?: PhiRuntimeFeatureState | null): PhiCmsNodeVisibility;
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { collectPhiRuntimeValueConditions, evaluatePhiRuntimeConditionExpression, readPhiRuntimeConditionExpression, } from "../types/runtime-condition";
|
|
1
|
+
import { collectPhiRuntimeValueConditions, evaluatePhiRuntimeConditionExpression, matchesPhiRuntimeValueCondition, readPhiRuntimeConditionExpression, } from "../types/runtime-condition";
|
|
2
2
|
/**
|
|
3
3
|
* Whether a node appears at all, read from the node's own config rather than the Widget's.
|
|
4
4
|
*
|
|
@@ -48,6 +48,40 @@ export function readPhiCmsServerPageConditionState(runtime) {
|
|
|
48
48
|
}
|
|
49
49
|
return { path: runtime.page?.path ?? "", query };
|
|
50
50
|
}
|
|
51
|
+
/** Whether a condition reads the record the Page is about, which only the server can answer. */
|
|
52
|
+
export function readsPhiCmsNodeRecord(visibleWhen) {
|
|
53
|
+
return collectPhiRuntimeValueConditions(visibleWhen).some((condition) => condition.source === "record");
|
|
54
|
+
}
|
|
55
|
+
/**
|
|
56
|
+
* A node's condition with every `record` part answered, before anything else of it is.
|
|
57
|
+
*
|
|
58
|
+
* `false` is a condition that cannot hold whatever the rest of it says, `null` one that holds whatever
|
|
59
|
+
* the rest says (or no condition at all), and an expression is what is left to answer -- the parts that
|
|
60
|
+
* do not read the record, as `resolvePhiCmsNodeVisibility` and, where it has to, the gate take them.
|
|
61
|
+
* The record is answered here and taken out, not handed on: the gate runs in the browser, which never
|
|
62
|
+
* sees the record, so a part about it would leave the node waiting for an answer nobody can give.
|
|
63
|
+
*/
|
|
64
|
+
export function settlePhiCmsNodeRecordConditions(visibleWhen, record) {
|
|
65
|
+
if (!visibleWhen || !readsPhiCmsNodeRecord(visibleWhen))
|
|
66
|
+
return visibleWhen;
|
|
67
|
+
if ("source" in visibleWhen) {
|
|
68
|
+
if (record.fields == null)
|
|
69
|
+
return record.live ? false : null;
|
|
70
|
+
return matchesPhiRuntimeValueCondition(visibleWhen, { record: record.fields }) ? null : false;
|
|
71
|
+
}
|
|
72
|
+
const decisive = visibleWhen.match === "all" ? false : null;
|
|
73
|
+
const rest = [];
|
|
74
|
+
for (const condition of visibleWhen.conditions) {
|
|
75
|
+
const settled = settlePhiCmsNodeRecordConditions(condition, record);
|
|
76
|
+
if (settled === decisive)
|
|
77
|
+
return decisive;
|
|
78
|
+
if (settled)
|
|
79
|
+
rest.push(settled);
|
|
80
|
+
}
|
|
81
|
+
if (rest.length === 0)
|
|
82
|
+
return visibleWhen.match === "all" ? null : false;
|
|
83
|
+
return rest.length === 1 ? rest[0] : { match: visibleWhen.match, conditions: rest };
|
|
84
|
+
}
|
|
51
85
|
/**
|
|
52
86
|
* How much of a node's condition this render can settle on its own.
|
|
53
87
|
*
|
package/media.d.ts
CHANGED
|
@@ -9,3 +9,5 @@ export type { PhiAssetFolderControlProps } from "./components/media/phi-asset-fo
|
|
|
9
9
|
export { createDefaultFocalRect, focalRectToMetaValue, focalRectToPercent, normalizeMediaFocalRect, resolveContainedImageBox, resolveFocalRectCoverImageStyle, resolveFocalRectObjectPosition, type MediaFocalRect, } from "./components/media/focal-rect";
|
|
10
10
|
export type { PhiMediaAssetSelection } from "./types/media";
|
|
11
11
|
export { PHI_MEDIA_UPLOAD_FAILURE_REASONS, PhiMediaUploadError, runPhiAddonAssetUpload, type PhiAddonAssetReservation, type PhiMediaUploadFailureReason, type PhiMediaUploadPlan, type PhiMediaUploadProgressHandler, } from "./components/media/media-upload-flow";
|
|
12
|
+
export { PhiLightboxImageControl } from "./components/controls/phi-lightbox-image-control";
|
|
13
|
+
export type { PhiLightboxImageControlProps } from "./components/controls/phi-lightbox-image-control";
|
package/media.js
CHANGED
|
@@ -11,3 +11,5 @@ export { createDefaultFocalRect, focalRectToMetaValue, focalRectToPercent, norma
|
|
|
11
11
|
* answers, and a second implementation of them is a second set of answers that will disagree.
|
|
12
12
|
*/
|
|
13
13
|
export { PHI_MEDIA_UPLOAD_FAILURE_REASONS, PhiMediaUploadError, runPhiAddonAssetUpload, } from "./components/media/media-upload-flow";
|
|
14
|
+
/* An image that opens larger over the page when clicked: the overlay, the zoom and the close. */
|
|
15
|
+
export { PhiLightboxImageControl } from "./components/controls/phi-lightbox-image-control";
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@phis/ui",
|
|
3
|
-
"version": "0.7.
|
|
3
|
+
"version": "0.7.2",
|
|
4
4
|
"license": "Apache-2.0",
|
|
5
5
|
"publishConfig": {
|
|
6
6
|
"access": "public"
|
|
@@ -521,7 +521,7 @@
|
|
|
521
521
|
"@lexical/rich-text": "0.50.0",
|
|
522
522
|
"@lexical/selection": "0.50.0",
|
|
523
523
|
"@lexical/utils": "0.50.0",
|
|
524
|
-
"@phis/contracts": "^0.8.
|
|
524
|
+
"@phis/contracts": "^0.8.1",
|
|
525
525
|
"dayjs": "^1.11.23",
|
|
526
526
|
"dom-serializer": "^2.0.0",
|
|
527
527
|
"htmlparser2": "^10.1.0",
|
|
@@ -5,7 +5,7 @@ export const PHI_ACCOUNTING_RUNTIME_MODULE_DEFINITION = definePhiAreaBaseRuntime
|
|
|
5
5
|
area: "accounting",
|
|
6
6
|
moduleId: PHI_ACCOUNTING_RUNTIME_MODULE_ID,
|
|
7
7
|
serverBinding: PHI_CORE_SERVER_BINDING,
|
|
8
|
-
description: "Locked Accounting Area shell, navigation surface, and
|
|
8
|
+
description: "Locked Accounting Area shell, navigation surface, and root route.",
|
|
9
9
|
category: "foundation",
|
|
10
10
|
icon: "antd:profile",
|
|
11
11
|
});
|
|
@@ -1,9 +1,12 @@
|
|
|
1
|
-
import { PHI_BASE_PAGE_LAYOUT_VERSION } from "../../../components/regions/presets/phi-base-page-layout";
|
|
2
1
|
import { buildPhiAreaRootRoutePresetDescriptor } from "../area-root-route";
|
|
3
2
|
import { PhiCmsRegionType } from "../../../constants/phi-cms";
|
|
4
3
|
import { PHI_DEFAULT_PUB_AREA_COMPOSITION_NODE_KEYS } from "../preset-contracts/pub-area";
|
|
5
4
|
import { PHI_ACCOUNTING_RUNTIME_MODULE_ID } from "./ids";
|
|
6
|
-
/*
|
|
5
|
+
/*
|
|
6
|
+
* What the Accounting base Module brings: the Site shell for its Area and the Area root. No Page of its
|
|
7
|
+
* own -- the Dashboard Module's entry stands first in the sidebar, so the root lands there, and every other
|
|
8
|
+
* Accounting Page is a Module's.
|
|
9
|
+
*/
|
|
7
10
|
export const PHI_ACCOUNTING_RUNTIME_MODULE_AREA_SHELLS = [
|
|
8
11
|
{
|
|
9
12
|
ownerModuleId: PHI_ACCOUNTING_RUNTIME_MODULE_ID,
|
|
@@ -41,14 +44,4 @@ export const PHI_ACCOUNTING_RUNTIME_MODULE_ROUTES = [
|
|
|
41
44
|
area: "accounting",
|
|
42
45
|
title: "Accounting",
|
|
43
46
|
}),
|
|
44
|
-
{
|
|
45
|
-
ownerModuleId: PHI_ACCOUNTING_RUNTIME_MODULE_ID,
|
|
46
|
-
presetKey: "accounting-overview-page",
|
|
47
|
-
presetVersion: 1 + PHI_BASE_PAGE_LAYOUT_VERSION,
|
|
48
|
-
area: "accounting",
|
|
49
|
-
title: "Overview",
|
|
50
|
-
path: "/overview",
|
|
51
|
-
loadTree: ({ page, runtime }) => import("./trees/phi-default-accounting-page-tree")
|
|
52
|
-
.then((module) => module.buildPhiDefaultAccountingPageTree({ page, runtime })),
|
|
53
|
-
},
|
|
54
47
|
];
|
|
@@ -117,16 +117,7 @@ export declare const PHI_ACCOUNTING_RUNTIME_AREA_DEFINITIONS: {
|
|
|
117
117
|
label: {
|
|
118
118
|
defaultMessage: string;
|
|
119
119
|
};
|
|
120
|
-
items:
|
|
121
|
-
itemKey: string;
|
|
122
|
-
label: {
|
|
123
|
-
defaultMessage: string;
|
|
124
|
-
};
|
|
125
|
-
icon: string;
|
|
126
|
-
routePresetKey: string;
|
|
127
|
-
standing?: undefined;
|
|
128
|
-
target?: undefined;
|
|
129
|
-
} | {
|
|
120
|
+
items: {
|
|
130
121
|
itemKey: string;
|
|
131
122
|
label: {
|
|
132
123
|
defaultMessage: string;
|
|
@@ -137,9 +128,8 @@ export declare const PHI_ACCOUNTING_RUNTIME_AREA_DEFINITIONS: {
|
|
|
137
128
|
kind: "area";
|
|
138
129
|
area: "admin";
|
|
139
130
|
};
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
exportedItemKeys: string[];
|
|
131
|
+
}[];
|
|
132
|
+
exportedItemKeys: never[];
|
|
143
133
|
anchors: Partial<Record<PhiCmsNavigationAnchor, PhiCmsNavigationAnchorPlacement>>;
|
|
144
134
|
})[];
|
|
145
135
|
}[];
|
|
@@ -331,16 +321,7 @@ export declare const PHI_ALL_RUNTIME_AREA_DEFINITIONS: ({
|
|
|
331
321
|
label: {
|
|
332
322
|
defaultMessage: string;
|
|
333
323
|
};
|
|
334
|
-
items:
|
|
335
|
-
itemKey: string;
|
|
336
|
-
label: {
|
|
337
|
-
defaultMessage: string;
|
|
338
|
-
};
|
|
339
|
-
icon: string;
|
|
340
|
-
routePresetKey: string;
|
|
341
|
-
standing?: undefined;
|
|
342
|
-
target?: undefined;
|
|
343
|
-
} | {
|
|
324
|
+
items: {
|
|
344
325
|
itemKey: string;
|
|
345
326
|
label: {
|
|
346
327
|
defaultMessage: string;
|
|
@@ -351,9 +332,8 @@ export declare const PHI_ALL_RUNTIME_AREA_DEFINITIONS: ({
|
|
|
351
332
|
kind: "area";
|
|
352
333
|
area: "admin";
|
|
353
334
|
};
|
|
354
|
-
|
|
355
|
-
|
|
356
|
-
exportedItemKeys: string[];
|
|
335
|
+
}[];
|
|
336
|
+
exportedItemKeys: never[];
|
|
357
337
|
anchors: Partial<Record<PhiCmsNavigationAnchor, PhiCmsNavigationAnchorPlacement>>;
|
|
358
338
|
})[];
|
|
359
339
|
} | {
|
|
@@ -603,16 +583,7 @@ export declare function resolvePhiRuntimeAreaDefinition(area: PhiCmsAreaDefiniti
|
|
|
603
583
|
label: {
|
|
604
584
|
defaultMessage: string;
|
|
605
585
|
};
|
|
606
|
-
items:
|
|
607
|
-
itemKey: string;
|
|
608
|
-
label: {
|
|
609
|
-
defaultMessage: string;
|
|
610
|
-
};
|
|
611
|
-
icon: string;
|
|
612
|
-
routePresetKey: string;
|
|
613
|
-
standing?: undefined;
|
|
614
|
-
target?: undefined;
|
|
615
|
-
} | {
|
|
586
|
+
items: {
|
|
616
587
|
itemKey: string;
|
|
617
588
|
label: {
|
|
618
589
|
defaultMessage: string;
|
|
@@ -623,9 +594,8 @@ export declare function resolvePhiRuntimeAreaDefinition(area: PhiCmsAreaDefiniti
|
|
|
623
594
|
kind: "area";
|
|
624
595
|
area: "admin";
|
|
625
596
|
};
|
|
626
|
-
|
|
627
|
-
|
|
628
|
-
exportedItemKeys: string[];
|
|
597
|
+
}[];
|
|
598
|
+
exportedItemKeys: never[];
|
|
629
599
|
anchors: Partial<Record<PhiCmsNavigationAnchor, PhiCmsNavigationAnchorPlacement>>;
|
|
630
600
|
})[];
|
|
631
601
|
} | {
|
|
@@ -244,12 +244,11 @@ export const PHI_ACCOUNTING_RUNTIME_AREA_DEFINITIONS = [
|
|
|
244
244
|
navigationSurfaces: [{
|
|
245
245
|
navKey: "accounting:sidebar",
|
|
246
246
|
label: label("Accounting sidebar navigation"),
|
|
247
|
-
|
|
248
|
-
|
|
249
|
-
|
|
250
|
-
|
|
251
|
-
|
|
252
|
-
},
|
|
247
|
+
/*
|
|
248
|
+
* No entry of its own for the Area, as in the App: the root forwards to the first Module entry a
|
|
249
|
+
* viewer can see -- the Dashboard's -- and the Overview that used to stand here was a placeholder.
|
|
250
|
+
*/
|
|
251
|
+
items: [
|
|
253
252
|
// The way into the Admin, as the Builder has one; shown to whoever the Admin lets in.
|
|
254
253
|
{
|
|
255
254
|
itemKey: "@phis/ui/modules/accounting/nav/admin",
|
|
@@ -257,8 +256,9 @@ export const PHI_ACCOUNTING_RUNTIME_AREA_DEFINITIONS = [
|
|
|
257
256
|
icon: "antd:cluster",
|
|
258
257
|
standing: "last",
|
|
259
258
|
target: { kind: "area", area: "admin" },
|
|
260
|
-
}
|
|
261
|
-
|
|
259
|
+
},
|
|
260
|
+
],
|
|
261
|
+
exportedItemKeys: [],
|
|
262
262
|
anchors: sidebarAnchors(),
|
|
263
263
|
}, accountNavigationSurface(PHI_ACCOUNTING_ACCOUNT_NAV_ITEM_KEY, "accounting:account")],
|
|
264
264
|
},
|
|
@@ -9,13 +9,8 @@ import { dispatchPhiSignalCapability, usePhiSignalEmitter, } from "../../../../c
|
|
|
9
9
|
import { PHI_ASSET_CONTROLLER_STORE_KEY, PHI_ASSET_SIGNAL_CHANNELS, } from "../../../../components/media/asset-controller-signals";
|
|
10
10
|
import { normalizeMediaFocalRect } from "../../../../components/media/focal-rect";
|
|
11
11
|
import { buildPhiMediaFolderNamesById, resolvePhiMediaFolderIdFromValue, combinePhiMediaFlagValues, } from "../../../../components/media/media-folder-options";
|
|
12
|
+
import { splitPhiMediaFolderNamePath } from "../../../../components/media/media-folder-name-path";
|
|
12
13
|
const ASSET_FORM_FLAG_VALUES = Object.values(PhiMediaAssetFlags);
|
|
13
|
-
function splitPhiMediaFolderNamePath(value) {
|
|
14
|
-
return (value ?? "")
|
|
15
|
-
.split("/")
|
|
16
|
-
.map((segment) => segment.trim())
|
|
17
|
-
.filter(Boolean);
|
|
18
|
-
}
|
|
19
14
|
function buildPhiMediaFolderNamePath(folders, folderId) {
|
|
20
15
|
const names = buildPhiMediaFolderNamesById(folders, folderId);
|
|
21
16
|
return names.length > 0 ? `/${names.join("/")}` : "";
|
|
@@ -7,7 +7,7 @@ export declare const PHI_ASSET_RUNTIME_MODULE_DEFINITION: {
|
|
|
7
7
|
controller: import("../contracts").PhiRuntimeModuleControllerDescriptor;
|
|
8
8
|
title: string;
|
|
9
9
|
description: string;
|
|
10
|
-
category: "
|
|
10
|
+
category: "foundation";
|
|
11
11
|
iconFamily: string;
|
|
12
12
|
controllerMountPolicy: "demand";
|
|
13
13
|
dataProviders: ({
|
|
@@ -19,7 +19,8 @@ export const PHI_ASSET_RUNTIME_MODULE_DEFINITION = {
|
|
|
19
19
|
controller: buildPhiRuntimeModuleControllerDescriptor(PHI_ASSET_RUNTIME_CONTROLLER_DEFINITION),
|
|
20
20
|
title: "Assets",
|
|
21
21
|
description: "Media, upload, asset picking, and asset-backed data orchestration.",
|
|
22
|
-
|
|
22
|
+
// Listed with Core and the base Modules: it is always active and never selected, like them.
|
|
23
|
+
category: "foundation",
|
|
23
24
|
iconFamily: "media",
|
|
24
25
|
/*
|
|
25
26
|
* On demand, because the Module is active everywhere: a Page that draws no Media mounts nothing for
|
|
@@ -30,7 +30,7 @@ export const PHI_AREA_UPLOAD_WIDGET_DEFINITION = {
|
|
|
30
30
|
kind: "widget",
|
|
31
31
|
pluginKey: resolvePhiCmsWidgetPluginKey("area-upload"),
|
|
32
32
|
typeKey: "area-upload",
|
|
33
|
-
//
|
|
33
|
+
// Without a folderPath an upload goes into the folder the Asset Controller holds, so the Controller is where this is.
|
|
34
34
|
requiredRuntimeControllers: requirePhiAssetController,
|
|
35
35
|
title: "Area Upload",
|
|
36
36
|
description: "Dropzone and temporary upload wall for area-scoped media assets.",
|
|
@@ -42,6 +42,12 @@ export const PHI_AREA_UPLOAD_WIDGET_DEFINITION = {
|
|
|
42
42
|
{ key: "allowDelete", type: "boolean", label: "Allow Delete" },
|
|
43
43
|
{ key: "multiple", type: "boolean", label: "Multiple" },
|
|
44
44
|
{ key: "accept", type: "string", label: "Accept" },
|
|
45
|
+
/*
|
|
46
|
+
* A Folder of the Site Space by its path of names, "Shop Images / Products": every upload goes there,
|
|
47
|
+
* whichever Folder the Controller has open, and the Folders it names that are missing are created on
|
|
48
|
+
* the first upload. A path and not an id, so a preset can state it for every Site; it is resolved
|
|
49
|
+
* when an upload begins (`resolvePhiMediaUploadInitOptions`). Empty: the Controller's Folder.
|
|
50
|
+
*/
|
|
45
51
|
{ key: "folderPath", type: "string", label: "Folder Path" },
|
|
46
52
|
{ key: "presentationFlags", type: "number", label: "Flags", min: 0, precision: 0 },
|
|
47
53
|
],
|
|
@@ -170,6 +170,7 @@ export const PHI_BUILDER_RUNTIME_DATA_PROVIDER_DESCRIPTORS = [
|
|
|
170
170
|
{ key: "description", title: "Description", type: "string" },
|
|
171
171
|
{ key: "category", title: "Category", type: "string" },
|
|
172
172
|
{ key: "isBaseModule", title: "Area Base module", type: "boolean", required: true },
|
|
173
|
+
{ key: "alwaysActive", title: "Always active", type: "boolean", required: true },
|
|
173
174
|
{ key: "baseAreaKey", title: "Base area", type: "string" },
|
|
174
175
|
/*
|
|
175
176
|
* One optional boolean per Area: `true`/`false` is the Module's activation there, absence
|
|
@@ -18,6 +18,7 @@ export declare function buildRuntimeModuleRows(state: PhiDeveloperBuilderWorkspa
|
|
|
18
18
|
description: string;
|
|
19
19
|
category: string;
|
|
20
20
|
isBaseModule: boolean;
|
|
21
|
+
alwaysActive: boolean;
|
|
21
22
|
baseAreaKey: "public" | "app" | "admin" | "builder" | "editor" | "accounting" | null;
|
|
22
23
|
}[];
|
|
23
24
|
/** What the Modules table says when a Module that brings its own shell is switched on over a stored one. */
|
|
@@ -101,6 +101,7 @@ export function buildRuntimeModuleRows(state, categoryLabels, view, serverUnavai
|
|
|
101
101
|
.replaceAll("%1", unavailable.missingCapabilities.join(", ") || unavailable.diagnosticCode),
|
|
102
102
|
category: serverUnavailableLabels?.category ?? "Server part missing",
|
|
103
103
|
isBaseModule: false,
|
|
104
|
+
alwaysActive: false,
|
|
104
105
|
baseAreaKey: null,
|
|
105
106
|
...Object.fromEntries(PHI_CMS_AREA_KEYS.map((areaKey) => [`area_${areaKey}`, null])),
|
|
106
107
|
};
|
|
@@ -121,6 +122,8 @@ export function buildRuntimeModuleRows(state, categoryLabels, view, serverUnavai
|
|
|
121
122
|
description: definition.description,
|
|
122
123
|
category: categoryLabels?.[readPhiRuntimeModuleCategory(definition.category)] ?? definition.category,
|
|
123
124
|
isBaseModule: baseAreaKey != null,
|
|
125
|
+
// Its Area checkboxes hold no choice either: they show where it runs, disabled as a Base module's own Area is.
|
|
126
|
+
alwaysActive: definition.activation === "always",
|
|
124
127
|
baseAreaKey,
|
|
125
128
|
...Object.fromEntries(PHI_CMS_AREA_KEYS.map((areaKey) => [
|
|
126
129
|
`area_${areaKey}`,
|
|
@@ -177,6 +180,7 @@ function buildUnresolvedRuntimeModuleRows(state, view, labels) {
|
|
|
177
180
|
description: labels?.missingHint ?? "Not part of this build. The next save drops it from the Site.",
|
|
178
181
|
category: labels?.missing ?? "Not in this build",
|
|
179
182
|
isBaseModule: false,
|
|
183
|
+
alwaysActive: false,
|
|
180
184
|
baseAreaKey: null,
|
|
181
185
|
...Object.fromEntries(PHI_CMS_AREA_KEYS.map((areaKey) => [
|
|
182
186
|
`area_${areaKey}`,
|
|
@@ -1573,7 +1573,7 @@ async function buildPhiDefaultBuilderPagePresetTemplateTree({ page, runtime, pre
|
|
|
1573
1573
|
* One checkbox column per Area: the switch is the Module everywhere, these are
|
|
1574
1574
|
* the per-Area refinement. A Module not eligible for an Area carries null there
|
|
1575
1575
|
* and the cell renders empty; the Area whose Base module the row is stays
|
|
1576
|
-
* checked and disabled.
|
|
1576
|
+
* checked and disabled, and so does every Area of a Module that is always active.
|
|
1577
1577
|
*/
|
|
1578
1578
|
...PHI_CMS_AREA_KEYS.map((areaKey) => ({
|
|
1579
1579
|
key: `area_${areaKey}`,
|
|
@@ -1583,10 +1583,11 @@ async function buildPhiDefaultBuilderPagePresetTemplateTree({ page, runtime, pre
|
|
|
1583
1583
|
editor: {
|
|
1584
1584
|
control: "checkbox",
|
|
1585
1585
|
disabledWhen: {
|
|
1586
|
-
|
|
1587
|
-
|
|
1588
|
-
|
|
1589
|
-
|
|
1586
|
+
match: "any",
|
|
1587
|
+
conditions: [
|
|
1588
|
+
{ source: "row", valuePath: "baseAreaKey", operator: "equals", value: areaKey },
|
|
1589
|
+
{ source: "row", valuePath: "alwaysActive", operator: "truthy" },
|
|
1590
|
+
],
|
|
1590
1591
|
},
|
|
1591
1592
|
},
|
|
1592
1593
|
})),
|
|
@@ -174,6 +174,7 @@ export const PHI_IMAGE_WIDGET_DEFINITION = {
|
|
|
174
174
|
sourceField: "assetId",
|
|
175
175
|
translatable: true,
|
|
176
176
|
skipWhenConfigFieldValue: { field: "sourceKind", value: "url" },
|
|
177
|
+
recordField: "recordField",
|
|
177
178
|
},
|
|
178
179
|
defaultConfig: normalizePhiImageWidgetConfig(null),
|
|
179
180
|
parseConfig: parsePhiCmsImageWidgetConfig,
|
|
@@ -52,7 +52,6 @@ export type PhiCmsMarkdownWidgetConfig = PhiCmsWidgetConfigBase & {
|
|
|
52
52
|
/** How the text's lists are set. */
|
|
53
53
|
list?: PhiBulletListStyle;
|
|
54
54
|
resolvedContent?: PhiCmsResolvedContent | null;
|
|
55
|
-
preferSource?: boolean;
|
|
56
55
|
};
|
|
57
56
|
export declare function parsePhiCmsMarkdownWidgetConfig(config: Record<string, unknown>): PhiCmsMarkdownWidgetConfig;
|
|
58
57
|
export declare const PHI_MARKDOWN_WIDGET_DEFINITION: {
|
|
@@ -92,6 +91,7 @@ export declare const PHI_MARKDOWN_WIDGET_DEFINITION: {
|
|
|
92
91
|
field: string;
|
|
93
92
|
value: string;
|
|
94
93
|
};
|
|
94
|
+
recordField: string;
|
|
95
95
|
};
|
|
96
96
|
fields: (({
|
|
97
97
|
key: string;
|
|
@@ -43,7 +43,6 @@ export const PHI_MARKDOWN_WIDGET_PLUGIN = {
|
|
|
43
43
|
...config,
|
|
44
44
|
widgetId: widget.id,
|
|
45
45
|
resolvedContent: widget.resolvedContent ?? null,
|
|
46
|
-
preferSource: hasPhiFlag(widget.flags, PhiCmsFlags.NoTranslate),
|
|
47
46
|
translate: !hasPhiFlag(widget.flags, PhiCmsFlags.NoTranslate),
|
|
48
47
|
}, runtime: runtime }, `widget-${widget.id}`));
|
|
49
48
|
},
|