@phis/ui 0.7.1 → 0.7.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/cms/phi-cms-layout-renderer.d.ts +1 -0
- package/components/cms/phi-cms-layout-renderer.js +35 -6
- package/components/controls/phi-collection-reorder-context.d.ts +21 -0
- package/components/controls/phi-collection-reorder-context.js +6 -0
- package/components/controls/phi-collection-sortable-layout-control.d.ts +17 -0
- package/components/controls/phi-collection-sortable-layout-control.js +72 -0
- package/components/controls/phi-collection-view-control.d.ts +1 -1
- package/components/controls/phi-collection-view-control.js +15 -1
- package/components/controls/phi-media-asset-tile-control.d.ts +12 -5
- package/components/controls/phi-media-picker-control.d.ts +14 -1
- package/components/controls/phi-media-picker-control.js +11 -2
- 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/forms/compound-form-controls.d.ts +1 -1
- package/components/forms/compound-form-controls.js +6 -4
- package/components/forms/form-field-labels.d.ts +3 -1
- package/components/forms/form-field-labels.js +19 -6
- package/components/forms/form-provider-contract.js +2 -1
- package/components/forms/media-asset-field-keys.d.ts +4 -1
- package/components/forms/media-asset-field-keys.js +4 -1
- package/components/forms/table-field-keys.d.ts +8 -0
- package/components/forms/table-field-keys.js +8 -0
- package/components/forms/table-field-labels.d.ts +16 -0
- package/components/forms/table-field-labels.js +16 -0
- package/components/forms/table-field-text.d.ts +9 -0
- package/components/forms/table-field-text.js +20 -0
- package/components/forms/upload-field-refusal-labels.d.ts +10 -0
- package/components/forms/upload-field-refusal-labels.js +24 -0
- package/components/forms/upload-form-control.js +3 -16
- 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 +42 -0
- package/components/media/media-upload-flow.js +120 -4
- package/components/media/media-upload-refusals.js +5 -2
- package/components/media/phi-area-upload-widget.js +4 -0
- package/components/media/phi-media-picker-binding.d.ts +48 -1
- package/components/media/phi-media-picker-binding.js +99 -6
- package/components/media/phi-media-upload.d.ts +7 -1
- package/components/media/phi-media-upload.js +17 -5
- package/components/widgets/client/shared/phi-collection-reorder.d.ts +45 -0
- package/components/widgets/client/shared/phi-collection-reorder.js +110 -0
- package/components/widgets/client/shared/phi-collection-view-binding.js +2 -1
- 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/collection-view.d.ts +4 -0
- package/components/widgets/label-sets/collection-view.js +16 -0
- package/components/widgets/label-sets/color-picker.js +2 -0
- package/components/widgets/label-sets/table.d.ts +6 -0
- package/components/widgets/label-sets/table.js +10 -0
- package/components/widgets/label-types/collection-view.d.ts +8 -0
- package/components/widgets/label-types/collection-view.js +4 -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 +1 -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/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 +8 -0
- package/plugins/runtime-modules/asset/form-providers.d.ts +8 -0
- package/plugins/runtime-modules/asset/form-providers.js +6 -0
- package/plugins/runtime-modules/asset/media-asset-field.d.ts +34 -4
- package/plugins/runtime-modules/asset/media-asset-field.js +50 -3
- package/plugins/runtime-modules/asset/media-asset-form-control.d.ts +13 -0
- package/plugins/runtime-modules/asset/media-asset-form-control.js +81 -5
- 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/page-meta-form.js +6 -6
- 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/collection-view/client.d.ts +5 -0
- package/plugins/runtime-modules/core/widgets/collection-view/client.js +50 -4
- package/plugins/runtime-modules/core/widgets/collection-view/config.d.ts +28 -2
- package/plugins/runtime-modules/core/widgets/collection-view/config.js +13 -0
- package/plugins/runtime-modules/core/widgets/collection-view/plugin.js +1 -1
- package/plugins/runtime-modules/core/widgets/collection-view/server.d.ts +4 -1
- package/plugins/runtime-modules/core/widgets/collection-view/server.js +19 -4
- 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/server-helpers/cms-node-record.d.ts +18 -0
- package/server-helpers/cms-node-record.js +28 -0
- package/types/cms-plugins.d.ts +6 -0
- package/types/collection-provider.d.ts +7 -0
- package/types/collection-view-widget.d.ts +11 -0
- package/types/core-widget-placements.d.ts +11 -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
|
@@ -54,6 +54,7 @@ import { isPhiRecord } from "../../../../../helpers/is-record";
|
|
|
54
54
|
*/
|
|
55
55
|
const PHI_TABLE_VISUAL_ANCHOR_PARTS = ["filters", "toolbar", "header", "row-actions", "footer", "pagination"];
|
|
56
56
|
const PHI_TABLE_ACTION_BUTTON_STYLE = { whiteSpace: "nowrap" };
|
|
57
|
+
const PHI_TABLE_ACTION_CLICK_GUARD_STYLE = { display: "inline-flex" };
|
|
57
58
|
function formatTableActionTemplate(value, templateValue) {
|
|
58
59
|
return value && templateValue != null ? formatPhiTableWidgetLabel(value, templateValue) : value;
|
|
59
60
|
}
|
|
@@ -945,8 +946,14 @@ function TableAction({ action, disabled = false, disabledReason, templateValue,
|
|
|
945
946
|
* A row is clickable, and an action inside it must not also activate the row, so the click stops at
|
|
946
947
|
* the element around the button. A confirmed action still gets a handler of its own: the button is
|
|
947
948
|
* what opens the confirmation, and a button with nothing to call renders disabled.
|
|
949
|
+
*
|
|
950
|
+
* The element around it is exactly the button's box (`inline-flex`). As a block it was a line of the
|
|
951
|
+
* surrounding text tall, and the button sat on that line's baseline: where the line was taller than
|
|
952
|
+
* the button -- a Table in a Collapsible, whose panel sets a line height of 1.5 -- a toolbar action
|
|
953
|
+
* stood lower than the Reload beside it, which has no such element. It keeps a box of its own because
|
|
954
|
+
* a confirmation opens against it.
|
|
948
955
|
*/
|
|
949
|
-
const content = (_jsx("span", { onClick: (event) => event.stopPropagation(), children: _jsx(PhiButtonControl, { size: size, type: buttonType, danger: danger, disabled: disabled, style: PHI_TABLE_ACTION_BUTTON_STYLE, icon: showIcon ? icon ?? undefined : undefined, ariaLabel: action.label, label: showLabel ? action.label : null, tooltip: disabledReason ?? (display === "icon" ? action.label : undefined), onClick: () => {
|
|
956
|
+
const content = (_jsx("span", { style: PHI_TABLE_ACTION_CLICK_GUARD_STYLE, onClick: (event) => event.stopPropagation(), children: _jsx(PhiButtonControl, { size: size, type: buttonType, danger: danger, disabled: disabled, style: PHI_TABLE_ACTION_BUTTON_STYLE, icon: showIcon ? icon ?? undefined : undefined, ariaLabel: action.label, label: showLabel ? action.label : null, tooltip: disabledReason ?? (display === "icon" ? action.label : undefined), onClick: () => {
|
|
950
957
|
if (!action.confirm)
|
|
951
958
|
onActivate();
|
|
952
959
|
} }) }));
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
import "server-only";
|
|
2
|
+
import type { PhiBlockRuntime } from "../types";
|
|
3
|
+
import type { PhiCmsRuntimeRenderRegistry } from "../types/cms-plugins";
|
|
4
|
+
import type { PhiResolvedCmsRenderableTree } from "../types/cms";
|
|
5
|
+
/**
|
|
6
|
+
* The fields of the record this Page is about, as a `record` condition reads them, or null where it reads
|
|
7
|
+
* none.
|
|
8
|
+
*
|
|
9
|
+
* Read only for a tree that carries such a condition, and through the same request-memoised read the
|
|
10
|
+
* Widgets bound to the record use (`resolvePhiPageRecordFields`), so a page whose Widgets read the fields
|
|
11
|
+
* already pays nothing more for its conditions. Each field is its value, under its key: `icon` is the
|
|
12
|
+
* picture a Widget with `recordField: "icon"` draws, and a field the record lacks is not there.
|
|
13
|
+
*
|
|
14
|
+
* `null` is a Page that is about no record (`none`). A record whose fields could not be read is a record
|
|
15
|
+
* without any of them -- the bound Widgets draw nothing for it either -- so its conditions are answered
|
|
16
|
+
* against no fields rather than taken for a Page about nothing.
|
|
17
|
+
*/
|
|
18
|
+
export declare function resolvePhiCmsTreeRecordConditionFields(tree: Pick<PhiResolvedCmsRenderableTree, "layoutNodes" | "contentWidgets" | "overlays">, registry: Pick<PhiCmsRuntimeRenderRegistry, "recordProviderLoadersByKey" | "recordFieldsLoadersByKey" | "recordDeclarationsByKey">, runtime: PhiBlockRuntime): Promise<Readonly<Record<string, unknown>> | null>;
|
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
import "server-only";
|
|
2
|
+
import { readPhiCmsNodeVisibleWhen, readsPhiCmsNodeRecord } from "../helpers/cms-node-visibility";
|
|
3
|
+
import { resolvePhiPageRecordFields } from "./record-fields";
|
|
4
|
+
/**
|
|
5
|
+
* The fields of the record this Page is about, as a `record` condition reads them, or null where it reads
|
|
6
|
+
* none.
|
|
7
|
+
*
|
|
8
|
+
* Read only for a tree that carries such a condition, and through the same request-memoised read the
|
|
9
|
+
* Widgets bound to the record use (`resolvePhiPageRecordFields`), so a page whose Widgets read the fields
|
|
10
|
+
* already pays nothing more for its conditions. Each field is its value, under its key: `icon` is the
|
|
11
|
+
* picture a Widget with `recordField: "icon"` draws, and a field the record lacks is not there.
|
|
12
|
+
*
|
|
13
|
+
* `null` is a Page that is about no record (`none`). A record whose fields could not be read is a record
|
|
14
|
+
* without any of them -- the bound Widgets draw nothing for it either -- so its conditions are answered
|
|
15
|
+
* against no fields rather than taken for a Page about nothing.
|
|
16
|
+
*/
|
|
17
|
+
export async function resolvePhiCmsTreeRecordConditionFields(tree, registry, runtime) {
|
|
18
|
+
const asks = [...tree.overlays, ...tree.layoutNodes, ...tree.contentWidgets]
|
|
19
|
+
.some((node) => readsPhiCmsNodeRecord(readPhiCmsNodeVisibleWhen(node.config)));
|
|
20
|
+
if (!asks)
|
|
21
|
+
return null;
|
|
22
|
+
const result = await resolvePhiPageRecordFields({ registry, runtime });
|
|
23
|
+
if (result.status === "none")
|
|
24
|
+
return null;
|
|
25
|
+
if (result.status !== "ok")
|
|
26
|
+
return {};
|
|
27
|
+
return Object.fromEntries([...result.fields].map(([key, field]) => [key, field.value]));
|
|
28
|
+
}
|
package/types/cms-plugins.d.ts
CHANGED
|
@@ -368,6 +368,12 @@ export type PhiCmsWidgetContentBinding = {
|
|
|
368
368
|
field: string;
|
|
369
369
|
value: string | number | boolean | null;
|
|
370
370
|
};
|
|
371
|
+
/**
|
|
372
|
+
* The config field (a `record-field` field) that names a field of the page record in the content's
|
|
373
|
+
* place. On a Page about a record a Widget that names one shows that field, or nothing where the record
|
|
374
|
+
* lacks it, so it keeps no content of its own there and is never left out as unpublished.
|
|
375
|
+
*/
|
|
376
|
+
recordField?: string;
|
|
371
377
|
};
|
|
372
378
|
export type PhiCmsWidgetPluginRenderArgs<TConfig> = {
|
|
373
379
|
widget: PhiCmsContentWidgetNode;
|
|
@@ -96,6 +96,13 @@ export type PhiCollectionProviderActionRequest = {
|
|
|
96
96
|
itemKey?: string | number | null;
|
|
97
97
|
item?: Record<string, unknown> | null;
|
|
98
98
|
selectedItemKeys?: (string | number)[];
|
|
99
|
+
/**
|
|
100
|
+
* Every item key of the collection, in the order a reader dragged them into (`collection-view`'s
|
|
101
|
+
* `features.reorder`): the whole collection, never a page of it or a search's share. Sent with the
|
|
102
|
+
* reorder action's key; the Provider stores the order or refuses, and answers the collection as it
|
|
103
|
+
* now stands.
|
|
104
|
+
*/
|
|
105
|
+
itemKeys?: (string | number)[];
|
|
99
106
|
query?: PhiCollectionProviderQuery;
|
|
100
107
|
params?: Record<string, unknown>;
|
|
101
108
|
signal: AbortSignal;
|
|
@@ -41,6 +41,17 @@ export type PhiCmsCollectionViewWidgetConfig = PhiCmsWidgetConfigBase & {
|
|
|
41
41
|
actions?: {
|
|
42
42
|
toolbar?: PhiCmsCollectionToolbarActionPresentation[];
|
|
43
43
|
};
|
|
44
|
+
/**
|
|
45
|
+
* Drag reordering of the items, written back through the bound Provider's action `actionKey`
|
|
46
|
+
* (`"reorder"` by default) with every item key in the new order (`itemKeys`). The Widget stores no
|
|
47
|
+
* order: the Provider's is the order, applied at once on a drop and taken back if refused. Offered
|
|
48
|
+
* in `grid` and `stack` only, and only while the whole collection is shown -- no search text, no
|
|
49
|
+
* filter set apart from the Widget's own initial query, everything on one page.
|
|
50
|
+
*/
|
|
51
|
+
reorder?: {
|
|
52
|
+
enabled: boolean;
|
|
53
|
+
actionKey?: string;
|
|
54
|
+
};
|
|
44
55
|
pagination?: {
|
|
45
56
|
enabled: boolean;
|
|
46
57
|
pageSize?: number;
|
|
@@ -384,6 +384,11 @@ export type PhiCollectionViewWidgetPlacement = PhiWidgetPlacementBase & {
|
|
|
384
384
|
actions?: {
|
|
385
385
|
toolbar?: PhiCmsCollectionToolbarActionPresentation[];
|
|
386
386
|
};
|
|
387
|
+
/** Drag reordering through the bound Provider's action (`PhiCmsCollectionViewWidgetConfig`). */
|
|
388
|
+
reorder?: {
|
|
389
|
+
enabled: boolean;
|
|
390
|
+
actionKey?: string;
|
|
391
|
+
};
|
|
387
392
|
pagination?: {
|
|
388
393
|
enabled: boolean;
|
|
389
394
|
pageSize?: number;
|
|
@@ -414,6 +419,12 @@ export type PhiCommandButtonConfig = PhiControlBadgeConfig & {
|
|
|
414
419
|
label?: string;
|
|
415
420
|
tooltip?: string;
|
|
416
421
|
icon?: string;
|
|
422
|
+
/**
|
|
423
|
+
* The icon's colour, as the colour field stores it -- a Theme role (primary, success, warning, error,
|
|
424
|
+
* info, the text colours) or a colour of the Site's. Absent, the button's own. The button around it
|
|
425
|
+
* keeps its look: Danger and the variant still answer for the frame and the words.
|
|
426
|
+
*/
|
|
427
|
+
iconColor?: string;
|
|
417
428
|
display?: "icon" | "label" | "icon-label";
|
|
418
429
|
danger?: boolean;
|
|
419
430
|
disabled?: boolean;
|
|
@@ -1,6 +0,0 @@
|
|
|
1
|
-
import type { PhiResolvedCmsPageTree, PhiCmsPageNode } from "../../../../types/cms";
|
|
2
|
-
import type { PhiBlockRuntime } from "../../../../types";
|
|
3
|
-
export declare function buildPhiDefaultAccountingPageTree({ page, }: {
|
|
4
|
-
page: PhiCmsPageNode;
|
|
5
|
-
runtime: PhiBlockRuntime;
|
|
6
|
-
}): Promise<PhiResolvedCmsPageTree>;
|
|
@@ -1,49 +0,0 @@
|
|
|
1
|
-
import { PHI_TEXT_SOURCE_PRESET } from "../../../../helpers/text-source";
|
|
2
|
-
import { createPhiPresetCmsInstanceIdMap } from "../../../../types/cms-instance-id";
|
|
3
|
-
import { PHI_SURFACE_CARD } from "../../../../helpers/surface-presets";
|
|
4
|
-
import { PHI_ACCOUNTING_RUNTIME_MODULE_ID } from "../ids";
|
|
5
|
-
import { PHI_CMS_SEQUENTIAL_LAYOUT_SLOTS } from "../../../../constants/cms-layout-types";
|
|
6
|
-
import { PhiCmsPageType } from "../../../../constants/phi-cms";
|
|
7
|
-
import { createPhiCmsPresetNodes } from "../../../../helpers/cms-preset-nodes";
|
|
8
|
-
import { buildPhiBasePageContentScaffold, PHI_BASE_PAGE_LAYOUT_NODE_ID } from "../../../../components/regions/presets/phi-base-page-layout";
|
|
9
|
-
const SYNTHETIC_ACCOUNTING_REGION_IDS = {
|
|
10
|
-
regionContent: -451,
|
|
11
|
-
};
|
|
12
|
-
const SYNTHETIC_ACCOUNTING_WIDGET_IDS = createPhiPresetCmsInstanceIdMap({
|
|
13
|
-
domain: "page",
|
|
14
|
-
ownerModuleId: PHI_ACCOUNTING_RUNTIME_MODULE_ID,
|
|
15
|
-
presetKey: "accounting-overview-page",
|
|
16
|
-
}, [
|
|
17
|
-
"widgetOverview",
|
|
18
|
-
]);
|
|
19
|
-
export async function buildPhiDefaultAccountingPageTree({ page, }) {
|
|
20
|
-
const scaffold = buildPhiBasePageContentScaffold({
|
|
21
|
-
page,
|
|
22
|
-
regionId: SYNTHETIC_ACCOUNTING_REGION_IDS.regionContent,
|
|
23
|
-
});
|
|
24
|
-
const nodes = createPhiCmsPresetNodes(page);
|
|
25
|
-
return {
|
|
26
|
-
page: nodes.page({ pageType: PhiCmsPageType.Standard }),
|
|
27
|
-
overlays: [],
|
|
28
|
-
regions: [scaffold.region],
|
|
29
|
-
layoutNodes: [scaffold.layoutNode],
|
|
30
|
-
contentWidgets: [
|
|
31
|
-
nodes.widget({
|
|
32
|
-
id: SYNTHETIC_ACCOUNTING_WIDGET_IDS.widgetOverview,
|
|
33
|
-
parentLayoutNodeId: PHI_BASE_PAGE_LAYOUT_NODE_ID,
|
|
34
|
-
typeKey: "card",
|
|
35
|
-
slotIndex: PHI_CMS_SEQUENTIAL_LAYOUT_SLOTS[0].slotIndex,
|
|
36
|
-
sortOrder: 0,
|
|
37
|
-
label: "Accounting",
|
|
38
|
-
config: {
|
|
39
|
-
eyebrow: "Accounting",
|
|
40
|
-
textSource: PHI_TEXT_SOURCE_PRESET,
|
|
41
|
-
title: "Accounting",
|
|
42
|
-
description: "Invoices and billing workflows for this site.",
|
|
43
|
-
variant: "compact",
|
|
44
|
-
surface: PHI_SURFACE_CARD,
|
|
45
|
-
},
|
|
46
|
-
}),
|
|
47
|
-
],
|
|
48
|
-
};
|
|
49
|
-
}
|