@zykj2024/much-library 1.0.9
Sign up to get free protection for your applications and to get access to all the features.
- package/LICENSE +21 -0
- package/README.md +35 -0
- package/dist/McCascader/city.js +909 -0
- package/dist/McCascader/index.css +60 -0
- package/dist/McCascader/index.d.ts +19 -0
- package/dist/McCascader/index.js +221 -0
- package/dist/McContainer/demo/actionBar.d.ts +8 -0
- package/dist/McContainer/demo/actionBar.js +70 -0
- package/dist/McContainer/demo/base.d.ts +8 -0
- package/dist/McContainer/demo/base.js +80 -0
- package/dist/McContainer/demo/batch.d.ts +8 -0
- package/dist/McContainer/demo/batch.js +89 -0
- package/dist/McContainer/demo/collapse.d.ts +8 -0
- package/dist/McContainer/demo/collapse.js +76 -0
- package/dist/McContainer/demo/expand.d.ts +8 -0
- package/dist/McContainer/demo/expand.js +90 -0
- package/dist/McContainer/demo/pagination.d.ts +7 -0
- package/dist/McContainer/demo/pagination.js +93 -0
- package/dist/McContainer/demo/search.d.ts +7 -0
- package/dist/McContainer/demo/search.js +101 -0
- package/dist/McContainer/demo/standard.d.ts +7 -0
- package/dist/McContainer/demo/standard.js +168 -0
- package/dist/McContainer/index.css +123 -0
- package/dist/McContainer/index.d.ts +49 -0
- package/dist/McContainer/index.js +407 -0
- package/dist/McDateRange/demo/base.d.ts +6 -0
- package/dist/McDateRange/demo/base.js +22 -0
- package/dist/McDateRange/demo/cancelPresets.d.ts +6 -0
- package/dist/McDateRange/demo/cancelPresets.js +23 -0
- package/dist/McDateRange/demo/overlap.d.ts +2 -0
- package/dist/McDateRange/demo/overlap.js +32 -0
- package/dist/McDateRange/index.css +31 -0
- package/dist/McDateRange/index.d.ts +28 -0
- package/dist/McDateRange/index.js +167 -0
- package/dist/McFonts/index.d.ts +7 -0
- package/dist/McFonts/index.js +10 -0
- package/dist/McFonts/public/FF DIN Pro Bold.otf +0 -0
- package/dist/McFonts/public/SourceHanSansCN-Bold.otf +0 -0
- package/dist/McFonts/public/SourceHanSansCN-Light.otf +0 -0
- package/dist/McFonts/public/SourceHanSansCN-Medium.otf +0 -0
- package/dist/McFonts/public/SourceHanSansCN-Regular.otf +0 -0
- package/dist/McGroupPanel/comps/SelectedItem/index.d.ts +4 -0
- package/dist/McGroupPanel/comps/SelectedItem/index.js +76 -0
- package/dist/McGroupPanel/index.css +162 -0
- package/dist/McGroupPanel/index.d.ts +29 -0
- package/dist/McGroupPanel/index.js +411 -0
- package/dist/McIconFont/iconfont.js +1 -0
- package/dist/McIconFont/index.d.ts +5 -0
- package/dist/McIconFont/index.js +8 -0
- package/dist/McIcons/business.json +137 -0
- package/dist/McInput/Input.d.ts +19 -0
- package/dist/McInput/Input.js +48 -0
- package/dist/McInput/Search.d.ts +39 -0
- package/dist/McInput/Search.js +81 -0
- package/dist/McInput/TextArea.d.ts +11 -0
- package/dist/McInput/TextArea.js +37 -0
- package/dist/McInput/demo/Input/addonBefore.d.ts +3 -0
- package/dist/McInput/demo/Input/addonBefore.js +67 -0
- package/dist/McInput/demo/Input/base.d.ts +2 -0
- package/dist/McInput/demo/Input/base.js +31 -0
- package/dist/McInput/demo/Input/isTrim.d.ts +2 -0
- package/dist/McInput/demo/Input/isTrim.js +22 -0
- package/dist/McInput/demo/Input/label.d.ts +2 -0
- package/dist/McInput/demo/Input/label.js +26 -0
- package/dist/McInput/demo/Input/ref.d.ts +3 -0
- package/dist/McInput/demo/Input/ref.js +53 -0
- package/dist/McInput/demo/Input/status.d.ts +2 -0
- package/dist/McInput/demo/Input/status.js +23 -0
- package/dist/McInput/demo/Search/search-base.d.ts +2 -0
- package/dist/McInput/demo/Search/search-base.js +38 -0
- package/dist/McInput/demo/TextArea/text-area-base.d.ts +2 -0
- package/dist/McInput/demo/TextArea/text-area-base.js +38 -0
- package/dist/McInput/index.css +44 -0
- package/dist/McInput/index.d.ts +13 -0
- package/dist/McInput/index.js +7 -0
- package/dist/McInputNumber/demo/index.d.ts +2 -0
- package/dist/McInputNumber/demo/index.js +28 -0
- package/dist/McInputNumber/demo/label.d.ts +2 -0
- package/dist/McInputNumber/demo/label.js +26 -0
- package/dist/McInputNumber/demo/precision.d.ts +2 -0
- package/dist/McInputNumber/demo/precision.js +20 -0
- package/dist/McInputNumber/index.css +9 -0
- package/dist/McInputNumber/index.d.ts +13 -0
- package/dist/McInputNumber/index.js +43 -0
- package/dist/McModalProvider/index.d.ts +174 -0
- package/dist/McModalProvider/index.js +498 -0
- package/dist/McPeriodSelect/demo/base.d.ts +6 -0
- package/dist/McPeriodSelect/demo/base.js +19 -0
- package/dist/McPeriodSelect/demo/half.d.ts +6 -0
- package/dist/McPeriodSelect/demo/half.js +20 -0
- package/dist/McPeriodSelect/index.css +189 -0
- package/dist/McPeriodSelect/index.d.ts +13 -0
- package/dist/McPeriodSelect/index.js +305 -0
- package/dist/McPopoverButton/index.d.ts +14 -0
- package/dist/McPopoverButton/index.js +52 -0
- package/dist/McPopoverForm/index.d.ts +14 -0
- package/dist/McPopoverForm/index.js +95 -0
- package/dist/McResult/default.d.ts +1 -0
- package/dist/McResult/default.js +84 -0
- package/dist/McResult/demo/403.d.ts +6 -0
- package/dist/McResult/demo/403.js +17 -0
- package/dist/McResult/demo/404.d.ts +6 -0
- package/dist/McResult/demo/404.js +17 -0
- package/dist/McResult/demo/500.d.ts +6 -0
- package/dist/McResult/demo/500.js +17 -0
- package/dist/McResult/demo/building.d.ts +6 -0
- package/dist/McResult/demo/building.js +12 -0
- package/dist/McResult/demo/empty.d.ts +2 -0
- package/dist/McResult/demo/empty.js +11 -0
- package/dist/McResult/demo/noFunction.d.ts +2 -0
- package/dist/McResult/demo/noFunction.js +11 -0
- package/dist/McResult/demo/noUser.d.ts +6 -0
- package/dist/McResult/demo/noUser.js +12 -0
- package/dist/McResult/demo/preview.d.ts +2 -0
- package/dist/McResult/demo/preview.js +14 -0
- package/dist/McResult/icon.d.ts +25 -0
- package/dist/McResult/icon.js +946 -0
- package/dist/McResult/index.css +20 -0
- package/dist/McResult/index.d.ts +27 -0
- package/dist/McResult/index.js +103 -0
- package/dist/McResult/public/403.svg +164 -0
- package/dist/McResult/public/404.svg +123 -0
- package/dist/McResult/public/500.svg +129 -0
- package/dist/McResult/public/building.svg +127 -0
- package/dist/McResult/public/code403.svg +7 -0
- package/dist/McResult/public/code404.svg +5 -0
- package/dist/McResult/public/code500.svg +5 -0
- package/dist/McResult/public/empty.svg +1 -0
- package/dist/McResult/public/noFunction.svg +1 -0
- package/dist/McResult/public/noUser.svg +90 -0
- package/dist/McSelect/demo/base.d.ts +2 -0
- package/dist/McSelect/demo/base.js +63 -0
- package/dist/McSelect/demo/changeOnHidden.d.ts +2 -0
- package/dist/McSelect/demo/changeOnHidden.js +43 -0
- package/dist/McSelect/demo/dropdownRender.d.ts +7 -0
- package/dist/McSelect/demo/dropdownRender.js +78 -0
- package/dist/McSelect/demo/fetchOptions.d.ts +7 -0
- package/dist/McSelect/demo/fetchOptions.js +210 -0
- package/dist/McSelect/demo/inexistent.d.ts +2 -0
- package/dist/McSelect/demo/inexistent.js +79 -0
- package/dist/McSelect/demo/labelInValue.d.ts +2 -0
- package/dist/McSelect/demo/labelInValue.js +72 -0
- package/dist/McSelect/demo/maxTagCount.d.ts +3 -0
- package/dist/McSelect/demo/maxTagCount.js +51 -0
- package/dist/McSelect/demo/multiple.d.ts +2 -0
- package/dist/McSelect/demo/multiple.js +46 -0
- package/dist/McSelect/demo/optionRender.d.ts +3 -0
- package/dist/McSelect/demo/optionRender.js +51 -0
- package/dist/McSelect/demo/tagRender.d.ts +3 -0
- package/dist/McSelect/demo/tagRender.js +51 -0
- package/dist/McSelect/index.css +60 -0
- package/dist/McSelect/index.d.ts +40 -0
- package/dist/McSelect/index.js +350 -0
- package/dist/McThemeConfig/customToken.json +38 -0
- package/dist/McThemeConfig/demo/button.d.ts +2 -0
- package/dist/McThemeConfig/demo/button.js +226 -0
- package/dist/McThemeConfig/demo/drawer.d.ts +2 -0
- package/dist/McThemeConfig/demo/drawer.js +59 -0
- package/dist/McThemeConfig/demo/modal.d.ts +2 -0
- package/dist/McThemeConfig/demo/modal.js +78 -0
- package/dist/McThemeConfig/demo/radio.d.ts +2 -0
- package/dist/McThemeConfig/demo/radio.js +97 -0
- package/dist/McThemeConfig/demo/switch.d.ts +2 -0
- package/dist/McThemeConfig/demo/switch.js +96 -0
- package/dist/McThemeConfig/demo/tabs.d.ts +2 -0
- package/dist/McThemeConfig/demo/tabs.js +35 -0
- package/dist/McThemeConfig/globalStyle.d.ts +2 -0
- package/dist/McThemeConfig/globalStyle.js +172 -0
- package/dist/McThemeConfig/index.d.ts +9 -0
- package/dist/McThemeConfig/index.js +16 -0
- package/dist/McThemeConfig/layoutStyle.d.ts +2 -0
- package/dist/McThemeConfig/layoutStyle.js +1 -0
- package/dist/McThemeConfig/provider.d.ts +7 -0
- package/dist/McThemeConfig/provider.js +19 -0
- package/dist/McThemeConfig/themeToken.json +149 -0
- package/dist/McTreePanel/SelectedItem.d.ts +4 -0
- package/dist/McTreePanel/SelectedItem.js +75 -0
- package/dist/McTreePanel/demo/base.d.ts +6 -0
- package/dist/McTreePanel/demo/base.js +45 -0
- package/dist/McTreePanel/demo/fieldNames.d.ts +6 -0
- package/dist/McTreePanel/demo/fieldNames.js +37 -0
- package/dist/McTreePanel/demo/inexistent.d.ts +6 -0
- package/dist/McTreePanel/demo/inexistent.js +56 -0
- package/dist/McTreePanel/demo/labelInValue.d.ts +6 -0
- package/dist/McTreePanel/demo/labelInValue.js +56 -0
- package/dist/McTreePanel/demo/sortable.d.ts +6 -0
- package/dist/McTreePanel/demo/sortable.js +34 -0
- package/dist/McTreePanel/index.css +110 -0
- package/dist/McTreePanel/index.d.ts +27 -0
- package/dist/McTreePanel/index.js +315 -0
- package/dist/McTreeSelect/demo/base.d.ts +5 -0
- package/dist/McTreeSelect/demo/base.js +58 -0
- package/dist/McTreeSelect/demo/inexistent.d.ts +5 -0
- package/dist/McTreeSelect/demo/inexistent.js +63 -0
- package/dist/McTreeSelect/demo/label.d.ts +5 -0
- package/dist/McTreeSelect/demo/label.js +60 -0
- package/dist/McTreeSelect/demo/multiple.d.ts +5 -0
- package/dist/McTreeSelect/demo/multiple.js +71 -0
- package/dist/McTreeSelect/index.css +60 -0
- package/dist/McTreeSelect/index.d.ts +13 -0
- package/dist/McTreeSelect/index.js +182 -0
- package/dist/Utils/index.d.ts +4 -0
- package/dist/Utils/index.js +26 -0
- package/dist/index.d.ts +19 -0
- package/dist/index.js +19 -0
- package/dist/typings.d.ts +20 -0
- package/package.json +82 -0
@@ -0,0 +1,38 @@
|
|
1
|
+
/**
|
2
|
+
* title: 基本使用
|
3
|
+
* description: 设置 `enterButton` 使 搜索按钮 为主按钮样式。注意:addonAfter、suffix、onPressEnter 失效不可用
|
4
|
+
*/
|
5
|
+
import { McInput } from "../../..";
|
6
|
+
import { jsx as _jsx } from "react/jsx-runtime";
|
7
|
+
import { jsxs as _jsxs } from "react/jsx-runtime";
|
8
|
+
export default (function () {
|
9
|
+
return /*#__PURE__*/_jsxs("div", {
|
10
|
+
style: {
|
11
|
+
display: 'flex',
|
12
|
+
flexDirection: 'column',
|
13
|
+
gap: 8
|
14
|
+
},
|
15
|
+
children: [/*#__PURE__*/_jsx(McInput.Search, {
|
16
|
+
loading: true,
|
17
|
+
placeholder: "\u57FA\u672C\u4F7F\u7528",
|
18
|
+
count: {
|
19
|
+
show: true,
|
20
|
+
max: 10
|
21
|
+
}
|
22
|
+
}), /*#__PURE__*/_jsx(McInput.Search, {
|
23
|
+
placeholder: "\u57FA\u672C\u4F7F\u7528"
|
24
|
+
}), /*#__PURE__*/_jsx(McInput.Search, {
|
25
|
+
enterButton: true,
|
26
|
+
placeholder: "\u57FA\u672C\u4F7F\u7528",
|
27
|
+
style: {
|
28
|
+
width: 300
|
29
|
+
}
|
30
|
+
}), /*#__PURE__*/_jsx(McInput.Search, {
|
31
|
+
enterButton: "\u641C\u7D22",
|
32
|
+
placeholder: "\u57FA\u672C\u4F7F\u7528",
|
33
|
+
style: {
|
34
|
+
width: 300
|
35
|
+
}
|
36
|
+
})]
|
37
|
+
});
|
38
|
+
});
|
@@ -0,0 +1,38 @@
|
|
1
|
+
/**
|
2
|
+
* title: 基本使用
|
3
|
+
* description: 支持两种方式的限制最大数字多行文本框,
|
4
|
+
*/
|
5
|
+
import { McInput } from "../../..";
|
6
|
+
import { jsx as _jsx } from "react/jsx-runtime";
|
7
|
+
import { jsxs as _jsxs } from "react/jsx-runtime";
|
8
|
+
export default (function () {
|
9
|
+
return /*#__PURE__*/_jsxs("div", {
|
10
|
+
style: {
|
11
|
+
display: 'flex',
|
12
|
+
flexDirection: 'column',
|
13
|
+
gap: 8
|
14
|
+
},
|
15
|
+
children: [/*#__PURE__*/_jsx(McInput.TextArea, {
|
16
|
+
placeholder: "\u57FA\u672C\u4F7F\u7528\uFF0C\u4E0D\u4F1A\u6839\u636E\u5185\u5BB9\u53D8\u5316\u9AD8\u5EA6"
|
17
|
+
}), /*#__PURE__*/_jsx(McInput.TextArea, {
|
18
|
+
placeholder: "\u7B2C\u4E00\u79CD\u9650\u5236\u5B57\u6570\u65B9\u5F0F",
|
19
|
+
maxLength: 100,
|
20
|
+
showCount: true
|
21
|
+
}), /*#__PURE__*/_jsx(McInput.TextArea, {
|
22
|
+
placeholder: "\u7B2C\u4E8C\u79CD\u9650\u5236\u5B57\u6570\u65B9\u5F0F",
|
23
|
+
count: {
|
24
|
+
show: true,
|
25
|
+
max: 10
|
26
|
+
}
|
27
|
+
}), /*#__PURE__*/_jsx(McInput.TextArea, {
|
28
|
+
placeholder: "\u6839\u636E\u5185\u5BB9\u53D8\u5316\u9AD8\u5EA6",
|
29
|
+
autoSize: true
|
30
|
+
}), /*#__PURE__*/_jsx(McInput.TextArea, {
|
31
|
+
placeholder: "\u6700\u5C0F\u9AD8\u5EA6\u4E3A1\u884C\uFF0C\u6700\u5927\u9AD8\u5EA6\u4E3A5\u884C",
|
32
|
+
autoSize: {
|
33
|
+
minRows: 1,
|
34
|
+
maxRows: 5
|
35
|
+
}
|
36
|
+
})]
|
37
|
+
});
|
38
|
+
});
|
@@ -0,0 +1,44 @@
|
|
1
|
+
.mc-input .ant-input-suffix .ant-input-show-count-suffix,
|
2
|
+
.mc-search .ant-input-suffix .ant-input-show-count-suffix {
|
3
|
+
color: #b3b3b3;
|
4
|
+
font-size: 12px;
|
5
|
+
}
|
6
|
+
.mc-input__label {
|
7
|
+
color: #262626;
|
8
|
+
font-size: 14px;
|
9
|
+
margin-right: -4px;
|
10
|
+
}
|
11
|
+
.mc-input__label::after {
|
12
|
+
content: ':';
|
13
|
+
margin-left: 2px;
|
14
|
+
}
|
15
|
+
.mc-search {
|
16
|
+
width: 280px;
|
17
|
+
}
|
18
|
+
.mc-search .mc-search__icon {
|
19
|
+
width: auto;
|
20
|
+
height: 22px;
|
21
|
+
padding: 0;
|
22
|
+
color: #8c8c8c;
|
23
|
+
}
|
24
|
+
.mc-search .ant-input-affix-wrapper + .ant-input-group-addon {
|
25
|
+
inset-inline-start: -1px;
|
26
|
+
padding: 0;
|
27
|
+
border: 0;
|
28
|
+
}
|
29
|
+
.mc-search .ant-input-affix-wrapper + .ant-input-group-addon .mc-search__button {
|
30
|
+
width: auto;
|
31
|
+
border-radius: 0 4px 4px 0;
|
32
|
+
padding: 0 12px;
|
33
|
+
margin-right: -1px;
|
34
|
+
z-index: 1;
|
35
|
+
}
|
36
|
+
.mc-textarea .ant-input-suffix .ant-input-clear-icon {
|
37
|
+
z-index: 1;
|
38
|
+
}
|
39
|
+
.mc-textarea .ant-input-suffix .ant-input-data-count {
|
40
|
+
bottom: 0;
|
41
|
+
right: 11px;
|
42
|
+
color: #b3b3b3;
|
43
|
+
font-size: 12px;
|
44
|
+
}
|
@@ -0,0 +1,13 @@
|
|
1
|
+
import { ForwardRefExoticComponent, RefAttributes } from 'react';
|
2
|
+
import type { InputRef, McInputProps } from './Input';
|
3
|
+
import Search from './Search';
|
4
|
+
import TextArea from './TextArea';
|
5
|
+
export type { InputRef, McInputProps } from './Input';
|
6
|
+
export type { McSearchProps } from './Search';
|
7
|
+
export type { McTextAreaProps } from './TextArea';
|
8
|
+
type CompoundedComponent = ForwardRefExoticComponent<McInputProps & RefAttributes<InputRef>> & {
|
9
|
+
Search: typeof Search;
|
10
|
+
TextArea: typeof TextArea;
|
11
|
+
};
|
12
|
+
declare const McInput: CompoundedComponent;
|
13
|
+
export default McInput;
|
@@ -0,0 +1,28 @@
|
|
1
|
+
/**
|
2
|
+
* title: 基本用法
|
3
|
+
* description: 数字输入框
|
4
|
+
*/
|
5
|
+
import { Space } from 'antd';
|
6
|
+
import { McInputNumber } from "../..";
|
7
|
+
import { jsx as _jsx } from "react/jsx-runtime";
|
8
|
+
import { jsxs as _jsxs } from "react/jsx-runtime";
|
9
|
+
export default (function () {
|
10
|
+
return /*#__PURE__*/_jsxs(Space, {
|
11
|
+
direction: "vertical",
|
12
|
+
size: 16,
|
13
|
+
children: [/*#__PURE__*/_jsx(McInputNumber, {
|
14
|
+
style: {
|
15
|
+
width: 200
|
16
|
+
}
|
17
|
+
}), /*#__PURE__*/_jsxs(Space, {
|
18
|
+
children: [/*#__PURE__*/_jsx("span", {
|
19
|
+
children: "\u7981\u7528"
|
20
|
+
}), /*#__PURE__*/_jsx(McInputNumber, {
|
21
|
+
disabled: true,
|
22
|
+
style: {
|
23
|
+
width: 200
|
24
|
+
}
|
25
|
+
})]
|
26
|
+
})]
|
27
|
+
});
|
28
|
+
});
|
@@ -0,0 +1,26 @@
|
|
1
|
+
/**
|
2
|
+
* title: 前缀
|
3
|
+
* description: label属性,配置label属性后会多一个冒号(主要用于McContainer查询区),antd原生属性prefix会覆盖label属性
|
4
|
+
*/
|
5
|
+
import { Space } from 'antd';
|
6
|
+
import { McInputNumber } from "../..";
|
7
|
+
import { jsx as _jsx } from "react/jsx-runtime";
|
8
|
+
import { jsxs as _jsxs } from "react/jsx-runtime";
|
9
|
+
export default (function () {
|
10
|
+
return /*#__PURE__*/_jsxs(Space, {
|
11
|
+
direction: "vertical",
|
12
|
+
size: 16,
|
13
|
+
children: [/*#__PURE__*/_jsx(McInputNumber, {
|
14
|
+
label: "\u6570\u5B57",
|
15
|
+
style: {
|
16
|
+
width: 200
|
17
|
+
}
|
18
|
+
}), /*#__PURE__*/_jsx(McInputNumber, {
|
19
|
+
label: "\u6570\u5B57",
|
20
|
+
prefix: "\u524D\u7F00\u8986\u76D6",
|
21
|
+
style: {
|
22
|
+
width: 200
|
23
|
+
}
|
24
|
+
})]
|
25
|
+
});
|
26
|
+
});
|
@@ -0,0 +1,20 @@
|
|
1
|
+
/**
|
2
|
+
* title: 数值精度
|
3
|
+
* description: precision属性,默认为0即整数。不够精度时,不自动补0;超出精度,自动四舍五入。
|
4
|
+
*/
|
5
|
+
import { Space } from 'antd';
|
6
|
+
import { McInputNumber } from "../..";
|
7
|
+
import { jsx as _jsx } from "react/jsx-runtime";
|
8
|
+
export default (function () {
|
9
|
+
return /*#__PURE__*/_jsx(Space, {
|
10
|
+
direction: "vertical",
|
11
|
+
size: 16,
|
12
|
+
children: /*#__PURE__*/_jsx(McInputNumber, {
|
13
|
+
defaultValue: 1.1,
|
14
|
+
precision: 2,
|
15
|
+
style: {
|
16
|
+
width: 200
|
17
|
+
}
|
18
|
+
})
|
19
|
+
});
|
20
|
+
});
|
@@ -0,0 +1,13 @@
|
|
1
|
+
import { InputNumberProps } from 'antd';
|
2
|
+
import { FC, ReactNode } from 'react';
|
3
|
+
import './index.less';
|
4
|
+
type McInputNumberProps = Omit<InputNumberProps, 'precision' | 'value' | 'onChange'> & {
|
5
|
+
name?: string;
|
6
|
+
label?: ReactNode;
|
7
|
+
precision?: number;
|
8
|
+
value?: number | null;
|
9
|
+
onChange?: (value?: number | null) => void;
|
10
|
+
[key: string]: any;
|
11
|
+
};
|
12
|
+
declare const McInputNumber: FC<McInputNumberProps>;
|
13
|
+
export default McInputNumber;
|
@@ -0,0 +1,43 @@
|
|
1
|
+
import _objectSpread from "@babel/runtime/helpers/esm/objectSpread2";
|
2
|
+
import _slicedToArray from "@babel/runtime/helpers/esm/slicedToArray";
|
3
|
+
import _objectWithoutProperties from "@babel/runtime/helpers/esm/objectWithoutProperties";
|
4
|
+
var _excluded = ["label", "precision", "value", "onChange", "className"];
|
5
|
+
import { InputNumber } from 'antd';
|
6
|
+
import { forwardRef, useEffect, useState } from 'react';
|
7
|
+
import "./index.css";
|
8
|
+
import { jsx as _jsx } from "react/jsx-runtime";
|
9
|
+
var McInputNumber = /*#__PURE__*/forwardRef(function (props, ref) {
|
10
|
+
var label = props.label,
|
11
|
+
_props$precision = props.precision,
|
12
|
+
precision = _props$precision === void 0 ? 0 : _props$precision,
|
13
|
+
value = props.value,
|
14
|
+
_onChange = props.onChange,
|
15
|
+
className = props.className,
|
16
|
+
rest = _objectWithoutProperties(props, _excluded);
|
17
|
+
var _useState = useState(null),
|
18
|
+
_useState2 = _slicedToArray(_useState, 2),
|
19
|
+
inputNumberValue = _useState2[0],
|
20
|
+
setInputNumberValue = _useState2[1];
|
21
|
+
useEffect(function () {
|
22
|
+
setInputNumberValue(typeof value === 'number' ? value : null);
|
23
|
+
}, [value]);
|
24
|
+
return /*#__PURE__*/_jsx(InputNumber, _objectSpread({
|
25
|
+
ref: ref,
|
26
|
+
className: "mc-input-number ".concat(className || ''),
|
27
|
+
prefix: label && /*#__PURE__*/_jsx("span", {
|
28
|
+
className: "mc-input-number__label",
|
29
|
+
children: label
|
30
|
+
}),
|
31
|
+
value: inputNumberValue,
|
32
|
+
onChange: function onChange(v) {
|
33
|
+
// 检查是否为数字,并格式化为最多保留precision位小数,否则清空
|
34
|
+
var _v = typeof v === 'number' ? parseFloat(v.toFixed(precision)) : null;
|
35
|
+
if (!props.hasOwnProperty('value')) {
|
36
|
+
setInputNumberValue(_v);
|
37
|
+
}
|
38
|
+
_onChange === null || _onChange === void 0 || _onChange(_v);
|
39
|
+
},
|
40
|
+
placeholder: "\u8BF7\u8F93\u5165"
|
41
|
+
}, rest));
|
42
|
+
});
|
43
|
+
export default McInputNumber;
|
@@ -0,0 +1,174 @@
|
|
1
|
+
import React, { ReactNode } from 'react';
|
2
|
+
export interface McModalState {
|
3
|
+
id: string;
|
4
|
+
args?: Record<string, unknown>;
|
5
|
+
visible?: boolean;
|
6
|
+
delayVisible?: boolean;
|
7
|
+
keepMounted?: boolean;
|
8
|
+
}
|
9
|
+
export interface McModalStore {
|
10
|
+
[key: string]: McModalState;
|
11
|
+
}
|
12
|
+
export interface McModalAction {
|
13
|
+
type: string;
|
14
|
+
payload: {
|
15
|
+
modalId: string;
|
16
|
+
args?: Record<string, unknown>;
|
17
|
+
flags?: Record<string, unknown>;
|
18
|
+
};
|
19
|
+
}
|
20
|
+
/**
|
21
|
+
* The handler to manage a modal returned by {@link useModal | useModal} hook.
|
22
|
+
*/
|
23
|
+
export interface McModalHandler<Props = Record<string, unknown>> extends McModalState {
|
24
|
+
/**
|
25
|
+
* Whether a modal is visible, it's controlled by {@link McModalHandler.show | show}/{@link McModalHandler.hide | hide} method.
|
26
|
+
*/
|
27
|
+
visible: boolean;
|
28
|
+
/**
|
29
|
+
* If you don't want to remove the modal from the tree after hide when using helpers, set it to true.
|
30
|
+
*/
|
31
|
+
keepMounted: boolean;
|
32
|
+
/**
|
33
|
+
* Show the modal, it will change {@link McModalHandler.visible | visible} state to true.
|
34
|
+
* @param args - an object passed to modal component as props.
|
35
|
+
*/
|
36
|
+
show: (args?: Props) => Promise<unknown>;
|
37
|
+
/**
|
38
|
+
* Hide the modal, it will change {@link McModalHandler.visible | visible} state to false.
|
39
|
+
*/
|
40
|
+
hide: () => Promise<unknown>;
|
41
|
+
/**
|
42
|
+
* Resolve the promise returned by {@link McModalHandler.show | show} method.
|
43
|
+
*/
|
44
|
+
resolve: (args?: unknown) => void;
|
45
|
+
/**
|
46
|
+
* Reject the promise returned by {@link McModalHandler.show | show} method.
|
47
|
+
*/
|
48
|
+
reject: (args?: unknown) => void;
|
49
|
+
/**
|
50
|
+
* Remove the modal component from React component tree. It improves performance compared to just making a modal invisible.
|
51
|
+
*/
|
52
|
+
remove: () => void;
|
53
|
+
/**
|
54
|
+
* Resolve the promise returned by {@link McModalHandler.hide | hide} method.
|
55
|
+
*/
|
56
|
+
resolveHide: (args?: unknown) => void;
|
57
|
+
}
|
58
|
+
export interface McModalHocProps {
|
59
|
+
id: string;
|
60
|
+
defaultVisible?: boolean;
|
61
|
+
keepMounted?: boolean;
|
62
|
+
}
|
63
|
+
export declare const McModalContext: React.Context<McModalStore>;
|
64
|
+
declare let dispatch: React.Dispatch<McModalAction>;
|
65
|
+
export declare const reducer: (state: McModalStore | undefined, action: McModalAction) => McModalStore;
|
66
|
+
declare function getModal(modalId: string): React.FC<any> | undefined;
|
67
|
+
export declare const register: <T extends React.FC<any>>(id: string, comp: T, props?: Partial<McModalArgs<T>> | undefined) => void;
|
68
|
+
type McModalArgs<T> = T extends keyof JSX.IntrinsicElements | React.JSXElementConstructor<any> ? React.ComponentProps<T> : Record<string, unknown>;
|
69
|
+
export declare function show<T extends any, C extends any, P extends Partial<McModalArgs<React.FC<C>>>>(modal: React.FC<C>, args?: P): Promise<T>;
|
70
|
+
export declare function show<T extends any>(modal: string, args?: Record<string, unknown>): Promise<T>;
|
71
|
+
export declare function show<T extends any, P extends any>(modal: string, args: P): Promise<T>;
|
72
|
+
export declare function hide<T>(modal: string | React.FC<any>): Promise<T>;
|
73
|
+
export declare const remove: (modal: string | React.FC<any>) => void;
|
74
|
+
export declare function useModal(): McModalHandler;
|
75
|
+
export declare function useModal(modal: string, args?: Record<string, unknown>): McModalHandler;
|
76
|
+
export declare function useModal<C extends any, P extends Partial<McModalArgs<React.FC<C>>>>(modal: React.FC<C>, args?: P): Omit<McModalHandler, 'show'> & {
|
77
|
+
show: (args?: P) => Promise<unknown>;
|
78
|
+
};
|
79
|
+
export declare const create: <P extends {}>(Comp: React.ComponentType<P>) => React.FC<P & McModalHocProps>;
|
80
|
+
/**
|
81
|
+
* Unregister a modal.
|
82
|
+
* @param id - The id of the modal.
|
83
|
+
*/
|
84
|
+
export declare const unregister: (id: string) => void;
|
85
|
+
export declare const Provider: ({ children, dispatch: givenDispatch, modals: givenModals, }: {
|
86
|
+
children: ReactNode;
|
87
|
+
dispatch?: React.Dispatch<McModalAction> | undefined;
|
88
|
+
modals?: McModalStore | undefined;
|
89
|
+
}) => import("react/jsx-runtime").JSX.Element;
|
90
|
+
/**
|
91
|
+
* Declarative way to register a modal.
|
92
|
+
* @param id - The id of the modal.
|
93
|
+
* @param component - The modal Component.
|
94
|
+
* @returns
|
95
|
+
*/
|
96
|
+
export declare const ModalDef: ({ id, component, }: {
|
97
|
+
id: string;
|
98
|
+
component: React.FC<any>;
|
99
|
+
}) => null;
|
100
|
+
/**
|
101
|
+
* A place holder allows to bind props to a modal.
|
102
|
+
* It assigns show/hide methods to handler object to show/hide the modal.
|
103
|
+
*
|
104
|
+
* Comparing to use the <MyMcModal id=../> directly, this approach allows use registered modal id to find the modal component.
|
105
|
+
* Also it avoids to create unique id for MyMcModal.
|
106
|
+
*
|
107
|
+
* @param modal - The modal id registered or a modal component.
|
108
|
+
* @param handler - The handler object to control the modal.
|
109
|
+
* @returns
|
110
|
+
*/
|
111
|
+
export declare const ModalHolder: ({ modal, handler, ...restProps }: {
|
112
|
+
[key: string]: any;
|
113
|
+
modal: string | React.FC<any>;
|
114
|
+
handler: any;
|
115
|
+
}) => import("react/jsx-runtime").JSX.Element;
|
116
|
+
export declare const antdModalV4: (modal: McModalHandler) => {
|
117
|
+
visible: boolean;
|
118
|
+
onCancel: () => void;
|
119
|
+
onOk: () => void;
|
120
|
+
afterClose: () => void;
|
121
|
+
};
|
122
|
+
export declare const antdModal: (modal: McModalHandler) => {
|
123
|
+
open: boolean;
|
124
|
+
onCancel: () => void;
|
125
|
+
onOk: () => void;
|
126
|
+
afterClose: () => void;
|
127
|
+
};
|
128
|
+
export declare const antdDrawerV4: (modal: McModalHandler) => {
|
129
|
+
visible: boolean;
|
130
|
+
onClose: () => void;
|
131
|
+
afterVisibleChange: (visible: boolean) => void;
|
132
|
+
};
|
133
|
+
export declare const antdDrawer: (modal: McModalHandler) => {
|
134
|
+
open: boolean;
|
135
|
+
onClose: () => void;
|
136
|
+
afterOpenChange: (visible: boolean) => void;
|
137
|
+
};
|
138
|
+
declare const McModal: {
|
139
|
+
Provider: ({ children, dispatch: givenDispatch, modals: givenModals, }: {
|
140
|
+
children: ReactNode;
|
141
|
+
dispatch?: React.Dispatch<McModalAction> | undefined;
|
142
|
+
modals?: McModalStore | undefined;
|
143
|
+
}) => import("react/jsx-runtime").JSX.Element;
|
144
|
+
ModalDef: ({ id, component, }: {
|
145
|
+
id: string;
|
146
|
+
component: React.FC<any>;
|
147
|
+
}) => null;
|
148
|
+
ModalHolder: ({ modal, handler, ...restProps }: {
|
149
|
+
[key: string]: any;
|
150
|
+
modal: string | React.FC<any>;
|
151
|
+
handler: any;
|
152
|
+
}) => import("react/jsx-runtime").JSX.Element;
|
153
|
+
McModalContext: React.Context<McModalStore>;
|
154
|
+
create: <P extends {}>(Comp: React.ComponentType<P>) => React.FC<P & McModalHocProps>;
|
155
|
+
register: <T extends React.FC<any>>(id: string, comp: T, props?: Partial<McModalArgs<T>> | undefined) => void;
|
156
|
+
getModal: typeof getModal;
|
157
|
+
show: typeof show;
|
158
|
+
hide: typeof hide;
|
159
|
+
remove: (modal: string | React.FC<any>) => void;
|
160
|
+
useModal: typeof useModal;
|
161
|
+
reducer: (state: McModalStore | undefined, action: McModalAction) => McModalStore;
|
162
|
+
antdModal: (modal: McModalHandler) => {
|
163
|
+
open: boolean;
|
164
|
+
onCancel: () => void;
|
165
|
+
onOk: () => void;
|
166
|
+
afterClose: () => void;
|
167
|
+
};
|
168
|
+
antdDrawer: (modal: McModalHandler) => {
|
169
|
+
open: boolean;
|
170
|
+
onClose: () => void;
|
171
|
+
afterOpenChange: (visible: boolean) => void;
|
172
|
+
};
|
173
|
+
};
|
174
|
+
export default McModal;
|