@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
@@ -219,6 +219,7 @@ const contentManagerApi = strapiAdmin.adminApi.enhanceEndpoints({
|
|
219
219
|
]
|
220
220
|
});
|
221
221
|
const documentApi = contentManagerApi.injectEndpoints({
|
222
|
+
overrideExisting: true,
|
222
223
|
endpoints: (builder) => ({
|
223
224
|
autoCloneDocument: builder.mutation({
|
224
225
|
query: ({ model, sourceId, query }) => ({
|
@@ -620,11 +621,11 @@ const createAttributeSchema = (attribute) => {
|
|
620
621
|
}
|
621
622
|
};
|
622
623
|
const addRequiredValidation = (attribute) => (schema) => {
|
623
|
-
if (attribute.required) {
|
624
|
-
return schema.required
|
625
|
-
|
626
|
-
|
627
|
-
|
624
|
+
if ((attribute.type === "component" && attribute.repeatable || attribute.type === "dynamiczone") && attribute.required && "min" in schema) {
|
625
|
+
return schema.min(1, strapiAdmin.translatedErrors.required);
|
626
|
+
}
|
627
|
+
if (attribute.required && attribute.type !== "relation") {
|
628
|
+
return schema.required(strapiAdmin.translatedErrors.required);
|
628
629
|
}
|
629
630
|
return schema?.nullable ? schema.nullable() : (
|
630
631
|
// In some cases '.nullable' will not be available on the schema.
|
@@ -658,6 +659,28 @@ const addMaxLengthValidation = (attribute) => (schema) => {
|
|
658
659
|
const addMinValidation = (attribute) => (schema) => {
|
659
660
|
if ("min" in attribute) {
|
660
661
|
const min = toInteger(attribute.min);
|
662
|
+
if (attribute.type === "component" && attribute.repeatable || attribute.type === "dynamiczone") {
|
663
|
+
if (!attribute.required && "test" in schema && min) {
|
664
|
+
return schema.test(
|
665
|
+
"custom-min",
|
666
|
+
{
|
667
|
+
...strapiAdmin.translatedErrors.min,
|
668
|
+
values: {
|
669
|
+
min: attribute.min
|
670
|
+
}
|
671
|
+
},
|
672
|
+
(value) => {
|
673
|
+
if (!value) {
|
674
|
+
return true;
|
675
|
+
}
|
676
|
+
if (Array.isArray(value) && value.length === 0) {
|
677
|
+
return true;
|
678
|
+
}
|
679
|
+
return value.length >= min;
|
680
|
+
}
|
681
|
+
);
|
682
|
+
}
|
683
|
+
}
|
661
684
|
if ("min" in schema && min) {
|
662
685
|
return schema.min(min, {
|
663
686
|
...strapiAdmin.translatedErrors.min,
|
@@ -784,7 +807,10 @@ const useDocument = (args, opts) => {
|
|
784
807
|
isLoading: isLoadingDocument,
|
785
808
|
isFetching: isFetchingDocument,
|
786
809
|
error
|
787
|
-
} = useGetDocumentQuery(args,
|
810
|
+
} = useGetDocumentQuery(args, {
|
811
|
+
...opts,
|
812
|
+
skip: !args.documentId && args.collectionType !== SINGLE_TYPES || opts?.skip
|
813
|
+
});
|
788
814
|
const { components, schema, isLoading: isLoadingSchema } = useContentTypeSchema(args.model);
|
789
815
|
React__namespace.useEffect(() => {
|
790
816
|
if (error) {
|
@@ -1286,7 +1312,7 @@ const useDocumentActions = () => {
|
|
1286
1312
|
};
|
1287
1313
|
};
|
1288
1314
|
const ProtectedHistoryPage = React.lazy(
|
1289
|
-
() => Promise.resolve().then(() => require("./History-
|
1315
|
+
() => Promise.resolve().then(() => require("./History-xNH_9UuV.js")).then((mod) => ({ default: mod.ProtectedHistoryPage }))
|
1290
1316
|
);
|
1291
1317
|
const routes$1 = [
|
1292
1318
|
{
|
@@ -1299,31 +1325,31 @@ const routes$1 = [
|
|
1299
1325
|
}
|
1300
1326
|
];
|
1301
1327
|
const ProtectedEditViewPage = React.lazy(
|
1302
|
-
() => Promise.resolve().then(() => require("./EditViewPage-
|
1328
|
+
() => Promise.resolve().then(() => require("./EditViewPage-DhttErmY.js")).then((mod) => ({ default: mod.ProtectedEditViewPage }))
|
1303
1329
|
);
|
1304
1330
|
const ProtectedListViewPage = React.lazy(
|
1305
|
-
() => Promise.resolve().then(() => require("./ListViewPage-
|
1331
|
+
() => Promise.resolve().then(() => require("./ListViewPage-ZIvstfvl.js")).then((mod) => ({ default: mod.ProtectedListViewPage }))
|
1306
1332
|
);
|
1307
1333
|
const ProtectedListConfiguration = React.lazy(
|
1308
|
-
() => Promise.resolve().then(() => require("./ListConfigurationPage-
|
1334
|
+
() => Promise.resolve().then(() => require("./ListConfigurationPage-BCPzXk5W.js")).then((mod) => ({
|
1309
1335
|
default: mod.ProtectedListConfiguration
|
1310
1336
|
}))
|
1311
1337
|
);
|
1312
1338
|
const ProtectedEditConfigurationPage = React.lazy(
|
1313
|
-
() => Promise.resolve().then(() => require("./EditConfigurationPage-
|
1339
|
+
() => Promise.resolve().then(() => require("./EditConfigurationPage-b6V7YHfo.js")).then((mod) => ({
|
1314
1340
|
default: mod.ProtectedEditConfigurationPage
|
1315
1341
|
}))
|
1316
1342
|
);
|
1317
1343
|
const ProtectedComponentConfigurationPage = React.lazy(
|
1318
|
-
() => Promise.resolve().then(() => require("./ComponentConfigurationPage-
|
1344
|
+
() => Promise.resolve().then(() => require("./ComponentConfigurationPage-DVY3LwHo.js")).then((mod) => ({
|
1319
1345
|
default: mod.ProtectedComponentConfigurationPage
|
1320
1346
|
}))
|
1321
1347
|
);
|
1322
1348
|
const NoPermissions = React.lazy(
|
1323
|
-
() => Promise.resolve().then(() => require("./NoPermissionsPage-
|
1349
|
+
() => Promise.resolve().then(() => require("./NoPermissionsPage-DofU68cO.js")).then((mod) => ({ default: mod.NoPermissions }))
|
1324
1350
|
);
|
1325
1351
|
const NoContentType = React.lazy(
|
1326
|
-
() => Promise.resolve().then(() => require("./NoContentTypePage-
|
1352
|
+
() => Promise.resolve().then(() => require("./NoContentTypePage-h7FcuMjI.js")).then((mod) => ({ default: mod.NoContentType }))
|
1327
1353
|
);
|
1328
1354
|
const CollectionTypePages = () => {
|
1329
1355
|
const { collectionType } = reactRouterDom.useParams();
|
@@ -1450,7 +1476,7 @@ const DocumentActionButton = (action) => {
|
|
1450
1476
|
DocumentActionConfirmDialog,
|
1451
1477
|
{
|
1452
1478
|
...action.dialog,
|
1453
|
-
variant: action.variant,
|
1479
|
+
variant: action.dialog?.variant ?? action.variant,
|
1454
1480
|
isOpen: dialogId === action.id,
|
1455
1481
|
onClose: handleClose
|
1456
1482
|
}
|
@@ -1530,7 +1556,7 @@ const DocumentActionsMenu = ({
|
|
1530
1556
|
display: "block",
|
1531
1557
|
children: /* @__PURE__ */ jsxRuntime.jsxs(designSystem.Flex, { justifyContent: "space-between", gap: 4, children: [
|
1532
1558
|
/* @__PURE__ */ jsxRuntime.jsxs(designSystem.Flex, { color: convertActionVariantToColor(action.variant), gap: 2, tag: "span", children: [
|
1533
|
-
action.icon,
|
1559
|
+
/* @__PURE__ */ jsxRuntime.jsx(designSystem.Box, { tag: "span", color: convertActionVariantToIconColor(action.variant), children: action.icon }),
|
1534
1560
|
action.label
|
1535
1561
|
] }),
|
1536
1562
|
action.id.startsWith("HistoryAction") && /* @__PURE__ */ jsxRuntime.jsx(
|
@@ -1591,6 +1617,18 @@ const convertActionVariantToColor = (variant = "secondary") => {
|
|
1591
1617
|
return "primary600";
|
1592
1618
|
}
|
1593
1619
|
};
|
1620
|
+
const convertActionVariantToIconColor = (variant = "secondary") => {
|
1621
|
+
switch (variant) {
|
1622
|
+
case "danger":
|
1623
|
+
return "danger600";
|
1624
|
+
case "secondary":
|
1625
|
+
return "neutral500";
|
1626
|
+
case "success":
|
1627
|
+
return "success600";
|
1628
|
+
default:
|
1629
|
+
return "primary600";
|
1630
|
+
}
|
1631
|
+
};
|
1594
1632
|
const DocumentActionConfirmDialog = ({
|
1595
1633
|
onClose,
|
1596
1634
|
onCancel,
|
@@ -1613,22 +1651,20 @@ const DocumentActionConfirmDialog = ({
|
|
1613
1651
|
}
|
1614
1652
|
onClose();
|
1615
1653
|
};
|
1616
|
-
return /* @__PURE__ */ jsxRuntime.
|
1617
|
-
/* @__PURE__ */ jsxRuntime.jsx(designSystem.
|
1618
|
-
/* @__PURE__ */ jsxRuntime.jsx(
|
1619
|
-
|
1620
|
-
{
|
1621
|
-
|
1622
|
-
|
1623
|
-
|
1624
|
-
|
1625
|
-
|
1626
|
-
|
1627
|
-
|
1628
|
-
|
1629
|
-
|
1630
|
-
)
|
1631
|
-
] });
|
1654
|
+
return /* @__PURE__ */ jsxRuntime.jsx(designSystem.Dialog.Root, { open: isOpen, onOpenChange: handleClose, children: /* @__PURE__ */ jsxRuntime.jsxs(designSystem.Dialog.Content, { children: [
|
1655
|
+
/* @__PURE__ */ jsxRuntime.jsx(designSystem.Dialog.Header, { children: title }),
|
1656
|
+
/* @__PURE__ */ jsxRuntime.jsx(designSystem.Dialog.Body, { children: content }),
|
1657
|
+
/* @__PURE__ */ jsxRuntime.jsxs(designSystem.Dialog.Footer, { children: [
|
1658
|
+
/* @__PURE__ */ jsxRuntime.jsx(designSystem.Dialog.Cancel, { children: /* @__PURE__ */ jsxRuntime.jsx(designSystem.Button, { variant: "tertiary", children: formatMessage({
|
1659
|
+
id: "app.components.Button.cancel",
|
1660
|
+
defaultMessage: "Cancel"
|
1661
|
+
}) }) }),
|
1662
|
+
/* @__PURE__ */ jsxRuntime.jsx(designSystem.Button, { onClick: handleConfirm, variant, children: formatMessage({
|
1663
|
+
id: "app.components.Button.confirm",
|
1664
|
+
defaultMessage: "Confirm"
|
1665
|
+
}) })
|
1666
|
+
] })
|
1667
|
+
] }) });
|
1632
1668
|
};
|
1633
1669
|
const DocumentActionModal = ({
|
1634
1670
|
isOpen,
|
@@ -1638,34 +1674,17 @@ const DocumentActionModal = ({
|
|
1638
1674
|
content: Content,
|
1639
1675
|
onModalClose
|
1640
1676
|
}) => {
|
1641
|
-
const id = React__namespace.useId();
|
1642
|
-
if (!isOpen) {
|
1643
|
-
return null;
|
1644
|
-
}
|
1645
1677
|
const handleClose = () => {
|
1646
1678
|
if (onClose) {
|
1647
1679
|
onClose();
|
1648
1680
|
}
|
1649
1681
|
onModalClose();
|
1650
1682
|
};
|
1651
|
-
return /* @__PURE__ */ jsxRuntime.
|
1652
|
-
/* @__PURE__ */ jsxRuntime.jsx(designSystem.
|
1653
|
-
/* @__PURE__ */ jsxRuntime.jsx(designSystem.
|
1654
|
-
/* @__PURE__ */ jsxRuntime.jsx(
|
1655
|
-
|
1656
|
-
{
|
1657
|
-
paddingTop: 4,
|
1658
|
-
paddingBottom: 4,
|
1659
|
-
paddingLeft: 5,
|
1660
|
-
paddingRight: 5,
|
1661
|
-
borderWidth: "1px 0 0 0",
|
1662
|
-
borderStyle: "solid",
|
1663
|
-
borderColor: "neutral150",
|
1664
|
-
background: "neutral100",
|
1665
|
-
children: typeof Footer === "function" ? /* @__PURE__ */ jsxRuntime.jsx(Footer, { onClose: handleClose }) : Footer
|
1666
|
-
}
|
1667
|
-
)
|
1668
|
-
] });
|
1683
|
+
return /* @__PURE__ */ jsxRuntime.jsx(designSystem.Modal.Root, { open: isOpen, onOpenChange: handleClose, children: /* @__PURE__ */ jsxRuntime.jsxs(designSystem.Modal.Content, { children: [
|
1684
|
+
/* @__PURE__ */ jsxRuntime.jsx(designSystem.Modal.Header, { children: /* @__PURE__ */ jsxRuntime.jsx(designSystem.Modal.Title, { children: title }) }),
|
1685
|
+
/* @__PURE__ */ jsxRuntime.jsx(designSystem.Modal.Body, { children: typeof Content === "function" ? /* @__PURE__ */ jsxRuntime.jsx(Content, { onClose: handleClose }) : Content }),
|
1686
|
+
/* @__PURE__ */ jsxRuntime.jsx(designSystem.Modal.Footer, { children: typeof Footer === "function" ? /* @__PURE__ */ jsxRuntime.jsx(Footer, { onClose: handleClose }) : Footer })
|
1687
|
+
] }) });
|
1669
1688
|
};
|
1670
1689
|
const PublishAction$1 = ({
|
1671
1690
|
activeTab,
|
@@ -1686,6 +1705,12 @@ const PublishAction$1 = ({
|
|
1686
1705
|
({ canPublish: canPublish2, canCreate: canCreate2, canUpdate: canUpdate2 }) => ({ canPublish: canPublish2, canCreate: canCreate2, canUpdate: canUpdate2 })
|
1687
1706
|
);
|
1688
1707
|
const { publish } = useDocumentActions();
|
1708
|
+
const [
|
1709
|
+
countDraftRelations,
|
1710
|
+
{ isLoading: isLoadingDraftRelations, isError: isErrorDraftRelations }
|
1711
|
+
] = useLazyGetDraftRelationCountQuery();
|
1712
|
+
const [localCountOfDraftRelations, setLocalCountOfDraftRelations] = React__namespace.useState(0);
|
1713
|
+
const [serverCountOfDraftRelations, setServerCountOfDraftRelations] = React__namespace.useState(0);
|
1689
1714
|
const [{ query, rawQuery }] = strapiAdmin.useQueryParams();
|
1690
1715
|
const params = React__namespace.useMemo(() => buildValidParams(query), [query]);
|
1691
1716
|
const modified = strapiAdmin.useForm("PublishAction", ({ modified: modified2 }) => modified2);
|
@@ -1694,10 +1719,101 @@ const PublishAction$1 = ({
|
|
1694
1719
|
const validate = strapiAdmin.useForm("PublishAction", (state) => state.validate);
|
1695
1720
|
const setErrors = strapiAdmin.useForm("PublishAction", (state) => state.setErrors);
|
1696
1721
|
const formValues = strapiAdmin.useForm("PublishAction", ({ values }) => values);
|
1722
|
+
React__namespace.useEffect(() => {
|
1723
|
+
if (isErrorDraftRelations) {
|
1724
|
+
toggleNotification({
|
1725
|
+
type: "danger",
|
1726
|
+
message: formatMessage({
|
1727
|
+
id: getTranslation("error.records.fetch-draft-relatons"),
|
1728
|
+
defaultMessage: "An error occurred while fetching draft relations on this document."
|
1729
|
+
})
|
1730
|
+
});
|
1731
|
+
}
|
1732
|
+
}, [isErrorDraftRelations, toggleNotification, formatMessage]);
|
1733
|
+
React__namespace.useEffect(() => {
|
1734
|
+
const localDraftRelations = /* @__PURE__ */ new Set();
|
1735
|
+
const extractDraftRelations = (data) => {
|
1736
|
+
const relations = data.connect || [];
|
1737
|
+
relations.forEach((relation) => {
|
1738
|
+
if (relation.status === "draft") {
|
1739
|
+
localDraftRelations.add(relation.id);
|
1740
|
+
}
|
1741
|
+
});
|
1742
|
+
};
|
1743
|
+
const traverseAndExtract = (data) => {
|
1744
|
+
Object.entries(data).forEach(([key, value]) => {
|
1745
|
+
if (key === "connect" && Array.isArray(value)) {
|
1746
|
+
extractDraftRelations({ connect: value });
|
1747
|
+
} else if (typeof value === "object" && value !== null) {
|
1748
|
+
traverseAndExtract(value);
|
1749
|
+
}
|
1750
|
+
});
|
1751
|
+
};
|
1752
|
+
if (!documentId || modified) {
|
1753
|
+
traverseAndExtract(formValues);
|
1754
|
+
setLocalCountOfDraftRelations(localDraftRelations.size);
|
1755
|
+
}
|
1756
|
+
}, [documentId, modified, formValues, setLocalCountOfDraftRelations]);
|
1757
|
+
React__namespace.useEffect(() => {
|
1758
|
+
if (documentId) {
|
1759
|
+
const fetchDraftRelationsCount = async () => {
|
1760
|
+
const { data, error } = await countDraftRelations({
|
1761
|
+
collectionType,
|
1762
|
+
model,
|
1763
|
+
documentId,
|
1764
|
+
params
|
1765
|
+
});
|
1766
|
+
if (error) {
|
1767
|
+
throw error;
|
1768
|
+
}
|
1769
|
+
if (data) {
|
1770
|
+
setServerCountOfDraftRelations(data.data);
|
1771
|
+
}
|
1772
|
+
};
|
1773
|
+
fetchDraftRelationsCount();
|
1774
|
+
}
|
1775
|
+
}, [documentId, countDraftRelations, collectionType, model, params]);
|
1697
1776
|
const isDocumentPublished = (document?.[PUBLISHED_AT_ATTRIBUTE_NAME] || meta?.availableStatus.some((doc) => doc[PUBLISHED_AT_ATTRIBUTE_NAME] !== null)) && document?.status !== "modified";
|
1698
1777
|
if (!schema?.options?.draftAndPublish) {
|
1699
1778
|
return null;
|
1700
1779
|
}
|
1780
|
+
const performPublish = async () => {
|
1781
|
+
setSubmitting(true);
|
1782
|
+
try {
|
1783
|
+
const { errors } = await validate();
|
1784
|
+
if (errors) {
|
1785
|
+
toggleNotification({
|
1786
|
+
type: "danger",
|
1787
|
+
message: formatMessage({
|
1788
|
+
id: "content-manager.validation.error",
|
1789
|
+
defaultMessage: "There are validation errors in your document. Please fix them before saving."
|
1790
|
+
})
|
1791
|
+
});
|
1792
|
+
return;
|
1793
|
+
}
|
1794
|
+
const res = await publish(
|
1795
|
+
{
|
1796
|
+
collectionType,
|
1797
|
+
model,
|
1798
|
+
documentId,
|
1799
|
+
params
|
1800
|
+
},
|
1801
|
+
formValues
|
1802
|
+
);
|
1803
|
+
if ("data" in res && collectionType !== SINGLE_TYPES) {
|
1804
|
+
navigate({
|
1805
|
+
pathname: `../${collectionType}/${model}/${res.data.documentId}`,
|
1806
|
+
search: rawQuery
|
1807
|
+
});
|
1808
|
+
} else if ("error" in res && isBaseQueryError(res.error) && res.error.name === "ValidationError") {
|
1809
|
+
setErrors(formatValidationErrors(res.error));
|
1810
|
+
}
|
1811
|
+
} finally {
|
1812
|
+
setSubmitting(false);
|
1813
|
+
}
|
1814
|
+
};
|
1815
|
+
const totalDraftRelations = localCountOfDraftRelations + serverCountOfDraftRelations;
|
1816
|
+
const hasDraftRelations = totalDraftRelations > 0;
|
1701
1817
|
return {
|
1702
1818
|
/**
|
1703
1819
|
* Disabled when:
|
@@ -1710,46 +1826,38 @@ const PublishAction$1 = ({
|
|
1710
1826
|
* - the user doesn't have the permission to create a new document
|
1711
1827
|
* - the user doesn't have the permission to update the document
|
1712
1828
|
*/
|
1713
|
-
disabled: isCloning || isSubmitting || activeTab === "published" || !modified && isDocumentPublished || !modified && !document?.documentId || !canPublish || Boolean(!document?.documentId && !canCreate || document?.documentId && !canUpdate),
|
1829
|
+
disabled: isCloning || isSubmitting || isLoadingDraftRelations || activeTab === "published" || !modified && isDocumentPublished || !modified && !document?.documentId || !canPublish || Boolean(!document?.documentId && !canCreate || document?.documentId && !canUpdate),
|
1714
1830
|
label: formatMessage({
|
1715
1831
|
id: "app.utils.publish",
|
1716
1832
|
defaultMessage: "Publish"
|
1717
1833
|
}),
|
1718
1834
|
onClick: async () => {
|
1719
|
-
|
1720
|
-
|
1721
|
-
|
1722
|
-
|
1723
|
-
|
1724
|
-
|
1725
|
-
|
1726
|
-
|
1727
|
-
|
1728
|
-
|
1729
|
-
|
1730
|
-
|
1731
|
-
|
1732
|
-
|
1733
|
-
|
1734
|
-
|
1735
|
-
|
1736
|
-
|
1737
|
-
|
1738
|
-
|
1739
|
-
formValues
|
1740
|
-
);
|
1741
|
-
if ("data" in res && collectionType !== SINGLE_TYPES) {
|
1742
|
-
navigate({
|
1743
|
-
pathname: `../${collectionType}/${model}/${res.data.documentId}`,
|
1744
|
-
search: rawQuery
|
1745
|
-
});
|
1746
|
-
} else if ("error" in res && isBaseQueryError(res.error) && res.error.name === "ValidationError") {
|
1747
|
-
setErrors(formatValidationErrors(res.error));
|
1835
|
+
if (hasDraftRelations) {
|
1836
|
+
return;
|
1837
|
+
}
|
1838
|
+
await performPublish();
|
1839
|
+
},
|
1840
|
+
dialog: hasDraftRelations ? {
|
1841
|
+
type: "dialog",
|
1842
|
+
variant: "danger",
|
1843
|
+
footer: null,
|
1844
|
+
title: formatMessage({
|
1845
|
+
id: getTranslation(`popUpwarning.warning.bulk-has-draft-relations.title`),
|
1846
|
+
defaultMessage: "Confirmation"
|
1847
|
+
}),
|
1848
|
+
content: formatMessage(
|
1849
|
+
{
|
1850
|
+
id: getTranslation(`popUpwarning.warning.bulk-has-draft-relations.message`),
|
1851
|
+
defaultMessage: "This entry is related to {count, plural, one {# draft entry} other {# draft entries}}. Publishing it could leave broken links in your app."
|
1852
|
+
},
|
1853
|
+
{
|
1854
|
+
count: totalDraftRelations
|
1748
1855
|
}
|
1749
|
-
|
1750
|
-
|
1856
|
+
),
|
1857
|
+
onConfirm: async () => {
|
1858
|
+
await performPublish();
|
1751
1859
|
}
|
1752
|
-
}
|
1860
|
+
} : void 0
|
1753
1861
|
};
|
1754
1862
|
};
|
1755
1863
|
PublishAction$1.type = "publish";
|
@@ -1848,10 +1956,13 @@ const UpdateAction = ({
|
|
1848
1956
|
document
|
1849
1957
|
);
|
1850
1958
|
if ("data" in res && collectionType !== SINGLE_TYPES) {
|
1851
|
-
navigate(
|
1852
|
-
|
1853
|
-
|
1854
|
-
|
1959
|
+
navigate(
|
1960
|
+
{
|
1961
|
+
pathname: `../${collectionType}/${model}/${res.data.documentId}`,
|
1962
|
+
search: rawQuery
|
1963
|
+
},
|
1964
|
+
{ replace: true }
|
1965
|
+
);
|
1855
1966
|
} else if ("error" in res && isBaseQueryError(res.error) && res.error.name === "ValidationError") {
|
1856
1967
|
setErrors(formatValidationErrors(res.error));
|
1857
1968
|
}
|
@@ -1883,10 +1994,8 @@ const UnpublishAction$1 = ({
|
|
1883
1994
|
const { toggleNotification } = strapiAdmin.useNotification();
|
1884
1995
|
const [shouldKeepDraft, setShouldKeepDraft] = React__namespace.useState(true);
|
1885
1996
|
const isDocumentModified = document?.status === "modified";
|
1886
|
-
const handleChange = (
|
1887
|
-
|
1888
|
-
setShouldKeepDraft(e.target.value === UNPUBLISH_DRAFT_OPTIONS.KEEP);
|
1889
|
-
}
|
1997
|
+
const handleChange = (value) => {
|
1998
|
+
setShouldKeepDraft(value === UNPUBLISH_DRAFT_OPTIONS.KEEP);
|
1890
1999
|
};
|
1891
2000
|
if (!schema?.options?.draftAndPublish) {
|
1892
2001
|
return null;
|
@@ -1936,40 +2045,24 @@ const UnpublishAction$1 = ({
|
|
1936
2045
|
}) })
|
1937
2046
|
] }),
|
1938
2047
|
/* @__PURE__ */ jsxRuntime.jsxs(
|
1939
|
-
designSystem.
|
2048
|
+
designSystem.Radio.Group,
|
1940
2049
|
{
|
1941
|
-
|
1942
|
-
|
1943
|
-
|
1944
|
-
|
1945
|
-
|
1946
|
-
|
2050
|
+
defaultValue: UNPUBLISH_DRAFT_OPTIONS.KEEP,
|
2051
|
+
name: "discard-options",
|
2052
|
+
"aria-label": formatMessage({
|
2053
|
+
id: "content-manager.actions.unpublish.dialog.radio-label",
|
2054
|
+
defaultMessage: "Choose an option to unpublish the document."
|
2055
|
+
}),
|
2056
|
+
onValueChange: handleChange,
|
1947
2057
|
children: [
|
1948
|
-
/* @__PURE__ */ jsxRuntime.jsx(designSystem.
|
1949
|
-
|
1950
|
-
|
1951
|
-
|
1952
|
-
|
1953
|
-
|
1954
|
-
|
1955
|
-
|
1956
|
-
id: "content-manager.actions.unpublish.dialog.option.keep-draft",
|
1957
|
-
defaultMessage: "Keep draft"
|
1958
|
-
})
|
1959
|
-
}
|
1960
|
-
),
|
1961
|
-
/* @__PURE__ */ jsxRuntime.jsx(
|
1962
|
-
designSystem.Radio,
|
1963
|
-
{
|
1964
|
-
checked: !shouldKeepDraft,
|
1965
|
-
value: UNPUBLISH_DRAFT_OPTIONS.DISCARD,
|
1966
|
-
name: "discard-options",
|
1967
|
-
children: formatMessage({
|
1968
|
-
id: "content-manager.actions.unpublish.dialog.option.replace-draft",
|
1969
|
-
defaultMessage: "Replace draft"
|
1970
|
-
})
|
1971
|
-
}
|
1972
|
-
)
|
2058
|
+
/* @__PURE__ */ jsxRuntime.jsx(designSystem.Radio.Item, { checked: shouldKeepDraft, value: UNPUBLISH_DRAFT_OPTIONS.KEEP, children: formatMessage({
|
2059
|
+
id: "content-manager.actions.unpublish.dialog.option.keep-draft",
|
2060
|
+
defaultMessage: "Keep draft"
|
2061
|
+
}) }),
|
2062
|
+
/* @__PURE__ */ jsxRuntime.jsx(designSystem.Radio.Item, { checked: !shouldKeepDraft, value: UNPUBLISH_DRAFT_OPTIONS.DISCARD, children: formatMessage({
|
2063
|
+
id: "content-manager.actions.unpublish.dialog.option.replace-draft",
|
2064
|
+
defaultMessage: "Replace draft"
|
2065
|
+
}) })
|
1973
2066
|
]
|
1974
2067
|
}
|
1975
2068
|
)
|
@@ -2115,23 +2208,13 @@ const Header = ({ isCreating, status, title: documentTitle = "Untitled" }) => {
|
|
2115
2208
|
id: "content-manager.containers.edit.title.new",
|
2116
2209
|
defaultMessage: "Create an entry"
|
2117
2210
|
}) : documentTitle;
|
2118
|
-
return /* @__PURE__ */ jsxRuntime.jsxs(designSystem.Flex, { direction: "column", alignItems: "flex-start", paddingTop:
|
2211
|
+
return /* @__PURE__ */ jsxRuntime.jsxs(designSystem.Flex, { direction: "column", alignItems: "flex-start", paddingTop: 6, paddingBottom: 4, gap: 2, children: [
|
2119
2212
|
/* @__PURE__ */ jsxRuntime.jsx(strapiAdmin.BackButton, {}),
|
2120
|
-
/* @__PURE__ */ jsxRuntime.jsxs(
|
2121
|
-
designSystem.
|
2122
|
-
{
|
2123
|
-
|
2124
|
-
|
2125
|
-
paddingTop: 1,
|
2126
|
-
gap: "80px",
|
2127
|
-
alignItems: "flex-start",
|
2128
|
-
children: [
|
2129
|
-
/* @__PURE__ */ jsxRuntime.jsx(designSystem.Typography, { variant: "alpha", tag: "h1", children: title }),
|
2130
|
-
/* @__PURE__ */ jsxRuntime.jsx(HeaderToolbar, {})
|
2131
|
-
]
|
2132
|
-
}
|
2133
|
-
),
|
2134
|
-
status ? /* @__PURE__ */ jsxRuntime.jsx(DocumentStatus, { status: isCloning ? "draft" : status }) : null
|
2213
|
+
/* @__PURE__ */ jsxRuntime.jsxs(designSystem.Flex, { width: "100%", justifyContent: "space-between", gap: "80px", alignItems: "flex-start", children: [
|
2214
|
+
/* @__PURE__ */ jsxRuntime.jsx(designSystem.Typography, { variant: "alpha", tag: "h1", children: title }),
|
2215
|
+
/* @__PURE__ */ jsxRuntime.jsx(HeaderToolbar, {})
|
2216
|
+
] }),
|
2217
|
+
status ? /* @__PURE__ */ jsxRuntime.jsx(designSystem.Box, { marginTop: 1, children: /* @__PURE__ */ jsxRuntime.jsx(DocumentStatus, { status: isCloning ? "draft" : status }) }) : null
|
2135
2218
|
] });
|
2136
2219
|
};
|
2137
2220
|
const HeaderToolbar = () => {
|
@@ -2822,30 +2905,23 @@ const ConfirmBulkActionDialog = ({
|
|
2822
2905
|
endAction
|
2823
2906
|
}) => {
|
2824
2907
|
const { formatMessage } = reactIntl.useIntl();
|
2825
|
-
return /* @__PURE__ */ jsxRuntime.jsxs(
|
2826
|
-
designSystem.Dialog,
|
2827
|
-
|
2828
|
-
|
2829
|
-
|
2830
|
-
|
2831
|
-
|
2832
|
-
|
2833
|
-
|
2834
|
-
|
2835
|
-
|
2836
|
-
|
2837
|
-
|
2838
|
-
|
2839
|
-
|
2840
|
-
|
2841
|
-
|
2842
|
-
}) }),
|
2843
|
-
endAction
|
2844
|
-
}
|
2845
|
-
)
|
2846
|
-
]
|
2847
|
-
}
|
2848
|
-
);
|
2908
|
+
return /* @__PURE__ */ jsxRuntime.jsx(designSystem.Dialog.Root, { onOpenChange: onToggleDialog, open: isOpen, children: /* @__PURE__ */ jsxRuntime.jsxs(designSystem.Dialog.Content, { children: [
|
2909
|
+
/* @__PURE__ */ jsxRuntime.jsx(designSystem.Dialog.Header, { children: formatMessage({
|
2910
|
+
id: "app.components.ConfirmDialog.title",
|
2911
|
+
defaultMessage: "Confirmation"
|
2912
|
+
}) }),
|
2913
|
+
/* @__PURE__ */ jsxRuntime.jsx(designSystem.Dialog.Body, { children: /* @__PURE__ */ jsxRuntime.jsxs(designSystem.Flex, { direction: "column", alignItems: "stretch", gap: 2, children: [
|
2914
|
+
/* @__PURE__ */ jsxRuntime.jsx(designSystem.Flex, { justifyContent: "center", children: /* @__PURE__ */ jsxRuntime.jsx(Icons.WarningCircle, { width: "24px", height: "24px", fill: "danger600" }) }),
|
2915
|
+
dialogBody
|
2916
|
+
] }) }),
|
2917
|
+
/* @__PURE__ */ jsxRuntime.jsxs(designSystem.Dialog.Footer, { children: [
|
2918
|
+
/* @__PURE__ */ jsxRuntime.jsx(designSystem.Dialog.Cancel, { children: /* @__PURE__ */ jsxRuntime.jsx(designSystem.Button, { fullWidth: true, onClick: onToggleDialog, variant: "tertiary", children: formatMessage({
|
2919
|
+
id: "app.components.Button.cancel",
|
2920
|
+
defaultMessage: "Cancel"
|
2921
|
+
}) }) }),
|
2922
|
+
endAction
|
2923
|
+
] })
|
2924
|
+
] }) });
|
2849
2925
|
};
|
2850
2926
|
const BoldChunk$1 = (chunks) => /* @__PURE__ */ jsxRuntime.jsx(designSystem.Typography, { fontWeight: "bold", children: chunks });
|
2851
2927
|
const ConfirmDialogPublishAll = ({
|
@@ -2950,7 +3026,14 @@ const formatErrorMessages = (errors, parentKey, formatMessage) => {
|
|
2950
3026
|
)
|
2951
3027
|
);
|
2952
3028
|
} else {
|
2953
|
-
messages.push(
|
3029
|
+
messages.push(
|
3030
|
+
...formatErrorMessages(
|
3031
|
+
// @ts-expect-error TODO: check why value is not compatible with FormErrors
|
3032
|
+
value,
|
3033
|
+
currentKey,
|
3034
|
+
formatMessage
|
3035
|
+
)
|
3036
|
+
);
|
2954
3037
|
}
|
2955
3038
|
} else {
|
2956
3039
|
messages.push(
|
@@ -3187,7 +3270,7 @@ const SelectedEntriesModalContent = ({
|
|
3187
3270
|
);
|
3188
3271
|
};
|
3189
3272
|
return /* @__PURE__ */ jsxRuntime.jsxs(jsxRuntime.Fragment, { children: [
|
3190
|
-
/* @__PURE__ */ jsxRuntime.jsxs(designSystem.
|
3273
|
+
/* @__PURE__ */ jsxRuntime.jsxs(designSystem.Modal.Body, { children: [
|
3191
3274
|
/* @__PURE__ */ jsxRuntime.jsx(designSystem.Typography, { children: getFormattedCountMessage() }),
|
3192
3275
|
/* @__PURE__ */ jsxRuntime.jsx(designSystem.Box, { marginTop: 5, children: /* @__PURE__ */ jsxRuntime.jsx(
|
3193
3276
|
SelectedEntriesTableContent,
|
@@ -3199,27 +3282,24 @@ const SelectedEntriesModalContent = ({
|
|
3199
3282
|
}
|
3200
3283
|
) })
|
3201
3284
|
] }),
|
3202
|
-
/* @__PURE__ */ jsxRuntime.
|
3203
|
-
designSystem.
|
3204
|
-
|
3205
|
-
|
3206
|
-
|
3207
|
-
|
3208
|
-
}) }),
|
3209
|
-
|
3210
|
-
|
3211
|
-
|
3212
|
-
|
3213
|
-
|
3214
|
-
|
3215
|
-
|
3216
|
-
|
3217
|
-
|
3218
|
-
|
3219
|
-
|
3220
|
-
] })
|
3221
|
-
}
|
3222
|
-
),
|
3285
|
+
/* @__PURE__ */ jsxRuntime.jsxs(designSystem.Modal.Footer, { children: [
|
3286
|
+
/* @__PURE__ */ jsxRuntime.jsx(designSystem.Button, { onClick: toggleModal, variant: "tertiary", children: formatMessage({
|
3287
|
+
id: "app.components.Button.cancel",
|
3288
|
+
defaultMessage: "Cancel"
|
3289
|
+
}) }),
|
3290
|
+
/* @__PURE__ */ jsxRuntime.jsxs(designSystem.Flex, { gap: 2, children: [
|
3291
|
+
/* @__PURE__ */ jsxRuntime.jsx(designSystem.Button, { onClick: refetch, variant: "tertiary", loading: isFetching, children: formatMessage({ id: "app.utils.refresh", defaultMessage: "Refresh" }) }),
|
3292
|
+
/* @__PURE__ */ jsxRuntime.jsx(
|
3293
|
+
designSystem.Button,
|
3294
|
+
{
|
3295
|
+
onClick: toggleDialog,
|
3296
|
+
disabled: selectedEntries.length === 0 || selectedEntries.length === selectedEntriesWithErrorsCount || selectedEntriesPublished === selectedEntries.length || isLoading,
|
3297
|
+
loading: isSubmittingForm,
|
3298
|
+
children: formatMessage({ id: "app.utils.publish", defaultMessage: "Publish" })
|
3299
|
+
}
|
3300
|
+
)
|
3301
|
+
] })
|
3302
|
+
] }),
|
3223
3303
|
/* @__PURE__ */ jsxRuntime.jsx(
|
3224
3304
|
ConfirmDialogPublishAll,
|
3225
3305
|
{
|
@@ -3284,143 +3364,10 @@ const BulkActionsRenderer = () => {
|
|
3284
3364
|
documents: selectedRows
|
3285
3365
|
},
|
3286
3366
|
descriptions: plugins["content-manager"].apis.getBulkActions(),
|
3287
|
-
children: (actions2) => actions2.map((action) => /* @__PURE__ */ jsxRuntime.jsx(
|
3367
|
+
children: (actions2) => actions2.map((action) => /* @__PURE__ */ jsxRuntime.jsx(DocumentActionButton, { ...action }, action.id))
|
3288
3368
|
}
|
3289
3369
|
) });
|
3290
3370
|
};
|
3291
|
-
const BulkActionAction = (action) => {
|
3292
|
-
const [dialogId, setDialogId] = React__namespace.useState(null);
|
3293
|
-
const { toggleNotification } = strapiAdmin.useNotification();
|
3294
|
-
const handleClick = (action2) => (e) => {
|
3295
|
-
const { onClick, dialog, id } = action2;
|
3296
|
-
if (onClick) {
|
3297
|
-
onClick(e);
|
3298
|
-
}
|
3299
|
-
if (dialog) {
|
3300
|
-
switch (dialog.type) {
|
3301
|
-
case "notification":
|
3302
|
-
toggleNotification({
|
3303
|
-
title: dialog.title,
|
3304
|
-
message: dialog.content,
|
3305
|
-
type: dialog.status,
|
3306
|
-
timeout: dialog.timeout,
|
3307
|
-
onClose: dialog.onClose
|
3308
|
-
});
|
3309
|
-
break;
|
3310
|
-
case "dialog":
|
3311
|
-
case "modal": {
|
3312
|
-
e.preventDefault();
|
3313
|
-
setDialogId(id);
|
3314
|
-
}
|
3315
|
-
}
|
3316
|
-
}
|
3317
|
-
};
|
3318
|
-
const handleClose = () => {
|
3319
|
-
setDialogId(null);
|
3320
|
-
if (action.dialog?.type === "modal" && action.dialog?.onClose) {
|
3321
|
-
action.dialog.onClose();
|
3322
|
-
}
|
3323
|
-
};
|
3324
|
-
return /* @__PURE__ */ jsxRuntime.jsxs(jsxRuntime.Fragment, { children: [
|
3325
|
-
/* @__PURE__ */ jsxRuntime.jsx(
|
3326
|
-
designSystem.Button,
|
3327
|
-
{
|
3328
|
-
disabled: action.disabled,
|
3329
|
-
startIcon: action.icon,
|
3330
|
-
variant: action.variant,
|
3331
|
-
onClick: handleClick(action),
|
3332
|
-
children: action.label
|
3333
|
-
}
|
3334
|
-
),
|
3335
|
-
action.dialog?.type === "dialog" ? /* @__PURE__ */ jsxRuntime.jsx(
|
3336
|
-
BulkActionConfirmDialog,
|
3337
|
-
{
|
3338
|
-
...action.dialog,
|
3339
|
-
variant: action.variant,
|
3340
|
-
isOpen: dialogId === action.id,
|
3341
|
-
onClose: handleClose
|
3342
|
-
}
|
3343
|
-
) : null,
|
3344
|
-
action.dialog?.type === "modal" ? /* @__PURE__ */ jsxRuntime.jsx(
|
3345
|
-
BulkActionModal,
|
3346
|
-
{
|
3347
|
-
...action.dialog,
|
3348
|
-
onModalClose: handleClose,
|
3349
|
-
isOpen: dialogId === action.id
|
3350
|
-
}
|
3351
|
-
) : null
|
3352
|
-
] });
|
3353
|
-
};
|
3354
|
-
const BulkActionConfirmDialog = ({
|
3355
|
-
onClose,
|
3356
|
-
onCancel,
|
3357
|
-
onConfirm,
|
3358
|
-
title,
|
3359
|
-
content,
|
3360
|
-
confirmButton,
|
3361
|
-
isOpen,
|
3362
|
-
variant = "secondary"
|
3363
|
-
}) => {
|
3364
|
-
const { formatMessage } = reactIntl.useIntl();
|
3365
|
-
const handleClose = async () => {
|
3366
|
-
if (onCancel) {
|
3367
|
-
await onCancel();
|
3368
|
-
}
|
3369
|
-
onClose();
|
3370
|
-
};
|
3371
|
-
const handleConfirm = async () => {
|
3372
|
-
if (onConfirm) {
|
3373
|
-
await onConfirm();
|
3374
|
-
}
|
3375
|
-
onClose();
|
3376
|
-
};
|
3377
|
-
return /* @__PURE__ */ jsxRuntime.jsxs(designSystem.Dialog, { isOpen, title, onClose: handleClose, children: [
|
3378
|
-
/* @__PURE__ */ jsxRuntime.jsx(designSystem.DialogBody, { icon: /* @__PURE__ */ jsxRuntime.jsx(Icons.WarningCircle, {}), children: content }),
|
3379
|
-
/* @__PURE__ */ jsxRuntime.jsx(
|
3380
|
-
designSystem.DialogFooter,
|
3381
|
-
{
|
3382
|
-
startAction: /* @__PURE__ */ jsxRuntime.jsx(designSystem.Button, { onClick: handleClose, variant: "tertiary", children: formatMessage({
|
3383
|
-
id: "app.components.Button.cancel",
|
3384
|
-
defaultMessage: "Cancel"
|
3385
|
-
}) }),
|
3386
|
-
endAction: /* @__PURE__ */ jsxRuntime.jsx(
|
3387
|
-
designSystem.Button,
|
3388
|
-
{
|
3389
|
-
onClick: handleConfirm,
|
3390
|
-
variant: variant === "danger-light" ? variant : "secondary",
|
3391
|
-
startIcon: variant === "danger-light" ? /* @__PURE__ */ jsxRuntime.jsx(Icons.Trash, {}) : /* @__PURE__ */ jsxRuntime.jsx(Icons.Check, {}),
|
3392
|
-
children: confirmButton ? confirmButton : formatMessage({
|
3393
|
-
id: "app.components.Button.confirm",
|
3394
|
-
defaultMessage: "Confirm"
|
3395
|
-
})
|
3396
|
-
}
|
3397
|
-
)
|
3398
|
-
}
|
3399
|
-
)
|
3400
|
-
] });
|
3401
|
-
};
|
3402
|
-
const BulkActionModal = ({
|
3403
|
-
isOpen,
|
3404
|
-
title,
|
3405
|
-
onClose,
|
3406
|
-
content: Content,
|
3407
|
-
onModalClose
|
3408
|
-
}) => {
|
3409
|
-
const id = React__namespace.useId();
|
3410
|
-
if (!isOpen) {
|
3411
|
-
return null;
|
3412
|
-
}
|
3413
|
-
const handleClose = () => {
|
3414
|
-
if (onClose) {
|
3415
|
-
onClose();
|
3416
|
-
}
|
3417
|
-
onModalClose();
|
3418
|
-
};
|
3419
|
-
return /* @__PURE__ */ jsxRuntime.jsxs(designSystem.ModalLayout, { borderRadius: "4px", overflow: "hidden", onClose: handleClose, labelledBy: id, children: [
|
3420
|
-
/* @__PURE__ */ jsxRuntime.jsx(designSystem.ModalHeader, { children: /* @__PURE__ */ jsxRuntime.jsx(designSystem.Typography, { fontWeight: "bold", textColor: "neutral800", tag: "h2", id, children: title }) }),
|
3421
|
-
/* @__PURE__ */ jsxRuntime.jsx(Content, { onClose: handleClose })
|
3422
|
-
] });
|
3423
|
-
};
|
3424
3371
|
const DeleteAction = ({ documents, model }) => {
|
3425
3372
|
const { formatMessage } = reactIntl.useIntl();
|
3426
3373
|
const { schema: contentType } = useDoc();
|
@@ -3453,6 +3400,7 @@ const DeleteAction = ({ documents, model }) => {
|
|
3453
3400
|
defaultMessage: "Confirmation"
|
3454
3401
|
}),
|
3455
3402
|
content: /* @__PURE__ */ jsxRuntime.jsxs(designSystem.Flex, { direction: "column", alignItems: "stretch", gap: 2, children: [
|
3403
|
+
/* @__PURE__ */ jsxRuntime.jsx(designSystem.Flex, { justifyContent: "center", children: /* @__PURE__ */ jsxRuntime.jsx(Icons.WarningCircle, { width: "24px", height: "24px", fill: "danger600" }) }),
|
3456
3404
|
/* @__PURE__ */ jsxRuntime.jsx(designSystem.Typography, { id: "confirm-description", textAlign: "center", children: formatMessage({
|
3457
3405
|
id: "popUpWarning.bodyMessage.contentType.delete.all",
|
3458
3406
|
defaultMessage: "Are you sure you want to delete these entries?"
|
@@ -3502,6 +3450,7 @@ const UnpublishAction = ({ documents, model }) => {
|
|
3502
3450
|
defaultMessage: "Confirmation"
|
3503
3451
|
}),
|
3504
3452
|
content: /* @__PURE__ */ jsxRuntime.jsxs(designSystem.Flex, { direction: "column", alignItems: "stretch", gap: 2, children: [
|
3453
|
+
/* @__PURE__ */ jsxRuntime.jsx(designSystem.Flex, { justifyContent: "center", children: /* @__PURE__ */ jsxRuntime.jsx(Icons.WarningCircle, { width: "24px", height: "24px", fill: "danger600" }) }),
|
3505
3454
|
/* @__PURE__ */ jsxRuntime.jsx(designSystem.Typography, { id: "confirm-description", textAlign: "center", children: formatMessage({
|
3506
3455
|
id: "popUpWarning.bodyMessage.contentType.unpublish.all",
|
3507
3456
|
defaultMessage: "Are you sure you want to unpublish these entries?"
|
@@ -3887,15 +3836,24 @@ const index = {
|
|
3887
3836
|
defaultMessage: "Content Manager"
|
3888
3837
|
},
|
3889
3838
|
permissions: [],
|
3890
|
-
Component: () => Promise.resolve().then(() => require("./layout-DEYBqgF1.js")).then((mod) => ({ default: mod.Layout })),
|
3891
3839
|
position: 1
|
3892
3840
|
});
|
3841
|
+
app.router.addRoute({
|
3842
|
+
path: "content-manager/*",
|
3843
|
+
lazy: async () => {
|
3844
|
+
const { Layout } = await Promise.resolve().then(() => require("./layout-B1ZS-usI.js"));
|
3845
|
+
return {
|
3846
|
+
Component: Layout
|
3847
|
+
};
|
3848
|
+
},
|
3849
|
+
children: routes
|
3850
|
+
});
|
3893
3851
|
app.registerPlugin(cm.config);
|
3894
3852
|
},
|
3895
3853
|
async registerTrads({ locales }) {
|
3896
3854
|
const importedTrads = await Promise.all(
|
3897
3855
|
locales.map((locale) => {
|
3898
|
-
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-
|
3856
|
+
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-uOUIxfcQ.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 }) => {
|
3899
3857
|
return {
|
3900
3858
|
data: prefixPluginTranslations(data, PLUGIN_ID),
|
3901
3859
|
locale
|
@@ -3939,7 +3897,6 @@ exports.getDisplayName = getDisplayName;
|
|
3939
3897
|
exports.getMainField = getMainField;
|
3940
3898
|
exports.getTranslation = getTranslation;
|
3941
3899
|
exports.index = index;
|
3942
|
-
exports.routes = routes;
|
3943
3900
|
exports.setInitialData = setInitialData;
|
3944
3901
|
exports.useContentTypeSchema = useContentTypeSchema;
|
3945
3902
|
exports.useDoc = useDoc;
|
@@ -3953,4 +3910,4 @@ exports.useGetAllDocumentsQuery = useGetAllDocumentsQuery;
|
|
3953
3910
|
exports.useGetContentTypeConfigurationQuery = useGetContentTypeConfigurationQuery;
|
3954
3911
|
exports.useGetInitialDataQuery = useGetInitialDataQuery;
|
3955
3912
|
exports.useUpdateContentTypeConfigurationMutation = useUpdateContentTypeConfigurationMutation;
|
3956
|
-
//# sourceMappingURL=index-
|
3913
|
+
//# sourceMappingURL=index-CAlLHIrI.js.map
|