@hzab/sider 0.1.0 → 1.0.1
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/CHANGELOG.md +9 -0
- package/package.json +5 -6
- package/src/index.tsx +12 -4
- package/lib/index.js +0 -1
package/CHANGELOG.md
CHANGED
package/package.json
CHANGED
|
@@ -1,18 +1,17 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@hzab/sider",
|
|
3
|
-
"version": "0.1
|
|
3
|
+
"version": "1.0.1",
|
|
4
4
|
"description": "侧边栏",
|
|
5
|
-
"main": "
|
|
5
|
+
"main": "src",
|
|
6
6
|
"scripts": {
|
|
7
7
|
"dev": "webpack serve -c ./config/webpack.config.js --env local",
|
|
8
8
|
"build": "webpack -c ./config/webpack.config.js --env production",
|
|
9
|
-
"publish-patch": "npm
|
|
10
|
-
"publish-minor": "npm
|
|
11
|
-
"publish-major": "npm
|
|
9
|
+
"publish-patch": "npm version patch && npm publish --access public",
|
|
10
|
+
"publish-minor": "npm version minor && npm publish --access public",
|
|
11
|
+
"publish-major": "npm version major && npm publish --access public"
|
|
12
12
|
},
|
|
13
13
|
"files": [
|
|
14
14
|
"CHANGELOG.md",
|
|
15
|
-
"lib",
|
|
16
15
|
"src"
|
|
17
16
|
],
|
|
18
17
|
"keywords": [],
|
package/src/index.tsx
CHANGED
|
@@ -9,12 +9,11 @@ import style from "./index.module.less";
|
|
|
9
9
|
const { Sider: ASider } = Layout;
|
|
10
10
|
|
|
11
11
|
function Sider(props) {
|
|
12
|
-
const { collapsible, collapsedWidth } = props;
|
|
12
|
+
const { collapsible, collapsedWidth, collapsed: pCollapsed, onCollapse } = props;
|
|
13
13
|
const navigate = useNavigate();
|
|
14
14
|
const location = useLocation();
|
|
15
15
|
|
|
16
|
-
const [
|
|
17
|
-
const [collapsed, setCollapsed] = useState(false);
|
|
16
|
+
const [collapsed, setCollapsed] = useState(pCollapsed ?? false);
|
|
18
17
|
const [selected, setSelected] = useState([location.pathname]);
|
|
19
18
|
const [open, setOpen] = useState(location.pathname.split(/(?=\/)/)?.slice(0, 1));
|
|
20
19
|
const [menus, setMenus] = useState(_.cloneDeep(props.menus) || []);
|
|
@@ -73,14 +72,23 @@ function Sider(props) {
|
|
|
73
72
|
|
|
74
73
|
return (
|
|
75
74
|
<ASider
|
|
75
|
+
{...props}
|
|
76
76
|
className={`layout-sider ${style["layout-sider"]} ${props.layoutSiderClassName || ""}`}
|
|
77
77
|
style={{ ...(props.siderStyle || {}) }}
|
|
78
78
|
collapsedWidth={collapsedWidth}
|
|
79
79
|
collapsible={collapsible}
|
|
80
80
|
collapsed={collapsed}
|
|
81
|
-
onCollapse={
|
|
81
|
+
onCollapse={async (val) => {
|
|
82
|
+
const res = await (onCollapse && onCollapse(val));
|
|
83
|
+
if (res !== undefined) {
|
|
84
|
+
setCollapsed(res);
|
|
85
|
+
} else {
|
|
86
|
+
setCollapsed(val);
|
|
87
|
+
}
|
|
88
|
+
}}
|
|
82
89
|
>
|
|
83
90
|
<Menu
|
|
91
|
+
{...props}
|
|
84
92
|
className={`sider-box ${style["sider-box"]} ${props.className || ""}`}
|
|
85
93
|
style={{ ...(props.style || {}) }}
|
|
86
94
|
onClick={onClick}
|
package/lib/index.js
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
!function(t,e){"object"==typeof exports&&"object"==typeof module?module.exports=e(require("@ant-design/icons"),require("antd"),require("lodash"),require("react"),require("react-router-dom")):"function"==typeof define&&define.amd?define(["@ant-design/icons","antd","lodash","react","react-router-dom"],e):"object"==typeof exports?exports.sider=e(require("@ant-design/icons"),require("antd"),require("lodash"),require("react"),require("react-router-dom")):t.sider=e(t["@ant-design/icons"],t.antd,t.lodash,t.react,t["react-router-dom"])}(self,((t,e,r,n,o)=>(()=>{var i={38:(t,e,r)=>{"use strict";r.d(e,{Z:()=>c});var n=r(81),o=r.n(n),i=r(645),a=r.n(i)()(o());a.push([t.id,".layout-sider_xJMnHAH8 {\n position: relative;\n background-color: transparent;\n height: 100%;\n}\n.layout-sider_xJMnHAH8 .sider-box_V6sF9hhA {\n height: 100%;\n overflow-x: hidden;\n overflow-y: auto;\n /* 滚动条整体样式 */\n /* 滚动条轨道 */\n /* 滚动条里面的滑块 */\n /* 滚动条里面的滑块 hover 的情况 */\n}\n.layout-sider_xJMnHAH8 .sider-box_V6sF9hhA::-webkit-scrollbar {\n width: 4px;\n height: 4px;\n}\n.layout-sider_xJMnHAH8 .sider-box_V6sF9hhA::-webkit-scrollbar-track {\n background: #efefef;\n}\n.layout-sider_xJMnHAH8 .sider-box_V6sF9hhA::-webkit-scrollbar-thumb {\n background: rgba(144, 147, 153, 0.3);\n border-radius: 4px;\n}\n.layout-sider_xJMnHAH8 .sider-box_V6sF9hhA::-webkit-scrollbar-thumb:hover {\n background: rgba(144, 147, 153, 0.5);\n}\n.layout-sider .ant-layout-sider-zero-width-trigger {\n background-color: #fff;\n color: #333;\n border: 1px solid #f0f0f0;\n}\n",""]),a.locals={"layout-sider":"layout-sider_xJMnHAH8","sider-box":"sider-box_V6sF9hhA"};const c=a},645:t=>{"use strict";t.exports=function(t){var e=[];return e.toString=function(){return this.map((function(e){var r="",n=void 0!==e[5];return e[4]&&(r+="@supports (".concat(e[4],") {")),e[2]&&(r+="@media ".concat(e[2]," {")),n&&(r+="@layer".concat(e[5].length>0?" ".concat(e[5]):""," {")),r+=t(e),n&&(r+="}"),e[2]&&(r+="}"),e[4]&&(r+="}"),r})).join("")},e.i=function(t,r,n,o,i){"string"==typeof t&&(t=[[null,t,void 0]]);var a={};if(n)for(var c=0;c<this.length;c++){var u=this[c][0];null!=u&&(a[u]=!0)}for(var s=0;s<t.length;s++){var l=[].concat(t[s]);n&&a[l[0]]||(void 0!==i&&(void 0===l[5]||(l[1]="@layer".concat(l[5].length>0?" ".concat(l[5]):""," {").concat(l[1],"}")),l[5]=i),r&&(l[2]?(l[1]="@media ".concat(l[2]," {").concat(l[1],"}"),l[2]=r):l[2]=r),o&&(l[4]?(l[1]="@supports (".concat(l[4],") {").concat(l[1],"}"),l[4]=o):l[4]="".concat(o)),e.push(l))}},e}},81:t=>{"use strict";t.exports=function(t){return t[1]}},379:t=>{"use strict";var e=[];function r(t){for(var r=-1,n=0;n<e.length;n++)if(e[n].identifier===t){r=n;break}return r}function n(t,n){for(var i={},a=[],c=0;c<t.length;c++){var u=t[c],s=n.base?u[0]+n.base:u[0],l=i[s]||0,f="".concat(s," ").concat(l);i[s]=l+1;var p=r(f),d={css:u[1],media:u[2],sourceMap:u[3],supports:u[4],layer:u[5]};if(-1!==p)e[p].references++,e[p].updater(d);else{var h=o(d,n);n.byIndex=c,e.splice(c,0,{identifier:f,updater:h,references:1})}a.push(f)}return a}function o(t,e){var r=e.domAPI(e);r.update(t);return function(e){if(e){if(e.css===t.css&&e.media===t.media&&e.sourceMap===t.sourceMap&&e.supports===t.supports&&e.layer===t.layer)return;r.update(t=e)}else r.remove()}}t.exports=function(t,o){var i=n(t=t||[],o=o||{});return function(t){t=t||[];for(var a=0;a<i.length;a++){var c=r(i[a]);e[c].references--}for(var u=n(t,o),s=0;s<i.length;s++){var l=r(i[s]);0===e[l].references&&(e[l].updater(),e.splice(l,1))}i=u}}},569:t=>{"use strict";var e={};t.exports=function(t,r){var n=function(t){if(void 0===e[t]){var r=document.querySelector(t);if(window.HTMLIFrameElement&&r instanceof window.HTMLIFrameElement)try{r=r.contentDocument.head}catch(t){r=null}e[t]=r}return e[t]}(t);if(!n)throw new Error("Couldn't find a style target. This probably means that the value for the 'insert' parameter is invalid.");n.appendChild(r)}},216:t=>{"use strict";t.exports=function(t){var e=document.createElement("style");return t.setAttributes(e,t.attributes),t.insert(e,t.options),e}},565:(t,e,r)=>{"use strict";t.exports=function(t){var e=r.nc;e&&t.setAttribute("nonce",e)}},795:t=>{"use strict";t.exports=function(t){var e=t.insertStyleElement(t);return{update:function(r){!function(t,e,r){var n="";r.supports&&(n+="@supports (".concat(r.supports,") {")),r.media&&(n+="@media ".concat(r.media," {"));var o=void 0!==r.layer;o&&(n+="@layer".concat(r.layer.length>0?" ".concat(r.layer):""," {")),n+=r.css,o&&(n+="}"),r.media&&(n+="}"),r.supports&&(n+="}");var i=r.sourceMap;i&&"undefined"!=typeof btoa&&(n+="\n/*# sourceMappingURL=data:application/json;base64,".concat(btoa(unescape(encodeURIComponent(JSON.stringify(i))))," */")),e.styleTagTransform(n,t,e.options)}(e,t,r)},remove:function(){!function(t){if(null===t.parentNode)return!1;t.parentNode.removeChild(t)}(e)}}}},589:t=>{"use strict";t.exports=function(t,e){if(e.styleSheet)e.styleSheet.cssText=t;else{for(;e.firstChild;)e.removeChild(e.firstChild);e.appendChild(document.createTextNode(t))}}},482:e=>{"use strict";e.exports=t},721:t=>{"use strict";t.exports=e},467:t=>{"use strict";t.exports=r},156:t=>{"use strict";t.exports=n},128:t=>{"use strict";t.exports=o},61:(t,e,r)=>{var n=r(698).default;function o(){"use strict";t.exports=o=function(){return e},t.exports.__esModule=!0,t.exports.default=t.exports;var e={},r=Object.prototype,i=r.hasOwnProperty,a=Object.defineProperty||function(t,e,r){t[e]=r.value},c="function"==typeof Symbol?Symbol:{},u=c.iterator||"@@iterator",s=c.asyncIterator||"@@asyncIterator",l=c.toStringTag||"@@toStringTag";function f(t,e,r){return Object.defineProperty(t,e,{value:r,enumerable:!0,configurable:!0,writable:!0}),t[e]}try{f({},"")}catch(t){f=function(t,e,r){return t[e]=r}}function p(t,e,r,n){var o=e&&e.prototype instanceof y?e:y,i=Object.create(o.prototype),c=new k(n||[]);return a(i,"_invoke",{value:j(t,r,c)}),i}function d(t,e,r){try{return{type:"normal",arg:t.call(e,r)}}catch(t){return{type:"throw",arg:t}}}e.wrap=p;var h={};function y(){}function v(){}function m(){}var b={};f(b,u,(function(){return this}));var g=Object.getPrototypeOf,x=g&&g(g(A([])));x&&x!==r&&i.call(x,u)&&(b=x);var w=m.prototype=y.prototype=Object.create(b);function S(t){["next","throw","return"].forEach((function(e){f(t,e,(function(t){return this._invoke(e,t)}))}))}function O(t,e){function r(o,a,c,u){var s=d(t[o],t,a);if("throw"!==s.type){var l=s.arg,f=l.value;return f&&"object"==n(f)&&i.call(f,"__await")?e.resolve(f.__await).then((function(t){r("next",t,c,u)}),(function(t){r("throw",t,c,u)})):e.resolve(f).then((function(t){l.value=t,c(l)}),(function(t){return r("throw",t,c,u)}))}u(s.arg)}var o;a(this,"_invoke",{value:function(t,n){function i(){return new e((function(e,o){r(t,n,e,o)}))}return o=o?o.then(i,i):i()}})}function j(t,e,r){var n="suspendedStart";return function(o,i){if("executing"===n)throw new Error("Generator is already running");if("completed"===n){if("throw"===o)throw i;return P()}for(r.method=o,r.arg=i;;){var a=r.delegate;if(a){var c=_(a,r);if(c){if(c===h)continue;return c}}if("next"===r.method)r.sent=r._sent=r.arg;else if("throw"===r.method){if("suspendedStart"===n)throw n="completed",r.arg;r.dispatchException(r.arg)}else"return"===r.method&&r.abrupt("return",r.arg);n="executing";var u=d(t,e,r);if("normal"===u.type){if(n=r.done?"completed":"suspendedYield",u.arg===h)continue;return{value:u.arg,done:r.done}}"throw"===u.type&&(n="completed",r.method="throw",r.arg=u.arg)}}}function _(t,e){var r=e.method,n=t.iterator[r];if(void 0===n)return e.delegate=null,"throw"===r&&t.iterator.return&&(e.method="return",e.arg=void 0,_(t,e),"throw"===e.method)||"return"!==r&&(e.method="throw",e.arg=new TypeError("The iterator does not provide a '"+r+"' method")),h;var o=d(n,t.iterator,e.arg);if("throw"===o.type)return e.method="throw",e.arg=o.arg,e.delegate=null,h;var i=o.arg;return i?i.done?(e[t.resultName]=i.value,e.next=t.nextLoc,"return"!==e.method&&(e.method="next",e.arg=void 0),e.delegate=null,h):i:(e.method="throw",e.arg=new TypeError("iterator result is not an object"),e.delegate=null,h)}function E(t){var e={tryLoc:t[0]};1 in t&&(e.catchLoc=t[1]),2 in t&&(e.finallyLoc=t[2],e.afterLoc=t[3]),this.tryEntries.push(e)}function L(t){var e=t.completion||{};e.type="normal",delete e.arg,t.completion=e}function k(t){this.tryEntries=[{tryLoc:"root"}],t.forEach(E,this),this.reset(!0)}function A(t){if(t){var e=t[u];if(e)return e.call(t);if("function"==typeof t.next)return t;if(!isNaN(t.length)){var r=-1,n=function e(){for(;++r<t.length;)if(i.call(t,r))return e.value=t[r],e.done=!1,e;return e.value=void 0,e.done=!0,e};return n.next=n}}return{next:P}}function P(){return{value:void 0,done:!0}}return v.prototype=m,a(w,"constructor",{value:m,configurable:!0}),a(m,"constructor",{value:v,configurable:!0}),v.displayName=f(m,l,"GeneratorFunction"),e.isGeneratorFunction=function(t){var e="function"==typeof t&&t.constructor;return!!e&&(e===v||"GeneratorFunction"===(e.displayName||e.name))},e.mark=function(t){return Object.setPrototypeOf?Object.setPrototypeOf(t,m):(t.__proto__=m,f(t,l,"GeneratorFunction")),t.prototype=Object.create(w),t},e.awrap=function(t){return{__await:t}},S(O.prototype),f(O.prototype,s,(function(){return this})),e.AsyncIterator=O,e.async=function(t,r,n,o,i){void 0===i&&(i=Promise);var a=new O(p(t,r,n,o),i);return e.isGeneratorFunction(r)?a:a.next().then((function(t){return t.done?t.value:a.next()}))},S(w),f(w,l,"Generator"),f(w,u,(function(){return this})),f(w,"toString",(function(){return"[object Generator]"})),e.keys=function(t){var e=Object(t),r=[];for(var n in e)r.push(n);return r.reverse(),function t(){for(;r.length;){var n=r.pop();if(n in e)return t.value=n,t.done=!1,t}return t.done=!0,t}},e.values=A,k.prototype={constructor:k,reset:function(t){if(this.prev=0,this.next=0,this.sent=this._sent=void 0,this.done=!1,this.delegate=null,this.method="next",this.arg=void 0,this.tryEntries.forEach(L),!t)for(var e in this)"t"===e.charAt(0)&&i.call(this,e)&&!isNaN(+e.slice(1))&&(this[e]=void 0)},stop:function(){this.done=!0;var t=this.tryEntries[0].completion;if("throw"===t.type)throw t.arg;return this.rval},dispatchException:function(t){if(this.done)throw t;var e=this;function r(r,n){return a.type="throw",a.arg=t,e.next=r,n&&(e.method="next",e.arg=void 0),!!n}for(var n=this.tryEntries.length-1;n>=0;--n){var o=this.tryEntries[n],a=o.completion;if("root"===o.tryLoc)return r("end");if(o.tryLoc<=this.prev){var c=i.call(o,"catchLoc"),u=i.call(o,"finallyLoc");if(c&&u){if(this.prev<o.catchLoc)return r(o.catchLoc,!0);if(this.prev<o.finallyLoc)return r(o.finallyLoc)}else if(c){if(this.prev<o.catchLoc)return r(o.catchLoc,!0)}else{if(!u)throw new Error("try statement without catch or finally");if(this.prev<o.finallyLoc)return r(o.finallyLoc)}}}},abrupt:function(t,e){for(var r=this.tryEntries.length-1;r>=0;--r){var n=this.tryEntries[r];if(n.tryLoc<=this.prev&&i.call(n,"finallyLoc")&&this.prev<n.finallyLoc){var o=n;break}}o&&("break"===t||"continue"===t)&&o.tryLoc<=e&&e<=o.finallyLoc&&(o=null);var a=o?o.completion:{};return a.type=t,a.arg=e,o?(this.method="next",this.next=o.finallyLoc,h):this.complete(a)},complete:function(t,e){if("throw"===t.type)throw t.arg;return"break"===t.type||"continue"===t.type?this.next=t.arg:"return"===t.type?(this.rval=this.arg=t.arg,this.method="return",this.next="end"):"normal"===t.type&&e&&(this.next=e),h},finish:function(t){for(var e=this.tryEntries.length-1;e>=0;--e){var r=this.tryEntries[e];if(r.finallyLoc===t)return this.complete(r.completion,r.afterLoc),L(r),h}},catch:function(t){for(var e=this.tryEntries.length-1;e>=0;--e){var r=this.tryEntries[e];if(r.tryLoc===t){var n=r.completion;if("throw"===n.type){var o=n.arg;L(r)}return o}}throw new Error("illegal catch attempt")},delegateYield:function(t,e,r){return this.delegate={iterator:A(t),resultName:e,nextLoc:r},"next"===this.method&&(this.arg=void 0),h}},e}t.exports=o,t.exports.__esModule=!0,t.exports.default=t.exports},698:t=>{function e(r){return t.exports=e="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},t.exports.__esModule=!0,t.exports.default=t.exports,e(r)}t.exports=e,t.exports.__esModule=!0,t.exports.default=t.exports},687:(t,e,r)=>{var n=r(61)();t.exports=n;try{regeneratorRuntime=n}catch(t){"object"==typeof globalThis?globalThis.regeneratorRuntime=n:Function("r","regeneratorRuntime = r")(n)}}},a={};function c(t){var e=a[t];if(void 0!==e)return e.exports;var r=a[t]={id:t,exports:{}};return i[t](r,r.exports,c),r.exports}c.n=t=>{var e=t&&t.__esModule?()=>t.default:()=>t;return c.d(e,{a:e}),e},c.d=(t,e)=>{for(var r in e)c.o(e,r)&&!c.o(t,r)&&Object.defineProperty(t,r,{enumerable:!0,get:e[r]})},c.o=(t,e)=>Object.prototype.hasOwnProperty.call(t,e),c.r=t=>{"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(t,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(t,"__esModule",{value:!0})},c.nc=void 0;var u={};return(()=>{"use strict";function t(e){return t="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},t(e)}function e(e){var r=function(e,r){if("object"!==t(e)||null===e)return e;var n=e[Symbol.toPrimitive];if(void 0!==n){var o=n.call(e,r||"default");if("object"!==t(o))return o;throw new TypeError("@@toPrimitive must return a primitive value.")}return("string"===r?String:Number)(e)}(e,"string");return"symbol"===t(r)?r:String(r)}function r(t,r,n){return(r=e(r))in t?Object.defineProperty(t,r,{value:n,enumerable:!0,configurable:!0,writable:!0}):t[r]=n,t}function n(t,e,r,n,o,i,a){try{var c=t[i](a),u=c.value}catch(t){return void r(t)}c.done?e(u):Promise.resolve(u).then(n,o)}function o(t,e){(null==e||e>t.length)&&(e=t.length);for(var r=0,n=new Array(e);r<e;r++)n[r]=t[r];return n}function i(t,e){return function(t){if(Array.isArray(t))return t}(t)||function(t,e){var r=null==t?null:"undefined"!=typeof Symbol&&t[Symbol.iterator]||t["@@iterator"];if(null!=r){var n,o,i,a,c=[],u=!0,s=!1;try{if(i=(r=r.call(t)).next,0===e){if(Object(r)!==r)return;u=!1}else for(;!(u=(n=i.call(r)).done)&&(c.push(n.value),c.length!==e);u=!0);}catch(t){s=!0,o=t}finally{try{if(!u&&null!=r.return&&(a=r.return(),Object(a)!==a))return}finally{if(s)throw o}}return c}}(t,e)||function(t,e){if(t){if("string"==typeof t)return o(t,e);var r=Object.prototype.toString.call(t).slice(8,-1);return"Object"===r&&t.constructor&&(r=t.constructor.name),"Map"===r||"Set"===r?Array.from(t):"Arguments"===r||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(r)?o(t,e):void 0}}(t,e)||function(){throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()}c.r(u),c.d(u,{default:()=>H});var a=c(687),s=c.n(a),l=c(156),f=c.n(l),p=c(128),d=c(721),h=c(482),y=c(467),v=c.n(y),m=c(379),b=c.n(m),g=c(795),x=c.n(g),w=c(569),S=c.n(w),O=c(565),j=c.n(O),_=c(216),E=c.n(_),L=c(589),k=c.n(L),A=c(38),P={};P.styleTagTransform=k(),P.setAttributes=j(),P.insert=S().bind(null,"head"),P.domAPI=x(),P.insertStyleElement=E();b()(A.Z,P);const M=A.Z&&A.Z.locals?A.Z.locals:void 0;function T(t,e){var r=Object.keys(t);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(t);e&&(n=n.filter((function(e){return Object.getOwnPropertyDescriptor(t,e).enumerable}))),r.push.apply(r,n)}return r}function N(t){for(var e=1;e<arguments.length;e++){var n=null!=arguments[e]?arguments[e]:{};e%2?T(Object(n),!0).forEach((function(e){r(t,e,n[e])})):Object.getOwnPropertyDescriptors?Object.defineProperties(t,Object.getOwnPropertyDescriptors(n)):T(Object(n)).forEach((function(e){Object.defineProperty(t,e,Object.getOwnPropertyDescriptor(n,e))}))}return t}var C=d.Layout.Sider;const H=function(t){var e,r=t.collapsible,o=t.collapsedWidth,a=(0,p.useNavigate)(),c=(0,p.useLocation)(),u=i((0,l.useState)(!1),2),y=(u[0],u[1],i((0,l.useState)(!1),2)),m=y[0],b=y[1],g=i((0,l.useState)([c.pathname]),2),x=g[0],w=g[1],S=i((0,l.useState)(null===(e=c.pathname.split(/(?=\/)/))||void 0===e?void 0:e.slice(0,1)),2),O=S[0],j=S[1],_=i((0,l.useState)(v().cloneDeep(t.menus)||[]),2),E=_[0],L=_[1];function k(){var e;return e=s().mark((function e(r){return s().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(!t.onClick){e.next=6;break}return e.next=3,t.onClick(r);case 3:if(!1!==e.sent){e.next=6;break}return e.abrupt("return");case 6:a(r.key);case 7:case"end":return e.stop()}}),e)})),k=function(){var t=this,r=arguments;return new Promise((function(o,i){var a=e.apply(t,r);function c(t){n(a,o,i,c,u,"next",t)}function u(t){n(a,o,i,c,u,"throw",t)}c(void 0)}))},k.apply(this,arguments)}return(0,l.useEffect)((function(){var t=c.pathname.split(/(?=\/)/);if(t.length>0){var e=[],r=[],n="";t.forEach((function(t){n="".concat(n).concat(t),e.push(n),r.push(n)})),w(r),j(e)}}),[c.pathname]),(0,l.useEffect)((function(){var e=v().cloneDeep(t.menus);null==e||e.map((function(t){var e,r,n=t.icon;/^[A-Z]/.test(n)&&h&&h[n]?n=f().createElement(h&&h[n],{style:{fontSize:"14px"}}):null!==(e=n)&&void 0!==e&&e.startsWith&&null!==(r=n)&&void 0!==r&&r.startsWith("icon-")&&(n=f().createElement("i",{className:"sider-icon icon-iconfont "+n})),t.icon=n})),L(e)}),[t.menus]),f().createElement(C,{className:"layout-sider ".concat(M["layout-sider"]," ").concat(t.layoutSiderClassName||""),style:N({},t.siderStyle||{}),collapsedWidth:o,collapsible:r,collapsed:m,onCollapse:b},f().createElement(d.Menu,{className:"sider-box ".concat(M["sider-box"]," ").concat(t.className||""),style:N({},t.style||{}),onClick:function(t){return k.apply(this,arguments)},onOpenChange:function(e){j(e),t.onOpenChange&&t.onOpenChange(e)},selectedKeys:x,openKeys:O,mode:"inline",items:E}))}})(),u})()));
|