@spacego/fe-components 0.3.0 → 0.3.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/README.md +37 -37
- package/lib/fe-layouts/basics-layout/components/utils/index.js +8 -8
- package/lib/router/utils.js +31 -30
- package/lib/types/fe-auto-complete/auto-complete.d.ts +3 -1
- package/lib/types/fe-button/button.d.ts +15 -13
- package/lib/types/fe-cascader/cascader.d.ts +8 -6
- package/lib/types/fe-checkbox/checkbox.d.ts +6 -4
- package/lib/types/fe-checkbox-group/checkbox-group.d.ts +6 -4
- package/lib/types/fe-date-picker/date-picker.d.ts +4 -2
- package/lib/types/fe-description-render/description-render.d.ts +32 -30
- package/lib/types/fe-descriptions/descriptions.d.ts +3 -1
- package/lib/types/fe-empty/empty.d.ts +3 -1
- package/lib/types/fe-error-block/error-block.d.ts +7 -5
- package/lib/types/fe-form/fe-form/form.d.ts +338 -336
- package/lib/types/fe-form/fe-form-item/form-item.d.ts +66 -64
- package/lib/types/fe-form/fe-form-label/form-label.d.ts +44 -42
- package/lib/types/fe-input/input.d.ts +12 -10
- package/lib/types/fe-input-number/input-number.d.ts +3 -1
- package/lib/types/fe-layouts/basics-layout/components/utils/index.d.ts +7 -6
- package/lib/types/fe-layouts/context/global-context.d.ts +240 -238
- package/lib/types/fe-link/link.d.ts +6 -4
- package/lib/types/fe-map/map.d.ts +73 -73
- package/lib/types/fe-modal/modal.d.ts +20 -18
- package/lib/types/fe-pagination/pagination.d.ts +3 -1
- package/lib/types/fe-panel/panel-toolbar.d.ts +5 -3
- package/lib/types/fe-panel/panel.d.ts +60 -58
- package/lib/types/fe-permission/permission.d.ts +11 -9
- package/lib/types/fe-permission-provider/permission-provider.d.ts +8 -6
- package/lib/types/fe-radio/radio.d.ts +3 -1
- package/lib/types/fe-radio-group/radio-group.d.ts +3 -1
- package/lib/types/fe-rich-text/rich-text.d.ts +167 -165
- package/lib/types/fe-select/select.d.ts +9 -7
- package/lib/types/fe-switch/switch.d.ts +3 -1
- package/lib/types/fe-table/fe-table-link/table-link.d.ts +10 -8
- package/lib/types/fe-table/fe-table-render/table-render.d.ts +12 -10
- package/lib/types/fe-table/fe-table-toolbar/table-toolbar.d.ts +16 -14
- package/lib/types/fe-table/type/table-context.d.ts +60 -60
- package/lib/types/fe-table/type/table.d.ts +789 -787
- package/lib/types/fe-text-area/text-area.d.ts +5 -3
- package/lib/types/fe-time-picker/time-picker.d.ts +4 -2
- package/lib/types/fe-upload/upload.d.ts +83 -81
- package/lib/types/fe-upload-atomic/upload-atomic.d.ts +3 -1
- package/lib/types/hooks/use-descriptions.hook/use-descriptions.d.ts +151 -149
- package/lib/types/hooks/use-form.hook/use-form.d.ts +13 -11
- package/lib/types/hooks/use-permission.hook/use-permission.d.ts +10 -10
- package/lib/types/router/utils.d.ts +2 -1
- package/lib/types/typings/index.d.ts +98 -98
- package/lib/types/typings/shims-axios.d.ts +38 -38
- package/package.json +3 -3
package/README.md
CHANGED
|
@@ -1,37 +1,37 @@
|
|
|
1
|
-
<!--
|
|
2
|
-
* @Author: dushuai
|
|
3
|
-
* @Date: 2025-08-30 17:23:07
|
|
4
|
-
* @LastEditors: dushuai
|
|
5
|
-
* @LastEditTime: 2026-01-30 20:22:56
|
|
6
|
-
* @description: 心平气和
|
|
7
|
-
-->
|
|
8
|
-
# @spacego/fe-components
|
|
9
|
-
|
|
10
|
-
`@spacego/fe-components` 是一个完全基于 `typescript` + `antd` 的UI组件库,提供了一些常用的组件和我的默认Layout模版等。
|
|
11
|
-
|
|
12
|
-
## ✨ Features
|
|
13
|
-
|
|
14
|
-
- Easy to learn and use.
|
|
15
|
-
- Contains common hooks and encapsulates common apis.
|
|
16
|
-
- Written in TypeScript with predictable static types.
|
|
17
|
-
- High performance.
|
|
18
|
-
|
|
19
|
-
## 📦 Install
|
|
20
|
-
|
|
21
|
-
```bash
|
|
22
|
-
$ npm install --save @spacego/fe-components
|
|
23
|
-
# or
|
|
24
|
-
$ pnpm add @spacego/fe-components `推荐`
|
|
25
|
-
# or
|
|
26
|
-
$ yarn add @spacego/fe-components
|
|
27
|
-
```
|
|
28
|
-
|
|
29
|
-
## 🔨 Usage
|
|
30
|
-
|
|
31
|
-
```ts
|
|
32
|
-
import { FeButton ... } from '@spacego/fe-components';
|
|
33
|
-
```
|
|
34
|
-
|
|
35
|
-
## 🚀 API
|
|
36
|
-
|
|
37
|
-
...
|
|
1
|
+
<!--
|
|
2
|
+
* @Author: dushuai
|
|
3
|
+
* @Date: 2025-08-30 17:23:07
|
|
4
|
+
* @LastEditors: dushuai
|
|
5
|
+
* @LastEditTime: 2026-01-30 20:22:56
|
|
6
|
+
* @description: 心平气和
|
|
7
|
+
-->
|
|
8
|
+
# @spacego/fe-components
|
|
9
|
+
|
|
10
|
+
`@spacego/fe-components` 是一个完全基于 `typescript` + `antd` 的UI组件库,提供了一些常用的组件和我的默认Layout模版等。
|
|
11
|
+
|
|
12
|
+
## ✨ Features
|
|
13
|
+
|
|
14
|
+
- Easy to learn and use.
|
|
15
|
+
- Contains common hooks and encapsulates common apis.
|
|
16
|
+
- Written in TypeScript with predictable static types.
|
|
17
|
+
- High performance.
|
|
18
|
+
|
|
19
|
+
## 📦 Install
|
|
20
|
+
|
|
21
|
+
```bash
|
|
22
|
+
$ npm install --save @spacego/fe-components
|
|
23
|
+
# or
|
|
24
|
+
$ pnpm add @spacego/fe-components `推荐`
|
|
25
|
+
# or
|
|
26
|
+
$ yarn add @spacego/fe-components
|
|
27
|
+
```
|
|
28
|
+
|
|
29
|
+
## 🔨 Usage
|
|
30
|
+
|
|
31
|
+
```ts
|
|
32
|
+
import { FeButton ... } from '@spacego/fe-components';
|
|
33
|
+
```
|
|
34
|
+
|
|
35
|
+
## 🚀 API
|
|
36
|
+
|
|
37
|
+
...
|
|
@@ -1,11 +1,11 @@
|
|
|
1
1
|
function d(e) {
|
|
2
2
|
return e ? e === "/" ? "/" : e.replace(/\/+$/, "") : "";
|
|
3
3
|
}
|
|
4
|
-
function
|
|
4
|
+
function o(e, i) {
|
|
5
5
|
const t = d(e);
|
|
6
6
|
for (const n of i) {
|
|
7
7
|
if (n.children && n.children.length > 0) {
|
|
8
|
-
const u =
|
|
8
|
+
const u = o(e, n.children);
|
|
9
9
|
if (u) return u;
|
|
10
10
|
}
|
|
11
11
|
if (n.id === "Home" && t === "/")
|
|
@@ -19,20 +19,20 @@ function f(e, i) {
|
|
|
19
19
|
function s(e) {
|
|
20
20
|
const i = /* @__PURE__ */ new Map(), t = (n) => {
|
|
21
21
|
n.forEach((r) => {
|
|
22
|
-
r.
|
|
22
|
+
r.dbId !== void 0 && i.set(r.dbId, r), r.children && r.children.length > 0 && t(r.children);
|
|
23
23
|
});
|
|
24
24
|
};
|
|
25
25
|
return t(e), i;
|
|
26
26
|
}
|
|
27
|
-
function
|
|
27
|
+
function f(e, i) {
|
|
28
28
|
return i.get(e) || null;
|
|
29
29
|
}
|
|
30
30
|
function a(e, i) {
|
|
31
31
|
var r;
|
|
32
32
|
const t = [e];
|
|
33
33
|
let n = e;
|
|
34
|
-
for (; n.parentId && n.parentId !==
|
|
35
|
-
const u =
|
|
34
|
+
for (; n.parentId && n.parentId !== 0; ) {
|
|
35
|
+
const u = f(n.parentId, i);
|
|
36
36
|
if (u)
|
|
37
37
|
((r = n.handle) == null ? void 0 : r.isIndependentMenu) === !0 || t.unshift(u), n = u;
|
|
38
38
|
else
|
|
@@ -66,7 +66,7 @@ export {
|
|
|
66
66
|
l as findMenuByKey,
|
|
67
67
|
c as findMenuParentKeys,
|
|
68
68
|
a as findParentRoutes,
|
|
69
|
-
|
|
70
|
-
|
|
69
|
+
o as findRouteByPath,
|
|
70
|
+
f as getRouteById,
|
|
71
71
|
d as normalizePath
|
|
72
72
|
};
|
package/lib/router/utils.js
CHANGED
|
@@ -2,28 +2,29 @@ import { lazy as y, createElement as C } from "react";
|
|
|
2
2
|
function R(o) {
|
|
3
3
|
return `/src/pages/${o.replace(/^\/+/, "")}/index.tsx`;
|
|
4
4
|
}
|
|
5
|
-
function v(o,
|
|
6
|
-
const
|
|
7
|
-
return
|
|
5
|
+
function v(o, d) {
|
|
6
|
+
const r = d[R(o)];
|
|
7
|
+
return r ? y(r) : (console.warn(`Module not found for path: ${o}`), y(() => Promise.resolve({ default: () => C("div", null, `Module not found: ${o}`) })));
|
|
8
8
|
}
|
|
9
9
|
function w(o) {
|
|
10
10
|
if (o)
|
|
11
11
|
return o.startsWith("/") ? o : `/${o}`;
|
|
12
12
|
}
|
|
13
|
-
function T(o,
|
|
14
|
-
return (o.sort ?? 0) - (
|
|
13
|
+
function T(o, d) {
|
|
14
|
+
return (o.sort ?? 0) - (d.sort ?? 0);
|
|
15
15
|
}
|
|
16
|
-
function N(o,
|
|
16
|
+
function N(o, d, r) {
|
|
17
17
|
const p = [...o].sort(T).reduce((e, t) => {
|
|
18
18
|
const n = t.menuType || 2;
|
|
19
19
|
return e[n] || (e[n] = []), e[n].push(t), e;
|
|
20
20
|
}, {}), g = (p[3] || []).filter((e) => e.menuCode).map((e) => e.menuCode), l = [
|
|
21
21
|
...p[1] || [],
|
|
22
22
|
...p[2] || []
|
|
23
|
-
].sort(T),
|
|
23
|
+
].sort(T), u = /* @__PURE__ */ new Map(), f = [];
|
|
24
24
|
l.forEach((e) => {
|
|
25
|
-
const t = e.parentId ||
|
|
25
|
+
const t = e.parentId || 0, n = w(e.path), s = {
|
|
26
26
|
id: e.menuId,
|
|
27
|
+
dbId: e.id,
|
|
27
28
|
path: n,
|
|
28
29
|
parentId: t,
|
|
29
30
|
// 将 title、icon 放入 handle 字段
|
|
@@ -36,22 +37,22 @@ function N(o, i, d) {
|
|
|
36
37
|
}
|
|
37
38
|
};
|
|
38
39
|
if (e.menuType === 2 && e.menuCode) {
|
|
39
|
-
const
|
|
40
|
-
|
|
40
|
+
const i = v(e.menuCode, d);
|
|
41
|
+
i && (s.Component = i), e.index && (s.index = !0, delete s.path), e.protected !== !1 && r && (s.loader = r);
|
|
41
42
|
}
|
|
42
|
-
|
|
43
|
+
u.set(e.id, s);
|
|
43
44
|
}), l.forEach((e) => {
|
|
44
|
-
const t =
|
|
45
|
-
if (n && n !==
|
|
46
|
-
const s =
|
|
45
|
+
const t = u.get(e.id), n = e.parentId;
|
|
46
|
+
if (n && n !== 0) {
|
|
47
|
+
const s = u.get(n);
|
|
47
48
|
s ? (s.children || (s.children = []), s.children.push(t)) : f.push(t);
|
|
48
49
|
} else
|
|
49
50
|
f.push(t);
|
|
50
51
|
});
|
|
51
|
-
const a = /* @__PURE__ */ new Map(), h = [],
|
|
52
|
-
|
|
53
|
-
const t =
|
|
54
|
-
const { children:
|
|
52
|
+
const a = /* @__PURE__ */ new Map(), h = [], M = l.filter((e) => e.isShowMenu !== !1);
|
|
53
|
+
M.forEach((e) => {
|
|
54
|
+
const t = u.get(e.id), n = t ? (() => {
|
|
55
|
+
const { children: i, ...m } = t;
|
|
55
56
|
return m;
|
|
56
57
|
})() : void 0, s = {
|
|
57
58
|
key: e.menuId,
|
|
@@ -61,27 +62,27 @@ function N(o, i, d) {
|
|
|
61
62
|
menuType: e.menuType,
|
|
62
63
|
isIndependentMenu: e.isIndependentMenu
|
|
63
64
|
};
|
|
64
|
-
a.set(e.
|
|
65
|
-
}),
|
|
66
|
-
const t = a.get(e.
|
|
67
|
-
if (n && n !==
|
|
65
|
+
a.set(e.id, s);
|
|
66
|
+
}), M.forEach((e) => {
|
|
67
|
+
const t = a.get(e.id), n = e.parentId;
|
|
68
|
+
if (n && n !== 0) {
|
|
68
69
|
const s = a.get(n);
|
|
69
70
|
s ? (s.children || (s.children = []), s.children.push(t)) : h.push(t);
|
|
70
71
|
} else
|
|
71
72
|
h.push(t);
|
|
72
73
|
});
|
|
73
|
-
function
|
|
74
|
+
function I(e) {
|
|
74
75
|
const t = [];
|
|
75
76
|
return e.forEach((n) => {
|
|
76
|
-
if (n.children && n.children.length > 0 && (n.children =
|
|
77
|
-
const s = n.children.filter((
|
|
77
|
+
if (n.children && n.children.length > 0 && (n.children = I(n.children)), n.menuType === 1 && n.children && n.children.length > 0) {
|
|
78
|
+
const s = n.children.filter((i) => i.isIndependentMenu === !0 && i.menuType === 2 && !i.customType);
|
|
78
79
|
if (s.length > 0) {
|
|
79
|
-
const
|
|
80
|
-
...
|
|
80
|
+
const i = s.map((c) => ({
|
|
81
|
+
...c,
|
|
81
82
|
customType: "menu-promoted"
|
|
82
83
|
// 内部标识,表示这个菜单是被提升的
|
|
83
|
-
})), m = n.children.filter((
|
|
84
|
-
t.push(...
|
|
84
|
+
})), m = n.children.filter((c) => !(c.isIndependentMenu === !0 && c.menuType === 2 && !c.customType));
|
|
85
|
+
t.push(...i, ...m);
|
|
85
86
|
} else
|
|
86
87
|
t.push(n);
|
|
87
88
|
} else
|
|
@@ -90,7 +91,7 @@ function N(o, i, d) {
|
|
|
90
91
|
}
|
|
91
92
|
return {
|
|
92
93
|
routes: f,
|
|
93
|
-
menus:
|
|
94
|
+
menus: I(h),
|
|
94
95
|
permissions: g
|
|
95
96
|
};
|
|
96
97
|
}
|
|
@@ -1,16 +1,18 @@
|
|
|
1
1
|
import { ButtonProps } from 'antd';
|
|
2
2
|
import { default as React } from 'react';
|
|
3
3
|
import { IBasicProps, IPermissionProps } from '../typings';
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
4
|
+
|
|
5
|
+
|
|
6
|
+
export interface FeButtonProps
|
|
7
|
+
extends ButtonProps, IPermissionProps, Pick<IBasicProps, 'children'> {
|
|
8
|
+
/**
|
|
9
|
+
* 设置按钮最小宽度,支持数字(px)或字符串
|
|
10
|
+
* @default 120px
|
|
11
|
+
*/
|
|
12
|
+
minWidth?: number | string;
|
|
13
|
+
/**
|
|
14
|
+
* 禁用状态时的提示内容
|
|
15
|
+
* @description 当按钮被禁用时,显示该提示内容
|
|
16
|
+
*/
|
|
17
|
+
disabledTooltip?: string | React.ReactNode;
|
|
18
|
+
}
|
|
@@ -1,7 +1,9 @@
|
|
|
1
1
|
import { CascaderProps } from 'antd';
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
2
|
+
|
|
3
|
+
|
|
4
|
+
export interface FeCascaderProps extends CascaderProps {
|
|
5
|
+
/**
|
|
6
|
+
* @name 多选
|
|
7
|
+
*/
|
|
8
|
+
multiple?: false;
|
|
9
|
+
}
|
|
@@ -1,6 +1,8 @@
|
|
|
1
1
|
import { CheckboxProps } from 'antd';
|
|
2
2
|
import { default as React } from 'react';
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
3
|
+
|
|
4
|
+
|
|
5
|
+
export interface FeCheckboxProps extends CheckboxProps {
|
|
6
|
+
}
|
|
7
|
+
|
|
8
|
+
declare const FeCheckbox: React.ForwardRefExoticComponent<FeCheckboxProps>;
|
|
@@ -1,5 +1,7 @@
|
|
|
1
1
|
import { Checkbox } from 'antd';
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
2
|
+
|
|
3
|
+
|
|
4
|
+
type CheckboxGroupProps = Parameters<typeof Checkbox.Group>[0]
|
|
5
|
+
|
|
6
|
+
export interface FeCheckboxGroupProps extends CheckboxGroupProps {
|
|
7
|
+
}
|
|
@@ -1,31 +1,33 @@
|
|
|
1
1
|
import { IDescriptionsItem, TRenderType } from '../hooks/use-descriptions.hook/use-descriptions.d';
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
2
|
+
|
|
3
|
+
|
|
4
|
+
export interface FeDescriptionRenderProps<DataType extends Record<string, any>> {
|
|
5
|
+
/**
|
|
6
|
+
* 值
|
|
7
|
+
*/
|
|
8
|
+
value: any;
|
|
9
|
+
/**
|
|
10
|
+
* 原始值
|
|
11
|
+
*/
|
|
12
|
+
rawValue: any;
|
|
13
|
+
/**
|
|
14
|
+
* @name 渲染类型
|
|
15
|
+
*/
|
|
16
|
+
renderType: TRenderType;
|
|
17
|
+
/**
|
|
18
|
+
* 列宽
|
|
19
|
+
*/
|
|
20
|
+
colSpan: IDescriptionsItem<DataType>['colSpan'];
|
|
21
|
+
/**
|
|
22
|
+
* @name tag渲染器参数
|
|
23
|
+
*/
|
|
24
|
+
tagRenderParams: IDescriptionsItem<DataType>['tagRenderParams'];
|
|
25
|
+
/**
|
|
26
|
+
* @name link渲染器参数
|
|
27
|
+
*/
|
|
28
|
+
linkRenderParams: IDescriptionsItem<DataType>['linkRenderParams'];
|
|
29
|
+
/**
|
|
30
|
+
* @name image渲染器参数
|
|
31
|
+
*/
|
|
32
|
+
imageRenderParams: IDescriptionsItem<DataType>['imageRenderParams'];
|
|
33
|
+
}
|