@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.
Files changed (49) hide show
  1. package/README.md +37 -37
  2. package/lib/fe-layouts/basics-layout/components/utils/index.js +8 -8
  3. package/lib/router/utils.js +31 -30
  4. package/lib/types/fe-auto-complete/auto-complete.d.ts +3 -1
  5. package/lib/types/fe-button/button.d.ts +15 -13
  6. package/lib/types/fe-cascader/cascader.d.ts +8 -6
  7. package/lib/types/fe-checkbox/checkbox.d.ts +6 -4
  8. package/lib/types/fe-checkbox-group/checkbox-group.d.ts +6 -4
  9. package/lib/types/fe-date-picker/date-picker.d.ts +4 -2
  10. package/lib/types/fe-description-render/description-render.d.ts +32 -30
  11. package/lib/types/fe-descriptions/descriptions.d.ts +3 -1
  12. package/lib/types/fe-empty/empty.d.ts +3 -1
  13. package/lib/types/fe-error-block/error-block.d.ts +7 -5
  14. package/lib/types/fe-form/fe-form/form.d.ts +338 -336
  15. package/lib/types/fe-form/fe-form-item/form-item.d.ts +66 -64
  16. package/lib/types/fe-form/fe-form-label/form-label.d.ts +44 -42
  17. package/lib/types/fe-input/input.d.ts +12 -10
  18. package/lib/types/fe-input-number/input-number.d.ts +3 -1
  19. package/lib/types/fe-layouts/basics-layout/components/utils/index.d.ts +7 -6
  20. package/lib/types/fe-layouts/context/global-context.d.ts +240 -238
  21. package/lib/types/fe-link/link.d.ts +6 -4
  22. package/lib/types/fe-map/map.d.ts +73 -73
  23. package/lib/types/fe-modal/modal.d.ts +20 -18
  24. package/lib/types/fe-pagination/pagination.d.ts +3 -1
  25. package/lib/types/fe-panel/panel-toolbar.d.ts +5 -3
  26. package/lib/types/fe-panel/panel.d.ts +60 -58
  27. package/lib/types/fe-permission/permission.d.ts +11 -9
  28. package/lib/types/fe-permission-provider/permission-provider.d.ts +8 -6
  29. package/lib/types/fe-radio/radio.d.ts +3 -1
  30. package/lib/types/fe-radio-group/radio-group.d.ts +3 -1
  31. package/lib/types/fe-rich-text/rich-text.d.ts +167 -165
  32. package/lib/types/fe-select/select.d.ts +9 -7
  33. package/lib/types/fe-switch/switch.d.ts +3 -1
  34. package/lib/types/fe-table/fe-table-link/table-link.d.ts +10 -8
  35. package/lib/types/fe-table/fe-table-render/table-render.d.ts +12 -10
  36. package/lib/types/fe-table/fe-table-toolbar/table-toolbar.d.ts +16 -14
  37. package/lib/types/fe-table/type/table-context.d.ts +60 -60
  38. package/lib/types/fe-table/type/table.d.ts +789 -787
  39. package/lib/types/fe-text-area/text-area.d.ts +5 -3
  40. package/lib/types/fe-time-picker/time-picker.d.ts +4 -2
  41. package/lib/types/fe-upload/upload.d.ts +83 -81
  42. package/lib/types/fe-upload-atomic/upload-atomic.d.ts +3 -1
  43. package/lib/types/hooks/use-descriptions.hook/use-descriptions.d.ts +151 -149
  44. package/lib/types/hooks/use-form.hook/use-form.d.ts +13 -11
  45. package/lib/types/hooks/use-permission.hook/use-permission.d.ts +10 -10
  46. package/lib/types/router/utils.d.ts +2 -1
  47. package/lib/types/typings/index.d.ts +98 -98
  48. package/lib/types/typings/shims-axios.d.ts +38 -38
  49. 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 f(e, i) {
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 = f(e, n.children);
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.id && i.set(r.id, r), r.children && r.children.length > 0 && t(r.children);
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 o(e, i) {
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 = o(n.parentId, i);
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
- f as findRouteByPath,
70
- o as getRouteById,
69
+ o as findRouteByPath,
70
+ f as getRouteById,
71
71
  d as normalizePath
72
72
  };
@@ -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, i) {
6
- const d = i[R(o)];
7
- return d ? y(d) : (console.warn(`Module not found for path: ${o}`), y(() => Promise.resolve({ default: () => C("div", null, `Module not found: ${o}`) })));
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, i) {
14
- return (o.sort ?? 0) - (i.sort ?? 0);
13
+ function T(o, d) {
14
+ return (o.sort ?? 0) - (d.sort ?? 0);
15
15
  }
16
- function N(o, i, d) {
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), c = /* @__PURE__ */ new Map(), f = [];
23
+ ].sort(T), u = /* @__PURE__ */ new Map(), f = [];
24
24
  l.forEach((e) => {
25
- const t = e.parentId || "/", n = w(e.path), s = {
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 r = v(e.menuCode, i);
40
- r && (s.Component = r), e.index && (s.index = !0, delete s.path), e.protected !== !1 && d && (s.loader = d);
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
- c.set(e.menuId, s);
43
+ u.set(e.id, s);
43
44
  }), l.forEach((e) => {
44
- const t = c.get(e.menuId), n = e.parentId;
45
- if (n && n !== "/") {
46
- const s = c.get(n);
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 = [], I = l.filter((e) => e.isShowMenu !== !1);
52
- I.forEach((e) => {
53
- const t = c.get(e.menuId), n = t ? (() => {
54
- const { children: r, ...m } = t;
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.menuId, s);
65
- }), I.forEach((e) => {
66
- const t = a.get(e.menuId), n = e.parentId;
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 M(e) {
74
+ function I(e) {
74
75
  const t = [];
75
76
  return e.forEach((n) => {
76
- if (n.children && n.children.length > 0 && (n.children = M(n.children)), n.menuType === 1 && n.children && n.children.length > 0) {
77
- const s = n.children.filter((r) => r.isIndependentMenu === !0 && r.menuType === 2 && !r.customType);
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 r = s.map((u) => ({
80
- ...u,
80
+ const i = s.map((c) => ({
81
+ ...c,
81
82
  customType: "menu-promoted"
82
83
  // 内部标识,表示这个菜单是被提升的
83
- })), m = n.children.filter((u) => !(u.isIndependentMenu === !0 && u.menuType === 2 && !u.customType));
84
- t.push(...r, ...m);
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: M(h),
94
+ menus: I(h),
94
95
  permissions: g
95
96
  };
96
97
  }
@@ -1,2 +1,4 @@
1
1
  import { AutoCompleteProps } from 'antd';
2
- export interface FeAutoCompleteProps extends AutoCompleteProps { }
2
+
3
+
4
+ export interface FeAutoCompleteProps extends AutoCompleteProps { }
@@ -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
- export interface FeButtonProps
5
- extends ButtonProps, IPermissionProps, Pick<IBasicProps, 'children'> {
6
- /**
7
- * 设置按钮最小宽度,支持数字(px)或字符串
8
- * @default 120px
9
- */
10
- minWidth?: number | string;
11
- /**
12
- * 禁用状态时的提示内容
13
- * @description 当按钮被禁用时,显示该提示内容
14
- */
15
- disabledTooltip?: string | React.ReactNode;
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
- export interface FeCascaderProps extends CascaderProps {
3
- /**
4
- * @name 多选
5
- */
6
- multiple?: false;
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
- export interface FeCheckboxProps extends CheckboxProps {
4
- }
5
-
6
- declare const FeCheckbox: React.ForwardRefExoticComponent<FeCheckboxProps>;
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
- type CheckboxGroupProps = Parameters<typeof Checkbox.Group>[0]
3
-
4
- export interface FeCheckboxGroupProps extends CheckboxGroupProps {
5
- }
2
+
3
+
4
+ type CheckboxGroupProps = Parameters<typeof Checkbox.Group>[0]
5
+
6
+ export interface FeCheckboxGroupProps extends CheckboxGroupProps {
7
+ }
@@ -1,3 +1,5 @@
1
1
  import { DatePickerProps } from 'antd';
2
- export interface FeDatePickerProps extends DatePickerProps {
3
- }
2
+
3
+
4
+ export interface FeDatePickerProps extends DatePickerProps {
5
+ }
@@ -1,31 +1,33 @@
1
1
  import { IDescriptionsItem, TRenderType } from '../hooks/use-descriptions.hook/use-descriptions.d';
2
- export interface FeDescriptionRenderProps<DataType extends Record<string, any>> {
3
- /**
4
- *
5
- */
6
- value: any;
7
- /**
8
- * 原始值
9
- */
10
- rawValue: any;
11
- /**
12
- * @name 渲染类型
13
- */
14
- renderType: TRenderType;
15
- /**
16
- * 列宽
17
- */
18
- colSpan: IDescriptionsItem<DataType>['colSpan'];
19
- /**
20
- * @name tag渲染器参数
21
- */
22
- tagRenderParams: IDescriptionsItem<DataType>['tagRenderParams'];
23
- /**
24
- * @name link渲染器参数
25
- */
26
- linkRenderParams: IDescriptionsItem<DataType>['linkRenderParams'];
27
- /**
28
- * @name image渲染器参数
29
- */
30
- imageRenderParams: IDescriptionsItem<DataType>['imageRenderParams'];
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
+ }
@@ -1,2 +1,4 @@
1
1
  import { DescriptionsProps } from 'antd';
2
- export interface FeDescriptionsProps extends DescriptionsProps {}
2
+
3
+
4
+ export interface FeDescriptionsProps extends DescriptionsProps {}
@@ -1,2 +1,4 @@
1
1
  import { EmptyProps } from 'antd';
2
- export interface FeEmptyProps extends EmptyProps {}
2
+
3
+
4
+ export interface FeEmptyProps extends EmptyProps {}
@@ -1,6 +1,8 @@
1
1
  import { ReactNode } from 'react';
2
- export interface FeErrorBlockProps {
3
- children?: ReactNode;
4
- /** 错误信息 */
5
- message?: string;
6
- }
2
+
3
+
4
+ export interface FeErrorBlockProps {
5
+ children?: ReactNode;
6
+ /** 错误信息 */
7
+ message?: string;
8
+ }