@strapi/admin 4.2.1-alpha.0 → 4.3.0-beta.2
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/app.js +7 -4
- package/admin/src/components/OverlayBlocker/index.js +4 -0
- package/admin/src/content-manager/components/DynamicTable/CellContent/utils/hasContent.js +1 -1
- package/admin/src/content-manager/components/EditViewDataManagerProvider/index.js +10 -16
- package/admin/src/content-manager/components/EditViewDataManagerProvider/utils/cleanData.js +1 -0
- package/admin/src/content-manager/components/SelectMany/index.js +2 -4
- package/admin/src/content-manager/components/SelectWrapper/index.js +1 -13
- package/admin/src/content-manager/components/Wysiwyg/EditorStylesContainer.js +1 -1
- package/admin/src/content-manager/pages/ListView/index.js +2 -2
- package/admin/src/hooks/{useFetchInstalledPlugins → useFetchEnabledPlugins}/index.js +4 -4
- package/admin/src/hooks/{useFetchInstalledPlugins → useFetchEnabledPlugins}/utils/api.js +2 -2
- package/admin/src/hooks/useFetchMarketplaceProviders/index.js +1 -1
- package/admin/src/pages/Admin/index.js +15 -5
- package/admin/src/pages/App/constants.js +1 -0
- package/admin/src/pages/App/index.js +17 -3
- package/admin/src/pages/App/reducer.js +22 -0
- package/admin/src/pages/InstalledPluginsPage/Plugins.js +2 -2
- package/admin/src/pages/MarketplacePage/components/NpmPackageCard/index.js +7 -8
- package/admin/src/pages/MarketplacePage/components/NpmPackagesGrid/index.js +9 -3
- package/admin/src/pages/MarketplacePage/index.js +9 -39
- package/admin/src/pages/SettingsPage/pages/ApplicationInfosPage/components/LogoModalStepper/FromUrlForm.js +7 -3
- package/admin/src/reducers.js +4 -2
- package/admin/src/translations/en.json +2 -0
- package/admin/src/translations/hi.json +699 -0
- package/admin/src/translations/languageNativeNames.js +2 -0
- package/admin/src/translations/pl.json +238 -233
- package/admin/src/translations/sa.json +698 -0
- package/admin/src/translations/zh-Hans.json +28 -1
- package/admin/src/tsconfig.json +10 -0
- package/build/20.9e5a98b6.chunk.js +308 -0
- package/build/{9115.623dc4f7.chunk.js → 2336.cb1c0d6e.chunk.js} +1 -1
- package/build/2863.bf3c1eff.chunk.js +194 -0
- package/build/3531.ef1d2cfc.chunk.js +10 -0
- package/build/413.d5986568.chunk.js +284 -0
- package/build/{4715.4588fdf5.chunk.js → 4715.a6e62860.chunk.js} +8 -8
- package/build/5250.9988a0ad.chunk.js +12 -0
- package/build/{9158.e48d88af.chunk.js → 5520.9dcd6a9f.chunk.js} +32 -32
- package/build/5833.970a963d.chunk.js +112 -0
- package/build/6925.fb35248e.chunk.js +761 -0
- package/build/8773.16dea88d.chunk.js +327 -0
- package/build/{7757.f6eb5e92.chunk.js → 9166.5c585d7c.chunk.js} +25 -25
- package/build/9262.25aa12a5.chunk.js +1 -0
- package/build/Admin-authenticatedApp.d38dc4dd.chunk.js +80 -0
- package/build/Admin_homePage.e3571a75.chunk.js +71 -0
- package/build/Admin_marketplace.284bf8fc.chunk.js +11 -0
- package/build/Admin_pluginsPage.8537476f.chunk.js +1 -0
- package/build/{Admin_profilePage.249cbfc9.chunk.js → Admin_profilePage.b7f85e78.chunk.js} +2 -2
- package/build/Admin_settingsPage.858ef0d7.chunk.js +178 -0
- package/build/admin-edit-roles-page.33647266.chunk.js +1 -0
- package/build/admin-edit-users.8cd7519b.chunk.js +10 -0
- package/build/admin-users.6581eec5.chunk.js +11 -0
- package/build/{api-tokens-edit-page.3e453fc1.chunk.js → api-tokens-create-page.efa1d2aa.chunk.js} +1 -1
- package/build/api-tokens-edit-page.6101f051.chunk.js +1 -0
- package/build/{api-tokens-list-page.872c3800.chunk.js → api-tokens-list-page.782e872f.chunk.js} +2 -2
- package/build/{codemirror-css.98490df3.chunk.js → codemirror-css.4e2bbed3.chunk.js} +2 -2
- package/build/{codemirror-javacript.cafbda9c.chunk.js → codemirror-javacript.41bdefda.chunk.js} +1 -1
- package/build/codemirror-theme.a82cae4e.chunk.js +34 -0
- package/build/content-manager.adf6fc82.chunk.js +1182 -0
- package/build/content-type-builder-translation-pl-json.4a42349b.chunk.js +1 -0
- package/build/content-type-builder.366a3b10.chunk.js +142 -0
- package/build/{cropper-css.0055cd53.chunk.js → cropper-css.12fe038c.chunk.js} +4 -4
- package/build/{email-settings-page.1f235173.chunk.js → email-settings-page.d72e7f4c.chunk.js} +2 -2
- package/build/email-translation-pl-json.a03bcf98.chunk.js +1 -0
- package/build/{en-json.0a5ba154.chunk.js → en-json.729eb94d.chunk.js} +1 -1
- package/build/{fontawesome-css-all.b88d464e.chunk.js → fontawesome-css-all.15068c6e.chunk.js} +3 -3
- package/build/{fontawesome-css.a92a7b6c.chunk.js → fontawesome-css.418f40da.chunk.js} +2 -2
- package/build/hi-json.b4ae16d1.chunk.js +1 -0
- package/build/highlight.js.af2de364.chunk.js +86 -0
- package/build/i18n-settings-page.8803df0b.chunk.js +101 -0
- package/build/i18n-translation-pl-json.cea5bf23.chunk.js +1 -0
- package/build/index.html +1 -1
- package/build/main.689d6439.js +8688 -0
- package/build/pl-json.4d11f53d.chunk.js +1 -0
- package/build/runtime~main.308a7c41.js +2 -0
- package/build/sa-json.be504091.chunk.js +1 -0
- package/build/sso-settings-page.2bae79df.chunk.js +1 -0
- package/build/{upload-settings.4ee2f135.chunk.js → upload-settings.f1e587c0.chunk.js} +6 -6
- package/build/upload-translation-de-json.745613c0.chunk.js +1 -0
- package/build/upload-translation-dk-json.cb25dcf0.chunk.js +1 -0
- package/build/upload-translation-en-json.fddec9a6.chunk.js +1 -0
- package/build/upload-translation-es-json.1f344b53.chunk.js +1 -0
- package/build/upload-translation-fr-json.e21c0c7a.chunk.js +1 -0
- package/build/upload-translation-he-json.4ce77b7b.chunk.js +1 -0
- package/build/upload-translation-it-json.5ce11e0b.chunk.js +1 -0
- package/build/upload-translation-ja-json.22afae44.chunk.js +1 -0
- package/build/upload-translation-ko-json.9a2c21cb.chunk.js +1 -0
- package/build/upload-translation-ms-json.0605d6da.chunk.js +1 -0
- package/build/upload-translation-pl-json.c1f86b50.chunk.js +1 -0
- package/build/upload-translation-pt-BR-json.95686cfb.chunk.js +1 -0
- package/build/upload-translation-ru-json.37bd1546.chunk.js +1 -0
- package/build/upload-translation-sk-json.b03d4904.chunk.js +1 -0
- package/build/upload-translation-th-json.64dd70ce.chunk.js +1 -0
- package/build/upload-translation-uk-json.1328cb3e.chunk.js +1 -0
- package/build/{upload-translation-zh-Hans-json.c9622577.chunk.js → upload-translation-zh-Hans-json.6832ff81.chunk.js} +1 -1
- package/build/upload-translation-zh-json.ee8fba96.chunk.js +1 -0
- package/build/upload.1346f4b1.chunk.js +7 -0
- package/build/{users-advanced-settings-page.747b2ec1.chunk.js → users-advanced-settings-page.f38654fc.chunk.js} +1 -1
- package/build/users-email-settings-page.824a3cdb.chunk.js +101 -0
- package/build/users-permissions-translation-en-json.765abf48.chunk.js +1 -0
- package/build/users-permissions-translation-pl-json.1dbdd4a1.chunk.js +1 -0
- package/build/users-providers-settings-page.82a4ba58.chunk.js +101 -0
- package/build/{users-roles-settings-page.1bf4ffc5.chunk.js → users-roles-settings-page.1206751f.chunk.js} +3 -3
- package/build/{webhook-edit-page.142b23ac.chunk.js → webhook-edit-page.5c9bada0.chunk.js} +2 -2
- package/build/{webhook-list-page.671582a0.chunk.js → webhook-list-page.822927af.chunk.js} +1 -1
- package/build/zh-Hans-json.cbc69f3d.chunk.js +1 -0
- package/index.js +47 -239
- package/package.json +31 -24
- package/scripts/build.js +19 -3
- package/server/controllers/admin.js +23 -0
- package/server/policies/index.js +1 -0
- package/server/policies/isTelemetryEnabled.js +16 -0
- package/server/routes/admin.js +8 -0
- package/server/routes/serve-admin-panel.js +1 -1
- package/utils/create-cache-dir.js +131 -0
- package/utils/get-custom-app-config-file.js +28 -0
- package/utils/get-custom-webpack-config.js +38 -0
- package/utils/get-plugins-path.js +26 -0
- package/utils/index.js +13 -0
- package/utils/should-build-admin.js +52 -0
- package/utils/watch-admin-files.js +59 -0
- package/webpack.config.js +34 -6
- package/admin/src/content-manager/components/SelectWrapper/ClearIndicator.js +0 -18
- package/admin/src/content-manager/components/SelectWrapper/DropdownIndicator.js +0 -24
- package/admin/src/content-manager/components/SelectWrapper/IconBox.js +0 -20
- package/admin/src/content-manager/components/SelectWrapper/IndicatorSeparator.js +0 -3
- package/admin/src/content-manager/components/SelectWrapper/utils/getSelectStyles.js +0 -92
- package/admin/src/pages/MarketplacePage/utils/api.js +0 -9
- package/build/2758.9475712b.chunk.js +0 -162
- package/build/2912.dd031292.chunk.js +0 -253
- package/build/4982.c57c5675.chunk.js +0 -308
- package/build/6925.fafef528.chunk.js +0 -761
- package/build/7197.47565569.chunk.js +0 -113
- package/build/7589.77ef4fbf.chunk.js +0 -194
- package/build/7841.9e9cf739.chunk.js +0 -253
- package/build/8681.aec05472.chunk.js +0 -163
- package/build/9298.cb3b6bc1.chunk.js +0 -334
- package/build/948.d64fb515.chunk.js +0 -2
- package/build/Admin-authenticatedApp.63a5061a.chunk.js +0 -80
- package/build/Admin_homePage.447df176.chunk.js +0 -71
- package/build/Admin_marketplace.8a503eec.chunk.js +0 -11
- package/build/Admin_pluginsPage.91a96fa5.chunk.js +0 -1
- package/build/Admin_settingsPage.0d138832.chunk.js +0 -180
- package/build/admin-edit-roles-page.7c2c9752.chunk.js +0 -1
- package/build/admin-edit-users.b835bc48.chunk.js +0 -11
- package/build/admin-users.19900b75.chunk.js +0 -12
- package/build/api-tokens-create-page.8d299dde.chunk.js +0 -1
- package/build/codemirror-theme.b3c64617.chunk.js +0 -34
- package/build/content-manager.002bfd99.chunk.js +0 -1204
- package/build/content-type-builder-translation-pl-json.a866acda.chunk.js +0 -1
- package/build/content-type-builder.a0450dfe.chunk.js +0 -141
- package/build/email-translation-pl-json.6da50d0f.chunk.js +0 -1
- package/build/highlight.js.9d8ef460.chunk.js +0 -86
- package/build/i18n-settings-page.06e88cf2.chunk.js +0 -101
- package/build/main.e3a13431.js +0 -8404
- package/build/pl-json.f65302c2.chunk.js +0 -1
- package/build/runtime~main.dacf1aff.js +0 -2
- package/build/sso-settings-page.a7c2e854.chunk.js +0 -1
- package/build/upload-translation-de-json.b642da08.chunk.js +0 -1
- package/build/upload-translation-dk-json.fc61df13.chunk.js +0 -1
- package/build/upload-translation-en-json.59269508.chunk.js +0 -1
- package/build/upload-translation-es-json.8ec935ef.chunk.js +0 -1
- package/build/upload-translation-fr-json.eb9b4f84.chunk.js +0 -1
- package/build/upload-translation-he-json.c226f2dc.chunk.js +0 -1
- package/build/upload-translation-it-json.8e58456e.chunk.js +0 -1
- package/build/upload-translation-ja-json.1378a2e7.chunk.js +0 -1
- package/build/upload-translation-ko-json.5e06e112.chunk.js +0 -1
- package/build/upload-translation-ms-json.dc3bf0d7.chunk.js +0 -1
- package/build/upload-translation-pl-json.6071e38c.chunk.js +0 -1
- package/build/upload-translation-pt-BR-json.7e8d9550.chunk.js +0 -1
- package/build/upload-translation-ru-json.da2529f3.chunk.js +0 -1
- package/build/upload-translation-sk-json.bfdf4f09.chunk.js +0 -1
- package/build/upload-translation-th-json.6a48b826.chunk.js +0 -1
- package/build/upload-translation-uk-json.6fb09148.chunk.js +0 -1
- package/build/upload-translation-zh-json.711f804b.chunk.js +0 -1
- package/build/upload.0d4153e8.chunk.js +0 -105
- package/build/users-email-settings-page.8b9a266d.chunk.js +0 -1
- package/build/users-permissions-translation-en-json.3fe86528.chunk.js +0 -1
- package/build/users-permissions-translation-pl-json.3c4fe81c.chunk.js +0 -1
- package/build/users-providers-settings-page.fc9d8f9d.chunk.js +0 -1
- package/build/zh-Hans-json.c84ce330.chunk.js +0 -1
|
@@ -0,0 +1,1182 @@
|
|
|
1
|
+
(self.webpackChunk_strapi_admin=self.webpackChunk_strapi_admin||[]).push([[994],{37475:(fc,st)=>{var p=function(){var r={trace:function(){},yy:{},symbols_:{error:2,JSONString:3,STRING:4,JSONNumber:5,NUMBER:6,JSONNullLiteral:7,NULL:8,JSONBooleanLiteral:9,TRUE:10,FALSE:11,JSONText:12,JSONValue:13,EOF:14,JSONObject:15,JSONArray:16,"{":17,"}":18,JSONMemberList:19,JSONMember:20,":":21,",":22,"[":23,"]":24,JSONElementList:25,$accept:0,$end:1},terminals_:{2:"error",4:"STRING",6:"NUMBER",8:"NULL",10:"TRUE",11:"FALSE",14:"EOF",17:"{",18:"}",21:":",22:",",23:"[",24:"]"},productions_:[0,[3,1],[5,1],[7,1],[9,1],[9,1],[12,2],[13,1],[13,1],[13,1],[13,1],[13,1],[13,1],[15,2],[15,3],[20,3],[19,1],[19,3],[16,2],[16,3],[25,1],[25,3]],performAction:function(g,X,oe,A,Ee,ae,De){var pe=ae.length-1;switch(Ee){case 1:this.$=g.replace(/\\(\\|")/g,"$1").replace(/\\n/g,`
|
|
2
|
+
`).replace(/\\r/g,"\r").replace(/\\t/g," ").replace(/\\v/g,"\v").replace(/\\f/g,"\f").replace(/\\b/g,"\b");break;case 2:this.$=Number(g);break;case 3:this.$=null;break;case 4:this.$=!0;break;case 5:this.$=!1;break;case 6:return this.$=ae[pe-1];case 13:this.$={};break;case 14:this.$=ae[pe-1];break;case 15:this.$=[ae[pe-2],ae[pe]];break;case 16:this.$={},this.$[ae[pe][0]]=ae[pe][1];break;case 17:this.$=ae[pe-2],ae[pe-2][ae[pe][0]]=ae[pe][1];break;case 18:this.$=[];break;case 19:this.$=ae[pe-1];break;case 20:this.$=[ae[pe]];break;case 21:this.$=ae[pe-2],ae[pe-2].push(ae[pe]);break}},table:[{3:5,4:[1,12],5:6,6:[1,13],7:3,8:[1,9],9:4,10:[1,10],11:[1,11],12:1,13:2,15:7,16:8,17:[1,14],23:[1,15]},{1:[3]},{14:[1,16]},{14:[2,7],18:[2,7],22:[2,7],24:[2,7]},{14:[2,8],18:[2,8],22:[2,8],24:[2,8]},{14:[2,9],18:[2,9],22:[2,9],24:[2,9]},{14:[2,10],18:[2,10],22:[2,10],24:[2,10]},{14:[2,11],18:[2,11],22:[2,11],24:[2,11]},{14:[2,12],18:[2,12],22:[2,12],24:[2,12]},{14:[2,3],18:[2,3],22:[2,3],24:[2,3]},{14:[2,4],18:[2,4],22:[2,4],24:[2,4]},{14:[2,5],18:[2,5],22:[2,5],24:[2,5]},{14:[2,1],18:[2,1],21:[2,1],22:[2,1],24:[2,1]},{14:[2,2],18:[2,2],22:[2,2],24:[2,2]},{3:20,4:[1,12],18:[1,17],19:18,20:19},{3:5,4:[1,12],5:6,6:[1,13],7:3,8:[1,9],9:4,10:[1,10],11:[1,11],13:23,15:7,16:8,17:[1,14],23:[1,15],24:[1,21],25:22},{1:[2,6]},{14:[2,13],18:[2,13],22:[2,13],24:[2,13]},{18:[1,24],22:[1,25]},{18:[2,16],22:[2,16]},{21:[1,26]},{14:[2,18],18:[2,18],22:[2,18],24:[2,18]},{22:[1,28],24:[1,27]},{22:[2,20],24:[2,20]},{14:[2,14],18:[2,14],22:[2,14],24:[2,14]},{3:20,4:[1,12],20:29},{3:5,4:[1,12],5:6,6:[1,13],7:3,8:[1,9],9:4,10:[1,10],11:[1,11],13:30,15:7,16:8,17:[1,14],23:[1,15]},{14:[2,19],18:[2,19],22:[2,19],24:[2,19]},{3:5,4:[1,12],5:6,6:[1,13],7:3,8:[1,9],9:4,10:[1,10],11:[1,11],13:31,15:7,16:8,17:[1,14],23:[1,15]},{18:[2,17],22:[2,17]},{18:[2,15],22:[2,15]},{22:[2,21],24:[2,21]}],defaultActions:{16:[2,6]},parseError:function(g,X){throw new Error(g)},parse:function(g){var X=this,oe=[0],A=[null],Ee=[],ae=this.table,De="",pe=0,v=0,Te=0,xe=2,o=1;this.lexer.setInput(g),this.lexer.yy=this.yy,this.yy.lexer=this.lexer,typeof this.lexer.yylloc=="undefined"&&(this.lexer.yylloc={});var bt=this.lexer.yylloc;Ee.push(bt),typeof this.yy.parseError=="function"&&(this.parseError=this.yy.parseError);function At(L){oe.length=oe.length-2*L,A.length=A.length-L,Ee.length=Ee.length-L}function jt(){var L;return L=X.lexer.lex()||1,typeof L!="number"&&(L=X.symbols_[L]||L),L}for(var Oe,Je,we,Ie,no,Et,Ve={},Xe,Pe,k,D;;){we=oe[oe.length-1],this.defaultActions[we]?Ie=this.defaultActions[we]:(Oe==null&&(Oe=jt()),Ie=ae[we]&&ae[we][Oe]);e:if(typeof Ie=="undefined"||!Ie.length||!Ie[0]){if(!Te){D=[];for(Xe in ae[we])this.terminals_[Xe]&&Xe>2&&D.push("'"+this.terminals_[Xe]+"'");var j="";this.lexer.showPosition?j="Parse error on line "+(pe+1)+`:
|
|
3
|
+
`+this.lexer.showPosition()+`
|
|
4
|
+
Expecting `+D.join(", ")+", got '"+this.terminals_[Oe]+"'":j="Parse error on line "+(pe+1)+": Unexpected "+(Oe==1?"end of input":"'"+(this.terminals_[Oe]||Oe)+"'"),this.parseError(j,{text:this.lexer.match,token:this.terminals_[Oe]||Oe,line:this.lexer.yylineno,loc:bt,expected:D})}if(Te==3){if(Oe==o)throw new Error(j||"Parsing halted.");v=this.lexer.yyleng,De=this.lexer.yytext,pe=this.lexer.yylineno,bt=this.lexer.yylloc,Oe=jt()}for(;!(xe.toString()in ae[we]);){if(we==0)throw new Error(j||"Parsing halted.");At(1),we=oe[oe.length-1]}Je=Oe,Oe=xe,we=oe[oe.length-1],Ie=ae[we]&&ae[we][xe],Te=3}if(Ie[0]instanceof Array&&Ie.length>1)throw new Error("Parse Error: multiple actions possible at state: "+we+", token: "+Oe);switch(Ie[0]){case 1:oe.push(Oe),A.push(this.lexer.yytext),Ee.push(this.lexer.yylloc),oe.push(Ie[1]),Oe=null,Je?(Oe=Je,Je=null):(v=this.lexer.yyleng,De=this.lexer.yytext,pe=this.lexer.yylineno,bt=this.lexer.yylloc,Te>0&&Te--);break;case 2:if(Pe=this.productions_[Ie[1]][1],Ve.$=A[A.length-Pe],Ve._$={first_line:Ee[Ee.length-(Pe||1)].first_line,last_line:Ee[Ee.length-1].last_line,first_column:Ee[Ee.length-(Pe||1)].first_column,last_column:Ee[Ee.length-1].last_column},Et=this.performAction.call(Ve,De,v,pe,this.yy,Ie[1],A,Ee),typeof Et!="undefined")return Et;Pe&&(oe=oe.slice(0,-1*Pe*2),A=A.slice(0,-1*Pe),Ee=Ee.slice(0,-1*Pe)),oe.push(this.productions_[Ie[1]][0]),A.push(Ve.$),Ee.push(Ve._$),k=ae[oe[oe.length-2]][oe[oe.length-1]],oe.push(k);break;case 3:return!0}}return!0}},at=function(){var ee={EOF:1,parseError:function(X,oe){if(this.yy.parseError)this.yy.parseError(X,oe);else throw new Error(X)},setInput:function(g){return this._input=g,this._more=this._less=this.done=!1,this.yylineno=this.yyleng=0,this.yytext=this.matched=this.match="",this.conditionStack=["INITIAL"],this.yylloc={first_line:1,first_column:0,last_line:1,last_column:0},this},input:function(){var g=this._input[0];this.yytext+=g,this.yyleng++,this.match+=g,this.matched+=g;var X=g.match(/\n/);return X&&this.yylineno++,this._input=this._input.slice(1),g},unput:function(g){return this._input=g+this._input,this},more:function(){return this._more=!0,this},less:function(g){this._input=this.match.slice(g)+this._input},pastInput:function(){var g=this.matched.substr(0,this.matched.length-this.match.length);return(g.length>20?"...":"")+g.substr(-20).replace(/\n/g,"")},upcomingInput:function(){var g=this.match;return g.length<20&&(g+=this._input.substr(0,20-g.length)),(g.substr(0,20)+(g.length>20?"...":"")).replace(/\n/g,"")},showPosition:function(){var g=this.pastInput(),X=new Array(g.length+1).join("-");return g+this.upcomingInput()+`
|
|
5
|
+
`+X+"^"},next:function(){if(this.done)return this.EOF;this._input||(this.done=!0);var g,X,oe,A,Ee,ae;this._more||(this.yytext="",this.match="");for(var De=this._currentRules(),pe=0;pe<De.length&&(oe=this._input.match(this.rules[De[pe]]),!(oe&&(!X||oe[0].length>X[0].length)&&(X=oe,A=pe,!this.options.flex)));pe++);if(X)return ae=X[0].match(/\n.*/g),ae&&(this.yylineno+=ae.length),this.yylloc={first_line:this.yylloc.last_line,last_line:this.yylineno+1,first_column:this.yylloc.last_column,last_column:ae?ae[ae.length-1].length-1:this.yylloc.last_column+X[0].length},this.yytext+=X[0],this.match+=X[0],this.yyleng=this.yytext.length,this._more=!1,this._input=this._input.slice(X[0].length),this.matched+=X[0],g=this.performAction.call(this,this.yy,this,De[A],this.conditionStack[this.conditionStack.length-1]),this.done&&this._input&&(this.done=!1),g||void 0;if(this._input==="")return this.EOF;this.parseError("Lexical error on line "+(this.yylineno+1)+`. Unrecognized text.
|
|
6
|
+
`+this.showPosition(),{text:"",token:null,line:this.yylineno})},lex:function(){var X=this.next();return typeof X!="undefined"?X:this.lex()},begin:function(X){this.conditionStack.push(X)},popState:function(){return this.conditionStack.pop()},_currentRules:function(){return this.conditions[this.conditionStack[this.conditionStack.length-1]].rules},topState:function(){return this.conditionStack[this.conditionStack.length-2]},pushState:function(X){this.begin(X)}};return ee.options={},ee.performAction=function(X,oe,A,Ee){var ae=Ee;switch(A){case 0:break;case 1:return 6;case 2:return oe.yytext=oe.yytext.substr(1,oe.yyleng-2),4;break;case 3:return 17;case 4:return 18;case 5:return 23;case 6:return 24;case 7:return 22;case 8:return 21;case 9:return 10;case 10:return 11;case 11:return 8;case 12:return 14;case 13:return"INVALID"}},ee.rules=[/^(?:\s+)/,/^(?:(-?([0-9]|[1-9][0-9]+))(\.[0-9]+)?([eE][-+]?[0-9]+)?\b)/,/^(?:"(?:\\[\\"bfnrt/]|\\u[a-fA-F0-9]{4}|[^\\\0-\x09\x0a-\x1f"])*")/,/^(?:\{)/,/^(?:\})/,/^(?:\[)/,/^(?:\])/,/^(?:,)/,/^(?::)/,/^(?:true\b)/,/^(?:false\b)/,/^(?:null\b)/,/^(?:$)/,/^(?:.)/],ee.conditions={INITIAL:{rules:[0,1,2,3,4,5,6,7,8,9,10,11,12,13],inclusive:!0}},ee}();return r.lexer=at,r}();st.parser=p,st.parse=function(){return p.parse.apply(p,arguments)},st.main=function(at){if(!at[1])throw new Error("Usage: "+at[0]+" FILE")}},92494:(fc,st,p)=>{"use strict";p.r(st),p.d(st,{App:()=>pc,default:()=>NC});var r=p(32735),at=p(99357),ee=p(5141),g=p(88425),X=p(11856),oe=p(16540),A=p(5636),Ee=p(98978),ae=p.n(Ee),De=p(72041);const v=e=>`content-manager.${e}`;var Te=p(74506),xe=p(60216),o=p.n(xe);const At=(0,r.createContext)();var jt=Object.defineProperty,Oe=Object.getOwnPropertySymbols,Je=Object.prototype.hasOwnProperty,we=Object.prototype.propertyIsEnumerable,Ie=(e,t,n)=>t in e?jt(e,t,{enumerable:!0,configurable:!0,writable:!0,value:n}):e[t]=n,no=(e,t)=>{for(var n in t||(t={}))Je.call(t,n)&&Ie(e,n,t[n]);if(Oe)for(var n of Oe(t))we.call(t,n)&&Ie(e,n,t[n]);return e},Et=(e,t)=>{var n={};for(var s in e)Je.call(e,s)&&t.indexOf(s)<0&&(n[s]=e[s]);if(e!=null&&Oe)for(var s of Oe(e))t.indexOf(s)<0&&we.call(e,s)&&(n[s]=e[s]);return n};function Ve(e){var t=e,{attributes:n,buttonData:s,children:a,goTo:l,layout:i,metadatas:u,moveItem:c,moveRow:d,onAddData:m,relationsLayout:f,removeField:y,selectedItemName:h,setEditFieldToSelect:b}=t,E=Et(t,["attributes","buttonData","children","goTo","layout","metadatas","moveItem","moveRow","onAddData","relationsLayout","removeField","selectedItemName","setEditFieldToSelect"]);return r.createElement(At.Provider,{value:no({attributes:n,buttonData:s,goTo:l,layout:i,metadatas:u,moveItem:c,moveRow:d,onAddData:m,relationsLayout:f,removeField:y,selectedItemName:h,setEditFieldToSelect:b},E)},a)}Ve.defaultProps={attributes:{},buttonData:[],goTo:()=>{},layout:[],metadatas:{},moveItem:()=>{},moveRow:()=>{},onAddData:()=>{},relationsLayout:[],removeField:()=>{},selectedItemName:null,setEditFieldToSelect:()=>{}},Ve.propTypes={attributes:o().object,buttonData:o().array,children:o().node.isRequired,goTo:o().func,layout:o().array,metadatas:o().object,moveItem:o().func,moveRow:o().func,onAddData:o().func,relationsLayout:o().array,removeField:o().func,selectedItemName:o().string,setEditFieldToSelect:o().func};const Xe=Ve,Pe={COMPONENT:"component",EDIT_FIELD:"editField",EDIT_RELATION:"editRelation",FIELD:"field",RELATION:"relation"};var k=p(19615),D=p(9808),j=p(19192),L=p(95602),Me=p(20763),gc=p(76470),Be=p.n(gc),yc=p(64198),et=p.n(yc),hc=p(60672),ro=p.n(hc);const bc=(0,k.default)(D.Box)`
|
|
7
|
+
border: 1px solid ${({theme:e})=>e.colors.neutral200};
|
|
8
|
+
`,Ec=(0,k.default)(D.Box)`
|
|
9
|
+
height: ${32/16}rem;
|
|
10
|
+
width: ${32/16}rem;
|
|
11
|
+
border-radius: 50%;
|
|
12
|
+
display: flex;
|
|
13
|
+
align-items: center;
|
|
14
|
+
justify-content: center;
|
|
15
|
+
|
|
16
|
+
svg {
|
|
17
|
+
height: ${6/16}rem;
|
|
18
|
+
width: ${11/16}rem;
|
|
19
|
+
> path {
|
|
20
|
+
fill: ${({theme:e})=>e.colors.neutral600};
|
|
21
|
+
}
|
|
22
|
+
}
|
|
23
|
+
`,vc=k.default.button`
|
|
24
|
+
border: none;
|
|
25
|
+
background: transparent;
|
|
26
|
+
display: block;
|
|
27
|
+
width: 100%;
|
|
28
|
+
text-align: unset;
|
|
29
|
+
padding: 0;
|
|
30
|
+
`,oo=({displayedValue:e})=>r.createElement(bc,{paddingLeft:3,paddingRight:3,paddingTop:3,paddingBottom:3,hasRadius:!0,background:"neutral0",width:(0,g.pxToRem)(300)},r.createElement(j.Flex,{justifyContent:"space-between"},r.createElement(vc,{type:"button"},r.createElement(j.Flex,null,r.createElement(Ec,{background:"neutral200"},r.createElement(ro(),null)),r.createElement(D.Box,{paddingLeft:6,maxWidth:(0,g.pxToRem)(150)},r.createElement(L.Typography,{textColor:"neutral700",ellipsis:!0},e)))),r.createElement(D.Box,{paddingLeft:3},r.createElement(j.Flex,null,r.createElement(Me.IconButton,{icon:r.createElement(Be(),null)}),r.createElement(D.Box,{paddingLeft:2},r.createElement(Me.IconButton,{icon:r.createElement(et(),null)}))))));oo.propTypes={displayedValue:o().string.isRequired};const Cc=oo;var se=p(90662),Oc=p(95717),it=p.n(Oc),Pc=p(94009),so=p.n(Pc);const ao=e=>e.length>20?`${e.substring(0,20)}...`:e,yn=(0,k.default)(j.Flex)`
|
|
31
|
+
height: ${({theme:e})=>e.spaces[7]};
|
|
32
|
+
|
|
33
|
+
&:last-child {
|
|
34
|
+
padding: 0 ${({theme:e})=>e.spaces[3]};
|
|
35
|
+
}
|
|
36
|
+
`,io=(0,k.default)(yn)`
|
|
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
|
+
`,Rc=(0,k.default)(j.Flex)`
|
|
46
|
+
display: inline-flex;
|
|
47
|
+
max-height: ${32/16}rem;
|
|
48
|
+
opacity: ${({transparent:e})=>e?0:1};
|
|
49
|
+
background-color: ${({theme:e,isSibling:t})=>t?e.colors.neutral100:e.colors.primary100};
|
|
50
|
+
border: 1px solid
|
|
51
|
+
${({theme:e,isSibling:t})=>t?e.colors.neutral150:e.colors.primary200};
|
|
52
|
+
|
|
53
|
+
svg {
|
|
54
|
+
width: ${10/16}rem;
|
|
55
|
+
height: ${10/16}rem;
|
|
56
|
+
|
|
57
|
+
path {
|
|
58
|
+
fill: ${({theme:e,isSibling:t})=>t?void 0:e.colors.primary600};
|
|
59
|
+
}
|
|
60
|
+
}
|
|
61
|
+
|
|
62
|
+
${L.Typography} {
|
|
63
|
+
color: ${({theme:e,isSibling:t})=>t?void 0:e.colors.primary600};
|
|
64
|
+
}
|
|
65
|
+
|
|
66
|
+
${io} {
|
|
67
|
+
border-right: 1px solid
|
|
68
|
+
${({theme:e,isSibling:t})=>t?e.colors.neutral150:e.colors.primary200};
|
|
69
|
+
}
|
|
70
|
+
`,hn=({labelField:e,transparent:t,isSibling:n})=>{const s=ao(e);return r.createElement(Rc,{hasRadius:!0,justifyContent:"space-between",transparent:t,isSibling:n},r.createElement(se.Stack,{horizontal:!0,spacing:3},r.createElement(io,{alignItems:"center"},r.createElement(et(),null)),r.createElement(L.Typography,{fontWeight:"bold"},s)),r.createElement(j.Flex,{paddingLeft:3},r.createElement(yn,{alignItems:"center"},r.createElement(it(),null)),r.createElement(yn,{alignItems:"center"},r.createElement(so(),null))))};hn.defaultProps={isSibling:!1,transparent:!1},hn.propTypes={isSibling:o().bool,labelField:o().string.isRequired,transparent:o().bool};const bn=hn,Mc={position:"fixed",pointerEvents:"none",zIndex:100,left:0,top:0,width:"100%",height:"100%"};function Tc(e,t,n){if(!e||!t)return{display:"none"};const{x:s,y:a}=n,l=`translate(${s}px, ${a}px)`;return{transform:l,WebkitTransform:l}}const wc=()=>{const{itemType:e,isDragging:t,item:n,initialOffset:s,currentOffset:a,mouseOffset:l}=(0,Te.useDragLayer)(i=>({item:i.getItem(),itemType:i.getItemType(),initialOffset:i.getInitialSourceClientOffset(),currentOffset:i.getSourceClientOffset(),isDragging:i.isDragging(),mouseOffset:i.getClientOffset()}));return t?r.createElement(Xe,null,r.createElement("div",{style:Mc},r.createElement("div",{style:Tc(s,a,l),className:"col-md-2"},[Pe.EDIT_RELATION,Pe.EDIT_FIELD,Pe.FIELD].includes(e)&&r.createElement(bn,{labelField:n.labelField}),e===Pe.COMPONENT&&r.createElement(Cc,{displayedValue:n.displayedValue})))):null},lo=(0,r.createContext)();var Ic=p(18522),B=p(92891);const co=(0,r.createContext)(),UC=(0,r.createContext)(),HC=null;var fe=p(4409);const uo=e=>e["content-manager_editViewLayoutManager"].currentLayout;var Dc=Object.defineProperty,xc=Object.defineProperties,Sc=Object.getOwnPropertyDescriptors,po=Object.getOwnPropertySymbols,Lc=Object.prototype.hasOwnProperty,Fc=Object.prototype.propertyIsEnumerable,mo=(e,t,n)=>t in e?Dc(e,t,{enumerable:!0,configurable:!0,writable:!0,value:n}):e[t]=n,kc=(e,t)=>{for(var n in t||(t={}))Lc.call(t,n)&&mo(e,n,t[n]);if(po)for(var n of po(t))Fc.call(t,n)&&mo(e,n,t[n]);return e},Ac=(e,t)=>xc(e,Sc(t));const lt=()=>{const e=(0,fe.useSelector)(uo),t=(0,r.useCallback)(n=>(0,B.get)(e,["components",n],{}),[e]);return Ac(kc({},e),{getComponentLayout:t})};var jc=p(2739),Se=p.n(jc),ge=p(17247),$c=p(99381),qe=p.n($c);const vt=(e,t,n)=>{if(Array.isArray(e)&&t>=0&&n>=0&&t<=e.length-1&&n<=e.length-1){const s=qe()(e),a=s.splice(t,1);return s.splice(n,0,a[0]),s}return e},fo=e=>{const t=e.type;return t==="relation"?!(0,B.toLower)(e.relationType).includes("morph"):!["json","dynamiczone","richtext","password"].includes(t)&&!!t},go=(e,t)=>Object.keys(e).reduce((n,s)=>{const a=(0,B.get)(e,[s],{}),{default:l,component:i,type:u,required:c,min:d,repeatable:m}=a;if(u==="json"&&(n[s]=null),u==="json"&&c===!0&&(n[s]={}),l!==void 0&&(n[s]=l),u==="component"){const f=(0,B.get)(t,[i,"attributes"],{}),y=go(f,t);if(c===!0&&(n[s]=m===!0?[]:y),d&&m===!0&&c){n[s]=[];for(let h=0;h<d;h+=1)n[s].push(y)}}return u==="dynamiczone"&&c===!0&&(n[s]=[]),n},{}),$t=go;var Bc=Object.defineProperty,Nc=Object.defineProperties,Vc=Object.getOwnPropertyDescriptors,Bt=Object.getOwnPropertySymbols,yo=Object.prototype.hasOwnProperty,ho=Object.prototype.propertyIsEnumerable,bo=(e,t,n)=>t in e?Bc(e,t,{enumerable:!0,configurable:!0,writable:!0,value:n}):e[t]=n,En=(e,t)=>{for(var n in t||(t={}))yo.call(t,n)&&bo(e,n,t[n]);if(Bt)for(var n of Bt(t))ho.call(t,n)&&bo(e,n,t[n]);return e},vn=(e,t)=>Nc(e,Vc(t)),qc=(e,t)=>{var n={};for(var s in e)yo.call(e,s)&&t.indexOf(s)<0&&(n[s]=e[s]);if(e!=null&&Bt)for(var s of Bt(e))t.indexOf(s)<0&&ho.call(e,s)&&(n[s]=e[s]);return n};const Nt=e=>{var t=e,{layouts:n,metadatas:s}=t,a=qc(t,["layouts","metadatas"]);const l=n.list.map(d=>d.name?d.name:d),i=n.editRelations.map(({name:d})=>d),u=Object.keys(s).reduce((d,m)=>{const f=(0,B.get)(s,[m],{});let y=f.edit;return y.mainField&&(y=vn(En({},y),{mainField:f.edit.mainField.name})),vn(En({},d),{[m]:{edit:y,list:(0,B.omit)(f.list,["mainField"])}})},{}),c=n.edit.map(d=>d.map(({name:m,size:f})=>({name:m,size:f})));return vn(En({},a),{layouts:{edit:c,editRelations:i,list:l},metadatas:u})};var Wc=Object.defineProperty,zc=Object.defineProperties,Uc=Object.getOwnPropertyDescriptors,Eo=Object.getOwnPropertySymbols,Hc=Object.prototype.hasOwnProperty,Gc=Object.prototype.propertyIsEnumerable,vo=(e,t,n)=>t in e?Wc(e,t,{enumerable:!0,configurable:!0,writable:!0,value:n}):e[t]=n,Zc=(e,t)=>{for(var n in t||(t={}))Hc.call(t,n)&&vo(e,n,t[n]);if(Eo)for(var n of Eo(t))Gc.call(t,n)&&vo(e,n,t[n]);return e},_c=(e,t)=>zc(e,Uc(t));const Qc=(e,t)=>e.map(n=>_c(Zc({},n),{subject:t})),Co=e=>{const t={create:[{action:"plugin::content-manager.explorer.create",subject:null}],delete:[{action:"plugin::content-manager.explorer.delete",subject:null}],publish:[{action:"plugin::content-manager.explorer.publish",subject:null}],read:[{action:"plugin::content-manager.explorer.read",subject:null}],update:[{action:"plugin::content-manager.explorer.update",subject:null}]};return Object.keys(t).reduce((n,s)=>(n[s]=Qc(t[s],e),n),{})},Oo=e=>e.split(".").filter(t=>(0,B.isNaN)(parseInt(t,10))),Po=e=>e.length===0?-1:Math.max.apply(Math,e.map(t=>t.__temp_key__)),ve=e=>`/content-manager/${e}`;var Kc=Object.defineProperty,Ro=Object.getOwnPropertySymbols,Yc=Object.prototype.hasOwnProperty,Jc=Object.prototype.propertyIsEnumerable,Mo=(e,t,n)=>t in e?Kc(e,t,{enumerable:!0,configurable:!0,writable:!0,value:n}):e[t]=n,Vt=(e,t)=>{for(var n in t||(t={}))Yc.call(t,n)&&Mo(e,n,t[n]);if(Ro)for(var n of Ro(t))Jc.call(t,n)&&Mo(e,n,t[n]);return e};const To=(e,t,n)=>{const s=u=>t.find(c=>c.uid===u),a=Object.assign({},e),l=e[n].uid,i=s(l);return(0,B.set)(a,[n],Vt(Vt({},e[n]),i)),Object.keys(e.components).forEach(u=>{const c=s(u);(0,B.set)(a,["components",u],Vt(Vt({},e.components[u]),c))}),a};var Xc=Object.defineProperty,eu=Object.defineProperties,tu=Object.getOwnPropertyDescriptors,wo=Object.getOwnPropertySymbols,nu=Object.prototype.hasOwnProperty,ru=Object.prototype.propertyIsEnumerable,Io=(e,t,n)=>t in e?Xc(e,t,{enumerable:!0,configurable:!0,writable:!0,value:n}):e[t]=n,Cn=(e,t)=>{for(var n in t||(t={}))nu.call(t,n)&&Io(e,n,t[n]);if(wo)for(var n of wo(t))ru.call(t,n)&&Io(e,n,t[n]);return e},On=(e,t)=>eu(e,tu(t));const Ct=(e,t)=>e&&Object.keys(e).reduce((n,s)=>{const a=n[s];return a===null?n:Array.isArray(a)?Array.isArray(n)?(n[s]=Ct(a,t),n):On(Cn({},n),{[s]:a.map(l=>Ct(l,t))}):typeof a=="object"?a._isAMomentObject===!0?On(Cn({},n),{[s]:a}):Array.isArray(n)?(n[s]=Ct(a,t),n):On(Cn({},n),{[s]:Ct(a,t)}):(s===t&&delete n[s],n)},e),ou=Ct,Do=(e,t,n)=>{const s=(a,l)=>Object.keys(a).reduce((i,u)=>{const c=(0,g.getType)(l,u),d=(0,B.get)(a,u),m=(0,g.getOtherInfos)(l,[u,"component"]),f=(0,g.getOtherInfos)(l,[u,"repeatable"]);return c==="dynamiczone"?(i[u]=d.map(y=>s(y,n[y.__component])),i):c==="component"?(f?i[u]=d&&d.map(y=>s(y,n[m])):i[u]=d&&s(d,n[m]),i):(c!=="password"&&(i[u]=d),i)},{});return s(e,t)};var su=Object.defineProperty,au=Object.defineProperties,iu=Object.getOwnPropertyDescriptors,xo=Object.getOwnPropertySymbols,lu=Object.prototype.hasOwnProperty,cu=Object.prototype.propertyIsEnumerable,So=(e,t,n)=>t in e?su(e,t,{enumerable:!0,configurable:!0,writable:!0,value:n}):e[t]=n,Ot=(e,t)=>{for(var n in t||(t={}))lu.call(t,n)&&So(e,n,t[n]);if(xo)for(var n of xo(t))cu.call(t,n)&&So(e,n,t[n]);return e},Pt=(e,t)=>au(e,iu(t));const Pn=(e,t)=>t.find(n=>n.uid===e),uu=(e,t)=>e.layouts.editRelations.reduce((s,a)=>{const l=(0,B.get)(e,["attributes",a],{}),i=(0,B.get)(e,["attributes",a,"targetModel"],null),c=Pn(i,t).pluginOptions||{},d=(0,B.get)(e,["metadatas",a,"edit"],{}),m=6,f=Fo(e,a,t);return s.push({name:a,size:m,fieldSchema:l,metadatas:d,queryInfos:f,targetModelPluginOptions:c}),s},[]),du=(e,t)=>{const n=pu(e,t),s=Lo(n.contentType,null,t),a=n.contentType.uid,l=uu(n.contentType,t),i=mu(n.contentType,n.components);return(0,B.set)(n,["contentType","layouts","edit"],s),(0,B.set)(n,["contentType","layouts","editRelations"],l),(0,B.set)(n,["contentType","layouts","list"],i),Object.keys(n.components).forEach(u=>{const c=Lo(n.components[u],a,t);(0,B.set)(n,["components",u,"layouts","edit"],c)}),n},pu=(e,t)=>{const n=To((0,B.cloneDeep)(e),t,"contentType"),{components:s,contentType:a}=n,l=i=>Object.keys(i.metadatas).reduce((u,c)=>{const d=(0,B.get)(i,["attributes",c],{});let m=i.metadatas[c];if(d.type==="relation"){const f=Pn(d.targetModel,t),y=m.edit.mainField,h={name:y,schema:(0,B.get)(f,["attributes",y])};m={list:Pt(Ot({},m.list),{mainField:h}),edit:Pt(Ot({},m.edit),{mainField:h})}}return u[c]=m,u},{});return(0,B.set)(n,["contentType","metadatas"],l(a)),Object.keys(s).forEach(i=>{const u=s[i],c=l(u);(0,B.set)(n,["components",i,"metadatas"],c)}),n},Lo=(e,t,n)=>e.layouts.edit.reduce((a,l)=>{const i=l.map(u=>{const c=(0,B.get)(e,["attributes",u.name],{}),d=Pt(Ot({},u),{fieldSchema:c,metadatas:(0,B.get)(e,["metadatas",u.name,"edit"],{})});if(c.type==="relation"){const m=c.targetModel,y=Pn(m,n).pluginOptions||{},h=t?fu(e,u.name,t,n):Fo(e,u.name,n);(0,B.set)(d,"targetModelPluginOptions",y),(0,B.set)(d,"queryInfos",h)}return d});return a.push(i),a},[]),mu=(e,t)=>e.layouts.list.reduce((s,a)=>{const l=(0,B.get)(e,["attributes",a],{}),i=(0,B.get)(e,["metadatas",a,"list"],{}),u=l.type;if(u==="relation"){const c={endPoint:`collection-types/${e.uid}`,defaultParams:{}};return s.push({key:`__${a}_key__`,name:a,fieldSchema:l,metadatas:i,queryInfos:c}),s}if(u==="component"){const c=t[l.component],d=c.settings.mainField,m=c.attributes[d];return s.push({key:`__${a}_key__`,name:a,fieldSchema:l,metadatas:Pt(Ot({},i),{mainField:Pt(Ot({},m),{name:d})})}),s}return s.push({key:`__${a}_key__`,name:a,fieldSchema:l,metadatas:i}),s},[]),Fo=(e,t,n)=>{const s=e.uid,a=ve(`relations/${s}/${t}`),l=(0,B.get)(e,["metadatas",t,"edit","mainField","name"],""),i=(0,B.get)(e,["attributes",t,"targetModel"],""),u=ko(n).indexOf(i)!==-1;return{endPoint:a,containsKey:`${l}`,defaultParams:{},shouldDisplayRelationLink:u}},fu=(e,t,n,s)=>{const a=ve(`relations/${n}/${t}`),l=(0,B.get)(e,["metadatas",t,"edit","mainField","name"],""),i=(0,B.get)(e,["attributes",t,"targetModel"],""),u=ko(s).indexOf(i)!==-1;return{endPoint:a,containsKey:`${l}`,defaultParams:{_component:e.uid},shouldDisplayRelationLink:u}},ko=e=>e.filter(t=>t.isDisplayed).map(({uid:t})=>t),Ao=du;var qt=p(49415),gu=Object.defineProperty,yu=Object.defineProperties,hu=Object.getOwnPropertyDescriptors,jo=Object.getOwnPropertySymbols,bu=Object.prototype.hasOwnProperty,Eu=Object.prototype.propertyIsEnumerable,$o=(e,t,n)=>t in e?gu(e,t,{enumerable:!0,configurable:!0,writable:!0,value:n}):e[t]=n,Wt=(e,t)=>{for(var n in t||(t={}))bu.call(t,n)&&$o(e,n,t[n]);if(jo)for(var n of jo(t))Eu.call(t,n)&&$o(e,n,t[n]);return e},Bo=(e,t)=>yu(e,hu(t));const vu={error:null,isLoading:!0,layout:{},layouts:{}},Cu=(e,t)=>(0,qt.default)(e,n=>{switch(t.type){case"GET_DATA":{n.isLoading=!0,n.error=null,n.layout={};break}case"GET_DATA_SUCCEEDED":{const s=t.data.contentType.uid;n.layout=t.data,n.layouts[s]=t.data,n.isLoading=!1;break}case"GET_DATA_ERROR":{n.isLoading=!1,n.error=t.error;break}case"SET_LAYOUT_FROM_STATE":{n.error=null,n.layout=e.layouts[t.uid];break}case"UPDATE_LAYOUT":{const s=e.layout;n.layout=Bo(Wt({},s),{contentType:Wt({uid:s.contentType.uid},t.newLayout.contentType)}),n.layouts[s.contentType.uid]=Bo(Wt({},s),{contentType:Wt({uid:s.contentType.uid},t.newLayout.contentType)});break}default:return n}});var Rn=p(12463),Ou=p(34947);const Rt=()=>e=>e["content-manager_app"]||Ou.E,oO=()=>createSelector(Rt(),e=>e),sO=()=>createSelector(Rt(),e=>e.models),Pu=()=>(0,Rn.P1)(Rt(),e=>({collectionTypeLinks:e.collectionTypeLinks,singleTypeLinks:e.singleTypeLinks})),Mn=()=>(0,Rn.P1)(Rt(),({components:e,models:t})=>({schemas:[...e,...t]})),aO=null;var Ru=p(98399),Mu=(e,t,n)=>new Promise((s,a)=>{var l=c=>{try{u(n.next(c))}catch(d){a(d)}},i=c=>{try{u(n.throw(c))}catch(d){a(d)}},u=c=>c.done?s(c.value):Promise.resolve(c.value).then(l,i);u((n=n.apply(e,t)).next())});const No=e=>{const[{error:t,isLoading:n,layout:s,layouts:a},l]=(0,r.useReducer)(Cu,vu),i=(0,r.useMemo)(Mn,[]),{schemas:u}=(0,fe.useSelector)(f=>i(f),fe.shallowEqual),c=(0,r.useRef)(!0),d=(0,r.useCallback)((f,y)=>Mu(void 0,null,function*(){if(a[f]){l({type:"SET_LAYOUT_FROM_STATE",uid:f});return}l({type:"GET_DATA"});try{const h=ve(`content-types/${f}/configuration`),{data:{data:b}}=yield ge.be.get(h,{cancelToken:y.token});l({type:"GET_DATA_SUCCEEDED",data:Ao(b,u)})}catch(h){if(Se().isCancel(h))return;c.current&&Ru.error(h),c.current&&l({type:"GET_DATA_ERROR",error:h})}}),[a,u]);(0,r.useEffect)(()=>()=>{c.current=!1},[]),(0,r.useEffect)(()=>{const y=Se().CancelToken.source();return d(e,y),()=>{y.cancel("Operation canceled by the user.")}},[e,d]);const m=(0,r.useCallback)(f=>{l({type:"UPDATE_LAYOUT",newLayout:Ao({contentType:f,components:{}},u)})},[u]);return{error:t,isLoading:n,layout:s,updateLayout:m}},Tu=e=>e["content-manager_app"].collectionTypeLinks;var Ne=p(77997),wu=p(33795),R=p.n(wu),Iu=p(85973),Vo=p.n(Iu),Du=Object.defineProperty,xu=Object.defineProperties,Su=Object.getOwnPropertyDescriptors,qo=Object.getOwnPropertySymbols,Lu=Object.prototype.hasOwnProperty,Fu=Object.prototype.propertyIsEnumerable,Wo=(e,t,n)=>t in e?Du(e,t,{enumerable:!0,configurable:!0,writable:!0,value:n}):e[t]=n,ku=(e,t)=>{for(var n in t||(t={}))Lu.call(t,n)&&Wo(e,n,t[n]);if(qo)for(var n of qo(t))Fu.call(t,n)&&Wo(e,n,t[n]);return e},Au=(e,t)=>xu(e,Su(t));const zo=(e,t)=>Object.keys(e).reduce((n,s)=>{const a=e[s],l=R()(t,[s],a);return Vo()(a)?Au(ku({},n),{[s]:zo(a,l)}):(n[s]=l,n)},{}),ju=(e,t,n)=>{const s=e.find(({to:m})=>m.includes(t));if(!s)return"/";const{to:a,search:l}=s,i=(0,Ne.parse)(l),u=(0,Ne.parse)(n.substring(1)),c=zo(i,u);return`${a}?${(0,Ne.stringify)(c,{encode:!1})}`},Uo=e=>{const[{rawQuery:t}]=(0,g.useQueryParams)(),n=(0,fe.useSelector)(Tu);return ju(n,e,t)},Ge=()=>(0,r.useContext)(At),Ho=()=>{const{search:e}=(0,ee.useLocation)(),t=e?(0,Ne.parse)(e.substring(1)):{};return t.plugins?(0,Ne.stringify)({plugins:t.plugins},{encode:!1}):""};var Go=p(89334);const $u=(e,t,n)=>({type:Go.m,permissions:e,__meta__:{plugins:t,containerName:n}}),Bu=()=>({type:Go.Q}),Nu=e=>e["content-manager_rbacManager"].permissions,Vu=e=>e.rbacProvider.collectionTypesRelatedPermissions,Zo=(e,t,n="listView")=>{const s=(0,fe.useSelector)(Vu),a=(0,fe.useSelector)(Nu),l=(0,fe.useDispatch)(),i=s[t];return(0,r.useEffect)(()=>i?(l($u(i,e?e.plugins:null,n)),()=>{l(Bu())}):()=>{},[i,l,e,n]),a},fO=()=>useContext(WysiwygContext),gO=null;var zt=p(70836),_o=p(4460);const qu=()=>({type:_o.c}),Wu=(e,t)=>({type:_o.O,layout:e,query:t});var zu=p(8266),We=p.n(zu),Ut=p(27635),ie=p(78330),Uu=p(70404),Hu=p.n(Uu),Gu=p(66694);const Zu=()=>(0,r.useContext)(Gu.ux),Qo=e=>{const{getAdminInjectedComponents:t}=Zu(),[n,s,a]=e.split(".");return t(n,s,a)};var _u=Object.defineProperty,Ht=Object.getOwnPropertySymbols,Ko=Object.prototype.hasOwnProperty,Yo=Object.prototype.propertyIsEnumerable,Jo=(e,t,n)=>t in e?_u(e,t,{enumerable:!0,configurable:!0,writable:!0,value:n}):e[t]=n,Qu=(e,t)=>{for(var n in t||(t={}))Ko.call(t,n)&&Jo(e,n,t[n]);if(Ht)for(var n of Ht(t))Yo.call(t,n)&&Jo(e,n,t[n]);return e},Ku=(e,t)=>{var n={};for(var s in e)Ko.call(e,s)&&t.indexOf(s)<0&&(n[s]=e[s]);if(e!=null&&Ht)for(var s of Ht(e))t.indexOf(s)<0&&Yo.call(e,s)&&(n[s]=e[s]);return n};const Xo=e=>{var t=e,{area:n}=t,s=Ku(t,["area"]);return Qo(n).map(l=>r.createElement(l.Component,Qu({key:l.name},s)))};Xo.propTypes={area:o().string.isRequired};const Gt=Xo;var Yu=Object.defineProperty,es=Object.getOwnPropertySymbols,Ju=Object.prototype.hasOwnProperty,Xu=Object.prototype.propertyIsEnumerable,ts=(e,t,n)=>t in e?Yu(e,t,{enumerable:!0,configurable:!0,writable:!0,value:n}):e[t]=n,ns=(e,t)=>{for(var n in t||(t={}))Ju.call(t,n)&&ts(e,n,t[n]);if(es)for(var n of es(t))Xu.call(t,n)&&ts(e,n,t[n]);return e};function ed(e,t){return function(n){const s=t(n.name);return r.createElement(e,ns(ns({},n),s))}}const td=ed;function nd(e){const{addComponentToDynamicZone:t,createActionAllowedFields:n,isCreatingEntry:s,formErrors:a,modifiedData:l,moveComponentUp:i,moveComponentDown:u,removeComponentFromDynamicZone:c,readActionAllowedFields:d,updateActionAllowedFields:m}=(0,g.useCMEditViewDataManager)(),f=(0,r.useMemo)(()=>(0,B.get)(l,[e],[]).map(b=>b.__component),[l,e]),y=(0,r.useMemo)(()=>(s?n:m).includes(e),[e,s,n,m]),h=(0,r.useMemo)(()=>(s?[]:d).includes(e),[e,s,d]);return{addComponentToDynamicZone:t,formErrors:a,isCreatingEntry:s,isFieldAllowed:y,isFieldReadable:h,moveComponentUp:i,moveComponentDown:u,removeComponentFromDynamicZone:c,dynamicDisplayedComponents:f}}const rd=nd;var od=p(51542),rs=p.n(od),Tn=p(98195);const wn=(0,k.default)(rs())`
|
|
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
|
+
`,sd=(0,k.default)(Tn.BaseButton)`
|
|
79
|
+
border-radius: 26px;
|
|
80
|
+
border-color: ${({theme:e})=>e.colors.neutral150};
|
|
81
|
+
background: ${({theme:e})=>e.colors.neutral0};
|
|
82
|
+
padding-top: ${({theme:e})=>e.spaces[3]};
|
|
83
|
+
padding-right: ${({theme:e})=>e.spaces[4]};
|
|
84
|
+
padding-bottom: ${({theme:e})=>e.spaces[3]};
|
|
85
|
+
padding-left: ${({theme:e})=>e.spaces[4]};
|
|
86
|
+
|
|
87
|
+
box-shadow: ${({theme:e})=>e.shadows.filterShadow};
|
|
88
|
+
|
|
89
|
+
svg {
|
|
90
|
+
height: ${({theme:e})=>e.spaces[6]};
|
|
91
|
+
width: ${({theme:e})=>e.spaces[6]};
|
|
92
|
+
> path {
|
|
93
|
+
fill: ${({theme:e})=>e.colors.neutral600};
|
|
94
|
+
}
|
|
95
|
+
}
|
|
96
|
+
&:hover {
|
|
97
|
+
color: ${({theme:e})=>e.colors.primary600} !important;
|
|
98
|
+
${L.Typography} {
|
|
99
|
+
color: ${({theme:e})=>e.colors.primary600} !important;
|
|
100
|
+
}
|
|
101
|
+
|
|
102
|
+
${wn} {
|
|
103
|
+
> circle {
|
|
104
|
+
fill: ${({theme:e})=>e.colors.primary600};
|
|
105
|
+
}
|
|
106
|
+
> path {
|
|
107
|
+
fill: ${({theme:e})=>e.colors.neutral100};
|
|
108
|
+
}
|
|
109
|
+
}
|
|
110
|
+
}
|
|
111
|
+
&:active {
|
|
112
|
+
${L.Typography} {
|
|
113
|
+
color: ${({theme:e})=>e.colors.primary600};
|
|
114
|
+
}
|
|
115
|
+
${wn} {
|
|
116
|
+
> circle {
|
|
117
|
+
fill: ${({theme:e})=>e.colors.primary600};
|
|
118
|
+
}
|
|
119
|
+
> path {
|
|
120
|
+
fill: ${({theme:e})=>e.colors.neutral100};
|
|
121
|
+
}
|
|
122
|
+
}
|
|
123
|
+
}
|
|
124
|
+
`,ad=(0,k.default)(D.Box)`
|
|
125
|
+
height: 100%;
|
|
126
|
+
`,In=({hasError:e,hasMaxError:t,hasMinError:n,isDisabled:s,isOpen:a,label:l,missingComponentNumber:i,name:u,onClick:c})=>{const{formatMessage:d}=(0,A.useIntl)(),m=d({id:v("components.DynamicZone.add-component"),defaultMessage:"Add a component to {componentName}"},{componentName:l||u}),f=d({id:"app.utils.close-label",defaultMessage:"Close"});let y=a?f:m;return t&&!a&&(y=d({id:"components.Input.error.validation.max",defaultMessage:"The value is too high."})),n&&!a&&(y=d({id:v("components.DynamicZone.missing-components"),defaultMessage:"There {number, plural, =0 {are # missing components} one {is # missing component} other {are # missing components}}"},{number:i})),r.createElement(r.Fragment,null,r.createElement(j.Flex,{justifyContent:"center"},r.createElement(D.Box,{style:{cursor:s?"not-allowed":"pointer"}},r.createElement(sd,{type:"button",onClick:c,disabled:s,hasError:e},r.createElement(j.Flex,null,r.createElement(ad,{"aria-hidden":!0,paddingRight:2},r.createElement(wn,{$isOpen:a,$hasError:e&&!a})),r.createElement(L.Typography,{variant:"pi",fontWeight:"bold",textColor:e&&!a?"danger600":"neutral500"},y))))))};In.defaultProps={label:"",missingComponentNumber:0},In.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 id=In,ld=(0,k.default)(D.Box)`
|
|
127
|
+
border-radius: ${(0,g.pxToRem)(26)};
|
|
128
|
+
`,Dn=({label:e,labelAction:t,name:n,numberOfComponents:s,required:a,intlDescription:l})=>{const{formatMessage:i}=(0,A.useIntl)(),u=i({id:e||n,defaultMessage:e||n});return r.createElement(j.Flex,{justifyContent:"center"},r.createElement(D.Box,null,r.createElement(ld,{paddingTop:3,paddingBottom:3,paddingRight:4,paddingLeft:4,background:"neutral0",shadow:"filterShadow",color:"neutral500"},r.createElement(j.Flex,{direction:"column",justifyContent:"center"},r.createElement(j.Flex,{maxWidth:(0,g.pxToRem)(356)},r.createElement(L.Typography,{variant:"pi",textColor:"neutral600",fontWeight:"bold",ellipsis:!0},u,"\xA0"),r.createElement(L.Typography,{variant:"pi",textColor:"neutral600",fontWeight:"bold"},"(",s,")"),a&&r.createElement(L.Typography,{textColor:"danger600"},"*"),t&&r.createElement(D.Box,{paddingLeft:1},t)),l&&r.createElement(D.Box,{paddingTop:1,maxWidth:(0,g.pxToRem)(356)},r.createElement(L.Typography,{variant:"pi",textColor:"neutral600",ellipsis:!0},i(l)))))))};Dn.defaultProps={intlDescription:void 0,label:"",labelAction:void 0,required:!1},Dn.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 cd=Dn;var xn=p(16925),ze=p(12001),Sn=p(54742),ud=p(78325),dd=p.n(ud),pd=p(30857),md=p.n(pd),fd=p(61868),gd=p.n(fd),yd=Object.defineProperty,os=Object.getOwnPropertySymbols,hd=Object.prototype.hasOwnProperty,bd=Object.prototype.propertyIsEnumerable,ss=(e,t,n)=>t in e?yd(e,t,{enumerable:!0,configurable:!0,writable:!0,value:n}):e[t]=n,Ed=(e,t)=>{for(var n in t||(t={}))hd.call(t,n)&&ss(e,n,t[n]);if(os)for(var n of os(t))bd.call(t,n)&&ss(e,n,t[n]);return e};const vd=k.default.span`
|
|
129
|
+
> svg {
|
|
130
|
+
width: ${(0,g.pxToRem)(24)};
|
|
131
|
+
height: ${(0,g.pxToRem)(24)};
|
|
132
|
+
> circle {
|
|
133
|
+
fill: ${({theme:e})=>e.colors.primary200};
|
|
134
|
+
}
|
|
135
|
+
> path {
|
|
136
|
+
fill: ${({theme:e})=>e.colors.primary600};
|
|
137
|
+
}
|
|
138
|
+
}
|
|
139
|
+
`,Ln=({error:e,isReadOnly:t,onClick:n})=>{const{formatMessage:s}=(0,A.useIntl)();return r.createElement(r.Fragment,null,r.createElement(D.Box,{as:"button",background:"neutral100",borderColor:e?"danger600":"neutral200",disabled:t,hasRadius:!0,onClick:n,paddingTop:9,paddingBottom:9,type:"button"},r.createElement(se.Stack,{spacing:2},r.createElement(j.Flex,{justifyContent:"center",style:{cursor:t?"not-allowed":"inherit"}},r.createElement(vd,null,r.createElement(rs(),null))),r.createElement(j.Flex,{justifyContent:"center"},r.createElement(L.Typography,{textColor:"primary600",variant:"pi",fontWeight:"bold"},s({id:v("components.empty-repeatable"),defaultMessage:"No entry yet. Click on the button below to add one."}))))),(e==null?void 0:e.id)&&r.createElement(L.Typography,{textColor:"danger600",variant:"pi"},s({id:e.id,defaultMessage:e.id},Ed({},e.values))))};Ln.defaultProps={error:void 0,isReadOnly:!1},Ln.propTypes={error:o().shape({id:o().string.isRequired,defaultMessage:o().string.isRequired,values:o().object}),isReadOnly:o().bool,onClick:o().func.isRequired};const as=Ln;var Cd=p(9086),Od=p.n(Cd),Pd=p(88708),Zt=p.n(Pd),Rd=p(27509),_t=p.n(Rd),bO=p(40795),Md=p(88591),Td=p.n(Md),Fn=p(59845),wd=p(20871),Id=p.n(wd),Dd=p(48375),is=p.n(Dd),xd=p(31089),Sd=p.n(xd),Ld=p(16043),Fd=p.n(Ld),kd=p(5109),Ad=p.n(kd),jd=p(47955),$d=p.n(jd),Bd=p(95706),Nd=p.n(Bd),Vd=p(6658),qd=p.n(Vd),Wd=p(36407),zd=p.n(Wd),Ud=(e,t,n)=>new Promise((s,a)=>{var l=c=>{try{u(n.next(c))}catch(d){a(d)}},i=c=>{try{u(n.throw(c))}catch(d){a(d)}},u=c=>c.done?s(c.value):Promise.resolve(c.value).then(l,i);u((n=n.apply(e,t)).next())});(()=>Ud(void 0,null,function*(){yield p.e(7347).then(p.bind(p,98362))}))();const ct=new(Td())({html:!0,xhtmlOut:!1,breaks:!0,langPrefix:"language-",linkify:!0,typographer:!0,highlight:(e,t)=>{if(t&&t!=="auto"&&(0,Fn.getLanguage)(t))return'<pre class="hljs language-'+ct.utils.escapeHtml(t.toLowerCase())+'"><code>'+(0,Fn.highlight)(t,e,!0).value+"</code></pre>";if(t==="auto"){const n=(0,Fn.highlightAuto)(e);return'<pre class="hljs language-'+ct.utils.escapeHtml(n.language)+'"><code>'+n.value+"</code></pre>"}return'<pre class="hljs"><code>'+ct.utils.escapeHtml(e)+"</code></pre>"}}).use(Id()).use(is(),"warning").use(is(),"tip").use(Sd()).use(Fd()).use(Ad()).use($d()).use(Nd()).use(qd()).use(zd());ct.renderer.rules.footnote_ref=(e,t,n,s,a)=>{const l=a.rules.footnote_caption(e,t,n,s,a);return'<sup class="footnote-ref"><span>'+l+"</span></sup>"},ct.renderer.rules.footnote_anchor=()=>' <span class="footnote-backref">\u21A9\uFE0E</span>';const Hd=ct;var Gd=p(13993),ls=p.n(Gd),Zd=Object.defineProperty,_d=Object.defineProperties,Qd=Object.getOwnPropertyDescriptors,cs=Object.getOwnPropertySymbols,Kd=Object.prototype.hasOwnProperty,Yd=Object.prototype.propertyIsEnumerable,us=(e,t,n)=>t in e?Zd(e,t,{enumerable:!0,configurable:!0,writable:!0,value:n}):e[t]=n,Jd=(e,t)=>{for(var n in t||(t={}))Kd.call(t,n)&&us(e,n,t[n]);if(cs)for(var n of cs(t))Yd.call(t,n)&&us(e,n,t[n]);return e},Xd=(e,t)=>_d(e,Qd(t));const ep=Xd(Jd({},ls().defaults),{allowedTags:!1,allowedAttributes:{"*":["href","align","alt","center","width","height","type","controls","target"],img:["src","alt"],source:["src","type"]}}),tp=e=>ls()(e,ep),np=k.default.div`
|
|
140
|
+
position: absolute;
|
|
141
|
+
top: 0;
|
|
142
|
+
width: 100%;
|
|
143
|
+
height: 100%;
|
|
144
|
+
overflow: auto;
|
|
145
|
+
padding: ${({theme:e})=>`${e.spaces[3]} ${e.spaces[4]}`};
|
|
146
|
+
font-size: ${14/16}rem;
|
|
147
|
+
background-color: ${({theme:e})=>e.colors.neutral0};
|
|
148
|
+
z-index: 2;
|
|
149
|
+
cursor: not-allowed;
|
|
150
|
+
color: ${({theme:e})=>e.colors.neutral800};
|
|
151
|
+
|
|
152
|
+
h1,
|
|
153
|
+
h2,
|
|
154
|
+
h3,
|
|
155
|
+
h4,
|
|
156
|
+
h5,
|
|
157
|
+
h6 {
|
|
158
|
+
margin-block-start: 10px;
|
|
159
|
+
margin-block-end: 10px;
|
|
160
|
+
}
|
|
161
|
+
|
|
162
|
+
p {
|
|
163
|
+
margin-bottom: 10px;
|
|
164
|
+
}
|
|
165
|
+
|
|
166
|
+
h1 {
|
|
167
|
+
font-size: ${36/16}rem;
|
|
168
|
+
font-weight: 600;
|
|
169
|
+
}
|
|
170
|
+
|
|
171
|
+
h2 {
|
|
172
|
+
font-size: ${30/16}rem;
|
|
173
|
+
font-weight: 500;
|
|
174
|
+
}
|
|
175
|
+
|
|
176
|
+
h3 {
|
|
177
|
+
font-size: ${24/16}rem;
|
|
178
|
+
font-weight: 500;
|
|
179
|
+
}
|
|
180
|
+
|
|
181
|
+
h4 {
|
|
182
|
+
font-size: ${20/16}rem;
|
|
183
|
+
font-weight: 500;
|
|
184
|
+
}
|
|
185
|
+
|
|
186
|
+
strong {
|
|
187
|
+
font-weight: 800;
|
|
188
|
+
}
|
|
189
|
+
|
|
190
|
+
em {
|
|
191
|
+
font-style: italic;
|
|
192
|
+
}
|
|
193
|
+
|
|
194
|
+
blockquote {
|
|
195
|
+
margin-top: 41px;
|
|
196
|
+
margin-bottom: 34px;
|
|
197
|
+
font-size: ${14/16}rem;
|
|
198
|
+
font-weight: 400;
|
|
199
|
+
border-left: 5px solid #eee;
|
|
200
|
+
font-style: italic;
|
|
201
|
+
padding: 10px 20px;
|
|
202
|
+
}
|
|
203
|
+
|
|
204
|
+
img {
|
|
205
|
+
max-width: 100%;
|
|
206
|
+
}
|
|
207
|
+
|
|
208
|
+
table {
|
|
209
|
+
font-size: 13px;
|
|
210
|
+
thead {
|
|
211
|
+
background: rgb(243, 243, 243);
|
|
212
|
+
tr {
|
|
213
|
+
height: 43px;
|
|
214
|
+
}
|
|
215
|
+
}
|
|
216
|
+
tr {
|
|
217
|
+
border: 1px solid #c6cbd1;
|
|
218
|
+
}
|
|
219
|
+
th,
|
|
220
|
+
td {
|
|
221
|
+
padding: 0 25px;
|
|
222
|
+
border: 1px solid #c6cbd1;
|
|
223
|
+
border-bottom: 0;
|
|
224
|
+
border-top: 0;
|
|
225
|
+
}
|
|
226
|
+
|
|
227
|
+
tbody {
|
|
228
|
+
tr {
|
|
229
|
+
height: 54px;
|
|
230
|
+
}
|
|
231
|
+
}
|
|
232
|
+
}
|
|
233
|
+
|
|
234
|
+
pre,
|
|
235
|
+
code {
|
|
236
|
+
font-size: 13px;
|
|
237
|
+
border-radius: 3px;
|
|
238
|
+
background-color: #002b36;
|
|
239
|
+
}
|
|
240
|
+
|
|
241
|
+
/* Inline code */
|
|
242
|
+
p,
|
|
243
|
+
pre,
|
|
244
|
+
td {
|
|
245
|
+
> code {
|
|
246
|
+
color: #839496;
|
|
247
|
+
}
|
|
248
|
+
}
|
|
249
|
+
|
|
250
|
+
.warning {
|
|
251
|
+
background-color: #faa684;
|
|
252
|
+
padding: 30px;
|
|
253
|
+
border-radius: 3px;
|
|
254
|
+
}
|
|
255
|
+
.tip {
|
|
256
|
+
padding: 30px;
|
|
257
|
+
border-radius: 3px;
|
|
258
|
+
}
|
|
259
|
+
|
|
260
|
+
.footnote-ref,
|
|
261
|
+
.footnote-backref {
|
|
262
|
+
color: #007bff;
|
|
263
|
+
}
|
|
264
|
+
|
|
265
|
+
ol {
|
|
266
|
+
list-style-type: decimal;
|
|
267
|
+
margin-block-start: ${({theme:e})=>e.spaces[4]};
|
|
268
|
+
margin-block-end: ${({theme:e})=>e.spaces[4]};
|
|
269
|
+
margin-inline-start: 0px;
|
|
270
|
+
margin-inline-end: 0px;
|
|
271
|
+
padding-inline-start: ${({theme:e})=>e.spaces[4]};
|
|
272
|
+
ol,
|
|
273
|
+
ul {
|
|
274
|
+
margin-block-start: 0px;
|
|
275
|
+
margin-block-end: 0px;
|
|
276
|
+
}
|
|
277
|
+
}
|
|
278
|
+
|
|
279
|
+
ul {
|
|
280
|
+
list-style-type: disc;
|
|
281
|
+
margin-block-start: ${({theme:e})=>e.spaces[4]};
|
|
282
|
+
margin-block-end: ${({theme:e})=>e.spaces[4]};
|
|
283
|
+
margin-inline-start: 0px;
|
|
284
|
+
margin-inline-end: 0px;
|
|
285
|
+
padding-inline-start: ${({theme:e})=>e.spaces[4]};
|
|
286
|
+
ul,
|
|
287
|
+
ol {
|
|
288
|
+
margin-block-start: 0px;
|
|
289
|
+
margin-block-end: 0px;
|
|
290
|
+
}
|
|
291
|
+
}
|
|
292
|
+
`,kn=({data:e})=>{const t=(0,r.useMemo)(()=>tp(Hd.render(e||"")),[e]);return r.createElement(np,null,r.createElement("div",{dangerouslySetInnerHTML:{__html:t}}))};kn.defaultProps={data:""},kn.propTypes={data:o().string};const ds=(0,r.memo)(kn),rp=k.default.div`
|
|
293
|
+
cursor: ${({disabled:e})=>e?"not-allowed !important":"auto"};
|
|
294
|
+
height: 100%;
|
|
295
|
+
/* BASICS */
|
|
296
|
+
.CodeMirror-placeholder {
|
|
297
|
+
color: ${({theme:e})=>e.colors.neutral600} !important;
|
|
298
|
+
}
|
|
299
|
+
|
|
300
|
+
.CodeMirror {
|
|
301
|
+
/* Set height, width, borders, and global font properties here */
|
|
302
|
+
font-size: ${14/16}rem;
|
|
303
|
+
height: ${({isExpandMode:e})=>e?"100%":"290px"};
|
|
304
|
+
color: ${({theme:e})=>e.colors.neutral800};
|
|
305
|
+
direction: ltr;
|
|
306
|
+
font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Oxygen, Ubuntu, Cantarell,
|
|
307
|
+
'Open Sans', 'Helvetica Neue', sans-serif;
|
|
308
|
+
}
|
|
309
|
+
|
|
310
|
+
/* PADDING */
|
|
311
|
+
|
|
312
|
+
.CodeMirror-lines {
|
|
313
|
+
padding: ${({theme:e})=>`${e.spaces[3]} ${e.spaces[4]}`};
|
|
314
|
+
/* Vertical padding around content */
|
|
315
|
+
}
|
|
316
|
+
|
|
317
|
+
.CodeMirror-scrollbar-filler,
|
|
318
|
+
.CodeMirror-gutter-filler {
|
|
319
|
+
/* The little square between H and V scrollbars */
|
|
320
|
+
background-color: ${({theme:e})=>`${e.colors.neutral0}`};
|
|
321
|
+
}
|
|
322
|
+
|
|
323
|
+
/* GUTTER */
|
|
324
|
+
|
|
325
|
+
.CodeMirror-gutters {
|
|
326
|
+
border-right: 1px solid #ddd;
|
|
327
|
+
background-color: #f7f7f7;
|
|
328
|
+
white-space: nowrap;
|
|
329
|
+
}
|
|
330
|
+
.CodeMirror-linenumbers {
|
|
331
|
+
}
|
|
332
|
+
.CodeMirror-linenumber {
|
|
333
|
+
padding: 0 3px 0 5px;
|
|
334
|
+
min-width: 20px;
|
|
335
|
+
text-align: right;
|
|
336
|
+
color: #999;
|
|
337
|
+
white-space: nowrap;
|
|
338
|
+
}
|
|
339
|
+
|
|
340
|
+
.CodeMirror-guttermarker {
|
|
341
|
+
color: black;
|
|
342
|
+
}
|
|
343
|
+
.CodeMirror-guttermarker-subtle {
|
|
344
|
+
color: #999;
|
|
345
|
+
}
|
|
346
|
+
|
|
347
|
+
/* CURSOR */
|
|
348
|
+
|
|
349
|
+
.CodeMirror-cursor {
|
|
350
|
+
border-left: 1px solid black;
|
|
351
|
+
border-right: none;
|
|
352
|
+
width: 0;
|
|
353
|
+
}
|
|
354
|
+
/* Shown when moving in bi-directional text */
|
|
355
|
+
.CodeMirror div.CodeMirror-secondarycursor {
|
|
356
|
+
border-left: 1px solid silver;
|
|
357
|
+
}
|
|
358
|
+
.cm-fat-cursor .CodeMirror-cursor {
|
|
359
|
+
width: auto;
|
|
360
|
+
border: 0 !important;
|
|
361
|
+
background: #7e7;
|
|
362
|
+
}
|
|
363
|
+
.cm-fat-cursor div.CodeMirror-cursors {
|
|
364
|
+
/* z-index: 1; */
|
|
365
|
+
}
|
|
366
|
+
|
|
367
|
+
.cm-fat-cursor-mark {
|
|
368
|
+
background-color: rgba(20, 255, 20, 0.5);
|
|
369
|
+
-webkit-animation: blink 1.06s steps(1) infinite;
|
|
370
|
+
-moz-animation: blink 1.06s steps(1) infinite;
|
|
371
|
+
animation: blink 1.06s steps(1) infinite;
|
|
372
|
+
}
|
|
373
|
+
.cm-animate-fat-cursor {
|
|
374
|
+
width: auto;
|
|
375
|
+
border: 0;
|
|
376
|
+
-webkit-animation: blink 1.06s steps(1) infinite;
|
|
377
|
+
-moz-animation: blink 1.06s steps(1) infinite;
|
|
378
|
+
animation: blink 1.06s steps(1) infinite;
|
|
379
|
+
background-color: #7e7;
|
|
380
|
+
}
|
|
381
|
+
|
|
382
|
+
/* Can style cursor different in overwrite (non-insert) mode */
|
|
383
|
+
.CodeMirror-overwrite .CodeMirror-cursor {
|
|
384
|
+
}
|
|
385
|
+
|
|
386
|
+
.cm-tab {
|
|
387
|
+
display: inline-block;
|
|
388
|
+
text-decoration: inherit;
|
|
389
|
+
}
|
|
390
|
+
|
|
391
|
+
.CodeMirror-rulers {
|
|
392
|
+
position: absolute;
|
|
393
|
+
left: 0;
|
|
394
|
+
right: 0;
|
|
395
|
+
top: -50px;
|
|
396
|
+
bottom: 0;
|
|
397
|
+
overflow: hidden;
|
|
398
|
+
}
|
|
399
|
+
.CodeMirror-ruler {
|
|
400
|
+
border-left: 1px solid #ccc;
|
|
401
|
+
top: 0;
|
|
402
|
+
bottom: 0;
|
|
403
|
+
position: absolute;
|
|
404
|
+
}
|
|
405
|
+
|
|
406
|
+
/* DEFAULT THEME */
|
|
407
|
+
|
|
408
|
+
.cm-header,
|
|
409
|
+
.cm-strong {
|
|
410
|
+
font-weight: bold;
|
|
411
|
+
}
|
|
412
|
+
.cm-em {
|
|
413
|
+
font-style: italic;
|
|
414
|
+
}
|
|
415
|
+
.cm-link {
|
|
416
|
+
text-decoration: underline;
|
|
417
|
+
}
|
|
418
|
+
.cm-strikethrough {
|
|
419
|
+
text-decoration: line-through;
|
|
420
|
+
}
|
|
421
|
+
|
|
422
|
+
.CodeMirror-composing {
|
|
423
|
+
border-bottom: 2px solid;
|
|
424
|
+
}
|
|
425
|
+
|
|
426
|
+
/* Default styles for common addons */
|
|
427
|
+
|
|
428
|
+
div.CodeMirror span.CodeMirror-matchingbracket {
|
|
429
|
+
color: #0b0;
|
|
430
|
+
}
|
|
431
|
+
div.CodeMirror span.CodeMirror-nonmatchingbracket {
|
|
432
|
+
color: #a22;
|
|
433
|
+
}
|
|
434
|
+
.CodeMirror-matchingtag {
|
|
435
|
+
background: rgba(255, 150, 0, 0.3);
|
|
436
|
+
}
|
|
437
|
+
.CodeMirror-activeline-background {
|
|
438
|
+
background: #e8f2ff;
|
|
439
|
+
}
|
|
440
|
+
|
|
441
|
+
/* STOP */
|
|
442
|
+
|
|
443
|
+
/* The rest of this file contains styles related to the mechanics of
|
|
444
|
+
the editor. You probably shouldn't touch them. */
|
|
445
|
+
|
|
446
|
+
.CodeMirror {
|
|
447
|
+
position: relative;
|
|
448
|
+
overflow: hidden;
|
|
449
|
+
background: ${({theme:e})=>`${e.colors.neutral0}`};
|
|
450
|
+
}
|
|
451
|
+
|
|
452
|
+
.CodeMirror-scroll {
|
|
453
|
+
overflow: scroll !important; /* Things will break if this is overridden */
|
|
454
|
+
/* 50px is the magic margin used to hide the element's real scrollbars */
|
|
455
|
+
/* See overflow: hidden in .CodeMirror */
|
|
456
|
+
margin-bottom: -50px;
|
|
457
|
+
margin-right: -50px;
|
|
458
|
+
padding-bottom: 50px;
|
|
459
|
+
height: 100%;
|
|
460
|
+
outline: none; /* Prevent dragging from highlighting the element */
|
|
461
|
+
position: relative;
|
|
462
|
+
}
|
|
463
|
+
.CodeMirror-sizer {
|
|
464
|
+
position: relative;
|
|
465
|
+
border-right: 50px solid transparent;
|
|
466
|
+
}
|
|
467
|
+
|
|
468
|
+
/* The fake, visible scrollbars. Used to force redraw during scrolling
|
|
469
|
+
before actual scrolling happens, thus preventing shaking and
|
|
470
|
+
flickering artifacts. */
|
|
471
|
+
.CodeMirror-vscrollbar,
|
|
472
|
+
.CodeMirror-hscrollbar,
|
|
473
|
+
.CodeMirror-scrollbar-filler,
|
|
474
|
+
.CodeMirror-gutter-filler {
|
|
475
|
+
position: absolute;
|
|
476
|
+
z-index: 1;
|
|
477
|
+
display: none;
|
|
478
|
+
outline: none;
|
|
479
|
+
}
|
|
480
|
+
|
|
481
|
+
.CodeMirror-vscrollbar {
|
|
482
|
+
right: 0;
|
|
483
|
+
top: 0;
|
|
484
|
+
overflow-x: hidden;
|
|
485
|
+
overflow-y: scroll;
|
|
486
|
+
}
|
|
487
|
+
.CodeMirror-hscrollbar {
|
|
488
|
+
bottom: 0;
|
|
489
|
+
left: 0;
|
|
490
|
+
overflow-y: hidden;
|
|
491
|
+
overflow-x: scroll;
|
|
492
|
+
}
|
|
493
|
+
.CodeMirror-scrollbar-filler {
|
|
494
|
+
right: 0;
|
|
495
|
+
bottom: 0;
|
|
496
|
+
}
|
|
497
|
+
|
|
498
|
+
.CodeMirror-lines {
|
|
499
|
+
cursor: text;
|
|
500
|
+
min-height: 1px; /* prevents collapsing before first draw */
|
|
501
|
+
}
|
|
502
|
+
/* Reset some styles that the rest of the page might have set */
|
|
503
|
+
.CodeMirror pre.CodeMirror-line,
|
|
504
|
+
.CodeMirror pre.CodeMirror-line-like {
|
|
505
|
+
-moz-border-radius: 0;
|
|
506
|
+
-webkit-border-radius: 0;
|
|
507
|
+
border-radius: 0;
|
|
508
|
+
border-width: 0;
|
|
509
|
+
background: transparent;
|
|
510
|
+
font-family: inherit;
|
|
511
|
+
font-size: inherit;
|
|
512
|
+
margin: 0;
|
|
513
|
+
white-space: pre;
|
|
514
|
+
word-wrap: normal;
|
|
515
|
+
line-height: 1.5;
|
|
516
|
+
color: inherit;
|
|
517
|
+
/* z-index: 2; */
|
|
518
|
+
position: relative;
|
|
519
|
+
overflow: visible;
|
|
520
|
+
-webkit-tap-highlight-color: transparent;
|
|
521
|
+
-webkit-font-variant-ligatures: contextual;
|
|
522
|
+
font-variant-ligatures: contextual;
|
|
523
|
+
}
|
|
524
|
+
|
|
525
|
+
.CodeMirror pre.CodeMirror-line-like {
|
|
526
|
+
z-index: 2;
|
|
527
|
+
}
|
|
528
|
+
|
|
529
|
+
.CodeMirror-wrap pre.CodeMirror-line,
|
|
530
|
+
.CodeMirror-wrap pre.CodeMirror-line-like {
|
|
531
|
+
word-wrap: break-word;
|
|
532
|
+
white-space: pre-wrap;
|
|
533
|
+
word-break: normal;
|
|
534
|
+
}
|
|
535
|
+
|
|
536
|
+
.CodeMirror-linebackground {
|
|
537
|
+
position: absolute;
|
|
538
|
+
left: 0;
|
|
539
|
+
right: 0;
|
|
540
|
+
top: 0;
|
|
541
|
+
bottom: 0;
|
|
542
|
+
z-index: 0;
|
|
543
|
+
}
|
|
544
|
+
|
|
545
|
+
.CodeMirror-linewidget {
|
|
546
|
+
position: relative;
|
|
547
|
+
/* z-index: 2; */
|
|
548
|
+
padding: 0.1px; /* Force widget margins to stay inside of the container */
|
|
549
|
+
}
|
|
550
|
+
|
|
551
|
+
.CodeMirror-widget {
|
|
552
|
+
}
|
|
553
|
+
|
|
554
|
+
.CodeMirror-rtl pre {
|
|
555
|
+
direction: rtl;
|
|
556
|
+
}
|
|
557
|
+
|
|
558
|
+
.CodeMirror-code {
|
|
559
|
+
outline: none;
|
|
560
|
+
}
|
|
561
|
+
|
|
562
|
+
/* Force content-box sizing for the elements where we expect it */
|
|
563
|
+
.CodeMirror-scroll,
|
|
564
|
+
.CodeMirror-sizer,
|
|
565
|
+
.CodeMirror-gutter,
|
|
566
|
+
.CodeMirror-gutters,
|
|
567
|
+
.CodeMirror-linenumber {
|
|
568
|
+
-moz-box-sizing: content-box;
|
|
569
|
+
box-sizing: content-box;
|
|
570
|
+
}
|
|
571
|
+
|
|
572
|
+
.CodeMirror-measure {
|
|
573
|
+
position: absolute;
|
|
574
|
+
width: 100%;
|
|
575
|
+
height: 0;
|
|
576
|
+
overflow: hidden;
|
|
577
|
+
visibility: hidden;
|
|
578
|
+
}
|
|
579
|
+
|
|
580
|
+
.CodeMirror-cursor {
|
|
581
|
+
position: absolute;
|
|
582
|
+
pointer-events: none;
|
|
583
|
+
border-color: ${({theme:e})=>`${e.colors.neutral800}`};
|
|
584
|
+
}
|
|
585
|
+
.CodeMirror-measure pre {
|
|
586
|
+
position: static;
|
|
587
|
+
}
|
|
588
|
+
|
|
589
|
+
div.CodeMirror-cursors {
|
|
590
|
+
visibility: hidden;
|
|
591
|
+
position: relative;
|
|
592
|
+
+ div {
|
|
593
|
+
z-index: 0 !important;
|
|
594
|
+
}
|
|
595
|
+
}
|
|
596
|
+
|
|
597
|
+
div.CodeMirror-dragcursors {
|
|
598
|
+
visibility: visible;
|
|
599
|
+
}
|
|
600
|
+
|
|
601
|
+
.CodeMirror-focused div.CodeMirror-cursors {
|
|
602
|
+
visibility: visible;
|
|
603
|
+
}
|
|
604
|
+
|
|
605
|
+
.CodeMirror-selected {
|
|
606
|
+
background: ${({theme:e})=>e.colors.neutral200};
|
|
607
|
+
/* z-index: -10; */
|
|
608
|
+
}
|
|
609
|
+
.CodeMirror-crosshair {
|
|
610
|
+
cursor: crosshair;
|
|
611
|
+
}
|
|
612
|
+
|
|
613
|
+
/* Used to force a border model for a node */
|
|
614
|
+
.cm-force-border {
|
|
615
|
+
padding-right: 0.1px;
|
|
616
|
+
}
|
|
617
|
+
|
|
618
|
+
/* See issue #2901 */
|
|
619
|
+
.cm-tab-wrap-hack:after {
|
|
620
|
+
content: '';
|
|
621
|
+
}
|
|
622
|
+
|
|
623
|
+
/* Help users use markselection to safely style text background */
|
|
624
|
+
span.CodeMirror-selectedtext {
|
|
625
|
+
background: none;
|
|
626
|
+
}
|
|
627
|
+
|
|
628
|
+
span {
|
|
629
|
+
color: ${({theme:e})=>e.colors.neutral800} !important;
|
|
630
|
+
}
|
|
631
|
+
`,Le=(0,k.default)(Me.IconButton)`
|
|
632
|
+
padding: ${({theme:e})=>e.spaces[2]};
|
|
633
|
+
/* Trick to prevent the outline from overflowing because of the general outline-offset */
|
|
634
|
+
outline-offset: -2px !important;
|
|
635
|
+
|
|
636
|
+
svg {
|
|
637
|
+
width: ${18/16}rem;
|
|
638
|
+
height: ${18/16}rem;
|
|
639
|
+
}
|
|
640
|
+
`,op=(0,k.default)(Le)`
|
|
641
|
+
svg {
|
|
642
|
+
width: ${8/16}rem;
|
|
643
|
+
height: ${8/16}rem;
|
|
644
|
+
}
|
|
645
|
+
`,ps=(0,k.default)(Me.IconButtonGroup)`
|
|
646
|
+
margin-left: ${({theme:e})=>e.spaces[4]};
|
|
647
|
+
`,ms=(0,k.default)(Me.IconButton)`
|
|
648
|
+
margin: ${({theme:e})=>`0 ${e.spaces[2]}`};
|
|
649
|
+
padding: ${({theme:e})=>e.spaces[2]};
|
|
650
|
+
|
|
651
|
+
svg {
|
|
652
|
+
width: ${18/16}rem;
|
|
653
|
+
height: ${18/16}rem;
|
|
654
|
+
}
|
|
655
|
+
`,sp=(0,k.default)(Me.IconButtonGroup)`
|
|
656
|
+
margin-right: ${({theme:e})=>`${e.spaces[2]}`};
|
|
657
|
+
`,ap=k.default.div`
|
|
658
|
+
position: relative;
|
|
659
|
+
height: calc(100% - 48px);
|
|
660
|
+
`,ip=(0,k.default)(Tn.BaseButton)`
|
|
661
|
+
background-color: transparent;
|
|
662
|
+
border: none;
|
|
663
|
+
align-items: center;
|
|
664
|
+
|
|
665
|
+
svg {
|
|
666
|
+
margin-left: ${({theme:e})=>`${e.spaces[2]}`};
|
|
667
|
+
path {
|
|
668
|
+
fill: ${({theme:e})=>e.colors.neutral700};
|
|
669
|
+
width: ${12/16}rem;
|
|
670
|
+
height: ${12/16}rem;
|
|
671
|
+
}
|
|
672
|
+
}
|
|
673
|
+
`;var Qt=/^(\s*)(>[> ]*|[*+-] \[[x ]\]\s|[*+-]\s|(\d+)([.)]))(\s*)/,lp=/^(\s*)(>[> ]*|[*+-] \[[x ]\]|[*+-]|(\d+)[.)])(\s*)$/,cp=/[*+-]\s/;function up(e){if(e.getOption("disableInput"))return _t().Pass;for(var t=e.listSelections(),n=[],s=0;s<t.length;s++){var a=t[s].head,l=e.getStateAfter(a.line),i=l.list!==!1,u=l.quote!==0,c=e.getLine(a.line),d=Qt.exec(c),m=/^\s*$/.test(c.slice(0,a.ch));if(!t[s].empty()||!i&&!u||!d||m){e.execCommand("newlineAndIndent");return}if(lp.test(c)){var f=u&&/>\s*$/.test(c),y=!/>\s*$/.test(c);(f||y)&&e.replaceRange("",{line:a.line,ch:0},{line:a.line,ch:a.ch+1}),n[s]=`
|
|
674
|
+
`}else{var h=d[1],b=d[5],E=!(cp.test(d[2])||d[2].indexOf(">")>=0),O=E?parseInt(d[3],10)+1+d[4]:d[2].replace("x"," ");n[s]=`
|
|
675
|
+
`+h+O+b,E&&dp(e,a)}}e.replaceSelections(n)}function dp(e,t){var n=t.line,s=0,a=0,l=Qt.exec(e.getLine(n)),i=l[1];do{s+=1;var u=n+s,c=e.getLine(u),d=Qt.exec(c);if(d){var m=d[1],f=parseInt(l[3],10)+s-a,y=parseInt(d[3],10),h=y;if(i===m&&!isNaN(y))f===y&&(h=y+1),f>y&&(h=f+1),e.replaceRange(c.replace(Qt,m+h+d[4]+d[5]),{line:u,ch:0},{line:u,ch:c.length});else{if(i.length>m.length||i.length<m.length&&s===1)return;a+=1}}}while(d)}const pp=up,An=({disabled:e,editorRef:t,error:n,isPreviewMode:s,isExpandMode:a,name:l,onChange:i,placeholder:u,textareaRef:c,value:d})=>{const m=(0,r.useRef)(i);return(0,r.useEffect)(()=>{t.current=_t().fromTextArea(c.current,{lineWrapping:!0,extraKeys:{Enter:"newlineAndIndentContinueMarkdownList",Tab:!1,"Shift-Tab":!1},readOnly:!1,smartIndent:!1,placeholder:u,spellcheck:!0,inputStyle:"contenteditable"}),_t().commands.newlineAndIndentContinueMarkdownList=pp,t.current.on("change",f=>{m.current({target:{name:l,value:f.getValue(),type:"wysiwyg"}})})},[t,c,l,u]),(0,r.useEffect)(()=>{d&&!t.current.state.focused&&t.current.setValue(d)},[t,d]),(0,r.useEffect)(()=>{s||e?t.current.setOption("readOnly","nocursor"):t.current.setOption("readOnly",!1)},[e,s,t]),(0,r.useEffect)(()=>{n?t.current.setOption("screenReaderLabel",n):t.current.setOption("screenReaderLabel","Editor")},[t,n]),r.createElement(ap,null,r.createElement(rp,{isExpandMode:a,disabled:e||s},r.createElement("textarea",{ref:c})),s&&r.createElement(ds,{data:d}))};An.defaultProps={disabled:!1,error:void 0,isPreviewMode:!1,isExpandMode:!1,placeholder:"",value:""},An.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 mp=An;var ye=p(44526),ue=p(25716),fp=p(37853),gp=p(19882),fs=p.n(gp),yp=p(61980),gs=p.n(yp),hp=p(70052),ys=p.n(hp),bp=p(15053),Ep=p.n(bp),vp=p(18767),Cp=p.n(vp),Op=p(83358),Pp=p.n(Op),Rp=p(69822),Mp=p.n(Rp),Tp=p(88467),wp=p.n(Tp),Ip=p(83262),Dp=p.n(Ip),xp=p(49157),Sp=p.n(xp),Lp=p(75400),hs=p.n(Lp);const jn=({disabled:e,editorRef:t,isExpandMode:n,isPreviewMode:s,onActionClick:a,onToggleMediaLib:l,onTogglePreviewMode:i})=>{const[u,c]=(0,r.useState)(!1),{formatMessage:d}=(0,A.useIntl)(),m=d({id:"components.Wysiwyg.selectOptions.title",defaultMessage:"Add a title"}),f=(0,r.useRef)(),y=()=>{c(h=>!h)};return e||s?r.createElement(D.Box,{padding:2,background:"neutral100"},r.createElement(j.Flex,{justifyContent:"space-between"},r.createElement(j.Flex,null,r.createElement(ue.Select,{disabled:!0,id:"selectTitle",placeholder:m,size:"S","aria-label":m},r.createElement(ue.Option,{value:"h1"},"h1"),r.createElement(ue.Option,{value:"h2"},"h2"),r.createElement(ue.Option,{value:"h3"},"h3"),r.createElement(ue.Option,{value:"h4"},"h4"),r.createElement(ue.Option,{value:"h5"},"h5"),r.createElement(ue.Option,{value:"h6"},"h6")),r.createElement(ps,null,r.createElement(Le,{disabled:!0,id:"Bold",label:"Bold",name:"Bold",icon:r.createElement(fs(),null)}),r.createElement(Le,{disabled:!0,id:"Italic",label:"Italic",name:"Italic",icon:r.createElement(gs(),null)}),r.createElement(Le,{disabled:!0,id:"Underline",label:"Underline",name:"Underline",icon:r.createElement(ys(),null)})),r.createElement(ms,{disabled:!0,id:"more",label:"More",icon:r.createElement(hs(),null)})),!n&&r.createElement(ye.Button,{onClick:i,variant:"tertiary",id:"preview"},d({id:"components.Wysiwyg.ToggleMode.markdown-mode",defaultMessage:"Markdown mode"})))):r.createElement(D.Box,{padding:2,background:"neutral100"},r.createElement(j.Flex,{justifyContent:"space-between"},r.createElement(j.Flex,null,r.createElement(ue.Select,{id:"selectTitle",placeholder:m,size:"S",onChange:h=>a(h,t)},r.createElement(ue.Option,{value:"h1"},"h1"),r.createElement(ue.Option,{value:"h2"},"h2"),r.createElement(ue.Option,{value:"h3"},"h3"),r.createElement(ue.Option,{value:"h4"},"h4"),r.createElement(ue.Option,{value:"h5"},"h5"),r.createElement(ue.Option,{value:"h6"},"h6")),r.createElement(ps,null,r.createElement(Le,{onClick:()=>a("Bold",t),id:"Bold",label:"Bold",name:"Bold",icon:r.createElement(fs(),null)}),r.createElement(Le,{onClick:()=>a("Italic",t),id:"Italic",label:"Italic",name:"Italic",icon:r.createElement(gs(),null)}),r.createElement(Le,{onClick:()=>a("Underline",t),id:"Underline",label:"Underline",name:"Underline",icon:r.createElement(ys(),null)})),r.createElement(ms,{ref:f,onClick:y,id:"more",label:"More",icon:r.createElement(hs(),null)}),u&&r.createElement(fp.Popover,{centered:!0,source:f,spacing:4,id:"popover"},r.createElement(Sn.FocusTrap,{onEscape:y,restoreFocus:!1},r.createElement(j.Flex,null,r.createElement(sp,null,r.createElement(Le,{onClick:()=>a("Strikethrough",t,y),id:"Strikethrough",label:"Strikethrough",name:"Strikethrough",icon:r.createElement(Ep(),null)}),r.createElement(Le,{onClick:()=>a("BulletList",t,y),id:"BulletList",label:"BulletList",name:"BulletList",icon:r.createElement(Cp(),null)}),r.createElement(Le,{onClick:()=>a("NumberList",t,y),id:"NumberList",label:"NumberList",name:"NumberList",icon:r.createElement(Pp(),null)})),r.createElement(Me.IconButtonGroup,null,r.createElement(Le,{onClick:()=>a("Code",t,y),id:"Code",label:"Code",name:"Code",icon:r.createElement(Mp(),null)}),r.createElement(Le,{onClick:()=>{y(),l()},id:"Image",label:"Image",name:"Image",icon:r.createElement(wp(),null)}),r.createElement(op,{onClick:()=>a("Link",t,y),id:"Link",label:"Link",name:"Link",icon:r.createElement(Dp(),null)}),r.createElement(Le,{onClick:()=>a("Quote",t,y),id:"Quote",label:"Quote",name:"Quote",icon:r.createElement(Sp(),null)})))))),i&&r.createElement(ye.Button,{onClick:i,variant:"tertiary",id:"preview"},d({id:"components.Wysiwyg.ToggleMode.preview-mode",defaultMessage:"Preview mode"}))))};jn.defaultProps={isPreviewMode:!1,onActionClick:()=>{},onToggleMediaLib:()=>{},onTogglePreviewMode:void 0},jn.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 Fp=jn;var kp=p(39766),Ap=p.n(kp);const $n=({onToggleExpand:e})=>{const{formatMessage:t}=(0,A.useIntl)();return r.createElement(D.Box,{padding:2,background:"neutral100",hasRadius:!0},r.createElement(j.Flex,{justifyContent:"flex-end",alignItems:"flex-end"},r.createElement(ip,{id:"expand",onClick:e},r.createElement(L.Typography,null,t({id:"components.WysiwygBottomControls.fullscreen",defaultMessage:"Expand"})),r.createElement(Ap(),null))))};$n.defaultProps={onToggleExpand:()=>{}},$n.propTypes={onToggleExpand:o().func};const jp=$n;var $p=Object.defineProperty,bs=Object.getOwnPropertySymbols,Bp=Object.prototype.hasOwnProperty,Np=Object.prototype.propertyIsEnumerable,Es=(e,t,n)=>t in e?$p(e,t,{enumerable:!0,configurable:!0,writable:!0,value:n}):e[t]=n,Vp=(e,t)=>{for(var n in t||(t={}))Bp.call(t,n)&&Es(e,n,t[n]);if(bs)for(var n of bs(t))Np.call(t,n)&&Es(e,n,t[n]);return e};const Bn=({id:e,error:t,name:n,description:s})=>{const{formatMessage:a}=(0,A.useIntl)(),l=s?a({id:s.id,defaultMessage:s.defaultMessage},Vp({},s.values)):"";return!l||t?null:r.createElement(L.Typography,{as:"p",variant:"pi",id:`${e||n}-hint`,textColor:"neutral600"},l)};Bn.defaultProps={id:void 0,description:void 0,error:void 0},Bn.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 qp=Bn,vs=(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=`\`\`\`
|
|
676
|
+
${t}
|
|
677
|
+
\`\`\``;break;case"Link":n=`[${t}](link)`;break;case"Quote":n=`>${t}`;break;default:n=t}return n},Cs=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=`\`\`\`
|
|
678
|
+
${e}
|
|
679
|
+
\`\`\``,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}},Os=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},Ps=(e,t)=>{const n=e.current.getSelection();let s;if(n){const a=vs(t,n);e.current.replaceSelection(a),e.current.focus()}else{s=Cs(t),e.current.replaceSelection(s.editedText),e.current.focus();const{line:a,ch:l}=e.current.getCursor(),i=l-s.selection.end,u=l-s.selection.end-s.selection.start;e.current.setSelection({line:a,ch:u},{line:a,ch:i})}},Wp=(e,t)=>{const n=e.current.getDoc(),s=t==="BulletList"?"- ":"1. ";if(n.somethingSelected()){const a=n.listSelections();let l=null;e.current.operation(function(){a.forEach(function(i){const u=[i.head.line,i.anchor.line].sort();l==null&&(l=n.getLine(u[0]).startsWith(s));for(let c=u[0];c<=u[1];c++)if(l)n.getLine(c).startsWith(s)&&n.replaceRange("",{line:c,ch:0},{line:c,ch:s.length});else{const d=t==="BulletList"?"- ":`${c+1}. `;n.replaceRange(d,{line:c,ch:0})}})})}else{let{line:a}=n.getCursor();const l=Os(t),i=e.current.getLine(a),u=l+i;e.current.setSelection({line:a,ch:0},{line:a,ch:i.length}),e.current.replaceSelection(u)}e.current.focus()},zp=(e,t)=>{let{line:n}=e.current.getCursor();const s=Os(t),a=e.current.getLine(n),l=a.replace(/#{1,6}\s/g,"").trim(),i=s+l;e.current.setSelection({line:n,ch:0},{line:n,ch:a.length}),e.current.replaceSelection(i),setTimeout(()=>{const u=e.current.getLine(n).length;e.current.focus(),e.current.setCursor({line:n,ch:u})},0)},Up=(e,t)=>{let{line:n,ch:s}=e.current.getCursor();t.forEach((a,l)=>{let i=e.current.getLine(n).length;e.current.setCursor({line:n,ch:i}),(l>0||l===0&&s!==0)&&(i=e.current.getLine(n).length,e.current.setCursor({line:n,ch:i}),n++,e.current.replaceSelection(`
|
|
680
|
+
`)),a.mime.includes("image")?e.current.replaceSelection(``):e.current.replaceSelection(`[${a.alt}](${a.url})`)}),setTimeout(()=>e.current.focus(),0)},Hp=(e,t,n,s,a)=>{const l=vs(t,a),i=e.current.getRange({line:n+1,ch:0},{line:1/0,ch:1/0});if(e.current.replaceRange("",{line:n+1,ch:0},{line:1/0,ch:1/0}),e.current.replaceSelection(""),e.current.setCursor({line:n,ch:s}),e.current.replaceSelection(`
|
|
681
|
+
`),e.current.replaceSelection(l),t==="Code"){let{line:u}=e.current.getCursor();e.current.setCursor({line:u-1,ch:a.length})}e.current.replaceRange(i,{line:n+4,ch:0},{line:1/0,ch:1/0}),e.current.focus()},Gp=(e,t,n,s)=>{const a=Cs(t),l=e.current.getRange({line:n+1,ch:0},{line:1/0,ch:1/0});if(e.current.replaceRange("",{line:n+1,ch:0},{line:1/0,ch:1/0}),e.current.setCursor({line:n,ch:s}),e.current.replaceSelection(`
|
|
682
|
+
`),e.current.replaceSelection(a.editedText),t==="Code")n+=2,e.current.setSelection({line:n,ch:0},{line:n,ch:4});else{n+=1;let{ch:i}=e.current.getCursor(),u=i-a.selection.end,c=i-a.selection.end-a.selection.start;e.current.setSelection({line:n,ch:c},{line:n,ch:u})}e.current.replaceRange(l,{line:n+2,ch:0},{line:1/0,ch:1/0}),e.current.focus()},Zp=(e,t)=>{const n=e.current.getSelection();let{line:s}=e.current.getCursor(),a=e.current.getLine(s).length;n?Hp(e,t,s,a,n):Gp(e,t,s,a)};var _p=p(64410),Qp=p(43768),Kp=p.n(Qp);const Yp=(e,t)=>`${e}${Math.floor(t*255).toString(16).padStart(2,0)}`,Jp=(0,k.default)(j.Flex)`
|
|
683
|
+
background: ${({theme:e})=>Yp(e.colors.neutral800,.2)};
|
|
684
|
+
`,Xp=(0,k.default)(D.Box)`
|
|
685
|
+
border-right: 1px solid ${({theme:e})=>e.colors.neutral200};
|
|
686
|
+
`,em=(0,k.default)(Tn.BaseButton)`
|
|
687
|
+
background-color: transparent;
|
|
688
|
+
border: none;
|
|
689
|
+
align-items: center;
|
|
690
|
+
|
|
691
|
+
svg {
|
|
692
|
+
margin-left: ${({theme:e})=>`${e.spaces[2]}`};
|
|
693
|
+
path {
|
|
694
|
+
fill: ${({theme:e})=>e.colors.neutral700};
|
|
695
|
+
width: ${12/16}rem;
|
|
696
|
+
height: ${12/16}rem;
|
|
697
|
+
}
|
|
698
|
+
}
|
|
699
|
+
`,Nn=({children:e,isExpandMode:t,error:n,previewContent:s,onCollapse:a})=>{const{formatMessage:l}=(0,A.useIntl)();return(0,r.useEffect)(()=>{const i=document.body;return t&&i.classList.add("lock-body-scroll"),()=>{t&&i.classList.remove("lock-body-scroll")}},[t]),t?r.createElement(_p.Portal,{role:"dialog","aria-modal":!1},r.createElement(Sn.FocusTrap,{onEscape:a},r.createElement(Jp,{position:"fixed",top:0,left:0,right:0,bottom:0,zIndex:4,justifyContent:"center",onClick:a},r.createElement(D.Box,{id:"wysiwyg-expand",background:"neutral0",hasRadius:!0,shadow:"popupShadow",overflow:"hidden",width:"70%",height:"70%",onClick:i=>i.stopPropagation()},r.createElement(j.Flex,{height:"100%",alignItems:"flex-start"},r.createElement(Xp,{flex:"1",height:"100%"},e),r.createElement(D.Box,{flex:"1",height:"100%"},r.createElement(j.Flex,{height:(0,g.pxToRem)(48),background:"neutral100",justifyContent:"flex-end"},r.createElement(em,{id:"collapse",onClick:a},r.createElement(L.Typography,null,l({id:"components.Wysiwyg.collapse",defaultMessage:"Collapse"})),r.createElement(Kp(),null))),r.createElement(D.Box,{position:"relative",height:"100%"},r.createElement(ds,{data:s})))))))):r.createElement(D.Box,{borderColor:n?"danger600":"neutral200",borderStyle:"solid",borderWidth:"1px",hasRadius:!0},e)};Nn.defaultProps={error:void 0,previewContent:""},Nn.propTypes={children:o().node.isRequired,error:o().string,isExpandMode:o().bool.isRequired,previewContent:o().string,onCollapse:o().func.isRequired};var tm=Object.defineProperty,Rs=Object.getOwnPropertySymbols,nm=Object.prototype.hasOwnProperty,rm=Object.prototype.propertyIsEnumerable,Ms=(e,t,n)=>t in e?tm(e,t,{enumerable:!0,configurable:!0,writable:!0,value:n}):e[t]=n,Ts=(e,t)=>{for(var n in t||(t={}))nm.call(t,n)&&Ms(e,n,t[n]);if(Rs)for(var n of Rs(t))rm.call(t,n)&&Ms(e,n,t[n]);return e};const om=(0,k.default)(D.Box)`
|
|
700
|
+
svg path {
|
|
701
|
+
fill: ${({theme:e})=>e.colors.neutral500};
|
|
702
|
+
}
|
|
703
|
+
`,sm=(0,k.default)(L.Typography)`
|
|
704
|
+
line-height: 0;
|
|
705
|
+
`,Vn=({description:e,disabled:t,error:n,intlLabel:s,labelAction:a,name:l,onChange:i,placeholder:u,value:c,required:d})=>{const{formatMessage:m}=(0,A.useIntl)(),f=(0,r.useRef)(null),y=(0,r.useRef)(null),[h,b]=(0,r.useState)(!1),[E,O]=(0,r.useState)(!1),[x,C]=(0,r.useState)(!1),{components:S}=(0,g.useLibrary)(),I=S["media-library"],V=()=>O(F=>!F),w=()=>b(F=>!F),W=()=>{b(!1),C(F=>!F)},U=(F,K,$)=>{switch(F){case"Link":case"Strikethrough":{Ps(K,F),$();break}case"Code":case"Quote":{Zp(K,F),$();break}case"Bold":case"Italic":case"Underline":{Ps(K,F);break}case"BulletList":case"NumberList":{Wp(K,F),$();break}case"h1":case"h2":case"h3":case"h4":case"h5":case"h6":{zp(K,F);break}default:}},G=F=>{const K=F.map($=>({alt:$.alternativeText||$.name,url:(0,g.prefixFileUrlWithBackendUrl)($.url),mime:$.mime}));Up(y,K),O(!1)},N=u?m({id:u.id,defaultMessage:u.defaultMessage},Ts({},u.values)):"",H=s.id?m({id:s.id,defaultMessage:s.defaultMessage},Ts({},s.values)):l;return r.createElement(r.Fragment,null,r.createElement(se.Stack,{spacing:1},r.createElement(se.Stack,{horizontal:!0,spacing:1},r.createElement(L.Typography,{variant:"pi",fontWeight:"bold",textColor:"neutral800"},H,d&&r.createElement(sm,{textColor:"danger600"},"*")),a&&r.createElement(om,{paddingLeft:1},a)),r.createElement(Nn,{isExpandMode:x,error:n,previewContent:c,onCollapse:W},r.createElement(Fp,{isExpandMode:x,editorRef:y,isPreviewMode:h,onActionClick:U,onToggleMediaLib:V,onTogglePreviewMode:x?void 0:w,disabled:t}),r.createElement(mp,{disabled:t,isExpandMode:x,editorRef:y,error:n,isPreviewMode:h,name:l,onChange:i,placeholder:N,textareaRef:f,value:c}),!x&&r.createElement(jp,{onToggleExpand:W})),r.createElement(qp,{description:e,name:l,error:n})),n&&r.createElement(D.Box,{paddingTop:1},r.createElement(L.Typography,{variant:"pi",textColor:"danger600","data-strapi-field-error":!0},n)),E&&r.createElement(I,{onClose:V,onSelectAssets:G}))};Vn.defaultProps={description:null,disabled:!1,error:"",labelAction:void 0,placeholder:null,required:!1,value:""},Vn.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 am=Vn;var im=p(16285),lm=p.n(im),Mt=p(20001),cm=p(37475);const um=k.default.div`
|
|
706
|
+
cursor: ${({disabled:e})=>e?"not-allowed !important":"auto"};
|
|
707
|
+
/* BASICS */
|
|
708
|
+
|
|
709
|
+
.colored {
|
|
710
|
+
background-color: yellow;
|
|
711
|
+
color: black !important;
|
|
712
|
+
}
|
|
713
|
+
|
|
714
|
+
> div {
|
|
715
|
+
border-radius: 3px;
|
|
716
|
+
> div:last-of-type {
|
|
717
|
+
min-height: 253px;
|
|
718
|
+
max-height: 506px;
|
|
719
|
+
}
|
|
720
|
+
}
|
|
721
|
+
|
|
722
|
+
.CodeMirror {
|
|
723
|
+
/* Set height, width, borders, and global font properties here */
|
|
724
|
+
font-size: ${14/16}rem;
|
|
725
|
+
direction: ltr;
|
|
726
|
+
z-index: 0;
|
|
727
|
+
}
|
|
728
|
+
`,dm=(0,k.default)(D.Box)`
|
|
729
|
+
border-radius: ${({theme:e})=>e.borderRadius};
|
|
730
|
+
border: 1px solid ${({theme:e,error:t})=>t?e.colors.danger600:"transparent"};
|
|
731
|
+
`;var pm=Object.defineProperty,ws=Object.getOwnPropertySymbols,mm=Object.prototype.hasOwnProperty,fm=Object.prototype.propertyIsEnumerable,Is=(e,t,n)=>t in e?pm(e,t,{enumerable:!0,configurable:!0,writable:!0,value:n}):e[t]=n,gm=(e,t)=>{for(var n in t||(t={}))mm.call(t,n)&&Is(e,n,t[n]);if(ws)for(var n of ws(t))fm.call(t,n)&&Is(e,n,t[n]);return e};const ym=(0,k.default)(D.Box)`
|
|
732
|
+
svg path {
|
|
733
|
+
fill: ${({theme:e})=>e.colors.neutral500};
|
|
734
|
+
}
|
|
735
|
+
`,qn=({intlLabel:e,labelAction:t,name:n,required:s})=>{const{formatMessage:a}=(0,A.useIntl)(),l=e!=null&&e.id?a({id:e.id,defaultMessage:e.defaultMessage},gm({},e.values)):n;return r.createElement(j.Flex,null,r.createElement(Mt.FieldLabel,{required:s},l),t&&r.createElement(ym,{paddingLeft:1},t))};qn.defaultProps={id:void 0,intlLabel:void 0,labelAction:void 0,required:!1},qn.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 hm=qn,Wn=({name:e,hint:t,error:n,children:s})=>{const{formatMessage:a}=(0,A.useIntl)(),l=n?a({id:n,defaultMessage:n}):"";return r.createElement(Mt.Field,{name:e,hint:t&&a(t),error:l,id:e},s)};Wn.defaultProps={hint:void 0,error:""},Wn.propTypes={name:o().string.isRequired,hint:o().shape({id:o().string,defaultMessage:o().string}),error:o().string,children:o().node.isRequired};const bm=Wn;var Em=Object.defineProperty,vm=(e,t,n)=>t in e?Em(e,t,{enumerable:!0,configurable:!0,writable:!0,value:n}):e[t]=n,Ue=(e,t,n)=>(vm(e,typeof t!="symbol"?t+"":t,n),n),Cm=(e,t,n)=>new Promise((s,a)=>{var l=c=>{try{u(n.next(c))}catch(d){a(d)}},i=c=>{try{u(n.throw(c))}catch(d){a(d)}},u=c=>c.done?s(c.value):Promise.resolve(c.value).then(l,i);u((n=n.apply(e,t)).next())});const Om=600,Pm="blackboard";(()=>Cm(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 zn extends r.Component{constructor(t){super(t),Ue(this,"timer",null),Ue(this,"setInitValue",()=>{const{value:n}=this.props;try{return n===null?this.codeMirror.setValue(""):this.codeMirror.setValue(n)}catch(s){return this.setState({error:!0})}}),Ue(this,"setSize",()=>this.codeMirror.setSize("100%","auto")),Ue(this,"getContentAtLine",n=>this.codeMirror.getLine(n)),Ue(this,"getEditorOption",n=>this.codeMirror.getOption(n)),Ue(this,"getValue",()=>this.codeMirror.getValue()),Ue(this,"markSelection",({message:n})=>{let s=parseInt(n.split(":")[0].split("line ")[1],10)-1,a=this.getContentAtLine(s);a==="{"&&(s+=1,a=this.getContentAtLine(s));const l=a.length,i=l-lm()(a," ").length,u=this.codeMirror.markText({line:s,ch:i},{line:s,ch:l},{className:"colored"});this.setState({markedText:u})}),Ue(this,"handleChange",(n,s)=>{if(s.origin==="setValue")return;const{name:a,onChange:l}=this.props;let i=n.getValue();i===""&&(i=null),l({target:{name:a,value:i,type:"json"}}),this.state.markedText&&(this.state.markedText.clear(),this.setState({markedText:null,error:null})),clearTimeout(this.timer),this.timer=setTimeout(()=>this.testJSON(n.getValue()),Om)}),Ue(this,"testJSON",n=>{try{cm.parse(n)}catch(s){this.markSelection(s)}}),this.editor=r.createRef(),this.state={error:!1,markedText:null}}componentDidMount(){this.codeMirror=_t().fromTextArea(this.editor.current,{autoCloseBrackets:!0,lineNumbers:!0,matchBrackets:!0,mode:"application/json",readOnly:this.props.disabled,smartIndent:!0,styleSelectedText:!0,tabSize:2,theme:Pm,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(bm,{name:this.props.name,hint:this.props.description,error:this.props.error},r.createElement(se.Stack,{spacing:1},r.createElement(hm,{intlLabel:this.props.intlLabel,labelAction:this.props.labelAction,name:this.props.name,required:this.props.required}),r.createElement(dm,{error:this.props.error},r.createElement(um,{disabled:this.props.disabled},r.createElement("textarea",{ref:this.editor,autoComplete:"off",id:this.props.id||this.props.name,defaultValue:""}))),r.createElement(Mt.FieldHint,null),r.createElement(Mt.FieldError,null)))}}zn.defaultProps={description:null,disabled:!1,id:void 0,error:void 0,intlLabel:void 0,labelAction:void 0,onChange:()=>{},value:null,required:!1},zn.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 Rm=zn;var Un=p(37178),Mm=p(23101),Tm=p.n(Mm),wm=p(14356),Im=p.n(wm),Dm=p(50678),Tt=p.n(Dm),xm=p(103),Sm=p.n(xm);const Ds=(e,t)=>{const[n,s]=(0,r.useState)(e);return(0,r.useEffect)(()=>{const a=setTimeout(()=>{s(e)},t);return()=>{clearTimeout(a)}},[e,t]),n},Lm=new RegExp(/^[A-Za-z0-9-_.~]*$/),Fm=(0,k.default)(D.Box)`
|
|
736
|
+
position: relative;
|
|
737
|
+
`,km=(0,k.default)(Mt.FieldAction)`
|
|
738
|
+
svg {
|
|
739
|
+
height: 1rem;
|
|
740
|
+
width: 1rem;
|
|
741
|
+
path {
|
|
742
|
+
fill: ${({theme:e})=>e.colors.neutral400};
|
|
743
|
+
}
|
|
744
|
+
}
|
|
745
|
+
|
|
746
|
+
svg:hover {
|
|
747
|
+
path {
|
|
748
|
+
fill: ${({theme:e})=>e.colors.primary600};
|
|
749
|
+
}
|
|
750
|
+
}
|
|
751
|
+
`,Hn=(0,k.default)(j.Flex)`
|
|
752
|
+
position: absolute;
|
|
753
|
+
right: ${({theme:e})=>e.spaces[6]};
|
|
754
|
+
width: 100px;
|
|
755
|
+
pointer-events: none;
|
|
756
|
+
|
|
757
|
+
svg {
|
|
758
|
+
margin-right: ${({theme:e})=>e.spaces[1]};
|
|
759
|
+
height: ${12/16}rem;
|
|
760
|
+
width: ${12/16}rem;
|
|
761
|
+
path {
|
|
762
|
+
fill: ${({theme:e,notAvailable:t})=>t?e.colors.danger600:e.colors.success600};
|
|
763
|
+
}
|
|
764
|
+
}
|
|
765
|
+
`,Am=k.keyframes`
|
|
766
|
+
from {
|
|
767
|
+
transform: rotate(0deg);
|
|
768
|
+
}
|
|
769
|
+
to {
|
|
770
|
+
transform: rotate(359deg);
|
|
771
|
+
}
|
|
772
|
+
`,jm=(0,k.default)(j.Flex)`
|
|
773
|
+
animation: ${Am} 2s infinite linear;
|
|
774
|
+
`;var $m=Object.defineProperty,xs=Object.getOwnPropertySymbols,Bm=Object.prototype.hasOwnProperty,Nm=Object.prototype.propertyIsEnumerable,Ss=(e,t,n)=>t in e?$m(e,t,{enumerable:!0,configurable:!0,writable:!0,value:n}):e[t]=n,Gn=(e,t)=>{for(var n in t||(t={}))Bm.call(t,n)&&Ss(e,n,t[n]);if(xs)for(var n of xs(t))Nm.call(t,n)&&Ss(e,n,t[n]);return e},Ls=(e,t,n)=>new Promise((s,a)=>{var l=c=>{try{u(n.next(c))}catch(d){a(d)}},i=c=>{try{u(n.throw(c))}catch(d){a(d)}},u=c=>c.done?s(c.value):Promise.resolve(c.value).then(l,i);u((n=n.apply(e,t)).next())});const Zn=({attribute:e,contentTypeUID:t,description:n,disabled:s,error:a,intlLabel:l,labelAction:i,name:u,onChange:c,value:d,placeholder:m,required:f})=>{const{modifiedData:y,initialData:h,layout:b}=(0,g.useCMEditViewDataManager)(),[E,O]=(0,r.useState)(!1),[x,C]=(0,r.useState)(null),S=Ds(d,300),I=(0,r.useRef)(),V=h[u],{formatMessage:w}=(0,A.useIntl)(),W=R()(b,["options","timestamps",0]),U=!h[W],G=Ds(y[e.targetField],300),[N,H]=(0,r.useState)(!1),[F,K]=(0,r.useState)(null),$=l.id?w({id:l.id,defaultMessage:l.defaultMessage},Gn({},l.values)):u,Y=n?w({id:n.id,defaultMessage:n.defaultMessage},Gn({},n.values)):"",M=m?w({id:m.id,defaultMessage:m.defaultMessage},Gn({},m.values)):"";I.current=(P=!1)=>Ls(void 0,null,function*(){O(!0);const Q=ve("uid/generate");try{const{data:{data:re}}=yield ge.be.post(Q,{contentTypeUID:t,field:u,data:y});c({target:{name:u,value:re,type:"text"}},P),O(!1)}catch(re){O(!1)}});const q=()=>Ls(void 0,null,function*(){O(!0);const P=ve("uid/check-availability");if(!!d)try{const{data:Q}=yield ge.be.post(P,{contentTypeUID:t,field:u,value:d?d.trim():""});C(Q),O(!1)}catch(Q){O(!1)}});(0,r.useEffect)(()=>{!d&&e.required&&I.current(!0)},[]),(0,r.useEffect)(()=>{S&&S.trim().match(Lm)&&S!==V&&q(),S||C(null)},[S,V]),(0,r.useEffect)(()=>{let P;return x&&x.isAvailable&&(P=setTimeout(()=>{C(null)},4e3)),()=>{P&&clearTimeout(P)}},[x]),(0,r.useEffect)(()=>{!N&&U&&G&&y[e.targetField]&&!d&&I.current(!0)},[G,N,U]);const Z=()=>{K(w({id:"content-manager.components.uid.regenerate",defaultMessage:"Regenerate"}))},_=()=>{K(null)},T=P=>{P.target.value&&U&&H(!0),c(P)};return r.createElement(Un.TextInput,{disabled:s,error:a,endAction:r.createElement(Fm,null,x&&x.isAvailable&&!F&&r.createElement(Hn,{alignItems:"center",justifyContent:"flex-end"},r.createElement(Im(),null),r.createElement(L.Typography,{textColor:"success600",variant:"pi"},w({id:"content-manager.components.uid.available",defaultMessage:"Available"}))),x&&!x.isAvailable&&!F&&r.createElement(Hn,{notAvailable:!0,alignItems:"center",justifyContent:"flex-end"},r.createElement(Tt(),null),r.createElement(L.Typography,{textColor:"danger600",variant:"pi"},w({id:"content-manager.components.uid.unavailable",defaultMessage:"Unavailable"}))),F&&r.createElement(Hn,{alignItems:"center",justifyContent:"flex-end"},r.createElement(L.Typography,{textColor:"primary600",variant:"pi"},F)),r.createElement(km,{onClick:()=>I.current(),label:"regenerate",onMouseEnter:Z,onMouseLeave:_},E?r.createElement(jm,null,r.createElement(Sm(),null)):r.createElement(Tm(),null))),hint:Y,label:$,labelAction:i,name:u,onChange:T,placeholder:M,value:d||"",required:f})};Zn.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},Zn.defaultProps={description:void 0,disabled:!1,error:void 0,labelAction:void 0,placeholder:void 0,value:"",required:!1};const Vm=Zn;var qm=p(28611),Wm=p.n(qm),zm=p(77236),Fs=p.n(zm),Um=p(86834),Re=p.n(Um),Hm=p(3040),ne=p.n(Hm);const Gm=(0,k.default)(D.Box)`
|
|
775
|
+
svg path {
|
|
776
|
+
fill: ${({theme:e})=>e.colors.neutral500};
|
|
777
|
+
}
|
|
778
|
+
`,_n=({intlLabel:e,id:t,labelAction:n,link:s,name:a,numberOfEntries:l,isSingle:i})=>{const{formatMessage:u}=(0,A.useIntl)(),c=e!=null&&e.id?u(e):a;return r.createElement(j.Flex,{justifyContent:"space-between"},r.createElement(j.Flex,null,r.createElement(L.Typography,{textColor:"neutral800",htmlFor:t||a,variant:"pi",fontWeight:"bold",as:"label"},c,!i&&r.createElement(r.Fragment,null,"\xA0(",l,")")),n&&r.createElement(Gm,{paddingLeft:1},n)),s)};_n.defaultProps={id:void 0,labelAction:void 0,link:null,numberOfEntries:0},_n.propTypes={id:o().string,intlLabel:o().shape({id:o().string.isRequired,defaultMessage:o().string.isRequired,values:o().object}).isRequired,isSingle:o().bool.isRequired,labelAction:o().element,link:o().element,name:o().string.isRequired,numberOfEntries:o().number};const Zm=_n;var _m=p(7787),Qm=p.n(_m),Kt=p(54262),Km=p(23973),ks=p.n(Km),Ym=Object.defineProperty,As=Object.getOwnPropertySymbols,Jm=Object.prototype.hasOwnProperty,Xm=Object.prototype.propertyIsEnumerable,js=(e,t,n)=>t in e?Ym(e,t,{enumerable:!0,configurable:!0,writable:!0,value:n}):e[t]=n,$s=(e,t)=>{for(var n in t||(t={}))Jm.call(t,n)&&js(e,n,t[n]);if(As)for(var n of As(t))Xm.call(t,n)&&js(e,n,t[n]);return e};const ef=k.default.div`
|
|
779
|
+
width: ${(0,g.pxToRem)(6)};
|
|
780
|
+
height: ${(0,g.pxToRem)(6)};
|
|
781
|
+
margin-right: ${({theme:e})=>e.spaces[2]};
|
|
782
|
+
background: ${({theme:e,isDraft:t})=>e.colors[t?"secondary700":"success200"]};
|
|
783
|
+
border-radius: 50%;
|
|
784
|
+
cursor: pointer;
|
|
785
|
+
`,Bs=e=>{const{formatMessage:t}=(0,A.useIntl)(),n=Kt.components.SingleValue,s=ks()(R()(e,"data.value"),"publishedAt"),a=Re()(R()(e,"data.value.publishedAt"));if(s){const l={id:v("components.Select.draft-info-title"),defaultMessage:"State: Draft"},i={id:v("components.Select.publish-info-title"),defaultMessage:"State: Published"},u=t(a?l:i);return r.createElement(n,$s({},e),r.createElement(j.Flex,null,r.createElement(ef,{title:u,isDraft:a}),r.createElement(L.Typography,{ellipsis:!0},e.data.label||"-")))}return r.createElement(n,$s({},e),e.data.label||"-")};Bs.propTypes={data:o().object.isRequired,selectProps:o().shape({mainField:o().shape({name:o().string.isRequired,schema:o().shape({type:o().string.isRequired}).isRequired}).isRequired}).isRequired};const tf=Bs;var nf=Object.defineProperty,rf=Object.defineProperties,of=Object.getOwnPropertyDescriptors,Ns=Object.getOwnPropertySymbols,sf=Object.prototype.hasOwnProperty,af=Object.prototype.propertyIsEnumerable,Vs=(e,t,n)=>t in e?nf(e,t,{enumerable:!0,configurable:!0,writable:!0,value:n}):e[t]=n,lf=(e,t)=>{for(var n in t||(t={}))sf.call(t,n)&&Vs(e,n,t[n]);if(Ns)for(var n of Ns(t))af.call(t,n)&&Vs(e,n,t[n]);return e},cf=(e,t)=>rf(e,of(t));function Qn({components:e,mainField:t,name:n,isDisabled:s,isLoading:a,onChange:l,onInputChange:i,onMenuClose:u,onMenuOpen:c,onMenuScrollToBottom:d,options:m,placeholder:f,styles:y,value:h,description:b}){const{formatMessage:E}=(0,A.useIntl)();return r.createElement(se.Stack,{spacing:1},r.createElement(Kt.default,{components:cf(lf({},e),{SingleValue:tf}),id:n,isClearable:!0,isDisabled:s,isLoading:a,mainField:t,options:m,onChange:l,onInputChange:i,onMenuClose:u,onMenuOpen:c,onMenuScrollToBottom:d,placeholder:E(f||{id:"global.select",defaultMessage:"Select..."}),styles:y,value:Qm()(h)?null:{label:R()(h,[t.name],""),value:h}}),b&&r.createElement(L.Typography,{variant:"pi",textColor:"neutral600"},b))}Qn.defaultProps={description:"",components:{},placeholder:null,value:null},Qn.propTypes={components:o().object,isDisabled:o().bool.isRequired,isLoading:o().bool.isRequired,mainField:o().shape({name:o().string.isRequired,schema:o().shape({type:o().string.isRequired}).isRequired}).isRequired,name:o().string.isRequired,onChange:o().func.isRequired,onInputChange:o().func.isRequired,onMenuClose:o().func.isRequired,onMenuOpen:o().func.isRequired,onMenuScrollToBottom:o().func.isRequired,options:o().array.isRequired,placeholder:o().shape({id:o().string.isRequired,defaultMessage:o().string.isRequired}),styles:o().object.isRequired,value:o().object,description:o().string};const uf=(0,r.memo)(Qn),df=k.default.div`
|
|
786
|
+
width: ${(0,g.pxToRem)(6)};
|
|
787
|
+
height: ${(0,g.pxToRem)(6)};
|
|
788
|
+
background: ${({theme:e,isDraft:t})=>e.colors[t?"secondary600":"success600"]};
|
|
789
|
+
border-radius: 50%;
|
|
790
|
+
cursor: pointer;
|
|
791
|
+
`;function Kn({data:e,displayNavigationLink:t,isDisabled:n,mainField:s,onRemove:a,searchToPersist:l,targetModel:i}){const{formatMessage:u}=(0,A.useIntl)(),c=`/content-manager/collectionType/${i}/${e.id}`;let d="pointer";n&&(d="not-allowed"),t||(d="default");const m=ks()(e,"publishedAt"),f=Re()(e.publishedAt),y=e[s.name],h={id:v("components.Select.draft-info-title"),defaultMessage:"State: Draft"},b={id:v("components.Select.publish-info-title"),defaultMessage:"State: Published"},E=u(f?h:b),{pathname:O}=(0,ee.useLocation)();return r.createElement(j.Flex,{as:"li",alignItems:"center"},r.createElement(j.Flex,{style:{flex:1},alignItems:"center"},m&&r.createElement(D.Box,{paddingRight:2},r.createElement(df,{isDraft:f,title:E})),t?r.createElement(g.Link,{to:{pathname:c,state:{from:O},search:l},style:{textTransform:"none"}},y||e.id):r.createElement(L.Typography,{variant:"pi"},y||e.id)),r.createElement(g.RemoveRoundedButton,{onClick:a,label:"Remove",style:{cursor:d}}))}Kn.defaultProps={onRemove:()=>{},searchToPersist:null,targetModel:""},Kn.propTypes={data:o().object.isRequired,displayNavigationLink:o().bool.isRequired,isDisabled:o().bool.isRequired,mainField:o().shape({name:o().string.isRequired,schema:o().shape({type:o().string.isRequired}).isRequired}).isRequired,onRemove:o().func,searchToPersist:o().string,targetModel:o().string};const pf=(0,r.memo)(Kn);function Yn({addRelation:e,components:t,displayNavigationLink:n,mainField:s,name:a,isDisabled:l,isLoading:i,onInputChange:u,onMenuClose:c,onMenuOpen:d,onMenuScrollToBottom:m,onRemove:f,options:y,placeholder:h,searchToPersist:b,targetModel:E,value:O,description:x}){const{formatMessage:C}=(0,A.useIntl)(),S={ignoreCase:!0,ignoreAccents:!0,trim:!1,matchFrom:"any"};return r.createElement(se.Stack,{spacing:1},r.createElement(g.ReactSelect,{components:t,isDisabled:l,id:a,filterOption:(I,V)=>!Re()(O)&&O.findIndex(W=>W.id===I.value.id)!==-1?!1:V?(0,Kt.createFilter)(S)(I,V):!0,mainField:s,isLoading:i,isMulti:!0,isSearchable:!0,options:y,onChange:e,onInputChange:u,onMenuClose:c,onMenuOpen:d,onMenuScrollToBottom:m,placeholder:C(h||{id:"global.select",defaultMessage:"Select..."}),value:[]}),r.createElement(D.Box,{paddingTop:3,style:{overflow:"auto"}},r.createElement(se.Stack,{as:"ul",spacing:4,style:{maxHeight:"128px",overflowX:"hidden"}},O==null?void 0:O.map((I,V)=>r.createElement(pf,{key:I.id,data:I,displayNavigationLink:n,isDisabled:l,mainField:s,onRemove:()=>{l||f(`${a}.${V}`)},searchToPersist:b,targetModel:E})))),x&&r.createElement(L.Typography,{variant:"pi",textColor:"neutral600"},x))}Yn.defaultProps={description:"",components:{},placeholder:null,searchToPersist:null,value:null},Yn.propTypes={addRelation:o().func.isRequired,components:o().object,displayNavigationLink:o().bool.isRequired,isDisabled:o().bool.isRequired,isLoading:o().bool.isRequired,mainField:o().shape({name:o().string.isRequired,schema:o().shape({type:o().string.isRequired}).isRequired}).isRequired,name:o().string.isRequired,onInputChange:o().func.isRequired,onMenuClose:o().func.isRequired,onMenuOpen:o().func.isRequired,onMenuScrollToBottom:o().func.isRequired,onRemove:o().func.isRequired,options:o().array.isRequired,placeholder:o().shape({id:o().string.isRequired,defaultMessage:o().string.isRequired}),searchToPersist:o().string,targetModel:o().string.isRequired,value:o().array,description:o().string};const mf=(0,r.memo)(Yn);var ff=Object.defineProperty,qs=Object.getOwnPropertySymbols,gf=Object.prototype.hasOwnProperty,yf=Object.prototype.propertyIsEnumerable,Ws=(e,t,n)=>t in e?ff(e,t,{enumerable:!0,configurable:!0,writable:!0,value:n}):e[t]=n,zs=(e,t)=>{for(var n in t||(t={}))gf.call(t,n)&&Ws(e,n,t[n]);if(qs)for(var n of qs(t))yf.call(t,n)&&Ws(e,n,t[n]);return e};const hf=k.default.div`
|
|
792
|
+
width: ${(0,g.pxToRem)(6)};
|
|
793
|
+
height: ${(0,g.pxToRem)(6)};
|
|
794
|
+
margin-right: ${({theme:e})=>e.spaces[2]};
|
|
795
|
+
background: ${({theme:e,isDraft:t})=>e.colors[t?"secondary600":"success600"]};
|
|
796
|
+
border-radius: 50%;
|
|
797
|
+
cursor: pointer;
|
|
798
|
+
`,Jn=e=>{const{formatMessage:t}=(0,A.useIntl)(),n=Kt.components.Option,s=(0,B.has)((0,B.get)(e,"data.value"),"publishedAt"),a=(0,B.isEmpty)((0,B.get)(e,"data.value.publishedAt"));if(s&&s){const l={id:v("components.Select.draft-info-title"),defaultMessage:"State: Draft"},i={id:v("components.Select.publish-info-title"),defaultMessage:"State: Published"},u=t(a?l:i);return r.createElement(n,zs({},e),r.createElement(j.Flex,null,r.createElement(hf,{title:u,isDraft:a}),r.createElement(L.Typography,{ellipsis:!0},e.label||"-")))}return r.createElement(n,zs({},e),e.label||"-")};Jn.defaultProps={label:""},Jn.propTypes={label:o().oneOfType([o().string,o().number]),isFocused:o().bool.isRequired,selectProps:o().shape({hasDraftAndPublish:o().bool,mainField:o().shape({name:o().string.isRequired,schema:o().shape({type:o().string.isRequired}).isRequired}).isRequired}).isRequired};const bf=Jn;var Ef=Object.defineProperty,Us=Object.getOwnPropertySymbols,vf=Object.prototype.hasOwnProperty,Cf=Object.prototype.propertyIsEnumerable,Hs=(e,t,n)=>t in e?Ef(e,t,{enumerable:!0,configurable:!0,writable:!0,value:n}):e[t]=n,Gs=(e,t)=>{for(var n in t||(t={}))vf.call(t,n)&&Hs(e,n,t[n]);if(Us)for(var n of Us(t))Cf.call(t,n)&&Hs(e,n,t[n]);return e};function Of(e,t){return function(n){const s=t(n);return r.createElement(e,Gs(Gs({},n),s))}}const Pf=Of;function Rf({isUserAllowedToEditField:e,isUserAllowedToReadField:t,name:n}){const{isCreatingEntry:s,createActionAllowedFields:a,readActionAllowedFields:l,updateActionAllowedFields:i}=(0,g.useCMEditViewDataManager)(),u=(0,r.useMemo)(()=>e===!0?!0:(s?a:i).includes(n),[s,a,n,e,i]),c=(0,r.useMemo)(()=>t?!0:(s?[]:l).includes(n),[s,t,n,l]);return{isCreatingEntry:s,isFieldAllowed:u,isFieldReadable:c}}const Mf=Rf;var Tf=Object.defineProperty,wf=Object.defineProperties,If=Object.getOwnPropertyDescriptors,Zs=Object.getOwnPropertySymbols,Df=Object.prototype.hasOwnProperty,xf=Object.prototype.propertyIsEnumerable,_s=(e,t,n)=>t in e?Tf(e,t,{enumerable:!0,configurable:!0,writable:!0,value:n}):e[t]=n,Xn=(e,t)=>{for(var n in t||(t={}))Df.call(t,n)&&_s(e,n,t[n]);if(Zs)for(var n of Zs(t))xf.call(t,n)&&_s(e,n,t[n]);return e},er=(e,t)=>wf(e,If(t)),Sf=(e,t,n)=>new Promise((s,a)=>{var l=c=>{try{u(n.next(c))}catch(d){a(d)}},i=c=>{try{u(n.throw(c))}catch(d){a(d)}},u=c=>c.done?s(c.value):Promise.resolve(c.value).then(l,i);u((n=n.apply(e,t)).next())});const Qs={contains:"",limit:20,start:0},Lf=(e,t)=>t?t.reduce((n,s)=>{const a=R()(e,s,null);return a&&ne()(n,s,a),n},{}):{};function tr({description:e,editable:t,labelAction:n,intlLabel:s,isCreatingEntry:a,isFieldAllowed:l,isFieldReadable:i,mainField:u,name:c,relationType:d,targetModel:m,placeholder:f,queryInfos:y}){const{formatMessage:h}=(0,A.useIntl)(),[{query:b}]=(0,g.useQueryParams)(),E=(0,r.useMemo)(()=>d.toLowerCase().includes("morph"),[d]),{addRelation:O,modifiedData:x,moveRelation:C,onChange:S,onRemoveRelation:I}=(0,g.useCMEditViewDataManager)(),{pathname:V}=(0,ee.useLocation)(),w=R()(x,c,null),[W,U]=(0,r.useState)(Qs),[G,N]=(0,r.useState)([]),[H,F]=(0,r.useState)(!1),[K,$]=(0,r.useState)(!1),Y=(0,r.useMemo)(()=>G.filter(Ce=>Re()(w)?!0:Array.isArray(w)?Wm()(w,$e=>$e.id===Ce.value.id)===-1:R()(w,"id","")!==Ce.value.id),[G,w]),{endPoint:M,containsKey:q,defaultParams:Z,shouldDisplayRelationLink:_,paramsToKeep:T}=y,P=["oneWay","oneToOne","manyToOne","oneToManyMorph","oneToOneMorph"].includes(d),Q=(0,r.useMemo)(()=>w?P?[w.id]:w.map(Ce=>Ce.id):[],[P,w]),re=(0,r.useCallback)(Ce=>Sf(this,null,function*(){if(E){F(!1);return}if(!l){F(!1);return}F(!0);const $e=er(Xn({limit:W.limit},Z),{start:W.start});W.contains&&($e[`filters[${q}][$contains]`]=W.contains);try{const{data:Ke}=yield ge.be.post(M,{idsToOmit:Q},{params:$e,cancelToken:Ce.token}),Xr=Ke.map(Ye=>({value:Ye,label:Ye[u.name]}));N(Ye=>Ye.concat(Xr).filter((fn,eo)=>Ye.findIndex(J=>J.value.id===fn.value.id)===-1?!0:Ye.findIndex(J=>J.value.id===fn.value.id)===eo)),F(!1)}catch(Ke){F(!1)}}),[q,Z,M,Q,l,E,u.name,W.contains,W.limit,W.start]);(0,r.useEffect)(()=>{const $e=Se().CancelToken.source();return K&&re($e),()=>$e.cancel("Operation canceled by the user.")},[re,K]);const ce=(Ce,{action:$e})=>($e==="input-change"&&U(Ke=>Ke.contains===Ce?Ke:er(Xn({},Ke),{contains:Ce,start:0})),Ce),me=()=>{U(Ce=>er(Xn({},Ce),{start:Ce.start+20}))},Fe=()=>{U(Qs),$(!1)},rt=Ce=>{S({target:{name:c,value:Ce&&Ce.value}})},z=Ce=>{Re()(Ce)||O({target:{name:c,value:Ce}})},de=()=>{$(!0)},je=`/content-manager/collectionType/${m}/${w?w.id:null}`,He=(0,Ne.stringify)(Lf(b,T),{encode:!1});let ht=null;P&&w&&_&&(ht=r.createElement(g.Link,{to:{pathname:je,state:{from:V},search:He}},h({id:v("containers.Edit.seeDetails"),defaultMessage:"Details"})));const Qe=P?uf:mf,Yr=Fs()(w)?w.length:0,Jr=(0,r.useMemo)(()=>E?!0:a?!t:!l&&i||!t,[E,a,t,l,i]);return!l&&a?r.createElement(g.NotAllowedInput,{intlLabel:s,labelAction:n}):!a&&!l&&!i?r.createElement(g.NotAllowedInput,{intlLabel:s,labelAction:n}):r.createElement(se.Stack,{spacing:1},r.createElement(Zm,{intlLabel:s,isSingle:P,labelAction:n,link:ht,name:c,numberOfEntries:Yr}),r.createElement(Qe,{addRelation:z,components:{Option:bf},displayNavigationLink:_,id:c,isDisabled:Jr,isLoading:H,isClearable:!0,mainField:u,move:C,name:c,options:Y,onChange:rt,onInputChange:ce,onMenuClose:Fe,onMenuOpen:de,onMenuScrollToBottom:me,onRemove:I,placeholder:f,searchToPersist:He,targetModel:m,value:w,description:e}))}tr.defaultProps={editable:!0,description:"",labelAction:null,isFieldAllowed:!0,placeholder:null},tr.propTypes={editable:o().bool,description:o().string,intlLabel:o().shape({id:o().string.isRequired,defaultMessage:o().string.isRequired,values:o().object}).isRequired,labelAction:o().element,isCreatingEntry:o().bool.isRequired,isFieldAllowed:o().bool,isFieldReadable:o().bool.isRequired,mainField:o().shape({name:o().string.isRequired,schema:o().shape({type:o().string.isRequired}).isRequired}).isRequired,name:o().string.isRequired,placeholder:o().shape({id:o().string.isRequired,defaultMessage:o().string.isRequired,values:o().object}),relationType:o().string.isRequired,targetModel:o().string.isRequired,queryInfos:o().shape({containsKey:o().string.isRequired,defaultParams:o().object,endPoint:o().string.isRequired,shouldDisplayRelationLink:o().bool.isRequired,paramsToKeep:o().array}).isRequired};const Ff=(0,r.memo)(tr),Ks=Pf(Ff,Mf);var kf=Object.defineProperty,Ys=Object.getOwnPropertySymbols,Af=Object.prototype.hasOwnProperty,jf=Object.prototype.propertyIsEnumerable,Js=(e,t,n)=>t in e?kf(e,t,{enumerable:!0,configurable:!0,writable:!0,value:n}):e[t]=n,Xs=(e,t)=>{for(var n in t||(t={}))Af.call(t,n)&&Js(e,n,t[n]);if(Ys)for(var n of Ys(t))jf.call(t,n)&&Js(e,n,t[n]);return e};function $f(e,t){return function(n){const s=t(n.keys);return r.createElement(e,Xs(Xs({},n),s))}}const Bf=$f,Nf=(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}))],Vf=(e="")=>{switch((0,B.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"}},qf=e=>{let t;return e==="float"||e==="decimal"?t=.01:t=1,t};function Wf(e){const{createActionAllowedFields:t,formErrors:n,isCreatingEntry:s,modifiedData:a,onChange:l,readActionAllowedFields:i,shouldNotRunValidations:u,updateActionAllowedFields:c}=(0,g.useCMEditViewDataManager)(),d=(0,r.useMemo)(()=>s?t:c,[s,t,c]),m=(0,r.useMemo)(()=>s?[]:i,[s,i]),f=(0,B.get)(a,e,null);return{allowedFields:d,formErrors:n,isCreatingEntry:s,onChange:l,readableFields:m,shouldNotRunValidations:u,value:f}}const zf=Wf,ea=["type","model","via","collection","default","plugin","enum","regex","pluginOptions"];var Uf=Object.defineProperty,Hf=Object.defineProperties,Gf=Object.getOwnPropertyDescriptors,ta=Object.getOwnPropertySymbols,Zf=Object.prototype.hasOwnProperty,_f=Object.prototype.propertyIsEnumerable,na=(e,t,n)=>t in e?Uf(e,t,{enumerable:!0,configurable:!0,writable:!0,value:n}):e[t]=n,nr=(e,t)=>{for(var n in t||(t={}))Zf.call(t,n)&&na(e,n,t[n]);if(ta)for(var n of ta(t))_f.call(t,n)&&na(e,n,t[n]);return e},Qf=(e,t)=>Hf(e,Gf(t));function rr({allowedFields:e,fieldSchema:t,formErrors:n,isCreatingEntry:s,keys:a,labelAction:l,metadatas:i,onChange:u,readableFields:c,shouldNotRunValidations:d,queryInfos:m,value:f}){const{fields:y}=(0,g.useLibrary)(),{formatMessage:h}=(0,A.useIntl)(),{contentType:b}=lt(),E=(0,r.useMemo)(()=>!R()(i,"editable",!0),[i]),O=t.type,x=R()(n,[a],null),C=(0,r.useMemo)(()=>Oo(a),[a]),S=(0,r.useMemo)(()=>{const Z=Od()(t,d?[...ea,"required","minLength"]:ea),_=t.regex||null;if(_){const T=new RegExp(_);T&&(Z.regex=T)}return Z},[t,d]),I=(0,r.useMemo)(()=>R()(S,["required"],!1),[S]),V=(0,r.useMemo)(()=>{const Z=R()(b,["attributes"],{});return R()(Z,[C[0],"type"],null)==="dynamiczone"},[b,C]),w=(0,r.useMemo)(()=>Vf(O),[O]),W=(0,r.useMemo)(()=>O==="media"&&!f?[]:f,[O,f]),U=(0,r.useMemo)(()=>qf(O),[O]),G=(0,r.useMemo)(()=>{const Z=C.join(".");if(e.includes(Z))return!0;if(V)return e.includes(C[0]);if(C.length>1){const T=Zt()(C,C.length-1).join(".");return e.includes(T)}return!1},[e,C,V]),N=(0,r.useMemo)(()=>{const Z=C.join(".");if(c.includes(Z))return!0;if(V)return c.includes(C[0]);if(C.length>1){const T=Zt()(C,C.length-1).join(".");return c.includes(T)}return!1},[c,C,V]),H=(0,r.useMemo)(()=>N||G,[G,N]),F=(0,r.useMemo)(()=>s?E:N&&!G?!0:E,[E,s,G,N]),K=(0,r.useMemo)(()=>Nf(t.enum||[],I),[t,I]),{label:$,description:Y,placeholder:M,visible:q}=i;return q===!1?null:H?O==="relation"?r.createElement(Ks,Qf(nr(nr({},i),t),{description:i.description?h({id:i.description,defaultMessage:i.description}):void 0,intlLabel:{id:i.label,defaultMessage:i.label},labelAction:l,isUserAllowedToEditField:G,isUserAllowedToReadField:N,name:a,placeholder:i.placeholder?{id:i.placeholder,defaultMessage:i.placeholder}:null,queryInfos:m,value:f,error:x&&h(x)})):r.createElement(g.GenericInput,{attribute:t,autoComplete:"new-password",intlLabel:{id:$,defaultMessage:$},isNullable:w==="bool"&&[null,void 0].includes(t.default),description:Y?{id:Y,defaultMessage:Y}:null,disabled:F,error:x,labelAction:l,contentTypeUID:b.uid,customInputs:nr({json:Rm,uid:Vm,media:y.media,wysiwyg:am},y),multiple:t.multiple||!1,name:a,onChange:u,options:K,placeholder:M?{id:M,defaultMessage:M}:null,required:t.required||!1,step:U,type:w,value:W,withDefaultValue:!1}):r.createElement(g.NotAllowedInput,{description:Y?{id:Y,defaultMessage:Y}:null,intlLabel:{id:$,defaultMessage:$},labelAction:l,error:x&&h(x),name:a,required:I})}rr.defaultProps={formErrors:{},labelAction:void 0,queryInfos:{},value:null},rr.propTypes={allowedFields:o().array.isRequired,fieldSchema:o().object.isRequired,formErrors:o().object,keys:o().string.isRequired,isCreatingEntry:o().bool.isRequired,labelAction:o().element,metadatas:o().object.isRequired,onChange:o().func.isRequired,readableFields:o().array.isRequired,shouldNotRunValidations:o().bool.isRequired,queryInfos:o().shape({containsKey:o().string,defaultParams:o().object,endPoint:o().string}),value:o().any};const Kf=(0,r.memo)(rr,We()),or=Bf(Kf,zf),sr=({componentUid:e,isFromDynamicZone:t,isNested:n,name:s})=>{const{getComponentLayout:a}=lt(),i=(0,r.useMemo)(()=>a(e),[e,a]).layouts.edit;return r.createElement(D.Box,{background:t?"":"neutral100",paddingLeft:6,paddingRight:6,paddingTop:6,paddingBottom:6,hasRadius:n,borderColor:n?"neutral200":""},r.createElement(se.Stack,{spacing:6},i.map((u,c)=>r.createElement(ie.Grid,{gap:4,key:c},u.map(({name:d,size:m,metadatas:f,fieldSchema:y,queryInfos:h})=>{const b=y.type==="component",E=`${s}.${d}`;if(b){const O=y.component;return r.createElement(ie.GridItem,{col:m,s:12,xs:12,key:d},r.createElement(Jt,{componentUid:O,intlLabel:{id:f.label,defaultMessage:f.label},isNested:!0,isRepeatable:y.repeatable,max:y.max,min:y.min,name:E,required:y.required||!1}))}return r.createElement(ie.GridItem,{col:m,key:d,s:12,xs:12},r.createElement(or,{keys:E,fieldSchema:y,metadatas:f,queryInfos:h}))})))))};sr.defaultProps={isFromDynamicZone:!1,isNested:!1},sr.propTypes={componentUid:o().string.isRequired,isFromDynamicZone:o().bool,isNested:o().bool,name:o().string.isRequired};const Yf=sr;var ra=p(74201),Jf=p(59290),ut=p.n(Jf),Xf=Object.defineProperty,oa=Object.getOwnPropertySymbols,eg=Object.prototype.hasOwnProperty,tg=Object.prototype.propertyIsEnumerable,sa=(e,t,n)=>t in e?Xf(e,t,{enumerable:!0,configurable:!0,writable:!0,value:n}):e[t]=n,aa=(e,t)=>{for(var n in t||(t={}))eg.call(t,n)&&sa(e,n,t[n]);if(oa)for(var n of oa(t))tg.call(t,n)&&sa(e,n,t[n]);return e};function ng(e,t){return function(n){const s=t(n);return r.createElement(e,aa(aa({},n),s))}}const rg=ng;function og(){const{addRepeatableComponentToField:e,formErrors:t}=(0,g.useCMEditViewDataManager)();return{addRepeatableComponentToField:e,formErrors:t}}const sg=og;function ag(e,t){return Object.keys(t).filter(n=>n.startsWith(e)).map(n=>n.split(".").slice(0,e.split(".").length+1).join("."))}var Yt=p(51968),ig=p(41119),ia=p.n(ig),ar=p(44826);const lg=k.default.span`
|
|
799
|
+
display: block;
|
|
800
|
+
background-color: ${({theme:e})=>e.colors.primary100};
|
|
801
|
+
outline: 1px dashed ${({theme:e})=>e.colors.primary500};
|
|
802
|
+
outline-offset: -1px;
|
|
803
|
+
padding: ${({theme:e})=>e.spaces[6]};
|
|
804
|
+
`,cg=()=>r.createElement(lg,{padding:6,background:"primary100"});var ug=p(78752);const dg=(0,k.default)(Me.IconButton)`
|
|
805
|
+
background-color: transparent;
|
|
806
|
+
|
|
807
|
+
svg {
|
|
808
|
+
path {
|
|
809
|
+
fill: ${({theme:e,expanded:t})=>t?e.colors.primary600:e.colors.neutral600};
|
|
810
|
+
}
|
|
811
|
+
}
|
|
812
|
+
|
|
813
|
+
&:hover {
|
|
814
|
+
svg {
|
|
815
|
+
path {
|
|
816
|
+
fill: ${({theme:e})=>e.colors.primary600};
|
|
817
|
+
}
|
|
818
|
+
}
|
|
819
|
+
}
|
|
820
|
+
`,la=(0,k.default)(Me.IconButton)`
|
|
821
|
+
background-color: transparent;
|
|
822
|
+
|
|
823
|
+
svg {
|
|
824
|
+
path {
|
|
825
|
+
fill: ${({theme:e,expanded:t})=>t?e.colors.primary600:e.colors.neutral600};
|
|
826
|
+
}
|
|
827
|
+
}
|
|
828
|
+
`,pg=k.default.span`
|
|
829
|
+
display: flex;
|
|
830
|
+
justify-content: space-between;
|
|
831
|
+
padding-left: ${({theme:e})=>e.spaces[4]};
|
|
832
|
+
padding-right: ${({theme:e})=>e.spaces[4]};
|
|
833
|
+
background-color: ${({theme:e})=>e.colors.neutral0};
|
|
834
|
+
height: ${50/16}rem;
|
|
835
|
+
`,mg=(0,k.default)(ra.TextButton)`
|
|
836
|
+
text-align: left;
|
|
837
|
+
|
|
838
|
+
svg {
|
|
839
|
+
width: ${14/16}rem;
|
|
840
|
+
height: ${14/16}rem;
|
|
841
|
+
|
|
842
|
+
path {
|
|
843
|
+
fill: ${({theme:e,expanded:t})=>t?e.colors.primary600:e.colors.neutral500};
|
|
844
|
+
}
|
|
845
|
+
}
|
|
846
|
+
`,ca=({displayedValue:e})=>r.createElement(pg,null,r.createElement(se.Stack,{horizontal:!0,spacing:3,flex:1},r.createElement(j.Flex,{justifyContent:"center",borderRadius:"50%",height:`${24/16}rem}`,width:`${24/16}rem}`,"aria-hidden":!0,as:"span",background:"neutral200"},r.createElement(ug.Icon,{as:ro(),width:`${8/16}rem}`,color:"neutral600"})),r.createElement(mg,{onClick:()=>{},flex:1},r.createElement(L.Typography,{fontWeight:"bold",textColor:"neutral700"},e))),r.createElement(se.Stack,{horizontal:!0,spacing:0},r.createElement(la,{noBorder:!0,onClick:()=>{},icon:r.createElement(Be(),null)}),r.createElement(la,{icon:r.createElement(et(),null),noBorder:!0})));ca.propTypes={displayedValue:o().string.isRequired};const fg=ca;var gg=Object.defineProperty,ua=Object.getOwnPropertySymbols,yg=Object.prototype.hasOwnProperty,hg=Object.prototype.propertyIsEnumerable,da=(e,t,n)=>t in e?gg(e,t,{enumerable:!0,configurable:!0,writable:!0,value:n}):e[t]=n,pa=(e,t)=>{for(var n in t||(t={}))yg.call(t,n)&&da(e,n,t[n]);if(ua)for(var n of ua(t))hg.call(t,n)&&da(e,n,t[n]);return e};function bg(e,t){return function(n){const s=t(n);return r.createElement(e,pa(pa({},n),s))}}const Eg=bg;function vg({schema:e,componentFieldName:t}){const{checkFormErrors:n,modifiedData:s,moveComponentField:a,removeRepeatableField:l,triggerFormValidation:i}=(0,g.useCMEditViewDataManager)(),u=(0,r.useMemo)(()=>(0,B.get)(e,["settings","mainField"],"id"),[e]);return{displayedValue:(0,B.toString)((0,B.get)(s,[...t.split("."),u],"")),mainField:u,checkFormErrors:n,moveComponentField:a,removeRepeatableField:l,schema:e,triggerFormValidation:i}}const Cg=vg,Og=k.default.span`
|
|
847
|
+
display: flex;
|
|
848
|
+
align-items: center;
|
|
849
|
+
height: ${({theme:e})=>e.spaces[7]};
|
|
850
|
+
|
|
851
|
+
padding: 0 ${({theme:e})=>e.spaces[3]};
|
|
852
|
+
cursor: all-scroll;
|
|
853
|
+
|
|
854
|
+
svg {
|
|
855
|
+
width: ${12/16}rem;
|
|
856
|
+
height: ${12/16}rem;
|
|
857
|
+
}
|
|
858
|
+
`,ir=({componentFieldName:e,hasErrorMessage:t,hasErrors:n,isDraggingSibling:s,isOpen:a,isReadOnly:l,onClickToggle:i,schema:u,toggleCollapses:c,moveComponentField:d,removeRepeatableField:m,setIsDraggingSibling:f,triggerFormValidation:y,displayedValue:h})=>{const b=(0,r.useRef)(null),E=(0,r.useRef)(null),[,O]=(0,r.useState)(!1),{formatMessage:x}=(0,A.useIntl)(),C=u.layouts.edit,[,S]=(0,Te.useDrop)({accept:Pe.COMPONENT,canDrop(){return!1},hover(N,H){if(!E.current)return;const F=N.originalPath,K=e,$=F.split("."),Y=$.slice().splice(-1).join(""),M=K.split(".").splice(-1).join(""),q=$.slice(0,$.length-1),Z=parseInt(Y,10),_=parseInt(M,10);if(Z===_)return;const T=E.current.getBoundingClientRect(),P=(T.bottom-T.top)/2,re=H.getClientOffset().y-T.top;Z<_&&re<P||Z>_&&re>P||F.split(".").length===K.split(".").length&&(d(q,Z,_),N.originalPath=K)}}),[{isDragging:I},V,w]=(0,Te.useDrag)({type:Pe.COMPONENT,item:()=>(c(-1),{displayedValue:h,originalPath:e}),end:()=>{y(),f(!1)},collect:N=>({isDragging:N.isDragging()})});(0,r.useEffect)(()=>{w((0,Yt.rX)(),{captureDraggingState:!1})},[w]),(0,r.useEffect)(()=>{I&&f(!0)},[I,f]),(0,r.useEffect)(()=>{s||O(N=>!N)},[s]);const W={dragRef:V(b),dropRef:S(E)},U=ia()(h),G=n?"error":void 0;return r.createElement(D.Box,{ref:W?W.dropRef:null},I&&r.createElement(cg,null),!I&&s&&r.createElement(fg,{displayedValue:U,componentFieldName:e}),!I&&!s&&r.createElement(ze.Accordion,{error:G,hasErrorMessage:t,expanded:a,onToggle:i,id:e,size:"S"},r.createElement(ze.AccordionToggle,{action:l?null:r.createElement(se.Stack,{horizontal:!0,spacing:0},r.createElement(dg,{expanded:a,noBorder:!0,onClick:()=>{m(e),c()},label:x({id:v("containers.Edit.delete"),defaultMessage:"Delete"}),icon:r.createElement(Be(),null)}),r.createElement(ar.Tooltip,{description:x({id:v("components.DragHandle-label"),defaultMessage:"Drag"})},r.createElement(Og,{role:"button",tabIndex:-1,ref:W.dragRef,onClick:N=>N.stopPropagation()},r.createElement(et(),null)))),title:U,togglePosition:"left"}),r.createElement(ze.AccordionContent,null,r.createElement(se.Stack,{background:"neutral100",padding:6,spacing:6},C.map((N,H)=>r.createElement(ie.Grid,{gap:4,key:H},N.map(({name:F,fieldSchema:K,metadatas:$,queryInfos:Y,size:M})=>{const q=K.type==="component",Z=`${e}.${F}`;if(q){const _=K.component;return r.createElement(ie.GridItem,{col:M,s:12,xs:12,key:F},r.createElement(Jt,{componentUid:_,intlLabel:{id:$.label,defaultMessage:$.label},isRepeatable:K.repeatable,isNested:!0,name:Z,max:K.max,min:K.min,required:K.required}))}return r.createElement(ie.GridItem,{key:Z,col:M,s:12,xs:12},r.createElement(or,{fieldSchema:K,keys:Z,metadatas:$,queryInfos:Y}))})))))))};ir.defaultProps={isDraggingSibling:!1,isOpen:!1,setIsDraggingSibling:()=>{},toggleCollapses:()=>{}},ir.propTypes={componentFieldName:o().string.isRequired,hasErrorMessage:o().bool.isRequired,hasErrors:o().bool.isRequired,isDraggingSibling:o().bool,isOpen:o().bool,isReadOnly:o().bool.isRequired,onClickToggle:o().func.isRequired,schema:o().object.isRequired,toggleCollapses:o().func,moveComponentField:o().func.isRequired,removeRepeatableField:o().func.isRequired,setIsDraggingSibling:o().func,triggerFormValidation:o().func.isRequired,displayedValue:o().string.isRequired};const Pg=(0,r.memo)(ir),Rg=Eg(Pg,Cg);var ma=p(87910),Mg=Object.defineProperty,fa=Object.getOwnPropertySymbols,Tg=Object.prototype.hasOwnProperty,wg=Object.prototype.propertyIsEnumerable,ga=(e,t,n)=>t in e?Mg(e,t,{enumerable:!0,configurable:!0,writable:!0,value:n}):e[t]=n,Ig=(e,t)=>{for(var n in t||(t={}))Tg.call(t,n)&&ga(e,n,t[n]);if(fa)for(var n of fa(t))wg.call(t,n)&&ga(e,n,t[n]);return e};const Dg=(0,k.default)(D.Box)`
|
|
859
|
+
overflow: hidden;
|
|
860
|
+
border-bottom: 1px solid ${({theme:e})=>e.colors.neutral200};
|
|
861
|
+
border-right: 1px solid ${({theme:e})=>e.colors.neutral200};
|
|
862
|
+
border-left: 1px solid ${({theme:e})=>e.colors.neutral200};
|
|
863
|
+
border-radius: 0 0 ${({theme:e})=>e.borderRadius} ${({theme:e})=>e.borderRadius};
|
|
864
|
+
`,xg=(0,k.default)(D.Box)`
|
|
865
|
+
> div {
|
|
866
|
+
& > * {
|
|
867
|
+
border-radius: unset;
|
|
868
|
+
border-right: 1px solid ${({theme:e})=>e.colors.neutral200};
|
|
869
|
+
border-left: 1px solid ${({theme:e})=>e.colors.neutral200};
|
|
870
|
+
border-bottom: 1px solid ${({theme:e})=>e.colors.neutral200};
|
|
871
|
+
}
|
|
872
|
+
> div {
|
|
873
|
+
> div:first-of-type {
|
|
874
|
+
border-radius: unset;
|
|
875
|
+
}
|
|
876
|
+
}
|
|
877
|
+
}
|
|
878
|
+
|
|
879
|
+
> div:first-of-type {
|
|
880
|
+
> div {
|
|
881
|
+
border-radius: ${({theme:e})=>e.borderRadius} ${({theme:e})=>e.borderRadius} 0 0;
|
|
882
|
+
> div:first-of-type {
|
|
883
|
+
border-radius: ${({theme:e})=>e.borderRadius} ${({theme:e})=>e.borderRadius} 0 0;
|
|
884
|
+
}
|
|
885
|
+
}
|
|
886
|
+
|
|
887
|
+
> div:not([data-strapi-expanded='true']) {
|
|
888
|
+
border-top: 1px solid ${({theme:e})=>e.colors.neutral200};
|
|
889
|
+
|
|
890
|
+
&:hover {
|
|
891
|
+
border-top: 1px solid ${({theme:e})=>e.colors.primary600};
|
|
892
|
+
}
|
|
893
|
+
}
|
|
894
|
+
|
|
895
|
+
> span {
|
|
896
|
+
border-radius: ${({theme:e})=>e.borderRadius} ${({theme:e})=>e.borderRadius} 0 0;
|
|
897
|
+
border-top: 1px solid ${({theme:e})=>e.colors.neutral200};
|
|
898
|
+
}
|
|
899
|
+
}
|
|
900
|
+
|
|
901
|
+
& [data-strapi-expanded='true'] {
|
|
902
|
+
border: 1px solid ${({theme:e})=>e.colors.primary600};
|
|
903
|
+
}
|
|
904
|
+
|
|
905
|
+
${({theme:e,footer:t})=>`
|
|
906
|
+
&:not(${t}) {
|
|
907
|
+
& > *:last-of-type {
|
|
908
|
+
border-radius: 0 0 ${e.borderRadius} ${e.borderRadius};
|
|
909
|
+
}
|
|
910
|
+
}
|
|
911
|
+
`}
|
|
912
|
+
`,Sg=(0,k.default)(D.Box)`
|
|
913
|
+
svg path {
|
|
914
|
+
fill: ${({theme:e})=>e.colors.neutral500};
|
|
915
|
+
}
|
|
916
|
+
`,lr=({children:e,footer:t,label:n,labelAction:s,error:a})=>{const{formatMessage:l}=(0,A.useIntl)(),i=r.Children.toArray(e).map(u=>(0,r.cloneElement)(u,{hasErrorMessage:!1}));return r.createElement(ma.KeyboardNavigable,{attributeName:"data-strapi-accordion-toggle"},n&&r.createElement(j.Flex,{paddingBottom:1},r.createElement(L.Typography,{as:"label",textColor:"neutral800",variant:"pi",fontWeight:"bold"},n),s&&r.createElement(Sg,{paddingLeft:1},s)),r.createElement(xg,{footer:t},i),t&&r.createElement(Dg,null,t),a&&r.createElement(D.Box,{paddingTop:1},r.createElement(L.Typography,{variant:"pi",textColor:"danger600"},l({id:a.id,defaultMessage:a.id},Ig({},a.values)))))};lr.defaultProps={error:void 0,footer:null,label:null,labelAction:void 0},lr.propTypes={children:o().node.isRequired,error:o().shape({id:o().string.isRequired,defaultMessage:o().string.isRequired,values:o().object}),footer:o().node,label:o().string,labelAction:o().node};const Lg=lr,Fg=(0,k.default)(ra.TextButton)`
|
|
917
|
+
height: 100%;
|
|
918
|
+
width: 100%;
|
|
919
|
+
border-radius: 0 0 4px 4px;
|
|
920
|
+
display: flex;
|
|
921
|
+
justify-content: center;
|
|
922
|
+
span {
|
|
923
|
+
font-weight: 600;
|
|
924
|
+
font-size: 14px;
|
|
925
|
+
}
|
|
926
|
+
`,cr=({addRepeatableComponentToField:e,formErrors:t,componentUid:n,componentValue:s,componentValueLength:a,isReadOnly:l,max:i,min:u,name:c})=>{const d=(0,g.useNotification)(),{formatMessage:m}=(0,A.useIntl)(),[f,y]=(0,r.useState)(""),[h,b]=(0,r.useState)(!1),[,E]=(0,Te.useDrop)({accept:Pe.COMPONENT}),{getComponentLayout:O}=lt(),x=(0,r.useMemo)(()=>O(n),[n,O]),C=(0,r.useMemo)(()=>Po(s||[])+1,[s]),S=ag(c,t),I=()=>{y("")},V=u-a,w=R()(t,c,{id:""}).id.includes("min"),W=(0,r.useCallback)(()=>{l||(a<i?(e(c,n,w),y(C)):a>=i&&d({type:"info",message:{id:v("components.notification.info.maximum-requirement")}}))},[e,n,a,w,l,i,c,C,d]);let U=t[c];return w&&(U={id:v("components.DynamicZone.missing-components"),defaultMessage:"There {number, plural, =0 {are # missing components} one {is # missing component} other {are # missing components}}",values:{number:V}}),a===0?r.createElement(as,{error:U,isReadOnly:l,onClick:W}):(S.some(N=>N.split(".").length>1)&&!w&&(U={id:v("components.RepeatableComponent.error-message"),defaultMessage:"The component(s) contain error(s)"}),r.createElement(D.Box,{hasRadius:!0,ref:E},r.createElement(Lg,{error:U,footer:r.createElement(j.Flex,{justifyContent:"center",height:"48px",background:"neutral0"},r.createElement(Fg,{disabled:l,onClick:W,startIcon:r.createElement(ut(),null)},m({id:v("containers.EditView.add.new-entry"),defaultMessage:"Add an entry"})))},s.map((N,H)=>{const F=N.__temp_key__,K=f===F,$=`${c}.${H}`,Y=S.includes($);return r.createElement(Rg,{componentFieldName:$,componentUid:n,hasErrors:Y,hasMinError:w,isDraggingSibling:h,isOpen:K,isReadOnly:l,key:F,onClickToggle:()=>{y(K?"":F)},parentName:c,schema:x,setIsDraggingSibling:b,toggleCollapses:I})}))))};cr.defaultProps={componentValue:null,componentValueLength:0,formErrors:{},max:1/0,min:0},cr.propTypes={addRepeatableComponentToField:o().func.isRequired,componentUid:o().string.isRequired,componentValue:o().oneOfType([o().array,o().object]),componentValueLength:o().number,formErrors:o().object,isReadOnly:o().bool.isRequired,max:o().number,min:o().number,name:o().string.isRequired};const kg=(0,r.memo)(cr),Ag=rg(kg,sg);var jg=Object.defineProperty,ya=Object.getOwnPropertySymbols,$g=Object.prototype.hasOwnProperty,Bg=Object.prototype.propertyIsEnumerable,ha=(e,t,n)=>t in e?jg(e,t,{enumerable:!0,configurable:!0,writable:!0,value:n}):e[t]=n,ba=(e,t)=>{for(var n in t||(t={}))$g.call(t,n)&&ha(e,n,t[n]);if(ya)for(var n of ya(t))Bg.call(t,n)&&ha(e,n,t[n]);return e};function Ng(e,t){return function(n){const s=t(n);return r.createElement(e,ba(ba({},n),s))}}const Vg=Ng;function qg({isFromDynamicZone:e,name:t}){const{addNonRepeatableComponentToField:n,createActionAllowedFields:s,isCreatingEntry:a,modifiedData:l,removeComponentFromField:i,readActionAllowedFields:u,updateActionAllowedFields:c,formErrors:d}=(0,g.useCMEditViewDataManager)(),{contentType:m}=lt(),f=(0,r.useMemo)(()=>{const C=(0,B.get)(m,["attributes"],{});return Object.keys(C).filter(I=>(0,B.get)(C,[I,"type"],"")==="dynamiczone")},[m]),y=(0,r.useMemo)(()=>a?s:c,[a,s,c]),h=(0,B.get)(l,t,null),b=(0,r.useMemo)(()=>Oo(t),[t]),E=(0,r.useMemo)(()=>e&&a||y.filter(I=>I===b[0]).length>0?!0:y.map(I=>I.split(".")).filter(I=>I.length<b.length?!1:(0,B.take)(I,b.length).join(".")===b.join(".")).length>0,[e,a,y,b]),O=(0,r.useMemo)(()=>e||f.includes(b[0])?!0:(a?[]:u).map(I=>I.split(".")).filter(I=>I.length<b.length?!1:(0,B.take)(I,b.length).join(".")===b.join(".")).length>0,[e,f,b,a,u]),x=(0,r.useMemo)(()=>a||E?!1:O,[E,O,a]);return{addNonRepeatableComponentToField:n,formErrors:d,hasChildrenAllowedFields:E,hasChildrenReadableFields:O,isCreatingEntry:a,isReadOnly:x,removeComponentFromField:i,componentValue:h}}const Wg=qg,zg=(0,k.default)(D.Box)`
|
|
927
|
+
svg path {
|
|
928
|
+
fill: ${({theme:e})=>e.colors.neutral500};
|
|
929
|
+
}
|
|
930
|
+
`,ur=({intlLabel:e,id:t,labelAction:n,name:s,numberOfEntries:a,showNumberOfEntries:l,required:i})=>{const{formatMessage:u}=(0,A.useIntl)(),c=e!=null&&e.id?u(e):s;return r.createElement(D.Box,{paddingBottom:1},r.createElement(j.Flex,null,r.createElement(L.Typography,{textColor:"neutral800",htmlFor:t||s,variant:"pi",fontWeight:"bold",as:"label"},c,l&&r.createElement(r.Fragment,null,"\xA0(",a,")"),i&&r.createElement(L.Typography,{textColor:"danger600"},"*")),n&&r.createElement(zg,{paddingLeft:1},n)))};ur.defaultProps={id:void 0,labelAction:void 0,numberOfEntries:0,required:!1,showNumberOfEntries:!1},ur.propTypes={id:o().string,intlLabel:o().shape({id:o().string.isRequired,defaultMessage:o().string.isRequired,values:o().object}).isRequired,labelAction:o().element,name:o().string.isRequired,numberOfEntries:o().number,required:o().bool,showNumberOfEntries:o().bool};const Ug=ur,dr=({addNonRepeatableComponentToField:e,componentUid:t,intlLabel:n,isCreatingEntry:s,isFromDynamicZone:a,isRepeatable:l,isNested:i,labelAction:u,max:c,min:d,name:m,hasChildrenAllowedFields:f,hasChildrenReadableFields:y,isReadOnly:h,componentValue:b,removeComponentFromField:E,required:O})=>{const{formatMessage:x}=(0,A.useIntl)(),C=gd()(b),S=b!==null||a,I=!l&&S&&!a&&f;if(!f&&s)return r.createElement(g.NotAllowedInput,{labelAction:u,intlLabel:n,name:m});if(!f&&!s&&!y)return r.createElement(g.NotAllowedInput,{labelAction:u,intlLabel:n,name:m});const V=()=>{e(m,t)};return r.createElement(D.Box,null,r.createElement(j.Flex,{justifyContent:"space-between"},n&&r.createElement(Ug,{intlLabel:n,labelAction:u,name:m,numberOfEntries:C,showNumberOfEntries:l,required:O}),I&&r.createElement(Me.IconButton,{label:x({id:v("components.reset-entry"),defaultMessage:"Reset Entry"}),icon:r.createElement(Be(),null),noBorder:!0,onClick:()=>{E(m,t)}})),r.createElement(se.Stack,{spacing:1},!l&&!S&&r.createElement(as,{isReadOnly:h,onClick:V}),!l&&S&&r.createElement(Yf,{componentUid:t,isFromDynamicZone:a,isNested:i,name:m}),l&&r.createElement(Ag,{componentValue:b,componentValueLength:C,componentUid:t,isReadOnly:h,max:c,min:d,name:m})))};dr.defaultProps={componentValue:null,hasChildrenAllowedFields:!1,hasChildrenReadableFields:!1,intlLabel:void 0,isFromDynamicZone:!1,isReadOnly:!1,isRepeatable:!1,isNested:!1,labelAction:void 0,max:1/0,min:-1/0,required:!1},dr.propTypes={addNonRepeatableComponentToField:o().func.isRequired,componentUid:o().string.isRequired,componentValue:o().oneOfType([o().object,o().array]),hasChildrenAllowedFields:o().bool,hasChildrenReadableFields:o().bool,isCreatingEntry:o().bool.isRequired,isFromDynamicZone:o().bool,isReadOnly:o().bool,isRepeatable:o().bool,isNested:o().bool,intlLabel:o().shape({id:o().string.isRequired,defaultMessage:o().string.isRequired,values:o().object}),labelAction:o().element,max:o().number,min:o().number,name:o().string.isRequired,removeComponentFromField:o().func.isRequired,required:o().bool};const Hg=(0,r.memo)(dr,We()),Jt=Vg(Hg,Wg),Gg=(0,k.default)(D.Box)`
|
|
931
|
+
width: ${({theme:e})=>e.spaces[2]};
|
|
932
|
+
height: ${({theme:e})=>e.spaces[4]};
|
|
933
|
+
`,Zg=()=>r.createElement(j.Flex,{justifyContent:"center"},r.createElement(Gg,{background:"neutral200"})),_g=(0,k.default)(se.Stack)`
|
|
934
|
+
svg {
|
|
935
|
+
path {
|
|
936
|
+
fill: ${({theme:e,expanded:t})=>t?e.colors.primary600:e.colors.neutral600};
|
|
937
|
+
}
|
|
938
|
+
}
|
|
939
|
+
`,pr=(0,k.default)(Me.IconButton)`
|
|
940
|
+
background-color: transparent;
|
|
941
|
+
`,Qg=(0,k.default)(D.Box)`
|
|
942
|
+
> div:first-child {
|
|
943
|
+
box-shadow: ${({theme:e})=>e.shadows.tableShadow};
|
|
944
|
+
}
|
|
945
|
+
`,Kg=(0,k.default)(D.Box)`
|
|
946
|
+
border-radius: 0 0 ${({theme:e})=>e.spaces[1]} ${({theme:e})=>e.spaces[1]};
|
|
947
|
+
`,Ea=({componentUid:e,formErrors:t,index:n,isOpen:s,isFieldAllowed:a,moveComponentDown:l,moveComponentUp:i,name:u,onToggle:c,removeComponentFromDynamicZone:d,showDownIcon:m,showUpIcon:f})=>{const{formatMessage:y}=(0,A.useIntl)(),{getComponentLayout:h}=lt(),{icon:b,friendlyName:E}=(0,r.useMemo)(()=>{const{info:{icon:G,displayName:N}}=h(e);return{friendlyName:N,icon:G}},[e,h]),O=()=>l(u,n),x=()=>i(u,n),C=()=>d(u,n),S=y({id:v("components.DynamicZone.move-down-label"),defaultMessage:"Move component down"}),I=y({id:v("components.DynamicZone.move-up-label"),defaultMessage:"Move component down"}),V=y({id:v("components.DynamicZone.delete-label"),defaultMessage:"Delete {name}"},{name:E}),W=Object.keys(t).filter(G=>{const N=G.split(".");return`${N[0]}.${N[1]}`==`${u}.${n}`});let U;return W.length>0&&(U=y({id:v("components.DynamicZone.error-message"),defaultMessage:"The component contains error(s)"})),r.createElement(D.Box,null,r.createElement(Zg,null),r.createElement(Qg,{hasRadius:!0},r.createElement(ze.Accordion,{expanded:s,onToggle:()=>c(n),size:"S",error:U},r.createElement(ze.AccordionToggle,{startIcon:r.createElement(xn.G,{icon:b}),action:r.createElement(_g,{horizontal:!0,spacing:0,expanded:s},m&&r.createElement(pr,{noBorder:!0,label:S,onClick:O,icon:r.createElement(dd(),null)}),f&&r.createElement(pr,{noBorder:!0,label:I,onClick:x,icon:r.createElement(md(),null)}),a&&r.createElement(pr,{noBorder:!0,label:V,onClick:C,icon:r.createElement(Be(),null)})),title:E,togglePosition:"left"}),r.createElement(ze.AccordionContent,null,r.createElement(Kg,{background:"neutral0"},r.createElement(Sn.FocusTrap,{onEscape:()=>c(n)},r.createElement(Jt,{componentUid:e,icon:b,name:`${u}.${n}`,isFromDynamicZone:!0})))))))};Ea.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 Yg=(0,r.memo)(Ea,We());var Jg=p(81346),Xg=p.n(Jg);const va=(0,k.default)(xn.G)`
|
|
948
|
+
width: ${(0,g.pxToRem)(32)} !important;
|
|
949
|
+
height: ${(0,g.pxToRem)(32)} !important;
|
|
950
|
+
padding: ${(0,g.pxToRem)(9)};
|
|
951
|
+
border-radius: ${(0,g.pxToRem)(64)};
|
|
952
|
+
background: ${({theme:e})=>e.colors.neutral150};
|
|
953
|
+
path {
|
|
954
|
+
fill: ${({theme:e})=>e.colors.neutral500};
|
|
955
|
+
}
|
|
956
|
+
`,ey=(0,k.default)(D.Box)`
|
|
957
|
+
flex-shrink: 0;
|
|
958
|
+
height: ${(0,g.pxToRem)(84)};
|
|
959
|
+
border: 1px solid ${({theme:e})=>e.colors.neutral200};
|
|
960
|
+
background: ${({theme:e})=>e.colors.neutral100};
|
|
961
|
+
border-radius: ${({theme:e})=>e.borderRadius};
|
|
962
|
+
display: flex;
|
|
963
|
+
justify-content: center;
|
|
964
|
+
align-items: center;
|
|
965
|
+
|
|
966
|
+
&.active,
|
|
967
|
+
&:hover {
|
|
968
|
+
border: 1px solid ${({theme:e})=>e.colors.primary200};
|
|
969
|
+
background: ${({theme:e})=>e.colors.primary100};
|
|
970
|
+
|
|
971
|
+
${va} {
|
|
972
|
+
background: ${({theme:e})=>e.colors.primary200};
|
|
973
|
+
path {
|
|
974
|
+
fill: ${({theme:e})=>e.colors.primary600};
|
|
975
|
+
}
|
|
976
|
+
}
|
|
977
|
+
|
|
978
|
+
${L.Typography} {
|
|
979
|
+
color: ${({theme:e})=>e.colors.primary600};
|
|
980
|
+
}
|
|
981
|
+
}
|
|
982
|
+
`;function mr({componentUid:e,intlLabel:t,icon:n,onClick:s}){const{formatMessage:a}=(0,A.useIntl)(),l=()=>{s(e)};return r.createElement("button",{type:"button",onClick:l},r.createElement(ey,{borderRadius:"borderRadius"},r.createElement(se.Stack,{spacing:1,style:{justifyContent:"center",alignItems:"center"}},r.createElement(va,{icon:n}),r.createElement(L.Typography,{variant:"pi",fontWeight:"bold",textColor:"neutral600"},a(t)))))}mr.defaultProps={icon:"dice-d6",onClick:()=>{}},mr.propTypes={componentUid:o().string.isRequired,intlLabel:o().shape({id:o().string.isRequired,defaultMessage:o().string.isRequired}).isRequired,icon:o().string,onClick:o().func};const ty=mr,ny=k.default.div`
|
|
983
|
+
display: grid;
|
|
984
|
+
grid-template-columns: repeat(auto-fit, ${140/16}rem);
|
|
985
|
+
grid-gap: ${({theme:e})=>e.spaces[1]};
|
|
986
|
+
`,Ca=({category:e,components:t,isOdd:n,isOpen:s,onAddComponent:a,onToggle:l})=>{const{formatMessage:i}=(0,A.useIntl)(),u=()=>{l(e)};return r.createElement(ze.Accordion,{expanded:s,onToggle:u,size:"S"},r.createElement(ze.AccordionToggle,{variant:n?"primary":"secondary",title:i({id:e,defaultMessage:e}),togglePosition:"left"}),r.createElement(ze.AccordionContent,null,r.createElement(D.Box,{paddingTop:4,paddingBottom:4,paddingLeft:3,paddingRight:3},r.createElement(ny,null,t.map(({componentUid:c,info:{displayName:d,icon:m}})=>r.createElement(ty,{key:c,componentUid:c,intlLabel:{id:d,defaultMessage:d},icon:m,onClick:a}))))))};Ca.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 ry=Ca,Oa=({components:e,isOpen:t,onClickAddComponent:n})=>{const{formatMessage:s}=(0,A.useIntl)(),{getComponentLayout:a}=lt(),[l,i]=(0,r.useState)(""),u=(0,r.useMemo)(()=>{const m=e.map(y=>{const{category:h,info:b}=a(y);return{componentUid:y,category:h,info:b}}),f=Xg()(m,"category");return Object.keys(f).reduce((y,h)=>(y.push({category:h,components:f[h]}),y),[])},[e,a]);(0,r.useEffect)(()=>{t&&u.length&&i(u[0].category)},[t,u]);const c=(0,r.useCallback)(m=>{n(m),i("")},[n]),d=(0,r.useCallback)(m=>{i(l===m?"":m)},[l]);return t?r.createElement(D.Box,{paddingBottom:6},r.createElement(D.Box,{paddingTop:6,paddingBottom:6,paddingLeft:5,paddingRight:5,background:"neutral0",shadow:"tableShadow",borderColor:"neutral150",hasRadius:!0},r.createElement(j.Flex,{justifyContent:"center"},r.createElement(L.Typography,{fontWeight:"bold",textColor:"neutral600"},s({id:v("components.DynamicZone.ComponentPicker-label"),defaultMessage:"Pick one component"}))),r.createElement(D.Box,{paddingTop:2},r.createElement(ma.KeyboardNavigable,{attributeName:"data-strapi-accordion-toggle"},u.map(({category:m,components:f},y)=>r.createElement(ry,{key:m,category:m,components:f,isOdd:y%2===1,isOpen:m===l,onAddComponent:c,onToggle:d})))))):null};Oa.propTypes={components:o().array.isRequired,isOpen:o().bool.isRequired,onClickAddComponent:o().func.isRequired};const oy=(0,r.memo)(Oa);var sy=Object.defineProperty,ay=Object.defineProperties,iy=Object.getOwnPropertyDescriptors,Pa=Object.getOwnPropertySymbols,ly=Object.prototype.hasOwnProperty,cy=Object.prototype.propertyIsEnumerable,Ra=(e,t,n)=>t in e?sy(e,t,{enumerable:!0,configurable:!0,writable:!0,value:n}):e[t]=n,uy=(e,t)=>{for(var n in t||(t={}))ly.call(t,n)&&Ra(e,n,t[n]);if(Pa)for(var n of Pa(t))cy.call(t,n)&&Ra(e,n,t[n]);return e},dy=(e,t)=>ay(e,iy(t));const Ma=e=>Array.from({length:e}).map(()=>({isOpen:!1})),fr=({name:e,addComponentToDynamicZone:t,formErrors:n,isCreatingEntry:s,isFieldAllowed:a,isFieldReadable:l,labelAction:i,moveComponentUp:u,moveComponentDown:c,removeComponentFromDynamicZone:d,dynamicDisplayedComponents:m,fieldSchema:f,metadatas:y})=>{const h=(0,g.useNotification)(),[b,E]=(0,r.useState)(!1),[O,x]=(0,r.useState)(!1),C=m.length,S=y.description?{id:y.description,defaultMessage:y.description}:null,[I,V]=(0,r.useState)(Ma(C));(0,r.useEffect)(()=>{V(Ma(C))},[C]),(0,r.useEffect)(()=>{O&&(V(T=>T.map((P,Q)=>Q===T.length-1?dy(uy({},P),{isOpen:!0}):P)),x(!1))},[O]);const{max:w=1/0,min:W=-1/0}=f,U=(0,r.useMemo)(()=>Object.keys(n).filter(T=>T===e).map(T=>n[T]),[n,e]),G=(0,r.useMemo)(()=>f.components||[],[f]),N=W-C,H=U.length>0,F=U.length>0&&R()(U,[0,"id"],"").includes("min"),K=H&&R()(U,[0,"id"],"")==="components.Input.error.validation.max",$=(0,r.useCallback)(T=>{E(!1),t(e,T,H),x(!0)},[t,H,e]),Y=()=>{C<w?E(T=>!T):h({type:"info",message:{id:v("components.notification.info.maximum-requirement")}})},M=T=>{V(P=>P.map(({isOpen:Q},re)=>re===T?{isOpen:!Q}:{isOpen:Q}))},q=(T,P)=>{c(T,P),V(Q=>Q.map(({isOpen:re},ce,me)=>ce===P+1?{isOpen:me[P].isOpen}:ce===P?{isOpen:me[ce+1].isOpen}:{isOpen:re}))},Z=(T,P)=>{u(T,P),V(Q=>Q.map(({isOpen:re},ce,me)=>ce===P-1?{isOpen:me[P].isOpen}:ce===P?{isOpen:me[ce-1].isOpen}:{isOpen:re}))},_=(T,P)=>{d(T,P)};return!a&&s?r.createElement(g.NotAllowedInput,{description:S,intlLabel:{id:y.label,defaultMessage:y.label},labelAction:i,name:e}):!a&&!l&&!s?r.createElement(g.NotAllowedInput,{description:S,intlLabel:{id:y.label,defaultMessage:y.label},labelAction:i,name:e}):r.createElement(se.Stack,{spacing:6},C>0&&r.createElement(D.Box,null,r.createElement(cd,{intlDescription:S,label:y.label,labelAction:i,name:e,numberOfComponents:C,required:f.required||!1}),m.map((T,P)=>{var Q;const re=a&&C>0&&P<C-1,ce=a&&C>0&&P>0,me=((Q=I[P])==null?void 0:Q.isOpen)||!1;return r.createElement(Yg,{componentUid:T,formErrors:n,key:P,index:P,isOpen:me,isFieldAllowed:a,moveComponentDown:q,moveComponentUp:Z,onToggle:M,name:e,removeComponentFromDynamicZone:_,showDownIcon:re,showUpIcon:ce})})),r.createElement(id,{hasError:H,hasMaxError:K,hasMinError:F,isDisabled:!a,label:y.label,missingComponentNumber:N,isOpen:b,name:e,onClick:Y}),r.createElement(oy,{isOpen:b,components:G,onClickAddComponent:$}))};fr.defaultProps={dynamicDisplayedComponents:[],fieldSchema:{max:1/0,min:-1/0},labelAction:null},fr.propTypes={addComponentToDynamicZone:o().func.isRequired,dynamicDisplayedComponents:o().array,fieldSchema:o().shape({components:o().array.isRequired,max:o().number,min:o().number,required:o().bool}),formErrors:o().object.isRequired,isCreatingEntry:o().bool.isRequired,isFieldAllowed:o().bool.isRequired,isFieldReadable:o().bool.isRequired,labelAction:o().element,metadatas:o().shape({description:o().string,label:o().string}).isRequired,moveComponentUp:o().func.isRequired,moveComponentDown:o().func.isRequired,name:o().string.isRequired,removeComponentFromDynamicZone:o().func.isRequired};const py=(0,r.memo)(fr,We()),my=td(py,rd);var tt=p(41578);const Xt=()=>({type:tt.ZA}),gr=e=>({type:tt.Id,data:e}),yr=(e,t=!1)=>({type:tt.TP,rawQuery:e,isSingleType:t}),Ta=()=>({type:tt.c2}),wa=(e,t)=>({type:tt.w7,componentsDataStructure:e,contentTypeDataStructure:t}),he=e=>({type:tt.d0,status:e}),Ze=e=>({type:tt.t9,data:e}),Ia=e=>e["content-manager_editViewCrudReducer"];var fy=p(98399),gy=Object.defineProperty,Da=Object.getOwnPropertySymbols,yy=Object.prototype.hasOwnProperty,hy=Object.prototype.propertyIsEnumerable,xa=(e,t,n)=>t in e?gy(e,t,{enumerable:!0,configurable:!0,writable:!0,value:n}):e[t]=n,by=(e,t)=>{for(var n in t||(t={}))yy.call(t,n)&&xa(e,n,t[n]);if(Da)for(var n of Da(t))hy.call(t,n)&&xa(e,n,t[n]);return e},nt=(e,t,n)=>new Promise((s,a)=>{var l=c=>{try{u(n.next(c))}catch(d){a(d)}},i=c=>{try{u(n.throw(c))}catch(d){a(d)}},u=c=>c.done?s(c.value):Promise.resolve(c.value).then(l,i);u((n=n.apply(e,t)).next())});const hr=({allLayoutData:e,children:t,slug:n,id:s,origin:a})=>{const l=(0,g.useNotification)(),{setCurrentStep:i}=(0,g.useGuidedTour)(),{trackUsage:u}=(0,g.useTracking)(),{push:c,replace:d}=(0,ee.useHistory)(),[{rawQuery:m}]=(0,g.useQueryParams)(),f=(0,fe.useDispatch)(),{componentsDataStructure:y,contentTypeDataStructure:h,data:b,isLoading:E,status:O}=(0,fe.useSelector)(Ia),x=Uo(n),C=(0,r.useRef)(!0),S=(0,r.useRef)(u),I=(0,r.useRef)(e),V=s===null,w=(0,r.useMemo)(()=>V&&!a?null:ve(`collection-types/${n}/${a||s}`),[n,s,V,a]),W=(0,r.useCallback)(M=>a?(0,g.contentManagementUtilRemoveFieldsFromData)(M,I.current.contentType,I.current.components):M,[a]),U=(0,r.useCallback)(M=>{const q=Do(M,I.current.contentType,I.current.components);return(0,g.formatContentTypeData)(q,I.current.contentType,I.current.components)},[]);(0,r.useEffect)(()=>{const M=Object.keys(e.components).reduce((_,T)=>{const P=$t(R()(e,["components",T,"attributes"],{}),e.components);return _[T]=(0,g.formatContentTypeData)(P,e.components[T],e.components),_},{}),q=$t(e.contentType.attributes,e.components),Z=(0,g.formatContentTypeData)(q,e.contentType,e.components);f(wa(M,Z))},[e,f]),(0,r.useEffect)(()=>()=>{f(Ta())},[f]),(0,r.useEffect)(()=>{const q=Se().CancelToken.source(),Z=T=>nt(void 0,null,function*(){f(Xt());try{const{data:P}=yield ge.be.get(w,{cancelToken:T.token});f(gr(U(W(P))))}catch(P){if(Se().isCancel(P))return;fy.error(P);const Q=R()(P,"response.status",null);if(Q===404){c(x);return}Q===403&&(l({type:"info",message:{id:v("permissions.not-allowed.update")}}),c(x))}}),_=()=>nt(void 0,null,function*(){yield f(Xt()),yield f(yr(m))});return C.current?(w?Z(q):_(),()=>{q.cancel("Operation canceled by the user.")}):()=>{}},[W,U,c,w,f,m,x,l]);const G=(0,r.useCallback)(M=>{const q=M.response.data;let Z=R()(q,["error","message"],"Bad Request");Array.isArray(Z)&&(Z=R()(Z,["0","messages","0","id"])),typeof Z=="string"&&l({type:"warning",message:Z})},[l]),N=(0,r.useCallback)(M=>nt(void 0,null,function*(){try{S.current("willDeleteEntry",M);const{data:q}=yield ge.be.delete(ve(`collection-types/${n}/${s}`));return l({type:"success",message:{id:v("success.record.delete")}}),S.current("didDeleteEntry",M),Promise.resolve(q)}catch(q){return S.current("didNotDeleteEntry",by({error:q},M)),Promise.reject(q)}}),[s,n,l]),H=(0,r.useCallback)(()=>{d(x)},[x,d]),F=(0,r.useCallback)((M,q)=>nt(void 0,null,function*(){const Z=`${ve(`collection-types/${n}`)}${m}`;try{f(he("submit-pending"));const{data:_}=yield ge.be.post(Z,M);return S.current("didCreateEntry",q),l({type:"success",message:{id:v("success.record.save")}}),i("contentManager.success"),f(Ze(U(_))),f(he("resolved")),d(`/content-manager/collectionType/${n}/${_.id}${m}`),Promise.resolve(_)}catch(_){return G(_),S.current("didNotCreateEntry",{error:_,trackerProperty:q}),f(he("resolved")),Promise.reject(_)}}),[U,G,d,n,f,m,l,i]),K=(0,r.useCallback)(()=>nt(void 0,null,function*(){try{S.current("willPublishEntry");const M=ve(`collection-types/${n}/${s}/actions/publish`);f(he("publish-pending"));const{data:q}=yield ge.be.post(M);return S.current("didPublishEntry"),f(Ze(U(q))),f(he("resolved")),l({type:"success",message:{id:v("success.record.publish")}}),Promise.resolve(q)}catch(M){return G(M),f(he("resolved")),Promise.reject(M)}}),[U,G,s,n,f,l]),$=(0,r.useCallback)((M,q)=>nt(void 0,null,function*(){const Z=ve(`collection-types/${n}/${s}`);try{S.current("willEditEntry",q),f(he("submit-pending"));const{data:_}=yield ge.be.put(Z,M);return S.current("didEditEntry",{trackerProperty:q}),l({type:"success",message:{id:v("success.record.save")}}),f(Ze(U(_))),f(he("resolved")),Promise.resolve(_)}catch(_){return S.current("didNotEditEntry",{error:_,trackerProperty:q}),G(_),f(he("resolved")),Promise.reject(_)}}),[U,G,n,s,f,l]),Y=(0,r.useCallback)(()=>nt(void 0,null,function*(){const M=ve(`collection-types/${n}/${s}/actions/unpublish`);f(he("unpublish-pending"));try{S.current("willUnpublishEntry");const{data:q}=yield ge.be.post(M);return S.current("didUnpublishEntry"),l({type:"success",message:{id:v("success.record.unpublish")}}),f(Ze(U(q))),f(he("resolved")),Promise.resolve(q)}catch(q){return f(he("resolved")),G(q),Promise.reject(q)}}),[U,G,s,n,f,l]);return t({componentsDataStructure:y,contentTypeDataStructure:h,data:b,isCreatingEntry:V,isLoadingForData:E,onDelete:N,onDeleteSucceeded:H,onPost:F,onPublish:K,onPut:$,onUnpublish:Y,status:O,redirectionLink:x})};hr.defaultProps={id:null,origin:null},hr.propTypes={allLayoutData:o().exact({components:o().object.isRequired,contentType:o().shape({apiID:o().string.isRequired,attributes:o().object.isRequired,info:o().object.isRequired,isDisplayed:o().bool.isRequired,kind:o().string.isRequired,layouts:o().object.isRequired,metadatas:o().object.isRequired,options:o().object.isRequired,pluginOptions:o().object,settings:o().object.isRequired,uid:o().string.isRequired}).isRequired}).isRequired,children:o().func.isRequired,id:o().string,origin:o().string,slug:o().string.isRequired};const Ey=(0,r.memo)(hr,We());var vy=p(89793),en=p.n(vy),Cy=p(56236),Oy=p.n(Cy);const br=(e,t,n,s)=>{const a=e.slice();return a.splice(t,1),a.splice(n,0,s),a},Py=(e,t,n)=>{const s=(i,u)=>R()(i,["attributes",u,"type"],""),a=(i,u)=>R()(i,["attributes",...u],""),l=(i,u)=>Object.keys(i).reduce((c,d)=>{const m=s(u,d),f=R()(i,d),y=a(u,[d,"component"]),h=a(u,[d,"repeatable"]);let b;switch(m){case"json":b=JSON.parse(f);break;case"time":{b=f,f&&f.split(":").length<3&&(b=`${f}:00`);break}case"media":a(u,[d,"multiple"])===!0?b=f?f.filter(E=>!(E instanceof File)):null:b=R()(f,0)instanceof File?null:R()(f,"id",null);break;case"component":h?b=f&&f.map(E=>l(E,n[y])):b=f&&l(f,n[y]);break;case"dynamiczone":b=f.map(E=>l(E,n[E.__component]));break;default:b=Ry(f,"id")}return c[d]=b,c},{});return l(e,t)},Ry=(e,t)=>Fs()(e)?e.map(n=>n[t]?n[t]:n):Vo()(e)?e[t]:e,My=Py;var Ty=p(51355),wy=p.n(Ty),Iy=p(95919),Dy=p.n(Iy),xy=p(78746),dt=p.n(xy),be=p(5173);function wt(e){return["integer","biginteger","decimal","float","number"].includes(e)}var Sy=Object.defineProperty,Ly=Object.defineProperties,Fy=Object.getOwnPropertyDescriptors,Sa=Object.getOwnPropertySymbols,ky=Object.prototype.hasOwnProperty,Ay=Object.prototype.propertyIsEnumerable,La=(e,t,n)=>t in e?Sy(e,t,{enumerable:!0,configurable:!0,writable:!0,value:n}):e[t]=n,Fa=(e,t)=>{for(var n in t||(t={}))ky.call(t,n)&&La(e,n,t[n]);if(Sa)for(var n of Sa(t))Ay.call(t,n)&&La(e,n,t[n]);return e},ka=(e,t)=>Ly(e,Fy(t));be.kM(be.nK,"defined",function(){return this.test("defined",g.translatedErrors.required,e=>e!==void 0)}),be.kM(be.IX,"notEmptyMin",function(e){return this.test("notEmptyMin",g.translatedErrors.min,t=>Re()(t)?!0:t.length>=e)}),be.kM(be.Z_,"isInferior",function(e,t){return this.test("isInferior",e,function(n){return!n||Number.isNaN(dt()(n))?!0:dt()(t)>=dt()(n)})}),be.kM(be.Z_,"isSuperior",function(e,t){return this.test("isSuperior",e,function(n){return!n||Number.isNaN(dt()(n))?!0:dt()(n)>=dt()(t)})});const jy=e=>R()(e,["attributes"],{}),Er=(e,{components:t},n={isCreatingEntry:!0,isDraft:!0,isFromComponent:!1})=>{const s=jy(e);return be.Ry().shape(Object.keys(s).reduce((a,l)=>{const i=s[l];if(i.type!=="relation"&&i.type!=="component"&&i.type!=="dynamiczone"){const u=$y(i.type,i,n);a[l]=u}if(i.type==="relation"&&(a[l]=["oneWay","oneToOne","manyToOne","oneToManyMorph","oneToOneMorph"].includes(i.relationType)?be.Ry().nullable():be.IX().nullable()),i.type==="component"){const u=Er(t[i.component],{components:t},ka(Fa({},n),{isFromComponent:!0}));if(i.repeatable===!0){const{min:d,max:m,required:f}=i;let y=be.Vo(h=>{let b=be.IX().of(u);return d?f?b=b.min(d,g.translatedErrors.min):f!==!0&&Re()(h)?b=b.nullable():b=b.min(d,g.translatedErrors.min):f&&!n.isDraft&&(b=b.min(1,g.translatedErrors.required)),m&&(b=b.max(m,g.translatedErrors.max)),b});return a[l]=y,a}const c=be.Vo(d=>d!==void 0?i.required===!0&&!n.isDraft?u.defined():u.nullable():i.required===!0?be.Ry().defined():be.Ry().nullable());return a[l]=c,a}if(i.type==="dynamiczone"){let u=be.IX().of(be.Vo(({__component:m})=>Er(t[m],{components:t},ka(Fa({},n),{isFromComponent:!0}))));const{max:c,min:d}=i;d?i.required?u=u.test("min",g.translatedErrors.min,m=>n.isCreatingEntry?m&&m.length>=d:m===void 0?!0:m!==null&&m.length>=d).test("required",g.translatedErrors.required,m=>n.isCreatingEntry?m!==null||m!==void 0:m===void 0?!0:m!==null):u=u.notEmptyMin(d):i.required&&!n.isDraft&&(u=u.test("required",g.translatedErrors.required,m=>n.isCreatingEntry?m!==null||m!==void 0:m===void 0?!0:m!==null)),c&&(u=u.max(c,g.translatedErrors.max)),a[l]=u}return a},{}))},$y=(e,t,n)=>{let s=be.nK();return["string","uid","text","richtext","email","password","enumeration"].includes(e)&&(s=be.Z_()),e==="json"&&(s=be.nK(g.translatedErrors.json).test("isJSON",g.translatedErrors.json,a=>{if(a===void 0)return!0;try{return JSON.parse(a),!0}catch(l){return!1}}).nullable()),e==="email"&&(s=s.email(g.translatedErrors.email)),["number","integer","float","decimal"].includes(e)&&(s=be.Rx().transform(a=>Dy()(a)?void 0:a).typeError()),e==="biginteger"&&(s=be.Z_().matches(/^-?\d*$/)),["date","datetime"].includes(e)&&(s=be.hT()),Object.keys(t).forEach(a=>{const l=t[a];if(!!l||!wy()(l)&&Number.isInteger(Math.floor(l))||l===0)switch(a){case"required":{n.isDraft||(e==="password"&&n.isCreatingEntry&&(s=s.required(g.translatedErrors.required)),e!=="password"&&(n.isCreatingEntry?s=s.required(g.translatedErrors.required):s=s.test("required",g.translatedErrors.required,i=>i===void 0&&!n.isFromComponent?!0:wt(e)?i===0?!0:!!i:e==="boolean"?i!==null:e==="date"||e==="datetime"?typeof i=="string"?!Re()(i):!Re()(i==null?void 0:i.toString()):!Re()(i))));break}case"max":{e==="biginteger"?s=s.isInferior(g.translatedErrors.max,l):s=s.max(l,g.translatedErrors.max);break}case"maxLength":s=s.max(l,g.translatedErrors.maxLength);break;case"min":{e==="biginteger"?s=s.isSuperior(g.translatedErrors.min,l):s=s.min(l,g.translatedErrors.min);break}case"minLength":{n.isDraft||(s=s.min(l,g.translatedErrors.minLength));break}case"regex":s=s.matches(new RegExp(l),{message:g.translatedErrors.regex,excludeEmptyString:!t.required});break;case"lowercase":["text","textarea","email","string"].includes(e)&&(s=s.strict().lowercase());break;case"uppercase":["text","textarea","email","string"].includes(e)&&(s=s.strict().uppercase());break;case"positive":wt(e)&&(s=s.positive());break;case"negative":wt(e)&&(s=s.negative());break;default:s=s.nullable()}}),s},Aa=Er;var By=Object.defineProperty,Ny=Object.defineProperties,Vy=Object.getOwnPropertyDescriptors,ja=Object.getOwnPropertySymbols,qy=Object.prototype.hasOwnProperty,Wy=Object.prototype.propertyIsEnumerable,$a=(e,t,n)=>t in e?By(e,t,{enumerable:!0,configurable:!0,writable:!0,value:n}):e[t]=n,Ba=(e,t)=>{for(var n in t||(t={}))qy.call(t,n)&&$a(e,n,t[n]);if(ja)for(var n of ja(t))Wy.call(t,n)&&$a(e,n,t[n]);return e},Na=(e,t)=>Ny(e,Vy(t));const zy={componentsDataStructure:{},contentTypeDataStructure:{},formErrors:{},initialData:{},modifiedData:null,shouldCheckErrors:!1,modifiedDZName:null},Uy=(e,t)=>(0,qt.default)(e,n=>{switch(t.type){case"ADD_NON_REPEATABLE_COMPONENT_TO_FIELD":{ne()(n,["modifiedData",...t.keys],e.componentsDataStructure[t.componentUid]);break}case"ADD_REPEATABLE_COMPONENT_TO_FIELD":{let s=R()(e,["modifiedData",...t.keys],[]).slice();const a=Na(Ba({},e.componentsDataStructure[t.componentUid]),{__temp_key__:Po(s)+1});Array.isArray(s)?s.push(a):s=[a],ne()(n,["modifiedData",...t.keys],s),t.shouldCheckErrors&&(n.shouldCheckErrors=!e.shouldCheckErrors);break}case"ADD_COMPONENT_TO_DYNAMIC_ZONE":{n.modifiedDZName=t.keys[0],t.shouldCheckErrors&&(n.shouldCheckErrors=!e.shouldCheckErrors);const s=Na(Ba({},e.componentsDataStructure[t.componentUid]),{__component:t.componentUid}),a=R()(e,["modifiedData",...t.keys],null),l=a?[...a,s]:[s];ne()(n,["modifiedData",...t.keys],l);break}case"ADD_RELATION":{if(!Array.isArray(t.value)||!t.value.length)break;const s=t.value[0].value,a=R()(e,["modifiedData",...t.keys],null);if(!a){ne()(n,["modifiedData",...t.keys],[s]);break}ne()(n,["modifiedData",...t.keys],[...a,s]);break}case"INIT_FORM":{n.formErrors={},n.initialData=t.initialValues,n.modifiedData=t.initialValues,n.modifiedDZName=null,n.shouldCheckErrors=!1;break}case"MOVE_COMPONENT_FIELD":{const s=R()(e,["modifiedData",...t.pathToComponent]),a=R()(e,["modifiedData",...t.pathToComponent,t.dragIndex]),l=br(s,t.dragIndex,t.hoverIndex,a);ne()(n,["modifiedData",...t.pathToComponent],l);break}case"MOVE_COMPONENT_UP":case"MOVE_COMPONENT_DOWN":{const{currentIndex:s,dynamicZoneName:a,shouldCheckErrors:l}=t;l&&(n.shouldCheckErrors=!e.shouldCheckErrors);const i=e.modifiedData[a],u=t.type==="MOVE_COMPONENT_UP"?s-1:s+1,c=e.modifiedData[a][s],d=br(i,s,u,c);ne()(n,["modifiedData",t.dynamicZoneName],d);break}case"MOVE_FIELD":{const s=R()(e,["modifiedData",...t.keys],[]).slice(),a=R()(e,["modifiedData",...t.keys,t.dragIndex]),l=br(s,t.dragIndex,t.overIndex,a);ne()(n,["modifiedData",...t.keys],l);break}case"ON_CHANGE":{const[s]=t.keys;if(t.shouldSetInitialValue&&ne()(n,["initialData",...t.keys],t.value),t.keys.length===2&&R()(e,["modifiedData",s])===null){ne()(n,["modifiedData",s],{[t.keys[1]]:t.value});break}ne()(n,["modifiedData",...t.keys],t.value);break}case"REMOVE_COMPONENT_FROM_DYNAMIC_ZONE":{t.shouldCheckErrors&&(n.shouldCheckErrors=!e.shouldCheckErrors),n.modifiedData[t.dynamicZoneName].splice(t.index,1);break}case"REMOVE_COMPONENT_FROM_FIELD":{const s=["modifiedData",...t.keys];ne()(n,s,null);break}case"REMOVE_PASSWORD_FIELD":{Oy()(n,["modifiedData",...t.keys]);break}case"REMOVE_REPEATABLE_FIELD":{const s=t.keys.length-1,a=["modifiedData",...Zt()(t.keys,s)];Object.keys(e.formErrors).length>0&&(n.shouldCheckErrors=!e.shouldCheckErrors);const i=R()(e,a).slice();i.splice(parseInt(t.keys[s],10),1),ne()(n,a,i);break}case"REMOVE_RELATION":{const s=t.keys.split("."),a=s.length-1,l=["modifiedData",...Zt()(s,a)],i=R()(e,l).slice(),u=parseInt(s[a],10);i.splice(u,1),ne()(n,l,i);break}case"SET_DEFAULT_DATA_STRUCTURES":{n.componentsDataStructure=t.componentsDataStructure,n.contentTypeDataStructure=t.contentTypeDataStructure;break}case"SET_FORM_ERRORS":{n.modifiedDZName=null,n.formErrors=t.errors;break}case"TRIGGER_FORM_VALIDATION":{Object.keys(e.formErrors).length>0&&(n.shouldCheckErrors=!e.shouldCheckErrors);break}default:return n}});var Hy=Object.defineProperty,Va=Object.getOwnPropertySymbols,Gy=Object.prototype.hasOwnProperty,Zy=Object.prototype.propertyIsEnumerable,qa=(e,t,n)=>t in e?Hy(e,t,{enumerable:!0,configurable:!0,writable:!0,value:n}):e[t]=n,tn=(e,t)=>{for(var n in t||(t={}))Gy.call(t,n)&&qa(e,n,t[n]);if(Va)for(var n of Va(t))Zy.call(t,n)&&qa(e,n,t[n]);return e},vr=(e,t,n)=>new Promise((s,a)=>{var l=c=>{try{u(n.next(c))}catch(d){a(d)}},i=c=>{try{u(n.throw(c))}catch(d){a(d)}},u=c=>c.done?s(c.value):Promise.resolve(c.value).then(l,i);u((n=n.apply(e,t)).next())});const Cr=({allLayoutData:e,allowedActions:{canRead:t,canUpdate:n},children:s,componentsDataStructure:a,contentTypeDataStructure:l,createActionAllowedFields:i,from:u,initialValues:c,isCreatingEntry:d,isLoadingForData:m,isSingleType:f,onPost:y,onPublish:h,onPut:b,onUnpublish:E,readActionAllowedFields:O,redirectToPreviousPage:x,slug:C,status:S,updateActionAllowedFields:I})=>{const[V,w]=(0,r.useReducer)(Uy,zy),{formErrors:W,initialData:U,modifiedData:G,modifiedDZName:N,shouldCheckErrors:H}=V,F=(0,g.useNotification)(),{lockApp:K,unlockApp:$}=(0,g.useOverlayBlocker)(),Y=R()(e,["contentType"],{}),M=(0,r.useMemo)(()=>R()(Y,["options","draftAndPublish"],!1),[Y]),q=(0,r.useMemo)(()=>M&&!U.publishedAt,[M,U.publishedAt]),{trackUsage:Z}=(0,g.useTracking)(),{formatMessage:_}=(0,A.useIntl)(),T=(0,r.useRef)(Z),P=(0,r.useMemo)(()=>m||d?!1:t===!1&&n===!1,[m,d,t,n]);(0,r.useEffect)(()=>{S==="resolved"?$():K()},[K,$,S]),(0,r.useEffect)(()=>{m||rt()},[H]),(0,r.useEffect)(()=>{const te=Object.keys(W);if(te.length>0){const J=te[0],le=document.getElementById(J);le&&le.focus()}},[W]),(0,r.useEffect)(()=>{P&&F({type:"info",message:{id:v("permissions.not-allowed.update")}})},[P,F]),(0,r.useEffect)(()=>{w({type:"SET_DEFAULT_DATA_STRUCTURES",componentsDataStructure:a,contentTypeDataStructure:l})},[a,l]),(0,r.useEffect)(()=>{c&&w({type:"INIT_FORM",initialValues:c})},[c]);const Q=(0,r.useCallback)((te,J,le=!1)=>{T.current("didAddComponentToDynamicZone"),w({type:"ADD_COMPONENT_TO_DYNAMIC_ZONE",keys:te.split("."),componentUid:J,shouldCheckErrors:le})},[]),re=(0,r.useCallback)((te,J)=>{w({type:"ADD_NON_REPEATABLE_COMPONENT_TO_FIELD",keys:te.split("."),componentUid:J})},[]),ce=(0,r.useCallback)(({target:{name:te,value:J}})=>{w({type:"ADD_RELATION",keys:te.split("."),value:J})},[]),me=(0,r.useCallback)((te,J,le=!1)=>{w({type:"ADD_REPEATABLE_COMPONENT_TO_FIELD",keys:te.split("."),componentUid:J,shouldCheckErrors:le})},[]),Fe=(0,r.useMemo)(()=>{const te={isCreatingEntry:d,isDraft:q,isFromComponent:!1};return Aa(Y,{components:e.components||{}},te)},[e.components,Y,d,q]),rt=(0,r.useCallback)((...te)=>vr(void 0,[...te],function*(J={}){let le={};const ot=qe()(G);Re()(ot)||ne()(ot,J.path,J.value);try{yield Fe.validate(ot,{abortEarly:!1})}catch(gn){le=(0,g.getYupInnerErrors)(gn),N&&(le=Object.keys(le).reduce((mc,to)=>(to.split(".")[0]!==N&&(mc[to]=le[to]),mc),{}))}w({type:"SET_FORM_ERRORS",errors:le})}),[N,G,Fe]),z=(0,r.useCallback)(({target:{name:te,value:J,type:le}},ot=!1)=>{let gn=J;if(["text","textarea","string","email","uid","select","select-one","number"].includes(le)&&!J&&(gn=null),le==="password"&&!J){w({type:"REMOVE_PASSWORD_FIELD",keys:te.split(".")});return}w({type:"ON_CHANGE",keys:te.split("."),value:gn,shouldSetInitialValue:ot})},[]),de=(0,r.useCallback)(te=>{const J=ou(qe()(te),"__temp_key__");return My(J,Y,e.components)},[e.components,Y]),je=(0,r.useMemo)(()=>M?q?{status:"draft"}:{}:{},[M,q]),He=(0,r.useCallback)(te=>vr(void 0,null,function*(){te.preventDefault();let J={};try{yield Fe.validate(G,{abortEarly:!1})}catch(le){J=(0,g.getYupInnerErrors)(le)}try{if(Re()(J)){const le=de(G);d?yield y(le,je):yield b(le,je)}}catch(le){J=tn(tn({},J),(0,g.getAPIInnerErrors)(le))}w({type:"SET_FORM_ERRORS",errors:J})}),[de,d,G,y,b,je,Fe]),ht=(0,r.useCallback)(()=>vr(void 0,null,function*(){const te=Aa(Y,{components:R()(e,"components",{})},{isCreatingEntry:d,isDraft:!1,isFromComponent:!1});let J={};try{yield te.validate(G,{abortEarly:!1})}catch(le){J=(0,g.getYupInnerErrors)(le)}try{Re()(J)&&(yield h())}catch(le){J=tn(tn({},J),(0,g.getAPIInnerErrors)(le))}w({type:"SET_FORM_ERRORS",errors:J})}),[e,Y,d,G,h]),Qe=(0,r.useCallback)(te=>{const J=Object.keys(W).some(ot=>ot.split(".")[0]===te);return!Re()(W)&&J},[W]),Yr=(0,r.useCallback)((te,J)=>{T.current("changeComponentsOrder"),w({type:"MOVE_COMPONENT_DOWN",dynamicZoneName:te,currentIndex:J,shouldCheckErrors:Qe(te)})},[Qe]),Jr=(0,r.useCallback)((te,J)=>{T.current("changeComponentsOrder"),w({type:"MOVE_COMPONENT_UP",dynamicZoneName:te,currentIndex:J,shouldCheckErrors:Qe(te)})},[Qe]),Ce=(0,r.useCallback)((te,J,le)=>{w({type:"MOVE_COMPONENT_FIELD",pathToComponent:te,dragIndex:J,hoverIndex:le})},[]),$e=(0,r.useCallback)((te,J,le)=>{w({type:"MOVE_FIELD",dragIndex:te,overIndex:J,keys:le.split(".")})},[]),Ke=(0,r.useCallback)(te=>{w({type:"REMOVE_RELATION",keys:te})},[]),Xr=(0,r.useCallback)((te,J)=>{T.current("removeComponentFromDynamicZone"),w({type:"REMOVE_COMPONENT_FROM_DYNAMIC_ZONE",dynamicZoneName:te,index:J,shouldCheckErrors:Qe(te)})},[Qe]),Ye=(0,r.useCallback)((te,J)=>{w({type:"REMOVE_COMPONENT_FROM_FIELD",keys:te.split("."),componentUid:J})},[]),fn=(0,r.useCallback)((te,J)=>{w({type:"REMOVE_REPEATABLE_FIELD",keys:te.split("."),componentUid:J})},[]),eo=(0,r.useCallback)(()=>{w({type:"TRIGGER_FORM_VALIDATION"})},[]);return P?r.createElement(ee.Redirect,{to:u}):G?r.createElement(g.ContentManagerEditViewDataManagerContext.Provider,{value:{addComponentToDynamicZone:Q,addNonRepeatableComponentToField:re,addRelation:ce,addRepeatableComponentToField:me,allLayoutData:e,checkFormErrors:rt,createActionAllowedFields:i,formErrors:W,hasDraftAndPublish:M,initialData:U,isCreatingEntry:d,isSingleType:f,shouldNotRunValidations:q,status:S,layout:Y,modifiedData:G,moveComponentDown:Yr,moveComponentField:Ce,moveComponentUp:Jr,moveRelation:$e,onChange:z,onPublish:ht,onUnpublish:E,onRemoveRelation:Ke,readActionAllowedFields:O,redirectToPreviousPage:x,removeComponentFromDynamicZone:Xr,removeComponentFromField:Ye,removeRepeatableField:fn,slug:C,triggerFormValidation:eo,updateActionAllowedFields:I}},r.createElement(r.Fragment,null,m||!d&&!U.id?r.createElement(oe.Main,{"aria-busy":"true"},r.createElement(g.LoadingIndicatorPage,null)):r.createElement(r.Fragment,null,r.createElement(ee.Prompt,{when:!en()(G,U),message:_({id:"global.prompt.unsaved"})}),r.createElement("form",{noValidate:!0,onSubmit:He},s)))):null};Cr.defaultProps={from:"/",initialValues:null,redirectToPreviousPage:()=>{}},Cr.propTypes={allLayoutData:o().object.isRequired,allowedActions:o().object.isRequired,children:o().node.isRequired,componentsDataStructure:o().object.isRequired,contentTypeDataStructure:o().object.isRequired,createActionAllowedFields:o().array.isRequired,from:o().string,initialValues:o().object,isCreatingEntry:o().bool.isRequired,isLoadingForData:o().bool.isRequired,isSingleType:o().bool.isRequired,onPost:o().func.isRequired,onPublish:o().func.isRequired,onPut:o().func.isRequired,onUnpublish:o().func.isRequired,readActionAllowedFields:o().array.isRequired,redirectToPreviousPage:o().func,slug:o().string.isRequired,status:o().string.isRequired,updateActionAllowedFields:o().array.isRequired};const _y=Cr,pt=e=>ve(`single-types/${e}`),Qy=e=>Object.values(e||{}).reduce((t,n)=>Object.assign(t,n),{});var Ky=Object.defineProperty,nn=Object.getOwnPropertySymbols,Wa=Object.prototype.hasOwnProperty,za=Object.prototype.propertyIsEnumerable,Ua=(e,t,n)=>t in e?Ky(e,t,{enumerable:!0,configurable:!0,writable:!0,value:n}):e[t]=n,Ha=(e,t)=>{for(var n in t||(t={}))Wa.call(t,n)&&Ua(e,n,t[n]);if(nn)for(var n of nn(t))za.call(t,n)&&Ua(e,n,t[n]);return e},Yy=(e,t)=>{var n={};for(var s in e)Wa.call(e,s)&&t.indexOf(s)<0&&(n[s]=e[s]);if(e!=null&&nn)for(var s of nn(e))t.indexOf(s)<0&&za.call(e,s)&&(n[s]=e[s]);return n};const Ga=(e={})=>{const t=Ha(Ha({},e),Qy(e.plugins)),{plugins:n}=t,s=Yy(t,["plugins"]);return`?${(0,Ne.stringify)(s,{encode:!1})}`};var Jy=Object.defineProperty,Za=Object.getOwnPropertySymbols,Xy=Object.prototype.hasOwnProperty,eh=Object.prototype.propertyIsEnumerable,_a=(e,t,n)=>t in e?Jy(e,t,{enumerable:!0,configurable:!0,writable:!0,value:n}):e[t]=n,th=(e,t)=>{for(var n in t||(t={}))Xy.call(t,n)&&_a(e,n,t[n]);if(Za)for(var n of Za(t))eh.call(t,n)&&_a(e,n,t[n]);return e},mt=(e,t,n)=>new Promise((s,a)=>{var l=c=>{try{u(n.next(c))}catch(d){a(d)}},i=c=>{try{u(n.throw(c))}catch(d){a(d)}},u=c=>c.done?s(c.value):Promise.resolve(c.value).then(l,i);u((n=n.apply(e,t)).next())});const Qa=({allLayoutData:e,children:t,slug:n})=>{const{trackUsage:s}=(0,g.useTracking)(),{push:a}=(0,ee.useHistory)(),{setCurrentStep:l}=(0,g.useGuidedTour)(),i=(0,r.useRef)(s),[u,c]=(0,r.useState)(!0),[{query:d,rawQuery:m}]=(0,g.useQueryParams)(),f=Ga(d),y=(0,g.useNotification)(),h=(0,fe.useDispatch)(),{componentsDataStructure:b,contentTypeDataStructure:E,data:O,isLoading:x,status:C}=(0,fe.useSelector)(Ia),S=(0,r.useCallback)(H=>{const F=Do(H,e.contentType,e.components);return(0,g.formatContentTypeData)(F,e.contentType,e.components)},[e]);(0,r.useEffect)(()=>()=>{h(Ta())},[h]),(0,r.useEffect)(()=>{const H=Object.keys(e.components).reduce(($,Y)=>{const M=$t(R()(e,["components",Y,"attributes"],{}),e.components);return $[Y]=(0,g.formatContentTypeData)(M,e.components[Y],e.components),$},{}),F=$t(e.contentType.attributes,e.components),K=(0,g.formatContentTypeData)(F,e.contentType,e.components);h(wa(H,K))},[e,h]),(0,r.useEffect)(()=>{const F=Se().CancelToken.source();return($=>mt(void 0,null,function*(){h(Xt()),c(!0);try{const{data:Y}=yield(0,ge.be)(pt(`${n}${f}`),{cancelToken:$.token});h(gr(S(Y))),c(!1)}catch(Y){if(Se().isCancel(Y))return;const M=R()(Y,"response.status",null);M===404&&h(yr(m,!0)),M===403&&(y({type:"info",message:{id:v("permissions.not-allowed.update")}}),a("/"))}}))(F),()=>F.cancel("Operation canceled by the user.")},[S,a,n,h,f,m,y]);const I=(0,r.useCallback)(H=>{const F=H.response.data;let K=R()(F,["error","message"],"Bad Request");Array.isArray(K)&&(K=R()(K,["0","messages","0","id"])),typeof K=="string"&&y({type:"warning",message:K})},[y]),V=(0,r.useCallback)(H=>mt(void 0,null,function*(){try{i.current("willDeleteEntry",H);const{data:F}=yield ge.be.delete(pt(`${n}${f}`));return y({type:"success",message:{id:v("success.record.delete")}}),i.current("didDeleteEntry",H),Promise.resolve(F)}catch(F){return i.current("didNotDeleteEntry",th({error:F},H)),I(F),Promise.reject(F)}}),[n,I,y,f]),w=(0,r.useCallback)(()=>{c(!0),h(yr(m,!0))},[h,m]),W=(0,r.useCallback)((H,F)=>mt(void 0,null,function*(){const K=pt(`${n}${m}`);try{h(he("submit-pending"));const{data:$}=yield ge.be.put(K,H);return i.current("didCreateEntry",F),y({type:"success",message:{id:v("success.record.save")}}),l("contentManager.success"),h(Ze(S($))),c(!1),h(he("resolved")),Promise.resolve($)}catch($){return i.current("didNotCreateEntry",{error:$,trackerProperty:F}),I($),h(he("resolved")),Promise.reject($)}}),[S,I,n,h,m,y,l]),U=(0,r.useCallback)(()=>mt(void 0,null,function*(){try{i.current("willPublishEntry");const H=pt(`${n}/actions/publish${f}`);h(he("publish-pending"));const{data:F}=yield ge.be.post(H);return i.current("didPublishEntry"),y({type:"success",message:{id:v("success.record.publish")}}),h(Ze(S(F))),h(he("resolved")),Promise.resolve(F)}catch(H){return I(H),h(he("resolved")),Promise.reject(H)}}),[S,I,n,f,h,y]),G=(0,r.useCallback)((H,F)=>mt(void 0,null,function*(){const K=pt(`${n}${m}`);try{i.current("willEditEntry",F),h(he("submit-pending"));const{data:$}=yield ge.be.put(K,H);return y({type:"success",message:{id:v("success.record.save")}}),i.current("didEditEntry",{trackerProperty:F}),h(Ze(S($))),h(he("resolved")),Promise.resolve($)}catch($){return I($),i.current("didNotEditEntry",{error:$,trackerProperty:F}),h(he("resolved")),Promise.reject($)}}),[S,I,n,h,m,y]),N=(0,r.useCallback)(()=>mt(void 0,null,function*(){const H=pt(`${n}/actions/unpublish${f}`);h(he("unpublish-pending"));try{i.current("willUnpublishEntry");const{data:F}=yield ge.be.post(H);i.current("didUnpublishEntry"),y({type:"success",message:{id:v("success.record.unpublish")}}),h(Ze(S(F))),h(he("resolved"))}catch(F){h(he("resolved")),I(F)}}),[S,y,I,n,h,f]);return t({componentsDataStructure:b,contentTypeDataStructure:E,data:O,isCreatingEntry:u,isLoadingForData:x,onDelete:V,onDeleteSucceeded:w,onPost:W,onPublish:U,onPut:G,onUnpublish:N,redirectionLink:"/",status:C})};Qa.propTypes={allLayoutData:o().shape({components:o().object.isRequired,contentType:o().object.isRequired}).isRequired,children:o().func.isRequired,slug:o().string.isRequired};const nh=(0,r.memo)(Qa);var rh=p(57235),oh=p.n(rh),sh=Object.defineProperty,Ka=Object.getOwnPropertySymbols,ah=Object.prototype.hasOwnProperty,ih=Object.prototype.propertyIsEnumerable,Ya=(e,t,n)=>t in e?sh(e,t,{enumerable:!0,configurable:!0,writable:!0,value:n}):e[t]=n,Ja=(e,t)=>{for(var n in t||(t={}))ah.call(t,n)&&Ya(e,n,t[n]);if(Ka)for(var n of Ka(t))ih.call(t,n)&&Ya(e,n,t[n]);return e};function lh(e,t){return function(n){const s=t();return r.createElement(e,Ja(Ja({},n),s))}}const ch=lh;function uh(){const{initialData:e,hasDraftAndPublish:t}=(0,g.useCMEditViewDataManager)(),n=e.publishedAt!==void 0&&e.publishedAt!==null;return{hasDraftAndPublish:t,isPublished:n}}const dh=uh;var ph=Object.defineProperty,Xa=Object.getOwnPropertySymbols,mh=Object.prototype.hasOwnProperty,fh=Object.prototype.propertyIsEnumerable,ei=(e,t,n)=>t in e?ph(e,t,{enumerable:!0,configurable:!0,writable:!0,value:n}):e[t]=n,gh=(e,t)=>{for(var n in t||(t={}))mh.call(t,n)&&ei(e,n,t[n]);if(Xa)for(var n of Xa(t))fh.call(t,n)&&ei(e,n,t[n]);return e};const yh=(0,k.default)(oh())`
|
|
987
|
+
width: ${(0,g.pxToRem)(6)};
|
|
988
|
+
height: ${(0,g.pxToRem)(6)};
|
|
989
|
+
* {
|
|
990
|
+
fill: ${({theme:e,$bulletColor:t})=>e.colors[t]};
|
|
991
|
+
}
|
|
992
|
+
`,ti=({hasDraftAndPublish:e,isPublished:t})=>{const{formatMessage:n}=(0,A.useIntl)();if(!e)return null;const s={draft:{textColor:"secondary700",bulletColor:"secondary600",box:{background:"secondary100",borderColor:"secondary200"}},published:{textColor:"success700",bulletColor:"success600",box:{background:"success100",borderColor:"success200"}}},a=t?s.published:s.draft;return r.createElement(D.Box,gh({hasRadius:!0,as:"aside",paddingTop:4,paddingBottom:4,paddingLeft:5,paddingRight:5},a.box),r.createElement(D.Box,{as:j.Flex},r.createElement(yh,{$bulletColor:a.bulletColor}),r.createElement(D.Box,{paddingLeft:3},r.createElement(L.Typography,{textColor:a.textColor},n({id:v("containers.Edit.information.editing"),defaultMessage:"Editing"}),"\xA0"),r.createElement(L.Typography,{fontWeight:"bold",textColor:a.textColor},t&&n({id:v("containers.Edit.information.publishedVersion"),defaultMessage:"published version"}),!t&&n({id:v("containers.Edit.information.draftVersion"),defaultMessage:"draft version"})))))};ti.propTypes={hasDraftAndPublish:o().bool.isRequired,isPublished:o().bool.isRequired};const hh=ch(ti,dh),Or=60*1e3,Pr=Or*60,rn=Pr*24,ni=rn*30,ri=rn*365,bh=e=>e<Or?{unit:"second",value:-Math.round(e/1e3)}:e<Pr?{unit:"minute",value:-Math.round(e/Or)}:e<rn?{unit:"hour",value:-Math.round(e/Pr)}:e<ni?{unit:"day",value:-Math.round(e/rn)}:e<ri?{unit:"month",value:-Math.round(e/ni)}:{unit:"year",value:-Math.round(e/ri)};var oi=p(7602);const Eh=()=>{const{formatMessage:e,formatRelativeTime:t}=(0,A.useIntl)(),{initialData:n,isCreatingEntry:s}=(0,g.useCMEditViewDataManager)(),a=(0,r.useRef)(Date.now()),l=(c,d)=>{var m,f,y;const h=((m=n[d])==null?void 0:m.firstname)||"",b=((f=n[d])==null?void 0:f.lastname)||"",O=((y=n[d])==null?void 0:y.username)||(0,oi.Pp)(h,b),C=(n[c]?new Date(n[c]).getTime():Date.now())-a.current,{unit:S,value:I}=bh(-C);return{at:t(I,S,{numeric:"auto"}),by:s?"-":O}},i=l("updatedAt","updatedBy"),u=l("createdAt","createdBy");return r.createElement(D.Box,null,r.createElement(L.Typography,{variant:"sigma",textColor:"neutral600",id:"additional-informations"},e({id:v("containers.Edit.information"),defaultMessage:"Information"})),r.createElement(D.Box,{paddingTop:2,paddingBottom:6},r.createElement(Ut.Divider,null)),r.createElement(se.Stack,{spacing:4},r.createElement(j.Flex,{justifyContent:"space-between"},r.createElement(L.Typography,{fontWeight:"bold"},e({id:v("containers.Edit.information.created"),defaultMessage:"Created"})),r.createElement(L.Typography,null,u.at)),r.createElement(j.Flex,{justifyContent:"space-between"},r.createElement(L.Typography,{fontWeight:"bold"},e({id:v("containers.Edit.information.by"),defaultMessage:"By"})),r.createElement(L.Typography,null,u.by)),r.createElement(j.Flex,{justifyContent:"space-between"},r.createElement(L.Typography,{fontWeight:"bold"},e({id:v("containers.Edit.information.lastUpdate"),defaultMessage:"Last update"})),r.createElement(L.Typography,null,i.at)),r.createElement(j.Flex,{justifyContent:"space-between"},r.createElement(L.Typography,{fontWeight:"bold"},e({id:v("containers.Edit.information.by"),defaultMessage:"By"})),r.createElement(L.Typography,null,i.by))))};var vh=p(98599),on=p.n(vh),ke=p(49137),Ch=p(88677),ft=p.n(Ch),Oh=Object.defineProperty,si=Object.getOwnPropertySymbols,Ph=Object.prototype.hasOwnProperty,Rh=Object.prototype.propertyIsEnumerable,ai=(e,t,n)=>t in e?Oh(e,t,{enumerable:!0,configurable:!0,writable:!0,value:n}):e[t]=n,ii=(e,t)=>{for(var n in t||(t={}))Ph.call(t,n)&&ai(e,n,t[n]);if(si)for(var n of si(t))Rh.call(t,n)&&ai(e,n,t[n]);return e};function Mh(e,t){return function(n){const s=t();return r.createElement(e,ii(ii({},n),s))}}const Th=Mh,wh=(e,t,n)=>{const s=(l,i)=>Object.keys(l).reduce((u,c)=>{const d=(0,B.get)(i,["attributes",c,"type"],"string"),m=(0,B.get)(i,["attributes",c,"relationType"],""),f=m.toLowerCase().includes("morph"),y=["oneWay","oneToOne","manyToOne"],h=l[c];if((0,B.isNil)(h))return u;if(d==="dynamiczone"&&h.forEach(b=>{const E=(0,B.get)(n,b.__component,{});u+=s(b,E)}),d==="component"){const b=(0,B.get)(i,["attributes",c,"repeatable"],!1),E=(0,B.get)(i,["attributes",c,"component"],""),O=(0,B.get)(n,E,{});b?h.forEach(x=>{u+=s(x,O)}):u+=s(h,O)}return d==="relation"&&!f&&(y.includes(m)?(0,B.has)(h,"publishedAt")&&(0,B.isEmpty)(h.publishedAt)&&(u+=1):h.forEach(b=>{(0,B.has)(b,"publishedAt")&&(0,B.isEmpty)(b.publishedAt)&&(u+=1)})),u},0);return s(e,t,n)};function Ih(){const{allLayoutData:e,initialData:t,isCreatingEntry:n,isSingleType:s,status:a,layout:l,hasDraftAndPublish:i,modifiedData:u,onPublish:c,onUnpublish:d}=(0,g.useCMEditViewDataManager)();return{componentLayouts:e.components,initialData:t,isCreatingEntry:n,isSingleType:s,status:a,layout:l,hasDraftAndPublish:i,modifiedData:u,onPublish:c,onUnpublish:d}}const Dh=Ih,li=({allowedActions:{canUpdate:e,canCreate:t,canPublish:n},componentLayouts:s,initialData:a,isCreatingEntry:l,isSingleType:i,hasDraftAndPublish:u,layout:c,modifiedData:d,onPublish:m,onUnpublish:f,status:y})=>{const{goBack:h}=(0,ee.useHistory)(),[b,E]=(0,r.useState)(!1),[O,x]=(0,r.useState)(!1),{formatMessage:C}=(0,A.useIntl)(),S=(0,r.useRef)(0),I=R()(c,["settings","mainField"],"id"),V=R()(c,["info","displayName"],"NOT FOUND"),w=!en()(a,d)||l&&!Re()(d);let U=C({id:v("containers.Edit.pluginHeader.title.new"),defaultMessage:"Create an entry"});!l&&!i&&(U=a[I]||V),i&&(U=V);const G=()=>{const M=wh(d,c,s);return S.current=M,M};let N=null;if(l&&t&&(N=r.createElement(se.Stack,{horizontal:!0,spacing:2},u&&r.createElement(ye.Button,{disabled:!0,startIcon:r.createElement(ft(),null),variant:"secondary"},C({id:"app.utils.publish",defaultMessage:"Publish"})),r.createElement(ye.Button,{disabled:!w,isLoading:y==="submit-pending",type:"submit"},C({id:v("containers.Edit.submit"),defaultMessage:"Save"})))),!l&&e){const M=u&&n,q=!Re()(a.publishedAt),Z=q?y==="unpublish-pending":y==="publish-pending",_=q?{id:"app.utils.unpublish",defaultMessage:"Unpublish"}:{id:"app.utils.publish",defaultMessage:"Publish"},T=q?()=>E(!0):()=>{G()===0?m():x(!0)};N=r.createElement(j.Flex,null,M&&r.createElement(ye.Button,{disabled:w,loading:Z,onClick:T,startIcon:r.createElement(ft(),null),variant:"secondary"},C(_)),r.createElement(D.Box,{paddingLeft:M?2:0},r.createElement(ye.Button,{disabled:!w,loading:y==="submit-pending",type:"submit"},C({id:v("containers.Edit.submit"),defaultMessage:"Save"}))))}const H=()=>E(M=>!M),F=()=>x(M=>!M),K=()=>{F(),S.current=0,m()},$=()=>{H(),f()},Y=`${C({id:v("api.id"),defaultMessage:"API ID "})} : ${c.apiID}`;return r.createElement(r.Fragment,null,r.createElement(X.HeaderLayout,{title:U.toString(),primaryAction:N,subtitle:Y,navigationAction:r.createElement(g.Link,{startIcon:r.createElement(on(),null),onClick:M=>{M.preventDefault(),h()},to:"/"},C({id:"global.back",defaultMessage:"Back"}))}),b&&r.createElement(ke.Dialog,{onClose:H,title:"Confirmation",labelledBy:"confirmation",describedBy:"confirm-description",isOpen:b},r.createElement(ke.DialogBody,{icon:r.createElement(Tt(),null)},r.createElement(se.Stack,{spacing:2},r.createElement(j.Flex,{justifyContent:"center",style:{textAlign:"center"}},r.createElement(L.Typography,{id:"confirm-description"},C({id:v("popUpWarning.warning.unpublish"),defaultMessage:"Unpublish this content will automatically change it to a draft."},{br:()=>r.createElement("br",null)}))),r.createElement(j.Flex,{justifyContent:"center",style:{textAlign:"center"}},r.createElement(L.Typography,{id:"confirm-description"},C({id:v("popUpWarning.warning.unpublish-question"),defaultMessage:"Are you sure you want to unpublish it?"}))))),r.createElement(ke.DialogFooter,{startAction:r.createElement(ye.Button,{onClick:H,variant:"tertiary"},C({id:"components.popUpWarning.button.cancel",defaultMessage:"No, cancel"})),endAction:r.createElement(ye.Button,{variant:"danger-light",onClick:$},C({id:"components.popUpWarning.button.confirm",defaultMessage:"Yes, confirm"}))})),O&&r.createElement(ke.Dialog,{onClose:F,title:"Confirmation",labelledBy:"confirmation",describedBy:"confirm-description",isOpen:O},r.createElement(ke.DialogBody,{icon:r.createElement(Tt(),null)},r.createElement(se.Stack,{spacing:2},r.createElement(j.Flex,{justifyContent:"center",style:{textAlign:"center"}},r.createElement(L.Typography,{id:"confirm-description"},S.current,C({id:v("popUpwarning.warning.has-draft-relations.message"),defaultMessage:"<b>{count, plural, =0 { of your content relations is} one { of your content relations is} other { of your content relations are}}</b> not published yet.<br></br>It might engender broken links and errors on your project."},{br:()=>r.createElement("br",null),b:M=>r.createElement(L.Typography,{fontWeight:"bold"},M),count:S.current}))),r.createElement(j.Flex,{justifyContent:"center",style:{textAlign:"center"}},r.createElement(L.Typography,{id:"confirm-description"},C({id:v("popUpWarning.warning.publish-question"),defaultMessage:"Do you still want to publish it?"}))))),r.createElement(ke.DialogFooter,{startAction:r.createElement(ye.Button,{onClick:F,variant:"tertiary"},C({id:"components.popUpWarning.button.cancel",defaultMessage:"No, cancel"})),endAction:r.createElement(ye.Button,{variant:"success",onClick:K},C({id:v("popUpwarning.warning.has-draft-relations.button-confirm"),defaultMessage:"Yes, publish"}))})))};li.propTypes={allowedActions:o().shape({canUpdate:o().bool.isRequired,canCreate:o().bool.isRequired,canPublish:o().bool.isRequired}).isRequired,componentLayouts:o().object.isRequired,initialData:o().object.isRequired,isCreatingEntry:o().bool.isRequired,isSingleType:o().bool.isRequired,status:o().string.isRequired,layout:o().object.isRequired,hasDraftAndPublish:o().bool.isRequired,modifiedData:o().object.isRequired,onPublish:o().func.isRequired,onUnpublish:o().func.isRequired};const xh=(0,r.memo)(li,We()),Sh=Th(xh,Dh),Lh=(e,t)=>{const n=l=>(0,B.get)(t,[l,"type"],"");let s=0;const a=[];for(let l of e){const i=l.some(({name:u})=>n(u)==="dynamiczone");a[s]||(a[s]=[]),i?(s=s===0&&(0,B.isEmpty)(a[0])?0:s+1,a[s]||(a[s]=[]),a[s].push(l),s+=1):a[s].push(l)}return a.filter(l=>l.length>0)},Fh=(e,t)=>{const n=s=>{const a=(0,g.findMatchingPermissions)(e,[{action:`plugin::content-manager.explorer.${s}`,subject:t}]);return(0,B.uniq)((0,B.flatMap)(a,"properties.fields"))};return{createActionAllowedFields:n("create"),readActionAllowedFields:n("read"),updateActionAllowedFields:n("update")}};var kh=Object.defineProperty,ci=Object.getOwnPropertySymbols,Ah=Object.prototype.hasOwnProperty,jh=Object.prototype.propertyIsEnumerable,ui=(e,t,n)=>t in e?kh(e,t,{enumerable:!0,configurable:!0,writable:!0,value:n}):e[t]=n,di=(e,t)=>{for(var n in t||(t={}))Ah.call(t,n)&&ui(e,n,t[n]);if(ci)for(var n of ci(t))jh.call(t,n)&&ui(e,n,t[n]);return e};function $h(e,t){return function(n){const s=t();return r.createElement(e,di(di({},n),s))}}const Bh=$h;function Nh(){const{hasDraftAndPublish:e,modifiedData:t}=(0,g.useCMEditViewDataManager)();let n={};return e&&(n=(0,B.isEmpty)(t.publishedAt)?{status:"draft"}:{status:"published"}),{hasDraftAndPublish:e,trackerProperty:n}}const Vh=Nh;var qh=(e,t,n)=>new Promise((s,a)=>{var l=c=>{try{u(n.next(c))}catch(d){a(d)}},i=c=>{try{u(n.throw(c))}catch(d){a(d)}},u=c=>c.done?s(c.value):Promise.resolve(c.value).then(l,i);u((n=n.apply(e,t)).next())});const pi=({isCreatingEntry:e,onDelete:t,onDeleteSucceeded:n,trackerProperty:s})=>{const[a,l]=(0,r.useState)(!1),[i,u]=(0,r.useState)(!1),{formatMessage:c}=(0,A.useIntl)(),d=(0,g.useNotification)(),m=()=>l(y=>!y),f=()=>qh(void 0,null,function*(){try{u(!0),yield t(s),u(!1),m(),n()}catch(y){const h=R()(y,"response.payload.message",c({id:v("error.record.delete")}));u(!1),m(),d({type:"warning",message:h})}});return e?null:r.createElement(r.Fragment,null,r.createElement(ye.Button,{onClick:m,size:"S",startIcon:r.createElement(Be(),null),variant:"danger-light"},c({id:v("containers.Edit.delete-entry"),defaultMessage:"Delete this entry"})),r.createElement(g.ConfirmDialog,{isConfirmButtonLoading:i,isOpen:a,onConfirm:f,onToggleDialog:m}))};pi.propTypes={isCreatingEntry:o().bool.isRequired,onDelete:o().func.isRequired,onDeleteSucceeded:o().func.isRequired,trackerProperty:o().object.isRequired};const Wh=(0,r.memo)(pi,We()),zh=Bh(Wh,Vh);var Uh=Object.defineProperty,Hh=Object.defineProperties,Gh=Object.getOwnPropertyDescriptors,mi=Object.getOwnPropertySymbols,Zh=Object.prototype.hasOwnProperty,_h=Object.prototype.propertyIsEnumerable,fi=(e,t,n)=>t in e?Uh(e,t,{enumerable:!0,configurable:!0,writable:!0,value:n}):e[t]=n,gi=(e,t)=>{for(var n in t||(t={}))Zh.call(t,n)&&fi(e,n,t[n]);if(mi)for(var n of mi(t))_h.call(t,n)&&fi(e,n,t[n]);return e},Qh=(e,t)=>Hh(e,Gh(t));const yi=De.Z.contentManager,Kh=[{action:"plugin::content-type-builder.read",subject:null}],Rr=({allowedActions:e,isSingleType:t,goBack:n,layout:s,slug:a,id:l,origin:i,userPermissions:u})=>{const{trackUsage:c}=(0,g.useTracking)(),{formatMessage:d}=(0,A.useIntl)(),{createActionAllowedFields:m,readActionAllowedFields:f,updateActionAllowedFields:y}=(0,r.useMemo)(()=>Fh(u,a),[u,a]),h=(0,r.useMemo)(()=>t?yi.singleTypesConfigurations:yi.collectionTypesConfigurations,[t]),b=`/content-manager/${t?"singleType":"collectionType"}/${a}/configurations/edit`,E=R()(s,["contentType"],{}),O=(0,r.useMemo)(()=>t?nh:Ey,[t]),x=(0,r.useCallback)(V=>V.every(w=>w.every(W=>W.fieldSchema.type==="dynamiczone")),[]),C=(0,r.useMemo)(()=>E.layouts?Lh(E.layouts.edit,E.attributes):[],[E]),S=E.layouts.editRelations,I=S.length;return r.createElement(O,{allLayoutData:s,slug:a,id:l,origin:i},({componentsDataStructure:V,contentTypeDataStructure:w,data:W,isCreatingEntry:U,isLoadingForData:G,onDelete:N,onDeleteSucceeded:H,onPost:F,onPublish:K,onPut:$,onUnpublish:Y,redirectionLink:M,status:q})=>r.createElement(_y,{allowedActions:e,allLayoutData:s,createActionAllowedFields:m,componentsDataStructure:V,contentTypeDataStructure:w,from:M,initialValues:W,isCreatingEntry:U,isLoadingForData:G,isSingleType:t,onPost:F,onPublish:K,onPut:$,onUnpublish:Y,readActionAllowedFields:f,redirectToPreviousPage:n,slug:a,status:q,updateActionAllowedFields:y},r.createElement(oe.Main,{"aria-busy":q!=="resolved"},r.createElement(Sh,{allowedActions:e}),r.createElement(X.ContentLayout,null,r.createElement(ie.Grid,{gap:4},r.createElement(ie.GridItem,{col:9,s:12},r.createElement(se.Stack,{spacing:6},C.map((Z,_)=>{if(x(Z)){const{0:{0:{name:T,fieldSchema:P,metadatas:Q,labelAction:re}}}=Z;return r.createElement(D.Box,{key:_},r.createElement(ie.Grid,{gap:4},r.createElement(ie.GridItem,{col:12,s:12,xs:12},r.createElement(my,{name:T,fieldSchema:P,labelAction:re,metadatas:Q}))))}return r.createElement(D.Box,{key:_,hasRadius:!0,background:"neutral0",shadow:"tableShadow",paddingLeft:6,paddingRight:6,paddingTop:6,paddingBottom:6,borderColor:"neutral150"},r.createElement(se.Stack,{spacing:6},Z.map((T,P)=>r.createElement(ie.Grid,{gap:4,key:P},T.map(({fieldSchema:Q,labelAction:re,metadatas:ce,name:me,size:Fe})=>{if(Q.type==="component"){const{component:z,max:de,min:je,repeatable:He=!1,required:ht=!1}=Q;return r.createElement(ie.GridItem,{col:Fe,s:12,xs:12,key:z},r.createElement(Jt,{componentUid:z,labelAction:re,isRepeatable:He,intlLabel:{id:ce.label,defaultMessage:ce.label},max:de,min:je,name:me,required:ht}))}return r.createElement(ie.GridItem,{col:Fe,key:me,s:12,xs:12},r.createElement(or,{fieldSchema:Q,keys:me,labelAction:re,metadatas:ce}))})))))}))),r.createElement(ie.GridItem,{col:3,s:12},r.createElement(se.Stack,{spacing:2},r.createElement(hh,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(Eh,null),r.createElement(Gt,{area:"contentManager.editView.informations"})),I>0&&r.createElement(D.Box,{as:"aside","aria-labelledby":"relations-title",background:"neutral0",borderColor:"neutral150",hasRadius:!0,paddingBottom:4,paddingLeft:4,paddingRight:4,paddingTop:6,shadow:"tableShadow"},r.createElement(L.Typography,{variant:"sigma",textColor:"neutral600",id:"relations-title"},d({id:v("containers.Edit.relations"),defaultMessage:"{number, plural, =0 {relations} one {relation} other {relations}}"},{number:I})),r.createElement(D.Box,{paddingTop:2,paddingBottom:6},r.createElement(Ut.Divider,null)),r.createElement(se.Stack,{spacing:4},S.map(({name:Z,fieldSchema:_,labelAction:T,metadatas:P,queryInfos:Q})=>r.createElement(Ks,Qh(gi(gi({},_),P),{key:Z,description:P.description,intlLabel:{id:P.label,defaultMessage:P.label},labelAction:T,name:Z,relationsType:_.relationType,queryInfos:Q,placeholder:P.placeholder?{id:P.placeholder,defaultMessage:P.placeholder}:null}))))),r.createElement(D.Box,{as:"aside","aria-labelledby":"links"},r.createElement(se.Stack,{spacing:2},r.createElement(Gt,{area:"contentManager.editView.right-links",slug:a}),a!=="strapi::administrator"&&r.createElement(g.CheckPermissions,{permissions:Kh},r.createElement(g.LinkButton,{onClick:()=>{c("willEditEditLayout")},size:"S",startIcon:r.createElement(it(),null),style:{width:"100%"},to:`/plugins/content-type-builder/content-types/${a}`,variant:"secondary"},d({id:v("link-to-ctb"),defaultMessage:"Edit the model"}))),r.createElement(g.CheckPermissions,{permissions:h},r.createElement(g.LinkButton,{size:"S",startIcon:r.createElement(Hu(),null),style:{width:"100%"},to:b,variant:"secondary"},d({id:"app.links.configure-view",defaultMessage:"Configure the view"}))),e.canDelete&&r.createElement(zh,{isCreatingEntry:U,onDelete:N,onDeleteSucceeded:H}))))))))))};Rr.defaultProps={id:null,isSingleType:!1,origin:null,userPermissions:[]},Rr.propTypes={allowedActions:o().shape({canRead:o().bool.isRequired,canUpdate:o().bool.isRequired,canCreate:o().bool.isRequired,canDelete:o().bool.isRequired}).isRequired,layout:o().shape({components:o().object.isRequired,contentType:o().shape({uid:o().string.isRequired,settings:o().object.isRequired,metadatas:o().object.isRequired,options:o().object.isRequired,attributes:o().object.isRequired}).isRequired}).isRequired,id:o().string,isSingleType:o().bool,goBack:o().func.isRequired,origin:o().string,slug:o().string.isRequired,userPermissions:o().array};const Yh=(0,r.memo)(Rr);var Jh=Object.defineProperty,Xh=Object.defineProperties,eb=Object.getOwnPropertyDescriptors,hi=Object.getOwnPropertySymbols,tb=Object.prototype.hasOwnProperty,nb=Object.prototype.propertyIsEnumerable,bi=(e,t,n)=>t in e?Jh(e,t,{enumerable:!0,configurable:!0,writable:!0,value:n}):e[t]=n,rb=(e,t)=>{for(var n in t||(t={}))tb.call(t,n)&&bi(e,n,t[n]);if(hi)for(var n of hi(t))nb.call(t,n)&&bi(e,n,t[n]);return e},ob=(e,t)=>Xh(e,eb(t));const Mr=e=>{const t=(0,r.useMemo)(()=>Co(e.slug),[e.slug]),{isLoading:n,allowedActions:s}=(0,g.useRBAC)(t,e.userPermissions);return n?r.createElement(g.LoadingIndicatorPage,null):r.createElement(Yh,ob(rb({},e),{allowedActions:s}))};Mr.defaultProps={permissions:[]},Mr.propTypes={permissions:o().array,slug:o().string.isRequired,userPermissions:o().array.isRequired};const sb=(0,r.memo)(Mr,We());var ab=Object.defineProperty,ib=Object.defineProperties,lb=Object.getOwnPropertyDescriptors,sn=Object.getOwnPropertySymbols,Ei=Object.prototype.hasOwnProperty,vi=Object.prototype.propertyIsEnumerable,Ci=(e,t,n)=>t in e?ab(e,t,{enumerable:!0,configurable:!0,writable:!0,value:n}):e[t]=n,cb=(e,t)=>{for(var n in t||(t={}))Ei.call(t,n)&&Ci(e,n,t[n]);if(sn)for(var n of sn(t))vi.call(t,n)&&Ci(e,n,t[n]);return e},ub=(e,t)=>ib(e,lb(t)),db=(e,t)=>{var n={};for(var s in e)Ei.call(e,s)&&t.indexOf(s)<0&&(n[s]=e[s]);if(e!=null&&sn)for(var s of sn(e))t.indexOf(s)<0&&vi.call(e,s)&&(n[s]=e[s]);return n};const Oi=e=>{var t=e,{layout:n}=t,s=db(t,["layout"]);const a=(0,fe.useSelector)(uo),l=(0,fe.useDispatch)(),[{query:i}]=(0,g.useQueryParams)(),{runHookWaterfall:u}=(0,g.useStrapiApp)(),c=Zo(i,s.slug,"editView");return(0,r.useEffect)(()=>{const d=u(zt.Eo,{layout:n,query:i});return l(Wu(d.layout,i)),()=>{l(qu())}},[n,l,i,u]),!a||!c?r.createElement(g.LoadingIndicatorPage,null):r.createElement(sb,ub(cb({},s),{layout:a,userPermissions:c}))};Oi.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 an=Oi;var Tr=p(84968),pb=p(23940),It=p.n(pb),mb=p(88423),Pi=p.n(mb),fb=p(3704),gb=p.n(fb),yb=Object.defineProperty,hb=Object.defineProperties,bb=Object.getOwnPropertyDescriptors,Ri=Object.getOwnPropertySymbols,Eb=Object.prototype.hasOwnProperty,vb=Object.prototype.propertyIsEnumerable,Mi=(e,t,n)=>t in e?yb(e,t,{enumerable:!0,configurable:!0,writable:!0,value:n}):e[t]=n,Cb=(e,t)=>{for(var n in t||(t={}))Eb.call(t,n)&&Mi(e,n,t[n]);if(Ri)for(var n of Ri(t))vb.call(t,n)&&Mi(e,n,t[n]);return e},Ob=(e,t)=>hb(e,bb(t));const wr=e=>e.reduce((t,n)=>t+n.size,0),Pb=e=>e.reduce((t,n,s)=>{const a={rowId:s,rowContent:n};return t.concat(a)},[]),gt=e=>e.reduce((t,n)=>{let s=[];const a=n.rowContent.reduce((u,c)=>{const d=wr(u);return c.name==="_TEMP_"||(d+c.size<=12?u.push(c):s.push(c)),u},[]),l=t.length===0?0:Math.max.apply(Math,t.map(u=>u.rowId))+1,i=wr(a);if(i<12&&a.push({name:"_TEMP_",size:12-i}),t.push({rowId:l,rowContent:a}),s.length>0){const u=wr(s);u<12&&s.push({name:"_TEMP_",size:12-u}),t.push({rowId:l+1,rowContent:s}),s=[]}return t},[]).filter(t=>t.rowContent.length>0).filter(t=>t.rowContent.length===1?t.rowContent[0].name!=="_TEMP_":!0),Rb=e=>e.reduce((t,n)=>{const s=n.rowContent.filter(a=>a.name!=="_TEMP_");return t.concat([s])},[]),Ti=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}},Mb=(e,t=[])=>t.reduce((n,{rowContent:s})=>{var a,l;const i=(l=(a=s.find(u=>u.name===e))==null?void 0:a.size)!=null?l:null;return i&&(n=i),n},null),Tb=(e,t,n=[])=>n.map(s=>(s.rowContent=s.rowContent.map(a=>a.name===e?Ob(Cb({},a),{size:t}):a),s)),Ir={fieldForm:{},componentLayouts:{},metaToEdit:"",initialData:{},metaForm:{},modifiedData:{}},wb=(e=Ir,t)=>(0,qt.default)(e,n=>{var s,a,l;const i=["modifiedData","layouts","edit"],u=["modifiedData","layouts","editRelations"];switch(t.type){case"ADD_RELATION":{const c=R()(e,u,[]);ne()(n,u,[...c,t.name]);break}case"MOVE_RELATION":{const c=R()(e,u,[]),{fromIndex:d,toIndex:m}=t;ne()(n,u,vt(c,d,m));break}case"MOVE_ROW":{const c=R()(e,i,[]),{fromIndex:d,toIndex:m}=t;ne()(n,i,vt(c,d,m));break}case"ON_ADD_FIELD":{const c=qe()(e),d=Ti(R()(c,["modifiedData","attributes",t.name,"type"],"")),m=R()(c,i,[]).length,f=[...i,m-1,"rowContent"],y=R()(c,f,[]);let h=R()(c,i,[]);Array.isArray(y)?ne()(h,[m>0?m-1:0,"rowContent"],[...y,{name:t.name,size:d}]):ne()(h,[m>0?m-1:0,"rowContent"],[{name:t.name,size:d}]);const b=gt(h);ne()(n,i,b);break}case"ON_CHANGE":{ne()(n,["modifiedData",...t.keys],t.value);break}case"ON_CHANGE_META":{ne()(n,["metaForm","metadata",...t.keys],t.value);break}case"ON_CHANGE_SIZE":{ne()(n,["metaForm","size"],t.value);break}case"ON_RESET":{n.modifiedData=e.initialData;break}case"REMOVE_FIELD":{const c=R()(e,[...i,t.rowIndex,"rowContent"],[]);let d=qe()(e);if(c.length===1||c.length===2&&R()(c,[1,"name"],"")==="_TEMP_"){const f=R()(e,i,[]);ne()(d,i,f.filter((y,h)=>t.rowIndex!==h))}else ne()(d,[...i,t.rowIndex,"rowContent"],c.filter((f,y)=>y!==t.fieldIndex));const m=gt(R()(d,i,[]));ne()(n,i,m);break}case"REMOVE_RELATION":{const c=R()(e,u,[]);ne()(n,u,c.filter((d,m)=>t.index!==m));break}case"REORDER_DIFF_ROW":{const c=R()(e,[...i,t.dragRowIndex,"rowContent"],[]),d=R()(e,[...i,t.hoverRowIndex,"rowContent"],[]),m=R()(e,[...i,t.dragRowIndex,"rowContent",t.dragIndex],{}),f=[...d,m];let y=qe()(e);ne()(y,[...i,t.dragRowIndex,"rowContent"],c.filter((b,E)=>t.dragIndex!==E)),ne()(y,[...i,t.hoverRowIndex,"rowContent"],vt(f,f.length-1,t.hoverIndex));const h=gt(R()(y,i,[]));ne()(n,i,h);break}case"REORDER_ROW":{const c=qe()(e),d=R()(c,[...i,t.dragRowIndex,"rowContent"],[]);ne()(c,[...i,t.dragRowIndex,"rowContent"],vt(d,t.dragIndex,t.hoverIndex));const m=gt(R()(c,i,[]));ne()(n,i,m);break}case"SET_FIELD_TO_EDIT":{n.metaToEdit=t.name,n.metaForm={metadata:R()(e,["modifiedData","metadatas",t.name,"edit"],{}),size:(l=Mb(t.name,(a=(s=e.modifiedData)==null?void 0:s.layouts)==null?void 0:a.edit))!=null?l:Ti()};break}case"SUBMIT_META_FORM":{ne()(n,["modifiedData","metadatas",e.metaToEdit,"edit"],e.metaForm.metadata);const c=qe()(R()(e,i,[])),d=Tb(e.metaToEdit,e.metaForm.size,c);d.length>0&&ne()(n,i,gt(d));break}case"SUBMIT_SUCCEEDED":{n.initialData=e.modifiedData;break}case"UNSET_FIELD_TO_EDIT":{n.metaToEdit="",n.metaForm={};break}default:return n}});var Ib=Object.defineProperty,Db=Object.defineProperties,xb=Object.getOwnPropertyDescriptors,wi=Object.getOwnPropertySymbols,Sb=Object.prototype.hasOwnProperty,Lb=Object.prototype.propertyIsEnumerable,Ii=(e,t,n)=>t in e?Ib(e,t,{enumerable:!0,configurable:!0,writable:!0,value:n}):e[t]=n,Fb=(e,t)=>{for(var n in t||(t={}))Sb.call(t,n)&&Ii(e,n,t[n]);if(wi)for(var n of wi(t))Lb.call(t,n)&&Ii(e,n,t[n]);return e},kb=(e,t)=>Db(e,xb(t));const Ab=(e,t,n)=>{let s=(0,B.cloneDeep)(t);return(0,B.set)(s,["layouts","edit"],gt(Pb(t.layouts.edit))),kb(Fb({},e),{initialData:s,modifiedData:s,componentLayouts:n})};var Ae=p(12611),jb=p(42258),Di=p.n(jb);const xi=({componentUid:e})=>{const{componentLayouts:t}=Ge(),{formatMessage:n}=(0,A.useIntl)(),s=R()(t,[e],{}),a=R()(s,["layouts","edit"],[]);return r.createElement(D.Box,{padding:3},a.map((l,i)=>r.createElement(ie.Grid,{gap:4,key:i},l.map(u=>r.createElement(ie.GridItem,{key:u.name,col:u.size},r.createElement(D.Box,{paddingTop:2},r.createElement(j.Flex,{alignItems:"center",background:"neutral0",paddingLeft:3,paddingRight:3,height:`${32/16}rem`,hasRadius:!0,borderColor:"neutral200"},r.createElement(L.Typography,{textColor:"neutral800"},u.name))))))),r.createElement(D.Box,{paddingTop:2},r.createElement(g.Link,{startIcon:r.createElement(Di(),null),to:`/content-manager/components/${e}/configurations/edit`},n({id:v("components.FieldItem.linkToComponentLayout"),defaultMessage:"Set the component's layout"}))))};xi.propTypes={componentUid:o().string.isRequired};const $b=xi,Si=(0,k.default)(j.Flex)`
|
|
993
|
+
border-radius: 50%;
|
|
994
|
+
svg {
|
|
995
|
+
& > * {
|
|
996
|
+
fill: ${({theme:e})=>e.colors.neutral500};
|
|
997
|
+
}
|
|
998
|
+
width: 12px;
|
|
999
|
+
height: 12px;
|
|
1000
|
+
}
|
|
1001
|
+
`,Bb=(0,k.default)(j.Flex)`
|
|
1002
|
+
text-decoration: none;
|
|
1003
|
+
&:hover {
|
|
1004
|
+
${({theme:e})=>`
|
|
1005
|
+
background: ${e.colors.primary100};
|
|
1006
|
+
svg {
|
|
1007
|
+
& > * {
|
|
1008
|
+
fill: ${e.colors.primary600};
|
|
1009
|
+
}
|
|
1010
|
+
}
|
|
1011
|
+
${L.Typography} {
|
|
1012
|
+
color: ${e.colors.primary600};
|
|
1013
|
+
}
|
|
1014
|
+
${Si} {
|
|
1015
|
+
background: ${e.colors.primary200};
|
|
1016
|
+
}
|
|
1017
|
+
border-color: ${e.colors.primary200};
|
|
1018
|
+
`}
|
|
1019
|
+
}
|
|
1020
|
+
`,Li=({components:e})=>{const{componentLayouts:t}=Ge();return r.createElement(se.Stack,{spacing:2,horizontal:!0,overflow:"scroll hidden",padding:3},e.map(n=>r.createElement(Bb,{hasRadius:!0,background:"neutral0",justifyContent:"center",alignItems:"center",height:`${84/16}rem`,minWidth:`${140/16}rem`,key:n,padding:2,direction:"column",borderColor:"neutral200",as:ee.Link,to:`/content-manager/components/${n}/configurations/edit`},r.createElement(Si,{width:`${32/16}rem`,height:`${32/16}rem`,background:"neutral150",justifyContent:"center",alignItems:"center",padding:2},r.createElement(xn.G,{icon:R()(t,[n,"info","icon"],"")})),r.createElement(D.Box,{paddingTop:1},r.createElement(L.Typography,{fontSize:1,textColor:"neutral600",fontWeight:"bold"},R()(t,[n,"info","displayName"],""))))))};Li.propTypes={components:o().arrayOf(o().string).isRequired};const Nb=Li,Fi=(0,k.default)(Me.IconButton)`
|
|
1021
|
+
background-color: transparent;
|
|
1022
|
+
path {
|
|
1023
|
+
fill: ${({theme:e})=>e.colors.neutral600};
|
|
1024
|
+
}
|
|
1025
|
+
`,Dr=({attribute:e,onEditField:t,onDeleteField:n,children:s})=>{const{formatMessage:a}=(0,A.useIntl)();return r.createElement(D.Box,{overflow:"hidden",width:"100%"},r.createElement(j.Flex,{paddingLeft:3,alignItems:"center",justifyContent:"space-between"},r.createElement(L.Typography,{fontWeight:"semiBold",textColor:"neutral800",ellipsis:!0},s),r.createElement(j.Flex,null,r.createElement(Fi,{label:a({id:v("containers.ListSettingsView.modal-form.edit-label"),defaultMessage:"Edit {fieldName}"},{fieldName:s}),onClick:t,icon:r.createElement(it(),null),noBorder:!0}),r.createElement(Fi,{label:a({id:"global.delete-target",defaultMessage:"Delete {target}"},{target:s}),"data-testid":"delete-field",onClick:n,icon:r.createElement(Be(),null),noBorder:!0}))),(e==null?void 0:e.type)==="component"&&r.createElement($b,{componentUid:e.component}),(e==null?void 0:e.type)==="dynamiczone"&&r.createElement(Nb,{components:e.components}))};Dr.defaultProps={attribute:void 0},Dr.propTypes={attribute:o().shape({components:o().array,component:o().string,type:o().string}),onEditField:o().func.isRequired,onDeleteField:o().func.isRequired,children:o().string.isRequired};const ki=Dr,Vb=(0,k.default)(j.Flex)`
|
|
1026
|
+
position: relative;
|
|
1027
|
+
${({isFirst:e,isLast:t,hasHorizontalPadding:n})=>e?`
|
|
1028
|
+
padding-right: 4px;
|
|
1029
|
+
`:t?`
|
|
1030
|
+
padding-left: 4px;
|
|
1031
|
+
`:n?`
|
|
1032
|
+
padding: 0 4px;
|
|
1033
|
+
`:""}
|
|
1034
|
+
${({showRightCarret:e,showLeftCarret:t,theme:n})=>e?`
|
|
1035
|
+
&:after {
|
|
1036
|
+
content: '';
|
|
1037
|
+
position: absolute;
|
|
1038
|
+
right: -1px;
|
|
1039
|
+
background-color: ${n.colors.primary600};
|
|
1040
|
+
width: 2px;
|
|
1041
|
+
height: 100%;
|
|
1042
|
+
align-self: stretch;
|
|
1043
|
+
z-index: 1;
|
|
1044
|
+
}
|
|
1045
|
+
`:t?`
|
|
1046
|
+
&:before {
|
|
1047
|
+
content: '';
|
|
1048
|
+
position: absolute;
|
|
1049
|
+
left: -1px;
|
|
1050
|
+
background-color: ${n.colors.primary600};
|
|
1051
|
+
width: 2px;
|
|
1052
|
+
height: 100%;
|
|
1053
|
+
align-self: stretch;
|
|
1054
|
+
z-index: 1;
|
|
1055
|
+
}
|
|
1056
|
+
`:""};
|
|
1057
|
+
`,qb=(0,k.default)(et())`
|
|
1058
|
+
height: ${12/16}rem;
|
|
1059
|
+
width: ${12/16}rem;
|
|
1060
|
+
path {
|
|
1061
|
+
fill: ${({theme:e})=>e.colors.neutral600};
|
|
1062
|
+
}
|
|
1063
|
+
`,Wb=(0,k.default)(j.Flex)`
|
|
1064
|
+
display: ${({dragStart:e})=>e?"none":"flex"};
|
|
1065
|
+
opacity: ${({isDragging:e,isFullSize:t,isHidden:n})=>e&&!t?.2:e&&t||n?0:1};
|
|
1066
|
+
`,zb=(0,k.default)(j.Flex)`
|
|
1067
|
+
cursor: all-scroll;
|
|
1068
|
+
border-right: 1px solid ${({theme:e})=>e.colors.neutral200};
|
|
1069
|
+
`,xr=({attribute:e,children:t,index:n,lastIndex:s,moveItem:a,moveRow:l,name:i,onDeleteField:u,onEditField:c,rowIndex:d,size:m})=>{const[f,y]=(0,r.useState)(!1),h=i==="_TEMP_",{setIsDraggingSibling:b}=Ge(),E=m===12,O=(0,r.useRef)(null),x=(0,r.useRef)(null),[{clientOffset:C,isOver:S},I]=(0,Te.useDrop)({accept:Pe.EDIT_FIELD,hover(M,q){if(!x.current||M.size!==12)return;const Z=q.getItem().index,_=n,T=q.getItem().rowIndex,P=d;if(Z===_&&T===P)return;const Q=x.current.getBoundingClientRect(),re=(Q.bottom-Q.top)/2,me=q.getClientOffset().y-Q.top;T<P&&me<re||T>P&&me>re||(l(T,P),M.rowIndex=P,M.itemIndex=_)},drop(M,q){if(!x.current)return;const Z=q.getItem().index,_=n,T=q.getItem().rowIndex,P=d;if(M.size===12||Z===_&&T===P)return;const Q=x.current.getBoundingClientRect();if(Math.abs(q.getClientOffset().x-Q.left)>Q.width/1.8){a(Z,_+1,T,P),M.itemIndex=_+1,M.rowIndex=P;return}a(Z,_,T,P),M.itemIndex=_,M.rowIndex=P},collect:M=>({canDrop:M.canDrop(),clientOffset:M.getClientOffset(),isOver:M.isOver(),isOverCurrent:M.isOver({shallow:!0}),itemType:M.getItemType()})}),[{isDragging:V,getItem:w},W,U]=(0,Te.useDrag)({type:Pe.EDIT_FIELD,item:()=>(b(!0),{index:n,labelField:t,rowIndex:d,name:i,size:m}),canDrag(){return i!=="_TEMP_"},collect:M=>({isDragging:M.isDragging(),getItem:M.getItem()}),end:()=>{b(!1)}});(0,r.useEffect)(()=>{U((0,Yt.rX)(),{captureDraggingState:!0})},[U]);const G={dragRef:W(O),dropRef:I(x)};let N=!1,H=!1;if(x.current&&C){const M=x.current.getBoundingClientRect();N=S&&w.size!==12&&Math.abs(C.x-M.left)<M.width/2,H=S&&w.size!==12&&Math.abs(C.x-M.left)>M.width/2,i==="_TEMP_"&&(N=S&&w.size!==12,H=!1)}const F=()=>e&&E?`${74/16}rem`:`${32/16}rem`,K=n===0&&!E,$=n===s&&!E,Y=n!==0&&!E;return r.createElement(ie.GridItem,{col:m},r.createElement(Vb,{ref:G.dropRef,showLeftCarret:N,showRightCarret:H,isFirst:K,isLast:$,hasHorizontalPadding:Y,onDrag:()=>{E&&!f&&y(!0)},onDragEnd:()=>{E&&y(!1)}},f&&E&&r.createElement(D.Box,{width:"100%",height:"2px",background:"primary600"}),r.createElement(Wb,{width:E&&f?0:"100%",borderColor:"neutral150",hasRadius:!0,background:"neutral100",minHeight:F(),alignItems:"stretch",isDragging:V,dragStart:f,isFullSize:E,isHidden:h},r.createElement(zb,{as:"span",type:"button",ref:G.dragRef,onClick:M=>M.stopPropagation(),alignItems:"center",paddingLeft:3,paddingRight:3,tabIndex:-1},r.createElement(qb,null)),!h&&r.createElement(ki,{attribute:e,onEditField:c,onDeleteField:u},t))))};xr.defaultProps={attribute:void 0},xr.propTypes={attribute:o().shape({components:o().array,component:o().string,type:o().string}),children:o().string.isRequired,index:o().number.isRequired,moveItem:o().func.isRequired,moveRow:o().func.isRequired,name:o().string.isRequired,onDeleteField:o().func.isRequired,onEditField:o().func.isRequired,rowIndex:o().number.isRequired,lastIndex:o().number.isRequired,size:o().number.isRequired};const Ub=xr,Ai=({rowItem:e,onRemoveField:t,rowId:n,rowIndex:s,index:a,lastIndex:l})=>{const{setEditFieldToSelect:i,attributes:u,modifiedData:c,moveRow:d,moveItem:m}=Ge(),f=R()(u,[e.name],{}),y=R()(c,["metadatas",e.name,"edit","label"],"");return r.createElement(Ub,{onEditField:()=>i(e.name),onDeleteField:()=>t(n,a),attribute:f,index:a,lastIndex:l,rowIndex:s,name:e.name,size:e.size,moveRow:d,moveItem:m},y||e.name)};Ai.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 Hb=Ai,ji=({row:e,onRemoveField:t,rowIndex:n})=>r.createElement(ie.Grid,null,e.rowContent.map((s,a)=>r.createElement(Hb,{key:s.name,rowItem:s,index:a,rowId:e.rowId,onRemoveField:t,rowIndex:n,lastIndex:e.rowContent.length-1})));ji.propTypes={onRemoveField:o().func.isRequired,row:o().object.isRequired,rowIndex:o().number.isRequired};const Gb=ji,Zb=[{action:"plugin::content-type-builder.read",subject:null}],_b=()=>{const{trackUsage:e}=(0,g.useTracking)(),{formatMessage:t}=(0,A.useIntl)(),{slug:n,modifiedData:s,isContentTypeView:a}=Ge(),l=a?"content-types":"components",i=`/plugins/content-type-builder/${l==="content-types"?l:"component-categories"}`,u=R()(s,"category",""),c=l==="content-types"?n:`${u}/${n}`,d=()=>{e("willEditEditLayout")};return n==="strapi::administrator"?null:r.createElement(g.CheckPermissions,{permissions:Zb},r.createElement(g.LinkButton,{to:`${i}/${c}`,onClick:d,size:"S",startIcon:r.createElement(it(),null),variant:"secondary"},t({id:v(`edit-settings-view.link-to-ctb.${l}`),defaultMessage:"Edit the content type"})))},$i=({editLayout:e,editLayoutRemainingFields:t,onRemoveField:n,onAddField:s})=>{const{formatMessage:a}=(0,A.useIntl)();return r.createElement(se.Stack,{spacing:4},r.createElement(j.Flex,{justifyContent:"space-between"},r.createElement("div",null,r.createElement(D.Box,null,r.createElement(L.Typography,{fontWeight:"bold"},a({id:v("containers.ListPage.displayedFields"),defaultMessage:"Displayed fields"}))),r.createElement(D.Box,null,r.createElement(L.Typography,{variant:"pi",textColor:"neutral600"},a({id:"containers.SettingPage.editSettings.description",defaultMessage:"Drag & drop the fields to build the layout"})))),r.createElement(_b,null)),r.createElement(D.Box,{padding:4,hasRadius:!0,borderStyle:"dashed",borderWidth:"1px",borderColor:"neutral300"},r.createElement(se.Stack,{spacing:2},e.map((l,i)=>r.createElement(Gb,{key:l.rowId,row:l,rowIndex:i,onRemoveField:n})),r.createElement(Ae.SimpleMenu,{id:"label",label:a({id:v("containers.SettingPage.add.field"),defaultMessage:"Insert another field"}),as:ye.Button,"data-testid":"add-field",fullWidth:!0,startIcon:r.createElement(ut(),null),endIcon:null,variant:"secondary",disabled:t.length===0},t.map(l=>r.createElement(Ae.MenuItem,{key:l,onClick:()=>s(l)},l))))))};$i.propTypes={editLayout:o().array.isRequired,editLayoutRemainingFields:o().array.isRequired,onAddField:o().func.isRequired,onRemoveField:o().func.isRequired};const Qb=$i,Kb=(0,k.default)(et())`
|
|
1070
|
+
height: ${12/16}rem;
|
|
1071
|
+
width: ${12/16}rem;
|
|
1072
|
+
path {
|
|
1073
|
+
fill: ${({theme:e})=>e.colors.neutral600};
|
|
1074
|
+
}
|
|
1075
|
+
`,Yb=(0,k.default)(j.Flex)`
|
|
1076
|
+
opacity: ${({isDragging:e})=>e?0:1};
|
|
1077
|
+
`,Jb=(0,k.default)(j.Flex)`
|
|
1078
|
+
cursor: all-scroll;
|
|
1079
|
+
border-right: 1px solid ${({theme:e})=>e.colors.neutral200};
|
|
1080
|
+
`,Sr=({attribute:e,onEditField:t,onDeleteField:n,children:s,index:a,name:l,onMoveField:i})=>{const u=(0,r.useRef)(),[,c]=(0,Te.useDrop)({accept:Pe.EDIT_RELATION,hover(h){if(!u.current)return;const b=h.index,E=a;b!==E&&(i(b,E),h.index=E)}}),[{isDragging:d},m,f]=(0,Te.useDrag)({type:Pe.EDIT_RELATION,item:()=>({index:a,labelField:s,name:l}),collect:h=>({isDragging:h.isDragging()})});(0,r.useEffect)(()=>{f((0,Yt.rX)(),{captureDraggingState:!0})},[f]),m(c(u));const y=()=>e&&["json","text","file","media","component","richtext","dynamiczone"].includes(e.type)?`${74/16}rem`:`${32/16}rem`;return r.createElement(Yb,{width:"100%",borderColor:"neutral150",hasRadius:!0,background:"neutral100",minHeight:y(),alignItems:"stretch",isDragging:d},r.createElement(Jb,{as:"span",type:"button",ref:u,onClick:h=>h.stopPropagation(),alignItems:"center",paddingLeft:3,paddingRight:3,tabIndex:-1},r.createElement(Kb,null)),r.createElement(ki,{attribute:e,onEditField:t,onDeleteField:n},s))};Sr.defaultProps={attribute:void 0},Sr.propTypes={attribute:o().shape({components:o().array,component:o().string,type:o().string}),onEditField:o().func.isRequired,onDeleteField:o().func.isRequired,children:o().string.isRequired,index:o().number.isRequired,name:o().string.isRequired,onMoveField:o().func.isRequired};const Xb=Sr,Bi=({relationsLayout:e,editRelationsLayoutRemainingFields:t,onRemoveField:n,onAddField:s})=>{const{formatMessage:a}=(0,A.useIntl)(),{setEditFieldToSelect:l,modifiedData:i,onMoveRelation:u}=Ge();return r.createElement(se.Stack,{spacing:4},r.createElement("div",null,r.createElement(D.Box,null,r.createElement(L.Typography,{fontWeight:"bold"},a({id:v("containers.SettingPage.relations"),defaultMessage:"Relational fields"}))),r.createElement(D.Box,null,r.createElement(L.Typography,{variant:"pi",textColor:"neutral600"},a({id:"containers.SettingPage.editSettings.description",defaultMessage:"Drag & drop the fields to build the layout"})))),r.createElement(D.Box,{padding:4,hasRadius:!0,borderStyle:"dashed",borderWidth:"1px",borderColor:"neutral300"},r.createElement(se.Stack,{spacing:2},e.map((c,d)=>{const m=R()(i,["metadatas",c,"edit","label"],"");return r.createElement(Xb,{onEditField:()=>l(c),onDeleteField:()=>n(d),key:c,index:d,name:c,onMoveField:u},m||c)}),r.createElement(Ae.SimpleMenu,{id:"label",label:a({id:"containers.SettingPage.add.relational-field",defaultMessage:"Insert another relational field"}),"data-testid":"add-relation",as:ye.Button,fullWidth:!0,startIcon:r.createElement(ut(),null),endIcon:null,variant:"secondary",disabled:t.length===0},t.map(c=>r.createElement(Ae.MenuItem,{id:`menuItem-${c}`,key:`menuItem-${c}`,onClick:()=>s(c)},c))))))};Bi.propTypes={relationsLayout:o().array.isRequired,editRelationsLayoutRemainingFields:o().array.isRequired,onRemoveField:o().func.isRequired,onAddField:o().func.isRequired};const eE=Bi;var _e=p(4122),tE=p(61714),ln=p.n(tE),nE=p(9895),rE=p.n(nE),oE=p(34103),sE=p.n(oE),aE=p(57290),Ni=p.n(aE),iE=p(55788),Lr=p.n(iE),lE=p(81208),cE=p.n(lE),uE=p(65232),Fr=p.n(uE),dE=p(80268),pE=p.n(dE),mE=p(42122),Dt=p.n(mE),fE=p(57955),gE=p.n(fE),yE=p(10822),hE=p.n(yE),bE=p(80466),EE=p.n(bE);const vE={biginteger:r.createElement(Dt(),null),boolean:r.createElement(rE(),null),date:r.createElement(ln(),null),datetime:r.createElement(ln(),null),decimal:r.createElement(Dt(),null),email:r.createElement(sE(),null),enum:r.createElement(Ni(),null),enumeration:r.createElement(Ni(),null),file:r.createElement(Lr(),null),files:r.createElement(Lr(),null),float:r.createElement(Dt(),null),integer:r.createElement(Dt(),null),media:r.createElement(Lr(),null),number:r.createElement(Dt(),null),relation:r.createElement(cE(),null),string:r.createElement(Fr(),null),text:r.createElement(Fr(),null),richtext:r.createElement(Fr(),null),time:r.createElement(ln(),null),timestamp:r.createElement(ln(),null),json:r.createElement(gE(),null),uid:r.createElement(pE(),null),component:r.createElement(hE(),null),dynamiczone:r.createElement(EE(),null)},Vi=({type:e})=>vE[e]||null;Vi.propTypes={type:o().string.isRequired};const qi=Vi,CE=e=>e.reduce((t,n)=>{const s=(0,B.get)(n,["attributes"],{}),a=Object.keys(s).filter(l=>!["boolean","component","dynamiczone","json","media","password","relation","text","richtext"].includes((0,B.get)(s,[l,"type"],"")));return t[n.uid]=a,t},{}),Wi=e=>{let t;switch(e){case"description":case"label":case"placeholder":t="text";break;case"mainField":t="select";break;case"editable":t="bool";break;default:t=""}const n=v(e==="mainField"?"containers.SettingPage.editSettings.entry.title":`form.Input.${e}`);return{type:t,label:{id:n}}};var xt=p(63865),OE=Object.defineProperty,cn=Object.getOwnPropertySymbols,zi=Object.prototype.hasOwnProperty,Ui=Object.prototype.propertyIsEnumerable,Hi=(e,t,n)=>t in e?OE(e,t,{enumerable:!0,configurable:!0,writable:!0,value:n}):e[t]=n,kr=(e,t)=>{for(var n in t||(t={}))zi.call(t,n)&&Hi(e,n,t[n]);if(cn)for(var n of cn(t))Ui.call(t,n)&&Hi(e,n,t[n]);return e},PE=(e,t)=>{var n={};for(var s in e)zi.call(e,s)&&t.indexOf(s)<0&&(n[s]=e[s]);if(e!=null&&cn)for(var s of cn(e))t.indexOf(s)<0&&Ui.call(e,s)&&(n[s]=e[s]);return n};const Ar=e=>{var t=e,{type:n,options:s,onChange:a,value:l,name:i}=t,u=PE(t,["type","options","onChange","value","name"]);const{formatMessage:c}=(0,A.useIntl)();switch(n){case"text":return r.createElement(Un.TextInput,kr({onChange:a,value:l,name:i},u));case"bool":return r.createElement(xt.ToggleInput,kr({onChange:d=>{a({target:{name:i,value:d.target.checked}})},checked:l,name:i,onLabel:c({id:"app.components.ToggleCheckbox.on-label",defaultMessage:"On"}),offLabel:c({id:"app.components.ToggleCheckbox.off-label",defaultMessage:"Off"})},u));case"select":return r.createElement(ue.Select,kr({value:l,name:i,onChange:d=>a({target:{name:i,value:d}})},u),s.map(d=>r.createElement(ue.Option,{key:d,value:d},d)));default:return null}};Ar.defaultProps={options:void 0},Ar.propTypes={type:o().string.isRequired,options:o().arrayOf(o().string),onChange:o().func.isRequired,value:o().oneOfType([o().string,o().bool]).isRequired,name:o().string.isRequired};const RE=Ar,ME=[[4,"33%"],[6,"50%"],[8,"66%"],[12,"100%"]],TE=["dynamiczone","component","json","richtext"],Gi=({onMetaChange:e,onSizeChange:t})=>{const{formatMessage:n}=(0,A.useIntl)(),{modifiedData:s,selectedField:a,attributes:l,fieldForm:i}=Ge(),u=(0,r.useMemo)(Mn,[]),{schemas:c}=(0,fe.useSelector)(E=>u(E),fe.shallowEqual),d=(0,r.useMemo)(()=>{if(!a)return[];const E=R()(s,["metadatas",a,"edit"],{});return Object.keys(E).filter(O=>O!=="visible")},[a,s]),m=(0,r.useMemo)(()=>CE(c),[c]),f=(0,r.useCallback)(E=>{if(E!=="relation"&&E!=="component")return[];const O=E==="component"?"component":"targetModel",x=R()(s,["attributes",a,O],"");return R()(m,[x],[])},[a,m,s]),y=d.map(E=>{const O=R()(l,[a,"type"]);return O==="dynamiczone"||O==="component"&&!["label","description"].includes(E)||O==="component"&&E!=="label"||["media","json","boolean"].includes(O)&&E==="placeholder"?null:r.createElement(ie.GridItem,{col:6,key:E},r.createElement(RE,{type:Wi(E).type,hint:E==="mainField"?n({id:v("containers.SettingPage.editSettings.relation-field.description")}):"",label:n({id:R()(Wi(E),"label.id","app.utils.defaultMessage")}),name:E,onChange:e,value:R()(i,["metadata",E],""),options:f(O)}))}),h=!TE.includes(l[a].type),b=r.createElement(ie.GridItem,{col:6,key:"size"},r.createElement(ue.Select,{value:i==null?void 0:i.size,name:"size",onChange:E=>{t({name:a,value:E})},label:n({id:v("containers.SettingPage.editSettings.size.label"),defaultMessage:"Size"})},ME.map(([E,O])=>r.createElement(ue.Option,{key:E,value:E},O))));return r.createElement(r.Fragment,null,y,h&&b)};Gi.propTypes={onMetaChange:o().func.isRequired,onSizeChange:o().func.isRequired};const wE=Gi,IE=(0,k.default)(j.Flex)`
|
|
1081
|
+
svg {
|
|
1082
|
+
width: ${32/16}rem;
|
|
1083
|
+
height: ${24/16}rem;
|
|
1084
|
+
margin-right: ${({theme:e})=>e.spaces[3]};
|
|
1085
|
+
}
|
|
1086
|
+
`,Zi=({onToggle:e,onMetaChange:t,onSizeChange:n,onSubmit:s,type:a})=>{const{selectedField:l}=Ge(),{formatMessage:i}=(0,A.useIntl)(),u=()=>a==="timestamp"?"date":["decimal","float","integer","biginter"].includes(a)?"number":a;return r.createElement(_e.ModalLayout,{onClose:e,labelledBy:"title"},r.createElement("form",{onSubmit:s},r.createElement(_e.ModalHeader,null,r.createElement(IE,null,r.createElement(qi,{type:u(a)}),r.createElement(L.Typography,{fontWeight:"bold",textColor:"neutral800",as:"h2",id:"title"},i({id:v("containers.ListSettingsView.modal-form.edit-label"),defaultMessage:"Edit {fieldName}"},{fieldName:It()(l)})))),r.createElement(_e.ModalBody,null,r.createElement(ie.Grid,{gap:4},r.createElement(wE,{onMetaChange:t,onSizeChange:n}))),r.createElement(_e.ModalFooter,{startActions:r.createElement(ye.Button,{onClick:e,variant:"tertiary"},i({id:"app.components.Button.cancel",defaultMessage:"Cancel"})),endActions:r.createElement(ye.Button,{type:"submit"},i({id:"global.finish",defaultMessage:"Finish"}))})))};Zi.propTypes={onSubmit:o().func.isRequired,onToggle:o().func.isRequired,onMetaChange:o().func.isRequired,onSizeChange:o().func.isRequired,type:o().string.isRequired};const DE=Zi,xE=(e,t,n)=>ge.be.put(ve(n?`content-types/${t}/configuration`:`components/${t}/configuration`),e),jr=({mainLayout:e,components:t,isContentTypeView:n,slug:s,updateLayout:a})=>{const[l,i]=(0,r.useReducer)(wb,Ir,()=>Ab(Ir,e,t)),[u,c]=(0,r.useState)(!1),{trackUsage:d}=(0,g.useTracking)(),m=(0,g.useNotification)(),{goBack:f}=(0,ee.useHistory)(),[y,h]=(0,r.useState)(!1),[b,E]=(0,r.useState)(!1),{componentLayouts:O,initialData:x,modifiedData:C,metaToEdit:S,metaForm:I}=l,{formatMessage:V}=(0,A.useIntl)(),w=R()(e,["info","displayName"],""),W=R()(C,["attributes"],{}),U=Object.keys(W).filter(z=>{const de=R()(W,[z,"type"],"");return!["dynamiczone","json","text","relation","component","boolean","media","password","richtext","timestamp"].includes(de)&&!!de}),G=R()(C,["layouts","edit"],[]),N=gb()(G,"rowContent"),H=Object.keys(C.attributes).filter(z=>n?R()(C,["attributes",z,"type"],"")!=="relation":!0).filter(z=>R()(C,["metadatas",z,"edit","visible"],!1)===!0).filter(z=>N.findIndex(de=>de.name===z)===-1).sort(),F=R()(C,["layouts","editRelations"],[]),K=Object.keys(W).filter(z=>W[z].type==="relation").filter(z=>F.indexOf(z)===-1),$=({target:{name:z,value:de}})=>{i({type:"ON_CHANGE",keys:z.split("."),value:de})},Y=()=>{h(z=>!z)},M=()=>{E(z=>!z)},q=({target:{name:z,value:de}})=>{i({type:"ON_CHANGE_META",keys:z.split("."),value:de})},Z=({name:z,value:de})=>{i({type:"ON_CHANGE_SIZE",name:z,value:de})},_=z=>{z.preventDefault(),i({type:"SUBMIT_META_FORM"}),Y()},T=z=>{z.preventDefault(),M()},P=(0,Tr.useMutation)(z=>xE(z,s,n),{onSuccess:({data:z})=>{a&&a(z.data),i({type:"SUBMIT_SUCCEEDED"}),M(),d("didEditEditSettings")},onError:()=>{m({type:"warning",message:{id:"notification.error"}})}}),{isLoading:Q}=P,re=()=>{const z=Pi()(qe()(C),["layouts","metadatas","settings"]);ne()(z,"layouts.edit",Rb(z.layouts.edit)),P.mutate(z)},ce=(z,de)=>{i({type:"MOVE_RELATION",fromIndex:z,toIndex:de})},me=(z,de)=>{i({type:"MOVE_FIELD",fromIndex:z,toIndex:de})},Fe=(z,de,je,He)=>{i(je===He?{type:"REORDER_ROW",dragRowIndex:je,dragIndex:z,hoverIndex:de}:{type:"REORDER_DIFF_ROW",dragIndex:z,hoverIndex:de,dragRowIndex:je,hoverRowIndex:He})},rt=(z,de)=>{i({type:"MOVE_ROW",fromIndex:z,toIndex:de})};return r.createElement(Xe,{isContentTypeView:n,attributes:W,modifiedData:C,slug:s,componentLayouts:O,selectedField:S,fieldForm:I,onMoveRelation:ce,onMoveField:me,moveRow:rt,moveItem:Fe,setEditFieldToSelect:z=>{i({type:"SET_FIELD_TO_EDIT",name:z}),Y()},isDraggingSibling:u,setIsDraggingSibling:c},r.createElement(oe.Main,null,r.createElement("form",{onSubmit:T},r.createElement(X.HeaderLayout,{title:V({id:v("components.SettingsViewWrapper.pluginHeader.title"),defaultMessage:`Configure the view - ${It()(w)}`},{name:It()(w)}),subtitle:V({id:v("components.SettingsViewWrapper.pluginHeader.description.edit-settings"),defaultMessage:"Customize how the edit view will look like."}),navigationAction:r.createElement(g.Link,{startIcon:r.createElement(on(),null),onClick:z=>{z.preventDefault(),f()},to:"/"},V({id:"global.back",defaultMessage:"Back"})),primaryAction:r.createElement(ye.Button,{disabled:en()(x,C),startIcon:r.createElement(ft(),null),type:"submit"},V({id:"global.save",defaultMessage:"Save"}))}),r.createElement(X.ContentLayout,null,r.createElement(D.Box,{background:"neutral0",hasRadius:!0,shadow:"filterShadow",paddingTop:6,paddingBottom:6,paddingLeft:7,paddingRight:7},r.createElement(se.Stack,{spacing:4},r.createElement(L.Typography,{variant:"delta",as:"h2"},V({id:v("containers.SettingPage.settings"),defaultMessage:"Settings"})),r.createElement(ie.Grid,null,r.createElement(ie.GridItem,{col:6,s:12},r.createElement(ue.Select,{label:V({id:v("containers.SettingPage.editSettings.entry.title"),defaultMessage:"Entry title"}),hint:V({id:v("containers.SettingPage.editSettings.entry.title.description"),defaultMessage:"Set the display field of your entry"}),onChange:z=>{$({target:{name:"settings.mainField",value:z===""?null:z}})},value:C.settings.mainField},U.map(z=>r.createElement(ue.Option,{key:z,value:z},z))))),r.createElement(D.Box,{paddingTop:2,paddingBottom:2},r.createElement(Ut.Divider,null)),r.createElement(L.Typography,{variant:"delta",as:"h3"},V({id:v("containers.SettingPage.view"),defaultMessage:"View"})),r.createElement(ie.Grid,{gap:4},r.createElement(ie.GridItem,{col:n?8:12,s:12},r.createElement(Qb,{attributes:W,editLayout:G,editLayoutRemainingFields:H,onAddField:z=>{i({type:"ON_ADD_FIELD",name:z})},onRemoveField:(z,de)=>{i({type:"REMOVE_FIELD",rowIndex:z,fieldIndex:de})}})),n&&r.createElement(ie.GridItem,{col:4,s:12},r.createElement(eE,{editRelationsLayoutRemainingFields:K,relationsLayout:F,onAddField:z=>i({type:"ADD_RELATION",name:z}),onRemoveField:z=>i({type:"REMOVE_RELATION",index:z})})))))),r.createElement(g.ConfirmDialog,{bodyText:{id:v("popUpWarning.warning.updateAllSettings"),defaultMessage:"This will modify all your settings"},iconRightButton:r.createElement(ft(),null),isConfirmButtonLoading:Q,isOpen:b,onToggleDialog:M,onConfirm:re,variantRightButton:"success-light"})),y&&r.createElement(DE,{onSubmit:_,onToggle:Y,type:R()(W,[S,"type"],""),onMetaChange:q,onSizeChange:Z})))};jr.defaultProps={isContentTypeView:!1,updateLayout:null},jr.propTypes={components:o().object.isRequired,isContentTypeView:o().bool,mainLayout:o().shape({attributes:o().object.isRequired,info:o().object.isRequired,layouts:o().shape({list:o().array.isRequired,editRelations:o().array.isRequired,edit:o().array.isRequired}).isRequired,metadatas:o().object.isRequired,options:o().object.isRequired}).isRequired,slug:o().string.isRequired,updateLayout:o().func};const $r=jr;var yt=p(37617);const SE=()=>({type:yt.ZA}),LE=(e,t)=>({type:yt.Id,pagination:e,data:t}),FE=()=>({type:yt.MP});function kE(){return{type:yt.c2}}const AE=({components:e,contentType:t})=>{const{layouts:n}=t;return{contentType:t,components:e,displayedHeaders:n.list,type:yt.Zz}},Br=e=>({type:yt.Rp,target:e});var _i=p(13055),Nr=p(29270),jE=p(70664);const $E=()=>e=>e["content-manager_listView"]||jE.E,BE=()=>(0,Rn.P1)($E(),e=>e),Qi=e=>{const{displayedHeaders:t}=e["content-manager_listView"];return t},NE=BE,Ki=({isPublished:e})=>{const{formatMessage:t}=(0,A.useIntl)(),n=t({id:v(`containers.List.${e?"published":"draft"}`)}),s=e?"success100":"secondary100",a=e?"success700":"secondary700";return r.createElement(D.Box,{background:s,hasRadius:!0,paddingTop:1,paddingBottom:1,paddingLeft:2,paddingRight:2,style:{width:"fit-content"}},r.createElement(L.Typography,{fontWeight:"bold",textColor:a},n))};Ki.propTypes={isPublished:o().bool.isRequired};const VE=Ki;var qE=p(35980),St=p(53214),WE=p(68192),zE=p.n(WE),Yi=p(9667),UE=Object.defineProperty,un=Object.getOwnPropertySymbols,Ji=Object.prototype.hasOwnProperty,Xi=Object.prototype.propertyIsEnumerable,el=(e,t,n)=>t in e?UE(e,t,{enumerable:!0,configurable:!0,writable:!0,value:n}):e[t]=n,HE=(e,t)=>{for(var n in t||(t={}))Ji.call(t,n)&&el(e,n,t[n]);if(un)for(var n of un(t))Xi.call(t,n)&&el(e,n,t[n]);return e},GE=(e,t)=>{var n={};for(var s in e)Ji.call(e,s)&&t.indexOf(s)<0&&(n[s]=e[s]);if(e!=null&&un)for(var s of un(e))t.indexOf(s)<0&&Xi.call(e,s)&&(n[s]=e[s]);return n};const ZE=(0,k.default)(j.Flex)`
|
|
1087
|
+
position: relative;
|
|
1088
|
+
border-radius: 50%;
|
|
1089
|
+
width: 26px;
|
|
1090
|
+
height: 26px;
|
|
1091
|
+
border: 1px solid ${({theme:e})=>e.colors.neutral200};
|
|
1092
|
+
background: ${({theme:e})=>e.colors.neutral150};
|
|
1093
|
+
padding-left: 1px;
|
|
1094
|
+
|
|
1095
|
+
span {
|
|
1096
|
+
line-height: 0.6rem;
|
|
1097
|
+
font-size: 0.6rem;
|
|
1098
|
+
}
|
|
1099
|
+
`,tl=e=>{var t=e,{children:n}=t,s=GE(t,["children"]);return r.createElement(ZE,HE({justifyContent:"center",alignItems:"center",as:"span"},s),r.createElement(L.Typography,{variant:"sigma",textColor:"neutral600"},n))};tl.propTypes={children:o().string.isRequired};const nl=tl,Vr=({url:e,mime:t,alternativeText:n,name:s,ext:a,formats:l})=>{var i;const u=(0,g.prefixFileUrlWithBackendUrl)(e);if(t.includes("image")){const m=((i=l==null?void 0:l.thumbnail)==null?void 0:i.url)||null,f=(0,g.prefixFileUrlWithBackendUrl)(m)||u;return r.createElement(Yi.Avatar,{src:f,alt:n||s,preview:!0})}const c=(0,g.getFileExtension)(a),d=s.length>100?`${s.substring(0,100)}...`:s;return r.createElement(ar.Tooltip,{description:d},r.createElement(nl,null,c))};Vr.defaultProps={alternativeText:null,formats:null},Vr.propTypes={alternativeText:o().string,ext:o().string.isRequired,formats:o().object,mime:o().string.isRequired,name:o().string.isRequired,url:o().string.isRequired};const rl=Vr;var _E=Object.defineProperty,ol=Object.getOwnPropertySymbols,QE=Object.prototype.hasOwnProperty,KE=Object.prototype.propertyIsEnumerable,sl=(e,t,n)=>t in e?_E(e,t,{enumerable:!0,configurable:!0,writable:!0,value:n}):e[t]=n,YE=(e,t)=>{for(var n in t||(t={}))QE.call(t,n)&&sl(e,n,t[n]);if(ol)for(var n of ol(t))KE.call(t,n)&&sl(e,n,t[n]);return e};const al=({value:e})=>r.createElement(Yi.AvatarGroup,null,e.map((t,n)=>{const s=`${t.id}${n}`;if(n===3){const a=`+${e.length-3}`;return r.createElement(nl,{key:s,preview:!1},a)}return n>3?null:r.createElement(rl,YE({key:s},t))}));al.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 JE=al;var il=p(89557),XE=p(82910),e0=p(51064),t0=p.n(e0);const n0=e=>e%1!==0?e.toString().split(".")[1].length:0,ll=({type:e,value:t})=>{const{formatDate:n,formatTime:s,formatNumber:a}=(0,A.useIntl)();let l=t;if(e==="date"&&(l=n(t0()(t),{dateStyle:"full"})),e==="datetime"&&(l=n(t,{dateStyle:"full",timeStyle:"short"})),e==="time"){const[i,u,c]=t.split(":"),d=new Date;d.setHours(i),d.setMinutes(u),d.setSeconds(c),l=s(d,{numeric:"auto",style:"short"})}if(["float","decimal"].includes(e)){const i=n0(t);l=a(t,{minimumFractionDigits:i,maximumFractionDigits:i})}return["integer","biginteger"].includes(e)&&(l=a(t,{maximumFractionDigits:0})),ia()(l)};ll.propTypes={type:o().string.isRequired,value:o().any.isRequired};const Lt=ll;var r0=Object.defineProperty,cl=Object.getOwnPropertySymbols,o0=Object.prototype.hasOwnProperty,s0=Object.prototype.propertyIsEnumerable,ul=(e,t,n)=>t in e?r0(e,t,{enumerable:!0,configurable:!0,writable:!0,value:n}):e[t]=n,a0=(e,t)=>{for(var n in t||(t={}))o0.call(t,n)&&ul(e,n,t[n]);if(cl)for(var n of cl(t))s0.call(t,n)&&ul(e,n,t[n]);return e},i0=(e,t,n)=>new Promise((s,a)=>{var l=c=>{try{u(n.next(c))}catch(d){a(d)}},i=c=>{try{u(n.throw(c))}catch(d){a(d)}},u=c=>c.done?s(c.value):Promise.resolve(c.value).then(l,i);u((n=n.apply(e,t)).next())});const l0=(0,k.default)(L.Typography)`
|
|
1100
|
+
max-width: 500px;
|
|
1101
|
+
`,c0=(e,t)=>i0(void 0,null,function*(){const{data:{results:n,pagination:s}}=yield ge.be.get(e);return t(),{results:n,pagination:s}}),dl=({fieldSchema:e,metadatas:t,queryInfos:n,name:s,rowId:a,value:l})=>{const{formatMessage:i}=(0,A.useIntl)(),{notifyStatus:u}=(0,Nr.useNotifyAT)(),c=ve(`${n.endPoint}/${a}/${s.split(".")[0]}`),[d,m]=(0,r.useState)(!1),f=r.createElement(r.Fragment,null,r.createElement(il.Badge,null,l.count)," ",i({id:"content-manager.containers.ListPage.items",defaultMessage:"{number, plural, =0 {items} one {item} other {items}}"},{number:l.count})),y=()=>{const E=i({id:v("DynamicTable.relation-loaded"),defaultMessage:"Relations have been loaded"});u(E)},{data:h,status:b}=(0,Tr.useQuery)([e.targetModel,a],()=>c0(c,y),{enabled:d,staleTime:0});return r.createElement(D.Box,a0({},g.stopPropagation),r.createElement(Ae.SimpleMenu,{label:f,size:"S",onOpen:()=>m(!0),onClose:()=>m(!1)},b!=="success"&&r.createElement(Ae.MenuItem,{"aria-disabled":!0},r.createElement(XE.Loader,{small:!0},i({id:v("DynamicTable.relation-loading"),defaultMessage:"Relations are loading"}))),b==="success"&&r.createElement(r.Fragment,null,h==null?void 0:h.results.map(E=>r.createElement(Ae.MenuItem,{key:E.id,"aria-disabled":!0},r.createElement(l0,{ellipsis:!0},r.createElement(Lt,{type:t.mainField.schema.type,value:E[t.mainField.name]||E.id})))),(h==null?void 0:h.pagination.total)>10&&r.createElement(Ae.MenuItem,{"aria-disabled":!0,"aria-label":i({id:v("DynamicTable.relation-more"),defaultMessage:"This relation contains more entities than displayed"})},r.createElement(L.Typography,null,"...")))))};dl.propTypes={fieldSchema:o().shape({relation:o().string,targetModel:o().string,type:o().string.isRequired}).isRequired,metadatas:o().shape({mainField:o().shape({name:o().string.isRequired,schema:o().shape({type:o().string.isRequired}).isRequired})}).isRequired,name:o().string.isRequired,rowId:o().oneOfType([o().string,o().number]).isRequired,queryInfos:o().shape({endPoint:o().string.isRequired}).isRequired,value:o().object.isRequired};const u0=dl,d0=(0,k.default)(L.Typography)`
|
|
1102
|
+
max-width: 500px;
|
|
1103
|
+
`,pl=({metadatas:e,value:t})=>r.createElement(d0,{textColor:"neutral800",ellipsis:!0},r.createElement(Lt,{type:e.mainField.schema.type,value:t[e.mainField.name]||t.id}));pl.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 p0=pl;var m0=Object.defineProperty,ml=Object.getOwnPropertySymbols,f0=Object.prototype.hasOwnProperty,g0=Object.prototype.propertyIsEnumerable,fl=(e,t,n)=>t in e?m0(e,t,{enumerable:!0,configurable:!0,writable:!0,value:n}):e[t]=n,y0=(e,t)=>{for(var n in t||(t={}))f0.call(t,n)&&fl(e,n,t[n]);if(ml)for(var n of ml(t))g0.call(t,n)&&fl(e,n,t[n]);return e};const h0=(0,k.default)(L.Typography)`
|
|
1104
|
+
max-width: 500px;
|
|
1105
|
+
`,gl=({value:e,metadatas:t})=>{const{formatMessage:n}=(0,A.useIntl)(),{mainField:{type:s,name:a}}=t,l=r.createElement(r.Fragment,null,r.createElement(il.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,y0({},g.stopPropagation),r.createElement(Ae.SimpleMenu,{label:l,size:"S"},e.map(i=>r.createElement(Ae.MenuItem,{key:i.id,"aria-disabled":!0},r.createElement(h0,{ellipsis:!0},r.createElement(Lt,{type:s,value:i[a]||i.id}))))))};gl.propTypes={metadatas:o().shape({mainField:o().shape({name:o().string,type:o().string,value:o().string})}).isRequired,value:o().array.isRequired};const b0=gl,E0=(0,k.default)(L.Typography)`
|
|
1106
|
+
max-width: 250px;
|
|
1107
|
+
`,yl=({value:e,metadatas:t})=>{const{mainField:n}=t,s=e[n.name];return r.createElement(ar.Tooltip,{label:s},r.createElement(E0,{textColor:"neutral800",ellipsis:!0},r.createElement(Lt,{type:n.type,value:s})))};yl.propTypes={metadatas:o().shape({mainField:o().shape({name:o().string,type:o().string,value:o().string})}).isRequired,value:o().object.isRequired};const v0=yl;var C0=p(80022),hl=p.n(C0);function bl(e){return["oneToOne","manyToOne","oneToOneMorph"].includes(e)}function O0(e,t,n,s){if(e==="component"){const{mainField:{name:a,type:l}}=n;if(s!=null&&s.repeatable)return t.length>0;const i=t==null?void 0:t[a];return a==="id"&&![void 0,null].includes(i)?!0:wt(l)&&l!=="biginteger"&&a!=="id"?hl()(i):!Re()(i)}return e==="relation"?bl(s.relation)?!Re()(t):(t==null?void 0:t.count)>0:wt(e)&&e!=="biginteger"?hl()(t):e==="boolean"?t!==null:!Re()(t)}var P0=Object.defineProperty,El=Object.getOwnPropertySymbols,R0=Object.prototype.hasOwnProperty,M0=Object.prototype.propertyIsEnumerable,vl=(e,t,n)=>t in e?P0(e,t,{enumerable:!0,configurable:!0,writable:!0,value:n}):e[t]=n,T0=(e,t)=>{for(var n in t||(t={}))R0.call(t,n)&&vl(e,n,t[n]);if(El)for(var n of El(t))M0.call(t,n)&&vl(e,n,t[n]);return e};const w0=(0,k.default)(L.Typography)`
|
|
1108
|
+
max-width: 300px;
|
|
1109
|
+
`,qr=({content:e,fieldSchema:t,metadatas:n,name:s,queryInfos:a,rowId:l})=>{const{type:i}=t;if(!O0(i,e,n,t))return r.createElement(L.Typography,{textColor:"neutral800"},"-");switch(i){case"media":return t.multiple?r.createElement(JE,{value:e}):r.createElement(rl,T0({},e));case"relation":return bl(t.relation)?r.createElement(p0,{metadatas:n,value:e}):r.createElement(u0,{fieldSchema:t,queryInfos:a,metadatas:n,value:e,name:s,rowId:l});case"component":return t.repeatable===!0?r.createElement(b0,{value:e,metadatas:n}):r.createElement(v0,{value:e,metadatas:n});default:return r.createElement(w0,{ellipsis:!0,textColor:"neutral800"},r.createElement(Lt,{type:i,value:e}))}};qr.defaultProps={content:void 0,queryInfos:void 0},qr.propTypes={content:o().any,fieldSchema:o().shape({component:o().string,multiple:o().bool,type:o().string.isRequired,repeatable:o().bool,relation:o().string}).isRequired,metadatas:o().object.isRequired,name:o().string.isRequired,rowId:o().oneOfType([o().string,o().number]).isRequired,queryInfos:o().shape({endPoint:o().string.isRequired})};const I0=qr;var D0=Object.defineProperty,x0=Object.defineProperties,S0=Object.getOwnPropertyDescriptors,dn=Object.getOwnPropertySymbols,Cl=Object.prototype.hasOwnProperty,Ol=Object.prototype.propertyIsEnumerable,Pl=(e,t,n)=>t in e?D0(e,t,{enumerable:!0,configurable:!0,writable:!0,value:n}):e[t]=n,Ft=(e,t)=>{for(var n in t||(t={}))Cl.call(t,n)&&Pl(e,n,t[n]);if(dn)for(var n of dn(t))Ol.call(t,n)&&Pl(e,n,t[n]);return e},L0=(e,t)=>x0(e,S0(t)),F0=(e,t)=>{var n={};for(var s in e)Cl.call(e,s)&&t.indexOf(s)<0&&(n[s]=e[s]);if(e!=null&&dn)for(var s of dn(e))t.indexOf(s)<0&&Ol.call(e,s)&&(n[s]=e[s]);return n};const Wr=({canCreate:e,canDelete:t,headers:n,entriesToDelete:s,onClickDelete:a,onSelectRow:l,withMainAction:i,withBulkActions:u,rows:c})=>{const{push:d,location:{pathname:m}}=(0,ee.useHistory)(),{formatMessage:f}=(0,A.useIntl)(),{trackUsage:y}=(0,g.useTracking)(),h=Ho();return r.createElement(St.Tbody,null,c.map((b,E)=>{const O=s.findIndex(C=>C===b.id)!==-1,x=f({id:"content-manager.components.DynamicTable.row-line",defaultMessage:"item line {number}"},{number:E});return r.createElement(St.Tr,Ft({key:b.id},(0,g.onRowClick)({fn:()=>{y("willEditEntryFromList"),d({pathname:`${m}/${b.id}`,state:{from:m},search:h})},condition:u})),i&&r.createElement(St.Td,Ft({},g.stopPropagation),r.createElement(qE.BaseCheckbox,{"aria-label":f({id:"app.component.table.select.one-entry",defaultMessage:"Select {target}"},{target:(0,oi.Pp)(b.firstname,b.lastname)}),checked:O,onChange:()=>{l({name:b.id,value:!O})}})),n.map(C=>{var S=C,{key:I,cellFormatter:V,name:w}=S,W=F0(S,["key","cellFormatter","name"]);return r.createElement(St.Td,{key:I},typeof V=="function"?V(b,Ft({key:I,name:w},W)):r.createElement(I0,L0(Ft({content:b[w.split(".")[0]],name:w},W),{rowId:b.id})))}),u&&r.createElement(St.Td,null,r.createElement(j.Flex,Ft({justifyContent:"end"},g.stopPropagation),r.createElement(Me.IconButton,{onClick:()=>{y("willEditEntryFromButton"),d({pathname:`${m}/${b.id}`,state:{from:m},search:h})},label:f({id:"app.component.table.edit",defaultMessage:"Edit {target}"},{target:x}),noBorder:!0,icon:r.createElement(it(),null)}),e&&r.createElement(D.Box,{paddingLeft:1},r.createElement(Me.IconButton,{onClick:()=>{d({pathname:`${m}/create/clone/${b.id}`,state:{from:m},search:h})},label:f({id:"app.component.table.duplicate",defaultMessage:"Duplicate {target}"},{target:x}),noBorder:!0,icon:r.createElement(zE(),null)})),t&&r.createElement(D.Box,{paddingLeft:1},r.createElement(Me.IconButton,{onClick:()=>{y("willDeleteEntryFromList"),a(b.id)},label:f({id:"global.delete-target",defaultMessage:"Delete {target}"},{target:x}),noBorder:!0,icon:r.createElement(Be(),null)})))))}))};Wr.defaultProps={canCreate:!1,canDelete:!1,entriesToDelete:[],onClickDelete:()=>{},onSelectRow:()=>{},rows:[],withBulkActions:!1,withMainAction:!1},Wr.propTypes={canCreate:o().bool,canDelete:o().bool,entriesToDelete:o().array,headers:o().array.isRequired,onClickDelete:o().func,onSelectRow:o().func,rows:o().array,withBulkActions:o().bool,withMainAction:o().bool};const k0=Wr;var A0=Object.defineProperty,pn=Object.getOwnPropertySymbols,Rl=Object.prototype.hasOwnProperty,Ml=Object.prototype.propertyIsEnumerable,Tl=(e,t,n)=>t in e?A0(e,t,{enumerable:!0,configurable:!0,writable:!0,value:n}):e[t]=n,j0=(e,t)=>{for(var n in t||(t={}))Rl.call(t,n)&&Tl(e,n,t[n]);if(pn)for(var n of pn(t))Ml.call(t,n)&&Tl(e,n,t[n]);return e},$0=(e,t)=>{var n={};for(var s in e)Rl.call(e,s)&&t.indexOf(s)<0&&(n[s]=e[s]);if(e!=null&&pn)for(var s of pn(e))t.indexOf(s)<0&&Ml.call(e,s)&&(n[s]=e[s]);return n};const wl=e=>{var t=e,{area:n}=t,s=$0(t,["area"]);const a=Qo(n);return a?r.createElement("ul",null,a.map(l=>l.Component(s)?r.createElement(D.Box,{key:l.name,padding:3,style:{textAlign:"center"}},r.createElement(l.Component,j0({},s))):null)):null};wl.propTypes={area:o().string.isRequired};const Il=wl,Dl=({isConfirmButtonLoading:e,isOpen:t,onToggleDialog:n,onConfirm:s})=>{const{formatMessage:a}=(0,A.useIntl)();return r.createElement(ke.Dialog,{onClose:n,title:a({id:"app.components.ConfirmDialog.title",defaultMessage:"Confirmation"}),labelledBy:"confirmation",describedBy:"confirm-description",isOpen:t},r.createElement(ke.DialogBody,{icon:r.createElement(Tt(),null)},r.createElement(se.Stack,{spacing:2},r.createElement(j.Flex,{justifyContent:"center"},r.createElement(L.Typography,{id:"confirm-description"},a({id:v("popUpWarning.bodyMessage.contentType.delete.all"),defaultMessage:"Are you sure you want to delete these entries?"}))),r.createElement(j.Flex,null,r.createElement(Il,{area:"contentManager.listView.deleteModalAdditionalInfos"})))),r.createElement(ke.DialogFooter,{startAction:r.createElement(ye.Button,{onClick:n,variant:"tertiary"},a({id:"app.components.Button.cancel",defaultMessage:"Cancel"})),endAction:r.createElement(ye.Button,{onClick:s,variant:"danger-light",startIcon:r.createElement(Be(),null),id:"confirm-delete",loading:e},a({id:"app.components.Button.confirm",defaultMessage:"Confirm"}))}))};Dl.propTypes={isConfirmButtonLoading:o().bool.isRequired,isOpen:o().bool.isRequired,onConfirm:o().func.isRequired,onToggleDialog:o().func.isRequired};const B0=Dl,xl=({isConfirmButtonLoading:e,isOpen:t,onToggleDialog:n,onConfirm:s})=>{const{formatMessage:a}=(0,A.useIntl)();return r.createElement(ke.Dialog,{onClose:n,title:a({id:"app.components.ConfirmDialog.title",defaultMessage:"Confirmation"}),labelledBy:"confirmation",describedBy:"confirm-description",isOpen:t},r.createElement(ke.DialogBody,{icon:r.createElement(Tt(),null)},r.createElement(se.Stack,{spacing:2},r.createElement(j.Flex,{justifyContent:"center"},r.createElement(L.Typography,{id:"confirm-description"},a({id:"components.popUpWarning.message",defaultMessage:"Are you sure you want to delete this?"}))),r.createElement(j.Flex,null,r.createElement(Il,{area:"contentManager.listView.deleteModalAdditionalInfos"})))),r.createElement(ke.DialogFooter,{startAction:r.createElement(ye.Button,{onClick:n,variant:"tertiary"},a({id:"app.components.Button.cancel",defaultMessage:"Cancel"})),endAction:r.createElement(ye.Button,{onClick:s,variant:"danger-light",startIcon:r.createElement(Be(),null),id:"confirm-delete",loading:e},a({id:"app.components.Button.confirm",defaultMessage:"Confirm"}))}))};xl.propTypes={isConfirmButtonLoading:o().bool.isRequired,isOpen:o().bool.isRequired,onConfirm:o().func.isRequired,onToggleDialog:o().func.isRequired};const N0=xl;var V0=Object.defineProperty,q0=Object.defineProperties,W0=Object.getOwnPropertyDescriptors,Sl=Object.getOwnPropertySymbols,z0=Object.prototype.hasOwnProperty,U0=Object.prototype.propertyIsEnumerable,Ll=(e,t,n)=>t in e?V0(e,t,{enumerable:!0,configurable:!0,writable:!0,value:n}):e[t]=n,H0=(e,t)=>{for(var n in t||(t={}))z0.call(t,n)&&Ll(e,n,t[n]);if(Sl)for(var n of Sl(t))U0.call(t,n)&&Ll(e,n,t[n]);return e},G0=(e,t)=>q0(e,W0(t));const zr=({canCreate:e,canDelete:t,contentTypeName:n,action:s,isBulkable:a,isLoading:l,onConfirmDelete:i,onConfirmDeleteAll:u,layout:c,rows:d})=>{const{runHookWaterfall:m}=(0,g.useStrapiApp)(),f=c.contentType.options.draftAndPublish||!1,{formatMessage:y}=(0,A.useIntl)(),h=(0,fe.useSelector)(Qi),b=(0,r.useMemo)(()=>{const O=m(zt.No,{displayedHeaders:h,layout:c}).displayedHeaders.map(x=>{if(x.fieldSchema.type==="relation"){const C=`${x.name}.${x.metadatas.mainField.name}`;return G0(H0({},x),{name:C})}return x});return f?[...O,{key:"__published_at_temp_key__",name:"publishedAt",fieldSchema:{type:"custom"},metadatas:{label:y({id:v("containers.ListPage.table-headers.published_at")}),searchable:!1,sortable:!0},cellFormatter:x=>{const C=!Re()(x.publishedAt);return r.createElement(VE,{isPublished:C})}}]:O},[m,h,c,f,y]);return r.createElement(g.DynamicTable,{components:{ConfirmDialogDelete:N0,ConfirmDialogDeleteAll:B0},contentType:n,action:s,isLoading:l,headers:b,onConfirmDelete:i,onConfirmDeleteAll:u,onOpenDeleteAllModalTrackedEvent:"willBulkDeleteEntries",rows:d,withBulkActions:!0,withMainAction:t&&a},r.createElement(k0,{canCreate:e,canDelete:t,headers:b,rows:d,withBulkActions:!0,withMainAction:t&&a}))};zr.defaultProps={action:void 0},zr.propTypes={canCreate:o().bool.isRequired,canDelete:o().bool.isRequired,contentTypeName:o().string.isRequired,action:o().node,isBulkable:o().bool.isRequired,isLoading:o().bool.isRequired,layout:o().exact({components:o().object.isRequired,contentType:o().shape({attributes:o().object.isRequired,metadatas:o().object.isRequired,layouts:o().shape({list:o().array.isRequired,editRelations:o().array}).isRequired,options:o().object.isRequired,settings:o().object.isRequired}).isRequired}).isRequired,onConfirmDelete:o().func.isRequired,onConfirmDeleteAll:o().func.isRequired,rows:o().array.isRequired};const Z0=zr,_0=e=>Object.keys(e).reduce((n,s)=>{const a=e[s];return fo(a)&&n.push(s),n},[]).sort(),Fl=({layout:e})=>{const t=(0,fe.useDispatch)(),n=(0,fe.useSelector)(Qi),{trackUsage:s}=(0,g.useTracking)(),{formatMessage:a}=(0,A.useIntl)(),l=_0(e.contentType.attributes).map(c=>{const d=e.contentType.metadatas[c].list;return{name:c,intlLabel:{id:d.label,defaultMessage:d.label}}}),i=n.map(({name:c})=>c),u=c=>{if(s("didChangeDisplayedFields"),c.length<i.length){const d=i.filter(m=>c.indexOf(m)===-1);t(Br({name:d[0],value:!0}))}else{const d=c.filter(m=>i.indexOf(m)===-1);t(Br({name:d[0],value:!1}))}};return r.createElement(D.Box,{paddingTop:1,paddingBottom:1},r.createElement(ue.Select,{"aria-label":"change displayed fields",value:i,onChange:u,customizeContent:c=>`${c.length} currently selected`,multi:!0,size:"S"},l.map(c=>r.createElement(ue.Option,{key:c.name,value:c.name},a({id:c.intlLabel.id||c.name,defaultMessage:c.intlLabel.defaultMessage||c.name})))))};Fl.propTypes={layout:o().shape({contentType:o().shape({attributes:o().object.isRequired,metadatas:o().object.isRequired,layouts:o().shape({list:o().array.isRequired,editRelations:o().array}).isRequired,options:o().object.isRequired,settings:o().object.isRequired}).isRequired}).isRequired};const Q0=(0,r.memo)(Fl),Ur=({pagination:e})=>r.createElement(D.Box,{paddingTop:4},r.createElement(j.Flex,{alignItems:"flex-end",justifyContent:"space-between"},r.createElement(g.PageSizeURLQuery,{trackedEvent:"willChangeNumberOfEntriesPerPage"}),r.createElement(g.PaginationURLQuery,{pagination:e})));Ur.defaultProps={pagination:{pageCount:0,pageSize:10,total:0}},Ur.propTypes={pagination:o().shape({page:o().number,pageCount:o().number,pageSize:o().number,total:o().number})};const K0=Ur,Y0=["json","component","media","richtext","dynamiczone","password"],J0=["createdAt","updatedAt"],X0=(e,t)=>{const{allPermissions:n}=(0,g.useRBACProvider)(),s=(0,g.findMatchingPermissions)(n,[{action:"plugin::content-manager.explorer.read",subject:t}]),a=R()(s,["0","properties","fields"],[]);return Object.keys(R()(e,["attributes"]),{}).filter(u=>{const c=R()(e,["attributes",u],{});return!(!c.type||Y0.includes(c.type)||!a.includes(u)&&u!=="id"&&!J0.includes(u))}).sort()};var ev=p(23899),tv=p.n(ev);const kl=({displayedFilters:e})=>{const[t,n]=(0,r.useState)(!1),{formatMessage:s}=(0,A.useIntl)(),a=(0,r.useRef)(),{trackUsage:l}=(0,g.useTracking)(),i=()=>{t||l("willFilterEntries"),n(u=>!u)};return r.createElement(r.Fragment,null,r.createElement(D.Box,{paddingTop:1,paddingBottom:1},r.createElement(ye.Button,{variant:"tertiary",ref:a,startIcon:r.createElement(tv(),null),onClick:i,size:"S"},s({id:"app.utils.filters",defaultMessage:"Filters"})),t&&r.createElement(g.FilterPopoverURLQuery,{displayedFilters:e,isVisible:t,onToggle:i,source:a})),r.createElement(g.FilterListURLQuery,{filtersSchema:e}))};kl.propTypes={displayedFilters:o().arrayOf(o().shape({name:o().string.isRequired,metadatas:o().shape({label:o().string}),fieldSchema:o().shape({type:o().string})})).isRequired};const nv=kl,Al=({contentType:e,slug:t,metadatas:n})=>{const a=X0(e,t).map(l=>{const i=e.attributes[l],{type:u,enum:c}=i,d={name:"didFilterEntries",properties:{useRelation:u==="relation"}},{mainField:m,label:f}=n[l].list;return{name:l,metadatas:{label:f},fieldSchema:{type:u,options:c,mainField:m},trackedEvent:d}});return r.createElement(nv,{displayedFilters:a})};Al.propTypes={contentType:o().object.isRequired,metadatas:o().object.isRequired,slug:o().string.isRequired};const rv=Al;var ov=p(98399),sv=Object.defineProperty,av=Object.defineProperties,iv=Object.getOwnPropertyDescriptors,jl=Object.getOwnPropertySymbols,lv=Object.prototype.hasOwnProperty,cv=Object.prototype.propertyIsEnumerable,$l=(e,t,n)=>t in e?sv(e,t,{enumerable:!0,configurable:!0,writable:!0,value:n}):e[t]=n,uv=(e,t)=>{for(var n in t||(t={}))lv.call(t,n)&&$l(e,n,t[n]);if(jl)for(var n of jl(t))cv.call(t,n)&&$l(e,n,t[n]);return e},dv=(e,t)=>av(e,iv(t)),Hr=(e,t,n)=>new Promise((s,a)=>{var l=c=>{try{u(n.next(c))}catch(d){a(d)}},i=c=>{try{u(n.throw(c))}catch(d){a(d)}},u=c=>c.done?s(c.value):Promise.resolve(c.value).then(l,i);u((n=n.apply(e,t)).next())});const pv=De.Z.contentManager,mv=(0,k.default)(Me.IconButton)`
|
|
1110
|
+
svg {
|
|
1111
|
+
path {
|
|
1112
|
+
fill: ${({theme:e})=>e.colors.neutral900};
|
|
1113
|
+
}
|
|
1114
|
+
}
|
|
1115
|
+
`;function Bl({canCreate:e,canDelete:t,canRead:n,data:s,getData:a,getDataSucceeded:l,isLoading:i,layout:u,pagination:c,slug:d}){const{total:m}=c,{contentType:{metadatas:f,settings:{bulkable:y,filterable:h,searchable:b}}}=u,E=(0,g.useNotification)(),{trackUsage:O}=(0,g.useTracking)(),{refetchPermissions:x}=(0,g.useRBACProvider)(),C=(0,r.useRef)(O),S=(0,r.useRef)(x),{notifyStatus:I}=(0,Nr.useNotifyAT)();(0,g.useFocusWhenNavigate)();const[{query:V}]=(0,g.useQueryParams)(),w=Ga(V),W=(0,Ne.stringify)({plugins:V.plugins},{encode:!1}),{pathname:U}=(0,ee.useLocation)(),{push:G}=(0,ee.useHistory)(),{formatMessage:N}=(0,A.useIntl)(),H=u.contentType,F=R()(H,"options.draftAndPublish",!1),K=(0,r.useRef)(""),$=(0,r.useCallback)((P,Q)=>Hr(this,null,function*(){a();try{const re=Q?{cancelToken:Q.token}:null,{data:{results:ce,pagination:me}}=yield ge.be.get(P,re);I(N({id:v("utils.data-loaded"),defaultMessage:"{number, plural, =1 {# entry has} other {# entries have}} successfully been loaded"},{number:me.count})),l(me,ce)}catch(re){if(Se().isCancel(re))return;if(R()(re,"response.status",null)===403){yield S.current(),E({type:"info",message:{id:v("permissions.not-allowed.update")}}),G("/");return}ov.error(re),E({type:"warning",message:{id:v("error.model.fetch")}})}}),[N,a,l,I,G,E]),Y=(0,r.useCallback)(P=>Hr(this,null,function*(){try{yield ge.be.post(ve(`collection-types/${d}/actions/bulkDelete`),{ids:P});const Q=ve(`collection-types/${d}${w}`);$(Q),C.current("didBulkDeleteEntries")}catch(Q){E({type:"warning",message:{id:v("error.record.delete")}})}}),[$,w,d,E]),M=(0,r.useCallback)(P=>Hr(this,null,function*(){try{yield ge.be.delete(ve(`collection-types/${d}/${P}`));const Q=ve(`collection-types/${d}${w}`);$(Q),E({type:"success",message:{id:v("success.record.delete")}})}catch(Q){const re=R()(Q,"response.payload.message",N({id:v("error.record.delete")}));E({type:"warning",message:re})}}),[d,w,$,E,N]);(0,r.useEffect)(()=>{const Q=Se().CancelToken.source(),re=n,ce=ve(`collection-types/${d}${w}`);return re&&ce.includes(K.current)&&$(ce,Q),()=>{K.current=d,Q.cancel("Operation canceled by the user.")}},[n,a,d,w,l,$]);const q=N({id:v("header.name"),defaultMessage:"Content"}),Z=N({id:H.info.displayName,defaultMessage:H.info.displayName||q}),_=n?N({id:v("pages.ListView.header-subtitle"),defaultMessage:"{number, plural, =0 {# entries} one {# entry} other {# entries}} found"},{number:m}):null,T=P=>e?r.createElement(ye.Button,dv(uv({},P),{onClick:()=>{const Q=F?{status:"draft"}:{};C.current("willCreateEntry",Q),G({pathname:`${U}/create`,search:V.plugins?W:""})},startIcon:r.createElement(ut(),null)}),N({id:v("HeaderLayout.button.label-add-entry"),defaultMessage:"Create new entry"})):null;return r.createElement(oe.Main,{"aria-busy":i},r.createElement(X.HeaderLayout,{primaryAction:T(),subtitle:_,title:Z,navigationAction:r.createElement(g.Link,{startIcon:r.createElement(on(),null),to:"/content-manager/"},N({id:"global.back",defaultMessage:"Back"}))}),!n&&r.createElement(X.ActionLayout,{endActions:r.createElement(Gt,{area:"contentManager.listView.actions"})}),n&&r.createElement(X.ActionLayout,{endActions:r.createElement(r.Fragment,null,r.createElement(Gt,{area:"contentManager.listView.actions"}),r.createElement(Q0,{layout:u}),r.createElement(g.CheckPermissions,{permissions:pv.collectionTypesConfigurations},r.createElement(D.Box,{paddingTop:1,paddingBottom:1},r.createElement(mv,{onClick:()=>{O("willEditListLayout"),G({pathname:`${d}/configurations/list`,search:W})},icon:r.createElement(Di(),null),label:N({id:"app.links.configure-view",defaultMessage:"Configure the view"})})))),startActions:r.createElement(r.Fragment,null,b&&r.createElement(g.SearchURLQuery,{label:N({id:"app.component.search.label",defaultMessage:"Search for {target}"},{target:Z}),placeholder:N({id:"global.search",defaultMessage:"Search"}),trackedEvent:"didSearch"}),h&&r.createElement(rv,{contentType:H,slug:d,metadatas:f}))}),r.createElement(X.ContentLayout,null,n?r.createElement(r.Fragment,null,r.createElement(Z0,{canCreate:e,canDelete:t,contentTypeName:Z,onConfirmDeleteAll:Y,onConfirmDelete:M,isBulkable:y,isLoading:i,layout:u,rows:s,action:T({variant:"secondary"})}),r.createElement(K0,{pagination:{pageCount:(c==null?void 0:c.pageCount)||1}})):r.createElement(g.NoPermissions,null)))}Bl.propTypes={canCreate:o().bool.isRequired,canDelete:o().bool.isRequired,canRead:o().bool.isRequired,data:o().array.isRequired,layout:o().exact({components:o().object.isRequired,contentType:o().shape({attributes:o().object.isRequired,metadatas:o().object.isRequired,info:o().shape({displayName:o().string.isRequired}).isRequired,layouts:o().shape({list:o().array.isRequired,editRelations:o().array}).isRequired,options:o().object.isRequired,settings:o().object.isRequired}).isRequired}).isRequired,isLoading:o().bool.isRequired,getData:o().func.isRequired,getDataSucceeded:o().func.isRequired,pagination:o().shape({total:o().number.isRequired,pageCount:o().number}).isRequired,slug:o().string.isRequired};const fv=NE();function gv(e){return(0,_i.bindActionCreators)({getData:SE,getDataSucceeded:LE,onChangeListHeaders:Br,onResetListHeaders:FE},e)}const yv=(0,fe.connect)(fv,gv),hv=(0,_i.compose)(yv)((0,r.memo)(Bl,We()));var bv=Object.defineProperty,Nl=Object.getOwnPropertySymbols,Ev=Object.prototype.hasOwnProperty,vv=Object.prototype.propertyIsEnumerable,Vl=(e,t,n)=>t in e?bv(e,t,{enumerable:!0,configurable:!0,writable:!0,value:n}):e[t]=n,ql=(e,t)=>{for(var n in t||(t={}))Ev.call(t,n)&&Vl(e,n,t[n]);if(Nl)for(var n of Nl(t))vv.call(t,n)&&Vl(e,n,t[n]);return e};const Gr=e=>{const t=(0,r.useMemo)(()=>Co(e.slug),[e.slug]),{isLoading:n,allowedActions:s}=(0,g.useRBAC)(t,e.permissions);return n?r.createElement(g.LoadingIndicatorPage,null):r.createElement(hv,ql(ql({},e),s))};Gr.defaultProps={permissions:[]},Gr.propTypes={permissions:o().array,slug:o().string.isRequired};const Cv=(0,r.memo)(Gr,(e,t)=>{const n=(0,g.difference)(e,t);return Object.keys(n).filter(a=>a!=="state").length>0});var Ov=Object.defineProperty,Pv=Object.defineProperties,Rv=Object.getOwnPropertyDescriptors,mn=Object.getOwnPropertySymbols,Wl=Object.prototype.hasOwnProperty,zl=Object.prototype.propertyIsEnumerable,Ul=(e,t,n)=>t in e?Ov(e,t,{enumerable:!0,configurable:!0,writable:!0,value:n}):e[t]=n,Mv=(e,t)=>{for(var n in t||(t={}))Wl.call(t,n)&&Ul(e,n,t[n]);if(mn)for(var n of mn(t))zl.call(t,n)&&Ul(e,n,t[n]);return e},Tv=(e,t)=>Pv(e,Rv(t)),wv=(e,t)=>{var n={};for(var s in e)Wl.call(e,s)&&t.indexOf(s)<0&&(n[s]=e[s]);if(e!=null&&mn)for(var s of mn(e))t.indexOf(s)<0&&zl.call(e,s)&&(n[s]=e[s]);return n};const Hl=e=>{var t=e,{layout:n}=t,s=wv(t,["layout"]);const a=(0,fe.useDispatch)(),{replace:l}=(0,ee.useHistory)(),[{query:i,rawQuery:u}]=(0,g.useQueryParams)(),c=Zo(i,s.slug,"listView"),d=Uo(s.slug);return(0,r.useEffect)(()=>{u||l(d)},[u,l,d]),(0,r.useEffect)(()=>{a(AE(n))},[a,n]),(0,r.useEffect)(()=>()=>{a(kE())},[a]),c?r.createElement(Cv,Tv(Mv({},s),{layout:n,permissions:c})):null};Hl.propTypes={layout:o().exact({components:o().object.isRequired,contentType:o().shape({attributes:o().object.isRequired,metadatas:o().object.isRequired,layouts:o().shape({list:o().array.isRequired,editRelations:o().array}).isRequired,options:o().object.isRequired,settings:o().object.isRequired,pluginOptions:o().object}).isRequired}).isRequired,slug:o().string.isRequired};const Iv=Hl,Dv=(e,t)=>ge.be.put(ve(`content-types/${t}/configuration`),e),xv=(0,k.default)(j.Flex)`
|
|
1116
|
+
gap: ${({theme:e})=>e.spaces[4]};
|
|
1117
|
+
`,Zr=({modifiedData:e,onChange:t,sortOptions:n})=>{const{formatMessage:s}=(0,A.useIntl)(),{settings:a}=e;return r.createElement(r.Fragment,null,r.createElement(D.Box,{paddingBottom:4},r.createElement(L.Typography,{variant:"delta",as:"h2"},s({id:v("containers.SettingPage.settings"),defaultMessage:"Settings"}))),r.createElement(xv,{justifyContent:"space-between",wrap:"wrap",paddingBottom:6},r.createElement(xt.ToggleInput,{label:s({id:v("form.Input.search"),defaultMessage:"Enable search"}),onChange:l=>{t({target:{name:"settings.searchable",value:l.target.checked}})},onLabel:s({id:"app.components.ToggleCheckbox.on-label",defaultMessage:"on"}),offLabel:s({id:"app.components.ToggleCheckbox.off-label",defaultMessage:"off"}),name:"settings.searchable",checked:a.searchable}),r.createElement(xt.ToggleInput,{label:s({id:v("form.Input.filters"),defaultMessage:"Enable filters"}),onChange:l=>{t({target:{name:"settings.filterable",value:l.target.checked}})},onLabel:s({id:"app.components.ToggleCheckbox.on-label",defaultMessage:"on"}),offLabel:s({id:"app.components.ToggleCheckbox.off-label",defaultMessage:"off"}),name:"settings.filterable",checked:a.filterable}),r.createElement(xt.ToggleInput,{label:s({id:v("form.Input.bulkActions"),defaultMessage:"Enable bulk actions"}),onChange:l=>{t({target:{name:"settings.bulkable",value:l.target.checked}})},onLabel:s({id:"app.components.ToggleCheckbox.on-label",defaultMessage:"on"}),offLabel:s({id:"app.components.ToggleCheckbox.off-label",defaultMessage:"off"}),name:"settings.bulkable",checked:a.bulkable})),r.createElement(ie.Grid,{gap:4},r.createElement(ie.GridItem,{s:12,col:6},r.createElement(ue.Select,{label:s({id:v("form.Input.pageEntries"),defaultMessage:"Entries per page"}),hint:s({id:v("form.Input.pageEntries.inputDescription"),defaultMessage:"Note: You can override this value in the Collection Type settings page."}),onChange:l=>t({target:{name:"settings.pageSize",value:l}}),name:"settings.pageSize",value:e.settings.pageSize||""},[10,20,50,100].map(l=>r.createElement(ue.Option,{key:l,value:l},l)))),r.createElement(ie.GridItem,{s:12,col:3},r.createElement(ue.Select,{label:s({id:v("form.Input.defaultSort"),defaultMessage:"Default sort attribute"}),onChange:l=>t({target:{name:"settings.defaultSortBy",value:l}}),name:"settings.defaultSortBy",value:e.settings.defaultSortBy||""},n.map(l=>r.createElement(ue.Option,{key:l,value:l},l)))),r.createElement(ie.GridItem,{s:12,col:3},r.createElement(ue.Select,{label:s({id:v("form.Input.sort.order"),defaultMessage:"Default sort order"}),onChange:l=>t({target:{name:"settings.defaultSortOrder",value:l}}),name:"settings.defaultSortOrder",value:e.settings.defaultSortOrder||""},["ASC","DESC"].map(l=>r.createElement(ue.Option,{key:l,value:l},l))))))};Zr.defaultProps={modifiedData:{},sortOptions:[]},Zr.propTypes={modifiedData:o().object,onChange:o().func.isRequired,sortOptions:o().array};const Sv=Zr,_r=k.default.button`
|
|
1118
|
+
display: flex;
|
|
1119
|
+
align-items: center;
|
|
1120
|
+
height: ${({theme:e})=>e.spaces[7]};
|
|
1121
|
+
|
|
1122
|
+
&:last-child {
|
|
1123
|
+
padding: 0 ${({theme:e})=>e.spaces[3]};
|
|
1124
|
+
}
|
|
1125
|
+
`,Gl=(0,k.default)(_r)`
|
|
1126
|
+
padding: 0 ${({theme:e})=>e.spaces[3]};
|
|
1127
|
+
border-right: 1px solid ${({theme:e})=>e.colors.neutral150};
|
|
1128
|
+
cursor: all-scroll;
|
|
1129
|
+
|
|
1130
|
+
svg {
|
|
1131
|
+
width: ${12/16}rem;
|
|
1132
|
+
height: ${12/16}rem;
|
|
1133
|
+
}
|
|
1134
|
+
`,Lv=(0,k.default)(j.Flex)`
|
|
1135
|
+
max-height: ${32/16}rem;
|
|
1136
|
+
cursor: pointer;
|
|
1137
|
+
|
|
1138
|
+
svg {
|
|
1139
|
+
width: ${10/16}rem;
|
|
1140
|
+
height: ${10/16}rem;
|
|
1141
|
+
|
|
1142
|
+
path {
|
|
1143
|
+
fill: ${({theme:e})=>e.colors.neutral600};
|
|
1144
|
+
}
|
|
1145
|
+
}
|
|
1146
|
+
|
|
1147
|
+
&:hover {
|
|
1148
|
+
background-color: ${({theme:e})=>e.colors.primary100};
|
|
1149
|
+
border-color: ${({theme:e})=>e.colors.primary200};
|
|
1150
|
+
|
|
1151
|
+
svg {
|
|
1152
|
+
path {
|
|
1153
|
+
fill: ${({theme:e})=>e.colors.primary600};
|
|
1154
|
+
}
|
|
1155
|
+
}
|
|
1156
|
+
|
|
1157
|
+
${L.Typography} {
|
|
1158
|
+
color: ${({theme:e})=>e.colors.primary600};
|
|
1159
|
+
}
|
|
1160
|
+
|
|
1161
|
+
${Gl} {
|
|
1162
|
+
border-right: 1px solid ${({theme:e})=>e.colors.primary200};
|
|
1163
|
+
}
|
|
1164
|
+
}
|
|
1165
|
+
`,Fv=(0,k.default)(D.Box)`
|
|
1166
|
+
&:last-child {
|
|
1167
|
+
padding-right: ${({theme:e})=>e.spaces[3]};
|
|
1168
|
+
}
|
|
1169
|
+
`,Zl=({index:e,isDraggingSibling:t,labelField:n,onClickEditField:s,onMoveField:a,onRemoveField:l,name:i,setIsDraggingSibling:u})=>{const{formatMessage:c}=(0,A.useIntl)(),d=(0,r.useRef)(null),m=(0,r.useRef)(null),[,f]=(0,r.useState)(!1),y=(0,r.useRef)(),h=ao(n),b=()=>{y.current&&y.current.click()},[,E]=(0,Te.useDrop)({accept:Pe.FIELD,hover(I,V){if(!m.current)return;const w=I.index,W=e;if(w===W)return;const U=m.current.getBoundingClientRect(),G=(U.right-U.left)/2,H=V.getClientOffset().x-U.left;w>W&&H>G||w<W&&H<G||(a(w,W),I.index=W)}}),[{isDragging:O},x,C]=(0,Te.useDrag)({type:Pe.FIELD,item:()=>({index:e,labelField:n,name:i}),collect:I=>({isDragging:I.isDragging()}),end:()=>{u(!1)}});(0,r.useEffect)(()=>{C((0,Yt.rX)(),{captureDraggingState:!1})},[C]),(0,r.useEffect)(()=>{O&&u(!0)},[O,u]),(0,r.useEffect)(()=>{t||f(I=>!I)},[t]);const S={dragRef:x(d),dropRef:E(m)};return r.createElement(Fv,{ref:S?S.dropRef:null},O&&r.createElement(bn,{transparent:!0,labelField:h}),!O&&t&&r.createElement(bn,{isSibling:!0,labelField:h}),!O&&!t&&r.createElement(Lv,{borderColor:"neutral150",background:"neutral100",hasRadius:!0,justifyContent:"space-between",onClick:b,isDragging:O},r.createElement(se.Stack,{horizontal:!0,spacing:3},r.createElement(Gl,{as:"span","aria-label":c({id:v("components.DraggableCard.move.field"),defaultMessage:"Move {item}"},{item:i}),onClick:I=>I.stopPropagation(),ref:S.dragRef,type:"button"},r.createElement(et(),null)),r.createElement(L.Typography,{fontWeight:"bold"},h)),r.createElement(j.Flex,{paddingLeft:3},r.createElement(_r,{ref:y,onClick:I=>{I.stopPropagation(),s(i)},"aria-label":c({id:v("components.DraggableCard.edit.field"),defaultMessage:"Edit {item}"},{item:i}),type:"button"},r.createElement(it(),null)),r.createElement(_r,{onClick:l,"data-testid":`delete-${i}`,"aria-label":c({id:v("components.DraggableCard.delete.field"),defaultMessage:"Delete {item}"},{item:i}),type:"button"},r.createElement(so(),null)))))};Zl.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 kv=Zl,_l=(0,k.default)(D.Box)`
|
|
1170
|
+
flex: ${({size:e})=>e};
|
|
1171
|
+
`,Av=(0,k.default)(_l)`
|
|
1172
|
+
overflow-x: scroll;
|
|
1173
|
+
overflow-y: hidden;
|
|
1174
|
+
`,jv=(0,k.default)(_l)`
|
|
1175
|
+
max-width: ${32/16}rem;
|
|
1176
|
+
`,Ql=({displayedFields:e,listRemainingFields:t,metadatas:n,onAddField:s,onClickEditField:a,onMoveField:l,onRemoveField:i})=>{const{formatMessage:u}=(0,A.useIntl)(),[c,d]=(0,r.useState)(!1),[m,f]=(0,r.useState)(null),y=(0,r.useRef)();function h(...E){f("add"),s(...E)}function b(...E){f("remove"),i(...E)}return(0,r.useEffect)(()=>{m==="add"&&(y==null?void 0:y.current)&&(y.current.scrollLeft=y.current.scrollWidth)},[e,m]),r.createElement(r.Fragment,null,r.createElement(D.Box,{paddingBottom:4},r.createElement(L.Typography,{variant:"delta",as:"h2"},u({id:v("containers.SettingPage.view"),defaultMessage:"View"}))),r.createElement(j.Flex,{paddingTop:4,paddingLeft:4,paddingRight:4,borderColor:"neutral300",borderStyle:"dashed",borderWidth:"1px",hasRadius:!0},r.createElement(Av,{size:"1",paddingBottom:4,ref:y},r.createElement(se.Stack,{horizontal:!0,spacing:3},e.map((E,O)=>r.createElement(kv,{key:E,index:O,isDraggingSibling:c,onMoveField:l,onClickEditField:a,onRemoveField:x=>b(x,O),name:E,labelField:n[E].list.label||E,setIsDraggingSibling:d})))),r.createElement(jv,{size:"auto",paddingBottom:4},r.createElement(Ae.SimpleMenu,{label:u({id:v("components.FieldSelect.label"),defaultMessage:"Add a field"}),as:Me.IconButton,icon:r.createElement(ut(),null),disabled:t.length<=0,"data-testid":"add-field"},t.map(E=>r.createElement(Ae.MenuItem,{key:E,onClick:()=>h(E)},E))))))};Ql.propTypes={displayedFields:xe.PropTypes.array.isRequired,listRemainingFields:xe.PropTypes.array.isRequired,metadatas:xe.PropTypes.objectOf(xe.PropTypes.shape({list:xe.PropTypes.shape({label:xe.PropTypes.string})})).isRequired,onAddField:xe.PropTypes.func.isRequired,onClickEditField:xe.PropTypes.func.isRequired,onMoveField:xe.PropTypes.func.isRequired,onRemoveField:xe.PropTypes.func.isRequired};const $v=Ql,Bv=(0,k.default)(j.Flex)`
|
|
1177
|
+
svg {
|
|
1178
|
+
width: ${32/16}rem;
|
|
1179
|
+
height: ${24/16}rem;
|
|
1180
|
+
margin-right: ${({theme:e})=>e.spaces[3]};
|
|
1181
|
+
}
|
|
1182
|
+
`,Kl=({attributes:e,fieldForm:t,fieldToEdit:n,onCloseModal:s,onChangeEditLabel:a,onSubmit:l,type:i})=>{const{formatMessage:u}=(0,A.useIntl)(),c=e[n].relationType;let d=!["media","relation"].includes(i);return["oneWay","oneToOne","manyToOne"].includes(c)&&(d=!0),r.createElement(_e.ModalLayout,{onClose:s,labelledBy:"title"},r.createElement("form",{onSubmit:l},r.createElement(_e.ModalHeader,null,r.createElement(Bv,null,r.createElement(qi,{type:i}),r.createElement(L.Typography,{fontWeight:"bold",textColor:"neutral800",as:"h2",id:"title"},u({id:v("containers.ListSettingsView.modal-form.edit-label"),defaultMessage:"Edit {fieldName}"},{fieldName:It()(n)})))),r.createElement(_e.ModalBody,null,r.createElement(ie.Grid,{gap:4},r.createElement(ie.GridItem,{s:12,col:6},r.createElement(Un.TextInput,{id:"label-input",label:u({id:v("form.Input.label"),defaultMessage:"Label"}),name:"label",onChange:m=>a(m),value:t.label,hint:u({id:v("form.Input.label.inputDescription"),defaultMessage:"This value overrides the label displayed in the table's head"})})),d&&r.createElement(ie.GridItem,{s:12,col:6},r.createElement(xt.ToggleInput,{"data-testid":"Enable sort on this field",checked:t.sortable,label:u({id:v("form.Input.sort.field"),defaultMessage:"Enable sort on this field"}),name:"sortable",onChange:m=>a({target:{name:"sortable",value:m.target.checked}}),onLabel:u({id:"app.components.ToggleCheckbox.on-label",defaultMessage:"on"}),offLabel:u({id:"app.components.ToggleCheckbox.off-label",defaultMessage:"off"})})))),r.createElement(_e.ModalFooter,{startActions:r.createElement(ye.Button,{onClick:s,variant:"tertiary"},u({id:"app.components.Button.cancel",defaultMessage:"Cancel"})),endActions:r.createElement(ye.Button,{type:"submit"},u({id:"global.finish",defaultMessage:"Finish"}))})))};Kl.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 Nv=Kl;var Vv=Object.defineProperty,qv=Object.defineProperties,Wv=Object.getOwnPropertyDescriptors,Yl=Object.getOwnPropertySymbols,zv=Object.prototype.hasOwnProperty,Uv=Object.prototype.propertyIsEnumerable,Jl=(e,t,n)=>t in e?Vv(e,t,{enumerable:!0,configurable:!0,writable:!0,value:n}):e[t]=n,Hv=(e,t)=>{for(var n in t||(t={}))zv.call(t,n)&&Jl(e,n,t[n]);if(Yl)for(var n of Yl(t))Uv.call(t,n)&&Jl(e,n,t[n]);return e},Gv=(e,t)=>qv(e,Wv(t));const Zv=(e,t)=>Gv(Hv({},e),{initialData:t,modifiedData:t}),Qr={fieldForm:{},fieldToEdit:"",initialData:{},modifiedData:{}},_v=(e=Qr,t)=>(0,qt.default)(e,n=>{const s=["modifiedData","layouts","list"];switch(t.type){case"ADD_FIELD":{const a=R()(e,s,[]);ne()(n,s,[...a,t.item]);break}case"MOVE_FIELD":{const a=R()(e,s,[]),{originalIndex:l,atIndex:i}=t;ne()(n,s,vt(a,l,i));break}case"ON_CHANGE":{ne()(n,["modifiedData",...t.keys.split(".")],t.value);break}case"ON_CHANGE_FIELD_METAS":{ne()(n,["fieldForm",t.name],t.value);break}case"REMOVE_FIELD":{const a=R()(e,s,[]);ne()(n,s,a.filter((l,i)=>t.index!==i));break}case"SET_FIELD_TO_EDIT":{const{fieldToEdit:a}=t;n.fieldToEdit=a,n.fieldForm.label=R()(n,["modifiedData","metadatas",a,"list","label"],""),n.fieldForm.sortable=R()(n,["modifiedData","metadatas",a,"list","sortable"],"");break}case"UNSET_FIELD_TO_EDIT":{n.fieldForm={},n.fieldToEdit="";break}case"SUBMIT_FIELD_FORM":{const a=["modifiedData","metadatas",e.fieldToEdit,"list"];ne()(n,[...a,"label"],e.fieldForm.label),ne()(n,[...a,"sortable"],e.fieldForm.sortable);break}default:return n}}),Qv=["media","richtext","dynamiczone","relation","component","json"];var Kv=(e,t,n)=>new Promise((s,a)=>{var l=c=>{try{u(n.next(c))}catch(d){a(d)}},i=c=>{try{u(n.throw(c))}catch(d){a(d)}},u=c=>c.done?s(c.value):Promise.resolve(c.value).then(l,i);u((n=n.apply(e,t)).next())});const Xl=({layout:e,slug:t})=>{const{formatMessage:n}=(0,A.useIntl)(),{trackUsage:s}=(0,g.useTracking)(),a=Ho(),l=(0,g.useNotification)(),{refetchData:i}=(0,r.useContext)(lo),[u,c]=(0,r.useState)(!1),d=()=>c(T=>!T),[m,f]=(0,r.useState)(!1),y=()=>f(T=>!T),[h,b]=(0,r.useReducer)(_v,Qr,()=>Zv(Qr,e)),{fieldToEdit:E,fieldForm:O,initialData:x,modifiedData:C}=h,{attributes:S}=e,I=C.layouts.list,V=()=>{const{settings:{pageSize:T,defaultSortBy:P,defaultSortOrder:Q},kind:re,uid:ce}=x,me=`${P}:${Q}`,Fe=`${(0,Ne.stringify)({page:1,pageSize:T,sort:me},{encode:!1})}${a?`&${a}`:""}`;return`/content-manager/${re}/${ce}?${Fe}`},w=({target:{name:T,value:P}})=>{b({type:"ON_CHANGE",keys:T,value:T==="settings.pageSize"?parseInt(P,10):P})},W=()=>Kv(void 0,null,function*(){const T=Pi()(C,["layouts","settings","metadatas"]);$.mutate(T)}),U=T=>{b({type:"ADD_FIELD",item:T})},G=(T,P)=>{T.stopPropagation(),I.length===1?l({type:"info",message:{id:v("notification.info.minimumFields")}}):b({type:"REMOVE_FIELD",index:P})},N=T=>{T.preventDefault(),d(),s("willSaveContentTypeLayout")},H=T=>{b({type:"SET_FIELD_TO_EDIT",fieldToEdit:T}),y()},F=()=>{b({type:"UNSET_FIELD_TO_EDIT"}),y()},K=T=>{T.preventDefault(),y(),b({type:"SUBMIT_FIELD_FORM"})},$=(0,Tr.useMutation)(T=>Dv(T,t),{onSuccess:()=>{s("didEditListSettings"),i()},onError:()=>{l({type:"warning",message:{id:"notification.error"}})}}),{isLoading:Y}=$,M=({target:{name:T,value:P}})=>{b({type:"ON_CHANGE_FIELD_METAS",name:T,value:P})},q=Object.entries(S).reduce((T,P)=>{const[Q,re]=P,ce=fo(re),me=I.includes(Q);return ce&&!me&&T.push(Q),T},[]).sort(),Z=Object.entries(S).reduce((T,P)=>{const[Q,{type:re}]=P;return Qv.includes(re)||T.push(Q),T},[]),_=(T,P)=>{b({type:"MOVE_FIELD",originalIndex:T,atIndex:P})};return r.createElement(X.Layout,null,r.createElement(oe.Main,{"aria-busy":Y},r.createElement("form",{onSubmit:N},r.createElement(X.HeaderLayout,{navigationAction:r.createElement(g.Link,{startIcon:r.createElement(on(),null),to:V,id:"go-back"},n({id:"global.back",defaultMessage:"Back"})),primaryAction:r.createElement(ye.Button,{size:"L",startIcon:r.createElement(ft(),null),disabled:en()(C,x),type:"submit"},n({id:"global.save",defaultMessage:"Save"})),subtitle:n({id:v("components.SettingsViewWrapper.pluginHeader.description.list-settings"),defaultMessage:"Define the settings of the list view."}),title:n({id:v("components.SettingsViewWrapper.pluginHeader.title"),defaultMessage:"Configure the view - {name}"},{name:It()(C.info.displayName)})}),r.createElement(X.ContentLayout,null,r.createElement(D.Box,{background:"neutral0",hasRadius:!0,shadow:"tableShadow",paddingTop:6,paddingBottom:6,paddingLeft:7,paddingRight:7},r.createElement(Sv,{modifiedData:C,onChange:w,sortOptions:Z}),r.createElement(D.Box,{paddingTop:6,paddingBottom:6},r.createElement(Ut.Divider,null)),r.createElement($v,{listRemainingFields:q,displayedFields:I,onAddField:U,onClickEditField:H,onMoveField:_,onRemoveField:G,metadatas:C.metadatas}))),r.createElement(g.ConfirmDialog,{bodyText:{id:v("popUpWarning.warning.updateAllSettings"),defaultMessage:"This will modify all your settings"},iconRightButton:r.createElement(ft(),null),isConfirmButtonLoading:Y,isOpen:u,onToggleDialog:d,onConfirm:W,variantRightButton:"success-light"})),m&&r.createElement(Nv,{attributes:S,fieldForm:O,fieldToEdit:E,onChangeEditLabel:M,onCloseModal:F,onSubmit:K,type:R()(S,[E,"type"],"text")})))};Xl.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 Yv=(0,r.memo)(Xl),ec=De.Z.contentManager,tc=({match:{params:{slug:e},url:t}})=>{const{isLoading:n,layout:s,updateLayout:a}=No(e),{rawContentTypeLayout:l,rawComponentsLayouts:i}=(0,r.useMemo)(()=>{let m={},f={};return s.contentType&&(m=Nt(s.contentType)),s.components&&(f=Object.keys(s.components).reduce((y,h)=>(y[h]=Nt(s.components[h]),y),{})),{rawContentTypeLayout:m,rawComponentsLayouts:f}},[s]);if((0,B.get)(s,["contentType","uid"],null)!==e||n)return r.createElement(g.LoadingIndicatorPage,null);const c=({location:{state:m},history:{goBack:f},match:{params:{id:y,origin:h}}},b)=>r.createElement(b,{slug:e,layout:s,state:m,goBack:f,id:y,origin:h}),d=[{path:"create/clone/:origin",comp:an},{path:"create",comp:an},{path:":id",comp:an},{path:"",comp:Iv}].map(({path:m,comp:f})=>r.createElement(ee.Route,{key:m,path:`${t}/${m}`,render:y=>c(y,f)}));return r.createElement(Ic.SV,{FallbackComponent:g.ErrorFallback},r.createElement(co.Provider,{value:s},r.createElement(ee.Switch,null,r.createElement(ee.Route,{path:`${t}/configurations/list`},r.createElement(g.CheckPagePermissions,{permissions:ec.collectionTypesConfigurations},r.createElement(Yv,{layout:l,slug:e,updateLayout:a}))),r.createElement(ee.Route,{path:`${t}/configurations/edit`},r.createElement(g.CheckPagePermissions,{permissions:ec.collectionTypesConfigurations},r.createElement($r,{components:i,isContentTypeView:!0,mainLayout:l,slug:e,updateLayout:a}))),d)))};tc.propTypes={match:o().shape({url:o().string.isRequired,params:o().shape({slug:o().string.isRequired}).isRequired}).isRequired};const Jv=(0,r.memo)(tc);var nc=p(57678),Xv=p(98399),eC=(e,t,n)=>new Promise((s,a)=>{var l=c=>{try{u(n.next(c))}catch(d){a(d)}},i=c=>{try{u(n.throw(c))}catch(d){a(d)}},u=c=>c.done?s(c.value):Promise.resolve(c.value).then(l,i);u((n=n.apply(e,t)).next())});const tC=De.Z.contentManager,nC=()=>{const[{isLoading:e,data:t},n]=(0,r.useReducer)(nc.Z,nc.q),s=(0,r.useMemo)(Mn,[]),{schemas:a}=(0,fe.useSelector)(i=>s(i),fe.shallowEqual),{uid:l}=(0,ee.useParams)();return(0,r.useEffect)(()=>{const u=Se().CancelToken.source();return(d=>eC(void 0,null,function*(){try{n(Xt());const{data:{data:m}}=yield ge.be.get(ve(`components/${l}/configuration`),{cancelToken:d.token});n(gr(To(m,a,"component")))}catch(m){if(Se().isCancel(m))return;Xv.error(m)}}))(u),()=>{u.cancel("Operation canceled by the user.")}},[l,a]),e?r.createElement(g.LoadingIndicatorPage,null):r.createElement(g.CheckPagePermissions,{permissions:tC.componentsConfigurations},r.createElement($r,{components:t.components,mainLayout:t.component,slug:l}))},rC=(0,r.memo)(nC);var oC=p(64354),sC=p(97042),aC=p.n(sC);const iC=()=>{const{formatMessage:e}=(0,A.useIntl)();return(0,g.useFocusWhenNavigate)(),r.createElement(oe.Main,null,r.createElement(X.HeaderLayout,{title:e({id:v("header.name"),defaultMessage:"Content"})}),r.createElement(X.ContentLayout,null,r.createElement(oC.EmptyStateLayout,{action:r.createElement(g.LinkButton,{variant:"secondary",startIcon:r.createElement(ut(),null),to:"/plugins/content-type-builder/content-types/create-content-type"},e({id:"app.components.HomePage.create",defaultMessage:"Create your first Content-type"})),content:e({id:"content-manager.pages.NoContentType.text",defaultMessage:"You don't have any content yet, we recommend you to create your first Content-Type."}),hasRadius:!0,icon:r.createElement(aC(),{width:"10rem"}),shadow:"tableShadow"})))},lC=()=>{const{formatMessage:e}=(0,A.useIntl)();return(0,g.useFocusWhenNavigate)(),r.createElement(oe.Main,null,r.createElement(X.HeaderLayout,{title:e({id:v("header.name"),defaultMessage:"Content"})}),r.createElement(X.ContentLayout,null,r.createElement(g.NoPermissions,null)))},cC=De.Z.contentManager,rc=({match:{params:{slug:e},url:t}})=>{const{isLoading:n,layout:s,updateLayout:a}=No(e),{rawContentTypeLayout:l,rawComponentsLayouts:i}=(0,r.useMemo)(()=>{let u={},c={};return s.contentType&&(c=Nt(s.contentType)),s.components&&(u=Object.keys(s.components).reduce((d,m)=>(d[m]=Nt(s.components[m]),d),{})),{rawContentTypeLayout:c,rawComponentsLayouts:u}},[s]);return n?r.createElement(g.LoadingIndicatorPage,null):r.createElement(co.Provider,{value:s},r.createElement(ee.Switch,null,r.createElement(ee.Route,{path:`${t}/configurations/edit`},r.createElement(g.CheckPagePermissions,{permissions:cC.singleTypesConfigurations},r.createElement($r,{components:i,isContentTypeView:!0,mainLayout:l,slug:e,updateLayout:a}))),r.createElement(ee.Route,{path:t,render:({location:{state:u},history:{goBack:c}})=>r.createElement(an,{layout:s,slug:e,isSingleType:!0,state:u,goBack:c})})))};rc.propTypes={match:o().shape({url:o().string.isRequired,params:o().shape({slug:o().string.isRequired}).isRequired}).isRequired};const uC=(0,r.memo)(rc);var dC=p(58469),pC=p(59578),oc=p.n(pC),kt=p(89420),mC=Object.defineProperty,fC=Object.defineProperties,gC=Object.getOwnPropertyDescriptors,sc=Object.getOwnPropertySymbols,yC=Object.prototype.hasOwnProperty,hC=Object.prototype.propertyIsEnumerable,ac=(e,t,n)=>t in e?mC(e,t,{enumerable:!0,configurable:!0,writable:!0,value:n}):e[t]=n,bC=(e,t)=>{for(var n in t||(t={}))yC.call(t,n)&&ac(e,n,t[n]);if(sc)for(var n of sc(t))hC.call(t,n)&&ac(e,n,t[n]);return e},EC=(e,t)=>fC(e,gC(t));const ic=(e,t)=>(0,dC.ZP)(e,oc()(t),{keys:[n=>oc()(n.title)]}),vC=()=>{const[e,t]=(0,r.useState)(""),{formatMessage:n}=(0,A.useIntl)(),s=(0,r.useMemo)(Pu,[]),{collectionTypeLinks:a,singleTypeLinks:l}=(0,fe.useSelector)(h=>s(h),fe.shallowEqual),i=h=>h.map(b=>EC(bC({},b),{title:n({id:b.title,defaultMessage:b.title})})),u=i(a),c=i(l),d=[{id:"collectionTypes",title:{id:v("components.LeftMenu.collection-types"),defaultMessage:"Collection Types"},searchable:!0,links:ae()(ic(u,e),h=>h.title.toLowerCase())},{id:"singleTypes",title:{id:v("components.LeftMenu.single-types"),defaultMessage:"Single Types"},searchable:!0,links:ae()(ic(c,e),h=>h.title.toLowerCase())}],m=()=>{t("")},f=({target:{value:h}})=>{t(h)},y=n({id:v("header.name"),defaultMessage:"Content"});return r.createElement(kt.SubNav,{ariaLabel:y},r.createElement(kt.SubNavHeader,{label:y,searchable:!0,value:e,onChange:f,onClear:m,searchLabel:n({id:"content-manager.components.LeftMenu.Search.label",defaultMessage:"Search for a content type"})}),r.createElement(kt.SubNavSections,null,d.map(h=>{const b=n({id:h.title.id,defaultMessage:h.title.defaultMessage},h.title.values);return r.createElement(kt.SubNavSection,{key:h.id,label:b,badgeLabel:h.links.length.toString()},h.links.map(E=>{const O=E.search?`?${E.search}`:"";return r.createElement(kt.SubNavLink,{as:ee.NavLink,key:E.uid,to:`${E.to}${O}`},E.title)}))})))};var Kr=p(92886);const CC=()=>({type:Kr.ZA}),OC=()=>({type:Kr.c2}),PC=(e,t,n,s)=>({type:Kr.ix,data:{authorizedCtLinks:e,authorizedStLinks:t,components:s,contentTypeSchemas:n}}),lc=(e,t,n=[])=>e.filter(s=>s.isDisplayed).map(s=>{const a=[{action:"plugin::content-manager.explorer.create",subject:s.uid},{action:"plugin::content-manager.explorer.read",subject:s.uid}],l=[{action:"plugin::content-manager.explorer.read",subject:s.uid}],i=t==="collectionTypes"?a:l,u=n.find(({uid:d})=>d===s.uid);let c=null;if(u){const d={page:1,pageSize:u.settings.pageSize,sort:`${u.settings.defaultSortBy}:${u.settings.defaultSortOrder}`};c=(0,Ne.stringify)(d,{encode:!1})}return{permissions:i,search:c,kind:s.kind,title:s.info.displayName,to:`/content-manager/${s.kind}/${s.uid}`,uid:s.uid,name:s.uid,isDisplayed:s.isDisplayed}}),RC=(e,t)=>{const[n,s]=(0,B.chain)(e).groupBy("kind").map((a,l)=>({name:l,links:a})).sortBy("name").value();return{collectionTypesSectionLinks:lc((0,B.get)(n,"links",[]),"collectionTypes",t),singleTypesSectionLinks:lc((0,B.get)(s,"links",[]),"singleTypes")}},cc=(e,t)=>t.map(({permissions:n})=>(0,g.hasPermissions)(e,n));var MC=p(98399),TC=(e,t,n)=>new Promise((s,a)=>{var l=c=>{try{u(n.next(c))}catch(d){a(d)}},i=c=>{try{u(n.throw(c))}catch(d){a(d)}},u=c=>c.done?s(c.value):Promise.resolve(c.value).then(l,i);u((n=n.apply(e,t)).next())});const wC=(e,t,n)=>TC(void 0,null,function*(){try{const{data:{data:s}}=yield ge.be.get(ve("content-types-settings")),{collectionTypesSectionLinks:a,singleTypesSectionLinks:l}=RC(e,s),i=cc(t,a),u=yield Promise.all(i),c=a.filter((y,h)=>u[h]),d=cc(t,l),m=yield Promise.all(d),f=l.filter((y,h)=>m[h]);return{authorizedCtLinks:c,authorizedStLinks:f}}catch(s){return MC.error(s),n({type:"warning",message:{id:"notification.error"}}),{authorizedCtLinks:[],authorizedStLinks:[],contentTypes:[]}}});var IC=p(98399),DC=Object.defineProperty,xC=Object.defineProperties,SC=Object.getOwnPropertyDescriptors,uc=Object.getOwnPropertySymbols,LC=Object.prototype.hasOwnProperty,FC=Object.prototype.propertyIsEnumerable,dc=(e,t,n)=>t in e?DC(e,t,{enumerable:!0,configurable:!0,writable:!0,value:n}):e[t]=n,kC=(e,t)=>{for(var n in t||(t={}))LC.call(t,n)&&dc(e,n,t[n]);if(uc)for(var n of uc(t))FC.call(t,n)&&dc(e,n,t[n]);return e},AC=(e,t)=>xC(e,SC(t)),jC=(e,t,n)=>new Promise((s,a)=>{var l=c=>{try{u(n.next(c))}catch(d){a(d)}},i=c=>{try{u(n.throw(c))}catch(d){a(d)}},u=c=>c.done?s(c.value):Promise.resolve(c.value).then(l,i);u((n=n.apply(e,t)).next())});const $C=()=>{const e=(0,fe.useDispatch)(),t=(0,g.useNotification)(),n=(0,fe.useSelector)(Rt()),s=(0,r.useRef)(),{allPermissions:a}=(0,g.useRBACProvider)(),{runHookWaterfall:l}=(0,g.useStrapiApp)(),u=Se().CancelToken.source(),{notifyStatus:c}=(0,Nr.useNotifyAT)(),{formatMessage:d}=(0,A.useIntl)(),m=()=>jC(void 0,null,function*(){e(CC());try{const[{data:{data:f}},{data:{data:y}}]=yield Promise.all(["components","content-types"].map(C=>ge.be.get(ve(C),{cancelToken:u.token})));c(d({id:v("App.schemas.data-loaded"),defaultMessage:"The schemas have been successfully loaded."}));const{authorizedCtLinks:h,authorizedStLinks:b}=yield wC(y,a,t),{ctLinks:E}=l(zt.LK,{ctLinks:h,models:y}),{stLinks:O}=l(zt.dV,{stLinks:b,models:y}),x=PC(E,O,y,f);e(x)}catch(f){if(Se().isCancel(f))return;IC.error(f),t({type:"warning",message:{id:"notification.error"}})}});return s.current=m,(0,r.useEffect)(()=>(s.current(),()=>{u.cancel("Operation canceled by the user."),e(OC())}),[e,t]),AC(kC({},n),{refetchData:s.current})},BC=De.Z.contentManager,pc=()=>{const e=(0,ee.useRouteMatch)("/content-manager/:kind/:uid"),{status:t,collectionTypeLinks:n,singleTypeLinks:s,models:a,refetchData:l}=$C(),i=ae()([...n,...s],y=>y.title.toLowerCase()),{pathname:u}=(0,ee.useLocation)(),{formatMessage:c}=(0,A.useIntl)(),{startSection:d}=(0,g.useGuidedTour)(),m=(0,r.useRef)(d);if((0,r.useEffect)(()=>{m.current&&m.current("contentManager")},[]),t==="loading")return r.createElement(oe.Main,{"aria-busy":"true"},r.createElement(X.HeaderLayout,{title:c({id:v("header.name"),defaultMessage:"Content"})}),r.createElement(g.LoadingIndicatorPage,null));const f=a.filter(({isDisplayed:y})=>y);return i.length===0&&f.length>0&&u!=="/content-manager/403"?r.createElement(ee.Redirect,{to:"/content-manager/403"}):f.length===0&&u!=="/content-manager/no-content-types"?r.createElement(ee.Redirect,{to:"/content-manager/no-content-types"}):!e&&i.length>0?r.createElement(ee.Redirect,{to:`${i[0].to}${i[0].search?`?${i[0].search}`:""}`}):r.createElement(X.Layout,{sideNav:r.createElement(vC,null)},r.createElement(wc,null),r.createElement(lo.Provider,{value:{refetchData:l}},r.createElement(ee.Switch,null,r.createElement(ee.Route,{path:"/content-manager/components/:uid/configurations/edit"},r.createElement(g.CheckPagePermissions,{permissions:BC.componentsConfigurations},r.createElement(rC,null))),r.createElement(ee.Route,{path:"/content-manager/collectionType/:slug",component:Jv}),r.createElement(ee.Route,{path:"/content-manager/singleType/:slug",component:uC}),r.createElement(ee.Route,{path:"/content-manager/403"},r.createElement(lC,null)),r.createElement(ee.Route,{path:"/content-manager/no-content-types"},r.createElement(iC,null)),r.createElement(ee.Route,{path:"",component:g.NotFound}))))},NC=()=>{const{formatMessage:e}=(0,A.useIntl)();return r.createElement(r.Fragment,null,r.createElement(at.Helmet,{title:e({id:v("plugin.name"),defaultMessage:"Content Manager"})}),r.createElement(pc,null))}},57544:()=>{},59599:()=>{},42310:()=>{},33842:()=>{},85695:()=>{}}]);
|