@strapi/content-manager 0.0.0-next.8f63e1055db761e0213cb6610f80c55658196ae1 → 0.0.0-next.926e9af9369b89a571145e3c8fa1ce6bfd6cc0ab
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/dist/_chunks/CardDragPreview-C0QyJgRA.js.map +1 -1
- package/dist/_chunks/CardDragPreview-DOxamsuj.mjs.map +1 -1
- package/dist/_chunks/{ComponentConfigurationPage-Cmm0LJof.js → ComponentConfigurationPage-DMxUlNOo.js} +4 -5
- package/dist/_chunks/{ComponentConfigurationPage-Cmm0LJof.js.map → ComponentConfigurationPage-DMxUlNOo.js.map} +1 -1
- package/dist/_chunks/{ComponentConfigurationPage-FQd019My.mjs → ComponentConfigurationPage-baEkO-OV.mjs} +3 -3
- package/dist/_chunks/{ComponentConfigurationPage-FQd019My.mjs.map → ComponentConfigurationPage-baEkO-OV.mjs.map} +1 -1
- package/dist/_chunks/{ComponentIcon-BXdiCGQp.js → ComponentIcon-CRbtQEUV.js} +2 -3
- package/dist/_chunks/{ComponentIcon-BXdiCGQp.js.map → ComponentIcon-CRbtQEUV.js.map} +1 -1
- package/dist/_chunks/ComponentIcon-u4bIXTFY.mjs.map +1 -1
- package/dist/_chunks/{EditConfigurationPage-CseHna9y.js → EditConfigurationPage-CXxV7mKn.js} +4 -5
- package/dist/_chunks/{EditConfigurationPage-CseHna9y.js.map → EditConfigurationPage-CXxV7mKn.js.map} +1 -1
- package/dist/_chunks/{EditConfigurationPage-BUJqRuRq.mjs → EditConfigurationPage-YR8-4VCS.mjs} +3 -3
- package/dist/_chunks/{EditConfigurationPage-BUJqRuRq.mjs.map → EditConfigurationPage-YR8-4VCS.mjs.map} +1 -1
- package/dist/_chunks/{EditViewPage-BhjvFXZr.js → EditViewPage-BfR6jAR6.js} +22 -78
- package/dist/_chunks/EditViewPage-BfR6jAR6.js.map +1 -0
- package/dist/_chunks/{EditViewPage-BB9VeS-u.mjs → EditViewPage-DFF7c27p.mjs} +19 -74
- package/dist/_chunks/EditViewPage-DFF7c27p.mjs.map +1 -0
- package/dist/_chunks/FieldTypeIcon-CMlNO8PE.mjs.map +1 -1
- package/dist/_chunks/FieldTypeIcon-Dnwq_IRF.js.map +1 -1
- package/dist/_chunks/{Form-DH5m7r5s.js → Form-CjcMRP5A.js} +5 -6
- package/dist/_chunks/{Form-DH5m7r5s.js.map → Form-CjcMRP5A.js.map} +1 -1
- package/dist/_chunks/{Form-B5b7zgoL.mjs → Form-MSOSfGGN.mjs} +3 -3
- package/dist/_chunks/{Form-B5b7zgoL.mjs.map → Form-MSOSfGGN.mjs.map} +1 -1
- package/dist/_chunks/{History-CNO4Db6U.js → History-BgZ7gVuF.js} +48 -72
- package/dist/_chunks/History-BgZ7gVuF.js.map +1 -0
- package/dist/_chunks/{History-Dhy0xF0L.mjs → History-WOQNVho-.mjs} +37 -60
- package/dist/_chunks/History-WOQNVho-.mjs.map +1 -0
- package/dist/_chunks/{Field-CWi7XMCa.mjs → Input-BkKwZ6Qt.mjs} +1245 -1243
- package/dist/_chunks/Input-BkKwZ6Qt.mjs.map +1 -0
- package/dist/_chunks/{Field-B03STsf9.js → Input-BwOibhc3.js} +1331 -1329
- package/dist/_chunks/Input-BwOibhc3.js.map +1 -0
- package/dist/_chunks/{ListConfigurationPage-C_FCilGf.mjs → ListConfigurationPage-BeXfr6uW.mjs} +6 -5
- package/dist/_chunks/ListConfigurationPage-BeXfr6uW.mjs.map +1 -0
- package/dist/_chunks/{ListConfigurationPage-DE7NESsr.js → ListConfigurationPage-DnJ3nbwL.js} +6 -6
- package/dist/_chunks/ListConfigurationPage-DnJ3nbwL.js.map +1 -0
- package/dist/_chunks/{ListViewPage-C7p0PteR.js → ListViewPage-CJFDudKl.js} +61 -58
- package/dist/_chunks/ListViewPage-CJFDudKl.js.map +1 -0
- package/dist/_chunks/{ListViewPage-B6Ut2BH0.mjs → ListViewPage-VK2v44Q1.mjs} +55 -51
- package/dist/_chunks/ListViewPage-VK2v44Q1.mjs.map +1 -0
- package/dist/_chunks/{NoContentTypePage-rR7QwWP5.mjs → NoContentTypePage-T8ttty6K.mjs} +2 -2
- package/dist/_chunks/{NoContentTypePage-rR7QwWP5.mjs.map → NoContentTypePage-T8ttty6K.mjs.map} +1 -1
- package/dist/_chunks/{NoContentTypePage-BN-8niig.js → NoContentTypePage-en2PwWgI.js} +2 -2
- package/dist/_chunks/{NoContentTypePage-BN-8niig.js.map → NoContentTypePage-en2PwWgI.js.map} +1 -1
- package/dist/_chunks/{NoPermissionsPage-Bw3b0OQm.js → NoPermissionsPage-CcjILry3.js} +2 -2
- package/dist/_chunks/{NoPermissionsPage-Bw3b0OQm.js.map → NoPermissionsPage-CcjILry3.js.map} +1 -1
- package/dist/_chunks/{NoPermissionsPage-CGUgxmce.mjs → NoPermissionsPage-CokBHhhy.mjs} +2 -2
- package/dist/_chunks/{NoPermissionsPage-CGUgxmce.mjs.map → NoPermissionsPage-CokBHhhy.mjs.map} +1 -1
- package/dist/_chunks/{Preview-_gomrUna.mjs → Preview-BF81YhRj.mjs} +75 -76
- package/dist/_chunks/Preview-BF81YhRj.mjs.map +1 -0
- package/dist/_chunks/{Preview-CICG4cRf.js → Preview-DgzAuzWQ.js} +74 -76
- package/dist/_chunks/Preview-DgzAuzWQ.js.map +1 -0
- package/dist/_chunks/{Relations-uyLoal2t.js → Relations-1O-JcM4t.js} +7 -10
- package/dist/_chunks/{Relations-uyLoal2t.js.map → Relations-1O-JcM4t.js.map} +1 -1
- package/dist/_chunks/{Relations-BEvinUkU.mjs → Relations-BncdhGCd.mjs} +6 -8
- package/dist/_chunks/{Relations-BEvinUkU.mjs.map → Relations-BncdhGCd.mjs.map} +1 -1
- package/dist/_chunks/{en-D_BMf0hT.mjs → en-BZaUty0m.mjs} +12 -3
- package/dist/_chunks/{en-D_BMf0hT.mjs.map → en-BZaUty0m.mjs.map} +1 -1
- package/dist/_chunks/{en-CHOp_xJv.js → en-CzCnBk4S.js} +12 -3
- package/dist/_chunks/{en-CHOp_xJv.js.map → en-CzCnBk4S.js.map} +1 -1
- package/dist/_chunks/hooks-BAaaKPS_.js.map +1 -1
- package/dist/_chunks/{index-BagcPV6I.mjs → index-DiluOUp6.mjs} +462 -226
- package/dist/_chunks/index-DiluOUp6.mjs.map +1 -0
- package/dist/_chunks/{index-D_AvCmmG.js → index-EXJvmn4t.js} +445 -210
- package/dist/_chunks/index-EXJvmn4t.js.map +1 -0
- package/dist/_chunks/{layout-Dk0odfYR.js → layout-4TbKVax8.js} +5 -6
- package/dist/_chunks/{layout-Dk0odfYR.js.map → layout-4TbKVax8.js.map} +1 -1
- package/dist/_chunks/{layout-DKEX3X49.mjs → layout-mSwsYzxv.mjs} +4 -4
- package/dist/_chunks/{layout-DKEX3X49.mjs.map → layout-mSwsYzxv.mjs.map} +1 -1
- package/dist/_chunks/objects-BcXOv6_9.js.map +1 -1
- package/dist/_chunks/objects-D6yBsdmx.mjs.map +1 -1
- package/dist/_chunks/{relations-DDoMdwk6.mjs → relations--YOvQBqv.mjs} +2 -2
- package/dist/_chunks/{relations-DDoMdwk6.mjs.map → relations--YOvQBqv.mjs.map} +1 -1
- package/dist/_chunks/{relations-C312DwGU.js → relations-Ai6Izh7h.js} +2 -2
- package/dist/_chunks/{relations-C312DwGU.js.map → relations-Ai6Izh7h.js.map} +1 -1
- package/dist/_chunks/{useDragAndDrop-J0TUUbR6.js → useDragAndDrop-BMtgCYzL.js} +5 -9
- package/dist/_chunks/{useDragAndDrop-J0TUUbR6.js.map → useDragAndDrop-BMtgCYzL.js.map} +1 -1
- package/dist/_chunks/{useDragAndDrop-DdHgKsqq.mjs → useDragAndDrop-DJ6jqvZN.mjs} +4 -7
- package/dist/_chunks/{useDragAndDrop-DdHgKsqq.mjs.map → useDragAndDrop-DJ6jqvZN.mjs.map} +1 -1
- package/dist/_chunks/{useDebounce-DmuSJIF3.mjs → usePrev-CZGy2Vjf.mjs} +11 -11
- package/dist/_chunks/usePrev-CZGy2Vjf.mjs.map +1 -0
- package/dist/_chunks/{useDebounce-CtcjDB3L.js → usePrev-D5J_2fEu.js} +8 -8
- package/dist/_chunks/usePrev-D5J_2fEu.js.map +1 -0
- package/dist/admin/index.js +2 -1
- package/dist/admin/index.js.map +1 -1
- package/dist/admin/index.mjs +6 -5
- package/dist/admin/src/content-manager.d.ts +3 -2
- package/dist/admin/src/exports.d.ts +1 -0
- package/dist/admin/src/history/services/historyVersion.d.ts +1 -1
- package/dist/admin/src/hooks/useDocument.d.ts +19 -2
- package/dist/admin/src/pages/EditView/components/DocumentActions.d.ts +1 -1
- package/dist/admin/src/pages/EditView/components/DocumentStatus.d.ts +3 -3
- package/dist/admin/src/pages/EditView/components/FormInputs/BlocksInput/Blocks/Code.d.ts +7 -0
- package/dist/admin/src/pages/EditView/components/FormInputs/BlocksInput/Blocks/utils/prismLanguages.d.ts +49 -0
- package/dist/admin/src/pages/EditView/components/FormInputs/BlocksInput/utils/constants.d.ts +1 -0
- package/dist/admin/src/pages/EditView/components/FormInputs/DynamicZone/DynamicComponent.d.ts +4 -1
- package/dist/admin/src/pages/EditView/components/FormInputs/DynamicZone/Field.d.ts +4 -1
- package/dist/admin/src/pages/EditView/components/FormLayout.d.ts +27 -0
- package/dist/admin/src/pages/EditView/utils/data.d.ts +1 -0
- package/dist/admin/src/preview/pages/Preview.d.ts +1 -1
- package/dist/admin/src/preview/services/preview.d.ts +1 -1
- package/dist/admin/src/router.d.ts +1 -1
- package/dist/admin/src/services/api.d.ts +1 -1
- package/dist/admin/src/services/components.d.ts +2 -2
- package/dist/admin/src/services/contentTypes.d.ts +3 -3
- package/dist/admin/src/services/documents.d.ts +16 -19
- package/dist/admin/src/services/init.d.ts +1 -1
- package/dist/admin/src/services/relations.d.ts +2 -2
- package/dist/admin/src/services/uid.d.ts +3 -3
- package/dist/server/index.js +230 -187
- package/dist/server/index.js.map +1 -1
- package/dist/server/index.mjs +231 -187
- package/dist/server/index.mjs.map +1 -1
- package/dist/server/src/controllers/utils/metadata.d.ts +1 -0
- package/dist/server/src/controllers/utils/metadata.d.ts.map +1 -1
- package/dist/server/src/history/controllers/history-version.d.ts +1 -1
- package/dist/server/src/history/controllers/history-version.d.ts.map +1 -1
- package/dist/server/src/history/services/history.d.ts +3 -3
- package/dist/server/src/history/services/history.d.ts.map +1 -1
- package/dist/server/src/history/services/utils.d.ts +6 -10
- package/dist/server/src/history/services/utils.d.ts.map +1 -1
- package/dist/server/src/index.d.ts +3 -2
- package/dist/server/src/index.d.ts.map +1 -1
- package/dist/server/src/preview/controllers/validation/preview.d.ts.map +1 -1
- package/dist/server/src/preview/index.d.ts.map +1 -1
- package/dist/server/src/preview/services/index.d.ts +1 -0
- package/dist/server/src/preview/services/index.d.ts.map +1 -1
- package/dist/server/src/preview/services/preview-config.d.ts +2 -0
- package/dist/server/src/preview/services/preview-config.d.ts.map +1 -1
- package/dist/server/src/preview/utils.d.ts +1 -0
- package/dist/server/src/preview/utils.d.ts.map +1 -1
- package/dist/server/src/register.d.ts.map +1 -1
- package/dist/server/src/services/document-manager.d.ts.map +1 -1
- package/dist/server/src/services/document-metadata.d.ts +4 -2
- package/dist/server/src/services/document-metadata.d.ts.map +1 -1
- package/dist/server/src/services/index.d.ts +3 -2
- package/dist/server/src/services/index.d.ts.map +1 -1
- package/dist/server/src/services/utils/configuration/index.d.ts +2 -2
- package/dist/server/src/services/utils/configuration/layouts.d.ts +2 -2
- package/dist/server/src/services/utils/populate.d.ts +2 -2
- package/dist/server/src/services/utils/populate.d.ts.map +1 -1
- package/package.json +12 -11
- package/dist/_chunks/EditViewPage-BB9VeS-u.mjs.map +0 -1
- package/dist/_chunks/EditViewPage-BhjvFXZr.js.map +0 -1
- package/dist/_chunks/Field-B03STsf9.js.map +0 -1
- package/dist/_chunks/Field-CWi7XMCa.mjs.map +0 -1
- package/dist/_chunks/History-CNO4Db6U.js.map +0 -1
- package/dist/_chunks/History-Dhy0xF0L.mjs.map +0 -1
- package/dist/_chunks/ListConfigurationPage-C_FCilGf.mjs.map +0 -1
- package/dist/_chunks/ListConfigurationPage-DE7NESsr.js.map +0 -1
- package/dist/_chunks/ListViewPage-B6Ut2BH0.mjs.map +0 -1
- package/dist/_chunks/ListViewPage-C7p0PteR.js.map +0 -1
- package/dist/_chunks/Preview-CICG4cRf.js.map +0 -1
- package/dist/_chunks/Preview-_gomrUna.mjs.map +0 -1
- package/dist/_chunks/index-BagcPV6I.mjs.map +0 -1
- package/dist/_chunks/index-D_AvCmmG.js.map +0 -1
- package/dist/_chunks/useDebounce-CtcjDB3L.js.map +0 -1
- package/dist/_chunks/useDebounce-DmuSJIF3.mjs.map +0 -1
- package/dist/admin/src/preview/constants.d.ts +0 -1
- package/dist/server/src/preview/constants.d.ts +0 -2
- package/dist/server/src/preview/constants.d.ts.map +0 -1
@@ -7,16 +7,16 @@ const designSystem = require("@strapi/design-system");
|
|
7
7
|
const mapValues = require("lodash/fp/mapValues");
|
8
8
|
const reactIntl = require("react-intl");
|
9
9
|
const reactRouterDom = require("react-router-dom");
|
10
|
+
const styledComponents = require("styled-components");
|
10
11
|
const yup = require("yup");
|
12
|
+
const fractionalIndexing = require("fractional-indexing");
|
11
13
|
const pipe = require("lodash/fp/pipe");
|
12
|
-
const dateFns = require("date-fns");
|
13
|
-
const styledComponents = require("styled-components");
|
14
14
|
const qs = require("qs");
|
15
|
+
const dateFns = require("date-fns");
|
15
16
|
const toolkit = require("@reduxjs/toolkit");
|
16
17
|
const _interopDefault = (e) => e && e.__esModule ? e : { default: e };
|
17
18
|
function _interopNamespace(e) {
|
18
|
-
if (e && e.__esModule)
|
19
|
-
return e;
|
19
|
+
if (e && e.__esModule) return e;
|
20
20
|
const n = Object.create(null, { [Symbol.toStringTag]: { value: "Module" } });
|
21
21
|
if (e) {
|
22
22
|
for (const k in e) {
|
@@ -36,13 +36,20 @@ const React__namespace = /* @__PURE__ */ _interopNamespace(React);
|
|
36
36
|
const mapValues__default = /* @__PURE__ */ _interopDefault(mapValues);
|
37
37
|
const yup__namespace = /* @__PURE__ */ _interopNamespace(yup);
|
38
38
|
const pipe__default = /* @__PURE__ */ _interopDefault(pipe);
|
39
|
-
const __variableDynamicImportRuntimeHelper = (glob, path) => {
|
39
|
+
const __variableDynamicImportRuntimeHelper = (glob, path, segs) => {
|
40
40
|
const v = glob[path];
|
41
41
|
if (v) {
|
42
42
|
return typeof v === "function" ? v() : Promise.resolve(v);
|
43
43
|
}
|
44
44
|
return new Promise((_, reject) => {
|
45
|
-
(typeof queueMicrotask === "function" ? queueMicrotask : setTimeout)(
|
45
|
+
(typeof queueMicrotask === "function" ? queueMicrotask : setTimeout)(
|
46
|
+
reject.bind(
|
47
|
+
null,
|
48
|
+
new Error(
|
49
|
+
"Unknown variable dynamic import: " + path + (path.split("/").length !== segs ? ". Note that variables only represent file names one level deep." : "")
|
50
|
+
)
|
51
|
+
)
|
52
|
+
);
|
46
53
|
});
|
47
54
|
};
|
48
55
|
const PLUGIN_ID = "content-manager";
|
@@ -181,6 +188,113 @@ const extractAndDedupeFields = (permissions = []) => permissions.flatMap((permis
|
|
181
188
|
(field, index2, arr) => arr.indexOf(field) === index2 && typeof field === "string"
|
182
189
|
);
|
183
190
|
const removeNumericalStrings = (arr) => arr.filter((item) => isNaN(Number(item)));
|
191
|
+
const BLOCK_LIST_ATTRIBUTE_KEYS = ["__component", "__temp_key__"];
|
192
|
+
const traverseData = (predicate, transform) => (schema, components = {}) => (data = {}) => {
|
193
|
+
const traverse = (datum, attributes) => {
|
194
|
+
return Object.entries(datum).reduce((acc, [key, value]) => {
|
195
|
+
const attribute = attributes[key];
|
196
|
+
if (BLOCK_LIST_ATTRIBUTE_KEYS.includes(key) || value === null || value === void 0) {
|
197
|
+
acc[key] = value;
|
198
|
+
return acc;
|
199
|
+
}
|
200
|
+
if (attribute.type === "component") {
|
201
|
+
if (attribute.repeatable) {
|
202
|
+
const componentValue = predicate(attribute, value) ? transform(value, attribute) : value;
|
203
|
+
acc[key] = componentValue.map(
|
204
|
+
(componentData) => traverse(componentData, components[attribute.component]?.attributes ?? {})
|
205
|
+
);
|
206
|
+
} else {
|
207
|
+
const componentValue = predicate(attribute, value) ? transform(value, attribute) : value;
|
208
|
+
acc[key] = traverse(componentValue, components[attribute.component]?.attributes ?? {});
|
209
|
+
}
|
210
|
+
} else if (attribute.type === "dynamiczone") {
|
211
|
+
const dynamicZoneValue = predicate(attribute, value) ? transform(value, attribute) : value;
|
212
|
+
acc[key] = dynamicZoneValue.map(
|
213
|
+
(componentData) => traverse(componentData, components[componentData.__component]?.attributes ?? {})
|
214
|
+
);
|
215
|
+
} else if (predicate(attribute, value)) {
|
216
|
+
acc[key] = transform(value, attribute);
|
217
|
+
} else {
|
218
|
+
acc[key] = value;
|
219
|
+
}
|
220
|
+
return acc;
|
221
|
+
}, {});
|
222
|
+
};
|
223
|
+
return traverse(data, schema.attributes);
|
224
|
+
};
|
225
|
+
const removeProhibitedFields = (prohibitedFields) => traverseData(
|
226
|
+
(attribute) => prohibitedFields.includes(attribute.type),
|
227
|
+
() => ""
|
228
|
+
);
|
229
|
+
const prepareRelations = traverseData(
|
230
|
+
(attribute) => attribute.type === "relation",
|
231
|
+
() => ({
|
232
|
+
connect: [],
|
233
|
+
disconnect: []
|
234
|
+
})
|
235
|
+
);
|
236
|
+
const prepareTempKeys = traverseData(
|
237
|
+
(attribute) => attribute.type === "component" && attribute.repeatable || attribute.type === "dynamiczone",
|
238
|
+
(data) => {
|
239
|
+
if (Array.isArray(data) && data.length > 0) {
|
240
|
+
const keys = fractionalIndexing.generateNKeysBetween(void 0, void 0, data.length);
|
241
|
+
return data.map((datum, index2) => ({
|
242
|
+
...datum,
|
243
|
+
__temp_key__: keys[index2]
|
244
|
+
}));
|
245
|
+
}
|
246
|
+
return data;
|
247
|
+
}
|
248
|
+
);
|
249
|
+
const removeFieldsThatDontExistOnSchema = (schema) => (data) => {
|
250
|
+
const schemaKeys = Object.keys(schema.attributes);
|
251
|
+
const dataKeys = Object.keys(data);
|
252
|
+
const keysToRemove = dataKeys.filter((key) => !schemaKeys.includes(key));
|
253
|
+
const revisedData = [...keysToRemove, ...DOCUMENT_META_FIELDS].reduce((acc, key) => {
|
254
|
+
delete acc[key];
|
255
|
+
return acc;
|
256
|
+
}, structuredClone(data));
|
257
|
+
return revisedData;
|
258
|
+
};
|
259
|
+
const removeNullValues = (data) => {
|
260
|
+
return Object.entries(data).reduce((acc, [key, value]) => {
|
261
|
+
if (value === null) {
|
262
|
+
return acc;
|
263
|
+
}
|
264
|
+
acc[key] = value;
|
265
|
+
return acc;
|
266
|
+
}, {});
|
267
|
+
};
|
268
|
+
const transformDocument = (schema, components = {}) => (document) => {
|
269
|
+
const transformations = pipe__default.default(
|
270
|
+
removeFieldsThatDontExistOnSchema(schema),
|
271
|
+
removeProhibitedFields(["password"])(schema, components),
|
272
|
+
removeNullValues,
|
273
|
+
prepareRelations(schema, components),
|
274
|
+
prepareTempKeys(schema, components)
|
275
|
+
);
|
276
|
+
return transformations(document);
|
277
|
+
};
|
278
|
+
const createDefaultForm = (contentType, components = {}) => {
|
279
|
+
const traverseSchema = (attributes) => {
|
280
|
+
return Object.entries(attributes).reduce((acc, [key, attribute]) => {
|
281
|
+
if ("default" in attribute) {
|
282
|
+
acc[key] = attribute.default;
|
283
|
+
} else if (attribute.type === "component" && attribute.required) {
|
284
|
+
const defaultComponentForm = traverseSchema(components[attribute.component].attributes);
|
285
|
+
if (attribute.repeatable) {
|
286
|
+
acc[key] = attribute.min ? [...Array(attribute.min).fill(defaultComponentForm)] : [];
|
287
|
+
} else {
|
288
|
+
acc[key] = defaultComponentForm;
|
289
|
+
}
|
290
|
+
} else if (attribute.type === "dynamiczone" && attribute.required) {
|
291
|
+
acc[key] = [];
|
292
|
+
}
|
293
|
+
return acc;
|
294
|
+
}, {});
|
295
|
+
};
|
296
|
+
return traverseSchema(contentType.attributes);
|
297
|
+
};
|
184
298
|
const contentManagerApi = strapiAdmin.adminApi.enhanceEndpoints({
|
185
299
|
addTagTypes: [
|
186
300
|
"ComponentConfiguration",
|
@@ -190,7 +304,8 @@ const contentManagerApi = strapiAdmin.adminApi.enhanceEndpoints({
|
|
190
304
|
"InitialData",
|
191
305
|
"HistoryVersion",
|
192
306
|
"Relations",
|
193
|
-
"UidAvailability"
|
307
|
+
"UidAvailability",
|
308
|
+
"RecentDocumentList"
|
194
309
|
]
|
195
310
|
});
|
196
311
|
const documentApi = contentManagerApi.injectEndpoints({
|
@@ -208,7 +323,7 @@ const documentApi = contentManagerApi.injectEndpoints({
|
|
208
323
|
if (error) {
|
209
324
|
return [];
|
210
325
|
}
|
211
|
-
return [{ type: "Document", id: `${model}_LIST` }];
|
326
|
+
return [{ type: "Document", id: `${model}_LIST` }, "RecentDocumentList"];
|
212
327
|
}
|
213
328
|
}),
|
214
329
|
cloneDocument: builder.mutation({
|
@@ -222,7 +337,8 @@ const documentApi = contentManagerApi.injectEndpoints({
|
|
222
337
|
}),
|
223
338
|
invalidatesTags: (_result, _error, { model }) => [
|
224
339
|
{ type: "Document", id: `${model}_LIST` },
|
225
|
-
{ type: "UidAvailability", id: model }
|
340
|
+
{ type: "UidAvailability", id: model },
|
341
|
+
"RecentDocumentList"
|
226
342
|
]
|
227
343
|
}),
|
228
344
|
/**
|
@@ -241,8 +357,21 @@ const documentApi = contentManagerApi.injectEndpoints({
|
|
241
357
|
invalidatesTags: (result, _error, { model }) => [
|
242
358
|
{ type: "Document", id: `${model}_LIST` },
|
243
359
|
"Relations",
|
244
|
-
{ type: "UidAvailability", id: model }
|
245
|
-
|
360
|
+
{ type: "UidAvailability", id: model },
|
361
|
+
"RecentDocumentList"
|
362
|
+
],
|
363
|
+
transformResponse: (response, meta, arg) => {
|
364
|
+
if (!("data" in response) && arg.model === "plugin::users-permissions.user") {
|
365
|
+
return {
|
366
|
+
data: response,
|
367
|
+
meta: {
|
368
|
+
availableStatus: [],
|
369
|
+
availableLocales: []
|
370
|
+
}
|
371
|
+
};
|
372
|
+
}
|
373
|
+
return response;
|
374
|
+
}
|
246
375
|
}),
|
247
376
|
deleteDocument: builder.mutation({
|
248
377
|
query: ({ collectionType, model, documentId, params }) => ({
|
@@ -253,7 +382,8 @@ const documentApi = contentManagerApi.injectEndpoints({
|
|
253
382
|
}
|
254
383
|
}),
|
255
384
|
invalidatesTags: (_result, _error, { collectionType, model }) => [
|
256
|
-
{ type: "Document", id: collectionType !== SINGLE_TYPES ? `${model}_LIST` : model }
|
385
|
+
{ type: "Document", id: collectionType !== SINGLE_TYPES ? `${model}_LIST` : model },
|
386
|
+
"RecentDocumentList"
|
257
387
|
]
|
258
388
|
}),
|
259
389
|
deleteManyDocuments: builder.mutation({
|
@@ -265,7 +395,10 @@ const documentApi = contentManagerApi.injectEndpoints({
|
|
265
395
|
params
|
266
396
|
}
|
267
397
|
}),
|
268
|
-
invalidatesTags: (_res, _error, { model }) => [
|
398
|
+
invalidatesTags: (_res, _error, { model }) => [
|
399
|
+
{ type: "Document", id: `${model}_LIST` },
|
400
|
+
"RecentDocumentList"
|
401
|
+
]
|
269
402
|
}),
|
270
403
|
discardDocument: builder.mutation({
|
271
404
|
query: ({ collectionType, model, documentId, params }) => ({
|
@@ -283,7 +416,8 @@ const documentApi = contentManagerApi.injectEndpoints({
|
|
283
416
|
},
|
284
417
|
{ type: "Document", id: `${model}_LIST` },
|
285
418
|
"Relations",
|
286
|
-
{ type: "UidAvailability", id: model }
|
419
|
+
{ type: "UidAvailability", id: model },
|
420
|
+
"RecentDocumentList"
|
287
421
|
];
|
288
422
|
}
|
289
423
|
}),
|
@@ -296,7 +430,7 @@ const documentApi = contentManagerApi.injectEndpoints({
|
|
296
430
|
url: `/content-manager/collection-types/${model}`,
|
297
431
|
method: "GET",
|
298
432
|
config: {
|
299
|
-
params
|
433
|
+
params: qs.stringify(params, { encode: true })
|
300
434
|
}
|
301
435
|
}),
|
302
436
|
providesTags: (result, _error, arg) => {
|
@@ -378,7 +512,8 @@ const documentApi = contentManagerApi.injectEndpoints({
|
|
378
512
|
id: collectionType !== SINGLE_TYPES ? `${model}_${documentId}` : model
|
379
513
|
},
|
380
514
|
{ type: "Document", id: `${model}_LIST` },
|
381
|
-
"Relations"
|
515
|
+
"Relations",
|
516
|
+
"RecentDocumentList"
|
382
517
|
];
|
383
518
|
}
|
384
519
|
}),
|
@@ -409,7 +544,9 @@ const documentApi = contentManagerApi.injectEndpoints({
|
|
409
544
|
id: collectionType !== SINGLE_TYPES ? `${model}_${documentId}` : model
|
410
545
|
},
|
411
546
|
"Relations",
|
412
|
-
{ type: "UidAvailability", id: model }
|
547
|
+
{ type: "UidAvailability", id: model },
|
548
|
+
"RecentDocumentList",
|
549
|
+
"RecentDocumentList"
|
413
550
|
];
|
414
551
|
},
|
415
552
|
async onQueryStarted({ data, ...patch }, { dispatch, queryFulfilled }) {
|
@@ -439,7 +576,8 @@ const documentApi = contentManagerApi.injectEndpoints({
|
|
439
576
|
{
|
440
577
|
type: "Document",
|
441
578
|
id: collectionType !== SINGLE_TYPES ? `${model}_${documentId}` : model
|
442
|
-
}
|
579
|
+
},
|
580
|
+
"RecentDocumentList"
|
443
581
|
];
|
444
582
|
}
|
445
583
|
}),
|
@@ -452,7 +590,10 @@ const documentApi = contentManagerApi.injectEndpoints({
|
|
452
590
|
params
|
453
591
|
}
|
454
592
|
}),
|
455
|
-
invalidatesTags: (_res, _error, { model, documentIds }) =>
|
593
|
+
invalidatesTags: (_res, _error, { model, documentIds }) => [
|
594
|
+
...documentIds.map((id) => ({ type: "Document", id: `${model}_${id}` })),
|
595
|
+
"RecentDocumentList"
|
596
|
+
]
|
456
597
|
})
|
457
598
|
})
|
458
599
|
});
|
@@ -475,8 +616,7 @@ const {
|
|
475
616
|
useUnpublishManyDocumentsMutation
|
476
617
|
} = documentApi;
|
477
618
|
const buildValidParams = (query) => {
|
478
|
-
if (!query)
|
479
|
-
return query;
|
619
|
+
if (!query) return query;
|
480
620
|
const { plugins: _, ...validQueryParams } = {
|
481
621
|
...query,
|
482
622
|
...Object.values(query?.plugins ?? {}).reduce(
|
@@ -484,9 +624,6 @@ const buildValidParams = (query) => {
|
|
484
624
|
{}
|
485
625
|
)
|
486
626
|
};
|
487
|
-
if ("_q" in validQueryParams) {
|
488
|
-
validQueryParams._q = encodeURIComponent(validQueryParams._q);
|
489
|
-
}
|
490
627
|
return validQueryParams;
|
491
628
|
};
|
492
629
|
const isBaseQueryError = (error) => {
|
@@ -1127,6 +1264,7 @@ const convertListLayoutToFieldLayouts = (columns, attributes = {}, metadatas, co
|
|
1127
1264
|
const useDocument = (args, opts) => {
|
1128
1265
|
const { toggleNotification } = strapiAdmin.useNotification();
|
1129
1266
|
const { _unstableFormatAPIError: formatAPIError } = strapiAdmin.useAPIErrorHandler();
|
1267
|
+
const { formatMessage } = reactIntl.useIntl();
|
1130
1268
|
const {
|
1131
1269
|
currentData: data,
|
1132
1270
|
isLoading: isLoadingDocument,
|
@@ -1136,12 +1274,27 @@ const useDocument = (args, opts) => {
|
|
1136
1274
|
...opts,
|
1137
1275
|
skip: !args.documentId && args.collectionType !== SINGLE_TYPES || opts?.skip
|
1138
1276
|
});
|
1277
|
+
const document = data?.data;
|
1278
|
+
const meta = data?.meta;
|
1139
1279
|
const {
|
1140
1280
|
components,
|
1141
1281
|
schema,
|
1142
1282
|
schemas,
|
1143
1283
|
isLoading: isLoadingSchema
|
1144
1284
|
} = useContentTypeSchema(args.model);
|
1285
|
+
const isSingleType = schema?.kind === "singleType";
|
1286
|
+
const getTitle = (mainField) => {
|
1287
|
+
if (mainField !== "id" && document?.[mainField]) {
|
1288
|
+
return document[mainField];
|
1289
|
+
}
|
1290
|
+
if (isSingleType && schema?.info.displayName) {
|
1291
|
+
return schema.info.displayName;
|
1292
|
+
}
|
1293
|
+
return formatMessage({
|
1294
|
+
id: "content-manager.containers.untitled",
|
1295
|
+
defaultMessage: "Untitled"
|
1296
|
+
});
|
1297
|
+
};
|
1145
1298
|
React__namespace.useEffect(() => {
|
1146
1299
|
if (error) {
|
1147
1300
|
toggleNotification({
|
@@ -1157,14 +1310,14 @@ const useDocument = (args, opts) => {
|
|
1157
1310
|
return createYupSchema(schema.attributes, components);
|
1158
1311
|
}, [schema, components]);
|
1159
1312
|
const validate = React__namespace.useCallback(
|
1160
|
-
(
|
1313
|
+
(document2) => {
|
1161
1314
|
if (!validationSchema) {
|
1162
1315
|
throw new Error(
|
1163
1316
|
"There is no validation schema generated, this is likely due to the schema not being loaded yet."
|
1164
1317
|
);
|
1165
1318
|
}
|
1166
1319
|
try {
|
1167
|
-
validationSchema.validateSync(
|
1320
|
+
validationSchema.validateSync(document2, { abortEarly: false, strict: true });
|
1168
1321
|
return null;
|
1169
1322
|
} catch (error2) {
|
1170
1323
|
if (error2 instanceof yup.ValidationError) {
|
@@ -1175,17 +1328,29 @@ const useDocument = (args, opts) => {
|
|
1175
1328
|
},
|
1176
1329
|
[validationSchema]
|
1177
1330
|
);
|
1331
|
+
const getInitialFormValues = React__namespace.useCallback(
|
1332
|
+
(isCreatingDocument = false) => {
|
1333
|
+
if (!document && !isCreatingDocument && !isSingleType || !schema) {
|
1334
|
+
return void 0;
|
1335
|
+
}
|
1336
|
+
const form = document?.id ? document : createDefaultForm(schema, components);
|
1337
|
+
return transformDocument(schema, components)(form);
|
1338
|
+
},
|
1339
|
+
[document, isSingleType, schema, components]
|
1340
|
+
);
|
1178
1341
|
const isLoading = isLoadingDocument || isFetchingDocument || isLoadingSchema;
|
1179
1342
|
const hasError = !!error;
|
1180
1343
|
return {
|
1181
1344
|
components,
|
1182
|
-
document
|
1183
|
-
meta
|
1345
|
+
document,
|
1346
|
+
meta,
|
1184
1347
|
isLoading,
|
1185
1348
|
hasError,
|
1186
1349
|
schema,
|
1187
1350
|
schemas,
|
1188
|
-
validate
|
1351
|
+
validate,
|
1352
|
+
getTitle,
|
1353
|
+
getInitialFormValues
|
1189
1354
|
};
|
1190
1355
|
};
|
1191
1356
|
const useDoc = () => {
|
@@ -1686,7 +1851,7 @@ const useDocumentActions = () => {
|
|
1686
1851
|
};
|
1687
1852
|
};
|
1688
1853
|
const ProtectedHistoryPage = React__namespace.lazy(
|
1689
|
-
() => Promise.resolve().then(() => require("./History-
|
1854
|
+
() => Promise.resolve().then(() => require("./History-BgZ7gVuF.js")).then((mod) => ({ default: mod.ProtectedHistoryPage }))
|
1690
1855
|
);
|
1691
1856
|
const routes$2 = [
|
1692
1857
|
{
|
@@ -1699,7 +1864,7 @@ const routes$2 = [
|
|
1699
1864
|
}
|
1700
1865
|
];
|
1701
1866
|
const ProtectedPreviewPage = React__namespace.lazy(
|
1702
|
-
() => Promise.resolve().then(() => require("./Preview-
|
1867
|
+
() => Promise.resolve().then(() => require("./Preview-DgzAuzWQ.js")).then((mod) => ({ default: mod.ProtectedPreviewPage }))
|
1703
1868
|
);
|
1704
1869
|
const routes$1 = [
|
1705
1870
|
{
|
@@ -1712,31 +1877,31 @@ const routes$1 = [
|
|
1712
1877
|
}
|
1713
1878
|
];
|
1714
1879
|
const ProtectedEditViewPage = React.lazy(
|
1715
|
-
() => Promise.resolve().then(() => require("./EditViewPage-
|
1880
|
+
() => Promise.resolve().then(() => require("./EditViewPage-BfR6jAR6.js")).then((mod) => ({ default: mod.ProtectedEditViewPage }))
|
1716
1881
|
);
|
1717
1882
|
const ProtectedListViewPage = React.lazy(
|
1718
|
-
() => Promise.resolve().then(() => require("./ListViewPage-
|
1883
|
+
() => Promise.resolve().then(() => require("./ListViewPage-CJFDudKl.js")).then((mod) => ({ default: mod.ProtectedListViewPage }))
|
1719
1884
|
);
|
1720
1885
|
const ProtectedListConfiguration = React.lazy(
|
1721
|
-
() => Promise.resolve().then(() => require("./ListConfigurationPage-
|
1886
|
+
() => Promise.resolve().then(() => require("./ListConfigurationPage-DnJ3nbwL.js")).then((mod) => ({
|
1722
1887
|
default: mod.ProtectedListConfiguration
|
1723
1888
|
}))
|
1724
1889
|
);
|
1725
1890
|
const ProtectedEditConfigurationPage = React.lazy(
|
1726
|
-
() => Promise.resolve().then(() => require("./EditConfigurationPage-
|
1891
|
+
() => Promise.resolve().then(() => require("./EditConfigurationPage-CXxV7mKn.js")).then((mod) => ({
|
1727
1892
|
default: mod.ProtectedEditConfigurationPage
|
1728
1893
|
}))
|
1729
1894
|
);
|
1730
1895
|
const ProtectedComponentConfigurationPage = React.lazy(
|
1731
|
-
() => Promise.resolve().then(() => require("./ComponentConfigurationPage-
|
1896
|
+
() => Promise.resolve().then(() => require("./ComponentConfigurationPage-DMxUlNOo.js")).then((mod) => ({
|
1732
1897
|
default: mod.ProtectedComponentConfigurationPage
|
1733
1898
|
}))
|
1734
1899
|
);
|
1735
1900
|
const NoPermissions = React.lazy(
|
1736
|
-
() => Promise.resolve().then(() => require("./NoPermissionsPage-
|
1901
|
+
() => Promise.resolve().then(() => require("./NoPermissionsPage-CcjILry3.js")).then((mod) => ({ default: mod.NoPermissions }))
|
1737
1902
|
);
|
1738
1903
|
const NoContentType = React.lazy(
|
1739
|
-
() => Promise.resolve().then(() => require("./NoContentTypePage-
|
1904
|
+
() => Promise.resolve().then(() => require("./NoContentTypePage-en2PwWgI.js")).then((mod) => ({ default: mod.NoContentType }))
|
1740
1905
|
);
|
1741
1906
|
const CollectionTypePages = () => {
|
1742
1907
|
const { collectionType } = reactRouterDom.useParams();
|
@@ -1748,7 +1913,7 @@ const CollectionTypePages = () => {
|
|
1748
1913
|
const CLONE_RELATIVE_PATH = ":collectionType/:slug/clone/:origin";
|
1749
1914
|
const CLONE_PATH = `/content-manager/${CLONE_RELATIVE_PATH}`;
|
1750
1915
|
const LIST_RELATIVE_PATH = ":collectionType/:slug";
|
1751
|
-
const LIST_PATH = `/content-manager
|
1916
|
+
const LIST_PATH = `/content-manager/collection-types/:slug`;
|
1752
1917
|
const routes = [
|
1753
1918
|
{
|
1754
1919
|
path: LIST_RELATIVE_PATH,
|
@@ -1881,6 +2046,11 @@ const DocumentActionButton = (action) => {
|
|
1881
2046
|
) : null
|
1882
2047
|
] });
|
1883
2048
|
};
|
2049
|
+
const MenuItem = styledComponents.styled(designSystem.Menu.Item)`
|
2050
|
+
&:hover {
|
2051
|
+
background: ${({ theme, isVariantDanger, isDisabled }) => isVariantDanger && !isDisabled ? theme.colors.danger100 : "neutral"};
|
2052
|
+
}
|
2053
|
+
`;
|
1884
2054
|
const DocumentActionsMenu = ({
|
1885
2055
|
actions: actions2,
|
1886
2056
|
children,
|
@@ -1939,48 +2109,32 @@ const DocumentActionsMenu = ({
|
|
1939
2109
|
/* @__PURE__ */ jsxRuntime.jsxs(designSystem.Menu.Content, { maxHeight: void 0, popoverPlacement: "bottom-end", children: [
|
1940
2110
|
actions2.map((action) => {
|
1941
2111
|
return /* @__PURE__ */ jsxRuntime.jsx(
|
1942
|
-
|
2112
|
+
MenuItem,
|
1943
2113
|
{
|
1944
2114
|
disabled: action.disabled,
|
1945
2115
|
onSelect: handleClick(action),
|
1946
2116
|
display: "block",
|
1947
|
-
|
1948
|
-
|
1949
|
-
|
1950
|
-
|
1951
|
-
|
1952
|
-
|
1953
|
-
|
1954
|
-
|
1955
|
-
|
1956
|
-
|
1957
|
-
|
1958
|
-
|
1959
|
-
|
1960
|
-
|
1961
|
-
|
1962
|
-
|
1963
|
-
|
1964
|
-
|
1965
|
-
|
1966
|
-
|
1967
|
-
|
1968
|
-
designSystem.Flex,
|
1969
|
-
{
|
1970
|
-
alignItems: "center",
|
1971
|
-
background: "alternative100",
|
1972
|
-
borderStyle: "solid",
|
1973
|
-
borderColor: "alternative200",
|
1974
|
-
borderWidth: "1px",
|
1975
|
-
height: 5,
|
1976
|
-
paddingLeft: 2,
|
1977
|
-
paddingRight: 2,
|
1978
|
-
hasRadius: true,
|
1979
|
-
color: "alternative600",
|
1980
|
-
children: /* @__PURE__ */ jsxRuntime.jsx(designSystem.Typography, { variant: "sigma", fontWeight: "bold", lineHeight: 1, children: formatMessage({ id: "global.new", defaultMessage: "New" }) })
|
1981
|
-
}
|
1982
|
-
)
|
1983
|
-
] })
|
2117
|
+
isVariantDanger: action.variant === "danger",
|
2118
|
+
isDisabled: action.disabled,
|
2119
|
+
children: /* @__PURE__ */ jsxRuntime.jsx(designSystem.Flex, { justifyContent: "space-between", gap: 4, children: /* @__PURE__ */ jsxRuntime.jsxs(
|
2120
|
+
designSystem.Flex,
|
2121
|
+
{
|
2122
|
+
color: !action.disabled ? convertActionVariantToColor(action.variant) : "inherit",
|
2123
|
+
gap: 2,
|
2124
|
+
tag: "span",
|
2125
|
+
children: [
|
2126
|
+
/* @__PURE__ */ jsxRuntime.jsx(
|
2127
|
+
designSystem.Flex,
|
2128
|
+
{
|
2129
|
+
tag: "span",
|
2130
|
+
color: !action.disabled ? convertActionVariantToIconColor(action.variant) : "inherit",
|
2131
|
+
children: action.icon
|
2132
|
+
}
|
2133
|
+
),
|
2134
|
+
action.label
|
2135
|
+
]
|
2136
|
+
}
|
2137
|
+
) })
|
1984
2138
|
},
|
1985
2139
|
action.id
|
1986
2140
|
);
|
@@ -2117,6 +2271,7 @@ const PublishAction$1 = ({
|
|
2117
2271
|
const { _unstableFormatValidationErrors: formatValidationErrors } = strapiAdmin.useAPIErrorHandler();
|
2118
2272
|
const isListView = reactRouterDom.useMatch(LIST_PATH) !== null;
|
2119
2273
|
const isCloning = reactRouterDom.useMatch(CLONE_PATH) !== null;
|
2274
|
+
const { id } = reactRouterDom.useParams();
|
2120
2275
|
const { formatMessage } = reactIntl.useIntl();
|
2121
2276
|
const canPublish = useDocumentRBAC("PublishAction", ({ canPublish: canPublish2 }) => canPublish2);
|
2122
2277
|
const { publish } = useDocumentActions();
|
@@ -2219,10 +2374,12 @@ const PublishAction$1 = ({
|
|
2219
2374
|
transformData(formValues)
|
2220
2375
|
);
|
2221
2376
|
if ("data" in res && collectionType !== SINGLE_TYPES) {
|
2222
|
-
|
2223
|
-
|
2224
|
-
|
2225
|
-
|
2377
|
+
if (id === "create") {
|
2378
|
+
navigate({
|
2379
|
+
pathname: `../${collectionType}/${model}/${res.data.documentId}`,
|
2380
|
+
search: rawQuery
|
2381
|
+
});
|
2382
|
+
}
|
2226
2383
|
} else if ("error" in res && isBaseQueryError(res.error) && res.error.name === "ValidationError") {
|
2227
2384
|
setErrors(formatValidationErrors(res.error));
|
2228
2385
|
}
|
@@ -2275,6 +2432,7 @@ const PublishAction$1 = ({
|
|
2275
2432
|
};
|
2276
2433
|
};
|
2277
2434
|
PublishAction$1.type = "publish";
|
2435
|
+
PublishAction$1.position = "panel";
|
2278
2436
|
const UpdateAction = ({
|
2279
2437
|
activeTab,
|
2280
2438
|
documentId,
|
@@ -2297,96 +2455,134 @@ const UpdateAction = ({
|
|
2297
2455
|
const validate = strapiAdmin.useForm("UpdateAction", (state) => state.validate);
|
2298
2456
|
const setErrors = strapiAdmin.useForm("UpdateAction", (state) => state.setErrors);
|
2299
2457
|
const resetForm = strapiAdmin.useForm("PublishAction", ({ resetForm: resetForm2 }) => resetForm2);
|
2300
|
-
|
2301
|
-
|
2302
|
-
|
2303
|
-
|
2304
|
-
|
2305
|
-
|
2306
|
-
|
2307
|
-
|
2308
|
-
|
2309
|
-
|
2310
|
-
|
2311
|
-
|
2312
|
-
|
2313
|
-
|
2314
|
-
|
2315
|
-
|
2316
|
-
status: "draft"
|
2458
|
+
const handleUpdate = React__namespace.useCallback(async () => {
|
2459
|
+
setSubmitting(true);
|
2460
|
+
try {
|
2461
|
+
if (!modified) {
|
2462
|
+
return;
|
2463
|
+
}
|
2464
|
+
const { errors } = await validate(true, {
|
2465
|
+
status: "draft"
|
2466
|
+
});
|
2467
|
+
if (errors) {
|
2468
|
+
toggleNotification({
|
2469
|
+
type: "danger",
|
2470
|
+
message: formatMessage({
|
2471
|
+
id: "content-manager.validation.error",
|
2472
|
+
defaultMessage: "There are validation errors in your document. Please fix them before saving."
|
2473
|
+
})
|
2317
2474
|
});
|
2318
|
-
|
2319
|
-
|
2320
|
-
|
2321
|
-
|
2322
|
-
|
2323
|
-
|
2324
|
-
|
2325
|
-
|
2326
|
-
|
2327
|
-
|
2328
|
-
|
2329
|
-
|
2330
|
-
|
2331
|
-
model,
|
2332
|
-
documentId: cloneMatch.params.origin,
|
2333
|
-
params
|
2334
|
-
},
|
2335
|
-
transformData(document)
|
2336
|
-
);
|
2337
|
-
if ("data" in res) {
|
2338
|
-
navigate(
|
2339
|
-
{
|
2340
|
-
pathname: `../${res.data.documentId}`,
|
2341
|
-
search: rawQuery
|
2342
|
-
},
|
2343
|
-
{ relative: "path" }
|
2344
|
-
);
|
2345
|
-
} else if ("error" in res && isBaseQueryError(res.error) && res.error.name === "ValidationError") {
|
2346
|
-
setErrors(formatValidationErrors(res.error));
|
2347
|
-
}
|
2348
|
-
} else if (documentId || collectionType === SINGLE_TYPES) {
|
2349
|
-
const res = await update(
|
2475
|
+
return;
|
2476
|
+
}
|
2477
|
+
if (isCloning) {
|
2478
|
+
const res = await clone(
|
2479
|
+
{
|
2480
|
+
model,
|
2481
|
+
documentId: cloneMatch.params.origin,
|
2482
|
+
params
|
2483
|
+
},
|
2484
|
+
transformData(document)
|
2485
|
+
);
|
2486
|
+
if ("data" in res) {
|
2487
|
+
navigate(
|
2350
2488
|
{
|
2351
|
-
|
2352
|
-
|
2353
|
-
documentId,
|
2354
|
-
params
|
2489
|
+
pathname: `../${res.data.documentId}`,
|
2490
|
+
search: rawQuery
|
2355
2491
|
},
|
2356
|
-
|
2492
|
+
{ relative: "path" }
|
2357
2493
|
);
|
2358
|
-
|
2359
|
-
|
2360
|
-
|
2361
|
-
|
2362
|
-
|
2494
|
+
} else if ("error" in res && isBaseQueryError(res.error) && res.error.name === "ValidationError") {
|
2495
|
+
setErrors(formatValidationErrors(res.error));
|
2496
|
+
}
|
2497
|
+
} else if (documentId || collectionType === SINGLE_TYPES) {
|
2498
|
+
const res = await update(
|
2499
|
+
{
|
2500
|
+
collectionType,
|
2501
|
+
model,
|
2502
|
+
documentId,
|
2503
|
+
params
|
2504
|
+
},
|
2505
|
+
transformData(document)
|
2506
|
+
);
|
2507
|
+
if ("error" in res && isBaseQueryError(res.error) && res.error.name === "ValidationError") {
|
2508
|
+
setErrors(formatValidationErrors(res.error));
|
2363
2509
|
} else {
|
2364
|
-
|
2510
|
+
resetForm();
|
2511
|
+
}
|
2512
|
+
} else {
|
2513
|
+
const res = await create(
|
2514
|
+
{
|
2515
|
+
model,
|
2516
|
+
params
|
2517
|
+
},
|
2518
|
+
transformData(document)
|
2519
|
+
);
|
2520
|
+
if ("data" in res && collectionType !== SINGLE_TYPES) {
|
2521
|
+
navigate(
|
2365
2522
|
{
|
2366
|
-
|
2367
|
-
|
2523
|
+
pathname: `../${res.data.documentId}`,
|
2524
|
+
search: rawQuery
|
2368
2525
|
},
|
2369
|
-
|
2526
|
+
{ replace: true, relative: "path" }
|
2370
2527
|
);
|
2371
|
-
|
2372
|
-
|
2373
|
-
{
|
2374
|
-
pathname: `../${res.data.documentId}`,
|
2375
|
-
search: rawQuery
|
2376
|
-
},
|
2377
|
-
{ replace: true, relative: "path" }
|
2378
|
-
);
|
2379
|
-
} else if ("error" in res && isBaseQueryError(res.error) && res.error.name === "ValidationError") {
|
2380
|
-
setErrors(formatValidationErrors(res.error));
|
2381
|
-
}
|
2528
|
+
} else if ("error" in res && isBaseQueryError(res.error) && res.error.name === "ValidationError") {
|
2529
|
+
setErrors(formatValidationErrors(res.error));
|
2382
2530
|
}
|
2383
|
-
} finally {
|
2384
|
-
setSubmitting(false);
|
2385
2531
|
}
|
2532
|
+
} finally {
|
2533
|
+
setSubmitting(false);
|
2386
2534
|
}
|
2535
|
+
}, [
|
2536
|
+
clone,
|
2537
|
+
cloneMatch?.params.origin,
|
2538
|
+
collectionType,
|
2539
|
+
create,
|
2540
|
+
document,
|
2541
|
+
documentId,
|
2542
|
+
formatMessage,
|
2543
|
+
formatValidationErrors,
|
2544
|
+
isCloning,
|
2545
|
+
model,
|
2546
|
+
modified,
|
2547
|
+
navigate,
|
2548
|
+
params,
|
2549
|
+
rawQuery,
|
2550
|
+
resetForm,
|
2551
|
+
setErrors,
|
2552
|
+
setSubmitting,
|
2553
|
+
toggleNotification,
|
2554
|
+
update,
|
2555
|
+
validate
|
2556
|
+
]);
|
2557
|
+
React__namespace.useEffect(() => {
|
2558
|
+
const handleKeyDown = (e) => {
|
2559
|
+
if (e.key === "Enter" && (e.metaKey || e.ctrlKey)) {
|
2560
|
+
e.preventDefault();
|
2561
|
+
handleUpdate();
|
2562
|
+
}
|
2563
|
+
};
|
2564
|
+
window.addEventListener("keydown", handleKeyDown);
|
2565
|
+
return () => {
|
2566
|
+
window.removeEventListener("keydown", handleKeyDown);
|
2567
|
+
};
|
2568
|
+
}, [handleUpdate]);
|
2569
|
+
return {
|
2570
|
+
/**
|
2571
|
+
* Disabled when:
|
2572
|
+
* - the form is submitting
|
2573
|
+
* - the document is not modified & we're not cloning (you can save a clone entity straight away)
|
2574
|
+
* - the active tab is the published tab
|
2575
|
+
*/
|
2576
|
+
disabled: isSubmitting || !modified && !isCloning || activeTab === "published",
|
2577
|
+
label: formatMessage({
|
2578
|
+
id: "global.save",
|
2579
|
+
defaultMessage: "Save"
|
2580
|
+
}),
|
2581
|
+
onClick: handleUpdate
|
2387
2582
|
};
|
2388
2583
|
};
|
2389
2584
|
UpdateAction.type = "update";
|
2585
|
+
UpdateAction.position = "panel";
|
2390
2586
|
const UNPUBLISH_DRAFT_OPTIONS = {
|
2391
2587
|
KEEP: "keep",
|
2392
2588
|
DISCARD: "discard"
|
@@ -2509,6 +2705,7 @@ const UnpublishAction$1 = ({
|
|
2509
2705
|
};
|
2510
2706
|
};
|
2511
2707
|
UnpublishAction$1.type = "unpublish";
|
2708
|
+
UnpublishAction$1.position = "panel";
|
2512
2709
|
const DiscardAction = ({
|
2513
2710
|
activeTab,
|
2514
2711
|
documentId,
|
@@ -2559,6 +2756,7 @@ const DiscardAction = ({
|
|
2559
2756
|
};
|
2560
2757
|
};
|
2561
2758
|
DiscardAction.type = "discard";
|
2759
|
+
DiscardAction.position = "panel";
|
2562
2760
|
const DEFAULT_ACTIONS = [PublishAction$1, UpdateAction, UnpublishAction$1, DiscardAction];
|
2563
2761
|
const intervals = ["years", "months", "days", "hours", "minutes", "seconds"];
|
2564
2762
|
const RelativeTime = React__namespace.forwardRef(
|
@@ -2571,7 +2769,7 @@ const RelativeTime = React__namespace.forwardRef(
|
|
2571
2769
|
});
|
2572
2770
|
const unit = intervals.find((intervalUnit) => {
|
2573
2771
|
return interval[intervalUnit] > 0 && Object.keys(interval).includes(intervalUnit);
|
2574
|
-
});
|
2772
|
+
}) ?? "seconds";
|
2575
2773
|
const relativeTime = dateFns.isPast(timestamp) ? -interval[unit] : interval[unit];
|
2576
2774
|
const customInterval = customIntervals.find(
|
2577
2775
|
(custom) => interval[custom.unit] < custom.threshold
|
@@ -2605,10 +2803,10 @@ const getDisplayName = ({
|
|
2605
2803
|
return email ?? "";
|
2606
2804
|
};
|
2607
2805
|
const capitalise = (str) => str.charAt(0).toUpperCase() + str.slice(1);
|
2608
|
-
const DocumentStatus = ({ status = "draft", ...restProps }) => {
|
2806
|
+
const DocumentStatus = ({ status = "draft", size = "S", ...restProps }) => {
|
2609
2807
|
const statusVariant = status === "draft" ? "secondary" : status === "published" ? "success" : "alternative";
|
2610
2808
|
const { formatMessage } = reactIntl.useIntl();
|
2611
|
-
return /* @__PURE__ */ jsxRuntime.jsx(designSystem.Status, { ...restProps,
|
2809
|
+
return /* @__PURE__ */ jsxRuntime.jsx(designSystem.Status, { ...restProps, size, variant: statusVariant, children: /* @__PURE__ */ jsxRuntime.jsx(designSystem.Typography, { tag: "span", variant: "omega", fontWeight: "bold", children: formatMessage({
|
2612
2810
|
id: `content-manager.containers.List.${status}`,
|
2613
2811
|
defaultMessage: capitalise(status)
|
2614
2812
|
}) }) });
|
@@ -2616,12 +2814,18 @@ const DocumentStatus = ({ status = "draft", ...restProps }) => {
|
|
2616
2814
|
const Header = ({ isCreating, status, title: documentTitle = "Untitled" }) => {
|
2617
2815
|
const { formatMessage } = reactIntl.useIntl();
|
2618
2816
|
const isCloning = reactRouterDom.useMatch(CLONE_PATH) !== null;
|
2817
|
+
const params = reactRouterDom.useParams();
|
2619
2818
|
const title = isCreating ? formatMessage({
|
2620
2819
|
id: "content-manager.containers.edit.title.new",
|
2621
2820
|
defaultMessage: "Create an entry"
|
2622
2821
|
}) : documentTitle;
|
2623
2822
|
return /* @__PURE__ */ jsxRuntime.jsxs(designSystem.Flex, { direction: "column", alignItems: "flex-start", paddingTop: 6, paddingBottom: 4, gap: 2, children: [
|
2624
|
-
/* @__PURE__ */ jsxRuntime.jsx(
|
2823
|
+
/* @__PURE__ */ jsxRuntime.jsx(
|
2824
|
+
strapiAdmin.BackButton,
|
2825
|
+
{
|
2826
|
+
fallback: params.collectionType === SINGLE_TYPES ? void 0 : `../${COLLECTION_TYPES}/${params.slug}`
|
2827
|
+
}
|
2828
|
+
),
|
2625
2829
|
/* @__PURE__ */ jsxRuntime.jsxs(designSystem.Flex, { width: "100%", justifyContent: "space-between", gap: "80px", alignItems: "flex-start", children: [
|
2626
2830
|
/* @__PURE__ */ jsxRuntime.jsx(designSystem.Typography, { variant: "alpha", tag: "h1", children: title }),
|
2627
2831
|
/* @__PURE__ */ jsxRuntime.jsx(HeaderToolbar, {})
|
@@ -2672,7 +2876,7 @@ const HeaderToolbar = () => {
|
|
2672
2876
|
meta: isCloning ? void 0 : meta,
|
2673
2877
|
collectionType
|
2674
2878
|
},
|
2675
|
-
descriptions: plugins["content-manager"].apis.getDocumentActions(),
|
2879
|
+
descriptions: plugins["content-manager"].apis.getDocumentActions("header"),
|
2676
2880
|
children: (actions2) => {
|
2677
2881
|
const headerActions = actions2.filter((action) => {
|
2678
2882
|
const positions = Array.isArray(action.position) ? action.position : [action.position];
|
@@ -2880,6 +3084,7 @@ const ConfigureTheViewAction = ({ collectionType, model }) => {
|
|
2880
3084
|
};
|
2881
3085
|
};
|
2882
3086
|
ConfigureTheViewAction.type = "configure-the-view";
|
3087
|
+
ConfigureTheViewAction.position = "header";
|
2883
3088
|
const EditTheModelAction = ({ model }) => {
|
2884
3089
|
const navigate = reactRouterDom.useNavigate();
|
2885
3090
|
const { formatMessage } = reactIntl.useIntl();
|
@@ -2896,6 +3101,7 @@ const EditTheModelAction = ({ model }) => {
|
|
2896
3101
|
};
|
2897
3102
|
};
|
2898
3103
|
EditTheModelAction.type = "edit-the-model";
|
3104
|
+
EditTheModelAction.position = "header";
|
2899
3105
|
const DeleteAction$1 = ({ documentId, model, collectionType, document }) => {
|
2900
3106
|
const navigate = reactRouterDom.useNavigate();
|
2901
3107
|
const { formatMessage } = reactIntl.useIntl();
|
@@ -2969,6 +3175,7 @@ const DeleteAction$1 = ({ documentId, model, collectionType, document }) => {
|
|
2969
3175
|
};
|
2970
3176
|
};
|
2971
3177
|
DeleteAction$1.type = "delete";
|
3178
|
+
DeleteAction$1.position = ["header", "table-row"];
|
2972
3179
|
const DEFAULT_HEADER_ACTIONS = [EditTheModelAction, ConfigureTheViewAction, DeleteAction$1];
|
2973
3180
|
const Panels = () => {
|
2974
3181
|
const isCloning = reactRouterDom.useMatch(CLONE_PATH) !== null;
|
@@ -3031,7 +3238,7 @@ const ActionsPanelContent = () => {
|
|
3031
3238
|
strapiAdmin.DescriptionComponentRenderer,
|
3032
3239
|
{
|
3033
3240
|
props,
|
3034
|
-
descriptions: plugins["content-manager"].apis.getDocumentActions(),
|
3241
|
+
descriptions: plugins["content-manager"].apis.getDocumentActions("panel"),
|
3035
3242
|
children: (actions2) => /* @__PURE__ */ jsxRuntime.jsx(DocumentActions, { actions: actions2 })
|
3036
3243
|
}
|
3037
3244
|
),
|
@@ -3308,18 +3515,10 @@ const SelectedEntriesTableContent = ({
|
|
3308
3515
|
search: row.locale && `?plugins[i18n][locale]=${row.locale}`
|
3309
3516
|
},
|
3310
3517
|
state: { from: pathname },
|
3311
|
-
label: formatMessage(
|
3312
|
-
|
3313
|
-
|
3314
|
-
|
3315
|
-
{
|
3316
|
-
id: "content-manager.components.ListViewHelperPluginTable.row-line",
|
3317
|
-
defaultMessage: "item line {number}"
|
3318
|
-
},
|
3319
|
-
{ number: index2 + 1 }
|
3320
|
-
)
|
3321
|
-
}
|
3322
|
-
),
|
3518
|
+
label: formatMessage({
|
3519
|
+
id: "content-manager.bulk-publish.edit",
|
3520
|
+
defaultMessage: "Edit"
|
3521
|
+
}),
|
3323
3522
|
target: "_blank",
|
3324
3523
|
marginLeft: "auto",
|
3325
3524
|
variant: "ghost",
|
@@ -3493,8 +3692,7 @@ const PublishAction = ({ documents, model }) => {
|
|
3493
3692
|
const refetchList = () => {
|
3494
3693
|
contentManagerApi.util.invalidateTags([{ type: "Document", id: `${model}_LIST` }]);
|
3495
3694
|
};
|
3496
|
-
if (!showPublishButton)
|
3497
|
-
return null;
|
3695
|
+
if (!showPublishButton) return null;
|
3498
3696
|
return {
|
3499
3697
|
actionType: "publish",
|
3500
3698
|
variant: "tertiary",
|
@@ -3562,8 +3760,7 @@ const DeleteAction = ({ documents, model }) => {
|
|
3562
3760
|
selectRow([]);
|
3563
3761
|
}
|
3564
3762
|
};
|
3565
|
-
if (!hasDeletePermission)
|
3566
|
-
return null;
|
3763
|
+
if (!hasDeletePermission) return null;
|
3567
3764
|
return {
|
3568
3765
|
variant: "danger-light",
|
3569
3766
|
label: formatMessage({ id: "global.delete", defaultMessage: "Delete" }),
|
@@ -3612,8 +3809,7 @@ const UnpublishAction = ({ documents, model }) => {
|
|
3612
3809
|
}
|
3613
3810
|
};
|
3614
3811
|
const showUnpublishButton = hasDraftAndPublishEnabled && hasPublishPermission && documents.some((entry) => entry.status === "published" || entry.status === "modified");
|
3615
|
-
if (!showUnpublishButton)
|
3616
|
-
return null;
|
3812
|
+
if (!showUnpublishButton) return null;
|
3617
3813
|
return {
|
3618
3814
|
variant: "tertiary",
|
3619
3815
|
label: formatMessage({ id: "app.utils.unpublish", defaultMessage: "Unpublish" }),
|
@@ -3718,7 +3914,7 @@ const TableActions = ({ document }) => {
|
|
3718
3914
|
strapiAdmin.DescriptionComponentRenderer,
|
3719
3915
|
{
|
3720
3916
|
props,
|
3721
|
-
descriptions: plugins["content-manager"].apis.getDocumentActions().filter((action) => action.name !== "PublishAction"),
|
3917
|
+
descriptions: plugins["content-manager"].apis.getDocumentActions("table-row").filter((action) => action.name !== "PublishAction"),
|
3722
3918
|
children: (actions2) => {
|
3723
3919
|
const tableRowActions = actions2.filter((action) => {
|
3724
3920
|
const positions = Array.isArray(action.position) ? action.position : [action.position];
|
@@ -3777,6 +3973,7 @@ const EditAction = ({ documentId }) => {
|
|
3777
3973
|
};
|
3778
3974
|
};
|
3779
3975
|
EditAction.type = "edit";
|
3976
|
+
EditAction.position = "table-row";
|
3780
3977
|
const StyledPencil = styledComponents.styled(Icons.Pencil)`
|
3781
3978
|
path {
|
3782
3979
|
fill: currentColor;
|
@@ -3853,6 +4050,7 @@ const CloneAction = ({ model, documentId }) => {
|
|
3853
4050
|
};
|
3854
4051
|
};
|
3855
4052
|
CloneAction.type = "clone";
|
4053
|
+
CloneAction.position = "table-row";
|
3856
4054
|
const StyledDuplicate = styledComponents.styled(Icons.Duplicate)`
|
3857
4055
|
path {
|
3858
4056
|
fill: currentColor;
|
@@ -3939,7 +4137,14 @@ class ContentManagerPlugin {
|
|
3939
4137
|
addDocumentHeaderAction: this.addDocumentHeaderAction.bind(this),
|
3940
4138
|
addEditViewSidePanel: this.addEditViewSidePanel.bind(this),
|
3941
4139
|
getBulkActions: () => this.bulkActions,
|
3942
|
-
getDocumentActions: () =>
|
4140
|
+
getDocumentActions: (position) => {
|
4141
|
+
if (position) {
|
4142
|
+
return this.documentActions.filter(
|
4143
|
+
(action) => action.position == void 0 || [action.position].flat().includes(position)
|
4144
|
+
);
|
4145
|
+
}
|
4146
|
+
return this.documentActions;
|
4147
|
+
},
|
3943
4148
|
getEditViewSidePanels: () => this.editViewSidePanels,
|
3944
4149
|
getHeaderActions: () => this.headerActions
|
3945
4150
|
}
|
@@ -3949,10 +4154,8 @@ class ContentManagerPlugin {
|
|
3949
4154
|
const getPrintableType = (value) => {
|
3950
4155
|
const nativeType = typeof value;
|
3951
4156
|
if (nativeType === "object") {
|
3952
|
-
if (value === null)
|
3953
|
-
|
3954
|
-
if (Array.isArray(value))
|
3955
|
-
return "array";
|
4157
|
+
if (value === null) return "null";
|
4158
|
+
if (Array.isArray(value)) return "array";
|
3956
4159
|
if (value instanceof Object && value.constructor.name !== "Object") {
|
3957
4160
|
return value.constructor.name;
|
3958
4161
|
}
|
@@ -3963,17 +4166,27 @@ const HistoryAction = ({ model, document }) => {
|
|
3963
4166
|
const { formatMessage } = reactIntl.useIntl();
|
3964
4167
|
const [{ query }] = strapiAdmin.useQueryParams();
|
3965
4168
|
const navigate = reactRouterDom.useNavigate();
|
4169
|
+
const { trackUsage } = strapiAdmin.useTracking();
|
4170
|
+
const { pathname } = reactRouterDom.useLocation();
|
3966
4171
|
const pluginsQueryParams = qs.stringify({ plugins: query.plugins }, { encode: false });
|
3967
4172
|
if (!window.strapi.features.isEnabled("cms-content-history")) {
|
3968
4173
|
return null;
|
3969
4174
|
}
|
4175
|
+
const handleOnClick = () => {
|
4176
|
+
const destination = { pathname: "history", search: pluginsQueryParams };
|
4177
|
+
trackUsage("willNavigate", {
|
4178
|
+
from: pathname,
|
4179
|
+
to: `${pathname}/${destination.pathname}`
|
4180
|
+
});
|
4181
|
+
navigate(destination);
|
4182
|
+
};
|
3970
4183
|
return {
|
3971
4184
|
icon: /* @__PURE__ */ jsxRuntime.jsx(Icons.ClockCounterClockwise, {}),
|
3972
4185
|
label: formatMessage({
|
3973
4186
|
id: "content-manager.history.document-action",
|
3974
4187
|
defaultMessage: "Content History"
|
3975
4188
|
}),
|
3976
|
-
onClick:
|
4189
|
+
onClick: handleOnClick,
|
3977
4190
|
disabled: (
|
3978
4191
|
/**
|
3979
4192
|
* The user is creating a new document.
|
@@ -3995,6 +4208,7 @@ const HistoryAction = ({ model, document }) => {
|
|
3995
4208
|
};
|
3996
4209
|
};
|
3997
4210
|
HistoryAction.type = "history";
|
4211
|
+
HistoryAction.position = "header";
|
3998
4212
|
const historyAdmin = {
|
3999
4213
|
bootstrap(app) {
|
4000
4214
|
const { addDocumentAction } = app.getPlugin("content-manager").apis;
|
@@ -4057,10 +4271,18 @@ const previewApi = contentManagerApi.injectEndpoints({
|
|
4057
4271
|
})
|
4058
4272
|
});
|
4059
4273
|
const { useGetPreviewUrlQuery } = previewApi;
|
4274
|
+
const ConditionalTooltip = ({ isShown, label, children }) => {
|
4275
|
+
if (isShown) {
|
4276
|
+
return /* @__PURE__ */ jsxRuntime.jsx(designSystem.Tooltip, { label, children });
|
4277
|
+
}
|
4278
|
+
return children;
|
4279
|
+
};
|
4060
4280
|
const PreviewSidePanel = ({ model, documentId, document }) => {
|
4061
4281
|
const { formatMessage } = reactIntl.useIntl();
|
4062
4282
|
const { trackUsage } = strapiAdmin.useTracking();
|
4283
|
+
const { pathname } = reactRouterDom.useLocation();
|
4063
4284
|
const [{ query }] = strapiAdmin.useQueryParams();
|
4285
|
+
const isModified = strapiAdmin.useForm("PreviewSidePanel", (state) => state.modified);
|
4064
4286
|
const { data, error } = useGetPreviewUrlQuery({
|
4065
4287
|
params: {
|
4066
4288
|
contentType: model
|
@@ -4074,33 +4296,43 @@ const PreviewSidePanel = ({ model, documentId, document }) => {
|
|
4074
4296
|
if (!data?.data?.url || error) {
|
4075
4297
|
return null;
|
4076
4298
|
}
|
4077
|
-
const
|
4078
|
-
|
4299
|
+
const trackNavigation = () => {
|
4300
|
+
const destinationPathname = pathname.replace(/\/$/, "") + "/preview";
|
4301
|
+
trackUsage("willNavigate", { from: pathname, to: destinationPathname });
|
4079
4302
|
};
|
4080
4303
|
return {
|
4081
4304
|
title: formatMessage({ id: "content-manager.preview.panel.title", defaultMessage: "Preview" }),
|
4082
|
-
content: /* @__PURE__ */ jsxRuntime.jsx(
|
4083
|
-
|
4305
|
+
content: /* @__PURE__ */ jsxRuntime.jsx(
|
4306
|
+
ConditionalTooltip,
|
4084
4307
|
{
|
4085
|
-
|
4086
|
-
|
4087
|
-
|
4088
|
-
|
4089
|
-
|
4090
|
-
children:
|
4091
|
-
|
4092
|
-
|
4093
|
-
|
4308
|
+
label: formatMessage({
|
4309
|
+
id: "content-manager.preview.panel.button-disabled-tooltip",
|
4310
|
+
defaultMessage: "Please save to open the preview"
|
4311
|
+
}),
|
4312
|
+
isShown: isModified,
|
4313
|
+
children: /* @__PURE__ */ jsxRuntime.jsx(designSystem.Box, { cursor: "not-allowed", width: "100%", children: /* @__PURE__ */ jsxRuntime.jsx(
|
4314
|
+
designSystem.Button,
|
4315
|
+
{
|
4316
|
+
variant: "tertiary",
|
4317
|
+
tag: reactRouterDom.Link,
|
4318
|
+
to: { pathname: "preview", search: qs.stringify(query, { encode: false }) },
|
4319
|
+
onClick: trackNavigation,
|
4320
|
+
width: "100%",
|
4321
|
+
disabled: isModified,
|
4322
|
+
pointerEvents: isModified ? "none" : void 0,
|
4323
|
+
tabIndex: isModified ? -1 : void 0,
|
4324
|
+
children: formatMessage({
|
4325
|
+
id: "content-manager.preview.panel.button",
|
4326
|
+
defaultMessage: "Open preview"
|
4327
|
+
})
|
4328
|
+
}
|
4329
|
+
) })
|
4094
4330
|
}
|
4095
|
-
)
|
4331
|
+
)
|
4096
4332
|
};
|
4097
4333
|
};
|
4098
|
-
const FEATURE_ID = "preview";
|
4099
4334
|
const previewAdmin = {
|
4100
4335
|
bootstrap(app) {
|
4101
|
-
if (!window.strapi.future.isEnabled(FEATURE_ID)) {
|
4102
|
-
return;
|
4103
|
-
}
|
4104
4336
|
const contentManagerPluginApis = app.getPlugin("content-manager").apis;
|
4105
4337
|
contentManagerPluginApis.addEditViewSidePanel([PreviewSidePanel]);
|
4106
4338
|
}
|
@@ -4124,7 +4356,7 @@ const index = {
|
|
4124
4356
|
app.router.addRoute({
|
4125
4357
|
path: "content-manager/*",
|
4126
4358
|
lazy: async () => {
|
4127
|
-
const { Layout } = await Promise.resolve().then(() => require("./layout-
|
4359
|
+
const { Layout } = await Promise.resolve().then(() => require("./layout-4TbKVax8.js"));
|
4128
4360
|
return {
|
4129
4361
|
Component: Layout
|
4130
4362
|
};
|
@@ -4144,7 +4376,7 @@ const index = {
|
|
4144
4376
|
async registerTrads({ locales }) {
|
4145
4377
|
const importedTrads = await Promise.all(
|
4146
4378
|
locales.map((locale) => {
|
4147
|
-
return __variableDynamicImportRuntimeHelper(/* @__PURE__ */ Object.assign({ "./translations/ar.json": () => Promise.resolve().then(() => require("./ar-BUUWXIYu.js")), "./translations/ca.json": () => Promise.resolve().then(() => require("./ca-Cmk45QO6.js")), "./translations/cs.json": () => Promise.resolve().then(() => require("./cs-CkJy6B2v.js")), "./translations/de.json": () => Promise.resolve().then(() => require("./de-CCEmbAah.js")), "./translations/en.json": () => Promise.resolve().then(() => require("./en-
|
4379
|
+
return __variableDynamicImportRuntimeHelper(/* @__PURE__ */ Object.assign({ "./translations/ar.json": () => Promise.resolve().then(() => require("./ar-BUUWXIYu.js")), "./translations/ca.json": () => Promise.resolve().then(() => require("./ca-Cmk45QO6.js")), "./translations/cs.json": () => Promise.resolve().then(() => require("./cs-CkJy6B2v.js")), "./translations/de.json": () => Promise.resolve().then(() => require("./de-CCEmbAah.js")), "./translations/en.json": () => Promise.resolve().then(() => require("./en-CzCnBk4S.js")), "./translations/es.json": () => Promise.resolve().then(() => require("./es-9K52xZIr.js")), "./translations/eu.json": () => Promise.resolve().then(() => require("./eu-VDH-3ovk.js")), "./translations/fr.json": () => Promise.resolve().then(() => require("./fr-B2Kyv8Z9.js")), "./translations/gu.json": () => Promise.resolve().then(() => require("./gu-BRmF601H.js")), "./translations/hi.json": () => Promise.resolve().then(() => require("./hi-CCJBptSq.js")), "./translations/hu.json": () => Promise.resolve().then(() => require("./hu-sNV_yLYy.js")), "./translations/id.json": () => Promise.resolve().then(() => require("./id-B5Ser98A.js")), "./translations/it.json": () => Promise.resolve().then(() => require("./it-DkBIs7vD.js")), "./translations/ja.json": () => Promise.resolve().then(() => require("./ja-7sfIbjxE.js")), "./translations/ko.json": () => Promise.resolve().then(() => require("./ko-woFZPmLk.js")), "./translations/ml.json": () => Promise.resolve().then(() => require("./ml-C2W8N8k1.js")), "./translations/ms.json": () => Promise.resolve().then(() => require("./ms-BuFotyP_.js")), "./translations/nl.json": () => Promise.resolve().then(() => require("./nl-bbEOHChV.js")), "./translations/pl.json": () => Promise.resolve().then(() => require("./pl-uzwG-hk7.js")), "./translations/pt-BR.json": () => Promise.resolve().then(() => require("./pt-BR-BiOz37D9.js")), "./translations/pt.json": () => Promise.resolve().then(() => require("./pt-CeXQuq50.js")), "./translations/ru.json": () => Promise.resolve().then(() => require("./ru-BT3ybNny.js")), "./translations/sa.json": () => Promise.resolve().then(() => require("./sa-CcvkYInH.js")), "./translations/sk.json": () => Promise.resolve().then(() => require("./sk-CvY09Xjv.js")), "./translations/sv.json": () => Promise.resolve().then(() => require("./sv-MYDuzgvT.js")), "./translations/th.json": () => Promise.resolve().then(() => require("./th-D9_GfAjc.js")), "./translations/tr.json": () => Promise.resolve().then(() => require("./tr-D9UH-O_R.js")), "./translations/uk.json": () => Promise.resolve().then(() => require("./uk-C8EiqJY7.js")), "./translations/vi.json": () => Promise.resolve().then(() => require("./vi-CJlYDheJ.js")), "./translations/zh-Hans.json": () => Promise.resolve().then(() => require("./zh-Hans-9kOncHGw.js")), "./translations/zh.json": () => Promise.resolve().then(() => require("./zh-CQQfszqR.js")) }), `./translations/${locale}.json`, 3).then(({ default: data }) => {
|
4148
4380
|
return {
|
4149
4381
|
data: prefixPluginTranslations(data, PLUGIN_ID),
|
4150
4382
|
locale
|
@@ -4166,7 +4398,6 @@ exports.CLONE_PATH = CLONE_PATH;
|
|
4166
4398
|
exports.COLLECTION_TYPES = COLLECTION_TYPES;
|
4167
4399
|
exports.CREATOR_FIELDS = CREATOR_FIELDS;
|
4168
4400
|
exports.DEFAULT_SETTINGS = DEFAULT_SETTINGS;
|
4169
|
-
exports.DOCUMENT_META_FIELDS = DOCUMENT_META_FIELDS;
|
4170
4401
|
exports.DocumentRBAC = DocumentRBAC;
|
4171
4402
|
exports.DocumentStatus = DocumentStatus;
|
4172
4403
|
exports.HOOKS = HOOKS;
|
@@ -4183,13 +4414,17 @@ exports.checkIfAttributeIsDisplayable = checkIfAttributeIsDisplayable;
|
|
4183
4414
|
exports.contentManagerApi = contentManagerApi;
|
4184
4415
|
exports.convertEditLayoutToFieldLayouts = convertEditLayoutToFieldLayouts;
|
4185
4416
|
exports.convertListLayoutToFieldLayouts = convertListLayoutToFieldLayouts;
|
4417
|
+
exports.createDefaultForm = createDefaultForm;
|
4186
4418
|
exports.createYupSchema = createYupSchema;
|
4187
4419
|
exports.extractContentTypeComponents = extractContentTypeComponents;
|
4188
4420
|
exports.getDisplayName = getDisplayName;
|
4189
4421
|
exports.getMainField = getMainField;
|
4190
4422
|
exports.getTranslation = getTranslation;
|
4191
4423
|
exports.index = index;
|
4424
|
+
exports.prepareTempKeys = prepareTempKeys;
|
4425
|
+
exports.removeFieldsThatDontExistOnSchema = removeFieldsThatDontExistOnSchema;
|
4192
4426
|
exports.setInitialData = setInitialData;
|
4427
|
+
exports.transformDocument = transformDocument;
|
4193
4428
|
exports.useContentManagerContext = useContentManagerContext;
|
4194
4429
|
exports.useContentTypeSchema = useContentTypeSchema;
|
4195
4430
|
exports.useDoc = useDoc;
|
@@ -4204,4 +4439,4 @@ exports.useGetContentTypeConfigurationQuery = useGetContentTypeConfigurationQuer
|
|
4204
4439
|
exports.useGetInitialDataQuery = useGetInitialDataQuery;
|
4205
4440
|
exports.useGetPreviewUrlQuery = useGetPreviewUrlQuery;
|
4206
4441
|
exports.useUpdateContentTypeConfigurationMutation = useUpdateContentTypeConfigurationMutation;
|
4207
|
-
//# sourceMappingURL=index-
|
4442
|
+
//# sourceMappingURL=index-EXJvmn4t.js.map
|