@strapi/content-manager 5.9.0 → 5.10.1
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/admin/chunks/CardDragPreview-DwuraT0K.mjs +80 -0
- package/dist/admin/chunks/CardDragPreview-DwuraT0K.mjs.map +1 -0
- package/dist/admin/chunks/CardDragPreview-_dubYgXO.js +82 -0
- package/dist/admin/chunks/CardDragPreview-_dubYgXO.js.map +1 -0
- package/dist/admin/chunks/ComponentConfigurationPage-BN2kOtDm.mjs +277 -0
- package/dist/admin/chunks/ComponentConfigurationPage-BN2kOtDm.mjs.map +1 -0
- package/dist/admin/chunks/ComponentConfigurationPage-C5H-5L1u.js +299 -0
- package/dist/admin/chunks/ComponentConfigurationPage-C5H-5L1u.js.map +1 -0
- package/dist/admin/chunks/ComponentIcon-BZcTc4rj.mjs +153 -0
- package/dist/admin/chunks/ComponentIcon-BZcTc4rj.mjs.map +1 -0
- package/dist/admin/chunks/ComponentIcon-C-EjOUPA.js +176 -0
- package/dist/admin/chunks/ComponentIcon-C-EjOUPA.js.map +1 -0
- package/dist/admin/chunks/EditConfigurationPage-BExtZuB7.js +181 -0
- package/dist/admin/chunks/EditConfigurationPage-BExtZuB7.js.map +1 -0
- package/dist/admin/chunks/EditConfigurationPage-tMgOELQG.mjs +159 -0
- package/dist/admin/chunks/EditConfigurationPage-tMgOELQG.mjs.map +1 -0
- package/dist/admin/chunks/EditViewPage-CYe7wAXF.mjs +314 -0
- package/dist/admin/chunks/EditViewPage-CYe7wAXF.mjs.map +1 -0
- package/dist/admin/chunks/EditViewPage-DFkloeMZ.js +337 -0
- package/dist/admin/chunks/EditViewPage-DFkloeMZ.js.map +1 -0
- package/dist/admin/chunks/FieldTypeIcon-BY6MrVF4.mjs +56 -0
- package/dist/admin/chunks/FieldTypeIcon-BY6MrVF4.mjs.map +1 -0
- package/dist/admin/chunks/FieldTypeIcon-Bxh-7Jin.js +58 -0
- package/dist/admin/chunks/FieldTypeIcon-Bxh-7Jin.js.map +1 -0
- package/dist/admin/chunks/Form-DGUP3zQO.js +978 -0
- package/dist/admin/chunks/Form-DGUP3zQO.js.map +1 -0
- package/dist/admin/chunks/Form-DTO0ZIaB.mjs +955 -0
- package/dist/admin/chunks/Form-DTO0ZIaB.mjs.map +1 -0
- package/dist/admin/chunks/History-C333pgXF.mjs +1357 -0
- package/dist/admin/chunks/History-C333pgXF.mjs.map +1 -0
- package/dist/admin/chunks/History-CQznK1pG.js +1380 -0
- package/dist/admin/chunks/History-CQznK1pG.js.map +1 -0
- package/dist/admin/chunks/Input-BexkC_pp.mjs +7190 -0
- package/dist/admin/chunks/Input-BexkC_pp.mjs.map +1 -0
- package/dist/admin/chunks/Input-DLJZHw9Y.js +7221 -0
- package/dist/admin/chunks/Input-DLJZHw9Y.js.map +1 -0
- package/dist/admin/chunks/ListConfigurationPage-71I_stAM.js +819 -0
- package/dist/admin/chunks/ListConfigurationPage-71I_stAM.js.map +1 -0
- package/dist/admin/chunks/ListConfigurationPage-BX2WR7MI.mjs +796 -0
- package/dist/admin/chunks/ListConfigurationPage-BX2WR7MI.mjs.map +1 -0
- package/dist/admin/chunks/ListViewPage-BDeT3Dkk.mjs +1133 -0
- package/dist/admin/chunks/ListViewPage-BDeT3Dkk.mjs.map +1 -0
- package/dist/admin/chunks/ListViewPage-DV3heO4F.js +1155 -0
- package/dist/admin/chunks/ListViewPage-DV3heO4F.js.map +1 -0
- package/dist/admin/chunks/NoContentTypePage-9JHYpYVX.mjs +58 -0
- package/dist/admin/chunks/NoContentTypePage-9JHYpYVX.mjs.map +1 -0
- package/dist/admin/chunks/NoContentTypePage-COih9y2J.js +60 -0
- package/dist/admin/chunks/NoContentTypePage-COih9y2J.js.map +1 -0
- package/dist/admin/chunks/NoPermissionsPage-DGAwRIlN.js +39 -0
- package/dist/admin/chunks/NoPermissionsPage-DGAwRIlN.js.map +1 -0
- package/dist/admin/chunks/NoPermissionsPage-DTe9I47q.mjs +37 -0
- package/dist/admin/chunks/NoPermissionsPage-DTe9I47q.mjs.map +1 -0
- package/dist/admin/chunks/Preview-BEq0FXda.mjs +551 -0
- package/dist/admin/chunks/Preview-BEq0FXda.mjs.map +1 -0
- package/dist/admin/chunks/Preview-CXtc9yEV.js +573 -0
- package/dist/admin/chunks/Preview-CXtc9yEV.js.map +1 -0
- package/dist/admin/chunks/Relations-o7_hVGyK.js +1318 -0
- package/dist/admin/chunks/Relations-o7_hVGyK.js.map +1 -0
- package/dist/admin/chunks/Relations-qeZyLDgQ.mjs +1291 -0
- package/dist/admin/chunks/Relations-qeZyLDgQ.mjs.map +1 -0
- package/dist/admin/chunks/ar-DckYq_WK.mjs +222 -0
- package/dist/{_chunks/ar-CCEVvqGG.mjs.map → admin/chunks/ar-DckYq_WK.mjs.map} +1 -1
- package/dist/admin/chunks/ar-DeQBSsfl.js +227 -0
- package/dist/{_chunks/ru-BT3ybNny.js.map → admin/chunks/ar-DeQBSsfl.js.map} +1 -1
- package/dist/admin/chunks/ca-ClDTvatJ.js +202 -0
- package/dist/admin/chunks/ca-ClDTvatJ.js.map +1 -0
- package/dist/admin/chunks/ca-DviY7mRj.mjs +197 -0
- package/dist/admin/chunks/ca-DviY7mRj.mjs.map +1 -0
- package/dist/admin/chunks/cs-BJFxwIWj.js +126 -0
- package/dist/{_chunks/cs-CkJy6B2v.js.map → admin/chunks/cs-BJFxwIWj.js.map} +1 -1
- package/dist/admin/chunks/cs-C7OSYFQ7.mjs +122 -0
- package/dist/{_chunks/cs-CM2aBUar.mjs.map → admin/chunks/cs-C7OSYFQ7.mjs.map} +1 -1
- package/dist/admin/chunks/de-5QRlDHyR.mjs +195 -0
- package/dist/{_chunks/eu-CdALomew.mjs.map → admin/chunks/de-5QRlDHyR.mjs.map} +1 -1
- package/dist/admin/chunks/de-CbImAUA5.js +200 -0
- package/dist/{_chunks/gu-BRmF601H.js.map → admin/chunks/de-CbImAUA5.js.map} +1 -1
- package/dist/admin/chunks/en-C1CjdAtC.js +313 -0
- package/dist/{_chunks/en-BR48D_RH.js.map → admin/chunks/en-C1CjdAtC.js.map} +1 -1
- package/dist/admin/chunks/en-LfhocNG2.mjs +308 -0
- package/dist/{_chunks/en-D65uIF6Y.mjs.map → admin/chunks/en-LfhocNG2.mjs.map} +1 -1
- package/dist/admin/chunks/es-C8vLuvZL.js +197 -0
- package/dist/{_chunks/es-9K52xZIr.js.map → admin/chunks/es-C8vLuvZL.js.map} +1 -1
- package/dist/admin/chunks/es-DkoWSExG.mjs +192 -0
- package/dist/{_chunks/ja-BHqhDq4V.mjs.map → admin/chunks/es-DkoWSExG.mjs.map} +1 -1
- package/dist/admin/chunks/eu-BG1xX7HK.mjs +198 -0
- package/dist/admin/chunks/eu-BG1xX7HK.mjs.map +1 -0
- package/dist/admin/chunks/eu-BJW3AvXu.js +203 -0
- package/dist/admin/chunks/eu-BJW3AvXu.js.map +1 -0
- package/dist/admin/chunks/fr-CFdRaRVj.mjs +215 -0
- package/dist/admin/chunks/fr-CFdRaRVj.mjs.map +1 -0
- package/dist/admin/chunks/fr-gQSilC7w.js +220 -0
- package/dist/admin/chunks/fr-gQSilC7w.js.map +1 -0
- package/dist/admin/chunks/gu-D5MMMXRs.mjs +196 -0
- package/dist/admin/chunks/gu-D5MMMXRs.mjs.map +1 -0
- package/dist/admin/chunks/gu-DPU4wyx7.js +201 -0
- package/dist/{_chunks/eu-VDH-3ovk.js.map → admin/chunks/gu-DPU4wyx7.js.map} +1 -1
- package/dist/admin/chunks/hi-Dp4omeBb.js +201 -0
- package/dist/admin/chunks/hi-Dp4omeBb.js.map +1 -0
- package/dist/admin/chunks/hi-lp17SCjr.mjs +196 -0
- package/dist/admin/chunks/hi-lp17SCjr.mjs.map +1 -0
- package/dist/{_chunks/hooks-BAaaKPS_.js → admin/chunks/hooks-D-sOYd1s.js} +6 -3
- package/dist/admin/chunks/hooks-D-sOYd1s.js.map +1 -0
- package/dist/admin/chunks/hooks-DMvik5y_.mjs +7 -0
- package/dist/admin/chunks/hooks-DMvik5y_.mjs.map +1 -0
- package/dist/admin/chunks/hu-CLka1U2C.mjs +198 -0
- package/dist/admin/chunks/hu-CLka1U2C.mjs.map +1 -0
- package/dist/admin/chunks/hu-CtFJuhTd.js +203 -0
- package/dist/admin/chunks/hu-CtFJuhTd.js.map +1 -0
- package/dist/admin/chunks/id-D7V5S1rB.js +161 -0
- package/dist/{_chunks/it-DkBIs7vD.js.map → admin/chunks/id-D7V5S1rB.js.map} +1 -1
- package/dist/admin/chunks/id-USfY9m1g.mjs +156 -0
- package/dist/{_chunks/id-BtwA9WJT.mjs.map → admin/chunks/id-USfY9m1g.mjs.map} +1 -1
- package/dist/admin/chunks/index-BHimg6jW.js +5417 -0
- package/dist/admin/chunks/index-BHimg6jW.js.map +1 -0
- package/dist/admin/chunks/index-Cs6qwFQu.mjs +5351 -0
- package/dist/admin/chunks/index-Cs6qwFQu.mjs.map +1 -0
- package/dist/admin/chunks/it-BAHrwmYS.mjs +158 -0
- package/dist/{_chunks/it-BrVPqaf1.mjs.map → admin/chunks/it-BAHrwmYS.mjs.map} +1 -1
- package/dist/admin/chunks/it-CQFpa_Dc.js +163 -0
- package/dist/{_chunks/ko-woFZPmLk.js.map → admin/chunks/it-CQFpa_Dc.js.map} +1 -1
- package/dist/admin/chunks/ja-BWKmBJFT.mjs +192 -0
- package/dist/{_chunks/ko-HVQRlfUI.mjs.map → admin/chunks/ja-BWKmBJFT.mjs.map} +1 -1
- package/dist/admin/chunks/ja-jdQM-B79.js +197 -0
- package/dist/{_chunks/de-CCEmbAah.js.map → admin/chunks/ja-jdQM-B79.js.map} +1 -1
- package/dist/admin/chunks/ko-CgADGBNt.mjs +191 -0
- package/dist/{_chunks/es-D34tqjMw.mjs.map → admin/chunks/ko-CgADGBNt.mjs.map} +1 -1
- package/dist/admin/chunks/ko-k46sEyzt.js +196 -0
- package/dist/{_chunks/ja-7sfIbjxE.js.map → admin/chunks/ko-k46sEyzt.js.map} +1 -1
- package/dist/admin/chunks/layout-DStNia_P.mjs +599 -0
- package/dist/admin/chunks/layout-DStNia_P.mjs.map +1 -0
- package/dist/admin/chunks/layout-Dtahn4Ue.js +619 -0
- package/dist/admin/chunks/layout-Dtahn4Ue.js.map +1 -0
- package/dist/admin/chunks/ml-CnhCfOn_.mjs +196 -0
- package/dist/admin/chunks/ml-CnhCfOn_.mjs.map +1 -0
- package/dist/admin/chunks/ml-DqxPwODx.js +201 -0
- package/dist/admin/chunks/ml-DqxPwODx.js.map +1 -0
- package/dist/admin/chunks/ms-Bh09NFff.mjs +140 -0
- package/dist/{_chunks/ms-m_WjyWx7.mjs.map → admin/chunks/ms-Bh09NFff.mjs.map} +1 -1
- package/dist/admin/chunks/ms-CvSC0OdG.js +145 -0
- package/dist/{_chunks/ms-BuFotyP_.js.map → admin/chunks/ms-CvSC0OdG.js.map} +1 -1
- package/dist/admin/chunks/nl-BEubhS8C.js +203 -0
- package/dist/admin/chunks/nl-BEubhS8C.js.map +1 -0
- package/dist/admin/chunks/nl-C8HYflTc.mjs +198 -0
- package/dist/admin/chunks/nl-C8HYflTc.mjs.map +1 -0
- package/dist/admin/chunks/objects-C3EebVVe.js +76 -0
- package/dist/admin/chunks/objects-C3EebVVe.js.map +1 -0
- package/dist/admin/chunks/objects-wl73iEma.mjs +73 -0
- package/dist/admin/chunks/objects-wl73iEma.mjs.map +1 -0
- package/dist/admin/chunks/pl-DWhGDzmM.js +200 -0
- package/dist/{_chunks/ca-Cmk45QO6.js.map → admin/chunks/pl-DWhGDzmM.js.map} +1 -1
- package/dist/admin/chunks/pl-MFCZJZuZ.mjs +195 -0
- package/dist/{_chunks/ca-5U32ON2v.mjs.map → admin/chunks/pl-MFCZJZuZ.mjs.map} +1 -1
- package/dist/admin/chunks/pt-BR-CPtAXD-4.js +202 -0
- package/dist/{_chunks/pt-BR-BiOz37D9.js.map → admin/chunks/pt-BR-CPtAXD-4.js.map} +1 -1
- package/dist/admin/chunks/pt-BR-CcotyBGJ.mjs +197 -0
- package/dist/{_chunks/pt-BR-C71iDxnh.mjs.map → admin/chunks/pt-BR-CcotyBGJ.mjs.map} +1 -1
- package/dist/admin/chunks/pt-BoPxN80n.js +96 -0
- package/dist/admin/chunks/pt-BoPxN80n.js.map +1 -0
- package/dist/admin/chunks/pt-HbmgeiYO.mjs +93 -0
- package/dist/admin/chunks/pt-HbmgeiYO.mjs.map +1 -0
- package/dist/admin/chunks/relations-Cq8NRUto.mjs +173 -0
- package/dist/admin/chunks/relations-Cq8NRUto.mjs.map +1 -0
- package/dist/admin/chunks/relations-XOYEEqMz.js +178 -0
- package/dist/admin/chunks/relations-XOYEEqMz.js.map +1 -0
- package/dist/admin/chunks/ru-C0op0ALG.js +232 -0
- package/dist/admin/chunks/ru-C0op0ALG.js.map +1 -0
- package/dist/admin/chunks/ru-CB4BUyQp.mjs +230 -0
- package/dist/{_chunks/ru-BE6A4Exp.mjs.map → admin/chunks/ru-CB4BUyQp.mjs.map} +1 -1
- package/dist/admin/chunks/sa-B_FuPyMw.js +201 -0
- package/dist/admin/chunks/sa-B_FuPyMw.js.map +1 -0
- package/dist/admin/chunks/sa-n_aPA-pU.mjs +196 -0
- package/dist/admin/chunks/sa-n_aPA-pU.mjs.map +1 -0
- package/dist/admin/chunks/sk-D_iXML2C.js +203 -0
- package/dist/admin/chunks/sk-D_iXML2C.js.map +1 -0
- package/dist/admin/chunks/sk-tn_BDjE2.mjs +198 -0
- package/dist/admin/chunks/sk-tn_BDjE2.mjs.map +1 -0
- package/dist/admin/chunks/sv-BstBC1Yp.js +203 -0
- package/dist/admin/chunks/sv-BstBC1Yp.js.map +1 -0
- package/dist/admin/chunks/sv-cq4ZrQRd.mjs +198 -0
- package/dist/admin/chunks/sv-cq4ZrQRd.mjs.map +1 -0
- package/dist/admin/chunks/th-lXoOCqPC.js +149 -0
- package/dist/{_chunks/th-D9_GfAjc.js.map → admin/chunks/th-lXoOCqPC.js.map} +1 -1
- package/dist/admin/chunks/th-mUH7hEtc.mjs +144 -0
- package/dist/{_chunks/th-BqbI8lIT.mjs.map → admin/chunks/th-mUH7hEtc.mjs.map} +1 -1
- package/dist/admin/chunks/tr-CkS6sLIE.js +200 -0
- package/dist/admin/chunks/tr-CkS6sLIE.js.map +1 -0
- package/dist/admin/chunks/tr-Yt38daxh.mjs +195 -0
- package/dist/{_chunks/de-C72KDNOl.mjs.map → admin/chunks/tr-Yt38daxh.mjs.map} +1 -1
- package/dist/admin/chunks/uk-B24MoTVg.js +145 -0
- package/dist/{_chunks/uk-C8EiqJY7.js.map → admin/chunks/uk-B24MoTVg.js.map} +1 -1
- package/dist/admin/chunks/uk-Cpgmm7gE.mjs +140 -0
- package/dist/{_chunks/uk-CR-zDhAY.mjs.map → admin/chunks/uk-Cpgmm7gE.mjs.map} +1 -1
- package/dist/admin/chunks/useDragAndDrop-HYwNDExe.mjs +247 -0
- package/dist/admin/chunks/useDragAndDrop-HYwNDExe.mjs.map +1 -0
- package/dist/admin/chunks/useDragAndDrop-gcqEJMnO.js +271 -0
- package/dist/admin/chunks/useDragAndDrop-gcqEJMnO.js.map +1 -0
- package/dist/admin/chunks/usePrev-Bjw2dhmq.mjs +18 -0
- package/dist/admin/chunks/usePrev-Bjw2dhmq.mjs.map +1 -0
- package/dist/admin/chunks/usePrev-DIYl-IAL.js +21 -0
- package/dist/admin/chunks/usePrev-DIYl-IAL.js.map +1 -0
- package/dist/admin/chunks/vi-BGr1X_HZ.js +112 -0
- package/dist/{_chunks/vi-CJlYDheJ.js.map → admin/chunks/vi-BGr1X_HZ.js.map} +1 -1
- package/dist/admin/chunks/vi-CvBGlTjr.mjs +108 -0
- package/dist/{_chunks/vi-DUXIk_fw.mjs.map → admin/chunks/vi-CvBGlTjr.mjs.map} +1 -1
- package/dist/admin/chunks/zh-BmF-sHaT.mjs +205 -0
- package/dist/admin/chunks/zh-BmF-sHaT.mjs.map +1 -0
- package/dist/admin/chunks/zh-DwFu_Kfj.js +210 -0
- package/dist/admin/chunks/zh-DwFu_Kfj.js.map +1 -0
- package/dist/admin/chunks/zh-Hans-CI0HKio3.mjs +934 -0
- package/dist/{_chunks/zh-Hans-BPQcRIyH.mjs.map → admin/chunks/zh-Hans-CI0HKio3.mjs.map} +1 -1
- package/dist/admin/chunks/zh-Hans-JVK9x7xr.js +953 -0
- package/dist/{_chunks/zh-Hans-9kOncHGw.js.map → admin/chunks/zh-Hans-JVK9x7xr.js.map} +1 -1
- package/dist/admin/index.js +24 -4
- package/dist/admin/index.js.map +1 -1
- package/dist/admin/index.mjs +17 -13
- package/dist/admin/index.mjs.map +1 -1
- package/dist/admin/src/history/services/historyVersion.d.ts +1 -1
- package/dist/admin/src/hooks/useDocument.d.ts +2 -2
- package/dist/admin/src/index.d.ts +1 -0
- package/dist/admin/src/pages/EditView/components/EditorToolbarObserver.d.ts +11 -0
- package/dist/admin/src/pages/EditView/components/FormInputs/BlocksInput/Blocks/Code.d.ts +49 -1
- package/dist/admin/src/pages/EditView/components/FormInputs/Relations.d.ts +2 -1
- package/dist/admin/src/pages/EditView/components/FormInputs/Wysiwyg/WysiwygNav.d.ts +1 -2
- package/dist/admin/src/pages/EditView/components/FormLayout.d.ts +2 -1
- package/dist/admin/src/preview/components/PreviewContent.d.ts +2 -1
- package/dist/admin/src/preview/components/PreviewHeader.d.ts +2 -1
- package/dist/admin/src/preview/index.d.ts +2 -3
- package/dist/admin/src/preview/pages/Preview.d.ts +2 -0
- package/dist/server/index.js +5459 -4387
- package/dist/server/index.js.map +1 -1
- package/dist/server/index.mjs +5446 -4372
- package/dist/server/index.mjs.map +1 -1
- package/dist/server/src/controllers/utils/metadata.d.ts +1 -1
- package/dist/server/src/controllers/utils/metadata.d.ts.map +1 -1
- package/dist/server/src/history/services/utils.d.ts.map +1 -1
- package/dist/server/src/services/utils/count.d.ts +1 -1
- package/dist/server/src/services/utils/count.d.ts.map +1 -1
- package/dist/server/src/services/utils/populate.d.ts +1 -1
- package/dist/server/src/services/utils/populate.d.ts.map +1 -1
- package/dist/shared/contracts/collection-types.d.ts +0 -1
- package/dist/shared/contracts/components.d.ts +0 -1
- package/dist/shared/contracts/content-types.d.ts +0 -1
- package/dist/shared/contracts/history-versions.d.ts +0 -1
- package/dist/shared/contracts/index.d.ts +0 -1
- package/dist/shared/contracts/init.d.ts +0 -1
- package/dist/shared/contracts/preview.d.ts +0 -1
- package/dist/shared/contracts/relations.d.ts +1 -2
- package/dist/shared/contracts/relations.d.ts.map +1 -1
- package/dist/shared/contracts/review-workflows.d.ts +0 -1
- package/dist/shared/contracts/single-types.d.ts +0 -1
- package/dist/shared/contracts/uid.d.ts +0 -1
- package/dist/shared/index.d.ts +0 -1
- package/dist/shared/index.js +35 -24
- package/dist/shared/index.js.map +1 -1
- package/dist/shared/index.mjs +34 -25
- package/dist/shared/index.mjs.map +1 -1
- package/package.json +15 -12
- package/dist/_chunks/CardDragPreview-C0QyJgRA.js +0 -69
- package/dist/_chunks/CardDragPreview-C0QyJgRA.js.map +0 -1
- package/dist/_chunks/CardDragPreview-DOxamsuj.mjs +0 -70
- package/dist/_chunks/CardDragPreview-DOxamsuj.mjs.map +0 -1
- package/dist/_chunks/ComponentConfigurationPage-9_4yUE9L.mjs +0 -236
- package/dist/_chunks/ComponentConfigurationPage-9_4yUE9L.mjs.map +0 -1
- package/dist/_chunks/ComponentConfigurationPage-DBSh-kET.js +0 -254
- package/dist/_chunks/ComponentConfigurationPage-DBSh-kET.js.map +0 -1
- package/dist/_chunks/ComponentIcon-CRbtQEUV.js +0 -175
- package/dist/_chunks/ComponentIcon-CRbtQEUV.js.map +0 -1
- package/dist/_chunks/ComponentIcon-u4bIXTFY.mjs +0 -157
- package/dist/_chunks/ComponentIcon-u4bIXTFY.mjs.map +0 -1
- package/dist/_chunks/EditConfigurationPage-Bl_U2JgH.js +0 -150
- package/dist/_chunks/EditConfigurationPage-Bl_U2JgH.js.map +0 -1
- package/dist/_chunks/EditConfigurationPage-COe6hjPC.mjs +0 -132
- package/dist/_chunks/EditConfigurationPage-COe6hjPC.mjs.map +0 -1
- package/dist/_chunks/EditViewPage-D4yFJET6.js +0 -209
- package/dist/_chunks/EditViewPage-D4yFJET6.js.map +0 -1
- package/dist/_chunks/EditViewPage-DrmVmYN0.mjs +0 -191
- package/dist/_chunks/EditViewPage-DrmVmYN0.mjs.map +0 -1
- package/dist/_chunks/FieldTypeIcon-CMlNO8PE.mjs +0 -50
- package/dist/_chunks/FieldTypeIcon-CMlNO8PE.mjs.map +0 -1
- package/dist/_chunks/FieldTypeIcon-Dnwq_IRF.js +0 -49
- package/dist/_chunks/FieldTypeIcon-Dnwq_IRF.js.map +0 -1
- package/dist/_chunks/Form-C4rSaGsz.js +0 -778
- package/dist/_chunks/Form-C4rSaGsz.js.map +0 -1
- package/dist/_chunks/Form-DamaxNpG.mjs +0 -758
- package/dist/_chunks/Form-DamaxNpG.mjs.map +0 -1
- package/dist/_chunks/History-D1PreDSY.mjs +0 -999
- package/dist/_chunks/History-D1PreDSY.mjs.map +0 -1
- package/dist/_chunks/History-DTm8UCCQ.js +0 -1019
- package/dist/_chunks/History-DTm8UCCQ.js.map +0 -1
- package/dist/_chunks/Input-B7sapvBG.js +0 -5617
- package/dist/_chunks/Input-B7sapvBG.js.map +0 -1
- package/dist/_chunks/Input-CZ1YvjHR.mjs +0 -5585
- package/dist/_chunks/Input-CZ1YvjHR.mjs.map +0 -1
- package/dist/_chunks/ListConfigurationPage-Bbi32isk.mjs +0 -633
- package/dist/_chunks/ListConfigurationPage-Bbi32isk.mjs.map +0 -1
- package/dist/_chunks/ListConfigurationPage-ysFMjKI3.js +0 -652
- package/dist/_chunks/ListConfigurationPage-ysFMjKI3.js.map +0 -1
- package/dist/_chunks/ListViewPage-Bud_jBDQ.mjs +0 -854
- package/dist/_chunks/ListViewPage-Bud_jBDQ.mjs.map +0 -1
- package/dist/_chunks/ListViewPage-DTuuxU3n.js +0 -877
- package/dist/_chunks/ListViewPage-DTuuxU3n.js.map +0 -1
- package/dist/_chunks/NoContentTypePage-CL7VVeYs.js +0 -51
- package/dist/_chunks/NoContentTypePage-CL7VVeYs.js.map +0 -1
- package/dist/_chunks/NoContentTypePage-DVhkugsf.mjs +0 -51
- package/dist/_chunks/NoContentTypePage-DVhkugsf.mjs.map +0 -1
- package/dist/_chunks/NoPermissionsPage-CMdM-dCo.mjs +0 -23
- package/dist/_chunks/NoPermissionsPage-CMdM-dCo.mjs.map +0 -1
- package/dist/_chunks/NoPermissionsPage-v7I599vC.js +0 -23
- package/dist/_chunks/NoPermissionsPage-v7I599vC.js.map +0 -1
- package/dist/_chunks/Preview-BNuU0SuQ.mjs +0 -287
- package/dist/_chunks/Preview-BNuU0SuQ.mjs.map +0 -1
- package/dist/_chunks/Preview-Cxq-uI6D.js +0 -305
- package/dist/_chunks/Preview-Cxq-uI6D.js.map +0 -1
- package/dist/_chunks/Relations-C2Ahkrdg.mjs +0 -728
- package/dist/_chunks/Relations-C2Ahkrdg.mjs.map +0 -1
- package/dist/_chunks/Relations-CWS79QQn.js +0 -747
- package/dist/_chunks/Relations-CWS79QQn.js.map +0 -1
- package/dist/_chunks/ar-BUUWXIYu.js +0 -226
- package/dist/_chunks/ar-BUUWXIYu.js.map +0 -1
- package/dist/_chunks/ar-CCEVvqGG.mjs +0 -226
- package/dist/_chunks/ca-5U32ON2v.mjs +0 -201
- package/dist/_chunks/ca-Cmk45QO6.js +0 -201
- package/dist/_chunks/cs-CM2aBUar.mjs +0 -125
- package/dist/_chunks/cs-CkJy6B2v.js +0 -125
- package/dist/_chunks/de-C72KDNOl.mjs +0 -199
- package/dist/_chunks/de-CCEmbAah.js +0 -199
- package/dist/_chunks/en-BR48D_RH.js +0 -312
- package/dist/_chunks/en-D65uIF6Y.mjs +0 -312
- package/dist/_chunks/es-9K52xZIr.js +0 -196
- package/dist/_chunks/es-D34tqjMw.mjs +0 -196
- package/dist/_chunks/eu-CdALomew.mjs +0 -202
- package/dist/_chunks/eu-VDH-3ovk.js +0 -202
- package/dist/_chunks/fr-C43IbhA_.js +0 -219
- package/dist/_chunks/fr-C43IbhA_.js.map +0 -1
- package/dist/_chunks/fr-DBseuRuB.mjs +0 -219
- package/dist/_chunks/fr-DBseuRuB.mjs.map +0 -1
- package/dist/_chunks/gu-BRmF601H.js +0 -200
- package/dist/_chunks/gu-CNpaMDpH.mjs +0 -200
- package/dist/_chunks/gu-CNpaMDpH.mjs.map +0 -1
- package/dist/_chunks/hi-CCJBptSq.js +0 -200
- package/dist/_chunks/hi-CCJBptSq.js.map +0 -1
- package/dist/_chunks/hi-Dwvd04m3.mjs +0 -200
- package/dist/_chunks/hi-Dwvd04m3.mjs.map +0 -1
- package/dist/_chunks/hooks-BAaaKPS_.js.map +0 -1
- package/dist/_chunks/hooks-E5u1mcgM.mjs +0 -8
- package/dist/_chunks/hooks-E5u1mcgM.mjs.map +0 -1
- package/dist/_chunks/hu-CeYvaaO0.mjs +0 -202
- package/dist/_chunks/hu-CeYvaaO0.mjs.map +0 -1
- package/dist/_chunks/hu-sNV_yLYy.js +0 -202
- package/dist/_chunks/hu-sNV_yLYy.js.map +0 -1
- package/dist/_chunks/id-B5Ser98A.js +0 -160
- package/dist/_chunks/id-B5Ser98A.js.map +0 -1
- package/dist/_chunks/id-BtwA9WJT.mjs +0 -160
- package/dist/_chunks/index-DQsvBb_N.js +0 -4500
- package/dist/_chunks/index-DQsvBb_N.js.map +0 -1
- package/dist/_chunks/index-ZKrsjv-2.mjs +0 -4481
- package/dist/_chunks/index-ZKrsjv-2.mjs.map +0 -1
- package/dist/_chunks/it-BrVPqaf1.mjs +0 -162
- package/dist/_chunks/it-DkBIs7vD.js +0 -162
- package/dist/_chunks/ja-7sfIbjxE.js +0 -196
- package/dist/_chunks/ja-BHqhDq4V.mjs +0 -196
- package/dist/_chunks/ko-HVQRlfUI.mjs +0 -195
- package/dist/_chunks/ko-woFZPmLk.js +0 -195
- package/dist/_chunks/layout-Cl0NhlQB.js +0 -488
- package/dist/_chunks/layout-Cl0NhlQB.js.map +0 -1
- package/dist/_chunks/layout-fQk1rMk9.mjs +0 -471
- package/dist/_chunks/layout-fQk1rMk9.mjs.map +0 -1
- package/dist/_chunks/ml-BihZwQit.mjs +0 -200
- package/dist/_chunks/ml-BihZwQit.mjs.map +0 -1
- package/dist/_chunks/ml-C2W8N8k1.js +0 -200
- package/dist/_chunks/ml-C2W8N8k1.js.map +0 -1
- package/dist/_chunks/ms-BuFotyP_.js +0 -144
- package/dist/_chunks/ms-m_WjyWx7.mjs +0 -144
- package/dist/_chunks/nl-D4R9gHx5.mjs +0 -202
- package/dist/_chunks/nl-D4R9gHx5.mjs.map +0 -1
- package/dist/_chunks/nl-bbEOHChV.js +0 -202
- package/dist/_chunks/nl-bbEOHChV.js.map +0 -1
- package/dist/_chunks/objects-BcXOv6_9.js +0 -47
- package/dist/_chunks/objects-BcXOv6_9.js.map +0 -1
- package/dist/_chunks/objects-D6yBsdmx.mjs +0 -45
- package/dist/_chunks/objects-D6yBsdmx.mjs.map +0 -1
- package/dist/_chunks/pl-sbx9mSt_.mjs +0 -199
- package/dist/_chunks/pl-sbx9mSt_.mjs.map +0 -1
- package/dist/_chunks/pl-uzwG-hk7.js +0 -199
- package/dist/_chunks/pl-uzwG-hk7.js.map +0 -1
- package/dist/_chunks/pt-BR-BiOz37D9.js +0 -201
- package/dist/_chunks/pt-BR-C71iDxnh.mjs +0 -201
- package/dist/_chunks/pt-BsaFvS8-.mjs +0 -95
- package/dist/_chunks/pt-BsaFvS8-.mjs.map +0 -1
- package/dist/_chunks/pt-CeXQuq50.js +0 -95
- package/dist/_chunks/pt-CeXQuq50.js.map +0 -1
- package/dist/_chunks/relations-BRfBxVbX.js +0 -133
- package/dist/_chunks/relations-BRfBxVbX.js.map +0 -1
- package/dist/_chunks/relations-BakOFl_1.mjs +0 -134
- package/dist/_chunks/relations-BakOFl_1.mjs.map +0 -1
- package/dist/_chunks/ru-BE6A4Exp.mjs +0 -231
- package/dist/_chunks/ru-BT3ybNny.js +0 -231
- package/dist/_chunks/sa-CcvkYInH.js +0 -200
- package/dist/_chunks/sa-CcvkYInH.js.map +0 -1
- package/dist/_chunks/sa-Dag0k-Z8.mjs +0 -200
- package/dist/_chunks/sa-Dag0k-Z8.mjs.map +0 -1
- package/dist/_chunks/sk-BFg-R8qJ.mjs +0 -202
- package/dist/_chunks/sk-BFg-R8qJ.mjs.map +0 -1
- package/dist/_chunks/sk-CvY09Xjv.js +0 -202
- package/dist/_chunks/sk-CvY09Xjv.js.map +0 -1
- package/dist/_chunks/sv-CUnfWGsh.mjs +0 -202
- package/dist/_chunks/sv-CUnfWGsh.mjs.map +0 -1
- package/dist/_chunks/sv-MYDuzgvT.js +0 -202
- package/dist/_chunks/sv-MYDuzgvT.js.map +0 -1
- package/dist/_chunks/th-BqbI8lIT.mjs +0 -148
- package/dist/_chunks/th-D9_GfAjc.js +0 -148
- package/dist/_chunks/tr-CgeK3wJM.mjs +0 -199
- package/dist/_chunks/tr-CgeK3wJM.mjs.map +0 -1
- package/dist/_chunks/tr-D9UH-O_R.js +0 -199
- package/dist/_chunks/tr-D9UH-O_R.js.map +0 -1
- package/dist/_chunks/uk-C8EiqJY7.js +0 -144
- package/dist/_chunks/uk-CR-zDhAY.mjs +0 -144
- package/dist/_chunks/useDragAndDrop-BMtgCYzL.js +0 -245
- package/dist/_chunks/useDragAndDrop-BMtgCYzL.js.map +0 -1
- package/dist/_chunks/useDragAndDrop-DJ6jqvZN.mjs +0 -228
- package/dist/_chunks/useDragAndDrop-DJ6jqvZN.mjs.map +0 -1
- package/dist/_chunks/usePrev-CZGy2Vjf.mjs +0 -29
- package/dist/_chunks/usePrev-CZGy2Vjf.mjs.map +0 -1
- package/dist/_chunks/usePrev-D5J_2fEu.js +0 -28
- package/dist/_chunks/usePrev-D5J_2fEu.js.map +0 -1
- package/dist/_chunks/vi-CJlYDheJ.js +0 -111
- package/dist/_chunks/vi-DUXIk_fw.mjs +0 -111
- package/dist/_chunks/zh-BWZspA60.mjs +0 -209
- package/dist/_chunks/zh-BWZspA60.mjs.map +0 -1
- package/dist/_chunks/zh-CQQfszqR.js +0 -209
- package/dist/_chunks/zh-CQQfszqR.js.map +0 -1
- package/dist/_chunks/zh-Hans-9kOncHGw.js +0 -952
- package/dist/_chunks/zh-Hans-BPQcRIyH.mjs +0 -952
- package/dist/admin/src/pages/EditView/components/FormInputs/BlocksInput/Blocks/utils/prismLanguages.d.ts +0 -49
@@ -0,0 +1,1380 @@
|
|
1
|
+
'use strict';
|
2
|
+
|
3
|
+
var jsxRuntime = require('react/jsx-runtime');
|
4
|
+
var React = require('react');
|
5
|
+
var strapiAdmin = require('@strapi/admin/strapi-admin');
|
6
|
+
var designSystem = require('@strapi/design-system');
|
7
|
+
var qs = require('qs');
|
8
|
+
var reactIntl = require('react-intl');
|
9
|
+
var reactRouterDom = require('react-router-dom');
|
10
|
+
var index = require('./index-BHimg6jW.js');
|
11
|
+
var pipe = require('lodash/fp/pipe');
|
12
|
+
var hooks = require('./hooks-D-sOYd1s.js');
|
13
|
+
var Icons = require('@strapi/icons');
|
14
|
+
var styledComponents = require('styled-components');
|
15
|
+
var Input = require('./Input-DLJZHw9Y.js');
|
16
|
+
var relations = require('./relations-XOYEEqMz.js');
|
17
|
+
require('lodash/fp/mapValues');
|
18
|
+
require('yup');
|
19
|
+
require('fractional-indexing');
|
20
|
+
require('date-fns');
|
21
|
+
require('@reduxjs/toolkit');
|
22
|
+
require('prismjs');
|
23
|
+
require('react-redux');
|
24
|
+
require('slate');
|
25
|
+
require('slate-history');
|
26
|
+
require('slate-react');
|
27
|
+
require('prismjs/themes/prism-solarizedlight.css');
|
28
|
+
require('prismjs/components/prism-asmatmel');
|
29
|
+
require('prismjs/components/prism-bash');
|
30
|
+
require('prismjs/components/prism-basic');
|
31
|
+
require('prismjs/components/prism-c');
|
32
|
+
require('prismjs/components/prism-clojure');
|
33
|
+
require('prismjs/components/prism-cobol');
|
34
|
+
require('prismjs/components/prism-cpp');
|
35
|
+
require('prismjs/components/prism-csharp');
|
36
|
+
require('prismjs/components/prism-dart');
|
37
|
+
require('prismjs/components/prism-docker');
|
38
|
+
require('prismjs/components/prism-elixir');
|
39
|
+
require('prismjs/components/prism-erlang');
|
40
|
+
require('prismjs/components/prism-fortran');
|
41
|
+
require('prismjs/components/prism-fsharp');
|
42
|
+
require('prismjs/components/prism-go');
|
43
|
+
require('prismjs/components/prism-graphql');
|
44
|
+
require('prismjs/components/prism-groovy');
|
45
|
+
require('prismjs/components/prism-haskell');
|
46
|
+
require('prismjs/components/prism-haxe');
|
47
|
+
require('prismjs/components/prism-ini');
|
48
|
+
require('prismjs/components/prism-java');
|
49
|
+
require('prismjs/components/prism-javascript');
|
50
|
+
require('prismjs/components/prism-jsx');
|
51
|
+
require('prismjs/components/prism-json');
|
52
|
+
require('prismjs/components/prism-julia');
|
53
|
+
require('prismjs/components/prism-kotlin');
|
54
|
+
require('prismjs/components/prism-latex');
|
55
|
+
require('prismjs/components/prism-lua');
|
56
|
+
require('prismjs/components/prism-markdown');
|
57
|
+
require('prismjs/components/prism-matlab');
|
58
|
+
require('prismjs/components/prism-makefile');
|
59
|
+
require('prismjs/components/prism-objectivec');
|
60
|
+
require('prismjs/components/prism-perl');
|
61
|
+
require('prismjs/components/prism-php');
|
62
|
+
require('prismjs/components/prism-powershell');
|
63
|
+
require('prismjs/components/prism-python');
|
64
|
+
require('prismjs/components/prism-r');
|
65
|
+
require('prismjs/components/prism-ruby');
|
66
|
+
require('prismjs/components/prism-rust');
|
67
|
+
require('prismjs/components/prism-sas');
|
68
|
+
require('prismjs/components/prism-scala');
|
69
|
+
require('prismjs/components/prism-scheme');
|
70
|
+
require('prismjs/components/prism-sql');
|
71
|
+
require('prismjs/components/prism-stata');
|
72
|
+
require('prismjs/components/prism-swift');
|
73
|
+
require('prismjs/components/prism-typescript');
|
74
|
+
require('prismjs/components/prism-tsx');
|
75
|
+
require('prismjs/components/prism-vbnet');
|
76
|
+
require('prismjs/components/prism-yaml');
|
77
|
+
require('./usePrev-DIYl-IAL.js');
|
78
|
+
require('./useDragAndDrop-gcqEJMnO.js');
|
79
|
+
require('react-dnd');
|
80
|
+
require('@radix-ui/react-toolbar');
|
81
|
+
require('react-dnd-html5-backend');
|
82
|
+
require('./objects-C3EebVVe.js');
|
83
|
+
require('lodash/clone');
|
84
|
+
require('lodash/toPath');
|
85
|
+
require('./Relations-o7_hVGyK.js');
|
86
|
+
require('react-window');
|
87
|
+
require('./ComponentIcon-C-EjOUPA.js');
|
88
|
+
require('@strapi/icons/symbols');
|
89
|
+
require('codemirror5');
|
90
|
+
require('sanitize-html');
|
91
|
+
require('highlight.js');
|
92
|
+
require('markdown-it');
|
93
|
+
require('markdown-it-abbr');
|
94
|
+
require('markdown-it-container');
|
95
|
+
require('markdown-it-deflist');
|
96
|
+
require('markdown-it-emoji');
|
97
|
+
require('markdown-it-footnote');
|
98
|
+
require('markdown-it-ins');
|
99
|
+
require('markdown-it-mark');
|
100
|
+
require('markdown-it-sub');
|
101
|
+
require('markdown-it-sup');
|
102
|
+
require('highlight.js/styles/solarized-dark.css');
|
103
|
+
require('codemirror5/addon/display/placeholder');
|
104
|
+
|
105
|
+
function _interopNamespaceDefault(e) {
|
106
|
+
var n = Object.create(null);
|
107
|
+
if (e) {
|
108
|
+
Object.keys(e).forEach(function (k) {
|
109
|
+
if (k !== 'default') {
|
110
|
+
var d = Object.getOwnPropertyDescriptor(e, k);
|
111
|
+
Object.defineProperty(n, k, d.get ? d : {
|
112
|
+
enumerable: true,
|
113
|
+
get: function () { return e[k]; }
|
114
|
+
});
|
115
|
+
}
|
116
|
+
});
|
117
|
+
}
|
118
|
+
n.default = e;
|
119
|
+
return Object.freeze(n);
|
120
|
+
}
|
121
|
+
|
122
|
+
var React__namespace = /*#__PURE__*/_interopNamespaceDefault(React);
|
123
|
+
|
124
|
+
const StyledAlert = styledComponents.styled(designSystem.Alert).attrs({
|
125
|
+
closeLabel: 'Close',
|
126
|
+
onClose: ()=>{},
|
127
|
+
shadow: 'none'
|
128
|
+
})`
|
129
|
+
button {
|
130
|
+
display: none;
|
131
|
+
}
|
132
|
+
`;
|
133
|
+
/* -------------------------------------------------------------------------------------------------
|
134
|
+
* CustomRelationInput
|
135
|
+
* -----------------------------------------------------------------------------------------------*/ const LinkEllipsis = styledComponents.styled(designSystem.Link)`
|
136
|
+
display: block;
|
137
|
+
|
138
|
+
& > span {
|
139
|
+
white-space: nowrap;
|
140
|
+
overflow: hidden;
|
141
|
+
text-overflow: ellipsis;
|
142
|
+
display: block;
|
143
|
+
}
|
144
|
+
`;
|
145
|
+
const CustomRelationInput = (props)=>{
|
146
|
+
const { formatMessage } = reactIntl.useIntl();
|
147
|
+
const field = strapiAdmin.useField(props.name);
|
148
|
+
/**
|
149
|
+
* Ideally the server would return the correct shape, however, for admin user relations
|
150
|
+
* it sanitizes everything out when it finds an object for the relation value.
|
151
|
+
*/ let formattedFieldValue;
|
152
|
+
if (field) {
|
153
|
+
formattedFieldValue = Array.isArray(field.value) ? {
|
154
|
+
results: field.value,
|
155
|
+
meta: {
|
156
|
+
missingCount: 0
|
157
|
+
}
|
158
|
+
} : field.value;
|
159
|
+
}
|
160
|
+
if (!formattedFieldValue || formattedFieldValue.results.length === 0 && formattedFieldValue.meta.missingCount === 0) {
|
161
|
+
return /*#__PURE__*/ jsxRuntime.jsxs(jsxRuntime.Fragment, {
|
162
|
+
children: [
|
163
|
+
/*#__PURE__*/ jsxRuntime.jsx(designSystem.Field.Label, {
|
164
|
+
action: props.labelAction,
|
165
|
+
children: props.label
|
166
|
+
}),
|
167
|
+
/*#__PURE__*/ jsxRuntime.jsx(designSystem.Box, {
|
168
|
+
marginTop: 1,
|
169
|
+
children: /*#__PURE__*/ jsxRuntime.jsx(StyledAlert, {
|
170
|
+
variant: "default",
|
171
|
+
children: formatMessage({
|
172
|
+
id: 'content-manager.history.content.no-relations',
|
173
|
+
defaultMessage: 'No relations.'
|
174
|
+
})
|
175
|
+
})
|
176
|
+
})
|
177
|
+
]
|
178
|
+
});
|
179
|
+
}
|
180
|
+
const { results, meta } = formattedFieldValue;
|
181
|
+
return /*#__PURE__*/ jsxRuntime.jsxs(designSystem.Box, {
|
182
|
+
children: [
|
183
|
+
/*#__PURE__*/ jsxRuntime.jsx(designSystem.Field.Label, {
|
184
|
+
children: props.label
|
185
|
+
}),
|
186
|
+
results.length > 0 && /*#__PURE__*/ jsxRuntime.jsx(designSystem.Flex, {
|
187
|
+
direction: "column",
|
188
|
+
gap: 2,
|
189
|
+
marginTop: 1,
|
190
|
+
alignItems: "stretch",
|
191
|
+
children: results.map((relationData)=>{
|
192
|
+
// @ts-expect-error - targetModel does exist on the attribute. But it's not typed.
|
193
|
+
const { targetModel } = props.attribute;
|
194
|
+
const href = `../${index.COLLECTION_TYPES}/${targetModel}/${relationData.documentId}`;
|
195
|
+
const label = relations.getRelationLabel(relationData, props.mainField);
|
196
|
+
const isAdminUserRelation = targetModel === 'admin::user';
|
197
|
+
return /*#__PURE__*/ jsxRuntime.jsxs(designSystem.Flex, {
|
198
|
+
paddingTop: 2,
|
199
|
+
paddingBottom: 2,
|
200
|
+
paddingLeft: 4,
|
201
|
+
paddingRight: 4,
|
202
|
+
hasRadius: true,
|
203
|
+
borderColor: "neutral200",
|
204
|
+
background: "neutral150",
|
205
|
+
justifyContent: "space-between",
|
206
|
+
children: [
|
207
|
+
/*#__PURE__*/ jsxRuntime.jsx(designSystem.Box, {
|
208
|
+
minWidth: 0,
|
209
|
+
paddingTop: 1,
|
210
|
+
paddingBottom: 1,
|
211
|
+
paddingRight: 4,
|
212
|
+
children: /*#__PURE__*/ jsxRuntime.jsx(designSystem.Tooltip, {
|
213
|
+
label: label,
|
214
|
+
children: isAdminUserRelation ? /*#__PURE__*/ jsxRuntime.jsx(designSystem.Typography, {
|
215
|
+
children: label
|
216
|
+
}) : /*#__PURE__*/ jsxRuntime.jsx(LinkEllipsis, {
|
217
|
+
tag: reactRouterDom.NavLink,
|
218
|
+
to: href,
|
219
|
+
children: label
|
220
|
+
})
|
221
|
+
})
|
222
|
+
}),
|
223
|
+
/*#__PURE__*/ jsxRuntime.jsx(index.DocumentStatus, {
|
224
|
+
status: relationData.status
|
225
|
+
})
|
226
|
+
]
|
227
|
+
}, relationData.documentId ?? relationData.id);
|
228
|
+
})
|
229
|
+
}),
|
230
|
+
meta.missingCount > 0 && /* @ts-expect-error – we dont need closeLabel */ /*#__PURE__*/ jsxRuntime.jsx(StyledAlert, {
|
231
|
+
marginTop: 1,
|
232
|
+
variant: "warning",
|
233
|
+
title: formatMessage({
|
234
|
+
id: 'content-manager.history.content.missing-relations.title',
|
235
|
+
defaultMessage: '{number, plural, =1 {Missing relation} other {{number} missing relations}}'
|
236
|
+
}, {
|
237
|
+
number: meta.missingCount
|
238
|
+
}),
|
239
|
+
children: formatMessage({
|
240
|
+
id: 'content-manager.history.content.missing-relations.message',
|
241
|
+
defaultMessage: "{number, plural, =1 {It has} other {They have}} been deleted and can't be restored."
|
242
|
+
}, {
|
243
|
+
number: meta.missingCount
|
244
|
+
})
|
245
|
+
})
|
246
|
+
]
|
247
|
+
});
|
248
|
+
};
|
249
|
+
/* -------------------------------------------------------------------------------------------------
|
250
|
+
* CustomMediaInput
|
251
|
+
* -----------------------------------------------------------------------------------------------*/ // Create an object with value at key path (i.e. 'a.b.c')
|
252
|
+
const createInitialValuesForPath = (keyPath, value)=>{
|
253
|
+
const keys = keyPath.split('.');
|
254
|
+
// The root level object
|
255
|
+
const root = {};
|
256
|
+
// Make the first node the root
|
257
|
+
let node = root;
|
258
|
+
keys.forEach((key, index)=>{
|
259
|
+
// Skip prototype pollution keys
|
260
|
+
if (key === '__proto__' || key === 'constructor') return;
|
261
|
+
// If it's the last key, set the node value
|
262
|
+
if (index === keys.length - 1) {
|
263
|
+
node[key] = value;
|
264
|
+
} else {
|
265
|
+
// Ensure the key exists and is an object
|
266
|
+
node[key] = node[key] || {};
|
267
|
+
}
|
268
|
+
// Traverse down the tree
|
269
|
+
node = node[key];
|
270
|
+
});
|
271
|
+
return root;
|
272
|
+
};
|
273
|
+
const CustomMediaInput = (props)=>{
|
274
|
+
const { value } = strapiAdmin.useField(props.name);
|
275
|
+
const results = value?.results ?? [];
|
276
|
+
const meta = value?.meta ?? {
|
277
|
+
missingCount: 0
|
278
|
+
};
|
279
|
+
const { formatMessage } = reactIntl.useIntl();
|
280
|
+
const fields = strapiAdmin.useStrapiApp('CustomMediaInput', (state)=>state.fields);
|
281
|
+
const MediaLibrary = fields.media;
|
282
|
+
return /*#__PURE__*/ jsxRuntime.jsxs(designSystem.Flex, {
|
283
|
+
direction: "column",
|
284
|
+
gap: 2,
|
285
|
+
alignItems: "stretch",
|
286
|
+
children: [
|
287
|
+
/*#__PURE__*/ jsxRuntime.jsx(strapiAdmin.Form, {
|
288
|
+
method: "PUT",
|
289
|
+
disabled: true,
|
290
|
+
initialValues: createInitialValuesForPath(props.name, results),
|
291
|
+
children: /*#__PURE__*/ jsxRuntime.jsx(MediaLibrary, {
|
292
|
+
...props,
|
293
|
+
disabled: true,
|
294
|
+
multiple: results.length > 1
|
295
|
+
})
|
296
|
+
}),
|
297
|
+
meta.missingCount > 0 && /*#__PURE__*/ jsxRuntime.jsx(StyledAlert, {
|
298
|
+
variant: "warning",
|
299
|
+
closeLabel: "Close",
|
300
|
+
onClose: ()=>{},
|
301
|
+
title: formatMessage({
|
302
|
+
id: 'content-manager.history.content.missing-assets.title',
|
303
|
+
defaultMessage: '{number, plural, =1 {Missing asset} other {{number} missing assets}}'
|
304
|
+
}, {
|
305
|
+
number: meta.missingCount
|
306
|
+
}),
|
307
|
+
children: formatMessage({
|
308
|
+
id: 'content-manager.history.content.missing-assets.message',
|
309
|
+
defaultMessage: "{number, plural, =1 {It has} other {They have}} been deleted in the Media Library and can't be restored."
|
310
|
+
}, {
|
311
|
+
number: meta.missingCount
|
312
|
+
})
|
313
|
+
})
|
314
|
+
]
|
315
|
+
});
|
316
|
+
};
|
317
|
+
/**
|
318
|
+
* Checks if the i18n plugin added a label action to the field and modifies it
|
319
|
+
* to adapt the wording for the history page.
|
320
|
+
*/ const getLabelAction = (labelAction)=>{
|
321
|
+
if (!/*#__PURE__*/ React__namespace.isValidElement(labelAction)) {
|
322
|
+
return labelAction;
|
323
|
+
}
|
324
|
+
// TODO: find a better way to do this rather than access internals
|
325
|
+
const labelActionTitleId = labelAction.props.title.id;
|
326
|
+
if (labelActionTitleId === 'i18n.Field.localized') {
|
327
|
+
return /*#__PURE__*/ React__namespace.cloneElement(labelAction, {
|
328
|
+
...labelAction.props,
|
329
|
+
title: {
|
330
|
+
id: 'history.content.localized',
|
331
|
+
defaultMessage: 'This value is specific to this locale. If you restore this version, the content will not be replaced for other locales.'
|
332
|
+
}
|
333
|
+
});
|
334
|
+
}
|
335
|
+
if (labelActionTitleId === 'i18n.Field.not-localized') {
|
336
|
+
return /*#__PURE__*/ React__namespace.cloneElement(labelAction, {
|
337
|
+
...labelAction.props,
|
338
|
+
title: {
|
339
|
+
id: 'history.content.not-localized',
|
340
|
+
defaultMessage: 'This value is common to all locales. If you restore this version and save the changes, the content will be replaced for all locales.'
|
341
|
+
}
|
342
|
+
});
|
343
|
+
}
|
344
|
+
// Label action is unrelated to i18n, don't touch it.
|
345
|
+
return labelAction;
|
346
|
+
};
|
347
|
+
/**
|
348
|
+
* @internal
|
349
|
+
*
|
350
|
+
* @description An abstraction around the regular form input renderer designed specifically
|
351
|
+
* to be used on the History page in the content-manager. It understands how to render specific
|
352
|
+
* inputs within the context of a history version (i.e. relations, media, ignored RBAC, etc...)
|
353
|
+
*/ const VersionInputRenderer = ({ visible, hint: providedHint, shouldIgnoreRBAC = false, labelAction, ...props })=>{
|
354
|
+
const customLabelAction = getLabelAction(labelAction);
|
355
|
+
const { formatMessage } = reactIntl.useIntl();
|
356
|
+
const version = useHistoryContext('VersionContent', (state)=>state.selectedVersion);
|
357
|
+
const configuration = useHistoryContext('VersionContent', (state)=>state.configuration);
|
358
|
+
const fieldSizes = hooks.useTypedSelector((state)=>state['content-manager'].app.fieldSizes);
|
359
|
+
const { id, components } = index.useDoc();
|
360
|
+
const isFormDisabled = strapiAdmin.useForm('InputRenderer', (state)=>state.disabled);
|
361
|
+
const isInDynamicZone = Input.useDynamicZone('isInDynamicZone', (state)=>state.isInDynamicZone);
|
362
|
+
const canCreateFields = index.useDocumentRBAC('InputRenderer', (rbac)=>rbac.canCreateFields);
|
363
|
+
const canReadFields = index.useDocumentRBAC('InputRenderer', (rbac)=>rbac.canReadFields);
|
364
|
+
const canUpdateFields = index.useDocumentRBAC('InputRenderer', (rbac)=>rbac.canUpdateFields);
|
365
|
+
const canUserAction = index.useDocumentRBAC('InputRenderer', (rbac)=>rbac.canUserAction);
|
366
|
+
const editableFields = id ? canUpdateFields : canCreateFields;
|
367
|
+
const readableFields = id ? canReadFields : canCreateFields;
|
368
|
+
/**
|
369
|
+
* Component fields are always readable and editable,
|
370
|
+
* however the fields within them may not be.
|
371
|
+
*/ const canUserReadField = canUserAction(props.name, readableFields, props.type);
|
372
|
+
const canUserEditField = canUserAction(props.name, editableFields, props.type);
|
373
|
+
const fields = strapiAdmin.useStrapiApp('InputRenderer', (app)=>app.fields);
|
374
|
+
const { lazyComponentStore } = Input.useLazyComponents(attributeHasCustomFieldProperty(props.attribute) ? [
|
375
|
+
props.attribute.customField
|
376
|
+
] : undefined);
|
377
|
+
const hint = Input.useFieldHint(providedHint, props.attribute);
|
378
|
+
const { edit: { components: componentsLayout } } = index.useDocLayout();
|
379
|
+
if (!visible) {
|
380
|
+
return null;
|
381
|
+
}
|
382
|
+
/**
|
383
|
+
* Don't render the field if the user can't read it.
|
384
|
+
*/ if (!shouldIgnoreRBAC && !canUserReadField && !isInDynamicZone) {
|
385
|
+
return /*#__PURE__*/ jsxRuntime.jsx(Input.NotAllowedInput, {
|
386
|
+
hint: hint,
|
387
|
+
...props
|
388
|
+
});
|
389
|
+
}
|
390
|
+
const fieldIsDisabled = !canUserEditField && !isInDynamicZone || props.disabled || isFormDisabled;
|
391
|
+
/**
|
392
|
+
* Attributes found on the current content-type schema cannot be restored. We handle
|
393
|
+
* this by displaying a warning alert to the user instead of the input for that field type.
|
394
|
+
*/ const addedAttributes = version.meta.unknownAttributes.added;
|
395
|
+
if (Object.keys(addedAttributes).includes(props.name)) {
|
396
|
+
return /*#__PURE__*/ jsxRuntime.jsxs(designSystem.Flex, {
|
397
|
+
direction: "column",
|
398
|
+
alignItems: "flex-start",
|
399
|
+
gap: 1,
|
400
|
+
children: [
|
401
|
+
/*#__PURE__*/ jsxRuntime.jsx(designSystem.Field.Label, {
|
402
|
+
children: props.label
|
403
|
+
}),
|
404
|
+
/*#__PURE__*/ jsxRuntime.jsx(StyledAlert, {
|
405
|
+
width: "100%",
|
406
|
+
closeLabel: "Close",
|
407
|
+
onClose: ()=>{},
|
408
|
+
variant: "warning",
|
409
|
+
title: formatMessage({
|
410
|
+
id: 'content-manager.history.content.new-field.title',
|
411
|
+
defaultMessage: 'New field'
|
412
|
+
}),
|
413
|
+
children: formatMessage({
|
414
|
+
id: 'content-manager.history.content.new-field.message',
|
415
|
+
defaultMessage: "This field didn't exist when this version was saved. If you restore this version, it will be empty."
|
416
|
+
})
|
417
|
+
})
|
418
|
+
]
|
419
|
+
});
|
420
|
+
}
|
421
|
+
/**
|
422
|
+
* Because a custom field has a unique prop but the type could be confused with either
|
423
|
+
* the useField hook or the type of the field we need to handle it separately and first.
|
424
|
+
*/ if (attributeHasCustomFieldProperty(props.attribute)) {
|
425
|
+
const CustomInput = lazyComponentStore[props.attribute.customField];
|
426
|
+
if (CustomInput) {
|
427
|
+
return /*#__PURE__*/ jsxRuntime.jsx(CustomInput, {
|
428
|
+
...props,
|
429
|
+
// @ts-expect-error – TODO: fix this type error in the useLazyComponents hook.
|
430
|
+
hint: hint,
|
431
|
+
labelAction: customLabelAction,
|
432
|
+
disabled: fieldIsDisabled
|
433
|
+
});
|
434
|
+
}
|
435
|
+
return /*#__PURE__*/ jsxRuntime.jsx(strapiAdmin.InputRenderer, {
|
436
|
+
...props,
|
437
|
+
hint: hint,
|
438
|
+
labelAction: customLabelAction,
|
439
|
+
// @ts-expect-error – this workaround lets us display that the custom field is missing.
|
440
|
+
type: props.attribute.customField,
|
441
|
+
disabled: fieldIsDisabled
|
442
|
+
});
|
443
|
+
}
|
444
|
+
/**
|
445
|
+
* Since media fields use a custom input via the upload plugin provided by the useLibrary hook,
|
446
|
+
* we need to handle the them before other custom inputs coming from the useLibrary hook.
|
447
|
+
*/ if (props.type === 'media') {
|
448
|
+
return /*#__PURE__*/ jsxRuntime.jsx(CustomMediaInput, {
|
449
|
+
...props,
|
450
|
+
labelAction: customLabelAction,
|
451
|
+
disabled: fieldIsDisabled
|
452
|
+
});
|
453
|
+
}
|
454
|
+
/**
|
455
|
+
* This is where we handle ONLY the fields from the `useLibrary` hook.
|
456
|
+
*/ const addedInputTypes = Object.keys(fields);
|
457
|
+
if (!attributeHasCustomFieldProperty(props.attribute) && addedInputTypes.includes(props.type)) {
|
458
|
+
const CustomInput = fields[props.type];
|
459
|
+
return /*#__PURE__*/ jsxRuntime.jsx(CustomInput, {
|
460
|
+
...props,
|
461
|
+
// @ts-expect-error – TODO: fix this type error in the useLibrary hook.
|
462
|
+
hint: hint,
|
463
|
+
labelAction: customLabelAction,
|
464
|
+
disabled: fieldIsDisabled
|
465
|
+
});
|
466
|
+
}
|
467
|
+
/**
|
468
|
+
* These include the content-manager specific fields, failing that we fall back
|
469
|
+
* to the more generic form input renderer.
|
470
|
+
*/ switch(props.type){
|
471
|
+
case 'blocks':
|
472
|
+
return /*#__PURE__*/ jsxRuntime.jsx(Input.MemoizedBlocksInput, {
|
473
|
+
...props,
|
474
|
+
hint: hint,
|
475
|
+
type: props.type,
|
476
|
+
disabled: fieldIsDisabled
|
477
|
+
});
|
478
|
+
case 'component':
|
479
|
+
const { layout } = componentsLayout[props.attribute.component];
|
480
|
+
// Components can only have one panel, so only save the first layout item
|
481
|
+
const [remainingFieldsLayout] = getRemaingFieldsLayout({
|
482
|
+
layout: [
|
483
|
+
layout
|
484
|
+
],
|
485
|
+
metadatas: configuration.components[props.attribute.component].metadatas,
|
486
|
+
fieldSizes,
|
487
|
+
schemaAttributes: components[props.attribute.component].attributes
|
488
|
+
});
|
489
|
+
return /*#__PURE__*/ jsxRuntime.jsx(Input.MemoizedComponentInput, {
|
490
|
+
...props,
|
491
|
+
layout: [
|
492
|
+
...layout,
|
493
|
+
...remainingFieldsLayout || []
|
494
|
+
],
|
495
|
+
hint: hint,
|
496
|
+
labelAction: customLabelAction,
|
497
|
+
disabled: fieldIsDisabled,
|
498
|
+
children: (inputProps)=>/*#__PURE__*/ jsxRuntime.jsx(VersionInputRenderer, {
|
499
|
+
...inputProps,
|
500
|
+
shouldIgnoreRBAC: true
|
501
|
+
})
|
502
|
+
});
|
503
|
+
case 'dynamiczone':
|
504
|
+
return /*#__PURE__*/ jsxRuntime.jsx(Input.DynamicZone, {
|
505
|
+
...props,
|
506
|
+
hint: hint,
|
507
|
+
labelAction: customLabelAction,
|
508
|
+
disabled: fieldIsDisabled,
|
509
|
+
children: (inputProps)=>/*#__PURE__*/ jsxRuntime.jsx(VersionInputRenderer, {
|
510
|
+
...inputProps,
|
511
|
+
shouldIgnoreRBAC: true
|
512
|
+
})
|
513
|
+
});
|
514
|
+
case 'relation':
|
515
|
+
return /*#__PURE__*/ jsxRuntime.jsx(CustomRelationInput, {
|
516
|
+
...props,
|
517
|
+
hint: hint,
|
518
|
+
labelAction: customLabelAction,
|
519
|
+
disabled: fieldIsDisabled
|
520
|
+
});
|
521
|
+
case 'richtext':
|
522
|
+
return /*#__PURE__*/ jsxRuntime.jsx(Input.MemoizedWysiwyg, {
|
523
|
+
...props,
|
524
|
+
hint: hint,
|
525
|
+
type: props.type,
|
526
|
+
labelAction: customLabelAction,
|
527
|
+
disabled: fieldIsDisabled
|
528
|
+
});
|
529
|
+
case 'uid':
|
530
|
+
return /*#__PURE__*/ jsxRuntime.jsx(Input.MemoizedUIDInput, {
|
531
|
+
...props,
|
532
|
+
hint: hint,
|
533
|
+
type: props.type,
|
534
|
+
labelAction: customLabelAction,
|
535
|
+
disabled: fieldIsDisabled
|
536
|
+
});
|
537
|
+
/**
|
538
|
+
* Enumerations are a special case because they require options.
|
539
|
+
*/ case 'enumeration':
|
540
|
+
return /*#__PURE__*/ jsxRuntime.jsx(strapiAdmin.InputRenderer, {
|
541
|
+
...props,
|
542
|
+
hint: hint,
|
543
|
+
labelAction: customLabelAction,
|
544
|
+
options: props.attribute.enum.map((value)=>({
|
545
|
+
value
|
546
|
+
})),
|
547
|
+
// @ts-expect-error – Temp workaround so we don't forget custom-fields don't work!
|
548
|
+
type: props.customField ? 'custom-field' : props.type,
|
549
|
+
disabled: fieldIsDisabled
|
550
|
+
});
|
551
|
+
default:
|
552
|
+
// These props are not needed for the generic form input renderer.
|
553
|
+
const { unique: _unique, mainField: _mainField, ...restProps } = props;
|
554
|
+
return /*#__PURE__*/ jsxRuntime.jsx(strapiAdmin.InputRenderer, {
|
555
|
+
...restProps,
|
556
|
+
hint: hint,
|
557
|
+
labelAction: customLabelAction,
|
558
|
+
// @ts-expect-error – Temp workaround so we don't forget custom-fields don't work!
|
559
|
+
type: props.customField ? 'custom-field' : props.type,
|
560
|
+
disabled: fieldIsDisabled
|
561
|
+
});
|
562
|
+
}
|
563
|
+
};
|
564
|
+
const attributeHasCustomFieldProperty = (attribute)=>'customField' in attribute && typeof attribute.customField === 'string';
|
565
|
+
|
566
|
+
const createLayoutFromFields = (fields)=>{
|
567
|
+
return fields.reduce((rows, field)=>{
|
568
|
+
if (field.type === 'dynamiczone') {
|
569
|
+
// Dynamic zones take up all the columns in a row
|
570
|
+
rows.push([
|
571
|
+
field
|
572
|
+
]);
|
573
|
+
return rows;
|
574
|
+
}
|
575
|
+
if (!rows[rows.length - 1]) {
|
576
|
+
// Create a new row if there isn't one available
|
577
|
+
rows.push([]);
|
578
|
+
}
|
579
|
+
// Push fields to the current row, they wrap and handle their own column size
|
580
|
+
rows[rows.length - 1].push(field);
|
581
|
+
return rows;
|
582
|
+
}, [])// Map the rows to panels
|
583
|
+
.map((row)=>[
|
584
|
+
row
|
585
|
+
]);
|
586
|
+
};
|
587
|
+
/**
|
588
|
+
* Build a layout for the fields that are were deleted from the edit view layout
|
589
|
+
* via the configure the view page. This layout will be merged with the main one.
|
590
|
+
* Those fields would be restored if the user restores the history version, which is why it's
|
591
|
+
* important to show them, even if they're not in the normal layout.
|
592
|
+
*/ function getRemaingFieldsLayout({ layout, metadatas, schemaAttributes, fieldSizes }) {
|
593
|
+
const fieldsInLayout = layout.flatMap((panel)=>panel.flatMap((row)=>row.flatMap((field)=>field.name)));
|
594
|
+
const remainingFields = Object.entries(metadatas).reduce((currentRemainingFields, [name, field])=>{
|
595
|
+
// Make sure we do not fields that are not visible, e.g. "id"
|
596
|
+
if (!fieldsInLayout.includes(name) && field.edit.visible === true) {
|
597
|
+
const attribute = schemaAttributes[name];
|
598
|
+
// @ts-expect-error not sure why attribute causes type error
|
599
|
+
currentRemainingFields.push({
|
600
|
+
attribute,
|
601
|
+
type: attribute.type,
|
602
|
+
visible: true,
|
603
|
+
disabled: true,
|
604
|
+
label: field.edit.label || name,
|
605
|
+
name: name,
|
606
|
+
size: fieldSizes[attribute.type].default ?? 12
|
607
|
+
});
|
608
|
+
}
|
609
|
+
return currentRemainingFields;
|
610
|
+
}, []);
|
611
|
+
return createLayoutFromFields(remainingFields);
|
612
|
+
}
|
613
|
+
/* -------------------------------------------------------------------------------------------------
|
614
|
+
* FormPanel
|
615
|
+
* -----------------------------------------------------------------------------------------------*/ const FormPanel = ({ panel })=>{
|
616
|
+
if (panel.some((row)=>row.some((field)=>field.type === 'dynamiczone'))) {
|
617
|
+
const [row] = panel;
|
618
|
+
const [field] = row;
|
619
|
+
return /*#__PURE__*/ jsxRuntime.jsx(designSystem.Grid.Root, {
|
620
|
+
gap: 4,
|
621
|
+
children: /*#__PURE__*/ jsxRuntime.jsx(designSystem.Grid.Item, {
|
622
|
+
col: 12,
|
623
|
+
s: 12,
|
624
|
+
xs: 12,
|
625
|
+
direction: "column",
|
626
|
+
alignItems: "stretch",
|
627
|
+
children: /*#__PURE__*/ jsxRuntime.jsx(VersionInputRenderer, {
|
628
|
+
...field
|
629
|
+
})
|
630
|
+
})
|
631
|
+
}, field.name);
|
632
|
+
}
|
633
|
+
return /*#__PURE__*/ jsxRuntime.jsx(designSystem.Box, {
|
634
|
+
hasRadius: true,
|
635
|
+
background: "neutral0",
|
636
|
+
shadow: "tableShadow",
|
637
|
+
paddingLeft: 6,
|
638
|
+
paddingRight: 6,
|
639
|
+
paddingTop: 6,
|
640
|
+
paddingBottom: 6,
|
641
|
+
borderColor: "neutral150",
|
642
|
+
children: /*#__PURE__*/ jsxRuntime.jsx(designSystem.Flex, {
|
643
|
+
direction: "column",
|
644
|
+
alignItems: "stretch",
|
645
|
+
gap: 6,
|
646
|
+
children: panel.map((row, gridRowIndex)=>/*#__PURE__*/ jsxRuntime.jsx(designSystem.Grid.Root, {
|
647
|
+
gap: 4,
|
648
|
+
children: row.map(({ size, ...field })=>{
|
649
|
+
return /*#__PURE__*/ jsxRuntime.jsx(designSystem.Grid.Item, {
|
650
|
+
col: size,
|
651
|
+
s: 12,
|
652
|
+
xs: 12,
|
653
|
+
direction: "column",
|
654
|
+
alignItems: "stretch",
|
655
|
+
children: /*#__PURE__*/ jsxRuntime.jsx(VersionInputRenderer, {
|
656
|
+
...field
|
657
|
+
})
|
658
|
+
}, field.name);
|
659
|
+
})
|
660
|
+
}, gridRowIndex))
|
661
|
+
})
|
662
|
+
});
|
663
|
+
};
|
664
|
+
const VersionContent = ()=>{
|
665
|
+
const { formatMessage } = reactIntl.useIntl();
|
666
|
+
const { fieldSizes } = hooks.useTypedSelector((state)=>state['content-manager'].app);
|
667
|
+
const version = useHistoryContext('VersionContent', (state)=>state.selectedVersion);
|
668
|
+
const layout = useHistoryContext('VersionContent', (state)=>state.layout);
|
669
|
+
const configuration = useHistoryContext('VersionContent', (state)=>state.configuration);
|
670
|
+
const schema = useHistoryContext('VersionContent', (state)=>state.schema);
|
671
|
+
// Build a layout for the unknown fields section
|
672
|
+
const removedAttributes = version.meta.unknownAttributes.removed;
|
673
|
+
const removedAttributesAsFields = Object.entries(removedAttributes).map(([attributeName, attribute])=>{
|
674
|
+
const field = {
|
675
|
+
attribute,
|
676
|
+
shouldIgnoreRBAC: true,
|
677
|
+
type: attribute.type,
|
678
|
+
visible: true,
|
679
|
+
disabled: true,
|
680
|
+
label: attributeName,
|
681
|
+
name: attributeName,
|
682
|
+
size: fieldSizes[attribute.type].default ?? 12
|
683
|
+
};
|
684
|
+
return field;
|
685
|
+
});
|
686
|
+
const unknownFieldsLayout = createLayoutFromFields(removedAttributesAsFields);
|
687
|
+
// Build a layout for the fields that are were deleted from the layout
|
688
|
+
const remainingFieldsLayout = getRemaingFieldsLayout({
|
689
|
+
metadatas: configuration.contentType.metadatas,
|
690
|
+
layout,
|
691
|
+
schemaAttributes: schema.attributes,
|
692
|
+
fieldSizes
|
693
|
+
});
|
694
|
+
const { components } = index.useDoc();
|
695
|
+
/**
|
696
|
+
* Transform the data before passing it to the form so that each field
|
697
|
+
* has a uniquely generated key
|
698
|
+
*/ const transformedData = React__namespace.useMemo(()=>{
|
699
|
+
const transform = (schemaAttributes, components = {})=>(document)=>{
|
700
|
+
const schema = {
|
701
|
+
attributes: schemaAttributes
|
702
|
+
};
|
703
|
+
const transformations = pipe(index.removeFieldsThatDontExistOnSchema(schema), index.prepareTempKeys(schema, components));
|
704
|
+
return transformations(document);
|
705
|
+
};
|
706
|
+
return transform(version.schema, components)(version.data);
|
707
|
+
}, [
|
708
|
+
components,
|
709
|
+
version.data,
|
710
|
+
version.schema
|
711
|
+
]);
|
712
|
+
return /*#__PURE__*/ jsxRuntime.jsxs(strapiAdmin.Layouts.Content, {
|
713
|
+
children: [
|
714
|
+
/*#__PURE__*/ jsxRuntime.jsx(designSystem.Box, {
|
715
|
+
paddingBottom: 8,
|
716
|
+
children: /*#__PURE__*/ jsxRuntime.jsx(strapiAdmin.Form, {
|
717
|
+
disabled: true,
|
718
|
+
method: "PUT",
|
719
|
+
initialValues: transformedData,
|
720
|
+
children: /*#__PURE__*/ jsxRuntime.jsx(designSystem.Flex, {
|
721
|
+
direction: "column",
|
722
|
+
alignItems: "stretch",
|
723
|
+
gap: 6,
|
724
|
+
position: "relative",
|
725
|
+
children: [
|
726
|
+
...layout,
|
727
|
+
...remainingFieldsLayout
|
728
|
+
].map((panel, index)=>{
|
729
|
+
return /*#__PURE__*/ jsxRuntime.jsx(FormPanel, {
|
730
|
+
panel: panel
|
731
|
+
}, index);
|
732
|
+
})
|
733
|
+
})
|
734
|
+
})
|
735
|
+
}),
|
736
|
+
removedAttributesAsFields.length > 0 && /*#__PURE__*/ jsxRuntime.jsxs(jsxRuntime.Fragment, {
|
737
|
+
children: [
|
738
|
+
/*#__PURE__*/ jsxRuntime.jsx(designSystem.Divider, {}),
|
739
|
+
/*#__PURE__*/ jsxRuntime.jsxs(designSystem.Box, {
|
740
|
+
paddingTop: 8,
|
741
|
+
children: [
|
742
|
+
/*#__PURE__*/ jsxRuntime.jsxs(designSystem.Flex, {
|
743
|
+
direction: "column",
|
744
|
+
alignItems: "flex-start",
|
745
|
+
paddingBottom: 6,
|
746
|
+
gap: 1,
|
747
|
+
children: [
|
748
|
+
/*#__PURE__*/ jsxRuntime.jsx(designSystem.Typography, {
|
749
|
+
variant: "delta",
|
750
|
+
children: formatMessage({
|
751
|
+
id: 'content-manager.history.content.unknown-fields.title',
|
752
|
+
defaultMessage: 'Unknown fields'
|
753
|
+
})
|
754
|
+
}),
|
755
|
+
/*#__PURE__*/ jsxRuntime.jsx(designSystem.Typography, {
|
756
|
+
variant: "pi",
|
757
|
+
children: formatMessage({
|
758
|
+
id: 'content-manager.history.content.unknown-fields.message',
|
759
|
+
defaultMessage: 'These fields have been deleted or renamed in the Content-Type Builder. <b>These fields will not be restored.</b>'
|
760
|
+
}, {
|
761
|
+
b: (chunks)=>/*#__PURE__*/ jsxRuntime.jsx(designSystem.Typography, {
|
762
|
+
variant: "pi",
|
763
|
+
fontWeight: "bold",
|
764
|
+
children: chunks
|
765
|
+
})
|
766
|
+
})
|
767
|
+
})
|
768
|
+
]
|
769
|
+
}),
|
770
|
+
/*#__PURE__*/ jsxRuntime.jsx(strapiAdmin.Form, {
|
771
|
+
disabled: true,
|
772
|
+
method: "PUT",
|
773
|
+
initialValues: version.data,
|
774
|
+
children: /*#__PURE__*/ jsxRuntime.jsx(designSystem.Flex, {
|
775
|
+
direction: "column",
|
776
|
+
alignItems: "stretch",
|
777
|
+
gap: 6,
|
778
|
+
position: "relative",
|
779
|
+
children: unknownFieldsLayout.map((panel, index)=>{
|
780
|
+
return /*#__PURE__*/ jsxRuntime.jsx(FormPanel, {
|
781
|
+
panel: panel
|
782
|
+
}, index);
|
783
|
+
})
|
784
|
+
})
|
785
|
+
})
|
786
|
+
]
|
787
|
+
})
|
788
|
+
]
|
789
|
+
})
|
790
|
+
]
|
791
|
+
});
|
792
|
+
};
|
793
|
+
|
794
|
+
const historyVersionsApi = index.contentManagerApi.injectEndpoints({
|
795
|
+
endpoints: (builder)=>({
|
796
|
+
getHistoryVersions: builder.query({
|
797
|
+
query (params) {
|
798
|
+
return {
|
799
|
+
url: `/content-manager/history-versions`,
|
800
|
+
method: 'GET',
|
801
|
+
config: {
|
802
|
+
params
|
803
|
+
}
|
804
|
+
};
|
805
|
+
},
|
806
|
+
providesTags: [
|
807
|
+
'HistoryVersion'
|
808
|
+
]
|
809
|
+
}),
|
810
|
+
restoreVersion: builder.mutation({
|
811
|
+
query ({ params, body }) {
|
812
|
+
return {
|
813
|
+
url: `/content-manager/history-versions/${params.versionId}/restore`,
|
814
|
+
method: 'PUT',
|
815
|
+
data: body
|
816
|
+
};
|
817
|
+
},
|
818
|
+
invalidatesTags: (_res, _error, { documentId, collectionType, params })=>{
|
819
|
+
return [
|
820
|
+
'HistoryVersion',
|
821
|
+
{
|
822
|
+
type: 'Document',
|
823
|
+
id: collectionType === index.COLLECTION_TYPES ? `${params.contentType}_${documentId}` : params.contentType
|
824
|
+
}
|
825
|
+
];
|
826
|
+
}
|
827
|
+
})
|
828
|
+
})
|
829
|
+
});
|
830
|
+
const { useGetHistoryVersionsQuery, useRestoreVersionMutation } = historyVersionsApi;
|
831
|
+
|
832
|
+
const VersionHeader = ({ headerId })=>{
|
833
|
+
const [isConfirmDialogOpen, setIsConfirmDialogOpen] = React__namespace.useState(false);
|
834
|
+
const navigate = reactRouterDom.useNavigate();
|
835
|
+
const { formatMessage, formatDate } = reactIntl.useIntl();
|
836
|
+
const { trackUsage } = strapiAdmin.useTracking();
|
837
|
+
const { toggleNotification } = strapiAdmin.useNotification();
|
838
|
+
const [{ query }] = strapiAdmin.useQueryParams();
|
839
|
+
const { collectionType, slug } = reactRouterDom.useParams();
|
840
|
+
const [restoreVersion, { isLoading }] = useRestoreVersionMutation();
|
841
|
+
const { allowedActions } = strapiAdmin.useRBAC(index.PERMISSIONS.map((action)=>({
|
842
|
+
action,
|
843
|
+
subject: slug
|
844
|
+
})));
|
845
|
+
const version = useHistoryContext('VersionHeader', (state)=>state.selectedVersion);
|
846
|
+
const mainField = useHistoryContext('VersionHeader', (state)=>state.mainField);
|
847
|
+
const schema = useHistoryContext('VersionHeader', (state)=>state.schema);
|
848
|
+
const isCurrentVersion = useHistoryContext('VersionHeader', (state)=>state.page === 1 && state.versions.data[0].id === state.selectedVersion.id);
|
849
|
+
const mainFieldValue = version.data[mainField];
|
850
|
+
const getNextNavigation = ()=>{
|
851
|
+
const pluginsQueryParams = qs.stringify({
|
852
|
+
plugins: query.plugins
|
853
|
+
}, {
|
854
|
+
encode: false
|
855
|
+
});
|
856
|
+
return {
|
857
|
+
pathname: '..',
|
858
|
+
search: pluginsQueryParams
|
859
|
+
};
|
860
|
+
};
|
861
|
+
const handleRestore = async ()=>{
|
862
|
+
try {
|
863
|
+
const response = await restoreVersion({
|
864
|
+
documentId: version.relatedDocumentId,
|
865
|
+
collectionType,
|
866
|
+
params: {
|
867
|
+
versionId: version.id,
|
868
|
+
contentType: version.contentType
|
869
|
+
},
|
870
|
+
body: {
|
871
|
+
contentType: version.contentType
|
872
|
+
}
|
873
|
+
});
|
874
|
+
if ('data' in response) {
|
875
|
+
navigate(getNextNavigation(), {
|
876
|
+
relative: 'path'
|
877
|
+
});
|
878
|
+
toggleNotification({
|
879
|
+
type: 'success',
|
880
|
+
title: formatMessage({
|
881
|
+
id: 'content-manager.restore.success.title',
|
882
|
+
defaultMessage: 'Version restored.'
|
883
|
+
}),
|
884
|
+
message: formatMessage({
|
885
|
+
id: 'content-manager.restore.success.message',
|
886
|
+
defaultMessage: 'A past version of the content was restored.'
|
887
|
+
})
|
888
|
+
});
|
889
|
+
trackUsage('didRestoreHistoryVersion');
|
890
|
+
}
|
891
|
+
if ('error' in response) {
|
892
|
+
toggleNotification({
|
893
|
+
type: 'danger',
|
894
|
+
message: formatMessage({
|
895
|
+
id: 'content-manager.history.restore.error.message',
|
896
|
+
defaultMessage: 'Could not restore version.'
|
897
|
+
})
|
898
|
+
});
|
899
|
+
}
|
900
|
+
} catch (error) {
|
901
|
+
toggleNotification({
|
902
|
+
type: 'danger',
|
903
|
+
message: formatMessage({
|
904
|
+
id: 'notification.error',
|
905
|
+
defaultMessage: 'An error occurred'
|
906
|
+
})
|
907
|
+
});
|
908
|
+
}
|
909
|
+
};
|
910
|
+
return /*#__PURE__*/ jsxRuntime.jsxs(designSystem.Dialog.Root, {
|
911
|
+
open: isConfirmDialogOpen,
|
912
|
+
onOpenChange: setIsConfirmDialogOpen,
|
913
|
+
children: [
|
914
|
+
/*#__PURE__*/ jsxRuntime.jsx(strapiAdmin.Layouts.BaseHeader, {
|
915
|
+
id: headerId,
|
916
|
+
title: formatDate(new Date(version.createdAt), {
|
917
|
+
year: 'numeric',
|
918
|
+
month: 'numeric',
|
919
|
+
day: 'numeric',
|
920
|
+
hour: 'numeric',
|
921
|
+
minute: 'numeric'
|
922
|
+
}),
|
923
|
+
subtitle: /*#__PURE__*/ jsxRuntime.jsx(designSystem.Typography, {
|
924
|
+
variant: "epsilon",
|
925
|
+
textColor: "neutral600",
|
926
|
+
children: formatMessage({
|
927
|
+
id: 'content-manager.history.version.subtitle',
|
928
|
+
defaultMessage: '{hasLocale, select, true {{subtitle}, in {locale}} other {{subtitle}}}'
|
929
|
+
}, {
|
930
|
+
hasLocale: Boolean(version.locale),
|
931
|
+
subtitle: `${mainFieldValue || ''} (${schema.info.singularName})`.trim(),
|
932
|
+
locale: version.locale?.name
|
933
|
+
})
|
934
|
+
}),
|
935
|
+
navigationAction: /*#__PURE__*/ jsxRuntime.jsx(designSystem.Link, {
|
936
|
+
startIcon: /*#__PURE__*/ jsxRuntime.jsx(Icons.ArrowLeft, {}),
|
937
|
+
tag: reactRouterDom.NavLink,
|
938
|
+
to: getNextNavigation(),
|
939
|
+
relative: "path",
|
940
|
+
isExternal: false,
|
941
|
+
children: formatMessage({
|
942
|
+
id: 'global.back',
|
943
|
+
defaultMessage: 'Back'
|
944
|
+
})
|
945
|
+
}),
|
946
|
+
sticky: false,
|
947
|
+
primaryAction: /*#__PURE__*/ jsxRuntime.jsx(designSystem.Dialog.Trigger, {
|
948
|
+
children: /*#__PURE__*/ jsxRuntime.jsx(designSystem.Button, {
|
949
|
+
disabled: !allowedActions.canUpdate || isCurrentVersion,
|
950
|
+
onClick: ()=>{
|
951
|
+
setIsConfirmDialogOpen(true);
|
952
|
+
},
|
953
|
+
children: formatMessage({
|
954
|
+
id: 'content-manager.history.restore.confirm.button',
|
955
|
+
defaultMessage: 'Restore'
|
956
|
+
})
|
957
|
+
})
|
958
|
+
})
|
959
|
+
}),
|
960
|
+
/*#__PURE__*/ jsxRuntime.jsx(strapiAdmin.ConfirmDialog, {
|
961
|
+
onConfirm: handleRestore,
|
962
|
+
endAction: /*#__PURE__*/ jsxRuntime.jsx(designSystem.Button, {
|
963
|
+
variant: "secondary",
|
964
|
+
onClick: handleRestore,
|
965
|
+
loading: isLoading,
|
966
|
+
children: formatMessage({
|
967
|
+
id: 'content-manager.history.restore.confirm.button',
|
968
|
+
defaultMessage: 'Restore'
|
969
|
+
})
|
970
|
+
}),
|
971
|
+
children: /*#__PURE__*/ jsxRuntime.jsxs(designSystem.Flex, {
|
972
|
+
direction: "column",
|
973
|
+
alignItems: "center",
|
974
|
+
justifyContent: "center",
|
975
|
+
gap: 2,
|
976
|
+
textAlign: "center",
|
977
|
+
children: [
|
978
|
+
/*#__PURE__*/ jsxRuntime.jsx(designSystem.Flex, {
|
979
|
+
justifyContent: "center",
|
980
|
+
children: /*#__PURE__*/ jsxRuntime.jsx(Icons.WarningCircle, {
|
981
|
+
width: "24px",
|
982
|
+
height: "24px",
|
983
|
+
fill: "danger600"
|
984
|
+
})
|
985
|
+
}),
|
986
|
+
/*#__PURE__*/ jsxRuntime.jsx(designSystem.Typography, {
|
987
|
+
children: formatMessage({
|
988
|
+
id: 'content-manager.history.restore.confirm.title',
|
989
|
+
defaultMessage: 'Are you sure you want to restore this version?'
|
990
|
+
})
|
991
|
+
}),
|
992
|
+
/*#__PURE__*/ jsxRuntime.jsx(designSystem.Typography, {
|
993
|
+
children: formatMessage({
|
994
|
+
id: 'content-manager.history.restore.confirm.message',
|
995
|
+
defaultMessage: "{isDraft, select, true {The restored content will override your draft.} other {The restored content won't be published, it will override the draft and be saved as pending changes. You'll be able to publish the changes at anytime.}}"
|
996
|
+
}, {
|
997
|
+
isDraft: version.status === 'draft'
|
998
|
+
})
|
999
|
+
})
|
1000
|
+
]
|
1001
|
+
})
|
1002
|
+
})
|
1003
|
+
]
|
1004
|
+
});
|
1005
|
+
};
|
1006
|
+
|
1007
|
+
/* -------------------------------------------------------------------------------------------------
|
1008
|
+
* BlueText
|
1009
|
+
* -----------------------------------------------------------------------------------------------*/ const BlueText = (children)=>/*#__PURE__*/ jsxRuntime.jsx(designSystem.Typography, {
|
1010
|
+
textColor: "primary600",
|
1011
|
+
variant: "pi",
|
1012
|
+
children: children
|
1013
|
+
});
|
1014
|
+
const VersionCard = ({ version, isCurrent })=>{
|
1015
|
+
const { formatDate, formatMessage } = reactIntl.useIntl();
|
1016
|
+
const [{ query }] = strapiAdmin.useQueryParams();
|
1017
|
+
const isActive = query.id === version.id.toString();
|
1018
|
+
const author = version.createdBy && index.getDisplayName(version.createdBy);
|
1019
|
+
return /*#__PURE__*/ jsxRuntime.jsxs(designSystem.Flex, {
|
1020
|
+
direction: "column",
|
1021
|
+
alignItems: "flex-start",
|
1022
|
+
gap: 3,
|
1023
|
+
hasRadius: true,
|
1024
|
+
borderWidth: "1px",
|
1025
|
+
borderStyle: "solid",
|
1026
|
+
borderColor: isActive ? 'primary600' : 'neutral200',
|
1027
|
+
color: "neutral800",
|
1028
|
+
padding: 5,
|
1029
|
+
tag: reactRouterDom.Link,
|
1030
|
+
to: `?${qs.stringify({
|
1031
|
+
...query,
|
1032
|
+
id: version.id
|
1033
|
+
})}`,
|
1034
|
+
style: {
|
1035
|
+
textDecoration: 'none'
|
1036
|
+
},
|
1037
|
+
children: [
|
1038
|
+
/*#__PURE__*/ jsxRuntime.jsxs(designSystem.Flex, {
|
1039
|
+
direction: "column",
|
1040
|
+
gap: 1,
|
1041
|
+
alignItems: "flex-start",
|
1042
|
+
children: [
|
1043
|
+
/*#__PURE__*/ jsxRuntime.jsx(designSystem.Typography, {
|
1044
|
+
tag: "h3",
|
1045
|
+
fontWeight: "semiBold",
|
1046
|
+
children: formatDate(version.createdAt, {
|
1047
|
+
day: 'numeric',
|
1048
|
+
month: 'numeric',
|
1049
|
+
year: 'numeric',
|
1050
|
+
hour: '2-digit',
|
1051
|
+
minute: '2-digit'
|
1052
|
+
})
|
1053
|
+
}),
|
1054
|
+
/*#__PURE__*/ jsxRuntime.jsx(designSystem.Typography, {
|
1055
|
+
tag: "p",
|
1056
|
+
variant: "pi",
|
1057
|
+
textColor: "neutral600",
|
1058
|
+
children: formatMessage({
|
1059
|
+
id: 'content-manager.history.sidebar.versionDescription',
|
1060
|
+
defaultMessage: '{distanceToNow}{isAnonymous, select, true {} other { by {author}}}{isCurrent, select, true { <b>(current)</b>} other {}}'
|
1061
|
+
}, {
|
1062
|
+
distanceToNow: /*#__PURE__*/ jsxRuntime.jsx(index.RelativeTime, {
|
1063
|
+
timestamp: new Date(version.createdAt)
|
1064
|
+
}),
|
1065
|
+
author,
|
1066
|
+
isAnonymous: !Boolean(version.createdBy),
|
1067
|
+
isCurrent,
|
1068
|
+
b: BlueText
|
1069
|
+
})
|
1070
|
+
})
|
1071
|
+
]
|
1072
|
+
}),
|
1073
|
+
version.status && /*#__PURE__*/ jsxRuntime.jsx(index.DocumentStatus, {
|
1074
|
+
status: version.status,
|
1075
|
+
size: "XS"
|
1076
|
+
})
|
1077
|
+
]
|
1078
|
+
});
|
1079
|
+
};
|
1080
|
+
const PaginationButton = ({ page, children })=>{
|
1081
|
+
const [{ query }] = strapiAdmin.useQueryParams();
|
1082
|
+
// Remove the id from the pagination link, so that the history page can redirect
|
1083
|
+
// to the id of the first history version in the new page once it's loaded
|
1084
|
+
const { id: _id, ...queryRest } = query;
|
1085
|
+
return /*#__PURE__*/ jsxRuntime.jsx(reactRouterDom.Link, {
|
1086
|
+
to: {
|
1087
|
+
search: qs.stringify({
|
1088
|
+
...queryRest,
|
1089
|
+
page
|
1090
|
+
})
|
1091
|
+
},
|
1092
|
+
style: {
|
1093
|
+
textDecoration: 'none'
|
1094
|
+
},
|
1095
|
+
children: /*#__PURE__*/ jsxRuntime.jsx(designSystem.Typography, {
|
1096
|
+
variant: "omega",
|
1097
|
+
textColor: "primary600",
|
1098
|
+
children: children
|
1099
|
+
})
|
1100
|
+
});
|
1101
|
+
};
|
1102
|
+
/* -------------------------------------------------------------------------------------------------
|
1103
|
+
* VersionsList
|
1104
|
+
* -----------------------------------------------------------------------------------------------*/ const VersionsList = ()=>{
|
1105
|
+
const { formatMessage } = reactIntl.useIntl();
|
1106
|
+
const { versions, page } = useHistoryContext('VersionsList', (state)=>({
|
1107
|
+
versions: state.versions,
|
1108
|
+
page: state.page
|
1109
|
+
}));
|
1110
|
+
return /*#__PURE__*/ jsxRuntime.jsxs(designSystem.Flex, {
|
1111
|
+
shrink: 0,
|
1112
|
+
direction: "column",
|
1113
|
+
alignItems: "stretch",
|
1114
|
+
width: "320px",
|
1115
|
+
height: "100vh",
|
1116
|
+
background: "neutral0",
|
1117
|
+
borderColor: "neutral200",
|
1118
|
+
borderWidth: "0 0 0 1px",
|
1119
|
+
borderStyle: "solid",
|
1120
|
+
tag: "aside",
|
1121
|
+
children: [
|
1122
|
+
/*#__PURE__*/ jsxRuntime.jsxs(designSystem.Flex, {
|
1123
|
+
direction: "row",
|
1124
|
+
justifyContent: "space-between",
|
1125
|
+
padding: 4,
|
1126
|
+
borderColor: "neutral200",
|
1127
|
+
borderWidth: "0 0 1px",
|
1128
|
+
borderStyle: "solid",
|
1129
|
+
tag: "header",
|
1130
|
+
children: [
|
1131
|
+
/*#__PURE__*/ jsxRuntime.jsx(designSystem.Typography, {
|
1132
|
+
tag: "h2",
|
1133
|
+
variant: "omega",
|
1134
|
+
fontWeight: "semiBold",
|
1135
|
+
children: formatMessage({
|
1136
|
+
id: 'content-manager.history.sidebar.title',
|
1137
|
+
defaultMessage: 'Versions'
|
1138
|
+
})
|
1139
|
+
}),
|
1140
|
+
/*#__PURE__*/ jsxRuntime.jsx(designSystem.Box, {
|
1141
|
+
background: "neutral150",
|
1142
|
+
hasRadius: true,
|
1143
|
+
padding: 1,
|
1144
|
+
children: /*#__PURE__*/ jsxRuntime.jsx(designSystem.Typography, {
|
1145
|
+
variant: "sigma",
|
1146
|
+
textColor: "neutral600",
|
1147
|
+
children: versions.meta.pagination.total
|
1148
|
+
})
|
1149
|
+
})
|
1150
|
+
]
|
1151
|
+
}),
|
1152
|
+
/*#__PURE__*/ jsxRuntime.jsxs(designSystem.Box, {
|
1153
|
+
flex: 1,
|
1154
|
+
overflow: "auto",
|
1155
|
+
children: [
|
1156
|
+
versions.meta.pagination.page > 1 && /*#__PURE__*/ jsxRuntime.jsx(designSystem.Box, {
|
1157
|
+
paddingTop: 4,
|
1158
|
+
textAlign: "center",
|
1159
|
+
children: /*#__PURE__*/ jsxRuntime.jsx(PaginationButton, {
|
1160
|
+
page: page - 1,
|
1161
|
+
children: formatMessage({
|
1162
|
+
id: 'content-manager.history.sidebar.show-newer',
|
1163
|
+
defaultMessage: 'Show newer versions'
|
1164
|
+
})
|
1165
|
+
})
|
1166
|
+
}),
|
1167
|
+
/*#__PURE__*/ jsxRuntime.jsx(designSystem.Flex, {
|
1168
|
+
direction: "column",
|
1169
|
+
gap: 3,
|
1170
|
+
padding: 4,
|
1171
|
+
tag: "ul",
|
1172
|
+
alignItems: "stretch",
|
1173
|
+
children: versions.data.map((version, index)=>/*#__PURE__*/ jsxRuntime.jsx("li", {
|
1174
|
+
"aria-label": formatMessage({
|
1175
|
+
id: 'content-manager.history.sidebar.title.version-card.aria-label',
|
1176
|
+
defaultMessage: 'Version card'
|
1177
|
+
}),
|
1178
|
+
children: /*#__PURE__*/ jsxRuntime.jsx(VersionCard, {
|
1179
|
+
version: version,
|
1180
|
+
isCurrent: page === 1 && index === 0
|
1181
|
+
})
|
1182
|
+
}, version.id))
|
1183
|
+
}),
|
1184
|
+
versions.meta.pagination.page < versions.meta.pagination.pageCount && /*#__PURE__*/ jsxRuntime.jsx(designSystem.Box, {
|
1185
|
+
paddingBottom: 4,
|
1186
|
+
textAlign: "center",
|
1187
|
+
children: /*#__PURE__*/ jsxRuntime.jsx(PaginationButton, {
|
1188
|
+
page: page + 1,
|
1189
|
+
children: formatMessage({
|
1190
|
+
id: 'content-manager.history.sidebar.show-older',
|
1191
|
+
defaultMessage: 'Show older versions'
|
1192
|
+
})
|
1193
|
+
})
|
1194
|
+
})
|
1195
|
+
]
|
1196
|
+
})
|
1197
|
+
]
|
1198
|
+
});
|
1199
|
+
};
|
1200
|
+
|
1201
|
+
const [HistoryProvider, useHistoryContext] = strapiAdmin.createContext('HistoryPage');
|
1202
|
+
/* -------------------------------------------------------------------------------------------------
|
1203
|
+
* HistoryPage
|
1204
|
+
* -----------------------------------------------------------------------------------------------*/ const HistoryPage = ()=>{
|
1205
|
+
const headerId = React__namespace.useId();
|
1206
|
+
const { formatMessage } = reactIntl.useIntl();
|
1207
|
+
const { slug, id: documentId, collectionType } = reactRouterDom.useParams();
|
1208
|
+
const { isLoading: isLoadingDocument, schema } = index.useDocument({
|
1209
|
+
collectionType: collectionType,
|
1210
|
+
model: slug
|
1211
|
+
});
|
1212
|
+
const { isLoading: isLoadingLayout, edit: { layout, settings: { displayName, mainField } } } = index.useDocumentLayout(slug);
|
1213
|
+
const { data: configuration, isLoading: isLoadingConfiguration } = index.useGetContentTypeConfigurationQuery(slug);
|
1214
|
+
// Parse state from query params
|
1215
|
+
const [{ query }] = strapiAdmin.useQueryParams();
|
1216
|
+
const { id: selectedVersionId, ...queryWithoutId } = query;
|
1217
|
+
const validQueryParamsWithoutId = index.buildValidParams(queryWithoutId);
|
1218
|
+
const page = validQueryParamsWithoutId.page ? Number(validQueryParamsWithoutId.page) : 1;
|
1219
|
+
const versionsResponse = useGetHistoryVersionsQuery({
|
1220
|
+
contentType: slug,
|
1221
|
+
...documentId ? {
|
1222
|
+
documentId
|
1223
|
+
} : {},
|
1224
|
+
// Omit id since it's not needed by the endpoint and caused extra refetches
|
1225
|
+
...validQueryParamsWithoutId
|
1226
|
+
}, {
|
1227
|
+
refetchOnMountOrArgChange: true
|
1228
|
+
});
|
1229
|
+
/**
|
1230
|
+
* When the page is first mounted, if there's already data in the cache, RTK has a fullfilled
|
1231
|
+
* status for the first render, right before it triggers a new request. This means the code
|
1232
|
+
* briefly reaches the part that redirects to the first history version (if none is set).
|
1233
|
+
* But since that data is stale, that means auto-selecting a version that may not be the most
|
1234
|
+
* recent. To avoid this, we identify through requestId if the query is stale despite the
|
1235
|
+
* fullfilled status, and show the loader in that case.
|
1236
|
+
* This means we essentially don't want cache. We always refetch when the page mounts, and
|
1237
|
+
* we always show the loader until we have the most recent data. That's fine for this page.
|
1238
|
+
*/ const initialRequestId = React__namespace.useRef(versionsResponse.requestId);
|
1239
|
+
const isStaleRequest = versionsResponse.requestId === initialRequestId.current;
|
1240
|
+
/**
|
1241
|
+
* Ensure that we have the necessary data to render the page:
|
1242
|
+
* - slug for single types
|
1243
|
+
* - slug _and_ documentId for collection types
|
1244
|
+
*/ if (!slug || collectionType === index.COLLECTION_TYPES && !documentId) {
|
1245
|
+
return /*#__PURE__*/ jsxRuntime.jsx(reactRouterDom.Navigate, {
|
1246
|
+
to: "/content-manager"
|
1247
|
+
});
|
1248
|
+
}
|
1249
|
+
if (isLoadingDocument || isLoadingLayout || versionsResponse.isFetching || isStaleRequest || isLoadingConfiguration) {
|
1250
|
+
return /*#__PURE__*/ jsxRuntime.jsx(strapiAdmin.Page.Loading, {});
|
1251
|
+
}
|
1252
|
+
// It was a success, handle empty data
|
1253
|
+
if (!versionsResponse.isError && !versionsResponse.data?.data?.length) {
|
1254
|
+
return /*#__PURE__*/ jsxRuntime.jsx(jsxRuntime.Fragment, {
|
1255
|
+
children: /*#__PURE__*/ jsxRuntime.jsx(strapiAdmin.Page.NoData, {
|
1256
|
+
action: /*#__PURE__*/ jsxRuntime.jsx(designSystem.Link, {
|
1257
|
+
tag: reactRouterDom.NavLink,
|
1258
|
+
to: `/content-manager/${collectionType}/${slug}${documentId ? `/${documentId}` : ''}`,
|
1259
|
+
children: formatMessage({
|
1260
|
+
id: 'global.back',
|
1261
|
+
defaultMessage: 'Back'
|
1262
|
+
})
|
1263
|
+
})
|
1264
|
+
})
|
1265
|
+
});
|
1266
|
+
}
|
1267
|
+
// We have data, handle selected version
|
1268
|
+
if (versionsResponse.data?.data?.length && !selectedVersionId) {
|
1269
|
+
return /*#__PURE__*/ jsxRuntime.jsx(reactRouterDom.Navigate, {
|
1270
|
+
to: {
|
1271
|
+
search: qs.stringify({
|
1272
|
+
...query,
|
1273
|
+
id: versionsResponse.data.data[0].id
|
1274
|
+
})
|
1275
|
+
},
|
1276
|
+
replace: true
|
1277
|
+
});
|
1278
|
+
}
|
1279
|
+
const selectedVersion = versionsResponse.data?.data?.find((version)=>version.id.toString() === selectedVersionId);
|
1280
|
+
if (versionsResponse.isError || !layout || !schema || !selectedVersion || !configuration || // This should not happen as it's covered by versionsResponse.isError, but we need it for TS
|
1281
|
+
versionsResponse.data.error) {
|
1282
|
+
return /*#__PURE__*/ jsxRuntime.jsx(strapiAdmin.Page.Error, {});
|
1283
|
+
}
|
1284
|
+
return /*#__PURE__*/ jsxRuntime.jsxs(jsxRuntime.Fragment, {
|
1285
|
+
children: [
|
1286
|
+
/*#__PURE__*/ jsxRuntime.jsx(strapiAdmin.Page.Title, {
|
1287
|
+
children: formatMessage({
|
1288
|
+
id: 'content-manager.history.page-title',
|
1289
|
+
defaultMessage: '{contentType} history'
|
1290
|
+
}, {
|
1291
|
+
contentType: displayName
|
1292
|
+
})
|
1293
|
+
}),
|
1294
|
+
/*#__PURE__*/ jsxRuntime.jsx(HistoryProvider, {
|
1295
|
+
contentType: slug,
|
1296
|
+
id: documentId,
|
1297
|
+
schema: schema,
|
1298
|
+
layout: layout,
|
1299
|
+
configuration: configuration,
|
1300
|
+
selectedVersion: selectedVersion,
|
1301
|
+
versions: versionsResponse.data,
|
1302
|
+
page: page,
|
1303
|
+
mainField: mainField,
|
1304
|
+
children: /*#__PURE__*/ jsxRuntime.jsxs(designSystem.Flex, {
|
1305
|
+
direction: "row",
|
1306
|
+
alignItems: "flex-start",
|
1307
|
+
children: [
|
1308
|
+
/*#__PURE__*/ jsxRuntime.jsxs(designSystem.Main, {
|
1309
|
+
grow: 1,
|
1310
|
+
height: "100vh",
|
1311
|
+
background: "neutral100",
|
1312
|
+
paddingBottom: 6,
|
1313
|
+
overflow: "auto",
|
1314
|
+
labelledBy: headerId,
|
1315
|
+
children: [
|
1316
|
+
/*#__PURE__*/ jsxRuntime.jsx(VersionHeader, {
|
1317
|
+
headerId: headerId
|
1318
|
+
}),
|
1319
|
+
/*#__PURE__*/ jsxRuntime.jsx(VersionContent, {})
|
1320
|
+
]
|
1321
|
+
}),
|
1322
|
+
/*#__PURE__*/ jsxRuntime.jsx(VersionsList, {})
|
1323
|
+
]
|
1324
|
+
})
|
1325
|
+
})
|
1326
|
+
]
|
1327
|
+
});
|
1328
|
+
};
|
1329
|
+
/* -------------------------------------------------------------------------------------------------
|
1330
|
+
* ProtectedHistoryPage
|
1331
|
+
* -----------------------------------------------------------------------------------------------*/ const ProtectedHistoryPageImpl = ()=>{
|
1332
|
+
const { slug } = reactRouterDom.useParams();
|
1333
|
+
const { permissions = [], isLoading, error } = strapiAdmin.useRBAC(index.PERMISSIONS.map((action)=>({
|
1334
|
+
action,
|
1335
|
+
subject: slug
|
1336
|
+
})));
|
1337
|
+
if (isLoading) {
|
1338
|
+
return /*#__PURE__*/ jsxRuntime.jsx(strapiAdmin.Page.Loading, {});
|
1339
|
+
}
|
1340
|
+
if (error || !slug) {
|
1341
|
+
return /*#__PURE__*/ jsxRuntime.jsx(designSystem.Box, {
|
1342
|
+
height: "100vh",
|
1343
|
+
width: "100vw",
|
1344
|
+
position: "fixed",
|
1345
|
+
top: 0,
|
1346
|
+
left: 0,
|
1347
|
+
zIndex: 2,
|
1348
|
+
background: "neutral0",
|
1349
|
+
children: /*#__PURE__*/ jsxRuntime.jsx(strapiAdmin.Page.Error, {})
|
1350
|
+
});
|
1351
|
+
}
|
1352
|
+
return /*#__PURE__*/ jsxRuntime.jsx(designSystem.Box, {
|
1353
|
+
height: "100vh",
|
1354
|
+
width: "100vw",
|
1355
|
+
position: "fixed",
|
1356
|
+
top: 0,
|
1357
|
+
left: 0,
|
1358
|
+
zIndex: 2,
|
1359
|
+
background: "neutral0",
|
1360
|
+
children: /*#__PURE__*/ jsxRuntime.jsx(strapiAdmin.Page.Protect, {
|
1361
|
+
permissions: permissions,
|
1362
|
+
children: ({ permissions })=>/*#__PURE__*/ jsxRuntime.jsx(index.DocumentRBAC, {
|
1363
|
+
permissions: permissions,
|
1364
|
+
children: /*#__PURE__*/ jsxRuntime.jsx(HistoryPage, {})
|
1365
|
+
})
|
1366
|
+
})
|
1367
|
+
});
|
1368
|
+
};
|
1369
|
+
const ProtectedHistoryPage = ()=>{
|
1370
|
+
return /*#__PURE__*/ jsxRuntime.jsx(designSystem.Portal, {
|
1371
|
+
children: /*#__PURE__*/ jsxRuntime.jsx(designSystem.FocusTrap, {
|
1372
|
+
children: /*#__PURE__*/ jsxRuntime.jsx(ProtectedHistoryPageImpl, {})
|
1373
|
+
})
|
1374
|
+
});
|
1375
|
+
};
|
1376
|
+
|
1377
|
+
exports.HistoryProvider = HistoryProvider;
|
1378
|
+
exports.ProtectedHistoryPage = ProtectedHistoryPage;
|
1379
|
+
exports.useHistoryContext = useHistoryContext;
|
1380
|
+
//# sourceMappingURL=History-CQznK1pG.js.map
|