@strapi/content-manager 0.0.0-experimental.a9a5a36dd73072c19eadeff5f387e8286b2a4d22 → 0.0.0-experimental.afa3b513b8f95459043f33fb94f4bac03af1474f
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-B1bIXVuX.mjs → ComponentConfigurationPage-CnL10QYC.mjs} +3 -3
- package/dist/_chunks/{ComponentConfigurationPage-B1bIXVuX.mjs.map → ComponentConfigurationPage-CnL10QYC.mjs.map} +1 -1
- package/dist/_chunks/{ComponentConfigurationPage-Bqgx7Mes.js → ComponentConfigurationPage-G4EIirP8.js} +3 -3
- package/dist/_chunks/{ComponentConfigurationPage-Bqgx7Mes.js.map → ComponentConfigurationPage-G4EIirP8.js.map} +1 -1
- package/dist/_chunks/{EditConfigurationPage-BFEwvdMW.js → EditConfigurationPage-B2AA1kVF.js} +3 -3
- package/dist/_chunks/{EditConfigurationPage-BFEwvdMW.js.map → EditConfigurationPage-B2AA1kVF.js.map} +1 -1
- package/dist/_chunks/{EditConfigurationPage-ZO0vOO8q.mjs → EditConfigurationPage-I2kKh9dx.mjs} +3 -3
- package/dist/_chunks/{EditConfigurationPage-ZO0vOO8q.mjs.map → EditConfigurationPage-I2kKh9dx.mjs.map} +1 -1
- package/dist/_chunks/{EditViewPage-DA95Ha6J.js → EditViewPage-CHgoNwlc.js} +19 -8
- package/dist/_chunks/EditViewPage-CHgoNwlc.js.map +1 -0
- package/dist/_chunks/{EditViewPage-DlLEyUL6.mjs → EditViewPage-zFjJK0s8.mjs} +19 -8
- package/dist/_chunks/EditViewPage-zFjJK0s8.mjs.map +1 -0
- package/dist/_chunks/{Field-CnK8dO8N.js → Field-9DePZh-0.js} +125 -97
- package/dist/_chunks/Field-9DePZh-0.js.map +1 -0
- package/dist/_chunks/{Field-Dq7bDnuh.mjs → Field-DPAzUS1M.mjs} +123 -95
- package/dist/_chunks/Field-DPAzUS1M.mjs.map +1 -0
- package/dist/_chunks/{Form-B_JE0dbz.mjs → Form-CEkENbkF.mjs} +35 -16
- package/dist/_chunks/Form-CEkENbkF.mjs.map +1 -0
- package/dist/_chunks/{Form-BpiR4piS.js → Form-DPm-KZ1A.js} +35 -16
- package/dist/_chunks/Form-DPm-KZ1A.js.map +1 -0
- package/dist/_chunks/{History-DdIstl8b.js → History-DXSbTWez.js} +21 -11
- package/dist/_chunks/History-DXSbTWez.js.map +1 -0
- package/dist/_chunks/{History-CBNGU7a-.mjs → History-utls71em.mjs} +21 -11
- package/dist/_chunks/History-utls71em.mjs.map +1 -0
- package/dist/_chunks/{ListConfigurationPage-5dr4qpue.mjs → ListConfigurationPage-CuMXWWqb.mjs} +14 -4
- package/dist/_chunks/ListConfigurationPage-CuMXWWqb.mjs.map +1 -0
- package/dist/_chunks/{ListConfigurationPage-DkKRparB.js → ListConfigurationPage-D5C7ACZ_.js} +14 -4
- package/dist/_chunks/ListConfigurationPage-D5C7ACZ_.js.map +1 -0
- package/dist/_chunks/{ListViewPage-DecLrYV6.mjs → ListViewPage-CdKd-PS_.mjs} +46 -37
- package/dist/_chunks/ListViewPage-CdKd-PS_.mjs.map +1 -0
- package/dist/_chunks/{ListViewPage-wE0lXqoD.js → ListViewPage-DfuwH1tt.js} +48 -39
- package/dist/_chunks/ListViewPage-DfuwH1tt.js.map +1 -0
- package/dist/_chunks/{NoContentTypePage-DEKR6tf9.js → NoContentTypePage-BIxlkWWi.js} +2 -2
- package/dist/_chunks/{NoContentTypePage-DEKR6tf9.js.map → NoContentTypePage-BIxlkWWi.js.map} +1 -1
- package/dist/_chunks/{NoContentTypePage-CiIcfYsd.mjs → NoContentTypePage-DkToTT7u.mjs} +2 -2
- package/dist/_chunks/{NoContentTypePage-CiIcfYsd.mjs.map → NoContentTypePage-DkToTT7u.mjs.map} +1 -1
- package/dist/_chunks/{NoPermissionsPage-DmNfF2Bb.js → NoPermissionsPage-Bu4GWYb-.js} +2 -2
- package/dist/_chunks/{NoPermissionsPage-DmNfF2Bb.js.map → NoPermissionsPage-Bu4GWYb-.js.map} +1 -1
- package/dist/_chunks/{NoPermissionsPage-CM5UD8ee.mjs → NoPermissionsPage-DlWi4BAH.mjs} +2 -2
- package/dist/_chunks/{NoPermissionsPage-CM5UD8ee.mjs.map → NoPermissionsPage-DlWi4BAH.mjs.map} +1 -1
- package/dist/_chunks/{Relations-L0xYRoSQ.js → Relations-CFjTESWQ.js} +4 -4
- package/dist/_chunks/{Relations-L0xYRoSQ.js.map → Relations-CFjTESWQ.js.map} +1 -1
- package/dist/_chunks/{Relations-Dqz0C1fz.mjs → Relations-QP5yn9_z.mjs} +4 -4
- package/dist/_chunks/{Relations-Dqz0C1fz.mjs.map → Relations-QP5yn9_z.mjs.map} +1 -1
- package/dist/_chunks/{en-uOUIxfcQ.js → en-BVzUkPxZ.js} +6 -5
- package/dist/_chunks/{en-uOUIxfcQ.js.map → en-BVzUkPxZ.js.map} +1 -1
- package/dist/_chunks/{en-BrCTWlZv.mjs → en-CPTj6CjC.mjs} +6 -5
- package/dist/_chunks/{en-BrCTWlZv.mjs.map → en-CPTj6CjC.mjs.map} +1 -1
- package/dist/_chunks/{index-BSn97i8U.mjs → index-BHfS6_D5.mjs} +253 -136
- package/dist/_chunks/index-BHfS6_D5.mjs.map +1 -0
- package/dist/_chunks/{index-DyvUPg1a.js → index-DXiHxy70.js} +234 -117
- package/dist/_chunks/index-DXiHxy70.js.map +1 -0
- package/dist/_chunks/{layout-DPaHUusj.mjs → layout-DX_52HSH.mjs} +22 -9
- package/dist/_chunks/layout-DX_52HSH.mjs.map +1 -0
- package/dist/_chunks/{layout-TPqF2oJ5.js → layout-bE-WUnQ0.js} +21 -8
- package/dist/_chunks/layout-bE-WUnQ0.js.map +1 -0
- package/dist/_chunks/{relations-BWYS9gkn.js → relations-D706vblp.js} +2 -2
- package/dist/_chunks/{relations-BWYS9gkn.js.map → relations-D706vblp.js.map} +1 -1
- package/dist/_chunks/{relations-Ck7-ecDT.mjs → relations-SCVAL_aJ.mjs} +2 -2
- package/dist/_chunks/{relations-Ck7-ecDT.mjs.map → relations-SCVAL_aJ.mjs.map} +1 -1
- package/dist/_chunks/{usePrev-B9w_-eYc.js → useDebounce-CtcjDB3L.js} +14 -1
- package/dist/_chunks/useDebounce-CtcjDB3L.js.map +1 -0
- package/dist/_chunks/useDebounce-DmuSJIF3.mjs +29 -0
- package/dist/_chunks/useDebounce-DmuSJIF3.mjs.map +1 -0
- package/dist/admin/index.js +1 -1
- package/dist/admin/index.mjs +4 -4
- package/dist/admin/src/history/services/historyVersion.d.ts +1 -1
- package/dist/admin/src/pages/EditView/components/FormInputs/Wysiwyg/EditorLayout.d.ts +2 -2
- package/dist/admin/src/pages/EditView/components/FormInputs/Wysiwyg/WysiwygFooter.d.ts +2 -2
- package/dist/admin/src/pages/EditView/components/FormInputs/Wysiwyg/WysiwygStyles.d.ts +4 -48
- package/dist/admin/src/pages/EditView/components/Header.d.ts +10 -11
- 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 +19 -17
- 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/admin/src/utils/validation.d.ts +4 -1
- package/dist/server/index.js +177 -107
- package/dist/server/index.js.map +1 -1
- package/dist/server/index.mjs +178 -108
- package/dist/server/index.mjs.map +1 -1
- package/dist/server/src/controllers/collection-types.d.ts.map +1 -1
- package/dist/server/src/controllers/relations.d.ts.map +1 -1
- package/dist/server/src/controllers/uid.d.ts.map +1 -1
- package/dist/server/src/controllers/validation/dimensions.d.ts +4 -2
- package/dist/server/src/controllers/validation/dimensions.d.ts.map +1 -1
- package/dist/server/src/history/services/history.d.ts.map +1 -1
- package/dist/server/src/history/services/lifecycles.d.ts.map +1 -1
- package/dist/server/src/history/services/utils.d.ts +2 -1
- package/dist/server/src/history/services/utils.d.ts.map +1 -1
- package/dist/server/src/policies/hasPermissions.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.map +1 -1
- package/dist/server/src/services/permission-checker.d.ts.map +1 -1
- package/dist/server/src/services/utils/populate.d.ts.map +1 -1
- package/dist/shared/contracts/collection-types.d.ts +3 -1
- package/dist/shared/contracts/collection-types.d.ts.map +1 -1
- package/package.json +11 -11
- package/dist/_chunks/EditViewPage-DA95Ha6J.js.map +0 -1
- package/dist/_chunks/EditViewPage-DlLEyUL6.mjs.map +0 -1
- package/dist/_chunks/Field-CnK8dO8N.js.map +0 -1
- package/dist/_chunks/Field-Dq7bDnuh.mjs.map +0 -1
- package/dist/_chunks/Form-B_JE0dbz.mjs.map +0 -1
- package/dist/_chunks/Form-BpiR4piS.js.map +0 -1
- package/dist/_chunks/History-CBNGU7a-.mjs.map +0 -1
- package/dist/_chunks/History-DdIstl8b.js.map +0 -1
- package/dist/_chunks/ListConfigurationPage-5dr4qpue.mjs.map +0 -1
- package/dist/_chunks/ListConfigurationPage-DkKRparB.js.map +0 -1
- package/dist/_chunks/ListViewPage-DecLrYV6.mjs.map +0 -1
- package/dist/_chunks/ListViewPage-wE0lXqoD.js.map +0 -1
- package/dist/_chunks/index-BSn97i8U.mjs.map +0 -1
- package/dist/_chunks/index-DyvUPg1a.js.map +0 -1
- package/dist/_chunks/layout-DPaHUusj.mjs.map +0 -1
- package/dist/_chunks/layout-TPqF2oJ5.js.map +0 -1
- package/dist/_chunks/usePrev-B9w_-eYc.js.map +0 -1
- package/dist/_chunks/usePrev-DH6iah0A.mjs +0 -16
- package/dist/_chunks/usePrev-DH6iah0A.mjs.map +0 -1
- package/strapi-server.js +0 -3
@@ -6,10 +6,10 @@ const React = require("react");
|
|
6
6
|
const designSystem = require("@strapi/design-system");
|
7
7
|
const reactIntl = require("react-intl");
|
8
8
|
const reactRouterDom = require("react-router-dom");
|
9
|
-
const styledComponents = require("styled-components");
|
10
9
|
const yup = require("yup");
|
11
10
|
const pipe = require("lodash/fp/pipe");
|
12
11
|
const dateFns = require("date-fns");
|
12
|
+
const styledComponents = require("styled-components");
|
13
13
|
const qs = require("qs");
|
14
14
|
const toolkit = require("@reduxjs/toolkit");
|
15
15
|
const _interopDefault = (e) => e && e.__esModule ? e : { default: e };
|
@@ -179,7 +179,8 @@ const contentManagerApi = strapiAdmin.adminApi.enhanceEndpoints({
|
|
179
179
|
"Document",
|
180
180
|
"InitialData",
|
181
181
|
"HistoryVersion",
|
182
|
-
"Relations"
|
182
|
+
"Relations",
|
183
|
+
"UidAvailability"
|
183
184
|
]
|
184
185
|
});
|
185
186
|
const documentApi = contentManagerApi.injectEndpoints({
|
@@ -193,7 +194,12 @@ const documentApi = contentManagerApi.injectEndpoints({
|
|
193
194
|
params: query
|
194
195
|
}
|
195
196
|
}),
|
196
|
-
invalidatesTags: (_result,
|
197
|
+
invalidatesTags: (_result, error, { model }) => {
|
198
|
+
if (error) {
|
199
|
+
return [];
|
200
|
+
}
|
201
|
+
return [{ type: "Document", id: `${model}_LIST` }];
|
202
|
+
}
|
197
203
|
}),
|
198
204
|
cloneDocument: builder.mutation({
|
199
205
|
query: ({ model, sourceId, data, params }) => ({
|
@@ -204,7 +210,10 @@ const documentApi = contentManagerApi.injectEndpoints({
|
|
204
210
|
params
|
205
211
|
}
|
206
212
|
}),
|
207
|
-
invalidatesTags: (_result, _error, { model }) => [
|
213
|
+
invalidatesTags: (_result, _error, { model }) => [
|
214
|
+
{ type: "Document", id: `${model}_LIST` },
|
215
|
+
{ type: "UidAvailability", id: model }
|
216
|
+
]
|
208
217
|
}),
|
209
218
|
/**
|
210
219
|
* Creates a new collection-type document. This should ONLY be used for collection-types.
|
@@ -221,7 +230,8 @@ const documentApi = contentManagerApi.injectEndpoints({
|
|
221
230
|
}),
|
222
231
|
invalidatesTags: (result, _error, { model }) => [
|
223
232
|
{ type: "Document", id: `${model}_LIST` },
|
224
|
-
"Relations"
|
233
|
+
"Relations",
|
234
|
+
{ type: "UidAvailability", id: model }
|
225
235
|
]
|
226
236
|
}),
|
227
237
|
deleteDocument: builder.mutation({
|
@@ -262,7 +272,8 @@ const documentApi = contentManagerApi.injectEndpoints({
|
|
262
272
|
id: collectionType !== SINGLE_TYPES ? `${model}_${documentId}` : model
|
263
273
|
},
|
264
274
|
{ type: "Document", id: `${model}_LIST` },
|
265
|
-
"Relations"
|
275
|
+
"Relations",
|
276
|
+
{ type: "UidAvailability", id: model }
|
266
277
|
];
|
267
278
|
}
|
268
279
|
}),
|
@@ -280,6 +291,7 @@ const documentApi = contentManagerApi.injectEndpoints({
|
|
280
291
|
}),
|
281
292
|
providesTags: (result, _error, arg) => {
|
282
293
|
return [
|
294
|
+
{ type: "Document", id: `ALL_LIST` },
|
283
295
|
{ type: "Document", id: `${arg.model}_LIST` },
|
284
296
|
...result?.results.map(({ documentId }) => ({
|
285
297
|
type: "Document",
|
@@ -318,6 +330,11 @@ const documentApi = contentManagerApi.injectEndpoints({
|
|
318
330
|
{
|
319
331
|
type: "Document",
|
320
332
|
id: collectionType !== SINGLE_TYPES ? `${model}_${result && "documentId" in result ? result.documentId : documentId}` : model
|
333
|
+
},
|
334
|
+
// Make it easy to invalidate all individual documents queries for a model
|
335
|
+
{
|
336
|
+
type: "Document",
|
337
|
+
id: `${model}_ALL_ITEMS`
|
321
338
|
}
|
322
339
|
];
|
323
340
|
}
|
@@ -381,8 +398,21 @@ const documentApi = contentManagerApi.injectEndpoints({
|
|
381
398
|
type: "Document",
|
382
399
|
id: collectionType !== SINGLE_TYPES ? `${model}_${documentId}` : model
|
383
400
|
},
|
384
|
-
"Relations"
|
401
|
+
"Relations",
|
402
|
+
{ type: "UidAvailability", id: model }
|
385
403
|
];
|
404
|
+
},
|
405
|
+
async onQueryStarted({ data, ...patch }, { dispatch, queryFulfilled }) {
|
406
|
+
const patchResult = dispatch(
|
407
|
+
documentApi.util.updateQueryData("getDocument", patch, (draft) => {
|
408
|
+
Object.assign(draft.data, data);
|
409
|
+
})
|
410
|
+
);
|
411
|
+
try {
|
412
|
+
await queryFulfilled;
|
413
|
+
} catch {
|
414
|
+
patchResult.undo();
|
415
|
+
}
|
386
416
|
}
|
387
417
|
}),
|
388
418
|
unpublishDocument: builder.mutation({
|
@@ -452,7 +482,7 @@ const buildValidParams = (query) => {
|
|
452
482
|
const isBaseQueryError = (error) => {
|
453
483
|
return error.name !== void 0;
|
454
484
|
};
|
455
|
-
const createYupSchema = (attributes = {}, components = {}) => {
|
485
|
+
const createYupSchema = (attributes = {}, components = {}, options = { status: null }) => {
|
456
486
|
const createModelSchema = (attributes2) => yup__namespace.object().shape(
|
457
487
|
Object.entries(attributes2).reduce((acc, [name, attribute]) => {
|
458
488
|
if (DOCUMENT_META_FIELDS.includes(name)) {
|
@@ -465,7 +495,7 @@ const createYupSchema = (attributes = {}, components = {}) => {
|
|
465
495
|
addMinValidation,
|
466
496
|
addMaxValidation,
|
467
497
|
addRegexValidation
|
468
|
-
].map((fn) => fn(attribute));
|
498
|
+
].map((fn) => fn(attribute, options));
|
469
499
|
const transformSchema = pipe__default.default(...validations);
|
470
500
|
switch (attribute.type) {
|
471
501
|
case "component": {
|
@@ -566,6 +596,14 @@ const createAttributeSchema = (attribute) => {
|
|
566
596
|
if (!value || typeof value === "string" && value.length === 0) {
|
567
597
|
return true;
|
568
598
|
}
|
599
|
+
if (typeof value === "object") {
|
600
|
+
try {
|
601
|
+
JSON.stringify(value);
|
602
|
+
return true;
|
603
|
+
} catch (err) {
|
604
|
+
return false;
|
605
|
+
}
|
606
|
+
}
|
569
607
|
try {
|
570
608
|
JSON.parse(value);
|
571
609
|
return true;
|
@@ -584,13 +622,7 @@ const createAttributeSchema = (attribute) => {
|
|
584
622
|
return yup__namespace.mixed();
|
585
623
|
}
|
586
624
|
};
|
587
|
-
const
|
588
|
-
if ((attribute.type === "component" && attribute.repeatable || attribute.type === "dynamiczone") && attribute.required && "min" in schema) {
|
589
|
-
return schema.min(1, strapiAdmin.translatedErrors.required);
|
590
|
-
}
|
591
|
-
if (attribute.required && attribute.type !== "relation") {
|
592
|
-
return schema.required(strapiAdmin.translatedErrors.required);
|
593
|
-
}
|
625
|
+
const nullableSchema = (schema) => {
|
594
626
|
return schema?.nullable ? schema.nullable() : (
|
595
627
|
// In some cases '.nullable' will not be available on the schema.
|
596
628
|
// e.g. when the schema has been built using yup.lazy (e.g. for relations).
|
@@ -598,7 +630,22 @@ const addRequiredValidation = (attribute) => (schema) => {
|
|
598
630
|
schema
|
599
631
|
);
|
600
632
|
};
|
601
|
-
const
|
633
|
+
const addRequiredValidation = (attribute, options) => (schema) => {
|
634
|
+
if (options.status === "draft") {
|
635
|
+
return nullableSchema(schema);
|
636
|
+
}
|
637
|
+
if ((attribute.type === "component" && attribute.repeatable || attribute.type === "dynamiczone") && attribute.required && "min" in schema) {
|
638
|
+
return schema.min(1, strapiAdmin.translatedErrors.required);
|
639
|
+
}
|
640
|
+
if (attribute.required && attribute.type !== "relation") {
|
641
|
+
return schema.required(strapiAdmin.translatedErrors.required);
|
642
|
+
}
|
643
|
+
return nullableSchema(schema);
|
644
|
+
};
|
645
|
+
const addMinLengthValidation = (attribute, options) => (schema) => {
|
646
|
+
if (options.status === "draft") {
|
647
|
+
return schema;
|
648
|
+
}
|
602
649
|
if ("minLength" in attribute && attribute.minLength && Number.isInteger(attribute.minLength) && "min" in schema) {
|
603
650
|
return schema.min(attribute.minLength, {
|
604
651
|
...strapiAdmin.translatedErrors.minLength,
|
@@ -620,11 +667,11 @@ const addMaxLengthValidation = (attribute) => (schema) => {
|
|
620
667
|
}
|
621
668
|
return schema;
|
622
669
|
};
|
623
|
-
const addMinValidation = (attribute) => (schema) => {
|
670
|
+
const addMinValidation = (attribute, options) => (schema) => {
|
624
671
|
if ("min" in attribute) {
|
625
672
|
const min = toInteger(attribute.min);
|
626
673
|
if (attribute.type === "component" && attribute.repeatable || attribute.type === "dynamiczone") {
|
627
|
-
if (!attribute.required && "test" in schema && min) {
|
674
|
+
if (options.status !== "draft" && !attribute.required && "test" in schema && min) {
|
628
675
|
return schema.test(
|
629
676
|
"custom-min",
|
630
677
|
{
|
@@ -860,6 +907,7 @@ const useDocumentActions = () => {
|
|
860
907
|
const { formatMessage } = reactIntl.useIntl();
|
861
908
|
const { trackUsage } = strapiAdmin.useTracking();
|
862
909
|
const { _unstableFormatAPIError: formatAPIError } = strapiAdmin.useAPIErrorHandler();
|
910
|
+
const navigate = reactRouterDom.useNavigate();
|
863
911
|
const [deleteDocument] = useDeleteDocumentMutation();
|
864
912
|
const _delete = React__namespace.useCallback(
|
865
913
|
async ({ collectionType, model, documentId, params }, trackerProperty) => {
|
@@ -1195,7 +1243,6 @@ const useDocumentActions = () => {
|
|
1195
1243
|
sourceId
|
1196
1244
|
});
|
1197
1245
|
if ("error" in res) {
|
1198
|
-
toggleNotification({ type: "danger", message: formatAPIError(res.error) });
|
1199
1246
|
return { error: res.error };
|
1200
1247
|
}
|
1201
1248
|
toggleNotification({
|
@@ -1214,7 +1261,7 @@ const useDocumentActions = () => {
|
|
1214
1261
|
throw err;
|
1215
1262
|
}
|
1216
1263
|
},
|
1217
|
-
[autoCloneDocument,
|
1264
|
+
[autoCloneDocument, formatMessage, toggleNotification]
|
1218
1265
|
);
|
1219
1266
|
const [cloneDocument] = useCloneDocumentMutation();
|
1220
1267
|
const clone = React__namespace.useCallback(
|
@@ -1240,6 +1287,7 @@ const useDocumentActions = () => {
|
|
1240
1287
|
defaultMessage: "Cloned document"
|
1241
1288
|
})
|
1242
1289
|
});
|
1290
|
+
navigate(`../../${res.data.data.documentId}`, { relative: "path" });
|
1243
1291
|
return res.data;
|
1244
1292
|
} catch (err) {
|
1245
1293
|
toggleNotification({
|
@@ -1250,7 +1298,7 @@ const useDocumentActions = () => {
|
|
1250
1298
|
throw err;
|
1251
1299
|
}
|
1252
1300
|
},
|
1253
|
-
[cloneDocument, trackUsage, toggleNotification, formatMessage, formatAPIError]
|
1301
|
+
[cloneDocument, trackUsage, toggleNotification, formatMessage, formatAPIError, navigate]
|
1254
1302
|
);
|
1255
1303
|
const [getDoc] = useLazyGetDocumentQuery();
|
1256
1304
|
const getDocument = React__namespace.useCallback(
|
@@ -1276,7 +1324,7 @@ const useDocumentActions = () => {
|
|
1276
1324
|
};
|
1277
1325
|
};
|
1278
1326
|
const ProtectedHistoryPage = React.lazy(
|
1279
|
-
() => Promise.resolve().then(() => require("./History-
|
1327
|
+
() => Promise.resolve().then(() => require("./History-DXSbTWez.js")).then((mod) => ({ default: mod.ProtectedHistoryPage }))
|
1280
1328
|
);
|
1281
1329
|
const routes$1 = [
|
1282
1330
|
{
|
@@ -1289,31 +1337,31 @@ const routes$1 = [
|
|
1289
1337
|
}
|
1290
1338
|
];
|
1291
1339
|
const ProtectedEditViewPage = React.lazy(
|
1292
|
-
() => Promise.resolve().then(() => require("./EditViewPage-
|
1340
|
+
() => Promise.resolve().then(() => require("./EditViewPage-CHgoNwlc.js")).then((mod) => ({ default: mod.ProtectedEditViewPage }))
|
1293
1341
|
);
|
1294
1342
|
const ProtectedListViewPage = React.lazy(
|
1295
|
-
() => Promise.resolve().then(() => require("./ListViewPage-
|
1343
|
+
() => Promise.resolve().then(() => require("./ListViewPage-DfuwH1tt.js")).then((mod) => ({ default: mod.ProtectedListViewPage }))
|
1296
1344
|
);
|
1297
1345
|
const ProtectedListConfiguration = React.lazy(
|
1298
|
-
() => Promise.resolve().then(() => require("./ListConfigurationPage-
|
1346
|
+
() => Promise.resolve().then(() => require("./ListConfigurationPage-D5C7ACZ_.js")).then((mod) => ({
|
1299
1347
|
default: mod.ProtectedListConfiguration
|
1300
1348
|
}))
|
1301
1349
|
);
|
1302
1350
|
const ProtectedEditConfigurationPage = React.lazy(
|
1303
|
-
() => Promise.resolve().then(() => require("./EditConfigurationPage-
|
1351
|
+
() => Promise.resolve().then(() => require("./EditConfigurationPage-B2AA1kVF.js")).then((mod) => ({
|
1304
1352
|
default: mod.ProtectedEditConfigurationPage
|
1305
1353
|
}))
|
1306
1354
|
);
|
1307
1355
|
const ProtectedComponentConfigurationPage = React.lazy(
|
1308
|
-
() => Promise.resolve().then(() => require("./ComponentConfigurationPage-
|
1356
|
+
() => Promise.resolve().then(() => require("./ComponentConfigurationPage-G4EIirP8.js")).then((mod) => ({
|
1309
1357
|
default: mod.ProtectedComponentConfigurationPage
|
1310
1358
|
}))
|
1311
1359
|
);
|
1312
1360
|
const NoPermissions = React.lazy(
|
1313
|
-
() => Promise.resolve().then(() => require("./NoPermissionsPage-
|
1361
|
+
() => Promise.resolve().then(() => require("./NoPermissionsPage-Bu4GWYb-.js")).then((mod) => ({ default: mod.NoPermissions }))
|
1314
1362
|
);
|
1315
1363
|
const NoContentType = React.lazy(
|
1316
|
-
() => Promise.resolve().then(() => require("./NoContentTypePage-
|
1364
|
+
() => Promise.resolve().then(() => require("./NoContentTypePage-BIxlkWWi.js")).then((mod) => ({ default: mod.NoContentType }))
|
1317
1365
|
);
|
1318
1366
|
const CollectionTypePages = () => {
|
1319
1367
|
const { collectionType } = reactRouterDom.useParams();
|
@@ -1427,12 +1475,14 @@ const DocumentActionButton = (action) => {
|
|
1427
1475
|
/* @__PURE__ */ jsxRuntime.jsx(
|
1428
1476
|
designSystem.Button,
|
1429
1477
|
{
|
1430
|
-
flex:
|
1478
|
+
flex: "auto",
|
1431
1479
|
startIcon: action.icon,
|
1432
1480
|
disabled: action.disabled,
|
1433
1481
|
onClick: handleClick(action),
|
1434
1482
|
justifyContent: "center",
|
1435
1483
|
variant: action.variant || "default",
|
1484
|
+
paddingTop: "7px",
|
1485
|
+
paddingBottom: "7px",
|
1436
1486
|
children: action.label
|
1437
1487
|
}
|
1438
1488
|
),
|
@@ -1497,9 +1547,9 @@ const DocumentActionsMenu = ({
|
|
1497
1547
|
disabled: isDisabled,
|
1498
1548
|
size: "S",
|
1499
1549
|
endIcon: null,
|
1500
|
-
paddingTop: "
|
1501
|
-
paddingLeft: "
|
1502
|
-
paddingRight: "
|
1550
|
+
paddingTop: "4px",
|
1551
|
+
paddingLeft: "7px",
|
1552
|
+
paddingRight: "7px",
|
1503
1553
|
variant,
|
1504
1554
|
children: [
|
1505
1555
|
/* @__PURE__ */ jsxRuntime.jsx(Icons.More, { "aria-hidden": true, focusable: false }),
|
@@ -1510,7 +1560,7 @@ const DocumentActionsMenu = ({
|
|
1510
1560
|
]
|
1511
1561
|
}
|
1512
1562
|
),
|
1513
|
-
/* @__PURE__ */ jsxRuntime.jsxs(designSystem.Menu.Content, {
|
1563
|
+
/* @__PURE__ */ jsxRuntime.jsxs(designSystem.Menu.Content, { maxHeight: void 0, popoverPlacement: "bottom-end", children: [
|
1514
1564
|
actions2.map((action) => {
|
1515
1565
|
return /* @__PURE__ */ jsxRuntime.jsx(
|
1516
1566
|
designSystem.Menu.Item,
|
@@ -1519,10 +1569,25 @@ const DocumentActionsMenu = ({
|
|
1519
1569
|
onSelect: handleClick(action),
|
1520
1570
|
display: "block",
|
1521
1571
|
children: /* @__PURE__ */ jsxRuntime.jsxs(designSystem.Flex, { justifyContent: "space-between", gap: 4, children: [
|
1522
|
-
/* @__PURE__ */ jsxRuntime.jsxs(
|
1523
|
-
|
1524
|
-
|
1525
|
-
|
1572
|
+
/* @__PURE__ */ jsxRuntime.jsxs(
|
1573
|
+
designSystem.Flex,
|
1574
|
+
{
|
1575
|
+
color: !action.disabled ? convertActionVariantToColor(action.variant) : "inherit",
|
1576
|
+
gap: 2,
|
1577
|
+
tag: "span",
|
1578
|
+
children: [
|
1579
|
+
/* @__PURE__ */ jsxRuntime.jsx(
|
1580
|
+
designSystem.Flex,
|
1581
|
+
{
|
1582
|
+
tag: "span",
|
1583
|
+
color: !action.disabled ? convertActionVariantToIconColor(action.variant) : "inherit",
|
1584
|
+
children: action.icon
|
1585
|
+
}
|
1586
|
+
),
|
1587
|
+
action.label
|
1588
|
+
]
|
1589
|
+
}
|
1590
|
+
),
|
1526
1591
|
action.id.startsWith("HistoryAction") && /* @__PURE__ */ jsxRuntime.jsx(
|
1527
1592
|
designSystem.Flex,
|
1528
1593
|
{
|
@@ -1619,11 +1684,11 @@ const DocumentActionConfirmDialog = ({
|
|
1619
1684
|
/* @__PURE__ */ jsxRuntime.jsx(designSystem.Dialog.Header, { children: title }),
|
1620
1685
|
/* @__PURE__ */ jsxRuntime.jsx(designSystem.Dialog.Body, { children: content }),
|
1621
1686
|
/* @__PURE__ */ jsxRuntime.jsxs(designSystem.Dialog.Footer, { children: [
|
1622
|
-
/* @__PURE__ */ jsxRuntime.jsx(designSystem.Dialog.Cancel, { children: /* @__PURE__ */ jsxRuntime.jsx(designSystem.Button, { variant: "tertiary", children: formatMessage({
|
1687
|
+
/* @__PURE__ */ jsxRuntime.jsx(designSystem.Dialog.Cancel, { children: /* @__PURE__ */ jsxRuntime.jsx(designSystem.Button, { variant: "tertiary", fullWidth: true, children: formatMessage({
|
1623
1688
|
id: "app.components.Button.cancel",
|
1624
1689
|
defaultMessage: "Cancel"
|
1625
1690
|
}) }) }),
|
1626
|
-
/* @__PURE__ */ jsxRuntime.jsx(designSystem.Button, { onClick: handleConfirm, variant, children: formatMessage({
|
1691
|
+
/* @__PURE__ */ jsxRuntime.jsx(designSystem.Button, { onClick: handleConfirm, variant, fullWidth: true, children: formatMessage({
|
1627
1692
|
id: "app.components.Button.confirm",
|
1628
1693
|
defaultMessage: "Confirm"
|
1629
1694
|
}) })
|
@@ -1646,8 +1711,8 @@ const DocumentActionModal = ({
|
|
1646
1711
|
};
|
1647
1712
|
return /* @__PURE__ */ jsxRuntime.jsx(designSystem.Modal.Root, { open: isOpen, onOpenChange: handleClose, children: /* @__PURE__ */ jsxRuntime.jsxs(designSystem.Modal.Content, { children: [
|
1648
1713
|
/* @__PURE__ */ jsxRuntime.jsx(designSystem.Modal.Header, { children: /* @__PURE__ */ jsxRuntime.jsx(designSystem.Modal.Title, { children: title }) }),
|
1649
|
-
|
1650
|
-
|
1714
|
+
typeof Content === "function" ? /* @__PURE__ */ jsxRuntime.jsx(Content, { onClose: handleClose }) : /* @__PURE__ */ jsxRuntime.jsx(designSystem.Modal.Body, { children: Content }),
|
1715
|
+
typeof Footer === "function" ? /* @__PURE__ */ jsxRuntime.jsx(Footer, { onClose: handleClose }) : Footer
|
1651
1716
|
] }) });
|
1652
1717
|
};
|
1653
1718
|
const PublishAction$1 = ({
|
@@ -1662,12 +1727,10 @@ const PublishAction$1 = ({
|
|
1662
1727
|
const navigate = reactRouterDom.useNavigate();
|
1663
1728
|
const { toggleNotification } = strapiAdmin.useNotification();
|
1664
1729
|
const { _unstableFormatValidationErrors: formatValidationErrors } = strapiAdmin.useAPIErrorHandler();
|
1730
|
+
const isListView = reactRouterDom.useMatch(LIST_PATH) !== null;
|
1665
1731
|
const isCloning = reactRouterDom.useMatch(CLONE_PATH) !== null;
|
1666
1732
|
const { formatMessage } = reactIntl.useIntl();
|
1667
|
-
const { canPublish
|
1668
|
-
"PublishAction",
|
1669
|
-
({ canPublish: canPublish2, canCreate: canCreate2, canUpdate: canUpdate2 }) => ({ canPublish: canPublish2, canCreate: canCreate2, canUpdate: canUpdate2 })
|
1670
|
-
);
|
1733
|
+
const canPublish = useDocumentRBAC("PublishAction", ({ canPublish: canPublish2 }) => canPublish2);
|
1671
1734
|
const { publish } = useDocumentActions();
|
1672
1735
|
const [
|
1673
1736
|
countDraftRelations,
|
@@ -1719,24 +1782,25 @@ const PublishAction$1 = ({
|
|
1719
1782
|
}
|
1720
1783
|
}, [documentId, modified, formValues, setLocalCountOfDraftRelations]);
|
1721
1784
|
React__namespace.useEffect(() => {
|
1722
|
-
if (documentId) {
|
1723
|
-
|
1724
|
-
const { data, error } = await countDraftRelations({
|
1725
|
-
collectionType,
|
1726
|
-
model,
|
1727
|
-
documentId,
|
1728
|
-
params
|
1729
|
-
});
|
1730
|
-
if (error) {
|
1731
|
-
throw error;
|
1732
|
-
}
|
1733
|
-
if (data) {
|
1734
|
-
setServerCountOfDraftRelations(data.data);
|
1735
|
-
}
|
1736
|
-
};
|
1737
|
-
fetchDraftRelationsCount();
|
1785
|
+
if (!document || !document.documentId || isListView) {
|
1786
|
+
return;
|
1738
1787
|
}
|
1739
|
-
|
1788
|
+
const fetchDraftRelationsCount = async () => {
|
1789
|
+
const { data, error } = await countDraftRelations({
|
1790
|
+
collectionType,
|
1791
|
+
model,
|
1792
|
+
documentId,
|
1793
|
+
params
|
1794
|
+
});
|
1795
|
+
if (error) {
|
1796
|
+
throw error;
|
1797
|
+
}
|
1798
|
+
if (data) {
|
1799
|
+
setServerCountOfDraftRelations(data.data);
|
1800
|
+
}
|
1801
|
+
};
|
1802
|
+
fetchDraftRelationsCount();
|
1803
|
+
}, [isListView, document, documentId, countDraftRelations, collectionType, model, params]);
|
1740
1804
|
const isDocumentPublished = (document?.[PUBLISHED_AT_ATTRIBUTE_NAME] || meta?.availableStatus.some((doc) => doc[PUBLISHED_AT_ATTRIBUTE_NAME] !== null)) && document?.status !== "modified";
|
1741
1805
|
if (!schema?.options?.draftAndPublish) {
|
1742
1806
|
return null;
|
@@ -1777,7 +1841,8 @@ const PublishAction$1 = ({
|
|
1777
1841
|
}
|
1778
1842
|
};
|
1779
1843
|
const totalDraftRelations = localCountOfDraftRelations + serverCountOfDraftRelations;
|
1780
|
-
const
|
1844
|
+
const enableDraftRelationsCount = false;
|
1845
|
+
const hasDraftRelations = enableDraftRelationsCount;
|
1781
1846
|
return {
|
1782
1847
|
/**
|
1783
1848
|
* Disabled when:
|
@@ -1787,18 +1852,13 @@ const PublishAction$1 = ({
|
|
1787
1852
|
* - the document is already published & not modified
|
1788
1853
|
* - the document is being created & not modified
|
1789
1854
|
* - the user doesn't have the permission to publish
|
1790
|
-
* - the user doesn't have the permission to create a new document
|
1791
|
-
* - the user doesn't have the permission to update the document
|
1792
1855
|
*/
|
1793
|
-
disabled: isCloning || isSubmitting || isLoadingDraftRelations || activeTab === "published" || !modified && isDocumentPublished || !modified && !document?.documentId || !canPublish
|
1856
|
+
disabled: isCloning || isSubmitting || isLoadingDraftRelations || activeTab === "published" || !modified && isDocumentPublished || !modified && !document?.documentId || !canPublish,
|
1794
1857
|
label: formatMessage({
|
1795
1858
|
id: "app.utils.publish",
|
1796
1859
|
defaultMessage: "Publish"
|
1797
1860
|
}),
|
1798
1861
|
onClick: async () => {
|
1799
|
-
if (hasDraftRelations) {
|
1800
|
-
return;
|
1801
|
-
}
|
1802
1862
|
await performPublish();
|
1803
1863
|
},
|
1804
1864
|
dialog: hasDraftRelations ? {
|
@@ -1837,10 +1897,6 @@ const UpdateAction = ({
|
|
1837
1897
|
const cloneMatch = reactRouterDom.useMatch(CLONE_PATH);
|
1838
1898
|
const isCloning = cloneMatch !== null;
|
1839
1899
|
const { formatMessage } = reactIntl.useIntl();
|
1840
|
-
const { canCreate, canUpdate } = useDocumentRBAC("UpdateAction", ({ canCreate: canCreate2, canUpdate: canUpdate2 }) => ({
|
1841
|
-
canCreate: canCreate2,
|
1842
|
-
canUpdate: canUpdate2
|
1843
|
-
}));
|
1844
1900
|
const { create, update, clone } = useDocumentActions();
|
1845
1901
|
const [{ query, rawQuery }] = strapiAdmin.useQueryParams();
|
1846
1902
|
const params = React__namespace.useMemo(() => buildValidParams(query), [query]);
|
@@ -1857,10 +1913,8 @@ const UpdateAction = ({
|
|
1857
1913
|
* - the form is submitting
|
1858
1914
|
* - the document is not modified & we're not cloning (you can save a clone entity straight away)
|
1859
1915
|
* - the active tab is the published tab
|
1860
|
-
* - the user doesn't have the permission to create a new document
|
1861
|
-
* - the user doesn't have the permission to update the document
|
1862
1916
|
*/
|
1863
|
-
disabled: isSubmitting || !modified && !isCloning || activeTab === "published"
|
1917
|
+
disabled: isSubmitting || !modified && !isCloning || activeTab === "published",
|
1864
1918
|
label: formatMessage({
|
1865
1919
|
id: "content-manager.containers.Edit.save",
|
1866
1920
|
defaultMessage: "Save"
|
@@ -1868,16 +1922,18 @@ const UpdateAction = ({
|
|
1868
1922
|
onClick: async () => {
|
1869
1923
|
setSubmitting(true);
|
1870
1924
|
try {
|
1871
|
-
|
1872
|
-
|
1873
|
-
|
1874
|
-
|
1875
|
-
|
1876
|
-
|
1877
|
-
|
1878
|
-
|
1879
|
-
|
1880
|
-
|
1925
|
+
if (activeTab !== "draft") {
|
1926
|
+
const { errors } = await validate();
|
1927
|
+
if (errors) {
|
1928
|
+
toggleNotification({
|
1929
|
+
type: "danger",
|
1930
|
+
message: formatMessage({
|
1931
|
+
id: "content-manager.validation.error",
|
1932
|
+
defaultMessage: "There are validation errors in your document. Please fix them before saving."
|
1933
|
+
})
|
1934
|
+
});
|
1935
|
+
return;
|
1936
|
+
}
|
1881
1937
|
}
|
1882
1938
|
if (isCloning) {
|
1883
1939
|
const res = await clone(
|
@@ -1889,10 +1945,13 @@ const UpdateAction = ({
|
|
1889
1945
|
document
|
1890
1946
|
);
|
1891
1947
|
if ("data" in res) {
|
1892
|
-
navigate(
|
1893
|
-
|
1894
|
-
|
1895
|
-
|
1948
|
+
navigate(
|
1949
|
+
{
|
1950
|
+
pathname: `../${res.data.documentId}`,
|
1951
|
+
search: rawQuery
|
1952
|
+
},
|
1953
|
+
{ relative: "path" }
|
1954
|
+
);
|
1896
1955
|
} else if ("error" in res && isBaseQueryError(res.error) && res.error.name === "ValidationError") {
|
1897
1956
|
setErrors(formatValidationErrors(res.error));
|
1898
1957
|
}
|
@@ -1922,10 +1981,10 @@ const UpdateAction = ({
|
|
1922
1981
|
if ("data" in res && collectionType !== SINGLE_TYPES) {
|
1923
1982
|
navigate(
|
1924
1983
|
{
|
1925
|
-
pathname: `../${
|
1984
|
+
pathname: `../${res.data.documentId}`,
|
1926
1985
|
search: rawQuery
|
1927
1986
|
},
|
1928
|
-
{ replace: true }
|
1987
|
+
{ replace: true, relative: "path" }
|
1929
1988
|
);
|
1930
1989
|
} else if ("error" in res && isBaseQueryError(res.error) && res.error.name === "ValidationError") {
|
1931
1990
|
setErrors(formatValidationErrors(res.error));
|
@@ -1970,7 +2029,7 @@ const UnpublishAction$1 = ({
|
|
1970
2029
|
id: "app.utils.unpublish",
|
1971
2030
|
defaultMessage: "Unpublish"
|
1972
2031
|
}),
|
1973
|
-
icon: /* @__PURE__ */ jsxRuntime.jsx(
|
2032
|
+
icon: /* @__PURE__ */ jsxRuntime.jsx(Icons.Cross, {}),
|
1974
2033
|
onClick: async () => {
|
1975
2034
|
if (!documentId && collectionType !== SINGLE_TYPES || isDocumentModified) {
|
1976
2035
|
if (!documentId) {
|
@@ -2082,7 +2141,7 @@ const DiscardAction = ({
|
|
2082
2141
|
id: "content-manager.actions.discard.label",
|
2083
2142
|
defaultMessage: "Discard changes"
|
2084
2143
|
}),
|
2085
|
-
icon: /* @__PURE__ */ jsxRuntime.jsx(
|
2144
|
+
icon: /* @__PURE__ */ jsxRuntime.jsx(Icons.Cross, {}),
|
2086
2145
|
position: ["panel", "table-row"],
|
2087
2146
|
variant: "danger",
|
2088
2147
|
dialog: {
|
@@ -2110,11 +2169,6 @@ const DiscardAction = ({
|
|
2110
2169
|
};
|
2111
2170
|
};
|
2112
2171
|
DiscardAction.type = "discard";
|
2113
|
-
const StyledCrossCircle = styledComponents.styled(Icons.CrossCircle)`
|
2114
|
-
path {
|
2115
|
-
fill: currentColor;
|
2116
|
-
}
|
2117
|
-
`;
|
2118
2172
|
const DEFAULT_ACTIONS = [PublishAction$1, UpdateAction, UnpublishAction$1, DiscardAction];
|
2119
2173
|
const intervals = ["years", "months", "days", "hours", "minutes", "seconds"];
|
2120
2174
|
const RelativeTime = React__namespace.forwardRef(
|
@@ -2162,7 +2216,7 @@ const getDisplayName = ({
|
|
2162
2216
|
};
|
2163
2217
|
const capitalise = (str) => str.charAt(0).toUpperCase() + str.slice(1);
|
2164
2218
|
const DocumentStatus = ({ status = "draft", ...restProps }) => {
|
2165
|
-
const statusVariant = status === "draft" ? "
|
2219
|
+
const statusVariant = status === "draft" ? "secondary" : status === "published" ? "success" : "alternative";
|
2166
2220
|
return /* @__PURE__ */ jsxRuntime.jsx(designSystem.Status, { ...restProps, showBullet: false, size: "S", variant: statusVariant, children: /* @__PURE__ */ jsxRuntime.jsx(designSystem.Typography, { tag: "span", variant: "omega", fontWeight: "bold", children: capitalise(status) }) });
|
2167
2221
|
};
|
2168
2222
|
const Header = ({ isCreating, status, title: documentTitle = "Untitled" }) => {
|
@@ -2345,8 +2399,22 @@ const Information = ({ activeTab }) => {
|
|
2345
2399
|
);
|
2346
2400
|
};
|
2347
2401
|
const HeaderActions = ({ actions: actions2 }) => {
|
2348
|
-
|
2349
|
-
|
2402
|
+
const [dialogId, setDialogId] = React__namespace.useState(null);
|
2403
|
+
const handleClick = (action) => async (e) => {
|
2404
|
+
if (!("options" in action)) {
|
2405
|
+
const { onClick = () => false, dialog, id } = action;
|
2406
|
+
const muteDialog = await onClick(e);
|
2407
|
+
if (dialog && !muteDialog) {
|
2408
|
+
e.preventDefault();
|
2409
|
+
setDialogId(id);
|
2410
|
+
}
|
2411
|
+
}
|
2412
|
+
};
|
2413
|
+
const handleClose = () => {
|
2414
|
+
setDialogId(null);
|
2415
|
+
};
|
2416
|
+
return /* @__PURE__ */ jsxRuntime.jsx(designSystem.Flex, { gap: 1, children: actions2.map((action) => {
|
2417
|
+
if (action.options) {
|
2350
2418
|
return /* @__PURE__ */ jsxRuntime.jsx(
|
2351
2419
|
designSystem.SingleSelect,
|
2352
2420
|
{
|
@@ -2360,10 +2428,49 @@ const HeaderActions = ({ actions: actions2 }) => {
|
|
2360
2428
|
action.id
|
2361
2429
|
);
|
2362
2430
|
} else {
|
2363
|
-
|
2431
|
+
if (action.type === "icon") {
|
2432
|
+
return /* @__PURE__ */ jsxRuntime.jsxs(React__namespace.Fragment, { children: [
|
2433
|
+
/* @__PURE__ */ jsxRuntime.jsx(
|
2434
|
+
designSystem.IconButton,
|
2435
|
+
{
|
2436
|
+
disabled: action.disabled,
|
2437
|
+
label: action.label,
|
2438
|
+
size: "S",
|
2439
|
+
onClick: handleClick(action),
|
2440
|
+
children: action.icon
|
2441
|
+
}
|
2442
|
+
),
|
2443
|
+
action.dialog ? /* @__PURE__ */ jsxRuntime.jsx(
|
2444
|
+
HeaderActionDialog,
|
2445
|
+
{
|
2446
|
+
...action.dialog,
|
2447
|
+
isOpen: dialogId === action.id,
|
2448
|
+
onClose: handleClose
|
2449
|
+
}
|
2450
|
+
) : null
|
2451
|
+
] }, action.id);
|
2452
|
+
}
|
2364
2453
|
}
|
2365
2454
|
}) });
|
2366
2455
|
};
|
2456
|
+
const HeaderActionDialog = ({
|
2457
|
+
onClose,
|
2458
|
+
onCancel,
|
2459
|
+
title,
|
2460
|
+
content: Content,
|
2461
|
+
isOpen
|
2462
|
+
}) => {
|
2463
|
+
const handleClose = async () => {
|
2464
|
+
if (onCancel) {
|
2465
|
+
await onCancel();
|
2466
|
+
}
|
2467
|
+
onClose();
|
2468
|
+
};
|
2469
|
+
return /* @__PURE__ */ jsxRuntime.jsx(designSystem.Dialog.Root, { open: isOpen, onOpenChange: handleClose, children: /* @__PURE__ */ jsxRuntime.jsxs(designSystem.Dialog.Content, { children: [
|
2470
|
+
/* @__PURE__ */ jsxRuntime.jsx(designSystem.Dialog.Header, { children: title }),
|
2471
|
+
typeof Content === "function" ? /* @__PURE__ */ jsxRuntime.jsx(Content, { onClose: handleClose }) : Content
|
2472
|
+
] }) });
|
2473
|
+
};
|
2367
2474
|
const ConfigureTheViewAction = ({ collectionType, model }) => {
|
2368
2475
|
const navigate = reactRouterDom.useNavigate();
|
2369
2476
|
const { formatMessage } = reactIntl.useIntl();
|
@@ -2499,7 +2606,7 @@ const ActionsPanel = () => {
|
|
2499
2606
|
return {
|
2500
2607
|
title: formatMessage({
|
2501
2608
|
id: "content-manager.containers.edit.panels.default.title",
|
2502
|
-
defaultMessage: "
|
2609
|
+
defaultMessage: "Entry"
|
2503
2610
|
}),
|
2504
2611
|
content: /* @__PURE__ */ jsxRuntime.jsx(ActionsPanelContent, {})
|
2505
2612
|
};
|
@@ -2743,7 +2850,8 @@ const formatEditLayout = (data, {
|
|
2743
2850
|
layout: convertEditLayoutToFieldLayouts(
|
2744
2851
|
configuration.layouts.edit,
|
2745
2852
|
components[uid].attributes,
|
2746
|
-
configuration.metadatas
|
2853
|
+
configuration.metadatas,
|
2854
|
+
{ configurations: data.components, schemas: components }
|
2747
2855
|
),
|
2748
2856
|
settings: {
|
2749
2857
|
...configuration.settings,
|
@@ -2900,6 +3008,7 @@ const ConfirmDialogPublishAll = ({
|
|
2900
3008
|
const { _unstableFormatAPIError: formatAPIError } = strapiAdmin.useAPIErrorHandler(getTranslation);
|
2901
3009
|
const { model, schema } = useDoc();
|
2902
3010
|
const [{ query }] = strapiAdmin.useQueryParams();
|
3011
|
+
const enableDraftRelationsCount = false;
|
2903
3012
|
const {
|
2904
3013
|
data: countDraftRelations = 0,
|
2905
3014
|
isLoading,
|
@@ -2911,7 +3020,7 @@ const ConfirmDialogPublishAll = ({
|
|
2911
3020
|
locale: query?.plugins?.i18n?.locale
|
2912
3021
|
},
|
2913
3022
|
{
|
2914
|
-
skip:
|
3023
|
+
skip: !enableDraftRelationsCount
|
2915
3024
|
}
|
2916
3025
|
);
|
2917
3026
|
React__namespace.useEffect(() => {
|
@@ -3096,7 +3205,7 @@ const SelectedEntriesTableContent = ({
|
|
3096
3205
|
status: row.status
|
3097
3206
|
}
|
3098
3207
|
) }),
|
3099
|
-
/* @__PURE__ */ jsxRuntime.jsx(strapiAdmin.Table.Cell, { children: /* @__PURE__ */ jsxRuntime.jsx(
|
3208
|
+
/* @__PURE__ */ jsxRuntime.jsx(strapiAdmin.Table.Cell, { children: /* @__PURE__ */ jsxRuntime.jsx(designSystem.Flex, { children: /* @__PURE__ */ jsxRuntime.jsx(
|
3100
3209
|
designSystem.IconButton,
|
3101
3210
|
{
|
3102
3211
|
tag: reactRouterDom.Link,
|
@@ -3119,9 +3228,10 @@ const SelectedEntriesTableContent = ({
|
|
3119
3228
|
),
|
3120
3229
|
target: "_blank",
|
3121
3230
|
marginLeft: "auto",
|
3122
|
-
|
3231
|
+
variant: "ghost",
|
3232
|
+
children: /* @__PURE__ */ jsxRuntime.jsx(Icons.Pencil, { width: "1.6rem", height: "1.6rem" })
|
3123
3233
|
}
|
3124
|
-
) })
|
3234
|
+
) }) })
|
3125
3235
|
] }, row.id)) })
|
3126
3236
|
] });
|
3127
3237
|
};
|
@@ -3158,7 +3268,13 @@ const SelectedEntriesModalContent = ({
|
|
3158
3268
|
);
|
3159
3269
|
const { rows, validationErrors } = React__namespace.useMemo(() => {
|
3160
3270
|
if (data.length > 0 && schema) {
|
3161
|
-
const validate = createYupSchema(
|
3271
|
+
const validate = createYupSchema(
|
3272
|
+
schema.attributes,
|
3273
|
+
components,
|
3274
|
+
// Since this is the "Publish" action, the validation
|
3275
|
+
// schema must enforce the rules for published entities
|
3276
|
+
{ status: "published" }
|
3277
|
+
);
|
3162
3278
|
const validationErrors2 = {};
|
3163
3279
|
const rows2 = data.map((entry) => {
|
3164
3280
|
try {
|
@@ -3508,7 +3624,7 @@ const TableActions = ({ document }) => {
|
|
3508
3624
|
strapiAdmin.DescriptionComponentRenderer,
|
3509
3625
|
{
|
3510
3626
|
props,
|
3511
|
-
descriptions: plugins["content-manager"].apis.getDocumentActions(),
|
3627
|
+
descriptions: plugins["content-manager"].apis.getDocumentActions().filter((action) => action.name !== "PublishAction"),
|
3512
3628
|
children: (actions2) => {
|
3513
3629
|
const tableRowActions = actions2.filter((action) => {
|
3514
3630
|
const positions = Array.isArray(action.position) ? action.position : [action.position];
|
@@ -3619,7 +3735,7 @@ const CloneAction = ({ model, documentId }) => {
|
|
3619
3735
|
}),
|
3620
3736
|
content: /* @__PURE__ */ jsxRuntime.jsx(AutoCloneFailureModalBody, { prohibitedFields }),
|
3621
3737
|
footer: ({ onClose }) => {
|
3622
|
-
return /* @__PURE__ */ jsxRuntime.jsxs(designSystem.
|
3738
|
+
return /* @__PURE__ */ jsxRuntime.jsxs(designSystem.Modal.Footer, { children: [
|
3623
3739
|
/* @__PURE__ */ jsxRuntime.jsx(designSystem.Button, { onClick: onClose, variant: "tertiary", children: formatMessage({
|
3624
3740
|
id: "cancel",
|
3625
3741
|
defaultMessage: "Cancel"
|
@@ -3850,7 +3966,7 @@ const index = {
|
|
3850
3966
|
app.router.addRoute({
|
3851
3967
|
path: "content-manager/*",
|
3852
3968
|
lazy: async () => {
|
3853
|
-
const { Layout } = await Promise.resolve().then(() => require("./layout-
|
3969
|
+
const { Layout } = await Promise.resolve().then(() => require("./layout-bE-WUnQ0.js"));
|
3854
3970
|
return {
|
3855
3971
|
Component: Layout
|
3856
3972
|
};
|
@@ -3867,7 +3983,7 @@ const index = {
|
|
3867
3983
|
async registerTrads({ locales }) {
|
3868
3984
|
const importedTrads = await Promise.all(
|
3869
3985
|
locales.map((locale) => {
|
3870
|
-
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-
|
3986
|
+
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-BVzUkPxZ.js")), "./translations/es.json": () => Promise.resolve().then(() => require("./es-EUonQTon.js")), "./translations/eu.json": () => Promise.resolve().then(() => require("./eu-VDH-3ovk.js")), "./translations/fr.json": () => Promise.resolve().then(() => require("./fr-B7kGGg3E.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-CcFe8diO.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`).then(({ default: data }) => {
|
3871
3987
|
return {
|
3872
3988
|
data: prefixPluginTranslations(data, PLUGIN_ID),
|
3873
3989
|
locale
|
@@ -3885,6 +4001,7 @@ const index = {
|
|
3885
4001
|
};
|
3886
4002
|
exports.ATTRIBUTE_TYPES_THAT_CANNOT_BE_MAIN_FIELD = ATTRIBUTE_TYPES_THAT_CANNOT_BE_MAIN_FIELD;
|
3887
4003
|
exports.BulkActionsRenderer = BulkActionsRenderer;
|
4004
|
+
exports.CLONE_PATH = CLONE_PATH;
|
3888
4005
|
exports.COLLECTION_TYPES = COLLECTION_TYPES;
|
3889
4006
|
exports.CREATOR_FIELDS = CREATOR_FIELDS;
|
3890
4007
|
exports.DEFAULT_SETTINGS = DEFAULT_SETTINGS;
|
@@ -3924,4 +4041,4 @@ exports.useGetAllDocumentsQuery = useGetAllDocumentsQuery;
|
|
3924
4041
|
exports.useGetContentTypeConfigurationQuery = useGetContentTypeConfigurationQuery;
|
3925
4042
|
exports.useGetInitialDataQuery = useGetInitialDataQuery;
|
3926
4043
|
exports.useUpdateContentTypeConfigurationMutation = useUpdateContentTypeConfigurationMutation;
|
3927
|
-
//# sourceMappingURL=index-
|
4044
|
+
//# sourceMappingURL=index-DXiHxy70.js.map
|