@hzab/sider 1.0.1 → 1.0.3
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 +5 -14
- package/LICENSE +21 -0
- package/dist/index.cjs +1 -0
- package/dist/index.css +2 -0
- package/dist/index.d.ts +3 -0
- package/dist/index.js +85 -0
- package/package.json +45 -25
- package/src/index.module.less +4 -0
- package/src/index.tsx +3 -3
- package/src/vite-env.d.ts +1 -0
- package/README.md +0 -114
package/CHANGELOG.md
CHANGED
|
@@ -1,16 +1,7 @@
|
|
|
1
|
-
# @hzab/sider@1.0.
|
|
1
|
+
# @hzab/sider@1.0.3
|
|
2
2
|
|
|
3
|
-
|
|
3
|
+
chore: 本仓迁移版本首次发布(源码直出 `main: "src"` + 类型入口指向 `dist`)
|
|
4
4
|
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
break: 入口文件 src,去除 lib
|
|
9
|
-
|
|
10
|
-
# @hzab/sider@0.1.0
|
|
11
|
-
|
|
12
|
-
- 支持收起、支持收起成浮动块
|
|
13
|
-
|
|
14
|
-
# @hzab/sider@0.0.1
|
|
15
|
-
|
|
16
|
-
组件初始化
|
|
5
|
+
- 构建切换到本仓 `@hzab/vite-config` 组件库工厂(`vite build` + `tsc --emitDeclarationOnly` 产出 `dist`)
|
|
6
|
+
- 运行时依赖上移至 `peerDependencies`
|
|
7
|
+
- 组件运行时行为与来源仓 1.0.2 保持一致
|
package/LICENSE
ADDED
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
MIT License
|
|
2
|
+
|
|
3
|
+
Copyright (c) 2026 CaiYansong
|
|
4
|
+
|
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
6
|
+
of this software and associated documentation files (the "Software"), to deal
|
|
7
|
+
in the Software without restriction, including without limitation the rights
|
|
8
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
9
|
+
copies of the Software, and to permit persons to whom the Software is
|
|
10
|
+
furnished to do so, subject to the following conditions:
|
|
11
|
+
|
|
12
|
+
The above copyright notice and this permission notice shall be included in all
|
|
13
|
+
copies or substantial portions of the Software.
|
|
14
|
+
|
|
15
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
16
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
17
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
18
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
19
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
20
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
21
|
+
SOFTWARE.
|
package/dist/index.cjs
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
var e=Object.create,t=Object.defineProperty,n=Object.getOwnPropertyDescriptor,r=Object.getOwnPropertyNames,i=Object.getPrototypeOf,a=Object.prototype.hasOwnProperty,o=(e,i,o,s)=>{if(i&&typeof i==`object`||typeof i==`function`)for(var c=r(i),l=0,u=c.length,d;l<u;l++)d=c[l],!a.call(e,d)&&d!==o&&t(e,d,{get:(e=>i[e]).bind(null,d),enumerable:!(s=n(i,d))||s.enumerable});return e},s=(n,r,s)=>(s=n==null?{}:e(i(n)),o(r||!n||!n.__esModule||!a.call(n,`default`)?t(s,`default`,{value:n,enumerable:!0}):s,n));let c=require("react/compiler-runtime"),l=require("react");l=s(l,1);let u=require("react-router-dom"),d=require("antd"),f=require("@ant-design/icons");f=s(f,1);let p=require("lodash");p=s(p,1);let m=require("react/jsx-runtime");var h={"layout-sider":`_layout-sider_wu8rw_1`,"sider-box":`_sider-box_wu8rw_6`},{Sider:g}=d.Layout;function _(e){let t=(0,c.c)(45),{collapsible:n,collapsedWidth:r,collapsed:i,onCollapse:a}=e,o=(0,u.useNavigate)(),s=(0,u.useLocation)(),[f,_]=(0,l.useState)(i??!1),y;t[0]===s.pathname?y=t[1]:(y=[s.pathname],t[0]=s.pathname,t[1]=y);let[b,x]=(0,l.useState)(y),S;t[2]===s.pathname?S=t[3]:(S=s.pathname.split(/(?=\/)/)?.slice(0,1),t[2]=s.pathname,t[3]=S);let[C,w]=(0,l.useState)(S),T;t[4]===e.menus?T=t[5]:(T=p.default.cloneDeep(e.menus)||[],t[4]=e.menus,t[5]=T);let[E,D]=(0,l.useState)(T),O,k;t[6]===s.pathname?(O=t[7],k=t[8]):(O=()=>{let e=s.pathname.split(/(?=\/)/);if(e.length>0){let t=[],n=[],r=``;e.forEach(e=>{r=`${r}${e}`,t.push(r),n.push(r)}),x(n),w(t)}},k=[s.pathname],t[6]=s.pathname,t[7]=O,t[8]=k),(0,l.useEffect)(O,k);let A,j;t[9]===e.menus?(A=t[10],j=t[11]):(A=()=>{let t=p.default.cloneDeep(e.menus);t?.map(v),D(t)},j=[e.menus],t[9]=e.menus,t[10]=A,t[11]=j),(0,l.useEffect)(A,j);let M;t[12]!==o||t[13]!==e?(M=async function(t){e.onClick&&await e.onClick(t)===!1||o(t.key)},t[12]=o,t[13]=e,t[14]=M):M=t[14];let N=M,P;t[15]===e?P=t[16]:(P=function(t){w(t),e.onOpenChange&&e.onOpenChange(t)},t[15]=e,t[16]=P);let F=P,I=`layout-sider ${h[`layout-sider`]} ${e.layoutSiderClassName||``}`,L;t[17]===e.siderStyle?L=t[18]:(L=e.siderStyle||{},t[17]=e.siderStyle,t[18]=L);let R;t[19]===L?R=t[20]:(R={...L},t[19]=L,t[20]=R);let z;t[21]===a?z=t[22]:(z=async e=>{let t=await(a&&a(e));_(t===void 0?e:t)},t[21]=a,t[22]=z);let B=`sider-box ${h[`sider-box`]} ${e.className||``}`,V;t[23]===e.style?V=t[24]:(V=e.style||{},t[23]=e.style,t[24]=V);let H;t[25]===V?H=t[26]:(H={...V},t[25]=V,t[26]=H);let U;t[27]!==E||t[28]!==N||t[29]!==F||t[30]!==C||t[31]!==e||t[32]!==b||t[33]!==B||t[34]!==H?(U=(0,m.jsx)(d.Menu,{...e,className:B,style:H,onClick:N,onOpenChange:F,selectedKeys:b,openKeys:C,mode:`inline`,items:E}),t[27]=E,t[28]=N,t[29]=F,t[30]=C,t[31]=e,t[32]=b,t[33]=B,t[34]=H,t[35]=U):U=t[35];let W;return t[36]!==f||t[37]!==r||t[38]!==n||t[39]!==e||t[40]!==R||t[41]!==z||t[42]!==U||t[43]!==I?(W=(0,m.jsx)(g,{...e,className:I,style:R,collapsedWidth:r,collapsible:n,collapsed:f,onCollapse:z,children:U}),t[36]=f,t[37]=r,t[38]=n,t[39]=e,t[40]=R,t[41]=z,t[42]=U,t[43]=I,t[44]=W):W=t[44],W}function v(e){let t=e.icon;/^[A-Z]/.test(t)&&f&&f[t]?t=l.default.createElement(f&&f[t],{style:{fontSize:`14px`}}):t?.startsWith&&t?.startsWith(`icon-`)&&(t=(0,m.jsx)(`i`,{className:`sider-icon icon-iconfont `+t})),e.icon=t}module.exports=_;
|
package/dist/index.css
ADDED
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
._layout-sider_wu8rw_1{background-color:#0000;height:100%;position:relative}._layout-sider_wu8rw_1 ._sider-box_wu8rw_6{height:100%;overflow:hidden auto}._layout-sider_wu8rw_1 ._sider-box_wu8rw_6::-webkit-scrollbar{width:4px;height:4px}._layout-sider_wu8rw_1 ._sider-box_wu8rw_6::-webkit-scrollbar-track{background:#efefef}._layout-sider_wu8rw_1 ._sider-box_wu8rw_6::-webkit-scrollbar-thumb{background:#9093994d;border-radius:4px}._layout-sider_wu8rw_1 ._sider-box_wu8rw_6::-webkit-scrollbar-thumb:hover{background:#90939980}.layout-sider .ant-layout-sider-zero-width-trigger{color:#333;background-color:#fff;border:1px solid #f0f0f0}.layout-sider .ant-layout-sider-trigger{color:#333;background-color:#0000}
|
|
2
|
+
/*$vite$:1*/
|
package/dist/index.d.ts
ADDED
package/dist/index.js
ADDED
|
@@ -0,0 +1,85 @@
|
|
|
1
|
+
import { c as e } from "react/compiler-runtime";
|
|
2
|
+
import t, { useEffect as n, useState as r } from "react";
|
|
3
|
+
import { useLocation as i, useNavigate as a } from "react-router-dom";
|
|
4
|
+
import { Layout as o, Menu as s } from "antd";
|
|
5
|
+
import * as c from "@ant-design/icons";
|
|
6
|
+
import l from "lodash";
|
|
7
|
+
import { jsx as u } from "react/jsx-runtime";
|
|
8
|
+
//#region src/index.module.less
|
|
9
|
+
var d = {
|
|
10
|
+
"layout-sider": "_layout-sider_wu8rw_1",
|
|
11
|
+
"sider-box": "_sider-box_wu8rw_6"
|
|
12
|
+
}, { Sider: f } = o;
|
|
13
|
+
function p(t) {
|
|
14
|
+
let o = e(45), { collapsible: c, collapsedWidth: p, collapsed: h, onCollapse: g } = t, _ = a(), v = i(), [y, b] = r(h ?? !1), x;
|
|
15
|
+
o[0] === v.pathname ? x = o[1] : (x = [v.pathname], o[0] = v.pathname, o[1] = x);
|
|
16
|
+
let [S, C] = r(x), w;
|
|
17
|
+
o[2] === v.pathname ? w = o[3] : (w = v.pathname.split(/(?=\/)/)?.slice(0, 1), o[2] = v.pathname, o[3] = w);
|
|
18
|
+
let [T, E] = r(w), D;
|
|
19
|
+
o[4] === t.menus ? D = o[5] : (D = l.cloneDeep(t.menus) || [], o[4] = t.menus, o[5] = D);
|
|
20
|
+
let [O, k] = r(D), A, j;
|
|
21
|
+
o[6] === v.pathname ? (A = o[7], j = o[8]) : (A = () => {
|
|
22
|
+
let e = v.pathname.split(/(?=\/)/);
|
|
23
|
+
if (e.length > 0) {
|
|
24
|
+
let t = [], n = [], r = "";
|
|
25
|
+
e.forEach((e) => {
|
|
26
|
+
r = `${r}${e}`, t.push(r), n.push(r);
|
|
27
|
+
}), C(n), E(t);
|
|
28
|
+
}
|
|
29
|
+
}, j = [v.pathname], o[6] = v.pathname, o[7] = A, o[8] = j), n(A, j);
|
|
30
|
+
let M, N;
|
|
31
|
+
o[9] === t.menus ? (M = o[10], N = o[11]) : (M = () => {
|
|
32
|
+
let e = l.cloneDeep(t.menus);
|
|
33
|
+
e?.map(m), k(e);
|
|
34
|
+
}, N = [t.menus], o[9] = t.menus, o[10] = M, o[11] = N), n(M, N);
|
|
35
|
+
let P;
|
|
36
|
+
o[12] !== _ || o[13] !== t ? (P = async function(e) {
|
|
37
|
+
t.onClick && await t.onClick(e) === !1 || _(e.key);
|
|
38
|
+
}, o[12] = _, o[13] = t, o[14] = P) : P = o[14];
|
|
39
|
+
let F = P, I;
|
|
40
|
+
o[15] === t ? I = o[16] : (I = function(e) {
|
|
41
|
+
E(e), t.onOpenChange && t.onOpenChange(e);
|
|
42
|
+
}, o[15] = t, o[16] = I);
|
|
43
|
+
let L = I, R = `layout-sider ${d["layout-sider"]} ${t.layoutSiderClassName || ""}`, z;
|
|
44
|
+
o[17] === t.siderStyle ? z = o[18] : (z = t.siderStyle || {}, o[17] = t.siderStyle, o[18] = z);
|
|
45
|
+
let B;
|
|
46
|
+
o[19] === z ? B = o[20] : (B = { ...z }, o[19] = z, o[20] = B);
|
|
47
|
+
let V;
|
|
48
|
+
o[21] === g ? V = o[22] : (V = async (e) => {
|
|
49
|
+
let t = await (g && g(e));
|
|
50
|
+
b(t === void 0 ? e : t);
|
|
51
|
+
}, o[21] = g, o[22] = V);
|
|
52
|
+
let H = `sider-box ${d["sider-box"]} ${t.className || ""}`, U;
|
|
53
|
+
o[23] === t.style ? U = o[24] : (U = t.style || {}, o[23] = t.style, o[24] = U);
|
|
54
|
+
let W;
|
|
55
|
+
o[25] === U ? W = o[26] : (W = { ...U }, o[25] = U, o[26] = W);
|
|
56
|
+
let G;
|
|
57
|
+
o[27] !== O || o[28] !== F || o[29] !== L || o[30] !== T || o[31] !== t || o[32] !== S || o[33] !== H || o[34] !== W ? (G = /* @__PURE__ */ u(s, {
|
|
58
|
+
...t,
|
|
59
|
+
className: H,
|
|
60
|
+
style: W,
|
|
61
|
+
onClick: F,
|
|
62
|
+
onOpenChange: L,
|
|
63
|
+
selectedKeys: S,
|
|
64
|
+
openKeys: T,
|
|
65
|
+
mode: "inline",
|
|
66
|
+
items: O
|
|
67
|
+
}), o[27] = O, o[28] = F, o[29] = L, o[30] = T, o[31] = t, o[32] = S, o[33] = H, o[34] = W, o[35] = G) : G = o[35];
|
|
68
|
+
let K;
|
|
69
|
+
return o[36] !== y || o[37] !== p || o[38] !== c || o[39] !== t || o[40] !== B || o[41] !== V || o[42] !== G || o[43] !== R ? (K = /* @__PURE__ */ u(f, {
|
|
70
|
+
...t,
|
|
71
|
+
className: R,
|
|
72
|
+
style: B,
|
|
73
|
+
collapsedWidth: p,
|
|
74
|
+
collapsible: c,
|
|
75
|
+
collapsed: y,
|
|
76
|
+
onCollapse: V,
|
|
77
|
+
children: G
|
|
78
|
+
}), o[36] = y, o[37] = p, o[38] = c, o[39] = t, o[40] = B, o[41] = V, o[42] = G, o[43] = R, o[44] = K) : K = o[44], K;
|
|
79
|
+
}
|
|
80
|
+
function m(e) {
|
|
81
|
+
let n = e.icon;
|
|
82
|
+
/^[A-Z]/.test(n) && c && c[n] ? n = t.createElement(c && c[n], { style: { fontSize: "14px" } }) : n?.startsWith && n?.startsWith("icon-") && (n = /* @__PURE__ */ u("i", { className: "sider-icon icon-iconfont " + n })), e.icon = n;
|
|
83
|
+
}
|
|
84
|
+
//#endregion
|
|
85
|
+
export { p as default };
|
package/package.json
CHANGED
|
@@ -1,38 +1,58 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@hzab/sider",
|
|
3
|
-
"version": "1.0.
|
|
3
|
+
"version": "1.0.3",
|
|
4
|
+
"private": false,
|
|
5
|
+
"src-direct": true,
|
|
6
|
+
"type": "module",
|
|
4
7
|
"description": "侧边栏",
|
|
5
|
-
"
|
|
6
|
-
"
|
|
7
|
-
|
|
8
|
-
"
|
|
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"
|
|
8
|
+
"license": "ISC",
|
|
9
|
+
"author": "CaiYansong",
|
|
10
|
+
"engines": {
|
|
11
|
+
"node": ">=24"
|
|
12
12
|
},
|
|
13
|
+
"main": "src",
|
|
14
|
+
"types": "./dist/index.d.ts",
|
|
13
15
|
"files": [
|
|
14
|
-
"
|
|
15
|
-
"
|
|
16
|
+
"src",
|
|
17
|
+
"dist",
|
|
18
|
+
"CHANGELOG.md"
|
|
16
19
|
],
|
|
17
|
-
"
|
|
18
|
-
|
|
19
|
-
|
|
20
|
+
"sideEffects": [
|
|
21
|
+
"**/*.less"
|
|
22
|
+
],
|
|
23
|
+
"peerDependencies": {
|
|
24
|
+
"@ant-design/icons": ">=4.0.0",
|
|
25
|
+
"antd": ">=4.0.0",
|
|
26
|
+
"lodash": ">=4.0.0",
|
|
27
|
+
"react": ">=16.8.0",
|
|
28
|
+
"react-dom": ">=16.8.0",
|
|
29
|
+
"react-router-dom": ">=6.0.0"
|
|
30
|
+
},
|
|
31
|
+
"dependencies": {},
|
|
20
32
|
"devDependencies": {
|
|
21
|
-
"@
|
|
22
|
-
"@types/
|
|
23
|
-
"@types/react
|
|
24
|
-
"
|
|
33
|
+
"@ant-design/icons": "^4.8.0",
|
|
34
|
+
"@types/lodash": "^4.17.12",
|
|
35
|
+
"@types/react": "^17.0.62",
|
|
36
|
+
"@types/react-dom": "^17.0.20",
|
|
37
|
+
"@vitest/coverage-v8": "4.1.10",
|
|
38
|
+
"antd": "^4.14.0",
|
|
39
|
+
"happy-dom": "^20.11.1",
|
|
25
40
|
"less": "^4.1.3",
|
|
41
|
+
"lodash": "^4.18.1",
|
|
26
42
|
"react": "^17.0.2",
|
|
27
43
|
"react-dom": "^17.0.2",
|
|
28
44
|
"react-router-dom": "^6.14.1",
|
|
29
|
-
"typescript": "^
|
|
45
|
+
"typescript": "^5.9.3",
|
|
46
|
+
"vite": "^8.0.0",
|
|
47
|
+
"vitest": "^4.1.10",
|
|
48
|
+
"@hzab/typescript-config": "^0.0.0",
|
|
49
|
+
"@hzab/vite-config": "^0.0.3-alpha.0",
|
|
50
|
+
"@hzab/eslint-config": "^0.0.0"
|
|
30
51
|
},
|
|
31
|
-
"
|
|
32
|
-
"
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
"
|
|
36
|
-
"antd": "^4.14.0"
|
|
52
|
+
"scripts": {
|
|
53
|
+
"build": "vite build && tsc -p tsconfig.build.json",
|
|
54
|
+
"typecheck": "tsc -p tsconfig.json",
|
|
55
|
+
"test": "vitest run --passWithNoTests",
|
|
56
|
+
"test:watch": "vitest"
|
|
37
57
|
}
|
|
38
|
-
}
|
|
58
|
+
}
|
package/src/index.module.less
CHANGED
package/src/index.tsx
CHANGED
|
@@ -43,8 +43,8 @@ function Sider(props) {
|
|
|
43
43
|
const _menus = _.cloneDeep(props.menus);
|
|
44
44
|
_menus?.map((it) => {
|
|
45
45
|
let iconDom = it.icon;
|
|
46
|
-
if (/^[A-Z]/.test(iconDom) && Icon && (Icon as
|
|
47
|
-
iconDom = React.createElement(Icon && (Icon as
|
|
46
|
+
if (/^[A-Z]/.test(iconDom) && Icon && (Icon as unknown as Record<string, React.ElementType>)[iconDom]) {
|
|
47
|
+
iconDom = React.createElement(Icon && (Icon as unknown as Record<string, React.ElementType>)[iconDom], {
|
|
48
48
|
style: { fontSize: "14px" },
|
|
49
49
|
});
|
|
50
50
|
} else if (iconDom?.startsWith && iconDom?.startsWith("icon-")) {
|
|
@@ -67,7 +67,7 @@ function Sider(props) {
|
|
|
67
67
|
|
|
68
68
|
function onOpenChange(openKeys) {
|
|
69
69
|
setOpen(openKeys);
|
|
70
|
-
props.onOpenChange
|
|
70
|
+
if (props.onOpenChange) props.onOpenChange(openKeys);
|
|
71
71
|
}
|
|
72
72
|
|
|
73
73
|
return (
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
/// <reference types="vite/client" />
|
package/README.md
DELETED
|
@@ -1,114 +0,0 @@
|
|
|
1
|
-
# @hzab/sider
|
|
2
|
-
|
|
3
|
-
侧边栏组件
|
|
4
|
-
|
|
5
|
-
- node@14.21
|
|
6
|
-
|
|
7
|
-
# 组件
|
|
8
|
-
|
|
9
|
-
## 示例
|
|
10
|
-
|
|
11
|
-
```jsx
|
|
12
|
-
import Demo from "@hzab/sider";
|
|
13
|
-
|
|
14
|
-
<Demo
|
|
15
|
-
menus={[
|
|
16
|
-
{ key: "/", label: "首页", title: "首页" },
|
|
17
|
-
{
|
|
18
|
-
key: "/user-server",
|
|
19
|
-
label: "用户服务",
|
|
20
|
-
icon: "UserOutlined",
|
|
21
|
-
children: [
|
|
22
|
-
{
|
|
23
|
-
key: "/user-server/user-list",
|
|
24
|
-
label: "用户管理",
|
|
25
|
-
},
|
|
26
|
-
{
|
|
27
|
-
key: "/user-server/role-list",
|
|
28
|
-
label: "角色管理",
|
|
29
|
-
},
|
|
30
|
-
{
|
|
31
|
-
key: "/user-server/org-list",
|
|
32
|
-
label: "组织管理",
|
|
33
|
-
},
|
|
34
|
-
],
|
|
35
|
-
},
|
|
36
|
-
{
|
|
37
|
-
key: "/sys-server",
|
|
38
|
-
label: "系统服务",
|
|
39
|
-
icon: "UserOutlined",
|
|
40
|
-
children: [
|
|
41
|
-
{
|
|
42
|
-
key: "/sys-server/config-list",
|
|
43
|
-
label: "配置管理",
|
|
44
|
-
},
|
|
45
|
-
{
|
|
46
|
-
key: "/sys-server/color-list",
|
|
47
|
-
label: "颜色管理",
|
|
48
|
-
},
|
|
49
|
-
{
|
|
50
|
-
key: "/sys-server/size-list",
|
|
51
|
-
label: "尺寸管理",
|
|
52
|
-
},
|
|
53
|
-
],
|
|
54
|
-
},
|
|
55
|
-
]}
|
|
56
|
-
/>;
|
|
57
|
-
```
|
|
58
|
-
|
|
59
|
-
## API
|
|
60
|
-
|
|
61
|
-
### InfoPanel Attributes
|
|
62
|
-
|
|
63
|
-
| 参数 | 类型 | 必填 | 默认值 | 说明 |
|
|
64
|
-
| -------------- | ------- | ---- | ------ | ----------------------------------------------- | --- |
|
|
65
|
-
| menus | Array | 是 | - | 侧边栏数据 | |
|
|
66
|
-
| collapsible | boolean | 否 | - | 是否可以收起 | |
|
|
67
|
-
| collapsedWidth | number | 否 | - | 收缩宽度,设置为 0 会出现特殊 trigger(定位块) | |
|
|
68
|
-
|
|
69
|
-
#### MenuItem
|
|
70
|
-
|
|
71
|
-
| 参数 | 类型 | 必填 | 默认值 | 说明 |
|
|
72
|
-
| -------- | ------ | ---- | ------ | ----------------------------- | --- |
|
|
73
|
-
| key | string | 是 | - | 跳转地址 | |
|
|
74
|
-
| label | string | 是 | - | 文案 | |
|
|
75
|
-
| icon | string | 是 | - | icon,可以是 antd icon 字符串 | |
|
|
76
|
-
| children | Array | 是 | - | 子集 | |
|
|
77
|
-
|
|
78
|
-
# 组件开发流程
|
|
79
|
-
|
|
80
|
-
- 在 config/webpack.config.js 中按需修改 library 配置的文件名
|
|
81
|
-
- 在 config/webpack.config.js 中按需修改 alias 配置的包名,便于本地调试
|
|
82
|
-
- 在 src/typings.d.ts 中按需修改 declare module 配置的包名,解决 ts 报错问题
|
|
83
|
-
- npm run dev
|
|
84
|
-
|
|
85
|
-
## 文件目录
|
|
86
|
-
|
|
87
|
-
- example 本地开发测试代码
|
|
88
|
-
- src 组件源码
|
|
89
|
-
- lib 组件打包编译后的代码
|
|
90
|
-
|
|
91
|
-
## 命令
|
|
92
|
-
|
|
93
|
-
- 本地运行:npm run dev
|
|
94
|
-
- 打包编译:npm run build
|
|
95
|
-
|
|
96
|
-
## 发布
|
|
97
|
-
|
|
98
|
-
- 注意:示例代码生效,但发布之后未生效。确认是否执行了编译!!!
|
|
99
|
-
|
|
100
|
-
- 编译组件:npm run build
|
|
101
|
-
- 命令:npm publish --access public
|
|
102
|
-
- 发布目录:
|
|
103
|
-
- lib
|
|
104
|
-
- src
|
|
105
|
-
|
|
106
|
-
## 配置
|
|
107
|
-
|
|
108
|
-
### 配置文件
|
|
109
|
-
|
|
110
|
-
- 本地配置文件:config/config.js
|
|
111
|
-
|
|
112
|
-
### webpack 配置文件
|
|
113
|
-
|
|
114
|
-
- config/webpack.config.js
|