@hi-ui/hiui 2.15.10 → 2.15.11
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +3 -0
- package/es/_util/warning.js +2 -2
- package/es/alert/__test__/index.test.js +67 -0
- package/es/alert/index.js +147 -6
- package/es/alert/style/index.css +1 -1
- package/es/badge/index.js +87 -9
- package/es/badge/style/index.css +1 -1
- package/es/badge/style/index.js +0 -0
- package/es/button/Button.js +51 -59
- package/es/button/ButtonGroup.js +31 -23
- package/es/button/IconLoading.js +2 -2
- package/es/button/__test__/index.test.js +29 -0
- package/es/button/index.js +2 -3
- package/es/button/style/index.css +1 -1
- package/es/card/index.js +42 -54
- package/es/card/style/index.css +1 -1
- package/es/cascader/Cascader.js +116 -181
- package/es/cascader/__test__/index.test.js +283 -0
- package/es/cascader/index.js +2 -5
- package/es/cascader/menu.js +155 -0
- package/es/cascader/style/cascader.css +1 -1
- package/es/cascader/style/menu.css +1 -1
- package/es/checkbox/{checkbox-legacy/Base.js → Base.js} +31 -46
- package/es/checkbox/CheckBox.js +185 -0
- package/es/checkbox/index.js +4 -13
- package/es/checkbox/style/index.css +1 -1
- package/es/collapse/__test__/index.test.js +58 -0
- package/es/collapse/index.js +93 -79
- package/es/collapse/style/index.css +1 -1
- package/es/confirm/index.js +50 -37
- package/es/context/index.js +37 -39
- package/es/counter/__test__/index.test.js +52 -0
- package/es/counter/index.js +270 -6
- package/es/counter/style/index.css +1 -1
- package/es/date-picker/BasePicker.js +288 -374
- package/es/date-picker/Calender.js +90 -326
- package/es/date-picker/DatePanel.js +186 -175
- package/es/date-picker/DatePicker.js +51 -151
- package/es/date-picker/DateRangePanel.js +181 -253
- package/es/date-picker/Modal.js +25 -15
- package/es/date-picker/Time.js +336 -230
- package/es/date-picker/TimePanel.js +32 -27
- package/es/date-picker/TimePeriodPanel.js +32 -21
- package/es/date-picker/TimePicker.js +40 -42
- package/es/date-picker/TimeRangePanel.js +42 -32
- package/es/date-picker/Type.js +1 -5
- package/es/date-picker/WeekRangePanel.js +150 -237
- package/es/date-picker/constants.js +28 -14
- package/es/date-picker/dateUtil.js +52 -221
- package/es/date-picker/index.js +2 -5
- package/es/date-picker/style/index.css +1 -1
- package/es/date-picker/util.js +8 -101
- package/es/dropdown/Dropdown.js +199 -193
- package/es/dropdown/{tests → __test__}/index.test.js +2 -2
- package/es/dropdown/index.js +4 -73
- package/es/dropdown/style/index.css +1 -1
- package/es/dropdown/style/index.js +2 -0
- package/es/ficon/index.js +23 -13
- package/es/form/index.js +171 -6
- package/es/form/{Item.js → item.js} +53 -53
- package/es/form/style/index.css +1 -1
- package/es/grid/index.js +37 -25
- package/es/icon/index.js +32 -21
- package/es/index.js +9 -61
- package/es/input/index.js +345 -28
- package/es/input/style/index.css +1 -1
- package/es/input/util.js +18 -26
- package/es/lib/withDragDropContext.js +2 -2
- package/es/loading/index.js +129 -5
- package/es/loading/style/index.css +0 -0
- package/es/loading/style/index.js +0 -0
- package/es/locales/en-US.js +11 -45
- package/es/locales/index.js +2 -16
- package/es/locales/zh-CN.js +12 -46
- package/es/menu/Item.js +41 -32
- package/es/menu/ItemGroup.js +81 -0
- package/es/menu/SubMenu.js +74 -55
- package/es/menu/Title.js +42 -36
- package/es/menu/index.js +419 -12
- package/es/menu/style/index.css +1 -1
- package/es/modal/__test__/index.test.js +123 -0
- package/es/modal/index.js +61 -77
- package/es/modal/style/index.css +1 -1
- package/es/nav-menu/NavMenu.js +45 -31
- package/es/nav-menu/__test__/index.test.js +2 -2
- package/es/nav-menu/index.js +2 -2
- package/es/notification/__test__/index.test.js +56 -0
- package/es/notification/index.js +231 -68
- package/es/notification/style/index.css +1 -1
- package/es/notification/style/index.js +0 -0
- package/es/pagination/Pager.js +8 -6
- package/es/pagination/Pagination.js +115 -124
- package/es/pagination/__test__/index.test.js +140 -0
- package/es/pagination/index.js +8 -9
- package/es/pagination/style/index.css +1 -1
- package/es/panel/index.js +33 -23
- package/es/popover/__test__/index.test.js +2 -2
- package/es/popover/index.js +69 -71
- package/es/popper/index.js +54 -64
- package/es/popper/style/index.css +1 -1
- package/es/progress/BarProgress.js +43 -109
- package/es/progress/CircleProgress.js +10 -9
- package/es/progress/DashboardProgress.js +9 -7
- package/es/progress/index.js +100 -8
- package/es/progress/style/index.css +1 -1
- package/es/radio/{radio-legacy/__test__ → __test__}/index.test.js +10 -10
- package/es/radio/index.js +216 -10
- package/es/radio/style/index.css +1 -1
- package/es/rate/Icons.js +2 -2
- package/es/rate/Rate.js +90 -65
- package/es/rate/__test__/index.test.js +54 -0
- package/es/rate/index.js +2 -5
- package/es/rate/style/index.css +1 -1
- package/es/select/Option.js +93 -0
- package/es/select/Select.js +253 -325
- package/es/select/SelectDropdown.js +63 -215
- package/es/select/SelectInput.js +54 -88
- package/es/select/__test__/index.test.js +429 -0
- package/es/select/index.js +4 -6
- package/es/select/style/select-dropdown.css +1 -1
- package/es/select/style/select-input.css +1 -1
- package/es/stepper/index.js +127 -21
- package/es/stepper/style/index.css +1 -1
- package/es/style/color/colors.css +0 -0
- package/es/style/icon/diyIcon.css +1 -1
- package/es/style/icon/index.css +1 -1
- package/es/style/index.css +0 -0
- package/es/style/mixins/colors.css +0 -0
- package/es/style/mixins/index.css +0 -0
- package/es/style/theme/dark.css +0 -0
- package/es/style/theme/default.css +0 -0
- package/es/switch/{__tests__ → __test__}/index.test.js +2 -31
- package/es/switch/index.js +36 -24
- package/es/switch/style/index.css +1 -1
- package/es/table/__test__/index.test.js +73 -0
- package/es/table/{Body.js → body.js} +52 -36
- package/es/table/checkbox/index.js +36 -33
- package/es/table/clickOuterside.js +115 -0
- package/es/table/{Footer.js → footer.js} +41 -24
- package/es/table/{Header.js → header.js} +54 -41
- package/es/table/index.js +300 -262
- package/es/table/menu/index.js +34 -32
- package/es/table/pover.js +154 -0
- package/es/table/prefix.js +2 -2
- package/es/table/style/Table.css +1 -1
- package/es/table/style/index.css +1 -1
- package/es/table/tableContent.js +120 -0
- package/es/tabs/ItemDropdown.js +51 -39
- package/es/tabs/TabPane.js +35 -25
- package/es/tabs/Tabs.js +91 -98
- package/es/tabs/index.js +3 -9
- package/es/tabs/style/index.css +1 -1
- package/es/timeline/__test__/index.test.js +49 -0
- package/es/timeline/foldingItem.js +82 -0
- package/es/timeline/index.js +127 -203
- package/es/timeline/style/index.css +1 -1
- package/es/tooltip/__test__/index.test.js +67 -0
- package/es/tooltip/index.js +39 -86
- package/es/tooltip/style/index.css +1 -1
- package/es/transfer/Item.js +44 -53
- package/es/transfer/__test__/index.test.js +11 -0
- package/es/transfer/index.js +443 -4
- package/es/transfer/style/index.css +1 -1
- package/es/tree/Tree.js +86 -76
- package/es/tree/TreeDivider.js +3 -3
- package/es/tree/TreeItem.js +108 -204
- package/es/tree/TreeNode.js +318 -457
- package/es/tree/index.js +2 -9
- package/es/tree/style/index.css +1 -1
- package/es/tree/util.js +257 -9
- package/es/upload/{upload-legacy/Preview.js → Preview.js} +39 -33
- package/es/upload/Upload.js +193 -289
- package/es/upload/UploadAvatar.js +58 -44
- package/es/upload/UploadClick.js +45 -49
- package/es/upload/UploadDrag.js +43 -44
- package/es/upload/UploadPhoto.js +55 -70
- package/es/upload/UploadPictureCard.js +44 -39
- package/es/upload/index.js +71 -8
- package/es/upload/style/index.css +1 -1
- package/es/upload/tool.js +1 -0
- package/package.json +4 -1
- package/es/_util/SwitchVersion.js +0 -44
- package/es/_util/depreactedPropsCompat.js +0 -58
- package/es/_util/index.js +0 -32
- package/es/alert/Alert.js +0 -134
- package/es/alert/__tests__/index.test.js +0 -88
- package/es/badge/Badge.js +0 -90
- package/es/badge/__tests__/index.test.js +0 -82
- package/es/breadcrumb/__tests__/index.test.js +0 -61
- package/es/breadcrumb/index.js +0 -93
- package/es/breadcrumb/style/index.css +0 -1
- package/es/button/__tests__/index.test.js +0 -219
- package/es/card/__tests__/index.test.js +0 -169
- package/es/carousel/__tests__/index.test.js +0 -104
- package/es/carousel/index.js +0 -227
- package/es/carousel/style/index.css +0 -1
- package/es/carousel/style/index.js +0 -3
- package/es/cascader/Menu.js +0 -174
- package/es/cascader/__tests__/index.test.js +0 -389
- package/es/checkbox/Checkbox.js +0 -144
- package/es/checkbox/Group.js +0 -202
- package/es/checkbox/__tests__/index.test.js +0 -226
- package/es/checkbox/checkbox-legacy/CheckBox.js +0 -165
- package/es/checkbox/checkbox-legacy/index.js +0 -15
- package/es/checkbox/checkbox-legacy/style/index.css +0 -1
- package/es/checkbox/checkbox-legacy/style/index.js +0 -3
- package/es/collapse/__tests__/index.test.js +0 -111
- package/es/counter/Counter.js +0 -343
- package/es/counter/__tests__/index.test.js +0 -134
- package/es/counter/counter-legacy/index.js +0 -271
- package/es/date-picker/TimeList.js +0 -254
- package/es/date-picker/YMRangePanel.js +0 -372
- package/es/date-picker/__tests__/index.test.js +0 -961
- package/es/date-picker/datepicker-legacy/BasePicker.js +0 -519
- package/es/date-picker/datepicker-legacy/Calender.js +0 -430
- package/es/date-picker/datepicker-legacy/DatePanel.js +0 -463
- package/es/date-picker/datepicker-legacy/DatePicker.js +0 -107
- package/es/date-picker/datepicker-legacy/DateRangePanel.js +0 -496
- package/es/date-picker/datepicker-legacy/Modal.js +0 -71
- package/es/date-picker/datepicker-legacy/Time.js +0 -413
- package/es/date-picker/datepicker-legacy/TimePanel.js +0 -93
- package/es/date-picker/datepicker-legacy/TimePeriodPanel.js +0 -126
- package/es/date-picker/datepicker-legacy/TimePicker.js +0 -82
- package/es/date-picker/datepicker-legacy/TimeRangePanel.js +0 -98
- package/es/date-picker/datepicker-legacy/Type.js +0 -31
- package/es/date-picker/datepicker-legacy/WeekRangePanel.js +0 -345
- package/es/date-picker/datepicker-legacy/constants.js +0 -79
- package/es/date-picker/datepicker-legacy/dateUtil.js +0 -258
- package/es/date-picker/datepicker-legacy/index.js +0 -15
- package/es/date-picker/datepicker-legacy/local.js +0 -11
- package/es/date-picker/datepicker-legacy/style/index.css +0 -1
- package/es/date-picker/datepicker-legacy/style/index.js +0 -3
- package/es/date-picker/datepicker-legacy/style/timepicker.css +0 -1
- package/es/date-picker/datepicker-legacy/util.js +0 -60
- package/es/date-picker/toLunar.js +0 -172
- package/es/dropdown/DropdownButton.js +0 -106
- package/es/dropdown/DropdownMenu.js +0 -111
- package/es/dropdown/DropdownMenuItem.js +0 -178
- package/es/dropdown/__tests__/index.test.js +0 -317
- package/es/dropdown/utils.js +0 -35
- package/es/form/Form.js +0 -184
- package/es/form/__tests__/index.test.js +0 -575
- package/es/grid/__tests__/index.test.js +0 -104
- package/es/input/Input.js +0 -412
- package/es/input/__tests__/index.test.js +0 -381
- package/es/input/input-legacy/index.js +0 -353
- package/es/input/input-legacy/util.js +0 -176
- package/es/loading/Loading.js +0 -181
- package/es/loading/__tests__/index.test.js +0 -110
- package/es/locales/zh-Hant-HK.js +0 -121
- package/es/locales/zh-Hant-TW.js +0 -123
- package/es/menu/Menu.js +0 -422
- package/es/menu/__tests__/index.test.js +0 -279
- package/es/message/__tests__/index.test.js +0 -75
- package/es/message/index.js +0 -58
- package/es/message/style/index.css +0 -1
- package/es/message/style/index.js +0 -5
- package/es/modal/__tests__/index.test.js +0 -178
- package/es/nav-menu/__tests__/index.test.js +0 -27
- package/es/notice/Notice.js +0 -142
- package/es/notice/NoticeContainer.js +0 -113
- package/es/notice/__tests__/index.test.js +0 -174
- package/es/notice/index.js +0 -66
- package/es/notice/style/index.css +0 -1
- package/es/notice/style/index.js +0 -5
- package/es/notification/HandleNotification/index.js +0 -224
- package/es/notification/HandleNotification/style/index.css +0 -1
- package/es/notification/HandleNotification/style/index.js +0 -5
- package/es/notification/__tests__/index.test.js +0 -118
- package/es/pagination/__tests__/index.test.js +0 -248
- package/es/popover/__tests__/index.test.js +0 -152
- package/es/preview/index.js +0 -527
- package/es/preview/style/index.css +0 -1
- package/es/preview/style/index.js +0 -3
- package/es/progress/Progress.js +0 -110
- package/es/progress/__tests__/index.test.js +0 -131
- package/es/radio/Group.js +0 -203
- package/es/radio/Radio.js +0 -151
- package/es/radio/__tests__/index.test.js +0 -128
- package/es/radio/radio-legacy/index.js +0 -222
- package/es/radio/radio-legacy/style/index.css +0 -1
- package/es/radio/radio-legacy/style/index.js +0 -3
- package/es/rate/__tests__/index.test.js +0 -124
- package/es/select/__tests__/index.test.js +0 -505
- package/es/select/select-legacy/Option.js +0 -81
- package/es/select/select-legacy/Select.js +0 -710
- package/es/select/select-legacy/SelectDropdown.js +0 -164
- package/es/select/select-legacy/SelectInput.js +0 -312
- package/es/select/select-legacy/common.js +0 -19
- package/es/select/select-legacy/index.js +0 -16
- package/es/stepper/Stepper.js +0 -151
- package/es/stepper/__tests__/index.test.js +0 -161
- package/es/table/ClickOuterside.js +0 -103
- package/es/table/TableContent.js +0 -109
- package/es/table/__tests__/index.test.js +0 -133
- package/es/table/checkbox/style/index.css +0 -1
- package/es/table/checkbox/style/index.js +0 -3
- package/es/tabs/__tests__/index.test.js +0 -333
- package/es/tabs/tabs-legacy/ItemDropdown.js +0 -170
- package/es/tabs/tabs-legacy/TabPane.js +0 -78
- package/es/tabs/tabs-legacy/Tabs.js +0 -299
- package/es/tabs/tabs-legacy/index.js +0 -18
- package/es/tabs/tabs-legacy/style/index.css +0 -1
- package/es/tabs/tabs-legacy/style/index.js +0 -3
- package/es/tag/__tests__/index.test.js +0 -46
- package/es/tag/index.js +0 -94
- package/es/tag/style/index.css +0 -1
- package/es/tag/style/index.js +0 -3
- package/es/timeline/__tests__/index.test.js +0 -198
- package/es/tooltip/__tests__/index.test.js +0 -170
- package/es/transfer/Transfer.js +0 -566
- package/es/transfer/__tests__/index.test.js +0 -210
- package/es/tree/IconLoading.js +0 -38
- package/es/tree/__tests__/index.test.js +0 -603
- package/es/tree/tree-legacy/Tree.js +0 -337
- package/es/tree/tree-legacy/TreeDivider.js +0 -25
- package/es/tree/tree-legacy/TreeItem.js +0 -333
- package/es/tree/tree-legacy/TreeNode.js +0 -719
- package/es/tree/tree-legacy/index.js +0 -13
- package/es/tree/tree-legacy/style/index.css +0 -1
- package/es/tree/tree-legacy/style/index.js +0 -3
- package/es/tree/tree-legacy/util.js +0 -434
- package/es/upload/__tests__/index.test.js +0 -760
- package/es/upload/main.js +0 -91
- package/es/upload/upload-legacy/Upload.js +0 -435
- package/es/upload/upload-legacy/UploadAvatar.js +0 -322
- package/es/upload/upload-legacy/UploadClick.js +0 -125
- package/es/upload/upload-legacy/UploadDrag.js +0 -180
- package/es/upload/upload-legacy/UploadPhoto.js +0 -183
- package/es/upload/upload-legacy/UploadPictureCard.js +0 -126
- package/es/upload/upload-legacy/index.js +0 -75
- package/es/upload/upload-legacy/style/index.css +0 -1
- package/es/upload/upload-legacy/style/index.js +0 -5
- package/es/upload/upload-legacy/tool.js +0 -84
- package/es/watermark/index.js +0 -101
- package/es/watermark/watermark.js +0 -252
- /package/es/checkbox/{checkbox-legacy/common.js → common.js} +0 -0
- /package/es/{breadcrumb/style → style}/index.js +0 -0
- /package/es/upload/{upload-legacy/style → style}/preview.css +0 -0
- /package/es/upload/{upload-legacy/style → style}/preview.js +0 -0
|
@@ -1,353 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
|
|
3
|
-
var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault");
|
|
4
|
-
|
|
5
|
-
var _typeof3 = require("@babel/runtime/helpers/typeof");
|
|
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 _inherits2 = _interopRequireDefault(require("@babel/runtime/helpers/inherits"));
|
|
21
|
-
|
|
22
|
-
var _possibleConstructorReturn2 = _interopRequireDefault(require("@babel/runtime/helpers/possibleConstructorReturn"));
|
|
23
|
-
|
|
24
|
-
var _getPrototypeOf2 = _interopRequireDefault(require("@babel/runtime/helpers/getPrototypeOf"));
|
|
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
|
-
function _getRequireWildcardCache(nodeInterop) { if (typeof WeakMap !== "function") return null; var cacheBabelInterop = new WeakMap(); var cacheNodeInterop = new WeakMap(); return (_getRequireWildcardCache = function _getRequireWildcardCache(nodeInterop) { return nodeInterop ? cacheNodeInterop : cacheBabelInterop; })(nodeInterop); }
|
|
35
|
-
|
|
36
|
-
function _interopRequireWildcard(obj, nodeInterop) { if (!nodeInterop && obj && obj.__esModule) { return obj; } if (obj === null || _typeof3(obj) !== "object" && typeof obj !== "function") { return { "default": obj }; } var cache = _getRequireWildcardCache(nodeInterop); if (cache && cache.has(obj)) { return cache.get(obj); } var newObj = {}; var hasPropertyDescriptor = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var key in obj) { if (key !== "default" && Object.prototype.hasOwnProperty.call(obj, key)) { var desc = hasPropertyDescriptor ? Object.getOwnPropertyDescriptor(obj, key) : null; if (desc && (desc.get || desc.set)) { Object.defineProperty(newObj, key, desc); } else { newObj[key] = obj[key]; } } } newObj["default"] = obj; if (cache) { cache.set(obj, newObj); } return newObj; }
|
|
37
|
-
|
|
38
|
-
function _createSuper(Derived) { var hasNativeReflectConstruct = _isNativeReflectConstruct(); return function _createSuperInternal() { var Super = (0, _getPrototypeOf2["default"])(Derived), result; if (hasNativeReflectConstruct) { var NewTarget = (0, _getPrototypeOf2["default"])(this).constructor; result = Reflect.construct(Super, arguments, NewTarget); } else { result = Super.apply(this, arguments); } return (0, _possibleConstructorReturn2["default"])(this, result); }; }
|
|
39
|
-
|
|
40
|
-
function _isNativeReflectConstruct() { if (typeof Reflect === "undefined" || !Reflect.construct) return false; if (Reflect.construct.sham) return false; if (typeof Proxy === "function") return true; try { Boolean.prototype.valueOf.call(Reflect.construct(Boolean, [], function () {})); return true; } catch (e) { return false; } }
|
|
41
|
-
|
|
42
|
-
/**
|
|
43
|
-
* 自定义属性全小写;原声属性驼峰法
|
|
44
|
-
* @prop type 输入框类型
|
|
45
|
-
*/
|
|
46
|
-
var Input = /*#__PURE__*/function (_Component) {
|
|
47
|
-
(0, _inherits2["default"])(Input, _Component);
|
|
48
|
-
|
|
49
|
-
var _super = _createSuper(Input);
|
|
50
|
-
|
|
51
|
-
function Input(props) {
|
|
52
|
-
var _this;
|
|
53
|
-
|
|
54
|
-
(0, _classCallCheck2["default"])(this, Input);
|
|
55
|
-
_this = _super.call(this, props); // 传入属性
|
|
56
|
-
|
|
57
|
-
var commonAttrs = {
|
|
58
|
-
type: 'text',
|
|
59
|
-
size: 'm',
|
|
60
|
-
prefixicon: '',
|
|
61
|
-
suffixicon: '',
|
|
62
|
-
prefix: '',
|
|
63
|
-
suffix: ''
|
|
64
|
-
};
|
|
65
|
-
var oldProps = Object.assign({}, commonAttrs, _this.props);
|
|
66
|
-
var newProps = (0, _util.getAttrs)(oldProps); // 分离有效属性和事件
|
|
67
|
-
|
|
68
|
-
_this.attrs = newProps.attrs;
|
|
69
|
-
var type = (0, _typeof2["default"])(_this.props.value);
|
|
70
|
-
var prefix = typeof _this.props.prefix === 'undefined' ? '' : _this.props.prefix;
|
|
71
|
-
var suffix = typeof _this.props.suffix === 'undefined' ? '' : _this.props.suffix;
|
|
72
|
-
_this.state = {
|
|
73
|
-
value: type === 'string' || type === 'number' ? (0, _util.format)(_this.props.value, _this.props.type) : '',
|
|
74
|
-
valueTrue: prefix + _this.props.value + suffix,
|
|
75
|
-
hover: false,
|
|
76
|
-
active: false
|
|
77
|
-
};
|
|
78
|
-
return _this;
|
|
79
|
-
}
|
|
80
|
-
|
|
81
|
-
(0, _createClass2["default"])(Input, [{
|
|
82
|
-
key: "componentWillReceiveProps",
|
|
83
|
-
value: function componentWillReceiveProps(nextProps) {
|
|
84
|
-
if (nextProps.value !== undefined) {
|
|
85
|
-
if (nextProps.value !== this.state.value) {
|
|
86
|
-
this.setState({
|
|
87
|
-
value: (0, _util.format)(nextProps.value, this.props.type),
|
|
88
|
-
valueTrue: nextProps.value
|
|
89
|
-
});
|
|
90
|
-
}
|
|
91
|
-
}
|
|
92
|
-
}
|
|
93
|
-
/**
|
|
94
|
-
* 渲染 text 输入框
|
|
95
|
-
*/
|
|
96
|
-
|
|
97
|
-
}, {
|
|
98
|
-
key: "renderText",
|
|
99
|
-
value: function renderText() {
|
|
100
|
-
var _this2 = this;
|
|
101
|
-
|
|
102
|
-
var _this$state = this.state,
|
|
103
|
-
hover = _this$state.hover,
|
|
104
|
-
active = _this$state.active,
|
|
105
|
-
value = _this$state.value;
|
|
106
|
-
var _this$props = this.props,
|
|
107
|
-
disabled = _this$props.disabled,
|
|
108
|
-
type = _this$props.type,
|
|
109
|
-
prefix = _this$props.prefix,
|
|
110
|
-
suffix = _this$props.suffix,
|
|
111
|
-
prepend = _this$props.prepend,
|
|
112
|
-
append = _this$props.append,
|
|
113
|
-
id = _this$props.id,
|
|
114
|
-
placeholder = _this$props.placeholder;
|
|
115
|
-
var noClear = ['textarea'];
|
|
116
|
-
var prefixId = id ? id + '_prefix' : '';
|
|
117
|
-
var suffixId = id ? id + '_suffix' : '';
|
|
118
|
-
return /*#__PURE__*/_react["default"].createElement("div", {
|
|
119
|
-
className: (0, _classnames["default"])('hi-input__out', {
|
|
120
|
-
'hi-input--prepend': prepend,
|
|
121
|
-
'hi-input--append': append
|
|
122
|
-
})
|
|
123
|
-
}, // 前置元素
|
|
124
|
-
prepend && /*#__PURE__*/_react["default"].createElement("span", {
|
|
125
|
-
className: "hi-input__prepend"
|
|
126
|
-
}, prepend), /*#__PURE__*/_react["default"].createElement("div", {
|
|
127
|
-
className: "hi-input__inner".concat(active ? ' active' : '').concat(disabled ? ' disabled' : '')
|
|
128
|
-
}, // 前缀
|
|
129
|
-
prefix && /*#__PURE__*/_react["default"].createElement("span", {
|
|
130
|
-
id: prefixId,
|
|
131
|
-
className: "hi-input__prefix",
|
|
132
|
-
"data-value": prefix
|
|
133
|
-
}, prefix), /*#__PURE__*/_react["default"].createElement("input", (0, _extends2["default"])({
|
|
134
|
-
ref: function ref(arg) {
|
|
135
|
-
_this2._Input = arg;
|
|
136
|
-
},
|
|
137
|
-
className: "hi-input__text ".concat(disabled ? 'disabled' : ''),
|
|
138
|
-
value: this.state.value,
|
|
139
|
-
autoComplete: "off",
|
|
140
|
-
disabled: disabled
|
|
141
|
-
}, this.attrs, {
|
|
142
|
-
placeholder: placeholder,
|
|
143
|
-
onChange: function onChange(e) {
|
|
144
|
-
e.persist();
|
|
145
|
-
var value = e.target.value;
|
|
146
|
-
var valueTrue = (0, _util.formatValue)(value, type);
|
|
147
|
-
|
|
148
|
-
if (prefix) {
|
|
149
|
-
valueTrue = prefix + valueTrue;
|
|
150
|
-
}
|
|
151
|
-
|
|
152
|
-
if (suffix) {
|
|
153
|
-
valueTrue = valueTrue + suffix;
|
|
154
|
-
}
|
|
155
|
-
|
|
156
|
-
value = (0, _util.format)(value, type);
|
|
157
|
-
|
|
158
|
-
_this2.setState({
|
|
159
|
-
value: value,
|
|
160
|
-
valueTrue: valueTrue
|
|
161
|
-
}, function () {
|
|
162
|
-
_this2.props.onChange && _this2.props.onChange(e, valueTrue);
|
|
163
|
-
});
|
|
164
|
-
},
|
|
165
|
-
onBlur: function onBlur(e) {
|
|
166
|
-
e.persist();
|
|
167
|
-
var value = e.target.value;
|
|
168
|
-
var valueTrue = _this2.state.valueTrue; // amount 自动添加小数
|
|
169
|
-
|
|
170
|
-
if (_this2.props.type === 'amount' && value !== '') {
|
|
171
|
-
value = (0, _util.formatAmount)(value);
|
|
172
|
-
}
|
|
173
|
-
|
|
174
|
-
_this2.setState({
|
|
175
|
-
active: false,
|
|
176
|
-
value: value
|
|
177
|
-
}, function () {
|
|
178
|
-
_this2.props.onBlur && _this2.props.onBlur(e, valueTrue);
|
|
179
|
-
});
|
|
180
|
-
},
|
|
181
|
-
onFocus: function onFocus(e) {
|
|
182
|
-
e.persist();
|
|
183
|
-
var valueTrue = _this2.state.valueTrue;
|
|
184
|
-
|
|
185
|
-
_this2.setState({
|
|
186
|
-
active: true
|
|
187
|
-
}, function () {
|
|
188
|
-
_this2.props.onFocus && _this2.props.onFocus(e, valueTrue);
|
|
189
|
-
});
|
|
190
|
-
},
|
|
191
|
-
onKeyDown: function onKeyDown(e) {
|
|
192
|
-
var valueTrue = _this2.state.valueTrue;
|
|
193
|
-
_this2.props.onKeyDown && _this2.props.onKeyDown(e, valueTrue);
|
|
194
|
-
},
|
|
195
|
-
onKeyUp: function onKeyUp(e) {
|
|
196
|
-
var valueTrue = _this2.state.valueTrue;
|
|
197
|
-
_this2.props.onKeyUp && _this2.props.onKeyUp(e, valueTrue);
|
|
198
|
-
},
|
|
199
|
-
onKeyPress: function onKeyPress(e) {
|
|
200
|
-
var valueTrue = _this2.state.valueTrue;
|
|
201
|
-
_this2.props.onKeyPress && _this2.props.onKeyPress(e, valueTrue);
|
|
202
|
-
},
|
|
203
|
-
onInput: function onInput(e) {
|
|
204
|
-
var valueTrue = _this2.state.valueTrue;
|
|
205
|
-
_this2.props.onInput && _this2.props.onInput(e, valueTrue);
|
|
206
|
-
}
|
|
207
|
-
})), // 清除
|
|
208
|
-
noClear.indexOf(type) === -1 && typeof prefix === 'undefined' && typeof suffix === 'undefined' && value !== '' && /*#__PURE__*/_react["default"].createElement("span", {
|
|
209
|
-
className: "hi-input__fix-box ".concat(hover && !disabled ? '' : 'invisible'),
|
|
210
|
-
onClick: function onClick() {
|
|
211
|
-
_this2._Input.focus();
|
|
212
|
-
|
|
213
|
-
var prefix = typeof _this2.props.prefix === 'undefined' ? '' : _this2.props.prefix;
|
|
214
|
-
var suffix = typeof _this2.props.suffix === 'undefined' ? '' : _this2.props.suffix;
|
|
215
|
-
var valueTrue = prefix + '' + suffix;
|
|
216
|
-
|
|
217
|
-
_this2.setState({
|
|
218
|
-
value: '',
|
|
219
|
-
valueTrue: valueTrue
|
|
220
|
-
}, function () {
|
|
221
|
-
var e = {
|
|
222
|
-
target: _this2._Input
|
|
223
|
-
};
|
|
224
|
-
_this2.props.onChange && _this2.props.onChange(e, '');
|
|
225
|
-
});
|
|
226
|
-
}
|
|
227
|
-
}, /*#__PURE__*/_react["default"].createElement("i", {
|
|
228
|
-
className: "hi-input__clear hi-input__suffix__icon hi-icon icon-close-circle"
|
|
229
|
-
})), // 后缀
|
|
230
|
-
suffix && /*#__PURE__*/_react["default"].createElement("span", {
|
|
231
|
-
id: suffixId,
|
|
232
|
-
className: "hi-input__suffix",
|
|
233
|
-
"data-value": suffix
|
|
234
|
-
}, suffix)), // 后置元素
|
|
235
|
-
append && /*#__PURE__*/_react["default"].createElement("span", {
|
|
236
|
-
className: "hi-input__append"
|
|
237
|
-
}, append));
|
|
238
|
-
}
|
|
239
|
-
/**
|
|
240
|
-
* 渲染 textarea
|
|
241
|
-
*/
|
|
242
|
-
|
|
243
|
-
}, {
|
|
244
|
-
key: "renderTextarea",
|
|
245
|
-
value: function renderTextarea() {
|
|
246
|
-
var _this3 = this;
|
|
247
|
-
|
|
248
|
-
var active = this.state.active;
|
|
249
|
-
var disabled = this.props.disabled;
|
|
250
|
-
return /*#__PURE__*/_react["default"].createElement("textarea", (0, _extends2["default"])({
|
|
251
|
-
className: "hi-input ".concat(active ? 'active' : '', " ").concat(disabled ? 'disabled' : ''),
|
|
252
|
-
style: this.props.style,
|
|
253
|
-
autoComplete: "off",
|
|
254
|
-
value: this.state.value,
|
|
255
|
-
disabled: disabled
|
|
256
|
-
}, this.attrs, {
|
|
257
|
-
onChange: function onChange(e) {
|
|
258
|
-
e.persist();
|
|
259
|
-
var valueTrue = e.target.value;
|
|
260
|
-
|
|
261
|
-
_this3.setState({
|
|
262
|
-
value: valueTrue,
|
|
263
|
-
valueTrue: valueTrue
|
|
264
|
-
}, function () {
|
|
265
|
-
_this3.props.onChange && _this3.props.onChange(e, valueTrue);
|
|
266
|
-
});
|
|
267
|
-
},
|
|
268
|
-
onBlur: function onBlur(e) {
|
|
269
|
-
e.persist();
|
|
270
|
-
var valueTrue = e.target.value;
|
|
271
|
-
|
|
272
|
-
_this3.setState({
|
|
273
|
-
active: false
|
|
274
|
-
}, function () {
|
|
275
|
-
_this3.props.onBlur && _this3.props.onBlur(e, valueTrue);
|
|
276
|
-
});
|
|
277
|
-
},
|
|
278
|
-
onFocus: function onFocus(e) {
|
|
279
|
-
e.persist();
|
|
280
|
-
var valueTrue = e.target.value;
|
|
281
|
-
|
|
282
|
-
_this3.setState({
|
|
283
|
-
active: true
|
|
284
|
-
}, function () {
|
|
285
|
-
_this3.props.onFocus && _this3.props.onFocus(e, valueTrue);
|
|
286
|
-
});
|
|
287
|
-
},
|
|
288
|
-
onKeyDown: function onKeyDown(e) {
|
|
289
|
-
var valueTrue = e.target.value;
|
|
290
|
-
_this3.props.onKeyDown && _this3.props.onKeyDown(e, valueTrue);
|
|
291
|
-
},
|
|
292
|
-
onKeyUp: function onKeyUp(e) {
|
|
293
|
-
var valueTrue = e.target.value;
|
|
294
|
-
_this3.props.onKeyUp && _this3.props.onKeyUp(e, valueTrue);
|
|
295
|
-
},
|
|
296
|
-
onKeyPress: function onKeyPress(e) {
|
|
297
|
-
var valueTrue = e.target.value;
|
|
298
|
-
_this3.props.onKeyPress && _this3.props.onKeyPress(e, valueTrue);
|
|
299
|
-
},
|
|
300
|
-
onInput: function onInput(e) {
|
|
301
|
-
var valueTrue = e.target.value;
|
|
302
|
-
_this3.props.onInput && _this3.props.onInput(e, valueTrue);
|
|
303
|
-
},
|
|
304
|
-
onMouseOver: function onMouseOver(e) {
|
|
305
|
-
_this3.setState({
|
|
306
|
-
hover: true
|
|
307
|
-
});
|
|
308
|
-
},
|
|
309
|
-
onMouseLeave: function onMouseLeave(e) {
|
|
310
|
-
_this3.setState({
|
|
311
|
-
hover: false
|
|
312
|
-
});
|
|
313
|
-
}
|
|
314
|
-
}));
|
|
315
|
-
}
|
|
316
|
-
}, {
|
|
317
|
-
key: "render",
|
|
318
|
-
value: function render() {
|
|
319
|
-
var _this4 = this;
|
|
320
|
-
|
|
321
|
-
var type = this.attrs.type;
|
|
322
|
-
var _this$props2 = this.props,
|
|
323
|
-
size = _this$props2.size,
|
|
324
|
-
id = _this$props2.id,
|
|
325
|
-
className = _this$props2.className,
|
|
326
|
-
required = _this$props2.required;
|
|
327
|
-
return type === 'textarea' ? this.renderTextarea() : /*#__PURE__*/_react["default"].createElement("div", {
|
|
328
|
-
id: id,
|
|
329
|
-
className: "hi-input ".concat(className || '', " ").concat(type || '').concat(size ? ' hi-input_' + size : '').concat(required ? ' required' : ''),
|
|
330
|
-
style: this.props.style,
|
|
331
|
-
"data-value": this.state.valueTrue,
|
|
332
|
-
onClick: function onClick(e) {
|
|
333
|
-
_this4._Input.focus();
|
|
334
|
-
},
|
|
335
|
-
onMouseOver: function onMouseOver(e) {
|
|
336
|
-
_this4.setState({
|
|
337
|
-
hover: true
|
|
338
|
-
});
|
|
339
|
-
},
|
|
340
|
-
onMouseLeave: function onMouseLeave(e) {
|
|
341
|
-
_this4.setState({
|
|
342
|
-
hover: false
|
|
343
|
-
});
|
|
344
|
-
}
|
|
345
|
-
}, this.renderText());
|
|
346
|
-
}
|
|
347
|
-
}]);
|
|
348
|
-
return Input;
|
|
349
|
-
}(_react.Component);
|
|
350
|
-
|
|
351
|
-
(0, _defineProperty2["default"])(Input, "_Input", '');
|
|
352
|
-
var _default = Input;
|
|
353
|
-
exports["default"] = _default;
|
|
@@ -1,176 +0,0 @@
|
|
|
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;
|