@strapi/admin 4.4.3 → 4.5.0-beta.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/content-manager/components/CollectionTypeFormWrapper/index.js +35 -1
- package/admin/src/content-manager/components/DynamicTable/CellContent/RelationMultiple/index.js +11 -7
- package/admin/src/content-manager/components/DynamicTable/CellContent/index.js +6 -5
- package/admin/src/content-manager/components/DynamicTable/TableRows/index.js +5 -0
- package/admin/src/content-manager/components/DynamicTable/index.js +1 -1
- package/admin/src/content-manager/components/EditViewDataManagerProvider/index.js +73 -20
- package/admin/src/content-manager/components/EditViewDataManagerProvider/reducer.js +166 -26
- package/admin/src/content-manager/components/EditViewDataManagerProvider/utils/cleanData.js +17 -1
- package/admin/src/content-manager/components/Inputs/index.js +12 -4
- package/admin/src/content-manager/components/NonRepeatableComponent/index.js +2 -0
- package/admin/src/content-manager/components/RelationInput/RelationInput.js +427 -0
- package/admin/src/content-manager/components/{SelectWrapper → RelationInput/components}/Option.js +15 -25
- package/admin/src/content-manager/components/RelationInput/components/Relation.js +48 -0
- package/admin/src/content-manager/components/RelationInput/components/RelationItem.js +52 -0
- package/admin/src/content-manager/components/RelationInput/components/RelationList.js +52 -0
- package/admin/src/content-manager/components/RelationInput/constants.js +1 -0
- package/admin/src/content-manager/components/RelationInput/index.js +1 -0
- package/admin/src/content-manager/components/RelationInputDataManager/RelationInputDataManager.js +261 -0
- package/admin/src/content-manager/components/RelationInputDataManager/constants.js +8 -0
- package/admin/src/content-manager/components/RelationInputDataManager/index.js +1 -0
- package/admin/src/content-manager/components/{SelectWrapper → RelationInputDataManager}/utils/connect.js +0 -1
- package/admin/src/content-manager/components/RelationInputDataManager/utils/getRelationLink.js +5 -0
- package/admin/src/content-manager/components/RelationInputDataManager/utils/index.js +4 -0
- package/admin/src/content-manager/components/RelationInputDataManager/utils/normalizeRelations.js +65 -0
- package/admin/src/content-manager/components/RelationInputDataManager/utils/normalizeSearchResults.js +12 -0
- package/admin/src/content-manager/components/RelationInputDataManager/utils/select.js +98 -0
- package/admin/src/content-manager/components/RepeatableComponent/DraggedItem/index.js +5 -0
- package/admin/src/content-manager/components/SingleTypeFormWrapper/index.js +42 -2
- package/admin/src/content-manager/hooks/useFetchContentTypeLayout/utils/formatLayouts.js +7 -69
- package/admin/src/content-manager/hooks/useRelation/index.js +1 -0
- package/admin/src/content-manager/hooks/useRelation/useRelation.js +81 -0
- package/admin/src/content-manager/pages/EditSettingsView/components/DisplayedFields.js +4 -4
- package/admin/src/content-manager/pages/EditSettingsView/index.js +21 -49
- package/admin/src/content-manager/pages/EditSettingsView/reducer.js +0 -25
- package/admin/src/content-manager/pages/EditView/Header/index.js +121 -140
- package/admin/src/content-manager/pages/EditView/Header/utils/index.js +0 -1
- package/admin/src/content-manager/pages/EditView/Header/utils/select.js +4 -2
- package/admin/src/content-manager/pages/EditView/index.js +12 -65
- package/admin/src/content-manager/pages/ListView/FieldPicker/index.js +0 -1
- package/admin/src/content-manager/pages/ListView/index.js +0 -1
- package/admin/src/content-manager/pages/ListViewLayoutManager/index.js +0 -1
- package/admin/src/content-manager/utils/formatLayoutToApi.js +1 -3
- package/admin/src/pages/HomePage/SocialLinks.js +1 -1
- package/admin/src/translations/ar.json +0 -1
- package/admin/src/translations/ca.json +1 -8
- package/admin/src/translations/cs.json +0 -2
- package/admin/src/translations/de.json +4 -12
- package/admin/src/translations/dk.json +3 -11
- package/admin/src/translations/en.json +4 -11
- package/admin/src/translations/es.json +156 -168
- package/admin/src/translations/fr.json +3 -11
- package/admin/src/translations/gu.json +608 -617
- package/admin/src/translations/hi.json +689 -698
- package/admin/src/translations/hu.json +2 -10
- package/admin/src/translations/id.json +2 -10
- package/admin/src/translations/it.json +2 -10
- package/admin/src/translations/ja.json +2 -11
- package/admin/src/translations/ko.json +2 -11
- package/admin/src/translations/ml.json +689 -698
- package/admin/src/translations/ms.json +0 -2
- package/admin/src/translations/nl.json +3 -11
- package/admin/src/translations/pl.json +2 -11
- package/admin/src/translations/pt-BR.json +3 -11
- package/admin/src/translations/pt.json +0 -1
- package/admin/src/translations/ru.json +489 -501
- package/admin/src/translations/sa.json +85 -93
- package/admin/src/translations/sk.json +3 -10
- package/admin/src/translations/sv.json +3 -9
- package/admin/src/translations/th.json +0 -2
- package/admin/src/translations/tr.json +0 -1
- package/admin/src/translations/uk.json +0 -2
- package/admin/src/translations/vi.json +0 -1
- package/admin/src/translations/zh-Hans.json +4 -13
- package/admin/src/translations/zh.json +3 -11
- package/build/{8773.51992277.chunk.js → 1939.e3c87653.chunk.js} +50 -50
- package/build/8738.a30a2160.chunk.js +461 -0
- package/build/962.8651ba3f.chunk.js +184 -0
- package/build/Admin-authenticatedApp.883449a5.chunk.js +80 -0
- package/build/{Admin_homePage.6d5e3236.chunk.js → Admin_homePage.4b2be829.chunk.js} +1 -1
- package/build/{ar-json.d4cb26d9.chunk.js → ar-json.3489463d.chunk.js} +1 -1
- package/build/{ca-json.d16c1d28.chunk.js → ca-json.82df6eab.chunk.js} +1 -1
- package/build/content-manager.933dc286.chunk.js +1201 -0
- package/build/{cs-json.c8f28ba8.chunk.js → cs-json.ce49da5c.chunk.js} +1 -1
- package/build/{de-json.a9b514dc.chunk.js → de-json.0ad554eb.chunk.js} +1 -1
- package/build/{dk-json.09e8d145.chunk.js → dk-json.e195ea1a.chunk.js} +1 -1
- package/build/{en-json.e936d40e.chunk.js → en-json.1889403c.chunk.js} +1 -1
- package/build/{es-json.3a9c7c09.chunk.js → es-json.09f80f6e.chunk.js} +1 -1
- package/build/{fr-json.4ed1fc2c.chunk.js → fr-json.606d056b.chunk.js} +1 -1
- package/build/{gu-json.d8311297.chunk.js → gu-json.9881264f.chunk.js} +1 -1
- package/build/{hi-json.0edb8d29.chunk.js → hi-json.83dcf48f.chunk.js} +1 -1
- package/build/{hu-json.7855529a.chunk.js → hu-json.6f328bce.chunk.js} +1 -1
- package/build/{id-json.df9618f2.chunk.js → id-json.1f3c4303.chunk.js} +1 -1
- package/build/index.html +1 -1
- package/build/{it-json.a21bf078.chunk.js → it-json.494ac432.chunk.js} +1 -1
- package/build/{ja-json.7b0d9067.chunk.js → ja-json.6f262117.chunk.js} +1 -1
- package/build/{ko-json.983c1f8f.chunk.js → ko-json.36dc3b9a.chunk.js} +1 -1
- package/build/main.63e7ea0a.js +9338 -0
- package/build/{ml-json.8dd021c8.chunk.js → ml-json.9566bf9a.chunk.js} +1 -1
- package/build/{ms-json.836ed013.chunk.js → ms-json.ed51e902.chunk.js} +1 -1
- package/build/{nl-json.29d2eb37.chunk.js → nl-json.94c3a289.chunk.js} +1 -1
- package/build/{pl-json.1f04f00c.chunk.js → pl-json.ccc6ef23.chunk.js} +1 -1
- package/build/{pt-BR-json.b4bc8efe.chunk.js → pt-BR-json.744f024d.chunk.js} +1 -1
- package/build/{pt-json.c23020ab.chunk.js → pt-json.3161ca22.chunk.js} +1 -1
- package/build/{ru-json.7ab40ccf.chunk.js → ru-json.d22ea13c.chunk.js} +1 -1
- package/build/{runtime~main.7faf633a.js → runtime~main.3a5e1b07.js} +1 -1
- package/build/{sa-json.c5a9f4ea.chunk.js → sa-json.8fb1c04d.chunk.js} +1 -1
- package/build/{sk-json.e4c24c4e.chunk.js → sk-json.6c7335d4.chunk.js} +1 -1
- package/build/{sv-json.c3f471ae.chunk.js → sv-json.2e589a7d.chunk.js} +1 -1
- package/build/{th-json.a59ffb32.chunk.js → th-json.72e8de3d.chunk.js} +1 -1
- package/build/{tr-json.276e59fe.chunk.js → tr-json.9c44ea0c.chunk.js} +1 -1
- package/build/{uk-json.5b5b9c27.chunk.js → uk-json.c4cd2e24.chunk.js} +1 -1
- package/build/{upload-translation-en-json.004a86c1.chunk.js → upload-translation-en-json.86da7b0a.chunk.js} +1 -1
- package/build/{vi-json.bf3424be.chunk.js → vi-json.f7890025.chunk.js} +1 -1
- package/build/{zh-Hans-json.9c99f8d4.chunk.js → zh-Hans-json.a4d7dc69.chunk.js} +1 -1
- package/build/{zh-json.451a0271.chunk.js → zh-json.66aa2ae1.chunk.js} +1 -1
- package/package.json +7 -7
- package/admin/src/content-manager/components/SelectMany/ListItem.js +0 -102
- package/admin/src/content-manager/components/SelectMany/index.js +0 -148
- package/admin/src/content-manager/components/SelectOne/SingleValue.js +0 -67
- package/admin/src/content-manager/components/SelectOne/index.js +0 -97
- package/admin/src/content-manager/components/SelectWrapper/Label.js +0 -60
- package/admin/src/content-manager/components/SelectWrapper/index.js +0 -356
- package/admin/src/content-manager/components/SelectWrapper/utils/index.js +0 -2
- package/admin/src/content-manager/components/SelectWrapper/utils/select.js +0 -45
- package/admin/src/content-manager/pages/EditSettingsView/components/RelationalFieldButton.js +0 -135
- package/admin/src/content-manager/pages/EditSettingsView/components/RelationalFields.js +0 -103
- package/admin/src/content-manager/pages/EditView/Header/utils/getDraftRelations.js +0 -62
- package/build/1669.d1b29c28.chunk.js +0 -1
- package/build/524.8a540ac1.chunk.js +0 -644
- package/build/Admin-authenticatedApp.88fa40ac.chunk.js +0 -80
- package/build/content-manager.8bddf2e6.chunk.js +0 -1178
- package/build/main.6650d2e7.js +0 -9338
|
@@ -1,1178 +0,0 @@
|
|
|
1
|
-
(self.webpackChunk_strapi_admin=self.webpackChunk_strapi_admin||[]).push([[994],{37475:(bc,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(g,te,oe,A,Ee,ie,De){var me=ie.length-1;switch(Ee){case 1:this.$=g.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(g);break;case 3:this.$=null;break;case 4:this.$=!0;break;case 5:this.$=!1;break;case 6:return this.$=ie[me-1];case 13:this.$={};break;case 14:this.$=ie[me-1];break;case 15:this.$=[ie[me-2],ie[me]];break;case 16:this.$={},this.$[ie[me][0]]=ie[me][1];break;case 17:this.$=ie[me-2],ie[me-2][ie[me][0]]=ie[me][1];break;case 18:this.$=[];break;case 19:this.$=ie[me-1];break;case 20:this.$=[ie[me]];break;case 21:this.$=ie[me-2],ie[me-2].push(ie[me]);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(g,te){throw new Error(g)},parse:function(g){var te=this,oe=[0],A=[null],Ee=[],ie=this.table,De="",me=0,v=0,Te=0,xe=2,o=1;this.lexer.setInput(g),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=te.lexer.lex()||1,typeof L!="number"&&(L=te.symbols_[L]||L),L}for(var Pe,Ye,we,Ie,oo,Et,Ve={},Je,Oe,k,D;;){we=oe[oe.length-1],this.defaultActions[we]?Ie=this.defaultActions[we]:(Pe==null&&(Pe=jt()),Ie=ie[we]&&ie[we][Pe]);e:if(typeof Ie=="undefined"||!Ie.length||!Ie[0]){if(!Te){D=[];for(Je in ie[we])this.terminals_[Je]&&Je>2&&D.push("'"+this.terminals_[Je]+"'");var j="";this.lexer.showPosition?j="Parse error on line "+(me+1)+`:
|
|
3
|
-
`+this.lexer.showPosition()+`
|
|
4
|
-
Expecting `+D.join(", ")+", got '"+this.terminals_[Pe]+"'":j="Parse error on line "+(me+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,me=this.lexer.yylineno,bt=this.lexer.yylloc,Pe=jt()}for(;!(xe.toString()in ie[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=ie[we]&&ie[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,me=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,me,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=ie[oe[oe.length-2]][oe[oe.length-1]],oe.push(k);break;case 3:return!0}}return!0}},at=function(){var X={EOF:1,parseError:function(te,oe){if(this.yy.parseError)this.yy.parseError(te,oe);else throw new Error(te)},setInput:function(g){return this._input=g,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 g=this._input[0];this.yytext+=g,this.yyleng++,this.match+=g,this.matched+=g;var te=g.match(/\n/);return te&&this.yylineno++,this._input=this._input.slice(1),g},unput:function(g){return this._input=g+this._input,this},more:function(){return this._more=!0,this},less:function(g){this._input=this.match.slice(g)+this._input},pastInput:function(){var g=this.matched.substr(0,this.matched.length-this.match.length);return(g.length>20?"...":"")+g.substr(-20).replace(/\n/g,"")},upcomingInput:function(){var g=this.match;return g.length<20&&(g+=this._input.substr(0,20-g.length)),(g.substr(0,20)+(g.length>20?"...":"")).replace(/\n/g,"")},showPosition:function(){var g=this.pastInput(),te=new Array(g.length+1).join("-");return g+this.upcomingInput()+`
|
|
5
|
-
`+te+"^"},next:function(){if(this.done)return this.EOF;this._input||(this.done=!0);var g,te,oe,A,Ee,ie;this._more||(this.yytext="",this.match="");for(var De=this._currentRules(),me=0;me<De.length&&(oe=this._input.match(this.rules[De[me]]),!(oe&&(!te||oe[0].length>te[0].length)&&(te=oe,A=me,!this.options.flex)));me++);if(te)return ie=te[0].match(/\n.*/g),ie&&(this.yylineno+=ie.length),this.yylloc={first_line:this.yylloc.last_line,last_line:this.yylineno+1,first_column:this.yylloc.last_column,last_column:ie?ie[ie.length-1].length-1:this.yylloc.last_column+te[0].length},this.yytext+=te[0],this.match+=te[0],this.yyleng=this.yytext.length,this._more=!1,this._input=this._input.slice(te[0].length),this.matched+=te[0],g=this.performAction.call(this,this.yy,this,De[A],this.conditionStack[this.conditionStack.length-1]),this.done&&this._input&&(this.done=!1),g||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 te=this.next();return typeof te!="undefined"?te:this.lex()},begin:function(te){this.conditionStack.push(te)},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(te){this.begin(te)}};return X.options={},X.performAction=function(te,oe,A,Ee){var ie=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"}},X.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)/,/^(?:$)/,/^(?:.)/],X.conditions={INITIAL:{rules:[0,1,2,3,4,5,6,7,8,9,10,11,12,13],inclusive:!0}},X}();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:(bc,st,p)=>{"use strict";p.r(st),p.d(st,{App:()=>yc,default:()=>VC});var r=p(32735),at=p(99357),X=p(5141),g=p(88425),te=p(11856),oe=p(16540),A=p(5636),Ee=p(98978),ie=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,oo=(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:y,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:oo({attributes:n,buttonData:s,goTo:l,layout:i,metadatas:u,moveItem:c,moveRow:d,onAddData:m,relationsLayout:f,removeField:y,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),Ec=p(76470),Be=p.n(Ec),vc=p(64198),Xe=p.n(vc),Cc=p(60672),so=p.n(Cc);const Pc=(0,k.default)(D.Box)`
|
|
7
|
-
border: 1px solid ${({theme:e})=>e.colors.neutral200};
|
|
8
|
-
`,Oc=(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
|
-
`,Rc=k.default.button`
|
|
24
|
-
border: none;
|
|
25
|
-
background: transparent;
|
|
26
|
-
display: block;
|
|
27
|
-
width: 100%;
|
|
28
|
-
text-align: unset;
|
|
29
|
-
padding: 0;
|
|
30
|
-
`,ao=({displayedValue:e})=>r.createElement(Pc,{paddingLeft:3,paddingRight:3,paddingTop:3,paddingBottom:3,hasRadius:!0,background:"neutral0",width:(0,g.pxToRem)(300)},r.createElement(j.Flex,{justifyContent:"space-between"},r.createElement(Rc,{type:"button"},r.createElement(j.Flex,null,r.createElement(Oc,{background:"neutral200"},r.createElement(so(),null)),r.createElement(D.Box,{paddingLeft:6,maxWidth:(0,g.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)}))))));ao.propTypes={displayedValue:o().string.isRequired};const Mc=ao;var se=p(90662),Tc=p(95717),it=p.n(Tc),wc=p(94009),io=p.n(wc);const lo=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
|
-
`,co=(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
|
-
`,Ic=(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
|
-
${co} {
|
|
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=lo(e);return r.createElement(Ic,{hasRadius:!0,justifyContent:"space-between",transparent:t,isSibling:n},r.createElement(se.Stack,{horizontal:!0,spacing:3},r.createElement(co,{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(io(),null))))};bn.defaultProps={isSibling:!1,transparent:!1},bn.propTypes={isSibling:o().bool,labelField:o().string.isRequired,transparent:o().bool};const En=bn,Dc={position:"fixed",pointerEvents:"none",zIndex:100,left:0,top:0,width:"100%",height:"100%"};function xc(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 Sc=()=>{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:Dc},r.createElement("div",{style:xc(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(Mc,{displayedValue:n.displayedValue})))):null},uo=(0,r.createContext)();var Lc=p(18522),N=p(92891);const po=(0,r.createContext)(),HC=(0,r.createContext)(),_C=null;var fe=p(4409);const mo=e=>e["content-manager_editViewLayoutManager"].currentLayout;var Fc=Object.defineProperty,kc=Object.defineProperties,Ac=Object.getOwnPropertyDescriptors,fo=Object.getOwnPropertySymbols,jc=Object.prototype.hasOwnProperty,$c=Object.prototype.propertyIsEnumerable,go=(e,t,n)=>t in e?Fc(e,t,{enumerable:!0,configurable:!0,writable:!0,value:n}):e[t]=n,Bc=(e,t)=>{for(var n in t||(t={}))jc.call(t,n)&&go(e,n,t[n]);if(fo)for(var n of fo(t))$c.call(t,n)&&go(e,n,t[n]);return e},Nc=(e,t)=>kc(e,Ac(t));const lt=()=>{const e=(0,fe.useSelector)(mo),t=(0,r.useCallback)(n=>(0,N.get)(e,["components",n],{}),[e]);return Nc(Bc({},e),{getComponentLayout:t})};var Vc=p(43653),Se=p.n(Vc),ge=p(17247),qc=p(99381),qe=p.n(qc);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},yo=e=>{const t=e.type;return t==="relation"?!(0,N.toLower)(e.relationType).includes("morph"):!["json","dynamiczone","richtext","password"].includes(t)&&!!t},ho=(e,t)=>Object.keys(e).reduce((n,s)=>{const a=(0,N.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,N.get)(t,[i,"attributes"],{}),y=ho(f,t);if(c===!0&&(n[s]=m===!0?[]:y),d&&m===!0&&c){n[s]=[];for(let h=0;h<d;h+=1)n[s].push(y)}}return u==="dynamiczone"&&c===!0&&(n[s]=[]),n},{}),$t=ho;var Wc=Object.defineProperty,zc=Object.defineProperties,Uc=Object.getOwnPropertyDescriptors,Bt=Object.getOwnPropertySymbols,bo=Object.prototype.hasOwnProperty,Eo=Object.prototype.propertyIsEnumerable,vo=(e,t,n)=>t in e?Wc(e,t,{enumerable:!0,configurable:!0,writable:!0,value:n}):e[t]=n,vn=(e,t)=>{for(var n in t||(t={}))bo.call(t,n)&&vo(e,n,t[n]);if(Bt)for(var n of Bt(t))Eo.call(t,n)&&vo(e,n,t[n]);return e},Cn=(e,t)=>zc(e,Uc(t)),Hc=(e,t)=>{var n={};for(var s in e)bo.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&&Eo.call(e,s)&&(n[s]=e[s]);return n};const Nt=e=>{var t=e,{layouts:n,metadatas:s}=t,a=Hc(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,N.get)(s,[m],{});let y=f.edit;return y.mainField&&(y=Cn(vn({},y),{mainField:f.edit.mainField.name})),Cn(vn({},d),{[m]:{edit:y,list:(0,N.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 _c=Object.defineProperty,Gc=Object.defineProperties,Zc=Object.getOwnPropertyDescriptors,Co=Object.getOwnPropertySymbols,Qc=Object.prototype.hasOwnProperty,Kc=Object.prototype.propertyIsEnumerable,Po=(e,t,n)=>t in e?_c(e,t,{enumerable:!0,configurable:!0,writable:!0,value:n}):e[t]=n,Yc=(e,t)=>{for(var n in t||(t={}))Qc.call(t,n)&&Po(e,n,t[n]);if(Co)for(var n of Co(t))Kc.call(t,n)&&Po(e,n,t[n]);return e},Jc=(e,t)=>Gc(e,Zc(t));const Xc=(e,t)=>e.map(n=>Jc(Yc({},n),{subject:t})),Oo=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]=Xc(t[s],e),n),{})},Ro=e=>e.split(".").filter(t=>(0,N.isNaN)(parseInt(t,10))),Mo=e=>e.length===0?-1:Math.max.apply(Math,e.map(t=>t.__temp_key__)),ve=e=>`/content-manager/${e}`;var eu=Object.defineProperty,To=Object.getOwnPropertySymbols,tu=Object.prototype.hasOwnProperty,nu=Object.prototype.propertyIsEnumerable,wo=(e,t,n)=>t in e?eu(e,t,{enumerable:!0,configurable:!0,writable:!0,value:n}):e[t]=n,Vt=(e,t)=>{for(var n in t||(t={}))tu.call(t,n)&&wo(e,n,t[n]);if(To)for(var n of To(t))nu.call(t,n)&&wo(e,n,t[n]);return e};const Io=(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,N.set)(a,[n],Vt(Vt({},e[n]),i)),Object.keys(e.components).forEach(u=>{const c=s(u);(0,N.set)(a,["components",u],Vt(Vt({},e.components[u]),c))}),a};var ru=Object.defineProperty,ou=Object.defineProperties,su=Object.getOwnPropertyDescriptors,Do=Object.getOwnPropertySymbols,au=Object.prototype.hasOwnProperty,iu=Object.prototype.propertyIsEnumerable,xo=(e,t,n)=>t in e?ru(e,t,{enumerable:!0,configurable:!0,writable:!0,value:n}):e[t]=n,So=(e,t)=>{for(var n in t||(t={}))au.call(t,n)&&xo(e,n,t[n]);if(Do)for(var n of Do(t))iu.call(t,n)&&xo(e,n,t[n]);return e},Lo=(e,t)=>ou(e,su(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):Lo(So({},n),{[s]:a.map(l=>Ct(l,t))}):typeof a=="object"?Array.isArray(n)?(n[s]=Ct(a,t),n):Lo(So({},n),{[s]:Ct(a,t)}):(s===t&&delete n[s],n)},e),lu=Ct,Fo=(e,t,n)=>{const s=(a,l)=>Object.keys(a).reduce((i,u)=>{const c=(0,g.getType)(l,u),d=(0,N.get)(a,u),m=(0,g.getOtherInfos)(l,[u,"component"]),f=(0,g.getOtherInfos)(l,[u,"repeatable"]);return c==="dynamiczone"?(i[u]=d.map(y=>s(y,n[y.__component])),i):c==="component"?(f?i[u]=d&&d.map(y=>s(y,n[m])):i[u]=d&&s(d,n[m]),i):(c!=="password"&&(i[u]=d),i)},{});return s(e,t)};var cu=Object.defineProperty,uu=Object.defineProperties,du=Object.getOwnPropertyDescriptors,ko=Object.getOwnPropertySymbols,pu=Object.prototype.hasOwnProperty,mu=Object.prototype.propertyIsEnumerable,Ao=(e,t,n)=>t in e?cu(e,t,{enumerable:!0,configurable:!0,writable:!0,value:n}):e[t]=n,Pt=(e,t)=>{for(var n in t||(t={}))pu.call(t,n)&&Ao(e,n,t[n]);if(ko)for(var n of ko(t))mu.call(t,n)&&Ao(e,n,t[n]);return e},Ot=(e,t)=>uu(e,du(t));const Pn=(e,t)=>t.find(n=>n.uid===e),fu=(e,t)=>e.layouts.editRelations.reduce((s,a)=>{const l=(0,N.get)(e,["attributes",a],{}),i=(0,N.get)(e,["attributes",a,"targetModel"],null),c=Pn(i,t).pluginOptions||{},d=(0,N.get)(e,["metadatas",a,"edit"],{}),m=6,f=$o(e,a,t);return s.push({name:a,size:m,fieldSchema:l,metadatas:d,queryInfos:f,targetModelPluginOptions:c}),s},[]),gu=(e,t)=>{const n=yu(e,t),s=jo(n.contentType,null,t),a=n.contentType.uid,l=fu(n.contentType,t),i=hu(n.contentType,n.components);return(0,N.set)(n,["contentType","layouts","edit"],s),(0,N.set)(n,["contentType","layouts","editRelations"],l),(0,N.set)(n,["contentType","layouts","list"],i),Object.keys(n.components).forEach(u=>{const c=jo(n.components[u],a,t);(0,N.set)(n,["components",u,"layouts","edit"],c)}),n},yu=(e,t)=>{const n=Io((0,N.cloneDeep)(e),t,"contentType"),{components:s,contentType:a}=n,l=i=>Object.keys(i.metadatas).reduce((u,c)=>{const d=(0,N.get)(i,["attributes",c],{});let m=i.metadatas[c];if(d.type==="relation"){const f=Pn(d.targetModel,t),y=m.edit.mainField,h={name:y,schema:(0,N.get)(f,["attributes",y])};m={list:Ot(Pt({},m.list),{mainField:h}),edit:Ot(Pt({},m.edit),{mainField:h})}}return u[c]=m,u},{});return(0,N.set)(n,["contentType","metadatas"],l(a)),Object.keys(s).forEach(i=>{const u=s[i],c=l(u);(0,N.set)(n,["components",i,"metadatas"],c)}),n},jo=(e,t,n)=>e.layouts.edit.reduce((a,l)=>{const i=l.map(u=>{const c=(0,N.get)(e,["attributes",u.name],{}),d=Ot(Pt({},u),{fieldSchema:c,metadatas:(0,N.get)(e,["metadatas",u.name,"edit"],{})});if(c.type==="relation"){const m=c.targetModel,y=Pn(m,n).pluginOptions||{},h=t?bu(e,u.name,t,n):$o(e,u.name,n);(0,N.set)(d,"targetModelPluginOptions",y),(0,N.set)(d,"queryInfos",h)}return d});return a.push(i),a},[]),hu=(e,t)=>e.layouts.list.reduce((s,a)=>{const l=(0,N.get)(e,["attributes",a],{}),i=(0,N.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},[]),$o=(e,t,n)=>{const s=e.uid,a=ve(`relations/${s}/${t}`),l=(0,N.get)(e,["metadatas",t,"edit","mainField","name"],""),i=(0,N.get)(e,["attributes",t,"targetModel"],""),u=Bo(n).indexOf(i)!==-1;return{endPoint:a,containsKey:`${l}`,defaultParams:{},shouldDisplayRelationLink:u}},bu=(e,t,n,s)=>{const a=ve(`relations/${n}/${t}`),l=(0,N.get)(e,["metadatas",t,"edit","mainField","name"],""),i=(0,N.get)(e,["attributes",t,"targetModel"],""),u=Bo(s).indexOf(i)!==-1;return{endPoint:a,containsKey:`${l}`,defaultParams:{_component:e.uid},shouldDisplayRelationLink:u}},Bo=e=>e.filter(t=>t.isDisplayed).map(({uid:t})=>t),No=gu;var qt=p(49415),Eu=Object.defineProperty,vu=Object.defineProperties,Cu=Object.getOwnPropertyDescriptors,Vo=Object.getOwnPropertySymbols,Pu=Object.prototype.hasOwnProperty,Ou=Object.prototype.propertyIsEnumerable,qo=(e,t,n)=>t in e?Eu(e,t,{enumerable:!0,configurable:!0,writable:!0,value:n}):e[t]=n,Wt=(e,t)=>{for(var n in t||(t={}))Pu.call(t,n)&&qo(e,n,t[n]);if(Vo)for(var n of Vo(t))Ou.call(t,n)&&qo(e,n,t[n]);return e},Wo=(e,t)=>vu(e,Cu(t));const Ru={error:null,isLoading:!0,layout:{},layouts:{}},Mu=(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=Wo(Wt({},s),{contentType:Wt({uid:s.contentType.uid},t.newLayout.contentType)}),n.layouts[s.contentType.uid]=Wo(Wt({},s),{contentType:Wt({uid:s.contentType.uid},t.newLayout.contentType)});break}default:return n}});var On=p(12463),Tu=p(34947);const Rt=()=>e=>e["content-manager_app"]||Tu.E,sP=()=>createSelector(Rt(),e=>e),aP=()=>createSelector(Rt(),e=>e.models),wu=()=>(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 Iu=p(98399),Du=(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 zo=e=>{const[{error:t,isLoading:n,layout:s,layouts:a},l]=(0,r.useReducer)(Mu,Ru),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,y)=>Du(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:y.token});l({type:"GET_DATA_SUCCEEDED",data:No(b,u)})}catch(h){if(Se().isCancel(h))return;c.current&&Iu.error(h),c.current&&l({type:"GET_DATA_ERROR",error:h})}}),[a,u]);(0,r.useEffect)(()=>()=>{c.current=!1},[]),(0,r.useEffect)(()=>{const y=Se().CancelToken.source();return d(e,y),()=>{y.cancel("Operation canceled by the user.")}},[e,d]);const m=(0,r.useCallback)(f=>{l({type:"UPDATE_LAYOUT",newLayout:No(f,u)})},[u]);return{error:t,isLoading:n,layout:s,updateLayout:m}},xu=e=>e["content-manager_app"].collectionTypeLinks;var Ne=p(77997),Su=p(33795),T=p.n(Su),Lu=p(85973),Uo=p.n(Lu),Fu=Object.defineProperty,ku=Object.defineProperties,Au=Object.getOwnPropertyDescriptors,Ho=Object.getOwnPropertySymbols,ju=Object.prototype.hasOwnProperty,$u=Object.prototype.propertyIsEnumerable,_o=(e,t,n)=>t in e?Fu(e,t,{enumerable:!0,configurable:!0,writable:!0,value:n}):e[t]=n,Bu=(e,t)=>{for(var n in t||(t={}))ju.call(t,n)&&_o(e,n,t[n]);if(Ho)for(var n of Ho(t))$u.call(t,n)&&_o(e,n,t[n]);return e},Nu=(e,t)=>ku(e,Au(t));const Go=(e,t)=>Object.keys(e).reduce((n,s)=>{const a=e[s],l=T()(t,[s],a);return Uo()(a)?Nu(Bu({},n),{[s]:Go(a,l)}):(n[s]=l,n)},{}),Vu=(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=Go(i,u);return`${a}?${(0,Ne.stringify)(c,{encode:!1})}`},Zo=e=>{const[{rawQuery:t}]=(0,g.useQueryParams)(),n=(0,fe.useSelector)(xu);return Vu(n,e,t)},He=()=>(0,r.useContext)(At),Qo=()=>{const{search:e}=(0,X.useLocation)(),t=e?(0,Ne.parse)(e.substring(1)):{};return t.plugins?(0,Ne.stringify)({plugins:t.plugins},{encode:!1}):""};var Ko=p(89334);const qu=(e,t,n)=>({type:Ko.m,permissions:e,__meta__:{plugins:t,containerName:n}}),Wu=()=>({type:Ko.Q}),zu=e=>e["content-manager_rbacManager"].permissions,Uu=e=>e.rbacProvider.collectionTypesRelatedPermissions,Yo=(e,t,n="listView")=>{const s=(0,fe.useSelector)(Uu),a=(0,fe.useSelector)(zu),l=(0,fe.useDispatch)(),i=s[t];return(0,r.useEffect)(()=>i?(l(qu(i,e?e.plugins:null,n)),()=>{l(Wu())}):()=>{},[i,l,e,n]),a},gP=()=>useContext(WysiwygContext),yP=null;var zt=p(70836),Jo=p(4460);const Hu=()=>({type:Jo.c}),_u=(e,t)=>({type:Jo.O,layout:e,query:t});var Gu=p(8266),We=p.n(Gu),Ut=p(27635),le=p(78330),Zu=p(70404),Qu=p.n(Zu),Ku=p(66694);const Yu=()=>(0,r.useContext)(Ku.ux),Xo=e=>{const{getAdminInjectedComponents:t}=Yu(),[n,s,a]=e.split(".");return t(n,s,a)};var Ju=Object.defineProperty,Ht=Object.getOwnPropertySymbols,es=Object.prototype.hasOwnProperty,ts=Object.prototype.propertyIsEnumerable,ns=(e,t,n)=>t in e?Ju(e,t,{enumerable:!0,configurable:!0,writable:!0,value:n}):e[t]=n,Xu=(e,t)=>{for(var n in t||(t={}))es.call(t,n)&&ns(e,n,t[n]);if(Ht)for(var n of Ht(t))ts.call(t,n)&&ns(e,n,t[n]);return e},ed=(e,t)=>{var n={};for(var s in e)es.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&&ts.call(e,s)&&(n[s]=e[s]);return n};const rs=e=>{var t=e,{area:n}=t,s=ed(t,["area"]);return Xo(n).map(l=>r.createElement(l.Component,Xu({key:l.name},s)))};rs.propTypes={area:o().string.isRequired};const _t=rs;var td=Object.defineProperty,os=Object.getOwnPropertySymbols,nd=Object.prototype.hasOwnProperty,rd=Object.prototype.propertyIsEnumerable,ss=(e,t,n)=>t in e?td(e,t,{enumerable:!0,configurable:!0,writable:!0,value:n}):e[t]=n,as=(e,t)=>{for(var n in t||(t={}))nd.call(t,n)&&ss(e,n,t[n]);if(os)for(var n of os(t))rd.call(t,n)&&ss(e,n,t[n]);return e};function od(e,t){return n=>{const s=t(n.name);return r.createElement(e,as(as({},n),s))}}const sd=od;function ad(e){const{addComponentToDynamicZone:t,createActionAllowedFields:n,isCreatingEntry:s,formErrors:a,modifiedData:l,moveComponentUp:i,moveComponentDown:u,removeComponentFromDynamicZone:c,readActionAllowedFields:d,updateActionAllowedFields:m}=(0,g.useCMEditViewDataManager)(),f=(0,r.useMemo)(()=>(0,N.get)(l,[e],[]).map(b=>b.__component),[l,e]),y=(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:y,isFieldReadable:h,moveComponentUp:i,moveComponentDown:u,removeComponentFromDynamicZone:c,dynamicDisplayedComponents:f}}const id=ad;var ld=p(51542),is=p.n(ld),Mn=p(98195);const Tn=(0,k.default)(is())`
|
|
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
|
-
`,cd=(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
|
-
`,ud=(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 y=a?f:m;return t&&!a&&(y=d({id:"components.Input.error.validation.max",defaultMessage:"The value is too high."})),n&&!a&&(y=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(cd,{type:"button",onClick:c,disabled:s,hasError:e},r.createElement(j.Flex,null,r.createElement(ud,{"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"},y)))))};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 dd=wn,pd=(0,k.default)(D.Box)`
|
|
127
|
-
border-radius: ${(0,g.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(pd,{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,g.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,g.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 md=In;var Dn=p(16925),ze=p(12001),xn=p(54742),ls=p(82910),fd=p(78325),gd=p.n(fd),yd=p(30857),hd=p.n(yd),bd=p(61868),Ed=p.n(bd),vd=Object.defineProperty,cs=Object.getOwnPropertySymbols,Cd=Object.prototype.hasOwnProperty,Pd=Object.prototype.propertyIsEnumerable,us=(e,t,n)=>t in e?vd(e,t,{enumerable:!0,configurable:!0,writable:!0,value:n}):e[t]=n,Od=(e,t)=>{for(var n in t||(t={}))Cd.call(t,n)&&us(e,n,t[n]);if(cs)for(var n of cs(t))Pd.call(t,n)&&us(e,n,t[n]);return e};const Rd=k.default.span`
|
|
129
|
-
> svg {
|
|
130
|
-
width: ${(0,g.pxToRem)(24)};
|
|
131
|
-
height: ${(0,g.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(Rd,null,r.createElement(is(),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},Od({},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 ds=Sn;var Md=p(9086),Td=p.n(Md),wd=p(88708),Gt=p.n(wd),Id=p(27509),Zt=p.n(Id),EP=p(40795),Dd=p(88591),xd=p.n(Dd),Ln=p(59845),Sd=p(20871),Ld=p.n(Sd),Fd=p(48375),ps=p.n(Fd),kd=p(31089),Ad=p.n(kd),jd=p(16043),$d=p.n(jd),Bd=p(5109),Nd=p.n(Bd),Vd=p(47955),qd=p.n(Vd),Wd=p(95706),zd=p.n(Wd),Ud=p(6658),Hd=p.n(Ud),_d=p(36407),Gd=p.n(_d),Zd=(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())});(()=>Zd(void 0,null,function*(){yield p.e(7347).then(p.bind(p,98362))}))();const ct=new(xd())({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(Ld()).use(ps(),"warning").use(ps(),"tip").use(Ad()).use($d()).use(Nd()).use(qd()).use(zd()).use(Hd()).use(Gd());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 Qd=ct;var Kd=p(13993),ms=p.n(Kd),Yd=Object.defineProperty,Jd=Object.defineProperties,Xd=Object.getOwnPropertyDescriptors,fs=Object.getOwnPropertySymbols,ep=Object.prototype.hasOwnProperty,tp=Object.prototype.propertyIsEnumerable,gs=(e,t,n)=>t in e?Yd(e,t,{enumerable:!0,configurable:!0,writable:!0,value:n}):e[t]=n,np=(e,t)=>{for(var n in t||(t={}))ep.call(t,n)&&gs(e,n,t[n]);if(fs)for(var n of fs(t))tp.call(t,n)&&gs(e,n,t[n]);return e},rp=(e,t)=>Jd(e,Xd(t));const op=rp(np({},ms().defaults),{allowedTags:!1,allowedAttributes:{"*":["href","align","alt","center","width","height","type","controls","target"],img:["src","alt"],source:["src","type"]}}),sp=e=>ms()(e,op),ap=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)(()=>sp(Qd.render(e||"")),[e]);return r.createElement(ap,null,r.createElement("div",{dangerouslySetInnerHTML:{__html:t}}))};Fn.defaultProps={data:""},Fn.propTypes={data:o().string};const ys=(0,r.memo)(Fn),ip=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
|
-
`,lp=(0,k.default)(Le)`
|
|
635
|
-
svg {
|
|
636
|
-
width: ${8/16}rem;
|
|
637
|
-
height: ${8/16}rem;
|
|
638
|
-
}
|
|
639
|
-
`,hs=(0,k.default)(Me.IconButtonGroup)`
|
|
640
|
-
margin-left: ${({theme:e})=>e.spaces[4]};
|
|
641
|
-
`,bs=(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
|
-
`,cp=(0,k.default)(Me.IconButtonGroup)`
|
|
650
|
-
margin-right: ${({theme:e})=>`${e.spaces[2]}`};
|
|
651
|
-
`,up=k.default.div`
|
|
652
|
-
position: relative;
|
|
653
|
-
height: calc(100% - 48px);
|
|
654
|
-
`,dp=(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*)/,pp=/^(\s*)(>[> ]*|[*+-] \[[x ]\]|[*+-]|(\d+)[.)])(\s*)$/,mp=/[*+-]\s/;function fp(e){if(e.getOption("disableInput"))return Zt().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(pp.test(c)){var f=u&&/>\s*$/.test(c),y=!/>\s*$/.test(c);(f||y)&&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=!(mp.test(d[2])||d[2].indexOf(">")>=0),F=E?parseInt(d[3],10)+1+d[4]:d[2].replace("x"," ");n[s]=`
|
|
669
|
-
`+h+F+b,E&&gp(e,a)}}e.replaceSelections(n)}function gp(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,y=parseInt(d[3],10),h=y;if(i===m&&!isNaN(y))f===y&&(h=y+1),f>y&&(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 yp=fp,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=Zt().fromTextArea(c.current,{lineWrapping:!0,extraKeys:{Enter:"newlineAndIndentContinueMarkdownList",Tab:!1,"Shift-Tab":!1},readOnly:!1,smartIndent:!1,placeholder:u,spellcheck:!0,inputStyle:"contenteditable"}),Zt().commands.newlineAndIndentContinueMarkdownList=yp,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(up,null,r.createElement(ip,{isExpandMode:a,disabled:e||s},r.createElement("textarea",{ref:c})),s&&r.createElement(ys,{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 hp=kn;var ye=p(44526),de=p(25716),bp=p(37853),Ep=p(19882),Es=p.n(Ep),vp=p(61980),vs=p.n(vp),Cp=p(70052),Cs=p.n(Cp),Pp=p(15053),Op=p.n(Pp),Rp=p(18767),Mp=p.n(Rp),Tp=p(83358),wp=p.n(Tp),Ip=p(69822),Dp=p.n(Ip),xp=p(88467),Sp=p.n(xp),Lp=p(83262),Fp=p.n(Lp),kp=p(49157),Ap=p.n(kp),jp=p(75400),Ps=p.n(jp);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)(),y=()=>{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(de.Select,{disabled:!0,id:"selectTitle",placeholder:m,size:"S","aria-label":m},r.createElement(de.Option,{value:"h1"},"h1"),r.createElement(de.Option,{value:"h2"},"h2"),r.createElement(de.Option,{value:"h3"},"h3"),r.createElement(de.Option,{value:"h4"},"h4"),r.createElement(de.Option,{value:"h5"},"h5"),r.createElement(de.Option,{value:"h6"},"h6")),r.createElement(hs,null,r.createElement(Le,{disabled:!0,id:"Bold",label:"Bold",name:"Bold",icon:r.createElement(Es(),null)}),r.createElement(Le,{disabled:!0,id:"Italic",label:"Italic",name:"Italic",icon:r.createElement(vs(),null)}),r.createElement(Le,{disabled:!0,id:"Underline",label:"Underline",name:"Underline",icon:r.createElement(Cs(),null)})),r.createElement(bs,{disabled:!0,id:"more",label:"More",icon:r.createElement(Ps(),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(de.Select,{id:"selectTitle",placeholder:m,size:"S",onChange:h=>a(h,t)},r.createElement(de.Option,{value:"h1"},"h1"),r.createElement(de.Option,{value:"h2"},"h2"),r.createElement(de.Option,{value:"h3"},"h3"),r.createElement(de.Option,{value:"h4"},"h4"),r.createElement(de.Option,{value:"h5"},"h5"),r.createElement(de.Option,{value:"h6"},"h6")),r.createElement(hs,null,r.createElement(Le,{onClick:()=>a("Bold",t),id:"Bold",label:"Bold",name:"Bold",icon:r.createElement(Es(),null)}),r.createElement(Le,{onClick:()=>a("Italic",t),id:"Italic",label:"Italic",name:"Italic",icon:r.createElement(vs(),null)}),r.createElement(Le,{onClick:()=>a("Underline",t),id:"Underline",label:"Underline",name:"Underline",icon:r.createElement(Cs(),null)})),r.createElement(bs,{ref:f,onClick:y,id:"more",label:"More",icon:r.createElement(Ps(),null)}),u&&r.createElement(bp.Popover,{centered:!0,source:f,spacing:4,id:"popover"},r.createElement(xn.FocusTrap,{onEscape:y,restoreFocus:!1},r.createElement(j.Flex,null,r.createElement(cp,null,r.createElement(Le,{onClick:()=>a("Strikethrough",t,y),id:"Strikethrough",label:"Strikethrough",name:"Strikethrough",icon:r.createElement(Op(),null)}),r.createElement(Le,{onClick:()=>a("BulletList",t,y),id:"BulletList",label:"BulletList",name:"BulletList",icon:r.createElement(Mp(),null)}),r.createElement(Le,{onClick:()=>a("NumberList",t,y),id:"NumberList",label:"NumberList",name:"NumberList",icon:r.createElement(wp(),null)})),r.createElement(Me.IconButtonGroup,null,r.createElement(Le,{onClick:()=>a("Code",t,y),id:"Code",label:"Code",name:"Code",icon:r.createElement(Dp(),null)}),r.createElement(Le,{onClick:()=>{y(),l()},id:"Image",label:"Image",name:"Image",icon:r.createElement(Sp(),null)}),r.createElement(lp,{onClick:()=>a("Link",t,y),id:"Link",label:"Link",name:"Link",icon:r.createElement(Fp(),null)}),r.createElement(Le,{onClick:()=>a("Quote",t,y),id:"Quote",label:"Quote",name:"Quote",icon:r.createElement(Ap(),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 $p=An;var Bp=p(39766),Np=p.n(Bp);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(dp,{id:"expand",onClick:e},r.createElement(L.Typography,null,t({id:"components.WysiwygBottomControls.fullscreen",defaultMessage:"Expand"})),r.createElement(Np(),null))))};jn.defaultProps={onToggleExpand(){}},jn.propTypes={onToggleExpand:o().func};const Vp=jn;var qp=Object.defineProperty,Os=Object.getOwnPropertySymbols,Wp=Object.prototype.hasOwnProperty,zp=Object.prototype.propertyIsEnumerable,Rs=(e,t,n)=>t in e?qp(e,t,{enumerable:!0,configurable:!0,writable:!0,value:n}):e[t]=n,Up=(e,t)=>{for(var n in t||(t={}))Wp.call(t,n)&&Rs(e,n,t[n]);if(Os)for(var n of Os(t))zp.call(t,n)&&Rs(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},Up({},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 Hp=$n,Ms=(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},Ts=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}},ws=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},Is=(e,t)=>{const n=e.current.getSelection();let s;if(n){const a=Ms(t,n);e.current.replaceSelection(a),e.current.focus()}else{s=Ts(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})}},_p=(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=ws(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()},Gp=(e,t)=>{let{line:n}=e.current.getCursor();const s=ws(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)},Zp=(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)},Qp=(e,t,n,s,a)=>{const l=Ms(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()},Kp=(e,t,n,s)=>{const a=Ts(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()},Yp=(e,t)=>{const n=e.current.getSelection();let{line:s}=e.current.getCursor(),a=e.current.getLine(s).length;n?Qp(e,t,s,a,n):Kp(e,t,s,a)};var Jp=p(64410),Xp=p(43768),em=p.n(Xp);const tm=(e,t)=>`${e}${Math.floor(t*255).toString(16).padStart(2,0)}`,nm=(0,k.default)(j.Flex)`
|
|
677
|
-
background: ${({theme:e})=>tm(e.colors.neutral800,.2)};
|
|
678
|
-
`,rm=(0,k.default)(D.Box)`
|
|
679
|
-
border-right: 1px solid ${({theme:e})=>e.colors.neutral200};
|
|
680
|
-
`,om=(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(Jp.Portal,{role:"dialog","aria-modal":!1},r.createElement(xn.FocusTrap,{onEscape:a},r.createElement(nm,{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(rm,{flex:"1",height:"100%"},e),r.createElement(D.Box,{flex:"1",height:"100%"},r.createElement(j.Flex,{height:(0,g.pxToRem)(48),background:"neutral100",justifyContent:"flex-end"},r.createElement(om,{id:"collapse",onClick:a},r.createElement(L.Typography,null,l({id:"components.Wysiwyg.collapse",defaultMessage:"Collapse"})),r.createElement(em(),null))),r.createElement(D.Box,{position:"relative",height:"100%"},r.createElement(ys,{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 sm=Object.defineProperty,Ds=Object.getOwnPropertySymbols,am=Object.prototype.hasOwnProperty,im=Object.prototype.propertyIsEnumerable,xs=(e,t,n)=>t in e?sm(e,t,{enumerable:!0,configurable:!0,writable:!0,value:n}):e[t]=n,Ss=(e,t)=>{for(var n in t||(t={}))am.call(t,n)&&xs(e,n,t[n]);if(Ds)for(var n of Ds(t))im.call(t,n)&&xs(e,n,t[n]);return e};const lm=(0,k.default)(D.Box)`
|
|
694
|
-
svg path {
|
|
695
|
-
fill: ${({theme:e})=>e.colors.neutral500};
|
|
696
|
-
}
|
|
697
|
-
`,cm=(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),y=(0,r.useRef)(null),[h,b]=(0,r.useState)(!1),[E,F]=(0,r.useState)(!1),[C,P]=(0,r.useState)(!1),{components:I}=(0,g.useLibrary)(),R=I["media-library"],z=()=>F(S=>!S),M=()=>b(S=>!S),V=()=>{b(!1),P(S=>!S)},B=(S,G,W)=>{switch(S){case"Link":case"Strikethrough":{Is(G,S),W();break}case"Code":case"Quote":{Yp(G,S),W();break}case"Bold":case"Italic":case"Underline":{Is(G,S);break}case"BulletList":case"NumberList":{_p(G,S),W();break}case"h1":case"h2":case"h3":case"h4":case"h5":case"h6":{Gp(G,S);break}default:}},Z=S=>{const G=S.map(W=>({alt:W.alternativeText||W.name,url:(0,g.prefixFileUrlWithBackendUrl)(W.url),mime:W.mime}));Zp(y,G),F(!1)},U=u?m({id:u.id,defaultMessage:u.defaultMessage},Ss({},u.values)):"",q=s.id?m({id:s.id,defaultMessage:s.defaultMessage},Ss({},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"},q,d&&r.createElement(cm,{textColor:"danger600"},"*")),a&&r.createElement(lm,{paddingLeft:1},a)),r.createElement(Bn,{isExpandMode:C,error:n,previewContent:c,onCollapse:V},r.createElement($p,{isExpandMode:C,editorRef:y,isPreviewMode:h,onActionClick:B,onToggleMediaLib:z,onTogglePreviewMode:C?void 0:M,disabled:t}),r.createElement(hp,{disabled:t,isExpandMode:C,editorRef:y,error:n,isPreviewMode:h,name:l,onChange:i,placeholder:U,textareaRef:f,value:c}),!C&&r.createElement(Vp,{onToggleExpand:V})),r.createElement(Hp,{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(R,{onClose:z,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 um=Nn;var dm=p(16285),pm=p.n(dm),Mt=p(20001),mm=p(37475);const fm=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
|
-
`,gm=(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 ym=Object.defineProperty,Ls=Object.getOwnPropertySymbols,hm=Object.prototype.hasOwnProperty,bm=Object.prototype.propertyIsEnumerable,Fs=(e,t,n)=>t in e?ym(e,t,{enumerable:!0,configurable:!0,writable:!0,value:n}):e[t]=n,Em=(e,t)=>{for(var n in t||(t={}))hm.call(t,n)&&Fs(e,n,t[n]);if(Ls)for(var n of Ls(t))bm.call(t,n)&&Fs(e,n,t[n]);return e};const vm=(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},Em({},e.values)):n;return r.createElement(j.Flex,null,r.createElement(Mt.FieldLabel,{required:s},l),t&&r.createElement(vm,{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 Cm=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 Pm=qn;var Om=Object.defineProperty,Rm=(e,t,n)=>t in e?Om(e,t,{enumerable:!0,configurable:!0,writable:!0,value:n}):e[t]=n,et=(e,t,n)=>(Rm(e,typeof t!="symbol"?t+"":t,n),n),Mm=(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 Tm=600,wm="blackboard";(()=>Mm(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(""):n===0?this.codeMirror.setValue("0"):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-pm()(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()),Tm)}),et(this,"testJSON",n=>{try{mm.parse(n)}catch(s){this.markSelection(s)}}),this.editor=r.createRef(),this.state={error:!1,markedText:null}}componentDidMount(){this.codeMirror=Zt().fromTextArea(this.editor.current,{autoCloseBrackets:!0,lineNumbers:!0,matchBrackets:!0,mode:"application/json",readOnly:this.props.disabled,smartIndent:!0,styleSelectedText:!0,tabSize:2,theme:wm,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(Pm,{name:this.props.name,hint:this.props.description,error:this.props.error},r.createElement(se.Stack,{spacing:1},r.createElement(Cm,{intlLabel:this.props.intlLabel,labelAction:this.props.labelAction,name:this.props.name,required:this.props.required}),r.createElement(gm,{error:this.props.error},r.createElement(fm,{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 Im=Wn;var zn=p(37178),Dm=p(23101),xm=p.n(Dm),Sm=p(14356),Lm=p.n(Sm),Fm=p(50678),Tt=p.n(Fm),km=p(103),Am=p.n(km);const ks=(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},jm=/^[A-Za-z0-9-_.~]*$/,$m=(0,k.default)(D.Box)`
|
|
730
|
-
position: relative;
|
|
731
|
-
`,Bm=(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
|
-
`,Nm=k.keyframes`
|
|
760
|
-
from {
|
|
761
|
-
transform: rotate(0deg);
|
|
762
|
-
}
|
|
763
|
-
to {
|
|
764
|
-
transform: rotate(359deg);
|
|
765
|
-
}
|
|
766
|
-
`,Vm=(0,k.default)(j.Flex)`
|
|
767
|
-
animation: ${Nm} 2s infinite linear;
|
|
768
|
-
`;var qm=Object.defineProperty,As=Object.getOwnPropertySymbols,Wm=Object.prototype.hasOwnProperty,zm=Object.prototype.propertyIsEnumerable,js=(e,t,n)=>t in e?qm(e,t,{enumerable:!0,configurable:!0,writable:!0,value:n}):e[t]=n,Hn=(e,t)=>{for(var n in t||(t={}))Wm.call(t,n)&&js(e,n,t[n]);if(As)for(var n of As(t))zm.call(t,n)&&js(e,n,t[n]);return e},$s=(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 _n=({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:y,initialData:h,layout:b}=(0,g.useCMEditViewDataManager)(),[E,F]=(0,r.useState)(!1),[C,P]=(0,r.useState)(null),I=ks(d,300),R=(0,r.useRef)(),z=h[u],{formatMessage:M}=(0,A.useIntl)(),V=T()(b,["options","timestamps",0]),B=!h[V],Z=ks(y[e.targetField],300),[U,q]=(0,r.useState)(!1),[S,G]=(0,r.useState)(null),W=l.id?M({id:l.id,defaultMessage:l.defaultMessage},Hn({},l.values)):u,ee=n?M({id:n.id,defaultMessage:n.defaultMessage},Hn({},n.values)):"",w=m?M({id:m.id,defaultMessage:m.defaultMessage},Hn({},m.values)):"";R.current=(O=!1)=>$s(void 0,null,function*(){F(!0);const _=ve("uid/generate");try{const{data:{data:K}}=yield ge.be.post(_,{contentTypeUID:t,field:u,data:y});c({target:{name:u,value:K,type:"text"}},O),F(!1)}catch(K){F(!1)}});const $=()=>$s(void 0,null,function*(){F(!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():""});P(_),F(!1)}catch(_){F(!1)}});(0,r.useEffect)(()=>{!d&&e.required&&R.current(!0)},[]),(0,r.useEffect)(()=>{I&&I.trim().match(jm)&&I!==z&&$(),I||P(null)},[I,z]),(0,r.useEffect)(()=>{let O;return C&&C.isAvailable&&(O=setTimeout(()=>{P(null)},4e3)),()=>{O&&clearTimeout(O)}},[C]),(0,r.useEffect)(()=>{!U&&B&&Z&&y[e.targetField]&&!d&&R.current(!0)},[Z,U,B]);const Y=()=>{G(M({id:"content-manager.components.uid.regenerate",defaultMessage:"Regenerate"}))},Q=()=>{G(null)},x=O=>{O.target.value&&B&&q(!0),c(O)};return r.createElement(zn.TextInput,{disabled:s,error:a,endAction:r.createElement($m,null,C&&C.isAvailable&&!S&&r.createElement(Un,{alignItems:"center",justifyContent:"flex-end"},r.createElement(Lm(),null),r.createElement(L.Typography,{textColor:"success600",variant:"pi"},M({id:"content-manager.components.uid.available",defaultMessage:"Available"}))),C&&!C.isAvailable&&!S&&r.createElement(Un,{notAvailable:!0,alignItems:"center",justifyContent:"flex-end"},r.createElement(Tt(),null),r.createElement(L.Typography,{textColor:"danger600",variant:"pi"},M({id:"content-manager.components.uid.unavailable",defaultMessage:"Unavailable"}))),S&&r.createElement(Un,{alignItems:"center",justifyContent:"flex-end"},r.createElement(L.Typography,{textColor:"primary600",variant:"pi"},S)),r.createElement(Bm,{onClick:()=>R.current(),label:"regenerate",onMouseEnter:Y,onMouseLeave:Q},E?r.createElement(Vm,null,r.createElement(Am(),null)):r.createElement(xm(),null))),hint:ee,label:W,labelAction:i,name:u,onChange:x,placeholder:w,value:d||"",required:f})};_n.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},_n.defaultProps={description:void 0,disabled:!1,error:void 0,labelAction:void 0,placeholder:void 0,value:"",required:!1};const Um=_n;var Hm=p(28611),_m=p.n(Hm),Gm=p(77236),Bs=p.n(Gm),Zm=p(86834),Re=p.n(Zm),Qm=p(3040),ne=p.n(Qm);const Km=(0,k.default)(D.Box)`
|
|
769
|
-
svg path {
|
|
770
|
-
fill: ${({theme:e})=>e.colors.neutral500};
|
|
771
|
-
}
|
|
772
|
-
`,Gn=({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(Km,{paddingLeft:1},n)),s)};Gn.defaultProps={id:void 0,labelAction:void 0,link:null,numberOfEntries:0},Gn.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 Ym=Gn;var Jm=p(7787),Xm=p.n(Jm),Zn=p(82576),ef=p(23973),Ns=p.n(ef),tf=Object.defineProperty,Vs=Object.getOwnPropertySymbols,nf=Object.prototype.hasOwnProperty,rf=Object.prototype.propertyIsEnumerable,qs=(e,t,n)=>t in e?tf(e,t,{enumerable:!0,configurable:!0,writable:!0,value:n}):e[t]=n,Ws=(e,t)=>{for(var n in t||(t={}))nf.call(t,n)&&qs(e,n,t[n]);if(Vs)for(var n of Vs(t))rf.call(t,n)&&qs(e,n,t[n]);return e};const of=k.default.div`
|
|
773
|
-
flex-shrink: 0;
|
|
774
|
-
width: ${(0,g.pxToRem)(6)};
|
|
775
|
-
height: ${(0,g.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
|
-
`,zs=e=>{var t,n;const{formatMessage:s}=(0,A.useIntl)(),a=Zn.components.SingleValue,l=Ns()(T()(e,"data.value"),"publishedAt"),i=Re()(T()(e,"data.value.publishedAt"));if(l){const u={id:v("components.Select.draft-info-title"),defaultMessage:"State: Draft"},c={id:v("components.Select.publish-info-title"),defaultMessage:"State: Published"},d=s(i?u:c);return r.createElement(a,Ws({},e),r.createElement(j.Flex,null,r.createElement(of,{title:d,isDraft:i}),r.createElement(L.Typography,{ellipsis:!0},(t=e.data.label)!=null?t:"-")))}return r.createElement(a,Ws({},e),(n=e.data.label)!=null?n:"-")};zs.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 sf=zs;var af=Object.defineProperty,lf=Object.defineProperties,cf=Object.getOwnPropertyDescriptors,Us=Object.getOwnPropertySymbols,uf=Object.prototype.hasOwnProperty,df=Object.prototype.propertyIsEnumerable,Hs=(e,t,n)=>t in e?af(e,t,{enumerable:!0,configurable:!0,writable:!0,value:n}):e[t]=n,pf=(e,t)=>{for(var n in t||(t={}))uf.call(t,n)&&Hs(e,n,t[n]);if(Us)for(var n of Us(t))df.call(t,n)&&Hs(e,n,t[n]);return e},mf=(e,t)=>lf(e,cf(t));function Qn({components:e,mainField:t,name:n,isDisabled:s,isLoading:a,loadingMessage:l,onChange:i,onInputChange:u,onMenuClose:c,onMenuOpen:d,onMenuScrollToBottom:m,options:f,placeholder:y,value:h,description:b}){const{formatMessage:E}=(0,A.useIntl)();return r.createElement(se.Stack,{spacing:1},r.createElement(g.ReactSelect,{components:mf(pf({},e),{SingleValue:sf}),id:n,isClearable:!0,isDisabled:s,isLoading:a,loadingMessage:l,mainField:t,options:f,onChange:i,onInputChange:u,onMenuClose:c,onMenuOpen:d,onMenuScrollToBottom:m,placeholder:E(y||{id:"global.select",defaultMessage:"Select..."}),value:Xm()(h)?null:{label:T()(h,[t.name],""),value:h}}),b&&r.createElement(L.Typography,{variant:"pi",textColor:"neutral600"},b))}Qn.defaultProps={description:"",components:{},placeholder:null,value:null},Qn.propTypes={components:o().object,isDisabled:o().bool.isRequired,isLoading:o().bool.isRequired,loadingMessage:o().func.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 ff=(0,r.memo)(Qn),gf=k.default.div`
|
|
781
|
-
width: ${(0,g.pxToRem)(6)};
|
|
782
|
-
height: ${(0,g.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=Ns()(e,"publishedAt"),f=Re()(e.publishedAt),y=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:F}=(0,X.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(gf,{isDraft:f,title:E})),t?r.createElement(g.Link,{to:{pathname:c,state:{from:F},search:l},style:{textTransform:"none"}},y||e.id):r.createElement(L.Typography,{variant:"pi"},y||e.id)),r.createElement(g.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 yf=(0,r.memo)(Kn);function Yn({addRelation:e,components:t,displayNavigationLink:n,mainField:s,name:a,isDisabled:l,isLoading:i,loadingMessage:u,onInputChange:c,onMenuClose:d,onMenuOpen:m,onMenuScrollToBottom:f,onRemove:y,options:h,placeholder:b,searchToPersist:E,targetModel:F,value:C,description:P}){const{formatMessage:I}=(0,A.useIntl)(),R={ignoreCase:!0,ignoreAccents:!0,trim:!1,matchFrom:"any"};return r.createElement(se.Stack,{spacing:1},r.createElement(g.ReactSelect,{components:t,isDisabled:l,id:a,filterOption:(z,M)=>!Re()(C)&&C.findIndex(B=>B.id===z.value.id)!==-1?!1:M?(0,Zn.createFilter)(R)(z,M):!0,mainField:s,isLoading:i,loadingMessage:u,isMulti:!0,isSearchable:!0,options:h,onChange:e,onInputChange:c,onMenuClose:d,onMenuOpen:m,onMenuScrollToBottom:f,placeholder:I(b||{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"}},C==null?void 0:C.map((z,M)=>r.createElement(yf,{key:z.id,data:z,displayNavigationLink:n,isDisabled:l,mainField:s,onRemove:()=>{l||y(`${a}.${M}`)},searchToPersist:E,targetModel:F})))),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,loadingMessage:o().func.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 hf=(0,r.memo)(Yn);var bf=Object.defineProperty,_s=Object.getOwnPropertySymbols,Ef=Object.prototype.hasOwnProperty,vf=Object.prototype.propertyIsEnumerable,Gs=(e,t,n)=>t in e?bf(e,t,{enumerable:!0,configurable:!0,writable:!0,value:n}):e[t]=n,Zs=(e,t)=>{for(var n in t||(t={}))Ef.call(t,n)&&Gs(e,n,t[n]);if(_s)for(var n of _s(t))vf.call(t,n)&&Gs(e,n,t[n]);return e};const Cf=k.default.div`
|
|
787
|
-
flex-shrink: 0;
|
|
788
|
-
width: ${(0,g.pxToRem)(6)};
|
|
789
|
-
height: ${(0,g.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=>{var t,n;const{formatMessage:s}=(0,A.useIntl)(),a=Zn.components.Option;if((0,N.has)((0,N.get)(e,"data.value"),"publishedAt")){const i=(0,N.isEmpty)((0,N.get)(e,"data.value.publishedAt")),u={id:v("components.Select.draft-info-title"),defaultMessage:"State: Draft"},c={id:v("components.Select.publish-info-title"),defaultMessage:"State: Published"},d=s(i?u:c);return r.createElement(a,Zs({},e),r.createElement(j.Flex,null,r.createElement(Cf,{title:d,isDraft:i}),r.createElement(L.Typography,{ellipsis:!0},(t=e.label)!=null?t:"-")))}return r.createElement(a,Zs({},e),(n=e.label)!=null?n:"-")};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 Pf=Jn;var Of=Object.defineProperty,Qs=Object.getOwnPropertySymbols,Rf=Object.prototype.hasOwnProperty,Mf=Object.prototype.propertyIsEnumerable,Ks=(e,t,n)=>t in e?Of(e,t,{enumerable:!0,configurable:!0,writable:!0,value:n}):e[t]=n,Ys=(e,t)=>{for(var n in t||(t={}))Rf.call(t,n)&&Ks(e,n,t[n]);if(Qs)for(var n of Qs(t))Mf.call(t,n)&&Ks(e,n,t[n]);return e};function Tf(e,t){return n=>{const s=t(n);return r.createElement(e,Ys(Ys({},n),s))}}const wf=Tf;function If({isUserAllowedToEditField:e,isUserAllowedToReadField:t,name:n}){const{isCreatingEntry:s,createActionAllowedFields:a,readActionAllowedFields:l,updateActionAllowedFields:i}=(0,g.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 Df=If;var xf=Object.defineProperty,Sf=Object.defineProperties,Lf=Object.getOwnPropertyDescriptors,Js=Object.getOwnPropertySymbols,Ff=Object.prototype.hasOwnProperty,kf=Object.prototype.propertyIsEnumerable,Xs=(e,t,n)=>t in e?xf(e,t,{enumerable:!0,configurable:!0,writable:!0,value:n}):e[t]=n,Xn=(e,t)=>{for(var n in t||(t={}))Ff.call(t,n)&&Xs(e,n,t[n]);if(Js)for(var n of Js(t))kf.call(t,n)&&Xs(e,n,t[n]);return e},er=(e,t)=>Sf(e,Lf(t)),Af=(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 ea={contains:"",limit:20,start:0},jf=(e,t)=>t?t.reduce((n,s)=>{const a=T()(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:y}){const{formatMessage:h}=(0,A.useIntl)(),[{query:b}]=(0,g.useQueryParams)(),E=(0,r.useMemo)(()=>d.toLowerCase().includes("morph"),[d]),{addRelation:F,modifiedData:C,moveRelation:P,onChange:I,onRemoveRelation:R}=(0,g.useCMEditViewDataManager)(),{pathname:z}=(0,X.useLocation)(),M=T()(C,c,null),[V,B]=(0,r.useState)(ea),[Z,U]=(0,r.useState)([]),[q,S]=(0,r.useState)(!1),[G,W]=(0,r.useState)(!1),ee=(0,r.useMemo)(()=>Z.filter(Ce=>Re()(M)?!0:Array.isArray(M)?_m()(M,$e=>$e.id===Ce.value.id)===-1:T()(M,"id","")!==Ce.value.id),[Z,M]),{endPoint:w,containsKey:$,defaultParams:Y,shouldDisplayRelationLink:Q,paramsToKeep:x}=y,O=["oneWay","oneToOne","manyToOne","oneToManyMorph","oneToOneMorph"].includes(d),_=(0,r.useMemo)(()=>M?O?[M.id]:M.map(Ce=>Ce.id):[],[O,M]),K=(0,r.useCallback)(Ce=>Af(this,null,function*(){if(E){S(!1);return}if(!l){S(!1);return}S(!0);const $e=er(Xn({limit:V.limit},Y),{start:V.start});V.contains&&($e[`filters[${$}][$containsi]`]=V.contains);try{const{data:Qe}=yield ge.be.post(w,{idsToOmit:_},{params:$e,cancelToken:Ce.token}),to=Qe.map(Ke=>({value:Ke,label:Ke[u.name]}));U(Ke=>Ke.concat(to).filter((gn,no)=>Ke.findIndex(J=>J.value.id===gn.value.id)===-1?!0:Ke.findIndex(J=>J.value.id===gn.value.id)===no)),S(!1)}catch(Qe){S(!1)}}),[$,Y,w,_,l,E,u.name,V.contains,V.limit,V.start]);(0,r.useEffect)(()=>{const $e=Se().CancelToken.source();return G&&K($e),()=>$e.cancel("Operation canceled by the user.")},[K,G]);const ae=(Ce,{action:$e})=>($e==="input-change"&&B(Qe=>Qe.contains===Ce?Qe:er(Xn({},Qe),{contains:Ce,start:0})),Ce),ce=()=>{B(Ce=>er(Xn({},Ce),{start:Ce.start+20}))},Fe=()=>{B(ea),W(!1)},rt=Ce=>{I({target:{name:c,value:Ce&&Ce.value}})},H=Ce=>{Re()(Ce)||F({target:{name:c,value:Ce}})},pe=()=>{W(!0)},je=`/content-manager/collectionType/${m}/${M?M.id:null}`,Ue=(0,Ne.stringify)(jf(b,x),{encode:!1});let ht=null;O&&M&&Q&&(ht=r.createElement(g.Link,{to:{pathname:je,state:{from:z},search:Ue}},h({id:v("containers.Edit.seeDetails"),defaultMessage:"Details"})));const Ze=O?ff:hf,Xr=Bs()(M)?M.length:0,eo=(0,r.useMemo)(()=>E?!0:a?!t:!l&&i||!t,[E,a,t,l,i]);return!l&&a?r.createElement(g.NotAllowedInput,{intlLabel:s,labelAction:n}):!a&&!l&&!i?r.createElement(g.NotAllowedInput,{intlLabel:s,labelAction:n}):r.createElement(se.Stack,{spacing:1},r.createElement(Ym,{intlLabel:s,isSingle:O,labelAction:n,link:ht,name:c,numberOfEntries:Xr}),r.createElement(Ze,{addRelation:H,components:{Option:Pf},displayNavigationLink:Q,id:c,isDisabled:eo,isLoading:q,isClearable:!0,loadingMessage:()=>h({id:v("DynamicTable.relation-loading"),defaultMessage:"Relations are loading"}),mainField:u,move:P,name:c,options:ee,onChange:rt,onInputChange:ae,onMenuClose:Fe,onMenuOpen:pe,onMenuScrollToBottom:ce,onRemove:R,placeholder:f,searchToPersist:Ue,targetModel:m,value:M,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 $f=(0,r.memo)(tr),ta=wf($f,Df);var Bf=Object.defineProperty,na=Object.getOwnPropertySymbols,Nf=Object.prototype.hasOwnProperty,Vf=Object.prototype.propertyIsEnumerable,ra=(e,t,n)=>t in e?Bf(e,t,{enumerable:!0,configurable:!0,writable:!0,value:n}):e[t]=n,oa=(e,t)=>{for(var n in t||(t={}))Nf.call(t,n)&&ra(e,n,t[n]);if(na)for(var n of na(t))Vf.call(t,n)&&ra(e,n,t[n]);return e};function qf(e,t){return n=>{const s=t(n.keys);return r.createElement(e,oa(oa({},n),s))}}const Wf=qf,zf=(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}))],Uf=(e="")=>{switch((0,N.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"}},Hf=e=>{let t;return e==="float"||e==="decimal"?t=.01:t=1,t};function _f(e){const{createActionAllowedFields:t,formErrors:n,isCreatingEntry:s,modifiedData:a,onChange:l,readActionAllowedFields:i,shouldNotRunValidations:u,updateActionAllowedFields:c}=(0,g.useCMEditViewDataManager)(),d=(0,r.useMemo)(()=>s?t:c,[s,t,c]),m=(0,r.useMemo)(()=>s?[]:i,[s,i]),f=(0,N.get)(a,e,null);return{allowedFields:d,formErrors:n,isCreatingEntry:s,onChange:l,readableFields:m,shouldNotRunValidations:u,value:f}}const Gf=_f,sa=["type","model","via","collection","default","plugin","enum","regex","pluginOptions"];var Zf=Object.defineProperty,Qf=Object.defineProperties,Kf=Object.getOwnPropertyDescriptors,aa=Object.getOwnPropertySymbols,Yf=Object.prototype.hasOwnProperty,Jf=Object.prototype.propertyIsEnumerable,ia=(e,t,n)=>t in e?Zf(e,t,{enumerable:!0,configurable:!0,writable:!0,value:n}):e[t]=n,nr=(e,t)=>{for(var n in t||(t={}))Yf.call(t,n)&&ia(e,n,t[n]);if(aa)for(var n of aa(t))Jf.call(t,n)&&ia(e,n,t[n]);return e},Xf=(e,t)=>Qf(e,Kf(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:y}=(0,g.useLibrary)(),{formatMessage:h}=(0,A.useIntl)(),{contentType:b}=lt(),E=(0,g.useCustomFields)(),F=(0,r.useMemo)(()=>!T()(i,"editable",!0),[i]),{type:C,customField:P}=t,I=T()(n,[a],null),R=(0,r.useMemo)(()=>Ro(a),[a]),z=(0,r.useMemo)(()=>{const K=Td()(t,d?[...sa,"required","minLength"]:sa),ae=t.regex||null;if(ae){const ce=new RegExp(ae);ce&&(K.regex=ce)}return K},[t,d]),M=(0,r.useMemo)(()=>T()(z,["required"],!1),[z]),V=(0,r.useMemo)(()=>{const K=T()(b,["attributes"],{});return T()(K,[R[0],"type"],null)==="dynamiczone"},[b,R]),B=(0,r.useMemo)(()=>Uf(C),[C]),Z=(0,r.useMemo)(()=>C==="media"&&!f?[]:f,[C,f]),U=(0,r.useMemo)(()=>Hf(C),[C]),q=(0,r.useMemo)(()=>{const K=R.join(".");if(e.includes(K))return!0;if(V)return e.includes(R[0]);if(R.length>1){const ce=Gt()(R,R.length-1).join(".");return e.includes(ce)}return!1},[e,R,V]),S=(0,r.useMemo)(()=>{const K=R.join(".");if(c.includes(K))return!0;if(V)return c.includes(R[0]);if(R.length>1){const ce=Gt()(R,R.length-1).join(".");return c.includes(ce)}return!1},[c,R,V]),G=(0,r.useMemo)(()=>S||q,[q,S]),W=(0,r.useMemo)(()=>s?F:S&&!q?!0:F,[F,s,q,S]),ee=(0,r.useMemo)(()=>zf(t.enum||[],M),[t,M]),{label:w,description:$,placeholder:Y,visible:Q}=i,x=(0,r.useMemo)(()=>{if(!i.step||B!=="datetime"&&B!=="time")return U;if(!Z)return i.step;let K;return B==="datetime"?K=parseInt(Z.substr(14,2),10):B==="time"&&(K=parseInt(Z.slice(-2),10)),K%i.step===0?i.step:U},[B,Z,i.step,U]),O=(0,r.useMemo)(()=>{if(P){const K=E.get(P);return r.lazy(K.components.Input)}return null},[P,E]);if(Q===!1)return null;if(!G)return r.createElement(g.NotAllowedInput,{description:$?{id:$,defaultMessage:$}:null,intlLabel:{id:w,defaultMessage:w},labelAction:l,error:I&&h(I),name:a,required:M});if(C==="relation")return r.createElement(ta,Xf(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:q,isUserAllowedToReadField:S,name:a,placeholder:i.placeholder?{id:i.placeholder,defaultMessage:i.placeholder}:null,queryInfos:m,value:f,error:I&&h(I)}));const _=nr({json:Im,uid:Um,media:y.media,wysiwyg:um},y);return P&&(_[P]=O),r.createElement(g.GenericInput,{attribute:t,autoComplete:"new-password",intlLabel:{id:w,defaultMessage:w},isNullable:B==="bool"&&[null,void 0].includes(t.default),description:$?{id:$,defaultMessage:$}:null,disabled:W,error:I,labelAction:l,contentTypeUID:b.uid,customInputs:_,multiple:t.multiple||!1,name:a,onChange:u,options:ee,placeholder:Y?{id:Y,defaultMessage:Y}:null,required:t.required||!1,step:x,type:P||B,value:Z,withDefaultValue:!1})}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 eg=(0,r.memo)(rr,We()),or=Wf(eg,Gf),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(le.Grid,{gap:4,key:c},u.map(({name:d,size:m,metadatas:f,fieldSchema:y,queryInfos:h})=>{const b=y.type==="component",E=`${s}.${d}`;if(b){const F=y.component;return r.createElement(le.GridItem,{col:m,s:12,xs:12,key:d},r.createElement(Yt,{componentUid:F,intlLabel:{id:f.label,defaultMessage:f.label},isNested:!0,isRepeatable:y.repeatable,max:y.max,min:y.min,name:E,required:y.required||!1}))}return r.createElement(le.GridItem,{col:m,key:d,s:12,xs:12},r.createElement(or,{keys:E,fieldSchema:y,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 tg=sr;var la=p(74201),ng=p(59290),ut=p.n(ng),rg=Object.defineProperty,ca=Object.getOwnPropertySymbols,og=Object.prototype.hasOwnProperty,sg=Object.prototype.propertyIsEnumerable,ua=(e,t,n)=>t in e?rg(e,t,{enumerable:!0,configurable:!0,writable:!0,value:n}):e[t]=n,da=(e,t)=>{for(var n in t||(t={}))og.call(t,n)&&ua(e,n,t[n]);if(ca)for(var n of ca(t))sg.call(t,n)&&ua(e,n,t[n]);return e};function ag(e,t){return n=>{const s=t(n);return r.createElement(e,da(da({},n),s))}}const ig=ag;function lg(){const{addRepeatableComponentToField:e,formErrors:t}=(0,g.useCMEditViewDataManager)();return{addRepeatableComponentToField:e,formErrors:t}}const cg=lg;function ug(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),dg=p(41119),pa=p.n(dg),ar=p(44826);const pg=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
|
-
`,mg=()=>r.createElement(pg,{padding:6,background:"primary100"});var fg=p(78752);const gg=(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
|
-
`,ma=(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
|
-
`,yg=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
|
-
`,hg=(0,k.default)(la.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
|
-
`,fa=({displayedValue:e})=>r.createElement(yg,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(fg.Icon,{as:so(),width:`${8/16}rem}`,color:"neutral600"})),r.createElement(hg,{onClick:()=>{},flex:1},r.createElement(L.Typography,{fontWeight:"bold",textColor:"neutral700"},e))),r.createElement(se.Stack,{horizontal:!0,spacing:0},r.createElement(ma,{noBorder:!0,onClick:()=>{},icon:r.createElement(Be(),null)}),r.createElement(ma,{icon:r.createElement(Xe(),null),noBorder:!0})));fa.propTypes={displayedValue:o().string.isRequired};const bg=fa;var Eg=Object.defineProperty,ga=Object.getOwnPropertySymbols,vg=Object.prototype.hasOwnProperty,Cg=Object.prototype.propertyIsEnumerable,ya=(e,t,n)=>t in e?Eg(e,t,{enumerable:!0,configurable:!0,writable:!0,value:n}):e[t]=n,ha=(e,t)=>{for(var n in t||(t={}))vg.call(t,n)&&ya(e,n,t[n]);if(ga)for(var n of ga(t))Cg.call(t,n)&&ya(e,n,t[n]);return e};function Pg(e,t){return n=>{const s=t(n);return r.createElement(e,ha(ha({},n),s))}}const Og=Pg;function Rg({schema:e,componentFieldName:t}){const{checkFormErrors:n,modifiedData:s,moveComponentField:a,removeRepeatableField:l,triggerFormValidation:i}=(0,g.useCMEditViewDataManager)(),u=(0,r.useMemo)(()=>(0,N.get)(e,["settings","mainField"],"id"),[e]);return{displayedValue:(0,N.toString)((0,N.get)(s,[...t.split("."),u],"")),mainField:u,checkFormErrors:n,moveComponentField:a,removeRepeatableField:l,schema:e,triggerFormValidation:i}}const Mg=Rg,Tg=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:y,displayedValue:h})=>{const b=(0,r.useRef)(null),E=(0,r.useRef)(null),[,F]=(0,r.useState)(!1),{formatMessage:C}=(0,A.useIntl)(),P=u.layouts.edit,[,I]=(0,Te.useDrop)({accept:Oe.COMPONENT,canDrop(){return!1},hover(U,q){if(!E.current)return;const S=U.originalPath,G=e,W=S.split("."),ee=W.slice().splice(-1).join(""),w=G.split(".").splice(-1).join(""),$=W.slice(0,W.length-1),Y=parseInt(ee,10),Q=parseInt(w,10);if(Y===Q)return;const x=E.current.getBoundingClientRect(),O=(x.bottom-x.top)/2,K=q.getClientOffset().y-x.top;Y<Q&&K<O||Y>Q&&K>O||S.split(".").length===G.split(".").length&&(d($,Y,Q),U.originalPath=G)}}),[{isDragging:R},z,M]=(0,Te.useDrag)({type:Oe.COMPONENT,item(){return c(-1),{displayedValue:h,originalPath:e}},end(){y(),f(!1)},collect:U=>({isDragging:U.isDragging()})});(0,r.useEffect)(()=>{M((0,Kt.rX)(),{captureDraggingState:!1})},[M]),(0,r.useEffect)(()=>{R&&f(!0)},[R,f]),(0,r.useEffect)(()=>{s||F(U=>!U)},[s]);const V={dragRef:z(b),dropRef:I(E)},B=pa()(h),Z=n?"error":void 0;return r.createElement(D.Box,{ref:V?V.dropRef:null},R&&r.createElement(mg,null),!R&&s&&r.createElement(bg,{displayedValue:B,componentFieldName:e}),!R&&!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(gg,{expanded:a,noBorder:!0,onClick:()=>{m(e),c()},label:C({id:v("containers.Edit.delete"),defaultMessage:"Delete"}),icon:r.createElement(Be(),null)}),r.createElement(ar.Tooltip,{description:C({id:v("components.DragHandle-label"),defaultMessage:"Drag"})},r.createElement(Tg,{role:"button",tabIndex:-1,ref:V.dragRef,onClick:U=>U.stopPropagation()},r.createElement(Xe(),null)))),title:B,togglePosition:"left"}),r.createElement(ze.AccordionContent,null,r.createElement(se.Stack,{background:"neutral100",padding:6,spacing:6},P.map((U,q)=>r.createElement(le.Grid,{gap:4,key:q},U.map(({name:S,fieldSchema:G,metadatas:W,queryInfos:ee,size:w})=>{const $=G.type==="component",Y=`${e}.${S}`;if($){const Q=G.component;return r.createElement(le.GridItem,{col:w,s:12,xs:12,key:S},r.createElement(Yt,{componentUid:Q,intlLabel:{id:W.label,defaultMessage:W.label},isRepeatable:G.repeatable,isNested:!0,name:Y,max:G.max,min:G.min,required:G.required}))}return r.createElement(le.GridItem,{key:Y,col:w,s:12,xs:12},r.createElement(or,{fieldSchema:G,keys:Y,metadatas:W,queryInfos:ee}))})))))))};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 wg=(0,r.memo)(ir),Ig=Og(wg,Mg);var ba=p(87910),Dg=Object.defineProperty,Ea=Object.getOwnPropertySymbols,xg=Object.prototype.hasOwnProperty,Sg=Object.prototype.propertyIsEnumerable,va=(e,t,n)=>t in e?Dg(e,t,{enumerable:!0,configurable:!0,writable:!0,value:n}):e[t]=n,Lg=(e,t)=>{for(var n in t||(t={}))xg.call(t,n)&&va(e,n,t[n]);if(Ea)for(var n of Ea(t))Sg.call(t,n)&&va(e,n,t[n]);return e};const Fg=(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
|
-
`,kg=(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
|
-
`,Ag=(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(ba.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(Ag,{paddingLeft:1},s)),r.createElement(kg,{footer:t},i),t&&r.createElement(Fg,null,t),a&&r.createElement(D.Box,{paddingTop:1},r.createElement(L.Typography,{variant:"pi",textColor:"danger600"},l({id:a.id,defaultMessage:a.id},Lg({},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 jg=lr,$g=(0,k.default)(la.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,g.useNotification)(),{formatMessage:m}=(0,A.useIntl)(),[f,y]=(0,r.useState)(""),[h,b]=(0,r.useState)(!1),[,E]=(0,Te.useDrop)({accept:Oe.COMPONENT}),{getComponentLayout:F}=lt(),C=(0,r.useMemo)(()=>F(n),[n,F]),P=(0,r.useMemo)(()=>Mo(s||[])+1,[s]),I=ug(c,t),R=()=>{y("")},z=u-a,M=T()(t,c,{id:""}).id.includes("min"),V=(0,r.useCallback)(()=>{l||(a<i?(e(c,n,M),y(P)):a>=i&&d({type:"info",message:{id:v("components.notification.info.maximum-requirement")}}))},[e,n,a,M,l,i,c,P,d]);let B=t[c];return M&&(B={id:v("components.DynamicZone.missing-components"),defaultMessage:"There {number, plural, =0 {are # missing components} one {is # missing component} other {are # missing components}}",values:{number:z}}),a===0?r.createElement(ds,{error:B,isReadOnly:l,onClick:V}):(I.some(U=>U.split(".").length>1)&&!M&&(B={id:v("components.RepeatableComponent.error-message"),defaultMessage:"The component(s) contain error(s)"}),r.createElement(D.Box,{hasRadius:!0,ref:E},r.createElement(jg,{error:B,footer:r.createElement(j.Flex,{justifyContent:"center",height:"48px",background:"neutral0"},r.createElement($g,{disabled:l,onClick:V,startIcon:r.createElement(ut(),null)},m({id:v("containers.EditView.add.new-entry"),defaultMessage:"Add an entry"})))},s.map((U,q)=>{const S=U.__temp_key__,G=f===S,W=`${c}.${q}`,ee=I.includes(W);return r.createElement(Ig,{componentFieldName:W,componentUid:n,hasErrors:ee,hasMinError:M,isDraggingSibling:h,isOpen:G,isReadOnly:l,key:S,onClickToggle:()=>{y(G?"":S)},parentName:c,schema:C,setIsDraggingSibling:b,toggleCollapses:R})}))))};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 Bg=(0,r.memo)(cr),Ng=ig(Bg,cg);var Vg=Object.defineProperty,Ca=Object.getOwnPropertySymbols,qg=Object.prototype.hasOwnProperty,Wg=Object.prototype.propertyIsEnumerable,Pa=(e,t,n)=>t in e?Vg(e,t,{enumerable:!0,configurable:!0,writable:!0,value:n}):e[t]=n,Oa=(e,t)=>{for(var n in t||(t={}))qg.call(t,n)&&Pa(e,n,t[n]);if(Ca)for(var n of Ca(t))Wg.call(t,n)&&Pa(e,n,t[n]);return e};function zg(e,t){return n=>{const s=t(n);return r.createElement(e,Oa(Oa({},n),s))}}const Ug=zg;function Hg({isFromDynamicZone:e,name:t}){const{addNonRepeatableComponentToField:n,createActionAllowedFields:s,isCreatingEntry:a,modifiedData:l,removeComponentFromField:i,readActionAllowedFields:u,updateActionAllowedFields:c,formErrors:d}=(0,g.useCMEditViewDataManager)(),{contentType:m}=lt(),f=(0,r.useMemo)(()=>{const P=(0,N.get)(m,["attributes"],{});return Object.keys(P).filter(R=>(0,N.get)(P,[R,"type"],"")==="dynamiczone")},[m]),y=(0,r.useMemo)(()=>a?s:c,[a,s,c]),h=(0,N.get)(l,t,null),b=(0,r.useMemo)(()=>Ro(t),[t]),E=(0,r.useMemo)(()=>e&&a||y.filter(R=>R===b[0]).length>0?!0:y.map(R=>R.split(".")).filter(R=>R.length<b.length?!1:(0,N.take)(R,b.length).join(".")===b.join(".")).length>0,[e,a,y,b]),F=(0,r.useMemo)(()=>e||f.includes(b[0])?!0:(a?[]:u).map(R=>R.split(".")).filter(R=>R.length<b.length?!1:(0,N.take)(R,b.length).join(".")===b.join(".")).length>0,[e,f,b,a,u]),C=(0,r.useMemo)(()=>a||E?!1:F,[E,F,a]);return{addNonRepeatableComponentToField:n,formErrors:d,hasChildrenAllowedFields:E,hasChildrenReadableFields:F,isCreatingEntry:a,isReadOnly:C,removeComponentFromField:i,componentValue:h}}const _g=Hg,Gg=(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(Gg,{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 Zg=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:y,isReadOnly:h,componentValue:b,removeComponentFromField:E,required:F})=>{const{formatMessage:C}=(0,A.useIntl)(),P=Ed()(b),I=b!==null||a,R=!l&&I&&!a&&f;if(!f&&s)return r.createElement(g.NotAllowedInput,{labelAction:u,intlLabel:n,name:m});if(!f&&!s&&!y)return r.createElement(g.NotAllowedInput,{labelAction:u,intlLabel:n,name:m});const z=()=>{e(m,t)};return r.createElement(D.Box,null,r.createElement(j.Flex,{justifyContent:"space-between"},n&&r.createElement(Zg,{intlLabel:n,labelAction:u,name:m,numberOfEntries:P,showNumberOfEntries:l,required:F}),R&&r.createElement(Me.IconButton,{label:C({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&&!I&&r.createElement(ds,{isReadOnly:h,onClick:z}),!l&&I&&r.createElement(tg,{componentUid:t,isFromDynamicZone:a,isNested:i,name:m}),l&&r.createElement(Ng,{componentValue:b,componentValueLength:P,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 Qg=(0,r.memo)(dr,We()),Yt=Ug(Qg,_g),Kg=(0,k.default)(D.Box)`
|
|
927
|
-
width: ${({theme:e})=>e.spaces[2]};
|
|
928
|
-
height: ${({theme:e})=>e.spaces[4]};
|
|
929
|
-
`,Yg=()=>r.createElement(j.Flex,{justifyContent:"center"},r.createElement(Kg,{background:"neutral200"})),Jg=(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
|
-
`,Xg=(0,k.default)(D.Box)`
|
|
938
|
-
> div:first-child {
|
|
939
|
-
box-shadow: ${({theme:e})=>e.shadows.tableShadow};
|
|
940
|
-
}
|
|
941
|
-
`,ey=(0,k.default)(D.Box)`
|
|
942
|
-
border-radius: 0 0 ${({theme:e})=>e.spaces[1]} ${({theme:e})=>e.spaces[1]};
|
|
943
|
-
`,Ra=({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:y}=(0,A.useIntl)(),{getComponentLayout:h}=lt(),{icon:b,friendlyName:E}=(0,r.useMemo)(()=>{const{info:{icon:Z,displayName:U}}=h(e);return{friendlyName:U,icon:Z}},[e,h]),F=()=>l(u,n),C=()=>i(u,n),P=()=>d(u,n),I=y({id:v("components.DynamicZone.move-down-label"),defaultMessage:"Move component down"}),R=y({id:v("components.DynamicZone.move-up-label"),defaultMessage:"Move component down"}),z=y({id:v("components.DynamicZone.delete-label"),defaultMessage:"Delete {name}"},{name:E}),V=Object.keys(t).filter(Z=>{const U=Z.split(".");return`${U[0]}.${U[1]}`==`${u}.${n}`});let B;return V.length>0&&(B=y({id:v("components.DynamicZone.error-message"),defaultMessage:"The component contains error(s)"})),r.createElement(D.Box,null,r.createElement(Yg,null),r.createElement(Xg,{hasRadius:!0},r.createElement(ze.Accordion,{expanded:s,onToggle:()=>c(n),size:"S",error:B},r.createElement(ze.AccordionToggle,{startIcon:r.createElement(Dn.G,{icon:b}),action:r.createElement(Jg,{horizontal:!0,spacing:0,expanded:s},m&&r.createElement(pr,{noBorder:!0,label:I,onClick:F,icon:r.createElement(gd(),null)}),f&&r.createElement(pr,{noBorder:!0,label:R,onClick:C,icon:r.createElement(hd(),null)}),a&&r.createElement(pr,{noBorder:!0,label:z,onClick:P,icon:r.createElement(Be(),null)})),title:E,togglePosition:"left"}),r.createElement(ze.AccordionContent,null,r.createElement(ey,{background:"neutral0"},r.createElement(r.Suspense,{fallback:r.createElement(j.Flex,{justifyContent:"center",paddingTop:4,paddingBottom:4},r.createElement(ls.Loader,null,"Loading content."))},r.createElement(xn.FocusTrap,{onEscape:()=>c(n)},r.createElement(Yt,{componentUid:e,icon:b,name:`${u}.${n}`,isFromDynamicZone:!0}))))))))};Ra.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 ty=(0,r.memo)(Ra,We());var ny=p(81346),ry=p.n(ny);const Ma=(0,k.default)(Dn.G)`
|
|
944
|
-
width: ${(0,g.pxToRem)(32)} !important;
|
|
945
|
-
height: ${(0,g.pxToRem)(32)} !important;
|
|
946
|
-
padding: ${(0,g.pxToRem)(9)};
|
|
947
|
-
border-radius: ${(0,g.pxToRem)(64)};
|
|
948
|
-
background: ${({theme:e})=>e.colors.neutral150};
|
|
949
|
-
path {
|
|
950
|
-
fill: ${({theme:e})=>e.colors.neutral500};
|
|
951
|
-
}
|
|
952
|
-
`,oy=(0,k.default)(D.Box)`
|
|
953
|
-
flex-shrink: 0;
|
|
954
|
-
height: ${(0,g.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
|
-
${Ma} {
|
|
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(oy,{borderRadius:"borderRadius"},r.createElement(se.Stack,{spacing:1,style:{justifyContent:"center",alignItems:"center"}},r.createElement(Ma,{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 sy=mr,ay=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
|
-
`,Ta=({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(ay,null,t.map(({componentUid:c,info:{displayName:d,icon:m}})=>r.createElement(sy,{key:c,componentUid:c,intlLabel:{id:d,defaultMessage:d},icon:m,onClick:a}))))))};Ta.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 iy=Ta,wa=({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(y=>{const{category:h,info:b}=a(y);return{componentUid:y,category:h,info:b}}),f=ry()(m,"category");return Object.keys(f).reduce((y,h)=>(y.push({category:h,components:f[h]}),y),[])},[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(ba.KeyboardNavigable,{attributeName:"data-strapi-accordion-toggle"},u.map(({category:m,components:f},y)=>r.createElement(iy,{key:m,category:m,components:f,isOdd:y%2===1,isOpen:m===l,onAddComponent:c,onToggle:d})))))):null};wa.propTypes={components:o().array.isRequired,isOpen:o().bool.isRequired,onClickAddComponent:o().func.isRequired};const ly=(0,r.memo)(wa);var cy=Object.defineProperty,uy=Object.defineProperties,dy=Object.getOwnPropertyDescriptors,Ia=Object.getOwnPropertySymbols,py=Object.prototype.hasOwnProperty,my=Object.prototype.propertyIsEnumerable,Da=(e,t,n)=>t in e?cy(e,t,{enumerable:!0,configurable:!0,writable:!0,value:n}):e[t]=n,fy=(e,t)=>{for(var n in t||(t={}))py.call(t,n)&&Da(e,n,t[n]);if(Ia)for(var n of Ia(t))my.call(t,n)&&Da(e,n,t[n]);return e},gy=(e,t)=>uy(e,dy(t));const xa=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:y})=>{const h=(0,g.useNotification)(),[b,E]=(0,r.useState)(!1),[F,C]=(0,r.useState)(!1),P=m.length,I=y.description?{id:y.description,defaultMessage:y.description}:null,[R,z]=(0,r.useState)(xa(P));(0,r.useEffect)(()=>{z(xa(P))},[P]),(0,r.useEffect)(()=>{F&&(z(x=>x.map((O,_)=>_===x.length-1?gy(fy({},O),{isOpen:!0}):O)),C(!1))},[F]);const{max:M=1/0,min:V=-1/0}=f,B=(0,r.useMemo)(()=>Object.keys(n).filter(x=>x===e).map(x=>n[x]),[n,e]),Z=(0,r.useMemo)(()=>f.components||[],[f]),U=V-P,q=B.length>0,S=B.length>0&&T()(B,[0,"id"],"").includes("min"),G=q&&T()(B,[0,"id"],"")==="components.Input.error.validation.max",W=(0,r.useCallback)(x=>{E(!1),t(e,x,q),C(!0)},[t,q,e]),ee=()=>{P<M?E(x=>!x):h({type:"info",message:{id:v("components.notification.info.maximum-requirement")}})},w=x=>{z(O=>O.map(({isOpen:_},K)=>K===x?{isOpen:!_}:{isOpen:_}))},$=(x,O)=>{c(x,O),z(_=>_.map(({isOpen:K},ae,ce)=>ae===O+1?{isOpen:ce[O].isOpen}:ae===O?{isOpen:ce[ae+1].isOpen}:{isOpen:K}))},Y=(x,O)=>{u(x,O),z(_=>_.map(({isOpen:K},ae,ce)=>ae===O-1?{isOpen:ce[O].isOpen}:ae===O?{isOpen:ce[ae-1].isOpen}:{isOpen:K}))},Q=(x,O)=>{d(x,O)};return!a&&s?r.createElement(g.NotAllowedInput,{description:I,intlLabel:{id:y.label,defaultMessage:y.label},labelAction:i,name:e}):!a&&!l&&!s?r.createElement(g.NotAllowedInput,{description:I,intlLabel:{id:y.label,defaultMessage:y.label},labelAction:i,name:e}):r.createElement(se.Stack,{spacing:6},P>0&&r.createElement(D.Box,null,r.createElement(md,{intlDescription:I,label:y.label,labelAction:i,name:e,numberOfComponents:P,required:f.required||!1}),m.map((x,O)=>{var _;const K=a&&P>0&&O<P-1,ae=a&&P>0&&O>0,ce=((_=R[O])==null?void 0:_.isOpen)||!1;return r.createElement(ty,{componentUid:x,formErrors:n,key:O,index:O,isOpen:ce,isFieldAllowed:a,moveComponentDown:$,moveComponentUp:Y,onToggle:w,name:e,removeComponentFromDynamicZone:Q,showDownIcon:K,showUpIcon:ae})})),r.createElement(dd,{hasError:q,hasMaxError:G,hasMinError:S,isDisabled:!a,label:y.label,missingComponentNumber:U,isOpen:b,name:e,onClick:ee}),r.createElement(ly,{isOpen:b,components:Z,onClickAddComponent:W}))};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 yy=(0,r.memo)(fr,We()),hy=sd(yy,id);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}),Sa=()=>({type:tt.c2}),La=(e,t)=>({type:tt.w7,componentsDataStructure:e,contentTypeDataStructure:t}),he=e=>({type:tt.d0,status:e}),_e=e=>({type:tt.t9,data:e}),Fa=e=>e["content-manager_editViewCrudReducer"];var by=p(98399),Ey=Object.defineProperty,ka=Object.getOwnPropertySymbols,vy=Object.prototype.hasOwnProperty,Cy=Object.prototype.propertyIsEnumerable,Aa=(e,t,n)=>t in e?Ey(e,t,{enumerable:!0,configurable:!0,writable:!0,value:n}):e[t]=n,Py=(e,t)=>{for(var n in t||(t={}))vy.call(t,n)&&Aa(e,n,t[n]);if(ka)for(var n of ka(t))Cy.call(t,n)&&Aa(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,g.useNotification)(),{setCurrentStep:i}=(0,g.useGuidedTour)(),{trackUsage:u}=(0,g.useTracking)(),{push:c,replace:d}=(0,X.useHistory)(),[{rawQuery:m}]=(0,g.useQueryParams)(),f=(0,fe.useDispatch)(),{componentsDataStructure:y,contentTypeDataStructure:h,data:b,isLoading:E,status:F}=(0,fe.useSelector)(Fa),C=Zo(n),P=(0,r.useRef)(!0),I=(0,r.useRef)(u),R=(0,r.useRef)(e),z=s===null,M=(0,r.useMemo)(()=>z&&!a?null:ve(`collection-types/${n}/${a||s}`),[n,s,z,a]),V=(0,r.useCallback)(w=>a?(0,g.contentManagementUtilRemoveFieldsFromData)(w,R.current.contentType,R.current.components):w,[a]),B=(0,r.useCallback)(w=>{const $=Fo(w,R.current.contentType,R.current.components);return(0,g.formatContentTypeData)($,R.current.contentType,R.current.components)},[]);(0,r.useEffect)(()=>{const w=Object.keys(e.components).reduce((Q,x)=>{const O=$t(T()(e,["components",x,"attributes"],{}),e.components);return Q[x]=(0,g.formatContentTypeData)(O,e.components[x],e.components),Q},{}),$=$t(e.contentType.attributes,e.components),Y=(0,g.formatContentTypeData)($,e.contentType,e.components);f(La(w,Y))},[e,f]),(0,r.useEffect)(()=>()=>{f(Sa())},[f]),(0,r.useEffect)(()=>{const $=Se().CancelToken.source(),Y=x=>nt(void 0,null,function*(){f(Jt());try{const{data:O}=yield ge.be.get(M,{cancelToken:x.token});f(gr(B(V(O))))}catch(O){if(Se().isCancel(O))return;by.error(O);const _=T()(O,"response.status",null);if(_===404){c(C);return}_===403&&(l({type:"info",message:{id:v("permissions.not-allowed.update")}}),c(C))}}),Q=()=>nt(void 0,null,function*(){yield f(Jt()),yield f(yr(m))});return P.current?(M?Y($):Q(),()=>{$.cancel("Operation canceled by the user.")}):()=>{}},[V,B,c,M,f,m,C,l]);const Z=(0,r.useCallback)(w=>{const $=w.response.data;let Y=T()($,["error","message"],"Bad Request");Array.isArray(Y)&&(Y=T()(Y,["0","messages","0","id"])),typeof Y=="string"&&l({type:"warning",message:Y})},[l]),U=(0,r.useCallback)(w=>nt(void 0,null,function*(){try{I.current("willDeleteEntry",w);const{data:$}=yield ge.be.delete(ve(`collection-types/${n}/${s}`));return l({type:"success",message:{id:v("success.record.delete")}}),I.current("didDeleteEntry",w),Promise.resolve($)}catch($){return I.current("didNotDeleteEntry",Py({error:$},w)),Promise.reject($)}}),[s,n,l]),q=(0,r.useCallback)(()=>{d(C)},[C,d]),S=(0,r.useCallback)((w,$)=>nt(void 0,null,function*(){const Y=`${ve(`collection-types/${n}`)}${m}`;try{f(he("submit-pending"));const{data:Q}=yield ge.be.post(Y,w);return I.current("didCreateEntry",$),l({type:"success",message:{id:v("success.record.save")}}),i("contentManager.success"),f(_e(B(Q))),f(he("resolved")),d(`/content-manager/collectionType/${n}/${Q.id}${m}`),Promise.resolve(Q)}catch(Q){return Z(Q),I.current("didNotCreateEntry",{error:Q,trackerProperty:$}),f(he("resolved")),Promise.reject(Q)}}),[B,Z,d,n,f,m,l,i]),G=(0,r.useCallback)(()=>nt(void 0,null,function*(){try{I.current("willPublishEntry");const w=ve(`collection-types/${n}/${s}/actions/publish`);f(he("publish-pending"));const{data:$}=yield ge.be.post(w);return I.current("didPublishEntry"),f(_e(B($))),f(he("resolved")),l({type:"success",message:{id:v("success.record.publish")}}),Promise.resolve($)}catch(w){return Z(w),f(he("resolved")),Promise.reject(w)}}),[B,Z,s,n,f,l]),W=(0,r.useCallback)((w,$)=>nt(void 0,null,function*(){const Y=ve(`collection-types/${n}/${s}`);try{I.current("willEditEntry",$),f(he("submit-pending"));const{data:Q}=yield ge.be.put(Y,w);return I.current("didEditEntry",{trackerProperty:$}),l({type:"success",message:{id:v("success.record.save")}}),f(_e(B(Q))),f(he("resolved")),Promise.resolve(Q)}catch(Q){return I.current("didNotEditEntry",{error:Q,trackerProperty:$}),Z(Q),f(he("resolved")),Promise.reject(Q)}}),[B,Z,n,s,f,l]),ee=(0,r.useCallback)(()=>nt(void 0,null,function*(){const w=ve(`collection-types/${n}/${s}/actions/unpublish`);f(he("unpublish-pending"));try{I.current("willUnpublishEntry");const{data:$}=yield ge.be.post(w);return I.current("didUnpublishEntry"),l({type:"success",message:{id:v("success.record.unpublish")}}),f(_e(B($))),f(he("resolved")),Promise.resolve($)}catch($){return f(he("resolved")),Z($),Promise.reject($)}}),[B,Z,s,n,f,l]);return t({componentsDataStructure:y,contentTypeDataStructure:h,data:b,isCreatingEntry:z,isLoadingForData:E,onDelete:U,onDeleteSucceeded:q,onPost:S,onPublish:G,onPut:W,onUnpublish:ee,status:F,redirectionLink:C})};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 Oy=(0,r.memo)(hr,We());var Ry=p(89793),Xt=p.n(Ry),My=p(56236),Ty=p.n(My);const br=(e,t,n,s)=>{const a=e.slice();return a.splice(t,1),a.splice(n,0,s),a},wy=(e,t,n)=>{const s=(i,u)=>T()(i,["attributes",u,"type"],""),a=(i,u)=>T()(i,["attributes",...u],""),l=(i,u)=>Object.keys(i).reduce((c,d)=>{const m=s(u,d),f=T()(i,d),y=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=T()(f,0)instanceof File?null:T()(f,"id",null);break;case"component":h?b=f&&f.map(E=>l(E,n[y])):b=f&&l(f,n[y]);break;case"dynamiczone":b=f.map(E=>l(E,n[E.__component]));break;default:b=Iy(f,"id")}return c[d]=b,c},{});return l(e,t)},Iy=(e,t)=>Bs()(e)?e.map(n=>n[t]?n[t]:n):Uo()(e)?e[t]:e,Dy=wy;var xy=p(51355),Sy=p.n(xy),Ly=p(95919),Fy=p.n(Ly),ky=p(78746),dt=p.n(ky),be=p(5173);function wt(e){return["integer","biginteger","decimal","float","number"].includes(e)}var Ay=Object.defineProperty,jy=Object.defineProperties,$y=Object.getOwnPropertyDescriptors,ja=Object.getOwnPropertySymbols,By=Object.prototype.hasOwnProperty,Ny=Object.prototype.propertyIsEnumerable,$a=(e,t,n)=>t in e?Ay(e,t,{enumerable:!0,configurable:!0,writable:!0,value:n}):e[t]=n,Ba=(e,t)=>{for(var n in t||(t={}))By.call(t,n)&&$a(e,n,t[n]);if(ja)for(var n of ja(t))Ny.call(t,n)&&$a(e,n,t[n]);return e},Na=(e,t)=>jy(e,$y(t));be.kM(be.nK,"defined",function(){return this.test("defined",g.translatedErrors.required,e=>e!==void 0)}),be.kM(be.IX,"notEmptyMin",function(e){return this.test("notEmptyMin",g.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 Vy=e=>T()(e,["attributes"],{}),Er=(e,{components:t},n={isCreatingEntry:!0,isDraft:!0,isFromComponent:!1})=>{const s=Vy(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=qy(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},Na(Ba({},n),{isFromComponent:!0}));if(i.repeatable===!0){const{min:d,max:m,required:f}=i;let y=be.Vo(h=>{let b=be.IX().of(u);return d?f?b=b.min(d,g.translatedErrors.min):f!==!0&&Re()(h)?b=b.nullable():b=b.min(d,g.translatedErrors.min):f&&!n.isDraft&&(b=b.min(1,g.translatedErrors.required)),m&&(b=b.max(m,g.translatedErrors.max)),b});return a[l]=y,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},Na(Ba({},n),{isFromComponent:!0}))));const{max:c,min:d}=i;d?i.required?u=u.test("min",g.translatedErrors.min,m=>n.isCreatingEntry?m&&m.length>=d:m===void 0?!0:m!==null&&m.length>=d).test("required",g.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",g.translatedErrors.required,m=>n.isCreatingEntry?m!==null||m!==void 0:m===void 0?!0:m!==null)),c&&(u=u.max(c,g.translatedErrors.max)),a[l]=u}return a},{}))},qy=(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(g.translatedErrors.json).test("isJSON",g.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(g.translatedErrors.email)),["number","integer","float","decimal"].includes(e)&&(s=be.Rx().transform(a=>Fy()(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||!Sy()(l)&&Number.isInteger(Math.floor(l))||l===0)switch(a){case"required":{n.isDraft||(e==="password"&&n.isCreatingEntry&&(s=s.required(g.translatedErrors.required)),e!=="password"&&(n.isCreatingEntry?s=s.required(g.translatedErrors.required):s=s.test("required",g.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(g.translatedErrors.max,l):s=s.max(l,g.translatedErrors.max);break}case"maxLength":s=s.max(l,g.translatedErrors.maxLength);break;case"min":{e==="biginteger"?s=s.isSuperior(g.translatedErrors.min,l):s=s.min(l,g.translatedErrors.min);break}case"minLength":{n.isDraft||(s=s.min(l,g.translatedErrors.minLength));break}case"regex":s=s.matches(new RegExp(l),{message:g.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},Va=Er;var Wy=Object.defineProperty,zy=Object.defineProperties,Uy=Object.getOwnPropertyDescriptors,qa=Object.getOwnPropertySymbols,Hy=Object.prototype.hasOwnProperty,_y=Object.prototype.propertyIsEnumerable,Wa=(e,t,n)=>t in e?Wy(e,t,{enumerable:!0,configurable:!0,writable:!0,value:n}):e[t]=n,za=(e,t)=>{for(var n in t||(t={}))Hy.call(t,n)&&Wa(e,n,t[n]);if(qa)for(var n of qa(t))_y.call(t,n)&&Wa(e,n,t[n]);return e},Ua=(e,t)=>zy(e,Uy(t));const Gy={componentsDataStructure:{},contentTypeDataStructure:{},formErrors:{},initialData:{},modifiedData:null,shouldCheckErrors:!1,modifiedDZName:null},Zy=(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=T()(e,["modifiedData",...t.keys],[]).slice();const a=Ua(za({},e.componentsDataStructure[t.componentUid]),{__temp_key__:Mo(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=Ua(za({},e.componentsDataStructure[t.componentUid]),{__component:t.componentUid}),a=T()(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=T()(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=T()(e,["modifiedData",...t.pathToComponent]),a=T()(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=T()(e,["modifiedData",...t.keys],[]).slice(),a=T()(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&&T()(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":{Ty()(n,["modifiedData",...t.keys]);break}case"REMOVE_REPEATABLE_FIELD":{const s=t.keys.length-1,a=["modifiedData",...Gt()(t.keys,s)];Object.keys(e.formErrors).length>0&&(n.shouldCheckErrors=!e.shouldCheckErrors);const i=T()(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",...Gt()(s,a)],i=T()(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 Qy=Object.defineProperty,Ha=Object.getOwnPropertySymbols,Ky=Object.prototype.hasOwnProperty,Yy=Object.prototype.propertyIsEnumerable,_a=(e,t,n)=>t in e?Qy(e,t,{enumerable:!0,configurable:!0,writable:!0,value:n}):e[t]=n,en=(e,t)=>{for(var n in t||(t={}))Ky.call(t,n)&&_a(e,n,t[n]);if(Ha)for(var n of Ha(t))Yy.call(t,n)&&_a(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:y,onPublish:h,onPut:b,onUnpublish:E,readActionAllowedFields:F,redirectToPreviousPage:C,slug:P,status:I,updateActionAllowedFields:R})=>{const[z,M]=(0,r.useReducer)(Zy,Gy),{formErrors:V,initialData:B,modifiedData:Z,modifiedDZName:U,shouldCheckErrors:q}=z,S=(0,g.useNotification)(),{lockApp:G,unlockApp:W}=(0,g.useOverlayBlocker)(),ee=T()(e,["contentType"],{}),w=(0,r.useMemo)(()=>T()(ee,["options","draftAndPublish"],!1),[ee]),$=(0,r.useMemo)(()=>w&&!B.publishedAt,[w,B.publishedAt]),{trackUsage:Y}=(0,g.useTracking)(),{formatMessage:Q}=(0,A.useIntl)(),x=(0,r.useRef)(Y),O=(0,r.useMemo)(()=>m||d?!1:t===!1&&n===!1,[m,d,t,n]);(0,r.useEffect)(()=>{I==="resolved"?W():G()},[G,W,I]),(0,r.useEffect)(()=>{m||rt()},[q]),(0,r.useEffect)(()=>{const re=Object.keys(V);if(re.length>0){const J=re[0],ue=document.getElementById(J);ue&&ue.focus()}},[V]),(0,r.useEffect)(()=>{O&&S({type:"info",message:{id:v("permissions.not-allowed.update")}})},[O,S]),(0,r.useEffect)(()=>{M({type:"SET_DEFAULT_DATA_STRUCTURES",componentsDataStructure:a,contentTypeDataStructure:l})},[a,l]),(0,r.useEffect)(()=>{c&&M({type:"INIT_FORM",initialValues:c})},[c]);const _=(0,r.useCallback)((re,J,ue=!1)=>{x.current("didAddComponentToDynamicZone"),M({type:"ADD_COMPONENT_TO_DYNAMIC_ZONE",keys:re.split("."),componentUid:J,shouldCheckErrors:ue})},[]),K=(0,r.useCallback)((re,J)=>{M({type:"ADD_NON_REPEATABLE_COMPONENT_TO_FIELD",keys:re.split("."),componentUid:J})},[]),ae=(0,r.useCallback)(({target:{name:re,value:J}})=>{M({type:"ADD_RELATION",keys:re.split("."),value:J})},[]),ce=(0,r.useCallback)((re,J,ue=!1)=>{M({type:"ADD_REPEATABLE_COMPONENT_TO_FIELD",keys:re.split("."),componentUid:J,shouldCheckErrors:ue})},[]),Fe=(0,r.useMemo)(()=>{const re={isCreatingEntry:d,isDraft:$,isFromComponent:!1};return Va(ee,{components:e.components||{}},re)},[e.components,ee,d,$]),rt=(0,r.useCallback)((...re)=>vr(void 0,[...re],function*(J={}){let ue={};const ot=qe()(Z);Re()(ot)||ne()(ot,J.path,J.value);try{yield Fe.validate(ot,{abortEarly:!1})}catch(yn){ue=(0,g.getYupInnerErrors)(yn),U&&(ue=Object.keys(ue).reduce((hc,ro)=>(ro.split(".")[0]!==U&&(hc[ro]=ue[ro]),hc),{}))}M({type:"SET_FORM_ERRORS",errors:ue})}),[U,Z,Fe]),H=(0,r.useCallback)(({target:{name:re,value:J,type:ue}},ot=!1)=>{let yn=J;if(["text","textarea","string","email","uid","select","select-one","number"].includes(ue)&&!J&&J!==0&&(yn=null),ue==="password"&&!J){M({type:"REMOVE_PASSWORD_FIELD",keys:re.split(".")});return}M({type:"ON_CHANGE",keys:re.split("."),value:yn,shouldSetInitialValue:ot})},[]),pe=(0,r.useCallback)(re=>{const J=lu(qe()(re),"__temp_key__");return Dy(J,ee,e.components)},[e.components,ee]),je=(0,r.useMemo)(()=>w?$?{status:"draft"}:{}:{},[w,$]),Ue=(0,r.useCallback)(re=>vr(void 0,null,function*(){re.preventDefault();let J={};try{yield Fe.validate(Z,{abortEarly:!1})}catch(ue){J=(0,g.getYupInnerErrors)(ue)}try{if(Re()(J)){const ue=pe(Z);d?yield y(ue,je):yield b(ue,je)}}catch(ue){J=en(en({},J),(0,g.getAPIInnerErrors)(ue,{getTrad:v}))}M({type:"SET_FORM_ERRORS",errors:J})}),[pe,d,Z,y,b,je,Fe]),ht=(0,r.useCallback)(()=>vr(void 0,null,function*(){const re=Va(ee,{components:T()(e,"components",{})},{isCreatingEntry:d,isDraft:!1,isFromComponent:!1});let J={};try{yield re.validate(Z,{abortEarly:!1})}catch(ue){J=(0,g.getYupInnerErrors)(ue)}try{Re()(J)&&(yield h())}catch(ue){J=en(en({},J),(0,g.getAPIInnerErrors)(ue,{getTrad:v}))}M({type:"SET_FORM_ERRORS",errors:J})}),[e,ee,d,Z,h]),Ze=(0,r.useCallback)(re=>{const J=Object.keys(V).some(ot=>ot.split(".")[0]===re);return!Re()(V)&&J},[V]),Xr=(0,r.useCallback)((re,J)=>{x.current("changeComponentsOrder"),M({type:"MOVE_COMPONENT_DOWN",dynamicZoneName:re,currentIndex:J,shouldCheckErrors:Ze(re)})},[Ze]),eo=(0,r.useCallback)((re,J)=>{x.current("changeComponentsOrder"),M({type:"MOVE_COMPONENT_UP",dynamicZoneName:re,currentIndex:J,shouldCheckErrors:Ze(re)})},[Ze]),Ce=(0,r.useCallback)((re,J,ue)=>{M({type:"MOVE_COMPONENT_FIELD",pathToComponent:re,dragIndex:J,hoverIndex:ue})},[]),$e=(0,r.useCallback)((re,J,ue)=>{M({type:"MOVE_FIELD",dragIndex:re,overIndex:J,keys:ue.split(".")})},[]),Qe=(0,r.useCallback)(re=>{M({type:"REMOVE_RELATION",keys:re})},[]),to=(0,r.useCallback)((re,J)=>{x.current("removeComponentFromDynamicZone"),M({type:"REMOVE_COMPONENT_FROM_DYNAMIC_ZONE",dynamicZoneName:re,index:J,shouldCheckErrors:Ze(re)})},[Ze]),Ke=(0,r.useCallback)((re,J)=>{M({type:"REMOVE_COMPONENT_FROM_FIELD",keys:re.split("."),componentUid:J})},[]),gn=(0,r.useCallback)((re,J)=>{M({type:"REMOVE_REPEATABLE_FIELD",keys:re.split("."),componentUid:J})},[]),no=(0,r.useCallback)(()=>{M({type:"TRIGGER_FORM_VALIDATION"})},[]);return O?r.createElement(X.Redirect,{to:u}):Z?r.createElement(g.ContentManagerEditViewDataManagerContext.Provider,{value:{addComponentToDynamicZone:_,addNonRepeatableComponentToField:K,addRelation:ae,addRepeatableComponentToField:ce,allLayoutData:e,checkFormErrors:rt,createActionAllowedFields:i,formErrors:V,hasDraftAndPublish:w,initialData:B,isCreatingEntry:d,isSingleType:f,shouldNotRunValidations:$,status:I,layout:ee,modifiedData:Z,moveComponentDown:Xr,moveComponentField:Ce,moveComponentUp:eo,moveRelation:$e,onChange:H,onPublish:ht,onUnpublish:E,onRemoveRelation:Qe,readActionAllowedFields:F,redirectToPreviousPage:C,removeComponentFromDynamicZone:to,removeComponentFromField:Ke,removeRepeatableField:gn,slug:P,triggerFormValidation:no,updateActionAllowedFields:R}},r.createElement(r.Fragment,null,m||!d&&!B.id?r.createElement(oe.Main,{"aria-busy":"true"},r.createElement(g.LoadingIndicatorPage,null)):r.createElement(r.Fragment,null,r.createElement(X.Prompt,{when:!Xt()(Z,B),message:Q({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 Jy=Cr,pt=e=>ve(`single-types/${e}`),Xy=e=>Object.values(e||{}).reduce((t,n)=>Object.assign(t,n),{});var eh=Object.defineProperty,tn=Object.getOwnPropertySymbols,Ga=Object.prototype.hasOwnProperty,Za=Object.prototype.propertyIsEnumerable,Qa=(e,t,n)=>t in e?eh(e,t,{enumerable:!0,configurable:!0,writable:!0,value:n}):e[t]=n,Ka=(e,t)=>{for(var n in t||(t={}))Ga.call(t,n)&&Qa(e,n,t[n]);if(tn)for(var n of tn(t))Za.call(t,n)&&Qa(e,n,t[n]);return e},th=(e,t)=>{var n={};for(var s in e)Ga.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&&Za.call(e,s)&&(n[s]=e[s]);return n};const Ya=(e={})=>{const t=Ka(Ka({},e),Xy(e.plugins)),{plugins:n,_q:s}=t,a=th(t,["plugins","_q"]);return s&&ne()(a,"_q",encodeURIComponent(s)),`${(0,Ne.stringify)(a,{encode:!1,addQueryPrefix:!0})}`};var nh=Object.defineProperty,Ja=Object.getOwnPropertySymbols,rh=Object.prototype.hasOwnProperty,oh=Object.prototype.propertyIsEnumerable,Xa=(e,t,n)=>t in e?nh(e,t,{enumerable:!0,configurable:!0,writable:!0,value:n}):e[t]=n,sh=(e,t)=>{for(var n in t||(t={}))rh.call(t,n)&&Xa(e,n,t[n]);if(Ja)for(var n of Ja(t))oh.call(t,n)&&Xa(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 ei=({allLayoutData:e,children:t,slug:n})=>{const{trackUsage:s}=(0,g.useTracking)(),{push:a}=(0,X.useHistory)(),{setCurrentStep:l}=(0,g.useGuidedTour)(),i=(0,r.useRef)(s),[u,c]=(0,r.useState)(!0),[{query:d,rawQuery:m}]=(0,g.useQueryParams)(),f=Ya(d),y=(0,g.useNotification)(),h=(0,fe.useDispatch)(),{componentsDataStructure:b,contentTypeDataStructure:E,data:F,isLoading:C,status:P}=(0,fe.useSelector)(Fa),I=(0,r.useCallback)(q=>{const S=Fo(q,e.contentType,e.components);return(0,g.formatContentTypeData)(S,e.contentType,e.components)},[e]);(0,r.useEffect)(()=>()=>{h(Sa())},[h]),(0,r.useEffect)(()=>{const q=Object.keys(e.components).reduce((W,ee)=>{const w=$t(T()(e,["components",ee,"attributes"],{}),e.components);return W[ee]=(0,g.formatContentTypeData)(w,e.components[ee],e.components),W},{}),S=$t(e.contentType.attributes,e.components),G=(0,g.formatContentTypeData)(S,e.contentType,e.components);h(La(q,G))},[e,h]),(0,r.useEffect)(()=>{const S=Se().CancelToken.source();return(W=>mt(void 0,null,function*(){h(Jt()),c(!0);try{const{data:ee}=yield(0,ge.be)(pt(`${n}${f}`),{cancelToken:W.token});h(gr(I(ee))),c(!1)}catch(ee){if(Se().isCancel(ee))return;const w=T()(ee,"response.status",null);w===404&&h(yr(m,!0)),w===403&&(y({type:"info",message:{id:v("permissions.not-allowed.update")}}),a("/"))}}))(S),()=>S.cancel("Operation canceled by the user.")},[I,a,n,h,f,m,y]);const R=(0,r.useCallback)(q=>{const S=q.response.data;let G=T()(S,["error","message"],"Bad Request");Array.isArray(G)&&(G=T()(G,["0","messages","0","id"])),typeof G=="string"&&y({type:"warning",message:G})},[y]),z=(0,r.useCallback)(q=>mt(void 0,null,function*(){try{i.current("willDeleteEntry",q);const{data:S}=yield ge.be.delete(pt(`${n}${f}`));return y({type:"success",message:{id:v("success.record.delete")}}),i.current("didDeleteEntry",q),Promise.resolve(S)}catch(S){return i.current("didNotDeleteEntry",sh({error:S},q)),R(S),Promise.reject(S)}}),[n,R,y,f]),M=(0,r.useCallback)(()=>{c(!0),h(yr(m,!0))},[h,m]),V=(0,r.useCallback)((q,S)=>mt(void 0,null,function*(){const G=pt(`${n}${m}`);try{h(he("submit-pending"));const{data:W}=yield ge.be.put(G,q);return i.current("didCreateEntry",S),y({type:"success",message:{id:v("success.record.save")}}),l("contentManager.success"),h(_e(I(W))),c(!1),h(he("resolved")),Promise.resolve(W)}catch(W){return i.current("didNotCreateEntry",{error:W,trackerProperty:S}),R(W),h(he("resolved")),Promise.reject(W)}}),[I,R,n,h,m,y,l]),B=(0,r.useCallback)(()=>mt(void 0,null,function*(){try{i.current("willPublishEntry");const q=pt(`${n}/actions/publish${f}`);h(he("publish-pending"));const{data:S}=yield ge.be.post(q);return i.current("didPublishEntry"),y({type:"success",message:{id:v("success.record.publish")}}),h(_e(I(S))),h(he("resolved")),Promise.resolve(S)}catch(q){return R(q),h(he("resolved")),Promise.reject(q)}}),[I,R,n,f,h,y]),Z=(0,r.useCallback)((q,S)=>mt(void 0,null,function*(){const G=pt(`${n}${m}`);try{i.current("willEditEntry",S),h(he("submit-pending"));const{data:W}=yield ge.be.put(G,q);return y({type:"success",message:{id:v("success.record.save")}}),i.current("didEditEntry",{trackerProperty:S}),h(_e(I(W))),h(he("resolved")),Promise.resolve(W)}catch(W){return R(W),i.current("didNotEditEntry",{error:W,trackerProperty:S}),h(he("resolved")),Promise.reject(W)}}),[I,R,n,h,m,y]),U=(0,r.useCallback)(()=>mt(void 0,null,function*(){const q=pt(`${n}/actions/unpublish${f}`);h(he("unpublish-pending"));try{i.current("willUnpublishEntry");const{data:S}=yield ge.be.post(q);i.current("didUnpublishEntry"),y({type:"success",message:{id:v("success.record.unpublish")}}),h(_e(I(S))),h(he("resolved"))}catch(S){h(he("resolved")),R(S)}}),[I,y,R,n,h,f]);return t({componentsDataStructure:b,contentTypeDataStructure:E,data:F,isCreatingEntry:u,isLoadingForData:C,onDelete:z,onDeleteSucceeded:M,onPost:V,onPublish:B,onPut:Z,onUnpublish:U,redirectionLink:"/",status:P})};ei.propTypes={allLayoutData:o().shape({components:o().object.isRequired,contentType:o().object.isRequired}).isRequired,children:o().func.isRequired,slug:o().string.isRequired};const ah=(0,r.memo)(ei);var ih=p(57235),lh=p.n(ih),ch=Object.defineProperty,ti=Object.getOwnPropertySymbols,uh=Object.prototype.hasOwnProperty,dh=Object.prototype.propertyIsEnumerable,ni=(e,t,n)=>t in e?ch(e,t,{enumerable:!0,configurable:!0,writable:!0,value:n}):e[t]=n,ri=(e,t)=>{for(var n in t||(t={}))uh.call(t,n)&&ni(e,n,t[n]);if(ti)for(var n of ti(t))dh.call(t,n)&&ni(e,n,t[n]);return e};function ph(e,t){return n=>{const s=t();return r.createElement(e,ri(ri({},n),s))}}const mh=ph;function fh(){const{initialData:e,hasDraftAndPublish:t}=(0,g.useCMEditViewDataManager)(),n=e.publishedAt!==void 0&&e.publishedAt!==null;return{hasDraftAndPublish:t,isPublished:n}}const gh=fh;var yh=Object.defineProperty,oi=Object.getOwnPropertySymbols,hh=Object.prototype.hasOwnProperty,bh=Object.prototype.propertyIsEnumerable,si=(e,t,n)=>t in e?yh(e,t,{enumerable:!0,configurable:!0,writable:!0,value:n}):e[t]=n,Eh=(e,t)=>{for(var n in t||(t={}))hh.call(t,n)&&si(e,n,t[n]);if(oi)for(var n of oi(t))bh.call(t,n)&&si(e,n,t[n]);return e};const vh=(0,k.default)(lh())`
|
|
983
|
-
width: ${(0,g.pxToRem)(6)};
|
|
984
|
-
height: ${(0,g.pxToRem)(6)};
|
|
985
|
-
* {
|
|
986
|
-
fill: ${({theme:e,$bulletColor:t})=>e.colors[t]};
|
|
987
|
-
}
|
|
988
|
-
`,ai=({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,Eh({hasRadius:!0,as:"aside",paddingTop:4,paddingBottom:4,paddingLeft:5,paddingRight:5},a.box),r.createElement(D.Box,{as:j.Flex},r.createElement(vh,{$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"})))))};ai.propTypes={hasDraftAndPublish:o().bool.isRequired,isPublished:o().bool.isRequired};const Ch=mh(ai,gh),Pr=60*1e3,Or=Pr*60,nn=Or*24,ii=nn*30,li=nn*365,Ph=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<ii?{unit:"day",value:-Math.round(e/nn)}:e<li?{unit:"month",value:-Math.round(e/ii)}:{unit:"year",value:-Math.round(e/li)};var ci=p(7602);const Oh=()=>{const{formatMessage:e,formatRelativeTime:t}=(0,A.useIntl)(),{initialData:n,isCreatingEntry:s}=(0,g.useCMEditViewDataManager)(),a=(0,r.useRef)(Date.now()),l=(c,d)=>{var m,f,y;const h=((m=n[d])==null?void 0:m.firstname)||"",b=((f=n[d])==null?void 0:f.lastname)||"",F=((y=n[d])==null?void 0:y.username)||(0,ci.Pp)(h,b),P=(n[c]?new Date(n[c]).getTime():Date.now())-a.current,{unit:I,value:R}=Ph(-P);return{at:t(R,I,{numeric:"auto"}),by:s?"-":F}},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 Rh=p(98599),rn=p.n(Rh),ke=p(49137),Mh=p(88677),ft=p.n(Mh),Th=Object.defineProperty,ui=Object.getOwnPropertySymbols,wh=Object.prototype.hasOwnProperty,Ih=Object.prototype.propertyIsEnumerable,di=(e,t,n)=>t in e?Th(e,t,{enumerable:!0,configurable:!0,writable:!0,value:n}):e[t]=n,pi=(e,t)=>{for(var n in t||(t={}))wh.call(t,n)&&di(e,n,t[n]);if(ui)for(var n of ui(t))Ih.call(t,n)&&di(e,n,t[n]);return e};function Dh(e,t){return n=>{const s=t();return r.createElement(e,pi(pi({},n),s))}}const xh=Dh,Sh=(e,t,n)=>{const s=(l,i)=>Object.keys(l).reduce((u,c)=>{const d=(0,N.get)(i,["attributes",c,"type"],"string"),m=(0,N.get)(i,["attributes",c,"relationType"],""),f=m.toLowerCase().includes("morph"),y=["oneWay","oneToOne","manyToOne"],h=l[c];if((0,N.isNil)(h))return u;if(d==="dynamiczone"&&h.forEach(b=>{const E=(0,N.get)(n,b.__component,{});u+=s(b,E)}),d==="component"){const b=(0,N.get)(i,["attributes",c,"repeatable"],!1),E=(0,N.get)(i,["attributes",c,"component"],""),F=(0,N.get)(n,E,{});b?h.forEach(C=>{u+=s(C,F)}):u+=s(h,F)}return d==="relation"&&!f&&(y.includes(m)?(0,N.has)(h,"publishedAt")&&(0,N.isEmpty)(h.publishedAt)&&(u+=1):h.forEach(b=>{(0,N.has)(b,"publishedAt")&&(0,N.isEmpty)(b.publishedAt)&&(u+=1)})),u},0);return s(e,t,n)};function Lh(){const{allLayoutData:e,initialData:t,isCreatingEntry:n,isSingleType:s,status:a,layout:l,hasDraftAndPublish:i,modifiedData:u,onPublish:c,onUnpublish:d}=(0,g.useCMEditViewDataManager)();return{componentLayouts:e.components,initialData:t,isCreatingEntry:n,isSingleType:s,status:a,layout:l,hasDraftAndPublish:i,modifiedData:u,onPublish:c,onUnpublish:d}}const Fh=Lh,mi=({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:y})=>{const{goBack:h}=(0,X.useHistory)(),[b,E]=(0,r.useState)(!1),[F,C]=(0,r.useState)(!1),{formatMessage:P}=(0,A.useIntl)(),I=(0,r.useRef)(0),R=T()(c,["settings","mainField"],"id"),z=T()(c,["info","displayName"],"NOT FOUND"),M=!Xt()(a,d)||l&&!Re()(d);let B=P({id:v("containers.Edit.pluginHeader.title.new"),defaultMessage:"Create an entry"});!l&&!i&&(B=a[R]||z),i&&(B=z);const Z=()=>{const w=Sh(d,c,s);return I.current=w,w};let U=null;if(l&&t&&(U=r.createElement(se.Stack,{horizontal:!0,spacing:2},u&&r.createElement(ye.Button,{disabled:!0,startIcon:r.createElement(ft(),null),variant:"secondary"},P({id:"app.utils.publish",defaultMessage:"Publish"})),r.createElement(ye.Button,{disabled:!M,isLoading:y==="submit-pending",type:"submit"},P({id:v("containers.Edit.submit"),defaultMessage:"Save"})))),!l&&e){const w=u&&n,$=!Re()(a.publishedAt),Y=$?y==="unpublish-pending":y==="publish-pending",Q=$?{id:"app.utils.unpublish",defaultMessage:"Unpublish"}:{id:"app.utils.publish",defaultMessage:"Publish"},x=$?()=>E(!0):()=>{Z()===0?m():C(!0)};U=r.createElement(j.Flex,null,w&&r.createElement(ye.Button,{disabled:M,loading:Y,onClick:x,startIcon:r.createElement(ft(),null),variant:"secondary"},P(Q)),r.createElement(D.Box,{paddingLeft:w?2:0},r.createElement(ye.Button,{disabled:!M,loading:y==="submit-pending",type:"submit"},P({id:v("containers.Edit.submit"),defaultMessage:"Save"}))))}const q=()=>E(w=>!w),S=()=>C(w=>!w),G=()=>{S(),I.current=0,m()},W=()=>{q(),f()},ee=`${P({id:v("api.id"),defaultMessage:"API ID "})} : ${c.apiID}`;return r.createElement(r.Fragment,null,r.createElement(te.HeaderLayout,{title:B.toString(),primaryAction:U,subtitle:ee,navigationAction:r.createElement(g.Link,{startIcon:r.createElement(rn(),null),onClick:w=>{w.preventDefault(),h()},to:"/"},P({id:"global.back",defaultMessage:"Back"}))}),b&&r.createElement(ke.Dialog,{onClose:q,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"},P({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"},P({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:q,variant:"tertiary"},P({id:"components.popUpWarning.button.cancel",defaultMessage:"No, cancel"})),endAction:r.createElement(ye.Button,{variant:"danger-light",onClick:W},P({id:"components.popUpWarning.button.confirm",defaultMessage:"Yes, confirm"}))})),F&&r.createElement(ke.Dialog,{onClose:S,title:"Confirmation",labelledBy:"confirmation",describedBy:"confirm-description",isOpen:F},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"},I.current,P({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:w=>r.createElement(L.Typography,{fontWeight:"bold"},w),count:I.current}))),r.createElement(j.Flex,{justifyContent:"center",style:{textAlign:"center"}},r.createElement(L.Typography,{id:"confirm-description"},P({id:v("popUpWarning.warning.publish-question"),defaultMessage:"Do you still want to publish it?"}))))),r.createElement(ke.DialogFooter,{startAction:r.createElement(ye.Button,{onClick:S,variant:"tertiary"},P({id:"components.popUpWarning.button.cancel",defaultMessage:"No, cancel"})),endAction:r.createElement(ye.Button,{variant:"success",onClick:G},P({id:v("popUpwarning.warning.has-draft-relations.button-confirm"),defaultMessage:"Yes, publish"}))})))};mi.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 kh=(0,r.memo)(mi,We()),Ah=xh(kh,Fh),jh=(e,t)=>{const n=l=>(0,N.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,N.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)},$h=(e,t)=>{const n=s=>{const a=(0,g.findMatchingPermissions)(e,[{action:`plugin::content-manager.explorer.${s}`,subject:t}]);return(0,N.uniq)((0,N.flatMap)(a,"properties.fields"))};return{createActionAllowedFields:n("create"),readActionAllowedFields:n("read"),updateActionAllowedFields:n("update")}};var Bh=Object.defineProperty,fi=Object.getOwnPropertySymbols,Nh=Object.prototype.hasOwnProperty,Vh=Object.prototype.propertyIsEnumerable,gi=(e,t,n)=>t in e?Bh(e,t,{enumerable:!0,configurable:!0,writable:!0,value:n}):e[t]=n,yi=(e,t)=>{for(var n in t||(t={}))Nh.call(t,n)&&gi(e,n,t[n]);if(fi)for(var n of fi(t))Vh.call(t,n)&&gi(e,n,t[n]);return e};function qh(e,t){return n=>{const s=t();return r.createElement(e,yi(yi({},n),s))}}const Wh=qh;function zh(){const{hasDraftAndPublish:e,modifiedData:t}=(0,g.useCMEditViewDataManager)();let n={};return e&&(n=(0,N.isEmpty)(t.publishedAt)?{status:"draft"}:{status:"published"}),{hasDraftAndPublish:e,trackerProperty:n}}const Uh=zh;var Hh=(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 hi=({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,g.useNotification)(),m=()=>l(y=>!y),f=()=>Hh(void 0,null,function*(){try{u(!0),yield t(s),u(!1),m(),n()}catch(y){const h=T()(y,"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(g.ConfirmDialog,{isConfirmButtonLoading:i,isOpen:a,onConfirm:f,onToggleDialog:m}))};hi.propTypes={isCreatingEntry:o().bool.isRequired,onDelete:o().func.isRequired,onDeleteSucceeded:o().func.isRequired,trackerProperty:o().object.isRequired};const _h=(0,r.memo)(hi,We()),Gh=Wh(_h,Uh);var Zh=Object.defineProperty,Qh=Object.defineProperties,Kh=Object.getOwnPropertyDescriptors,bi=Object.getOwnPropertySymbols,Yh=Object.prototype.hasOwnProperty,Jh=Object.prototype.propertyIsEnumerable,Ei=(e,t,n)=>t in e?Zh(e,t,{enumerable:!0,configurable:!0,writable:!0,value:n}):e[t]=n,vi=(e,t)=>{for(var n in t||(t={}))Yh.call(t,n)&&Ei(e,n,t[n]);if(bi)for(var n of bi(t))Jh.call(t,n)&&Ei(e,n,t[n]);return e},Xh=(e,t)=>Qh(e,Kh(t));const Ci=De.Z.contentManager,eb=[{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,g.useTracking)(),{formatMessage:d}=(0,A.useIntl)(),{createActionAllowedFields:m,readActionAllowedFields:f,updateActionAllowedFields:y}=(0,r.useMemo)(()=>$h(u,a),[u,a]),h=(0,r.useMemo)(()=>t?Ci.singleTypesConfigurations:Ci.collectionTypesConfigurations,[t]),b=`/content-manager/${t?"singleType":"collectionType"}/${a}/configurations/edit`,E=T()(s,["contentType"],{}),F=(0,r.useMemo)(()=>t?ah:Oy,[t]),C=(0,r.useCallback)(z=>z.every(M=>M.every(V=>V.fieldSchema.type==="dynamiczone")),[]),P=(0,r.useMemo)(()=>E.layouts?jh(E.layouts.edit,E.attributes):[],[E]),I=E.layouts.editRelations,R=I.length;return r.createElement(F,{allLayoutData:s,slug:a,id:l,origin:i},({componentsDataStructure:z,contentTypeDataStructure:M,data:V,isCreatingEntry:B,isLoadingForData:Z,onDelete:U,onDeleteSucceeded:q,onPost:S,onPublish:G,onPut:W,onUnpublish:ee,redirectionLink:w,status:$})=>r.createElement(Jy,{allowedActions:e,allLayoutData:s,createActionAllowedFields:m,componentsDataStructure:z,contentTypeDataStructure:M,from:w,initialValues:V,isCreatingEntry:B,isLoadingForData:Z,isSingleType:t,onPost:S,onPublish:G,onPut:W,onUnpublish:ee,readActionAllowedFields:f,redirectToPreviousPage:n,slug:a,status:$,updateActionAllowedFields:y},r.createElement(oe.Main,{"aria-busy":$!=="resolved"},r.createElement(Ah,{allowedActions:e}),r.createElement(te.ContentLayout,null,r.createElement(le.Grid,{gap:4},r.createElement(le.GridItem,{col:9,s:12},r.createElement(r.Suspense,{fallback:r.createElement(g.LoadingIndicatorPage,null)},r.createElement(se.Stack,{spacing:6},P.map((Y,Q)=>{if(C(Y)){const{0:{0:{name:x,fieldSchema:O,metadatas:_,labelAction:K}}}=Y;return r.createElement(D.Box,{key:Q},r.createElement(le.Grid,{gap:4},r.createElement(le.GridItem,{col:12,s:12,xs:12},r.createElement(hy,{name:x,fieldSchema:O,labelAction:K,metadatas:_}))))}return r.createElement(D.Box,{key:Q,hasRadius:!0,background:"neutral0",shadow:"tableShadow",paddingLeft:6,paddingRight:6,paddingTop:6,paddingBottom:6,borderColor:"neutral150"},r.createElement(se.Stack,{spacing:6},Y.map((x,O)=>r.createElement(le.Grid,{gap:4,key:O},x.map(({fieldSchema:_,labelAction:K,metadatas:ae,name:ce,size:Fe})=>{if(_.type==="component"){const{component:H,max:pe,min:je,repeatable:Ue=!1,required:ht=!1}=_;return r.createElement(le.GridItem,{col:Fe,s:12,xs:12,key:H},r.createElement(Yt,{componentUid:H,labelAction:K,isRepeatable:Ue,intlLabel:{id:ae.label,defaultMessage:ae.label},max:pe,min:je,name:ce,required:ht}))}return r.createElement(le.GridItem,{col:Fe,key:ce,s:12,xs:12},r.createElement(or,{fieldSchema:_,keys:ce,labelAction:K,metadatas:ae}))})))))})))),r.createElement(le.GridItem,{col:3,s:12},r.createElement(se.Stack,{spacing:2},r.createElement(Ch,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(Oh,null),r.createElement(_t,{area:"contentManager.editView.informations"})),R>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:R})),r.createElement(D.Box,{paddingTop:2,paddingBottom:6},r.createElement(Ut.Divider,null)),r.createElement(se.Stack,{spacing:4},I.map(({name:Y,fieldSchema:Q,labelAction:x,metadatas:O,queryInfos:_})=>r.createElement(ta,Xh(vi(vi({},Q),O),{key:Y,description:O.description,intlLabel:{id:O.label,defaultMessage:O.label},labelAction:x,name:Y,relationsType:Q.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(_t,{area:"contentManager.editView.right-links",slug:a}),a!=="strapi::administrator"&&r.createElement(g.CheckPermissions,{permissions:eb},r.createElement(g.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(g.CheckPermissions,{permissions:h},r.createElement(g.LinkButton,{size:"S",startIcon:r.createElement(Qu(),null),style:{width:"100%"},to:b,variant:"secondary"},d({id:"app.links.configure-view",defaultMessage:"Configure the view"}))),e.canDelete&&r.createElement(Gh,{isCreatingEntry:B,onDelete:U,onDeleteSucceeded:q}))))))))))};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 tb=(0,r.memo)(Rr);var nb=Object.defineProperty,rb=Object.defineProperties,ob=Object.getOwnPropertyDescriptors,Pi=Object.getOwnPropertySymbols,sb=Object.prototype.hasOwnProperty,ab=Object.prototype.propertyIsEnumerable,Oi=(e,t,n)=>t in e?nb(e,t,{enumerable:!0,configurable:!0,writable:!0,value:n}):e[t]=n,ib=(e,t)=>{for(var n in t||(t={}))sb.call(t,n)&&Oi(e,n,t[n]);if(Pi)for(var n of Pi(t))ab.call(t,n)&&Oi(e,n,t[n]);return e},lb=(e,t)=>rb(e,ob(t));const Mr=e=>{const t=(0,r.useMemo)(()=>Oo(e.slug),[e.slug]),{isLoading:n,allowedActions:s}=(0,g.useRBAC)(t,e.userPermissions);return n?r.createElement(g.LoadingIndicatorPage,null):r.createElement(tb,lb(ib({},e),{allowedActions:s}))};Mr.defaultProps={permissions:[]},Mr.propTypes={permissions:o().array,slug:o().string.isRequired,userPermissions:o().array.isRequired};const cb=(0,r.memo)(Mr,We());var ub=Object.defineProperty,db=Object.defineProperties,pb=Object.getOwnPropertyDescriptors,on=Object.getOwnPropertySymbols,Ri=Object.prototype.hasOwnProperty,Mi=Object.prototype.propertyIsEnumerable,Ti=(e,t,n)=>t in e?ub(e,t,{enumerable:!0,configurable:!0,writable:!0,value:n}):e[t]=n,mb=(e,t)=>{for(var n in t||(t={}))Ri.call(t,n)&&Ti(e,n,t[n]);if(on)for(var n of on(t))Mi.call(t,n)&&Ti(e,n,t[n]);return e},fb=(e,t)=>db(e,pb(t)),gb=(e,t)=>{var n={};for(var s in e)Ri.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&&Mi.call(e,s)&&(n[s]=e[s]);return n};const wi=e=>{var t=e,{layout:n}=t,s=gb(t,["layout"]);const a=(0,fe.useSelector)(mo),l=(0,fe.useDispatch)(),[{query:i}]=(0,g.useQueryParams)(),{runHookWaterfall:u}=(0,g.useStrapiApp)(),c=Yo(i,s.slug,"editView");return(0,r.useEffect)(()=>{const d=u(zt.Eo,{layout:n,query:i});return l(_u(d.layout,i)),()=>{l(Hu())}},[n,l,i,u]),!a||!c?r.createElement(g.LoadingIndicatorPage,null):r.createElement(cb,fb(mb({},s),{layout:a,userPermissions:c}))};wi.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=wi;var Tr=p(84968),yb=p(23940),It=p.n(yb),hb=p(88423),Ii=p.n(hb),bb=p(3704),Eb=p.n(bb),vb=Object.defineProperty,Cb=Object.defineProperties,Pb=Object.getOwnPropertyDescriptors,Di=Object.getOwnPropertySymbols,Ob=Object.prototype.hasOwnProperty,Rb=Object.prototype.propertyIsEnumerable,xi=(e,t,n)=>t in e?vb(e,t,{enumerable:!0,configurable:!0,writable:!0,value:n}):e[t]=n,Mb=(e,t)=>{for(var n in t||(t={}))Ob.call(t,n)&&xi(e,n,t[n]);if(Di)for(var n of Di(t))Rb.call(t,n)&&xi(e,n,t[n]);return e},Tb=(e,t)=>Cb(e,Pb(t));const wr=e=>e.reduce((t,n)=>t+n.size,0),wb=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),Ib=e=>e.reduce((t,n)=>{const s=n.rowContent.filter(a=>a.name!=="_TEMP_");return t.concat([s])},[]),Si=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}},Db=(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),xb=(e,t,n=[])=>n.map(s=>(s.rowContent=s.rowContent.map(a=>a.name===e?Tb(Mb({},a),{size:t}):a),s)),Ir={fieldForm:{},componentLayouts:{},metaToEdit:"",initialData:{},metaForm:{},modifiedData:{}},Sb=(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=T()(e,u,[]);ne()(n,u,[...c,t.name]);break}case"MOVE_RELATION":{const c=T()(e,u,[]),{fromIndex:d,toIndex:m}=t;ne()(n,u,vt(c,d,m));break}case"MOVE_ROW":{const c=T()(e,i,[]),{fromIndex:d,toIndex:m}=t;ne()(n,i,vt(c,d,m));break}case"ON_ADD_FIELD":{const c=qe()(e),d=Si(T()(c,["modifiedData","attributes",t.name,"type"],"")),m=T()(c,i,[]).length,f=[...i,m-1,"rowContent"],y=T()(c,f,[]);let h=T()(c,i,[]);Array.isArray(y)?ne()(h,[m>0?m-1:0,"rowContent"],[...y,{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=T()(e,[...i,t.rowIndex,"rowContent"],[]);let d=qe()(e);if(c.length===1||c.length===2&&T()(c,[1,"name"],"")==="_TEMP_"){const f=T()(e,i,[]);ne()(d,i,f.filter((y,h)=>t.rowIndex!==h))}else ne()(d,[...i,t.rowIndex,"rowContent"],c.filter((f,y)=>y!==t.fieldIndex));const m=gt(T()(d,i,[]));ne()(n,i,m);break}case"REMOVE_RELATION":{const c=T()(e,u,[]);ne()(n,u,c.filter((d,m)=>t.index!==m));break}case"REORDER_DIFF_ROW":{const c=T()(e,[...i,t.dragRowIndex,"rowContent"],[]),d=T()(e,[...i,t.hoverRowIndex,"rowContent"],[]),m=T()(e,[...i,t.dragRowIndex,"rowContent",t.dragIndex],{}),f=[...d,m];let y=qe()(e);ne()(y,[...i,t.dragRowIndex,"rowContent"],c.filter((b,E)=>t.dragIndex!==E)),ne()(y,[...i,t.hoverRowIndex,"rowContent"],vt(f,f.length-1,t.hoverIndex));const h=gt(T()(y,i,[]));ne()(n,i,h);break}case"REORDER_ROW":{const c=qe()(e),d=T()(c,[...i,t.dragRowIndex,"rowContent"],[]);ne()(c,[...i,t.dragRowIndex,"rowContent"],vt(d,t.dragIndex,t.hoverIndex));const m=gt(T()(c,i,[]));ne()(n,i,m);break}case"SET_FIELD_TO_EDIT":{n.metaToEdit=t.name,n.metaForm={metadata:T()(e,["modifiedData","metadatas",t.name,"edit"],{}),size:(l=Db(t.name,(a=(s=e.modifiedData)==null?void 0:s.layouts)==null?void 0:a.edit))!=null?l:Si()};break}case"SUBMIT_META_FORM":{ne()(n,["modifiedData","metadatas",e.metaToEdit,"edit"],e.metaForm.metadata);const c=qe()(T()(e,i,[])),d=xb(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 Lb=Object.defineProperty,Fb=Object.defineProperties,kb=Object.getOwnPropertyDescriptors,Li=Object.getOwnPropertySymbols,Ab=Object.prototype.hasOwnProperty,jb=Object.prototype.propertyIsEnumerable,Fi=(e,t,n)=>t in e?Lb(e,t,{enumerable:!0,configurable:!0,writable:!0,value:n}):e[t]=n,$b=(e,t)=>{for(var n in t||(t={}))Ab.call(t,n)&&Fi(e,n,t[n]);if(Li)for(var n of Li(t))jb.call(t,n)&&Fi(e,n,t[n]);return e},Bb=(e,t)=>Fb(e,kb(t));const Nb=(e,t,n)=>{let s=(0,N.cloneDeep)(t);return(0,N.set)(s,["layouts","edit"],gt(wb(t.layouts.edit))),Bb($b({},e),{initialData:s,modifiedData:s,componentLayouts:n})};var Ae=p(12611),Vb=p(42258),ki=p.n(Vb);const Ai=({componentUid:e})=>{const{componentLayouts:t}=He(),{formatMessage:n}=(0,A.useIntl)(),s=T()(t,[e],{}),a=T()(s,["layouts","edit"],[]);return r.createElement(D.Box,{padding:3},a.map((l,i)=>r.createElement(le.Grid,{gap:4,key:i},l.map(u=>r.createElement(le.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(g.Link,{startIcon:r.createElement(ki(),null),to:`/content-manager/components/${e}/configurations/edit`},n({id:v("components.FieldItem.linkToComponentLayout"),defaultMessage:"Set the component's layout"}))))};Ai.propTypes={componentUid:o().string.isRequired};const qb=Ai,ji=(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
|
-
`,Wb=(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
|
-
${ji} {
|
|
1011
|
-
background: ${e.colors.primary200};
|
|
1012
|
-
}
|
|
1013
|
-
border-color: ${e.colors.primary200};
|
|
1014
|
-
`}
|
|
1015
|
-
}
|
|
1016
|
-
`,$i=({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(Wb,{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:X.Link,to:`/content-manager/components/${n}/configurations/edit`},r.createElement(ji,{width:`${32/16}rem`,height:`${32/16}rem`,background:"neutral150",justifyContent:"center",alignItems:"center",padding:2},r.createElement(Dn.G,{icon:T()(t,[n,"info","icon"],"")})),r.createElement(D.Box,{paddingTop:1},r.createElement(L.Typography,{fontSize:1,textColor:"neutral600",fontWeight:"bold"},T()(t,[n,"info","displayName"],""))))))};$i.propTypes={components:o().arrayOf(o().string).isRequired};const zb=$i,Bi=(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(Bi,{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(Bi,{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(qb,{componentUid:e.component}),(e==null?void 0:e.type)==="dynamiczone"&&r.createElement(zb,{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 Ni=Dr,Ub=(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
|
-
`,Hb=(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
|
-
`,_b=(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
|
-
`,Gb=(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,y]=(0,r.useState)(!1),h=i==="_TEMP_",{setIsDraggingSibling:b}=He(),E=m===12,F=(0,r.useRef)(null),C=(0,r.useRef)(null),[{clientOffset:P,isOver:I},R]=(0,Te.useDrop)({accept:Oe.EDIT_FIELD,hover(w,$){if(!C.current||w.size!==12)return;const Y=$.getItem().index,Q=n,x=$.getItem().rowIndex,O=d;if(Y===Q&&x===O)return;const _=C.current.getBoundingClientRect(),K=(_.bottom-_.top)/2,ce=$.getClientOffset().y-_.top;x<O&&ce<K||x>O&&ce>K||(l(x,O),w.rowIndex=O,w.itemIndex=Q)},drop(w,$){if(!C.current)return;const Y=$.getItem().index,Q=n,x=$.getItem().rowIndex,O=d;if(w.size===12||Y===Q&&x===O)return;const _=C.current.getBoundingClientRect();if(Math.abs($.getClientOffset().x-_.left)>_.width/1.8){a(Y,Q+1,x,O),w.itemIndex=Q+1,w.rowIndex=O;return}a(Y,Q,x,O),w.itemIndex=Q,w.rowIndex=O},collect:w=>({canDrop:w.canDrop(),clientOffset:w.getClientOffset(),isOver:w.isOver(),isOverCurrent:w.isOver({shallow:!0}),itemType:w.getItemType()})}),[{isDragging:z,getItem:M},V,B]=(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:w=>({isDragging:w.isDragging(),getItem:w.getItem()}),end(){b(!1)}});(0,r.useEffect)(()=>{B((0,Kt.rX)(),{captureDraggingState:!0})},[B]);const Z={dragRef:V(F),dropRef:R(C)};let U=!1,q=!1;if(C.current&&P){const w=C.current.getBoundingClientRect();U=I&&M.size!==12&&Math.abs(P.x-w.left)<w.width/2,q=I&&M.size!==12&&Math.abs(P.x-w.left)>w.width/2,i==="_TEMP_"&&(U=I&&M.size!==12,q=!1)}const S=()=>e&&E?`${74/16}rem`:`${32/16}rem`,G=n===0&&!E,W=n===s&&!E,ee=n!==0&&!E;return r.createElement(le.GridItem,{col:m},r.createElement(Ub,{ref:Z.dropRef,showLeftCarret:U,showRightCarret:q,isFirst:G,isLast:W,hasHorizontalPadding:ee,onDrag:()=>{E&&!f&&y(!0)},onDragEnd:()=>{E&&y(!1)}},f&&E&&r.createElement(D.Box,{width:"100%",height:"2px",background:"primary600"}),r.createElement(_b,{width:E&&f?0:"100%",borderColor:"neutral150",hasRadius:!0,background:"neutral100",minHeight:S(),alignItems:"stretch",isDragging:z,dragStart:f,isFullSize:E,isHidden:h},r.createElement(Gb,{as:"span",type:"button",ref:Z.dragRef,onClick:w=>w.stopPropagation(),alignItems:"center",paddingLeft:3,paddingRight:3,tabIndex:-1},r.createElement(Hb,null)),!h&&r.createElement(Ni,{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 Zb=xr,Vi=({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=T()(u,[e.name],{}),y=T()(c,["metadatas",e.name,"edit","label"],"");return r.createElement(Zb,{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},y||e.name)};Vi.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 Qb=Vi,qi=({row:e,onRemoveField:t,rowIndex:n})=>r.createElement(le.Grid,null,e.rowContent.map((s,a)=>r.createElement(Qb,{key:s.name,rowItem:s,index:a,rowId:e.rowId,onRemoveField:t,rowIndex:n,lastIndex:e.rowContent.length-1})));qi.propTypes={onRemoveField:o().func.isRequired,row:o().object.isRequired,rowIndex:o().number.isRequired};const Kb=qi,Yb=[{action:"plugin::content-type-builder.read",subject:null}],Jb=()=>{const{trackUsage:e}=(0,g.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=T()(s,"category",""),c=l==="content-types"?n:`${u}/${n}`,d=()=>{e("willEditEditLayout")};return n==="strapi::administrator"?null:r.createElement(g.CheckPermissions,{permissions:Yb},r.createElement(g.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"})))},Wi=({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(Jb,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(Kb,{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))))))};Wi.propTypes={editLayout:o().array.isRequired,editLayoutRemainingFields:o().array.isRequired,onAddField:o().func.isRequired,onRemoveField:o().func.isRequired};const Xb=Wi,eE=(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
|
-
`,tE=(0,k.default)(j.Flex)`
|
|
1072
|
-
opacity: ${({isDragging:e})=>e?0:1};
|
|
1073
|
-
`,nE=(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 y=()=>e&&["json","text","file","media","component","richtext","dynamiczone"].includes(e.type)?`${74/16}rem`:`${32/16}rem`;return r.createElement(tE,{width:"100%",borderColor:"neutral150",hasRadius:!0,background:"neutral100",minHeight:y(),alignItems:"stretch",isDragging:d},r.createElement(nE,{as:"span",type:"button",ref:u,onClick:h=>h.stopPropagation(),alignItems:"center",paddingLeft:3,paddingRight:3,tabIndex:-1},r.createElement(eE,null)),r.createElement(Ni,{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 rE=Sr,zi=({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=T()(i,["metadatas",c,"edit","label"],"");return r.createElement(rE,{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))))))};zi.propTypes={relationsLayout:o().array.isRequired,editRelationsLayoutRemainingFields:o().array.isRequired,onRemoveField:o().func.isRequired,onAddField:o().func.isRequired};const oE=zi;var Ge=p(4122),sE=p(61714),an=p.n(sE),aE=p(9895),iE=p.n(aE),lE=p(34103),cE=p.n(lE),uE=p(57290),Ui=p.n(uE),dE=p(55788),Lr=p.n(dE),pE=p(81208),mE=p.n(pE),fE=p(65232),Fr=p.n(fE),gE=p(80268),yE=p.n(gE),hE=p(42122),Dt=p.n(hE),bE=p(57955),EE=p.n(bE),vE=p(10822),CE=p.n(vE),PE=p(80466),OE=p.n(PE);const Hi={biginteger:r.createElement(Dt(),null),boolean:r.createElement(iE(),null),date:r.createElement(an(),null),datetime:r.createElement(an(),null),decimal:r.createElement(Dt(),null),email:r.createElement(cE(),null),enum:r.createElement(Ui(),null),enumeration:r.createElement(Ui(),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(mE(),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(EE(),null),uid:r.createElement(yE(),null),component:r.createElement(CE(),null),dynamiczone:r.createElement(OE(),null)},kr=({type:e,customFieldUid:t})=>{const n=(0,g.useCustomFields)();let s=Hi[e];if(t){const l=n.get(t).icon;l&&(s=r.createElement(D.Box,{marginRight:3,width:7,height:6},r.createElement(l,null)))}return Hi[e]?s:null};kr.defaultProps={customFieldUid:null},kr.propTypes={type:o().string.isRequired,customFieldUid:o().string};const _i=kr,RE=e=>e.reduce((t,n)=>{const s=(0,N.get)(n,["attributes"],{}),a=Object.keys(s).filter(l=>!["boolean","component","dynamiczone","json","media","password","relation","text","richtext"].includes((0,N.get)(s,[l,"type"],"")));return t[n.uid]=a,t},{}),Gi=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),ME=Object.defineProperty,ln=Object.getOwnPropertySymbols,Zi=Object.prototype.hasOwnProperty,Qi=Object.prototype.propertyIsEnumerable,Ki=(e,t,n)=>t in e?ME(e,t,{enumerable:!0,configurable:!0,writable:!0,value:n}):e[t]=n,Ar=(e,t)=>{for(var n in t||(t={}))Zi.call(t,n)&&Ki(e,n,t[n]);if(ln)for(var n of ln(t))Qi.call(t,n)&&Ki(e,n,t[n]);return e},TE=(e,t)=>{var n={};for(var s in e)Zi.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&&Qi.call(e,s)&&(n[s]=e[s]);return n};const jr=e=>{var t=e,{type:n,options:s,onChange:a,value:l,name:i}=t,u=TE(t,["type","options","onChange","value","name"]);const{formatMessage:c}=(0,A.useIntl)();switch(n){case"text":return r.createElement(zn.TextInput,Ar({onChange:a,value:l,name:i},u));case"bool":return r.createElement(xt.ToggleInput,Ar({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(de.Select,Ar({value:l,name:i,onChange:d=>a({target:{name:i,value:d}})},u),s.map(d=>r.createElement(de.Option,{key:d,value:d},d)));default:return null}};jr.defaultProps={options:void 0},jr.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 wE=jr,IE=[[4,"33%"],[6,"50%"],[8,"66%"],[12,"100%"]],DE=["dynamiczone","component","json","richtext"],xE=[1,5,10,15,30,60],SE=["datetime","time"],Yi=({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)(C=>u(C),fe.shallowEqual),d=(0,r.useMemo)(()=>{if(!a)return[];const C=T()(s,["metadatas",a,"edit"],{});return Object.keys(C).filter(P=>P!=="visible")},[a,s]),m=(0,r.useMemo)(()=>RE(c),[c]),f=(0,r.useCallback)(C=>{if(C!=="relation"&&C!=="component")return[];const P=C==="component"?"component":"targetModel",I=T()(s,["attributes",a,P],"");return T()(m,[I],[])},[a,m,s]),y=d.map(C=>{const P=T()(l,[a,"type"]);return["component","dynamiczone"].includes(P)&&!["label","description"].includes(C)||P==="component"&&C!=="label"||["media","json","boolean"].includes(P)&&C==="placeholder"||C==="step"?null:r.createElement(le.GridItem,{col:6,key:C},r.createElement(wE,{type:Gi(C).type,hint:C==="mainField"?n({id:v("containers.SettingPage.editSettings.relation-field.description")}):"",label:n({id:T()(Gi(C),"label.id","app.utils.defaultMessage")}),name:C,onChange:e,value:T()(i,["metadata",C],""),options:f(P)}))}),h=!DE.includes(l[a].type),b=r.createElement(le.GridItem,{col:6,key:"size"},r.createElement(de.Select,{value:i==null?void 0:i.size,name:"size",onChange:C=>{t({name:a,value:C})},label:n({id:v("containers.SettingPage.editSettings.size.label"),defaultMessage:"Size"})},IE.map(([C,P])=>r.createElement(de.Option,{key:C,value:C},P)))),E=SE.includes(l[a].type),F=r.createElement(le.GridItem,{col:6,key:"step"},r.createElement(de.Select,{value:T()(i,["metadata","step"],1),name:"step",onChange:C=>e({target:{name:"step",value:C}}),label:n({id:v("containers.SettingPage.editSettings.step.label"),defaultMessage:"Time interval (minutes)"})},xE.map(C=>r.createElement(de.Option,{key:C,value:C},C))));return r.createElement(r.Fragment,null,y,h&&b,E&&F)};Yi.propTypes={onMetaChange:o().func.isRequired,onSizeChange:o().func.isRequired};const LE=Yi,FE=(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
|
-
`,$r=({onToggle:e,onMetaChange:t,onSizeChange:n,onSubmit:s,type:a,customFieldUid:l})=>{const{selectedField:i}=He(),{formatMessage:u}=(0,A.useIntl)(),c=()=>a==="timestamp"?"date":["decimal","float","integer","biginter"].includes(a)?"number":a;return r.createElement(Ge.ModalLayout,{onClose:e,labelledBy:"title"},r.createElement("form",{onSubmit:s},r.createElement(Ge.ModalHeader,null,r.createElement(FE,null,r.createElement(_i,{type:c(),customFieldUid:l}),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()(i)})))),r.createElement(Ge.ModalBody,null,r.createElement(le.Grid,{gap:4},r.createElement(LE,{onMetaChange:t,onSizeChange:n}))),r.createElement(Ge.ModalFooter,{startActions:r.createElement(ye.Button,{onClick:e,variant:"tertiary"},u({id:"app.components.Button.cancel",defaultMessage:"Cancel"})),endActions:r.createElement(ye.Button,{type:"submit"},u({id:"global.finish",defaultMessage:"Finish"}))})))};$r.defaultProps={customFieldUid:null},$r.propTypes={customFieldUid:o().string,onSubmit:o().func.isRequired,onToggle:o().func.isRequired,onMetaChange:o().func.isRequired,onSizeChange:o().func.isRequired,type:o().string.isRequired};const kE=$r,AE=(e,t,n)=>ge.be.put(ve(n?`content-types/${t}/configuration`:`components/${t}/configuration`),e),Br=({mainLayout:e,components:t,isContentTypeView:n,slug:s,updateLayout:a})=>{const[l,i]=(0,r.useReducer)(Sb,Ir,()=>Nb(Ir,e,t)),[u,c]=(0,r.useState)(!1),{trackUsage:d}=(0,g.useTracking)(),m=(0,g.useNotification)(),{goBack:f}=(0,X.useHistory)(),[y,h]=(0,r.useState)(!1),[b,E]=(0,r.useState)(!1),{componentLayouts:F,initialData:C,modifiedData:P,metaToEdit:I,metaForm:R}=l,{formatMessage:z}=(0,A.useIntl)(),M=T()(e,["info","displayName"],""),V=T()(P,["attributes"],{}),B=Object.keys(V).filter(H=>{const pe=T()(V,[H,"type"],"");return!["dynamiczone","json","text","relation","component","boolean","media","password","richtext","timestamp"].includes(pe)&&!!pe}),Z=T()(P,["layouts","edit"],[]),U=Eb()(Z,"rowContent"),q=Object.keys(P.attributes).filter(H=>n?T()(P,["attributes",H,"type"],"")!=="relation":!0).filter(H=>T()(P,["metadatas",H,"edit","visible"],!1)===!0).filter(H=>U.findIndex(pe=>pe.name===H)===-1).sort(),S=T()(P,["layouts","editRelations"],[]),G=Object.keys(V).filter(H=>V[H].type==="relation").filter(H=>S.indexOf(H)===-1),W=({target:{name:H,value:pe}})=>{i({type:"ON_CHANGE",keys:H.split("."),value:pe})},ee=()=>{h(H=>!H)},w=()=>{E(H=>!H)},$=({target:{name:H,value:pe}})=>{i({type:"ON_CHANGE_META",keys:H.split("."),value:pe})},Y=({name:H,value:pe})=>{i({type:"ON_CHANGE_SIZE",name:H,value:pe})},Q=H=>{H.preventDefault(),i({type:"SUBMIT_META_FORM"}),ee()},x=H=>{H.preventDefault(),w()},O=(0,Tr.useMutation)(H=>AE(H,s,n),{onSuccess({data:H}){a&&a(H.data),i({type:"SUBMIT_SUCCEEDED"}),w(),d("didEditEditSettings")},onError(){m({type:"warning",message:{id:"notification.error"}})}}),{isLoading:_}=O,K=()=>{const H=Ii()(qe()(P),["layouts","metadatas","settings"]);ne()(H,"layouts.edit",Ib(H.layouts.edit)),O.mutate(H)},ae=(H,pe)=>{i({type:"MOVE_RELATION",fromIndex:H,toIndex:pe})},ce=(H,pe)=>{i({type:"MOVE_FIELD",fromIndex:H,toIndex:pe})},Fe=(H,pe,je,Ue)=>{i(je===Ue?{type:"REORDER_ROW",dragRowIndex:je,dragIndex:H,hoverIndex:pe}:{type:"REORDER_DIFF_ROW",dragIndex:H,hoverIndex:pe,dragRowIndex:je,hoverRowIndex:Ue})},rt=(H,pe)=>{i({type:"MOVE_ROW",fromIndex:H,toIndex:pe})};return r.createElement(Je,{isContentTypeView:n,attributes:V,modifiedData:P,slug:s,componentLayouts:F,selectedField:I,fieldForm:R,onMoveRelation:ae,onMoveField:ce,moveRow:rt,moveItem:Fe,setEditFieldToSelect:H=>{i({type:"SET_FIELD_TO_EDIT",name:H}),ee()},isDraggingSibling:u,setIsDraggingSibling:c},r.createElement(oe.Main,null,r.createElement("form",{onSubmit:x},r.createElement(te.HeaderLayout,{title:z({id:v("components.SettingsViewWrapper.pluginHeader.title"),defaultMessage:`Configure the view - ${It()(M)}`},{name:It()(M)}),subtitle:z({id:v("components.SettingsViewWrapper.pluginHeader.description.edit-settings"),defaultMessage:"Customize how the edit view will look like."}),navigationAction:r.createElement(g.Link,{startIcon:r.createElement(rn(),null),onClick:H=>{H.preventDefault(),f()},to:"/"},z({id:"global.back",defaultMessage:"Back"})),primaryAction:r.createElement(ye.Button,{disabled:Xt()(C,P),startIcon:r.createElement(ft(),null),type:"submit"},z({id:"global.save",defaultMessage:"Save"}))}),r.createElement(te.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"},z({id:v("containers.SettingPage.settings"),defaultMessage:"Settings"})),r.createElement(le.Grid,null,r.createElement(le.GridItem,{col:6,s:12},r.createElement(de.Select,{label:z({id:v("containers.SettingPage.editSettings.entry.title"),defaultMessage:"Entry title"}),hint:z({id:v("containers.SettingPage.editSettings.entry.title.description"),defaultMessage:"Set the display field of your entry"}),onChange:H=>{W({target:{name:"settings.mainField",value:H===""?null:H}})},value:P.settings.mainField},B.map(H=>r.createElement(de.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"},z({id:v("containers.SettingPage.view"),defaultMessage:"View"})),r.createElement(le.Grid,{gap:4},r.createElement(le.GridItem,{col:n?8:12,s:12},r.createElement(Xb,{attributes:V,editLayout:Z,editLayoutRemainingFields:q,onAddField:H=>{i({type:"ON_ADD_FIELD",name:H})},onRemoveField:(H,pe)=>{i({type:"REMOVE_FIELD",rowIndex:H,fieldIndex:pe})}})),n&&r.createElement(le.GridItem,{col:4,s:12},r.createElement(oE,{editRelationsLayoutRemainingFields:G,relationsLayout:S,onAddField:H=>i({type:"ADD_RELATION",name:H}),onRemoveField:H=>i({type:"REMOVE_RELATION",index:H})})))))),r.createElement(g.ConfirmDialog,{bodyText:{id:v("popUpWarning.warning.updateAllSettings"),defaultMessage:"This will modify all your settings"},iconRightButton:r.createElement(ft(),null),isConfirmButtonLoading:_,isOpen:b,onToggleDialog:w,onConfirm:K,variantRightButton:"success-light"})),y&&r.createElement(kE,{onSubmit:Q,onToggle:ee,onMetaChange:$,onSizeChange:Y,type:T()(V,[I,"type"],""),customFieldUid:T()(V,[I,"customField"],"")})))};Br.defaultProps={isContentTypeView:!1,updateLayout:null},Br.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 Nr=Br;var yt=p(37617);const jE=()=>({type:yt.ZA}),$E=(e,t)=>({type:yt.Id,pagination:e,data:t}),BE=()=>({type:yt.MP});function NE(){return{type:yt.c2}}const VE=({components:e,contentType:t})=>{const{layouts:n}=t;return{contentType:t,components:e,displayedHeaders:n.list,type:yt.Zz}},Vr=e=>({type:yt.Rp,target:e});var Ji=p(13055),qr=p(29270),qE=p(70664);const WE=()=>e=>e["content-manager_listView"]||qE.E,zE=()=>(0,On.P1)(WE(),e=>e),Xi=e=>{const{displayedHeaders:t}=e["content-manager_listView"];return t},UE=zE,el=({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))};el.propTypes={isPublished:o().bool.isRequired};const HE=el;var _E=p(35980),St=p(53214),GE=p(68192),ZE=p.n(GE),tl=p(9667),QE=Object.defineProperty,cn=Object.getOwnPropertySymbols,nl=Object.prototype.hasOwnProperty,rl=Object.prototype.propertyIsEnumerable,ol=(e,t,n)=>t in e?QE(e,t,{enumerable:!0,configurable:!0,writable:!0,value:n}):e[t]=n,KE=(e,t)=>{for(var n in t||(t={}))nl.call(t,n)&&ol(e,n,t[n]);if(cn)for(var n of cn(t))rl.call(t,n)&&ol(e,n,t[n]);return e},YE=(e,t)=>{var n={};for(var s in e)nl.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&&rl.call(e,s)&&(n[s]=e[s]);return n};const JE=(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
|
-
`,sl=e=>{var t=e,{children:n}=t,s=YE(t,["children"]);return r.createElement(JE,KE({justifyContent:"center",alignItems:"center",as:"span"},s),r.createElement(L.Typography,{variant:"sigma",textColor:"neutral600"},n))};sl.propTypes={children:o().string.isRequired};const al=sl,Wr=({url:e,mime:t,alternativeText:n,name:s,ext:a,formats:l})=>{var i;const u=(0,g.prefixFileUrlWithBackendUrl)(e);if(t.includes("image")){const m=((i=l==null?void 0:l.thumbnail)==null?void 0:i.url)||null,f=(0,g.prefixFileUrlWithBackendUrl)(m)||u;return r.createElement(tl.Avatar,{src:f,alt:n||s,preview:!0})}const c=(0,g.getFileExtension)(a),d=s.length>100?`${s.substring(0,100)}...`:s;return r.createElement(ar.Tooltip,{description:d},r.createElement(al,null,c))};Wr.defaultProps={alternativeText:null,formats:null},Wr.propTypes={alternativeText:o().string,ext:o().string.isRequired,formats:o().object,mime:o().string.isRequired,name:o().string.isRequired,url:o().string.isRequired};const il=Wr;var XE=Object.defineProperty,ll=Object.getOwnPropertySymbols,e0=Object.prototype.hasOwnProperty,t0=Object.prototype.propertyIsEnumerable,cl=(e,t,n)=>t in e?XE(e,t,{enumerable:!0,configurable:!0,writable:!0,value:n}):e[t]=n,n0=(e,t)=>{for(var n in t||(t={}))e0.call(t,n)&&cl(e,n,t[n]);if(ll)for(var n of ll(t))t0.call(t,n)&&cl(e,n,t[n]);return e};const ul=({value:e})=>r.createElement(tl.AvatarGroup,null,e.map((t,n)=>{const s=`${t.id}${n}`;if(n===3){const a=`+${e.length-3}`;return r.createElement(al,{key:s,preview:!1},a)}return n>3?null:r.createElement(il,n0({key:s},t))}));ul.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 r0=ul;var dl=p(89557),o0=p(51064),s0=p.n(o0);const pl=({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})),pa()(l)};pl.propTypes={type:o().string.isRequired,value:o().any.isRequired};const Lt=pl;var a0=Object.defineProperty,ml=Object.getOwnPropertySymbols,i0=Object.prototype.hasOwnProperty,l0=Object.prototype.propertyIsEnumerable,fl=(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)&&fl(e,n,t[n]);if(ml)for(var n of ml(t))l0.call(t,n)&&fl(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}}),gl=({fieldSchema:e,metadatas:t,queryInfos:n,name:s,rowId:a,value:l})=>{const{formatMessage:i}=(0,A.useIntl)(),{notifyStatus:u}=(0,qr.useNotifyAT)(),c=ve(`${n.endPoint}/${a}/${s.split(".")[0]}`),[d,m]=(0,r.useState)(!1),f=r.createElement(r.Fragment,null,r.createElement(dl.Badge,null,l.count)," ",i({id:"content-manager.containers.ListPage.items",defaultMessage:"{number, plural, =0 {items} one {item} other {items}}"},{number:l.count})),y=()=>{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,y),{enabled:d,staleTime:0});return r.createElement(D.Box,c0({},g.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(ls.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,"...")))))};gl.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=gl,f0=(0,k.default)(L.Typography)`
|
|
1098
|
-
max-width: 500px;
|
|
1099
|
-
`,yl=({metadatas:e,value:t})=>{var n;return r.createElement(f0,{textColor:"neutral800",ellipsis:!0},r.createElement(Lt,{type:e.mainField.schema.type,value:(n=t[e.mainField.name])!=null?n:t.id}))};yl.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=yl;var y0=Object.defineProperty,hl=Object.getOwnPropertySymbols,h0=Object.prototype.hasOwnProperty,b0=Object.prototype.propertyIsEnumerable,bl=(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)&&bl(e,n,t[n]);if(hl)for(var n of hl(t))b0.call(t,n)&&bl(e,n,t[n]);return e};const v0=(0,k.default)(L.Typography)`
|
|
1100
|
-
max-width: 500px;
|
|
1101
|
-
`,El=({value:e,metadatas:t})=>{const{formatMessage:n}=(0,A.useIntl)(),{mainField:{type:s,name:a}}=t,l=r.createElement(r.Fragment,null,r.createElement(dl.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({},g.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}))))))};El.propTypes={metadatas:o().shape({mainField:o().shape({name:o().string,type:o().string,value:o().string})}).isRequired,value:o().array.isRequired};const C0=El,P0=(0,k.default)(L.Typography)`
|
|
1102
|
-
max-width: 250px;
|
|
1103
|
-
`,vl=({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})))};vl.propTypes={metadatas:o().shape({mainField:o().shape({name:o().string,type:o().string,value:o().string})}).isRequired,value:o().object.isRequired};const O0=vl;var R0=p(80022),Cl=p.n(R0);function Pl(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"?Cl()(i):!Re()(i)}return e==="relation"?Pl(s.relation)?!Re()(t):(t==null?void 0:t.count)>0:wt(e)&&e!=="biginteger"?Cl()(t):e==="boolean"?t!==null:!Re()(t)}var T0=Object.defineProperty,Ol=Object.getOwnPropertySymbols,w0=Object.prototype.hasOwnProperty,I0=Object.prototype.propertyIsEnumerable,Rl=(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)&&Rl(e,n,t[n]);if(Ol)for(var n of Ol(t))I0.call(t,n)&&Rl(e,n,t[n]);return e};const x0=(0,k.default)(L.Typography)`
|
|
1104
|
-
max-width: 300px;
|
|
1105
|
-
`,zr=({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(r0,{value:e}):r.createElement(il,D0({},e));case"relation":return Pl(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}))}};zr.defaultProps={content:void 0,queryInfos:void 0},zr.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=zr;var L0=Object.defineProperty,F0=Object.defineProperties,k0=Object.getOwnPropertyDescriptors,un=Object.getOwnPropertySymbols,Ml=Object.prototype.hasOwnProperty,Tl=Object.prototype.propertyIsEnumerable,wl=(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={}))Ml.call(t,n)&&wl(e,n,t[n]);if(un)for(var n of un(t))Tl.call(t,n)&&wl(e,n,t[n]);return e},A0=(e,t)=>F0(e,k0(t)),j0=(e,t)=>{var n={};for(var s in e)Ml.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&&Tl.call(e,s)&&(n[s]=e[s]);return n};const Ur=({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,X.useHistory)(),{formatMessage:f}=(0,A.useIntl)(),{trackUsage:y}=(0,g.useTracking)(),h=Qo();return r.createElement(St.Tbody,null,c.map((b,E)=>{const F=s.findIndex(P=>P===b.id)!==-1,C=f({id:"content-manager.components.DynamicTable.row-line",defaultMessage:"item line {number}"},{number:E});return r.createElement(St.Tr,Ft({key:b.id},(0,g.onRowClick)({fn(){y("willEditEntryFromList"),d({pathname:`${m}/${b.id}`,state:{from:m},search:h})},condition:u})),i&&r.createElement(St.Td,Ft({},g.stopPropagation),r.createElement(_E.BaseCheckbox,{"aria-label":f({id:"app.component.table.select.one-entry",defaultMessage:"Select {target}"},{target:(0,ci.Pp)(b.firstname,b.lastname)}),checked:F,onChange:()=>{l({name:b.id,value:!F})}})),n.map(P=>{var I=P,{key:R,cellFormatter:z,name:M}=I,V=j0(I,["key","cellFormatter","name"]);return r.createElement(St.Td,{key:R},typeof z=="function"?z(b,Ft({key:R,name:M},V)):r.createElement(S0,A0(Ft({content:b[M.split(".")[0]],name:M},V),{rowId:b.id})))}),u&&r.createElement(St.Td,null,r.createElement(j.Flex,Ft({justifyContent:"end"},g.stopPropagation),r.createElement(Me.IconButton,{forwardedAs:X.Link,onClick:()=>{y("willEditEntryFromButton")},to:{pathname:`${m}/${b.id}`,state:{from:m},search:h},label:f({id:"app.component.table.edit",defaultMessage:"Edit {target}"},{target:C}),noBorder:!0,icon:r.createElement(it(),null)}),e&&r.createElement(D.Box,{paddingLeft:1},r.createElement(Me.IconButton,{forwardedAs:X.Link,to:{pathname:`${m}/create/clone/${b.id}`,state:{from:m},search:h},label:f({id:"app.component.table.duplicate",defaultMessage:"Duplicate {target}"},{target:C}),noBorder:!0,icon:r.createElement(ZE(),null)})),t&&r.createElement(D.Box,{paddingLeft:1},r.createElement(Me.IconButton,{onClick:()=>{y("willDeleteEntryFromList"),a(b.id)},label:f({id:"global.delete-target",defaultMessage:"Delete {target}"},{target:C}),noBorder:!0,icon:r.createElement(Be(),null)})))))}))};Ur.defaultProps={canCreate:!1,canDelete:!1,entriesToDelete:[],onClickDelete(){},onSelectRow(){},rows:[],withBulkActions:!1,withMainAction:!1},Ur.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=Ur;var B0=Object.defineProperty,dn=Object.getOwnPropertySymbols,Il=Object.prototype.hasOwnProperty,Dl=Object.prototype.propertyIsEnumerable,xl=(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={}))Il.call(t,n)&&xl(e,n,t[n]);if(dn)for(var n of dn(t))Dl.call(t,n)&&xl(e,n,t[n]);return e},V0=(e,t)=>{var n={};for(var s in e)Il.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&&Dl.call(e,s)&&(n[s]=e[s]);return n};const Sl=e=>{var t=e,{area:n}=t,s=V0(t,["area"]);const a=Xo(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};Sl.propTypes={area:o().string.isRequired};const Ll=Sl,Fl=({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(Ll,{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"}))}))};Fl.propTypes={isConfirmButtonLoading:o().bool.isRequired,isOpen:o().bool.isRequired,onConfirm:o().func.isRequired,onToggleDialog:o().func.isRequired};const q0=Fl,kl=({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(Ll,{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"}))}))};kl.propTypes={isConfirmButtonLoading:o().bool.isRequired,isOpen:o().bool.isRequired,onConfirm:o().func.isRequired,onToggleDialog:o().func.isRequired};const W0=kl;var z0=Object.defineProperty,U0=Object.defineProperties,H0=Object.getOwnPropertyDescriptors,Al=Object.getOwnPropertySymbols,_0=Object.prototype.hasOwnProperty,G0=Object.prototype.propertyIsEnumerable,jl=(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={}))_0.call(t,n)&&jl(e,n,t[n]);if(Al)for(var n of Al(t))G0.call(t,n)&&jl(e,n,t[n]);return e},mn=(e,t)=>U0(e,H0(t));const Hr=({canCreate:e,canDelete:t,contentTypeName:n,action:s,isBulkable:a,isLoading:l,onConfirmDelete:i,onConfirmDeleteAll:u,layout:c,rows:d})=>{const{runHookWaterfall:m}=(0,g.useStrapiApp)(),f=c.contentType.options.draftAndPublish||!1,{formatMessage:y}=(0,A.useIntl)(),h=(0,fe.useSelector)(Xi),b=(0,r.useMemo)(()=>{const F=m(zt.No,{displayedHeaders:h,layout:c}).displayedHeaders.map(C=>{const{metadatas:P}=C;if(C.fieldSchema.type==="relation"){const I=`${C.name}.${C.metadatas.mainField.name}`;return mn(pn({},C),{metadatas:mn(pn({},P),{label:y({id:v(`containers.ListPage.table-headers.${C.name}`),defaultMessage:P.label})}),name:I})}return mn(pn({},C),{metadatas:mn(pn({},P),{label:y({id:v(`containers.ListPage.table-headers.${C.name}`),defaultMessage:P.label})})})});return f?[...F,{key:"__published_at_temp_key__",name:"publishedAt",fieldSchema:{type:"custom"},metadatas:{label:y({id:v("containers.ListPage.table-headers.publishedAt"),defaultMessage:"publishedAt"}),searchable:!1,sortable:!0},cellFormatter(C){const P=!Re()(C.publishedAt);return r.createElement(HE,{isPublished:P})}}]:F},[m,h,c,f,y]);return r.createElement(g.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}))};Hr.defaultProps={action:void 0},Hr.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 Z0=Hr,Q0=["json","component","media","richtext","dynamiczone","password"],K0=["createdAt","updatedAt"],Y0=(e,t)=>{const{allPermissions:n}=(0,g.useRBACProvider)(),s=(0,g.findMatchingPermissions)(n,[{action:"plugin::content-manager.explorer.read",subject:t}]),a=T()(s,["0","properties","fields"],[]);return Object.keys(T()(e,["attributes"]),{}).filter(u=>{const c=T()(e,["attributes",u],{});return!(!c.type||Q0.includes(c.type)||!a.includes(u)&&u!=="id"&&!K0.includes(u))}).sort()};var J0=p(23899),X0=p.n(J0);const $l=({displayedFilters:e})=>{const[t,n]=(0,r.useState)(!1),{formatMessage:s}=(0,A.useIntl)(),a=(0,r.useRef)(),{trackUsage:l}=(0,g.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(X0(),null),onClick:i,size:"S"},s({id:"app.utils.filters",defaultMessage:"Filters"})),t&&r.createElement(g.FilterPopoverURLQuery,{displayedFilters:e,isVisible:t,onToggle:i,source:a})),r.createElement(g.FilterListURLQuery,{filtersSchema:e}))};$l.propTypes={displayedFilters:o().arrayOf(o().shape({name:o().string.isRequired,metadatas:o().shape({label:o().string}),fieldSchema:o().shape({type:o().string})})).isRequired};const ev=$l,Bl=({contentType:e,slug:t,metadatas:n})=>{const{formatMessage:s}=(0,A.useIntl)(),l=Y0(e,t).map(i=>{const u=e.attributes[i],{type:c,enum:d}=u,m={name:"didFilterEntries",properties:{useRelation:c==="relation"}},{mainField:f,label:y}=n[i].list;return{name:i,metadatas:{label:s({id:y,defaultMessage:y})},fieldSchema:{type:c,options:d,mainField:f},trackedEvent:m}});return r.createElement(ev,{displayedFilters:l})};Bl.propTypes={contentType:o().object.isRequired,metadatas:o().object.isRequired,slug:o().string.isRequired};const tv=Bl,nv=e=>Object.keys(e).reduce((n,s)=>{const a=e[s];return yo(a)&&n.push(s),n},[]).sort(),Nl=({layout:e})=>{const t=(0,fe.useDispatch)(),n=(0,fe.useSelector)(Xi),{trackUsage:s}=(0,g.useTracking)(),{formatMessage:a}=(0,A.useIntl)(),l=nv(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(Vr({name:d[0],value:!0}))}else{const d=c.filter(m=>i.indexOf(m)===-1);t(Vr({name:d[0],value:!1}))}};return r.createElement(D.Box,{paddingTop:1,paddingBottom:1},r.createElement(de.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(de.Option,{key:c.name,value:c.name},a({id:c.intlLabel.id||c.name,defaultMessage:c.intlLabel.defaultMessage||c.name})))))};Nl.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 rv=(0,r.memo)(Nl),_r=({pagination:e})=>r.createElement(D.Box,{paddingTop:4},r.createElement(j.Flex,{alignItems:"flex-end",justifyContent:"space-between"},r.createElement(g.PageSizeURLQuery,{trackedEvent:"willChangeNumberOfEntriesPerPage"}),r.createElement(g.PaginationURLQuery,{pagination:e})));_r.defaultProps={pagination:{pageCount:0,pageSize:10,total:0}},_r.propTypes={pagination:o().shape({page:o().number,pageCount:o().number,pageSize:o().number,total:o().number})};const ov=_r;var sv=p(98399),av=Object.defineProperty,iv=Object.defineProperties,lv=Object.getOwnPropertyDescriptors,Vl=Object.getOwnPropertySymbols,cv=Object.prototype.hasOwnProperty,uv=Object.prototype.propertyIsEnumerable,ql=(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)&&ql(e,n,t[n]);if(Vl)for(var n of Vl(t))uv.call(t,n)&&ql(e,n,t[n]);return e},pv=(e,t)=>iv(e,lv(t)),Gr=(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)(D.Box)`
|
|
1106
|
-
svg {
|
|
1107
|
-
path {
|
|
1108
|
-
fill: ${({theme:e})=>e.colors.neutral900};
|
|
1109
|
-
}
|
|
1110
|
-
}
|
|
1111
|
-
`;function Wl({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:y,filterable:h,searchable:b}}}=u,E=(0,g.useNotification)(),{trackUsage:F}=(0,g.useTracking)(),{refetchPermissions:C}=(0,g.useRBACProvider)(),P=(0,r.useRef)(F),I=(0,r.useRef)(C),{notifyStatus:R}=(0,qr.useNotifyAT)();(0,g.useFocusWhenNavigate)();const[{query:z}]=(0,g.useQueryParams)(),M=Ya(z),V=(0,Ne.stringify)({plugins:z.plugins},{encode:!1}),{pathname:B}=(0,X.useLocation)(),{push:Z}=(0,X.useHistory)(),{formatMessage:U}=(0,A.useIntl)(),q=u.contentType,S=T()(q,"options.draftAndPublish",!1),G=(0,r.useRef)(""),W=(0,r.useCallback)((O,_)=>Gr(this,null,function*(){a();try{const K=_?{cancelToken:_.token}:null,{data:{results:ae,pagination:ce}}=yield ge.be.get(O,K);R(U({id:v("utils.data-loaded"),defaultMessage:"{number, plural, =1 {# entry has} other {# entries have}} successfully been loaded"},{number:ce.count})),l(ce,ae)}catch(K){if(Se().isCancel(K))return;if(T()(K,"response.status",null)===403){yield I.current(),E({type:"info",message:{id:v("permissions.not-allowed.update")}}),Z("/");return}sv.error(K),E({type:"warning",message:{id:v("error.model.fetch")}})}}),[U,a,l,R,Z,E]),ee=(0,r.useCallback)(O=>Gr(this,null,function*(){try{yield ge.be.post(ve(`collection-types/${d}/actions/bulkDelete`),{ids:O});const _=ve(`collection-types/${d}${M}`);W(_),P.current("didBulkDeleteEntries")}catch(_){E({type:"warning",message:{id:v("error.record.delete")}})}}),[W,M,d,E]),w=(0,r.useCallback)(O=>Gr(this,null,function*(){try{yield ge.be.delete(ve(`collection-types/${d}/${O}`));const _=ve(`collection-types/${d}${M}`);W(_),E({type:"success",message:{id:v("success.record.delete")}})}catch(_){const K=T()(_,"response.payload.message",U({id:v("error.record.delete")}));E({type:"warning",message:K})}}),[d,M,W,E,U]);(0,r.useEffect)(()=>{const _=Se().CancelToken.source(),K=n,ae=ve(`collection-types/${d}${M}`);return K&&ae.includes(G.current)&&W(ae,_),()=>{G.current=d,_.cancel("Operation canceled by the user.")}},[n,a,d,M,l,W]);const $=U({id:v("header.name"),defaultMessage:"Content"}),Y=U({id:q.info.displayName,defaultMessage:q.info.displayName||$}),Q=n?U({id:v("pages.ListView.header-subtitle"),defaultMessage:"{number, plural, =0 {# entries} one {# entry} other {# entries}} found"},{number:m}):null,x=O=>e?r.createElement(ye.Button,pv(dv({},O),{forwardedAs:X.Link,onClick:()=>{const _=S?{status:"draft"}:{};P.current("willCreateEntry",_)},to:{pathname:`${B}/create`,search:z.plugins?V:""},startIcon:r.createElement(ut(),null),style:{textDecoration:"none"}}),U({id:v("HeaderLayout.button.label-add-entry"),defaultMessage:"Create new entry"})):null;return r.createElement(oe.Main,{"aria-busy":i},r.createElement(te.HeaderLayout,{primaryAction:x(),subtitle:Q,title:Y,navigationAction:r.createElement(g.Link,{startIcon:r.createElement(rn(),null),to:"/content-manager/"},U({id:"global.back",defaultMessage:"Back"}))}),!n&&r.createElement(te.ActionLayout,{endActions:r.createElement(_t,{area:"contentManager.listView.actions"})}),n&&r.createElement(te.ActionLayout,{endActions:r.createElement(r.Fragment,null,r.createElement(_t,{area:"contentManager.listView.actions"}),r.createElement(rv,{layout:u}),r.createElement(g.CheckPermissions,{permissions:mv.collectionTypesConfigurations},r.createElement(fv,{paddingTop:1,paddingBottom:1},r.createElement(Me.IconButton,{onClick:()=>{F("willEditListLayout")},forwardedAs:X.Link,to:{pathname:`${d}/configurations/list`,search:V},icon:r.createElement(ki(),null),label:U({id:"app.links.configure-view",defaultMessage:"Configure the view"})})))),startActions:r.createElement(r.Fragment,null,b&&r.createElement(g.SearchURLQuery,{label:U({id:"app.component.search.label",defaultMessage:"Search for {target}"},{target:Y}),placeholder:U({id:"global.search",defaultMessage:"Search"}),trackedEvent:"didSearch"}),h&&r.createElement(tv,{contentType:q,slug:d,metadatas:f}))}),r.createElement(te.ContentLayout,null,n?r.createElement(r.Fragment,null,r.createElement(Z0,{canCreate:e,canDelete:t,contentTypeName:Y,onConfirmDeleteAll:ee,onConfirmDelete:w,isBulkable:y,isLoading:i,layout:u,rows:s,action:x({variant:"secondary"})}),r.createElement(ov,{pagination:{pageCount:(c==null?void 0:c.pageCount)||1}})):r.createElement(g.NoPermissions,null)))}Wl.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=UE();function yv(e){return(0,Ji.bindActionCreators)({getData:jE,getDataSucceeded:$E,onChangeListHeaders:Vr,onResetListHeaders:BE},e)}const hv=(0,fe.connect)(gv,yv),bv=(0,Ji.compose)(hv)((0,r.memo)(Wl,We()));var Ev=Object.defineProperty,zl=Object.getOwnPropertySymbols,vv=Object.prototype.hasOwnProperty,Cv=Object.prototype.propertyIsEnumerable,Ul=(e,t,n)=>t in e?Ev(e,t,{enumerable:!0,configurable:!0,writable:!0,value:n}):e[t]=n,Hl=(e,t)=>{for(var n in t||(t={}))vv.call(t,n)&&Ul(e,n,t[n]);if(zl)for(var n of zl(t))Cv.call(t,n)&&Ul(e,n,t[n]);return e};const Zr=e=>{const t=(0,r.useMemo)(()=>Oo(e.slug),[e.slug]),{isLoading:n,allowedActions:s}=(0,g.useRBAC)(t,e.permissions);return n?r.createElement(g.LoadingIndicatorPage,null):r.createElement(bv,Hl(Hl({},e),s))};Zr.defaultProps={permissions:[]},Zr.propTypes={permissions:o().array,slug:o().string.isRequired};const Pv=(0,r.memo)(Zr,(e,t)=>{const n=(0,g.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,_l=Object.prototype.hasOwnProperty,Gl=Object.prototype.propertyIsEnumerable,Zl=(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={}))_l.call(t,n)&&Zl(e,n,t[n]);if(fn)for(var n of fn(t))Gl.call(t,n)&&Zl(e,n,t[n]);return e},wv=(e,t)=>Rv(e,Mv(t)),Iv=(e,t)=>{var n={};for(var s in e)_l.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&&Gl.call(e,s)&&(n[s]=e[s]);return n};const Ql=e=>{var t=e,{layout:n}=t,s=Iv(t,["layout"]);const a=(0,fe.useDispatch)(),{replace:l}=(0,X.useHistory)(),[{query:i,rawQuery:u}]=(0,g.useQueryParams)(),c=Yo(i,s.slug,"listView"),d=Zo(s.slug);return(0,r.useEffect)(()=>{u||l(d)},[u,l,d]),(0,r.useEffect)(()=>{a(VE(n))},[a,n]),(0,r.useEffect)(()=>()=>{a(NE())},[a]),c?r.createElement(Pv,wv(Tv({},s),{layout:n,permissions:c})):null};Ql.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=Ql,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
|
-
`,Qr=({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(le.Grid,{gap:4},r.createElement(le.GridItem,{s:12,col:6},r.createElement(de.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(de.Option,{key:l,value:l},l)))),r.createElement(le.GridItem,{s:12,col:3},r.createElement(de.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(de.Option,{key:l,value:l},l)))),r.createElement(le.GridItem,{s:12,col:3},r.createElement(de.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(de.Option,{key:l,value:l},l))))))};Qr.defaultProps={modifiedData:{},sortOptions:[]},Qr.propTypes={modifiedData:o().object,onChange:o().func.isRequired,sortOptions:o().array};const Lv=Qr,Kr=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
|
-
`,Kl=(0,k.default)(Kr)`
|
|
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
|
-
${Kl} {
|
|
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
|
-
`,Yl=({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),y=(0,r.useRef)(),h=lo(n),b=()=>{y.current&&y.current.click()},[,E]=(0,Te.useDrop)({accept:Oe.FIELD,hover(R,z){if(!m.current)return;const M=R.index,V=e;if(M===V)return;const B=m.current.getBoundingClientRect(),Z=(B.right-B.left)/2,q=z.getClientOffset().x-B.left;M>V&&q>Z||M<V&&q<Z||(a(M,V),R.index=V)}}),[{isDragging:F},C,P]=(0,Te.useDrag)({type:Oe.FIELD,item(){return{index:e,labelField:n,name:i}},collect:R=>({isDragging:R.isDragging()}),end(){u(!1)}});(0,r.useEffect)(()=>{P((0,Kt.rX)(),{captureDraggingState:!1})},[P]),(0,r.useEffect)(()=>{F&&u(!0)},[F,u]),(0,r.useEffect)(()=>{t||f(R=>!R)},[t]);const I={dragRef:C(d),dropRef:E(m)};return r.createElement(kv,{ref:I?I.dropRef:null},F&&r.createElement(En,{transparent:!0,labelField:h}),!F&&t&&r.createElement(En,{isSibling:!0,labelField:h}),!F&&!t&&r.createElement(Fv,{borderColor:"neutral150",background:"neutral100",hasRadius:!0,justifyContent:"space-between",onClick:b,isDragging:F},r.createElement(se.Stack,{horizontal:!0,spacing:3},r.createElement(Kl,{as:"span","aria-label":c({id:v("components.DraggableCard.move.field"),defaultMessage:"Move {item}"},{item:i}),onClick:R=>R.stopPropagation(),ref:I.dragRef,type:"button"},r.createElement(Xe(),null)),r.createElement(L.Typography,{fontWeight:"bold"},h)),r.createElement(j.Flex,{paddingLeft:3},r.createElement(Kr,{ref:y,onClick:R=>{R.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(Kr,{onClick:l,"data-testid":`delete-${i}`,"aria-label":c({id:v("components.DraggableCard.delete.field"),defaultMessage:"Delete {item}"},{item:i}),type:"button"},r.createElement(io(),null)))))};Yl.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=Yl,Jl=(0,k.default)(D.Box)`
|
|
1166
|
-
flex: ${({size:e})=>e};
|
|
1167
|
-
`,jv=(0,k.default)(Jl)`
|
|
1168
|
-
overflow-x: scroll;
|
|
1169
|
-
overflow-y: hidden;
|
|
1170
|
-
`,$v=(0,k.default)(Jl)`
|
|
1171
|
-
max-width: ${32/16}rem;
|
|
1172
|
-
`,Xl=({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),y=(0,r.useRef)();function h(...E){f("add"),s(...E)}function b(...E){f("remove"),i(...E)}return(0,r.useEffect)(()=>{m==="add"&&(y==null?void 0:y.current)&&(y.current.scrollLeft=y.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:y},r.createElement(se.Stack,{horizontal:!0,spacing:3},e.map((E,F)=>r.createElement(Av,{key:E,index:F,isDraggingSibling:c,onMoveField:l,onClickEditField:a,onRemoveField:C=>b(C,F),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))))))};Xl.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=Xl,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
|
-
`,ec=({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(Ge.ModalLayout,{onClose:s,labelledBy:"title"},r.createElement("form",{onSubmit:l},r.createElement(Ge.ModalHeader,null,r.createElement(Nv,null,r.createElement(_i,{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(Ge.ModalBody,null,r.createElement(le.Grid,{gap:4},r.createElement(le.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(le.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(Ge.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"}))})))};ec.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=ec;var qv=Object.defineProperty,Wv=Object.defineProperties,zv=Object.getOwnPropertyDescriptors,tc=Object.getOwnPropertySymbols,Uv=Object.prototype.hasOwnProperty,Hv=Object.prototype.propertyIsEnumerable,nc=(e,t,n)=>t in e?qv(e,t,{enumerable:!0,configurable:!0,writable:!0,value:n}):e[t]=n,_v=(e,t)=>{for(var n in t||(t={}))Uv.call(t,n)&&nc(e,n,t[n]);if(tc)for(var n of tc(t))Hv.call(t,n)&&nc(e,n,t[n]);return e},Gv=(e,t)=>Wv(e,zv(t));const Zv=(e,t)=>Gv(_v({},e),{initialData:t,modifiedData:t}),Yr={fieldForm:{},fieldToEdit:"",initialData:{},modifiedData:{}},Qv=(e=Yr,t)=>(0,qt.default)(e,n=>{const s=["modifiedData","layouts","list"];switch(t.type){case"ADD_FIELD":{const a=T()(e,s,[]);ne()(n,s,[...a,t.item]);break}case"MOVE_FIELD":{const a=T()(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=T()(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=T()(n,["modifiedData","metadatas",a,"list","label"],""),n.fieldForm.sortable=T()(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 rc=({layout:e,slug:t})=>{const{formatMessage:n}=(0,A.useIntl)(),{trackUsage:s}=(0,g.useTracking)(),a=Qo(),l=(0,g.useNotification)(),{refetchData:i}=(0,r.useContext)(uo),[u,c]=(0,r.useState)(!1),d=()=>c(x=>!x),[m,f]=(0,r.useState)(!1),y=()=>f(x=>!x),[h,b]=(0,r.useReducer)(Qv,Yr,()=>Zv(Yr,e)),{fieldToEdit:E,fieldForm:F,initialData:C,modifiedData:P}=h,{attributes:I}=e,R=P.layouts.list,z=()=>{const{settings:{pageSize:x,defaultSortBy:O,defaultSortOrder:_},kind:K,uid:ae}=C,ce=`${O}:${_}`,Fe=`${(0,Ne.stringify)({page:1,pageSize:x,sort:ce},{encode:!1})}${a?`&${a}`:""}`;return`/content-manager/${K}/${ae}?${Fe}`},M=({target:{name:x,value:O}})=>{b({type:"ON_CHANGE",keys:x,value:x==="settings.pageSize"?parseInt(O,10):O})},V=()=>Yv(void 0,null,function*(){const x=Ii()(P,["layouts","settings","metadatas"]);W.mutate(x)}),B=x=>{b({type:"ADD_FIELD",item:x})},Z=(x,O)=>{x.stopPropagation(),R.length===1?l({type:"info",message:{id:v("notification.info.minimumFields")}}):b({type:"REMOVE_FIELD",index:O})},U=x=>{x.preventDefault(),d(),s("willSaveContentTypeLayout")},q=x=>{b({type:"SET_FIELD_TO_EDIT",fieldToEdit:x}),y()},S=()=>{b({type:"UNSET_FIELD_TO_EDIT"}),y()},G=x=>{x.preventDefault(),y(),b({type:"SUBMIT_FIELD_FORM"})},W=(0,Tr.useMutation)(x=>xv(x,t),{onSuccess(){s("didEditListSettings"),i()},onError(){l({type:"warning",message:{id:"notification.error"}})}}),{isLoading:ee}=W,w=({target:{name:x,value:O}})=>{b({type:"ON_CHANGE_FIELD_METAS",name:x,value:O})},$=Object.entries(I).reduce((x,O)=>{const[_,K]=O,ae=yo(K),ce=R.includes(_);return ae&&!ce&&x.push(_),x},[]).sort(),Y=Object.entries(I).reduce((x,O)=>{const[_,{type:K}]=O;return Kv.includes(K)||x.push(_),x},[]),Q=(x,O)=>{b({type:"MOVE_FIELD",originalIndex:x,atIndex:O})};return r.createElement(te.Layout,null,r.createElement(oe.Main,{"aria-busy":ee},r.createElement("form",{onSubmit:U},r.createElement(te.HeaderLayout,{navigationAction:r.createElement(g.Link,{startIcon:r.createElement(rn(),null),to:z,id:"go-back"},n({id:"global.back",defaultMessage:"Back"})),primaryAction:r.createElement(ye.Button,{size:"S",startIcon:r.createElement(ft(),null),disabled:Xt()(P,C),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()(P.info.displayName)})}),r.createElement(te.ContentLayout,null,r.createElement(D.Box,{background:"neutral0",hasRadius:!0,shadow:"tableShadow",paddingTop:6,paddingBottom:6,paddingLeft:7,paddingRight:7},r.createElement(Lv,{modifiedData:P,onChange:M,sortOptions:Y}),r.createElement(D.Box,{paddingTop:6,paddingBottom:6},r.createElement(Ut.Divider,null)),r.createElement(Bv,{listRemainingFields:$,displayedFields:R,onAddField:B,onClickEditField:q,onMoveField:Q,onRemoveField:Z,metadatas:P.metadatas}))),r.createElement(g.ConfirmDialog,{bodyText:{id:v("popUpWarning.warning.updateAllSettings"),defaultMessage:"This will modify all your settings"},iconRightButton:r.createElement(ft(),null),isConfirmButtonLoading:ee,isOpen:u,onToggleDialog:d,onConfirm:V,variantRightButton:"success-light"})),m&&r.createElement(Vv,{attributes:I,fieldForm:F,fieldToEdit:E,onChangeEditLabel:w,onCloseModal:S,onSubmit:G,type:T()(I,[E,"type"],"text")})))};rc.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)(rc),oc=De.Z.contentManager,sc=({match:{params:{slug:e},url:t}})=>{const{isLoading:n,layout:s,updateLayout:a}=zo(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((y,h)=>(y[h]=Nt(s.components[h]),y),{})),{rawContentTypeLayout:m,rawComponentsLayouts:f}},[s]);if((0,N.get)(s,["contentType","uid"],null)!==e||n)return r.createElement(g.LoadingIndicatorPage,null);const c=({location:{state:m},history:{goBack:f},match:{params:{id:y,origin:h}}},b)=>r.createElement(b,{slug:e,layout:s,state:m,goBack:f,id:y,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(X.Route,{key:m,path:`${t}/${m}`,render:y=>c(y,f)}));return r.createElement(Lc.SV,{FallbackComponent:g.ErrorFallback},r.createElement(po.Provider,{value:s},r.createElement(X.Switch,null,r.createElement(X.Route,{path:`${t}/configurations/list`},r.createElement(g.CheckPagePermissions,{permissions:oc.collectionTypesConfigurations},r.createElement(Jv,{layout:l,slug:e,updateLayout:a}))),r.createElement(X.Route,{path:`${t}/configurations/edit`},r.createElement(g.CheckPagePermissions,{permissions:oc.collectionTypesConfigurations},r.createElement(Nr,{components:i,isContentTypeView:!0,mainLayout:l,slug:e,updateLayout:a}))),d)))};sc.propTypes={match:o().shape({url:o().string.isRequired,params:o().shape({slug:o().string.isRequired}).isRequired}).isRequired};const Xv=(0,r.memo)(sc);var ac=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)(ac.Z,ac.q),s=(0,r.useMemo)(Rn,[]),{schemas:a}=(0,fe.useSelector)(i=>s(i),fe.shallowEqual),{uid:l}=(0,X.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(Io(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(g.LoadingIndicatorPage,null):r.createElement(g.CheckPagePermissions,{permissions:nC.componentsConfigurations},r.createElement(Nr,{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,g.useFocusWhenNavigate)(),r.createElement(oe.Main,null,r.createElement(te.HeaderLayout,{title:e({id:v("header.name"),defaultMessage:"Content"})}),r.createElement(te.ContentLayout,null,r.createElement(sC.EmptyStateLayout,{action:r.createElement(g.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,g.useFocusWhenNavigate)(),r.createElement(oe.Main,null,r.createElement(te.HeaderLayout,{title:e({id:v("header.name"),defaultMessage:"Content"})}),r.createElement(te.ContentLayout,null,r.createElement(g.NoPermissions,null)))},uC=De.Z.contentManager,ic=({match:{params:{slug:e},url:t}})=>{const{isLoading:n,layout:s,updateLayout:a}=zo(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(g.LoadingIndicatorPage,null):r.createElement(po.Provider,{value:s},r.createElement(X.Switch,null,r.createElement(X.Route,{path:`${t}/configurations/edit`},r.createElement(g.CheckPagePermissions,{permissions:uC.singleTypesConfigurations},r.createElement(Nr,{components:i,isContentTypeView:!0,mainLayout:l,slug:e,updateLayout:a}))),r.createElement(X.Route,{path:t,render:({location:{state:u},history:{goBack:c}})=>r.createElement(sn,{layout:s,slug:e,isSingleType:!0,state:u,goBack:c})})))};ic.propTypes={match:o().shape({url:o().string.isRequired,params:o().shape({slug:o().string.isRequired}).isRequired}).isRequired};const dC=(0,r.memo)(ic);var pC=p(58469),mC=p(59578),lc=p.n(mC),kt=p(89420),fC=Object.defineProperty,gC=Object.defineProperties,yC=Object.getOwnPropertyDescriptors,cc=Object.getOwnPropertySymbols,hC=Object.prototype.hasOwnProperty,bC=Object.prototype.propertyIsEnumerable,uc=(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)&&uc(e,n,t[n]);if(cc)for(var n of cc(t))bC.call(t,n)&&uc(e,n,t[n]);return e},vC=(e,t)=>gC(e,yC(t));const dc=(e,t)=>(0,pC.ZP)(e,lc()(t),{keys:[n=>lc()(n.title)]}),CC=()=>{const[e,t]=(0,r.useState)(""),{formatMessage:n}=(0,A.useIntl)(),s=(0,r.useMemo)(wu,[]),{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:ie()(dc(u,e),h=>h.title.toLowerCase())},{id:"singleTypes",title:{id:v("components.LeftMenu.single-types"),defaultMessage:"Single Types"},searchable:!0,links:ie()(dc(c,e),h=>h.title.toLowerCase())}],m=()=>{t("")},f=({target:{value:h}})=>{t(h)},y=n({id:v("header.name"),defaultMessage:"Content"});return r.createElement(kt.SubNav,{ariaLabel:y},r.createElement(kt.SubNavHeader,{label:y,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 F=E.search?`?${E.search}`:"";return r.createElement(kt.SubNavLink,{as:X.NavLink,key:E.uid,to:`${E.to}${F}`},E.title)}))})))};var Jr=p(92886);const PC=()=>({type:Jr.ZA}),OC=()=>({type:Jr.c2}),RC=(e,t,n,s)=>({type:Jr.ix,data:{authorizedCtLinks:e,authorizedStLinks:t,components:s,contentTypeSchemas:n}}),pc=(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,N.chain)(e).groupBy("kind").map((a,l)=>({name:l,links:a})).sortBy("name").value();return{collectionTypesSectionLinks:pc((0,N.get)(n,"links",[]),"collectionTypes",t),singleTypesSectionLinks:pc((0,N.get)(s,"links",[]),"singleTypes")}},mc=(e,t)=>t.map(({permissions:n})=>(0,g.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=mc(t,a),u=yield Promise.all(i),c=a.filter((y,h)=>u[h]),d=mc(t,l),m=yield Promise.all(d),f=l.filter((y,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,fc=Object.getOwnPropertySymbols,FC=Object.prototype.hasOwnProperty,kC=Object.prototype.propertyIsEnumerable,gc=(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)&&gc(e,n,t[n]);if(fc)for(var n of fc(t))kC.call(t,n)&&gc(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,g.useNotification)(),n=(0,fe.useSelector)(Rt()),s=(0,r.useRef)(),{allPermissions:a}=(0,g.useRBACProvider)(),{runHookWaterfall:l}=(0,g.useStrapiApp)(),u=Se().CancelToken.source(),{notifyStatus:c}=(0,qr.useNotifyAT)(),{formatMessage:d}=(0,A.useIntl)(),m=()=>$C(void 0,null,function*(){e(PC());try{const[{data:{data:f}},{data:{data:y}}]=yield Promise.all(["components","content-types"].map(P=>ge.be.get(ve(P),{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(y,a,t),{ctLinks:E}=l(zt.LK,{ctLinks:h,models:y}),{stLinks:F}=l(zt.dV,{stLinks:b,models:y}),C=RC(E,F,y,f);e(C)}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,yc=()=>{const e=(0,X.useRouteMatch)("/content-manager/:kind/:uid"),{status:t,collectionTypeLinks:n,singleTypeLinks:s,models:a,refetchData:l}=BC(),i=ie()([...n,...s],y=>y.title.toLowerCase()),{pathname:u}=(0,X.useLocation)(),{formatMessage:c}=(0,A.useIntl)(),{startSection:d}=(0,g.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(te.HeaderLayout,{title:c({id:v("header.name"),defaultMessage:"Content"})}),r.createElement(g.LoadingIndicatorPage,null));const f=a.filter(({isDisplayed:y})=>y);return i.length===0&&f.length>0&&u!=="/content-manager/403"?r.createElement(X.Redirect,{to:"/content-manager/403"}):f.length===0&&u!=="/content-manager/no-content-types"?r.createElement(X.Redirect,{to:"/content-manager/no-content-types"}):!e&&i.length>0?r.createElement(X.Redirect,{to:`${i[0].to}${i[0].search?`?${i[0].search}`:""}`}):r.createElement(te.Layout,{sideNav:r.createElement(CC,null)},r.createElement(Sc,null),r.createElement(uo.Provider,{value:{refetchData:l}},r.createElement(X.Switch,null,r.createElement(X.Route,{path:"/content-manager/components/:uid/configurations/edit"},r.createElement(g.CheckPagePermissions,{permissions:NC.componentsConfigurations},r.createElement(oC,null))),r.createElement(X.Route,{path:"/content-manager/collectionType/:slug",component:Xv}),r.createElement(X.Route,{path:"/content-manager/singleType/:slug",component:dC}),r.createElement(X.Route,{path:"/content-manager/403"},r.createElement(cC,null)),r.createElement(X.Route,{path:"/content-manager/no-content-types"},r.createElement(lC,null)),r.createElement(X.Route,{path:"",component:g.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(yc,null))}},57544:()=>{},59599:()=>{},42310:()=>{},33842:()=>{},85695:()=>{}}]);
|