@strapi/content-manager 5.0.0-beta.9 → 5.0.0-rc.0
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/LICENSE +18 -3
- package/dist/_chunks/{ComponentConfigurationPage-y_7iLdmB.js → ComponentConfigurationPage-DVY3LwHo.js} +3 -3
- package/dist/_chunks/{ComponentConfigurationPage-y_7iLdmB.js.map → ComponentConfigurationPage-DVY3LwHo.js.map} +1 -1
- package/dist/_chunks/{ComponentConfigurationPage-BMajAl1u.mjs → ComponentConfigurationPage-Dy9BQQ2V.mjs} +3 -3
- package/dist/_chunks/{ComponentConfigurationPage-BMajAl1u.mjs.map → ComponentConfigurationPage-Dy9BQQ2V.mjs.map} +1 -1
- package/dist/_chunks/{EditConfigurationPage-CcOoD26O.mjs → EditConfigurationPage-DbR8mWH5.mjs} +3 -3
- package/dist/_chunks/{EditConfigurationPage-CcOoD26O.mjs.map → EditConfigurationPage-DbR8mWH5.mjs.map} +1 -1
- package/dist/_chunks/{EditConfigurationPage-CPVB8Uqc.js → EditConfigurationPage-b6V7YHfo.js} +3 -3
- package/dist/_chunks/{EditConfigurationPage-CPVB8Uqc.js.map → EditConfigurationPage-b6V7YHfo.js.map} +1 -1
- package/dist/_chunks/{EditViewPage-DWb0DE7R.mjs → EditViewPage-CPrukwtO.mjs} +46 -46
- package/dist/_chunks/EditViewPage-CPrukwtO.mjs.map +1 -0
- package/dist/_chunks/{EditViewPage-CTTDHKkQ.js → EditViewPage-DhttErmY.js} +45 -45
- package/dist/_chunks/EditViewPage-DhttErmY.js.map +1 -0
- package/dist/_chunks/{Field-C5Z1Ivdv.js → Field-CBRV4uan.js} +416 -136
- package/dist/_chunks/Field-CBRV4uan.js.map +1 -0
- package/dist/_chunks/{Field-DnStdvQw.mjs → Field-DrgIgQPw.mjs} +417 -137
- package/dist/_chunks/Field-DrgIgQPw.mjs.map +1 -0
- package/dist/_chunks/{Form-B81OtW-k.js → Form-Bk3v7Frl.js} +25 -26
- package/dist/_chunks/Form-Bk3v7Frl.js.map +1 -0
- package/dist/_chunks/{Form-DqGgE55Q.mjs → Form-Dxk4txLJ.mjs} +27 -28
- package/dist/_chunks/Form-Dxk4txLJ.mjs.map +1 -0
- package/dist/_chunks/{History-DS6-HCYX.mjs → History-DSU-y4Hg.mjs} +35 -22
- package/dist/_chunks/History-DSU-y4Hg.mjs.map +1 -0
- package/dist/_chunks/{History-4NbOq2dX.js → History-xNH_9UuV.js} +34 -21
- package/dist/_chunks/History-xNH_9UuV.js.map +1 -0
- package/dist/_chunks/{ListConfigurationPage-CpfstlYY.js → ListConfigurationPage-BCPzXk5W.js} +48 -47
- package/dist/_chunks/ListConfigurationPage-BCPzXk5W.js.map +1 -0
- package/dist/_chunks/{ListConfigurationPage-DQJJltko.mjs → ListConfigurationPage-BWwZ-uMJ.mjs} +49 -49
- package/dist/_chunks/ListConfigurationPage-BWwZ-uMJ.mjs.map +1 -0
- package/dist/_chunks/{ListViewPage-nQrOQuVo.mjs → ListViewPage-D9UmehuA.mjs} +60 -68
- package/dist/_chunks/ListViewPage-D9UmehuA.mjs.map +1 -0
- package/dist/_chunks/{ListViewPage-CA3I75m5.js → ListViewPage-ZIvstfvl.js} +59 -67
- package/dist/_chunks/ListViewPage-ZIvstfvl.js.map +1 -0
- package/dist/_chunks/{NoContentTypePage-DbnHE22g.mjs → NoContentTypePage-CstnyWv2.mjs} +2 -2
- package/dist/_chunks/{NoContentTypePage-DbnHE22g.mjs.map → NoContentTypePage-CstnyWv2.mjs.map} +1 -1
- package/dist/_chunks/{NoContentTypePage-Dldu-_Mx.js → NoContentTypePage-h7FcuMjI.js} +2 -2
- package/dist/_chunks/{NoContentTypePage-Dldu-_Mx.js.map → NoContentTypePage-h7FcuMjI.js.map} +1 -1
- package/dist/_chunks/{NoPermissionsPage-CO2MK200.js → NoPermissionsPage-DofU68cO.js} +2 -2
- package/dist/_chunks/{NoPermissionsPage-CO2MK200.js.map → NoPermissionsPage-DofU68cO.js.map} +1 -1
- package/dist/_chunks/{NoPermissionsPage-fOIkQM0v.mjs → NoPermissionsPage-aFCCLbsf.mjs} +2 -2
- package/dist/_chunks/{NoPermissionsPage-fOIkQM0v.mjs.map → NoPermissionsPage-aFCCLbsf.mjs.map} +1 -1
- package/dist/_chunks/{Relations-BDRl99Ux.mjs → Relations-7v66IP7b.mjs} +3 -3
- package/dist/_chunks/Relations-7v66IP7b.mjs.map +1 -0
- package/dist/_chunks/{Relations-DG2jnOcr.js → Relations-DAS_DKG5.js} +3 -3
- package/dist/_chunks/Relations-DAS_DKG5.js.map +1 -0
- package/dist/_chunks/{en-Ux26r5pl.mjs → en-BrCTWlZv.mjs} +5 -4
- package/dist/_chunks/{en-Ux26r5pl.mjs.map → en-BrCTWlZv.mjs.map} +1 -1
- package/dist/_chunks/{en-fbKQxLGn.js → en-uOUIxfcQ.js} +5 -4
- package/dist/_chunks/{en-fbKQxLGn.js.map → en-uOUIxfcQ.js.map} +1 -1
- package/dist/_chunks/{index-BZoNZMXL.js → index-CAlLHIrI.js} +285 -328
- package/dist/_chunks/index-CAlLHIrI.js.map +1 -0
- package/dist/_chunks/{index-Drt2DN7v.mjs → index-DIQ7Io-l.mjs} +298 -341
- package/dist/_chunks/index-DIQ7Io-l.mjs.map +1 -0
- package/dist/_chunks/{layout-DEYBqgF1.js → layout-B1ZS-usI.js} +7 -7
- package/dist/_chunks/layout-B1ZS-usI.js.map +1 -0
- package/dist/_chunks/{layout-BzAbmoO6.mjs → layout-DHe2GdT4.mjs} +8 -8
- package/dist/_chunks/layout-DHe2GdT4.mjs.map +1 -0
- package/dist/_chunks/{relations-D26zVRdi.mjs → relations-BUieBWhT.mjs} +2 -2
- package/dist/_chunks/{relations-D26zVRdi.mjs.map → relations-BUieBWhT.mjs.map} +1 -1
- package/dist/_chunks/{relations-D0eZ4VWw.js → relations-yXHkSG1Z.js} +2 -2
- package/dist/_chunks/{relations-D0eZ4VWw.js.map → relations-yXHkSG1Z.js.map} +1 -1
- package/dist/admin/index.js +1 -1
- package/dist/admin/index.mjs +4 -4
- package/dist/admin/src/pages/EditView/components/DocumentActions.d.ts +8 -3
- package/dist/admin/src/pages/EditView/components/FormInputs/BlocksInput/utils/constants.d.ts +4 -0
- package/dist/admin/src/pages/EditView/components/FormInputs/Relations.d.ts +20 -0
- package/dist/admin/src/pages/EditView/components/FormInputs/Wysiwyg/WysiwygStyles.d.ts +2 -10
- package/dist/admin/src/pages/ListView/components/BulkActions/Actions.d.ts +3 -30
- package/dist/admin/src/pages/ListView/components/BulkActions/ConfirmBulkActionDialog.d.ts +2 -2
- package/dist/server/index.js +11 -6
- package/dist/server/index.js.map +1 -1
- package/dist/server/index.mjs +11 -6
- package/dist/server/index.mjs.map +1 -1
- package/dist/server/src/history/services/lifecycles.d.ts.map +1 -1
- package/dist/server/src/history/services/utils.d.ts.map +1 -1
- package/package.json +8 -8
- package/dist/_chunks/EditViewPage-CTTDHKkQ.js.map +0 -1
- package/dist/_chunks/EditViewPage-DWb0DE7R.mjs.map +0 -1
- package/dist/_chunks/Field-C5Z1Ivdv.js.map +0 -1
- package/dist/_chunks/Field-DnStdvQw.mjs.map +0 -1
- package/dist/_chunks/Form-B81OtW-k.js.map +0 -1
- package/dist/_chunks/Form-DqGgE55Q.mjs.map +0 -1
- package/dist/_chunks/History-4NbOq2dX.js.map +0 -1
- package/dist/_chunks/History-DS6-HCYX.mjs.map +0 -1
- package/dist/_chunks/ListConfigurationPage-CpfstlYY.js.map +0 -1
- package/dist/_chunks/ListConfigurationPage-DQJJltko.mjs.map +0 -1
- package/dist/_chunks/ListViewPage-CA3I75m5.js.map +0 -1
- package/dist/_chunks/ListViewPage-nQrOQuVo.mjs.map +0 -1
- package/dist/_chunks/Relations-BDRl99Ux.mjs.map +0 -1
- package/dist/_chunks/Relations-DG2jnOcr.js.map +0 -1
- package/dist/_chunks/index-BZoNZMXL.js.map +0 -1
- package/dist/_chunks/index-Drt2DN7v.mjs.map +0 -1
- package/dist/_chunks/layout-BzAbmoO6.mjs.map +0 -1
- package/dist/_chunks/layout-DEYBqgF1.js.map +0 -1
@@ -6,7 +6,7 @@ import { useIntl } from "react-intl";
|
|
6
6
|
import { useNavigate, useParams, Navigate, useMatch, useLocation, Link, NavLink } from "react-router-dom";
|
7
7
|
import * as React from "react";
|
8
8
|
import { lazy } from "react";
|
9
|
-
import { Menu, VisuallyHidden, Flex, Typography, Dialog,
|
9
|
+
import { Button, Menu, VisuallyHidden, Flex, Box, Typography, Dialog, Modal, Radio, Status, SingleSelect, SingleSelectOption, Loader, IconButton, Tooltip, LinkButton } from "@strapi/design-system";
|
10
10
|
import { styled } from "styled-components";
|
11
11
|
import * as yup from "yup";
|
12
12
|
import { ValidationError } from "yup";
|
@@ -198,6 +198,7 @@ const contentManagerApi = adminApi.enhanceEndpoints({
|
|
198
198
|
]
|
199
199
|
});
|
200
200
|
const documentApi = contentManagerApi.injectEndpoints({
|
201
|
+
overrideExisting: true,
|
201
202
|
endpoints: (builder) => ({
|
202
203
|
autoCloneDocument: builder.mutation({
|
203
204
|
query: ({ model, sourceId, query }) => ({
|
@@ -599,11 +600,11 @@ const createAttributeSchema = (attribute) => {
|
|
599
600
|
}
|
600
601
|
};
|
601
602
|
const addRequiredValidation = (attribute) => (schema) => {
|
602
|
-
if (attribute.required) {
|
603
|
-
return schema.required
|
604
|
-
|
605
|
-
|
606
|
-
|
603
|
+
if ((attribute.type === "component" && attribute.repeatable || attribute.type === "dynamiczone") && attribute.required && "min" in schema) {
|
604
|
+
return schema.min(1, translatedErrors.required);
|
605
|
+
}
|
606
|
+
if (attribute.required && attribute.type !== "relation") {
|
607
|
+
return schema.required(translatedErrors.required);
|
607
608
|
}
|
608
609
|
return schema?.nullable ? schema.nullable() : (
|
609
610
|
// In some cases '.nullable' will not be available on the schema.
|
@@ -637,6 +638,28 @@ const addMaxLengthValidation = (attribute) => (schema) => {
|
|
637
638
|
const addMinValidation = (attribute) => (schema) => {
|
638
639
|
if ("min" in attribute) {
|
639
640
|
const min = toInteger(attribute.min);
|
641
|
+
if (attribute.type === "component" && attribute.repeatable || attribute.type === "dynamiczone") {
|
642
|
+
if (!attribute.required && "test" in schema && min) {
|
643
|
+
return schema.test(
|
644
|
+
"custom-min",
|
645
|
+
{
|
646
|
+
...translatedErrors.min,
|
647
|
+
values: {
|
648
|
+
min: attribute.min
|
649
|
+
}
|
650
|
+
},
|
651
|
+
(value) => {
|
652
|
+
if (!value) {
|
653
|
+
return true;
|
654
|
+
}
|
655
|
+
if (Array.isArray(value) && value.length === 0) {
|
656
|
+
return true;
|
657
|
+
}
|
658
|
+
return value.length >= min;
|
659
|
+
}
|
660
|
+
);
|
661
|
+
}
|
662
|
+
}
|
640
663
|
if ("min" in schema && min) {
|
641
664
|
return schema.min(min, {
|
642
665
|
...translatedErrors.min,
|
@@ -763,7 +786,10 @@ const useDocument = (args, opts) => {
|
|
763
786
|
isLoading: isLoadingDocument,
|
764
787
|
isFetching: isFetchingDocument,
|
765
788
|
error
|
766
|
-
} = useGetDocumentQuery(args,
|
789
|
+
} = useGetDocumentQuery(args, {
|
790
|
+
...opts,
|
791
|
+
skip: !args.documentId && args.collectionType !== SINGLE_TYPES || opts?.skip
|
792
|
+
});
|
767
793
|
const { components, schema, isLoading: isLoadingSchema } = useContentTypeSchema(args.model);
|
768
794
|
React.useEffect(() => {
|
769
795
|
if (error) {
|
@@ -1265,7 +1291,7 @@ const useDocumentActions = () => {
|
|
1265
1291
|
};
|
1266
1292
|
};
|
1267
1293
|
const ProtectedHistoryPage = lazy(
|
1268
|
-
() => import("./History-
|
1294
|
+
() => import("./History-DSU-y4Hg.mjs").then((mod) => ({ default: mod.ProtectedHistoryPage }))
|
1269
1295
|
);
|
1270
1296
|
const routes$1 = [
|
1271
1297
|
{
|
@@ -1278,31 +1304,31 @@ const routes$1 = [
|
|
1278
1304
|
}
|
1279
1305
|
];
|
1280
1306
|
const ProtectedEditViewPage = lazy(
|
1281
|
-
() => import("./EditViewPage-
|
1307
|
+
() => import("./EditViewPage-CPrukwtO.mjs").then((mod) => ({ default: mod.ProtectedEditViewPage }))
|
1282
1308
|
);
|
1283
1309
|
const ProtectedListViewPage = lazy(
|
1284
|
-
() => import("./ListViewPage-
|
1310
|
+
() => import("./ListViewPage-D9UmehuA.mjs").then((mod) => ({ default: mod.ProtectedListViewPage }))
|
1285
1311
|
);
|
1286
1312
|
const ProtectedListConfiguration = lazy(
|
1287
|
-
() => import("./ListConfigurationPage-
|
1313
|
+
() => import("./ListConfigurationPage-BWwZ-uMJ.mjs").then((mod) => ({
|
1288
1314
|
default: mod.ProtectedListConfiguration
|
1289
1315
|
}))
|
1290
1316
|
);
|
1291
1317
|
const ProtectedEditConfigurationPage = lazy(
|
1292
|
-
() => import("./EditConfigurationPage-
|
1318
|
+
() => import("./EditConfigurationPage-DbR8mWH5.mjs").then((mod) => ({
|
1293
1319
|
default: mod.ProtectedEditConfigurationPage
|
1294
1320
|
}))
|
1295
1321
|
);
|
1296
1322
|
const ProtectedComponentConfigurationPage = lazy(
|
1297
|
-
() => import("./ComponentConfigurationPage-
|
1323
|
+
() => import("./ComponentConfigurationPage-Dy9BQQ2V.mjs").then((mod) => ({
|
1298
1324
|
default: mod.ProtectedComponentConfigurationPage
|
1299
1325
|
}))
|
1300
1326
|
);
|
1301
1327
|
const NoPermissions = lazy(
|
1302
|
-
() => import("./NoPermissionsPage-
|
1328
|
+
() => import("./NoPermissionsPage-aFCCLbsf.mjs").then((mod) => ({ default: mod.NoPermissions }))
|
1303
1329
|
);
|
1304
1330
|
const NoContentType = lazy(
|
1305
|
-
() => import("./NoContentTypePage-
|
1331
|
+
() => import("./NoContentTypePage-CstnyWv2.mjs").then((mod) => ({ default: mod.NoContentType }))
|
1306
1332
|
);
|
1307
1333
|
const CollectionTypePages = () => {
|
1308
1334
|
const { collectionType } = useParams();
|
@@ -1429,7 +1455,7 @@ const DocumentActionButton = (action) => {
|
|
1429
1455
|
DocumentActionConfirmDialog,
|
1430
1456
|
{
|
1431
1457
|
...action.dialog,
|
1432
|
-
variant: action.variant,
|
1458
|
+
variant: action.dialog?.variant ?? action.variant,
|
1433
1459
|
isOpen: dialogId === action.id,
|
1434
1460
|
onClose: handleClose
|
1435
1461
|
}
|
@@ -1509,7 +1535,7 @@ const DocumentActionsMenu = ({
|
|
1509
1535
|
display: "block",
|
1510
1536
|
children: /* @__PURE__ */ jsxs(Flex, { justifyContent: "space-between", gap: 4, children: [
|
1511
1537
|
/* @__PURE__ */ jsxs(Flex, { color: convertActionVariantToColor(action.variant), gap: 2, tag: "span", children: [
|
1512
|
-
action.icon,
|
1538
|
+
/* @__PURE__ */ jsx(Box, { tag: "span", color: convertActionVariantToIconColor(action.variant), children: action.icon }),
|
1513
1539
|
action.label
|
1514
1540
|
] }),
|
1515
1541
|
action.id.startsWith("HistoryAction") && /* @__PURE__ */ jsx(
|
@@ -1570,6 +1596,18 @@ const convertActionVariantToColor = (variant = "secondary") => {
|
|
1570
1596
|
return "primary600";
|
1571
1597
|
}
|
1572
1598
|
};
|
1599
|
+
const convertActionVariantToIconColor = (variant = "secondary") => {
|
1600
|
+
switch (variant) {
|
1601
|
+
case "danger":
|
1602
|
+
return "danger600";
|
1603
|
+
case "secondary":
|
1604
|
+
return "neutral500";
|
1605
|
+
case "success":
|
1606
|
+
return "success600";
|
1607
|
+
default:
|
1608
|
+
return "primary600";
|
1609
|
+
}
|
1610
|
+
};
|
1573
1611
|
const DocumentActionConfirmDialog = ({
|
1574
1612
|
onClose,
|
1575
1613
|
onCancel,
|
@@ -1592,22 +1630,20 @@ const DocumentActionConfirmDialog = ({
|
|
1592
1630
|
}
|
1593
1631
|
onClose();
|
1594
1632
|
};
|
1595
|
-
return /* @__PURE__ */
|
1596
|
-
/* @__PURE__ */ jsx(
|
1597
|
-
/* @__PURE__ */ jsx(
|
1598
|
-
|
1599
|
-
{
|
1600
|
-
|
1601
|
-
|
1602
|
-
|
1603
|
-
|
1604
|
-
|
1605
|
-
|
1606
|
-
|
1607
|
-
|
1608
|
-
|
1609
|
-
)
|
1610
|
-
] });
|
1633
|
+
return /* @__PURE__ */ jsx(Dialog.Root, { open: isOpen, onOpenChange: handleClose, children: /* @__PURE__ */ jsxs(Dialog.Content, { children: [
|
1634
|
+
/* @__PURE__ */ jsx(Dialog.Header, { children: title }),
|
1635
|
+
/* @__PURE__ */ jsx(Dialog.Body, { children: content }),
|
1636
|
+
/* @__PURE__ */ jsxs(Dialog.Footer, { children: [
|
1637
|
+
/* @__PURE__ */ jsx(Dialog.Cancel, { children: /* @__PURE__ */ jsx(Button, { variant: "tertiary", children: formatMessage({
|
1638
|
+
id: "app.components.Button.cancel",
|
1639
|
+
defaultMessage: "Cancel"
|
1640
|
+
}) }) }),
|
1641
|
+
/* @__PURE__ */ jsx(Button, { onClick: handleConfirm, variant, children: formatMessage({
|
1642
|
+
id: "app.components.Button.confirm",
|
1643
|
+
defaultMessage: "Confirm"
|
1644
|
+
}) })
|
1645
|
+
] })
|
1646
|
+
] }) });
|
1611
1647
|
};
|
1612
1648
|
const DocumentActionModal = ({
|
1613
1649
|
isOpen,
|
@@ -1617,34 +1653,17 @@ const DocumentActionModal = ({
|
|
1617
1653
|
content: Content,
|
1618
1654
|
onModalClose
|
1619
1655
|
}) => {
|
1620
|
-
const id = React.useId();
|
1621
|
-
if (!isOpen) {
|
1622
|
-
return null;
|
1623
|
-
}
|
1624
1656
|
const handleClose = () => {
|
1625
1657
|
if (onClose) {
|
1626
1658
|
onClose();
|
1627
1659
|
}
|
1628
1660
|
onModalClose();
|
1629
1661
|
};
|
1630
|
-
return /* @__PURE__ */
|
1631
|
-
/* @__PURE__ */ jsx(
|
1632
|
-
/* @__PURE__ */ jsx(
|
1633
|
-
/* @__PURE__ */ jsx(
|
1634
|
-
|
1635
|
-
{
|
1636
|
-
paddingTop: 4,
|
1637
|
-
paddingBottom: 4,
|
1638
|
-
paddingLeft: 5,
|
1639
|
-
paddingRight: 5,
|
1640
|
-
borderWidth: "1px 0 0 0",
|
1641
|
-
borderStyle: "solid",
|
1642
|
-
borderColor: "neutral150",
|
1643
|
-
background: "neutral100",
|
1644
|
-
children: typeof Footer === "function" ? /* @__PURE__ */ jsx(Footer, { onClose: handleClose }) : Footer
|
1645
|
-
}
|
1646
|
-
)
|
1647
|
-
] });
|
1662
|
+
return /* @__PURE__ */ jsx(Modal.Root, { open: isOpen, onOpenChange: handleClose, children: /* @__PURE__ */ jsxs(Modal.Content, { children: [
|
1663
|
+
/* @__PURE__ */ jsx(Modal.Header, { children: /* @__PURE__ */ jsx(Modal.Title, { children: title }) }),
|
1664
|
+
/* @__PURE__ */ jsx(Modal.Body, { children: typeof Content === "function" ? /* @__PURE__ */ jsx(Content, { onClose: handleClose }) : Content }),
|
1665
|
+
/* @__PURE__ */ jsx(Modal.Footer, { children: typeof Footer === "function" ? /* @__PURE__ */ jsx(Footer, { onClose: handleClose }) : Footer })
|
1666
|
+
] }) });
|
1648
1667
|
};
|
1649
1668
|
const PublishAction$1 = ({
|
1650
1669
|
activeTab,
|
@@ -1665,6 +1684,12 @@ const PublishAction$1 = ({
|
|
1665
1684
|
({ canPublish: canPublish2, canCreate: canCreate2, canUpdate: canUpdate2 }) => ({ canPublish: canPublish2, canCreate: canCreate2, canUpdate: canUpdate2 })
|
1666
1685
|
);
|
1667
1686
|
const { publish } = useDocumentActions();
|
1687
|
+
const [
|
1688
|
+
countDraftRelations,
|
1689
|
+
{ isLoading: isLoadingDraftRelations, isError: isErrorDraftRelations }
|
1690
|
+
] = useLazyGetDraftRelationCountQuery();
|
1691
|
+
const [localCountOfDraftRelations, setLocalCountOfDraftRelations] = React.useState(0);
|
1692
|
+
const [serverCountOfDraftRelations, setServerCountOfDraftRelations] = React.useState(0);
|
1668
1693
|
const [{ query, rawQuery }] = useQueryParams();
|
1669
1694
|
const params = React.useMemo(() => buildValidParams(query), [query]);
|
1670
1695
|
const modified = useForm("PublishAction", ({ modified: modified2 }) => modified2);
|
@@ -1673,10 +1698,101 @@ const PublishAction$1 = ({
|
|
1673
1698
|
const validate = useForm("PublishAction", (state) => state.validate);
|
1674
1699
|
const setErrors = useForm("PublishAction", (state) => state.setErrors);
|
1675
1700
|
const formValues = useForm("PublishAction", ({ values }) => values);
|
1701
|
+
React.useEffect(() => {
|
1702
|
+
if (isErrorDraftRelations) {
|
1703
|
+
toggleNotification({
|
1704
|
+
type: "danger",
|
1705
|
+
message: formatMessage({
|
1706
|
+
id: getTranslation("error.records.fetch-draft-relatons"),
|
1707
|
+
defaultMessage: "An error occurred while fetching draft relations on this document."
|
1708
|
+
})
|
1709
|
+
});
|
1710
|
+
}
|
1711
|
+
}, [isErrorDraftRelations, toggleNotification, formatMessage]);
|
1712
|
+
React.useEffect(() => {
|
1713
|
+
const localDraftRelations = /* @__PURE__ */ new Set();
|
1714
|
+
const extractDraftRelations = (data) => {
|
1715
|
+
const relations = data.connect || [];
|
1716
|
+
relations.forEach((relation) => {
|
1717
|
+
if (relation.status === "draft") {
|
1718
|
+
localDraftRelations.add(relation.id);
|
1719
|
+
}
|
1720
|
+
});
|
1721
|
+
};
|
1722
|
+
const traverseAndExtract = (data) => {
|
1723
|
+
Object.entries(data).forEach(([key, value]) => {
|
1724
|
+
if (key === "connect" && Array.isArray(value)) {
|
1725
|
+
extractDraftRelations({ connect: value });
|
1726
|
+
} else if (typeof value === "object" && value !== null) {
|
1727
|
+
traverseAndExtract(value);
|
1728
|
+
}
|
1729
|
+
});
|
1730
|
+
};
|
1731
|
+
if (!documentId || modified) {
|
1732
|
+
traverseAndExtract(formValues);
|
1733
|
+
setLocalCountOfDraftRelations(localDraftRelations.size);
|
1734
|
+
}
|
1735
|
+
}, [documentId, modified, formValues, setLocalCountOfDraftRelations]);
|
1736
|
+
React.useEffect(() => {
|
1737
|
+
if (documentId) {
|
1738
|
+
const fetchDraftRelationsCount = async () => {
|
1739
|
+
const { data, error } = await countDraftRelations({
|
1740
|
+
collectionType,
|
1741
|
+
model,
|
1742
|
+
documentId,
|
1743
|
+
params
|
1744
|
+
});
|
1745
|
+
if (error) {
|
1746
|
+
throw error;
|
1747
|
+
}
|
1748
|
+
if (data) {
|
1749
|
+
setServerCountOfDraftRelations(data.data);
|
1750
|
+
}
|
1751
|
+
};
|
1752
|
+
fetchDraftRelationsCount();
|
1753
|
+
}
|
1754
|
+
}, [documentId, countDraftRelations, collectionType, model, params]);
|
1676
1755
|
const isDocumentPublished = (document?.[PUBLISHED_AT_ATTRIBUTE_NAME] || meta?.availableStatus.some((doc) => doc[PUBLISHED_AT_ATTRIBUTE_NAME] !== null)) && document?.status !== "modified";
|
1677
1756
|
if (!schema?.options?.draftAndPublish) {
|
1678
1757
|
return null;
|
1679
1758
|
}
|
1759
|
+
const performPublish = async () => {
|
1760
|
+
setSubmitting(true);
|
1761
|
+
try {
|
1762
|
+
const { errors } = await validate();
|
1763
|
+
if (errors) {
|
1764
|
+
toggleNotification({
|
1765
|
+
type: "danger",
|
1766
|
+
message: formatMessage({
|
1767
|
+
id: "content-manager.validation.error",
|
1768
|
+
defaultMessage: "There are validation errors in your document. Please fix them before saving."
|
1769
|
+
})
|
1770
|
+
});
|
1771
|
+
return;
|
1772
|
+
}
|
1773
|
+
const res = await publish(
|
1774
|
+
{
|
1775
|
+
collectionType,
|
1776
|
+
model,
|
1777
|
+
documentId,
|
1778
|
+
params
|
1779
|
+
},
|
1780
|
+
formValues
|
1781
|
+
);
|
1782
|
+
if ("data" in res && collectionType !== SINGLE_TYPES) {
|
1783
|
+
navigate({
|
1784
|
+
pathname: `../${collectionType}/${model}/${res.data.documentId}`,
|
1785
|
+
search: rawQuery
|
1786
|
+
});
|
1787
|
+
} else if ("error" in res && isBaseQueryError(res.error) && res.error.name === "ValidationError") {
|
1788
|
+
setErrors(formatValidationErrors(res.error));
|
1789
|
+
}
|
1790
|
+
} finally {
|
1791
|
+
setSubmitting(false);
|
1792
|
+
}
|
1793
|
+
};
|
1794
|
+
const totalDraftRelations = localCountOfDraftRelations + serverCountOfDraftRelations;
|
1795
|
+
const hasDraftRelations = totalDraftRelations > 0;
|
1680
1796
|
return {
|
1681
1797
|
/**
|
1682
1798
|
* Disabled when:
|
@@ -1689,46 +1805,38 @@ const PublishAction$1 = ({
|
|
1689
1805
|
* - the user doesn't have the permission to create a new document
|
1690
1806
|
* - the user doesn't have the permission to update the document
|
1691
1807
|
*/
|
1692
|
-
disabled: isCloning || isSubmitting || activeTab === "published" || !modified && isDocumentPublished || !modified && !document?.documentId || !canPublish || Boolean(!document?.documentId && !canCreate || document?.documentId && !canUpdate),
|
1808
|
+
disabled: isCloning || isSubmitting || isLoadingDraftRelations || activeTab === "published" || !modified && isDocumentPublished || !modified && !document?.documentId || !canPublish || Boolean(!document?.documentId && !canCreate || document?.documentId && !canUpdate),
|
1693
1809
|
label: formatMessage({
|
1694
1810
|
id: "app.utils.publish",
|
1695
1811
|
defaultMessage: "Publish"
|
1696
1812
|
}),
|
1697
1813
|
onClick: async () => {
|
1698
|
-
|
1699
|
-
|
1700
|
-
|
1701
|
-
|
1702
|
-
|
1703
|
-
|
1704
|
-
|
1705
|
-
|
1706
|
-
|
1707
|
-
|
1708
|
-
|
1709
|
-
|
1710
|
-
|
1711
|
-
|
1712
|
-
|
1713
|
-
|
1714
|
-
|
1715
|
-
|
1716
|
-
|
1717
|
-
|
1718
|
-
formValues
|
1719
|
-
);
|
1720
|
-
if ("data" in res && collectionType !== SINGLE_TYPES) {
|
1721
|
-
navigate({
|
1722
|
-
pathname: `../${collectionType}/${model}/${res.data.documentId}`,
|
1723
|
-
search: rawQuery
|
1724
|
-
});
|
1725
|
-
} else if ("error" in res && isBaseQueryError(res.error) && res.error.name === "ValidationError") {
|
1726
|
-
setErrors(formatValidationErrors(res.error));
|
1814
|
+
if (hasDraftRelations) {
|
1815
|
+
return;
|
1816
|
+
}
|
1817
|
+
await performPublish();
|
1818
|
+
},
|
1819
|
+
dialog: hasDraftRelations ? {
|
1820
|
+
type: "dialog",
|
1821
|
+
variant: "danger",
|
1822
|
+
footer: null,
|
1823
|
+
title: formatMessage({
|
1824
|
+
id: getTranslation(`popUpwarning.warning.bulk-has-draft-relations.title`),
|
1825
|
+
defaultMessage: "Confirmation"
|
1826
|
+
}),
|
1827
|
+
content: formatMessage(
|
1828
|
+
{
|
1829
|
+
id: getTranslation(`popUpwarning.warning.bulk-has-draft-relations.message`),
|
1830
|
+
defaultMessage: "This entry is related to {count, plural, one {# draft entry} other {# draft entries}}. Publishing it could leave broken links in your app."
|
1831
|
+
},
|
1832
|
+
{
|
1833
|
+
count: totalDraftRelations
|
1727
1834
|
}
|
1728
|
-
|
1729
|
-
|
1835
|
+
),
|
1836
|
+
onConfirm: async () => {
|
1837
|
+
await performPublish();
|
1730
1838
|
}
|
1731
|
-
}
|
1839
|
+
} : void 0
|
1732
1840
|
};
|
1733
1841
|
};
|
1734
1842
|
PublishAction$1.type = "publish";
|
@@ -1827,10 +1935,13 @@ const UpdateAction = ({
|
|
1827
1935
|
document
|
1828
1936
|
);
|
1829
1937
|
if ("data" in res && collectionType !== SINGLE_TYPES) {
|
1830
|
-
navigate(
|
1831
|
-
|
1832
|
-
|
1833
|
-
|
1938
|
+
navigate(
|
1939
|
+
{
|
1940
|
+
pathname: `../${collectionType}/${model}/${res.data.documentId}`,
|
1941
|
+
search: rawQuery
|
1942
|
+
},
|
1943
|
+
{ replace: true }
|
1944
|
+
);
|
1834
1945
|
} else if ("error" in res && isBaseQueryError(res.error) && res.error.name === "ValidationError") {
|
1835
1946
|
setErrors(formatValidationErrors(res.error));
|
1836
1947
|
}
|
@@ -1862,10 +1973,8 @@ const UnpublishAction$1 = ({
|
|
1862
1973
|
const { toggleNotification } = useNotification();
|
1863
1974
|
const [shouldKeepDraft, setShouldKeepDraft] = React.useState(true);
|
1864
1975
|
const isDocumentModified = document?.status === "modified";
|
1865
|
-
const handleChange = (
|
1866
|
-
|
1867
|
-
setShouldKeepDraft(e.target.value === UNPUBLISH_DRAFT_OPTIONS.KEEP);
|
1868
|
-
}
|
1976
|
+
const handleChange = (value) => {
|
1977
|
+
setShouldKeepDraft(value === UNPUBLISH_DRAFT_OPTIONS.KEEP);
|
1869
1978
|
};
|
1870
1979
|
if (!schema?.options?.draftAndPublish) {
|
1871
1980
|
return null;
|
@@ -1915,40 +2024,24 @@ const UnpublishAction$1 = ({
|
|
1915
2024
|
}) })
|
1916
2025
|
] }),
|
1917
2026
|
/* @__PURE__ */ jsxs(
|
1918
|
-
|
2027
|
+
Radio.Group,
|
1919
2028
|
{
|
1920
|
-
|
1921
|
-
|
1922
|
-
|
1923
|
-
|
1924
|
-
|
1925
|
-
|
2029
|
+
defaultValue: UNPUBLISH_DRAFT_OPTIONS.KEEP,
|
2030
|
+
name: "discard-options",
|
2031
|
+
"aria-label": formatMessage({
|
2032
|
+
id: "content-manager.actions.unpublish.dialog.radio-label",
|
2033
|
+
defaultMessage: "Choose an option to unpublish the document."
|
2034
|
+
}),
|
2035
|
+
onValueChange: handleChange,
|
1926
2036
|
children: [
|
1927
|
-
/* @__PURE__ */ jsx(
|
1928
|
-
|
1929
|
-
|
1930
|
-
|
1931
|
-
|
1932
|
-
|
1933
|
-
|
1934
|
-
|
1935
|
-
id: "content-manager.actions.unpublish.dialog.option.keep-draft",
|
1936
|
-
defaultMessage: "Keep draft"
|
1937
|
-
})
|
1938
|
-
}
|
1939
|
-
),
|
1940
|
-
/* @__PURE__ */ jsx(
|
1941
|
-
Radio,
|
1942
|
-
{
|
1943
|
-
checked: !shouldKeepDraft,
|
1944
|
-
value: UNPUBLISH_DRAFT_OPTIONS.DISCARD,
|
1945
|
-
name: "discard-options",
|
1946
|
-
children: formatMessage({
|
1947
|
-
id: "content-manager.actions.unpublish.dialog.option.replace-draft",
|
1948
|
-
defaultMessage: "Replace draft"
|
1949
|
-
})
|
1950
|
-
}
|
1951
|
-
)
|
2037
|
+
/* @__PURE__ */ jsx(Radio.Item, { checked: shouldKeepDraft, value: UNPUBLISH_DRAFT_OPTIONS.KEEP, children: formatMessage({
|
2038
|
+
id: "content-manager.actions.unpublish.dialog.option.keep-draft",
|
2039
|
+
defaultMessage: "Keep draft"
|
2040
|
+
}) }),
|
2041
|
+
/* @__PURE__ */ jsx(Radio.Item, { checked: !shouldKeepDraft, value: UNPUBLISH_DRAFT_OPTIONS.DISCARD, children: formatMessage({
|
2042
|
+
id: "content-manager.actions.unpublish.dialog.option.replace-draft",
|
2043
|
+
defaultMessage: "Replace draft"
|
2044
|
+
}) })
|
1952
2045
|
]
|
1953
2046
|
}
|
1954
2047
|
)
|
@@ -2094,23 +2187,13 @@ const Header = ({ isCreating, status, title: documentTitle = "Untitled" }) => {
|
|
2094
2187
|
id: "content-manager.containers.edit.title.new",
|
2095
2188
|
defaultMessage: "Create an entry"
|
2096
2189
|
}) : documentTitle;
|
2097
|
-
return /* @__PURE__ */ jsxs(Flex, { direction: "column", alignItems: "flex-start", paddingTop:
|
2190
|
+
return /* @__PURE__ */ jsxs(Flex, { direction: "column", alignItems: "flex-start", paddingTop: 6, paddingBottom: 4, gap: 2, children: [
|
2098
2191
|
/* @__PURE__ */ jsx(BackButton, {}),
|
2099
|
-
/* @__PURE__ */ jsxs(
|
2100
|
-
|
2101
|
-
{
|
2102
|
-
|
2103
|
-
|
2104
|
-
paddingTop: 1,
|
2105
|
-
gap: "80px",
|
2106
|
-
alignItems: "flex-start",
|
2107
|
-
children: [
|
2108
|
-
/* @__PURE__ */ jsx(Typography, { variant: "alpha", tag: "h1", children: title }),
|
2109
|
-
/* @__PURE__ */ jsx(HeaderToolbar, {})
|
2110
|
-
]
|
2111
|
-
}
|
2112
|
-
),
|
2113
|
-
status ? /* @__PURE__ */ jsx(DocumentStatus, { status: isCloning ? "draft" : status }) : null
|
2192
|
+
/* @__PURE__ */ jsxs(Flex, { width: "100%", justifyContent: "space-between", gap: "80px", alignItems: "flex-start", children: [
|
2193
|
+
/* @__PURE__ */ jsx(Typography, { variant: "alpha", tag: "h1", children: title }),
|
2194
|
+
/* @__PURE__ */ jsx(HeaderToolbar, {})
|
2195
|
+
] }),
|
2196
|
+
status ? /* @__PURE__ */ jsx(Box, { marginTop: 1, children: /* @__PURE__ */ jsx(DocumentStatus, { status: isCloning ? "draft" : status }) }) : null
|
2114
2197
|
] });
|
2115
2198
|
};
|
2116
2199
|
const HeaderToolbar = () => {
|
@@ -2801,30 +2884,23 @@ const ConfirmBulkActionDialog = ({
|
|
2801
2884
|
endAction
|
2802
2885
|
}) => {
|
2803
2886
|
const { formatMessage } = useIntl();
|
2804
|
-
return /* @__PURE__ */ jsxs(
|
2805
|
-
Dialog,
|
2806
|
-
|
2807
|
-
|
2808
|
-
|
2809
|
-
|
2810
|
-
|
2811
|
-
|
2812
|
-
|
2813
|
-
|
2814
|
-
|
2815
|
-
|
2816
|
-
|
2817
|
-
|
2818
|
-
|
2819
|
-
|
2820
|
-
|
2821
|
-
}) }),
|
2822
|
-
endAction
|
2823
|
-
}
|
2824
|
-
)
|
2825
|
-
]
|
2826
|
-
}
|
2827
|
-
);
|
2887
|
+
return /* @__PURE__ */ jsx(Dialog.Root, { onOpenChange: onToggleDialog, open: isOpen, children: /* @__PURE__ */ jsxs(Dialog.Content, { children: [
|
2888
|
+
/* @__PURE__ */ jsx(Dialog.Header, { children: formatMessage({
|
2889
|
+
id: "app.components.ConfirmDialog.title",
|
2890
|
+
defaultMessage: "Confirmation"
|
2891
|
+
}) }),
|
2892
|
+
/* @__PURE__ */ jsx(Dialog.Body, { children: /* @__PURE__ */ jsxs(Flex, { direction: "column", alignItems: "stretch", gap: 2, children: [
|
2893
|
+
/* @__PURE__ */ jsx(Flex, { justifyContent: "center", children: /* @__PURE__ */ jsx(WarningCircle, { width: "24px", height: "24px", fill: "danger600" }) }),
|
2894
|
+
dialogBody
|
2895
|
+
] }) }),
|
2896
|
+
/* @__PURE__ */ jsxs(Dialog.Footer, { children: [
|
2897
|
+
/* @__PURE__ */ jsx(Dialog.Cancel, { children: /* @__PURE__ */ jsx(Button, { fullWidth: true, onClick: onToggleDialog, variant: "tertiary", children: formatMessage({
|
2898
|
+
id: "app.components.Button.cancel",
|
2899
|
+
defaultMessage: "Cancel"
|
2900
|
+
}) }) }),
|
2901
|
+
endAction
|
2902
|
+
] })
|
2903
|
+
] }) });
|
2828
2904
|
};
|
2829
2905
|
const BoldChunk$1 = (chunks) => /* @__PURE__ */ jsx(Typography, { fontWeight: "bold", children: chunks });
|
2830
2906
|
const ConfirmDialogPublishAll = ({
|
@@ -2929,7 +3005,14 @@ const formatErrorMessages = (errors, parentKey, formatMessage) => {
|
|
2929
3005
|
)
|
2930
3006
|
);
|
2931
3007
|
} else {
|
2932
|
-
messages.push(
|
3008
|
+
messages.push(
|
3009
|
+
...formatErrorMessages(
|
3010
|
+
// @ts-expect-error TODO: check why value is not compatible with FormErrors
|
3011
|
+
value,
|
3012
|
+
currentKey,
|
3013
|
+
formatMessage
|
3014
|
+
)
|
3015
|
+
);
|
2933
3016
|
}
|
2934
3017
|
} else {
|
2935
3018
|
messages.push(
|
@@ -3166,7 +3249,7 @@ const SelectedEntriesModalContent = ({
|
|
3166
3249
|
);
|
3167
3250
|
};
|
3168
3251
|
return /* @__PURE__ */ jsxs(Fragment, { children: [
|
3169
|
-
/* @__PURE__ */ jsxs(
|
3252
|
+
/* @__PURE__ */ jsxs(Modal.Body, { children: [
|
3170
3253
|
/* @__PURE__ */ jsx(Typography, { children: getFormattedCountMessage() }),
|
3171
3254
|
/* @__PURE__ */ jsx(Box, { marginTop: 5, children: /* @__PURE__ */ jsx(
|
3172
3255
|
SelectedEntriesTableContent,
|
@@ -3178,27 +3261,24 @@ const SelectedEntriesModalContent = ({
|
|
3178
3261
|
}
|
3179
3262
|
) })
|
3180
3263
|
] }),
|
3181
|
-
/* @__PURE__ */
|
3182
|
-
|
3183
|
-
|
3184
|
-
|
3185
|
-
|
3186
|
-
|
3187
|
-
}) }),
|
3188
|
-
|
3189
|
-
|
3190
|
-
|
3191
|
-
|
3192
|
-
|
3193
|
-
|
3194
|
-
|
3195
|
-
|
3196
|
-
|
3197
|
-
|
3198
|
-
|
3199
|
-
] })
|
3200
|
-
}
|
3201
|
-
),
|
3264
|
+
/* @__PURE__ */ jsxs(Modal.Footer, { children: [
|
3265
|
+
/* @__PURE__ */ jsx(Button, { onClick: toggleModal, variant: "tertiary", children: formatMessage({
|
3266
|
+
id: "app.components.Button.cancel",
|
3267
|
+
defaultMessage: "Cancel"
|
3268
|
+
}) }),
|
3269
|
+
/* @__PURE__ */ jsxs(Flex, { gap: 2, children: [
|
3270
|
+
/* @__PURE__ */ jsx(Button, { onClick: refetch, variant: "tertiary", loading: isFetching, children: formatMessage({ id: "app.utils.refresh", defaultMessage: "Refresh" }) }),
|
3271
|
+
/* @__PURE__ */ jsx(
|
3272
|
+
Button,
|
3273
|
+
{
|
3274
|
+
onClick: toggleDialog,
|
3275
|
+
disabled: selectedEntries.length === 0 || selectedEntries.length === selectedEntriesWithErrorsCount || selectedEntriesPublished === selectedEntries.length || isLoading,
|
3276
|
+
loading: isSubmittingForm,
|
3277
|
+
children: formatMessage({ id: "app.utils.publish", defaultMessage: "Publish" })
|
3278
|
+
}
|
3279
|
+
)
|
3280
|
+
] })
|
3281
|
+
] }),
|
3202
3282
|
/* @__PURE__ */ jsx(
|
3203
3283
|
ConfirmDialogPublishAll,
|
3204
3284
|
{
|
@@ -3263,143 +3343,10 @@ const BulkActionsRenderer = () => {
|
|
3263
3343
|
documents: selectedRows
|
3264
3344
|
},
|
3265
3345
|
descriptions: plugins["content-manager"].apis.getBulkActions(),
|
3266
|
-
children: (actions2) => actions2.map((action) => /* @__PURE__ */ jsx(
|
3346
|
+
children: (actions2) => actions2.map((action) => /* @__PURE__ */ jsx(DocumentActionButton, { ...action }, action.id))
|
3267
3347
|
}
|
3268
3348
|
) });
|
3269
3349
|
};
|
3270
|
-
const BulkActionAction = (action) => {
|
3271
|
-
const [dialogId, setDialogId] = React.useState(null);
|
3272
|
-
const { toggleNotification } = useNotification();
|
3273
|
-
const handleClick = (action2) => (e) => {
|
3274
|
-
const { onClick, dialog, id } = action2;
|
3275
|
-
if (onClick) {
|
3276
|
-
onClick(e);
|
3277
|
-
}
|
3278
|
-
if (dialog) {
|
3279
|
-
switch (dialog.type) {
|
3280
|
-
case "notification":
|
3281
|
-
toggleNotification({
|
3282
|
-
title: dialog.title,
|
3283
|
-
message: dialog.content,
|
3284
|
-
type: dialog.status,
|
3285
|
-
timeout: dialog.timeout,
|
3286
|
-
onClose: dialog.onClose
|
3287
|
-
});
|
3288
|
-
break;
|
3289
|
-
case "dialog":
|
3290
|
-
case "modal": {
|
3291
|
-
e.preventDefault();
|
3292
|
-
setDialogId(id);
|
3293
|
-
}
|
3294
|
-
}
|
3295
|
-
}
|
3296
|
-
};
|
3297
|
-
const handleClose = () => {
|
3298
|
-
setDialogId(null);
|
3299
|
-
if (action.dialog?.type === "modal" && action.dialog?.onClose) {
|
3300
|
-
action.dialog.onClose();
|
3301
|
-
}
|
3302
|
-
};
|
3303
|
-
return /* @__PURE__ */ jsxs(Fragment, { children: [
|
3304
|
-
/* @__PURE__ */ jsx(
|
3305
|
-
Button,
|
3306
|
-
{
|
3307
|
-
disabled: action.disabled,
|
3308
|
-
startIcon: action.icon,
|
3309
|
-
variant: action.variant,
|
3310
|
-
onClick: handleClick(action),
|
3311
|
-
children: action.label
|
3312
|
-
}
|
3313
|
-
),
|
3314
|
-
action.dialog?.type === "dialog" ? /* @__PURE__ */ jsx(
|
3315
|
-
BulkActionConfirmDialog,
|
3316
|
-
{
|
3317
|
-
...action.dialog,
|
3318
|
-
variant: action.variant,
|
3319
|
-
isOpen: dialogId === action.id,
|
3320
|
-
onClose: handleClose
|
3321
|
-
}
|
3322
|
-
) : null,
|
3323
|
-
action.dialog?.type === "modal" ? /* @__PURE__ */ jsx(
|
3324
|
-
BulkActionModal,
|
3325
|
-
{
|
3326
|
-
...action.dialog,
|
3327
|
-
onModalClose: handleClose,
|
3328
|
-
isOpen: dialogId === action.id
|
3329
|
-
}
|
3330
|
-
) : null
|
3331
|
-
] });
|
3332
|
-
};
|
3333
|
-
const BulkActionConfirmDialog = ({
|
3334
|
-
onClose,
|
3335
|
-
onCancel,
|
3336
|
-
onConfirm,
|
3337
|
-
title,
|
3338
|
-
content,
|
3339
|
-
confirmButton,
|
3340
|
-
isOpen,
|
3341
|
-
variant = "secondary"
|
3342
|
-
}) => {
|
3343
|
-
const { formatMessage } = useIntl();
|
3344
|
-
const handleClose = async () => {
|
3345
|
-
if (onCancel) {
|
3346
|
-
await onCancel();
|
3347
|
-
}
|
3348
|
-
onClose();
|
3349
|
-
};
|
3350
|
-
const handleConfirm = async () => {
|
3351
|
-
if (onConfirm) {
|
3352
|
-
await onConfirm();
|
3353
|
-
}
|
3354
|
-
onClose();
|
3355
|
-
};
|
3356
|
-
return /* @__PURE__ */ jsxs(Dialog, { isOpen, title, onClose: handleClose, children: [
|
3357
|
-
/* @__PURE__ */ jsx(DialogBody, { icon: /* @__PURE__ */ jsx(WarningCircle, {}), children: content }),
|
3358
|
-
/* @__PURE__ */ jsx(
|
3359
|
-
DialogFooter,
|
3360
|
-
{
|
3361
|
-
startAction: /* @__PURE__ */ jsx(Button, { onClick: handleClose, variant: "tertiary", children: formatMessage({
|
3362
|
-
id: "app.components.Button.cancel",
|
3363
|
-
defaultMessage: "Cancel"
|
3364
|
-
}) }),
|
3365
|
-
endAction: /* @__PURE__ */ jsx(
|
3366
|
-
Button,
|
3367
|
-
{
|
3368
|
-
onClick: handleConfirm,
|
3369
|
-
variant: variant === "danger-light" ? variant : "secondary",
|
3370
|
-
startIcon: variant === "danger-light" ? /* @__PURE__ */ jsx(Trash, {}) : /* @__PURE__ */ jsx(Check, {}),
|
3371
|
-
children: confirmButton ? confirmButton : formatMessage({
|
3372
|
-
id: "app.components.Button.confirm",
|
3373
|
-
defaultMessage: "Confirm"
|
3374
|
-
})
|
3375
|
-
}
|
3376
|
-
)
|
3377
|
-
}
|
3378
|
-
)
|
3379
|
-
] });
|
3380
|
-
};
|
3381
|
-
const BulkActionModal = ({
|
3382
|
-
isOpen,
|
3383
|
-
title,
|
3384
|
-
onClose,
|
3385
|
-
content: Content,
|
3386
|
-
onModalClose
|
3387
|
-
}) => {
|
3388
|
-
const id = React.useId();
|
3389
|
-
if (!isOpen) {
|
3390
|
-
return null;
|
3391
|
-
}
|
3392
|
-
const handleClose = () => {
|
3393
|
-
if (onClose) {
|
3394
|
-
onClose();
|
3395
|
-
}
|
3396
|
-
onModalClose();
|
3397
|
-
};
|
3398
|
-
return /* @__PURE__ */ jsxs(ModalLayout, { borderRadius: "4px", overflow: "hidden", onClose: handleClose, labelledBy: id, children: [
|
3399
|
-
/* @__PURE__ */ jsx(ModalHeader, { children: /* @__PURE__ */ jsx(Typography, { fontWeight: "bold", textColor: "neutral800", tag: "h2", id, children: title }) }),
|
3400
|
-
/* @__PURE__ */ jsx(Content, { onClose: handleClose })
|
3401
|
-
] });
|
3402
|
-
};
|
3403
3350
|
const DeleteAction = ({ documents, model }) => {
|
3404
3351
|
const { formatMessage } = useIntl();
|
3405
3352
|
const { schema: contentType } = useDoc();
|
@@ -3432,6 +3379,7 @@ const DeleteAction = ({ documents, model }) => {
|
|
3432
3379
|
defaultMessage: "Confirmation"
|
3433
3380
|
}),
|
3434
3381
|
content: /* @__PURE__ */ jsxs(Flex, { direction: "column", alignItems: "stretch", gap: 2, children: [
|
3382
|
+
/* @__PURE__ */ jsx(Flex, { justifyContent: "center", children: /* @__PURE__ */ jsx(WarningCircle, { width: "24px", height: "24px", fill: "danger600" }) }),
|
3435
3383
|
/* @__PURE__ */ jsx(Typography, { id: "confirm-description", textAlign: "center", children: formatMessage({
|
3436
3384
|
id: "popUpWarning.bodyMessage.contentType.delete.all",
|
3437
3385
|
defaultMessage: "Are you sure you want to delete these entries?"
|
@@ -3481,6 +3429,7 @@ const UnpublishAction = ({ documents, model }) => {
|
|
3481
3429
|
defaultMessage: "Confirmation"
|
3482
3430
|
}),
|
3483
3431
|
content: /* @__PURE__ */ jsxs(Flex, { direction: "column", alignItems: "stretch", gap: 2, children: [
|
3432
|
+
/* @__PURE__ */ jsx(Flex, { justifyContent: "center", children: /* @__PURE__ */ jsx(WarningCircle, { width: "24px", height: "24px", fill: "danger600" }) }),
|
3484
3433
|
/* @__PURE__ */ jsx(Typography, { id: "confirm-description", textAlign: "center", children: formatMessage({
|
3485
3434
|
id: "popUpWarning.bodyMessage.contentType.unpublish.all",
|
3486
3435
|
defaultMessage: "Are you sure you want to unpublish these entries?"
|
@@ -3866,15 +3815,24 @@ const index = {
|
|
3866
3815
|
defaultMessage: "Content Manager"
|
3867
3816
|
},
|
3868
3817
|
permissions: [],
|
3869
|
-
Component: () => import("./layout-BzAbmoO6.mjs").then((mod) => ({ default: mod.Layout })),
|
3870
3818
|
position: 1
|
3871
3819
|
});
|
3820
|
+
app.router.addRoute({
|
3821
|
+
path: "content-manager/*",
|
3822
|
+
lazy: async () => {
|
3823
|
+
const { Layout } = await import("./layout-DHe2GdT4.mjs");
|
3824
|
+
return {
|
3825
|
+
Component: Layout
|
3826
|
+
};
|
3827
|
+
},
|
3828
|
+
children: routes
|
3829
|
+
});
|
3872
3830
|
app.registerPlugin(cm.config);
|
3873
3831
|
},
|
3874
3832
|
async registerTrads({ locales }) {
|
3875
3833
|
const importedTrads = await Promise.all(
|
3876
3834
|
locales.map((locale) => {
|
3877
|
-
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-
|
3835
|
+
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-BrCTWlZv.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 }) => {
|
3878
3836
|
return {
|
3879
3837
|
data: prefixPluginTranslations(data, PLUGIN_ID),
|
3880
3838
|
locale
|
@@ -3895,14 +3853,13 @@ export {
|
|
3895
3853
|
BulkActionsRenderer as B,
|
3896
3854
|
COLLECTION_TYPES as C,
|
3897
3855
|
DocumentStatus as D,
|
3898
|
-
|
3899
|
-
|
3900
|
-
|
3856
|
+
DEFAULT_SETTINGS as E,
|
3857
|
+
convertEditLayoutToFieldLayouts as F,
|
3858
|
+
useDocument as G,
|
3901
3859
|
HOOKS as H,
|
3902
3860
|
InjectionZone as I,
|
3903
|
-
|
3904
|
-
|
3905
|
-
useDocumentActions as L,
|
3861
|
+
index as J,
|
3862
|
+
useDocumentActions as K,
|
3906
3863
|
Panels as P,
|
3907
3864
|
RelativeTime as R,
|
3908
3865
|
SINGLE_TYPES as S,
|
@@ -3924,14 +3881,14 @@ export {
|
|
3924
3881
|
useGetContentTypeConfigurationQuery as o,
|
3925
3882
|
CREATOR_FIELDS as p,
|
3926
3883
|
getMainField as q,
|
3927
|
-
|
3884
|
+
getDisplayName as r,
|
3928
3885
|
setInitialData as s,
|
3929
|
-
|
3886
|
+
checkIfAttributeIsDisplayable as t,
|
3930
3887
|
useContentTypeSchema as u,
|
3931
|
-
|
3932
|
-
|
3933
|
-
|
3934
|
-
|
3935
|
-
|
3888
|
+
useGetAllDocumentsQuery as v,
|
3889
|
+
convertListLayoutToFieldLayouts as w,
|
3890
|
+
capitalise as x,
|
3891
|
+
useUpdateContentTypeConfigurationMutation as y,
|
3892
|
+
extractContentTypeComponents as z
|
3936
3893
|
};
|
3937
|
-
//# sourceMappingURL=index-
|
3894
|
+
//# sourceMappingURL=index-DIQ7Io-l.mjs.map
|