@hi-ui/hiui 2.15.11 → 2.15.12

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.
Files changed (344) hide show
  1. package/es/_util/SwitchVersion.js +40 -0
  2. package/es/_util/depreactedPropsCompat.js +58 -0
  3. package/es/_util/index.js +31 -0
  4. package/es/_util/warning.js +2 -2
  5. package/es/alert/Alert.js +126 -0
  6. package/es/alert/__tests__/index.test.js +84 -0
  7. package/es/alert/index.js +6 -147
  8. package/es/alert/style/index.css +1 -1
  9. package/es/badge/Badge.js +82 -0
  10. package/es/badge/__tests__/index.test.js +82 -0
  11. package/es/badge/index.js +9 -87
  12. package/es/badge/style/index.css +1 -1
  13. package/es/badge/style/index.js +0 -0
  14. package/es/breadcrumb/__tests__/index.test.js +61 -0
  15. package/es/breadcrumb/index.js +85 -0
  16. package/es/breadcrumb/style/index.css +1 -0
  17. package/es/button/Button.js +62 -60
  18. package/es/button/ButtonGroup.js +24 -40
  19. package/es/button/IconLoading.js +6 -6
  20. package/es/button/__tests__/index.test.js +221 -0
  21. package/es/button/index.js +3 -2
  22. package/es/button/style/index.css +1 -1
  23. package/es/card/__tests__/index.test.js +179 -0
  24. package/es/card/index.js +61 -57
  25. package/es/card/style/index.css +1 -1
  26. package/es/carousel/__tests__/index.test.js +104 -0
  27. package/es/carousel/index.js +219 -0
  28. package/es/carousel/style/index.css +1 -0
  29. package/es/carousel/style/index.js +3 -0
  30. package/es/cascader/Cascader.js +190 -133
  31. package/es/cascader/Menu.js +168 -0
  32. package/es/cascader/__tests__/index.test.js +392 -0
  33. package/es/cascader/index.js +5 -2
  34. package/es/cascader/style/cascader.css +1 -1
  35. package/es/cascader/style/menu.css +1 -1
  36. package/es/checkbox/Checkbox.js +136 -0
  37. package/es/checkbox/Group.js +194 -0
  38. package/es/checkbox/__tests__/index.test.js +226 -0
  39. package/es/checkbox/checkbox-legacy/Base.js +212 -0
  40. package/es/checkbox/checkbox-legacy/CheckBox.js +157 -0
  41. package/es/checkbox/checkbox-legacy/index.js +15 -0
  42. package/es/checkbox/checkbox-legacy/style/index.css +1 -0
  43. package/es/checkbox/checkbox-legacy/style/index.js +3 -0
  44. package/es/checkbox/index.js +13 -4
  45. package/es/checkbox/style/index.css +1 -1
  46. package/es/collapse/__tests__/index.test.js +111 -0
  47. package/es/collapse/index.js +88 -110
  48. package/es/collapse/style/index.css +1 -1
  49. package/es/confirm/index.js +39 -60
  50. package/es/context/index.js +45 -51
  51. package/es/counter/Counter.js +339 -0
  52. package/es/counter/__tests__/index.test.js +134 -0
  53. package/es/counter/counter-legacy/index.js +267 -0
  54. package/es/counter/index.js +6 -270
  55. package/es/counter/style/index.css +1 -1
  56. package/es/date-picker/BasePicker.js +380 -302
  57. package/es/date-picker/Calender.js +326 -98
  58. package/es/date-picker/DatePanel.js +194 -213
  59. package/es/date-picker/DatePicker.js +143 -47
  60. package/es/date-picker/DateRangePanel.js +272 -208
  61. package/es/date-picker/Modal.js +18 -32
  62. package/es/date-picker/Time.js +231 -345
  63. package/es/date-picker/TimeList.js +246 -0
  64. package/es/date-picker/TimePanel.js +28 -41
  65. package/es/date-picker/TimePeriodPanel.js +27 -46
  66. package/es/date-picker/TimePicker.js +44 -46
  67. package/es/date-picker/TimeRangePanel.js +33 -51
  68. package/es/date-picker/Type.js +5 -1
  69. package/es/date-picker/WeekRangePanel.js +254 -175
  70. package/es/date-picker/YMRangePanel.js +364 -0
  71. package/es/date-picker/__tests__/index.test.js +956 -0
  72. package/es/date-picker/constants.js +14 -28
  73. package/es/date-picker/dateUtil.js +221 -52
  74. package/es/date-picker/datepicker-legacy/BasePicker.js +511 -0
  75. package/es/date-picker/datepicker-legacy/Calender.js +422 -0
  76. package/es/date-picker/datepicker-legacy/DatePanel.js +455 -0
  77. package/es/date-picker/datepicker-legacy/DatePicker.js +103 -0
  78. package/es/date-picker/datepicker-legacy/DateRangePanel.js +488 -0
  79. package/es/date-picker/datepicker-legacy/Modal.js +67 -0
  80. package/es/date-picker/datepicker-legacy/Time.js +405 -0
  81. package/es/date-picker/datepicker-legacy/TimePanel.js +85 -0
  82. package/es/date-picker/datepicker-legacy/TimePeriodPanel.js +118 -0
  83. package/es/date-picker/datepicker-legacy/TimePicker.js +78 -0
  84. package/es/date-picker/datepicker-legacy/TimeRangePanel.js +90 -0
  85. package/es/date-picker/datepicker-legacy/Type.js +31 -0
  86. package/es/date-picker/datepicker-legacy/WeekRangePanel.js +337 -0
  87. package/es/date-picker/datepicker-legacy/constants.js +79 -0
  88. package/es/date-picker/datepicker-legacy/dateUtil.js +258 -0
  89. package/es/date-picker/datepicker-legacy/index.js +15 -0
  90. package/es/date-picker/datepicker-legacy/local.js +11 -0
  91. package/es/date-picker/datepicker-legacy/style/index.css +1 -0
  92. package/es/date-picker/datepicker-legacy/style/index.js +3 -0
  93. package/es/date-picker/datepicker-legacy/style/timepicker.css +1 -0
  94. package/es/date-picker/datepicker-legacy/util.js +60 -0
  95. package/es/date-picker/index.js +5 -2
  96. package/es/date-picker/style/index.css +1 -1
  97. package/es/date-picker/toLunar.js +172 -0
  98. package/es/date-picker/util.js +101 -8
  99. package/es/dropdown/Dropdown.js +191 -203
  100. package/es/dropdown/DropdownButton.js +102 -0
  101. package/es/dropdown/DropdownMenu.js +107 -0
  102. package/es/dropdown/DropdownMenuItem.js +172 -0
  103. package/es/dropdown/__tests__/index.test.js +313 -0
  104. package/es/dropdown/index.js +69 -4
  105. package/es/dropdown/style/index.css +1 -1
  106. package/es/dropdown/style/index.js +0 -2
  107. package/es/dropdown/{__test__ → tests}/index.test.js +7 -7
  108. package/es/dropdown/utils.js +35 -0
  109. package/es/ficon/index.js +16 -30
  110. package/es/form/Form.js +176 -0
  111. package/es/form/{item.js → Item.js} +52 -60
  112. package/es/form/__tests__/index.test.js +571 -0
  113. package/es/form/index.js +6 -171
  114. package/es/form/style/index.css +1 -1
  115. package/es/grid/__tests__/index.test.js +100 -0
  116. package/es/grid/index.js +36 -56
  117. package/es/icon/index.js +23 -38
  118. package/es/index.js +61 -9
  119. package/es/input/Input.js +400 -0
  120. package/es/input/__tests__/index.test.js +376 -0
  121. package/es/input/index.js +26 -347
  122. package/es/input/input-legacy/index.js +341 -0
  123. package/es/input/input-legacy/util.js +176 -0
  124. package/es/input/style/index.css +1 -1
  125. package/es/input/util.js +26 -18
  126. package/es/lib/withDragDropContext.js +2 -2
  127. package/es/loading/Loading.js +173 -0
  128. package/es/loading/__tests__/index.test.js +110 -0
  129. package/es/loading/index.js +5 -129
  130. package/es/loading/style/index.css +0 -0
  131. package/es/loading/style/index.js +0 -0
  132. package/es/locales/en-US.js +45 -9
  133. package/es/locales/index.js +16 -2
  134. package/es/locales/zh-CN.js +46 -10
  135. package/es/locales/zh-Hant-HK.js +123 -0
  136. package/es/locales/zh-Hant-TW.js +125 -0
  137. package/es/menu/Item.js +34 -51
  138. package/es/menu/Menu.js +414 -0
  139. package/es/menu/SubMenu.js +63 -90
  140. package/es/menu/Title.js +37 -51
  141. package/es/menu/__tests__/index.test.js +274 -0
  142. package/es/menu/index.js +12 -419
  143. package/es/menu/style/index.css +1 -1
  144. package/es/message/__tests__/index.test.js +71 -0
  145. package/es/message/index.js +58 -0
  146. package/es/message/style/index.css +1 -0
  147. package/es/message/style/index.js +5 -0
  148. package/es/modal/__tests__/index.test.js +178 -0
  149. package/es/modal/index.js +85 -77
  150. package/es/modal/style/index.css +1 -1
  151. package/es/nav-menu/NavMenu.js +44 -61
  152. package/es/nav-menu/__test__/index.test.js +8 -8
  153. package/es/nav-menu/__tests__/index.test.js +23 -0
  154. package/es/nav-menu/index.js +2 -2
  155. package/es/notice/Notice.js +136 -0
  156. package/es/notice/NoticeContainer.js +107 -0
  157. package/es/notice/__tests__/index.test.js +174 -0
  158. package/es/notice/index.js +66 -0
  159. package/es/notice/style/index.css +1 -0
  160. package/es/notice/style/index.js +5 -0
  161. package/es/notification/HandleNotification/index.js +216 -0
  162. package/es/notification/HandleNotification/style/index.css +1 -0
  163. package/es/notification/HandleNotification/style/index.js +5 -0
  164. package/es/notification/__tests__/index.test.js +114 -0
  165. package/es/notification/index.js +68 -231
  166. package/es/notification/style/index.css +1 -1
  167. package/es/notification/style/index.js +0 -0
  168. package/es/pagination/Pager.js +7 -9
  169. package/es/pagination/Pagination.js +134 -133
  170. package/es/pagination/__tests__/index.test.js +244 -0
  171. package/es/pagination/index.js +9 -8
  172. package/es/pagination/style/index.css +1 -1
  173. package/es/panel/index.js +28 -46
  174. package/es/popover/__test__/index.test.js +10 -10
  175. package/es/popover/__tests__/index.test.js +152 -0
  176. package/es/popover/index.js +77 -83
  177. package/es/popper/index.js +68 -64
  178. package/es/popper/style/index.css +1 -1
  179. package/es/preview/index.js +529 -0
  180. package/es/preview/style/index.css +1 -0
  181. package/es/preview/style/index.js +3 -0
  182. package/es/progress/BarProgress.js +107 -43
  183. package/es/progress/CircleProgress.js +13 -14
  184. package/es/progress/DashboardProgress.js +11 -13
  185. package/es/progress/Progress.js +102 -0
  186. package/es/progress/__tests__/index.test.js +131 -0
  187. package/es/progress/index.js +8 -100
  188. package/es/progress/style/index.css +1 -1
  189. package/es/radio/Group.js +199 -0
  190. package/es/radio/Radio.js +147 -0
  191. package/es/radio/__tests__/index.test.js +127 -0
  192. package/es/radio/index.js +10 -216
  193. package/es/radio/{__test__ → radio-legacy/__test__}/index.test.js +13 -13
  194. package/es/radio/radio-legacy/index.js +214 -0
  195. package/es/radio/radio-legacy/style/index.css +1 -0
  196. package/es/radio/radio-legacy/style/index.js +3 -0
  197. package/es/radio/style/index.css +1 -1
  198. package/es/rate/Icons.js +70 -70
  199. package/es/rate/Rate.js +75 -108
  200. package/es/rate/__tests__/index.test.js +124 -0
  201. package/es/rate/index.js +5 -2
  202. package/es/rate/style/index.css +1 -1
  203. package/es/select/Select.js +330 -265
  204. package/es/select/SelectDropdown.js +223 -79
  205. package/es/select/SelectInput.js +120 -91
  206. package/es/select/__tests__/index.test.js +505 -0
  207. package/es/select/index.js +6 -4
  208. package/es/select/select-legacy/Option.js +78 -0
  209. package/es/select/select-legacy/Select.js +702 -0
  210. package/es/select/select-legacy/SelectDropdown.js +157 -0
  211. package/es/select/select-legacy/SelectInput.js +308 -0
  212. package/es/select/select-legacy/common.js +19 -0
  213. package/es/select/select-legacy/index.js +16 -0
  214. package/es/select/style/select-dropdown.css +1 -1
  215. package/es/select/style/select-input.css +1 -1
  216. package/es/stepper/Stepper.js +147 -0
  217. package/es/stepper/__tests__/index.test.js +161 -0
  218. package/es/stepper/index.js +21 -127
  219. package/es/stepper/style/index.css +1 -1
  220. package/es/style/icon/diyIcon.css +1 -1
  221. package/es/style/icon/index.css +1 -1
  222. package/es/switch/__tests__/index.test.js +68 -0
  223. package/es/switch/index.js +26 -46
  224. package/es/switch/style/index.css +1 -1
  225. package/es/table/Body.js +294 -0
  226. package/es/table/ClickOuterside.js +95 -0
  227. package/es/table/Footer.js +171 -0
  228. package/es/table/Header.js +320 -0
  229. package/es/table/TableContent.js +101 -0
  230. package/es/table/__tests__/index.test.js +129 -0
  231. package/es/table/checkbox/index.js +36 -47
  232. package/es/table/checkbox/style/index.css +1 -0
  233. package/es/table/checkbox/style/index.js +3 -0
  234. package/es/table/index.js +269 -314
  235. package/es/table/menu/index.js +34 -44
  236. package/es/table/prefix.js +2 -2
  237. package/es/table/style/Table.css +1 -1
  238. package/es/table/style/index.css +1 -1
  239. package/es/tabs/ItemDropdown.js +45 -65
  240. package/es/tabs/TabPane.js +26 -44
  241. package/es/tabs/Tabs.js +110 -111
  242. package/es/tabs/__tests__/index.test.js +329 -0
  243. package/es/tabs/index.js +9 -3
  244. package/es/tabs/style/index.css +1 -1
  245. package/es/tabs/tabs-legacy/ItemDropdown.js +162 -0
  246. package/es/tabs/tabs-legacy/TabPane.js +70 -0
  247. package/es/tabs/tabs-legacy/Tabs.js +291 -0
  248. package/es/tabs/tabs-legacy/index.js +18 -0
  249. package/es/tabs/tabs-legacy/style/index.css +1 -0
  250. package/es/tabs/tabs-legacy/style/index.js +3 -0
  251. package/es/tag/__tests__/index.test.js +46 -0
  252. package/es/tag/index.js +86 -0
  253. package/es/tag/style/index.css +1 -0
  254. package/es/tag/style/index.js +3 -0
  255. package/es/timeline/__tests__/index.test.js +198 -0
  256. package/es/timeline/index.js +206 -136
  257. package/es/timeline/style/index.css +1 -1
  258. package/es/tooltip/__tests__/index.test.js +166 -0
  259. package/es/tooltip/index.js +93 -52
  260. package/es/tooltip/style/index.css +1 -1
  261. package/es/transfer/Item.js +73 -71
  262. package/es/transfer/Transfer.js +558 -0
  263. package/es/transfer/__tests__/index.test.js +210 -0
  264. package/es/transfer/index.js +4 -443
  265. package/es/transfer/style/index.css +1 -1
  266. package/es/tree/IconLoading.js +38 -0
  267. package/es/tree/Tree.js +94 -111
  268. package/es/tree/TreeDivider.js +6 -6
  269. package/es/tree/TreeItem.js +217 -123
  270. package/es/tree/TreeNode.js +472 -333
  271. package/es/tree/__tests__/index.test.js +599 -0
  272. package/es/tree/index.js +9 -2
  273. package/es/tree/style/index.css +1 -1
  274. package/es/tree/tree-legacy/Tree.js +330 -0
  275. package/es/tree/tree-legacy/TreeDivider.js +25 -0
  276. package/es/tree/tree-legacy/TreeItem.js +326 -0
  277. package/es/tree/tree-legacy/TreeNode.js +711 -0
  278. package/es/tree/tree-legacy/index.js +13 -0
  279. package/es/tree/tree-legacy/style/index.css +1 -0
  280. package/es/tree/tree-legacy/style/index.js +3 -0
  281. package/es/tree/tree-legacy/util.js +434 -0
  282. package/es/tree/util.js +8 -256
  283. package/es/upload/Upload.js +292 -200
  284. package/es/upload/UploadAvatar.js +61 -79
  285. package/es/upload/UploadClick.js +62 -60
  286. package/es/upload/UploadDrag.js +63 -66
  287. package/es/upload/UploadPhoto.js +86 -75
  288. package/es/upload/UploadPictureCard.js +53 -60
  289. package/es/upload/__tests__/index.test.js +760 -0
  290. package/es/upload/index.js +8 -71
  291. package/es/upload/main.js +83 -0
  292. package/es/upload/style/index.css +1 -1
  293. package/es/upload/tool.js +0 -1
  294. package/es/upload/{Preview.js → upload-legacy/Preview.js} +48 -62
  295. package/es/upload/upload-legacy/Upload.js +431 -0
  296. package/es/upload/upload-legacy/UploadAvatar.js +318 -0
  297. package/es/upload/upload-legacy/UploadClick.js +121 -0
  298. package/es/upload/upload-legacy/UploadDrag.js +176 -0
  299. package/es/upload/upload-legacy/UploadPhoto.js +179 -0
  300. package/es/upload/upload-legacy/UploadPictureCard.js +122 -0
  301. package/es/upload/upload-legacy/index.js +67 -0
  302. package/es/upload/upload-legacy/style/index.css +1 -0
  303. package/es/upload/upload-legacy/style/index.js +5 -0
  304. package/es/upload/upload-legacy/tool.js +84 -0
  305. package/es/watermark/index.js +97 -0
  306. package/es/watermark/watermark.js +263 -0
  307. package/package.json +1 -1
  308. package/es/alert/__test__/index.test.js +0 -67
  309. package/es/button/__test__/index.test.js +0 -29
  310. package/es/cascader/__test__/index.test.js +0 -283
  311. package/es/cascader/menu.js +0 -155
  312. package/es/checkbox/Base.js +0 -205
  313. package/es/checkbox/CheckBox.js +0 -185
  314. package/es/collapse/__test__/index.test.js +0 -58
  315. package/es/counter/__test__/index.test.js +0 -52
  316. package/es/menu/ItemGroup.js +0 -81
  317. package/es/modal/__test__/index.test.js +0 -123
  318. package/es/notification/__test__/index.test.js +0 -56
  319. package/es/pagination/__test__/index.test.js +0 -140
  320. package/es/rate/__test__/index.test.js +0 -54
  321. package/es/select/Option.js +0 -93
  322. package/es/select/__test__/index.test.js +0 -429
  323. package/es/style/color/colors.css +0 -0
  324. package/es/style/index.css +0 -0
  325. package/es/style/mixins/colors.css +0 -0
  326. package/es/style/mixins/index.css +0 -0
  327. package/es/style/theme/dark.css +0 -0
  328. package/es/style/theme/default.css +0 -0
  329. package/es/switch/__test__/index.test.js +0 -39
  330. package/es/table/__test__/index.test.js +0 -73
  331. package/es/table/body.js +0 -318
  332. package/es/table/clickOuterside.js +0 -115
  333. package/es/table/footer.js +0 -196
  334. package/es/table/header.js +0 -337
  335. package/es/table/pover.js +0 -154
  336. package/es/table/tableContent.js +0 -120
  337. package/es/timeline/__test__/index.test.js +0 -49
  338. package/es/timeline/foldingItem.js +0 -82
  339. package/es/tooltip/__test__/index.test.js +0 -67
  340. package/es/transfer/__test__/index.test.js +0 -11
  341. /package/es/{style → breadcrumb/style}/index.js +0 -0
  342. /package/es/checkbox/{common.js → checkbox-legacy/common.js} +0 -0
  343. /package/es/upload/{style → upload-legacy/style}/preview.css +0 -0
  344. /package/es/upload/{style → upload-legacy/style}/preview.js +0 -0
