@strapi/content-manager 0.0.0-next.8414b837972392b1d362ae53b86b5da1eb2ad05c → 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/{ComponentConfigurationPage-BTR_hQow.js → ComponentConfigurationPage-DMxUlNOo.js} +3 -3
- package/dist/_chunks/{ComponentConfigurationPage-BTR_hQow.js.map → ComponentConfigurationPage-DMxUlNOo.js.map} +1 -1
- package/dist/_chunks/{ComponentConfigurationPage-bLQr82ce.mjs → ComponentConfigurationPage-baEkO-OV.mjs} +3 -3
- package/dist/_chunks/{ComponentConfigurationPage-bLQr82ce.mjs.map → ComponentConfigurationPage-baEkO-OV.mjs.map} +1 -1
- package/dist/_chunks/{EditConfigurationPage-z39Wv3E6.js → EditConfigurationPage-CXxV7mKn.js} +3 -3
- package/dist/_chunks/{EditConfigurationPage-z39Wv3E6.js.map → EditConfigurationPage-CXxV7mKn.js.map} +1 -1
- package/dist/_chunks/{EditConfigurationPage-BhRSnUsL.mjs → EditConfigurationPage-YR8-4VCS.mjs} +3 -3
- package/dist/_chunks/{EditConfigurationPage-BhRSnUsL.mjs.map → EditConfigurationPage-YR8-4VCS.mjs.map} +1 -1
- package/dist/_chunks/{EditViewPage-wujOq90c.js → EditViewPage-BfR6jAR6.js} +13 -76
- package/dist/_chunks/EditViewPage-BfR6jAR6.js.map +1 -0
- package/dist/_chunks/{EditViewPage-BCjNxNlY.mjs → EditViewPage-DFF7c27p.mjs} +11 -74
- package/dist/_chunks/EditViewPage-DFF7c27p.mjs.map +1 -0
- package/dist/_chunks/{Form-D7mexvm3.js → Form-CjcMRP5A.js} +2 -2
- package/dist/_chunks/{Form-D7mexvm3.js.map → Form-CjcMRP5A.js.map} +1 -1
- package/dist/_chunks/{Form-BZgvE8C8.mjs → Form-MSOSfGGN.mjs} +2 -2
- package/dist/_chunks/{Form-BZgvE8C8.mjs.map → Form-MSOSfGGN.mjs.map} +1 -1
- package/dist/_chunks/{History-DYl2A8Z_.js → History-BgZ7gVuF.js} +43 -19
- package/dist/_chunks/History-BgZ7gVuF.js.map +1 -0
- package/dist/_chunks/{History-CqNgxkqK.mjs → History-WOQNVho-.mjs} +32 -8
- package/dist/_chunks/History-WOQNVho-.mjs.map +1 -0
- package/dist/_chunks/{Field-Byr3mPTl.mjs → Input-BkKwZ6Qt.mjs} +1131 -1188
- package/dist/_chunks/Input-BkKwZ6Qt.mjs.map +1 -0
- package/dist/_chunks/{Field-B5QXnctJ.js → Input-BwOibhc3.js} +1212 -1269
- package/dist/_chunks/Input-BwOibhc3.js.map +1 -0
- package/dist/_chunks/{ListConfigurationPage-BbQjzKkQ.mjs → ListConfigurationPage-BeXfr6uW.mjs} +2 -2
- package/dist/_chunks/{ListConfigurationPage-BbQjzKkQ.mjs.map → ListConfigurationPage-BeXfr6uW.mjs.map} +1 -1
- package/dist/_chunks/{ListConfigurationPage-BXnu_OoY.js → ListConfigurationPage-DnJ3nbwL.js} +2 -2
- package/dist/_chunks/{ListConfigurationPage-BXnu_OoY.js.map → ListConfigurationPage-DnJ3nbwL.js.map} +1 -1
- package/dist/_chunks/{ListViewPage-BtSi8C1l.js → ListViewPage-CJFDudKl.js} +13 -10
- package/dist/_chunks/{ListViewPage-BtSi8C1l.js.map → ListViewPage-CJFDudKl.js.map} +1 -1
- package/dist/_chunks/{ListViewPage-D4ofkbjR.mjs → ListViewPage-VK2v44Q1.mjs} +8 -5
- package/dist/_chunks/{ListViewPage-D4ofkbjR.mjs.map → ListViewPage-VK2v44Q1.mjs.map} +1 -1
- package/dist/_chunks/{NoContentTypePage-DyUx5mXh.mjs → NoContentTypePage-T8ttty6K.mjs} +2 -2
- package/dist/_chunks/{NoContentTypePage-DyUx5mXh.mjs.map → NoContentTypePage-T8ttty6K.mjs.map} +1 -1
- package/dist/_chunks/{NoContentTypePage-CitJeOq4.js → NoContentTypePage-en2PwWgI.js} +2 -2
- package/dist/_chunks/{NoContentTypePage-CitJeOq4.js.map → NoContentTypePage-en2PwWgI.js.map} +1 -1
- package/dist/_chunks/{NoPermissionsPage-DzgWz0M-.js → NoPermissionsPage-CcjILry3.js} +2 -2
- package/dist/_chunks/{NoPermissionsPage-DzgWz0M-.js.map → NoPermissionsPage-CcjILry3.js.map} +1 -1
- package/dist/_chunks/{NoPermissionsPage-DhIiyWkk.mjs → NoPermissionsPage-CokBHhhy.mjs} +2 -2
- package/dist/_chunks/{NoPermissionsPage-DhIiyWkk.mjs.map → NoPermissionsPage-CokBHhhy.mjs.map} +1 -1
- package/dist/_chunks/{Preview-BaYGJ0nb.mjs → Preview-BF81YhRj.mjs} +10 -16
- package/dist/_chunks/Preview-BF81YhRj.mjs.map +1 -0
- package/dist/_chunks/{Preview-DfNx8Ke-.js → Preview-DgzAuzWQ.js} +10 -16
- package/dist/_chunks/Preview-DgzAuzWQ.js.map +1 -0
- package/dist/_chunks/{Relations-DuKCaXrv.js → Relations-1O-JcM4t.js} +3 -3
- package/dist/_chunks/{Relations-DuKCaXrv.js.map → Relations-1O-JcM4t.js.map} +1 -1
- package/dist/_chunks/{Relations-DM2yUTST.mjs → Relations-BncdhGCd.mjs} +3 -3
- package/dist/_chunks/{Relations-DM2yUTST.mjs.map → Relations-BncdhGCd.mjs.map} +1 -1
- package/dist/_chunks/{en-Dtk_ot79.mjs → en-BZaUty0m.mjs} +8 -2
- package/dist/_chunks/{en-Dtk_ot79.mjs.map → en-BZaUty0m.mjs.map} +1 -1
- package/dist/_chunks/{en-BK8Xyl5I.js → en-CzCnBk4S.js} +8 -2
- package/dist/_chunks/{en-BK8Xyl5I.js.map → en-CzCnBk4S.js.map} +1 -1
- package/dist/_chunks/{index-DVAIIsOs.mjs → index-DiluOUp6.mjs} +214 -48
- package/dist/_chunks/index-DiluOUp6.mjs.map +1 -0
- package/dist/_chunks/{index-BUWEmX8m.js → index-EXJvmn4t.js} +197 -31
- package/dist/_chunks/index-EXJvmn4t.js.map +1 -0
- package/dist/_chunks/{layout-C3fN7Ejz.js → layout-4TbKVax8.js} +3 -3
- package/dist/_chunks/{layout-C3fN7Ejz.js.map → layout-4TbKVax8.js.map} +1 -1
- package/dist/_chunks/{layout-Bxsv5mP7.mjs → layout-mSwsYzxv.mjs} +3 -3
- package/dist/_chunks/{layout-Bxsv5mP7.mjs.map → layout-mSwsYzxv.mjs.map} +1 -1
- package/dist/_chunks/{relations-o3pPhzY4.mjs → relations--YOvQBqv.mjs} +2 -2
- package/dist/_chunks/{relations-o3pPhzY4.mjs.map → relations--YOvQBqv.mjs.map} +1 -1
- package/dist/_chunks/{relations-BPZKAoEY.js → relations-Ai6Izh7h.js} +2 -2
- package/dist/_chunks/{relations-BPZKAoEY.js.map → relations-Ai6Izh7h.js.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/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/DocumentStatus.d.ts +1 -1
- 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/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 -16
- 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 +156 -138
- package/dist/server/index.js.map +1 -1
- package/dist/server/index.mjs +157 -139
- 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/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 +6 -7
- package/dist/_chunks/EditViewPage-BCjNxNlY.mjs.map +0 -1
- package/dist/_chunks/EditViewPage-wujOq90c.js.map +0 -1
- package/dist/_chunks/Field-B5QXnctJ.js.map +0 -1
- package/dist/_chunks/Field-Byr3mPTl.mjs.map +0 -1
- package/dist/_chunks/History-CqNgxkqK.mjs.map +0 -1
- package/dist/_chunks/History-DYl2A8Z_.js.map +0 -1
- package/dist/_chunks/Preview-BaYGJ0nb.mjs.map +0 -1
- package/dist/_chunks/Preview-DfNx8Ke-.js.map +0 -1
- package/dist/_chunks/index-BUWEmX8m.js.map +0 -1
- package/dist/_chunks/index-DVAIIsOs.mjs.map +0 -1
- package/dist/_chunks/useDebounce-CtcjDB3L.js.map +0 -1
- package/dist/_chunks/useDebounce-DmuSJIF3.mjs.map +0 -1
@@ -9,8 +9,9 @@ const reactIntl = require("react-intl");
|
|
9
9
|
const reactRouterDom = require("react-router-dom");
|
10
10
|
const styledComponents = require("styled-components");
|
11
11
|
const yup = require("yup");
|
12
|
-
const
|
12
|
+
const fractionalIndexing = require("fractional-indexing");
|
13
13
|
const pipe = require("lodash/fp/pipe");
|
14
|
+
const qs = require("qs");
|
14
15
|
const dateFns = require("date-fns");
|
15
16
|
const toolkit = require("@reduxjs/toolkit");
|
16
17
|
const _interopDefault = (e) => e && e.__esModule ? e : { default: e };
|
@@ -187,6 +188,113 @@ const extractAndDedupeFields = (permissions = []) => permissions.flatMap((permis
|
|
187
188
|
(field, index2, arr) => arr.indexOf(field) === index2 && typeof field === "string"
|
188
189
|
);
|
189
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
|
+
};
|
190
298
|
const contentManagerApi = strapiAdmin.adminApi.enhanceEndpoints({
|
191
299
|
addTagTypes: [
|
192
300
|
"ComponentConfiguration",
|
@@ -196,7 +304,8 @@ const contentManagerApi = strapiAdmin.adminApi.enhanceEndpoints({
|
|
196
304
|
"InitialData",
|
197
305
|
"HistoryVersion",
|
198
306
|
"Relations",
|
199
|
-
"UidAvailability"
|
307
|
+
"UidAvailability",
|
308
|
+
"RecentDocumentList"
|
200
309
|
]
|
201
310
|
});
|
202
311
|
const documentApi = contentManagerApi.injectEndpoints({
|
@@ -214,7 +323,7 @@ const documentApi = contentManagerApi.injectEndpoints({
|
|
214
323
|
if (error) {
|
215
324
|
return [];
|
216
325
|
}
|
217
|
-
return [{ type: "Document", id: `${model}_LIST` }];
|
326
|
+
return [{ type: "Document", id: `${model}_LIST` }, "RecentDocumentList"];
|
218
327
|
}
|
219
328
|
}),
|
220
329
|
cloneDocument: builder.mutation({
|
@@ -228,7 +337,8 @@ const documentApi = contentManagerApi.injectEndpoints({
|
|
228
337
|
}),
|
229
338
|
invalidatesTags: (_result, _error, { model }) => [
|
230
339
|
{ type: "Document", id: `${model}_LIST` },
|
231
|
-
{ type: "UidAvailability", id: model }
|
340
|
+
{ type: "UidAvailability", id: model },
|
341
|
+
"RecentDocumentList"
|
232
342
|
]
|
233
343
|
}),
|
234
344
|
/**
|
@@ -247,8 +357,21 @@ const documentApi = contentManagerApi.injectEndpoints({
|
|
247
357
|
invalidatesTags: (result, _error, { model }) => [
|
248
358
|
{ type: "Document", id: `${model}_LIST` },
|
249
359
|
"Relations",
|
250
|
-
{ type: "UidAvailability", id: model }
|
251
|
-
|
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
|
+
}
|
252
375
|
}),
|
253
376
|
deleteDocument: builder.mutation({
|
254
377
|
query: ({ collectionType, model, documentId, params }) => ({
|
@@ -259,7 +382,8 @@ const documentApi = contentManagerApi.injectEndpoints({
|
|
259
382
|
}
|
260
383
|
}),
|
261
384
|
invalidatesTags: (_result, _error, { collectionType, model }) => [
|
262
|
-
{ type: "Document", id: collectionType !== SINGLE_TYPES ? `${model}_LIST` : model }
|
385
|
+
{ type: "Document", id: collectionType !== SINGLE_TYPES ? `${model}_LIST` : model },
|
386
|
+
"RecentDocumentList"
|
263
387
|
]
|
264
388
|
}),
|
265
389
|
deleteManyDocuments: builder.mutation({
|
@@ -271,7 +395,10 @@ const documentApi = contentManagerApi.injectEndpoints({
|
|
271
395
|
params
|
272
396
|
}
|
273
397
|
}),
|
274
|
-
invalidatesTags: (_res, _error, { model }) => [
|
398
|
+
invalidatesTags: (_res, _error, { model }) => [
|
399
|
+
{ type: "Document", id: `${model}_LIST` },
|
400
|
+
"RecentDocumentList"
|
401
|
+
]
|
275
402
|
}),
|
276
403
|
discardDocument: builder.mutation({
|
277
404
|
query: ({ collectionType, model, documentId, params }) => ({
|
@@ -289,7 +416,8 @@ const documentApi = contentManagerApi.injectEndpoints({
|
|
289
416
|
},
|
290
417
|
{ type: "Document", id: `${model}_LIST` },
|
291
418
|
"Relations",
|
292
|
-
{ type: "UidAvailability", id: model }
|
419
|
+
{ type: "UidAvailability", id: model },
|
420
|
+
"RecentDocumentList"
|
293
421
|
];
|
294
422
|
}
|
295
423
|
}),
|
@@ -384,7 +512,8 @@ const documentApi = contentManagerApi.injectEndpoints({
|
|
384
512
|
id: collectionType !== SINGLE_TYPES ? `${model}_${documentId}` : model
|
385
513
|
},
|
386
514
|
{ type: "Document", id: `${model}_LIST` },
|
387
|
-
"Relations"
|
515
|
+
"Relations",
|
516
|
+
"RecentDocumentList"
|
388
517
|
];
|
389
518
|
}
|
390
519
|
}),
|
@@ -415,7 +544,9 @@ const documentApi = contentManagerApi.injectEndpoints({
|
|
415
544
|
id: collectionType !== SINGLE_TYPES ? `${model}_${documentId}` : model
|
416
545
|
},
|
417
546
|
"Relations",
|
418
|
-
{ type: "UidAvailability", id: model }
|
547
|
+
{ type: "UidAvailability", id: model },
|
548
|
+
"RecentDocumentList",
|
549
|
+
"RecentDocumentList"
|
419
550
|
];
|
420
551
|
},
|
421
552
|
async onQueryStarted({ data, ...patch }, { dispatch, queryFulfilled }) {
|
@@ -445,7 +576,8 @@ const documentApi = contentManagerApi.injectEndpoints({
|
|
445
576
|
{
|
446
577
|
type: "Document",
|
447
578
|
id: collectionType !== SINGLE_TYPES ? `${model}_${documentId}` : model
|
448
|
-
}
|
579
|
+
},
|
580
|
+
"RecentDocumentList"
|
449
581
|
];
|
450
582
|
}
|
451
583
|
}),
|
@@ -458,7 +590,10 @@ const documentApi = contentManagerApi.injectEndpoints({
|
|
458
590
|
params
|
459
591
|
}
|
460
592
|
}),
|
461
|
-
invalidatesTags: (_res, _error, { model, documentIds }) =>
|
593
|
+
invalidatesTags: (_res, _error, { model, documentIds }) => [
|
594
|
+
...documentIds.map((id) => ({ type: "Document", id: `${model}_${id}` })),
|
595
|
+
"RecentDocumentList"
|
596
|
+
]
|
462
597
|
})
|
463
598
|
})
|
464
599
|
});
|
@@ -1129,6 +1264,7 @@ const convertListLayoutToFieldLayouts = (columns, attributes = {}, metadatas, co
|
|
1129
1264
|
const useDocument = (args, opts) => {
|
1130
1265
|
const { toggleNotification } = strapiAdmin.useNotification();
|
1131
1266
|
const { _unstableFormatAPIError: formatAPIError } = strapiAdmin.useAPIErrorHandler();
|
1267
|
+
const { formatMessage } = reactIntl.useIntl();
|
1132
1268
|
const {
|
1133
1269
|
currentData: data,
|
1134
1270
|
isLoading: isLoadingDocument,
|
@@ -1138,12 +1274,27 @@ const useDocument = (args, opts) => {
|
|
1138
1274
|
...opts,
|
1139
1275
|
skip: !args.documentId && args.collectionType !== SINGLE_TYPES || opts?.skip
|
1140
1276
|
});
|
1277
|
+
const document = data?.data;
|
1278
|
+
const meta = data?.meta;
|
1141
1279
|
const {
|
1142
1280
|
components,
|
1143
1281
|
schema,
|
1144
1282
|
schemas,
|
1145
1283
|
isLoading: isLoadingSchema
|
1146
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
|
+
};
|
1147
1298
|
React__namespace.useEffect(() => {
|
1148
1299
|
if (error) {
|
1149
1300
|
toggleNotification({
|
@@ -1159,14 +1310,14 @@ const useDocument = (args, opts) => {
|
|
1159
1310
|
return createYupSchema(schema.attributes, components);
|
1160
1311
|
}, [schema, components]);
|
1161
1312
|
const validate = React__namespace.useCallback(
|
1162
|
-
(
|
1313
|
+
(document2) => {
|
1163
1314
|
if (!validationSchema) {
|
1164
1315
|
throw new Error(
|
1165
1316
|
"There is no validation schema generated, this is likely due to the schema not being loaded yet."
|
1166
1317
|
);
|
1167
1318
|
}
|
1168
1319
|
try {
|
1169
|
-
validationSchema.validateSync(
|
1320
|
+
validationSchema.validateSync(document2, { abortEarly: false, strict: true });
|
1170
1321
|
return null;
|
1171
1322
|
} catch (error2) {
|
1172
1323
|
if (error2 instanceof yup.ValidationError) {
|
@@ -1177,17 +1328,29 @@ const useDocument = (args, opts) => {
|
|
1177
1328
|
},
|
1178
1329
|
[validationSchema]
|
1179
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
|
+
);
|
1180
1341
|
const isLoading = isLoadingDocument || isFetchingDocument || isLoadingSchema;
|
1181
1342
|
const hasError = !!error;
|
1182
1343
|
return {
|
1183
1344
|
components,
|
1184
|
-
document
|
1185
|
-
meta
|
1345
|
+
document,
|
1346
|
+
meta,
|
1186
1347
|
isLoading,
|
1187
1348
|
hasError,
|
1188
1349
|
schema,
|
1189
1350
|
schemas,
|
1190
|
-
validate
|
1351
|
+
validate,
|
1352
|
+
getTitle,
|
1353
|
+
getInitialFormValues
|
1191
1354
|
};
|
1192
1355
|
};
|
1193
1356
|
const useDoc = () => {
|
@@ -1688,7 +1851,7 @@ const useDocumentActions = () => {
|
|
1688
1851
|
};
|
1689
1852
|
};
|
1690
1853
|
const ProtectedHistoryPage = React__namespace.lazy(
|
1691
|
-
() => Promise.resolve().then(() => require("./History-
|
1854
|
+
() => Promise.resolve().then(() => require("./History-BgZ7gVuF.js")).then((mod) => ({ default: mod.ProtectedHistoryPage }))
|
1692
1855
|
);
|
1693
1856
|
const routes$2 = [
|
1694
1857
|
{
|
@@ -1701,7 +1864,7 @@ const routes$2 = [
|
|
1701
1864
|
}
|
1702
1865
|
];
|
1703
1866
|
const ProtectedPreviewPage = React__namespace.lazy(
|
1704
|
-
() => Promise.resolve().then(() => require("./Preview-
|
1867
|
+
() => Promise.resolve().then(() => require("./Preview-DgzAuzWQ.js")).then((mod) => ({ default: mod.ProtectedPreviewPage }))
|
1705
1868
|
);
|
1706
1869
|
const routes$1 = [
|
1707
1870
|
{
|
@@ -1714,31 +1877,31 @@ const routes$1 = [
|
|
1714
1877
|
}
|
1715
1878
|
];
|
1716
1879
|
const ProtectedEditViewPage = React.lazy(
|
1717
|
-
() => Promise.resolve().then(() => require("./EditViewPage-
|
1880
|
+
() => Promise.resolve().then(() => require("./EditViewPage-BfR6jAR6.js")).then((mod) => ({ default: mod.ProtectedEditViewPage }))
|
1718
1881
|
);
|
1719
1882
|
const ProtectedListViewPage = React.lazy(
|
1720
|
-
() => Promise.resolve().then(() => require("./ListViewPage-
|
1883
|
+
() => Promise.resolve().then(() => require("./ListViewPage-CJFDudKl.js")).then((mod) => ({ default: mod.ProtectedListViewPage }))
|
1721
1884
|
);
|
1722
1885
|
const ProtectedListConfiguration = React.lazy(
|
1723
|
-
() => Promise.resolve().then(() => require("./ListConfigurationPage-
|
1886
|
+
() => Promise.resolve().then(() => require("./ListConfigurationPage-DnJ3nbwL.js")).then((mod) => ({
|
1724
1887
|
default: mod.ProtectedListConfiguration
|
1725
1888
|
}))
|
1726
1889
|
);
|
1727
1890
|
const ProtectedEditConfigurationPage = React.lazy(
|
1728
|
-
() => Promise.resolve().then(() => require("./EditConfigurationPage-
|
1891
|
+
() => Promise.resolve().then(() => require("./EditConfigurationPage-CXxV7mKn.js")).then((mod) => ({
|
1729
1892
|
default: mod.ProtectedEditConfigurationPage
|
1730
1893
|
}))
|
1731
1894
|
);
|
1732
1895
|
const ProtectedComponentConfigurationPage = React.lazy(
|
1733
|
-
() => Promise.resolve().then(() => require("./ComponentConfigurationPage-
|
1896
|
+
() => Promise.resolve().then(() => require("./ComponentConfigurationPage-DMxUlNOo.js")).then((mod) => ({
|
1734
1897
|
default: mod.ProtectedComponentConfigurationPage
|
1735
1898
|
}))
|
1736
1899
|
);
|
1737
1900
|
const NoPermissions = React.lazy(
|
1738
|
-
() => Promise.resolve().then(() => require("./NoPermissionsPage-
|
1901
|
+
() => Promise.resolve().then(() => require("./NoPermissionsPage-CcjILry3.js")).then((mod) => ({ default: mod.NoPermissions }))
|
1739
1902
|
);
|
1740
1903
|
const NoContentType = React.lazy(
|
1741
|
-
() => Promise.resolve().then(() => require("./NoContentTypePage-
|
1904
|
+
() => Promise.resolve().then(() => require("./NoContentTypePage-en2PwWgI.js")).then((mod) => ({ default: mod.NoContentType }))
|
1742
1905
|
);
|
1743
1906
|
const CollectionTypePages = () => {
|
1744
1907
|
const { collectionType } = reactRouterDom.useParams();
|
@@ -4193,7 +4356,7 @@ const index = {
|
|
4193
4356
|
app.router.addRoute({
|
4194
4357
|
path: "content-manager/*",
|
4195
4358
|
lazy: async () => {
|
4196
|
-
const { Layout } = await Promise.resolve().then(() => require("./layout-
|
4359
|
+
const { Layout } = await Promise.resolve().then(() => require("./layout-4TbKVax8.js"));
|
4197
4360
|
return {
|
4198
4361
|
Component: Layout
|
4199
4362
|
};
|
@@ -4213,7 +4376,7 @@ const index = {
|
|
4213
4376
|
async registerTrads({ locales }) {
|
4214
4377
|
const importedTrads = await Promise.all(
|
4215
4378
|
locales.map((locale) => {
|
4216
|
-
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 }) => {
|
4217
4380
|
return {
|
4218
4381
|
data: prefixPluginTranslations(data, PLUGIN_ID),
|
4219
4382
|
locale
|
@@ -4235,7 +4398,6 @@ exports.CLONE_PATH = CLONE_PATH;
|
|
4235
4398
|
exports.COLLECTION_TYPES = COLLECTION_TYPES;
|
4236
4399
|
exports.CREATOR_FIELDS = CREATOR_FIELDS;
|
4237
4400
|
exports.DEFAULT_SETTINGS = DEFAULT_SETTINGS;
|
4238
|
-
exports.DOCUMENT_META_FIELDS = DOCUMENT_META_FIELDS;
|
4239
4401
|
exports.DocumentRBAC = DocumentRBAC;
|
4240
4402
|
exports.DocumentStatus = DocumentStatus;
|
4241
4403
|
exports.HOOKS = HOOKS;
|
@@ -4252,13 +4414,17 @@ exports.checkIfAttributeIsDisplayable = checkIfAttributeIsDisplayable;
|
|
4252
4414
|
exports.contentManagerApi = contentManagerApi;
|
4253
4415
|
exports.convertEditLayoutToFieldLayouts = convertEditLayoutToFieldLayouts;
|
4254
4416
|
exports.convertListLayoutToFieldLayouts = convertListLayoutToFieldLayouts;
|
4417
|
+
exports.createDefaultForm = createDefaultForm;
|
4255
4418
|
exports.createYupSchema = createYupSchema;
|
4256
4419
|
exports.extractContentTypeComponents = extractContentTypeComponents;
|
4257
4420
|
exports.getDisplayName = getDisplayName;
|
4258
4421
|
exports.getMainField = getMainField;
|
4259
4422
|
exports.getTranslation = getTranslation;
|
4260
4423
|
exports.index = index;
|
4424
|
+
exports.prepareTempKeys = prepareTempKeys;
|
4425
|
+
exports.removeFieldsThatDontExistOnSchema = removeFieldsThatDontExistOnSchema;
|
4261
4426
|
exports.setInitialData = setInitialData;
|
4427
|
+
exports.transformDocument = transformDocument;
|
4262
4428
|
exports.useContentManagerContext = useContentManagerContext;
|
4263
4429
|
exports.useContentTypeSchema = useContentTypeSchema;
|
4264
4430
|
exports.useDoc = useDoc;
|
@@ -4273,4 +4439,4 @@ exports.useGetContentTypeConfigurationQuery = useGetContentTypeConfigurationQuer
|
|
4273
4439
|
exports.useGetInitialDataQuery = useGetInitialDataQuery;
|
4274
4440
|
exports.useGetPreviewUrlQuery = useGetPreviewUrlQuery;
|
4275
4441
|
exports.useUpdateContentTypeConfigurationMutation = useUpdateContentTypeConfigurationMutation;
|
4276
|
-
//# sourceMappingURL=index-
|
4442
|
+
//# sourceMappingURL=index-EXJvmn4t.js.map
|