@strapi/admin 4.3.6 → 4.4.0-alpha.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/admin/src/StrapiApp.js +4 -12
- package/admin/src/components/Providers/index.js +14 -10
- package/admin/src/content-manager/components/FieldTypeIcon/index.js +31 -1
- package/admin/src/content-manager/components/Inputs/index.js +30 -10
- package/admin/src/content-manager/pages/EditSettingsView/components/FormModal.js +7 -2
- package/admin/src/content-manager/pages/EditSettingsView/index.js +2 -1
- package/admin/src/content-manager/pages/EditView/index.js +91 -84
- package/admin/src/core/apis/CustomFields.js +80 -0
- package/admin/src/core/apis/index.js +1 -0
- package/build/524.2437fb56.chunk.js +644 -0
- package/build/{Admin-authenticatedApp.350ee81d.chunk.js → Admin-authenticatedApp.aaa66872.chunk.js} +3 -3
- package/build/{admin-app.05edc328.chunk.js → admin-app.1f9e13f8.chunk.js} +16 -16
- package/build/content-manager.86f7594d.chunk.js +1178 -0
- package/build/content-type-builder-list-view.9b874fd4.chunk.js +194 -0
- package/build/content-type-builder-translation-en-json.f985c9c4.chunk.js +1 -0
- package/build/content-type-builder.47ab07ad.chunk.js +145 -0
- package/build/index.html +1 -1
- package/build/{main.f220d4d1.js → main.7db3414f.js} +1181 -1181
- package/build/{runtime~main.14842096.js → runtime~main.c1c5510b.js} +2 -2
- package/package.json +6 -6
- package/build/611.aa894d27.chunk.js +0 -158
- package/build/content-manager.62390771.chunk.js +0 -1178
- package/build/content-type-builder-list-view.76a69473.chunk.js +0 -194
- package/build/content-type-builder-translation-en-json.201bfb78.chunk.js +0 -1
- package/build/content-type-builder.42cecba9.chunk.js +0 -142
|
@@ -1,1178 +0,0 @@
|
|
|
1
|
-
(self.webpackChunk_strapi_admin=self.webpackChunk_strapi_admin||[]).push([[994],{37475:(yc,st)=>{var p=function(){var r={trace:function(){},yy:{},symbols_:{error:2,JSONString:3,STRING:4,JSONNumber:5,NUMBER:6,JSONNullLiteral:7,NULL:8,JSONBooleanLiteral:9,TRUE:10,FALSE:11,JSONText:12,JSONValue:13,EOF:14,JSONObject:15,JSONArray:16,"{":17,"}":18,JSONMemberList:19,JSONMember:20,":":21,",":22,"[":23,"]":24,JSONElementList:25,$accept:0,$end:1},terminals_:{2:"error",4:"STRING",6:"NUMBER",8:"NULL",10:"TRUE",11:"FALSE",14:"EOF",17:"{",18:"}",21:":",22:",",23:"[",24:"]"},productions_:[0,[3,1],[5,1],[7,1],[9,1],[9,1],[12,2],[13,1],[13,1],[13,1],[13,1],[13,1],[13,1],[15,2],[15,3],[20,3],[19,1],[19,3],[16,2],[16,3],[25,1],[25,3]],performAction:function(y,X,oe,A,Ee,ae,De){var pe=ae.length-1;switch(Ee){case 1:this.$=y.replace(/\\(\\|")/g,"$1").replace(/\\n/g,`
|
|
2
|
-
`).replace(/\\r/g,"\r").replace(/\\t/g," ").replace(/\\v/g,"\v").replace(/\\f/g,"\f").replace(/\\b/g,"\b");break;case 2:this.$=Number(y);break;case 3:this.$=null;break;case 4:this.$=!0;break;case 5:this.$=!1;break;case 6:return this.$=ae[pe-1];case 13:this.$={};break;case 14:this.$=ae[pe-1];break;case 15:this.$=[ae[pe-2],ae[pe]];break;case 16:this.$={},this.$[ae[pe][0]]=ae[pe][1];break;case 17:this.$=ae[pe-2],ae[pe-2][ae[pe][0]]=ae[pe][1];break;case 18:this.$=[];break;case 19:this.$=ae[pe-1];break;case 20:this.$=[ae[pe]];break;case 21:this.$=ae[pe-2],ae[pe-2].push(ae[pe]);break}},table:[{3:5,4:[1,12],5:6,6:[1,13],7:3,8:[1,9],9:4,10:[1,10],11:[1,11],12:1,13:2,15:7,16:8,17:[1,14],23:[1,15]},{1:[3]},{14:[1,16]},{14:[2,7],18:[2,7],22:[2,7],24:[2,7]},{14:[2,8],18:[2,8],22:[2,8],24:[2,8]},{14:[2,9],18:[2,9],22:[2,9],24:[2,9]},{14:[2,10],18:[2,10],22:[2,10],24:[2,10]},{14:[2,11],18:[2,11],22:[2,11],24:[2,11]},{14:[2,12],18:[2,12],22:[2,12],24:[2,12]},{14:[2,3],18:[2,3],22:[2,3],24:[2,3]},{14:[2,4],18:[2,4],22:[2,4],24:[2,4]},{14:[2,5],18:[2,5],22:[2,5],24:[2,5]},{14:[2,1],18:[2,1],21:[2,1],22:[2,1],24:[2,1]},{14:[2,2],18:[2,2],22:[2,2],24:[2,2]},{3:20,4:[1,12],18:[1,17],19:18,20:19},{3:5,4:[1,12],5:6,6:[1,13],7:3,8:[1,9],9:4,10:[1,10],11:[1,11],13:23,15:7,16:8,17:[1,14],23:[1,15],24:[1,21],25:22},{1:[2,6]},{14:[2,13],18:[2,13],22:[2,13],24:[2,13]},{18:[1,24],22:[1,25]},{18:[2,16],22:[2,16]},{21:[1,26]},{14:[2,18],18:[2,18],22:[2,18],24:[2,18]},{22:[1,28],24:[1,27]},{22:[2,20],24:[2,20]},{14:[2,14],18:[2,14],22:[2,14],24:[2,14]},{3:20,4:[1,12],20:29},{3:5,4:[1,12],5:6,6:[1,13],7:3,8:[1,9],9:4,10:[1,10],11:[1,11],13:30,15:7,16:8,17:[1,14],23:[1,15]},{14:[2,19],18:[2,19],22:[2,19],24:[2,19]},{3:5,4:[1,12],5:6,6:[1,13],7:3,8:[1,9],9:4,10:[1,10],11:[1,11],13:31,15:7,16:8,17:[1,14],23:[1,15]},{18:[2,17],22:[2,17]},{18:[2,15],22:[2,15]},{22:[2,21],24:[2,21]}],defaultActions:{16:[2,6]},parseError:function(y,X){throw new Error(y)},parse:function(y){var X=this,oe=[0],A=[null],Ee=[],ae=this.table,De="",pe=0,v=0,Te=0,xe=2,o=1;this.lexer.setInput(y),this.lexer.yy=this.yy,this.yy.lexer=this.lexer,typeof this.lexer.yylloc=="undefined"&&(this.lexer.yylloc={});var bt=this.lexer.yylloc;Ee.push(bt),typeof this.yy.parseError=="function"&&(this.parseError=this.yy.parseError);function At(L){oe.length=oe.length-2*L,A.length=A.length-L,Ee.length=Ee.length-L}function jt(){var L;return L=X.lexer.lex()||1,typeof L!="number"&&(L=X.symbols_[L]||L),L}for(var Pe,Ye,we,Ie,no,Et,Ve={},Je,Oe,k,D;;){we=oe[oe.length-1],this.defaultActions[we]?Ie=this.defaultActions[we]:(Pe==null&&(Pe=jt()),Ie=ae[we]&&ae[we][Pe]);e:if(typeof Ie=="undefined"||!Ie.length||!Ie[0]){if(!Te){D=[];for(Je in ae[we])this.terminals_[Je]&&Je>2&&D.push("'"+this.terminals_[Je]+"'");var j="";this.lexer.showPosition?j="Parse error on line "+(pe+1)+`:
|
|
3
|
-
`+this.lexer.showPosition()+`
|
|
4
|
-
Expecting `+D.join(", ")+", got '"+this.terminals_[Pe]+"'":j="Parse error on line "+(pe+1)+": Unexpected "+(Pe==1?"end of input":"'"+(this.terminals_[Pe]||Pe)+"'"),this.parseError(j,{text:this.lexer.match,token:this.terminals_[Pe]||Pe,line:this.lexer.yylineno,loc:bt,expected:D})}if(Te==3){if(Pe==o)throw new Error(j||"Parsing halted.");v=this.lexer.yyleng,De=this.lexer.yytext,pe=this.lexer.yylineno,bt=this.lexer.yylloc,Pe=jt()}for(;!(xe.toString()in ae[we]);){if(we==0)throw new Error(j||"Parsing halted.");At(1),we=oe[oe.length-1]}Ye=Pe,Pe=xe,we=oe[oe.length-1],Ie=ae[we]&&ae[we][xe],Te=3}if(Ie[0]instanceof Array&&Ie.length>1)throw new Error("Parse Error: multiple actions possible at state: "+we+", token: "+Pe);switch(Ie[0]){case 1:oe.push(Pe),A.push(this.lexer.yytext),Ee.push(this.lexer.yylloc),oe.push(Ie[1]),Pe=null,Ye?(Pe=Ye,Ye=null):(v=this.lexer.yyleng,De=this.lexer.yytext,pe=this.lexer.yylineno,bt=this.lexer.yylloc,Te>0&&Te--);break;case 2:if(Oe=this.productions_[Ie[1]][1],Ve.$=A[A.length-Oe],Ve._$={first_line:Ee[Ee.length-(Oe||1)].first_line,last_line:Ee[Ee.length-1].last_line,first_column:Ee[Ee.length-(Oe||1)].first_column,last_column:Ee[Ee.length-1].last_column},Et=this.performAction.call(Ve,De,v,pe,this.yy,Ie[1],A,Ee),typeof Et!="undefined")return Et;Oe&&(oe=oe.slice(0,-1*Oe*2),A=A.slice(0,-1*Oe),Ee=Ee.slice(0,-1*Oe)),oe.push(this.productions_[Ie[1]][0]),A.push(Ve.$),Ee.push(Ve._$),k=ae[oe[oe.length-2]][oe[oe.length-1]],oe.push(k);break;case 3:return!0}}return!0}},at=function(){var ee={EOF:1,parseError:function(X,oe){if(this.yy.parseError)this.yy.parseError(X,oe);else throw new Error(X)},setInput:function(y){return this._input=y,this._more=this._less=this.done=!1,this.yylineno=this.yyleng=0,this.yytext=this.matched=this.match="",this.conditionStack=["INITIAL"],this.yylloc={first_line:1,first_column:0,last_line:1,last_column:0},this},input:function(){var y=this._input[0];this.yytext+=y,this.yyleng++,this.match+=y,this.matched+=y;var X=y.match(/\n/);return X&&this.yylineno++,this._input=this._input.slice(1),y},unput:function(y){return this._input=y+this._input,this},more:function(){return this._more=!0,this},less:function(y){this._input=this.match.slice(y)+this._input},pastInput:function(){var y=this.matched.substr(0,this.matched.length-this.match.length);return(y.length>20?"...":"")+y.substr(-20).replace(/\n/g,"")},upcomingInput:function(){var y=this.match;return y.length<20&&(y+=this._input.substr(0,20-y.length)),(y.substr(0,20)+(y.length>20?"...":"")).replace(/\n/g,"")},showPosition:function(){var y=this.pastInput(),X=new Array(y.length+1).join("-");return y+this.upcomingInput()+`
|
|
5
|
-
`+X+"^"},next:function(){if(this.done)return this.EOF;this._input||(this.done=!0);var y,X,oe,A,Ee,ae;this._more||(this.yytext="",this.match="");for(var De=this._currentRules(),pe=0;pe<De.length&&(oe=this._input.match(this.rules[De[pe]]),!(oe&&(!X||oe[0].length>X[0].length)&&(X=oe,A=pe,!this.options.flex)));pe++);if(X)return ae=X[0].match(/\n.*/g),ae&&(this.yylineno+=ae.length),this.yylloc={first_line:this.yylloc.last_line,last_line:this.yylineno+1,first_column:this.yylloc.last_column,last_column:ae?ae[ae.length-1].length-1:this.yylloc.last_column+X[0].length},this.yytext+=X[0],this.match+=X[0],this.yyleng=this.yytext.length,this._more=!1,this._input=this._input.slice(X[0].length),this.matched+=X[0],y=this.performAction.call(this,this.yy,this,De[A],this.conditionStack[this.conditionStack.length-1]),this.done&&this._input&&(this.done=!1),y||void 0;if(this._input==="")return this.EOF;this.parseError("Lexical error on line "+(this.yylineno+1)+`. Unrecognized text.
|
|
6
|
-
`+this.showPosition(),{text:"",token:null,line:this.yylineno})},lex:function(){var X=this.next();return typeof X!="undefined"?X:this.lex()},begin:function(X){this.conditionStack.push(X)},popState:function(){return this.conditionStack.pop()},_currentRules:function(){return this.conditions[this.conditionStack[this.conditionStack.length-1]].rules},topState:function(){return this.conditionStack[this.conditionStack.length-2]},pushState:function(X){this.begin(X)}};return ee.options={},ee.performAction=function(X,oe,A,Ee){var ae=Ee;switch(A){case 0:break;case 1:return 6;case 2:return oe.yytext=oe.yytext.substr(1,oe.yyleng-2),4;break;case 3:return 17;case 4:return 18;case 5:return 23;case 6:return 24;case 7:return 22;case 8:return 21;case 9:return 10;case 10:return 11;case 11:return 8;case 12:return 14;case 13:return"INVALID"}},ee.rules=[/^(?:\s+)/,/^(?:(-?([0-9]|[1-9][0-9]+))(\.[0-9]+)?([eE][-+]?[0-9]+)?\b)/,/^(?:"(?:\\[\\"bfnrt/]|\\u[a-fA-F0-9]{4}|[^\\\0-\x09\x0a-\x1f"])*")/,/^(?:\{)/,/^(?:\})/,/^(?:\[)/,/^(?:\])/,/^(?:,)/,/^(?::)/,/^(?:true\b)/,/^(?:false\b)/,/^(?:null\b)/,/^(?:$)/,/^(?:.)/],ee.conditions={INITIAL:{rules:[0,1,2,3,4,5,6,7,8,9,10,11,12,13],inclusive:!0}},ee}();return r.lexer=at,r}();st.parser=p,st.parse=function(){return p.parse.apply(p,arguments)},st.main=function(at){if(!at[1])throw new Error("Usage: "+at[0]+" FILE")}},95417:(yc,st,p)=>{"use strict";p.r(st),p.d(st,{App:()=>fc,default:()=>VC});var r=p(32735),at=p(99357),ee=p(5141),y=p(88425),X=p(11856),oe=p(16540),A=p(5636),Ee=p(98978),ae=p.n(Ee),De=p(83983);const v=e=>`content-manager.${e}`;var Te=p(74506),xe=p(60216),o=p.n(xe);const At=(0,r.createContext)();var jt=Object.defineProperty,Pe=Object.getOwnPropertySymbols,Ye=Object.prototype.hasOwnProperty,we=Object.prototype.propertyIsEnumerable,Ie=(e,t,n)=>t in e?jt(e,t,{enumerable:!0,configurable:!0,writable:!0,value:n}):e[t]=n,no=(e,t)=>{for(var n in t||(t={}))Ye.call(t,n)&&Ie(e,n,t[n]);if(Pe)for(var n of Pe(t))we.call(t,n)&&Ie(e,n,t[n]);return e},Et=(e,t)=>{var n={};for(var s in e)Ye.call(e,s)&&t.indexOf(s)<0&&(n[s]=e[s]);if(e!=null&&Pe)for(var s of Pe(e))t.indexOf(s)<0&&we.call(e,s)&&(n[s]=e[s]);return n};function Ve(e){var t=e,{attributes:n,buttonData:s,children:a,goTo:l,layout:i,metadatas:u,moveItem:c,moveRow:d,onAddData:m,relationsLayout:f,removeField:g,selectedItemName:h,setEditFieldToSelect:b}=t,E=Et(t,["attributes","buttonData","children","goTo","layout","metadatas","moveItem","moveRow","onAddData","relationsLayout","removeField","selectedItemName","setEditFieldToSelect"]);return r.createElement(At.Provider,{value:no({attributes:n,buttonData:s,goTo:l,layout:i,metadatas:u,moveItem:c,moveRow:d,onAddData:m,relationsLayout:f,removeField:g,selectedItemName:h,setEditFieldToSelect:b},E)},a)}Ve.defaultProps={attributes:{},buttonData:[],goTo(){},layout:[],metadatas:{},moveItem(){},moveRow(){},onAddData(){},relationsLayout:[],removeField(){},selectedItemName:null,setEditFieldToSelect(){}},Ve.propTypes={attributes:o().object,buttonData:o().array,children:o().node.isRequired,goTo:o().func,layout:o().array,metadatas:o().object,moveItem:o().func,moveRow:o().func,onAddData:o().func,relationsLayout:o().array,removeField:o().func,selectedItemName:o().string,setEditFieldToSelect:o().func};const Je=Ve,Oe={COMPONENT:"component",EDIT_FIELD:"editField",EDIT_RELATION:"editRelation",FIELD:"field",RELATION:"relation"};var k=p(19615),D=p(9808),j=p(19192),L=p(95602),Me=p(20763),hc=p(76470),Be=p.n(hc),bc=p(64198),Xe=p.n(bc),Ec=p(60672),ro=p.n(Ec);const vc=(0,k.default)(D.Box)`
|
|
7
|
-
border: 1px solid ${({theme:e})=>e.colors.neutral200};
|
|
8
|
-
`,Cc=(0,k.default)(D.Box)`
|
|
9
|
-
height: ${32/16}rem;
|
|
10
|
-
width: ${32/16}rem;
|
|
11
|
-
border-radius: 50%;
|
|
12
|
-
display: flex;
|
|
13
|
-
align-items: center;
|
|
14
|
-
justify-content: center;
|
|
15
|
-
|
|
16
|
-
svg {
|
|
17
|
-
height: ${6/16}rem;
|
|
18
|
-
width: ${11/16}rem;
|
|
19
|
-
> path {
|
|
20
|
-
fill: ${({theme:e})=>e.colors.neutral600};
|
|
21
|
-
}
|
|
22
|
-
}
|
|
23
|
-
`,Pc=k.default.button`
|
|
24
|
-
border: none;
|
|
25
|
-
background: transparent;
|
|
26
|
-
display: block;
|
|
27
|
-
width: 100%;
|
|
28
|
-
text-align: unset;
|
|
29
|
-
padding: 0;
|
|
30
|
-
`,oo=({displayedValue:e})=>r.createElement(vc,{paddingLeft:3,paddingRight:3,paddingTop:3,paddingBottom:3,hasRadius:!0,background:"neutral0",width:(0,y.pxToRem)(300)},r.createElement(j.Flex,{justifyContent:"space-between"},r.createElement(Pc,{type:"button"},r.createElement(j.Flex,null,r.createElement(Cc,{background:"neutral200"},r.createElement(ro(),null)),r.createElement(D.Box,{paddingLeft:6,maxWidth:(0,y.pxToRem)(150)},r.createElement(L.Typography,{textColor:"neutral700",ellipsis:!0},e)))),r.createElement(D.Box,{paddingLeft:3},r.createElement(j.Flex,null,r.createElement(Me.IconButton,{icon:r.createElement(Be(),null)}),r.createElement(D.Box,{paddingLeft:2},r.createElement(Me.IconButton,{icon:r.createElement(Xe(),null)}))))));oo.propTypes={displayedValue:o().string.isRequired};const Oc=oo;var se=p(90662),Rc=p(95717),it=p.n(Rc),Mc=p(94009),so=p.n(Mc);const ao=e=>e.length>20?`${e.substring(0,20)}...`:e,hn=(0,k.default)(j.Flex)`
|
|
31
|
-
height: ${({theme:e})=>e.spaces[7]};
|
|
32
|
-
|
|
33
|
-
&:last-child {
|
|
34
|
-
padding: 0 ${({theme:e})=>e.spaces[3]};
|
|
35
|
-
}
|
|
36
|
-
`,io=(0,k.default)(hn)`
|
|
37
|
-
padding: 0 ${({theme:e})=>e.spaces[3]};
|
|
38
|
-
border-right: 1px solid ${({theme:e})=>e.colors.neutral150};
|
|
39
|
-
cursor: all-scroll;
|
|
40
|
-
|
|
41
|
-
svg {
|
|
42
|
-
width: ${12/16}rem;
|
|
43
|
-
height: ${12/16}rem;
|
|
44
|
-
}
|
|
45
|
-
`,Tc=(0,k.default)(j.Flex)`
|
|
46
|
-
display: inline-flex;
|
|
47
|
-
max-height: ${32/16}rem;
|
|
48
|
-
opacity: ${({transparent:e})=>e?0:1};
|
|
49
|
-
background-color: ${({theme:e,isSibling:t})=>t?e.colors.neutral100:e.colors.primary100};
|
|
50
|
-
border: 1px solid
|
|
51
|
-
${({theme:e,isSibling:t})=>t?e.colors.neutral150:e.colors.primary200};
|
|
52
|
-
|
|
53
|
-
svg {
|
|
54
|
-
width: ${10/16}rem;
|
|
55
|
-
height: ${10/16}rem;
|
|
56
|
-
|
|
57
|
-
path {
|
|
58
|
-
fill: ${({theme:e,isSibling:t})=>t?void 0:e.colors.primary600};
|
|
59
|
-
}
|
|
60
|
-
}
|
|
61
|
-
|
|
62
|
-
${L.Typography} {
|
|
63
|
-
color: ${({theme:e,isSibling:t})=>t?void 0:e.colors.primary600};
|
|
64
|
-
}
|
|
65
|
-
|
|
66
|
-
${io} {
|
|
67
|
-
border-right: 1px solid
|
|
68
|
-
${({theme:e,isSibling:t})=>t?e.colors.neutral150:e.colors.primary200};
|
|
69
|
-
}
|
|
70
|
-
`,bn=({labelField:e,transparent:t,isSibling:n})=>{const s=ao(e);return r.createElement(Tc,{hasRadius:!0,justifyContent:"space-between",transparent:t,isSibling:n},r.createElement(se.Stack,{horizontal:!0,spacing:3},r.createElement(io,{alignItems:"center"},r.createElement(Xe(),null)),r.createElement(L.Typography,{fontWeight:"bold"},s)),r.createElement(j.Flex,{paddingLeft:3},r.createElement(hn,{alignItems:"center"},r.createElement(it(),null)),r.createElement(hn,{alignItems:"center"},r.createElement(so(),null))))};bn.defaultProps={isSibling:!1,transparent:!1},bn.propTypes={isSibling:o().bool,labelField:o().string.isRequired,transparent:o().bool};const En=bn,wc={position:"fixed",pointerEvents:"none",zIndex:100,left:0,top:0,width:"100%",height:"100%"};function Ic(e,t,n){if(!e||!t)return{display:"none"};const{x:s,y:a}=n,l=`translate(${s}px, ${a}px)`;return{transform:l,WebkitTransform:l}}const Dc=()=>{const{itemType:e,isDragging:t,item:n,initialOffset:s,currentOffset:a,mouseOffset:l}=(0,Te.useDragLayer)(i=>({item:i.getItem(),itemType:i.getItemType(),initialOffset:i.getInitialSourceClientOffset(),currentOffset:i.getSourceClientOffset(),isDragging:i.isDragging(),mouseOffset:i.getClientOffset()}));return t?r.createElement(Je,null,r.createElement("div",{style:wc},r.createElement("div",{style:Ic(s,a,l),className:"col-md-2"},[Oe.EDIT_RELATION,Oe.EDIT_FIELD,Oe.FIELD].includes(e)&&r.createElement(En,{labelField:n.labelField}),e===Oe.COMPONENT&&r.createElement(Oc,{displayedValue:n.displayedValue})))):null},lo=(0,r.createContext)();var xc=p(18522),V=p(92891);const co=(0,r.createContext)(),HC=(0,r.createContext)(),GC=null;var fe=p(4409);const uo=e=>e["content-manager_editViewLayoutManager"].currentLayout;var Sc=Object.defineProperty,Lc=Object.defineProperties,Fc=Object.getOwnPropertyDescriptors,po=Object.getOwnPropertySymbols,kc=Object.prototype.hasOwnProperty,Ac=Object.prototype.propertyIsEnumerable,mo=(e,t,n)=>t in e?Sc(e,t,{enumerable:!0,configurable:!0,writable:!0,value:n}):e[t]=n,jc=(e,t)=>{for(var n in t||(t={}))kc.call(t,n)&&mo(e,n,t[n]);if(po)for(var n of po(t))Ac.call(t,n)&&mo(e,n,t[n]);return e},$c=(e,t)=>Lc(e,Fc(t));const lt=()=>{const e=(0,fe.useSelector)(uo),t=(0,r.useCallback)(n=>(0,V.get)(e,["components",n],{}),[e]);return $c(jc({},e),{getComponentLayout:t})};var Bc=p(43653),Se=p.n(Bc),ge=p(17247),Nc=p(99381),qe=p.n(Nc);const vt=(e,t,n)=>{if(Array.isArray(e)&&t>=0&&n>=0&&t<=e.length-1&&n<=e.length-1){const s=qe()(e),a=s.splice(t,1);return s.splice(n,0,a[0]),s}return e},fo=e=>{const t=e.type;return t==="relation"?!(0,V.toLower)(e.relationType).includes("morph"):!["json","dynamiczone","richtext","password"].includes(t)&&!!t},go=(e,t)=>Object.keys(e).reduce((n,s)=>{const a=(0,V.get)(e,[s],{}),{default:l,component:i,type:u,required:c,min:d,repeatable:m}=a;if(u==="json"&&(n[s]=null),u==="json"&&c===!0&&(n[s]={}),l!==void 0&&(n[s]=l),u==="component"){const f=(0,V.get)(t,[i,"attributes"],{}),g=go(f,t);if(c===!0&&(n[s]=m===!0?[]:g),d&&m===!0&&c){n[s]=[];for(let h=0;h<d;h+=1)n[s].push(g)}}return u==="dynamiczone"&&c===!0&&(n[s]=[]),n},{}),$t=go;var Vc=Object.defineProperty,qc=Object.defineProperties,Wc=Object.getOwnPropertyDescriptors,Bt=Object.getOwnPropertySymbols,yo=Object.prototype.hasOwnProperty,ho=Object.prototype.propertyIsEnumerable,bo=(e,t,n)=>t in e?Vc(e,t,{enumerable:!0,configurable:!0,writable:!0,value:n}):e[t]=n,vn=(e,t)=>{for(var n in t||(t={}))yo.call(t,n)&&bo(e,n,t[n]);if(Bt)for(var n of Bt(t))ho.call(t,n)&&bo(e,n,t[n]);return e},Cn=(e,t)=>qc(e,Wc(t)),zc=(e,t)=>{var n={};for(var s in e)yo.call(e,s)&&t.indexOf(s)<0&&(n[s]=e[s]);if(e!=null&&Bt)for(var s of Bt(e))t.indexOf(s)<0&&ho.call(e,s)&&(n[s]=e[s]);return n};const Nt=e=>{var t=e,{layouts:n,metadatas:s}=t,a=zc(t,["layouts","metadatas"]);const l=n.list.map(d=>d.name?d.name:d),i=n.editRelations.map(({name:d})=>d),u=Object.keys(s).reduce((d,m)=>{const f=(0,V.get)(s,[m],{});let g=f.edit;return g.mainField&&(g=Cn(vn({},g),{mainField:f.edit.mainField.name})),Cn(vn({},d),{[m]:{edit:g,list:(0,V.omit)(f.list,["mainField"])}})},{}),c=n.edit.map(d=>d.map(({name:m,size:f})=>({name:m,size:f})));return Cn(vn({},a),{layouts:{edit:c,editRelations:i,list:l},metadatas:u})};var Uc=Object.defineProperty,Hc=Object.defineProperties,Gc=Object.getOwnPropertyDescriptors,Eo=Object.getOwnPropertySymbols,Zc=Object.prototype.hasOwnProperty,_c=Object.prototype.propertyIsEnumerable,vo=(e,t,n)=>t in e?Uc(e,t,{enumerable:!0,configurable:!0,writable:!0,value:n}):e[t]=n,Qc=(e,t)=>{for(var n in t||(t={}))Zc.call(t,n)&&vo(e,n,t[n]);if(Eo)for(var n of Eo(t))_c.call(t,n)&&vo(e,n,t[n]);return e},Kc=(e,t)=>Hc(e,Gc(t));const Yc=(e,t)=>e.map(n=>Kc(Qc({},n),{subject:t})),Co=e=>{const t={create:[{action:"plugin::content-manager.explorer.create",subject:null}],delete:[{action:"plugin::content-manager.explorer.delete",subject:null}],publish:[{action:"plugin::content-manager.explorer.publish",subject:null}],read:[{action:"plugin::content-manager.explorer.read",subject:null}],update:[{action:"plugin::content-manager.explorer.update",subject:null}]};return Object.keys(t).reduce((n,s)=>(n[s]=Yc(t[s],e),n),{})},Po=e=>e.split(".").filter(t=>(0,V.isNaN)(parseInt(t,10))),Oo=e=>e.length===0?-1:Math.max.apply(Math,e.map(t=>t.__temp_key__)),ve=e=>`/content-manager/${e}`;var Jc=Object.defineProperty,Ro=Object.getOwnPropertySymbols,Xc=Object.prototype.hasOwnProperty,eu=Object.prototype.propertyIsEnumerable,Mo=(e,t,n)=>t in e?Jc(e,t,{enumerable:!0,configurable:!0,writable:!0,value:n}):e[t]=n,Vt=(e,t)=>{for(var n in t||(t={}))Xc.call(t,n)&&Mo(e,n,t[n]);if(Ro)for(var n of Ro(t))eu.call(t,n)&&Mo(e,n,t[n]);return e};const To=(e,t,n)=>{const s=u=>t.find(c=>c.uid===u),a=Object.assign({},e),l=e[n].uid,i=s(l);return(0,V.set)(a,[n],Vt(Vt({},e[n]),i)),Object.keys(e.components).forEach(u=>{const c=s(u);(0,V.set)(a,["components",u],Vt(Vt({},e.components[u]),c))}),a};var tu=Object.defineProperty,nu=Object.defineProperties,ru=Object.getOwnPropertyDescriptors,wo=Object.getOwnPropertySymbols,ou=Object.prototype.hasOwnProperty,su=Object.prototype.propertyIsEnumerable,Io=(e,t,n)=>t in e?tu(e,t,{enumerable:!0,configurable:!0,writable:!0,value:n}):e[t]=n,Do=(e,t)=>{for(var n in t||(t={}))ou.call(t,n)&&Io(e,n,t[n]);if(wo)for(var n of wo(t))su.call(t,n)&&Io(e,n,t[n]);return e},xo=(e,t)=>nu(e,ru(t));const Ct=(e,t)=>e&&Object.keys(e).reduce((n,s)=>{const a=n[s];return a===null?n:Array.isArray(a)?Array.isArray(n)?(n[s]=Ct(a,t),n):xo(Do({},n),{[s]:a.map(l=>Ct(l,t))}):typeof a=="object"?Array.isArray(n)?(n[s]=Ct(a,t),n):xo(Do({},n),{[s]:Ct(a,t)}):(s===t&&delete n[s],n)},e),au=Ct,So=(e,t,n)=>{const s=(a,l)=>Object.keys(a).reduce((i,u)=>{const c=(0,y.getType)(l,u),d=(0,V.get)(a,u),m=(0,y.getOtherInfos)(l,[u,"component"]),f=(0,y.getOtherInfos)(l,[u,"repeatable"]);return c==="dynamiczone"?(i[u]=d.map(g=>s(g,n[g.__component])),i):c==="component"?(f?i[u]=d&&d.map(g=>s(g,n[m])):i[u]=d&&s(d,n[m]),i):(c!=="password"&&(i[u]=d),i)},{});return s(e,t)};var iu=Object.defineProperty,lu=Object.defineProperties,cu=Object.getOwnPropertyDescriptors,Lo=Object.getOwnPropertySymbols,uu=Object.prototype.hasOwnProperty,du=Object.prototype.propertyIsEnumerable,Fo=(e,t,n)=>t in e?iu(e,t,{enumerable:!0,configurable:!0,writable:!0,value:n}):e[t]=n,Pt=(e,t)=>{for(var n in t||(t={}))uu.call(t,n)&&Fo(e,n,t[n]);if(Lo)for(var n of Lo(t))du.call(t,n)&&Fo(e,n,t[n]);return e},Ot=(e,t)=>lu(e,cu(t));const Pn=(e,t)=>t.find(n=>n.uid===e),pu=(e,t)=>e.layouts.editRelations.reduce((s,a)=>{const l=(0,V.get)(e,["attributes",a],{}),i=(0,V.get)(e,["attributes",a,"targetModel"],null),c=Pn(i,t).pluginOptions||{},d=(0,V.get)(e,["metadatas",a,"edit"],{}),m=6,f=Ao(e,a,t);return s.push({name:a,size:m,fieldSchema:l,metadatas:d,queryInfos:f,targetModelPluginOptions:c}),s},[]),mu=(e,t)=>{const n=fu(e,t),s=ko(n.contentType,null,t),a=n.contentType.uid,l=pu(n.contentType,t),i=gu(n.contentType,n.components);return(0,V.set)(n,["contentType","layouts","edit"],s),(0,V.set)(n,["contentType","layouts","editRelations"],l),(0,V.set)(n,["contentType","layouts","list"],i),Object.keys(n.components).forEach(u=>{const c=ko(n.components[u],a,t);(0,V.set)(n,["components",u,"layouts","edit"],c)}),n},fu=(e,t)=>{const n=To((0,V.cloneDeep)(e),t,"contentType"),{components:s,contentType:a}=n,l=i=>Object.keys(i.metadatas).reduce((u,c)=>{const d=(0,V.get)(i,["attributes",c],{});let m=i.metadatas[c];if(d.type==="relation"){const f=Pn(d.targetModel,t),g=m.edit.mainField,h={name:g,schema:(0,V.get)(f,["attributes",g])};m={list:Ot(Pt({},m.list),{mainField:h}),edit:Ot(Pt({},m.edit),{mainField:h})}}return u[c]=m,u},{});return(0,V.set)(n,["contentType","metadatas"],l(a)),Object.keys(s).forEach(i=>{const u=s[i],c=l(u);(0,V.set)(n,["components",i,"metadatas"],c)}),n},ko=(e,t,n)=>e.layouts.edit.reduce((a,l)=>{const i=l.map(u=>{const c=(0,V.get)(e,["attributes",u.name],{}),d=Ot(Pt({},u),{fieldSchema:c,metadatas:(0,V.get)(e,["metadatas",u.name,"edit"],{})});if(c.type==="relation"){const m=c.targetModel,g=Pn(m,n).pluginOptions||{},h=t?yu(e,u.name,t,n):Ao(e,u.name,n);(0,V.set)(d,"targetModelPluginOptions",g),(0,V.set)(d,"queryInfos",h)}return d});return a.push(i),a},[]),gu=(e,t)=>e.layouts.list.reduce((s,a)=>{const l=(0,V.get)(e,["attributes",a],{}),i=(0,V.get)(e,["metadatas",a,"list"],{}),u=l.type;if(u==="relation"){const c={endPoint:`collection-types/${e.uid}`,defaultParams:{}};return s.push({key:`__${a}_key__`,name:a,fieldSchema:l,metadatas:i,queryInfos:c}),s}if(u==="component"){const c=t[l.component],d=c.settings.mainField,m=c.attributes[d];return s.push({key:`__${a}_key__`,name:a,fieldSchema:l,metadatas:Ot(Pt({},i),{mainField:Ot(Pt({},m),{name:d})})}),s}return s.push({key:`__${a}_key__`,name:a,fieldSchema:l,metadatas:i}),s},[]),Ao=(e,t,n)=>{const s=e.uid,a=ve(`relations/${s}/${t}`),l=(0,V.get)(e,["metadatas",t,"edit","mainField","name"],""),i=(0,V.get)(e,["attributes",t,"targetModel"],""),u=jo(n).indexOf(i)!==-1;return{endPoint:a,containsKey:`${l}`,defaultParams:{},shouldDisplayRelationLink:u}},yu=(e,t,n,s)=>{const a=ve(`relations/${n}/${t}`),l=(0,V.get)(e,["metadatas",t,"edit","mainField","name"],""),i=(0,V.get)(e,["attributes",t,"targetModel"],""),u=jo(s).indexOf(i)!==-1;return{endPoint:a,containsKey:`${l}`,defaultParams:{_component:e.uid},shouldDisplayRelationLink:u}},jo=e=>e.filter(t=>t.isDisplayed).map(({uid:t})=>t),$o=mu;var qt=p(49415),hu=Object.defineProperty,bu=Object.defineProperties,Eu=Object.getOwnPropertyDescriptors,Bo=Object.getOwnPropertySymbols,vu=Object.prototype.hasOwnProperty,Cu=Object.prototype.propertyIsEnumerable,No=(e,t,n)=>t in e?hu(e,t,{enumerable:!0,configurable:!0,writable:!0,value:n}):e[t]=n,Wt=(e,t)=>{for(var n in t||(t={}))vu.call(t,n)&&No(e,n,t[n]);if(Bo)for(var n of Bo(t))Cu.call(t,n)&&No(e,n,t[n]);return e},Vo=(e,t)=>bu(e,Eu(t));const Pu={error:null,isLoading:!0,layout:{},layouts:{}},Ou=(e,t)=>(0,qt.default)(e,n=>{switch(t.type){case"GET_DATA":{n.isLoading=!0,n.error=null,n.layout={};break}case"GET_DATA_SUCCEEDED":{const s=t.data.contentType.uid;n.layout=t.data,n.layouts[s]=t.data,n.isLoading=!1;break}case"GET_DATA_ERROR":{n.isLoading=!1,n.error=t.error;break}case"SET_LAYOUT_FROM_STATE":{n.error=null,n.layout=e.layouts[t.uid];break}case"UPDATE_LAYOUT":{const s=e.layout;n.layout=Vo(Wt({},s),{contentType:Wt({uid:s.contentType.uid},t.newLayout.contentType)}),n.layouts[s.contentType.uid]=Vo(Wt({},s),{contentType:Wt({uid:s.contentType.uid},t.newLayout.contentType)});break}default:return n}});var On=p(12463),Ru=p(34947);const Rt=()=>e=>e["content-manager_app"]||Ru.E,sP=()=>createSelector(Rt(),e=>e),aP=()=>createSelector(Rt(),e=>e.models),Mu=()=>(0,On.P1)(Rt(),e=>({collectionTypeLinks:e.collectionTypeLinks,singleTypeLinks:e.singleTypeLinks})),Rn=()=>(0,On.P1)(Rt(),({components:e,models:t})=>({schemas:[...e,...t]})),iP=null;var Tu=p(98399),wu=(e,t,n)=>new Promise((s,a)=>{var l=c=>{try{u(n.next(c))}catch(d){a(d)}},i=c=>{try{u(n.throw(c))}catch(d){a(d)}},u=c=>c.done?s(c.value):Promise.resolve(c.value).then(l,i);u((n=n.apply(e,t)).next())});const qo=e=>{const[{error:t,isLoading:n,layout:s,layouts:a},l]=(0,r.useReducer)(Ou,Pu),i=(0,r.useMemo)(Rn,[]),{schemas:u}=(0,fe.useSelector)(f=>i(f),fe.shallowEqual),c=(0,r.useRef)(!0),d=(0,r.useCallback)((f,g)=>wu(void 0,null,function*(){if(a[f]){l({type:"SET_LAYOUT_FROM_STATE",uid:f});return}l({type:"GET_DATA"});try{const h=ve(`content-types/${f}/configuration`),{data:{data:b}}=yield ge.be.get(h,{cancelToken:g.token});l({type:"GET_DATA_SUCCEEDED",data:$o(b,u)})}catch(h){if(Se().isCancel(h))return;c.current&&Tu.error(h),c.current&&l({type:"GET_DATA_ERROR",error:h})}}),[a,u]);(0,r.useEffect)(()=>()=>{c.current=!1},[]),(0,r.useEffect)(()=>{const g=Se().CancelToken.source();return d(e,g),()=>{g.cancel("Operation canceled by the user.")}},[e,d]);const m=(0,r.useCallback)(f=>{l({type:"UPDATE_LAYOUT",newLayout:$o(f,u)})},[u]);return{error:t,isLoading:n,layout:s,updateLayout:m}},Iu=e=>e["content-manager_app"].collectionTypeLinks;var Ne=p(77997),Du=p(33795),M=p.n(Du),xu=p(85973),Wo=p.n(xu),Su=Object.defineProperty,Lu=Object.defineProperties,Fu=Object.getOwnPropertyDescriptors,zo=Object.getOwnPropertySymbols,ku=Object.prototype.hasOwnProperty,Au=Object.prototype.propertyIsEnumerable,Uo=(e,t,n)=>t in e?Su(e,t,{enumerable:!0,configurable:!0,writable:!0,value:n}):e[t]=n,ju=(e,t)=>{for(var n in t||(t={}))ku.call(t,n)&&Uo(e,n,t[n]);if(zo)for(var n of zo(t))Au.call(t,n)&&Uo(e,n,t[n]);return e},$u=(e,t)=>Lu(e,Fu(t));const Ho=(e,t)=>Object.keys(e).reduce((n,s)=>{const a=e[s],l=M()(t,[s],a);return Wo()(a)?$u(ju({},n),{[s]:Ho(a,l)}):(n[s]=l,n)},{}),Bu=(e,t,n)=>{const s=e.find(({to:m})=>m.includes(t));if(!s)return"/";const{to:a,search:l}=s,i=(0,Ne.parse)(l),u=(0,Ne.parse)(n.substring(1)),c=Ho(i,u);return`${a}?${(0,Ne.stringify)(c,{encode:!1})}`},Go=e=>{const[{rawQuery:t}]=(0,y.useQueryParams)(),n=(0,fe.useSelector)(Iu);return Bu(n,e,t)},He=()=>(0,r.useContext)(At),Zo=()=>{const{search:e}=(0,ee.useLocation)(),t=e?(0,Ne.parse)(e.substring(1)):{};return t.plugins?(0,Ne.stringify)({plugins:t.plugins},{encode:!1}):""};var _o=p(89334);const Nu=(e,t,n)=>({type:_o.m,permissions:e,__meta__:{plugins:t,containerName:n}}),Vu=()=>({type:_o.Q}),qu=e=>e["content-manager_rbacManager"].permissions,Wu=e=>e.rbacProvider.collectionTypesRelatedPermissions,Qo=(e,t,n="listView")=>{const s=(0,fe.useSelector)(Wu),a=(0,fe.useSelector)(qu),l=(0,fe.useDispatch)(),i=s[t];return(0,r.useEffect)(()=>i?(l(Nu(i,e?e.plugins:null,n)),()=>{l(Vu())}):()=>{},[i,l,e,n]),a},gP=()=>useContext(WysiwygContext),yP=null;var zt=p(70836),Ko=p(4460);const zu=()=>({type:Ko.c}),Uu=(e,t)=>({type:Ko.O,layout:e,query:t});var Hu=p(8266),We=p.n(Hu),Ut=p(27635),ie=p(78330),Gu=p(70404),Zu=p.n(Gu),_u=p(66694);const Qu=()=>(0,r.useContext)(_u.ux),Yo=e=>{const{getAdminInjectedComponents:t}=Qu(),[n,s,a]=e.split(".");return t(n,s,a)};var Ku=Object.defineProperty,Ht=Object.getOwnPropertySymbols,Jo=Object.prototype.hasOwnProperty,Xo=Object.prototype.propertyIsEnumerable,es=(e,t,n)=>t in e?Ku(e,t,{enumerable:!0,configurable:!0,writable:!0,value:n}):e[t]=n,Yu=(e,t)=>{for(var n in t||(t={}))Jo.call(t,n)&&es(e,n,t[n]);if(Ht)for(var n of Ht(t))Xo.call(t,n)&&es(e,n,t[n]);return e},Ju=(e,t)=>{var n={};for(var s in e)Jo.call(e,s)&&t.indexOf(s)<0&&(n[s]=e[s]);if(e!=null&&Ht)for(var s of Ht(e))t.indexOf(s)<0&&Xo.call(e,s)&&(n[s]=e[s]);return n};const ts=e=>{var t=e,{area:n}=t,s=Ju(t,["area"]);return Yo(n).map(l=>r.createElement(l.Component,Yu({key:l.name},s)))};ts.propTypes={area:o().string.isRequired};const Gt=ts;var Xu=Object.defineProperty,ns=Object.getOwnPropertySymbols,ed=Object.prototype.hasOwnProperty,td=Object.prototype.propertyIsEnumerable,rs=(e,t,n)=>t in e?Xu(e,t,{enumerable:!0,configurable:!0,writable:!0,value:n}):e[t]=n,os=(e,t)=>{for(var n in t||(t={}))ed.call(t,n)&&rs(e,n,t[n]);if(ns)for(var n of ns(t))td.call(t,n)&&rs(e,n,t[n]);return e};function nd(e,t){return n=>{const s=t(n.name);return r.createElement(e,os(os({},n),s))}}const rd=nd;function od(e){const{addComponentToDynamicZone:t,createActionAllowedFields:n,isCreatingEntry:s,formErrors:a,modifiedData:l,moveComponentUp:i,moveComponentDown:u,removeComponentFromDynamicZone:c,readActionAllowedFields:d,updateActionAllowedFields:m}=(0,y.useCMEditViewDataManager)(),f=(0,r.useMemo)(()=>(0,V.get)(l,[e],[]).map(b=>b.__component),[l,e]),g=(0,r.useMemo)(()=>(s?n:m).includes(e),[e,s,n,m]),h=(0,r.useMemo)(()=>(s?[]:d).includes(e),[e,s,d]);return{addComponentToDynamicZone:t,formErrors:a,isCreatingEntry:s,isFieldAllowed:g,isFieldReadable:h,moveComponentUp:i,moveComponentDown:u,removeComponentFromDynamicZone:c,dynamicDisplayedComponents:f}}const sd=od;var ad=p(51542),ss=p.n(ad),Mn=p(98195);const Tn=(0,k.default)(ss())`
|
|
71
|
-
transform: ${({$isOpen:e})=>e?"rotate(45deg)":"rotate(0deg)"};
|
|
72
|
-
> circle {
|
|
73
|
-
fill: ${({theme:e,$hasError:t})=>t?e.colors.danger200:e.colors.neutral150};
|
|
74
|
-
}
|
|
75
|
-
> path {
|
|
76
|
-
fill: ${({theme:e,$hasError:t})=>t?e.colors.danger600:e.colors.neutral600};
|
|
77
|
-
}
|
|
78
|
-
`,id=(0,k.default)(Mn.BaseButton)`
|
|
79
|
-
border-radius: 26px;
|
|
80
|
-
border-color: ${({theme:e})=>e.colors.neutral150};
|
|
81
|
-
background: ${({theme:e})=>e.colors.neutral0};
|
|
82
|
-
padding-top: ${({theme:e})=>e.spaces[3]};
|
|
83
|
-
padding-right: ${({theme:e})=>e.spaces[4]};
|
|
84
|
-
padding-bottom: ${({theme:e})=>e.spaces[3]};
|
|
85
|
-
padding-left: ${({theme:e})=>e.spaces[4]};
|
|
86
|
-
|
|
87
|
-
box-shadow: ${({theme:e})=>e.shadows.filterShadow};
|
|
88
|
-
|
|
89
|
-
svg {
|
|
90
|
-
height: ${({theme:e})=>e.spaces[6]};
|
|
91
|
-
width: ${({theme:e})=>e.spaces[6]};
|
|
92
|
-
> path {
|
|
93
|
-
fill: ${({theme:e})=>e.colors.neutral600};
|
|
94
|
-
}
|
|
95
|
-
}
|
|
96
|
-
&:hover {
|
|
97
|
-
color: ${({theme:e})=>e.colors.primary600} !important;
|
|
98
|
-
${L.Typography} {
|
|
99
|
-
color: ${({theme:e})=>e.colors.primary600} !important;
|
|
100
|
-
}
|
|
101
|
-
|
|
102
|
-
${Tn} {
|
|
103
|
-
> circle {
|
|
104
|
-
fill: ${({theme:e})=>e.colors.primary600};
|
|
105
|
-
}
|
|
106
|
-
> path {
|
|
107
|
-
fill: ${({theme:e})=>e.colors.neutral100};
|
|
108
|
-
}
|
|
109
|
-
}
|
|
110
|
-
}
|
|
111
|
-
&:active {
|
|
112
|
-
${L.Typography} {
|
|
113
|
-
color: ${({theme:e})=>e.colors.primary600};
|
|
114
|
-
}
|
|
115
|
-
${Tn} {
|
|
116
|
-
> circle {
|
|
117
|
-
fill: ${({theme:e})=>e.colors.primary600};
|
|
118
|
-
}
|
|
119
|
-
> path {
|
|
120
|
-
fill: ${({theme:e})=>e.colors.neutral100};
|
|
121
|
-
}
|
|
122
|
-
}
|
|
123
|
-
}
|
|
124
|
-
`,ld=(0,k.default)(D.Box)`
|
|
125
|
-
height: 100%;
|
|
126
|
-
`,wn=({hasError:e,hasMaxError:t,hasMinError:n,isDisabled:s,isOpen:a,label:l,missingComponentNumber:i,name:u,onClick:c})=>{const{formatMessage:d}=(0,A.useIntl)(),m=d({id:v("components.DynamicZone.add-component"),defaultMessage:"Add a component to {componentName}"},{componentName:l||u}),f=d({id:"app.utils.close-label",defaultMessage:"Close"});let g=a?f:m;return t&&!a&&(g=d({id:"components.Input.error.validation.max",defaultMessage:"The value is too high."})),n&&!a&&(g=d({id:v("components.DynamicZone.missing-components"),defaultMessage:"There {number, plural, =0 {are # missing components} one {is # missing component} other {are # missing components}}"},{number:i})),r.createElement(j.Flex,{justifyContent:"center"},r.createElement(D.Box,{style:{cursor:s?"not-allowed":"pointer"}},r.createElement(id,{type:"button",onClick:c,disabled:s,hasError:e},r.createElement(j.Flex,null,r.createElement(ld,{"aria-hidden":!0,paddingRight:2},r.createElement(Tn,{$isOpen:a,$hasError:e&&!a})),r.createElement(L.Typography,{variant:"pi",fontWeight:"bold",textColor:e&&!a?"danger600":"neutral500"},g)))))};wn.defaultProps={label:"",missingComponentNumber:0},wn.propTypes={label:o().string,hasError:o().bool.isRequired,hasMaxError:o().bool.isRequired,hasMinError:o().bool.isRequired,isDisabled:o().bool.isRequired,isOpen:o().bool.isRequired,missingComponentNumber:o().number,name:o().string.isRequired,onClick:o().func.isRequired};const cd=wn,ud=(0,k.default)(D.Box)`
|
|
127
|
-
border-radius: ${(0,y.pxToRem)(26)};
|
|
128
|
-
`,In=({label:e,labelAction:t,name:n,numberOfComponents:s,required:a,intlDescription:l})=>{const{formatMessage:i}=(0,A.useIntl)(),u=i({id:e||n,defaultMessage:e||n});return r.createElement(j.Flex,{justifyContent:"center"},r.createElement(D.Box,null,r.createElement(ud,{paddingTop:3,paddingBottom:3,paddingRight:4,paddingLeft:4,background:"neutral0",shadow:"filterShadow",color:"neutral500"},r.createElement(j.Flex,{direction:"column",justifyContent:"center"},r.createElement(j.Flex,{maxWidth:(0,y.pxToRem)(356)},r.createElement(L.Typography,{variant:"pi",textColor:"neutral600",fontWeight:"bold",ellipsis:!0},u,"\xA0"),r.createElement(L.Typography,{variant:"pi",textColor:"neutral600",fontWeight:"bold"},"(",s,")"),a&&r.createElement(L.Typography,{textColor:"danger600"},"*"),t&&r.createElement(D.Box,{paddingLeft:1},t)),l&&r.createElement(D.Box,{paddingTop:1,maxWidth:(0,y.pxToRem)(356)},r.createElement(L.Typography,{variant:"pi",textColor:"neutral600",ellipsis:!0},i(l)))))))};In.defaultProps={intlDescription:void 0,label:"",labelAction:void 0,required:!1},In.propTypes={intlDescription:o().shape({id:o().string.isRequired,defaultMessage:o().string.isRequired}),label:o().string,labelAction:o().element,name:o().string.isRequired,numberOfComponents:o().number.isRequired,required:o().bool};const dd=In;var Dn=p(16925),ze=p(12001),xn=p(54742),pd=p(78325),md=p.n(pd),fd=p(30857),gd=p.n(fd),yd=p(61868),hd=p.n(yd),bd=Object.defineProperty,as=Object.getOwnPropertySymbols,Ed=Object.prototype.hasOwnProperty,vd=Object.prototype.propertyIsEnumerable,is=(e,t,n)=>t in e?bd(e,t,{enumerable:!0,configurable:!0,writable:!0,value:n}):e[t]=n,Cd=(e,t)=>{for(var n in t||(t={}))Ed.call(t,n)&&is(e,n,t[n]);if(as)for(var n of as(t))vd.call(t,n)&&is(e,n,t[n]);return e};const Pd=k.default.span`
|
|
129
|
-
> svg {
|
|
130
|
-
width: ${(0,y.pxToRem)(24)};
|
|
131
|
-
height: ${(0,y.pxToRem)(24)};
|
|
132
|
-
> circle {
|
|
133
|
-
fill: ${({theme:e})=>e.colors.primary200};
|
|
134
|
-
}
|
|
135
|
-
> path {
|
|
136
|
-
fill: ${({theme:e})=>e.colors.primary600};
|
|
137
|
-
}
|
|
138
|
-
}
|
|
139
|
-
`,Sn=({error:e,isReadOnly:t,onClick:n})=>{const{formatMessage:s}=(0,A.useIntl)();return r.createElement(r.Fragment,null,r.createElement(D.Box,{as:"button",background:"neutral100",borderColor:e?"danger600":"neutral200",disabled:t,hasRadius:!0,onClick:n,paddingTop:9,paddingBottom:9,type:"button"},r.createElement(se.Stack,{spacing:2},r.createElement(j.Flex,{justifyContent:"center",style:{cursor:t?"not-allowed":"inherit"}},r.createElement(Pd,null,r.createElement(ss(),null))),r.createElement(j.Flex,{justifyContent:"center"},r.createElement(L.Typography,{textColor:"primary600",variant:"pi",fontWeight:"bold"},s({id:v("components.empty-repeatable"),defaultMessage:"No entry yet. Click on the button below to add one."}))))),(e==null?void 0:e.id)&&r.createElement(L.Typography,{textColor:"danger600",variant:"pi"},s({id:e.id,defaultMessage:e.id},Cd({},e.values))))};Sn.defaultProps={error:void 0,isReadOnly:!1},Sn.propTypes={error:o().shape({id:o().string.isRequired,defaultMessage:o().string.isRequired,values:o().object}),isReadOnly:o().bool,onClick:o().func.isRequired};const ls=Sn;var Od=p(9086),Rd=p.n(Od),Md=p(88708),Zt=p.n(Md),Td=p(27509),_t=p.n(Td),EP=p(40795),wd=p(88591),Id=p.n(wd),Ln=p(59845),Dd=p(20871),xd=p.n(Dd),Sd=p(48375),cs=p.n(Sd),Ld=p(31089),Fd=p.n(Ld),kd=p(16043),Ad=p.n(kd),jd=p(5109),$d=p.n(jd),Bd=p(47955),Nd=p.n(Bd),Vd=p(95706),qd=p.n(Vd),Wd=p(6658),zd=p.n(Wd),Ud=p(36407),Hd=p.n(Ud),Gd=(e,t,n)=>new Promise((s,a)=>{var l=c=>{try{u(n.next(c))}catch(d){a(d)}},i=c=>{try{u(n.throw(c))}catch(d){a(d)}},u=c=>c.done?s(c.value):Promise.resolve(c.value).then(l,i);u((n=n.apply(e,t)).next())});(()=>Gd(void 0,null,function*(){yield p.e(7347).then(p.bind(p,98362))}))();const ct=new(Id())({html:!0,xhtmlOut:!1,breaks:!0,langPrefix:"language-",linkify:!0,typographer:!0,highlight(e,t){if(t&&t!=="auto"&&(0,Ln.getLanguage)(t))return'<pre class="hljs language-'+ct.utils.escapeHtml(t.toLowerCase())+'"><code>'+(0,Ln.highlight)(t,e,!0).value+"</code></pre>";if(t==="auto"){const n=(0,Ln.highlightAuto)(e);return'<pre class="hljs language-'+ct.utils.escapeHtml(n.language)+'"><code>'+n.value+"</code></pre>"}return'<pre class="hljs"><code>'+ct.utils.escapeHtml(e)+"</code></pre>"}}).use(xd()).use(cs(),"warning").use(cs(),"tip").use(Fd()).use(Ad()).use($d()).use(Nd()).use(qd()).use(zd()).use(Hd());ct.renderer.rules.footnote_ref=(e,t,n,s,a)=>{const l=a.rules.footnote_caption(e,t,n,s,a);return'<sup class="footnote-ref"><span>'+l+"</span></sup>"},ct.renderer.rules.footnote_anchor=()=>' <span class="footnote-backref">\u21A9\uFE0E</span>';const Zd=ct;var _d=p(13993),us=p.n(_d),Qd=Object.defineProperty,Kd=Object.defineProperties,Yd=Object.getOwnPropertyDescriptors,ds=Object.getOwnPropertySymbols,Jd=Object.prototype.hasOwnProperty,Xd=Object.prototype.propertyIsEnumerable,ps=(e,t,n)=>t in e?Qd(e,t,{enumerable:!0,configurable:!0,writable:!0,value:n}):e[t]=n,ep=(e,t)=>{for(var n in t||(t={}))Jd.call(t,n)&&ps(e,n,t[n]);if(ds)for(var n of ds(t))Xd.call(t,n)&&ps(e,n,t[n]);return e},tp=(e,t)=>Kd(e,Yd(t));const np=tp(ep({},us().defaults),{allowedTags:!1,allowedAttributes:{"*":["href","align","alt","center","width","height","type","controls","target"],img:["src","alt"],source:["src","type"]}}),rp=e=>us()(e,np),op=k.default.div`
|
|
140
|
-
position: absolute;
|
|
141
|
-
top: 0;
|
|
142
|
-
width: 100%;
|
|
143
|
-
height: 100%;
|
|
144
|
-
overflow: auto;
|
|
145
|
-
padding: ${({theme:e})=>`${e.spaces[3]} ${e.spaces[4]}`};
|
|
146
|
-
font-size: ${14/16}rem;
|
|
147
|
-
background-color: ${({theme:e})=>e.colors.neutral0};
|
|
148
|
-
z-index: 2;
|
|
149
|
-
cursor: not-allowed;
|
|
150
|
-
color: ${({theme:e})=>e.colors.neutral800};
|
|
151
|
-
|
|
152
|
-
h1,
|
|
153
|
-
h2,
|
|
154
|
-
h3,
|
|
155
|
-
h4,
|
|
156
|
-
h5,
|
|
157
|
-
h6 {
|
|
158
|
-
margin-block-start: 10px;
|
|
159
|
-
margin-block-end: 10px;
|
|
160
|
-
}
|
|
161
|
-
|
|
162
|
-
p {
|
|
163
|
-
margin-bottom: 10px;
|
|
164
|
-
}
|
|
165
|
-
|
|
166
|
-
h1 {
|
|
167
|
-
font-size: ${36/16}rem;
|
|
168
|
-
font-weight: 600;
|
|
169
|
-
}
|
|
170
|
-
|
|
171
|
-
h2 {
|
|
172
|
-
font-size: ${30/16}rem;
|
|
173
|
-
font-weight: 500;
|
|
174
|
-
}
|
|
175
|
-
|
|
176
|
-
h3 {
|
|
177
|
-
font-size: ${24/16}rem;
|
|
178
|
-
font-weight: 500;
|
|
179
|
-
}
|
|
180
|
-
|
|
181
|
-
h4 {
|
|
182
|
-
font-size: ${20/16}rem;
|
|
183
|
-
font-weight: 500;
|
|
184
|
-
}
|
|
185
|
-
|
|
186
|
-
strong {
|
|
187
|
-
font-weight: 800;
|
|
188
|
-
}
|
|
189
|
-
|
|
190
|
-
em {
|
|
191
|
-
font-style: italic;
|
|
192
|
-
}
|
|
193
|
-
|
|
194
|
-
blockquote {
|
|
195
|
-
margin-top: 41px;
|
|
196
|
-
margin-bottom: 34px;
|
|
197
|
-
font-size: ${14/16}rem;
|
|
198
|
-
font-weight: 400;
|
|
199
|
-
border-left: 5px solid #eee;
|
|
200
|
-
font-style: italic;
|
|
201
|
-
padding: 10px 20px;
|
|
202
|
-
}
|
|
203
|
-
|
|
204
|
-
img {
|
|
205
|
-
max-width: 100%;
|
|
206
|
-
}
|
|
207
|
-
|
|
208
|
-
table {
|
|
209
|
-
thead {
|
|
210
|
-
background: ${({theme:e})=>e.colors.neutral150};
|
|
211
|
-
|
|
212
|
-
th {
|
|
213
|
-
padding: ${({theme:e})=>e.spaces[4]};
|
|
214
|
-
}
|
|
215
|
-
}
|
|
216
|
-
tr {
|
|
217
|
-
border: 1px solid ${({theme:e})=>e.colors.neutral200};
|
|
218
|
-
}
|
|
219
|
-
th,
|
|
220
|
-
td {
|
|
221
|
-
padding: ${({theme:e})=>e.spaces[4]};
|
|
222
|
-
border: 1px solid ${({theme:e})=>e.colors.neutral200};
|
|
223
|
-
border-bottom: 0;
|
|
224
|
-
border-top: 0;
|
|
225
|
-
}
|
|
226
|
-
}
|
|
227
|
-
|
|
228
|
-
pre,
|
|
229
|
-
code {
|
|
230
|
-
font-size: 13px;
|
|
231
|
-
border-radius: 3px;
|
|
232
|
-
background-color: #002b36;
|
|
233
|
-
}
|
|
234
|
-
|
|
235
|
-
/* Inline code */
|
|
236
|
-
p,
|
|
237
|
-
pre,
|
|
238
|
-
td {
|
|
239
|
-
> code {
|
|
240
|
-
color: #839496;
|
|
241
|
-
}
|
|
242
|
-
}
|
|
243
|
-
|
|
244
|
-
.warning {
|
|
245
|
-
background-color: #faa684;
|
|
246
|
-
padding: 30px;
|
|
247
|
-
border-radius: 3px;
|
|
248
|
-
}
|
|
249
|
-
.tip {
|
|
250
|
-
padding: 30px;
|
|
251
|
-
border-radius: 3px;
|
|
252
|
-
}
|
|
253
|
-
|
|
254
|
-
.footnote-ref,
|
|
255
|
-
.footnote-backref {
|
|
256
|
-
color: #007bff;
|
|
257
|
-
}
|
|
258
|
-
|
|
259
|
-
ol {
|
|
260
|
-
list-style-type: decimal;
|
|
261
|
-
margin-block-start: ${({theme:e})=>e.spaces[4]};
|
|
262
|
-
margin-block-end: ${({theme:e})=>e.spaces[4]};
|
|
263
|
-
margin-inline-start: 0px;
|
|
264
|
-
margin-inline-end: 0px;
|
|
265
|
-
padding-inline-start: ${({theme:e})=>e.spaces[4]};
|
|
266
|
-
ol,
|
|
267
|
-
ul {
|
|
268
|
-
margin-block-start: 0px;
|
|
269
|
-
margin-block-end: 0px;
|
|
270
|
-
}
|
|
271
|
-
}
|
|
272
|
-
|
|
273
|
-
ul {
|
|
274
|
-
list-style-type: disc;
|
|
275
|
-
margin-block-start: ${({theme:e})=>e.spaces[4]};
|
|
276
|
-
margin-block-end: ${({theme:e})=>e.spaces[4]};
|
|
277
|
-
margin-inline-start: 0px;
|
|
278
|
-
margin-inline-end: 0px;
|
|
279
|
-
padding-inline-start: ${({theme:e})=>e.spaces[4]};
|
|
280
|
-
ul,
|
|
281
|
-
ol {
|
|
282
|
-
margin-block-start: 0px;
|
|
283
|
-
margin-block-end: 0px;
|
|
284
|
-
}
|
|
285
|
-
}
|
|
286
|
-
`,Fn=({data:e})=>{const t=(0,r.useMemo)(()=>rp(Zd.render(e||"")),[e]);return r.createElement(op,null,r.createElement("div",{dangerouslySetInnerHTML:{__html:t}}))};Fn.defaultProps={data:""},Fn.propTypes={data:o().string};const ms=(0,r.memo)(Fn),sp=k.default.div`
|
|
287
|
-
cursor: ${({disabled:e})=>e?"not-allowed !important":"auto"};
|
|
288
|
-
height: 100%;
|
|
289
|
-
/* BASICS */
|
|
290
|
-
.CodeMirror-placeholder {
|
|
291
|
-
color: ${({theme:e})=>e.colors.neutral600} !important;
|
|
292
|
-
}
|
|
293
|
-
|
|
294
|
-
.CodeMirror {
|
|
295
|
-
/* Set height, width, borders, and global font properties here */
|
|
296
|
-
font-size: ${14/16}rem;
|
|
297
|
-
height: ${({isExpandMode:e})=>e?"100%":"290px"};
|
|
298
|
-
color: ${({theme:e})=>e.colors.neutral800};
|
|
299
|
-
direction: ltr;
|
|
300
|
-
font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Oxygen, Ubuntu, Cantarell,
|
|
301
|
-
'Open Sans', 'Helvetica Neue', sans-serif;
|
|
302
|
-
}
|
|
303
|
-
|
|
304
|
-
/* PADDING */
|
|
305
|
-
|
|
306
|
-
.CodeMirror-lines {
|
|
307
|
-
padding: ${({theme:e})=>`${e.spaces[3]} ${e.spaces[4]}`};
|
|
308
|
-
/* Vertical padding around content */
|
|
309
|
-
}
|
|
310
|
-
|
|
311
|
-
.CodeMirror-scrollbar-filler,
|
|
312
|
-
.CodeMirror-gutter-filler {
|
|
313
|
-
/* The little square between H and V scrollbars */
|
|
314
|
-
background-color: ${({theme:e})=>`${e.colors.neutral0}`};
|
|
315
|
-
}
|
|
316
|
-
|
|
317
|
-
/* GUTTER */
|
|
318
|
-
|
|
319
|
-
.CodeMirror-gutters {
|
|
320
|
-
border-right: 1px solid #ddd;
|
|
321
|
-
background-color: #f7f7f7;
|
|
322
|
-
white-space: nowrap;
|
|
323
|
-
}
|
|
324
|
-
.CodeMirror-linenumbers {
|
|
325
|
-
}
|
|
326
|
-
.CodeMirror-linenumber {
|
|
327
|
-
padding: 0 3px 0 5px;
|
|
328
|
-
min-width: 20px;
|
|
329
|
-
text-align: right;
|
|
330
|
-
color: #999;
|
|
331
|
-
white-space: nowrap;
|
|
332
|
-
}
|
|
333
|
-
|
|
334
|
-
.CodeMirror-guttermarker {
|
|
335
|
-
color: black;
|
|
336
|
-
}
|
|
337
|
-
.CodeMirror-guttermarker-subtle {
|
|
338
|
-
color: #999;
|
|
339
|
-
}
|
|
340
|
-
|
|
341
|
-
/* CURSOR */
|
|
342
|
-
|
|
343
|
-
.CodeMirror-cursor {
|
|
344
|
-
border-left: 1px solid black;
|
|
345
|
-
border-right: none;
|
|
346
|
-
width: 0;
|
|
347
|
-
}
|
|
348
|
-
/* Shown when moving in bi-directional text */
|
|
349
|
-
.CodeMirror div.CodeMirror-secondarycursor {
|
|
350
|
-
border-left: 1px solid silver;
|
|
351
|
-
}
|
|
352
|
-
.cm-fat-cursor .CodeMirror-cursor {
|
|
353
|
-
width: auto;
|
|
354
|
-
border: 0 !important;
|
|
355
|
-
background: #7e7;
|
|
356
|
-
}
|
|
357
|
-
.cm-fat-cursor div.CodeMirror-cursors {
|
|
358
|
-
/* z-index: 1; */
|
|
359
|
-
}
|
|
360
|
-
|
|
361
|
-
.cm-fat-cursor-mark {
|
|
362
|
-
background-color: rgba(20, 255, 20, 0.5);
|
|
363
|
-
-webkit-animation: blink 1.06s steps(1) infinite;
|
|
364
|
-
-moz-animation: blink 1.06s steps(1) infinite;
|
|
365
|
-
animation: blink 1.06s steps(1) infinite;
|
|
366
|
-
}
|
|
367
|
-
.cm-animate-fat-cursor {
|
|
368
|
-
width: auto;
|
|
369
|
-
border: 0;
|
|
370
|
-
-webkit-animation: blink 1.06s steps(1) infinite;
|
|
371
|
-
-moz-animation: blink 1.06s steps(1) infinite;
|
|
372
|
-
animation: blink 1.06s steps(1) infinite;
|
|
373
|
-
background-color: #7e7;
|
|
374
|
-
}
|
|
375
|
-
|
|
376
|
-
/* Can style cursor different in overwrite (non-insert) mode */
|
|
377
|
-
.CodeMirror-overwrite .CodeMirror-cursor {
|
|
378
|
-
}
|
|
379
|
-
|
|
380
|
-
.cm-tab {
|
|
381
|
-
display: inline-block;
|
|
382
|
-
text-decoration: inherit;
|
|
383
|
-
}
|
|
384
|
-
|
|
385
|
-
.CodeMirror-rulers {
|
|
386
|
-
position: absolute;
|
|
387
|
-
left: 0;
|
|
388
|
-
right: 0;
|
|
389
|
-
top: -50px;
|
|
390
|
-
bottom: 0;
|
|
391
|
-
overflow: hidden;
|
|
392
|
-
}
|
|
393
|
-
.CodeMirror-ruler {
|
|
394
|
-
border-left: 1px solid #ccc;
|
|
395
|
-
top: 0;
|
|
396
|
-
bottom: 0;
|
|
397
|
-
position: absolute;
|
|
398
|
-
}
|
|
399
|
-
|
|
400
|
-
/* DEFAULT THEME */
|
|
401
|
-
|
|
402
|
-
.cm-header,
|
|
403
|
-
.cm-strong {
|
|
404
|
-
font-weight: bold;
|
|
405
|
-
}
|
|
406
|
-
.cm-em {
|
|
407
|
-
font-style: italic;
|
|
408
|
-
}
|
|
409
|
-
.cm-link {
|
|
410
|
-
text-decoration: underline;
|
|
411
|
-
}
|
|
412
|
-
.cm-strikethrough {
|
|
413
|
-
text-decoration: line-through;
|
|
414
|
-
}
|
|
415
|
-
|
|
416
|
-
.CodeMirror-composing {
|
|
417
|
-
border-bottom: 2px solid;
|
|
418
|
-
}
|
|
419
|
-
|
|
420
|
-
/* Default styles for common addons */
|
|
421
|
-
|
|
422
|
-
div.CodeMirror span.CodeMirror-matchingbracket {
|
|
423
|
-
color: #0b0;
|
|
424
|
-
}
|
|
425
|
-
div.CodeMirror span.CodeMirror-nonmatchingbracket {
|
|
426
|
-
color: #a22;
|
|
427
|
-
}
|
|
428
|
-
.CodeMirror-matchingtag {
|
|
429
|
-
background: rgba(255, 150, 0, 0.3);
|
|
430
|
-
}
|
|
431
|
-
.CodeMirror-activeline-background {
|
|
432
|
-
background: #e8f2ff;
|
|
433
|
-
}
|
|
434
|
-
|
|
435
|
-
/* STOP */
|
|
436
|
-
|
|
437
|
-
/* The rest of this file contains styles related to the mechanics of
|
|
438
|
-
the editor. You probably shouldn't touch them. */
|
|
439
|
-
|
|
440
|
-
.CodeMirror {
|
|
441
|
-
position: relative;
|
|
442
|
-
overflow: hidden;
|
|
443
|
-
background: ${({theme:e})=>`${e.colors.neutral0}`};
|
|
444
|
-
}
|
|
445
|
-
|
|
446
|
-
.CodeMirror-scroll {
|
|
447
|
-
overflow: scroll !important; /* Things will break if this is overridden */
|
|
448
|
-
/* 50px is the magic margin used to hide the element's real scrollbars */
|
|
449
|
-
/* See overflow: hidden in .CodeMirror */
|
|
450
|
-
margin-bottom: -50px;
|
|
451
|
-
margin-right: -50px;
|
|
452
|
-
padding-bottom: 50px;
|
|
453
|
-
height: 100%;
|
|
454
|
-
outline: none; /* Prevent dragging from highlighting the element */
|
|
455
|
-
position: relative;
|
|
456
|
-
}
|
|
457
|
-
.CodeMirror-sizer {
|
|
458
|
-
position: relative;
|
|
459
|
-
border-right: 50px solid transparent;
|
|
460
|
-
}
|
|
461
|
-
|
|
462
|
-
/* The fake, visible scrollbars. Used to force redraw during scrolling
|
|
463
|
-
before actual scrolling happens, thus preventing shaking and
|
|
464
|
-
flickering artifacts. */
|
|
465
|
-
.CodeMirror-vscrollbar,
|
|
466
|
-
.CodeMirror-hscrollbar,
|
|
467
|
-
.CodeMirror-scrollbar-filler,
|
|
468
|
-
.CodeMirror-gutter-filler {
|
|
469
|
-
position: absolute;
|
|
470
|
-
z-index: 1;
|
|
471
|
-
display: none;
|
|
472
|
-
outline: none;
|
|
473
|
-
}
|
|
474
|
-
|
|
475
|
-
.CodeMirror-vscrollbar {
|
|
476
|
-
right: 0;
|
|
477
|
-
top: 0;
|
|
478
|
-
overflow-x: hidden;
|
|
479
|
-
overflow-y: scroll;
|
|
480
|
-
}
|
|
481
|
-
.CodeMirror-hscrollbar {
|
|
482
|
-
bottom: 0;
|
|
483
|
-
left: 0;
|
|
484
|
-
overflow-y: hidden;
|
|
485
|
-
overflow-x: scroll;
|
|
486
|
-
}
|
|
487
|
-
.CodeMirror-scrollbar-filler {
|
|
488
|
-
right: 0;
|
|
489
|
-
bottom: 0;
|
|
490
|
-
}
|
|
491
|
-
|
|
492
|
-
.CodeMirror-lines {
|
|
493
|
-
cursor: text;
|
|
494
|
-
min-height: 1px; /* prevents collapsing before first draw */
|
|
495
|
-
}
|
|
496
|
-
/* Reset some styles that the rest of the page might have set */
|
|
497
|
-
.CodeMirror pre.CodeMirror-line,
|
|
498
|
-
.CodeMirror pre.CodeMirror-line-like {
|
|
499
|
-
-moz-border-radius: 0;
|
|
500
|
-
-webkit-border-radius: 0;
|
|
501
|
-
border-radius: 0;
|
|
502
|
-
border-width: 0;
|
|
503
|
-
background: transparent;
|
|
504
|
-
font-family: inherit;
|
|
505
|
-
font-size: inherit;
|
|
506
|
-
margin: 0;
|
|
507
|
-
white-space: pre;
|
|
508
|
-
word-wrap: normal;
|
|
509
|
-
line-height: 1.5;
|
|
510
|
-
color: inherit;
|
|
511
|
-
/* z-index: 2; */
|
|
512
|
-
position: relative;
|
|
513
|
-
overflow: visible;
|
|
514
|
-
-webkit-tap-highlight-color: transparent;
|
|
515
|
-
-webkit-font-variant-ligatures: contextual;
|
|
516
|
-
font-variant-ligatures: contextual;
|
|
517
|
-
}
|
|
518
|
-
|
|
519
|
-
.CodeMirror pre.CodeMirror-line-like {
|
|
520
|
-
z-index: 2;
|
|
521
|
-
}
|
|
522
|
-
|
|
523
|
-
.CodeMirror-wrap pre.CodeMirror-line,
|
|
524
|
-
.CodeMirror-wrap pre.CodeMirror-line-like {
|
|
525
|
-
word-wrap: break-word;
|
|
526
|
-
white-space: pre-wrap;
|
|
527
|
-
word-break: normal;
|
|
528
|
-
}
|
|
529
|
-
|
|
530
|
-
.CodeMirror-linebackground {
|
|
531
|
-
position: absolute;
|
|
532
|
-
left: 0;
|
|
533
|
-
right: 0;
|
|
534
|
-
top: 0;
|
|
535
|
-
bottom: 0;
|
|
536
|
-
z-index: 0;
|
|
537
|
-
}
|
|
538
|
-
|
|
539
|
-
.CodeMirror-linewidget {
|
|
540
|
-
position: relative;
|
|
541
|
-
/* z-index: 2; */
|
|
542
|
-
padding: 0.1px; /* Force widget margins to stay inside of the container */
|
|
543
|
-
}
|
|
544
|
-
|
|
545
|
-
.CodeMirror-widget {
|
|
546
|
-
}
|
|
547
|
-
|
|
548
|
-
.CodeMirror-rtl pre {
|
|
549
|
-
direction: rtl;
|
|
550
|
-
}
|
|
551
|
-
|
|
552
|
-
.CodeMirror-code {
|
|
553
|
-
outline: none;
|
|
554
|
-
}
|
|
555
|
-
|
|
556
|
-
/* Force content-box sizing for the elements where we expect it */
|
|
557
|
-
.CodeMirror-scroll,
|
|
558
|
-
.CodeMirror-sizer,
|
|
559
|
-
.CodeMirror-gutter,
|
|
560
|
-
.CodeMirror-gutters,
|
|
561
|
-
.CodeMirror-linenumber {
|
|
562
|
-
-moz-box-sizing: content-box;
|
|
563
|
-
box-sizing: content-box;
|
|
564
|
-
}
|
|
565
|
-
|
|
566
|
-
.CodeMirror-measure {
|
|
567
|
-
position: absolute;
|
|
568
|
-
width: 100%;
|
|
569
|
-
height: 0;
|
|
570
|
-
overflow: hidden;
|
|
571
|
-
visibility: hidden;
|
|
572
|
-
}
|
|
573
|
-
|
|
574
|
-
.CodeMirror-cursor {
|
|
575
|
-
position: absolute;
|
|
576
|
-
pointer-events: none;
|
|
577
|
-
border-color: ${({theme:e})=>`${e.colors.neutral800}`};
|
|
578
|
-
}
|
|
579
|
-
.CodeMirror-measure pre {
|
|
580
|
-
position: static;
|
|
581
|
-
}
|
|
582
|
-
|
|
583
|
-
div.CodeMirror-cursors {
|
|
584
|
-
visibility: hidden;
|
|
585
|
-
position: relative;
|
|
586
|
-
+ div {
|
|
587
|
-
z-index: 0 !important;
|
|
588
|
-
}
|
|
589
|
-
}
|
|
590
|
-
|
|
591
|
-
div.CodeMirror-dragcursors {
|
|
592
|
-
visibility: visible;
|
|
593
|
-
}
|
|
594
|
-
|
|
595
|
-
.CodeMirror-focused div.CodeMirror-cursors {
|
|
596
|
-
visibility: visible;
|
|
597
|
-
}
|
|
598
|
-
|
|
599
|
-
.CodeMirror-selected {
|
|
600
|
-
background: ${({theme:e})=>e.colors.neutral200};
|
|
601
|
-
/* z-index: -10; */
|
|
602
|
-
}
|
|
603
|
-
.CodeMirror-crosshair {
|
|
604
|
-
cursor: crosshair;
|
|
605
|
-
}
|
|
606
|
-
|
|
607
|
-
/* Used to force a border model for a node */
|
|
608
|
-
.cm-force-border {
|
|
609
|
-
padding-right: 0.1px;
|
|
610
|
-
}
|
|
611
|
-
|
|
612
|
-
/* See issue #2901 */
|
|
613
|
-
.cm-tab-wrap-hack:after {
|
|
614
|
-
content: '';
|
|
615
|
-
}
|
|
616
|
-
|
|
617
|
-
/* Help users use markselection to safely style text background */
|
|
618
|
-
span.CodeMirror-selectedtext {
|
|
619
|
-
background: none;
|
|
620
|
-
}
|
|
621
|
-
|
|
622
|
-
span {
|
|
623
|
-
color: ${({theme:e})=>e.colors.neutral800} !important;
|
|
624
|
-
}
|
|
625
|
-
`,Le=(0,k.default)(Me.IconButton)`
|
|
626
|
-
padding: ${({theme:e})=>e.spaces[2]};
|
|
627
|
-
/* Trick to prevent the outline from overflowing because of the general outline-offset */
|
|
628
|
-
outline-offset: -2px !important;
|
|
629
|
-
|
|
630
|
-
svg {
|
|
631
|
-
width: ${18/16}rem;
|
|
632
|
-
height: ${18/16}rem;
|
|
633
|
-
}
|
|
634
|
-
`,ap=(0,k.default)(Le)`
|
|
635
|
-
svg {
|
|
636
|
-
width: ${8/16}rem;
|
|
637
|
-
height: ${8/16}rem;
|
|
638
|
-
}
|
|
639
|
-
`,fs=(0,k.default)(Me.IconButtonGroup)`
|
|
640
|
-
margin-left: ${({theme:e})=>e.spaces[4]};
|
|
641
|
-
`,gs=(0,k.default)(Me.IconButton)`
|
|
642
|
-
margin: ${({theme:e})=>`0 ${e.spaces[2]}`};
|
|
643
|
-
padding: ${({theme:e})=>e.spaces[2]};
|
|
644
|
-
|
|
645
|
-
svg {
|
|
646
|
-
width: ${18/16}rem;
|
|
647
|
-
height: ${18/16}rem;
|
|
648
|
-
}
|
|
649
|
-
`,ip=(0,k.default)(Me.IconButtonGroup)`
|
|
650
|
-
margin-right: ${({theme:e})=>`${e.spaces[2]}`};
|
|
651
|
-
`,lp=k.default.div`
|
|
652
|
-
position: relative;
|
|
653
|
-
height: calc(100% - 48px);
|
|
654
|
-
`,cp=(0,k.default)(Mn.BaseButton)`
|
|
655
|
-
background-color: transparent;
|
|
656
|
-
border: none;
|
|
657
|
-
align-items: center;
|
|
658
|
-
|
|
659
|
-
svg {
|
|
660
|
-
margin-left: ${({theme:e})=>`${e.spaces[2]}`};
|
|
661
|
-
path {
|
|
662
|
-
fill: ${({theme:e})=>e.colors.neutral700};
|
|
663
|
-
width: ${12/16}rem;
|
|
664
|
-
height: ${12/16}rem;
|
|
665
|
-
}
|
|
666
|
-
}
|
|
667
|
-
`;var Qt=/^(\s*)(>[> ]*|[*+-] \[[x ]\]\s|[*+-]\s|(\d+)([.)]))(\s*)/,up=/^(\s*)(>[> ]*|[*+-] \[[x ]\]|[*+-]|(\d+)[.)])(\s*)$/,dp=/[*+-]\s/;function pp(e){if(e.getOption("disableInput"))return _t().Pass;for(var t=e.listSelections(),n=[],s=0;s<t.length;s++){var a=t[s].head,l=e.getStateAfter(a.line),i=l.list!==!1,u=l.quote!==0,c=e.getLine(a.line),d=Qt.exec(c),m=/^\s*$/.test(c.slice(0,a.ch));if(!t[s].empty()||!i&&!u||!d||m){e.execCommand("newlineAndIndent");return}if(up.test(c)){var f=u&&/>\s*$/.test(c),g=!/>\s*$/.test(c);(f||g)&&e.replaceRange("",{line:a.line,ch:0},{line:a.line,ch:a.ch+1}),n[s]=`
|
|
668
|
-
`}else{var h=d[1],b=d[5],E=!(dp.test(d[2])||d[2].indexOf(">")>=0),x=E?parseInt(d[3],10)+1+d[4]:d[2].replace("x"," ");n[s]=`
|
|
669
|
-
`+h+x+b,E&&mp(e,a)}}e.replaceSelections(n)}function mp(e,t){var n=t.line,s=0,a=0,l=Qt.exec(e.getLine(n)),i=l[1];do{s+=1;var u=n+s,c=e.getLine(u),d=Qt.exec(c);if(d){var m=d[1],f=parseInt(l[3],10)+s-a,g=parseInt(d[3],10),h=g;if(i===m&&!isNaN(g))f===g&&(h=g+1),f>g&&(h=f+1),e.replaceRange(c.replace(Qt,m+h+d[4]+d[5]),{line:u,ch:0},{line:u,ch:c.length});else{if(i.length>m.length||i.length<m.length&&s===1)return;a+=1}}}while(d)}const fp=pp,kn=({disabled:e,editorRef:t,error:n,isPreviewMode:s,isExpandMode:a,name:l,onChange:i,placeholder:u,textareaRef:c,value:d})=>{const m=(0,r.useRef)(i);return(0,r.useEffect)(()=>{t.current=_t().fromTextArea(c.current,{lineWrapping:!0,extraKeys:{Enter:"newlineAndIndentContinueMarkdownList",Tab:!1,"Shift-Tab":!1},readOnly:!1,smartIndent:!1,placeholder:u,spellcheck:!0,inputStyle:"contenteditable"}),_t().commands.newlineAndIndentContinueMarkdownList=fp,t.current.on("change",f=>{m.current({target:{name:l,value:f.getValue(),type:"wysiwyg"}})})},[t,c,l,u]),(0,r.useEffect)(()=>{d&&!t.current.state.focused&&t.current.setValue(d)},[t,d]),(0,r.useEffect)(()=>{s||e?t.current.setOption("readOnly","nocursor"):t.current.setOption("readOnly",!1)},[e,s,t]),(0,r.useEffect)(()=>{n?t.current.setOption("screenReaderLabel",n):t.current.setOption("screenReaderLabel","Editor")},[t,n]),r.createElement(lp,null,r.createElement(sp,{isExpandMode:a,disabled:e||s},r.createElement("textarea",{ref:c})),s&&r.createElement(ms,{data:d}))};kn.defaultProps={disabled:!1,error:void 0,isPreviewMode:!1,isExpandMode:!1,placeholder:"",value:""},kn.propTypes={disabled:o().bool,editorRef:o().shape({current:o().any}).isRequired,error:o().string,isPreviewMode:o().bool,isExpandMode:o().bool,name:o().string.isRequired,onChange:o().func.isRequired,placeholder:o().string,textareaRef:o().shape({current:o().any}).isRequired,value:o().string};const gp=kn;var ye=p(44526),ce=p(25716),yp=p(37853),hp=p(19882),ys=p.n(hp),bp=p(61980),hs=p.n(bp),Ep=p(70052),bs=p.n(Ep),vp=p(15053),Cp=p.n(vp),Pp=p(18767),Op=p.n(Pp),Rp=p(83358),Mp=p.n(Rp),Tp=p(69822),wp=p.n(Tp),Ip=p(88467),Dp=p.n(Ip),xp=p(83262),Sp=p.n(xp),Lp=p(49157),Fp=p.n(Lp),kp=p(75400),Es=p.n(kp);const An=({disabled:e,editorRef:t,isExpandMode:n,isPreviewMode:s,onActionClick:a,onToggleMediaLib:l,onTogglePreviewMode:i})=>{const[u,c]=(0,r.useState)(!1),{formatMessage:d}=(0,A.useIntl)(),m=d({id:"components.Wysiwyg.selectOptions.title",defaultMessage:"Add a title"}),f=(0,r.useRef)(),g=()=>{c(h=>!h)};return e||s?r.createElement(D.Box,{padding:2,background:"neutral100"},r.createElement(j.Flex,{justifyContent:"space-between"},r.createElement(j.Flex,null,r.createElement(ce.Select,{disabled:!0,id:"selectTitle",placeholder:m,size:"S","aria-label":m},r.createElement(ce.Option,{value:"h1"},"h1"),r.createElement(ce.Option,{value:"h2"},"h2"),r.createElement(ce.Option,{value:"h3"},"h3"),r.createElement(ce.Option,{value:"h4"},"h4"),r.createElement(ce.Option,{value:"h5"},"h5"),r.createElement(ce.Option,{value:"h6"},"h6")),r.createElement(fs,null,r.createElement(Le,{disabled:!0,id:"Bold",label:"Bold",name:"Bold",icon:r.createElement(ys(),null)}),r.createElement(Le,{disabled:!0,id:"Italic",label:"Italic",name:"Italic",icon:r.createElement(hs(),null)}),r.createElement(Le,{disabled:!0,id:"Underline",label:"Underline",name:"Underline",icon:r.createElement(bs(),null)})),r.createElement(gs,{disabled:!0,id:"more",label:"More",icon:r.createElement(Es(),null)})),!n&&r.createElement(ye.Button,{onClick:i,variant:"tertiary",id:"preview"},d({id:"components.Wysiwyg.ToggleMode.markdown-mode",defaultMessage:"Markdown mode"})))):r.createElement(D.Box,{padding:2,background:"neutral100"},r.createElement(j.Flex,{justifyContent:"space-between"},r.createElement(j.Flex,null,r.createElement(ce.Select,{id:"selectTitle",placeholder:m,size:"S",onChange:h=>a(h,t)},r.createElement(ce.Option,{value:"h1"},"h1"),r.createElement(ce.Option,{value:"h2"},"h2"),r.createElement(ce.Option,{value:"h3"},"h3"),r.createElement(ce.Option,{value:"h4"},"h4"),r.createElement(ce.Option,{value:"h5"},"h5"),r.createElement(ce.Option,{value:"h6"},"h6")),r.createElement(fs,null,r.createElement(Le,{onClick:()=>a("Bold",t),id:"Bold",label:"Bold",name:"Bold",icon:r.createElement(ys(),null)}),r.createElement(Le,{onClick:()=>a("Italic",t),id:"Italic",label:"Italic",name:"Italic",icon:r.createElement(hs(),null)}),r.createElement(Le,{onClick:()=>a("Underline",t),id:"Underline",label:"Underline",name:"Underline",icon:r.createElement(bs(),null)})),r.createElement(gs,{ref:f,onClick:g,id:"more",label:"More",icon:r.createElement(Es(),null)}),u&&r.createElement(yp.Popover,{centered:!0,source:f,spacing:4,id:"popover"},r.createElement(xn.FocusTrap,{onEscape:g,restoreFocus:!1},r.createElement(j.Flex,null,r.createElement(ip,null,r.createElement(Le,{onClick:()=>a("Strikethrough",t,g),id:"Strikethrough",label:"Strikethrough",name:"Strikethrough",icon:r.createElement(Cp(),null)}),r.createElement(Le,{onClick:()=>a("BulletList",t,g),id:"BulletList",label:"BulletList",name:"BulletList",icon:r.createElement(Op(),null)}),r.createElement(Le,{onClick:()=>a("NumberList",t,g),id:"NumberList",label:"NumberList",name:"NumberList",icon:r.createElement(Mp(),null)})),r.createElement(Me.IconButtonGroup,null,r.createElement(Le,{onClick:()=>a("Code",t,g),id:"Code",label:"Code",name:"Code",icon:r.createElement(wp(),null)}),r.createElement(Le,{onClick:()=>{g(),l()},id:"Image",label:"Image",name:"Image",icon:r.createElement(Dp(),null)}),r.createElement(ap,{onClick:()=>a("Link",t,g),id:"Link",label:"Link",name:"Link",icon:r.createElement(Sp(),null)}),r.createElement(Le,{onClick:()=>a("Quote",t,g),id:"Quote",label:"Quote",name:"Quote",icon:r.createElement(Fp(),null)})))))),i&&r.createElement(ye.Button,{onClick:i,variant:"tertiary",id:"preview"},d({id:"components.Wysiwyg.ToggleMode.preview-mode",defaultMessage:"Preview mode"}))))};An.defaultProps={isPreviewMode:!1,onActionClick(){},onToggleMediaLib(){},onTogglePreviewMode:void 0},An.propTypes={disabled:o().bool.isRequired,editorRef:o().shape({current:o().any}).isRequired,isExpandMode:o().bool.isRequired,isPreviewMode:o().bool,onActionClick:o().func,onToggleMediaLib:o().func,onTogglePreviewMode:o().func};const Ap=An;var jp=p(39766),$p=p.n(jp);const jn=({onToggleExpand:e})=>{const{formatMessage:t}=(0,A.useIntl)();return r.createElement(D.Box,{padding:2,background:"neutral100",hasRadius:!0},r.createElement(j.Flex,{justifyContent:"flex-end",alignItems:"flex-end"},r.createElement(cp,{id:"expand",onClick:e},r.createElement(L.Typography,null,t({id:"components.WysiwygBottomControls.fullscreen",defaultMessage:"Expand"})),r.createElement($p(),null))))};jn.defaultProps={onToggleExpand(){}},jn.propTypes={onToggleExpand:o().func};const Bp=jn;var Np=Object.defineProperty,vs=Object.getOwnPropertySymbols,Vp=Object.prototype.hasOwnProperty,qp=Object.prototype.propertyIsEnumerable,Cs=(e,t,n)=>t in e?Np(e,t,{enumerable:!0,configurable:!0,writable:!0,value:n}):e[t]=n,Wp=(e,t)=>{for(var n in t||(t={}))Vp.call(t,n)&&Cs(e,n,t[n]);if(vs)for(var n of vs(t))qp.call(t,n)&&Cs(e,n,t[n]);return e};const $n=({id:e,error:t,name:n,description:s})=>{const{formatMessage:a}=(0,A.useIntl)(),l=s?a({id:s.id,defaultMessage:s.defaultMessage},Wp({},s.values)):"";return!l||t?null:r.createElement(L.Typography,{as:"p",variant:"pi",id:`${e||n}-hint`,textColor:"neutral600"},l)};$n.defaultProps={id:void 0,description:void 0,error:void 0},$n.propTypes={description:o().shape({id:o().string.isRequired,defaultMessage:o().string.isRequired,values:o().object}),error:o().string,id:o().string,name:o().string.isRequired};const zp=$n,Ps=(e,t)=>{let n;switch(e){case"Strikethrough":n=`~~${t}~~`;break;case"Bold":n=`**${t}**`;break;case"Italic":n=`_${t}_`;break;case"Underline":n=`<u>${t}</u>`;break;case"Code":n=`\`\`\`
|
|
670
|
-
${t}
|
|
671
|
-
\`\`\``;break;case"Link":n=`[${t}](link)`;break;case"Quote":n=`>${t}`;break;default:n=t}return n},Os=e=>{let t,n={start:e.length,end:0};switch(e){case"Strikethrough":t=`~~${e}~~`,n.end=2;break;case"Bold":t=`**${e}**`,n.end=2;break;case"Italic":t=`_${e}_`,n.end=1;break;case"alt":t=`[${e}]()`,n.end=3;break;case"Underline":t=`<u>${e}</u>`,n.end=4;break;case"Code":t=`\`\`\`
|
|
672
|
-
${e}
|
|
673
|
-
\`\`\``,n.end=3;break;case"Link":t=`[${e}](link)`,n.end=7;break;case"Quote":t=`>${e}`,n.end=0;break;default:t=""}return{editedText:t,selection:n}},Rs=e=>{let t;switch(e){case"BulletList":t="- ";break;case"NumberList":t="1. ";break;case"h1":t="# ";break;case"h2":t="## ";break;case"h3":t="### ";break;case"h4":t="#### ";break;case"h5":t="##### ";break;case"h6":t="###### ";break;default:return""}return t},Ms=(e,t)=>{const n=e.current.getSelection();let s;if(n){const a=Ps(t,n);e.current.replaceSelection(a),e.current.focus()}else{s=Os(t),e.current.replaceSelection(s.editedText),e.current.focus();const{line:a,ch:l}=e.current.getCursor(),i=l-s.selection.end,u=l-s.selection.end-s.selection.start;e.current.setSelection({line:a,ch:u},{line:a,ch:i})}},Up=(e,t)=>{const n=e.current.getDoc(),s=t==="BulletList"?"- ":"1. ";if(n.somethingSelected()){const a=n.listSelections();let l=null;e.current.operation(function(){a.forEach(function(i){const u=[i.head.line,i.anchor.line].sort();l==null&&(l=n.getLine(u[0]).startsWith(s));for(let c=u[0];c<=u[1];c++)if(l)n.getLine(c).startsWith(s)&&n.replaceRange("",{line:c,ch:0},{line:c,ch:s.length});else{const d=t==="BulletList"?"- ":`${c+1}. `;n.replaceRange(d,{line:c,ch:0})}})})}else{let{line:a}=n.getCursor();const l=Rs(t),i=e.current.getLine(a),u=l+i;e.current.setSelection({line:a,ch:0},{line:a,ch:i.length}),e.current.replaceSelection(u)}e.current.focus()},Hp=(e,t)=>{let{line:n}=e.current.getCursor();const s=Rs(t),a=e.current.getLine(n),l=a.replace(/#{1,6}\s/g,"").trim(),i=s+l;e.current.setSelection({line:n,ch:0},{line:n,ch:a.length}),e.current.replaceSelection(i),setTimeout(()=>{const u=e.current.getLine(n).length;e.current.focus(),e.current.setCursor({line:n,ch:u})},0)},Gp=(e,t)=>{let{line:n,ch:s}=e.current.getCursor();t.forEach((a,l)=>{let i=e.current.getLine(n).length;e.current.setCursor({line:n,ch:i}),(l>0||l===0&&s!==0)&&(i=e.current.getLine(n).length,e.current.setCursor({line:n,ch:i}),n++,e.current.replaceSelection(`
|
|
674
|
-
`)),a.mime.includes("image")?e.current.replaceSelection(``):e.current.replaceSelection(`[${a.alt}](${a.url})`)}),setTimeout(()=>e.current.focus(),0)},Zp=(e,t,n,s,a)=>{const l=Ps(t,a),i=e.current.getRange({line:n+1,ch:0},{line:1/0,ch:1/0});if(e.current.replaceRange("",{line:n+1,ch:0},{line:1/0,ch:1/0}),e.current.replaceSelection(""),e.current.setCursor({line:n,ch:s}),e.current.replaceSelection(`
|
|
675
|
-
`),e.current.replaceSelection(l),t==="Code"){let{line:u}=e.current.getCursor();e.current.setCursor({line:u-1,ch:a.length})}e.current.replaceRange(i,{line:n+4,ch:0},{line:1/0,ch:1/0}),e.current.focus()},_p=(e,t,n,s)=>{const a=Os(t),l=e.current.getRange({line:n+1,ch:0},{line:1/0,ch:1/0});if(e.current.replaceRange("",{line:n+1,ch:0},{line:1/0,ch:1/0}),e.current.setCursor({line:n,ch:s}),e.current.replaceSelection(`
|
|
676
|
-
`),e.current.replaceSelection(a.editedText),t==="Code")n+=2,e.current.setSelection({line:n,ch:0},{line:n,ch:4});else{n+=1;let{ch:i}=e.current.getCursor(),u=i-a.selection.end,c=i-a.selection.end-a.selection.start;e.current.setSelection({line:n,ch:c},{line:n,ch:u})}e.current.replaceRange(l,{line:n+2,ch:0},{line:1/0,ch:1/0}),e.current.focus()},Qp=(e,t)=>{const n=e.current.getSelection();let{line:s}=e.current.getCursor(),a=e.current.getLine(s).length;n?Zp(e,t,s,a,n):_p(e,t,s,a)};var Kp=p(64410),Yp=p(43768),Jp=p.n(Yp);const Xp=(e,t)=>`${e}${Math.floor(t*255).toString(16).padStart(2,0)}`,em=(0,k.default)(j.Flex)`
|
|
677
|
-
background: ${({theme:e})=>Xp(e.colors.neutral800,.2)};
|
|
678
|
-
`,tm=(0,k.default)(D.Box)`
|
|
679
|
-
border-right: 1px solid ${({theme:e})=>e.colors.neutral200};
|
|
680
|
-
`,nm=(0,k.default)(Mn.BaseButton)`
|
|
681
|
-
background-color: transparent;
|
|
682
|
-
border: none;
|
|
683
|
-
align-items: center;
|
|
684
|
-
|
|
685
|
-
svg {
|
|
686
|
-
margin-left: ${({theme:e})=>`${e.spaces[2]}`};
|
|
687
|
-
path {
|
|
688
|
-
fill: ${({theme:e})=>e.colors.neutral700};
|
|
689
|
-
width: ${12/16}rem;
|
|
690
|
-
height: ${12/16}rem;
|
|
691
|
-
}
|
|
692
|
-
}
|
|
693
|
-
`,Bn=({children:e,isExpandMode:t,error:n,previewContent:s,onCollapse:a})=>{const{formatMessage:l}=(0,A.useIntl)();return(0,r.useEffect)(()=>{const i=document.body;return t&&i.classList.add("lock-body-scroll"),()=>{t&&i.classList.remove("lock-body-scroll")}},[t]),t?r.createElement(Kp.Portal,{role:"dialog","aria-modal":!1},r.createElement(xn.FocusTrap,{onEscape:a},r.createElement(em,{position:"fixed",top:0,left:0,right:0,bottom:0,zIndex:4,justifyContent:"center",onClick:a},r.createElement(D.Box,{id:"wysiwyg-expand",background:"neutral0",hasRadius:!0,shadow:"popupShadow",overflow:"hidden",width:"70%",height:"70%",onClick:i=>i.stopPropagation()},r.createElement(j.Flex,{height:"100%",alignItems:"flex-start"},r.createElement(tm,{flex:"1",height:"100%"},e),r.createElement(D.Box,{flex:"1",height:"100%"},r.createElement(j.Flex,{height:(0,y.pxToRem)(48),background:"neutral100",justifyContent:"flex-end"},r.createElement(nm,{id:"collapse",onClick:a},r.createElement(L.Typography,null,l({id:"components.Wysiwyg.collapse",defaultMessage:"Collapse"})),r.createElement(Jp(),null))),r.createElement(D.Box,{position:"relative",height:"100%"},r.createElement(ms,{data:s})))))))):r.createElement(D.Box,{borderColor:n?"danger600":"neutral200",borderStyle:"solid",borderWidth:"1px",hasRadius:!0},e)};Bn.defaultProps={error:void 0,previewContent:""},Bn.propTypes={children:o().node.isRequired,error:o().string,isExpandMode:o().bool.isRequired,previewContent:o().string,onCollapse:o().func.isRequired};var rm=Object.defineProperty,Ts=Object.getOwnPropertySymbols,om=Object.prototype.hasOwnProperty,sm=Object.prototype.propertyIsEnumerable,ws=(e,t,n)=>t in e?rm(e,t,{enumerable:!0,configurable:!0,writable:!0,value:n}):e[t]=n,Is=(e,t)=>{for(var n in t||(t={}))om.call(t,n)&&ws(e,n,t[n]);if(Ts)for(var n of Ts(t))sm.call(t,n)&&ws(e,n,t[n]);return e};const am=(0,k.default)(D.Box)`
|
|
694
|
-
svg path {
|
|
695
|
-
fill: ${({theme:e})=>e.colors.neutral500};
|
|
696
|
-
}
|
|
697
|
-
`,im=(0,k.default)(L.Typography)`
|
|
698
|
-
line-height: 0;
|
|
699
|
-
`,Nn=({description:e,disabled:t,error:n,intlLabel:s,labelAction:a,name:l,onChange:i,placeholder:u,value:c,required:d})=>{const{formatMessage:m}=(0,A.useIntl)(),f=(0,r.useRef)(null),g=(0,r.useRef)(null),[h,b]=(0,r.useState)(!1),[E,x]=(0,r.useState)(!1),[P,C]=(0,r.useState)(!1),{components:S}=(0,y.useLibrary)(),I=S["media-library"],W=()=>x(F=>!F),R=()=>b(F=>!F),B=()=>{b(!1),C(F=>!F)},U=(F,Q,$)=>{switch(F){case"Link":case"Strikethrough":{Ms(Q,F),$();break}case"Code":case"Quote":{Qp(Q,F),$();break}case"Bold":case"Italic":case"Underline":{Ms(Q,F);break}case"BulletList":case"NumberList":{Up(Q,F),$();break}case"h1":case"h2":case"h3":case"h4":case"h5":case"h6":{Hp(Q,F);break}default:}},Z=F=>{const Q=F.map($=>({alt:$.alternativeText||$.name,url:(0,y.prefixFileUrlWithBackendUrl)($.url),mime:$.mime}));Gp(g,Q),x(!1)},q=u?m({id:u.id,defaultMessage:u.defaultMessage},Is({},u.values)):"",G=s.id?m({id:s.id,defaultMessage:s.defaultMessage},Is({},s.values)):l;return r.createElement(r.Fragment,null,r.createElement(se.Stack,{spacing:1},r.createElement(se.Stack,{horizontal:!0,spacing:1},r.createElement(L.Typography,{variant:"pi",fontWeight:"bold",textColor:"neutral800"},G,d&&r.createElement(im,{textColor:"danger600"},"*")),a&&r.createElement(am,{paddingLeft:1},a)),r.createElement(Bn,{isExpandMode:P,error:n,previewContent:c,onCollapse:B},r.createElement(Ap,{isExpandMode:P,editorRef:g,isPreviewMode:h,onActionClick:U,onToggleMediaLib:W,onTogglePreviewMode:P?void 0:R,disabled:t}),r.createElement(gp,{disabled:t,isExpandMode:P,editorRef:g,error:n,isPreviewMode:h,name:l,onChange:i,placeholder:q,textareaRef:f,value:c}),!P&&r.createElement(Bp,{onToggleExpand:B})),r.createElement(zp,{description:e,name:l,error:n})),n&&r.createElement(D.Box,{paddingTop:1},r.createElement(L.Typography,{variant:"pi",textColor:"danger600","data-strapi-field-error":!0},n)),E&&r.createElement(I,{onClose:W,onSelectAssets:Z}))};Nn.defaultProps={description:null,disabled:!1,error:"",labelAction:void 0,placeholder:null,required:!1,value:""},Nn.propTypes={description:o().shape({id:o().string.isRequired,defaultMessage:o().string.isRequired,values:o().object}),disabled:o().bool,error:o().string,intlLabel:o().shape({id:o().string.isRequired,defaultMessage:o().string.isRequired,values:o().object}).isRequired,labelAction:o().element,name:o().string.isRequired,onChange:o().func.isRequired,placeholder:o().shape({id:o().string.isRequired,defaultMessage:o().string.isRequired,values:o().object}),required:o().bool,value:o().string};const lm=Nn;var cm=p(16285),um=p.n(cm),Mt=p(20001),dm=p(37475);const pm=k.default.div`
|
|
700
|
-
cursor: ${({disabled:e})=>e?"not-allowed !important":"auto"};
|
|
701
|
-
/* BASICS */
|
|
702
|
-
|
|
703
|
-
.colored {
|
|
704
|
-
background-color: yellow;
|
|
705
|
-
color: black !important;
|
|
706
|
-
}
|
|
707
|
-
|
|
708
|
-
> div {
|
|
709
|
-
border-radius: 3px;
|
|
710
|
-
> div:last-of-type {
|
|
711
|
-
min-height: 253px;
|
|
712
|
-
max-height: 506px;
|
|
713
|
-
}
|
|
714
|
-
}
|
|
715
|
-
|
|
716
|
-
.CodeMirror {
|
|
717
|
-
/* Set height, width, borders, and global font properties here */
|
|
718
|
-
font-size: ${14/16}rem;
|
|
719
|
-
direction: ltr;
|
|
720
|
-
z-index: 0;
|
|
721
|
-
}
|
|
722
|
-
`,mm=(0,k.default)(D.Box)`
|
|
723
|
-
border-radius: ${({theme:e})=>e.borderRadius};
|
|
724
|
-
border: 1px solid ${({theme:e,error:t})=>t?e.colors.danger600:"transparent"};
|
|
725
|
-
`;var fm=Object.defineProperty,Ds=Object.getOwnPropertySymbols,gm=Object.prototype.hasOwnProperty,ym=Object.prototype.propertyIsEnumerable,xs=(e,t,n)=>t in e?fm(e,t,{enumerable:!0,configurable:!0,writable:!0,value:n}):e[t]=n,hm=(e,t)=>{for(var n in t||(t={}))gm.call(t,n)&&xs(e,n,t[n]);if(Ds)for(var n of Ds(t))ym.call(t,n)&&xs(e,n,t[n]);return e};const bm=(0,k.default)(D.Box)`
|
|
726
|
-
svg path {
|
|
727
|
-
fill: ${({theme:e})=>e.colors.neutral500};
|
|
728
|
-
}
|
|
729
|
-
`,Vn=({intlLabel:e,labelAction:t,name:n,required:s})=>{const{formatMessage:a}=(0,A.useIntl)(),l=e!=null&&e.id?a({id:e.id,defaultMessage:e.defaultMessage},hm({},e.values)):n;return r.createElement(j.Flex,null,r.createElement(Mt.FieldLabel,{required:s},l),t&&r.createElement(bm,{paddingLeft:1},t))};Vn.defaultProps={id:void 0,intlLabel:void 0,labelAction:void 0,required:!1},Vn.propTypes={id:o().string,intlLabel:o().shape({id:o().string.isRequired,defaultMessage:o().string.isRequired,values:o().object}),labelAction:o().element,name:o().string.isRequired,required:o().bool};const Em=Vn,qn=({name:e,hint:t,error:n,children:s})=>{const{formatMessage:a}=(0,A.useIntl)(),l=n?a({id:n,defaultMessage:n}):"";return r.createElement(Mt.Field,{name:e,hint:t&&a(t),error:l,id:e},s)};qn.defaultProps={hint:void 0,error:""},qn.propTypes={name:o().string.isRequired,hint:o().shape({id:o().string,defaultMessage:o().string}),error:o().string,children:o().node.isRequired};const vm=qn;var Cm=Object.defineProperty,Pm=(e,t,n)=>t in e?Cm(e,t,{enumerable:!0,configurable:!0,writable:!0,value:n}):e[t]=n,et=(e,t,n)=>(Pm(e,typeof t!="symbol"?t+"":t,n),n),Om=(e,t,n)=>new Promise((s,a)=>{var l=c=>{try{u(n.next(c))}catch(d){a(d)}},i=c=>{try{u(n.throw(c))}catch(d){a(d)}},u=c=>c.done?s(c.value):Promise.resolve(c.value).then(l,i);u((n=n.apply(e,t)).next())});const Rm=600,Mm="blackboard";(()=>Om(void 0,null,function*(){yield p.e(3860).then(p.t.bind(p,87541,23)),yield p.e(2781).then(p.t.bind(p,80249,23)),yield p.e(953).then(p.t.bind(p,54745,23)),yield p.e(5178).then(p.t.bind(p,3903,23)),yield p.e(5509).then(p.t.bind(p,59577,23)),yield p.e(3973).then(p.bind(p,65701)),yield p.e(2218).then(p.bind(p,88333))}))();class Wn extends r.Component{constructor(t){super(t),et(this,"timer",null),et(this,"setInitValue",()=>{const{value:n}=this.props;try{return n===null?this.codeMirror.setValue(""):this.codeMirror.setValue(n)}catch(s){return this.setState({error:!0})}}),et(this,"setSize",()=>this.codeMirror.setSize("100%","auto")),et(this,"getContentAtLine",n=>this.codeMirror.getLine(n)),et(this,"markSelection",({message:n})=>{let s=parseInt(n.split(":")[0].split("line ")[1],10)-1,a=this.getContentAtLine(s);a==="{"&&(s+=1,a=this.getContentAtLine(s));const l=a.length,i=l-um()(a," ").length,u=this.codeMirror.markText({line:s,ch:i},{line:s,ch:l},{className:"colored"});this.setState({markedText:u})}),et(this,"handleChange",(n,s)=>{if(s.origin==="setValue")return;const{name:a,onChange:l}=this.props;let i=n.getValue();i===""&&(i=null),l({target:{name:a,value:i,type:"json"}}),this.state.markedText&&(this.state.markedText.clear(),this.setState({markedText:null,error:null})),clearTimeout(this.timer),this.timer=setTimeout(()=>this.testJSON(n.getValue()),Rm)}),et(this,"testJSON",n=>{try{dm.parse(n)}catch(s){this.markSelection(s)}}),this.editor=r.createRef(),this.state={error:!1,markedText:null}}componentDidMount(){this.codeMirror=_t().fromTextArea(this.editor.current,{autoCloseBrackets:!0,lineNumbers:!0,matchBrackets:!0,mode:"application/json",readOnly:this.props.disabled,smartIndent:!0,styleSelectedText:!0,tabSize:2,theme:Mm,fontSize:"13px"}),this.codeMirror.on("change",this.handleChange),this.setSize(),this.setInitValue()}componentDidUpdate(t){t.value!==this.props.value&&!this.codeMirror.state.focused&&this.setInitValue()}render(){return this.state.error?r.createElement("div",null,"error json"):r.createElement(vm,{name:this.props.name,hint:this.props.description,error:this.props.error},r.createElement(se.Stack,{spacing:1},r.createElement(Em,{intlLabel:this.props.intlLabel,labelAction:this.props.labelAction,name:this.props.name,required:this.props.required}),r.createElement(mm,{error:this.props.error},r.createElement(pm,{disabled:this.props.disabled},r.createElement("textarea",{ref:this.editor,autoComplete:"off",id:this.props.id||this.props.name,defaultValue:""}))),r.createElement(Mt.FieldHint,null),r.createElement(Mt.FieldError,null)))}}Wn.defaultProps={description:null,disabled:!1,id:void 0,error:void 0,intlLabel:void 0,labelAction:void 0,onChange(){},value:null,required:!1},Wn.propTypes={description:o().shape({id:o().string.isRequired,defaultMessage:o().string.isRequired,values:o().object}),disabled:o().bool,error:o().string,id:o().string,intlLabel:o().shape({id:o().string.isRequired,defaultMessage:o().string.isRequired,values:o().object}),labelAction:o().element,name:o().string.isRequired,onChange:o().func,value:o().any,required:o().bool};const Tm=Wn;var zn=p(37178),wm=p(23101),Im=p.n(wm),Dm=p(14356),xm=p.n(Dm),Sm=p(50678),Tt=p.n(Sm),Lm=p(103),Fm=p.n(Lm);const Ss=(e,t)=>{const[n,s]=(0,r.useState)(e);return(0,r.useEffect)(()=>{const a=setTimeout(()=>{s(e)},t);return()=>{clearTimeout(a)}},[e,t]),n},km=/^[A-Za-z0-9-_.~]*$/,Am=(0,k.default)(D.Box)`
|
|
730
|
-
position: relative;
|
|
731
|
-
`,jm=(0,k.default)(Mt.FieldAction)`
|
|
732
|
-
svg {
|
|
733
|
-
height: 1rem;
|
|
734
|
-
width: 1rem;
|
|
735
|
-
path {
|
|
736
|
-
fill: ${({theme:e})=>e.colors.neutral400};
|
|
737
|
-
}
|
|
738
|
-
}
|
|
739
|
-
|
|
740
|
-
svg:hover {
|
|
741
|
-
path {
|
|
742
|
-
fill: ${({theme:e})=>e.colors.primary600};
|
|
743
|
-
}
|
|
744
|
-
}
|
|
745
|
-
`,Un=(0,k.default)(j.Flex)`
|
|
746
|
-
position: absolute;
|
|
747
|
-
right: ${({theme:e})=>e.spaces[6]};
|
|
748
|
-
width: 100px;
|
|
749
|
-
pointer-events: none;
|
|
750
|
-
|
|
751
|
-
svg {
|
|
752
|
-
margin-right: ${({theme:e})=>e.spaces[1]};
|
|
753
|
-
height: ${12/16}rem;
|
|
754
|
-
width: ${12/16}rem;
|
|
755
|
-
path {
|
|
756
|
-
fill: ${({theme:e,notAvailable:t})=>t?e.colors.danger600:e.colors.success600};
|
|
757
|
-
}
|
|
758
|
-
}
|
|
759
|
-
`,$m=k.keyframes`
|
|
760
|
-
from {
|
|
761
|
-
transform: rotate(0deg);
|
|
762
|
-
}
|
|
763
|
-
to {
|
|
764
|
-
transform: rotate(359deg);
|
|
765
|
-
}
|
|
766
|
-
`,Bm=(0,k.default)(j.Flex)`
|
|
767
|
-
animation: ${$m} 2s infinite linear;
|
|
768
|
-
`;var Nm=Object.defineProperty,Ls=Object.getOwnPropertySymbols,Vm=Object.prototype.hasOwnProperty,qm=Object.prototype.propertyIsEnumerable,Fs=(e,t,n)=>t in e?Nm(e,t,{enumerable:!0,configurable:!0,writable:!0,value:n}):e[t]=n,Hn=(e,t)=>{for(var n in t||(t={}))Vm.call(t,n)&&Fs(e,n,t[n]);if(Ls)for(var n of Ls(t))qm.call(t,n)&&Fs(e,n,t[n]);return e},ks=(e,t,n)=>new Promise((s,a)=>{var l=c=>{try{u(n.next(c))}catch(d){a(d)}},i=c=>{try{u(n.throw(c))}catch(d){a(d)}},u=c=>c.done?s(c.value):Promise.resolve(c.value).then(l,i);u((n=n.apply(e,t)).next())});const Gn=({attribute:e,contentTypeUID:t,description:n,disabled:s,error:a,intlLabel:l,labelAction:i,name:u,onChange:c,value:d,placeholder:m,required:f})=>{const{modifiedData:g,initialData:h,layout:b}=(0,y.useCMEditViewDataManager)(),[E,x]=(0,r.useState)(!1),[P,C]=(0,r.useState)(null),S=Ss(d,300),I=(0,r.useRef)(),W=h[u],{formatMessage:R}=(0,A.useIntl)(),B=M()(b,["options","timestamps",0]),U=!h[B],Z=Ss(g[e.targetField],300),[q,G]=(0,r.useState)(!1),[F,Q]=(0,r.useState)(null),$=l.id?R({id:l.id,defaultMessage:l.defaultMessage},Hn({},l.values)):u,Y=n?R({id:n.id,defaultMessage:n.defaultMessage},Hn({},n.values)):"",T=m?R({id:m.id,defaultMessage:m.defaultMessage},Hn({},m.values)):"";I.current=(O=!1)=>ks(void 0,null,function*(){x(!0);const _=ve("uid/generate");try{const{data:{data:re}}=yield ge.be.post(_,{contentTypeUID:t,field:u,data:g});c({target:{name:u,value:re,type:"text"}},O),x(!1)}catch(re){x(!1)}});const z=()=>ks(void 0,null,function*(){x(!0);const O=ve("uid/check-availability");if(!!d)try{const{data:_}=yield ge.be.post(O,{contentTypeUID:t,field:u,value:d?d.trim():""});C(_),x(!1)}catch(_){x(!1)}});(0,r.useEffect)(()=>{!d&&e.required&&I.current(!0)},[]),(0,r.useEffect)(()=>{S&&S.trim().match(km)&&S!==W&&z(),S||C(null)},[S,W]),(0,r.useEffect)(()=>{let O;return P&&P.isAvailable&&(O=setTimeout(()=>{C(null)},4e3)),()=>{O&&clearTimeout(O)}},[P]),(0,r.useEffect)(()=>{!q&&U&&Z&&g[e.targetField]&&!d&&I.current(!0)},[Z,q,U]);const K=()=>{Q(R({id:"content-manager.components.uid.regenerate",defaultMessage:"Regenerate"}))},N=()=>{Q(null)},w=O=>{O.target.value&&U&&G(!0),c(O)};return r.createElement(zn.TextInput,{disabled:s,error:a,endAction:r.createElement(Am,null,P&&P.isAvailable&&!F&&r.createElement(Un,{alignItems:"center",justifyContent:"flex-end"},r.createElement(xm(),null),r.createElement(L.Typography,{textColor:"success600",variant:"pi"},R({id:"content-manager.components.uid.available",defaultMessage:"Available"}))),P&&!P.isAvailable&&!F&&r.createElement(Un,{notAvailable:!0,alignItems:"center",justifyContent:"flex-end"},r.createElement(Tt(),null),r.createElement(L.Typography,{textColor:"danger600",variant:"pi"},R({id:"content-manager.components.uid.unavailable",defaultMessage:"Unavailable"}))),F&&r.createElement(Un,{alignItems:"center",justifyContent:"flex-end"},r.createElement(L.Typography,{textColor:"primary600",variant:"pi"},F)),r.createElement(jm,{onClick:()=>I.current(),label:"regenerate",onMouseEnter:K,onMouseLeave:N},E?r.createElement(Bm,null,r.createElement(Fm(),null)):r.createElement(Im(),null))),hint:Y,label:$,labelAction:i,name:u,onChange:w,placeholder:T,value:d||"",required:f})};Gn.propTypes={attribute:o().shape({targetField:o().string,required:o().bool}).isRequired,contentTypeUID:o().string.isRequired,description:o().shape({id:o().string.isRequired,defaultMessage:o().string.isRequired,values:o().object}),disabled:o().bool,error:o().string,intlLabel:o().shape({id:o().string.isRequired,defaultMessage:o().string.isRequired,values:o().object}).isRequired,labelAction:o().element,name:o().string.isRequired,onChange:o().func.isRequired,value:o().string,placeholder:o().shape({id:o().string.isRequired,defaultMessage:o().string.isRequired,values:o().object}),required:o().bool},Gn.defaultProps={description:void 0,disabled:!1,error:void 0,labelAction:void 0,placeholder:void 0,value:"",required:!1};const Wm=Gn;var zm=p(28611),Um=p.n(zm),Hm=p(77236),As=p.n(Hm),Gm=p(86834),Re=p.n(Gm),Zm=p(3040),ne=p.n(Zm);const _m=(0,k.default)(D.Box)`
|
|
769
|
-
svg path {
|
|
770
|
-
fill: ${({theme:e})=>e.colors.neutral500};
|
|
771
|
-
}
|
|
772
|
-
`,Zn=({intlLabel:e,id:t,labelAction:n,link:s,name:a,numberOfEntries:l,isSingle:i})=>{const{formatMessage:u}=(0,A.useIntl)(),c=e!=null&&e.id?u(e):a;return r.createElement(j.Flex,{justifyContent:"space-between"},r.createElement(j.Flex,null,r.createElement(L.Typography,{textColor:"neutral800",htmlFor:t||a,variant:"pi",fontWeight:"bold",as:"label"},c,!i&&r.createElement(r.Fragment,null,"\xA0(",l,")")),n&&r.createElement(_m,{paddingLeft:1},n)),s)};Zn.defaultProps={id:void 0,labelAction:void 0,link:null,numberOfEntries:0},Zn.propTypes={id:o().string,intlLabel:o().shape({id:o().string.isRequired,defaultMessage:o().string.isRequired,values:o().object}).isRequired,isSingle:o().bool.isRequired,labelAction:o().element,link:o().element,name:o().string.isRequired,numberOfEntries:o().number};const Qm=Zn;var Km=p(7787),Ym=p.n(Km),_n=p(82576),Jm=p(23973),js=p.n(Jm),Xm=Object.defineProperty,$s=Object.getOwnPropertySymbols,ef=Object.prototype.hasOwnProperty,tf=Object.prototype.propertyIsEnumerable,Bs=(e,t,n)=>t in e?Xm(e,t,{enumerable:!0,configurable:!0,writable:!0,value:n}):e[t]=n,Ns=(e,t)=>{for(var n in t||(t={}))ef.call(t,n)&&Bs(e,n,t[n]);if($s)for(var n of $s(t))tf.call(t,n)&&Bs(e,n,t[n]);return e};const nf=k.default.div`
|
|
773
|
-
flex-shrink: 0;
|
|
774
|
-
width: ${(0,y.pxToRem)(6)};
|
|
775
|
-
height: ${(0,y.pxToRem)(6)};
|
|
776
|
-
margin-right: ${({theme:e})=>e.spaces[2]};
|
|
777
|
-
background-color: ${({theme:e,isDraft:t})=>e.colors[t?"secondary600":"success600"]};
|
|
778
|
-
border-radius: 50%;
|
|
779
|
-
cursor: pointer;
|
|
780
|
-
`,Vs=e=>{const{formatMessage:t}=(0,A.useIntl)(),n=_n.components.SingleValue,s=js()(M()(e,"data.value"),"publishedAt"),a=Re()(M()(e,"data.value.publishedAt"));if(s){const l={id:v("components.Select.draft-info-title"),defaultMessage:"State: Draft"},i={id:v("components.Select.publish-info-title"),defaultMessage:"State: Published"},u=t(a?l:i);return r.createElement(n,Ns({},e),r.createElement(j.Flex,null,r.createElement(nf,{title:u,isDraft:a}),r.createElement(L.Typography,{ellipsis:!0},e.data.label||"-")))}return r.createElement(n,Ns({},e),e.data.label||"-")};Vs.propTypes={data:o().object.isRequired,selectProps:o().shape({mainField:o().shape({name:o().string.isRequired,schema:o().shape({type:o().string.isRequired}).isRequired}).isRequired}).isRequired};const rf=Vs;var of=Object.defineProperty,sf=Object.defineProperties,af=Object.getOwnPropertyDescriptors,qs=Object.getOwnPropertySymbols,lf=Object.prototype.hasOwnProperty,cf=Object.prototype.propertyIsEnumerable,Ws=(e,t,n)=>t in e?of(e,t,{enumerable:!0,configurable:!0,writable:!0,value:n}):e[t]=n,uf=(e,t)=>{for(var n in t||(t={}))lf.call(t,n)&&Ws(e,n,t[n]);if(qs)for(var n of qs(t))cf.call(t,n)&&Ws(e,n,t[n]);return e},df=(e,t)=>sf(e,af(t));function Qn({components:e,mainField:t,name:n,isDisabled:s,isLoading:a,onChange:l,onInputChange:i,onMenuClose:u,onMenuOpen:c,onMenuScrollToBottom:d,options:m,placeholder:f,value:g,description:h}){const{formatMessage:b}=(0,A.useIntl)();return r.createElement(se.Stack,{spacing:1},r.createElement(y.ReactSelect,{components:df(uf({},e),{SingleValue:rf}),id:n,isClearable:!0,isDisabled:s,isLoading:a,mainField:t,options:m,onChange:l,onInputChange:i,onMenuClose:u,onMenuOpen:c,onMenuScrollToBottom:d,placeholder:b(f||{id:"global.select",defaultMessage:"Select..."}),value:Ym()(g)?null:{label:M()(g,[t.name],""),value:g}}),h&&r.createElement(L.Typography,{variant:"pi",textColor:"neutral600"},h))}Qn.defaultProps={description:"",components:{},placeholder:null,value:null},Qn.propTypes={components:o().object,isDisabled:o().bool.isRequired,isLoading:o().bool.isRequired,mainField:o().shape({name:o().string.isRequired,schema:o().shape({type:o().string.isRequired}).isRequired}).isRequired,name:o().string.isRequired,onChange:o().func.isRequired,onInputChange:o().func.isRequired,onMenuClose:o().func.isRequired,onMenuOpen:o().func.isRequired,onMenuScrollToBottom:o().func.isRequired,options:o().array.isRequired,placeholder:o().shape({id:o().string.isRequired,defaultMessage:o().string.isRequired}),value:o().object,description:o().string};const pf=(0,r.memo)(Qn),mf=k.default.div`
|
|
781
|
-
width: ${(0,y.pxToRem)(6)};
|
|
782
|
-
height: ${(0,y.pxToRem)(6)};
|
|
783
|
-
background: ${({theme:e,isDraft:t})=>e.colors[t?"secondary600":"success600"]};
|
|
784
|
-
border-radius: 50%;
|
|
785
|
-
cursor: pointer;
|
|
786
|
-
`;function Kn({data:e,displayNavigationLink:t,isDisabled:n,mainField:s,onRemove:a,searchToPersist:l,targetModel:i}){const{formatMessage:u}=(0,A.useIntl)(),c=`/content-manager/collectionType/${i}/${e.id}`;let d="pointer";n&&(d="not-allowed"),t||(d="default");const m=js()(e,"publishedAt"),f=Re()(e.publishedAt),g=e[s.name],h={id:v("components.Select.draft-info-title"),defaultMessage:"State: Draft"},b={id:v("components.Select.publish-info-title"),defaultMessage:"State: Published"},E=u(f?h:b),{pathname:x}=(0,ee.useLocation)();return r.createElement(j.Flex,{as:"li",alignItems:"center"},r.createElement(j.Flex,{style:{flex:1},alignItems:"center"},m&&r.createElement(D.Box,{paddingRight:2},r.createElement(mf,{isDraft:f,title:E})),t?r.createElement(y.Link,{to:{pathname:c,state:{from:x},search:l},style:{textTransform:"none"}},g||e.id):r.createElement(L.Typography,{variant:"pi"},g||e.id)),r.createElement(y.RemoveRoundedButton,{onClick:a,label:"Remove",style:{cursor:d}}))}Kn.defaultProps={onRemove(){},searchToPersist:null,targetModel:""},Kn.propTypes={data:o().object.isRequired,displayNavigationLink:o().bool.isRequired,isDisabled:o().bool.isRequired,mainField:o().shape({name:o().string.isRequired,schema:o().shape({type:o().string.isRequired}).isRequired}).isRequired,onRemove:o().func,searchToPersist:o().string,targetModel:o().string};const ff=(0,r.memo)(Kn);function Yn({addRelation:e,components:t,displayNavigationLink:n,mainField:s,name:a,isDisabled:l,isLoading:i,onInputChange:u,onMenuClose:c,onMenuOpen:d,onMenuScrollToBottom:m,onRemove:f,options:g,placeholder:h,searchToPersist:b,targetModel:E,value:x,description:P}){const{formatMessage:C}=(0,A.useIntl)(),S={ignoreCase:!0,ignoreAccents:!0,trim:!1,matchFrom:"any"};return r.createElement(se.Stack,{spacing:1},r.createElement(y.ReactSelect,{components:t,isDisabled:l,id:a,filterOption:(I,W)=>!Re()(x)&&x.findIndex(B=>B.id===I.value.id)!==-1?!1:W?(0,_n.createFilter)(S)(I,W):!0,mainField:s,isLoading:i,isMulti:!0,isSearchable:!0,options:g,onChange:e,onInputChange:u,onMenuClose:c,onMenuOpen:d,onMenuScrollToBottom:m,placeholder:C(h||{id:"global.select",defaultMessage:"Select..."}),value:[]}),r.createElement(D.Box,{paddingTop:3,style:{overflow:"auto"}},r.createElement(se.Stack,{as:"ul",spacing:4,style:{maxHeight:"128px",overflowX:"hidden"}},x==null?void 0:x.map((I,W)=>r.createElement(ff,{key:I.id,data:I,displayNavigationLink:n,isDisabled:l,mainField:s,onRemove:()=>{l||f(`${a}.${W}`)},searchToPersist:b,targetModel:E})))),P&&r.createElement(L.Typography,{variant:"pi",textColor:"neutral600"},P))}Yn.defaultProps={description:"",components:{},placeholder:null,searchToPersist:null,value:null},Yn.propTypes={addRelation:o().func.isRequired,components:o().object,displayNavigationLink:o().bool.isRequired,isDisabled:o().bool.isRequired,isLoading:o().bool.isRequired,mainField:o().shape({name:o().string.isRequired,schema:o().shape({type:o().string.isRequired}).isRequired}).isRequired,name:o().string.isRequired,onInputChange:o().func.isRequired,onMenuClose:o().func.isRequired,onMenuOpen:o().func.isRequired,onMenuScrollToBottom:o().func.isRequired,onRemove:o().func.isRequired,options:o().array.isRequired,placeholder:o().shape({id:o().string.isRequired,defaultMessage:o().string.isRequired}),searchToPersist:o().string,targetModel:o().string.isRequired,value:o().array,description:o().string};const gf=(0,r.memo)(Yn);var yf=Object.defineProperty,zs=Object.getOwnPropertySymbols,hf=Object.prototype.hasOwnProperty,bf=Object.prototype.propertyIsEnumerable,Us=(e,t,n)=>t in e?yf(e,t,{enumerable:!0,configurable:!0,writable:!0,value:n}):e[t]=n,Hs=(e,t)=>{for(var n in t||(t={}))hf.call(t,n)&&Us(e,n,t[n]);if(zs)for(var n of zs(t))bf.call(t,n)&&Us(e,n,t[n]);return e};const Ef=k.default.div`
|
|
787
|
-
flex-shrink: 0;
|
|
788
|
-
width: ${(0,y.pxToRem)(6)};
|
|
789
|
-
height: ${(0,y.pxToRem)(6)};
|
|
790
|
-
margin-right: ${({theme:e})=>e.spaces[2]};
|
|
791
|
-
background-color: ${({theme:e,isDraft:t})=>e.colors[t?"secondary600":"success600"]};
|
|
792
|
-
border-radius: 50%;
|
|
793
|
-
cursor: pointer;
|
|
794
|
-
`,Jn=e=>{const{formatMessage:t}=(0,A.useIntl)(),n=_n.components.Option;if((0,V.has)((0,V.get)(e,"data.value"),"publishedAt")){const a=(0,V.isEmpty)((0,V.get)(e,"data.value.publishedAt")),l={id:v("components.Select.draft-info-title"),defaultMessage:"State: Draft"},i={id:v("components.Select.publish-info-title"),defaultMessage:"State: Published"},u=t(a?l:i);return r.createElement(n,Hs({},e),r.createElement(j.Flex,null,r.createElement(Ef,{title:u,isDraft:a}),r.createElement(L.Typography,{ellipsis:!0},e.label||"-")))}return r.createElement(n,Hs({},e),e.label||"-")};Jn.defaultProps={label:""},Jn.propTypes={label:o().oneOfType([o().string,o().number]),isFocused:o().bool.isRequired,selectProps:o().shape({hasDraftAndPublish:o().bool,mainField:o().shape({name:o().string.isRequired,schema:o().shape({type:o().string.isRequired}).isRequired}).isRequired}).isRequired};const vf=Jn;var Cf=Object.defineProperty,Gs=Object.getOwnPropertySymbols,Pf=Object.prototype.hasOwnProperty,Of=Object.prototype.propertyIsEnumerable,Zs=(e,t,n)=>t in e?Cf(e,t,{enumerable:!0,configurable:!0,writable:!0,value:n}):e[t]=n,_s=(e,t)=>{for(var n in t||(t={}))Pf.call(t,n)&&Zs(e,n,t[n]);if(Gs)for(var n of Gs(t))Of.call(t,n)&&Zs(e,n,t[n]);return e};function Rf(e,t){return n=>{const s=t(n);return r.createElement(e,_s(_s({},n),s))}}const Mf=Rf;function Tf({isUserAllowedToEditField:e,isUserAllowedToReadField:t,name:n}){const{isCreatingEntry:s,createActionAllowedFields:a,readActionAllowedFields:l,updateActionAllowedFields:i}=(0,y.useCMEditViewDataManager)(),u=(0,r.useMemo)(()=>e===!0?!0:(s?a:i).includes(n),[s,a,n,e,i]),c=(0,r.useMemo)(()=>t?!0:(s?[]:l).includes(n),[s,t,n,l]);return{isCreatingEntry:s,isFieldAllowed:u,isFieldReadable:c}}const wf=Tf;var If=Object.defineProperty,Df=Object.defineProperties,xf=Object.getOwnPropertyDescriptors,Qs=Object.getOwnPropertySymbols,Sf=Object.prototype.hasOwnProperty,Lf=Object.prototype.propertyIsEnumerable,Ks=(e,t,n)=>t in e?If(e,t,{enumerable:!0,configurable:!0,writable:!0,value:n}):e[t]=n,Xn=(e,t)=>{for(var n in t||(t={}))Sf.call(t,n)&&Ks(e,n,t[n]);if(Qs)for(var n of Qs(t))Lf.call(t,n)&&Ks(e,n,t[n]);return e},er=(e,t)=>Df(e,xf(t)),Ff=(e,t,n)=>new Promise((s,a)=>{var l=c=>{try{u(n.next(c))}catch(d){a(d)}},i=c=>{try{u(n.throw(c))}catch(d){a(d)}},u=c=>c.done?s(c.value):Promise.resolve(c.value).then(l,i);u((n=n.apply(e,t)).next())});const Ys={contains:"",limit:20,start:0},kf=(e,t)=>t?t.reduce((n,s)=>{const a=M()(e,s,null);return a&&ne()(n,s,a),n},{}):{};function tr({description:e,editable:t,labelAction:n,intlLabel:s,isCreatingEntry:a,isFieldAllowed:l,isFieldReadable:i,mainField:u,name:c,relationType:d,targetModel:m,placeholder:f,queryInfos:g}){const{formatMessage:h}=(0,A.useIntl)(),[{query:b}]=(0,y.useQueryParams)(),E=(0,r.useMemo)(()=>d.toLowerCase().includes("morph"),[d]),{addRelation:x,modifiedData:P,moveRelation:C,onChange:S,onRemoveRelation:I}=(0,y.useCMEditViewDataManager)(),{pathname:W}=(0,ee.useLocation)(),R=M()(P,c,null),[B,U]=(0,r.useState)(Ys),[Z,q]=(0,r.useState)([]),[G,F]=(0,r.useState)(!1),[Q,$]=(0,r.useState)(!1),Y=(0,r.useMemo)(()=>Z.filter(Ce=>Re()(R)?!0:Array.isArray(R)?Um()(R,$e=>$e.id===Ce.value.id)===-1:M()(R,"id","")!==Ce.value.id),[Z,R]),{endPoint:T,containsKey:z,defaultParams:K,shouldDisplayRelationLink:N,paramsToKeep:w}=g,O=["oneWay","oneToOne","manyToOne","oneToManyMorph","oneToOneMorph"].includes(d),_=(0,r.useMemo)(()=>R?O?[R.id]:R.map(Ce=>Ce.id):[],[O,R]),re=(0,r.useCallback)(Ce=>Ff(this,null,function*(){if(E){F(!1);return}if(!l){F(!1);return}F(!0);const $e=er(Xn({limit:B.limit},K),{start:B.start});B.contains&&($e[`filters[${z}][$contains]`]=B.contains);try{const{data:Qe}=yield ge.be.post(T,{idsToOmit:_},{params:$e,cancelToken:Ce.token}),Xr=Qe.map(Ke=>({value:Ke,label:Ke[u.name]}));q(Ke=>Ke.concat(Xr).filter((gn,eo)=>Ke.findIndex(J=>J.value.id===gn.value.id)===-1?!0:Ke.findIndex(J=>J.value.id===gn.value.id)===eo)),F(!1)}catch(Qe){F(!1)}}),[z,K,T,_,l,E,u.name,B.contains,B.limit,B.start]);(0,r.useEffect)(()=>{const $e=Se().CancelToken.source();return Q&&re($e),()=>$e.cancel("Operation canceled by the user.")},[re,Q]);const ue=(Ce,{action:$e})=>($e==="input-change"&&U(Qe=>Qe.contains===Ce?Qe:er(Xn({},Qe),{contains:Ce,start:0})),Ce),me=()=>{U(Ce=>er(Xn({},Ce),{start:Ce.start+20}))},Fe=()=>{U(Ys),$(!1)},rt=Ce=>{S({target:{name:c,value:Ce&&Ce.value}})},H=Ce=>{Re()(Ce)||x({target:{name:c,value:Ce}})},de=()=>{$(!0)},je=`/content-manager/collectionType/${m}/${R?R.id:null}`,Ue=(0,Ne.stringify)(kf(b,w),{encode:!1});let ht=null;O&&R&&N&&(ht=r.createElement(y.Link,{to:{pathname:je,state:{from:W},search:Ue}},h({id:v("containers.Edit.seeDetails"),defaultMessage:"Details"})));const _e=O?pf:gf,Yr=As()(R)?R.length:0,Jr=(0,r.useMemo)(()=>E?!0:a?!t:!l&&i||!t,[E,a,t,l,i]);return!l&&a?r.createElement(y.NotAllowedInput,{intlLabel:s,labelAction:n}):!a&&!l&&!i?r.createElement(y.NotAllowedInput,{intlLabel:s,labelAction:n}):r.createElement(se.Stack,{spacing:1},r.createElement(Qm,{intlLabel:s,isSingle:O,labelAction:n,link:ht,name:c,numberOfEntries:Yr}),r.createElement(_e,{addRelation:H,components:{Option:vf},displayNavigationLink:N,id:c,isDisabled:Jr,isLoading:G,isClearable:!0,mainField:u,move:C,name:c,options:Y,onChange:rt,onInputChange:ue,onMenuClose:Fe,onMenuOpen:de,onMenuScrollToBottom:me,onRemove:I,placeholder:f,searchToPersist:Ue,targetModel:m,value:R,description:e}))}tr.defaultProps={editable:!0,description:"",labelAction:null,isFieldAllowed:!0,placeholder:null},tr.propTypes={editable:o().bool,description:o().string,intlLabel:o().shape({id:o().string.isRequired,defaultMessage:o().string.isRequired,values:o().object}).isRequired,labelAction:o().element,isCreatingEntry:o().bool.isRequired,isFieldAllowed:o().bool,isFieldReadable:o().bool.isRequired,mainField:o().shape({name:o().string.isRequired,schema:o().shape({type:o().string.isRequired}).isRequired}).isRequired,name:o().string.isRequired,placeholder:o().shape({id:o().string.isRequired,defaultMessage:o().string.isRequired,values:o().object}),relationType:o().string.isRequired,targetModel:o().string.isRequired,queryInfos:o().shape({containsKey:o().string.isRequired,defaultParams:o().object,endPoint:o().string.isRequired,shouldDisplayRelationLink:o().bool.isRequired,paramsToKeep:o().array}).isRequired};const Af=(0,r.memo)(tr),Js=Mf(Af,wf);var jf=Object.defineProperty,Xs=Object.getOwnPropertySymbols,$f=Object.prototype.hasOwnProperty,Bf=Object.prototype.propertyIsEnumerable,ea=(e,t,n)=>t in e?jf(e,t,{enumerable:!0,configurable:!0,writable:!0,value:n}):e[t]=n,ta=(e,t)=>{for(var n in t||(t={}))$f.call(t,n)&&ea(e,n,t[n]);if(Xs)for(var n of Xs(t))Bf.call(t,n)&&ea(e,n,t[n]);return e};function Nf(e,t){return n=>{const s=t(n.keys);return r.createElement(e,ta(ta({},n),s))}}const Vf=Nf,qf=(e,t=!1)=>[{metadatas:{intlLabel:{id:"components.InputSelect.option.placeholder",defaultMessage:"Choose here"},disabled:t,hidden:t},key:"__enum_option_null",value:""},...e.map(n=>({metadatas:{intlLabel:{id:n,defaultMessage:n},hidden:!1,disabled:!1},key:n,value:n}))],Wf=(e="")=>{switch((0,V.toLower)(e)){case"boolean":return"bool";case"biginteger":return"text";case"decimal":case"float":case"integer":return"number";case"date":case"datetime":case"time":return e;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 e||"text"}},zf=e=>{let t;return e==="float"||e==="decimal"?t=.01:t=1,t};function Uf(e){const{createActionAllowedFields:t,formErrors:n,isCreatingEntry:s,modifiedData:a,onChange:l,readActionAllowedFields:i,shouldNotRunValidations:u,updateActionAllowedFields:c}=(0,y.useCMEditViewDataManager)(),d=(0,r.useMemo)(()=>s?t:c,[s,t,c]),m=(0,r.useMemo)(()=>s?[]:i,[s,i]),f=(0,V.get)(a,e,null);return{allowedFields:d,formErrors:n,isCreatingEntry:s,onChange:l,readableFields:m,shouldNotRunValidations:u,value:f}}const Hf=Uf,na=["type","model","via","collection","default","plugin","enum","regex","pluginOptions"];var Gf=Object.defineProperty,Zf=Object.defineProperties,_f=Object.getOwnPropertyDescriptors,ra=Object.getOwnPropertySymbols,Qf=Object.prototype.hasOwnProperty,Kf=Object.prototype.propertyIsEnumerable,oa=(e,t,n)=>t in e?Gf(e,t,{enumerable:!0,configurable:!0,writable:!0,value:n}):e[t]=n,nr=(e,t)=>{for(var n in t||(t={}))Qf.call(t,n)&&oa(e,n,t[n]);if(ra)for(var n of ra(t))Kf.call(t,n)&&oa(e,n,t[n]);return e},Yf=(e,t)=>Zf(e,_f(t));function rr({allowedFields:e,fieldSchema:t,formErrors:n,isCreatingEntry:s,keys:a,labelAction:l,metadatas:i,onChange:u,readableFields:c,shouldNotRunValidations:d,queryInfos:m,value:f}){const{fields:g}=(0,y.useLibrary)(),{formatMessage:h}=(0,A.useIntl)(),{contentType:b}=lt(),E=(0,r.useMemo)(()=>!M()(i,"editable",!0),[i]),x=t.type,P=M()(n,[a],null),C=(0,r.useMemo)(()=>Po(a),[a]),S=(0,r.useMemo)(()=>{const N=Rd()(t,d?[...na,"required","minLength"]:na),w=t.regex||null;if(w){const O=new RegExp(w);O&&(N.regex=O)}return N},[t,d]),I=(0,r.useMemo)(()=>M()(S,["required"],!1),[S]),W=(0,r.useMemo)(()=>{const N=M()(b,["attributes"],{});return M()(N,[C[0],"type"],null)==="dynamiczone"},[b,C]),R=(0,r.useMemo)(()=>Wf(x),[x]),B=(0,r.useMemo)(()=>x==="media"&&!f?[]:f,[x,f]),U=(0,r.useMemo)(()=>zf(x),[x]),Z=(0,r.useMemo)(()=>{const N=C.join(".");if(e.includes(N))return!0;if(W)return e.includes(C[0]);if(C.length>1){const O=Zt()(C,C.length-1).join(".");return e.includes(O)}return!1},[e,C,W]),q=(0,r.useMemo)(()=>{const N=C.join(".");if(c.includes(N))return!0;if(W)return c.includes(C[0]);if(C.length>1){const O=Zt()(C,C.length-1).join(".");return c.includes(O)}return!1},[c,C,W]),G=(0,r.useMemo)(()=>q||Z,[Z,q]),F=(0,r.useMemo)(()=>s?E:q&&!Z?!0:E,[E,s,Z,q]),Q=(0,r.useMemo)(()=>qf(t.enum||[],I),[t,I]),{label:$,description:Y,placeholder:T,visible:z}=i,K=(0,r.useMemo)(()=>{if(!i.step||R!=="datetime"&&R!=="time")return U;if(!B)return i.step;let N;return R==="datetime"?N=parseInt(B.substr(14,2),10):R==="time"&&(N=parseInt(B.slice(-2),10)),N%i.step===0?i.step:U},[R,B,i.step,U]);return z===!1?null:G?x==="relation"?r.createElement(Js,Yf(nr(nr({},i),t),{description:i.description?h({id:i.description,defaultMessage:i.description}):void 0,intlLabel:{id:i.label,defaultMessage:i.label},labelAction:l,isUserAllowedToEditField:Z,isUserAllowedToReadField:q,name:a,placeholder:i.placeholder?{id:i.placeholder,defaultMessage:i.placeholder}:null,queryInfos:m,value:f,error:P&&h(P)})):r.createElement(y.GenericInput,{attribute:t,autoComplete:"new-password",intlLabel:{id:$,defaultMessage:$},isNullable:R==="bool"&&[null,void 0].includes(t.default),description:Y?{id:Y,defaultMessage:Y}:null,disabled:F,error:P,labelAction:l,contentTypeUID:b.uid,customInputs:nr({json:Tm,uid:Wm,media:g.media,wysiwyg:lm},g),multiple:t.multiple||!1,name:a,onChange:u,options:Q,placeholder:T?{id:T,defaultMessage:T}:null,required:t.required||!1,step:K,type:R,value:B,withDefaultValue:!1}):r.createElement(y.NotAllowedInput,{description:Y?{id:Y,defaultMessage:Y}:null,intlLabel:{id:$,defaultMessage:$},labelAction:l,error:P&&h(P),name:a,required:I})}rr.defaultProps={formErrors:{},labelAction:void 0,queryInfos:{},value:null},rr.propTypes={allowedFields:o().array.isRequired,fieldSchema:o().object.isRequired,formErrors:o().object,keys:o().string.isRequired,isCreatingEntry:o().bool.isRequired,labelAction:o().element,metadatas:o().object.isRequired,onChange:o().func.isRequired,readableFields:o().array.isRequired,shouldNotRunValidations:o().bool.isRequired,queryInfos:o().shape({containsKey:o().string,defaultParams:o().object,endPoint:o().string}),value:o().any};const Jf=(0,r.memo)(rr,We()),or=Vf(Jf,Hf),sr=({componentUid:e,isFromDynamicZone:t,isNested:n,name:s})=>{const{getComponentLayout:a}=lt(),i=(0,r.useMemo)(()=>a(e),[e,a]).layouts.edit;return r.createElement(D.Box,{background:t?"":"neutral100",paddingLeft:6,paddingRight:6,paddingTop:6,paddingBottom:6,hasRadius:n,borderColor:n?"neutral200":""},r.createElement(se.Stack,{spacing:6},i.map((u,c)=>r.createElement(ie.Grid,{gap:4,key:c},u.map(({name:d,size:m,metadatas:f,fieldSchema:g,queryInfos:h})=>{const b=g.type==="component",E=`${s}.${d}`;if(b){const x=g.component;return r.createElement(ie.GridItem,{col:m,s:12,xs:12,key:d},r.createElement(Yt,{componentUid:x,intlLabel:{id:f.label,defaultMessage:f.label},isNested:!0,isRepeatable:g.repeatable,max:g.max,min:g.min,name:E,required:g.required||!1}))}return r.createElement(ie.GridItem,{col:m,key:d,s:12,xs:12},r.createElement(or,{keys:E,fieldSchema:g,metadatas:f,queryInfos:h}))})))))};sr.defaultProps={isFromDynamicZone:!1,isNested:!1},sr.propTypes={componentUid:o().string.isRequired,isFromDynamicZone:o().bool,isNested:o().bool,name:o().string.isRequired};const Xf=sr;var sa=p(74201),eg=p(59290),ut=p.n(eg),tg=Object.defineProperty,aa=Object.getOwnPropertySymbols,ng=Object.prototype.hasOwnProperty,rg=Object.prototype.propertyIsEnumerable,ia=(e,t,n)=>t in e?tg(e,t,{enumerable:!0,configurable:!0,writable:!0,value:n}):e[t]=n,la=(e,t)=>{for(var n in t||(t={}))ng.call(t,n)&&ia(e,n,t[n]);if(aa)for(var n of aa(t))rg.call(t,n)&&ia(e,n,t[n]);return e};function og(e,t){return n=>{const s=t(n);return r.createElement(e,la(la({},n),s))}}const sg=og;function ag(){const{addRepeatableComponentToField:e,formErrors:t}=(0,y.useCMEditViewDataManager)();return{addRepeatableComponentToField:e,formErrors:t}}const ig=ag;function lg(e,t){return Object.keys(t).filter(n=>n.startsWith(e)).map(n=>n.split(".").slice(0,e.split(".").length+1).join("."))}var Kt=p(51968),cg=p(41119),ca=p.n(cg),ar=p(44826);const ug=k.default.span`
|
|
795
|
-
display: block;
|
|
796
|
-
background-color: ${({theme:e})=>e.colors.primary100};
|
|
797
|
-
outline: 1px dashed ${({theme:e})=>e.colors.primary500};
|
|
798
|
-
outline-offset: -1px;
|
|
799
|
-
padding: ${({theme:e})=>e.spaces[6]};
|
|
800
|
-
`,dg=()=>r.createElement(ug,{padding:6,background:"primary100"});var pg=p(78752);const mg=(0,k.default)(Me.IconButton)`
|
|
801
|
-
background-color: transparent;
|
|
802
|
-
|
|
803
|
-
svg {
|
|
804
|
-
path {
|
|
805
|
-
fill: ${({theme:e,expanded:t})=>t?e.colors.primary600:e.colors.neutral600};
|
|
806
|
-
}
|
|
807
|
-
}
|
|
808
|
-
|
|
809
|
-
&:hover {
|
|
810
|
-
svg {
|
|
811
|
-
path {
|
|
812
|
-
fill: ${({theme:e})=>e.colors.primary600};
|
|
813
|
-
}
|
|
814
|
-
}
|
|
815
|
-
}
|
|
816
|
-
`,ua=(0,k.default)(Me.IconButton)`
|
|
817
|
-
background-color: transparent;
|
|
818
|
-
|
|
819
|
-
svg {
|
|
820
|
-
path {
|
|
821
|
-
fill: ${({theme:e,expanded:t})=>t?e.colors.primary600:e.colors.neutral600};
|
|
822
|
-
}
|
|
823
|
-
}
|
|
824
|
-
`,fg=k.default.span`
|
|
825
|
-
display: flex;
|
|
826
|
-
justify-content: space-between;
|
|
827
|
-
padding-left: ${({theme:e})=>e.spaces[4]};
|
|
828
|
-
padding-right: ${({theme:e})=>e.spaces[4]};
|
|
829
|
-
background-color: ${({theme:e})=>e.colors.neutral0};
|
|
830
|
-
height: ${50/16}rem;
|
|
831
|
-
`,gg=(0,k.default)(sa.TextButton)`
|
|
832
|
-
text-align: left;
|
|
833
|
-
|
|
834
|
-
svg {
|
|
835
|
-
width: ${14/16}rem;
|
|
836
|
-
height: ${14/16}rem;
|
|
837
|
-
|
|
838
|
-
path {
|
|
839
|
-
fill: ${({theme:e,expanded:t})=>t?e.colors.primary600:e.colors.neutral500};
|
|
840
|
-
}
|
|
841
|
-
}
|
|
842
|
-
`,da=({displayedValue:e})=>r.createElement(fg,null,r.createElement(se.Stack,{horizontal:!0,spacing:3,flex:1},r.createElement(j.Flex,{justifyContent:"center",borderRadius:"50%",height:`${24/16}rem}`,width:`${24/16}rem}`,"aria-hidden":!0,as:"span",background:"neutral200"},r.createElement(pg.Icon,{as:ro(),width:`${8/16}rem}`,color:"neutral600"})),r.createElement(gg,{onClick:()=>{},flex:1},r.createElement(L.Typography,{fontWeight:"bold",textColor:"neutral700"},e))),r.createElement(se.Stack,{horizontal:!0,spacing:0},r.createElement(ua,{noBorder:!0,onClick:()=>{},icon:r.createElement(Be(),null)}),r.createElement(ua,{icon:r.createElement(Xe(),null),noBorder:!0})));da.propTypes={displayedValue:o().string.isRequired};const yg=da;var hg=Object.defineProperty,pa=Object.getOwnPropertySymbols,bg=Object.prototype.hasOwnProperty,Eg=Object.prototype.propertyIsEnumerable,ma=(e,t,n)=>t in e?hg(e,t,{enumerable:!0,configurable:!0,writable:!0,value:n}):e[t]=n,fa=(e,t)=>{for(var n in t||(t={}))bg.call(t,n)&&ma(e,n,t[n]);if(pa)for(var n of pa(t))Eg.call(t,n)&&ma(e,n,t[n]);return e};function vg(e,t){return n=>{const s=t(n);return r.createElement(e,fa(fa({},n),s))}}const Cg=vg;function Pg({schema:e,componentFieldName:t}){const{checkFormErrors:n,modifiedData:s,moveComponentField:a,removeRepeatableField:l,triggerFormValidation:i}=(0,y.useCMEditViewDataManager)(),u=(0,r.useMemo)(()=>(0,V.get)(e,["settings","mainField"],"id"),[e]);return{displayedValue:(0,V.toString)((0,V.get)(s,[...t.split("."),u],"")),mainField:u,checkFormErrors:n,moveComponentField:a,removeRepeatableField:l,schema:e,triggerFormValidation:i}}const Og=Pg,Rg=k.default.span`
|
|
843
|
-
display: flex;
|
|
844
|
-
align-items: center;
|
|
845
|
-
height: ${({theme:e})=>e.spaces[7]};
|
|
846
|
-
|
|
847
|
-
padding: 0 ${({theme:e})=>e.spaces[3]};
|
|
848
|
-
cursor: all-scroll;
|
|
849
|
-
|
|
850
|
-
svg {
|
|
851
|
-
width: ${12/16}rem;
|
|
852
|
-
height: ${12/16}rem;
|
|
853
|
-
}
|
|
854
|
-
`,ir=({componentFieldName:e,hasErrorMessage:t,hasErrors:n,isDraggingSibling:s,isOpen:a,isReadOnly:l,onClickToggle:i,schema:u,toggleCollapses:c,moveComponentField:d,removeRepeatableField:m,setIsDraggingSibling:f,triggerFormValidation:g,displayedValue:h})=>{const b=(0,r.useRef)(null),E=(0,r.useRef)(null),[,x]=(0,r.useState)(!1),{formatMessage:P}=(0,A.useIntl)(),C=u.layouts.edit,[,S]=(0,Te.useDrop)({accept:Oe.COMPONENT,canDrop(){return!1},hover(q,G){if(!E.current)return;const F=q.originalPath,Q=e,$=F.split("."),Y=$.slice().splice(-1).join(""),T=Q.split(".").splice(-1).join(""),z=$.slice(0,$.length-1),K=parseInt(Y,10),N=parseInt(T,10);if(K===N)return;const w=E.current.getBoundingClientRect(),O=(w.bottom-w.top)/2,re=G.getClientOffset().y-w.top;K<N&&re<O||K>N&&re>O||F.split(".").length===Q.split(".").length&&(d(z,K,N),q.originalPath=Q)}}),[{isDragging:I},W,R]=(0,Te.useDrag)({type:Oe.COMPONENT,item(){return c(-1),{displayedValue:h,originalPath:e}},end(){g(),f(!1)},collect:q=>({isDragging:q.isDragging()})});(0,r.useEffect)(()=>{R((0,Kt.rX)(),{captureDraggingState:!1})},[R]),(0,r.useEffect)(()=>{I&&f(!0)},[I,f]),(0,r.useEffect)(()=>{s||x(q=>!q)},[s]);const B={dragRef:W(b),dropRef:S(E)},U=ca()(h),Z=n?"error":void 0;return r.createElement(D.Box,{ref:B?B.dropRef:null},I&&r.createElement(dg,null),!I&&s&&r.createElement(yg,{displayedValue:U,componentFieldName:e}),!I&&!s&&r.createElement(ze.Accordion,{error:Z,hasErrorMessage:t,expanded:a,onToggle:i,id:e,size:"S"},r.createElement(ze.AccordionToggle,{action:l?null:r.createElement(se.Stack,{horizontal:!0,spacing:0},r.createElement(mg,{expanded:a,noBorder:!0,onClick:()=>{m(e),c()},label:P({id:v("containers.Edit.delete"),defaultMessage:"Delete"}),icon:r.createElement(Be(),null)}),r.createElement(ar.Tooltip,{description:P({id:v("components.DragHandle-label"),defaultMessage:"Drag"})},r.createElement(Rg,{role:"button",tabIndex:-1,ref:B.dragRef,onClick:q=>q.stopPropagation()},r.createElement(Xe(),null)))),title:U,togglePosition:"left"}),r.createElement(ze.AccordionContent,null,r.createElement(se.Stack,{background:"neutral100",padding:6,spacing:6},C.map((q,G)=>r.createElement(ie.Grid,{gap:4,key:G},q.map(({name:F,fieldSchema:Q,metadatas:$,queryInfos:Y,size:T})=>{const z=Q.type==="component",K=`${e}.${F}`;if(z){const N=Q.component;return r.createElement(ie.GridItem,{col:T,s:12,xs:12,key:F},r.createElement(Yt,{componentUid:N,intlLabel:{id:$.label,defaultMessage:$.label},isRepeatable:Q.repeatable,isNested:!0,name:K,max:Q.max,min:Q.min,required:Q.required}))}return r.createElement(ie.GridItem,{key:K,col:T,s:12,xs:12},r.createElement(or,{fieldSchema:Q,keys:K,metadatas:$,queryInfos:Y}))})))))))};ir.defaultProps={isDraggingSibling:!1,isOpen:!1,setIsDraggingSibling(){},toggleCollapses(){}},ir.propTypes={componentFieldName:o().string.isRequired,hasErrorMessage:o().bool.isRequired,hasErrors:o().bool.isRequired,isDraggingSibling:o().bool,isOpen:o().bool,isReadOnly:o().bool.isRequired,onClickToggle:o().func.isRequired,schema:o().object.isRequired,toggleCollapses:o().func,moveComponentField:o().func.isRequired,removeRepeatableField:o().func.isRequired,setIsDraggingSibling:o().func,triggerFormValidation:o().func.isRequired,displayedValue:o().string.isRequired};const Mg=(0,r.memo)(ir),Tg=Cg(Mg,Og);var ga=p(87910),wg=Object.defineProperty,ya=Object.getOwnPropertySymbols,Ig=Object.prototype.hasOwnProperty,Dg=Object.prototype.propertyIsEnumerable,ha=(e,t,n)=>t in e?wg(e,t,{enumerable:!0,configurable:!0,writable:!0,value:n}):e[t]=n,xg=(e,t)=>{for(var n in t||(t={}))Ig.call(t,n)&&ha(e,n,t[n]);if(ya)for(var n of ya(t))Dg.call(t,n)&&ha(e,n,t[n]);return e};const Sg=(0,k.default)(D.Box)`
|
|
855
|
-
overflow: hidden;
|
|
856
|
-
border-bottom: 1px solid ${({theme:e})=>e.colors.neutral200};
|
|
857
|
-
border-right: 1px solid ${({theme:e})=>e.colors.neutral200};
|
|
858
|
-
border-left: 1px solid ${({theme:e})=>e.colors.neutral200};
|
|
859
|
-
border-radius: 0 0 ${({theme:e})=>e.borderRadius} ${({theme:e})=>e.borderRadius};
|
|
860
|
-
`,Lg=(0,k.default)(D.Box)`
|
|
861
|
-
> div {
|
|
862
|
-
& > * {
|
|
863
|
-
border-radius: unset;
|
|
864
|
-
border-right: 1px solid ${({theme:e})=>e.colors.neutral200};
|
|
865
|
-
border-left: 1px solid ${({theme:e})=>e.colors.neutral200};
|
|
866
|
-
border-bottom: 1px solid ${({theme:e})=>e.colors.neutral200};
|
|
867
|
-
}
|
|
868
|
-
> div {
|
|
869
|
-
> div:first-of-type {
|
|
870
|
-
border-radius: unset;
|
|
871
|
-
}
|
|
872
|
-
}
|
|
873
|
-
}
|
|
874
|
-
|
|
875
|
-
> div:first-of-type {
|
|
876
|
-
> div {
|
|
877
|
-
border-radius: ${({theme:e})=>e.borderRadius} ${({theme:e})=>e.borderRadius} 0 0;
|
|
878
|
-
> div:first-of-type {
|
|
879
|
-
border-radius: ${({theme:e})=>e.borderRadius} ${({theme:e})=>e.borderRadius} 0 0;
|
|
880
|
-
}
|
|
881
|
-
}
|
|
882
|
-
|
|
883
|
-
> div:not([data-strapi-expanded='true']) {
|
|
884
|
-
border-top: 1px solid ${({theme:e})=>e.colors.neutral200};
|
|
885
|
-
|
|
886
|
-
&:hover {
|
|
887
|
-
border-top: 1px solid ${({theme:e})=>e.colors.primary600};
|
|
888
|
-
}
|
|
889
|
-
}
|
|
890
|
-
|
|
891
|
-
> span {
|
|
892
|
-
border-radius: ${({theme:e})=>e.borderRadius} ${({theme:e})=>e.borderRadius} 0 0;
|
|
893
|
-
border-top: 1px solid ${({theme:e})=>e.colors.neutral200};
|
|
894
|
-
}
|
|
895
|
-
}
|
|
896
|
-
|
|
897
|
-
& [data-strapi-expanded='true'] {
|
|
898
|
-
border: 1px solid ${({theme:e})=>e.colors.primary600};
|
|
899
|
-
}
|
|
900
|
-
|
|
901
|
-
${({theme:e,footer:t})=>`
|
|
902
|
-
&:not(${t}) {
|
|
903
|
-
& > *:last-of-type {
|
|
904
|
-
border-radius: 0 0 ${e.borderRadius} ${e.borderRadius};
|
|
905
|
-
}
|
|
906
|
-
}
|
|
907
|
-
`}
|
|
908
|
-
`,Fg=(0,k.default)(D.Box)`
|
|
909
|
-
svg path {
|
|
910
|
-
fill: ${({theme:e})=>e.colors.neutral500};
|
|
911
|
-
}
|
|
912
|
-
`,lr=({children:e,footer:t,label:n,labelAction:s,error:a})=>{const{formatMessage:l}=(0,A.useIntl)(),i=r.Children.toArray(e).map(u=>(0,r.cloneElement)(u,{hasErrorMessage:!1}));return r.createElement(ga.KeyboardNavigable,{attributeName:"data-strapi-accordion-toggle"},n&&r.createElement(j.Flex,{paddingBottom:1},r.createElement(L.Typography,{as:"label",textColor:"neutral800",variant:"pi",fontWeight:"bold"},n),s&&r.createElement(Fg,{paddingLeft:1},s)),r.createElement(Lg,{footer:t},i),t&&r.createElement(Sg,null,t),a&&r.createElement(D.Box,{paddingTop:1},r.createElement(L.Typography,{variant:"pi",textColor:"danger600"},l({id:a.id,defaultMessage:a.id},xg({},a.values)))))};lr.defaultProps={error:void 0,footer:null,label:null,labelAction:void 0},lr.propTypes={children:o().node.isRequired,error:o().shape({id:o().string.isRequired,defaultMessage:o().string.isRequired,values:o().object}),footer:o().node,label:o().string,labelAction:o().node};const kg=lr,Ag=(0,k.default)(sa.TextButton)`
|
|
913
|
-
height: 100%;
|
|
914
|
-
width: 100%;
|
|
915
|
-
border-radius: 0 0 4px 4px;
|
|
916
|
-
display: flex;
|
|
917
|
-
justify-content: center;
|
|
918
|
-
span {
|
|
919
|
-
font-weight: 600;
|
|
920
|
-
font-size: 14px;
|
|
921
|
-
}
|
|
922
|
-
`,cr=({addRepeatableComponentToField:e,formErrors:t,componentUid:n,componentValue:s,componentValueLength:a,isReadOnly:l,max:i,min:u,name:c})=>{const d=(0,y.useNotification)(),{formatMessage:m}=(0,A.useIntl)(),[f,g]=(0,r.useState)(""),[h,b]=(0,r.useState)(!1),[,E]=(0,Te.useDrop)({accept:Oe.COMPONENT}),{getComponentLayout:x}=lt(),P=(0,r.useMemo)(()=>x(n),[n,x]),C=(0,r.useMemo)(()=>Oo(s||[])+1,[s]),S=lg(c,t),I=()=>{g("")},W=u-a,R=M()(t,c,{id:""}).id.includes("min"),B=(0,r.useCallback)(()=>{l||(a<i?(e(c,n,R),g(C)):a>=i&&d({type:"info",message:{id:v("components.notification.info.maximum-requirement")}}))},[e,n,a,R,l,i,c,C,d]);let U=t[c];return R&&(U={id:v("components.DynamicZone.missing-components"),defaultMessage:"There {number, plural, =0 {are # missing components} one {is # missing component} other {are # missing components}}",values:{number:W}}),a===0?r.createElement(ls,{error:U,isReadOnly:l,onClick:B}):(S.some(q=>q.split(".").length>1)&&!R&&(U={id:v("components.RepeatableComponent.error-message"),defaultMessage:"The component(s) contain error(s)"}),r.createElement(D.Box,{hasRadius:!0,ref:E},r.createElement(kg,{error:U,footer:r.createElement(j.Flex,{justifyContent:"center",height:"48px",background:"neutral0"},r.createElement(Ag,{disabled:l,onClick:B,startIcon:r.createElement(ut(),null)},m({id:v("containers.EditView.add.new-entry"),defaultMessage:"Add an entry"})))},s.map((q,G)=>{const F=q.__temp_key__,Q=f===F,$=`${c}.${G}`,Y=S.includes($);return r.createElement(Tg,{componentFieldName:$,componentUid:n,hasErrors:Y,hasMinError:R,isDraggingSibling:h,isOpen:Q,isReadOnly:l,key:F,onClickToggle:()=>{g(Q?"":F)},parentName:c,schema:P,setIsDraggingSibling:b,toggleCollapses:I})}))))};cr.defaultProps={componentValue:null,componentValueLength:0,formErrors:{},max:1/0,min:0},cr.propTypes={addRepeatableComponentToField:o().func.isRequired,componentUid:o().string.isRequired,componentValue:o().oneOfType([o().array,o().object]),componentValueLength:o().number,formErrors:o().object,isReadOnly:o().bool.isRequired,max:o().number,min:o().number,name:o().string.isRequired};const jg=(0,r.memo)(cr),$g=sg(jg,ig);var Bg=Object.defineProperty,ba=Object.getOwnPropertySymbols,Ng=Object.prototype.hasOwnProperty,Vg=Object.prototype.propertyIsEnumerable,Ea=(e,t,n)=>t in e?Bg(e,t,{enumerable:!0,configurable:!0,writable:!0,value:n}):e[t]=n,va=(e,t)=>{for(var n in t||(t={}))Ng.call(t,n)&&Ea(e,n,t[n]);if(ba)for(var n of ba(t))Vg.call(t,n)&&Ea(e,n,t[n]);return e};function qg(e,t){return n=>{const s=t(n);return r.createElement(e,va(va({},n),s))}}const Wg=qg;function zg({isFromDynamicZone:e,name:t}){const{addNonRepeatableComponentToField:n,createActionAllowedFields:s,isCreatingEntry:a,modifiedData:l,removeComponentFromField:i,readActionAllowedFields:u,updateActionAllowedFields:c,formErrors:d}=(0,y.useCMEditViewDataManager)(),{contentType:m}=lt(),f=(0,r.useMemo)(()=>{const C=(0,V.get)(m,["attributes"],{});return Object.keys(C).filter(I=>(0,V.get)(C,[I,"type"],"")==="dynamiczone")},[m]),g=(0,r.useMemo)(()=>a?s:c,[a,s,c]),h=(0,V.get)(l,t,null),b=(0,r.useMemo)(()=>Po(t),[t]),E=(0,r.useMemo)(()=>e&&a||g.filter(I=>I===b[0]).length>0?!0:g.map(I=>I.split(".")).filter(I=>I.length<b.length?!1:(0,V.take)(I,b.length).join(".")===b.join(".")).length>0,[e,a,g,b]),x=(0,r.useMemo)(()=>e||f.includes(b[0])?!0:(a?[]:u).map(I=>I.split(".")).filter(I=>I.length<b.length?!1:(0,V.take)(I,b.length).join(".")===b.join(".")).length>0,[e,f,b,a,u]),P=(0,r.useMemo)(()=>a||E?!1:x,[E,x,a]);return{addNonRepeatableComponentToField:n,formErrors:d,hasChildrenAllowedFields:E,hasChildrenReadableFields:x,isCreatingEntry:a,isReadOnly:P,removeComponentFromField:i,componentValue:h}}const Ug=zg,Hg=(0,k.default)(D.Box)`
|
|
923
|
-
svg path {
|
|
924
|
-
fill: ${({theme:e})=>e.colors.neutral500};
|
|
925
|
-
}
|
|
926
|
-
`,ur=({intlLabel:e,id:t,labelAction:n,name:s,numberOfEntries:a,showNumberOfEntries:l,required:i})=>{const{formatMessage:u}=(0,A.useIntl)(),c=e!=null&&e.id?u(e):s;return r.createElement(D.Box,{paddingBottom:1},r.createElement(j.Flex,null,r.createElement(L.Typography,{textColor:"neutral800",htmlFor:t||s,variant:"pi",fontWeight:"bold",as:"label"},c,l&&r.createElement(r.Fragment,null,"\xA0(",a,")"),i&&r.createElement(L.Typography,{textColor:"danger600"},"*")),n&&r.createElement(Hg,{paddingLeft:1},n)))};ur.defaultProps={id:void 0,labelAction:void 0,numberOfEntries:0,required:!1,showNumberOfEntries:!1},ur.propTypes={id:o().string,intlLabel:o().shape({id:o().string.isRequired,defaultMessage:o().string.isRequired,values:o().object}).isRequired,labelAction:o().element,name:o().string.isRequired,numberOfEntries:o().number,required:o().bool,showNumberOfEntries:o().bool};const Gg=ur,dr=({addNonRepeatableComponentToField:e,componentUid:t,intlLabel:n,isCreatingEntry:s,isFromDynamicZone:a,isRepeatable:l,isNested:i,labelAction:u,max:c,min:d,name:m,hasChildrenAllowedFields:f,hasChildrenReadableFields:g,isReadOnly:h,componentValue:b,removeComponentFromField:E,required:x})=>{const{formatMessage:P}=(0,A.useIntl)(),C=hd()(b),S=b!==null||a,I=!l&&S&&!a&&f;if(!f&&s)return r.createElement(y.NotAllowedInput,{labelAction:u,intlLabel:n,name:m});if(!f&&!s&&!g)return r.createElement(y.NotAllowedInput,{labelAction:u,intlLabel:n,name:m});const W=()=>{e(m,t)};return r.createElement(D.Box,null,r.createElement(j.Flex,{justifyContent:"space-between"},n&&r.createElement(Gg,{intlLabel:n,labelAction:u,name:m,numberOfEntries:C,showNumberOfEntries:l,required:x}),I&&r.createElement(Me.IconButton,{label:P({id:v("components.reset-entry"),defaultMessage:"Reset Entry"}),icon:r.createElement(Be(),null),noBorder:!0,onClick:()=>{E(m,t)}})),r.createElement(se.Stack,{spacing:1},!l&&!S&&r.createElement(ls,{isReadOnly:h,onClick:W}),!l&&S&&r.createElement(Xf,{componentUid:t,isFromDynamicZone:a,isNested:i,name:m}),l&&r.createElement($g,{componentValue:b,componentValueLength:C,componentUid:t,isReadOnly:h,max:c,min:d,name:m})))};dr.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},dr.propTypes={addNonRepeatableComponentToField:o().func.isRequired,componentUid:o().string.isRequired,componentValue:o().oneOfType([o().object,o().array]),hasChildrenAllowedFields:o().bool,hasChildrenReadableFields:o().bool,isCreatingEntry:o().bool.isRequired,isFromDynamicZone:o().bool,isReadOnly:o().bool,isRepeatable:o().bool,isNested:o().bool,intlLabel:o().shape({id:o().string.isRequired,defaultMessage:o().string.isRequired,values:o().object}),labelAction:o().element,max:o().number,min:o().number,name:o().string.isRequired,removeComponentFromField:o().func.isRequired,required:o().bool};const Zg=(0,r.memo)(dr,We()),Yt=Wg(Zg,Ug),_g=(0,k.default)(D.Box)`
|
|
927
|
-
width: ${({theme:e})=>e.spaces[2]};
|
|
928
|
-
height: ${({theme:e})=>e.spaces[4]};
|
|
929
|
-
`,Qg=()=>r.createElement(j.Flex,{justifyContent:"center"},r.createElement(_g,{background:"neutral200"})),Kg=(0,k.default)(se.Stack)`
|
|
930
|
-
svg {
|
|
931
|
-
path {
|
|
932
|
-
fill: ${({theme:e,expanded:t})=>t?e.colors.primary600:e.colors.neutral600};
|
|
933
|
-
}
|
|
934
|
-
}
|
|
935
|
-
`,pr=(0,k.default)(Me.IconButton)`
|
|
936
|
-
background-color: transparent;
|
|
937
|
-
`,Yg=(0,k.default)(D.Box)`
|
|
938
|
-
> div:first-child {
|
|
939
|
-
box-shadow: ${({theme:e})=>e.shadows.tableShadow};
|
|
940
|
-
}
|
|
941
|
-
`,Jg=(0,k.default)(D.Box)`
|
|
942
|
-
border-radius: 0 0 ${({theme:e})=>e.spaces[1]} ${({theme:e})=>e.spaces[1]};
|
|
943
|
-
`,Ca=({componentUid:e,formErrors:t,index:n,isOpen:s,isFieldAllowed:a,moveComponentDown:l,moveComponentUp:i,name:u,onToggle:c,removeComponentFromDynamicZone:d,showDownIcon:m,showUpIcon:f})=>{const{formatMessage:g}=(0,A.useIntl)(),{getComponentLayout:h}=lt(),{icon:b,friendlyName:E}=(0,r.useMemo)(()=>{const{info:{icon:Z,displayName:q}}=h(e);return{friendlyName:q,icon:Z}},[e,h]),x=()=>l(u,n),P=()=>i(u,n),C=()=>d(u,n),S=g({id:v("components.DynamicZone.move-down-label"),defaultMessage:"Move component down"}),I=g({id:v("components.DynamicZone.move-up-label"),defaultMessage:"Move component down"}),W=g({id:v("components.DynamicZone.delete-label"),defaultMessage:"Delete {name}"},{name:E}),B=Object.keys(t).filter(Z=>{const q=Z.split(".");return`${q[0]}.${q[1]}`==`${u}.${n}`});let U;return B.length>0&&(U=g({id:v("components.DynamicZone.error-message"),defaultMessage:"The component contains error(s)"})),r.createElement(D.Box,null,r.createElement(Qg,null),r.createElement(Yg,{hasRadius:!0},r.createElement(ze.Accordion,{expanded:s,onToggle:()=>c(n),size:"S",error:U},r.createElement(ze.AccordionToggle,{startIcon:r.createElement(Dn.G,{icon:b}),action:r.createElement(Kg,{horizontal:!0,spacing:0,expanded:s},m&&r.createElement(pr,{noBorder:!0,label:S,onClick:x,icon:r.createElement(md(),null)}),f&&r.createElement(pr,{noBorder:!0,label:I,onClick:P,icon:r.createElement(gd(),null)}),a&&r.createElement(pr,{noBorder:!0,label:W,onClick:C,icon:r.createElement(Be(),null)})),title:E,togglePosition:"left"}),r.createElement(ze.AccordionContent,null,r.createElement(Jg,{background:"neutral0"},r.createElement(xn.FocusTrap,{onEscape:()=>c(n)},r.createElement(Yt,{componentUid:e,icon:b,name:`${u}.${n}`,isFromDynamicZone:!0})))))))};Ca.propTypes={componentUid:o().string.isRequired,formErrors:o().object.isRequired,index:o().number.isRequired,isFieldAllowed:o().bool.isRequired,isOpen:o().bool.isRequired,moveComponentDown:o().func.isRequired,moveComponentUp:o().func.isRequired,name:o().string.isRequired,onToggle:o().func.isRequired,removeComponentFromDynamicZone:o().func.isRequired,showDownIcon:o().bool.isRequired,showUpIcon:o().bool.isRequired};const Xg=(0,r.memo)(Ca,We());var ey=p(81346),ty=p.n(ey);const Pa=(0,k.default)(Dn.G)`
|
|
944
|
-
width: ${(0,y.pxToRem)(32)} !important;
|
|
945
|
-
height: ${(0,y.pxToRem)(32)} !important;
|
|
946
|
-
padding: ${(0,y.pxToRem)(9)};
|
|
947
|
-
border-radius: ${(0,y.pxToRem)(64)};
|
|
948
|
-
background: ${({theme:e})=>e.colors.neutral150};
|
|
949
|
-
path {
|
|
950
|
-
fill: ${({theme:e})=>e.colors.neutral500};
|
|
951
|
-
}
|
|
952
|
-
`,ny=(0,k.default)(D.Box)`
|
|
953
|
-
flex-shrink: 0;
|
|
954
|
-
height: ${(0,y.pxToRem)(84)};
|
|
955
|
-
border: 1px solid ${({theme:e})=>e.colors.neutral200};
|
|
956
|
-
background: ${({theme:e})=>e.colors.neutral100};
|
|
957
|
-
border-radius: ${({theme:e})=>e.borderRadius};
|
|
958
|
-
display: flex;
|
|
959
|
-
justify-content: center;
|
|
960
|
-
align-items: center;
|
|
961
|
-
|
|
962
|
-
&.active,
|
|
963
|
-
&:hover {
|
|
964
|
-
border: 1px solid ${({theme:e})=>e.colors.primary200};
|
|
965
|
-
background: ${({theme:e})=>e.colors.primary100};
|
|
966
|
-
|
|
967
|
-
${Pa} {
|
|
968
|
-
background: ${({theme:e})=>e.colors.primary200};
|
|
969
|
-
path {
|
|
970
|
-
fill: ${({theme:e})=>e.colors.primary600};
|
|
971
|
-
}
|
|
972
|
-
}
|
|
973
|
-
|
|
974
|
-
${L.Typography} {
|
|
975
|
-
color: ${({theme:e})=>e.colors.primary600};
|
|
976
|
-
}
|
|
977
|
-
}
|
|
978
|
-
`;function mr({componentUid:e,intlLabel:t,icon:n,onClick:s}){const{formatMessage:a}=(0,A.useIntl)(),l=()=>{s(e)};return r.createElement("button",{type:"button",onClick:l},r.createElement(ny,{borderRadius:"borderRadius"},r.createElement(se.Stack,{spacing:1,style:{justifyContent:"center",alignItems:"center"}},r.createElement(Pa,{icon:n}),r.createElement(L.Typography,{variant:"pi",fontWeight:"bold",textColor:"neutral600"},a(t)))))}mr.defaultProps={icon:"dice-d6",onClick(){}},mr.propTypes={componentUid:o().string.isRequired,intlLabel:o().shape({id:o().string.isRequired,defaultMessage:o().string.isRequired}).isRequired,icon:o().string,onClick:o().func};const ry=mr,oy=k.default.div`
|
|
979
|
-
display: grid;
|
|
980
|
-
grid-template-columns: repeat(auto-fit, ${140/16}rem);
|
|
981
|
-
grid-gap: ${({theme:e})=>e.spaces[1]};
|
|
982
|
-
`,Oa=({category:e,components:t,isOdd:n,isOpen:s,onAddComponent:a,onToggle:l})=>{const{formatMessage:i}=(0,A.useIntl)(),u=()=>{l(e)};return r.createElement(ze.Accordion,{expanded:s,onToggle:u,size:"S"},r.createElement(ze.AccordionToggle,{variant:n?"primary":"secondary",title:i({id:e,defaultMessage:e}),togglePosition:"left"}),r.createElement(ze.AccordionContent,null,r.createElement(D.Box,{paddingTop:4,paddingBottom:4,paddingLeft:3,paddingRight:3},r.createElement(oy,null,t.map(({componentUid:c,info:{displayName:d,icon:m}})=>r.createElement(ry,{key:c,componentUid:c,intlLabel:{id:d,defaultMessage:d},icon:m,onClick:a}))))))};Oa.propTypes={category:o().string.isRequired,components:o().array.isRequired,isOdd:o().bool.isRequired,isOpen:o().bool.isRequired,onAddComponent:o().func.isRequired,onToggle:o().func.isRequired};const sy=Oa,Ra=({components:e,isOpen:t,onClickAddComponent:n})=>{const{formatMessage:s}=(0,A.useIntl)(),{getComponentLayout:a}=lt(),[l,i]=(0,r.useState)(""),u=(0,r.useMemo)(()=>{const m=e.map(g=>{const{category:h,info:b}=a(g);return{componentUid:g,category:h,info:b}}),f=ty()(m,"category");return Object.keys(f).reduce((g,h)=>(g.push({category:h,components:f[h]}),g),[])},[e,a]);(0,r.useEffect)(()=>{t&&u.length&&i(u[0].category)},[t,u]);const c=(0,r.useCallback)(m=>{n(m),i("")},[n]),d=(0,r.useCallback)(m=>{i(l===m?"":m)},[l]);return t?r.createElement(D.Box,{paddingBottom:6},r.createElement(D.Box,{paddingTop:6,paddingBottom:6,paddingLeft:5,paddingRight:5,background:"neutral0",shadow:"tableShadow",borderColor:"neutral150",hasRadius:!0},r.createElement(j.Flex,{justifyContent:"center"},r.createElement(L.Typography,{fontWeight:"bold",textColor:"neutral600"},s({id:v("components.DynamicZone.ComponentPicker-label"),defaultMessage:"Pick one component"}))),r.createElement(D.Box,{paddingTop:2},r.createElement(ga.KeyboardNavigable,{attributeName:"data-strapi-accordion-toggle"},u.map(({category:m,components:f},g)=>r.createElement(sy,{key:m,category:m,components:f,isOdd:g%2===1,isOpen:m===l,onAddComponent:c,onToggle:d})))))):null};Ra.propTypes={components:o().array.isRequired,isOpen:o().bool.isRequired,onClickAddComponent:o().func.isRequired};const ay=(0,r.memo)(Ra);var iy=Object.defineProperty,ly=Object.defineProperties,cy=Object.getOwnPropertyDescriptors,Ma=Object.getOwnPropertySymbols,uy=Object.prototype.hasOwnProperty,dy=Object.prototype.propertyIsEnumerable,Ta=(e,t,n)=>t in e?iy(e,t,{enumerable:!0,configurable:!0,writable:!0,value:n}):e[t]=n,py=(e,t)=>{for(var n in t||(t={}))uy.call(t,n)&&Ta(e,n,t[n]);if(Ma)for(var n of Ma(t))dy.call(t,n)&&Ta(e,n,t[n]);return e},my=(e,t)=>ly(e,cy(t));const wa=e=>Array.from({length:e}).map(()=>({isOpen:!1})),fr=({name:e,addComponentToDynamicZone:t,formErrors:n,isCreatingEntry:s,isFieldAllowed:a,isFieldReadable:l,labelAction:i,moveComponentUp:u,moveComponentDown:c,removeComponentFromDynamicZone:d,dynamicDisplayedComponents:m,fieldSchema:f,metadatas:g})=>{const h=(0,y.useNotification)(),[b,E]=(0,r.useState)(!1),[x,P]=(0,r.useState)(!1),C=m.length,S=g.description?{id:g.description,defaultMessage:g.description}:null,[I,W]=(0,r.useState)(wa(C));(0,r.useEffect)(()=>{W(wa(C))},[C]),(0,r.useEffect)(()=>{x&&(W(w=>w.map((O,_)=>_===w.length-1?my(py({},O),{isOpen:!0}):O)),P(!1))},[x]);const{max:R=1/0,min:B=-1/0}=f,U=(0,r.useMemo)(()=>Object.keys(n).filter(w=>w===e).map(w=>n[w]),[n,e]),Z=(0,r.useMemo)(()=>f.components||[],[f]),q=B-C,G=U.length>0,F=U.length>0&&M()(U,[0,"id"],"").includes("min"),Q=G&&M()(U,[0,"id"],"")==="components.Input.error.validation.max",$=(0,r.useCallback)(w=>{E(!1),t(e,w,G),P(!0)},[t,G,e]),Y=()=>{C<R?E(w=>!w):h({type:"info",message:{id:v("components.notification.info.maximum-requirement")}})},T=w=>{W(O=>O.map(({isOpen:_},re)=>re===w?{isOpen:!_}:{isOpen:_}))},z=(w,O)=>{c(w,O),W(_=>_.map(({isOpen:re},ue,me)=>ue===O+1?{isOpen:me[O].isOpen}:ue===O?{isOpen:me[ue+1].isOpen}:{isOpen:re}))},K=(w,O)=>{u(w,O),W(_=>_.map(({isOpen:re},ue,me)=>ue===O-1?{isOpen:me[O].isOpen}:ue===O?{isOpen:me[ue-1].isOpen}:{isOpen:re}))},N=(w,O)=>{d(w,O)};return!a&&s?r.createElement(y.NotAllowedInput,{description:S,intlLabel:{id:g.label,defaultMessage:g.label},labelAction:i,name:e}):!a&&!l&&!s?r.createElement(y.NotAllowedInput,{description:S,intlLabel:{id:g.label,defaultMessage:g.label},labelAction:i,name:e}):r.createElement(se.Stack,{spacing:6},C>0&&r.createElement(D.Box,null,r.createElement(dd,{intlDescription:S,label:g.label,labelAction:i,name:e,numberOfComponents:C,required:f.required||!1}),m.map((w,O)=>{var _;const re=a&&C>0&&O<C-1,ue=a&&C>0&&O>0,me=((_=I[O])==null?void 0:_.isOpen)||!1;return r.createElement(Xg,{componentUid:w,formErrors:n,key:O,index:O,isOpen:me,isFieldAllowed:a,moveComponentDown:z,moveComponentUp:K,onToggle:T,name:e,removeComponentFromDynamicZone:N,showDownIcon:re,showUpIcon:ue})})),r.createElement(cd,{hasError:G,hasMaxError:Q,hasMinError:F,isDisabled:!a,label:g.label,missingComponentNumber:q,isOpen:b,name:e,onClick:Y}),r.createElement(ay,{isOpen:b,components:Z,onClickAddComponent:$}))};fr.defaultProps={dynamicDisplayedComponents:[],fieldSchema:{max:1/0,min:-1/0},labelAction:null},fr.propTypes={addComponentToDynamicZone:o().func.isRequired,dynamicDisplayedComponents:o().array,fieldSchema:o().shape({components:o().array.isRequired,max:o().number,min:o().number,required:o().bool}),formErrors:o().object.isRequired,isCreatingEntry:o().bool.isRequired,isFieldAllowed:o().bool.isRequired,isFieldReadable:o().bool.isRequired,labelAction:o().element,metadatas:o().shape({description:o().string,label:o().string}).isRequired,moveComponentUp:o().func.isRequired,moveComponentDown:o().func.isRequired,name:o().string.isRequired,removeComponentFromDynamicZone:o().func.isRequired};const fy=(0,r.memo)(fr,We()),gy=rd(fy,sd);var tt=p(41578);const Jt=()=>({type:tt.ZA}),gr=e=>({type:tt.Id,data:e}),yr=(e,t=!1)=>({type:tt.TP,rawQuery:e,isSingleType:t}),Ia=()=>({type:tt.c2}),Da=(e,t)=>({type:tt.w7,componentsDataStructure:e,contentTypeDataStructure:t}),he=e=>({type:tt.d0,status:e}),Ge=e=>({type:tt.t9,data:e}),xa=e=>e["content-manager_editViewCrudReducer"];var yy=p(98399),hy=Object.defineProperty,Sa=Object.getOwnPropertySymbols,by=Object.prototype.hasOwnProperty,Ey=Object.prototype.propertyIsEnumerable,La=(e,t,n)=>t in e?hy(e,t,{enumerable:!0,configurable:!0,writable:!0,value:n}):e[t]=n,vy=(e,t)=>{for(var n in t||(t={}))by.call(t,n)&&La(e,n,t[n]);if(Sa)for(var n of Sa(t))Ey.call(t,n)&&La(e,n,t[n]);return e},nt=(e,t,n)=>new Promise((s,a)=>{var l=c=>{try{u(n.next(c))}catch(d){a(d)}},i=c=>{try{u(n.throw(c))}catch(d){a(d)}},u=c=>c.done?s(c.value):Promise.resolve(c.value).then(l,i);u((n=n.apply(e,t)).next())});const hr=({allLayoutData:e,children:t,slug:n,id:s,origin:a})=>{const l=(0,y.useNotification)(),{setCurrentStep:i}=(0,y.useGuidedTour)(),{trackUsage:u}=(0,y.useTracking)(),{push:c,replace:d}=(0,ee.useHistory)(),[{rawQuery:m}]=(0,y.useQueryParams)(),f=(0,fe.useDispatch)(),{componentsDataStructure:g,contentTypeDataStructure:h,data:b,isLoading:E,status:x}=(0,fe.useSelector)(xa),P=Go(n),C=(0,r.useRef)(!0),S=(0,r.useRef)(u),I=(0,r.useRef)(e),W=s===null,R=(0,r.useMemo)(()=>W&&!a?null:ve(`collection-types/${n}/${a||s}`),[n,s,W,a]),B=(0,r.useCallback)(T=>a?(0,y.contentManagementUtilRemoveFieldsFromData)(T,I.current.contentType,I.current.components):T,[a]),U=(0,r.useCallback)(T=>{const z=So(T,I.current.contentType,I.current.components);return(0,y.formatContentTypeData)(z,I.current.contentType,I.current.components)},[]);(0,r.useEffect)(()=>{const T=Object.keys(e.components).reduce((N,w)=>{const O=$t(M()(e,["components",w,"attributes"],{}),e.components);return N[w]=(0,y.formatContentTypeData)(O,e.components[w],e.components),N},{}),z=$t(e.contentType.attributes,e.components),K=(0,y.formatContentTypeData)(z,e.contentType,e.components);f(Da(T,K))},[e,f]),(0,r.useEffect)(()=>()=>{f(Ia())},[f]),(0,r.useEffect)(()=>{const z=Se().CancelToken.source(),K=w=>nt(void 0,null,function*(){f(Jt());try{const{data:O}=yield ge.be.get(R,{cancelToken:w.token});f(gr(U(B(O))))}catch(O){if(Se().isCancel(O))return;yy.error(O);const _=M()(O,"response.status",null);if(_===404){c(P);return}_===403&&(l({type:"info",message:{id:v("permissions.not-allowed.update")}}),c(P))}}),N=()=>nt(void 0,null,function*(){yield f(Jt()),yield f(yr(m))});return C.current?(R?K(z):N(),()=>{z.cancel("Operation canceled by the user.")}):()=>{}},[B,U,c,R,f,m,P,l]);const Z=(0,r.useCallback)(T=>{const z=T.response.data;let K=M()(z,["error","message"],"Bad Request");Array.isArray(K)&&(K=M()(K,["0","messages","0","id"])),typeof K=="string"&&l({type:"warning",message:K})},[l]),q=(0,r.useCallback)(T=>nt(void 0,null,function*(){try{S.current("willDeleteEntry",T);const{data:z}=yield ge.be.delete(ve(`collection-types/${n}/${s}`));return l({type:"success",message:{id:v("success.record.delete")}}),S.current("didDeleteEntry",T),Promise.resolve(z)}catch(z){return S.current("didNotDeleteEntry",vy({error:z},T)),Promise.reject(z)}}),[s,n,l]),G=(0,r.useCallback)(()=>{d(P)},[P,d]),F=(0,r.useCallback)((T,z)=>nt(void 0,null,function*(){const K=`${ve(`collection-types/${n}`)}${m}`;try{f(he("submit-pending"));const{data:N}=yield ge.be.post(K,T);return S.current("didCreateEntry",z),l({type:"success",message:{id:v("success.record.save")}}),i("contentManager.success"),f(Ge(U(N))),f(he("resolved")),d(`/content-manager/collectionType/${n}/${N.id}${m}`),Promise.resolve(N)}catch(N){return Z(N),S.current("didNotCreateEntry",{error:N,trackerProperty:z}),f(he("resolved")),Promise.reject(N)}}),[U,Z,d,n,f,m,l,i]),Q=(0,r.useCallback)(()=>nt(void 0,null,function*(){try{S.current("willPublishEntry");const T=ve(`collection-types/${n}/${s}/actions/publish`);f(he("publish-pending"));const{data:z}=yield ge.be.post(T);return S.current("didPublishEntry"),f(Ge(U(z))),f(he("resolved")),l({type:"success",message:{id:v("success.record.publish")}}),Promise.resolve(z)}catch(T){return Z(T),f(he("resolved")),Promise.reject(T)}}),[U,Z,s,n,f,l]),$=(0,r.useCallback)((T,z)=>nt(void 0,null,function*(){const K=ve(`collection-types/${n}/${s}`);try{S.current("willEditEntry",z),f(he("submit-pending"));const{data:N}=yield ge.be.put(K,T);return S.current("didEditEntry",{trackerProperty:z}),l({type:"success",message:{id:v("success.record.save")}}),f(Ge(U(N))),f(he("resolved")),Promise.resolve(N)}catch(N){return S.current("didNotEditEntry",{error:N,trackerProperty:z}),Z(N),f(he("resolved")),Promise.reject(N)}}),[U,Z,n,s,f,l]),Y=(0,r.useCallback)(()=>nt(void 0,null,function*(){const T=ve(`collection-types/${n}/${s}/actions/unpublish`);f(he("unpublish-pending"));try{S.current("willUnpublishEntry");const{data:z}=yield ge.be.post(T);return S.current("didUnpublishEntry"),l({type:"success",message:{id:v("success.record.unpublish")}}),f(Ge(U(z))),f(he("resolved")),Promise.resolve(z)}catch(z){return f(he("resolved")),Z(z),Promise.reject(z)}}),[U,Z,s,n,f,l]);return t({componentsDataStructure:g,contentTypeDataStructure:h,data:b,isCreatingEntry:W,isLoadingForData:E,onDelete:q,onDeleteSucceeded:G,onPost:F,onPublish:Q,onPut:$,onUnpublish:Y,status:x,redirectionLink:P})};hr.defaultProps={id:null,origin:null},hr.propTypes={allLayoutData:o().exact({components:o().object.isRequired,contentType:o().shape({apiID:o().string.isRequired,attributes:o().object.isRequired,info:o().object.isRequired,isDisplayed:o().bool.isRequired,kind:o().string.isRequired,layouts:o().object.isRequired,metadatas:o().object.isRequired,options:o().object.isRequired,pluginOptions:o().object,settings:o().object.isRequired,uid:o().string.isRequired}).isRequired}).isRequired,children:o().func.isRequired,id:o().string,origin:o().string,slug:o().string.isRequired};const Cy=(0,r.memo)(hr,We());var Py=p(89793),Xt=p.n(Py),Oy=p(56236),Ry=p.n(Oy);const br=(e,t,n,s)=>{const a=e.slice();return a.splice(t,1),a.splice(n,0,s),a},My=(e,t,n)=>{const s=(i,u)=>M()(i,["attributes",u,"type"],""),a=(i,u)=>M()(i,["attributes",...u],""),l=(i,u)=>Object.keys(i).reduce((c,d)=>{const m=s(u,d),f=M()(i,d),g=a(u,[d,"component"]),h=a(u,[d,"repeatable"]);let b;switch(m){case"json":b=JSON.parse(f);break;case"time":{b=f,f&&f.split(":").length<3&&(b=`${f}:00`);break}case"media":a(u,[d,"multiple"])===!0?b=f?f.filter(E=>!(E instanceof File)):null:b=M()(f,0)instanceof File?null:M()(f,"id",null);break;case"component":h?b=f&&f.map(E=>l(E,n[g])):b=f&&l(f,n[g]);break;case"dynamiczone":b=f.map(E=>l(E,n[E.__component]));break;default:b=Ty(f,"id")}return c[d]=b,c},{});return l(e,t)},Ty=(e,t)=>As()(e)?e.map(n=>n[t]?n[t]:n):Wo()(e)?e[t]:e,wy=My;var Iy=p(51355),Dy=p.n(Iy),xy=p(95919),Sy=p.n(xy),Ly=p(78746),dt=p.n(Ly),be=p(5173);function wt(e){return["integer","biginteger","decimal","float","number"].includes(e)}var Fy=Object.defineProperty,ky=Object.defineProperties,Ay=Object.getOwnPropertyDescriptors,Fa=Object.getOwnPropertySymbols,jy=Object.prototype.hasOwnProperty,$y=Object.prototype.propertyIsEnumerable,ka=(e,t,n)=>t in e?Fy(e,t,{enumerable:!0,configurable:!0,writable:!0,value:n}):e[t]=n,Aa=(e,t)=>{for(var n in t||(t={}))jy.call(t,n)&&ka(e,n,t[n]);if(Fa)for(var n of Fa(t))$y.call(t,n)&&ka(e,n,t[n]);return e},ja=(e,t)=>ky(e,Ay(t));be.kM(be.nK,"defined",function(){return this.test("defined",y.translatedErrors.required,e=>e!==void 0)}),be.kM(be.IX,"notEmptyMin",function(e){return this.test("notEmptyMin",y.translatedErrors.min,t=>Re()(t)?!0:t.length>=e)}),be.kM(be.Z_,"isInferior",function(e,t){return this.test("isInferior",e,function(n){return!n||Number.isNaN(dt()(n))?!0:dt()(t)>=dt()(n)})}),be.kM(be.Z_,"isSuperior",function(e,t){return this.test("isSuperior",e,function(n){return!n||Number.isNaN(dt()(n))?!0:dt()(n)>=dt()(t)})});const By=e=>M()(e,["attributes"],{}),Er=(e,{components:t},n={isCreatingEntry:!0,isDraft:!0,isFromComponent:!1})=>{const s=By(e);return be.Ry().shape(Object.keys(s).reduce((a,l)=>{const i=s[l];if(i.type!=="relation"&&i.type!=="component"&&i.type!=="dynamiczone"){const u=Ny(i.type,i,n);a[l]=u}if(i.type==="relation"&&(a[l]=["oneWay","oneToOne","manyToOne","oneToManyMorph","oneToOneMorph"].includes(i.relationType)?be.Ry().nullable():be.IX().nullable()),i.type==="component"){const u=Er(t[i.component],{components:t},ja(Aa({},n),{isFromComponent:!0}));if(i.repeatable===!0){const{min:d,max:m,required:f}=i;let g=be.Vo(h=>{let b=be.IX().of(u);return d?f?b=b.min(d,y.translatedErrors.min):f!==!0&&Re()(h)?b=b.nullable():b=b.min(d,y.translatedErrors.min):f&&!n.isDraft&&(b=b.min(1,y.translatedErrors.required)),m&&(b=b.max(m,y.translatedErrors.max)),b});return a[l]=g,a}const c=be.Vo(d=>d!==void 0?i.required===!0&&!n.isDraft?u.defined():u.nullable():i.required===!0?be.Ry().defined():be.Ry().nullable());return a[l]=c,a}if(i.type==="dynamiczone"){let u=be.IX().of(be.Vo(({__component:m})=>Er(t[m],{components:t},ja(Aa({},n),{isFromComponent:!0}))));const{max:c,min:d}=i;d?i.required?u=u.test("min",y.translatedErrors.min,m=>n.isCreatingEntry?m&&m.length>=d:m===void 0?!0:m!==null&&m.length>=d).test("required",y.translatedErrors.required,m=>n.isCreatingEntry?m!==null||m!==void 0:m===void 0?!0:m!==null):u=u.notEmptyMin(d):i.required&&!n.isDraft&&(u=u.test("required",y.translatedErrors.required,m=>n.isCreatingEntry?m!==null||m!==void 0:m===void 0?!0:m!==null)),c&&(u=u.max(c,y.translatedErrors.max)),a[l]=u}return a},{}))},Ny=(e,t,n)=>{let s=be.nK();return["string","uid","text","richtext","email","password","enumeration"].includes(e)&&(s=be.Z_()),e==="json"&&(s=be.nK(y.translatedErrors.json).test("isJSON",y.translatedErrors.json,a=>{if(a===void 0)return!0;try{return JSON.parse(a),!0}catch(l){return!1}}).nullable()),e==="email"&&(s=s.email(y.translatedErrors.email)),["number","integer","float","decimal"].includes(e)&&(s=be.Rx().transform(a=>Sy()(a)?void 0:a).typeError()),e==="biginteger"&&(s=be.Z_().matches(/^-?\d*$/)),["date","datetime"].includes(e)&&(s=be.hT()),Object.keys(t).forEach(a=>{const l=t[a];if(!!l||!Dy()(l)&&Number.isInteger(Math.floor(l))||l===0)switch(a){case"required":{n.isDraft||(e==="password"&&n.isCreatingEntry&&(s=s.required(y.translatedErrors.required)),e!=="password"&&(n.isCreatingEntry?s=s.required(y.translatedErrors.required):s=s.test("required",y.translatedErrors.required,i=>i===void 0&&!n.isFromComponent?!0:wt(e)?i===0?!0:!!i:e==="boolean"?i!==null:e==="date"||e==="datetime"?typeof i=="string"?!Re()(i):!Re()(i==null?void 0:i.toString()):!Re()(i))));break}case"max":{e==="biginteger"?s=s.isInferior(y.translatedErrors.max,l):s=s.max(l,y.translatedErrors.max);break}case"maxLength":s=s.max(l,y.translatedErrors.maxLength);break;case"min":{e==="biginteger"?s=s.isSuperior(y.translatedErrors.min,l):s=s.min(l,y.translatedErrors.min);break}case"minLength":{n.isDraft||(s=s.min(l,y.translatedErrors.minLength));break}case"regex":s=s.matches(new RegExp(l),{message:y.translatedErrors.regex,excludeEmptyString:!t.required});break;case"lowercase":["text","textarea","email","string"].includes(e)&&(s=s.strict().lowercase());break;case"uppercase":["text","textarea","email","string"].includes(e)&&(s=s.strict().uppercase());break;case"positive":wt(e)&&(s=s.positive());break;case"negative":wt(e)&&(s=s.negative());break;default:s=s.nullable()}}),s},$a=Er;var Vy=Object.defineProperty,qy=Object.defineProperties,Wy=Object.getOwnPropertyDescriptors,Ba=Object.getOwnPropertySymbols,zy=Object.prototype.hasOwnProperty,Uy=Object.prototype.propertyIsEnumerable,Na=(e,t,n)=>t in e?Vy(e,t,{enumerable:!0,configurable:!0,writable:!0,value:n}):e[t]=n,Va=(e,t)=>{for(var n in t||(t={}))zy.call(t,n)&&Na(e,n,t[n]);if(Ba)for(var n of Ba(t))Uy.call(t,n)&&Na(e,n,t[n]);return e},qa=(e,t)=>qy(e,Wy(t));const Hy={componentsDataStructure:{},contentTypeDataStructure:{},formErrors:{},initialData:{},modifiedData:null,shouldCheckErrors:!1,modifiedDZName:null},Gy=(e,t)=>(0,qt.default)(e,n=>{switch(t.type){case"ADD_NON_REPEATABLE_COMPONENT_TO_FIELD":{ne()(n,["modifiedData",...t.keys],e.componentsDataStructure[t.componentUid]);break}case"ADD_REPEATABLE_COMPONENT_TO_FIELD":{let s=M()(e,["modifiedData",...t.keys],[]).slice();const a=qa(Va({},e.componentsDataStructure[t.componentUid]),{__temp_key__:Oo(s)+1});Array.isArray(s)?s.push(a):s=[a],ne()(n,["modifiedData",...t.keys],s),t.shouldCheckErrors&&(n.shouldCheckErrors=!e.shouldCheckErrors);break}case"ADD_COMPONENT_TO_DYNAMIC_ZONE":{n.modifiedDZName=t.keys[0],t.shouldCheckErrors&&(n.shouldCheckErrors=!e.shouldCheckErrors);const s=qa(Va({},e.componentsDataStructure[t.componentUid]),{__component:t.componentUid}),a=M()(e,["modifiedData",...t.keys],null),l=a?[...a,s]:[s];ne()(n,["modifiedData",...t.keys],l);break}case"ADD_RELATION":{if(!Array.isArray(t.value)||!t.value.length)break;const s=t.value[0].value,a=M()(e,["modifiedData",...t.keys],null);if(!a){ne()(n,["modifiedData",...t.keys],[s]);break}ne()(n,["modifiedData",...t.keys],[...a,s]);break}case"INIT_FORM":{n.formErrors={},n.initialData=t.initialValues,n.modifiedData=t.initialValues,n.modifiedDZName=null,n.shouldCheckErrors=!1;break}case"MOVE_COMPONENT_FIELD":{const s=M()(e,["modifiedData",...t.pathToComponent]),a=M()(e,["modifiedData",...t.pathToComponent,t.dragIndex]),l=br(s,t.dragIndex,t.hoverIndex,a);ne()(n,["modifiedData",...t.pathToComponent],l);break}case"MOVE_COMPONENT_UP":case"MOVE_COMPONENT_DOWN":{const{currentIndex:s,dynamicZoneName:a,shouldCheckErrors:l}=t;l&&(n.shouldCheckErrors=!e.shouldCheckErrors);const i=e.modifiedData[a],u=t.type==="MOVE_COMPONENT_UP"?s-1:s+1,c=e.modifiedData[a][s],d=br(i,s,u,c);ne()(n,["modifiedData",t.dynamicZoneName],d);break}case"MOVE_FIELD":{const s=M()(e,["modifiedData",...t.keys],[]).slice(),a=M()(e,["modifiedData",...t.keys,t.dragIndex]),l=br(s,t.dragIndex,t.overIndex,a);ne()(n,["modifiedData",...t.keys],l);break}case"ON_CHANGE":{const[s]=t.keys;if(t.shouldSetInitialValue&&ne()(n,["initialData",...t.keys],t.value),t.keys.length===2&&M()(e,["modifiedData",s])===null){ne()(n,["modifiedData",s],{[t.keys[1]]:t.value});break}ne()(n,["modifiedData",...t.keys],t.value);break}case"REMOVE_COMPONENT_FROM_DYNAMIC_ZONE":{t.shouldCheckErrors&&(n.shouldCheckErrors=!e.shouldCheckErrors),n.modifiedData[t.dynamicZoneName].splice(t.index,1);break}case"REMOVE_COMPONENT_FROM_FIELD":{const s=["modifiedData",...t.keys];ne()(n,s,null);break}case"REMOVE_PASSWORD_FIELD":{Ry()(n,["modifiedData",...t.keys]);break}case"REMOVE_REPEATABLE_FIELD":{const s=t.keys.length-1,a=["modifiedData",...Zt()(t.keys,s)];Object.keys(e.formErrors).length>0&&(n.shouldCheckErrors=!e.shouldCheckErrors);const i=M()(e,a).slice();i.splice(parseInt(t.keys[s],10),1),ne()(n,a,i);break}case"REMOVE_RELATION":{const s=t.keys.split("."),a=s.length-1,l=["modifiedData",...Zt()(s,a)],i=M()(e,l).slice(),u=parseInt(s[a],10);i.splice(u,1),ne()(n,l,i);break}case"SET_DEFAULT_DATA_STRUCTURES":{n.componentsDataStructure=t.componentsDataStructure,n.contentTypeDataStructure=t.contentTypeDataStructure;break}case"SET_FORM_ERRORS":{n.modifiedDZName=null,n.formErrors=t.errors;break}case"TRIGGER_FORM_VALIDATION":{Object.keys(e.formErrors).length>0&&(n.shouldCheckErrors=!e.shouldCheckErrors);break}default:return n}});var Zy=Object.defineProperty,Wa=Object.getOwnPropertySymbols,_y=Object.prototype.hasOwnProperty,Qy=Object.prototype.propertyIsEnumerable,za=(e,t,n)=>t in e?Zy(e,t,{enumerable:!0,configurable:!0,writable:!0,value:n}):e[t]=n,en=(e,t)=>{for(var n in t||(t={}))_y.call(t,n)&&za(e,n,t[n]);if(Wa)for(var n of Wa(t))Qy.call(t,n)&&za(e,n,t[n]);return e},vr=(e,t,n)=>new Promise((s,a)=>{var l=c=>{try{u(n.next(c))}catch(d){a(d)}},i=c=>{try{u(n.throw(c))}catch(d){a(d)}},u=c=>c.done?s(c.value):Promise.resolve(c.value).then(l,i);u((n=n.apply(e,t)).next())});const Cr=({allLayoutData:e,allowedActions:{canRead:t,canUpdate:n},children:s,componentsDataStructure:a,contentTypeDataStructure:l,createActionAllowedFields:i,from:u,initialValues:c,isCreatingEntry:d,isLoadingForData:m,isSingleType:f,onPost:g,onPublish:h,onPut:b,onUnpublish:E,readActionAllowedFields:x,redirectToPreviousPage:P,slug:C,status:S,updateActionAllowedFields:I})=>{const[W,R]=(0,r.useReducer)(Gy,Hy),{formErrors:B,initialData:U,modifiedData:Z,modifiedDZName:q,shouldCheckErrors:G}=W,F=(0,y.useNotification)(),{lockApp:Q,unlockApp:$}=(0,y.useOverlayBlocker)(),Y=M()(e,["contentType"],{}),T=(0,r.useMemo)(()=>M()(Y,["options","draftAndPublish"],!1),[Y]),z=(0,r.useMemo)(()=>T&&!U.publishedAt,[T,U.publishedAt]),{trackUsage:K}=(0,y.useTracking)(),{formatMessage:N}=(0,A.useIntl)(),w=(0,r.useRef)(K),O=(0,r.useMemo)(()=>m||d?!1:t===!1&&n===!1,[m,d,t,n]);(0,r.useEffect)(()=>{S==="resolved"?$():Q()},[Q,$,S]),(0,r.useEffect)(()=>{m||rt()},[G]),(0,r.useEffect)(()=>{const te=Object.keys(B);if(te.length>0){const J=te[0],le=document.getElementById(J);le&&le.focus()}},[B]),(0,r.useEffect)(()=>{O&&F({type:"info",message:{id:v("permissions.not-allowed.update")}})},[O,F]),(0,r.useEffect)(()=>{R({type:"SET_DEFAULT_DATA_STRUCTURES",componentsDataStructure:a,contentTypeDataStructure:l})},[a,l]),(0,r.useEffect)(()=>{c&&R({type:"INIT_FORM",initialValues:c})},[c]);const _=(0,r.useCallback)((te,J,le=!1)=>{w.current("didAddComponentToDynamicZone"),R({type:"ADD_COMPONENT_TO_DYNAMIC_ZONE",keys:te.split("."),componentUid:J,shouldCheckErrors:le})},[]),re=(0,r.useCallback)((te,J)=>{R({type:"ADD_NON_REPEATABLE_COMPONENT_TO_FIELD",keys:te.split("."),componentUid:J})},[]),ue=(0,r.useCallback)(({target:{name:te,value:J}})=>{R({type:"ADD_RELATION",keys:te.split("."),value:J})},[]),me=(0,r.useCallback)((te,J,le=!1)=>{R({type:"ADD_REPEATABLE_COMPONENT_TO_FIELD",keys:te.split("."),componentUid:J,shouldCheckErrors:le})},[]),Fe=(0,r.useMemo)(()=>{const te={isCreatingEntry:d,isDraft:z,isFromComponent:!1};return $a(Y,{components:e.components||{}},te)},[e.components,Y,d,z]),rt=(0,r.useCallback)((...te)=>vr(void 0,[...te],function*(J={}){let le={};const ot=qe()(Z);Re()(ot)||ne()(ot,J.path,J.value);try{yield Fe.validate(ot,{abortEarly:!1})}catch(yn){le=(0,y.getYupInnerErrors)(yn),q&&(le=Object.keys(le).reduce((gc,to)=>(to.split(".")[0]!==q&&(gc[to]=le[to]),gc),{}))}R({type:"SET_FORM_ERRORS",errors:le})}),[q,Z,Fe]),H=(0,r.useCallback)(({target:{name:te,value:J,type:le}},ot=!1)=>{let yn=J;if(["text","textarea","string","email","uid","select","select-one","number"].includes(le)&&!J&&J!==0&&(yn=null),le==="password"&&!J){R({type:"REMOVE_PASSWORD_FIELD",keys:te.split(".")});return}R({type:"ON_CHANGE",keys:te.split("."),value:yn,shouldSetInitialValue:ot})},[]),de=(0,r.useCallback)(te=>{const J=au(qe()(te),"__temp_key__");return wy(J,Y,e.components)},[e.components,Y]),je=(0,r.useMemo)(()=>T?z?{status:"draft"}:{}:{},[T,z]),Ue=(0,r.useCallback)(te=>vr(void 0,null,function*(){te.preventDefault();let J={};try{yield Fe.validate(Z,{abortEarly:!1})}catch(le){J=(0,y.getYupInnerErrors)(le)}try{if(Re()(J)){const le=de(Z);d?yield g(le,je):yield b(le,je)}}catch(le){J=en(en({},J),(0,y.getAPIInnerErrors)(le,{getTrad:v}))}R({type:"SET_FORM_ERRORS",errors:J})}),[de,d,Z,g,b,je,Fe]),ht=(0,r.useCallback)(()=>vr(void 0,null,function*(){const te=$a(Y,{components:M()(e,"components",{})},{isCreatingEntry:d,isDraft:!1,isFromComponent:!1});let J={};try{yield te.validate(Z,{abortEarly:!1})}catch(le){J=(0,y.getYupInnerErrors)(le)}try{Re()(J)&&(yield h())}catch(le){J=en(en({},J),(0,y.getAPIInnerErrors)(le,{getTrad:v}))}R({type:"SET_FORM_ERRORS",errors:J})}),[e,Y,d,Z,h]),_e=(0,r.useCallback)(te=>{const J=Object.keys(B).some(ot=>ot.split(".")[0]===te);return!Re()(B)&&J},[B]),Yr=(0,r.useCallback)((te,J)=>{w.current("changeComponentsOrder"),R({type:"MOVE_COMPONENT_DOWN",dynamicZoneName:te,currentIndex:J,shouldCheckErrors:_e(te)})},[_e]),Jr=(0,r.useCallback)((te,J)=>{w.current("changeComponentsOrder"),R({type:"MOVE_COMPONENT_UP",dynamicZoneName:te,currentIndex:J,shouldCheckErrors:_e(te)})},[_e]),Ce=(0,r.useCallback)((te,J,le)=>{R({type:"MOVE_COMPONENT_FIELD",pathToComponent:te,dragIndex:J,hoverIndex:le})},[]),$e=(0,r.useCallback)((te,J,le)=>{R({type:"MOVE_FIELD",dragIndex:te,overIndex:J,keys:le.split(".")})},[]),Qe=(0,r.useCallback)(te=>{R({type:"REMOVE_RELATION",keys:te})},[]),Xr=(0,r.useCallback)((te,J)=>{w.current("removeComponentFromDynamicZone"),R({type:"REMOVE_COMPONENT_FROM_DYNAMIC_ZONE",dynamicZoneName:te,index:J,shouldCheckErrors:_e(te)})},[_e]),Ke=(0,r.useCallback)((te,J)=>{R({type:"REMOVE_COMPONENT_FROM_FIELD",keys:te.split("."),componentUid:J})},[]),gn=(0,r.useCallback)((te,J)=>{R({type:"REMOVE_REPEATABLE_FIELD",keys:te.split("."),componentUid:J})},[]),eo=(0,r.useCallback)(()=>{R({type:"TRIGGER_FORM_VALIDATION"})},[]);return O?r.createElement(ee.Redirect,{to:u}):Z?r.createElement(y.ContentManagerEditViewDataManagerContext.Provider,{value:{addComponentToDynamicZone:_,addNonRepeatableComponentToField:re,addRelation:ue,addRepeatableComponentToField:me,allLayoutData:e,checkFormErrors:rt,createActionAllowedFields:i,formErrors:B,hasDraftAndPublish:T,initialData:U,isCreatingEntry:d,isSingleType:f,shouldNotRunValidations:z,status:S,layout:Y,modifiedData:Z,moveComponentDown:Yr,moveComponentField:Ce,moveComponentUp:Jr,moveRelation:$e,onChange:H,onPublish:ht,onUnpublish:E,onRemoveRelation:Qe,readActionAllowedFields:x,redirectToPreviousPage:P,removeComponentFromDynamicZone:Xr,removeComponentFromField:Ke,removeRepeatableField:gn,slug:C,triggerFormValidation:eo,updateActionAllowedFields:I}},r.createElement(r.Fragment,null,m||!d&&!U.id?r.createElement(oe.Main,{"aria-busy":"true"},r.createElement(y.LoadingIndicatorPage,null)):r.createElement(r.Fragment,null,r.createElement(ee.Prompt,{when:!Xt()(Z,U),message:N({id:"global.prompt.unsaved"})}),r.createElement("form",{noValidate:!0,onSubmit:Ue},s)))):null};Cr.defaultProps={from:"/",initialValues:null,redirectToPreviousPage(){}},Cr.propTypes={allLayoutData:o().object.isRequired,allowedActions:o().object.isRequired,children:o().node.isRequired,componentsDataStructure:o().object.isRequired,contentTypeDataStructure:o().object.isRequired,createActionAllowedFields:o().array.isRequired,from:o().string,initialValues:o().object,isCreatingEntry:o().bool.isRequired,isLoadingForData:o().bool.isRequired,isSingleType:o().bool.isRequired,onPost:o().func.isRequired,onPublish:o().func.isRequired,onPut:o().func.isRequired,onUnpublish:o().func.isRequired,readActionAllowedFields:o().array.isRequired,redirectToPreviousPage:o().func,slug:o().string.isRequired,status:o().string.isRequired,updateActionAllowedFields:o().array.isRequired};const Ky=Cr,pt=e=>ve(`single-types/${e}`),Yy=e=>Object.values(e||{}).reduce((t,n)=>Object.assign(t,n),{});var Jy=Object.defineProperty,tn=Object.getOwnPropertySymbols,Ua=Object.prototype.hasOwnProperty,Ha=Object.prototype.propertyIsEnumerable,Ga=(e,t,n)=>t in e?Jy(e,t,{enumerable:!0,configurable:!0,writable:!0,value:n}):e[t]=n,Za=(e,t)=>{for(var n in t||(t={}))Ua.call(t,n)&&Ga(e,n,t[n]);if(tn)for(var n of tn(t))Ha.call(t,n)&&Ga(e,n,t[n]);return e},Xy=(e,t)=>{var n={};for(var s in e)Ua.call(e,s)&&t.indexOf(s)<0&&(n[s]=e[s]);if(e!=null&&tn)for(var s of tn(e))t.indexOf(s)<0&&Ha.call(e,s)&&(n[s]=e[s]);return n};const _a=(e={})=>{const t=Za(Za({},e),Yy(e.plugins)),{plugins:n}=t,s=Xy(t,["plugins"]);return`?${(0,Ne.stringify)(s,{encode:!1})}`};var eh=Object.defineProperty,Qa=Object.getOwnPropertySymbols,th=Object.prototype.hasOwnProperty,nh=Object.prototype.propertyIsEnumerable,Ka=(e,t,n)=>t in e?eh(e,t,{enumerable:!0,configurable:!0,writable:!0,value:n}):e[t]=n,rh=(e,t)=>{for(var n in t||(t={}))th.call(t,n)&&Ka(e,n,t[n]);if(Qa)for(var n of Qa(t))nh.call(t,n)&&Ka(e,n,t[n]);return e},mt=(e,t,n)=>new Promise((s,a)=>{var l=c=>{try{u(n.next(c))}catch(d){a(d)}},i=c=>{try{u(n.throw(c))}catch(d){a(d)}},u=c=>c.done?s(c.value):Promise.resolve(c.value).then(l,i);u((n=n.apply(e,t)).next())});const Ya=({allLayoutData:e,children:t,slug:n})=>{const{trackUsage:s}=(0,y.useTracking)(),{push:a}=(0,ee.useHistory)(),{setCurrentStep:l}=(0,y.useGuidedTour)(),i=(0,r.useRef)(s),[u,c]=(0,r.useState)(!0),[{query:d,rawQuery:m}]=(0,y.useQueryParams)(),f=_a(d),g=(0,y.useNotification)(),h=(0,fe.useDispatch)(),{componentsDataStructure:b,contentTypeDataStructure:E,data:x,isLoading:P,status:C}=(0,fe.useSelector)(xa),S=(0,r.useCallback)(G=>{const F=So(G,e.contentType,e.components);return(0,y.formatContentTypeData)(F,e.contentType,e.components)},[e]);(0,r.useEffect)(()=>()=>{h(Ia())},[h]),(0,r.useEffect)(()=>{const G=Object.keys(e.components).reduce(($,Y)=>{const T=$t(M()(e,["components",Y,"attributes"],{}),e.components);return $[Y]=(0,y.formatContentTypeData)(T,e.components[Y],e.components),$},{}),F=$t(e.contentType.attributes,e.components),Q=(0,y.formatContentTypeData)(F,e.contentType,e.components);h(Da(G,Q))},[e,h]),(0,r.useEffect)(()=>{const F=Se().CancelToken.source();return($=>mt(void 0,null,function*(){h(Jt()),c(!0);try{const{data:Y}=yield(0,ge.be)(pt(`${n}${f}`),{cancelToken:$.token});h(gr(S(Y))),c(!1)}catch(Y){if(Se().isCancel(Y))return;const T=M()(Y,"response.status",null);T===404&&h(yr(m,!0)),T===403&&(g({type:"info",message:{id:v("permissions.not-allowed.update")}}),a("/"))}}))(F),()=>F.cancel("Operation canceled by the user.")},[S,a,n,h,f,m,g]);const I=(0,r.useCallback)(G=>{const F=G.response.data;let Q=M()(F,["error","message"],"Bad Request");Array.isArray(Q)&&(Q=M()(Q,["0","messages","0","id"])),typeof Q=="string"&&g({type:"warning",message:Q})},[g]),W=(0,r.useCallback)(G=>mt(void 0,null,function*(){try{i.current("willDeleteEntry",G);const{data:F}=yield ge.be.delete(pt(`${n}${f}`));return g({type:"success",message:{id:v("success.record.delete")}}),i.current("didDeleteEntry",G),Promise.resolve(F)}catch(F){return i.current("didNotDeleteEntry",rh({error:F},G)),I(F),Promise.reject(F)}}),[n,I,g,f]),R=(0,r.useCallback)(()=>{c(!0),h(yr(m,!0))},[h,m]),B=(0,r.useCallback)((G,F)=>mt(void 0,null,function*(){const Q=pt(`${n}${m}`);try{h(he("submit-pending"));const{data:$}=yield ge.be.put(Q,G);return i.current("didCreateEntry",F),g({type:"success",message:{id:v("success.record.save")}}),l("contentManager.success"),h(Ge(S($))),c(!1),h(he("resolved")),Promise.resolve($)}catch($){return i.current("didNotCreateEntry",{error:$,trackerProperty:F}),I($),h(he("resolved")),Promise.reject($)}}),[S,I,n,h,m,g,l]),U=(0,r.useCallback)(()=>mt(void 0,null,function*(){try{i.current("willPublishEntry");const G=pt(`${n}/actions/publish${f}`);h(he("publish-pending"));const{data:F}=yield ge.be.post(G);return i.current("didPublishEntry"),g({type:"success",message:{id:v("success.record.publish")}}),h(Ge(S(F))),h(he("resolved")),Promise.resolve(F)}catch(G){return I(G),h(he("resolved")),Promise.reject(G)}}),[S,I,n,f,h,g]),Z=(0,r.useCallback)((G,F)=>mt(void 0,null,function*(){const Q=pt(`${n}${m}`);try{i.current("willEditEntry",F),h(he("submit-pending"));const{data:$}=yield ge.be.put(Q,G);return g({type:"success",message:{id:v("success.record.save")}}),i.current("didEditEntry",{trackerProperty:F}),h(Ge(S($))),h(he("resolved")),Promise.resolve($)}catch($){return I($),i.current("didNotEditEntry",{error:$,trackerProperty:F}),h(he("resolved")),Promise.reject($)}}),[S,I,n,h,m,g]),q=(0,r.useCallback)(()=>mt(void 0,null,function*(){const G=pt(`${n}/actions/unpublish${f}`);h(he("unpublish-pending"));try{i.current("willUnpublishEntry");const{data:F}=yield ge.be.post(G);i.current("didUnpublishEntry"),g({type:"success",message:{id:v("success.record.unpublish")}}),h(Ge(S(F))),h(he("resolved"))}catch(F){h(he("resolved")),I(F)}}),[S,g,I,n,h,f]);return t({componentsDataStructure:b,contentTypeDataStructure:E,data:x,isCreatingEntry:u,isLoadingForData:P,onDelete:W,onDeleteSucceeded:R,onPost:B,onPublish:U,onPut:Z,onUnpublish:q,redirectionLink:"/",status:C})};Ya.propTypes={allLayoutData:o().shape({components:o().object.isRequired,contentType:o().object.isRequired}).isRequired,children:o().func.isRequired,slug:o().string.isRequired};const oh=(0,r.memo)(Ya);var sh=p(57235),ah=p.n(sh),ih=Object.defineProperty,Ja=Object.getOwnPropertySymbols,lh=Object.prototype.hasOwnProperty,ch=Object.prototype.propertyIsEnumerable,Xa=(e,t,n)=>t in e?ih(e,t,{enumerable:!0,configurable:!0,writable:!0,value:n}):e[t]=n,ei=(e,t)=>{for(var n in t||(t={}))lh.call(t,n)&&Xa(e,n,t[n]);if(Ja)for(var n of Ja(t))ch.call(t,n)&&Xa(e,n,t[n]);return e};function uh(e,t){return n=>{const s=t();return r.createElement(e,ei(ei({},n),s))}}const dh=uh;function ph(){const{initialData:e,hasDraftAndPublish:t}=(0,y.useCMEditViewDataManager)(),n=e.publishedAt!==void 0&&e.publishedAt!==null;return{hasDraftAndPublish:t,isPublished:n}}const mh=ph;var fh=Object.defineProperty,ti=Object.getOwnPropertySymbols,gh=Object.prototype.hasOwnProperty,yh=Object.prototype.propertyIsEnumerable,ni=(e,t,n)=>t in e?fh(e,t,{enumerable:!0,configurable:!0,writable:!0,value:n}):e[t]=n,hh=(e,t)=>{for(var n in t||(t={}))gh.call(t,n)&&ni(e,n,t[n]);if(ti)for(var n of ti(t))yh.call(t,n)&&ni(e,n,t[n]);return e};const bh=(0,k.default)(ah())`
|
|
983
|
-
width: ${(0,y.pxToRem)(6)};
|
|
984
|
-
height: ${(0,y.pxToRem)(6)};
|
|
985
|
-
* {
|
|
986
|
-
fill: ${({theme:e,$bulletColor:t})=>e.colors[t]};
|
|
987
|
-
}
|
|
988
|
-
`,ri=({hasDraftAndPublish:e,isPublished:t})=>{const{formatMessage:n}=(0,A.useIntl)();if(!e)return null;const s={draft:{textColor:"secondary700",bulletColor:"secondary600",box:{background:"secondary100",borderColor:"secondary200"}},published:{textColor:"success700",bulletColor:"success600",box:{background:"success100",borderColor:"success200"}}},a=t?s.published:s.draft;return r.createElement(D.Box,hh({hasRadius:!0,as:"aside",paddingTop:4,paddingBottom:4,paddingLeft:5,paddingRight:5},a.box),r.createElement(D.Box,{as:j.Flex},r.createElement(bh,{$bulletColor:a.bulletColor}),r.createElement(D.Box,{paddingLeft:3},r.createElement(L.Typography,{textColor:a.textColor},n({id:v("containers.Edit.information.editing"),defaultMessage:"Editing"}),"\xA0"),r.createElement(L.Typography,{fontWeight:"bold",textColor:a.textColor},t&&n({id:v("containers.Edit.information.publishedVersion"),defaultMessage:"published version"}),!t&&n({id:v("containers.Edit.information.draftVersion"),defaultMessage:"draft version"})))))};ri.propTypes={hasDraftAndPublish:o().bool.isRequired,isPublished:o().bool.isRequired};const Eh=dh(ri,mh),Pr=60*1e3,Or=Pr*60,nn=Or*24,oi=nn*30,si=nn*365,vh=e=>e<Pr?{unit:"second",value:-Math.round(e/1e3)}:e<Or?{unit:"minute",value:-Math.round(e/Pr)}:e<nn?{unit:"hour",value:-Math.round(e/Or)}:e<oi?{unit:"day",value:-Math.round(e/nn)}:e<si?{unit:"month",value:-Math.round(e/oi)}:{unit:"year",value:-Math.round(e/si)};var ai=p(7602);const Ch=()=>{const{formatMessage:e,formatRelativeTime:t}=(0,A.useIntl)(),{initialData:n,isCreatingEntry:s}=(0,y.useCMEditViewDataManager)(),a=(0,r.useRef)(Date.now()),l=(c,d)=>{var m,f,g;const h=((m=n[d])==null?void 0:m.firstname)||"",b=((f=n[d])==null?void 0:f.lastname)||"",x=((g=n[d])==null?void 0:g.username)||(0,ai.Pp)(h,b),C=(n[c]?new Date(n[c]).getTime():Date.now())-a.current,{unit:S,value:I}=vh(-C);return{at:t(I,S,{numeric:"auto"}),by:s?"-":x}},i=l("updatedAt","updatedBy"),u=l("createdAt","createdBy");return r.createElement(D.Box,null,r.createElement(L.Typography,{variant:"sigma",textColor:"neutral600",id:"additional-informations"},e({id:v("containers.Edit.information"),defaultMessage:"Information"})),r.createElement(D.Box,{paddingTop:2,paddingBottom:6},r.createElement(Ut.Divider,null)),r.createElement(se.Stack,{spacing:4},r.createElement(j.Flex,{justifyContent:"space-between"},r.createElement(L.Typography,{fontWeight:"bold"},e({id:v("containers.Edit.information.created"),defaultMessage:"Created"})),r.createElement(L.Typography,null,u.at)),r.createElement(j.Flex,{justifyContent:"space-between"},r.createElement(L.Typography,{fontWeight:"bold"},e({id:v("containers.Edit.information.by"),defaultMessage:"By"})),r.createElement(L.Typography,null,u.by)),r.createElement(j.Flex,{justifyContent:"space-between"},r.createElement(L.Typography,{fontWeight:"bold"},e({id:v("containers.Edit.information.lastUpdate"),defaultMessage:"Last update"})),r.createElement(L.Typography,null,i.at)),r.createElement(j.Flex,{justifyContent:"space-between"},r.createElement(L.Typography,{fontWeight:"bold"},e({id:v("containers.Edit.information.by"),defaultMessage:"By"})),r.createElement(L.Typography,null,i.by))))};var Ph=p(98599),rn=p.n(Ph),ke=p(49137),Oh=p(88677),ft=p.n(Oh),Rh=Object.defineProperty,ii=Object.getOwnPropertySymbols,Mh=Object.prototype.hasOwnProperty,Th=Object.prototype.propertyIsEnumerable,li=(e,t,n)=>t in e?Rh(e,t,{enumerable:!0,configurable:!0,writable:!0,value:n}):e[t]=n,ci=(e,t)=>{for(var n in t||(t={}))Mh.call(t,n)&&li(e,n,t[n]);if(ii)for(var n of ii(t))Th.call(t,n)&&li(e,n,t[n]);return e};function wh(e,t){return n=>{const s=t();return r.createElement(e,ci(ci({},n),s))}}const Ih=wh,Dh=(e,t,n)=>{const s=(l,i)=>Object.keys(l).reduce((u,c)=>{const d=(0,V.get)(i,["attributes",c,"type"],"string"),m=(0,V.get)(i,["attributes",c,"relationType"],""),f=m.toLowerCase().includes("morph"),g=["oneWay","oneToOne","manyToOne"],h=l[c];if((0,V.isNil)(h))return u;if(d==="dynamiczone"&&h.forEach(b=>{const E=(0,V.get)(n,b.__component,{});u+=s(b,E)}),d==="component"){const b=(0,V.get)(i,["attributes",c,"repeatable"],!1),E=(0,V.get)(i,["attributes",c,"component"],""),x=(0,V.get)(n,E,{});b?h.forEach(P=>{u+=s(P,x)}):u+=s(h,x)}return d==="relation"&&!f&&(g.includes(m)?(0,V.has)(h,"publishedAt")&&(0,V.isEmpty)(h.publishedAt)&&(u+=1):h.forEach(b=>{(0,V.has)(b,"publishedAt")&&(0,V.isEmpty)(b.publishedAt)&&(u+=1)})),u},0);return s(e,t,n)};function xh(){const{allLayoutData:e,initialData:t,isCreatingEntry:n,isSingleType:s,status:a,layout:l,hasDraftAndPublish:i,modifiedData:u,onPublish:c,onUnpublish:d}=(0,y.useCMEditViewDataManager)();return{componentLayouts:e.components,initialData:t,isCreatingEntry:n,isSingleType:s,status:a,layout:l,hasDraftAndPublish:i,modifiedData:u,onPublish:c,onUnpublish:d}}const Sh=xh,ui=({allowedActions:{canUpdate:e,canCreate:t,canPublish:n},componentLayouts:s,initialData:a,isCreatingEntry:l,isSingleType:i,hasDraftAndPublish:u,layout:c,modifiedData:d,onPublish:m,onUnpublish:f,status:g})=>{const{goBack:h}=(0,ee.useHistory)(),[b,E]=(0,r.useState)(!1),[x,P]=(0,r.useState)(!1),{formatMessage:C}=(0,A.useIntl)(),S=(0,r.useRef)(0),I=M()(c,["settings","mainField"],"id"),W=M()(c,["info","displayName"],"NOT FOUND"),R=!Xt()(a,d)||l&&!Re()(d);let U=C({id:v("containers.Edit.pluginHeader.title.new"),defaultMessage:"Create an entry"});!l&&!i&&(U=a[I]||W),i&&(U=W);const Z=()=>{const T=Dh(d,c,s);return S.current=T,T};let q=null;if(l&&t&&(q=r.createElement(se.Stack,{horizontal:!0,spacing:2},u&&r.createElement(ye.Button,{disabled:!0,startIcon:r.createElement(ft(),null),variant:"secondary"},C({id:"app.utils.publish",defaultMessage:"Publish"})),r.createElement(ye.Button,{disabled:!R,isLoading:g==="submit-pending",type:"submit"},C({id:v("containers.Edit.submit"),defaultMessage:"Save"})))),!l&&e){const T=u&&n,z=!Re()(a.publishedAt),K=z?g==="unpublish-pending":g==="publish-pending",N=z?{id:"app.utils.unpublish",defaultMessage:"Unpublish"}:{id:"app.utils.publish",defaultMessage:"Publish"},w=z?()=>E(!0):()=>{Z()===0?m():P(!0)};q=r.createElement(j.Flex,null,T&&r.createElement(ye.Button,{disabled:R,loading:K,onClick:w,startIcon:r.createElement(ft(),null),variant:"secondary"},C(N)),r.createElement(D.Box,{paddingLeft:T?2:0},r.createElement(ye.Button,{disabled:!R,loading:g==="submit-pending",type:"submit"},C({id:v("containers.Edit.submit"),defaultMessage:"Save"}))))}const G=()=>E(T=>!T),F=()=>P(T=>!T),Q=()=>{F(),S.current=0,m()},$=()=>{G(),f()},Y=`${C({id:v("api.id"),defaultMessage:"API ID "})} : ${c.apiID}`;return r.createElement(r.Fragment,null,r.createElement(X.HeaderLayout,{title:U.toString(),primaryAction:q,subtitle:Y,navigationAction:r.createElement(y.Link,{startIcon:r.createElement(rn(),null),onClick:T=>{T.preventDefault(),h()},to:"/"},C({id:"global.back",defaultMessage:"Back"}))}),b&&r.createElement(ke.Dialog,{onClose:G,title:"Confirmation",labelledBy:"confirmation",describedBy:"confirm-description",isOpen:b},r.createElement(ke.DialogBody,{icon:r.createElement(Tt(),null)},r.createElement(se.Stack,{spacing:2},r.createElement(j.Flex,{justifyContent:"center",style:{textAlign:"center"}},r.createElement(L.Typography,{id:"confirm-description"},C({id:v("popUpWarning.warning.unpublish"),defaultMessage:"Unpublish this content will automatically change it to a draft."},{br:()=>r.createElement("br",null)}))),r.createElement(j.Flex,{justifyContent:"center",style:{textAlign:"center"}},r.createElement(L.Typography,{id:"confirm-description"},C({id:v("popUpWarning.warning.unpublish-question"),defaultMessage:"Are you sure you want to unpublish it?"}))))),r.createElement(ke.DialogFooter,{startAction:r.createElement(ye.Button,{onClick:G,variant:"tertiary"},C({id:"components.popUpWarning.button.cancel",defaultMessage:"No, cancel"})),endAction:r.createElement(ye.Button,{variant:"danger-light",onClick:$},C({id:"components.popUpWarning.button.confirm",defaultMessage:"Yes, confirm"}))})),x&&r.createElement(ke.Dialog,{onClose:F,title:"Confirmation",labelledBy:"confirmation",describedBy:"confirm-description",isOpen:x},r.createElement(ke.DialogBody,{icon:r.createElement(Tt(),null)},r.createElement(se.Stack,{spacing:2},r.createElement(j.Flex,{justifyContent:"center",style:{textAlign:"center"}},r.createElement(L.Typography,{id:"confirm-description"},S.current,C({id:v("popUpwarning.warning.has-draft-relations.message"),defaultMessage:"<b>{count, plural, =0 { of your content relations is} one { of your content relations is} other { of your content relations are}}</b> not published yet.<br></br>It might engender broken links and errors on your project."},{br:()=>r.createElement("br",null),b:T=>r.createElement(L.Typography,{fontWeight:"bold"},T),count:S.current}))),r.createElement(j.Flex,{justifyContent:"center",style:{textAlign:"center"}},r.createElement(L.Typography,{id:"confirm-description"},C({id:v("popUpWarning.warning.publish-question"),defaultMessage:"Do you still want to publish it?"}))))),r.createElement(ke.DialogFooter,{startAction:r.createElement(ye.Button,{onClick:F,variant:"tertiary"},C({id:"components.popUpWarning.button.cancel",defaultMessage:"No, cancel"})),endAction:r.createElement(ye.Button,{variant:"success",onClick:Q},C({id:v("popUpwarning.warning.has-draft-relations.button-confirm"),defaultMessage:"Yes, publish"}))})))};ui.propTypes={allowedActions:o().shape({canUpdate:o().bool.isRequired,canCreate:o().bool.isRequired,canPublish:o().bool.isRequired}).isRequired,componentLayouts:o().object.isRequired,initialData:o().object.isRequired,isCreatingEntry:o().bool.isRequired,isSingleType:o().bool.isRequired,status:o().string.isRequired,layout:o().object.isRequired,hasDraftAndPublish:o().bool.isRequired,modifiedData:o().object.isRequired,onPublish:o().func.isRequired,onUnpublish:o().func.isRequired};const Lh=(0,r.memo)(ui,We()),Fh=Ih(Lh,Sh),kh=(e,t)=>{const n=l=>(0,V.get)(t,[l,"type"],"");let s=0;const a=[];for(let l of e){const i=l.some(({name:u})=>n(u)==="dynamiczone");a[s]||(a[s]=[]),i?(s=s===0&&(0,V.isEmpty)(a[0])?0:s+1,a[s]||(a[s]=[]),a[s].push(l),s+=1):a[s].push(l)}return a.filter(l=>l.length>0)},Ah=(e,t)=>{const n=s=>{const a=(0,y.findMatchingPermissions)(e,[{action:`plugin::content-manager.explorer.${s}`,subject:t}]);return(0,V.uniq)((0,V.flatMap)(a,"properties.fields"))};return{createActionAllowedFields:n("create"),readActionAllowedFields:n("read"),updateActionAllowedFields:n("update")}};var jh=Object.defineProperty,di=Object.getOwnPropertySymbols,$h=Object.prototype.hasOwnProperty,Bh=Object.prototype.propertyIsEnumerable,pi=(e,t,n)=>t in e?jh(e,t,{enumerable:!0,configurable:!0,writable:!0,value:n}):e[t]=n,mi=(e,t)=>{for(var n in t||(t={}))$h.call(t,n)&&pi(e,n,t[n]);if(di)for(var n of di(t))Bh.call(t,n)&&pi(e,n,t[n]);return e};function Nh(e,t){return n=>{const s=t();return r.createElement(e,mi(mi({},n),s))}}const Vh=Nh;function qh(){const{hasDraftAndPublish:e,modifiedData:t}=(0,y.useCMEditViewDataManager)();let n={};return e&&(n=(0,V.isEmpty)(t.publishedAt)?{status:"draft"}:{status:"published"}),{hasDraftAndPublish:e,trackerProperty:n}}const Wh=qh;var zh=(e,t,n)=>new Promise((s,a)=>{var l=c=>{try{u(n.next(c))}catch(d){a(d)}},i=c=>{try{u(n.throw(c))}catch(d){a(d)}},u=c=>c.done?s(c.value):Promise.resolve(c.value).then(l,i);u((n=n.apply(e,t)).next())});const fi=({isCreatingEntry:e,onDelete:t,onDeleteSucceeded:n,trackerProperty:s})=>{const[a,l]=(0,r.useState)(!1),[i,u]=(0,r.useState)(!1),{formatMessage:c}=(0,A.useIntl)(),d=(0,y.useNotification)(),m=()=>l(g=>!g),f=()=>zh(void 0,null,function*(){try{u(!0),yield t(s),u(!1),m(),n()}catch(g){const h=M()(g,"response.payload.message",c({id:v("error.record.delete")}));u(!1),m(),d({type:"warning",message:h})}});return e?null:r.createElement(r.Fragment,null,r.createElement(ye.Button,{onClick:m,size:"S",startIcon:r.createElement(Be(),null),variant:"danger-light"},c({id:v("containers.Edit.delete-entry"),defaultMessage:"Delete this entry"})),r.createElement(y.ConfirmDialog,{isConfirmButtonLoading:i,isOpen:a,onConfirm:f,onToggleDialog:m}))};fi.propTypes={isCreatingEntry:o().bool.isRequired,onDelete:o().func.isRequired,onDeleteSucceeded:o().func.isRequired,trackerProperty:o().object.isRequired};const Uh=(0,r.memo)(fi,We()),Hh=Vh(Uh,Wh);var Gh=Object.defineProperty,Zh=Object.defineProperties,_h=Object.getOwnPropertyDescriptors,gi=Object.getOwnPropertySymbols,Qh=Object.prototype.hasOwnProperty,Kh=Object.prototype.propertyIsEnumerable,yi=(e,t,n)=>t in e?Gh(e,t,{enumerable:!0,configurable:!0,writable:!0,value:n}):e[t]=n,hi=(e,t)=>{for(var n in t||(t={}))Qh.call(t,n)&&yi(e,n,t[n]);if(gi)for(var n of gi(t))Kh.call(t,n)&&yi(e,n,t[n]);return e},Yh=(e,t)=>Zh(e,_h(t));const bi=De.Z.contentManager,Jh=[{action:"plugin::content-type-builder.read",subject:null}],Rr=({allowedActions:e,isSingleType:t,goBack:n,layout:s,slug:a,id:l,origin:i,userPermissions:u})=>{const{trackUsage:c}=(0,y.useTracking)(),{formatMessage:d}=(0,A.useIntl)(),{createActionAllowedFields:m,readActionAllowedFields:f,updateActionAllowedFields:g}=(0,r.useMemo)(()=>Ah(u,a),[u,a]),h=(0,r.useMemo)(()=>t?bi.singleTypesConfigurations:bi.collectionTypesConfigurations,[t]),b=`/content-manager/${t?"singleType":"collectionType"}/${a}/configurations/edit`,E=M()(s,["contentType"],{}),x=(0,r.useMemo)(()=>t?oh:Cy,[t]),P=(0,r.useCallback)(W=>W.every(R=>R.every(B=>B.fieldSchema.type==="dynamiczone")),[]),C=(0,r.useMemo)(()=>E.layouts?kh(E.layouts.edit,E.attributes):[],[E]),S=E.layouts.editRelations,I=S.length;return r.createElement(x,{allLayoutData:s,slug:a,id:l,origin:i},({componentsDataStructure:W,contentTypeDataStructure:R,data:B,isCreatingEntry:U,isLoadingForData:Z,onDelete:q,onDeleteSucceeded:G,onPost:F,onPublish:Q,onPut:$,onUnpublish:Y,redirectionLink:T,status:z})=>r.createElement(Ky,{allowedActions:e,allLayoutData:s,createActionAllowedFields:m,componentsDataStructure:W,contentTypeDataStructure:R,from:T,initialValues:B,isCreatingEntry:U,isLoadingForData:Z,isSingleType:t,onPost:F,onPublish:Q,onPut:$,onUnpublish:Y,readActionAllowedFields:f,redirectToPreviousPage:n,slug:a,status:z,updateActionAllowedFields:g},r.createElement(oe.Main,{"aria-busy":z!=="resolved"},r.createElement(Fh,{allowedActions:e}),r.createElement(X.ContentLayout,null,r.createElement(ie.Grid,{gap:4},r.createElement(ie.GridItem,{col:9,s:12},r.createElement(se.Stack,{spacing:6},C.map((K,N)=>{if(P(K)){const{0:{0:{name:w,fieldSchema:O,metadatas:_,labelAction:re}}}=K;return r.createElement(D.Box,{key:N},r.createElement(ie.Grid,{gap:4},r.createElement(ie.GridItem,{col:12,s:12,xs:12},r.createElement(gy,{name:w,fieldSchema:O,labelAction:re,metadatas:_}))))}return r.createElement(D.Box,{key:N,hasRadius:!0,background:"neutral0",shadow:"tableShadow",paddingLeft:6,paddingRight:6,paddingTop:6,paddingBottom:6,borderColor:"neutral150"},r.createElement(se.Stack,{spacing:6},K.map((w,O)=>r.createElement(ie.Grid,{gap:4,key:O},w.map(({fieldSchema:_,labelAction:re,metadatas:ue,name:me,size:Fe})=>{if(_.type==="component"){const{component:H,max:de,min:je,repeatable:Ue=!1,required:ht=!1}=_;return r.createElement(ie.GridItem,{col:Fe,s:12,xs:12,key:H},r.createElement(Yt,{componentUid:H,labelAction:re,isRepeatable:Ue,intlLabel:{id:ue.label,defaultMessage:ue.label},max:de,min:je,name:me,required:ht}))}return r.createElement(ie.GridItem,{col:Fe,key:me,s:12,xs:12},r.createElement(or,{fieldSchema:_,keys:me,labelAction:re,metadatas:ue}))})))))}))),r.createElement(ie.GridItem,{col:3,s:12},r.createElement(se.Stack,{spacing:2},r.createElement(Eh,null),r.createElement(D.Box,{as:"aside","aria-labelledby":"additional-informations",background:"neutral0",borderColor:"neutral150",hasRadius:!0,paddingBottom:4,paddingLeft:4,paddingRight:4,paddingTop:6,shadow:"tableShadow"},r.createElement(Ch,null),r.createElement(Gt,{area:"contentManager.editView.informations"})),I>0&&r.createElement(D.Box,{as:"aside","aria-labelledby":"relations-title",background:"neutral0",borderColor:"neutral150",hasRadius:!0,paddingBottom:4,paddingLeft:4,paddingRight:4,paddingTop:6,shadow:"tableShadow"},r.createElement(L.Typography,{variant:"sigma",textColor:"neutral600",id:"relations-title"},d({id:v("containers.Edit.relations"),defaultMessage:"{number, plural, =0 {relations} one {relation} other {relations}}"},{number:I})),r.createElement(D.Box,{paddingTop:2,paddingBottom:6},r.createElement(Ut.Divider,null)),r.createElement(se.Stack,{spacing:4},S.map(({name:K,fieldSchema:N,labelAction:w,metadatas:O,queryInfos:_})=>r.createElement(Js,Yh(hi(hi({},N),O),{key:K,description:O.description,intlLabel:{id:O.label,defaultMessage:O.label},labelAction:w,name:K,relationsType:N.relationType,queryInfos:_,placeholder:O.placeholder?{id:O.placeholder,defaultMessage:O.placeholder}:null}))))),r.createElement(D.Box,{as:"aside","aria-labelledby":"links"},r.createElement(se.Stack,{spacing:2},r.createElement(Gt,{area:"contentManager.editView.right-links",slug:a}),a!=="strapi::administrator"&&r.createElement(y.CheckPermissions,{permissions:Jh},r.createElement(y.LinkButton,{onClick:()=>{c("willEditEditLayout")},size:"S",startIcon:r.createElement(it(),null),style:{width:"100%"},to:`/plugins/content-type-builder/content-types/${a}`,variant:"secondary"},d({id:v("link-to-ctb"),defaultMessage:"Edit the model"}))),r.createElement(y.CheckPermissions,{permissions:h},r.createElement(y.LinkButton,{size:"S",startIcon:r.createElement(Zu(),null),style:{width:"100%"},to:b,variant:"secondary"},d({id:"app.links.configure-view",defaultMessage:"Configure the view"}))),e.canDelete&&r.createElement(Hh,{isCreatingEntry:U,onDelete:q,onDeleteSucceeded:G}))))))))))};Rr.defaultProps={id:null,isSingleType:!1,origin:null,userPermissions:[]},Rr.propTypes={allowedActions:o().shape({canRead:o().bool.isRequired,canUpdate:o().bool.isRequired,canCreate:o().bool.isRequired,canDelete:o().bool.isRequired}).isRequired,layout:o().shape({components:o().object.isRequired,contentType:o().shape({uid:o().string.isRequired,settings:o().object.isRequired,metadatas:o().object.isRequired,options:o().object.isRequired,attributes:o().object.isRequired}).isRequired}).isRequired,id:o().string,isSingleType:o().bool,goBack:o().func.isRequired,origin:o().string,slug:o().string.isRequired,userPermissions:o().array};const Xh=(0,r.memo)(Rr);var eb=Object.defineProperty,tb=Object.defineProperties,nb=Object.getOwnPropertyDescriptors,Ei=Object.getOwnPropertySymbols,rb=Object.prototype.hasOwnProperty,ob=Object.prototype.propertyIsEnumerable,vi=(e,t,n)=>t in e?eb(e,t,{enumerable:!0,configurable:!0,writable:!0,value:n}):e[t]=n,sb=(e,t)=>{for(var n in t||(t={}))rb.call(t,n)&&vi(e,n,t[n]);if(Ei)for(var n of Ei(t))ob.call(t,n)&&vi(e,n,t[n]);return e},ab=(e,t)=>tb(e,nb(t));const Mr=e=>{const t=(0,r.useMemo)(()=>Co(e.slug),[e.slug]),{isLoading:n,allowedActions:s}=(0,y.useRBAC)(t,e.userPermissions);return n?r.createElement(y.LoadingIndicatorPage,null):r.createElement(Xh,ab(sb({},e),{allowedActions:s}))};Mr.defaultProps={permissions:[]},Mr.propTypes={permissions:o().array,slug:o().string.isRequired,userPermissions:o().array.isRequired};const ib=(0,r.memo)(Mr,We());var lb=Object.defineProperty,cb=Object.defineProperties,ub=Object.getOwnPropertyDescriptors,on=Object.getOwnPropertySymbols,Ci=Object.prototype.hasOwnProperty,Pi=Object.prototype.propertyIsEnumerable,Oi=(e,t,n)=>t in e?lb(e,t,{enumerable:!0,configurable:!0,writable:!0,value:n}):e[t]=n,db=(e,t)=>{for(var n in t||(t={}))Ci.call(t,n)&&Oi(e,n,t[n]);if(on)for(var n of on(t))Pi.call(t,n)&&Oi(e,n,t[n]);return e},pb=(e,t)=>cb(e,ub(t)),mb=(e,t)=>{var n={};for(var s in e)Ci.call(e,s)&&t.indexOf(s)<0&&(n[s]=e[s]);if(e!=null&&on)for(var s of on(e))t.indexOf(s)<0&&Pi.call(e,s)&&(n[s]=e[s]);return n};const Ri=e=>{var t=e,{layout:n}=t,s=mb(t,["layout"]);const a=(0,fe.useSelector)(uo),l=(0,fe.useDispatch)(),[{query:i}]=(0,y.useQueryParams)(),{runHookWaterfall:u}=(0,y.useStrapiApp)(),c=Qo(i,s.slug,"editView");return(0,r.useEffect)(()=>{const d=u(zt.Eo,{layout:n,query:i});return l(Uu(d.layout,i)),()=>{l(zu())}},[n,l,i,u]),!a||!c?r.createElement(y.LoadingIndicatorPage,null):r.createElement(ib,pb(db({},s),{layout:a,userPermissions:c}))};Ri.propTypes={layout:o().shape({components:o().object.isRequired,contentType:o().shape({uid:o().string.isRequired,settings:o().object.isRequired,metadatas:o().object.isRequired,options:o().object.isRequired,attributes:o().object.isRequired}).isRequired}).isRequired};const sn=Ri;var Tr=p(84968),fb=p(23940),It=p.n(fb),gb=p(88423),Mi=p.n(gb),yb=p(3704),hb=p.n(yb),bb=Object.defineProperty,Eb=Object.defineProperties,vb=Object.getOwnPropertyDescriptors,Ti=Object.getOwnPropertySymbols,Cb=Object.prototype.hasOwnProperty,Pb=Object.prototype.propertyIsEnumerable,wi=(e,t,n)=>t in e?bb(e,t,{enumerable:!0,configurable:!0,writable:!0,value:n}):e[t]=n,Ob=(e,t)=>{for(var n in t||(t={}))Cb.call(t,n)&&wi(e,n,t[n]);if(Ti)for(var n of Ti(t))Pb.call(t,n)&&wi(e,n,t[n]);return e},Rb=(e,t)=>Eb(e,vb(t));const wr=e=>e.reduce((t,n)=>t+n.size,0),Mb=e=>e.reduce((t,n,s)=>{const a={rowId:s,rowContent:n};return t.concat(a)},[]),gt=e=>e.reduce((t,n)=>{let s=[];const a=n.rowContent.reduce((u,c)=>{const d=wr(u);return c.name==="_TEMP_"||(d+c.size<=12?u.push(c):s.push(c)),u},[]),l=t.length===0?0:Math.max.apply(Math,t.map(u=>u.rowId))+1,i=wr(a);if(i<12&&a.push({name:"_TEMP_",size:12-i}),t.push({rowId:l,rowContent:a}),s.length>0){const u=wr(s);u<12&&s.push({name:"_TEMP_",size:12-u}),t.push({rowId:l+1,rowContent:s}),s=[]}return t},[]).filter(t=>t.rowContent.length>0).filter(t=>t.rowContent.length===1?t.rowContent[0].name!=="_TEMP_":!0),Tb=e=>e.reduce((t,n)=>{const s=n.rowContent.filter(a=>a.name!=="_TEMP_");return t.concat([s])},[]),Ii=e=>{switch(e){case"boolean":case"date":case"integer":case"float":case"biginteger":case"decimal":case"time":return 4;case"json":case"component":case"richtext":case"dynamiczone":return 12;default:return 6}},wb=(e,t=[])=>t.reduce((n,{rowContent:s})=>{var a,l;const i=(l=(a=s.find(u=>u.name===e))==null?void 0:a.size)!=null?l:null;return i&&(n=i),n},null),Ib=(e,t,n=[])=>n.map(s=>(s.rowContent=s.rowContent.map(a=>a.name===e?Rb(Ob({},a),{size:t}):a),s)),Ir={fieldForm:{},componentLayouts:{},metaToEdit:"",initialData:{},metaForm:{},modifiedData:{}},Db=(e=Ir,t)=>(0,qt.default)(e,n=>{var s,a,l;const i=["modifiedData","layouts","edit"],u=["modifiedData","layouts","editRelations"];switch(t.type){case"ADD_RELATION":{const c=M()(e,u,[]);ne()(n,u,[...c,t.name]);break}case"MOVE_RELATION":{const c=M()(e,u,[]),{fromIndex:d,toIndex:m}=t;ne()(n,u,vt(c,d,m));break}case"MOVE_ROW":{const c=M()(e,i,[]),{fromIndex:d,toIndex:m}=t;ne()(n,i,vt(c,d,m));break}case"ON_ADD_FIELD":{const c=qe()(e),d=Ii(M()(c,["modifiedData","attributes",t.name,"type"],"")),m=M()(c,i,[]).length,f=[...i,m-1,"rowContent"],g=M()(c,f,[]);let h=M()(c,i,[]);Array.isArray(g)?ne()(h,[m>0?m-1:0,"rowContent"],[...g,{name:t.name,size:d}]):ne()(h,[m>0?m-1:0,"rowContent"],[{name:t.name,size:d}]);const b=gt(h);ne()(n,i,b);break}case"ON_CHANGE":{ne()(n,["modifiedData",...t.keys],t.value);break}case"ON_CHANGE_META":{ne()(n,["metaForm","metadata",...t.keys],t.value);break}case"ON_CHANGE_SIZE":{ne()(n,["metaForm","size"],t.value);break}case"ON_RESET":{n.modifiedData=e.initialData;break}case"REMOVE_FIELD":{const c=M()(e,[...i,t.rowIndex,"rowContent"],[]);let d=qe()(e);if(c.length===1||c.length===2&&M()(c,[1,"name"],"")==="_TEMP_"){const f=M()(e,i,[]);ne()(d,i,f.filter((g,h)=>t.rowIndex!==h))}else ne()(d,[...i,t.rowIndex,"rowContent"],c.filter((f,g)=>g!==t.fieldIndex));const m=gt(M()(d,i,[]));ne()(n,i,m);break}case"REMOVE_RELATION":{const c=M()(e,u,[]);ne()(n,u,c.filter((d,m)=>t.index!==m));break}case"REORDER_DIFF_ROW":{const c=M()(e,[...i,t.dragRowIndex,"rowContent"],[]),d=M()(e,[...i,t.hoverRowIndex,"rowContent"],[]),m=M()(e,[...i,t.dragRowIndex,"rowContent",t.dragIndex],{}),f=[...d,m];let g=qe()(e);ne()(g,[...i,t.dragRowIndex,"rowContent"],c.filter((b,E)=>t.dragIndex!==E)),ne()(g,[...i,t.hoverRowIndex,"rowContent"],vt(f,f.length-1,t.hoverIndex));const h=gt(M()(g,i,[]));ne()(n,i,h);break}case"REORDER_ROW":{const c=qe()(e),d=M()(c,[...i,t.dragRowIndex,"rowContent"],[]);ne()(c,[...i,t.dragRowIndex,"rowContent"],vt(d,t.dragIndex,t.hoverIndex));const m=gt(M()(c,i,[]));ne()(n,i,m);break}case"SET_FIELD_TO_EDIT":{n.metaToEdit=t.name,n.metaForm={metadata:M()(e,["modifiedData","metadatas",t.name,"edit"],{}),size:(l=wb(t.name,(a=(s=e.modifiedData)==null?void 0:s.layouts)==null?void 0:a.edit))!=null?l:Ii()};break}case"SUBMIT_META_FORM":{ne()(n,["modifiedData","metadatas",e.metaToEdit,"edit"],e.metaForm.metadata);const c=qe()(M()(e,i,[])),d=Ib(e.metaToEdit,e.metaForm.size,c);d.length>0&&ne()(n,i,gt(d));break}case"SUBMIT_SUCCEEDED":{n.initialData=e.modifiedData;break}case"UNSET_FIELD_TO_EDIT":{n.metaToEdit="",n.metaForm={};break}default:return n}});var xb=Object.defineProperty,Sb=Object.defineProperties,Lb=Object.getOwnPropertyDescriptors,Di=Object.getOwnPropertySymbols,Fb=Object.prototype.hasOwnProperty,kb=Object.prototype.propertyIsEnumerable,xi=(e,t,n)=>t in e?xb(e,t,{enumerable:!0,configurable:!0,writable:!0,value:n}):e[t]=n,Ab=(e,t)=>{for(var n in t||(t={}))Fb.call(t,n)&&xi(e,n,t[n]);if(Di)for(var n of Di(t))kb.call(t,n)&&xi(e,n,t[n]);return e},jb=(e,t)=>Sb(e,Lb(t));const $b=(e,t,n)=>{let s=(0,V.cloneDeep)(t);return(0,V.set)(s,["layouts","edit"],gt(Mb(t.layouts.edit))),jb(Ab({},e),{initialData:s,modifiedData:s,componentLayouts:n})};var Ae=p(12611),Bb=p(42258),Si=p.n(Bb);const Li=({componentUid:e})=>{const{componentLayouts:t}=He(),{formatMessage:n}=(0,A.useIntl)(),s=M()(t,[e],{}),a=M()(s,["layouts","edit"],[]);return r.createElement(D.Box,{padding:3},a.map((l,i)=>r.createElement(ie.Grid,{gap:4,key:i},l.map(u=>r.createElement(ie.GridItem,{key:u.name,col:u.size},r.createElement(D.Box,{paddingTop:2},r.createElement(j.Flex,{alignItems:"center",background:"neutral0",paddingLeft:3,paddingRight:3,height:`${32/16}rem`,hasRadius:!0,borderColor:"neutral200"},r.createElement(L.Typography,{textColor:"neutral800"},u.name))))))),r.createElement(D.Box,{paddingTop:2},r.createElement(y.Link,{startIcon:r.createElement(Si(),null),to:`/content-manager/components/${e}/configurations/edit`},n({id:v("components.FieldItem.linkToComponentLayout"),defaultMessage:"Set the component's layout"}))))};Li.propTypes={componentUid:o().string.isRequired};const Nb=Li,Fi=(0,k.default)(j.Flex)`
|
|
989
|
-
border-radius: 50%;
|
|
990
|
-
svg {
|
|
991
|
-
& > * {
|
|
992
|
-
fill: ${({theme:e})=>e.colors.neutral500};
|
|
993
|
-
}
|
|
994
|
-
width: 12px;
|
|
995
|
-
height: 12px;
|
|
996
|
-
}
|
|
997
|
-
`,Vb=(0,k.default)(j.Flex)`
|
|
998
|
-
text-decoration: none;
|
|
999
|
-
&:hover {
|
|
1000
|
-
${({theme:e})=>`
|
|
1001
|
-
background: ${e.colors.primary100};
|
|
1002
|
-
svg {
|
|
1003
|
-
& > * {
|
|
1004
|
-
fill: ${e.colors.primary600};
|
|
1005
|
-
}
|
|
1006
|
-
}
|
|
1007
|
-
${L.Typography} {
|
|
1008
|
-
color: ${e.colors.primary600};
|
|
1009
|
-
}
|
|
1010
|
-
${Fi} {
|
|
1011
|
-
background: ${e.colors.primary200};
|
|
1012
|
-
}
|
|
1013
|
-
border-color: ${e.colors.primary200};
|
|
1014
|
-
`}
|
|
1015
|
-
}
|
|
1016
|
-
`,ki=({components:e})=>{const{componentLayouts:t}=He();return r.createElement(se.Stack,{spacing:2,horizontal:!0,overflow:"scroll hidden",padding:3},e.map(n=>r.createElement(Vb,{hasRadius:!0,background:"neutral0",justifyContent:"center",alignItems:"center",height:`${84/16}rem`,minWidth:`${140/16}rem`,key:n,padding:2,direction:"column",borderColor:"neutral200",as:ee.Link,to:`/content-manager/components/${n}/configurations/edit`},r.createElement(Fi,{width:`${32/16}rem`,height:`${32/16}rem`,background:"neutral150",justifyContent:"center",alignItems:"center",padding:2},r.createElement(Dn.G,{icon:M()(t,[n,"info","icon"],"")})),r.createElement(D.Box,{paddingTop:1},r.createElement(L.Typography,{fontSize:1,textColor:"neutral600",fontWeight:"bold"},M()(t,[n,"info","displayName"],""))))))};ki.propTypes={components:o().arrayOf(o().string).isRequired};const qb=ki,Ai=(0,k.default)(Me.IconButton)`
|
|
1017
|
-
background-color: transparent;
|
|
1018
|
-
path {
|
|
1019
|
-
fill: ${({theme:e})=>e.colors.neutral600};
|
|
1020
|
-
}
|
|
1021
|
-
`,Dr=({attribute:e,onEditField:t,onDeleteField:n,children:s})=>{const{formatMessage:a}=(0,A.useIntl)();return r.createElement(D.Box,{overflow:"hidden",width:"100%"},r.createElement(j.Flex,{paddingLeft:3,alignItems:"center",justifyContent:"space-between"},r.createElement(L.Typography,{fontWeight:"semiBold",textColor:"neutral800",ellipsis:!0},s),r.createElement(j.Flex,null,r.createElement(Ai,{label:a({id:v("containers.ListSettingsView.modal-form.edit-label"),defaultMessage:"Edit {fieldName}"},{fieldName:s}),onClick:t,icon:r.createElement(it(),null),noBorder:!0}),r.createElement(Ai,{label:a({id:"global.delete-target",defaultMessage:"Delete {target}"},{target:s}),"data-testid":"delete-field",onClick:n,icon:r.createElement(Be(),null),noBorder:!0}))),(e==null?void 0:e.type)==="component"&&r.createElement(Nb,{componentUid:e.component}),(e==null?void 0:e.type)==="dynamiczone"&&r.createElement(qb,{components:e.components}))};Dr.defaultProps={attribute:void 0},Dr.propTypes={attribute:o().shape({components:o().array,component:o().string,type:o().string}),onEditField:o().func.isRequired,onDeleteField:o().func.isRequired,children:o().string.isRequired};const ji=Dr,Wb=(0,k.default)(j.Flex)`
|
|
1022
|
-
position: relative;
|
|
1023
|
-
${({isFirst:e,isLast:t,hasHorizontalPadding:n})=>e?`
|
|
1024
|
-
padding-right: 4px;
|
|
1025
|
-
`:t?`
|
|
1026
|
-
padding-left: 4px;
|
|
1027
|
-
`:n?`
|
|
1028
|
-
padding: 0 4px;
|
|
1029
|
-
`:""}
|
|
1030
|
-
${({showRightCarret:e,showLeftCarret:t,theme:n})=>e?`
|
|
1031
|
-
&:after {
|
|
1032
|
-
content: '';
|
|
1033
|
-
position: absolute;
|
|
1034
|
-
right: -1px;
|
|
1035
|
-
background-color: ${n.colors.primary600};
|
|
1036
|
-
width: 2px;
|
|
1037
|
-
height: 100%;
|
|
1038
|
-
align-self: stretch;
|
|
1039
|
-
z-index: 1;
|
|
1040
|
-
}
|
|
1041
|
-
`:t?`
|
|
1042
|
-
&:before {
|
|
1043
|
-
content: '';
|
|
1044
|
-
position: absolute;
|
|
1045
|
-
left: -1px;
|
|
1046
|
-
background-color: ${n.colors.primary600};
|
|
1047
|
-
width: 2px;
|
|
1048
|
-
height: 100%;
|
|
1049
|
-
align-self: stretch;
|
|
1050
|
-
z-index: 1;
|
|
1051
|
-
}
|
|
1052
|
-
`:""};
|
|
1053
|
-
`,zb=(0,k.default)(Xe())`
|
|
1054
|
-
height: ${12/16}rem;
|
|
1055
|
-
width: ${12/16}rem;
|
|
1056
|
-
path {
|
|
1057
|
-
fill: ${({theme:e})=>e.colors.neutral600};
|
|
1058
|
-
}
|
|
1059
|
-
`,Ub=(0,k.default)(j.Flex)`
|
|
1060
|
-
display: ${({dragStart:e})=>e?"none":"flex"};
|
|
1061
|
-
opacity: ${({isDragging:e,isFullSize:t,isHidden:n})=>e&&!t?.2:e&&t||n?0:1};
|
|
1062
|
-
`,Hb=(0,k.default)(j.Flex)`
|
|
1063
|
-
cursor: all-scroll;
|
|
1064
|
-
border-right: 1px solid ${({theme:e})=>e.colors.neutral200};
|
|
1065
|
-
`,xr=({attribute:e,children:t,index:n,lastIndex:s,moveItem:a,moveRow:l,name:i,onDeleteField:u,onEditField:c,rowIndex:d,size:m})=>{const[f,g]=(0,r.useState)(!1),h=i==="_TEMP_",{setIsDraggingSibling:b}=He(),E=m===12,x=(0,r.useRef)(null),P=(0,r.useRef)(null),[{clientOffset:C,isOver:S},I]=(0,Te.useDrop)({accept:Oe.EDIT_FIELD,hover(T,z){if(!P.current||T.size!==12)return;const K=z.getItem().index,N=n,w=z.getItem().rowIndex,O=d;if(K===N&&w===O)return;const _=P.current.getBoundingClientRect(),re=(_.bottom-_.top)/2,me=z.getClientOffset().y-_.top;w<O&&me<re||w>O&&me>re||(l(w,O),T.rowIndex=O,T.itemIndex=N)},drop(T,z){if(!P.current)return;const K=z.getItem().index,N=n,w=z.getItem().rowIndex,O=d;if(T.size===12||K===N&&w===O)return;const _=P.current.getBoundingClientRect();if(Math.abs(z.getClientOffset().x-_.left)>_.width/1.8){a(K,N+1,w,O),T.itemIndex=N+1,T.rowIndex=O;return}a(K,N,w,O),T.itemIndex=N,T.rowIndex=O},collect:T=>({canDrop:T.canDrop(),clientOffset:T.getClientOffset(),isOver:T.isOver(),isOverCurrent:T.isOver({shallow:!0}),itemType:T.getItemType()})}),[{isDragging:W,getItem:R},B,U]=(0,Te.useDrag)({type:Oe.EDIT_FIELD,item(){return b(!0),{index:n,labelField:t,rowIndex:d,name:i,size:m}},canDrag(){return i!=="_TEMP_"},collect:T=>({isDragging:T.isDragging(),getItem:T.getItem()}),end(){b(!1)}});(0,r.useEffect)(()=>{U((0,Kt.rX)(),{captureDraggingState:!0})},[U]);const Z={dragRef:B(x),dropRef:I(P)};let q=!1,G=!1;if(P.current&&C){const T=P.current.getBoundingClientRect();q=S&&R.size!==12&&Math.abs(C.x-T.left)<T.width/2,G=S&&R.size!==12&&Math.abs(C.x-T.left)>T.width/2,i==="_TEMP_"&&(q=S&&R.size!==12,G=!1)}const F=()=>e&&E?`${74/16}rem`:`${32/16}rem`,Q=n===0&&!E,$=n===s&&!E,Y=n!==0&&!E;return r.createElement(ie.GridItem,{col:m},r.createElement(Wb,{ref:Z.dropRef,showLeftCarret:q,showRightCarret:G,isFirst:Q,isLast:$,hasHorizontalPadding:Y,onDrag:()=>{E&&!f&&g(!0)},onDragEnd:()=>{E&&g(!1)}},f&&E&&r.createElement(D.Box,{width:"100%",height:"2px",background:"primary600"}),r.createElement(Ub,{width:E&&f?0:"100%",borderColor:"neutral150",hasRadius:!0,background:"neutral100",minHeight:F(),alignItems:"stretch",isDragging:W,dragStart:f,isFullSize:E,isHidden:h},r.createElement(Hb,{as:"span",type:"button",ref:Z.dragRef,onClick:T=>T.stopPropagation(),alignItems:"center",paddingLeft:3,paddingRight:3,tabIndex:-1},r.createElement(zb,null)),!h&&r.createElement(ji,{attribute:e,onEditField:c,onDeleteField:u},t))))};xr.defaultProps={attribute:void 0},xr.propTypes={attribute:o().shape({components:o().array,component:o().string,type:o().string}),children:o().string.isRequired,index:o().number.isRequired,moveItem:o().func.isRequired,moveRow:o().func.isRequired,name:o().string.isRequired,onDeleteField:o().func.isRequired,onEditField:o().func.isRequired,rowIndex:o().number.isRequired,lastIndex:o().number.isRequired,size:o().number.isRequired};const Gb=xr,$i=({rowItem:e,onRemoveField:t,rowId:n,rowIndex:s,index:a,lastIndex:l})=>{const{setEditFieldToSelect:i,attributes:u,modifiedData:c,moveRow:d,moveItem:m}=He(),f=M()(u,[e.name],{}),g=M()(c,["metadatas",e.name,"edit","label"],"");return r.createElement(Gb,{onEditField:()=>i(e.name),onDeleteField:()=>t(n,a),attribute:f,index:a,lastIndex:l,rowIndex:s,name:e.name,size:e.size,moveRow:d,moveItem:m},g||e.name)};$i.propTypes={index:o().number.isRequired,lastIndex:o().number.isRequired,onRemoveField:o().func.isRequired,rowId:o().number.isRequired,rowIndex:o().number.isRequired,rowItem:o().object.isRequired};const Zb=$i,Bi=({row:e,onRemoveField:t,rowIndex:n})=>r.createElement(ie.Grid,null,e.rowContent.map((s,a)=>r.createElement(Zb,{key:s.name,rowItem:s,index:a,rowId:e.rowId,onRemoveField:t,rowIndex:n,lastIndex:e.rowContent.length-1})));Bi.propTypes={onRemoveField:o().func.isRequired,row:o().object.isRequired,rowIndex:o().number.isRequired};const _b=Bi,Qb=[{action:"plugin::content-type-builder.read",subject:null}],Kb=()=>{const{trackUsage:e}=(0,y.useTracking)(),{formatMessage:t}=(0,A.useIntl)(),{slug:n,modifiedData:s,isContentTypeView:a}=He(),l=a?"content-types":"components",i=`/plugins/content-type-builder/${l==="content-types"?l:"component-categories"}`,u=M()(s,"category",""),c=l==="content-types"?n:`${u}/${n}`,d=()=>{e("willEditEditLayout")};return n==="strapi::administrator"?null:r.createElement(y.CheckPermissions,{permissions:Qb},r.createElement(y.LinkButton,{to:`${i}/${c}`,onClick:d,size:"S",startIcon:r.createElement(it(),null),variant:"secondary"},t({id:v(`edit-settings-view.link-to-ctb.${l}`),defaultMessage:"Edit the content type"})))},Ni=({editLayout:e,editLayoutRemainingFields:t,onRemoveField:n,onAddField:s})=>{const{formatMessage:a}=(0,A.useIntl)();return r.createElement(se.Stack,{spacing:4},r.createElement(j.Flex,{justifyContent:"space-between"},r.createElement("div",null,r.createElement(D.Box,null,r.createElement(L.Typography,{fontWeight:"bold"},a({id:v("containers.ListPage.displayedFields"),defaultMessage:"Displayed fields"}))),r.createElement(D.Box,null,r.createElement(L.Typography,{variant:"pi",textColor:"neutral600"},a({id:"containers.SettingPage.editSettings.description",defaultMessage:"Drag & drop the fields to build the layout"})))),r.createElement(Kb,null)),r.createElement(D.Box,{padding:4,hasRadius:!0,borderStyle:"dashed",borderWidth:"1px",borderColor:"neutral300"},r.createElement(se.Stack,{spacing:2},e.map((l,i)=>r.createElement(_b,{key:l.rowId,row:l,rowIndex:i,onRemoveField:n})),r.createElement(Ae.SimpleMenu,{id:"label",label:a({id:v("containers.SettingPage.add.field"),defaultMessage:"Insert another field"}),as:ye.Button,"data-testid":"add-field",fullWidth:!0,startIcon:r.createElement(ut(),null),endIcon:null,variant:"secondary",disabled:t.length===0},t.map(l=>r.createElement(Ae.MenuItem,{key:l,onClick:()=>s(l)},l))))))};Ni.propTypes={editLayout:o().array.isRequired,editLayoutRemainingFields:o().array.isRequired,onAddField:o().func.isRequired,onRemoveField:o().func.isRequired};const Yb=Ni,Jb=(0,k.default)(Xe())`
|
|
1066
|
-
height: ${12/16}rem;
|
|
1067
|
-
width: ${12/16}rem;
|
|
1068
|
-
path {
|
|
1069
|
-
fill: ${({theme:e})=>e.colors.neutral600};
|
|
1070
|
-
}
|
|
1071
|
-
`,Xb=(0,k.default)(j.Flex)`
|
|
1072
|
-
opacity: ${({isDragging:e})=>e?0:1};
|
|
1073
|
-
`,eE=(0,k.default)(j.Flex)`
|
|
1074
|
-
cursor: all-scroll;
|
|
1075
|
-
border-right: 1px solid ${({theme:e})=>e.colors.neutral200};
|
|
1076
|
-
`,Sr=({attribute:e,onEditField:t,onDeleteField:n,children:s,index:a,name:l,onMoveField:i})=>{const u=(0,r.useRef)(),[,c]=(0,Te.useDrop)({accept:Oe.EDIT_RELATION,hover(h){if(!u.current)return;const b=h.index,E=a;b!==E&&(i(b,E),h.index=E)}}),[{isDragging:d},m,f]=(0,Te.useDrag)({type:Oe.EDIT_RELATION,item(){return{index:a,labelField:s,name:l}},collect:h=>({isDragging:h.isDragging()})});(0,r.useEffect)(()=>{f((0,Kt.rX)(),{captureDraggingState:!0})},[f]),m(c(u));const g=()=>e&&["json","text","file","media","component","richtext","dynamiczone"].includes(e.type)?`${74/16}rem`:`${32/16}rem`;return r.createElement(Xb,{width:"100%",borderColor:"neutral150",hasRadius:!0,background:"neutral100",minHeight:g(),alignItems:"stretch",isDragging:d},r.createElement(eE,{as:"span",type:"button",ref:u,onClick:h=>h.stopPropagation(),alignItems:"center",paddingLeft:3,paddingRight:3,tabIndex:-1},r.createElement(Jb,null)),r.createElement(ji,{attribute:e,onEditField:t,onDeleteField:n},s))};Sr.defaultProps={attribute:void 0},Sr.propTypes={attribute:o().shape({components:o().array,component:o().string,type:o().string}),onEditField:o().func.isRequired,onDeleteField:o().func.isRequired,children:o().string.isRequired,index:o().number.isRequired,name:o().string.isRequired,onMoveField:o().func.isRequired};const tE=Sr,Vi=({relationsLayout:e,editRelationsLayoutRemainingFields:t,onRemoveField:n,onAddField:s})=>{const{formatMessage:a}=(0,A.useIntl)(),{setEditFieldToSelect:l,modifiedData:i,onMoveRelation:u}=He();return r.createElement(se.Stack,{spacing:4},r.createElement("div",null,r.createElement(D.Box,null,r.createElement(L.Typography,{fontWeight:"bold"},a({id:v("containers.SettingPage.relations"),defaultMessage:"Relational fields"}))),r.createElement(D.Box,null,r.createElement(L.Typography,{variant:"pi",textColor:"neutral600"},a({id:"containers.SettingPage.editSettings.description",defaultMessage:"Drag & drop the fields to build the layout"})))),r.createElement(D.Box,{padding:4,hasRadius:!0,borderStyle:"dashed",borderWidth:"1px",borderColor:"neutral300"},r.createElement(se.Stack,{spacing:2},e.map((c,d)=>{const m=M()(i,["metadatas",c,"edit","label"],"");return r.createElement(tE,{onEditField:()=>l(c),onDeleteField:()=>n(d),key:c,index:d,name:c,onMoveField:u},m||c)}),r.createElement(Ae.SimpleMenu,{id:"label",label:a({id:"containers.SettingPage.add.relational-field",defaultMessage:"Insert another relational field"}),"data-testid":"add-relation",as:ye.Button,fullWidth:!0,startIcon:r.createElement(ut(),null),endIcon:null,variant:"secondary",disabled:t.length===0},t.map(c=>r.createElement(Ae.MenuItem,{id:`menuItem-${c}`,key:`menuItem-${c}`,onClick:()=>s(c)},c))))))};Vi.propTypes={relationsLayout:o().array.isRequired,editRelationsLayoutRemainingFields:o().array.isRequired,onRemoveField:o().func.isRequired,onAddField:o().func.isRequired};const nE=Vi;var Ze=p(4122),rE=p(61714),an=p.n(rE),oE=p(9895),sE=p.n(oE),aE=p(34103),iE=p.n(aE),lE=p(57290),qi=p.n(lE),cE=p(55788),Lr=p.n(cE),uE=p(81208),dE=p.n(uE),pE=p(65232),Fr=p.n(pE),mE=p(80268),fE=p.n(mE),gE=p(42122),Dt=p.n(gE),yE=p(57955),hE=p.n(yE),bE=p(10822),EE=p.n(bE),vE=p(80466),CE=p.n(vE);const PE={biginteger:r.createElement(Dt(),null),boolean:r.createElement(sE(),null),date:r.createElement(an(),null),datetime:r.createElement(an(),null),decimal:r.createElement(Dt(),null),email:r.createElement(iE(),null),enum:r.createElement(qi(),null),enumeration:r.createElement(qi(),null),file:r.createElement(Lr(),null),files:r.createElement(Lr(),null),float:r.createElement(Dt(),null),integer:r.createElement(Dt(),null),media:r.createElement(Lr(),null),number:r.createElement(Dt(),null),relation:r.createElement(dE(),null),string:r.createElement(Fr(),null),text:r.createElement(Fr(),null),richtext:r.createElement(Fr(),null),time:r.createElement(an(),null),timestamp:r.createElement(an(),null),json:r.createElement(hE(),null),uid:r.createElement(fE(),null),component:r.createElement(EE(),null),dynamiczone:r.createElement(CE(),null)},Wi=({type:e})=>PE[e]||null;Wi.propTypes={type:o().string.isRequired};const zi=Wi,OE=e=>e.reduce((t,n)=>{const s=(0,V.get)(n,["attributes"],{}),a=Object.keys(s).filter(l=>!["boolean","component","dynamiczone","json","media","password","relation","text","richtext"].includes((0,V.get)(s,[l,"type"],"")));return t[n.uid]=a,t},{}),Ui=e=>{let t;switch(e){case"description":case"label":case"placeholder":t="text";break;case"mainField":t="select";break;case"editable":t="bool";break;default:t=""}const n=v(e==="mainField"?"containers.SettingPage.editSettings.entry.title":`form.Input.${e}`);return{type:t,label:{id:n}}};var xt=p(63865),RE=Object.defineProperty,ln=Object.getOwnPropertySymbols,Hi=Object.prototype.hasOwnProperty,Gi=Object.prototype.propertyIsEnumerable,Zi=(e,t,n)=>t in e?RE(e,t,{enumerable:!0,configurable:!0,writable:!0,value:n}):e[t]=n,kr=(e,t)=>{for(var n in t||(t={}))Hi.call(t,n)&&Zi(e,n,t[n]);if(ln)for(var n of ln(t))Gi.call(t,n)&&Zi(e,n,t[n]);return e},ME=(e,t)=>{var n={};for(var s in e)Hi.call(e,s)&&t.indexOf(s)<0&&(n[s]=e[s]);if(e!=null&&ln)for(var s of ln(e))t.indexOf(s)<0&&Gi.call(e,s)&&(n[s]=e[s]);return n};const Ar=e=>{var t=e,{type:n,options:s,onChange:a,value:l,name:i}=t,u=ME(t,["type","options","onChange","value","name"]);const{formatMessage:c}=(0,A.useIntl)();switch(n){case"text":return r.createElement(zn.TextInput,kr({onChange:a,value:l,name:i},u));case"bool":return r.createElement(xt.ToggleInput,kr({onChange:d=>{a({target:{name:i,value:d.target.checked}})},checked:l,name:i,onLabel:c({id:"app.components.ToggleCheckbox.on-label",defaultMessage:"On"}),offLabel:c({id:"app.components.ToggleCheckbox.off-label",defaultMessage:"Off"})},u));case"select":return r.createElement(ce.Select,kr({value:l,name:i,onChange:d=>a({target:{name:i,value:d}})},u),s.map(d=>r.createElement(ce.Option,{key:d,value:d},d)));default:return null}};Ar.defaultProps={options:void 0},Ar.propTypes={type:o().string.isRequired,options:o().arrayOf(o().string),onChange:o().func.isRequired,value:o().oneOfType([o().string,o().bool]).isRequired,name:o().string.isRequired};const TE=Ar,wE=[[4,"33%"],[6,"50%"],[8,"66%"],[12,"100%"]],IE=["dynamiczone","component","json","richtext"],DE=[1,5,10,15,30,60],xE=["datetime","time"],_i=({onMetaChange:e,onSizeChange:t})=>{const{formatMessage:n}=(0,A.useIntl)(),{modifiedData:s,selectedField:a,attributes:l,fieldForm:i}=He(),u=(0,r.useMemo)(Rn,[]),{schemas:c}=(0,fe.useSelector)(P=>u(P),fe.shallowEqual),d=(0,r.useMemo)(()=>{if(!a)return[];const P=M()(s,["metadatas",a,"edit"],{});return Object.keys(P).filter(C=>C!=="visible")},[a,s]),m=(0,r.useMemo)(()=>OE(c),[c]),f=(0,r.useCallback)(P=>{if(P!=="relation"&&P!=="component")return[];const C=P==="component"?"component":"targetModel",S=M()(s,["attributes",a,C],"");return M()(m,[S],[])},[a,m,s]),g=d.map(P=>{const C=M()(l,[a,"type"]);return["component","dynamiczone"].includes(C)&&!["label","description"].includes(P)||C==="component"&&P!=="label"||["media","json","boolean"].includes(C)&&P==="placeholder"||P==="step"?null:r.createElement(ie.GridItem,{col:6,key:P},r.createElement(TE,{type:Ui(P).type,hint:P==="mainField"?n({id:v("containers.SettingPage.editSettings.relation-field.description")}):"",label:n({id:M()(Ui(P),"label.id","app.utils.defaultMessage")}),name:P,onChange:e,value:M()(i,["metadata",P],""),options:f(C)}))}),h=!IE.includes(l[a].type),b=r.createElement(ie.GridItem,{col:6,key:"size"},r.createElement(ce.Select,{value:i==null?void 0:i.size,name:"size",onChange:P=>{t({name:a,value:P})},label:n({id:v("containers.SettingPage.editSettings.size.label"),defaultMessage:"Size"})},wE.map(([P,C])=>r.createElement(ce.Option,{key:P,value:P},C)))),E=xE.includes(l[a].type),x=r.createElement(ie.GridItem,{col:6,key:"step"},r.createElement(ce.Select,{value:M()(i,["metadata","step"],1),name:"step",onChange:P=>e({target:{name:"step",value:P}}),label:n({id:v("containers.SettingPage.editSettings.step.label"),defaultMessage:"Time interval (minutes)"})},DE.map(P=>r.createElement(ce.Option,{key:P,value:P},P))));return r.createElement(r.Fragment,null,g,h&&b,E&&x)};_i.propTypes={onMetaChange:o().func.isRequired,onSizeChange:o().func.isRequired};const SE=_i,LE=(0,k.default)(j.Flex)`
|
|
1077
|
-
svg {
|
|
1078
|
-
width: ${32/16}rem;
|
|
1079
|
-
height: ${24/16}rem;
|
|
1080
|
-
margin-right: ${({theme:e})=>e.spaces[3]};
|
|
1081
|
-
}
|
|
1082
|
-
`,Qi=({onToggle:e,onMetaChange:t,onSizeChange:n,onSubmit:s,type:a})=>{const{selectedField:l}=He(),{formatMessage:i}=(0,A.useIntl)(),u=()=>a==="timestamp"?"date":["decimal","float","integer","biginter"].includes(a)?"number":a;return r.createElement(Ze.ModalLayout,{onClose:e,labelledBy:"title"},r.createElement("form",{onSubmit:s},r.createElement(Ze.ModalHeader,null,r.createElement(LE,null,r.createElement(zi,{type:u(a)}),r.createElement(L.Typography,{fontWeight:"bold",textColor:"neutral800",as:"h2",id:"title"},i({id:v("containers.ListSettingsView.modal-form.edit-label"),defaultMessage:"Edit {fieldName}"},{fieldName:It()(l)})))),r.createElement(Ze.ModalBody,null,r.createElement(ie.Grid,{gap:4},r.createElement(SE,{onMetaChange:t,onSizeChange:n}))),r.createElement(Ze.ModalFooter,{startActions:r.createElement(ye.Button,{onClick:e,variant:"tertiary"},i({id:"app.components.Button.cancel",defaultMessage:"Cancel"})),endActions:r.createElement(ye.Button,{type:"submit"},i({id:"global.finish",defaultMessage:"Finish"}))})))};Qi.propTypes={onSubmit:o().func.isRequired,onToggle:o().func.isRequired,onMetaChange:o().func.isRequired,onSizeChange:o().func.isRequired,type:o().string.isRequired};const FE=Qi,kE=(e,t,n)=>ge.be.put(ve(n?`content-types/${t}/configuration`:`components/${t}/configuration`),e),jr=({mainLayout:e,components:t,isContentTypeView:n,slug:s,updateLayout:a})=>{const[l,i]=(0,r.useReducer)(Db,Ir,()=>$b(Ir,e,t)),[u,c]=(0,r.useState)(!1),{trackUsage:d}=(0,y.useTracking)(),m=(0,y.useNotification)(),{goBack:f}=(0,ee.useHistory)(),[g,h]=(0,r.useState)(!1),[b,E]=(0,r.useState)(!1),{componentLayouts:x,initialData:P,modifiedData:C,metaToEdit:S,metaForm:I}=l,{formatMessage:W}=(0,A.useIntl)(),R=M()(e,["info","displayName"],""),B=M()(C,["attributes"],{}),U=Object.keys(B).filter(H=>{const de=M()(B,[H,"type"],"");return!["dynamiczone","json","text","relation","component","boolean","media","password","richtext","timestamp"].includes(de)&&!!de}),Z=M()(C,["layouts","edit"],[]),q=hb()(Z,"rowContent"),G=Object.keys(C.attributes).filter(H=>n?M()(C,["attributes",H,"type"],"")!=="relation":!0).filter(H=>M()(C,["metadatas",H,"edit","visible"],!1)===!0).filter(H=>q.findIndex(de=>de.name===H)===-1).sort(),F=M()(C,["layouts","editRelations"],[]),Q=Object.keys(B).filter(H=>B[H].type==="relation").filter(H=>F.indexOf(H)===-1),$=({target:{name:H,value:de}})=>{i({type:"ON_CHANGE",keys:H.split("."),value:de})},Y=()=>{h(H=>!H)},T=()=>{E(H=>!H)},z=({target:{name:H,value:de}})=>{i({type:"ON_CHANGE_META",keys:H.split("."),value:de})},K=({name:H,value:de})=>{i({type:"ON_CHANGE_SIZE",name:H,value:de})},N=H=>{H.preventDefault(),i({type:"SUBMIT_META_FORM"}),Y()},w=H=>{H.preventDefault(),T()},O=(0,Tr.useMutation)(H=>kE(H,s,n),{onSuccess({data:H}){a&&a(H.data),i({type:"SUBMIT_SUCCEEDED"}),T(),d("didEditEditSettings")},onError(){m({type:"warning",message:{id:"notification.error"}})}}),{isLoading:_}=O,re=()=>{const H=Mi()(qe()(C),["layouts","metadatas","settings"]);ne()(H,"layouts.edit",Tb(H.layouts.edit)),O.mutate(H)},ue=(H,de)=>{i({type:"MOVE_RELATION",fromIndex:H,toIndex:de})},me=(H,de)=>{i({type:"MOVE_FIELD",fromIndex:H,toIndex:de})},Fe=(H,de,je,Ue)=>{i(je===Ue?{type:"REORDER_ROW",dragRowIndex:je,dragIndex:H,hoverIndex:de}:{type:"REORDER_DIFF_ROW",dragIndex:H,hoverIndex:de,dragRowIndex:je,hoverRowIndex:Ue})},rt=(H,de)=>{i({type:"MOVE_ROW",fromIndex:H,toIndex:de})};return r.createElement(Je,{isContentTypeView:n,attributes:B,modifiedData:C,slug:s,componentLayouts:x,selectedField:S,fieldForm:I,onMoveRelation:ue,onMoveField:me,moveRow:rt,moveItem:Fe,setEditFieldToSelect:H=>{i({type:"SET_FIELD_TO_EDIT",name:H}),Y()},isDraggingSibling:u,setIsDraggingSibling:c},r.createElement(oe.Main,null,r.createElement("form",{onSubmit:w},r.createElement(X.HeaderLayout,{title:W({id:v("components.SettingsViewWrapper.pluginHeader.title"),defaultMessage:`Configure the view - ${It()(R)}`},{name:It()(R)}),subtitle:W({id:v("components.SettingsViewWrapper.pluginHeader.description.edit-settings"),defaultMessage:"Customize how the edit view will look like."}),navigationAction:r.createElement(y.Link,{startIcon:r.createElement(rn(),null),onClick:H=>{H.preventDefault(),f()},to:"/"},W({id:"global.back",defaultMessage:"Back"})),primaryAction:r.createElement(ye.Button,{disabled:Xt()(P,C),startIcon:r.createElement(ft(),null),type:"submit"},W({id:"global.save",defaultMessage:"Save"}))}),r.createElement(X.ContentLayout,null,r.createElement(D.Box,{background:"neutral0",hasRadius:!0,shadow:"filterShadow",paddingTop:6,paddingBottom:6,paddingLeft:7,paddingRight:7},r.createElement(se.Stack,{spacing:4},r.createElement(L.Typography,{variant:"delta",as:"h2"},W({id:v("containers.SettingPage.settings"),defaultMessage:"Settings"})),r.createElement(ie.Grid,null,r.createElement(ie.GridItem,{col:6,s:12},r.createElement(ce.Select,{label:W({id:v("containers.SettingPage.editSettings.entry.title"),defaultMessage:"Entry title"}),hint:W({id:v("containers.SettingPage.editSettings.entry.title.description"),defaultMessage:"Set the display field of your entry"}),onChange:H=>{$({target:{name:"settings.mainField",value:H===""?null:H}})},value:C.settings.mainField},U.map(H=>r.createElement(ce.Option,{key:H,value:H},H))))),r.createElement(D.Box,{paddingTop:2,paddingBottom:2},r.createElement(Ut.Divider,null)),r.createElement(L.Typography,{variant:"delta",as:"h3"},W({id:v("containers.SettingPage.view"),defaultMessage:"View"})),r.createElement(ie.Grid,{gap:4},r.createElement(ie.GridItem,{col:n?8:12,s:12},r.createElement(Yb,{attributes:B,editLayout:Z,editLayoutRemainingFields:G,onAddField:H=>{i({type:"ON_ADD_FIELD",name:H})},onRemoveField:(H,de)=>{i({type:"REMOVE_FIELD",rowIndex:H,fieldIndex:de})}})),n&&r.createElement(ie.GridItem,{col:4,s:12},r.createElement(nE,{editRelationsLayoutRemainingFields:Q,relationsLayout:F,onAddField:H=>i({type:"ADD_RELATION",name:H}),onRemoveField:H=>i({type:"REMOVE_RELATION",index:H})})))))),r.createElement(y.ConfirmDialog,{bodyText:{id:v("popUpWarning.warning.updateAllSettings"),defaultMessage:"This will modify all your settings"},iconRightButton:r.createElement(ft(),null),isConfirmButtonLoading:_,isOpen:b,onToggleDialog:T,onConfirm:re,variantRightButton:"success-light"})),g&&r.createElement(FE,{onSubmit:N,onToggle:Y,type:M()(B,[S,"type"],""),onMetaChange:z,onSizeChange:K})))};jr.defaultProps={isContentTypeView:!1,updateLayout:null},jr.propTypes={components:o().object.isRequired,isContentTypeView:o().bool,mainLayout:o().shape({attributes:o().object.isRequired,info:o().object.isRequired,layouts:o().shape({list:o().array.isRequired,editRelations:o().array.isRequired,edit:o().array.isRequired}).isRequired,metadatas:o().object.isRequired,options:o().object.isRequired}).isRequired,slug:o().string.isRequired,updateLayout:o().func};const $r=jr;var yt=p(37617);const AE=()=>({type:yt.ZA}),jE=(e,t)=>({type:yt.Id,pagination:e,data:t}),$E=()=>({type:yt.MP});function BE(){return{type:yt.c2}}const NE=({components:e,contentType:t})=>{const{layouts:n}=t;return{contentType:t,components:e,displayedHeaders:n.list,type:yt.Zz}},Br=e=>({type:yt.Rp,target:e});var Ki=p(13055),Nr=p(29270),VE=p(70664);const qE=()=>e=>e["content-manager_listView"]||VE.E,WE=()=>(0,On.P1)(qE(),e=>e),Yi=e=>{const{displayedHeaders:t}=e["content-manager_listView"];return t},zE=WE,Ji=({isPublished:e})=>{const{formatMessage:t}=(0,A.useIntl)(),n=t({id:v(`containers.List.${e?"published":"draft"}`)}),s=e?"success100":"secondary100",a=e?"success700":"secondary700";return r.createElement(D.Box,{background:s,hasRadius:!0,paddingTop:1,paddingBottom:1,paddingLeft:2,paddingRight:2,style:{width:"fit-content"}},r.createElement(L.Typography,{fontWeight:"bold",textColor:a},n))};Ji.propTypes={isPublished:o().bool.isRequired};const UE=Ji;var HE=p(35980),St=p(53214),GE=p(68192),ZE=p.n(GE),Xi=p(9667),_E=Object.defineProperty,cn=Object.getOwnPropertySymbols,el=Object.prototype.hasOwnProperty,tl=Object.prototype.propertyIsEnumerable,nl=(e,t,n)=>t in e?_E(e,t,{enumerable:!0,configurable:!0,writable:!0,value:n}):e[t]=n,QE=(e,t)=>{for(var n in t||(t={}))el.call(t,n)&&nl(e,n,t[n]);if(cn)for(var n of cn(t))tl.call(t,n)&&nl(e,n,t[n]);return e},KE=(e,t)=>{var n={};for(var s in e)el.call(e,s)&&t.indexOf(s)<0&&(n[s]=e[s]);if(e!=null&&cn)for(var s of cn(e))t.indexOf(s)<0&&tl.call(e,s)&&(n[s]=e[s]);return n};const YE=(0,k.default)(j.Flex)`
|
|
1083
|
-
position: relative;
|
|
1084
|
-
border-radius: 50%;
|
|
1085
|
-
width: 26px;
|
|
1086
|
-
height: 26px;
|
|
1087
|
-
border: 1px solid ${({theme:e})=>e.colors.neutral200};
|
|
1088
|
-
background: ${({theme:e})=>e.colors.neutral150};
|
|
1089
|
-
padding-left: 1px;
|
|
1090
|
-
|
|
1091
|
-
span {
|
|
1092
|
-
line-height: 0.6rem;
|
|
1093
|
-
font-size: 0.6rem;
|
|
1094
|
-
}
|
|
1095
|
-
`,rl=e=>{var t=e,{children:n}=t,s=KE(t,["children"]);return r.createElement(YE,QE({justifyContent:"center",alignItems:"center",as:"span"},s),r.createElement(L.Typography,{variant:"sigma",textColor:"neutral600"},n))};rl.propTypes={children:o().string.isRequired};const ol=rl,Vr=({url:e,mime:t,alternativeText:n,name:s,ext:a,formats:l})=>{var i;const u=(0,y.prefixFileUrlWithBackendUrl)(e);if(t.includes("image")){const m=((i=l==null?void 0:l.thumbnail)==null?void 0:i.url)||null,f=(0,y.prefixFileUrlWithBackendUrl)(m)||u;return r.createElement(Xi.Avatar,{src:f,alt:n||s,preview:!0})}const c=(0,y.getFileExtension)(a),d=s.length>100?`${s.substring(0,100)}...`:s;return r.createElement(ar.Tooltip,{description:d},r.createElement(ol,null,c))};Vr.defaultProps={alternativeText:null,formats:null},Vr.propTypes={alternativeText:o().string,ext:o().string.isRequired,formats:o().object,mime:o().string.isRequired,name:o().string.isRequired,url:o().string.isRequired};const sl=Vr;var JE=Object.defineProperty,al=Object.getOwnPropertySymbols,XE=Object.prototype.hasOwnProperty,e0=Object.prototype.propertyIsEnumerable,il=(e,t,n)=>t in e?JE(e,t,{enumerable:!0,configurable:!0,writable:!0,value:n}):e[t]=n,t0=(e,t)=>{for(var n in t||(t={}))XE.call(t,n)&&il(e,n,t[n]);if(al)for(var n of al(t))e0.call(t,n)&&il(e,n,t[n]);return e};const ll=({value:e})=>r.createElement(Xi.AvatarGroup,null,e.map((t,n)=>{const s=`${t.id}${n}`;if(n===3){const a=`+${e.length-3}`;return r.createElement(ol,{key:s,preview:!1},a)}return n>3?null:r.createElement(sl,t0({key:s},t))}));ll.propTypes={value:o().arrayOf(o().shape({alternativeText:o().string,ext:o().string.isRequired,formats:o().object,mime:o().string.isRequired,name:o().string.isRequired,url:o().string.isRequired})).isRequired};const n0=ll;var cl=p(89557),r0=p(82910),o0=p(51064),s0=p.n(o0);const ul=({type:e,value:t})=>{const{formatDate:n,formatTime:s,formatNumber:a}=(0,A.useIntl)();let l=t;if(e==="date"&&(l=n(s0()(t),{dateStyle:"full"})),e==="datetime"&&(l=n(t,{dateStyle:"full",timeStyle:"short"})),e==="time"){const[i,u,c]=t.split(":"),d=new Date;d.setHours(i),d.setMinutes(u),d.setSeconds(c),l=s(d,{numeric:"auto",style:"short"})}return["float","decimal"].includes(e)&&(l=a(t,{maximumFractionDigits:21})),["integer","biginteger"].includes(e)&&(l=a(t,{maximumFractionDigits:0})),ca()(l)};ul.propTypes={type:o().string.isRequired,value:o().any.isRequired};const Lt=ul;var a0=Object.defineProperty,dl=Object.getOwnPropertySymbols,i0=Object.prototype.hasOwnProperty,l0=Object.prototype.propertyIsEnumerable,pl=(e,t,n)=>t in e?a0(e,t,{enumerable:!0,configurable:!0,writable:!0,value:n}):e[t]=n,c0=(e,t)=>{for(var n in t||(t={}))i0.call(t,n)&&pl(e,n,t[n]);if(dl)for(var n of dl(t))l0.call(t,n)&&pl(e,n,t[n]);return e},u0=(e,t,n)=>new Promise((s,a)=>{var l=c=>{try{u(n.next(c))}catch(d){a(d)}},i=c=>{try{u(n.throw(c))}catch(d){a(d)}},u=c=>c.done?s(c.value):Promise.resolve(c.value).then(l,i);u((n=n.apply(e,t)).next())});const d0=(0,k.default)(L.Typography)`
|
|
1096
|
-
max-width: 500px;
|
|
1097
|
-
`,p0=(e,t)=>u0(void 0,null,function*(){const{data:{results:n,pagination:s}}=yield ge.be.get(e);return t(),{results:n,pagination:s}}),ml=({fieldSchema:e,metadatas:t,queryInfos:n,name:s,rowId:a,value:l})=>{const{formatMessage:i}=(0,A.useIntl)(),{notifyStatus:u}=(0,Nr.useNotifyAT)(),c=ve(`${n.endPoint}/${a}/${s.split(".")[0]}`),[d,m]=(0,r.useState)(!1),f=r.createElement(r.Fragment,null,r.createElement(cl.Badge,null,l.count)," ",i({id:"content-manager.containers.ListPage.items",defaultMessage:"{number, plural, =0 {items} one {item} other {items}}"},{number:l.count})),g=()=>{const E=i({id:v("DynamicTable.relation-loaded"),defaultMessage:"Relations have been loaded"});u(E)},{data:h,status:b}=(0,Tr.useQuery)([e.targetModel,a],()=>p0(c,g),{enabled:d,staleTime:0});return r.createElement(D.Box,c0({},y.stopPropagation),r.createElement(Ae.SimpleMenu,{label:f,size:"S",onOpen:()=>m(!0),onClose:()=>m(!1)},b!=="success"&&r.createElement(Ae.MenuItem,{"aria-disabled":!0},r.createElement(r0.Loader,{small:!0},i({id:v("DynamicTable.relation-loading"),defaultMessage:"Relations are loading"}))),b==="success"&&r.createElement(r.Fragment,null,h==null?void 0:h.results.map(E=>r.createElement(Ae.MenuItem,{key:E.id,"aria-disabled":!0},r.createElement(d0,{ellipsis:!0},r.createElement(Lt,{type:t.mainField.schema.type,value:E[t.mainField.name]||E.id})))),(h==null?void 0:h.pagination.total)>10&&r.createElement(Ae.MenuItem,{"aria-disabled":!0,"aria-label":i({id:v("DynamicTable.relation-more"),defaultMessage:"This relation contains more entities than displayed"})},r.createElement(L.Typography,null,"...")))))};ml.propTypes={fieldSchema:o().shape({relation:o().string,targetModel:o().string,type:o().string.isRequired}).isRequired,metadatas:o().shape({mainField:o().shape({name:o().string.isRequired,schema:o().shape({type:o().string.isRequired}).isRequired})}).isRequired,name:o().string.isRequired,rowId:o().oneOfType([o().string,o().number]).isRequired,queryInfos:o().shape({endPoint:o().string.isRequired}).isRequired,value:o().object.isRequired};const m0=ml,f0=(0,k.default)(L.Typography)`
|
|
1098
|
-
max-width: 500px;
|
|
1099
|
-
`,fl=({metadatas:e,value:t})=>r.createElement(f0,{textColor:"neutral800",ellipsis:!0},r.createElement(Lt,{type:e.mainField.schema.type,value:t[e.mainField.name]||t.id}));fl.propTypes={metadatas:o().shape({mainField:o().shape({name:o().string.isRequired,schema:o().shape({type:o().string.isRequired}).isRequired})}).isRequired,value:o().object.isRequired};const g0=fl;var y0=Object.defineProperty,gl=Object.getOwnPropertySymbols,h0=Object.prototype.hasOwnProperty,b0=Object.prototype.propertyIsEnumerable,yl=(e,t,n)=>t in e?y0(e,t,{enumerable:!0,configurable:!0,writable:!0,value:n}):e[t]=n,E0=(e,t)=>{for(var n in t||(t={}))h0.call(t,n)&&yl(e,n,t[n]);if(gl)for(var n of gl(t))b0.call(t,n)&&yl(e,n,t[n]);return e};const v0=(0,k.default)(L.Typography)`
|
|
1100
|
-
max-width: 500px;
|
|
1101
|
-
`,hl=({value:e,metadatas:t})=>{const{formatMessage:n}=(0,A.useIntl)(),{mainField:{type:s,name:a}}=t,l=r.createElement(r.Fragment,null,r.createElement(cl.Badge,null,e.length)," ",n({id:"content-manager.containers.ListPage.items",defaultMessage:"{number, plural, =0 {items} one {item} other {items}}"},{number:e.length}));return r.createElement(D.Box,E0({},y.stopPropagation),r.createElement(Ae.SimpleMenu,{label:l,size:"S"},e.map(i=>r.createElement(Ae.MenuItem,{key:i.id,"aria-disabled":!0},r.createElement(v0,{ellipsis:!0},r.createElement(Lt,{type:s,value:i[a]||i.id}))))))};hl.propTypes={metadatas:o().shape({mainField:o().shape({name:o().string,type:o().string,value:o().string})}).isRequired,value:o().array.isRequired};const C0=hl,P0=(0,k.default)(L.Typography)`
|
|
1102
|
-
max-width: 250px;
|
|
1103
|
-
`,bl=({value:e,metadatas:t})=>{const{mainField:n}=t,s=e[n.name];return r.createElement(ar.Tooltip,{label:s},r.createElement(P0,{textColor:"neutral800",ellipsis:!0},r.createElement(Lt,{type:n.type,value:s})))};bl.propTypes={metadatas:o().shape({mainField:o().shape({name:o().string,type:o().string,value:o().string})}).isRequired,value:o().object.isRequired};const O0=bl;var R0=p(80022),El=p.n(R0);function vl(e){return["oneToOne","manyToOne","oneToOneMorph"].includes(e)}function M0(e,t,n,s){if(e==="component"){const{mainField:{name:a,type:l}}=n;if(s!=null&&s.repeatable)return t.length>0;const i=t==null?void 0:t[a];return a==="id"&&![void 0,null].includes(i)?!0:wt(l)&&l!=="biginteger"&&a!=="id"?El()(i):!Re()(i)}return e==="relation"?vl(s.relation)?!Re()(t):(t==null?void 0:t.count)>0:wt(e)&&e!=="biginteger"?El()(t):e==="boolean"?t!==null:!Re()(t)}var T0=Object.defineProperty,Cl=Object.getOwnPropertySymbols,w0=Object.prototype.hasOwnProperty,I0=Object.prototype.propertyIsEnumerable,Pl=(e,t,n)=>t in e?T0(e,t,{enumerable:!0,configurable:!0,writable:!0,value:n}):e[t]=n,D0=(e,t)=>{for(var n in t||(t={}))w0.call(t,n)&&Pl(e,n,t[n]);if(Cl)for(var n of Cl(t))I0.call(t,n)&&Pl(e,n,t[n]);return e};const x0=(0,k.default)(L.Typography)`
|
|
1104
|
-
max-width: 300px;
|
|
1105
|
-
`,qr=({content:e,fieldSchema:t,metadatas:n,name:s,queryInfos:a,rowId:l})=>{const{type:i}=t;if(!M0(i,e,n,t))return r.createElement(L.Typography,{textColor:"neutral800"},"-");switch(i){case"media":return t.multiple?r.createElement(n0,{value:e}):r.createElement(sl,D0({},e));case"relation":return vl(t.relation)?r.createElement(g0,{metadatas:n,value:e}):r.createElement(m0,{fieldSchema:t,queryInfos:a,metadatas:n,value:e,name:s,rowId:l});case"component":return t.repeatable===!0?r.createElement(C0,{value:e,metadatas:n}):r.createElement(O0,{value:e,metadatas:n});default:return r.createElement(x0,{ellipsis:!0,textColor:"neutral800"},r.createElement(Lt,{type:i,value:e}))}};qr.defaultProps={content:void 0,queryInfos:void 0},qr.propTypes={content:o().any,fieldSchema:o().shape({component:o().string,multiple:o().bool,type:o().string.isRequired,repeatable:o().bool,relation:o().string}).isRequired,metadatas:o().object.isRequired,name:o().string.isRequired,rowId:o().oneOfType([o().string,o().number]).isRequired,queryInfos:o().shape({endPoint:o().string.isRequired})};const S0=qr;var L0=Object.defineProperty,F0=Object.defineProperties,k0=Object.getOwnPropertyDescriptors,un=Object.getOwnPropertySymbols,Ol=Object.prototype.hasOwnProperty,Rl=Object.prototype.propertyIsEnumerable,Ml=(e,t,n)=>t in e?L0(e,t,{enumerable:!0,configurable:!0,writable:!0,value:n}):e[t]=n,Ft=(e,t)=>{for(var n in t||(t={}))Ol.call(t,n)&&Ml(e,n,t[n]);if(un)for(var n of un(t))Rl.call(t,n)&&Ml(e,n,t[n]);return e},A0=(e,t)=>F0(e,k0(t)),j0=(e,t)=>{var n={};for(var s in e)Ol.call(e,s)&&t.indexOf(s)<0&&(n[s]=e[s]);if(e!=null&&un)for(var s of un(e))t.indexOf(s)<0&&Rl.call(e,s)&&(n[s]=e[s]);return n};const Wr=({canCreate:e,canDelete:t,headers:n,entriesToDelete:s,onClickDelete:a,onSelectRow:l,withMainAction:i,withBulkActions:u,rows:c})=>{const{push:d,location:{pathname:m}}=(0,ee.useHistory)(),{formatMessage:f}=(0,A.useIntl)(),{trackUsage:g}=(0,y.useTracking)(),h=Zo();return r.createElement(St.Tbody,null,c.map((b,E)=>{const x=s.findIndex(C=>C===b.id)!==-1,P=f({id:"content-manager.components.DynamicTable.row-line",defaultMessage:"item line {number}"},{number:E});return r.createElement(St.Tr,Ft({key:b.id},(0,y.onRowClick)({fn(){g("willEditEntryFromList"),d({pathname:`${m}/${b.id}`,state:{from:m},search:h})},condition:u})),i&&r.createElement(St.Td,Ft({},y.stopPropagation),r.createElement(HE.BaseCheckbox,{"aria-label":f({id:"app.component.table.select.one-entry",defaultMessage:"Select {target}"},{target:(0,ai.Pp)(b.firstname,b.lastname)}),checked:x,onChange:()=>{l({name:b.id,value:!x})}})),n.map(C=>{var S=C,{key:I,cellFormatter:W,name:R}=S,B=j0(S,["key","cellFormatter","name"]);return r.createElement(St.Td,{key:I},typeof W=="function"?W(b,Ft({key:I,name:R},B)):r.createElement(S0,A0(Ft({content:b[R.split(".")[0]],name:R},B),{rowId:b.id})))}),u&&r.createElement(St.Td,null,r.createElement(j.Flex,Ft({justifyContent:"end"},y.stopPropagation),r.createElement(Me.IconButton,{onClick:()=>{g("willEditEntryFromButton"),d({pathname:`${m}/${b.id}`,state:{from:m},search:h})},label:f({id:"app.component.table.edit",defaultMessage:"Edit {target}"},{target:P}),noBorder:!0,icon:r.createElement(it(),null)}),e&&r.createElement(D.Box,{paddingLeft:1},r.createElement(Me.IconButton,{onClick:()=>{d({pathname:`${m}/create/clone/${b.id}`,state:{from:m},search:h})},label:f({id:"app.component.table.duplicate",defaultMessage:"Duplicate {target}"},{target:P}),noBorder:!0,icon:r.createElement(ZE(),null)})),t&&r.createElement(D.Box,{paddingLeft:1},r.createElement(Me.IconButton,{onClick:()=>{g("willDeleteEntryFromList"),a(b.id)},label:f({id:"global.delete-target",defaultMessage:"Delete {target}"},{target:P}),noBorder:!0,icon:r.createElement(Be(),null)})))))}))};Wr.defaultProps={canCreate:!1,canDelete:!1,entriesToDelete:[],onClickDelete(){},onSelectRow(){},rows:[],withBulkActions:!1,withMainAction:!1},Wr.propTypes={canCreate:o().bool,canDelete:o().bool,entriesToDelete:o().array,headers:o().array.isRequired,onClickDelete:o().func,onSelectRow:o().func,rows:o().array,withBulkActions:o().bool,withMainAction:o().bool};const $0=Wr;var B0=Object.defineProperty,dn=Object.getOwnPropertySymbols,Tl=Object.prototype.hasOwnProperty,wl=Object.prototype.propertyIsEnumerable,Il=(e,t,n)=>t in e?B0(e,t,{enumerable:!0,configurable:!0,writable:!0,value:n}):e[t]=n,N0=(e,t)=>{for(var n in t||(t={}))Tl.call(t,n)&&Il(e,n,t[n]);if(dn)for(var n of dn(t))wl.call(t,n)&&Il(e,n,t[n]);return e},V0=(e,t)=>{var n={};for(var s in e)Tl.call(e,s)&&t.indexOf(s)<0&&(n[s]=e[s]);if(e!=null&&dn)for(var s of dn(e))t.indexOf(s)<0&&wl.call(e,s)&&(n[s]=e[s]);return n};const Dl=e=>{var t=e,{area:n}=t,s=V0(t,["area"]);const a=Yo(n);return a?r.createElement("ul",null,a.map(l=>l.Component(s)?r.createElement(D.Box,{key:l.name,padding:3,style:{textAlign:"center"}},r.createElement(l.Component,N0({},s))):null)):null};Dl.propTypes={area:o().string.isRequired};const xl=Dl,Sl=({isConfirmButtonLoading:e,isOpen:t,onToggleDialog:n,onConfirm:s})=>{const{formatMessage:a}=(0,A.useIntl)();return r.createElement(ke.Dialog,{onClose:n,title:a({id:"app.components.ConfirmDialog.title",defaultMessage:"Confirmation"}),labelledBy:"confirmation",describedBy:"confirm-description",isOpen:t},r.createElement(ke.DialogBody,{icon:r.createElement(Tt(),null)},r.createElement(se.Stack,{spacing:2},r.createElement(j.Flex,{justifyContent:"center"},r.createElement(L.Typography,{id:"confirm-description"},a({id:v("popUpWarning.bodyMessage.contentType.delete.all"),defaultMessage:"Are you sure you want to delete these entries?"}))),r.createElement(j.Flex,null,r.createElement(xl,{area:"contentManager.listView.deleteModalAdditionalInfos"})))),r.createElement(ke.DialogFooter,{startAction:r.createElement(ye.Button,{onClick:n,variant:"tertiary"},a({id:"app.components.Button.cancel",defaultMessage:"Cancel"})),endAction:r.createElement(ye.Button,{onClick:s,variant:"danger-light",startIcon:r.createElement(Be(),null),id:"confirm-delete",loading:e},a({id:"app.components.Button.confirm",defaultMessage:"Confirm"}))}))};Sl.propTypes={isConfirmButtonLoading:o().bool.isRequired,isOpen:o().bool.isRequired,onConfirm:o().func.isRequired,onToggleDialog:o().func.isRequired};const q0=Sl,Ll=({isConfirmButtonLoading:e,isOpen:t,onToggleDialog:n,onConfirm:s})=>{const{formatMessage:a}=(0,A.useIntl)();return r.createElement(ke.Dialog,{onClose:n,title:a({id:"app.components.ConfirmDialog.title",defaultMessage:"Confirmation"}),labelledBy:"confirmation",describedBy:"confirm-description",isOpen:t},r.createElement(ke.DialogBody,{icon:r.createElement(Tt(),null)},r.createElement(se.Stack,{spacing:2},r.createElement(j.Flex,{justifyContent:"center"},r.createElement(L.Typography,{id:"confirm-description"},a({id:"components.popUpWarning.message",defaultMessage:"Are you sure you want to delete this?"}))),r.createElement(j.Flex,null,r.createElement(xl,{area:"contentManager.listView.deleteModalAdditionalInfos"})))),r.createElement(ke.DialogFooter,{startAction:r.createElement(ye.Button,{onClick:n,variant:"tertiary"},a({id:"app.components.Button.cancel",defaultMessage:"Cancel"})),endAction:r.createElement(ye.Button,{onClick:s,variant:"danger-light",startIcon:r.createElement(Be(),null),id:"confirm-delete",loading:e},a({id:"app.components.Button.confirm",defaultMessage:"Confirm"}))}))};Ll.propTypes={isConfirmButtonLoading:o().bool.isRequired,isOpen:o().bool.isRequired,onConfirm:o().func.isRequired,onToggleDialog:o().func.isRequired};const W0=Ll;var z0=Object.defineProperty,U0=Object.defineProperties,H0=Object.getOwnPropertyDescriptors,Fl=Object.getOwnPropertySymbols,G0=Object.prototype.hasOwnProperty,Z0=Object.prototype.propertyIsEnumerable,kl=(e,t,n)=>t in e?z0(e,t,{enumerable:!0,configurable:!0,writable:!0,value:n}):e[t]=n,pn=(e,t)=>{for(var n in t||(t={}))G0.call(t,n)&&kl(e,n,t[n]);if(Fl)for(var n of Fl(t))Z0.call(t,n)&&kl(e,n,t[n]);return e},mn=(e,t)=>U0(e,H0(t));const zr=({canCreate:e,canDelete:t,contentTypeName:n,action:s,isBulkable:a,isLoading:l,onConfirmDelete:i,onConfirmDeleteAll:u,layout:c,rows:d})=>{const{runHookWaterfall:m}=(0,y.useStrapiApp)(),f=c.contentType.options.draftAndPublish||!1,{formatMessage:g}=(0,A.useIntl)(),h=(0,fe.useSelector)(Yi),b=(0,r.useMemo)(()=>{const x=m(zt.No,{displayedHeaders:h,layout:c}).displayedHeaders.map(P=>{const{metadatas:C}=P;if(P.fieldSchema.type==="relation"){const S=`${P.name}.${P.metadatas.mainField.name}`;return mn(pn({},P),{metadatas:mn(pn({},C),{label:g({id:v(`containers.ListPage.table-headers.${P.name}`),defaultMessage:P.name})}),name:S})}return mn(pn({},P),{metadatas:mn(pn({},C),{label:g({id:v(`containers.ListPage.table-headers.${P.name}`),defaultMessage:P.name})})})});return f?[...x,{key:"__published_at_temp_key__",name:"publishedAt",fieldSchema:{type:"custom"},metadatas:{label:g({id:v("containers.ListPage.table-headers.publishedAt"),defaultMessage:"publishedAt"}),searchable:!1,sortable:!0},cellFormatter(P){const C=!Re()(P.publishedAt);return r.createElement(UE,{isPublished:C})}}]:x},[m,h,c,f,g]);return r.createElement(y.DynamicTable,{components:{ConfirmDialogDelete:W0,ConfirmDialogDeleteAll:q0},contentType:n,action:s,isLoading:l,headers:b,onConfirmDelete:i,onConfirmDeleteAll:u,onOpenDeleteAllModalTrackedEvent:"willBulkDeleteEntries",rows:d,withBulkActions:!0,withMainAction:t&&a},r.createElement($0,{canCreate:e,canDelete:t,headers:b,rows:d,withBulkActions:!0,withMainAction:t&&a}))};zr.defaultProps={action:void 0},zr.propTypes={canCreate:o().bool.isRequired,canDelete:o().bool.isRequired,contentTypeName:o().string.isRequired,action:o().node,isBulkable:o().bool.isRequired,isLoading:o().bool.isRequired,layout:o().exact({components:o().object.isRequired,contentType:o().shape({attributes:o().object.isRequired,metadatas:o().object.isRequired,layouts:o().shape({list:o().array.isRequired,editRelations:o().array}).isRequired,options:o().object.isRequired,settings:o().object.isRequired}).isRequired}).isRequired,onConfirmDelete:o().func.isRequired,onConfirmDeleteAll:o().func.isRequired,rows:o().array.isRequired};const _0=zr,Q0=e=>Object.keys(e).reduce((n,s)=>{const a=e[s];return fo(a)&&n.push(s),n},[]).sort(),Al=({layout:e})=>{const t=(0,fe.useDispatch)(),n=(0,fe.useSelector)(Yi),{trackUsage:s}=(0,y.useTracking)(),{formatMessage:a}=(0,A.useIntl)(),l=Q0(e.contentType.attributes).map(c=>{const d=e.contentType.metadatas[c].list;return{name:c,intlLabel:{id:d.label,defaultMessage:d.label}}}),i=n.map(({name:c})=>c),u=c=>{if(s("didChangeDisplayedFields"),c.length<i.length){const d=i.filter(m=>c.indexOf(m)===-1);t(Br({name:d[0],value:!0}))}else{const d=c.filter(m=>i.indexOf(m)===-1);t(Br({name:d[0],value:!1}))}};return r.createElement(D.Box,{paddingTop:1,paddingBottom:1},r.createElement(ce.Select,{"aria-label":"change displayed fields",value:i,onChange:u,customizeContent:c=>a({id:v("select.currently.selected"),defaultMessage:"{count} currently selected"},{count:c.length}),multi:!0,size:"S"},l.map(c=>r.createElement(ce.Option,{key:c.name,value:c.name},a({id:c.intlLabel.id||c.name,defaultMessage:c.intlLabel.defaultMessage||c.name})))))};Al.propTypes={layout:o().shape({contentType:o().shape({attributes:o().object.isRequired,metadatas:o().object.isRequired,layouts:o().shape({list:o().array.isRequired,editRelations:o().array}).isRequired,options:o().object.isRequired,settings:o().object.isRequired}).isRequired}).isRequired};const K0=(0,r.memo)(Al),Ur=({pagination:e})=>r.createElement(D.Box,{paddingTop:4},r.createElement(j.Flex,{alignItems:"flex-end",justifyContent:"space-between"},r.createElement(y.PageSizeURLQuery,{trackedEvent:"willChangeNumberOfEntriesPerPage"}),r.createElement(y.PaginationURLQuery,{pagination:e})));Ur.defaultProps={pagination:{pageCount:0,pageSize:10,total:0}},Ur.propTypes={pagination:o().shape({page:o().number,pageCount:o().number,pageSize:o().number,total:o().number})};const Y0=Ur,J0=["json","component","media","richtext","dynamiczone","password"],X0=["createdAt","updatedAt"],ev=(e,t)=>{const{allPermissions:n}=(0,y.useRBACProvider)(),s=(0,y.findMatchingPermissions)(n,[{action:"plugin::content-manager.explorer.read",subject:t}]),a=M()(s,["0","properties","fields"],[]);return Object.keys(M()(e,["attributes"]),{}).filter(u=>{const c=M()(e,["attributes",u],{});return!(!c.type||J0.includes(c.type)||!a.includes(u)&&u!=="id"&&!X0.includes(u))}).sort()};var tv=p(23899),nv=p.n(tv);const jl=({displayedFilters:e})=>{const[t,n]=(0,r.useState)(!1),{formatMessage:s}=(0,A.useIntl)(),a=(0,r.useRef)(),{trackUsage:l}=(0,y.useTracking)(),i=()=>{t||l("willFilterEntries"),n(u=>!u)};return r.createElement(r.Fragment,null,r.createElement(D.Box,{paddingTop:1,paddingBottom:1},r.createElement(ye.Button,{variant:"tertiary",ref:a,startIcon:r.createElement(nv(),null),onClick:i,size:"S"},s({id:"app.utils.filters",defaultMessage:"Filters"})),t&&r.createElement(y.FilterPopoverURLQuery,{displayedFilters:e,isVisible:t,onToggle:i,source:a})),r.createElement(y.FilterListURLQuery,{filtersSchema:e}))};jl.propTypes={displayedFilters:o().arrayOf(o().shape({name:o().string.isRequired,metadatas:o().shape({label:o().string}),fieldSchema:o().shape({type:o().string})})).isRequired};const rv=jl,$l=({contentType:e,slug:t,metadatas:n})=>{const{formatMessage:s}=(0,A.useIntl)(),l=ev(e,t).map(i=>{const u=e.attributes[i],{type:c,enum:d}=u,m={name:"didFilterEntries",properties:{useRelation:c==="relation"}},{mainField:f,label:g}=n[i].list;return{name:i,metadatas:{label:s({id:g,defaultMessage:g})},fieldSchema:{type:c,options:d,mainField:f},trackedEvent:m}});return r.createElement(rv,{displayedFilters:l})};$l.propTypes={contentType:o().object.isRequired,metadatas:o().object.isRequired,slug:o().string.isRequired};const ov=$l;var sv=p(98399),av=Object.defineProperty,iv=Object.defineProperties,lv=Object.getOwnPropertyDescriptors,Bl=Object.getOwnPropertySymbols,cv=Object.prototype.hasOwnProperty,uv=Object.prototype.propertyIsEnumerable,Nl=(e,t,n)=>t in e?av(e,t,{enumerable:!0,configurable:!0,writable:!0,value:n}):e[t]=n,dv=(e,t)=>{for(var n in t||(t={}))cv.call(t,n)&&Nl(e,n,t[n]);if(Bl)for(var n of Bl(t))uv.call(t,n)&&Nl(e,n,t[n]);return e},pv=(e,t)=>iv(e,lv(t)),Hr=(e,t,n)=>new Promise((s,a)=>{var l=c=>{try{u(n.next(c))}catch(d){a(d)}},i=c=>{try{u(n.throw(c))}catch(d){a(d)}},u=c=>c.done?s(c.value):Promise.resolve(c.value).then(l,i);u((n=n.apply(e,t)).next())});const mv=De.Z.contentManager,fv=(0,k.default)(Me.IconButton)`
|
|
1106
|
-
svg {
|
|
1107
|
-
path {
|
|
1108
|
-
fill: ${({theme:e})=>e.colors.neutral900};
|
|
1109
|
-
}
|
|
1110
|
-
}
|
|
1111
|
-
`;function Vl({canCreate:e,canDelete:t,canRead:n,data:s,getData:a,getDataSucceeded:l,isLoading:i,layout:u,pagination:c,slug:d}){const{total:m}=c,{contentType:{metadatas:f,settings:{bulkable:g,filterable:h,searchable:b}}}=u,E=(0,y.useNotification)(),{trackUsage:x}=(0,y.useTracking)(),{refetchPermissions:P}=(0,y.useRBACProvider)(),C=(0,r.useRef)(x),S=(0,r.useRef)(P),{notifyStatus:I}=(0,Nr.useNotifyAT)();(0,y.useFocusWhenNavigate)();const[{query:W}]=(0,y.useQueryParams)(),R=_a(W),B=(0,Ne.stringify)({plugins:W.plugins},{encode:!1}),{pathname:U}=(0,ee.useLocation)(),{push:Z}=(0,ee.useHistory)(),{formatMessage:q}=(0,A.useIntl)(),G=u.contentType,F=M()(G,"options.draftAndPublish",!1),Q=(0,r.useRef)(""),$=(0,r.useCallback)((O,_)=>Hr(this,null,function*(){a();try{const re=_?{cancelToken:_.token}:null,{data:{results:ue,pagination:me}}=yield ge.be.get(O,re);I(q({id:v("utils.data-loaded"),defaultMessage:"{number, plural, =1 {# entry has} other {# entries have}} successfully been loaded"},{number:me.count})),l(me,ue)}catch(re){if(Se().isCancel(re))return;if(M()(re,"response.status",null)===403){yield S.current(),E({type:"info",message:{id:v("permissions.not-allowed.update")}}),Z("/");return}sv.error(re),E({type:"warning",message:{id:v("error.model.fetch")}})}}),[q,a,l,I,Z,E]),Y=(0,r.useCallback)(O=>Hr(this,null,function*(){try{yield ge.be.post(ve(`collection-types/${d}/actions/bulkDelete`),{ids:O});const _=ve(`collection-types/${d}${R}`);$(_),C.current("didBulkDeleteEntries")}catch(_){E({type:"warning",message:{id:v("error.record.delete")}})}}),[$,R,d,E]),T=(0,r.useCallback)(O=>Hr(this,null,function*(){try{yield ge.be.delete(ve(`collection-types/${d}/${O}`));const _=ve(`collection-types/${d}${R}`);$(_),E({type:"success",message:{id:v("success.record.delete")}})}catch(_){const re=M()(_,"response.payload.message",q({id:v("error.record.delete")}));E({type:"warning",message:re})}}),[d,R,$,E,q]);(0,r.useEffect)(()=>{const _=Se().CancelToken.source(),re=n,ue=ve(`collection-types/${d}${R}`);return re&&ue.includes(Q.current)&&$(ue,_),()=>{Q.current=d,_.cancel("Operation canceled by the user.")}},[n,a,d,R,l,$]);const z=q({id:v("header.name"),defaultMessage:"Content"}),K=q({id:G.info.displayName,defaultMessage:G.info.displayName||z}),N=n?q({id:v("pages.ListView.header-subtitle"),defaultMessage:"{number, plural, =0 {# entries} one {# entry} other {# entries}} found"},{number:m}):null,w=O=>e?r.createElement(ye.Button,pv(dv({},O),{onClick:()=>{const _=F?{status:"draft"}:{};C.current("willCreateEntry",_),Z({pathname:`${U}/create`,search:W.plugins?B:""})},startIcon:r.createElement(ut(),null)}),q({id:v("HeaderLayout.button.label-add-entry"),defaultMessage:"Create new entry"})):null;return r.createElement(oe.Main,{"aria-busy":i},r.createElement(X.HeaderLayout,{primaryAction:w(),subtitle:N,title:K,navigationAction:r.createElement(y.Link,{startIcon:r.createElement(rn(),null),to:"/content-manager/"},q({id:"global.back",defaultMessage:"Back"}))}),!n&&r.createElement(X.ActionLayout,{endActions:r.createElement(Gt,{area:"contentManager.listView.actions"})}),n&&r.createElement(X.ActionLayout,{endActions:r.createElement(r.Fragment,null,r.createElement(Gt,{area:"contentManager.listView.actions"}),r.createElement(K0,{layout:u}),r.createElement(y.CheckPermissions,{permissions:mv.collectionTypesConfigurations},r.createElement(D.Box,{paddingTop:1,paddingBottom:1},r.createElement(fv,{onClick:()=>{x("willEditListLayout"),Z({pathname:`${d}/configurations/list`,search:B})},icon:r.createElement(Si(),null),label:q({id:"app.links.configure-view",defaultMessage:"Configure the view"})})))),startActions:r.createElement(r.Fragment,null,b&&r.createElement(y.SearchURLQuery,{label:q({id:"app.component.search.label",defaultMessage:"Search for {target}"},{target:K}),placeholder:q({id:"global.search",defaultMessage:"Search"}),trackedEvent:"didSearch"}),h&&r.createElement(ov,{contentType:G,slug:d,metadatas:f}))}),r.createElement(X.ContentLayout,null,n?r.createElement(r.Fragment,null,r.createElement(_0,{canCreate:e,canDelete:t,contentTypeName:K,onConfirmDeleteAll:Y,onConfirmDelete:T,isBulkable:g,isLoading:i,layout:u,rows:s,action:w({variant:"secondary"})}),r.createElement(Y0,{pagination:{pageCount:(c==null?void 0:c.pageCount)||1}})):r.createElement(y.NoPermissions,null)))}Vl.propTypes={canCreate:o().bool.isRequired,canDelete:o().bool.isRequired,canRead:o().bool.isRequired,data:o().array.isRequired,layout:o().exact({components:o().object.isRequired,contentType:o().shape({attributes:o().object.isRequired,metadatas:o().object.isRequired,info:o().shape({displayName:o().string.isRequired}).isRequired,layouts:o().shape({list:o().array.isRequired,editRelations:o().array}).isRequired,options:o().object.isRequired,settings:o().object.isRequired}).isRequired}).isRequired,isLoading:o().bool.isRequired,getData:o().func.isRequired,getDataSucceeded:o().func.isRequired,pagination:o().shape({total:o().number.isRequired,pageCount:o().number}).isRequired,slug:o().string.isRequired};const gv=zE();function yv(e){return(0,Ki.bindActionCreators)({getData:AE,getDataSucceeded:jE,onChangeListHeaders:Br,onResetListHeaders:$E},e)}const hv=(0,fe.connect)(gv,yv),bv=(0,Ki.compose)(hv)((0,r.memo)(Vl,We()));var Ev=Object.defineProperty,ql=Object.getOwnPropertySymbols,vv=Object.prototype.hasOwnProperty,Cv=Object.prototype.propertyIsEnumerable,Wl=(e,t,n)=>t in e?Ev(e,t,{enumerable:!0,configurable:!0,writable:!0,value:n}):e[t]=n,zl=(e,t)=>{for(var n in t||(t={}))vv.call(t,n)&&Wl(e,n,t[n]);if(ql)for(var n of ql(t))Cv.call(t,n)&&Wl(e,n,t[n]);return e};const Gr=e=>{const t=(0,r.useMemo)(()=>Co(e.slug),[e.slug]),{isLoading:n,allowedActions:s}=(0,y.useRBAC)(t,e.permissions);return n?r.createElement(y.LoadingIndicatorPage,null):r.createElement(bv,zl(zl({},e),s))};Gr.defaultProps={permissions:[]},Gr.propTypes={permissions:o().array,slug:o().string.isRequired};const Pv=(0,r.memo)(Gr,(e,t)=>{const n=(0,y.difference)(e,t);return Object.keys(n).filter(a=>a!=="state").length>0});var Ov=Object.defineProperty,Rv=Object.defineProperties,Mv=Object.getOwnPropertyDescriptors,fn=Object.getOwnPropertySymbols,Ul=Object.prototype.hasOwnProperty,Hl=Object.prototype.propertyIsEnumerable,Gl=(e,t,n)=>t in e?Ov(e,t,{enumerable:!0,configurable:!0,writable:!0,value:n}):e[t]=n,Tv=(e,t)=>{for(var n in t||(t={}))Ul.call(t,n)&&Gl(e,n,t[n]);if(fn)for(var n of fn(t))Hl.call(t,n)&&Gl(e,n,t[n]);return e},wv=(e,t)=>Rv(e,Mv(t)),Iv=(e,t)=>{var n={};for(var s in e)Ul.call(e,s)&&t.indexOf(s)<0&&(n[s]=e[s]);if(e!=null&&fn)for(var s of fn(e))t.indexOf(s)<0&&Hl.call(e,s)&&(n[s]=e[s]);return n};const Zl=e=>{var t=e,{layout:n}=t,s=Iv(t,["layout"]);const a=(0,fe.useDispatch)(),{replace:l}=(0,ee.useHistory)(),[{query:i,rawQuery:u}]=(0,y.useQueryParams)(),c=Qo(i,s.slug,"listView"),d=Go(s.slug);return(0,r.useEffect)(()=>{u||l(d)},[u,l,d]),(0,r.useEffect)(()=>{a(NE(n))},[a,n]),(0,r.useEffect)(()=>()=>{a(BE())},[a]),c?r.createElement(Pv,wv(Tv({},s),{layout:n,permissions:c})):null};Zl.propTypes={layout:o().exact({components:o().object.isRequired,contentType:o().shape({attributes:o().object.isRequired,metadatas:o().object.isRequired,layouts:o().shape({list:o().array.isRequired,editRelations:o().array}).isRequired,options:o().object.isRequired,settings:o().object.isRequired,pluginOptions:o().object}).isRequired}).isRequired,slug:o().string.isRequired};const Dv=Zl,xv=(e,t)=>ge.be.put(ve(`content-types/${t}/configuration`),e),Sv=(0,k.default)(j.Flex)`
|
|
1112
|
-
gap: ${({theme:e})=>e.spaces[4]};
|
|
1113
|
-
`,Zr=({modifiedData:e,onChange:t,sortOptions:n})=>{const{formatMessage:s}=(0,A.useIntl)(),{settings:a}=e;return r.createElement(r.Fragment,null,r.createElement(D.Box,{paddingBottom:4},r.createElement(L.Typography,{variant:"delta",as:"h2"},s({id:v("containers.SettingPage.settings"),defaultMessage:"Settings"}))),r.createElement(Sv,{justifyContent:"space-between",wrap:"wrap",paddingBottom:6},r.createElement(xt.ToggleInput,{label:s({id:v("form.Input.search"),defaultMessage:"Enable search"}),onChange:l=>{t({target:{name:"settings.searchable",value:l.target.checked}})},onLabel:s({id:"app.components.ToggleCheckbox.on-label",defaultMessage:"on"}),offLabel:s({id:"app.components.ToggleCheckbox.off-label",defaultMessage:"off"}),name:"settings.searchable",checked:a.searchable}),r.createElement(xt.ToggleInput,{label:s({id:v("form.Input.filters"),defaultMessage:"Enable filters"}),onChange:l=>{t({target:{name:"settings.filterable",value:l.target.checked}})},onLabel:s({id:"app.components.ToggleCheckbox.on-label",defaultMessage:"on"}),offLabel:s({id:"app.components.ToggleCheckbox.off-label",defaultMessage:"off"}),name:"settings.filterable",checked:a.filterable}),r.createElement(xt.ToggleInput,{label:s({id:v("form.Input.bulkActions"),defaultMessage:"Enable bulk actions"}),onChange:l=>{t({target:{name:"settings.bulkable",value:l.target.checked}})},onLabel:s({id:"app.components.ToggleCheckbox.on-label",defaultMessage:"on"}),offLabel:s({id:"app.components.ToggleCheckbox.off-label",defaultMessage:"off"}),name:"settings.bulkable",checked:a.bulkable})),r.createElement(ie.Grid,{gap:4},r.createElement(ie.GridItem,{s:12,col:6},r.createElement(ce.Select,{label:s({id:v("form.Input.pageEntries"),defaultMessage:"Entries per page"}),hint:s({id:v("form.Input.pageEntries.inputDescription"),defaultMessage:"Note: You can override this value in the Collection Type settings page."}),onChange:l=>t({target:{name:"settings.pageSize",value:l}}),name:"settings.pageSize",value:e.settings.pageSize||""},[10,20,50,100].map(l=>r.createElement(ce.Option,{key:l,value:l},l)))),r.createElement(ie.GridItem,{s:12,col:3},r.createElement(ce.Select,{label:s({id:v("form.Input.defaultSort"),defaultMessage:"Default sort attribute"}),onChange:l=>t({target:{name:"settings.defaultSortBy",value:l}}),name:"settings.defaultSortBy",value:e.settings.defaultSortBy||""},n.map(l=>r.createElement(ce.Option,{key:l,value:l},l)))),r.createElement(ie.GridItem,{s:12,col:3},r.createElement(ce.Select,{label:s({id:v("form.Input.sort.order"),defaultMessage:"Default sort order"}),onChange:l=>t({target:{name:"settings.defaultSortOrder",value:l}}),name:"settings.defaultSortOrder",value:e.settings.defaultSortOrder||""},["ASC","DESC"].map(l=>r.createElement(ce.Option,{key:l,value:l},l))))))};Zr.defaultProps={modifiedData:{},sortOptions:[]},Zr.propTypes={modifiedData:o().object,onChange:o().func.isRequired,sortOptions:o().array};const Lv=Zr,_r=k.default.button`
|
|
1114
|
-
display: flex;
|
|
1115
|
-
align-items: center;
|
|
1116
|
-
height: ${({theme:e})=>e.spaces[7]};
|
|
1117
|
-
|
|
1118
|
-
&:last-child {
|
|
1119
|
-
padding: 0 ${({theme:e})=>e.spaces[3]};
|
|
1120
|
-
}
|
|
1121
|
-
`,_l=(0,k.default)(_r)`
|
|
1122
|
-
padding: 0 ${({theme:e})=>e.spaces[3]};
|
|
1123
|
-
border-right: 1px solid ${({theme:e})=>e.colors.neutral150};
|
|
1124
|
-
cursor: all-scroll;
|
|
1125
|
-
|
|
1126
|
-
svg {
|
|
1127
|
-
width: ${12/16}rem;
|
|
1128
|
-
height: ${12/16}rem;
|
|
1129
|
-
}
|
|
1130
|
-
`,Fv=(0,k.default)(j.Flex)`
|
|
1131
|
-
max-height: ${32/16}rem;
|
|
1132
|
-
cursor: pointer;
|
|
1133
|
-
|
|
1134
|
-
svg {
|
|
1135
|
-
width: ${10/16}rem;
|
|
1136
|
-
height: ${10/16}rem;
|
|
1137
|
-
|
|
1138
|
-
path {
|
|
1139
|
-
fill: ${({theme:e})=>e.colors.neutral600};
|
|
1140
|
-
}
|
|
1141
|
-
}
|
|
1142
|
-
|
|
1143
|
-
&:hover {
|
|
1144
|
-
background-color: ${({theme:e})=>e.colors.primary100};
|
|
1145
|
-
border-color: ${({theme:e})=>e.colors.primary200};
|
|
1146
|
-
|
|
1147
|
-
svg {
|
|
1148
|
-
path {
|
|
1149
|
-
fill: ${({theme:e})=>e.colors.primary600};
|
|
1150
|
-
}
|
|
1151
|
-
}
|
|
1152
|
-
|
|
1153
|
-
${L.Typography} {
|
|
1154
|
-
color: ${({theme:e})=>e.colors.primary600};
|
|
1155
|
-
}
|
|
1156
|
-
|
|
1157
|
-
${_l} {
|
|
1158
|
-
border-right: 1px solid ${({theme:e})=>e.colors.primary200};
|
|
1159
|
-
}
|
|
1160
|
-
}
|
|
1161
|
-
`,kv=(0,k.default)(D.Box)`
|
|
1162
|
-
&:last-child {
|
|
1163
|
-
padding-right: ${({theme:e})=>e.spaces[3]};
|
|
1164
|
-
}
|
|
1165
|
-
`,Ql=({index:e,isDraggingSibling:t,labelField:n,onClickEditField:s,onMoveField:a,onRemoveField:l,name:i,setIsDraggingSibling:u})=>{const{formatMessage:c}=(0,A.useIntl)(),d=(0,r.useRef)(null),m=(0,r.useRef)(null),[,f]=(0,r.useState)(!1),g=(0,r.useRef)(),h=ao(n),b=()=>{g.current&&g.current.click()},[,E]=(0,Te.useDrop)({accept:Oe.FIELD,hover(I,W){if(!m.current)return;const R=I.index,B=e;if(R===B)return;const U=m.current.getBoundingClientRect(),Z=(U.right-U.left)/2,G=W.getClientOffset().x-U.left;R>B&&G>Z||R<B&&G<Z||(a(R,B),I.index=B)}}),[{isDragging:x},P,C]=(0,Te.useDrag)({type:Oe.FIELD,item(){return{index:e,labelField:n,name:i}},collect:I=>({isDragging:I.isDragging()}),end(){u(!1)}});(0,r.useEffect)(()=>{C((0,Kt.rX)(),{captureDraggingState:!1})},[C]),(0,r.useEffect)(()=>{x&&u(!0)},[x,u]),(0,r.useEffect)(()=>{t||f(I=>!I)},[t]);const S={dragRef:P(d),dropRef:E(m)};return r.createElement(kv,{ref:S?S.dropRef:null},x&&r.createElement(En,{transparent:!0,labelField:h}),!x&&t&&r.createElement(En,{isSibling:!0,labelField:h}),!x&&!t&&r.createElement(Fv,{borderColor:"neutral150",background:"neutral100",hasRadius:!0,justifyContent:"space-between",onClick:b,isDragging:x},r.createElement(se.Stack,{horizontal:!0,spacing:3},r.createElement(_l,{as:"span","aria-label":c({id:v("components.DraggableCard.move.field"),defaultMessage:"Move {item}"},{item:i}),onClick:I=>I.stopPropagation(),ref:S.dragRef,type:"button"},r.createElement(Xe(),null)),r.createElement(L.Typography,{fontWeight:"bold"},h)),r.createElement(j.Flex,{paddingLeft:3},r.createElement(_r,{ref:g,onClick:I=>{I.stopPropagation(),s(i)},"aria-label":c({id:v("components.DraggableCard.edit.field"),defaultMessage:"Edit {item}"},{item:i}),type:"button"},r.createElement(it(),null)),r.createElement(_r,{onClick:l,"data-testid":`delete-${i}`,"aria-label":c({id:v("components.DraggableCard.delete.field"),defaultMessage:"Delete {item}"},{item:i}),type:"button"},r.createElement(so(),null)))))};Ql.propTypes={index:o().number.isRequired,isDraggingSibling:o().bool.isRequired,labelField:o().string.isRequired,name:o().string.isRequired,onClickEditField:o().func.isRequired,onMoveField:o().func.isRequired,onRemoveField:o().func.isRequired,setIsDraggingSibling:o().func.isRequired};const Av=Ql,Kl=(0,k.default)(D.Box)`
|
|
1166
|
-
flex: ${({size:e})=>e};
|
|
1167
|
-
`,jv=(0,k.default)(Kl)`
|
|
1168
|
-
overflow-x: scroll;
|
|
1169
|
-
overflow-y: hidden;
|
|
1170
|
-
`,$v=(0,k.default)(Kl)`
|
|
1171
|
-
max-width: ${32/16}rem;
|
|
1172
|
-
`,Yl=({displayedFields:e,listRemainingFields:t,metadatas:n,onAddField:s,onClickEditField:a,onMoveField:l,onRemoveField:i})=>{const{formatMessage:u}=(0,A.useIntl)(),[c,d]=(0,r.useState)(!1),[m,f]=(0,r.useState)(null),g=(0,r.useRef)();function h(...E){f("add"),s(...E)}function b(...E){f("remove"),i(...E)}return(0,r.useEffect)(()=>{m==="add"&&(g==null?void 0:g.current)&&(g.current.scrollLeft=g.current.scrollWidth)},[e,m]),r.createElement(r.Fragment,null,r.createElement(D.Box,{paddingBottom:4},r.createElement(L.Typography,{variant:"delta",as:"h2"},u({id:v("containers.SettingPage.view"),defaultMessage:"View"}))),r.createElement(j.Flex,{paddingTop:4,paddingLeft:4,paddingRight:4,borderColor:"neutral300",borderStyle:"dashed",borderWidth:"1px",hasRadius:!0},r.createElement(jv,{size:"1",paddingBottom:4,ref:g},r.createElement(se.Stack,{horizontal:!0,spacing:3},e.map((E,x)=>r.createElement(Av,{key:E,index:x,isDraggingSibling:c,onMoveField:l,onClickEditField:a,onRemoveField:P=>b(P,x),name:E,labelField:n[E].list.label||E,setIsDraggingSibling:d})))),r.createElement($v,{size:"auto",paddingBottom:4},r.createElement(Ae.SimpleMenu,{label:u({id:v("components.FieldSelect.label"),defaultMessage:"Add a field"}),as:Me.IconButton,icon:r.createElement(ut(),null),disabled:t.length<=0,"data-testid":"add-field"},t.map(E=>r.createElement(Ae.MenuItem,{key:E,onClick:()=>h(E)},E))))))};Yl.propTypes={displayedFields:xe.PropTypes.array.isRequired,listRemainingFields:xe.PropTypes.array.isRequired,metadatas:xe.PropTypes.objectOf(xe.PropTypes.shape({list:xe.PropTypes.shape({label:xe.PropTypes.string})})).isRequired,onAddField:xe.PropTypes.func.isRequired,onClickEditField:xe.PropTypes.func.isRequired,onMoveField:xe.PropTypes.func.isRequired,onRemoveField:xe.PropTypes.func.isRequired};const Bv=Yl,Nv=(0,k.default)(j.Flex)`
|
|
1173
|
-
svg {
|
|
1174
|
-
width: ${32/16}rem;
|
|
1175
|
-
height: ${24/16}rem;
|
|
1176
|
-
margin-right: ${({theme:e})=>e.spaces[3]};
|
|
1177
|
-
}
|
|
1178
|
-
`,Jl=({attributes:e,fieldForm:t,fieldToEdit:n,onCloseModal:s,onChangeEditLabel:a,onSubmit:l,type:i})=>{const{formatMessage:u}=(0,A.useIntl)(),c=e[n].relationType;let d=!["media","relation"].includes(i);return["oneWay","oneToOne","manyToOne"].includes(c)&&(d=!0),r.createElement(Ze.ModalLayout,{onClose:s,labelledBy:"title"},r.createElement("form",{onSubmit:l},r.createElement(Ze.ModalHeader,null,r.createElement(Nv,null,r.createElement(zi,{type:i}),r.createElement(L.Typography,{fontWeight:"bold",textColor:"neutral800",as:"h2",id:"title"},u({id:v("containers.ListSettingsView.modal-form.edit-label"),defaultMessage:"Edit {fieldName}"},{fieldName:It()(n)})))),r.createElement(Ze.ModalBody,null,r.createElement(ie.Grid,{gap:4},r.createElement(ie.GridItem,{s:12,col:6},r.createElement(zn.TextInput,{id:"label-input",label:u({id:v("form.Input.label"),defaultMessage:"Label"}),name:"label",onChange:m=>a(m),value:t.label,hint:u({id:v("form.Input.label.inputDescription"),defaultMessage:"This value overrides the label displayed in the table's head"})})),d&&r.createElement(ie.GridItem,{s:12,col:6},r.createElement(xt.ToggleInput,{"data-testid":"Enable sort on this field",checked:t.sortable,label:u({id:v("form.Input.sort.field"),defaultMessage:"Enable sort on this field"}),name:"sortable",onChange:m=>a({target:{name:"sortable",value:m.target.checked}}),onLabel:u({id:"app.components.ToggleCheckbox.on-label",defaultMessage:"on"}),offLabel:u({id:"app.components.ToggleCheckbox.off-label",defaultMessage:"off"})})))),r.createElement(Ze.ModalFooter,{startActions:r.createElement(ye.Button,{onClick:s,variant:"tertiary"},u({id:"app.components.Button.cancel",defaultMessage:"Cancel"})),endActions:r.createElement(ye.Button,{type:"submit"},u({id:"global.finish",defaultMessage:"Finish"}))})))};Jl.propTypes={attributes:o().objectOf(o().shape({relationType:o().string})).isRequired,fieldForm:o().shape({label:o().string,sortable:o().bool}).isRequired,fieldToEdit:o().string.isRequired,onChangeEditLabel:o().func.isRequired,onCloseModal:o().func.isRequired,onSubmit:o().func.isRequired,type:o().string.isRequired};const Vv=Jl;var qv=Object.defineProperty,Wv=Object.defineProperties,zv=Object.getOwnPropertyDescriptors,Xl=Object.getOwnPropertySymbols,Uv=Object.prototype.hasOwnProperty,Hv=Object.prototype.propertyIsEnumerable,ec=(e,t,n)=>t in e?qv(e,t,{enumerable:!0,configurable:!0,writable:!0,value:n}):e[t]=n,Gv=(e,t)=>{for(var n in t||(t={}))Uv.call(t,n)&&ec(e,n,t[n]);if(Xl)for(var n of Xl(t))Hv.call(t,n)&&ec(e,n,t[n]);return e},Zv=(e,t)=>Wv(e,zv(t));const _v=(e,t)=>Zv(Gv({},e),{initialData:t,modifiedData:t}),Qr={fieldForm:{},fieldToEdit:"",initialData:{},modifiedData:{}},Qv=(e=Qr,t)=>(0,qt.default)(e,n=>{const s=["modifiedData","layouts","list"];switch(t.type){case"ADD_FIELD":{const a=M()(e,s,[]);ne()(n,s,[...a,t.item]);break}case"MOVE_FIELD":{const a=M()(e,s,[]),{originalIndex:l,atIndex:i}=t;ne()(n,s,vt(a,l,i));break}case"ON_CHANGE":{ne()(n,["modifiedData",...t.keys.split(".")],t.value);break}case"ON_CHANGE_FIELD_METAS":{ne()(n,["fieldForm",t.name],t.value);break}case"REMOVE_FIELD":{const a=M()(e,s,[]);ne()(n,s,a.filter((l,i)=>t.index!==i));break}case"SET_FIELD_TO_EDIT":{const{fieldToEdit:a}=t;n.fieldToEdit=a,n.fieldForm.label=M()(n,["modifiedData","metadatas",a,"list","label"],""),n.fieldForm.sortable=M()(n,["modifiedData","metadatas",a,"list","sortable"],"");break}case"UNSET_FIELD_TO_EDIT":{n.fieldForm={},n.fieldToEdit="";break}case"SUBMIT_FIELD_FORM":{const a=["modifiedData","metadatas",e.fieldToEdit,"list"];ne()(n,[...a,"label"],e.fieldForm.label),ne()(n,[...a,"sortable"],e.fieldForm.sortable);break}default:return n}}),Kv=["media","richtext","dynamiczone","relation","component","json"];var Yv=(e,t,n)=>new Promise((s,a)=>{var l=c=>{try{u(n.next(c))}catch(d){a(d)}},i=c=>{try{u(n.throw(c))}catch(d){a(d)}},u=c=>c.done?s(c.value):Promise.resolve(c.value).then(l,i);u((n=n.apply(e,t)).next())});const tc=({layout:e,slug:t})=>{const{formatMessage:n}=(0,A.useIntl)(),{trackUsage:s}=(0,y.useTracking)(),a=Zo(),l=(0,y.useNotification)(),{refetchData:i}=(0,r.useContext)(lo),[u,c]=(0,r.useState)(!1),d=()=>c(w=>!w),[m,f]=(0,r.useState)(!1),g=()=>f(w=>!w),[h,b]=(0,r.useReducer)(Qv,Qr,()=>_v(Qr,e)),{fieldToEdit:E,fieldForm:x,initialData:P,modifiedData:C}=h,{attributes:S}=e,I=C.layouts.list,W=()=>{const{settings:{pageSize:w,defaultSortBy:O,defaultSortOrder:_},kind:re,uid:ue}=P,me=`${O}:${_}`,Fe=`${(0,Ne.stringify)({page:1,pageSize:w,sort:me},{encode:!1})}${a?`&${a}`:""}`;return`/content-manager/${re}/${ue}?${Fe}`},R=({target:{name:w,value:O}})=>{b({type:"ON_CHANGE",keys:w,value:w==="settings.pageSize"?parseInt(O,10):O})},B=()=>Yv(void 0,null,function*(){const w=Mi()(C,["layouts","settings","metadatas"]);$.mutate(w)}),U=w=>{b({type:"ADD_FIELD",item:w})},Z=(w,O)=>{w.stopPropagation(),I.length===1?l({type:"info",message:{id:v("notification.info.minimumFields")}}):b({type:"REMOVE_FIELD",index:O})},q=w=>{w.preventDefault(),d(),s("willSaveContentTypeLayout")},G=w=>{b({type:"SET_FIELD_TO_EDIT",fieldToEdit:w}),g()},F=()=>{b({type:"UNSET_FIELD_TO_EDIT"}),g()},Q=w=>{w.preventDefault(),g(),b({type:"SUBMIT_FIELD_FORM"})},$=(0,Tr.useMutation)(w=>xv(w,t),{onSuccess(){s("didEditListSettings"),i()},onError(){l({type:"warning",message:{id:"notification.error"}})}}),{isLoading:Y}=$,T=({target:{name:w,value:O}})=>{b({type:"ON_CHANGE_FIELD_METAS",name:w,value:O})},z=Object.entries(S).reduce((w,O)=>{const[_,re]=O,ue=fo(re),me=I.includes(_);return ue&&!me&&w.push(_),w},[]).sort(),K=Object.entries(S).reduce((w,O)=>{const[_,{type:re}]=O;return Kv.includes(re)||w.push(_),w},[]),N=(w,O)=>{b({type:"MOVE_FIELD",originalIndex:w,atIndex:O})};return r.createElement(X.Layout,null,r.createElement(oe.Main,{"aria-busy":Y},r.createElement("form",{onSubmit:q},r.createElement(X.HeaderLayout,{navigationAction:r.createElement(y.Link,{startIcon:r.createElement(rn(),null),to:W,id:"go-back"},n({id:"global.back",defaultMessage:"Back"})),primaryAction:r.createElement(ye.Button,{size:"L",startIcon:r.createElement(ft(),null),disabled:Xt()(C,P),type:"submit"},n({id:"global.save",defaultMessage:"Save"})),subtitle:n({id:v("components.SettingsViewWrapper.pluginHeader.description.list-settings"),defaultMessage:"Define the settings of the list view."}),title:n({id:v("components.SettingsViewWrapper.pluginHeader.title"),defaultMessage:"Configure the view - {name}"},{name:It()(C.info.displayName)})}),r.createElement(X.ContentLayout,null,r.createElement(D.Box,{background:"neutral0",hasRadius:!0,shadow:"tableShadow",paddingTop:6,paddingBottom:6,paddingLeft:7,paddingRight:7},r.createElement(Lv,{modifiedData:C,onChange:R,sortOptions:K}),r.createElement(D.Box,{paddingTop:6,paddingBottom:6},r.createElement(Ut.Divider,null)),r.createElement(Bv,{listRemainingFields:z,displayedFields:I,onAddField:U,onClickEditField:G,onMoveField:N,onRemoveField:Z,metadatas:C.metadatas}))),r.createElement(y.ConfirmDialog,{bodyText:{id:v("popUpWarning.warning.updateAllSettings"),defaultMessage:"This will modify all your settings"},iconRightButton:r.createElement(ft(),null),isConfirmButtonLoading:Y,isOpen:u,onToggleDialog:d,onConfirm:B,variantRightButton:"success-light"})),m&&r.createElement(Vv,{attributes:S,fieldForm:x,fieldToEdit:E,onChangeEditLabel:T,onCloseModal:F,onSubmit:Q,type:M()(S,[E,"type"],"text")})))};tc.propTypes={layout:o().shape({uid:o().string.isRequired,settings:o().shape({bulkable:o().bool,defaultSortBy:o().string,defaultSortOrder:o().string,filterable:o().bool,pageSize:o().number,searchable:o().bool}).isRequired,metadatas:o().object.isRequired,options:o().object.isRequired,attributes:o().objectOf(o().shape({type:o().string})).isRequired}).isRequired,slug:o().string.isRequired};const Jv=(0,r.memo)(tc),nc=De.Z.contentManager,rc=({match:{params:{slug:e},url:t}})=>{const{isLoading:n,layout:s,updateLayout:a}=qo(e),{rawContentTypeLayout:l,rawComponentsLayouts:i}=(0,r.useMemo)(()=>{let m={},f={};return s.contentType&&(m=Nt(s.contentType)),s.components&&(f=Object.keys(s.components).reduce((g,h)=>(g[h]=Nt(s.components[h]),g),{})),{rawContentTypeLayout:m,rawComponentsLayouts:f}},[s]);if((0,V.get)(s,["contentType","uid"],null)!==e||n)return r.createElement(y.LoadingIndicatorPage,null);const c=({location:{state:m},history:{goBack:f},match:{params:{id:g,origin:h}}},b)=>r.createElement(b,{slug:e,layout:s,state:m,goBack:f,id:g,origin:h}),d=[{path:"create/clone/:origin",comp:sn},{path:"create",comp:sn},{path:":id",comp:sn},{path:"",comp:Dv}].map(({path:m,comp:f})=>r.createElement(ee.Route,{key:m,path:`${t}/${m}`,render:g=>c(g,f)}));return r.createElement(xc.SV,{FallbackComponent:y.ErrorFallback},r.createElement(co.Provider,{value:s},r.createElement(ee.Switch,null,r.createElement(ee.Route,{path:`${t}/configurations/list`},r.createElement(y.CheckPagePermissions,{permissions:nc.collectionTypesConfigurations},r.createElement(Jv,{layout:l,slug:e,updateLayout:a}))),r.createElement(ee.Route,{path:`${t}/configurations/edit`},r.createElement(y.CheckPagePermissions,{permissions:nc.collectionTypesConfigurations},r.createElement($r,{components:i,isContentTypeView:!0,mainLayout:l,slug:e,updateLayout:a}))),d)))};rc.propTypes={match:o().shape({url:o().string.isRequired,params:o().shape({slug:o().string.isRequired}).isRequired}).isRequired};const Xv=(0,r.memo)(rc);var oc=p(57678),eC=p(98399),tC=(e,t,n)=>new Promise((s,a)=>{var l=c=>{try{u(n.next(c))}catch(d){a(d)}},i=c=>{try{u(n.throw(c))}catch(d){a(d)}},u=c=>c.done?s(c.value):Promise.resolve(c.value).then(l,i);u((n=n.apply(e,t)).next())});const nC=De.Z.contentManager,rC=()=>{const[{isLoading:e,data:t},n]=(0,r.useReducer)(oc.Z,oc.q),s=(0,r.useMemo)(Rn,[]),{schemas:a}=(0,fe.useSelector)(i=>s(i),fe.shallowEqual),{uid:l}=(0,ee.useParams)();return(0,r.useEffect)(()=>{const u=Se().CancelToken.source();return(d=>tC(void 0,null,function*(){try{n(Jt());const{data:{data:m}}=yield ge.be.get(ve(`components/${l}/configuration`),{cancelToken:d.token});n(gr(To(m,a,"component")))}catch(m){if(Se().isCancel(m))return;eC.error(m)}}))(u),()=>{u.cancel("Operation canceled by the user.")}},[l,a]),e?r.createElement(y.LoadingIndicatorPage,null):r.createElement(y.CheckPagePermissions,{permissions:nC.componentsConfigurations},r.createElement($r,{components:t.components,mainLayout:t.component,slug:l}))},oC=(0,r.memo)(rC);var sC=p(64354),aC=p(97042),iC=p.n(aC);const lC=()=>{const{formatMessage:e}=(0,A.useIntl)();return(0,y.useFocusWhenNavigate)(),r.createElement(oe.Main,null,r.createElement(X.HeaderLayout,{title:e({id:v("header.name"),defaultMessage:"Content"})}),r.createElement(X.ContentLayout,null,r.createElement(sC.EmptyStateLayout,{action:r.createElement(y.LinkButton,{variant:"secondary",startIcon:r.createElement(ut(),null),to:"/plugins/content-type-builder/content-types/create-content-type"},e({id:"app.components.HomePage.create",defaultMessage:"Create your first Content-type"})),content:e({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:r.createElement(iC(),{width:"10rem"}),shadow:"tableShadow"})))},cC=()=>{const{formatMessage:e}=(0,A.useIntl)();return(0,y.useFocusWhenNavigate)(),r.createElement(oe.Main,null,r.createElement(X.HeaderLayout,{title:e({id:v("header.name"),defaultMessage:"Content"})}),r.createElement(X.ContentLayout,null,r.createElement(y.NoPermissions,null)))},uC=De.Z.contentManager,sc=({match:{params:{slug:e},url:t}})=>{const{isLoading:n,layout:s,updateLayout:a}=qo(e),{rawContentTypeLayout:l,rawComponentsLayouts:i}=(0,r.useMemo)(()=>{let u={},c={};return s.contentType&&(c=Nt(s.contentType)),s.components&&(u=Object.keys(s.components).reduce((d,m)=>(d[m]=Nt(s.components[m]),d),{})),{rawContentTypeLayout:c,rawComponentsLayouts:u}},[s]);return n?r.createElement(y.LoadingIndicatorPage,null):r.createElement(co.Provider,{value:s},r.createElement(ee.Switch,null,r.createElement(ee.Route,{path:`${t}/configurations/edit`},r.createElement(y.CheckPagePermissions,{permissions:uC.singleTypesConfigurations},r.createElement($r,{components:i,isContentTypeView:!0,mainLayout:l,slug:e,updateLayout:a}))),r.createElement(ee.Route,{path:t,render:({location:{state:u},history:{goBack:c}})=>r.createElement(sn,{layout:s,slug:e,isSingleType:!0,state:u,goBack:c})})))};sc.propTypes={match:o().shape({url:o().string.isRequired,params:o().shape({slug:o().string.isRequired}).isRequired}).isRequired};const dC=(0,r.memo)(sc);var pC=p(58469),mC=p(59578),ac=p.n(mC),kt=p(89420),fC=Object.defineProperty,gC=Object.defineProperties,yC=Object.getOwnPropertyDescriptors,ic=Object.getOwnPropertySymbols,hC=Object.prototype.hasOwnProperty,bC=Object.prototype.propertyIsEnumerable,lc=(e,t,n)=>t in e?fC(e,t,{enumerable:!0,configurable:!0,writable:!0,value:n}):e[t]=n,EC=(e,t)=>{for(var n in t||(t={}))hC.call(t,n)&&lc(e,n,t[n]);if(ic)for(var n of ic(t))bC.call(t,n)&&lc(e,n,t[n]);return e},vC=(e,t)=>gC(e,yC(t));const cc=(e,t)=>(0,pC.ZP)(e,ac()(t),{keys:[n=>ac()(n.title)]}),CC=()=>{const[e,t]=(0,r.useState)(""),{formatMessage:n}=(0,A.useIntl)(),s=(0,r.useMemo)(Mu,[]),{collectionTypeLinks:a,singleTypeLinks:l}=(0,fe.useSelector)(h=>s(h),fe.shallowEqual),i=h=>h.map(b=>vC(EC({},b),{title:n({id:b.title,defaultMessage:b.title})})),u=i(a),c=i(l),d=[{id:"collectionTypes",title:{id:v("components.LeftMenu.collection-types"),defaultMessage:"Collection Types"},searchable:!0,links:ae()(cc(u,e),h=>h.title.toLowerCase())},{id:"singleTypes",title:{id:v("components.LeftMenu.single-types"),defaultMessage:"Single Types"},searchable:!0,links:ae()(cc(c,e),h=>h.title.toLowerCase())}],m=()=>{t("")},f=({target:{value:h}})=>{t(h)},g=n({id:v("header.name"),defaultMessage:"Content"});return r.createElement(kt.SubNav,{ariaLabel:g},r.createElement(kt.SubNavHeader,{label:g,searchable:!0,value:e,onChange:f,onClear:m,searchLabel:n({id:"content-manager.components.LeftMenu.Search.label",defaultMessage:"Search for a content type"})}),r.createElement(kt.SubNavSections,null,d.map(h=>{const b=n({id:h.title.id,defaultMessage:h.title.defaultMessage},h.title.values);return r.createElement(kt.SubNavSection,{key:h.id,label:b,badgeLabel:h.links.length.toString()},h.links.map(E=>{const x=E.search?`?${E.search}`:"";return r.createElement(kt.SubNavLink,{as:ee.NavLink,key:E.uid,to:`${E.to}${x}`},E.title)}))})))};var Kr=p(92886);const PC=()=>({type:Kr.ZA}),OC=()=>({type:Kr.c2}),RC=(e,t,n,s)=>({type:Kr.ix,data:{authorizedCtLinks:e,authorizedStLinks:t,components:s,contentTypeSchemas:n}}),uc=(e,t,n=[])=>e.filter(s=>s.isDisplayed).map(s=>{const a=[{action:"plugin::content-manager.explorer.create",subject:s.uid},{action:"plugin::content-manager.explorer.read",subject:s.uid}],l=[{action:"plugin::content-manager.explorer.read",subject:s.uid}],i=t==="collectionTypes"?a:l,u=n.find(({uid:d})=>d===s.uid);let c=null;if(u){const d={page:1,pageSize:u.settings.pageSize,sort:`${u.settings.defaultSortBy}:${u.settings.defaultSortOrder}`};c=(0,Ne.stringify)(d,{encode:!1})}return{permissions:i,search:c,kind:s.kind,title:s.info.displayName,to:`/content-manager/${s.kind}/${s.uid}`,uid:s.uid,name:s.uid,isDisplayed:s.isDisplayed}}),MC=(e,t)=>{const[n,s]=(0,V.chain)(e).groupBy("kind").map((a,l)=>({name:l,links:a})).sortBy("name").value();return{collectionTypesSectionLinks:uc((0,V.get)(n,"links",[]),"collectionTypes",t),singleTypesSectionLinks:uc((0,V.get)(s,"links",[]),"singleTypes")}},dc=(e,t)=>t.map(({permissions:n})=>(0,y.hasPermissions)(e,n));var TC=p(98399),wC=(e,t,n)=>new Promise((s,a)=>{var l=c=>{try{u(n.next(c))}catch(d){a(d)}},i=c=>{try{u(n.throw(c))}catch(d){a(d)}},u=c=>c.done?s(c.value):Promise.resolve(c.value).then(l,i);u((n=n.apply(e,t)).next())});const IC=(e,t,n)=>wC(void 0,null,function*(){try{const{data:{data:s}}=yield ge.be.get(ve("content-types-settings")),{collectionTypesSectionLinks:a,singleTypesSectionLinks:l}=MC(e,s),i=dc(t,a),u=yield Promise.all(i),c=a.filter((g,h)=>u[h]),d=dc(t,l),m=yield Promise.all(d),f=l.filter((g,h)=>m[h]);return{authorizedCtLinks:c,authorizedStLinks:f}}catch(s){return TC.error(s),n({type:"warning",message:{id:"notification.error"}}),{authorizedCtLinks:[],authorizedStLinks:[],contentTypes:[]}}});var DC=p(98399),xC=Object.defineProperty,SC=Object.defineProperties,LC=Object.getOwnPropertyDescriptors,pc=Object.getOwnPropertySymbols,FC=Object.prototype.hasOwnProperty,kC=Object.prototype.propertyIsEnumerable,mc=(e,t,n)=>t in e?xC(e,t,{enumerable:!0,configurable:!0,writable:!0,value:n}):e[t]=n,AC=(e,t)=>{for(var n in t||(t={}))FC.call(t,n)&&mc(e,n,t[n]);if(pc)for(var n of pc(t))kC.call(t,n)&&mc(e,n,t[n]);return e},jC=(e,t)=>SC(e,LC(t)),$C=(e,t,n)=>new Promise((s,a)=>{var l=c=>{try{u(n.next(c))}catch(d){a(d)}},i=c=>{try{u(n.throw(c))}catch(d){a(d)}},u=c=>c.done?s(c.value):Promise.resolve(c.value).then(l,i);u((n=n.apply(e,t)).next())});const BC=()=>{const e=(0,fe.useDispatch)(),t=(0,y.useNotification)(),n=(0,fe.useSelector)(Rt()),s=(0,r.useRef)(),{allPermissions:a}=(0,y.useRBACProvider)(),{runHookWaterfall:l}=(0,y.useStrapiApp)(),u=Se().CancelToken.source(),{notifyStatus:c}=(0,Nr.useNotifyAT)(),{formatMessage:d}=(0,A.useIntl)(),m=()=>$C(void 0,null,function*(){e(PC());try{const[{data:{data:f}},{data:{data:g}}]=yield Promise.all(["components","content-types"].map(C=>ge.be.get(ve(C),{cancelToken:u.token})));c(d({id:v("App.schemas.data-loaded"),defaultMessage:"The schemas have been successfully loaded."}));const{authorizedCtLinks:h,authorizedStLinks:b}=yield IC(g,a,t),{ctLinks:E}=l(zt.LK,{ctLinks:h,models:g}),{stLinks:x}=l(zt.dV,{stLinks:b,models:g}),P=RC(E,x,g,f);e(P)}catch(f){if(Se().isCancel(f))return;DC.error(f),t({type:"warning",message:{id:"notification.error"}})}});return s.current=m,(0,r.useEffect)(()=>(s.current(),()=>{u.cancel("Operation canceled by the user."),e(OC())}),[e,t]),jC(AC({},n),{refetchData:s.current})},NC=De.Z.contentManager,fc=()=>{const e=(0,ee.useRouteMatch)("/content-manager/:kind/:uid"),{status:t,collectionTypeLinks:n,singleTypeLinks:s,models:a,refetchData:l}=BC(),i=ae()([...n,...s],g=>g.title.toLowerCase()),{pathname:u}=(0,ee.useLocation)(),{formatMessage:c}=(0,A.useIntl)(),{startSection:d}=(0,y.useGuidedTour)(),m=(0,r.useRef)(d);if((0,r.useEffect)(()=>{m.current&&m.current("contentManager")},[]),t==="loading")return r.createElement(oe.Main,{"aria-busy":"true"},r.createElement(X.HeaderLayout,{title:c({id:v("header.name"),defaultMessage:"Content"})}),r.createElement(y.LoadingIndicatorPage,null));const f=a.filter(({isDisplayed:g})=>g);return i.length===0&&f.length>0&&u!=="/content-manager/403"?r.createElement(ee.Redirect,{to:"/content-manager/403"}):f.length===0&&u!=="/content-manager/no-content-types"?r.createElement(ee.Redirect,{to:"/content-manager/no-content-types"}):!e&&i.length>0?r.createElement(ee.Redirect,{to:`${i[0].to}${i[0].search?`?${i[0].search}`:""}`}):r.createElement(X.Layout,{sideNav:r.createElement(CC,null)},r.createElement(Dc,null),r.createElement(lo.Provider,{value:{refetchData:l}},r.createElement(ee.Switch,null,r.createElement(ee.Route,{path:"/content-manager/components/:uid/configurations/edit"},r.createElement(y.CheckPagePermissions,{permissions:NC.componentsConfigurations},r.createElement(oC,null))),r.createElement(ee.Route,{path:"/content-manager/collectionType/:slug",component:Xv}),r.createElement(ee.Route,{path:"/content-manager/singleType/:slug",component:dC}),r.createElement(ee.Route,{path:"/content-manager/403"},r.createElement(cC,null)),r.createElement(ee.Route,{path:"/content-manager/no-content-types"},r.createElement(lC,null)),r.createElement(ee.Route,{path:"",component:y.NotFound}))))};function VC(){const{formatMessage:e}=(0,A.useIntl)();return r.createElement(r.Fragment,null,r.createElement(at.Helmet,{title:e({id:v("plugin.name"),defaultMessage:"Content Manager"})}),r.createElement(fc,null))}},57544:()=>{},59599:()=>{},42310:()=>{},33842:()=>{},85695:()=>{}}]);
|