@strapi/content-type-builder 5.8.1 → 5.10.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/admin/chunks/ListView-CDnrvVrV.mjs +1184 -0
- package/dist/admin/chunks/ListView-CDnrvVrV.mjs.map +1 -0
- package/dist/admin/chunks/ListView-CQwvSbZH.js +1186 -0
- package/dist/admin/chunks/ListView-CQwvSbZH.js.map +1 -0
- package/dist/admin/chunks/ar-Df0f0-PT.js +52 -0
- package/dist/admin/chunks/ar-Df0f0-PT.js.map +1 -0
- package/dist/admin/chunks/ar-sRW9VFC-.mjs +49 -0
- package/dist/admin/chunks/ar-sRW9VFC-.mjs.map +1 -0
- package/dist/admin/chunks/cs-BpQ26jiq.mjs +136 -0
- package/dist/{_chunks/cs-ChL4LaFY.mjs.map → admin/chunks/cs-BpQ26jiq.mjs.map} +1 -1
- package/dist/admin/chunks/cs-DeTwqc7p.js +140 -0
- package/dist/{_chunks/cs-Ci3js5EC.js.map → admin/chunks/cs-DeTwqc7p.js.map} +1 -1
- package/dist/admin/chunks/de-BJkS06jF.js +194 -0
- package/dist/{_chunks/de-DnlblIOh.js.map → admin/chunks/de-BJkS06jF.js.map} +1 -1
- package/dist/admin/chunks/de-DSxx5_x-.mjs +190 -0
- package/dist/{_chunks/de-DsHQNzp2.mjs.map → admin/chunks/de-DSxx5_x-.mjs.map} +1 -1
- package/dist/admin/chunks/dk-BnjVZ7A_.mjs +180 -0
- package/dist/{_chunks/es-BE_zx2_w.mjs.map → admin/chunks/dk-BnjVZ7A_.mjs.map} +1 -1
- package/dist/admin/chunks/dk-CGm-qVH7.js +184 -0
- package/dist/{_chunks/dk-D3XnOjYz.js.map → admin/chunks/dk-CGm-qVH7.js.map} +1 -1
- package/dist/admin/chunks/en-BJUu34b0.js +217 -0
- package/dist/{_chunks/en-CXG5y_vo.js.map → admin/chunks/en-BJUu34b0.js.map} +1 -1
- package/dist/admin/chunks/en-Bhut8Yay.mjs +213 -0
- package/dist/{_chunks/en-jBwb53yg.mjs.map → admin/chunks/en-Bhut8Yay.mjs.map} +1 -1
- package/dist/admin/chunks/es-DG8g9igJ.mjs +180 -0
- package/dist/admin/chunks/es-DG8g9igJ.mjs.map +1 -0
- package/dist/admin/chunks/es-J8kvHlNy.js +184 -0
- package/dist/{_chunks/es-DL8lez9W.js.map → admin/chunks/es-J8kvHlNy.js.map} +1 -1
- package/dist/admin/chunks/fr-C6y35iY7.js +76 -0
- package/dist/admin/chunks/fr-C6y35iY7.js.map +1 -0
- package/dist/admin/chunks/fr-UpV34MHY.mjs +73 -0
- package/dist/admin/chunks/fr-UpV34MHY.mjs.map +1 -0
- package/dist/admin/chunks/id-BWM18ljw.mjs +163 -0
- package/dist/{_chunks/ru-DGSjru5m.mjs.map → admin/chunks/id-BWM18ljw.mjs.map} +1 -1
- package/dist/admin/chunks/id-BvxV6wLP.js +167 -0
- package/dist/{_chunks/ru-C8A_4j0w.js.map → admin/chunks/id-BvxV6wLP.js.map} +1 -1
- package/dist/admin/chunks/index-BQ2VO38W.js +7781 -0
- package/dist/admin/chunks/index-BQ2VO38W.js.map +1 -0
- package/dist/admin/chunks/index-BZeN5KRn.js +1421 -0
- package/dist/admin/chunks/index-BZeN5KRn.js.map +1 -0
- package/dist/admin/chunks/index-BhX2euW0.mjs +1384 -0
- package/dist/admin/chunks/index-BhX2euW0.mjs.map +1 -0
- package/dist/admin/chunks/index-Cr5tfW7U.mjs +7754 -0
- package/dist/admin/chunks/index-Cr5tfW7U.mjs.map +1 -0
- package/dist/admin/chunks/it-1_vd9gV4.mjs +164 -0
- package/dist/{_chunks/tr-DsUerr-c.mjs.map → admin/chunks/it-1_vd9gV4.mjs.map} +1 -1
- package/dist/admin/chunks/it-C_IgFU-G.js +168 -0
- package/dist/{_chunks/sk-raWRcmPT.js.map → admin/chunks/it-C_IgFU-G.js.map} +1 -1
- package/dist/admin/chunks/ja-CWo4Qqq6.js +51 -0
- package/dist/admin/chunks/ja-CWo4Qqq6.js.map +1 -0
- package/dist/admin/chunks/ja-Cx23a2Ui.mjs +48 -0
- package/dist/admin/chunks/ja-Cx23a2Ui.mjs.map +1 -0
- package/dist/admin/chunks/ko-BsByJNEl.js +184 -0
- package/dist/admin/chunks/ko-BsByJNEl.js.map +1 -0
- package/dist/admin/chunks/ko-DC7paEx5.mjs +180 -0
- package/dist/admin/chunks/ko-DC7paEx5.mjs.map +1 -0
- package/dist/admin/chunks/ms-C3s4kxq6.mjs +160 -0
- package/dist/{_chunks/id-W1sKBFEw.mjs.map → admin/chunks/ms-C3s4kxq6.mjs.map} +1 -1
- package/dist/admin/chunks/ms-DPTzS7SH.js +164 -0
- package/dist/{_chunks/th-C83Bb_kR.js.map → admin/chunks/ms-DPTzS7SH.js.map} +1 -1
- package/dist/admin/chunks/nl-TzvfktV_.mjs +153 -0
- package/dist/{_chunks/nl-BaTAuelQ.mjs.map → admin/chunks/nl-TzvfktV_.mjs.map} +1 -1
- package/dist/admin/chunks/nl-db29QMOx.js +157 -0
- package/dist/{_chunks/nl-DQjrDEw0.js.map → admin/chunks/nl-db29QMOx.js.map} +1 -1
- package/dist/admin/chunks/pl-BdvupIN_.mjs +190 -0
- package/dist/admin/chunks/pl-BdvupIN_.mjs.map +1 -0
- package/dist/admin/chunks/pl-pYy1djj3.js +194 -0
- package/dist/admin/chunks/pl-pYy1djj3.js.map +1 -0
- package/dist/admin/chunks/pt-BQmWcdeG.js +52 -0
- package/dist/admin/chunks/pt-BQmWcdeG.js.map +1 -0
- package/dist/admin/chunks/pt-BR-CTPuXGWF.js +194 -0
- package/dist/{_chunks/pt-BR-DPd5nRnl.js.map → admin/chunks/pt-BR-CTPuXGWF.js.map} +1 -1
- package/dist/admin/chunks/pt-BR-DPrVmKeZ.mjs +190 -0
- package/dist/{_chunks/pt-BR-CCQGwXs0.mjs.map → admin/chunks/pt-BR-DPrVmKeZ.mjs.map} +1 -1
- package/dist/admin/chunks/pt-BTLIwmCv.mjs +49 -0
- package/dist/admin/chunks/pt-BTLIwmCv.mjs.map +1 -0
- package/dist/admin/chunks/ru-D46no502.mjs +165 -0
- package/dist/{_chunks/dk-BC7NAQR2.mjs.map → admin/chunks/ru-D46no502.mjs.map} +1 -1
- package/dist/admin/chunks/ru-DQiDXgUV.js +169 -0
- package/dist/admin/chunks/ru-DQiDXgUV.js.map +1 -0
- package/dist/admin/chunks/sk-Byr_l4Jc.mjs +164 -0
- package/dist/{_chunks/ko-DoNsXHXA.mjs.map → admin/chunks/sk-Byr_l4Jc.mjs.map} +1 -1
- package/dist/admin/chunks/sk-DrnebmXb.js +168 -0
- package/dist/{_chunks/it-DS4sM3km.js.map → admin/chunks/sk-DrnebmXb.js.map} +1 -1
- package/dist/admin/chunks/sv-Bbam7IDm.mjs +199 -0
- package/dist/admin/chunks/sv-Bbam7IDm.mjs.map +1 -0
- package/dist/admin/chunks/sv-CrWlNosi.js +203 -0
- package/dist/admin/chunks/sv-CrWlNosi.js.map +1 -0
- package/dist/admin/chunks/th-BbrCkfgX.js +165 -0
- package/dist/{_chunks/id-DYuTgqcc.js.map → admin/chunks/th-BbrCkfgX.js.map} +1 -1
- package/dist/admin/chunks/th-hfS0Wmk_.mjs +161 -0
- package/dist/{_chunks/it-D04lb2Wc.mjs.map → admin/chunks/th-hfS0Wmk_.mjs.map} +1 -1
- package/dist/admin/chunks/tr-CHdMj8m6.js +180 -0
- package/dist/admin/chunks/tr-CHdMj8m6.js.map +1 -0
- package/dist/admin/chunks/tr-DS7DBOhC.mjs +176 -0
- package/dist/admin/chunks/tr-DS7DBOhC.mjs.map +1 -0
- package/dist/admin/chunks/uk-BQEQ3weH.js +165 -0
- package/dist/{_chunks/uk-VwB0oiuV.js.map → admin/chunks/uk-BQEQ3weH.js.map} +1 -1
- package/dist/admin/chunks/uk-Cj8-BKeu.mjs +161 -0
- package/dist/{_chunks/sk-DVK4HfSC.mjs.map → admin/chunks/uk-Cj8-BKeu.mjs.map} +1 -1
- package/dist/admin/chunks/zh-BUVXH75-.mjs +199 -0
- package/dist/admin/chunks/zh-BUVXH75-.mjs.map +1 -0
- package/dist/admin/chunks/zh-CWj4avQA.js +203 -0
- package/dist/admin/chunks/zh-CWj4avQA.js.map +1 -0
- package/dist/admin/chunks/zh-Hans-BElOnuRb.mjs +144 -0
- package/dist/{_chunks/zh-Hans-Cc0M5PXr.mjs.map → admin/chunks/zh-Hans-BElOnuRb.mjs.map} +1 -1
- package/dist/admin/chunks/zh-Hans-lXbNiMp9.js +148 -0
- package/dist/{_chunks/zh-Hans-CLTLm_nt.js.map → admin/chunks/zh-Hans-lXbNiMp9.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 -7
- package/dist/admin/index.mjs.map +1 -1
- package/dist/admin/src/components/ContentTypeBuilderNav/useContentTypeBuilderMenu.d.ts +5 -2
- package/dist/admin/src/components/DataManagerProvider/reducer.d.ts +97 -6
- package/dist/admin/src/components/FormModal/reducer.d.ts +110 -4
- package/dist/admin/src/components/ListRow.d.ts +2 -1
- package/dist/admin/src/contexts/DataManagerContext.d.ts +4 -4
- package/dist/admin/src/index.d.ts +2 -1
- package/dist/admin/src/pages/ListView/LinkToCMSettingsView.d.ts +1 -2
- package/dist/admin/src/pluginId.d.ts +1 -1
- package/dist/admin/src/reducers.d.ts +8 -1
- package/dist/admin/src/types.d.ts +2 -5
- package/dist/server/index.js +2504 -2151
- package/dist/server/index.js.map +1 -1
- package/dist/server/index.mjs +2500 -2147
- package/dist/server/index.mjs.map +1 -1
- package/package.json +13 -10
- package/dist/_chunks/ListView-CsqdnKp3.mjs +0 -959
- package/dist/_chunks/ListView-CsqdnKp3.mjs.map +0 -1
- package/dist/_chunks/ListView-tgW460ly.js +0 -964
- package/dist/_chunks/ListView-tgW460ly.js.map +0 -1
- package/dist/_chunks/ar-BYDB75EB.mjs +0 -51
- package/dist/_chunks/ar-BYDB75EB.mjs.map +0 -1
- package/dist/_chunks/ar-OCxhAFUy.js +0 -51
- package/dist/_chunks/ar-OCxhAFUy.js.map +0 -1
- package/dist/_chunks/cs-ChL4LaFY.mjs +0 -139
- package/dist/_chunks/cs-Ci3js5EC.js +0 -139
- package/dist/_chunks/de-DnlblIOh.js +0 -193
- package/dist/_chunks/de-DsHQNzp2.mjs +0 -193
- package/dist/_chunks/dk-BC7NAQR2.mjs +0 -183
- package/dist/_chunks/dk-D3XnOjYz.js +0 -183
- package/dist/_chunks/en-CXG5y_vo.js +0 -216
- package/dist/_chunks/en-jBwb53yg.mjs +0 -216
- package/dist/_chunks/es-BE_zx2_w.mjs +0 -183
- package/dist/_chunks/es-DL8lez9W.js +0 -183
- package/dist/_chunks/fr-DnTxugIo.js +0 -75
- package/dist/_chunks/fr-DnTxugIo.js.map +0 -1
- package/dist/_chunks/fr-lU_OMJma.mjs +0 -75
- package/dist/_chunks/fr-lU_OMJma.mjs.map +0 -1
- package/dist/_chunks/id-DYuTgqcc.js +0 -166
- package/dist/_chunks/id-W1sKBFEw.mjs +0 -166
- package/dist/_chunks/index-AjJmuxjv.js +0 -1357
- package/dist/_chunks/index-AjJmuxjv.js.map +0 -1
- package/dist/_chunks/index-BhIIILgq.mjs +0 -6694
- package/dist/_chunks/index-BhIIILgq.mjs.map +0 -1
- package/dist/_chunks/index-D79WZLAU.js +0 -6730
- package/dist/_chunks/index-D79WZLAU.js.map +0 -1
- package/dist/_chunks/index-DIuvDpH9.mjs +0 -1331
- package/dist/_chunks/index-DIuvDpH9.mjs.map +0 -1
- package/dist/_chunks/it-D04lb2Wc.mjs +0 -167
- package/dist/_chunks/it-DS4sM3km.js +0 -167
- package/dist/_chunks/ja-BHLK_2_g.mjs +0 -50
- package/dist/_chunks/ja-BHLK_2_g.mjs.map +0 -1
- package/dist/_chunks/ja-BjouJgZf.js +0 -50
- package/dist/_chunks/ja-BjouJgZf.js.map +0 -1
- package/dist/_chunks/ko-D_71Pdfn.js +0 -183
- package/dist/_chunks/ko-D_71Pdfn.js.map +0 -1
- package/dist/_chunks/ko-DoNsXHXA.mjs +0 -183
- package/dist/_chunks/ms-BtGFDB9t.mjs +0 -163
- package/dist/_chunks/ms-BtGFDB9t.mjs.map +0 -1
- package/dist/_chunks/ms-Re1pSHmx.js +0 -163
- package/dist/_chunks/ms-Re1pSHmx.js.map +0 -1
- package/dist/_chunks/nl-BaTAuelQ.mjs +0 -156
- package/dist/_chunks/nl-DQjrDEw0.js +0 -156
- package/dist/_chunks/pl-BGwXgwH7.js +0 -193
- package/dist/_chunks/pl-BGwXgwH7.js.map +0 -1
- package/dist/_chunks/pl-CP2Zgp01.mjs +0 -193
- package/dist/_chunks/pl-CP2Zgp01.mjs.map +0 -1
- package/dist/_chunks/pt-BR-CCQGwXs0.mjs +0 -193
- package/dist/_chunks/pt-BR-DPd5nRnl.js +0 -193
- package/dist/_chunks/pt-CJoUDTHQ.js +0 -51
- package/dist/_chunks/pt-CJoUDTHQ.js.map +0 -1
- package/dist/_chunks/pt-DMeTMW2x.mjs +0 -51
- package/dist/_chunks/pt-DMeTMW2x.mjs.map +0 -1
- package/dist/_chunks/ru-C8A_4j0w.js +0 -168
- package/dist/_chunks/ru-DGSjru5m.mjs +0 -168
- package/dist/_chunks/sk-DVK4HfSC.mjs +0 -167
- package/dist/_chunks/sk-raWRcmPT.js +0 -167
- package/dist/_chunks/sv-BGb12eW3.mjs +0 -202
- package/dist/_chunks/sv-BGb12eW3.mjs.map +0 -1
- package/dist/_chunks/sv-BNN71SFE.js +0 -202
- package/dist/_chunks/sv-BNN71SFE.js.map +0 -1
- package/dist/_chunks/th--u3VqsON.mjs +0 -164
- package/dist/_chunks/th--u3VqsON.mjs.map +0 -1
- package/dist/_chunks/th-C83Bb_kR.js +0 -164
- package/dist/_chunks/tr-BW20CfcO.js +0 -179
- package/dist/_chunks/tr-BW20CfcO.js.map +0 -1
- package/dist/_chunks/tr-DsUerr-c.mjs +0 -179
- package/dist/_chunks/uk-Bx5IlOKX.mjs +0 -164
- package/dist/_chunks/uk-Bx5IlOKX.mjs.map +0 -1
- package/dist/_chunks/uk-VwB0oiuV.js +0 -164
- package/dist/_chunks/zh-BiOCwPJu.js +0 -202
- package/dist/_chunks/zh-BiOCwPJu.js.map +0 -1
- package/dist/_chunks/zh-CsUDN13W.mjs +0 -202
- package/dist/_chunks/zh-CsUDN13W.mjs.map +0 -1
- package/dist/_chunks/zh-Hans-CLTLm_nt.js +0 -147
- package/dist/_chunks/zh-Hans-Cc0M5PXr.mjs +0 -147
- package/dist/admin/src/components/DataManagerProvider/constants.d.ts +0 -17
- package/dist/admin/src/components/FormModal/constants.d.ts +0 -12
- package/dist/admin/src/pages/RecursivePath/RecursivePath.d.ts +0 -1
|
@@ -1,959 +0,0 @@
|
|
|
1
|
-
import { jsx, jsxs, Fragment as Fragment$1 } from "react/jsx-runtime";
|
|
2
|
-
import { useTracking, useRBAC, Layouts, BackButton } from "@strapi/admin/strapi-admin";
|
|
3
|
-
import { Box, Flex, Typography, Table, Thead, Tr as Tr$1, Th, Tbody, Td, EmptyStateLayout, Button, TFooter, IconButton } from "@strapi/design-system";
|
|
4
|
-
import { Cross, Plus, Pencil, Trash, Lock, ListPlus, Check } from "@strapi/icons";
|
|
5
|
-
import get from "lodash/get";
|
|
6
|
-
import has from "lodash/has";
|
|
7
|
-
import isEqual from "lodash/isEqual";
|
|
8
|
-
import upperFirst from "lodash/upperFirst";
|
|
9
|
-
import { useIntl } from "react-intl";
|
|
10
|
-
import { useNavigate, useMatch, unstable_usePrompt } from "react-router-dom";
|
|
11
|
-
import { styled } from "styled-components";
|
|
12
|
-
import { useState, createElement, Fragment, memo } from "react";
|
|
13
|
-
import { EmptyDocuments } from "@strapi/icons/symbols";
|
|
14
|
-
import { u as useDataManager, C as COMPONENT_ICONS, g as getTrad, a as useFormModalNavigation, A as AttributeIcon } from "./index-BhIIILgq.mjs";
|
|
15
|
-
const BoxWrapper$1 = styled(Box)`
|
|
16
|
-
table {
|
|
17
|
-
width: 100%;
|
|
18
|
-
white-space: nowrap;
|
|
19
|
-
}
|
|
20
|
-
|
|
21
|
-
thead {
|
|
22
|
-
border-bottom: 1px solid ${({ theme }) => theme.colors.neutral150};
|
|
23
|
-
|
|
24
|
-
tr {
|
|
25
|
-
border-top: 0;
|
|
26
|
-
}
|
|
27
|
-
}
|
|
28
|
-
|
|
29
|
-
tr {
|
|
30
|
-
border-top: 1px solid ${({ theme }) => theme.colors.neutral150};
|
|
31
|
-
|
|
32
|
-
& td,
|
|
33
|
-
& th {
|
|
34
|
-
padding: ${({ theme }) => theme.spaces[4]};
|
|
35
|
-
}
|
|
36
|
-
|
|
37
|
-
& td:first-of-type,
|
|
38
|
-
& th:first-of-type {
|
|
39
|
-
padding: 0 ${({ theme }) => theme.spaces[1]};
|
|
40
|
-
}
|
|
41
|
-
}
|
|
42
|
-
|
|
43
|
-
th,
|
|
44
|
-
td {
|
|
45
|
-
vertical-align: middle;
|
|
46
|
-
text-align: left;
|
|
47
|
-
color: ${({ theme }) => theme.colors.neutral600};
|
|
48
|
-
outline-offset: -4px;
|
|
49
|
-
}
|
|
50
|
-
`;
|
|
51
|
-
const Tr = styled.tr`
|
|
52
|
-
&.component-row,
|
|
53
|
-
&.dynamiczone-row {
|
|
54
|
-
position: relative;
|
|
55
|
-
border-top: none !important;
|
|
56
|
-
|
|
57
|
-
table tr:first-child {
|
|
58
|
-
border-top: none;
|
|
59
|
-
}
|
|
60
|
-
|
|
61
|
-
> td:first-of-type {
|
|
62
|
-
padding: 0 0 0 2rem;
|
|
63
|
-
position: relative;
|
|
64
|
-
|
|
65
|
-
&::before {
|
|
66
|
-
content: '';
|
|
67
|
-
width: 0.4rem;
|
|
68
|
-
height: calc(100% - 40px);
|
|
69
|
-
position: absolute;
|
|
70
|
-
top: -7px;
|
|
71
|
-
left: 2.6rem;
|
|
72
|
-
border-radius: 4px;
|
|
73
|
-
|
|
74
|
-
${({ $isFromDynamicZone, $isChildOfDynamicZone, theme }) => {
|
|
75
|
-
if ($isChildOfDynamicZone) {
|
|
76
|
-
return `background-color: ${theme.colors.primary200};`;
|
|
77
|
-
}
|
|
78
|
-
if ($isFromDynamicZone) {
|
|
79
|
-
return `background-color: ${theme.colors.primary200};`;
|
|
80
|
-
}
|
|
81
|
-
return `background: ${theme.colors.neutral150};`;
|
|
82
|
-
}}
|
|
83
|
-
}
|
|
84
|
-
}
|
|
85
|
-
}
|
|
86
|
-
|
|
87
|
-
&.dynamiczone-row > td:first-of-type {
|
|
88
|
-
padding: 0;
|
|
89
|
-
}
|
|
90
|
-
`;
|
|
91
|
-
const ComponentList = ({
|
|
92
|
-
customRowComponent,
|
|
93
|
-
component,
|
|
94
|
-
isFromDynamicZone = false,
|
|
95
|
-
isNestedInDZComponent = false,
|
|
96
|
-
firstLoopComponentUid
|
|
97
|
-
}) => {
|
|
98
|
-
const { modifiedData } = useDataManager();
|
|
99
|
-
const {
|
|
100
|
-
schema: { attributes }
|
|
101
|
-
} = get(modifiedData, ["components", component], {
|
|
102
|
-
schema: { attributes: [] }
|
|
103
|
-
});
|
|
104
|
-
return /* @__PURE__ */ jsx(Tr, { $isChildOfDynamicZone: isFromDynamicZone, className: "component-row", children: /* @__PURE__ */ jsx("td", { colSpan: 12, children: /* @__PURE__ */ jsx(
|
|
105
|
-
List,
|
|
106
|
-
{
|
|
107
|
-
customRowComponent,
|
|
108
|
-
items: attributes,
|
|
109
|
-
targetUid: component,
|
|
110
|
-
firstLoopComponentUid: firstLoopComponentUid || component,
|
|
111
|
-
editTarget: "components",
|
|
112
|
-
isFromDynamicZone,
|
|
113
|
-
isNestedInDZComponent,
|
|
114
|
-
isSub: true,
|
|
115
|
-
secondLoopComponentUid: firstLoopComponentUid ? component : null
|
|
116
|
-
}
|
|
117
|
-
) }) });
|
|
118
|
-
};
|
|
119
|
-
const ComponentIcon = ({ isActive = false, icon = "dashboard" }) => {
|
|
120
|
-
const Icon = COMPONENT_ICONS[icon] || COMPONENT_ICONS.dashboard;
|
|
121
|
-
return /* @__PURE__ */ jsx(
|
|
122
|
-
Flex,
|
|
123
|
-
{
|
|
124
|
-
alignItems: "center",
|
|
125
|
-
background: isActive ? "primary200" : "neutral200",
|
|
126
|
-
justifyContent: "center",
|
|
127
|
-
height: 8,
|
|
128
|
-
width: 8,
|
|
129
|
-
borderRadius: "50%",
|
|
130
|
-
children: /* @__PURE__ */ jsx(Icon, { height: "2rem", width: "2rem" })
|
|
131
|
-
}
|
|
132
|
-
);
|
|
133
|
-
};
|
|
134
|
-
const CloseButton = styled(Box)`
|
|
135
|
-
position: absolute;
|
|
136
|
-
display: none;
|
|
137
|
-
top: 5px;
|
|
138
|
-
right: 0.8rem;
|
|
139
|
-
|
|
140
|
-
svg {
|
|
141
|
-
width: 1rem;
|
|
142
|
-
height: 1rem;
|
|
143
|
-
|
|
144
|
-
path {
|
|
145
|
-
fill: ${({ theme }) => theme.colors.primary600};
|
|
146
|
-
}
|
|
147
|
-
}
|
|
148
|
-
`;
|
|
149
|
-
const ComponentBox = styled(Flex)`
|
|
150
|
-
width: 14rem;
|
|
151
|
-
height: 8rem;
|
|
152
|
-
position: relative;
|
|
153
|
-
border: 1px solid ${({ theme }) => theme.colors.neutral200};
|
|
154
|
-
background: ${({ theme }) => theme.colors.neutral100};
|
|
155
|
-
border-radius: ${({ theme }) => theme.borderRadius};
|
|
156
|
-
max-width: 100%;
|
|
157
|
-
|
|
158
|
-
&.active,
|
|
159
|
-
&:focus,
|
|
160
|
-
&:hover {
|
|
161
|
-
border: 1px solid ${({ theme }) => theme.colors.primary200};
|
|
162
|
-
background: ${({ theme }) => theme.colors.primary100};
|
|
163
|
-
color: ${({ theme }) => theme.colors.primary600};
|
|
164
|
-
|
|
165
|
-
${CloseButton} {
|
|
166
|
-
display: block;
|
|
167
|
-
}
|
|
168
|
-
|
|
169
|
-
/* > ComponentIcon */
|
|
170
|
-
> div:first-child {
|
|
171
|
-
background: ${({ theme }) => theme.colors.primary200};
|
|
172
|
-
color: ${({ theme }) => theme.colors.primary600};
|
|
173
|
-
|
|
174
|
-
svg {
|
|
175
|
-
path {
|
|
176
|
-
fill: ${({ theme }) => theme.colors.primary600};
|
|
177
|
-
}
|
|
178
|
-
}
|
|
179
|
-
}
|
|
180
|
-
}
|
|
181
|
-
`;
|
|
182
|
-
const ComponentCard = ({
|
|
183
|
-
component,
|
|
184
|
-
dzName,
|
|
185
|
-
index,
|
|
186
|
-
isActive = false,
|
|
187
|
-
isInDevelopmentMode = false,
|
|
188
|
-
onClick
|
|
189
|
-
}) => {
|
|
190
|
-
const { modifiedData, removeComponentFromDynamicZone } = useDataManager();
|
|
191
|
-
const {
|
|
192
|
-
schema: { icon, displayName }
|
|
193
|
-
} = get(modifiedData, ["components", component], { schema: {} });
|
|
194
|
-
const onClose = (e) => {
|
|
195
|
-
e.stopPropagation();
|
|
196
|
-
removeComponentFromDynamicZone(dzName, index);
|
|
197
|
-
};
|
|
198
|
-
return /* @__PURE__ */ jsxs(
|
|
199
|
-
ComponentBox,
|
|
200
|
-
{
|
|
201
|
-
alignItems: "center",
|
|
202
|
-
direction: "column",
|
|
203
|
-
className: isActive ? "active" : "",
|
|
204
|
-
borderRadius: "borderRadius",
|
|
205
|
-
justifyContent: "center",
|
|
206
|
-
paddingLeft: 4,
|
|
207
|
-
paddingRight: 4,
|
|
208
|
-
shrink: 0,
|
|
209
|
-
onClick,
|
|
210
|
-
role: "tab",
|
|
211
|
-
tabIndex: isActive ? 0 : -1,
|
|
212
|
-
cursor: "pointer",
|
|
213
|
-
"aria-selected": isActive,
|
|
214
|
-
"aria-controls": `dz-${dzName}-panel-${index}`,
|
|
215
|
-
id: `dz-${dzName}-tab-${index}`,
|
|
216
|
-
children: [
|
|
217
|
-
/* @__PURE__ */ jsx(ComponentIcon, { icon, isActive }),
|
|
218
|
-
/* @__PURE__ */ jsx(Box, { marginTop: 1, maxWidth: "100%", children: /* @__PURE__ */ jsx(Typography, { variant: "pi", fontWeight: "bold", ellipsis: true, children: displayName }) }),
|
|
219
|
-
isInDevelopmentMode && /* @__PURE__ */ jsx(CloseButton, { tag: "button", onClick: onClose, children: /* @__PURE__ */ jsx(Cross, {}) })
|
|
220
|
-
]
|
|
221
|
-
}
|
|
222
|
-
);
|
|
223
|
-
};
|
|
224
|
-
const StyledAddIcon = styled(Plus)`
|
|
225
|
-
width: 3.2rem;
|
|
226
|
-
height: 3.2rem;
|
|
227
|
-
padding: 0.9rem;
|
|
228
|
-
border-radius: 6.4rem;
|
|
229
|
-
background: ${({ theme }) => theme.colors.primary100};
|
|
230
|
-
path {
|
|
231
|
-
fill: ${({ theme }) => theme.colors.primary600};
|
|
232
|
-
}
|
|
233
|
-
`;
|
|
234
|
-
const FixedBox = styled(Box)`
|
|
235
|
-
height: 9rem;
|
|
236
|
-
position: absolute;
|
|
237
|
-
width: 100%;
|
|
238
|
-
top: 0;
|
|
239
|
-
left: 0;
|
|
240
|
-
`;
|
|
241
|
-
const ScrollableStack = styled(Flex)`
|
|
242
|
-
width: 100%;
|
|
243
|
-
overflow-x: auto;
|
|
244
|
-
`;
|
|
245
|
-
const ComponentContentBox = styled(Box)`
|
|
246
|
-
padding-top: 9rem;
|
|
247
|
-
`;
|
|
248
|
-
const ComponentStack = styled(Flex)`
|
|
249
|
-
flex-shrink: 0;
|
|
250
|
-
width: 14rem;
|
|
251
|
-
height: 8rem;
|
|
252
|
-
justify-content: center;
|
|
253
|
-
align-items: center;
|
|
254
|
-
`;
|
|
255
|
-
const DynamicZoneList = ({
|
|
256
|
-
customRowComponent,
|
|
257
|
-
components = [],
|
|
258
|
-
addComponent,
|
|
259
|
-
name,
|
|
260
|
-
targetUid
|
|
261
|
-
}) => {
|
|
262
|
-
const { isInDevelopmentMode } = useDataManager();
|
|
263
|
-
const [activeTab, setActiveTab] = useState(0);
|
|
264
|
-
const { formatMessage } = useIntl();
|
|
265
|
-
const toggle = (tab) => {
|
|
266
|
-
if (activeTab !== tab) {
|
|
267
|
-
setActiveTab(tab);
|
|
268
|
-
}
|
|
269
|
-
};
|
|
270
|
-
const handleClickAdd = () => {
|
|
271
|
-
addComponent(name);
|
|
272
|
-
};
|
|
273
|
-
return /* @__PURE__ */ jsx(Tr, { className: "dynamiczone-row", $isFromDynamicZone: true, children: /* @__PURE__ */ jsxs("td", { colSpan: 12, children: [
|
|
274
|
-
/* @__PURE__ */ jsx(FixedBox, { paddingLeft: 8, children: /* @__PURE__ */ jsxs(ScrollableStack, { gap: 2, children: [
|
|
275
|
-
isInDevelopmentMode && /* @__PURE__ */ jsx("button", { type: "button", onClick: handleClickAdd, children: /* @__PURE__ */ jsxs(ComponentStack, { direction: "column", alignItems: "stretch", gap: 1, children: [
|
|
276
|
-
/* @__PURE__ */ jsx(StyledAddIcon, {}),
|
|
277
|
-
/* @__PURE__ */ jsx(Typography, { variant: "pi", fontWeight: "bold", textColor: "primary600", children: formatMessage({
|
|
278
|
-
id: getTrad("button.component.add"),
|
|
279
|
-
defaultMessage: "Add a component"
|
|
280
|
-
}) })
|
|
281
|
-
] }) }),
|
|
282
|
-
/* @__PURE__ */ jsx(Flex, { role: "tablist", gap: 2, children: components.map((component, index) => {
|
|
283
|
-
return /* @__PURE__ */ jsx(
|
|
284
|
-
ComponentCard,
|
|
285
|
-
{
|
|
286
|
-
dzName: name || "",
|
|
287
|
-
index,
|
|
288
|
-
component,
|
|
289
|
-
isActive: activeTab === index,
|
|
290
|
-
isInDevelopmentMode,
|
|
291
|
-
onClick: () => toggle(index)
|
|
292
|
-
},
|
|
293
|
-
component
|
|
294
|
-
);
|
|
295
|
-
}) })
|
|
296
|
-
] }) }),
|
|
297
|
-
/* @__PURE__ */ jsx(ComponentContentBox, { children: components.map((component, index) => {
|
|
298
|
-
const props = {
|
|
299
|
-
customRowComponent,
|
|
300
|
-
component
|
|
301
|
-
};
|
|
302
|
-
return /* @__PURE__ */ jsx(
|
|
303
|
-
Box,
|
|
304
|
-
{
|
|
305
|
-
id: `dz-${name}-panel-${index}`,
|
|
306
|
-
role: "tabpanel",
|
|
307
|
-
"aria-labelledby": `dz-${name}-tab-${index}`,
|
|
308
|
-
style: { display: activeTab === index ? "block" : "none" },
|
|
309
|
-
children: /* @__PURE__ */ jsx("table", { children: /* @__PURE__ */ jsx("tbody", { children: /* @__PURE__ */ createElement(
|
|
310
|
-
ComponentList,
|
|
311
|
-
{
|
|
312
|
-
...props,
|
|
313
|
-
isFromDynamicZone: true,
|
|
314
|
-
component: targetUid,
|
|
315
|
-
key: component
|
|
316
|
-
}
|
|
317
|
-
) }) })
|
|
318
|
-
},
|
|
319
|
-
component
|
|
320
|
-
);
|
|
321
|
-
}) })
|
|
322
|
-
] }) });
|
|
323
|
-
};
|
|
324
|
-
const IconBox = styled(Box)`
|
|
325
|
-
height: 2.4rem;
|
|
326
|
-
width: 2.4rem;
|
|
327
|
-
border-radius: 50%;
|
|
328
|
-
display: flex;
|
|
329
|
-
justify-content: center;
|
|
330
|
-
align-items: center;
|
|
331
|
-
|
|
332
|
-
svg {
|
|
333
|
-
height: 1rem;
|
|
334
|
-
width: 1rem;
|
|
335
|
-
}
|
|
336
|
-
|
|
337
|
-
svg path {
|
|
338
|
-
fill: ${({ theme, color }) => theme.colors[`${color}600`]};
|
|
339
|
-
}
|
|
340
|
-
`;
|
|
341
|
-
const ButtonBox = styled(Box)`
|
|
342
|
-
border-radius: 0 0 ${({ theme }) => theme.borderRadius} ${({ theme }) => theme.borderRadius};
|
|
343
|
-
display: block;
|
|
344
|
-
width: 100%;
|
|
345
|
-
border: none;
|
|
346
|
-
position: relative;
|
|
347
|
-
left: -0.4rem;
|
|
348
|
-
`;
|
|
349
|
-
const NestedTFooter = ({ children, icon, color, ...props }) => {
|
|
350
|
-
return /* @__PURE__ */ jsx(ButtonBox, { paddingBottom: 4, paddingTop: 4, tag: "button", type: "button", ...props, children: /* @__PURE__ */ jsxs(Flex, { children: [
|
|
351
|
-
/* @__PURE__ */ jsx(IconBox, { color, "aria-hidden": true, background: `${color}200`, children: icon }),
|
|
352
|
-
/* @__PURE__ */ jsx(Box, { paddingLeft: 3, children: /* @__PURE__ */ jsx(Typography, { variant: "pi", fontWeight: "bold", textColor: `${color}600`, children }) })
|
|
353
|
-
] }) });
|
|
354
|
-
};
|
|
355
|
-
const List = ({
|
|
356
|
-
addComponentToDZ,
|
|
357
|
-
customRowComponent,
|
|
358
|
-
editTarget,
|
|
359
|
-
firstLoopComponentUid,
|
|
360
|
-
isFromDynamicZone = false,
|
|
361
|
-
isMain = false,
|
|
362
|
-
isNestedInDZComponent = false,
|
|
363
|
-
isSub = false,
|
|
364
|
-
items = [],
|
|
365
|
-
secondLoopComponentUid,
|
|
366
|
-
targetUid
|
|
367
|
-
}) => {
|
|
368
|
-
const { formatMessage } = useIntl();
|
|
369
|
-
const { trackUsage } = useTracking();
|
|
370
|
-
const { isInDevelopmentMode, modifiedData, isInContentTypeView } = useDataManager();
|
|
371
|
-
const { onOpenModalAddField } = useFormModalNavigation();
|
|
372
|
-
const onClickAddField = () => {
|
|
373
|
-
trackUsage("hasClickedCTBAddFieldBanner");
|
|
374
|
-
onOpenModalAddField({ forTarget: editTarget, targetUid });
|
|
375
|
-
};
|
|
376
|
-
if (!targetUid) {
|
|
377
|
-
return /* @__PURE__ */ jsxs(Table, { colCount: 2, rowCount: 2, children: [
|
|
378
|
-
/* @__PURE__ */ jsx(Thead, { children: /* @__PURE__ */ jsxs(Tr$1, { children: [
|
|
379
|
-
/* @__PURE__ */ jsx(Th, { children: /* @__PURE__ */ jsx(Typography, { variant: "sigma", textColor: "neutral600", children: formatMessage({ id: "global.name", defaultMessage: "Name" }) }) }),
|
|
380
|
-
/* @__PURE__ */ jsx(Th, { children: /* @__PURE__ */ jsx(Typography, { variant: "sigma", textColor: "neutral600", children: formatMessage({ id: "global.type", defaultMessage: "Type" }) }) })
|
|
381
|
-
] }) }),
|
|
382
|
-
/* @__PURE__ */ jsx(Tbody, { children: /* @__PURE__ */ jsx(Tr$1, { children: /* @__PURE__ */ jsx(Td, { colSpan: 2, children: /* @__PURE__ */ jsx(
|
|
383
|
-
EmptyStateLayout,
|
|
384
|
-
{
|
|
385
|
-
content: formatMessage({
|
|
386
|
-
id: getTrad("table.content.create-first-content-type"),
|
|
387
|
-
defaultMessage: "Create your first Collection-Type"
|
|
388
|
-
}),
|
|
389
|
-
hasRadius: true,
|
|
390
|
-
icon: /* @__PURE__ */ jsx(EmptyDocuments, { width: "16rem" })
|
|
391
|
-
}
|
|
392
|
-
) }) }) })
|
|
393
|
-
] });
|
|
394
|
-
}
|
|
395
|
-
if (items.length === 0 && isMain) {
|
|
396
|
-
return /* @__PURE__ */ jsxs(Table, { colCount: 2, rowCount: 2, children: [
|
|
397
|
-
/* @__PURE__ */ jsx(Thead, { children: /* @__PURE__ */ jsxs(Tr$1, { children: [
|
|
398
|
-
/* @__PURE__ */ jsx(Th, { children: /* @__PURE__ */ jsx(Typography, { variant: "sigma", textColor: "neutral600", children: formatMessage({ id: "global.name", defaultMessage: "Name" }) }) }),
|
|
399
|
-
/* @__PURE__ */ jsx(Th, { children: /* @__PURE__ */ jsx(Typography, { variant: "sigma", textColor: "neutral600", children: formatMessage({ id: "global.type", defaultMessage: "Type" }) }) })
|
|
400
|
-
] }) }),
|
|
401
|
-
/* @__PURE__ */ jsx(Tbody, { children: /* @__PURE__ */ jsx(Tr$1, { children: /* @__PURE__ */ jsx(Td, { colSpan: 2, children: /* @__PURE__ */ jsx(
|
|
402
|
-
EmptyStateLayout,
|
|
403
|
-
{
|
|
404
|
-
action: /* @__PURE__ */ jsx(
|
|
405
|
-
Button,
|
|
406
|
-
{
|
|
407
|
-
onClick: onClickAddField,
|
|
408
|
-
size: "L",
|
|
409
|
-
startIcon: /* @__PURE__ */ jsx(Plus, {}),
|
|
410
|
-
variant: "secondary",
|
|
411
|
-
children: formatMessage({
|
|
412
|
-
id: getTrad("table.button.no-fields"),
|
|
413
|
-
defaultMessage: "Add new field"
|
|
414
|
-
})
|
|
415
|
-
}
|
|
416
|
-
),
|
|
417
|
-
content: formatMessage(
|
|
418
|
-
isInContentTypeView ? {
|
|
419
|
-
id: getTrad("table.content.no-fields.collection-type"),
|
|
420
|
-
defaultMessage: "Add your first field to this Collection-Type"
|
|
421
|
-
} : {
|
|
422
|
-
id: getTrad("table.content.no-fields.component"),
|
|
423
|
-
defaultMessage: "Add your first field to this component"
|
|
424
|
-
}
|
|
425
|
-
),
|
|
426
|
-
hasRadius: true,
|
|
427
|
-
icon: /* @__PURE__ */ jsx(EmptyDocuments, { width: "16rem" })
|
|
428
|
-
}
|
|
429
|
-
) }) }) })
|
|
430
|
-
] });
|
|
431
|
-
}
|
|
432
|
-
return /* @__PURE__ */ jsxs(BoxWrapper$1, { children: [
|
|
433
|
-
/* @__PURE__ */ jsx(
|
|
434
|
-
Box,
|
|
435
|
-
{
|
|
436
|
-
paddingLeft: 6,
|
|
437
|
-
paddingRight: isMain ? 6 : 0,
|
|
438
|
-
...isMain && { style: { overflowX: "auto" } },
|
|
439
|
-
children: /* @__PURE__ */ jsxs("table", { children: [
|
|
440
|
-
isMain && /* @__PURE__ */ jsx("thead", { children: /* @__PURE__ */ jsxs("tr", { children: [
|
|
441
|
-
/* @__PURE__ */ jsx("th", { children: /* @__PURE__ */ jsx(Typography, { variant: "sigma", textColor: "neutral800", children: formatMessage({ id: "global.name", defaultMessage: "Name" }) }) }),
|
|
442
|
-
/* @__PURE__ */ jsx("th", { colSpan: 2, children: /* @__PURE__ */ jsx(Typography, { variant: "sigma", textColor: "neutral800", children: formatMessage({ id: "global.type", defaultMessage: "Type" }) }) })
|
|
443
|
-
] }) }),
|
|
444
|
-
/* @__PURE__ */ jsx("tbody", { children: items.map((item) => {
|
|
445
|
-
const { type } = item;
|
|
446
|
-
const CustomRow = customRowComponent;
|
|
447
|
-
return /* @__PURE__ */ jsxs(Fragment, { children: [
|
|
448
|
-
/* @__PURE__ */ jsx(
|
|
449
|
-
CustomRow,
|
|
450
|
-
{
|
|
451
|
-
...item,
|
|
452
|
-
isNestedInDZComponent,
|
|
453
|
-
targetUid,
|
|
454
|
-
editTarget,
|
|
455
|
-
firstLoopComponentUid,
|
|
456
|
-
isFromDynamicZone,
|
|
457
|
-
secondLoopComponentUid
|
|
458
|
-
}
|
|
459
|
-
),
|
|
460
|
-
type === "component" && /* @__PURE__ */ jsx(
|
|
461
|
-
ComponentList,
|
|
462
|
-
{
|
|
463
|
-
...item,
|
|
464
|
-
customRowComponent,
|
|
465
|
-
targetUid,
|
|
466
|
-
isNestedInDZComponent: isFromDynamicZone,
|
|
467
|
-
editTarget,
|
|
468
|
-
firstLoopComponentUid
|
|
469
|
-
}
|
|
470
|
-
),
|
|
471
|
-
type === "dynamiczone" && /* @__PURE__ */ jsx(
|
|
472
|
-
DynamicZoneList,
|
|
473
|
-
{
|
|
474
|
-
...item,
|
|
475
|
-
customRowComponent,
|
|
476
|
-
addComponent: addComponentToDZ,
|
|
477
|
-
targetUid
|
|
478
|
-
}
|
|
479
|
-
)
|
|
480
|
-
] }, item.name);
|
|
481
|
-
}) })
|
|
482
|
-
] })
|
|
483
|
-
}
|
|
484
|
-
),
|
|
485
|
-
isMain && isInDevelopmentMode && /* @__PURE__ */ jsx(TFooter, { cursor: "pointer", icon: /* @__PURE__ */ jsx(Plus, {}), onClick: onClickAddField, children: formatMessage({
|
|
486
|
-
id: getTrad(
|
|
487
|
-
`form.button.add.field.to.${modifiedData.contentType ? modifiedData.contentType.schema.kind : editTarget || "collectionType"}`
|
|
488
|
-
),
|
|
489
|
-
defaultMessage: "Add another field"
|
|
490
|
-
}) }),
|
|
491
|
-
isSub && isInDevelopmentMode && !isFromDynamicZone && /* @__PURE__ */ jsx(
|
|
492
|
-
NestedTFooter,
|
|
493
|
-
{
|
|
494
|
-
icon: /* @__PURE__ */ jsx(Plus, {}),
|
|
495
|
-
onClick: onClickAddField,
|
|
496
|
-
color: isFromDynamicZone ? "primary" : "neutral",
|
|
497
|
-
children: formatMessage({
|
|
498
|
-
id: getTrad(`form.button.add.field.to.component`),
|
|
499
|
-
defaultMessage: "Add another field"
|
|
500
|
-
})
|
|
501
|
-
}
|
|
502
|
-
)
|
|
503
|
-
] });
|
|
504
|
-
};
|
|
505
|
-
const StyledBox = styled(Box)`
|
|
506
|
-
position: absolute;
|
|
507
|
-
left: -1.8rem;
|
|
508
|
-
top: 0px;
|
|
509
|
-
|
|
510
|
-
&:before {
|
|
511
|
-
content: '';
|
|
512
|
-
width: 0.4rem;
|
|
513
|
-
height: 1.2rem;
|
|
514
|
-
background: ${({ theme, color }) => theme.colors[color]};
|
|
515
|
-
display: block;
|
|
516
|
-
}
|
|
517
|
-
`;
|
|
518
|
-
const Svg = styled.svg`
|
|
519
|
-
position: relative;
|
|
520
|
-
flex-shrink: 0;
|
|
521
|
-
transform: translate(-0.5px, -1px);
|
|
522
|
-
|
|
523
|
-
* {
|
|
524
|
-
fill: ${({ theme, color }) => theme.colors[color]};
|
|
525
|
-
}
|
|
526
|
-
`;
|
|
527
|
-
const Curve = (props) => /* @__PURE__ */ jsx(StyledBox, { children: /* @__PURE__ */ jsx(
|
|
528
|
-
Svg,
|
|
529
|
-
{
|
|
530
|
-
width: "20",
|
|
531
|
-
height: "23",
|
|
532
|
-
viewBox: "0 0 20 23",
|
|
533
|
-
fill: "none",
|
|
534
|
-
xmlns: "http://www.w3.org/2000/svg",
|
|
535
|
-
...props,
|
|
536
|
-
children: /* @__PURE__ */ jsx(
|
|
537
|
-
"path",
|
|
538
|
-
{
|
|
539
|
-
fillRule: "evenodd",
|
|
540
|
-
clipRule: "evenodd",
|
|
541
|
-
d: "M7.02477 14.7513C8.65865 17.0594 11.6046 18.6059 17.5596 18.8856C18.6836 18.9384 19.5976 19.8435 19.5976 20.9688V20.9688C19.5976 22.0941 18.6841 23.0125 17.5599 22.9643C10.9409 22.6805 6.454 20.9387 3.75496 17.1258C0.937988 13.1464 0.486328 7.39309 0.486328 0.593262H4.50974C4.50974 7.54693 5.06394 11.9813 7.02477 14.7513Z"
|
|
542
|
-
}
|
|
543
|
-
)
|
|
544
|
-
}
|
|
545
|
-
) });
|
|
546
|
-
const DisplayedType = ({
|
|
547
|
-
type,
|
|
548
|
-
customField = null,
|
|
549
|
-
repeatable = false
|
|
550
|
-
}) => {
|
|
551
|
-
const { formatMessage } = useIntl();
|
|
552
|
-
let readableType = type;
|
|
553
|
-
if (["integer", "biginteger", "float", "decimal"].includes(type)) {
|
|
554
|
-
readableType = "number";
|
|
555
|
-
} else if (["string"].includes(type)) {
|
|
556
|
-
readableType = "text";
|
|
557
|
-
}
|
|
558
|
-
if (customField) {
|
|
559
|
-
return /* @__PURE__ */ jsx(Typography, { children: formatMessage({
|
|
560
|
-
id: getTrad("attribute.customField"),
|
|
561
|
-
defaultMessage: "Custom field"
|
|
562
|
-
}) });
|
|
563
|
-
}
|
|
564
|
-
return /* @__PURE__ */ jsxs(Typography, { textColor: "neutral800", children: [
|
|
565
|
-
formatMessage({
|
|
566
|
-
id: getTrad(`attribute.${readableType}`),
|
|
567
|
-
defaultMessage: type
|
|
568
|
-
}),
|
|
569
|
-
" ",
|
|
570
|
-
repeatable && formatMessage({
|
|
571
|
-
id: getTrad("component.repeatable"),
|
|
572
|
-
defaultMessage: "(repeatable)"
|
|
573
|
-
})
|
|
574
|
-
] });
|
|
575
|
-
};
|
|
576
|
-
const UpperFirst = ({ content }) => /* @__PURE__ */ jsx(Fragment$1, { children: upperFirst(content) });
|
|
577
|
-
const BoxWrapper = styled(Box)`
|
|
578
|
-
position: relative;
|
|
579
|
-
`;
|
|
580
|
-
const ListRow = memo(
|
|
581
|
-
({
|
|
582
|
-
configurable = true,
|
|
583
|
-
customField = null,
|
|
584
|
-
editTarget,
|
|
585
|
-
firstLoopComponentUid = null,
|
|
586
|
-
isFromDynamicZone = false,
|
|
587
|
-
name,
|
|
588
|
-
onClick,
|
|
589
|
-
relation = "",
|
|
590
|
-
repeatable = false,
|
|
591
|
-
secondLoopComponentUid = null,
|
|
592
|
-
target = null,
|
|
593
|
-
targetUid = null,
|
|
594
|
-
type
|
|
595
|
-
}) => {
|
|
596
|
-
const { contentTypes, isInDevelopmentMode, removeAttribute } = useDataManager();
|
|
597
|
-
const { formatMessage } = useIntl();
|
|
598
|
-
const isMorph = type === "relation" && relation.includes("morph");
|
|
599
|
-
const ico = ["integer", "biginteger", "float", "decimal"].includes(type) ? "number" : type;
|
|
600
|
-
const contentType = get(contentTypes, [target], {});
|
|
601
|
-
const contentTypeFriendlyName = get(contentType, ["schema", "displayName"], "");
|
|
602
|
-
const isPluginContentType = get(contentType, "plugin");
|
|
603
|
-
const src = target ? "relation" : ico;
|
|
604
|
-
const handleClick = () => {
|
|
605
|
-
if (isMorph) {
|
|
606
|
-
return;
|
|
607
|
-
}
|
|
608
|
-
if (configurable !== false) {
|
|
609
|
-
const attrType = type;
|
|
610
|
-
onClick(
|
|
611
|
-
// Tells where the attribute is located in the main modifiedData object : contentType, component or components
|
|
612
|
-
editTarget,
|
|
613
|
-
// main data type uid
|
|
614
|
-
secondLoopComponentUid || firstLoopComponentUid || targetUid,
|
|
615
|
-
// Name of the attribute
|
|
616
|
-
name,
|
|
617
|
-
// Type of the attribute
|
|
618
|
-
attrType,
|
|
619
|
-
customField
|
|
620
|
-
);
|
|
621
|
-
}
|
|
622
|
-
};
|
|
623
|
-
let loopNumber;
|
|
624
|
-
if (secondLoopComponentUid && firstLoopComponentUid) {
|
|
625
|
-
loopNumber = 2;
|
|
626
|
-
} else if (firstLoopComponentUid) {
|
|
627
|
-
loopNumber = 1;
|
|
628
|
-
} else {
|
|
629
|
-
loopNumber = 0;
|
|
630
|
-
}
|
|
631
|
-
return /* @__PURE__ */ jsxs(
|
|
632
|
-
BoxWrapper,
|
|
633
|
-
{
|
|
634
|
-
tag: "tr",
|
|
635
|
-
onClick: isInDevelopmentMode && configurable && !isMorph ? handleClick : void 0,
|
|
636
|
-
children: [
|
|
637
|
-
/* @__PURE__ */ jsxs("td", { style: { position: "relative" }, children: [
|
|
638
|
-
loopNumber !== 0 && /* @__PURE__ */ jsx(Curve, { color: isFromDynamicZone ? "primary200" : "neutral150" }),
|
|
639
|
-
/* @__PURE__ */ jsxs(Flex, { paddingLeft: 2, gap: 4, children: [
|
|
640
|
-
/* @__PURE__ */ jsx(AttributeIcon, { type: src, customField }),
|
|
641
|
-
/* @__PURE__ */ jsx(Typography, { textColor: "neutral800", fontWeight: "bold", children: name })
|
|
642
|
-
] })
|
|
643
|
-
] }),
|
|
644
|
-
/* @__PURE__ */ jsx("td", { children: target ? /* @__PURE__ */ jsxs(Typography, { textColor: "neutral800", children: [
|
|
645
|
-
formatMessage({
|
|
646
|
-
id: getTrad(
|
|
647
|
-
`modelPage.attribute.${isMorph ? "relation-polymorphic" : "relationWith"}`
|
|
648
|
-
),
|
|
649
|
-
defaultMessage: "Relation with"
|
|
650
|
-
}),
|
|
651
|
-
" ",
|
|
652
|
-
/* @__PURE__ */ jsxs("span", { style: { fontStyle: "italic" }, children: [
|
|
653
|
-
/* @__PURE__ */ jsx(UpperFirst, { content: contentTypeFriendlyName }),
|
|
654
|
-
" ",
|
|
655
|
-
isPluginContentType && `(${formatMessage({
|
|
656
|
-
id: getTrad(`from`),
|
|
657
|
-
defaultMessage: "from"
|
|
658
|
-
})}: ${isPluginContentType})`
|
|
659
|
-
] })
|
|
660
|
-
] }) : /* @__PURE__ */ jsx(DisplayedType, { type, customField, repeatable }) }),
|
|
661
|
-
/* @__PURE__ */ jsx("td", { children: isInDevelopmentMode ? /* @__PURE__ */ jsx(Flex, { justifyContent: "flex-end", onClick: (e) => e.stopPropagation(), children: configurable ? /* @__PURE__ */ jsxs(Flex, { gap: 1, children: [
|
|
662
|
-
!isMorph && /* @__PURE__ */ jsx(
|
|
663
|
-
IconButton,
|
|
664
|
-
{
|
|
665
|
-
onClick: handleClick,
|
|
666
|
-
label: `${formatMessage({
|
|
667
|
-
id: "app.utils.edit",
|
|
668
|
-
defaultMessage: "Edit"
|
|
669
|
-
})} ${name}`,
|
|
670
|
-
variant: "ghost",
|
|
671
|
-
children: /* @__PURE__ */ jsx(Pencil, {})
|
|
672
|
-
}
|
|
673
|
-
),
|
|
674
|
-
/* @__PURE__ */ jsx(
|
|
675
|
-
IconButton,
|
|
676
|
-
{
|
|
677
|
-
onClick: (e) => {
|
|
678
|
-
e.stopPropagation();
|
|
679
|
-
removeAttribute(
|
|
680
|
-
editTarget,
|
|
681
|
-
name,
|
|
682
|
-
secondLoopComponentUid || firstLoopComponentUid || ""
|
|
683
|
-
);
|
|
684
|
-
},
|
|
685
|
-
label: `${formatMessage({
|
|
686
|
-
id: "global.delete",
|
|
687
|
-
defaultMessage: "Delete"
|
|
688
|
-
})} ${name}`,
|
|
689
|
-
variant: "ghost",
|
|
690
|
-
children: /* @__PURE__ */ jsx(Trash, {})
|
|
691
|
-
}
|
|
692
|
-
)
|
|
693
|
-
] }) : /* @__PURE__ */ jsx(Lock, {}) }) : (
|
|
694
|
-
/*
|
|
695
|
-
In production mode the edit icons aren't visible, therefore
|
|
696
|
-
we need to reserve the same space, otherwise the height of the
|
|
697
|
-
row might collapse, leading to bad positioned curve icons
|
|
698
|
-
*/
|
|
699
|
-
/* @__PURE__ */ jsx(Box, { height: "3.2rem" })
|
|
700
|
-
) })
|
|
701
|
-
]
|
|
702
|
-
}
|
|
703
|
-
);
|
|
704
|
-
}
|
|
705
|
-
);
|
|
706
|
-
const getAttributeDisplayedType = (type) => {
|
|
707
|
-
let displayedType;
|
|
708
|
-
switch (type) {
|
|
709
|
-
case "date":
|
|
710
|
-
case "datetime":
|
|
711
|
-
case "time":
|
|
712
|
-
case "timestamp":
|
|
713
|
-
displayedType = "date";
|
|
714
|
-
break;
|
|
715
|
-
case "integer":
|
|
716
|
-
case "biginteger":
|
|
717
|
-
case "decimal":
|
|
718
|
-
case "float":
|
|
719
|
-
displayedType = "number";
|
|
720
|
-
break;
|
|
721
|
-
case "string":
|
|
722
|
-
case "text":
|
|
723
|
-
displayedType = "text";
|
|
724
|
-
break;
|
|
725
|
-
case "":
|
|
726
|
-
displayedType = "relation";
|
|
727
|
-
break;
|
|
728
|
-
default:
|
|
729
|
-
displayedType = type;
|
|
730
|
-
}
|
|
731
|
-
return displayedType;
|
|
732
|
-
};
|
|
733
|
-
const cmPermissions = {
|
|
734
|
-
collectionTypesConfigurations: [
|
|
735
|
-
{
|
|
736
|
-
action: "plugin::content-manager.collection-types.configure-view",
|
|
737
|
-
subject: null
|
|
738
|
-
}
|
|
739
|
-
],
|
|
740
|
-
componentsConfigurations: [
|
|
741
|
-
{
|
|
742
|
-
action: "plugin::content-manager.components.configure-layout",
|
|
743
|
-
subject: null
|
|
744
|
-
}
|
|
745
|
-
],
|
|
746
|
-
singleTypesConfigurations: [
|
|
747
|
-
{
|
|
748
|
-
action: "plugin::content-manager.single-types.configure-view",
|
|
749
|
-
subject: null
|
|
750
|
-
}
|
|
751
|
-
]
|
|
752
|
-
};
|
|
753
|
-
const LinkToCMSettingsView = memo(
|
|
754
|
-
({
|
|
755
|
-
disabled,
|
|
756
|
-
isTemporary = false,
|
|
757
|
-
isInContentTypeView = true,
|
|
758
|
-
contentTypeKind = "collectionType",
|
|
759
|
-
targetUid = ""
|
|
760
|
-
}) => {
|
|
761
|
-
const { formatMessage } = useIntl();
|
|
762
|
-
const navigate = useNavigate();
|
|
763
|
-
const { collectionTypesConfigurations, componentsConfigurations, singleTypesConfigurations } = cmPermissions;
|
|
764
|
-
const label = formatMessage({
|
|
765
|
-
id: "content-type-builder.form.button.configure-view",
|
|
766
|
-
defaultMessage: "Configure the view"
|
|
767
|
-
});
|
|
768
|
-
let permissionsToApply = collectionTypesConfigurations;
|
|
769
|
-
const handleClick = () => {
|
|
770
|
-
if (isTemporary) {
|
|
771
|
-
return false;
|
|
772
|
-
}
|
|
773
|
-
if (isInContentTypeView) {
|
|
774
|
-
navigate(`/content-manager/collection-types/${targetUid}/configurations/edit`);
|
|
775
|
-
} else {
|
|
776
|
-
navigate(`/content-manager/components/${targetUid}/configurations/edit`);
|
|
777
|
-
}
|
|
778
|
-
return false;
|
|
779
|
-
};
|
|
780
|
-
if (isInContentTypeView && contentTypeKind === "singleType") {
|
|
781
|
-
permissionsToApply = singleTypesConfigurations;
|
|
782
|
-
}
|
|
783
|
-
if (!isInContentTypeView) {
|
|
784
|
-
permissionsToApply = componentsConfigurations;
|
|
785
|
-
}
|
|
786
|
-
const { isLoading, allowedActions } = useRBAC({
|
|
787
|
-
viewConfig: permissionsToApply
|
|
788
|
-
});
|
|
789
|
-
if (isLoading) {
|
|
790
|
-
return null;
|
|
791
|
-
}
|
|
792
|
-
if (!allowedActions.canConfigureView && !allowedActions.canConfigureLayout) {
|
|
793
|
-
return null;
|
|
794
|
-
}
|
|
795
|
-
return /* @__PURE__ */ jsx(
|
|
796
|
-
Button,
|
|
797
|
-
{
|
|
798
|
-
startIcon: /* @__PURE__ */ jsx(ListPlus, {}),
|
|
799
|
-
variant: "tertiary",
|
|
800
|
-
onClick: handleClick,
|
|
801
|
-
disabled: isTemporary || disabled,
|
|
802
|
-
children: label
|
|
803
|
-
}
|
|
804
|
-
);
|
|
805
|
-
}
|
|
806
|
-
);
|
|
807
|
-
const LayoutsHeaderCustom = styled(Layouts.Header)`
|
|
808
|
-
overflow-wrap: anywhere;
|
|
809
|
-
`;
|
|
810
|
-
const ListView = () => {
|
|
811
|
-
const { initialData, modifiedData, isInDevelopmentMode, isInContentTypeView, submitData } = useDataManager();
|
|
812
|
-
const { formatMessage } = useIntl();
|
|
813
|
-
const { trackUsage } = useTracking();
|
|
814
|
-
const match = useMatch("/plugins/content-type-builder/:kind/:currentUID");
|
|
815
|
-
const {
|
|
816
|
-
onOpenModalAddComponentsToDZ,
|
|
817
|
-
onOpenModalAddField,
|
|
818
|
-
onOpenModalEditField,
|
|
819
|
-
onOpenModalEditSchema,
|
|
820
|
-
onOpenModalEditCustomField
|
|
821
|
-
} = useFormModalNavigation();
|
|
822
|
-
const firstMainDataPath = isInContentTypeView ? "contentType" : "component";
|
|
823
|
-
const mainDataTypeAttributesPath = [firstMainDataPath, "schema", "attributes"];
|
|
824
|
-
const targetUid = get(modifiedData, [firstMainDataPath, "uid"]);
|
|
825
|
-
const isTemporary = get(modifiedData, [firstMainDataPath, "isTemporary"], false);
|
|
826
|
-
const contentTypeKind = get(modifiedData, [firstMainDataPath, "schema", "kind"], null);
|
|
827
|
-
const attributes = get(modifiedData, mainDataTypeAttributesPath, []);
|
|
828
|
-
const isFromPlugin = has(initialData, [firstMainDataPath, "plugin"]);
|
|
829
|
-
const hasModelBeenModified = !isEqual(modifiedData, initialData);
|
|
830
|
-
const forTarget = isInContentTypeView ? "contentType" : "component";
|
|
831
|
-
const handleClickAddComponentToDZ = (dynamicZoneTarget) => {
|
|
832
|
-
onOpenModalAddComponentsToDZ({ dynamicZoneTarget, targetUid });
|
|
833
|
-
};
|
|
834
|
-
const handleClickEditField = async (forTarget2, targetUid2, attributeName, type, customField) => {
|
|
835
|
-
const attributeType = getAttributeDisplayedType(type);
|
|
836
|
-
const step = type === "component" ? "2" : null;
|
|
837
|
-
if (customField) {
|
|
838
|
-
onOpenModalEditCustomField({
|
|
839
|
-
forTarget: forTarget2,
|
|
840
|
-
targetUid: targetUid2,
|
|
841
|
-
attributeName,
|
|
842
|
-
attributeType,
|
|
843
|
-
customFieldUid: customField
|
|
844
|
-
});
|
|
845
|
-
} else {
|
|
846
|
-
onOpenModalEditField({
|
|
847
|
-
forTarget: forTarget2,
|
|
848
|
-
targetUid: targetUid2,
|
|
849
|
-
attributeName,
|
|
850
|
-
attributeType,
|
|
851
|
-
step
|
|
852
|
-
});
|
|
853
|
-
}
|
|
854
|
-
};
|
|
855
|
-
let label = get(modifiedData, [firstMainDataPath, "schema", "displayName"], "");
|
|
856
|
-
const kind = get(modifiedData, [firstMainDataPath, "schema", "kind"], "");
|
|
857
|
-
const isCreatingFirstContentType = match?.params.currentUID === "create-content-type";
|
|
858
|
-
if (!label && isCreatingFirstContentType) {
|
|
859
|
-
label = formatMessage({
|
|
860
|
-
id: getTrad("button.model.create"),
|
|
861
|
-
defaultMessage: "Create new collection type"
|
|
862
|
-
});
|
|
863
|
-
}
|
|
864
|
-
const onEdit = () => {
|
|
865
|
-
const contentType = kind || firstMainDataPath;
|
|
866
|
-
if (contentType === "collectionType") {
|
|
867
|
-
trackUsage("willEditNameOfContentType");
|
|
868
|
-
}
|
|
869
|
-
if (contentType === "singleType") {
|
|
870
|
-
trackUsage("willEditNameOfSingleType");
|
|
871
|
-
}
|
|
872
|
-
onOpenModalEditSchema({
|
|
873
|
-
modalType: firstMainDataPath,
|
|
874
|
-
forTarget: firstMainDataPath,
|
|
875
|
-
targetUid,
|
|
876
|
-
kind: contentType
|
|
877
|
-
});
|
|
878
|
-
};
|
|
879
|
-
unstable_usePrompt({
|
|
880
|
-
when: hasModelBeenModified,
|
|
881
|
-
message: formatMessage({ id: getTrad("prompt.unsaved"), defaultMessage: "Are you sure?" })
|
|
882
|
-
});
|
|
883
|
-
return /* @__PURE__ */ jsxs(Fragment$1, { children: [
|
|
884
|
-
/* @__PURE__ */ jsx(
|
|
885
|
-
LayoutsHeaderCustom,
|
|
886
|
-
{
|
|
887
|
-
id: "title",
|
|
888
|
-
primaryAction: isInDevelopmentMode && /* @__PURE__ */ jsxs(Flex, { gap: 2, marginLeft: 2, children: [
|
|
889
|
-
!isCreatingFirstContentType && /* @__PURE__ */ jsx(
|
|
890
|
-
Button,
|
|
891
|
-
{
|
|
892
|
-
startIcon: /* @__PURE__ */ jsx(Plus, {}),
|
|
893
|
-
variant: "secondary",
|
|
894
|
-
minWidth: "max-content",
|
|
895
|
-
onClick: () => {
|
|
896
|
-
onOpenModalAddField({ forTarget, targetUid });
|
|
897
|
-
},
|
|
898
|
-
children: formatMessage({
|
|
899
|
-
id: getTrad("button.attributes.add.another"),
|
|
900
|
-
defaultMessage: "Add another field"
|
|
901
|
-
})
|
|
902
|
-
}
|
|
903
|
-
),
|
|
904
|
-
/* @__PURE__ */ jsx(
|
|
905
|
-
Button,
|
|
906
|
-
{
|
|
907
|
-
startIcon: /* @__PURE__ */ jsx(Check, {}),
|
|
908
|
-
onClick: async () => await submitData(),
|
|
909
|
-
type: "submit",
|
|
910
|
-
disabled: isEqual(modifiedData, initialData),
|
|
911
|
-
children: formatMessage({
|
|
912
|
-
id: "global.save",
|
|
913
|
-
defaultMessage: "Save"
|
|
914
|
-
})
|
|
915
|
-
}
|
|
916
|
-
)
|
|
917
|
-
] }),
|
|
918
|
-
secondaryAction: isInDevelopmentMode && !isFromPlugin && !isCreatingFirstContentType && /* @__PURE__ */ jsx(Button, { startIcon: /* @__PURE__ */ jsx(Pencil, {}), variant: "tertiary", onClick: onEdit, children: formatMessage({
|
|
919
|
-
id: "app.utils.edit",
|
|
920
|
-
defaultMessage: "Edit"
|
|
921
|
-
}) }),
|
|
922
|
-
title: upperFirst(label),
|
|
923
|
-
subtitle: formatMessage({
|
|
924
|
-
id: getTrad("listView.headerLayout.description"),
|
|
925
|
-
defaultMessage: "Build the data architecture of your content"
|
|
926
|
-
}),
|
|
927
|
-
navigationAction: /* @__PURE__ */ jsx(BackButton, {})
|
|
928
|
-
}
|
|
929
|
-
),
|
|
930
|
-
/* @__PURE__ */ jsx(Layouts.Content, { children: /* @__PURE__ */ jsxs(Flex, { direction: "column", alignItems: "stretch", gap: 4, children: [
|
|
931
|
-
/* @__PURE__ */ jsx(Flex, { justifyContent: "flex-end", children: /* @__PURE__ */ jsx(Flex, { gap: 2, children: /* @__PURE__ */ jsx(
|
|
932
|
-
LinkToCMSettingsView,
|
|
933
|
-
{
|
|
934
|
-
targetUid,
|
|
935
|
-
isTemporary,
|
|
936
|
-
isInContentTypeView,
|
|
937
|
-
contentTypeKind,
|
|
938
|
-
disabled: isCreatingFirstContentType
|
|
939
|
-
},
|
|
940
|
-
"link-to-cm-settings-view"
|
|
941
|
-
) }) }),
|
|
942
|
-
/* @__PURE__ */ jsx(Box, { background: "neutral0", shadow: "filterShadow", hasRadius: true, children: /* @__PURE__ */ jsx(
|
|
943
|
-
List,
|
|
944
|
-
{
|
|
945
|
-
items: attributes,
|
|
946
|
-
customRowComponent: (props) => /* @__PURE__ */ jsx(ListRow, { ...props, onClick: handleClickEditField }),
|
|
947
|
-
addComponentToDZ: handleClickAddComponentToDZ,
|
|
948
|
-
targetUid,
|
|
949
|
-
editTarget: forTarget,
|
|
950
|
-
isMain: true
|
|
951
|
-
}
|
|
952
|
-
) })
|
|
953
|
-
] }) })
|
|
954
|
-
] });
|
|
955
|
-
};
|
|
956
|
-
export {
|
|
957
|
-
ListView as default
|
|
958
|
-
};
|
|
959
|
-
//# sourceMappingURL=ListView-CsqdnKp3.mjs.map
|