@zykj2024/much-library 1.0.9

Sign up to get free protection for your applications and to get access to all the features.
Files changed (207) hide show
  1. package/LICENSE +21 -0
  2. package/README.md +35 -0
  3. package/dist/McCascader/city.js +909 -0
  4. package/dist/McCascader/index.css +60 -0
  5. package/dist/McCascader/index.d.ts +19 -0
  6. package/dist/McCascader/index.js +221 -0
  7. package/dist/McContainer/demo/actionBar.d.ts +8 -0
  8. package/dist/McContainer/demo/actionBar.js +70 -0
  9. package/dist/McContainer/demo/base.d.ts +8 -0
  10. package/dist/McContainer/demo/base.js +80 -0
  11. package/dist/McContainer/demo/batch.d.ts +8 -0
  12. package/dist/McContainer/demo/batch.js +89 -0
  13. package/dist/McContainer/demo/collapse.d.ts +8 -0
  14. package/dist/McContainer/demo/collapse.js +76 -0
  15. package/dist/McContainer/demo/expand.d.ts +8 -0
  16. package/dist/McContainer/demo/expand.js +90 -0
  17. package/dist/McContainer/demo/pagination.d.ts +7 -0
  18. package/dist/McContainer/demo/pagination.js +93 -0
  19. package/dist/McContainer/demo/search.d.ts +7 -0
  20. package/dist/McContainer/demo/search.js +101 -0
  21. package/dist/McContainer/demo/standard.d.ts +7 -0
  22. package/dist/McContainer/demo/standard.js +168 -0
  23. package/dist/McContainer/index.css +123 -0
  24. package/dist/McContainer/index.d.ts +49 -0
  25. package/dist/McContainer/index.js +407 -0
  26. package/dist/McDateRange/demo/base.d.ts +6 -0
  27. package/dist/McDateRange/demo/base.js +22 -0
  28. package/dist/McDateRange/demo/cancelPresets.d.ts +6 -0
  29. package/dist/McDateRange/demo/cancelPresets.js +23 -0
  30. package/dist/McDateRange/demo/overlap.d.ts +2 -0
  31. package/dist/McDateRange/demo/overlap.js +32 -0
  32. package/dist/McDateRange/index.css +31 -0
  33. package/dist/McDateRange/index.d.ts +28 -0
  34. package/dist/McDateRange/index.js +167 -0
  35. package/dist/McFonts/index.d.ts +7 -0
  36. package/dist/McFonts/index.js +10 -0
  37. package/dist/McFonts/public/FF DIN Pro Bold.otf +0 -0
  38. package/dist/McFonts/public/SourceHanSansCN-Bold.otf +0 -0
  39. package/dist/McFonts/public/SourceHanSansCN-Light.otf +0 -0
  40. package/dist/McFonts/public/SourceHanSansCN-Medium.otf +0 -0
  41. package/dist/McFonts/public/SourceHanSansCN-Regular.otf +0 -0
  42. package/dist/McGroupPanel/comps/SelectedItem/index.d.ts +4 -0
  43. package/dist/McGroupPanel/comps/SelectedItem/index.js +76 -0
  44. package/dist/McGroupPanel/index.css +162 -0
  45. package/dist/McGroupPanel/index.d.ts +29 -0
  46. package/dist/McGroupPanel/index.js +411 -0
  47. package/dist/McIconFont/iconfont.js +1 -0
  48. package/dist/McIconFont/index.d.ts +5 -0
  49. package/dist/McIconFont/index.js +8 -0
  50. package/dist/McIcons/business.json +137 -0
  51. package/dist/McInput/Input.d.ts +19 -0
  52. package/dist/McInput/Input.js +48 -0
  53. package/dist/McInput/Search.d.ts +39 -0
  54. package/dist/McInput/Search.js +81 -0
  55. package/dist/McInput/TextArea.d.ts +11 -0
  56. package/dist/McInput/TextArea.js +37 -0
  57. package/dist/McInput/demo/Input/addonBefore.d.ts +3 -0
  58. package/dist/McInput/demo/Input/addonBefore.js +67 -0
  59. package/dist/McInput/demo/Input/base.d.ts +2 -0
  60. package/dist/McInput/demo/Input/base.js +31 -0
  61. package/dist/McInput/demo/Input/isTrim.d.ts +2 -0
  62. package/dist/McInput/demo/Input/isTrim.js +22 -0
  63. package/dist/McInput/demo/Input/label.d.ts +2 -0
  64. package/dist/McInput/demo/Input/label.js +26 -0
  65. package/dist/McInput/demo/Input/ref.d.ts +3 -0
  66. package/dist/McInput/demo/Input/ref.js +53 -0
  67. package/dist/McInput/demo/Input/status.d.ts +2 -0
  68. package/dist/McInput/demo/Input/status.js +23 -0
  69. package/dist/McInput/demo/Search/search-base.d.ts +2 -0
  70. package/dist/McInput/demo/Search/search-base.js +38 -0
  71. package/dist/McInput/demo/TextArea/text-area-base.d.ts +2 -0
  72. package/dist/McInput/demo/TextArea/text-area-base.js +38 -0
  73. package/dist/McInput/index.css +44 -0
  74. package/dist/McInput/index.d.ts +13 -0
  75. package/dist/McInput/index.js +7 -0
  76. package/dist/McInputNumber/demo/index.d.ts +2 -0
  77. package/dist/McInputNumber/demo/index.js +28 -0
  78. package/dist/McInputNumber/demo/label.d.ts +2 -0
  79. package/dist/McInputNumber/demo/label.js +26 -0
  80. package/dist/McInputNumber/demo/precision.d.ts +2 -0
  81. package/dist/McInputNumber/demo/precision.js +20 -0
  82. package/dist/McInputNumber/index.css +9 -0
  83. package/dist/McInputNumber/index.d.ts +13 -0
  84. package/dist/McInputNumber/index.js +43 -0
  85. package/dist/McModalProvider/index.d.ts +174 -0
  86. package/dist/McModalProvider/index.js +498 -0
  87. package/dist/McPeriodSelect/demo/base.d.ts +6 -0
  88. package/dist/McPeriodSelect/demo/base.js +19 -0
  89. package/dist/McPeriodSelect/demo/half.d.ts +6 -0
  90. package/dist/McPeriodSelect/demo/half.js +20 -0
  91. package/dist/McPeriodSelect/index.css +189 -0
  92. package/dist/McPeriodSelect/index.d.ts +13 -0
  93. package/dist/McPeriodSelect/index.js +305 -0
  94. package/dist/McPopoverButton/index.d.ts +14 -0
  95. package/dist/McPopoverButton/index.js +52 -0
  96. package/dist/McPopoverForm/index.d.ts +14 -0
  97. package/dist/McPopoverForm/index.js +95 -0
  98. package/dist/McResult/default.d.ts +1 -0
  99. package/dist/McResult/default.js +84 -0
  100. package/dist/McResult/demo/403.d.ts +6 -0
  101. package/dist/McResult/demo/403.js +17 -0
  102. package/dist/McResult/demo/404.d.ts +6 -0
  103. package/dist/McResult/demo/404.js +17 -0
  104. package/dist/McResult/demo/500.d.ts +6 -0
  105. package/dist/McResult/demo/500.js +17 -0
  106. package/dist/McResult/demo/building.d.ts +6 -0
  107. package/dist/McResult/demo/building.js +12 -0
  108. package/dist/McResult/demo/empty.d.ts +2 -0
  109. package/dist/McResult/demo/empty.js +11 -0
  110. package/dist/McResult/demo/noFunction.d.ts +2 -0
  111. package/dist/McResult/demo/noFunction.js +11 -0
  112. package/dist/McResult/demo/noUser.d.ts +6 -0
  113. package/dist/McResult/demo/noUser.js +12 -0
  114. package/dist/McResult/demo/preview.d.ts +2 -0
  115. package/dist/McResult/demo/preview.js +14 -0
  116. package/dist/McResult/icon.d.ts +25 -0
  117. package/dist/McResult/icon.js +946 -0
  118. package/dist/McResult/index.css +20 -0
  119. package/dist/McResult/index.d.ts +27 -0
  120. package/dist/McResult/index.js +103 -0
  121. package/dist/McResult/public/403.svg +164 -0
  122. package/dist/McResult/public/404.svg +123 -0
  123. package/dist/McResult/public/500.svg +129 -0
  124. package/dist/McResult/public/building.svg +127 -0
  125. package/dist/McResult/public/code403.svg +7 -0
  126. package/dist/McResult/public/code404.svg +5 -0
  127. package/dist/McResult/public/code500.svg +5 -0
  128. package/dist/McResult/public/empty.svg +1 -0
  129. package/dist/McResult/public/noFunction.svg +1 -0
  130. package/dist/McResult/public/noUser.svg +90 -0
  131. package/dist/McSelect/demo/base.d.ts +2 -0
  132. package/dist/McSelect/demo/base.js +63 -0
  133. package/dist/McSelect/demo/changeOnHidden.d.ts +2 -0
  134. package/dist/McSelect/demo/changeOnHidden.js +43 -0
  135. package/dist/McSelect/demo/dropdownRender.d.ts +7 -0
  136. package/dist/McSelect/demo/dropdownRender.js +78 -0
  137. package/dist/McSelect/demo/fetchOptions.d.ts +7 -0
  138. package/dist/McSelect/demo/fetchOptions.js +210 -0
  139. package/dist/McSelect/demo/inexistent.d.ts +2 -0
  140. package/dist/McSelect/demo/inexistent.js +79 -0
  141. package/dist/McSelect/demo/labelInValue.d.ts +2 -0
  142. package/dist/McSelect/demo/labelInValue.js +72 -0
  143. package/dist/McSelect/demo/maxTagCount.d.ts +3 -0
  144. package/dist/McSelect/demo/maxTagCount.js +51 -0
  145. package/dist/McSelect/demo/multiple.d.ts +2 -0
  146. package/dist/McSelect/demo/multiple.js +46 -0
  147. package/dist/McSelect/demo/optionRender.d.ts +3 -0
  148. package/dist/McSelect/demo/optionRender.js +51 -0
  149. package/dist/McSelect/demo/tagRender.d.ts +3 -0
  150. package/dist/McSelect/demo/tagRender.js +51 -0
  151. package/dist/McSelect/index.css +60 -0
  152. package/dist/McSelect/index.d.ts +40 -0
  153. package/dist/McSelect/index.js +350 -0
  154. package/dist/McThemeConfig/customToken.json +38 -0
  155. package/dist/McThemeConfig/demo/button.d.ts +2 -0
  156. package/dist/McThemeConfig/demo/button.js +226 -0
  157. package/dist/McThemeConfig/demo/drawer.d.ts +2 -0
  158. package/dist/McThemeConfig/demo/drawer.js +59 -0
  159. package/dist/McThemeConfig/demo/modal.d.ts +2 -0
  160. package/dist/McThemeConfig/demo/modal.js +78 -0
  161. package/dist/McThemeConfig/demo/radio.d.ts +2 -0
  162. package/dist/McThemeConfig/demo/radio.js +97 -0
  163. package/dist/McThemeConfig/demo/switch.d.ts +2 -0
  164. package/dist/McThemeConfig/demo/switch.js +96 -0
  165. package/dist/McThemeConfig/demo/tabs.d.ts +2 -0
  166. package/dist/McThemeConfig/demo/tabs.js +35 -0
  167. package/dist/McThemeConfig/globalStyle.d.ts +2 -0
  168. package/dist/McThemeConfig/globalStyle.js +172 -0
  169. package/dist/McThemeConfig/index.d.ts +9 -0
  170. package/dist/McThemeConfig/index.js +16 -0
  171. package/dist/McThemeConfig/layoutStyle.d.ts +2 -0
  172. package/dist/McThemeConfig/layoutStyle.js +1 -0
  173. package/dist/McThemeConfig/provider.d.ts +7 -0
  174. package/dist/McThemeConfig/provider.js +19 -0
  175. package/dist/McThemeConfig/themeToken.json +149 -0
  176. package/dist/McTreePanel/SelectedItem.d.ts +4 -0
  177. package/dist/McTreePanel/SelectedItem.js +75 -0
  178. package/dist/McTreePanel/demo/base.d.ts +6 -0
  179. package/dist/McTreePanel/demo/base.js +45 -0
  180. package/dist/McTreePanel/demo/fieldNames.d.ts +6 -0
  181. package/dist/McTreePanel/demo/fieldNames.js +37 -0
  182. package/dist/McTreePanel/demo/inexistent.d.ts +6 -0
  183. package/dist/McTreePanel/demo/inexistent.js +56 -0
  184. package/dist/McTreePanel/demo/labelInValue.d.ts +6 -0
  185. package/dist/McTreePanel/demo/labelInValue.js +56 -0
  186. package/dist/McTreePanel/demo/sortable.d.ts +6 -0
  187. package/dist/McTreePanel/demo/sortable.js +34 -0
  188. package/dist/McTreePanel/index.css +110 -0
  189. package/dist/McTreePanel/index.d.ts +27 -0
  190. package/dist/McTreePanel/index.js +315 -0
  191. package/dist/McTreeSelect/demo/base.d.ts +5 -0
  192. package/dist/McTreeSelect/demo/base.js +58 -0
  193. package/dist/McTreeSelect/demo/inexistent.d.ts +5 -0
  194. package/dist/McTreeSelect/demo/inexistent.js +63 -0
  195. package/dist/McTreeSelect/demo/label.d.ts +5 -0
  196. package/dist/McTreeSelect/demo/label.js +60 -0
  197. package/dist/McTreeSelect/demo/multiple.d.ts +5 -0
  198. package/dist/McTreeSelect/demo/multiple.js +71 -0
  199. package/dist/McTreeSelect/index.css +60 -0
  200. package/dist/McTreeSelect/index.d.ts +13 -0
  201. package/dist/McTreeSelect/index.js +182 -0
  202. package/dist/Utils/index.d.ts +4 -0
  203. package/dist/Utils/index.js +26 -0
  204. package/dist/index.d.ts +19 -0
  205. package/dist/index.js +19 -0
  206. package/dist/typings.d.ts +20 -0
  207. package/package.json +82 -0
