@spacego/fe-components 0.1.1 → 0.2.0
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/_virtual/Resizable.js +4 -0
- package/lib/_virtual/ResizableBox.js +4 -0
- package/lib/_virtual/index.js +5 -0
- package/lib/_virtual/index2.js +4 -0
- package/lib/_virtual/index3.js +4 -0
- package/lib/_virtual/index4.js +4 -0
- package/lib/_virtual/propTypes.js +4 -0
- package/lib/_virtual/react-is.development.js +4 -0
- package/lib/_virtual/react-is.production.min.js +4 -0
- package/lib/_virtual/utils.js +4 -0
- package/lib/fe-auto-complete/index.js +6 -0
- package/lib/fe-button/index.js +27 -0
- package/lib/fe-cascader/index.js +19 -0
- package/lib/fe-checkbox/index.js +6 -0
- package/lib/fe-checkbox-group/index.js +6 -0
- package/lib/fe-date-picker/index.js +19 -0
- package/lib/fe-description-render/index.js +43 -0
- package/lib/fe-descriptions/index.js +6 -0
- package/lib/fe-empty/index.js +6 -0
- package/lib/fe-error-block/index.js +6 -0
- package/lib/fe-form/fe-form/index.js +133 -0
- package/lib/fe-form/fe-form-auto-complete/index.js +57 -0
- package/lib/fe-form/fe-form-btn-group/index.js +29 -0
- package/lib/fe-form/fe-form-cascader/index.js +25 -0
- package/lib/fe-form/fe-form-checkbox-group/index.js +21 -0
- package/lib/fe-form/fe-form-date-picker/index.js +75 -0
- package/lib/fe-form/fe-form-date-range-picker/index.js +99 -0
- package/lib/fe-form/fe-form-input/index.js +53 -0
- package/lib/fe-form/fe-form-input-input/index.js +63 -0
- package/lib/fe-form/fe-form-input-number/index.js +43 -0
- package/lib/fe-form/fe-form-item/index.js +46 -0
- package/lib/fe-form/fe-form-label/index.js +20 -0
- package/lib/fe-form/fe-form-radio/index.js +21 -0
- package/lib/fe-form/fe-form-render/index.js +33 -0
- package/lib/fe-form/fe-form-rich-text/index.js +25 -0
- package/lib/fe-form/fe-form-select/index.js +93 -0
- package/lib/fe-form/fe-form-switch/index.js +21 -0
- package/lib/fe-form/fe-form-text/index.js +20 -0
- package/lib/fe-form/fe-form-text-area/index.js +24 -0
- package/lib/fe-form/fe-form-time-picker/index.js +21 -0
- package/lib/fe-form/fe-form-upload/index.js +63 -0
- package/lib/fe-form/utils/index.js +28 -0
- package/lib/fe-input/index.js +32 -0
- package/lib/fe-input-number/index.js +19 -0
- package/lib/fe-layouts/auth-layout/index.js +35 -17
- package/lib/fe-layouts/basics-layout/index.js +2 -2
- package/lib/fe-layouts/layout.js +34 -16
- package/lib/fe-link/index.js +23 -0
- package/lib/fe-map/index.js +263 -0
- package/lib/fe-modal/index.js +85 -0
- package/lib/fe-pagination/index.js +6 -0
- package/lib/fe-panel/fe-panel-toolbar.js +40 -0
- package/lib/fe-panel/index.js +49 -0
- package/lib/fe-panel/use-panel-context.js +9 -0
- package/lib/fe-permission/index.js +12 -0
- package/lib/fe-permission-provider/index.js +29 -0
- package/lib/fe-radio/index.js +11 -0
- package/lib/fe-radio-group/index.js +6 -0
- package/lib/fe-rich-text/index.js +293 -0
- package/lib/fe-select/index.js +24 -0
- package/lib/fe-switch/index.js +6 -0
- package/lib/fe-table/fe-edit-table/index.js +39 -0
- package/lib/fe-table/fe-edit-table-cell/index.js +63 -0
- package/lib/fe-table/fe-head-title/index.js +9 -0
- package/lib/fe-table/fe-normal-table/index.js +192 -0
- package/lib/fe-table/fe-sub-table/index.js +74 -0
- package/lib/fe-table/fe-table/index.js +7 -0
- package/lib/fe-table/fe-table-alert/index.js +42 -0
- package/lib/fe-table/fe-table-link/index.js +87 -0
- package/lib/fe-table/fe-table-render/index.js +56 -0
- package/lib/fe-table/fe-table-setting/index.js +165 -0
- package/lib/fe-table/fe-table-toolbar/index.js +63 -0
- package/lib/fe-table/fe-table-utils/index.js +157 -0
- package/lib/fe-table/type/table.d.js +4 -0
- package/lib/fe-table/use-edit-table/index.js +151 -0
- package/lib/fe-table/use-pagination/index.js +59 -0
- package/lib/fe-table/use-sub-table/index.js +23 -0
- package/lib/fe-table/use-table/index.js +177 -0
- package/lib/fe-table/use-table-columns/index.js +53 -0
- package/lib/fe-table/use-table-form-context/index.js +14 -0
- package/lib/fe-table/use-table-selection/index.js +53 -0
- package/lib/fe-text-area/index.js +21 -0
- package/lib/fe-time-picker/index.js +19 -0
- package/lib/fe-upload/index.js +182 -0
- package/lib/fe-upload/upload.constant.js +91 -0
- package/lib/fe-upload-atomic/index.js +6 -0
- package/lib/fe-upload-crop/index.js +207 -0
- package/lib/hooks/{use-auth.hook.js → use-auth.hook/index.js} +3 -3
- package/lib/hooks/use-form/index.js +38 -0
- package/lib/hooks/use-permission.hook/index.js +9 -0
- package/lib/index.css +7 -1
- package/lib/index.js +161 -42
- package/lib/node_modules/.pnpm/@dnd-kit_accessibility@3.1.1_react@18.3.1/node_modules/@dnd-kit/accessibility/dist/accessibility.esm.js +56 -0
- package/lib/node_modules/.pnpm/@dnd-kit_core@6.3.1_nnrd3gsncyragczmpvfhocinkq/node_modules/@dnd-kit/core/dist/core.esm.js +2344 -0
- package/lib/node_modules/.pnpm/@dnd-kit_modifiers@9.0.0_55ztycxty3xzw7t4rzpvix55vq/node_modules/@dnd-kit/modifiers/dist/modifiers.esm.js +13 -0
- package/lib/node_modules/.pnpm/@dnd-kit_sortable@10.0.0_55ztycxty3xzw7t4rzpvix55vq/node_modules/@dnd-kit/sortable/dist/sortable.esm.js +439 -0
- package/lib/node_modules/.pnpm/@dnd-kit_utilities@3.2.2_react@18.3.1/node_modules/@dnd-kit/utilities/dist/utilities.esm.js +235 -0
- package/lib/node_modules/.pnpm/object-assign@4.1.1/node_modules/object-assign/index.js +54 -0
- package/lib/node_modules/.pnpm/prop-types@15.8.1/node_modules/prop-types/checkPropTypes.js +54 -0
- package/lib/node_modules/.pnpm/prop-types@15.8.1/node_modules/prop-types/factoryWithThrowingShims.js +52 -0
- package/lib/node_modules/.pnpm/prop-types@15.8.1/node_modules/prop-types/factoryWithTypeCheckers.js +329 -0
- package/lib/node_modules/.pnpm/prop-types@15.8.1/node_modules/prop-types/index.js +17 -0
- package/lib/node_modules/.pnpm/prop-types@15.8.1/node_modules/prop-types/lib/ReactPropTypesSecret.js +10 -0
- package/lib/node_modules/.pnpm/prop-types@15.8.1/node_modules/prop-types/lib/has.js +7 -0
- package/lib/node_modules/.pnpm/react-is@16.13.1/node_modules/react-is/cjs/react-is.development.js +95 -0
- package/lib/node_modules/.pnpm/react-is@16.13.1/node_modules/react-is/cjs/react-is.production.min.js +78 -0
- package/lib/node_modules/.pnpm/react-is@16.13.1/node_modules/react-is/index.js +10 -0
- package/lib/node_modules/.pnpm/react-resizable@3.1.3_nnrd3gsncyragczmpvfhocinkq/node_modules/react-resizable/build/Resizable.js +233 -0
- package/lib/node_modules/.pnpm/react-resizable@3.1.3_nnrd3gsncyragczmpvfhocinkq/node_modules/react-resizable/build/ResizableBox.js +164 -0
- package/lib/node_modules/.pnpm/react-resizable@3.1.3_nnrd3gsncyragczmpvfhocinkq/node_modules/react-resizable/build/propTypes.js +113 -0
- package/lib/node_modules/.pnpm/react-resizable@3.1.3_nnrd3gsncyragczmpvfhocinkq/node_modules/react-resizable/build/utils.js +56 -0
- package/lib/node_modules/.pnpm/react-resizable@3.1.3_nnrd3gsncyragczmpvfhocinkq/node_modules/react-resizable/index.js +12 -0
- package/lib/store/modules/layout-config.store.js +83 -65
- package/lib/store/modules/theme.store.js +36 -18
- package/lib/types/fe-auto-complete/index.d.ts +2 -0
- package/lib/types/fe-button/index.d.ts +16 -0
- package/lib/types/fe-cascader/index.d.ts +7 -0
- package/lib/types/fe-checkbox/index.d.ts +6 -0
- package/lib/types/fe-checkbox-group/index.d.ts +7 -0
- package/lib/types/fe-date-picker/index.d.ts +3 -0
- package/lib/types/fe-description-render/index.d.ts +31 -0
- package/lib/types/fe-descriptions/index.d.ts +2 -0
- package/lib/types/fe-empty/index.d.ts +2 -0
- package/lib/types/fe-error-block/index.d.ts +6 -0
- package/lib/types/fe-form/fe-form/index.d.ts +356 -0
- package/lib/types/fe-form/fe-form-auto-complete/index.d.ts +3 -0
- package/lib/types/fe-form/fe-form-btn-group/index.d.ts +3 -0
- package/lib/types/fe-form/fe-form-cascader/index.d.ts +3 -0
- package/lib/types/fe-form/fe-form-checkbox-group/index.d.ts +3 -0
- package/lib/types/fe-form/fe-form-date-picker/index.d.ts +3 -0
- package/lib/types/fe-form/fe-form-date-range-picker/index.d.ts +3 -0
- package/lib/types/fe-form/fe-form-input/index.d.ts +3 -0
- package/lib/types/fe-form/fe-form-input-input/index.d.ts +3 -0
- package/lib/types/fe-form/fe-form-input-number/index.d.ts +3 -0
- package/lib/types/fe-form/fe-form-item/index.d.ts +70 -0
- package/lib/types/fe-form/fe-form-label/index.d.ts +45 -0
- package/lib/types/fe-form/fe-form-radio/index.d.ts +3 -0
- package/lib/types/fe-form/fe-form-render/index.d.ts +3 -0
- package/lib/types/fe-form/fe-form-rich-text/index.d.ts +3 -0
- package/lib/types/fe-form/fe-form-select/index.d.ts +3 -0
- package/lib/types/fe-form/fe-form-switch/index.d.ts +3 -0
- package/lib/types/fe-form/fe-form-text/index.d.ts +3 -0
- package/lib/types/fe-form/fe-form-text-area/index.d.ts +3 -0
- package/lib/types/fe-form/fe-form-time-picker/index.d.ts +3 -0
- package/lib/types/fe-form/fe-form-upload/index.d.ts +3 -0
- package/lib/types/fe-form/index.d.ts +26 -0
- package/lib/types/fe-form/utils/index.d.ts +24 -0
- package/lib/types/fe-input/index.d.ts +12 -0
- package/lib/types/fe-input-number/index.d.ts +2 -0
- package/lib/types/fe-layouts/context/global-context.d.ts +240 -238
- package/lib/types/fe-link/index.d.ts +6 -0
- package/lib/types/fe-map/index.d.ts +73 -0
- package/lib/types/fe-modal/index.d.ts +20 -0
- package/lib/types/fe-pagination/index.d.ts +2 -0
- package/lib/types/fe-panel/fe-panel-toolbar.d.ts +3 -0
- package/lib/types/fe-panel/index.d.ts +61 -0
- package/lib/types/fe-panel/panel-toolbar.d.ts +4 -0
- package/lib/types/fe-panel/use-panel-context.d.ts +6 -0
- package/lib/types/fe-permission/index.d.ts +10 -0
- package/lib/types/fe-permission-provider/index.d.ts +8 -0
- package/lib/types/fe-radio/index.d.ts +2 -0
- package/lib/types/fe-radio-group/index.d.ts +2 -0
- package/lib/types/fe-rich-text/index.d.ts +167 -0
- package/lib/types/fe-select/index.d.ts +8 -0
- package/lib/types/fe-switch/index.d.ts +2 -0
- package/lib/types/fe-table/fe-edit-table/index.d.ts +3 -0
- package/lib/types/fe-table/fe-edit-table-cell/index.d.ts +16 -0
- package/lib/types/fe-table/fe-head-title/index.d.ts +6 -0
- package/lib/types/fe-table/fe-normal-table/index.d.ts +3 -0
- package/lib/types/fe-table/fe-sub-table/index.d.ts +3 -0
- package/lib/types/fe-table/fe-table/index.d.ts +3 -0
- package/lib/types/fe-table/fe-table-alert/index.d.ts +13 -0
- package/lib/types/fe-table/fe-table-link/index.d.ts +12 -0
- package/lib/types/fe-table/fe-table-render/index.d.ts +13 -0
- package/lib/types/fe-table/fe-table-setting/index.d.ts +22 -0
- package/lib/types/fe-table/fe-table-toolbar/index.d.ts +18 -0
- package/lib/types/fe-table/fe-table-utils/index.d.ts +193 -0
- package/lib/types/fe-table/index.d.ts +6 -0
- package/lib/types/fe-table/type/table-context.d.ts +60 -0
- package/lib/types/fe-table/type/table.d.ts +797 -0
- package/lib/types/fe-table/use-edit-table/index.d.ts +6 -0
- package/lib/types/fe-table/use-pagination/index.d.ts +3 -0
- package/lib/types/fe-table/use-sub-table/index.d.ts +8 -0
- package/lib/types/fe-table/use-table/index.d.ts +3 -0
- package/lib/types/fe-table/use-table-columns/index.d.ts +47 -0
- package/lib/types/fe-table/use-table-form-context/index.d.ts +10 -0
- package/lib/types/fe-table/use-table-selection/index.d.ts +46 -0
- package/lib/types/fe-text-area/index.d.ts +4 -0
- package/lib/types/fe-time-picker/index.d.ts +3 -0
- package/lib/types/fe-upload/index.d.ts +85 -0
- package/lib/types/fe-upload/upload.constant.d.ts +39 -0
- package/lib/types/fe-upload-atomic/index.d.ts +2 -0
- package/lib/types/fe-upload-crop/index.d.ts +10 -0
- package/lib/types/hooks/index.d.ts +1 -0
- package/lib/types/hooks/use-descriptions/index.d.ts +3 -0
- package/lib/types/hooks/use-form/index.d.ts +16 -0
- package/lib/types/hooks/use-permission.hook/index.d.ts +10 -0
- package/lib/types/index.d.ts +32 -0
- package/lib/types/typings/index.d.ts +98 -59
- package/lib/types/typings/shims-axios.d.ts +38 -38
- package/package.json +79 -69
- /package/lib/hooks/{use-nprogress.hook.js → use-nprogress.hook/index.js} +0 -0
- /package/lib/types/hooks/{use-auth.hook.d.ts → use-auth.hook/index.d.ts} +0 -0
- /package/lib/types/hooks/{use-nprogress.hook.d.ts → use-nprogress.hook/index.d.ts} +0 -0
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
|
+
...
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
import { jsx as n } from "react/jsx-runtime";
|
|
2
|
+
import { classnames as f } from "@spacego/turbo-utils";
|
|
3
|
+
import { Button as b, Tooltip as h } from "antd";
|
|
4
|
+
import { useMemo as y } from "react";
|
|
5
|
+
import { FePermission as B } from "../fe-permission/index.js";
|
|
6
|
+
const N = (r) => {
|
|
7
|
+
const { minWidth: t = 100, disabledTooltip: i, disabled: e, className: c, style: s, onClick: l, children: a, ...p } = r, d = (o) => {
|
|
8
|
+
o.stopPropagation(), !e && l && l(o);
|
|
9
|
+
}, u = y(() => {
|
|
10
|
+
const o = { ...s };
|
|
11
|
+
return t && (o.minWidth = typeof t == "number" ? `${t}px` : t), o;
|
|
12
|
+
}, [s, t]), m = /* @__PURE__ */ n(
|
|
13
|
+
b,
|
|
14
|
+
{
|
|
15
|
+
...p,
|
|
16
|
+
disabled: e,
|
|
17
|
+
className: f("fe-button", c),
|
|
18
|
+
style: u,
|
|
19
|
+
onClick: d,
|
|
20
|
+
children: a || ""
|
|
21
|
+
}
|
|
22
|
+
);
|
|
23
|
+
return /* @__PURE__ */ n(B, { ...r, children: e && i ? /* @__PURE__ */ n(h, { title: i, children: m }) : m });
|
|
24
|
+
};
|
|
25
|
+
export {
|
|
26
|
+
N as default
|
|
27
|
+
};
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
import { jsx as h } from "react/jsx-runtime";
|
|
2
|
+
import { Cascader as l } from "antd";
|
|
3
|
+
const d = (e) => {
|
|
4
|
+
const a = (n, t) => {
|
|
5
|
+
e.onChange && e.onChange(n, t);
|
|
6
|
+
};
|
|
7
|
+
return /* @__PURE__ */ h(
|
|
8
|
+
l,
|
|
9
|
+
{
|
|
10
|
+
...e,
|
|
11
|
+
value: e.value,
|
|
12
|
+
style: { ...e.style, minWidth: "200px" },
|
|
13
|
+
onChange: a
|
|
14
|
+
}
|
|
15
|
+
);
|
|
16
|
+
};
|
|
17
|
+
export {
|
|
18
|
+
d as default
|
|
19
|
+
};
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
import { jsx as o } from "react/jsx-runtime";
|
|
2
|
+
import { DatePicker as i } from "antd";
|
|
3
|
+
const c = (e) => {
|
|
4
|
+
const t = (a, n) => {
|
|
5
|
+
e.onChange && e.onChange(a, n);
|
|
6
|
+
};
|
|
7
|
+
return /* @__PURE__ */ o(
|
|
8
|
+
i,
|
|
9
|
+
{
|
|
10
|
+
...e,
|
|
11
|
+
value: e.value,
|
|
12
|
+
onChange: t,
|
|
13
|
+
style: { width: "100%", ...e.style || {} }
|
|
14
|
+
}
|
|
15
|
+
);
|
|
16
|
+
};
|
|
17
|
+
export {
|
|
18
|
+
c as default
|
|
19
|
+
};
|
|
@@ -0,0 +1,43 @@
|
|
|
1
|
+
import { jsx as Q, Fragment as n } from "react/jsx-runtime";
|
|
2
|
+
import { Image as C, Space as J, Tag as N } from "antd";
|
|
3
|
+
import i from "../fe-link/index.js";
|
|
4
|
+
const h = ({ value: A }) => /* @__PURE__ */ Q(n, { children: A }), c = ({
|
|
5
|
+
value: A,
|
|
6
|
+
rawValue: E,
|
|
7
|
+
tagRenderParams: B
|
|
8
|
+
}) => A.length ? /* @__PURE__ */ Q("div", { children: A.map((g, o) => {
|
|
9
|
+
var I;
|
|
10
|
+
return /* @__PURE__ */ Q(N, { color: ((I = B == null ? void 0 : B.themeEnums) == null ? void 0 : I[E]) ?? "processing", children: g }, `${g}-${o}`);
|
|
11
|
+
}) }) : /* @__PURE__ */ Q("div", { children: "-" }), K = ({
|
|
12
|
+
value: A,
|
|
13
|
+
linkRenderParams: E
|
|
14
|
+
}) => /* @__PURE__ */ Q(i, { onClick: () => {
|
|
15
|
+
var g;
|
|
16
|
+
(g = E == null ? void 0 : E.onClick) == null || g.call(E, A);
|
|
17
|
+
}, children: (E == null ? void 0 : E.label) ?? A }), S = ({
|
|
18
|
+
value: A,
|
|
19
|
+
imageRenderParams: E
|
|
20
|
+
}) => {
|
|
21
|
+
const B = "data:image/png;base64,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";
|
|
22
|
+
if (!A || Array.isArray(A) && !A.length) return /* @__PURE__ */ Q("span", { children: "-" });
|
|
23
|
+
const g = (o) => /* @__PURE__ */ Q(C, { src: o, alt: "图片", fallback: B, ...E }, o);
|
|
24
|
+
return Array.isArray(A) ? /* @__PURE__ */ Q(C.PreviewGroup, { children: /* @__PURE__ */ Q(J, { children: A.map(g) }) }) : g(A);
|
|
25
|
+
};
|
|
26
|
+
function Y({
|
|
27
|
+
value: A,
|
|
28
|
+
renderType: E,
|
|
29
|
+
rawValue: B,
|
|
30
|
+
tagRenderParams: g,
|
|
31
|
+
linkRenderParams: o,
|
|
32
|
+
imageRenderParams: I
|
|
33
|
+
}) {
|
|
34
|
+
return {
|
|
35
|
+
tag: () => /* @__PURE__ */ Q(c, { value: A, rawValue: B, tagRenderParams: g }),
|
|
36
|
+
default: () => /* @__PURE__ */ Q(h, { value: A }),
|
|
37
|
+
link: () => /* @__PURE__ */ Q(K, { value: A, linkRenderParams: o }),
|
|
38
|
+
image: () => /* @__PURE__ */ Q(S, { value: A, imageRenderParams: I })
|
|
39
|
+
}[E]();
|
|
40
|
+
}
|
|
41
|
+
export {
|
|
42
|
+
Y as default
|
|
43
|
+
};
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
import { jsx as r, Fragment as t } from "react/jsx-runtime";
|
|
2
|
+
import { Result as o } from "antd";
|
|
3
|
+
const n = (e) => /* @__PURE__ */ r(t, { children: e.message ? /* @__PURE__ */ r(o, { status: "error", title: "Something went wrong", subTitle: e.message }) : e.children });
|
|
4
|
+
export {
|
|
5
|
+
n as default
|
|
6
|
+
};
|
|
@@ -0,0 +1,133 @@
|
|
|
1
|
+
import { jsx as n, jsxs as l } from "react/jsx-runtime";
|
|
2
|
+
import { useState as T, useRef as g, useMemo as u, createElement as M, useImperativeHandle as A, useEffect as P } from "react";
|
|
3
|
+
import { DownOutlined as B } from "@ant-design/icons";
|
|
4
|
+
import { underlineToHump as W, uuid as j } from "@spacego/turbo-utils";
|
|
5
|
+
import { Form as x, Col as y, Row as H } from "antd";
|
|
6
|
+
import { isEqual as L } from "lodash-es";
|
|
7
|
+
import C from "../../fe-button/index.js";
|
|
8
|
+
import G from "../fe-form-auto-complete/index.js";
|
|
9
|
+
import N from "../fe-form-btn-group/index.js";
|
|
10
|
+
import X from "../fe-form-cascader/index.js";
|
|
11
|
+
import _ from "../fe-form-checkbox-group/index.js";
|
|
12
|
+
import $ from "../fe-form-date-picker/index.js";
|
|
13
|
+
import q from "../fe-form-date-range-picker/index.js";
|
|
14
|
+
import O from "../fe-form-input/index.js";
|
|
15
|
+
import U from "../fe-form-input-input/index.js";
|
|
16
|
+
import z from "../fe-form-input-number/index.js";
|
|
17
|
+
import J from "../fe-form-radio/index.js";
|
|
18
|
+
import K from "../fe-form-render/index.js";
|
|
19
|
+
import Q from "../fe-form-rich-text/index.js";
|
|
20
|
+
import Y from "../fe-form-select/index.js";
|
|
21
|
+
import Z from "../fe-form-switch/index.js";
|
|
22
|
+
import ee from "../fe-form-text/index.js";
|
|
23
|
+
import te from "../fe-form-text-area/index.js";
|
|
24
|
+
import re from "../fe-form-time-picker/index.js";
|
|
25
|
+
import oe from "../fe-form-upload/index.js";
|
|
26
|
+
/* empty css */
|
|
27
|
+
const S = /* @__PURE__ */ new Map([
|
|
28
|
+
["input", O],
|
|
29
|
+
["select", Y],
|
|
30
|
+
["textarea", te],
|
|
31
|
+
["cascader", X],
|
|
32
|
+
["inputNumber", z],
|
|
33
|
+
["upload", oe],
|
|
34
|
+
["richText", Q],
|
|
35
|
+
["timePicker", re],
|
|
36
|
+
["datePicker", $],
|
|
37
|
+
["dateRange", q],
|
|
38
|
+
["inputInput", U],
|
|
39
|
+
["radio", J],
|
|
40
|
+
["switch", Z],
|
|
41
|
+
["btnGroup", N],
|
|
42
|
+
["checkbox", _],
|
|
43
|
+
["text", ee],
|
|
44
|
+
["render", K],
|
|
45
|
+
["autoComplete", G]
|
|
46
|
+
]), Te = (e) => {
|
|
47
|
+
const [m, I] = T(typeof e.isExpanded == "boolean" ? e.isExpanded : !0), [r] = x.useForm(), a = g({}), d = g(""), R = /* @__PURE__ */ new Map(), f = /* @__PURE__ */ new Map([
|
|
48
|
+
["uploadCard", 24],
|
|
49
|
+
["uploadDrag", 24],
|
|
50
|
+
["uploadDefault", 24]
|
|
51
|
+
]), b = (t) => {
|
|
52
|
+
var i;
|
|
53
|
+
return t.type === "upload" ? f.get(W(`${t.type}_${((i = t.uploadAttributes) == null ? void 0 : i.customType) ?? "default"}`)) : f.get(t.type);
|
|
54
|
+
}, v = u(() => {
|
|
55
|
+
const t = [...e.formItems];
|
|
56
|
+
return t.filter((o) => S.has(o.type) && !o.isHidden).slice(0, m || e.type === "form" ? t.length : 2).map((o) => {
|
|
57
|
+
const p = o.dataIndex;
|
|
58
|
+
let c = R.get(o.type) ?? o.colSpan ?? b(o);
|
|
59
|
+
e.type === "form" && e.formColSpan && (c = c ?? e.formColSpan);
|
|
60
|
+
const h = e.type === "search" && (e.formReactive ?? !0) === !0, D = h ? { span: 24, md: 24, lg: 12, xl: 8 } : { span: (h ? 8 : c) ?? 8 }, E = S.get(o.type);
|
|
61
|
+
return /* @__PURE__ */ M(y, { ...D, key: p }, /* @__PURE__ */ n("div", { style: { paddingInline: "16px" }, children: /* @__PURE__ */ n(E, { labelWidth: e.labelWidth, ...o, forceValue: d.current }, p) }));
|
|
62
|
+
});
|
|
63
|
+
}, [e.formItems, m]), w = u(() => e.formItems.length > 2, [e.formItems]), V = u(() => {
|
|
64
|
+
if (!m) return 8;
|
|
65
|
+
switch (e.formItems.length % 3) {
|
|
66
|
+
case 0:
|
|
67
|
+
return 24;
|
|
68
|
+
case 1:
|
|
69
|
+
return 16;
|
|
70
|
+
case 2:
|
|
71
|
+
return 8;
|
|
72
|
+
default:
|
|
73
|
+
return 8;
|
|
74
|
+
}
|
|
75
|
+
}, [m, e.formItems]), s = (t) => {
|
|
76
|
+
a.current = { ...a.current, ...t }, e.onValueChange && e.onValueChange(a.current);
|
|
77
|
+
}, k = () => {
|
|
78
|
+
e.onSearch && e.onSearch();
|
|
79
|
+
}, F = () => {
|
|
80
|
+
r.resetFields(), a.current = r.getFieldsValue(), s(r.getFieldsValue()), d.current = j(), e.onReload && e.onReload();
|
|
81
|
+
};
|
|
82
|
+
return A(e.formRef, () => ({
|
|
83
|
+
...r,
|
|
84
|
+
validate: (t) => t ? r.validateFields([t]) : r.validateFields(),
|
|
85
|
+
onReload: F
|
|
86
|
+
})), P(() => {
|
|
87
|
+
const t = r.getFieldsValue();
|
|
88
|
+
L(t, e.formData) || (r.setFieldsValue(e.formData), a.current = {
|
|
89
|
+
...a.current,
|
|
90
|
+
...e.formData
|
|
91
|
+
});
|
|
92
|
+
}, [e.formData, r]), /* @__PURE__ */ n(x, { form: r, onValuesChange: (t, i) => s(i), ...e.baseFormAttributes ?? {}, children: /* @__PURE__ */ l(H, { children: [
|
|
93
|
+
v,
|
|
94
|
+
e.type === "search" && /* @__PURE__ */ n(
|
|
95
|
+
y,
|
|
96
|
+
{
|
|
97
|
+
...e.formReactive ? { span: 24, md: 24, lg: 12, xl: V } : { span: e.formColSpan ?? 8 },
|
|
98
|
+
children: /* @__PURE__ */ l(
|
|
99
|
+
"div",
|
|
100
|
+
{
|
|
101
|
+
style: {
|
|
102
|
+
display: "flex",
|
|
103
|
+
alignItems: "center",
|
|
104
|
+
justifyContent: "flex-end",
|
|
105
|
+
gap: "16px",
|
|
106
|
+
marginBottom: "24px"
|
|
107
|
+
},
|
|
108
|
+
children: [
|
|
109
|
+
/* @__PURE__ */ n(C, { type: "primary", onClick: k, minWidth: 80, children: "查询" }),
|
|
110
|
+
/* @__PURE__ */ n(C, { onClick: () => F(), minWidth: 80, children: "重置" }),
|
|
111
|
+
w && /* @__PURE__ */ l(
|
|
112
|
+
"div",
|
|
113
|
+
{
|
|
114
|
+
style: { color: "var(--theme-color)", cursor: "pointer" },
|
|
115
|
+
onClick: () => {
|
|
116
|
+
I(!m);
|
|
117
|
+
},
|
|
118
|
+
children: [
|
|
119
|
+
/* @__PURE__ */ n(B, { rotate: m ? 180 : 0 }),
|
|
120
|
+
/* @__PURE__ */ n("span", { style: { marginLeft: "4px", userSelect: "none" }, children: m ? "收起" : "展开" })
|
|
121
|
+
]
|
|
122
|
+
}
|
|
123
|
+
)
|
|
124
|
+
]
|
|
125
|
+
}
|
|
126
|
+
)
|
|
127
|
+
}
|
|
128
|
+
)
|
|
129
|
+
] }) });
|
|
130
|
+
};
|
|
131
|
+
export {
|
|
132
|
+
Te as default
|
|
133
|
+
};
|
|
@@ -0,0 +1,57 @@
|
|
|
1
|
+
import { jsx as o } from "react/jsx-runtime";
|
|
2
|
+
import { Input as f } from "antd";
|
|
3
|
+
import { useMemo as u } from "react";
|
|
4
|
+
import C from "../../fe-auto-complete/index.js";
|
|
5
|
+
import d from "../../fe-button/index.js";
|
|
6
|
+
import h from "../fe-form-item/index.js";
|
|
7
|
+
import { getFormItemProps as A, getLabelProps as g } from "../utils/index.js";
|
|
8
|
+
const L = (t) => {
|
|
9
|
+
var n, a;
|
|
10
|
+
const l = u(() => !t.autoCompleteAttributes || !t.autoCompleteAttributes.options ? [] : t.autoCompleteAttributes.options.map((e) => ({
|
|
11
|
+
value: e,
|
|
12
|
+
label: e
|
|
13
|
+
})), [t.autoCompleteAttributes]), i = u(() => {
|
|
14
|
+
if (!t.autoCompleteAttributes) return {};
|
|
15
|
+
const { options: e, ...r } = t.autoCompleteAttributes;
|
|
16
|
+
return r;
|
|
17
|
+
}, [t]), m = u(
|
|
18
|
+
() => (e, r) => {
|
|
19
|
+
if (!e || !(r != null && r.label)) return !0;
|
|
20
|
+
const c = e.toLowerCase();
|
|
21
|
+
return String(r.label).toLowerCase().includes(c);
|
|
22
|
+
},
|
|
23
|
+
[]
|
|
24
|
+
), s = (e) => {
|
|
25
|
+
t.onChange && t.onChange(e);
|
|
26
|
+
}, b = /* @__PURE__ */ o(d, { ...t.buttonAttributes || {} });
|
|
27
|
+
return /* @__PURE__ */ o(
|
|
28
|
+
h,
|
|
29
|
+
{
|
|
30
|
+
name: t.dataIndex,
|
|
31
|
+
required: t.required ?? !1,
|
|
32
|
+
type: t.type,
|
|
33
|
+
rules: t.rules,
|
|
34
|
+
requiredMessage: t.requiredMessage,
|
|
35
|
+
attributes: { ...t.attributes || {} },
|
|
36
|
+
...g(t),
|
|
37
|
+
...A(t),
|
|
38
|
+
children: /* @__PURE__ */ o(
|
|
39
|
+
C,
|
|
40
|
+
{
|
|
41
|
+
...i,
|
|
42
|
+
showSearch: {
|
|
43
|
+
filterOption: ((n = t.autoCompleteAttributes) == null ? void 0 : n.filterOption) || m
|
|
44
|
+
},
|
|
45
|
+
placeholder: t.placeholder ?? `请输入${t.label}`,
|
|
46
|
+
value: t.value,
|
|
47
|
+
onChange: s,
|
|
48
|
+
options: l,
|
|
49
|
+
children: ((a = t.buttonAttributes) == null ? void 0 : a.children) && /* @__PURE__ */ o(f.Search, { enterButton: b })
|
|
50
|
+
}
|
|
51
|
+
)
|
|
52
|
+
}
|
|
53
|
+
);
|
|
54
|
+
};
|
|
55
|
+
export {
|
|
56
|
+
L as default
|
|
57
|
+
};
|
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
import { jsx as r } from "react/jsx-runtime";
|
|
2
|
+
import u from "../../fe-radio-group/index.js";
|
|
3
|
+
import i from "../fe-form-item/index.js";
|
|
4
|
+
import { getFormItemProps as a, getLabelProps as m } from "../utils/index.js";
|
|
5
|
+
const b = (e) => {
|
|
6
|
+
var t;
|
|
7
|
+
const o = {
|
|
8
|
+
width: "fit-content",
|
|
9
|
+
wordBreak: "keep-all",
|
|
10
|
+
...((t = e.buttonGroupAttributes) == null ? void 0 : t.style) || {}
|
|
11
|
+
};
|
|
12
|
+
return /* @__PURE__ */ r(
|
|
13
|
+
i,
|
|
14
|
+
{
|
|
15
|
+
name: e.dataIndex,
|
|
16
|
+
required: e.required ?? !1,
|
|
17
|
+
type: e.type,
|
|
18
|
+
rules: e.rules,
|
|
19
|
+
requiredMessage: e.requiredMessage,
|
|
20
|
+
attributes: { ...e.attributes || {} },
|
|
21
|
+
...m(e),
|
|
22
|
+
...a(e),
|
|
23
|
+
children: /* @__PURE__ */ r(u, { ...e.buttonGroupAttributes, optionType: "button", style: o, block: !0 })
|
|
24
|
+
}
|
|
25
|
+
);
|
|
26
|
+
};
|
|
27
|
+
export {
|
|
28
|
+
b as default
|
|
29
|
+
};
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
import { jsx as r } from "react/jsx-runtime";
|
|
2
|
+
import m from "../../fe-cascader/index.js";
|
|
3
|
+
import l from "../fe-form-item/index.js";
|
|
4
|
+
import { getFormItemProps as u, getLabelProps as d } from "../utils/index.js";
|
|
5
|
+
const f = (e) => {
|
|
6
|
+
const { valueType: t, ...a } = u(e);
|
|
7
|
+
return /* @__PURE__ */ r(
|
|
8
|
+
l,
|
|
9
|
+
{
|
|
10
|
+
name: e.dataIndex,
|
|
11
|
+
required: e.required ?? !1,
|
|
12
|
+
rules: e.rules,
|
|
13
|
+
type: e.type,
|
|
14
|
+
valueType: t ?? "array",
|
|
15
|
+
requiredMessage: e.requiredMessage,
|
|
16
|
+
...d(e),
|
|
17
|
+
...a,
|
|
18
|
+
attributes: { ...e.attributes || {} },
|
|
19
|
+
children: /* @__PURE__ */ r(m, { allowClear: !0, placeholder: `请选择${e.label}`, ...e.cascaderAttributes || {} })
|
|
20
|
+
}
|
|
21
|
+
);
|
|
22
|
+
};
|
|
23
|
+
export {
|
|
24
|
+
f as default
|
|
25
|
+
};
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
import { jsx as r } from "react/jsx-runtime";
|
|
2
|
+
import t from "../../fe-checkbox-group/index.js";
|
|
3
|
+
import m from "../fe-form-item/index.js";
|
|
4
|
+
import { getFormItemProps as u, getLabelProps as i } from "../utils/index.js";
|
|
5
|
+
const s = (e) => /* @__PURE__ */ r(
|
|
6
|
+
m,
|
|
7
|
+
{
|
|
8
|
+
name: e.dataIndex,
|
|
9
|
+
required: e.required ?? !1,
|
|
10
|
+
type: e.type,
|
|
11
|
+
rules: e.rules,
|
|
12
|
+
requiredMessage: e.requiredMessage,
|
|
13
|
+
...i(e),
|
|
14
|
+
...u(e),
|
|
15
|
+
attributes: { ...e.attributes || {} },
|
|
16
|
+
children: /* @__PURE__ */ r(t, { ...e.checkboxGroupAttributes || {} })
|
|
17
|
+
}
|
|
18
|
+
);
|
|
19
|
+
export {
|
|
20
|
+
s as default
|
|
21
|
+
};
|
|
@@ -0,0 +1,75 @@
|
|
|
1
|
+
import { jsx as s, jsxs as k } from "react/jsx-runtime";
|
|
2
|
+
import { dayjs as u } from "@spacego/turbo-utils";
|
|
3
|
+
import { Checkbox as P } from "antd";
|
|
4
|
+
import { useMemo as C, useState as p, useEffect as b } from "react";
|
|
5
|
+
import h from "../../fe-date-picker/index.js";
|
|
6
|
+
import y from "../fe-form-item/index.js";
|
|
7
|
+
import { getFormItemProps as x, getLabelProps as D } from "../utils/index.js";
|
|
8
|
+
const M = ({ attr: e, ...a }) => {
|
|
9
|
+
const n = { ...e, ...a }, { value: t, onChange: r, ...l } = n, m = u.default, [i, c] = p(!1), d = m("9999-12-31 23:59:59");
|
|
10
|
+
b(() => {
|
|
11
|
+
t && m(t).isSame(d) ? c(!0) : c(!1);
|
|
12
|
+
}, [t]);
|
|
13
|
+
const f = (o) => {
|
|
14
|
+
c(o), o ? r && r(d, "9999-12-31 23:59:59") : r && r(null, "");
|
|
15
|
+
};
|
|
16
|
+
return /* @__PURE__ */ k("div", { style: { display: "flex", alignItems: "center", gap: "8px", width: "100%" }, children: [
|
|
17
|
+
/* @__PURE__ */ s(
|
|
18
|
+
h,
|
|
19
|
+
{
|
|
20
|
+
value: i ? d : t,
|
|
21
|
+
onChange: (o, g) => {
|
|
22
|
+
i || r && r(o, g);
|
|
23
|
+
},
|
|
24
|
+
disabled: i,
|
|
25
|
+
allowClear: !i,
|
|
26
|
+
placeholder: l.placeholder,
|
|
27
|
+
style: { flex: 1, minWidth: 0 },
|
|
28
|
+
...l.datePickerAttributes || {}
|
|
29
|
+
}
|
|
30
|
+
),
|
|
31
|
+
/* @__PURE__ */ s(P, { checked: i, onChange: (o) => f(o.target.checked), style: { flexShrink: 0 }, children: "长期有效" })
|
|
32
|
+
] });
|
|
33
|
+
}, Y = ({ attr: e, ...a }) => {
|
|
34
|
+
const n = { ...e, ...a }, { value: t, onChange: r, ...l } = n;
|
|
35
|
+
return /* @__PURE__ */ s(
|
|
36
|
+
h,
|
|
37
|
+
{
|
|
38
|
+
value: t,
|
|
39
|
+
allowClear: !0,
|
|
40
|
+
placeholder: `请选择${n.label}`,
|
|
41
|
+
onChange: r,
|
|
42
|
+
...l.datePickerAttributes || {}
|
|
43
|
+
}
|
|
44
|
+
);
|
|
45
|
+
}, F = /* @__PURE__ */ new Map([
|
|
46
|
+
["datePicker", Y],
|
|
47
|
+
["datePickerLongTime", M]
|
|
48
|
+
]), $ = (e) => {
|
|
49
|
+
const a = u.default, n = C(() => {
|
|
50
|
+
var t;
|
|
51
|
+
return F.get(((t = e.datePickerAttributes) == null ? void 0 : t.datePickerType) ?? "datePicker");
|
|
52
|
+
}, [e.datePickerAttributes]);
|
|
53
|
+
return /* @__PURE__ */ s(
|
|
54
|
+
y,
|
|
55
|
+
{
|
|
56
|
+
name: e.dataIndex,
|
|
57
|
+
required: e.required ?? !1,
|
|
58
|
+
rules: e.rules,
|
|
59
|
+
type: e.type,
|
|
60
|
+
requiredMessage: e.requiredMessage,
|
|
61
|
+
getValueProps: (t) => ({ value: t && a(t) }),
|
|
62
|
+
normalize: (t) => {
|
|
63
|
+
var r;
|
|
64
|
+
return ((r = e.datePickerAttributes) == null ? void 0 : r.picker) === "month" ? t && a(t).format("YYYY-MM") : t && a(t).format("YYYY-MM-DD HH:mm:ss");
|
|
65
|
+
},
|
|
66
|
+
...D(e),
|
|
67
|
+
...x(e),
|
|
68
|
+
attributes: { ...e.attributes || {} },
|
|
69
|
+
children: /* @__PURE__ */ s(n, { attr: { ...e, placeholder: e.placeholder } })
|
|
70
|
+
}
|
|
71
|
+
);
|
|
72
|
+
};
|
|
73
|
+
export {
|
|
74
|
+
$ as default
|
|
75
|
+
};
|