@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
|
@@ -0,0 +1,1201 @@
|
|
|
1
|
+
(self.webpackChunk_strapi_admin=self.webpackChunk_strapi_admin||[]).push([[994],{37475:(Dc,st)=>{var p=function(){var r={trace:function(){},yy:{},symbols_:{error:2,JSONString:3,STRING:4,JSONNumber:5,NUMBER:6,JSONNullLiteral:7,NULL:8,JSONBooleanLiteral:9,TRUE:10,FALSE:11,JSONText:12,JSONValue:13,EOF:14,JSONObject:15,JSONArray:16,"{":17,"}":18,JSONMemberList:19,JSONMember:20,":":21,",":22,"[":23,"]":24,JSONElementList:25,$accept:0,$end:1},terminals_:{2:"error",4:"STRING",6:"NUMBER",8:"NULL",10:"TRUE",11:"FALSE",14:"EOF",17:"{",18:"}",21:":",22:",",23:"[",24:"]"},productions_:[0,[3,1],[5,1],[7,1],[9,1],[9,1],[12,2],[13,1],[13,1],[13,1],[13,1],[13,1],[13,1],[15,2],[15,3],[20,3],[19,1],[19,3],[16,2],[16,3],[25,1],[25,3]],performAction:function(y,ee,ie,N,Ee,ce,Ie){var ge=ce.length-1;switch(Ee){case 1:this.$=y.replace(/\\(\\|")/g,"$1").replace(/\\n/g,`
|
|
2
|
+
`).replace(/\\r/g,"\r").replace(/\\t/g," ").replace(/\\v/g,"\v").replace(/\\f/g,"\f").replace(/\\b/g,"\b");break;case 2:this.$=Number(y);break;case 3:this.$=null;break;case 4:this.$=!0;break;case 5:this.$=!1;break;case 6:return this.$=ce[ge-1];case 13:this.$={};break;case 14:this.$=ce[ge-1];break;case 15:this.$=[ce[ge-2],ce[ge]];break;case 16:this.$={},this.$[ce[ge][0]]=ce[ge][1];break;case 17:this.$=ce[ge-2],ce[ge-2][ce[ge][0]]=ce[ge][1];break;case 18:this.$=[];break;case 19:this.$=ce[ge-1];break;case 20:this.$=[ce[ge]];break;case 21:this.$=ce[ge-2],ce[ge-2].push(ce[ge]);break}},table:[{3:5,4:[1,12],5:6,6:[1,13],7:3,8:[1,9],9:4,10:[1,10],11:[1,11],12:1,13:2,15:7,16:8,17:[1,14],23:[1,15]},{1:[3]},{14:[1,16]},{14:[2,7],18:[2,7],22:[2,7],24:[2,7]},{14:[2,8],18:[2,8],22:[2,8],24:[2,8]},{14:[2,9],18:[2,9],22:[2,9],24:[2,9]},{14:[2,10],18:[2,10],22:[2,10],24:[2,10]},{14:[2,11],18:[2,11],22:[2,11],24:[2,11]},{14:[2,12],18:[2,12],22:[2,12],24:[2,12]},{14:[2,3],18:[2,3],22:[2,3],24:[2,3]},{14:[2,4],18:[2,4],22:[2,4],24:[2,4]},{14:[2,5],18:[2,5],22:[2,5],24:[2,5]},{14:[2,1],18:[2,1],21:[2,1],22:[2,1],24:[2,1]},{14:[2,2],18:[2,2],22:[2,2],24:[2,2]},{3:20,4:[1,12],18:[1,17],19:18,20:19},{3:5,4:[1,12],5:6,6:[1,13],7:3,8:[1,9],9:4,10:[1,10],11:[1,11],13:23,15:7,16:8,17:[1,14],23:[1,15],24:[1,21],25:22},{1:[2,6]},{14:[2,13],18:[2,13],22:[2,13],24:[2,13]},{18:[1,24],22:[1,25]},{18:[2,16],22:[2,16]},{21:[1,26]},{14:[2,18],18:[2,18],22:[2,18],24:[2,18]},{22:[1,28],24:[1,27]},{22:[2,20],24:[2,20]},{14:[2,14],18:[2,14],22:[2,14],24:[2,14]},{3:20,4:[1,12],20:29},{3:5,4:[1,12],5:6,6:[1,13],7:3,8:[1,9],9:4,10:[1,10],11:[1,11],13:30,15:7,16:8,17:[1,14],23:[1,15]},{14:[2,19],18:[2,19],22:[2,19],24:[2,19]},{3:5,4:[1,12],5:6,6:[1,13],7:3,8:[1,9],9:4,10:[1,10],11:[1,11],13:31,15:7,16:8,17:[1,14],23:[1,15]},{18:[2,17],22:[2,17]},{18:[2,15],22:[2,15]},{22:[2,21],24:[2,21]}],defaultActions:{16:[2,6]},parseError:function(y,ee){throw new Error(y)},parse:function(y){var ee=this,ie=[0],N=[null],Ee=[],ce=this.table,Ie="",ge=0,E=0,Le=0,De=2,o=1;this.lexer.setInput(y),this.lexer.yy=this.yy,this.yy.lexer=this.lexer,typeof this.lexer.yylloc=="undefined"&&(this.lexer.yylloc={});var ht=this.lexer.yylloc;Ee.push(ht),typeof this.yy.parseError=="function"&&(this.parseError=this.yy.parseError);function At(x){ie.length=ie.length-2*x,N.length=N.length-x,Ee.length=Ee.length-x}function jt(){var x;return x=ee.lexer.lex()||1,typeof x!="number"&&(x=ee.symbols_[x]||x),x}for(var Oe,Ye,Me,we,oo,bt,qe={},Xe,Re,L,D;;){Me=ie[ie.length-1],this.defaultActions[Me]?we=this.defaultActions[Me]:(Oe==null&&(Oe=jt()),we=ce[Me]&&ce[Me][Oe]);e:if(typeof we=="undefined"||!we.length||!we[0]){if(!Le){D=[];for(Xe in ce[Me])this.terminals_[Xe]&&Xe>2&&D.push("'"+this.terminals_[Xe]+"'");var W="";this.lexer.showPosition?W="Parse error on line "+(ge+1)+`:
|
|
3
|
+
`+this.lexer.showPosition()+`
|
|
4
|
+
Expecting `+D.join(", ")+", got '"+this.terminals_[Oe]+"'":W="Parse error on line "+(ge+1)+": Unexpected "+(Oe==1?"end of input":"'"+(this.terminals_[Oe]||Oe)+"'"),this.parseError(W,{text:this.lexer.match,token:this.terminals_[Oe]||Oe,line:this.lexer.yylineno,loc:ht,expected:D})}if(Le==3){if(Oe==o)throw new Error(W||"Parsing halted.");E=this.lexer.yyleng,Ie=this.lexer.yytext,ge=this.lexer.yylineno,ht=this.lexer.yylloc,Oe=jt()}for(;!(De.toString()in ce[Me]);){if(Me==0)throw new Error(W||"Parsing halted.");At(1),Me=ie[ie.length-1]}Ye=Oe,Oe=De,Me=ie[ie.length-1],we=ce[Me]&&ce[Me][De],Le=3}if(we[0]instanceof Array&&we.length>1)throw new Error("Parse Error: multiple actions possible at state: "+Me+", token: "+Oe);switch(we[0]){case 1:ie.push(Oe),N.push(this.lexer.yytext),Ee.push(this.lexer.yylloc),ie.push(we[1]),Oe=null,Ye?(Oe=Ye,Ye=null):(E=this.lexer.yyleng,Ie=this.lexer.yytext,ge=this.lexer.yylineno,ht=this.lexer.yylloc,Le>0&&Le--);break;case 2:if(Re=this.productions_[we[1]][1],qe.$=N[N.length-Re],qe._$={first_line:Ee[Ee.length-(Re||1)].first_line,last_line:Ee[Ee.length-1].last_line,first_column:Ee[Ee.length-(Re||1)].first_column,last_column:Ee[Ee.length-1].last_column},bt=this.performAction.call(qe,Ie,E,ge,this.yy,we[1],N,Ee),typeof bt!="undefined")return bt;Re&&(ie=ie.slice(0,-1*Re*2),N=N.slice(0,-1*Re),Ee=Ee.slice(0,-1*Re)),ie.push(this.productions_[we[1]][0]),N.push(qe.$),Ee.push(qe._$),L=ce[ie[ie.length-2]][ie[ie.length-1]],ie.push(L);break;case 3:return!0}}return!0}},it=function(){var oe={EOF:1,parseError:function(ee,ie){if(this.yy.parseError)this.yy.parseError(ee,ie);else throw new Error(ee)},setInput:function(y){return this._input=y,this._more=this._less=this.done=!1,this.yylineno=this.yyleng=0,this.yytext=this.matched=this.match="",this.conditionStack=["INITIAL"],this.yylloc={first_line:1,first_column:0,last_line:1,last_column:0},this},input:function(){var y=this._input[0];this.yytext+=y,this.yyleng++,this.match+=y,this.matched+=y;var ee=y.match(/\n/);return ee&&this.yylineno++,this._input=this._input.slice(1),y},unput:function(y){return this._input=y+this._input,this},more:function(){return this._more=!0,this},less:function(y){this._input=this.match.slice(y)+this._input},pastInput:function(){var y=this.matched.substr(0,this.matched.length-this.match.length);return(y.length>20?"...":"")+y.substr(-20).replace(/\n/g,"")},upcomingInput:function(){var y=this.match;return y.length<20&&(y+=this._input.substr(0,20-y.length)),(y.substr(0,20)+(y.length>20?"...":"")).replace(/\n/g,"")},showPosition:function(){var y=this.pastInput(),ee=new Array(y.length+1).join("-");return y+this.upcomingInput()+`
|
|
5
|
+
`+ee+"^"},next:function(){if(this.done)return this.EOF;this._input||(this.done=!0);var y,ee,ie,N,Ee,ce;this._more||(this.yytext="",this.match="");for(var Ie=this._currentRules(),ge=0;ge<Ie.length&&(ie=this._input.match(this.rules[Ie[ge]]),!(ie&&(!ee||ie[0].length>ee[0].length)&&(ee=ie,N=ge,!this.options.flex)));ge++);if(ee)return ce=ee[0].match(/\n.*/g),ce&&(this.yylineno+=ce.length),this.yylloc={first_line:this.yylloc.last_line,last_line:this.yylineno+1,first_column:this.yylloc.last_column,last_column:ce?ce[ce.length-1].length-1:this.yylloc.last_column+ee[0].length},this.yytext+=ee[0],this.match+=ee[0],this.yyleng=this.yytext.length,this._more=!1,this._input=this._input.slice(ee[0].length),this.matched+=ee[0],y=this.performAction.call(this,this.yy,this,Ie[N],this.conditionStack[this.conditionStack.length-1]),this.done&&this._input&&(this.done=!1),y||void 0;if(this._input==="")return this.EOF;this.parseError("Lexical error on line "+(this.yylineno+1)+`. Unrecognized text.
|
|
6
|
+
`+this.showPosition(),{text:"",token:null,line:this.yylineno})},lex:function(){var ee=this.next();return typeof ee!="undefined"?ee:this.lex()},begin:function(ee){this.conditionStack.push(ee)},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(ee){this.begin(ee)}};return oe.options={},oe.performAction=function(ee,ie,N,Ee){var ce=Ee;switch(N){case 0:break;case 1:return 6;case 2:return ie.yytext=ie.yytext.substr(1,ie.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"}},oe.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)/,/^(?:$)/,/^(?:.)/],oe.conditions={INITIAL:{rules:[0,1,2,3,4,5,6,7,8,9,10,11,12,13],inclusive:!0}},oe}();return r.lexer=it,r}();st.parser=p,st.parse=function(){return p.parse.apply(p,arguments)},st.main=function(it){if(!it[1])throw new Error("Usage: "+it[0]+" FILE")}},46741:(Dc,st,p)=>{"use strict";p.r(st),p.d(st,{App:()=>wc,default:()=>hO});var r=p(32735),it=p(99357),oe=p(5141),y=p(88425),ee=p(11856),ie=p(16540),N=p(5636),Ee=p(98978),ce=p.n(Ee),Ie=p(83983);const E=e=>`content-manager.${e}`;var Le=p(74506),De=p(60216),o=p.n(De);const At=(0,r.createContext)();var jt=Object.defineProperty,Oe=Object.getOwnPropertySymbols,Ye=Object.prototype.hasOwnProperty,Me=Object.prototype.propertyIsEnumerable,we=(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)&&we(e,n,t[n]);if(Oe)for(var n of Oe(t))Me.call(t,n)&&we(e,n,t[n]);return e},bt=(e,t)=>{var n={};for(var a in e)Ye.call(e,a)&&t.indexOf(a)<0&&(n[a]=e[a]);if(e!=null&&Oe)for(var a of Oe(e))t.indexOf(a)<0&&Me.call(e,a)&&(n[a]=e[a]);return n};function qe(e){var t=e,{attributes:n,buttonData:a,children:s,goTo:i,layout:l,metadatas:c,moveItem:u,moveRow:d,onAddData:m,relationsLayout:g,removeField:f,selectedItemName:h,setEditFieldToSelect:b}=t,v=bt(t,["attributes","buttonData","children","goTo","layout","metadatas","moveItem","moveRow","onAddData","relationsLayout","removeField","selectedItemName","setEditFieldToSelect"]);return r.createElement(At.Provider,{value:oo({attributes:n,buttonData:a,goTo:i,layout:l,metadatas:c,moveItem:u,moveRow:d,onAddData:m,relationsLayout:g,removeField:f,selectedItemName:h,setEditFieldToSelect:b},v)},s)}qe.defaultProps={attributes:{},buttonData:[],goTo(){},layout:[],metadatas:{},moveItem(){},moveRow(){},onAddData(){},relationsLayout:[],removeField(){},selectedItemName:null,setEditFieldToSelect(){}},qe.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 Xe=qe,Re={COMPONENT:"component",EDIT_FIELD:"editField",EDIT_RELATION:"editRelation",FIELD:"field",RELATION:"relation"};var L=p(19615),D=p(9808),W=p(19192),x=p(95602),Te=p(20763),Sc=p(76470),Ne=p.n(Sc),Lc=p(64198),lt=p.n(Lc),xc=p(60672),ao=p.n(xc);const Fc=(0,L.default)(D.Box)`
|
|
7
|
+
border: 1px solid ${({theme:e})=>e.colors.neutral200};
|
|
8
|
+
`,kc=(0,L.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
|
+
`,Ac=L.default.button`
|
|
24
|
+
border: none;
|
|
25
|
+
background: transparent;
|
|
26
|
+
display: block;
|
|
27
|
+
width: 100%;
|
|
28
|
+
text-align: unset;
|
|
29
|
+
padding: 0;
|
|
30
|
+
`,so=({displayedValue:e})=>r.createElement(Fc,{paddingLeft:3,paddingRight:3,paddingTop:3,paddingBottom:3,hasRadius:!0,background:"neutral0",width:(0,y.pxToRem)(300)},r.createElement(W.Flex,{justifyContent:"space-between"},r.createElement(Ac,{type:"button"},r.createElement(W.Flex,null,r.createElement(kc,{background:"neutral200"},r.createElement(ao(),null)),r.createElement(D.Box,{paddingLeft:6,maxWidth:(0,y.pxToRem)(150)},r.createElement(x.Typography,{textColor:"neutral700",ellipsis:!0},e)))),r.createElement(D.Box,{paddingLeft:3},r.createElement(W.Flex,null,r.createElement(Te.IconButton,{icon:r.createElement(Ne(),null)}),r.createElement(D.Box,{paddingLeft:2},r.createElement(Te.IconButton,{icon:r.createElement(lt(),null)}))))));so.propTypes={displayedValue:o().string.isRequired};const jc=so;var ue=p(90662),$c=p(95717),ct=p.n($c),Bc=p(94009),Pn=p.n(Bc);const io=e=>e.length>20?`${e.substring(0,20)}...`:e,Rn=(0,L.default)(W.Flex)`
|
|
31
|
+
height: ${({theme:e})=>e.spaces[7]};
|
|
32
|
+
|
|
33
|
+
&:last-child {
|
|
34
|
+
padding: 0 ${({theme:e})=>e.spaces[3]};
|
|
35
|
+
}
|
|
36
|
+
`,lo=(0,L.default)(Rn)`
|
|
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
|
+
`,Nc=(0,L.default)(W.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
|
+
${x.Typography} {
|
|
63
|
+
color: ${({theme:e,isSibling:t})=>t?void 0:e.colors.primary600};
|
|
64
|
+
}
|
|
65
|
+
|
|
66
|
+
${lo} {
|
|
67
|
+
border-right: 1px solid
|
|
68
|
+
${({theme:e,isSibling:t})=>t?e.colors.neutral150:e.colors.primary200};
|
|
69
|
+
}
|
|
70
|
+
`,Tn=({labelField:e,transparent:t,isSibling:n})=>{const a=io(e);return r.createElement(Nc,{hasRadius:!0,justifyContent:"space-between",transparent:t,isSibling:n},r.createElement(ue.Stack,{horizontal:!0,spacing:3},r.createElement(lo,{alignItems:"center"},r.createElement(lt(),null)),r.createElement(x.Typography,{fontWeight:"bold"},a)),r.createElement(W.Flex,{paddingLeft:3},r.createElement(Rn,{alignItems:"center"},r.createElement(ct(),null)),r.createElement(Rn,{alignItems:"center"},r.createElement(Pn(),null))))};Tn.defaultProps={isSibling:!1,transparent:!1},Tn.propTypes={isSibling:o().bool,labelField:o().string.isRequired,transparent:o().bool};const Mn=Tn,Vc={position:"fixed",pointerEvents:"none",zIndex:100,left:0,top:0,width:"100%",height:"100%"};function qc(e,t,n){if(!e||!t)return{display:"none"};const{x:a,y:s}=n,i=`translate(${a}px, ${s}px)`;return{transform:i,WebkitTransform:i}}const zc=()=>{const{itemType:e,isDragging:t,item:n,initialOffset:a,currentOffset:s,mouseOffset:i}=(0,Le.useDragLayer)(l=>({item:l.getItem(),itemType:l.getItemType(),initialOffset:l.getInitialSourceClientOffset(),currentOffset:l.getSourceClientOffset(),isDragging:l.isDragging(),mouseOffset:l.getClientOffset()}));return t?r.createElement(Xe,null,r.createElement("div",{style:Vc},r.createElement("div",{style:qc(a,s,i),className:"col-md-2"},[Re.EDIT_RELATION,Re.EDIT_FIELD,Re.FIELD].includes(e)&&r.createElement(Mn,{labelField:n.labelField}),e===Re.COMPONENT&&r.createElement(jc,{displayedValue:n.displayedValue})))):null},co=(0,r.createContext)();var Wc=p(18522),X=p(92891);const uo=(0,r.createContext)(),xO=(0,r.createContext)(),FO=null;var he=p(4409);const po=e=>e["content-manager_editViewLayoutManager"].currentLayout;var Uc=Object.defineProperty,_c=Object.defineProperties,Hc=Object.getOwnPropertyDescriptors,mo=Object.getOwnPropertySymbols,Gc=Object.prototype.hasOwnProperty,Zc=Object.prototype.propertyIsEnumerable,fo=(e,t,n)=>t in e?Uc(e,t,{enumerable:!0,configurable:!0,writable:!0,value:n}):e[t]=n,Qc=(e,t)=>{for(var n in t||(t={}))Gc.call(t,n)&&fo(e,n,t[n]);if(mo)for(var n of mo(t))Zc.call(t,n)&&fo(e,n,t[n]);return e},Jc=(e,t)=>_c(e,Hc(t));const ut=()=>{const e=(0,he.useSelector)(po),t=(0,r.useCallback)(n=>(0,X.get)(e,["components",n],{}),[e]);return Jc(Qc({},e),{getComponentLayout:t})};var Kc=p(43653),ke=p.n(Kc),fe=p(17247),Yc=p(99381),ze=p.n(Yc);const $t=(e,t,n)=>{if(Array.isArray(e)&&t>=0&&n>=0&&t<=e.length-1&&n<=e.length-1){const a=ze()(e),s=a.splice(t,1);return a.splice(n,0,s[0]),a}return e},go=e=>{const t=e.type;return t==="relation"?!(0,X.toLower)(e.relationType).includes("morph"):!["json","dynamiczone","richtext","password"].includes(t)&&!!t},yo=(e,t)=>Object.keys(e).reduce((n,a)=>{const s=(0,X.get)(e,[a],{}),{default:i,component:l,type:c,required:u,min:d,repeatable:m}=s;if(c==="json"&&(n[a]=null),c==="json"&&u===!0&&(n[a]={}),i!==void 0&&(n[a]=i),c==="component"){const g=(0,X.get)(t,[l,"attributes"],{}),f=yo(g,t);if(u===!0&&(n[a]=m===!0?[]:f),d&&m===!0&&u){n[a]=[];for(let h=0;h<d;h+=1)n[a].push(f)}}return c==="dynamiczone"&&u===!0&&(n[a]=[]),n},{}),Bt=yo;var Xc=Object.defineProperty,eu=Object.defineProperties,tu=Object.getOwnPropertyDescriptors,Nt=Object.getOwnPropertySymbols,ho=Object.prototype.hasOwnProperty,bo=Object.prototype.propertyIsEnumerable,vo=(e,t,n)=>t in e?Xc(e,t,{enumerable:!0,configurable:!0,writable:!0,value:n}):e[t]=n,wn=(e,t)=>{for(var n in t||(t={}))ho.call(t,n)&&vo(e,n,t[n]);if(Nt)for(var n of Nt(t))bo.call(t,n)&&vo(e,n,t[n]);return e},In=(e,t)=>eu(e,tu(t)),nu=(e,t)=>{var n={};for(var a in e)ho.call(e,a)&&t.indexOf(a)<0&&(n[a]=e[a]);if(e!=null&&Nt)for(var a of Nt(e))t.indexOf(a)<0&&bo.call(e,a)&&(n[a]=e[a]);return n};const Vt=e=>{var t=e,{layouts:n,metadatas:a}=t,s=nu(t,["layouts","metadatas"]);const i=n.list.map(u=>u.name?u.name:u),l=Object.keys(a).reduce((u,d)=>{const m=(0,X.get)(a,[d],{});let g=m.edit;return g.mainField&&(g=In(wn({},g),{mainField:m.edit.mainField.name})),In(wn({},u),{[d]:{edit:g,list:(0,X.omit)(m.list,["mainField"])}})},{}),c=n.edit.map(u=>u.map(({name:d,size:m})=>({name:d,size:m})));return In(wn({},s),{layouts:{edit:c,list:i},metadatas:l})};var ru=Object.defineProperty,ou=Object.defineProperties,au=Object.getOwnPropertyDescriptors,Eo=Object.getOwnPropertySymbols,su=Object.prototype.hasOwnProperty,iu=Object.prototype.propertyIsEnumerable,Co=(e,t,n)=>t in e?ru(e,t,{enumerable:!0,configurable:!0,writable:!0,value:n}):e[t]=n,lu=(e,t)=>{for(var n in t||(t={}))su.call(t,n)&&Co(e,n,t[n]);if(Eo)for(var n of Eo(t))iu.call(t,n)&&Co(e,n,t[n]);return e},cu=(e,t)=>ou(e,au(t));const uu=(e,t)=>e.map(n=>cu(lu({},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,a)=>(n[a]=uu(t[a],e),n),{})},Po=e=>e.split(".").filter(t=>(0,X.isNaN)(parseInt(t,10))),Ro=e=>e.length===0?-1:Math.max.apply(Math,e.map(t=>t.__temp_key__)),ye=e=>`/content-manager/${e}`;var du=Object.defineProperty,To=Object.getOwnPropertySymbols,pu=Object.prototype.hasOwnProperty,mu=Object.prototype.propertyIsEnumerable,Mo=(e,t,n)=>t in e?du(e,t,{enumerable:!0,configurable:!0,writable:!0,value:n}):e[t]=n,qt=(e,t)=>{for(var n in t||(t={}))pu.call(t,n)&&Mo(e,n,t[n]);if(To)for(var n of To(t))mu.call(t,n)&&Mo(e,n,t[n]);return e};const wo=(e,t,n)=>{const a=c=>t.find(u=>u.uid===c),s=Object.assign({},e),i=e[n].uid,l=a(i);return(0,X.set)(s,[n],qt(qt({},e[n]),l)),Object.keys(e.components).forEach(c=>{const u=a(c);(0,X.set)(s,["components",c],qt(qt({},e.components[c]),u))}),s};var fu=Object.defineProperty,gu=Object.defineProperties,yu=Object.getOwnPropertyDescriptors,Io=Object.getOwnPropertySymbols,hu=Object.prototype.hasOwnProperty,bu=Object.prototype.propertyIsEnumerable,Do=(e,t,n)=>t in e?fu(e,t,{enumerable:!0,configurable:!0,writable:!0,value:n}):e[t]=n,So=(e,t)=>{for(var n in t||(t={}))hu.call(t,n)&&Do(e,n,t[n]);if(Io)for(var n of Io(t))bu.call(t,n)&&Do(e,n,t[n]);return e},Lo=(e,t)=>gu(e,yu(t));const vt=(e,t)=>e&&Object.keys(e).reduce((n,a)=>{const s=n[a];return s===null?n:Array.isArray(s)?Array.isArray(n)?(n[a]=vt(s,t),n):Lo(So({},n),{[a]:s.map(i=>vt(i,t))}):typeof s=="object"?Array.isArray(n)?(n[a]=vt(s,t),n):Lo(So({},n),{[a]:vt(s,t)}):(a===t&&delete n[a],n)},e),vu=vt,xo=(e,t,n)=>{const a=(s,i)=>Object.keys(s).reduce((l,c)=>{const u=(0,y.getType)(i,c),d=(0,X.get)(s,c),m=(0,y.getOtherInfos)(i,[c,"component"]),g=(0,y.getOtherInfos)(i,[c,"repeatable"]);return u==="dynamiczone"?(l[c]=d.map(f=>a(f,n[f.__component])),l):u==="component"?(g?l[c]=d&&d.map(f=>a(f,n[m])):l[c]=d&&a(d,n[m]),l):(u!=="password"&&(l[c]=d),l)},{});return a(e,t)};var Eu=Object.defineProperty,Cu=Object.defineProperties,Ou=Object.getOwnPropertyDescriptors,Fo=Object.getOwnPropertySymbols,Pu=Object.prototype.hasOwnProperty,Ru=Object.prototype.propertyIsEnumerable,ko=(e,t,n)=>t in e?Eu(e,t,{enumerable:!0,configurable:!0,writable:!0,value:n}):e[t]=n,Et=(e,t)=>{for(var n in t||(t={}))Pu.call(t,n)&&ko(e,n,t[n]);if(Fo)for(var n of Fo(t))Ru.call(t,n)&&ko(e,n,t[n]);return e},Ct=(e,t)=>Cu(e,Ou(t));const Ao=(e,t)=>t.find(n=>n.uid===e),Tu=(e,t)=>{const n=Mu(e,t),a=jo(n.contentType,null,t),s=n.contentType.uid,i=wu(n.contentType,n.components);return(0,X.set)(n,["contentType","layouts","edit"],a),(0,X.set)(n,["contentType","layouts","list"],i),Object.keys(n.components).forEach(l=>{const c=jo(n.components[l],s,t);(0,X.set)(n,["components",l,"layouts","edit"],c)}),n},Mu=(e,t)=>{const n=wo((0,X.cloneDeep)(e),t,"contentType"),{components:a,contentType:s}=n,i=l=>Object.keys(l.metadatas).reduce((c,u)=>{const d=(0,X.get)(l,["attributes",u],{});let m=l.metadatas[u];if(d.type==="relation"){const g=Ao(d.targetModel,t),f=m.edit.mainField,h={name:f,schema:(0,X.get)(g,["attributes",f])};m={list:Ct(Et({},m.list),{mainField:h}),edit:Ct(Et({},m.edit),{mainField:h})}}return c[u]=m,c},{});return(0,X.set)(n,["contentType","metadatas"],i(s)),Object.keys(a).forEach(l=>{const c=a[l],u=i(c);(0,X.set)(n,["components",l,"metadatas"],u)}),n},jo=(e,t,n)=>e.layouts.edit.reduce((s,i)=>{const l=i.map(c=>{const u=(0,X.get)(e,["attributes",c.name],{}),d=Ct(Et({},c),{fieldSchema:u,metadatas:(0,X.get)(e,["metadatas",c.name,"edit"],{})});if(u.type==="relation"){const m=u.targetModel,f=Ao(m,n).pluginOptions||{},h=t?Du(e,c.name,n):Iu(e,c.name,n);(0,X.set)(d,"targetModelPluginOptions",f),(0,X.set)(d,"queryInfos",h)}return d});return s.push(l),s},[]),wu=(e,t)=>e.layouts.list.reduce((a,s)=>{const i=(0,X.get)(e,["attributes",s],{}),l=(0,X.get)(e,["metadatas",s,"list"],{}),c=i.type;if(c==="relation"){const u={defaultParams:{}};return a.push({key:`__${s}_key__`,name:s,fieldSchema:i,metadatas:l,queryInfos:u}),a}if(c==="component"){const u=t[i.component],d=u.settings.mainField,m=u.attributes[d];return a.push({key:`__${s}_key__`,name:s,fieldSchema:i,metadatas:Ct(Et({},l),{mainField:Ct(Et({},m),{name:d})})}),a}return a.push({key:`__${s}_key__`,name:s,fieldSchema:i,metadatas:l}),a},[]),Iu=(e,t,n)=>{const a=(0,X.get)(e,["attributes",t,"targetModel"],""),s=$o(n).includes(a);return{defaultParams:{},shouldDisplayRelationLink:s}},Du=(e,t,n)=>{const a=(0,X.get)(e,["attributes",t,"targetModel"],""),s=$o(n).includes(a);return{defaultParams:{component:e.uid},shouldDisplayRelationLink:s}},$o=e=>e.filter(t=>t.isDisplayed).map(({uid:t})=>t),Bo=Tu;var zt=p(49415),Su=Object.defineProperty,Lu=Object.defineProperties,xu=Object.getOwnPropertyDescriptors,No=Object.getOwnPropertySymbols,Fu=Object.prototype.hasOwnProperty,ku=Object.prototype.propertyIsEnumerable,Vo=(e,t,n)=>t in e?Su(e,t,{enumerable:!0,configurable:!0,writable:!0,value:n}):e[t]=n,Wt=(e,t)=>{for(var n in t||(t={}))Fu.call(t,n)&&Vo(e,n,t[n]);if(No)for(var n of No(t))ku.call(t,n)&&Vo(e,n,t[n]);return e},qo=(e,t)=>Lu(e,xu(t));const Au={error:null,isLoading:!0,layout:{},layouts:{}},ju=(e,t)=>(0,zt.default)(e,n=>{switch(t.type){case"GET_DATA":{n.isLoading=!0,n.error=null,n.layout={};break}case"GET_DATA_SUCCEEDED":{const a=t.data.contentType.uid;n.layout=t.data,n.layouts[a]=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 a=e.layout;n.layout=qo(Wt({},a),{contentType:Wt({uid:a.contentType.uid},t.newLayout.contentType)}),n.layouts[a.contentType.uid]=qo(Wt({},a),{contentType:Wt({uid:a.contentType.uid},t.newLayout.contentType)});break}default:return n}});var Dn=p(12463),$u=p(34947);const Ot=()=>e=>e["content-manager_app"]||$u.E,HO=()=>createSelector(Ot(),e=>e),GO=()=>createSelector(Ot(),e=>e.models),Bu=()=>(0,Dn.P1)(Ot(),e=>({collectionTypeLinks:e.collectionTypeLinks,singleTypeLinks:e.singleTypeLinks})),Sn=()=>(0,Dn.P1)(Ot(),({components:e,models:t})=>({schemas:[...e,...t]})),ZO=null;var Nu=p(98399),Vu=(e,t,n)=>new Promise((a,s)=>{var i=u=>{try{c(n.next(u))}catch(d){s(d)}},l=u=>{try{c(n.throw(u))}catch(d){s(d)}},c=u=>u.done?a(u.value):Promise.resolve(u.value).then(i,l);c((n=n.apply(e,t)).next())});const zo=e=>{const[{error:t,isLoading:n,layout:a,layouts:s},i]=(0,r.useReducer)(ju,Au),l=(0,r.useMemo)(Sn,[]),{schemas:c}=(0,he.useSelector)(g=>l(g),he.shallowEqual),u=(0,r.useRef)(!0),d=(0,r.useCallback)((g,f)=>Vu(void 0,null,function*(){if(s[g]){i({type:"SET_LAYOUT_FROM_STATE",uid:g});return}i({type:"GET_DATA"});try{const h=ye(`content-types/${g}/configuration`),{data:{data:b}}=yield fe.be.get(h,{cancelToken:f.token});i({type:"GET_DATA_SUCCEEDED",data:Bo(b,c)})}catch(h){if(ke().isCancel(h))return;u.current&&Nu.error(h),u.current&&i({type:"GET_DATA_ERROR",error:h})}}),[s,c]);(0,r.useEffect)(()=>()=>{u.current=!1},[]),(0,r.useEffect)(()=>{const f=ke().CancelToken.source();return d(e,f),()=>{f.cancel("Operation canceled by the user.")}},[e,d]);const m=(0,r.useCallback)(g=>{i({type:"UPDATE_LAYOUT",newLayout:Bo(g,c)})},[c]);return{error:t,isLoading:n,layout:a,updateLayout:m}},qu=e=>e["content-manager_app"].collectionTypeLinks;var We=p(77997),zu=p(33795),w=p.n(zu),Wu=p(85973),Wo=p.n(Wu),Uu=Object.defineProperty,_u=Object.defineProperties,Hu=Object.getOwnPropertyDescriptors,Uo=Object.getOwnPropertySymbols,Gu=Object.prototype.hasOwnProperty,Zu=Object.prototype.propertyIsEnumerable,_o=(e,t,n)=>t in e?Uu(e,t,{enumerable:!0,configurable:!0,writable:!0,value:n}):e[t]=n,Qu=(e,t)=>{for(var n in t||(t={}))Gu.call(t,n)&&_o(e,n,t[n]);if(Uo)for(var n of Uo(t))Zu.call(t,n)&&_o(e,n,t[n]);return e},Ju=(e,t)=>_u(e,Hu(t));const Ho=(e,t)=>Object.keys(e).reduce((n,a)=>{const s=e[a],i=w()(t,[a],s);return Wo()(s)?Ju(Qu({},n),{[a]:Ho(s,i)}):(n[a]=i,n)},{}),Ku=(e,t,n)=>{const a=e.find(({to:m})=>m.includes(t));if(!a)return"/";const{to:s,search:i}=a,l=(0,We.parse)(i),c=(0,We.parse)(n.substring(1)),u=Ho(l,c);return`${s}?${(0,We.stringify)(u,{encode:!1})}`},Go=e=>{const[{rawQuery:t}]=(0,y.useQueryParams)(),n=(0,he.useSelector)(qu);return Ku(n,e,t)},et=()=>(0,r.useContext)(At),Zo=()=>{const{search:e}=(0,oe.useLocation)(),t=e?(0,We.parse)(e.substring(1)):{};return t.plugins?(0,We.stringify)({plugins:t.plugins},{encode:!1}):""};var Qo=p(89334);const Yu=(e,t,n)=>({type:Qo.m,permissions:e,__meta__:{plugins:t,containerName:n}}),Xu=()=>({type:Qo.Q}),ed=e=>e["content-manager_rbacManager"].permissions,td=e=>e.rbacProvider.collectionTypesRelatedPermissions,Jo=(e,t,n="listView")=>{const a=(0,he.useSelector)(td),s=(0,he.useSelector)(ed),i=(0,he.useDispatch)(),l=a[t];return(0,r.useEffect)(()=>l?(i(Yu(l,e?e.plugins:null,n)),()=>{i(Xu())}):()=>{},[l,i,e,n]),s},nP=()=>useContext(WysiwygContext),rP=null;var Ut=p(70836),Ko=p(4460);const nd=()=>({type:Ko.c}),rd=(e,t)=>({type:Ko.O,layout:e,query:t});var od=p(8266),Ue=p.n(od),de=p(78330),ad=p(70404),sd=p.n(ad),id=p(66694);const ld=()=>(0,r.useContext)(id.ux),Yo=e=>{const{getAdminInjectedComponents:t}=ld(),[n,a,s]=e.split(".");return t(n,a,s)};var cd=Object.defineProperty,_t=Object.getOwnPropertySymbols,Xo=Object.prototype.hasOwnProperty,ea=Object.prototype.propertyIsEnumerable,ta=(e,t,n)=>t in e?cd(e,t,{enumerable:!0,configurable:!0,writable:!0,value:n}):e[t]=n,ud=(e,t)=>{for(var n in t||(t={}))Xo.call(t,n)&&ta(e,n,t[n]);if(_t)for(var n of _t(t))ea.call(t,n)&&ta(e,n,t[n]);return e},dd=(e,t)=>{var n={};for(var a in e)Xo.call(e,a)&&t.indexOf(a)<0&&(n[a]=e[a]);if(e!=null&&_t)for(var a of _t(e))t.indexOf(a)<0&&ea.call(e,a)&&(n[a]=e[a]);return n};const na=e=>{var t=e,{area:n}=t,a=dd(t,["area"]);return Yo(n).map(i=>r.createElement(i.Component,ud({key:i.name},a)))};na.propTypes={area:o().string.isRequired};const Ht=na;var pd=Object.defineProperty,ra=Object.getOwnPropertySymbols,md=Object.prototype.hasOwnProperty,fd=Object.prototype.propertyIsEnumerable,oa=(e,t,n)=>t in e?pd(e,t,{enumerable:!0,configurable:!0,writable:!0,value:n}):e[t]=n,aa=(e,t)=>{for(var n in t||(t={}))md.call(t,n)&&oa(e,n,t[n]);if(ra)for(var n of ra(t))fd.call(t,n)&&oa(e,n,t[n]);return e};function gd(e,t){return n=>{const a=t(n.name);return r.createElement(e,aa(aa({},n),a))}}const yd=gd;function hd(e){const{addComponentToDynamicZone:t,createActionAllowedFields:n,isCreatingEntry:a,formErrors:s,modifiedData:i,moveComponentUp:l,moveComponentDown:c,removeComponentFromDynamicZone:u,readActionAllowedFields:d,updateActionAllowedFields:m}=(0,y.useCMEditViewDataManager)(),g=(0,r.useMemo)(()=>(0,X.get)(i,[e],[]).map(b=>b.__component),[i,e]),f=(0,r.useMemo)(()=>(a?n:m).includes(e),[e,a,n,m]),h=(0,r.useMemo)(()=>(a?[]:d).includes(e),[e,a,d]);return{addComponentToDynamicZone:t,formErrors:s,isCreatingEntry:a,isFieldAllowed:f,isFieldReadable:h,moveComponentUp:l,moveComponentDown:c,removeComponentFromDynamicZone:u,dynamicDisplayedComponents:g}}const bd=hd;var vd=p(51542),sa=p.n(vd),Ln=p(98195);const xn=(0,L.default)(sa())`
|
|
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
|
+
`,Ed=(0,L.default)(Ln.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
|
+
${x.Typography} {
|
|
99
|
+
color: ${({theme:e})=>e.colors.primary600} !important;
|
|
100
|
+
}
|
|
101
|
+
|
|
102
|
+
${xn} {
|
|
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
|
+
${x.Typography} {
|
|
113
|
+
color: ${({theme:e})=>e.colors.primary600};
|
|
114
|
+
}
|
|
115
|
+
${xn} {
|
|
116
|
+
> circle {
|
|
117
|
+
fill: ${({theme:e})=>e.colors.primary600};
|
|
118
|
+
}
|
|
119
|
+
> path {
|
|
120
|
+
fill: ${({theme:e})=>e.colors.neutral100};
|
|
121
|
+
}
|
|
122
|
+
}
|
|
123
|
+
}
|
|
124
|
+
`,Cd=(0,L.default)(D.Box)`
|
|
125
|
+
height: 100%;
|
|
126
|
+
`,Fn=({hasError:e,hasMaxError:t,hasMinError:n,isDisabled:a,isOpen:s,label:i,missingComponentNumber:l,name:c,onClick:u})=>{const{formatMessage:d}=(0,N.useIntl)(),m=d({id:E("components.DynamicZone.add-component"),defaultMessage:"Add a component to {componentName}"},{componentName:i||c}),g=d({id:"app.utils.close-label",defaultMessage:"Close"});let f=s?g:m;return t&&!s&&(f=d({id:"components.Input.error.validation.max",defaultMessage:"The value is too high."})),n&&!s&&(f=d({id:E("components.DynamicZone.missing-components"),defaultMessage:"There {number, plural, =0 {are # missing components} one {is # missing component} other {are # missing components}}"},{number:l})),r.createElement(W.Flex,{justifyContent:"center"},r.createElement(D.Box,{style:{cursor:a?"not-allowed":"pointer"}},r.createElement(Ed,{type:"button",onClick:u,disabled:a,hasError:e},r.createElement(W.Flex,null,r.createElement(Cd,{"aria-hidden":!0,paddingRight:2},r.createElement(xn,{$isOpen:s,$hasError:e&&!s})),r.createElement(x.Typography,{variant:"pi",fontWeight:"bold",textColor:e&&!s?"danger600":"neutral500"},f)))))};Fn.defaultProps={label:"",missingComponentNumber:0},Fn.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 Od=Fn,Pd=(0,L.default)(D.Box)`
|
|
127
|
+
border-radius: ${(0,y.pxToRem)(26)};
|
|
128
|
+
`,kn=({label:e,labelAction:t,name:n,numberOfComponents:a,required:s,intlDescription:i})=>{const{formatMessage:l}=(0,N.useIntl)(),c=l({id:e||n,defaultMessage:e||n});return r.createElement(W.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(W.Flex,{direction:"column",justifyContent:"center"},r.createElement(W.Flex,{maxWidth:(0,y.pxToRem)(356)},r.createElement(x.Typography,{variant:"pi",textColor:"neutral600",fontWeight:"bold",ellipsis:!0},c,"\xA0"),r.createElement(x.Typography,{variant:"pi",textColor:"neutral600",fontWeight:"bold"},"(",a,")"),s&&r.createElement(x.Typography,{textColor:"danger600"},"*"),t&&r.createElement(D.Box,{paddingLeft:1},t)),i&&r.createElement(D.Box,{paddingTop:1,maxWidth:(0,y.pxToRem)(356)},r.createElement(x.Typography,{variant:"pi",textColor:"neutral600",ellipsis:!0},l(i)))))))};kn.defaultProps={intlDescription:void 0,label:"",labelAction:void 0,required:!1},kn.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 Rd=kn;var An=p(16925),_e=p(12001),jn=p(54742),ia=p(82910),Td=p(78325),Md=p.n(Td),wd=p(30857),Id=p.n(wd),Dd=p(61868),Sd=p.n(Dd),Ld=Object.defineProperty,la=Object.getOwnPropertySymbols,xd=Object.prototype.hasOwnProperty,Fd=Object.prototype.propertyIsEnumerable,ca=(e,t,n)=>t in e?Ld(e,t,{enumerable:!0,configurable:!0,writable:!0,value:n}):e[t]=n,kd=(e,t)=>{for(var n in t||(t={}))xd.call(t,n)&&ca(e,n,t[n]);if(la)for(var n of la(t))Fd.call(t,n)&&ca(e,n,t[n]);return e};const Ad=L.default.span`
|
|
129
|
+
> svg {
|
|
130
|
+
width: ${(0,y.pxToRem)(24)};
|
|
131
|
+
height: ${(0,y.pxToRem)(24)};
|
|
132
|
+
> circle {
|
|
133
|
+
fill: ${({theme:e})=>e.colors.primary200};
|
|
134
|
+
}
|
|
135
|
+
> path {
|
|
136
|
+
fill: ${({theme:e})=>e.colors.primary600};
|
|
137
|
+
}
|
|
138
|
+
}
|
|
139
|
+
`,$n=({error:e,isReadOnly:t,onClick:n})=>{const{formatMessage:a}=(0,N.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(ue.Stack,{spacing:2},r.createElement(W.Flex,{justifyContent:"center",style:{cursor:t?"not-allowed":"inherit"}},r.createElement(Ad,null,r.createElement(sa(),null))),r.createElement(W.Flex,{justifyContent:"center"},r.createElement(x.Typography,{textColor:"primary600",variant:"pi",fontWeight:"bold"},a({id:E("components.empty-repeatable"),defaultMessage:"No entry yet. Click on the button below to add one."}))))),(e==null?void 0:e.id)&&r.createElement(x.Typography,{textColor:"danger600",variant:"pi"},a({id:e.id,defaultMessage:e.id},kd({},e.values))))};$n.defaultProps={error:void 0,isReadOnly:!1},$n.propTypes={error:o().shape({id:o().string.isRequired,defaultMessage:o().string.isRequired,values:o().object}),isReadOnly:o().bool,onClick:o().func.isRequired};const ua=$n;var jd=p(9086),$d=p.n(jd),Bd=p(88708),Bn=p.n(Bd),Nd=p(27509),Gt=p.n(Nd),sP=p(40795),Vd=p(88591),qd=p.n(Vd),Nn=p(59845),zd=p(20871),Wd=p.n(zd),Ud=p(48375),da=p.n(Ud),_d=p(31089),Hd=p.n(_d),Gd=p(16043),Zd=p.n(Gd),Qd=p(5109),Jd=p.n(Qd),Kd=p(47955),Yd=p.n(Kd),Xd=p(95706),ep=p.n(Xd),tp=p(6658),np=p.n(tp),rp=p(36407),op=p.n(rp),ap=(e,t,n)=>new Promise((a,s)=>{var i=u=>{try{c(n.next(u))}catch(d){s(d)}},l=u=>{try{c(n.throw(u))}catch(d){s(d)}},c=u=>u.done?a(u.value):Promise.resolve(u.value).then(i,l);c((n=n.apply(e,t)).next())});(()=>ap(void 0,null,function*(){yield p.e(7347).then(p.bind(p,98362))}))();const dt=new(qd())({html:!0,xhtmlOut:!1,breaks:!0,langPrefix:"language-",linkify:!0,typographer:!0,highlight(e,t){if(t&&t!=="auto"&&(0,Nn.getLanguage)(t))return'<pre class="hljs language-'+dt.utils.escapeHtml(t.toLowerCase())+'"><code>'+(0,Nn.highlight)(t,e,!0).value+"</code></pre>";if(t==="auto"){const n=(0,Nn.highlightAuto)(e);return'<pre class="hljs language-'+dt.utils.escapeHtml(n.language)+'"><code>'+n.value+"</code></pre>"}return'<pre class="hljs"><code>'+dt.utils.escapeHtml(e)+"</code></pre>"}}).use(Wd()).use(da(),"warning").use(da(),"tip").use(Hd()).use(Zd()).use(Jd()).use(Yd()).use(ep()).use(np()).use(op());dt.renderer.rules.footnote_ref=(e,t,n,a,s)=>{const i=s.rules.footnote_caption(e,t,n,a,s);return'<sup class="footnote-ref"><span>'+i+"</span></sup>"},dt.renderer.rules.footnote_anchor=()=>' <span class="footnote-backref">\u21A9\uFE0E</span>';const sp=dt;var ip=p(13993),pa=p.n(ip),lp=Object.defineProperty,cp=Object.defineProperties,up=Object.getOwnPropertyDescriptors,ma=Object.getOwnPropertySymbols,dp=Object.prototype.hasOwnProperty,pp=Object.prototype.propertyIsEnumerable,fa=(e,t,n)=>t in e?lp(e,t,{enumerable:!0,configurable:!0,writable:!0,value:n}):e[t]=n,mp=(e,t)=>{for(var n in t||(t={}))dp.call(t,n)&&fa(e,n,t[n]);if(ma)for(var n of ma(t))pp.call(t,n)&&fa(e,n,t[n]);return e},fp=(e,t)=>cp(e,up(t));const gp=fp(mp({},pa().defaults),{allowedTags:!1,allowedAttributes:{"*":["href","align","alt","center","width","height","type","controls","target"],img:["src","alt"],source:["src","type"]}}),yp=e=>pa()(e,gp),hp=L.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
|
+
`,Vn=({data:e})=>{const t=(0,r.useMemo)(()=>yp(sp.render(e||"")),[e]);return r.createElement(hp,null,r.createElement("div",{dangerouslySetInnerHTML:{__html:t}}))};Vn.defaultProps={data:""},Vn.propTypes={data:o().string};const ga=(0,r.memo)(Vn),bp=L.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
|
+
`,Fe=(0,L.default)(Te.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
|
+
`,vp=(0,L.default)(Fe)`
|
|
635
|
+
svg {
|
|
636
|
+
width: ${8/16}rem;
|
|
637
|
+
height: ${8/16}rem;
|
|
638
|
+
}
|
|
639
|
+
`,ya=(0,L.default)(Te.IconButtonGroup)`
|
|
640
|
+
margin-left: ${({theme:e})=>e.spaces[4]};
|
|
641
|
+
`,ha=(0,L.default)(Te.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
|
+
`,Ep=(0,L.default)(Te.IconButtonGroup)`
|
|
650
|
+
margin-right: ${({theme:e})=>`${e.spaces[2]}`};
|
|
651
|
+
`,Cp=L.default.div`
|
|
652
|
+
position: relative;
|
|
653
|
+
height: calc(100% - 48px);
|
|
654
|
+
`,Op=(0,L.default)(Ln.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 Zt=/^(\s*)(>[> ]*|[*+-] \[[x ]\]\s|[*+-]\s|(\d+)([.)]))(\s*)/,Pp=/^(\s*)(>[> ]*|[*+-] \[[x ]\]|[*+-]|(\d+)[.)])(\s*)$/,Rp=/[*+-]\s/;function Tp(e){if(e.getOption("disableInput"))return Gt().Pass;for(var t=e.listSelections(),n=[],a=0;a<t.length;a++){var s=t[a].head,i=e.getStateAfter(s.line),l=i.list!==!1,c=i.quote!==0,u=e.getLine(s.line),d=Zt.exec(u),m=/^\s*$/.test(u.slice(0,s.ch));if(!t[a].empty()||!l&&!c||!d||m){e.execCommand("newlineAndIndent");return}if(Pp.test(u)){var g=c&&/>\s*$/.test(u),f=!/>\s*$/.test(u);(g||f)&&e.replaceRange("",{line:s.line,ch:0},{line:s.line,ch:s.ch+1}),n[a]=`
|
|
668
|
+
`}else{var h=d[1],b=d[5],v=!(Rp.test(d[2])||d[2].indexOf(">")>=0),S=v?parseInt(d[3],10)+1+d[4]:d[2].replace("x"," ");n[a]=`
|
|
669
|
+
`+h+S+b,v&&Mp(e,s)}}e.replaceSelections(n)}function Mp(e,t){var n=t.line,a=0,s=0,i=Zt.exec(e.getLine(n)),l=i[1];do{a+=1;var c=n+a,u=e.getLine(c),d=Zt.exec(u);if(d){var m=d[1],g=parseInt(i[3],10)+a-s,f=parseInt(d[3],10),h=f;if(l===m&&!isNaN(f))g===f&&(h=f+1),g>f&&(h=g+1),e.replaceRange(u.replace(Zt,m+h+d[4]+d[5]),{line:c,ch:0},{line:c,ch:u.length});else{if(l.length>m.length||l.length<m.length&&a===1)return;s+=1}}}while(d)}const wp=Tp,qn=({disabled:e,editorRef:t,error:n,isPreviewMode:a,isExpandMode:s,name:i,onChange:l,placeholder:c,textareaRef:u,value:d})=>{const m=(0,r.useRef)(l);return(0,r.useEffect)(()=>{t.current=Gt().fromTextArea(u.current,{lineWrapping:!0,extraKeys:{Enter:"newlineAndIndentContinueMarkdownList",Tab:!1,"Shift-Tab":!1},readOnly:!1,smartIndent:!1,placeholder:c,spellcheck:!0,inputStyle:"contenteditable"}),Gt().commands.newlineAndIndentContinueMarkdownList=wp,t.current.on("change",g=>{m.current({target:{name:i,value:g.getValue(),type:"wysiwyg"}})})},[t,u,i,c]),(0,r.useEffect)(()=>{d&&!t.current.state.focused&&t.current.setValue(d)},[t,d]),(0,r.useEffect)(()=>{a||e?t.current.setOption("readOnly","nocursor"):t.current.setOption("readOnly",!1)},[e,a,t]),(0,r.useEffect)(()=>{n?t.current.setOption("screenReaderLabel",n):t.current.setOption("screenReaderLabel","Editor")},[t,n]),r.createElement(Cp,null,r.createElement(bp,{isExpandMode:s,disabled:e||a},r.createElement("textarea",{ref:u})),a&&r.createElement(ga,{data:d}))};qn.defaultProps={disabled:!1,error:void 0,isPreviewMode:!1,isExpandMode:!1,placeholder:"",value:""},qn.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 Ip=qn;var be=p(44526),pe=p(25716),Dp=p(37853),Sp=p(19882),ba=p.n(Sp),Lp=p(61980),va=p.n(Lp),xp=p(70052),Ea=p.n(xp),Fp=p(15053),kp=p.n(Fp),Ap=p(18767),jp=p.n(Ap),$p=p(83358),Bp=p.n($p),Np=p(69822),Vp=p.n(Np),qp=p(88467),zp=p.n(qp),Wp=p(83262),Up=p.n(Wp),_p=p(49157),Hp=p.n(_p),Gp=p(75400),Ca=p.n(Gp);const zn=({disabled:e,editorRef:t,isExpandMode:n,isPreviewMode:a,onActionClick:s,onToggleMediaLib:i,onTogglePreviewMode:l})=>{const[c,u]=(0,r.useState)(!1),{formatMessage:d}=(0,N.useIntl)(),m=d({id:"components.Wysiwyg.selectOptions.title",defaultMessage:"Add a title"}),g=(0,r.useRef)(),f=()=>{u(h=>!h)};return e||a?r.createElement(D.Box,{padding:2,background:"neutral100"},r.createElement(W.Flex,{justifyContent:"space-between"},r.createElement(W.Flex,null,r.createElement(pe.Select,{disabled:!0,id:"selectTitle",placeholder:m,size:"S","aria-label":m},r.createElement(pe.Option,{value:"h1"},"h1"),r.createElement(pe.Option,{value:"h2"},"h2"),r.createElement(pe.Option,{value:"h3"},"h3"),r.createElement(pe.Option,{value:"h4"},"h4"),r.createElement(pe.Option,{value:"h5"},"h5"),r.createElement(pe.Option,{value:"h6"},"h6")),r.createElement(ya,null,r.createElement(Fe,{disabled:!0,id:"Bold",label:"Bold",name:"Bold",icon:r.createElement(ba(),null)}),r.createElement(Fe,{disabled:!0,id:"Italic",label:"Italic",name:"Italic",icon:r.createElement(va(),null)}),r.createElement(Fe,{disabled:!0,id:"Underline",label:"Underline",name:"Underline",icon:r.createElement(Ea(),null)})),r.createElement(ha,{disabled:!0,id:"more",label:"More",icon:r.createElement(Ca(),null)})),!n&&r.createElement(be.Button,{onClick:l,variant:"tertiary",id:"preview"},d({id:"components.Wysiwyg.ToggleMode.markdown-mode",defaultMessage:"Markdown mode"})))):r.createElement(D.Box,{padding:2,background:"neutral100"},r.createElement(W.Flex,{justifyContent:"space-between"},r.createElement(W.Flex,null,r.createElement(pe.Select,{id:"selectTitle",placeholder:m,size:"S",onChange:h=>s(h,t)},r.createElement(pe.Option,{value:"h1"},"h1"),r.createElement(pe.Option,{value:"h2"},"h2"),r.createElement(pe.Option,{value:"h3"},"h3"),r.createElement(pe.Option,{value:"h4"},"h4"),r.createElement(pe.Option,{value:"h5"},"h5"),r.createElement(pe.Option,{value:"h6"},"h6")),r.createElement(ya,null,r.createElement(Fe,{onClick:()=>s("Bold",t),id:"Bold",label:"Bold",name:"Bold",icon:r.createElement(ba(),null)}),r.createElement(Fe,{onClick:()=>s("Italic",t),id:"Italic",label:"Italic",name:"Italic",icon:r.createElement(va(),null)}),r.createElement(Fe,{onClick:()=>s("Underline",t),id:"Underline",label:"Underline",name:"Underline",icon:r.createElement(Ea(),null)})),r.createElement(ha,{ref:g,onClick:f,id:"more",label:"More",icon:r.createElement(Ca(),null)}),c&&r.createElement(Dp.Popover,{centered:!0,source:g,spacing:4,id:"popover"},r.createElement(jn.FocusTrap,{onEscape:f,restoreFocus:!1},r.createElement(W.Flex,null,r.createElement(Ep,null,r.createElement(Fe,{onClick:()=>s("Strikethrough",t,f),id:"Strikethrough",label:"Strikethrough",name:"Strikethrough",icon:r.createElement(kp(),null)}),r.createElement(Fe,{onClick:()=>s("BulletList",t,f),id:"BulletList",label:"BulletList",name:"BulletList",icon:r.createElement(jp(),null)}),r.createElement(Fe,{onClick:()=>s("NumberList",t,f),id:"NumberList",label:"NumberList",name:"NumberList",icon:r.createElement(Bp(),null)})),r.createElement(Te.IconButtonGroup,null,r.createElement(Fe,{onClick:()=>s("Code",t,f),id:"Code",label:"Code",name:"Code",icon:r.createElement(Vp(),null)}),r.createElement(Fe,{onClick:()=>{f(),i()},id:"Image",label:"Image",name:"Image",icon:r.createElement(zp(),null)}),r.createElement(vp,{onClick:()=>s("Link",t,f),id:"Link",label:"Link",name:"Link",icon:r.createElement(Up(),null)}),r.createElement(Fe,{onClick:()=>s("Quote",t,f),id:"Quote",label:"Quote",name:"Quote",icon:r.createElement(Hp(),null)})))))),l&&r.createElement(be.Button,{onClick:l,variant:"tertiary",id:"preview"},d({id:"components.Wysiwyg.ToggleMode.preview-mode",defaultMessage:"Preview mode"}))))};zn.defaultProps={isPreviewMode:!1,onActionClick(){},onToggleMediaLib(){},onTogglePreviewMode:void 0},zn.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 Zp=zn;var Qp=p(39766),Jp=p.n(Qp);const Wn=({onToggleExpand:e})=>{const{formatMessage:t}=(0,N.useIntl)();return r.createElement(D.Box,{padding:2,background:"neutral100",hasRadius:!0},r.createElement(W.Flex,{justifyContent:"flex-end",alignItems:"flex-end"},r.createElement(Op,{id:"expand",onClick:e},r.createElement(x.Typography,null,t({id:"components.WysiwygBottomControls.fullscreen",defaultMessage:"Expand"})),r.createElement(Jp(),null))))};Wn.defaultProps={onToggleExpand(){}},Wn.propTypes={onToggleExpand:o().func};const Kp=Wn;var Yp=Object.defineProperty,Oa=Object.getOwnPropertySymbols,Xp=Object.prototype.hasOwnProperty,em=Object.prototype.propertyIsEnumerable,Pa=(e,t,n)=>t in e?Yp(e,t,{enumerable:!0,configurable:!0,writable:!0,value:n}):e[t]=n,tm=(e,t)=>{for(var n in t||(t={}))Xp.call(t,n)&&Pa(e,n,t[n]);if(Oa)for(var n of Oa(t))em.call(t,n)&&Pa(e,n,t[n]);return e};const Un=({id:e,error:t,name:n,description:a})=>{const{formatMessage:s}=(0,N.useIntl)(),i=a?s({id:a.id,defaultMessage:a.defaultMessage},tm({},a.values)):"";return!i||t?null:r.createElement(x.Typography,{as:"p",variant:"pi",id:`${e||n}-hint`,textColor:"neutral600"},i)};Un.defaultProps={id:void 0,description:void 0,error:void 0},Un.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 nm=Un,Ra=(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},Ta=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}},Ma=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},wa=(e,t)=>{const n=e.current.getSelection();let a;if(n){const s=Ra(t,n);e.current.replaceSelection(s),e.current.focus()}else{a=Ta(t),e.current.replaceSelection(a.editedText),e.current.focus();const{line:s,ch:i}=e.current.getCursor(),l=i-a.selection.end,c=i-a.selection.end-a.selection.start;e.current.setSelection({line:s,ch:c},{line:s,ch:l})}},rm=(e,t)=>{const n=e.current.getDoc(),a=t==="BulletList"?"- ":"1. ";if(n.somethingSelected()){const s=n.listSelections();let i=null;e.current.operation(function(){s.forEach(function(l){const c=[l.head.line,l.anchor.line].sort();i==null&&(i=n.getLine(c[0]).startsWith(a));for(let u=c[0];u<=c[1];u++)if(i)n.getLine(u).startsWith(a)&&n.replaceRange("",{line:u,ch:0},{line:u,ch:a.length});else{const d=t==="BulletList"?"- ":`${u+1}. `;n.replaceRange(d,{line:u,ch:0})}})})}else{let{line:s}=n.getCursor();const i=Ma(t),l=e.current.getLine(s),c=i+l;e.current.setSelection({line:s,ch:0},{line:s,ch:l.length}),e.current.replaceSelection(c)}e.current.focus()},om=(e,t)=>{let{line:n}=e.current.getCursor();const a=Ma(t),s=e.current.getLine(n),i=s.replace(/#{1,6}\s/g,"").trim(),l=a+i;e.current.setSelection({line:n,ch:0},{line:n,ch:s.length}),e.current.replaceSelection(l),setTimeout(()=>{const c=e.current.getLine(n).length;e.current.focus(),e.current.setCursor({line:n,ch:c})},0)},am=(e,t)=>{let{line:n,ch:a}=e.current.getCursor();t.forEach((s,i)=>{let l=e.current.getLine(n).length;e.current.setCursor({line:n,ch:l}),(i>0||i===0&&a!==0)&&(l=e.current.getLine(n).length,e.current.setCursor({line:n,ch:l}),n++,e.current.replaceSelection(`
|
|
674
|
+
`)),s.mime.includes("image")?e.current.replaceSelection(``):e.current.replaceSelection(`[${s.alt}](${s.url})`)}),setTimeout(()=>e.current.focus(),0)},sm=(e,t,n,a,s)=>{const i=Ra(t,s),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.replaceSelection(""),e.current.setCursor({line:n,ch:a}),e.current.replaceSelection(`
|
|
675
|
+
`),e.current.replaceSelection(i),t==="Code"){let{line:c}=e.current.getCursor();e.current.setCursor({line:c-1,ch:s.length})}e.current.replaceRange(l,{line:n+4,ch:0},{line:1/0,ch:1/0}),e.current.focus()},im=(e,t,n,a)=>{const s=Ta(t),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.setCursor({line:n,ch:a}),e.current.replaceSelection(`
|
|
676
|
+
`),e.current.replaceSelection(s.editedText),t==="Code")n+=2,e.current.setSelection({line:n,ch:0},{line:n,ch:4});else{n+=1;let{ch:l}=e.current.getCursor(),c=l-s.selection.end,u=l-s.selection.end-s.selection.start;e.current.setSelection({line:n,ch:u},{line:n,ch:c})}e.current.replaceRange(i,{line:n+2,ch:0},{line:1/0,ch:1/0}),e.current.focus()},lm=(e,t)=>{const n=e.current.getSelection();let{line:a}=e.current.getCursor(),s=e.current.getLine(a).length;n?sm(e,t,a,s,n):im(e,t,a,s)};var cm=p(64410),um=p(43768),dm=p.n(um);const pm=(e,t)=>`${e}${Math.floor(t*255).toString(16).padStart(2,0)}`,mm=(0,L.default)(W.Flex)`
|
|
677
|
+
background: ${({theme:e})=>pm(e.colors.neutral800,.2)};
|
|
678
|
+
`,fm=(0,L.default)(D.Box)`
|
|
679
|
+
border-right: 1px solid ${({theme:e})=>e.colors.neutral200};
|
|
680
|
+
`,gm=(0,L.default)(Ln.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
|
+
`,_n=({children:e,isExpandMode:t,error:n,previewContent:a,onCollapse:s})=>{const{formatMessage:i}=(0,N.useIntl)();return(0,r.useEffect)(()=>{const l=document.body;return t&&l.classList.add("lock-body-scroll"),()=>{t&&l.classList.remove("lock-body-scroll")}},[t]),t?r.createElement(cm.Portal,{role:"dialog","aria-modal":!1},r.createElement(jn.FocusTrap,{onEscape:s},r.createElement(mm,{position:"fixed",top:0,left:0,right:0,bottom:0,zIndex:4,justifyContent:"center",onClick:s},r.createElement(D.Box,{id:"wysiwyg-expand",background:"neutral0",hasRadius:!0,shadow:"popupShadow",overflow:"hidden",width:"70%",height:"70%",onClick:l=>l.stopPropagation()},r.createElement(W.Flex,{height:"100%",alignItems:"flex-start"},r.createElement(fm,{flex:"1",height:"100%"},e),r.createElement(D.Box,{flex:"1",height:"100%"},r.createElement(W.Flex,{height:(0,y.pxToRem)(48),background:"neutral100",justifyContent:"flex-end"},r.createElement(gm,{id:"collapse",onClick:s},r.createElement(x.Typography,null,i({id:"components.Wysiwyg.collapse",defaultMessage:"Collapse"})),r.createElement(dm(),null))),r.createElement(D.Box,{position:"relative",height:"100%"},r.createElement(ga,{data:a})))))))):r.createElement(D.Box,{borderColor:n?"danger600":"neutral200",borderStyle:"solid",borderWidth:"1px",hasRadius:!0},e)};_n.defaultProps={error:void 0,previewContent:""},_n.propTypes={children:o().node.isRequired,error:o().string,isExpandMode:o().bool.isRequired,previewContent:o().string,onCollapse:o().func.isRequired};var ym=Object.defineProperty,Ia=Object.getOwnPropertySymbols,hm=Object.prototype.hasOwnProperty,bm=Object.prototype.propertyIsEnumerable,Da=(e,t,n)=>t in e?ym(e,t,{enumerable:!0,configurable:!0,writable:!0,value:n}):e[t]=n,Sa=(e,t)=>{for(var n in t||(t={}))hm.call(t,n)&&Da(e,n,t[n]);if(Ia)for(var n of Ia(t))bm.call(t,n)&&Da(e,n,t[n]);return e};const vm=(0,L.default)(D.Box)`
|
|
694
|
+
svg path {
|
|
695
|
+
fill: ${({theme:e})=>e.colors.neutral500};
|
|
696
|
+
}
|
|
697
|
+
`,Em=(0,L.default)(x.Typography)`
|
|
698
|
+
line-height: 0;
|
|
699
|
+
`,Hn=({description:e,disabled:t,error:n,intlLabel:a,labelAction:s,name:i,onChange:l,placeholder:c,value:u,required:d})=>{const{formatMessage:m}=(0,N.useIntl)(),g=(0,r.useRef)(null),f=(0,r.useRef)(null),[h,b]=(0,r.useState)(!1),[v,S]=(0,r.useState)(!1),[O,C]=(0,r.useState)(!1),{components:B}=(0,y.useLibrary)(),T=B["media-library"],M=()=>S(U=>!U),V=()=>b(U=>!U),A=()=>{b(!1),C(U=>!U)},H=(U,F,I)=>{switch(U){case"Link":case"Strikethrough":{wa(F,U),I();break}case"Code":case"Quote":{lm(F,U),I();break}case"Bold":case"Italic":case"Underline":{wa(F,U);break}case"BulletList":case"NumberList":{rm(F,U),I();break}case"h1":case"h2":case"h3":case"h4":case"h5":case"h6":{om(F,U);break}default:}},Q=U=>{const F=U.map(I=>({alt:I.alternativeText||I.name,url:(0,y.prefixFileUrlWithBackendUrl)(I.url),mime:I.mime}));am(f,F),S(!1)},j=c?m({id:c.id,defaultMessage:c.defaultMessage},Sa({},c.values)):"",G=a.id?m({id:a.id,defaultMessage:a.defaultMessage},Sa({},a.values)):i;return r.createElement(r.Fragment,null,r.createElement(ue.Stack,{spacing:1},r.createElement(ue.Stack,{horizontal:!0,spacing:1},r.createElement(x.Typography,{variant:"pi",fontWeight:"bold",textColor:"neutral800"},G,d&&r.createElement(Em,{textColor:"danger600"},"*")),s&&r.createElement(vm,{paddingLeft:1},s)),r.createElement(_n,{isExpandMode:O,error:n,previewContent:u,onCollapse:A},r.createElement(Zp,{isExpandMode:O,editorRef:f,isPreviewMode:h,onActionClick:H,onToggleMediaLib:M,onTogglePreviewMode:O?void 0:V,disabled:t}),r.createElement(Ip,{disabled:t,isExpandMode:O,editorRef:f,error:n,isPreviewMode:h,name:i,onChange:l,placeholder:j,textareaRef:g,value:u}),!O&&r.createElement(Kp,{onToggleExpand:A})),r.createElement(nm,{description:e,name:i,error:n})),n&&r.createElement(D.Box,{paddingTop:1},r.createElement(x.Typography,{variant:"pi",textColor:"danger600","data-strapi-field-error":!0},n)),v&&r.createElement(T,{onClose:M,onSelectAssets:Q}))};Hn.defaultProps={description:null,disabled:!1,error:"",labelAction:void 0,placeholder:null,required:!1,value:""},Hn.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 Cm=Hn;var Om=p(16285),Pm=p.n(Om),He=p(20001),Rm=p(37475);const Tm=L.default.div`
|
|
700
|
+
cursor: ${({disabled:e})=>e?"not-allowed !important":"auto"};
|
|
701
|
+
/* BASICS */
|
|
702
|
+
|
|
703
|
+
.colored {
|
|
704
|
+
background-color: yellow;
|
|
705
|
+
color: black !important;
|
|
706
|
+
}
|
|
707
|
+
|
|
708
|
+
> div {
|
|
709
|
+
border-radius: 3px;
|
|
710
|
+
> div:last-of-type {
|
|
711
|
+
min-height: 253px;
|
|
712
|
+
max-height: 506px;
|
|
713
|
+
}
|
|
714
|
+
}
|
|
715
|
+
|
|
716
|
+
.CodeMirror {
|
|
717
|
+
/* Set height, width, borders, and global font properties here */
|
|
718
|
+
font-size: ${14/16}rem;
|
|
719
|
+
direction: ltr;
|
|
720
|
+
z-index: 0;
|
|
721
|
+
}
|
|
722
|
+
`,Mm=(0,L.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 wm=Object.defineProperty,La=Object.getOwnPropertySymbols,Im=Object.prototype.hasOwnProperty,Dm=Object.prototype.propertyIsEnumerable,xa=(e,t,n)=>t in e?wm(e,t,{enumerable:!0,configurable:!0,writable:!0,value:n}):e[t]=n,Sm=(e,t)=>{for(var n in t||(t={}))Im.call(t,n)&&xa(e,n,t[n]);if(La)for(var n of La(t))Dm.call(t,n)&&xa(e,n,t[n]);return e};const Lm=(0,L.default)(D.Box)`
|
|
726
|
+
svg path {
|
|
727
|
+
fill: ${({theme:e})=>e.colors.neutral500};
|
|
728
|
+
}
|
|
729
|
+
`,Gn=({intlLabel:e,labelAction:t,name:n,required:a})=>{const{formatMessage:s}=(0,N.useIntl)(),i=e!=null&&e.id?s({id:e.id,defaultMessage:e.defaultMessage},Sm({},e.values)):n;return r.createElement(W.Flex,null,r.createElement(He.FieldLabel,{required:a},i),t&&r.createElement(Lm,{paddingLeft:1},t))};Gn.defaultProps={id:void 0,intlLabel:void 0,labelAction:void 0,required:!1},Gn.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 xm=Gn,Zn=({name:e,hint:t,error:n,children:a})=>{const{formatMessage:s}=(0,N.useIntl)(),i=n?s({id:n,defaultMessage:n}):"";return r.createElement(He.Field,{name:e,hint:t&&s(t),error:i,id:e},a)};Zn.defaultProps={hint:void 0,error:""},Zn.propTypes={name:o().string.isRequired,hint:o().shape({id:o().string,defaultMessage:o().string}),error:o().string,children:o().node.isRequired};const Fm=Zn;var km=Object.defineProperty,Am=(e,t,n)=>t in e?km(e,t,{enumerable:!0,configurable:!0,writable:!0,value:n}):e[t]=n,tt=(e,t,n)=>(Am(e,typeof t!="symbol"?t+"":t,n),n),jm=(e,t,n)=>new Promise((a,s)=>{var i=u=>{try{c(n.next(u))}catch(d){s(d)}},l=u=>{try{c(n.throw(u))}catch(d){s(d)}},c=u=>u.done?a(u.value):Promise.resolve(u.value).then(i,l);c((n=n.apply(e,t)).next())});const $m=600,Bm="blackboard";(()=>jm(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 Qn extends r.Component{constructor(t){super(t),tt(this,"timer",null),tt(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(a){return this.setState({error:!0})}}),tt(this,"setSize",()=>this.codeMirror.setSize("100%","auto")),tt(this,"getContentAtLine",n=>this.codeMirror.getLine(n)),tt(this,"markSelection",({message:n})=>{let a=parseInt(n.split(":")[0].split("line ")[1],10)-1,s=this.getContentAtLine(a);s==="{"&&(a+=1,s=this.getContentAtLine(a));const i=s.length,l=i-Pm()(s," ").length,c=this.codeMirror.markText({line:a,ch:l},{line:a,ch:i},{className:"colored"});this.setState({markedText:c})}),tt(this,"handleChange",(n,a)=>{if(a.origin==="setValue")return;const{name:s,onChange:i}=this.props;let l=n.getValue();l===""&&(l=null),i({target:{name:s,value:l,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()),$m)}),tt(this,"testJSON",n=>{try{Rm.parse(n)}catch(a){this.markSelection(a)}}),this.editor=r.createRef(),this.state={error:!1,markedText:null}}componentDidMount(){this.codeMirror=Gt().fromTextArea(this.editor.current,{autoCloseBrackets:!0,lineNumbers:!0,matchBrackets:!0,mode:"application/json",readOnly:this.props.disabled,smartIndent:!0,styleSelectedText:!0,tabSize:2,theme:Bm,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(Fm,{name:this.props.name,hint:this.props.description,error:this.props.error},r.createElement(ue.Stack,{spacing:1},r.createElement(xm,{intlLabel:this.props.intlLabel,labelAction:this.props.labelAction,name:this.props.name,required:this.props.required}),r.createElement(Mm,{error:this.props.error},r.createElement(Tm,{disabled:this.props.disabled},r.createElement("textarea",{ref:this.editor,autoComplete:"off",id:this.props.id||this.props.name,defaultValue:""}))),r.createElement(He.FieldHint,null),r.createElement(He.FieldError,null)))}}Qn.defaultProps={description:null,disabled:!1,id:void 0,error:void 0,intlLabel:void 0,labelAction:void 0,onChange(){},value:null,required:!1},Qn.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 Nm=Qn;var Jn=p(37178),Vm=p(23101),Fa=p.n(Vm),qm=p(14356),zm=p.n(qm),Wm=p(50678),Pt=p.n(Wm),Um=p(103),_m=p.n(Um);const ka=(e,t)=>{const[n,a]=(0,r.useState)(e);return(0,r.useEffect)(()=>{const s=setTimeout(()=>{a(e)},t);return()=>{clearTimeout(s)}},[e,t]),n},Hm=/^[A-Za-z0-9-_.~]*$/,Gm=(0,L.default)(D.Box)`
|
|
730
|
+
position: relative;
|
|
731
|
+
`,Zm=(0,L.default)(He.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
|
+
`,Kn=(0,L.default)(W.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
|
+
`,Qm=L.keyframes`
|
|
760
|
+
from {
|
|
761
|
+
transform: rotate(0deg);
|
|
762
|
+
}
|
|
763
|
+
to {
|
|
764
|
+
transform: rotate(359deg);
|
|
765
|
+
}
|
|
766
|
+
`,Jm=(0,L.default)(W.Flex)`
|
|
767
|
+
animation: ${Qm} 2s infinite linear;
|
|
768
|
+
`;var Km=Object.defineProperty,Aa=Object.getOwnPropertySymbols,Ym=Object.prototype.hasOwnProperty,Xm=Object.prototype.propertyIsEnumerable,ja=(e,t,n)=>t in e?Km(e,t,{enumerable:!0,configurable:!0,writable:!0,value:n}):e[t]=n,Yn=(e,t)=>{for(var n in t||(t={}))Ym.call(t,n)&&ja(e,n,t[n]);if(Aa)for(var n of Aa(t))Xm.call(t,n)&&ja(e,n,t[n]);return e},$a=(e,t,n)=>new Promise((a,s)=>{var i=u=>{try{c(n.next(u))}catch(d){s(d)}},l=u=>{try{c(n.throw(u))}catch(d){s(d)}},c=u=>u.done?a(u.value):Promise.resolve(u.value).then(i,l);c((n=n.apply(e,t)).next())});const Xn=({attribute:e,contentTypeUID:t,description:n,disabled:a,error:s,intlLabel:i,labelAction:l,name:c,onChange:u,value:d,placeholder:m,required:g})=>{const{modifiedData:f,initialData:h,layout:b}=(0,y.useCMEditViewDataManager)(),[v,S]=(0,r.useState)(!1),[O,C]=(0,r.useState)(null),B=ka(d,300),T=(0,r.useRef)(),M=h[c],{formatMessage:V}=(0,N.useIntl)(),A=w()(b,["options","timestamps",0]),H=!h[A],Q=ka(f[e.targetField],300),[j,G]=(0,r.useState)(!1),[U,F]=(0,r.useState)(null),I=i.id?V({id:i.id,defaultMessage:i.defaultMessage},Yn({},i.values)):c,K=n?V({id:n.id,defaultMessage:n.defaultMessage},Yn({},n.values)):"",$=m?V({id:m.id,defaultMessage:m.defaultMessage},Yn({},m.values)):"";T.current=(P=!1)=>$a(void 0,null,function*(){S(!0);const z=ye("uid/generate");try{const{data:{data:Y}}=yield fe.be.post(z,{contentTypeUID:t,field:c,data:f});u({target:{name:c,value:Y,type:"text"}},P),S(!1)}catch(Y){S(!1)}});const Z=()=>$a(void 0,null,function*(){S(!0);const P=ye("uid/check-availability");if(!!d)try{const{data:z}=yield fe.be.post(P,{contentTypeUID:t,field:c,value:d?d.trim():""});C(z),S(!1)}catch(z){S(!1)}});(0,r.useEffect)(()=>{!d&&e.required&&T.current(!0)},[]),(0,r.useEffect)(()=>{B&&B.trim().match(Hm)&&B!==M&&Z(),B||C(null)},[B,M]),(0,r.useEffect)(()=>{let P;return O&&O.isAvailable&&(P=setTimeout(()=>{C(null)},4e3)),()=>{P&&clearTimeout(P)}},[O]),(0,r.useEffect)(()=>{!j&&H&&Q&&f[e.targetField]&&!d&&T.current(!0)},[Q,j,H]);const q=()=>{F(V({id:"content-manager.components.uid.regenerate",defaultMessage:"Regenerate"}))},k=()=>{F(null)},R=P=>{P.target.value&&H&&G(!0),u(P)};return r.createElement(Jn.TextInput,{disabled:a,error:s,endAction:r.createElement(Gm,null,O&&O.isAvailable&&!U&&r.createElement(Kn,{alignItems:"center",justifyContent:"flex-end"},r.createElement(zm(),null),r.createElement(x.Typography,{textColor:"success600",variant:"pi"},V({id:"content-manager.components.uid.available",defaultMessage:"Available"}))),O&&!O.isAvailable&&!U&&r.createElement(Kn,{notAvailable:!0,alignItems:"center",justifyContent:"flex-end"},r.createElement(Pt(),null),r.createElement(x.Typography,{textColor:"danger600",variant:"pi"},V({id:"content-manager.components.uid.unavailable",defaultMessage:"Unavailable"}))),U&&r.createElement(Kn,{alignItems:"center",justifyContent:"flex-end"},r.createElement(x.Typography,{textColor:"primary600",variant:"pi"},U)),r.createElement(Zm,{onClick:()=>T.current(),label:"regenerate",onMouseEnter:q,onMouseLeave:k},v?r.createElement(Jm,null,r.createElement(_m(),null)):r.createElement(Fa(),null))),hint:K,label:I,labelAction:l,name:c,onChange:R,placeholder:$,value:d||"",required:g})};Xn.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},Xn.defaultProps={description:void 0,disabled:!1,error:void 0,labelAction:void 0,placeholder:void 0,value:"",required:!1};const ef=Xn;var tf=p(54450),er=p(89557),nf=p(58434),Ba=p(78752),tr=p(74201),Qt=p(44826),rf=Object.defineProperty,Jt=Object.getOwnPropertySymbols,Na=Object.prototype.hasOwnProperty,Va=Object.prototype.propertyIsEnumerable,qa=(e,t,n)=>t in e?rf(e,t,{enumerable:!0,configurable:!0,writable:!0,value:n}):e[t]=n,of=(e,t)=>{for(var n in t||(t={}))Na.call(t,n)&&qa(e,n,t[n]);if(Jt)for(var n of Jt(t))Va.call(t,n)&&qa(e,n,t[n]);return e},af=(e,t)=>{var n={};for(var a in e)Na.call(e,a)&&t.indexOf(a)<0&&(n[a]=e[a]);if(e!=null&&Jt)for(var a of Jt(e))t.indexOf(a)<0&&Va.call(e,a)&&(n[a]=e[a]);return n};const nr=e=>{var t=e,{children:n,loadMore:a,search:s,totalNumberOfRelations:i,size:l}=t,c=af(t,["children","loadMore","search","totalNumberOfRelations","size"]);return r.createElement(r.Fragment,null,r.createElement(W.Flex,{paddingBottom:i>0?3:0,gap:2,justifyContent:"space-between",alignItems:"end",wrap:"wrap"},r.createElement(ue.Stack,of({basis:l<=6?"100%":"70%",spacing:1},c),s),a),n)};nr.defaultProps={search:void 0,loadMore:void 0,totalNumberOfRelations:0},nr.propTypes={children:o().node.isRequired,search:o().node,loadMore:o().node,size:o().number.isRequired,totalNumberOfRelations:o().number};var sf=Object.defineProperty,Kt=Object.getOwnPropertySymbols,za=Object.prototype.hasOwnProperty,Wa=Object.prototype.propertyIsEnumerable,Ua=(e,t,n)=>t in e?sf(e,t,{enumerable:!0,configurable:!0,writable:!0,value:n}):e[t]=n,lf=(e,t)=>{for(var n in t||(t={}))za.call(t,n)&&Ua(e,n,t[n]);if(Kt)for(var n of Kt(t))Wa.call(t,n)&&Ua(e,n,t[n]);return e},cf=(e,t)=>{var n={};for(var a in e)za.call(e,a)&&t.indexOf(a)<0&&(n[a]=e[a]);if(e!=null&&Kt)for(var a of Kt(e))t.indexOf(a)<0&&Wa.call(e,a)&&(n[a]=e[a]);return n};const uf=(0,L.default)(W.Flex)`
|
|
769
|
+
width: 100%;
|
|
770
|
+
/* Used to prevent endAction to be pushed out of container */
|
|
771
|
+
min-width: 0;
|
|
772
|
+
`,rr=e=>{var t=e,{children:n,disabled:a,endAction:s,style:i}=t,l=cf(t,["children","disabled","endAction","style"]);return r.createElement(D.Box,{style:i,as:"li"},r.createElement(W.Flex,lf({paddingTop:2,paddingBottom:2,paddingLeft:4,paddingRight:4,hasRadius:!0,borderSize:1,background:a?"neutral150":"neutral0",borderColor:"neutral200",justifyContent:"space-between"},l),r.createElement(uf,{justifyContent:"space-between"},n),s&&r.createElement(D.Box,{paddingLeft:4},s)))};rr.defaultProps={disabled:!1,endAction:void 0,style:void 0},rr.propTypes={children:o().node.isRequired,disabled:o().bool,endAction:o().node,style:o().shape({height:o().number,left:o().number,position:o().string,right:o().number,width:o().string})};var df=Object.defineProperty,Yt=Object.getOwnPropertySymbols,_a=Object.prototype.hasOwnProperty,Ha=Object.prototype.propertyIsEnumerable,Ga=(e,t,n)=>t in e?df(e,t,{enumerable:!0,configurable:!0,writable:!0,value:n}):e[t]=n,pf=(e,t)=>{for(var n in t||(t={}))_a.call(t,n)&&Ga(e,n,t[n]);if(Yt)for(var n of Yt(t))Ha.call(t,n)&&Ga(e,n,t[n]);return e},mf=(e,t)=>{var n={};for(var a in e)_a.call(e,a)&&t.indexOf(a)<0&&(n[a]=e[a]);if(e!=null&&Yt)for(var a of Yt(e))t.indexOf(a)<0&&Ha.call(e,a)&&(n[a]=e[a]);return n};const ff=(0,L.default)(D.Box)`
|
|
773
|
+
position: relative;
|
|
774
|
+
overflow-x: hidden;
|
|
775
|
+
overflow-y: auto;
|
|
776
|
+
|
|
777
|
+
&:before,
|
|
778
|
+
&:after {
|
|
779
|
+
position: absolute;
|
|
780
|
+
width: 100%;
|
|
781
|
+
height: 4px;
|
|
782
|
+
z-index: 1;
|
|
783
|
+
}
|
|
784
|
+
|
|
785
|
+
&:before {
|
|
786
|
+
/* TODO: as for DS Table component we would need this to be handled by the DS theme */
|
|
787
|
+
content: ${({overflowDirection:e})=>e==="top-bottom"||e==="top"?"''":void 0};
|
|
788
|
+
background: linear-gradient(rgba(33, 33, 52, 0.1) 0%, rgba(0, 0, 0, 0) 100%);
|
|
789
|
+
top: 0;
|
|
790
|
+
}
|
|
791
|
+
|
|
792
|
+
&:after {
|
|
793
|
+
/* TODO: as for DS Table component we would need this to be handled by the DS theme */
|
|
794
|
+
content: ${({overflowDirection:e})=>e==="top-bottom"||e==="bottom"?"''":void 0};
|
|
795
|
+
background: linear-gradient(rgba(0, 0, 0, 0) 0%, rgba(33, 33, 52, 0.1) 100%);
|
|
796
|
+
bottom: 0;
|
|
797
|
+
}
|
|
798
|
+
`,or=e=>{var t=e,{children:n,overflow:a}=t,s=mf(t,["children","overflow"]);return r.createElement(ff,pf({overflowDirection:a},s),r.createElement(ue.Stack,{spacing:1},n))};or.defaultProps={overflow:""},or.propTypes={children:o().node.isRequired,overflow:o().oneOf(["top-bottom","bottom","top",""])};var gf=p(82576),yf=Object.defineProperty,Za=Object.getOwnPropertySymbols,hf=Object.prototype.hasOwnProperty,bf=Object.prototype.propertyIsEnumerable,Qa=(e,t,n)=>t in e?yf(e,t,{enumerable:!0,configurable:!0,writable:!0,value:n}):e[t]=n,Ja=(e,t)=>{for(var n in t||(t={}))hf.call(t,n)&&Qa(e,n,t[n]);if(Za)for(var n of Za(t))bf.call(t,n)&&Qa(e,n,t[n]);return e};const vf=L.default.div`
|
|
799
|
+
flex-shrink: 0;
|
|
800
|
+
width: ${(0,y.pxToRem)(6)};
|
|
801
|
+
height: ${(0,y.pxToRem)(6)};
|
|
802
|
+
margin-right: ${({theme:e})=>e.spaces[2]};
|
|
803
|
+
background-color: ${({theme:e,isDraft:t})=>e.colors[t?"secondary600":"success600"]};
|
|
804
|
+
border-radius: 50%;
|
|
805
|
+
`,Ka=e=>{const{formatMessage:t}=(0,N.useIntl)(),n=gf.components.Option,{publicationState:a,mainField:s,id:i}=e.data;if(a){const l=a==="draft",c={id:E("components.Select.draft-info-title"),defaultMessage:"State: Draft"},u={id:E("components.Select.publish-info-title"),defaultMessage:"State: Published"},d=t(l?c:u);return r.createElement(n,Ja({},e),r.createElement(W.Flex,null,r.createElement(vf,{title:d,isDraft:l}),r.createElement(x.Typography,{ellipsis:!0},s!=null?s:i)))}return r.createElement(n,Ja({},e),s!=null?s:i)};Ka.propTypes={isFocused:o().bool.isRequired,data:o().shape({id:o().number.isRequired,isDraft:o().bool,mainField:o().string,publicationState:o().oneOfType([o().string,o().bool])}).isRequired};const Xt=50;var Ef=Object.defineProperty,Cf=Object.defineProperties,Of=Object.getOwnPropertyDescriptors,Ya=Object.getOwnPropertySymbols,Pf=Object.prototype.hasOwnProperty,Rf=Object.prototype.propertyIsEnumerable,Xa=(e,t,n)=>t in e?Ef(e,t,{enumerable:!0,configurable:!0,writable:!0,value:n}):e[t]=n,Tf=(e,t)=>{for(var n in t||(t={}))Pf.call(t,n)&&Xa(e,n,t[n]);if(Ya)for(var n of Ya(t))Rf.call(t,n)&&Xa(e,n,t[n]);return e},Mf=(e,t)=>Cf(e,Of(t));const wf=(0,L.default)(nf.Link)`
|
|
806
|
+
white-space: nowrap;
|
|
807
|
+
overflow: hidden;
|
|
808
|
+
text-overflow: ellipsis;
|
|
809
|
+
display: inherit;
|
|
810
|
+
`,If=(0,L.default)(D.Box)`
|
|
811
|
+
> span {
|
|
812
|
+
white-space: nowrap;
|
|
813
|
+
overflow: hidden;
|
|
814
|
+
text-overflow: ellipsis;
|
|
815
|
+
display: inherit;
|
|
816
|
+
}
|
|
817
|
+
`,Df=L.default.button`
|
|
818
|
+
svg path {
|
|
819
|
+
fill: ${({theme:e})=>e.colors.neutral500};
|
|
820
|
+
}
|
|
821
|
+
|
|
822
|
+
&:hover svg path,
|
|
823
|
+
&:focus svg path {
|
|
824
|
+
fill: ${({theme:e})=>e.colors.neutral600};
|
|
825
|
+
}
|
|
826
|
+
`,ar=({description:e,disabled:t,error:n,id:a,name:s,numberOfRelationsToDisplay:i,label:l,labelAction:c,labelLoadMore:u,labelDisconnectRelation:d,loadingMessage:m,onRelationAdd:g,onRelationLoadMore:f,onRelationRemove:h,onSearchClose:b,onSearchNextPage:v,onSearchOpen:S,onSearch:O,placeholder:C,publicationStateTranslations:B,required:T,relations:M,searchResults:V,size:A})=>{var H;const[Q,j]=(0,r.useState)(null),G=(0,r.useRef)(),U=(0,r.useRef)(),[F,I]=(0,r.useState)(""),{data:{pages:K}}=V,$=(0,r.useMemo)(()=>M.data.pages.flat(),[M]),Z=(H=$.length)!=null?H:0,q=(0,r.useMemo)(()=>Z>i?Math.min(Z,i)*Xt+Xt/2:Math.min(Z,i)*Xt,[Z,i]),k=!!u&&!t&&M.hasNextPage||M.isLoading,R=(0,r.useMemo)(()=>K.flat().map(J=>Mf(Tf({},J),{value:J.id,label:J.mainField})),[K]);(0,r.useEffect)(()=>{if(Z<=i)return I("");const J=Ce=>{const xe=Ce.target.parentNode.scrollHeight,Ke=Ce.target.scrollHeight-Ce.target.scrollTop;return Ce.target.scrollTop===0?I("bottom"):I(Ke===xe?"top":"top-bottom")},Pe=U==null?void 0:U.current;return!M.isLoading&&$.length>0&&Pe&&U.current.addEventListener("scroll",J),()=>{Pe&&Pe.removeEventListener("scroll",J)}},[M,$,i,Z]);const[P,z]=(0,r.useState)(!1),Y=(0,r.useRef)(),se=(0,r.useRef)([]);(0,r.useEffect)(()=>(R.length>0&&se.current.length===0&&z(J=>(J&&(Y.current=setTimeout(()=>{z(!0)},10)),!1)),()=>{se.current=R||[]}),[R]),(0,r.useEffect)(()=>()=>{Y.current&&clearTimeout(Y.current)},[]);const ae=()=>{z(!1),b&&b()},_=()=>{z(!0),S()};return r.createElement(He.Field,{error:n,name:s,hint:e,id:a},r.createElement(nr,{totalNumberOfRelations:Z,size:A,search:r.createElement(r.Fragment,null,r.createElement(He.FieldLabel,{action:c,required:T},l),r.createElement(y.ReactSelect,{menuPosition:"absolute",menuPlacement:"auto",components:{Option:Ka},options:R,isDisabled:t,isLoading:V.isLoading,error:n,inputId:a,isSearchable:!0,isClear:!0,loadingMessage:m,onChange:J=>{j(null),g(J),$.length>0&&setTimeout(()=>{G.current.scrollToItem($.length,"end")})},onInputChange:J=>{j(J),O(J)},onMenuClose:ae,onMenuOpen:_,menuIsOpen:P,onMenuScrollToBottom:()=>{V.hasNextPage&&v()},placeholder:C,name:s,value:Q})),loadMore:k&&r.createElement(tr.TextButton,{disabled:M.isLoading||M.isFetchingNextPage,onClick:()=>f(),loading:M.isLoading||M.isFetchingNextPage,startIcon:r.createElement(Fa(),null)},u)},r.createElement(or,{overflow:F},r.createElement(tf.t7,{height:q,ref:G,outerRef:U,itemCount:Z,itemSize:Xt,itemData:$,innerElementType:"ol"},({data:J,index:Pe,style:Ce})=>{const{publicationState:xe,href:Ke,mainField:$e,id:Ge}=J[Pe],kt=xe==="draft"?"secondary":"success";return r.createElement(rr,{disabled:t,key:`relation-${s}-${Ge}`,endAction:r.createElement(Df,{"data-testid":`remove-relation-${Ge}`,disabled:t,type:"button",onClick:()=>h(J[Pe]),"aria-label":d},r.createElement(Ba.Icon,{width:"12px",as:Pn()})),style:Ce},r.createElement(If,{minWidth:0,paddingTop:1,paddingBottom:1,paddingRight:4},r.createElement(Qt.Tooltip,{description:$e!=null?$e:`${Ge}`},Ke?r.createElement(wf,{to:Ke,disabled:t},$e!=null?$e:Ge):r.createElement(x.Typography,{textColor:t?"neutral600":"primary600",ellipsis:!0},$e!=null?$e:Ge))),xe&&r.createElement(er.Badge,{borderSize:1,borderColor:`${kt}200`,backgroundColor:`${kt}100`,textColor:`${kt}700`,shrink:0},B[xe]))})),(e||n)&&r.createElement(D.Box,{paddingTop:2},r.createElement(He.FieldHint,null),r.createElement(He.FieldError,null))))},Sf=o().shape({data:o().shape({pages:o().arrayOf(o().arrayOf(o().shape({href:o().string,id:o().number.isRequired,publicationState:o().oneOfType([o().string,o().bool]),mainField:o().oneOfType([o().string,o().number])})))}),hasNextPage:o().bool,isFetchingNextPage:o().bool.isRequired,isLoading:o().bool.isRequired,isSuccess:o().bool.isRequired}),Lf=o().shape({data:o().shape({pages:o().arrayOf(o().arrayOf(o().shape({id:o().number.isRequired,mainField:o().oneOfType([o().string,o().number]),publicationState:o().oneOfType([o().string,o().bool])})))}),hasNextPage:o().bool,isLoading:o().bool.isRequired,isSuccess:o().bool.isRequired});ar.defaultProps={description:void 0,disabled:!1,error:void 0,labelAction:null,labelLoadMore:null,onSearchClose:void 0,required:!1,relations:[],searchResults:[]},ar.propTypes={error:o().string,description:o().string,disabled:o().bool,id:o().string.isRequired,label:o().string.isRequired,labelAction:o().element,labelLoadMore:o().string,labelDisconnectRelation:o().string.isRequired,loadingMessage:o().func.isRequired,name:o().string.isRequired,numberOfRelationsToDisplay:o().number.isRequired,onRelationAdd:o().func.isRequired,onRelationRemove:o().func.isRequired,onRelationLoadMore:o().func.isRequired,onSearch:o().func.isRequired,onSearchNextPage:o().func.isRequired,onSearchClose:o().func,onSearchOpen:o().func.isRequired,placeholder:o().string.isRequired,publicationStateTranslations:o().shape({draft:o().string.isRequired,published:o().string.isRequired}).isRequired,required:o().bool,searchResults:Lf,size:o().number.isRequired,relations:Sf};const xf=ar;var nt=p(84968),Ff=Object.defineProperty,kf=Object.defineProperties,Af=Object.getOwnPropertyDescriptors,es=Object.getOwnPropertySymbols,jf=Object.prototype.hasOwnProperty,$f=Object.prototype.propertyIsEnumerable,ts=(e,t,n)=>t in e?Ff(e,t,{enumerable:!0,configurable:!0,writable:!0,value:n}):e[t]=n,Rt=(e,t)=>{for(var n in t||(t={}))jf.call(t,n)&&ts(e,n,t[n]);if(es)for(var n of es(t))$f.call(t,n)&&ts(e,n,t[n]);return e},en=(e,t)=>kf(e,Af(t)),ns=(e,t,n)=>new Promise((a,s)=>{var i=u=>{try{c(n.next(u))}catch(d){s(d)}},l=u=>{try{c(n.throw(u))}catch(d){s(d)}},c=u=>u.done?a(u.value):Promise.resolve(u.value).then(i,l);c((n=n.apply(e,t)).next())});const Bf=(e,{relation:t,search:n})=>{const[a,s]=(0,r.useState)({}),i=m=>ns(void 0,[m],function*({pageParam:g=1}){var f;try{const{data:h}=yield fe.be.get(t==null?void 0:t.endpoint,{params:en(Rt({},(f=t.pageParams)!=null?f:{}),{page:g})});return h}catch(h){return null}}),l=m=>ns(void 0,[m],function*({pageParam:g=1}){var f;try{const{data:h}=yield fe.be.get(n.endpoint,{params:en(Rt(Rt({},(f=n.pageParams)!=null?f:{}),a),{page:g})});return h}catch(h){return null}}),c=(0,nt.useInfiniteQuery)(["relation",e],i,{cacheTime:0,enabled:t.enabled,getNextPageParam(m){if(!(!m||m.pagination.page>=m.pagination.pageCount))return m.pagination.page+1},select:m=>({pages:m.pages.map(g=>{var f;return en(Rt({},g),{results:[...(f=g.results)!=null?f:[]].reverse()})})})}),u=(0,nt.useInfiniteQuery)(["relation",e,"search",JSON.stringify(a)],l,{enabled:Object.keys(a).length>0,getNextPageParam(m){if(!(m.pagination.page>=m.pagination.pageCount))return m.pagination.page+1}});return{relations:c,search:u,searchFor:(m,g={})=>{s(en(Rt({},g),{_q:m}))}}};var Nf=Object.defineProperty,rs=Object.getOwnPropertySymbols,Vf=Object.prototype.hasOwnProperty,qf=Object.prototype.propertyIsEnumerable,os=(e,t,n)=>t in e?Nf(e,t,{enumerable:!0,configurable:!0,writable:!0,value:n}):e[t]=n,as=(e,t)=>{for(var n in t||(t={}))Vf.call(t,n)&&os(e,n,t[n]);if(rs)for(var n of rs(t))qf.call(t,n)&&os(e,n,t[n]);return e};function zf(e,t){return n=>{const a=t(n);return r.createElement(e,as(as({},n),a))}}const Wf=zf;var Uf=Object.defineProperty,_f=Object.defineProperties,Hf=Object.getOwnPropertyDescriptors,ss=Object.getOwnPropertySymbols,Gf=Object.prototype.hasOwnProperty,Zf=Object.prototype.propertyIsEnumerable,is=(e,t,n)=>t in e?Uf(e,t,{enumerable:!0,configurable:!0,writable:!0,value:n}):e[t]=n,Qf=(e,t)=>{for(var n in t||(t={}))Gf.call(t,n)&&is(e,n,t[n]);if(ss)for(var n of ss(t))Zf.call(t,n)&&is(e,n,t[n]);return e},Jf=(e,t)=>_f(e,Hf(t));function Kf({componentUid:e,isUserAllowedToEditField:t,isUserAllowedToReadField:n,name:a,queryInfos:s}){var i;const{isCreatingEntry:l,createActionAllowedFields:c,readActionAllowedFields:u,updateActionAllowedFields:d,slug:m,initialData:g}=(0,y.useCMEditViewDataManager)(),f=(0,r.useMemo)(()=>t===!0?!0:(l?c:d).includes(a),[l,c,a,t,d]),h=(0,r.useMemo)(()=>n?!0:(l?[]:u).includes(a),[l,n,a,u]),b=a.split(".");let v;e&&(v=(i=w()(g,b.slice(0,-1)))==null?void 0:i.id);const S=(0,r.useMemo)(()=>l?null:e?v?ye(`relations/${e}/${v}/${b.at(-1)}`):null:ye(`relations/${m}/${g.id}/${a.split(".").at(-1)}`),[l,e,m,g.id,a,v,b]),O=(0,r.useMemo)(()=>ye(e?`relations/${e}/${a.split(".").at(-1)}`:`relations/${m}/${a.split(".").at(-1)}`),[e,m,a]);return{componentId:v,queryInfos:Jf(Qf({},s),{endpoints:{search:O,relation:S}}),isCreatingEntry:l,isFieldAllowed:f,isFieldReadable:h}}const Yf=Kf;function Xf(e,t){return`${ye(`collectionType/${e}/${t!=null?t:""}`)}`}const tn={DRAFT:"draft",PUBLISHED:"published"},ls=5,eg=10;var tg=Object.defineProperty,ng=Object.defineProperties,rg=Object.getOwnPropertyDescriptors,cs=Object.getOwnPropertySymbols,og=Object.prototype.hasOwnProperty,ag=Object.prototype.propertyIsEnumerable,us=(e,t,n)=>t in e?tg(e,t,{enumerable:!0,configurable:!0,writable:!0,value:n}):e[t]=n,ds=(e,t)=>{for(var n in t||(t={}))og.call(t,n)&&us(e,n,t[n]);if(cs)for(var n of cs(t))ag.call(t,n)&&us(e,n,t[n]);return e},sg=(e,t)=>ng(e,rg(t));const ps=(e,{shouldAddLink:t,mainFieldName:n,targetModel:a})=>{const s=ds({},e);return t&&(s.href=Xf(a,s.id)),s.publicationState=!1,(s==null?void 0:s.publishedAt)!==void 0&&(s.publicationState=s.publishedAt?tn.PUBLISHED:tn.DRAFT),s.mainField=s[n],s},ig=(e,{modifiedData:t={},shouldAddLink:n=!1,mainFieldName:a,targetModel:s})=>{var i,l,c,u,d;return sg(ds({},e),{data:{pages:(d=(u=(c=[...(l=(i=e==null?void 0:e.data)==null?void 0:i.pages.reverse())!=null?l:[],...t!=null&&t.connect?[{results:t.connect}]:[]])==null?void 0:c.map(m=>m==null?void 0:m.results.filter(g=>{var f;return!((f=t==null?void 0:t.disconnect)!=null&&f.find(h=>h.id===g.id))}).map(g=>ps(g,{shouldAddLink:n,mainFieldName:a,targetModel:s})).filter(Boolean)))==null?void 0:u.filter(m=>m.length>0))!=null?d:[]}})};var lg=Object.defineProperty,cg=Object.defineProperties,ug=Object.getOwnPropertyDescriptors,ms=Object.getOwnPropertySymbols,dg=Object.prototype.hasOwnProperty,pg=Object.prototype.propertyIsEnumerable,fs=(e,t,n)=>t in e?lg(e,t,{enumerable:!0,configurable:!0,writable:!0,value:n}):e[t]=n,mg=(e,t)=>{for(var n in t||(t={}))dg.call(t,n)&&fs(e,n,t[n]);if(ms)for(var n of ms(t))pg.call(t,n)&&fs(e,n,t[n]);return e},fg=(e,t)=>cg(e,ug(t));const gg=(e,{mainFieldName:t})=>{var n,a,s;return fg(mg({},e),{data:{pages:(s=[...(a=(n=e==null?void 0:e.data)==null?void 0:n.pages)!=null?a:[]])==null?void 0:s.map(i=>i==null?void 0:i.results.map(l=>ps(l,{mainFieldName:t})))}})};var yg=Object.defineProperty,hg=Object.defineProperties,bg=Object.getOwnPropertyDescriptors,gs=Object.getOwnPropertySymbols,vg=Object.prototype.hasOwnProperty,Eg=Object.prototype.propertyIsEnumerable,ys=(e,t,n)=>t in e?yg(e,t,{enumerable:!0,configurable:!0,writable:!0,value:n}):e[t]=n,hs=(e,t)=>{for(var n in t||(t={}))vg.call(t,n)&&ys(e,n,t[n]);if(gs)for(var n of gs(t))Eg.call(t,n)&&ys(e,n,t[n]);return e},bs=(e,t)=>hg(e,bg(t));const sr=({componentId:e,editable:t,description:n,intlLabel:a,isCreatingEntry:s,isFieldAllowed:i,isFieldReadable:l,labelAction:c,mainField:u,name:d,queryInfos:{endpoints:m,defaultParams:g,shouldDisplayRelationLink:f},placeholder:h,required:b,relationType:v,size:S,targetModel:O})=>{var C,B,T;const{formatMessage:M}=(0,N.useIntl)(),{connectRelation:V,disconnectRelation:A,loadRelation:H,modifiedData:Q,slug:j,initialData:G}=(0,y.useCMEditViewDataManager)(),{relations:U,search:F,searchFor:I}=Bf(`${j}-${d}-${(C=G==null?void 0:G.id)!=null?C:""}`,{relation:{enabled:((B=w()(G,d))==null?void 0:B.count)!==0&&!!m.relation,endpoint:m.relation,pageParams:bs(hs({},g),{pageSize:ls})},search:{endpoint:m.search,pageParams:bs(hs({},g),{entityId:s?void 0:e!=null?e:G.id,pageSize:eg})}}),K=w()(Q,d),$=JSON.stringify(U),Z=(0,r.useMemo)(()=>ig(U,{modifiedData:K,mainFieldName:u.name,shouldAddLink:f,targetModel:O}),[$,Q,d,u.name,f,O]);(0,r.useEffect)(()=>{U.status==="success"&&H({target:{name:d,value:Z.data.pages.flat()}})},[H,U.status,$,d]);const q=(0,r.useMemo)(()=>v.toLowerCase().includes("morph"),[v]),k=["oneWay","oneToOne","manyToOne","oneToManyMorph","oneToOneMorph"].includes(v),R=(0,r.useMemo)(()=>q?!0:s?!t:!i&&l||!t,[q,s,t,i,l]),P=J=>{V({target:{name:d,value:J,replace:k}})},z=J=>{A({target:{name:d,value:J}})},Y=()=>{U.fetchNextPage()},se=J=>{var Pe,Ce;I(J,{idsToInclude:(Pe=K==null?void 0:K.disconnect)==null?void 0:Pe.map(xe=>xe.id),idsToOmit:(Ce=K==null?void 0:K.connect)==null?void 0:Ce.map(xe=>xe.id)})},ae=()=>{var J,Pe;I("",{idsToInclude:(J=K==null?void 0:K.disconnect)==null?void 0:J.map(Ce=>Ce.id),idsToOmit:(Pe=K==null?void 0:K.connect)==null?void 0:Pe.map(Ce=>Ce.id)})},_=()=>{F.fetchNextPage()};return!i&&s||!s&&!i&&!l?r.createElement(y.NotAllowedInput,{intlLabel:a,labelAction:c}):r.createElement(xf,{description:n,disabled:R,id:d,label:`${M({id:a.id,defaultMessage:a.defaultMessage})} ${((T=G[d])==null?void 0:T.count)!==void 0?`(${G[d].count})`:""}`,labelAction:c,labelLoadMore:s?null:M({id:E("relation.loadMore"),defaultMessage:"Load More"}),labelDisconnectRelation:M({id:E("relation.disconnect"),defaultMessage:"Remove"}),listHeight:320,loadingMessage:()=>M({id:E("relation.isLoading"),defaultMessage:"Relations are loading"}),name:d,numberOfRelationsToDisplay:ls,onRelationAdd:J=>P(J),onRelationRemove:J=>z(J),onRelationLoadMore:()=>Y(),onSearch:J=>se(J),onSearchNextPage:()=>_(),onSearchOpen:ae,placeholder:M(h||{id:E("relation.add"),defaultMessage:"Add relation"}),publicationStateTranslations:{[tn.DRAFT]:M({id:E("relation.publicationState.draft"),defaultMessage:"Draft"}),[tn.PUBLISHED]:M({id:E("relation.publicationState.published"),defaultMessage:"Published"})},relations:Z,required:b,searchResults:gg(F,{mainFieldName:u.name}),size:S})};sr.defaultProps={componentId:void 0,editable:!0,description:"",labelAction:null,isFieldAllowed:!0,placeholder:null,required:!1},sr.propTypes={componentId:o().number,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}),required:o().bool,relationType:o().string.isRequired,size:o().number.isRequired,targetModel:o().string.isRequired,queryInfos:o().shape({defaultParams:o().shape({_component:o().string}),endpoints:o().shape({relation:o().string,search:o().string.isRequired}).isRequired,shouldDisplayRelationLink:o().bool.isRequired}).isRequired};const Cg=(0,r.memo)(sr),Og=Wf(Cg,Yf);var Pg=Object.defineProperty,vs=Object.getOwnPropertySymbols,Rg=Object.prototype.hasOwnProperty,Tg=Object.prototype.propertyIsEnumerable,Es=(e,t,n)=>t in e?Pg(e,t,{enumerable:!0,configurable:!0,writable:!0,value:n}):e[t]=n,Cs=(e,t)=>{for(var n in t||(t={}))Rg.call(t,n)&&Es(e,n,t[n]);if(vs)for(var n of vs(t))Tg.call(t,n)&&Es(e,n,t[n]);return e};function Mg(e,t){return n=>{const a=t(n.keys);return r.createElement(e,Cs(Cs({},n),a))}}const wg=Mg,Ig=(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}))],Dg=(e="")=>{switch((0,X.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"}},Sg=e=>{let t;return e==="float"||e==="decimal"?t=.01:t=1,t};function Lg(e){const{createActionAllowedFields:t,formErrors:n,isCreatingEntry:a,modifiedData:s,onChange:i,readActionAllowedFields:l,shouldNotRunValidations:c,updateActionAllowedFields:u}=(0,y.useCMEditViewDataManager)(),d=(0,r.useMemo)(()=>a?t:u,[a,t,u]),m=(0,r.useMemo)(()=>a?[]:l,[a,l]),g=(0,X.get)(s,e,null);return{allowedFields:d,formErrors:n,isCreatingEntry:a,onChange:i,readableFields:m,shouldNotRunValidations:c,value:g}}const xg=Lg,Os=["type","model","via","collection","default","plugin","enum","regex","pluginOptions"];var Fg=Object.defineProperty,kg=Object.defineProperties,Ag=Object.getOwnPropertyDescriptors,Ps=Object.getOwnPropertySymbols,jg=Object.prototype.hasOwnProperty,$g=Object.prototype.propertyIsEnumerable,Rs=(e,t,n)=>t in e?Fg(e,t,{enumerable:!0,configurable:!0,writable:!0,value:n}):e[t]=n,ir=(e,t)=>{for(var n in t||(t={}))jg.call(t,n)&&Rs(e,n,t[n]);if(Ps)for(var n of Ps(t))$g.call(t,n)&&Rs(e,n,t[n]);return e},Bg=(e,t)=>kg(e,Ag(t));function lr({allowedFields:e,componentUid:t,fieldSchema:n,formErrors:a,isCreatingEntry:s,keys:i,labelAction:l,metadatas:c,onChange:u,readableFields:d,shouldNotRunValidations:m,queryInfos:g,value:f,size:h}){const{fields:b}=(0,y.useLibrary)(),{formatMessage:v}=(0,N.useIntl)(),{contentType:S}=ut(),O=(0,y.useCustomFields)(),C=(0,r.useMemo)(()=>!w()(c,"editable",!0),[c]),{type:B,customField:T}=n,M=w()(a,[i],null),V=(0,r.useMemo)(()=>Po(i),[i]),A=(0,r.useMemo)(()=>{const ae=$d()(n,m?[...Os,"required","minLength"]:Os),_=n.regex||null;if(_){const J=new RegExp(_);J&&(ae.regex=J)}return ae},[n,m]),H=(0,r.useMemo)(()=>w()(A,["required"],!1),[A]),Q=(0,r.useMemo)(()=>{const ae=w()(S,["attributes"],{});return w()(ae,[V[0],"type"],null)==="dynamiczone"},[S,V]),j=(0,r.useMemo)(()=>Dg(B),[B]),G=(0,r.useMemo)(()=>B==="media"&&!f?[]:f,[B,f]),U=(0,r.useMemo)(()=>Sg(B),[B]),F=(0,r.useMemo)(()=>{const ae=V.join(".");if(e.includes(ae))return!0;if(Q)return e.includes(V[0]);if(V.length>1){const J=Bn()(V,V.length-1).join(".");return e.includes(J)}return!1},[e,V,Q]),I=(0,r.useMemo)(()=>{const ae=V.join(".");if(d.includes(ae))return!0;if(Q)return d.includes(V[0]);if(V.length>1){const J=Bn()(V,V.length-1).join(".");return d.includes(J)}return!1},[d,V,Q]),K=(0,r.useMemo)(()=>I||F,[F,I]),$=(0,r.useMemo)(()=>s?C:I&&!F?!0:C,[C,s,F,I]),Z=(0,r.useMemo)(()=>Ig(n.enum||[],H),[n,H]),{label:q,description:k,placeholder:R,visible:P}=c,z=(0,r.useMemo)(()=>{if(!c.step||j!=="datetime"&&j!=="time")return U;if(!G)return c.step;let ae;return j==="datetime"?ae=parseInt(G.substr(14,2),10):j==="time"&&(ae=parseInt(G.slice(-2),10)),ae%c.step===0?c.step:U},[j,G,c.step,U]),Y=(0,r.useMemo)(()=>{if(T){const ae=O.get(T);return r.lazy(ae.components.Input)}return null},[T,O]);if(P===!1)return null;if(!K)return r.createElement(y.NotAllowedInput,{description:k?{id:k,defaultMessage:k}:null,intlLabel:{id:q,defaultMessage:q},labelAction:l,error:M&&v(M),name:i,required:H});if(B==="relation")return r.createElement(Og,Bg(ir(ir({},c),n),{componentUid:t,description:c.description?v({id:c.description,defaultMessage:c.description}):void 0,intlLabel:{id:c.label,defaultMessage:c.label},labelAction:l,isUserAllowedToEditField:F,isUserAllowedToReadField:I,name:i,placeholder:c.placeholder?{id:c.placeholder,defaultMessage:c.placeholder}:null,queryInfos:g,size:h,value:f,error:M&&v(M)}));const se=ir({json:Nm,uid:ef,media:b.media,wysiwyg:Cm},b);return T&&(se[T]=Y),r.createElement(y.GenericInput,{attribute:n,autoComplete:"new-password",intlLabel:{id:q,defaultMessage:q},isNullable:j==="bool"&&[null,void 0].includes(n.default),description:k?{id:k,defaultMessage:k}:null,disabled:$,error:M,labelAction:l,contentTypeUID:S.uid,customInputs:se,multiple:n.multiple||!1,name:i,onChange:u,options:Z,placeholder:R?{id:R,defaultMessage:R}:null,required:n.required||!1,step:z,type:T||j,value:G,withDefaultValue:!1})}lr.defaultProps={componentUid:void 0,formErrors:{},labelAction:void 0,size:void 0,value:null,queryInfos:{}},lr.propTypes={allowedFields:o().array.isRequired,componentUid:o().string,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,size:o().number,shouldNotRunValidations:o().bool.isRequired,value:o().any,queryInfos:o().shape({containsKey:o().string,defaultParams:o().object,endPoint:o().string})};const Ng=(0,r.memo)(lr,Ue()),cr=wg(Ng,xg),ur=({componentUid:e,isFromDynamicZone:t,isNested:n,name:a})=>{const{getComponentLayout:s}=ut(),l=(0,r.useMemo)(()=>s(e),[e,s]).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(ue.Stack,{spacing:6},l.map((c,u)=>r.createElement(de.Grid,{gap:4,key:u},c.map(({name:d,size:m,metadatas:g,fieldSchema:f,queryInfos:h})=>{const b=f.type==="component",v=`${a}.${d}`;if(b){const S=f.component;return r.createElement(de.GridItem,{col:m,s:12,xs:12,key:d},r.createElement(nn,{componentUid:S,intlLabel:{id:g.label,defaultMessage:g.label},isNested:!0,isRepeatable:f.repeatable,max:f.max,min:f.min,name:v,required:f.required||!1}))}return r.createElement(de.GridItem,{col:m,key:d,s:12,xs:12},r.createElement(cr,{componentUid:e,keys:v,fieldSchema:f,metadatas:g,queryInfos:h,size:m}))})))))};ur.defaultProps={isFromDynamicZone:!1,isNested:!1},ur.propTypes={componentUid:o().string.isRequired,isFromDynamicZone:o().bool,isNested:o().bool,name:o().string.isRequired};const Vg=ur;var qg=p(59290),Tt=p.n(qg),zg=Object.defineProperty,Ts=Object.getOwnPropertySymbols,Wg=Object.prototype.hasOwnProperty,Ug=Object.prototype.propertyIsEnumerable,Ms=(e,t,n)=>t in e?zg(e,t,{enumerable:!0,configurable:!0,writable:!0,value:n}):e[t]=n,ws=(e,t)=>{for(var n in t||(t={}))Wg.call(t,n)&&Ms(e,n,t[n]);if(Ts)for(var n of Ts(t))Ug.call(t,n)&&Ms(e,n,t[n]);return e};function _g(e,t){return n=>{const a=t(n);return r.createElement(e,ws(ws({},n),a))}}const Hg=_g;function Gg(){const{addRepeatableComponentToField:e,formErrors:t}=(0,y.useCMEditViewDataManager)();return{addRepeatableComponentToField:e,formErrors:t}}const Zg=Gg;function Qg(e,t){return Object.keys(t).filter(n=>n.startsWith(e)).map(n=>n.split(".").slice(0,e.split(".").length+1).join("."))}var dr=p(51968),Jg=p(41119),Is=p.n(Jg);const Kg=L.default.span`
|
|
827
|
+
display: block;
|
|
828
|
+
background-color: ${({theme:e})=>e.colors.primary100};
|
|
829
|
+
outline: 1px dashed ${({theme:e})=>e.colors.primary500};
|
|
830
|
+
outline-offset: -1px;
|
|
831
|
+
padding: ${({theme:e})=>e.spaces[6]};
|
|
832
|
+
`,Yg=()=>r.createElement(Kg,{padding:6,background:"primary100"}),Xg=(0,L.default)(Te.IconButton)`
|
|
833
|
+
background-color: transparent;
|
|
834
|
+
|
|
835
|
+
svg {
|
|
836
|
+
path {
|
|
837
|
+
fill: ${({theme:e,expanded:t})=>t?e.colors.primary600:e.colors.neutral600};
|
|
838
|
+
}
|
|
839
|
+
}
|
|
840
|
+
|
|
841
|
+
&:hover {
|
|
842
|
+
svg {
|
|
843
|
+
path {
|
|
844
|
+
fill: ${({theme:e})=>e.colors.primary600};
|
|
845
|
+
}
|
|
846
|
+
}
|
|
847
|
+
}
|
|
848
|
+
`,Ds=(0,L.default)(Te.IconButton)`
|
|
849
|
+
background-color: transparent;
|
|
850
|
+
|
|
851
|
+
svg {
|
|
852
|
+
path {
|
|
853
|
+
fill: ${({theme:e,expanded:t})=>t?e.colors.primary600:e.colors.neutral600};
|
|
854
|
+
}
|
|
855
|
+
}
|
|
856
|
+
`,ey=L.default.span`
|
|
857
|
+
display: flex;
|
|
858
|
+
justify-content: space-between;
|
|
859
|
+
padding-left: ${({theme:e})=>e.spaces[4]};
|
|
860
|
+
padding-right: ${({theme:e})=>e.spaces[4]};
|
|
861
|
+
background-color: ${({theme:e})=>e.colors.neutral0};
|
|
862
|
+
height: ${50/16}rem;
|
|
863
|
+
`,ty=(0,L.default)(tr.TextButton)`
|
|
864
|
+
text-align: left;
|
|
865
|
+
|
|
866
|
+
svg {
|
|
867
|
+
width: ${14/16}rem;
|
|
868
|
+
height: ${14/16}rem;
|
|
869
|
+
|
|
870
|
+
path {
|
|
871
|
+
fill: ${({theme:e,expanded:t})=>t?e.colors.primary600:e.colors.neutral500};
|
|
872
|
+
}
|
|
873
|
+
}
|
|
874
|
+
`,Ss=({displayedValue:e})=>r.createElement(ey,null,r.createElement(ue.Stack,{horizontal:!0,spacing:3,flex:1},r.createElement(W.Flex,{justifyContent:"center",borderRadius:"50%",height:`${24/16}rem}`,width:`${24/16}rem}`,"aria-hidden":!0,as:"span",background:"neutral200"},r.createElement(Ba.Icon,{as:ao(),width:`${8/16}rem}`,color:"neutral600"})),r.createElement(ty,{onClick:()=>{},flex:1},r.createElement(x.Typography,{fontWeight:"bold",textColor:"neutral700"},e))),r.createElement(ue.Stack,{horizontal:!0,spacing:0},r.createElement(Ds,{noBorder:!0,onClick:()=>{},icon:r.createElement(Ne(),null)}),r.createElement(Ds,{icon:r.createElement(lt(),null),noBorder:!0})));Ss.propTypes={displayedValue:o().string.isRequired};const ny=Ss;var ry=Object.defineProperty,Ls=Object.getOwnPropertySymbols,oy=Object.prototype.hasOwnProperty,ay=Object.prototype.propertyIsEnumerable,xs=(e,t,n)=>t in e?ry(e,t,{enumerable:!0,configurable:!0,writable:!0,value:n}):e[t]=n,Fs=(e,t)=>{for(var n in t||(t={}))oy.call(t,n)&&xs(e,n,t[n]);if(Ls)for(var n of Ls(t))ay.call(t,n)&&xs(e,n,t[n]);return e};function sy(e,t){return n=>{const a=t(n);return r.createElement(e,Fs(Fs({},n),a))}}const iy=sy;function ly({schema:e,componentFieldName:t}){const{checkFormErrors:n,modifiedData:a,moveComponentField:s,removeRepeatableField:i,triggerFormValidation:l}=(0,y.useCMEditViewDataManager)(),c=(0,r.useMemo)(()=>(0,X.get)(e,["settings","mainField"],"id"),[e]);return{displayedValue:(0,X.toString)((0,X.get)(a,[...t.split("."),c],"")),mainField:c,checkFormErrors:n,moveComponentField:s,removeRepeatableField:i,schema:e,triggerFormValidation:l}}const cy=ly,uy=L.default.span`
|
|
875
|
+
display: flex;
|
|
876
|
+
align-items: center;
|
|
877
|
+
height: ${({theme:e})=>e.spaces[7]};
|
|
878
|
+
|
|
879
|
+
padding: 0 ${({theme:e})=>e.spaces[3]};
|
|
880
|
+
cursor: all-scroll;
|
|
881
|
+
|
|
882
|
+
svg {
|
|
883
|
+
width: ${12/16}rem;
|
|
884
|
+
height: ${12/16}rem;
|
|
885
|
+
}
|
|
886
|
+
`,pr=({componentFieldName:e,componentUid:t,hasErrorMessage:n,hasErrors:a,isDraggingSibling:s,isOpen:i,isReadOnly:l,onClickToggle:c,schema:u,toggleCollapses:d,moveComponentField:m,removeRepeatableField:g,setIsDraggingSibling:f,triggerFormValidation:h,displayedValue:b})=>{const v=(0,r.useRef)(null),S=(0,r.useRef)(null),[,O]=(0,r.useState)(!1),{formatMessage:C}=(0,N.useIntl)(),B=u.layouts.edit,[,T]=(0,Le.useDrop)({accept:Re.COMPONENT,canDrop(){return!1},hover(G,U){if(!S.current)return;const F=G.originalPath,I=e,K=F.split("."),$=K.slice().splice(-1).join(""),Z=I.split(".").splice(-1).join(""),q=K.slice(0,K.length-1),k=parseInt($,10),R=parseInt(Z,10);if(k===R)return;const P=S.current.getBoundingClientRect(),z=(P.bottom-P.top)/2,se=U.getClientOffset().y-P.top;k<R&&se<z||k>R&&se>z||F.split(".").length===I.split(".").length&&(m(q,k,R),G.originalPath=I)}}),[{isDragging:M},V,A]=(0,Le.useDrag)({type:Re.COMPONENT,item(){return d(-1),{displayedValue:b,originalPath:e}},end(){h(),f(!1)},collect:G=>({isDragging:G.isDragging()})});(0,r.useEffect)(()=>{A((0,dr.rX)(),{captureDraggingState:!1})},[A]),(0,r.useEffect)(()=>{M&&f(!0)},[M,f]),(0,r.useEffect)(()=>{s||O(G=>!G)},[s]);const H={dragRef:V(v),dropRef:T(S)},Q=Is()(b),j=a?"error":void 0;return r.createElement(D.Box,{ref:H?H.dropRef:null},M&&r.createElement(Yg,null),!M&&s&&r.createElement(ny,{displayedValue:Q,componentFieldName:e}),!M&&!s&&r.createElement(_e.Accordion,{error:j,hasErrorMessage:n,expanded:i,onToggle:c,id:e,size:"S"},r.createElement(_e.AccordionToggle,{action:l?null:r.createElement(ue.Stack,{horizontal:!0,spacing:0},r.createElement(Xg,{expanded:i,noBorder:!0,onClick:()=>{g(e),d()},label:C({id:E("containers.Edit.delete"),defaultMessage:"Delete"}),icon:r.createElement(Ne(),null)}),r.createElement(Qt.Tooltip,{description:C({id:E("components.DragHandle-label"),defaultMessage:"Drag"})},r.createElement(uy,{role:"button",tabIndex:-1,ref:H.dragRef,onClick:G=>G.stopPropagation()},r.createElement(lt(),null)))),title:Q,togglePosition:"left"}),r.createElement(_e.AccordionContent,null,r.createElement(ue.Stack,{background:"neutral100",padding:6,spacing:6},B.map((G,U)=>r.createElement(de.Grid,{gap:4,key:U},G.map(({name:F,fieldSchema:I,metadatas:K,queryInfos:$,size:Z})=>{const q=I.type==="component",k=`${e}.${F}`;if(q){const R=I.component;return r.createElement(de.GridItem,{col:Z,s:12,xs:12,key:F},r.createElement(nn,{componentUid:R,intlLabel:{id:K.label,defaultMessage:K.label},isRepeatable:I.repeatable,isNested:!0,name:k,max:I.max,min:I.min,required:I.required}))}return r.createElement(de.GridItem,{key:k,col:Z,s:12,xs:12},r.createElement(cr,{componentUid:t,fieldSchema:I,keys:k,metadatas:K,queryInfos:$,size:Z}))})))))))};pr.defaultProps={componentUid:void 0,isDraggingSibling:!1,isOpen:!1,setIsDraggingSibling(){},toggleCollapses(){}},pr.propTypes={componentFieldName:o().string.isRequired,componentUid:o().string,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 dy=(0,r.memo)(pr),py=iy(dy,cy);var ks=p(87910),my=Object.defineProperty,As=Object.getOwnPropertySymbols,fy=Object.prototype.hasOwnProperty,gy=Object.prototype.propertyIsEnumerable,js=(e,t,n)=>t in e?my(e,t,{enumerable:!0,configurable:!0,writable:!0,value:n}):e[t]=n,yy=(e,t)=>{for(var n in t||(t={}))fy.call(t,n)&&js(e,n,t[n]);if(As)for(var n of As(t))gy.call(t,n)&&js(e,n,t[n]);return e};const hy=(0,L.default)(D.Box)`
|
|
887
|
+
overflow: hidden;
|
|
888
|
+
border-bottom: 1px solid ${({theme:e})=>e.colors.neutral200};
|
|
889
|
+
border-right: 1px solid ${({theme:e})=>e.colors.neutral200};
|
|
890
|
+
border-left: 1px solid ${({theme:e})=>e.colors.neutral200};
|
|
891
|
+
border-radius: 0 0 ${({theme:e})=>e.borderRadius} ${({theme:e})=>e.borderRadius};
|
|
892
|
+
`,by=(0,L.default)(D.Box)`
|
|
893
|
+
> div {
|
|
894
|
+
& > * {
|
|
895
|
+
border-radius: unset;
|
|
896
|
+
border-right: 1px solid ${({theme:e})=>e.colors.neutral200};
|
|
897
|
+
border-left: 1px solid ${({theme:e})=>e.colors.neutral200};
|
|
898
|
+
border-bottom: 1px solid ${({theme:e})=>e.colors.neutral200};
|
|
899
|
+
}
|
|
900
|
+
> div {
|
|
901
|
+
> div:first-of-type {
|
|
902
|
+
border-radius: unset;
|
|
903
|
+
}
|
|
904
|
+
}
|
|
905
|
+
}
|
|
906
|
+
|
|
907
|
+
> div:first-of-type {
|
|
908
|
+
> div {
|
|
909
|
+
border-radius: ${({theme:e})=>e.borderRadius} ${({theme:e})=>e.borderRadius} 0 0;
|
|
910
|
+
> div:first-of-type {
|
|
911
|
+
border-radius: ${({theme:e})=>e.borderRadius} ${({theme:e})=>e.borderRadius} 0 0;
|
|
912
|
+
}
|
|
913
|
+
}
|
|
914
|
+
|
|
915
|
+
> div:not([data-strapi-expanded='true']) {
|
|
916
|
+
border-top: 1px solid ${({theme:e})=>e.colors.neutral200};
|
|
917
|
+
|
|
918
|
+
&:hover {
|
|
919
|
+
border-top: 1px solid ${({theme:e})=>e.colors.primary600};
|
|
920
|
+
}
|
|
921
|
+
}
|
|
922
|
+
|
|
923
|
+
> span {
|
|
924
|
+
border-radius: ${({theme:e})=>e.borderRadius} ${({theme:e})=>e.borderRadius} 0 0;
|
|
925
|
+
border-top: 1px solid ${({theme:e})=>e.colors.neutral200};
|
|
926
|
+
}
|
|
927
|
+
}
|
|
928
|
+
|
|
929
|
+
& [data-strapi-expanded='true'] {
|
|
930
|
+
border: 1px solid ${({theme:e})=>e.colors.primary600};
|
|
931
|
+
}
|
|
932
|
+
|
|
933
|
+
${({theme:e,footer:t})=>`
|
|
934
|
+
&:not(${t}) {
|
|
935
|
+
& > *:last-of-type {
|
|
936
|
+
border-radius: 0 0 ${e.borderRadius} ${e.borderRadius};
|
|
937
|
+
}
|
|
938
|
+
}
|
|
939
|
+
`}
|
|
940
|
+
`,vy=(0,L.default)(D.Box)`
|
|
941
|
+
svg path {
|
|
942
|
+
fill: ${({theme:e})=>e.colors.neutral500};
|
|
943
|
+
}
|
|
944
|
+
`,mr=({children:e,footer:t,label:n,labelAction:a,error:s})=>{const{formatMessage:i}=(0,N.useIntl)(),l=r.Children.toArray(e).map(c=>(0,r.cloneElement)(c,{hasErrorMessage:!1}));return r.createElement(ks.KeyboardNavigable,{attributeName:"data-strapi-accordion-toggle"},n&&r.createElement(W.Flex,{paddingBottom:1},r.createElement(x.Typography,{as:"label",textColor:"neutral800",variant:"pi",fontWeight:"bold"},n),a&&r.createElement(vy,{paddingLeft:1},a)),r.createElement(by,{footer:t},l),t&&r.createElement(hy,null,t),s&&r.createElement(D.Box,{paddingTop:1},r.createElement(x.Typography,{variant:"pi",textColor:"danger600"},i({id:s.id,defaultMessage:s.id},yy({},s.values)))))};mr.defaultProps={error:void 0,footer:null,label:null,labelAction:void 0},mr.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 Ey=mr,Cy=(0,L.default)(tr.TextButton)`
|
|
945
|
+
height: 100%;
|
|
946
|
+
width: 100%;
|
|
947
|
+
border-radius: 0 0 4px 4px;
|
|
948
|
+
display: flex;
|
|
949
|
+
justify-content: center;
|
|
950
|
+
span {
|
|
951
|
+
font-weight: 600;
|
|
952
|
+
font-size: 14px;
|
|
953
|
+
}
|
|
954
|
+
`,fr=({addRepeatableComponentToField:e,formErrors:t,componentUid:n,componentValue:a,componentValueLength:s,isReadOnly:i,max:l,min:c,name:u})=>{const d=(0,y.useNotification)(),{formatMessage:m}=(0,N.useIntl)(),[g,f]=(0,r.useState)(""),[h,b]=(0,r.useState)(!1),[,v]=(0,Le.useDrop)({accept:Re.COMPONENT}),{getComponentLayout:S}=ut(),O=(0,r.useMemo)(()=>S(n),[n,S]),C=(0,r.useMemo)(()=>Ro(a||[])+1,[a]),B=Qg(u,t),T=()=>{f("")},M=c-s,V=w()(t,u,{id:""}).id.includes("min"),A=(0,r.useCallback)(()=>{i||(s<l?(e(u,n,V),f(C)):s>=l&&d({type:"info",message:{id:E("components.notification.info.maximum-requirement")}}))},[e,n,s,V,i,l,u,C,d]);let H=t[u];return V&&(H={id:E("components.DynamicZone.missing-components"),defaultMessage:"There {number, plural, =0 {are # missing components} one {is # missing component} other {are # missing components}}",values:{number:M}}),s===0?r.createElement(ua,{error:H,isReadOnly:i,onClick:A}):(B.some(j=>j.split(".").length>1)&&!V&&(H={id:E("components.RepeatableComponent.error-message"),defaultMessage:"The component(s) contain error(s)"}),r.createElement(D.Box,{hasRadius:!0,ref:v},r.createElement(Ey,{error:H,footer:r.createElement(W.Flex,{justifyContent:"center",height:"48px",background:"neutral0"},r.createElement(Cy,{disabled:i,onClick:A,startIcon:r.createElement(Tt(),null)},m({id:E("containers.EditView.add.new-entry"),defaultMessage:"Add an entry"})))},a.map((j,G)=>{const U=j.__temp_key__,F=g===U,I=`${u}.${G}`,K=B.includes(I);return r.createElement(py,{componentFieldName:I,componentUid:n,hasErrors:K,hasMinError:V,isDraggingSibling:h,isOpen:F,isReadOnly:i,key:U,onClickToggle:()=>{f(F?"":U)},parentName:u,schema:O,setIsDraggingSibling:b,toggleCollapses:T})}))))};fr.defaultProps={componentValue:null,componentValueLength:0,formErrors:{},max:1/0,min:0},fr.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 Oy=(0,r.memo)(fr),Py=Hg(Oy,Zg);var Ry=Object.defineProperty,$s=Object.getOwnPropertySymbols,Ty=Object.prototype.hasOwnProperty,My=Object.prototype.propertyIsEnumerable,Bs=(e,t,n)=>t in e?Ry(e,t,{enumerable:!0,configurable:!0,writable:!0,value:n}):e[t]=n,Ns=(e,t)=>{for(var n in t||(t={}))Ty.call(t,n)&&Bs(e,n,t[n]);if($s)for(var n of $s(t))My.call(t,n)&&Bs(e,n,t[n]);return e};function wy(e,t){return n=>{const a=t(n);return r.createElement(e,Ns(Ns({},n),a))}}const Iy=wy;function Dy({isFromDynamicZone:e,name:t}){const{addNonRepeatableComponentToField:n,createActionAllowedFields:a,isCreatingEntry:s,modifiedData:i,removeComponentFromField:l,readActionAllowedFields:c,updateActionAllowedFields:u,formErrors:d}=(0,y.useCMEditViewDataManager)(),{contentType:m}=ut(),g=(0,r.useMemo)(()=>{const C=(0,X.get)(m,["attributes"],{});return Object.keys(C).filter(T=>(0,X.get)(C,[T,"type"],"")==="dynamiczone")},[m]),f=(0,r.useMemo)(()=>s?a:u,[s,a,u]),h=(0,X.get)(i,t,null),b=(0,r.useMemo)(()=>Po(t),[t]),v=(0,r.useMemo)(()=>e&&s||f.filter(T=>T===b[0]).length>0?!0:f.map(T=>T.split(".")).filter(T=>T.length<b.length?!1:(0,X.take)(T,b.length).join(".")===b.join(".")).length>0,[e,s,f,b]),S=(0,r.useMemo)(()=>e||g.includes(b[0])?!0:(s?[]:c).map(T=>T.split(".")).filter(T=>T.length<b.length?!1:(0,X.take)(T,b.length).join(".")===b.join(".")).length>0,[e,g,b,s,c]),O=(0,r.useMemo)(()=>s||v?!1:S,[v,S,s]);return{addNonRepeatableComponentToField:n,formErrors:d,hasChildrenAllowedFields:v,hasChildrenReadableFields:S,isCreatingEntry:s,isReadOnly:O,removeComponentFromField:l,componentValue:h}}const Sy=Dy,Ly=(0,L.default)(D.Box)`
|
|
955
|
+
svg path {
|
|
956
|
+
fill: ${({theme:e})=>e.colors.neutral500};
|
|
957
|
+
}
|
|
958
|
+
`,gr=({intlLabel:e,id:t,labelAction:n,name:a,numberOfEntries:s,showNumberOfEntries:i,required:l})=>{const{formatMessage:c}=(0,N.useIntl)(),u=e!=null&&e.id?c(e):a;return r.createElement(D.Box,{paddingBottom:1},r.createElement(W.Flex,null,r.createElement(x.Typography,{textColor:"neutral800",htmlFor:t||a,variant:"pi",fontWeight:"bold",as:"label"},u,i&&r.createElement(r.Fragment,null,"\xA0(",s,")"),l&&r.createElement(x.Typography,{textColor:"danger600"},"*")),n&&r.createElement(Ly,{paddingLeft:1},n)))};gr.defaultProps={id:void 0,labelAction:void 0,numberOfEntries:0,required:!1,showNumberOfEntries:!1},gr.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 xy=gr,yr=({addNonRepeatableComponentToField:e,componentUid:t,intlLabel:n,isCreatingEntry:a,isFromDynamicZone:s,isRepeatable:i,isNested:l,labelAction:c,max:u,min:d,name:m,hasChildrenAllowedFields:g,hasChildrenReadableFields:f,isReadOnly:h,componentValue:b,removeComponentFromField:v,required:S})=>{const{formatMessage:O}=(0,N.useIntl)(),C=Sd()(b),B=b!==null||s,T=!i&&B&&!s&&g;if(!g&&a)return r.createElement(y.NotAllowedInput,{labelAction:c,intlLabel:n,name:m});if(!g&&!a&&!f)return r.createElement(y.NotAllowedInput,{labelAction:c,intlLabel:n,name:m});const M=()=>{e(m,t)};return r.createElement(D.Box,null,r.createElement(W.Flex,{justifyContent:"space-between"},n&&r.createElement(xy,{intlLabel:n,labelAction:c,name:m,numberOfEntries:C,showNumberOfEntries:i,required:S}),T&&r.createElement(Te.IconButton,{label:O({id:E("components.reset-entry"),defaultMessage:"Reset Entry"}),icon:r.createElement(Ne(),null),noBorder:!0,onClick:()=>{v(m,t)}})),r.createElement(ue.Stack,{spacing:1},!i&&!B&&r.createElement(ua,{isReadOnly:h,onClick:M}),!i&&B&&r.createElement(Vg,{componentUid:t,isFromDynamicZone:s,isNested:l,name:m}),i&&r.createElement(Py,{componentValue:b,componentValueLength:C,componentUid:t,isReadOnly:h,max:u,min:d,name:m})))};yr.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},yr.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 Fy=(0,r.memo)(yr,Ue()),nn=Iy(Fy,Sy),ky=(0,L.default)(D.Box)`
|
|
959
|
+
width: ${({theme:e})=>e.spaces[2]};
|
|
960
|
+
height: ${({theme:e})=>e.spaces[4]};
|
|
961
|
+
`,Ay=()=>r.createElement(W.Flex,{justifyContent:"center"},r.createElement(ky,{background:"neutral200"})),jy=(0,L.default)(ue.Stack)`
|
|
962
|
+
svg {
|
|
963
|
+
path {
|
|
964
|
+
fill: ${({theme:e,expanded:t})=>t?e.colors.primary600:e.colors.neutral600};
|
|
965
|
+
}
|
|
966
|
+
}
|
|
967
|
+
`,hr=(0,L.default)(Te.IconButton)`
|
|
968
|
+
background-color: transparent;
|
|
969
|
+
`,$y=(0,L.default)(D.Box)`
|
|
970
|
+
> div:first-child {
|
|
971
|
+
box-shadow: ${({theme:e})=>e.shadows.tableShadow};
|
|
972
|
+
}
|
|
973
|
+
`,By=(0,L.default)(D.Box)`
|
|
974
|
+
border-radius: 0 0 ${({theme:e})=>e.spaces[1]} ${({theme:e})=>e.spaces[1]};
|
|
975
|
+
`,Vs=({componentUid:e,formErrors:t,index:n,isOpen:a,isFieldAllowed:s,moveComponentDown:i,moveComponentUp:l,name:c,onToggle:u,removeComponentFromDynamicZone:d,showDownIcon:m,showUpIcon:g})=>{const{formatMessage:f}=(0,N.useIntl)(),{getComponentLayout:h}=ut(),{icon:b,friendlyName:v}=(0,r.useMemo)(()=>{const{info:{icon:Q,displayName:j}}=h(e);return{friendlyName:j,icon:Q}},[e,h]),S=()=>i(c,n),O=()=>l(c,n),C=()=>d(c,n),B=f({id:E("components.DynamicZone.move-down-label"),defaultMessage:"Move component down"}),T=f({id:E("components.DynamicZone.move-up-label"),defaultMessage:"Move component down"}),M=f({id:E("components.DynamicZone.delete-label"),defaultMessage:"Delete {name}"},{name:v}),A=Object.keys(t).filter(Q=>{const j=Q.split(".");return`${j[0]}.${j[1]}`==`${c}.${n}`});let H;return A.length>0&&(H=f({id:E("components.DynamicZone.error-message"),defaultMessage:"The component contains error(s)"})),r.createElement(D.Box,null,r.createElement(Ay,null),r.createElement($y,{hasRadius:!0},r.createElement(_e.Accordion,{expanded:a,onToggle:()=>u(n),size:"S",error:H},r.createElement(_e.AccordionToggle,{startIcon:r.createElement(An.G,{icon:b}),action:r.createElement(jy,{horizontal:!0,spacing:0,expanded:a},m&&r.createElement(hr,{noBorder:!0,label:B,onClick:S,icon:r.createElement(Md(),null)}),g&&r.createElement(hr,{noBorder:!0,label:T,onClick:O,icon:r.createElement(Id(),null)}),s&&r.createElement(hr,{noBorder:!0,label:M,onClick:C,icon:r.createElement(Ne(),null)})),title:v,togglePosition:"left"}),r.createElement(_e.AccordionContent,null,r.createElement(By,{background:"neutral0"},r.createElement(r.Suspense,{fallback:r.createElement(W.Flex,{justifyContent:"center",paddingTop:4,paddingBottom:4},r.createElement(ia.Loader,null,"Loading content."))},r.createElement(jn.FocusTrap,{onEscape:()=>u(n)},r.createElement(nn,{componentUid:e,icon:b,name:`${c}.${n}`,isFromDynamicZone:!0}))))))))};Vs.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 Ny=(0,r.memo)(Vs,Ue());var Vy=p(81346),qy=p.n(Vy);const qs=(0,L.default)(An.G)`
|
|
976
|
+
width: ${(0,y.pxToRem)(32)} !important;
|
|
977
|
+
height: ${(0,y.pxToRem)(32)} !important;
|
|
978
|
+
padding: ${(0,y.pxToRem)(9)};
|
|
979
|
+
border-radius: ${(0,y.pxToRem)(64)};
|
|
980
|
+
background: ${({theme:e})=>e.colors.neutral150};
|
|
981
|
+
path {
|
|
982
|
+
fill: ${({theme:e})=>e.colors.neutral500};
|
|
983
|
+
}
|
|
984
|
+
`,zy=(0,L.default)(D.Box)`
|
|
985
|
+
flex-shrink: 0;
|
|
986
|
+
height: ${(0,y.pxToRem)(84)};
|
|
987
|
+
border: 1px solid ${({theme:e})=>e.colors.neutral200};
|
|
988
|
+
background: ${({theme:e})=>e.colors.neutral100};
|
|
989
|
+
border-radius: ${({theme:e})=>e.borderRadius};
|
|
990
|
+
display: flex;
|
|
991
|
+
justify-content: center;
|
|
992
|
+
align-items: center;
|
|
993
|
+
|
|
994
|
+
&.active,
|
|
995
|
+
&:hover {
|
|
996
|
+
border: 1px solid ${({theme:e})=>e.colors.primary200};
|
|
997
|
+
background: ${({theme:e})=>e.colors.primary100};
|
|
998
|
+
|
|
999
|
+
${qs} {
|
|
1000
|
+
background: ${({theme:e})=>e.colors.primary200};
|
|
1001
|
+
path {
|
|
1002
|
+
fill: ${({theme:e})=>e.colors.primary600};
|
|
1003
|
+
}
|
|
1004
|
+
}
|
|
1005
|
+
|
|
1006
|
+
${x.Typography} {
|
|
1007
|
+
color: ${({theme:e})=>e.colors.primary600};
|
|
1008
|
+
}
|
|
1009
|
+
}
|
|
1010
|
+
`;function br({componentUid:e,intlLabel:t,icon:n,onClick:a}){const{formatMessage:s}=(0,N.useIntl)(),i=()=>{a(e)};return r.createElement("button",{type:"button",onClick:i},r.createElement(zy,{borderRadius:"borderRadius"},r.createElement(ue.Stack,{spacing:1,style:{justifyContent:"center",alignItems:"center"}},r.createElement(qs,{icon:n}),r.createElement(x.Typography,{variant:"pi",fontWeight:"bold",textColor:"neutral600"},s(t)))))}br.defaultProps={icon:"dice-d6",onClick(){}},br.propTypes={componentUid:o().string.isRequired,intlLabel:o().shape({id:o().string.isRequired,defaultMessage:o().string.isRequired}).isRequired,icon:o().string,onClick:o().func};const Wy=br,Uy=L.default.div`
|
|
1011
|
+
display: grid;
|
|
1012
|
+
grid-template-columns: repeat(auto-fit, ${140/16}rem);
|
|
1013
|
+
grid-gap: ${({theme:e})=>e.spaces[1]};
|
|
1014
|
+
`,zs=({category:e,components:t,isOdd:n,isOpen:a,onAddComponent:s,onToggle:i})=>{const{formatMessage:l}=(0,N.useIntl)(),c=()=>{i(e)};return r.createElement(_e.Accordion,{expanded:a,onToggle:c,size:"S"},r.createElement(_e.AccordionToggle,{variant:n?"primary":"secondary",title:l({id:e,defaultMessage:e}),togglePosition:"left"}),r.createElement(_e.AccordionContent,null,r.createElement(D.Box,{paddingTop:4,paddingBottom:4,paddingLeft:3,paddingRight:3},r.createElement(Uy,null,t.map(({componentUid:u,info:{displayName:d,icon:m}})=>r.createElement(Wy,{key:u,componentUid:u,intlLabel:{id:d,defaultMessage:d},icon:m,onClick:s}))))))};zs.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 _y=zs,Ws=({components:e,isOpen:t,onClickAddComponent:n})=>{const{formatMessage:a}=(0,N.useIntl)(),{getComponentLayout:s}=ut(),[i,l]=(0,r.useState)(""),c=(0,r.useMemo)(()=>{const m=e.map(f=>{const{category:h,info:b}=s(f);return{componentUid:f,category:h,info:b}}),g=qy()(m,"category");return Object.keys(g).reduce((f,h)=>(f.push({category:h,components:g[h]}),f),[])},[e,s]);(0,r.useEffect)(()=>{t&&c.length&&l(c[0].category)},[t,c]);const u=(0,r.useCallback)(m=>{n(m),l("")},[n]),d=(0,r.useCallback)(m=>{l(i===m?"":m)},[i]);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(W.Flex,{justifyContent:"center"},r.createElement(x.Typography,{fontWeight:"bold",textColor:"neutral600"},a({id:E("components.DynamicZone.ComponentPicker-label"),defaultMessage:"Pick one component"}))),r.createElement(D.Box,{paddingTop:2},r.createElement(ks.KeyboardNavigable,{attributeName:"data-strapi-accordion-toggle"},c.map(({category:m,components:g},f)=>r.createElement(_y,{key:m,category:m,components:g,isOdd:f%2===1,isOpen:m===i,onAddComponent:u,onToggle:d})))))):null};Ws.propTypes={components:o().array.isRequired,isOpen:o().bool.isRequired,onClickAddComponent:o().func.isRequired};const Hy=(0,r.memo)(Ws);var Gy=Object.defineProperty,Zy=Object.defineProperties,Qy=Object.getOwnPropertyDescriptors,Us=Object.getOwnPropertySymbols,Jy=Object.prototype.hasOwnProperty,Ky=Object.prototype.propertyIsEnumerable,_s=(e,t,n)=>t in e?Gy(e,t,{enumerable:!0,configurable:!0,writable:!0,value:n}):e[t]=n,Yy=(e,t)=>{for(var n in t||(t={}))Jy.call(t,n)&&_s(e,n,t[n]);if(Us)for(var n of Us(t))Ky.call(t,n)&&_s(e,n,t[n]);return e},Xy=(e,t)=>Zy(e,Qy(t));const Hs=e=>Array.from({length:e}).map(()=>({isOpen:!1})),vr=({name:e,addComponentToDynamicZone:t,formErrors:n,isCreatingEntry:a,isFieldAllowed:s,isFieldReadable:i,labelAction:l,moveComponentUp:c,moveComponentDown:u,removeComponentFromDynamicZone:d,dynamicDisplayedComponents:m,fieldSchema:g,metadatas:f})=>{const h=(0,y.useNotification)(),[b,v]=(0,r.useState)(!1),[S,O]=(0,r.useState)(!1),C=m.length,B=f.description?{id:f.description,defaultMessage:f.description}:null,[T,M]=(0,r.useState)(Hs(C));(0,r.useEffect)(()=>{M(Hs(C))},[C]),(0,r.useEffect)(()=>{S&&(M(R=>R.map((P,z)=>z===R.length-1?Xy(Yy({},P),{isOpen:!0}):P)),O(!1))},[S]);const{max:V=1/0,min:A=-1/0}=g,H=(0,r.useMemo)(()=>Object.keys(n).filter(R=>R===e).map(R=>n[R]),[n,e]),Q=(0,r.useMemo)(()=>g.components||[],[g]),j=A-C,G=H.length>0,U=H.length>0&&w()(H,[0,"id"],"").includes("min"),F=G&&w()(H,[0,"id"],"")==="components.Input.error.validation.max",I=(0,r.useCallback)(R=>{v(!1),t(e,R,G),O(!0)},[t,G,e]),K=()=>{C<V?v(R=>!R):h({type:"info",message:{id:E("components.notification.info.maximum-requirement")}})},$=R=>{M(P=>P.map(({isOpen:z},Y)=>Y===R?{isOpen:!z}:{isOpen:z}))},Z=(R,P)=>{u(R,P),M(z=>z.map(({isOpen:Y},se,ae)=>se===P+1?{isOpen:ae[P].isOpen}:se===P?{isOpen:ae[se+1].isOpen}:{isOpen:Y}))},q=(R,P)=>{c(R,P),M(z=>z.map(({isOpen:Y},se,ae)=>se===P-1?{isOpen:ae[P].isOpen}:se===P?{isOpen:ae[se-1].isOpen}:{isOpen:Y}))},k=(R,P)=>{d(R,P)};return!s&&a?r.createElement(y.NotAllowedInput,{description:B,intlLabel:{id:f.label,defaultMessage:f.label},labelAction:l,name:e}):!s&&!i&&!a?r.createElement(y.NotAllowedInput,{description:B,intlLabel:{id:f.label,defaultMessage:f.label},labelAction:l,name:e}):r.createElement(ue.Stack,{spacing:6},C>0&&r.createElement(D.Box,null,r.createElement(Rd,{intlDescription:B,label:f.label,labelAction:l,name:e,numberOfComponents:C,required:g.required||!1}),m.map((R,P)=>{var z;const Y=s&&C>0&&P<C-1,se=s&&C>0&&P>0,ae=((z=T[P])==null?void 0:z.isOpen)||!1;return r.createElement(Ny,{componentUid:R,formErrors:n,key:P,index:P,isOpen:ae,isFieldAllowed:s,moveComponentDown:Z,moveComponentUp:q,onToggle:$,name:e,removeComponentFromDynamicZone:k,showDownIcon:Y,showUpIcon:se})})),r.createElement(Od,{hasError:G,hasMaxError:F,hasMinError:U,isDisabled:!s,label:f.label,missingComponentNumber:j,isOpen:b,name:e,onClick:K}),r.createElement(Hy,{isOpen:b,components:Q,onClickAddComponent:I}))};vr.defaultProps={dynamicDisplayedComponents:[],fieldSchema:{max:1/0,min:-1/0},labelAction:null},vr.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 eh=(0,r.memo)(vr,Ue()),th=yd(eh,bd);var rt=p(41578);const rn=()=>({type:rt.ZA}),Er=e=>({type:rt.Id,data:e}),Cr=(e,t=!1)=>({type:rt.TP,rawQuery:e,isSingleType:t}),Gs=()=>({type:rt.c2}),Zs=(e,t)=>({type:rt.w7,componentsDataStructure:e,contentTypeDataStructure:t}),me=e=>({type:rt.d0,status:e}),Ze=e=>({type:rt.t9,data:e}),Qs=e=>e["content-manager_editViewCrudReducer"];var nh=p(98399),rh=Object.defineProperty,Js=Object.getOwnPropertySymbols,oh=Object.prototype.hasOwnProperty,ah=Object.prototype.propertyIsEnumerable,Ks=(e,t,n)=>t in e?rh(e,t,{enumerable:!0,configurable:!0,writable:!0,value:n}):e[t]=n,sh=(e,t)=>{for(var n in t||(t={}))oh.call(t,n)&&Ks(e,n,t[n]);if(Js)for(var n of Js(t))ah.call(t,n)&&Ks(e,n,t[n]);return e},Qe=(e,t,n)=>new Promise((a,s)=>{var i=u=>{try{c(n.next(u))}catch(d){s(d)}},l=u=>{try{c(n.throw(u))}catch(d){s(d)}},c=u=>u.done?a(u.value):Promise.resolve(u.value).then(i,l);c((n=n.apply(e,t)).next())});const Or=({allLayoutData:e,children:t,slug:n,id:a,origin:s})=>{const i=(0,nt.useQueryClient)(),l=(0,y.useNotification)(),{setCurrentStep:c}=(0,y.useGuidedTour)(),{trackUsage:u}=(0,y.useTracking)(),{push:d,replace:m}=(0,oe.useHistory)(),[{rawQuery:g}]=(0,y.useQueryParams)(),f=(0,he.useDispatch)(),{componentsDataStructure:h,contentTypeDataStructure:b,data:v,isLoading:S,status:O}=(0,he.useSelector)(Qs),C=Go(n),B=(0,r.useRef)(!0),T=(0,r.useRef)(u),M=(0,r.useRef)(e),V=a===null,A=(0,r.useMemo)(()=>V&&!s?null:ye(`collection-types/${n}/${s||a}`),[n,a,V,s]),H=(0,r.useCallback)(q=>s?(0,y.contentManagementUtilRemoveFieldsFromData)(q,M.current.contentType,M.current.components):q,[s]),Q=(0,r.useCallback)(q=>{const k=xo(q,M.current.contentType,M.current.components);return(0,y.formatContentTypeData)(k,M.current.contentType,M.current.components)},[]);(0,r.useEffect)(()=>{const q=Object.keys(e.components).reduce((P,z)=>{const Y=Bt(w()(e,["components",z,"attributes"],{}),e.components);return P[z]=(0,y.formatContentTypeData)(Y,e.components[z],e.components),P},{}),k=Bt(e.contentType.attributes,e.components),R=(0,y.formatContentTypeData)(k,e.contentType,e.components);f(Zs(q,R))},[e,f]),(0,r.useEffect)(()=>()=>{f(Gs())},[f]),(0,r.useEffect)(()=>{const k=ke().CancelToken.source(),R=z=>Qe(void 0,null,function*(){f(rn());try{const{data:Y}=yield fe.be.get(A,{cancelToken:z.token});f(Er(Q(H(Y))))}catch(Y){if(ke().isCancel(Y))return;nh.error(Y);const se=w()(Y,"response.status",null);if(se===404){d(C);return}se===403&&(l({type:"info",message:{id:E("permissions.not-allowed.update")}}),d(C))}}),P=()=>Qe(void 0,null,function*(){yield f(rn()),yield f(Cr(g))});return B.current?(A?R(k):P(),()=>{k.cancel("Operation canceled by the user.")}):()=>{}},[H,Q,d,A,f,g,C,l]);const j=(0,r.useCallback)(q=>{const k=q.response.data;let R=w()(k,["error","message"],"Bad Request");Array.isArray(R)&&(R=w()(R,["0","messages","0","id"])),typeof R=="string"&&l({type:"warning",message:R})},[l]),G=(0,r.useCallback)(q=>Qe(void 0,null,function*(){try{T.current("willDeleteEntry",q);const{data:k}=yield fe.be.delete(ye(`collection-types/${n}/${a}`));return l({type:"success",message:{id:E("success.record.delete")}}),T.current("didDeleteEntry",q),Promise.resolve(k)}catch(k){return T.current("didNotDeleteEntry",sh({error:k},q)),Promise.reject(k)}}),[a,n,l]),U=(0,r.useCallback)(()=>{m(C)},[C,m]),F=(0,r.useCallback)((q,k)=>Qe(void 0,null,function*(){const R=`${ye(`collection-types/${n}`)}${g}`;try{f(me("submit-pending"));const{data:P}=yield fe.be.post(R,q);return T.current("didCreateEntry",k),l({type:"success",message:{id:E("success.record.save")}}),c("contentManager.success"),i.invalidateQueries(["relation"]),f(Ze(Q(P))),f(me("resolved")),m(`/content-manager/collectionType/${n}/${P.id}${g}`),Promise.resolve(P)}catch(P){return j(P),T.current("didNotCreateEntry",{error:P,trackerProperty:k}),f(me("resolved")),Promise.reject(P)}}),[Q,j,m,n,f,g,l,c,i]),I=(0,r.useCallback)(()=>Qe(void 0,null,function*(){try{T.current("willCheckDraftRelations");const q=ye(`collection-types/${n}/${a}/actions/numberOfDraftRelations`);f(me("draft-relation-check-pending"));const k=yield fe.be.get(q);return T.current("didCheckDraftRelations"),f(me("resolved")),k.data.data}catch(q){return j(q),f(me("resolved")),Promise.reject(q)}}),[j,a,n,f]),K=(0,r.useCallback)(()=>Qe(void 0,null,function*(){try{T.current("willPublishEntry");const q=ye(`collection-types/${n}/${a}/actions/publish`);f(me("publish-pending"));const{data:k}=yield fe.be.post(q);return T.current("didPublishEntry"),f(Ze(Q(k))),f(me("resolved")),l({type:"success",message:{id:E("success.record.publish")}}),Promise.resolve(k)}catch(q){return j(q),f(me("resolved")),Promise.reject(q)}}),[Q,j,a,n,f,l]),$=(0,r.useCallback)((q,k)=>Qe(void 0,null,function*(){const R=ye(`collection-types/${n}/${a}`);try{T.current("willEditEntry",k),f(me("submit-pending"));const{data:P}=yield fe.be.put(R,q);return T.current("didEditEntry",{trackerProperty:k}),l({type:"success",message:{id:E("success.record.save")}}),i.invalidateQueries(["relation"]),f(Ze(Q(P))),f(me("resolved")),Promise.resolve(P)}catch(P){return T.current("didNotEditEntry",{error:P,trackerProperty:k}),j(P),f(me("resolved")),Promise.reject(P)}}),[Q,j,n,a,f,l,i]),Z=(0,r.useCallback)(()=>Qe(void 0,null,function*(){const q=ye(`collection-types/${n}/${a}/actions/unpublish`);f(me("unpublish-pending"));try{T.current("willUnpublishEntry");const{data:k}=yield fe.be.post(q);return T.current("didUnpublishEntry"),l({type:"success",message:{id:E("success.record.unpublish")}}),f(Ze(Q(k))),f(me("resolved")),Promise.resolve(k)}catch(k){return f(me("resolved")),j(k),Promise.reject(k)}}),[Q,j,a,n,f,l]);return t({componentsDataStructure:h,contentTypeDataStructure:b,data:v,isCreatingEntry:V,isLoadingForData:S,onDelete:G,onDeleteSucceeded:U,onPost:F,onPublish:K,onDraftRelationCheck:I,onPut:$,onUnpublish:Z,status:O,redirectionLink:C})};Or.defaultProps={id:null,origin:null},Or.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 ih=(0,r.memo)(Or,Ue());var lh=p(86834),Se=p.n(lh),ch=p(89793),on=p.n(ch),uh=p(3040),te=p.n(uh),dh=p(56236),ph=p.n(dh),mh=p(82879),Ys=p.n(mh);const Pr=(e,t,n,a)=>{const s=e.slice();return s.splice(t,1),s.splice(n,0,a),s};var fh=p(77236),gh=p.n(fh);const yh=(e,t,n)=>{const a=(l,c)=>w()(l,["attributes",c,"type"],""),s=(l,c)=>w()(l,["attributes",...c],""),i=(l,c)=>Object.keys(l).reduce((u,d)=>{const m=a(c,d),g=w()(l,d),f=s(c,[d,"component"]),h=s(c,[d,"repeatable"]);let b;switch(m){case"json":b=JSON.parse(g);break;case"time":{b=g,g&&g.split(":").length<3&&(b=`${g}:00`);break}case"media":s(c,[d,"multiple"])===!0?b=g?g.filter(v=>!(v instanceof File)):null:b=w()(g,0)instanceof File?null:w()(g,"id",null);break;case"component":h?b=g&&g.map(v=>i(v,n[f])):b=g&&i(g,n[f]);break;case"relation":b=Object.entries(g).reduce((v,[S,O])=>(["connect","disconnect"].includes(S)&&(v[S]=O.map(C=>({id:C.id}))),v),{});break;case"dynamiczone":b=g.map(v=>i(v,n[v.__component]));break;default:b=hh(g,"id")}return u[d]=b,u},{});return i(e,t)},hh=(e,t)=>gh()(e)?e.map(n=>n[t]?n[t]:n):Wo()(e)?e[t]:e,bh=yh;var vh=p(51355),Eh=p.n(vh),Ch=p(95919),Oh=p.n(Ch),Ph=p(78746),pt=p.n(Ph),ve=p(5173);function Mt(e){return["integer","biginteger","decimal","float","number"].includes(e)}var Rh=Object.defineProperty,Th=Object.defineProperties,Mh=Object.getOwnPropertyDescriptors,Xs=Object.getOwnPropertySymbols,wh=Object.prototype.hasOwnProperty,Ih=Object.prototype.propertyIsEnumerable,ei=(e,t,n)=>t in e?Rh(e,t,{enumerable:!0,configurable:!0,writable:!0,value:n}):e[t]=n,ti=(e,t)=>{for(var n in t||(t={}))wh.call(t,n)&&ei(e,n,t[n]);if(Xs)for(var n of Xs(t))Ih.call(t,n)&&ei(e,n,t[n]);return e},ni=(e,t)=>Th(e,Mh(t));ve.kM(ve.nK,"defined",function(){return this.test("defined",y.translatedErrors.required,e=>e!==void 0)}),ve.kM(ve.IX,"notEmptyMin",function(e){return this.test("notEmptyMin",y.translatedErrors.min,t=>Se()(t)?!0:t.length>=e)}),ve.kM(ve.Z_,"isInferior",function(e,t){return this.test("isInferior",e,function(n){return!n||Number.isNaN(pt()(n))?!0:pt()(t)>=pt()(n)})}),ve.kM(ve.Z_,"isSuperior",function(e,t){return this.test("isSuperior",e,function(n){return!n||Number.isNaN(pt()(n))?!0:pt()(n)>=pt()(t)})});const Dh=e=>w()(e,["attributes"],{}),Rr=(e,{components:t},n={isCreatingEntry:!0,isDraft:!0,isFromComponent:!1})=>{const a=Dh(e);return ve.Ry().shape(Object.keys(a).reduce((s,i)=>{const l=a[i];if(l.type!=="relation"&&l.type!=="component"&&l.type!=="dynamiczone"){const c=Sh(l.type,l,n);s[i]=c}if(l.type==="relation"&&(s[i]=["oneWay","oneToOne","manyToOne","oneToManyMorph","oneToOneMorph"].includes(l.relationType)?ve.Ry().nullable():ve.IX().nullable()),l.type==="component"){const c=Rr(t[l.component],{components:t},ni(ti({},n),{isFromComponent:!0}));if(l.repeatable===!0){const{min:d,max:m,required:g}=l;let f=ve.Vo(h=>{let b=ve.IX().of(c);return d?g?b=b.min(d,y.translatedErrors.min):g!==!0&&Se()(h)?b=b.nullable():b=b.min(d,y.translatedErrors.min):g&&!n.isDraft&&(b=b.min(1,y.translatedErrors.required)),m&&(b=b.max(m,y.translatedErrors.max)),b});return s[i]=f,s}const u=ve.Vo(d=>d!==void 0?l.required===!0&&!n.isDraft?c.defined():c.nullable():l.required===!0?ve.Ry().defined():ve.Ry().nullable());return s[i]=u,s}if(l.type==="dynamiczone"){let c=ve.IX().of(ve.Vo(({__component:m})=>Rr(t[m],{components:t},ni(ti({},n),{isFromComponent:!0}))));const{max:u,min:d}=l;d?l.required?c=c.test("min",y.translatedErrors.min,m=>n.isCreatingEntry?m&&m.length>=d:m===void 0?!0:m!==null&&m.length>=d).test("required",y.translatedErrors.required,m=>n.isCreatingEntry?m!==null||m!==void 0:m===void 0?!0:m!==null):c=c.notEmptyMin(d):l.required&&!n.isDraft&&(c=c.test("required",y.translatedErrors.required,m=>n.isCreatingEntry?m!==null||m!==void 0:m===void 0?!0:m!==null)),u&&(c=c.max(u,y.translatedErrors.max)),s[i]=c}return s},{}))},Sh=(e,t,n)=>{let a=ve.nK();return["string","uid","text","richtext","email","password","enumeration"].includes(e)&&(a=ve.Z_()),e==="json"&&(a=ve.nK(y.translatedErrors.json).test("isJSON",y.translatedErrors.json,s=>{if(s===void 0)return!0;try{return JSON.parse(s),!0}catch(i){return!1}}).nullable()),e==="email"&&(a=a.email(y.translatedErrors.email)),["number","integer","float","decimal"].includes(e)&&(a=ve.Rx().transform(s=>Oh()(s)?void 0:s).typeError()),e==="biginteger"&&(a=ve.Z_().matches(/^-?\d*$/)),["date","datetime"].includes(e)&&(a=ve.hT()),Object.keys(t).forEach(s=>{const i=t[s];if(!!i||!Eh()(i)&&Number.isInteger(Math.floor(i))||i===0)switch(s){case"required":{n.isDraft||(e==="password"&&n.isCreatingEntry&&(a=a.required(y.translatedErrors.required)),e!=="password"&&(n.isCreatingEntry?a=a.required(y.translatedErrors.required):a=a.test("required",y.translatedErrors.required,l=>l===void 0&&!n.isFromComponent?!0:Mt(e)?l===0?!0:!!l:e==="boolean"?l!==null:e==="date"||e==="datetime"?typeof l=="string"?!Se()(l):!Se()(l==null?void 0:l.toString()):!Se()(l))));break}case"max":{e==="biginteger"?a=a.isInferior(y.translatedErrors.max,i):a=a.max(i,y.translatedErrors.max);break}case"maxLength":a=a.max(i,y.translatedErrors.maxLength);break;case"min":{e==="biginteger"?a=a.isSuperior(y.translatedErrors.min,i):a=a.min(i,y.translatedErrors.min);break}case"minLength":{n.isDraft||(a=a.min(i,y.translatedErrors.minLength));break}case"regex":a=a.matches(new RegExp(i),{message:y.translatedErrors.regex,excludeEmptyString:!t.required});break;case"lowercase":["text","textarea","email","string"].includes(e)&&(a=a.strict().lowercase());break;case"uppercase":["text","textarea","email","string"].includes(e)&&(a=a.strict().uppercase());break;case"positive":Mt(e)&&(a=a.positive());break;case"negative":Mt(e)&&(a=a.negative());break;default:a=a.nullable()}}),a},ri=Rr;var Lh=Object.defineProperty,xh=Object.defineProperties,Fh=Object.getOwnPropertyDescriptors,an=Object.getOwnPropertySymbols,oi=Object.prototype.hasOwnProperty,ai=Object.prototype.propertyIsEnumerable,si=(e,t,n)=>t in e?Lh(e,t,{enumerable:!0,configurable:!0,writable:!0,value:n}):e[t]=n,Ae=(e,t)=>{for(var n in t||(t={}))oi.call(t,n)&&si(e,n,t[n]);if(an)for(var n of an(t))ai.call(t,n)&&si(e,n,t[n]);return e},Tr=(e,t)=>xh(e,Fh(t)),kh=(e,t)=>{var n={};for(var a in e)oi.call(e,a)&&t.indexOf(a)<0&&(n[a]=e[a]);if(e!=null&&an)for(var a of an(e))t.indexOf(a)<0&&ai.call(e,a)&&(n[a]=e[a]);return n};const Ah={componentsDataStructure:{},contentTypeDataStructure:{},formErrors:{},initialData:{},modifiedData:null,shouldCheckErrors:!1,modifiedDZName:null,publishConfirmation:{show:!1,draftCount:0}},jh=(e,t)=>(0,zt.default)(e,n=>{var a,s;switch(t.type){case"ADD_NON_REPEATABLE_COMPONENT_TO_FIELD":{te()(n,["modifiedData",...t.keys],e.componentsDataStructure[t.componentUid]);break}case"ADD_REPEATABLE_COMPONENT_TO_FIELD":{let i=w()(e,["modifiedData",...t.keys],[]).slice();const l=Tr(Ae({},e.componentsDataStructure[t.componentUid]),{__temp_key__:Ro(i)+1});Array.isArray(i)?i.push(l):i=[l],te()(n,["modifiedData",...t.keys],i),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 i=Tr(Ae({},e.componentsDataStructure[t.componentUid]),{__component:t.componentUid}),l=w()(e,["modifiedData",...t.keys],null),c=l?[...l,i]:[i];te()(n,["modifiedData",...t.keys],c);break}case"LOAD_RELATION":{const i=["initialData",...t.keys,"results"],l=["modifiedData",...t.keys,"results"],{value:c}=t;te()(n,i,c),te()(n,l,c);break}case"CONNECT_RELATION":{const i=["modifiedData",...t.keys],{value:l,replace:c=!1}=t,u=w()(e,[...i,"connect"]),d=(a=w()(e,[...i,"disconnect"]))!=null?a:[],m=(s=w()(e,[...i,"results"]))!=null?s:[],g=(m==null?void 0:m.findIndex(f=>f.id===l.id))!==-1;if(u||te()(n,[...i,"connect"],[]),g||(c?te()(n,[...i,"connect"],[l]):w()(n,[...i,"connect"]).push(l)),c)m.length&&!d.length&&te()(n,[...i,"disconnect"],m),d.length&&d.findIndex(h=>(h==null?void 0:h.id)===l.id)>-1&&(te()(n,[...i,"disconnect"],[]),te()(n,[...i,"connect"],[]));else if(d.length){const f=d.find(h=>h.id===l.id);if(f){const h=Ys()([...d],f);te()(n,[...i,"disconnect"],h)}}break}case"DISCONNECT_RELATION":{const i=["modifiedData",...t.keys],{value:l}=t,c=w()(e,[...i,"connect"]);if(w()(e,[...i,"disconnect"])||te()(n,[...i,"disconnect"],[]),w()(n,[...i,"disconnect"]).push(l),c!=null&&c.length){const m=c.find(g=>g.id===l.id);if(m){const g=Ys()([...c],m);te()(n,[...i,"connect"],g)}}break}case"INIT_FORM":{const{initialValues:i,relationalFields:l=[]}=t;n.formErrors={},n.initialData=Ae(Ae({},i),l.reduce((c,u)=>{var d,m,g;return c[u]=Ae(Ae({},(m=(d=e.initialData)==null?void 0:d[u])!=null?m:{}),(g=i==null?void 0:i[u])!=null?g:{}),c},{})),n.modifiedData=Ae(Ae({},i),l.reduce((c,u)=>{var d,m,g;const f=(m=(d=e.modifiedData)==null?void 0:d[u])!=null?m:{},{connect:h,disconnect:b}=f,v=kh(f,["connect","disconnect"]);return c[u]=Ae(Ae({},v!=null?v:{}),(g=i==null?void 0:i[u])!=null?g:{}),c},{})),n.modifiedDZName=null,n.shouldCheckErrors=!1;break}case"MOVE_COMPONENT_FIELD":{const i=w()(e,["modifiedData",...t.pathToComponent]),l=w()(e,["modifiedData",...t.pathToComponent,t.dragIndex]),c=Pr(i,t.dragIndex,t.hoverIndex,l);te()(n,["modifiedData",...t.pathToComponent],c);break}case"MOVE_COMPONENT_UP":case"MOVE_COMPONENT_DOWN":{const{currentIndex:i,dynamicZoneName:l,shouldCheckErrors:c}=t;c&&(n.shouldCheckErrors=!e.shouldCheckErrors);const u=e.modifiedData[l],d=t.type==="MOVE_COMPONENT_UP"?i-1:i+1,m=e.modifiedData[l][i],g=Pr(u,i,d,m);te()(n,["modifiedData",t.dynamicZoneName],g);break}case"MOVE_FIELD":{const i=w()(e,["modifiedData",...t.keys],[]).slice(),l=w()(e,["modifiedData",...t.keys,t.dragIndex]),c=Pr(i,t.dragIndex,t.overIndex,l);te()(n,["modifiedData",...t.keys],c);break}case"ON_CHANGE":{const[i]=t.keys;if(t.shouldSetInitialValue&&te()(n,["initialData",...t.keys],t.value),t.keys.length===2&&w()(e,["modifiedData",i])===null){te()(n,["modifiedData",i],{[t.keys[1]]:t.value});break}te()(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 i=["modifiedData",...t.keys];te()(n,i,null);break}case"REMOVE_PASSWORD_FIELD":{ph()(n,["modifiedData",...t.keys]);break}case"REMOVE_REPEATABLE_FIELD":{const i=t.keys.length-1,l=["modifiedData",...Bn()(t.keys,i)];Object.keys(e.formErrors).length>0&&(n.shouldCheckErrors=!e.shouldCheckErrors);const u=w()(e,l).slice();u.splice(parseInt(t.keys[i],10),1),te()(n,l,u);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}case"SET_PUBLISH_CONFIRMATION":{n.publishConfirmation=Ae({},t.publishConfirmation);break}case"RESET_PUBLISH_CONFIRMATION":{n.publishConfirmation=Tr(Ae({},e.publishConfirmation),{show:!1});break}default:return n}});var $h=Object.defineProperty,ii=Object.getOwnPropertySymbols,Bh=Object.prototype.hasOwnProperty,Nh=Object.prototype.propertyIsEnumerable,li=(e,t,n)=>t in e?$h(e,t,{enumerable:!0,configurable:!0,writable:!0,value:n}):e[t]=n,sn=(e,t)=>{for(var n in t||(t={}))Bh.call(t,n)&&li(e,n,t[n]);if(ii)for(var n of ii(t))Nh.call(t,n)&&li(e,n,t[n]);return e},ln=(e,t,n)=>new Promise((a,s)=>{var i=u=>{try{c(n.next(u))}catch(d){s(d)}},l=u=>{try{c(n.throw(u))}catch(d){s(d)}},c=u=>u.done?a(u.value):Promise.resolve(u.value).then(i,l);c((n=n.apply(e,t)).next())});const Mr=({allLayoutData:e,allowedActions:{canRead:t,canUpdate:n},children:a,componentsDataStructure:s,contentTypeDataStructure:i,createActionAllowedFields:l,from:c,initialValues:u,isCreatingEntry:d,isLoadingForData:m,isSingleType:g,onPost:f,onPublish:h,onDraftRelationCheck:b,onPut:v,onUnpublish:S,readActionAllowedFields:O,redirectToPreviousPage:C,slug:B,status:T,updateActionAllowedFields:M})=>{const[V,A]=(0,r.useReducer)(jh,Ah),{formErrors:H,initialData:Q,modifiedData:j,modifiedDZName:G,shouldCheckErrors:U,publishConfirmation:F}=V,I=(0,y.useNotification)(),{lockApp:K,unlockApp:$}=(0,y.useOverlayBlocker)(),Z=w()(e,["contentType"],{}),q=(0,r.useMemo)(()=>w()(Z,["options","draftAndPublish"],!1),[Z]),k=(0,r.useMemo)(()=>q&&!Q.publishedAt,[q,Q.publishedAt]),{trackUsage:R}=(0,y.useTracking)(),{formatMessage:P}=(0,N.useIntl)(),z=(0,r.useRef)(R),Y=(0,r.useMemo)(()=>m||d?!1:t===!1&&n===!1,[m,d,t,n]);(0,r.useEffect)(()=>{T==="resolved"?$():K()},[K,$,T]),(0,r.useEffect)(()=>{m||xe()},[U]),(0,r.useEffect)(()=>{const ne=Object.keys(H);if(ne.length>0){const re=ne[0],le=document.getElementById(re);le&&le.focus()}},[H]),(0,r.useEffect)(()=>{Y&&I({type:"info",message:{id:E("permissions.not-allowed.update")}})},[Y,I]),(0,r.useEffect)(()=>{A({type:"SET_DEFAULT_DATA_STRUCTURES",componentsDataStructure:s,contentTypeDataStructure:i})},[s,i]),(0,r.useEffect)(()=>{if(u){const ne=Object.keys(u).filter(re=>{var le;return((le=Z==null?void 0:Z.attributes[re])==null?void 0:le.type)==="relation"});A({type:"INIT_FORM",initialValues:u,relationalFields:ne})}},[u,Z]);const se=(0,r.useCallback)((ne,re,le=!1)=>{z.current("didAddComponentToDynamicZone"),A({type:"ADD_COMPONENT_TO_DYNAMIC_ZONE",keys:ne.split("."),componentUid:re,shouldCheckErrors:le})},[]),ae=(0,r.useCallback)((ne,re)=>{A({type:"ADD_NON_REPEATABLE_COMPONENT_TO_FIELD",keys:ne.split("."),componentUid:re})},[]),_=(0,r.useCallback)(({target:{name:ne,value:re,replace:le}})=>{A({type:"CONNECT_RELATION",keys:ne.split("."),value:re,replace:le})},[]),J=(0,r.useCallback)(({target:{name:ne,value:re}})=>{A({type:"LOAD_RELATION",keys:ne.split("."),value:re})},[]),Pe=(0,r.useCallback)((ne,re,le=!1)=>{A({type:"ADD_REPEATABLE_COMPONENT_TO_FIELD",keys:ne.split("."),componentUid:re,shouldCheckErrors:le})},[]),Ce=(0,r.useMemo)(()=>{const ne={isCreatingEntry:d,isDraft:k,isFromComponent:!1};return ri(Z,{components:e.components||{}},ne)},[e.components,Z,d,k]),xe=(0,r.useCallback)((...ne)=>ln(void 0,[...ne],function*(re={}){let le={};const Be=ze()(j);Se()(Be)||te()(Be,re.path,re.value);try{yield Ce.validate(Be,{abortEarly:!1})}catch(On){le=(0,y.getYupInnerErrors)(On),G&&(le=Object.keys(le).reduce((Ic,ro)=>(ro.split(".")[0]!==G&&(Ic[ro]=le[ro]),Ic),{}))}A({type:"SET_FORM_ERRORS",errors:le})}),[G,j,Ce]),Ke=(0,r.useCallback)(({target:{name:ne,value:re,type:le}},Be=!1)=>{let On=re;if(["text","textarea","string","email","uid","select","select-one","number"].includes(le)&&!re&&re!==0&&(On=null),le==="password"&&!re){A({type:"REMOVE_PASSWORD_FIELD",keys:ne.split(".")});return}A({type:"ON_CHANGE",keys:ne.split("."),value:On,shouldSetInitialValue:Be})},[]),$e=(0,r.useCallback)(ne=>{const re=vu(ze()(ne),"__temp_key__");return bh(re,Z,e.components)},[e.components,Z]),Ge=(0,r.useMemo)(()=>q?k?{status:"draft"}:{}:{},[q,k]),kt=(0,r.useCallback)(ne=>ln(void 0,null,function*(){return ne.preventDefault(),A({type:"RESET_PUBLISH_CONFIRMATION"})}),[]),bO=(0,r.useCallback)(ne=>ln(void 0,null,function*(){ne.preventDefault();let re={};try{yield Ce.validate(j,{abortEarly:!1})}catch(le){re=(0,y.getYupInnerErrors)(le)}try{if(Se()(re)){const le=$e(j);d?yield f(le,Ge):yield v(le,Ge)}}catch(le){re=sn(sn({},re),(0,y.getAPIInnerErrors)(le,{getTrad:E}))}A({type:"SET_FORM_ERRORS",errors:re})}),[$e,d,j,f,v,Ge,Ce]),vO=(0,r.useCallback)(()=>ln(void 0,null,function*(){const ne=ri(Z,{components:w()(e,"components",{})},{isCreatingEntry:d,isDraft:!1,isFromComponent:!1}),re=yield b();if(!F.show&&re>0){A({type:"SET_PUBLISH_CONFIRMATION",publishConfirmation:{show:!0,draftCount:re}});return}A({type:"RESET_PUBLISH_CONFIRMATION"});let le={};try{yield ne.validate(j,{abortEarly:!1})}catch(Be){le=(0,y.getYupInnerErrors)(Be)}try{Se()(le)&&(yield h())}catch(Be){le=sn(sn({},le),(0,y.getAPIInnerErrors)(Be,{getTrad:E}))}A({type:"SET_FORM_ERRORS",errors:le})}),[e,Z,d,j,F.show,h,b]),yt=(0,r.useCallback)(ne=>{const re=Object.keys(H).some(Be=>Be.split(".")[0]===ne);return!Se()(H)&&re},[H]),EO=(0,r.useCallback)((ne,re)=>{z.current("changeComponentsOrder"),A({type:"MOVE_COMPONENT_DOWN",dynamicZoneName:ne,currentIndex:re,shouldCheckErrors:yt(ne)})},[yt]),CO=(0,r.useCallback)((ne,re)=>{z.current("changeComponentsOrder"),A({type:"MOVE_COMPONENT_UP",dynamicZoneName:ne,currentIndex:re,shouldCheckErrors:yt(ne)})},[yt]),OO=(0,r.useCallback)((ne,re,le)=>{A({type:"MOVE_COMPONENT_FIELD",pathToComponent:ne,dragIndex:re,hoverIndex:le})},[]),PO=(0,r.useCallback)(({target:{name:ne,value:re}})=>{A({type:"DISCONNECT_RELATION",keys:ne.split("."),value:re})},[]),RO=(0,r.useCallback)((ne,re)=>{z.current("removeComponentFromDynamicZone"),A({type:"REMOVE_COMPONENT_FROM_DYNAMIC_ZONE",dynamicZoneName:ne,index:re,shouldCheckErrors:yt(ne)})},[yt]),TO=(0,r.useCallback)((ne,re)=>{A({type:"REMOVE_COMPONENT_FROM_FIELD",keys:ne.split("."),componentUid:re})},[]),MO=(0,r.useCallback)((ne,re)=>{A({type:"REMOVE_REPEATABLE_FIELD",keys:ne.split("."),componentUid:re})},[]),wO=(0,r.useCallback)(()=>{A({type:"TRIGGER_FORM_VALIDATION"})},[]);return Y?r.createElement(oe.Redirect,{to:c}):j?r.createElement(y.ContentManagerEditViewDataManagerContext.Provider,{value:{addComponentToDynamicZone:se,addNonRepeatableComponentToField:ae,connectRelation:_,addRepeatableComponentToField:Pe,allLayoutData:e,checkFormErrors:xe,createActionAllowedFields:l,formErrors:H,hasDraftAndPublish:q,initialData:Q,isCreatingEntry:d,isSingleType:g,shouldNotRunValidations:k,status:T,layout:Z,loadRelation:J,modifiedData:j,moveComponentDown:EO,moveComponentField:OO,moveComponentUp:CO,onChange:Ke,onPublish:vO,onUnpublish:S,disconnectRelation:PO,readActionAllowedFields:O,redirectToPreviousPage:C,removeComponentFromDynamicZone:RO,removeComponentFromField:TO,removeRepeatableField:MO,slug:B,triggerFormValidation:wO,updateActionAllowedFields:M,onPublishPromptDismissal:kt,publishConfirmation:F}},r.createElement(r.Fragment,null,m||!d&&!Q.id?r.createElement(ie.Main,{"aria-busy":"true"},r.createElement(y.LoadingIndicatorPage,null)):r.createElement(r.Fragment,null,r.createElement(oe.Prompt,{when:!on()(j,Q),message:P({id:"global.prompt.unsaved"})}),r.createElement("form",{noValidate:!0,onSubmit:bO},a)))):null};Mr.defaultProps={from:"/",initialValues:null,redirectToPreviousPage(){}},Mr.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,onDraftRelationCheck: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 Vh=Mr,ot=e=>ye(`single-types/${e}`),qh=e=>Object.values(e||{}).reduce((t,n)=>Object.assign(t,n),{});var zh=Object.defineProperty,cn=Object.getOwnPropertySymbols,ci=Object.prototype.hasOwnProperty,ui=Object.prototype.propertyIsEnumerable,di=(e,t,n)=>t in e?zh(e,t,{enumerable:!0,configurable:!0,writable:!0,value:n}):e[t]=n,pi=(e,t)=>{for(var n in t||(t={}))ci.call(t,n)&&di(e,n,t[n]);if(cn)for(var n of cn(t))ui.call(t,n)&&di(e,n,t[n]);return e},Wh=(e,t)=>{var n={};for(var a in e)ci.call(e,a)&&t.indexOf(a)<0&&(n[a]=e[a]);if(e!=null&&cn)for(var a of cn(e))t.indexOf(a)<0&&ui.call(e,a)&&(n[a]=e[a]);return n};const mi=(e={})=>{const t=pi(pi({},e),qh(e.plugins)),{plugins:n,_q:a}=t,s=Wh(t,["plugins","_q"]);return a&&te()(s,"_q",encodeURIComponent(a)),`${(0,We.stringify)(s,{encode:!1,addQueryPrefix:!0})}`};var Uh=Object.defineProperty,fi=Object.getOwnPropertySymbols,_h=Object.prototype.hasOwnProperty,Hh=Object.prototype.propertyIsEnumerable,gi=(e,t,n)=>t in e?Uh(e,t,{enumerable:!0,configurable:!0,writable:!0,value:n}):e[t]=n,Gh=(e,t)=>{for(var n in t||(t={}))_h.call(t,n)&&gi(e,n,t[n]);if(fi)for(var n of fi(t))Hh.call(t,n)&&gi(e,n,t[n]);return e},at=(e,t,n)=>new Promise((a,s)=>{var i=u=>{try{c(n.next(u))}catch(d){s(d)}},l=u=>{try{c(n.throw(u))}catch(d){s(d)}},c=u=>u.done?a(u.value):Promise.resolve(u.value).then(i,l);c((n=n.apply(e,t)).next())});const yi=({allLayoutData:e,children:t,slug:n})=>{const a=(0,nt.useQueryClient)(),{trackUsage:s}=(0,y.useTracking)(),{push:i}=(0,oe.useHistory)(),{setCurrentStep:l}=(0,y.useGuidedTour)(),c=(0,r.useRef)(s),[u,d]=(0,r.useState)(!0),[{query:m,rawQuery:g}]=(0,y.useQueryParams)(),f=mi(m),h=(0,y.useNotification)(),b=(0,he.useDispatch)(),{componentsDataStructure:v,contentTypeDataStructure:S,data:O,isLoading:C,status:B}=(0,he.useSelector)(Qs),T=(0,r.useCallback)(F=>{const I=xo(F,e.contentType,e.components);return(0,y.formatContentTypeData)(I,e.contentType,e.components)},[e]);(0,r.useEffect)(()=>()=>{b(Gs())},[b]),(0,r.useEffect)(()=>{const F=Object.keys(e.components).reduce(($,Z)=>{const q=Bt(w()(e,["components",Z,"attributes"],{}),e.components);return $[Z]=(0,y.formatContentTypeData)(q,e.components[Z],e.components),$},{}),I=Bt(e.contentType.attributes,e.components),K=(0,y.formatContentTypeData)(I,e.contentType,e.components);b(Zs(F,K))},[e,b]),(0,r.useEffect)(()=>{const I=ke().CancelToken.source();return($=>at(void 0,null,function*(){b(rn()),d(!0);try{const{data:Z}=yield(0,fe.be)(ot(`${n}${f}`),{cancelToken:$.token});b(Er(T(Z))),d(!1)}catch(Z){if(ke().isCancel(Z))return;const q=w()(Z,"response.status",null);q===404&&b(Cr(g,!0)),q===403&&(h({type:"info",message:{id:E("permissions.not-allowed.update")}}),i("/"))}}))(I),()=>I.cancel("Operation canceled by the user.")},[T,i,n,b,f,g,h]);const M=(0,r.useCallback)(F=>{const I=F.response.data;let K=w()(I,["error","message"],"Bad Request");Array.isArray(K)&&(K=w()(K,["0","messages","0","id"])),typeof K=="string"&&h({type:"warning",message:K})},[h]),V=(0,r.useCallback)(F=>at(void 0,null,function*(){try{c.current("willDeleteEntry",F);const{data:I}=yield fe.be.delete(ot(`${n}${f}`));return h({type:"success",message:{id:E("success.record.delete")}}),c.current("didDeleteEntry",F),Promise.resolve(I)}catch(I){return c.current("didNotDeleteEntry",Gh({error:I},F)),M(I),Promise.reject(I)}}),[n,M,h,f]),A=(0,r.useCallback)(()=>{d(!0),b(Cr(g,!0))},[b,g]),H=(0,r.useCallback)((F,I)=>at(void 0,null,function*(){const K=ot(`${n}${g}`);try{b(me("submit-pending"));const{data:$}=yield fe.be.put(K,F);return c.current("didCreateEntry",I),h({type:"success",message:{id:E("success.record.save")}}),l("contentManager.success"),a.invalidateQueries(["relation"]),b(Ze(T($))),d(!1),b(me("resolved")),Promise.resolve($)}catch($){return c.current("didNotCreateEntry",{error:$,trackerProperty:I}),M($),b(me("resolved")),Promise.reject($)}}),[T,M,n,b,g,h,l,a]),Q=(0,r.useCallback)(()=>at(void 0,null,function*(){try{c.current("willCheckDraftRelations");const F=ot(`${n}/actions/numberOfDraftRelations`);b(me("draft-relation-check-pending"));const I=yield fe.be.get(F);return c.current("didCheckDraftRelations"),b(me("resolved")),I.data.data}catch(F){return M(F),b(me("resolved")),Promise.reject(F)}}),[M,n,b]),j=(0,r.useCallback)(()=>at(void 0,null,function*(){try{c.current("willPublishEntry");const F=ot(`${n}/actions/publish${f}`);b(me("publish-pending"));const{data:I}=yield fe.be.post(F);return c.current("didPublishEntry"),h({type:"success",message:{id:E("success.record.publish")}}),b(Ze(T(I))),b(me("resolved")),Promise.resolve(I)}catch(F){return M(F),b(me("resolved")),Promise.reject(F)}}),[T,M,n,f,b,h]),G=(0,r.useCallback)((F,I)=>at(void 0,null,function*(){const K=ot(`${n}${g}`);try{c.current("willEditEntry",I),b(me("submit-pending"));const{data:$}=yield fe.be.put(K,F);return h({type:"success",message:{id:E("success.record.save")}}),c.current("didEditEntry",{trackerProperty:I}),a.invalidateQueries(["relation"]),b(Ze(T($))),b(me("resolved")),Promise.resolve($)}catch($){return M($),c.current("didNotEditEntry",{error:$,trackerProperty:I}),b(me("resolved")),Promise.reject($)}}),[T,M,n,b,g,h,a]),U=(0,r.useCallback)(()=>at(void 0,null,function*(){const F=ot(`${n}/actions/unpublish${f}`);b(me("unpublish-pending"));try{c.current("willUnpublishEntry");const{data:I}=yield fe.be.post(F);c.current("didUnpublishEntry"),h({type:"success",message:{id:E("success.record.unpublish")}}),b(Ze(T(I))),b(me("resolved"))}catch(I){b(me("resolved")),M(I)}}),[T,h,M,n,b,f]);return t({componentsDataStructure:v,contentTypeDataStructure:S,data:O,isCreatingEntry:u,isLoadingForData:C,onDelete:V,onDeleteSucceeded:A,onPost:H,onDraftRelationCheck:Q,onPublish:j,onPut:G,onUnpublish:U,redirectionLink:"/",status:B})};yi.propTypes={allLayoutData:o().shape({components:o().object.isRequired,contentType:o().object.isRequired}).isRequired,children:o().func.isRequired,slug:o().string.isRequired};const Zh=(0,r.memo)(yi);var Qh=p(57235),Jh=p.n(Qh),Kh=Object.defineProperty,hi=Object.getOwnPropertySymbols,Yh=Object.prototype.hasOwnProperty,Xh=Object.prototype.propertyIsEnumerable,bi=(e,t,n)=>t in e?Kh(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)&&bi(e,n,t[n]);if(hi)for(var n of hi(t))Xh.call(t,n)&&bi(e,n,t[n]);return e};function eb(e,t){return n=>{const a=t();return r.createElement(e,vi(vi({},n),a))}}const tb=eb;function nb(){const{initialData:e,hasDraftAndPublish:t}=(0,y.useCMEditViewDataManager)(),n=e.publishedAt!==void 0&&e.publishedAt!==null;return{hasDraftAndPublish:t,isPublished:n}}const rb=nb;var ob=Object.defineProperty,Ei=Object.getOwnPropertySymbols,ab=Object.prototype.hasOwnProperty,sb=Object.prototype.propertyIsEnumerable,Ci=(e,t,n)=>t in e?ob(e,t,{enumerable:!0,configurable:!0,writable:!0,value:n}):e[t]=n,ib=(e,t)=>{for(var n in t||(t={}))ab.call(t,n)&&Ci(e,n,t[n]);if(Ei)for(var n of Ei(t))sb.call(t,n)&&Ci(e,n,t[n]);return e};const lb=(0,L.default)(Jh())`
|
|
1015
|
+
width: ${(0,y.pxToRem)(6)};
|
|
1016
|
+
height: ${(0,y.pxToRem)(6)};
|
|
1017
|
+
* {
|
|
1018
|
+
fill: ${({theme:e,$bulletColor:t})=>e.colors[t]};
|
|
1019
|
+
}
|
|
1020
|
+
`,Oi=({hasDraftAndPublish:e,isPublished:t})=>{const{formatMessage:n}=(0,N.useIntl)();if(!e)return null;const a={draft:{textColor:"secondary700",bulletColor:"secondary600",box:{background:"secondary100",borderColor:"secondary200"}},published:{textColor:"success700",bulletColor:"success600",box:{background:"success100",borderColor:"success200"}}},s=t?a.published:a.draft;return r.createElement(D.Box,ib({hasRadius:!0,as:"aside",paddingTop:4,paddingBottom:4,paddingLeft:5,paddingRight:5},s.box),r.createElement(D.Box,{as:W.Flex},r.createElement(lb,{$bulletColor:s.bulletColor}),r.createElement(D.Box,{paddingLeft:3},r.createElement(x.Typography,{textColor:s.textColor},n({id:E("containers.Edit.information.editing"),defaultMessage:"Editing"}),"\xA0"),r.createElement(x.Typography,{fontWeight:"bold",textColor:s.textColor},t&&n({id:E("containers.Edit.information.publishedVersion"),defaultMessage:"published version"}),!t&&n({id:E("containers.Edit.information.draftVersion"),defaultMessage:"draft version"})))))};Oi.propTypes={hasDraftAndPublish:o().bool.isRequired,isPublished:o().bool.isRequired};const cb=tb(Oi,rb);var wr=p(27635);const Ir=60*1e3,Dr=Ir*60,un=Dr*24,Pi=un*30,Ri=un*365,ub=e=>e<Ir?{unit:"second",value:-Math.round(e/1e3)}:e<Dr?{unit:"minute",value:-Math.round(e/Ir)}:e<un?{unit:"hour",value:-Math.round(e/Dr)}:e<Pi?{unit:"day",value:-Math.round(e/un)}:e<Ri?{unit:"month",value:-Math.round(e/Pi)}:{unit:"year",value:-Math.round(e/Ri)};var Ti=p(7602);const db=()=>{const{formatMessage:e,formatRelativeTime:t}=(0,N.useIntl)(),{initialData:n,isCreatingEntry:a}=(0,y.useCMEditViewDataManager)(),s=(0,r.useRef)(Date.now()),i=(u,d)=>{var m,g,f;const h=((m=n[d])==null?void 0:m.firstname)||"",b=((g=n[d])==null?void 0:g.lastname)||"",S=((f=n[d])==null?void 0:f.username)||(0,Ti.Pp)(h,b),C=(n[u]?new Date(n[u]).getTime():Date.now())-s.current,{unit:B,value:T}=ub(-C);return{at:t(T,B,{numeric:"auto"}),by:a?"-":S}},l=i("updatedAt","updatedBy"),c=i("createdAt","createdBy");return r.createElement(D.Box,null,r.createElement(x.Typography,{variant:"sigma",textColor:"neutral600",id:"additional-informations"},e({id:E("containers.Edit.information"),defaultMessage:"Information"})),r.createElement(D.Box,{paddingTop:2,paddingBottom:6},r.createElement(wr.Divider,null)),r.createElement(ue.Stack,{spacing:4},r.createElement(W.Flex,{justifyContent:"space-between"},r.createElement(x.Typography,{fontWeight:"bold"},e({id:E("containers.Edit.information.created"),defaultMessage:"Created"})),r.createElement(x.Typography,null,c.at)),r.createElement(W.Flex,{justifyContent:"space-between"},r.createElement(x.Typography,{fontWeight:"bold"},e({id:E("containers.Edit.information.by"),defaultMessage:"By"})),r.createElement(x.Typography,null,c.by)),r.createElement(W.Flex,{justifyContent:"space-between"},r.createElement(x.Typography,{fontWeight:"bold"},e({id:E("containers.Edit.information.lastUpdate"),defaultMessage:"Last update"})),r.createElement(x.Typography,null,l.at)),r.createElement(W.Flex,{justifyContent:"space-between"},r.createElement(x.Typography,{fontWeight:"bold"},e({id:E("containers.Edit.information.by"),defaultMessage:"By"})),r.createElement(x.Typography,null,l.by))))};var pb=p(98599),dn=p.n(pb),je=p(49137),mb=p(88677),mt=p.n(mb),fb=Object.defineProperty,Mi=Object.getOwnPropertySymbols,gb=Object.prototype.hasOwnProperty,yb=Object.prototype.propertyIsEnumerable,wi=(e,t,n)=>t in e?fb(e,t,{enumerable:!0,configurable:!0,writable:!0,value:n}):e[t]=n,Ii=(e,t)=>{for(var n in t||(t={}))gb.call(t,n)&&wi(e,n,t[n]);if(Mi)for(var n of Mi(t))yb.call(t,n)&&wi(e,n,t[n]);return e};function hb(e,t){return n=>{const a=t();return r.createElement(e,Ii(Ii({},n),a))}}const bb=hb;function vb(){const{initialData:e,isCreatingEntry:t,isSingleType:n,status:a,layout:s,hasDraftAndPublish:i,modifiedData:l,onPublish:c,onUnpublish:u,publishConfirmation:d,onPublishPromptDismissal:m}=(0,y.useCMEditViewDataManager)();return{initialData:e,isCreatingEntry:t,isSingleType:n,status:a,layout:s,hasDraftAndPublish:i,modifiedData:l,onPublish:c,onUnpublish:u,publishConfirmation:d,onPublishPromptDismissal:m}}const Eb=vb,Di=(0,L.default)(W.Flex)`
|
|
1021
|
+
text-align: center;
|
|
1022
|
+
`,Si=({allowedActions:{canUpdate:e,canCreate:t,canPublish:n},initialData:a,isCreatingEntry:s,isSingleType:i,hasDraftAndPublish:l,layout:c,modifiedData:u,onPublish:d,onUnpublish:m,status:g,publishConfirmation:{show:f,draftCount:h},onPublishPromptDismissal:b})=>{const{goBack:v}=(0,oe.useHistory)(),[S,O]=(0,r.useState)(!1),{formatMessage:C}=(0,N.useIntl)(),B=w()(c,["settings","mainField"],"id"),T=w()(c,["info","displayName"],"NOT FOUND"),M=!on()(a,u)||s&&!Se()(u);let A=C({id:E("containers.Edit.pluginHeader.title.new"),defaultMessage:"Create an entry"});!s&&!i&&(A=a[B]||T),i&&(A=T);let H=null;if(s&&t&&(H=r.createElement(ue.Stack,{horizontal:!0,spacing:2},l&&r.createElement(be.Button,{disabled:!0,startIcon:r.createElement(mt(),null),variant:"secondary"},C({id:"app.utils.publish",defaultMessage:"Publish"})),r.createElement(be.Button,{disabled:!M,isLoading:g==="submit-pending",type:"submit"},C({id:E("containers.Edit.submit"),defaultMessage:"Save"})))),!s&&e){const U=l&&n,F=!Se()(a.publishedAt),I=F?g==="unpublish-pending":g==="publish-pending",K=F?{id:"app.utils.unpublish",defaultMessage:"Unpublish"}:{id:"app.utils.publish",defaultMessage:"Publish"},$=F?()=>O(!0):()=>d();H=r.createElement(W.Flex,null,U&&r.createElement(be.Button,{disabled:M,loading:I,onClick:$,startIcon:r.createElement(mt(),null),variant:"secondary"},C(K)),r.createElement(D.Box,{paddingLeft:U?2:0},r.createElement(be.Button,{disabled:!M,loading:g==="submit-pending",type:"submit"},C({id:E("containers.Edit.submit"),defaultMessage:"Save"}))))}const Q=()=>O(U=>!U),j=()=>{Q(),m()},G=`${C({id:E("api.id"),defaultMessage:"API ID "})} : ${c.apiID}`;return r.createElement(r.Fragment,null,r.createElement(ee.HeaderLayout,{title:A.toString(),primaryAction:H,subtitle:G,navigationAction:r.createElement(y.Link,{startIcon:r.createElement(dn(),null),onClick:U=>{U.preventDefault(),v()},to:"/"},C({id:"global.back",defaultMessage:"Back"}))}),r.createElement(je.Dialog,{onClose:Q,title:"Confirmation",labelledBy:"confirmation",describedBy:"confirm-description",isOpen:S},r.createElement(je.DialogBody,{icon:r.createElement(Pt(),null)},r.createElement(ue.Stack,{spacing:2},r.createElement(W.Flex,{justifyContent:"center",style:{textAlign:"center"}},r.createElement(x.Typography,{id:"confirm-description"},C({id:E("popUpWarning.warning.unpublish"),defaultMessage:"Unpublish this content will automatically change it to a draft."},{br:()=>r.createElement("br",null)}))),r.createElement(W.Flex,{justifyContent:"center",style:{textAlign:"center"}},r.createElement(x.Typography,{id:"confirm-description"},C({id:E("popUpWarning.warning.unpublish-question"),defaultMessage:"Are you sure you want to unpublish it?"}))))),r.createElement(je.DialogFooter,{startAction:r.createElement(be.Button,{onClick:Q,variant:"tertiary"},C({id:"components.popUpWarning.button.cancel",defaultMessage:"Cancel"})),endAction:r.createElement(be.Button,{variant:"danger-light",onClick:j},C({id:"components.popUpWarning.button.confirm",defaultMessage:"Confirm"}))})),r.createElement(je.Dialog,{onClose:b,title:C({id:E("popUpWarning.warning.has-draft-relations.title"),defaultMessage:"Confirmation"}),labelledBy:"confirmation",describedBy:"confirm-description",isOpen:f},r.createElement(je.DialogBody,{icon:r.createElement(Pt(),null)},r.createElement(ue.Stack,{spacing:2},r.createElement(Di,{justifyContent:"center"},r.createElement(x.Typography,{id:"confirm-description"},h,C({id:E("popUpwarning.warning.has-draft-relations.message"),defaultMessage:"<b>{count, plural, one { relation is} other { relations are}}</b> not published yet and might lead to unexpected behavior."},{b:U=>r.createElement(x.Typography,{fontWeight:"bold"},U),count:h}))),r.createElement(Di,{justifyContent:"center"},r.createElement(x.Typography,{id:"confirm-description"},C({id:E("popUpWarning.warning.publish-question"),defaultMessage:"Do you still want to publish?"}))))),r.createElement(je.DialogFooter,{startAction:r.createElement(be.Button,{onClick:b,variant:"tertiary"},C({id:"components.popUpWarning.button.cancel",defaultMessage:"Cancel"})),endAction:r.createElement(be.Button,{variant:"success",onClick:d},C({id:E("popUpwarning.warning.has-draft-relations.button-confirm"),defaultMessage:"Publish"}))})))};Si.propTypes={allowedActions:o().shape({canUpdate:o().bool.isRequired,canCreate:o().bool.isRequired,canPublish:o().bool.isRequired}).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,publishConfirmation:o().shape({show:o().bool.isRequired,draftCount:o().number.isRequired}).isRequired,onPublishPromptDismissal:o().func.isRequired};const Cb=(0,r.memo)(Si,Ue()),Ob=bb(Cb,Eb),Pb=(e,t)=>{const n=i=>(0,X.get)(t,[i,"type"],"");let a=0;const s=[];for(let i of e){const l=i.some(({name:c})=>n(c)==="dynamiczone");s[a]||(s[a]=[]),l?(a=a===0&&(0,X.isEmpty)(s[0])?0:a+1,s[a]||(s[a]=[]),s[a].push(i),a+=1):s[a].push(i)}return s.filter(i=>i.length>0)},Rb=(e,t)=>{const n=a=>{const s=(0,y.findMatchingPermissions)(e,[{action:`plugin::content-manager.explorer.${a}`,subject:t}]);return(0,X.uniq)((0,X.flatMap)(s,"properties.fields"))};return{createActionAllowedFields:n("create"),readActionAllowedFields:n("read"),updateActionAllowedFields:n("update")}};var Tb=Object.defineProperty,Li=Object.getOwnPropertySymbols,Mb=Object.prototype.hasOwnProperty,wb=Object.prototype.propertyIsEnumerable,xi=(e,t,n)=>t in e?Tb(e,t,{enumerable:!0,configurable:!0,writable:!0,value:n}):e[t]=n,Fi=(e,t)=>{for(var n in t||(t={}))Mb.call(t,n)&&xi(e,n,t[n]);if(Li)for(var n of Li(t))wb.call(t,n)&&xi(e,n,t[n]);return e};function Ib(e,t){return n=>{const a=t();return r.createElement(e,Fi(Fi({},n),a))}}const Db=Ib;function Sb(){const{hasDraftAndPublish:e,modifiedData:t}=(0,y.useCMEditViewDataManager)();let n={};return e&&(n=(0,X.isEmpty)(t.publishedAt)?{status:"draft"}:{status:"published"}),{hasDraftAndPublish:e,trackerProperty:n}}const Lb=Sb;var xb=(e,t,n)=>new Promise((a,s)=>{var i=u=>{try{c(n.next(u))}catch(d){s(d)}},l=u=>{try{c(n.throw(u))}catch(d){s(d)}},c=u=>u.done?a(u.value):Promise.resolve(u.value).then(i,l);c((n=n.apply(e,t)).next())});const ki=({isCreatingEntry:e,onDelete:t,onDeleteSucceeded:n,trackerProperty:a})=>{const[s,i]=(0,r.useState)(!1),[l,c]=(0,r.useState)(!1),{formatMessage:u}=(0,N.useIntl)(),d=(0,y.useNotification)(),m=()=>i(f=>!f),g=()=>xb(void 0,null,function*(){try{c(!0),yield t(a),c(!1),m(),n()}catch(f){const h=w()(f,"response.payload.message",u({id:E("error.record.delete")}));c(!1),m(),d({type:"warning",message:h})}});return e?null:r.createElement(r.Fragment,null,r.createElement(be.Button,{onClick:m,size:"S",startIcon:r.createElement(Ne(),null),variant:"danger-light"},u({id:E("containers.Edit.delete-entry"),defaultMessage:"Delete this entry"})),r.createElement(y.ConfirmDialog,{isConfirmButtonLoading:l,isOpen:s,onConfirm:g,onToggleDialog:m}))};ki.propTypes={isCreatingEntry:o().bool.isRequired,onDelete:o().func.isRequired,onDeleteSucceeded:o().func.isRequired,trackerProperty:o().object.isRequired};const Fb=(0,r.memo)(ki,Ue()),kb=Db(Fb,Lb),Ai=Ie.Z.contentManager,Ab=[{action:"plugin::content-type-builder.read",subject:null}],Sr=({allowedActions:e,isSingleType:t,goBack:n,layout:a,slug:s,id:i,origin:l,userPermissions:c})=>{const{trackUsage:u}=(0,y.useTracking)(),{formatMessage:d}=(0,N.useIntl)(),{createActionAllowedFields:m,readActionAllowedFields:g,updateActionAllowedFields:f}=(0,r.useMemo)(()=>Rb(c,s),[c,s]),h=(0,r.useMemo)(()=>t?Ai.singleTypesConfigurations:Ai.collectionTypesConfigurations,[t]),b=`/content-manager/${t?"singleType":"collectionType"}/${s}/configurations/edit`,v=w()(a,["contentType"],{}),S=(0,r.useMemo)(()=>t?Zh:ih,[t]),O=(0,r.useCallback)(B=>B.every(T=>T.every(M=>M.fieldSchema.type==="dynamiczone")),[]),C=(0,r.useMemo)(()=>v.layouts?Pb(v.layouts.edit,v.attributes):[],[v]);return r.createElement(S,{allLayoutData:a,slug:s,id:i,origin:l},({componentsDataStructure:B,contentTypeDataStructure:T,data:M,isCreatingEntry:V,isLoadingForData:A,onDelete:H,onDeleteSucceeded:Q,onPost:j,onPublish:G,onDraftRelationCheck:U,onPut:F,onUnpublish:I,redirectionLink:K,status:$})=>r.createElement(Vh,{allowedActions:e,allLayoutData:a,createActionAllowedFields:m,componentsDataStructure:B,contentTypeDataStructure:T,from:K,initialValues:M,isCreatingEntry:V,isLoadingForData:A,isSingleType:t,onPost:j,onPublish:G,onDraftRelationCheck:U,onPut:F,onUnpublish:I,readActionAllowedFields:g,redirectToPreviousPage:n,slug:s,status:$,updateActionAllowedFields:f},r.createElement(ie.Main,{"aria-busy":$!=="resolved"},r.createElement(Ob,{allowedActions:e}),r.createElement(ee.ContentLayout,null,r.createElement(de.Grid,{gap:4},r.createElement(de.GridItem,{col:9,s:12},r.createElement(r.Suspense,{fallback:r.createElement(y.LoadingIndicatorPage,null)},r.createElement(ue.Stack,{spacing:6},C.map((Z,q)=>{if(O(Z)){const{0:{0:{name:k,fieldSchema:R,metadatas:P,labelAction:z}}}=Z;return r.createElement(D.Box,{key:q},r.createElement(de.Grid,{gap:4},r.createElement(de.GridItem,{col:12,s:12,xs:12},r.createElement(th,{name:k,fieldSchema:R,labelAction:z,metadatas:P}))))}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(ue.Stack,{spacing:6},Z.map((k,R)=>r.createElement(de.Grid,{gap:4,key:R},k.map(({fieldSchema:P,labelAction:z,metadatas:Y,name:se,size:ae,queryInfos:_})=>{if(P.type==="component"){const{component:Pe,max:Ce,min:xe,repeatable:Ke=!1,required:$e=!1}=P;return r.createElement(de.GridItem,{col:ae,s:12,xs:12,key:Pe},r.createElement(nn,{componentUid:Pe,labelAction:z,isRepeatable:Ke,intlLabel:{id:Y.label,defaultMessage:Y.label},max:Ce,min:xe,name:se,required:$e}))}return r.createElement(de.GridItem,{col:ae,key:se,s:12,xs:12},r.createElement(cr,{size:ae,fieldSchema:P,keys:se,labelAction:z,metadatas:Y,queryInfos:_}))})))))})))),r.createElement(de.GridItem,{col:3,s:12},r.createElement(ue.Stack,{spacing:2},r.createElement(cb,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(db,null),r.createElement(Ht,{area:"contentManager.editView.informations"})),r.createElement(D.Box,{as:"aside","aria-labelledby":"links"},r.createElement(ue.Stack,{spacing:2},r.createElement(Ht,{area:"contentManager.editView.right-links",slug:s}),s!=="strapi::administrator"&&r.createElement(y.CheckPermissions,{permissions:Ab},r.createElement(y.LinkButton,{onClick:()=>{u("willEditEditLayout")},size:"S",startIcon:r.createElement(ct(),null),style:{width:"100%"},to:`/plugins/content-type-builder/content-types/${s}`,variant:"secondary"},d({id:E("link-to-ctb"),defaultMessage:"Edit the model"}))),r.createElement(y.CheckPermissions,{permissions:h},r.createElement(y.LinkButton,{size:"S",startIcon:r.createElement(sd(),null),style:{width:"100%"},to:b,variant:"secondary"},d({id:"app.links.configure-view",defaultMessage:"Configure the view"}))),e.canDelete&&r.createElement(kb,{isCreatingEntry:V,onDelete:H,onDeleteSucceeded:Q}))))))))))};Sr.defaultProps={id:null,isSingleType:!1,origin:null,userPermissions:[]},Sr.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 jb=(0,r.memo)(Sr);var $b=Object.defineProperty,Bb=Object.defineProperties,Nb=Object.getOwnPropertyDescriptors,ji=Object.getOwnPropertySymbols,Vb=Object.prototype.hasOwnProperty,qb=Object.prototype.propertyIsEnumerable,$i=(e,t,n)=>t in e?$b(e,t,{enumerable:!0,configurable:!0,writable:!0,value:n}):e[t]=n,zb=(e,t)=>{for(var n in t||(t={}))Vb.call(t,n)&&$i(e,n,t[n]);if(ji)for(var n of ji(t))qb.call(t,n)&&$i(e,n,t[n]);return e},Wb=(e,t)=>Bb(e,Nb(t));const Lr=e=>{const t=(0,r.useMemo)(()=>Oo(e.slug),[e.slug]),{isLoading:n,allowedActions:a}=(0,y.useRBAC)(t,e.userPermissions);return n?r.createElement(y.LoadingIndicatorPage,null):r.createElement(jb,Wb(zb({},e),{allowedActions:a}))};Lr.defaultProps={permissions:[]},Lr.propTypes={permissions:o().array,slug:o().string.isRequired,userPermissions:o().array.isRequired};const Ub=(0,r.memo)(Lr,Ue());var _b=Object.defineProperty,Hb=Object.defineProperties,Gb=Object.getOwnPropertyDescriptors,pn=Object.getOwnPropertySymbols,Bi=Object.prototype.hasOwnProperty,Ni=Object.prototype.propertyIsEnumerable,Vi=(e,t,n)=>t in e?_b(e,t,{enumerable:!0,configurable:!0,writable:!0,value:n}):e[t]=n,Zb=(e,t)=>{for(var n in t||(t={}))Bi.call(t,n)&&Vi(e,n,t[n]);if(pn)for(var n of pn(t))Ni.call(t,n)&&Vi(e,n,t[n]);return e},Qb=(e,t)=>Hb(e,Gb(t)),Jb=(e,t)=>{var n={};for(var a in e)Bi.call(e,a)&&t.indexOf(a)<0&&(n[a]=e[a]);if(e!=null&&pn)for(var a of pn(e))t.indexOf(a)<0&&Ni.call(e,a)&&(n[a]=e[a]);return n};const qi=e=>{var t=e,{layout:n}=t,a=Jb(t,["layout"]);const s=(0,he.useSelector)(po),i=(0,he.useDispatch)(),[{query:l}]=(0,y.useQueryParams)(),{runHookWaterfall:c}=(0,y.useStrapiApp)(),u=Jo(l,a.slug,"editView");return(0,r.useEffect)(()=>{const d=c(Ut.Eo,{layout:n,query:l});return i(rd(d.layout,l)),()=>{i(nd())}},[n,i,l,c]),!s||!u?r.createElement(y.LoadingIndicatorPage,null):r.createElement(Ub,Qb(Zb({},a),{layout:s,userPermissions:u}))};qi.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 mn=qi;var Kb=p(23940),wt=p.n(Kb),Yb=p(88423),zi=p.n(Yb),Xb=p(3704),ev=p.n(Xb),tv=Object.defineProperty,nv=Object.defineProperties,rv=Object.getOwnPropertyDescriptors,Wi=Object.getOwnPropertySymbols,ov=Object.prototype.hasOwnProperty,av=Object.prototype.propertyIsEnumerable,Ui=(e,t,n)=>t in e?tv(e,t,{enumerable:!0,configurable:!0,writable:!0,value:n}):e[t]=n,sv=(e,t)=>{for(var n in t||(t={}))ov.call(t,n)&&Ui(e,n,t[n]);if(Wi)for(var n of Wi(t))av.call(t,n)&&Ui(e,n,t[n]);return e},iv=(e,t)=>nv(e,rv(t));const xr=e=>e.reduce((t,n)=>t+n.size,0),lv=e=>e.reduce((t,n,a)=>{const s={rowId:a,rowContent:n};return t.concat(s)},[]),ft=e=>e.reduce((t,n)=>{let a=[];const s=n.rowContent.reduce((c,u)=>{const d=xr(c);return u.name==="_TEMP_"||(d+u.size<=12?c.push(u):a.push(u)),c},[]),i=t.length===0?0:Math.max.apply(Math,t.map(c=>c.rowId))+1,l=xr(s);if(l<12&&s.push({name:"_TEMP_",size:12-l}),t.push({rowId:i,rowContent:s}),a.length>0){const c=xr(a);c<12&&a.push({name:"_TEMP_",size:12-c}),t.push({rowId:i+1,rowContent:a}),a=[]}return t},[]).filter(t=>t.rowContent.length>0).filter(t=>t.rowContent.length===1?t.rowContent[0].name!=="_TEMP_":!0),cv=e=>e.reduce((t,n)=>{const a=n.rowContent.filter(s=>s.name!=="_TEMP_");return t.concat([a])},[]),_i=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}},uv=(e,t=[])=>t.reduce((n,{rowContent:a})=>{var s,i;const l=(i=(s=a.find(c=>c.name===e))==null?void 0:s.size)!=null?i:null;return l&&(n=l),n},null),dv=(e,t,n=[])=>n.map(a=>(a.rowContent=a.rowContent.map(s=>s.name===e?iv(sv({},s),{size:t}):s),a)),Fr={fieldForm:{},componentLayouts:{},metaToEdit:"",initialData:{},metaForm:{},modifiedData:{}},pv=(e=Fr,t)=>(0,zt.default)(e,n=>{var a,s,i;const l=["modifiedData","layouts","edit"];switch(t.type){case"MOVE_ROW":{const c=w()(e,l,[]),{fromIndex:u,toIndex:d}=t;te()(n,l,$t(c,u,d));break}case"ON_ADD_FIELD":{const c=ze()(e),u=_i(w()(c,["modifiedData","attributes",t.name,"type"],"")),d=w()(c,l,[]).length,m=[...l,d-1,"rowContent"],g=w()(c,m,[]);let f=w()(c,l,[]);Array.isArray(g)?te()(f,[d>0?d-1:0,"rowContent"],[...g,{name:t.name,size:u}]):te()(f,[d>0?d-1:0,"rowContent"],[{name:t.name,size:u}]);const h=ft(f);te()(n,l,h);break}case"ON_CHANGE":{te()(n,["modifiedData",...t.keys],t.value);break}case"ON_CHANGE_META":{te()(n,["metaForm","metadata",...t.keys],t.value);break}case"ON_CHANGE_SIZE":{te()(n,["metaForm","size"],t.value);break}case"ON_RESET":{n.modifiedData=e.initialData;break}case"REMOVE_FIELD":{const c=w()(e,[...l,t.rowIndex,"rowContent"],[]);let u=ze()(e);if(c.length===1||c.length===2&&w()(c,[1,"name"],"")==="_TEMP_"){const m=w()(e,l,[]);te()(u,l,m.filter((g,f)=>t.rowIndex!==f))}else te()(u,[...l,t.rowIndex,"rowContent"],c.filter((m,g)=>g!==t.fieldIndex));const d=ft(w()(u,l,[]));te()(n,l,d);break}case"REORDER_DIFF_ROW":{const c=w()(e,[...l,t.dragRowIndex,"rowContent"],[]),u=w()(e,[...l,t.hoverRowIndex,"rowContent"],[]),d=w()(e,[...l,t.dragRowIndex,"rowContent",t.dragIndex],{}),m=[...u,d];let g=ze()(e);te()(g,[...l,t.dragRowIndex,"rowContent"],c.filter((h,b)=>t.dragIndex!==b)),te()(g,[...l,t.hoverRowIndex,"rowContent"],$t(m,m.length-1,t.hoverIndex));const f=ft(w()(g,l,[]));te()(n,l,f);break}case"REORDER_ROW":{const c=ze()(e),u=w()(c,[...l,t.dragRowIndex,"rowContent"],[]);te()(c,[...l,t.dragRowIndex,"rowContent"],$t(u,t.dragIndex,t.hoverIndex));const d=ft(w()(c,l,[]));te()(n,l,d);break}case"SET_FIELD_TO_EDIT":{n.metaToEdit=t.name,n.metaForm={metadata:w()(e,["modifiedData","metadatas",t.name,"edit"],{}),size:(i=uv(t.name,(s=(a=e.modifiedData)==null?void 0:a.layouts)==null?void 0:s.edit))!=null?i:_i()};break}case"SUBMIT_META_FORM":{te()(n,["modifiedData","metadatas",e.metaToEdit,"edit"],e.metaForm.metadata);const c=ze()(w()(e,l,[])),u=dv(e.metaToEdit,e.metaForm.size,c);u.length>0&&te()(n,l,ft(u));break}case"SUBMIT_SUCCEEDED":{n.initialData=e.modifiedData;break}case"UNSET_FIELD_TO_EDIT":{n.metaToEdit="",n.metaForm={};break}default:return n}});var mv=Object.defineProperty,fv=Object.defineProperties,gv=Object.getOwnPropertyDescriptors,Hi=Object.getOwnPropertySymbols,yv=Object.prototype.hasOwnProperty,hv=Object.prototype.propertyIsEnumerable,Gi=(e,t,n)=>t in e?mv(e,t,{enumerable:!0,configurable:!0,writable:!0,value:n}):e[t]=n,bv=(e,t)=>{for(var n in t||(t={}))yv.call(t,n)&&Gi(e,n,t[n]);if(Hi)for(var n of Hi(t))hv.call(t,n)&&Gi(e,n,t[n]);return e},vv=(e,t)=>fv(e,gv(t));const Ev=(e,t,n)=>{let a=(0,X.cloneDeep)(t);return(0,X.set)(a,["layouts","edit"],ft(lv(t.layouts.edit))),vv(bv({},e),{initialData:a,modifiedData:a,componentLayouts:n})};var Ve=p(12611),Cv=p(42258),Zi=p.n(Cv);const Qi=({componentUid:e})=>{const{componentLayouts:t}=et(),{formatMessage:n}=(0,N.useIntl)(),a=w()(t,[e],{}),s=w()(a,["layouts","edit"],[]);return r.createElement(D.Box,{padding:3},s.map((i,l)=>r.createElement(de.Grid,{gap:4,key:l},i.map(c=>r.createElement(de.GridItem,{key:c.name,col:c.size},r.createElement(D.Box,{paddingTop:2},r.createElement(W.Flex,{alignItems:"center",background:"neutral0",paddingLeft:3,paddingRight:3,height:`${32/16}rem`,hasRadius:!0,borderColor:"neutral200"},r.createElement(x.Typography,{textColor:"neutral800"},c.name))))))),r.createElement(D.Box,{paddingTop:2},r.createElement(y.Link,{startIcon:r.createElement(Zi(),null),to:`/content-manager/components/${e}/configurations/edit`},n({id:E("components.FieldItem.linkToComponentLayout"),defaultMessage:"Set the component's layout"}))))};Qi.propTypes={componentUid:o().string.isRequired};const Ov=Qi,Ji=(0,L.default)(W.Flex)`
|
|
1023
|
+
border-radius: 50%;
|
|
1024
|
+
svg {
|
|
1025
|
+
& > * {
|
|
1026
|
+
fill: ${({theme:e})=>e.colors.neutral500};
|
|
1027
|
+
}
|
|
1028
|
+
width: 12px;
|
|
1029
|
+
height: 12px;
|
|
1030
|
+
}
|
|
1031
|
+
`,Pv=(0,L.default)(W.Flex)`
|
|
1032
|
+
text-decoration: none;
|
|
1033
|
+
&:hover {
|
|
1034
|
+
${({theme:e})=>`
|
|
1035
|
+
background: ${e.colors.primary100};
|
|
1036
|
+
svg {
|
|
1037
|
+
& > * {
|
|
1038
|
+
fill: ${e.colors.primary600};
|
|
1039
|
+
}
|
|
1040
|
+
}
|
|
1041
|
+
${x.Typography} {
|
|
1042
|
+
color: ${e.colors.primary600};
|
|
1043
|
+
}
|
|
1044
|
+
${Ji} {
|
|
1045
|
+
background: ${e.colors.primary200};
|
|
1046
|
+
}
|
|
1047
|
+
border-color: ${e.colors.primary200};
|
|
1048
|
+
`}
|
|
1049
|
+
}
|
|
1050
|
+
`,Ki=({components:e})=>{const{componentLayouts:t}=et();return r.createElement(ue.Stack,{spacing:2,horizontal:!0,overflow:"scroll hidden",padding:3},e.map(n=>r.createElement(Pv,{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:oe.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(An.G,{icon:w()(t,[n,"info","icon"],"")})),r.createElement(D.Box,{paddingTop:1},r.createElement(x.Typography,{fontSize:1,textColor:"neutral600",fontWeight:"bold"},w()(t,[n,"info","displayName"],""))))))};Ki.propTypes={components:o().arrayOf(o().string).isRequired};const Rv=Ki,Yi=(0,L.default)(Te.IconButton)`
|
|
1051
|
+
background-color: transparent;
|
|
1052
|
+
path {
|
|
1053
|
+
fill: ${({theme:e})=>e.colors.neutral600};
|
|
1054
|
+
}
|
|
1055
|
+
`,kr=({attribute:e,onEditField:t,onDeleteField:n,children:a})=>{const{formatMessage:s}=(0,N.useIntl)();return r.createElement(D.Box,{overflow:"hidden",width:"100%"},r.createElement(W.Flex,{paddingLeft:3,alignItems:"center",justifyContent:"space-between"},r.createElement(x.Typography,{fontWeight:"semiBold",textColor:"neutral800",ellipsis:!0},a),r.createElement(W.Flex,null,r.createElement(Yi,{label:s({id:E("containers.ListSettingsView.modal-form.edit-label"),defaultMessage:"Edit {fieldName}"},{fieldName:a}),onClick:t,icon:r.createElement(ct(),null),noBorder:!0}),r.createElement(Yi,{label:s({id:"global.delete-target",defaultMessage:"Delete {target}"},{target:a}),"data-testid":"delete-field",onClick:n,icon:r.createElement(Ne(),null),noBorder:!0}))),(e==null?void 0:e.type)==="component"&&r.createElement(Ov,{componentUid:e.component}),(e==null?void 0:e.type)==="dynamiczone"&&r.createElement(Rv,{components:e.components}))};kr.defaultProps={attribute:void 0},kr.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 Tv=kr,Mv=(0,L.default)(W.Flex)`
|
|
1056
|
+
position: relative;
|
|
1057
|
+
${({isFirst:e,isLast:t,hasHorizontalPadding:n})=>e?`
|
|
1058
|
+
padding-right: 4px;
|
|
1059
|
+
`:t?`
|
|
1060
|
+
padding-left: 4px;
|
|
1061
|
+
`:n?`
|
|
1062
|
+
padding: 0 4px;
|
|
1063
|
+
`:""}
|
|
1064
|
+
${({showRightCarret:e,showLeftCarret:t,theme:n})=>e?`
|
|
1065
|
+
&:after {
|
|
1066
|
+
content: '';
|
|
1067
|
+
position: absolute;
|
|
1068
|
+
right: -1px;
|
|
1069
|
+
background-color: ${n.colors.primary600};
|
|
1070
|
+
width: 2px;
|
|
1071
|
+
height: 100%;
|
|
1072
|
+
align-self: stretch;
|
|
1073
|
+
z-index: 1;
|
|
1074
|
+
}
|
|
1075
|
+
`:t?`
|
|
1076
|
+
&:before {
|
|
1077
|
+
content: '';
|
|
1078
|
+
position: absolute;
|
|
1079
|
+
left: -1px;
|
|
1080
|
+
background-color: ${n.colors.primary600};
|
|
1081
|
+
width: 2px;
|
|
1082
|
+
height: 100%;
|
|
1083
|
+
align-self: stretch;
|
|
1084
|
+
z-index: 1;
|
|
1085
|
+
}
|
|
1086
|
+
`:""};
|
|
1087
|
+
`,wv=(0,L.default)(lt())`
|
|
1088
|
+
height: ${12/16}rem;
|
|
1089
|
+
width: ${12/16}rem;
|
|
1090
|
+
path {
|
|
1091
|
+
fill: ${({theme:e})=>e.colors.neutral600};
|
|
1092
|
+
}
|
|
1093
|
+
`,Iv=(0,L.default)(W.Flex)`
|
|
1094
|
+
display: ${({dragStart:e})=>e?"none":"flex"};
|
|
1095
|
+
opacity: ${({isDragging:e,isFullSize:t,isHidden:n})=>e&&!t?.2:e&&t||n?0:1};
|
|
1096
|
+
`,Dv=(0,L.default)(W.Flex)`
|
|
1097
|
+
cursor: all-scroll;
|
|
1098
|
+
border-right: 1px solid ${({theme:e})=>e.colors.neutral200};
|
|
1099
|
+
`,Ar=({attribute:e,children:t,index:n,lastIndex:a,moveItem:s,moveRow:i,name:l,onDeleteField:c,onEditField:u,rowIndex:d,size:m})=>{const[g,f]=(0,r.useState)(!1),h=l==="_TEMP_",{setIsDraggingSibling:b}=et(),v=m===12,S=(0,r.useRef)(null),O=(0,r.useRef)(null),[{clientOffset:C,isOver:B},T]=(0,Le.useDrop)({accept:Re.EDIT_FIELD,hover($,Z){if(!O.current||$.size!==12)return;const q=Z.getItem().index,k=n,R=Z.getItem().rowIndex,P=d;if(q===k&&R===P)return;const z=O.current.getBoundingClientRect(),Y=(z.bottom-z.top)/2,ae=Z.getClientOffset().y-z.top;R<P&&ae<Y||R>P&&ae>Y||(i(R,P),$.rowIndex=P,$.itemIndex=k)},drop($,Z){if(!O.current)return;const q=Z.getItem().index,k=n,R=Z.getItem().rowIndex,P=d;if($.size===12||q===k&&R===P)return;const z=O.current.getBoundingClientRect();if(Math.abs(Z.getClientOffset().x-z.left)>z.width/1.8){s(q,k+1,R,P),$.itemIndex=k+1,$.rowIndex=P;return}s(q,k,R,P),$.itemIndex=k,$.rowIndex=P},collect:$=>({canDrop:$.canDrop(),clientOffset:$.getClientOffset(),isOver:$.isOver(),isOverCurrent:$.isOver({shallow:!0}),itemType:$.getItemType()})}),[{isDragging:M,getItem:V},A,H]=(0,Le.useDrag)({type:Re.EDIT_FIELD,item(){return b(!0),{index:n,labelField:t,rowIndex:d,name:l,size:m}},canDrag(){return l!=="_TEMP_"},collect:$=>({isDragging:$.isDragging(),getItem:$.getItem()}),end(){b(!1)}});(0,r.useEffect)(()=>{H((0,dr.rX)(),{captureDraggingState:!0})},[H]);const Q={dragRef:A(S),dropRef:T(O)};let j=!1,G=!1;if(O.current&&C){const $=O.current.getBoundingClientRect();j=B&&V.size!==12&&Math.abs(C.x-$.left)<$.width/2,G=B&&V.size!==12&&Math.abs(C.x-$.left)>$.width/2,l==="_TEMP_"&&(j=B&&V.size!==12,G=!1)}const U=()=>e&&v?`${74/16}rem`:`${32/16}rem`,F=n===0&&!v,I=n===a&&!v,K=n!==0&&!v;return r.createElement(de.GridItem,{col:m},r.createElement(Mv,{ref:Q.dropRef,showLeftCarret:j,showRightCarret:G,isFirst:F,isLast:I,hasHorizontalPadding:K,onDrag:()=>{v&&!g&&f(!0)},onDragEnd:()=>{v&&f(!1)}},g&&v&&r.createElement(D.Box,{width:"100%",height:"2px",background:"primary600"}),r.createElement(Iv,{width:v&&g?0:"100%",borderColor:"neutral150",hasRadius:!0,background:"neutral100",minHeight:U(),alignItems:"stretch",isDragging:M,dragStart:g,isFullSize:v,isHidden:h},r.createElement(Dv,{as:"span",type:"button",ref:Q.dragRef,onClick:$=>$.stopPropagation(),alignItems:"center",paddingLeft:3,paddingRight:3,tabIndex:-1},r.createElement(wv,null)),!h&&r.createElement(Tv,{attribute:e,onEditField:u,onDeleteField:c},t))))};Ar.defaultProps={attribute:void 0},Ar.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 Sv=Ar,Xi=({rowItem:e,onRemoveField:t,rowId:n,rowIndex:a,index:s,lastIndex:i})=>{const{setEditFieldToSelect:l,attributes:c,modifiedData:u,moveRow:d,moveItem:m}=et(),g=w()(c,[e.name],{}),f=w()(u,["metadatas",e.name,"edit","label"],"");return r.createElement(Sv,{onEditField:()=>l(e.name),onDeleteField:()=>t(n,s),attribute:g,index:s,lastIndex:i,rowIndex:a,name:e.name,size:e.size,moveRow:d,moveItem:m},f||e.name)};Xi.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 Lv=Xi,el=({row:e,onRemoveField:t,rowIndex:n})=>r.createElement(de.Grid,null,e.rowContent.map((a,s)=>r.createElement(Lv,{key:a.name,rowItem:a,index:s,rowId:e.rowId,onRemoveField:t,rowIndex:n,lastIndex:e.rowContent.length-1})));el.propTypes={onRemoveField:o().func.isRequired,row:o().object.isRequired,rowIndex:o().number.isRequired};const xv=el,Fv=[{action:"plugin::content-type-builder.read",subject:null}],kv=()=>{const{trackUsage:e}=(0,y.useTracking)(),{formatMessage:t}=(0,N.useIntl)(),{slug:n,modifiedData:a,isContentTypeView:s}=et(),i=s?"content-types":"components",l=`/plugins/content-type-builder/${i==="content-types"?i:"component-categories"}`,c=w()(a,"category",""),u=i==="content-types"?n:`${c}/${n}`,d=()=>{e("willEditEditLayout")};return n==="strapi::administrator"?null:r.createElement(y.CheckPermissions,{permissions:Fv},r.createElement(y.LinkButton,{to:`${l}/${u}`,onClick:d,size:"S",startIcon:r.createElement(ct(),null),variant:"secondary"},t({id:E(`edit-settings-view.link-to-ctb.${i}`),defaultMessage:"Edit the content type"})))},tl=({editLayout:e,fields:t,onRemoveField:n,onAddField:a})=>{const{formatMessage:s}=(0,N.useIntl)();return r.createElement(ue.Stack,{spacing:4},r.createElement(W.Flex,{justifyContent:"space-between"},r.createElement("div",null,r.createElement(D.Box,null,r.createElement(x.Typography,{fontWeight:"bold"},s({id:E("containers.ListPage.displayedFields"),defaultMessage:"Displayed fields"}))),r.createElement(D.Box,null,r.createElement(x.Typography,{variant:"pi",textColor:"neutral600"},s({id:"containers.SettingPage.editSettings.description",defaultMessage:"Drag & drop the fields to build the layout"})))),r.createElement(kv,null)),r.createElement(D.Box,{padding:4,hasRadius:!0,borderStyle:"dashed",borderWidth:"1px",borderColor:"neutral300"},r.createElement(ue.Stack,{spacing:2},e.map((i,l)=>r.createElement(xv,{key:i.rowId,row:i,rowIndex:l,onRemoveField:n})),r.createElement(Ve.SimpleMenu,{id:"label",label:s({id:E("containers.SettingPage.add.field"),defaultMessage:"Insert another field"}),as:be.Button,"data-testid":"add-field",fullWidth:!0,startIcon:r.createElement(Tt(),null),endIcon:null,variant:"secondary",disabled:t.length===0},t.map(i=>r.createElement(Ve.MenuItem,{key:i,onClick:()=>a(i)},i))))))};tl.propTypes={editLayout:o().array.isRequired,fields:o().array.isRequired,onAddField:o().func.isRequired,onRemoveField:o().func.isRequired};const Av=tl;var Je=p(4122),jv=p(61714),fn=p.n(jv),$v=p(9895),Bv=p.n($v),Nv=p(34103),Vv=p.n(Nv),qv=p(57290),nl=p.n(qv),zv=p(55788),jr=p.n(zv),Wv=p(81208),Uv=p.n(Wv),_v=p(65232),$r=p.n(_v),Hv=p(80268),Gv=p.n(Hv),Zv=p(42122),It=p.n(Zv),Qv=p(57955),Jv=p.n(Qv),Kv=p(10822),Yv=p.n(Kv),Xv=p(80466),e0=p.n(Xv);const rl={biginteger:r.createElement(It(),null),boolean:r.createElement(Bv(),null),date:r.createElement(fn(),null),datetime:r.createElement(fn(),null),decimal:r.createElement(It(),null),email:r.createElement(Vv(),null),enum:r.createElement(nl(),null),enumeration:r.createElement(nl(),null),file:r.createElement(jr(),null),files:r.createElement(jr(),null),float:r.createElement(It(),null),integer:r.createElement(It(),null),media:r.createElement(jr(),null),number:r.createElement(It(),null),relation:r.createElement(Uv(),null),string:r.createElement($r(),null),text:r.createElement($r(),null),richtext:r.createElement($r(),null),time:r.createElement(fn(),null),timestamp:r.createElement(fn(),null),json:r.createElement(Jv(),null),uid:r.createElement(Gv(),null),component:r.createElement(Yv(),null),dynamiczone:r.createElement(e0(),null)},Br=({type:e,customFieldUid:t})=>{const n=(0,y.useCustomFields)();let a=rl[e];if(t){const i=n.get(t).icon;i&&(a=r.createElement(D.Box,{marginRight:3,width:7,height:6},r.createElement(i,null)))}return rl[e]?a:null};Br.defaultProps={customFieldUid:null},Br.propTypes={type:o().string.isRequired,customFieldUid:o().string};const ol=Br,t0=e=>e.reduce((t,n)=>{const a=(0,X.get)(n,["attributes"],{}),s=Object.keys(a).filter(i=>!["boolean","component","dynamiczone","json","media","password","relation","text","richtext"].includes((0,X.get)(a,[i,"type"],"")));return t[n.uid]=s,t},{}),al=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=E(e==="mainField"?"containers.SettingPage.editSettings.entry.title":`form.Input.${e}`);return{type:t,label:{id:n}}};var Dt=p(63865),n0=Object.defineProperty,gn=Object.getOwnPropertySymbols,sl=Object.prototype.hasOwnProperty,il=Object.prototype.propertyIsEnumerable,ll=(e,t,n)=>t in e?n0(e,t,{enumerable:!0,configurable:!0,writable:!0,value:n}):e[t]=n,Nr=(e,t)=>{for(var n in t||(t={}))sl.call(t,n)&&ll(e,n,t[n]);if(gn)for(var n of gn(t))il.call(t,n)&&ll(e,n,t[n]);return e},r0=(e,t)=>{var n={};for(var a in e)sl.call(e,a)&&t.indexOf(a)<0&&(n[a]=e[a]);if(e!=null&&gn)for(var a of gn(e))t.indexOf(a)<0&&il.call(e,a)&&(n[a]=e[a]);return n};const Vr=e=>{var t=e,{type:n,options:a,onChange:s,value:i,name:l}=t,c=r0(t,["type","options","onChange","value","name"]);const{formatMessage:u}=(0,N.useIntl)();switch(n){case"text":return r.createElement(Jn.TextInput,Nr({onChange:s,value:i,name:l},c));case"bool":return r.createElement(Dt.ToggleInput,Nr({onChange:d=>{s({target:{name:l,value:d.target.checked}})},checked:i,name:l,onLabel:u({id:"app.components.ToggleCheckbox.on-label",defaultMessage:"On"}),offLabel:u({id:"app.components.ToggleCheckbox.off-label",defaultMessage:"Off"})},c));case"select":return r.createElement(pe.Select,Nr({value:i,name:l,onChange:d=>s({target:{name:l,value:d}})},c),a.map(d=>r.createElement(pe.Option,{key:d,value:d},d)));default:return null}};Vr.defaultProps={options:void 0},Vr.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 o0=Vr,a0=[[4,"33%"],[6,"50%"],[8,"66%"],[12,"100%"]],s0=["dynamiczone","component","json","richtext"],i0=[1,5,10,15,30,60],l0=["datetime","time"],cl=({onMetaChange:e,onSizeChange:t})=>{const{formatMessage:n}=(0,N.useIntl)(),{modifiedData:a,selectedField:s,attributes:i,fieldForm:l}=et(),c=(0,r.useMemo)(Sn,[]),{schemas:u}=(0,he.useSelector)(O=>c(O),he.shallowEqual),d=(0,r.useMemo)(()=>{if(!s)return[];const O=w()(a,["metadatas",s,"edit"],{});return Object.keys(O).filter(C=>C!=="visible")},[s,a]),m=(0,r.useMemo)(()=>t0(u),[u]),g=(0,r.useCallback)(O=>{if(O!=="relation"&&O!=="component")return[];const C=O==="component"?"component":"targetModel",B=w()(a,["attributes",s,C],"");return w()(m,[B],[])},[s,m,a]),f=d.map(O=>{const C=w()(i,[s,"type"]);return["component","dynamiczone"].includes(C)&&!["label","description"].includes(O)||C==="component"&&O!=="label"||["media","json","boolean"].includes(C)&&O==="placeholder"||O==="step"?null:r.createElement(de.GridItem,{col:6,key:O},r.createElement(o0,{type:al(O).type,hint:O==="mainField"?n({id:E("containers.SettingPage.editSettings.relation-field.description")}):"",label:n({id:w()(al(O),"label.id","app.utils.defaultMessage")}),name:O,onChange:e,value:w()(l,["metadata",O],""),options:g(C)}))}),h=!s0.includes(i[s].type),b=r.createElement(de.GridItem,{col:6,key:"size"},r.createElement(pe.Select,{value:l==null?void 0:l.size,name:"size",onChange:O=>{t({name:s,value:O})},label:n({id:E("containers.SettingPage.editSettings.size.label"),defaultMessage:"Size"})},a0.map(([O,C])=>r.createElement(pe.Option,{key:O,value:O},C)))),v=l0.includes(i[s].type),S=r.createElement(de.GridItem,{col:6,key:"step"},r.createElement(pe.Select,{value:w()(l,["metadata","step"],1),name:"step",onChange:O=>e({target:{name:"step",value:O}}),label:n({id:E("containers.SettingPage.editSettings.step.label"),defaultMessage:"Time interval (minutes)"})},i0.map(O=>r.createElement(pe.Option,{key:O,value:O},O))));return r.createElement(r.Fragment,null,f,h&&b,v&&S)};cl.propTypes={onMetaChange:o().func.isRequired,onSizeChange:o().func.isRequired};const c0=cl,u0=(0,L.default)(W.Flex)`
|
|
1100
|
+
svg {
|
|
1101
|
+
width: ${32/16}rem;
|
|
1102
|
+
height: ${24/16}rem;
|
|
1103
|
+
margin-right: ${({theme:e})=>e.spaces[3]};
|
|
1104
|
+
}
|
|
1105
|
+
`,qr=({onToggle:e,onMetaChange:t,onSizeChange:n,onSubmit:a,type:s,customFieldUid:i})=>{const{selectedField:l}=et(),{formatMessage:c}=(0,N.useIntl)(),u=()=>s==="timestamp"?"date":["decimal","float","integer","biginter"].includes(s)?"number":s;return r.createElement(Je.ModalLayout,{onClose:e,labelledBy:"title"},r.createElement("form",{onSubmit:a},r.createElement(Je.ModalHeader,null,r.createElement(u0,null,r.createElement(ol,{type:u(),customFieldUid:i}),r.createElement(x.Typography,{fontWeight:"bold",textColor:"neutral800",as:"h2",id:"title"},c({id:E("containers.ListSettingsView.modal-form.edit-label"),defaultMessage:"Edit {fieldName}"},{fieldName:wt()(l)})))),r.createElement(Je.ModalBody,null,r.createElement(de.Grid,{gap:4},r.createElement(c0,{onMetaChange:t,onSizeChange:n}))),r.createElement(Je.ModalFooter,{startActions:r.createElement(be.Button,{onClick:e,variant:"tertiary"},c({id:"app.components.Button.cancel",defaultMessage:"Cancel"})),endActions:r.createElement(be.Button,{type:"submit"},c({id:"global.finish",defaultMessage:"Finish"}))})))};qr.defaultProps={customFieldUid:null},qr.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 d0=qr,p0=(e,t,n)=>fe.be.put(ye(n?`content-types/${t}/configuration`:`components/${t}/configuration`),e),zr=({mainLayout:e,components:t,isContentTypeView:n,slug:a,updateLayout:s})=>{const[i,l]=(0,r.useReducer)(pv,Fr,()=>Ev(Fr,e,t)),[c,u]=(0,r.useState)(!1),{trackUsage:d}=(0,y.useTracking)(),m=(0,y.useNotification)(),{goBack:g}=(0,oe.useHistory)(),[f,h]=(0,r.useState)(!1),[b,v]=(0,r.useState)(!1),{componentLayouts:S,initialData:O,modifiedData:C,metaToEdit:B,metaForm:T}=i,{formatMessage:M}=(0,N.useIntl)(),V=w()(e,["info","displayName"],""),A=w()(C,["attributes"],{}),H=Object.keys(A).filter(_=>{const J=w()(A,[_,"type"],"");return!["dynamiczone","json","text","relation","component","boolean","media","password","richtext","timestamp"].includes(J)&&!!J}),Q=w()(C,["layouts","edit"],[]),j=ev()(Q,"rowContent"),G=Object.keys(C.attributes).filter(_=>w()(C,["metadatas",_,"edit","visible"],!1)===!0).filter(_=>j.findIndex(J=>J.name===_)===-1).sort(),U=({target:{name:_,value:J}})=>{l({type:"ON_CHANGE",keys:_.split("."),value:J})},F=()=>{h(_=>!_)},I=()=>{v(_=>!_)},K=({target:{name:_,value:J}})=>{l({type:"ON_CHANGE_META",keys:_.split("."),value:J})},$=({name:_,value:J})=>{l({type:"ON_CHANGE_SIZE",name:_,value:J})},Z=_=>{_.preventDefault(),l({type:"SUBMIT_META_FORM"}),F()},q=_=>{_.preventDefault(),I()},k=(0,nt.useMutation)(_=>p0(_,a,n),{onSuccess({data:_}){s&&s(_.data),l({type:"SUBMIT_SUCCEEDED"}),I(),d("didEditEditSettings")},onError(){m({type:"warning",message:{id:"notification.error"}})}}),{isLoading:R}=k,P=()=>{const _=zi()(ze()(C),["layouts","metadatas","settings"]);te()(_,"layouts.edit",cv(_.layouts.edit)),k.mutate(_)},z=(_,J)=>{l({type:"MOVE_RELATION",fromIndex:_,toIndex:J})},Y=(_,J)=>{l({type:"MOVE_FIELD",fromIndex:_,toIndex:J})},se=(_,J,Pe,Ce)=>{l(Pe===Ce?{type:"REORDER_ROW",dragRowIndex:Pe,dragIndex:_,hoverIndex:J}:{type:"REORDER_DIFF_ROW",dragIndex:_,hoverIndex:J,dragRowIndex:Pe,hoverRowIndex:Ce})},ae=(_,J)=>{l({type:"MOVE_ROW",fromIndex:_,toIndex:J})};return r.createElement(Xe,{isContentTypeView:n,attributes:A,modifiedData:C,slug:a,componentLayouts:S,selectedField:B,fieldForm:T,onMoveRelation:z,onMoveField:Y,moveRow:ae,moveItem:se,setEditFieldToSelect:_=>{l({type:"SET_FIELD_TO_EDIT",name:_}),F()},isDraggingSibling:c,setIsDraggingSibling:u},r.createElement(ie.Main,null,r.createElement("form",{onSubmit:q},r.createElement(ee.HeaderLayout,{title:M({id:E("components.SettingsViewWrapper.pluginHeader.title"),defaultMessage:`Configure the view - ${wt()(V)}`},{name:wt()(V)}),subtitle:M({id:E("components.SettingsViewWrapper.pluginHeader.description.edit-settings"),defaultMessage:"Customize how the edit view will look like."}),navigationAction:r.createElement(y.Link,{startIcon:r.createElement(dn(),null),onClick:_=>{_.preventDefault(),g()},to:"/"},M({id:"global.back",defaultMessage:"Back"})),primaryAction:r.createElement(be.Button,{disabled:on()(O,C),startIcon:r.createElement(mt(),null),type:"submit"},M({id:"global.save",defaultMessage:"Save"}))}),r.createElement(ee.ContentLayout,null,r.createElement(D.Box,{background:"neutral0",hasRadius:!0,shadow:"filterShadow",paddingTop:6,paddingBottom:6,paddingLeft:7,paddingRight:7},r.createElement(ue.Stack,{spacing:4},r.createElement(x.Typography,{variant:"delta",as:"h2"},M({id:E("containers.SettingPage.settings"),defaultMessage:"Settings"})),r.createElement(de.Grid,null,r.createElement(de.GridItem,{col:6,s:12},r.createElement(pe.Select,{label:M({id:E("containers.SettingPage.editSettings.entry.title"),defaultMessage:"Entry title"}),hint:M({id:E("containers.SettingPage.editSettings.entry.title.description"),defaultMessage:"Set the display field of your entry"}),onChange:_=>{U({target:{name:"settings.mainField",value:_===""?null:_}})},value:C.settings.mainField},H.map(_=>r.createElement(pe.Option,{key:_,value:_},_))))),r.createElement(D.Box,{paddingTop:2,paddingBottom:2},r.createElement(wr.Divider,null)),r.createElement(x.Typography,{variant:"delta",as:"h3"},M({id:E("containers.SettingPage.view"),defaultMessage:"View"})),r.createElement(Av,{attributes:A,editLayout:Q,fields:G,onAddField:_=>{l({type:"ON_ADD_FIELD",name:_})},onRemoveField:(_,J)=>{l({type:"REMOVE_FIELD",rowIndex:_,fieldIndex:J})}})))),r.createElement(y.ConfirmDialog,{bodyText:{id:E("popUpWarning.warning.updateAllSettings"),defaultMessage:"This will modify all your settings"},iconRightButton:r.createElement(mt(),null),isConfirmButtonLoading:R,isOpen:b,onToggleDialog:I,onConfirm:P,variantRightButton:"success-light"})),f&&r.createElement(d0,{onSubmit:Z,onToggle:F,onMetaChange:K,onSizeChange:$,type:w()(A,[B,"type"],""),customFieldUid:w()(A,[B,"customField"],"")})))};zr.defaultProps={isContentTypeView:!1,updateLayout:null},zr.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,edit:o().array.isRequired}).isRequired,metadatas:o().object.isRequired,options:o().object.isRequired}).isRequired,slug:o().string.isRequired,updateLayout:o().func};const Wr=zr;var gt=p(37617);const m0=()=>({type:gt.ZA}),f0=(e,t)=>({type:gt.Id,pagination:e,data:t}),g0=()=>({type:gt.MP});function y0(){return{type:gt.c2}}const h0=({components:e,contentType:t})=>{const{layouts:n}=t;return{contentType:t,components:e,displayedHeaders:n.list,type:gt.Zz}},Ur=e=>({type:gt.Rp,target:e});var ul=p(13055),_r=p(29270),b0=p(70664);const v0=()=>e=>e["content-manager_listView"]||b0.E,E0=()=>(0,Dn.P1)(v0(),e=>e),dl=e=>{const{displayedHeaders:t}=e["content-manager_listView"];return t},C0=E0,pl=({isPublished:e})=>{const{formatMessage:t}=(0,N.useIntl)(),n=t({id:E(`containers.List.${e?"published":"draft"}`)}),a=e?"success100":"secondary100",s=e?"success700":"secondary700";return r.createElement(D.Box,{background:a,hasRadius:!0,paddingTop:1,paddingBottom:1,paddingLeft:2,paddingRight:2,style:{width:"fit-content"}},r.createElement(x.Typography,{fontWeight:"bold",textColor:s},n))};pl.propTypes={isPublished:o().bool.isRequired};const O0=pl;var P0=p(35980),St=p(53214),R0=p(68192),T0=p.n(R0),ml=p(9667),M0=Object.defineProperty,yn=Object.getOwnPropertySymbols,fl=Object.prototype.hasOwnProperty,gl=Object.prototype.propertyIsEnumerable,yl=(e,t,n)=>t in e?M0(e,t,{enumerable:!0,configurable:!0,writable:!0,value:n}):e[t]=n,w0=(e,t)=>{for(var n in t||(t={}))fl.call(t,n)&&yl(e,n,t[n]);if(yn)for(var n of yn(t))gl.call(t,n)&&yl(e,n,t[n]);return e},I0=(e,t)=>{var n={};for(var a in e)fl.call(e,a)&&t.indexOf(a)<0&&(n[a]=e[a]);if(e!=null&&yn)for(var a of yn(e))t.indexOf(a)<0&&gl.call(e,a)&&(n[a]=e[a]);return n};const D0=(0,L.default)(W.Flex)`
|
|
1106
|
+
position: relative;
|
|
1107
|
+
border-radius: 50%;
|
|
1108
|
+
width: 26px;
|
|
1109
|
+
height: 26px;
|
|
1110
|
+
border: 1px solid ${({theme:e})=>e.colors.neutral200};
|
|
1111
|
+
background: ${({theme:e})=>e.colors.neutral150};
|
|
1112
|
+
padding-left: 1px;
|
|
1113
|
+
|
|
1114
|
+
span {
|
|
1115
|
+
line-height: 0.6rem;
|
|
1116
|
+
font-size: 0.6rem;
|
|
1117
|
+
}
|
|
1118
|
+
`,hl=e=>{var t=e,{children:n}=t,a=I0(t,["children"]);return r.createElement(D0,w0({justifyContent:"center",alignItems:"center",as:"span"},a),r.createElement(x.Typography,{variant:"sigma",textColor:"neutral600"},n))};hl.propTypes={children:o().string.isRequired};const bl=hl,Hr=({url:e,mime:t,alternativeText:n,name:a,ext:s,formats:i})=>{var l;const c=(0,y.prefixFileUrlWithBackendUrl)(e);if(t.includes("image")){const m=((l=i==null?void 0:i.thumbnail)==null?void 0:l.url)||null,g=(0,y.prefixFileUrlWithBackendUrl)(m)||c;return r.createElement(ml.Avatar,{src:g,alt:n||a,preview:!0})}const u=(0,y.getFileExtension)(s),d=a.length>100?`${a.substring(0,100)}...`:a;return r.createElement(Qt.Tooltip,{description:d},r.createElement(bl,null,u))};Hr.defaultProps={alternativeText:null,formats:null},Hr.propTypes={alternativeText:o().string,ext:o().string.isRequired,formats:o().object,mime:o().string.isRequired,name:o().string.isRequired,url:o().string.isRequired};const vl=Hr;var S0=Object.defineProperty,El=Object.getOwnPropertySymbols,L0=Object.prototype.hasOwnProperty,x0=Object.prototype.propertyIsEnumerable,Cl=(e,t,n)=>t in e?S0(e,t,{enumerable:!0,configurable:!0,writable:!0,value:n}):e[t]=n,F0=(e,t)=>{for(var n in t||(t={}))L0.call(t,n)&&Cl(e,n,t[n]);if(El)for(var n of El(t))x0.call(t,n)&&Cl(e,n,t[n]);return e};const Ol=({value:e})=>r.createElement(ml.AvatarGroup,null,e.map((t,n)=>{const a=`${t.id}${n}`;if(n===3){const s=`+${e.length-3}`;return r.createElement(bl,{key:a,preview:!1},s)}return n>3?null:r.createElement(vl,F0({key:a},t))}));Ol.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 k0=Ol;var A0=p(51064),j0=p.n(A0);const Pl=({type:e,value:t})=>{const{formatDate:n,formatTime:a,formatNumber:s}=(0,N.useIntl)();let i=t;if(e==="date"&&(i=n(j0()(t),{dateStyle:"full"})),e==="datetime"&&(i=n(t,{dateStyle:"full",timeStyle:"short"})),e==="time"){const[l,c,u]=t.split(":"),d=new Date;d.setHours(l),d.setMinutes(c),d.setSeconds(u),i=a(d,{numeric:"auto",style:"short"})}return["float","decimal"].includes(e)&&(i=s(t,{maximumFractionDigits:21})),["integer","biginteger"].includes(e)&&(i=s(t,{maximumFractionDigits:0})),Is()(i)};Pl.propTypes={type:o().string.isRequired,value:o().any.isRequired};const Lt=Pl;var $0=Object.defineProperty,Rl=Object.getOwnPropertySymbols,B0=Object.prototype.hasOwnProperty,N0=Object.prototype.propertyIsEnumerable,Tl=(e,t,n)=>t in e?$0(e,t,{enumerable:!0,configurable:!0,writable:!0,value:n}):e[t]=n,V0=(e,t)=>{for(var n in t||(t={}))B0.call(t,n)&&Tl(e,n,t[n]);if(Rl)for(var n of Rl(t))N0.call(t,n)&&Tl(e,n,t[n]);return e},q0=(e,t,n)=>new Promise((a,s)=>{var i=u=>{try{c(n.next(u))}catch(d){s(d)}},l=u=>{try{c(n.throw(u))}catch(d){s(d)}},c=u=>u.done?a(u.value):Promise.resolve(u.value).then(i,l);c((n=n.apply(e,t)).next())});const z0=(0,L.default)(x.Typography)`
|
|
1119
|
+
max-width: 500px;
|
|
1120
|
+
`,W0=(e,t)=>q0(void 0,null,function*(){const{data:{results:n,pagination:a}}=yield fe.be.get(e);return t(),{results:n,pagination:a}}),Ml=({fieldSchema:e,metadatas:t,name:n,entityId:a,value:s,contentType:i})=>{const{formatMessage:l}=(0,N.useIntl)(),{notifyStatus:c}=(0,_r.useNotifyAT)(),u=(0,r.useMemo)(()=>ye(`collection-types/${i.uid}/${a}/${n.split(".")[0]}`),[a,n,i]),[d,m]=(0,r.useState)(!1),g=r.createElement(r.Fragment,null,r.createElement(er.Badge,null,s.count)," ",l({id:"content-manager.containers.ListPage.items",defaultMessage:"{number, plural, =0 {items} one {item} other {items}}"},{number:s.count})),f=()=>{const v=l({id:E("DynamicTable.relation-loaded"),defaultMessage:"Relations have been loaded"});c(v)},{data:h,status:b}=(0,nt.useQuery)([e.targetModel,a],()=>W0(u,f),{enabled:d,staleTime:0});return r.createElement(D.Box,V0({},y.stopPropagation),r.createElement(Ve.SimpleMenu,{label:g,size:"S",onOpen:()=>m(!0),onClose:()=>m(!1)},b!=="success"&&r.createElement(Ve.MenuItem,{"aria-disabled":!0},r.createElement(ia.Loader,{small:!0},l({id:E("DynamicTable.relation-loading"),defaultMessage:"Relations are loading"}))),b==="success"&&r.createElement(r.Fragment,null,h==null?void 0:h.results.map(v=>r.createElement(Ve.MenuItem,{key:v.id,"aria-disabled":!0},r.createElement(z0,{ellipsis:!0},r.createElement(Lt,{type:t.mainField.schema.type,value:v[t.mainField.name]||v.id})))),(h==null?void 0:h.pagination.total)>10&&r.createElement(Ve.MenuItem,{"aria-disabled":!0,"aria-label":l({id:E("DynamicTable.relation-more"),defaultMessage:"This relation contains more entities than displayed"})},r.createElement(x.Typography,null,"...")))))};Ml.propTypes={contentType:o().shape({uid:o().string.isRequired}).isRequired,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,entityId:o().oneOfType([o().string,o().number]).isRequired,value:o().object.isRequired};const U0=Ml,_0=(0,L.default)(x.Typography)`
|
|
1121
|
+
max-width: 500px;
|
|
1122
|
+
`,wl=({metadatas:e,value:t})=>{var n;return r.createElement(_0,{textColor:"neutral800",ellipsis:!0},r.createElement(Lt,{type:e.mainField.schema.type,value:(n=t[e.mainField.name])!=null?n:t.id}))};wl.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 H0=wl;var G0=Object.defineProperty,Il=Object.getOwnPropertySymbols,Z0=Object.prototype.hasOwnProperty,Q0=Object.prototype.propertyIsEnumerable,Dl=(e,t,n)=>t in e?G0(e,t,{enumerable:!0,configurable:!0,writable:!0,value:n}):e[t]=n,J0=(e,t)=>{for(var n in t||(t={}))Z0.call(t,n)&&Dl(e,n,t[n]);if(Il)for(var n of Il(t))Q0.call(t,n)&&Dl(e,n,t[n]);return e};const K0=(0,L.default)(x.Typography)`
|
|
1123
|
+
max-width: 500px;
|
|
1124
|
+
`,Sl=({value:e,metadatas:t})=>{const{formatMessage:n}=(0,N.useIntl)(),{mainField:{type:a,name:s}}=t,i=r.createElement(r.Fragment,null,r.createElement(er.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,J0({},y.stopPropagation),r.createElement(Ve.SimpleMenu,{label:i,size:"S"},e.map(l=>r.createElement(Ve.MenuItem,{key:l.id,"aria-disabled":!0},r.createElement(K0,{ellipsis:!0},r.createElement(Lt,{type:a,value:l[s]||l.id}))))))};Sl.propTypes={metadatas:o().shape({mainField:o().shape({name:o().string,type:o().string,value:o().string})}).isRequired,value:o().array.isRequired};const Y0=Sl,X0=(0,L.default)(x.Typography)`
|
|
1125
|
+
max-width: 250px;
|
|
1126
|
+
`,Ll=({value:e,metadatas:t})=>{const{mainField:n}=t,a=e[n.name];return r.createElement(Qt.Tooltip,{label:a},r.createElement(X0,{textColor:"neutral800",ellipsis:!0},r.createElement(Lt,{type:n.type,value:a})))};Ll.propTypes={metadatas:o().shape({mainField:o().shape({name:o().string,type:o().string,value:o().string})}).isRequired,value:o().object.isRequired};const eE=Ll;var tE=p(80022),xl=p.n(tE);function Fl(e){return["oneToOne","manyToOne","oneToOneMorph"].includes(e)}function nE(e,t,n,a){if(e==="component"){const{mainField:{name:s,type:i}}=n;if(a!=null&&a.repeatable)return t.length>0;const l=t==null?void 0:t[s];return s==="id"&&![void 0,null].includes(l)?!0:Mt(i)&&i!=="biginteger"&&s!=="id"?xl()(l):!Se()(l)}return e==="relation"?Fl(a.relation)?!Se()(t):(t==null?void 0:t.count)>0:Mt(e)&&e!=="biginteger"?xl()(t):e==="boolean"?t!==null:!Se()(t)}var rE=Object.defineProperty,kl=Object.getOwnPropertySymbols,oE=Object.prototype.hasOwnProperty,aE=Object.prototype.propertyIsEnumerable,Al=(e,t,n)=>t in e?rE(e,t,{enumerable:!0,configurable:!0,writable:!0,value:n}):e[t]=n,sE=(e,t)=>{for(var n in t||(t={}))oE.call(t,n)&&Al(e,n,t[n]);if(kl)for(var n of kl(t))aE.call(t,n)&&Al(e,n,t[n]);return e};const iE=(0,L.default)(x.Typography)`
|
|
1127
|
+
max-width: 300px;
|
|
1128
|
+
`,Gr=({content:e,fieldSchema:t,metadatas:n,name:a,rowId:s,contentType:i})=>{const{type:l}=t;if(!nE(l,e,n,t))return r.createElement(x.Typography,{textColor:"neutral800"},"-");switch(l){case"media":return t.multiple?r.createElement(k0,{value:e}):r.createElement(vl,sE({},e));case"relation":return Fl(t.relation)?r.createElement(H0,{metadatas:n,value:e}):r.createElement(U0,{fieldSchema:t,metadatas:n,value:e,name:a,entityId:s,contentType:i});case"component":return t.repeatable===!0?r.createElement(Y0,{value:e,metadatas:n}):r.createElement(eE,{value:e,metadatas:n});default:return r.createElement(iE,{ellipsis:!0,textColor:"neutral800"},r.createElement(Lt,{type:l,value:e}))}};Gr.defaultProps={content:void 0},Gr.propTypes={content:o().any,contentType:o().shape({uid:o().string.isRequired}).isRequired,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};const lE=Gr;var cE=Object.defineProperty,uE=Object.defineProperties,dE=Object.getOwnPropertyDescriptors,hn=Object.getOwnPropertySymbols,jl=Object.prototype.hasOwnProperty,$l=Object.prototype.propertyIsEnumerable,Bl=(e,t,n)=>t in e?cE(e,t,{enumerable:!0,configurable:!0,writable:!0,value:n}):e[t]=n,xt=(e,t)=>{for(var n in t||(t={}))jl.call(t,n)&&Bl(e,n,t[n]);if(hn)for(var n of hn(t))$l.call(t,n)&&Bl(e,n,t[n]);return e},pE=(e,t)=>uE(e,dE(t)),mE=(e,t)=>{var n={};for(var a in e)jl.call(e,a)&&t.indexOf(a)<0&&(n[a]=e[a]);if(e!=null&&hn)for(var a of hn(e))t.indexOf(a)<0&&$l.call(e,a)&&(n[a]=e[a]);return n};const Zr=({canCreate:e,canDelete:t,contentType:n,headers:a,entriesToDelete:s,onClickDelete:i,onSelectRow:l,withMainAction:c,withBulkActions:u,rows:d})=>{const{push:m,location:{pathname:g}}=(0,oe.useHistory)(),{formatMessage:f}=(0,N.useIntl)(),{trackUsage:h}=(0,y.useTracking)(),b=Zo();return r.createElement(St.Tbody,null,d.map((v,S)=>{const O=s.findIndex(B=>B===v.id)!==-1,C=f({id:"content-manager.components.DynamicTable.row-line",defaultMessage:"item line {number}"},{number:S});return r.createElement(St.Tr,xt({key:v.id},(0,y.onRowClick)({fn(){h("willEditEntryFromList"),m({pathname:`${g}/${v.id}`,state:{from:g},search:b})},condition:u})),c&&r.createElement(St.Td,xt({},y.stopPropagation),r.createElement(P0.BaseCheckbox,{"aria-label":f({id:"app.component.table.select.one-entry",defaultMessage:"Select {target}"},{target:(0,Ti.Pp)(v.firstname,v.lastname)}),checked:O,onChange:()=>{l({name:v.id,value:!O})}})),a.map(B=>{var T=B,{key:M,cellFormatter:V,name:A}=T,H=mE(T,["key","cellFormatter","name"]);return r.createElement(St.Td,{key:M},typeof V=="function"?V(v,xt({key:M,name:A},H)):r.createElement(lE,pE(xt({content:v[A.split(".")[0]],name:A,contentType:n},H),{rowId:v.id})))}),u&&r.createElement(St.Td,null,r.createElement(W.Flex,xt({justifyContent:"end"},y.stopPropagation),r.createElement(Te.IconButton,{forwardedAs:oe.Link,onClick:()=>{h("willEditEntryFromButton")},to:{pathname:`${g}/${v.id}`,state:{from:g},search:b},label:f({id:"app.component.table.edit",defaultMessage:"Edit {target}"},{target:C}),noBorder:!0,icon:r.createElement(ct(),null)}),e&&r.createElement(D.Box,{paddingLeft:1},r.createElement(Te.IconButton,{forwardedAs:oe.Link,to:{pathname:`${g}/create/clone/${v.id}`,state:{from:g},search:b},label:f({id:"app.component.table.duplicate",defaultMessage:"Duplicate {target}"},{target:C}),noBorder:!0,icon:r.createElement(T0(),null)})),t&&r.createElement(D.Box,{paddingLeft:1},r.createElement(Te.IconButton,{onClick:()=>{h("willDeleteEntryFromList"),i(v.id)},label:f({id:"global.delete-target",defaultMessage:"Delete {target}"},{target:C}),noBorder:!0,icon:r.createElement(Ne(),null)})))))}))};Zr.defaultProps={canCreate:!1,canDelete:!1,entriesToDelete:[],onClickDelete(){},onSelectRow(){},rows:[],withBulkActions:!1,withMainAction:!1},Zr.propTypes={canCreate:o().bool,canDelete:o().bool,contentType:o().shape({uid:o().string.isRequired}).isRequired,entriesToDelete:o().array,headers:o().array.isRequired,onClickDelete:o().func,onSelectRow:o().func,rows:o().array,withBulkActions:o().bool,withMainAction:o().bool};const fE=Zr;var gE=Object.defineProperty,bn=Object.getOwnPropertySymbols,Nl=Object.prototype.hasOwnProperty,Vl=Object.prototype.propertyIsEnumerable,ql=(e,t,n)=>t in e?gE(e,t,{enumerable:!0,configurable:!0,writable:!0,value:n}):e[t]=n,yE=(e,t)=>{for(var n in t||(t={}))Nl.call(t,n)&&ql(e,n,t[n]);if(bn)for(var n of bn(t))Vl.call(t,n)&&ql(e,n,t[n]);return e},hE=(e,t)=>{var n={};for(var a in e)Nl.call(e,a)&&t.indexOf(a)<0&&(n[a]=e[a]);if(e!=null&&bn)for(var a of bn(e))t.indexOf(a)<0&&Vl.call(e,a)&&(n[a]=e[a]);return n};const zl=e=>{var t=e,{area:n}=t,a=hE(t,["area"]);const s=Yo(n);return s?r.createElement("ul",null,s.map(i=>i.Component(a)?r.createElement(D.Box,{key:i.name,padding:3,style:{textAlign:"center"}},r.createElement(i.Component,yE({},a))):null)):null};zl.propTypes={area:o().string.isRequired};const Wl=zl,Ul=({isConfirmButtonLoading:e,isOpen:t,onToggleDialog:n,onConfirm:a})=>{const{formatMessage:s}=(0,N.useIntl)();return r.createElement(je.Dialog,{onClose:n,title:s({id:"app.components.ConfirmDialog.title",defaultMessage:"Confirmation"}),labelledBy:"confirmation",describedBy:"confirm-description",isOpen:t},r.createElement(je.DialogBody,{icon:r.createElement(Pt(),null)},r.createElement(ue.Stack,{spacing:2},r.createElement(W.Flex,{justifyContent:"center"},r.createElement(x.Typography,{id:"confirm-description"},s({id:E("popUpWarning.bodyMessage.contentType.delete.all"),defaultMessage:"Are you sure you want to delete these entries?"}))),r.createElement(W.Flex,null,r.createElement(Wl,{area:"contentManager.listView.deleteModalAdditionalInfos"})))),r.createElement(je.DialogFooter,{startAction:r.createElement(be.Button,{onClick:n,variant:"tertiary"},s({id:"app.components.Button.cancel",defaultMessage:"Cancel"})),endAction:r.createElement(be.Button,{onClick:a,variant:"danger-light",startIcon:r.createElement(Ne(),null),id:"confirm-delete",loading:e},s({id:"app.components.Button.confirm",defaultMessage:"Confirm"}))}))};Ul.propTypes={isConfirmButtonLoading:o().bool.isRequired,isOpen:o().bool.isRequired,onConfirm:o().func.isRequired,onToggleDialog:o().func.isRequired};const bE=Ul,_l=({isConfirmButtonLoading:e,isOpen:t,onToggleDialog:n,onConfirm:a})=>{const{formatMessage:s}=(0,N.useIntl)();return r.createElement(je.Dialog,{onClose:n,title:s({id:"app.components.ConfirmDialog.title",defaultMessage:"Confirmation"}),labelledBy:"confirmation",describedBy:"confirm-description",isOpen:t},r.createElement(je.DialogBody,{icon:r.createElement(Pt(),null)},r.createElement(ue.Stack,{spacing:2},r.createElement(W.Flex,{justifyContent:"center"},r.createElement(x.Typography,{id:"confirm-description"},s({id:"components.popUpWarning.message",defaultMessage:"Are you sure you want to delete this?"}))),r.createElement(W.Flex,null,r.createElement(Wl,{area:"contentManager.listView.deleteModalAdditionalInfos"})))),r.createElement(je.DialogFooter,{startAction:r.createElement(be.Button,{onClick:n,variant:"tertiary"},s({id:"app.components.Button.cancel",defaultMessage:"Cancel"})),endAction:r.createElement(be.Button,{onClick:a,variant:"danger-light",startIcon:r.createElement(Ne(),null),id:"confirm-delete",loading:e},s({id:"app.components.Button.confirm",defaultMessage:"Confirm"}))}))};_l.propTypes={isConfirmButtonLoading:o().bool.isRequired,isOpen:o().bool.isRequired,onConfirm:o().func.isRequired,onToggleDialog:o().func.isRequired};const vE=_l;var EE=Object.defineProperty,CE=Object.defineProperties,OE=Object.getOwnPropertyDescriptors,Hl=Object.getOwnPropertySymbols,PE=Object.prototype.hasOwnProperty,RE=Object.prototype.propertyIsEnumerable,Gl=(e,t,n)=>t in e?EE(e,t,{enumerable:!0,configurable:!0,writable:!0,value:n}):e[t]=n,vn=(e,t)=>{for(var n in t||(t={}))PE.call(t,n)&&Gl(e,n,t[n]);if(Hl)for(var n of Hl(t))RE.call(t,n)&&Gl(e,n,t[n]);return e},En=(e,t)=>CE(e,OE(t));const Qr=({canCreate:e,canDelete:t,contentTypeName:n,action:a,isBulkable:s,isLoading:i,onConfirmDelete:l,onConfirmDeleteAll:c,layout:u,rows:d})=>{const{runHookWaterfall:m}=(0,y.useStrapiApp)(),g=u.contentType.options.draftAndPublish||!1,{formatMessage:f}=(0,N.useIntl)(),h=(0,he.useSelector)(dl),b=(0,r.useMemo)(()=>{const S=m(Ut.No,{displayedHeaders:h,layout:u}).displayedHeaders.map(O=>{const{metadatas:C}=O;if(O.fieldSchema.type==="relation"){const B=`${O.name}.${O.metadatas.mainField.name}`;return En(vn({},O),{metadatas:En(vn({},C),{label:f({id:E(`containers.ListPage.table-headers.${O.name}`),defaultMessage:C.label})}),name:B})}return En(vn({},O),{metadatas:En(vn({},C),{label:f({id:E(`containers.ListPage.table-headers.${O.name}`),defaultMessage:C.label})})})});return g?[...S,{key:"__published_at_temp_key__",name:"publishedAt",fieldSchema:{type:"custom"},metadatas:{label:f({id:E("containers.ListPage.table-headers.publishedAt"),defaultMessage:"publishedAt"}),searchable:!1,sortable:!0},cellFormatter(O){const C=!Se()(O.publishedAt);return r.createElement(O0,{isPublished:C})}}]:S},[m,h,u,g,f]);return r.createElement(y.DynamicTable,{components:{ConfirmDialogDelete:vE,ConfirmDialogDeleteAll:bE},contentType:n,action:a,isLoading:i,headers:b,onConfirmDelete:l,onConfirmDeleteAll:c,onOpenDeleteAllModalTrackedEvent:"willBulkDeleteEntries",rows:d,withBulkActions:!0,withMainAction:t&&s},r.createElement(fE,{canCreate:e,canDelete:t,contentType:u.contentType,headers:b,rows:d,withBulkActions:!0,withMainAction:t&&s}))};Qr.defaultProps={action:void 0},Qr.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}).isRequired,options:o().object.isRequired,settings:o().object.isRequired}).isRequired}).isRequired,onConfirmDelete:o().func.isRequired,onConfirmDeleteAll:o().func.isRequired,rows:o().array.isRequired};const TE=Qr,ME=["json","component","media","richtext","dynamiczone","password"],wE=["createdAt","updatedAt"],IE=(e,t)=>{const{allPermissions:n}=(0,y.useRBACProvider)(),a=(0,y.findMatchingPermissions)(n,[{action:"plugin::content-manager.explorer.read",subject:t}]),s=w()(a,["0","properties","fields"],[]);return Object.keys(w()(e,["attributes"]),{}).filter(c=>{const u=w()(e,["attributes",c],{});return!(!u.type||ME.includes(u.type)||!s.includes(c)&&c!=="id"&&!wE.includes(c))}).sort()};var DE=p(23899),SE=p.n(DE);const Zl=({displayedFilters:e})=>{const[t,n]=(0,r.useState)(!1),{formatMessage:a}=(0,N.useIntl)(),s=(0,r.useRef)(),{trackUsage:i}=(0,y.useTracking)(),l=()=>{t||i("willFilterEntries"),n(c=>!c)};return r.createElement(r.Fragment,null,r.createElement(D.Box,{paddingTop:1,paddingBottom:1},r.createElement(be.Button,{variant:"tertiary",ref:s,startIcon:r.createElement(SE(),null),onClick:l,size:"S"},a({id:"app.utils.filters",defaultMessage:"Filters"})),t&&r.createElement(y.FilterPopoverURLQuery,{displayedFilters:e,isVisible:t,onToggle:l,source:s})),r.createElement(y.FilterListURLQuery,{filtersSchema:e}))};Zl.propTypes={displayedFilters:o().arrayOf(o().shape({name:o().string.isRequired,metadatas:o().shape({label:o().string}),fieldSchema:o().shape({type:o().string})})).isRequired};const LE=Zl,Ql=({contentType:e,slug:t,metadatas:n})=>{const{formatMessage:a}=(0,N.useIntl)(),i=IE(e,t).map(l=>{const c=e.attributes[l],{type:u,enum:d}=c,m={name:"didFilterEntries",properties:{useRelation:u==="relation"}},{mainField:g,label:f}=n[l].list;return{name:l,metadatas:{label:a({id:f,defaultMessage:f})},fieldSchema:{type:u,options:d,mainField:g},trackedEvent:m}});return r.createElement(LE,{displayedFilters:i})};Ql.propTypes={contentType:o().object.isRequired,metadatas:o().object.isRequired,slug:o().string.isRequired};const xE=Ql,FE=e=>Object.keys(e).reduce((n,a)=>{const s=e[a];return go(s)&&n.push(a),n},[]).sort(),Jl=({layout:e})=>{const t=(0,he.useDispatch)(),n=(0,he.useSelector)(dl),{trackUsage:a}=(0,y.useTracking)(),{formatMessage:s}=(0,N.useIntl)(),i=FE(e.contentType.attributes).map(u=>{const d=e.contentType.metadatas[u].list;return{name:u,intlLabel:{id:d.label,defaultMessage:d.label}}}),l=n.map(({name:u})=>u),c=u=>{if(a("didChangeDisplayedFields"),u.length<l.length){const d=l.filter(m=>u.indexOf(m)===-1);t(Ur({name:d[0],value:!0}))}else{const d=u.filter(m=>l.indexOf(m)===-1);t(Ur({name:d[0],value:!1}))}};return r.createElement(D.Box,{paddingTop:1,paddingBottom:1},r.createElement(pe.Select,{"aria-label":"change displayed fields",value:l,onChange:c,customizeContent:u=>s({id:E("select.currently.selected"),defaultMessage:"{count} currently selected"},{count:u.length}),multi:!0,size:"S"},i.map(u=>r.createElement(pe.Option,{key:u.name,value:u.name},s({id:u.intlLabel.id||u.name,defaultMessage:u.intlLabel.defaultMessage||u.name})))))};Jl.propTypes={layout:o().shape({contentType:o().shape({attributes:o().object.isRequired,metadatas:o().object.isRequired,layouts:o().shape({list:o().array.isRequired}).isRequired,options:o().object.isRequired,settings:o().object.isRequired}).isRequired}).isRequired};const kE=(0,r.memo)(Jl),Jr=({pagination:e})=>r.createElement(D.Box,{paddingTop:4},r.createElement(W.Flex,{alignItems:"flex-end",justifyContent:"space-between"},r.createElement(y.PageSizeURLQuery,{trackedEvent:"willChangeNumberOfEntriesPerPage"}),r.createElement(y.PaginationURLQuery,{pagination:e})));Jr.defaultProps={pagination:{pageCount:0,pageSize:10,total:0}},Jr.propTypes={pagination:o().shape({page:o().number,pageCount:o().number,pageSize:o().number,total:o().number})};const AE=Jr;var jE=p(98399),$E=Object.defineProperty,BE=Object.defineProperties,NE=Object.getOwnPropertyDescriptors,Kl=Object.getOwnPropertySymbols,VE=Object.prototype.hasOwnProperty,qE=Object.prototype.propertyIsEnumerable,Yl=(e,t,n)=>t in e?$E(e,t,{enumerable:!0,configurable:!0,writable:!0,value:n}):e[t]=n,zE=(e,t)=>{for(var n in t||(t={}))VE.call(t,n)&&Yl(e,n,t[n]);if(Kl)for(var n of Kl(t))qE.call(t,n)&&Yl(e,n,t[n]);return e},WE=(e,t)=>BE(e,NE(t)),Kr=(e,t,n)=>new Promise((a,s)=>{var i=u=>{try{c(n.next(u))}catch(d){s(d)}},l=u=>{try{c(n.throw(u))}catch(d){s(d)}},c=u=>u.done?a(u.value):Promise.resolve(u.value).then(i,l);c((n=n.apply(e,t)).next())});const UE=Ie.Z.contentManager,_E=(0,L.default)(D.Box)`
|
|
1129
|
+
svg {
|
|
1130
|
+
path {
|
|
1131
|
+
fill: ${({theme:e})=>e.colors.neutral900};
|
|
1132
|
+
}
|
|
1133
|
+
}
|
|
1134
|
+
`;function Xl({canCreate:e,canDelete:t,canRead:n,data:a,getData:s,getDataSucceeded:i,isLoading:l,layout:c,pagination:u,slug:d}){const{total:m}=u,{contentType:{metadatas:g,settings:{bulkable:f,filterable:h,searchable:b}}}=c,v=(0,y.useNotification)(),{trackUsage:S}=(0,y.useTracking)(),{refetchPermissions:O}=(0,y.useRBACProvider)(),C=(0,r.useRef)(S),B=(0,r.useRef)(O),{notifyStatus:T}=(0,_r.useNotifyAT)();(0,y.useFocusWhenNavigate)();const[{query:M}]=(0,y.useQueryParams)(),V=mi(M),A=(0,We.stringify)({plugins:M.plugins},{encode:!1}),{pathname:H}=(0,oe.useLocation)(),{push:Q}=(0,oe.useHistory)(),{formatMessage:j}=(0,N.useIntl)(),G=c.contentType,U=w()(G,"options.draftAndPublish",!1),F=(0,r.useRef)(""),I=(0,r.useCallback)((P,z)=>Kr(this,null,function*(){s();try{const Y=z?{cancelToken:z.token}:null,{data:{results:se,pagination:ae}}=yield fe.be.get(P,Y);T(j({id:E("utils.data-loaded"),defaultMessage:"{number, plural, =1 {# entry has} other {# entries have}} successfully been loaded"},{number:ae.count})),i(ae,se)}catch(Y){if(ke().isCancel(Y))return;if(w()(Y,"response.status",null)===403){yield B.current(),v({type:"info",message:{id:E("permissions.not-allowed.update")}}),Q("/");return}jE.error(Y),v({type:"warning",message:{id:E("error.model.fetch")}})}}),[j,s,i,T,Q,v]),K=(0,r.useCallback)(P=>Kr(this,null,function*(){try{yield fe.be.post(ye(`collection-types/${d}/actions/bulkDelete`),{ids:P});const z=ye(`collection-types/${d}${V}`);I(z),C.current("didBulkDeleteEntries")}catch(z){v({type:"warning",message:{id:E("error.record.delete")}})}}),[I,V,d,v]),$=(0,r.useCallback)(P=>Kr(this,null,function*(){try{yield fe.be.delete(ye(`collection-types/${d}/${P}`));const z=ye(`collection-types/${d}${V}`);I(z),v({type:"success",message:{id:E("success.record.delete")}})}catch(z){const Y=w()(z,"response.payload.message",j({id:E("error.record.delete")}));v({type:"warning",message:Y})}}),[d,V,I,v,j]);(0,r.useEffect)(()=>{const z=ke().CancelToken.source(),Y=n,se=ye(`collection-types/${d}${V}`);return Y&&se.includes(F.current)&&I(se,z),()=>{F.current=d,z.cancel("Operation canceled by the user.")}},[n,s,d,V,i,I]);const Z=j({id:E("header.name"),defaultMessage:"Content"}),q=j({id:G.info.displayName,defaultMessage:G.info.displayName||Z}),k=n?j({id:E("pages.ListView.header-subtitle"),defaultMessage:"{number, plural, =0 {# entries} one {# entry} other {# entries}} found"},{number:m}):null,R=P=>e?r.createElement(be.Button,WE(zE({},P),{forwardedAs:oe.Link,onClick:()=>{const z=U?{status:"draft"}:{};C.current("willCreateEntry",z)},to:{pathname:`${H}/create`,search:M.plugins?A:""},startIcon:r.createElement(Tt(),null),style:{textDecoration:"none"}}),j({id:E("HeaderLayout.button.label-add-entry"),defaultMessage:"Create new entry"})):null;return r.createElement(ie.Main,{"aria-busy":l},r.createElement(ee.HeaderLayout,{primaryAction:R(),subtitle:k,title:q,navigationAction:r.createElement(y.Link,{startIcon:r.createElement(dn(),null),to:"/content-manager/"},j({id:"global.back",defaultMessage:"Back"}))}),!n&&r.createElement(ee.ActionLayout,{endActions:r.createElement(Ht,{area:"contentManager.listView.actions"})}),n&&r.createElement(ee.ActionLayout,{endActions:r.createElement(r.Fragment,null,r.createElement(Ht,{area:"contentManager.listView.actions"}),r.createElement(kE,{layout:c}),r.createElement(y.CheckPermissions,{permissions:UE.collectionTypesConfigurations},r.createElement(_E,{paddingTop:1,paddingBottom:1},r.createElement(Te.IconButton,{onClick:()=>{S("willEditListLayout")},forwardedAs:oe.Link,to:{pathname:`${d}/configurations/list`,search:A},icon:r.createElement(Zi(),null),label:j({id:"app.links.configure-view",defaultMessage:"Configure the view"})})))),startActions:r.createElement(r.Fragment,null,b&&r.createElement(y.SearchURLQuery,{label:j({id:"app.component.search.label",defaultMessage:"Search for {target}"},{target:q}),placeholder:j({id:"global.search",defaultMessage:"Search"}),trackedEvent:"didSearch"}),h&&r.createElement(xE,{contentType:G,slug:d,metadatas:g}))}),r.createElement(ee.ContentLayout,null,n?r.createElement(r.Fragment,null,r.createElement(TE,{canCreate:e,canDelete:t,contentTypeName:q,onConfirmDeleteAll:K,onConfirmDelete:$,isBulkable:f,isLoading:l,layout:c,rows:a,action:R({variant:"secondary"})}),r.createElement(AE,{pagination:{pageCount:(u==null?void 0:u.pageCount)||1}})):r.createElement(y.NoPermissions,null)))}Xl.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}).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 HE=C0();function GE(e){return(0,ul.bindActionCreators)({getData:m0,getDataSucceeded:f0,onChangeListHeaders:Ur,onResetListHeaders:g0},e)}const ZE=(0,he.connect)(HE,GE),QE=(0,ul.compose)(ZE)((0,r.memo)(Xl,Ue()));var JE=Object.defineProperty,ec=Object.getOwnPropertySymbols,KE=Object.prototype.hasOwnProperty,YE=Object.prototype.propertyIsEnumerable,tc=(e,t,n)=>t in e?JE(e,t,{enumerable:!0,configurable:!0,writable:!0,value:n}):e[t]=n,nc=(e,t)=>{for(var n in t||(t={}))KE.call(t,n)&&tc(e,n,t[n]);if(ec)for(var n of ec(t))YE.call(t,n)&&tc(e,n,t[n]);return e};const Yr=e=>{const t=(0,r.useMemo)(()=>Oo(e.slug),[e.slug]),{isLoading:n,allowedActions:a}=(0,y.useRBAC)(t,e.permissions);return n?r.createElement(y.LoadingIndicatorPage,null):r.createElement(QE,nc(nc({},e),a))};Yr.defaultProps={permissions:[]},Yr.propTypes={permissions:o().array,slug:o().string.isRequired};const XE=(0,r.memo)(Yr,(e,t)=>{const n=(0,y.difference)(e,t);return Object.keys(n).filter(s=>s!=="state").length>0});var eC=Object.defineProperty,tC=Object.defineProperties,nC=Object.getOwnPropertyDescriptors,Cn=Object.getOwnPropertySymbols,rc=Object.prototype.hasOwnProperty,oc=Object.prototype.propertyIsEnumerable,ac=(e,t,n)=>t in e?eC(e,t,{enumerable:!0,configurable:!0,writable:!0,value:n}):e[t]=n,rC=(e,t)=>{for(var n in t||(t={}))rc.call(t,n)&&ac(e,n,t[n]);if(Cn)for(var n of Cn(t))oc.call(t,n)&&ac(e,n,t[n]);return e},oC=(e,t)=>tC(e,nC(t)),aC=(e,t)=>{var n={};for(var a in e)rc.call(e,a)&&t.indexOf(a)<0&&(n[a]=e[a]);if(e!=null&&Cn)for(var a of Cn(e))t.indexOf(a)<0&&oc.call(e,a)&&(n[a]=e[a]);return n};const sc=e=>{var t=e,{layout:n}=t,a=aC(t,["layout"]);const s=(0,he.useDispatch)(),{replace:i}=(0,oe.useHistory)(),[{query:l,rawQuery:c}]=(0,y.useQueryParams)(),u=Jo(l,a.slug,"listView"),d=Go(a.slug);return(0,r.useEffect)(()=>{c||i(d)},[c,i,d]),(0,r.useEffect)(()=>{s(h0(n))},[s,n]),(0,r.useEffect)(()=>()=>{s(y0())},[s]),u?r.createElement(XE,oC(rC({},a),{layout:n,permissions:u})):null};sc.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}).isRequired,options:o().object.isRequired,settings:o().object.isRequired,pluginOptions:o().object}).isRequired}).isRequired,slug:o().string.isRequired};const sC=sc,iC=(e,t)=>fe.be.put(ye(`content-types/${t}/configuration`),e),lC=(0,L.default)(W.Flex)`
|
|
1135
|
+
gap: ${({theme:e})=>e.spaces[4]};
|
|
1136
|
+
`,Xr=({modifiedData:e,onChange:t,sortOptions:n})=>{const{formatMessage:a}=(0,N.useIntl)(),{settings:s}=e;return r.createElement(r.Fragment,null,r.createElement(D.Box,{paddingBottom:4},r.createElement(x.Typography,{variant:"delta",as:"h2"},a({id:E("containers.SettingPage.settings"),defaultMessage:"Settings"}))),r.createElement(lC,{justifyContent:"space-between",wrap:"wrap",paddingBottom:6},r.createElement(Dt.ToggleInput,{label:a({id:E("form.Input.search"),defaultMessage:"Enable search"}),onChange:i=>{t({target:{name:"settings.searchable",value:i.target.checked}})},onLabel:a({id:"app.components.ToggleCheckbox.on-label",defaultMessage:"on"}),offLabel:a({id:"app.components.ToggleCheckbox.off-label",defaultMessage:"off"}),name:"settings.searchable",checked:s.searchable}),r.createElement(Dt.ToggleInput,{label:a({id:E("form.Input.filters"),defaultMessage:"Enable filters"}),onChange:i=>{t({target:{name:"settings.filterable",value:i.target.checked}})},onLabel:a({id:"app.components.ToggleCheckbox.on-label",defaultMessage:"on"}),offLabel:a({id:"app.components.ToggleCheckbox.off-label",defaultMessage:"off"}),name:"settings.filterable",checked:s.filterable}),r.createElement(Dt.ToggleInput,{label:a({id:E("form.Input.bulkActions"),defaultMessage:"Enable bulk actions"}),onChange:i=>{t({target:{name:"settings.bulkable",value:i.target.checked}})},onLabel:a({id:"app.components.ToggleCheckbox.on-label",defaultMessage:"on"}),offLabel:a({id:"app.components.ToggleCheckbox.off-label",defaultMessage:"off"}),name:"settings.bulkable",checked:s.bulkable})),r.createElement(de.Grid,{gap:4},r.createElement(de.GridItem,{s:12,col:6},r.createElement(pe.Select,{label:a({id:E("form.Input.pageEntries"),defaultMessage:"Entries per page"}),hint:a({id:E("form.Input.pageEntries.inputDescription"),defaultMessage:"Note: You can override this value in the Collection Type settings page."}),onChange:i=>t({target:{name:"settings.pageSize",value:i}}),name:"settings.pageSize",value:e.settings.pageSize||""},[10,20,50,100].map(i=>r.createElement(pe.Option,{key:i,value:i},i)))),r.createElement(de.GridItem,{s:12,col:3},r.createElement(pe.Select,{label:a({id:E("form.Input.defaultSort"),defaultMessage:"Default sort attribute"}),onChange:i=>t({target:{name:"settings.defaultSortBy",value:i}}),name:"settings.defaultSortBy",value:e.settings.defaultSortBy||""},n.map(i=>r.createElement(pe.Option,{key:i,value:i},i)))),r.createElement(de.GridItem,{s:12,col:3},r.createElement(pe.Select,{label:a({id:E("form.Input.sort.order"),defaultMessage:"Default sort order"}),onChange:i=>t({target:{name:"settings.defaultSortOrder",value:i}}),name:"settings.defaultSortOrder",value:e.settings.defaultSortOrder||""},["ASC","DESC"].map(i=>r.createElement(pe.Option,{key:i,value:i},i))))))};Xr.defaultProps={modifiedData:{},sortOptions:[]},Xr.propTypes={modifiedData:o().object,onChange:o().func.isRequired,sortOptions:o().array};const cC=Xr,eo=L.default.button`
|
|
1137
|
+
display: flex;
|
|
1138
|
+
align-items: center;
|
|
1139
|
+
height: ${({theme:e})=>e.spaces[7]};
|
|
1140
|
+
|
|
1141
|
+
&:last-child {
|
|
1142
|
+
padding: 0 ${({theme:e})=>e.spaces[3]};
|
|
1143
|
+
}
|
|
1144
|
+
`,ic=(0,L.default)(eo)`
|
|
1145
|
+
padding: 0 ${({theme:e})=>e.spaces[3]};
|
|
1146
|
+
border-right: 1px solid ${({theme:e})=>e.colors.neutral150};
|
|
1147
|
+
cursor: all-scroll;
|
|
1148
|
+
|
|
1149
|
+
svg {
|
|
1150
|
+
width: ${12/16}rem;
|
|
1151
|
+
height: ${12/16}rem;
|
|
1152
|
+
}
|
|
1153
|
+
`,uC=(0,L.default)(W.Flex)`
|
|
1154
|
+
max-height: ${32/16}rem;
|
|
1155
|
+
cursor: pointer;
|
|
1156
|
+
|
|
1157
|
+
svg {
|
|
1158
|
+
width: ${10/16}rem;
|
|
1159
|
+
height: ${10/16}rem;
|
|
1160
|
+
|
|
1161
|
+
path {
|
|
1162
|
+
fill: ${({theme:e})=>e.colors.neutral600};
|
|
1163
|
+
}
|
|
1164
|
+
}
|
|
1165
|
+
|
|
1166
|
+
&:hover {
|
|
1167
|
+
background-color: ${({theme:e})=>e.colors.primary100};
|
|
1168
|
+
border-color: ${({theme:e})=>e.colors.primary200};
|
|
1169
|
+
|
|
1170
|
+
svg {
|
|
1171
|
+
path {
|
|
1172
|
+
fill: ${({theme:e})=>e.colors.primary600};
|
|
1173
|
+
}
|
|
1174
|
+
}
|
|
1175
|
+
|
|
1176
|
+
${x.Typography} {
|
|
1177
|
+
color: ${({theme:e})=>e.colors.primary600};
|
|
1178
|
+
}
|
|
1179
|
+
|
|
1180
|
+
${ic} {
|
|
1181
|
+
border-right: 1px solid ${({theme:e})=>e.colors.primary200};
|
|
1182
|
+
}
|
|
1183
|
+
}
|
|
1184
|
+
`,dC=(0,L.default)(D.Box)`
|
|
1185
|
+
&:last-child {
|
|
1186
|
+
padding-right: ${({theme:e})=>e.spaces[3]};
|
|
1187
|
+
}
|
|
1188
|
+
`,lc=({index:e,isDraggingSibling:t,labelField:n,onClickEditField:a,onMoveField:s,onRemoveField:i,name:l,setIsDraggingSibling:c})=>{const{formatMessage:u}=(0,N.useIntl)(),d=(0,r.useRef)(null),m=(0,r.useRef)(null),[,g]=(0,r.useState)(!1),f=(0,r.useRef)(),h=io(n),b=()=>{f.current&&f.current.click()},[,v]=(0,Le.useDrop)({accept:Re.FIELD,hover(T,M){if(!m.current)return;const V=T.index,A=e;if(V===A)return;const H=m.current.getBoundingClientRect(),Q=(H.right-H.left)/2,G=M.getClientOffset().x-H.left;V>A&&G>Q||V<A&&G<Q||(s(V,A),T.index=A)}}),[{isDragging:S},O,C]=(0,Le.useDrag)({type:Re.FIELD,item(){return{index:e,labelField:n,name:l}},collect:T=>({isDragging:T.isDragging()}),end(){c(!1)}});(0,r.useEffect)(()=>{C((0,dr.rX)(),{captureDraggingState:!1})},[C]),(0,r.useEffect)(()=>{S&&c(!0)},[S,c]),(0,r.useEffect)(()=>{t||g(T=>!T)},[t]);const B={dragRef:O(d),dropRef:v(m)};return r.createElement(dC,{ref:B?B.dropRef:null},S&&r.createElement(Mn,{transparent:!0,labelField:h}),!S&&t&&r.createElement(Mn,{isSibling:!0,labelField:h}),!S&&!t&&r.createElement(uC,{borderColor:"neutral150",background:"neutral100",hasRadius:!0,justifyContent:"space-between",onClick:b,isDragging:S},r.createElement(ue.Stack,{horizontal:!0,spacing:3},r.createElement(ic,{as:"span","aria-label":u({id:E("components.DraggableCard.move.field"),defaultMessage:"Move {item}"},{item:l}),onClick:T=>T.stopPropagation(),ref:B.dragRef,type:"button"},r.createElement(lt(),null)),r.createElement(x.Typography,{fontWeight:"bold"},h)),r.createElement(W.Flex,{paddingLeft:3},r.createElement(eo,{ref:f,onClick:T=>{T.stopPropagation(),a(l)},"aria-label":u({id:E("components.DraggableCard.edit.field"),defaultMessage:"Edit {item}"},{item:l}),type:"button"},r.createElement(ct(),null)),r.createElement(eo,{onClick:i,"data-testid":`delete-${l}`,"aria-label":u({id:E("components.DraggableCard.delete.field"),defaultMessage:"Delete {item}"},{item:l}),type:"button"},r.createElement(Pn(),null)))))};lc.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 pC=lc,cc=(0,L.default)(D.Box)`
|
|
1189
|
+
flex: ${({size:e})=>e};
|
|
1190
|
+
`,mC=(0,L.default)(cc)`
|
|
1191
|
+
overflow-x: scroll;
|
|
1192
|
+
overflow-y: hidden;
|
|
1193
|
+
`,fC=(0,L.default)(cc)`
|
|
1194
|
+
max-width: ${32/16}rem;
|
|
1195
|
+
`,uc=({displayedFields:e,listRemainingFields:t,metadatas:n,onAddField:a,onClickEditField:s,onMoveField:i,onRemoveField:l})=>{const{formatMessage:c}=(0,N.useIntl)(),[u,d]=(0,r.useState)(!1),[m,g]=(0,r.useState)(null),f=(0,r.useRef)();function h(...v){g("add"),a(...v)}function b(...v){g("remove"),l(...v)}return(0,r.useEffect)(()=>{m==="add"&&(f==null?void 0:f.current)&&(f.current.scrollLeft=f.current.scrollWidth)},[e,m]),r.createElement(r.Fragment,null,r.createElement(D.Box,{paddingBottom:4},r.createElement(x.Typography,{variant:"delta",as:"h2"},c({id:E("containers.SettingPage.view"),defaultMessage:"View"}))),r.createElement(W.Flex,{paddingTop:4,paddingLeft:4,paddingRight:4,borderColor:"neutral300",borderStyle:"dashed",borderWidth:"1px",hasRadius:!0},r.createElement(mC,{size:"1",paddingBottom:4,ref:f},r.createElement(ue.Stack,{horizontal:!0,spacing:3},e.map((v,S)=>r.createElement(pC,{key:v,index:S,isDraggingSibling:u,onMoveField:i,onClickEditField:s,onRemoveField:O=>b(O,S),name:v,labelField:n[v].list.label||v,setIsDraggingSibling:d})))),r.createElement(fC,{size:"auto",paddingBottom:4},r.createElement(Ve.SimpleMenu,{label:c({id:E("components.FieldSelect.label"),defaultMessage:"Add a field"}),as:Te.IconButton,icon:r.createElement(Tt(),null),disabled:t.length<=0,"data-testid":"add-field"},t.map(v=>r.createElement(Ve.MenuItem,{key:v,onClick:()=>h(v)},v))))))};uc.propTypes={displayedFields:De.PropTypes.array.isRequired,listRemainingFields:De.PropTypes.array.isRequired,metadatas:De.PropTypes.objectOf(De.PropTypes.shape({list:De.PropTypes.shape({label:De.PropTypes.string})})).isRequired,onAddField:De.PropTypes.func.isRequired,onClickEditField:De.PropTypes.func.isRequired,onMoveField:De.PropTypes.func.isRequired,onRemoveField:De.PropTypes.func.isRequired};const gC=uc,yC=(0,L.default)(W.Flex)`
|
|
1196
|
+
svg {
|
|
1197
|
+
width: ${32/16}rem;
|
|
1198
|
+
height: ${24/16}rem;
|
|
1199
|
+
margin-right: ${({theme:e})=>e.spaces[3]};
|
|
1200
|
+
}
|
|
1201
|
+
`,dc=({attributes:e,fieldForm:t,fieldToEdit:n,onCloseModal:a,onChangeEditLabel:s,onSubmit:i,type:l})=>{const{formatMessage:c}=(0,N.useIntl)(),u=e[n].relationType;let d=!["media","relation"].includes(l);return["oneWay","oneToOne","manyToOne"].includes(u)&&(d=!0),r.createElement(Je.ModalLayout,{onClose:a,labelledBy:"title"},r.createElement("form",{onSubmit:i},r.createElement(Je.ModalHeader,null,r.createElement(yC,null,r.createElement(ol,{type:l}),r.createElement(x.Typography,{fontWeight:"bold",textColor:"neutral800",as:"h2",id:"title"},c({id:E("containers.ListSettingsView.modal-form.edit-label"),defaultMessage:"Edit {fieldName}"},{fieldName:wt()(n)})))),r.createElement(Je.ModalBody,null,r.createElement(de.Grid,{gap:4},r.createElement(de.GridItem,{s:12,col:6},r.createElement(Jn.TextInput,{id:"label-input",label:c({id:E("form.Input.label"),defaultMessage:"Label"}),name:"label",onChange:m=>s(m),value:t.label,hint:c({id:E("form.Input.label.inputDescription"),defaultMessage:"This value overrides the label displayed in the table's head"})})),d&&r.createElement(de.GridItem,{s:12,col:6},r.createElement(Dt.ToggleInput,{"data-testid":"Enable sort on this field",checked:t.sortable,label:c({id:E("form.Input.sort.field"),defaultMessage:"Enable sort on this field"}),name:"sortable",onChange:m=>s({target:{name:"sortable",value:m.target.checked}}),onLabel:c({id:"app.components.ToggleCheckbox.on-label",defaultMessage:"on"}),offLabel:c({id:"app.components.ToggleCheckbox.off-label",defaultMessage:"off"})})))),r.createElement(Je.ModalFooter,{startActions:r.createElement(be.Button,{onClick:a,variant:"tertiary"},c({id:"app.components.Button.cancel",defaultMessage:"Cancel"})),endActions:r.createElement(be.Button,{type:"submit"},c({id:"global.finish",defaultMessage:"Finish"}))})))};dc.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 hC=dc;var bC=Object.defineProperty,vC=Object.defineProperties,EC=Object.getOwnPropertyDescriptors,pc=Object.getOwnPropertySymbols,CC=Object.prototype.hasOwnProperty,OC=Object.prototype.propertyIsEnumerable,mc=(e,t,n)=>t in e?bC(e,t,{enumerable:!0,configurable:!0,writable:!0,value:n}):e[t]=n,PC=(e,t)=>{for(var n in t||(t={}))CC.call(t,n)&&mc(e,n,t[n]);if(pc)for(var n of pc(t))OC.call(t,n)&&mc(e,n,t[n]);return e},RC=(e,t)=>vC(e,EC(t));const TC=(e,t)=>RC(PC({},e),{initialData:t,modifiedData:t}),to={fieldForm:{},fieldToEdit:"",initialData:{},modifiedData:{}},MC=(e=to,t)=>(0,zt.default)(e,n=>{const a=["modifiedData","layouts","list"];switch(t.type){case"ADD_FIELD":{const s=w()(e,a,[]);te()(n,a,[...s,t.item]);break}case"MOVE_FIELD":{const s=w()(e,a,[]),{originalIndex:i,atIndex:l}=t;te()(n,a,$t(s,i,l));break}case"ON_CHANGE":{te()(n,["modifiedData",...t.keys.split(".")],t.value);break}case"ON_CHANGE_FIELD_METAS":{te()(n,["fieldForm",t.name],t.value);break}case"REMOVE_FIELD":{const s=w()(e,a,[]);te()(n,a,s.filter((i,l)=>t.index!==l));break}case"SET_FIELD_TO_EDIT":{const{fieldToEdit:s}=t;n.fieldToEdit=s,n.fieldForm.label=w()(n,["modifiedData","metadatas",s,"list","label"],""),n.fieldForm.sortable=w()(n,["modifiedData","metadatas",s,"list","sortable"],"");break}case"UNSET_FIELD_TO_EDIT":{n.fieldForm={},n.fieldToEdit="";break}case"SUBMIT_FIELD_FORM":{const s=["modifiedData","metadatas",e.fieldToEdit,"list"];te()(n,[...s,"label"],e.fieldForm.label),te()(n,[...s,"sortable"],e.fieldForm.sortable);break}default:return n}}),wC=["media","richtext","dynamiczone","relation","component","json"];var IC=(e,t,n)=>new Promise((a,s)=>{var i=u=>{try{c(n.next(u))}catch(d){s(d)}},l=u=>{try{c(n.throw(u))}catch(d){s(d)}},c=u=>u.done?a(u.value):Promise.resolve(u.value).then(i,l);c((n=n.apply(e,t)).next())});const fc=({layout:e,slug:t})=>{const{formatMessage:n}=(0,N.useIntl)(),{trackUsage:a}=(0,y.useTracking)(),s=Zo(),i=(0,y.useNotification)(),{refetchData:l}=(0,r.useContext)(co),[c,u]=(0,r.useState)(!1),d=()=>u(R=>!R),[m,g]=(0,r.useState)(!1),f=()=>g(R=>!R),[h,b]=(0,r.useReducer)(MC,to,()=>TC(to,e)),{fieldToEdit:v,fieldForm:S,initialData:O,modifiedData:C}=h,{attributes:B}=e,T=C.layouts.list,M=()=>{const{settings:{pageSize:R,defaultSortBy:P,defaultSortOrder:z},kind:Y,uid:se}=O,ae=`${P}:${z}`,_=`${(0,We.stringify)({page:1,pageSize:R,sort:ae},{encode:!1})}${s?`&${s}`:""}`;return`/content-manager/${Y}/${se}?${_}`},V=({target:{name:R,value:P}})=>{b({type:"ON_CHANGE",keys:R,value:R==="settings.pageSize"?parseInt(P,10):P})},A=()=>IC(void 0,null,function*(){const R=zi()(C,["layouts","settings","metadatas"]);I.mutate(R)}),H=R=>{b({type:"ADD_FIELD",item:R})},Q=(R,P)=>{R.stopPropagation(),T.length===1?i({type:"info",message:{id:E("notification.info.minimumFields")}}):b({type:"REMOVE_FIELD",index:P})},j=R=>{R.preventDefault(),d(),a("willSaveContentTypeLayout")},G=R=>{b({type:"SET_FIELD_TO_EDIT",fieldToEdit:R}),f()},U=()=>{b({type:"UNSET_FIELD_TO_EDIT"}),f()},F=R=>{R.preventDefault(),f(),b({type:"SUBMIT_FIELD_FORM"})},I=(0,nt.useMutation)(R=>iC(R,t),{onSuccess(){a("didEditListSettings"),l()},onError(){i({type:"warning",message:{id:"notification.error"}})}}),{isLoading:K}=I,$=({target:{name:R,value:P}})=>{b({type:"ON_CHANGE_FIELD_METAS",name:R,value:P})},Z=Object.entries(B).reduce((R,P)=>{const[z,Y]=P,se=go(Y),ae=T.includes(z);return se&&!ae&&R.push(z),R},[]).sort(),q=Object.entries(B).reduce((R,P)=>{const[z,{type:Y}]=P;return wC.includes(Y)||R.push(z),R},[]),k=(R,P)=>{b({type:"MOVE_FIELD",originalIndex:R,atIndex:P})};return r.createElement(ee.Layout,null,r.createElement(ie.Main,{"aria-busy":K},r.createElement("form",{onSubmit:j},r.createElement(ee.HeaderLayout,{navigationAction:r.createElement(y.Link,{startIcon:r.createElement(dn(),null),to:M,id:"go-back"},n({id:"global.back",defaultMessage:"Back"})),primaryAction:r.createElement(be.Button,{size:"S",startIcon:r.createElement(mt(),null),disabled:on()(C,O),type:"submit"},n({id:"global.save",defaultMessage:"Save"})),subtitle:n({id:E("components.SettingsViewWrapper.pluginHeader.description.list-settings"),defaultMessage:"Define the settings of the list view."}),title:n({id:E("components.SettingsViewWrapper.pluginHeader.title"),defaultMessage:"Configure the view - {name}"},{name:wt()(C.info.displayName)})}),r.createElement(ee.ContentLayout,null,r.createElement(D.Box,{background:"neutral0",hasRadius:!0,shadow:"tableShadow",paddingTop:6,paddingBottom:6,paddingLeft:7,paddingRight:7},r.createElement(cC,{modifiedData:C,onChange:V,sortOptions:q}),r.createElement(D.Box,{paddingTop:6,paddingBottom:6},r.createElement(wr.Divider,null)),r.createElement(gC,{listRemainingFields:Z,displayedFields:T,onAddField:H,onClickEditField:G,onMoveField:k,onRemoveField:Q,metadatas:C.metadatas}))),r.createElement(y.ConfirmDialog,{bodyText:{id:E("popUpWarning.warning.updateAllSettings"),defaultMessage:"This will modify all your settings"},iconRightButton:r.createElement(mt(),null),isConfirmButtonLoading:K,isOpen:c,onToggleDialog:d,onConfirm:A,variantRightButton:"success-light"})),m&&r.createElement(hC,{attributes:B,fieldForm:S,fieldToEdit:v,onChangeEditLabel:$,onCloseModal:U,onSubmit:F,type:w()(B,[v,"type"],"text")})))};fc.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 DC=(0,r.memo)(fc),gc=Ie.Z.contentManager,yc=({match:{params:{slug:e},url:t}})=>{const{isLoading:n,layout:a,updateLayout:s}=zo(e),{rawContentTypeLayout:i,rawComponentsLayouts:l}=(0,r.useMemo)(()=>{let m={},g={};return a.contentType&&(m=Vt(a.contentType)),a.components&&(g=Object.keys(a.components).reduce((f,h)=>(f[h]=Vt(a.components[h]),f),{})),{rawContentTypeLayout:m,rawComponentsLayouts:g}},[a]);if((0,X.get)(a,["contentType","uid"],null)!==e||n)return r.createElement(y.LoadingIndicatorPage,null);const u=({location:{state:m},history:{goBack:g},match:{params:{id:f,origin:h}}},b)=>r.createElement(b,{slug:e,layout:a,state:m,goBack:g,id:f,origin:h}),d=[{path:"create/clone/:origin",comp:mn},{path:"create",comp:mn},{path:":id",comp:mn},{path:"",comp:sC}].map(({path:m,comp:g})=>r.createElement(oe.Route,{key:m,path:`${t}/${m}`,render:f=>u(f,g)}));return r.createElement(Wc.SV,{FallbackComponent:y.ErrorFallback},r.createElement(uo.Provider,{value:a},r.createElement(oe.Switch,null,r.createElement(oe.Route,{path:`${t}/configurations/list`},r.createElement(y.CheckPagePermissions,{permissions:gc.collectionTypesConfigurations},r.createElement(DC,{layout:i,slug:e,updateLayout:s}))),r.createElement(oe.Route,{path:`${t}/configurations/edit`},r.createElement(y.CheckPagePermissions,{permissions:gc.collectionTypesConfigurations},r.createElement(Wr,{components:l,isContentTypeView:!0,mainLayout:i,slug:e,updateLayout:s}))),d)))};yc.propTypes={match:o().shape({url:o().string.isRequired,params:o().shape({slug:o().string.isRequired}).isRequired}).isRequired};const SC=(0,r.memo)(yc);var hc=p(57678),LC=p(98399),xC=(e,t,n)=>new Promise((a,s)=>{var i=u=>{try{c(n.next(u))}catch(d){s(d)}},l=u=>{try{c(n.throw(u))}catch(d){s(d)}},c=u=>u.done?a(u.value):Promise.resolve(u.value).then(i,l);c((n=n.apply(e,t)).next())});const FC=Ie.Z.contentManager,kC=()=>{const[{isLoading:e,data:t},n]=(0,r.useReducer)(hc.Z,hc.q),a=(0,r.useMemo)(Sn,[]),{schemas:s}=(0,he.useSelector)(l=>a(l),he.shallowEqual),{uid:i}=(0,oe.useParams)();return(0,r.useEffect)(()=>{const c=ke().CancelToken.source();return(d=>xC(void 0,null,function*(){try{n(rn());const{data:{data:m}}=yield fe.be.get(ye(`components/${i}/configuration`),{cancelToken:d.token});n(Er(wo(m,s,"component")))}catch(m){if(ke().isCancel(m))return;LC.error(m)}}))(c),()=>{c.cancel("Operation canceled by the user.")}},[i,s]),e?r.createElement(y.LoadingIndicatorPage,null):r.createElement(y.CheckPagePermissions,{permissions:FC.componentsConfigurations},r.createElement(Wr,{components:t.components,mainLayout:t.component,slug:i}))},AC=(0,r.memo)(kC);var jC=p(64354),$C=p(97042),BC=p.n($C);const NC=()=>{const{formatMessage:e}=(0,N.useIntl)();return(0,y.useFocusWhenNavigate)(),r.createElement(ie.Main,null,r.createElement(ee.HeaderLayout,{title:e({id:E("header.name"),defaultMessage:"Content"})}),r.createElement(ee.ContentLayout,null,r.createElement(jC.EmptyStateLayout,{action:r.createElement(y.LinkButton,{variant:"secondary",startIcon:r.createElement(Tt(),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(BC(),{width:"10rem"}),shadow:"tableShadow"})))},VC=()=>{const{formatMessage:e}=(0,N.useIntl)();return(0,y.useFocusWhenNavigate)(),r.createElement(ie.Main,null,r.createElement(ee.HeaderLayout,{title:e({id:E("header.name"),defaultMessage:"Content"})}),r.createElement(ee.ContentLayout,null,r.createElement(y.NoPermissions,null)))},qC=Ie.Z.contentManager,bc=({match:{params:{slug:e},url:t}})=>{const{isLoading:n,layout:a,updateLayout:s}=zo(e),{rawContentTypeLayout:i,rawComponentsLayouts:l}=(0,r.useMemo)(()=>{let c={},u={};return a.contentType&&(u=Vt(a.contentType)),a.components&&(c=Object.keys(a.components).reduce((d,m)=>(d[m]=Vt(a.components[m]),d),{})),{rawContentTypeLayout:u,rawComponentsLayouts:c}},[a]);return n?r.createElement(y.LoadingIndicatorPage,null):r.createElement(uo.Provider,{value:a},r.createElement(oe.Switch,null,r.createElement(oe.Route,{path:`${t}/configurations/edit`},r.createElement(y.CheckPagePermissions,{permissions:qC.singleTypesConfigurations},r.createElement(Wr,{components:l,isContentTypeView:!0,mainLayout:i,slug:e,updateLayout:s}))),r.createElement(oe.Route,{path:t,render:({location:{state:c},history:{goBack:u}})=>r.createElement(mn,{layout:a,slug:e,isSingleType:!0,state:c,goBack:u})})))};bc.propTypes={match:o().shape({url:o().string.isRequired,params:o().shape({slug:o().string.isRequired}).isRequired}).isRequired};const zC=(0,r.memo)(bc);var WC=p(58469),UC=p(59578),vc=p.n(UC),Ft=p(89420),_C=Object.defineProperty,HC=Object.defineProperties,GC=Object.getOwnPropertyDescriptors,Ec=Object.getOwnPropertySymbols,ZC=Object.prototype.hasOwnProperty,QC=Object.prototype.propertyIsEnumerable,Cc=(e,t,n)=>t in e?_C(e,t,{enumerable:!0,configurable:!0,writable:!0,value:n}):e[t]=n,JC=(e,t)=>{for(var n in t||(t={}))ZC.call(t,n)&&Cc(e,n,t[n]);if(Ec)for(var n of Ec(t))QC.call(t,n)&&Cc(e,n,t[n]);return e},KC=(e,t)=>HC(e,GC(t));const Oc=(e,t)=>(0,WC.ZP)(e,vc()(t),{keys:[n=>vc()(n.title)]}),YC=()=>{const[e,t]=(0,r.useState)(""),{formatMessage:n}=(0,N.useIntl)(),a=(0,r.useMemo)(Bu,[]),{collectionTypeLinks:s,singleTypeLinks:i}=(0,he.useSelector)(h=>a(h),he.shallowEqual),l=h=>h.map(b=>KC(JC({},b),{title:n({id:b.title,defaultMessage:b.title})})),c=l(s),u=l(i),d=[{id:"collectionTypes",title:{id:E("components.LeftMenu.collection-types"),defaultMessage:"Collection Types"},searchable:!0,links:ce()(Oc(c,e),h=>h.title.toLowerCase())},{id:"singleTypes",title:{id:E("components.LeftMenu.single-types"),defaultMessage:"Single Types"},searchable:!0,links:ce()(Oc(u,e),h=>h.title.toLowerCase())}],m=()=>{t("")},g=({target:{value:h}})=>{t(h)},f=n({id:E("header.name"),defaultMessage:"Content"});return r.createElement(Ft.SubNav,{ariaLabel:f},r.createElement(Ft.SubNavHeader,{label:f,searchable:!0,value:e,onChange:g,onClear:m,searchLabel:n({id:"content-manager.components.LeftMenu.Search.label",defaultMessage:"Search for a content type"})}),r.createElement(Ft.SubNavSections,null,d.map(h=>{const b=n({id:h.title.id,defaultMessage:h.title.defaultMessage},h.title.values);return r.createElement(Ft.SubNavSection,{key:h.id,label:b,badgeLabel:h.links.length.toString()},h.links.map(v=>{const S=v.search?`?${v.search}`:"";return r.createElement(Ft.SubNavLink,{as:oe.NavLink,key:v.uid,to:`${v.to}${S}`},v.title)}))})))};var no=p(92886);const XC=()=>({type:no.ZA}),eO=()=>({type:no.c2}),tO=(e,t,n,a)=>({type:no.ix,data:{authorizedCtLinks:e,authorizedStLinks:t,components:a,contentTypeSchemas:n}}),Pc=(e,t,n=[])=>e.filter(a=>a.isDisplayed).map(a=>{const s=[{action:"plugin::content-manager.explorer.create",subject:a.uid},{action:"plugin::content-manager.explorer.read",subject:a.uid}],i=[{action:"plugin::content-manager.explorer.read",subject:a.uid}],l=t==="collectionTypes"?s:i,c=n.find(({uid:d})=>d===a.uid);let u=null;if(c){const d={page:1,pageSize:c.settings.pageSize,sort:`${c.settings.defaultSortBy}:${c.settings.defaultSortOrder}`};u=(0,We.stringify)(d,{encode:!1})}return{permissions:l,search:u,kind:a.kind,title:a.info.displayName,to:`/content-manager/${a.kind}/${a.uid}`,uid:a.uid,name:a.uid,isDisplayed:a.isDisplayed}}),nO=(e,t)=>{const[n,a]=(0,X.chain)(e).groupBy("kind").map((s,i)=>({name:i,links:s})).sortBy("name").value();return{collectionTypesSectionLinks:Pc((0,X.get)(n,"links",[]),"collectionTypes",t),singleTypesSectionLinks:Pc((0,X.get)(a,"links",[]),"singleTypes")}},Rc=(e,t)=>t.map(({permissions:n})=>(0,y.hasPermissions)(e,n));var rO=p(98399),oO=(e,t,n)=>new Promise((a,s)=>{var i=u=>{try{c(n.next(u))}catch(d){s(d)}},l=u=>{try{c(n.throw(u))}catch(d){s(d)}},c=u=>u.done?a(u.value):Promise.resolve(u.value).then(i,l);c((n=n.apply(e,t)).next())});const aO=(e,t,n)=>oO(void 0,null,function*(){try{const{data:{data:a}}=yield fe.be.get(ye("content-types-settings")),{collectionTypesSectionLinks:s,singleTypesSectionLinks:i}=nO(e,a),l=Rc(t,s),c=yield Promise.all(l),u=s.filter((f,h)=>c[h]),d=Rc(t,i),m=yield Promise.all(d),g=i.filter((f,h)=>m[h]);return{authorizedCtLinks:u,authorizedStLinks:g}}catch(a){return rO.error(a),n({type:"warning",message:{id:"notification.error"}}),{authorizedCtLinks:[],authorizedStLinks:[],contentTypes:[]}}});var sO=p(98399),iO=Object.defineProperty,lO=Object.defineProperties,cO=Object.getOwnPropertyDescriptors,Tc=Object.getOwnPropertySymbols,uO=Object.prototype.hasOwnProperty,dO=Object.prototype.propertyIsEnumerable,Mc=(e,t,n)=>t in e?iO(e,t,{enumerable:!0,configurable:!0,writable:!0,value:n}):e[t]=n,pO=(e,t)=>{for(var n in t||(t={}))uO.call(t,n)&&Mc(e,n,t[n]);if(Tc)for(var n of Tc(t))dO.call(t,n)&&Mc(e,n,t[n]);return e},mO=(e,t)=>lO(e,cO(t)),fO=(e,t,n)=>new Promise((a,s)=>{var i=u=>{try{c(n.next(u))}catch(d){s(d)}},l=u=>{try{c(n.throw(u))}catch(d){s(d)}},c=u=>u.done?a(u.value):Promise.resolve(u.value).then(i,l);c((n=n.apply(e,t)).next())});const gO=()=>{const e=(0,he.useDispatch)(),t=(0,y.useNotification)(),n=(0,he.useSelector)(Ot()),a=(0,r.useRef)(),{allPermissions:s}=(0,y.useRBACProvider)(),{runHookWaterfall:i}=(0,y.useStrapiApp)(),c=ke().CancelToken.source(),{notifyStatus:u}=(0,_r.useNotifyAT)(),{formatMessage:d}=(0,N.useIntl)(),m=()=>fO(void 0,null,function*(){e(XC());try{const[{data:{data:g}},{data:{data:f}}]=yield Promise.all(["components","content-types"].map(C=>fe.be.get(ye(C),{cancelToken:c.token})));u(d({id:E("App.schemas.data-loaded"),defaultMessage:"The schemas have been successfully loaded."}));const{authorizedCtLinks:h,authorizedStLinks:b}=yield aO(f,s,t),{ctLinks:v}=i(Ut.LK,{ctLinks:h,models:f}),{stLinks:S}=i(Ut.dV,{stLinks:b,models:f}),O=tO(v,S,f,g);e(O)}catch(g){if(ke().isCancel(g))return;sO.error(g),t({type:"warning",message:{id:"notification.error"}})}});return a.current=m,(0,r.useEffect)(()=>(a.current(),()=>{c.cancel("Operation canceled by the user."),e(eO())}),[e,t]),mO(pO({},n),{refetchData:a.current})},yO=Ie.Z.contentManager,wc=()=>{const e=(0,oe.useRouteMatch)("/content-manager/:kind/:uid"),{status:t,collectionTypeLinks:n,singleTypeLinks:a,models:s,refetchData:i}=gO(),l=ce()([...n,...a],f=>f.title.toLowerCase()),{pathname:c}=(0,oe.useLocation)(),{formatMessage:u}=(0,N.useIntl)(),{startSection:d}=(0,y.useGuidedTour)(),m=(0,r.useRef)(d);if((0,r.useEffect)(()=>{m.current&&m.current("contentManager")},[]),t==="loading")return r.createElement(ie.Main,{"aria-busy":"true"},r.createElement(ee.HeaderLayout,{title:u({id:E("header.name"),defaultMessage:"Content"})}),r.createElement(y.LoadingIndicatorPage,null));const g=s.filter(({isDisplayed:f})=>f);return l.length===0&&g.length>0&&c!=="/content-manager/403"?r.createElement(oe.Redirect,{to:"/content-manager/403"}):g.length===0&&c!=="/content-manager/no-content-types"?r.createElement(oe.Redirect,{to:"/content-manager/no-content-types"}):!e&&l.length>0?r.createElement(oe.Redirect,{to:`${l[0].to}${l[0].search?`?${l[0].search}`:""}`}):r.createElement(ee.Layout,{sideNav:r.createElement(YC,null)},r.createElement(zc,null),r.createElement(co.Provider,{value:{refetchData:i}},r.createElement(oe.Switch,null,r.createElement(oe.Route,{path:"/content-manager/components/:uid/configurations/edit"},r.createElement(y.CheckPagePermissions,{permissions:yO.componentsConfigurations},r.createElement(AC,null))),r.createElement(oe.Route,{path:"/content-manager/collectionType/:slug",component:SC}),r.createElement(oe.Route,{path:"/content-manager/singleType/:slug",component:zC}),r.createElement(oe.Route,{path:"/content-manager/403"},r.createElement(VC,null)),r.createElement(oe.Route,{path:"/content-manager/no-content-types"},r.createElement(NC,null)),r.createElement(oe.Route,{path:"",component:y.NotFound}))))};function hO(){const{formatMessage:e}=(0,N.useIntl)();return r.createElement(r.Fragment,null,r.createElement(it.Helmet,{title:e({id:E("plugin.name"),defaultMessage:"Content Manager"})}),r.createElement(wc,null))}},57544:()=>{},59599:()=>{},42310:()=>{},33842:()=>{},85695:()=>{}}]);
|