@@ -0,0 +1,5 @@
1
+ import { IconFontProps } from 'much-icons/lib/components/IconFont';
2
+ import { FC } from 'react';
3
+ import './iconfont.js';
4
+ declare const McIconFont: FC<IconFontProps>;
5
+ export default McIconFont;
@@ -0,0 +1,8 @@
1
+ import { createFromIconfontCN } from 'much-icons';
2
+ import "./iconfont.js";
3
+
4
+ // iconfont 图标库:https://www.iconfont.cn/manage/index?manage_type=myprojects&projectId=4602078
5
+ var McIconFont = createFromIconfontCN({
6
+ scriptUrl: ''
7
+ });
8
+ export default McIconFont;
@@ -0,0 +1,137 @@
1
+ {
2
+ "Outlined/Basic": [
3
+ "ArrowLeftOutlined",
4
+ "ArrowRightOutlined",
5
+ "DoubleLeftOutlined",
6
+ "DoubleRightOutlined",
7
+ "DoubleUpOutlined",
8
+ "DoubleDownOutlined",
9
+ "LeftOutlined",
10
+ "RightOutlined",
11
+ "UpOutlined",
12
+ "DownOutlined",
13
+ "CaretLeftOutlined",
14
+ "CaretRightOutlined",
15
+ "CaretUpOutlined",
16
+ "CaretDownOutlined",
17
+ "SortOutlined",
18
+ "SwapOutlined",
19
+ "ArrowsAltOutlined",
20
+ "ShrinkOutlined",
21
+ "HamburgerOutlined",
22
+ "MoveOutlined",
23
+ "CalendarOutlined",
24
+ "InfoCircleOutlined",
25
+ "ExclamationCircleOutlined",
26
+ "QuestionCircleOutlined",
27
+ "CheckCircleOutlined",
28
+ "CloseCircleOutlined",
29
+ "AccountOutlined",
30
+ "PasswordOutlined",
31
+ "VerificationOutlined",
32
+ "InvisibleOutlined",
33
+ "VisibleOutlined",
34
+ "AnchorPointOutlined"
35
+ ],
36
+ "Outlined/Action": [
37
+ "EnterOutlined",
38
+ "ReloadOutlined",
39
+ "AddOutlined",
40
+ "SearchOutlined",
41
+ "CheckOutlined",
42
+ "CloseOutlined",
43
+ "EditOutlined",
44
+ "CopyOutlined",
45
+ "PictureOutlined",
46
+ "AddFileOutlined",
47
+ "AddFolderOutlined",
48
+ "AttachmentOutlined",
49
+ "CouponOutlined",
50
+ "FilterOutlined",
51
+ "TimeOutlined",
52
+ "PlayOutlined",
53
+ "BarsOutlined",
54
+ "DeleteOutlined",
55
+ "SettingOutlined",
56
+ "LoadingOutlined",
57
+ "TeamOutlined",
58
+ "UserAddOutlined",
59
+ "MoreOutlined",
60
+ "DownloadOutlined",
61
+ "UploadOutlined",
62
+ "FireOutlined",
63
+ "AssociationOutlined",
64
+ "AppendOutlined"
65
+ ],
66
+ "Outlined/Brand and Logos": [
67
+ "TikTokOutlined",
68
+ "ByteMiniProgramOutlined",
69
+ "MiniProgramOutlined",
70
+ "AlipayOutlined"
71
+ ],
72
+
73
+ "Filled/Basic": [
74
+ "RiseFilled",
75
+ "DeclineFilled",
76
+ "CaretLeftFilled",
77
+ "CaretRightFilled",
78
+ "CaretUpFilled",
79
+ "CaretDownFilled",
80
+ "SortFilled",
81
+ "CheckCircleFilled",
82
+ "CloseCircleFilled",
83
+ "ExclamationCircleFilled",
84
+ "InfoCircleFilled",
85
+ "FilterFilled",
86
+ "QuestionCircleFilled",
87
+ "WarningFilled",
88
+ "SettingFilled",
89
+ "BellFilled",
90
+ "PlayFilled",
91
+ "DeleteFilled",
92
+ "UploadFilled",
93
+ "CornerMarkFilled"
94
+ ],
95
+
96
+ "Filled/Brand and Logos": [
97
+ "WechatFilled",
98
+ "AlipayCircleFilled",
99
+ "AlipaySquareFilled",
100
+ "TikTokFilled",
101
+ "HuaweiFilled",
102
+ "WebPageFilled",
103
+ "QuickappFilled"
104
+ ],
105
+
106
+ "Filled/Menu": [
107
+ "ExperimentalMenuFilled",
108
+ "DataMenuFilled",
109
+ "SetMenuFilled",
110
+ "UserMenuFilled",
111
+ "RoleMenuFilled",
112
+ "ApplicationMenuFilled",
113
+ "RentalMenuFilled",
114
+ "MenuManagementMenuFilled",
115
+ "BarChartMenuFilled",
116
+ "PieChartMenuFilled",
117
+ "LogMenuFilled",
118
+ "ADMenuFilled",
119
+ "StrategyMenuFilled",
120
+ "FolderMenuFilled",
121
+ "AdministrationMenuFilled",
122
+ "DustbinMenuFilled",
123
+ "MerchandiseMenuFilled",
124
+ "WalletMenuFilled",
125
+ "PostbackMenuFilled",
126
+ "OptimaSelectionMenuFilled",
127
+ "PlayMenuFilled",
128
+ "WeChatMenuFilled",
129
+ "LinkMenuFilled"
130
+ ],
131
+
132
+ "TwoTone/Others": [
133
+ "HomeOthersTwoTone",
134
+ "ItemOthersTwoTone",
135
+ "FileOthersTwoTone"
136
+ ]
137
+ }
@@ -0,0 +1,19 @@
1
+ import { InputProps, InputRef } from 'antd';
2
+ import { FC, ReactNode } from 'react';
3
+ import './index.less';
4
+ export type McInputProps = Omit<InputProps, 'value' | 'onChange' | 'onPressEnter'> & {
5
+ /**
6
+ * @description 属性描述
7
+ * @default "默认值"
8
+ */
9
+ name?: string;
10
+ label?: ReactNode;
11
+ isTrim?: boolean;
12
+ value?: string;
13
+ onChange?: (value?: string, e?: any) => void;
14
+ onPressEnter?: (value?: string, e?: any) => void;
15
+ [key: string]: any;
16
+ };
17
+ export type { InputRef };
18
+ declare const McInput: FC<McInputProps>;
19
+ export default McInput;
@@ -0,0 +1,48 @@
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", "isTrim", "value", "onChange", "onPressEnter", "className"];
5
+ import { Input } from 'antd';
6
+ import { forwardRef, useEffect, useState } from 'react';
7
+ import "./index.css";
8
+ import { jsx as _jsx } from "react/jsx-runtime";
9
+ var McInput = /*#__PURE__*/forwardRef(function (props, ref) {
10
+ var label = props.label,
11
+ _props$isTrim = props.isTrim,
12
+ isTrim = _props$isTrim === void 0 ? true : _props$isTrim,
13
+ value = props.value,
14
+ _onChange = props.onChange,
15
+ _onPressEnter = props.onPressEnter,
16
+ className = props.className,
17
+ rest = _objectWithoutProperties(props, _excluded);
18
+ var _useState = useState(),
19
+ _useState2 = _slicedToArray(_useState, 2),
20
+ inputValue = _useState2[0],
21
+ setInputValue = _useState2[1];
22
+ useEffect(function () {
23
+ setInputValue(value);
24
+ }, [value]);
25
+ return /*#__PURE__*/_jsx(Input, _objectSpread({
26
+ ref: ref,
27
+ className: "mc-input ".concat(className || ''),
28
+ prefix: label && /*#__PURE__*/_jsx("span", {
29
+ className: "mc-input__label",
30
+ children: label
31
+ }),
32
+ value: inputValue,
33
+ onChange: function onChange(e) {
34
+ var v = isTrim ? e.target.value.trim() : e.target.value;
35
+ if (v !== inputValue) {
36
+ _onChange === null || _onChange === void 0 || _onChange(v, e);
37
+ }
38
+ setInputValue(v);
39
+ },
40
+ onPressEnter: function onPressEnter(e) {
41
+ return _onPressEnter === null || _onPressEnter === void 0 ? void 0 : _onPressEnter(isTrim ? e.target.value.trim() : e.target.value, e);
42
+ },
43
+ placeholder: "\u8BF7\u8F93\u5165",
44
+ allowClear: true,
45
+ autoComplete: "off"
46
+ }, rest));
47
+ });
48
+ export default McInput;
@@ -0,0 +1,39 @@
1
+ import { InputProps } from 'antd';
2
+ import { FC } from 'react';
3
+ import './index.less';
4
+ export type McSearchProps = Omit<InputProps, 'suffix' | 'value' | 'onChange' | 'onPressEnter'> & {
5
+ /**
6
+ * @description 查询项的字段名(配合McContainer组件的查询功能使用)
7
+ */
8
+ name?: string;
9
+ /**
10
+ * @description 是否禁止内容两边输入空格
11
+ * @default true
12
+ */
13
+ isTrim?: boolean;
14
+ /**
15
+ * @description 是否有搜索按钮,可设置文字,该属性会与 addonAfter 冲突
16
+ * @default false
17
+ */
18
+ enterButton?: boolean | string;
19
+ /**
20
+ * @description 搜索loading
21
+ * @default false
22
+ */
23
+ loading?: boolean;
24
+ /**
25
+ * @description 输入框内容
26
+ */
27
+ value?: string;
28
+ /**
29
+ * @description 输入框内容变化时的回调
30
+ */
31
+ onChange?: (value?: string, e?: any) => void;
32
+ /**
33
+ * @description 点击搜索图标或按下回车键时的回调
34
+ */
35
+ onSearch?: (value?: string) => void;
36
+ [key: string]: any;
37
+ };
38
+ declare const McSearch: FC<McSearchProps>;
39
+ export default McSearch;
@@ -0,0 +1,81 @@
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 = ["isTrim", "enterButton", "loading", "value", "onChange", "onSearch", "className"];
5
+ import { Button, Input } from 'antd';
6
+ import { SearchOutlined } from 'much-icons';
7
+ import { forwardRef, useEffect, useMemo, useState } from 'react';
8
+ import "./index.css";
9
+
10
+ /* 该组件不支持原antd组件的 suffix 属性 */
11
+ import { jsx as _jsx } from "react/jsx-runtime";
12
+ var McSearch = /*#__PURE__*/forwardRef(function (props, ref) {
13
+ var _props$isTrim = props.isTrim,
14
+ isTrim = _props$isTrim === void 0 ? true : _props$isTrim,
15
+ _props$enterButton = props.enterButton,
16
+ enterButton = _props$enterButton === void 0 ? false : _props$enterButton,
17
+ loading = props.loading,
18
+ value = props.value,
19
+ _onChange = props.onChange,
20
+ onSearch = props.onSearch,
21
+ className = props.className,
22
+ rest = _objectWithoutProperties(props, _excluded);
23
+ var _useState = useState(),
24
+ _useState2 = _slicedToArray(_useState, 2),
25
+ inputValue = _useState2[0],
26
+ setInputValue = _useState2[1];
27
+ /* 搜索按钮展示默认样式 */
28
+ var showDefaultBtn = useMemo(function () {
29
+ return typeof enterButton === 'boolean' && !enterButton;
30
+ }, [enterButton]);
31
+ /* 搜索按钮自定义文本 */
32
+ var customBtnText = useMemo(function () {
33
+ return typeof enterButton === 'string' && enterButton.length > 0;
34
+ }, [enterButton]);
35
+ useEffect(function () {
36
+ setInputValue(value);
37
+ }, [value]);
38
+ return /*#__PURE__*/_jsx(Input, _objectSpread(_objectSpread({
39
+ ref: ref,
40
+ className: "mc-search ".concat(className || ''),
41
+ value: inputValue,
42
+ onChange: function onChange(e) {
43
+ var v = isTrim ? e.target.value.trim() : e.target.value;
44
+ if (v !== inputValue) {
45
+ _onChange === null || _onChange === void 0 || _onChange(v, e);
46
+ }
47
+ setInputValue(v);
48
+ },
49
+ onPressEnter: function onPressEnter(e) {
50
+ var _e$nativeEvent;
51
+ e.stopPropagation();
52
+ /* 当前是否处于中文输入ing状态 */
53
+ if ((_e$nativeEvent = e.nativeEvent) !== null && _e$nativeEvent !== void 0 && _e$nativeEvent.isComposing) return;
54
+ onSearch === null || onSearch === void 0 || onSearch(inputValue);
55
+ },
56
+ allowClear: true,
57
+ placeholder: "\u8BF7\u8F93\u5165\u5173\u952E\u8BCD",
58
+ autoComplete: "off"
59
+ }, rest), {}, {
60
+ suffix: showDefaultBtn && /*#__PURE__*/_jsx(Button, {
61
+ className: "mc-search__icon",
62
+ type: "link",
63
+ icon: /*#__PURE__*/_jsx(SearchOutlined, {}),
64
+ loading: loading,
65
+ onClick: function onClick() {
66
+ return onSearch === null || onSearch === void 0 ? void 0 : onSearch(inputValue);
67
+ }
68
+ }),
69
+ addonAfter: !showDefaultBtn && /*#__PURE__*/_jsx(Button, {
70
+ className: "mc-search__button",
71
+ type: "primary",
72
+ icon: !customBtnText && /*#__PURE__*/_jsx(SearchOutlined, {}),
73
+ loading: loading,
74
+ onClick: function onClick() {
75
+ return onSearch === null || onSearch === void 0 ? void 0 : onSearch(inputValue);
76
+ },
77
+ children: customBtnText ? enterButton : undefined
78
+ })
79
+ }));
80
+ });
81
+ export default McSearch;
@@ -0,0 +1,11 @@
1
+ import { TextAreaProps } from 'antd/es/input';
2
+ import { FC } from 'react';
3
+ export type McTextAreaProps = Omit<TextAreaProps, 'value' | 'onChange'> & {
4
+ name?: string;
5
+ isTrim?: boolean;
6
+ value?: string;
7
+ onChange?: (value?: string, e?: any) => void;
8
+ [key: string]: any;
9
+ };
10
+ declare const McTextArea: FC<McTextAreaProps>;
11
+ export default McTextArea;
@@ -0,0 +1,37 @@
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 = ["isTrim", "value", "onChange", "className"];
5
+ import { Input } from 'antd';
6
+ import { forwardRef, useEffect, useState } from 'react';
7
+ import { jsx as _jsx } from "react/jsx-runtime";
8
+ var McTextArea = /*#__PURE__*/forwardRef(function (props, ref) {
9
+ var isTrim = props.isTrim,
10
+ value = props.value,
11
+ _onChange = props.onChange,
12
+ className = props.className,
13
+ rest = _objectWithoutProperties(props, _excluded);
14
+ var _useState = useState(),
15
+ _useState2 = _slicedToArray(_useState, 2),
16
+ inputValue = _useState2[0],
17
+ setInputValue = _useState2[1];
18
+ useEffect(function () {
19
+ setInputValue(value);
20
+ }, [value]);
21
+ return /*#__PURE__*/_jsx(Input.TextArea, _objectSpread({
22
+ ref: ref,
23
+ className: "mc-textarea ".concat(className || ''),
24
+ value: inputValue,
25
+ onChange: function onChange(e) {
26
+ var v = isTrim ? e.target.value.trim() : e.target.value;
27
+ if (v !== inputValue) {
28
+ _onChange === null || _onChange === void 0 || _onChange(v, e);
29
+ }
30
+ setInputValue(v);
31
+ },
32
+ allowClear: true,
33
+ placeholder: "\u8BF7\u8F93\u5165",
34
+ autoComplete: "off"
35
+ }, rest));
36
+ });
37
+ export default McTextArea;
@@ -0,0 +1,3 @@
1
+ import React from 'react';
2
+ declare const App: React.FC;
3
+ export default App;
@@ -0,0 +1,67 @@
1
+ /**
2
+ * title: 前置/后置标签
3
+ * description: 用于配置一些固定组合。和antd用法一致
4
+ */
5
+ import { Cascader, Select, Space } from 'antd';
6
+ import { SettingOutlined } from 'much-icons';
7
+ import { McInput } from "../../..";
8
+ import React from 'react';
9
+ import { jsx as _jsx } from "react/jsx-runtime";
10
+ import { jsxs as _jsxs } from "react/jsx-runtime";
11
+ var Option = Select.Option;
12
+ var selectBefore = /*#__PURE__*/_jsxs(Select, {
13
+ defaultValue: "http://",
14
+ children: [/*#__PURE__*/_jsx(Option, {
15
+ value: "http://",
16
+ children: "http://"
17
+ }), /*#__PURE__*/_jsx(Option, {
18
+ value: "https://",
19
+ children: "https://"
20
+ })]
21
+ });
22
+ var selectAfter = /*#__PURE__*/_jsxs(Select, {
23
+ defaultValue: ".com",
24
+ children: [/*#__PURE__*/_jsx(Option, {
25
+ value: ".com",
26
+ children: ".com"
27
+ }), /*#__PURE__*/_jsx(Option, {
28
+ value: ".jp",
29
+ children: ".jp"
30
+ }), /*#__PURE__*/_jsx(Option, {
31
+ value: ".cn",
32
+ children: ".cn"
33
+ }), /*#__PURE__*/_jsx(Option, {
34
+ value: ".org",
35
+ children: ".org"
36
+ })]
37
+ });
38
+ var App = function App() {
39
+ return /*#__PURE__*/_jsxs(Space, {
40
+ direction: "vertical",
41
+ children: [/*#__PURE__*/_jsx(McInput, {
42
+ addonBefore: "http://",
43
+ addonAfter: ".com",
44
+ defaultValue: "mysite"
45
+ }), /*#__PURE__*/_jsx(McInput, {
46
+ addonBefore: selectBefore,
47
+ addonAfter: selectAfter,
48
+ defaultValue: "mysite"
49
+ }), /*#__PURE__*/_jsx(McInput, {
50
+ addonAfter: /*#__PURE__*/_jsx(SettingOutlined, {}),
51
+ defaultValue: "mysite"
52
+ }), /*#__PURE__*/_jsx(McInput, {
53
+ addonBefore: "http://",
54
+ suffix: ".com",
55
+ defaultValue: "mysite"
56
+ }), /*#__PURE__*/_jsx(McInput, {
57
+ addonBefore: /*#__PURE__*/_jsx(Cascader, {
58
+ placeholder: "cascader",
59
+ style: {
60
+ width: 150
61
+ }
62
+ }),
63
+ defaultValue: "mysite"
64
+ })]
65
+ });
66
+ };
67
+ export default App;
@@ -0,0 +1,2 @@
1
+ declare const _default: () => import("react/jsx-runtime").JSX.Element;
2
+ export default _default;
@@ -0,0 +1,31 @@
1
+ /**
2
+ * title: 基本使用
3
+ * description: 基本使用和<a href="https://ant-design.antgroup.com/components/input-cn" target='_blank'>antd</a>用法一致
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, {
16
+ placeholder: "\u57FA\u672C\u4F7F\u7528",
17
+ count: {
18
+ show: true,
19
+ max: 10
20
+ }
21
+ }), /*#__PURE__*/_jsx(McInput, {
22
+ placeholder: "\u57FA\u672C\u4F7F\u7528",
23
+ variant: "filled",
24
+ size: "large"
25
+ }), /*#__PURE__*/_jsx(McInput, {
26
+ placeholder: "\u57FA\u672C\u4F7F\u7528",
27
+ variant: "borderless",
28
+ size: "small"
29
+ })]
30
+ });
31
+ });
@@ -0,0 +1,2 @@
1
+ declare const _default: () => import("react/jsx-runtime").JSX.Element;
2
+ export default _default;
@@ -0,0 +1,22 @@
1
+ /**
2
+ * title: 去前后空格
3
+ * description: isTrim 默认true
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, {
16
+ placeholder: "\u4E0D\u53EF\u8F93\u5165\u524D\u540E\u7A7A\u683C"
17
+ }), /*#__PURE__*/_jsx(McInput, {
18
+ placeholder: "\u53EF\u8F93\u5165\u524D\u540E\u7A7A\u683C",
19
+ isTrim: false
20
+ })]
21
+ });
22
+ });
@@ -0,0 +1,2 @@
1
+ declare const _default: () => import("react/jsx-runtime").JSX.Element;
2
+ export default _default;
@@ -0,0 +1,26 @@
1
+ /**
2
+ * title: 前缀
3
+ * description: 新增label属性,配置label属性后会多一个冒号(主要用于McContainer查询区),antd原生属性prefix会覆盖label属性
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, {
16
+ placeholder: "antd\u539F\u751F\u5C5E\u6027prefix",
17
+ prefix: "prefix"
18
+ }), /*#__PURE__*/_jsx(McInput, {
19
+ placeholder: "\u65B0\u589E\u5C5E\u6027label",
20
+ label: "label"
21
+ }), /*#__PURE__*/_jsx(McInput, {
22
+ label: "label",
23
+ prefix: "\u8986\u76D6label\u5C5E\u6027"
24
+ })]
25
+ });
26
+ });
@@ -0,0 +1,3 @@
1
+ import React from 'react';
2
+ declare const App: React.FC;
3
+ export default App;
@@ -0,0 +1,53 @@
1
+ import _objectSpread from "@babel/runtime/helpers/esm/objectSpread2";
2
+ /**
3
+ * title: 调用方法
4
+ * description: <a href="https://ant-design.antgroup.com/components/input-cn" target='_blank'>antd</a>用法一致
5
+ */
6
+
7
+ import { Button, Space } from 'antd';
8
+ import { McInput } from "../../..";
9
+ import React, { useRef } from 'react';
10
+ import { jsx as _jsx } from "react/jsx-runtime";
11
+ import { jsxs as _jsxs } from "react/jsx-runtime";
12
+ var App = function App() {
13
+ var inputRef = useRef(null);
14
+ var sharedProps = {
15
+ style: {
16
+ width: '100%'
17
+ },
18
+ defaultValue: 'Ant Design love you!',
19
+ ref: inputRef
20
+ };
21
+ return /*#__PURE__*/_jsxs(Space, {
22
+ direction: "vertical",
23
+ style: {
24
+ width: '100%'
25
+ },
26
+ children: [/*#__PURE__*/_jsxs(Space, {
27
+ wrap: true,
28
+ children: [/*#__PURE__*/_jsx(Button, {
29
+ onClick: function onClick() {
30
+ inputRef.current.focus({
31
+ cursor: 'start'
32
+ });
33
+ },
34
+ children: "\u805A\u7126\u5230\u5F00\u5934"
35
+ }), /*#__PURE__*/_jsx(Button, {
36
+ onClick: function onClick() {
37
+ inputRef.current.focus({
38
+ cursor: 'end'
39
+ });
40
+ },
41
+ children: "\u805A\u7126\u5230\u7ED3\u5C3E"
42
+ }), /*#__PURE__*/_jsx(Button, {
43
+ onClick: function onClick() {
44
+ inputRef.current.focus({
45
+ cursor: 'all'
46
+ });
47
+ },
48
+ children: "\u9009\u4E2D\u5168\u90E8"
49
+ })]
50
+ }), /*#__PURE__*/_jsx("br", {}), /*#__PURE__*/_jsx(McInput, _objectSpread({}, sharedProps))]
51
+ });
52
+ };
53
+ export default App;
@@ -0,0 +1,2 @@
1
+ declare const _default: () => import("react/jsx-runtime").JSX.Element;
2
+ export default _default;
@@ -0,0 +1,23 @@
1
+ /**
2
+ * title: 自定义状态
3
+ * description: 使用 `status` 为 Input 添加状态,可选 `error` 或者 `warning`。
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, {
16
+ placeholder: "error",
17
+ status: "error"
18
+ }), /*#__PURE__*/_jsx(McInput, {
19
+ placeholder: "warning",
20
+ status: "warning"
21
+ })]
22
+ });
23
+ });
@@ -0,0 +1,2 @@
1
+ declare const _default: () => import("react/jsx-runtime").JSX.Element;
2
+ export default _default;