@nocobase/plugin-theme-editor 1.9.0-beta.9 → 2.0.0-alpha.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/dist/client/1a8ca1e21b09091e.js +10 -0
- package/dist/client/4acfe66b1504e9e2.js +10 -0
- package/dist/client/{f54828f43cde7d12.js → 56efc5f384c11f3a.js} +1 -1
- package/dist/client/{b00409d86c095c84.js → 717f252ea7b0f951.js} +1 -1
- package/dist/client/{25b861dac0654ce8.js → 9f56d6363d65244d.js} +1 -1
- package/dist/client/index.js +1 -1
- package/dist/externalVersion.js +5 -5
- package/dist/server/builtinThemes.js +3 -1
- package/package.json +8 -8
- package/dist/client/c82595eedf47675d.js +0 -10
- package/dist/client/df1f6dbeeffce444.js +0 -10
|
@@ -1,10 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* This file is part of the NocoBase (R) project.
|
|
3
|
-
* Copyright (c) 2020-2024 NocoBase Co., Ltd.
|
|
4
|
-
* Authors: NocoBase Team.
|
|
5
|
-
*
|
|
6
|
-
* This project is dual-licensed under AGPL-3.0 and NocoBase Commercial License.
|
|
7
|
-
* For more information, please refer to: https://www.nocobase.com/agreement.
|
|
8
|
-
*/
|
|
9
|
-
|
|
10
|
-
"use strict";(self.webpackChunk_nocobase_plugin_theme_editor=self.webpackChunk_nocobase_plugin_theme_editor||[]).push([["751"],{3898:function(e,t,n){n.r(t),n.d(t,{default:function(){return O}});var r=n(3772),l=n(7584),a=n(2721),o=n(8156),i=n.n(o),u=n(482),s=n(4987),c=n(6597),d=n(2748),m=n(1820),f=n(7350);function p(e,t){(null==t||t>e.length)&&(t=e.length);for(var n=0,r=Array(t);n<t;n++)r[n]=e[n];return r}function h(e,t,n,r,l,a,o){try{var i=e[a](o),u=i.value}catch(e){n(e);return}i.done?t(u):Promise.resolve(u).then(r,l)}function y(e){return function(){var t=this,n=arguments;return new Promise(function(r,l){var a=e.apply(t,n);function o(e){h(a,r,l,o,i,"next",e)}function i(e){h(a,r,l,o,i,"throw",e)}o(void 0)})}}function b(e){for(var t=1;t<arguments.length;t++){var n=null!=arguments[t]?arguments[t]:{},r=Object.keys(n);"function"==typeof Object.getOwnPropertySymbols&&(r=r.concat(Object.getOwnPropertySymbols(n).filter(function(e){return Object.getOwnPropertyDescriptor(n,e).enumerable}))),r.forEach(function(t){var r;r=n[t],t in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r})}return e}function g(e,t){var n,r,l,a,o={label:0,sent:function(){if(1&l[0])throw l[1];return l[1]},trys:[],ops:[]};return a={next:i(0),throw:i(1),return:i(2)},"function"==typeof Symbol&&(a[Symbol.iterator]=function(){return this}),a;function i(a){return function(i){var u=[a,i];if(n)throw TypeError("Generator is already executing.");for(;o;)try{if(n=1,r&&(l=2&u[0]?r.return:u[0]?r.throw||((l=r.return)&&l.call(r),0):r.next)&&!(l=l.call(r,u[1])).done)return l;switch(r=0,l&&(u=[2&u[0],l.value]),u[0]){case 0:case 1:l=u;break;case 4:return o.label++,{value:u[1],done:!1};case 5:o.label++,r=u[1],u=[0];continue;case 7:u=o.ops.pop(),o.trys.pop();continue;default:if(!(l=(l=o.trys).length>0&&l[l.length-1])&&(6===u[0]||2===u[0])){o=0;continue}if(3===u[0]&&(!l||u[1]>l[0]&&u[1]<l[3])){o.label=u[1];break}if(6===u[0]&&o.label<l[1]){o.label=l[1],l=u;break}if(l&&o.label<l[2]){o.label=l[2],o.ops.push(u);break}l[2]&&o.ops.pop(),o.trys.pop();continue}u=t.call(e,o)}catch(e){u=[6,e],r=0}finally{n=l=0}if(5&u[0])throw u[1];return{value:u[0]?u[1]:void 0,done:!0}}}}var v=function(e){var t,n,l=e.theme,o=(0,r.useToken)().token;return i().createElement(a.ConfigProvider,{theme:(t=b({},l),n=n={inherit:!1},Object.getOwnPropertyDescriptors?Object.defineProperties(t,Object.getOwnPropertyDescriptors(n)):(function(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);n.push.apply(n,r)}return n})(Object(n)).forEach(function(e){Object.defineProperty(t,e,Object.getOwnPropertyDescriptor(n,e))}),t)},i().createElement("div",{style:{display:"flex",justifyContent:"space-between",pointerEvents:"none",width:"100%",height:129,borderRadius:o.borderRadiusLG,overflow:"hidden"}},i().createElement(a.Space,{style:{transform:"scale(0.7) translate(0, 0)",transformOrigin:"0 0"},size:0,align:"start"},i().createElement(s.sq,null))))},C=function(e){var t,n,s,h,C,w,k,E,O,T,S=(0,r.useGlobalTheme)(),j=S.theme,P=S.setTheme,x=S.setCurrentSettingTheme,A=S.setCurrentEditingTheme,D=S.getCurrentEditingTheme,I=(0,f.useThemeEditorContext)().setOpen,_=(0,r.useCurrentUserContext)(),z=e.item,q=e.style,G=void 0===q?{}:q,U=e.onChange,L=(0,r.useAPIClient)(),M=(0,c.Y)().updateUserThemeSettings,R=a.App.useApp().modal,N=(t=i().useState(!1),function(e){if(Array.isArray(e))return e}(t)||function(e,t){var n,r,l=null==e?null:"undefined"!=typeof Symbol&&e[Symbol.iterator]||e["@@iterator"];if(null!=l){var a=[],o=!0,i=!1;try{for(l=l.call(e);!(o=(n=l.next()).done)&&(a.push(n.value),a.length!==t);o=!0);}catch(e){i=!0,r=e}finally{try{o||null==l.return||l.return()}finally{if(i)throw r}}return a}}(t,2)||function(e,t){if(e){if("string"==typeof e)return p(e,2);var n=Object.prototype.toString.call(e).slice(8,-1);if("Object"===n&&e.constructor&&(n=e.constructor.name),"Map"===n||"Set"===n)return Array.from(n);if("Arguments"===n||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n))return p(e,t)}}(t,2)||function(){throw TypeError("Invalid attempt to destructure non-iterable instance.\\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()),B=N[0],Y=N[1],$=(0,m.useThemeId)(),H=$.currentThemeId,F=$.defaultThemeId,J=(0,d.$)().t,K=(0,r.useToken)().token,Q=z.id===F,V=(0,o.useCallback)(function(){Q||R.confirm({title:J("Delete theme"),content:J("Deletion is unrecoverable. Confirm deletion?"),onOk:y(function(){var e,t,n;return g(this,function(r){switch(r.label){case 0:return[4,L.request({url:"themeConfig:destroy/".concat(z.id)})];case 1:return r.sent(),z.id===(null==_||null==(n=_.data)||null==(t=n.data)||null==(e=t.systemSettings)?void 0:e.themeId)&&M(null),a.message.success(J("Deleted successfully")),null==U||U({type:"delete",item:z}),[2]}})})})},[L,null==_||null==(w=_.data)||null==(C=w.data)||null==(h=C.systemSettings)?void 0:h.themeId,Q,z,R,U,J,M]),W=(0,o.useCallback)((n=y(function(e){var t,n,r,o;return g(this,function(i){switch(i.label){case 0:Y(!0),i.label=1;case 1:if(i.trys.push([1,6,,7]),e)return[3,3];return[4,Promise.all([L.request({url:"themeConfig:update/".concat(z.id),method:"post",data:{optional:e,default:!1}}),z.id===(null==_||null==(r=_.data)||null==(n=r.data)||null==(t=n.systemSettings)?void 0:t.themeId)&&M(null)])];case 2:return i.sent(),[3,5];case 3:return[4,L.request({url:"themeConfig:update/".concat(z.id),method:"post",data:{optional:e}})];case 4:i.sent(),i.label=5;case 5:return[3,7];case 6:return o=i.sent(),(0,l.error)(o),[3,7];case 7:return Y(!1),a.message.success(J("Updated successfully")),null==U||U({type:"optional",item:z}),[2]}})}),function(e){return n.apply(this,arguments)}),[L,null==_||null==(O=_.data)||null==(E=O.data)||null==(k=E.systemSettings)?void 0:k.themeId,z,U,J,M]),X=(0,o.useCallback)((s=y(function(e){var t;return g(this,function(n){switch(n.label){case 0:Y(!0),n.label=1;case 1:if(n.trys.push([1,6,,7]),!e)return[3,3];return[4,Promise.all([L.request({url:"themeConfig:update/".concat(z.id),method:"post",data:{optional:!0,default:!0}})])];case 2:return n.sent(),[3,5];case 3:return[4,L.request({url:"themeConfig:update/".concat(z.id),method:"post",data:{default:!1}})];case 4:n.sent(),n.label=5;case 5:return[3,7];case 6:return t=n.sent(),(0,l.error)(t),[3,7];case 7:return Y(!1),a.message.success(J("Updated successfully")),null==U||U({type:"optional",item:z}),[2]}})}),function(e){return s.apply(this,arguments)}),[L,z,U,J]),Z=(0,o.useCallback)(function(){x(j),A(z),P((0,r.compatOldTheme)(z.config)),I(!0)},[z,A,x,I,P,j]),ee=(0,o.useMemo)(function(){return{items:[{key:"optional",label:i().createElement(a.Space,{style:{width:"100%",justifyContent:"space-between"},align:"center",size:"middle",onClick:function(e){return e.stopPropagation()}},i().createElement("span",null,J("User selectable")),i().createElement(a.Switch,{disabled:Q,style:{transform:"translateY(-2px)"},checked:z.optional,size:"small",loading:B,onChange:W}))},{key:"system",label:i().createElement(a.Space,{style:{width:"100%",justifyContent:"space-between"},align:"center",size:"middle",onClick:function(e){return e.stopPropagation()}},i().createElement("span",null,J("Default theme")),i().createElement(a.Switch,{disabled:Q,style:{transform:"translateY(-2px)"},checked:Q,size:"small",loading:B,onChange:X}))}]}},[X,W,Q,z.optional,B,J]),et=(0,o.useMemo)(function(){return[i().createElement(u.EditOutlined,{key:"edit",onClick:Z}),i().createElement(u.DeleteOutlined,{key:"delete",style:Q?{color:K.colorTextDisabled,cursor:"not-allowed"}:null,disabled:Q,onClick:V}),i().createElement(a.Dropdown,{key:"ellipsis",menu:ee},i().createElement(u.EllipsisOutlined,null))]},[V,Z,Q,ee,K.colorTextDisabled]),en=(0,o.useMemo)(function(){if(z.id!==F&&!z.optional)return null;var e=z.id===H?J("Current"):z.id===F?J("Default"):z.optional?J("Optional"):J("Non-optional"),t=z.id===H?"processing":z.id===F?"default":z.optional?"success":"error";return i().createElement(a.Tag,{style:{marginRight:0},color:t},e)},[H,F,z.id,z.optional,J]),er=(0,o.useMemo)(function(){var e;return(null==(e=D())?void 0:e.id)===z.id?b({cursor:"default",width:240,height:240,overflow:"hidden",outline:"1px solid var(--colorSettings)"},G):b({cursor:"default",width:240,height:240,overflow:"hidden"},G)},[D,z.id,G]);return i().createElement(a.Card,{hoverable:!0,extra:en,title:J(null==(T=z.config)?void 0:T.name),size:"small",style:er,headStyle:{minHeight:38},actions:et},i().createElement(v,{theme:z.config}))};C.displayName="ThemeCard";var w=n(9273),k=function(){var e=(0,r.useGlobalTheme)(),t=e.theme,n=e.setTheme,l=e.setCurrentSettingTheme,s=(0,r.useToken)().token,c=(0,f.useThemeEditorContext)().setOpen,m=(0,d.$)().t,p=a.App.useApp().modal,h=(0,o.useCallback)(function(){var e=p.confirm({title:m("Add new theme"),closable:!0,maskClosable:!0,width:"fit-content",footer:i().createElement(a.Space,{style:{float:"right",marginTop:s.margin,justifyContent:"flex-end"},wrap:!0},i().createElement(a.Button,{onClick:function(){l(t),n((0,r.compatOldTheme)(t)),c(!0),e.destroy()}},m("Edit based on current theme")),i().createElement(a.Button,{type:"primary",onClick:function(){l(t),n((0,r.compatOldTheme)(r.defaultTheme)),c(!0),e.destroy()}},m("Create a brand new theme")))})},[p,l,c,n,m,t,s.margin]);return i().createElement(a.Button,{type:"dashed",style:{width:240,height:240,borderRadius:s.borderRadiusLG,borderColor:"var(--colorSettings)",color:"var(--colorSettings)"},icon:i().createElement(u.PlusOutlined,null),onClick:h},m("Add new theme"))};k.displayName="ToEditTheme";var E=function(){var e=(0,w.useThemeListContext)(),t=e.run,n=e.error,u=e.refresh,s=e.data,c=(0,r.useToken)().token;(0,o.useEffect)(function(){s||t()},[]);var d=(0,o.useCallback)(function(){u()},[u]);return n?((0,l.error)(n),null):i().createElement(a.Space,{size:c.marginLG,wrap:!0},null==s?void 0:s.map(function(e){return i().createElement(C,{item:e,key:e.id,onChange:d})}),i().createElement(k,null))};E.displayName="ThemeList";var O=E}}]);
|