@strapi/content-manager 0.0.0-experimental.0af49f5c5ec496b0fad61ac9bfd4d0127b89d8d3 → 0.0.0-experimental.0e4ee97541bf8b600fc5272e0fee2b733aaf283b
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-CtIa3aa2.mjs → ComponentConfigurationPage-D4H-v0et.mjs} +3 -3
- package/dist/_chunks/{ComponentConfigurationPage-CtIa3aa2.mjs.map → ComponentConfigurationPage-D4H-v0et.mjs.map} +1 -1
- package/dist/_chunks/{ComponentConfigurationPage-BLWQy8ru.js → ComponentConfigurationPage-DdkVGfXC.js} +3 -3
- package/dist/_chunks/{ComponentConfigurationPage-BLWQy8ru.js.map → ComponentConfigurationPage-DdkVGfXC.js.map} +1 -1
- package/dist/_chunks/{EditConfigurationPage-DsPR2DVk.mjs → EditConfigurationPage-D1nvB7Br.mjs} +3 -3
- package/dist/_chunks/{EditConfigurationPage-DsPR2DVk.mjs.map → EditConfigurationPage-D1nvB7Br.mjs.map} +1 -1
- package/dist/_chunks/{EditConfigurationPage-RQkymxCy.js → EditConfigurationPage-LYEvR4fW.js} +3 -3
- package/dist/_chunks/{EditConfigurationPage-RQkymxCy.js.map → EditConfigurationPage-LYEvR4fW.js.map} +1 -1
- package/dist/_chunks/{EditViewPage-BPyVuPfM.mjs → EditViewPage-Bcnff6Vd.mjs} +11 -74
- package/dist/_chunks/EditViewPage-Bcnff6Vd.mjs.map +1 -0
- package/dist/_chunks/{EditViewPage-B-kExt8C.js → EditViewPage-DqelJ9UK.js} +13 -76
- package/dist/_chunks/EditViewPage-DqelJ9UK.js.map +1 -0
- package/dist/_chunks/{Form-BFi4MXMT.js → Form-CnHfBeiB.js} +2 -2
- package/dist/_chunks/{Form-BFi4MXMT.js.map → Form-CnHfBeiB.js.map} +1 -1
- package/dist/_chunks/{Form-C1IcWm1u.mjs → Form-CzPCJi3B.mjs} +2 -2
- package/dist/_chunks/{Form-C1IcWm1u.mjs.map → Form-CzPCJi3B.mjs.map} +1 -1
- package/dist/_chunks/{History-04ChQ4pl.mjs → History-CcmSn3Mj.mjs} +4 -4
- package/dist/_chunks/{History-04ChQ4pl.mjs.map → History-CcmSn3Mj.mjs.map} +1 -1
- package/dist/_chunks/{History-wjcK4L0C.js → History-zArjENzj.js} +15 -15
- package/dist/_chunks/{History-wjcK4L0C.js.map → History-zArjENzj.js.map} +1 -1
- package/dist/_chunks/{Field-DPIsQRre.js → Input-CDHKQd7o.js} +1150 -1182
- package/dist/_chunks/Input-CDHKQd7o.js.map +1 -0
- package/dist/_chunks/{Field-Dltnt1km.mjs → Input-aV8SSoTa.mjs} +1193 -1225
- package/dist/_chunks/Input-aV8SSoTa.mjs.map +1 -0
- package/dist/_chunks/{ListConfigurationPage-BYqPYLSU.mjs → ListConfigurationPage-BPvzENJJ.mjs} +2 -2
- package/dist/_chunks/{ListConfigurationPage-BYqPYLSU.mjs.map → ListConfigurationPage-BPvzENJJ.mjs.map} +1 -1
- package/dist/_chunks/{ListConfigurationPage-CRbxIC3J.js → ListConfigurationPage-ByZAO_9H.js} +2 -2
- package/dist/_chunks/{ListConfigurationPage-CRbxIC3J.js.map → ListConfigurationPage-ByZAO_9H.js.map} +1 -1
- package/dist/_chunks/{ListViewPage-D5NY9183.js → ListViewPage-BVKBeQAA.js} +13 -10
- package/dist/_chunks/{ListViewPage-D5NY9183.js.map → ListViewPage-BVKBeQAA.js.map} +1 -1
- package/dist/_chunks/{ListViewPage-FU2LBuhl.mjs → ListViewPage-HljQVnFH.mjs} +8 -5
- package/dist/_chunks/{ListViewPage-FU2LBuhl.mjs.map → ListViewPage-HljQVnFH.mjs.map} +1 -1
- package/dist/_chunks/{NoContentTypePage-BgQVE_Qb.js → NoContentTypePage-BV5zfDxr.js} +2 -2
- package/dist/_chunks/{NoContentTypePage-BgQVE_Qb.js.map → NoContentTypePage-BV5zfDxr.js.map} +1 -1
- package/dist/_chunks/{NoContentTypePage-DCKUkwb8.mjs → NoContentTypePage-BfHaSM-K.mjs} +2 -2
- package/dist/_chunks/{NoContentTypePage-DCKUkwb8.mjs.map → NoContentTypePage-BfHaSM-K.mjs.map} +1 -1
- package/dist/_chunks/{NoPermissionsPage-jqve7C8l.mjs → NoPermissionsPage-D6ze2nQL.mjs} +2 -2
- package/dist/_chunks/{NoPermissionsPage-jqve7C8l.mjs.map → NoPermissionsPage-D6ze2nQL.mjs.map} +1 -1
- package/dist/_chunks/{NoPermissionsPage-C5jwn70o.js → NoPermissionsPage-vdNpc6jb.js} +2 -2
- package/dist/_chunks/{NoPermissionsPage-C5jwn70o.js.map → NoPermissionsPage-vdNpc6jb.js.map} +1 -1
- package/dist/_chunks/{Preview-DaOihysv.js → Preview-DEHdENT1.js} +8 -15
- package/dist/_chunks/Preview-DEHdENT1.js.map +1 -0
- package/dist/_chunks/{Preview-BMYN548c.mjs → Preview-vfWOtPG5.mjs} +8 -15
- package/dist/_chunks/Preview-vfWOtPG5.mjs.map +1 -0
- package/dist/_chunks/{Relations-gscPkxjF.mjs → Relations-B7_hbF0w.mjs} +6 -5
- package/dist/_chunks/Relations-B7_hbF0w.mjs.map +1 -0
- package/dist/_chunks/{Relations-CTGM7Hv5.js → Relations-DcoOBejP.js} +6 -5
- package/dist/_chunks/Relations-DcoOBejP.js.map +1 -0
- package/dist/_chunks/{en-BzQmavmK.js → en-BR48D_RH.js} +3 -1
- package/dist/_chunks/{en-BzQmavmK.js.map → en-BR48D_RH.js.map} +1 -1
- package/dist/_chunks/{en-CSxLmrh1.mjs → en-D65uIF6Y.mjs} +3 -1
- package/dist/_chunks/{en-CSxLmrh1.mjs.map → en-D65uIF6Y.mjs.map} +1 -1
- package/dist/_chunks/{fr-B2Kyv8Z9.js → fr-C43IbhA_.js} +4 -1
- package/dist/_chunks/{fr-B2Kyv8Z9.js.map → fr-C43IbhA_.js.map} +1 -1
- package/dist/_chunks/{fr--pg5jUbt.mjs → fr-DBseuRuB.mjs} +4 -1
- package/dist/_chunks/{fr--pg5jUbt.mjs.map → fr-DBseuRuB.mjs.map} +1 -1
- package/dist/_chunks/{index-Ca7YWlAA.js → index-CxLSGwnk.js} +254 -57
- package/dist/_chunks/index-CxLSGwnk.js.map +1 -0
- package/dist/_chunks/{index-DqasUQ6Q.mjs → index-EH8ZtHd5.mjs} +273 -76
- package/dist/_chunks/index-EH8ZtHd5.mjs.map +1 -0
- package/dist/_chunks/{layout-W3clJSCy.mjs → layout-CxDMdJ13.mjs} +3 -3
- package/dist/_chunks/{layout-W3clJSCy.mjs.map → layout-CxDMdJ13.mjs.map} +1 -1
- package/dist/_chunks/{layout-BW80JSCd.js → layout-DSeUTfMv.js} +3 -3
- package/dist/_chunks/{layout-BW80JSCd.js.map → layout-DSeUTfMv.js.map} +1 -1
- package/dist/_chunks/{relations-BlDkoeWh.mjs → relations-B8_Uu38Q.mjs} +17 -3
- package/dist/_chunks/relations-B8_Uu38Q.mjs.map +1 -0
- package/dist/_chunks/{relations-C9Usz9k5.js → relations-S5nNKdN3.js} +16 -2
- package/dist/_chunks/relations-S5nNKdN3.js.map +1 -0
- package/dist/_chunks/{useDebounce-CtcjDB3L.js → usePrev-B9w_-eYc.js} +1 -14
- package/dist/_chunks/usePrev-B9w_-eYc.js.map +1 -0
- package/dist/_chunks/usePrev-DH6iah0A.mjs +16 -0
- package/dist/_chunks/usePrev-DH6iah0A.mjs.map +1 -0
- package/dist/admin/index.js +1 -1
- package/dist/admin/index.mjs +5 -5
- package/dist/admin/src/hooks/useDocument.d.ts +19 -2
- 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/package.json +6 -7
- package/dist/_chunks/EditViewPage-B-kExt8C.js.map +0 -1
- package/dist/_chunks/EditViewPage-BPyVuPfM.mjs.map +0 -1
- package/dist/_chunks/Field-DPIsQRre.js.map +0 -1
- package/dist/_chunks/Field-Dltnt1km.mjs.map +0 -1
- package/dist/_chunks/Preview-BMYN548c.mjs.map +0 -1
- package/dist/_chunks/Preview-DaOihysv.js.map +0 -1
- package/dist/_chunks/Relations-CTGM7Hv5.js.map +0 -1
- package/dist/_chunks/Relations-gscPkxjF.mjs.map +0 -1
- package/dist/_chunks/index-Ca7YWlAA.js.map +0 -1
- package/dist/_chunks/index-DqasUQ6Q.mjs.map +0 -1
- package/dist/_chunks/relations-BlDkoeWh.mjs.map +0 -1
- package/dist/_chunks/relations-C9Usz9k5.js.map +0 -1
- package/dist/_chunks/useDebounce-CtcjDB3L.js.map +0 -1
- package/dist/_chunks/useDebounce-DmuSJIF3.mjs +0 -29
- 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",
|
@@ -1156,6 +1264,7 @@ const convertListLayoutToFieldLayouts = (columns, attributes = {}, metadatas, co
|
|
1156
1264
|
const useDocument = (args, opts) => {
|
1157
1265
|
const { toggleNotification } = strapiAdmin.useNotification();
|
1158
1266
|
const { _unstableFormatAPIError: formatAPIError } = strapiAdmin.useAPIErrorHandler();
|
1267
|
+
const { formatMessage } = reactIntl.useIntl();
|
1159
1268
|
const {
|
1160
1269
|
currentData: data,
|
1161
1270
|
isLoading: isLoadingDocument,
|
@@ -1165,12 +1274,27 @@ const useDocument = (args, opts) => {
|
|
1165
1274
|
...opts,
|
1166
1275
|
skip: !args.documentId && args.collectionType !== SINGLE_TYPES || opts?.skip
|
1167
1276
|
});
|
1277
|
+
const document = data?.data;
|
1278
|
+
const meta = data?.meta;
|
1168
1279
|
const {
|
1169
1280
|
components,
|
1170
1281
|
schema,
|
1171
1282
|
schemas,
|
1172
1283
|
isLoading: isLoadingSchema
|
1173
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
|
+
};
|
1174
1298
|
React__namespace.useEffect(() => {
|
1175
1299
|
if (error) {
|
1176
1300
|
toggleNotification({
|
@@ -1186,14 +1310,14 @@ const useDocument = (args, opts) => {
|
|
1186
1310
|
return createYupSchema(schema.attributes, components);
|
1187
1311
|
}, [schema, components]);
|
1188
1312
|
const validate = React__namespace.useCallback(
|
1189
|
-
(
|
1313
|
+
(document2) => {
|
1190
1314
|
if (!validationSchema) {
|
1191
1315
|
throw new Error(
|
1192
1316
|
"There is no validation schema generated, this is likely due to the schema not being loaded yet."
|
1193
1317
|
);
|
1194
1318
|
}
|
1195
1319
|
try {
|
1196
|
-
validationSchema.validateSync(
|
1320
|
+
validationSchema.validateSync(document2, { abortEarly: false, strict: true });
|
1197
1321
|
return null;
|
1198
1322
|
} catch (error2) {
|
1199
1323
|
if (error2 instanceof yup.ValidationError) {
|
@@ -1204,17 +1328,29 @@ const useDocument = (args, opts) => {
|
|
1204
1328
|
},
|
1205
1329
|
[validationSchema]
|
1206
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
|
+
);
|
1207
1341
|
const isLoading = isLoadingDocument || isFetchingDocument || isLoadingSchema;
|
1208
1342
|
const hasError = !!error;
|
1209
1343
|
return {
|
1210
1344
|
components,
|
1211
|
-
document
|
1212
|
-
meta
|
1345
|
+
document,
|
1346
|
+
meta,
|
1213
1347
|
isLoading,
|
1214
1348
|
hasError,
|
1215
1349
|
schema,
|
1216
1350
|
schemas,
|
1217
|
-
validate
|
1351
|
+
validate,
|
1352
|
+
getTitle,
|
1353
|
+
getInitialFormValues
|
1218
1354
|
};
|
1219
1355
|
};
|
1220
1356
|
const useDoc = () => {
|
@@ -1715,7 +1851,7 @@ const useDocumentActions = () => {
|
|
1715
1851
|
};
|
1716
1852
|
};
|
1717
1853
|
const ProtectedHistoryPage = React__namespace.lazy(
|
1718
|
-
() => Promise.resolve().then(() => require("./History-
|
1854
|
+
() => Promise.resolve().then(() => require("./History-zArjENzj.js")).then((mod) => ({ default: mod.ProtectedHistoryPage }))
|
1719
1855
|
);
|
1720
1856
|
const routes$2 = [
|
1721
1857
|
{
|
@@ -1728,7 +1864,7 @@ const routes$2 = [
|
|
1728
1864
|
}
|
1729
1865
|
];
|
1730
1866
|
const ProtectedPreviewPage = React__namespace.lazy(
|
1731
|
-
() => Promise.resolve().then(() => require("./Preview-
|
1867
|
+
() => Promise.resolve().then(() => require("./Preview-DEHdENT1.js")).then((mod) => ({ default: mod.ProtectedPreviewPage }))
|
1732
1868
|
);
|
1733
1869
|
const routes$1 = [
|
1734
1870
|
{
|
@@ -1741,31 +1877,31 @@ const routes$1 = [
|
|
1741
1877
|
}
|
1742
1878
|
];
|
1743
1879
|
const ProtectedEditViewPage = React.lazy(
|
1744
|
-
() => Promise.resolve().then(() => require("./EditViewPage-
|
1880
|
+
() => Promise.resolve().then(() => require("./EditViewPage-DqelJ9UK.js")).then((mod) => ({ default: mod.ProtectedEditViewPage }))
|
1745
1881
|
);
|
1746
1882
|
const ProtectedListViewPage = React.lazy(
|
1747
|
-
() => Promise.resolve().then(() => require("./ListViewPage-
|
1883
|
+
() => Promise.resolve().then(() => require("./ListViewPage-BVKBeQAA.js")).then((mod) => ({ default: mod.ProtectedListViewPage }))
|
1748
1884
|
);
|
1749
1885
|
const ProtectedListConfiguration = React.lazy(
|
1750
|
-
() => Promise.resolve().then(() => require("./ListConfigurationPage-
|
1886
|
+
() => Promise.resolve().then(() => require("./ListConfigurationPage-ByZAO_9H.js")).then((mod) => ({
|
1751
1887
|
default: mod.ProtectedListConfiguration
|
1752
1888
|
}))
|
1753
1889
|
);
|
1754
1890
|
const ProtectedEditConfigurationPage = React.lazy(
|
1755
|
-
() => Promise.resolve().then(() => require("./EditConfigurationPage-
|
1891
|
+
() => Promise.resolve().then(() => require("./EditConfigurationPage-LYEvR4fW.js")).then((mod) => ({
|
1756
1892
|
default: mod.ProtectedEditConfigurationPage
|
1757
1893
|
}))
|
1758
1894
|
);
|
1759
1895
|
const ProtectedComponentConfigurationPage = React.lazy(
|
1760
|
-
() => Promise.resolve().then(() => require("./ComponentConfigurationPage-
|
1896
|
+
() => Promise.resolve().then(() => require("./ComponentConfigurationPage-DdkVGfXC.js")).then((mod) => ({
|
1761
1897
|
default: mod.ProtectedComponentConfigurationPage
|
1762
1898
|
}))
|
1763
1899
|
);
|
1764
1900
|
const NoPermissions = React.lazy(
|
1765
|
-
() => Promise.resolve().then(() => require("./NoPermissionsPage-
|
1901
|
+
() => Promise.resolve().then(() => require("./NoPermissionsPage-vdNpc6jb.js")).then((mod) => ({ default: mod.NoPermissions }))
|
1766
1902
|
);
|
1767
1903
|
const NoContentType = React.lazy(
|
1768
|
-
() => Promise.resolve().then(() => require("./NoContentTypePage-
|
1904
|
+
() => Promise.resolve().then(() => require("./NoContentTypePage-BV5zfDxr.js")).then((mod) => ({ default: mod.NoContentType }))
|
1769
1905
|
);
|
1770
1906
|
const CollectionTypePages = () => {
|
1771
1907
|
const { collectionType } = reactRouterDom.useParams();
|
@@ -3160,7 +3296,7 @@ const ConfirmBulkActionDialog = ({
|
|
3160
3296
|
] })
|
3161
3297
|
] }) });
|
3162
3298
|
};
|
3163
|
-
const BoldChunk
|
3299
|
+
const BoldChunk = (chunks) => /* @__PURE__ */ jsxRuntime.jsx(designSystem.Typography, { fontWeight: "bold", children: chunks });
|
3164
3300
|
const ConfirmDialogPublishAll = ({
|
3165
3301
|
isOpen,
|
3166
3302
|
onToggleDialog,
|
@@ -3209,7 +3345,7 @@ const ConfirmDialogPublishAll = ({
|
|
3209
3345
|
defaultMessage: "<b>{count} {count, plural, one { relation } other { relations } } out of {entities} { entities, plural, one { entry } other { entries } } {count, plural, one { is } other { are } }</b> not published yet and might lead to unexpected behavior. "
|
3210
3346
|
},
|
3211
3347
|
{
|
3212
|
-
b: BoldChunk
|
3348
|
+
b: BoldChunk,
|
3213
3349
|
count: countDraftRelations,
|
3214
3350
|
entities: selectedEntries.length
|
3215
3351
|
}
|
@@ -3248,6 +3384,16 @@ const ConfirmDialogPublishAll = ({
|
|
3248
3384
|
const TypographyMaxWidth = styledComponents.styled(designSystem.Typography)`
|
3249
3385
|
max-width: 300px;
|
3250
3386
|
`;
|
3387
|
+
const TableComponent = styledComponents.styled(designSystem.RawTable)`
|
3388
|
+
width: 100%;
|
3389
|
+
table-layout: fixed;
|
3390
|
+
td:first-child {
|
3391
|
+
border-right: 1px solid ${({ theme }) => theme.colors.neutral150};
|
3392
|
+
}
|
3393
|
+
td:first-of-type {
|
3394
|
+
padding: ${({ theme }) => theme.spaces[4]};
|
3395
|
+
}
|
3396
|
+
`;
|
3251
3397
|
const formatErrorMessages = (errors, parentKey, formatMessage) => {
|
3252
3398
|
const messages = [];
|
3253
3399
|
Object.entries(errors).forEach(([key, value]) => {
|
@@ -3352,7 +3498,7 @@ const SelectedEntriesTableContent = ({
|
|
3352
3498
|
)
|
3353
3499
|
] }),
|
3354
3500
|
/* @__PURE__ */ jsxRuntime.jsx(strapiAdmin.Table.Loading, {}),
|
3355
|
-
/* @__PURE__ */ jsxRuntime.jsx(strapiAdmin.Table.Body, { children: rowsToDisplay.map((row
|
3501
|
+
/* @__PURE__ */ jsxRuntime.jsx(strapiAdmin.Table.Body, { children: rowsToDisplay.map((row) => /* @__PURE__ */ jsxRuntime.jsxs(strapiAdmin.Table.Row, { children: [
|
3356
3502
|
/* @__PURE__ */ jsxRuntime.jsx(strapiAdmin.Table.CheckboxCell, { id: row.id }),
|
3357
3503
|
/* @__PURE__ */ jsxRuntime.jsx(strapiAdmin.Table.Cell, { children: /* @__PURE__ */ jsxRuntime.jsx(designSystem.Typography, { children: row.id }) }),
|
3358
3504
|
shouldDisplayMainField && /* @__PURE__ */ jsxRuntime.jsx(strapiAdmin.Table.Cell, { children: /* @__PURE__ */ jsxRuntime.jsx(designSystem.Typography, { children: row[mainField] }) }),
|
@@ -3392,7 +3538,73 @@ const SelectedEntriesTableContent = ({
|
|
3392
3538
|
] }, row.id)) })
|
3393
3539
|
] });
|
3394
3540
|
};
|
3395
|
-
const
|
3541
|
+
const PublicationStatusSummary = ({ count, icon, message }) => {
|
3542
|
+
return /* @__PURE__ */ jsxRuntime.jsxs(designSystem.Flex, { justifyContent: "space-between", flex: 1, gap: 3, children: [
|
3543
|
+
/* @__PURE__ */ jsxRuntime.jsxs(designSystem.Flex, { gap: 2, children: [
|
3544
|
+
icon,
|
3545
|
+
/* @__PURE__ */ jsxRuntime.jsx(designSystem.Typography, { children: message })
|
3546
|
+
] }),
|
3547
|
+
/* @__PURE__ */ jsxRuntime.jsx(designSystem.Typography, { fontWeight: "bold", children: count })
|
3548
|
+
] });
|
3549
|
+
};
|
3550
|
+
const PublicationStatusGrid = ({
|
3551
|
+
entriesReadyToPublishCount,
|
3552
|
+
entriesPublishedCount,
|
3553
|
+
entriesModifiedCount,
|
3554
|
+
entriesWithErrorsCount
|
3555
|
+
}) => {
|
3556
|
+
const { formatMessage } = reactIntl.useIntl();
|
3557
|
+
return /* @__PURE__ */ jsxRuntime.jsx(designSystem.Box, { hasRadius: true, borderColor: "neutral150", children: /* @__PURE__ */ jsxRuntime.jsx(TableComponent, { colCount: 2, rowCount: 2, children: /* @__PURE__ */ jsxRuntime.jsxs(designSystem.Tbody, { children: [
|
3558
|
+
/* @__PURE__ */ jsxRuntime.jsxs(designSystem.Tr, { children: [
|
3559
|
+
/* @__PURE__ */ jsxRuntime.jsx(designSystem.Td, { children: /* @__PURE__ */ jsxRuntime.jsx(
|
3560
|
+
PublicationStatusSummary,
|
3561
|
+
{
|
3562
|
+
count: entriesReadyToPublishCount,
|
3563
|
+
icon: /* @__PURE__ */ jsxRuntime.jsx(Icons.CheckCircle, { fill: "success600" }),
|
3564
|
+
message: formatMessage({
|
3565
|
+
id: "app.utils.ready-to-publish",
|
3566
|
+
defaultMessage: "Ready to publish"
|
3567
|
+
})
|
3568
|
+
}
|
3569
|
+
) }),
|
3570
|
+
/* @__PURE__ */ jsxRuntime.jsx(designSystem.Td, { children: /* @__PURE__ */ jsxRuntime.jsx(
|
3571
|
+
PublicationStatusSummary,
|
3572
|
+
{
|
3573
|
+
count: entriesPublishedCount,
|
3574
|
+
icon: /* @__PURE__ */ jsxRuntime.jsx(Icons.CheckCircle, { fill: "success600" }),
|
3575
|
+
message: formatMessage({
|
3576
|
+
id: "app.utils.already-published",
|
3577
|
+
defaultMessage: "Already published"
|
3578
|
+
})
|
3579
|
+
}
|
3580
|
+
) })
|
3581
|
+
] }),
|
3582
|
+
/* @__PURE__ */ jsxRuntime.jsxs(designSystem.Tr, { children: [
|
3583
|
+
/* @__PURE__ */ jsxRuntime.jsx(designSystem.Td, { children: /* @__PURE__ */ jsxRuntime.jsx(
|
3584
|
+
PublicationStatusSummary,
|
3585
|
+
{
|
3586
|
+
count: entriesModifiedCount,
|
3587
|
+
icon: /* @__PURE__ */ jsxRuntime.jsx(Icons.ArrowsCounterClockwise, { fill: "alternative600" }),
|
3588
|
+
message: formatMessage({
|
3589
|
+
id: "content-manager.bulk-publish.modified",
|
3590
|
+
defaultMessage: "Ready to publish changes"
|
3591
|
+
})
|
3592
|
+
}
|
3593
|
+
) }),
|
3594
|
+
/* @__PURE__ */ jsxRuntime.jsx(designSystem.Td, { children: /* @__PURE__ */ jsxRuntime.jsx(
|
3595
|
+
PublicationStatusSummary,
|
3596
|
+
{
|
3597
|
+
count: entriesWithErrorsCount,
|
3598
|
+
icon: /* @__PURE__ */ jsxRuntime.jsx(Icons.CrossCircle, { fill: "danger600" }),
|
3599
|
+
message: formatMessage({
|
3600
|
+
id: "content-manager.bulk-publish.waiting-for-action",
|
3601
|
+
defaultMessage: "Waiting for action"
|
3602
|
+
})
|
3603
|
+
}
|
3604
|
+
) })
|
3605
|
+
] })
|
3606
|
+
] }) }) });
|
3607
|
+
};
|
3396
3608
|
const SelectedEntriesModalContent = ({
|
3397
3609
|
listViewSelectedEntries,
|
3398
3610
|
toggleModal,
|
@@ -3451,7 +3663,6 @@ const SelectedEntriesModalContent = ({
|
|
3451
3663
|
validationErrors: {}
|
3452
3664
|
};
|
3453
3665
|
}, [components, data, schema]);
|
3454
|
-
const [publishedCount, setPublishedCount] = React__namespace.useState(0);
|
3455
3666
|
const [isDialogOpen, setIsDialogOpen] = React__namespace.useState(false);
|
3456
3667
|
const { publishMany: bulkPublishAction } = useDocumentActions();
|
3457
3668
|
const [, { isLoading: isSubmittingForm }] = usePublishManyDocumentsMutation();
|
@@ -3463,53 +3674,36 @@ const SelectedEntriesModalContent = ({
|
|
3463
3674
|
const selectedEntriesWithErrorsCount = selectedEntries.filter(
|
3464
3675
|
({ documentId }) => validationErrors[documentId]
|
3465
3676
|
).length;
|
3466
|
-
const
|
3677
|
+
const selectedEntriesPublishedCount = selectedEntries.filter(
|
3467
3678
|
({ status }) => status === "published"
|
3468
3679
|
).length;
|
3469
|
-
const
|
3680
|
+
const selectedEntriesModifiedCount = selectedEntries.filter(
|
3681
|
+
({ status, documentId }) => status === "modified" && !validationErrors[documentId]
|
3682
|
+
).length;
|
3683
|
+
const selectedEntriesWithNoErrorsCount = selectedEntries.length - selectedEntriesWithErrorsCount - selectedEntriesPublishedCount;
|
3470
3684
|
const toggleDialog = () => setIsDialogOpen((prev) => !prev);
|
3471
3685
|
const handleConfirmBulkPublish = async () => {
|
3472
3686
|
toggleDialog();
|
3473
3687
|
const res = await bulkPublishAction({ model, documentIds: entriesToPublish, params });
|
3474
3688
|
if (!("error" in res)) {
|
3475
|
-
setPublishedCount(res.count);
|
3476
3689
|
const unpublishedEntries = rows.filter((row) => {
|
3477
3690
|
return !entriesToPublish.includes(row.documentId);
|
3478
3691
|
});
|
3479
3692
|
setListViewSelectedDocuments(unpublishedEntries);
|
3480
3693
|
}
|
3481
3694
|
};
|
3482
|
-
const getFormattedCountMessage = () => {
|
3483
|
-
if (publishedCount) {
|
3484
|
-
return formatMessage(
|
3485
|
-
{
|
3486
|
-
id: getTranslation("containers.list.selectedEntriesModal.publishedCount"),
|
3487
|
-
defaultMessage: "<b>{publishedCount}</b> {publishedCount, plural, =0 {entries} one {entry} other {entries}} published. <b>{withErrorsCount}</b> {withErrorsCount, plural, =0 {entries} one {entry} other {entries}} waiting for action."
|
3488
|
-
},
|
3489
|
-
{
|
3490
|
-
publishedCount,
|
3491
|
-
withErrorsCount: selectedEntriesWithErrorsCount,
|
3492
|
-
b: BoldChunk
|
3493
|
-
}
|
3494
|
-
);
|
3495
|
-
}
|
3496
|
-
return formatMessage(
|
3497
|
-
{
|
3498
|
-
id: getTranslation("containers.list.selectedEntriesModal.selectedCount"),
|
3499
|
-
defaultMessage: "<b>{alreadyPublishedCount}</b> {alreadyPublishedCount, plural, =0 {entries} one {entry} other {entries}} already published. <b>{readyToPublishCount}</b> {readyToPublishCount, plural, =0 {entries} one {entry} other {entries}} ready to publish. <b>{withErrorsCount}</b> {withErrorsCount, plural, =0 {entries} one {entry} other {entries}} waiting for action."
|
3500
|
-
},
|
3501
|
-
{
|
3502
|
-
readyToPublishCount: selectedEntriesWithNoErrorsCount,
|
3503
|
-
withErrorsCount: selectedEntriesWithErrorsCount,
|
3504
|
-
alreadyPublishedCount: selectedEntriesPublished,
|
3505
|
-
b: BoldChunk
|
3506
|
-
}
|
3507
|
-
);
|
3508
|
-
};
|
3509
3695
|
return /* @__PURE__ */ jsxRuntime.jsxs(jsxRuntime.Fragment, { children: [
|
3510
3696
|
/* @__PURE__ */ jsxRuntime.jsxs(designSystem.Modal.Body, { children: [
|
3511
|
-
/* @__PURE__ */ jsxRuntime.jsx(
|
3512
|
-
|
3697
|
+
/* @__PURE__ */ jsxRuntime.jsx(
|
3698
|
+
PublicationStatusGrid,
|
3699
|
+
{
|
3700
|
+
entriesReadyToPublishCount: selectedEntriesWithNoErrorsCount - selectedEntriesModifiedCount,
|
3701
|
+
entriesPublishedCount: selectedEntriesPublishedCount,
|
3702
|
+
entriesModifiedCount: selectedEntriesModifiedCount,
|
3703
|
+
entriesWithErrorsCount: selectedEntriesWithErrorsCount
|
3704
|
+
}
|
3705
|
+
),
|
3706
|
+
/* @__PURE__ */ jsxRuntime.jsx(designSystem.Box, { marginTop: 7, children: /* @__PURE__ */ jsxRuntime.jsx(
|
3513
3707
|
SelectedEntriesTableContent,
|
3514
3708
|
{
|
3515
3709
|
isPublishing: isSubmittingForm,
|
@@ -3530,7 +3724,7 @@ const SelectedEntriesModalContent = ({
|
|
3530
3724
|
designSystem.Button,
|
3531
3725
|
{
|
3532
3726
|
onClick: toggleDialog,
|
3533
|
-
disabled: selectedEntries.length === 0 || selectedEntries.length === selectedEntriesWithErrorsCount ||
|
3727
|
+
disabled: selectedEntries.length === 0 || selectedEntries.length === selectedEntriesWithErrorsCount || selectedEntriesPublishedCount === selectedEntries.length || isLoading,
|
3534
3728
|
loading: isSubmittingForm,
|
3535
3729
|
children: formatMessage({ id: "app.utils.publish", defaultMessage: "Publish" })
|
3536
3730
|
}
|
@@ -4220,7 +4414,7 @@ const index = {
|
|
4220
4414
|
app.router.addRoute({
|
4221
4415
|
path: "content-manager/*",
|
4222
4416
|
lazy: async () => {
|
4223
|
-
const { Layout } = await Promise.resolve().then(() => require("./layout-
|
4417
|
+
const { Layout } = await Promise.resolve().then(() => require("./layout-DSeUTfMv.js"));
|
4224
4418
|
return {
|
4225
4419
|
Component: Layout
|
4226
4420
|
};
|
@@ -4240,7 +4434,7 @@ const index = {
|
|
4240
4434
|
async registerTrads({ locales }) {
|
4241
4435
|
const importedTrads = await Promise.all(
|
4242
4436
|
locales.map((locale) => {
|
4243
|
-
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-
|
4437
|
+
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-BR48D_RH.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-C43IbhA_.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 }) => {
|
4244
4438
|
return {
|
4245
4439
|
data: prefixPluginTranslations(data, PLUGIN_ID),
|
4246
4440
|
locale
|
@@ -4262,7 +4456,6 @@ exports.CLONE_PATH = CLONE_PATH;
|
|
4262
4456
|
exports.COLLECTION_TYPES = COLLECTION_TYPES;
|
4263
4457
|
exports.CREATOR_FIELDS = CREATOR_FIELDS;
|
4264
4458
|
exports.DEFAULT_SETTINGS = DEFAULT_SETTINGS;
|
4265
|
-
exports.DOCUMENT_META_FIELDS = DOCUMENT_META_FIELDS;
|
4266
4459
|
exports.DocumentRBAC = DocumentRBAC;
|
4267
4460
|
exports.DocumentStatus = DocumentStatus;
|
4268
4461
|
exports.HOOKS = HOOKS;
|
@@ -4279,13 +4472,17 @@ exports.checkIfAttributeIsDisplayable = checkIfAttributeIsDisplayable;
|
|
4279
4472
|
exports.contentManagerApi = contentManagerApi;
|
4280
4473
|
exports.convertEditLayoutToFieldLayouts = convertEditLayoutToFieldLayouts;
|
4281
4474
|
exports.convertListLayoutToFieldLayouts = convertListLayoutToFieldLayouts;
|
4475
|
+
exports.createDefaultForm = createDefaultForm;
|
4282
4476
|
exports.createYupSchema = createYupSchema;
|
4283
4477
|
exports.extractContentTypeComponents = extractContentTypeComponents;
|
4284
4478
|
exports.getDisplayName = getDisplayName;
|
4285
4479
|
exports.getMainField = getMainField;
|
4286
4480
|
exports.getTranslation = getTranslation;
|
4287
4481
|
exports.index = index;
|
4482
|
+
exports.prepareTempKeys = prepareTempKeys;
|
4483
|
+
exports.removeFieldsThatDontExistOnSchema = removeFieldsThatDontExistOnSchema;
|
4288
4484
|
exports.setInitialData = setInitialData;
|
4485
|
+
exports.transformDocument = transformDocument;
|
4289
4486
|
exports.useContentManagerContext = useContentManagerContext;
|
4290
4487
|
exports.useContentTypeSchema = useContentTypeSchema;
|
4291
4488
|
exports.useDoc = useDoc;
|
@@ -4300,4 +4497,4 @@ exports.useGetContentTypeConfigurationQuery = useGetContentTypeConfigurationQuer
|
|
4300
4497
|
exports.useGetInitialDataQuery = useGetInitialDataQuery;
|
4301
4498
|
exports.useGetPreviewUrlQuery = useGetPreviewUrlQuery;
|
4302
4499
|
exports.useUpdateContentTypeConfigurationMutation = useUpdateContentTypeConfigurationMutation;
|
4303
|
-
//# sourceMappingURL=index-
|
4500
|
+
//# sourceMappingURL=index-CxLSGwnk.js.map
|