@strapi/content-manager 0.0.0-experimental.dd3311938ac827f1fa8560c8840a9a394f5896c0 → 0.0.0-experimental.e14656d3b8681880212c13260b9a2b340c182f2d
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-D_M8iBw5.js} +3 -3
- package/dist/_chunks/{ComponentConfigurationPage-y_7iLdmB.js.map → ComponentConfigurationPage-D_M8iBw5.js.map} +1 -1
- package/dist/_chunks/{ComponentConfigurationPage-BMajAl1u.mjs → ComponentConfigurationPage-qemkOlnj.mjs} +3 -3
- package/dist/_chunks/{ComponentConfigurationPage-BMajAl1u.mjs.map → ComponentConfigurationPage-qemkOlnj.mjs.map} +1 -1
- package/dist/_chunks/{EditConfigurationPage-CPVB8Uqc.js → EditConfigurationPage-BePwPuHy.js} +3 -3
- package/dist/_chunks/{EditConfigurationPage-CPVB8Uqc.js.map → EditConfigurationPage-BePwPuHy.js.map} +1 -1
- package/dist/_chunks/{EditConfigurationPage-CcOoD26O.mjs → EditConfigurationPage-CjUrEewK.mjs} +3 -3
- package/dist/_chunks/{EditConfigurationPage-CcOoD26O.mjs.map → EditConfigurationPage-CjUrEewK.mjs.map} +1 -1
- package/dist/_chunks/{EditViewPage-CTTDHKkQ.js → EditViewPage-B-RJeiJD.js} +57 -46
- package/dist/_chunks/EditViewPage-B-RJeiJD.js.map +1 -0
- package/dist/_chunks/{EditViewPage-DWb0DE7R.mjs → EditViewPage-De8GyU8P.mjs} +58 -47
- package/dist/_chunks/EditViewPage-De8GyU8P.mjs.map +1 -0
- package/dist/_chunks/{Field-C5Z1Ivdv.js → Field-dq8Tg1M_.js} +514 -168
- package/dist/_chunks/Field-dq8Tg1M_.js.map +1 -0
- package/dist/_chunks/{Field-DnStdvQw.mjs → Field-pb2o8uBe.mjs} +516 -170
- package/dist/_chunks/Field-pb2o8uBe.mjs.map +1 -0
- package/dist/_chunks/{Form-B81OtW-k.js → Form-DGIf4jQU.js} +38 -28
- package/dist/_chunks/Form-DGIf4jQU.js.map +1 -0
- package/dist/_chunks/{Form-DqGgE55Q.mjs → Form-DJn0Dxha.mjs} +40 -30
- package/dist/_chunks/Form-DJn0Dxha.mjs.map +1 -0
- package/dist/_chunks/{History-DS6-HCYX.mjs → History-BowL3JKP.mjs} +52 -29
- package/dist/_chunks/History-BowL3JKP.mjs.map +1 -0
- package/dist/_chunks/{History-4NbOq2dX.js → History-Dh2NEHnR.js} +51 -28
- package/dist/_chunks/History-Dh2NEHnR.js.map +1 -0
- package/dist/_chunks/{ListConfigurationPage-DQJJltko.mjs → ListConfigurationPage-BpVOB-hn.mjs} +58 -48
- package/dist/_chunks/ListConfigurationPage-BpVOB-hn.mjs.map +1 -0
- package/dist/_chunks/{ListConfigurationPage-CpfstlYY.js → ListConfigurationPage-BxYCWz9e.js} +57 -46
- package/dist/_chunks/ListConfigurationPage-BxYCWz9e.js.map +1 -0
- package/dist/_chunks/{ListViewPage-CA3I75m5.js → ListViewPage-4XsciqHZ.js} +65 -68
- package/dist/_chunks/ListViewPage-4XsciqHZ.js.map +1 -0
- package/dist/_chunks/{ListViewPage-nQrOQuVo.mjs → ListViewPage-CXFUjZQC.mjs} +67 -70
- package/dist/_chunks/ListViewPage-CXFUjZQC.mjs.map +1 -0
- package/dist/_chunks/{NoContentTypePage-Dldu-_Mx.js → NoContentTypePage-C8OpoHeU.js} +2 -2
- package/dist/_chunks/{NoContentTypePage-Dldu-_Mx.js.map → NoContentTypePage-C8OpoHeU.js.map} +1 -1
- package/dist/_chunks/{NoContentTypePage-DbnHE22g.mjs → NoContentTypePage-DuhOTp3x.mjs} +2 -2
- package/dist/_chunks/{NoContentTypePage-DbnHE22g.mjs.map → NoContentTypePage-DuhOTp3x.mjs.map} +1 -1
- package/dist/_chunks/{NoPermissionsPage-fOIkQM0v.mjs → NoPermissionsPage-DVz3mzDz.mjs} +2 -2
- package/dist/_chunks/{NoPermissionsPage-fOIkQM0v.mjs.map → NoPermissionsPage-DVz3mzDz.mjs.map} +1 -1
- package/dist/_chunks/{NoPermissionsPage-CO2MK200.js → NoPermissionsPage-y_r7DVA2.js} +2 -2
- package/dist/_chunks/{NoPermissionsPage-CO2MK200.js.map → NoPermissionsPage-y_r7DVA2.js.map} +1 -1
- package/dist/_chunks/{Relations-BDRl99Ux.mjs → Relations-CVNLrn1Y.mjs} +4 -4
- package/dist/_chunks/Relations-CVNLrn1Y.mjs.map +1 -0
- package/dist/_chunks/{Relations-DG2jnOcr.js → Relations-DPFCAa7b.js} +4 -4
- package/dist/_chunks/Relations-DPFCAa7b.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-C3fJE-1-.js} +465 -422
- package/dist/_chunks/index-C3fJE-1-.js.map +1 -0
- package/dist/_chunks/{index-Drt2DN7v.mjs → index-DiMrfcfy.mjs} +472 -429
- package/dist/_chunks/index-DiMrfcfy.mjs.map +1 -0
- package/dist/_chunks/{layout-DEYBqgF1.js → layout-C788OmNr.js} +23 -11
- package/dist/_chunks/layout-C788OmNr.js.map +1 -0
- package/dist/_chunks/{layout-BzAbmoO6.mjs → layout-ls3gxfpH.mjs} +25 -13
- package/dist/_chunks/layout-ls3gxfpH.mjs.map +1 -0
- package/dist/_chunks/{relations-D26zVRdi.mjs → relations-CLcOmGO0.mjs} +2 -2
- package/dist/_chunks/{relations-D26zVRdi.mjs.map → relations-CLcOmGO0.mjs.map} +1 -1
- package/dist/_chunks/{relations-D0eZ4VWw.js → relations-DYeotliT.js} +2 -2
- package/dist/_chunks/{relations-D0eZ4VWw.js.map → relations-DYeotliT.js.map} +1 -1
- package/dist/admin/index.js +1 -1
- package/dist/admin/index.mjs +1 -1
- package/dist/admin/src/history/index.d.ts +3 -0
- package/dist/admin/src/history/services/historyVersion.d.ts +1 -1
- package/dist/admin/src/index.d.ts +1 -0
- 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/EditorLayout.d.ts +2 -2
- package/dist/admin/src/pages/EditView/components/FormInputs/Wysiwyg/WysiwygFooter.d.ts +2 -2
- package/dist/admin/src/pages/EditView/components/FormInputs/Wysiwyg/WysiwygStyles.d.ts +12 -32
- 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/admin/src/services/api.d.ts +1 -1
- package/dist/admin/src/services/components.d.ts +2 -2
- package/dist/admin/src/services/contentTypes.d.ts +3 -3
- package/dist/admin/src/services/documents.d.ts +16 -16
- package/dist/admin/src/services/init.d.ts +1 -1
- package/dist/admin/src/services/relations.d.ts +2 -2
- package/dist/admin/src/services/uid.d.ts +3 -3
- package/dist/admin/src/utils/validation.d.ts +4 -1
- package/dist/server/index.js +166 -108
- package/dist/server/index.js.map +1 -1
- package/dist/server/index.mjs +167 -109
- package/dist/server/index.mjs.map +1 -1
- package/dist/server/src/controllers/collection-types.d.ts.map +1 -1
- package/dist/server/src/controllers/relations.d.ts.map +1 -1
- package/dist/server/src/controllers/uid.d.ts.map +1 -1
- package/dist/server/src/controllers/validation/dimensions.d.ts +4 -2
- package/dist/server/src/controllers/validation/dimensions.d.ts.map +1 -1
- package/dist/server/src/history/services/lifecycles.d.ts.map +1 -1
- package/dist/server/src/history/services/utils.d.ts +1 -1
- package/dist/server/src/history/services/utils.d.ts.map +1 -1
- package/dist/server/src/policies/hasPermissions.d.ts.map +1 -1
- package/dist/server/src/services/document-manager.d.ts.map +1 -1
- package/dist/server/src/services/document-metadata.d.ts.map +1 -1
- package/dist/server/src/services/permission-checker.d.ts.map +1 -1
- package/dist/server/src/services/utils/populate.d.ts.map +1 -1
- package/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
@@ -1,12 +1,12 @@
|
|
1
1
|
import { jsx, jsxs, Fragment } from "react/jsx-runtime";
|
2
2
|
import * as React from "react";
|
3
3
|
import { useQueryParams, useNotification, Page, Form, Blocker, useRBAC } from "@strapi/admin/strapi-admin";
|
4
|
-
import { Flex, Grid,
|
4
|
+
import { Flex, Grid, Box, Main, Tabs } from "@strapi/design-system";
|
5
5
|
import { useIntl } from "react-intl";
|
6
6
|
import { useLocation, useParams } from "react-router-dom";
|
7
7
|
import { styled } from "styled-components";
|
8
|
-
import { c as useDoc, f as useDocumentRBAC, h as useDocumentLayout, i as createYupSchema, j as Header, g as getTranslation, P as Panels, k as PERMISSIONS, l as DocumentRBAC, S as SINGLE_TYPES } from "./index-
|
9
|
-
import { M as MemoizedInputRenderer, u as useLazyComponents, c as createDefaultForm, t as transformDocument } from "./Field-
|
8
|
+
import { c as useDoc, f as useDocumentRBAC, h as useDocumentLayout, i as createYupSchema, j as Header, g as getTranslation, P as Panels, k as PERMISSIONS, l as DocumentRBAC, S as SINGLE_TYPES } from "./index-DiMrfcfy.mjs";
|
9
|
+
import { M as MemoizedInputRenderer, u as useLazyComponents, c as createDefaultForm, t as transformDocument } from "./Field-pb2o8uBe.mjs";
|
10
10
|
const useOnce = (effect) => React.useEffect(effect, emptyDeps);
|
11
11
|
const emptyDeps = [];
|
12
12
|
const FormLayout = ({ layout }) => {
|
@@ -14,7 +14,7 @@ const FormLayout = ({ layout }) => {
|
|
14
14
|
if (panel.some((row) => row.some((field) => field.type === "dynamiczone"))) {
|
15
15
|
const [row] = panel;
|
16
16
|
const [field] = row;
|
17
|
-
return /* @__PURE__ */ jsx(Grid, { gap: 4, children: /* @__PURE__ */ jsx(
|
17
|
+
return /* @__PURE__ */ jsx(Grid.Root, { gap: 4, children: /* @__PURE__ */ jsx(Grid.Item, { col: 12, s: 12, xs: 12, direction: "column", alignItems: "stretch", children: /* @__PURE__ */ jsx(MemoizedInputRenderer, { ...field }) }) }, field.name);
|
18
18
|
}
|
19
19
|
return /* @__PURE__ */ jsx(
|
20
20
|
Box,
|
@@ -27,8 +27,19 @@ const FormLayout = ({ layout }) => {
|
|
27
27
|
paddingTop: 6,
|
28
28
|
paddingBottom: 6,
|
29
29
|
borderColor: "neutral150",
|
30
|
-
children: /* @__PURE__ */ jsx(Flex, { direction: "column", alignItems: "stretch", gap: 6, children: panel.map((row, gridRowIndex) => /* @__PURE__ */ jsx(Grid, { gap: 4, children: row.map(({ size, ...field }) => {
|
31
|
-
return /* @__PURE__ */ jsx(
|
30
|
+
children: /* @__PURE__ */ jsx(Flex, { direction: "column", alignItems: "stretch", gap: 6, children: panel.map((row, gridRowIndex) => /* @__PURE__ */ jsx(Grid.Root, { gap: 4, children: row.map(({ size, ...field }) => {
|
31
|
+
return /* @__PURE__ */ jsx(
|
32
|
+
Grid.Item,
|
33
|
+
{
|
34
|
+
col: size,
|
35
|
+
s: 12,
|
36
|
+
xs: 12,
|
37
|
+
direction: "column",
|
38
|
+
alignItems: "stretch",
|
39
|
+
children: /* @__PURE__ */ jsx(MemoizedInputRenderer, { ...field })
|
40
|
+
},
|
41
|
+
field.name
|
42
|
+
);
|
32
43
|
}) }, gridRowIndex)) })
|
33
44
|
},
|
34
45
|
index
|
@@ -42,10 +53,11 @@ const EditViewPage = () => {
|
|
42
53
|
query: { status }
|
43
54
|
},
|
44
55
|
setQuery
|
45
|
-
] = useQueryParams(
|
56
|
+
] = useQueryParams({
|
57
|
+
status: "draft"
|
58
|
+
});
|
46
59
|
const { formatMessage } = useIntl();
|
47
60
|
const { toggleNotification } = useNotification();
|
48
|
-
const tabApi = React.useRef(null);
|
49
61
|
const {
|
50
62
|
document,
|
51
63
|
meta,
|
@@ -91,11 +103,9 @@ const EditViewPage = () => {
|
|
91
103
|
if (!initialValues) {
|
92
104
|
return /* @__PURE__ */ jsx(Page.Error, {});
|
93
105
|
}
|
94
|
-
const handleTabChange = (
|
95
|
-
if (
|
96
|
-
setQuery({ status:
|
97
|
-
} else {
|
98
|
-
setQuery({ status: "published" }, "push", true);
|
106
|
+
const handleTabChange = (status2) => {
|
107
|
+
if (status2 === "published" || status2 === "draft") {
|
108
|
+
setQuery({ status: status2 }, "push", true);
|
99
109
|
}
|
100
110
|
};
|
101
111
|
const documentTitle = mainField !== "id" && document?.[mainField] ? document[mainField] : "Untitled";
|
@@ -107,7 +117,7 @@ const EditViewPage = () => {
|
|
107
117
|
disabled: hasDraftAndPublished && status === "published",
|
108
118
|
initialValues,
|
109
119
|
method: isCreatingDocument ? "POST" : "PUT",
|
110
|
-
validationSchema: createYupSchema(schema?.attributes, components),
|
120
|
+
validationSchema: createYupSchema(schema?.attributes, components, { status }),
|
111
121
|
children: ({ resetForm }) => /* @__PURE__ */ jsxs(Fragment, { children: [
|
112
122
|
/* @__PURE__ */ jsx(
|
113
123
|
Header,
|
@@ -117,40 +127,41 @@ const EditViewPage = () => {
|
|
117
127
|
title: documentTitle
|
118
128
|
}
|
119
129
|
),
|
120
|
-
/* @__PURE__ */ jsxs(
|
121
|
-
|
122
|
-
|
123
|
-
|
124
|
-
|
125
|
-
|
126
|
-
|
127
|
-
|
128
|
-
|
129
|
-
|
130
|
-
onTabChange: (index) => {
|
131
|
-
handleTabChange(index);
|
132
|
-
},
|
133
|
-
children: [
|
134
|
-
hasDraftAndPublished ? /* @__PURE__ */ jsxs(Tabs, { children: [
|
135
|
-
/* @__PURE__ */ jsx(StatusTab, { children: formatMessage({
|
130
|
+
/* @__PURE__ */ jsxs(Tabs.Root, { variant: "simple", value: status, onValueChange: handleTabChange, children: [
|
131
|
+
/* @__PURE__ */ jsx(
|
132
|
+
Tabs.List,
|
133
|
+
{
|
134
|
+
"aria-label": formatMessage({
|
135
|
+
id: getTranslation("containers.edit.tabs.label"),
|
136
|
+
defaultMessage: "Document status"
|
137
|
+
}),
|
138
|
+
children: hasDraftAndPublished ? /* @__PURE__ */ jsxs(Fragment, { children: [
|
139
|
+
/* @__PURE__ */ jsx(StatusTab, { value: "draft", children: formatMessage({
|
136
140
|
id: getTranslation("containers.edit.tabs.draft"),
|
137
141
|
defaultMessage: "draft"
|
138
142
|
}) }),
|
139
|
-
/* @__PURE__ */ jsx(
|
140
|
-
|
141
|
-
|
142
|
-
|
143
|
-
|
144
|
-
|
145
|
-
|
146
|
-
|
147
|
-
|
148
|
-
|
149
|
-
|
150
|
-
] })
|
151
|
-
|
152
|
-
|
153
|
-
|
143
|
+
/* @__PURE__ */ jsx(
|
144
|
+
StatusTab,
|
145
|
+
{
|
146
|
+
disabled: !meta || meta.availableStatus.length === 0,
|
147
|
+
value: "published",
|
148
|
+
children: formatMessage({
|
149
|
+
id: getTranslation("containers.edit.tabs.published"),
|
150
|
+
defaultMessage: "published"
|
151
|
+
})
|
152
|
+
}
|
153
|
+
)
|
154
|
+
] }) : null
|
155
|
+
}
|
156
|
+
),
|
157
|
+
/* @__PURE__ */ jsxs(Grid.Root, { paddingTop: 8, gap: 4, children: [
|
158
|
+
/* @__PURE__ */ jsxs(Grid.Item, { col: 9, s: 12, direction: "column", alignItems: "stretch", children: [
|
159
|
+
/* @__PURE__ */ jsx(Tabs.Content, { value: "draft", children: /* @__PURE__ */ jsx(FormLayout, { layout }) }),
|
160
|
+
/* @__PURE__ */ jsx(Tabs.Content, { value: "published", children: /* @__PURE__ */ jsx(FormLayout, { layout }) })
|
161
|
+
] }),
|
162
|
+
/* @__PURE__ */ jsx(Grid.Item, { col: 3, s: 12, direction: "column", alignItems: "stretch", children: /* @__PURE__ */ jsx(Panels, {}) })
|
163
|
+
] })
|
164
|
+
] }),
|
154
165
|
/* @__PURE__ */ jsx(
|
155
166
|
Blocker,
|
156
167
|
{
|
@@ -162,7 +173,7 @@ const EditViewPage = () => {
|
|
162
173
|
)
|
163
174
|
] });
|
164
175
|
};
|
165
|
-
const StatusTab = styled(
|
176
|
+
const StatusTab = styled(Tabs.Trigger)`
|
166
177
|
text-transform: uppercase;
|
167
178
|
`;
|
168
179
|
const getDocumentStatus = (document, meta) => {
|
@@ -200,4 +211,4 @@ export {
|
|
200
211
|
EditViewPage,
|
201
212
|
ProtectedEditViewPage
|
202
213
|
};
|
203
|
-
//# sourceMappingURL=EditViewPage-
|
214
|
+
//# sourceMappingURL=EditViewPage-De8GyU8P.mjs.map
|
@@ -0,0 +1 @@
|
|
1
|
+
{"version":3,"file":"EditViewPage-De8GyU8P.mjs","sources":["../../admin/src/hooks/useOnce.ts","../../admin/src/pages/EditView/components/FormLayout.tsx","../../admin/src/pages/EditView/EditViewPage.tsx"],"sourcesContent":["/* eslint-disable react-hooks/exhaustive-deps */\nimport * as React from 'react';\n\nexport const useOnce = (effect: React.EffectCallback) => React.useEffect(effect, emptyDeps);\n\nconst emptyDeps: React.DependencyList = [];\n","import { Box, Flex, Grid } from '@strapi/design-system';\n\nimport { EditLayout } from '../../../hooks/useDocumentLayout';\n\nimport { InputRenderer } from './InputRenderer';\n\ninterface FormLayoutProps extends Pick<EditLayout, 'layout'> {}\n\nconst FormLayout = ({ layout }: FormLayoutProps) => {\n return (\n <Flex direction=\"column\" alignItems=\"stretch\" gap={6}>\n {layout.map((panel, index) => {\n if (panel.some((row) => row.some((field) => field.type === 'dynamiczone'))) {\n const [row] = panel;\n const [field] = row;\n return (\n <Grid.Root key={field.name} gap={4}>\n <Grid.Item col={12} s={12} xs={12} direction=\"column\" alignItems=\"stretch\">\n <InputRenderer {...field} />\n </Grid.Item>\n </Grid.Root>\n );\n }\n\n return (\n <Box\n key={index}\n hasRadius\n background=\"neutral0\"\n shadow=\"tableShadow\"\n paddingLeft={6}\n paddingRight={6}\n paddingTop={6}\n paddingBottom={6}\n borderColor=\"neutral150\"\n >\n <Flex direction=\"column\" alignItems=\"stretch\" gap={6}>\n {panel.map((row, gridRowIndex) => (\n <Grid.Root key={gridRowIndex} gap={4}>\n {row.map(({ size, ...field }) => {\n return (\n <Grid.Item\n col={size}\n key={field.name}\n s={12}\n xs={12}\n direction=\"column\"\n alignItems=\"stretch\"\n >\n <InputRenderer {...field} />\n </Grid.Item>\n );\n })}\n </Grid.Root>\n ))}\n </Flex>\n </Box>\n );\n })}\n </Flex>\n );\n};\n\nexport { FormLayout, FormLayoutProps };\n","import * as React from 'react';\n\nimport {\n Page,\n Blocker,\n Form,\n useRBAC,\n useNotification,\n useQueryParams,\n} from '@strapi/admin/strapi-admin';\nimport { Grid, Main, Tabs } from '@strapi/design-system';\nimport { useIntl } from 'react-intl';\nimport { useLocation, useParams } from 'react-router-dom';\nimport { styled } from 'styled-components';\n\nimport { SINGLE_TYPES } from '../../constants/collections';\nimport { PERMISSIONS } from '../../constants/plugin';\nimport { DocumentRBAC, useDocumentRBAC } from '../../features/DocumentRBAC';\nimport { type UseDocument, useDoc } from '../../hooks/useDocument';\nimport { useDocumentLayout } from '../../hooks/useDocumentLayout';\nimport { useLazyComponents } from '../../hooks/useLazyComponents';\nimport { useOnce } from '../../hooks/useOnce';\nimport { getTranslation } from '../../utils/translations';\nimport { createYupSchema } from '../../utils/validation';\n\nimport { FormLayout } from './components/FormLayout';\nimport { Header } from './components/Header';\nimport { Panels } from './components/Panels';\nimport { transformDocument } from './utils/data';\nimport { createDefaultForm } from './utils/forms';\n\n/* -------------------------------------------------------------------------------------------------\n * EditViewPage\n * -----------------------------------------------------------------------------------------------*/\n\nconst EditViewPage = () => {\n const location = useLocation();\n const [\n {\n query: { status },\n },\n setQuery,\n ] = useQueryParams<{ status: 'draft' | 'published' }>({\n status: 'draft',\n });\n const { formatMessage } = useIntl();\n const { toggleNotification } = useNotification();\n\n const {\n document,\n meta,\n isLoading: isLoadingDocument,\n schema,\n components,\n collectionType,\n id,\n model,\n } = useDoc();\n\n const hasDraftAndPublished = schema?.options?.draftAndPublish ?? false;\n\n useOnce(() => {\n /**\n * We only ever want to fire the notification once otherwise\n * whenever the app re-renders it'll pop up regardless of\n * what we do because the state comes from react-router-dom\n */\n if (location?.state && 'error' in location.state) {\n toggleNotification({\n type: 'danger',\n message: location.state.error,\n timeout: 5000,\n });\n }\n });\n\n const isLoadingActionsRBAC = useDocumentRBAC('EditViewPage', (state) => state.isLoading);\n\n const isSingleType = collectionType === SINGLE_TYPES;\n\n /**\n * single-types don't current have an id, but because they're a singleton\n * we can simply use the update operation to continuously update the same\n * document with varying params.\n */\n const isCreatingDocument = !id && !isSingleType;\n\n const {\n isLoading: isLoadingLayout,\n edit: {\n layout,\n settings: { mainField },\n },\n } = useDocumentLayout(model);\n\n const { isLazyLoading } = useLazyComponents([]);\n\n const isLoading = isLoadingActionsRBAC || isLoadingDocument || isLoadingLayout || isLazyLoading;\n\n /**\n * Here we prepare the form for editing, we need to:\n * - remove prohibited fields from the document (passwords | ADD YOURS WHEN THERES A NEW ONE)\n * - swap out count objects on relations for empty arrays\n * - set __temp_key__ on array objects for drag & drop\n *\n * We also prepare the form for new documents, so we need to:\n * - set default values on fields\n */\n const initialValues = React.useMemo(() => {\n if ((!document && !isCreatingDocument && !isSingleType) || !schema) {\n return undefined;\n }\n\n /**\n * Check that we have an ID so we know the\n * document has been created in some way.\n */\n const form = document?.id ? document : createDefaultForm(schema, components);\n\n return transformDocument(schema, components)(form);\n }, [document, isCreatingDocument, isSingleType, schema, components]);\n\n if (isLoading && !document?.documentId) {\n return <Page.Loading />;\n }\n\n if (!initialValues) {\n return <Page.Error />;\n }\n\n const handleTabChange = (status: string) => {\n if (status === 'published' || status === 'draft') {\n setQuery({ status }, 'push', true);\n }\n };\n\n /**\n * We look to see what the mainField is from the configuration,\n * if it's an id we don't use it because it's a uuid format and\n * not very user friendly. Instead in that case, we simply write \"Untitled\".\n */\n const documentTitle =\n mainField !== 'id' && document?.[mainField] ? document[mainField] : 'Untitled';\n\n return (\n <Main paddingLeft={10} paddingRight={10}>\n <Page.Title>{`${documentTitle}`}</Page.Title>\n <Form\n disabled={hasDraftAndPublished && status === 'published'}\n initialValues={initialValues}\n method={isCreatingDocument ? 'POST' : 'PUT'}\n validationSchema={createYupSchema(schema?.attributes, components, { status })}\n >\n {({ resetForm }) => (\n <>\n <Header\n isCreating={isCreatingDocument}\n status={hasDraftAndPublished ? getDocumentStatus(document, meta) : undefined}\n title={documentTitle}\n />\n <Tabs.Root variant=\"simple\" value={status} onValueChange={handleTabChange}>\n <Tabs.List\n aria-label={formatMessage({\n id: getTranslation('containers.edit.tabs.label'),\n defaultMessage: 'Document status',\n })}\n >\n {hasDraftAndPublished ? (\n <>\n <StatusTab value=\"draft\">\n {formatMessage({\n id: getTranslation('containers.edit.tabs.draft'),\n defaultMessage: 'draft',\n })}\n </StatusTab>\n <StatusTab\n disabled={!meta || meta.availableStatus.length === 0}\n value=\"published\"\n >\n {formatMessage({\n id: getTranslation('containers.edit.tabs.published'),\n defaultMessage: 'published',\n })}\n </StatusTab>\n </>\n ) : null}\n </Tabs.List>\n <Grid.Root paddingTop={8} gap={4}>\n <Grid.Item col={9} s={12} direction=\"column\" alignItems=\"stretch\">\n <Tabs.Content value=\"draft\">\n <FormLayout layout={layout} />\n </Tabs.Content>\n <Tabs.Content value=\"published\">\n <FormLayout layout={layout} />\n </Tabs.Content>\n </Grid.Item>\n <Grid.Item col={3} s={12} direction=\"column\" alignItems=\"stretch\">\n <Panels />\n </Grid.Item>\n </Grid.Root>\n </Tabs.Root>\n <Blocker\n // We reset the form to the published version to avoid errors like – https://strapi-inc.atlassian.net/browse/CONTENT-2284\n onProceed={resetForm}\n />\n </>\n )}\n </Form>\n </Main>\n );\n};\n\nconst StatusTab = styled(Tabs.Trigger)`\n text-transform: uppercase;\n`;\n\n/**\n * @internal\n * @description Returns the status of the document where it's latest state takes priority,\n * this typically will be \"published\" unless a user has edited their draft in which we should\n * display \"modified\".\n */\nconst getDocumentStatus = (\n document: ReturnType<UseDocument>['document'],\n meta: ReturnType<UseDocument>['meta']\n): 'draft' | 'published' | 'modified' => {\n const docStatus = document?.status;\n const statuses = meta?.availableStatus ?? [];\n\n /**\n * Creating an entry\n */\n if (!docStatus) {\n return 'draft';\n }\n\n /**\n * We're viewing a draft, but the document could have a published version\n */\n if (docStatus === 'draft' && statuses.find((doc) => doc.publishedAt !== null)) {\n return 'published';\n }\n\n return docStatus;\n};\n\n/* -------------------------------------------------------------------------------------------------\n * ProtectedEditViewPage\n * -----------------------------------------------------------------------------------------------*/\n\nconst ProtectedEditViewPage = () => {\n const { slug = '' } = useParams<{\n slug: string;\n }>();\n const {\n permissions = [],\n isLoading,\n error,\n } = useRBAC(\n PERMISSIONS.map((action) => ({\n action,\n subject: slug,\n }))\n );\n\n if (isLoading) {\n return <Page.Loading />;\n }\n\n if (error || !slug) {\n return <Page.Error />;\n }\n\n return (\n <Page.Protect permissions={permissions}>\n {({ permissions }) => (\n <DocumentRBAC permissions={permissions}>\n <EditViewPage />\n </DocumentRBAC>\n )}\n </Page.Protect>\n );\n};\n\nexport { EditViewPage, ProtectedEditViewPage };\n"],"names":["InputRenderer","status","permissions"],"mappings":";;;;;;;;;AAGO,MAAM,UAAU,CAAC,WAAiC,MAAM,UAAU,QAAQ,SAAS;AAE1F,MAAM,YAAkC,CAAC;ACGzC,MAAM,aAAa,CAAC,EAAE,aAA8B;AAClD,SACG,oBAAA,MAAA,EAAK,WAAU,UAAS,YAAW,WAAU,KAAK,GAChD,UAAO,OAAA,IAAI,CAAC,OAAO,UAAU;AAC5B,QAAI,MAAM,KAAK,CAAC,QAAQ,IAAI,KAAK,CAAC,UAAU,MAAM,SAAS,aAAa,CAAC,GAAG;AACpE,YAAA,CAAC,GAAG,IAAI;AACR,YAAA,CAAC,KAAK,IAAI;AAEd,aAAA,oBAAC,KAAK,MAAL,EAA2B,KAAK,GAC/B,UAAA,oBAAC,KAAK,MAAL,EAAU,KAAK,IAAI,GAAG,IAAI,IAAI,IAAI,WAAU,UAAS,YAAW,WAC/D,UAAA,oBAACA,uBAAe,EAAA,GAAG,MAAO,CAAA,EAC5B,CAAA,EAHc,GAAA,MAAM,IAItB;AAAA,IAEJ;AAGE,WAAA;AAAA,MAAC;AAAA,MAAA;AAAA,QAEC,WAAS;AAAA,QACT,YAAW;AAAA,QACX,QAAO;AAAA,QACP,aAAa;AAAA,QACb,cAAc;AAAA,QACd,YAAY;AAAA,QACZ,eAAe;AAAA,QACf,aAAY;AAAA,QAEZ,UAAA,oBAAC,MAAK,EAAA,WAAU,UAAS,YAAW,WAAU,KAAK,GAChD,UAAA,MAAM,IAAI,CAAC,KAAK,qCACd,KAAK,MAAL,EAA6B,KAAK,GAChC,UAAA,IAAI,IAAI,CAAC,EAAE,MAAM,GAAG,MAAA,MAAY;AAE7B,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