@@ -0,0 +1,341 @@
1
+ "use strict";
2
+
3
+ var _interopRequireWildcard = require("@babel/runtime/helpers/interopRequireWildcard");
4
+
5
+ var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault");
6
+
7
+ Object.defineProperty(exports, "__esModule", {
8
+ value: true
9
+ });
10
+ exports["default"] = void 0;
11
+
12
+ var _extends2 = _interopRequireDefault(require("@babel/runtime/helpers/extends"));
13
+
14
+ var _typeof2 = _interopRequireDefault(require("@babel/runtime/helpers/typeof"));
15
+
16
+ var _classCallCheck2 = _interopRequireDefault(require("@babel/runtime/helpers/classCallCheck"));
17
+
18
+ var _createClass2 = _interopRequireDefault(require("@babel/runtime/helpers/createClass"));
19
+
20
+ var _possibleConstructorReturn2 = _interopRequireDefault(require("@babel/runtime/helpers/possibleConstructorReturn"));
21
+
22
+ var _getPrototypeOf2 = _interopRequireDefault(require("@babel/runtime/helpers/getPrototypeOf"));
23
+
24
+ var _inherits2 = _interopRequireDefault(require("@babel/runtime/helpers/inherits"));
25
+
26
+ var _defineProperty2 = _interopRequireDefault(require("@babel/runtime/helpers/defineProperty"));
27
+
28
+ var _react = _interopRequireWildcard(require("react"));
29
+
30
+ var _classnames = _interopRequireDefault(require("classnames"));
31
+
32
+ var _util = require("./util");
33
+
34
+ var Input =
35
+ /*#__PURE__*/
36
+ function (_Component) {
37
+ (0, _inherits2["default"])(Input, _Component);
38
+
39
+ function Input(props) {
40
+ var _this;
41
+
42
+ (0, _classCallCheck2["default"])(this, Input);
43
+ _this = (0, _possibleConstructorReturn2["default"])(this, (0, _getPrototypeOf2["default"])(Input).call(this, props)); // 传入属性
44
+
45
+ var commonAttrs = {
46
+ type: 'text',
47
+ size: 'm',
48
+ prefixicon: '',
49
+ suffixicon: '',
50
+ prefix: '',
51
+ suffix: ''
52
+ };
53
+ var oldProps = Object.assign({}, commonAttrs, _this.props);
54
+ var newProps = (0, _util.getAttrs)(oldProps); // 分离有效属性和事件
55
+
56
+ _this.attrs = newProps.attrs;
57
+ var type = (0, _typeof2["default"])(_this.props.value);
58
+ var prefix = typeof _this.props.prefix === 'undefined' ? '' : _this.props.prefix;
59
+ var suffix = typeof _this.props.suffix === 'undefined' ? '' : _this.props.suffix;
60
+ _this.state = {
61
+ value: type === 'string' || type === 'number' ? (0, _util.format)(_this.props.value, _this.props.type) : '',
62
+ valueTrue: prefix + _this.props.value + suffix,
63
+ hover: false,
64
+ active: false
65
+ };
66
+ return _this;
67
+ }
68
+
69
+ (0, _createClass2["default"])(Input, [{
70
+ key: "componentWillReceiveProps",
71
+ value: function componentWillReceiveProps(nextProps) {
72
+ if (nextProps.value !== undefined) {
73
+ if (nextProps.value !== this.state.value) {
74
+ this.setState({
75
+ value: (0, _util.format)(nextProps.value, this.props.type),
76
+ valueTrue: nextProps.value
77
+ });
78
+ }
79
+ }
80
+ }
81
+ /**
82
+ * 渲染 text 输入框
83
+ */
84
+
85
+ }, {
86
+ key: "renderText",
87
+ value: function renderText() {
88
+ var _this2 = this;
89
+
90
+ var _this$state = this.state,
91
+ hover = _this$state.hover,
92
+ active = _this$state.active,
93
+ value = _this$state.value;
94
+ var _this$props = this.props,
95
+ disabled = _this$props.disabled,
96
+ type = _this$props.type,
97
+ prefix = _this$props.prefix,
98
+ suffix = _this$props.suffix,
99
+ prepend = _this$props.prepend,
100
+ append = _this$props.append,
101
+ id = _this$props.id,
102
+ placeholder = _this$props.placeholder;
103
+ var noClear = ['textarea'];
104
+ var prefixId = id ? id + '_prefix' : '';
105
+ var suffixId = id ? id + '_suffix' : '';
106
+ return _react["default"].createElement("div", {
107
+ className: (0, _classnames["default"])('hi-input__out', {
108
+ 'hi-input--prepend': prepend,
109
+ 'hi-input--append': append
110
+ })
111
+ }, // 前置元素
112
+ prepend && _react["default"].createElement("span", {
113
+ className: "hi-input__prepend"
114
+ }, prepend), _react["default"].createElement("div", {
115
+ className: "hi-input__inner".concat(active ? ' active' : '').concat(disabled ? ' disabled' : '')
116
+ }, // 前缀
117
+ prefix && _react["default"].createElement("span", {
118
+ id: prefixId,
119
+ className: "hi-input__prefix",
120
+ "data-value": prefix
121
+ }, prefix), _react["default"].createElement("input", (0, _extends2["default"])({
122
+ ref: function ref(arg) {
123
+ _this2._Input = arg;
124
+ },
125
+ className: "hi-input__text ".concat(disabled ? 'disabled' : ''),
126
+ value: this.state.value,
127
+ autoComplete: "off",
128
+ disabled: disabled
129
+ }, this.attrs, {
130
+ placeholder: placeholder,
131
+ onChange: function onChange(e) {
132
+ e.persist();
133
+ var value = e.target.value;
134
+ var valueTrue = (0, _util.formatValue)(value, type);
135
+
136
+ if (prefix) {
137
+ valueTrue = prefix + valueTrue;
138
+ }
139
+
140
+ if (suffix) {
141
+ valueTrue = valueTrue + suffix;
142
+ }
143
+
144
+ value = (0, _util.format)(value, type);
145
+
146
+ _this2.setState({
147
+ value: value,
148
+ valueTrue: valueTrue
149
+ }, function () {
150
+ _this2.props.onChange && _this2.props.onChange(e, valueTrue);
151
+ });
152
+ },
153
+ onBlur: function onBlur(e) {
154
+ e.persist();
155
+ var value = e.target.value;
156
+ var valueTrue = _this2.state.valueTrue; // amount 自动添加小数
157
+
158
+ if (_this2.props.type === 'amount' && value !== '') {
159
+ value = (0, _util.formatAmount)(value);
160
+ }
161
+
162
+ _this2.setState({
163
+ active: false,
164
+ value: value
165
+ }, function () {
166
+ _this2.props.onBlur && _this2.props.onBlur(e, valueTrue);
167
+ });
168
+ },
169
+ onFocus: function onFocus(e) {
170
+ e.persist();
171
+ var valueTrue = _this2.state.valueTrue;
172
+
173
+ _this2.setState({
174
+ active: true
175
+ }, function () {
176
+ _this2.props.onFocus && _this2.props.onFocus(e, valueTrue);
177
+ });
178
+ },
179
+ onKeyDown: function onKeyDown(e) {
180
+ var valueTrue = _this2.state.valueTrue;
181
+ _this2.props.onKeyDown && _this2.props.onKeyDown(e, valueTrue);
182
+ },
183
+ onKeyUp: function onKeyUp(e) {
184
+ var valueTrue = _this2.state.valueTrue;
185
+ _this2.props.onKeyUp && _this2.props.onKeyUp(e, valueTrue);
186
+ },
187
+ onKeyPress: function onKeyPress(e) {
188
+ var valueTrue = _this2.state.valueTrue;
189
+ _this2.props.onKeyPress && _this2.props.onKeyPress(e, valueTrue);
190
+ },
191
+ onInput: function onInput(e) {
192
+ var valueTrue = _this2.state.valueTrue;
193
+ _this2.props.onInput && _this2.props.onInput(e, valueTrue);
194
+ }
195
+ })), // 清除
196
+ noClear.indexOf(type) === -1 && typeof prefix === 'undefined' && typeof suffix === 'undefined' && value !== '' && _react["default"].createElement("span", {
197
+ className: "hi-input__fix-box ".concat(hover && !disabled ? '' : 'invisible'),
198
+ onClick: function onClick() {
199
+ _this2._Input.focus();
200
+
201
+ var prefix = typeof _this2.props.prefix === 'undefined' ? '' : _this2.props.prefix;
202
+ var suffix = typeof _this2.props.suffix === 'undefined' ? '' : _this2.props.suffix;
203
+ var valueTrue = prefix + '' + suffix;
204
+
205
+ _this2.setState({
206
+ value: '',
207
+ valueTrue: valueTrue
208
+ }, function () {
209
+ var e = {
210
+ target: _this2._Input
211
+ };
212
+ _this2.props.onChange && _this2.props.onChange(e, '');
213
+ });
214
+ }
215
+ }, _react["default"].createElement("i", {
216
+ className: "hi-input__clear hi-input__suffix__icon hi-icon icon-close-circle"
217
+ })), // 后缀
218
+ suffix && _react["default"].createElement("span", {
219
+ id: suffixId,
220
+ className: "hi-input__suffix",
221
+ "data-value": suffix
222
+ }, suffix)), // 后置元素
223
+ append && _react["default"].createElement("span", {
224
+ className: "hi-input__append"
225
+ }, append));
226
+ }
227
+ /**
228
+ * 渲染 textarea
229
+ */
230
+
231
+ }, {
232
+ key: "renderTextarea",
233
+ value: function renderTextarea() {
234
+ var _this3 = this;
235
+
236
+ var active = this.state.active;
237
+ var disabled = this.props.disabled;
238
+ return _react["default"].createElement("textarea", (0, _extends2["default"])({
239
+ className: "hi-input ".concat(active ? 'active' : '', " ").concat(disabled ? 'disabled' : ''),
240
+ style: this.props.style,
241
+ autoComplete: "off",
242
+ value: this.state.value,
243
+ disabled: disabled
244
+ }, this.attrs, {
245
+ onChange: function onChange(e) {
246
+ e.persist();
247
+ var valueTrue = e.target.value;
248
+
249
+ _this3.setState({
250
+ value: valueTrue,
251
+ valueTrue: valueTrue
252
+ }, function () {
253
+ _this3.props.onChange && _this3.props.onChange(e, valueTrue);
254
+ });
255
+ },
256
+ onBlur: function onBlur(e) {
257
+ e.persist();
258
+ var valueTrue = e.target.value;
259
+
260
+ _this3.setState({
261
+ active: false
262
+ }, function () {
263
+ _this3.props.onBlur && _this3.props.onBlur(e, valueTrue);
264
+ });
265
+ },
266
+ onFocus: function onFocus(e) {
267
+ e.persist();
268
+ var valueTrue = e.target.value;
269
+
270
+ _this3.setState({
271
+ active: true
272
+ }, function () {
273
+ _this3.props.onFocus && _this3.props.onFocus(e, valueTrue);
274
+ });
275
+ },
276
+ onKeyDown: function onKeyDown(e) {
277
+ var valueTrue = e.target.value;
278
+ _this3.props.onKeyDown && _this3.props.onKeyDown(e, valueTrue);
279
+ },
280
+ onKeyUp: function onKeyUp(e) {
281
+ var valueTrue = e.target.value;
282
+ _this3.props.onKeyUp && _this3.props.onKeyUp(e, valueTrue);
283
+ },
284
+ onKeyPress: function onKeyPress(e) {
285
+ var valueTrue = e.target.value;
286
+ _this3.props.onKeyPress && _this3.props.onKeyPress(e, valueTrue);
287
+ },
288
+ onInput: function onInput(e) {
289
+ var valueTrue = e.target.value;
290
+ _this3.props.onInput && _this3.props.onInput(e, valueTrue);
291
+ },
292
+ onMouseOver: function onMouseOver(e) {
293
+ _this3.setState({
294
+ hover: true
295
+ });
296
+ },
297
+ onMouseLeave: function onMouseLeave(e) {
298
+ _this3.setState({
299
+ hover: false
300
+ });
301
+ }
302
+ }));
303
+ }
304
+ }, {
305
+ key: "render",
306
+ value: function render() {
307
+ var _this4 = this;
308
+
309
+ var type = this.attrs.type;
310
+ var _this$props2 = this.props,
311
+ size = _this$props2.size,
312
+ id = _this$props2.id,
313
+ className = _this$props2.className,
314
+ required = _this$props2.required;
315
+ return type === 'textarea' ? this.renderTextarea() : _react["default"].createElement("div", {
316
+ id: id,
317
+ className: "hi-input ".concat(className || '', " ").concat(type || '').concat(size ? ' hi-input_' + size : '').concat(required ? ' required' : ''),
318
+ style: this.props.style,
319
+ "data-value": this.state.valueTrue,
320
+ onClick: function onClick(e) {
321
+ _this4._Input.focus();
322
+ },
323
+ onMouseOver: function onMouseOver(e) {
324
+ _this4.setState({
325
+ hover: true
326
+ });
327
+ },
328
+ onMouseLeave: function onMouseLeave(e) {
329
+ _this4.setState({
330
+ hover: false
331
+ });
332
+ }
333
+ }, this.renderText());
334
+ }
335
+ }]);
336
+ return Input;
337
+ }(_react.Component);
338
+
339
+ (0, _defineProperty2["default"])(Input, "_Input", '');
340
+ var _default = Input;
341
+ exports["default"] = _default;
@@ -0,0 +1,176 @@
1
+ "use strict";
2
+
3
+ Object.defineProperty(exports, "__esModule", {
4
+ value: true
5
+ });
6
+ exports.formatValue = exports.formatAmount = exports.format = exports.formatCard = exports.formatTel = exports.formatId = exports.getAttrs = void 0;
7
+
8
+ /**
9
+ * 提取非函数属性
10
+ * @param {object} oldProps 原始props
11
+ */
12
+ var getAttrs = function getAttrs(oldProps) {
13
+ var noNeed = ['value', 'className', 'class', 'id', 'style', 'size', 'disabled'];
14
+ var attrs = {};
15
+ var events = {};
16
+
17
+ for (var i in oldProps) {
18
+ if (!(oldProps[i] instanceof Function)) {
19
+ if (noNeed.indexOf(i) === -1) {
20
+ attrs[i] = oldProps[i];
21
+ }
22
+ } else {
23
+ events[i] = oldProps[i];
24
+ }
25
+ }
26
+
27
+ return {
28
+ attrs: attrs,
29
+ events: events
30
+ };
31
+ };
32
+ /**
33
+ * 格式化身份证
34
+ */
35
+
36
+
37
+ exports.getAttrs = getAttrs;
38
+
39
+ var formatId = function formatId(val) {
40
+ val = val.replace(/[^a-zA-Z0-9]/g, '');
41
+ var len = val.length;
42
+
43
+ if (val === '' || len < 7) {
44
+ return val;
45
+ }
46
+
47
+ if (len < 11) {
48
+ return val.slice(0, 6) + ' ' + val.slice(6, 10);
49
+ } else if (len < 15) {
50
+ return val.slice(0, 6) + ' ' + val.slice(6, 10) + ' ' + val.slice(10, 14);
51
+ } else {
52
+ return val.slice(0, 6) + ' ' + val.slice(6, 10) + ' ' + val.slice(10, 14) + ' ' + val.slice(14, 18);
53
+ }
54
+ };
55
+ /**
56
+ * 格式化手机号
57
+ */
58
+
59
+
60
+ exports.formatId = formatId;
61
+
62
+ var formatTel = function formatTel(val) {
63
+ val = val.replace(/\D/g, '');
64
+ var len = val.length;
65
+
66
+ if (val === '' || len < 4) {
67
+ return val;
68
+ }
69
+
70
+ if (len < 8) {
71
+ return val.slice(0, 3) + ' ' + val.slice(3, 7);
72
+ } else {
73
+ return val.slice(0, 3) + ' ' + val.slice(3, 7) + ' ' + val.slice(7, 11);
74
+ }
75
+ };
76
+ /**
77
+ * 格式化银行卡号
78
+ */
79
+
80
+
81
+ exports.formatTel = formatTel;
82
+
83
+ var formatCard = function formatCard(val) {
84
+ val = val.replace(/\D/g, '');
85
+ var len = val.length;
86
+
87
+ if (val === '' || val.length < 5) {
88
+ return val;
89
+ }
90
+
91
+ if (len < 5) {
92
+ return val.slice(0, 4);
93
+ } else if (len < 9) {
94
+ return val.slice(0, 4) + ' ' + val.slice(4, 8);
95
+ } else if (len < 13) {
96
+ return val.slice(0, 4) + ' ' + val.slice(4, 8) + ' ' + val.slice(8, 12);
97
+ } else if (len < 17) {
98
+ return val.slice(0, 4) + ' ' + val.slice(4, 8) + ' ' + val.slice(8, 12) + ' ' + val.slice(12, 16);
99
+ } else {
100
+ return val.slice(0, 4) + ' ' + val.slice(4, 8) + ' ' + val.slice(8, 12) + ' ' + val.slice(12, 16) + ' ' + val.slice(16, 19);
101
+ }
102
+ };
103
+ /**
104
+ * 输入规则
105
+ * @param {string} val 需要处理的值
106
+ * @param {string} type 输入框类型
107
+ */
108
+
109
+
110
+ exports.formatCard = formatCard;
111
+
112
+ var format = function format(val, type) {
113
+ switch (type) {
114
+ case 'id':
115
+ return formatId(val);
116
+
117
+ case 'tel':
118
+ return formatTel(val);
119
+
120
+ case 'card':
121
+ return formatCard(val);
122
+
123
+ case 'email':
124
+ return val.replace(/\W/g, '');
125
+
126
+ case 'amount':
127
+ val = val.replace(/[^\d|.|,]/g, '');
128
+ return val;
129
+
130
+ default:
131
+ return val;
132
+ }
133
+ };
134
+ /**
135
+ * 金额自动生成小数
136
+ * @param {string} val 需要处理的值
137
+ */
138
+
139
+
140
+ exports.format = format;
141
+
142
+ var formatAmount = function formatAmount(val) {
143
+ return val.indexOf('.') > -1 ? val : val + '.00';
144
+ };
145
+ /**
146
+ * 净化数据
147
+ */
148
+
149
+
150
+ exports.formatAmount = formatAmount;
151
+
152
+ var formatValue = function formatValue(val, type) {
153
+ var numberType = ['id', 'tel', 'amount', 'card'];
154
+
155
+ if (numberType.indexOf(type) > -1) {
156
+ var tmp = val.replace(/[^\d|.]/g, '');
157
+
158
+ switch (type) {
159
+ case 'id':
160
+ return tmp.slice(0, 18);
161
+
162
+ case 'tel':
163
+ return tmp.slice(0, 11);
164
+
165
+ case 'card':
166
+ return tmp.slice(0, 19);
167
+
168
+ default:
169
+ return tmp;
170
+ }
171
+ } else {
172
+ return val;
173
+ }
174
+ };
175
+
176
+ exports.formatValue = formatValue;
@@ -1 +1 @@
1
- textarea.hi-input{-webkit-box-shadow:none;box-shadow:none;outline:none;color:#333;font-size:14px;min-height:30px;line-height:22px;resize:vertical;overflow:auto;height:100%;padding:4px 12px;border:1px solid #d8d8d8;-webkit-box-sizing:border-box;box-sizing:border-box;border-radius:2px;background-color:#fff;-webkit-transition:border-color 0.3s;transition:border-color 0.3s}textarea.hi-input:not(.disabled):hover{border-color:#4284f5}textarea.hi-input.active{border-color:#4284f5}textarea.hi-input.disabled{color:#ccc;background-color:#f2f2f2}textarea.hi-input::-webkit-input-placeholder{color:#ccc}textarea.hi-input:-moz-placeholder{color:#ccc}textarea.hi-input::-moz-placeholder{color:#ccc}textarea.hi-input:-ms-input-placeholder{color:#ccc}.hi-input,.hi-input_m{position:relative;display:inline-block;width:100%;height:32px;-webkit-box-sizing:border-box;box-sizing:border-box}.hi-input ::-webkit-input-placeholder,.hi-input_m ::-webkit-input-placeholder{color:#ccc}.hi-input :-moz-placeholder,.hi-input_m :-moz-placeholder{color:#ccc}.hi-input ::-moz-placeholder,.hi-input_m ::-moz-placeholder{color:#ccc}.hi-input :-ms-input-placeholder,.hi-input_m :-ms-input-placeholder{color:#ccc}.hi-input input,.hi-input_m input{-webkit-box-flex:1;-ms-flex:1 1 auto;flex:1 1 auto;border:none;outline:none;min-height:30px;-webkit-box-sizing:border-box;box-sizing:border-box;color:#333;font-size:14px;line-height:22px;-webkit-box-shadow:none;box-shadow:none}.hi-input input.disabled,.hi-input_m input.disabled{color:#ccc;background-color:#f2f2f2}.hi-input input[type='search'],.hi-input_m input[type='search']{-webkit-appearance:none}.hi-input ::-webkit-search-cancel-button,.hi-input_m ::-webkit-search-cancel-button{display:none}.hi-input .hi-input__out,.hi-input_m .hi-input__out{display:-webkit-box;display:-ms-flexbox;display:flex;-webkit-box-pack:justify;-ms-flex-pack:justify;justify-content:space-between;height:100%}.hi-input .hi-input__inner,.hi-input_m .hi-input__inner{position:relative;display:-webkit-box;display:-ms-flexbox;display:flex;width:100%;border:1px solid #d8d8d8;-webkit-box-sizing:border-box;box-sizing:border-box;border-radius:2px;background-color:#fff;-webkit-transition:border-color 0.3s;transition:border-color 0.3s}.hi-input .hi-input__inner:not(.disabled):hover,.hi-input_m .hi-input__inner:not(.disabled):hover{border-color:#4284f5}.hi-input .hi-input__inner.active,.hi-input_m .hi-input__inner.active{border-color:#4284f5}.hi-input .hi-input__inner.disabled,.hi-input_m .hi-input__inner.disabled{color:#ccc;background-color:#f2f2f2}.hi-input__fix-box,.hi-input_m__fix-box{display:inline-block;width:12px;height:auto;padding:0 18px 0 2px;-webkit-box-flex:1;-ms-flex:1 0 auto;flex:1 0 auto;cursor:pointer;opacity:1;-webkit-transition:all 0.3s;transition:all 0.3s}.hi-input__fix-box.invisible,.hi-input_m__fix-box.invisible{visibility:hidden;opacity:0}.hi-input__fix-box .hi-input__clear,.hi-input_m__fix-box .hi-input__clear{display:block;border-radius:50%;color:#666;font-size:14px;text-align:center}.hi-input__fix-box .hi-input__suffix__icon,.hi-input_m__fix-box .hi-input__suffix__icon{position:absolute;top:50%;width:14px;height:14px;line-height:14px;-webkit-transform:translateY(-50%);transform:translateY(-50%);font-size:14px}.hi-input__text,.hi-input_m__text{width:100%;padding:4px 12px}.hi-input__prefix,.hi-input__suffix,.hi-input_m__prefix,.hi-input_m__suffix{display:-webkit-box;display:-ms-flexbox;display:flex;-webkit-box-orient:vertical;-webkit-box-direction:normal;-ms-flex-direction:column;flex-direction:column;-ms-flex-pack:distribute;justify-content:space-around;-webkit-box-flex:1;-ms-flex:1 0 auto;flex:1 0 auto;color:#333;font-size:14px;line-height:30px}.hi-input__prefix,.hi-input_m__prefix{padding-left:12px}.hi-input__suffix,.hi-input_m__suffix{padding-right:12px}.hi-input--prepend .hi-input__inner,.hi-input_m--prepend .hi-input__inner{border-top-left-radius:0;border-bottom-left-radius:0}.hi-input__prepend .hi-btn,.hi-input__prepend .hi-select__input,.hi-input_m__prepend .hi-btn,.hi-input_m__prepend .hi-select__input{border-right-color:transparent;border-top-right-radius:0;border-bottom-right-radius:0;border-top-left-radius:2px;border-bottom-left-radius:2px}.hi-input--append .hi-input__inner,.hi-input_m--append .hi-input__inner{border-top-right-radius:0;border-bottom-right-radius:0}.hi-input__append .hi-btn,.hi-input__append .hi-select__input,.hi-input_m__append .hi-btn,.hi-input_m__append .hi-select__input{border-left-color:transparent;border-top-left-radius:0;border-bottom-left-radius:0;border-top-right-radius:2px;border-bottom-right-radius:2px}.hi-input.required::after,.hi-input_m.required::after{position:absolute;top:0;content:'*';right:-30px;width:30px;height:100%;display:-webkit-box;display:-ms-flexbox;display:flex;-ms-flex-pack:distribute;justify-content:space-around;-webkit-box-align:center;-ms-flex-align:center;align-items:center;color:#f00}
1
+ textarea.hi-input{display:block;-webkit-box-shadow:none;box-shadow:none;outline:none;color:#333;font-size:14px;min-height:32px;height:auto;line-height:22px;resize:vertical;overflow:auto;padding:4px 12px;border:1px solid #d8d8d8;-webkit-box-sizing:border-box;box-sizing:border-box;border-radius:2px;background-color:#fff;-webkit-transition:border-color 0.3s;transition:border-color 0.3s}textarea.hi-input:not(.disabled):hover{border-color:#4284f5}textarea.hi-input.active{border-color:#4284f5}textarea.hi-input.disabled{color:#ccc;background-color:#f2f2f2}textarea.hi-input::-webkit-input-placeholder{color:#ccc}textarea.hi-input:-moz-placeholder{color:#ccc}textarea.hi-input::-moz-placeholder{color:#ccc}textarea.hi-input:-ms-input-placeholder{color:#ccc}.hi-input,.hi-input_m{position:relative;display:inline-block;width:100%;height:32px;-webkit-box-sizing:border-box;box-sizing:border-box}.hi-input ::-webkit-input-placeholder,.hi-input_m ::-webkit-input-placeholder{color:#ccc}.hi-input :-moz-placeholder,.hi-input_m :-moz-placeholder{color:#ccc}.hi-input ::-moz-placeholder,.hi-input_m ::-moz-placeholder{color:#ccc}.hi-input :-ms-input-placeholder,.hi-input_m :-ms-input-placeholder{color:#ccc}.hi-input input,.hi-input_m input{-webkit-box-flex:1;-ms-flex:1 1 auto;flex:1 1 auto;border:none;outline:none;min-height:30px;-webkit-box-sizing:border-box;box-sizing:border-box;color:#333;font-size:14px;line-height:22px;-webkit-box-shadow:none;box-shadow:none}.hi-input input.disabled,.hi-input_m input.disabled{color:#ccc;background-color:#f2f2f2}.hi-input input[type='search'],.hi-input_m input[type='search']{-webkit-appearance:none}.hi-input ::-webkit-search-cancel-button,.hi-input_m ::-webkit-search-cancel-button{display:none}.hi-input .hi-input__out,.hi-input_m .hi-input__out{display:-webkit-box;display:-ms-flexbox;display:flex;-webkit-box-pack:justify;-ms-flex-pack:justify;justify-content:space-between;height:100%}.hi-input .hi-input__inner,.hi-input_m .hi-input__inner{position:relative;display:-webkit-box;display:-ms-flexbox;display:flex;width:100%;border:1px solid #d8d8d8;-webkit-box-sizing:border-box;box-sizing:border-box;border-radius:2px;background-color:#fff;-webkit-transition:border-color 0.3s;transition:border-color 0.3s}.hi-input .hi-input__inner:not(.disabled):hover,.hi-input_m .hi-input__inner:not(.disabled):hover{border-color:#4284f5}.hi-input .hi-input__inner.active,.hi-input_m .hi-input__inner.active{border-color:#4284f5}.hi-input .hi-input__inner.disabled,.hi-input_m .hi-input__inner.disabled{color:#ccc;background-color:#f2f2f2}.hi-input__fix-box,.hi-input_m__fix-box{display:inline-block;width:12px;height:auto;padding:0 18px 0 2px;-webkit-box-flex:1;-ms-flex:1 0 auto;flex:1 0 auto;cursor:pointer;opacity:1;-webkit-transition:all 0.3s;transition:all 0.3s}.hi-input__fix-box.invisible,.hi-input_m__fix-box.invisible{visibility:hidden;opacity:0}.hi-input__fix-box .hi-input__clear,.hi-input_m__fix-box .hi-input__clear{display:block;border-radius:50%;color:#666;font-size:14px;text-align:center}.hi-input__fix-box .hi-input__suffix__icon,.hi-input_m__fix-box .hi-input__suffix__icon{position:absolute;top:50%;width:14px;height:14px;line-height:14px;-webkit-transform:translateY(-50%);transform:translateY(-50%);font-size:14px}.hi-input__text,.hi-input_m__text{width:100%;padding:4px 12px}.hi-input__prefix,.hi-input__suffix,.hi-input_m__prefix,.hi-input_m__suffix{display:-webkit-box;display:-ms-flexbox;display:flex;-webkit-box-orient:vertical;-webkit-box-direction:normal;-ms-flex-direction:column;flex-direction:column;-ms-flex-pack:distribute;justify-content:space-around;-webkit-box-flex:1;-ms-flex:1 0 auto;flex:1 0 auto;color:#333;font-size:14px;line-height:30px}.hi-input__prefix,.hi-input_m__prefix{padding-left:12px}.hi-input__suffix,.hi-input_m__suffix{padding-right:12px}.hi-input--prepend .hi-input__inner,.hi-input_m--prepend .hi-input__inner{border-top-left-radius:0;border-bottom-left-radius:0}.hi-input__prepend .hi-btn,.hi-input__prepend .hi-select__input,.hi-input_m__prepend .hi-btn,.hi-input_m__prepend .hi-select__input{border-right-color:transparent;border-top-right-radius:0;border-bottom-right-radius:0;border-top-left-radius:2px;border-bottom-left-radius:2px}.hi-input--append .hi-input__inner,.hi-input_m--append .hi-input__inner{border-top-right-radius:0;border-bottom-right-radius:0}.hi-input__append,.hi-input_m__append{color:#4284f5}.hi-input__append .hi-btn,.hi-input__append .hi-select__input,.hi-input_m__append .hi-btn,.hi-input_m__append .hi-select__input{border-left-color:transparent;border-top-left-radius:0;border-bottom-left-radius:0;border-top-right-radius:2px;border-bottom-right-radius:2px}.hi-input.required::after,.hi-input_m.required::after{position:absolute;top:0;content:'*';right:-30px;width:30px;height:100%;display:-webkit-box;display:-ms-flexbox;display:flex;-ms-flex-pack:distribute;justify-content:space-around;-webkit-box-align:center;-ms-flex-align:center;align-items:center;color:#f00}.theme__hiui-blue.hi-input .hi-input__inner:not(.disabled):hover{border-color:#4285f4}.theme__hiui-blue.hi-input .hi-input__inner.active{border-color:#4285f4}.theme__hiui-blue.hi-input .hi-input--append .hi-input__append{color:#4285f4}textarea.hi-input.theme__hiui-blue:not(.disabled):hover{border-color:#4285f4}textarea.hi-input.theme__hiui-blue.active{border-color:#4285f4}.theme__orange.hi-input .hi-input__inner:not(.disabled):hover{border-color:#f63}.theme__orange.hi-input .hi-input__inner.active{border-color:#f63}.theme__orange.hi-input .hi-input--append .hi-input__append{color:#f63}textarea.hi-input.theme__orange:not(.disabled):hover{border-color:#f63}textarea.hi-input.theme__orange.active{border-color:#f63}.theme__cyan.hi-input .hi-input__inner:not(.disabled):hover{border-color:#46bc99}.theme__cyan.hi-input .hi-input__inner.active{border-color:#46bc99}.theme__cyan.hi-input .hi-input--append .hi-input__append{color:#46bc99}textarea.hi-input.theme__cyan:not(.disabled):hover{border-color:#46bc99}textarea.hi-input.theme__cyan.active{border-color:#46bc99}.theme__magenta.hi-input .hi-input__inner:not(.disabled):hover{border-color:#ff5975}.theme__magenta.hi-input .hi-input__inner.active{border-color:#ff5975}.theme__magenta.hi-input .hi-input--append .hi-input__append{color:#ff5975}textarea.hi-input.theme__magenta:not(.disabled):hover{border-color:#ff5975}textarea.hi-input.theme__magenta.active{border-color:#ff5975}.theme__lavender.hi-input .hi-input__inner:not(.disabled):hover{border-color:#b450de}.theme__lavender.hi-input .hi-input__inner.active{border-color:#b450de}.theme__lavender.hi-input .hi-input--append .hi-input__append{color:#b450de}textarea.hi-input.theme__lavender:not(.disabled):hover{border-color:#b450de}textarea.hi-input.theme__lavender.active{border-color:#b450de}.theme__blue.hi-input .hi-input__inner:not(.disabled):hover{border-color:#3da8f5}.theme__blue.hi-input .hi-input__inner.active{border-color:#3da8f5}.theme__blue.hi-input .hi-input--append .hi-input__append{color:#3da8f5}textarea.hi-input.theme__blue:not(.disabled):hover{border-color:#3da8f5}textarea.hi-input.theme__blue.active{border-color:#3da8f5}.theme__purple.hi-input .hi-input__inner:not(.disabled):hover{border-color:#8a8acb}.theme__purple.hi-input .hi-input__inner.active{border-color:#8a8acb}.theme__purple.hi-input .hi-input--append .hi-input__append{color:#8a8acb}textarea.hi-input.theme__purple:not(.disabled):hover{border-color:#8a8acb}textarea.hi-input.theme__purple.active{border-color:#8a8acb}
package/es/input/util.js CHANGED
@@ -3,12 +3,12 @@
3
3
  Object.defineProperty(exports, "__esModule", {
4
4
  value: true
5
5
  });
6
- exports.formatValue = exports.formatAmount = exports.format = exports.formatCard = exports.formatTel = exports.formatId = exports.getAttrs = void 0;
6
+ exports.filterObjProps = exports.formatValue = exports.formatAmount = exports.format = exports.formatCard = exports.formatTel = exports.formatId = exports.getAttrs = void 0;
7
7
 
8
8
  /**
9
- * 提取非函数属性
10
- * @param {object} oldProps 原始props
11
- */
9
+ * 提取非函数属性
10
+ * @param {object} oldProps 原始props
11
+ */
12
12
  var getAttrs = function getAttrs(oldProps) {
13
13
  var noNeed = ['value', 'className', 'class', 'id', 'style', 'size', 'disabled'];
14
14
  var attrs = {};
@@ -88,9 +88,7 @@ var formatCard = function formatCard(val) {
88
88
  return val;
89
89
  }
90
90
 
91
- if (len < 5) {
92
- return val.slice(0, 4);
93
- } else if (len < 9) {
91
+ if (len < 9) {
94
92
  return val.slice(0, 4) + ' ' + val.slice(4, 8);
95
93
  } else if (len < 13) {
96
94
  return val.slice(0, 4) + ' ' + val.slice(4, 8) + ' ' + val.slice(8, 12);
@@ -124,7 +122,9 @@ var format = function format(val, type) {
124
122
  return val.replace(/\W/g, '');
125
123
 
126
124
  case 'amount':
127
- val = val.replace(/[^\d|.|,]/g, '');
125
+ val = val.replace(/[^\d|.|,]/g, '').replace(/(\.\d*?)(\.|,).*/, function (_, $1) {
126
+ return $1;
127
+ });
128
128
  return val;
129
129
 
130
130
  default:
@@ -132,7 +132,7 @@ var format = function format(val, type) {
132
132
  }
133
133
  };
134
134
  /**
135
- * 浮点数
135
+ * 金额自动生成小数
136
136
  * @param {string} val 需要处理的值
137
137
  */
138
138
 
@@ -140,14 +140,7 @@ var format = function format(val, type) {
140
140
  exports.format = format;
141
141
 
142
142
  var formatAmount = function formatAmount(val) {
143
- if (val.includes('.')) {
144
- var valueArray = val.split('.');
145
- val = "".concat(+(valueArray[0] || 0), ".").concat(valueArray[1] || 0);
146
- } else {
147
- val = +val + '.0';
148
- }
149
-
150
- return val.includes(',') ? '0.0' : val;
143
+ return val.indexOf('.') > -1 ? val : val + '.00';
151
144
  };
152
145
  /**
153
146
  * 净化数据
@@ -179,5 +172,20 @@ var formatValue = function formatValue(val, type) {
179
172
  return val;
180
173
  }
181
174
  };
175
+ /**
176
+ * 过滤属性
177
+ */
178
+
179
+
180
+ exports.formatValue = formatValue;
181
+
182
+ var filterObjProps = function filterObjProps(obj, propsNeedFilter) {
183
+ return Object.keys(obj).filter(function (key) {
184
+ return !propsNeedFilter.includes(key);
185
+ }).reduce(function (filteredObj, key) {
186
+ filteredObj[key] = obj[key];
187
+ return filteredObj;
188
+ }, {});
189
+ };
182
190
 
183
- exports.formatValue = formatValue;
191
+ exports.filterObjProps = filterObjProps;
@@ -1,5 +1,7 @@
1
1
  "use strict";
2
2
 
3
+ var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault");
4
+
3
5
  Object.defineProperty(exports, "__esModule", {
4
6
  value: true
5
7
  });
@@ -9,8 +11,6 @@ var _reactDnd = require("react-dnd");
9
11
 
10
12
  var _reactDndHtml5Backend = _interopRequireDefault(require("react-dnd-html5-backend"));
11
13
 
12
- function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { "default": obj }; }
13
-
14
14
  var _default = (0, _reactDnd.DragDropContext)(_reactDndHtml5Backend["default"]);
15
15
 
16
16
  exports["default"] = _default;