@strapi/admin 4.10.2 → 4.10.5
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/admin/src/content-manager/components/Wysiwyg/WysiwygNav.js +156 -155
- package/admin/src/content-manager/pages/ListSettingsView/{utils/excludedSortOptions.js → constants.js} +1 -1
- package/admin/src/content-manager/pages/ListSettingsView/index.js +33 -36
- package/admin/src/pages/Admin/index.js +3 -0
- package/admin/src/pages/AuthPage/components/Register/index.js +1 -1
- package/admin/src/pages/MarketplacePage/components/NpmPackagesFilters/FilterSelect.js +1 -1
- package/admin/src/pages/MarketplacePage/components/NpmPackagesFilters/FiltersPopover.js +52 -41
- package/admin/src/pages/MarketplacePage/components/SortSelect/index.js +16 -0
- package/admin/src/pages/SettingsPage/pages/Users/components/SelectRoles/index.js +2 -2
- package/admin/src/translations/en.json +1 -0
- package/admin/src/translations/ru.json +7 -0
- package/build/{1387.84b454d3.chunk.js → 1387.437eb420.chunk.js} +1 -1
- package/build/{1657.45231968.chunk.js → 1657.85034334.chunk.js} +52 -52
- package/build/3081.c2cdfac8.chunk.js +108 -0
- package/build/3816.1a828046.chunk.js +211 -0
- package/build/462.a073ff1f.chunk.js +71 -0
- package/build/{4628.20631dd1.chunk.js → 4628.9cbb6df5.chunk.js} +1 -1
- package/build/5542.002522eb.chunk.js +71 -0
- package/build/{5563.986609ed.chunk.js → 5563.44e0ef15.chunk.js} +22 -22
- package/build/617.2c8c7183.chunk.js +155 -0
- package/build/{6858.56d4d528.chunk.js → 6858.85d76858.chunk.js} +6 -6
- package/build/6970.e8422af3.chunk.js +1 -0
- package/build/{7259.7a48aa2f.chunk.js → 7259.3ed2b60e.chunk.js} +1 -1
- package/build/{Admin-authenticatedApp.a8373103.chunk.js → Admin-authenticatedApp.6b74c5fd.chunk.js} +2 -2
- package/build/Admin_homePage.e15dcf28.chunk.js +73 -0
- package/build/Admin_marketplace.87f51b29.chunk.js +55 -0
- package/build/Admin_pluginsPage.7df6b5a9.chunk.js +6 -0
- package/build/{Admin_profilePage.1b337b73.chunk.js → Admin_profilePage.1687246a.chunk.js} +1 -1
- package/build/Admin_settingsPage.20884a40.chunk.js +79 -0
- package/build/Upload_ConfigureTheView.aa64ed9a.chunk.js +1 -0
- package/build/{admin-app.9bfe4ec7.chunk.js → admin-app.d4fd9379.chunk.js} +4 -4
- package/build/{admin-edit-roles-page.d0c9497b.chunk.js → admin-edit-roles-page.6fe9de49.chunk.js} +43 -41
- package/build/{admin-edit-users.ba27c532.chunk.js → admin-edit-users.49363035.chunk.js} +4 -4
- package/build/admin-roles-list.a323aa9f.chunk.js +31 -0
- package/build/admin-users.16bb6e77.chunk.js +34 -0
- package/build/audit-logs-settings-page.7ec976e1.chunk.js +129 -0
- package/build/content-manager.a97db8a1.chunk.js +1123 -0
- package/build/content-type-builder-list-view.1e821eb9.chunk.js +215 -0
- package/build/{content-type-builder-translation-en-json.446b611d.chunk.js → content-type-builder-translation-en-json.5e5f8607.chunk.js} +1 -1
- package/build/{content-type-builder.4737a30c.chunk.js → content-type-builder.51c64fe5.chunk.js} +4 -4
- package/build/email-settings-page.dba83275.chunk.js +11 -0
- package/build/en-json.1f6af924.chunk.js +1 -0
- package/build/i18n-settings-page.e34ec940.chunk.js +114 -0
- package/build/i18n-translation-ru-json.401bc498.chunk.js +1 -0
- package/build/index.html +1 -1
- package/build/main.57970a57.js +2674 -0
- package/build/review-workflows-settings.26409ce4.chunk.js +61 -0
- package/build/ru-json.678cd48b.chunk.js +1 -0
- package/build/{runtime~main.c20330f1.js → runtime~main.df78e1c7.js} +2 -2
- package/build/{sso-settings-page.f44d95d8.chunk.js → sso-settings-page.c9d7c8df.chunk.js} +1 -1
- package/build/upload-settings.63d99bf5.chunk.js +14 -0
- package/build/upload.bf183c0c.chunk.js +34 -0
- package/build/users-advanced-settings-page.4f49ca57.chunk.js +9 -0
- package/build/users-email-settings-page.756aa7ab.chunk.js +24 -0
- package/build/users-permissions-translation-ru-json.8e883c67.chunk.js +1 -0
- package/build/users-providers-settings-page.ff9e4c0a.chunk.js +29 -0
- package/build/webhook-edit-page.550be445.chunk.js +128 -0
- package/build/webhook-list-page.0983d83f.chunk.js +71 -0
- package/ee/admin/content-manager/components/DynamicTable/CellContent/ReviewWorkflowsStage/ReviewWorkflowsStageEE.js +12 -1
- package/ee/admin/content-manager/components/DynamicTable/CellContent/ReviewWorkflowsStage/getTableColumn.js +6 -1
- package/ee/admin/content-manager/pages/EditView/InformationBox/InformationBoxEE.js +4 -1
- package/ee/admin/pages/SettingsPage/pages/ReviewWorkflows/components/Stages/Stage/Stage.js +10 -7
- package/ee/admin/pages/SettingsPage/pages/ReviewWorkflows/components/Stages/Stage/components/OptionColor/OptionColor.js +11 -1
- package/ee/admin/pages/SettingsPage/pages/ReviewWorkflows/components/Stages/Stage/components/SingleValueColor/SingleValueColor.js +14 -1
- package/ee/admin/pages/SettingsPage/pages/ReviewWorkflows/utils/colors.js +7 -1
- package/ee/server/routes/audit-logs.js +43 -0
- package/ee/server/routes/index.js +5 -226
- package/ee/server/routes/license-limit.js +29 -0
- package/ee/server/routes/review-workflows.js +112 -0
- package/ee/server/routes/sso.js +60 -0
- package/ee/server/routes/utils.js +15 -0
- package/package.json +16 -16
- package/server/routes/index.js +16 -11
- package/webpack.alias.js +0 -1
- package/admin/src/content-manager/pages/ListSettingsView/utils/api.js +0 -10
- package/build/3081.bcf9a12f.chunk.js +0 -108
- package/build/462.8fff7f3b.chunk.js +0 -71
- package/build/5542.b8240e3f.chunk.js +0 -70
- package/build/6404.68405699.chunk.js +0 -100
- package/build/7725.1633e06f.chunk.js +0 -213
- package/build/9703.e590889d.chunk.js +0 -1
- package/build/Admin_homePage.9f7c0bb1.chunk.js +0 -73
- package/build/Admin_marketplace.a60cde15.chunk.js +0 -31
- package/build/Admin_pluginsPage.9e6fa51c.chunk.js +0 -6
- package/build/Admin_settingsPage.5e045f42.chunk.js +0 -79
- package/build/Upload_ConfigureTheView.4fc648b5.chunk.js +0 -1
- package/build/admin-roles-list.c759daa3.chunk.js +0 -31
- package/build/admin-users.ad5dd832.chunk.js +0 -34
- package/build/audit-logs-settings-page.45cb4fb5.chunk.js +0 -76
- package/build/content-manager.d28eb183.chunk.js +0 -1111
- package/build/content-type-builder-list-view.5ff685ec.chunk.js +0 -214
- package/build/email-settings-page.dc07d518.chunk.js +0 -10
- package/build/en-json.c7fc79af.chunk.js +0 -1
- package/build/i18n-settings-page.8219dd99.chunk.js +0 -60
- package/build/main.41970e4c.js +0 -2597
- package/build/review-workflows-settings.7c0b4e73.chunk.js +0 -61
- package/build/ru-json.e0662702.chunk.js +0 -1
- package/build/upload-settings.dd2d987c.chunk.js +0 -13
- package/build/upload.c8479232.chunk.js +0 -33
- package/build/users-advanced-settings-page.c36cfd59.chunk.js +0 -8
- package/build/users-email-settings-page.2716ce8e.chunk.js +0 -23
- package/build/users-permissions-translation-ru-json.20e177db.chunk.js +0 -1
- package/build/users-providers-settings-page.0d6304a5.chunk.js +0 -28
- package/build/webhook-edit-page.f4db86f3.chunk.js +0 -75
- package/build/webhook-list-page.30d73114.chunk.js +0 -71
|
@@ -1,1111 +0,0 @@
|
|
|
1
|
-
(self.webpackChunk_strapi_admin=self.webpackChunk_strapi_admin||[]).push([[994],{42814:function(ct,Ie){"use strict";Ie.Z=()=>null},43011:function(ct,Ie,d){"use strict";d.r(Ie),d.d(Ie,{App:function(){return js},default:function(){return Em}});var e=d(32735),ve=d(74758),te=d(53038),h=d(24989),Ce=d(27649),fe=d(82055),Pe=d(96709),H=d(67879),Ke=d(98978),we=d.n(Ke),ke=d(83983),be=d(47510),Fe=d(55433),Se=(0,e.createContext)(),Rt=d(47533),he=d(60216),n=d.n(he),Ne=(0,e.createContext)(),Vt=d(73386),de=d(56327),y=d(95952),J=d(15062),Ae=d(46339),Ye=d(4460);const Mt=()=>({type:Ye.c}),Tt=(t,r)=>({type:Ye.O,layout:t,query:r});var ut=d(70031),rt=d(8266),Oe=d.n(rt),$e=d(17e3),De=d(15335),ue=d(5803),P=d(87933),L=d(72850),je=d(68625),Ue=d(2669),Xe=d(66694),It=()=>(0,e.useContext)(Xe.ux),Ut=t=>{const{getAdminInjectedComponents:r}=It(),[o,s,a]=t.split(".");return r(o,s,a)};const Wr=({area:t,...r})=>Ut(t).map(s=>e.createElement(s.Component,{key:s.name,...r}));Wr.propTypes={area:n().string.isRequired};var Ht=Wr,Ws=d(33795),x=d.n(Ws),mt=d(3685);function zs(t,r){return o=>{const s=r(o.name);return e.createElement(t,{...o,...s})}}var Vs=zs;function Us(t){const{addComponentToDynamicZone:r,createActionAllowedFields:o,isCreatingEntry:s,formErrors:a,modifiedData:l,moveComponentField:i,removeComponentFromDynamicZone:c,readActionAllowedFields:p,updateActionAllowedFields:u}=(0,h.Wq)(),m=(0,e.useMemo)(()=>x()(l,[t],[]).map(b=>({componentUid:b.__component,id:b.id??b.__temp_key__})),[l,t]),f=(0,e.useMemo)(()=>(s?o:u).includes(t),[t,s,o,u]),g=(0,e.useMemo)(()=>(s?[]:p).includes(t),[t,s,p]);return{addComponentToDynamicZone:r,formErrors:a,isCreatingEntry:s,isFieldAllowed:f,isFieldReadable:g,moveComponentField:i,removeComponentFromDynamicZone:c,dynamicDisplayedComponents:m}}var Hs=Us,N=d(8471),Ot=d(51968),ye=d(50563),mn=d(83828),pn=d(61762),gn=d(89966),He=d(4038),Je=d(47081),Qs=d(61868),Gs=d.n(Qs);function Ks(t,r){return o=>{const s=r(o);return e.createElement(t,{...o,...s})}}var Ys=Ks,Xs=d(88708),xt=d.n(Xs);function Js({isFromDynamicZone:t,name:r}){const{addNonRepeatableComponentToField:o,createActionAllowedFields:s,isCreatingEntry:a,modifiedData:l,removeComponentFromField:i,readActionAllowedFields:c,updateActionAllowedFields:p,formErrors:u}=(0,h.Wq)(),{contentType:m}=(0,de.PL)(),f=(0,e.useMemo)(()=>{const D=x()(m,["attributes"],{});return Object.keys(D).filter(k=>x()(D,[k,"type"],"")==="dynamiczone")},[m]),g=(0,e.useMemo)(()=>a?s:p,[a,s,p]),b=x()(l,r,null),E=(0,e.useMemo)(()=>(0,y.Ts)(r),[r]),v=(0,e.useMemo)(()=>t&&a||g.filter(k=>k===E[0]).length>0?!0:g.map(k=>k.split(".")).filter(k=>k.length<E.length?!1:xt()(k,E.length).join(".")===E.join(".")).length>0,[t,a,g,E]),I=(0,e.useMemo)(()=>t||f.includes(E[0])?!0:(a?[]:c).map(k=>k.split(".")).filter(k=>k.length<E.length?!1:xt()(k,E.length).join(".")===E.join(".")).length>0,[t,f,E,a,c]),T=(0,e.useMemo)(()=>a||v?!1:I,[v,I,a]);return{addNonRepeatableComponentToField:o,formErrors:u,hasChildrenAllowedFields:v,hasChildrenReadableFields:I,isCreatingEntry:a,isReadOnly:T,removeComponentFromField:i,componentValue:b}}var _s=Js,Q=d(49372);const ea=(0,N.ZP)(L.x)`
|
|
2
|
-
svg path {
|
|
3
|
-
fill: ${({theme:t})=>t.colors.neutral500};
|
|
4
|
-
}
|
|
5
|
-
`,fn=({intlLabel:t,id:r,labelAction:o,name:s,numberOfEntries:a,showNumberOfEntries:l,required:i})=>{const{formatMessage:c}=(0,H.Z)(),p=t?.id?c(t):s;return e.createElement(L.x,{paddingBottom:1},e.createElement(P.k,null,e.createElement(Q.Z,{textColor:"neutral800",htmlFor:r||s,variant:"pi",fontWeight:"bold",as:"label"},p,l&&e.createElement(e.Fragment,null,"\xA0(",a,")"),i&&e.createElement(Q.Z,{textColor:"danger600"},"*")),o&&e.createElement(ea,{paddingLeft:1},o)))};fn.defaultProps={id:void 0,labelAction:void 0,numberOfEntries:0,required:!1,showNumberOfEntries:!1},fn.propTypes={id:n().string,intlLabel:n().shape({id:n().string.isRequired,defaultMessage:n().string.isRequired,values:n().object}).isRequired,labelAction:n().element,name:n().string.isRequired,numberOfEntries:n().number,required:n().bool,showNumberOfEntries:n().bool};var ta=fn,zr=d(86308);const na=N.ZP.span`
|
|
6
|
-
> svg {
|
|
7
|
-
width: ${(0,h.Q1)(24)};
|
|
8
|
-
height: ${(0,h.Q1)(24)};
|
|
9
|
-
> circle {
|
|
10
|
-
fill: ${({theme:t})=>t.colors.primary200};
|
|
11
|
-
}
|
|
12
|
-
> path {
|
|
13
|
-
fill: ${({theme:t})=>t.colors.primary600};
|
|
14
|
-
}
|
|
15
|
-
}
|
|
16
|
-
`,hn=({error:t,isReadOnly:r,onClick:o})=>{const{formatMessage:s}=(0,H.Z)();return e.createElement(e.Fragment,null,e.createElement(L.x,{as:"button",background:"neutral100",borderColor:t?"danger600":"neutral200",disabled:r,hasRadius:!0,onClick:o,paddingTop:9,paddingBottom:9,type:"button"},e.createElement(P.k,{direction:"column",gap:2},e.createElement(P.k,{justifyContent:"center",style:{cursor:r?"not-allowed":"inherit"}},e.createElement(na,null,e.createElement(zr.Z,null))),e.createElement(P.k,{justifyContent:"center"},e.createElement(Q.Z,{textColor:"primary600",variant:"pi",fontWeight:"bold"},s({id:(0,y.OB)("components.empty-repeatable"),defaultMessage:"No entry yet. Click on the button below to add one."}))))),t?.id&&e.createElement(Q.Z,{textColor:"danger600",variant:"pi"},s(t,{...t.values})))};hn.defaultProps={error:void 0,isReadOnly:!1},hn.propTypes={error:n().shape({id:n().string.isRequired,defaultMessage:n().string.isRequired,values:n().object}),isReadOnly:n().bool,onClick:n().func.isRequired};var Vr=hn,ra=d(9086),oa=d.n(ra),sa=d(87702),yn=d.n(sa),Om=d(27217),aa=d(88591),ia=d.n(aa),En=d(59845),la=d(20871),ca=d.n(la),da=d(48375),Ur=d.n(da),ua=d(31089),ma=d.n(ua),pa=d(16043),ga=d.n(pa),fa=d(5109),ha=d.n(fa),ya=d(47955),Ea=d.n(ya),ba=d(95706),va=d.n(ba),Ca=d(6658),Ra=d.n(Ca),Ma=d(36407),Ta=d.n(Ma);(async()=>{await d.e(7347).then(d.bind(d,74194))})();const pt=new(ia())({html:!0,xhtmlOut:!1,breaks:!0,langPrefix:"language-",linkify:!0,typographer:!0,highlight(t,r){if(r&&r!=="auto"&&(0,En.getLanguage)(r))return'<pre class="hljs language-'+pt.utils.escapeHtml(r.toLowerCase())+'"><code>'+(0,En.highlight)(r,t,!0).value+"</code></pre>";if(r==="auto"){const o=(0,En.highlightAuto)(t);return'<pre class="hljs language-'+pt.utils.escapeHtml(o.language)+'"><code>'+o.value+"</code></pre>"}return'<pre class="hljs"><code>'+pt.utils.escapeHtml(t)+"</code></pre>"}}).use(ca()).use(Ur(),"warning").use(Ur(),"tip").use(ma()).use(ga()).use(ha()).use(Ea()).use(va()).use(Ra()).use(Ta());pt.renderer.rules.footnote_ref=(t,r,o,s,a)=>'<sup class="footnote-ref"><span>'+a.rules.footnote_caption(t,r,o,s,a)+"</span></sup>",pt.renderer.rules.footnote_anchor=()=>' <span class="footnote-backref">\u21A9\uFE0E</span>';var Da=pt,Ia=d(13993),Hr=d.n(Ia);const ka={...Hr().defaults,allowedTags:!1,allowedAttributes:{"*":["href","align","alt","center","width","height","type","controls","target"],img:["src","alt"],source:["src","type"]}};var Oa=t=>Hr()(t,ka),xa=N.ZP.div`
|
|
17
|
-
position: absolute;
|
|
18
|
-
top: 0;
|
|
19
|
-
width: 100%;
|
|
20
|
-
height: 100%;
|
|
21
|
-
overflow: auto;
|
|
22
|
-
padding: ${({theme:t})=>`${t.spaces[3]} ${t.spaces[4]}`};
|
|
23
|
-
font-size: ${14/16}rem;
|
|
24
|
-
background-color: ${({theme:t})=>t.colors.neutral0};
|
|
25
|
-
color: ${({theme:t})=>t.colors.neutral800};
|
|
26
|
-
line-height: ${({theme:t})=>t.lineHeights[6]};
|
|
27
|
-
|
|
28
|
-
h1,
|
|
29
|
-
h2,
|
|
30
|
-
h3,
|
|
31
|
-
h4,
|
|
32
|
-
h5,
|
|
33
|
-
h6 {
|
|
34
|
-
margin-block-start: ${({theme:t})=>t.spaces[2]};
|
|
35
|
-
margin-block-end: ${({theme:t})=>t.spaces[2]};
|
|
36
|
-
}
|
|
37
|
-
|
|
38
|
-
p {
|
|
39
|
-
margin-bottom: ${({theme:t})=>t.spaces[2]};
|
|
40
|
-
}
|
|
41
|
-
|
|
42
|
-
h1 {
|
|
43
|
-
font-size: ${36/16}rem;
|
|
44
|
-
font-weight: 600;
|
|
45
|
-
}
|
|
46
|
-
|
|
47
|
-
h2 {
|
|
48
|
-
font-size: ${30/16}rem;
|
|
49
|
-
font-weight: 500;
|
|
50
|
-
}
|
|
51
|
-
|
|
52
|
-
h3 {
|
|
53
|
-
font-size: ${24/16}rem;
|
|
54
|
-
font-weight: 500;
|
|
55
|
-
}
|
|
56
|
-
|
|
57
|
-
h4 {
|
|
58
|
-
font-size: ${20/16}rem;
|
|
59
|
-
font-weight: 500;
|
|
60
|
-
}
|
|
61
|
-
|
|
62
|
-
strong {
|
|
63
|
-
font-weight: 800;
|
|
64
|
-
}
|
|
65
|
-
|
|
66
|
-
em {
|
|
67
|
-
font-style: italic;
|
|
68
|
-
}
|
|
69
|
-
|
|
70
|
-
blockquote {
|
|
71
|
-
margin-top: ${({theme:t})=>t.spaces[8]};
|
|
72
|
-
margin-bottom: ${({theme:t})=>t.spaces[7]};
|
|
73
|
-
font-size: ${14/16}rem;
|
|
74
|
-
font-weight: 400;
|
|
75
|
-
border-left: 4px solid ${({theme:t})=>t.colors.neutral150};
|
|
76
|
-
font-style: italic;
|
|
77
|
-
padding: ${({theme:t})=>t.spaces[2]} ${({theme:t})=>t.spaces[5]};
|
|
78
|
-
}
|
|
79
|
-
|
|
80
|
-
img {
|
|
81
|
-
max-width: 100%;
|
|
82
|
-
}
|
|
83
|
-
|
|
84
|
-
table {
|
|
85
|
-
thead {
|
|
86
|
-
background: ${({theme:t})=>t.colors.neutral150};
|
|
87
|
-
|
|
88
|
-
th {
|
|
89
|
-
padding: ${({theme:t})=>t.spaces[4]};
|
|
90
|
-
}
|
|
91
|
-
}
|
|
92
|
-
tr {
|
|
93
|
-
border: 1px solid ${({theme:t})=>t.colors.neutral200};
|
|
94
|
-
}
|
|
95
|
-
th,
|
|
96
|
-
td {
|
|
97
|
-
padding: ${({theme:t})=>t.spaces[4]};
|
|
98
|
-
border: 1px solid ${({theme:t})=>t.colors.neutral200};
|
|
99
|
-
border-bottom: 0;
|
|
100
|
-
border-top: 0;
|
|
101
|
-
}
|
|
102
|
-
}
|
|
103
|
-
|
|
104
|
-
pre,
|
|
105
|
-
code {
|
|
106
|
-
font-size: ${14/16}rem;
|
|
107
|
-
border-radius: 4px;
|
|
108
|
-
/*
|
|
109
|
-
Hard coded since the color is the same between themes,
|
|
110
|
-
theme.colors.neutral800 changes between themes.
|
|
111
|
-
|
|
112
|
-
Matches the color of the JSON Input component.
|
|
113
|
-
*/
|
|
114
|
-
background-color: #32324d;
|
|
115
|
-
max-width: 100%;
|
|
116
|
-
overflow: auto;
|
|
117
|
-
padding: ${({theme:t})=>t.spaces[2]};
|
|
118
|
-
}
|
|
119
|
-
|
|
120
|
-
/* Inline code */
|
|
121
|
-
p,
|
|
122
|
-
pre,
|
|
123
|
-
td {
|
|
124
|
-
> code {
|
|
125
|
-
color: #839496;
|
|
126
|
-
}
|
|
127
|
-
}
|
|
128
|
-
|
|
129
|
-
ol {
|
|
130
|
-
list-style-type: decimal;
|
|
131
|
-
margin-block-start: ${({theme:t})=>t.spaces[4]};
|
|
132
|
-
margin-block-end: ${({theme:t})=>t.spaces[4]};
|
|
133
|
-
margin-inline-start: 0px;
|
|
134
|
-
margin-inline-end: 0px;
|
|
135
|
-
padding-inline-start: ${({theme:t})=>t.spaces[4]};
|
|
136
|
-
|
|
137
|
-
ol,
|
|
138
|
-
ul {
|
|
139
|
-
margin-block-start: 0px;
|
|
140
|
-
margin-block-end: 0px;
|
|
141
|
-
}
|
|
142
|
-
}
|
|
143
|
-
|
|
144
|
-
ul {
|
|
145
|
-
list-style-type: disc;
|
|
146
|
-
margin-block-start: ${({theme:t})=>t.spaces[4]};
|
|
147
|
-
margin-block-end: ${({theme:t})=>t.spaces[4]};
|
|
148
|
-
margin-inline-start: 0px;
|
|
149
|
-
margin-inline-end: 0px;
|
|
150
|
-
padding-inline-start: ${({theme:t})=>t.spaces[4]};
|
|
151
|
-
|
|
152
|
-
ul,
|
|
153
|
-
ol {
|
|
154
|
-
margin-block-start: 0px;
|
|
155
|
-
margin-block-end: 0px;
|
|
156
|
-
}
|
|
157
|
-
}
|
|
158
|
-
`;const bn=({data:t})=>{const r=(0,e.useMemo)(()=>Oa(Da.render(t.replaceAll("\\n",`
|
|
159
|
-
`)||"")),[t]);return e.createElement(xa,null,e.createElement("div",{dangerouslySetInnerHTML:{__html:r}}))};bn.defaultProps={data:""},bn.propTypes={data:n().string};var Qr=(0,e.memo)(bn);const Pa=N.ZP.div`
|
|
160
|
-
cursor: ${({disabled:t})=>t?"not-allowed !important":"auto"};
|
|
161
|
-
height: 100%;
|
|
162
|
-
/* BASICS */
|
|
163
|
-
.CodeMirror-placeholder {
|
|
164
|
-
color: ${({theme:t})=>t.colors.neutral600} !important;
|
|
165
|
-
}
|
|
166
|
-
|
|
167
|
-
.CodeMirror {
|
|
168
|
-
/* Set height, width, borders, and global font properties here */
|
|
169
|
-
font-size: ${14/16}rem;
|
|
170
|
-
height: ${({isExpandMode:t})=>t?"100%":"290px"};
|
|
171
|
-
color: ${({theme:t})=>t.colors.neutral800};
|
|
172
|
-
direction: ltr;
|
|
173
|
-
font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Oxygen, Ubuntu, Cantarell,
|
|
174
|
-
'Open Sans', 'Helvetica Neue', sans-serif;
|
|
175
|
-
}
|
|
176
|
-
|
|
177
|
-
/* PADDING */
|
|
178
|
-
|
|
179
|
-
.CodeMirror-lines {
|
|
180
|
-
padding: ${({theme:t})=>`${t.spaces[3]} ${t.spaces[4]}`};
|
|
181
|
-
/* Vertical padding around content */
|
|
182
|
-
}
|
|
183
|
-
|
|
184
|
-
.CodeMirror-scrollbar-filler,
|
|
185
|
-
.CodeMirror-gutter-filler {
|
|
186
|
-
/* The little square between H and V scrollbars */
|
|
187
|
-
background-color: ${({theme:t})=>`${t.colors.neutral0}`};
|
|
188
|
-
}
|
|
189
|
-
|
|
190
|
-
/* GUTTER */
|
|
191
|
-
|
|
192
|
-
.CodeMirror-gutters {
|
|
193
|
-
border-right: 1px solid #ddd;
|
|
194
|
-
background-color: #f7f7f7;
|
|
195
|
-
white-space: nowrap;
|
|
196
|
-
}
|
|
197
|
-
.CodeMirror-linenumbers {
|
|
198
|
-
}
|
|
199
|
-
.CodeMirror-linenumber {
|
|
200
|
-
padding: 0 3px 0 5px;
|
|
201
|
-
min-width: 20px;
|
|
202
|
-
text-align: right;
|
|
203
|
-
color: #999;
|
|
204
|
-
white-space: nowrap;
|
|
205
|
-
}
|
|
206
|
-
|
|
207
|
-
.CodeMirror-guttermarker {
|
|
208
|
-
color: black;
|
|
209
|
-
}
|
|
210
|
-
.CodeMirror-guttermarker-subtle {
|
|
211
|
-
color: #999;
|
|
212
|
-
}
|
|
213
|
-
|
|
214
|
-
/* CURSOR */
|
|
215
|
-
|
|
216
|
-
.CodeMirror-cursor {
|
|
217
|
-
border-left: 1px solid black;
|
|
218
|
-
border-right: none;
|
|
219
|
-
width: 0;
|
|
220
|
-
}
|
|
221
|
-
/* Shown when moving in bi-directional text */
|
|
222
|
-
.CodeMirror div.CodeMirror-secondarycursor {
|
|
223
|
-
border-left: 1px solid silver;
|
|
224
|
-
}
|
|
225
|
-
.cm-fat-cursor .CodeMirror-cursor {
|
|
226
|
-
width: auto;
|
|
227
|
-
border: 0 !important;
|
|
228
|
-
background: #7e7;
|
|
229
|
-
}
|
|
230
|
-
.cm-fat-cursor div.CodeMirror-cursors {
|
|
231
|
-
/* z-index: 1; */
|
|
232
|
-
}
|
|
233
|
-
|
|
234
|
-
.cm-fat-cursor-mark {
|
|
235
|
-
background-color: rgba(20, 255, 20, 0.5);
|
|
236
|
-
-webkit-animation: blink 1.06s steps(1) infinite;
|
|
237
|
-
-moz-animation: blink 1.06s steps(1) infinite;
|
|
238
|
-
animation: blink 1.06s steps(1) infinite;
|
|
239
|
-
}
|
|
240
|
-
.cm-animate-fat-cursor {
|
|
241
|
-
width: auto;
|
|
242
|
-
border: 0;
|
|
243
|
-
-webkit-animation: blink 1.06s steps(1) infinite;
|
|
244
|
-
-moz-animation: blink 1.06s steps(1) infinite;
|
|
245
|
-
animation: blink 1.06s steps(1) infinite;
|
|
246
|
-
background-color: #7e7;
|
|
247
|
-
}
|
|
248
|
-
|
|
249
|
-
/* Can style cursor different in overwrite (non-insert) mode */
|
|
250
|
-
.CodeMirror-overwrite .CodeMirror-cursor {
|
|
251
|
-
}
|
|
252
|
-
|
|
253
|
-
.cm-tab {
|
|
254
|
-
display: inline-block;
|
|
255
|
-
text-decoration: inherit;
|
|
256
|
-
}
|
|
257
|
-
|
|
258
|
-
.CodeMirror-rulers {
|
|
259
|
-
position: absolute;
|
|
260
|
-
left: 0;
|
|
261
|
-
right: 0;
|
|
262
|
-
top: -50px;
|
|
263
|
-
bottom: 0;
|
|
264
|
-
overflow: hidden;
|
|
265
|
-
}
|
|
266
|
-
.CodeMirror-ruler {
|
|
267
|
-
border-left: 1px solid #ccc;
|
|
268
|
-
top: 0;
|
|
269
|
-
bottom: 0;
|
|
270
|
-
position: absolute;
|
|
271
|
-
}
|
|
272
|
-
|
|
273
|
-
/* DEFAULT THEME */
|
|
274
|
-
|
|
275
|
-
.cm-header,
|
|
276
|
-
.cm-strong {
|
|
277
|
-
font-weight: bold;
|
|
278
|
-
}
|
|
279
|
-
.cm-em {
|
|
280
|
-
font-style: italic;
|
|
281
|
-
}
|
|
282
|
-
.cm-link {
|
|
283
|
-
text-decoration: underline;
|
|
284
|
-
}
|
|
285
|
-
.cm-strikethrough {
|
|
286
|
-
text-decoration: line-through;
|
|
287
|
-
}
|
|
288
|
-
|
|
289
|
-
.CodeMirror-composing {
|
|
290
|
-
border-bottom: 2px solid;
|
|
291
|
-
}
|
|
292
|
-
|
|
293
|
-
/* Default styles for common addons */
|
|
294
|
-
|
|
295
|
-
div.CodeMirror span.CodeMirror-matchingbracket {
|
|
296
|
-
color: #0b0;
|
|
297
|
-
}
|
|
298
|
-
div.CodeMirror span.CodeMirror-nonmatchingbracket {
|
|
299
|
-
color: #a22;
|
|
300
|
-
}
|
|
301
|
-
.CodeMirror-matchingtag {
|
|
302
|
-
background: rgba(255, 150, 0, 0.3);
|
|
303
|
-
}
|
|
304
|
-
.CodeMirror-activeline-background {
|
|
305
|
-
background: #e8f2ff;
|
|
306
|
-
}
|
|
307
|
-
|
|
308
|
-
/* STOP */
|
|
309
|
-
|
|
310
|
-
/* The rest of this file contains styles related to the mechanics of
|
|
311
|
-
the editor. You probably shouldn't touch them. */
|
|
312
|
-
|
|
313
|
-
.CodeMirror {
|
|
314
|
-
position: relative;
|
|
315
|
-
overflow: hidden;
|
|
316
|
-
background: ${({theme:t})=>`${t.colors.neutral0}`};
|
|
317
|
-
}
|
|
318
|
-
|
|
319
|
-
.CodeMirror-scroll {
|
|
320
|
-
overflow: scroll !important; /* Things will break if this is overridden */
|
|
321
|
-
/* 50px is the magic margin used to hide the element's real scrollbars */
|
|
322
|
-
/* See overflow: hidden in .CodeMirror */
|
|
323
|
-
margin-bottom: -50px;
|
|
324
|
-
margin-right: -50px;
|
|
325
|
-
padding-bottom: 50px;
|
|
326
|
-
height: 100%;
|
|
327
|
-
outline: none; /* Prevent dragging from highlighting the element */
|
|
328
|
-
position: relative;
|
|
329
|
-
}
|
|
330
|
-
.CodeMirror-sizer {
|
|
331
|
-
position: relative;
|
|
332
|
-
border-right: 50px solid transparent;
|
|
333
|
-
}
|
|
334
|
-
|
|
335
|
-
/* The fake, visible scrollbars. Used to force redraw during scrolling
|
|
336
|
-
before actual scrolling happens, thus preventing shaking and
|
|
337
|
-
flickering artifacts. */
|
|
338
|
-
.CodeMirror-vscrollbar,
|
|
339
|
-
.CodeMirror-hscrollbar,
|
|
340
|
-
.CodeMirror-scrollbar-filler,
|
|
341
|
-
.CodeMirror-gutter-filler {
|
|
342
|
-
position: absolute;
|
|
343
|
-
z-index: 1;
|
|
344
|
-
display: none;
|
|
345
|
-
outline: none;
|
|
346
|
-
}
|
|
347
|
-
|
|
348
|
-
.CodeMirror-vscrollbar {
|
|
349
|
-
right: 0;
|
|
350
|
-
top: 0;
|
|
351
|
-
overflow-x: hidden;
|
|
352
|
-
overflow-y: scroll;
|
|
353
|
-
}
|
|
354
|
-
.CodeMirror-hscrollbar {
|
|
355
|
-
bottom: 0;
|
|
356
|
-
left: 0;
|
|
357
|
-
overflow-y: hidden;
|
|
358
|
-
overflow-x: scroll;
|
|
359
|
-
}
|
|
360
|
-
.CodeMirror-scrollbar-filler {
|
|
361
|
-
right: 0;
|
|
362
|
-
bottom: 0;
|
|
363
|
-
}
|
|
364
|
-
|
|
365
|
-
.CodeMirror-lines {
|
|
366
|
-
cursor: text;
|
|
367
|
-
min-height: 1px; /* prevents collapsing before first draw */
|
|
368
|
-
}
|
|
369
|
-
/* Reset some styles that the rest of the page might have set */
|
|
370
|
-
.CodeMirror pre.CodeMirror-line,
|
|
371
|
-
.CodeMirror pre.CodeMirror-line-like {
|
|
372
|
-
-moz-border-radius: 0;
|
|
373
|
-
-webkit-border-radius: 0;
|
|
374
|
-
border-radius: 0;
|
|
375
|
-
border-width: 0;
|
|
376
|
-
background: transparent;
|
|
377
|
-
font-family: inherit;
|
|
378
|
-
font-size: inherit;
|
|
379
|
-
margin: 0;
|
|
380
|
-
white-space: pre;
|
|
381
|
-
word-wrap: normal;
|
|
382
|
-
line-height: 1.5;
|
|
383
|
-
color: inherit;
|
|
384
|
-
/* z-index: 2; */
|
|
385
|
-
position: relative;
|
|
386
|
-
overflow: visible;
|
|
387
|
-
-webkit-tap-highlight-color: transparent;
|
|
388
|
-
-webkit-font-variant-ligatures: contextual;
|
|
389
|
-
font-variant-ligatures: contextual;
|
|
390
|
-
}
|
|
391
|
-
|
|
392
|
-
.CodeMirror pre.CodeMirror-line-like {
|
|
393
|
-
z-index: 2;
|
|
394
|
-
}
|
|
395
|
-
|
|
396
|
-
.CodeMirror-wrap pre.CodeMirror-line,
|
|
397
|
-
.CodeMirror-wrap pre.CodeMirror-line-like {
|
|
398
|
-
word-wrap: break-word;
|
|
399
|
-
white-space: pre-wrap;
|
|
400
|
-
word-break: normal;
|
|
401
|
-
}
|
|
402
|
-
|
|
403
|
-
.CodeMirror-linebackground {
|
|
404
|
-
position: absolute;
|
|
405
|
-
left: 0;
|
|
406
|
-
right: 0;
|
|
407
|
-
top: 0;
|
|
408
|
-
bottom: 0;
|
|
409
|
-
z-index: 0;
|
|
410
|
-
}
|
|
411
|
-
|
|
412
|
-
.CodeMirror-linewidget {
|
|
413
|
-
position: relative;
|
|
414
|
-
/* z-index: 2; */
|
|
415
|
-
padding: 0.1px; /* Force widget margins to stay inside of the container */
|
|
416
|
-
}
|
|
417
|
-
|
|
418
|
-
.CodeMirror-widget {
|
|
419
|
-
}
|
|
420
|
-
|
|
421
|
-
.CodeMirror-rtl pre {
|
|
422
|
-
direction: rtl;
|
|
423
|
-
}
|
|
424
|
-
|
|
425
|
-
.CodeMirror-code {
|
|
426
|
-
outline: none;
|
|
427
|
-
}
|
|
428
|
-
|
|
429
|
-
/* Force content-box sizing for the elements where we expect it */
|
|
430
|
-
.CodeMirror-scroll,
|
|
431
|
-
.CodeMirror-sizer,
|
|
432
|
-
.CodeMirror-gutter,
|
|
433
|
-
.CodeMirror-gutters,
|
|
434
|
-
.CodeMirror-linenumber {
|
|
435
|
-
-moz-box-sizing: content-box;
|
|
436
|
-
box-sizing: content-box;
|
|
437
|
-
}
|
|
438
|
-
|
|
439
|
-
.CodeMirror-measure {
|
|
440
|
-
position: absolute;
|
|
441
|
-
width: 100%;
|
|
442
|
-
height: 0;
|
|
443
|
-
overflow: hidden;
|
|
444
|
-
visibility: hidden;
|
|
445
|
-
}
|
|
446
|
-
|
|
447
|
-
.CodeMirror-cursor {
|
|
448
|
-
position: absolute;
|
|
449
|
-
pointer-events: none;
|
|
450
|
-
border-color: ${({theme:t})=>`${t.colors.neutral800}`};
|
|
451
|
-
}
|
|
452
|
-
.CodeMirror-measure pre {
|
|
453
|
-
position: static;
|
|
454
|
-
}
|
|
455
|
-
|
|
456
|
-
div.CodeMirror-cursors {
|
|
457
|
-
visibility: hidden;
|
|
458
|
-
position: relative;
|
|
459
|
-
+ div {
|
|
460
|
-
z-index: 0 !important;
|
|
461
|
-
}
|
|
462
|
-
}
|
|
463
|
-
|
|
464
|
-
div.CodeMirror-dragcursors {
|
|
465
|
-
visibility: visible;
|
|
466
|
-
}
|
|
467
|
-
|
|
468
|
-
.CodeMirror-focused div.CodeMirror-cursors {
|
|
469
|
-
visibility: visible;
|
|
470
|
-
}
|
|
471
|
-
|
|
472
|
-
.CodeMirror-selected {
|
|
473
|
-
background: ${({theme:t})=>t.colors.neutral200};
|
|
474
|
-
/* z-index: -10; */
|
|
475
|
-
}
|
|
476
|
-
.CodeMirror-crosshair {
|
|
477
|
-
cursor: crosshair;
|
|
478
|
-
}
|
|
479
|
-
|
|
480
|
-
/* Used to force a border model for a node */
|
|
481
|
-
.cm-force-border {
|
|
482
|
-
padding-right: 0.1px;
|
|
483
|
-
}
|
|
484
|
-
|
|
485
|
-
/* See issue #2901 */
|
|
486
|
-
.cm-tab-wrap-hack:after {
|
|
487
|
-
content: '';
|
|
488
|
-
}
|
|
489
|
-
|
|
490
|
-
/* Help users use markselection to safely style text background */
|
|
491
|
-
span.CodeMirror-selectedtext {
|
|
492
|
-
background: none;
|
|
493
|
-
}
|
|
494
|
-
|
|
495
|
-
span {
|
|
496
|
-
color: ${({theme:t})=>t.colors.neutral800} !important;
|
|
497
|
-
}
|
|
498
|
-
`;var vn=d(69783);const xe=(0,N.ZP)(ye.h)`
|
|
499
|
-
padding: ${({theme:t})=>t.spaces[2]};
|
|
500
|
-
/* Trick to prevent the outline from overflowing because of the general outline-offset */
|
|
501
|
-
outline-offset: -2px !important;
|
|
502
|
-
|
|
503
|
-
svg {
|
|
504
|
-
width: ${18/16}rem;
|
|
505
|
-
height: ${18/16}rem;
|
|
506
|
-
}
|
|
507
|
-
`,wa=(0,N.ZP)(xe)`
|
|
508
|
-
svg {
|
|
509
|
-
width: ${8/16}rem;
|
|
510
|
-
height: ${8/16}rem;
|
|
511
|
-
}
|
|
512
|
-
`,Gr=(0,N.ZP)(ye.o)`
|
|
513
|
-
margin-left: ${({theme:t})=>t.spaces[4]};
|
|
514
|
-
`,Kr=(0,N.ZP)(ye.h)`
|
|
515
|
-
margin: ${({theme:t})=>`0 ${t.spaces[2]}`};
|
|
516
|
-
padding: ${({theme:t})=>t.spaces[2]};
|
|
517
|
-
|
|
518
|
-
svg {
|
|
519
|
-
width: ${18/16}rem;
|
|
520
|
-
height: ${18/16}rem;
|
|
521
|
-
}
|
|
522
|
-
`,Fa=(0,N.ZP)(ye.o)`
|
|
523
|
-
margin-right: ${({theme:t})=>`${t.spaces[2]}`};
|
|
524
|
-
`,La=N.ZP.div`
|
|
525
|
-
position: relative;
|
|
526
|
-
height: calc(100% - 48px);
|
|
527
|
-
`,Sa=(0,N.ZP)(vn.Y)`
|
|
528
|
-
background-color: transparent;
|
|
529
|
-
border: none;
|
|
530
|
-
align-items: center;
|
|
531
|
-
|
|
532
|
-
svg {
|
|
533
|
-
margin-left: ${({theme:t})=>`${t.spaces[2]}`};
|
|
534
|
-
path {
|
|
535
|
-
fill: ${({theme:t})=>t.colors.neutral700};
|
|
536
|
-
width: ${12/16}rem;
|
|
537
|
-
height: ${12/16}rem;
|
|
538
|
-
}
|
|
539
|
-
}
|
|
540
|
-
`;var Qt=/^(\s*)(>[> ]*|[*+-] \[[x ]\]\s|[*+-]\s|(\d+)([.)]))(\s*)/,Aa=/^(\s*)(>[> ]*|[*+-] \[[x ]\]|[*+-]|(\d+)[.)])(\s*)$/,$a=/[*+-]\s/;function Za(t){if(t.getOption("disableInput"))return yn().Pass;for(var r=t.listSelections(),o=[],s=0;s<r.length;s++){var a=r[s].head,l=t.getStateAfter(a.line),i=l.list!==!1,c=l.quote!==0,p=t.getLine(a.line),u=Qt.exec(p),m=/^\s*$/.test(p.slice(0,a.ch));if(!r[s].empty()||!i&&!c||!u||m){t.execCommand("newlineAndIndent");return}if(Aa.test(p)){var f=c&&/>\s*$/.test(p),g=!/>\s*$/.test(p);(f||g)&&t.replaceRange("",{line:a.line,ch:0},{line:a.line,ch:a.ch+1}),o[s]=`
|
|
541
|
-
`}else{var b=u[1],E=u[5],v=!($a.test(u[2])||u[2].indexOf(">")>=0),I=v?parseInt(u[3],10)+1+u[4]:u[2].replace("x"," ");o[s]=`
|
|
542
|
-
`+b+I+E,v&&Ba(t,a)}}t.replaceSelections(o)}function Ba(t,r){var o=r.line,s=0,a=0,l=Qt.exec(t.getLine(o)),i=l[1];do{s+=1;var c=o+s,p=t.getLine(c),u=Qt.exec(p);if(u){var m=u[1],f=parseInt(l[3],10)+s-a,g=parseInt(u[3],10),b=g;if(i===m&&!isNaN(g))f===g&&(b=g+1),f>g&&(b=f+1),t.replaceRange(p.replace(Qt,m+b+u[4]+u[5]),{line:c,ch:0},{line:c,ch:p.length});else{if(i.length>m.length||i.length<m.length&&s===1)return;a+=1}}}while(u)}var qa=Za;const Cn=({disabled:t,editorRef:r,error:o,isPreviewMode:s,isExpandMode:a,name:l,onChange:i,placeholder:c,textareaRef:p,value:u})=>{const m=(0,e.useRef)(i);return(0,e.useEffect)(()=>{r.current=yn().fromTextArea(p.current,{lineWrapping:!0,extraKeys:{Enter:"newlineAndIndentContinueMarkdownList",Tab:!1,"Shift-Tab":!1},readOnly:!1,smartIndent:!1,placeholder:c,spellcheck:!0,inputStyle:"contenteditable"}),yn().commands.newlineAndIndentContinueMarkdownList=qa,r.current.on("change",f=>{m.current({target:{name:l,value:f.getValue(),type:"wysiwyg"}})})},[r,p,l,c]),(0,e.useEffect)(()=>{u&&!r.current.hasFocus()&&r.current.setValue(u)},[r,u]),(0,e.useEffect)(()=>{s||t?r.current.setOption("readOnly","nocursor"):r.current.setOption("readOnly",!1)},[t,s,r]),(0,e.useEffect)(()=>{o?r.current.setOption("screenReaderLabel",o):r.current.setOption("screenReaderLabel","Editor")},[r,o]),e.createElement(La,null,e.createElement(Pa,{isExpandMode:a,disabled:t||s},e.createElement("textarea",{ref:p})),s&&e.createElement(Qr,{data:u}))};Cn.defaultProps={disabled:!1,error:void 0,isPreviewMode:!1,isExpandMode:!1,placeholder:"",value:""},Cn.propTypes={disabled:n().bool,editorRef:n().shape({current:n().any}).isRequired,error:n().string,isPreviewMode:n().bool,isExpandMode:n().bool,name:n().string.isRequired,onChange:n().func.isRequired,placeholder:n().string,textareaRef:n().shape({current:n().any}).isRequired,value:n().string};var Na=Cn,We=d(80084),Ee=d(84967),me=d(41415),ja=d(4101),Yr=d(67563),Xr=d(73906),Jr=d(49844),_r=d(99283),eo=d(49825),Wa=d(83139),za=d(35635),Va=d(20063),Ua=d(80601),Ha=d(11417),Qa=d(43231),Ga=d(65663);const Rn=({disabled:t,editorRef:r,isExpandMode:o,isPreviewMode:s,onActionClick:a,onToggleMediaLib:l,onTogglePreviewMode:i})=>{const[c,p]=(0,e.useState)(!1),{formatMessage:u}=(0,H.Z)(),m=u({id:"components.Wysiwyg.selectOptions.title",defaultMessage:"Add a title"}),f=(0,e.useRef)(),g=()=>{p(b=>!b)};return t||s?e.createElement(L.x,{padding:2,background:"neutral100"},e.createElement(P.k,{justifyContent:"space-between"},e.createElement(P.k,null,e.createElement(We.P,{disabled:!0,id:"selectTitle",placeholder:m,size:"S","aria-label":m},e.createElement(Ee.W,{value:"h1"},"h1"),e.createElement(Ee.W,{value:"h2"},"h2"),e.createElement(Ee.W,{value:"h3"},"h3"),e.createElement(Ee.W,{value:"h4"},"h4"),e.createElement(Ee.W,{value:"h5"},"h5"),e.createElement(Ee.W,{value:"h6"},"h6")),e.createElement(Gr,null,e.createElement(xe,{disabled:!0,id:"Bold",label:"Bold",name:"Bold",icon:e.createElement(Xr.Z,null)}),e.createElement(xe,{disabled:!0,id:"Italic",label:"Italic",name:"Italic",icon:e.createElement(Jr.Z,null)}),e.createElement(xe,{disabled:!0,id:"Underline",label:"Underline",name:"Underline",icon:e.createElement(_r.Z,null)})),e.createElement(Kr,{disabled:!0,id:"more",label:"More",icon:e.createElement(eo.Z,null)})),!o&&e.createElement(me.z,{onClick:i,variant:"tertiary",id:"preview"},u({id:"components.Wysiwyg.ToggleMode.markdown-mode",defaultMessage:"Markdown mode"})))):e.createElement(L.x,{padding:2,background:"neutral100"},e.createElement(P.k,{justifyContent:"space-between"},e.createElement(P.k,null,e.createElement(We.P,{id:"selectTitle",placeholder:m,size:"S",onChange:b=>a(b,r)},e.createElement(Ee.W,{value:"h1"},"h1"),e.createElement(Ee.W,{value:"h2"},"h2"),e.createElement(Ee.W,{value:"h3"},"h3"),e.createElement(Ee.W,{value:"h4"},"h4"),e.createElement(Ee.W,{value:"h5"},"h5"),e.createElement(Ee.W,{value:"h6"},"h6")),e.createElement(Gr,null,e.createElement(xe,{onClick:()=>a("Bold",r),id:"Bold",label:"Bold",name:"Bold",icon:e.createElement(Xr.Z,null)}),e.createElement(xe,{onClick:()=>a("Italic",r),id:"Italic",label:"Italic",name:"Italic",icon:e.createElement(Jr.Z,null)}),e.createElement(xe,{onClick:()=>a("Underline",r),id:"Underline",label:"Underline",name:"Underline",icon:e.createElement(_r.Z,null)})),e.createElement(Kr,{ref:f,onClick:g,id:"more",label:"More",icon:e.createElement(eo.Z,null)}),c&&e.createElement(ja.J2,{centered:!0,source:f,spacing:4,id:"popover"},e.createElement(Yr.i,{onEscape:g,restoreFocus:!1},e.createElement(P.k,null,e.createElement(Fa,null,e.createElement(xe,{onClick:()=>a("Strikethrough",r,g),id:"Strikethrough",label:"Strikethrough",name:"Strikethrough",icon:e.createElement(Wa.Z,null)}),e.createElement(xe,{onClick:()=>a("BulletList",r,g),id:"BulletList",label:"BulletList",name:"BulletList",icon:e.createElement(za.Z,null)}),e.createElement(xe,{onClick:()=>a("NumberList",r,g),id:"NumberList",label:"NumberList",name:"NumberList",icon:e.createElement(Va.Z,null)})),e.createElement(ye.o,null,e.createElement(xe,{onClick:()=>a("Code",r,g),id:"Code",label:"Code",name:"Code",icon:e.createElement(Ua.Z,null)}),e.createElement(xe,{onClick:()=>{g(),l()},id:"Image",label:"Image",name:"Image",icon:e.createElement(Ha.Z,null)}),e.createElement(wa,{onClick:()=>a("Link",r,g),id:"Link",label:"Link",name:"Link",icon:e.createElement(Qa.Z,null)}),e.createElement(xe,{onClick:()=>a("Quote",r,g),id:"Quote",label:"Quote",name:"Quote",icon:e.createElement(Ga.Z,null)})))))),i&&e.createElement(me.z,{onClick:i,variant:"tertiary",id:"preview"},u({id:"components.Wysiwyg.ToggleMode.preview-mode",defaultMessage:"Preview mode"}))))};Rn.defaultProps={isPreviewMode:!1,onActionClick(){},onToggleMediaLib(){},onTogglePreviewMode:void 0},Rn.propTypes={disabled:n().bool.isRequired,editorRef:n().shape({current:n().any}).isRequired,isExpandMode:n().bool.isRequired,isPreviewMode:n().bool,onActionClick:n().func,onToggleMediaLib:n().func,onTogglePreviewMode:n().func};var Ka=Rn,Ya=d(18070);const Mn=({onToggleExpand:t})=>{const{formatMessage:r}=(0,H.Z)();return e.createElement(L.x,{padding:2,background:"neutral100",hasRadius:!0},e.createElement(P.k,{justifyContent:"flex-end",alignItems:"flex-end"},e.createElement(Sa,{id:"expand",onClick:t},e.createElement(Q.Z,null,r({id:"components.WysiwygBottomControls.fullscreen",defaultMessage:"Expand"})),e.createElement(Ya.Z,null))))};Mn.defaultProps={onToggleExpand(){}},Mn.propTypes={onToggleExpand:n().func};var Xa=Mn;const Tn=({id:t,error:r,name:o,hint:s})=>s.length===0||r?null:e.createElement(Q.Z,{as:"p",variant:"pi",id:`${t||o}-hint`,textColor:"neutral600"},s);Tn.defaultProps={id:void 0,error:void 0,hint:""},Tn.propTypes={hint:n().oneOfType([n().string,n().array]),error:n().string,id:n().string,name:n().string.isRequired};var Ja=Tn;const to=(t,r)=>{let o;switch(t){case"Strikethrough":o=`~~${r}~~`;break;case"Bold":o=`**${r}**`;break;case"Italic":o=`_${r}_`;break;case"Underline":o=`<u>${r}</u>`;break;case"Code":o=`\`\`\`
|
|
543
|
-
${r}
|
|
544
|
-
\`\`\``;break;case"Link":o=`[${r}](link)`;break;case"Quote":o=`>${r}`;break;default:o=r}return o},no=t=>{let r,o={start:t.length,end:0};switch(t){case"Strikethrough":r=`~~${t}~~`,o.end=2;break;case"Bold":r=`**${t}**`,o.end=2;break;case"Italic":r=`_${t}_`,o.end=1;break;case"alt":r=`[${t}]()`,o.end=3;break;case"Underline":r=`<u>${t}</u>`,o.end=4;break;case"Code":r=`\`\`\`
|
|
545
|
-
${t}
|
|
546
|
-
\`\`\``,o.end=3;break;case"Link":r=`[${t}](link)`,o.end=7;break;case"Quote":r=`>${t}`,o.end=0;break;default:r=""}return{editedText:r,selection:o}},ro=t=>{let r;switch(t){case"BulletList":r="- ";break;case"NumberList":r="1. ";break;case"h1":r="# ";break;case"h2":r="## ";break;case"h3":r="### ";break;case"h4":r="#### ";break;case"h5":r="##### ";break;case"h6":r="###### ";break;default:return""}return r},oo=(t,r)=>{const o=t.current.getSelection();let s;if(o){const a=to(r,o);t.current.replaceSelection(a),t.current.focus()}else{s=no(r),t.current.replaceSelection(s.editedText),t.current.focus();const{line:a,ch:l}=t.current.getCursor(),i=l-s.selection.end,c=l-s.selection.end-s.selection.start;t.current.setSelection({line:a,ch:c},{line:a,ch:i})}},_a=(t,r)=>{const o=t.current.getDoc(),s=r==="BulletList"?"- ":"1. ";if(o.somethingSelected()){const a=o.listSelections();let l=null;t.current.operation(function(){a.forEach(function(i){const c=[i.head.line,i.anchor.line].sort();l==null&&(l=o.getLine(c[0]).startsWith(s));for(let p=c[0];p<=c[1];p++)if(l)o.getLine(p).startsWith(s)&&o.replaceRange("",{line:p,ch:0},{line:p,ch:s.length});else{const u=r==="BulletList"?"- ":`${p+1}. `;o.replaceRange(u,{line:p,ch:0})}})})}else{let{line:a}=o.getCursor();const l=ro(r),i=t.current.getLine(a),c=l+i;t.current.setSelection({line:a,ch:0},{line:a,ch:i.length}),t.current.replaceSelection(c)}t.current.focus()},ei=(t,r)=>{let{line:o}=t.current.getCursor();const s=ro(r),a=t.current.getLine(o),l=a.replace(/#{1,6}\s/g,"").trim(),i=s+l;t.current.setSelection({line:o,ch:0},{line:o,ch:a.length}),t.current.replaceSelection(i),setTimeout(()=>{const c=t.current.getLine(o).length;t.current.focus(),t.current.setCursor({line:o,ch:c})},0)},ti=(t,r)=>{let{line:o,ch:s}=t.current.getCursor();r.forEach((a,l)=>{let i=t.current.getLine(o).length;t.current.setCursor({line:o,ch:i}),(l>0||l===0&&s!==0)&&(i=t.current.getLine(o).length,t.current.setCursor({line:o,ch:i}),o++,t.current.replaceSelection(`
|
|
547
|
-
`)),a.mime.includes("image")?t.current.replaceSelection(``):t.current.replaceSelection(`[${a.alt}](${a.url})`)}),setTimeout(()=>t.current.focus(),0)},ni=(t,r,o,s,a)=>{const l=to(r,a),i=t.current.getRange({line:o+1,ch:0},{line:1/0,ch:1/0});if(t.current.replaceRange("",{line:o+1,ch:0},{line:1/0,ch:1/0}),t.current.replaceSelection(""),t.current.setCursor({line:o,ch:s}),t.current.replaceSelection(`
|
|
548
|
-
`),t.current.replaceSelection(l),r==="Code"){let{line:c}=t.current.getCursor();t.current.setCursor({line:c-1,ch:a.length})}t.current.replaceRange(i,{line:o+4,ch:0},{line:1/0,ch:1/0}),t.current.focus()},ri=(t,r,o,s)=>{const a=no(r),l=t.current.getRange({line:o+1,ch:0},{line:1/0,ch:1/0});if(t.current.replaceRange("",{line:o+1,ch:0},{line:1/0,ch:1/0}),t.current.setCursor({line:o,ch:s}),t.current.replaceSelection(`
|
|
549
|
-
`),t.current.replaceSelection(a.editedText),r==="Code")o+=2,t.current.setSelection({line:o,ch:0},{line:o,ch:4});else{o+=1;let{ch:i}=t.current.getCursor(),c=i-a.selection.end,p=i-a.selection.end-a.selection.start;t.current.setSelection({line:o,ch:p},{line:o,ch:c})}t.current.replaceRange(l,{line:o+2,ch:0},{line:1/0,ch:1/0}),t.current.focus()},oi=(t,r)=>{const o=t.current.getSelection();let{line:s}=t.current.getCursor(),a=t.current.getLine(s).length;o?ni(t,r,s,a,o):ri(t,r,s,a)};var si=d(71933),ai=d(74464);const ii=(t,r)=>`${t}${Math.floor(r*255).toString(16).padStart(2,0)}`,li=(0,N.ZP)(P.k)`
|
|
550
|
-
background: ${({theme:t})=>ii(t.colors.neutral800,.2)};
|
|
551
|
-
`,ci=(0,N.ZP)(L.x)`
|
|
552
|
-
border-right: 1px solid ${({theme:t})=>t.colors.neutral200};
|
|
553
|
-
`,di=(0,N.ZP)(vn.Y)`
|
|
554
|
-
background-color: transparent;
|
|
555
|
-
border: none;
|
|
556
|
-
align-items: center;
|
|
557
|
-
|
|
558
|
-
svg {
|
|
559
|
-
margin-left: ${({theme:t})=>`${t.spaces[2]}`};
|
|
560
|
-
|
|
561
|
-
path {
|
|
562
|
-
fill: ${({theme:t})=>t.colors.neutral700};
|
|
563
|
-
width: ${12/16}rem;
|
|
564
|
-
height: ${12/16}rem;
|
|
565
|
-
}
|
|
566
|
-
}
|
|
567
|
-
`,Dn=({children:t,isExpandMode:r,error:o,previewContent:s,onCollapse:a})=>{const{formatMessage:l}=(0,H.Z)();return(0,h.F5)(r),r?e.createElement(si.h,{role:"dialog","aria-modal":!1},e.createElement(Yr.i,{onEscape:a},e.createElement(li,{position:"fixed",top:0,left:0,right:0,bottom:0,zIndex:4,justifyContent:"center",onClick:a},e.createElement(L.x,{background:"neutral0",hasRadius:!0,shadow:"popupShadow",overflow:"hidden",width:"70%",height:"70%",onClick:i=>i.stopPropagation()},e.createElement(P.k,{height:"100%",alignItems:"flex-start"},e.createElement(ci,{flex:"1",height:"100%"},t),e.createElement(P.k,{alignItems:"start",direction:"column",flex:1,height:"100%",width:"100%"},e.createElement(P.k,{height:(0,h.Q1)(48),background:"neutral100",justifyContent:"flex-end",shrink:0,width:"100%"},e.createElement(di,{onClick:a},e.createElement(Q.Z,null,l({id:"components.Wysiwyg.collapse",defaultMessage:"Collapse"})),e.createElement(ai.Z,null))),e.createElement(L.x,{position:"relative",height:"100%",width:"100%"},e.createElement(Qr,{data:s})))))))):e.createElement(L.x,{borderColor:o?"danger600":"neutral200",borderStyle:"solid",borderWidth:"1px",hasRadius:!0},t)};Dn.defaultProps={error:void 0,previewContent:""},Dn.propTypes={children:n().node.isRequired,error:n().string,isExpandMode:n().bool.isRequired,previewContent:n().string,onCollapse:n().func.isRequired};const ui=(0,N.ZP)(L.x)`
|
|
568
|
-
svg path {
|
|
569
|
-
fill: ${({theme:t})=>t.colors.neutral500};
|
|
570
|
-
}
|
|
571
|
-
`,mi=(0,N.ZP)(Q.Z)`
|
|
572
|
-
line-height: 0;
|
|
573
|
-
`,In=({hint:t,disabled:r,error:o,intlLabel:s,labelAction:a,name:l,onChange:i,placeholder:c,value:p,required:u})=>{const{formatMessage:m}=(0,H.Z)(),f=(0,e.useRef)(null),g=(0,e.useRef)(null),[b,E]=(0,e.useState)(!1),[v,I]=(0,e.useState)(!1),[T,D]=(0,e.useState)(!1),{components:w}=(0,h.yX)(),k=w["media-library"],C=()=>I($=>!$),M=()=>E($=>!$),F=()=>{E(!1),D($=>!$)},B=($,Y,j)=>{switch($){case"Link":case"Strikethrough":{oo(Y,$),j();break}case"Code":case"Quote":{oi(Y,$),j();break}case"Bold":case"Italic":case"Underline":{oo(Y,$);break}case"BulletList":case"NumberList":{_a(Y,$),j();break}case"h1":case"h2":case"h3":case"h4":case"h5":case"h6":{ei(Y,$);break}default:}},U=$=>{const Y=$.map(j=>({alt:j.alternativeText||j.name,url:(0,h.CR)(j.url),mime:j.mime}));ti(g,Y),I(!1)},A=c?m({id:c.id,defaultMessage:c.defaultMessage},{...c.values}):"",G=s.id?m({id:s.id,defaultMessage:s.defaultMessage},{...s.values}):l;return e.createElement(e.Fragment,null,e.createElement(P.k,{direction:"column",alignItems:"stretch",gap:1},e.createElement(P.k,{gap:1},e.createElement(Q.Z,{variant:"pi",fontWeight:"bold",textColor:"neutral800"},G,u&&e.createElement(mi,{textColor:"danger600"},"*")),a&&e.createElement(ui,{paddingLeft:1},a)),e.createElement(Dn,{isExpandMode:T,error:o,previewContent:p,onCollapse:F},e.createElement(Ka,{isExpandMode:T,editorRef:g,isPreviewMode:b,onActionClick:B,onToggleMediaLib:C,onTogglePreviewMode:T?void 0:M,disabled:r}),e.createElement(Na,{disabled:r,isExpandMode:T,editorRef:g,error:o,isPreviewMode:b,name:l,onChange:i,placeholder:A,textareaRef:f,value:p}),!T&&e.createElement(Xa,{onToggleExpand:F})),e.createElement(Ja,{hint:t,name:l,error:o})),o&&e.createElement(L.x,{paddingTop:1},e.createElement(Q.Z,{variant:"pi",textColor:"danger600","data-strapi-field-error":!0},o)),v&&e.createElement(k,{onClose:C,onSelectAssets:U}))};In.defaultProps={disabled:!1,error:"",labelAction:void 0,placeholder:null,required:!1,value:"",hint:""},In.propTypes={hint:n().oneOfType([n().string,n().array]),disabled:n().bool,error:n().string,intlLabel:n().shape({id:n().string.isRequired,defaultMessage:n().string.isRequired,values:n().object}).isRequired,labelAction:n().element,name:n().string.isRequired,onChange:n().func.isRequired,placeholder:n().shape({id:n().string.isRequired,defaultMessage:n().string.isRequired,values:n().object}),required:n().bool,value:n().string};var pi=In,kn=d(10369),gi=d(38705),Pt=d(69932),fi=d(27169),so=d(44647),ao=d(75536),hi=/^[A-Za-z0-9-_.~]*$/,yi=d(63642);const Ei=(0,N.ZP)(yi.E)`
|
|
574
|
-
svg {
|
|
575
|
-
height: 1rem;
|
|
576
|
-
width: 1rem;
|
|
577
|
-
path {
|
|
578
|
-
fill: ${({theme:t})=>t.colors.neutral400};
|
|
579
|
-
}
|
|
580
|
-
}
|
|
581
|
-
|
|
582
|
-
svg:hover {
|
|
583
|
-
path {
|
|
584
|
-
fill: ${({theme:t})=>t.colors.primary600};
|
|
585
|
-
}
|
|
586
|
-
}
|
|
587
|
-
`,io=(0,N.ZP)(P.k)`
|
|
588
|
-
svg {
|
|
589
|
-
height: ${12/16}rem;
|
|
590
|
-
width: ${12/16}rem;
|
|
591
|
-
|
|
592
|
-
path {
|
|
593
|
-
fill: ${({theme:t,available:r})=>r?t.colors.success600:t.colors.danger600};
|
|
594
|
-
}
|
|
595
|
-
}
|
|
596
|
-
`,bi=N.F4`
|
|
597
|
-
from {
|
|
598
|
-
transform: rotate(0deg);
|
|
599
|
-
}
|
|
600
|
-
to {
|
|
601
|
-
transform: rotate(359deg);
|
|
602
|
-
}
|
|
603
|
-
`,vi=(0,N.ZP)(P.k)`
|
|
604
|
-
animation: ${bi} 2s infinite linear;
|
|
605
|
-
`,On=({attribute:t,contentTypeUID:r,hint:o,disabled:s,error:a,intlLabel:l,labelAction:i,name:c,onChange:p,value:u,placeholder:m,required:f})=>{const{modifiedData:g,initialData:b,layout:E}=(0,h.Wq)(),[v,I]=(0,e.useState)(!1),[T,D]=(0,e.useState)(null),w=(0,ao.Z)(u,300),k=(0,e.useRef)(),C=(0,h.lm)(),{formatAPIError:M}=(0,h.So)(),F=b[c],{formatMessage:B}=(0,H.Z)(),U=E?.options?.timestamps??0,A=!b[U],G=(0,ao.Z)(g[t.targetField],300),[$,Y]=(0,e.useState)(!1),[j,X]=(0,e.useState)(null),{post:q}=(0,h.kY)(),W=l.id?B({id:l.id,defaultMessage:l.defaultMessage},{...l.values}):c,R=m?B({id:m.id,defaultMessage:m.defaultMessage},{...m.values}):"";k.current=async(S=!1)=>{I(!0);try{const{data:{data:ne}}=await q((0,y.IF)("uid/generate"),{contentTypeUID:r,field:c,data:g});p({target:{name:c,value:ne,type:"text"}},S),I(!1)}catch(ne){I(!1),C({type:"warning",message:M(ne)})}};const Z=async()=>{if(u){I(!0);try{const{data:S}=await q((0,y.IF)("uid/check-availability"),{contentTypeUID:r,field:c,value:u?u.trim():""});I(!1),D(S)}catch(S){I(!1),C({type:"warning",message:M(S)})}}};(0,e.useEffect)(()=>{!u&&t.required&&k.current(!0)},[t.required,k,u]),(0,e.useEffect)(()=>{w?.trim().match(hi)&&w!==F&&Z(),w||D(null)},[F,w]),(0,e.useEffect)(()=>{let S;return T?.isAvailable&&(S=setTimeout(()=>{D(null)},4e3)),()=>{S&&clearTimeout(S)}},[T]),(0,e.useEffect)(()=>{!$&&A&&G&&g[t.targetField]&&!u&&k.current(!0)},[G,$,A]);const V=()=>{X(B({id:"content-manager.components.uid.regenerate",defaultMessage:"Regenerate"}))},K=()=>{X(null)},O=S=>{S.target.value&&A&&Y(!0),p(S)};return e.createElement(kn.o,{disabled:s,error:a,endAction:e.createElement(P.k,{position:"relative",gap:1},T&&!j&&e.createElement(io,{alignItems:"center",gap:1,justifyContent:"flex-end",available:!!T?.isAvailable,"data-not-here-outer":!0,position:"absolute",pointerEvents:"none",right:6,width:"100px"},T?.isAvailable?e.createElement(gi.Z,null):e.createElement(Pt.Z,null),e.createElement(Q.Z,{textColor:T.isAvailable?"success600":"danger600",variant:"pi"},B(T.isAvailable?{id:"content-manager.components.uid.available",defaultMessage:"Available"}:{id:"content-manager.components.uid.unavailable",defaultMessage:"Unavailable"}))),!s&&e.createElement(e.Fragment,null,j&&e.createElement(io,{alignItems:"center",justifyContent:"flex-end",gap:1},e.createElement(Q.Z,{textColor:"primary600",variant:"pi"},j)),e.createElement(Ei,{onClick:()=>k.current(),label:B({id:"content-manager.components.uid.regenerate",defaultMessage:"Regenerate"}),onMouseEnter:V,onMouseLeave:K},v?e.createElement(vi,{"data-testid":"loading-wrapper"},e.createElement(fi.Z,null)):e.createElement(so.Z,null)))),hint:o,label:W,labelAction:i,name:c,onChange:O,placeholder:R,value:u||"",required:f})};On.propTypes={attribute:n().shape({targetField:n().string,required:n().bool}).isRequired,contentTypeUID:n().string.isRequired,disabled:n().bool,error:n().string,intlLabel:n().shape({id:n().string.isRequired,defaultMessage:n().string.isRequired,values:n().object}).isRequired,labelAction:n().element,name:n().string.isRequired,onChange:n().func.isRequired,value:n().string,placeholder:n().shape({id:n().string.isRequired,defaultMessage:n().string.isRequired,values:n().object}),required:n().bool,hint:n().oneOfType([n().string,n().array])},On.defaultProps={disabled:!1,error:void 0,labelAction:void 0,placeholder:void 0,value:"",required:!1,hint:""};var Ci=On,Ri=d(88423),xn=d.n(Ri),Mi=d(41044),Ti=d(50428),Di=d(87107),Ii=d(28847),lo=d(7563),ki=d(67014),Oi=d(47851),co=d(99140),Gt=d(63919),Pn=d(41234),Kt=d(35331);const wn=({children:t,loadMore:r,search:o,totalNumberOfRelations:s,size:a,...l})=>e.createElement(e.Fragment,null,e.createElement(P.k,{paddingBottom:s>0?3:0,gap:2,justifyContent:"space-between",alignItems:"end",wrap:"wrap"},e.createElement(P.k,{direction:"column",alignItems:"stretch",basis:a<=6?"100%":"70%",gap:1,...l},o),r),t);wn.defaultProps={search:void 0,loadMore:void 0,totalNumberOfRelations:0},wn.propTypes={children:n().node.isRequired,search:n().node,loadMore:n().node,size:n().number.isRequired,totalNumberOfRelations:n().number};var uo=d(90553);const Yt=50,gt=4,mo=(0,N.ZP)(P.k)`
|
|
606
|
-
width: 100%;
|
|
607
|
-
/* Used to prevent endAction to be pushed out of container */
|
|
608
|
-
min-width: 0;
|
|
609
|
-
|
|
610
|
-
& > div[role='button'] {
|
|
611
|
-
cursor: all-scroll;
|
|
612
|
-
}
|
|
613
|
-
`,po=(0,N.ZP)(P.k)`
|
|
614
|
-
width: 100%;
|
|
615
|
-
/* Used to prevent endAction to be pushed out of container */
|
|
616
|
-
min-width: 0;
|
|
617
|
-
`,Fn=({ariaDescribedBy:t,children:r,displayValue:o,canDrag:s,disabled:a,endAction:l,iconButtonAriaLabel:i,style:c,id:p,index:u,name:m,onCancel:f,onDropItem:g,onGrabItem:b,status:E,updatePositionOfRelation:v,...I})=>{const[{handlerId:T,isDragging:D,handleKeyDown:w},k,C,M,F]=(0,uo.Y)(s&&!a,{type:`${y._Q.RELATION}_${m}`,index:u,item:{displayedValue:o,status:E,id:p},onGrabItem:b,onDropItem:g,onCancel:f,onMoveItem:v,dropSensitivity:"immediate"}),B=(0,y.FE)(k,M);return(0,e.useEffect)(()=>{F((0,Ot.rX)())},[F]),e.createElement(L.x,{style:c,as:"li",ref:C,"aria-describedby":t,cursor:s?"all-scroll":"default"},D?e.createElement(xi,null):e.createElement(P.k,{paddingTop:2,paddingBottom:2,paddingLeft:s?2:4,paddingRight:4,hasRadius:!0,borderSize:1,borderColor:"neutral200",background:a?"neutral150":"neutral0",justifyContent:"space-between",ref:s?B:void 0,"data-handler-id":T,...I},e.createElement(mo,{gap:1},s?e.createElement(ye.h,{forwardedAs:"div",role:"button",tabIndex:0,"aria-label":i,noBorder:!0,onKeyDown:w,disabled:a},e.createElement(Je.Z,null)):null,e.createElement(po,{justifyContent:"space-between"},r)),l&&e.createElement(L.x,{paddingLeft:4},l)))},xi=()=>e.createElement(L.x,{paddingTop:2,paddingBottom:2,paddingLeft:4,paddingRight:4,hasRadius:!0,borderStyle:"dashed",borderColor:"primary600",borderWidth:"1px",background:"primary100",height:`calc(100% - ${gt}px)`});Fn.defaultProps={ariaDescribedBy:"",canDrag:!1,displayValue:"",disabled:!1,endAction:void 0,onCancel:void 0,onDropItem:void 0,onGrabItem:void 0,style:void 0,status:void 0,updatePositionOfRelation:void 0},Fn.propTypes={ariaDescribedBy:n().string,canDrag:n().bool,children:n().node.isRequired,displayValue:n().string,disabled:n().bool,endAction:n().node,iconButtonAriaLabel:n().string.isRequired,id:n().number.isRequired,index:n().number.isRequired,name:n().string.isRequired,onCancel:n().func,onDropItem:n().func,onGrabItem:n().func,status:n().string,style:n().shape({height:n().number,left:n().number,position:n().string,right:n().number,width:n().string}),updatePositionOfRelation:n().func};const Pi=(0,N.ZP)(L.x)`
|
|
618
|
-
position: relative;
|
|
619
|
-
overflow-x: hidden;
|
|
620
|
-
overflow-y: auto;
|
|
621
|
-
|
|
622
|
-
&:before,
|
|
623
|
-
&:after {
|
|
624
|
-
position: absolute;
|
|
625
|
-
width: 100%;
|
|
626
|
-
height: 4px;
|
|
627
|
-
z-index: 1;
|
|
628
|
-
}
|
|
629
|
-
|
|
630
|
-
&:before {
|
|
631
|
-
/* TODO: as for DS Table component we would need this to be handled by the DS theme */
|
|
632
|
-
content: '';
|
|
633
|
-
background: linear-gradient(rgba(3, 3, 5, 0.2) 0%, rgba(0, 0, 0, 0) 100%);
|
|
634
|
-
top: 0;
|
|
635
|
-
opacity: ${({overflowDirection:t})=>t==="top-bottom"||t==="top"?1:0};
|
|
636
|
-
transition: opacity 0.2s ease-in-out;
|
|
637
|
-
}
|
|
638
|
-
|
|
639
|
-
&:after {
|
|
640
|
-
/* TODO: as for DS Table component we would need this to be handled by the DS theme */
|
|
641
|
-
content: '';
|
|
642
|
-
background: linear-gradient(0deg, rgba(3, 3, 5, 0.2) 0%, rgba(0, 0, 0, 0) 100%);
|
|
643
|
-
bottom: 0;
|
|
644
|
-
opacity: ${({overflowDirection:t})=>t==="top-bottom"||t==="bottom"?1:0};
|
|
645
|
-
transition: opacity 0.2s ease-in-out;
|
|
646
|
-
}
|
|
647
|
-
`,Ln=({children:t,overflow:r,...o})=>e.createElement(Pi,{overflowDirection:r,...o},t);Ln.defaultProps={overflow:""},Ln.propTypes={children:n().node.isRequired,overflow:n().oneOf(["top-bottom","bottom","top",""])};var wi=d(88994);const Fi=N.ZP.div`
|
|
648
|
-
flex-shrink: 0;
|
|
649
|
-
width: ${(0,h.Q1)(6)};
|
|
650
|
-
height: ${(0,h.Q1)(6)};
|
|
651
|
-
margin-right: ${({theme:t})=>t.spaces[2]};
|
|
652
|
-
background-color: ${({theme:t,isDraft:r})=>t.colors[r?"secondary600":"success600"]};
|
|
653
|
-
border-radius: 50%;
|
|
654
|
-
`,go=t=>{const{formatMessage:r}=(0,H.Z)(),o=wi.c.Option,{publicationState:s,mainField:a,id:l}=t.data;if(s){const i=s==="draft",c={id:(0,y.OB)("components.Select.draft-info-title"),defaultMessage:"State: Draft"},p={id:(0,y.OB)("components.Select.publish-info-title"),defaultMessage:"State: Published"},u=r(i?c:p);return e.createElement(o,{...t},e.createElement(P.k,null,e.createElement(Fi,{title:u,isDraft:i}),e.createElement(Q.Z,{ellipsis:!0},a??l)))}return e.createElement(o,{...t},a??l)};go.propTypes={isFocused:n().bool.isRequired,data:n().shape({id:n().number.isRequired,isDraft:n().bool,mainField:n().string,publicationState:n().oneOfType([n().string,n().bool])}).isRequired};const fo=(0,N.ZP)(Ti.r)`
|
|
655
|
-
display: block;
|
|
656
|
-
|
|
657
|
-
> span {
|
|
658
|
-
white-space: nowrap;
|
|
659
|
-
overflow: hidden;
|
|
660
|
-
text-overflow: ellipsis;
|
|
661
|
-
display: block;
|
|
662
|
-
}
|
|
663
|
-
`,ho=N.ZP.button`
|
|
664
|
-
svg path {
|
|
665
|
-
fill: ${({theme:t,disabled:r})=>r?t.colors.neutral600:t.colors.neutral500};
|
|
666
|
-
}
|
|
667
|
-
|
|
668
|
-
&:hover svg path,
|
|
669
|
-
&:focus svg path {
|
|
670
|
-
fill: ${({theme:t,disabled:r})=>!r&&t.colors.neutral600};
|
|
671
|
-
}
|
|
672
|
-
`,Sn=({canReorder:t,description:r,disabled:o,error:s,iconButtonAriaLabel:a,id:l,name:i,numberOfRelationsToDisplay:c,label:p,labelAction:u,labelLoadMore:m,labelDisconnectRelation:f,listAriaDescription:g,liveText:b,loadingMessage:E,onCancel:v,onDropItem:I,onGrabItem:T,noRelationsMessage:D,onRelationConnect:w,onRelationLoadMore:k,onRelationDisconnect:C,onRelationReorder:M,onSearchNextPage:F,onSearch:B,placeholder:U,publicationStateTranslations:A,required:G,relations:$,searchResults:Y,size:j})=>{const[X,q]=(0,e.useState)(null),[W,R]=(0,e.useState)(""),Z=(0,e.useRef)(),V=(0,e.useRef)(),{data:K}=Y,O=$.data,S=O.length??0,ne=(0,e.useMemo)(()=>S>c?Math.min(S,c)*(Yt+gt)+Yt/2:Math.min(S,c)*(Yt+gt),[S,c]),_=!!m&&$.hasNextPage,ae=(0,e.useMemo)(()=>K.flat().filter(Boolean).map(re=>({...re,value:re.id,label:re.mainField})),[K]);(0,e.useEffect)(()=>{if(S<=c)return R("");const re=Be=>{const Nr=Be.target.parentNode.scrollHeight,nt=Be.target.scrollHeight-Be.target.scrollTop;return Be.target.scrollTop===0?R("bottom"):R(nt===Nr?"top":"top-bottom")},ge=V?.current;return!$.isLoading&&O.length>0&&ge&&V.current.addEventListener("scroll",re),()=>{ge&&ge.removeEventListener("scroll",re)}},[$,O,c,S]);const[z,ie]=(0,e.useState)(!1),Te=(0,e.useRef)(),Ge=(0,e.useRef)([]);(0,e.useEffect)(()=>(ae.length>0&&Ge.current.length===0&&ie(re=>(re&&(Te.current=setTimeout(()=>{ie(!0)},10)),!1)),()=>{Ge.current=ae||[]}),[ae]),(0,e.useEffect)(()=>()=>{Te.current&&clearTimeout(Te.current)},[]);const Nt=()=>{ie(!1)},jt=()=>{ie(!0),B()},Wt=(re,ge)=>{M&&re>=0&&re<O.length&&M(ge,re)},Le=(0,de.zH)(O.length),Ze=(0,e.useRef)(),zt=()=>{Ze.current="loadMore",k()};(0,e.useEffect)(()=>{Ze.current==="onChange"&&O.length!==Le?Z.current.scrollToItem(O.length,"end"):Ze.current==="loadMore"&&O.length!==Le&&Z.current.scrollToItem(0,"start"),Ze.current=void 0},[Le,O]);const tt=`${i}-item-instructions`;return e.createElement(Di.g,{error:s,name:i,hint:r,id:l,required:G},e.createElement(wn,{totalNumberOfRelations:S,size:j,search:e.createElement(e.Fragment,null,e.createElement(Ii.Q,{action:u},p),e.createElement(h.JV,{menuPosition:"absolute",menuPlacement:"auto",components:{Option:go},options:ae,isDisabled:o,isLoading:Y.isLoading,error:s,inputId:l,isSearchable:!0,isClear:!0,loadingMessage:()=>E,onChange:re=>{q(null),w(re),Ze.current="onChange"},onInputChange:re=>{q(re),B(re)},onMenuClose:Nt,onMenuOpen:jt,menuIsOpen:z,noOptionsMessage:()=>D,onMenuScrollToBottom:()=>{Y.hasNextPage&&F()},placeholder:U,name:i,value:X})),loadMore:_&&e.createElement(lo.A,{disabled:$.isLoading||$.isFetchingNextPage,onClick:zt,loading:$.isLoading||$.isFetchingNextPage,startIcon:e.createElement(so.Z,null)},m)},O.length>0&&e.createElement(Ln,{overflow:W},e.createElement(mt.T,{id:tt},g),e.createElement(mt.T,{"aria-live":"assertive"},b),e.createElement(Mi.t7,{height:ne,ref:Z,outerRef:V,itemCount:S,itemSize:Yt+gt,itemData:{name:i,ariaDescribedBy:tt,canDrag:t,disabled:o,handleCancel:v,handleDropItem:I,handleGrabItem:T,iconButtonAriaLabel:a,labelDisconnectRelation:f,onRelationDisconnect:C,publicationStateTranslations:A,relations:O,updatePositionOfRelation:Wt},itemKey:re=>`${O[re].mainField}_${O[re].id}`,innerElementType:"ol"},An)),(r||s)&&e.createElement(L.x,{paddingTop:2},e.createElement(ki.J,null),e.createElement(Oi.c,null))))},Li=n().shape({data:n().arrayOf(n().shape({href:n().string,id:n().number.isRequired,publicationState:n().oneOfType([n().string,n().bool]),mainField:n().oneOfType([n().string,n().number])})),hasNextPage:n().bool,isFetchingNextPage:n().bool.isRequired,isLoading:n().bool.isRequired,isSuccess:n().bool.isRequired}),Si=n().shape({data:n().arrayOf(n().shape({id:n().number.isRequired,href:n().string,mainField:n().oneOfType([n().string,n().number]),publicationState:n().oneOfType([n().string,n().bool])})),hasNextPage:n().bool,isLoading:n().bool.isRequired,isSuccess:n().bool.isRequired});Sn.defaultProps={canReorder:!1,description:void 0,disabled:!1,error:void 0,labelAction:null,labelLoadMore:null,liveText:void 0,onCancel:void 0,onDropItem:void 0,onGrabItem:void 0,required:!1,relations:{data:[]},searchResults:{data:[]}},Sn.propTypes={error:n().string,canReorder:n().bool,description:n().string,disabled:n().bool,iconButtonAriaLabel:n().string.isRequired,id:n().string.isRequired,label:n().string.isRequired,labelAction:n().element,labelLoadMore:n().string,labelDisconnectRelation:n().string.isRequired,listAriaDescription:n().string.isRequired,liveText:n().string,loadingMessage:n().string.isRequired,name:n().string.isRequired,noRelationsMessage:n().string.isRequired,numberOfRelationsToDisplay:n().number.isRequired,onCancel:n().func,onDropItem:n().func,onGrabItem:n().func,onRelationConnect:n().func.isRequired,onRelationDisconnect:n().func.isRequired,onRelationLoadMore:n().func.isRequired,onRelationReorder:n().func.isRequired,onSearch:n().func.isRequired,onSearchNextPage:n().func.isRequired,placeholder:n().string.isRequired,publicationStateTranslations:n().shape({draft:n().string.isRequired,published:n().string.isRequired}).isRequired,required:n().bool,searchResults:Si,size:n().number.isRequired,relations:Li};const An=({data:t,index:r,style:o})=>{const{ariaDescribedBy:s,canDrag:a,disabled:l,handleCancel:i,handleDropItem:c,handleGrabItem:p,iconButtonAriaLabel:u,name:m,labelDisconnectRelation:f,onRelationDisconnect:g,publicationStateTranslations:b,relations:E,updatePositionOfRelation:v}=t,{publicationState:I,href:T,mainField:D,id:w}=E[r],k=I==="draft"?"secondary":"success";return e.createElement(Fn,{ariaDescribedBy:s,canDrag:a,disabled:l,displayValue:String(D??w),iconButtonAriaLabel:u,id:w,index:r,name:m,endAction:e.createElement(ho,{"data-testid":`remove-relation-${w}`,disabled:l,type:"button",onClick:()=>g(E[r]),"aria-label":f},e.createElement(co.J,{width:"12px",as:Kt.Z})),onCancel:i,onDropItem:c,onGrabItem:p,status:I||void 0,style:{...o,bottom:o.bottom??0+gt,height:o.height??0-gt},updatePositionOfRelation:v},e.createElement(L.x,{minWidth:0,paddingTop:1,paddingBottom:1,paddingRight:4},e.createElement(Gt.u,{description:D??`${w}`},T?e.createElement(fo,{to:T},D??w):e.createElement(Q.Z,{textColor:l?"neutral600":"primary600",ellipsis:!0},D??w))),I&&e.createElement(Pn.q,{variant:k,showBullet:!1,size:"S"},e.createElement(Q.Z,{fontWeight:"bold",textColor:`${k}700`},b[I])))};An.defaultProps={data:{}},An.propTypes={data:n().shape({ariaDescribedBy:n().string.isRequired,canDrag:n().bool.isRequired,disabled:n().bool.isRequired,handleCancel:n().func,handleDropItem:n().func,handleGrabItem:n().func,iconButtonAriaLabel:n().string.isRequired,labelDisconnectRelation:n().string.isRequired,name:n().string.isRequired,onRelationDisconnect:n().func.isRequired,publicationStateTranslations:n().shape({draft:n().string.isRequired,published:n().string.isRequired}).isRequired,relations:n().arrayOf(n().shape({href:n().string,id:n().number.isRequired,publicationState:n().oneOfType([n().string,n().bool]),mainField:n().oneOfType([n().string,n().number])})),updatePositionOfRelation:n().func.isRequired}),index:n().number.isRequired,style:n().object.isRequired};var Ai=Sn,ot=d(20108);function $i(t,r){return o=>{const s=r(o);return e.createElement(t,{...o,...s})}}var Zi=$i;function Bi({componentUid:t,isUserAllowedToEditField:r,isUserAllowedToReadField:o,name:s,queryInfos:a}){const{isCreatingEntry:l,createActionAllowedFields:i,readActionAllowedFields:c,updateActionAllowedFields:p,slug:u,modifiedData:m}=(0,h.Wq)(),f=(0,e.useMemo)(()=>r===!0?!0:(l?i:p).includes(s),[l,i,s,r,p]),g=(0,e.useMemo)(()=>o?!0:(l?[]:c).includes(s),[l,o,s,c]),b=s.split(".");let E;t&&(E=x()(m,b.slice(0,-1))?.id);const v=(0,e.useMemo)(()=>l?null:t?E?(0,y.IF)(`relations/${t}/${E}/${b.at(-1)}`):null:(0,y.IF)(`relations/${u}/${m.id}/${s.split(".").at(-1)}`),[l,t,u,m.id,s,E,b]),I=(0,e.useMemo)(()=>t?(0,y.IF)(`relations/${t}/${s.split(".").at(-1)}`):(0,y.IF)(`relations/${u}/${s.split(".").at(-1)}`),[t,u,s]);return{componentId:E,isComponentRelation:Boolean(t),queryInfos:{...a,endpoints:{search:I,relation:v}},isCreatingEntry:l,isFieldAllowed:f,isFieldReadable:g}}var qi=Bi;function Ni(t,r){return`${(0,y.IF)(`collectionType/${t}/${r??""}`)}`}const st={DRAFT:"draft",PUBLISHED:"published"},$n=5,ji=10,Zn=(t,{shouldAddLink:r,mainFieldName:o,targetModel:s})=>{const a={...t};return r&&(a.href=Ni(s,a.id)),a.publicationState=!1,a?.publishedAt!==void 0&&(a.publicationState=a.publishedAt?st.PUBLISHED:st.DRAFT),a.mainField=a[o],a},Wi=(t,{shouldAddLink:r=!1,mainFieldName:o,targetModel:s}={})=>[...t].map(a=>Zn(a,{shouldAddLink:r,mainFieldName:o,targetModel:s})),zi=(t,{mainFieldName:r})=>{const{data:o}=t,{pages:s=[]}=o??{};return{...t,data:s.map(a=>a?.results.map(l=>Zn(l,{mainFieldName:r}))).filter(Boolean).flat()}},Vi=(t=[],r=[])=>{const o=t.reduce((a,l)=>r.find(i=>i.id===l.id)?a:[...a,l.id],[]),s=r.reduce((a,l)=>t.find(i=>i.id===l.id)?a:[...a,l.id],[]);return[o,s]},Ui=(t,{relation:r,search:o})=>{const[s,a]=(0,e.useState)({}),[l,i]=(0,e.useState)(0),{get:c}=(0,h.kY)(),p=async({pageParam:C=1})=>{try{const{data:M}=await c(r?.endpoint,{params:{...r.pageParams??{},page:C}});return i(C),M}catch{return null}},u=async({pageParam:C=1})=>{try{const{data:M}=await c(o.endpoint,{params:{...o.pageParams??{},...s,page:C}});return M}catch{return null}},{onLoad:m,normalizeArguments:f={}}=r,g=(0,ot.useInfiniteQuery)(["relation",...t],p,{cacheTime:0,enabled:r.enabled,getNextPageParam(C){const M=!C?.pagination;if(!(!C||M||C?.pagination.page>=C?.pagination.pageCount))return C.pagination.page+1},select:C=>({...C,pages:C.pages.map(M=>{if(!M)return M;const{data:F,results:B,pagination:U}=M,A=!!F;let G=[];return A?G=[F]:B&&(G=[...B].reverse()),{pagination:U,results:G}})})}),{pageGoal:b}=r,{status:E,data:v,fetchNextPage:I,hasNextPage:T}=g;(0,e.useEffect)(()=>{b>l&&T&&E==="success"&&I({pageParam:l+1})},[b,l,I,T,E]);const D=(0,h.W6)(m);(0,e.useEffect)(()=>{if(E==="success"&&v&&v.pages?.at(-1)?.results&&D){const C=Wi(v.pages.at(-1).results,f);D(C)}},[E,D,v]);const w=(0,ot.useInfiniteQuery)(["relation",...t,"search",JSON.stringify(s)],u,{enabled:Object.keys(s).length>0,getNextPageParam(C){if(!(!C?.pagination||C.pagination.page>=C.pagination.pageCount))return C.pagination.page+1}});return{relations:g,search:w,searchFor:(C,M={})=>{a({...M,_q:C})}}},yo=(t,r)=>o=>{const s=o.split(".");return s.reduce((a,l,i)=>{const c=x()(t,a),p=x()(r,[...s.slice(0,i),l,"__temp_key__"]);if(Array.isArray(c)&&typeof p=="number"){const u=c.findIndex(m=>m.__temp_key__===p);return a.push(u.toString()),a}return a.push(l),a},[])},Bn=({error:t,componentId:r,isComponentRelation:o,editable:s,description:a,intlLabel:l,isCreatingEntry:i,isFieldAllowed:c,isFieldReadable:p,labelAction:u,mainField:m,name:f,queryInfos:{endpoints:g,defaultParams:b,shouldDisplayRelationLink:E},placeholder:v,required:I,relationType:T,size:D,targetModel:w})=>{const[k,C]=(0,e.useState)(""),{formatMessage:M}=(0,H.Z)(),{slug:F,initialData:B,modifiedData:U,relationConnect:A,relationDisconnect:G,relationLoad:$,relationReorder:Y}=(0,h.Wq)(),j=f.split("."),X=yo(B,U)(f),q=x()(U,f,[]),W=Math.ceil(x()(B,f,[]).length/$n),{relations:R,search:Z,searchFor:V}=Ui([F,X.join("."),U.id,b],{relation:{enabled:!!g.relation,endpoint:g.relation,pageGoal:W,pageParams:{...b,pageSize:$n},onLoad(re){$({target:{initialDataPath:["initialData",...X],modifiedDataPath:["modifiedData",...j],value:re}})},normalizeArguments:{mainFieldName:m.name,shouldAddLink:E,targetModel:w}},search:{endpoint:g.search,pageParams:{...b,entityId:i?void 0:o?r:B.id,pageSize:ji}}}),K=(0,e.useMemo)(()=>T.toLowerCase().includes("morph"),[T]),O=["oneWay","oneToOne","manyToOne","oneToManyMorph","oneToOneMorph"].includes(T),S=(0,e.useMemo)(()=>K?!0:i?!s:!c&&p||!s,[K,i,s,c,p]),ne=re=>{const ge=Zn(re,{mainFieldName:m.name,shouldAddLink:E,targetModel:w});A({name:f,value:ge,toOneRelation:O})},_=re=>{G({name:f,id:re.id})},ae=()=>{R.fetchNextPage()},z=(re="")=>{const[ge,Be]=Vi(q,x()(B,f));V(re,{idsToInclude:Be,idsToOmit:ge})},ie=()=>{Z.fetchNextPage()},Te=re=>`${re+1} of ${q.length}`,Ge=(re,ge)=>{const Be=q[re];C(M({id:(0,y.OB)("dnd.reorder"),defaultMessage:"{item}, moved. New position in list: {position}."},{item:Be.mainField??Be.id,position:Te(ge)})),Y({name:f,newIndex:ge,oldIndex:re})},Nt=re=>{const ge=q[re];C(M({id:(0,y.OB)("dnd.grab-item"),defaultMessage:"{item}, grabbed. Current position in list: {position}. Press up and down arrow to change position, Spacebar to drop, Escape to cancel."},{item:ge.mainField??ge.id,position:Te(re)}))},jt=re=>{const ge=q[re];C(M({id:(0,y.OB)("dnd.drop-item"),defaultMessage:"{item}, dropped. Final position in list: {position}."},{item:ge.mainField??ge.id,position:Te(re)}))},Wt=re=>{const ge=q[re];C(M({id:(0,y.OB)("dnd.cancel-item"),defaultMessage:"{item}, dropped. Re-order cancelled."},{item:ge.mainField??ge.id}))};if(!c&&i||!i&&!c&&!p)return e.createElement(h.X0,{name:f,intlLabel:l,labelAction:u});const Le=q.length,Ze=(x()(B,X)??[]).length,zt=R.data?.pages[0]?.pagination?.total??0,tt=!R.data&&Le===Ze?Le:Le-Ze+zt;return e.createElement(Ai,{error:t,canReorder:!O,description:a,disabled:S,iconButtonAriaLabel:M({id:(0,y.OB)("components.RelationInput.icon-button-aria-label"),defaultMessage:"Drag"}),id:f,label:`${M({id:l.id,defaultMessage:l.defaultMessage})} ${tt>0?`(${tt})`:""}`,labelAction:u,labelLoadMore:i?null:M({id:(0,y.OB)("relation.loadMore"),defaultMessage:"Load More"}),labelDisconnectRelation:M({id:(0,y.OB)("relation.disconnect"),defaultMessage:"Remove"}),listAriaDescription:M({id:(0,y.OB)("dnd.instructions"),defaultMessage:"Press spacebar to grab and re-order"}),listHeight:320,liveText:k,loadingMessage:M({id:(0,y.OB)("relation.isLoading"),defaultMessage:"Relations are loading"}),name:f,noRelationsMessage:M({id:(0,y.OB)("relation.notAvailable"),defaultMessage:"No relations available"}),numberOfRelationsToDisplay:$n,onDropItem:jt,onGrabItem:Nt,onCancel:Wt,onRelationConnect:ne,onRelationDisconnect:_,onRelationLoadMore:ae,onRelationReorder:Ge,onSearch:re=>z(re),onSearchNextPage:()=>ie(),placeholder:M(v||{id:(0,y.OB)("relation.add"),defaultMessage:"Add relation"}),publicationStateTranslations:{[st.DRAFT]:M({id:(0,y.OB)("relation.publicationState.draft"),defaultMessage:"Draft"}),[st.PUBLISHED]:M({id:(0,y.OB)("relation.publicationState.published"),defaultMessage:"Published"})},relations:xn()({...R,data:q},"data","hasNextPage","isFetchingNextPage","isLoading","isSuccess"),required:I,searchResults:zi(Z,{mainFieldName:m.name}),size:D})};Bn.defaultProps={componentId:void 0,editable:!0,error:void 0,description:"",labelAction:null,isComponentRelation:!1,isFieldAllowed:!0,placeholder:null,required:!1},Bn.propTypes={componentId:n().number,editable:n().bool,error:n().string,description:n().string,intlLabel:n().shape({id:n().string.isRequired,defaultMessage:n().string.isRequired,values:n().object}).isRequired,labelAction:n().element,isCreatingEntry:n().bool.isRequired,isComponentRelation:n().bool,isFieldAllowed:n().bool,isFieldReadable:n().bool.isRequired,mainField:n().shape({name:n().string.isRequired,schema:n().shape({type:n().string.isRequired}).isRequired}).isRequired,name:n().string.isRequired,placeholder:n().shape({id:n().string.isRequired,defaultMessage:n().string.isRequired,values:n().object}),required:n().bool,relationType:n().string.isRequired,size:n().number.isRequired,targetModel:n().string.isRequired,queryInfos:n().shape({defaultParams:n().shape({locale:n().string}),endpoints:n().shape({relation:n().string,search:n().string.isRequired}).isRequired,shouldDisplayRelationLink:n().bool.isRequired}).isRequired};const Hi=(0,e.memo)(Bn);var Qi=Zi(Hi,qi);function Gi(t,r){return o=>{const s=r(o.keys);return e.createElement(t,{...o,...s})}}var Ki=Gi,Yi=(t,r=!1)=>[{metadatas:{intlLabel:{id:"components.InputSelect.option.placeholder",defaultMessage:"Choose here"},disabled:r,hidden:r},key:"__enum_option_null",value:""},...t.map(o=>({metadatas:{intlLabel:{id:o,defaultMessage:o},hidden:!1,disabled:!1},key:o,value:o}))],Xi=d(59578),Ji=d.n(Xi),_i=(t="")=>{switch(Ji()(t)){case"boolean":return"bool";case"biginteger":return"text";case"decimal":case"float":case"integer":return"number";case"date":case"datetime":case"time":return t;case"email":return"email";case"enumeration":return"select";case"password":return"password";case"string":return"text";case"text":return"textarea";case"media":case"file":case"files":return"media";case"json":return"json";case"wysiwyg":case"WYSIWYG":case"richtext":return"wysiwyg";case"uid":return"uid";default:return t||"text"}},el=t=>{let r;return t==="float"||t==="decimal"?r=.01:r=1,r};function tl(t){const{createActionAllowedFields:r,formErrors:o,isCreatingEntry:s,modifiedData:a,onChange:l,readActionAllowedFields:i,shouldNotRunValidations:c,updateActionAllowedFields:p}=(0,h.Wq)(),u=(0,e.useMemo)(()=>s?r:p,[s,r,p]),m=(0,e.useMemo)(()=>s?[]:i,[s,i]),f=x()(a,t,null);return{allowedFields:u,formErrors:o,isCreatingEntry:s,onChange:l,readableFields:m,shouldNotRunValidations:c,value:f}}var nl=tl,Eo=["type","model","via","collection","default","plugin","enum","regex","pluginOptions"];function qn({allowedFields:t,componentUid:r,fieldSchema:o,formErrors:s,isCreatingEntry:a,keys:l,labelAction:i,metadatas:c,onChange:p,readableFields:u,shouldNotRunValidations:m,queryInfos:f,value:g,size:b,customFieldInputs:E}){const{fields:v}=(0,h.yX)(),{formatMessage:I}=(0,H.Z)(),{contentType:T}=(0,de.PL)(),D=(0,e.useMemo)(()=>!x()(c,"editable",!0),[c]),{type:w,customField:k}=o,C=x()(s,[l],null),M=(0,e.useMemo)(()=>(0,y.Ts)(l),[l]),F=(0,e.useMemo)(()=>{const ne=oa()(o,m?[...Eo,"required","minLength"]:Eo),_=o.regex||null;if(_){const ae=new RegExp(_);ae&&(ne.regex=ae)}return ne},[o,m]),B=(0,e.useMemo)(()=>x()(F,["required"],!1),[F]),U=(0,e.useMemo)(()=>{const ne=x()(T,["attributes"],{});return x()(ne,[M[0],"type"],null)==="dynamiczone"},[T,M]),A=(0,e.useMemo)(()=>_i(w),[w]),G=(0,e.useMemo)(()=>w==="media"&&!g?[]:g,[w,g]),$=(0,e.useMemo)(()=>el(w),[w]),Y=(0,e.useMemo)(()=>{const ne=M.join(".");if(t.includes(ne))return!0;if(U)return t.includes(M[0]);if(M.length>1){const ae=xt()(M,M.length-1).join(".");return t.includes(ae)}return!1},[t,M,U]),j=(0,e.useMemo)(()=>{const ne=M.join(".");if(u.includes(ne))return!0;if(U)return u.includes(M[0]);if(M.length>1){const ae=xt()(M,M.length-1).join(".");return u.includes(ae)}return!1},[u,M,U]),X=(0,e.useMemo)(()=>j||Y,[Y,j]),q=(0,e.useMemo)(()=>a?D:j&&!Y?!0:D,[D,a,Y,j]),W=(0,e.useMemo)(()=>Yi(o.enum||[],B),[o,B]),{label:R,description:Z,placeholder:V,visible:K}=c,O=(0,e.useMemo)(()=>{if(!c.step||A!=="datetime"&&A!=="time")return $;if(!G)return c.step;let ne;return A==="datetime"?ne=parseInt(G.substr(14,2),10):A==="time"&&(ne=parseInt(G.slice(-2),10)),ne%c.step===0?c.step:$},[A,G,c.step,$]);if(K===!1)return null;if(!X)return e.createElement(h.X0,{description:Z?{id:Z,defaultMessage:Z}:null,intlLabel:{id:R,defaultMessage:R},labelAction:i,error:C&&I(C),name:l,required:B});if(w==="relation")return e.createElement(Qi,{...c,...o,componentUid:r,description:c.description?I({id:c.description,defaultMessage:c.description}):void 0,intlLabel:{id:c.label,defaultMessage:c.label},labelAction:i,isUserAllowedToEditField:Y,isUserAllowedToReadField:j,name:l,placeholder:c.placeholder?{id:c.placeholder,defaultMessage:c.placeholder}:null,queryInfos:f,size:b,value:g,error:C&&I(C)});const S={uid:Ci,media:v.media,wysiwyg:pi,...v,...E};return e.createElement(h.jm,{attribute:o,autoComplete:"new-password",intlLabel:{id:R,defaultMessage:R},isNullable:A==="bool"&&[null,void 0].includes(o.default),description:Z?{id:Z,defaultMessage:Z}:null,disabled:q,error:C,labelAction:i,contentTypeUID:T.uid,customInputs:S,multiple:o.multiple||!1,name:l,onChange:p,options:W,placeholder:V?{id:V,defaultMessage:V}:null,required:o.required||!1,step:O,type:k||A,value:G,withDefaultValue:!1})}qn.defaultProps={componentUid:void 0,formErrors:{},labelAction:void 0,size:void 0,value:null,queryInfos:{},customFieldInputs:{}},qn.propTypes={allowedFields:n().array.isRequired,componentUid:n().string,fieldSchema:n().object.isRequired,formErrors:n().object,keys:n().string.isRequired,isCreatingEntry:n().bool.isRequired,labelAction:n().element,metadatas:n().object.isRequired,onChange:n().func.isRequired,readableFields:n().array.isRequired,size:n().number,shouldNotRunValidations:n().bool.isRequired,value:n().any,queryInfos:n().shape({containsKey:n().string,defaultParams:n().object,endPoint:n().string}),customFieldInputs:n().object};const rl=(0,e.memo)(qn,Oe());var Nn=Ki(rl,nl);const wt=new Map;var jn=(t=[])=>{const[r,o]=(0,e.useState)(Object.fromEntries(wt)),s=t.filter(p=>!wt.get(p)),[a,l]=(0,e.useState)(()=>!!s.length),i=(0,h.mZ)();(0,e.useEffect)(()=>{const p=m=>{o(m),l(!1)},u=async(m,f)=>{const g=await Promise.all(f);m.forEach((b,E)=>{wt.set(b,g[E].default)}),p(Object.fromEntries(wt))};if(s.length>0){l(!0);const m=s.reduce((f,g)=>{const b=i.get(g);return b&&f.push(b.components.Input()),f},[]);m.length>0&&u(s,m)}},[s,i]);const c=(0,e.useCallback)(()=>{wt.clear(),o({})},[]);return{isLazyLoading:a,lazyComponentStore:r,cleanup:c}};const Wn=({componentUid:t,isFromDynamicZone:r,isNested:o,name:s})=>{const{getComponentLayout:a}=(0,de.PL)(),i=(0,e.useMemo)(()=>a(t),[t,a]).layouts.edit,{lazyComponentStore:c}=jn();return e.createElement(L.x,{background:r?"":"neutral100",paddingLeft:6,paddingRight:6,paddingTop:6,paddingBottom:6,hasRadius:o,borderColor:o?"neutral200":""},e.createElement(P.k,{direction:"column",alignItems:"stretch",gap:6},i.map((p,u)=>e.createElement(De.r,{gap:4,key:u},p.map(({name:m,size:f,metadatas:g,fieldSchema:b,queryInfos:E})=>{const v=b.type==="component",I=`${s}.${m}`;if(v){const T=b.component;return e.createElement(ue.P,{col:f,s:12,xs:12,key:m},e.createElement(Xt,{componentUid:T,intlLabel:{id:g.label,defaultMessage:g.label},isNested:!0,isRepeatable:b.repeatable,max:b.max,min:b.min,name:I,required:b.required||!1}))}return e.createElement(ue.P,{col:f,key:m,s:12,xs:12},e.createElement(Nn,{componentUid:t,keys:I,fieldSchema:b,metadatas:g,queryInfos:E,size:f,customFieldInputs:c}))})))))};Wn.defaultProps={isFromDynamicZone:!1,isNested:!1},Wn.propTypes={componentUid:n().string.isRequired,isFromDynamicZone:n().bool,isNested:n().bool,name:n().string.isRequired};var ol=Wn,Ft=d(19406),sl=d(41119),bo=d.n(sl);const al=N.ZP.span`
|
|
673
|
-
display: block;
|
|
674
|
-
background-color: ${({theme:t})=>t.colors.primary100};
|
|
675
|
-
outline: 1px dashed ${({theme:t})=>t.colors.primary500};
|
|
676
|
-
outline-offset: -1px;
|
|
677
|
-
padding: ${({theme:t})=>t.spaces[6]};
|
|
678
|
-
`;var il=()=>e.createElement(al,{padding:6,background:"primary100"});const ll=(0,N.ZP)(ye.h)`
|
|
679
|
-
background-color: transparent;
|
|
680
|
-
|
|
681
|
-
svg {
|
|
682
|
-
path {
|
|
683
|
-
fill: ${({theme:t,expanded:r})=>r?t.colors.primary600:t.colors.neutral600};
|
|
684
|
-
}
|
|
685
|
-
}
|
|
686
|
-
|
|
687
|
-
&:hover {
|
|
688
|
-
svg {
|
|
689
|
-
path {
|
|
690
|
-
fill: ${({theme:t})=>t.colors.primary600};
|
|
691
|
-
}
|
|
692
|
-
}
|
|
693
|
-
}
|
|
694
|
-
`,cl=(0,N.ZP)(P.k)`
|
|
695
|
-
& .drag-handle {
|
|
696
|
-
background: unset;
|
|
697
|
-
|
|
698
|
-
svg {
|
|
699
|
-
path {
|
|
700
|
-
fill: ${({theme:t,expanded:r})=>r?t.colors.primary600:void 0};
|
|
701
|
-
}
|
|
702
|
-
}
|
|
703
|
-
|
|
704
|
-
&:hover {
|
|
705
|
-
svg {
|
|
706
|
-
path {
|
|
707
|
-
/* keeps the hover style of the accordion */
|
|
708
|
-
fill: ${({theme:t})=>t.colors.primary600};
|
|
709
|
-
}
|
|
710
|
-
}
|
|
711
|
-
}
|
|
712
|
-
}
|
|
713
|
-
`,zn=({componentFieldName:t,componentUid:r,fields:o,index:s,isOpen:a,isReadOnly:l,mainField:i,moveComponentField:c,onClickToggle:p,toggleCollapses:u,onGrabItem:m,onDropItem:f,onCancel:g})=>{const{modifiedData:b,removeRepeatableField:E,triggerFormValidation:v}=(0,h.Wq)(),I=bo()(x()(b,[...t.split("."),i],"")),T=(0,e.useRef)(null),{formatMessage:D}=(0,H.Z)(),w=t.split(".").slice(0,-1).join("."),[{handlerId:k,isDragging:C,handleKeyDown:M},F,B,U,A]=(0,uo.Y)(!l,{type:`${y._Q.COMPONENT}_${w}`,index:s,item:{displayedValue:I},onMoveItem:c,onStart(){u()},onEnd(){v()},onGrabItem:m,onDropItem:f,onCancel:g});(0,e.useEffect)(()=>{A((0,Ot.rX)(),{captureDraggingState:!1})},[A,s]);const G=(0,y.FE)(T,U),$=(0,y.FE)(F,B),{lazyComponentStore:Y}=jn();return e.createElement(L.x,{ref:$},C?e.createElement(il,null):e.createElement(mn.U,{expanded:a,onToggle:p,id:t,size:"S"},e.createElement(pn.B,{action:l?null:e.createElement(cl,{gap:0,expanded:a},e.createElement(ll,{expanded:a,noBorder:!0,onClick:()=>{E(t),u()},label:D({id:(0,y.OB)("containers.Edit.delete"),defaultMessage:"Delete"}),icon:e.createElement(He.Z,null)}),e.createElement(ye.h,{className:"drag-handle",ref:G,forwardedAs:"div",role:"button",noBorder:!0,tabIndex:0,onClick:j=>j.stopPropagation(),"data-handler-id":k,label:D({id:(0,y.OB)("components.DragHandle-label"),defaultMessage:"Drag"}),onKeyDown:M},e.createElement(Je.Z,null))),title:I,togglePosition:"left"}),e.createElement(gn.v,null,e.createElement(P.k,{direction:"column",alignItems:"stretch",background:"neutral100",padding:6,gap:6},o.map((j,X)=>e.createElement(De.r,{gap:4,key:X},j.map(({name:q,fieldSchema:W,metadatas:R,queryInfos:Z,size:V})=>{const K=W.type==="component",O=`${t}.${q}`;if(K){const S=W.component;return e.createElement(ue.P,{col:V,s:12,xs:12,key:q},e.createElement(Xt,{componentUid:S,intlLabel:{id:R.label,defaultMessage:R.label},isRepeatable:W.repeatable,isNested:!0,name:O,max:W.max,min:W.min,required:W.required}))}return e.createElement(ue.P,{key:O,col:V,s:12,xs:12},e.createElement(Nn,{componentUid:r,fieldSchema:W,keys:O,metadatas:R,queryInfos:Z,size:V,customFieldInputs:Y}))})))))))};zn.defaultProps={componentUid:void 0,fields:[],isReadOnly:!1,isOpen:!1,onGrabItem:void 0,onDropItem:void 0,onCancel:void 0,toggleCollapses(){}},zn.propTypes={componentFieldName:n().string.isRequired,componentUid:n().string,fields:n().array,index:n().number.isRequired,isOpen:n().bool,isReadOnly:n().bool,mainField:n().string.isRequired,moveComponentField:n().func.isRequired,onGrabItem:n().func,onDropItem:n().func,onCancel:n().func,onClickToggle:n().func.isRequired,toggleCollapses:n().func};var dl=(0,e.memo)(zn),vo=d(861);const ul=(0,N.ZP)(L.x)`
|
|
714
|
-
overflow: hidden;
|
|
715
|
-
border-bottom: 1px solid ${({theme:t})=>t.colors.neutral200};
|
|
716
|
-
border-right: 1px solid ${({theme:t})=>t.colors.neutral200};
|
|
717
|
-
border-left: 1px solid ${({theme:t})=>t.colors.neutral200};
|
|
718
|
-
border-radius: 0 0 ${({theme:t})=>t.borderRadius} ${({theme:t})=>t.borderRadius};
|
|
719
|
-
`,ml=(0,N.ZP)(L.x)`
|
|
720
|
-
border-bottom: none;
|
|
721
|
-
|
|
722
|
-
/* add the borders and make sure the top is transparent to avoid jumping with the hover effect */
|
|
723
|
-
& > div > div {
|
|
724
|
-
border: 1px solid ${({theme:t})=>t.colors.neutral200};
|
|
725
|
-
border-top-color: transparent;
|
|
726
|
-
}
|
|
727
|
-
|
|
728
|
-
/* the top accordion _does_ need a border though */
|
|
729
|
-
& > div:first-child > div {
|
|
730
|
-
border-top: 1px solid ${({theme:t})=>t.colors.neutral200};
|
|
731
|
-
}
|
|
732
|
-
|
|
733
|
-
/* Reset all the border-radius' */
|
|
734
|
-
& > div > div,
|
|
735
|
-
& > div > div > div {
|
|
736
|
-
border-radius: unset;
|
|
737
|
-
}
|
|
738
|
-
|
|
739
|
-
/* Give the border radius back to the first accordion */
|
|
740
|
-
& > div:first-child > div,
|
|
741
|
-
& > div:first-child > div > div {
|
|
742
|
-
border-radius: ${({theme:t})=>t.borderRadius} ${({theme:t})=>t.borderRadius} 0 0;
|
|
743
|
-
}
|
|
744
|
-
|
|
745
|
-
& > div > div[data-strapi-expanded='true'] {
|
|
746
|
-
border: 1px solid ${({theme:t})=>t.colors.primary600};
|
|
747
|
-
}
|
|
748
|
-
`,Vn=({children:t,error:r})=>{const{formatMessage:o}=(0,H.Z)();return e.createElement(vo.k,{attributeName:"data-strapi-accordion-toggle"},t,r&&e.createElement(L.x,{paddingTop:1},e.createElement(Q.Z,{variant:"pi",textColor:"danger600"},o({id:r.id,defaultMessage:r.defaultMessage},{...r.values}))))};Vn.defaultProps={error:void 0},Vn.propTypes={children:n().node.isRequired,error:n().shape({id:n().string.isRequired,defaultMessage:n().string.isRequired,values:n().object})};function pl(t,r={}){return Object.keys(r).filter(o=>o.startsWith(t)).map(o=>o.split(".").slice(0,t.split(".").length+1).join("."))}const gl=(0,N.ZP)(lo.A)`
|
|
749
|
-
height: 100%;
|
|
750
|
-
width: 100%;
|
|
751
|
-
border-radius: 0 0 4px 4px;
|
|
752
|
-
display: flex;
|
|
753
|
-
justify-content: center;
|
|
754
|
-
span {
|
|
755
|
-
font-weight: 600;
|
|
756
|
-
font-size: 14px;
|
|
757
|
-
}
|
|
758
|
-
`,Un=({componentUid:t,componentValue:r,componentValueLength:o,isReadOnly:s,max:a,min:l,name:i})=>{const{addRepeatableComponentToField:c,formErrors:p,moveComponentField:u}=(0,h.Wq)(),m=(0,h.lm)(),{formatMessage:f}=(0,H.Z)(),[g,b]=(0,e.useState)(""),[E,v]=(0,e.useState)(""),{getComponentLayout:I,components:T}=(0,de.PL)(),D=(0,e.useMemo)(()=>I(t),[t,I]),w=(0,e.useMemo)(()=>(0,y.Uo)(r||[])+1,[r]),k=pl(i,p),C=l-o,M=x()(p,i,{id:""}).id.includes("min"),F=()=>{b("")},B=()=>{s||(o<a?(c(i,D,T,M),b(w)):o>=a&&m({type:"info",message:{id:(0,y.OB)("components.notification.info.maximum-requirement")}}))},U=(R,Z)=>{v(f({id:(0,y.OB)("dnd.reorder"),defaultMessage:"{item}, moved. New position in list: {position}."},{item:`${i}.${Z}`,position:$(R)})),u({name:i,newIndex:R,currentIndex:Z})},A=x()(D,["settings","mainField"],"id"),G=R=>()=>{b(g===R?"":R)},$=R=>`${R+1} of ${o}`,Y=R=>{v(f({id:(0,y.OB)("dnd.cancel-item"),defaultMessage:"{item}, dropped. Re-order cancelled."},{item:`${i}.${R}`}))},j=R=>{v(f({id:(0,y.OB)("dnd.grab-item"),defaultMessage:"{item}, grabbed. Current position in list: {position}. Press up and down arrow to change position, Spacebar to drop, Escape to cancel."},{item:`${i}.${R}`,position:$(R)}))},X=R=>{v(f({id:(0,y.OB)("dnd.drop-item"),defaultMessage:"{item}, dropped. Final position in list: {position}."},{item:`${i}.${R}`,position:$(R)}))};let q=p[i];if(M?q={id:(0,y.OB)("components.DynamicZone.missing-components"),defaultMessage:"There {number, plural, =0 {are # missing components} one {is # missing component} other {are # missing components}}",values:{number:C}}:k.some(R=>R.split(".").length>1)&&!M&&(q={id:(0,y.OB)("components.RepeatableComponent.error-message"),defaultMessage:"The component(s) contain error(s)"}),o===0)return e.createElement(Vr,{error:q,isReadOnly:s,onClick:B});const W=`${i}-item-instructions`;return e.createElement(L.x,{hasRadius:!0},e.createElement(mt.T,{id:W},f({id:(0,y.OB)("dnd.instructions"),defaultMessage:"Press spacebar to grab and re-order"})),e.createElement(mt.T,{"aria-live":"assertive"},E),e.createElement(Vn,{error:q,ariaDescribedBy:W},e.createElement(ml,{"aria-describedby":W},r.map(({__temp_key__:R},Z)=>e.createElement(dl,{componentFieldName:`${i}.${Z}`,componentUid:t,fields:D.layouts.edit,key:R,index:Z,isOpen:g===R,isReadOnly:s,mainField:A,moveComponentField:U,onClickToggle:G(R),toggleCollapses:F,onCancel:Y,onDropItem:X,onGrabItem:j}))),e.createElement(ul,null,e.createElement(P.k,{justifyContent:"center",height:"48px",background:"neutral0"},e.createElement(gl,{disabled:s,onClick:B,startIcon:e.createElement(Ft.Z,null)},f({id:(0,y.OB)("containers.EditView.add.new-entry"),defaultMessage:"Add an entry"}))))))};Un.defaultProps={componentValue:null,componentValueLength:0,isReadOnly:!1,max:1/0,min:0},Un.propTypes={componentUid:n().string.isRequired,componentValue:n().oneOfType([n().array,n().object]),componentValueLength:n().number,isReadOnly:n().bool,max:n().number,min:n().number,name:n().string.isRequired};var fl=(0,e.memo)(Un);const Hn=({addNonRepeatableComponentToField:t,componentUid:r,intlLabel:o,isCreatingEntry:s,isFromDynamicZone:a,isRepeatable:l,isNested:i,labelAction:c,max:p,min:u,name:m,hasChildrenAllowedFields:f,hasChildrenReadableFields:g,isReadOnly:b,componentValue:E,removeComponentFromField:v,required:I})=>{const{formatMessage:T}=(0,H.Z)(),D=Gs()(E),w=E!==null||a,k=!l&&w&&!a&&f,{getComponentLayout:C,components:M}=(0,de.PL)(),F=(0,e.useMemo)(()=>C(r),[r,C]);if(!f&&s)return e.createElement(h.X0,{labelAction:c,intlLabel:o,name:m});if(!f&&!s&&!g)return e.createElement(h.X0,{labelAction:c,intlLabel:o,name:m});const B=()=>{t(m,F,M)};return e.createElement(L.x,null,e.createElement(P.k,{justifyContent:"space-between"},o&&e.createElement(ta,{intlLabel:o,labelAction:c,name:m,numberOfEntries:D,showNumberOfEntries:l,required:I}),k&&e.createElement(ye.h,{label:T({id:(0,y.OB)("components.reset-entry"),defaultMessage:"Reset Entry"}),icon:e.createElement(He.Z,null),noBorder:!0,onClick:()=>{v(m,r)}})),e.createElement(P.k,{direction:"column",alignItems:"stretch",gap:1},!l&&!w&&e.createElement(Vr,{isReadOnly:b,onClick:B}),!l&&w&&e.createElement(ol,{componentUid:r,isFromDynamicZone:a,isNested:i,name:m}),l&&e.createElement(fl,{componentValue:E,componentValueLength:D,componentUid:r,isReadOnly:b,max:p,min:u,name:m})))};Hn.defaultProps={componentValue:null,hasChildrenAllowedFields:!1,hasChildrenReadableFields:!1,intlLabel:void 0,isFromDynamicZone:!1,isReadOnly:!1,isRepeatable:!1,isNested:!1,labelAction:void 0,max:1/0,min:-1/0,required:!1},Hn.propTypes={addNonRepeatableComponentToField:n().func.isRequired,componentUid:n().string.isRequired,componentValue:n().oneOfType([n().object,n().array]),hasChildrenAllowedFields:n().bool,hasChildrenReadableFields:n().bool,isCreatingEntry:n().bool.isRequired,isFromDynamicZone:n().bool,isReadOnly:n().bool,isRepeatable:n().bool,isNested:n().bool,intlLabel:n().shape({id:n().string.isRequired,defaultMessage:n().string.isRequired,values:n().object}),labelAction:n().element,max:n().number,min:n().number,name:n().string.isRequired,removeComponentFromField:n().func.isRequired,required:n().bool};const hl=(0,e.memo)(Hn,Oe());var Xt=Ys(hl,_s);const yl=(0,N.ZP)(P.k)`
|
|
759
|
-
/*
|
|
760
|
-
we need to remove the background from the button but we can't
|
|
761
|
-
wrap the element in styled because it breaks the forwardedAs which
|
|
762
|
-
we need for drag handler to work on firefox
|
|
763
|
-
*/
|
|
764
|
-
div[role='button'] {
|
|
765
|
-
background: transparent;
|
|
766
|
-
}
|
|
767
|
-
`,El=(0,N.ZP)(ye.h)`
|
|
768
|
-
background-color: transparent;
|
|
769
|
-
|
|
770
|
-
svg path {
|
|
771
|
-
fill: ${({theme:t,expanded:r})=>r?t.colors.primary600:t.colors.neutral600};
|
|
772
|
-
}
|
|
773
|
-
`,bl=(0,N.ZP)(L.x)`
|
|
774
|
-
> div:first-child {
|
|
775
|
-
box-shadow: ${({theme:t})=>t.shadows.tableShadow};
|
|
776
|
-
}
|
|
777
|
-
`,vl=(0,N.ZP)(L.x)`
|
|
778
|
-
border-radius: 0 0 ${({theme:t})=>t.spaces[1]} ${({theme:t})=>t.spaces[1]};
|
|
779
|
-
`,Cl=(0,N.ZP)(L.x)`
|
|
780
|
-
width: ${({theme:t})=>t.spaces[2]};
|
|
781
|
-
height: ${({theme:t})=>t.spaces[4]};
|
|
782
|
-
`,Rl=N.ZP.span`
|
|
783
|
-
display: block;
|
|
784
|
-
background-color: ${({theme:t})=>t.colors.primary100};
|
|
785
|
-
outline: 1px dashed ${({theme:t})=>t.colors.primary500};
|
|
786
|
-
outline-offset: -1px;
|
|
787
|
-
padding: ${({theme:t})=>t.spaces[6]};
|
|
788
|
-
`,Ml=(0,N.ZP)(L.x)`
|
|
789
|
-
list-style: none;
|
|
790
|
-
padding: 0;
|
|
791
|
-
margin: 0;
|
|
792
|
-
`,Qn=({componentUid:t,formErrors:r,index:o,isFieldAllowed:s,name:a,onRemoveComponentClick:l,onMoveComponent:i,onGrabItem:c,onDropItem:p,onCancel:u})=>{const[m,f]=(0,e.useState)(!0),{formatMessage:g}=(0,H.Z)(),{getComponentLayout:b}=(0,de.PL)(),{modifiedData:E}=(0,h.Wq)(),{icon:v,friendlyName:I,mainValue:T}=(0,e.useMemo)(()=>{const j=b(t),{info:{icon:X,displayName:q}}=j,W=x()(j,["settings","mainField"],"id"),R=x()(E,[a,o,W])??"",Z=W==="id"?"":String(R).trim(),V=Z.length>0?` - ${Z}`:Z;return{friendlyName:q,icon:X,mainValue:V}},[t,b,E,a,o]),D=Object.keys(r).filter(j=>{const X=j.split(".");return`${X[0]}.${X[1]}`==`${a}.${o}`});let w;D.length>0&&(w=g({id:(0,y.OB)("components.DynamicZone.error-message"),defaultMessage:"The component contains error(s)"}));const k=()=>{f(j=>!j)},[{handlerId:C,isDragging:M,handleKeyDown:F},B,U,A,G]=(0,de.Y9)(s,{type:`${y._Q.DYNAMIC_ZONE}_${a}`,index:o,item:{displayedValue:`${I}${T}`,icon:v},onMoveItem:i,onGrabItem:c,onDropItem:p,onCancel:u});(0,e.useEffect)(()=>{G((0,Ot.rX)(),{captureDraggingState:!1})},[G,o]);const $=(0,y.FE)(B,U),Y=s?e.createElement(yl,{gap:0,expanded:m},e.createElement(El,{noBorder:!0,label:g({id:(0,y.OB)("components.DynamicZone.delete-label"),defaultMessage:"Delete {name}"},{name:I}),onClick:l},e.createElement(He.Z,null)),e.createElement(ye.h,{forwardedAs:"div",role:"button",noBorder:!0,tabIndex:0,onClick:j=>j.stopPropagation(),"data-handler-id":C,ref:A,label:g({id:(0,y.OB)("components.DragHandle-label"),defaultMessage:"Drag"}),onKeyDown:F},e.createElement(Je.Z,null))):null;return e.createElement(Ml,{as:"li"},e.createElement(P.k,{justifyContent:"center"},e.createElement(Cl,{background:"neutral200"})),e.createElement(bl,{ref:$,hasRadius:!0},M?e.createElement(Rl,{padding:6,background:"primary100"}):e.createElement(mn.U,{expanded:m,onToggle:k,size:"S",error:w},e.createElement(pn.B,{action:Y,title:`${I}${T}`,togglePosition:"left"}),e.createElement(gn.v,null,e.createElement(vl,{background:"neutral0"},e.createElement(Xt,{componentUid:t,icon:v,name:`${a}.${o}`,isFromDynamicZone:!0}))))))};Qn.defaultProps={formErrors:{},index:0,isFieldAllowed:!0,onGrabItem:void 0,onDropItem:void 0,onCancel:void 0},Qn.propTypes={componentUid:n().string.isRequired,formErrors:n().object,index:n().number,isFieldAllowed:n().bool,name:n().string.isRequired,onGrabItem:n().func,onDropItem:n().func,onCancel:n().func,onMoveComponent:n().func.isRequired,onRemoveComponentClick:n().func.isRequired};var Tl=Qn;const Gn=(0,N.ZP)(zr.Z)`
|
|
793
|
-
transform: ${({$isOpen:t})=>t?"rotate(45deg)":"rotate(0deg)"};
|
|
794
|
-
> circle {
|
|
795
|
-
fill: ${({theme:t,$hasError:r})=>r?t.colors.danger200:t.colors.neutral150};
|
|
796
|
-
}
|
|
797
|
-
> path {
|
|
798
|
-
fill: ${({theme:t,$hasError:r})=>r?t.colors.danger600:t.colors.neutral600};
|
|
799
|
-
}
|
|
800
|
-
`,Dl=(0,N.ZP)(vn.Y)`
|
|
801
|
-
border-radius: 26px;
|
|
802
|
-
border-color: ${({theme:t})=>t.colors.neutral150};
|
|
803
|
-
background: ${({theme:t})=>t.colors.neutral0};
|
|
804
|
-
padding-top: ${({theme:t})=>t.spaces[3]};
|
|
805
|
-
padding-right: ${({theme:t})=>t.spaces[4]};
|
|
806
|
-
padding-bottom: ${({theme:t})=>t.spaces[3]};
|
|
807
|
-
padding-left: ${({theme:t})=>t.spaces[4]};
|
|
808
|
-
|
|
809
|
-
box-shadow: ${({theme:t})=>t.shadows.filterShadow};
|
|
810
|
-
|
|
811
|
-
svg {
|
|
812
|
-
height: ${({theme:t})=>t.spaces[6]};
|
|
813
|
-
width: ${({theme:t})=>t.spaces[6]};
|
|
814
|
-
> path {
|
|
815
|
-
fill: ${({theme:t})=>t.colors.neutral600};
|
|
816
|
-
}
|
|
817
|
-
}
|
|
818
|
-
&:hover {
|
|
819
|
-
color: ${({theme:t})=>t.colors.primary600} !important;
|
|
820
|
-
${Q.Z} {
|
|
821
|
-
color: ${({theme:t})=>t.colors.primary600} !important;
|
|
822
|
-
}
|
|
823
|
-
|
|
824
|
-
${Gn} {
|
|
825
|
-
> circle {
|
|
826
|
-
fill: ${({theme:t})=>t.colors.primary600};
|
|
827
|
-
}
|
|
828
|
-
> path {
|
|
829
|
-
fill: ${({theme:t})=>t.colors.neutral100};
|
|
830
|
-
}
|
|
831
|
-
}
|
|
832
|
-
}
|
|
833
|
-
&:active {
|
|
834
|
-
${Q.Z} {
|
|
835
|
-
color: ${({theme:t})=>t.colors.primary600};
|
|
836
|
-
}
|
|
837
|
-
${Gn} {
|
|
838
|
-
> circle {
|
|
839
|
-
fill: ${({theme:t})=>t.colors.primary600};
|
|
840
|
-
}
|
|
841
|
-
> path {
|
|
842
|
-
fill: ${({theme:t})=>t.colors.neutral100};
|
|
843
|
-
}
|
|
844
|
-
}
|
|
845
|
-
}
|
|
846
|
-
`,Il=(0,N.ZP)(L.x)`
|
|
847
|
-
height: 100%;
|
|
848
|
-
`,Kn=({hasError:t,hasMaxError:r,hasMinError:o,isDisabled:s,isOpen:a,label:l,missingComponentNumber:i,name:c,onClick:p})=>{const{formatMessage:u}=(0,H.Z)(),m=u({id:(0,y.OB)("components.DynamicZone.add-component"),defaultMessage:"Add a component to {componentName}"},{componentName:l||c}),f=u({id:"app.utils.close-label",defaultMessage:"Close"});let g=a?f:m;return r&&!a&&(g=u({id:"components.Input.error.validation.max",defaultMessage:"The value is too high."})),o&&!a&&(g=u({id:(0,y.OB)("components.DynamicZone.missing-components"),defaultMessage:"There {number, plural, =0 {are # missing components} one {is # missing component} other {are # missing components}}"},{number:i})),e.createElement(P.k,{justifyContent:"center"},e.createElement(L.x,{style:{cursor:s?"not-allowed":"pointer"}},e.createElement(Dl,{type:"button",onClick:p,disabled:s,hasError:t},e.createElement(P.k,null,e.createElement(Il,{"aria-hidden":!0,paddingRight:2},e.createElement(Gn,{$isOpen:a,$hasError:t&&!a})),e.createElement(Q.Z,{variant:"pi",fontWeight:"bold",textColor:t&&!a?"danger600":"neutral500"},g)))))};Kn.defaultProps={hasError:!1,hasMaxError:!1,hasMinError:!1,isDisabled:!1,isOpen:!1,label:"",missingComponentNumber:0},Kn.propTypes={label:n().string,hasError:n().bool,hasMaxError:n().bool,hasMinError:n().bool,isDisabled:n().bool,isOpen:n().bool,missingComponentNumber:n().number,name:n().string.isRequired,onClick:n().func.isRequired};var kl=Kn;const Ol=(0,N.ZP)(L.x)`
|
|
849
|
-
border-radius: ${(0,h.Q1)(26)};
|
|
850
|
-
`,Yn=({label:t,labelAction:r,name:o,numberOfComponents:s,required:a,intlDescription:l})=>{const{formatMessage:i}=(0,H.Z)(),c=i({id:t||o,defaultMessage:t||o});return e.createElement(P.k,{justifyContent:"center"},e.createElement(L.x,null,e.createElement(Ol,{paddingTop:3,paddingBottom:3,paddingRight:4,paddingLeft:4,background:"neutral0",shadow:"filterShadow",color:"neutral500"},e.createElement(P.k,{direction:"column",justifyContent:"center"},e.createElement(P.k,{maxWidth:(0,h.Q1)(356)},e.createElement(Q.Z,{variant:"pi",textColor:"neutral600",fontWeight:"bold",ellipsis:!0},c,"\xA0"),e.createElement(Q.Z,{variant:"pi",textColor:"neutral600",fontWeight:"bold"},"(",s,")"),a&&e.createElement(Q.Z,{textColor:"danger600"},"*"),r&&e.createElement(L.x,{paddingLeft:1},r)),l&&e.createElement(L.x,{paddingTop:1,maxWidth:(0,h.Q1)(356)},e.createElement(Q.Z,{variant:"pi",textColor:"neutral600",ellipsis:!0},i(l)))))))};Yn.defaultProps={intlDescription:void 0,label:"",labelAction:void 0,numberOfComponents:0,required:!1},Yn.propTypes={intlDescription:n().shape({id:n().string.isRequired,defaultMessage:n().string.isRequired}),label:n().string,labelAction:n().element,name:n().string.isRequired,numberOfComponents:n().number,required:n().bool};var xl=Yn,Pl=d(81346),Co=d.n(Pl);const Jt=5,_t=8,wl=(0,N.ZP)(P.k)`
|
|
851
|
-
border-radius: ${({showBackground:t})=>t?"50%":0};
|
|
852
|
-
color: ${({theme:t})=>t.colors.neutral600};
|
|
853
|
-
height: ${({theme:t,size:r})=>t.spaces[r==="S"?Jt:_t]};
|
|
854
|
-
width: ${({theme:t,size:r})=>t.spaces[r==="S"?Jt:_t]};
|
|
855
|
-
|
|
856
|
-
svg {
|
|
857
|
-
height: ${({theme:t,size:r})=>t.spaces[r==="S"?Jt-2:_t-3]};
|
|
858
|
-
width: ${({theme:t,size:r})=>t.spaces[r==="S"?Jt-2:_t-3]};
|
|
859
|
-
}
|
|
860
|
-
`;function en({showBackground:t=!0,size:r="M"}){return e.createElement(wl,{alignItems:"center",background:t?"neutral200":null,justifyContent:"center",size:r,showBackground:t},e.createElement("svg",{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 448 512"},e.createElement("path",{d:"M216.3 2c4.8-2.6 10.5-2.6 15.3 0L422.3 106c5.1 2.8 8.3 8.2 8.3 14s-3.2 11.2-8.3 14L231.7 238c-4.8 2.6-10.5 2.6-15.3 0L25.7 134c-5.1-2.8-8.3-8.2-8.3-14s3.2-11.2 8.3-14L216.3 2zM23.7 170l176 96c5.1 2.8 8.3 8.2 8.3 14V496c0 5.6-3 10.9-7.8 13.8s-10.9 3-15.8 .3L8.3 414C3.2 411.2 0 405.9 0 400V184c0-5.6 3-10.9 7.8-13.8s10.9-3 15.8-.3zm400.7 0c5-2.7 11-2.6 15.8 .3s7.8 8.1 7.8 13.8V400c0 5.9-3.2 11.2-8.3 14l-176 96c-5 2.7-11 2.6-15.8-.3s-7.8-8.1-7.8-13.8V280c0-5.9 3.2-11.2 8.3-14l176-96z",fill:"currentColor"})))}en.defaultProps={showBackground:!0,size:"M"},en.propTypes={showBackground:n().bool,size:n().string};const Fl=(0,N.ZP)(L.x)`
|
|
861
|
-
flex-shrink: 0;
|
|
862
|
-
height: ${(0,h.Q1)(84)};
|
|
863
|
-
border: 1px solid ${({theme:t})=>t.colors.neutral200};
|
|
864
|
-
background: ${({theme:t})=>t.colors.neutral100};
|
|
865
|
-
border-radius: ${({theme:t})=>t.borderRadius};
|
|
866
|
-
display: flex;
|
|
867
|
-
justify-content: center;
|
|
868
|
-
align-items: center;
|
|
869
|
-
|
|
870
|
-
&:focus,
|
|
871
|
-
&:hover {
|
|
872
|
-
border: 1px solid ${({theme:t})=>t.colors.primary200};
|
|
873
|
-
background: ${({theme:t})=>t.colors.primary100};
|
|
874
|
-
|
|
875
|
-
${Q.Z} {
|
|
876
|
-
color: ${({theme:t})=>t.colors.primary600};
|
|
877
|
-
}
|
|
878
|
-
|
|
879
|
-
/* > Flex > ComponentIcon */
|
|
880
|
-
> div > div:first-child {
|
|
881
|
-
background: ${({theme:t})=>t.colors.primary200};
|
|
882
|
-
color: ${({theme:t})=>t.colors.primary600};
|
|
883
|
-
}
|
|
884
|
-
}
|
|
885
|
-
`;function Xn({children:t,onClick:r}){return e.createElement(Fl,{as:"button",type:"button",onClick:r,hasRadius:!0},e.createElement(P.k,{direction:"column",gap:1,alignItems:"center",justifyContent:"center"},e.createElement(en,null),e.createElement(Q.Z,{variant:"pi",fontWeight:"bold",textColor:"neutral600"},t)))}Xn.defaultProps={onClick(){}},Xn.propTypes={children:n().node.isRequired,onClick:n().func};const Ll=N.ZP.div`
|
|
886
|
-
display: grid;
|
|
887
|
-
grid-template-columns: repeat(auto-fit, ${140/16}rem);
|
|
888
|
-
grid-gap: ${({theme:t})=>t.spaces[1]};
|
|
889
|
-
`,Jn=({category:t,components:r,variant:o,isOpen:s,onAddComponent:a,onToggle:l})=>{const{formatMessage:i}=(0,H.Z)(),c=()=>{l(t)};return e.createElement(mn.U,{expanded:s,onToggle:c,size:"S"},e.createElement(pn.B,{variant:o,title:i({id:t,defaultMessage:t}),togglePosition:"left"}),e.createElement(gn.v,null,e.createElement(L.x,{paddingTop:4,paddingBottom:4,paddingLeft:3,paddingRight:3},e.createElement(Ll,null,r.map(({componentUid:p,info:{displayName:u}})=>e.createElement(Xn,{key:p,onClick:a(p)},i({id:u,defaultMessage:u})))))))};Jn.defaultProps={components:[],isOpen:!1,variant:"primary"},Jn.propTypes={category:n().string.isRequired,components:n().array,isOpen:n().bool,onAddComponent:n().func.isRequired,onToggle:n().func.isRequired,variant:n().oneOf(["primary","secondary"])};var Sl=Jn;const _n=({components:t,isOpen:r,onClickAddComponent:o})=>{const{formatMessage:s}=(0,H.Z)(),{getComponentLayout:a}=(0,de.PL)(),[l,i]=(0,e.useState)(""),c=(0,e.useMemo)(()=>{const m=t.map(g=>{const{category:b,info:E}=a(g);return{componentUid:g,category:b,info:E}}),f=Co()(m,"category");return Object.keys(f).reduce((g,b)=>(g.push({category:b,components:f[b]}),g),[])},[t,a]);(0,e.useEffect)(()=>{r&&c.length>0&&i(c[0].category)},[r,c]);const p=m=>()=>{o(m),i("")},u=m=>{i(f=>f===m?"":m)};return r?e.createElement(L.x,{paddingBottom:6},e.createElement(L.x,{paddingTop:6,paddingBottom:6,paddingLeft:5,paddingRight:5,background:"neutral0",shadow:"tableShadow",borderColor:"neutral150",hasRadius:!0},e.createElement(P.k,{justifyContent:"center"},e.createElement(Q.Z,{fontWeight:"bold",textColor:"neutral600"},s({id:(0,y.OB)("components.DynamicZone.ComponentPicker-label"),defaultMessage:"Pick one component"}))),e.createElement(L.x,{paddingTop:2},e.createElement(vo.k,{attributeName:"data-strapi-accordion-toggle"},c.map(({category:m,components:f},g)=>e.createElement(Sl,{key:m,category:m,components:f,onAddComponent:p,isOpen:m===l,onToggle:u,variant:g%2===1?"primary":"secondary"})))))):null};_n.defaultProps={components:[],isOpen:!1},_n.propTypes={components:n().array,isOpen:n().bool,onClickAddComponent:n().func.isRequired};var Al=_n;const er=({name:t,addComponentToDynamicZone:r,formErrors:o,isCreatingEntry:s,isFieldAllowed:a,isFieldReadable:l,labelAction:i,moveComponentField:c,removeComponentFromDynamicZone:p,dynamicDisplayedComponents:u,fieldSchema:m,metadatas:f})=>{const[g,b]=(0,e.useState)(!1),[E,v]=(0,e.useState)(""),{formatMessage:I}=(0,H.Z)(),T=(0,h.lm)(),{getComponentLayout:D,components:w}=(0,de.PL)(),k=u.length,C=f.description?{id:f.description,defaultMessage:f.description}:null,{max:M=1/0,min:F=-1/0}=m,B=(0,e.useMemo)(()=>Object.keys(o).filter(O=>O===t).map(O=>o[O]),[o,t]),U=F-k,A=B.length>0,G=B.length>0&&x()(B,[0,"id"],"").includes("min"),$=A&&x()(B,[0,"id"],"")==="components.Input.error.validation.max",Y=O=>{b(!1);const S=D(O);r(t,S,w,A)},j=()=>{k<M?b(O=>!O):T({type:"info",message:{id:(0,y.OB)("components.notification.info.maximum-requirement")}})},X=(O,S)=>{v(I({id:(0,y.OB)("dnd.reorder"),defaultMessage:"{item}, moved. New position in list: {position}."},{item:`${t}.${S}`,position:q(O)})),c({name:t,newIndex:O,currentIndex:S})},q=O=>`${O+1} of ${u.length}`,W=O=>{v(I({id:(0,y.OB)("dnd.cancel-item"),defaultMessage:"{item}, dropped. Re-order cancelled."},{item:`${t}.${O}`}))},R=O=>{v(I({id:(0,y.OB)("dnd.grab-item"),defaultMessage:"{item}, grabbed. Current position in list: {position}. Press up and down arrow to change position, Spacebar to drop, Escape to cancel."},{item:`${t}.${O}`,position:q(O)}))},Z=O=>{v(I({id:(0,y.OB)("dnd.drop-item"),defaultMessage:"{item}, dropped. Final position in list: {position}."},{item:`${t}.${O}`,position:q(O)}))},V=(O,S)=>()=>{p(O,S)};if(!a&&(s||!l&&!s))return e.createElement(h.X0,{description:C,intlLabel:{id:f.label,defaultMessage:f.label},labelAction:i,name:t});const K=`${t}-item-instructions`;return e.createElement(P.k,{direction:"column",alignItems:"stretch",gap:6},k>0&&e.createElement(L.x,null,e.createElement(xl,{intlDescription:C,label:f.label,labelAction:i,name:t,numberOfComponents:k,required:m.required||!1}),e.createElement(mt.T,{id:K},I({id:(0,y.OB)("dnd.instructions"),defaultMessage:"Press spacebar to grab and re-order"})),e.createElement(mt.T,{"aria-live":"assertive"},E),e.createElement("ol",{"aria-describedby":K},u.map(({componentUid:O,id:S},ne)=>e.createElement(Tl,{componentUid:O,formErrors:o,key:`${O}-${S}`,index:ne,isFieldAllowed:a,name:t,onMoveComponent:X,onRemoveComponentClick:V(t,ne),onCancel:W,onDropItem:Z,onGrabItem:R})))),e.createElement(kl,{hasError:A,hasMaxError:$,hasMinError:G,isDisabled:!a,label:f.label,missingComponentNumber:U,isOpen:g,name:t,onClick:j}),e.createElement(Al,{isOpen:g,components:m.components??[],onClickAddComponent:Y}))};er.defaultProps={dynamicDisplayedComponents:[],fieldSchema:{max:1/0,min:-1/0},labelAction:null},er.propTypes={addComponentToDynamicZone:n().func.isRequired,dynamicDisplayedComponents:n().arrayOf(n().shape({componentUid:n().string.isRequired,id:n().number.isRequired})),fieldSchema:n().shape({components:n().array.isRequired,max:n().number,min:n().number,required:n().bool}),formErrors:n().object.isRequired,isCreatingEntry:n().bool.isRequired,isFieldAllowed:n().bool.isRequired,isFieldReadable:n().bool.isRequired,labelAction:n().element,metadatas:n().shape({description:n().string,label:n().string}).isRequired,moveComponentField:n().func.isRequired,name:n().string.isRequired,removeComponentFromDynamicZone:n().func.isRequired};const $l=(0,e.memo)(er,Oe());var Zl=Vs($l,Hs),ze=d(84306),_e=d(41578);const tn=()=>({type:_e.ZA}),tr=t=>({type:_e.Id,data:t}),nr=(t,r=!1)=>({type:_e.TP,rawQuery:t,isSingleType:r}),Ro=()=>({type:_e.c2}),Mo=(t,r)=>({type:_e.w7,componentsDataStructure:t,contentTypeDataStructure:r}),ce=t=>({type:_e.d0,status:t}),et=t=>({type:_e.t9,data:t}),Bl=()=>({type:_e.tE});var rr=t=>t["content-manager_editViewCrudReducer"];const or=({allLayoutData:t,children:r,slug:o,id:s,origin:a})=>{const l=(0,ot.useQueryClient)(),i=(0,h.lm)(),{setCurrentStep:c}=(0,h.c1)(),{trackUsage:p}=(0,h.rS)(),{push:u,replace:m}=(0,te.k6)(),[{rawQuery:f}]=(0,h.Kx)(),g=(0,J.I0)(),{componentsDataStructure:b,contentTypeDataStructure:E,data:v,isLoading:I,status:T}=(0,J.v9)(rr),D=(0,de.Ky)(o),{formatAPIError:w}=(0,h.So)(y.OB),k=(0,e.useRef)(!0),C=(0,e.useRef)(p),M=(0,e.useRef)(t),F=(0,h.kY)(),{put:B,post:U,del:A}=F,G=s===null,$=(0,e.useMemo)(()=>G&&!a?null:(0,y.IF)(`collection-types/${o}/${a||s}`),[o,s,G,a]),Y=(0,e.useCallback)(O=>a?(0,h.w6)(O,M.current.contentType,M.current.components):O,[a]),j=(0,e.useCallback)(O=>{const S=(0,y.kc)(O,M.current.contentType,M.current.components);return(0,h.dU)(S,M.current.contentType,M.current.components)},[]);(0,e.useEffect)(()=>{const O=Object.keys(t.components).reduce((_,ae)=>{const z=(0,y.Di)(x()(t,["components",ae,"attributes"],{}),t.components);return _[ae]=(0,h.dU)(z,t.components[ae],t.components),_},{}),S=(0,y.Di)(t.contentType.attributes,t.components),ne=(0,h.dU)(S,t.contentType,t.components);g(Mo(O,ne))},[t,g]),(0,e.useEffect)(()=>()=>{g(Ro())},[g]),(0,e.useEffect)(()=>{const S=ze.Z.CancelToken.source(),ne=async ae=>{g(tn());try{const{data:z}=await F.get($,{cancelToken:ae.token});g(tr(j(Y(z))))}catch(z){if(ze.Z.isCancel(z))return;const ie=x()(z,"response.status",null);if(ie===404){u(D);return}ie===403&&(i({type:"info",message:{id:(0,y.OB)("permissions.not-allowed.update")}}),u(D))}},_=async()=>{await g(tn()),await g(nr(f))};return k.current?($?ne(S):_(),()=>{S.cancel("Operation canceled by the user.")}):()=>{}},[F,Y,j,u,$,g,f,D,i]);const X=(0,e.useCallback)(O=>{i({type:"warning",message:w(O)})},[i,w]),q=(0,e.useCallback)(async O=>{try{C.current("willDeleteEntry",O);const{data:S}=await A((0,y.IF)(`collection-types/${o}/${s}`));return i({type:"success",message:{id:(0,y.OB)("success.record.delete")}}),C.current("didDeleteEntry",O),m(D),Promise.resolve(S)}catch(S){return C.current("didNotDeleteEntry",{error:S,...O}),Promise.reject(S)}},[s,o,i,A,D,m]),W=(0,e.useCallback)(async(O,S)=>{const ne=`${(0,y.IF)(`collection-types/${o}`)}${f}`;try{g(ce("submit-pending"));const{data:_}=await U(ne,O);return C.current("didCreateEntry",S),i({type:"success",message:{id:(0,y.OB)("success.record.save")}}),c("contentManager.success"),l.invalidateQueries(["relation"]),g(et(j(_))),g(ce("resolved")),m(`/content-manager/collectionType/${o}/${_.id}${f}`),Promise.resolve(_)}catch(_){return X(_),C.current("didNotCreateEntry",{error:_,trackerProperty:S}),g(ce("resolved")),Promise.reject(_)}},[j,X,m,o,g,f,i,c,l,U]),R=(0,e.useCallback)(async()=>{try{C.current("willCheckDraftRelations");const O=(0,y.IF)(`collection-types/${o}/${s}/actions/numberOfDraftRelations`);g(ce("draft-relation-check-pending"));const S=await F.get(O);return C.current("didCheckDraftRelations"),g(ce("resolved")),S.data.data}catch(O){return X(O),g(ce("resolved")),Promise.reject(O)}},[X,s,o,g,F]),Z=(0,e.useCallback)(async()=>{try{C.current("willPublishEntry");const O=(0,y.IF)(`collection-types/${o}/${s}/actions/publish`);g(ce("publish-pending"));const{data:S}=await U(O);return C.current("didPublishEntry"),g(et(j(S))),g(ce("resolved")),i({type:"success",message:{id:(0,y.OB)("success.record.publish")}}),Promise.resolve(S)}catch(O){return X(O),g(ce("resolved")),Promise.reject(O)}},[j,X,s,o,g,i,U]),V=(0,e.useCallback)(async(O,S)=>{const ne=(0,y.IF)(`collection-types/${o}/${s}`);try{C.current("willEditEntry",S),g(ce("submit-pending"));const{data:_}=await B(ne,O);return C.current("didEditEntry",{trackerProperty:S}),i({type:"success",message:{id:(0,y.OB)("success.record.save")}}),l.invalidateQueries(["relation"]),g(et(j(_))),g(ce("resolved")),Promise.resolve(_)}catch(_){return C.current("didNotEditEntry",{error:_,trackerProperty:S}),X(_),g(ce("resolved")),Promise.reject(_)}},[j,X,o,s,g,i,l,B]),K=(0,e.useCallback)(async()=>{const O=(0,y.IF)(`collection-types/${o}/${s}/actions/unpublish`);g(ce("unpublish-pending"));try{C.current("willUnpublishEntry");const{data:S}=await U(O);return C.current("didUnpublishEntry"),i({type:"success",message:{id:(0,y.OB)("success.record.unpublish")}}),g(et(j(S))),g(ce("resolved")),Promise.resolve(S)}catch(S){return g(ce("resolved")),X(S),Promise.reject(S)}},[j,X,s,o,g,i,U]);return r({componentsDataStructure:b,contentTypeDataStructure:E,data:v,isCreatingEntry:G,isLoadingForData:I,onDelete:q,onPost:W,onPublish:Z,onDraftRelationCheck:R,onPut:V,onUnpublish:K,status:T,redirectionLink:D})};or.defaultProps={id:null,origin:null},or.propTypes={allLayoutData:n().exact({components:n().object.isRequired,contentType:n().shape({apiID:n().string.isRequired,attributes:n().object.isRequired,info:n().object.isRequired,isDisplayed:n().bool.isRequired,kind:n().string.isRequired,layouts:n().object.isRequired,metadatas:n().object.isRequired,options:n().object.isRequired,pluginOptions:n().object,settings:n().object.isRequired,uid:n().string.isRequired}).isRequired}).isRequired,children:n().func.isRequired,id:n().string,origin:n().string,slug:n().string.isRequired};var ql=(0,e.memo)(or,Oe()),Nl=d(86834),Re=d.n(Nl),jl=d(99381),Qe=d.n(jl),Wl=d(89793),Lt=d.n(Wl),zl=d(3040),se=d.n(zl),sr=d(97889),Vl=d(56236),Ul=d.n(Vl),Hl=d(10268),To=d.n(Hl),ar=d(99526),Do=(t,r,o,s)=>{const a=t.slice();return a.splice(r,1),a.splice(o,0,s),a},Ql=d(77236),Gl=d.n(Ql),Kl=d(85973),Yl=d.n(Kl);const Xl=({browserState:t,serverState:r},o,s)=>{const a=r,l=t,i=(u,m)=>x()(u,["attributes",m,"type"],""),c=(u,m)=>x()(u,["attributes",...m],""),p=(u,m,f,g)=>Object.keys(u).reduce((b,E)=>{const v=g?`${g}.${E}`:E,I=i(f,E),T=x()(u,E),D=x()(m,E),w=c(f,[E,"component"]),k=c(f,[E,"repeatable"]);let C;switch(I){case"json":C=JSON.parse(T);break;case"time":{C=T,T&&T.split(":").length<3&&(C=`${T}:00`);break}case"media":c(f,[E,"multiple"])===!0?C=T?T.filter(M=>!(M instanceof File)):null:C=x()(T,0)instanceof File?null:x()(T,"id",null);break;case"component":k?C=T&&T.map((M,F)=>p(M,(D??[])[F],s[w],`${v}.${F}`)):C=T&&p(T,D,s[w],v);break;case"relation":{const M=yo(a,l)(v).join(".");let F=x()(a,M,[]);const B=T.reduce((A,G,$,Y)=>{const j=F.find(q=>q.id===G.id),X=Y[$+1];if(!j||j.__temp_key__!==G.__temp_key__){const q=X?{before:X.id}:{end:!0};return[...A,{id:G.id,position:q}]}return A},[]);C={disconnect:F.reduce((A,G)=>T.find($=>$.id===G.id)?A:[...A,{id:G.id}],[]),connect:B.reverse()};break}case"dynamiczone":C=T.map((M,F)=>p(M,(D??[])[F],s[M.__component],`${v}.${F}`));break;default:C=Jl(T,"id")}return b[E]=C,b},{});return p(t,r,o,"")},Jl=(t,r)=>Gl()(t)?t.map(o=>o[r]?o[r]:o):Yl()(t)?t[r]:t;var _l=Xl,ec=d(51355),tc=d.n(ec),nc=d(95919),rc=d.n(nc),oc=d(78746),ft=d.n(oc),pe=d(24346);function St(t){return["integer","biginteger","decimal","float","number"].includes(t)}pe.kM(pe.nK,"defined",function(){return this.test("defined",h.I0.required,t=>t!==void 0)}),pe.kM(pe.IX,"notEmptyMin",function(t){return this.test("notEmptyMin",h.I0.min,r=>Re()(r)?!0:r.length>=t)}),pe.kM(pe.Z_,"isInferior",function(t,r){return this.test("isInferior",t,function(o){return!o||Number.isNaN(ft()(o))?!0:ft()(r)>=ft()(o)})}),pe.kM(pe.Z_,"isSuperior",function(t,r){return this.test("isSuperior",t,function(o){return!o||Number.isNaN(ft()(o))?!0:ft()(o)>=ft()(r)})});const sc=t=>x()(t,["attributes"],{}),ir=(t,{components:r},o={isCreatingEntry:!0,isDraft:!0,isFromComponent:!1})=>{const s=sc(t);return pe.Ry().shape(Object.keys(s).reduce((a,l)=>{const i=s[l];if(i.type!=="relation"&&i.type!=="component"&&i.type!=="dynamiczone"){const c=ac(i.type,i,o);a[l]=c}if(i.type==="relation"&&(a[l]=["oneWay","oneToOne","manyToOne","oneToManyMorph","oneToOneMorph"].includes(i.relationType)?pe.Ry().nullable():pe.IX().nullable()),i.type==="component"){const c=ir(r[i.component],{components:r},{...o,isFromComponent:!0});if(i.repeatable===!0){const{min:u,max:m,required:f}=i;let g=pe.Vo(b=>{let E=pe.IX().of(c);return u?f?E=E.min(u,h.I0.min):f!==!0&&Re()(b)?E=E.nullable():E=E.min(u,h.I0.min):f&&!o.isDraft&&(E=E.min(1,h.I0.required)),m&&(E=E.max(m,h.I0.max)),E});return a[l]=g,a}const p=pe.Vo(u=>u!==void 0?i.required===!0&&!o.isDraft?c.defined():c.nullable():i.required===!0?pe.Ry().defined():pe.Ry().nullable());return a[l]=p,a}if(i.type==="dynamiczone"){let c=pe.IX().of(pe.Vo(({__component:m})=>ir(r[m],{components:r},{...o,isFromComponent:!0})));const{max:p,min:u}=i;u?i.required?c=c.test("min",h.I0.min,m=>o.isCreatingEntry?m&&m.length>=u:m===void 0?!0:m!==null&&m.length>=u).test("required",h.I0.required,m=>o.isCreatingEntry?m!==null||m!==void 0:m===void 0?!0:m!==null):c=c.notEmptyMin(u):i.required&&!o.isDraft&&(c=c.test("required",h.I0.required,m=>o.isCreatingEntry?m!==null||m!==void 0:m===void 0?!0:m!==null)),p&&(c=c.max(p,h.I0.max)),a[l]=c}return a},{}))},ac=(t,r,o)=>{let s=pe.nK();return["string","uid","text","richtext","email","password","enumeration"].includes(t)&&(s=pe.Z_()),t==="json"&&(s=pe.nK(h.I0.json).test("isJSON",h.I0.json,a=>{if(!a||!a.length)return!0;try{return JSON.parse(a),!0}catch{return!1}}).nullable().test("required",h.I0.required,a=>!(r.required&&(!a||!a.length)))),t==="email"&&(s=s.email(h.I0.email)),["number","integer","float","decimal"].includes(t)&&(s=pe.Rx().transform(a=>rc()(a)?void 0:a).typeError()),t==="biginteger"&&(s=pe.Z_().matches(/^-?\d*$/)),["date","datetime"].includes(t)&&(s=pe.hT()),Object.keys(r).forEach(a=>{const l=r[a];if(l||!tc()(l)&&Number.isInteger(Math.floor(l))||l===0)switch(a){case"required":{o.isDraft||(t==="password"&&o.isCreatingEntry&&(s=s.required(h.I0.required)),t!=="password"&&(o.isCreatingEntry?s=s.required(h.I0.required):s=s.test("required",h.I0.required,i=>i===void 0&&!o.isFromComponent?!0:St(t)?i===0?!0:!!i:t==="boolean"?i!=null:t==="date"||t==="datetime"?typeof i=="string"?!Re()(i):!Re()(i?.toString()):!Re()(i))));break}case"max":{t==="biginteger"?s=s.isInferior(h.I0.max,l):s=s.max(l,h.I0.max);break}case"maxLength":s=s.max(l,h.I0.maxLength);break;case"min":{t==="biginteger"?s=s.isSuperior(h.I0.min,l):s=s.min(l,h.I0.min);break}case"minLength":{o.isDraft||(s=s.min(l,h.I0.minLength));break}case"regex":s=s.matches(new RegExp(l),{message:h.I0.regex,excludeEmptyString:!r.required});break;case"lowercase":["text","textarea","email","string"].includes(t)&&(s=s.strict().lowercase());break;case"uppercase":["text","textarea","email","string"].includes(t)&&(s=s.strict().uppercase());break;case"positive":St(t)&&(s=s.positive());break;case"negative":St(t)&&(s=s.negative());break;default:s=s.nullable()}}),s};var Io=ir;const nn=(t,r=()=>!1,o=void 0)=>{const s=(a,l,{ignoreFalseyValues:i=!1,path:c=[],parent:p=l}={})=>Object.entries(l).reduce((u,[m,f])=>{if(i&&(u==null||u[m]===void 0||u[m]===null))return u;if(r(f,{path:[...c,m],parent:p})&&(u[m]=typeof o=="function"?o(u[m],{path:[...c,m],parent:u}):o),f.type==="component"){const g=t[f.component].attributes;!f.repeatable&&u[m]&&typeof u[m]=="object"?u[m]=s(u[m],g,{ignoreFalseyValues:i,path:[...c,m],parent:l[m]}):f.repeatable&&Array.isArray(u[m])&&(u[m]=u[m].map((b,E)=>s(b,g,{ignoreFalseyValues:i,path:[...c,m,E],parent:l[m]})))}else f.type==="dynamiczone"&&Array.isArray(u[m])&&(u[m]=u[m].map((g,b)=>{const E=t[g.__component].attributes;return s(g,E,{ignoreFalseyValues:i,path:[...c,m,b],parent:l[m]})}));return u},{...a});return s},ic={componentsDataStructure:{},contentTypeDataStructure:{},formErrors:{},initialData:{},modifiedData:null,shouldCheckErrors:!1,modifiedDZName:null,publishConfirmation:{show:!1,draftCount:0}};var lc=(t,r)=>(0,sr.ZP)(t,o=>{switch(r.type){case"ADD_NON_REPEATABLE_COMPONENT_TO_FIELD":{const{componentLayoutData:s,allComponents:a}=r,l={...t.componentsDataStructure[s.uid]},c=nn(a,p=>p.type==="relation",[])(l,s.attributes);se()(o,["modifiedData",...r.keys],c);break}case"ADD_COMPONENT_TO_DYNAMIC_ZONE":case"ADD_REPEATABLE_COMPONENT_TO_FIELD":{const{keys:s,allComponents:a,componentLayoutData:l,shouldCheckErrors:i}=r;i&&(o.shouldCheckErrors=!t.shouldCheckErrors),r.type==="ADD_COMPONENT_TO_DYNAMIC_ZONE"&&(o.modifiedDZName=s[0]);const c=x()(t,["modifiedData",...s],[]),p=r.type==="ADD_COMPONENT_TO_DYNAMIC_ZONE"?{...t.componentsDataStructure[l.uid],__component:l.uid,__temp_key__:(0,y.Uo)(c)+1}:{...t.componentsDataStructure[l.uid],__temp_key__:(0,y.Uo)(c)+1},m=nn(a,g=>g.type==="relation",[])(p,l.attributes),f=Array.isArray(c)?[...c,m]:[m];se()(o,["modifiedData",...s],f);break}case"LOAD_RELATION":{const{initialDataPath:s,modifiedDataPath:a,value:l}=r,i=x()(t,s),c=x()(t,a),p=i?l.filter(f=>!i.some(g=>g.id===f.id)):l,u=(0,ar.zJ)(null,c[0]?.__temp_key__,p.length),m=p.map((f,g)=>({...f,__temp_key__:u[g]}));se()(o,s,To()([...m,...i],"id")),se()(o,a,To()([...m,...c],"id"));break}case"CONNECT_RELATION":{const s=["modifiedData",...r.keys],{value:a,toOneRelation:l}=r;if(l)se()(o,s,[a]);else{const i=x()(t,s),[c]=(0,ar.zJ)(i.at(-1)?.__temp_key__,null,1),p=[...i,{...a,__temp_key__:c}];se()(o,s,p)}break}case"DISCONNECT_RELATION":{const s=["modifiedData",...r.keys],{id:a}=r,i=x()(t,[...s]).filter(c=>c.id!==a);se()(o,s,i);break}case"MOVE_COMPONENT_FIELD":case"REORDER_RELATION":{const{oldIndex:s,newIndex:a,keys:l}=r,i=["modifiedData",...l],c=x()(t,[...i]),p=c[s],u=[...c];if(r.type==="REORDER_RELATION"){const m=s>a?c[a-1]?.__temp_key__:c[a]?.__temp_key__,f=s>a?c[a]?.__temp_key__:c[a+1]?.__temp_key__,[g]=(0,ar.zJ)(m,f,1);u.splice(s,1),u.splice(a,0,{...p,__temp_key__:g})}else u.splice(s,1),u.splice(a,0,p);se()(o,i,u);break}case"INIT_FORM":{const{initialValues:s,components:a={},attributes:l={},setModifiedDataOnly:i}=r,c=Qe()(s),u=nn(a,g=>g.type==="relation",(g,{path:b})=>t.modifiedData?.id===c.id&&x()(t.modifiedData,b)?x()(t.modifiedData,b):[])(c,l),f=nn(a,g=>g.type==="dynamiczone"||g.type==="component"&&!g.repeatable,g=>Array.isArray(g)?g.map((b,E)=>({...b,__temp_key__:E})):{...g,__temp_key__:0})(u,l,{ignoreFalseyValues:!0});i||(o.initialData=f),o.modifiedData=f,o.formErrors={},o.modifiedDZName=null,o.shouldCheckErrors=!1;break}case"MOVE_COMPONENT_UP":case"MOVE_COMPONENT_DOWN":{const{currentIndex:s,dynamicZoneName:a,shouldCheckErrors:l}=r;l&&(o.shouldCheckErrors=!t.shouldCheckErrors);const i=t.modifiedData[a],c=r.type==="MOVE_COMPONENT_UP"?s-1:s+1,p=t.modifiedData[a][s],u=Do(i,s,c,p);se()(o,["modifiedData",r.dynamicZoneName],u);break}case"MOVE_FIELD":{const s=x()(t,["modifiedData",...r.keys],[]).slice(),a=x()(t,["modifiedData",...r.keys,r.dragIndex]),l=Do(s,r.dragIndex,r.overIndex,a);se()(o,["modifiedData",...r.keys],l);break}case"ON_CHANGE":{const[s]=r.keys;if(r.shouldSetInitialValue&&se()(o,["initialData",...r.keys],r.value),r.keys.length===2&&x()(t,["modifiedData",s])===null){se()(o,["modifiedData",s],{[r.keys[1]]:r.value});break}se()(o,["modifiedData",...r.keys],r.value);break}case"REMOVE_COMPONENT_FROM_DYNAMIC_ZONE":{r.shouldCheckErrors&&(o.shouldCheckErrors=!t.shouldCheckErrors),o.modifiedData[r.dynamicZoneName].splice(r.index,1);break}case"REMOVE_COMPONENT_FROM_FIELD":{const s=["modifiedData",...r.keys];se()(o,s,null);break}case"REMOVE_PASSWORD_FIELD":{Ul()(o,["modifiedData",...r.keys]);break}case"REMOVE_REPEATABLE_FIELD":{const s=r.keys.length-1,a=["modifiedData",...xt()(r.keys,s)];Object.keys(t.formErrors).length>0&&(o.shouldCheckErrors=!t.shouldCheckErrors);const i=x()(t,a).slice();i.splice(parseInt(r.keys[s],10),1),se()(o,a,i);break}case"SET_DEFAULT_DATA_STRUCTURES":{o.componentsDataStructure=r.componentsDataStructure,o.contentTypeDataStructure=r.contentTypeDataStructure;break}case"SET_FORM_ERRORS":{o.modifiedDZName=null,o.formErrors=r.errors;break}case"TRIGGER_FORM_VALIDATION":{Object.keys(t.formErrors).length>0&&(o.shouldCheckErrors=!t.shouldCheckErrors);break}case"SET_PUBLISH_CONFIRMATION":{o.publishConfirmation={...r.publishConfirmation};break}case"RESET_PUBLISH_CONFIRMATION":{o.publishConfirmation={...t.publishConfirmation,show:!1};break}default:return o}});const lr=({allLayoutData:t,allowedActions:{canRead:r,canUpdate:o},children:s,componentsDataStructure:a,contentTypeDataStructure:l,createActionAllowedFields:i,from:c,initialValues:p,isCreatingEntry:u,isLoadingForData:m,isSingleType:f,onPost:g,onPublish:b,onDraftRelationCheck:E,onPut:v,onUnpublish:I,readActionAllowedFields:T,redirectToPreviousPage:D,slug:w,status:k,updateActionAllowedFields:C})=>{const[M,F]=(0,e.useReducer)(lc,ic),{formErrors:B,initialData:U,modifiedData:A,modifiedDZName:G,shouldCheckErrors:$,publishConfirmation:Y}=M,{setModifiedDataOnly:j}=(0,J.v9)(rr),X=(0,J.I0)(),q=(0,h.lm)(),{lockApp:W,unlockApp:R}=(0,h.o1)(),Z=x()(t,["contentType"],{}),V=(0,e.useMemo)(()=>x()(Z,["options","draftAndPublish"],!1),[Z]),K=(0,e.useMemo)(()=>V&&!U.publishedAt,[V,U.publishedAt]),{trackUsage:O}=(0,h.rS)(),{formatMessage:S}=(0,H.Z)(),ne=(0,e.useRef)(O),_=(0,e.useMemo)(()=>m||u?!1:r===!1&&o===!1,[m,u,r,o]);(0,e.useEffect)(()=>{k==="resolved"?R():W()},[W,R,k]),(0,e.useEffect)(()=>{m||Ze()},[$]),(0,e.useEffect)(()=>{const oe=Object.keys(B);if(oe.length>0){const ee=oe[0],le=document.getElementById(ee);le&&le.focus()}},[B]),(0,e.useEffect)(()=>{_&&q({type:"info",message:{id:(0,y.OB)("permissions.not-allowed.update")}})},[_,q]),(0,e.useEffect)(()=>{F({type:"SET_DEFAULT_DATA_STRUCTURES",componentsDataStructure:a,contentTypeDataStructure:l})},[a,l]);const{components:ae}=t,z=(0,de.zH)(p);(0,e.useEffect)(()=>{p&&Z?.attributes&&!Lt()(z,p)&&(F({type:"INIT_FORM",initialValues:p,components:ae,attributes:Z.attributes,setModifiedDataOnly:j}),j&&X(Bl()))},[p,Z,ae,j,X,z]);const ie=(0,e.useCallback)(oe=>(ee,le,qe,lt=!1)=>{ne.current("didAddComponentToDynamicZone"),F({type:oe,keys:ee.split("."),componentLayoutData:le,allComponents:qe,shouldCheckErrors:lt})},[]),Te=ie("ADD_COMPONENT_TO_DYNAMIC_ZONE"),Ge=(0,e.useCallback)((oe,ee,le)=>{F({type:"ADD_NON_REPEATABLE_COMPONENT_TO_FIELD",keys:oe.split("."),componentLayoutData:ee,allComponents:le})},[]),Nt=(0,e.useCallback)(({name:oe,value:ee,toOneRelation:le})=>{F({type:"CONNECT_RELATION",keys:oe.split("."),value:ee,toOneRelation:le})},[]),jt=(0,e.useCallback)(({target:{initialDataPath:oe,modifiedDataPath:ee,value:le}})=>{F({type:"LOAD_RELATION",modifiedDataPath:ee,initialDataPath:oe,value:le})},[]),Wt=ie("ADD_REPEATABLE_COMPONENT_TO_FIELD"),Le=(0,e.useMemo)(()=>{const oe={isCreatingEntry:u,isDraft:K,isFromComponent:!1};return Io(Z,{components:t.components||{}},oe)},[t.components,Z,u,K]),Ze=(0,e.useCallback)(async(oe={})=>{let ee={};const le=Qe()(A);Re()(le)||se()(le,oe.path,oe.value);try{await Le.validate(le,{abortEarly:!1})}catch(qe){ee=(0,h.CJ)(qe),G&&(ee=Object.keys(ee).reduce((lt,jr)=>(jr.split(".")[0]!==G&&(lt[jr]=ee[jr]),lt),{}))}F({type:"SET_FORM_ERRORS",errors:ee})},[G,A,Le]),zt=(0,e.useCallback)(({target:{name:oe,value:ee,type:le}},qe=!1)=>{let lt=ee;if(["text","textarea","string","email","uid","select","select-one","number"].includes(le)&&!ee&&ee!==0&&(lt=null),le==="password"&&!ee){F({type:"REMOVE_PASSWORD_FIELD",keys:oe.split(".")});return}F({type:"ON_CHANGE",keys:oe.split("."),value:lt,shouldSetInitialValue:qe})},[]),tt=(0,e.useCallback)((oe,ee)=>_l({browserState:oe,serverState:ee},Z,t.components),[t.components,Z]),re=(0,e.useMemo)(()=>V?K?{status:"draft"}:{}:{},[V,K]),ge=(0,e.useCallback)(async oe=>(oe.preventDefault(),F({type:"RESET_PUBLISH_CONFIRMATION"})),[]),Be=(0,e.useCallback)(async oe=>{oe.preventDefault();let ee={};try{await Le.validate(A,{abortEarly:!1})}catch(le){ee=(0,h.CJ)(le)}try{if(Re()(ee)){const le=tt(A,U);u?await g(le,re):await v(le,re)}}catch(le){ee={...ee,...(0,h.nn)(le,{getTrad:y.OB})}}F({type:"SET_FORM_ERRORS",errors:ee})},[tt,u,A,U,g,v,re,Le]),Nr=(0,e.useCallback)(async()=>{const oe=Io(Z,{components:x()(t,"components",{})},{isCreatingEntry:u,isDraft:!1,isFromComponent:!1}),ee=await E();if(!Y.show&&ee>0){F({type:"SET_PUBLISH_CONFIRMATION",publishConfirmation:{show:!0,draftCount:ee}});return}F({type:"RESET_PUBLISH_CONFIRMATION"});let le={};try{await oe.validate(A,{abortEarly:!1})}catch(qe){le=(0,h.CJ)(qe)}try{Re()(le)&&await b()}catch(qe){le={...le,...(0,h.nn)(qe,{getTrad:y.OB})}}F({type:"SET_FORM_ERRORS",errors:le})},[t,Z,u,A,Y.show,b,E]),nt=(0,e.useCallback)(oe=>{const ee=Object.keys(B).some(qe=>qe.split(".")[0]===oe);return!Re()(B)&&ee},[B]),bm=(0,e.useCallback)((oe,ee)=>{ne.current("changeComponentsOrder"),F({type:"MOVE_COMPONENT_DOWN",dynamicZoneName:oe,currentIndex:ee,shouldCheckErrors:nt(oe)})},[nt]),vm=(0,e.useCallback)((oe,ee)=>{ne.current("changeComponentsOrder"),F({type:"MOVE_COMPONENT_UP",dynamicZoneName:oe,currentIndex:ee,shouldCheckErrors:nt(oe)})},[nt]),Cm=(0,e.useCallback)(({name:oe,newIndex:ee,currentIndex:le})=>{F({type:"MOVE_COMPONENT_FIELD",keys:oe.split("."),newIndex:ee,oldIndex:le})},[]),Rm=(0,e.useCallback)(({name:oe,id:ee})=>{F({type:"DISCONNECT_RELATION",keys:oe.split("."),id:ee})},[]),Mm=(0,e.useCallback)(({name:oe,oldIndex:ee,newIndex:le})=>{F({type:"REORDER_RELATION",keys:oe.split("."),oldIndex:ee,newIndex:le})},[]),Tm=(0,e.useCallback)((oe,ee)=>{ne.current("removeComponentFromDynamicZone"),F({type:"REMOVE_COMPONENT_FROM_DYNAMIC_ZONE",dynamicZoneName:oe,index:ee,shouldCheckErrors:nt(oe)})},[nt]),Dm=(0,e.useCallback)((oe,ee)=>{F({type:"REMOVE_COMPONENT_FROM_FIELD",keys:oe.split("."),componentUid:ee})},[]),Im=(0,e.useCallback)((oe,ee)=>{F({type:"REMOVE_REPEATABLE_FIELD",keys:oe.split("."),componentUid:ee})},[]),km=(0,e.useCallback)(()=>{F({type:"TRIGGER_FORM_VALIDATION"})},[]);return _?e.createElement(te.l_,{to:c}):A?e.createElement(h.W1.Provider,{value:{addComponentToDynamicZone:Te,addNonRepeatableComponentToField:Ge,addRepeatableComponentToField:Wt,allLayoutData:t,checkFormErrors:Ze,createActionAllowedFields:i,formErrors:B,hasDraftAndPublish:V,initialData:U,isCreatingEntry:u,isSingleType:f,shouldNotRunValidations:K,status:k,layout:Z,modifiedData:A,moveComponentField:Cm,moveComponentDown:bm,moveComponentUp:vm,onChange:zt,onPublish:Nr,onUnpublish:I,readActionAllowedFields:T,redirectToPreviousPage:D,removeComponentFromDynamicZone:Tm,removeComponentFromField:Dm,removeRepeatableField:Im,relationConnect:Nt,relationDisconnect:Rm,relationLoad:jt,relationReorder:Mm,slug:w,triggerFormValidation:km,updateActionAllowedFields:C,onPublishPromptDismissal:ge,publishConfirmation:Y}},m||!u&&!U.id?e.createElement(Ce.o,{"aria-busy":"true"},e.createElement(h.dO,null)):e.createElement(e.Fragment,null,e.createElement(te.NL,{when:!Lt()(A,U),message:S({id:"global.prompt.unsaved"})}),e.createElement("form",{noValidate:!0,onSubmit:Be},s))):null};lr.defaultProps={from:"/",initialValues:null,redirectToPreviousPage(){}},lr.propTypes={allLayoutData:n().object.isRequired,allowedActions:n().object.isRequired,children:n().node.isRequired,componentsDataStructure:n().object.isRequired,contentTypeDataStructure:n().object.isRequired,createActionAllowedFields:n().array.isRequired,from:n().string,initialValues:n().object,isCreatingEntry:n().bool.isRequired,isLoadingForData:n().bool.isRequired,isSingleType:n().bool.isRequired,onPost:n().func.isRequired,onPublish:n().func.isRequired,onDraftRelationCheck:n().func.isRequired,onPut:n().func.isRequired,onUnpublish:n().func.isRequired,readActionAllowedFields:n().array.isRequired,redirectToPreviousPage:n().func,slug:n().string.isRequired,status:n().string.isRequired,updateActionAllowedFields:n().array.isRequired};var cc=lr,at=t=>(0,y.IF)(`single-types/${t}`),rn=d(33348),dc=t=>Object.values(t||{}).reduce((r,o)=>Object.assign(r,o),{}),ko=(t={})=>{const{plugins:r,_q:o,...s}={...t,...dc(t.plugins)};return o&&se()(s,"_q",encodeURIComponent(o)),`${(0,rn.stringify)(s,{encode:!1,addQueryPrefix:!0})}`};const Oo=({allLayoutData:t,children:r,slug:o})=>{const s=(0,ot.useQueryClient)(),{trackUsage:a}=(0,h.rS)(),{push:l}=(0,te.k6)(),{setCurrentStep:i}=(0,h.c1)(),c=(0,e.useRef)(a),[p,u]=(0,e.useState)(!0),[{query:m,rawQuery:f}]=(0,h.Kx)(),g=ko(m),b=(0,h.lm)(),E=(0,J.I0)(),{formatAPIError:v}=(0,h.So)(y.OB),I=(0,h.kY)(),{post:T,put:D,del:w}=I,{componentsDataStructure:k,contentTypeDataStructure:C,data:M,isLoading:F,status:B}=(0,J.v9)(rr),U=(0,e.useCallback)(W=>{const R=(0,y.kc)(W,t.contentType,t.components);return(0,h.dU)(R,t.contentType,t.components)},[t]);(0,e.useEffect)(()=>()=>{E(Ro())},[E]),(0,e.useEffect)(()=>{const W=Object.keys(t.components).reduce((V,K)=>{const O=(0,y.Di)(x()(t,["components",K,"attributes"],{}),t.components);return V[K]=(0,h.dU)(O,t.components[K],t.components),V},{}),R=(0,y.Di)(t.contentType.attributes,t.components),Z=(0,h.dU)(R,t.contentType,t.components);E(Mo(W,Z))},[t,E]),(0,e.useEffect)(()=>{const R=ze.Z.CancelToken.source();return(async V=>{E(tn()),u(!0);try{const{data:K}=await I.get(at(`${o}${g}`),{cancelToken:V.token});E(tr(U(K))),u(!1)}catch(K){if(ze.Z.isCancel(K))return;const O=x()(K,"response.status",null);O===404&&E(nr(f,!0)),O===403&&(b({type:"info",message:{id:(0,y.OB)("permissions.not-allowed.update")}}),l("/"))}})(R),()=>R.cancel("Operation canceled by the user.")},[I,U,l,o,E,g,f,b]);const A=(0,e.useCallback)(W=>{b({type:"warning",message:v(W)})},[b,v]),G=(0,e.useCallback)(async W=>{try{c.current("willDeleteEntry",W);const{data:R}=await w(at(`${o}${g}`));return b({type:"success",message:{id:(0,y.OB)("success.record.delete")}}),c.current("didDeleteEntry",W),u(!0),E(nr(f,!0)),Promise.resolve(R)}catch(R){return c.current("didNotDeleteEntry",{error:R,...W}),A(R),Promise.reject(R)}},[w,o,A,b,g,E,f]),$=(0,e.useCallback)(async(W,R)=>{const Z=at(`${o}${f}`);try{E(ce("submit-pending"));const{data:V}=await D(Z,W);return c.current("didCreateEntry",R),b({type:"success",message:{id:(0,y.OB)("success.record.save")}}),i("contentManager.success"),s.invalidateQueries(["relation"]),E(et(U(V))),u(!1),E(ce("resolved")),Promise.resolve(V)}catch(V){return c.current("didNotCreateEntry",{error:V,trackerProperty:R}),A(V),E(ce("resolved")),Promise.reject(V)}},[D,U,A,o,E,f,b,i,s]),Y=(0,e.useCallback)(async()=>{try{c.current("willCheckDraftRelations");const W=at(`${o}/actions/numberOfDraftRelations`);E(ce("draft-relation-check-pending"));const R=await I.get(W);return c.current("didCheckDraftRelations"),E(ce("resolved")),R.data.data}catch(W){return A(W),E(ce("resolved")),Promise.reject(W)}},[I,A,o,E]),j=(0,e.useCallback)(async()=>{try{c.current("willPublishEntry");const W=at(`${o}/actions/publish${g}`);E(ce("publish-pending"));const{data:R}=await T(W);return c.current("didPublishEntry"),b({type:"success",message:{id:(0,y.OB)("success.record.publish")}}),E(et(U(R))),E(ce("resolved")),Promise.resolve(R)}catch(W){return A(W),E(ce("resolved")),Promise.reject(W)}},[T,U,A,o,g,E,b]),X=(0,e.useCallback)(async(W,R)=>{const Z=at(`${o}${f}`);try{c.current("willEditEntry",R),E(ce("submit-pending"));const{data:V}=await D(Z,W);return b({type:"success",message:{id:(0,y.OB)("success.record.save")}}),c.current("didEditEntry",{trackerProperty:R}),s.invalidateQueries(["relation"]),E(et(U(V))),E(ce("resolved")),Promise.resolve(V)}catch(V){return A(V),c.current("didNotEditEntry",{error:V,trackerProperty:R}),E(ce("resolved")),Promise.reject(V)}},[D,U,A,o,E,f,b,s]),q=(0,e.useCallback)(async()=>{const W=at(`${o}/actions/unpublish${g}`);E(ce("unpublish-pending"));try{c.current("willUnpublishEntry");const{data:R}=await T(W);c.current("didUnpublishEntry"),b({type:"success",message:{id:(0,y.OB)("success.record.unpublish")}}),E(et(U(R))),E(ce("resolved"))}catch(R){E(ce("resolved")),A(R)}},[T,U,b,A,o,E,g]);return r({componentsDataStructure:k,contentTypeDataStructure:C,data:M,isCreatingEntry:p,isLoadingForData:F,onDelete:G,onPost:$,onDraftRelationCheck:Y,onPublish:j,onPut:X,onUnpublish:q,redirectionLink:"/",status:B})};Oo.propTypes={allLayoutData:n().shape({components:n().object.isRequired,contentType:n().object.isRequired}).isRequired,children:n().func.isRequired,slug:n().string.isRequired};var uc=(0,e.memo)(Oo),mc=d(56243);function pc(t,r){return o=>{const s=r();return e.createElement(t,{...o,...s})}}var gc=pc;function fc(){const{initialData:t,hasDraftAndPublish:r}=(0,h.Wq)(),o=t.publishedAt!==void 0&&t.publishedAt!==null;return{hasDraftAndPublish:r,isPublished:o}}var hc=fc;const yc=(0,N.ZP)(mc.Z)`
|
|
890
|
-
width: ${(0,h.Q1)(6)};
|
|
891
|
-
height: ${(0,h.Q1)(6)};
|
|
892
|
-
* {
|
|
893
|
-
fill: ${({theme:t,$bulletColor:r})=>t.colors[r]};
|
|
894
|
-
}
|
|
895
|
-
`,xo=({hasDraftAndPublish:t,isPublished:r})=>{const{formatMessage:o}=(0,H.Z)();if(!t)return null;const s={draft:{textColor:"secondary700",bulletColor:"secondary600",box:{background:"secondary100",borderColor:"secondary200"}},published:{textColor:"success700",bulletColor:"success600",box:{background:"success100",borderColor:"success200"}}},a=r?s.published:s.draft;return e.createElement(L.x,{hasRadius:!0,as:"aside",paddingTop:4,paddingBottom:4,paddingLeft:5,paddingRight:5,...a.box},e.createElement(L.x,{as:P.k},e.createElement(yc,{$bulletColor:a.bulletColor}),e.createElement(L.x,{paddingLeft:3},e.createElement(Q.Z,{textColor:a.textColor},o({id:(0,y.OB)("containers.Edit.information.editing"),defaultMessage:"Editing"}),"\xA0"),e.createElement(Q.Z,{fontWeight:"bold",textColor:a.textColor},r&&o({id:(0,y.OB)("containers.Edit.information.publishedVersion"),defaultMessage:"published version"}),!r&&o({id:(0,y.OB)("containers.Edit.information.draftVersion"),defaultMessage:"draft version"})))))};xo.propTypes={hasDraftAndPublish:n().bool.isRequired,isPublished:n().bool.isRequired};var Ec=gc(xo,hc),ht=d(66456),on=d(29439),sn=d(22342),an=d(96166),ln=d(88693);function bc(t,r){return o=>{const s=r();return e.createElement(t,{...o,...s})}}var vc=bc;function Cc(){const{initialData:t,isCreatingEntry:r,isSingleType:o,status:s,layout:a,hasDraftAndPublish:l,modifiedData:i,onPublish:c,onUnpublish:p,publishConfirmation:u,onPublishPromptDismissal:m}=(0,h.Wq)();return{initialData:t,isCreatingEntry:r,isSingleType:o,status:s,layout:a,hasDraftAndPublish:l,modifiedData:i,onPublish:c,onUnpublish:p,publishConfirmation:u,onPublishPromptDismissal:m}}var Rc=Cc;const Po=(0,N.ZP)(P.k)`
|
|
896
|
-
text-align: center;
|
|
897
|
-
`,wo=({allowedActions:{canUpdate:t,canCreate:r,canPublish:o},initialData:s,isCreatingEntry:a,isSingleType:l,hasDraftAndPublish:i,layout:c,modifiedData:p,onPublish:u,onUnpublish:m,status:f,publishConfirmation:{show:g,draftCount:b},onPublishPromptDismissal:E})=>{const{goBack:v}=(0,te.k6)(),[I,T]=(0,e.useState)(!1),{formatMessage:D}=(0,H.Z)(),w=x()(c,["settings","mainField"],"id"),k=x()(c,["info","displayName"],"NOT FOUND"),C=!Lt()(s,p)||a&&!Re()(p);let F=D({id:(0,y.OB)("containers.Edit.pluginHeader.title.new"),defaultMessage:"Create an entry"});!a&&!l&&(F=s[w]||k),l&&(F=k);let B=null;if(a&&r&&(B=e.createElement(P.k,{gap:2},i&&e.createElement(me.z,{disabled:!0,startIcon:e.createElement(ht.Z,null),variant:"secondary"},D({id:"app.utils.publish",defaultMessage:"Publish"})),e.createElement(me.z,{disabled:!C,loading:f==="submit-pending",type:"submit"},D({id:(0,y.OB)("containers.Edit.submit"),defaultMessage:"Save"})))),!a&&t){const $=i&&o,Y=!Re()(s.publishedAt),j=Y?f==="unpublish-pending":f==="publish-pending",X=Y?{id:"app.utils.unpublish",defaultMessage:"Unpublish"}:{id:"app.utils.publish",defaultMessage:"Publish"},q=Y?()=>T(!0):()=>u();B=e.createElement(P.k,null,$&&e.createElement(me.z,{disabled:C,loading:j,onClick:q,startIcon:e.createElement(ht.Z,null),variant:"secondary"},D(X)),e.createElement(L.x,{paddingLeft:$?2:0},e.createElement(me.z,{disabled:!C,loading:f==="submit-pending",type:"submit"},D({id:(0,y.OB)("containers.Edit.submit"),defaultMessage:"Save"}))))}const U=()=>T($=>!$),A=()=>{U(),m()},G=`${D({id:(0,y.OB)("api.id"),defaultMessage:"API ID "})} : ${c.apiID}`;return e.createElement(e.Fragment,null,e.createElement(fe.T,{title:F.toString(),primaryAction:B,subtitle:G,navigationAction:e.createElement(h.rU,{startIcon:e.createElement(on.Z,null),onClick:$=>{$.preventDefault(),v()},to:"/"},D({id:"global.back",defaultMessage:"Back"}))}),e.createElement(sn.V,{onClose:U,title:"Confirmation",labelledBy:"confirmation",describedBy:"confirm-description",isOpen:I},e.createElement(an.a,{icon:e.createElement(Pt.Z,null)},e.createElement(P.k,{direction:"column",alignItems:"stretch",gap:2},e.createElement(P.k,{justifyContent:"center",style:{textAlign:"center"}},e.createElement(Q.Z,{id:"confirm-description"},D({id:(0,y.OB)("popUpWarning.warning.unpublish"),defaultMessage:"Unpublish this content will automatically change it to a draft."},{br:()=>e.createElement("br",null)}))),e.createElement(P.k,{justifyContent:"center",style:{textAlign:"center"}},e.createElement(Q.Z,{id:"confirm-description"},D({id:(0,y.OB)("popUpWarning.warning.unpublish-question"),defaultMessage:"Are you sure you want to unpublish it?"}))))),e.createElement(ln.c,{startAction:e.createElement(me.z,{onClick:U,variant:"tertiary"},D({id:"components.popUpWarning.button.cancel",defaultMessage:"Cancel"})),endAction:e.createElement(me.z,{variant:"danger-light",onClick:A},D({id:"components.popUpWarning.button.confirm",defaultMessage:"Confirm"}))})),e.createElement(sn.V,{onClose:E,title:D({id:(0,y.OB)("popUpWarning.warning.has-draft-relations.title"),defaultMessage:"Confirmation"}),labelledBy:"confirmation",describedBy:"confirm-description",isOpen:g},e.createElement(an.a,{icon:e.createElement(Pt.Z,null)},e.createElement(P.k,{direction:"column",alignItems:"stretch",gap:2},e.createElement(Po,{justifyContent:"center"},e.createElement(Q.Z,{id:"confirm-description"},b,D({id:(0,y.OB)("popUpwarning.warning.has-draft-relations.message"),defaultMessage:"<b>{count, plural, one { relation is} other { relations are}}</b> not published yet and might lead to unexpected behavior."},{b:$=>e.createElement(Q.Z,{fontWeight:"bold"},$),count:b}))),e.createElement(Po,{justifyContent:"center"},e.createElement(Q.Z,{id:"confirm-description"},D({id:(0,y.OB)("popUpWarning.warning.publish-question"),defaultMessage:"Do you still want to publish?"}))))),e.createElement(ln.c,{startAction:e.createElement(me.z,{onClick:E,variant:"tertiary"},D({id:"components.popUpWarning.button.cancel",defaultMessage:"Cancel"})),endAction:e.createElement(me.z,{variant:"success",onClick:u},D({id:(0,y.OB)("popUpwarning.warning.has-draft-relations.button-confirm"),defaultMessage:"Publish"}))})))};wo.propTypes={allowedActions:n().shape({canUpdate:n().bool.isRequired,canCreate:n().bool.isRequired,canPublish:n().bool.isRequired}).isRequired,initialData:n().object.isRequired,isCreatingEntry:n().bool.isRequired,isSingleType:n().bool.isRequired,status:n().string.isRequired,layout:n().object.isRequired,hasDraftAndPublish:n().bool.isRequired,modifiedData:n().object.isRequired,onPublish:n().func.isRequired,onUnpublish:n().func.isRequired,publishConfirmation:n().shape({show:n().bool.isRequired,draftCount:n().number.isRequired}).isRequired,onPublishPromptDismissal:n().func.isRequired};const Mc=(0,e.memo)(wo,Oe());var Tc=vc(Mc,Rc),Dc=t=>{if(!t.layouts)return[];const r=t.layouts.edit,o=t.attributes,s=i=>x()(o,[i,"type"],"");let a=0;const l=[];return r.forEach(i=>{const c=i.some(({name:p})=>s(p)==="dynamiczone");l[a]||(l[a]=[]),c?(a=a===0&&Re()(l[0])?0:a+1,l[a]||(l[a]=[]),l[a].push(i),a+=1):l[a].push(i)}),l.filter(i=>i.length>0)},Ic=d(91815),kc=d.n(Ic),Oc=d(3704),Fo=d.n(Oc),xc=(t,r)=>{const o=s=>{const a=(0,h.ZT)(t,[{action:`plugin::content-manager.explorer.${s}`,subject:r}]);return kc()(Fo()(a,"properties.fields"))};return{createActionAllowedFields:o("create"),readActionAllowedFields:o("read"),updateActionAllowedFields:o("update")}},Pc=t=>{if(!t)return[];const o=[...t.contentType.layouts.edit,...Object.values(t.components).flatMap(a=>a.layouts.edit)].flat().filter(a=>a.fieldSchema.customField).map(a=>a.fieldSchema.customField);return[...new Set(o)]};function wc(t,r){return o=>{const s=r();return e.createElement(t,{...o,...s})}}var Fc=wc;function Lc(){const{hasDraftAndPublish:t,modifiedData:r}=(0,h.Wq)();let o={};return t&&(o=Re()(r.publishedAt)?{status:"draft"}:{status:"published"}),{hasDraftAndPublish:t,trackerProperty:o}}var Sc=Lc;const Lo=({onDelete:t,trackerProperty:r})=>{const[o,s]=(0,e.useState)(!1),[a,l]=(0,e.useState)(!1),{formatMessage:i}=(0,H.Z)(),{formatAPIError:c}=(0,h.So)(y.OB),p=(0,h.lm)(),u=()=>s(f=>!f),m=async()=>{try{l(!0),await t(r),l(!1),u()}catch(f){l(!1),u(),p({type:"warning",message:c(f)})}};return e.createElement(e.Fragment,null,e.createElement(me.z,{onClick:u,size:"S",startIcon:e.createElement(He.Z,null),variant:"danger-light"},i({id:(0,y.OB)("containers.Edit.delete-entry"),defaultMessage:"Delete this entry"})),e.createElement(h.QH,{isConfirmButtonLoading:a,isOpen:o,onConfirm:m,onToggleDialog:u}))};Lo.propTypes={onDelete:n().func.isRequired,trackerProperty:n().object.isRequired};const Ac=(0,e.memo)(Lo,Oe());var $c=Fc(Ac,Sc);const cr=({columns:t,customFieldInputs:r})=>e.createElement(De.r,{gap:4},t.map(({fieldSchema:o,labelAction:s,metadatas:a,name:l,size:i,queryInfos:c})=>{if(o.type==="component"){const{component:u,max:m,min:f,repeatable:g=!1,required:b=!1}=o;return e.createElement(ue.P,{col:i,s:12,xs:12,key:u},e.createElement(Xt,{componentUid:u,labelAction:s,isRepeatable:g,intlLabel:{id:a.label,defaultMessage:a.label},max:m,min:f,name:l,required:b}))}return e.createElement(ue.P,{col:i,key:l,s:12,xs:12},e.createElement(Nn,{size:i,fieldSchema:o,keys:l,labelAction:s,metadatas:a,queryInfos:c,customFieldInputs:r}))}));cr.defaultProps={customFieldInputs:{}},cr.propTypes={columns:n().array.isRequired,customFieldInputs:n().object};var Zc=cr,dr=d(98178);const ur=t=>t["content-manager_editViewLayoutManager"].currentLayout,Bc=(0,dr.P1)(ur,t=>Dc(t?.contentType??{})),qc=(0,dr.P1)(ur,t=>Pc(t)),Nc=(()=>window&&window.strapi&&window.strapi.isEE?d(28243).Z:d(73710).Z)(),So=ke.Z.contentManager,jc=[{action:"plugin::content-type-builder.read",subject:null}],mr=t=>{let{allowedActions:r,isSingleType:o,goBack:s,slug:a,id:l,origin:i,userPermissions:c}=t;const{trackUsage:p}=(0,h.rS)(),{formatMessage:u}=(0,H.Z)(),{layout:m,formattedContentTypeLayout:f,customFieldUids:g}=(0,J.v9)(M=>({layout:ur(M),formattedContentTypeLayout:Bc(M),customFieldUids:qc(M)})),{isLazyLoading:b,lazyComponentStore:E}=jn(g),{createActionAllowedFields:v,readActionAllowedFields:I,updateActionAllowedFields:T}=xc(c,a),D=o?So.singleTypesConfigurations:So.collectionTypesConfigurations,w=`/content-manager/${o?"singleType":"collectionType"}/${a}/configurations/edit`,k=o?uc:ql,C=M=>M.every(F=>F.every(B=>B.fieldSchema.type==="dynamiczone"));return b?e.createElement(h.dO,null):e.createElement(k,{allLayoutData:m,slug:a,id:l,origin:i},M=>{let{componentsDataStructure:F,contentTypeDataStructure:B,data:U,isCreatingEntry:A,isLoadingForData:G,onDelete:$,onPost:Y,onPublish:j,onDraftRelationCheck:X,onPut:q,onUnpublish:W,redirectionLink:R,status:Z}=M;return e.createElement(cc,{allowedActions:r,allLayoutData:m,createActionAllowedFields:v,componentsDataStructure:F,contentTypeDataStructure:B,from:R,initialValues:U,isCreatingEntry:A,isLoadingForData:G,isSingleType:o,onPost:Y,onPublish:j,onDraftRelationCheck:X,onPut:q,onUnpublish:W,readActionAllowedFields:I,redirectToPreviousPage:s,slug:a,status:Z,updateActionAllowedFields:T},e.createElement(Ce.o,{"aria-busy":Z!=="resolved"},e.createElement(Tc,{allowedActions:r}),e.createElement($e.D,null,e.createElement(De.r,{gap:4},e.createElement(ue.P,{col:9,s:12},e.createElement(P.k,{direction:"column",alignItems:"stretch",gap:6},f.map((V,K)=>{if(C(V)){const{0:{0:{name:O,fieldSchema:S,metadatas:ne,labelAction:_}}}=V;return e.createElement(L.x,{key:K},e.createElement(De.r,{gap:4},e.createElement(ue.P,{col:12,s:12,xs:12},e.createElement(Zl,{name:O,fieldSchema:S,labelAction:_,metadatas:ne}))))}return e.createElement(L.x,{key:K,hasRadius:!0,background:"neutral0",shadow:"tableShadow",paddingLeft:6,paddingRight:6,paddingTop:6,paddingBottom:6,borderColor:"neutral150"},e.createElement(P.k,{direction:"column",alignItems:"stretch",gap:6},V.map((O,S)=>e.createElement(Zc,{columns:O,customFieldInputs:E,key:S}))))}))),e.createElement(ue.P,{col:3,s:12},e.createElement(P.k,{direction:"column",alignItems:"stretch",gap:2},e.createElement(Ec,null),e.createElement(L.x,{as:"aside","aria-labelledby":"additional-information",background:"neutral0",borderColor:"neutral150",hasRadius:!0,paddingBottom:4,paddingLeft:4,paddingRight:4,paddingTop:6,shadow:"tableShadow"},e.createElement(Nc,null),e.createElement(Ht,{area:"contentManager.editView.informations"})),e.createElement(L.x,{as:"aside","aria-labelledby":"links"},e.createElement(P.k,{direction:"column",alignItems:"stretch",gap:2},e.createElement(Ht,{area:"contentManager.editView.right-links",slug:a}),a!=="strapi::administrator"&&e.createElement(h.jW,{permissions:jc},e.createElement(h.Qj,{onClick:()=>{p("willEditEditLayout")},size:"S",startIcon:e.createElement(je.Z,null),style:{width:"100%"},to:`/plugins/content-type-builder/content-types/${a}`,variant:"secondary"},u({id:(0,y.OB)("link-to-ctb"),defaultMessage:"Edit the model"}))),e.createElement(h.jW,{permissions:D},e.createElement(h.Qj,{size:"S",startIcon:e.createElement(Ue.Z,null),style:{width:"100%"},to:w,variant:"secondary"},u({id:"app.links.configure-view",defaultMessage:"Configure the view"}))),r.canDelete&&!A&&e.createElement($c,{onDelete:$})))))))))})};mr.defaultProps={id:null,isSingleType:!1,origin:null,userPermissions:[]},mr.propTypes={allowedActions:n().shape({canRead:n().bool.isRequired,canUpdate:n().bool.isRequired,canCreate:n().bool.isRequired,canDelete:n().bool.isRequired}).isRequired,id:n().string,isSingleType:n().bool,goBack:n().func.isRequired,origin:n().string,slug:n().string.isRequired,userPermissions:n().array};var Wc=(0,e.memo)(mr);const pr=t=>{const r=(0,e.useMemo)(()=>(0,y.TA)(t.slug),[t.slug]),{isLoading:o,allowedActions:s}=(0,h.ss)(r,t.userPermissions);return o?e.createElement(h.dO,null):e.createElement(Wc,{...t,allowedActions:s})};pr.defaultProps={permissions:[]},pr.propTypes={permissions:n().array,slug:n().string.isRequired,userPermissions:n().array.isRequired};var zc=(0,e.memo)(pr,Oe());const Ao=({layout:t,...r})=>{const o=(0,J.v9)(ut.Z),s=(0,J.I0)(),[{query:a}]=(0,h.Kx)(),{runHookWaterfall:l}=(0,h.j1)(),i=(0,de.r5)(a,r.slug,"editView");return(0,e.useEffect)(()=>{const c=l(Ae.Eo,{layout:t,query:a});return s(Tt(c.layout,a)),()=>{s(Mt())}},[t,s,a,l]),!o||!i?e.createElement(h.dO,null):e.createElement(zc,{...r,userPermissions:i})};Ao.propTypes={layout:n().shape({components:n().object.isRequired,contentType:n().shape({uid:n().string.isRequired,settings:n().object.isRequired,metadatas:n().object.isRequired,options:n().object.isRequired,attributes:n().object.isRequired}).isRequired}).isRequired};var cn=Ao,Vc=d(23940),At=d.n(Vc),$o=d(9026);const gr=t=>t.reduce((r,o)=>r+o.size,0),Uc=t=>t.reduce((r,o,s)=>{const a={rowId:s,rowContent:o};return r.concat(a)},[]),yt=t=>t.reduce((r,o)=>{let s=[];const a=o.rowContent.reduce((c,p)=>{const u=gr(c);return p.name==="_TEMP_"||(u+p.size<=12?c.push(p):s.push(p)),c},[]),l=r.length===0?0:Math.max.apply(Math,r.map(c=>c.rowId))+1,i=gr(a);if(i<12&&a.push({name:"_TEMP_",size:12-i}),r.push({rowId:l,rowContent:a}),s.length>0){const c=gr(s);c<12&&s.push({name:"_TEMP_",size:12-c}),r.push({rowId:l+1,rowContent:s}),s=[]}return r},[]).filter(r=>r.rowContent.length>0).filter(r=>r.rowContent.length===1?r.rowContent[0].name!=="_TEMP_":!0),Hc=t=>t.reduce((r,o)=>{const s=o.rowContent.filter(a=>a.name!=="_TEMP_");return r.concat([s])},[]),Qc=(t,r=[])=>r.reduce((o,{rowContent:s})=>{const a=s.find(l=>l.name===t)?.size??null;return a&&(o=a),o},null),Gc=(t,r,o=[])=>o.map(s=>(s.rowContent=s.rowContent.map(a=>a.name===t?{...a,size:r}:a),s)),Zo=6,fr={fieldForm:{},componentLayouts:{},metaToEdit:"",initialData:{},metaForm:{},modifiedData:{}};var Kc=(t=fr,r)=>(0,sr.ZP)(t,o=>{const s=["modifiedData","layouts","edit"];switch(r.type){case"MOVE_ROW":{const a=x()(t,s,[]),{fromIndex:l,toIndex:i}=r;se()(o,s,(0,y.W3)(a,l,i));break}case"ON_ADD_FIELD":{const a=Qe()(t),l=x()(a,["modifiedData","attributes",r.name],{}),i=r.fieldSizes[l?.customField]?.default??r.fieldSizes[l?.type]?.default??Zo,c=x()(a,s,[]).length,p=[...s,c-1,"rowContent"],u=x()(a,p,[]);let m=x()(a,s,[]);Array.isArray(u)?se()(m,[c>0?c-1:0,"rowContent"],[...u,{name:r.name,size:i}]):se()(m,[c>0?c-1:0,"rowContent"],[{name:r.name,size:i}]);const f=yt(m);se()(o,s,f);break}case"ON_CHANGE":{se()(o,["modifiedData",...r.keys],r.value);break}case"ON_CHANGE_META":{se()(o,["metaForm","metadata",...r.keys],r.value);break}case"ON_CHANGE_SIZE":{se()(o,["metaForm","size"],r.value);break}case"ON_RESET":{o.modifiedData=t.initialData;break}case"REMOVE_FIELD":{const a=x()(t,[...s,r.rowIndex,"rowContent"],[]);let l=Qe()(t);if(a.length===1||a.length===2&&x()(a,[1,"name"],"")==="_TEMP_"){const c=x()(t,s,[]);se()(l,s,c.filter((p,u)=>r.rowIndex!==u))}else se()(l,[...s,r.rowIndex,"rowContent"],a.filter((c,p)=>p!==r.fieldIndex));const i=yt(x()(l,s,[]));se()(o,s,i);break}case"REORDER_DIFF_ROW":{const a=x()(t,[...s,r.dragRowIndex,"rowContent"],[]),l=x()(t,[...s,r.hoverRowIndex,"rowContent"],[]),i=x()(t,[...s,r.dragRowIndex,"rowContent",r.dragIndex],{}),c=[...l,i];let p=Qe()(t);se()(p,[...s,r.dragRowIndex,"rowContent"],a.filter((m,f)=>r.dragIndex!==f)),se()(p,[...s,r.hoverRowIndex,"rowContent"],(0,y.W3)(c,c.length-1,r.hoverIndex));const u=yt(x()(p,s,[]));se()(o,s,u);break}case"REORDER_ROW":{const a=Qe()(t),l=x()(a,[...s,r.dragRowIndex,"rowContent"],[]);se()(a,[...s,r.dragRowIndex,"rowContent"],(0,y.W3)(l,r.dragIndex,r.hoverIndex));const i=yt(x()(a,s,[]));se()(o,s,i);break}case"SET_FIELD_TO_EDIT":{o.metaToEdit=r.name,o.metaForm={metadata:x()(t,["modifiedData","metadatas",r.name,"edit"],{}),size:Qc(r.name,t.modifiedData?.layouts?.edit)??Zo};break}case"SUBMIT_META_FORM":{se()(o,["modifiedData","metadatas",t.metaToEdit,"edit"],t.metaForm.metadata);const a=Qe()(x()(t,s,[])),l=Gc(t.metaToEdit,t.metaForm.size,a);l.length>0&&se()(o,s,yt(l));break}case"SUBMIT_SUCCEEDED":{o.initialData=t.modifiedData;break}case"UNSET_FIELD_TO_EDIT":{o.metaToEdit="",o.metaForm={};break}default:return o}}),Yc=(t,r,o)=>{let s=Qe()(r);return se()(s,["layouts","edit"],yt(Uc(r.layouts.edit))),{...t,initialData:s,modifiedData:s,componentLayouts:o}},Ve=d(34853);const Bo=e.createContext();function hr({attributes:t,buttonData:r,children:o,goTo:s,layout:a,metadatas:l,moveItem:i,moveRow:c,onAddData:p,relationsLayout:u,removeField:m,selectedItemName:f,setEditFieldToSelect:g,...b}){return e.createElement(Bo.Provider,{value:{attributes:t,buttonData:r,goTo:s,layout:a,metadatas:l,moveItem:i,moveRow:c,onAddData:p,relationsLayout:u,removeField:m,selectedItemName:f,setEditFieldToSelect:g,...b}},o)}hr.defaultProps={attributes:{},buttonData:[],goTo(){},layout:[],metadatas:{},moveItem(){},moveRow(){},onAddData(){},relationsLayout:[],removeField(){},selectedItemName:null,setEditFieldToSelect(){}},hr.propTypes={attributes:n().object,buttonData:n().array,children:n().node.isRequired,goTo:n().func,layout:n().array,metadatas:n().object,moveItem:n().func,moveRow:n().func,onAddData:n().func,relationsLayout:n().array,removeField:n().func,selectedItemName:n().string,setEditFieldToSelect:n().func};function it(){return e.useContext(Bo)}var dn=d(74506),qo=d(45112);const No=({componentUid:t})=>{const{componentLayouts:r}=it(),{formatMessage:o}=(0,H.Z)(),s=x()(r,[t],{}),a=x()(s,["layouts","edit"],[]);return e.createElement(L.x,{padding:3},a.map((l,i)=>e.createElement(De.r,{gap:4,key:i},l.map(c=>e.createElement(ue.P,{key:c.name,col:c.size},e.createElement(L.x,{paddingTop:2},e.createElement(P.k,{alignItems:"center",background:"neutral0",paddingLeft:3,paddingRight:3,height:`${32/16}rem`,hasRadius:!0,borderColor:"neutral200"},e.createElement(Q.Z,{textColor:"neutral800"},c.name))))))),e.createElement(L.x,{paddingTop:2},e.createElement(h.rU,{startIcon:e.createElement(qo.Z,null),to:`/content-manager/components/${t}/configurations/edit`},o({id:(0,be.Z)("components.FieldItem.linkToComponentLayout"),defaultMessage:"Set the component's layout"}))))};No.propTypes={componentUid:n().string.isRequired};var Xc=No,Et=d(14911);const Jc=(0,N.ZP)(P.k)`
|
|
898
|
-
text-decoration: none;
|
|
899
|
-
|
|
900
|
-
&:focus,
|
|
901
|
-
&:hover {
|
|
902
|
-
${({theme:t})=>`
|
|
903
|
-
background-color: ${t.colors.primary100};
|
|
904
|
-
border-color: ${t.colors.primary200};
|
|
905
|
-
|
|
906
|
-
${Q.Z} {
|
|
907
|
-
color: ${t.colors.primary600};
|
|
908
|
-
}
|
|
909
|
-
`}
|
|
910
|
-
|
|
911
|
-
/* > ComponentIcon */
|
|
912
|
-
> div:first-child {
|
|
913
|
-
background: ${({theme:t})=>t.colors.primary200};
|
|
914
|
-
color: ${({theme:t})=>t.colors.primary600};
|
|
915
|
-
}
|
|
916
|
-
}
|
|
917
|
-
`,jo=({components:t})=>{const{componentLayouts:r}=it();return e.createElement(P.k,{gap:2,overflow:"scroll hidden",padding:3},t.map(o=>e.createElement(Jc,{hasRadius:!0,background:"neutral0",justifyContent:"center",alignItems:"center",height:`${84/16}rem`,minWidth:`${140/16}rem`,key:o,padding:2,direction:"column",borderColor:"neutral200",as:Et.rU,to:`/content-manager/components/${o}/configurations/edit`},e.createElement(en,null),e.createElement(L.x,{paddingTop:1},e.createElement(Q.Z,{fontSize:1,textColor:"neutral600",fontWeight:"bold"},r?.[o]?.info?.displayName??"")))))};jo.propTypes={components:n().arrayOf(n().string).isRequired};var _c=jo;const Wo=(0,N.ZP)(ye.h)`
|
|
918
|
-
background-color: transparent;
|
|
919
|
-
path {
|
|
920
|
-
fill: ${({theme:t})=>t.colors.neutral600};
|
|
921
|
-
}
|
|
922
|
-
`,yr=({attribute:t,onEditField:r,onDeleteField:o,children:s})=>{const{formatMessage:a}=(0,H.Z)();return e.createElement(L.x,{overflow:"hidden",width:"100%"},e.createElement(P.k,{paddingLeft:3,alignItems:"center",justifyContent:"space-between"},e.createElement(Q.Z,{fontWeight:"semiBold",textColor:"neutral800",ellipsis:!0},s),e.createElement(P.k,null,e.createElement(Wo,{label:a({id:(0,y.OB)("containers.ListSettingsView.modal-form.edit-label"),defaultMessage:"Edit {fieldName}"},{fieldName:s}),onClick:r,icon:e.createElement(je.Z,null),noBorder:!0}),e.createElement(Wo,{label:a({id:"global.delete-target",defaultMessage:"Delete {target}"},{target:s}),"data-testid":"delete-field",onClick:o,icon:e.createElement(He.Z,null),noBorder:!0}))),t?.type==="component"&&e.createElement(Xc,{componentUid:t.component}),t?.type==="dynamiczone"&&e.createElement(_c,{components:t.components}))};yr.defaultProps={attribute:void 0},yr.propTypes={attribute:n().shape({components:n().array,component:n().string,type:n().string}),onEditField:n().func.isRequired,onDeleteField:n().func.isRequired,children:n().string.isRequired};var ed=yr;const td=(0,N.ZP)(P.k)`
|
|
923
|
-
position: relative;
|
|
924
|
-
${({isFirst:t,isLast:r,hasHorizontalPadding:o})=>t?`
|
|
925
|
-
padding-right: 4px;
|
|
926
|
-
`:r?`
|
|
927
|
-
padding-left: 4px;
|
|
928
|
-
`:o?`
|
|
929
|
-
padding: 0 4px;
|
|
930
|
-
`:""}
|
|
931
|
-
${({showRightCarret:t,showLeftCarret:r,theme:o})=>t?`
|
|
932
|
-
&:after {
|
|
933
|
-
content: '';
|
|
934
|
-
position: absolute;
|
|
935
|
-
right: -1px;
|
|
936
|
-
background-color: ${o.colors.primary600};
|
|
937
|
-
width: 2px;
|
|
938
|
-
height: 100%;
|
|
939
|
-
align-self: stretch;
|
|
940
|
-
z-index: 1;
|
|
941
|
-
}
|
|
942
|
-
`:r?`
|
|
943
|
-
&:before {
|
|
944
|
-
content: '';
|
|
945
|
-
position: absolute;
|
|
946
|
-
left: -1px;
|
|
947
|
-
background-color: ${o.colors.primary600};
|
|
948
|
-
width: 2px;
|
|
949
|
-
height: 100%;
|
|
950
|
-
align-self: stretch;
|
|
951
|
-
z-index: 1;
|
|
952
|
-
}
|
|
953
|
-
`:""};
|
|
954
|
-
`,nd=(0,N.ZP)(Je.Z)`
|
|
955
|
-
height: ${12/16}rem;
|
|
956
|
-
width: ${12/16}rem;
|
|
957
|
-
path {
|
|
958
|
-
fill: ${({theme:t})=>t.colors.neutral600};
|
|
959
|
-
}
|
|
960
|
-
`,rd=(0,N.ZP)(P.k)`
|
|
961
|
-
display: ${({dragStart:t})=>t?"none":"flex"};
|
|
962
|
-
opacity: ${({isDragging:t,isFullSize:r,isHidden:o})=>t&&!r?.2:t&&r||o?0:1};
|
|
963
|
-
`,od=(0,N.ZP)(P.k)`
|
|
964
|
-
cursor: all-scroll;
|
|
965
|
-
border-right: 1px solid ${({theme:t})=>t.colors.neutral200};
|
|
966
|
-
`,Er=({attribute:t,children:r,index:o,lastIndex:s,moveItem:a,moveRow:l,name:i,onDeleteField:c,onEditField:p,rowIndex:u,size:m})=>{const[f,g]=(0,e.useState)(!1),b=i==="_TEMP_",{setIsDraggingSibling:E}=it(),v=m===12,I=(0,e.useRef)(null),T=(0,e.useRef)(null),[{clientOffset:D,isOver:w},k]=(0,dn.useDrop)({accept:y._Q.EDIT_FIELD,hover(q,W){if(!T.current||q.size!==12)return;const R=W.getItem().index,Z=o,V=W.getItem().rowIndex,K=u;if(R===Z&&V===K)return;const O=T.current.getBoundingClientRect(),S=(O.bottom-O.top)/2,_=W.getClientOffset().y-O.top;V<K&&_<S||V>K&&_>S||(l(V,K),q.rowIndex=K,q.itemIndex=Z)},drop(q,W){if(!T.current)return;const R=W.getItem().index,Z=o,V=W.getItem().rowIndex,K=u;if(q.size===12||R===Z&&V===K)return;const O=T.current.getBoundingClientRect();if(Math.abs(W.getClientOffset().x-O.left)>O.width/1.8){a(R,Z+1,V,K),q.itemIndex=Z+1,q.rowIndex=K;return}a(R,Z,V,K),q.itemIndex=Z,q.rowIndex=K},collect:q=>({canDrop:q.canDrop(),clientOffset:q.getClientOffset(),isOver:q.isOver(),isOverCurrent:q.isOver({shallow:!0}),itemType:q.getItemType()})}),[{isDragging:C,getItem:M},F,B]=(0,dn.useDrag)({type:y._Q.EDIT_FIELD,item(){return E(!0),{index:o,labelField:r,rowIndex:u,name:i,size:m}},canDrag(){return i!=="_TEMP_"},collect:q=>({isDragging:q.isDragging(),getItem:q.getItem()}),end(){E(!1)}});(0,e.useEffect)(()=>{B((0,Ot.rX)(),{captureDraggingState:!0})},[B]);const U={dragRef:F(I),dropRef:k(T)};let A=!1,G=!1;if(T.current&&D){const q=T.current.getBoundingClientRect();A=w&&M.size!==12&&Math.abs(D.x-q.left)<q.width/2,G=w&&M.size!==12&&Math.abs(D.x-q.left)>q.width/2,i==="_TEMP_"&&(A=w&&M.size!==12,G=!1)}const $=()=>t&&v?`${74/16}rem`:`${32/16}rem`,Y=o===0&&!v,j=o===s&&!v,X=o!==0&&!v;return e.createElement(ue.P,{col:m},e.createElement(td,{ref:U.dropRef,showLeftCarret:A,showRightCarret:G,isFirst:Y,isLast:j,hasHorizontalPadding:X,onDrag:()=>{v&&!f&&g(!0)},onDragEnd:()=>{v&&g(!1)}},f&&v&&e.createElement(L.x,{width:"100%",height:"2px",background:"primary600"}),e.createElement(rd,{width:v&&f?0:"100%",borderColor:"neutral150",hasRadius:!0,background:"neutral100",minHeight:$(),alignItems:"stretch",isDragging:C,dragStart:f,isFullSize:v,isHidden:b},e.createElement(od,{as:"span",type:"button",ref:U.dragRef,onClick:q=>q.stopPropagation(),alignItems:"center",paddingLeft:3,paddingRight:3,tabIndex:-1},e.createElement(nd,null)),!b&&e.createElement(ed,{attribute:t,onEditField:p,onDeleteField:c},r))))};Er.defaultProps={attribute:void 0},Er.propTypes={attribute:n().shape({components:n().array,component:n().string,type:n().string}),children:n().string.isRequired,index:n().number.isRequired,moveItem:n().func.isRequired,moveRow:n().func.isRequired,name:n().string.isRequired,onDeleteField:n().func.isRequired,onEditField:n().func.isRequired,rowIndex:n().number.isRequired,lastIndex:n().number.isRequired,size:n().number.isRequired};var sd=Er;const zo=({rowItem:t,onRemoveField:r,rowId:o,rowIndex:s,index:a,lastIndex:l})=>{const{setEditFieldToSelect:i,attributes:c,modifiedData:p,moveRow:u,moveItem:m}=it(),f=x()(c,[t.name],{}),g=x()(p,["metadatas",t.name,"edit","label"],"");return e.createElement(sd,{onEditField:()=>i(t.name),onDeleteField:()=>r(o,a),attribute:f,index:a,lastIndex:l,rowIndex:s,name:t.name,size:t.size,moveRow:u,moveItem:m},g||t.name)};zo.propTypes={index:n().number.isRequired,lastIndex:n().number.isRequired,onRemoveField:n().func.isRequired,rowId:n().number.isRequired,rowIndex:n().number.isRequired,rowItem:n().object.isRequired};var ad=zo;const Vo=({row:t,onRemoveField:r,rowIndex:o})=>e.createElement(De.r,null,t.rowContent.map((s,a)=>e.createElement(ad,{key:s.name,rowItem:s,index:a,rowId:t.rowId,onRemoveField:r,rowIndex:o,lastIndex:t.rowContent.length-1})));Vo.propTypes={onRemoveField:n().func.isRequired,row:n().object.isRequired,rowIndex:n().number.isRequired};var id=Vo;const ld=[{action:"plugin::content-type-builder.read",subject:null}];var cd=()=>{const{trackUsage:t}=(0,h.rS)(),{formatMessage:r}=(0,H.Z)(),{slug:o,modifiedData:s,isContentTypeView:a}=it(),l=a?"content-types":"components",i=`/plugins/content-type-builder/${l==="content-types"?l:"component-categories"}`,c=x()(s,"category",""),p=l==="content-types"?o:`${c}/${o}`,u=()=>{t("willEditEditLayout")};return o==="strapi::administrator"?null:e.createElement(h.jW,{permissions:ld},e.createElement(h.Qj,{to:`${i}/${p}`,onClick:u,size:"S",startIcon:e.createElement(je.Z,null),variant:"secondary"},r({id:(0,be.Z)(`edit-settings-view.link-to-ctb.${l}`),defaultMessage:"Edit the content type"})))};const Uo=({editLayout:t,fields:r,onRemoveField:o,onAddField:s})=>{const{formatMessage:a}=(0,H.Z)();return e.createElement(P.k,{direction:"column",alignItems:"stretch",gap:4},e.createElement(P.k,{justifyContent:"space-between"},e.createElement("div",null,e.createElement(L.x,null,e.createElement(Q.Z,{fontWeight:"bold"},a({id:(0,y.OB)("containers.ListPage.displayedFields"),defaultMessage:"Displayed fields"}))),e.createElement(L.x,null,e.createElement(Q.Z,{variant:"pi",textColor:"neutral600"},a({id:"containers.SettingPage.editSettings.description",defaultMessage:"Drag & drop the fields to build the layout"})))),e.createElement(cd,null)),e.createElement(L.x,{padding:4,hasRadius:!0,borderStyle:"dashed",borderWidth:"1px",borderColor:"neutral300"},e.createElement(P.k,{direction:"column",alignItems:"stretch",gap:2},t.map((l,i)=>e.createElement(id,{key:l.rowId,row:l,rowIndex:i,onRemoveField:o})),e.createElement(Ve.O,{id:"label",label:a({id:(0,y.OB)("containers.SettingPage.add.field"),defaultMessage:"Insert another field"}),as:me.z,"data-testid":"add-field",fullWidth:!0,startIcon:e.createElement(Ft.Z,null),endIcon:null,variant:"secondary",disabled:r.length===0},r.map(l=>e.createElement(Ve.s,{key:l,onClick:()=>s(l)},l))))))};Uo.propTypes={editLayout:n().array.isRequired,fields:n().array.isRequired,onAddField:n().func.isRequired,onRemoveField:n().func.isRequired};var dd=Uo,Ho=d(85025),Qo=d(55225),Go=d(31600),Ko=d(11406),$t=d(32031),ud=d(73779),un=d(88675),md=d(22348),Yo=d(7184),br=d(43475),pd=d(82512),vr=d(83218),gd=d(872),fd=d(17757),hd=d(1176),yd=d(15431);const Xo={biginteger:e.createElement($t.Z,null),boolean:e.createElement(ud.Z,null),date:e.createElement(un.Z,null),datetime:e.createElement(un.Z,null),decimal:e.createElement($t.Z,null),email:e.createElement(md.Z,null),enum:e.createElement(Yo.Z,null),enumeration:e.createElement(Yo.Z,null),file:e.createElement(br.Z,null),files:e.createElement(br.Z,null),float:e.createElement($t.Z,null),integer:e.createElement($t.Z,null),media:e.createElement(br.Z,null),number:e.createElement($t.Z,null),relation:e.createElement(pd.Z,null),string:e.createElement(vr.Z,null),text:e.createElement(vr.Z,null),richtext:e.createElement(vr.Z,null),time:e.createElement(un.Z,null),timestamp:e.createElement(un.Z,null),json:e.createElement(gd.Z,null),uid:e.createElement(fd.Z,null),component:e.createElement(hd.Z,null),dynamiczone:e.createElement(yd.Z,null)},Cr=({type:t,customFieldUid:r})=>{const o=(0,h.mZ)();let s=Xo[t];if(r){const l=o.get(r).icon;l&&(s=e.createElement(L.x,{marginRight:3,width:7,height:6},e.createElement(l,null)))}return Xo[t]?s:null};Cr.defaultProps={customFieldUid:null},Cr.propTypes={type:n().string.isRequired,customFieldUid:n().string};var Jo=Cr,Ed=t=>t.reduce((r,o)=>{const s=o?.attributes??{},a=Object.keys(s).filter(l=>!["boolean","component","dynamiczone","json","media","password","relation","text","richtext"].includes(s?.[l]?.type??""));return r[o.uid]=a,r},{}),_o=t=>{let r;switch(t){case"description":case"label":case"placeholder":r="text";break;case"mainField":r="select";break;case"editable":r="bool";break;default:r=""}const o=t==="mainField"?(0,y.OB)("containers.SettingPage.editSettings.entry.title"):(0,y.OB)(`form.Input.${t}`);return{type:r,label:{id:o}}},bt=d(42882),Zt=d(9139);const Rr=({type:t,options:r,onChange:o,value:s,name:a,...l})=>{const{formatMessage:i}=(0,H.Z)();switch(t){case"text":return e.createElement(kn.o,{onChange:o,value:s,name:a,...l});case"bool":return e.createElement(Zt.s,{onChange:c=>{o({target:{name:a,value:c.target.checked}})},checked:s,name:a,onLabel:i({id:"app.components.ToggleCheckbox.on-label",defaultMessage:"On"}),offLabel:i({id:"app.components.ToggleCheckbox.off-label",defaultMessage:"Off"}),...l});case"select":return e.createElement(We.P,{value:s,name:a,onChange:c=>o({target:{name:a,value:c}}),...l},r.map(c=>e.createElement(Ee.W,{key:c,value:c},c)));default:return null}};Rr.defaultProps={options:void 0},Rr.propTypes={type:n().string.isRequired,options:n().arrayOf(n().string),onChange:n().func.isRequired,value:n().oneOfType([n().string,n().bool]).isRequired,name:n().string.isRequired};var bd=Rr;const vd=[[4,"33%"],[6,"50%"],[8,"66%"],[12,"100%"]],Cd=[1,5,10,15,30,60],Rd=["datetime","time"],es=({onMetaChange:t,onSizeChange:r})=>{const{formatMessage:o}=(0,H.Z)(),{modifiedData:s,selectedField:a,attributes:l,fieldForm:i}=it(),c=(0,e.useMemo)(bt.Vo,[]),{schemas:p}=(0,J.v9)(k=>c(k),J.wU),u=(0,J.v9)(bt.Jg),m=(0,e.useMemo)(()=>{if(!a)return[];const k=x()(s,["metadatas",a,"edit"],{});return Object.keys(k).filter(C=>C!=="visible")},[a,s]),f=(0,e.useMemo)(()=>Ed(p),[p]),g=(0,e.useCallback)(k=>{if(k!=="relation"&&k!=="component")return[];const C=k==="component"?"component":"targetModel",M=x()(s,["attributes",a,C],"");return x()(f,[M],[])},[a,f,s]),b=m.map(k=>{const C=x()(l,[a,"type"]);return["component","dynamiczone"].includes(C)&&!["label","description"].includes(k)||C==="component"&&k!=="label"||["media","json","boolean"].includes(C)&&k==="placeholder"||k==="step"?null:e.createElement(ue.P,{col:6,key:k},e.createElement(bd,{type:_o(k).type,hint:k==="mainField"?o({id:(0,be.Z)("containers.SettingPage.editSettings.relation-field.description")}):"",label:o({id:x()(_o(k),"label.id","app.utils.defaultMessage")}),name:k,onChange:t,value:x()(i,["metadata",k],""),options:g(C)}))}),{type:E,customField:v}=l[a],{isResizable:I}=u[v]??u[E],T=e.createElement(ue.P,{col:6,key:"size"},e.createElement(We.P,{value:i?.size,name:"size",onChange:k=>{r({name:a,value:k})},label:o({id:(0,be.Z)("containers.SettingPage.editSettings.size.label"),defaultMessage:"Size"})},vd.map(([k,C])=>e.createElement(Ee.W,{key:k,value:k},C)))),D=Rd.includes(l[a].type),w=e.createElement(ue.P,{col:6,key:"step"},e.createElement(We.P,{value:x()(i,["metadata","step"],1),name:"step",onChange:k=>t({target:{name:"step",value:k}}),label:o({id:(0,be.Z)("containers.SettingPage.editSettings.step.label"),defaultMessage:"Time interval (minutes)"})},Cd.map(k=>e.createElement(Ee.W,{key:k,value:k},k))));return e.createElement(e.Fragment,null,b,I&&T,D&&w)};es.propTypes={onMetaChange:n().func.isRequired,onSizeChange:n().func.isRequired};var Md=es;const Td=(0,N.ZP)(P.k)`
|
|
967
|
-
svg {
|
|
968
|
-
width: ${32/16}rem;
|
|
969
|
-
height: ${24/16}rem;
|
|
970
|
-
margin-right: ${({theme:t})=>t.spaces[3]};
|
|
971
|
-
}
|
|
972
|
-
`,Mr=({onToggle:t,onMetaChange:r,onSizeChange:o,onSubmit:s,type:a,customFieldUid:l})=>{const{selectedField:i}=it(),{formatMessage:c}=(0,H.Z)(),p=()=>a==="timestamp"?"date":["decimal","float","integer","biginter"].includes(a)?"number":a;return e.createElement(Ho.P,{onClose:t,labelledBy:"title"},e.createElement("form",{onSubmit:s},e.createElement(Qo.x,null,e.createElement(Td,null,e.createElement(Jo,{type:p(),customFieldUid:l}),e.createElement(Q.Z,{fontWeight:"bold",textColor:"neutral800",as:"h2",id:"title"},c({id:(0,y.OB)("containers.ListSettingsView.modal-form.edit-label"),defaultMessage:"Edit {fieldName}"},{fieldName:At()(i)})))),e.createElement(Go.f,null,e.createElement(De.r,{gap:4},e.createElement(Md,{onMetaChange:r,onSizeChange:o}))),e.createElement(Ko.m,{startActions:e.createElement(me.z,{onClick:t,variant:"tertiary"},c({id:"app.components.Button.cancel",defaultMessage:"Cancel"})),endActions:e.createElement(me.z,{type:"submit"},c({id:"global.finish",defaultMessage:"Finish"}))})))};Mr.defaultProps={customFieldUid:null},Mr.propTypes={customFieldUid:n().string,onSubmit:n().func.isRequired,onToggle:n().func.isRequired,onMetaChange:n().func.isRequired,onSizeChange:n().func.isRequired,type:n().string.isRequired};var Dd=Mr,Id=(t,r,o)=>{const{put:s}=(0,h.tg)();return s((0,y.IF)(o?`content-types/${r}/configuration`:`components/${r}/configuration`),t)};const Tr=({mainLayout:t,components:r,isContentTypeView:o,slug:s,updateLayout:a})=>{const[l,i]=(0,e.useReducer)(Kc,fr,()=>Yc(fr,t,r)),[c,p]=(0,e.useState)(!1),{trackUsage:u}=(0,h.rS)(),m=(0,h.lm)(),{goBack:f}=(0,te.k6)(),[g,b]=(0,e.useState)(!1),[E,v]=(0,e.useState)(!1),{componentLayouts:I,initialData:T,modifiedData:D,metaToEdit:w,metaForm:k}=l,{formatMessage:C}=(0,H.Z)(),M=x()(t,["info","displayName"],""),F=x()(D,["attributes"],{}),B=(0,J.v9)(bt.Jg),U=Object.keys(F).filter(z=>{const ie=x()(F,[z,"type"],"");return!["dynamiczone","json","text","relation","component","boolean","media","password","richtext","timestamp"].includes(ie)&&!!ie}),A=x()(D,["layouts","edit"],[]),G=Fo()(A,"rowContent"),$=Object.keys(D.attributes).filter(z=>x()(D,["metadatas",z,"edit","visible"],!1)===!0).filter(z=>G.findIndex(ie=>ie.name===z)===-1).sort(),Y=({target:{name:z,value:ie}})=>{i({type:"ON_CHANGE",keys:z.split("."),value:ie})},j=()=>{b(z=>!z)},X=()=>{v(z=>!z)},q=({target:{name:z,value:ie}})=>{i({type:"ON_CHANGE_META",keys:z.split("."),value:ie})},W=({name:z,value:ie})=>{i({type:"ON_CHANGE_SIZE",name:z,value:ie})},R=z=>{z.preventDefault(),i({type:"SUBMIT_META_FORM"}),j()},Z=z=>{z.preventDefault(),X()},V=(0,ot.useMutation)(z=>Id(z,s,o),{onSuccess({data:z}){a&&a(z.data),i({type:"SUBMIT_SUCCEEDED"}),X(),u("didEditEditSettings")},onError(){m({type:"warning",message:{id:"notification.error"}})}}),{isLoading:K}=V,O=()=>{const z=xn()(Qe()(D),["layouts","metadatas","settings"]);se()(z,"layouts.edit",Hc(z.layouts.edit)),V.mutate(z)},S=(z,ie)=>{i({type:"MOVE_RELATION",fromIndex:z,toIndex:ie})},ne=(z,ie)=>{i({type:"MOVE_FIELD",fromIndex:z,toIndex:ie})},_=(z,ie,Te,Ge)=>{i(Te===Ge?{type:"REORDER_ROW",dragRowIndex:Te,dragIndex:z,hoverIndex:ie}:{type:"REORDER_DIFF_ROW",dragIndex:z,hoverIndex:ie,dragRowIndex:Te,hoverRowIndex:Ge})},ae=(z,ie)=>{i({type:"MOVE_ROW",fromIndex:z,toIndex:ie})};return e.createElement(hr,{isContentTypeView:o,attributes:F,modifiedData:D,slug:s,componentLayouts:I,selectedField:w,fieldForm:k,onMoveRelation:S,onMoveField:ne,moveRow:ae,moveItem:_,setEditFieldToSelect:z=>{i({type:"SET_FIELD_TO_EDIT",name:z}),j()},isDraggingSibling:c,setIsDraggingSibling:p},e.createElement(Ce.o,null,e.createElement("form",{onSubmit:Z},e.createElement(fe.T,{title:C({id:(0,y.OB)("components.SettingsViewWrapper.pluginHeader.title"),defaultMessage:`Configure the view - ${At()(M)}`},{name:At()(M)}),subtitle:C({id:(0,y.OB)("components.SettingsViewWrapper.pluginHeader.description.edit-settings"),defaultMessage:"Customize how the edit view will look like."}),navigationAction:e.createElement(h.rU,{startIcon:e.createElement(on.Z,null),onClick:z=>{z.preventDefault(),f()},to:"/"},C({id:"global.back",defaultMessage:"Back"})),primaryAction:e.createElement(me.z,{disabled:Lt()(T,D),startIcon:e.createElement(ht.Z,null),type:"submit"},C({id:"global.save",defaultMessage:"Save"}))}),e.createElement($e.D,null,e.createElement(L.x,{background:"neutral0",hasRadius:!0,shadow:"filterShadow",paddingTop:6,paddingBottom:6,paddingLeft:7,paddingRight:7},e.createElement(P.k,{direction:"column",alignItems:"stretch",gap:4},e.createElement(Q.Z,{variant:"delta",as:"h2"},C({id:(0,y.OB)("containers.SettingPage.settings"),defaultMessage:"Settings"})),e.createElement(De.r,null,e.createElement(ue.P,{col:6,s:12},e.createElement(We.P,{label:C({id:(0,y.OB)("containers.SettingPage.editSettings.entry.title"),defaultMessage:"Entry title"}),hint:C({id:(0,y.OB)("containers.SettingPage.editSettings.entry.title.description"),defaultMessage:"Set the display field of your entry"}),onChange:z=>{Y({target:{name:"settings.mainField",value:z===""?null:z}})},value:D.settings.mainField},U.map(z=>e.createElement(Ee.W,{key:z,value:z},z))))),e.createElement(L.x,{paddingTop:2,paddingBottom:2},e.createElement($o.i,null)),e.createElement(Q.Z,{variant:"delta",as:"h3"},C({id:(0,y.OB)("containers.SettingPage.view"),defaultMessage:"View"})),e.createElement(dd,{attributes:F,editLayout:A,fields:$,onAddField:z=>{i({type:"ON_ADD_FIELD",name:z,fieldSizes:B})},onRemoveField:(z,ie)=>{i({type:"REMOVE_FIELD",rowIndex:z,fieldIndex:ie})}})))),e.createElement(h.QH,{bodyText:{id:(0,y.OB)("popUpWarning.warning.updateAllSettings"),defaultMessage:"This will modify all your settings"},iconRightButton:e.createElement(ht.Z,null),isConfirmButtonLoading:K,isOpen:E,onToggleDialog:X,onConfirm:O,variantRightButton:"success-light"})),g&&e.createElement(Dd,{onSubmit:R,onToggle:j,onMetaChange:q,onSizeChange:W,type:x()(F,[w,"type"],""),customFieldUid:x()(F,[w,"customField"],"")})))};Tr.defaultProps={isContentTypeView:!1,updateLayout:null},Tr.propTypes={components:n().object.isRequired,isContentTypeView:n().bool,mainLayout:n().shape({attributes:n().object.isRequired,info:n().object.isRequired,layouts:n().shape({list:n().array.isRequired,edit:n().array.isRequired}).isRequired,metadatas:n().object.isRequired,options:n().object.isRequired}).isRequired,slug:n().string.isRequired,updateLayout:n().func};var Dr=Tr,vt=d(37617);const kd=()=>({type:vt.ZA}),Od=(t,r)=>({type:vt.Id,pagination:t,data:r}),xd=()=>({type:vt.MP});function Pd(){return{type:vt.c2}}const wd=({components:t,contentType:r})=>{const{layouts:o}=r;return{contentType:r,components:t,displayedHeaders:o.list,type:vt.Zz}},Ir=t=>({type:vt.Rp,target:t});var ts=d(6680),kr=d(94638),ns=d(99223),Fd=d(70664);const Ld=()=>t=>t["content-manager_listView"]||Fd.E,Sd=()=>(0,dr.P1)(Ld(),t=>t),rs=t=>{const{displayedHeaders:r}=t["content-manager_listView"];return r};var Ad=Sd,$d=d(35658),Zd=d(94547),Or=d(19786),Bd=d(44426),qd=d(47765),Nd=d(8997),jd=d(69033);const Wd=(0,N.ZP)(P.k)`
|
|
973
|
-
position: relative;
|
|
974
|
-
border-radius: 50%;
|
|
975
|
-
width: 26px;
|
|
976
|
-
height: 26px;
|
|
977
|
-
border: 1px solid ${({theme:t})=>t.colors.neutral200};
|
|
978
|
-
background: ${({theme:t})=>t.colors.neutral150};
|
|
979
|
-
padding-left: 1px;
|
|
980
|
-
|
|
981
|
-
span {
|
|
982
|
-
line-height: 0.6rem;
|
|
983
|
-
font-size: 0.6rem;
|
|
984
|
-
}
|
|
985
|
-
`,os=({children:t,...r})=>e.createElement(Wd,{justifyContent:"center",alignItems:"center",as:"span",...r},e.createElement(Q.Z,{variant:"sigma",textColor:"neutral600"},t));os.propTypes={children:n().string.isRequired};var ss=os;const xr=({url:t,mime:r,alternativeText:o,name:s,ext:a,formats:l})=>{const i=(0,h.CR)(t);if(r.includes("image")){const u=l?.thumbnail?.url||null,m=(0,h.CR)(u)||i;return e.createElement(jd.q,{src:m,alt:o||s,preview:!0})}const c=(0,h.mD)(a),p=s.length>100?`${s.substring(0,100)}...`:s;return e.createElement(Gt.u,{description:p},e.createElement(ss,null,c))};xr.defaultProps={alternativeText:null,formats:null},xr.propTypes={alternativeText:n().string,ext:n().string.isRequired,formats:n().object,mime:n().string.isRequired,name:n().string.isRequired,url:n().string.isRequired};var as=xr,zd=d(25898);const is=({value:t})=>e.createElement(zd.H,null,t.map((r,o)=>{const s=`${r.id}${o}`;if(o===3){const a=`+${t.length-3}`;return e.createElement(ss,{key:s,preview:!1},a)}return o>3?null:e.createElement(as,{key:s,...r})}));is.propTypes={value:n().arrayOf(n().shape({alternativeText:n().string,ext:n().string.isRequired,formats:n().object,mime:n().string.isRequired,name:n().string.isRequired,url:n().string.isRequired})).isRequired};var Vd=is,ls=d(6518),Ud=d(97405),Hd=d(96315);const cs=({type:t,value:r})=>{const{formatDate:o,formatTime:s,formatNumber:a}=(0,H.Z)();let l=r;if(t==="date"&&(l=o((0,Hd.Z)(r),{dateStyle:"full"})),t==="datetime"&&(l=o(r,{dateStyle:"full",timeStyle:"short"})),t==="time"){const[i,c,p]=r.split(":"),u=new Date;u.setHours(i),u.setMinutes(c),u.setSeconds(p),l=s(u,{numeric:"auto",style:"short"})}return["float","decimal"].includes(t)&&(l=a(r,{maximumFractionDigits:20})),["integer","biginteger"].includes(t)&&(l=a(r,{maximumFractionDigits:0})),bo()(l)};cs.propTypes={type:n().string.isRequired,value:n().any.isRequired};var Ct=cs;const Qd=(0,N.ZP)(Q.Z)`
|
|
986
|
-
max-width: 500px;
|
|
987
|
-
`,Gd=async(t,r,o)=>{const{data:{results:s,pagination:a}}=await o(t);return r(),{results:s,pagination:a}},ds=({fieldSchema:t,metadatas:r,name:o,entityId:s,value:a,contentType:l})=>{const{formatMessage:i}=(0,H.Z)(),{notifyStatus:c}=(0,kr.G)(),p=(0,e.useMemo)(()=>(0,y.IF)(`relations/${l.uid}/${s}/${o.split(".")[0]}`),[s,o,l]),[u,m]=(0,e.useState)(!1),{get:f}=(0,h.kY)(),g=e.createElement(P.k,{gap:1,wrap:"nowrap"},e.createElement(ls.C,null,a.count),i({id:"content-manager.containers.ListPage.items",defaultMessage:"{number, plural, =0 {items} one {item} other {items}}"},{number:a.count})),b=()=>{const I=i({id:(0,y.OB)("DynamicTable.relation-loaded"),defaultMessage:"Relations have been loaded"});c(I)},{data:E,status:v}=(0,ot.useQuery)([t.targetModel,s],()=>Gd(p,b,f),{enabled:u,staleTime:0,select:I=>({...I,results:[...I.results].reverse()})});return e.createElement(L.x,{...h.UW},e.createElement(Ve.O,{label:g,size:"S",onOpen:()=>m(!0),onClose:()=>m(!1)},v!=="success"&&e.createElement(Ve.s,{"aria-disabled":!0},e.createElement(Ud.a,{small:!0},i({id:(0,y.OB)("DynamicTable.relation-loading"),defaultMessage:"Relations are loading"}))),v==="success"&&e.createElement(e.Fragment,null,E?.results.map(I=>e.createElement(Ve.s,{key:I.id,"aria-disabled":!0},e.createElement(Qd,{ellipsis:!0},e.createElement(Ct,{type:r.mainField.schema.type,value:I[r.mainField.name]||I.id})))),E?.pagination.total>10&&e.createElement(Ve.s,{"aria-disabled":!0,"aria-label":i({id:(0,y.OB)("DynamicTable.relation-more"),defaultMessage:"This relation contains more entities than displayed"})},e.createElement(Q.Z,null,"\u2026")))))};ds.propTypes={contentType:n().shape({uid:n().string.isRequired}).isRequired,fieldSchema:n().shape({relation:n().string,targetModel:n().string,type:n().string.isRequired}).isRequired,metadatas:n().shape({mainField:n().shape({name:n().string.isRequired,schema:n().shape({type:n().string.isRequired}).isRequired})}).isRequired,name:n().string.isRequired,entityId:n().oneOfType([n().string,n().number]).isRequired,value:n().object.isRequired};var Kd=ds;const Yd=(0,N.ZP)(Q.Z)`
|
|
988
|
-
max-width: 500px;
|
|
989
|
-
`,us=({metadatas:t,value:r})=>e.createElement(Yd,{textColor:"neutral800",ellipsis:!0},e.createElement(Ct,{type:t.mainField.schema.type,value:r[t.mainField.name]??r.id}));us.propTypes={metadatas:n().shape({mainField:n().shape({name:n().string.isRequired,schema:n().shape({type:n().string.isRequired}).isRequired})}).isRequired,value:n().object.isRequired};var Xd=us;const Jd=(0,N.ZP)(Q.Z)`
|
|
990
|
-
max-width: 500px;
|
|
991
|
-
`,ms=({value:t,metadatas:r})=>{const{formatMessage:o}=(0,H.Z)(),{mainField:{type:s,name:a}}=r,l=e.createElement(e.Fragment,null,e.createElement(ls.C,null,t.length)," ",o({id:"content-manager.containers.ListPage.items",defaultMessage:"{number, plural, =0 {items} one {item} other {items}}"},{number:t.length}));return e.createElement(L.x,{...h.UW},e.createElement(Ve.O,{label:l,size:"S"},t.map(i=>e.createElement(Ve.s,{key:i.id,"aria-disabled":!0},e.createElement(Jd,{ellipsis:!0},e.createElement(Ct,{type:s,value:i[a]||i.id}))))))};ms.propTypes={metadatas:n().shape({mainField:n().shape({name:n().string,type:n().string,value:n().string})}).isRequired,value:n().array.isRequired};var _d=ms;const eu=(0,N.ZP)(Q.Z)`
|
|
992
|
-
max-width: 250px;
|
|
993
|
-
`,ps=({value:t,metadatas:r})=>{const{mainField:o}=r,s=t[o.name];return e.createElement(Gt.u,{label:s},e.createElement(eu,{textColor:"neutral800",ellipsis:!0},e.createElement(Ct,{type:o.type,value:s})))};ps.propTypes={metadatas:n().shape({mainField:n().shape({name:n().string,type:n().string,value:n().string})}).isRequired,value:n().object.isRequired};var tu=ps,nu=d(80022),gs=d.n(nu);function fs(t){return["oneToOne","manyToOne","oneToOneMorph"].includes(t)}function ru(t,r,o,s){if(t==="component"){const{mainField:{name:a,type:l}}=o;if(s?.repeatable)return r.length>0;const i=r?.[a];return a==="id"&&![void 0,null].includes(i)?!0:St(l)&&l!=="biginteger"&&a!=="id"?gs()(i):!Re()(i)}return t==="relation"?fs(s.relation)?!Re()(r):r?.count>0:St(t)&&t!=="biginteger"?gs()(r):t==="boolean"?r!==null:!Re()(r)}const hs=(0,N.ZP)(Q.Z)`
|
|
994
|
-
max-width: 300px;
|
|
995
|
-
`,Pr=({content:t,fieldSchema:r,metadatas:o,name:s,rowId:a,contentType:l})=>{const{type:i}=r;if(!ru(i,t,o,r))return e.createElement(Q.Z,{textColor:"neutral800"},"-");switch(i){case"media":return r.multiple?e.createElement(Vd,{value:t}):e.createElement(as,{...t});case"relation":return fs(r.relation)?e.createElement(Xd,{metadatas:o,value:t}):e.createElement(Kd,{fieldSchema:r,metadatas:o,value:t,name:s,entityId:a,contentType:l});case"component":return r.repeatable===!0?e.createElement(_d,{value:t,metadatas:o}):e.createElement(tu,{value:t,metadatas:o});case"string":return e.createElement(Gt.u,{description:t},e.createElement(hs,{ellipsis:!0,textColor:"neutral800"},e.createElement(Ct,{type:i,value:t})));default:return e.createElement(hs,{ellipsis:!0,textColor:"neutral800"},e.createElement(Ct,{type:i,value:t}))}};Pr.defaultProps={content:void 0},Pr.propTypes={content:n().any,contentType:n().shape({uid:n().string.isRequired}).isRequired,fieldSchema:n().shape({component:n().string,multiple:n().bool,type:n().string.isRequired,repeatable:n().bool,relation:n().string}).isRequired,metadatas:n().object.isRequired,name:n().string.isRequired,rowId:n().oneOfType([n().string,n().number]).isRequired};var ou=Pr;const wr=({canCreate:t,canDelete:r,contentType:o,headers:s,entriesToDelete:a,onClickDelete:l,onSelectRow:i,withMainAction:c,withBulkActions:p,rows:u})=>{const{push:m,location:{pathname:f}}=(0,te.k6)(),{formatMessage:g}=(0,H.Z)(),{trackUsage:b}=(0,h.rS)(),E=(0,de.fi)();return e.createElement($d.p,null,u.map((v,I)=>{const T=a.findIndex(w=>w===v.id)!==-1,D=g({id:"content-manager.components.DynamicTable.row-line",defaultMessage:"item line {number}"},{number:I});return e.createElement(Zd.Tr,{key:v.id,...(0,h.X7)({fn(){b("willEditEntryFromList"),m({pathname:`${f}/${v.id}`,state:{from:f},search:E})},condition:p})},c&&e.createElement(Or.Td,{...h.UW},e.createElement(Bd.C,{"aria-label":g({id:"app.component.table.select.one-entry",defaultMessage:"Select {target}"},{target:(0,Nd.Pp)(v.firstname,v.lastname)}),checked:T,onChange:()=>{i({name:v.id,value:!T})}})),s.map(({key:w,cellFormatter:k,name:C,...M})=>e.createElement(Or.Td,{key:w},typeof k=="function"?k(v,{key:w,name:C,...M}):e.createElement(ou,{content:v[C.split(".")[0]],name:C,contentType:o,...M,rowId:v.id}))),p&&e.createElement(Or.Td,null,e.createElement(P.k,{justifyContent:"end",...h.UW},e.createElement(ye.h,{forwardedAs:Et.rU,onClick:()=>{b("willEditEntryFromButton")},to:{pathname:`${f}/${v.id}`,state:{from:f},search:E},label:g({id:"app.component.table.edit",defaultMessage:"Edit {target}"},{target:D}),noBorder:!0,icon:e.createElement(je.Z,null)}),t&&e.createElement(L.x,{paddingLeft:1},e.createElement(ye.h,{forwardedAs:Et.rU,to:{pathname:`${f}/create/clone/${v.id}`,state:{from:f},search:E},label:g({id:"app.component.table.duplicate",defaultMessage:"Duplicate {target}"},{target:D}),noBorder:!0,icon:e.createElement(qd.Z,null)})),r&&e.createElement(L.x,{paddingLeft:1},e.createElement(ye.h,{onClick:()=>{b("willDeleteEntryFromList"),l(v.id)},label:g({id:"global.delete-target",defaultMessage:"Delete {target}"},{target:D}),noBorder:!0,icon:e.createElement(He.Z,null)})))))}))};wr.defaultProps={canCreate:!1,canDelete:!1,entriesToDelete:[],onClickDelete(){},onSelectRow(){},rows:[],withBulkActions:!1,withMainAction:!1},wr.propTypes={canCreate:n().bool,canDelete:n().bool,contentType:n().shape({uid:n().string.isRequired}).isRequired,entriesToDelete:n().array,headers:n().array.isRequired,onClickDelete:n().func,onSelectRow:n().func,rows:n().array,withBulkActions:n().bool,withMainAction:n().bool};var su=wr;const ys=({area:t,...r})=>{const o=Ut(t);return o?e.createElement("ul",null,o.map(s=>s.Component(r)?e.createElement(L.x,{key:s.name,padding:3,style:{textAlign:"center"}},e.createElement(s.Component,{...r})):null)):null};ys.propTypes={area:n().string.isRequired};var Es=ys;const bs=({isConfirmButtonLoading:t,isOpen:r,onToggleDialog:o,onConfirm:s})=>{const{formatMessage:a}=(0,H.Z)();return e.createElement(sn.V,{onClose:o,title:a({id:"app.components.ConfirmDialog.title",defaultMessage:"Confirmation"}),labelledBy:"confirmation",describedBy:"confirm-description",isOpen:r},e.createElement(an.a,{icon:e.createElement(Pt.Z,null)},e.createElement(P.k,{direction:"column",alignItems:"stretch",gap:2},e.createElement(P.k,{justifyContent:"center"},e.createElement(Q.Z,{id:"confirm-description"},a({id:(0,y.OB)("popUpWarning.bodyMessage.contentType.delete.all"),defaultMessage:"Are you sure you want to delete these entries?"}))),e.createElement(P.k,null,e.createElement(Es,{area:"contentManager.listView.deleteModalAdditionalInfos"})))),e.createElement(ln.c,{startAction:e.createElement(me.z,{onClick:o,variant:"tertiary"},a({id:"app.components.Button.cancel",defaultMessage:"Cancel"})),endAction:e.createElement(me.z,{onClick:s,variant:"danger-light",startIcon:e.createElement(He.Z,null),id:"confirm-delete",loading:t},a({id:"app.components.Button.confirm",defaultMessage:"Confirm"}))}))};bs.propTypes={isConfirmButtonLoading:n().bool.isRequired,isOpen:n().bool.isRequired,onConfirm:n().func.isRequired,onToggleDialog:n().func.isRequired};var au=bs;const vs=({isConfirmButtonLoading:t,isOpen:r,onToggleDialog:o,onConfirm:s})=>{const{formatMessage:a}=(0,H.Z)();return e.createElement(sn.V,{onClose:o,title:a({id:"app.components.ConfirmDialog.title",defaultMessage:"Confirmation"}),labelledBy:"confirmation",describedBy:"confirm-description",isOpen:r},e.createElement(an.a,{icon:e.createElement(Pt.Z,null)},e.createElement(P.k,{direction:"column",alignItems:"stretch",gap:2},e.createElement(P.k,{justifyContent:"center"},e.createElement(Q.Z,{id:"confirm-description"},a({id:"components.popUpWarning.message",defaultMessage:"Are you sure you want to delete this?"}))),e.createElement(P.k,null,e.createElement(Es,{area:"contentManager.listView.deleteModalAdditionalInfos"})))),e.createElement(ln.c,{startAction:e.createElement(me.z,{onClick:o,variant:"tertiary"},a({id:"app.components.Button.cancel",defaultMessage:"Cancel"})),endAction:e.createElement(me.z,{onClick:s,variant:"danger-light",startIcon:e.createElement(He.Z,null),id:"confirm-delete",loading:t},a({id:"app.components.Button.confirm",defaultMessage:"Confirm"}))}))};vs.propTypes={isConfirmButtonLoading:n().bool.isRequired,isOpen:n().bool.isRequired,onConfirm:n().func.isRequired,onToggleDialog:n().func.isRequired};var iu=vs;function Cs({isPublished:t}){const{formatMessage:r}=(0,H.Z)(),o=t?"success":"secondary";return e.createElement(Pn.q,{showBullet:!1,variant:o,size:"S",width:"min-content"},e.createElement(Q.Z,{fontWeight:"bold",textColor:`${o}700`},r({id:(0,y.OB)(`containers.List.${t?"published":"draft"}`),defaultMessage:t?"Published":"Draft"})))}Cs.propTypes={isPublished:n().bool.isRequired};const lu=(()=>window&&window.strapi&&window.strapi.isEE?d(57047).Z:d(42814).Z)(),Fr=t=>{let{canCreate:r,canDelete:o,contentTypeName:s,action:a,isBulkable:l,isLoading:i,onConfirmDelete:c,onConfirmDeleteAll:p,layout:u,rows:m}=t;const{runHookWaterfall:f}=(0,h.j1)(),g=u.contentType.options?.draftAndPublish??!1,{formatMessage:b}=(0,H.Z)(),E=(0,J.v9)(rs),v=(0,e.useMemo)(()=>{const T=f(Ae.No,{displayedHeaders:E,layout:u}).displayedHeaders.map(w=>{const{fieldSchema:k,metadatas:C,name:M}=w;return{...w,metadatas:{...C,label:b({id:(0,y.OB)(`containers.ListPage.table-headers.${M}`),defaultMessage:C.label})},name:k.type==="relation"?`${M}.${C.mainField.name}`:M}});g&&T.push({key:"__published_at_temp_key__",name:"publishedAt",fieldSchema:{type:"custom"},metadatas:{label:b({id:(0,y.OB)("containers.ListPage.table-headers.publishedAt"),defaultMessage:"publishedAt"}),searchable:!1,sortable:!0},cellFormatter(w){let{publishedAt:k}=w;return e.createElement(Cs,{isPublished:!!k})}});const D=lu(u);return D&&T.push(D),T},[f,E,u,g,b]);return e.createElement(h.tM,{components:{ConfirmDialogDelete:iu,ConfirmDialogDeleteAll:au},contentType:s,action:a,isLoading:i,headers:v,onConfirmDelete:c,onConfirmDeleteAll:p,onOpenDeleteAllModalTrackedEvent:"willBulkDeleteEntries",rows:m,withBulkActions:!0,withMainAction:o&&l},e.createElement(su,{canCreate:r,canDelete:o,contentType:u.contentType,headers:v,rows:m,withBulkActions:!0,withMainAction:o&&l}))};Fr.defaultProps={action:void 0},Fr.propTypes={canCreate:n().bool.isRequired,canDelete:n().bool.isRequired,contentTypeName:n().string.isRequired,action:n().node,isBulkable:n().bool.isRequired,isLoading:n().bool.isRequired,layout:n().exact({components:n().object.isRequired,contentType:n().shape({attributes:n().object.isRequired,metadatas:n().object.isRequired,layouts:n().shape({list:n().array.isRequired}).isRequired,options:n().object.isRequired,settings:n().object.isRequired}).isRequired}).isRequired,onConfirmDelete:n().func.isRequired,onConfirmDeleteAll:n().func.isRequired,rows:n().array.isRequired};var cu=Fr;const du=["json","component","media","richtext","dynamiczone","password"],uu=["createdAt","updatedAt"];var mu=(t,r)=>{const{allPermissions:o}=(0,h.vn)(),s=(0,h.ZT)(o,[{action:"plugin::content-manager.explorer.read",subject:r}]),a=x()(s,["0","properties","fields"],[]);return Object.keys(x()(t,["attributes"]),{}).filter(c=>{const p=x()(t,["attributes",c],{});return!(!p.type||du.includes(p.type)||!a.includes(c)&&c!=="id"&&!uu.includes(c))}).sort()},pu=d(5644);const Rs=({displayedFilters:t})=>{const[r,o]=(0,e.useState)(!1),{formatMessage:s}=(0,H.Z)(),a=(0,e.useRef)(),{trackUsage:l}=(0,h.rS)(),i=()=>{r||l("willFilterEntries"),o(c=>!c)};return e.createElement(e.Fragment,null,e.createElement(L.x,{paddingTop:1,paddingBottom:1},e.createElement(me.z,{variant:"tertiary",ref:a,startIcon:e.createElement(pu.Z,null),onClick:i,size:"S"},s({id:"app.utils.filters",defaultMessage:"Filters"})),r&&e.createElement(h.J5,{displayedFilters:t,isVisible:r,onToggle:i,source:a})),e.createElement(h.W$,{filtersSchema:t}))};Rs.propTypes={displayedFilters:n().arrayOf(n().shape({name:n().string.isRequired,metadatas:n().shape({label:n().string}),fieldSchema:n().shape({type:n().string})})).isRequired};var gu=Rs;const Ms=({contentType:t,slug:r,metadatas:o})=>{const{formatMessage:s}=(0,H.Z)(),l=mu(t,r).map(i=>{const c=t.attributes[i],{type:p,enum:u}=c,m={name:"didFilterEntries",properties:{useRelation:p==="relation"}},{mainField:f,label:g}=o[i].list;return{name:i,metadatas:{label:s({id:g,defaultMessage:g})},fieldSchema:{type:p,options:u,mainField:f},trackedEvent:m}});return e.createElement(gu,{displayedFilters:l})};Ms.propTypes={contentType:n().object.isRequired,metadatas:n().object.isRequired,slug:n().string.isRequired};var fu=Ms,hu=t=>Object.keys(t).reduce((o,s)=>{const a=t[s];return(0,y.ko)(a)&&o.push(s),o},[]).sort();const Ts=({layout:t})=>{const r=(0,J.I0)(),o=(0,J.v9)(rs),{trackUsage:s}=(0,h.rS)(),{formatMessage:a}=(0,H.Z)(),l=hu(t.contentType.attributes).map(p=>{const u=t.contentType.metadatas[p].list;return{name:p,intlLabel:{id:u.label,defaultMessage:u.label}}}),i=o.map(({name:p})=>p),c=p=>{if(s("didChangeDisplayedFields"),p.length<i.length){const u=i.filter(m=>p.indexOf(m)===-1);r(Ir({name:u[0],value:!0}))}else{const u=p.filter(m=>i.indexOf(m)===-1);r(Ir({name:u[0],value:!1}))}};return e.createElement(L.x,{paddingTop:1,paddingBottom:1},e.createElement(We.P,{"aria-label":"change displayed fields",value:i,onChange:c,customizeContent:p=>a({id:(0,be.Z)("select.currently.selected"),defaultMessage:"{count} currently selected"},{count:p.length}),multi:!0,size:"S"},l.map(p=>e.createElement(Ee.W,{key:p.name,value:p.name},a({id:p.intlLabel.id||p.name,defaultMessage:p.intlLabel.defaultMessage||p.name})))))};Ts.propTypes={layout:n().shape({contentType:n().shape({attributes:n().object.isRequired,metadatas:n().object.isRequired,layouts:n().shape({list:n().array.isRequired}).isRequired,options:n().object.isRequired,settings:n().object.isRequired}).isRequired}).isRequired};var yu=(0,e.memo)(Ts);const Lr=({pagination:t})=>e.createElement(L.x,{paddingTop:4},e.createElement(P.k,{alignItems:"flex-end",justifyContent:"space-between"},e.createElement(h.v4,{trackedEvent:"willChangeNumberOfEntriesPerPage"}),e.createElement(h.tU,{pagination:t})));Lr.defaultProps={pagination:{pageCount:0,pageSize:10,total:0}},Lr.propTypes={pagination:n().shape({page:n().number,pageCount:n().number,pageSize:n().number,total:n().number})};var Eu=Lr;const bu=ke.Z.contentManager,vu=(0,N.ZP)(L.x)`
|
|
996
|
-
svg {
|
|
997
|
-
path {
|
|
998
|
-
fill: ${({theme:t})=>t.colors.neutral900};
|
|
999
|
-
}
|
|
1000
|
-
}
|
|
1001
|
-
`;function Ds({canCreate:t,canDelete:r,canRead:o,data:s,getData:a,getDataSucceeded:l,isLoading:i,layout:c,pagination:p,slug:u}){const{total:m}=p,{contentType:f}=c,{metadatas:g,settings:{bulkable:b,filterable:E,searchable:v}}=f,I=(0,h.lm)(),{trackUsage:T}=(0,h.rS)(),{refetchPermissions:D}=(0,h.vn)(),w=(0,e.useRef)(T),k=(0,e.useRef)(D),{notifyStatus:C}=(0,kr.G)(),{formatAPIError:M}=(0,h.So)(y.OB);(0,h.go)();const[{query:F}]=(0,h.Kx)(),B=ko(F),U=(0,rn.stringify)({plugins:F.plugins},{encode:!1}),{pathname:A}=(0,te.TH)(),{push:G}=(0,te.k6)(),{formatMessage:$}=(0,H.Z)(),Y=f.options?.draftAndPublish??!1,j=(0,h.kY)(),{post:X,del:q}=j,W=(0,e.useRef)(""),R=(0,e.useCallback)(async(_,ae)=>{a();try{const z=ae?{cancelToken:ae.token}:null,{data:{results:ie,pagination:Te}}=await j.get(_,z);C($({id:(0,y.OB)("utils.data-loaded"),defaultMessage:"{number, plural, =1 {# entry has} other {# entries have}} successfully been loaded"},{number:Te.count})),l(Te,ie)}catch(z){if(ze.Z.isCancel(z))return;if((z?.response?.status??null)===403){await k.current(),I({type:"info",message:{id:(0,y.OB)("permissions.not-allowed.update")}}),G("/");return}I({type:"warning",message:{id:(0,y.OB)("error.model.fetch")}})}},[$,a,l,C,G,I,j]),Z=(0,e.useCallback)(async _=>{try{await X((0,y.IF)(`collection-types/${u}/actions/bulkDelete`),{ids:_});const ae=(0,y.IF)(`collection-types/${u}${B}`);R(ae),w.current("didBulkDeleteEntries")}catch(ae){I({type:"warning",message:M(ae)})}},[R,B,u,I,M,X]),V=(0,e.useCallback)(async _=>{try{await q((0,y.IF)(`collection-types/${u}/${_}`));const ae=(0,y.IF)(`collection-types/${u}${B}`);R(ae),I({type:"success",message:{id:(0,y.OB)("success.record.delete")}})}catch(ae){I({type:"warning",message:M(ae)})}},[u,B,R,I,M,q]);(0,e.useEffect)(()=>{const ae=ze.Z.CancelToken.source(),z=o,ie=(0,y.IF)(`collection-types/${u}${B}`);return z&&ie.includes(W.current)&&R(ie,ae),()=>{W.current=u,ae.cancel("Operation canceled by the user.")}},[o,a,u,B,l,R]);const K=$({id:(0,y.OB)("header.name"),defaultMessage:"Content"}),O=$({id:f.info.displayName,defaultMessage:f.info.displayName||K}),S=o?$({id:(0,y.OB)("pages.ListView.header-subtitle"),defaultMessage:"{number, plural, =0 {# entries} one {# entry} other {# entries}} found"},{number:m}):null,ne=_=>t?e.createElement(me.z,{..._,forwardedAs:Et.rU,onClick:()=>{const ae=Y?{status:"draft"}:{};w.current("willCreateEntry",ae)},to:{pathname:`${A}/create`,search:F.plugins?U:""},startIcon:e.createElement(Ft.Z,null),style:{textDecoration:"none"}},$({id:(0,y.OB)("HeaderLayout.button.label-add-entry"),defaultMessage:"Create new entry"})):null;return e.createElement(Ce.o,{"aria-busy":i},e.createElement(fe.T,{primaryAction:ne(),subtitle:S,title:O,navigationAction:e.createElement(h.rU,{startIcon:e.createElement(on.Z,null),to:"/content-manager/"},$({id:"global.back",defaultMessage:"Back"}))}),!o&&e.createElement(ns.Z,{endActions:e.createElement(Ht,{area:"contentManager.listView.actions"})}),o&&e.createElement(ns.Z,{endActions:e.createElement(e.Fragment,null,e.createElement(Ht,{area:"contentManager.listView.actions"}),e.createElement(yu,{layout:c}),e.createElement(h.jW,{permissions:bu.collectionTypesConfigurations},e.createElement(vu,{paddingTop:1,paddingBottom:1},e.createElement(ye.h,{onClick:()=>{T("willEditListLayout")},forwardedAs:Et.rU,to:{pathname:`${u}/configurations/list`,search:U},icon:e.createElement(qo.Z,null),label:$({id:"app.links.configure-view",defaultMessage:"Configure the view"})})))),startActions:e.createElement(e.Fragment,null,v&&e.createElement(h.m,{label:$({id:"app.component.search.label",defaultMessage:"Search for {target}"},{target:O}),placeholder:$({id:"global.search",defaultMessage:"Search"}),trackedEvent:"didSearch"}),E&&e.createElement(fu,{contentType:f,slug:u,metadatas:g}))}),e.createElement($e.D,null,o?e.createElement(e.Fragment,null,e.createElement(cu,{canCreate:t,canDelete:r,contentTypeName:O,onConfirmDeleteAll:Z,onConfirmDelete:V,isBulkable:b,isLoading:i,layout:c,rows:s,action:ne({variant:"secondary"})}),e.createElement(Eu,{pagination:{pageCount:p?.pageCount||1}})):e.createElement(h.ZF,null)))}Ds.propTypes={canCreate:n().bool.isRequired,canDelete:n().bool.isRequired,canRead:n().bool.isRequired,data:n().array.isRequired,layout:n().exact({components:n().object.isRequired,contentType:n().shape({attributes:n().object.isRequired,metadatas:n().object.isRequired,info:n().shape({displayName:n().string.isRequired}).isRequired,layouts:n().shape({list:n().array.isRequired}).isRequired,options:n().object.isRequired,settings:n().object.isRequired}).isRequired}).isRequired,isLoading:n().bool.isRequired,getData:n().func.isRequired,getDataSucceeded:n().func.isRequired,pagination:n().shape({total:n().number.isRequired,pageCount:n().number}).isRequired,slug:n().string.isRequired};const Cu=Ad();function Ru(t){return(0,ts.bindActionCreators)({getData:kd,getDataSucceeded:Od,onChangeListHeaders:Ir,onResetListHeaders:xd},t)}const Mu=(0,J.$j)(Cu,Ru);var Tu=(0,ts.compose)(Mu)((0,e.memo)(Ds,Oe()));const Sr=t=>{const r=(0,e.useMemo)(()=>(0,y.TA)(t.slug),[t.slug]),{isLoading:o,allowedActions:s}=(0,h.ss)(r,t.permissions);return o?e.createElement(h.dO,null):e.createElement(Tu,{...t,...s})};Sr.defaultProps={permissions:[]},Sr.propTypes={permissions:n().array,slug:n().string.isRequired};var Du=(0,e.memo)(Sr,(t,r)=>{const o=(0,h.e5)(t,r);return Object.keys(o).filter(a=>a!=="state").length>0});const Is=({layout:t,...r})=>{const o=(0,J.I0)(),{replace:s}=(0,te.k6)(),[{query:a,rawQuery:l}]=(0,h.Kx)(),i=(0,de.r5)(a,r.slug,"listView"),c=(0,de.Ky)(r.slug);return(0,e.useEffect)(()=>{l||s(c)},[l,s,c]),(0,e.useEffect)(()=>{o(wd(t))},[o,t]),(0,e.useEffect)(()=>()=>{o(Pd())},[o]),i?e.createElement(Du,{...r,layout:t,permissions:i}):null};Is.propTypes={layout:n().exact({components:n().object.isRequired,contentType:n().shape({attributes:n().object.isRequired,metadatas:n().object.isRequired,layouts:n().shape({list:n().array.isRequired}).isRequired,options:n().object.isRequired,settings:n().object.isRequired,pluginOptions:n().object}).isRequired}).isRequired,slug:n().string.isRequired};var Iu=Is,ku=(t,r)=>{const{put:o}=(0,h.tg)();return o((0,y.IF)(`content-types/${r}/configuration`),t)};const Ar=({modifiedData:t,onChange:r,sortOptions:o})=>{const{formatMessage:s}=(0,H.Z)(),{settings:a,metadatas:l}=t;return e.createElement(P.k,{direction:"column",alignItems:"stretch",gap:4},e.createElement(Q.Z,{variant:"delta",as:"h2"},s({id:(0,y.OB)("containers.SettingPage.settings"),defaultMessage:"Settings"})),e.createElement(P.k,{justifyContent:"space-between",gap:4},e.createElement(L.x,{width:"100%"},e.createElement(Zt.s,{label:s({id:(0,y.OB)("form.Input.search"),defaultMessage:"Enable search"}),onChange:i=>{r({target:{name:"settings.searchable",value:i.target.checked}})},onLabel:s({id:"app.components.ToggleCheckbox.on-label",defaultMessage:"on"}),offLabel:s({id:"app.components.ToggleCheckbox.off-label",defaultMessage:"off"}),name:"settings.searchable",checked:a.searchable})),e.createElement(L.x,{width:"100%"},e.createElement(Zt.s,{label:s({id:(0,y.OB)("form.Input.filters"),defaultMessage:"Enable filters"}),onChange:i=>{r({target:{name:"settings.filterable",value:i.target.checked}})},onLabel:s({id:"app.components.ToggleCheckbox.on-label",defaultMessage:"on"}),offLabel:s({id:"app.components.ToggleCheckbox.off-label",defaultMessage:"off"}),name:"settings.filterable",checked:a.filterable})),e.createElement(L.x,{width:"100%"},e.createElement(Zt.s,{label:s({id:(0,y.OB)("form.Input.bulkActions"),defaultMessage:"Enable bulk actions"}),onChange:i=>{r({target:{name:"settings.bulkable",value:i.target.checked}})},onLabel:s({id:"app.components.ToggleCheckbox.on-label",defaultMessage:"on"}),offLabel:s({id:"app.components.ToggleCheckbox.off-label",defaultMessage:"off"}),name:"settings.bulkable",checked:a.bulkable}))),e.createElement(De.r,{gap:4},e.createElement(ue.P,{s:12,col:6},e.createElement(We.P,{label:s({id:(0,y.OB)("form.Input.pageEntries"),defaultMessage:"Entries per page"}),hint:s({id:(0,y.OB)("form.Input.pageEntries.inputDescription"),defaultMessage:"Note: You can override this value in the Collection Type settings page."}),onChange:i=>r({target:{name:"settings.pageSize",value:i}}),name:"settings.pageSize",value:t.settings.pageSize||""},[10,20,50,100].map(i=>e.createElement(Ee.W,{key:i,value:i},i)))),e.createElement(ue.P,{s:12,col:3},e.createElement(We.P,{label:s({id:(0,y.OB)("form.Input.defaultSort"),defaultMessage:"Default sort attribute"}),onChange:i=>r({target:{name:"settings.defaultSortBy",value:i}}),name:"settings.defaultSortBy",value:t.settings.defaultSortBy||""},o.map(i=>e.createElement(Ee.W,{key:i,value:i},l[i].list.label||i)))),e.createElement(ue.P,{s:12,col:3},e.createElement(We.P,{label:s({id:(0,y.OB)("form.Input.sort.order"),defaultMessage:"Default sort order"}),onChange:i=>r({target:{name:"settings.defaultSortOrder",value:i}}),name:"settings.defaultSortOrder",value:t.settings.defaultSortOrder||""},["ASC","DESC"].map(i=>e.createElement(Ee.W,{key:i,value:i},i))))))};Ar.defaultProps={modifiedData:{},sortOptions:[]},Ar.propTypes={modifiedData:n().object,onChange:n().func.isRequired,sortOptions:n().array};var Ou=Ar;const $r=(0,N.ZP)(P.k)`
|
|
1002
|
-
height: ${({theme:t})=>t.spaces[7]};
|
|
1003
|
-
|
|
1004
|
-
&:last-child {
|
|
1005
|
-
padding: 0 ${({theme:t})=>t.spaces[3]};
|
|
1006
|
-
}
|
|
1007
|
-
`,xu=(0,N.ZP)($r)`
|
|
1008
|
-
border-right: 1px solid
|
|
1009
|
-
${({theme:t,isSibling:r})=>r?t.colors.neutral150:t.colors.primary200};
|
|
1010
|
-
|
|
1011
|
-
svg {
|
|
1012
|
-
width: ${12/16}rem;
|
|
1013
|
-
height: ${12/16}rem;
|
|
1014
|
-
}
|
|
1015
|
-
`,Pu=(0,N.ZP)(P.k)`
|
|
1016
|
-
border: 1px solid
|
|
1017
|
-
${({theme:t,isSibling:r})=>r?t.colors.neutral150:t.colors.primary200};
|
|
1018
|
-
|
|
1019
|
-
svg {
|
|
1020
|
-
width: ${10/16}rem;
|
|
1021
|
-
height: ${10/16}rem;
|
|
1022
|
-
|
|
1023
|
-
path {
|
|
1024
|
-
fill: ${({theme:t,isSibling:r})=>r?void 0:t.colors.primary600};
|
|
1025
|
-
}
|
|
1026
|
-
}
|
|
1027
|
-
`,wu=(0,N.ZP)(Q.Z)`
|
|
1028
|
-
max-width: ${72/16}rem;
|
|
1029
|
-
`;function Bt({labelField:t,transparent:r,isSibling:o}){return e.createElement(Pu,{background:o?"neutral100":"primary100",display:"inline-flex",gap:3,hasRadius:!0,justifyContent:"space-between",transparent:r,isSibling:o,"max-height":(0,h.Q1)(32),maxWidth:"min-content",opacity:r?0:1},e.createElement(P.k,{gap:3},e.createElement(xu,{alignItems:"center",cursor:"all-scroll",padding:3},e.createElement(Je.Z,null)),e.createElement(wu,{textColor:o?void 0:"primary600",fontWeight:"bold",ellipsis:!0},t)),e.createElement(P.k,null,e.createElement($r,{alignItems:"center"},e.createElement(je.Z,null)),e.createElement($r,{alignItems:"center"},e.createElement(Kt.Z,null))))}Bt.defaultProps={isSibling:!1,transparent:!1},Bt.propTypes={isSibling:n().bool,labelField:n().string.isRequired,transparent:n().bool};const Zr=N.ZP.button`
|
|
1030
|
-
display: flex;
|
|
1031
|
-
align-items: center;
|
|
1032
|
-
height: ${({theme:t})=>t.spaces[7]};
|
|
1033
|
-
|
|
1034
|
-
&:last-child {
|
|
1035
|
-
padding: 0 ${({theme:t})=>t.spaces[3]};
|
|
1036
|
-
}
|
|
1037
|
-
`,ks=(0,N.ZP)(Zr)`
|
|
1038
|
-
padding: 0 ${({theme:t})=>t.spaces[3]};
|
|
1039
|
-
border-right: 1px solid ${({theme:t})=>t.colors.neutral150};
|
|
1040
|
-
cursor: all-scroll;
|
|
1041
|
-
|
|
1042
|
-
svg {
|
|
1043
|
-
width: ${12/16}rem;
|
|
1044
|
-
height: ${12/16}rem;
|
|
1045
|
-
}
|
|
1046
|
-
`,Fu=(0,N.ZP)(P.k)`
|
|
1047
|
-
max-height: ${32/16}rem;
|
|
1048
|
-
cursor: pointer;
|
|
1049
|
-
|
|
1050
|
-
svg {
|
|
1051
|
-
width: ${10/16}rem;
|
|
1052
|
-
height: ${10/16}rem;
|
|
1053
|
-
|
|
1054
|
-
path {
|
|
1055
|
-
fill: ${({theme:t})=>t.colors.neutral600};
|
|
1056
|
-
}
|
|
1057
|
-
}
|
|
1058
|
-
|
|
1059
|
-
&:hover {
|
|
1060
|
-
background-color: ${({theme:t})=>t.colors.primary100};
|
|
1061
|
-
border-color: ${({theme:t})=>t.colors.primary200};
|
|
1062
|
-
|
|
1063
|
-
svg {
|
|
1064
|
-
path {
|
|
1065
|
-
fill: ${({theme:t})=>t.colors.primary600};
|
|
1066
|
-
}
|
|
1067
|
-
}
|
|
1068
|
-
|
|
1069
|
-
${Q.Z} {
|
|
1070
|
-
color: ${({theme:t})=>t.colors.primary600};
|
|
1071
|
-
}
|
|
1072
|
-
|
|
1073
|
-
${ks} {
|
|
1074
|
-
border-right: 1px solid ${({theme:t})=>t.colors.primary200};
|
|
1075
|
-
}
|
|
1076
|
-
}
|
|
1077
|
-
`,Lu=(0,N.ZP)(L.x)`
|
|
1078
|
-
&:last-child {
|
|
1079
|
-
padding-right: ${({theme:t})=>t.spaces[3]};
|
|
1080
|
-
}
|
|
1081
|
-
`,Os=({index:t,isDraggingSibling:r,labelField:o,onClickEditField:s,onMoveField:a,onRemoveField:l,name:i,setIsDraggingSibling:c})=>{const{formatMessage:p}=(0,H.Z)(),u=(0,e.useRef)(null),m=(0,e.useRef)(null),[,f]=(0,e.useState)(!1),g=(0,e.useRef)(),b=()=>{g.current&&g.current.click()},[,E]=(0,dn.useDrop)({accept:y._Q.FIELD,hover(w,k){if(!m.current)return;const C=w.index,M=t;if(C===M)return;const F=m.current.getBoundingClientRect(),B=(F.right-F.left)/2,A=k.getClientOffset().x-F.left;C>M&&A>B||C<M&&A<B||(a(C,M),w.index=M)}}),[{isDragging:v},I,T]=(0,dn.useDrag)({type:y._Q.FIELD,item(){return{index:t,labelField:o,name:i}},collect:w=>({isDragging:w.isDragging()}),end(){c(!1)}});(0,e.useEffect)(()=>{T((0,Ot.rX)(),{captureDraggingState:!1})},[T]),(0,e.useEffect)(()=>{v&&c(!0)},[v,c]),(0,e.useEffect)(()=>{r||f(w=>!w)},[r]);const D={dragRef:I(u),dropRef:E(m)};return e.createElement(Lu,{ref:D?D.dropRef:null},v&&e.createElement(Bt,{transparent:!0,labelField:o}),!v&&r&&e.createElement(Bt,{isSibling:!0,labelField:o}),!v&&!r&&e.createElement(Fu,{borderColor:"neutral150",background:"neutral100",hasRadius:!0,justifyContent:"space-between",onClick:b,isDragging:v},e.createElement(P.k,{gap:3},e.createElement(ks,{as:"span","aria-label":p({id:(0,y.OB)("components.DraggableCard.move.field"),defaultMessage:"Move {item}"},{item:o}),onClick:w=>w.stopPropagation(),ref:D.dragRef,type:"button"},e.createElement(Je.Z,null)),e.createElement(Q.Z,{fontWeight:"bold"},o)),e.createElement(P.k,{paddingLeft:3},e.createElement(Zr,{ref:g,onClick:w=>{w.stopPropagation(),s(i)},"aria-label":p({id:(0,y.OB)("components.DraggableCard.edit.field"),defaultMessage:"Edit {item}"},{item:o}),type:"button"},e.createElement(je.Z,null)),e.createElement(Zr,{onClick:l,"data-testid":`delete-${i}`,"aria-label":p({id:(0,y.OB)("components.DraggableCard.delete.field"),defaultMessage:"Delete {item}"},{item:o}),type:"button"},e.createElement(Kt.Z,null)))))};Os.propTypes={index:n().number.isRequired,isDraggingSibling:n().bool.isRequired,labelField:n().string.isRequired,name:n().string.isRequired,onClickEditField:n().func.isRequired,onMoveField:n().func.isRequired,onRemoveField:n().func.isRequired,setIsDraggingSibling:n().func.isRequired};var Su=Os;const xs=(0,N.ZP)(L.x)`
|
|
1082
|
-
flex: ${({size:t})=>t};
|
|
1083
|
-
`,Au=(0,N.ZP)(xs)`
|
|
1084
|
-
overflow-x: scroll;
|
|
1085
|
-
overflow-y: hidden;
|
|
1086
|
-
`,$u=(0,N.ZP)(xs)`
|
|
1087
|
-
max-width: ${32/16}rem;
|
|
1088
|
-
`,Ps=({displayedFields:t,listRemainingFields:r,metadatas:o,onAddField:s,onClickEditField:a,onMoveField:l,onRemoveField:i})=>{const{formatMessage:c}=(0,H.Z)(),[p,u]=(0,e.useState)(!1),[m,f]=(0,e.useState)(null),g=(0,e.useRef)();function b(...v){f("add"),s(...v)}function E(...v){f("remove"),i(...v)}return(0,e.useEffect)(()=>{m==="add"&&g?.current&&(g.current.scrollLeft=g.current.scrollWidth)},[t,m]),e.createElement(e.Fragment,null,e.createElement(L.x,{paddingBottom:4},e.createElement(Q.Z,{variant:"delta",as:"h2"},c({id:(0,y.OB)("containers.SettingPage.view"),defaultMessage:"View"}))),e.createElement(P.k,{paddingTop:4,paddingLeft:4,paddingRight:4,borderColor:"neutral300",borderStyle:"dashed",borderWidth:"1px",hasRadius:!0},e.createElement(Au,{size:"1",paddingBottom:4,ref:g},e.createElement(P.k,{gap:3},t.map((v,I)=>e.createElement(Su,{key:v,index:I,isDraggingSibling:p,onMoveField:l,onClickEditField:a,onRemoveField:T=>E(T,I),name:v,labelField:o[v].list.label||v,setIsDraggingSibling:u})))),e.createElement($u,{size:"auto",paddingBottom:4},e.createElement(Ve.O,{label:c({id:(0,y.OB)("components.FieldSelect.label"),defaultMessage:"Add a field"}),as:ye.h,icon:e.createElement(Ft.Z,null),disabled:r.length<=0,"data-testid":"add-field"},r.map(v=>e.createElement(Ve.s,{key:v,onClick:()=>b(v)},o[v].list.label||v))))))};Ps.propTypes={displayedFields:he.PropTypes.array.isRequired,listRemainingFields:he.PropTypes.array.isRequired,metadatas:he.PropTypes.objectOf(he.PropTypes.shape({list:he.PropTypes.shape({label:he.PropTypes.string})})).isRequired,onAddField:he.PropTypes.func.isRequired,onClickEditField:he.PropTypes.func.isRequired,onMoveField:he.PropTypes.func.isRequired,onRemoveField:he.PropTypes.func.isRequired};var Zu=Ps;const Bu=(0,N.ZP)(P.k)`
|
|
1089
|
-
svg {
|
|
1090
|
-
width: ${32/16}rem;
|
|
1091
|
-
height: ${24/16}rem;
|
|
1092
|
-
margin-right: ${({theme:t})=>t.spaces[3]};
|
|
1093
|
-
}
|
|
1094
|
-
`,ws=({attributes:t,fieldForm:r,fieldToEdit:o,onCloseModal:s,onChangeEditLabel:a,onSubmit:l,type:i})=>{const{formatMessage:c}=(0,H.Z)(),p=t[o].relationType;let u=!["media","relation"].includes(i);return["oneWay","oneToOne","manyToOne"].includes(p)&&(u=!0),e.createElement(Ho.P,{onClose:s,labelledBy:"title"},e.createElement("form",{onSubmit:l},e.createElement(Qo.x,null,e.createElement(Bu,null,e.createElement(Jo,{type:i}),e.createElement(Q.Z,{fontWeight:"bold",textColor:"neutral800",as:"h2",id:"title"},c({id:(0,y.OB)("containers.ListSettingsView.modal-form.edit-label"),defaultMessage:"Edit {fieldName}"},{fieldName:At()(o)})))),e.createElement(Go.f,null,e.createElement(De.r,{gap:4},e.createElement(ue.P,{s:12,col:6},e.createElement(kn.o,{id:"label-input",label:c({id:(0,y.OB)("form.Input.label"),defaultMessage:"Label"}),name:"label",onChange:m=>a(m),value:r.label,hint:c({id:(0,y.OB)("form.Input.label.inputDescription"),defaultMessage:"This value overrides the label displayed in the table's head"})})),u&&e.createElement(ue.P,{s:12,col:6},e.createElement(Zt.s,{"data-testid":"Enable sort on this field",checked:r.sortable,label:c({id:(0,y.OB)("form.Input.sort.field"),defaultMessage:"Enable sort on this field"}),name:"sortable",onChange:m=>a({target:{name:"sortable",value:m.target.checked}}),onLabel:c({id:"app.components.ToggleCheckbox.on-label",defaultMessage:"on"}),offLabel:c({id:"app.components.ToggleCheckbox.off-label",defaultMessage:"off"})})))),e.createElement(Ko.m,{startActions:e.createElement(me.z,{onClick:s,variant:"tertiary"},c({id:"app.components.Button.cancel",defaultMessage:"Cancel"})),endActions:e.createElement(me.z,{type:"submit"},c({id:"global.finish",defaultMessage:"Finish"}))})))};ws.propTypes={attributes:n().objectOf(n().shape({relationType:n().string})).isRequired,fieldForm:n().shape({label:n().string,sortable:n().bool}).isRequired,fieldToEdit:n().string.isRequired,onChangeEditLabel:n().func.isRequired,onCloseModal:n().func.isRequired,onSubmit:n().func.isRequired,type:n().string.isRequired};var qu=ws,Nu=(t,r)=>({...t,initialData:r,modifiedData:r});const Br={fieldForm:{},fieldToEdit:"",initialData:{},modifiedData:{}};var ju=(t=Br,r)=>(0,sr.ZP)(t,o=>{const s=["modifiedData","layouts","list"];switch(r.type){case"ADD_FIELD":{const a=x()(t,s,[]);se()(o,s,[...a,r.item]);break}case"MOVE_FIELD":{const a=x()(t,s,[]),{originalIndex:l,atIndex:i}=r;se()(o,s,(0,y.W3)(a,l,i));break}case"ON_CHANGE":{se()(o,["modifiedData",...r.keys.split(".")],r.value);break}case"ON_CHANGE_FIELD_METAS":{se()(o,["fieldForm",r.name],r.value);break}case"REMOVE_FIELD":{const a=x()(t,s,[]);se()(o,s,a.filter((l,i)=>r.index!==i));break}case"SET_FIELD_TO_EDIT":{const{fieldToEdit:a}=r;o.fieldToEdit=a,o.fieldForm.label=x()(o,["modifiedData","metadatas",a,"list","label"],""),o.fieldForm.sortable=x()(o,["modifiedData","metadatas",a,"list","sortable"],"");break}case"UNSET_FIELD_TO_EDIT":{o.fieldForm={},o.fieldToEdit="";break}case"SUBMIT_FIELD_FORM":{const a=["modifiedData","metadatas",t.fieldToEdit,"list"];se()(o,[...a,"label"],t.fieldForm.label),se()(o,[...a,"sortable"],t.fieldForm.sortable);break}default:return o}});const Wu=["media","richtext","dynamiczone","relation","component","json"],Fs=({layout:t,slug:r})=>{const{formatMessage:o}=(0,H.Z)(),{trackUsage:s}=(0,h.rS)(),a=(0,de.fi)(),l=(0,h.lm)(),{refetchData:i}=(0,e.useContext)(Se),[c,p]=(0,e.useState)(!1),u=()=>p(R=>!R),[m,f]=(0,e.useReducer)(ju,Br,()=>Nu(Br,t)),{fieldToEdit:g,fieldForm:b,initialData:E,modifiedData:v}=m,I=!Re()(b),{attributes:T}=t,D=v.layouts.list,w=()=>{const{settings:{pageSize:R,defaultSortBy:Z,defaultSortOrder:V},kind:K,uid:O}=E,S=`${Z}:${V}`,ne=`${(0,rn.stringify)({page:1,pageSize:R,sort:S},{encode:!1})}${a?`&${a}`:""}`;return`/content-manager/${K}/${O}?${ne}`},k=({target:{name:R,value:Z}})=>{f({type:"ON_CHANGE",keys:R,value:R==="settings.pageSize"?parseInt(Z,10):Z})},C=async()=>{const R=xn()(v,["layouts","settings","metadatas"]);$.mutate(R)},M=R=>{f({type:"ADD_FIELD",item:R})},F=(R,Z)=>{R.stopPropagation(),D.length===1?l({type:"info",message:{id:(0,y.OB)("notification.info.minimumFields")}}):f({type:"REMOVE_FIELD",index:Z})},B=R=>{R.preventDefault(),u(),s("willSaveContentTypeLayout")},U=R=>{f({type:"SET_FIELD_TO_EDIT",fieldToEdit:R})},A=()=>{f({type:"UNSET_FIELD_TO_EDIT"})},G=R=>{R.preventDefault(),f({type:"SUBMIT_FIELD_FORM"}),A()},$=(0,ot.useMutation)(R=>ku(R,r),{onSuccess(){s("didEditListSettings"),i()},onError(){l({type:"warning",message:{id:"notification.error"}})}}),{isLoading:Y}=$,j=({target:{name:R,value:Z}})=>{f({type:"ON_CHANGE_FIELD_METAS",name:R,value:Z})},X=Object.entries(T).reduce((R,Z)=>{const[V,K]=Z,O=(0,y.ko)(K),S=D.includes(V);return O&&!S&&R.push(V),R},[]).sort(),q=Object.entries(T).reduce((R,Z)=>{const[V,{type:K}]=Z;return Wu.includes(K)||R.push(V),R},[]),W=(R,Z)=>{f({type:"MOVE_FIELD",originalIndex:R,atIndex:Z})};return e.createElement(Pe.A,null,e.createElement(Ce.o,{"aria-busy":Y},e.createElement("form",{onSubmit:B},e.createElement(fe.T,{navigationAction:e.createElement(h.rU,{startIcon:e.createElement(on.Z,null),to:w,id:"go-back"},o({id:"global.back",defaultMessage:"Back"})),primaryAction:e.createElement(me.z,{size:"S",startIcon:e.createElement(ht.Z,null),disabled:Lt()(v,E),type:"submit"},o({id:"global.save",defaultMessage:"Save"})),subtitle:o({id:(0,y.OB)("components.SettingsViewWrapper.pluginHeader.description.list-settings"),defaultMessage:"Define the settings of the list view."}),title:o({id:(0,y.OB)("components.SettingsViewWrapper.pluginHeader.title"),defaultMessage:"Configure the view - {name}"},{name:At()(v.info.displayName)})}),e.createElement($e.D,null,e.createElement(L.x,{background:"neutral0",hasRadius:!0,shadow:"tableShadow",paddingTop:6,paddingBottom:6,paddingLeft:7,paddingRight:7},e.createElement(Ou,{modifiedData:v,onChange:k,sortOptions:q}),e.createElement(L.x,{paddingTop:6,paddingBottom:6},e.createElement($o.i,null)),e.createElement(Zu,{listRemainingFields:X,displayedFields:D,onAddField:M,onClickEditField:U,onMoveField:W,onRemoveField:F,metadatas:v.metadatas}))),e.createElement(h.QH,{bodyText:{id:(0,y.OB)("popUpWarning.warning.updateAllSettings"),defaultMessage:"This will modify all your settings"},iconRightButton:e.createElement(ht.Z,null),isConfirmButtonLoading:Y,isOpen:c,onToggleDialog:u,onConfirm:C,variantRightButton:"success-light"})),I&&e.createElement(qu,{attributes:T,fieldForm:b,fieldToEdit:g,onChangeEditLabel:j,onCloseModal:A,onSubmit:G,type:x()(T,[g,"type"],"text")})))};Fs.propTypes={layout:n().shape({uid:n().string.isRequired,settings:n().shape({bulkable:n().bool,defaultSortBy:n().string,defaultSortOrder:n().string,filterable:n().bool,pageSize:n().number,searchable:n().bool}).isRequired,metadatas:n().object.isRequired,options:n().object.isRequired,attributes:n().objectOf(n().shape({type:n().string})).isRequired}).isRequired,slug:n().string.isRequired};var zu=(0,e.memo)(Fs),Vu=()=>e.createElement(L.x,{padding:8},e.createElement(h.Hn,null));const Ls=ke.Z.contentManager,Ss=({match:{params:{slug:t},url:r}})=>{const{isLoading:o,layout:s,updateLayout:a}=(0,de.zE)(t),{rawContentTypeLayout:l,rawComponentsLayouts:i}=(0,e.useMemo)(()=>{let m={},f={};return s.contentType&&(m=(0,y.du)(s.contentType)),s.components&&(f=Object.keys(s.components).reduce((g,b)=>(g[b]=(0,y.du)(s.components[b]),g),{})),{rawContentTypeLayout:m,rawComponentsLayouts:f}},[s]);if((s?.contentType?.uid??null)!==t||o)return e.createElement(h.dO,null);const p=({location:{state:m},history:{goBack:f},match:{params:{id:g,origin:b}}},E)=>e.createElement(E,{slug:t,layout:s,state:m,goBack:f,id:g,origin:b}),u=[{path:"create/clone/:origin",comp:cn},{path:"create",comp:cn},{path:":id",comp:cn},{path:"",comp:Iu}].map(({path:m,comp:f})=>e.createElement(te.AW,{key:m,path:`${r}/${m}`,render:g=>p(g,f)}));return e.createElement(Rt.ErrorBoundary,{FallbackComponent:Vu},e.createElement(Ne.Provider,{value:s},e.createElement(te.rs,null,e.createElement(te.AW,{path:`${r}/configurations/list`},e.createElement(h.O4,{permissions:Ls.collectionTypesConfigurations},e.createElement(zu,{layout:l,slug:t,updateLayout:a}))),e.createElement(te.AW,{path:`${r}/configurations/edit`},e.createElement(h.O4,{permissions:Ls.collectionTypesConfigurations},e.createElement(Dr,{components:i,isContentTypeView:!0,mainLayout:l,slug:t,updateLayout:a}))),u)))};Ss.propTypes={match:n().shape({url:n().string.isRequired,params:n().shape({slug:n().string.isRequired}).isRequired}).isRequired};var Uu=(0,e.memo)(Ss),As=d(57678);const Hu=ke.Z.contentManager,Qu=()=>{const[{isLoading:t,data:r},o]=(0,e.useReducer)(As.Z,As.q),s=(0,e.useMemo)(bt.Vo,[]),{schemas:a}=(0,J.v9)(c=>s(c),J.wU),{uid:l}=(0,te.UO)(),{get:i}=(0,h.kY)();return(0,e.useEffect)(()=>{const p=ze.Z.CancelToken.source();return(async m=>{try{o(tn());const{data:{data:f}}=await i((0,y.IF)(`components/${l}/configuration`),{cancelToken:m.token});o(tr((0,y.w8)(f,a,"component")))}catch(f){if(ze.Z.isCancel(f))return;console.error(f)}})(p),()=>{p.cancel("Operation canceled by the user.")}},[l,a,i]),t?e.createElement(h.dO,null):e.createElement(h.O4,{permissions:Hu.componentsConfigurations},e.createElement(Dr,{components:r.components,mainLayout:r.component,slug:l}))};var Gu=(0,e.memo)(Qu),Ku=d(9695),Yu=d(54725),Xu=()=>{const{formatMessage:t}=(0,H.Z)();return(0,h.go)(),e.createElement(Ce.o,null,e.createElement(fe.T,{title:t({id:(0,y.OB)("header.name"),defaultMessage:"Content"})}),e.createElement($e.D,null,e.createElement(Ku.x,{action:e.createElement(h.Qj,{variant:"secondary",startIcon:e.createElement(Ft.Z,null),to:"/plugins/content-type-builder/content-types/create-content-type"},t({id:"app.components.HomePage.create",defaultMessage:"Create your first Content-type"})),content:t({id:"content-manager.pages.NoContentType.text",defaultMessage:"You don't have any content yet, we recommend you to create your first Content-Type."}),hasRadius:!0,icon:e.createElement(Yu.Z,{width:"10rem"}),shadow:"tableShadow"})))},Ju=()=>{const{formatMessage:t}=(0,H.Z)();return(0,h.go)(),e.createElement(Ce.o,null,e.createElement(fe.T,{title:t({id:(0,y.OB)("header.name"),defaultMessage:"Content"})}),e.createElement($e.D,null,e.createElement(h.ZF,null)))};const _u=ke.Z.contentManager,$s=({match:{params:{slug:t},url:r}})=>{const{isLoading:o,layout:s,updateLayout:a}=(0,de.zE)(t),{rawContentTypeLayout:l,rawComponentsLayouts:i}=(0,e.useMemo)(()=>{let c={},p={};return s.contentType&&(p=(0,y.du)(s.contentType)),s.components&&(c=Object.keys(s.components).reduce((u,m)=>(u[m]=(0,y.du)(s.components[m]),u),{})),{rawContentTypeLayout:p,rawComponentsLayouts:c}},[s]);return o?e.createElement(h.dO,null):e.createElement(Ne.Provider,{value:s},e.createElement(te.rs,null,e.createElement(te.AW,{path:`${r}/configurations/edit`},e.createElement(h.O4,{permissions:_u.singleTypesConfigurations},e.createElement(Dr,{components:i,isContentTypeView:!0,mainLayout:l,slug:t,updateLayout:a}))),e.createElement(te.AW,{path:r,render:({location:{state:c},history:{goBack:p}})=>e.createElement(cn,{layout:s,slug:t,isSingleType:!0,state:c,goBack:p})})))};$s.propTypes={match:n().shape({url:n().string.isRequired,params:n().shape({slug:n().string.isRequired}).isRequired}).isRequired};var em=(0,e.memo)($s),tm=d(90700),nm=d(78090),rm=d(77013),om=d(79318),sm=d(66618),am=()=>{const[t,r]=(0,e.useState)(""),{formatMessage:o,locale:s}=(0,H.Z)(),a=(0,e.useMemo)(bt.KQ,[]),{collectionTypeLinks:l,singleTypeLinks:i}=(0,J.v9)(a,J.wU),{startsWith:c}=(0,h.L0)(s,{sensitivity:"base"}),p=(0,h.Xe)(s,{sensitivity:"base"}),u=(0,e.useMemo)(()=>[{id:"collectionTypes",title:{id:(0,be.Z)("components.LeftMenu.collection-types"),defaultMessage:"Collection Types"},searchable:!0,links:l},{id:"singleTypes",title:{id:(0,be.Z)("components.LeftMenu.single-types"),defaultMessage:"Single Types"},searchable:!0,links:i}].map(b=>({...b,links:b.links.filter(E=>c(E.title,t)).sort((E,v)=>p.compare(E.title,v.title)).map(E=>({...E,title:o({id:E.title,defaultMessage:E.title})}))})),[l,t,i,c,o,p]),m=()=>{r("")},f=({target:{value:b}})=>{r(b)},g=o({id:(0,be.Z)("header.name"),defaultMessage:"Content"});return e.createElement(tm.m,{ariaLabel:g},e.createElement(nm.p,{label:g,searchable:!0,value:t,onChange:f,onClear:m,searchLabel:o({id:"content-manager.components.LeftMenu.Search.label",defaultMessage:"Search for a content type"})}),e.createElement(rm.Z,null,u.map(b=>{const E=o({id:b.title.id,defaultMessage:b.title.defaultMessage},b.title.values);return e.createElement(om.D,{key:b.id,label:E,badgeLabel:b.links.length.toString()},b.links.map(v=>{const I=v.search?`?${v.search}`:"";return e.createElement(sm.E,{as:Et.OL,key:v.uid,to:`${v.to}${I}`},v.title)}))})))},qr=d(92886);const im=()=>({type:qr.fn}),lm=()=>({type:qr.sZ}),cm=({authorizedCollectionTypeLinks:t,authorizedSingleTypeLinks:r,contentTypeSchemas:o,components:s,fieldSizes:a})=>({type:qr.IX,data:{authorizedCollectionTypeLinks:t,authorizedSingleTypeLinks:r,components:s,contentTypeSchemas:o,fieldSizes:a}}),Zs=(t,r,o=[])=>t.filter(s=>s.isDisplayed).map(s=>{const a=[{action:"plugin::content-manager.explorer.create",subject:s.uid},{action:"plugin::content-manager.explorer.read",subject:s.uid}],l=[{action:"plugin::content-manager.explorer.read",subject:s.uid}],i=r==="collectionTypes"?a:l,c=o.find(({uid:u})=>u===s.uid);let p=null;if(c){const u={page:1,pageSize:c.settings.pageSize,sort:`${c.settings.defaultSortBy}:${c.settings.defaultSortOrder}`};p=(0,rn.stringify)(u,{encode:!1})}return{permissions:i,search:p,kind:s.kind,title:s.info.displayName,to:`/content-manager/${s.kind}/${s.uid}`,uid:s.uid,name:s.uid,isDisplayed:s.isDisplayed}});var dm=(t,r)=>{const o=Object.entries(Co()(t,"kind")).map(([l,i])=>({name:l,links:i})),[s,a]=we()(o,"name");return{collectionTypeSectionLinks:Zs(s?.links||[],"collectionTypes",r),singleTypeSectionLinks:Zs(a?.links??[],"singleTypes")}},Bs=(t,r)=>r.map(({permissions:o})=>(0,h.qX)(t,o)),um=async({models:t,userPermissions:r,toggleNotification:o})=>{const{get:s}=(0,h.tg)();try{const{data:{data:a}}=await s((0,y.IF)("content-types-settings")),{collectionTypeSectionLinks:l,singleTypeSectionLinks:i}=dm(t,a),c=await Promise.all(Bs(r,l)),p=l.filter((f,g)=>c[g]),u=await Promise.all(Bs(r,i)),m=i.filter((f,g)=>u[g]);return{authorizedCollectionTypeLinks:p,authorizedSingleTypeLinks:m}}catch(a){return console.error(a),o({type:"warning",message:{id:"notification.error"}}),{authorizedCollectionTypeLinks:[],authorizedSingleTypeLinks:[]}}},mm=()=>{const t=(0,J.I0)(),r=(0,h.lm)(),o=(0,J.v9)((0,bt.Yg)()),s=(0,e.useRef)(),{allPermissions:a}=(0,h.vn)(),{runHookWaterfall:l}=(0,h.j1)(),c=ze.Z.CancelToken.source(),{notifyStatus:p}=(0,kr.G)(),{formatMessage:u}=(0,H.Z)(),{get:m}=(0,h.kY)(),f=async()=>{t(im());try{const{data:{data:{components:g,contentTypes:b,fieldSizes:E}}}=await m((0,y.IF)("init"),{cancelToken:c.token});p(u({id:(0,y.OB)("App.schemas.data-loaded"),defaultMessage:"The schemas have been successfully loaded."}));const v=await um({models:b,userPermissions:a,toggleNotification:r}),{ctLinks:I}=l(Ae.LK,{ctLinks:v.authorizedCollectionTypeLinks,models:b}),{stLinks:T}=l(Ae.dV,{stLinks:v.authorizedSingleTypeLinks,models:b}),D=cm({authorizedCollectionTypeLinks:I,authorizedSingleTypeLinks:T,contentTypeSchemas:b,components:g,fieldSizes:E});t(D)}catch(g){if(ze.Z.isCancel(g))return;console.error(g),r({type:"warning",message:{id:"notification.error"}})}};return s.current=f,(0,e.useEffect)(()=>(s.current(),()=>{c.cancel("Operation canceled by the user."),t(lm())}),[t,r]),{...o,refetchData:s.current}},qt=d(25708),pm=d(16899);const gm=(0,N.ZP)(P.k)`
|
|
1095
|
-
border-radius: 50%;
|
|
1096
|
-
|
|
1097
|
-
svg {
|
|
1098
|
-
height: ${6/16}rem;
|
|
1099
|
-
width: ${11/16}rem;
|
|
1100
|
-
> path {
|
|
1101
|
-
fill: ${({theme:t})=>t.colors.neutral600};
|
|
1102
|
-
}
|
|
1103
|
-
}
|
|
1104
|
-
`,fm=N.ZP.button`
|
|
1105
|
-
border: none;
|
|
1106
|
-
background: transparent;
|
|
1107
|
-
display: block;
|
|
1108
|
-
width: 100%;
|
|
1109
|
-
text-align: unset;
|
|
1110
|
-
padding: 0;
|
|
1111
|
-
`;function qs({displayedValue:t}){return e.createElement(P.k,{background:"neutral0",borderColor:"neutral200",justifyContent:"space-between",gap:3,padding:3,width:(0,h.Q1)(300)},e.createElement(fm,{type:"button"},e.createElement(P.k,{gap:6},e.createElement(gm,{alignItems:"center",justifyContent:"center",background:"neutral200",height:(0,h.Q1)(32),width:(0,h.Q1)(32)},e.createElement(pm.Z,null)),e.createElement(P.k,{maxWidth:(0,h.Q1)(150)},e.createElement(Q.Z,{textColor:"neutral700",ellipsis:!0},t)))),e.createElement(P.k,{gap:2},e.createElement(ye.h,{noBorder:!0},e.createElement(He.Z,null)),e.createElement(ye.h,{noBorder:!0},e.createElement(Je.Z,null))))}qs.propTypes={displayedValue:n().string.isRequired};const Ns=({status:t,displayedValue:r,width:o})=>{const{formatMessage:s}=(0,H.Z)(),a={[st.DRAFT]:s({id:(0,y.OB)("relation.publicationState.draft"),defaultMessage:"Draft"}),[st.PUBLISHED]:s({id:(0,y.OB)("relation.publicationState.published"),defaultMessage:"Published"})},l=t===st.DRAFT?"secondary":"success";return e.createElement(L.x,{style:{width:o}},e.createElement(P.k,{paddingTop:2,paddingBottom:2,paddingLeft:2,paddingRight:4,hasRadius:!0,borderSize:1,background:"neutral0",borderColor:"neutral200",justifyContent:"space-between"},e.createElement(mo,{gap:1},e.createElement(ye.h,{noBorder:!0},e.createElement(Je.Z,null)),e.createElement(po,{maxWidth:"100%",justifyContent:"space-between"},e.createElement(L.x,{minWidth:0,paddingTop:1,paddingBottom:1,paddingRight:4},e.createElement(fo,null,e.createElement(Q.Z,{textColor:"primary600",ellipsis:!0},r))),t&&e.createElement(Pn.q,{variant:l,showBullet:!1,size:"S"},e.createElement(Q.Z,{fontWeight:"bold",textColor:`${l}700`},a[t])))),e.createElement(L.x,{paddingLeft:4},e.createElement(ho,{type:"button"},e.createElement(co.J,{width:"12px",as:Kt.Z})))))};Ns.propTypes={status:n().string.isRequired,displayedValue:n().string.isRequired,width:n().number.isRequired};const hm=ke.Z.contentManager;function ym({type:t,item:r}){if([qt.Z.EDIT_FIELD,qt.Z.FIELD].includes(t))return e.createElement(Bt,{labelField:r.labelField});const[o]=t.split("_");switch(o){case qt.Z.COMPONENT:case qt.Z.DYNAMIC_ZONE:return e.createElement(qs,{displayedValue:r.displayedValue});case qt.Z.RELATION:return e.createElement(Ns,{displayedValue:r.displayedValue,status:r.status,width:r.width});default:return null}}const js=()=>{const t=(0,te.$B)("/content-manager/:kind/:uid"),{status:r,collectionTypeLinks:o,singleTypeLinks:s,models:a,refetchData:l}=mm(),i=we()([...o,...s],g=>g.title.toLowerCase()),{pathname:c}=(0,te.TH)(),{formatMessage:p}=(0,H.Z)(),{startSection:u}=(0,h.c1)(),m=(0,e.useRef)(u);if((0,e.useEffect)(()=>{m.current&&m.current("contentManager")},[]),r==="loading")return e.createElement(Ce.o,{"aria-busy":"true"},e.createElement(fe.T,{title:p({id:(0,be.Z)("header.name"),defaultMessage:"Content"})}),e.createElement(h.dO,null));const f=a.filter(({isDisplayed:g})=>g);return i.length===0&&f.length>0&&c!=="/content-manager/403"?e.createElement(te.l_,{to:"/content-manager/403"}):f.length===0&&c!=="/content-manager/no-content-types"?e.createElement(te.l_,{to:"/content-manager/no-content-types"}):!t&&i.length>0?e.createElement(te.l_,{to:`${i[0].to}${i[0].search?`?${i[0].search}`:""}`}):e.createElement(Pe.A,{sideNav:e.createElement(am,null)},e.createElement(Fe.r,{renderItem:ym}),e.createElement(Se.Provider,{value:{refetchData:l}},e.createElement(te.rs,null,e.createElement(te.AW,{path:"/content-manager/components/:uid/configurations/edit"},e.createElement(h.O4,{permissions:hm.componentsConfigurations},e.createElement(Gu,null))),e.createElement(te.AW,{path:"/content-manager/collectionType/:slug",component:Uu}),e.createElement(te.AW,{path:"/content-manager/singleType/:slug",component:em}),e.createElement(te.AW,{path:"/content-manager/403"},e.createElement(Ju,null)),e.createElement(te.AW,{path:"/content-manager/no-content-types"},e.createElement(Xu,null)),e.createElement(te.AW,{path:"",component:h.Hn}))))};function Em(){const{formatMessage:t}=(0,H.Z)();return e.createElement(e.Fragment,null,e.createElement(ve.q,{title:t({id:(0,be.Z)("plugin.name"),defaultMessage:"Content Manager"})}),e.createElement(js,null))}},92914:function(ct,Ie,d){"use strict";d.d(Ie,{Z:function(){return y}});var e=d(32735),ve=d(60216),te=d.n(ve),h=d(67879),Ce=d(24989),fe=d(87933),Pe=d(49372),H=d(72850),Ke=d(9026),we=d(95952);const ke=60*1e3,be=ke*60,Fe=be*24,Me=Fe*30,Se=Fe*365;var he=J=>J<ke?{unit:"second",value:-Math.round(J/1e3)}:J<be?{unit:"minute",value:-Math.round(J/ke)}:J<Fe?{unit:"hour",value:-Math.round(J/be)}:J<Me?{unit:"day",value:-Math.round(J/Fe)}:J<Se?{unit:"month",value:-Math.round(J/Me)}:{unit:"year",value:-Math.round(J/Se)},n=d(8997);const dt=()=>{const{formatMessage:J}=(0,h.Z)();return e.createElement(fe.k,{direction:"column",alignItems:"stretch",gap:2},e.createElement(Pe.Z,{variant:"sigma",textColor:"neutral600",id:"additional-information"},J({id:(0,we.OB)("containers.Edit.information"),defaultMessage:"Information"})),e.createElement(H.x,null,e.createElement(Ke.i,null)))},Ne=({label:J,value:Ae})=>e.createElement(fe.k,{justifyContent:"space-between"},e.createElement(Pe.Z,{as:"dt",fontWeight:"bold",textColor:"neutral800",variant:"pi"},J),e.createElement(Pe.Z,{as:"dd",variant:"pi",textColor:"neutral600"},Ae));Ne.propTypes={label:te().string.isRequired,value:te().string.isRequired};const Vt=()=>{const{formatMessage:J,formatRelativeTime:Ae}=(0,h.Z)(),{initialData:Ye,isCreatingEntry:Mt}=(0,Ce.Wq)(),Tt=(0,e.useRef)(Date.now()),ut=($e,De)=>{const{firstname:ue,lastname:P,username:L}=Ye[De]??{},je=ue??"",Ue=P??"",Xe=L??(0,n.Pp)(je,Ue),It=(Ye[$e]?new Date(Ye[$e]).getTime():Date.now())-Tt.current,{unit:kt,value:Ut}=he(-It);return{at:Ae(Ut,kt,{numeric:"auto"}),by:Mt?"-":Xe}},rt=ut("updatedAt","updatedBy"),Oe=ut("createdAt","createdBy");return e.createElement(fe.k,{direction:"column",alignItems:"stretch",gap:4},e.createElement(fe.k,{direction:"column",alignItems:"stretch",gap:2,as:"dl"},e.createElement(Ne,{label:J({id:(0,we.OB)("containers.Edit.information.created"),defaultMessage:"Created"}),value:Oe.at}),e.createElement(Ne,{label:J({id:(0,we.OB)("containers.Edit.information.by"),defaultMessage:"By"}),value:Oe.by})),e.createElement(fe.k,{direction:"column",alignItems:"stretch",gap:2,as:"dl"},e.createElement(Ne,{label:J({id:(0,we.OB)("containers.Edit.information.lastUpdate"),defaultMessage:"Last update"}),value:rt.at}),e.createElement(Ne,{label:J({id:(0,we.OB)("containers.Edit.information.by"),defaultMessage:"By"}),value:rt.by})))},de=({children:J})=>e.createElement(fe.k,{direction:"column",alignItems:"stretch",gap:4},J);de.propTypes={children:te().oneOfType([te().arrayOf(te().node),te().node]).isRequired};var y={Root:de,Title:dt,Body:Vt}},73710:function(ct,Ie,d){"use strict";d.d(Ie,{Z:function(){return h}});var e=d(32735),ve=d(92914);function te(){return e.createElement(ve.Z.Root,null,e.createElement(ve.Z.Title,null),e.createElement(ve.Z.Body,null))}var h=te},75536:function(ct,Ie,d){"use strict";var e=d(32735);const ve=(te,h)=>{const[Ce,fe]=(0,e.useState)(te);return(0,e.useEffect)(()=>{const Pe=setTimeout(()=>{fe(te)},h);return()=>{clearTimeout(Pe)}},[te,h]),Ce};Ie.Z=ve},57047:function(ct,Ie,d){"use strict";d.d(Ie,{Z:function(){return Fe}});var e=d(32735),ve=d(67879),te=d(49372),h=d(60216),Ce=d.n(h),fe=d(87933),Pe=d(72850),H=d(24989);function Ke({color:Me,name:Se}){return e.createElement(fe.k,{alignItems:"center",gap:2,maxWidth:(0,H.Q1)(300)},e.createElement(Pe.x,{height:2,background:Me,hasRadius:!0,shrink:0,width:2}),e.createElement(te.Z,{fontWeight:"regular",textColor:"neutral700",ellipsis:!0},Se))}Ke.propTypes={color:Ce().string.isRequired,name:Ce().string.isRequired};var we=Ke,ke=d(47510),be=d(61937),Fe=Me=>{const{formatMessage:Se}=(0,ve.Z)();return(window.strapi.features.isEnabled(window.strapi.features.REVIEW_WORKFLOWS)&&Me.contentType.options?.reviewWorkflows)??!1?{key:"__strapi_reviewWorkflows_stage_temp_key__",name:"strapi_reviewWorkflows_stage",fieldSchema:{type:"relation"},metadatas:{label:Se({id:(0,ke.Z)("containers.ListPage.table-headers.reviewWorkflows.stage"),defaultMessage:"Review stage"}),searchable:!1,sortable:!0,mainField:"name"},cellFormatter({strapi_reviewWorkflows_stage:he}){if(!he)return e.createElement(te.Z,{textColor:"neutral800"},"-");const{color:n,name:dt}=he;return e.createElement(we,{color:n??be.FT,name:dt})}}:null}},28243:function(ct,Ie,d){"use strict";d.d(Ie,{Z:function(){return Rt}});var e=d(32735),ve=d(24989),te=d(87107),h=d(87933),Ce=d(28847),fe=d(97405),Pe=d(47851),H=d(67879),Ke=d(20108),we=d(67350),ke=d(28315),be=d(8445),Fe=d(92914);const Me="strapi_reviewWorkflows_stage";function Se(){const{initialData:he,isCreatingEntry:n,layout:{uid:dt},isSingleType:Ne,onChange:Vt}=(0,ve.Wq)(),{put:de}=(0,ve.kY)(),y=he?.[Me]??null,J=Object.prototype.hasOwnProperty.call(he,Me),{formatMessage:Ae}=(0,H.Z)(),{formatAPIError:Ye}=(0,ve.So)(),Mt=(0,ve.lm)(),{workflows:{data:Tt,isLoading:ut}={}}=(0,we.n)(),rt=Tt?.[0]??null,{error:Oe,isLoading:$e,mutateAsync:De}=(0,Ke.useMutation)(async({entityId:Ue,stageId:Xe,uid:Dt})=>{const It=Ne?"single-types":"collection-types",{data:{data:kt}}=await de(`/admin/content-manager/${It}/${Dt}/${Ue}/stage`,{data:{id:Xe}});return Vt({target:{name:Me,value:kt[Me]}},!0),kt},{onSuccess(){Mt({type:"success",message:{id:"notification.success.saved",defaultMessage:"Saved"}})}}),ue=y===null&&!ut&&!n&&Ae({id:"content-manager.reviewWorkflows.stage.select.placeholder",defaultMessage:"Select a stage"}),L=Oe&&Ye(Oe)||ue||null,je=async({value:Ue})=>{try{await De({entityId:he.id,stageId:Ue,uid:dt})}catch{}};return e.createElement(Fe.Z.Root,null,e.createElement(Fe.Z.Title,null),J&&!n&&e.createElement(te.g,{error:L,name:Me,id:Me},e.createElement(h.k,{direction:"column",gap:2,alignItems:"stretch"},e.createElement(Ce.Q,null,Ae({id:"content-manager.reviewWorkflows.stage.label",defaultMessage:"Review stage"})),e.createElement(ve.JV,{components:{LoadingIndicator:()=>e.createElement(fe.a,{small:!0}),Option:ke.K,SingleValue:be.R},error:L,inputId:Me,isLoading:$e,isSearchable:!1,isClearable:!1,name:Me,onChange:je,options:rt?rt.stages.map(({id:Ue,color:Xe,name:Dt})=>({value:Ue,label:Dt,color:Xe})):[],value:{value:y?.id,label:y?.name,color:y?.color}}),e.createElement(Pe.c,null))),e.createElement(Fe.Z.Body,null))}var Rt=Se},57544:function(){},59599:function(){},42310:function(){},33842:function(){},85695:function(){}}]);
|