@strapi/admin 4.11.3 → 4.11.4
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/components/AuthenticatedApp/index.js +2 -2
- package/admin/src/content-manager/components/RelationInput/RelationInput.js +99 -178
- package/admin/src/content-manager/components/RelationInput/components/Option.js +17 -15
- package/admin/src/content-manager/components/RelationInput/components/RelationList.js +2 -2
- package/admin/src/content-manager/pages/ListView/index.js +12 -0
- package/admin/src/pages/SettingsPage/components/Tokens/Table/index.js +15 -1
- package/admin/src/pages/SettingsPage/pages/Roles/ProtectedEditPage/index.js +4 -10
- package/admin/src/pages/SettingsPage/pages/Users/EditPage/index.js +2 -2
- package/admin/src/pages/SettingsPage/pages/Webhooks/EditView/components/WebhookForm/utils/makeWebhookValidationSchema.js +11 -5
- package/admin/src/translations/ca.json +1 -0
- package/admin/src/translations/en.json +4 -1
- package/admin/src/translations/es.json +5 -0
- package/admin/src/translations/fr.json +1 -0
- package/build/{1799.84268ad3.chunk.js → 1799.44d2e264.chunk.js} +1 -1
- package/build/{5542.64b623c9.chunk.js → 5542.c62d0daf.chunk.js} +1 -1
- package/build/{6405.27e1bee5.chunk.js → 970.89601f27.chunk.js} +2 -2
- package/build/Admin-authenticatedApp.cb649fc1.chunk.js +79 -0
- package/build/{admin-edit-roles-page.2040034a.chunk.js → admin-edit-roles-page.3fdd6b9d.chunk.js} +11 -11
- package/build/admin-edit-users.200551e3.chunk.js +10 -0
- package/build/api-tokens-list-page.a103f526.chunk.js +16 -0
- package/build/audit-logs-settings-page.f538490f.chunk.js +1 -0
- package/build/ca-json.1fed5d8b.chunk.js +1 -0
- package/build/content-manager.c40f5ff9.chunk.js +1088 -0
- package/build/{content-type-builder-list-view.0c3ceb4e.chunk.js → content-type-builder-list-view.a200a358.chunk.js} +1 -1
- package/build/{content-type-builder.e1b6d13b.chunk.js → content-type-builder.bd1bbff1.chunk.js} +15 -15
- package/build/{email-settings-page.6b38222d.chunk.js → email-settings-page.45695daa.chunk.js} +1 -1
- package/build/en-json.fb9f6ddd.chunk.js +1 -0
- package/build/es-json.42096084.chunk.js +1 -0
- package/build/fr-json.69789980.chunk.js +1 -0
- package/build/{i18n-settings-page.ff863f20.chunk.js → i18n-settings-page.29308d0b.chunk.js} +1 -1
- package/build/index.html +1 -1
- package/build/main.ee36abd9.js +2927 -0
- package/build/{runtime~main.20c3cac6.js → runtime~main.efd966f6.js} +1 -1
- package/build/sso-settings-page.0cdb96a6.chunk.js +1 -0
- package/build/transfer-tokens-list-page.7237443d.chunk.js +16 -0
- package/build/{upload-settings.43cf16cd.chunk.js → upload-settings.cb6c14c3.chunk.js} +1 -1
- package/build/{upload.72f8f8fc.chunk.js → upload.7e629643.chunk.js} +2 -2
- package/build/users-advanced-settings-page.750b1f76.chunk.js +9 -0
- package/build/{users-email-settings-page.33359797.chunk.js → users-email-settings-page.e9bcd865.chunk.js} +1 -1
- package/build/{users-providers-settings-page.1e7a4a71.chunk.js → users-providers-settings-page.a94253e9.chunk.js} +1 -1
- package/build/{users-roles-settings-page.235378b6.chunk.js → users-roles-settings-page.1f505119.chunk.js} +5 -5
- package/build/webhook-edit-page.77ef4f1a.chunk.js +33 -0
- package/ee/admin/pages/SettingsPage/pages/AuditLogs/ListView/index.js +4 -9
- package/ee/admin/pages/SettingsPage/pages/SingleSignOn/index.js +4 -9
- package/ee/server/services/review-workflows/entity-service-decorator.js +20 -11
- package/package.json +12 -12
- package/server/content-types/User.js +10 -0
- package/server/strategies/api-token.js +9 -5
- package/server/strategies/data-transfer.js +9 -5
- package/admin/src/content-manager/components/RelationInput/components/Relation.js +0 -53
- package/build/Admin-authenticatedApp.69855f1b.chunk.js +0 -79
- package/build/admin-edit-users.53e4290a.chunk.js +0 -10
- package/build/api-tokens-list-page.201fb67a.chunk.js +0 -16
- package/build/audit-logs-settings-page.b07ad202.chunk.js +0 -1
- package/build/ca-json.43e14418.chunk.js +0 -1
- package/build/content-manager.66cec770.chunk.js +0 -1094
- package/build/en-json.f5fa476a.chunk.js +0 -1
- package/build/es-json.715b6fd8.chunk.js +0 -1
- package/build/fr-json.73494bf5.chunk.js +0 -1
- package/build/main.83edb3fc.js +0 -2926
- package/build/sso-settings-page.35b67909.chunk.js +0 -1
- package/build/transfer-tokens-list-page.217573c3.chunk.js +0 -16
- package/build/users-advanced-settings-page.1911adf5.chunk.js +0 -9
- package/build/webhook-edit-page.1ee02c4b.chunk.js +0 -33
|
@@ -1,1094 +0,0 @@
|
|
|
1
|
-
(self.webpackChunk_strapi_admin=self.webpackChunk_strapi_admin||[]).push([[994],{691:function(qt,We,i){"use strict";i.r(We),i.d(We,{App:function(){return qa},default:function(){return jp}});var e=i(32735),Ee=i(27649),Ce=i(82055),$e=i(96709),y=i(19565),ze=i(98978),rt=i.n(ze),Ue=i(74758),Q=i(67879),de=i(15062),ie=i(53038),Se=i(55433),Ae=i(78125),Xe=(0,e.createContext)(),Te=i(47510),at=i(25708),Oe=i(60216),n=i.n(Oe),Je=i(47533),ut=(0,e.createContext)(),Zt=i(73386),ae=i(56327),f=i(51375),le=i(41415),qe=i(17e3),W=i(72850),Z=i(87933),G=i(49372),De=i(15335),ye=i(5803),Ze=i(68465),be=i(84967),bt=i(9026),et=i(29439),Me=i(66456),tt=i(99381),Ie=i.n(tt),vt=i(3704),mt=i.n(vt),an=i(33795),k=i.n(an),Va=i(89793),Le=i.n(Va),Ha=i(88423),sn=i.n(Ha),Ga=i(3040),se=i.n(Ga),Qa=i(23940),xt=i.n(Qa),nt=i(20108),Ct=i(42882),Ve=i(34853),Rt=i(19406),pt=i(68625);const Wo=e.createContext();function ln({attributes:t,buttonData:o,children:r,goTo:a,layout:s,metadatas:c,moveItem:l,moveRow:d,onAddData:m,relationsLayout:u,removeField:g,selectedItemName:h,setEditFieldToSelect:p,...E}){return e.createElement(Wo.Provider,{value:{attributes:t,buttonData:o,goTo:a,layout:s,metadatas:c,moveItem:l,moveRow:d,onAddData:m,relationsLayout:u,removeField:g,selectedItemName:h,setEditFieldToSelect:p,...E}},r)}ln.defaultProps={attributes:{},buttonData:[],goTo(){},layout:[],metadatas:{},moveItem(){},moveRow(){},onAddData(){},relationsLayout:[],removeField(){},selectedItemName:null,setEditFieldToSelect(){}},ln.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 gt(){return e.useContext(Wo)}const Ka=[{action:"plugin::content-type-builder.read",subject:null}];var Ya=()=>{const{trackUsage:t}=(0,y.rS)(),{formatMessage:o}=(0,Q.Z)(),{slug:r,modifiedData:a,isContentTypeView:s}=gt(),c=s?"content-types":"components",l=`/plugins/content-type-builder/${c==="content-types"?c:"component-categories"}`,d=k()(a,"category",""),m=c==="content-types"?r:`${d}/${r}`,u=()=>{t("willEditEditLayout")};return r==="strapi::administrator"?null:e.createElement(y.jW,{permissions:Ka},e.createElement(y.Qj,{to:`${l}/${m}`,onClick:u,size:"S",startIcon:e.createElement(pt.Z,null),variant:"secondary"},o({id:(0,Te.Z)(`edit-settings-view.link-to-ctb.${c}`),defaultMessage:"Edit the content type"})))},st=i(47081),Vt=i(74506),kt=i(51968),U=i(8471),Re=i(50563),He=i(4038),cn=i(45112);const zo=({componentUid:t})=>{const{componentLayouts:o}=gt(),{formatMessage:r}=(0,Q.Z)(),a=k()(o,[t],{}),s=k()(a,["layouts","edit"],[]);return e.createElement(W.x,{padding:3},s.map((c,l)=>e.createElement(De.r,{gap:4,key:l},c.map(d=>e.createElement(ye.P,{key:d.name,col:d.size},e.createElement(W.x,{paddingTop:2},e.createElement(Z.k,{alignItems:"center",background:"neutral0",paddingLeft:3,paddingRight:3,height:`${32/16}rem`,hasRadius:!0,borderColor:"neutral200"},e.createElement(G.Z,{textColor:"neutral800"},d.name))))))),e.createElement(W.x,{paddingTop:2},e.createElement(y.rU,{startIcon:e.createElement(cn.Z,null),to:`/content-manager/components/${t}/configurations/edit`},r({id:(0,Te.Z)("components.FieldItem.linkToComponentLayout"),defaultMessage:"Set the component's layout"}))))};zo.propTypes={componentUid:n().string.isRequired};var Xa=zo,Ft=i(14911),dn=i(99140),Ja=i(55805),_a=i(31206),es=i(97075),ts=i(14949),ns=i(8482),os=i(65261),rs=i(55877),as=i(84298),un=i(73906),ss=i(37272),is=i(67121),ls=i(39869),Uo=i(35635),cs=i(26366),ds=i(98464),us=i(2362),ms=i(89992),ps=i(10473),gs=i(95971),fs=i(72536),hs=i(68312),qo=i(80601),Vo=i(74464),ys=i(70809),Es=i(98148),bs=i(81424),vs=i(69317),Cs=i(25789),Rs=i(77359),Ms=i(50416),Ts=i(20015),Ds=i(20276),Is=i(82068),Os=i(41645),Ps=i(61294),Zs=i(65943),xs=i(8606),ks=i(7961),Fs=i(92967),Ho=i(18070),Ss=i(54894),As=i(30285),Ls=i(96011),ws=i(47041),$s=i(60625),Go=i(5644),Bs=i(78150),Ns=i(63717),js=i(24609),Ws=i(86543),zs=i(62864),Us=i(92989),qs=i(49886),Vs=i(47052),Hs=i(50694),Gs=i(81875),Qs=i(92323),mn=i(49844),Ks=i(11631),Ys=i(9254),Qo=i(2669),Xs=i(18709),Js=i(20258),Ko=i(43231),_s=i(45147),ei=i(23154),ti=i(26253),ni=i(79634),oi=i(32548),ri=i(99482),ai=i(45323),si=i(76994),ii=i(88777),li=i(95703),ci=i(8981),di=i(7733),ui=i(10168),mi=i(25449),pi=i(83900),gi=i(32645),fi=i(78429),hi=i(9882),Yo=i(11417),yi=i(39698),Ei=i(92168),bi=i(69621),vi=i(2438),Ci=i(92254),Ri=i(2287),Mi=i(29685),Xo=i(65663),pn=i(44647),Ti=i(5502),Di=i(31047),Ii=i(93307),Oi=i(78055),Pi=i(51239),Zi=i(6792),xi=i(75156),ki=i(80683),Fi=i(2689),Si=i(40202),Ai=i(36919),Li=i(75444),wi=i(92003),$i=i(4511),Bi=i(2847),Jo=i(83139),Ni=i(53779),ji=i(72890),Wi=i(84411),zi=i(37193),Ui=i(74831),qi=i(99221),Vi=i(34119),gn=i(99283),Hi=i(21371),Gi=i(70727),Qi=i(42213),Ki=i(8611),Yi=i(20448),Xi=i(73165);const _o={alien:Ja.Z,apps:_a.Z,archive:es.Z,arrowDown:ts.Z,arrowLeft:et.Z,arrowRight:ns.Z,arrowUp:os.Z,attachment:rs.Z,bell:as.Z,bold:un.Z,book:ss.Z,briefcase:is.Z,brush:ls.Z,bulletList:Uo.Z,calendar:cs.Z,car:ds.Z,cast:us.Z,chartBubble:ms.Z,chartCircle:ps.Z,chartPie:gs.Z,check:Me.Z,clock:fs.Z,cloud:hs.Z,code:qo.Z,cog:cn.Z,collapse:Vo.Z,command:ys.Z,connector:Es.Z,crop:bs.Z,crown:vs.Z,cube:Cs.Z,cup:Rs.Z,cursor:Ms.Z,dashboard:Ts.Z,database:Ds.Z,discuss:Is.Z,doctor:Os.Z,earth:Ps.Z,emotionHappy:Zs.Z,emotionUnhappy:xs.Z,envelop:ks.Z,exit:Fs.Z,expand:Ho.Z,eye:Ss.Z,feather:As.Z,file:Ls.Z,fileError:ws.Z,filePdf:$s.Z,filter:Go.Z,folder:Bs.Z,gate:Ns.Z,gift:js.Z,globe:Ws.Z,grid:zs.Z,handHeart:Us.Z,hashtag:qs.Z,headphone:Vs.Z,heart:Hs.Z,house:Gs.Z,information:Qs.Z,italic:mn.Z,key:Ks.Z,landscape:Ys.Z,layer:Qo.Z,layout:Xs.Z,lightbulb:Js.Z,link:Ko.Z,lock:_s.Z,magic:ei.Z,manyToMany:ti.Z,manyToOne:ni.Z,manyWays:oi.Z,medium:ri.Z,message:ai.Z,microphone:si.Z,monitor:ii.Z,moon:li.Z,music:ci.Z,oneToMany:di.Z,oneToOne:ui.Z,oneWay:mi.Z,paint:pi.Z,paintBrush:gi.Z,paperPlane:fi.Z,pencil:pt.Z,phone:hi.Z,picture:Yo.Z,pin:yi.Z,pinMap:Ei.Z,plane:bi.Z,play:vi.Z,plus:Rt.Z,priceTag:Ci.Z,puzzle:Ri.Z,question:Mi.Z,quote:Xo.Z,refresh:pn.Z,repeat:Ti.Z,restaurant:Di.Z,rocket:Ii.Z,rotate:Oi.Z,scissors:Pi.Z,search:Zi.Z,seed:xi.Z,server:ki.Z,shield:Fi.Z,shirt:Si.Z,shoppingCart:Ai.Z,slideshow:Li.Z,stack:wi.Z,star:$i.Z,store:Bi.Z,strikeThrough:Jo.Z,sun:Ni.Z,television:ji.Z,thumbDown:Wi.Z,thumbUp:zi.Z,train:Ui.Z,twitter:qi.Z,typhoon:Vi.Z,underline:gn.Z,user:Hi.Z,volumeMute:Gi.Z,volumeUp:Qi.Z,walk:Ki.Z,wheelchair:Yi.Z,write:Xi.Z};function St({showBackground:t=!0,size:o="M",icon:r}){return e.createElement(Z.k,{alignItems:"center",background:t?"neutral200":null,justifyContent:"center",size:o,showBackground:t,height:o==="S"?5:8,width:o==="S"?5:8,color:"neutral600",borderRadius:t?"50%":0},e.createElement(dn.J,{as:_o[r]||_o.cube,height:o==="S"?3:5,width:o==="S"?3:5}))}St.defaultProps={showBackground:!0,size:"M",icon:"Cube"},St.propTypes={showBackground:n().bool,size:n().string,icon:n().string};const Ji=(0,U.ZP)(Z.k)`
|
|
2
|
-
text-decoration: none;
|
|
3
|
-
|
|
4
|
-
&:focus,
|
|
5
|
-
&:hover {
|
|
6
|
-
${({theme:t})=>`
|
|
7
|
-
background-color: ${t.colors.primary100};
|
|
8
|
-
border-color: ${t.colors.primary200};
|
|
9
|
-
|
|
10
|
-
${G.Z} {
|
|
11
|
-
color: ${t.colors.primary600};
|
|
12
|
-
}
|
|
13
|
-
`}
|
|
14
|
-
|
|
15
|
-
/* > ComponentIcon */
|
|
16
|
-
> div:first-child {
|
|
17
|
-
background: ${({theme:t})=>t.colors.primary200};
|
|
18
|
-
color: ${({theme:t})=>t.colors.primary600};
|
|
19
|
-
|
|
20
|
-
svg {
|
|
21
|
-
path {
|
|
22
|
-
fill: ${({theme:t})=>t.colors.primary600};
|
|
23
|
-
}
|
|
24
|
-
}
|
|
25
|
-
}
|
|
26
|
-
}
|
|
27
|
-
`,er=({components:t})=>{const{componentLayouts:o}=gt();return e.createElement(Z.k,{gap:2,overflow:"scroll hidden",padding:3},t.map(r=>e.createElement(Ji,{hasRadius:!0,background:"neutral0",justifyContent:"center",alignItems:"center",height:`${84/16}rem`,minWidth:`${140/16}rem`,key:r,padding:2,direction:"column",borderColor:"neutral200",as:Ft.rU,to:`/content-manager/components/${r}/configurations/edit`},e.createElement(St,{icon:o?.[r]?.info?.icon}),e.createElement(W.x,{paddingTop:1},e.createElement(G.Z,{fontSize:1,textColor:"neutral600",fontWeight:"bold"},o?.[r]?.info?.displayName??"")))))};er.propTypes={components:n().arrayOf(n().string).isRequired};var _i=er;const tr=(0,U.ZP)(Re.h)`
|
|
28
|
-
background-color: transparent;
|
|
29
|
-
path {
|
|
30
|
-
fill: ${({theme:t})=>t.colors.neutral600};
|
|
31
|
-
}
|
|
32
|
-
`,fn=({attribute:t,onEditField:o,onDeleteField:r,children:a})=>{const{formatMessage:s}=(0,Q.Z)();return e.createElement(W.x,{overflow:"hidden",width:"100%"},e.createElement(Z.k,{paddingLeft:3,alignItems:"center",justifyContent:"space-between"},e.createElement(G.Z,{fontWeight:"semiBold",textColor:"neutral800",ellipsis:!0},a),e.createElement(Z.k,null,e.createElement(tr,{label:s({id:(0,f.OB)("containers.ListSettingsView.modal-form.edit-label"),defaultMessage:"Edit {fieldName}"},{fieldName:a}),onClick:o,icon:e.createElement(pt.Z,null),noBorder:!0}),e.createElement(tr,{label:s({id:"global.delete-target",defaultMessage:"Delete {target}"},{target:a}),"data-testid":"delete-field",onClick:r,icon:e.createElement(He.Z,null),noBorder:!0}))),t?.type==="component"&&e.createElement(Xa,{componentUid:t.component}),t?.type==="dynamiczone"&&e.createElement(_i,{components:t.components}))};fn.defaultProps={attribute:void 0},fn.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 el=fn;const tl=(0,U.ZP)(Z.k)`
|
|
33
|
-
position: relative;
|
|
34
|
-
${({isFirst:t,isLast:o,hasHorizontalPadding:r})=>t?`
|
|
35
|
-
padding-right: 4px;
|
|
36
|
-
`:o?`
|
|
37
|
-
padding-left: 4px;
|
|
38
|
-
`:r?`
|
|
39
|
-
padding: 0 4px;
|
|
40
|
-
`:""}
|
|
41
|
-
${({showRightCarret:t,showLeftCarret:o,theme:r})=>t?`
|
|
42
|
-
&:after {
|
|
43
|
-
content: '';
|
|
44
|
-
position: absolute;
|
|
45
|
-
right: -1px;
|
|
46
|
-
background-color: ${r.colors.primary600};
|
|
47
|
-
width: 2px;
|
|
48
|
-
height: 100%;
|
|
49
|
-
align-self: stretch;
|
|
50
|
-
z-index: 1;
|
|
51
|
-
}
|
|
52
|
-
`:o?`
|
|
53
|
-
&:before {
|
|
54
|
-
content: '';
|
|
55
|
-
position: absolute;
|
|
56
|
-
left: -1px;
|
|
57
|
-
background-color: ${r.colors.primary600};
|
|
58
|
-
width: 2px;
|
|
59
|
-
height: 100%;
|
|
60
|
-
align-self: stretch;
|
|
61
|
-
z-index: 1;
|
|
62
|
-
}
|
|
63
|
-
`:""};
|
|
64
|
-
`,nl=(0,U.ZP)(st.Z)`
|
|
65
|
-
height: ${12/16}rem;
|
|
66
|
-
width: ${12/16}rem;
|
|
67
|
-
path {
|
|
68
|
-
fill: ${({theme:t})=>t.colors.neutral600};
|
|
69
|
-
}
|
|
70
|
-
`,ol=(0,U.ZP)(Z.k)`
|
|
71
|
-
display: ${({dragStart:t})=>t?"none":"flex"};
|
|
72
|
-
opacity: ${({isDragging:t,isFullSize:o,isHidden:r})=>t&&!o?.2:t&&o||r?0:1};
|
|
73
|
-
`,rl=(0,U.ZP)(Z.k)`
|
|
74
|
-
cursor: all-scroll;
|
|
75
|
-
border-right: 1px solid ${({theme:t})=>t.colors.neutral200};
|
|
76
|
-
`,hn=({attribute:t,children:o,index:r,lastIndex:a,moveItem:s,moveRow:c,name:l,onDeleteField:d,onEditField:m,rowIndex:u,size:g})=>{const[h,p]=(0,e.useState)(!1),E=l==="_TEMP_",{setIsDraggingSibling:b}=gt(),C=g===12,T=(0,e.useRef)(null),D=(0,e.useRef)(null),[{clientOffset:M,isOver:I},R]=(0,Vt.useDrop)({accept:f._Q.EDIT_FIELD,hover(F,w){if(!D.current||F.size!==12)return;const O=w.getItem().index,S=r,z=w.getItem().rowIndex,Y=u;if(O===S&&z===Y)return;const N=D.current.getBoundingClientRect(),j=(N.bottom-N.top)/2,ne=w.getClientOffset().y-N.top;z<Y&&ne<j||z>Y&&ne>j||(c(z,Y),F.rowIndex=Y,F.itemIndex=S)},drop(F,w){if(!D.current)return;const O=w.getItem().index,S=r,z=w.getItem().rowIndex,Y=u;if(F.size===12||O===S&&z===Y)return;const N=D.current.getBoundingClientRect();if(Math.abs(w.getClientOffset().x-N.left)>N.width/1.8){s(O,S+1,z,Y),F.itemIndex=S+1,F.rowIndex=Y;return}s(O,S,z,Y),F.itemIndex=S,F.rowIndex=Y},collect:F=>({canDrop:F.canDrop(),clientOffset:F.getClientOffset(),isOver:F.isOver(),isOverCurrent:F.isOver({shallow:!0}),itemType:F.getItemType()})}),[{isDragging:v,getItem:x},B,A]=(0,Vt.useDrag)({type:f._Q.EDIT_FIELD,item(){return b(!0),{index:r,labelField:o,rowIndex:u,name:l,size:g}},canDrag(){return l!=="_TEMP_"},collect:F=>({isDragging:F.isDragging(),getItem:F.getItem()}),end(){b(!1)}});(0,e.useEffect)(()=>{A((0,kt.rX)(),{captureDraggingState:!0})},[A]);const P={dragRef:B(T),dropRef:R(D)};let $=!1,q=!1;if(D.current&&M){const F=D.current.getBoundingClientRect();$=I&&x.size!==12&&Math.abs(M.x-F.left)<F.width/2,q=I&&x.size!==12&&Math.abs(M.x-F.left)>F.width/2,l==="_TEMP_"&&($=I&&x.size!==12,q=!1)}const L=()=>t&&C?`${74/16}rem`:`${32/16}rem`,X=r===0&&!C,K=r===a&&!C,J=r!==0&&!C;return e.createElement(ye.P,{col:g},e.createElement(tl,{ref:P.dropRef,showLeftCarret:$,showRightCarret:q,isFirst:X,isLast:K,hasHorizontalPadding:J,onDrag:()=>{C&&!h&&p(!0)},onDragEnd:()=>{C&&p(!1)}},h&&C&&e.createElement(W.x,{width:"100%",height:"2px",background:"primary600"}),e.createElement(ol,{width:C&&h?0:"100%",borderColor:"neutral150",hasRadius:!0,background:"neutral100",minHeight:L(),alignItems:"stretch",isDragging:v,dragStart:h,isFullSize:C,isHidden:E},e.createElement(rl,{as:"span",type:"button",ref:P.dragRef,onClick:F=>F.stopPropagation(),alignItems:"center",paddingLeft:3,paddingRight:3,tabIndex:-1},e.createElement(nl,null)),!E&&e.createElement(el,{attribute:t,onEditField:m,onDeleteField:d},o))))};hn.defaultProps={attribute:void 0},hn.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 al=hn;const nr=({rowItem:t,onRemoveField:o,rowId:r,rowIndex:a,index:s,lastIndex:c})=>{const{setEditFieldToSelect:l,attributes:d,modifiedData:m,moveRow:u,moveItem:g}=gt(),h=k()(d,[t.name],{}),p=k()(m,["metadatas",t.name,"edit","label"],"");return e.createElement(al,{onEditField:()=>l(t.name),onDeleteField:()=>o(r,s),attribute:h,index:s,lastIndex:c,rowIndex:a,name:t.name,size:t.size,moveRow:u,moveItem:g},p||t.name)};nr.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 sl=nr;const or=({row:t,onRemoveField:o,rowIndex:r})=>e.createElement(De.r,null,t.rowContent.map((a,s)=>e.createElement(sl,{key:a.name,rowItem:a,index:s,rowId:t.rowId,onRemoveField:o,rowIndex:r,lastIndex:t.rowContent.length-1})));or.propTypes={onRemoveField:n().func.isRequired,row:n().object.isRequired,rowIndex:n().number.isRequired};var il=or;const rr=({editLayout:t,fields:o,onRemoveField:r,onAddField:a})=>{const{formatMessage:s}=(0,Q.Z)();return e.createElement(Z.k,{direction:"column",alignItems:"stretch",gap:4},e.createElement(Z.k,{justifyContent:"space-between"},e.createElement("div",null,e.createElement(W.x,null,e.createElement(G.Z,{fontWeight:"bold"},s({id:(0,f.OB)("containers.ListPage.displayedFields"),defaultMessage:"Displayed fields"}))),e.createElement(W.x,null,e.createElement(G.Z,{variant:"pi",textColor:"neutral600"},s({id:"containers.SettingPage.editSettings.description",defaultMessage:"Drag & drop the fields to build the layout"})))),e.createElement(Ya,null)),e.createElement(W.x,{padding:4,hasRadius:!0,borderStyle:"dashed",borderWidth:"1px",borderColor:"neutral300"},e.createElement(Z.k,{direction:"column",alignItems:"stretch",gap:2},t.map((c,l)=>e.createElement(il,{key:c.rowId,row:c,rowIndex:l,onRemoveField:r})),e.createElement(Ve.O,{id:"label",label:s({id:(0,f.OB)("containers.SettingPage.add.field"),defaultMessage:"Insert another field"}),as:le.z,"data-testid":"add-field",fullWidth:!0,startIcon:e.createElement(Rt.Z,null),endIcon:null,variant:"secondary",disabled:o.length===0},o.map(c=>e.createElement(Ve.s,{key:c,onClick:()=>a(c)},c))))))};rr.propTypes={editLayout:n().array.isRequired,fields:n().array.isRequired,onAddField:n().func.isRequired,onRemoveField:n().func.isRequired};var ll=rr,ar=i(85025),sr=i(55225),ir=i(31600),lr=i(11406),At=i(32031),cl=i(73779),Ht=i(88675),dl=i(22348),cr=i(7184),yn=i(43475),ul=i(82512),En=i(83218),ml=i(872),pl=i(17757),gl=i(1176),fl=i(15431);const dr={biginteger:e.createElement(At.Z,null),boolean:e.createElement(cl.Z,null),date:e.createElement(Ht.Z,null),datetime:e.createElement(Ht.Z,null),decimal:e.createElement(At.Z,null),email:e.createElement(dl.Z,null),enum:e.createElement(cr.Z,null),enumeration:e.createElement(cr.Z,null),file:e.createElement(yn.Z,null),files:e.createElement(yn.Z,null),float:e.createElement(At.Z,null),integer:e.createElement(At.Z,null),media:e.createElement(yn.Z,null),number:e.createElement(At.Z,null),relation:e.createElement(ul.Z,null),string:e.createElement(En.Z,null),text:e.createElement(En.Z,null),richtext:e.createElement(En.Z,null),time:e.createElement(Ht.Z,null),timestamp:e.createElement(Ht.Z,null),json:e.createElement(ml.Z,null),uid:e.createElement(pl.Z,null),component:e.createElement(gl.Z,null),dynamiczone:e.createElement(fl.Z,null)},bn=({type:t,customFieldUid:o})=>{const r=(0,y.mZ)();let a=dr[t];if(o){const c=r.get(o).icon;c&&(a=e.createElement(W.x,{marginRight:3,width:7,height:6},e.createElement(c,null)))}return dr[t]?a:null};bn.defaultProps={customFieldUid:null},bn.propTypes={type:n().string.isRequired,customFieldUid:n().string};var ur=bn,hl=t=>t.reduce((o,r)=>{const a=r?.attributes??{},s=Object.keys(a).filter(c=>!["boolean","component","dynamiczone","json","media","password","relation","text","richtext"].includes(a?.[c]?.type??""));return o[r.uid]=s,o},{}),mr=t=>{let o;switch(t){case"description":case"label":case"placeholder":o="text";break;case"mainField":o="select";break;case"editable":o="bool";break;default:o=""}const r=t==="mainField"?(0,f.OB)("containers.SettingPage.editSettings.entry.title"):(0,f.OB)(`form.Input.${t}`);return{type:o,label:{id:r}}},vn=i(10369),Lt=i(9139);const Cn=({type:t,options:o,onChange:r,value:a,name:s,...c})=>{const{formatMessage:l}=(0,Q.Z)();switch(t){case"text":return e.createElement(vn.o,{onChange:r,value:a,name:s,...c});case"bool":return e.createElement(Lt.s,{onChange:d=>{r({target:{name:s,value:d.target.checked}})},checked:a,name:s,onLabel:l({id:"app.components.ToggleCheckbox.on-label",defaultMessage:"On"}),offLabel:l({id:"app.components.ToggleCheckbox.off-label",defaultMessage:"Off"}),...c});case"select":return e.createElement(Ze.P,{value:a,name:s,onChange:d=>r({target:{name:s,value:d}}),...c},o.map(d=>e.createElement(be.W,{key:d,value:d},d)));default:return null}};Cn.defaultProps={options:void 0},Cn.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 yl=Cn;const El=[[4,"33%"],[6,"50%"],[8,"66%"],[12,"100%"]],bl=[1,5,10,15,30,60],vl=["datetime","time"],pr=({onMetaChange:t,onSizeChange:o})=>{const{formatMessage:r}=(0,Q.Z)(),{modifiedData:a,selectedField:s,attributes:c,fieldForm:l}=gt(),d=(0,e.useMemo)(Ct.Vo,[]),{schemas:m}=(0,de.v9)(R=>d(R),de.wU),u=(0,de.v9)(Ct.Jg),g=(0,e.useMemo)(()=>{if(!s)return[];const R=k()(a,["metadatas",s,"edit"],{});return Object.keys(R).filter(v=>v!=="visible")},[s,a]),h=(0,e.useMemo)(()=>hl(m),[m]),p=(0,e.useCallback)(R=>{if(R!=="relation"&&R!=="component")return[];const v=R==="component"?"component":"targetModel",x=k()(a,["attributes",s,v],"");return k()(h,[x],[])},[s,h,a]),E=g.map(R=>{const v=k()(c,[s,"type"]);return["component","dynamiczone"].includes(v)&&!["label","description"].includes(R)||v==="component"&&R!=="label"||["media","json","boolean"].includes(v)&&R==="placeholder"||R==="step"?null:e.createElement(ye.P,{col:6,key:R},e.createElement(yl,{type:mr(R).type,hint:R==="mainField"?r({id:(0,Te.Z)("containers.SettingPage.editSettings.relation-field.description")}):"",label:r({id:k()(mr(R),"label.id","app.utils.defaultMessage")}),name:R,onChange:t,value:k()(l,["metadata",R],""),options:p(v)}))}),{type:b,customField:C}=c[s],{isResizable:T}=u[C]??u[b],D=e.createElement(ye.P,{col:6,key:"size"},e.createElement(Ze.P,{value:l?.size,name:"size",onChange:R=>{o({name:s,value:R})},label:r({id:(0,Te.Z)("containers.SettingPage.editSettings.size.label"),defaultMessage:"Size"})},El.map(([R,v])=>e.createElement(be.W,{key:R,value:R},v)))),M=vl.includes(c[s].type),I=e.createElement(ye.P,{col:6,key:"step"},e.createElement(Ze.P,{value:k()(l,["metadata","step"],1),name:"step",onChange:R=>t({target:{name:"step",value:R}}),label:r({id:(0,Te.Z)("containers.SettingPage.editSettings.step.label"),defaultMessage:"Time interval (minutes)"})},bl.map(R=>e.createElement(be.W,{key:R,value:R},R))));return e.createElement(e.Fragment,null,E,T&&D,M&&I)};pr.propTypes={onMetaChange:n().func.isRequired,onSizeChange:n().func.isRequired};var Cl=pr;const Rl=(0,U.ZP)(Z.k)`
|
|
77
|
-
svg {
|
|
78
|
-
width: ${32/16}rem;
|
|
79
|
-
height: ${24/16}rem;
|
|
80
|
-
margin-right: ${({theme:t})=>t.spaces[3]};
|
|
81
|
-
}
|
|
82
|
-
`,Rn=({onToggle:t,onMetaChange:o,onSizeChange:r,onSubmit:a,type:s,customFieldUid:c})=>{const{selectedField:l}=gt(),{formatMessage:d}=(0,Q.Z)(),m=()=>s==="timestamp"?"date":["decimal","float","integer","biginter"].includes(s)?"number":s;return e.createElement(ar.P,{onClose:t,labelledBy:"title"},e.createElement("form",{onSubmit:a},e.createElement(sr.x,null,e.createElement(Rl,null,e.createElement(ur,{type:m(),customFieldUid:c}),e.createElement(G.Z,{fontWeight:"bold",textColor:"neutral800",as:"h2",id:"title"},d({id:(0,f.OB)("containers.ListSettingsView.modal-form.edit-label"),defaultMessage:"Edit {fieldName}"},{fieldName:xt()(l)})))),e.createElement(ir.f,null,e.createElement(De.r,{gap:4},e.createElement(Cl,{onMetaChange:o,onSizeChange:r}))),e.createElement(lr.m,{startActions:e.createElement(le.z,{onClick:t,variant:"tertiary"},d({id:"app.components.Button.cancel",defaultMessage:"Cancel"})),endActions:e.createElement(le.z,{type:"submit"},d({id:"global.finish",defaultMessage:"Finish"}))})))};Rn.defaultProps={customFieldUid:null},Rn.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 Ml=Rn;const Mn=t=>t.reduce((o,r)=>o+r.size,0),Tl=t=>t.reduce((o,r,a)=>{const s={rowId:a,rowContent:r};return o.concat(s)},[]),Mt=t=>t.reduce((o,r)=>{let a=[];const s=r.rowContent.reduce((d,m)=>{const u=Mn(d);return m.name==="_TEMP_"||(u+m.size<=12?d.push(m):a.push(m)),d},[]),c=o.length===0?0:Math.max.apply(Math,o.map(d=>d.rowId))+1,l=Mn(s);if(l<12&&s.push({name:"_TEMP_",size:12-l}),o.push({rowId:c,rowContent:s}),a.length>0){const d=Mn(a);d<12&&a.push({name:"_TEMP_",size:12-d}),o.push({rowId:c+1,rowContent:a}),a=[]}return o},[]).filter(o=>o.rowContent.length>0).filter(o=>o.rowContent.length===1?o.rowContent[0].name!=="_TEMP_":!0),Dl=t=>t.reduce((o,r)=>{const a=r.rowContent.filter(s=>s.name!=="_TEMP_");return o.concat([a])},[]),Il=(t,o=[])=>o.reduce((r,{rowContent:a})=>{const s=a.find(c=>c.name===t)?.size??null;return s&&(r=s),r},null),Ol=(t,o,r=[])=>r.map(a=>(a.rowContent=a.rowContent.map(s=>s.name===t?{...s,size:o}:s),a));var Pl=(t,o,r)=>{let a=Ie()(o);return se()(a,["layouts","edit"],Mt(Tl(o.layouts.edit))),{...t,initialData:a,modifiedData:a,componentLayouts:r}},Tn=i(97889);const gr=6,Dn={fieldForm:{},componentLayouts:{},metaToEdit:"",initialData:{},metaForm:{},modifiedData:{}};var Zl=(t=Dn,o)=>(0,Tn.ZP)(t,r=>{const a=["modifiedData","layouts","edit"];switch(o.type){case"MOVE_ROW":{const s=k()(t,a,[]),{fromIndex:c,toIndex:l}=o;se()(r,a,(0,f.W3)(s,c,l));break}case"ON_ADD_FIELD":{const s=Ie()(t),c=k()(s,["modifiedData","attributes",o.name],{}),l=o.fieldSizes[c?.customField]?.default??o.fieldSizes[c?.type]?.default??gr,d=k()(s,a,[]).length,m=[...a,d-1,"rowContent"],u=k()(s,m,[]);let g=k()(s,a,[]);Array.isArray(u)?se()(g,[d>0?d-1:0,"rowContent"],[...u,{name:o.name,size:l}]):se()(g,[d>0?d-1:0,"rowContent"],[{name:o.name,size:l}]);const h=Mt(g);se()(r,a,h);break}case"ON_CHANGE":{se()(r,["modifiedData",...o.keys],o.value);break}case"ON_CHANGE_META":{se()(r,["metaForm","metadata",...o.keys],o.value);break}case"ON_CHANGE_SIZE":{se()(r,["metaForm","size"],o.value);break}case"ON_RESET":{r.modifiedData=t.initialData;break}case"REMOVE_FIELD":{const s=k()(t,[...a,o.rowIndex,"rowContent"],[]);let c=Ie()(t);if(s.length===1||s.length===2&&k()(s,[1,"name"],"")==="_TEMP_"){const d=k()(t,a,[]);se()(c,a,d.filter((m,u)=>o.rowIndex!==u))}else se()(c,[...a,o.rowIndex,"rowContent"],s.filter((d,m)=>m!==o.fieldIndex));const l=Mt(k()(c,a,[]));se()(r,a,l);break}case"REORDER_DIFF_ROW":{const s=k()(t,[...a,o.dragRowIndex,"rowContent"],[]),c=k()(t,[...a,o.hoverRowIndex,"rowContent"],[]),l=k()(t,[...a,o.dragRowIndex,"rowContent",o.dragIndex],{}),d=[...c,l];let m=Ie()(t);se()(m,[...a,o.dragRowIndex,"rowContent"],s.filter((g,h)=>o.dragIndex!==h)),se()(m,[...a,o.hoverRowIndex,"rowContent"],(0,f.W3)(d,d.length-1,o.hoverIndex));const u=Mt(k()(m,a,[]));se()(r,a,u);break}case"REORDER_ROW":{const s=Ie()(t),c=k()(s,[...a,o.dragRowIndex,"rowContent"],[]);se()(s,[...a,o.dragRowIndex,"rowContent"],(0,f.W3)(c,o.dragIndex,o.hoverIndex));const l=Mt(k()(s,a,[]));se()(r,a,l);break}case"SET_FIELD_TO_EDIT":{r.metaToEdit=o.name,r.metaForm={metadata:k()(t,["modifiedData","metadatas",o.name,"edit"],{}),size:Il(o.name,t.modifiedData?.layouts?.edit)??gr};break}case"SUBMIT_META_FORM":{se()(r,["modifiedData","metadatas",t.metaToEdit,"edit"],t.metaForm.metadata);const s=Ie()(k()(t,a,[])),c=Ol(t.metaToEdit,t.metaForm.size,s);c.length>0&&se()(r,a,Mt(c));break}case"SUBMIT_SUCCEEDED":{r.initialData=t.modifiedData;break}case"UNSET_FIELD_TO_EDIT":{r.metaToEdit="",r.metaForm={};break}default:return r}}),xl=(t,o,r)=>{const{put:a}=(0,y.tg)();return a((0,f.IF)(r?`content-types/${o}/configuration`:`components/${o}/configuration`),t)};const In=({mainLayout:t,components:o,isContentTypeView:r,slug:a,updateLayout:s})=>{const[c,l]=(0,e.useReducer)(Zl,Dn,()=>Pl(Dn,t,o)),[d,m]=(0,e.useState)(!1),{trackUsage:u}=(0,y.rS)(),g=(0,y.lm)(),{goBack:h}=(0,ie.k6)(),[p,E]=(0,e.useState)(!1),[b,C]=(0,e.useState)(!1),{componentLayouts:T,initialData:D,modifiedData:M,metaToEdit:I,metaForm:R}=c,{formatMessage:v}=(0,Q.Z)(),x=k()(t,["info","displayName"],""),B=k()(M,["attributes"],{}),A=(0,de.v9)(Ct.Jg),P=Object.keys(B).filter(V=>{const H=k()(B,[V,"type"],"");return!["dynamiczone","json","text","relation","component","boolean","media","password","richtext","timestamp"].includes(H)&&!!H}),$=k()(M,["layouts","edit"],[]),q=mt()($,"rowContent"),L=Object.keys(M.attributes).filter(V=>k()(M,["metadatas",V,"edit","visible"],!1)===!0).filter(V=>q.findIndex(H=>H.name===V)===-1).sort(),X=({target:{name:V,value:H}})=>{l({type:"ON_CHANGE",keys:V.split("."),value:H})},K=()=>{E(V=>!V)},J=()=>{C(V=>!V)},F=({target:{name:V,value:H}})=>{l({type:"ON_CHANGE_META",keys:V.split("."),value:H})},w=({name:V,value:H})=>{l({type:"ON_CHANGE_SIZE",name:V,value:H})},O=V=>{V.preventDefault(),l({type:"SUBMIT_META_FORM"}),K()},S=V=>{V.preventDefault(),J()},z=(0,nt.useMutation)(V=>xl(V,a,r),{onSuccess({data:V}){s&&s(V.data),l({type:"SUBMIT_SUCCEEDED"}),J(),u("didEditEditSettings")},onError(){g({type:"warning",message:{id:"notification.error"}})}}),{isLoading:Y}=z,N=()=>{const V=sn()(Ie()(M),["layouts","metadatas","settings"]);se()(V,"layouts.edit",Dl(V.layouts.edit)),z.mutate(V)},j=(V,H)=>{l({type:"MOVE_RELATION",fromIndex:V,toIndex:H})},_=(V,H)=>{l({type:"MOVE_FIELD",fromIndex:V,toIndex:H})},ne=(V,H,he,ve)=>{l(he===ve?{type:"REORDER_ROW",dragRowIndex:he,dragIndex:V,hoverIndex:H}:{type:"REORDER_DIFF_ROW",dragIndex:V,hoverIndex:H,dragRowIndex:he,hoverRowIndex:ve})},me=(V,H)=>{l({type:"MOVE_ROW",fromIndex:V,toIndex:H})};return e.createElement(ln,{isContentTypeView:r,attributes:B,modifiedData:M,slug:a,componentLayouts:T,selectedField:I,fieldForm:R,onMoveRelation:j,onMoveField:_,moveRow:me,moveItem:ne,setEditFieldToSelect:V=>{l({type:"SET_FIELD_TO_EDIT",name:V}),K()},isDraggingSibling:d,setIsDraggingSibling:m},e.createElement(Ee.o,null,e.createElement("form",{onSubmit:S},e.createElement(Ce.T,{title:v({id:(0,f.OB)("components.SettingsViewWrapper.pluginHeader.title"),defaultMessage:`Configure the view - ${xt()(x)}`},{name:xt()(x)}),subtitle:v({id:(0,f.OB)("components.SettingsViewWrapper.pluginHeader.description.edit-settings"),defaultMessage:"Customize how the edit view will look like."}),navigationAction:e.createElement(y.rU,{startIcon:e.createElement(et.Z,null),onClick:V=>{V.preventDefault(),h()},to:"/"},v({id:"global.back",defaultMessage:"Back"})),primaryAction:e.createElement(le.z,{disabled:Le()(D,M),startIcon:e.createElement(Me.Z,null),type:"submit"},v({id:"global.save",defaultMessage:"Save"}))}),e.createElement(qe.D,null,e.createElement(W.x,{background:"neutral0",hasRadius:!0,shadow:"filterShadow",paddingTop:6,paddingBottom:6,paddingLeft:7,paddingRight:7},e.createElement(Z.k,{direction:"column",alignItems:"stretch",gap:4},e.createElement(G.Z,{variant:"delta",as:"h2"},v({id:(0,f.OB)("containers.SettingPage.settings"),defaultMessage:"Settings"})),e.createElement(De.r,null,e.createElement(ye.P,{col:6,s:12},e.createElement(Ze.P,{label:v({id:(0,f.OB)("containers.SettingPage.editSettings.entry.title"),defaultMessage:"Entry title"}),hint:v({id:(0,f.OB)("containers.SettingPage.editSettings.entry.title.description"),defaultMessage:"Set the display field of your entry"}),onChange:V=>{X({target:{name:"settings.mainField",value:V===""?null:V}})},value:M.settings.mainField},P.map(V=>e.createElement(be.W,{key:V,value:V},V))))),e.createElement(W.x,{paddingTop:2,paddingBottom:2},e.createElement(bt.i,null)),e.createElement(G.Z,{variant:"delta",as:"h3"},v({id:(0,f.OB)("containers.SettingPage.view"),defaultMessage:"View"})),e.createElement(ll,{attributes:B,editLayout:$,fields:L,onAddField:V=>{l({type:"ON_ADD_FIELD",name:V,fieldSizes:A})},onRemoveField:(V,H)=>{l({type:"REMOVE_FIELD",rowIndex:V,fieldIndex:H})}})))),e.createElement(y.QH,{bodyText:{id:(0,f.OB)("popUpWarning.warning.updateAllSettings"),defaultMessage:"This will modify all your settings"},iconRightButton:e.createElement(Me.Z,null),isConfirmButtonLoading:Y,isOpen:b,onToggleDialog:J,onConfirm:N,variantRightButton:"success-light"})),p&&e.createElement(Ml,{onSubmit:O,onToggle:K,onMetaChange:F,onSizeChange:w,type:k()(B,[I,"type"],""),customFieldUid:k()(B,[I,"customField"],"")})))};In.defaultProps={isContentTypeView:!1,updateLayout:null},In.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 On=In,Gt=i(46339),fr=i(4460);const kl=()=>({type:fr.c}),Fl=(t,o)=>({type:fr.O,layout:t,query:o});var Sl=i(66694),Al=()=>(0,e.useContext)(Sl.ux),hr=t=>{const{getAdminInjectedComponents:o}=Al(),[r,a,s]=t.split(".");return o(r,a,s)};const yr=({area:t,...o})=>hr(t).map(a=>e.createElement(a.Component,{key:a.name,...o}));yr.propTypes={area:n().string.isRequired};var Qt=yr,Ge=i(84306),it=i(41578);const Kt=()=>({type:it.ZA}),Pn=t=>({type:it.Id,data:t}),Zn=(t,o=!1)=>({type:it.TP,rawQuery:t,isSingleType:o}),Er=()=>({type:it.c2}),br=(t,o)=>({type:it.w7,componentsDataStructure:t,contentTypeDataStructure:o}),ge=t=>({type:it.d0,status:t}),lt=t=>({type:it.t9,data:t}),Ll=()=>({type:it.tE});var xn=t=>t["content-manager_editViewCrudReducer"];const kn=({allLayoutData:t,children:o,slug:r,id:a,origin:s})=>{const c=(0,nt.useQueryClient)(),l=(0,y.lm)(),{setCurrentStep:d}=(0,y.c1)(),{trackUsage:m}=(0,y.rS)(),{push:u,replace:g}=(0,ie.k6)(),[{rawQuery:h}]=(0,y.Kx)(),p=(0,de.I0)(),{componentsDataStructure:E,contentTypeDataStructure:b,data:C,isLoading:T,status:D}=(0,de.v9)(xn),M=(0,ae.Ky)(r),{formatAPIError:I}=(0,y.So)(f.OB),R=(0,e.useRef)(!0),v=(0,e.useRef)(m),x=(0,e.useRef)(t),B=(0,y.kY)(),{put:A,post:P,del:$}=B,q=a===null,L=(0,e.useMemo)(()=>q&&!s?null:(0,f.IF)(`collection-types/${r}/${s||a}`),[r,a,q,s]),X=(0,e.useCallback)(N=>s?(0,y.w6)(N,x.current.contentType,x.current.components):N,[s]),K=(0,e.useCallback)(N=>{const j=(0,f.kc)(N,x.current.contentType,x.current.components);return(0,y.dU)(j,x.current.contentType,x.current.components)},[]);(0,e.useEffect)(()=>{const N=Object.keys(t.components).reduce((ne,me)=>{const V=(0,f.Di)(k()(t,["components",me,"attributes"],{}),t.components);return ne[me]=(0,y.dU)(V,t.components[me],t.components),ne},{}),j=(0,f.Di)(t.contentType.attributes,t.components),_=(0,y.dU)(j,t.contentType,t.components);p(br(N,_))},[t,p]),(0,e.useEffect)(()=>()=>{p(Er())},[p]),(0,e.useEffect)(()=>{const j=Ge.default.CancelToken.source(),_=async me=>{p(Kt());try{const{data:V}=await B.get(L,{cancelToken:me.token});p(Pn(K(X(V))))}catch(V){if(Ge.default.isCancel(V))return;const H=k()(V,"response.status",null);if(H===404){u(M);return}H===403&&(l({type:"info",message:{id:(0,f.OB)("permissions.not-allowed.update")}}),u(M))}},ne=async()=>{await p(Kt()),await p(Zn(h))};return R.current?(L?_(j):ne(),()=>{j.cancel("Operation canceled by the user.")}):()=>{}},[B,X,K,u,L,p,h,M,l]);const J=(0,e.useCallback)(N=>{l({type:"warning",message:I(N)})},[l,I]),F=(0,e.useCallback)(async N=>{try{v.current("willDeleteEntry",N);const{data:j}=await $((0,f.IF)(`collection-types/${r}/${a}`));return l({type:"success",message:{id:(0,f.OB)("success.record.delete")}}),v.current("didDeleteEntry",N),g(M),Promise.resolve(j)}catch(j){return v.current("didNotDeleteEntry",{error:j,...N}),Promise.reject(j)}},[a,r,l,$,M,g]),w=(0,e.useCallback)(async(N,j)=>{const _=typeof s=="string"?`${(0,f.IF)(`collection-types/${r}/clone/${s}`)}${h}`:`${(0,f.IF)(`collection-types/${r}`)}${h}`;try{p(ge("submit-pending"));const{data:ne}=await P(_,N);return v.current("didCreateEntry",j),l({type:"success",message:{id:(0,f.OB)("success.record.save")}}),d("contentManager.success"),c.invalidateQueries(["relation"]),p(lt(K(ne))),p(ge("resolved")),g(`/content-manager/collectionType/${r}/${ne.id}${h}`),Promise.resolve(ne)}catch(ne){return J(ne),v.current("didNotCreateEntry",{error:ne,trackerProperty:j}),p(ge("resolved")),Promise.reject(ne)}},[s,K,J,g,r,p,h,l,d,c,P]),O=(0,e.useCallback)(async()=>{try{v.current("willCheckDraftRelations");const N=(0,f.IF)(`collection-types/${r}/${a}/actions/numberOfDraftRelations`);p(ge("draft-relation-check-pending"));const j=await B.get(N);return v.current("didCheckDraftRelations"),p(ge("resolved")),j.data.data}catch(N){return J(N),p(ge("resolved")),Promise.reject(N)}},[J,a,r,p,B]),S=(0,e.useCallback)(async()=>{try{v.current("willPublishEntry");const N=(0,f.IF)(`collection-types/${r}/${a}/actions/publish`);p(ge("publish-pending"));const{data:j}=await P(N);return v.current("didPublishEntry"),p(lt(K(j))),p(ge("resolved")),l({type:"success",message:{id:(0,f.OB)("success.record.publish")}}),Promise.resolve(j)}catch(N){return J(N),p(ge("resolved")),Promise.reject(N)}},[K,J,a,r,p,l,P]),z=(0,e.useCallback)(async(N,j)=>{const _=(0,f.IF)(`collection-types/${r}/${a}`);try{v.current("willEditEntry",j),p(ge("submit-pending"));const{data:ne}=await A(_,N);return v.current("didEditEntry",{trackerProperty:j}),l({type:"success",message:{id:(0,f.OB)("success.record.save")}}),c.invalidateQueries(["relation"]),p(lt(K(ne))),p(ge("resolved")),Promise.resolve(ne)}catch(ne){return v.current("didNotEditEntry",{error:ne,trackerProperty:j}),J(ne),p(ge("resolved")),Promise.reject(ne)}},[K,J,r,a,p,l,c,A]),Y=(0,e.useCallback)(async()=>{const N=(0,f.IF)(`collection-types/${r}/${a}/actions/unpublish`);p(ge("unpublish-pending"));try{v.current("willUnpublishEntry");const{data:j}=await P(N);return v.current("didUnpublishEntry"),l({type:"success",message:{id:(0,f.OB)("success.record.unpublish")}}),p(lt(K(j))),p(ge("resolved")),Promise.resolve(j)}catch(j){return p(ge("resolved")),J(j),Promise.reject(j)}},[K,J,a,r,p,l,P]);return o({componentsDataStructure:E,contentTypeDataStructure:b,data:C,isCreatingEntry:q,isLoadingForData:T,onDelete:F,onPost:w,onPublish:S,onDraftRelationCheck:O,onPut:z,onUnpublish:Y,status:D,redirectionLink:M})};kn.defaultProps={id:null,origin:null},kn.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 wl=(0,e.memo)(kn,Le()),ft=i(3685),Fn=i(69783),vr=i(86308);const Sn=({hasError:t,isDisabled:o,isOpen:r,children:a,onClick:s})=>e.createElement($l,{type:"button",onClick:s,disabled:o,hasError:t,background:"neutral0",paddingTop:3,paddingBottom:3,paddingLeft:4,paddingRight:4,style:{cursor:o?"not-allowed":"pointer"}},e.createElement(Z.k,{as:"span",gap:2},e.createElement(An,{"aria-hidden":!0,$isOpen:r,$hasError:t&&!r}),e.createElement(G.Z,{variant:"pi",fontWeight:"bold",textColor:t&&!r?"danger600":"neutral500"},a))),An=(0,U.ZP)(vr.Z)`
|
|
83
|
-
height: ${({theme:t})=>t.spaces[6]};
|
|
84
|
-
width: ${({theme:t})=>t.spaces[6]};
|
|
85
|
-
transform: ${({$isOpen:t})=>t?"rotate(45deg)":"rotate(0deg)"};
|
|
86
|
-
> circle {
|
|
87
|
-
fill: ${({theme:t,$hasError:o})=>o?t.colors.danger200:t.colors.neutral150};
|
|
88
|
-
}
|
|
89
|
-
> path {
|
|
90
|
-
fill: ${({theme:t,$hasError:o})=>o?t.colors.danger600:t.colors.neutral600};
|
|
91
|
-
}
|
|
92
|
-
`,$l=(0,U.ZP)(Fn.Y)`
|
|
93
|
-
border-radius: 26px;
|
|
94
|
-
border-color: ${({theme:t})=>t.colors.neutral150};
|
|
95
|
-
box-shadow: ${({theme:t})=>t.shadows.filterShadow};
|
|
96
|
-
|
|
97
|
-
&:hover {
|
|
98
|
-
${G.Z} {
|
|
99
|
-
color: ${({theme:t})=>t.colors.primary600};
|
|
100
|
-
}
|
|
101
|
-
|
|
102
|
-
${An} {
|
|
103
|
-
> circle {
|
|
104
|
-
fill: ${({theme:t})=>t.colors.primary600};
|
|
105
|
-
}
|
|
106
|
-
> path {
|
|
107
|
-
fill: ${({theme:t})=>t.colors.neutral100};
|
|
108
|
-
}
|
|
109
|
-
}
|
|
110
|
-
}
|
|
111
|
-
&:active {
|
|
112
|
-
${G.Z} {
|
|
113
|
-
color: ${({theme:t})=>t.colors.primary600};
|
|
114
|
-
}
|
|
115
|
-
${An} {
|
|
116
|
-
> circle {
|
|
117
|
-
fill: ${({theme:t})=>t.colors.primary600};
|
|
118
|
-
}
|
|
119
|
-
> path {
|
|
120
|
-
fill: ${({theme:t})=>t.colors.neutral100};
|
|
121
|
-
}
|
|
122
|
-
}
|
|
123
|
-
}
|
|
124
|
-
`;Sn.defaultProps={hasError:!1,isDisabled:!1,isOpen:!1},Sn.propTypes={children:n().node.isRequired,hasError:n().bool,isDisabled:n().bool,isOpen:n().bool,onClick:n().func.isRequired};var Cr=i(861),Ln=i(83828),wn=i(61762),$n=i(89966);const Bn=({category:t,components:o,variant:r,isOpen:a,onAddComponent:s,onToggle:c})=>{const{formatMessage:l}=(0,Q.Z)(),d=()=>{c(t)};return e.createElement(Ln.U,{expanded:a,onToggle:d,size:"S"},e.createElement(wn.B,{variant:r,title:l({id:t,defaultMessage:t}),togglePosition:"left"}),e.createElement($n.v,null,e.createElement(W.x,{paddingTop:4,paddingBottom:4,paddingLeft:3,paddingRight:3},e.createElement(Bl,null,o.map(({componentUid:m,info:{displayName:u,icon:g}})=>e.createElement(Nl,{key:m,as:"button",type:"button",background:"neutral100",justifyContent:"center",onClick:s(m),hasRadius:!0,height:(0,y.Q1)(84),shrink:0,borderColor:"neutral200"},e.createElement(Z.k,{direction:"column",gap:1,alignItems:"center",justifyContent:"center"},e.createElement(St,{icon:g}),e.createElement(G.Z,{variant:"pi",fontWeight:"bold",textColor:"neutral600"},l({id:u,defaultMessage:u})))))))))},Bl=U.ZP.div`
|
|
125
|
-
display: grid;
|
|
126
|
-
grid-template-columns: repeat(auto-fit, ${140/16}rem);
|
|
127
|
-
grid-gap: ${({theme:t})=>t.spaces[1]};
|
|
128
|
-
`,Nl=(0,U.ZP)(Z.k)`
|
|
129
|
-
&:focus,
|
|
130
|
-
&:hover {
|
|
131
|
-
border: 1px solid ${({theme:t})=>t.colors.primary200};
|
|
132
|
-
background: ${({theme:t})=>t.colors.primary100};
|
|
133
|
-
|
|
134
|
-
${G.Z} {
|
|
135
|
-
color: ${({theme:t})=>t.colors.primary600};
|
|
136
|
-
}
|
|
137
|
-
|
|
138
|
-
/* > Flex > ComponentIcon */
|
|
139
|
-
> div > div:first-child {
|
|
140
|
-
background: ${({theme:t})=>t.colors.primary200};
|
|
141
|
-
color: ${({theme:t})=>t.colors.primary600};
|
|
142
|
-
}
|
|
143
|
-
}
|
|
144
|
-
`;Bn.defaultProps={components:[],isOpen:!1,variant:"primary"},Bn.propTypes={category:n().string.isRequired,components:n().array,isOpen:n().bool,onAddComponent:n().func.isRequired,onToggle:n().func.isRequired,variant:n().oneOf(["primary","secondary"])};const Nn=({dynamicComponentsByCategory:t,isOpen:o,onClickAddComponent:r})=>{const{formatMessage:a}=(0,Q.Z)(),[s,c]=(0,e.useState)("");(0,e.useEffect)(()=>{const m=Object.keys(t);o&&m.length>0&&c(m[0])},[o,t]);const l=m=>()=>{r(m),c("")},d=m=>{c(u=>u===m?"":m)};return o?e.createElement(W.x,{paddingTop:6,paddingBottom:6,paddingLeft:5,paddingRight:5,background:"neutral0",shadow:"tableShadow",borderColor:"neutral150",hasRadius:!0},e.createElement(Z.k,{justifyContent:"center"},e.createElement(G.Z,{fontWeight:"bold",textColor:"neutral600"},a({id:(0,f.OB)("components.DynamicZone.ComponentPicker-label"),defaultMessage:"Pick one component"}))),e.createElement(W.x,{paddingTop:2},e.createElement(Cr.k,{attributeName:"data-strapi-accordion-toggle"},Object.entries(t).map(([m,u],g)=>e.createElement(Bn,{key:m,category:m,components:u,onAddComponent:l,isOpen:m===s,onToggle:d,variant:g%2===1?"primary":"secondary"}))))):null};Nn.defaultProps={dynamicComponentsByCategory:{},isOpen:!1},Nn.propTypes={dynamicComponentsByCategory:n().shape({components:n().arrayOf(n().shape({componentUid:n().string.isRequired,info:n().object}))}),isOpen:n().bool,onClickAddComponent:n().func.isRequired};var Be=i(65588),Rr=i(91647),jn=i(49825),jl=i(61868),Wl=i.n(jl);const zl=U.ZP.span`
|
|
145
|
-
> svg {
|
|
146
|
-
width: ${(0,y.Q1)(24)};
|
|
147
|
-
height: ${(0,y.Q1)(24)};
|
|
148
|
-
> circle {
|
|
149
|
-
fill: ${({theme:t})=>t.colors.primary200};
|
|
150
|
-
}
|
|
151
|
-
> path {
|
|
152
|
-
fill: ${({theme:t})=>t.colors.primary600};
|
|
153
|
-
}
|
|
154
|
-
}
|
|
155
|
-
`,Wn=({error:t,isReadOnly:o,onClick:r})=>{const{formatMessage:a}=(0,Q.Z)();return e.createElement(e.Fragment,null,e.createElement(W.x,{as:"button",background:"neutral100",borderColor:t?"danger600":"neutral200",disabled:o,hasRadius:!0,onClick:r,paddingTop:9,paddingBottom:9,type:"button"},e.createElement(Z.k,{direction:"column",gap:2},e.createElement(Z.k,{justifyContent:"center",style:{cursor:o?"not-allowed":"inherit"}},e.createElement(zl,null,e.createElement(vr.Z,null))),e.createElement(Z.k,{justifyContent:"center"},e.createElement(G.Z,{textColor:"primary600",variant:"pi",fontWeight:"bold"},a({id:(0,f.OB)("components.empty-repeatable"),defaultMessage:"No entry yet. Click on the button below to add one."}))))),t?.id&&e.createElement(G.Z,{textColor:"danger600",variant:"pi"},a(t,{...t.values})))};Wn.defaultProps={error:void 0,isReadOnly:!1},Wn.propTypes={error:n().shape({id:n().string.isRequired,defaultMessage:n().string.isRequired,values:n().object}),isReadOnly:n().bool,onClick:n().func.isRequired};var Mr=Wn;const wt=new Map;var zn=(t=[])=>{const[o,r]=(0,e.useState)(Object.fromEntries(wt)),a=t.filter(m=>!wt.get(m)),[s,c]=(0,e.useState)(()=>!!a.length),l=(0,y.mZ)();(0,e.useEffect)(()=>{const m=g=>{r(g),c(!1)},u=async(g,h)=>{const p=await Promise.all(h);g.forEach((E,b)=>{wt.set(E,p[b].default)}),m(Object.fromEntries(wt))};if(a.length>0){c(!0);const g=a.reduce((h,p)=>{const E=l.get(p);return E&&h.push(E.components.Input()),h},[]);g.length>0&&u(a,g)}},[a,l]);const d=(0,e.useCallback)(()=>{wt.clear(),r({})},[]);return{isLazyLoading:s,lazyComponentStore:o,cleanup:d}},Ul=i(9086),ql=i.n(Ul),Vl=i(88708),$t=i.n(Vl),Hl=i(38705),Tt=i(69932),Gl=i(27169),Tr=i(75536),Ql=i(63642);const Kl=(0,U.ZP)(Ql.E)`
|
|
156
|
-
svg {
|
|
157
|
-
height: 1rem;
|
|
158
|
-
width: 1rem;
|
|
159
|
-
path {
|
|
160
|
-
fill: ${({theme:t})=>t.colors.neutral400};
|
|
161
|
-
}
|
|
162
|
-
}
|
|
163
|
-
|
|
164
|
-
svg:hover {
|
|
165
|
-
path {
|
|
166
|
-
fill: ${({theme:t})=>t.colors.primary600};
|
|
167
|
-
}
|
|
168
|
-
}
|
|
169
|
-
`,Dr=(0,U.ZP)(Z.k)`
|
|
170
|
-
svg {
|
|
171
|
-
height: ${12/16}rem;
|
|
172
|
-
width: ${12/16}rem;
|
|
173
|
-
|
|
174
|
-
path {
|
|
175
|
-
fill: ${({theme:t,available:o})=>o?t.colors.success600:t.colors.danger600};
|
|
176
|
-
}
|
|
177
|
-
}
|
|
178
|
-
`,Yl=U.F4`
|
|
179
|
-
from {
|
|
180
|
-
transform: rotate(0deg);
|
|
181
|
-
}
|
|
182
|
-
to {
|
|
183
|
-
transform: rotate(359deg);
|
|
184
|
-
}
|
|
185
|
-
`,Xl=(0,U.ZP)(Z.k)`
|
|
186
|
-
animation: ${Yl} 2s infinite linear;
|
|
187
|
-
`;var Jl=/^[A-Za-z0-9-_.~]*$/;const Un=({attribute:t,contentTypeUID:o,hint:r,disabled:a,error:s,intlLabel:c,labelAction:l,name:d,onChange:m,value:u,placeholder:g,required:h})=>{const{modifiedData:p,initialData:E,layout:b}=(0,y.Wq)(),[C,T]=(0,e.useState)(!1),[D,M]=(0,e.useState)(null),I=(0,Tr.Z)(u,300),R=(0,e.useRef)(),v=(0,y.lm)(),{formatAPIError:x}=(0,y.So)(),B=E[d],{formatMessage:A}=(0,Q.Z)(),P=b?.options?.timestamps??0,$=!E[P],q=(0,Tr.Z)(p[t.targetField],300),[L,X]=(0,e.useState)(!1),[K,J]=(0,e.useState)(null),{post:F}=(0,y.kY)(),w=c.id?A({id:c.id,defaultMessage:c.defaultMessage},{...c.values}):d,O=g?A({id:g.id,defaultMessage:g.defaultMessage},{...g.values}):"";R.current=async(j=!1)=>{T(!0);try{const{data:{data:_}}=await F((0,f.IF)("uid/generate"),{contentTypeUID:o,field:d,data:p});m({target:{name:d,value:_,type:"text"}},j),T(!1)}catch(_){T(!1),v({type:"warning",message:x(_)})}};const S=async()=>{if(u){T(!0);try{const{data:j}=await F((0,f.IF)("uid/check-availability"),{contentTypeUID:o,field:d,value:u?u.trim():""});T(!1),M(j)}catch(j){T(!1),v({type:"warning",message:x(j)})}}};(0,e.useEffect)(()=>{!u&&t.required&&R.current(!0)},[t.required,R,u]),(0,e.useEffect)(()=>{I?.trim().match(Jl)&&I!==B&&S(),I||M(null)},[B,I]),(0,e.useEffect)(()=>{let j;return D?.isAvailable&&(j=setTimeout(()=>{M(null)},4e3)),()=>{j&&clearTimeout(j)}},[D]),(0,e.useEffect)(()=>{!L&&$&&q&&p[t.targetField]&&!u&&R.current(!0)},[q,L,$]);const z=()=>{J(A({id:"content-manager.components.uid.regenerate",defaultMessage:"Regenerate"}))},Y=()=>{J(null)},N=j=>{j.target.value&&$&&X(!0),m(j)};return e.createElement(vn.o,{disabled:a,error:s,endAction:e.createElement(Z.k,{position:"relative",gap:1},D&&!K&&e.createElement(Dr,{alignItems:"center",gap:1,justifyContent:"flex-end",available:!!D?.isAvailable,"data-not-here-outer":!0,position:"absolute",pointerEvents:"none",right:6,width:"100px"},D?.isAvailable?e.createElement(Hl.Z,null):e.createElement(Tt.Z,null),e.createElement(G.Z,{textColor:D.isAvailable?"success600":"danger600",variant:"pi"},A(D.isAvailable?{id:"content-manager.components.uid.available",defaultMessage:"Available"}:{id:"content-manager.components.uid.unavailable",defaultMessage:"Unavailable"}))),!a&&e.createElement(e.Fragment,null,K&&e.createElement(Dr,{alignItems:"center",justifyContent:"flex-end",gap:1},e.createElement(G.Z,{textColor:"primary600",variant:"pi"},K)),e.createElement(Kl,{onClick:()=>R.current(),label:A({id:"content-manager.components.uid.regenerate",defaultMessage:"Regenerate"}),onMouseEnter:z,onMouseLeave:Y},C?e.createElement(Xl,{"data-testid":"loading-wrapper"},e.createElement(Gl.Z,null)):e.createElement(pn.Z,null)))),hint:r,label:w,labelAction:l,name:d,onChange:N,placeholder:O,value:u||"",required:h})};Un.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])},Un.defaultProps={disabled:!1,error:void 0,labelAction:void 0,placeholder:void 0,value:"",required:!1,hint:""};var _l=Un;function ec(t,o){return r=>{const a=o(r);return e.createElement(t,{...r,...a})}}var tc=ec;const nc=(t=[],o=[])=>{const r=t.reduce((s,c)=>o.find(l=>l.id===c.id)?s:[...s,c.id],[]),a=o.reduce((s,c)=>t.find(l=>l.id===c.id)?s:[...s,c.id],[]);return[r,a]},ht={DRAFT:"draft",PUBLISHED:"published"},qn=5,oc=10;function rc(t,o){return`${(0,f.IF)(`collectionType/${t}/${o??""}`)}`}const Vn=(t,{shouldAddLink:o,mainFieldName:r,targetModel:a})=>{const s={...t};return o&&(s.href=rc(a,s.id)),s.publicationState=!1,s?.publishedAt!==void 0&&(s.publicationState=s.publishedAt?ht.PUBLISHED:ht.DRAFT),s.mainField=s[r],s},ac=(t,{shouldAddLink:o=!1,mainFieldName:r,targetModel:a}={})=>[...t].map(s=>Vn(s,{shouldAddLink:o,mainFieldName:r,targetModel:a})),sc=(t,{mainFieldName:o})=>{const{data:r}=t,{pages:a=[]}=r??{};return{...t,data:a.map(s=>s?.results.map(c=>Vn(c,{mainFieldName:o}))).filter(Boolean).flat()}};function ic({componentUid:t,isUserAllowedToEditField:o,isUserAllowedToReadField:r,name:a,queryInfos:s}){const{isCreatingEntry:c,createActionAllowedFields:l,readActionAllowedFields:d,updateActionAllowedFields:m,slug:u,modifiedData:g}=(0,y.Wq)(),{params:h}=(0,ie.$B)("/content-manager/collectionType/:collectionType/create/clone/:origin")??{},{origin:p}=h??{},E=(0,e.useMemo)(()=>o===!0?!0:(c?l:m).includes(a),[c,l,a,o,m]),b=(0,e.useMemo)(()=>r?!0:(c?[]:d).includes(a),[c,r,a,d]),C=a.split(".");let T;t&&(T=k()(g,C.slice(0,-1))?.id);const D=p||g.id,M=(0,e.useMemo)(()=>c&&!p?null:t?T?(0,f.IF)(`relations/${t}/${T}/${C.at(-1)}`):null:(0,f.IF)(`relations/${u}/${D}/${a.split(".").at(-1)}`),[c,p,t,u,D,a,T,C]),I=(0,e.useMemo)(()=>t?(0,f.IF)(`relations/${t}/${a.split(".").at(-1)}`):(0,f.IF)(`relations/${u}/${a.split(".").at(-1)}`),[t,u,a]);return{entityId:D,componentId:T,isComponentRelation:Boolean(t),queryInfos:{...s,endpoints:{search:I,relation:M}},isCloningEntry:Boolean(p),isCreatingEntry:c,isFieldAllowed:E,isFieldReadable:b}}var lc=ic;const cc=(t,{relation:o,search:r})=>{const[a,s]=(0,e.useState)({}),[c,l]=(0,e.useState)(0),{get:d}=(0,y.kY)(),m=async({pageParam:v=1})=>{try{const{data:x}=await d(o?.endpoint,{params:{...o.pageParams??{},page:v}});return l(v),x}catch{return null}},u=async({pageParam:v=1})=>{try{const{data:x}=await d(r.endpoint,{params:{...r.pageParams??{},...a,page:v}});return x}catch{return null}},{onLoad:g,normalizeArguments:h={}}=o,p=(0,nt.useInfiniteQuery)(["relation",...t],m,{cacheTime:0,enabled:o.enabled,getNextPageParam(v){const x=!v?.pagination;if(!(!v||x||v?.pagination.page>=v?.pagination.pageCount))return v.pagination.page+1},select:v=>({...v,pages:v.pages.map(x=>{if(!x)return x;const{data:B,results:A,pagination:P}=x,$=!!B;let q=[];return $?q=[B]:A&&(q=[...A].reverse()),{pagination:P,results:q}})})}),{pageGoal:E}=o,{status:b,data:C,fetchNextPage:T,hasNextPage:D}=p;(0,e.useEffect)(()=>{E>c&&D&&b==="success"&&T({pageParam:c+1})},[E,c,T,D,b]);const M=(0,y.W6)(g);(0,e.useEffect)(()=>{if(b==="success"&&C&&C.pages?.at(-1)?.results&&M){const v=ac(C.pages.at(-1).results,h);M(v)}},[b,M,C]);const I=(0,nt.useInfiniteQuery)(["relation",...t,"search",JSON.stringify(a)],u,{enabled:Object.keys(a).length>0,getNextPageParam(v){if(!(!v?.pagination||v.pagination.page>=v.pagination.pageCount))return v.pagination.page+1}});return{relations:p,search:I,searchFor:(v,x={})=>{s({...x,_q:v})}}},Ir=(t,o)=>r=>{const a=r.split(".");return a.reduce((s,c,l)=>{const d=k()(t,s),m=k()(o,[...a.slice(0,l),c,"__temp_key__"]);if(Array.isArray(d)&&typeof m=="number"){const u=d.findIndex(g=>g.__temp_key__===m);return s.push(u.toString()),s}return s.push(c),s},[])};var dc=i(50428),uc=i(87107),mc=i(28847),Or=i(7563),pc=i(67014),gc=i(47851),Yt=i(63919),Hn=i(41234),Xt=i(35331),fc=i(41044),hc=i(67582);const yc=U.ZP.div`
|
|
188
|
-
flex-shrink: 0;
|
|
189
|
-
width: ${(0,y.Q1)(6)};
|
|
190
|
-
height: ${(0,y.Q1)(6)};
|
|
191
|
-
margin-right: ${({theme:t})=>t.spaces[2]};
|
|
192
|
-
background-color: ${({theme:t,isDraft:o})=>t.colors[o?"secondary600":"success600"]};
|
|
193
|
-
border-radius: 50%;
|
|
194
|
-
`,Pr=t=>{const{formatMessage:o}=(0,Q.Z)(),r=hc.c.Option,{publicationState:a,mainField:s,id:c}=t.data;if(a){const l=a==="draft",d={id:(0,f.OB)("components.Select.draft-info-title"),defaultMessage:"State: Draft"},m={id:(0,f.OB)("components.Select.publish-info-title"),defaultMessage:"State: Published"},u=o(l?d:m);return e.createElement(r,{...t},e.createElement(Z.k,null,e.createElement(yc,{title:u,isDraft:l}),e.createElement(G.Z,{ellipsis:!0},s??c)))}return e.createElement(r,{...t},s??c)};Pr.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 Gn=({children:t,loadMore:o,search:r,totalNumberOfRelations:a,size:s,...c})=>e.createElement(e.Fragment,null,e.createElement(Z.k,{paddingBottom:a>0?3:0,gap:2,justifyContent:"space-between",alignItems:"end",wrap:"wrap"},e.createElement(Z.k,{direction:"column",alignItems:"stretch",basis:s<=6?"100%":"70%",gap:1,...c},r),o),t);Gn.defaultProps={search:void 0,loadMore:void 0,totalNumberOfRelations:0},Gn.propTypes={children:n().node.isRequired,search:n().node,loadMore:n().node,size:n().number.isRequired,totalNumberOfRelations:n().number};var Zr=i(90553);const Jt=50,Dt=4,xr=(0,U.ZP)(Z.k)`
|
|
195
|
-
width: 100%;
|
|
196
|
-
/* Used to prevent endAction to be pushed out of container */
|
|
197
|
-
min-width: 0;
|
|
198
|
-
|
|
199
|
-
& > div[role='button'] {
|
|
200
|
-
cursor: all-scroll;
|
|
201
|
-
}
|
|
202
|
-
`,kr=(0,U.ZP)(Z.k)`
|
|
203
|
-
width: 100%;
|
|
204
|
-
/* Used to prevent endAction to be pushed out of container */
|
|
205
|
-
min-width: 0;
|
|
206
|
-
`,Qn=({ariaDescribedBy:t,children:o,displayValue:r,canDrag:a,disabled:s,endAction:c,iconButtonAriaLabel:l,style:d,id:m,index:u,name:g,onCancel:h,onDropItem:p,onGrabItem:E,status:b,updatePositionOfRelation:C,...T})=>{const[{handlerId:D,isDragging:M,handleKeyDown:I},R,v,x,B]=(0,Zr.Y)(a&&!s,{type:`${f._Q.RELATION}_${g}`,index:u,item:{displayedValue:r,status:b,id:m},onGrabItem:E,onDropItem:p,onCancel:h,onMoveItem:C,dropSensitivity:"immediate"}),A=(0,f.FE)(R,x);return(0,e.useEffect)(()=>{B((0,kt.rX)())},[B]),e.createElement(W.x,{style:d,as:"li",ref:v,"aria-describedby":t,cursor:a?"all-scroll":"default"},M?e.createElement(Ec,null):e.createElement(Z.k,{paddingTop:2,paddingBottom:2,paddingLeft:a?2:4,paddingRight:4,hasRadius:!0,borderSize:1,borderColor:"neutral200",background:s?"neutral150":"neutral0",justifyContent:"space-between",ref:a?A:void 0,"data-handler-id":D,...T},e.createElement(xr,{gap:1},a?e.createElement(Re.h,{forwardedAs:"div",role:"button",tabIndex:0,"aria-label":l,noBorder:!0,onKeyDown:I,disabled:s},e.createElement(st.Z,null)):null,e.createElement(kr,{justifyContent:"space-between"},o)),c&&e.createElement(W.x,{paddingLeft:4},c)))},Ec=()=>e.createElement(W.x,{paddingTop:2,paddingBottom:2,paddingLeft:4,paddingRight:4,hasRadius:!0,borderStyle:"dashed",borderColor:"primary600",borderWidth:"1px",background:"primary100",height:`calc(100% - ${Dt}px)`});Qn.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},Qn.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 bc=(0,U.ZP)(W.x)`
|
|
207
|
-
position: relative;
|
|
208
|
-
overflow-x: hidden;
|
|
209
|
-
overflow-y: auto;
|
|
210
|
-
|
|
211
|
-
&:before,
|
|
212
|
-
&:after {
|
|
213
|
-
position: absolute;
|
|
214
|
-
width: 100%;
|
|
215
|
-
height: 4px;
|
|
216
|
-
z-index: 1;
|
|
217
|
-
}
|
|
218
|
-
|
|
219
|
-
&:before {
|
|
220
|
-
/* TODO: as for DS Table component we would need this to be handled by the DS theme */
|
|
221
|
-
content: '';
|
|
222
|
-
background: linear-gradient(rgba(3, 3, 5, 0.2) 0%, rgba(0, 0, 0, 0) 100%);
|
|
223
|
-
top: 0;
|
|
224
|
-
opacity: ${({overflowDirection:t})=>t==="top-bottom"||t==="top"?1:0};
|
|
225
|
-
transition: opacity 0.2s ease-in-out;
|
|
226
|
-
}
|
|
227
|
-
|
|
228
|
-
&:after {
|
|
229
|
-
/* TODO: as for DS Table component we would need this to be handled by the DS theme */
|
|
230
|
-
content: '';
|
|
231
|
-
background: linear-gradient(0deg, rgba(3, 3, 5, 0.2) 0%, rgba(0, 0, 0, 0) 100%);
|
|
232
|
-
bottom: 0;
|
|
233
|
-
opacity: ${({overflowDirection:t})=>t==="top-bottom"||t==="bottom"?1:0};
|
|
234
|
-
transition: opacity 0.2s ease-in-out;
|
|
235
|
-
}
|
|
236
|
-
`,Kn=({children:t,overflow:o,...r})=>e.createElement(bc,{overflowDirection:o,...r},t);Kn.defaultProps={overflow:""},Kn.propTypes={children:n().node.isRequired,overflow:n().oneOf(["top-bottom","bottom","top",""])};const Fr=(0,U.ZP)(dc.r)`
|
|
237
|
-
display: block;
|
|
238
|
-
|
|
239
|
-
> span {
|
|
240
|
-
white-space: nowrap;
|
|
241
|
-
overflow: hidden;
|
|
242
|
-
text-overflow: ellipsis;
|
|
243
|
-
display: block;
|
|
244
|
-
}
|
|
245
|
-
`,Sr=U.ZP.button`
|
|
246
|
-
svg path {
|
|
247
|
-
fill: ${({theme:t,disabled:o})=>o?t.colors.neutral600:t.colors.neutral500};
|
|
248
|
-
}
|
|
249
|
-
|
|
250
|
-
&:hover svg path,
|
|
251
|
-
&:focus svg path {
|
|
252
|
-
fill: ${({theme:t,disabled:o})=>!o&&t.colors.neutral600};
|
|
253
|
-
}
|
|
254
|
-
`,Yn=({canReorder:t,description:o,disabled:r,error:a,iconButtonAriaLabel:s,id:c,name:l,numberOfRelationsToDisplay:d,label:m,labelAction:u,labelLoadMore:g,labelDisconnectRelation:h,listAriaDescription:p,liveText:E,loadingMessage:b,onCancel:C,onDropItem:T,onGrabItem:D,noRelationsMessage:M,onRelationConnect:I,onRelationLoadMore:R,onRelationDisconnect:v,onRelationReorder:x,onSearchNextPage:B,onSearch:A,placeholder:P,publicationStateTranslations:$,required:q,relations:L,searchResults:X,size:K})=>{const[J,F]=(0,e.useState)(null),[w,O]=(0,e.useState)(""),S=(0,e.useRef)(),z=(0,e.useRef)(),{data:Y}=X,N=L.data,j=N.length??0,_=(0,e.useMemo)(()=>j>d?Math.min(j,d)*(Jt+Dt)+Jt/2:Math.min(j,d)*(Jt+Dt),[j,d]),ne=!!g&&L.hasNextPage,me=(0,e.useMemo)(()=>Y.flat().filter(Boolean).map(ee=>({...ee,value:ee.id,label:ee.mainField})),[Y]);(0,e.useEffect)(()=>{if(j<=d)return O("");const ee=oe=>{const fe=oe.target.parentNode.scrollHeight,ot=oe.target.scrollHeight-oe.target.scrollTop;return oe.target.scrollTop===0?O("bottom"):O(ot===fe?"top":"top-bottom")},pe=z?.current;return!L.isLoading&&N.length>0&&pe&&z.current.addEventListener("scroll",ee),()=>{pe&&pe.removeEventListener("scroll",ee)}},[L,N,d,j]);const[V,H]=(0,e.useState)(!1),he=(0,e.useRef)(),ve=(0,e.useRef)([]);(0,e.useEffect)(()=>(me.length>0&&ve.current.length===0&&H(ee=>(ee&&(he.current=setTimeout(()=>{H(!0)},10)),!1)),()=>{ve.current=me||[]}),[me]),(0,e.useEffect)(()=>()=>{he.current&&clearTimeout(he.current)},[]);const Pe=()=>{H(!1)},Qe=()=>{H(!0),A()},Ke=(ee,pe)=>{x&&ee>=0&&ee<N.length&&x(pe,ee)},Ye=(0,ae.zH)(N.length),Ne=(0,e.useRef)(),ke=()=>{Ne.current="loadMore",R()};(0,e.useEffect)(()=>{Ne.current==="onChange"&&N.length!==Ye?S.current.scrollToItem(N.length,"end"):Ne.current==="loadMore"&&N.length!==Ye&&S.current.scrollToItem(0,"start"),Ne.current=void 0},[Ye,N]);const ue=`${l}-item-instructions`;return e.createElement(uc.g,{error:a,name:l,hint:o,id:c,required:q},e.createElement(Gn,{totalNumberOfRelations:j,size:K,search:e.createElement(e.Fragment,null,e.createElement(mc.Q,{action:u},m),e.createElement(y.JV,{menuPosition:"absolute",menuPlacement:"auto",components:{Option:Pr},options:me,isDisabled:r,isLoading:X.isLoading,error:a,inputId:c,isSearchable:!0,isClear:!0,loadingMessage:()=>b,onChange:ee=>{F(null),I(ee),Ne.current="onChange"},onInputChange:ee=>{F(ee),A(ee)},onMenuClose:Pe,onMenuOpen:Qe,menuIsOpen:V,noOptionsMessage:()=>M,onMenuScrollToBottom:()=>{X.hasNextPage&&B()},placeholder:P,name:l,value:J})),loadMore:ne&&e.createElement(Or.A,{disabled:L.isLoading||L.isFetchingNextPage,onClick:ke,loading:L.isLoading||L.isFetchingNextPage,startIcon:e.createElement(pn.Z,null)},g)},N.length>0&&e.createElement(Kn,{overflow:w},e.createElement(ft.T,{id:ue},p),e.createElement(ft.T,{"aria-live":"assertive"},E),e.createElement(fc.t7,{height:_,ref:S,outerRef:z,itemCount:j,itemSize:Jt+Dt,itemData:{name:l,ariaDescribedBy:ue,canDrag:t,disabled:r,handleCancel:C,handleDropItem:T,handleGrabItem:D,iconButtonAriaLabel:s,labelDisconnectRelation:h,onRelationDisconnect:v,publicationStateTranslations:$,relations:N,updatePositionOfRelation:Ke},itemKey:ee=>`${N[ee].mainField}_${N[ee].id}`,innerElementType:"ol"},Xn)),(o||a)&&e.createElement(W.x,{paddingTop:2},e.createElement(pc.J,null),e.createElement(gc.c,null))))},vc=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}),Cc=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});Yn.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:[]}},Yn.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:Cc,size:n().number.isRequired,relations:vc};const Xn=({data:t,index:o,style:r})=>{const{ariaDescribedBy:a,canDrag:s,disabled:c,handleCancel:l,handleDropItem:d,handleGrabItem:m,iconButtonAriaLabel:u,name:g,labelDisconnectRelation:h,onRelationDisconnect:p,publicationStateTranslations:E,relations:b,updatePositionOfRelation:C}=t,{publicationState:T,href:D,mainField:M,id:I}=b[o],R=T==="draft"?"secondary":"success";return e.createElement(Qn,{ariaDescribedBy:a,canDrag:s,disabled:c,displayValue:String(M??I),iconButtonAriaLabel:u,id:I,index:o,name:g,endAction:e.createElement(Sr,{"data-testid":`remove-relation-${I}`,disabled:c,type:"button",onClick:()=>p(b[o]),"aria-label":h},e.createElement(dn.J,{width:"12px",as:Xt.Z})),onCancel:l,onDropItem:d,onGrabItem:m,status:T||void 0,style:{...r,bottom:r.bottom??0+Dt,height:r.height??0-Dt},updatePositionOfRelation:C},e.createElement(W.x,{minWidth:0,paddingTop:1,paddingBottom:1,paddingRight:4},e.createElement(Yt.u,{description:M??`${I}`},D?e.createElement(Fr,{to:D},M??I):e.createElement(G.Z,{textColor:c?"neutral600":"primary600",ellipsis:!0},M??I))),T&&e.createElement(Hn.q,{variant:R,showBullet:!1,size:"S"},e.createElement(G.Z,{fontWeight:"bold",textColor:`${R}700`},E[T])))};Xn.defaultProps={data:{}},Xn.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 Rc=Yn;const Jn=({error:t,entityId:o,componentId:r,isComponentRelation:a,editable:s,description:c,intlLabel:l,isCreatingEntry:d,isCloningEntry:m,isFieldAllowed:u,isFieldReadable:g,labelAction:h,mainField:p,name:E,queryInfos:{endpoints:b,defaultParams:C,shouldDisplayRelationLink:T},placeholder:D,required:M,relationType:I,size:R,targetModel:v})=>{const[x,B]=(0,e.useState)(""),{formatMessage:A}=(0,Q.Z)(),{slug:P,initialData:$,modifiedData:q,relationConnect:L,relationDisconnect:X,relationLoad:K,relationReorder:J}=(0,y.Wq)(),F=E.split("."),w=Ir($,q)(E),O=k()(q,E,[]),S=Math.ceil(k()($,E,[]).length/qn),{relations:z,search:Y,searchFor:N}=cc([P,w.join("."),q.id,C],{relation:{enabled:!!b.relation,endpoint:b.relation,pageGoal:S,pageParams:{...C,pageSize:qn},onLoad(oe){K({target:{initialDataPath:["initialData",...w],modifiedDataPath:["modifiedData",...F],value:oe}})},normalizeArguments:{mainFieldName:p.name,shouldAddLink:T,targetModel:v}},search:{endpoint:b.search,pageParams:{...C,entityId:d||m?void 0:a?r:o,pageSize:oc}}}),j=(0,e.useMemo)(()=>I.toLowerCase().includes("morph"),[I]),_=["oneWay","oneToOne","manyToOne","oneToManyMorph","oneToOneMorph"].includes(I),ne=(0,e.useMemo)(()=>j?!0:d?!s:!u&&g||!s,[j,d,s,u,g]),me=oe=>{const fe=Vn(oe,{mainFieldName:p.name,shouldAddLink:T,targetModel:v});L({name:E,value:fe,toOneRelation:_})},V=oe=>{X({name:E,id:oe.id})},H=()=>{z.fetchNextPage()},he=(oe="")=>{const[fe,ot]=nc(O,k()($,E));N(oe,{idsToInclude:ot,idsToOmit:fe})},ve=()=>{Y.fetchNextPage()},Pe=oe=>`${oe+1} of ${O.length}`,Qe=(oe,fe)=>{const ot=O[oe];B(A({id:(0,f.OB)("dnd.reorder"),defaultMessage:"{item}, moved. New position in list: {position}."},{item:ot.mainField??ot.id,position:Pe(fe)})),J({name:E,newIndex:fe,oldIndex:oe})},Ke=oe=>{const fe=O[oe];B(A({id:(0,f.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:fe.mainField??fe.id,position:Pe(oe)}))},Ye=oe=>{const fe=O[oe];B(A({id:(0,f.OB)("dnd.drop-item"),defaultMessage:"{item}, dropped. Final position in list: {position}."},{item:fe.mainField??fe.id,position:Pe(oe)}))},Ne=oe=>{const fe=O[oe];B(A({id:(0,f.OB)("dnd.cancel-item"),defaultMessage:"{item}, dropped. Re-order cancelled."},{item:fe.mainField??fe.id}))};if(!u&&d||!d&&!u&&!g)return e.createElement(y.X0,{name:E,intlLabel:l,labelAction:h});const ke=O.length,ue=(k()($,w)??[]).length,ee=z.data?.pages[0]?.pagination?.total??0,pe=!z.data&&ke===ue?ke:ke-ue+ee;return e.createElement(Rc,{error:t,canReorder:!_,description:c,disabled:ne,iconButtonAriaLabel:A({id:(0,f.OB)("components.RelationInput.icon-button-aria-label"),defaultMessage:"Drag"}),id:E,label:`${A({id:l.id,defaultMessage:l.defaultMessage})} ${pe>0?`(${pe})`:""}`,labelAction:h,labelLoadMore:!d||m?A({id:(0,f.OB)("relation.loadMore"),defaultMessage:"Load More"}):null,labelDisconnectRelation:A({id:(0,f.OB)("relation.disconnect"),defaultMessage:"Remove"}),listAriaDescription:A({id:(0,f.OB)("dnd.instructions"),defaultMessage:"Press spacebar to grab and re-order"}),listHeight:320,liveText:x,loadingMessage:A({id:(0,f.OB)("relation.isLoading"),defaultMessage:"Relations are loading"}),name:E,noRelationsMessage:A({id:(0,f.OB)("relation.notAvailable"),defaultMessage:"No relations available"}),numberOfRelationsToDisplay:qn,onDropItem:Ye,onGrabItem:Ke,onCancel:Ne,onRelationConnect:me,onRelationDisconnect:V,onRelationLoadMore:H,onRelationReorder:Qe,onSearch:oe=>he(oe),onSearchNextPage:()=>ve(),placeholder:A(D||{id:(0,f.OB)("relation.add"),defaultMessage:"Add relation"}),publicationStateTranslations:{[ht.DRAFT]:A({id:(0,f.OB)("relation.publicationState.draft"),defaultMessage:"Draft"}),[ht.PUBLISHED]:A({id:(0,f.OB)("relation.publicationState.published"),defaultMessage:"Published"})},relations:sn()({...z,data:O},"data","hasNextPage","isFetchingNextPage","isLoading","isSuccess"),required:M,searchResults:sc(Y,{mainFieldName:p.name}),size:R})};Jn.defaultProps={componentId:void 0,entityId:void 0,editable:!0,error:void 0,description:"",labelAction:null,isComponentRelation:!1,isFieldAllowed:!0,placeholder:null,required:!1},Jn.propTypes={componentId:n().number,entityId: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,isCloningEntry:n().bool.isRequired,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 Mc=(0,e.memo)(Jn);var Tc=tc(Mc,lc);const _n=({id:t,error:o,name:r,hint:a})=>a.length===0||o?null:e.createElement(G.Z,{as:"p",variant:"pi",id:`${t||r}-hint`,textColor:"neutral600"},a);_n.defaultProps={id:void 0,error:void 0,hint:""},_n.propTypes={hint:n().oneOfType([n().string,n().array]),error:n().string,id:n().string,name:n().string.isRequired};var Dc=_n,Ic=i(87702),eo=i.n(Ic),to=i(59845),Oc=i(88591),Pc=i.n(Oc),Zc=i(20871),xc=i.n(Zc),kc=i(48375),Ar=i.n(kc),Fc=i(31089),Sc=i.n(Fc),Ac=i(16043),Lc=i.n(Ac),wc=i(5109),$c=i.n(wc),Bc=i(47955),Nc=i.n(Bc),jc=i(95706),Wc=i.n(jc),zc=i(6658),Uc=i.n(zc),qc=i(36407),Vc=i.n(qc);(async()=>{await i.e(7347).then(i.bind(i,74194))})();const It=new(Pc())({html:!0,xhtmlOut:!1,breaks:!0,langPrefix:"language-",linkify:!0,typographer:!0,highlight(t,o){if(o&&o!=="auto"&&(0,to.getLanguage)(o))return'<pre class="hljs language-'+It.utils.escapeHtml(o.toLowerCase())+'"><code>'+(0,to.highlight)(o,t,!0).value+"</code></pre>";if(o==="auto"){const r=(0,to.highlightAuto)(t);return'<pre class="hljs language-'+It.utils.escapeHtml(r.language)+'"><code>'+r.value+"</code></pre>"}return'<pre class="hljs"><code>'+It.utils.escapeHtml(t)+"</code></pre>"}}).use(xc()).use(Ar(),"warning").use(Ar(),"tip").use(Sc()).use(Lc()).use($c()).use(Nc()).use(Wc()).use(Uc()).use(Vc());It.renderer.rules.footnote_ref=(t,o,r,a,s)=>'<sup class="footnote-ref"><span>'+s.rules.footnote_caption(t,o,r,a,s)+"</span></sup>",It.renderer.rules.footnote_anchor=()=>' <span class="footnote-backref">\u21A9\uFE0E</span>';var Hc=It,Gc=i(13993),Lr=i.n(Gc);const Qc={...Lr().defaults,allowedTags:!1,allowedAttributes:{"*":["href","align","alt","center","width","height","type","controls","target"],img:["src","alt"],source:["src","type"]}};var Kc=t=>Lr()(t,Qc),Yc=U.ZP.div`
|
|
255
|
-
position: absolute;
|
|
256
|
-
top: 0;
|
|
257
|
-
width: 100%;
|
|
258
|
-
height: 100%;
|
|
259
|
-
overflow: auto;
|
|
260
|
-
padding: ${({theme:t})=>`${t.spaces[3]} ${t.spaces[4]}`};
|
|
261
|
-
font-size: ${14/16}rem;
|
|
262
|
-
background-color: ${({theme:t})=>t.colors.neutral0};
|
|
263
|
-
color: ${({theme:t})=>t.colors.neutral800};
|
|
264
|
-
line-height: ${({theme:t})=>t.lineHeights[6]};
|
|
265
|
-
|
|
266
|
-
h1,
|
|
267
|
-
h2,
|
|
268
|
-
h3,
|
|
269
|
-
h4,
|
|
270
|
-
h5,
|
|
271
|
-
h6 {
|
|
272
|
-
margin-block-start: ${({theme:t})=>t.spaces[2]};
|
|
273
|
-
margin-block-end: ${({theme:t})=>t.spaces[2]};
|
|
274
|
-
}
|
|
275
|
-
|
|
276
|
-
p {
|
|
277
|
-
margin-bottom: ${({theme:t})=>t.spaces[2]};
|
|
278
|
-
}
|
|
279
|
-
|
|
280
|
-
h1 {
|
|
281
|
-
font-size: ${36/16}rem;
|
|
282
|
-
font-weight: 600;
|
|
283
|
-
}
|
|
284
|
-
|
|
285
|
-
h2 {
|
|
286
|
-
font-size: ${30/16}rem;
|
|
287
|
-
font-weight: 500;
|
|
288
|
-
}
|
|
289
|
-
|
|
290
|
-
h3 {
|
|
291
|
-
font-size: ${24/16}rem;
|
|
292
|
-
font-weight: 500;
|
|
293
|
-
}
|
|
294
|
-
|
|
295
|
-
h4 {
|
|
296
|
-
font-size: ${20/16}rem;
|
|
297
|
-
font-weight: 500;
|
|
298
|
-
}
|
|
299
|
-
|
|
300
|
-
strong {
|
|
301
|
-
font-weight: 800;
|
|
302
|
-
}
|
|
303
|
-
|
|
304
|
-
em {
|
|
305
|
-
font-style: italic;
|
|
306
|
-
}
|
|
307
|
-
|
|
308
|
-
blockquote {
|
|
309
|
-
margin-top: ${({theme:t})=>t.spaces[8]};
|
|
310
|
-
margin-bottom: ${({theme:t})=>t.spaces[7]};
|
|
311
|
-
font-size: ${14/16}rem;
|
|
312
|
-
font-weight: 400;
|
|
313
|
-
border-left: 4px solid ${({theme:t})=>t.colors.neutral150};
|
|
314
|
-
font-style: italic;
|
|
315
|
-
padding: ${({theme:t})=>t.spaces[2]} ${({theme:t})=>t.spaces[5]};
|
|
316
|
-
}
|
|
317
|
-
|
|
318
|
-
img {
|
|
319
|
-
max-width: 100%;
|
|
320
|
-
}
|
|
321
|
-
|
|
322
|
-
table {
|
|
323
|
-
thead {
|
|
324
|
-
background: ${({theme:t})=>t.colors.neutral150};
|
|
325
|
-
|
|
326
|
-
th {
|
|
327
|
-
padding: ${({theme:t})=>t.spaces[4]};
|
|
328
|
-
}
|
|
329
|
-
}
|
|
330
|
-
tr {
|
|
331
|
-
border: 1px solid ${({theme:t})=>t.colors.neutral200};
|
|
332
|
-
}
|
|
333
|
-
th,
|
|
334
|
-
td {
|
|
335
|
-
padding: ${({theme:t})=>t.spaces[4]};
|
|
336
|
-
border: 1px solid ${({theme:t})=>t.colors.neutral200};
|
|
337
|
-
border-bottom: 0;
|
|
338
|
-
border-top: 0;
|
|
339
|
-
}
|
|
340
|
-
}
|
|
341
|
-
|
|
342
|
-
pre,
|
|
343
|
-
code {
|
|
344
|
-
font-size: ${14/16}rem;
|
|
345
|
-
border-radius: 4px;
|
|
346
|
-
/*
|
|
347
|
-
Hard coded since the color is the same between themes,
|
|
348
|
-
theme.colors.neutral800 changes between themes.
|
|
349
|
-
|
|
350
|
-
Matches the color of the JSON Input component.
|
|
351
|
-
*/
|
|
352
|
-
background-color: #32324d;
|
|
353
|
-
max-width: 100%;
|
|
354
|
-
overflow: auto;
|
|
355
|
-
padding: ${({theme:t})=>t.spaces[2]};
|
|
356
|
-
}
|
|
357
|
-
|
|
358
|
-
/* Inline code */
|
|
359
|
-
p,
|
|
360
|
-
pre,
|
|
361
|
-
td {
|
|
362
|
-
> code {
|
|
363
|
-
color: #839496;
|
|
364
|
-
}
|
|
365
|
-
}
|
|
366
|
-
|
|
367
|
-
ol {
|
|
368
|
-
list-style-type: decimal;
|
|
369
|
-
margin-block-start: ${({theme:t})=>t.spaces[4]};
|
|
370
|
-
margin-block-end: ${({theme:t})=>t.spaces[4]};
|
|
371
|
-
margin-inline-start: 0px;
|
|
372
|
-
margin-inline-end: 0px;
|
|
373
|
-
padding-inline-start: ${({theme:t})=>t.spaces[4]};
|
|
374
|
-
|
|
375
|
-
ol,
|
|
376
|
-
ul {
|
|
377
|
-
margin-block-start: 0px;
|
|
378
|
-
margin-block-end: 0px;
|
|
379
|
-
}
|
|
380
|
-
}
|
|
381
|
-
|
|
382
|
-
ul {
|
|
383
|
-
list-style-type: disc;
|
|
384
|
-
margin-block-start: ${({theme:t})=>t.spaces[4]};
|
|
385
|
-
margin-block-end: ${({theme:t})=>t.spaces[4]};
|
|
386
|
-
margin-inline-start: 0px;
|
|
387
|
-
margin-inline-end: 0px;
|
|
388
|
-
padding-inline-start: ${({theme:t})=>t.spaces[4]};
|
|
389
|
-
|
|
390
|
-
ul,
|
|
391
|
-
ol {
|
|
392
|
-
margin-block-start: 0px;
|
|
393
|
-
margin-block-end: 0px;
|
|
394
|
-
}
|
|
395
|
-
}
|
|
396
|
-
`;const no=({data:t})=>{const o=(0,e.useMemo)(()=>Kc(Hc.render(t.replaceAll("\\n",`
|
|
397
|
-
`)||"")),[t]);return e.createElement(Yc,null,e.createElement("div",{dangerouslySetInnerHTML:{__html:o}}))};no.defaultProps={data:""},no.propTypes={data:n().string};var wr=(0,e.memo)(no);const Xc=U.ZP.div`
|
|
398
|
-
cursor: ${({disabled:t})=>t?"not-allowed !important":"auto"};
|
|
399
|
-
height: 100%;
|
|
400
|
-
/* BASICS */
|
|
401
|
-
.CodeMirror-placeholder {
|
|
402
|
-
color: ${({theme:t})=>t.colors.neutral600} !important;
|
|
403
|
-
}
|
|
404
|
-
|
|
405
|
-
.CodeMirror {
|
|
406
|
-
/* Set height, width, borders, and global font properties here */
|
|
407
|
-
font-size: ${14/16}rem;
|
|
408
|
-
height: ${({isExpandMode:t})=>t?"100%":"290px"};
|
|
409
|
-
color: ${({theme:t})=>t.colors.neutral800};
|
|
410
|
-
direction: ltr;
|
|
411
|
-
font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Oxygen, Ubuntu, Cantarell,
|
|
412
|
-
'Open Sans', 'Helvetica Neue', sans-serif;
|
|
413
|
-
}
|
|
414
|
-
|
|
415
|
-
/* PADDING */
|
|
416
|
-
|
|
417
|
-
.CodeMirror-lines {
|
|
418
|
-
padding: ${({theme:t})=>`${t.spaces[3]} ${t.spaces[4]}`};
|
|
419
|
-
/* Vertical padding around content */
|
|
420
|
-
}
|
|
421
|
-
|
|
422
|
-
.CodeMirror-scrollbar-filler,
|
|
423
|
-
.CodeMirror-gutter-filler {
|
|
424
|
-
/* The little square between H and V scrollbars */
|
|
425
|
-
background-color: ${({theme:t})=>`${t.colors.neutral0}`};
|
|
426
|
-
}
|
|
427
|
-
|
|
428
|
-
/* GUTTER */
|
|
429
|
-
|
|
430
|
-
.CodeMirror-gutters {
|
|
431
|
-
border-right: 1px solid #ddd;
|
|
432
|
-
background-color: #f7f7f7;
|
|
433
|
-
white-space: nowrap;
|
|
434
|
-
}
|
|
435
|
-
.CodeMirror-linenumbers {
|
|
436
|
-
}
|
|
437
|
-
.CodeMirror-linenumber {
|
|
438
|
-
padding: 0 3px 0 5px;
|
|
439
|
-
min-width: 20px;
|
|
440
|
-
text-align: right;
|
|
441
|
-
color: #999;
|
|
442
|
-
white-space: nowrap;
|
|
443
|
-
}
|
|
444
|
-
|
|
445
|
-
.CodeMirror-guttermarker {
|
|
446
|
-
color: black;
|
|
447
|
-
}
|
|
448
|
-
.CodeMirror-guttermarker-subtle {
|
|
449
|
-
color: #999;
|
|
450
|
-
}
|
|
451
|
-
|
|
452
|
-
/* CURSOR */
|
|
453
|
-
|
|
454
|
-
.CodeMirror-cursor {
|
|
455
|
-
border-left: 1px solid black;
|
|
456
|
-
border-right: none;
|
|
457
|
-
width: 0;
|
|
458
|
-
}
|
|
459
|
-
/* Shown when moving in bi-directional text */
|
|
460
|
-
.CodeMirror div.CodeMirror-secondarycursor {
|
|
461
|
-
border-left: 1px solid silver;
|
|
462
|
-
}
|
|
463
|
-
.cm-fat-cursor .CodeMirror-cursor {
|
|
464
|
-
width: auto;
|
|
465
|
-
border: 0 !important;
|
|
466
|
-
background: #7e7;
|
|
467
|
-
}
|
|
468
|
-
.cm-fat-cursor div.CodeMirror-cursors {
|
|
469
|
-
/* z-index: 1; */
|
|
470
|
-
}
|
|
471
|
-
|
|
472
|
-
.cm-fat-cursor-mark {
|
|
473
|
-
background-color: rgba(20, 255, 20, 0.5);
|
|
474
|
-
-webkit-animation: blink 1.06s steps(1) infinite;
|
|
475
|
-
-moz-animation: blink 1.06s steps(1) infinite;
|
|
476
|
-
animation: blink 1.06s steps(1) infinite;
|
|
477
|
-
}
|
|
478
|
-
.cm-animate-fat-cursor {
|
|
479
|
-
width: auto;
|
|
480
|
-
border: 0;
|
|
481
|
-
-webkit-animation: blink 1.06s steps(1) infinite;
|
|
482
|
-
-moz-animation: blink 1.06s steps(1) infinite;
|
|
483
|
-
animation: blink 1.06s steps(1) infinite;
|
|
484
|
-
background-color: #7e7;
|
|
485
|
-
}
|
|
486
|
-
|
|
487
|
-
/* Can style cursor different in overwrite (non-insert) mode */
|
|
488
|
-
.CodeMirror-overwrite .CodeMirror-cursor {
|
|
489
|
-
}
|
|
490
|
-
|
|
491
|
-
.cm-tab {
|
|
492
|
-
display: inline-block;
|
|
493
|
-
text-decoration: inherit;
|
|
494
|
-
}
|
|
495
|
-
|
|
496
|
-
.CodeMirror-rulers {
|
|
497
|
-
position: absolute;
|
|
498
|
-
left: 0;
|
|
499
|
-
right: 0;
|
|
500
|
-
top: -50px;
|
|
501
|
-
bottom: 0;
|
|
502
|
-
overflow: hidden;
|
|
503
|
-
}
|
|
504
|
-
.CodeMirror-ruler {
|
|
505
|
-
border-left: 1px solid #ccc;
|
|
506
|
-
top: 0;
|
|
507
|
-
bottom: 0;
|
|
508
|
-
position: absolute;
|
|
509
|
-
}
|
|
510
|
-
|
|
511
|
-
/* DEFAULT THEME */
|
|
512
|
-
|
|
513
|
-
.cm-header,
|
|
514
|
-
.cm-strong {
|
|
515
|
-
font-weight: bold;
|
|
516
|
-
}
|
|
517
|
-
.cm-em {
|
|
518
|
-
font-style: italic;
|
|
519
|
-
}
|
|
520
|
-
.cm-link {
|
|
521
|
-
text-decoration: underline;
|
|
522
|
-
}
|
|
523
|
-
.cm-strikethrough {
|
|
524
|
-
text-decoration: line-through;
|
|
525
|
-
}
|
|
526
|
-
|
|
527
|
-
.CodeMirror-composing {
|
|
528
|
-
border-bottom: 2px solid;
|
|
529
|
-
}
|
|
530
|
-
|
|
531
|
-
/* Default styles for common addons */
|
|
532
|
-
|
|
533
|
-
div.CodeMirror span.CodeMirror-matchingbracket {
|
|
534
|
-
color: #0b0;
|
|
535
|
-
}
|
|
536
|
-
div.CodeMirror span.CodeMirror-nonmatchingbracket {
|
|
537
|
-
color: #a22;
|
|
538
|
-
}
|
|
539
|
-
.CodeMirror-matchingtag {
|
|
540
|
-
background: rgba(255, 150, 0, 0.3);
|
|
541
|
-
}
|
|
542
|
-
.CodeMirror-activeline-background {
|
|
543
|
-
background: #e8f2ff;
|
|
544
|
-
}
|
|
545
|
-
|
|
546
|
-
/* STOP */
|
|
547
|
-
|
|
548
|
-
/* The rest of this file contains styles related to the mechanics of
|
|
549
|
-
the editor. You probably shouldn't touch them. */
|
|
550
|
-
|
|
551
|
-
.CodeMirror {
|
|
552
|
-
position: relative;
|
|
553
|
-
overflow: hidden;
|
|
554
|
-
background: ${({theme:t})=>`${t.colors.neutral0}`};
|
|
555
|
-
}
|
|
556
|
-
|
|
557
|
-
.CodeMirror-scroll {
|
|
558
|
-
overflow: scroll !important; /* Things will break if this is overridden */
|
|
559
|
-
/* 50px is the magic margin used to hide the element's real scrollbars */
|
|
560
|
-
/* See overflow: hidden in .CodeMirror */
|
|
561
|
-
margin-bottom: -50px;
|
|
562
|
-
margin-right: -50px;
|
|
563
|
-
padding-bottom: 50px;
|
|
564
|
-
height: 100%;
|
|
565
|
-
outline: none; /* Prevent dragging from highlighting the element */
|
|
566
|
-
position: relative;
|
|
567
|
-
}
|
|
568
|
-
.CodeMirror-sizer {
|
|
569
|
-
position: relative;
|
|
570
|
-
border-right: 50px solid transparent;
|
|
571
|
-
}
|
|
572
|
-
|
|
573
|
-
/* The fake, visible scrollbars. Used to force redraw during scrolling
|
|
574
|
-
before actual scrolling happens, thus preventing shaking and
|
|
575
|
-
flickering artifacts. */
|
|
576
|
-
.CodeMirror-vscrollbar,
|
|
577
|
-
.CodeMirror-hscrollbar,
|
|
578
|
-
.CodeMirror-scrollbar-filler,
|
|
579
|
-
.CodeMirror-gutter-filler {
|
|
580
|
-
position: absolute;
|
|
581
|
-
z-index: 1;
|
|
582
|
-
display: none;
|
|
583
|
-
outline: none;
|
|
584
|
-
}
|
|
585
|
-
|
|
586
|
-
.CodeMirror-vscrollbar {
|
|
587
|
-
right: 0;
|
|
588
|
-
top: 0;
|
|
589
|
-
overflow-x: hidden;
|
|
590
|
-
overflow-y: scroll;
|
|
591
|
-
}
|
|
592
|
-
.CodeMirror-hscrollbar {
|
|
593
|
-
bottom: 0;
|
|
594
|
-
left: 0;
|
|
595
|
-
overflow-y: hidden;
|
|
596
|
-
overflow-x: scroll;
|
|
597
|
-
}
|
|
598
|
-
.CodeMirror-scrollbar-filler {
|
|
599
|
-
right: 0;
|
|
600
|
-
bottom: 0;
|
|
601
|
-
}
|
|
602
|
-
|
|
603
|
-
.CodeMirror-lines {
|
|
604
|
-
cursor: text;
|
|
605
|
-
min-height: 1px; /* prevents collapsing before first draw */
|
|
606
|
-
}
|
|
607
|
-
/* Reset some styles that the rest of the page might have set */
|
|
608
|
-
.CodeMirror pre.CodeMirror-line,
|
|
609
|
-
.CodeMirror pre.CodeMirror-line-like {
|
|
610
|
-
-moz-border-radius: 0;
|
|
611
|
-
-webkit-border-radius: 0;
|
|
612
|
-
border-radius: 0;
|
|
613
|
-
border-width: 0;
|
|
614
|
-
background: transparent;
|
|
615
|
-
font-family: inherit;
|
|
616
|
-
font-size: inherit;
|
|
617
|
-
margin: 0;
|
|
618
|
-
white-space: pre;
|
|
619
|
-
word-wrap: normal;
|
|
620
|
-
line-height: 1.5;
|
|
621
|
-
color: inherit;
|
|
622
|
-
/* z-index: 2; */
|
|
623
|
-
position: relative;
|
|
624
|
-
overflow: visible;
|
|
625
|
-
-webkit-tap-highlight-color: transparent;
|
|
626
|
-
-webkit-font-variant-ligatures: contextual;
|
|
627
|
-
font-variant-ligatures: contextual;
|
|
628
|
-
}
|
|
629
|
-
|
|
630
|
-
.CodeMirror pre.CodeMirror-line-like {
|
|
631
|
-
z-index: 2;
|
|
632
|
-
}
|
|
633
|
-
|
|
634
|
-
.CodeMirror-wrap pre.CodeMirror-line,
|
|
635
|
-
.CodeMirror-wrap pre.CodeMirror-line-like {
|
|
636
|
-
word-wrap: break-word;
|
|
637
|
-
white-space: pre-wrap;
|
|
638
|
-
word-break: normal;
|
|
639
|
-
}
|
|
640
|
-
|
|
641
|
-
.CodeMirror-linebackground {
|
|
642
|
-
position: absolute;
|
|
643
|
-
left: 0;
|
|
644
|
-
right: 0;
|
|
645
|
-
top: 0;
|
|
646
|
-
bottom: 0;
|
|
647
|
-
z-index: 0;
|
|
648
|
-
}
|
|
649
|
-
|
|
650
|
-
.CodeMirror-linewidget {
|
|
651
|
-
position: relative;
|
|
652
|
-
/* z-index: 2; */
|
|
653
|
-
padding: 0.1px; /* Force widget margins to stay inside of the container */
|
|
654
|
-
}
|
|
655
|
-
|
|
656
|
-
.CodeMirror-widget {
|
|
657
|
-
}
|
|
658
|
-
|
|
659
|
-
.CodeMirror-rtl pre {
|
|
660
|
-
direction: rtl;
|
|
661
|
-
}
|
|
662
|
-
|
|
663
|
-
.CodeMirror-code {
|
|
664
|
-
outline: none;
|
|
665
|
-
}
|
|
666
|
-
|
|
667
|
-
/* Force content-box sizing for the elements where we expect it */
|
|
668
|
-
.CodeMirror-scroll,
|
|
669
|
-
.CodeMirror-sizer,
|
|
670
|
-
.CodeMirror-gutter,
|
|
671
|
-
.CodeMirror-gutters,
|
|
672
|
-
.CodeMirror-linenumber {
|
|
673
|
-
-moz-box-sizing: content-box;
|
|
674
|
-
box-sizing: content-box;
|
|
675
|
-
}
|
|
676
|
-
|
|
677
|
-
.CodeMirror-measure {
|
|
678
|
-
position: absolute;
|
|
679
|
-
width: 100%;
|
|
680
|
-
height: 0;
|
|
681
|
-
overflow: hidden;
|
|
682
|
-
visibility: hidden;
|
|
683
|
-
}
|
|
684
|
-
|
|
685
|
-
.CodeMirror-cursor {
|
|
686
|
-
position: absolute;
|
|
687
|
-
pointer-events: none;
|
|
688
|
-
border-color: ${({theme:t})=>`${t.colors.neutral800}`};
|
|
689
|
-
}
|
|
690
|
-
.CodeMirror-measure pre {
|
|
691
|
-
position: static;
|
|
692
|
-
}
|
|
693
|
-
|
|
694
|
-
div.CodeMirror-cursors {
|
|
695
|
-
visibility: hidden;
|
|
696
|
-
position: relative;
|
|
697
|
-
+ div {
|
|
698
|
-
z-index: 0 !important;
|
|
699
|
-
}
|
|
700
|
-
}
|
|
701
|
-
|
|
702
|
-
div.CodeMirror-dragcursors {
|
|
703
|
-
visibility: visible;
|
|
704
|
-
}
|
|
705
|
-
|
|
706
|
-
.CodeMirror-focused div.CodeMirror-cursors {
|
|
707
|
-
visibility: visible;
|
|
708
|
-
}
|
|
709
|
-
|
|
710
|
-
.CodeMirror-selected {
|
|
711
|
-
background: ${({theme:t})=>t.colors.neutral200};
|
|
712
|
-
/* z-index: -10; */
|
|
713
|
-
}
|
|
714
|
-
.CodeMirror-crosshair {
|
|
715
|
-
cursor: crosshair;
|
|
716
|
-
}
|
|
717
|
-
|
|
718
|
-
/* Used to force a border model for a node */
|
|
719
|
-
.cm-force-border {
|
|
720
|
-
padding-right: 0.1px;
|
|
721
|
-
}
|
|
722
|
-
|
|
723
|
-
/* See issue #2901 */
|
|
724
|
-
.cm-tab-wrap-hack:after {
|
|
725
|
-
content: '';
|
|
726
|
-
}
|
|
727
|
-
|
|
728
|
-
/* Help users use markselection to safely style text background */
|
|
729
|
-
span.CodeMirror-selectedtext {
|
|
730
|
-
background: none;
|
|
731
|
-
}
|
|
732
|
-
|
|
733
|
-
span {
|
|
734
|
-
color: ${({theme:t})=>t.colors.neutral800} !important;
|
|
735
|
-
}
|
|
736
|
-
`;var _t=/^(\s*)(>[> ]*|[*+-] \[[x ]\]\s|[*+-]\s|(\d+)([.)]))(\s*)/,Jc=/^(\s*)(>[> ]*|[*+-] \[[x ]\]|[*+-]|(\d+)[.)])(\s*)$/,_c=/[*+-]\s/;function ed(t){if(t.getOption("disableInput"))return eo().Pass;for(var o=t.listSelections(),r=[],a=0;a<o.length;a++){var s=o[a].head,c=t.getStateAfter(s.line),l=c.list!==!1,d=c.quote!==0,m=t.getLine(s.line),u=_t.exec(m),g=/^\s*$/.test(m.slice(0,s.ch));if(!o[a].empty()||!l&&!d||!u||g){t.execCommand("newlineAndIndent");return}if(Jc.test(m)){var h=d&&/>\s*$/.test(m),p=!/>\s*$/.test(m);(h||p)&&t.replaceRange("",{line:s.line,ch:0},{line:s.line,ch:s.ch+1}),r[a]=`
|
|
737
|
-
`}else{var E=u[1],b=u[5],C=!(_c.test(u[2])||u[2].indexOf(">")>=0),T=C?parseInt(u[3],10)+1+u[4]:u[2].replace("x"," ");r[a]=`
|
|
738
|
-
`+E+T+b,C&&td(t,s)}}t.replaceSelections(r)}function td(t,o){var r=o.line,a=0,s=0,c=_t.exec(t.getLine(r)),l=c[1];do{a+=1;var d=r+a,m=t.getLine(d),u=_t.exec(m);if(u){var g=u[1],h=parseInt(c[3],10)+a-s,p=parseInt(u[3],10),E=p;if(l===g&&!isNaN(p))h===p&&(E=p+1),h>p&&(E=h+1),t.replaceRange(m.replace(_t,g+E+u[4]+u[5]),{line:d,ch:0},{line:d,ch:m.length});else{if(l.length>g.length||l.length<g.length&&a===1)return;s+=1}}}while(u)}var nd=ed;const xe=(0,U.ZP)(Re.h)`
|
|
739
|
-
padding: ${({theme:t})=>t.spaces[2]};
|
|
740
|
-
/* Trick to prevent the outline from overflowing because of the general outline-offset */
|
|
741
|
-
outline-offset: -2px !important;
|
|
742
|
-
|
|
743
|
-
svg {
|
|
744
|
-
width: ${18/16}rem;
|
|
745
|
-
height: ${18/16}rem;
|
|
746
|
-
}
|
|
747
|
-
`,od=(0,U.ZP)(xe)`
|
|
748
|
-
svg {
|
|
749
|
-
width: ${8/16}rem;
|
|
750
|
-
height: ${8/16}rem;
|
|
751
|
-
}
|
|
752
|
-
`,$r=(0,U.ZP)(Re.o)`
|
|
753
|
-
margin-left: ${({theme:t})=>t.spaces[4]};
|
|
754
|
-
`,Br=(0,U.ZP)(Re.h)`
|
|
755
|
-
margin: ${({theme:t})=>`0 ${t.spaces[2]}`};
|
|
756
|
-
padding: ${({theme:t})=>t.spaces[2]};
|
|
757
|
-
|
|
758
|
-
svg {
|
|
759
|
-
width: ${18/16}rem;
|
|
760
|
-
height: ${18/16}rem;
|
|
761
|
-
}
|
|
762
|
-
`,rd=(0,U.ZP)(Re.o)`
|
|
763
|
-
margin-right: ${({theme:t})=>`${t.spaces[2]}`};
|
|
764
|
-
`,ad=U.ZP.div`
|
|
765
|
-
position: relative;
|
|
766
|
-
height: calc(100% - 48px);
|
|
767
|
-
`,sd=(0,U.ZP)(Fn.Y)`
|
|
768
|
-
background-color: transparent;
|
|
769
|
-
border: none;
|
|
770
|
-
align-items: center;
|
|
771
|
-
|
|
772
|
-
svg {
|
|
773
|
-
margin-left: ${({theme:t})=>`${t.spaces[2]}`};
|
|
774
|
-
path {
|
|
775
|
-
fill: ${({theme:t})=>t.colors.neutral700};
|
|
776
|
-
width: ${12/16}rem;
|
|
777
|
-
height: ${12/16}rem;
|
|
778
|
-
}
|
|
779
|
-
}
|
|
780
|
-
`;var dg=i(27217);const oo=({disabled:t,editorRef:o,error:r,isPreviewMode:a,isExpandMode:s,name:c,onChange:l,placeholder:d,textareaRef:m,value:u})=>{const g=(0,e.useRef)(l);return(0,e.useEffect)(()=>{o.current=eo().fromTextArea(m.current,{lineWrapping:!0,extraKeys:{Enter:"newlineAndIndentContinueMarkdownList",Tab:!1,"Shift-Tab":!1},readOnly:!1,smartIndent:!1,placeholder:d,spellcheck:!0,inputStyle:"contenteditable"}),eo().commands.newlineAndIndentContinueMarkdownList=nd,o.current.on("change",h=>{g.current({target:{name:c,value:h.getValue(),type:"wysiwyg"}})})},[o,m,c,d]),(0,e.useEffect)(()=>{u&&!o.current.hasFocus()&&o.current.setValue(u)},[o,u]),(0,e.useEffect)(()=>{a||t?o.current.setOption("readOnly","nocursor"):o.current.setOption("readOnly",!1)},[t,a,o]),(0,e.useEffect)(()=>{r?o.current.setOption("screenReaderLabel",r):o.current.setOption("screenReaderLabel","Editor")},[o,r]),e.createElement(ad,null,e.createElement(Xc,{isExpandMode:s,disabled:t||a},e.createElement("textarea",{ref:m})),a&&e.createElement(wr,{data:u}))};oo.defaultProps={disabled:!1,error:void 0,isPreviewMode:!1,isExpandMode:!1,placeholder:"",value:""},oo.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 id=oo,ld=i(71933),cd=i(67563);const dd=(t,o)=>`${t}${Math.floor(o*255).toString(16).padStart(2,0)}`,ud=(0,U.ZP)(Z.k)`
|
|
781
|
-
background: ${({theme:t})=>dd(t.colors.neutral800,.2)};
|
|
782
|
-
`,md=(0,U.ZP)(W.x)`
|
|
783
|
-
border-right: 1px solid ${({theme:t})=>t.colors.neutral200};
|
|
784
|
-
`,pd=(0,U.ZP)(Fn.Y)`
|
|
785
|
-
background-color: transparent;
|
|
786
|
-
border: none;
|
|
787
|
-
align-items: center;
|
|
788
|
-
|
|
789
|
-
svg {
|
|
790
|
-
margin-left: ${({theme:t})=>`${t.spaces[2]}`};
|
|
791
|
-
|
|
792
|
-
path {
|
|
793
|
-
fill: ${({theme:t})=>t.colors.neutral700};
|
|
794
|
-
width: ${12/16}rem;
|
|
795
|
-
height: ${12/16}rem;
|
|
796
|
-
}
|
|
797
|
-
}
|
|
798
|
-
`,ro=({children:t,isExpandMode:o,error:r,previewContent:a,onCollapse:s})=>{const{formatMessage:c}=(0,Q.Z)();return(0,y.F5)(o),o?e.createElement(ld.h,{role:"dialog","aria-modal":!1},e.createElement(cd.i,{onEscape:s},e.createElement(ud,{position:"fixed",top:0,left:0,right:0,bottom:0,zIndex:4,justifyContent:"center",onClick:s},e.createElement(W.x,{background:"neutral0",hasRadius:!0,shadow:"popupShadow",overflow:"hidden",width:"70%",height:"70%",onClick:l=>l.stopPropagation()},e.createElement(Z.k,{height:"100%",alignItems:"flex-start"},e.createElement(md,{flex:"1",height:"100%"},t),e.createElement(Z.k,{alignItems:"start",direction:"column",flex:1,height:"100%",width:"100%"},e.createElement(Z.k,{height:(0,y.Q1)(48),background:"neutral100",justifyContent:"flex-end",shrink:0,width:"100%"},e.createElement(pd,{onClick:s},e.createElement(G.Z,null,c({id:"components.Wysiwyg.collapse",defaultMessage:"Collapse"})),e.createElement(Vo.Z,null))),e.createElement(W.x,{position:"relative",height:"100%",width:"100%"},e.createElement(wr,{data:a})))))))):e.createElement(W.x,{borderColor:r?"danger600":"neutral200",borderStyle:"solid",borderWidth:"1px",hasRadius:!0},t)};ro.defaultProps={error:void 0,previewContent:""},ro.propTypes={children:n().node.isRequired,error:n().string,isExpandMode:n().bool.isRequired,previewContent:n().string,onCollapse:n().func.isRequired};const Nr=(t,o)=>{let r;switch(t){case"Strikethrough":r=`~~${o}~~`;break;case"Bold":r=`**${o}**`;break;case"Italic":r=`_${o}_`;break;case"Underline":r=`<u>${o}</u>`;break;case"Code":r=`\`\`\`
|
|
799
|
-
${o}
|
|
800
|
-
\`\`\``;break;case"Link":r=`[${o}](link)`;break;case"Quote":r=`>${o}`;break;default:r=o}return r},jr=t=>{let o,r={start:t.length,end:0};switch(t){case"Strikethrough":o=`~~${t}~~`,r.end=2;break;case"Bold":o=`**${t}**`,r.end=2;break;case"Italic":o=`_${t}_`,r.end=1;break;case"alt":o=`[${t}]()`,r.end=3;break;case"Underline":o=`<u>${t}</u>`,r.end=4;break;case"Code":o=`\`\`\`
|
|
801
|
-
${t}
|
|
802
|
-
\`\`\``,r.end=3;break;case"Link":o=`[${t}](link)`,r.end=7;break;case"Quote":o=`>${t}`,r.end=0;break;default:o=""}return{editedText:o,selection:r}},Wr=t=>{let o;switch(t){case"BulletList":o="- ";break;case"NumberList":o="1. ";break;case"h1":o="# ";break;case"h2":o="## ";break;case"h3":o="### ";break;case"h4":o="#### ";break;case"h5":o="##### ";break;case"h6":o="###### ";break;default:return""}return o},zr=(t,o)=>{const r=t.current.getSelection();let a;if(r){const s=Nr(o,r);t.current.replaceSelection(s),t.current.focus()}else{a=jr(o),t.current.replaceSelection(a.editedText),t.current.focus();const{line:s,ch:c}=t.current.getCursor(),l=c-a.selection.end,d=c-a.selection.end-a.selection.start;t.current.setSelection({line:s,ch:d},{line:s,ch:l})}},gd=(t,o)=>{const r=t.current.getDoc(),a=o==="BulletList"?"- ":"1. ";if(r.somethingSelected()){const s=r.listSelections();let c=null;t.current.operation(function(){s.forEach(function(l){const d=[l.head.line,l.anchor.line].sort();c==null&&(c=r.getLine(d[0]).startsWith(a));for(let m=d[0];m<=d[1];m++)if(c)r.getLine(m).startsWith(a)&&r.replaceRange("",{line:m,ch:0},{line:m,ch:a.length});else{const u=o==="BulletList"?"- ":`${m+1}. `;r.replaceRange(u,{line:m,ch:0})}})})}else{let{line:s}=r.getCursor();const c=Wr(o),l=t.current.getLine(s),d=c+l;t.current.setSelection({line:s,ch:0},{line:s,ch:l.length}),t.current.replaceSelection(d)}t.current.focus()},fd=(t,o)=>{let{line:r}=t.current.getCursor();const a=Wr(o),s=t.current.getLine(r),c=s.replace(/#{1,6}\s/g,"").trim(),l=a+c;t.current.setSelection({line:r,ch:0},{line:r,ch:s.length}),t.current.replaceSelection(l),setTimeout(()=>{const d=t.current.getLine(r).length;t.current.focus(),t.current.setCursor({line:r,ch:d})},0)},hd=(t,o)=>{let{line:r,ch:a}=t.current.getCursor();o.forEach((s,c)=>{let l=t.current.getLine(r).length;t.current.setCursor({line:r,ch:l}),(c>0||c===0&&a!==0)&&(l=t.current.getLine(r).length,t.current.setCursor({line:r,ch:l}),r++,t.current.replaceSelection(`
|
|
803
|
-
`)),s.mime.includes("image")?t.current.replaceSelection(``):t.current.replaceSelection(`[${s.alt}](${s.url})`)}),setTimeout(()=>t.current.focus(),0)},yd=(t,o,r,a,s)=>{const c=Nr(o,s),l=t.current.getRange({line:r+1,ch:0},{line:1/0,ch:1/0});if(t.current.replaceRange("",{line:r+1,ch:0},{line:1/0,ch:1/0}),t.current.replaceSelection(""),t.current.setCursor({line:r,ch:a}),t.current.replaceSelection(`
|
|
804
|
-
`),t.current.replaceSelection(c),o==="Code"){let{line:d}=t.current.getCursor();t.current.setCursor({line:d-1,ch:s.length})}t.current.replaceRange(l,{line:r+4,ch:0},{line:1/0,ch:1/0}),t.current.focus()},Ed=(t,o,r,a)=>{const s=jr(o),c=t.current.getRange({line:r+1,ch:0},{line:1/0,ch:1/0});if(t.current.replaceRange("",{line:r+1,ch:0},{line:1/0,ch:1/0}),t.current.setCursor({line:r,ch:a}),t.current.replaceSelection(`
|
|
805
|
-
`),t.current.replaceSelection(s.editedText),o==="Code")r+=2,t.current.setSelection({line:r,ch:0},{line:r,ch:4});else{r+=1;let{ch:l}=t.current.getCursor(),d=l-s.selection.end,m=l-s.selection.end-s.selection.start;t.current.setSelection({line:r,ch:m},{line:r,ch:d})}t.current.replaceRange(c,{line:r+2,ch:0},{line:1/0,ch:1/0}),t.current.focus()},bd=(t,o)=>{const r=t.current.getSelection();let{line:a}=t.current.getCursor(),s=t.current.getLine(a).length;r?yd(t,o,a,s,r):Ed(t,o,a,s)},ao=({onToggleExpand:t})=>{const{formatMessage:o}=(0,Q.Z)();return e.createElement(W.x,{padding:2,background:"neutral100",hasRadius:!0},e.createElement(Z.k,{justifyContent:"flex-end",alignItems:"flex-end"},e.createElement(sd,{id:"expand",onClick:t},e.createElement(G.Z,null,o({id:"components.WysiwygBottomControls.fullscreen",defaultMessage:"Expand"})),e.createElement(Ho.Z,null))))};ao.defaultProps={onToggleExpand(){}},ao.propTypes={onToggleExpand:n().func};var vd=ao,Cd=i(5383),Rd=i(20063);const so=({disabled:t,editorRef:o,isExpandMode:r,isPreviewMode:a,onActionClick:s,onToggleMediaLib:c,onTogglePreviewMode:l})=>{const[d,m]=(0,e.useState)(!1),{formatMessage:u}=(0,Q.Z)(),g=u({id:"components.Wysiwyg.selectOptions.title",defaultMessage:"Add a title"}),h=(0,e.useRef)(),p=()=>{m(E=>!E)};return t||a?e.createElement(Z.k,{padding:2,background:"neutral100",justifyContent:"space-between"},e.createElement(Ur,null,e.createElement(Ze.P,{disabled:!0,placeholder:g,size:"S",label:g},e.createElement(be.W,{value:"h1"},"h1"),e.createElement(be.W,{value:"h2"},"h2"),e.createElement(be.W,{value:"h3"},"h3"),e.createElement(be.W,{value:"h4"},"h4"),e.createElement(be.W,{value:"h5"},"h5"),e.createElement(be.W,{value:"h6"},"h6")),e.createElement($r,null,e.createElement(xe,{disabled:!0,id:"Bold",label:"Bold",name:"Bold",icon:e.createElement(un.Z,null)}),e.createElement(xe,{disabled:!0,id:"Italic",label:"Italic",name:"Italic",icon:e.createElement(mn.Z,null)}),e.createElement(xe,{disabled:!0,id:"Underline",label:"Underline",name:"Underline",icon:e.createElement(gn.Z,null)})),e.createElement(Br,{disabled:!0,id:"more",label:"More",icon:e.createElement(jn.Z,null)})),!r&&e.createElement(le.z,{onClick:l,variant:"tertiary",id:"preview"},u({id:"components.Wysiwyg.ToggleMode.markdown-mode",defaultMessage:"Markdown mode"}))):e.createElement(Z.k,{padding:2,background:"neutral100",justifyContent:"space-between"},e.createElement(Ur,null,e.createElement(Ze.P,{placeholder:g,label:g,size:"S",onChange:E=>s(E,o)},e.createElement(be.W,{value:"h1"},"h1"),e.createElement(be.W,{value:"h2"},"h2"),e.createElement(be.W,{value:"h3"},"h3"),e.createElement(be.W,{value:"h4"},"h4"),e.createElement(be.W,{value:"h5"},"h5"),e.createElement(be.W,{value:"h6"},"h6")),e.createElement($r,null,e.createElement(xe,{onClick:()=>s("Bold",o),id:"Bold",label:"Bold",name:"Bold",icon:e.createElement(un.Z,null)}),e.createElement(xe,{onClick:()=>s("Italic",o),id:"Italic",label:"Italic",name:"Italic",icon:e.createElement(mn.Z,null)}),e.createElement(xe,{onClick:()=>s("Underline",o),id:"Underline",label:"Underline",name:"Underline",icon:e.createElement(gn.Z,null)})),e.createElement(Br,{ref:h,onClick:p,id:"more",label:"More",icon:e.createElement(jn.Z,null)}),d&&e.createElement(Cd.J2,{onDismiss:p,centered:!0,source:h,spacing:4,id:"popover"},e.createElement(Z.k,null,e.createElement(rd,null,e.createElement(xe,{onClick:()=>s("Strikethrough",o,p),id:"Strikethrough",label:"Strikethrough",name:"Strikethrough",icon:e.createElement(Jo.Z,null)}),e.createElement(xe,{onClick:()=>s("BulletList",o,p),id:"BulletList",label:"BulletList",name:"BulletList",icon:e.createElement(Uo.Z,null)}),e.createElement(xe,{onClick:()=>s("NumberList",o,p),id:"NumberList",label:"NumberList",name:"NumberList",icon:e.createElement(Rd.Z,null)})),e.createElement(Re.o,null,e.createElement(xe,{onClick:()=>s("Code",o,p),id:"Code",label:"Code",name:"Code",icon:e.createElement(qo.Z,null)}),e.createElement(xe,{onClick:()=>{p(),c()},id:"Image",label:"Image",name:"Image",icon:e.createElement(Yo.Z,null)}),e.createElement(od,{onClick:()=>s("Link",o,p),id:"Link",label:"Link",name:"Link",icon:e.createElement(Ko.Z,null)}),e.createElement(xe,{onClick:()=>s("Quote",o,p),id:"Quote",label:"Quote",name:"Quote",icon:e.createElement(Xo.Z,null)}))))),l&&e.createElement(le.z,{onClick:l,variant:"tertiary",id:"preview"},u({id:"components.Wysiwyg.ToggleMode.preview-mode",defaultMessage:"Preview mode"})))};so.defaultProps={isPreviewMode:!1,onActionClick(){},onToggleMediaLib(){},onTogglePreviewMode:void 0},so.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 Md=so;const Ur=(0,U.ZP)(Z.k)`
|
|
806
|
-
/* Hide the label, every input needs a label. */
|
|
807
|
-
label {
|
|
808
|
-
border: 0;
|
|
809
|
-
clip: rect(0 0 0 0);
|
|
810
|
-
height: 1px;
|
|
811
|
-
margin: -1px;
|
|
812
|
-
overflow: hidden;
|
|
813
|
-
padding: 0;
|
|
814
|
-
position: absolute;
|
|
815
|
-
width: 1px;
|
|
816
|
-
}
|
|
817
|
-
`,Td=(0,U.ZP)(W.x)`
|
|
818
|
-
svg path {
|
|
819
|
-
fill: ${({theme:t})=>t.colors.neutral500};
|
|
820
|
-
}
|
|
821
|
-
`,Dd=(0,U.ZP)(G.Z)`
|
|
822
|
-
line-height: 0;
|
|
823
|
-
`,io=({hint:t,disabled:o,error:r,intlLabel:a,labelAction:s,name:c,onChange:l,placeholder:d,value:m,required:u})=>{const{formatMessage:g}=(0,Q.Z)(),h=(0,e.useRef)(null),p=(0,e.useRef)(null),[E,b]=(0,e.useState)(!1),[C,T]=(0,e.useState)(!1),[D,M]=(0,e.useState)(!1),{components:I}=(0,y.yX)(),R=I["media-library"],v=()=>T(L=>!L),x=()=>b(L=>!L),B=()=>{b(!1),M(L=>!L)},A=(L,X,K)=>{switch(L){case"Link":case"Strikethrough":{zr(X,L),K();break}case"Code":case"Quote":{bd(X,L),K();break}case"Bold":case"Italic":case"Underline":{zr(X,L);break}case"BulletList":case"NumberList":{gd(X,L),K();break}case"h1":case"h2":case"h3":case"h4":case"h5":case"h6":{fd(X,L);break}default:}},P=L=>{const X=L.map(K=>({alt:K.alternativeText||K.name,url:(0,y.CR)(K.url),mime:K.mime}));hd(p,X),T(!1)},$=d?g({id:d.id,defaultMessage:d.defaultMessage},{...d.values}):"",q=a.id?g({id:a.id,defaultMessage:a.defaultMessage},{...a.values}):c;return e.createElement(e.Fragment,null,e.createElement(Z.k,{direction:"column",alignItems:"stretch",gap:1},e.createElement(Z.k,{gap:1},e.createElement(G.Z,{variant:"pi",fontWeight:"bold",textColor:"neutral800"},q,u&&e.createElement(Dd,{textColor:"danger600"},"*")),s&&e.createElement(Td,{paddingLeft:1},s)),e.createElement(ro,{isExpandMode:D,error:r,previewContent:m,onCollapse:B},e.createElement(Md,{isExpandMode:D,editorRef:p,isPreviewMode:E,onActionClick:A,onToggleMediaLib:v,onTogglePreviewMode:D?void 0:x,disabled:o}),e.createElement(id,{disabled:o,isExpandMode:D,editorRef:p,error:r,isPreviewMode:E,name:c,onChange:l,placeholder:$,textareaRef:h,value:m}),!D&&e.createElement(vd,{onToggleExpand:B})),e.createElement(Dc,{hint:t,name:c,error:r})),r&&e.createElement(W.x,{paddingTop:1},e.createElement(G.Z,{variant:"pi",textColor:"danger600","data-strapi-field-error":!0},r)),C&&e.createElement(R,{onClose:v,onSelectAssets:P}))};io.defaultProps={disabled:!1,error:"",labelAction:void 0,placeholder:null,required:!1,value:"",hint:""},io.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 Id=io;function Od(t,o){return r=>{const a=o(r.keys);return e.createElement(t,{...r,...a})}}var Pd=Od,Zd=(t,o=!1)=>[{metadatas:{intlLabel:{id:"components.InputSelect.option.placeholder",defaultMessage:"Choose here"},disabled:o,hidden:o},key:"__enum_option_null",value:""},...t.map(r=>({metadatas:{intlLabel:{id:r,defaultMessage:r},hidden:!1,disabled:!1},key:r,value:r}))],xd=i(59578),kd=i.n(xd),Fd=(t="")=>{switch(kd()(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"}};function Sd(t){const{createActionAllowedFields:o,formErrors:r,isCreatingEntry:a,modifiedData:s,onChange:c,readActionAllowedFields:l,shouldNotRunValidations:d,updateActionAllowedFields:m}=(0,y.Wq)(),u=(0,e.useMemo)(()=>a?o:m,[a,o,m]),g=(0,e.useMemo)(()=>a?[]:l,[a,l]),h=k()(s,t,null);return{allowedFields:u,formErrors:r,isCreatingEntry:a,onChange:c,readableFields:g,shouldNotRunValidations:d,value:h}}var Ad=Sd,qr=["type","model","via","collection","default","plugin","enum","regex","pluginOptions"];function lo({allowedFields:t,componentUid:o,fieldSchema:r,formErrors:a,isCreatingEntry:s,keys:c,labelAction:l,metadatas:d,onChange:m,readableFields:u,shouldNotRunValidations:g,queryInfos:h,value:p,size:E,customFieldInputs:b}){const{fields:C}=(0,y.yX)(),{formatMessage:T}=(0,Q.Z)(),{contentType:D}=(0,ae.PL)(),M=(0,e.useMemo)(()=>!k()(d,"editable",!0),[d]),{type:I,customField:R}=r,v=k()(a,[c],null),x=(0,e.useMemo)(()=>(0,f.Ts)(c),[c]),B=(0,e.useMemo)(()=>{const _=ql()(r,g?[...qr,"required","minLength"]:qr),ne=r.regex||null;if(ne){const me=new RegExp(ne);me&&(_.regex=me)}return _},[r,g]),A=(0,e.useMemo)(()=>k()(B,["required"],!1),[B]),P=(0,e.useMemo)(()=>{const _=k()(D,["attributes"],{});return k()(_,[x[0],"type"],null)==="dynamiczone"},[D,x]),$=(0,e.useMemo)(()=>Fd(I),[I]),q=(0,e.useMemo)(()=>I==="media"&&!p?[]:p,[I,p]),L=Ld(I),X=(0,e.useMemo)(()=>{const _=x.join(".");if(t.includes(_))return!0;if(P)return t.includes(x[0]);if(x.length>1){const me=$t()(x,x.length-1).join(".");return t.includes(me)}return!1},[t,x,P]),K=(0,e.useMemo)(()=>{const _=x.join(".");if(u.includes(_))return!0;if(P)return u.includes(x[0]);if(x.length>1){const me=$t()(x,x.length-1).join(".");return u.includes(me)}return!1},[u,x,P]),J=(0,e.useMemo)(()=>K||X,[X,K]),F=(0,e.useMemo)(()=>s?M:K&&!X?!0:M,[M,s,X,K]),w=(0,e.useMemo)(()=>Zd(r.enum||[],A),[r,A]),{label:O,description:S,placeholder:z,visible:Y}=d,N=(0,e.useMemo)(()=>{if(!d.step||$!=="datetime"&&$!=="time")return L;if(!q)return d.step;let _;return $==="datetime"?_=parseInt(q.substr(14,2),10):$==="time"&&(_=parseInt(q.slice(-2),10)),_%d.step===0?d.step:L},[$,q,d.step,L]);if(Y===!1)return null;if(!J)return e.createElement(y.X0,{description:S?{id:S,defaultMessage:S}:null,intlLabel:{id:O,defaultMessage:O},labelAction:l,error:v&&T(v),name:c,required:A});if(I==="relation")return e.createElement(Tc,{...d,...r,componentUid:o,description:d.description?T({id:d.description,defaultMessage:d.description}):void 0,intlLabel:{id:d.label,defaultMessage:d.label},labelAction:l,isUserAllowedToEditField:X,isUserAllowedToReadField:K,name:c,placeholder:d.placeholder?{id:d.placeholder,defaultMessage:d.placeholder}:null,queryInfos:h,size:E,value:p,error:v&&T(v)});const j={uid:_l,media:C.media,wysiwyg:Id,...C,...b};return e.createElement(y.jm,{attribute:r,autoComplete:"new-password",intlLabel:{id:O,defaultMessage:O},isNullable:$==="bool"&&[null,void 0].includes(r.default),description:S?{id:S,defaultMessage:S}:null,disabled:F,error:v,labelAction:l,contentTypeUID:D.uid,customInputs:j,multiple:r.multiple||!1,name:c,onChange:m,options:w,placeholder:z?{id:z,defaultMessage:z}:null,required:r.required||!1,step:N,type:R||$,value:q,withDefaultValue:!1})}lo.defaultProps={componentUid:void 0,formErrors:{},labelAction:void 0,size:void 0,value:null,queryInfos:{},customFieldInputs:{}},lo.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 Ld=t=>{switch(t){case"float":case"decimal":return .01;case"time":case"datetime":return 15;default:return 1}},wd=(0,e.memo)(lo,Le());var co=Pd(wd,Ad);const uo=({componentUid:t,isFromDynamicZone:o,isNested:r,name:a})=>{const{getComponentLayout:s}=(0,ae.PL)(),l=(0,e.useMemo)(()=>s(t),[t,s]).layouts.edit,{lazyComponentStore:d}=zn();return e.createElement(W.x,{background:o?"":"neutral100",paddingLeft:6,paddingRight:6,paddingTop:6,paddingBottom:6,hasRadius:r,borderColor:r?"neutral200":""},e.createElement(Z.k,{direction:"column",alignItems:"stretch",gap:6},l.map((m,u)=>e.createElement(De.r,{gap:4,key:u},m.map(({name:g,size:h,metadatas:p,fieldSchema:E,queryInfos:b})=>{const C=E.type==="component",T=`${a}.${g}`;if(C){const D=E.component;return e.createElement(ye.P,{col:h,s:12,xs:12,key:g},e.createElement(en,{componentUid:D,intlLabel:{id:p.label,defaultMessage:p.label},isNested:!0,isRepeatable:E.repeatable,max:E.max,min:E.min,name:T,required:E.required||!1}))}return e.createElement(ye.P,{col:h,key:g,s:12,xs:12},e.createElement(co,{componentUid:t,keys:T,fieldSchema:E,metadatas:p,queryInfos:b,size:h,customFieldInputs:d}))})))))};uo.defaultProps={isFromDynamicZone:!1,isNested:!1},uo.propTypes={componentUid:n().string.isRequired,isFromDynamicZone:n().bool,isNested:n().bool,name:n().string.isRequired};var $d=uo;const Bd=(0,U.ZP)(W.x)`
|
|
824
|
-
overflow: hidden;
|
|
825
|
-
border-bottom: 1px solid ${({theme:t})=>t.colors.neutral200};
|
|
826
|
-
border-right: 1px solid ${({theme:t})=>t.colors.neutral200};
|
|
827
|
-
border-left: 1px solid ${({theme:t})=>t.colors.neutral200};
|
|
828
|
-
border-radius: 0 0 ${({theme:t})=>t.borderRadius} ${({theme:t})=>t.borderRadius};
|
|
829
|
-
`,Nd=(0,U.ZP)(W.x)`
|
|
830
|
-
border-bottom: none;
|
|
831
|
-
|
|
832
|
-
/* add the borders and make sure the top is transparent to avoid jumping with the hover effect */
|
|
833
|
-
& > div > div {
|
|
834
|
-
border: 1px solid ${({theme:t})=>t.colors.neutral200};
|
|
835
|
-
border-top-color: transparent;
|
|
836
|
-
}
|
|
837
|
-
|
|
838
|
-
/* the top accordion _does_ need a border though */
|
|
839
|
-
& > div:first-child > div {
|
|
840
|
-
border-top: 1px solid ${({theme:t})=>t.colors.neutral200};
|
|
841
|
-
}
|
|
842
|
-
|
|
843
|
-
/* Reset all the border-radius' */
|
|
844
|
-
& > div > div,
|
|
845
|
-
& > div > div > div {
|
|
846
|
-
border-radius: unset;
|
|
847
|
-
}
|
|
848
|
-
|
|
849
|
-
/* Give the border radius back to the first accordion */
|
|
850
|
-
& > div:first-child > div,
|
|
851
|
-
& > div:first-child > div > div {
|
|
852
|
-
border-radius: ${({theme:t})=>t.borderRadius} ${({theme:t})=>t.borderRadius} 0 0;
|
|
853
|
-
}
|
|
854
|
-
|
|
855
|
-
& > div > div[data-strapi-expanded='true'] {
|
|
856
|
-
border: 1px solid ${({theme:t})=>t.colors.primary600};
|
|
857
|
-
}
|
|
858
|
-
`,mo=({children:t,error:o})=>{const{formatMessage:r}=(0,Q.Z)();return e.createElement(Cr.k,{attributeName:"data-strapi-accordion-toggle"},t,o&&e.createElement(W.x,{paddingTop:1},e.createElement(G.Z,{variant:"pi",textColor:"danger600"},r({id:o.id,defaultMessage:o.defaultMessage},{...o.values}))))};mo.defaultProps={error:void 0},mo.propTypes={children:n().node.isRequired,error:n().shape({id:n().string.isRequired,defaultMessage:n().string.isRequired,values:n().object})};var jd=i(41119),Vr=i.n(jd);const Wd=U.ZP.span`
|
|
859
|
-
display: block;
|
|
860
|
-
background-color: ${({theme:t})=>t.colors.primary100};
|
|
861
|
-
outline: 1px dashed ${({theme:t})=>t.colors.primary500};
|
|
862
|
-
outline-offset: -1px;
|
|
863
|
-
padding: ${({theme:t})=>t.spaces[6]};
|
|
864
|
-
`;var zd=()=>e.createElement(Wd,{padding:6,background:"primary100"});const Ud=(0,U.ZP)(Re.h)`
|
|
865
|
-
background-color: transparent;
|
|
866
|
-
|
|
867
|
-
svg {
|
|
868
|
-
path {
|
|
869
|
-
fill: ${({theme:t,expanded:o})=>o?t.colors.primary600:t.colors.neutral600};
|
|
870
|
-
}
|
|
871
|
-
}
|
|
872
|
-
|
|
873
|
-
&:hover {
|
|
874
|
-
svg {
|
|
875
|
-
path {
|
|
876
|
-
fill: ${({theme:t})=>t.colors.primary600};
|
|
877
|
-
}
|
|
878
|
-
}
|
|
879
|
-
}
|
|
880
|
-
`,qd=(0,U.ZP)(Z.k)`
|
|
881
|
-
& .drag-handle {
|
|
882
|
-
background: unset;
|
|
883
|
-
|
|
884
|
-
svg {
|
|
885
|
-
path {
|
|
886
|
-
fill: ${({theme:t,expanded:o})=>o?t.colors.primary600:void 0};
|
|
887
|
-
}
|
|
888
|
-
}
|
|
889
|
-
|
|
890
|
-
&:hover {
|
|
891
|
-
svg {
|
|
892
|
-
path {
|
|
893
|
-
/* keeps the hover style of the accordion */
|
|
894
|
-
fill: ${({theme:t})=>t.colors.primary600};
|
|
895
|
-
}
|
|
896
|
-
}
|
|
897
|
-
}
|
|
898
|
-
}
|
|
899
|
-
`,po=({componentFieldName:t,componentUid:o,fields:r,index:a,isOpen:s,isReadOnly:c,mainField:l,moveComponentField:d,onClickToggle:m,toggleCollapses:u,onGrabItem:g,onDropItem:h,onCancel:p})=>{const{modifiedData:E,removeRepeatableField:b,triggerFormValidation:C}=(0,y.Wq)(),T=Vr()(k()(E,[...t.split("."),l],"")),D=(0,e.useRef)(null),{formatMessage:M}=(0,Q.Z)(),I=t.split(".").slice(0,-1).join("."),[{handlerId:R,isDragging:v,handleKeyDown:x},B,A,P,$]=(0,Zr.Y)(!c,{type:`${f._Q.COMPONENT}_${I}`,index:a,item:{displayedValue:T},onMoveItem:d,onStart(){u()},onEnd(){C()},onGrabItem:g,onDropItem:h,onCancel:p});(0,e.useEffect)(()=>{$((0,kt.rX)(),{captureDraggingState:!1})},[$,a]);const q=(0,f.FE)(D,P),L=(0,f.FE)(B,A),{lazyComponentStore:X}=zn();return e.createElement(W.x,{ref:L},v?e.createElement(zd,null):e.createElement(Ln.U,{expanded:s,onToggle:m,id:t,size:"S"},e.createElement(wn.B,{action:c?null:e.createElement(qd,{gap:0,expanded:s},e.createElement(Ud,{expanded:s,noBorder:!0,onClick:()=>{b(t),u()},label:M({id:(0,f.OB)("containers.Edit.delete"),defaultMessage:"Delete"}),icon:e.createElement(He.Z,null)}),e.createElement(Re.h,{className:"drag-handle",ref:q,forwardedAs:"div",role:"button",noBorder:!0,tabIndex:0,onClick:K=>K.stopPropagation(),"data-handler-id":R,label:M({id:(0,f.OB)("components.DragHandle-label"),defaultMessage:"Drag"}),onKeyDown:x},e.createElement(st.Z,null))),title:T,togglePosition:"left"}),e.createElement($n.v,null,e.createElement(Z.k,{direction:"column",alignItems:"stretch",background:"neutral100",padding:6,gap:6},r.map((K,J)=>e.createElement(De.r,{gap:4,key:J},K.map(({name:F,fieldSchema:w,metadatas:O,queryInfos:S,size:z})=>{const Y=w.type==="component",N=`${t}.${F}`;if(Y){const j=w.component;return e.createElement(ye.P,{col:z,s:12,xs:12,key:F},e.createElement(en,{componentUid:j,intlLabel:{id:O.label,defaultMessage:O.label},isRepeatable:w.repeatable,isNested:!0,name:N,max:w.max,min:w.min,required:w.required}))}return e.createElement(ye.P,{key:N,col:z,s:12,xs:12},e.createElement(co,{componentUid:o,fieldSchema:w,keys:N,metadatas:O,queryInfos:S,size:z,customFieldInputs:X}))})))))))};po.defaultProps={componentUid:void 0,fields:[],isReadOnly:!1,isOpen:!1,onGrabItem:void 0,onDropItem:void 0,onCancel:void 0,toggleCollapses(){}},po.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 Vd=(0,e.memo)(po);function Hd(t,o={}){return Object.keys(o).filter(r=>r.startsWith(t)).map(r=>r.split(".").slice(0,t.split(".").length+1).join("."))}const Gd=(0,U.ZP)(Or.A)`
|
|
900
|
-
height: 100%;
|
|
901
|
-
width: 100%;
|
|
902
|
-
border-radius: 0 0 4px 4px;
|
|
903
|
-
display: flex;
|
|
904
|
-
justify-content: center;
|
|
905
|
-
span {
|
|
906
|
-
font-weight: 600;
|
|
907
|
-
font-size: 14px;
|
|
908
|
-
}
|
|
909
|
-
`,go=({componentUid:t,componentValue:o,componentValueLength:r,isReadOnly:a,max:s,min:c,name:l})=>{const{addRepeatableComponentToField:d,formErrors:m,moveComponentField:u}=(0,y.Wq)(),g=(0,y.lm)(),{formatMessage:h}=(0,Q.Z)(),[p,E]=(0,e.useState)(""),[b,C]=(0,e.useState)(""),{getComponentLayout:T,components:D}=(0,ae.PL)(),M=(0,e.useMemo)(()=>T(t),[t,T]),I=(0,e.useMemo)(()=>(0,f.Uo)(o||[])+1,[o]),R=Hd(l,m),v=c-r,x=k()(m,l,{id:""}).id.includes("min"),B=()=>{E("")},A=()=>{a||(r<s?(d(l,M,D,x),E(I)):r>=s&&g({type:"info",message:{id:(0,f.OB)("components.notification.info.maximum-requirement")}}))},P=(O,S)=>{C(h({id:(0,f.OB)("dnd.reorder"),defaultMessage:"{item}, moved. New position in list: {position}."},{item:`${l}.${S}`,position:L(O)})),u({name:l,newIndex:O,currentIndex:S})},$=k()(M,["settings","mainField"],"id"),q=O=>()=>{E(p===O?"":O)},L=O=>`${O+1} of ${r}`,X=O=>{C(h({id:(0,f.OB)("dnd.cancel-item"),defaultMessage:"{item}, dropped. Re-order cancelled."},{item:`${l}.${O}`}))},K=O=>{C(h({id:(0,f.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:`${l}.${O}`,position:L(O)}))},J=O=>{C(h({id:(0,f.OB)("dnd.drop-item"),defaultMessage:"{item}, dropped. Final position in list: {position}."},{item:`${l}.${O}`,position:L(O)}))};let F=m[l];if(x?F={id:(0,f.OB)("components.DynamicZone.missing-components"),defaultMessage:"There {number, plural, =0 {are # missing components} one {is # missing component} other {are # missing components}}",values:{number:v}}:R.some(O=>O.split(".").length>1)&&!x&&(F={id:(0,f.OB)("components.RepeatableComponent.error-message"),defaultMessage:"The component(s) contain error(s)"}),r===0)return e.createElement(Mr,{error:F,isReadOnly:a,onClick:A});const w=`${l}-item-instructions`;return e.createElement(W.x,{hasRadius:!0},e.createElement(ft.T,{id:w},h({id:(0,f.OB)("dnd.instructions"),defaultMessage:"Press spacebar to grab and re-order"})),e.createElement(ft.T,{"aria-live":"assertive"},b),e.createElement(mo,{error:F,ariaDescribedBy:w},e.createElement(Nd,{"aria-describedby":w},o.map(({__temp_key__:O},S)=>e.createElement(Vd,{componentFieldName:`${l}.${S}`,componentUid:t,fields:M.layouts.edit,key:O,index:S,isOpen:p===O,isReadOnly:a,mainField:$,moveComponentField:P,onClickToggle:q(O),toggleCollapses:B,onCancel:X,onDropItem:J,onGrabItem:K}))),e.createElement(Bd,null,e.createElement(Z.k,{justifyContent:"center",height:"48px",background:"neutral0"},e.createElement(Gd,{disabled:a,onClick:A,startIcon:e.createElement(Rt.Z,null)},h({id:(0,f.OB)("containers.EditView.add.new-entry"),defaultMessage:"Add an entry"}))))))};go.defaultProps={componentValue:null,componentValueLength:0,isReadOnly:!1,max:1/0,min:0},go.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 Qd=(0,e.memo)(go);const Kd=(0,U.ZP)(W.x)`
|
|
910
|
-
svg path {
|
|
911
|
-
fill: ${({theme:t})=>t.colors.neutral500};
|
|
912
|
-
}
|
|
913
|
-
`,fo=({intlLabel:t,id:o,labelAction:r,name:a,numberOfEntries:s,showNumberOfEntries:c,required:l})=>{const{formatMessage:d}=(0,Q.Z)(),m=t?.id?d(t):a;return e.createElement(W.x,{paddingBottom:1},e.createElement(Z.k,null,e.createElement(G.Z,{textColor:"neutral800",htmlFor:o||a,variant:"pi",fontWeight:"bold",as:"label"},m,c&&e.createElement(e.Fragment,null,"\xA0(",s,")"),l&&e.createElement(G.Z,{textColor:"danger600"},"*")),r&&e.createElement(Kd,{paddingLeft:1},r)))};fo.defaultProps={id:void 0,labelAction:void 0,numberOfEntries:0,required:!1,showNumberOfEntries:!1},fo.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 Yd=fo;function Xd(t,o){return r=>{const a=o(r);return e.createElement(t,{...r,...a})}}var Jd=Xd;function _d({isFromDynamicZone:t,name:o}){const{addNonRepeatableComponentToField:r,createActionAllowedFields:a,isCreatingEntry:s,modifiedData:c,removeComponentFromField:l,readActionAllowedFields:d,updateActionAllowedFields:m,formErrors:u}=(0,y.Wq)(),{contentType:g}=(0,ae.PL)(),h=(0,e.useMemo)(()=>{const M=k()(g,["attributes"],{});return Object.keys(M).filter(R=>k()(M,[R,"type"],"")==="dynamiczone")},[g]),p=(0,e.useMemo)(()=>s?a:m,[s,a,m]),E=k()(c,o,null),b=(0,e.useMemo)(()=>(0,f.Ts)(o),[o]),C=(0,e.useMemo)(()=>t&&s||p.filter(R=>R===b[0]).length>0?!0:p.map(R=>R.split(".")).filter(R=>R.length<b.length?!1:$t()(R,b.length).join(".")===b.join(".")).length>0,[t,s,p,b]),T=(0,e.useMemo)(()=>t||h.includes(b[0])?!0:(s?[]:d).map(R=>R.split(".")).filter(R=>R.length<b.length?!1:$t()(R,b.length).join(".")===b.join(".")).length>0,[t,h,b,s,d]),D=(0,e.useMemo)(()=>s||C?!1:T,[C,T,s]);return{addNonRepeatableComponentToField:r,formErrors:u,hasChildrenAllowedFields:C,hasChildrenReadableFields:T,isCreatingEntry:s,isReadOnly:D,removeComponentFromField:l,componentValue:E}}var eu=_d;const ho=({addNonRepeatableComponentToField:t,componentUid:o,intlLabel:r,isCreatingEntry:a,isFromDynamicZone:s,isRepeatable:c,isNested:l,labelAction:d,max:m,min:u,name:g,hasChildrenAllowedFields:h,hasChildrenReadableFields:p,isReadOnly:E,componentValue:b,removeComponentFromField:C,required:T})=>{const{formatMessage:D}=(0,Q.Z)(),M=Wl()(b),I=b!==null||s,R=!c&&I&&!s&&h,{getComponentLayout:v,components:x}=(0,ae.PL)(),B=(0,e.useMemo)(()=>v(o),[o,v]);if(!h&&a)return e.createElement(y.X0,{labelAction:d,intlLabel:r,name:g});if(!h&&!a&&!p)return e.createElement(y.X0,{labelAction:d,intlLabel:r,name:g});const A=()=>{t(g,B,x)};return e.createElement(W.x,null,e.createElement(Z.k,{justifyContent:"space-between"},r&&e.createElement(Yd,{intlLabel:r,labelAction:d,name:g,numberOfEntries:M,showNumberOfEntries:c,required:T}),R&&e.createElement(Re.h,{label:D({id:(0,f.OB)("components.reset-entry"),defaultMessage:"Reset Entry"}),icon:e.createElement(He.Z,null),noBorder:!0,onClick:()=>{C(g,o)}})),e.createElement(Z.k,{direction:"column",alignItems:"stretch",gap:1},!c&&!I&&e.createElement(Mr,{isReadOnly:E,onClick:A}),!c&&I&&e.createElement($d,{componentUid:o,isFromDynamicZone:s,isNested:l,name:g}),c&&e.createElement(Qd,{componentValue:b,componentValueLength:M,componentUid:o,isReadOnly:E,max:m,min:u,name:g})))};ho.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},ho.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 tu=(0,e.memo)(ho,Le());var en=Jd(tu,eu);const yo=({componentUid:t,formErrors:o,index:r,isFieldAllowed:a,name:s,onRemoveComponentClick:c,onMoveComponent:l,onGrabItem:d,onDropItem:m,onCancel:u,dynamicComponentsByCategory:g,onAddComponent:h})=>{const[p,E]=(0,e.useState)(!0),{formatMessage:b}=(0,Q.Z)(),{getComponentLayout:C}=(0,ae.PL)(),{modifiedData:T}=(0,y.Wq)(),{icon:D,friendlyName:M,mainValue:I}=(0,e.useMemo)(()=>{const F=C(t),{info:{icon:w,displayName:O}}=F,S=k()(F,["settings","mainField"],"id"),z=k()(T,[s,r,S])??"",Y=S==="id"?"":String(z).trim(),N=Y.length>0?` - ${Y}`:Y;return{friendlyName:O,icon:w,mainValue:N}},[t,C,T,s,r]),R=Object.keys(o).filter(F=>{const w=F.split(".");return`${w[0]}.${w[1]}`==`${s}.${r}`});let v;R.length>0&&(v=b({id:(0,f.OB)("components.DynamicZone.error-message"),defaultMessage:"The component contains error(s)"}));const x=()=>{E(F=>!F)},[{handlerId:B,isDragging:A,handleKeyDown:P},$,q,L,X]=(0,ae.Y9)(a,{type:`${f._Q.DYNAMIC_ZONE}_${s}`,index:r,item:{displayedValue:`${M}${I}`,icon:D},onMoveItem:l,onGrabItem:d,onDropItem:m,onCancel:u});(0,e.useEffect)(()=>{X((0,kt.rX)(),{captureDraggingState:!1})},[X,r]);const K=(0,f.FE)($,q),J=a?e.createElement(nu,{gap:0,expanded:p},e.createElement(ou,{noBorder:!0,label:b({id:(0,f.OB)("components.DynamicZone.delete-label"),defaultMessage:"Delete {name}"},{name:M}),onClick:c},e.createElement(He.Z,null)),e.createElement(Re.h,{forwardedAs:"div",role:"button",noBorder:!0,tabIndex:0,onClick:F=>F.stopPropagation(),"data-handler-id":B,ref:L,label:b({id:(0,f.OB)("components.DragHandle-label"),defaultMessage:"Drag"}),onKeyDown:P},e.createElement(st.Z,null)),e.createElement(Be.fC,null,e.createElement(Be.xz,{size:"S",endIcon:void 0,paddingLeft:2,paddingRight:2},e.createElement(jn.Z,{"aria-hidden":!0,focusable:!1}),e.createElement(ft.T,{as:"span"},b({id:(0,f.OB)("components.DynamicZone.more-actions"),defaultMessage:"More actions"}))),e.createElement(Be.VY,null,e.createElement(Be.rl,null,e.createElement(Be.fF,null,b({id:(0,f.OB)("components.DynamicZone.add-item-above"),defaultMessage:"Add component above"})),e.createElement(Be.tu,null,Object.entries(g).map(([F,w])=>e.createElement(e.Fragment,{key:F},e.createElement(Be.__,null,F),w.map(({componentUid:O,info:{displayName:S}})=>e.createElement(Rr.sN,{key:O,onSelect:()=>h(O,r)},S)))))),e.createElement(Be.rl,null,e.createElement(Be.fF,null,b({id:(0,f.OB)("components.DynamicZone.add-item-below"),defaultMessage:"Add component below"})),e.createElement(Be.tu,null,Object.entries(g).map(([F,w])=>e.createElement(e.Fragment,{key:F},e.createElement(Be.__,null,F),w.map(({componentUid:O,info:{displayName:S}})=>e.createElement(Rr.sN,{key:O,onSelect:()=>h(O,r+1)},S))))))))):null;return e.createElement(lu,{as:"li",width:"100%"},e.createElement(Z.k,{justifyContent:"center"},e.createElement(su,{background:"neutral200"})),e.createElement(ru,{ref:K,hasRadius:!0},A?e.createElement(iu,{padding:6,background:"primary100"}):e.createElement(Ln.U,{expanded:p,onToggle:x,size:"S",error:v},e.createElement(wn.B,{startIcon:e.createElement(St,{icon:D,showBackground:!1,size:"S"}),action:J,title:`${M}${I}`,togglePosition:"left"}),e.createElement($n.v,null,e.createElement(au,{background:"neutral0"},e.createElement(en,{componentUid:t,icon:D,name:`${s}.${r}`,isFromDynamicZone:!0}))))))},nu=(0,U.ZP)(Z.k)`
|
|
914
|
-
/*
|
|
915
|
-
we need to remove the background from the button but we can't
|
|
916
|
-
wrap the element in styled because it breaks the forwardedAs which
|
|
917
|
-
we need for drag handler to work on firefox
|
|
918
|
-
*/
|
|
919
|
-
div[role='button'] {
|
|
920
|
-
background: transparent;
|
|
921
|
-
}
|
|
922
|
-
`,ou=(0,U.ZP)(Re.h)`
|
|
923
|
-
background-color: transparent;
|
|
924
|
-
|
|
925
|
-
svg path {
|
|
926
|
-
fill: ${({theme:t,expanded:o})=>o?t.colors.primary600:t.colors.neutral600};
|
|
927
|
-
}
|
|
928
|
-
`,ru=(0,U.ZP)(W.x)`
|
|
929
|
-
> div:first-child {
|
|
930
|
-
box-shadow: ${({theme:t})=>t.shadows.tableShadow};
|
|
931
|
-
}
|
|
932
|
-
`,au=(0,U.ZP)(W.x)`
|
|
933
|
-
border-radius: 0 0 ${({theme:t})=>t.spaces[1]} ${({theme:t})=>t.spaces[1]};
|
|
934
|
-
`,su=(0,U.ZP)(W.x)`
|
|
935
|
-
width: ${({theme:t})=>t.spaces[2]};
|
|
936
|
-
height: ${({theme:t})=>t.spaces[4]};
|
|
937
|
-
`,iu=U.ZP.span`
|
|
938
|
-
display: block;
|
|
939
|
-
background-color: ${({theme:t})=>t.colors.primary100};
|
|
940
|
-
outline: 1px dashed ${({theme:t})=>t.colors.primary500};
|
|
941
|
-
outline-offset: -1px;
|
|
942
|
-
padding: ${({theme:t})=>t.spaces[6]};
|
|
943
|
-
`,lu=(0,U.ZP)(W.x)`
|
|
944
|
-
list-style: none;
|
|
945
|
-
padding: 0;
|
|
946
|
-
margin: 0;
|
|
947
|
-
`;yo.defaultProps={dynamicComponentsByCategory:{},formErrors:{},index:0,isFieldAllowed:!0,onAddComponent:void 0,onGrabItem:void 0,onDropItem:void 0,onCancel:void 0},yo.propTypes={componentUid:n().string.isRequired,dynamicComponentsByCategory:n().shape({components:n().arrayOf(n().shape({componentUid:n().string.isRequired,info:n().object}))}),formErrors:n().object,index:n().number,isFieldAllowed:n().bool,name:n().string.isRequired,onAddComponent:n().func,onGrabItem:n().func,onDropItem:n().func,onCancel:n().func,onMoveComponent:n().func.isRequired,onRemoveComponentClick:n().func.isRequired};const Eo=({label:t,labelAction:o,name:r,numberOfComponents:a,required:s,intlDescription:c})=>{const{formatMessage:l}=(0,Q.Z)(),d=l({id:t||r,defaultMessage:t||r});return e.createElement(Z.k,{justifyContent:"center"},e.createElement(W.x,{paddingTop:3,paddingBottom:3,paddingRight:4,paddingLeft:4,borderRadius:26,background:"neutral0",shadow:"filterShadow",color:"neutral500"},e.createElement(Z.k,{direction:"column",justifyContent:"center"},e.createElement(Z.k,{maxWidth:(0,y.Q1)(356)},e.createElement(G.Z,{variant:"pi",textColor:"neutral600",fontWeight:"bold",ellipsis:!0},d,"\xA0"),e.createElement(G.Z,{variant:"pi",textColor:"neutral600",fontWeight:"bold"},"(",a,")"),s&&e.createElement(G.Z,{textColor:"danger600"},"*"),o&&e.createElement(W.x,{paddingLeft:1},o)),c&&e.createElement(W.x,{paddingTop:1,maxWidth:(0,y.Q1)(356)},e.createElement(G.Z,{variant:"pi",textColor:"neutral600",ellipsis:!0},l(c))))))};Eo.defaultProps={intlDescription:void 0,label:"",labelAction:void 0,numberOfComponents:0,required:!1},Eo.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};const bo=({name:t,labelAction:o,fieldSchema:r,metadatas:a})=>{const{max:s=1/0,min:c=-1/0,components:l=[],required:d=!1}=r,[m,u]=(0,e.useState)(!1),[g,h]=(0,e.useState)(""),{addComponentToDynamicZone:p,createActionAllowedFields:E,isCreatingEntry:b,formErrors:C,modifiedData:T,moveComponentField:D,removeComponentFromDynamicZone:M,readActionAllowedFields:I,updateActionAllowedFields:R}=(0,y.Wq)(),v=(0,e.useMemo)(()=>(T?.[t]??[]).map(H=>({componentUid:H.__component,id:H.id??H.__temp_key__})),[T,t]),{getComponentLayout:x,components:B}=(0,ae.PL)(),A=(0,e.useMemo)(()=>l.reduce((H,he)=>{const{category:ve,info:Pe,attributes:Qe}=x(he),Ke={componentUid:he,info:Pe,attributes:Qe};return H[ve]||(H[ve]=[]),H[ve]=[...H[ve],Ke],H},{}),[l,x]),{formatMessage:P}=(0,Q.Z)(),$=(0,y.lm)(),q=(0,e.useMemo)(()=>(b?E:R).includes(t),[t,b,E,R]),L=(0,e.useMemo)(()=>(b?[]:I).includes(t),[t,b,I]),X=v.length,K=a.description?{id:a.description,defaultMessage:a.description}:null,J=C[t],F=c-X,w=!!J,O=(H,he)=>{u(!1);const ve=x(H);p(t,ve,B,w,he)},S=()=>{X<s?u(H=>!H):$({type:"info",message:{id:(0,f.OB)("components.notification.info.maximum-requirement")}})},z=(H,he)=>{h(P({id:(0,f.OB)("dnd.reorder"),defaultMessage:"{item}, moved. New position in list: {position}."},{item:`${t}.${he}`,position:Y(H)})),D({name:t,newIndex:H,currentIndex:he})},Y=H=>`${H+1} of ${v.length}`,N=H=>{h(P({id:(0,f.OB)("dnd.cancel-item"),defaultMessage:"{item}, dropped. Re-order cancelled."},{item:`${t}.${H}`}))},j=H=>{h(P({id:(0,f.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}.${H}`,position:Y(H)}))},_=H=>{h(P({id:(0,f.OB)("dnd.drop-item"),defaultMessage:"{item}, dropped. Final position in list: {position}."},{item:`${t}.${H}`,position:Y(H)}))},ne=(H,he)=>()=>{M(H,he)},me=()=>m?P({id:"app.utils.close-label",defaultMessage:"Close"}):w&&J.id.includes("max")?P({id:"components.Input.error.validation.max",defaultMessage:"The value is too high."}):w&&J.id.includes("min")?P({id:(0,f.OB)("components.DynamicZone.missing-components"),defaultMessage:"There {number, plural, =0 {are # missing components} one {is # missing component} other {are # missing components}}"},{number:F}):P({id:(0,f.OB)("components.DynamicZone.add-component"),defaultMessage:"Add a component to {componentName}"},{componentName:a.label||t});if(!q&&(b||!L&&!b))return e.createElement(y.X0,{description:K,intlLabel:{id:a.label,defaultMessage:a.label},labelAction:o,name:t});const V=`${t}-item-instructions`;return e.createElement(Z.k,{direction:"column",alignItems:"stretch",gap:6},X>0&&e.createElement(W.x,null,e.createElement(Eo,{intlDescription:K,label:a.label,labelAction:o,name:t,numberOfComponents:X,required:d}),e.createElement(ft.T,{id:V},P({id:(0,f.OB)("dnd.instructions"),defaultMessage:"Press spacebar to grab and re-order"})),e.createElement(ft.T,{"aria-live":"assertive"},g),e.createElement("ol",{"aria-describedby":V},v.map(({componentUid:H,id:he},ve)=>e.createElement(yo,{componentUid:H,formErrors:C,key:`${H}-${he}`,index:ve,isFieldAllowed:q,name:t,onMoveComponent:z,onRemoveComponentClick:ne(t,ve),onCancel:N,onDropItem:_,onGrabItem:j,onAddComponent:O,dynamicComponentsByCategory:A})))),e.createElement(Z.k,{justifyContent:"center"},e.createElement(Sn,{hasError:w,isDisabled:!q,isOpen:m,onClick:S},me())),e.createElement(Nn,{dynamicComponentsByCategory:A,isOpen:m,onClickAddComponent:O}))};bo.defaultProps={fieldSchema:{},labelAction:null},bo.propTypes={fieldSchema:n().shape({components:n().array,max:n().number,min:n().number,required:n().bool}),labelAction:n().element,metadatas:n().shape({description:n().string,label:n().string}).isRequired,name:n().string.isRequired};var cu=i(86834),we=i.n(cu),Hr=i(12788),vo=i(99526),du=i(10268),Gr=i.n(du),uu=i(56236),mu=i.n(uu),pu=i(77236),gu=i.n(pu),fu=i(85973),hu=i.n(fu);const yu=({browserState:t,serverState:o},r,a)=>{const s=o,c=t,l=(u,g)=>k()(u,["attributes",g,"type"],""),d=(u,g)=>k()(u,["attributes",...g],""),m=(u,g,h,p)=>Object.keys(u).reduce((E,b)=>{const C=p?`${p}.${b}`:b,T=l(h,b),D=k()(u,b),M=k()(g,b),I=d(h,[b,"component"]),R=d(h,[b,"repeatable"]);let v;switch(T){case"json":v=JSON.parse(D);break;case"time":{v=D,D&&D.split(":").length<3&&(v=`${D}:00`);break}case"media":d(h,[b,"multiple"])===!0?v=D?D.filter(x=>!(x instanceof File)):null:v=k()(D,0)instanceof File?null:k()(D,"id",null);break;case"component":R?v=D&&D.map((x,B)=>m(x,(M??[])[B],a[I],`${C}.${B}`)):v=D&&m(D,M,a[I],C);break;case"relation":{const x=Ir(s,c)(C).join(".");let B=k()(s,x,[]);const A=D.reduce(($,q,L,X)=>{const K=B.find(F=>F.id===q.id),J=X[L+1];if(!K||K.__temp_key__!==q.__temp_key__){const F=J?{before:J.id}:{end:!0};return[...$,{id:q.id,position:F}]}return $},[]);v={disconnect:B.reduce(($,q)=>D.find(L=>L.id===q.id)?$:[...$,{id:q.id}],[]),connect:A.reverse()};break}case"dynamiczone":v=D.map((x,B)=>m(x,(M??[])[B],a[x.__component],`${C}.${B}`));break;default:v=Eu(D,"id")}return E[b]=v,E},{});return m(t,o,r,"")},Eu=(t,o)=>gu()(t)?t.map(r=>r[o]?r[o]:r):hu()(t)?t[o]:t;var bu=yu;const tn=(t,o=()=>!1,r=void 0)=>{const a=(s,c,{ignoreFalseyValues:l=!1,path:d=[],parent:m=c}={})=>Object.entries(c).reduce((u,[g,h])=>{if(l&&(u==null||u[g]===void 0||u[g]===null))return u;if(o(h,{path:[...d,g],parent:m})&&(u[g]=typeof r=="function"?r(u[g],{path:[...d,g],parent:u}):r),h.type==="component"){const p=t[h.component].attributes;!h.repeatable&&u[g]&&typeof u[g]=="object"?u[g]=a(u[g],p,{ignoreFalseyValues:l,path:[...d,g],parent:c[g]}):h.repeatable&&Array.isArray(u[g])&&(u[g]=u[g].map((E,b)=>a(E,p,{ignoreFalseyValues:l,path:[...d,g,b],parent:c[g]})))}else h.type==="dynamiczone"&&Array.isArray(u[g])&&(u[g]=u[g].map((p,E)=>{const b=t[p.__component].attributes;return a(p,b,{ignoreFalseyValues:l,path:[...d,g,E],parent:c[g]})}));return u},{...s});return a};var Qr=(t,o,r,a)=>{const s=t.slice();return s.splice(o,1),s.splice(r,0,a),s};const vu={componentsDataStructure:{},contentTypeDataStructure:{},formErrors:{},initialData:{},modifiedData:null,shouldCheckErrors:!1,modifiedDZName:null,publishConfirmation:{show:!1,draftCount:0}};var Cu=(t,o)=>(0,Tn.ZP)(t,r=>{switch(o.type){case"ADD_NON_REPEATABLE_COMPONENT_TO_FIELD":{const{componentLayoutData:a,allComponents:s}=o,c={...t.componentsDataStructure[a.uid]},d=tn(s,m=>m.type==="relation",[])(c,a.attributes);se()(r,["modifiedData",...o.keys],d);break}case"ADD_COMPONENT_TO_DYNAMIC_ZONE":case"ADD_REPEATABLE_COMPONENT_TO_FIELD":{const{keys:a,allComponents:s,componentLayoutData:c,shouldCheckErrors:l,position:d=void 0}=o;l&&(r.shouldCheckErrors=!t.shouldCheckErrors),o.type==="ADD_COMPONENT_TO_DYNAMIC_ZONE"&&(r.modifiedDZName=a[0]);const m=[...k()(t,["modifiedData",...a],[])];let u=d;u===void 0?u=m.length:u<0&&(u=0);const g=o.type==="ADD_COMPONENT_TO_DYNAMIC_ZONE"?{...t.componentsDataStructure[c.uid],__component:c.uid,__temp_key__:(0,f.Uo)(m)+1}:{...t.componentsDataStructure[c.uid],__temp_key__:(0,f.Uo)(m)+1},p=tn(s,E=>E.type==="relation",[])(g,c.attributes);m.splice(u,0,p),se()(r,["modifiedData",...a],m);break}case"LOAD_RELATION":{const{initialDataPath:a,modifiedDataPath:s,value:c}=o,l=k()(t,a),d=k()(t,s),m=l?c.filter(h=>!l.some(p=>p.id===h.id)):c,u=(0,vo.zJ)(null,d[0]?.__temp_key__,m.length),g=m.map((h,p)=>({...h,__temp_key__:u[p]}));se()(r,a,Gr()([...g,...l],"id")),se()(r,s,Gr()([...g,...d],"id"));break}case"CONNECT_RELATION":{const a=["modifiedData",...o.keys],{value:s,toOneRelation:c}=o;if(c)se()(r,a,[s]);else{const l=k()(t,a),[d]=(0,vo.zJ)(l.at(-1)?.__temp_key__,null,1),m=[...l,{...s,__temp_key__:d}];se()(r,a,m)}break}case"DISCONNECT_RELATION":{const a=["modifiedData",...o.keys],{id:s}=o,l=k()(t,[...a]).filter(d=>d.id!==s);se()(r,a,l);break}case"MOVE_COMPONENT_FIELD":case"REORDER_RELATION":{const{oldIndex:a,newIndex:s,keys:c}=o,l=["modifiedData",...c],d=k()(t,[...l]),m=d[a],u=[...d];if(o.type==="REORDER_RELATION"){const g=a>s?d[s-1]?.__temp_key__:d[s]?.__temp_key__,h=a>s?d[s]?.__temp_key__:d[s+1]?.__temp_key__,[p]=(0,vo.zJ)(g,h,1);u.splice(a,1),u.splice(s,0,{...m,__temp_key__:p})}else u.splice(a,1),u.splice(s,0,m);se()(r,l,u);break}case"INIT_FORM":{const{initialValues:a,components:s={},attributes:c={},setModifiedDataOnly:l}=o,d=Ie()(a),u=tn(s,p=>p.type==="relation",(p,{path:E})=>t.modifiedData?.id===d.id&&k()(t.modifiedData,E)?k()(t.modifiedData,E):[])(d,c),h=tn(s,p=>p.type==="dynamiczone"||p.type==="component"&&!p.repeatable,p=>Array.isArray(p)?p.map((E,b)=>({...E,__temp_key__:b})):{...p,__temp_key__:0})(u,c,{ignoreFalseyValues:!0});l||(r.initialData=h),r.modifiedData=h,r.formErrors={},r.modifiedDZName=null,r.shouldCheckErrors=!1;break}case"MOVE_COMPONENT_UP":case"MOVE_COMPONENT_DOWN":{const{currentIndex:a,dynamicZoneName:s,shouldCheckErrors:c}=o;c&&(r.shouldCheckErrors=!t.shouldCheckErrors);const l=t.modifiedData[s],d=o.type==="MOVE_COMPONENT_UP"?a-1:a+1,m=t.modifiedData[s][a],u=Qr(l,a,d,m);se()(r,["modifiedData",o.dynamicZoneName],u);break}case"MOVE_FIELD":{const a=k()(t,["modifiedData",...o.keys],[]).slice(),s=k()(t,["modifiedData",...o.keys,o.dragIndex]),c=Qr(a,o.dragIndex,o.overIndex,s);se()(r,["modifiedData",...o.keys],c);break}case"ON_CHANGE":{const[a]=o.keys;if(o.shouldSetInitialValue&&se()(r,["initialData",...o.keys],o.value),o.keys.length===2&&k()(t,["modifiedData",a])===null){se()(r,["modifiedData",a],{[o.keys[1]]:o.value});break}se()(r,["modifiedData",...o.keys],o.value);break}case"REMOVE_COMPONENT_FROM_DYNAMIC_ZONE":{o.shouldCheckErrors&&(r.shouldCheckErrors=!t.shouldCheckErrors),r.modifiedData[o.dynamicZoneName].splice(o.index,1);break}case"REMOVE_COMPONENT_FROM_FIELD":{const a=["modifiedData",...o.keys];se()(r,a,null);break}case"REMOVE_PASSWORD_FIELD":{mu()(r,["modifiedData",...o.keys]);break}case"REMOVE_REPEATABLE_FIELD":{const a=o.keys.length-1,s=["modifiedData",...$t()(o.keys,a)];Object.keys(t.formErrors).length>0&&(r.shouldCheckErrors=!t.shouldCheckErrors);const l=k()(t,s).slice();l.splice(parseInt(o.keys[a],10),1),se()(r,s,l);break}case"SET_DEFAULT_DATA_STRUCTURES":{r.componentsDataStructure=o.componentsDataStructure,r.contentTypeDataStructure=o.contentTypeDataStructure;break}case"SET_FORM_ERRORS":{r.modifiedDZName=null,r.formErrors=o.errors;break}case"TRIGGER_FORM_VALIDATION":{Object.keys(t.formErrors).length>0&&(r.shouldCheckErrors=!t.shouldCheckErrors);break}case"SET_PUBLISH_CONFIRMATION":{r.publishConfirmation={...o.publishConfirmation};break}case"RESET_PUBLISH_CONFIRMATION":{r.publishConfirmation={...t.publishConfirmation,show:!1};break}default:return r}});const Co=({allLayoutData:t,allowedActions:{canRead:o,canUpdate:r},children:a,componentsDataStructure:s,contentTypeDataStructure:c,createActionAllowedFields:l,from:d,initialValues:m,isCreatingEntry:u,isLoadingForData:g,isSingleType:h,onPost:p,onPublish:E,onDraftRelationCheck:b,onPut:C,onUnpublish:T,readActionAllowedFields:D,redirectToPreviousPage:M,slug:I,status:R,updateActionAllowedFields:v})=>{const[x,B]=e.useState(!1),[A,P]=(0,e.useReducer)(Cu,vu),{formErrors:$,initialData:q,modifiedData:L,modifiedDZName:X,shouldCheckErrors:K,publishConfirmation:J}=A,{setModifiedDataOnly:F}=(0,de.v9)(xn),w=(0,de.I0)(),O=(0,y.lm)(),{lockApp:S,unlockApp:z}=(0,y.o1)(),Y=k()(t,["contentType"],{}),N=(0,e.useMemo)(()=>k()(Y,["options","draftAndPublish"],!1),[Y]),j=(0,e.useMemo)(()=>N&&!q.publishedAt,[N,q.publishedAt]),{trackUsage:_}=(0,y.rS)(),{formatMessage:ne}=(0,Q.Z)(),me=(0,e.useRef)(_),V=(0,e.useMemo)(()=>g||u?!1:o===!1&&r===!1,[g,u,o,r]);(0,e.useEffect)(()=>{R==="resolved"?z():S()},[S,z,R]),(0,e.useEffect)(()=>{g||ue()},[K]),(0,e.useEffect)(()=>{const re=Object.keys($);if(re.length>0){const te=re[0],ce=document.getElementById(te);ce&&ce.focus()}},[$]),(0,e.useEffect)(()=>{V&&O({type:"info",message:{id:(0,f.OB)("permissions.not-allowed.update")}})},[V,O]),(0,e.useEffect)(()=>{P({type:"SET_DEFAULT_DATA_STRUCTURES",componentsDataStructure:s,contentTypeDataStructure:c})},[s,c]);const{components:H}=t,he=(0,ae.zH)(m);(0,e.useEffect)(()=>{m&&Y?.attributes&&!Le()(he,m)&&(P({type:"INIT_FORM",initialValues:m,components:H,attributes:Y.attributes,setModifiedDataOnly:F}),F&&w(Ll()))},[m,Y,H,F,w,he]);const ve=(0,e.useCallback)(re=>(te,ce,Fe,Et=!1,Ut=void 0)=>{me.current("didAddComponentToDynamicZone"),P({type:re,keys:te.split("."),position:Ut,componentLayoutData:ce,allComponents:Fe,shouldCheckErrors:Et})},[]),Pe=ve("ADD_COMPONENT_TO_DYNAMIC_ZONE"),Qe=(0,e.useCallback)((re,te,ce)=>{P({type:"ADD_NON_REPEATABLE_COMPONENT_TO_FIELD",keys:re.split("."),componentLayoutData:te,allComponents:ce})},[]),Ke=(0,e.useCallback)(({name:re,value:te,toOneRelation:ce})=>{P({type:"CONNECT_RELATION",keys:re.split("."),value:te,toOneRelation:ce})},[]),Ye=(0,e.useCallback)(({target:{initialDataPath:re,modifiedDataPath:te,value:ce,modifiedDataOnly:Fe}})=>{P({type:"LOAD_RELATION",modifiedDataPath:te,initialDataPath:re,value:ce,modifiedDataOnly:Fe})},[]),Ne=ve("ADD_REPEATABLE_COMPONENT_TO_FIELD"),ke=(0,e.useMemo)(()=>{const re={isCreatingEntry:u,isDraft:j,isFromComponent:!1};return(0,f.Ex)(Y,{components:t.components||{}},re)},[t.components,Y,u,j]),ue=(0,e.useCallback)(async(re={})=>{let te={};const ce=Ie()(L);we()(ce)||se()(ce,re.path,re.value);try{await ke.validate(ce,{abortEarly:!1})}catch(Fe){te=(0,y.CJ)(Fe),X&&(te=Object.keys(te).reduce((Et,Ut)=>(Ut.split(".")[0]!==X&&(Et[Ut]=te[Ut]),Et),{}))}P({type:"SET_FORM_ERRORS",errors:te})},[X,L,ke]),ee=(0,e.useCallback)(({target:{name:re,value:te,type:ce}},Fe=!1)=>{let Et=te;if(["text","textarea","string","email","uid","select","select-one","number"].includes(ce)&&!te&&te!==0&&(Et=null),ce==="password"&&!te){P({type:"REMOVE_PASSWORD_FIELD",keys:re.split(".")});return}P({type:"ON_CHANGE",keys:re.split("."),value:Et,shouldSetInitialValue:Fe})},[]),pe=(0,e.useCallback)((re,te)=>bu({browserState:re,serverState:te},Y,t.components),[t.components,Y]),oe=(0,e.useMemo)(()=>N?j?{status:"draft"}:{}:{},[N,j]),fe=(0,e.useCallback)(async re=>(re.preventDefault(),P({type:"RESET_PUBLISH_CONFIRMATION"})),[]),ot=(0,e.useCallback)(async re=>{re.preventDefault();let te={};try{await ke.validate(L,{abortEarly:!1})}catch(ce){te=(0,y.CJ)(ce)}try{if(we()(te)){const ce=pe(L,q);(0,Hr.flushSync)(()=>{B(!0)}),u?await p(ce,oe):await C(ce,oe),B(!1)}}catch(ce){B(!1),te={...te,...(0,y.nn)(ce,{getTrad:f.OB})}}P({type:"SET_FORM_ERRORS",errors:te})},[pe,u,L,q,p,C,oe,ke]),je=(0,e.useCallback)(async()=>{const re=(0,f.Ex)(Y,{components:k()(t,"components",{})},{isCreatingEntry:u,isDraft:!1,isFromComponent:!1}),te=await b();if(!J.show&&te>0){P({type:"SET_PUBLISH_CONFIRMATION",publishConfirmation:{show:!0,draftCount:te}});return}P({type:"RESET_PUBLISH_CONFIRMATION"});let ce={};try{await re.validate(L,{abortEarly:!1})}catch(Fe){ce=(0,y.CJ)(Fe)}try{we()(ce)&&((0,Hr.flushSync)(()=>{B(!0)}),await E(),B(!1))}catch(Fe){B(!1),ce={...ce,...(0,y.nn)(Fe,{getTrad:f.OB})}}P({type:"SET_FORM_ERRORS",errors:ce})},[t,Y,u,L,J.show,E,b]),ct=(0,e.useCallback)(re=>{const te=Object.keys($).some(Fe=>Fe.split(".")[0]===re);return!we()($)&&te},[$]),Wp=(0,e.useCallback)((re,te)=>{me.current("changeComponentsOrder"),P({type:"MOVE_COMPONENT_DOWN",dynamicZoneName:re,currentIndex:te,shouldCheckErrors:ct(re)})},[ct]),zp=(0,e.useCallback)((re,te)=>{me.current("changeComponentsOrder"),P({type:"MOVE_COMPONENT_UP",dynamicZoneName:re,currentIndex:te,shouldCheckErrors:ct(re)})},[ct]),Up=(0,e.useCallback)(({name:re,newIndex:te,currentIndex:ce})=>{P({type:"MOVE_COMPONENT_FIELD",keys:re.split("."),newIndex:te,oldIndex:ce})},[]),qp=(0,e.useCallback)(({name:re,id:te})=>{P({type:"DISCONNECT_RELATION",keys:re.split("."),id:te})},[]),Vp=(0,e.useCallback)(({name:re,oldIndex:te,newIndex:ce})=>{P({type:"REORDER_RELATION",keys:re.split("."),oldIndex:te,newIndex:ce})},[]),Hp=(0,e.useCallback)((re,te)=>{me.current("removeComponentFromDynamicZone"),P({type:"REMOVE_COMPONENT_FROM_DYNAMIC_ZONE",dynamicZoneName:re,index:te,shouldCheckErrors:ct(re)})},[ct]),Gp=(0,e.useCallback)((re,te)=>{P({type:"REMOVE_COMPONENT_FROM_FIELD",keys:re.split("."),componentUid:te})},[]),Qp=(0,e.useCallback)((re,te)=>{P({type:"REMOVE_REPEATABLE_FIELD",keys:re.split("."),componentUid:te})},[]),Kp=(0,e.useCallback)(()=>{P({type:"TRIGGER_FORM_VALIDATION"})},[]);return V?e.createElement(ie.l_,{to:d}):L?e.createElement(y.W1.Provider,{value:{addComponentToDynamicZone:Pe,addNonRepeatableComponentToField:Qe,addRepeatableComponentToField:Ne,allLayoutData:t,checkFormErrors:ue,createActionAllowedFields:l,formErrors:$,hasDraftAndPublish:N,initialData:q,isCreatingEntry:u,isSingleType:h,shouldNotRunValidations:j,status:R,layout:Y,modifiedData:L,moveComponentField:Up,moveComponentDown:Wp,moveComponentUp:zp,onChange:ee,onPublish:je,onUnpublish:T,readActionAllowedFields:D,redirectToPreviousPage:M,removeComponentFromDynamicZone:Hp,removeComponentFromField:Gp,removeRepeatableField:Qp,relationConnect:Ke,relationDisconnect:qp,relationLoad:Ye,relationReorder:Vp,slug:I,triggerFormValidation:Kp,updateActionAllowedFields:v,onPublishPromptDismissal:fe,publishConfirmation:J}},g||!u&&!q.id?e.createElement(Ee.o,{"aria-busy":"true"},e.createElement(y.dO,null)):e.createElement(e.Fragment,null,x?null:e.createElement(ie.NL,{when:!Le()(L,q),message:ne({id:"global.prompt.unsaved"})}),e.createElement("form",{noValidate:!0,onSubmit:ot},a))):null};Co.defaultProps={from:"/",initialValues:null,redirectToPreviousPage(){}},Co.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 Ru=Co,nn=i(33348),Mu=t=>Object.values(t||{}).reduce((o,r)=>Object.assign(o,r),{}),Kr=(t={})=>{const{plugins:o,_q:r,...a}={...t,...Mu(t.plugins)};return r&&se()(a,"_q",encodeURIComponent(r)),`${(0,nn.stringify)(a,{encode:!1,addQueryPrefix:!0})}`},yt=t=>(0,f.IF)(`single-types/${t}`);const Yr=({allLayoutData:t,children:o,slug:r})=>{const a=(0,nt.useQueryClient)(),{trackUsage:s}=(0,y.rS)(),{push:c}=(0,ie.k6)(),{setCurrentStep:l}=(0,y.c1)(),d=(0,e.useRef)(s),[m,u]=(0,e.useState)(!0),[{query:g,rawQuery:h}]=(0,y.Kx)(),p=Kr(g),E=(0,y.lm)(),b=(0,de.I0)(),{formatAPIError:C}=(0,y.So)(f.OB),T=(0,y.kY)(),{post:D,put:M,del:I}=T,{componentsDataStructure:R,contentTypeDataStructure:v,data:x,isLoading:B,status:A}=(0,de.v9)(xn),P=(0,e.useCallback)(w=>{const O=(0,f.kc)(w,t.contentType,t.components);return(0,y.dU)(O,t.contentType,t.components)},[t]);(0,e.useEffect)(()=>()=>{b(Er())},[b]),(0,e.useEffect)(()=>{const w=Object.keys(t.components).reduce((z,Y)=>{const N=(0,f.Di)(k()(t,["components",Y,"attributes"],{}),t.components);return z[Y]=(0,y.dU)(N,t.components[Y],t.components),z},{}),O=(0,f.Di)(t.contentType.attributes,t.components),S=(0,y.dU)(O,t.contentType,t.components);b(br(w,S))},[t,b]),(0,e.useEffect)(()=>{const O=Ge.default.CancelToken.source();return(async z=>{b(Kt()),u(!0);try{const{data:Y}=await T.get(yt(`${r}${p}`),{cancelToken:z.token});b(Pn(P(Y))),u(!1)}catch(Y){if(Ge.default.isCancel(Y))return;const N=k()(Y,"response.status",null);N===404&&b(Zn(h,!0)),N===403&&(E({type:"info",message:{id:(0,f.OB)("permissions.not-allowed.update")}}),c("/"))}})(O),()=>O.cancel("Operation canceled by the user.")},[T,P,c,r,b,p,h,E]);const $=(0,e.useCallback)(w=>{E({type:"warning",message:C(w)})},[E,C]),q=(0,e.useCallback)(async w=>{try{d.current("willDeleteEntry",w);const{data:O}=await I(yt(`${r}${p}`));return E({type:"success",message:{id:(0,f.OB)("success.record.delete")}}),d.current("didDeleteEntry",w),u(!0),b(Zn(h,!0)),Promise.resolve(O)}catch(O){return d.current("didNotDeleteEntry",{error:O,...w}),$(O),Promise.reject(O)}},[I,r,$,E,p,b,h]),L=(0,e.useCallback)(async(w,O)=>{const S=yt(`${r}${h}`);try{b(ge("submit-pending"));const{data:z}=await M(S,w);return d.current("didCreateEntry",O),E({type:"success",message:{id:(0,f.OB)("success.record.save")}}),l("contentManager.success"),a.invalidateQueries(["relation"]),b(lt(P(z))),u(!1),b(ge("resolved")),Promise.resolve(z)}catch(z){return d.current("didNotCreateEntry",{error:z,trackerProperty:O}),$(z),b(ge("resolved")),Promise.reject(z)}},[M,P,$,r,b,h,E,l,a]),X=(0,e.useCallback)(async()=>{try{d.current("willCheckDraftRelations");const w=yt(`${r}/actions/numberOfDraftRelations`);b(ge("draft-relation-check-pending"));const O=await T.get(w);return d.current("didCheckDraftRelations"),b(ge("resolved")),O.data.data}catch(w){return $(w),b(ge("resolved")),Promise.reject(w)}},[T,$,r,b]),K=(0,e.useCallback)(async()=>{try{d.current("willPublishEntry");const w=yt(`${r}/actions/publish${p}`);b(ge("publish-pending"));const{data:O}=await D(w);return d.current("didPublishEntry"),E({type:"success",message:{id:(0,f.OB)("success.record.publish")}}),b(lt(P(O))),b(ge("resolved")),Promise.resolve(O)}catch(w){return $(w),b(ge("resolved")),Promise.reject(w)}},[D,P,$,r,p,b,E]),J=(0,e.useCallback)(async(w,O)=>{const S=yt(`${r}${h}`);try{d.current("willEditEntry",O),b(ge("submit-pending"));const{data:z}=await M(S,w);return E({type:"success",message:{id:(0,f.OB)("success.record.save")}}),d.current("didEditEntry",{trackerProperty:O}),a.invalidateQueries(["relation"]),b(lt(P(z))),b(ge("resolved")),Promise.resolve(z)}catch(z){return $(z),d.current("didNotEditEntry",{error:z,trackerProperty:O}),b(ge("resolved")),Promise.reject(z)}},[M,P,$,r,b,h,E,a]),F=(0,e.useCallback)(async()=>{const w=yt(`${r}/actions/unpublish${p}`);b(ge("unpublish-pending"));try{d.current("willUnpublishEntry");const{data:O}=await D(w);d.current("didUnpublishEntry"),E({type:"success",message:{id:(0,f.OB)("success.record.unpublish")}}),b(lt(P(O))),b(ge("resolved"))}catch(O){b(ge("resolved")),$(O)}},[D,P,E,$,r,b,p]);return o({componentsDataStructure:R,contentTypeDataStructure:v,data:x,isCreatingEntry:m,isLoadingForData:B,onDelete:q,onPost:L,onDraftRelationCheck:X,onPublish:K,onPut:J,onUnpublish:F,redirectionLink:"/",status:A})};Yr.propTypes={allLayoutData:n().shape({components:n().object.isRequired,contentType:n().object.isRequired}).isRequired,children:n().func.isRequired,slug:n().string.isRequired};var Tu=(0,e.memo)(Yr);function Du(t,o){return r=>{const a=o();return e.createElement(t,{...r,...a})}}var Iu=Du;function Ou(){const{hasDraftAndPublish:t,modifiedData:o}=(0,y.Wq)();let r={};return t&&(r=we()(o.publishedAt)?{status:"draft"}:{status:"published"}),{hasDraftAndPublish:t,trackerProperty:r}}var Pu=Ou;const Xr=({onDelete:t,trackerProperty:o})=>{const[r,a]=(0,e.useState)(!1),[s,c]=(0,e.useState)(!1),{formatMessage:l}=(0,Q.Z)(),{formatAPIError:d}=(0,y.So)(f.OB),m=(0,y.lm)(),u=()=>a(h=>!h),g=async()=>{try{c(!0),await t(o),c(!1),u()}catch(h){c(!1),u(),m({type:"warning",message:d(h)})}};return e.createElement(e.Fragment,null,e.createElement(le.z,{onClick:u,size:"S",startIcon:e.createElement(He.Z,null),variant:"danger-light"},l({id:(0,f.OB)("containers.Edit.delete-entry"),defaultMessage:"Delete this entry"})),e.createElement(y.QH,{isConfirmButtonLoading:s,isOpen:r,onConfirm:g,onToggleDialog:u}))};Xr.propTypes={onDelete:n().func.isRequired,trackerProperty:n().object.isRequired};const Zu=(0,e.memo)(Xr,Le());var xu=Iu(Zu,Pu),ku=i(56243);function Fu(t,o){return r=>{const a=o();return e.createElement(t,{...r,...a})}}var Su=Fu;function Au(){const{initialData:t,hasDraftAndPublish:o}=(0,y.Wq)(),r=t.publishedAt!==void 0&&t.publishedAt!==null;return{hasDraftAndPublish:o,isPublished:r}}var Lu=Au;const wu=(0,U.ZP)(ku.Z)`
|
|
948
|
-
width: ${(0,y.Q1)(6)};
|
|
949
|
-
height: ${(0,y.Q1)(6)};
|
|
950
|
-
* {
|
|
951
|
-
fill: ${({theme:t,$bulletColor:o})=>t.colors[o]};
|
|
952
|
-
}
|
|
953
|
-
`,Jr=({hasDraftAndPublish:t,isPublished:o})=>{const{formatMessage:r}=(0,Q.Z)();if(!t)return null;const a={draft:{textColor:"secondary700",bulletColor:"secondary600",box:{background:"secondary100",borderColor:"secondary200"}},published:{textColor:"success700",bulletColor:"success600",box:{background:"success100",borderColor:"success200"}}},s=o?a.published:a.draft;return e.createElement(W.x,{hasRadius:!0,as:"aside",paddingTop:4,paddingBottom:4,paddingLeft:5,paddingRight:5,...s.box},e.createElement(W.x,{as:Z.k},e.createElement(wu,{$bulletColor:s.bulletColor}),e.createElement(W.x,{paddingLeft:3},e.createElement(G.Z,{textColor:s.textColor},r({id:(0,f.OB)("containers.Edit.information.editing"),defaultMessage:"Editing"}),"\xA0"),e.createElement(G.Z,{fontWeight:"bold",textColor:s.textColor},o&&r({id:(0,f.OB)("containers.Edit.information.publishedVersion"),defaultMessage:"published version"}),!o&&r({id:(0,f.OB)("containers.Edit.information.draftVersion"),defaultMessage:"draft version"})))))};Jr.propTypes={hasDraftAndPublish:n().bool.isRequired,isPublished:n().bool.isRequired};var $u=Su(Jr,Lu);const Ro=({columns:t,customFieldInputs:o})=>e.createElement(De.r,{gap:4},t.map(({fieldSchema:r,labelAction:a,metadatas:s,name:c,size:l,queryInfos:d})=>{if(r.type==="component"){const{component:u,max:g,min:h,repeatable:p=!1,required:E=!1}=r;return e.createElement(ye.P,{col:l,s:12,xs:12,key:u},e.createElement(en,{componentUid:u,labelAction:a,isRepeatable:p,intlLabel:{id:s.label,defaultMessage:s.label},max:g,min:h,name:c,required:E}))}return e.createElement(ye.P,{col:l,key:c,s:12,xs:12},e.createElement(co,{size:l,fieldSchema:r,keys:c,labelAction:a,metadatas:s,queryInfos:d,customFieldInputs:o}))}));Ro.defaultProps={customFieldInputs:{}},Ro.propTypes={columns:n().array.isRequired,customFieldInputs:n().object};var Bu=Ro,Bt=i(22342),Nt=i(96166),jt=i(88693);function Nu(t,o){return r=>{const a=o();return e.createElement(t,{...r,...a})}}var ju=Nu;function Wu(){const{initialData:t,isCreatingEntry:o,isSingleType:r,status:a,layout:s,hasDraftAndPublish:c,modifiedData:l,onPublish:d,onUnpublish:m,publishConfirmation:u,onPublishPromptDismissal:g}=(0,y.Wq)();return{initialData:t,isCreatingEntry:o,isSingleType:r,status:a,layout:s,hasDraftAndPublish:c,modifiedData:l,onPublish:d,onUnpublish:m,publishConfirmation:u,onPublishPromptDismissal:g}}var zu=Wu;const _r=(0,U.ZP)(Z.k)`
|
|
954
|
-
text-align: center;
|
|
955
|
-
`,ea=({allowedActions:{canUpdate:t,canCreate:o,canPublish:r},initialData:a,isCreatingEntry:s,isSingleType:c,hasDraftAndPublish:l,layout:d,modifiedData:m,onPublish:u,onUnpublish:g,status:h,publishConfirmation:{show:p,draftCount:E},onPublishPromptDismissal:b})=>{const{goBack:C}=(0,ie.k6)(),[T,D]=(0,e.useState)(!1),{formatMessage:M}=(0,Q.Z)(),I=k()(d,["settings","mainField"],"id"),R=k()(d,["info","displayName"],"NOT FOUND"),v=!Le()(a,m)||s&&!we()(m);let B=M({id:(0,f.OB)("containers.Edit.pluginHeader.title.new"),defaultMessage:"Create an entry"});!s&&!c&&(B=a[I]||R),c&&(B=R);let A=null;if(s&&o&&(A=e.createElement(Z.k,{gap:2},l&&e.createElement(le.z,{disabled:!0,startIcon:e.createElement(Me.Z,null),variant:"secondary"},M({id:"app.utils.publish",defaultMessage:"Publish"})),e.createElement(le.z,{disabled:!v,loading:h==="submit-pending",type:"submit"},M({id:(0,f.OB)("containers.Edit.submit"),defaultMessage:"Save"})))),!s&&t){const L=l&&r,X=!we()(a.publishedAt),K=X?h==="unpublish-pending":h==="publish-pending",J=X?{id:"app.utils.unpublish",defaultMessage:"Unpublish"}:{id:"app.utils.publish",defaultMessage:"Publish"},F=X?()=>D(!0):()=>u();A=e.createElement(Z.k,null,L&&e.createElement(le.z,{disabled:v,loading:K,onClick:F,startIcon:e.createElement(Me.Z,null),variant:"secondary"},M(J)),e.createElement(W.x,{paddingLeft:L?2:0},e.createElement(le.z,{disabled:!v,loading:h==="submit-pending",type:"submit"},M({id:(0,f.OB)("containers.Edit.submit"),defaultMessage:"Save"}))))}const P=()=>D(L=>!L),$=()=>{P(),g()},q=`${M({id:(0,f.OB)("api.id"),defaultMessage:"API ID "})} : ${d.apiID}`;return e.createElement(e.Fragment,null,e.createElement(Ce.T,{title:B.toString(),primaryAction:A,subtitle:q,navigationAction:e.createElement(y.rU,{startIcon:e.createElement(et.Z,null),onClick:L=>{L.preventDefault(),C()},to:"/"},M({id:"global.back",defaultMessage:"Back"}))}),e.createElement(Bt.V,{onClose:P,title:"Confirmation",labelledBy:"confirmation",describedBy:"confirm-description",isOpen:T},e.createElement(Nt.a,{icon:e.createElement(Tt.Z,null)},e.createElement(Z.k,{direction:"column",alignItems:"stretch",gap:2},e.createElement(Z.k,{justifyContent:"center",style:{textAlign:"center"}},e.createElement(G.Z,{id:"confirm-description"},M({id:(0,f.OB)("popUpWarning.warning.unpublish"),defaultMessage:"Unpublish this content will automatically change it to a draft."},{br:()=>e.createElement("br",null)}))),e.createElement(Z.k,{justifyContent:"center",style:{textAlign:"center"}},e.createElement(G.Z,{id:"confirm-description"},M({id:(0,f.OB)("popUpWarning.warning.unpublish-question"),defaultMessage:"Are you sure you want to unpublish it?"}))))),e.createElement(jt.c,{startAction:e.createElement(le.z,{onClick:P,variant:"tertiary"},M({id:"components.popUpWarning.button.cancel",defaultMessage:"Cancel"})),endAction:e.createElement(le.z,{variant:"danger-light",onClick:$},M({id:"components.popUpWarning.button.confirm",defaultMessage:"Confirm"}))})),e.createElement(Bt.V,{onClose:b,title:M({id:(0,f.OB)("popUpWarning.warning.has-draft-relations.title"),defaultMessage:"Confirmation"}),labelledBy:"confirmation",describedBy:"confirm-description",isOpen:p},e.createElement(Nt.a,{icon:e.createElement(Tt.Z,null)},e.createElement(Z.k,{direction:"column",alignItems:"stretch",gap:2},e.createElement(_r,{justifyContent:"center"},e.createElement(G.Z,{id:"confirm-description"},E,M({id:(0,f.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:L=>e.createElement(G.Z,{fontWeight:"bold"},L),count:E}))),e.createElement(_r,{justifyContent:"center"},e.createElement(G.Z,{id:"confirm-description"},M({id:(0,f.OB)("popUpWarning.warning.publish-question"),defaultMessage:"Do you still want to publish?"}))))),e.createElement(jt.c,{startAction:e.createElement(le.z,{onClick:b,variant:"tertiary"},M({id:"components.popUpWarning.button.cancel",defaultMessage:"Cancel"})),endAction:e.createElement(le.z,{variant:"success",onClick:u},M({id:(0,f.OB)("popUpwarning.warning.has-draft-relations.button-confirm"),defaultMessage:"Publish"}))})))};ea.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 Uu=(0,e.memo)(ea,Le());var qu=ju(Uu,zu);const Vu=t=>(0,e.useEffect)(t,Hu),Hu=[];var Mo=i(98178),Gu=t=>{if(!t.layouts)return[];const o=t.layouts.edit,r=t.attributes,a=l=>k()(r,[l,"type"],"");let s=0;const c=[];return o.forEach(l=>{const d=l.some(({name:m})=>a(m)==="dynamiczone");c[s]||(c[s]=[]),d?(s=s===0&&we()(c[0])?0:s+1,c[s]||(c[s]=[]),c[s].push(l),s+=1):c[s].push(l)}),c.filter(l=>l.length>0)},Qu=t=>{if(!t)return[];const r=[...t.contentType.layouts.edit,...Object.values(t.components).flatMap(s=>s.layouts.edit)].flat().filter(s=>s.fieldSchema.customField).map(s=>s.fieldSchema.customField);return[...new Set(r)]},Ku=i(91815),Yu=i.n(Ku),Xu=(t,o)=>{const r=a=>{const s=(0,y.ZT)(t,[{action:`plugin::content-manager.explorer.${a}`,subject:o}]);return Yu()(mt()(s,"properties.fields"))};return{createActionAllowedFields:r("create"),readActionAllowedFields:r("read"),updateActionAllowedFields:r("update")}};const To=t=>t["content-manager_editViewLayoutManager"].currentLayout,Ju=(0,Mo.P1)(To,t=>Gu(t?.contentType??{})),_u=(0,Mo.P1)(To,t=>Qu(t)),em=(()=>window&&window.strapi&&window.strapi.isEE?i(28243).Z:i(73710).Z)(),tm=[{action:"plugin::content-type-builder.read",subject:null}],Do=t=>{let{allowedActions:o,isSingleType:r,goBack:a,slug:s,id:c,origin:l,userPermissions:d}=t;const{trackUsage:m}=(0,y.rS)(),{formatMessage:u}=(0,Q.Z)(),g=(0,de.v9)(Ae._),h=(0,ie.TH)(),p=(0,y.lm)();Vu(()=>{h?.state&&"error"in h.state&&p({type:"warning",message:h.state.error,timeout:5e3})});const{layout:E,formattedContentTypeLayout:b,customFieldUids:C}=(0,de.v9)(P=>({layout:To(P),formattedContentTypeLayout:Ju(P),customFieldUids:_u(P)})),{isLazyLoading:T,lazyComponentStore:D}=zn(C),{createActionAllowedFields:M,readActionAllowedFields:I,updateActionAllowedFields:R}=Xu(d,s),v=r?g.contentManager.singleTypesConfigurations:g.contentManager.collectionTypesConfigurations,x=`/content-manager/${r?"singleType":"collectionType"}/${s}/configurations/edit`,B=r?Tu:wl,A=P=>P.every($=>$.every(q=>q.fieldSchema.type==="dynamiczone"));return T?e.createElement(y.dO,null):e.createElement(B,{allLayoutData:E,slug:s,id:c,origin:l},P=>{let{componentsDataStructure:$,contentTypeDataStructure:q,data:L,isCreatingEntry:X,isLoadingForData:K,onDelete:J,onPost:F,onPublish:w,onDraftRelationCheck:O,onPut:S,onUnpublish:z,redirectionLink:Y,status:N}=P;return e.createElement(Ru,{allowedActions:o,allLayoutData:E,createActionAllowedFields:M,componentsDataStructure:$,contentTypeDataStructure:q,from:Y,initialValues:L,isCreatingEntry:X,isLoadingForData:K,isSingleType:r,onPost:F,onPublish:w,onDraftRelationCheck:O,onPut:S,onUnpublish:z,readActionAllowedFields:I,redirectToPreviousPage:a,slug:s,status:N,updateActionAllowedFields:R},e.createElement(Ee.o,{"aria-busy":N!=="resolved"},e.createElement(qu,{allowedActions:o}),e.createElement(qe.D,null,e.createElement(De.r,{gap:4},e.createElement(ye.P,{col:9,s:12},e.createElement(Z.k,{direction:"column",alignItems:"stretch",gap:6},b.map((j,_)=>{if(A(j)){const{0:{0:{name:ne,fieldSchema:me,metadatas:V,labelAction:H}}}=j;return e.createElement(W.x,{key:_},e.createElement(De.r,{gap:4},e.createElement(ye.P,{col:12,s:12,xs:12},e.createElement(bo,{name:ne,fieldSchema:me,labelAction:H,metadatas:V}))))}return e.createElement(W.x,{key:_,hasRadius:!0,background:"neutral0",shadow:"tableShadow",paddingLeft:6,paddingRight:6,paddingTop:6,paddingBottom:6,borderColor:"neutral150"},e.createElement(Z.k,{direction:"column",alignItems:"stretch",gap:6},j.map((ne,me)=>e.createElement(Bu,{columns:ne,customFieldInputs:D,key:me}))))}))),e.createElement(ye.P,{col:3,s:12},e.createElement(Z.k,{direction:"column",alignItems:"stretch",gap:2},e.createElement($u,null),e.createElement(W.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(em,null),e.createElement(Qt,{area:"contentManager.editView.informations"})),e.createElement(W.x,{as:"aside","aria-labelledby":"links"},e.createElement(Z.k,{direction:"column",alignItems:"stretch",gap:2},e.createElement(Qt,{area:"contentManager.editView.right-links",slug:s}),s!=="strapi::administrator"&&e.createElement(y.jW,{permissions:tm},e.createElement(y.Qj,{onClick:()=>{m("willEditEditLayout")},size:"S",startIcon:e.createElement(pt.Z,null),style:{width:"100%"},to:`/plugins/content-type-builder/content-types/${s}`,variant:"secondary"},u({id:(0,f.OB)("link-to-ctb"),defaultMessage:"Edit the model"}))),e.createElement(y.jW,{permissions:v},e.createElement(y.Qj,{size:"S",startIcon:e.createElement(Qo.Z,null),style:{width:"100%"},to:x,variant:"secondary"},u({id:"app.links.configure-view",defaultMessage:"Configure the view"}))),o.canDelete&&!X&&e.createElement(xu,{onDelete:J})))))))))})};Do.defaultProps={id:null,isSingleType:!1,origin:null,userPermissions:[]},Do.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 nm=Do;const Io=t=>{const o=(0,e.useMemo)(()=>(0,f.TA)(t.slug),[t.slug]),{isLoading:r,allowedActions:a}=(0,y.ss)(o,t.userPermissions);return r?e.createElement(y.dO,null):e.createElement(nm,{...t,allowedActions:a})};Io.defaultProps={permissions:[]},Io.propTypes={permissions:n().array,slug:n().string.isRequired,userPermissions:n().array.isRequired};var om=(0,e.memo)(Io,Le()),rm=i(70031);const ta=({layout:t,...o})=>{const r=(0,de.v9)(rm.Z),a=(0,de.I0)(),[{query:s}]=(0,y.Kx)(),{runHookWaterfall:c}=(0,y.j1)(),l=(0,ae.r5)(s,o.slug,"editView");return(0,e.useEffect)(()=>{const d=c(Gt.Eo,{layout:t,query:s});return a(Fl(d.layout,s)),()=>{a(kl())}},[t,a,s,c]),!r||!l?e.createElement(y.dO,null):e.createElement(om,{...o,userPermissions:l})};ta.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 on=ta;const am=(0,U.ZP)(Z.k)`
|
|
956
|
-
svg {
|
|
957
|
-
width: ${32/16}rem;
|
|
958
|
-
height: ${24/16}rem;
|
|
959
|
-
margin-right: ${({theme:t})=>t.spaces[3]};
|
|
960
|
-
}
|
|
961
|
-
`,na=({attributes:t,fieldForm:o,fieldToEdit:r,onCloseModal:a,onChangeEditLabel:s,onSubmit:c,type:l})=>{const{formatMessage:d}=(0,Q.Z)(),m=t[r].relationType;let u=!["media","relation"].includes(l);return["oneWay","oneToOne","manyToOne"].includes(m)&&(u=!0),e.createElement(ar.P,{onClose:a,labelledBy:"title"},e.createElement("form",{onSubmit:c},e.createElement(sr.x,null,e.createElement(am,null,e.createElement(ur,{type:l}),e.createElement(G.Z,{fontWeight:"bold",textColor:"neutral800",as:"h2",id:"title"},d({id:(0,f.OB)("containers.ListSettingsView.modal-form.edit-label"),defaultMessage:"Edit {fieldName}"},{fieldName:xt()(r)})))),e.createElement(ir.f,null,e.createElement(De.r,{gap:4},e.createElement(ye.P,{s:12,col:6},e.createElement(vn.o,{id:"label-input",label:d({id:(0,f.OB)("form.Input.label"),defaultMessage:"Label"}),name:"label",onChange:g=>s(g),value:o.label,hint:d({id:(0,f.OB)("form.Input.label.inputDescription"),defaultMessage:"This value overrides the label displayed in the table's head"})})),u&&e.createElement(ye.P,{s:12,col:6},e.createElement(Lt.s,{"data-testid":"Enable sort on this field",checked:o.sortable,label:d({id:(0,f.OB)("form.Input.sort.field"),defaultMessage:"Enable sort on this field"}),name:"sortable",onChange:g=>s({target:{name:"sortable",value:g.target.checked}}),onLabel:d({id:"app.components.ToggleCheckbox.on-label",defaultMessage:"on"}),offLabel:d({id:"app.components.ToggleCheckbox.off-label",defaultMessage:"off"})})))),e.createElement(lr.m,{startActions:e.createElement(le.z,{onClick:a,variant:"tertiary"},d({id:"app.components.Button.cancel",defaultMessage:"Cancel"})),endActions:e.createElement(le.z,{type:"submit"},d({id:"global.finish",defaultMessage:"Finish"}))})))};na.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 sm=na;const Oo=({modifiedData:t,onChange:o,sortOptions:r})=>{const{formatMessage:a}=(0,Q.Z)(),{settings:s,metadatas:c}=t;return e.createElement(Z.k,{direction:"column",alignItems:"stretch",gap:4},e.createElement(G.Z,{variant:"delta",as:"h2"},a({id:(0,f.OB)("containers.SettingPage.settings"),defaultMessage:"Settings"})),e.createElement(Z.k,{justifyContent:"space-between",gap:4},e.createElement(W.x,{width:"100%"},e.createElement(Lt.s,{label:a({id:(0,f.OB)("form.Input.search"),defaultMessage:"Enable search"}),onChange:l=>{o({target:{name:"settings.searchable",value:l.target.checked}})},onLabel:a({id:"app.components.ToggleCheckbox.on-label",defaultMessage:"on"}),offLabel:a({id:"app.components.ToggleCheckbox.off-label",defaultMessage:"off"}),name:"settings.searchable",checked:s.searchable})),e.createElement(W.x,{width:"100%"},e.createElement(Lt.s,{label:a({id:(0,f.OB)("form.Input.filters"),defaultMessage:"Enable filters"}),onChange:l=>{o({target:{name:"settings.filterable",value:l.target.checked}})},onLabel:a({id:"app.components.ToggleCheckbox.on-label",defaultMessage:"on"}),offLabel:a({id:"app.components.ToggleCheckbox.off-label",defaultMessage:"off"}),name:"settings.filterable",checked:s.filterable})),e.createElement(W.x,{width:"100%"},e.createElement(Lt.s,{label:a({id:(0,f.OB)("form.Input.bulkActions"),defaultMessage:"Enable bulk actions"}),onChange:l=>{o({target:{name:"settings.bulkable",value:l.target.checked}})},onLabel:a({id:"app.components.ToggleCheckbox.on-label",defaultMessage:"on"}),offLabel:a({id:"app.components.ToggleCheckbox.off-label",defaultMessage:"off"}),name:"settings.bulkable",checked:s.bulkable}))),e.createElement(De.r,{gap:4},e.createElement(ye.P,{s:12,col:6},e.createElement(Ze.P,{label:a({id:(0,f.OB)("form.Input.pageEntries"),defaultMessage:"Entries per page"}),hint:a({id:(0,f.OB)("form.Input.pageEntries.inputDescription"),defaultMessage:"Note: You can override this value in the Collection Type settings page."}),onChange:l=>o({target:{name:"settings.pageSize",value:l}}),name:"settings.pageSize",value:t.settings.pageSize||""},[10,20,50,100].map(l=>e.createElement(be.W,{key:l,value:l},l)))),e.createElement(ye.P,{s:12,col:3},e.createElement(Ze.P,{label:a({id:(0,f.OB)("form.Input.defaultSort"),defaultMessage:"Default sort attribute"}),onChange:l=>o({target:{name:"settings.defaultSortBy",value:l}}),name:"settings.defaultSortBy",value:t.settings.defaultSortBy||""},r.map(l=>e.createElement(be.W,{key:l,value:l},c[l].list.label||l)))),e.createElement(ye.P,{s:12,col:3},e.createElement(Ze.P,{label:a({id:(0,f.OB)("form.Input.sort.order"),defaultMessage:"Default sort order"}),onChange:l=>o({target:{name:"settings.defaultSortOrder",value:l}}),name:"settings.defaultSortOrder",value:t.settings.defaultSortOrder||""},["ASC","DESC"].map(l=>e.createElement(be.W,{key:l,value:l},l))))))};Oo.defaultProps={modifiedData:{},sortOptions:[]},Oo.propTypes={modifiedData:n().object,onChange:n().func.isRequired,sortOptions:n().array};var im=Oo;const Po=(0,U.ZP)(Z.k)`
|
|
962
|
-
height: ${({theme:t})=>t.spaces[7]};
|
|
963
|
-
|
|
964
|
-
&:last-child {
|
|
965
|
-
padding: 0 ${({theme:t})=>t.spaces[3]};
|
|
966
|
-
}
|
|
967
|
-
`,lm=(0,U.ZP)(Po)`
|
|
968
|
-
border-right: 1px solid
|
|
969
|
-
${({theme:t,isSibling:o})=>o?t.colors.neutral150:t.colors.primary200};
|
|
970
|
-
|
|
971
|
-
svg {
|
|
972
|
-
width: ${12/16}rem;
|
|
973
|
-
height: ${12/16}rem;
|
|
974
|
-
}
|
|
975
|
-
`,cm=(0,U.ZP)(Z.k)`
|
|
976
|
-
border: 1px solid
|
|
977
|
-
${({theme:t,isSibling:o})=>o?t.colors.neutral150:t.colors.primary200};
|
|
978
|
-
|
|
979
|
-
svg {
|
|
980
|
-
width: ${10/16}rem;
|
|
981
|
-
height: ${10/16}rem;
|
|
982
|
-
|
|
983
|
-
path {
|
|
984
|
-
fill: ${({theme:t,isSibling:o})=>o?void 0:t.colors.primary600};
|
|
985
|
-
}
|
|
986
|
-
}
|
|
987
|
-
`,dm=(0,U.ZP)(G.Z)`
|
|
988
|
-
max-width: ${72/16}rem;
|
|
989
|
-
`;function Wt({labelField:t,transparent:o,isSibling:r}){return e.createElement(cm,{background:r?"neutral100":"primary100",display:"inline-flex",gap:3,hasRadius:!0,justifyContent:"space-between",transparent:o,isSibling:r,"max-height":(0,y.Q1)(32),maxWidth:"min-content",opacity:o?0:1},e.createElement(Z.k,{gap:3},e.createElement(lm,{alignItems:"center",cursor:"all-scroll",padding:3},e.createElement(st.Z,null)),e.createElement(dm,{textColor:r?void 0:"primary600",fontWeight:"bold",ellipsis:!0},t)),e.createElement(Z.k,null,e.createElement(Po,{alignItems:"center"},e.createElement(pt.Z,null)),e.createElement(Po,{alignItems:"center"},e.createElement(Xt.Z,null))))}Wt.defaultProps={isSibling:!1,transparent:!1},Wt.propTypes={isSibling:n().bool,labelField:n().string.isRequired,transparent:n().bool};const Zo=U.ZP.button`
|
|
990
|
-
display: flex;
|
|
991
|
-
align-items: center;
|
|
992
|
-
height: ${({theme:t})=>t.spaces[7]};
|
|
993
|
-
|
|
994
|
-
&:last-child {
|
|
995
|
-
padding: 0 ${({theme:t})=>t.spaces[3]};
|
|
996
|
-
}
|
|
997
|
-
`,oa=(0,U.ZP)(Zo)`
|
|
998
|
-
padding: 0 ${({theme:t})=>t.spaces[3]};
|
|
999
|
-
border-right: 1px solid ${({theme:t})=>t.colors.neutral150};
|
|
1000
|
-
cursor: all-scroll;
|
|
1001
|
-
|
|
1002
|
-
svg {
|
|
1003
|
-
width: ${12/16}rem;
|
|
1004
|
-
height: ${12/16}rem;
|
|
1005
|
-
}
|
|
1006
|
-
`,um=(0,U.ZP)(Z.k)`
|
|
1007
|
-
max-height: ${32/16}rem;
|
|
1008
|
-
cursor: pointer;
|
|
1009
|
-
|
|
1010
|
-
svg {
|
|
1011
|
-
width: ${10/16}rem;
|
|
1012
|
-
height: ${10/16}rem;
|
|
1013
|
-
|
|
1014
|
-
path {
|
|
1015
|
-
fill: ${({theme:t})=>t.colors.neutral600};
|
|
1016
|
-
}
|
|
1017
|
-
}
|
|
1018
|
-
|
|
1019
|
-
&:hover {
|
|
1020
|
-
background-color: ${({theme:t})=>t.colors.primary100};
|
|
1021
|
-
border-color: ${({theme:t})=>t.colors.primary200};
|
|
1022
|
-
|
|
1023
|
-
svg {
|
|
1024
|
-
path {
|
|
1025
|
-
fill: ${({theme:t})=>t.colors.primary600};
|
|
1026
|
-
}
|
|
1027
|
-
}
|
|
1028
|
-
|
|
1029
|
-
${G.Z} {
|
|
1030
|
-
color: ${({theme:t})=>t.colors.primary600};
|
|
1031
|
-
}
|
|
1032
|
-
|
|
1033
|
-
${oa} {
|
|
1034
|
-
border-right: 1px solid ${({theme:t})=>t.colors.primary200};
|
|
1035
|
-
}
|
|
1036
|
-
}
|
|
1037
|
-
`,mm=(0,U.ZP)(W.x)`
|
|
1038
|
-
&:last-child {
|
|
1039
|
-
padding-right: ${({theme:t})=>t.spaces[3]};
|
|
1040
|
-
}
|
|
1041
|
-
`,ra=({index:t,isDraggingSibling:o,labelField:r,onClickEditField:a,onMoveField:s,onRemoveField:c,name:l,setIsDraggingSibling:d})=>{const{formatMessage:m}=(0,Q.Z)(),u=(0,e.useRef)(null),g=(0,e.useRef)(null),[,h]=(0,e.useState)(!1),p=(0,e.useRef)(),E=()=>{p.current&&p.current.click()},[,b]=(0,Vt.useDrop)({accept:f._Q.FIELD,hover(I,R){if(!g.current)return;const v=I.index,x=t;if(v===x)return;const B=g.current.getBoundingClientRect(),A=(B.right-B.left)/2,$=R.getClientOffset().x-B.left;v>x&&$>A||v<x&&$<A||(s(v,x),I.index=x)}}),[{isDragging:C},T,D]=(0,Vt.useDrag)({type:f._Q.FIELD,item(){return{index:t,labelField:r,name:l}},collect:I=>({isDragging:I.isDragging()}),end(){d(!1)}});(0,e.useEffect)(()=>{D((0,kt.rX)(),{captureDraggingState:!1})},[D]),(0,e.useEffect)(()=>{C&&d(!0)},[C,d]),(0,e.useEffect)(()=>{o||h(I=>!I)},[o]);const M={dragRef:T(u),dropRef:b(g)};return e.createElement(mm,{ref:M?M.dropRef:null},C&&e.createElement(Wt,{transparent:!0,labelField:r}),!C&&o&&e.createElement(Wt,{isSibling:!0,labelField:r}),!C&&!o&&e.createElement(um,{borderColor:"neutral150",background:"neutral100",hasRadius:!0,justifyContent:"space-between",onClick:E,isDragging:C},e.createElement(Z.k,{gap:3},e.createElement(oa,{as:"span","aria-label":m({id:(0,f.OB)("components.DraggableCard.move.field"),defaultMessage:"Move {item}"},{item:r}),onClick:I=>I.stopPropagation(),ref:M.dragRef,type:"button"},e.createElement(st.Z,null)),e.createElement(G.Z,{fontWeight:"bold"},r)),e.createElement(Z.k,{paddingLeft:3},e.createElement(Zo,{ref:p,onClick:I=>{I.stopPropagation(),a(l)},"aria-label":m({id:(0,f.OB)("components.DraggableCard.edit.field"),defaultMessage:"Edit {item}"},{item:r}),type:"button"},e.createElement(pt.Z,null)),e.createElement(Zo,{onClick:c,"data-testid":`delete-${l}`,"aria-label":m({id:(0,f.OB)("components.DraggableCard.delete.field"),defaultMessage:"Delete {item}"},{item:r}),type:"button"},e.createElement(Xt.Z,null)))))};ra.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 pm=ra;const aa=(0,U.ZP)(W.x)`
|
|
1042
|
-
flex: ${({size:t})=>t};
|
|
1043
|
-
`,gm=(0,U.ZP)(aa)`
|
|
1044
|
-
overflow-x: scroll;
|
|
1045
|
-
overflow-y: hidden;
|
|
1046
|
-
`,fm=(0,U.ZP)(aa)`
|
|
1047
|
-
max-width: ${32/16}rem;
|
|
1048
|
-
`,sa=({displayedFields:t,listRemainingFields:o,metadatas:r,onAddField:a,onClickEditField:s,onMoveField:c,onRemoveField:l})=>{const{formatMessage:d}=(0,Q.Z)(),[m,u]=(0,e.useState)(!1),[g,h]=(0,e.useState)(null),p=(0,e.useRef)();function E(...C){h("add"),a(...C)}function b(...C){h("remove"),l(...C)}return(0,e.useEffect)(()=>{g==="add"&&p?.current&&(p.current.scrollLeft=p.current.scrollWidth)},[t,g]),e.createElement(e.Fragment,null,e.createElement(W.x,{paddingBottom:4},e.createElement(G.Z,{variant:"delta",as:"h2"},d({id:(0,f.OB)("containers.SettingPage.view"),defaultMessage:"View"}))),e.createElement(Z.k,{paddingTop:4,paddingLeft:4,paddingRight:4,borderColor:"neutral300",borderStyle:"dashed",borderWidth:"1px",hasRadius:!0},e.createElement(gm,{size:"1",paddingBottom:4,ref:p},e.createElement(Z.k,{gap:3},t.map((C,T)=>e.createElement(pm,{key:C,index:T,isDraggingSibling:m,onMoveField:c,onClickEditField:s,onRemoveField:D=>b(D,T),name:C,labelField:r[C].list.label||C,setIsDraggingSibling:u})))),e.createElement(fm,{size:"auto",paddingBottom:4},e.createElement(Ve.O,{label:d({id:(0,f.OB)("components.FieldSelect.label"),defaultMessage:"Add a field"}),as:Re.h,icon:e.createElement(Rt.Z,null),disabled:o.length<=0,"data-testid":"add-field"},o.map(C=>e.createElement(Ve.s,{key:C,onClick:()=>E(C)},r[C].list.label||C))))))};sa.propTypes={displayedFields:Oe.PropTypes.array.isRequired,listRemainingFields:Oe.PropTypes.array.isRequired,metadatas:Oe.PropTypes.objectOf(Oe.PropTypes.shape({list:Oe.PropTypes.shape({label:Oe.PropTypes.string})})).isRequired,onAddField:Oe.PropTypes.func.isRequired,onClickEditField:Oe.PropTypes.func.isRequired,onMoveField:Oe.PropTypes.func.isRequired,onRemoveField:Oe.PropTypes.func.isRequired};var hm=sa;const ym=["media","richtext","dynamiczone","relation","component","json"];var Em=(t,o)=>({...t,initialData:o,modifiedData:o});const xo={fieldForm:{},fieldToEdit:"",initialData:{},modifiedData:{}};var bm=(t=xo,o)=>(0,Tn.ZP)(t,r=>{const a=["modifiedData","layouts","list"];switch(o.type){case"ADD_FIELD":{const s=k()(t,a,[]);se()(r,a,[...s,o.item]);break}case"MOVE_FIELD":{const s=k()(t,a,[]),{originalIndex:c,atIndex:l}=o;se()(r,a,(0,f.W3)(s,c,l));break}case"ON_CHANGE":{se()(r,["modifiedData",...o.keys.split(".")],o.value);break}case"ON_CHANGE_FIELD_METAS":{se()(r,["fieldForm",o.name],o.value);break}case"REMOVE_FIELD":{const s=k()(t,a,[]);se()(r,a,s.filter((c,l)=>o.index!==l));break}case"SET_FIELD_TO_EDIT":{const{fieldToEdit:s}=o;r.fieldToEdit=s,r.fieldForm.label=k()(r,["modifiedData","metadatas",s,"list","label"],""),r.fieldForm.sortable=k()(r,["modifiedData","metadatas",s,"list","sortable"],"");break}case"UNSET_FIELD_TO_EDIT":{r.fieldForm={},r.fieldToEdit="";break}case"SUBMIT_FIELD_FORM":{const s=["modifiedData","metadatas",t.fieldToEdit,"list"];se()(r,[...s,"label"],t.fieldForm.label),se()(r,[...s,"sortable"],t.fieldForm.sortable);break}default:return r}});const ia=({layout:t,slug:o})=>{const{put:r}=(0,y.kY)(),{formatMessage:a}=(0,Q.Z)(),{trackUsage:s}=(0,y.rS)(),c=(0,ae.fi)(),l=(0,y.lm)(),{refetchData:d}=(0,e.useContext)(Xe),[m,u]=(0,e.useState)(!1),g=()=>u(S=>!S),[h,p]=(0,e.useReducer)(bm,xo,()=>Em(xo,t)),{fieldToEdit:E,fieldForm:b,initialData:C,modifiedData:T}=h,D=!we()(b),{attributes:M}=t,I=T.layouts.list,R=()=>{const{settings:{pageSize:S,defaultSortBy:z,defaultSortOrder:Y},kind:N,uid:j}=C,_=`${z}:${Y}`,ne=`${(0,nn.stringify)({page:1,pageSize:S,sort:_},{encode:!1})}${c?`&${c}`:""}`;return`/content-manager/${N}/${j}?${ne}`},v=({target:{name:S,value:z}})=>{p({type:"ON_CHANGE",keys:S,value:S==="settings.pageSize"?parseInt(z,10):z})},x=async()=>{const S=sn()(T,["layouts","settings","metadatas"]);X.mutate(S)},B=S=>{p({type:"ADD_FIELD",item:S})},A=(S,z)=>{S.stopPropagation(),I.length===1?l({type:"info",message:{id:(0,f.OB)("notification.info.minimumFields")}}):p({type:"REMOVE_FIELD",index:z})},P=S=>{S.preventDefault(),g(),s("willSaveContentTypeLayout")},$=S=>{p({type:"SET_FIELD_TO_EDIT",fieldToEdit:S})},q=()=>{p({type:"UNSET_FIELD_TO_EDIT"})},L=S=>{S.preventDefault(),p({type:"SUBMIT_FIELD_FORM"}),q()},X=(0,nt.useMutation)(S=>r(`/content-manager/content-types/${o}/configuration`,S),{onSuccess(){s("didEditListSettings"),d()},onError(){l({type:"warning",message:{id:"notification.error"}})}}),{isLoading:K}=X,J=({target:{name:S,value:z}})=>{p({type:"ON_CHANGE_FIELD_METAS",name:S,value:z})},F=Object.entries(M).filter(([S,z])=>(0,f.ko)(z)&&!I.includes(S)).map(([S])=>S).sort(),w=Object.entries(M).filter(([,S])=>!ym.includes(S.type)).map(([S])=>S),O=(S,z)=>{p({type:"MOVE_FIELD",originalIndex:S,atIndex:z})};return e.createElement($e.A,null,e.createElement(Ee.o,{"aria-busy":K},e.createElement("form",{onSubmit:P},e.createElement(Ce.T,{navigationAction:e.createElement(y.rU,{startIcon:e.createElement(et.Z,null),to:R,id:"go-back"},a({id:"global.back",defaultMessage:"Back"})),primaryAction:e.createElement(le.z,{size:"S",startIcon:e.createElement(Me.Z,null),disabled:Le()(T,C),type:"submit"},a({id:"global.save",defaultMessage:"Save"})),subtitle:a({id:(0,f.OB)("components.SettingsViewWrapper.pluginHeader.description.list-settings"),defaultMessage:"Define the settings of the list view."}),title:a({id:(0,f.OB)("components.SettingsViewWrapper.pluginHeader.title"),defaultMessage:"Configure the view - {name}"},{name:xt()(T.info.displayName)})}),e.createElement(qe.D,null,e.createElement(W.x,{background:"neutral0",hasRadius:!0,shadow:"tableShadow",paddingTop:6,paddingBottom:6,paddingLeft:7,paddingRight:7},e.createElement(im,{modifiedData:T,onChange:v,sortOptions:w}),e.createElement(W.x,{paddingTop:6,paddingBottom:6},e.createElement(bt.i,null)),e.createElement(hm,{listRemainingFields:F,displayedFields:I,onAddField:B,onClickEditField:$,onMoveField:O,onRemoveField:A,metadatas:T.metadatas}))),e.createElement(y.QH,{bodyText:{id:(0,f.OB)("popUpWarning.warning.updateAllSettings"),defaultMessage:"This will modify all your settings"},iconRightButton:e.createElement(Me.Z,null),isConfirmButtonLoading:K,isOpen:m,onToggleDialog:g,onConfirm:x,variantRightButton:"success-light"})),D&&e.createElement(sm,{attributes:M,fieldForm:b,fieldToEdit:E,onChangeEditLabel:J,onCloseModal:q,onSubmit:L,type:k()(M,[E,"type"],"text")})))};ia.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 vm=(0,e.memo)(ia),Ot=i(37617);const Cm=()=>({type:Ot.ZA}),Rm=(t,o)=>({type:Ot.Id,pagination:t,data:o}),Mm=()=>({type:Ot.MP});function Tm(){return{type:Ot.c2}}const Dm=({components:t,contentType:o})=>{const{layouts:r}=o;return{contentType:o,components:t,displayedHeaders:r.list,type:Ot.Zz}},ko=t=>({type:Ot.Rp,target:t});var Fo=i(94638),la=i(99223),ca=i(6680);const da=({displayedFilters:t})=>{const[o,r]=(0,e.useState)(!1),{formatMessage:a}=(0,Q.Z)(),s=(0,e.useRef)(),{trackUsage:c}=(0,y.rS)(),l=()=>{o||c("willFilterEntries"),r(d=>!d)};return e.createElement(e.Fragment,null,e.createElement(W.x,{paddingTop:1,paddingBottom:1},e.createElement(le.z,{variant:"tertiary",ref:s,startIcon:e.createElement(Go.Z,null),onClick:l,size:"S"},a({id:"app.utils.filters",defaultMessage:"Filters"})),o&&e.createElement(y.J5,{displayedFilters:t,isVisible:o,onToggle:l,source:s})),e.createElement(y.W$,{filtersSchema:t}))};da.propTypes={displayedFilters:n().arrayOf(n().shape({name:n().string.isRequired,metadatas:n().shape({label:n().string}),fieldSchema:n().shape({type:n().string})})).isRequired};var Im=da;const Om=["json","component","media","richtext","dynamiczone","password"],Pm=["createdAt","updatedAt"];var Zm=(t,o)=>{const{allPermissions:r}=(0,y.vn)(),a=(0,y.ZT)(r,[{action:"plugin::content-manager.explorer.read",subject:o}]),s=k()(a,["0","properties","fields"],[]);return Object.keys(k()(t,["attributes"]),{}).filter(d=>{const m=k()(t,["attributes",d],{});return!(!m.type||Om.includes(m.type)||!s.includes(d)&&d!=="id"&&!Pm.includes(d))}).sort()};const ua=({contentType:t,slug:o,metadatas:r})=>{const{formatMessage:a}=(0,Q.Z)(),c=Zm(t,o).map(l=>{const d=t.attributes[l],{type:m,enum:u}=d,g={name:"didFilterEntries",properties:{useRelation:m==="relation"}},{mainField:h,label:p}=r[l].list;return{name:l,metadatas:{label:a({id:p,defaultMessage:p})},fieldSchema:{type:m,options:u,mainField:h},trackedEvent:g}});return e.createElement(Im,{displayedFilters:c})};ua.propTypes={contentType:n().object.isRequired,metadatas:n().object.isRequired,slug:n().string.isRequired};var xm=ua,km=i(70664);const ma=()=>t=>t["content-manager_listView"]||km.E,Fm=()=>(0,Mo.P1)(ma(),t=>t),pa=t=>{const{displayedHeaders:o}=t["content-manager_listView"];return o};var Sm=Fm;const ga=({area:t,...o})=>{const r=hr(t);return r?e.createElement("ul",null,r.map(a=>a.Component(o)?e.createElement(W.x,{key:a.name,padding:3,style:{textAlign:"center"}},e.createElement(a.Component,{...o})):null)):null};ga.propTypes={area:n().string.isRequired};var zt=ga;const rn=({onToggleDialog:t,isOpen:o,dialogBody:r,endAction:a})=>{const{formatMessage:s}=(0,Q.Z)();return e.createElement(Bt.V,{onClose:t,title:s({id:"app.components.ConfirmDialog.title",defaultMessage:"Confirmation"}),labelledBy:"confirmation",describedBy:"confirm-description",isOpen:o},e.createElement(Nt.a,{icon:e.createElement(Tt.Z,null)},e.createElement(Z.k,{direction:"column",alignItems:"stretch",gap:2},r)),e.createElement(jt.c,{startAction:e.createElement(le.z,{onClick:t,variant:"tertiary"},s({id:"app.components.Button.cancel",defaultMessage:"Cancel"})),endAction:a}))};rn.propTypes={isOpen:n().bool.isRequired,onToggleDialog:n().func.isRequired,dialogBody:n().node.isRequired,endAction:n().node.isRequired};const So={isConfirmButtonLoading:n().bool.isRequired,isOpen:n().bool.isRequired,onConfirm:n().func.isRequired,onToggleDialog:n().func.isRequired},fa=({isOpen:t,onToggleDialog:o,isConfirmButtonLoading:r,onConfirm:a})=>{const{formatMessage:s}=(0,Q.Z)();return e.createElement(rn,{isOpen:t,onToggleDialog:o,dialogBody:e.createElement(e.Fragment,null,e.createElement(G.Z,{id:"confirm-description",textAlign:"center"},s({id:(0,f.OB)("popUpWarning.bodyMessage.contentType.publish.all"),defaultMessage:"Are you sure you want to publish these entries?"})),e.createElement(zt,{area:"contentManager.listView.publishModalAdditionalInfos"})),endAction:e.createElement(le.z,{onClick:a,variant:"secondary",startIcon:e.createElement(Me.Z,null),loading:r},s({id:"app.utils.publish",defaultMessage:"Publish"}))})};fa.propTypes=So;const ha=({isOpen:t,onToggleDialog:o,isConfirmButtonLoading:r,onConfirm:a})=>{const{formatMessage:s}=(0,Q.Z)();return e.createElement(rn,{isOpen:t,onToggleDialog:o,dialogBody:e.createElement(e.Fragment,null,e.createElement(G.Z,{id:"confirm-description",textAlign:"center"},s({id:(0,f.OB)("popUpWarning.bodyMessage.contentType.unpublish.all"),defaultMessage:"Are you sure you want to unpublish these entries?"})),e.createElement(zt,{area:"contentManager.listView.unpublishModalAdditionalInfos"})),endAction:e.createElement(le.z,{onClick:a,variant:"secondary",startIcon:e.createElement(Me.Z,null),loading:r},s({id:"app.utils.unpublish",defaultMessage:"Unpublish"}))})};ha.propTypes=So;const ya=({isOpen:t,onToggleDialog:o,isConfirmButtonLoading:r,onConfirm:a})=>{const{formatMessage:s}=(0,Q.Z)();return e.createElement(rn,{isOpen:t,onToggleDialog:o,dialogBody:e.createElement(e.Fragment,null,e.createElement(G.Z,{id:"confirm-description",textAlign:"center"},s({id:(0,f.OB)("popUpWarning.bodyMessage.contentType.delete.all"),defaultMessage:"Are you sure you want to delete these entries?"})),e.createElement(zt,{area:"contentManager.listView.deleteModalAdditionalInfos"})),endAction:e.createElement(le.z,{onClick:a,variant:"danger-light",startIcon:e.createElement(He.Z,null),id:"confirm-delete",loading:r},s({id:"app.components.Button.confirm",defaultMessage:"Confirm"}))})};ya.propTypes=So;const Ao=({showPublish:t,showDelete:o,onConfirmDeleteAll:r,onConfirmPublishAll:a,onConfirmUnpublishAll:s,selectedEntries:c,clearSelectedEntries:l})=>{const{formatMessage:d}=(0,Q.Z)(),{trackUsage:m}=(0,y.rS)(),{data:u}=(0,de.v9)(ma()),[g,h]=(0,e.useState)(!1),[p,E]=(0,e.useState)(null),b=u.filter(A=>c.includes(A.id)),C=t&&b.some(A=>!A.publishedAt),T=t&&b.some(A=>A.publishedAt),D=()=>{p==="delete"?E(null):(E("delete"),m("willBulkDeleteEntries"))},M=()=>{p==="publish"?E(null):(E("publish"),m("willBulkPublishEntries"))},I=()=>{p==="unpublish"?E(null):(E("unpublish"),m("willBulkUnpublishEntries"))},R=async(A,P)=>{try{h(!0),await A(c),h(!1),P(),l()}catch{h(!1),P()}},v=()=>R(r,D),x=()=>R(a,M),B=()=>R(s,I);return e.createElement(e.Fragment,null,C&&e.createElement(e.Fragment,null,e.createElement(le.z,{variant:"tertiary",onClick:M},d({id:"app.utils.publish",defaultMessage:"Publish"})),e.createElement(fa,{isOpen:p==="publish",onToggleDialog:M,isConfirmButtonLoading:g,onConfirm:x})),T&&e.createElement(e.Fragment,null,e.createElement(le.z,{variant:"tertiary",onClick:I},d({id:"app.utils.unpublish",defaultMessage:"Unpublish"})),e.createElement(ha,{isOpen:p==="unpublish",onToggleDialog:I,isConfirmButtonLoading:g,onConfirm:B})),o&&e.createElement(e.Fragment,null,e.createElement(le.z,{variant:"danger-light",onClick:D},d({id:"global.delete",defaultMessage:"Delete"})),e.createElement(ya,{isOpen:p==="delete",onToggleDialog:D,isConfirmButtonLoading:g,onConfirm:v})))};Ao.defaultProps={showPublish:!1,showDelete:!1,onConfirmDeleteAll(){},onConfirmPublishAll(){},onConfirmUnpublishAll(){}},Ao.propTypes={showPublish:n().bool,showDelete:n().bool,onConfirmDeleteAll:n().func,onConfirmPublishAll:n().func,onConfirmUnpublishAll:n().func,selectedEntries:n().array.isRequired,clearSelectedEntries:n().func.isRequired};var Am=Ao;const Ea=({isConfirmButtonLoading:t,isOpen:o,onToggleDialog:r,onConfirm:a})=>{const{formatMessage:s}=(0,Q.Z)();return e.createElement(Bt.V,{onClose:r,title:s({id:"app.components.ConfirmDialog.title",defaultMessage:"Confirmation"}),labelledBy:"confirmation",describedBy:"confirm-description",isOpen:o},e.createElement(Nt.a,{icon:e.createElement(Tt.Z,null)},e.createElement(Z.k,{direction:"column",alignItems:"stretch",gap:2},e.createElement(Z.k,{justifyContent:"center"},e.createElement(G.Z,{id:"confirm-description"},s({id:"components.popUpWarning.message",defaultMessage:"Are you sure you want to delete this?"}))),e.createElement(Z.k,null,e.createElement(zt,{area:"contentManager.listView.deleteModalAdditionalInfos"})))),e.createElement(jt.c,{startAction:e.createElement(le.z,{onClick:r,variant:"tertiary"},s({id:"app.components.Button.cancel",defaultMessage:"Cancel"})),endAction:e.createElement(le.z,{onClick:a,variant:"danger-light",startIcon:e.createElement(He.Z,null),id:"confirm-delete",loading:t},s({id:"app.components.Button.confirm",defaultMessage:"Confirm"}))}))};Ea.propTypes={isConfirmButtonLoading:n().bool.isRequired,isOpen:n().bool.isRequired,onConfirm:n().func.isRequired,onToggleDialog:n().func.isRequired};const ba=({isConfirmButtonLoading:t,isOpen:o,onToggleDialog:r,onConfirm:a})=>{const{formatMessage:s}=(0,Q.Z)();return e.createElement(Bt.V,{onClose:r,title:s({id:"app.components.ConfirmDialog.title",defaultMessage:"Confirmation"}),labelledBy:"confirmation",describedBy:"confirm-description",isOpen:o},e.createElement(Nt.a,{icon:e.createElement(Tt.Z,null)},e.createElement(Z.k,{direction:"column",alignItems:"stretch",gap:2},e.createElement(Z.k,{justifyContent:"center"},e.createElement(G.Z,{id:"confirm-description"},s({id:(0,f.OB)("popUpWarning.bodyMessage.contentType.delete.all"),defaultMessage:"Are you sure you want to delete these entries?"}))),e.createElement(Z.k,null,e.createElement(zt,{area:"contentManager.listView.deleteModalAdditionalInfos"})))),e.createElement(jt.c,{startAction:e.createElement(le.z,{onClick:r,variant:"tertiary"},s({id:"app.components.Button.cancel",defaultMessage:"Cancel"})),endAction:e.createElement(le.z,{onClick:a,variant:"danger-light",startIcon:e.createElement(He.Z,null),id:"confirm-delete",loading:t},s({id:"app.components.Button.confirm",defaultMessage:"Confirm"}))}))};ba.propTypes={isConfirmButtonLoading:n().bool.isRequired,isOpen:n().bool.isRequired,onConfirm:n().func.isRequired,onToggleDialog:n().func.isRequired};const va=({layout:t})=>{const o=(0,de.I0)(),r=(0,de.v9)(pa),{trackUsage:a}=(0,y.rS)(),{formatMessage:s}=(0,Q.Z)(),c=Lm(t.contentType.attributes).map(m=>{const u=t.contentType.metadatas[m].list;return{name:m,intlLabel:{id:u.label,defaultMessage:u.label}}}),l=r.map(({name:m})=>m),d=m=>{if(a("didChangeDisplayedFields"),m.length<l.length){const u=l.filter(g=>m.indexOf(g)===-1);o(ko({name:u[0],value:!0}))}else{const u=m.filter(g=>l.indexOf(g)===-1);o(ko({name:u[0],value:!1}))}};return e.createElement(W.x,{paddingTop:1,paddingBottom:1},e.createElement(Ze.P,{"aria-label":"change displayed fields",value:l,onChange:d,customizeContent:m=>s({id:(0,f.OB)("select.currently.selected"),defaultMessage:"{count} currently selected"},{count:m.length}),multi:!0,size:"S"},c.map(m=>e.createElement(be.W,{key:m.name,value:m.name},s({id:m.intlLabel.id||m.name,defaultMessage:m.intlLabel.defaultMessage||m.name})))))};va.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};const Lm=t=>Object.keys(t).reduce((r,a)=>{const s=t[a];return(0,f.ko)(s)&&r.push(a),r},[]).sort();var wm=i(35658),$m=i(94547),Lo=i(19786),Bm=i(82884),Nm=i(47765),jm=i(59177),Wm=i(8997),zm=i(96315);const Ca=({type:t,value:o})=>{const{formatDate:r,formatTime:a,formatNumber:s}=(0,Q.Z)();let c=o;if(t==="date"&&(c=r((0,zm.Z)(o),{dateStyle:"full"})),t==="datetime"&&(c=r(o,{dateStyle:"full",timeStyle:"short"})),t==="time"){const[l,d,m]=o.split(":"),u=new Date;u.setHours(l),u.setMinutes(d),u.setSeconds(m),c=a(u,{numeric:"auto",style:"short"})}return["float","decimal"].includes(t)&&(c=s(o,{maximumFractionDigits:20})),["integer","biginteger"].includes(t)&&(c=s(o,{maximumFractionDigits:0})),Vr()(c)};Ca.propTypes={type:n().string.isRequired,value:n().any.isRequired};var Pt=Ca,Um=i(69033);const qm=(0,U.ZP)(Z.k)`
|
|
1049
|
-
position: relative;
|
|
1050
|
-
border-radius: 50%;
|
|
1051
|
-
width: 26px;
|
|
1052
|
-
height: 26px;
|
|
1053
|
-
border: 1px solid ${({theme:t})=>t.colors.neutral200};
|
|
1054
|
-
background: ${({theme:t})=>t.colors.neutral150};
|
|
1055
|
-
padding-left: 1px;
|
|
1056
|
-
|
|
1057
|
-
span {
|
|
1058
|
-
line-height: 0.6rem;
|
|
1059
|
-
font-size: 0.6rem;
|
|
1060
|
-
}
|
|
1061
|
-
`,Ra=({children:t,...o})=>e.createElement(qm,{justifyContent:"center",alignItems:"center",as:"span",...o},e.createElement(G.Z,{variant:"sigma",textColor:"neutral600"},t));Ra.propTypes={children:n().string.isRequired};var Ma=Ra;const wo=({url:t,mime:o,alternativeText:r,name:a,ext:s,formats:c})=>{const l=(0,y.CR)(t);if(o.includes("image")){const u=c?.thumbnail?.url||null,g=(0,y.CR)(u)||l;return e.createElement(Um.q,{src:g,alt:r||a,preview:!0})}const d=(0,y.mD)(s),m=a.length>100?`${a.substring(0,100)}...`:a;return e.createElement(Yt.u,{description:m},e.createElement(Ma,null,d))};wo.defaultProps={alternativeText:null,formats:null},wo.propTypes={alternativeText:n().string,ext:n().string.isRequired,formats:n().object,mime:n().string.isRequired,name:n().string.isRequired,url:n().string.isRequired};var Ta=wo,Vm=i(25898);const Da=({value:t})=>e.createElement(Vm.H,null,t.map((o,r)=>{const a=`${o.id}${r}`;if(r===3){const s=`+${t.length-3}`;return e.createElement(Ma,{key:a,preview:!1},s)}return r>3?null:e.createElement(Ta,{key:a,...o})}));Da.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 Hm=Da,Ia=i(6518),Gm=i(23866);const Qm=(0,U.ZP)(G.Z)`
|
|
1062
|
-
max-width: 500px;
|
|
1063
|
-
`,Km=async(t,o,r)=>{const{data:{results:a,pagination:s}}=await r(t);return o(),{results:a,pagination:s}},Oa=({fieldSchema:t,metadatas:o,name:r,entityId:a,value:s,contentType:c})=>{const{formatMessage:l}=(0,Q.Z)(),{notifyStatus:d}=(0,Fo.G)(),m=(0,e.useMemo)(()=>(0,f.IF)(`relations/${c.uid}/${a}/${r.split(".")[0]}`),[a,r,c]),[u,g]=(0,e.useState)(!1),{get:h}=(0,y.kY)(),p=e.createElement(Z.k,{gap:1,wrap:"nowrap"},e.createElement(Ia.C,null,s.count),l({id:"content-manager.containers.ListPage.items",defaultMessage:"{number, plural, =0 {items} one {item} other {items}}"},{number:s.count})),E=()=>{const T=l({id:(0,f.OB)("DynamicTable.relation-loaded"),defaultMessage:"Relations have been loaded"});d(T)},{data:b,status:C}=(0,nt.useQuery)([t.targetModel,a],()=>Km(m,E,h),{enabled:u,staleTime:0,select:T=>({...T,results:[...T.results].reverse()})});return e.createElement(W.x,{...y.UW},e.createElement(Ve.O,{label:p,size:"S",onOpen:()=>g(!0),onClose:()=>g(!1)},C!=="success"&&e.createElement(Ve.s,{"aria-disabled":!0},e.createElement(Gm.a,{small:!0},l({id:(0,f.OB)("DynamicTable.relation-loading"),defaultMessage:"Relations are loading"}))),C==="success"&&e.createElement(e.Fragment,null,b?.results.map(T=>e.createElement(Ve.s,{key:T.id,"aria-disabled":!0},e.createElement(Qm,{ellipsis:!0},e.createElement(Pt,{type:o.mainField.schema.type,value:T[o.mainField.name]||T.id})))),b?.pagination.total>10&&e.createElement(Ve.s,{"aria-disabled":!0,"aria-label":l({id:(0,f.OB)("DynamicTable.relation-more"),defaultMessage:"This relation contains more entities than displayed"})},e.createElement(G.Z,null,"\u2026")))))};Oa.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 Ym=Oa;const Xm=(0,U.ZP)(G.Z)`
|
|
1064
|
-
max-width: 500px;
|
|
1065
|
-
`,Pa=({metadatas:t,value:o})=>e.createElement(Xm,{textColor:"neutral800",ellipsis:!0},e.createElement(Pt,{type:t.mainField.schema.type,value:o[t.mainField.name]??o.id}));Pa.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 Jm=Pa;const _m=(0,U.ZP)(G.Z)`
|
|
1066
|
-
max-width: 500px;
|
|
1067
|
-
`,Za=({value:t,metadatas:o})=>{const{formatMessage:r}=(0,Q.Z)(),{mainField:{type:a,name:s}}=o,c=e.createElement(e.Fragment,null,e.createElement(Ia.C,null,t.length)," ",r({id:"content-manager.containers.ListPage.items",defaultMessage:"{number, plural, =0 {items} one {item} other {items}}"},{number:t.length}));return e.createElement(W.x,{...y.UW},e.createElement(Ve.O,{label:c,size:"S"},t.map(l=>e.createElement(Ve.s,{key:l.id,"aria-disabled":!0},e.createElement(_m,{ellipsis:!0},e.createElement(Pt,{type:a,value:l[s]||l.id}))))))};Za.propTypes={metadatas:n().shape({mainField:n().shape({name:n().string,type:n().string,value:n().string})}).isRequired,value:n().array.isRequired};var ep=Za;const tp=(0,U.ZP)(G.Z)`
|
|
1068
|
-
max-width: 250px;
|
|
1069
|
-
`,xa=({value:t,metadatas:o})=>{const{mainField:r}=o,a=t[r.name];return e.createElement(Yt.u,{label:a},e.createElement(tp,{textColor:"neutral800",ellipsis:!0},e.createElement(Pt,{type:r.type,value:a})))};xa.propTypes={metadatas:n().shape({mainField:n().shape({name:n().string,type:n().string,value:n().string})}).isRequired,value:n().object.isRequired};var np=xa,op=i(80022),ka=i.n(op),Fa=i(82293);function Sa(t){return["oneToOne","manyToOne","oneToOneMorph"].includes(t)}function rp(t,o,r,a){if(t==="component"){const{mainField:{name:s,type:c}}=r;if(a?.repeatable)return o.length>0;const l=o?.[s];return s==="id"&&![void 0,null].includes(l)?!0:(0,Fa.Z)(c)&&c!=="biginteger"&&s!=="id"?ka()(l):!we()(l)}return t==="relation"?Sa(a.relation)?!we()(o):o?.count>0:(0,Fa.Z)(t)&&t!=="biginteger"?ka()(o):t==="boolean"?o!==null:!we()(o)}const Aa=(0,U.ZP)(G.Z)`
|
|
1070
|
-
max-width: 300px;
|
|
1071
|
-
`,$o=({content:t,fieldSchema:o,metadatas:r,name:a,rowId:s,contentType:c})=>{const{type:l}=o;if(!rp(l,t,r,o))return e.createElement(G.Z,{textColor:"neutral800"},"-");switch(l){case"media":return o.multiple?e.createElement(Hm,{value:t}):e.createElement(Ta,{...t});case"relation":return Sa(o.relation)?e.createElement(Jm,{metadatas:r,value:t}):e.createElement(Ym,{fieldSchema:o,metadatas:r,value:t,name:a,entityId:s,contentType:c});case"component":return o.repeatable===!0?e.createElement(ep,{value:t,metadatas:r}):e.createElement(np,{value:t,metadatas:r});case"string":return e.createElement(Yt.u,{description:t},e.createElement(Aa,{ellipsis:!0,textColor:"neutral800"},e.createElement(Pt,{type:l,value:t})));default:return e.createElement(Aa,{ellipsis:!0,textColor:"neutral800"},e.createElement(Pt,{type:l,value:t}))}};$o.defaultProps={content:void 0},$o.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 ap=$o;const Bo=({canCreate:t,canDelete:o,contentType:r,headers:a,entriesToDelete:s,onClickDelete:c,onSelectRow:l,withMainAction:d,withBulkActions:m,rows:u})=>{const{push:g,location:h}=(0,ie.k6)(),{pathname:p}=h,{formatMessage:E}=(0,Q.Z)(),{post:b}=(0,y.kY)(),{trackUsage:C}=(0,y.rS)(),T=(0,ae.fi)(),{formatAPIError:D}=(0,y.So)(f.OB),M=R=>()=>{m&&(C("willEditEntryFromList"),g({pathname:`${p}/${R}`,state:{from:p},search:T}))},I=R=>async()=>{try{const{data:v}=await b(`/content-manager/collection-types/${r.uid}/auto-clone/${R}?${T}`);"id"in v&&g({pathname:`${p}/${v.id}`,state:{from:p},search:T})}catch(v){v instanceof jm.d7&&g({pathname:`${p}/create/clone/${R}`,state:{from:p,error:D(v)},search:T})}};return e.createElement(wm.p,null,u.map((R,v)=>{const x=s.includes(R.id),B=E({id:"content-manager.components.DynamicTable.row-line",defaultMessage:"item line {number}"},{number:v});return e.createElement($m.Tr,{cursor:m?"pointer":"default",key:R.id,onClick:M(R.id)},d&&e.createElement(Lo.Td,{onClick:A=>A.stopPropagation()},e.createElement(Bm.C,{"aria-label":E({id:"app.component.table.select.one-entry",defaultMessage:"Select {target}"},{target:(0,Wm.Pp)(R.firstname,R.lastname)}),checked:x,onChange:()=>{l({name:R.id,value:!x})}})),a.map(({key:A,cellFormatter:P,name:$,...q})=>e.createElement(Lo.Td,{key:A},typeof P=="function"?P(R,{key:A,name:$,...q}):e.createElement(ap,{content:R[$.split(".")[0]],name:$,contentType:r,...q,rowId:R.id}))),m&&e.createElement(Lo.Td,null,e.createElement(Z.k,{as:"span",justifyContent:"end",gap:1,onClick:A=>A.stopPropagation()},e.createElement(Re.h,{forwardedAs:Ft.rU,onClick:()=>{C("willEditEntryFromButton")},to:{pathname:`${p}/${R.id}`,state:{from:p},search:T},label:E({id:"app.component.table.edit",defaultMessage:"Edit {target}"},{target:B}),noBorder:!0},e.createElement(pt.Z,null)),t&&e.createElement(Re.h,{onClick:I(R.id),label:E({id:"app.component.table.duplicate",defaultMessage:"Duplicate {target}"},{target:B}),noBorder:!0},e.createElement(Nm.Z,null)),o&&e.createElement(Re.h,{onClick:()=>{C("willDeleteEntryFromList"),c(R.id)},label:E({id:"global.delete-target",defaultMessage:"Delete {target}"},{target:B}),noBorder:!0},e.createElement(He.Z,null)))))}))};Bo.defaultProps={canCreate:!1,canDelete:!1,entriesToDelete:[],onClickDelete(){},onSelectRow(){},rows:[],withBulkActions:!1,withMainAction:!1},Bo.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};const sp=(0,U.ZP)(W.x)`
|
|
1072
|
-
svg {
|
|
1073
|
-
path {
|
|
1074
|
-
fill: ${({theme:t})=>t.colors.neutral900};
|
|
1075
|
-
}
|
|
1076
|
-
}
|
|
1077
|
-
`;function La({canCreate:t,canDelete:o,canRead:r,canPublish:a,data:s,getData:c,getDataSucceeded:l,isLoading:d,layout:m,pagination:u,slug:g}){const{total:h}=u,{contentType:p}=m,{info:E,options:b,metadatas:C,settings:{bulkable:T,filterable:D,searchable:M}}=p,I=(0,y.lm)(),{trackUsage:R}=(0,y.rS)(),{refetchPermissions:v}=(0,y.vn)(),x=e.useRef(R),B=e.useRef(v),{notifyStatus:A}=(0,Fo.G)(),{formatAPIError:P}=(0,y.So)(f.OB),$=(0,de.v9)(Ae._);(0,y.go)();const[{query:q}]=(0,y.Kx)(),L=Kr(q),X=(0,nn.stringify)({plugins:q.plugins},{encode:!1}),{pathname:K}=(0,ie.TH)(),{push:J}=(0,ie.k6)(),{formatMessage:F}=(0,Q.Z)(),w=b?.draftAndPublish||!1,O=(0,y.kY)(),{post:S,del:z}=O,Y=(0,nt.useMutation)(ue=>S(`/content-manager/collection-types/${p.uid}/actions/bulkPublish`,ue),{onSuccess(){I({type:"success",message:{id:"content-manager.success.record.publish",defaultMessage:"Published"}}),_(`/content-manager/collection-types/${g}${L}`)},onError(ue){I({type:"warning",message:P(ue)})}}),N=(0,nt.useMutation)(ue=>S(`/content-manager/collection-types/${p.uid}/actions/bulkUnpublish`,ue),{onSuccess(){I({type:"success",message:{id:"content-manager.success.record.unpublish",defaultMessage:"Unpublished"}}),_(`/content-manager/collection-types/${g}${L}`)},onError(ue){I({type:"warning",message:P(ue)})}}),j=e.useRef(""),_=e.useCallback(async(ue,ee)=>{c();try{const pe=ee?{cancelToken:ee.token}:null,{data:{results:oe,pagination:fe}}=await O.get(ue,pe);A(F({id:(0,f.OB)("utils.data-loaded"),defaultMessage:"{number, plural, =1 {# entry has} other {# entries have}} successfully been loaded"},{number:fe.count})),l(fe,oe)}catch(pe){if(Ge.default.isCancel(pe))return;if((pe?.response?.status??null)===403){await B.current(),I({type:"info",message:{id:(0,f.OB)("permissions.not-allowed.update")}}),J("/");return}I({type:"warning",message:{id:(0,f.OB)("error.model.fetch")}})}},[F,c,l,A,J,I,O]),ne=e.useCallback(async ue=>{try{await S((0,f.IF)(`collection-types/${g}/actions/bulkDelete`),{ids:ue});const ee=(0,f.IF)(`collection-types/${g}${L}`);_(ee),x.current("didBulkDeleteEntries")}catch(ee){I({type:"warning",message:P(ee)})}},[_,L,g,I,P,S]),me=e.useCallback(async ue=>{try{await z((0,f.IF)(`collection-types/${g}/${ue}`));const ee=(0,f.IF)(`collection-types/${g}${L}`);_(ee),I({type:"success",message:{id:(0,f.OB)("success.record.delete")}})}catch(ee){I({type:"warning",message:P(ee)})}},[g,L,_,I,P,z]),V=async ue=>{const ee={validIds:[],errors:{}},pe=(0,f.Ex)(p,{components:m.components},{isDraft:!1}),fe=s.filter(je=>ue.includes(je.id)).map(je=>pe.validate(je,{abortEarly:!1}));return(await Promise.allSettled(fe)).forEach(je=>{if(je.status==="rejected"){const ct=je.reason.value.id;ee.errors[ct]=(0,y.CJ)(je.reason)}je.status==="fulfilled"&&ee.validIds.push(je.value.id)}),ee},H=async ue=>{const ee=await V(ue);if(Object.values(ee.errors).length)throw I({type:"warning",title:{id:"content-manager.listView.validation.errors.title",defaultMessage:"Action required"},message:{id:"content-manager.listView.validation.errors.message",defaultMessage:"Please make sure all fields are valid before publishing (required field, min/max character limit, etc.)"}}),new Error("Validation error");return Y.mutateAsync({ids:ue})},he=ue=>N.mutateAsync({ids:ue});e.useEffect(()=>{const ee=Ge.default.CancelToken.source(),pe=r,oe=(0,f.IF)(`collection-types/${g}${L}`);return pe&&oe.includes(j.current)&&_(oe,ee),()=>{j.current=g,ee.cancel("Operation canceled by the user.")}},[r,c,g,L,l,_]);const ve=F({id:(0,f.OB)("header.name"),defaultMessage:"Content"}),Pe=F({id:E.displayName,defaultMessage:E.displayName||ve}),{runHookWaterfall:Qe}=(0,y.j1)(),Ke=(0,de.v9)(pa),Ye=e.useMemo(()=>{const ee=Qe(Gt.No,{displayedHeaders:Ke,layout:m}).displayedHeaders.map(pe=>{const{metadatas:oe}=pe;if(pe.fieldSchema.type==="relation"){const fe=`${pe.name}.${pe.metadatas.mainField.name}`;return{...pe,metadatas:{...oe,label:F({id:(0,f.OB)(`containers.ListPage.table-headers.${pe.name}`),defaultMessage:oe.label})},name:fe}}return{...pe,metadatas:{...oe,label:F({id:(0,f.OB)(`containers.ListPage.table-headers.${pe.name}`),defaultMessage:oe.label})}}});return w?[...ee,{key:"__published_at_temp_key__",name:"publishedAt",fieldSchema:{type:"custom"},metadatas:{label:F({id:(0,f.OB)("containers.ListPage.table-headers.publishedAt"),defaultMessage:"publishedAt"}),searchable:!1,sortable:!0},cellFormatter(pe){const oe=pe.publishedAt,fe=oe?"success":"secondary";return e.createElement(Hn.q,{width:"min-content",showBullet:!1,variant:fe,size:"S"},e.createElement(G.Z,{fontWeight:"bold",textColor:`${fe}700`},F({id:(0,f.OB)(`containers.List.${oe?"published":"draft"}`),defaultMessage:oe?"Published":"Draft"})))}}]:ee},[Qe,Ke,m,w,F]),Ne=r?F({id:(0,f.OB)("pages.ListView.header-subtitle"),defaultMessage:"{number, plural, =0 {# entries} one {# entry} other {# entries}} found"},{number:h}):null,ke=ue=>t?e.createElement(le.z,{...ue,forwardedAs:Ft.rU,onClick:()=>{const ee=w?{status:"draft"}:{};x.current("willCreateEntry",ee)},to:{pathname:`${K}/create`,search:q.plugins?X:""},startIcon:e.createElement(Rt.Z,null),style:{textDecoration:"none"}},F({id:(0,f.OB)("HeaderLayout.button.label-add-entry"),defaultMessage:"Create new entry"})):null;return e.createElement(Ee.o,{"aria-busy":d},e.createElement(Ce.T,{primaryAction:ke(),subtitle:Ne,title:Pe,navigationAction:e.createElement(y.rU,{startIcon:e.createElement(et.Z,null),to:"/content-manager/"},F({id:"global.back",defaultMessage:"Back"}))}),!r&&e.createElement(la.Z,{endActions:e.createElement(Qt,{area:"contentManager.listView.actions"})}),r&&e.createElement(la.Z,{endActions:e.createElement(e.Fragment,null,e.createElement(Qt,{area:"contentManager.listView.actions"}),e.createElement(va,{layout:m}),e.createElement(y.jW,{permissions:$.contentManager.collectionTypesConfigurations},e.createElement(sp,{paddingTop:1,paddingBottom:1},e.createElement(Re.h,{onClick:()=>{R("willEditListLayout")},forwardedAs:Ft.rU,to:{pathname:`${g}/configurations/list`,search:X},icon:e.createElement(cn.Z,null),label:F({id:"app.links.configure-view",defaultMessage:"Configure the view"})})))),startActions:e.createElement(e.Fragment,null,M&&e.createElement(y.m,{label:F({id:"app.component.search.label",defaultMessage:"Search for {target}"},{target:Pe}),placeholder:F({id:"global.search",defaultMessage:"Search"}),trackedEvent:"didSearch"}),D&&e.createElement(xm,{contentType:p,slug:g,metadatas:C}))}),e.createElement(qe.D,null,r?e.createElement(Z.k,{gap:4,direction:"column",alignItems:"stretch"},e.createElement(y.tM,{canCreate:t,canDelete:o,canPublish:a,contentTypeName:Pe,onConfirmDelete:me,onConfirmDeleteAll:ne,onConfirmPublishAll:H,onConfirmUnpublishAll:he,isBulkable:T,isLoading:d,layout:m,rows:s,components:{ConfirmDialogDelete:Ea,ConfirmDialogDeleteAll:ba},contentType:Pe,action:ke({variant:"secondary"}),headers:Ye,onOpenDeleteAllModalTrackedEvent:"willBulkDeleteEntries",withBulkActions:!0,withMainAction:o&&T,renderBulkActionsBar:({selectedEntries:ue,clearSelectedEntries:ee})=>e.createElement(Am,{showPublish:a&&w,showDelete:o,onConfirmDeleteAll:ne,onConfirmPublishAll:H,onConfirmUnpublishAll:he,selectedEntries:ue,clearSelectedEntries:ee}),bulkAction:!0},e.createElement(Bo,{canCreate:t,canDelete:o,contentType:p,headers:Ye,rows:s,withBulkActions:!0,withMainAction:o&&T})),e.createElement(Z.k,{alignItems:"flex-end",justifyContent:"space-between"},e.createElement(y.v4,{trackedEvent:"willChangeNumberOfEntriesPerPage"}),e.createElement(y.tU,{pagination:{pageCount:u?.pageCount||1}}))):e.createElement(y.ZF,null)))}La.propTypes={canCreate:n().bool.isRequired,canDelete:n().bool.isRequired,canRead:n().bool.isRequired,canPublish:n().bool.isRequired,data:n().array.isRequired,layout:n().exact({components:n().object.isRequired,contentType:n().shape({uid:n().string.isRequired,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 ip=Sm();function lp(t){return(0,ca.bindActionCreators)({getData:Cm,getDataSucceeded:Rm,onChangeListHeaders:ko,onResetListHeaders:Mm},t)}const cp=(0,de.$j)(ip,lp);var dp=(0,ca.compose)(cp)(e.memo(La,Le()));const No=t=>{const o=(0,e.useMemo)(()=>(0,f.TA)(t.slug),[t.slug]),{isLoading:r,allowedActions:a}=(0,y.ss)(o,t.permissions);return r?e.createElement(y.dO,null):e.createElement(dp,{...t,...a})};No.defaultProps={permissions:[]},No.propTypes={permissions:n().array,slug:n().string.isRequired};var up=(0,e.memo)(No,(t,o)=>{const r=(0,y.e5)(t,o);return Object.keys(r).filter(s=>s!=="state").length>0});const wa=({layout:t,...o})=>{const r=(0,de.I0)(),{replace:a}=(0,ie.k6)(),[{query:s,rawQuery:c}]=(0,y.Kx)(),l=(0,ae.r5)(s,o.slug,"listView"),d=(0,ae.Ky)(o.slug);return(0,e.useEffect)(()=>{c||a(d)},[c,a,d]),(0,e.useEffect)(()=>{r(Dm(t))},[r,t]),(0,e.useEffect)(()=>()=>{r(Tm())},[r]),l?e.createElement(up,{...o,layout:t,permissions:l}):null};wa.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 mp=wa,pp=()=>e.createElement(W.x,{padding:8},e.createElement(y.Hn,null));const $a=({match:{params:{slug:t},url:o}})=>{const r=(0,de.v9)(Ae._),{isLoading:a,layout:s,updateLayout:c}=(0,ae.zE)(t),{rawContentTypeLayout:l,rawComponentsLayouts:d}=(0,e.useMemo)(()=>{let h={},p={};return s.contentType&&(h=(0,f.du)(s.contentType)),s.components&&(p=Object.keys(s.components).reduce((E,b)=>(E[b]=(0,f.du)(s.components[b]),E),{})),{rawContentTypeLayout:h,rawComponentsLayouts:p}},[s]);if((s?.contentType?.uid??null)!==t||a)return e.createElement(y.dO,null);const u=({location:{state:h},history:{goBack:p},match:{params:{id:E,origin:b}}},C)=>e.createElement(C,{slug:t,layout:s,state:h,goBack:p,id:E,origin:b}),g=[{path:"create/clone/:origin",comp:on},{path:"create",comp:on},{path:":id",comp:on},{path:"",comp:mp}].map(({path:h,comp:p})=>e.createElement(ie.AW,{key:h,path:`${o}/${h}`,render:E=>u(E,p)}));return e.createElement(Je.ErrorBoundary,{FallbackComponent:pp},e.createElement(ut.Provider,{value:s},e.createElement(ie.rs,null,e.createElement(ie.AW,{path:`${o}/configurations/list`},e.createElement(y.O4,{permissions:r.contentManager.collectionTypesConfigurations},e.createElement(vm,{layout:l,slug:t,updateLayout:c}))),e.createElement(ie.AW,{path:`${o}/configurations/edit`},e.createElement(y.O4,{permissions:r.contentManager.collectionTypesConfigurations},e.createElement(On,{components:d,isContentTypeView:!0,mainLayout:l,slug:t,updateLayout:c}))),g)))};$a.propTypes={match:n().shape({url:n().string.isRequired,params:n().shape({slug:n().string.isRequired}).isRequired}).isRequired};var gp=(0,e.memo)($a),Ba=i(57678);const fp=()=>{const[{isLoading:t,data:o},r]=(0,e.useReducer)(Ba.Z,Ba.q),a=(0,e.useMemo)(Ct.Vo,[]),{schemas:s}=(0,de.v9)(m=>a(m),de.wU),c=(0,de.v9)(Ae._),{uid:l}=(0,ie.UO)(),{get:d}=(0,y.kY)();return(0,e.useEffect)(()=>{const u=Ge.default.CancelToken.source();return(async h=>{try{r(Kt());const{data:{data:p}}=await d(`/content-manager/components/${l}/configuration`,{cancelToken:h.token});r(Pn((0,f.w8)(p,s,"component")))}catch(p){if(Ge.default.isCancel(p))return;console.error(p)}})(u),()=>{u.cancel("Operation canceled by the user.")}},[l,s,d]),t?e.createElement(y.dO,null):e.createElement(y.O4,{permissions:c.contentManager.componentsConfigurations},e.createElement(On,{components:o.components,mainLayout:o.component,slug:l}))};var hp=(0,e.memo)(fp),yp=i(9695),Ep=i(54725),bp=()=>{const{formatMessage:t}=(0,Q.Z)();return(0,y.go)(),e.createElement(Ee.o,null,e.createElement(Ce.T,{title:t({id:(0,f.OB)("header.name"),defaultMessage:"Content"})}),e.createElement(qe.D,null,e.createElement(yp.x,{action:e.createElement(y.Qj,{variant:"secondary",startIcon:e.createElement(Rt.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(Ep.Z,{width:"10rem"}),shadow:"tableShadow"})))},vp=()=>{const{formatMessage:t}=(0,Q.Z)();return(0,y.go)(),e.createElement(Ee.o,null,e.createElement(Ce.T,{title:t({id:(0,f.OB)("header.name"),defaultMessage:"Content"})}),e.createElement(qe.D,null,e.createElement(y.ZF,null)))};const Na=({match:{params:{slug:t},url:o}})=>{const r=(0,de.v9)(Ae._),{isLoading:a,layout:s,updateLayout:c}=(0,ae.zE)(t),{rawContentTypeLayout:l,rawComponentsLayouts:d}=(0,e.useMemo)(()=>{let m={},u={};return s.contentType&&(u=(0,f.du)(s.contentType)),s.components&&(m=Object.keys(s.components).reduce((g,h)=>(g[h]=(0,f.du)(s.components[h]),g),{})),{rawContentTypeLayout:u,rawComponentsLayouts:m}},[s]);return a?e.createElement(y.dO,null):e.createElement(ut.Provider,{value:s},e.createElement(ie.rs,null,e.createElement(ie.AW,{path:`${o}/configurations/edit`},e.createElement(y.O4,{permissions:r.contentManager.singleTypesConfigurations},e.createElement(On,{components:d,isContentTypeView:!0,mainLayout:l,slug:t,updateLayout:c}))),e.createElement(ie.AW,{path:o,render:({location:{state:m},history:{goBack:u}})=>e.createElement(on,{layout:s,slug:t,isSingleType:!0,state:m,goBack:u})})))};Na.propTypes={match:n().shape({url:n().string.isRequired,params:n().shape({slug:n().string.isRequired}).isRequired}).isRequired};var Cp=(0,e.memo)(Na),Rp=i(16899);const Mp=(0,U.ZP)(Z.k)`
|
|
1078
|
-
border-radius: 50%;
|
|
1079
|
-
|
|
1080
|
-
svg {
|
|
1081
|
-
height: ${6/16}rem;
|
|
1082
|
-
width: ${11/16}rem;
|
|
1083
|
-
> path {
|
|
1084
|
-
fill: ${({theme:t})=>t.colors.neutral600};
|
|
1085
|
-
}
|
|
1086
|
-
}
|
|
1087
|
-
`,Tp=U.ZP.button`
|
|
1088
|
-
border: none;
|
|
1089
|
-
background: transparent;
|
|
1090
|
-
display: block;
|
|
1091
|
-
width: 100%;
|
|
1092
|
-
text-align: unset;
|
|
1093
|
-
padding: 0;
|
|
1094
|
-
`;function ja({displayedValue:t}){return e.createElement(Z.k,{background:"neutral0",borderColor:"neutral200",justifyContent:"space-between",gap:3,padding:3,width:(0,y.Q1)(300)},e.createElement(Tp,{type:"button"},e.createElement(Z.k,{gap:6},e.createElement(Mp,{alignItems:"center",justifyContent:"center",background:"neutral200",height:(0,y.Q1)(32),width:(0,y.Q1)(32)},e.createElement(Rp.Z,null)),e.createElement(Z.k,{maxWidth:(0,y.Q1)(150)},e.createElement(G.Z,{textColor:"neutral700",ellipsis:!0},t)))),e.createElement(Z.k,{gap:2},e.createElement(Re.h,{noBorder:!0},e.createElement(He.Z,null)),e.createElement(Re.h,{noBorder:!0},e.createElement(st.Z,null))))}ja.propTypes={displayedValue:n().string.isRequired};const Wa=({status:t,displayedValue:o,width:r})=>{const{formatMessage:a}=(0,Q.Z)(),s={[ht.DRAFT]:a({id:(0,f.OB)("relation.publicationState.draft"),defaultMessage:"Draft"}),[ht.PUBLISHED]:a({id:(0,f.OB)("relation.publicationState.published"),defaultMessage:"Published"})},c=t===ht.DRAFT?"secondary":"success";return e.createElement(W.x,{style:{width:r}},e.createElement(Z.k,{paddingTop:2,paddingBottom:2,paddingLeft:2,paddingRight:4,hasRadius:!0,borderSize:1,background:"neutral0",borderColor:"neutral200",justifyContent:"space-between"},e.createElement(xr,{gap:1},e.createElement(Re.h,{noBorder:!0},e.createElement(st.Z,null)),e.createElement(kr,{maxWidth:"100%",justifyContent:"space-between"},e.createElement(W.x,{minWidth:0,paddingTop:1,paddingBottom:1,paddingRight:4},e.createElement(Fr,null,e.createElement(G.Z,{textColor:"primary600",ellipsis:!0},o))),t&&e.createElement(Hn.q,{variant:c,showBullet:!1,size:"S"},e.createElement(G.Z,{fontWeight:"bold",textColor:`${c}700`},s[t])))),e.createElement(W.x,{paddingLeft:4},e.createElement(Sr,{type:"button"},e.createElement(dn.J,{width:"12px",as:Xt.Z})))))};Wa.propTypes={status:n().string.isRequired,displayedValue:n().string.isRequired,width:n().number.isRequired};var Dp=i(90700),Ip=i(78090),Op=i(77013),Pp=i(79318),Zp=i(66618),xp=()=>{const[t,o]=(0,e.useState)(""),{formatMessage:r,locale:a}=(0,Q.Z)(),s=(0,e.useMemo)(Ct.KQ,[]),{collectionTypeLinks:c,singleTypeLinks:l}=(0,de.v9)(s,de.wU),{startsWith:d}=(0,y.L0)(a,{sensitivity:"base"}),m=(0,y.Xe)(a,{sensitivity:"base"}),u=(0,e.useMemo)(()=>[{id:"collectionTypes",title:{id:(0,Te.Z)("components.LeftMenu.collection-types"),defaultMessage:"Collection Types"},searchable:!0,links:c},{id:"singleTypes",title:{id:(0,Te.Z)("components.LeftMenu.single-types"),defaultMessage:"Single Types"},searchable:!0,links:l}].map(E=>({...E,links:E.links.filter(b=>d(b.title,t)).sort((b,C)=>m.compare(b.title,C.title)).map(b=>({...b,title:r({id:b.title,defaultMessage:b.title})}))})),[c,t,l,d,r,m]),g=()=>{o("")},h=({target:{value:E}})=>{o(E)},p=r({id:(0,Te.Z)("header.name"),defaultMessage:"Content"});return e.createElement(Dp.m,{ariaLabel:p},e.createElement(Ip.p,{label:p,searchable:!0,value:t,onChange:h,onClear:g,searchLabel:r({id:"content-manager.components.LeftMenu.Search.label",defaultMessage:"Search for a content type"})}),e.createElement(Op.Z,null,u.map(E=>{const b=r({id:E.title.id,defaultMessage:E.title.defaultMessage},E.title.values);return e.createElement(Pp.D,{key:E.id,label:b,badgeLabel:E.links.length.toString()},E.links.map(C=>{const T=C.search?`?${C.search}`:"";return e.createElement(Zp.E,{as:Ft.OL,key:C.uid,to:`${C.to}${T}`},C.title)}))})))},jo=i(92886);const kp=()=>({type:jo.fn}),Fp=()=>({type:jo.sZ}),Sp=({authorizedCollectionTypeLinks:t,authorizedSingleTypeLinks:o,contentTypeSchemas:r,components:a,fieldSizes:s})=>({type:jo.IX,data:{authorizedCollectionTypeLinks:t,authorizedSingleTypeLinks:o,components:a,contentTypeSchemas:r,fieldSizes:s}});var za=(t,o)=>o.map(({permissions:r})=>(0,y.qX)(t,r)),Ap=i(81346),Lp=i.n(Ap);const Ua=(t,o,r=[])=>t.filter(a=>a.isDisplayed).map(a=>{const s=[{action:"plugin::content-manager.explorer.create",subject:a.uid},{action:"plugin::content-manager.explorer.read",subject:a.uid}],c=[{action:"plugin::content-manager.explorer.read",subject:a.uid}],l=o==="collectionTypes"?s:c,d=r.find(({uid:u})=>u===a.uid);let m=null;if(d){const u={page:1,pageSize:d.settings.pageSize,sort:`${d.settings.defaultSortBy}:${d.settings.defaultSortOrder}`};m=(0,nn.stringify)(u,{encode:!1})}return{permissions:l,search:m,kind:a.kind,title:a.info.displayName,to:`/content-manager/${a.kind}/${a.uid}`,uid:a.uid,name:a.uid,isDisplayed:a.isDisplayed}});var wp=(t,o)=>{const r=Object.entries(Lp()(t,"kind")).map(([c,l])=>({name:c,links:l})),[a,s]=rt()(r,"name");return{collectionTypeSectionLinks:Ua(a?.links||[],"collectionTypes",o),singleTypeSectionLinks:Ua(s?.links??[],"singleTypes")}},$p=async({models:t,userPermissions:o,toggleNotification:r})=>{const{get:a}=(0,y.tg)();try{const{data:{data:s}}=await a((0,f.IF)("content-types-settings")),{collectionTypeSectionLinks:c,singleTypeSectionLinks:l}=wp(t,s),d=await Promise.all(za(o,c)),m=c.filter((h,p)=>d[p]),u=await Promise.all(za(o,l)),g=l.filter((h,p)=>u[p]);return{authorizedCollectionTypeLinks:m,authorizedSingleTypeLinks:g}}catch(s){return console.error(s),r({type:"warning",message:{id:"notification.error"}}),{authorizedCollectionTypeLinks:[],authorizedSingleTypeLinks:[]}}},Bp=()=>{const t=(0,de.I0)(),o=(0,y.lm)(),r=(0,de.v9)((0,Ct.Yg)()),a=(0,e.useRef)(),{allPermissions:s}=(0,y.vn)(),{runHookWaterfall:c}=(0,y.j1)(),d=Ge.default.CancelToken.source(),{notifyStatus:m}=(0,Fo.G)(),{formatMessage:u}=(0,Q.Z)(),{get:g}=(0,y.kY)(),h=async()=>{t(kp());try{const{data:{data:{components:p,contentTypes:E,fieldSizes:b}}}=await g("/content-manager/init",{cancelToken:d.token});m(u({id:(0,f.OB)("App.schemas.data-loaded"),defaultMessage:"The schemas have been successfully loaded."}));const C=await $p({models:E,userPermissions:s,toggleNotification:o}),{ctLinks:T}=c(Gt.LK,{ctLinks:C.authorizedCollectionTypeLinks,models:E}),{stLinks:D}=c(Gt.dV,{stLinks:C.authorizedSingleTypeLinks,models:E}),M=Sp({authorizedCollectionTypeLinks:T,authorizedSingleTypeLinks:D,contentTypeSchemas:E,components:p,fieldSizes:b});t(M)}catch(p){if(Ge.default.isCancel(p))return;console.error(p),o({type:"warning",message:{id:"notification.error"}})}};return a.current=h,(0,e.useEffect)(()=>(a.current(),()=>{d.cancel("Operation canceled by the user."),t(Fp())}),[t,o]),{...r,refetchData:a.current}};function Np({type:t,item:o}){if([at.Z.EDIT_FIELD,at.Z.FIELD].includes(t))return e.createElement(Wt,{labelField:o.labelField});const[r]=t.split("_");switch(r){case at.Z.COMPONENT:case at.Z.DYNAMIC_ZONE:return e.createElement(ja,{displayedValue:o.displayedValue});case at.Z.RELATION:return e.createElement(Wa,{displayedValue:o.displayedValue,status:o.status,width:o.width});default:return null}}const qa=()=>{const t=(0,ie.$B)("/content-manager/:kind/:uid"),{status:o,collectionTypeLinks:r,singleTypeLinks:a,models:s,refetchData:c}=Bp(),l=rt()([...r,...a],E=>E.title.toLowerCase()),{pathname:d}=(0,ie.TH)(),{formatMessage:m}=(0,Q.Z)(),{startSection:u}=(0,y.c1)(),g=(0,e.useRef)(u),h=(0,de.v9)(Ae._);if((0,e.useEffect)(()=>{g.current&&g.current("contentManager")},[]),o==="loading")return e.createElement(Ee.o,{"aria-busy":"true"},e.createElement(Ce.T,{title:m({id:(0,Te.Z)("header.name"),defaultMessage:"Content"})}),e.createElement(y.dO,null));const p=s.filter(({isDisplayed:E})=>E);return l.length===0&&p.length>0&&d!=="/content-manager/403"?e.createElement(ie.l_,{to:"/content-manager/403"}):p.length===0&&d!=="/content-manager/no-content-types"?e.createElement(ie.l_,{to:"/content-manager/no-content-types"}):!t&&l.length>0?e.createElement(ie.l_,{to:`${l[0].to}${l[0].search?`?${l[0].search}`:""}`}):e.createElement($e.A,{sideNav:e.createElement(xp,null)},e.createElement(Se.r,{renderItem:Np}),e.createElement(Xe.Provider,{value:{refetchData:c}},e.createElement(ie.rs,null,e.createElement(ie.AW,{path:"/content-manager/components/:uid/configurations/edit"},e.createElement(y.O4,{permissions:h.contentManager.componentsConfigurations},e.createElement(hp,null))),e.createElement(ie.AW,{path:"/content-manager/collectionType/:slug",component:gp}),e.createElement(ie.AW,{path:"/content-manager/singleType/:slug",component:Cp}),e.createElement(ie.AW,{path:"/content-manager/403"},e.createElement(vp,null)),e.createElement(ie.AW,{path:"/content-manager/no-content-types"},e.createElement(bp,null)),e.createElement(ie.AW,{path:"",component:y.Hn}))))};function jp(){const{formatMessage:t}=(0,Q.Z)();return e.createElement(e.Fragment,null,e.createElement(Ue.q,{title:t({id:(0,Te.Z)("plugin.name"),defaultMessage:"Content Manager"})}),e.createElement(qa,null))}},92914:function(qt,We,i){"use strict";i.d(We,{Z:function(){return Zt}});var e=i(32735),Ee=i(87933),Ce=i(49372),$e=i(72850),y=i(9026),ze=i(19565),rt=i(60216),Ue=i.n(rt),Q=i(67879),de=i(8997),ie=i(51375);const Se=60*1e3,Ae=Se*60,dt=Ae*24,Xe=dt*30,Te=dt*365;var Oe=ae=>ae<Se?{unit:"second",value:-Math.round(ae/1e3)}:ae<Ae?{unit:"minute",value:-Math.round(ae/Se)}:ae<dt?{unit:"hour",value:-Math.round(ae/Ae)}:ae<Xe?{unit:"day",value:-Math.round(ae/dt)}:ae<Te?{unit:"month",value:-Math.round(ae/Xe)}:{unit:"year",value:-Math.round(ae/Te)};const n=()=>{const{formatMessage:ae}=(0,Q.Z)();return e.createElement(Ee.k,{direction:"column",alignItems:"stretch",gap:2},e.createElement(Ce.Z,{variant:"sigma",textColor:"neutral600",id:"additional-information"},ae({id:(0,ie.OB)("containers.Edit.information"),defaultMessage:"Information"})),e.createElement($e.x,null,e.createElement(y.i,null)))},Je=({label:ae,value:f})=>e.createElement(Ee.k,{justifyContent:"space-between"},e.createElement(Ce.Z,{as:"dt",fontWeight:"bold",textColor:"neutral800",variant:"pi"},ae),e.createElement(Ce.Z,{as:"dd",variant:"pi",textColor:"neutral600"},f));Je.propTypes={label:Ue().string.isRequired,value:Ue().string.isRequired};const _e=()=>{const{formatMessage:ae,formatRelativeTime:f}=(0,Q.Z)(),{initialData:le,isCreatingEntry:qe}=(0,ze.Wq)(),W=(0,e.useRef)(Date.now()),Z=(ye,Ze)=>{const{firstname:be,lastname:bt,username:et}=le[Ze]??{},Me=be??"",tt=bt??"",Ie=et??(0,de.Pp)(Me,tt),mt=(le[ye]?new Date(le[ye]).getTime():Date.now())-W.current,{unit:an,value:k}=Oe(-mt);return{at:f(k,an,{numeric:"auto"}),by:qe?"-":Ie}},G=Z("updatedAt","updatedBy"),De=Z("createdAt","createdBy");return e.createElement(Ee.k,{direction:"column",alignItems:"stretch",gap:4},e.createElement(Ee.k,{direction:"column",alignItems:"stretch",gap:2,as:"dl"},e.createElement(Je,{label:ae({id:(0,ie.OB)("containers.Edit.information.created"),defaultMessage:"Created"}),value:De.at}),e.createElement(Je,{label:ae({id:(0,ie.OB)("containers.Edit.information.by"),defaultMessage:"By"}),value:De.by})),e.createElement(Ee.k,{direction:"column",alignItems:"stretch",gap:2,as:"dl"},e.createElement(Je,{label:ae({id:(0,ie.OB)("containers.Edit.information.lastUpdate"),defaultMessage:"Last update"}),value:G.at}),e.createElement(Je,{label:ae({id:(0,ie.OB)("containers.Edit.information.by"),defaultMessage:"By"}),value:G.by})))},ut=({children:ae})=>e.createElement(Ee.k,{direction:"column",alignItems:"stretch",gap:4},ae);ut.propTypes={children:Ue().oneOfType([Ue().arrayOf(Ue().node),Ue().node]).isRequired};var Zt={Root:ut,Title:n,Body:_e}},73710:function(qt,We,i){"use strict";i.d(We,{Z:function(){return $e}});var e=i(32735),Ee=i(92914);function Ce(){return e.createElement(Ee.Z.Root,null,e.createElement(Ee.Z.Title,null),e.createElement(Ee.Z.Body,null))}var $e=Ce},75536:function(qt,We,i){"use strict";var e=i(32735);const Ee=(Ce,$e)=>{const[y,ze]=(0,e.useState)(Ce);return(0,e.useEffect)(()=>{const rt=setTimeout(()=>{ze(Ce)},$e);return()=>{clearTimeout(rt)}},[Ce,$e]),y};We.Z=Ee},28243:function(qt,We,i){"use strict";i.d(We,{Z:function(){return dt}});var e=i(32735),Ee=i(77035),Ce=i(87933),$e=i(49372),y=i(23866),ze=i(19565),rt=i(67879),Ue=i(20108),Q=i(92914),de=i(67350),ie=i(54504);const Se="strapi_reviewWorkflows_stage";function Ae(){const{initialData:Xe,isCreatingEntry:Te,layout:{uid:at},isSingleType:Oe,onChange:n}=(0,ze.Wq)(),{put:Je}=(0,ze.kY)(),_e=Xe?.[Se]??null,ut=Object.prototype.hasOwnProperty.call(Xe,Se),{formatMessage:Zt}=(0,rt.Z)(),{formatAPIError:ae}=(0,ze.So)(),f=(0,ze.lm)(),{workflows:le,isLoading:qe}=(0,de.n)(),W=le?.[0]??null,{error:Z,isLoading:G,mutateAsync:De}=(0,Ue.useMutation)(async({entityId:Me,stageId:tt,uid:Ie})=>{const vt=Oe?"single-types":"collection-types",{data:{data:mt}}=await Je(`/admin/content-manager/${vt}/${Ie}/${Me}/stage`,{data:{id:tt}});return n({target:{name:Se,value:mt[Se]}},!0),mt},{onSuccess(){f({type:"success",message:{id:"content-manager.reviewWorkflows.stage.notification.saved",defaultMessage:"Review stage updated"}})}}),ye=_e===null&&!qe&&!Te&&Zt({id:"content-manager.reviewWorkflows.stage.select.placeholder",defaultMessage:"Select a stage"}),be=Z&&ae(Z)||ye||null,bt=async({value:Me})=>{try{await De({entityId:Xe.id,stageId:Me,uid:at})}catch{}},{themeColorName:et}=_e?.color?(0,ie.k)(_e?.color):{};return e.createElement(Q.Z.Root,null,e.createElement(Q.Z.Title,null),ut&&!Te&&e.createElement(Ee.q4,{error:be,name:Se,id:Se,value:_e?.id,onChange:Me=>bt({value:Me}),label:Zt({id:"content-manager.reviewWorkflows.stage.label",defaultMessage:"Review stage"}),startIcon:e.createElement(Ce.k,{as:"span",height:2,background:_e?.color,borderColor:et==="neutral0"?"neutral150":"transparent",hasRadius:!0,shrink:0,width:2,marginRight:"-3px"}),customizeContent:()=>e.createElement(Ce.k,{as:"span",justifyContent:"space-between",alignItems:"center",width:"100%"},e.createElement($e.Z,{textColor:"neutral800",ellipsis:!0},_e?.name),G?e.createElement(y.a,{small:!0,style:{display:"flex"}}):null)},W?W.stages.map(({id:Me,color:tt,name:Ie})=>{const{themeColorName:vt}=(0,ie.k)(tt);return e.createElement(Ee.ag,{startIcon:e.createElement(Ce.k,{height:2,background:tt,borderColor:vt==="neutral0"?"neutral150":"transparent",hasRadius:!0,shrink:0,width:2}),value:Me,textValue:Ie},Ie)}):[]),e.createElement(Q.Z.Body,null))}var dt=Ae},57544:function(){},59599:function(){},42310:function(){},33842:function(){},85695:function(){}}]);
|