@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
@@ -1,16 +1,16 @@
|
|
1
|
-
import {
|
1
|
+
import { More, Cross, WarningCircle, ListPlus, Pencil, Trash, Check, CrossCircle, CheckCircle, ArrowsCounterClockwise, ChevronRight, Duplicate, ClockCounterClockwise, Feather } from "@strapi/icons";
|
2
2
|
import { jsx, Fragment, jsxs } from "react/jsx-runtime";
|
3
3
|
import { useStrapiApp, createContext, useAuth, useRBAC, Page, adminApi, translatedErrors, useNotification, useAPIErrorHandler, getYupValidationErrors, useQueryParams, useTracking, useForm, BackButton, DescriptionComponentRenderer, useTable, Table } from "@strapi/admin/strapi-admin";
|
4
4
|
import * as React from "react";
|
5
5
|
import { lazy } from "react";
|
6
|
-
import { Button, Menu, VisuallyHidden, Flex,
|
6
|
+
import { Button, Menu, VisuallyHidden, Flex, Typography, Dialog, Modal, Radio, Status, Box, SingleSelect, SingleSelectOption, IconButton, Loader, Tooltip, LinkButton } from "@strapi/design-system";
|
7
7
|
import { useIntl } from "react-intl";
|
8
|
-
import { useParams,
|
9
|
-
import { styled } from "styled-components";
|
8
|
+
import { useParams, useNavigate, Navigate, useMatch, useLocation, Link, NavLink } from "react-router-dom";
|
10
9
|
import * as yup from "yup";
|
11
10
|
import { ValidationError } from "yup";
|
12
11
|
import pipe from "lodash/fp/pipe";
|
13
12
|
import { intervalToDuration, isPast } from "date-fns";
|
13
|
+
import { styled } from "styled-components";
|
14
14
|
import { stringify } from "qs";
|
15
15
|
import { createSlice, combineReducers } from "@reduxjs/toolkit";
|
16
16
|
const __variableDynamicImportRuntimeHelper = (glob, path) => {
|
@@ -158,7 +158,8 @@ const contentManagerApi = adminApi.enhanceEndpoints({
|
|
158
158
|
"Document",
|
159
159
|
"InitialData",
|
160
160
|
"HistoryVersion",
|
161
|
-
"Relations"
|
161
|
+
"Relations",
|
162
|
+
"UidAvailability"
|
162
163
|
]
|
163
164
|
});
|
164
165
|
const documentApi = contentManagerApi.injectEndpoints({
|
@@ -172,7 +173,12 @@ const documentApi = contentManagerApi.injectEndpoints({
|
|
172
173
|
params: query
|
173
174
|
}
|
174
175
|
}),
|
175
|
-
invalidatesTags: (_result,
|
176
|
+
invalidatesTags: (_result, error, { model }) => {
|
177
|
+
if (error) {
|
178
|
+
return [];
|
179
|
+
}
|
180
|
+
return [{ type: "Document", id: `${model}_LIST` }];
|
181
|
+
}
|
176
182
|
}),
|
177
183
|
cloneDocument: builder.mutation({
|
178
184
|
query: ({ model, sourceId, data, params }) => ({
|
@@ -183,7 +189,10 @@ const documentApi = contentManagerApi.injectEndpoints({
|
|
183
189
|
params
|
184
190
|
}
|
185
191
|
}),
|
186
|
-
invalidatesTags: (_result, _error, { model }) => [
|
192
|
+
invalidatesTags: (_result, _error, { model }) => [
|
193
|
+
{ type: "Document", id: `${model}_LIST` },
|
194
|
+
{ type: "UidAvailability", id: model }
|
195
|
+
]
|
187
196
|
}),
|
188
197
|
/**
|
189
198
|
* Creates a new collection-type document. This should ONLY be used for collection-types.
|
@@ -200,7 +209,8 @@ const documentApi = contentManagerApi.injectEndpoints({
|
|
200
209
|
}),
|
201
210
|
invalidatesTags: (result, _error, { model }) => [
|
202
211
|
{ type: "Document", id: `${model}_LIST` },
|
203
|
-
"Relations"
|
212
|
+
"Relations",
|
213
|
+
{ type: "UidAvailability", id: model }
|
204
214
|
]
|
205
215
|
}),
|
206
216
|
deleteDocument: builder.mutation({
|
@@ -241,7 +251,8 @@ const documentApi = contentManagerApi.injectEndpoints({
|
|
241
251
|
id: collectionType !== SINGLE_TYPES ? `${model}_${documentId}` : model
|
242
252
|
},
|
243
253
|
{ type: "Document", id: `${model}_LIST` },
|
244
|
-
"Relations"
|
254
|
+
"Relations",
|
255
|
+
{ type: "UidAvailability", id: model }
|
245
256
|
];
|
246
257
|
}
|
247
258
|
}),
|
@@ -259,6 +270,7 @@ const documentApi = contentManagerApi.injectEndpoints({
|
|
259
270
|
}),
|
260
271
|
providesTags: (result, _error, arg) => {
|
261
272
|
return [
|
273
|
+
{ type: "Document", id: `ALL_LIST` },
|
262
274
|
{ type: "Document", id: `${arg.model}_LIST` },
|
263
275
|
...result?.results.map(({ documentId }) => ({
|
264
276
|
type: "Document",
|
@@ -297,6 +309,11 @@ const documentApi = contentManagerApi.injectEndpoints({
|
|
297
309
|
{
|
298
310
|
type: "Document",
|
299
311
|
id: collectionType !== SINGLE_TYPES ? `${model}_${result && "documentId" in result ? result.documentId : documentId}` : model
|
312
|
+
},
|
313
|
+
// Make it easy to invalidate all individual documents queries for a model
|
314
|
+
{
|
315
|
+
type: "Document",
|
316
|
+
id: `${model}_ALL_ITEMS`
|
300
317
|
}
|
301
318
|
];
|
302
319
|
}
|
@@ -360,8 +377,21 @@ const documentApi = contentManagerApi.injectEndpoints({
|
|
360
377
|
type: "Document",
|
361
378
|
id: collectionType !== SINGLE_TYPES ? `${model}_${documentId}` : model
|
362
379
|
},
|
363
|
-
"Relations"
|
380
|
+
"Relations",
|
381
|
+
{ type: "UidAvailability", id: model }
|
364
382
|
];
|
383
|
+
},
|
384
|
+
async onQueryStarted({ data, ...patch }, { dispatch, queryFulfilled }) {
|
385
|
+
const patchResult = dispatch(
|
386
|
+
documentApi.util.updateQueryData("getDocument", patch, (draft) => {
|
387
|
+
Object.assign(draft.data, data);
|
388
|
+
})
|
389
|
+
);
|
390
|
+
try {
|
391
|
+
await queryFulfilled;
|
392
|
+
} catch {
|
393
|
+
patchResult.undo();
|
394
|
+
}
|
365
395
|
}
|
366
396
|
}),
|
367
397
|
unpublishDocument: builder.mutation({
|
@@ -431,7 +461,7 @@ const buildValidParams = (query) => {
|
|
431
461
|
const isBaseQueryError = (error) => {
|
432
462
|
return error.name !== void 0;
|
433
463
|
};
|
434
|
-
const createYupSchema = (attributes = {}, components = {}) => {
|
464
|
+
const createYupSchema = (attributes = {}, components = {}, options = { status: null }) => {
|
435
465
|
const createModelSchema = (attributes2) => yup.object().shape(
|
436
466
|
Object.entries(attributes2).reduce((acc, [name, attribute]) => {
|
437
467
|
if (DOCUMENT_META_FIELDS.includes(name)) {
|
@@ -444,7 +474,7 @@ const createYupSchema = (attributes = {}, components = {}) => {
|
|
444
474
|
addMinValidation,
|
445
475
|
addMaxValidation,
|
446
476
|
addRegexValidation
|
447
|
-
].map((fn) => fn(attribute));
|
477
|
+
].map((fn) => fn(attribute, options));
|
448
478
|
const transformSchema = pipe(...validations);
|
449
479
|
switch (attribute.type) {
|
450
480
|
case "component": {
|
@@ -545,6 +575,14 @@ const createAttributeSchema = (attribute) => {
|
|
545
575
|
if (!value || typeof value === "string" && value.length === 0) {
|
546
576
|
return true;
|
547
577
|
}
|
578
|
+
if (typeof value === "object") {
|
579
|
+
try {
|
580
|
+
JSON.stringify(value);
|
581
|
+
return true;
|
582
|
+
} catch (err) {
|
583
|
+
return false;
|
584
|
+
}
|
585
|
+
}
|
548
586
|
try {
|
549
587
|
JSON.parse(value);
|
550
588
|
return true;
|
@@ -563,13 +601,7 @@ const createAttributeSchema = (attribute) => {
|
|
563
601
|
return yup.mixed();
|
564
602
|
}
|
565
603
|
};
|
566
|
-
const
|
567
|
-
if ((attribute.type === "component" && attribute.repeatable || attribute.type === "dynamiczone") && attribute.required && "min" in schema) {
|
568
|
-
return schema.min(1, translatedErrors.required);
|
569
|
-
}
|
570
|
-
if (attribute.required && attribute.type !== "relation") {
|
571
|
-
return schema.required(translatedErrors.required);
|
572
|
-
}
|
604
|
+
const nullableSchema = (schema) => {
|
573
605
|
return schema?.nullable ? schema.nullable() : (
|
574
606
|
// In some cases '.nullable' will not be available on the schema.
|
575
607
|
// e.g. when the schema has been built using yup.lazy (e.g. for relations).
|
@@ -577,7 +609,22 @@ const addRequiredValidation = (attribute) => (schema) => {
|
|
577
609
|
schema
|
578
610
|
);
|
579
611
|
};
|
580
|
-
const
|
612
|
+
const addRequiredValidation = (attribute, options) => (schema) => {
|
613
|
+
if (options.status === "draft") {
|
614
|
+
return nullableSchema(schema);
|
615
|
+
}
|
616
|
+
if ((attribute.type === "component" && attribute.repeatable || attribute.type === "dynamiczone") && attribute.required && "min" in schema) {
|
617
|
+
return schema.min(1, translatedErrors.required);
|
618
|
+
}
|
619
|
+
if (attribute.required && attribute.type !== "relation") {
|
620
|
+
return schema.required(translatedErrors.required);
|
621
|
+
}
|
622
|
+
return nullableSchema(schema);
|
623
|
+
};
|
624
|
+
const addMinLengthValidation = (attribute, options) => (schema) => {
|
625
|
+
if (options.status === "draft") {
|
626
|
+
return schema;
|
627
|
+
}
|
581
628
|
if ("minLength" in attribute && attribute.minLength && Number.isInteger(attribute.minLength) && "min" in schema) {
|
582
629
|
return schema.min(attribute.minLength, {
|
583
630
|
...translatedErrors.minLength,
|
@@ -599,11 +646,11 @@ const addMaxLengthValidation = (attribute) => (schema) => {
|
|
599
646
|
}
|
600
647
|
return schema;
|
601
648
|
};
|
602
|
-
const addMinValidation = (attribute) => (schema) => {
|
649
|
+
const addMinValidation = (attribute, options) => (schema) => {
|
603
650
|
if ("min" in attribute) {
|
604
651
|
const min = toInteger(attribute.min);
|
605
652
|
if (attribute.type === "component" && attribute.repeatable || attribute.type === "dynamiczone") {
|
606
|
-
if (!attribute.required && "test" in schema && min) {
|
653
|
+
if (options.status !== "draft" && !attribute.required && "test" in schema && min) {
|
607
654
|
return schema.test(
|
608
655
|
"custom-min",
|
609
656
|
{
|
@@ -839,6 +886,7 @@ const useDocumentActions = () => {
|
|
839
886
|
const { formatMessage } = useIntl();
|
840
887
|
const { trackUsage } = useTracking();
|
841
888
|
const { _unstableFormatAPIError: formatAPIError } = useAPIErrorHandler();
|
889
|
+
const navigate = useNavigate();
|
842
890
|
const [deleteDocument] = useDeleteDocumentMutation();
|
843
891
|
const _delete = React.useCallback(
|
844
892
|
async ({ collectionType, model, documentId, params }, trackerProperty) => {
|
@@ -1174,7 +1222,6 @@ const useDocumentActions = () => {
|
|
1174
1222
|
sourceId
|
1175
1223
|
});
|
1176
1224
|
if ("error" in res) {
|
1177
|
-
toggleNotification({ type: "danger", message: formatAPIError(res.error) });
|
1178
1225
|
return { error: res.error };
|
1179
1226
|
}
|
1180
1227
|
toggleNotification({
|
@@ -1193,7 +1240,7 @@ const useDocumentActions = () => {
|
|
1193
1240
|
throw err;
|
1194
1241
|
}
|
1195
1242
|
},
|
1196
|
-
[autoCloneDocument,
|
1243
|
+
[autoCloneDocument, formatMessage, toggleNotification]
|
1197
1244
|
);
|
1198
1245
|
const [cloneDocument] = useCloneDocumentMutation();
|
1199
1246
|
const clone = React.useCallback(
|
@@ -1219,6 +1266,7 @@ const useDocumentActions = () => {
|
|
1219
1266
|
defaultMessage: "Cloned document"
|
1220
1267
|
})
|
1221
1268
|
});
|
1269
|
+
navigate(`../../${res.data.data.documentId}`, { relative: "path" });
|
1222
1270
|
return res.data;
|
1223
1271
|
} catch (err) {
|
1224
1272
|
toggleNotification({
|
@@ -1229,7 +1277,7 @@ const useDocumentActions = () => {
|
|
1229
1277
|
throw err;
|
1230
1278
|
}
|
1231
1279
|
},
|
1232
|
-
[cloneDocument, trackUsage, toggleNotification, formatMessage, formatAPIError]
|
1280
|
+
[cloneDocument, trackUsage, toggleNotification, formatMessage, formatAPIError, navigate]
|
1233
1281
|
);
|
1234
1282
|
const [getDoc] = useLazyGetDocumentQuery();
|
1235
1283
|
const getDocument = React.useCallback(
|
@@ -1255,7 +1303,7 @@ const useDocumentActions = () => {
|
|
1255
1303
|
};
|
1256
1304
|
};
|
1257
1305
|
const ProtectedHistoryPage = lazy(
|
1258
|
-
() => import("./History-
|
1306
|
+
() => import("./History-utls71em.mjs").then((mod) => ({ default: mod.ProtectedHistoryPage }))
|
1259
1307
|
);
|
1260
1308
|
const routes$1 = [
|
1261
1309
|
{
|
@@ -1268,31 +1316,31 @@ const routes$1 = [
|
|
1268
1316
|
}
|
1269
1317
|
];
|
1270
1318
|
const ProtectedEditViewPage = lazy(
|
1271
|
-
() => import("./EditViewPage-
|
1319
|
+
() => import("./EditViewPage-zFjJK0s8.mjs").then((mod) => ({ default: mod.ProtectedEditViewPage }))
|
1272
1320
|
);
|
1273
1321
|
const ProtectedListViewPage = lazy(
|
1274
|
-
() => import("./ListViewPage-
|
1322
|
+
() => import("./ListViewPage-CdKd-PS_.mjs").then((mod) => ({ default: mod.ProtectedListViewPage }))
|
1275
1323
|
);
|
1276
1324
|
const ProtectedListConfiguration = lazy(
|
1277
|
-
() => import("./ListConfigurationPage-
|
1325
|
+
() => import("./ListConfigurationPage-CuMXWWqb.mjs").then((mod) => ({
|
1278
1326
|
default: mod.ProtectedListConfiguration
|
1279
1327
|
}))
|
1280
1328
|
);
|
1281
1329
|
const ProtectedEditConfigurationPage = lazy(
|
1282
|
-
() => import("./EditConfigurationPage-
|
1330
|
+
() => import("./EditConfigurationPage-I2kKh9dx.mjs").then((mod) => ({
|
1283
1331
|
default: mod.ProtectedEditConfigurationPage
|
1284
1332
|
}))
|
1285
1333
|
);
|
1286
1334
|
const ProtectedComponentConfigurationPage = lazy(
|
1287
|
-
() => import("./ComponentConfigurationPage-
|
1335
|
+
() => import("./ComponentConfigurationPage-CnL10QYC.mjs").then((mod) => ({
|
1288
1336
|
default: mod.ProtectedComponentConfigurationPage
|
1289
1337
|
}))
|
1290
1338
|
);
|
1291
1339
|
const NoPermissions = lazy(
|
1292
|
-
() => import("./NoPermissionsPage-
|
1340
|
+
() => import("./NoPermissionsPage-DlWi4BAH.mjs").then((mod) => ({ default: mod.NoPermissions }))
|
1293
1341
|
);
|
1294
1342
|
const NoContentType = lazy(
|
1295
|
-
() => import("./NoContentTypePage-
|
1343
|
+
() => import("./NoContentTypePage-DkToTT7u.mjs").then((mod) => ({ default: mod.NoContentType }))
|
1296
1344
|
);
|
1297
1345
|
const CollectionTypePages = () => {
|
1298
1346
|
const { collectionType } = useParams();
|
@@ -1406,12 +1454,14 @@ const DocumentActionButton = (action) => {
|
|
1406
1454
|
/* @__PURE__ */ jsx(
|
1407
1455
|
Button,
|
1408
1456
|
{
|
1409
|
-
flex:
|
1457
|
+
flex: "auto",
|
1410
1458
|
startIcon: action.icon,
|
1411
1459
|
disabled: action.disabled,
|
1412
1460
|
onClick: handleClick(action),
|
1413
1461
|
justifyContent: "center",
|
1414
1462
|
variant: action.variant || "default",
|
1463
|
+
paddingTop: "7px",
|
1464
|
+
paddingBottom: "7px",
|
1415
1465
|
children: action.label
|
1416
1466
|
}
|
1417
1467
|
),
|
@@ -1476,9 +1526,9 @@ const DocumentActionsMenu = ({
|
|
1476
1526
|
disabled: isDisabled,
|
1477
1527
|
size: "S",
|
1478
1528
|
endIcon: null,
|
1479
|
-
paddingTop: "
|
1480
|
-
paddingLeft: "
|
1481
|
-
paddingRight: "
|
1529
|
+
paddingTop: "4px",
|
1530
|
+
paddingLeft: "7px",
|
1531
|
+
paddingRight: "7px",
|
1482
1532
|
variant,
|
1483
1533
|
children: [
|
1484
1534
|
/* @__PURE__ */ jsx(More, { "aria-hidden": true, focusable: false }),
|
@@ -1489,7 +1539,7 @@ const DocumentActionsMenu = ({
|
|
1489
1539
|
]
|
1490
1540
|
}
|
1491
1541
|
),
|
1492
|
-
/* @__PURE__ */ jsxs(Menu.Content, {
|
1542
|
+
/* @__PURE__ */ jsxs(Menu.Content, { maxHeight: void 0, popoverPlacement: "bottom-end", children: [
|
1493
1543
|
actions2.map((action) => {
|
1494
1544
|
return /* @__PURE__ */ jsx(
|
1495
1545
|
Menu.Item,
|
@@ -1498,10 +1548,25 @@ const DocumentActionsMenu = ({
|
|
1498
1548
|
onSelect: handleClick(action),
|
1499
1549
|
display: "block",
|
1500
1550
|
children: /* @__PURE__ */ jsxs(Flex, { justifyContent: "space-between", gap: 4, children: [
|
1501
|
-
/* @__PURE__ */ jsxs(
|
1502
|
-
|
1503
|
-
|
1504
|
-
|
1551
|
+
/* @__PURE__ */ jsxs(
|
1552
|
+
Flex,
|
1553
|
+
{
|
1554
|
+
color: !action.disabled ? convertActionVariantToColor(action.variant) : "inherit",
|
1555
|
+
gap: 2,
|
1556
|
+
tag: "span",
|
1557
|
+
children: [
|
1558
|
+
/* @__PURE__ */ jsx(
|
1559
|
+
Flex,
|
1560
|
+
{
|
1561
|
+
tag: "span",
|
1562
|
+
color: !action.disabled ? convertActionVariantToIconColor(action.variant) : "inherit",
|
1563
|
+
children: action.icon
|
1564
|
+
}
|
1565
|
+
),
|
1566
|
+
action.label
|
1567
|
+
]
|
1568
|
+
}
|
1569
|
+
),
|
1505
1570
|
action.id.startsWith("HistoryAction") && /* @__PURE__ */ jsx(
|
1506
1571
|
Flex,
|
1507
1572
|
{
|
@@ -1598,11 +1663,11 @@ const DocumentActionConfirmDialog = ({
|
|
1598
1663
|
/* @__PURE__ */ jsx(Dialog.Header, { children: title }),
|
1599
1664
|
/* @__PURE__ */ jsx(Dialog.Body, { children: content }),
|
1600
1665
|
/* @__PURE__ */ jsxs(Dialog.Footer, { children: [
|
1601
|
-
/* @__PURE__ */ jsx(Dialog.Cancel, { children: /* @__PURE__ */ jsx(Button, { variant: "tertiary", children: formatMessage({
|
1666
|
+
/* @__PURE__ */ jsx(Dialog.Cancel, { children: /* @__PURE__ */ jsx(Button, { variant: "tertiary", fullWidth: true, children: formatMessage({
|
1602
1667
|
id: "app.components.Button.cancel",
|
1603
1668
|
defaultMessage: "Cancel"
|
1604
1669
|
}) }) }),
|
1605
|
-
/* @__PURE__ */ jsx(Button, { onClick: handleConfirm, variant, children: formatMessage({
|
1670
|
+
/* @__PURE__ */ jsx(Button, { onClick: handleConfirm, variant, fullWidth: true, children: formatMessage({
|
1606
1671
|
id: "app.components.Button.confirm",
|
1607
1672
|
defaultMessage: "Confirm"
|
1608
1673
|
}) })
|
@@ -1625,8 +1690,8 @@ const DocumentActionModal = ({
|
|
1625
1690
|
};
|
1626
1691
|
return /* @__PURE__ */ jsx(Modal.Root, { open: isOpen, onOpenChange: handleClose, children: /* @__PURE__ */ jsxs(Modal.Content, { children: [
|
1627
1692
|
/* @__PURE__ */ jsx(Modal.Header, { children: /* @__PURE__ */ jsx(Modal.Title, { children: title }) }),
|
1628
|
-
|
1629
|
-
|
1693
|
+
typeof Content === "function" ? /* @__PURE__ */ jsx(Content, { onClose: handleClose }) : /* @__PURE__ */ jsx(Modal.Body, { children: Content }),
|
1694
|
+
typeof Footer === "function" ? /* @__PURE__ */ jsx(Footer, { onClose: handleClose }) : Footer
|
1630
1695
|
] }) });
|
1631
1696
|
};
|
1632
1697
|
const PublishAction$1 = ({
|
@@ -1641,12 +1706,10 @@ const PublishAction$1 = ({
|
|
1641
1706
|
const navigate = useNavigate();
|
1642
1707
|
const { toggleNotification } = useNotification();
|
1643
1708
|
const { _unstableFormatValidationErrors: formatValidationErrors } = useAPIErrorHandler();
|
1709
|
+
const isListView = useMatch(LIST_PATH) !== null;
|
1644
1710
|
const isCloning = useMatch(CLONE_PATH) !== null;
|
1645
1711
|
const { formatMessage } = useIntl();
|
1646
|
-
const { canPublish
|
1647
|
-
"PublishAction",
|
1648
|
-
({ canPublish: canPublish2, canCreate: canCreate2, canUpdate: canUpdate2 }) => ({ canPublish: canPublish2, canCreate: canCreate2, canUpdate: canUpdate2 })
|
1649
|
-
);
|
1712
|
+
const canPublish = useDocumentRBAC("PublishAction", ({ canPublish: canPublish2 }) => canPublish2);
|
1650
1713
|
const { publish } = useDocumentActions();
|
1651
1714
|
const [
|
1652
1715
|
countDraftRelations,
|
@@ -1698,24 +1761,25 @@ const PublishAction$1 = ({
|
|
1698
1761
|
}
|
1699
1762
|
}, [documentId, modified, formValues, setLocalCountOfDraftRelations]);
|
1700
1763
|
React.useEffect(() => {
|
1701
|
-
if (documentId) {
|
1702
|
-
|
1703
|
-
const { data, error } = await countDraftRelations({
|
1704
|
-
collectionType,
|
1705
|
-
model,
|
1706
|
-
documentId,
|
1707
|
-
params
|
1708
|
-
});
|
1709
|
-
if (error) {
|
1710
|
-
throw error;
|
1711
|
-
}
|
1712
|
-
if (data) {
|
1713
|
-
setServerCountOfDraftRelations(data.data);
|
1714
|
-
}
|
1715
|
-
};
|
1716
|
-
fetchDraftRelationsCount();
|
1764
|
+
if (!document || !document.documentId || isListView) {
|
1765
|
+
return;
|
1717
1766
|
}
|
1718
|
-
|
1767
|
+
const fetchDraftRelationsCount = async () => {
|
1768
|
+
const { data, error } = await countDraftRelations({
|
1769
|
+
collectionType,
|
1770
|
+
model,
|
1771
|
+
documentId,
|
1772
|
+
params
|
1773
|
+
});
|
1774
|
+
if (error) {
|
1775
|
+
throw error;
|
1776
|
+
}
|
1777
|
+
if (data) {
|
1778
|
+
setServerCountOfDraftRelations(data.data);
|
1779
|
+
}
|
1780
|
+
};
|
1781
|
+
fetchDraftRelationsCount();
|
1782
|
+
}, [isListView, document, documentId, countDraftRelations, collectionType, model, params]);
|
1719
1783
|
const isDocumentPublished = (document?.[PUBLISHED_AT_ATTRIBUTE_NAME] || meta?.availableStatus.some((doc) => doc[PUBLISHED_AT_ATTRIBUTE_NAME] !== null)) && document?.status !== "modified";
|
1720
1784
|
if (!schema?.options?.draftAndPublish) {
|
1721
1785
|
return null;
|
@@ -1756,7 +1820,8 @@ const PublishAction$1 = ({
|
|
1756
1820
|
}
|
1757
1821
|
};
|
1758
1822
|
const totalDraftRelations = localCountOfDraftRelations + serverCountOfDraftRelations;
|
1759
|
-
const
|
1823
|
+
const enableDraftRelationsCount = false;
|
1824
|
+
const hasDraftRelations = enableDraftRelationsCount;
|
1760
1825
|
return {
|
1761
1826
|
/**
|
1762
1827
|
* Disabled when:
|
@@ -1766,18 +1831,13 @@ const PublishAction$1 = ({
|
|
1766
1831
|
* - the document is already published & not modified
|
1767
1832
|
* - the document is being created & not modified
|
1768
1833
|
* - the user doesn't have the permission to publish
|
1769
|
-
* - the user doesn't have the permission to create a new document
|
1770
|
-
* - the user doesn't have the permission to update the document
|
1771
1834
|
*/
|
1772
|
-
disabled: isCloning || isSubmitting || isLoadingDraftRelations || activeTab === "published" || !modified && isDocumentPublished || !modified && !document?.documentId || !canPublish
|
1835
|
+
disabled: isCloning || isSubmitting || isLoadingDraftRelations || activeTab === "published" || !modified && isDocumentPublished || !modified && !document?.documentId || !canPublish,
|
1773
1836
|
label: formatMessage({
|
1774
1837
|
id: "app.utils.publish",
|
1775
1838
|
defaultMessage: "Publish"
|
1776
1839
|
}),
|
1777
1840
|
onClick: async () => {
|
1778
|
-
if (hasDraftRelations) {
|
1779
|
-
return;
|
1780
|
-
}
|
1781
1841
|
await performPublish();
|
1782
1842
|
},
|
1783
1843
|
dialog: hasDraftRelations ? {
|
@@ -1816,10 +1876,6 @@ const UpdateAction = ({
|
|
1816
1876
|
const cloneMatch = useMatch(CLONE_PATH);
|
1817
1877
|
const isCloning = cloneMatch !== null;
|
1818
1878
|
const { formatMessage } = useIntl();
|
1819
|
-
const { canCreate, canUpdate } = useDocumentRBAC("UpdateAction", ({ canCreate: canCreate2, canUpdate: canUpdate2 }) => ({
|
1820
|
-
canCreate: canCreate2,
|
1821
|
-
canUpdate: canUpdate2
|
1822
|
-
}));
|
1823
1879
|
const { create, update, clone } = useDocumentActions();
|
1824
1880
|
const [{ query, rawQuery }] = useQueryParams();
|
1825
1881
|
const params = React.useMemo(() => buildValidParams(query), [query]);
|
@@ -1836,10 +1892,8 @@ const UpdateAction = ({
|
|
1836
1892
|
* - the form is submitting
|
1837
1893
|
* - the document is not modified & we're not cloning (you can save a clone entity straight away)
|
1838
1894
|
* - the active tab is the published tab
|
1839
|
-
* - the user doesn't have the permission to create a new document
|
1840
|
-
* - the user doesn't have the permission to update the document
|
1841
1895
|
*/
|
1842
|
-
disabled: isSubmitting || !modified && !isCloning || activeTab === "published"
|
1896
|
+
disabled: isSubmitting || !modified && !isCloning || activeTab === "published",
|
1843
1897
|
label: formatMessage({
|
1844
1898
|
id: "content-manager.containers.Edit.save",
|
1845
1899
|
defaultMessage: "Save"
|
@@ -1847,16 +1901,18 @@ const UpdateAction = ({
|
|
1847
1901
|
onClick: async () => {
|
1848
1902
|
setSubmitting(true);
|
1849
1903
|
try {
|
1850
|
-
|
1851
|
-
|
1852
|
-
|
1853
|
-
|
1854
|
-
|
1855
|
-
|
1856
|
-
|
1857
|
-
|
1858
|
-
|
1859
|
-
|
1904
|
+
if (activeTab !== "draft") {
|
1905
|
+
const { errors } = await validate();
|
1906
|
+
if (errors) {
|
1907
|
+
toggleNotification({
|
1908
|
+
type: "danger",
|
1909
|
+
message: formatMessage({
|
1910
|
+
id: "content-manager.validation.error",
|
1911
|
+
defaultMessage: "There are validation errors in your document. Please fix them before saving."
|
1912
|
+
})
|
1913
|
+
});
|
1914
|
+
return;
|
1915
|
+
}
|
1860
1916
|
}
|
1861
1917
|
if (isCloning) {
|
1862
1918
|
const res = await clone(
|
@@ -1868,10 +1924,13 @@ const UpdateAction = ({
|
|
1868
1924
|
document
|
1869
1925
|
);
|
1870
1926
|
if ("data" in res) {
|
1871
|
-
navigate(
|
1872
|
-
|
1873
|
-
|
1874
|
-
|
1927
|
+
navigate(
|
1928
|
+
{
|
1929
|
+
pathname: `../${res.data.documentId}`,
|
1930
|
+
search: rawQuery
|
1931
|
+
},
|
1932
|
+
{ relative: "path" }
|
1933
|
+
);
|
1875
1934
|
} else if ("error" in res && isBaseQueryError(res.error) && res.error.name === "ValidationError") {
|
1876
1935
|
setErrors(formatValidationErrors(res.error));
|
1877
1936
|
}
|
@@ -1901,10 +1960,10 @@ const UpdateAction = ({
|
|
1901
1960
|
if ("data" in res && collectionType !== SINGLE_TYPES) {
|
1902
1961
|
navigate(
|
1903
1962
|
{
|
1904
|
-
pathname: `../${
|
1963
|
+
pathname: `../${res.data.documentId}`,
|
1905
1964
|
search: rawQuery
|
1906
1965
|
},
|
1907
|
-
{ replace: true }
|
1966
|
+
{ replace: true, relative: "path" }
|
1908
1967
|
);
|
1909
1968
|
} else if ("error" in res && isBaseQueryError(res.error) && res.error.name === "ValidationError") {
|
1910
1969
|
setErrors(formatValidationErrors(res.error));
|
@@ -1949,7 +2008,7 @@ const UnpublishAction$1 = ({
|
|
1949
2008
|
id: "app.utils.unpublish",
|
1950
2009
|
defaultMessage: "Unpublish"
|
1951
2010
|
}),
|
1952
|
-
icon: /* @__PURE__ */ jsx(
|
2011
|
+
icon: /* @__PURE__ */ jsx(Cross, {}),
|
1953
2012
|
onClick: async () => {
|
1954
2013
|
if (!documentId && collectionType !== SINGLE_TYPES || isDocumentModified) {
|
1955
2014
|
if (!documentId) {
|
@@ -2061,7 +2120,7 @@ const DiscardAction = ({
|
|
2061
2120
|
id: "content-manager.actions.discard.label",
|
2062
2121
|
defaultMessage: "Discard changes"
|
2063
2122
|
}),
|
2064
|
-
icon: /* @__PURE__ */ jsx(
|
2123
|
+
icon: /* @__PURE__ */ jsx(Cross, {}),
|
2065
2124
|
position: ["panel", "table-row"],
|
2066
2125
|
variant: "danger",
|
2067
2126
|
dialog: {
|
@@ -2089,11 +2148,6 @@ const DiscardAction = ({
|
|
2089
2148
|
};
|
2090
2149
|
};
|
2091
2150
|
DiscardAction.type = "discard";
|
2092
|
-
const StyledCrossCircle = styled(CrossCircle)`
|
2093
|
-
path {
|
2094
|
-
fill: currentColor;
|
2095
|
-
}
|
2096
|
-
`;
|
2097
2151
|
const DEFAULT_ACTIONS = [PublishAction$1, UpdateAction, UnpublishAction$1, DiscardAction];
|
2098
2152
|
const intervals = ["years", "months", "days", "hours", "minutes", "seconds"];
|
2099
2153
|
const RelativeTime = React.forwardRef(
|
@@ -2141,7 +2195,7 @@ const getDisplayName = ({
|
|
2141
2195
|
};
|
2142
2196
|
const capitalise = (str) => str.charAt(0).toUpperCase() + str.slice(1);
|
2143
2197
|
const DocumentStatus = ({ status = "draft", ...restProps }) => {
|
2144
|
-
const statusVariant = status === "draft" ? "
|
2198
|
+
const statusVariant = status === "draft" ? "secondary" : status === "published" ? "success" : "alternative";
|
2145
2199
|
return /* @__PURE__ */ jsx(Status, { ...restProps, showBullet: false, size: "S", variant: statusVariant, children: /* @__PURE__ */ jsx(Typography, { tag: "span", variant: "omega", fontWeight: "bold", children: capitalise(status) }) });
|
2146
2200
|
};
|
2147
2201
|
const Header = ({ isCreating, status, title: documentTitle = "Untitled" }) => {
|
@@ -2324,8 +2378,22 @@ const Information = ({ activeTab }) => {
|
|
2324
2378
|
);
|
2325
2379
|
};
|
2326
2380
|
const HeaderActions = ({ actions: actions2 }) => {
|
2327
|
-
|
2328
|
-
|
2381
|
+
const [dialogId, setDialogId] = React.useState(null);
|
2382
|
+
const handleClick = (action) => async (e) => {
|
2383
|
+
if (!("options" in action)) {
|
2384
|
+
const { onClick = () => false, dialog, id } = action;
|
2385
|
+
const muteDialog = await onClick(e);
|
2386
|
+
if (dialog && !muteDialog) {
|
2387
|
+
e.preventDefault();
|
2388
|
+
setDialogId(id);
|
2389
|
+
}
|
2390
|
+
}
|
2391
|
+
};
|
2392
|
+
const handleClose = () => {
|
2393
|
+
setDialogId(null);
|
2394
|
+
};
|
2395
|
+
return /* @__PURE__ */ jsx(Flex, { gap: 1, children: actions2.map((action) => {
|
2396
|
+
if (action.options) {
|
2329
2397
|
return /* @__PURE__ */ jsx(
|
2330
2398
|
SingleSelect,
|
2331
2399
|
{
|
@@ -2339,10 +2407,49 @@ const HeaderActions = ({ actions: actions2 }) => {
|
|
2339
2407
|
action.id
|
2340
2408
|
);
|
2341
2409
|
} else {
|
2342
|
-
|
2410
|
+
if (action.type === "icon") {
|
2411
|
+
return /* @__PURE__ */ jsxs(React.Fragment, { children: [
|
2412
|
+
/* @__PURE__ */ jsx(
|
2413
|
+
IconButton,
|
2414
|
+
{
|
2415
|
+
disabled: action.disabled,
|
2416
|
+
label: action.label,
|
2417
|
+
size: "S",
|
2418
|
+
onClick: handleClick(action),
|
2419
|
+
children: action.icon
|
2420
|
+
}
|
2421
|
+
),
|
2422
|
+
action.dialog ? /* @__PURE__ */ jsx(
|
2423
|
+
HeaderActionDialog,
|
2424
|
+
{
|
2425
|
+
...action.dialog,
|
2426
|
+
isOpen: dialogId === action.id,
|
2427
|
+
onClose: handleClose
|
2428
|
+
}
|
2429
|
+
) : null
|
2430
|
+
] }, action.id);
|
2431
|
+
}
|
2343
2432
|
}
|
2344
2433
|
}) });
|
2345
2434
|
};
|
2435
|
+
const HeaderActionDialog = ({
|
2436
|
+
onClose,
|
2437
|
+
onCancel,
|
2438
|
+
title,
|
2439
|
+
content: Content,
|
2440
|
+
isOpen
|
2441
|
+
}) => {
|
2442
|
+
const handleClose = async () => {
|
2443
|
+
if (onCancel) {
|
2444
|
+
await onCancel();
|
2445
|
+
}
|
2446
|
+
onClose();
|
2447
|
+
};
|
2448
|
+
return /* @__PURE__ */ jsx(Dialog.Root, { open: isOpen, onOpenChange: handleClose, children: /* @__PURE__ */ jsxs(Dialog.Content, { children: [
|
2449
|
+
/* @__PURE__ */ jsx(Dialog.Header, { children: title }),
|
2450
|
+
typeof Content === "function" ? /* @__PURE__ */ jsx(Content, { onClose: handleClose }) : Content
|
2451
|
+
] }) });
|
2452
|
+
};
|
2346
2453
|
const ConfigureTheViewAction = ({ collectionType, model }) => {
|
2347
2454
|
const navigate = useNavigate();
|
2348
2455
|
const { formatMessage } = useIntl();
|
@@ -2478,7 +2585,7 @@ const ActionsPanel = () => {
|
|
2478
2585
|
return {
|
2479
2586
|
title: formatMessage({
|
2480
2587
|
id: "content-manager.containers.edit.panels.default.title",
|
2481
|
-
defaultMessage: "
|
2588
|
+
defaultMessage: "Entry"
|
2482
2589
|
}),
|
2483
2590
|
content: /* @__PURE__ */ jsx(ActionsPanelContent, {})
|
2484
2591
|
};
|
@@ -2722,7 +2829,8 @@ const formatEditLayout = (data, {
|
|
2722
2829
|
layout: convertEditLayoutToFieldLayouts(
|
2723
2830
|
configuration.layouts.edit,
|
2724
2831
|
components[uid].attributes,
|
2725
|
-
configuration.metadatas
|
2832
|
+
configuration.metadatas,
|
2833
|
+
{ configurations: data.components, schemas: components }
|
2726
2834
|
),
|
2727
2835
|
settings: {
|
2728
2836
|
...configuration.settings,
|
@@ -2879,6 +2987,7 @@ const ConfirmDialogPublishAll = ({
|
|
2879
2987
|
const { _unstableFormatAPIError: formatAPIError } = useAPIErrorHandler(getTranslation);
|
2880
2988
|
const { model, schema } = useDoc();
|
2881
2989
|
const [{ query }] = useQueryParams();
|
2990
|
+
const enableDraftRelationsCount = false;
|
2882
2991
|
const {
|
2883
2992
|
data: countDraftRelations = 0,
|
2884
2993
|
isLoading,
|
@@ -2890,7 +2999,7 @@ const ConfirmDialogPublishAll = ({
|
|
2890
2999
|
locale: query?.plugins?.i18n?.locale
|
2891
3000
|
},
|
2892
3001
|
{
|
2893
|
-
skip:
|
3002
|
+
skip: !enableDraftRelationsCount
|
2894
3003
|
}
|
2895
3004
|
);
|
2896
3005
|
React.useEffect(() => {
|
@@ -3075,7 +3184,7 @@ const SelectedEntriesTableContent = ({
|
|
3075
3184
|
status: row.status
|
3076
3185
|
}
|
3077
3186
|
) }),
|
3078
|
-
/* @__PURE__ */ jsx(Table.Cell, { children: /* @__PURE__ */ jsx(
|
3187
|
+
/* @__PURE__ */ jsx(Table.Cell, { children: /* @__PURE__ */ jsx(Flex, { children: /* @__PURE__ */ jsx(
|
3079
3188
|
IconButton,
|
3080
3189
|
{
|
3081
3190
|
tag: Link,
|
@@ -3098,9 +3207,10 @@ const SelectedEntriesTableContent = ({
|
|
3098
3207
|
),
|
3099
3208
|
target: "_blank",
|
3100
3209
|
marginLeft: "auto",
|
3101
|
-
|
3210
|
+
variant: "ghost",
|
3211
|
+
children: /* @__PURE__ */ jsx(Pencil, { width: "1.6rem", height: "1.6rem" })
|
3102
3212
|
}
|
3103
|
-
) })
|
3213
|
+
) }) })
|
3104
3214
|
] }, row.id)) })
|
3105
3215
|
] });
|
3106
3216
|
};
|
@@ -3137,7 +3247,13 @@ const SelectedEntriesModalContent = ({
|
|
3137
3247
|
);
|
3138
3248
|
const { rows, validationErrors } = React.useMemo(() => {
|
3139
3249
|
if (data.length > 0 && schema) {
|
3140
|
-
const validate = createYupSchema(
|
3250
|
+
const validate = createYupSchema(
|
3251
|
+
schema.attributes,
|
3252
|
+
components,
|
3253
|
+
// Since this is the "Publish" action, the validation
|
3254
|
+
// schema must enforce the rules for published entities
|
3255
|
+
{ status: "published" }
|
3256
|
+
);
|
3141
3257
|
const validationErrors2 = {};
|
3142
3258
|
const rows2 = data.map((entry) => {
|
3143
3259
|
try {
|
@@ -3487,7 +3603,7 @@ const TableActions = ({ document }) => {
|
|
3487
3603
|
DescriptionComponentRenderer,
|
3488
3604
|
{
|
3489
3605
|
props,
|
3490
|
-
descriptions: plugins["content-manager"].apis.getDocumentActions(),
|
3606
|
+
descriptions: plugins["content-manager"].apis.getDocumentActions().filter((action) => action.name !== "PublishAction"),
|
3491
3607
|
children: (actions2) => {
|
3492
3608
|
const tableRowActions = actions2.filter((action) => {
|
3493
3609
|
const positions = Array.isArray(action.position) ? action.position : [action.position];
|
@@ -3598,7 +3714,7 @@ const CloneAction = ({ model, documentId }) => {
|
|
3598
3714
|
}),
|
3599
3715
|
content: /* @__PURE__ */ jsx(AutoCloneFailureModalBody, { prohibitedFields }),
|
3600
3716
|
footer: ({ onClose }) => {
|
3601
|
-
return /* @__PURE__ */ jsxs(
|
3717
|
+
return /* @__PURE__ */ jsxs(Modal.Footer, { children: [
|
3602
3718
|
/* @__PURE__ */ jsx(Button, { onClick: onClose, variant: "tertiary", children: formatMessage({
|
3603
3719
|
id: "cancel",
|
3604
3720
|
defaultMessage: "Cancel"
|
@@ -3829,7 +3945,7 @@ const index = {
|
|
3829
3945
|
app.router.addRoute({
|
3830
3946
|
path: "content-manager/*",
|
3831
3947
|
lazy: async () => {
|
3832
|
-
const { Layout } = await import("./layout-
|
3948
|
+
const { Layout } = await import("./layout-DX_52HSH.mjs");
|
3833
3949
|
return {
|
3834
3950
|
Component: Layout
|
3835
3951
|
};
|
@@ -3846,7 +3962,7 @@ const index = {
|
|
3846
3962
|
async registerTrads({ locales }) {
|
3847
3963
|
const importedTrads = await Promise.all(
|
3848
3964
|
locales.map((locale) => {
|
3849
|
-
return __variableDynamicImportRuntimeHelper(/* @__PURE__ */ Object.assign({ "./translations/ar.json": () => import("./ar-CCEVvqGG.mjs"), "./translations/ca.json": () => import("./ca-5U32ON2v.mjs"), "./translations/cs.json": () => import("./cs-CM2aBUar.mjs"), "./translations/de.json": () => import("./de-C72KDNOl.mjs"), "./translations/en.json": () => import("./en-
|
3965
|
+
return __variableDynamicImportRuntimeHelper(/* @__PURE__ */ Object.assign({ "./translations/ar.json": () => import("./ar-CCEVvqGG.mjs"), "./translations/ca.json": () => import("./ca-5U32ON2v.mjs"), "./translations/cs.json": () => import("./cs-CM2aBUar.mjs"), "./translations/de.json": () => import("./de-C72KDNOl.mjs"), "./translations/en.json": () => import("./en-CPTj6CjC.mjs"), "./translations/es.json": () => import("./es-CeXiYflN.mjs"), "./translations/eu.json": () => import("./eu-CdALomew.mjs"), "./translations/fr.json": () => import("./fr-CD9VFbPM.mjs"), "./translations/gu.json": () => import("./gu-CNpaMDpH.mjs"), "./translations/hi.json": () => import("./hi-Dwvd04m3.mjs"), "./translations/hu.json": () => import("./hu-CeYvaaO0.mjs"), "./translations/id.json": () => import("./id-BtwA9WJT.mjs"), "./translations/it.json": () => import("./it-BrVPqaf1.mjs"), "./translations/ja.json": () => import("./ja-CtsUxOvk.mjs"), "./translations/ko.json": () => import("./ko-HVQRlfUI.mjs"), "./translations/ml.json": () => import("./ml-BihZwQit.mjs"), "./translations/ms.json": () => import("./ms-m_WjyWx7.mjs"), "./translations/nl.json": () => import("./nl-D4R9gHx5.mjs"), "./translations/pl.json": () => import("./pl-sbx9mSt_.mjs"), "./translations/pt-BR.json": () => import("./pt-BR-C71iDxnh.mjs"), "./translations/pt.json": () => import("./pt-BsaFvS8-.mjs"), "./translations/ru.json": () => import("./ru-BE6A4Exp.mjs"), "./translations/sa.json": () => import("./sa-Dag0k-Z8.mjs"), "./translations/sk.json": () => import("./sk-BFg-R8qJ.mjs"), "./translations/sv.json": () => import("./sv-CUnfWGsh.mjs"), "./translations/th.json": () => import("./th-BqbI8lIT.mjs"), "./translations/tr.json": () => import("./tr-CgeK3wJM.mjs"), "./translations/uk.json": () => import("./uk-CR-zDhAY.mjs"), "./translations/vi.json": () => import("./vi-DUXIk_fw.mjs"), "./translations/zh-Hans.json": () => import("./zh-Hans-BPQcRIyH.mjs"), "./translations/zh.json": () => import("./zh-BWZspA60.mjs") }), `./translations/${locale}.json`).then(({ default: data }) => {
|
3850
3966
|
return {
|
3851
3967
|
data: prefixPluginTranslations(data, PLUGIN_ID),
|
3852
3968
|
locale
|
@@ -3867,13 +3983,14 @@ export {
|
|
3867
3983
|
BulkActionsRenderer as B,
|
3868
3984
|
COLLECTION_TYPES as C,
|
3869
3985
|
DocumentStatus as D,
|
3870
|
-
|
3871
|
-
|
3872
|
-
|
3986
|
+
extractContentTypeComponents as E,
|
3987
|
+
DEFAULT_SETTINGS as F,
|
3988
|
+
convertEditLayoutToFieldLayouts as G,
|
3873
3989
|
HOOKS as H,
|
3874
3990
|
InjectionZone as I,
|
3875
|
-
|
3876
|
-
|
3991
|
+
useDocument as J,
|
3992
|
+
index as K,
|
3993
|
+
useDocumentActions as L,
|
3877
3994
|
Panels as P,
|
3878
3995
|
RelativeTime as R,
|
3879
3996
|
SINGLE_TYPES as S,
|
@@ -3891,18 +4008,18 @@ export {
|
|
3891
4008
|
PERMISSIONS as k,
|
3892
4009
|
DocumentRBAC as l,
|
3893
4010
|
DOCUMENT_META_FIELDS as m,
|
3894
|
-
|
3895
|
-
|
3896
|
-
|
3897
|
-
|
3898
|
-
|
4011
|
+
CLONE_PATH as n,
|
4012
|
+
useDocLayout as o,
|
4013
|
+
useGetContentTypeConfigurationQuery as p,
|
4014
|
+
CREATOR_FIELDS as q,
|
4015
|
+
getMainField as r,
|
3899
4016
|
setInitialData as s,
|
3900
|
-
|
4017
|
+
getDisplayName as t,
|
3901
4018
|
useContentTypeSchema as u,
|
3902
|
-
|
3903
|
-
|
3904
|
-
|
3905
|
-
|
3906
|
-
|
4019
|
+
checkIfAttributeIsDisplayable as v,
|
4020
|
+
useGetAllDocumentsQuery as w,
|
4021
|
+
convertListLayoutToFieldLayouts as x,
|
4022
|
+
capitalise as y,
|
4023
|
+
useUpdateContentTypeConfigurationMutation as z
|
3907
4024
|
};
|
3908
|
-
//# sourceMappingURL=index-
|
4025
|
+
//# sourceMappingURL=index-BHfS6_D5.mjs.map
|