@mi-avalon/libs 1.0.6 → 1.0.8
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 +9 -0
- package/dist/components/MForm/MFormItemConst.js +1 -9
- package/dist/components/MForm/index.js +8 -10
- package/dist/components/index.d.ts +8 -9
- package/dist/components/index.js +8 -9
- package/dist/index.d.ts +4 -4
- package/dist/index.es.js +1042 -28518
- package/dist/index.js +4 -4
- package/dist/index.umd.js +4 -257
- package/dist/utils/index.d.ts +3 -4
- package/dist/utils/index.js +3 -4
- package/dist/utils/openModal.d.ts +2 -2
- package/dist/utils/openModal.js +6 -6
- package/package.json +2 -1
- package/dist/components/MiModal/index.d.ts +0 -15
- package/dist/components/MiModal/index.js +0 -70
package/README.md
CHANGED
|
@@ -3,3 +3,12 @@
|
|
|
3
3
|
基于 react 19, antd 6 封装的组件/工具类库
|
|
4
4
|
|
|
5
5
|
[组件使用地址](https://mi-avalon.github.io/mi-avalon-libraries/2.%E7%BB%84%E4%BB%B6%E5%B7%A5%E5%85%B7%E7%B1%BB%E5%BA%93/1.%E5%AE%89%E8%A3%85%E4%B8%8E%E4%BD%BF%E7%94%A8/)
|
|
6
|
+
|
|
7
|
+
## 安装后必须操作
|
|
8
|
+
|
|
9
|
+
使用组件库前,请务必导入样式文件,否则组件将没有样式:
|
|
10
|
+
|
|
11
|
+
```css
|
|
12
|
+
在css文件中导入
|
|
13
|
+
@use "@mi-avalon/css";
|
|
14
|
+
```
|
|
@@ -56,15 +56,7 @@ export class MFormItemConst {
|
|
|
56
56
|
return _jsx(Checkbox.Group, { disabled: item.disabled, ...item.props });
|
|
57
57
|
};
|
|
58
58
|
static upload = (item) => {
|
|
59
|
-
|
|
60
|
-
const uploadProps = {
|
|
61
|
-
...item.props,
|
|
62
|
-
};
|
|
63
|
-
// 如果fileList存在但不是数组,转换为数组
|
|
64
|
-
if (uploadProps.fileList && !Array.isArray(uploadProps.fileList)) {
|
|
65
|
-
uploadProps.fileList = [uploadProps.fileList];
|
|
66
|
-
}
|
|
67
|
-
return (_jsx(Upload, { ...uploadProps, children: item.children || (_jsxs(Button, { children: [_jsx(UploadOutlined, {}), " \u70B9\u51FB\u4E0A\u4F20"] })) }));
|
|
59
|
+
return (_jsx(Upload, { ...item.props, children: item.children || (_jsxs(Button, { children: [_jsx(UploadOutlined, {}), " \u70B9\u51FB\u4E0A\u4F20"] })) }));
|
|
68
60
|
};
|
|
69
61
|
static mentions = (item) => {
|
|
70
62
|
return (_jsx(Mentions, { ...item.props, placeholder: item.placeholder || MFormItemConst.getDefaultPlaceholder(item) }));
|
|
@@ -34,6 +34,13 @@ const MForm = React.memo((props) => {
|
|
|
34
34
|
},
|
|
35
35
|
...itemLayout,
|
|
36
36
|
}), [itemLayout]);
|
|
37
|
+
// 修复Upload组件的值处理
|
|
38
|
+
const normFile = (e) => {
|
|
39
|
+
if (Array.isArray(e)) {
|
|
40
|
+
return e;
|
|
41
|
+
}
|
|
42
|
+
return e?.fileList;
|
|
43
|
+
};
|
|
37
44
|
// 优化:缓存渲染表单项的函数
|
|
38
45
|
const renderFormItem = useCallback((item) => {
|
|
39
46
|
const { show = true } = item;
|
|
@@ -51,21 +58,12 @@ const MForm = React.memo((props) => {
|
|
|
51
58
|
if (!formItemProps.valuePropName) {
|
|
52
59
|
formItemProps.valuePropName = 'fileList';
|
|
53
60
|
}
|
|
54
|
-
// 添加getValueProps确保传递给Upload的fileList始终是数组
|
|
55
|
-
if (!formItemProps.getValueProps) {
|
|
56
|
-
formItemProps.getValueProps = (value) => {
|
|
57
|
-
// 确保fileList始终是数组
|
|
58
|
-
return {
|
|
59
|
-
fileList: Array.isArray(value) ? value : [],
|
|
60
|
-
};
|
|
61
|
-
};
|
|
62
|
-
}
|
|
63
61
|
}
|
|
64
62
|
const mergedFormItemLayout = {
|
|
65
63
|
...formItemLayout,
|
|
66
64
|
...item.itemLayout,
|
|
67
65
|
};
|
|
68
|
-
return (_jsx(Col, { span: item.span || 24 / column, children: _jsxs(Row, { className: 'item-row', children: [_jsx("div", { className: classname('item-wrapper'), children: _jsx(Form.Item, { label: item.label, name: item.id, rules: rules, initialValue: item.initialValue, ...mergedFormItemLayout, ...formItemProps, children: renderItem(item, form) }) }), item.suffix] }) }, `col-${item.id}`));
|
|
66
|
+
return (_jsx(Col, { span: item.span || 24 / column, children: _jsxs(Row, { className: 'item-row', children: [_jsx("div", { className: classname('item-wrapper'), children: _jsx(Form.Item, { label: item.label, name: item.id, rules: rules, initialValue: item.initialValue, getValueFromEvent: item.type === 'upload' ? normFile : undefined, ...mergedFormItemLayout, ...formItemProps, children: renderItem(item, form) }) }), item.suffix] }) }, `col-${item.id}`));
|
|
69
67
|
}, [column, form, formItemLayout, renderItem]);
|
|
70
68
|
// 优化:缓存表单容器类名
|
|
71
69
|
const formClassName = useMemo(() => {
|
|
@@ -1,9 +1,8 @@
|
|
|
1
|
-
export * from
|
|
2
|
-
export * from
|
|
3
|
-
export * from
|
|
4
|
-
export * from
|
|
5
|
-
export { default as MForm } from
|
|
6
|
-
export * from
|
|
7
|
-
export * from
|
|
8
|
-
export * from
|
|
9
|
-
export * from './ThemeContext';
|
|
1
|
+
export * from "./ItemsRow";
|
|
2
|
+
export * from "./MBreadcrumb";
|
|
3
|
+
export * from "./MDescriptions";
|
|
4
|
+
export * from "./MForm";
|
|
5
|
+
export { default as MForm } from "./MForm";
|
|
6
|
+
export * from "./MSearch";
|
|
7
|
+
export * from "./MTable";
|
|
8
|
+
export * from "./ThemeContext";
|
package/dist/components/index.js
CHANGED
|
@@ -1,9 +1,8 @@
|
|
|
1
|
-
export * from
|
|
2
|
-
export * from
|
|
3
|
-
export * from
|
|
4
|
-
export * from
|
|
5
|
-
export { default as MForm } from
|
|
6
|
-
export * from
|
|
7
|
-
export * from
|
|
8
|
-
export * from
|
|
9
|
-
export * from './ThemeContext';
|
|
1
|
+
export * from "./ItemsRow";
|
|
2
|
+
export * from "./MBreadcrumb";
|
|
3
|
+
export * from "./MDescriptions";
|
|
4
|
+
export * from "./MForm";
|
|
5
|
+
export { default as MForm } from "./MForm";
|
|
6
|
+
export * from "./MSearch";
|
|
7
|
+
export * from "./MTable";
|
|
8
|
+
export * from "./ThemeContext";
|
package/dist/index.d.ts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
export * from
|
|
2
|
-
export * from
|
|
3
|
-
export * from
|
|
4
|
-
export * from
|
|
1
|
+
export * from "./components";
|
|
2
|
+
export * from "./constants";
|
|
3
|
+
export * from "./hooks";
|
|
4
|
+
export * from "./utils";
|