@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,79 @@
|
|
1
|
+
import _slicedToArray from "@babel/runtime/helpers/esm/slicedToArray";
|
2
|
+
/**
|
3
|
+
* title: 显示不存在
|
4
|
+
*/
|
5
|
+
import { Space } from 'antd';
|
6
|
+
import { McSelect } from "../..";
|
7
|
+
import { useState } from 'react';
|
8
|
+
import { jsx as _jsx } from "react/jsx-runtime";
|
9
|
+
import { jsxs as _jsxs } from "react/jsx-runtime";
|
10
|
+
export default (function () {
|
11
|
+
var _useState = useState(['1']),
|
12
|
+
_useState2 = _slicedToArray(_useState, 2),
|
13
|
+
value1 = _useState2[0],
|
14
|
+
setValue1 = _useState2[1];
|
15
|
+
return /*#__PURE__*/_jsxs(Space, {
|
16
|
+
wrap: true,
|
17
|
+
children: [/*#__PURE__*/_jsx(McSelect, {
|
18
|
+
value: value1,
|
19
|
+
onChange: setValue1,
|
20
|
+
inexistent: true,
|
21
|
+
options: [{
|
22
|
+
value: 'jack',
|
23
|
+
label: 'Jack'
|
24
|
+
}, {
|
25
|
+
value: 'lucy',
|
26
|
+
label: 'Lucy'
|
27
|
+
}, {
|
28
|
+
value: 'Yiminghe',
|
29
|
+
label: 'yiminghe'
|
30
|
+
}, {
|
31
|
+
value: 'disabled',
|
32
|
+
label: 'Disabled',
|
33
|
+
disabled: true
|
34
|
+
}]
|
35
|
+
}), /*#__PURE__*/_jsx(McSelect, {
|
36
|
+
value: value1,
|
37
|
+
onChange: setValue1,
|
38
|
+
inexistent: {
|
39
|
+
inexistentText: '已关闭'
|
40
|
+
},
|
41
|
+
options: [{
|
42
|
+
value: 'jack',
|
43
|
+
label: 'Jack'
|
44
|
+
}, {
|
45
|
+
value: 'lucy',
|
46
|
+
label: 'Lucy'
|
47
|
+
}, {
|
48
|
+
value: 'Yiminghe',
|
49
|
+
label: 'yiminghe'
|
50
|
+
}, {
|
51
|
+
value: 'disabled',
|
52
|
+
label: 'Disabled',
|
53
|
+
disabled: true
|
54
|
+
}]
|
55
|
+
}), /*#__PURE__*/_jsx(McSelect, {
|
56
|
+
value: value1,
|
57
|
+
onChange: setValue1,
|
58
|
+
inexistent: {
|
59
|
+
inexistentColor: 'skyblue',
|
60
|
+
inexistentText: '已关闭',
|
61
|
+
reserveOriginalValue: true
|
62
|
+
},
|
63
|
+
options: [{
|
64
|
+
value: 'jack',
|
65
|
+
label: 'Jack'
|
66
|
+
}, {
|
67
|
+
value: 'lucy',
|
68
|
+
label: 'Lucy'
|
69
|
+
}, {
|
70
|
+
value: 'Yiminghe',
|
71
|
+
label: 'yiminghe'
|
72
|
+
}, {
|
73
|
+
value: 'disabled',
|
74
|
+
label: 'Disabled',
|
75
|
+
disabled: true
|
76
|
+
}]
|
77
|
+
})]
|
78
|
+
});
|
79
|
+
});
|
@@ -0,0 +1,72 @@
|
|
1
|
+
import _slicedToArray from "@babel/runtime/helpers/esm/slicedToArray";
|
2
|
+
/**
|
3
|
+
* title: value值为对象
|
4
|
+
*/
|
5
|
+
import { McSelect } from "../..";
|
6
|
+
import { useState } from 'react';
|
7
|
+
import { jsx as _jsx } from "react/jsx-runtime";
|
8
|
+
import { jsxs as _jsxs } from "react/jsx-runtime";
|
9
|
+
import { Fragment as _Fragment } from "react/jsx-runtime";
|
10
|
+
export default (function () {
|
11
|
+
var _useState = useState(),
|
12
|
+
_useState2 = _slicedToArray(_useState, 2),
|
13
|
+
value = _useState2[0],
|
14
|
+
setValue = _useState2[1];
|
15
|
+
var _useState3 = useState([]),
|
16
|
+
_useState4 = _slicedToArray(_useState3, 2),
|
17
|
+
allowCreateValue = _useState4[0],
|
18
|
+
setAllowCreateValue = _useState4[1];
|
19
|
+
var handleChange = function handleChange(value) {
|
20
|
+
setValue(value);
|
21
|
+
};
|
22
|
+
return /*#__PURE__*/_jsxs(_Fragment, {
|
23
|
+
children: [/*#__PURE__*/_jsx(McSelect, {
|
24
|
+
label: "\u5355\u9009",
|
25
|
+
labelInValue: true,
|
26
|
+
value: value,
|
27
|
+
style: {
|
28
|
+
width: 200
|
29
|
+
},
|
30
|
+
options: [{
|
31
|
+
value: 'jack',
|
32
|
+
label: 'Jack'
|
33
|
+
}, {
|
34
|
+
value: 'lucy',
|
35
|
+
label: 'Lucy'
|
36
|
+
}, {
|
37
|
+
value: 'Yiminghe',
|
38
|
+
label: 'yiminghe'
|
39
|
+
}, {
|
40
|
+
value: 'disabled',
|
41
|
+
label: 'Disabled',
|
42
|
+
disabled: true
|
43
|
+
}],
|
44
|
+
onChange: handleChange
|
45
|
+
}), value && JSON.stringify(value), /*#__PURE__*/_jsx("br", {}), /*#__PURE__*/_jsxs("div", {
|
46
|
+
children: [/*#__PURE__*/_jsx(McSelect, {
|
47
|
+
label: "\u591A\u9009",
|
48
|
+
labelInValue: true,
|
49
|
+
value: allowCreateValue,
|
50
|
+
style: {
|
51
|
+
width: 200
|
52
|
+
},
|
53
|
+
options: [{
|
54
|
+
value: 'jack',
|
55
|
+
label: 'Jack'
|
56
|
+
}, {
|
57
|
+
value: 'lucy',
|
58
|
+
label: 'Lucy'
|
59
|
+
}, {
|
60
|
+
value: 'Yiminghe',
|
61
|
+
label: 'yiminghe'
|
62
|
+
}, {
|
63
|
+
value: 'disabled',
|
64
|
+
label: 'Disabled',
|
65
|
+
disabled: true
|
66
|
+
}],
|
67
|
+
onChange: setAllowCreateValue,
|
68
|
+
multiple: true
|
69
|
+
}), (allowCreateValue === null || allowCreateValue === void 0 ? void 0 : allowCreateValue.length) > 0 && JSON.stringify(allowCreateValue)]
|
70
|
+
})]
|
71
|
+
});
|
72
|
+
});
|
@@ -0,0 +1,51 @@
|
|
1
|
+
/**
|
2
|
+
* title: 多选时显示tag的个数
|
3
|
+
* description: 多选下通过响应式布局让选项自动收缩。该功能对性能有所消耗,不推荐在大表单场景下使用。
|
4
|
+
*/
|
5
|
+
|
6
|
+
import { Tag } from 'antd';
|
7
|
+
import { McSelect } from "../..";
|
8
|
+
import React from 'react';
|
9
|
+
import { jsx as _jsx } from "react/jsx-runtime";
|
10
|
+
var options = [{
|
11
|
+
value: 'gold'
|
12
|
+
}, {
|
13
|
+
value: 'lime'
|
14
|
+
}, {
|
15
|
+
value: 'green'
|
16
|
+
}, {
|
17
|
+
value: 'cyan'
|
18
|
+
}];
|
19
|
+
var tagRender = function tagRender(props) {
|
20
|
+
var label = props.label,
|
21
|
+
value = props.value,
|
22
|
+
closable = props.closable,
|
23
|
+
onClose = props.onClose;
|
24
|
+
var onPreventMouseDown = function onPreventMouseDown(event) {
|
25
|
+
event.preventDefault();
|
26
|
+
event.stopPropagation();
|
27
|
+
};
|
28
|
+
return /*#__PURE__*/_jsx(Tag, {
|
29
|
+
color: value,
|
30
|
+
onMouseDown: onPreventMouseDown,
|
31
|
+
closable: closable,
|
32
|
+
onClose: onClose,
|
33
|
+
style: {
|
34
|
+
marginInlineEnd: 4
|
35
|
+
},
|
36
|
+
children: label
|
37
|
+
});
|
38
|
+
};
|
39
|
+
var App = function App() {
|
40
|
+
return /*#__PURE__*/_jsx(McSelect, {
|
41
|
+
multiple: true,
|
42
|
+
maxTagCount: undefined,
|
43
|
+
tagRender: tagRender,
|
44
|
+
defaultValue: ['gold', 'cyan'],
|
45
|
+
style: {
|
46
|
+
width: '100%'
|
47
|
+
},
|
48
|
+
options: options
|
49
|
+
});
|
50
|
+
};
|
51
|
+
export default App;
|
@@ -0,0 +1,46 @@
|
|
1
|
+
/**
|
2
|
+
* title: 多选
|
3
|
+
* description: 与antd的不同:属性不同McSelect多选使用multiple属性,且不再支持mode属性
|
4
|
+
*/
|
5
|
+
import { Space } from 'antd';
|
6
|
+
import { McSelect } 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
|
+
wrap: true,
|
12
|
+
children: [/*#__PURE__*/_jsx(McSelect, {
|
13
|
+
defaultValue: "lucy",
|
14
|
+
style: {
|
15
|
+
width: 120
|
16
|
+
},
|
17
|
+
maxCount: 2,
|
18
|
+
options: [{
|
19
|
+
value: 'jack',
|
20
|
+
label: 'Jack'
|
21
|
+
}, {
|
22
|
+
value: 'lucy',
|
23
|
+
label: 'Lucy'
|
24
|
+
}, {
|
25
|
+
value: 'Yiminghe',
|
26
|
+
label: 'yiminghe'
|
27
|
+
}, {
|
28
|
+
value: 'disabled',
|
29
|
+
label: 'Disabled',
|
30
|
+
disabled: true
|
31
|
+
}],
|
32
|
+
multiple: true
|
33
|
+
}), /*#__PURE__*/_jsx(McSelect, {
|
34
|
+
defaultValue: "lucy",
|
35
|
+
style: {
|
36
|
+
width: 120
|
37
|
+
},
|
38
|
+
loading: true,
|
39
|
+
options: [{
|
40
|
+
value: 'lucy',
|
41
|
+
label: 'Lucy'
|
42
|
+
}],
|
43
|
+
multiple: true
|
44
|
+
})]
|
45
|
+
});
|
46
|
+
});
|
@@ -0,0 +1,51 @@
|
|
1
|
+
/**
|
2
|
+
* title: 自定义下拉选项
|
3
|
+
* description: 使用 `optionRender` 自定义渲染下拉选项。
|
4
|
+
*/
|
5
|
+
import { Space } from 'antd';
|
6
|
+
import { McSelect } from "../..";
|
7
|
+
import React from 'react';
|
8
|
+
import { jsx as _jsx } from "react/jsx-runtime";
|
9
|
+
import { jsxs as _jsxs } from "react/jsx-runtime";
|
10
|
+
var options = [{
|
11
|
+
label: 'China',
|
12
|
+
value: 'china',
|
13
|
+
emoji: '🇨🇳',
|
14
|
+
desc: 'China (中国)'
|
15
|
+
}, {
|
16
|
+
label: 'USA',
|
17
|
+
value: 'usa',
|
18
|
+
emoji: '🇺🇸',
|
19
|
+
desc: 'USA (美国)'
|
20
|
+
}, {
|
21
|
+
label: 'Japan',
|
22
|
+
value: 'japan',
|
23
|
+
emoji: '🇯🇵',
|
24
|
+
desc: 'Japan (日本)'
|
25
|
+
}, {
|
26
|
+
label: 'Korea',
|
27
|
+
value: 'korea',
|
28
|
+
emoji: '🇰🇷',
|
29
|
+
desc: 'Korea (韩国)'
|
30
|
+
}];
|
31
|
+
var App = function App() {
|
32
|
+
return /*#__PURE__*/_jsx(McSelect, {
|
33
|
+
multiple: true,
|
34
|
+
style: {
|
35
|
+
width: '100%'
|
36
|
+
},
|
37
|
+
placeholder: "select one country",
|
38
|
+
defaultValue: ['china'],
|
39
|
+
options: options,
|
40
|
+
optionRender: function optionRender(option) {
|
41
|
+
return /*#__PURE__*/_jsxs(Space, {
|
42
|
+
children: [/*#__PURE__*/_jsx("span", {
|
43
|
+
role: "img",
|
44
|
+
"aria-label": option.data.label,
|
45
|
+
children: option.data.emoji
|
46
|
+
}), option.data.desc]
|
47
|
+
});
|
48
|
+
}
|
49
|
+
});
|
50
|
+
};
|
51
|
+
export default App;
|
@@ -0,0 +1,51 @@
|
|
1
|
+
/**
|
2
|
+
* title: 自定义选择标签
|
3
|
+
* description: 允许自定义选择标签的样式。
|
4
|
+
*/
|
5
|
+
|
6
|
+
import { Tag } from 'antd';
|
7
|
+
import { McSelect } from "../..";
|
8
|
+
import React from 'react';
|
9
|
+
import { jsx as _jsx } from "react/jsx-runtime";
|
10
|
+
var options = [{
|
11
|
+
value: 'gold'
|
12
|
+
}, {
|
13
|
+
value: 'lime'
|
14
|
+
}, {
|
15
|
+
value: 'green'
|
16
|
+
}, {
|
17
|
+
value: 'cyan'
|
18
|
+
}];
|
19
|
+
var tagRender = function tagRender(props) {
|
20
|
+
var label = props.label,
|
21
|
+
value = props.value,
|
22
|
+
closable = props.closable,
|
23
|
+
onClose = props.onClose;
|
24
|
+
var onPreventMouseDown = function onPreventMouseDown(event) {
|
25
|
+
event.preventDefault();
|
26
|
+
event.stopPropagation();
|
27
|
+
};
|
28
|
+
return /*#__PURE__*/_jsx(Tag, {
|
29
|
+
color: value,
|
30
|
+
onMouseDown: onPreventMouseDown,
|
31
|
+
closable: closable,
|
32
|
+
onClose: onClose,
|
33
|
+
style: {
|
34
|
+
marginInlineEnd: 4
|
35
|
+
},
|
36
|
+
children: label
|
37
|
+
});
|
38
|
+
};
|
39
|
+
var App = function App() {
|
40
|
+
return /*#__PURE__*/_jsx(McSelect, {
|
41
|
+
multiple: true,
|
42
|
+
maxTagCount: undefined,
|
43
|
+
tagRender: tagRender,
|
44
|
+
defaultValue: ['gold', 'cyan'],
|
45
|
+
style: {
|
46
|
+
width: '100%'
|
47
|
+
},
|
48
|
+
options: options
|
49
|
+
});
|
50
|
+
};
|
51
|
+
export default App;
|
@@ -0,0 +1,60 @@
|
|
1
|
+
.mc-select__label {
|
2
|
+
color: #262626;
|
3
|
+
font-size: 14px;
|
4
|
+
position: absolute;
|
5
|
+
top: 0;
|
6
|
+
left: 11px;
|
7
|
+
z-index: 2;
|
8
|
+
height: 100%;
|
9
|
+
display: -webkit-box;
|
10
|
+
display: -ms-flexbox;
|
11
|
+
display: flex;
|
12
|
+
-webkit-box-align: center;
|
13
|
+
-ms-flex-align: center;
|
14
|
+
align-items: center;
|
15
|
+
}
|
16
|
+
.mc-select__label::after {
|
17
|
+
content: ':';
|
18
|
+
margin-left: 2px;
|
19
|
+
}
|
20
|
+
.mc-select__label.mc-select--disabled {
|
21
|
+
color: rgba(0, 0, 0, 0.25);
|
22
|
+
cursor: no-drop;
|
23
|
+
}
|
24
|
+
.mc-select__content {
|
25
|
+
width: 100%;
|
26
|
+
height: 100%;
|
27
|
+
}
|
28
|
+
.mc-select__content.ant-select .ant-select-selector {
|
29
|
+
padding-left: var(--selector-pl);
|
30
|
+
}
|
31
|
+
.mc-select__content.ant-select .ant-select-selector .ant-select-selection-overflow-item-rest .ant-select-selection-item {
|
32
|
+
color: #fff;
|
33
|
+
background: #325cf7;
|
34
|
+
padding-left: 4px;
|
35
|
+
}
|
36
|
+
.mc-select__content.ant-select .ant-select-selector .ant-select-selection-overflow-item-rest .ant-select-selection-item .ant-select-selection-item-content {
|
37
|
+
margin-right: 0;
|
38
|
+
}
|
39
|
+
.mc-select__content.ant-select .ant-select-selector .ant-select-selection-item[title*='「'][title$='」'] {
|
40
|
+
color: var(--inexistent-color);
|
41
|
+
}
|
42
|
+
.mc-select__content.ant-select.ant-select-single .ant-select-selector .ant-select-selection-search {
|
43
|
+
left: var(--selector-pl);
|
44
|
+
}
|
45
|
+
.mc-select__content.ant-select.ant-select-multiple .ant-select-selector .ant-select-selection-placeholder {
|
46
|
+
left: var(--selector-pl);
|
47
|
+
}
|
48
|
+
.mc-select__content.ant-select.ant-select-multiple .ant-select-selector .ant-select-selection-search {
|
49
|
+
margin-left: 0;
|
50
|
+
}
|
51
|
+
.mc-select.mc-select--inline .ant-select-selection-overflow-item:not(
|
52
|
+
.ant-select-selection-overflow-item-rest,
|
53
|
+
.ant-select-selection-overflow-item-suffix
|
54
|
+
) {
|
55
|
+
-webkit-box-flex: 1;
|
56
|
+
-ms-flex: 1;
|
57
|
+
flex: 1;
|
58
|
+
min-width: 0;
|
59
|
+
margin-right: 4px;
|
60
|
+
}
|
@@ -0,0 +1,40 @@
|
|
1
|
+
import { SelectProps } from 'antd';
|
2
|
+
import { CSSProperties, FC, ReactNode } from 'react';
|
3
|
+
import './index.less';
|
4
|
+
interface Option {
|
5
|
+
value: string | number;
|
6
|
+
label?: React.ReactNode;
|
7
|
+
title?: string;
|
8
|
+
disabled?: boolean;
|
9
|
+
[key: string]: any;
|
10
|
+
}
|
11
|
+
type Inexistent = {
|
12
|
+
inexistentText?: string;
|
13
|
+
inexistentColor?: string;
|
14
|
+
reserveOriginalValue?: boolean;
|
15
|
+
};
|
16
|
+
export type FetchOptions = (params: {
|
17
|
+
current: number;
|
18
|
+
pageSize: number;
|
19
|
+
keyword?: string;
|
20
|
+
extra?: any;
|
21
|
+
}) => Promise<{
|
22
|
+
data: Option[];
|
23
|
+
total: number;
|
24
|
+
}>;
|
25
|
+
export type McSelectProps = Omit<SelectProps, 'mode' | 'fieldNames'> & {
|
26
|
+
style?: CSSProperties;
|
27
|
+
className?: string;
|
28
|
+
name?: string;
|
29
|
+
label?: ReactNode;
|
30
|
+
multiple?: boolean;
|
31
|
+
changeOnHidden?: boolean;
|
32
|
+
inexistent?: boolean | Inexistent;
|
33
|
+
fetchOptions?: FetchOptions;
|
34
|
+
pageSize?: number;
|
35
|
+
extra?: any;
|
36
|
+
options?: Option[];
|
37
|
+
[key: string]: any;
|
38
|
+
};
|
39
|
+
declare const McSelect: FC<McSelectProps>;
|
40
|
+
export default McSelect;
|