@phis/ui 0.7.3 → 0.7.4
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/controls/phi-media-asset-tile-control.d.ts +4 -3
- package/components/controls/phi-media-picker-control.d.ts +9 -11
- package/components/controls/phi-media-picker-control.js +9 -11
- package/components/forms/form-field-labels.d.ts +3 -3
- package/components/forms/form-field-labels.js +13 -5
- package/components/forms/media-asset-field-keys.d.ts +9 -1
- package/components/forms/media-asset-field-keys.js +13 -1
- package/components/media/label-sets/media.js +4 -0
- package/components/media/media-folder-name-path.d.ts +14 -0
- package/components/media/media-folder-name-path.js +40 -2
- package/components/media/media-library-resource.d.ts +70 -0
- package/components/media/media-library-resource.js +41 -0
- package/components/media/media-widget-labels.d.ts +13 -0
- package/components/media/media-widget-labels.js +2 -0
- package/components/media/phi-area-upload-widget.d.ts +31 -1
- package/components/media/phi-area-upload-widget.js +33 -7
- package/components/media/phi-image-preview-data.d.ts +8 -1
- package/components/media/phi-image-preview-data.js +29 -0
- package/components/media/phi-media-picker-binding.d.ts +22 -20
- package/components/media/phi-media-picker-binding.js +20 -33
- package/components/media/use-media-library-add-picker.d.ts +94 -0
- package/components/media/use-media-library-add-picker.js +40 -0
- package/constants/media-library-provider-keys.d.ts +7 -0
- package/constants/media-library-provider-keys.js +7 -0
- package/constants/runtime-module-ownership.js +1 -0
- package/helpers/preset-tree-contract-check.d.ts +35 -0
- package/helpers/preset-tree-contract-check.js +211 -0
- package/module-page-check.d.ts +6 -0
- package/module-page-check.js +6 -0
- package/package.json +1 -1
- package/plugins/runtime-modules/asset/data-providers.d.ts +56 -38
- package/plugins/runtime-modules/asset/data-providers.js +4 -32
- package/plugins/runtime-modules/asset/definition.d.ts +115 -38
- package/plugins/runtime-modules/asset/definition.js +2 -1
- package/plugins/runtime-modules/asset/form-providers.d.ts +85 -2
- package/plugins/runtime-modules/asset/form-providers.js +70 -11
- package/plugins/runtime-modules/asset/form-ui-provider.js +7 -1
- package/plugins/runtime-modules/asset/media-asset-field.d.ts +7 -7
- package/plugins/runtime-modules/asset/media-asset-field.js +11 -33
- package/plugins/runtime-modules/asset/media-asset-form-control.d.ts +8 -7
- package/plugins/runtime-modules/asset/media-asset-form-control.js +42 -83
- package/plugins/runtime-modules/asset/media-assets-field.d.ts +37 -0
- package/plugins/runtime-modules/asset/media-assets-field.js +81 -0
- package/plugins/runtime-modules/asset/media-assets-form-control.d.ts +27 -0
- package/plugins/runtime-modules/asset/media-assets-form-control.js +182 -0
- package/plugins/runtime-modules/asset/media-field-picker-labels.d.ts +9 -0
- package/plugins/runtime-modules/asset/media-field-picker-labels.js +49 -0
- package/plugins/runtime-modules/asset/services/collection.js +12 -0
- package/plugins/runtime-modules/core/widgets/collection-view/asset-binding-tools.d.ts +24 -0
- package/plugins/runtime-modules/core/widgets/collection-view/asset-binding-tools.js +55 -0
- package/plugins/runtime-modules/core/widgets/collection-view/asset-binding.d.ts +26 -2
- package/plugins/runtime-modules/core/widgets/collection-view/asset-binding.js +125 -32
- package/plugins/runtime-modules/core/widgets/collection-view/client.d.ts +7 -2
- package/plugins/runtime-modules/core/widgets/collection-view/client.js +12 -4
- package/plugins/runtime-modules/core/widgets/collection-view/config.d.ts +25 -0
- package/plugins/runtime-modules/core/widgets/collection-view/config.js +34 -0
- package/plugins/runtime-modules/core/widgets/collection-view/image-preview-grid.js +4 -1
- package/plugins/runtime-modules/core/widgets/collection-view/server.d.ts +3 -2
- package/plugins/runtime-modules/core/widgets/collection-view/server.js +20 -18
- package/plugins/runtime-modules/descriptor-compiler.d.ts +4 -0
- package/plugins/runtime-modules/descriptor-compiler.js +9 -204
- package/plugins/runtime-modules/resolver.js +31 -5
- package/types/collection-view-widget.d.ts +19 -0
- package/types/core-widget-placements.d.ts +9 -0
- package/types/media.d.ts +16 -0
|
@@ -0,0 +1,211 @@
|
|
|
1
|
+
import { buildPhiBasePageLayoutNode, PHI_BASE_PAGE_LAYOUT_NODE_ID } from "../components/regions/presets/phi-base-page-layout";
|
|
2
|
+
import { PhiCmsLayoutType } from "../constants/cms-layout-type-keys";
|
|
3
|
+
import { PhiCmsWidgetType } from "../constants/cms-widget-types";
|
|
4
|
+
import { isPhiCmsInstanceId, readPhiCmsInstanceIdDescriptor } from "../types/cms-instance-id";
|
|
5
|
+
import { PHI_DIALOG_BLEED_BODY_CONFIG, PHI_DIALOG_BODY_CONFIG, PHI_DIALOG_COMMANDS_CONFIG, PHI_DIALOG_WIDTH, isPhiFormSingleColumn, } from "./cms-dialog";
|
|
6
|
+
import { resolvePhiLayoutCreationPreset } from "./cms-layout-defaults";
|
|
7
|
+
function stablePresetNodeJson(value) {
|
|
8
|
+
if (Array.isArray(value)) {
|
|
9
|
+
return `[${value.map(stablePresetNodeJson).join(",")}]`;
|
|
10
|
+
}
|
|
11
|
+
if (value && typeof value === "object") {
|
|
12
|
+
return `{${Object.entries(value)
|
|
13
|
+
.filter(([, entry]) => entry !== undefined)
|
|
14
|
+
.sort(([left], [right]) => (left < right ? -1 : left > right ? 1 : 0))
|
|
15
|
+
.map(([key, entry]) => `${JSON.stringify(key)}:${stablePresetNodeJson(entry)}`)
|
|
16
|
+
.join(",")}}`;
|
|
17
|
+
}
|
|
18
|
+
return JSON.stringify(value) ?? "undefined";
|
|
19
|
+
}
|
|
20
|
+
function readFormsById(forms) {
|
|
21
|
+
if (!forms || forms instanceof Map)
|
|
22
|
+
return forms;
|
|
23
|
+
return new Map([...forms].map((form) => [form.formId, form]));
|
|
24
|
+
}
|
|
25
|
+
export function checkPhiPresetTreeContract(tree, options = {}) {
|
|
26
|
+
const findings = [];
|
|
27
|
+
const report = (node, message) => findings.push({ node, message });
|
|
28
|
+
const expectedPage = options.page;
|
|
29
|
+
const forms = readFormsById(options.forms);
|
|
30
|
+
const layoutIds = new Set();
|
|
31
|
+
const allIds = new Set();
|
|
32
|
+
if (expectedPage &&
|
|
33
|
+
(tree.page.siteId !== expectedPage.siteId ||
|
|
34
|
+
tree.page.areaMask !== expectedPage.areaMask ||
|
|
35
|
+
tree.page.path !== expectedPage.path)) {
|
|
36
|
+
report("page", "Preset loader returned a Page outside its requested context.");
|
|
37
|
+
}
|
|
38
|
+
const checkId = (node, kind) => {
|
|
39
|
+
if (!isPhiCmsInstanceId(node.id) || readPhiCmsInstanceIdDescriptor(node.id)?.origin !== "preset") {
|
|
40
|
+
report(String(node.id), `${kind} has invalid instance id "${String(node.id)}".`);
|
|
41
|
+
}
|
|
42
|
+
if (allIds.has(node.id)) {
|
|
43
|
+
report(node.id, `Preset tree contains duplicate instance id "${node.id}".`);
|
|
44
|
+
}
|
|
45
|
+
allIds.add(node.id);
|
|
46
|
+
};
|
|
47
|
+
for (const node of tree.overlays)
|
|
48
|
+
checkId(node, "Preset Overlay");
|
|
49
|
+
for (const node of tree.layoutNodes) {
|
|
50
|
+
checkId(node, "Preset layout node");
|
|
51
|
+
layoutIds.add(node.id);
|
|
52
|
+
}
|
|
53
|
+
for (const node of tree.contentWidgets)
|
|
54
|
+
checkId(node, "Preset widget node");
|
|
55
|
+
for (const node of tree.layoutNodes) {
|
|
56
|
+
if (node.parentLayoutNodeId != null && !layoutIds.has(node.parentLayoutNodeId)) {
|
|
57
|
+
report(node.id, `Preset layout "${node.id}" has unresolved parent "${node.parentLayoutNodeId}".`);
|
|
58
|
+
}
|
|
59
|
+
}
|
|
60
|
+
for (const node of tree.contentWidgets) {
|
|
61
|
+
if (!layoutIds.has(node.parentLayoutNodeId)) {
|
|
62
|
+
report(node.id, `Preset widget "${node.id}" has unresolved parent "${node.parentLayoutNodeId}".`);
|
|
63
|
+
}
|
|
64
|
+
}
|
|
65
|
+
for (const region of tree.regions) {
|
|
66
|
+
if (expectedPage && region.pageId !== expectedPage.id) {
|
|
67
|
+
report(region.rootLayoutNodeId, `Preset region "${region.regionType}" belongs to a different Page.`);
|
|
68
|
+
}
|
|
69
|
+
if (!layoutIds.has(region.rootLayoutNodeId)) {
|
|
70
|
+
report(region.rootLayoutNodeId, `Preset region "${region.regionType}" has unresolved root "${region.rootLayoutNodeId}".`);
|
|
71
|
+
}
|
|
72
|
+
}
|
|
73
|
+
const layoutsById = new Map(tree.layoutNodes.map((node) => [node.id, node]));
|
|
74
|
+
checkBasePageLayoutNode(tree, layoutsById, report);
|
|
75
|
+
for (const overlay of tree.overlays) {
|
|
76
|
+
if (!layoutIds.has(overlay.bodyLayoutNodeId)) {
|
|
77
|
+
report(overlay.id, `Preset Overlay "${overlay.id}" has unresolved Body root "${overlay.bodyLayoutNodeId}".`);
|
|
78
|
+
}
|
|
79
|
+
if (overlay.headerLayoutNodeId != null && !layoutIds.has(overlay.headerLayoutNodeId)) {
|
|
80
|
+
report(overlay.id, `Preset Overlay "${overlay.id}" has unresolved Header root "${overlay.headerLayoutNodeId}".`);
|
|
81
|
+
}
|
|
82
|
+
if (overlay.footerPresentation === "none") {
|
|
83
|
+
continue;
|
|
84
|
+
}
|
|
85
|
+
const footerLayout = layoutsById.get(overlay.footerLayoutNodeId);
|
|
86
|
+
if (!footerLayout) {
|
|
87
|
+
report(overlay.id, `Preset Overlay "${overlay.id}" has unresolved Footer root "${overlay.footerLayoutNodeId}".`);
|
|
88
|
+
continue;
|
|
89
|
+
}
|
|
90
|
+
if (overlay.footerPresentation === "actions") {
|
|
91
|
+
if (footerLayout.widgetType !== PhiCmsLayoutType.Flex) {
|
|
92
|
+
report(overlay.id, `Preset Overlay "${overlay.id}" actions Footer must use the Phi Flex Layout.`);
|
|
93
|
+
continue;
|
|
94
|
+
}
|
|
95
|
+
const expectedConfig = resolvePhiLayoutCreationPreset("flex", "overlay-actions");
|
|
96
|
+
const mismatch = Object.entries(expectedConfig).find(([key, value]) => JSON.stringify(footerLayout.config[key]) !== JSON.stringify(value));
|
|
97
|
+
if (mismatch) {
|
|
98
|
+
report(overlay.id, `Preset Overlay "${overlay.id}" actions Footer does not match the canonical Layout preset at "${mismatch[0]}".`);
|
|
99
|
+
continue;
|
|
100
|
+
}
|
|
101
|
+
if (overlay.overlayType === "modal") {
|
|
102
|
+
checkDialogCommands(overlay.id, footerLayout.id, tree.contentWidgets, report);
|
|
103
|
+
}
|
|
104
|
+
}
|
|
105
|
+
}
|
|
106
|
+
for (const overlay of tree.overlays) {
|
|
107
|
+
if (overlay.overlayType !== "modal")
|
|
108
|
+
continue;
|
|
109
|
+
const body = layoutsById.get(overlay.bodyLayoutNodeId);
|
|
110
|
+
if (body)
|
|
111
|
+
checkDialogBody(overlay.id, body, report);
|
|
112
|
+
if (forms)
|
|
113
|
+
checkDialogWidth(overlay, tree, forms, report);
|
|
114
|
+
}
|
|
115
|
+
for (const rootLayoutNodeId of [
|
|
116
|
+
tree.page.heroRootLayoutNodeId,
|
|
117
|
+
tree.page.headerBottomRootLayoutNodeId,
|
|
118
|
+
tree.page.siderRightRootLayoutNodeId,
|
|
119
|
+
tree.page.footerTopRootLayoutNodeId,
|
|
120
|
+
tree.page.drawerRightRootLayoutNodeId,
|
|
121
|
+
tree.page.contentRootLayoutNodeId,
|
|
122
|
+
]) {
|
|
123
|
+
if (rootLayoutNodeId != null && !layoutIds.has(rootLayoutNodeId)) {
|
|
124
|
+
report("page", `Preset Page has unresolved root "${rootLayoutNodeId}".`);
|
|
125
|
+
}
|
|
126
|
+
}
|
|
127
|
+
return findings;
|
|
128
|
+
}
|
|
129
|
+
/**
|
|
130
|
+
* Equal id must mean equal node: the shared page scaffold carries the same instance id in every
|
|
131
|
+
* built-in preset tree, which stays sound only while every copy is the canonical node. A preset that
|
|
132
|
+
* wants different chrome gets its own Layout node in a slot -- a deviating copy of the scaffold is a
|
|
133
|
+
* contract violation, not a customisation.
|
|
134
|
+
*/
|
|
135
|
+
function checkBasePageLayoutNode(tree, layoutsById, report) {
|
|
136
|
+
for (const node of [...tree.overlays, ...tree.contentWidgets]) {
|
|
137
|
+
if (node.id === PHI_BASE_PAGE_LAYOUT_NODE_ID) {
|
|
138
|
+
report(node.id, "The base page layout instance id is reserved for the scaffold Layout node.");
|
|
139
|
+
}
|
|
140
|
+
}
|
|
141
|
+
const node = layoutsById.get(PHI_BASE_PAGE_LAYOUT_NODE_ID);
|
|
142
|
+
if (!node) {
|
|
143
|
+
return;
|
|
144
|
+
}
|
|
145
|
+
const canonical = buildPhiBasePageLayoutNode(tree.page);
|
|
146
|
+
const mismatch = Object.keys(canonical)
|
|
147
|
+
.find((key) => stablePresetNodeJson(node[key]) !== stablePresetNodeJson(canonical[key]));
|
|
148
|
+
if (mismatch) {
|
|
149
|
+
report(node.id, `Preset tree carries a deviating base page layout node: "${String(mismatch)}" is ` +
|
|
150
|
+
`${stablePresetNodeJson(node[mismatch])}, canonical is ${stablePresetNodeJson(canonical[mismatch])}.`);
|
|
151
|
+
}
|
|
152
|
+
}
|
|
153
|
+
/*
|
|
154
|
+
* A dialog's body and actions are one answer for every dialog (`helpers/cms-dialog.ts`), checked here as
|
|
155
|
+
* the footer Layout is: a Preset that builds its dialog node by node must arrive at the same look as one
|
|
156
|
+
* that calls `dialog`. A vertical Flex carries the whole body config; a Layout of another kind -- a Stack
|
|
157
|
+
* of tabs -- carries the ground and the inset, which are what make it the dialog's body.
|
|
158
|
+
*/
|
|
159
|
+
function checkDialogBody(overlayId, body, report) {
|
|
160
|
+
// The bleed body is the other answer, for content that runs to the edge; it is matched whole.
|
|
161
|
+
const bleed = PHI_DIALOG_BLEED_BODY_CONFIG.padding === body.config.padding;
|
|
162
|
+
const required = bleed
|
|
163
|
+
? PHI_DIALOG_BLEED_BODY_CONFIG
|
|
164
|
+
: body.widgetType === PhiCmsLayoutType.FlexVertical
|
|
165
|
+
? PHI_DIALOG_BODY_CONFIG
|
|
166
|
+
: { surface: PHI_DIALOG_BODY_CONFIG.surface, padding: PHI_DIALOG_BODY_CONFIG.padding };
|
|
167
|
+
const mismatch = Object.entries(required).find(([key, value]) => JSON.stringify(body.config[key]) !== JSON.stringify(value));
|
|
168
|
+
if (mismatch) {
|
|
169
|
+
report(overlayId, `Preset Overlay "${overlayId}" Body "${body.id}" does not match the dialog body (${bleed ? "PHI_DIALOG_BLEED_BODY_CONFIG" : "PHI_DIALOG_BODY_CONFIG"}) at "${mismatch[0]}".`);
|
|
170
|
+
}
|
|
171
|
+
}
|
|
172
|
+
function checkDialogCommands(overlayId, footerLayoutId, widgets, report) {
|
|
173
|
+
for (const widget of widgets) {
|
|
174
|
+
if (widget.parentLayoutNodeId !== footerLayoutId || widget.widgetType !== PhiCmsWidgetType.CommandToolbar)
|
|
175
|
+
continue;
|
|
176
|
+
const mismatch = Object.entries(PHI_DIALOG_COMMANDS_CONFIG).find(([key, value]) => widget.config[key] !== value);
|
|
177
|
+
if (mismatch) {
|
|
178
|
+
report(widget.id, `Preset Overlay "${overlayId}" actions "${widget.id}" do not match the dialog actions (PHI_DIALOG_COMMANDS_CONFIG) at "${mismatch[0]}".`);
|
|
179
|
+
}
|
|
180
|
+
}
|
|
181
|
+
}
|
|
182
|
+
/*
|
|
183
|
+
* A dialog is as wide as its Form needs (`helpers/cms-dialog.ts`): one column takes
|
|
184
|
+
* `PHI_DIALOG_WIDTH_SINGLE_COLUMN`, two keep `PHI_DIALOG_WIDTH`. What is refused is the one width a Preset
|
|
185
|
+
* did not choose -- the default, holding nothing but Forms of one column. Any other width was stated, by a
|
|
186
|
+
* caller that knows what else the body holds; a Form the caller cannot see is not judged.
|
|
187
|
+
*/
|
|
188
|
+
function checkDialogWidth(overlay, tree, forms, report) {
|
|
189
|
+
if (stablePresetNodeJson(overlay.config.width) !== stablePresetNodeJson(PHI_DIALOG_WIDTH))
|
|
190
|
+
return;
|
|
191
|
+
const bodyLayoutIds = new Set([overlay.bodyLayoutNodeId]);
|
|
192
|
+
for (let grown = true; grown;) {
|
|
193
|
+
grown = false;
|
|
194
|
+
for (const node of tree.layoutNodes) {
|
|
195
|
+
if (node.parentLayoutNodeId != null && bodyLayoutIds.has(node.parentLayoutNodeId) && !bodyLayoutIds.has(node.id)) {
|
|
196
|
+
bodyLayoutIds.add(node.id);
|
|
197
|
+
grown = true;
|
|
198
|
+
}
|
|
199
|
+
}
|
|
200
|
+
}
|
|
201
|
+
const formIds = tree.contentWidgets
|
|
202
|
+
.filter((widget) => widget.widgetType === PhiCmsWidgetType.Form && bodyLayoutIds.has(widget.parentLayoutNodeId))
|
|
203
|
+
.map((widget) => widget.config.formId);
|
|
204
|
+
if (formIds.length === 0)
|
|
205
|
+
return;
|
|
206
|
+
const descriptors = formIds.map((formId) => (typeof formId === "string" ? forms.get(formId) : undefined)?.descriptor);
|
|
207
|
+
if (descriptors.every((descriptor) => descriptor != null && isPhiFormSingleColumn(descriptor))) {
|
|
208
|
+
report(overlay.id, `Preset Overlay "${overlay.id}" holds the one-column Form "${String(formIds[0])}" at the full dialog width ` +
|
|
209
|
+
"(PHI_DIALOG_WIDTH). Hand the Form to `dialog` as `body.form`, or state `width: PHI_DIALOG_WIDTH_SINGLE_COLUMN`.");
|
|
210
|
+
}
|
|
211
|
+
}
|
package/module-page-check.d.ts
CHANGED
|
@@ -7,9 +7,15 @@
|
|
|
7
7
|
* build, and treats a finding as an error; it is never called while a Site serves a request, and so it is
|
|
8
8
|
* never part of `@phis/ui/helpers`.
|
|
9
9
|
*
|
|
10
|
+
* `checkPhiPresetTreeContract` is the one exception to "never at request time" for the code behind it, not
|
|
11
|
+
* for this door: the descriptor compiler runs the same rules on every tree a preset loads and throws the
|
|
12
|
+
* first finding. Here a package runs them first, with its own Forms, so a tree the compiler would refuse
|
|
13
|
+
* fails the package's tests instead of answering 500 on a Site.
|
|
14
|
+
*
|
|
10
15
|
* No `server-only` here, on purpose: a test in a package loads this door without a mock.
|
|
11
16
|
*/
|
|
12
17
|
export { createPhiDeclaredMediaResolver, type PhiModuleMediaFinding } from "./helpers/module-media-check";
|
|
13
18
|
export { checkPhiPagePresetLayout, type PhiPageLayoutFinding } from "./helpers/page-layout-check";
|
|
14
19
|
export { checkPhiPresetTextSources, type PhiPresetTextSourceFinding } from "./helpers/preset-text-source-check";
|
|
20
|
+
export { checkPhiPresetTreeContract, type PhiPresetTreeContractFinding } from "./helpers/preset-tree-contract-check";
|
|
15
21
|
export { checkPhiRouteAddresses, type PhiRouteAddressFinding, type PhiRouteAddressSubject } from "./helpers/route-address-check";
|
package/module-page-check.js
CHANGED
|
@@ -7,9 +7,15 @@
|
|
|
7
7
|
* build, and treats a finding as an error; it is never called while a Site serves a request, and so it is
|
|
8
8
|
* never part of `@phis/ui/helpers`.
|
|
9
9
|
*
|
|
10
|
+
* `checkPhiPresetTreeContract` is the one exception to "never at request time" for the code behind it, not
|
|
11
|
+
* for this door: the descriptor compiler runs the same rules on every tree a preset loads and throws the
|
|
12
|
+
* first finding. Here a package runs them first, with its own Forms, so a tree the compiler would refuse
|
|
13
|
+
* fails the package's tests instead of answering 500 on a Site.
|
|
14
|
+
*
|
|
10
15
|
* No `server-only` here, on purpose: a test in a package loads this door without a mock.
|
|
11
16
|
*/
|
|
12
17
|
export { createPhiDeclaredMediaResolver } from "./helpers/module-media-check";
|
|
13
18
|
export { checkPhiPagePresetLayout } from "./helpers/page-layout-check";
|
|
14
19
|
export { checkPhiPresetTextSources } from "./helpers/preset-text-source-check";
|
|
20
|
+
export { checkPhiPresetTreeContract } from "./helpers/preset-tree-contract-check";
|
|
15
21
|
export { checkPhiRouteAddresses } from "./helpers/route-address-check";
|
package/package.json
CHANGED
|
@@ -41,44 +41,62 @@ export declare const PHI_ASSET_RUNTIME_DATA_PROVIDER_DESCRIPTORS: ({
|
|
|
41
41
|
description: string;
|
|
42
42
|
availableToAuthoringChrome: true;
|
|
43
43
|
resources: {
|
|
44
|
-
resourceKey:
|
|
45
|
-
title:
|
|
46
|
-
itemIdentityPath:
|
|
47
|
-
itemRendererKey: `${string}/${string}`;
|
|
48
|
-
selectionValueSchema: `${string}/signals/${string}`;
|
|
49
|
-
defaultForWidget: true;
|
|
50
|
-
query: {
|
|
51
|
-
search: true;
|
|
52
|
-
pagination: true;
|
|
53
|
-
filterFields:
|
|
54
|
-
key:
|
|
55
|
-
title:
|
|
56
|
-
type: "enum[]";
|
|
57
|
-
}
|
|
58
|
-
key:
|
|
59
|
-
title:
|
|
60
|
-
type: "
|
|
61
|
-
}
|
|
44
|
+
readonly resourceKey: "assets";
|
|
45
|
+
readonly title: "Assets";
|
|
46
|
+
readonly itemIdentityPath: "id";
|
|
47
|
+
readonly itemRendererKey: `${string}/${string}`;
|
|
48
|
+
readonly selectionValueSchema: `${string}/signals/${string}`;
|
|
49
|
+
readonly defaultForWidget: true;
|
|
50
|
+
readonly query: {
|
|
51
|
+
readonly search: true;
|
|
52
|
+
readonly pagination: true;
|
|
53
|
+
readonly filterFields: readonly [{
|
|
54
|
+
readonly key: "kind";
|
|
55
|
+
readonly title: "Kind";
|
|
56
|
+
readonly type: "enum[]";
|
|
57
|
+
}, {
|
|
58
|
+
readonly key: "presentationFlags";
|
|
59
|
+
readonly title: "Flags";
|
|
60
|
+
readonly type: "enum[]";
|
|
61
|
+
}, {
|
|
62
|
+
readonly key: "folderId";
|
|
63
|
+
readonly title: "Folder";
|
|
64
|
+
readonly type: "path";
|
|
65
|
+
}];
|
|
62
66
|
};
|
|
63
|
-
actions:
|
|
64
|
-
key:
|
|
65
|
-
title:
|
|
66
|
-
scope: "resource";
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
67
|
+
readonly actions: readonly [{
|
|
68
|
+
readonly key: "createFolder";
|
|
69
|
+
readonly title: "Create folder";
|
|
70
|
+
readonly scope: "resource";
|
|
71
|
+
}, {
|
|
72
|
+
readonly key: "lockFolder";
|
|
73
|
+
readonly title: "Lock folder";
|
|
74
|
+
readonly scope: "resource";
|
|
75
|
+
}, {
|
|
76
|
+
readonly key: "unlockFolder";
|
|
77
|
+
readonly title: "Unlock folder";
|
|
78
|
+
readonly scope: "resource";
|
|
79
|
+
}, {
|
|
80
|
+
readonly key: "upload";
|
|
81
|
+
readonly title: "Upload";
|
|
82
|
+
readonly scope: "resource";
|
|
83
|
+
readonly panelKey: "upload";
|
|
84
|
+
}, {
|
|
85
|
+
readonly key: "refresh";
|
|
86
|
+
readonly title: "Reload";
|
|
87
|
+
readonly scope: "resource";
|
|
88
|
+
}, {
|
|
89
|
+
readonly key: "update";
|
|
90
|
+
readonly title: "Update";
|
|
91
|
+
readonly scope: "item";
|
|
92
|
+
}, {
|
|
93
|
+
readonly key: "delete";
|
|
94
|
+
readonly title: "Delete";
|
|
95
|
+
readonly scope: "item";
|
|
96
|
+
}];
|
|
97
|
+
readonly panels: readonly [{
|
|
98
|
+
readonly key: "upload";
|
|
99
|
+
readonly title: "Upload assets";
|
|
100
|
+
}];
|
|
83
101
|
}[];
|
|
84
102
|
})[];
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import { PHI_ASSET_RUNTIME_DATA_PROVIDER_KEYS
|
|
1
|
+
import { PHI_MEDIA_LIBRARY_ASSET_RESOURCE } from "../../../components/media/media-library-resource";
|
|
2
|
+
import { PHI_ASSET_RUNTIME_DATA_PROVIDER_KEYS } from "./ids";
|
|
3
3
|
import { PHI_ASSET_RUNTIME_MODULE_ID } from "./ids";
|
|
4
4
|
/** The existing User and Group Spaces, one resource per kind, for the Admin storage table. */
|
|
5
5
|
export const PHI_ASSET_STORAGE_SPACES_RESOURCES = [
|
|
@@ -92,35 +92,7 @@ export const PHI_ASSET_RUNTIME_DATA_PROVIDER_DESCRIPTORS = [
|
|
|
92
92
|
// The Builder's own pickers read this regardless of whether the edited Area activates
|
|
93
93
|
// this Module: a phis:asset reference resolves through the core resolver either way.
|
|
94
94
|
availableToAuthoringChrome: true,
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
resourceKey: "assets",
|
|
98
|
-
title: "Assets",
|
|
99
|
-
itemIdentityPath: "id",
|
|
100
|
-
itemRendererKey: PHI_ASSET_RUNTIME_ITEM_RENDERER_KEY,
|
|
101
|
-
selectionValueSchema: PHI_SIGNAL_VALUE_SCHEMAS.mediaAssetSelection,
|
|
102
|
-
defaultForWidget: true,
|
|
103
|
-
query: {
|
|
104
|
-
search: true,
|
|
105
|
-
pagination: true,
|
|
106
|
-
filterFields: [
|
|
107
|
-
{ key: "kind", title: "Kind", type: "enum[]" },
|
|
108
|
-
{ key: "presentationFlags", title: "Flags", type: "enum[]" },
|
|
109
|
-
{ key: "folderId", title: "Folder", type: "path" },
|
|
110
|
-
],
|
|
111
|
-
},
|
|
112
|
-
actions: [
|
|
113
|
-
{ key: "createFolder", title: "Create folder", scope: "resource" },
|
|
114
|
-
// The Folder the listing is filtered to; Core refuses every change to what a locked one holds.
|
|
115
|
-
{ key: "lockFolder", title: "Lock folder", scope: "resource" },
|
|
116
|
-
{ key: "unlockFolder", title: "Unlock folder", scope: "resource" },
|
|
117
|
-
{ key: "upload", title: "Upload", scope: "resource", panelKey: "upload" },
|
|
118
|
-
{ key: "refresh", title: "Reload", scope: "resource" },
|
|
119
|
-
{ key: "update", title: "Update", scope: "item" },
|
|
120
|
-
{ key: "delete", title: "Delete", scope: "item" },
|
|
121
|
-
],
|
|
122
|
-
panels: [{ key: "upload", title: "Upload assets" }],
|
|
123
|
-
},
|
|
124
|
-
],
|
|
95
|
+
// The Foundation states the resource, because its Media preview grid hands it to the renderer too.
|
|
96
|
+
resources: [PHI_MEDIA_LIBRARY_ASSET_RESOURCE],
|
|
125
97
|
},
|
|
126
98
|
];
|
|
@@ -50,45 +50,63 @@ export declare const PHI_ASSET_RUNTIME_MODULE_DEFINITION: {
|
|
|
50
50
|
description: string;
|
|
51
51
|
availableToAuthoringChrome: true;
|
|
52
52
|
resources: {
|
|
53
|
-
resourceKey:
|
|
54
|
-
title:
|
|
55
|
-
itemIdentityPath:
|
|
56
|
-
itemRendererKey: `${string}/${string}`;
|
|
57
|
-
selectionValueSchema: `${string}/signals/${string}`;
|
|
58
|
-
defaultForWidget: true;
|
|
59
|
-
query: {
|
|
60
|
-
search: true;
|
|
61
|
-
pagination: true;
|
|
62
|
-
filterFields:
|
|
63
|
-
key:
|
|
64
|
-
title:
|
|
65
|
-
type: "enum[]";
|
|
66
|
-
}
|
|
67
|
-
key:
|
|
68
|
-
title:
|
|
69
|
-
type: "
|
|
70
|
-
}
|
|
53
|
+
readonly resourceKey: "assets";
|
|
54
|
+
readonly title: "Assets";
|
|
55
|
+
readonly itemIdentityPath: "id";
|
|
56
|
+
readonly itemRendererKey: `${string}/${string}`;
|
|
57
|
+
readonly selectionValueSchema: `${string}/signals/${string}`;
|
|
58
|
+
readonly defaultForWidget: true;
|
|
59
|
+
readonly query: {
|
|
60
|
+
readonly search: true;
|
|
61
|
+
readonly pagination: true;
|
|
62
|
+
readonly filterFields: readonly [{
|
|
63
|
+
readonly key: "kind";
|
|
64
|
+
readonly title: "Kind";
|
|
65
|
+
readonly type: "enum[]";
|
|
66
|
+
}, {
|
|
67
|
+
readonly key: "presentationFlags";
|
|
68
|
+
readonly title: "Flags";
|
|
69
|
+
readonly type: "enum[]";
|
|
70
|
+
}, {
|
|
71
|
+
readonly key: "folderId";
|
|
72
|
+
readonly title: "Folder";
|
|
73
|
+
readonly type: "path";
|
|
74
|
+
}];
|
|
71
75
|
};
|
|
72
|
-
actions:
|
|
73
|
-
key:
|
|
74
|
-
title:
|
|
75
|
-
scope: "resource";
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
76
|
+
readonly actions: readonly [{
|
|
77
|
+
readonly key: "createFolder";
|
|
78
|
+
readonly title: "Create folder";
|
|
79
|
+
readonly scope: "resource";
|
|
80
|
+
}, {
|
|
81
|
+
readonly key: "lockFolder";
|
|
82
|
+
readonly title: "Lock folder";
|
|
83
|
+
readonly scope: "resource";
|
|
84
|
+
}, {
|
|
85
|
+
readonly key: "unlockFolder";
|
|
86
|
+
readonly title: "Unlock folder";
|
|
87
|
+
readonly scope: "resource";
|
|
88
|
+
}, {
|
|
89
|
+
readonly key: "upload";
|
|
90
|
+
readonly title: "Upload";
|
|
91
|
+
readonly scope: "resource";
|
|
92
|
+
readonly panelKey: "upload";
|
|
93
|
+
}, {
|
|
94
|
+
readonly key: "refresh";
|
|
95
|
+
readonly title: "Reload";
|
|
96
|
+
readonly scope: "resource";
|
|
97
|
+
}, {
|
|
98
|
+
readonly key: "update";
|
|
99
|
+
readonly title: "Update";
|
|
100
|
+
readonly scope: "item";
|
|
101
|
+
}, {
|
|
102
|
+
readonly key: "delete";
|
|
103
|
+
readonly title: "Delete";
|
|
104
|
+
readonly scope: "item";
|
|
105
|
+
}];
|
|
106
|
+
readonly panels: readonly [{
|
|
107
|
+
readonly key: "upload";
|
|
108
|
+
readonly title: "Upload assets";
|
|
109
|
+
}];
|
|
92
110
|
}[];
|
|
93
111
|
})[];
|
|
94
112
|
collectionItemRenderers: {
|
|
@@ -155,6 +173,65 @@ export declare const PHI_ASSET_RUNTIME_MODULE_DEFINITION: {
|
|
|
155
173
|
valueType?: undefined;
|
|
156
174
|
options?: undefined;
|
|
157
175
|
})[];
|
|
176
|
+
} | {
|
|
177
|
+
key: `${string}/${string}`;
|
|
178
|
+
ownerModuleId: "@phis/ui/modules/asset";
|
|
179
|
+
title: string;
|
|
180
|
+
description: string;
|
|
181
|
+
valueType: "json";
|
|
182
|
+
presentation: "control";
|
|
183
|
+
settingsFields: ({
|
|
184
|
+
key: string;
|
|
185
|
+
type: "choice";
|
|
186
|
+
mode: "single";
|
|
187
|
+
valueType: "string";
|
|
188
|
+
label: string;
|
|
189
|
+
description: string;
|
|
190
|
+
options: ({
|
|
191
|
+
value: "image";
|
|
192
|
+
label: string;
|
|
193
|
+
} | {
|
|
194
|
+
value: "video";
|
|
195
|
+
label: string;
|
|
196
|
+
} | {
|
|
197
|
+
value: "audio";
|
|
198
|
+
label: string;
|
|
199
|
+
} | {
|
|
200
|
+
value: "pdf";
|
|
201
|
+
label: string;
|
|
202
|
+
} | {
|
|
203
|
+
value: "markdown";
|
|
204
|
+
label: string;
|
|
205
|
+
} | {
|
|
206
|
+
value: "font";
|
|
207
|
+
label: string;
|
|
208
|
+
})[];
|
|
209
|
+
min?: undefined;
|
|
210
|
+
max?: undefined;
|
|
211
|
+
precision?: undefined;
|
|
212
|
+
} | {
|
|
213
|
+
key: string;
|
|
214
|
+
type: "string";
|
|
215
|
+
label: string;
|
|
216
|
+
description: string;
|
|
217
|
+
mode?: undefined;
|
|
218
|
+
valueType?: undefined;
|
|
219
|
+
options?: undefined;
|
|
220
|
+
min?: undefined;
|
|
221
|
+
max?: undefined;
|
|
222
|
+
precision?: undefined;
|
|
223
|
+
} | {
|
|
224
|
+
key: string;
|
|
225
|
+
type: "number";
|
|
226
|
+
label: string;
|
|
227
|
+
description: string;
|
|
228
|
+
min: number;
|
|
229
|
+
max: number;
|
|
230
|
+
precision: number;
|
|
231
|
+
mode?: undefined;
|
|
232
|
+
valueType?: undefined;
|
|
233
|
+
options?: undefined;
|
|
234
|
+
})[];
|
|
158
235
|
})[];
|
|
159
236
|
handlers: ({
|
|
160
237
|
key: `${string}/${string}`;
|
|
@@ -6,7 +6,7 @@ import { PHI_ASSET_RUNTIME_DATA_PROVIDER_DESCRIPTORS } from "./data-providers";
|
|
|
6
6
|
import { PHI_CMS_AREA_KEYS } from "../../../constants/cms-areas";
|
|
7
7
|
import { PHI_CORE_SERVER_BINDING } from "../../../types/server-capabilities";
|
|
8
8
|
import { PHI_ASSET_FOLDER_FORM_HANDLER_PROVIDER_DESCRIPTOR, PHI_ASSET_METADATA_FORM_HANDLER_PROVIDER_DESCRIPTOR, } from "./metadata-form";
|
|
9
|
-
import { PHI_ASSET_FOCAL_RECT_FORM_PROVIDER_DESCRIPTOR, PHI_ASSET_MEDIA_ASSET_FORM_PROVIDER_DESCRIPTOR, } from "./form-providers";
|
|
9
|
+
import { PHI_ASSET_FOCAL_RECT_FORM_PROVIDER_DESCRIPTOR, PHI_ASSET_MEDIA_ASSET_FORM_PROVIDER_DESCRIPTOR, PHI_ASSET_MEDIA_ASSETS_FORM_PROVIDER_DESCRIPTOR, } from "./form-providers";
|
|
10
10
|
import { PHI_MEDIA_SETTINGS_FORM_HANDLER_PROVIDER_DESCRIPTOR, PHI_MEDIA_STORAGE_SETTINGS_FORM_HANDLER_PROVIDER_DESCRIPTOR, } from "./settings-forms";
|
|
11
11
|
export const PHI_ASSET_RUNTIME_MODULE_DEFINITION = {
|
|
12
12
|
...PHI_ASSET_RUNTIME_MODULE_IDENTITY,
|
|
@@ -42,6 +42,7 @@ export const PHI_ASSET_RUNTIME_MODULE_DEFINITION = {
|
|
|
42
42
|
fieldTypes: [
|
|
43
43
|
PHI_ASSET_FOCAL_RECT_FORM_PROVIDER_DESCRIPTOR,
|
|
44
44
|
PHI_ASSET_MEDIA_ASSET_FORM_PROVIDER_DESCRIPTOR,
|
|
45
|
+
PHI_ASSET_MEDIA_ASSETS_FORM_PROVIDER_DESCRIPTOR,
|
|
45
46
|
],
|
|
46
47
|
handlers: [
|
|
47
48
|
PHI_ASSET_METADATA_FORM_HANDLER_PROVIDER_DESCRIPTOR,
|