@strapi/content-type-builder 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/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-B7k6NgwS.mjs +0 -959
- package/dist/_chunks/ListView-B7k6NgwS.mjs.map +0 -1
- package/dist/_chunks/ListView-CsRxS9zZ.js +0 -964
- package/dist/_chunks/ListView-CsRxS9zZ.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-97hm9i_H.mjs +0 -1331
- package/dist/_chunks/index-97hm9i_H.mjs.map +0 -1
- package/dist/_chunks/index-B5tHY87r.mjs +0 -6694
- package/dist/_chunks/index-B5tHY87r.mjs.map +0 -1
- package/dist/_chunks/index-BgMd59JL.js +0 -6730
- package/dist/_chunks/index-BgMd59JL.js.map +0 -1
- package/dist/_chunks/index-Cr85ijm8.js +0 -1357
- package/dist/_chunks/index-Cr85ijm8.js.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
|
@@ -0,0 +1,1186 @@
|
|
|
1
|
+
'use strict';
|
|
2
|
+
|
|
3
|
+
var jsxRuntime = require('react/jsx-runtime');
|
|
4
|
+
var strapiAdmin = require('@strapi/admin/strapi-admin');
|
|
5
|
+
var designSystem = require('@strapi/design-system');
|
|
6
|
+
var Icons = require('@strapi/icons');
|
|
7
|
+
var get = require('lodash/get');
|
|
8
|
+
var has = require('lodash/has');
|
|
9
|
+
var isEqual = require('lodash/isEqual');
|
|
10
|
+
var upperFirst = require('lodash/upperFirst');
|
|
11
|
+
var reactIntl = require('react-intl');
|
|
12
|
+
var reactRouterDom = require('react-router-dom');
|
|
13
|
+
var styledComponents = require('styled-components');
|
|
14
|
+
var React = require('react');
|
|
15
|
+
var Symbols = require('@strapi/icons/symbols');
|
|
16
|
+
var index = require('./index-BQ2VO38W.js');
|
|
17
|
+
require('./index-BZeN5KRn.js');
|
|
18
|
+
require('@reduxjs/toolkit');
|
|
19
|
+
require('immer');
|
|
20
|
+
require('lodash/set');
|
|
21
|
+
require('lodash/snakeCase');
|
|
22
|
+
require('pluralize');
|
|
23
|
+
require('@sindresorhus/slugify');
|
|
24
|
+
require('lodash/cloneDeep');
|
|
25
|
+
require('yup');
|
|
26
|
+
require('react-dom');
|
|
27
|
+
require('lodash/groupBy');
|
|
28
|
+
require('lodash/size');
|
|
29
|
+
require('react-redux');
|
|
30
|
+
require('lodash/toLower');
|
|
31
|
+
require('qs');
|
|
32
|
+
require('date-fns/formatISO');
|
|
33
|
+
require('lodash/truncate');
|
|
34
|
+
require('lodash/uniq');
|
|
35
|
+
require('lodash/fp');
|
|
36
|
+
require('lodash/toNumber');
|
|
37
|
+
require('lodash/camelCase');
|
|
38
|
+
require('lodash/omit');
|
|
39
|
+
require('lodash/sortBy');
|
|
40
|
+
|
|
41
|
+
const BoxWrapper$1 = styledComponents.styled(designSystem.Box)`
|
|
42
|
+
table {
|
|
43
|
+
width: 100%;
|
|
44
|
+
white-space: nowrap;
|
|
45
|
+
}
|
|
46
|
+
|
|
47
|
+
thead {
|
|
48
|
+
border-bottom: 1px solid ${({ theme })=>theme.colors.neutral150};
|
|
49
|
+
|
|
50
|
+
tr {
|
|
51
|
+
border-top: 0;
|
|
52
|
+
}
|
|
53
|
+
}
|
|
54
|
+
|
|
55
|
+
tr {
|
|
56
|
+
border-top: 1px solid ${({ theme })=>theme.colors.neutral150};
|
|
57
|
+
|
|
58
|
+
& td,
|
|
59
|
+
& th {
|
|
60
|
+
padding: ${({ theme })=>theme.spaces[4]};
|
|
61
|
+
}
|
|
62
|
+
|
|
63
|
+
& td:first-of-type,
|
|
64
|
+
& th:first-of-type {
|
|
65
|
+
padding: 0 ${({ theme })=>theme.spaces[1]};
|
|
66
|
+
}
|
|
67
|
+
}
|
|
68
|
+
|
|
69
|
+
th,
|
|
70
|
+
td {
|
|
71
|
+
vertical-align: middle;
|
|
72
|
+
text-align: left;
|
|
73
|
+
color: ${({ theme })=>theme.colors.neutral600};
|
|
74
|
+
outline-offset: -4px;
|
|
75
|
+
}
|
|
76
|
+
`;
|
|
77
|
+
|
|
78
|
+
// Keep component-row for css specificity
|
|
79
|
+
const Tr = styledComponents.styled.tr`
|
|
80
|
+
&.component-row,
|
|
81
|
+
&.dynamiczone-row {
|
|
82
|
+
position: relative;
|
|
83
|
+
border-top: none !important;
|
|
84
|
+
|
|
85
|
+
table tr:first-child {
|
|
86
|
+
border-top: none;
|
|
87
|
+
}
|
|
88
|
+
|
|
89
|
+
> td:first-of-type {
|
|
90
|
+
padding: 0 0 0 2rem;
|
|
91
|
+
position: relative;
|
|
92
|
+
|
|
93
|
+
&::before {
|
|
94
|
+
content: '';
|
|
95
|
+
width: 0.4rem;
|
|
96
|
+
height: calc(100% - 40px);
|
|
97
|
+
position: absolute;
|
|
98
|
+
top: -7px;
|
|
99
|
+
left: 2.6rem;
|
|
100
|
+
border-radius: 4px;
|
|
101
|
+
|
|
102
|
+
${({ $isFromDynamicZone, $isChildOfDynamicZone, theme })=>{
|
|
103
|
+
if ($isChildOfDynamicZone) {
|
|
104
|
+
return `background-color: ${theme.colors.primary200};`;
|
|
105
|
+
}
|
|
106
|
+
if ($isFromDynamicZone) {
|
|
107
|
+
return `background-color: ${theme.colors.primary200};`;
|
|
108
|
+
}
|
|
109
|
+
return `background: ${theme.colors.neutral150};`;
|
|
110
|
+
}}
|
|
111
|
+
}
|
|
112
|
+
}
|
|
113
|
+
}
|
|
114
|
+
|
|
115
|
+
&.dynamiczone-row > td:first-of-type {
|
|
116
|
+
padding: 0;
|
|
117
|
+
}
|
|
118
|
+
`;
|
|
119
|
+
|
|
120
|
+
const ComponentList = ({ customRowComponent, component, isFromDynamicZone = false, isNestedInDZComponent = false, firstLoopComponentUid })=>{
|
|
121
|
+
const { modifiedData } = index.useDataManager();
|
|
122
|
+
const { schema: { attributes } } = get(modifiedData, [
|
|
123
|
+
'components',
|
|
124
|
+
component
|
|
125
|
+
], {
|
|
126
|
+
schema: {
|
|
127
|
+
attributes: []
|
|
128
|
+
}
|
|
129
|
+
});
|
|
130
|
+
return /*#__PURE__*/ jsxRuntime.jsx(Tr, {
|
|
131
|
+
$isChildOfDynamicZone: isFromDynamicZone,
|
|
132
|
+
className: "component-row",
|
|
133
|
+
children: /*#__PURE__*/ jsxRuntime.jsx("td", {
|
|
134
|
+
colSpan: 12,
|
|
135
|
+
children: /*#__PURE__*/ jsxRuntime.jsx(List, {
|
|
136
|
+
customRowComponent: customRowComponent,
|
|
137
|
+
items: attributes,
|
|
138
|
+
targetUid: component,
|
|
139
|
+
firstLoopComponentUid: firstLoopComponentUid || component,
|
|
140
|
+
editTarget: "components",
|
|
141
|
+
isFromDynamicZone: isFromDynamicZone,
|
|
142
|
+
isNestedInDZComponent: isNestedInDZComponent,
|
|
143
|
+
isSub: true,
|
|
144
|
+
secondLoopComponentUid: firstLoopComponentUid ? component : null
|
|
145
|
+
})
|
|
146
|
+
})
|
|
147
|
+
});
|
|
148
|
+
};
|
|
149
|
+
|
|
150
|
+
const ComponentIcon = ({ isActive = false, icon = 'dashboard' })=>{
|
|
151
|
+
const Icon = index.COMPONENT_ICONS[icon] || index.COMPONENT_ICONS.dashboard;
|
|
152
|
+
return /*#__PURE__*/ jsxRuntime.jsx(designSystem.Flex, {
|
|
153
|
+
alignItems: "center",
|
|
154
|
+
background: isActive ? 'primary200' : 'neutral200',
|
|
155
|
+
justifyContent: "center",
|
|
156
|
+
height: 8,
|
|
157
|
+
width: 8,
|
|
158
|
+
borderRadius: "50%",
|
|
159
|
+
children: /*#__PURE__*/ jsxRuntime.jsx(Icon, {
|
|
160
|
+
height: "2rem",
|
|
161
|
+
width: "2rem"
|
|
162
|
+
})
|
|
163
|
+
});
|
|
164
|
+
};
|
|
165
|
+
|
|
166
|
+
const CloseButton = styledComponents.styled(designSystem.Box)`
|
|
167
|
+
position: absolute;
|
|
168
|
+
display: none;
|
|
169
|
+
top: 5px;
|
|
170
|
+
right: 0.8rem;
|
|
171
|
+
|
|
172
|
+
svg {
|
|
173
|
+
width: 1rem;
|
|
174
|
+
height: 1rem;
|
|
175
|
+
|
|
176
|
+
path {
|
|
177
|
+
fill: ${({ theme })=>theme.colors.primary600};
|
|
178
|
+
}
|
|
179
|
+
}
|
|
180
|
+
`;
|
|
181
|
+
const ComponentBox = styledComponents.styled(designSystem.Flex)`
|
|
182
|
+
width: 14rem;
|
|
183
|
+
height: 8rem;
|
|
184
|
+
position: relative;
|
|
185
|
+
border: 1px solid ${({ theme })=>theme.colors.neutral200};
|
|
186
|
+
background: ${({ theme })=>theme.colors.neutral100};
|
|
187
|
+
border-radius: ${({ theme })=>theme.borderRadius};
|
|
188
|
+
max-width: 100%;
|
|
189
|
+
|
|
190
|
+
&.active,
|
|
191
|
+
&:focus,
|
|
192
|
+
&:hover {
|
|
193
|
+
border: 1px solid ${({ theme })=>theme.colors.primary200};
|
|
194
|
+
background: ${({ theme })=>theme.colors.primary100};
|
|
195
|
+
color: ${({ theme })=>theme.colors.primary600};
|
|
196
|
+
|
|
197
|
+
${CloseButton} {
|
|
198
|
+
display: block;
|
|
199
|
+
}
|
|
200
|
+
|
|
201
|
+
/* > ComponentIcon */
|
|
202
|
+
> div:first-child {
|
|
203
|
+
background: ${({ theme })=>theme.colors.primary200};
|
|
204
|
+
color: ${({ theme })=>theme.colors.primary600};
|
|
205
|
+
|
|
206
|
+
svg {
|
|
207
|
+
path {
|
|
208
|
+
fill: ${({ theme })=>theme.colors.primary600};
|
|
209
|
+
}
|
|
210
|
+
}
|
|
211
|
+
}
|
|
212
|
+
}
|
|
213
|
+
`;
|
|
214
|
+
const ComponentCard = ({ component, dzName, index: index$1, isActive = false, isInDevelopmentMode = false, onClick })=>{
|
|
215
|
+
const { modifiedData, removeComponentFromDynamicZone } = index.useDataManager();
|
|
216
|
+
const { schema: { icon, displayName } } = get(modifiedData, [
|
|
217
|
+
'components',
|
|
218
|
+
component
|
|
219
|
+
], {
|
|
220
|
+
schema: {}
|
|
221
|
+
});
|
|
222
|
+
const onClose = (e)=>{
|
|
223
|
+
e.stopPropagation();
|
|
224
|
+
removeComponentFromDynamicZone(dzName, index$1);
|
|
225
|
+
};
|
|
226
|
+
return /*#__PURE__*/ jsxRuntime.jsxs(ComponentBox, {
|
|
227
|
+
alignItems: "center",
|
|
228
|
+
direction: "column",
|
|
229
|
+
className: isActive ? 'active' : '',
|
|
230
|
+
borderRadius: "borderRadius",
|
|
231
|
+
justifyContent: "center",
|
|
232
|
+
paddingLeft: 4,
|
|
233
|
+
paddingRight: 4,
|
|
234
|
+
shrink: 0,
|
|
235
|
+
onClick: onClick,
|
|
236
|
+
role: "tab",
|
|
237
|
+
tabIndex: isActive ? 0 : -1,
|
|
238
|
+
cursor: "pointer",
|
|
239
|
+
"aria-selected": isActive,
|
|
240
|
+
"aria-controls": `dz-${dzName}-panel-${index$1}`,
|
|
241
|
+
id: `dz-${dzName}-tab-${index$1}`,
|
|
242
|
+
children: [
|
|
243
|
+
/*#__PURE__*/ jsxRuntime.jsx(ComponentIcon, {
|
|
244
|
+
icon: icon,
|
|
245
|
+
isActive: isActive
|
|
246
|
+
}),
|
|
247
|
+
/*#__PURE__*/ jsxRuntime.jsx(designSystem.Box, {
|
|
248
|
+
marginTop: 1,
|
|
249
|
+
maxWidth: "100%",
|
|
250
|
+
children: /*#__PURE__*/ jsxRuntime.jsx(designSystem.Typography, {
|
|
251
|
+
variant: "pi",
|
|
252
|
+
fontWeight: "bold",
|
|
253
|
+
ellipsis: true,
|
|
254
|
+
children: displayName
|
|
255
|
+
})
|
|
256
|
+
}),
|
|
257
|
+
isInDevelopmentMode && /*#__PURE__*/ jsxRuntime.jsx(CloseButton, {
|
|
258
|
+
tag: "button",
|
|
259
|
+
onClick: onClose,
|
|
260
|
+
children: /*#__PURE__*/ jsxRuntime.jsx(Icons.Cross, {})
|
|
261
|
+
})
|
|
262
|
+
]
|
|
263
|
+
});
|
|
264
|
+
};
|
|
265
|
+
|
|
266
|
+
const StyledAddIcon = styledComponents.styled(Icons.Plus)`
|
|
267
|
+
width: 3.2rem;
|
|
268
|
+
height: 3.2rem;
|
|
269
|
+
padding: 0.9rem;
|
|
270
|
+
border-radius: 6.4rem;
|
|
271
|
+
background: ${({ theme })=>theme.colors.primary100};
|
|
272
|
+
path {
|
|
273
|
+
fill: ${({ theme })=>theme.colors.primary600};
|
|
274
|
+
}
|
|
275
|
+
`;
|
|
276
|
+
const FixedBox = styledComponents.styled(designSystem.Box)`
|
|
277
|
+
height: 9rem;
|
|
278
|
+
position: absolute;
|
|
279
|
+
width: 100%;
|
|
280
|
+
top: 0;
|
|
281
|
+
left: 0;
|
|
282
|
+
`;
|
|
283
|
+
const ScrollableStack = styledComponents.styled(designSystem.Flex)`
|
|
284
|
+
width: 100%;
|
|
285
|
+
overflow-x: auto;
|
|
286
|
+
`;
|
|
287
|
+
const ComponentContentBox = styledComponents.styled(designSystem.Box)`
|
|
288
|
+
padding-top: 9rem;
|
|
289
|
+
`;
|
|
290
|
+
const ComponentStack = styledComponents.styled(designSystem.Flex)`
|
|
291
|
+
flex-shrink: 0;
|
|
292
|
+
width: 14rem;
|
|
293
|
+
height: 8rem;
|
|
294
|
+
justify-content: center;
|
|
295
|
+
align-items: center;
|
|
296
|
+
`;
|
|
297
|
+
const DynamicZoneList = ({ customRowComponent, components = [], addComponent, name, targetUid })=>{
|
|
298
|
+
const { isInDevelopmentMode } = index.useDataManager();
|
|
299
|
+
const [activeTab, setActiveTab] = React.useState(0);
|
|
300
|
+
const { formatMessage } = reactIntl.useIntl();
|
|
301
|
+
const toggle = (tab)=>{
|
|
302
|
+
if (activeTab !== tab) {
|
|
303
|
+
setActiveTab(tab);
|
|
304
|
+
}
|
|
305
|
+
};
|
|
306
|
+
const handleClickAdd = ()=>{
|
|
307
|
+
addComponent(name);
|
|
308
|
+
};
|
|
309
|
+
return /*#__PURE__*/ jsxRuntime.jsx(Tr, {
|
|
310
|
+
className: "dynamiczone-row",
|
|
311
|
+
$isFromDynamicZone: true,
|
|
312
|
+
children: /*#__PURE__*/ jsxRuntime.jsxs("td", {
|
|
313
|
+
colSpan: 12,
|
|
314
|
+
children: [
|
|
315
|
+
/*#__PURE__*/ jsxRuntime.jsx(FixedBox, {
|
|
316
|
+
paddingLeft: 8,
|
|
317
|
+
children: /*#__PURE__*/ jsxRuntime.jsxs(ScrollableStack, {
|
|
318
|
+
gap: 2,
|
|
319
|
+
children: [
|
|
320
|
+
isInDevelopmentMode && /*#__PURE__*/ jsxRuntime.jsx("button", {
|
|
321
|
+
type: "button",
|
|
322
|
+
onClick: handleClickAdd,
|
|
323
|
+
children: /*#__PURE__*/ jsxRuntime.jsxs(ComponentStack, {
|
|
324
|
+
direction: "column",
|
|
325
|
+
alignItems: "stretch",
|
|
326
|
+
gap: 1,
|
|
327
|
+
children: [
|
|
328
|
+
/*#__PURE__*/ jsxRuntime.jsx(StyledAddIcon, {}),
|
|
329
|
+
/*#__PURE__*/ jsxRuntime.jsx(designSystem.Typography, {
|
|
330
|
+
variant: "pi",
|
|
331
|
+
fontWeight: "bold",
|
|
332
|
+
textColor: "primary600",
|
|
333
|
+
children: formatMessage({
|
|
334
|
+
id: index.getTrad('button.component.add'),
|
|
335
|
+
defaultMessage: 'Add a component'
|
|
336
|
+
})
|
|
337
|
+
})
|
|
338
|
+
]
|
|
339
|
+
})
|
|
340
|
+
}),
|
|
341
|
+
/*#__PURE__*/ jsxRuntime.jsx(designSystem.Flex, {
|
|
342
|
+
role: "tablist",
|
|
343
|
+
gap: 2,
|
|
344
|
+
children: components.map((component, index)=>{
|
|
345
|
+
return /*#__PURE__*/ jsxRuntime.jsx(ComponentCard, {
|
|
346
|
+
dzName: name || '',
|
|
347
|
+
index: index,
|
|
348
|
+
component: component,
|
|
349
|
+
isActive: activeTab === index,
|
|
350
|
+
isInDevelopmentMode: isInDevelopmentMode,
|
|
351
|
+
onClick: ()=>toggle(index)
|
|
352
|
+
}, component);
|
|
353
|
+
})
|
|
354
|
+
})
|
|
355
|
+
]
|
|
356
|
+
})
|
|
357
|
+
}),
|
|
358
|
+
/*#__PURE__*/ jsxRuntime.jsx(ComponentContentBox, {
|
|
359
|
+
children: components.map((component, index)=>{
|
|
360
|
+
const props = {
|
|
361
|
+
customRowComponent,
|
|
362
|
+
component
|
|
363
|
+
};
|
|
364
|
+
return /*#__PURE__*/ jsxRuntime.jsx(designSystem.Box, {
|
|
365
|
+
id: `dz-${name}-panel-${index}`,
|
|
366
|
+
role: "tabpanel",
|
|
367
|
+
"aria-labelledby": `dz-${name}-tab-${index}`,
|
|
368
|
+
style: {
|
|
369
|
+
display: activeTab === index ? 'block' : 'none'
|
|
370
|
+
},
|
|
371
|
+
children: /*#__PURE__*/ jsxRuntime.jsx("table", {
|
|
372
|
+
children: /*#__PURE__*/ jsxRuntime.jsx("tbody", {
|
|
373
|
+
children: /*#__PURE__*/ React.createElement(ComponentList, {
|
|
374
|
+
...props,
|
|
375
|
+
isFromDynamicZone: true,
|
|
376
|
+
component: targetUid,
|
|
377
|
+
key: component
|
|
378
|
+
})
|
|
379
|
+
})
|
|
380
|
+
})
|
|
381
|
+
}, component);
|
|
382
|
+
})
|
|
383
|
+
})
|
|
384
|
+
]
|
|
385
|
+
})
|
|
386
|
+
});
|
|
387
|
+
};
|
|
388
|
+
|
|
389
|
+
const IconBox = styledComponents.styled(designSystem.Box)`
|
|
390
|
+
height: 2.4rem;
|
|
391
|
+
width: 2.4rem;
|
|
392
|
+
border-radius: 50%;
|
|
393
|
+
display: flex;
|
|
394
|
+
justify-content: center;
|
|
395
|
+
align-items: center;
|
|
396
|
+
|
|
397
|
+
svg {
|
|
398
|
+
height: 1rem;
|
|
399
|
+
width: 1rem;
|
|
400
|
+
}
|
|
401
|
+
|
|
402
|
+
svg path {
|
|
403
|
+
fill: ${({ theme, color })=>theme.colors[`${color}600`]};
|
|
404
|
+
}
|
|
405
|
+
`;
|
|
406
|
+
const ButtonBox = styledComponents.styled(designSystem.Box)`
|
|
407
|
+
border-radius: 0 0 ${({ theme })=>theme.borderRadius} ${({ theme })=>theme.borderRadius};
|
|
408
|
+
display: block;
|
|
409
|
+
width: 100%;
|
|
410
|
+
border: none;
|
|
411
|
+
position: relative;
|
|
412
|
+
left: -0.4rem;
|
|
413
|
+
`;
|
|
414
|
+
const NestedTFooter = ({ children, icon, color, ...props })=>{
|
|
415
|
+
return /*#__PURE__*/ jsxRuntime.jsx(ButtonBox, {
|
|
416
|
+
paddingBottom: 4,
|
|
417
|
+
paddingTop: 4,
|
|
418
|
+
tag: "button",
|
|
419
|
+
type: "button",
|
|
420
|
+
...props,
|
|
421
|
+
children: /*#__PURE__*/ jsxRuntime.jsxs(designSystem.Flex, {
|
|
422
|
+
children: [
|
|
423
|
+
/*#__PURE__*/ jsxRuntime.jsx(IconBox, {
|
|
424
|
+
color: color,
|
|
425
|
+
"aria-hidden": true,
|
|
426
|
+
background: `${color}200`,
|
|
427
|
+
children: icon
|
|
428
|
+
}),
|
|
429
|
+
/*#__PURE__*/ jsxRuntime.jsx(designSystem.Box, {
|
|
430
|
+
paddingLeft: 3,
|
|
431
|
+
children: /*#__PURE__*/ jsxRuntime.jsx(designSystem.Typography, {
|
|
432
|
+
variant: "pi",
|
|
433
|
+
fontWeight: "bold",
|
|
434
|
+
textColor: `${color}600`,
|
|
435
|
+
children: children
|
|
436
|
+
})
|
|
437
|
+
})
|
|
438
|
+
]
|
|
439
|
+
})
|
|
440
|
+
});
|
|
441
|
+
};
|
|
442
|
+
|
|
443
|
+
const List = ({ addComponentToDZ, customRowComponent, editTarget, firstLoopComponentUid, isFromDynamicZone = false, isMain = false, isNestedInDZComponent = false, isSub = false, items = [], secondLoopComponentUid, targetUid })=>{
|
|
444
|
+
const { formatMessage } = reactIntl.useIntl();
|
|
445
|
+
const { trackUsage } = strapiAdmin.useTracking();
|
|
446
|
+
const { isInDevelopmentMode, modifiedData, isInContentTypeView } = index.useDataManager();
|
|
447
|
+
const { onOpenModalAddField } = index.useFormModalNavigation();
|
|
448
|
+
const onClickAddField = ()=>{
|
|
449
|
+
trackUsage('hasClickedCTBAddFieldBanner');
|
|
450
|
+
onOpenModalAddField({
|
|
451
|
+
forTarget: editTarget,
|
|
452
|
+
targetUid
|
|
453
|
+
});
|
|
454
|
+
};
|
|
455
|
+
if (!targetUid) {
|
|
456
|
+
return /*#__PURE__*/ jsxRuntime.jsxs(designSystem.Table, {
|
|
457
|
+
colCount: 2,
|
|
458
|
+
rowCount: 2,
|
|
459
|
+
children: [
|
|
460
|
+
/*#__PURE__*/ jsxRuntime.jsx(designSystem.Thead, {
|
|
461
|
+
children: /*#__PURE__*/ jsxRuntime.jsxs(designSystem.Tr, {
|
|
462
|
+
children: [
|
|
463
|
+
/*#__PURE__*/ jsxRuntime.jsx(designSystem.Th, {
|
|
464
|
+
children: /*#__PURE__*/ jsxRuntime.jsx(designSystem.Typography, {
|
|
465
|
+
variant: "sigma",
|
|
466
|
+
textColor: "neutral600",
|
|
467
|
+
children: formatMessage({
|
|
468
|
+
id: 'global.name',
|
|
469
|
+
defaultMessage: 'Name'
|
|
470
|
+
})
|
|
471
|
+
})
|
|
472
|
+
}),
|
|
473
|
+
/*#__PURE__*/ jsxRuntime.jsx(designSystem.Th, {
|
|
474
|
+
children: /*#__PURE__*/ jsxRuntime.jsx(designSystem.Typography, {
|
|
475
|
+
variant: "sigma",
|
|
476
|
+
textColor: "neutral600",
|
|
477
|
+
children: formatMessage({
|
|
478
|
+
id: 'global.type',
|
|
479
|
+
defaultMessage: 'Type'
|
|
480
|
+
})
|
|
481
|
+
})
|
|
482
|
+
})
|
|
483
|
+
]
|
|
484
|
+
})
|
|
485
|
+
}),
|
|
486
|
+
/*#__PURE__*/ jsxRuntime.jsx(designSystem.Tbody, {
|
|
487
|
+
children: /*#__PURE__*/ jsxRuntime.jsx(designSystem.Tr, {
|
|
488
|
+
children: /*#__PURE__*/ jsxRuntime.jsx(designSystem.Td, {
|
|
489
|
+
colSpan: 2,
|
|
490
|
+
children: /*#__PURE__*/ jsxRuntime.jsx(designSystem.EmptyStateLayout, {
|
|
491
|
+
content: formatMessage({
|
|
492
|
+
id: index.getTrad('table.content.create-first-content-type'),
|
|
493
|
+
defaultMessage: 'Create your first Collection-Type'
|
|
494
|
+
}),
|
|
495
|
+
hasRadius: true,
|
|
496
|
+
icon: /*#__PURE__*/ jsxRuntime.jsx(Symbols.EmptyDocuments, {
|
|
497
|
+
width: "16rem"
|
|
498
|
+
})
|
|
499
|
+
})
|
|
500
|
+
})
|
|
501
|
+
})
|
|
502
|
+
})
|
|
503
|
+
]
|
|
504
|
+
});
|
|
505
|
+
}
|
|
506
|
+
if (items.length === 0 && isMain) {
|
|
507
|
+
return /*#__PURE__*/ jsxRuntime.jsxs(designSystem.Table, {
|
|
508
|
+
colCount: 2,
|
|
509
|
+
rowCount: 2,
|
|
510
|
+
children: [
|
|
511
|
+
/*#__PURE__*/ jsxRuntime.jsx(designSystem.Thead, {
|
|
512
|
+
children: /*#__PURE__*/ jsxRuntime.jsxs(designSystem.Tr, {
|
|
513
|
+
children: [
|
|
514
|
+
/*#__PURE__*/ jsxRuntime.jsx(designSystem.Th, {
|
|
515
|
+
children: /*#__PURE__*/ jsxRuntime.jsx(designSystem.Typography, {
|
|
516
|
+
variant: "sigma",
|
|
517
|
+
textColor: "neutral600",
|
|
518
|
+
children: formatMessage({
|
|
519
|
+
id: 'global.name',
|
|
520
|
+
defaultMessage: 'Name'
|
|
521
|
+
})
|
|
522
|
+
})
|
|
523
|
+
}),
|
|
524
|
+
/*#__PURE__*/ jsxRuntime.jsx(designSystem.Th, {
|
|
525
|
+
children: /*#__PURE__*/ jsxRuntime.jsx(designSystem.Typography, {
|
|
526
|
+
variant: "sigma",
|
|
527
|
+
textColor: "neutral600",
|
|
528
|
+
children: formatMessage({
|
|
529
|
+
id: 'global.type',
|
|
530
|
+
defaultMessage: 'Type'
|
|
531
|
+
})
|
|
532
|
+
})
|
|
533
|
+
})
|
|
534
|
+
]
|
|
535
|
+
})
|
|
536
|
+
}),
|
|
537
|
+
/*#__PURE__*/ jsxRuntime.jsx(designSystem.Tbody, {
|
|
538
|
+
children: /*#__PURE__*/ jsxRuntime.jsx(designSystem.Tr, {
|
|
539
|
+
children: /*#__PURE__*/ jsxRuntime.jsx(designSystem.Td, {
|
|
540
|
+
colSpan: 2,
|
|
541
|
+
children: /*#__PURE__*/ jsxRuntime.jsx(designSystem.EmptyStateLayout, {
|
|
542
|
+
action: /*#__PURE__*/ jsxRuntime.jsx(designSystem.Button, {
|
|
543
|
+
onClick: onClickAddField,
|
|
544
|
+
size: "L",
|
|
545
|
+
startIcon: /*#__PURE__*/ jsxRuntime.jsx(Icons.Plus, {}),
|
|
546
|
+
variant: "secondary",
|
|
547
|
+
children: formatMessage({
|
|
548
|
+
id: index.getTrad('table.button.no-fields'),
|
|
549
|
+
defaultMessage: 'Add new field'
|
|
550
|
+
})
|
|
551
|
+
}),
|
|
552
|
+
content: formatMessage(isInContentTypeView ? {
|
|
553
|
+
id: index.getTrad('table.content.no-fields.collection-type'),
|
|
554
|
+
defaultMessage: 'Add your first field to this Collection-Type'
|
|
555
|
+
} : {
|
|
556
|
+
id: index.getTrad('table.content.no-fields.component'),
|
|
557
|
+
defaultMessage: 'Add your first field to this component'
|
|
558
|
+
}),
|
|
559
|
+
hasRadius: true,
|
|
560
|
+
icon: /*#__PURE__*/ jsxRuntime.jsx(Symbols.EmptyDocuments, {
|
|
561
|
+
width: "16rem"
|
|
562
|
+
})
|
|
563
|
+
})
|
|
564
|
+
})
|
|
565
|
+
})
|
|
566
|
+
})
|
|
567
|
+
]
|
|
568
|
+
});
|
|
569
|
+
}
|
|
570
|
+
return /*#__PURE__*/ jsxRuntime.jsxs(BoxWrapper$1, {
|
|
571
|
+
children: [
|
|
572
|
+
/*#__PURE__*/ jsxRuntime.jsx(designSystem.Box, {
|
|
573
|
+
paddingLeft: 6,
|
|
574
|
+
paddingRight: isMain ? 6 : 0,
|
|
575
|
+
...isMain && {
|
|
576
|
+
style: {
|
|
577
|
+
overflowX: 'auto'
|
|
578
|
+
}
|
|
579
|
+
},
|
|
580
|
+
children: /*#__PURE__*/ jsxRuntime.jsxs("table", {
|
|
581
|
+
children: [
|
|
582
|
+
isMain && /*#__PURE__*/ jsxRuntime.jsx("thead", {
|
|
583
|
+
children: /*#__PURE__*/ jsxRuntime.jsxs("tr", {
|
|
584
|
+
children: [
|
|
585
|
+
/*#__PURE__*/ jsxRuntime.jsx("th", {
|
|
586
|
+
children: /*#__PURE__*/ jsxRuntime.jsx(designSystem.Typography, {
|
|
587
|
+
variant: "sigma",
|
|
588
|
+
textColor: "neutral800",
|
|
589
|
+
children: formatMessage({
|
|
590
|
+
id: 'global.name',
|
|
591
|
+
defaultMessage: 'Name'
|
|
592
|
+
})
|
|
593
|
+
})
|
|
594
|
+
}),
|
|
595
|
+
/*#__PURE__*/ jsxRuntime.jsx("th", {
|
|
596
|
+
colSpan: 2,
|
|
597
|
+
children: /*#__PURE__*/ jsxRuntime.jsx(designSystem.Typography, {
|
|
598
|
+
variant: "sigma",
|
|
599
|
+
textColor: "neutral800",
|
|
600
|
+
children: formatMessage({
|
|
601
|
+
id: 'global.type',
|
|
602
|
+
defaultMessage: 'Type'
|
|
603
|
+
})
|
|
604
|
+
})
|
|
605
|
+
})
|
|
606
|
+
]
|
|
607
|
+
})
|
|
608
|
+
}),
|
|
609
|
+
/*#__PURE__*/ jsxRuntime.jsx("tbody", {
|
|
610
|
+
children: items.map((item)=>{
|
|
611
|
+
const { type } = item;
|
|
612
|
+
const CustomRow = customRowComponent;
|
|
613
|
+
return /*#__PURE__*/ jsxRuntime.jsxs(React.Fragment, {
|
|
614
|
+
children: [
|
|
615
|
+
/*#__PURE__*/ jsxRuntime.jsx(CustomRow, {
|
|
616
|
+
...item,
|
|
617
|
+
isNestedInDZComponent: isNestedInDZComponent,
|
|
618
|
+
targetUid: targetUid,
|
|
619
|
+
editTarget: editTarget,
|
|
620
|
+
firstLoopComponentUid: firstLoopComponentUid,
|
|
621
|
+
isFromDynamicZone: isFromDynamicZone,
|
|
622
|
+
secondLoopComponentUid: secondLoopComponentUid
|
|
623
|
+
}),
|
|
624
|
+
type === 'component' && /*#__PURE__*/ jsxRuntime.jsx(ComponentList, {
|
|
625
|
+
...item,
|
|
626
|
+
customRowComponent: customRowComponent,
|
|
627
|
+
targetUid: targetUid,
|
|
628
|
+
isNestedInDZComponent: isFromDynamicZone,
|
|
629
|
+
editTarget: editTarget,
|
|
630
|
+
firstLoopComponentUid: firstLoopComponentUid
|
|
631
|
+
}),
|
|
632
|
+
type === 'dynamiczone' && /*#__PURE__*/ jsxRuntime.jsx(DynamicZoneList, {
|
|
633
|
+
...item,
|
|
634
|
+
customRowComponent: customRowComponent,
|
|
635
|
+
addComponent: addComponentToDZ,
|
|
636
|
+
targetUid: targetUid
|
|
637
|
+
})
|
|
638
|
+
]
|
|
639
|
+
}, item.name);
|
|
640
|
+
})
|
|
641
|
+
})
|
|
642
|
+
]
|
|
643
|
+
})
|
|
644
|
+
}),
|
|
645
|
+
isMain && isInDevelopmentMode && /*#__PURE__*/ jsxRuntime.jsx(designSystem.TFooter, {
|
|
646
|
+
cursor: "pointer",
|
|
647
|
+
icon: /*#__PURE__*/ jsxRuntime.jsx(Icons.Plus, {}),
|
|
648
|
+
onClick: onClickAddField,
|
|
649
|
+
children: formatMessage({
|
|
650
|
+
id: index.getTrad(`form.button.add.field.to.${modifiedData.contentType ? modifiedData.contentType.schema.kind : editTarget || 'collectionType'}`),
|
|
651
|
+
defaultMessage: 'Add another field'
|
|
652
|
+
})
|
|
653
|
+
}),
|
|
654
|
+
isSub && isInDevelopmentMode && !isFromDynamicZone && /*#__PURE__*/ jsxRuntime.jsx(NestedTFooter, {
|
|
655
|
+
icon: /*#__PURE__*/ jsxRuntime.jsx(Icons.Plus, {}),
|
|
656
|
+
onClick: onClickAddField,
|
|
657
|
+
color: isFromDynamicZone ? 'primary' : 'neutral',
|
|
658
|
+
children: formatMessage({
|
|
659
|
+
id: index.getTrad(`form.button.add.field.to.component`),
|
|
660
|
+
defaultMessage: 'Add another field'
|
|
661
|
+
})
|
|
662
|
+
})
|
|
663
|
+
]
|
|
664
|
+
});
|
|
665
|
+
};
|
|
666
|
+
|
|
667
|
+
const StyledBox = styledComponents.styled(designSystem.Box)`
|
|
668
|
+
position: absolute;
|
|
669
|
+
left: -1.8rem;
|
|
670
|
+
top: 0px;
|
|
671
|
+
|
|
672
|
+
&:before {
|
|
673
|
+
content: '';
|
|
674
|
+
width: 0.4rem;
|
|
675
|
+
height: 1.2rem;
|
|
676
|
+
background: ${({ theme, color })=>theme.colors[color]};
|
|
677
|
+
display: block;
|
|
678
|
+
}
|
|
679
|
+
`;
|
|
680
|
+
const Svg = styledComponents.styled.svg`
|
|
681
|
+
position: relative;
|
|
682
|
+
flex-shrink: 0;
|
|
683
|
+
transform: translate(-0.5px, -1px);
|
|
684
|
+
|
|
685
|
+
* {
|
|
686
|
+
fill: ${({ theme, color })=>theme.colors[color]};
|
|
687
|
+
}
|
|
688
|
+
`;
|
|
689
|
+
const Curve = (props)=>/*#__PURE__*/ jsxRuntime.jsx(StyledBox, {
|
|
690
|
+
children: /*#__PURE__*/ jsxRuntime.jsx(Svg, {
|
|
691
|
+
width: "20",
|
|
692
|
+
height: "23",
|
|
693
|
+
viewBox: "0 0 20 23",
|
|
694
|
+
fill: "none",
|
|
695
|
+
xmlns: "http://www.w3.org/2000/svg",
|
|
696
|
+
...props,
|
|
697
|
+
children: /*#__PURE__*/ jsxRuntime.jsx("path", {
|
|
698
|
+
fillRule: "evenodd",
|
|
699
|
+
clipRule: "evenodd",
|
|
700
|
+
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"
|
|
701
|
+
})
|
|
702
|
+
})
|
|
703
|
+
});
|
|
704
|
+
|
|
705
|
+
const DisplayedType = ({ type, customField = null, repeatable = false })=>{
|
|
706
|
+
const { formatMessage } = reactIntl.useIntl();
|
|
707
|
+
let readableType = type;
|
|
708
|
+
if ([
|
|
709
|
+
'integer',
|
|
710
|
+
'biginteger',
|
|
711
|
+
'float',
|
|
712
|
+
'decimal'
|
|
713
|
+
].includes(type)) {
|
|
714
|
+
readableType = 'number';
|
|
715
|
+
} else if ([
|
|
716
|
+
'string'
|
|
717
|
+
].includes(type)) {
|
|
718
|
+
readableType = 'text';
|
|
719
|
+
}
|
|
720
|
+
if (customField) {
|
|
721
|
+
return /*#__PURE__*/ jsxRuntime.jsx(designSystem.Typography, {
|
|
722
|
+
children: formatMessage({
|
|
723
|
+
id: index.getTrad('attribute.customField'),
|
|
724
|
+
defaultMessage: 'Custom field'
|
|
725
|
+
})
|
|
726
|
+
});
|
|
727
|
+
}
|
|
728
|
+
return /*#__PURE__*/ jsxRuntime.jsxs(designSystem.Typography, {
|
|
729
|
+
textColor: "neutral800",
|
|
730
|
+
children: [
|
|
731
|
+
formatMessage({
|
|
732
|
+
id: index.getTrad(`attribute.${readableType}`),
|
|
733
|
+
defaultMessage: type
|
|
734
|
+
}),
|
|
735
|
+
" ",
|
|
736
|
+
repeatable && formatMessage({
|
|
737
|
+
id: index.getTrad('component.repeatable'),
|
|
738
|
+
defaultMessage: '(repeatable)'
|
|
739
|
+
})
|
|
740
|
+
]
|
|
741
|
+
});
|
|
742
|
+
};
|
|
743
|
+
|
|
744
|
+
const UpperFirst = ({ content })=>/*#__PURE__*/ jsxRuntime.jsx(jsxRuntime.Fragment, {
|
|
745
|
+
children: upperFirst(content)
|
|
746
|
+
});
|
|
747
|
+
|
|
748
|
+
const BoxWrapper = styledComponents.styled(designSystem.Box)`
|
|
749
|
+
position: relative;
|
|
750
|
+
`;
|
|
751
|
+
const ListRow = /*#__PURE__*/ React.memo(({ configurable = true, customField = null, editTarget, firstLoopComponentUid = null, isFromDynamicZone = false, name, onClick, relation = '', repeatable = false, secondLoopComponentUid = null, target = null, targetUid = null, type })=>{
|
|
752
|
+
const { contentTypes, isInDevelopmentMode, removeAttribute } = index.useDataManager();
|
|
753
|
+
const { formatMessage } = reactIntl.useIntl();
|
|
754
|
+
const isMorph = type === 'relation' && relation.includes('morph');
|
|
755
|
+
const ico = [
|
|
756
|
+
'integer',
|
|
757
|
+
'biginteger',
|
|
758
|
+
'float',
|
|
759
|
+
'decimal'
|
|
760
|
+
].includes(type) ? 'number' : type;
|
|
761
|
+
const contentType = get(contentTypes, [
|
|
762
|
+
target
|
|
763
|
+
], {});
|
|
764
|
+
const contentTypeFriendlyName = get(contentType, [
|
|
765
|
+
'schema',
|
|
766
|
+
'displayName'
|
|
767
|
+
], '');
|
|
768
|
+
const isPluginContentType = get(contentType, 'plugin');
|
|
769
|
+
const src = target ? 'relation' : ico;
|
|
770
|
+
const handleClick = ()=>{
|
|
771
|
+
if (isMorph) {
|
|
772
|
+
return;
|
|
773
|
+
}
|
|
774
|
+
if (configurable !== false) {
|
|
775
|
+
const attrType = type;
|
|
776
|
+
onClick(// Tells where the attribute is located in the main modifiedData object : contentType, component or components
|
|
777
|
+
editTarget, // main data type uid
|
|
778
|
+
secondLoopComponentUid || firstLoopComponentUid || targetUid, // Name of the attribute
|
|
779
|
+
name, // Type of the attribute
|
|
780
|
+
attrType, customField);
|
|
781
|
+
}
|
|
782
|
+
};
|
|
783
|
+
let loopNumber;
|
|
784
|
+
if (secondLoopComponentUid && firstLoopComponentUid) {
|
|
785
|
+
loopNumber = 2;
|
|
786
|
+
} else if (firstLoopComponentUid) {
|
|
787
|
+
loopNumber = 1;
|
|
788
|
+
} else {
|
|
789
|
+
loopNumber = 0;
|
|
790
|
+
}
|
|
791
|
+
return /*#__PURE__*/ jsxRuntime.jsxs(BoxWrapper, {
|
|
792
|
+
tag: "tr",
|
|
793
|
+
onClick: isInDevelopmentMode && configurable && !isMorph ? handleClick : undefined,
|
|
794
|
+
children: [
|
|
795
|
+
/*#__PURE__*/ jsxRuntime.jsxs("td", {
|
|
796
|
+
style: {
|
|
797
|
+
position: 'relative'
|
|
798
|
+
},
|
|
799
|
+
children: [
|
|
800
|
+
loopNumber !== 0 && /*#__PURE__*/ jsxRuntime.jsx(Curve, {
|
|
801
|
+
color: isFromDynamicZone ? 'primary200' : 'neutral150'
|
|
802
|
+
}),
|
|
803
|
+
/*#__PURE__*/ jsxRuntime.jsxs(designSystem.Flex, {
|
|
804
|
+
paddingLeft: 2,
|
|
805
|
+
gap: 4,
|
|
806
|
+
children: [
|
|
807
|
+
/*#__PURE__*/ jsxRuntime.jsx(index.AttributeIcon, {
|
|
808
|
+
type: src,
|
|
809
|
+
customField: customField
|
|
810
|
+
}),
|
|
811
|
+
/*#__PURE__*/ jsxRuntime.jsx(designSystem.Typography, {
|
|
812
|
+
textColor: "neutral800",
|
|
813
|
+
fontWeight: "bold",
|
|
814
|
+
children: name
|
|
815
|
+
})
|
|
816
|
+
]
|
|
817
|
+
})
|
|
818
|
+
]
|
|
819
|
+
}),
|
|
820
|
+
/*#__PURE__*/ jsxRuntime.jsx("td", {
|
|
821
|
+
children: target ? /*#__PURE__*/ jsxRuntime.jsxs(designSystem.Typography, {
|
|
822
|
+
textColor: "neutral800",
|
|
823
|
+
children: [
|
|
824
|
+
formatMessage({
|
|
825
|
+
id: index.getTrad(`modelPage.attribute.${isMorph ? 'relation-polymorphic' : 'relationWith'}`),
|
|
826
|
+
defaultMessage: 'Relation with'
|
|
827
|
+
}),
|
|
828
|
+
" ",
|
|
829
|
+
/*#__PURE__*/ jsxRuntime.jsxs("span", {
|
|
830
|
+
style: {
|
|
831
|
+
fontStyle: 'italic'
|
|
832
|
+
},
|
|
833
|
+
children: [
|
|
834
|
+
/*#__PURE__*/ jsxRuntime.jsx(UpperFirst, {
|
|
835
|
+
content: contentTypeFriendlyName
|
|
836
|
+
}),
|
|
837
|
+
" ",
|
|
838
|
+
isPluginContentType && `(${formatMessage({
|
|
839
|
+
id: index.getTrad(`from`),
|
|
840
|
+
defaultMessage: 'from'
|
|
841
|
+
})}: ${isPluginContentType})`
|
|
842
|
+
]
|
|
843
|
+
})
|
|
844
|
+
]
|
|
845
|
+
}) : /*#__PURE__*/ jsxRuntime.jsx(DisplayedType, {
|
|
846
|
+
type: type,
|
|
847
|
+
customField: customField,
|
|
848
|
+
repeatable: repeatable
|
|
849
|
+
})
|
|
850
|
+
}),
|
|
851
|
+
/*#__PURE__*/ jsxRuntime.jsx("td", {
|
|
852
|
+
children: isInDevelopmentMode ? /*#__PURE__*/ jsxRuntime.jsx(designSystem.Flex, {
|
|
853
|
+
justifyContent: "flex-end",
|
|
854
|
+
onClick: (e)=>e.stopPropagation(),
|
|
855
|
+
children: configurable ? /*#__PURE__*/ jsxRuntime.jsxs(designSystem.Flex, {
|
|
856
|
+
gap: 1,
|
|
857
|
+
children: [
|
|
858
|
+
!isMorph && /*#__PURE__*/ jsxRuntime.jsx(designSystem.IconButton, {
|
|
859
|
+
onClick: handleClick,
|
|
860
|
+
label: `${formatMessage({
|
|
861
|
+
id: 'app.utils.edit',
|
|
862
|
+
defaultMessage: 'Edit'
|
|
863
|
+
})} ${name}`,
|
|
864
|
+
variant: "ghost",
|
|
865
|
+
children: /*#__PURE__*/ jsxRuntime.jsx(Icons.Pencil, {})
|
|
866
|
+
}),
|
|
867
|
+
/*#__PURE__*/ jsxRuntime.jsx(designSystem.IconButton, {
|
|
868
|
+
onClick: (e)=>{
|
|
869
|
+
e.stopPropagation();
|
|
870
|
+
removeAttribute(editTarget, name, secondLoopComponentUid || firstLoopComponentUid || '');
|
|
871
|
+
},
|
|
872
|
+
label: `${formatMessage({
|
|
873
|
+
id: 'global.delete',
|
|
874
|
+
defaultMessage: 'Delete'
|
|
875
|
+
})} ${name}`,
|
|
876
|
+
variant: "ghost",
|
|
877
|
+
children: /*#__PURE__*/ jsxRuntime.jsx(Icons.Trash, {})
|
|
878
|
+
})
|
|
879
|
+
]
|
|
880
|
+
}) : /*#__PURE__*/ jsxRuntime.jsx(Icons.Lock, {})
|
|
881
|
+
}) : /*
|
|
882
|
+
In production mode the edit icons aren't visible, therefore
|
|
883
|
+
we need to reserve the same space, otherwise the height of the
|
|
884
|
+
row might collapse, leading to bad positioned curve icons
|
|
885
|
+
*/ /*#__PURE__*/ jsxRuntime.jsx(designSystem.Box, {
|
|
886
|
+
height: "3.2rem"
|
|
887
|
+
})
|
|
888
|
+
})
|
|
889
|
+
]
|
|
890
|
+
});
|
|
891
|
+
});
|
|
892
|
+
|
|
893
|
+
const getAttributeDisplayedType = (type)=>{
|
|
894
|
+
let displayedType;
|
|
895
|
+
switch(type){
|
|
896
|
+
case 'date':
|
|
897
|
+
case 'datetime':
|
|
898
|
+
case 'time':
|
|
899
|
+
case 'timestamp':
|
|
900
|
+
displayedType = 'date';
|
|
901
|
+
break;
|
|
902
|
+
case 'integer':
|
|
903
|
+
case 'biginteger':
|
|
904
|
+
case 'decimal':
|
|
905
|
+
case 'float':
|
|
906
|
+
displayedType = 'number';
|
|
907
|
+
break;
|
|
908
|
+
case 'string':
|
|
909
|
+
case 'text':
|
|
910
|
+
displayedType = 'text';
|
|
911
|
+
break;
|
|
912
|
+
case '':
|
|
913
|
+
displayedType = 'relation';
|
|
914
|
+
break;
|
|
915
|
+
default:
|
|
916
|
+
displayedType = type;
|
|
917
|
+
}
|
|
918
|
+
return displayedType;
|
|
919
|
+
};
|
|
920
|
+
|
|
921
|
+
const cmPermissions = {
|
|
922
|
+
collectionTypesConfigurations: [
|
|
923
|
+
{
|
|
924
|
+
action: 'plugin::content-manager.collection-types.configure-view',
|
|
925
|
+
subject: null
|
|
926
|
+
}
|
|
927
|
+
],
|
|
928
|
+
componentsConfigurations: [
|
|
929
|
+
{
|
|
930
|
+
action: 'plugin::content-manager.components.configure-layout',
|
|
931
|
+
subject: null
|
|
932
|
+
}
|
|
933
|
+
],
|
|
934
|
+
singleTypesConfigurations: [
|
|
935
|
+
{
|
|
936
|
+
action: 'plugin::content-manager.single-types.configure-view',
|
|
937
|
+
subject: null
|
|
938
|
+
}
|
|
939
|
+
]
|
|
940
|
+
};
|
|
941
|
+
const getPermission = ({ isInContentTypeView, contentTypeKind })=>{
|
|
942
|
+
if (isInContentTypeView) {
|
|
943
|
+
if (contentTypeKind === 'singleType') {
|
|
944
|
+
return cmPermissions.singleTypesConfigurations;
|
|
945
|
+
}
|
|
946
|
+
return cmPermissions.collectionTypesConfigurations;
|
|
947
|
+
}
|
|
948
|
+
return cmPermissions.componentsConfigurations;
|
|
949
|
+
};
|
|
950
|
+
const LinkToCMSettingsView = /*#__PURE__*/ React.memo(({ disabled, isInContentTypeView = true, contentTypeKind = 'collectionType', targetUid = '' })=>{
|
|
951
|
+
const { formatMessage } = reactIntl.useIntl();
|
|
952
|
+
const navigate = reactRouterDom.useNavigate();
|
|
953
|
+
const permissionsToApply = getPermission({
|
|
954
|
+
isInContentTypeView,
|
|
955
|
+
contentTypeKind
|
|
956
|
+
});
|
|
957
|
+
const label = formatMessage({
|
|
958
|
+
id: 'content-type-builder.form.button.configure-view',
|
|
959
|
+
defaultMessage: 'Configure the view'
|
|
960
|
+
});
|
|
961
|
+
const handleClick = ()=>{
|
|
962
|
+
if (disabled) {
|
|
963
|
+
return false;
|
|
964
|
+
}
|
|
965
|
+
if (isInContentTypeView) {
|
|
966
|
+
navigate(`/content-manager/collection-types/${targetUid}/configurations/edit`);
|
|
967
|
+
} else {
|
|
968
|
+
navigate(`/content-manager/components/${targetUid}/configurations/edit`);
|
|
969
|
+
}
|
|
970
|
+
return false;
|
|
971
|
+
};
|
|
972
|
+
const { isLoading, allowedActions } = strapiAdmin.useRBAC({
|
|
973
|
+
viewConfig: permissionsToApply
|
|
974
|
+
});
|
|
975
|
+
if (isLoading) {
|
|
976
|
+
return null;
|
|
977
|
+
}
|
|
978
|
+
if (!allowedActions.canConfigureView && !allowedActions.canConfigureLayout) {
|
|
979
|
+
return null;
|
|
980
|
+
}
|
|
981
|
+
return /*#__PURE__*/ jsxRuntime.jsx(designSystem.Button, {
|
|
982
|
+
startIcon: /*#__PURE__*/ jsxRuntime.jsx(Icons.ListPlus, {}),
|
|
983
|
+
variant: "tertiary",
|
|
984
|
+
onClick: handleClick,
|
|
985
|
+
disabled: disabled,
|
|
986
|
+
children: label
|
|
987
|
+
});
|
|
988
|
+
});
|
|
989
|
+
|
|
990
|
+
const LayoutsHeaderCustom = styledComponents.styled(strapiAdmin.Layouts.Header)`
|
|
991
|
+
overflow-wrap: anywhere;
|
|
992
|
+
`;
|
|
993
|
+
const ListView = ()=>{
|
|
994
|
+
const { initialData, modifiedData, isInDevelopmentMode, isInContentTypeView, submitData } = index.useDataManager();
|
|
995
|
+
const { formatMessage } = reactIntl.useIntl();
|
|
996
|
+
const { trackUsage } = strapiAdmin.useTracking();
|
|
997
|
+
const match = reactRouterDom.useMatch('/plugins/content-type-builder/:kind/:currentUID');
|
|
998
|
+
const { onOpenModalAddComponentsToDZ, onOpenModalAddField, onOpenModalEditField, onOpenModalEditSchema, onOpenModalEditCustomField } = index.useFormModalNavigation();
|
|
999
|
+
const firstMainDataPath = isInContentTypeView ? 'contentType' : 'component';
|
|
1000
|
+
const mainDataTypeAttributesPath = [
|
|
1001
|
+
firstMainDataPath,
|
|
1002
|
+
'schema',
|
|
1003
|
+
'attributes'
|
|
1004
|
+
];
|
|
1005
|
+
const targetUid = get(modifiedData, [
|
|
1006
|
+
firstMainDataPath,
|
|
1007
|
+
'uid'
|
|
1008
|
+
]);
|
|
1009
|
+
const isTemporary = get(modifiedData, [
|
|
1010
|
+
firstMainDataPath,
|
|
1011
|
+
'isTemporary'
|
|
1012
|
+
], false);
|
|
1013
|
+
const contentTypeKind = get(modifiedData, [
|
|
1014
|
+
firstMainDataPath,
|
|
1015
|
+
'schema',
|
|
1016
|
+
'kind'
|
|
1017
|
+
], null);
|
|
1018
|
+
const attributes = get(modifiedData, mainDataTypeAttributesPath, []);
|
|
1019
|
+
const isFromPlugin = has(initialData, [
|
|
1020
|
+
firstMainDataPath,
|
|
1021
|
+
'plugin'
|
|
1022
|
+
]);
|
|
1023
|
+
const hasModelBeenModified = !isEqual(modifiedData, initialData);
|
|
1024
|
+
const forTarget = isInContentTypeView ? 'contentType' : 'component';
|
|
1025
|
+
const handleClickAddComponentToDZ = (dynamicZoneTarget)=>{
|
|
1026
|
+
onOpenModalAddComponentsToDZ({
|
|
1027
|
+
dynamicZoneTarget,
|
|
1028
|
+
targetUid
|
|
1029
|
+
});
|
|
1030
|
+
};
|
|
1031
|
+
const handleClickEditField = async (forTarget, targetUid, attributeName, type, customField)=>{
|
|
1032
|
+
const attributeType = getAttributeDisplayedType(type);
|
|
1033
|
+
const step = type === 'component' ? '2' : null;
|
|
1034
|
+
if (customField) {
|
|
1035
|
+
onOpenModalEditCustomField({
|
|
1036
|
+
forTarget,
|
|
1037
|
+
targetUid,
|
|
1038
|
+
attributeName,
|
|
1039
|
+
attributeType,
|
|
1040
|
+
customFieldUid: customField
|
|
1041
|
+
});
|
|
1042
|
+
} else {
|
|
1043
|
+
onOpenModalEditField({
|
|
1044
|
+
forTarget,
|
|
1045
|
+
targetUid,
|
|
1046
|
+
attributeName,
|
|
1047
|
+
attributeType,
|
|
1048
|
+
step
|
|
1049
|
+
});
|
|
1050
|
+
}
|
|
1051
|
+
};
|
|
1052
|
+
let label = get(modifiedData, [
|
|
1053
|
+
firstMainDataPath,
|
|
1054
|
+
'schema',
|
|
1055
|
+
'displayName'
|
|
1056
|
+
], '');
|
|
1057
|
+
const kind = get(modifiedData, [
|
|
1058
|
+
firstMainDataPath,
|
|
1059
|
+
'schema',
|
|
1060
|
+
'kind'
|
|
1061
|
+
], '');
|
|
1062
|
+
const isCreatingFirstContentType = match?.params.currentUID === 'create-content-type';
|
|
1063
|
+
if (!label && isCreatingFirstContentType) {
|
|
1064
|
+
label = formatMessage({
|
|
1065
|
+
id: index.getTrad('button.model.create'),
|
|
1066
|
+
defaultMessage: 'Create new collection type'
|
|
1067
|
+
});
|
|
1068
|
+
}
|
|
1069
|
+
const onEdit = ()=>{
|
|
1070
|
+
const contentType = kind || firstMainDataPath;
|
|
1071
|
+
if (contentType === 'collectionType') {
|
|
1072
|
+
trackUsage('willEditNameOfContentType');
|
|
1073
|
+
}
|
|
1074
|
+
if (contentType === 'singleType') {
|
|
1075
|
+
trackUsage('willEditNameOfSingleType');
|
|
1076
|
+
}
|
|
1077
|
+
onOpenModalEditSchema({
|
|
1078
|
+
modalType: firstMainDataPath,
|
|
1079
|
+
forTarget: firstMainDataPath,
|
|
1080
|
+
targetUid,
|
|
1081
|
+
kind: contentType
|
|
1082
|
+
});
|
|
1083
|
+
};
|
|
1084
|
+
reactRouterDom.unstable_usePrompt({
|
|
1085
|
+
when: hasModelBeenModified,
|
|
1086
|
+
message: formatMessage({
|
|
1087
|
+
id: index.getTrad('prompt.unsaved'),
|
|
1088
|
+
defaultMessage: 'Are you sure?'
|
|
1089
|
+
})
|
|
1090
|
+
});
|
|
1091
|
+
const primaryAction = isInDevelopmentMode && /*#__PURE__*/ jsxRuntime.jsxs(designSystem.Flex, {
|
|
1092
|
+
gap: 2,
|
|
1093
|
+
marginLeft: 2,
|
|
1094
|
+
children: [
|
|
1095
|
+
!isCreatingFirstContentType && /*#__PURE__*/ jsxRuntime.jsx(designSystem.Button, {
|
|
1096
|
+
startIcon: /*#__PURE__*/ jsxRuntime.jsx(Icons.Plus, {}),
|
|
1097
|
+
variant: "secondary",
|
|
1098
|
+
minWidth: "max-content",
|
|
1099
|
+
onClick: ()=>{
|
|
1100
|
+
onOpenModalAddField({
|
|
1101
|
+
forTarget,
|
|
1102
|
+
targetUid
|
|
1103
|
+
});
|
|
1104
|
+
},
|
|
1105
|
+
children: formatMessage({
|
|
1106
|
+
id: index.getTrad('button.attributes.add.another'),
|
|
1107
|
+
defaultMessage: 'Add another field'
|
|
1108
|
+
})
|
|
1109
|
+
}),
|
|
1110
|
+
/*#__PURE__*/ jsxRuntime.jsx(designSystem.Button, {
|
|
1111
|
+
startIcon: /*#__PURE__*/ jsxRuntime.jsx(Icons.Check, {}),
|
|
1112
|
+
onClick: async ()=>await submitData(),
|
|
1113
|
+
type: "submit",
|
|
1114
|
+
disabled: isEqual(modifiedData, initialData),
|
|
1115
|
+
children: formatMessage({
|
|
1116
|
+
id: 'global.save',
|
|
1117
|
+
defaultMessage: 'Save'
|
|
1118
|
+
})
|
|
1119
|
+
})
|
|
1120
|
+
]
|
|
1121
|
+
});
|
|
1122
|
+
const secondaryAction = isInDevelopmentMode && !isFromPlugin && !isCreatingFirstContentType && /*#__PURE__*/ jsxRuntime.jsx(designSystem.Button, {
|
|
1123
|
+
startIcon: /*#__PURE__*/ jsxRuntime.jsx(Icons.Pencil, {}),
|
|
1124
|
+
variant: "tertiary",
|
|
1125
|
+
onClick: onEdit,
|
|
1126
|
+
children: formatMessage({
|
|
1127
|
+
id: 'app.utils.edit',
|
|
1128
|
+
defaultMessage: 'Edit'
|
|
1129
|
+
})
|
|
1130
|
+
});
|
|
1131
|
+
return /*#__PURE__*/ jsxRuntime.jsxs(jsxRuntime.Fragment, {
|
|
1132
|
+
children: [
|
|
1133
|
+
/*#__PURE__*/ jsxRuntime.jsx(LayoutsHeaderCustom, {
|
|
1134
|
+
id: "title",
|
|
1135
|
+
primaryAction: primaryAction,
|
|
1136
|
+
secondaryAction: secondaryAction,
|
|
1137
|
+
title: upperFirst(label),
|
|
1138
|
+
subtitle: formatMessage({
|
|
1139
|
+
id: index.getTrad('listView.headerLayout.description'),
|
|
1140
|
+
defaultMessage: 'Build the data architecture of your content'
|
|
1141
|
+
}),
|
|
1142
|
+
navigationAction: /*#__PURE__*/ jsxRuntime.jsx(strapiAdmin.BackButton, {})
|
|
1143
|
+
}),
|
|
1144
|
+
/*#__PURE__*/ jsxRuntime.jsx(strapiAdmin.Layouts.Content, {
|
|
1145
|
+
children: /*#__PURE__*/ jsxRuntime.jsxs(designSystem.Flex, {
|
|
1146
|
+
direction: "column",
|
|
1147
|
+
alignItems: "stretch",
|
|
1148
|
+
gap: 4,
|
|
1149
|
+
children: [
|
|
1150
|
+
/*#__PURE__*/ jsxRuntime.jsx(designSystem.Flex, {
|
|
1151
|
+
justifyContent: "flex-end",
|
|
1152
|
+
children: /*#__PURE__*/ jsxRuntime.jsx(designSystem.Flex, {
|
|
1153
|
+
gap: 2,
|
|
1154
|
+
children: /*#__PURE__*/ jsxRuntime.jsx(LinkToCMSettingsView, {
|
|
1155
|
+
targetUid: targetUid,
|
|
1156
|
+
isInContentTypeView: isInContentTypeView,
|
|
1157
|
+
contentTypeKind: contentTypeKind,
|
|
1158
|
+
disabled: isCreatingFirstContentType || isTemporary
|
|
1159
|
+
}, "link-to-cm-settings-view")
|
|
1160
|
+
})
|
|
1161
|
+
}),
|
|
1162
|
+
/*#__PURE__*/ jsxRuntime.jsx(designSystem.Box, {
|
|
1163
|
+
background: "neutral0",
|
|
1164
|
+
shadow: "filterShadow",
|
|
1165
|
+
hasRadius: true,
|
|
1166
|
+
children: /*#__PURE__*/ jsxRuntime.jsx(List, {
|
|
1167
|
+
items: attributes,
|
|
1168
|
+
customRowComponent: (props)=>/*#__PURE__*/ jsxRuntime.jsx(ListRow, {
|
|
1169
|
+
...props,
|
|
1170
|
+
onClick: handleClickEditField
|
|
1171
|
+
}),
|
|
1172
|
+
addComponentToDZ: handleClickAddComponentToDZ,
|
|
1173
|
+
targetUid: targetUid,
|
|
1174
|
+
editTarget: forTarget,
|
|
1175
|
+
isMain: true
|
|
1176
|
+
})
|
|
1177
|
+
})
|
|
1178
|
+
]
|
|
1179
|
+
})
|
|
1180
|
+
})
|
|
1181
|
+
]
|
|
1182
|
+
});
|
|
1183
|
+
};
|
|
1184
|
+
|
|
1185
|
+
exports.default = ListView;
|
|
1186
|
+
//# sourceMappingURL=ListView-CQwvSbZH.js.map
|