@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,35 +1,19 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
|
|
3
|
-
var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault");
|
|
4
|
-
|
|
5
|
-
var _typeof = require("@babel/runtime/helpers/typeof");
|
|
6
|
-
|
|
7
3
|
Object.defineProperty(exports, "__esModule", {
|
|
8
4
|
value: true
|
|
9
5
|
});
|
|
10
6
|
exports["default"] = void 0;
|
|
11
7
|
|
|
12
|
-
var _classCallCheck2 = _interopRequireDefault(require("@babel/runtime/helpers/classCallCheck"));
|
|
13
|
-
|
|
14
|
-
var _createClass2 = _interopRequireDefault(require("@babel/runtime/helpers/createClass"));
|
|
15
|
-
|
|
16
|
-
var _inherits2 = _interopRequireDefault(require("@babel/runtime/helpers/inherits"));
|
|
17
|
-
|
|
18
|
-
var _possibleConstructorReturn2 = _interopRequireDefault(require("@babel/runtime/helpers/possibleConstructorReturn"));
|
|
19
|
-
|
|
20
|
-
var _getPrototypeOf2 = _interopRequireDefault(require("@babel/runtime/helpers/getPrototypeOf"));
|
|
21
|
-
|
|
22
8
|
var _react = _interopRequireWildcard(require("react"));
|
|
23
9
|
|
|
24
|
-
var _lodash = _interopRequireDefault(require("lodash"));
|
|
25
|
-
|
|
26
10
|
var _Modal = _interopRequireDefault(require("./Modal"));
|
|
27
11
|
|
|
28
12
|
var _classnames = _interopRequireDefault(require("classnames"));
|
|
29
13
|
|
|
30
14
|
var _constants = require("./constants");
|
|
31
15
|
|
|
32
|
-
var
|
|
16
|
+
var _lodash = _interopRequireDefault(require("lodash"));
|
|
33
17
|
|
|
34
18
|
var _propTypes = _interopRequireDefault(require("prop-types"));
|
|
35
19
|
|
|
@@ -37,68 +21,87 @@ var _Type = _interopRequireDefault(require("./Type"));
|
|
|
37
21
|
|
|
38
22
|
var _dateUtil = require("./dateUtil");
|
|
39
23
|
|
|
40
|
-
|
|
24
|
+
var _dateFns = require("date-fns");
|
|
25
|
+
|
|
26
|
+
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { "default": obj }; }
|
|
27
|
+
|
|
28
|
+
function _getRequireWildcardCache() { if (typeof WeakMap !== "function") return null; var cache = new WeakMap(); _getRequireWildcardCache = function _getRequireWildcardCache() { return cache; }; return cache; }
|
|
29
|
+
|
|
30
|
+
function _interopRequireWildcard(obj) { if (obj && obj.__esModule) { return obj; } if (obj === null || _typeof(obj) !== "object" && typeof obj !== "function") { return { "default": obj }; } var cache = _getRequireWildcardCache(); if (cache && cache.has(obj)) { return cache.get(obj); } var newObj = {}; var hasPropertyDescriptor = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var key in obj) { if (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; }
|
|
31
|
+
|
|
32
|
+
function _typeof(obj) { "@babel/helpers - typeof"; if (typeof Symbol === "function" && typeof Symbol.iterator === "symbol") { _typeof = function _typeof(obj) { return typeof obj; }; } else { _typeof = function _typeof(obj) { return obj && typeof Symbol === "function" && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; }; } return _typeof(obj); }
|
|
33
|
+
|
|
34
|
+
function _objectWithoutProperties(source, excluded) { if (source == null) return {}; var target = _objectWithoutPropertiesLoose(source, excluded); var key, i; if (Object.getOwnPropertySymbols) { var sourceSymbolKeys = Object.getOwnPropertySymbols(source); for (i = 0; i < sourceSymbolKeys.length; i++) { key = sourceSymbolKeys[i]; if (excluded.indexOf(key) >= 0) continue; if (!Object.prototype.propertyIsEnumerable.call(source, key)) continue; target[key] = source[key]; } } return target; }
|
|
41
35
|
|
|
42
|
-
function
|
|
36
|
+
function _objectWithoutPropertiesLoose(source, excluded) { if (source == null) return {}; var target = {}; var sourceKeys = Object.keys(source); var key, i; for (i = 0; i < sourceKeys.length; i++) { key = sourceKeys[i]; if (excluded.indexOf(key) >= 0) continue; target[key] = source[key]; } return target; }
|
|
43
37
|
|
|
44
|
-
function
|
|
38
|
+
function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
|
|
45
39
|
|
|
46
|
-
function
|
|
40
|
+
function _defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } }
|
|
47
41
|
|
|
48
|
-
function
|
|
42
|
+
function _createClass(Constructor, protoProps, staticProps) { if (protoProps) _defineProperties(Constructor.prototype, protoProps); if (staticProps) _defineProperties(Constructor, staticProps); return Constructor; }
|
|
43
|
+
|
|
44
|
+
function _inherits(subClass, superClass) { if (typeof superClass !== "function" && superClass !== null) { throw new TypeError("Super expression must either be null or a function"); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, writable: true, configurable: true } }); if (superClass) _setPrototypeOf(subClass, superClass); }
|
|
45
|
+
|
|
46
|
+
function _setPrototypeOf(o, p) { _setPrototypeOf = Object.setPrototypeOf || function _setPrototypeOf(o, p) { o.__proto__ = p; return o; }; return _setPrototypeOf(o, p); }
|
|
47
|
+
|
|
48
|
+
function _createSuper(Derived) { var hasNativeReflectConstruct = _isNativeReflectConstruct(); return function _createSuperInternal() { var Super = _getPrototypeOf(Derived), result; if (hasNativeReflectConstruct) { var NewTarget = _getPrototypeOf(this).constructor; result = Reflect.construct(Super, arguments, NewTarget); } else { result = Super.apply(this, arguments); } return _possibleConstructorReturn(this, result); }; }
|
|
49
|
+
|
|
50
|
+
function _possibleConstructorReturn(self, call) { if (call && (_typeof(call) === "object" || typeof call === "function")) { return call; } return _assertThisInitialized(self); }
|
|
51
|
+
|
|
52
|
+
function _assertThisInitialized(self) { if (self === void 0) { throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); } return self; }
|
|
53
|
+
|
|
54
|
+
function _isNativeReflectConstruct() { if (typeof Reflect === "undefined" || !Reflect.construct) return false; if (Reflect.construct.sham) return false; if (typeof Proxy === "function") return true; try { Date.prototype.toString.call(Reflect.construct(Date, [], function () {})); return true; } catch (e) { return false; } }
|
|
55
|
+
|
|
56
|
+
function _getPrototypeOf(o) { _getPrototypeOf = Object.setPrototypeOf ? Object.getPrototypeOf : function _getPrototypeOf(o) { return o.__proto__ || Object.getPrototypeOf(o); }; return _getPrototypeOf(o); }
|
|
57
|
+
|
|
58
|
+
function _defineProperty(obj, key, value) { if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; }
|
|
49
59
|
|
|
50
60
|
var BasePicker = /*#__PURE__*/function (_Component) {
|
|
51
|
-
(
|
|
61
|
+
_inherits(BasePicker, _Component);
|
|
52
62
|
|
|
53
63
|
var _super = _createSuper(BasePicker);
|
|
54
64
|
|
|
55
65
|
function BasePicker(props) {
|
|
56
66
|
var _this;
|
|
57
67
|
|
|
58
|
-
(
|
|
68
|
+
_classCallCheck(this, BasePicker);
|
|
69
|
+
|
|
59
70
|
_this = _super.call(this, props);
|
|
71
|
+
|
|
72
|
+
_defineProperty(_assertThisInitialized(_this), "inputRoot", null);
|
|
73
|
+
|
|
74
|
+
_defineProperty(_assertThisInitialized(_this), "input", null);
|
|
75
|
+
|
|
76
|
+
_defineProperty(_assertThisInitialized(_this), "rInput", null);
|
|
77
|
+
|
|
60
78
|
_this.state = {
|
|
61
79
|
showPanel: false,
|
|
62
80
|
style: {},
|
|
63
81
|
date: null,
|
|
64
82
|
isFocus: false,
|
|
83
|
+
// input 框内的显示的时间内容
|
|
65
84
|
texts: ['', ''],
|
|
66
85
|
placeholder: '',
|
|
86
|
+
rText: '',
|
|
67
87
|
leftPlaceholder: '',
|
|
68
88
|
rightPlaceholder: '',
|
|
69
|
-
format:
|
|
70
|
-
rangeInputIsError: false
|
|
89
|
+
format: ''
|
|
71
90
|
};
|
|
72
|
-
_this.inputRoot = /*#__PURE__*/_react["default"].createRef();
|
|
73
|
-
_this.input = null;
|
|
74
|
-
_this.rInput = null;
|
|
75
91
|
return _this;
|
|
76
92
|
}
|
|
77
93
|
|
|
78
|
-
(
|
|
94
|
+
_createClass(BasePicker, [{
|
|
79
95
|
key: "setPlaceholder",
|
|
80
|
-
value: function setPlaceholder(
|
|
81
|
-
var placeholder = _props.placeholder;
|
|
96
|
+
value: function setPlaceholder() {
|
|
82
97
|
var _this$props = this.props,
|
|
98
|
+
placeholder = _this$props.placeholder,
|
|
83
99
|
localeDatas = _this$props.localeDatas,
|
|
84
|
-
type = _this$props.type
|
|
85
|
-
|
|
86
|
-
var typePlaceholder = localeDatas.datePicker.placeholders[type];
|
|
87
|
-
var tempPlaceholder = showTime ? localeDatas.datePicker.placeholderTimeperiod : typePlaceholder || localeDatas.datePicker.placeholder;
|
|
100
|
+
type = _this$props.type;
|
|
101
|
+
var tempPlaceholder = localeDatas.datePicker.placeholders[type] || localeDatas.datePicker.placeholder;
|
|
88
102
|
var leftPlaceholder = tempPlaceholder;
|
|
89
103
|
var rightPlaceholder = tempPlaceholder;
|
|
90
104
|
|
|
91
|
-
if (typePlaceholder instanceof Array) {
|
|
92
|
-
if (showTime) {
|
|
93
|
-
var timeperiodPlaceholder = localeDatas.datePicker.placeholders.timeperiod;
|
|
94
|
-
leftPlaceholder = timeperiodPlaceholder[0];
|
|
95
|
-
rightPlaceholder = timeperiodPlaceholder[1];
|
|
96
|
-
} else {
|
|
97
|
-
leftPlaceholder = tempPlaceholder[0];
|
|
98
|
-
rightPlaceholder = tempPlaceholder[1];
|
|
99
|
-
}
|
|
100
|
-
}
|
|
101
|
-
|
|
102
105
|
if (placeholder instanceof Array) {
|
|
103
106
|
leftPlaceholder = placeholder[0];
|
|
104
107
|
rightPlaceholder = placeholder[1] || placeholder[0];
|
|
@@ -112,13 +115,94 @@ var BasePicker = /*#__PURE__*/function (_Component) {
|
|
|
112
115
|
rightPlaceholder: rightPlaceholder
|
|
113
116
|
});
|
|
114
117
|
}
|
|
118
|
+
}, {
|
|
119
|
+
key: "_parseProps",
|
|
120
|
+
value: function _parseProps(props, callback) {
|
|
121
|
+
var _this2 = this;
|
|
122
|
+
|
|
123
|
+
var value = props.value,
|
|
124
|
+
showTime = props.showTime,
|
|
125
|
+
type = props.type,
|
|
126
|
+
format = props.format,
|
|
127
|
+
localeDatas = props.localeDatas,
|
|
128
|
+
weekOffset = props.weekOffset;
|
|
129
|
+
format = format || _constants.FORMATS[type];
|
|
130
|
+
var date;
|
|
131
|
+
var noText = false;
|
|
132
|
+
/**
|
|
133
|
+
* value 可能的格式:
|
|
134
|
+
* '' | undefined | null | Date | String | Number | {start: xxx, end: xxx}
|
|
135
|
+
*/
|
|
136
|
+
|
|
137
|
+
if (value === '' || !value) {
|
|
138
|
+
// value 未传入情况
|
|
139
|
+
date = new Date();
|
|
140
|
+
noText = true;
|
|
141
|
+
}
|
|
142
|
+
|
|
143
|
+
if (typeof value === 'number' || typeof value === 'string' && value.trim().length > 4) {
|
|
144
|
+
// value 为数字(times)
|
|
145
|
+
date = (0, _dateUtil.parse)(value);
|
|
146
|
+
}
|
|
147
|
+
|
|
148
|
+
if (value instanceof Date) {
|
|
149
|
+
date = value;
|
|
150
|
+
}
|
|
151
|
+
|
|
152
|
+
if (type.includes('range') || type === 'timeperiod') {
|
|
153
|
+
if (value) {
|
|
154
|
+
if (value instanceof Date) {
|
|
155
|
+
// 如果为时间段选择,则取默认的第一个范围
|
|
156
|
+
date = {
|
|
157
|
+
startDate: (0, _dateUtil.startOfDay)(date),
|
|
158
|
+
endDate: type === 'timeperiod' ? (0, _dateFns.addHours)((0, _dateUtil.startOfDay)(date), 4) : (0, _dateUtil.endOfDay)(date)
|
|
159
|
+
};
|
|
160
|
+
}
|
|
161
|
+
|
|
162
|
+
if (value.start && value.end) {
|
|
163
|
+
date = {
|
|
164
|
+
startDate: value.start,
|
|
165
|
+
endDate: value.end
|
|
166
|
+
};
|
|
167
|
+
}
|
|
168
|
+
} else {
|
|
169
|
+
date = {
|
|
170
|
+
startDate: new Date(),
|
|
171
|
+
endDate: new Date()
|
|
172
|
+
};
|
|
173
|
+
}
|
|
174
|
+
}
|
|
175
|
+
|
|
176
|
+
var leftText = noText ? '' : (0, _constants.formatterDate)(type, date.startDate || date, format, showTime, localeDatas, weekOffset);
|
|
177
|
+
var rightText = noText ? '' : (0, _constants.formatterDate)(type, date.endDate || date, format, showTime, localeDatas, weekOffset);
|
|
178
|
+
this.setState({
|
|
179
|
+
texts: [leftText, rightText],
|
|
180
|
+
date: date,
|
|
181
|
+
format: format
|
|
182
|
+
}, function () {
|
|
183
|
+
callback && callback(_this2.state.date);
|
|
184
|
+
});
|
|
185
|
+
}
|
|
115
186
|
}, {
|
|
116
187
|
key: "componentDidMount",
|
|
117
188
|
value: function componentDidMount() {
|
|
118
|
-
this
|
|
189
|
+
var _this3 = this;
|
|
190
|
+
|
|
191
|
+
this._parseProps(this.props, function (date) {
|
|
192
|
+
if (date && date.startDate && date.endDate) {
|
|
193
|
+
date = {
|
|
194
|
+
start: new Date(date.startDate),
|
|
195
|
+
end: new Date(date.endDate)
|
|
196
|
+
};
|
|
197
|
+
} else if (date !== null) {
|
|
198
|
+
date = new Date(date);
|
|
199
|
+
}
|
|
200
|
+
|
|
201
|
+
_this3.props.value && _this3.props.onChange && _this3.props.onChange(date);
|
|
202
|
+
});
|
|
119
203
|
|
|
120
|
-
this.setPlaceholder(
|
|
121
|
-
var rect = this.inputRoot.
|
|
204
|
+
this.setPlaceholder();
|
|
205
|
+
var rect = this.inputRoot.getBoundingClientRect();
|
|
122
206
|
this.calcPanelPos(rect);
|
|
123
207
|
}
|
|
124
208
|
}, {
|
|
@@ -130,20 +214,12 @@ var BasePicker = /*#__PURE__*/function (_Component) {
|
|
|
130
214
|
|
|
131
215
|
var _w = type.indexOf('range') !== -1 ? 578 : 288;
|
|
132
216
|
|
|
133
|
-
if (type === 'timerange') {
|
|
134
|
-
_w = 400;
|
|
135
|
-
}
|
|
136
|
-
|
|
137
217
|
var _h = 298;
|
|
138
218
|
|
|
139
219
|
if (type === 'daterange' && showTime) {
|
|
140
220
|
_h = 344;
|
|
141
221
|
}
|
|
142
222
|
|
|
143
|
-
if ((0, _util.showLargeCalendar)(this.props)) {
|
|
144
|
-
_h = 440;
|
|
145
|
-
}
|
|
146
|
-
|
|
147
223
|
var _cw = document.documentElement.clientWidth || document.body.clientWidth;
|
|
148
224
|
|
|
149
225
|
var _ch = document.documentElement.clientHeight || document.body.clientHeight;
|
|
@@ -155,14 +231,14 @@ var BasePicker = /*#__PURE__*/function (_Component) {
|
|
|
155
231
|
top = rect.top,
|
|
156
232
|
height = rect.height;
|
|
157
233
|
|
|
158
|
-
var _top = rect.top + rect.height + _st
|
|
234
|
+
var _top = rect.top + rect.height + _st;
|
|
159
235
|
|
|
160
236
|
if (left + _w > _cw) {
|
|
161
237
|
left = left + width - _w;
|
|
162
238
|
}
|
|
163
239
|
|
|
164
240
|
if (top + _h + height > _ch) {
|
|
165
|
-
_top = top - _h + _st
|
|
241
|
+
_top = top - _h + _st;
|
|
166
242
|
}
|
|
167
243
|
|
|
168
244
|
this.setState({
|
|
@@ -176,234 +252,141 @@ var BasePicker = /*#__PURE__*/function (_Component) {
|
|
|
176
252
|
}, {
|
|
177
253
|
key: "componentWillReceiveProps",
|
|
178
254
|
value: function componentWillReceiveProps(nextProps) {
|
|
179
|
-
if (nextProps.value !== this.props.value) {
|
|
180
|
-
this._parseProps(nextProps);
|
|
181
|
-
}
|
|
182
|
-
|
|
183
|
-
if (!_lodash["default"].isEqual(nextProps.placeholder, this.props.placeholder)) {
|
|
184
|
-
this.setPlaceholder(nextProps);
|
|
185
|
-
}
|
|
186
|
-
}
|
|
187
|
-
}, {
|
|
188
|
-
key: "getFormatString",
|
|
189
|
-
value: function getFormatString(props) {
|
|
190
|
-
var format = props.format,
|
|
191
|
-
showTime = props.showTime,
|
|
192
|
-
type = props.type;
|
|
193
|
-
format = (0, _dateUtil.compatibleFormatString)(format || _constants.FORMATS[type]);
|
|
194
|
-
|
|
195
|
-
if ((showTime || type === 'timeperiod') && !/[H|h|m|s]/.test(format)) {
|
|
196
|
-
format = format + ' HH:mm:ss';
|
|
197
|
-
}
|
|
198
|
-
|
|
199
|
-
return format;
|
|
200
|
-
}
|
|
201
|
-
}, {
|
|
202
|
-
key: "callFormatterDate",
|
|
203
|
-
value: function callFormatterDate(date) {
|
|
204
255
|
var _this$props3 = this.props,
|
|
205
|
-
|
|
206
|
-
|
|
207
|
-
localeDatas = _this$props3.localeDatas,
|
|
208
|
-
weekOffset = _this$props3.weekOffset;
|
|
209
|
-
return (0, _constants.formatterDate)(type, date, this.state.format, showTime, localeDatas, weekOffset);
|
|
210
|
-
}
|
|
211
|
-
}, {
|
|
212
|
-
key: "_parseProps",
|
|
213
|
-
value: function _parseProps(props) {
|
|
214
|
-
var value = props.value,
|
|
215
|
-
defaultValue = props.defaultValue,
|
|
216
|
-
type = props.type,
|
|
217
|
-
_props$timeInterval = props.timeInterval,
|
|
218
|
-
timeInterval = _props$timeInterval === void 0 ? 240 : _props$timeInterval;
|
|
219
|
-
var format = this.state.format;
|
|
256
|
+
onChange = _this$props3.onChange,
|
|
257
|
+
currentProps = _objectWithoutProperties(_this$props3, ["onChange"]);
|
|
220
258
|
|
|
221
|
-
var
|
|
259
|
+
var _onChange = nextProps.onChange,
|
|
260
|
+
_nextProps = _objectWithoutProperties(nextProps, ["onChange"]);
|
|
222
261
|
|
|
223
|
-
|
|
224
|
-
|
|
225
|
-
var date;
|
|
226
|
-
var leftText = '';
|
|
227
|
-
var rightText = '';
|
|
228
|
-
|
|
229
|
-
if (_value) {
|
|
230
|
-
if (Object.prototype.toString.call(_value) === '[object Object]') {
|
|
231
|
-
start = (0, _dateUtil.compatibleToDate)(_value.start, format);
|
|
232
|
-
end = (0, _dateUtil.compatibleToDate)(_value.end, format);
|
|
233
|
-
} else {
|
|
234
|
-
start = (0, _dateUtil.compatibleToDate)(_value, format);
|
|
235
|
-
|
|
236
|
-
if (type.includes('range')) {
|
|
237
|
-
end = (0, _dateUtil.compatibleToDate)(start, format);
|
|
238
|
-
|
|
239
|
-
if (type === 'weekrange') {
|
|
240
|
-
start = (0, _dateUtil.startOfWeek)(start);
|
|
241
|
-
end = (0, _dateUtil.endOfWeek)(end);
|
|
242
|
-
}
|
|
243
|
-
}
|
|
244
|
-
}
|
|
245
|
-
|
|
246
|
-
if (type === 'timeperiod' && (0, _dateUtil.isValid)(start)) {
|
|
247
|
-
var startTime = start.getTime();
|
|
248
|
-
startTime += timeInterval * 60 * 1000;
|
|
249
|
-
end = new Date(startTime);
|
|
250
|
-
}
|
|
262
|
+
if (!_lodash["default"].isEqual(currentProps, _nextProps)) {
|
|
263
|
+
this._parseProps(nextProps);
|
|
251
264
|
}
|
|
252
|
-
|
|
253
|
-
date = {
|
|
254
|
-
startDate: (0, _dateUtil.compatibleToDate)(start, format),
|
|
255
|
-
endDate: (0, _dateUtil.compatibleToDate)(end, format)
|
|
256
|
-
};
|
|
257
|
-
leftText = (0, _dateUtil.isValid)(date.startDate) ? this.callFormatterDate(date.startDate) : '';
|
|
258
|
-
rightText = (0, _dateUtil.isValid)(date.endDate) ? this.callFormatterDate(date.endDate) : '';
|
|
259
|
-
this.setState({
|
|
260
|
-
texts: [leftText, rightText],
|
|
261
|
-
date: date
|
|
262
|
-
});
|
|
263
265
|
}
|
|
264
266
|
}, {
|
|
265
267
|
key: "onPick",
|
|
266
268
|
value: function onPick(date, showPanel) {
|
|
267
|
-
var
|
|
268
|
-
|
|
269
|
-
if (!date.startDate) {
|
|
270
|
-
date = {
|
|
271
|
-
startDate: date,
|
|
272
|
-
endDate: undefined
|
|
273
|
-
};
|
|
274
|
-
}
|
|
269
|
+
var _this4 = this;
|
|
275
270
|
|
|
271
|
+
var _this$props4 = this.props,
|
|
272
|
+
type = _this$props4.type,
|
|
273
|
+
showTime = _this$props4.showTime,
|
|
274
|
+
localeDatas = _this$props4.localeDatas,
|
|
275
|
+
weekOffset = _this$props4.weekOffset;
|
|
276
|
+
var format = this.state.format;
|
|
276
277
|
this.setState({
|
|
277
278
|
date: date,
|
|
278
|
-
texts: [
|
|
279
|
+
texts: [(0, _constants.formatterDate)(type, date.startDate || date, format, showTime, localeDatas, weekOffset), (0, _constants.formatterDate)(type, date.endDate, format, showTime, localeDatas, weekOffset)],
|
|
279
280
|
showPanel: showPanel,
|
|
280
281
|
isFocus: false
|
|
281
282
|
}, function () {
|
|
282
283
|
if (!showPanel) {
|
|
283
|
-
|
|
284
|
+
_this4.callback();
|
|
284
285
|
}
|
|
285
286
|
});
|
|
286
287
|
}
|
|
287
288
|
}, {
|
|
288
289
|
key: "callback",
|
|
289
290
|
value: function callback() {
|
|
290
|
-
var _this$
|
|
291
|
-
type = _this$
|
|
292
|
-
onChange = _this$
|
|
293
|
-
|
|
294
|
-
|
|
295
|
-
|
|
296
|
-
|
|
297
|
-
|
|
298
|
-
|
|
299
|
-
|
|
300
|
-
if (onChange && !disabled) {
|
|
301
|
-
var _getInRangeDate = (0, _util.getInRangeDate)(_lodash["default"].cloneDeep(date.startDate), _lodash["default"].cloneDeep(date.endDate), max, min),
|
|
302
|
-
startDate = _getInRangeDate.startDate,
|
|
303
|
-
endDate = _getInRangeDate.endDate;
|
|
304
|
-
|
|
305
|
-
startDate = (0, _dateUtil.isValid)(startDate) ? startDate : '';
|
|
306
|
-
endDate = (0, _dateUtil.isValid)(endDate) ? endDate : '';
|
|
307
|
-
|
|
308
|
-
if (type === 'week' || type === 'weekrange') {
|
|
309
|
-
this.setState({
|
|
310
|
-
texts: [this.callFormatterDate(startDate), this.callFormatterDate(endDate)],
|
|
311
|
-
showPanel: false
|
|
312
|
-
});
|
|
313
|
-
onChange(date);
|
|
314
|
-
return;
|
|
315
|
-
}
|
|
316
|
-
|
|
317
|
-
if (type === 'time') {
|
|
318
|
-
this.setState({
|
|
319
|
-
texts: [this.callFormatterDate(startDate), ''],
|
|
320
|
-
showPanel: false
|
|
321
|
-
});
|
|
322
|
-
onChange(startDate, (0, _dateUtil.dateFormat)(startDate, format));
|
|
323
|
-
return;
|
|
324
|
-
}
|
|
291
|
+
var _this$props5 = this.props,
|
|
292
|
+
type = _this$props5.type,
|
|
293
|
+
onChange = _this$props5.onChange,
|
|
294
|
+
weekOffset = _this$props5.weekOffset;
|
|
295
|
+
var date = this.state.date;
|
|
296
|
+
|
|
297
|
+
if (onChange) {
|
|
298
|
+
var _weekOffset = {
|
|
299
|
+
weekStartsOn: weekOffset
|
|
300
|
+
};
|
|
325
301
|
|
|
326
|
-
if (
|
|
327
|
-
|
|
328
|
-
|
|
329
|
-
|
|
330
|
-
texts: [this.callFormatterDate(startDate), this.callFormatterDate(endDate)],
|
|
331
|
-
showPanel: isError
|
|
332
|
-
});
|
|
333
|
-
!isError && onChange({
|
|
334
|
-
start: startDate,
|
|
335
|
-
end: endDate
|
|
336
|
-
}, {
|
|
337
|
-
start: (0, _dateUtil.dateFormat)(startDate, format),
|
|
338
|
-
end: (0, _dateUtil.dateFormat)(endDate, format)
|
|
302
|
+
if (type === 'week') {
|
|
303
|
+
onChange({
|
|
304
|
+
start: (0, _dateUtil.startOfWeek)(date, _weekOffset),
|
|
305
|
+
end: (0, _dateUtil.endOfWeek)(date, _weekOffset)
|
|
339
306
|
});
|
|
340
307
|
return;
|
|
341
308
|
}
|
|
342
309
|
|
|
343
|
-
if (
|
|
344
|
-
|
|
345
|
-
|
|
346
|
-
|
|
347
|
-
|
|
348
|
-
|
|
310
|
+
if (date && date.startDate && date.endDate) {
|
|
311
|
+
if (type === 'weekrange') {
|
|
312
|
+
onChange({
|
|
313
|
+
start: (0, _dateUtil.startOfWeek)(date.startDate, _weekOffset),
|
|
314
|
+
end: (0, _dateUtil.endOfWeek)(date.endDate, _weekOffset)
|
|
315
|
+
});
|
|
316
|
+
} else if (['timerange', 'timeperiod', 'daterange'].includes(type)) {
|
|
317
|
+
onChange({
|
|
318
|
+
start: date.startDate,
|
|
319
|
+
end: date.endDate
|
|
320
|
+
});
|
|
321
|
+
} else {
|
|
322
|
+
onChange({
|
|
323
|
+
start: (0, _dateUtil.startOfDay)(date.startDate),
|
|
324
|
+
end: (0, _dateUtil.endOfDay)(date.endDate)
|
|
325
|
+
});
|
|
326
|
+
}
|
|
327
|
+
} else {
|
|
328
|
+
onChange(date);
|
|
349
329
|
}
|
|
350
330
|
}
|
|
351
331
|
}
|
|
352
332
|
}, {
|
|
353
|
-
key: "
|
|
354
|
-
value: function
|
|
333
|
+
key: "timeConfirm",
|
|
334
|
+
value: function timeConfirm(date, onlyTime) {
|
|
335
|
+
var _this$props6 = this.props,
|
|
336
|
+
type = _this$props6.type,
|
|
337
|
+
showTime = _this$props6.showTime,
|
|
338
|
+
onChange = _this$props6.onChange,
|
|
339
|
+
localeDatas = _this$props6.localeDatas,
|
|
340
|
+
weekOffset = _this$props6.weekOffset;
|
|
341
|
+
var format = this.state.format;
|
|
342
|
+
onlyTime && (format = _constants.FORMATS['time']);
|
|
355
343
|
this.setState({
|
|
344
|
+
date: date,
|
|
345
|
+
texts: [(0, _constants.formatterDate)(type, date.startDate || date, format, showTime, localeDatas, weekOffset), (0, _constants.formatterDate)(type, date.endDate, format, showTime, localeDatas, weekOffset)],
|
|
346
|
+
showPanel: false,
|
|
356
347
|
isFocus: false
|
|
357
348
|
});
|
|
358
|
-
}
|
|
359
|
-
}, {
|
|
360
|
-
key: "inputChangeEvent",
|
|
361
|
-
value: function inputChangeEvent() {
|
|
362
|
-
var _this$state2 = this.state,
|
|
363
|
-
texts = _this$state2.texts,
|
|
364
|
-
date = _this$state2.date,
|
|
365
|
-
format = _this$state2.format;
|
|
366
|
-
var startDate = (0, _dateUtil.parse)(texts[0], format, new Date());
|
|
367
|
-
var endDate = (0, _dateUtil.parse)(texts[1], format, new Date());
|
|
368
|
-
|
|
369
|
-
if (startDate && (0, _dateUtil.isValid)(startDate)) {
|
|
370
|
-
date.startDate ? date.startDate = startDate : date = startDate;
|
|
371
|
-
this.setState({
|
|
372
|
-
date: date
|
|
373
|
-
});
|
|
374
|
-
}
|
|
375
349
|
|
|
376
|
-
if (
|
|
377
|
-
date.
|
|
378
|
-
|
|
379
|
-
|
|
380
|
-
|
|
350
|
+
if (onChange) {
|
|
351
|
+
if (date.startDate && date.endDate) {
|
|
352
|
+
onChange({
|
|
353
|
+
start: date.startDate,
|
|
354
|
+
end: date.endDate
|
|
355
|
+
});
|
|
356
|
+
} else {
|
|
357
|
+
onChange(date);
|
|
358
|
+
}
|
|
381
359
|
}
|
|
360
|
+
}
|
|
361
|
+
}, {
|
|
362
|
+
key: "timeCancel",
|
|
363
|
+
value: function timeCancel() {
|
|
364
|
+
var _this$state = this.state,
|
|
365
|
+
tempDate = _this$state.tempDate,
|
|
366
|
+
format = _this$state.format;
|
|
367
|
+
var _this$props7 = this.props,
|
|
368
|
+
type = _this$props7.type,
|
|
369
|
+
showTime = _this$props7.showTime,
|
|
370
|
+
localeDatas = _this$props7.localeDatas,
|
|
371
|
+
weekOffset = _this$props7.weekOffset;
|
|
382
372
|
|
|
383
|
-
if (
|
|
384
|
-
date.startDate = null;
|
|
373
|
+
if (tempDate) {
|
|
385
374
|
this.setState({
|
|
386
|
-
date:
|
|
375
|
+
date: new Date(tempDate),
|
|
376
|
+
text: (0, _constants.formatterDate)(type, new Date(tempDate), format, showTime, localeDatas, weekOffset),
|
|
377
|
+
showPanel: false
|
|
387
378
|
});
|
|
388
|
-
}
|
|
389
|
-
|
|
390
|
-
if (texts[1].trim().length === 0) {
|
|
391
|
-
date.endDate = null;
|
|
379
|
+
} else {
|
|
392
380
|
this.setState({
|
|
393
|
-
|
|
381
|
+
showPanel: false,
|
|
382
|
+
isFocus: false
|
|
394
383
|
});
|
|
395
384
|
}
|
|
396
385
|
}
|
|
397
386
|
}, {
|
|
398
387
|
key: "clickOutSide",
|
|
399
388
|
value: function clickOutSide(e) {
|
|
400
|
-
var _this3 = this;
|
|
401
|
-
|
|
402
|
-
var _this$props5 = this.props,
|
|
403
|
-
max = _this$props5.max,
|
|
404
|
-
min = _this$props5.min;
|
|
405
389
|
var tar = e.target;
|
|
406
|
-
this.inputChangeEvent();
|
|
407
390
|
|
|
408
391
|
if (tar.className.indexOf('clear') !== -1) {
|
|
409
392
|
this.setState({
|
|
@@ -414,59 +397,45 @@ var BasePicker = /*#__PURE__*/function (_Component) {
|
|
|
414
397
|
}
|
|
415
398
|
|
|
416
399
|
if (tar !== this.input && tar !== this.rInput) {
|
|
417
|
-
|
|
418
|
-
|
|
419
|
-
var _getInRangeDate2 = (0, _util.getInRangeDate)(texts[0], texts[1], max, min),
|
|
420
|
-
startDate = _getInRangeDate2.startDate,
|
|
421
|
-
endDate = _getInRangeDate2.endDate;
|
|
422
|
-
|
|
423
|
-
texts = [this.callFormatterDate(startDate), this.callFormatterDate(endDate)];
|
|
424
|
-
this.setState({
|
|
425
|
-
texts: texts
|
|
426
|
-
}, function () {
|
|
427
|
-
_this3.timeCancel();
|
|
428
|
-
|
|
429
|
-
_this3.callback();
|
|
430
|
-
});
|
|
400
|
+
this.timeCancel();
|
|
431
401
|
}
|
|
402
|
+
|
|
403
|
+
this.callback();
|
|
432
404
|
}
|
|
433
405
|
}, {
|
|
434
406
|
key: "_input",
|
|
435
|
-
value: function _input(text
|
|
436
|
-
var
|
|
407
|
+
value: function _input(text) {
|
|
408
|
+
var _this5 = this;
|
|
437
409
|
|
|
438
|
-
var
|
|
439
|
-
|
|
440
|
-
|
|
441
|
-
|
|
442
|
-
|
|
443
|
-
|
|
444
|
-
|
|
410
|
+
var _ref = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : 'input';
|
|
411
|
+
|
|
412
|
+
var placeholder = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : 'Please Select...';
|
|
413
|
+
var _this$props8 = this.props,
|
|
414
|
+
disabled = _this$props8.disabled,
|
|
415
|
+
type = _this$props8.type,
|
|
416
|
+
_onChange2 = _this$props8.onChange;
|
|
445
417
|
return /*#__PURE__*/_react["default"].createElement("input", {
|
|
446
418
|
type: "text",
|
|
447
419
|
ref: function ref(el) {
|
|
448
|
-
|
|
420
|
+
_this5[_ref] = el;
|
|
449
421
|
},
|
|
450
422
|
placeholder: placeholder,
|
|
451
423
|
className: disabled ? 'disabled' : '',
|
|
452
424
|
disabled: disabled,
|
|
453
|
-
readOnly: hourStep || minuteStep || secondStep || inputReadOnly ? 'readOnly' : false,
|
|
454
425
|
onChange: function onChange(e) {
|
|
455
|
-
|
|
426
|
+
(0, _constants.isVaildDate)(new Date(e.target.value)) && type === 'date' && _onChange2(new Date(e.target.value));
|
|
456
427
|
|
|
457
|
-
|
|
458
|
-
|
|
459
|
-
}, function () {
|
|
460
|
-
_this4.inputChangeEvent();
|
|
428
|
+
_this5.setState({
|
|
429
|
+
text: e.target.value
|
|
461
430
|
});
|
|
462
431
|
},
|
|
463
432
|
onFocus: function onFocus(e) {
|
|
464
|
-
|
|
433
|
+
_this5.setState({
|
|
465
434
|
showPanel: true,
|
|
466
435
|
isFocus: true
|
|
467
436
|
});
|
|
468
437
|
|
|
469
|
-
|
|
438
|
+
_this5.calcPanelPos(_this5.inputRoot.getBoundingClientRect());
|
|
470
439
|
},
|
|
471
440
|
value: text
|
|
472
441
|
});
|
|
@@ -474,18 +443,15 @@ var BasePicker = /*#__PURE__*/function (_Component) {
|
|
|
474
443
|
}, {
|
|
475
444
|
key: "_clear",
|
|
476
445
|
value: function _clear() {
|
|
477
|
-
var
|
|
446
|
+
var onChange = this.props.onChange;
|
|
478
447
|
|
|
479
|
-
|
|
480
|
-
|
|
481
|
-
|
|
482
|
-
|
|
483
|
-
|
|
484
|
-
},
|
|
448
|
+
if (onChange) {
|
|
449
|
+
onChange(null);
|
|
450
|
+
}
|
|
451
|
+
|
|
452
|
+
this.setState({
|
|
485
453
|
texts: ['', ''],
|
|
486
454
|
isFocus: false
|
|
487
|
-
}, function () {
|
|
488
|
-
_this5.callback();
|
|
489
455
|
});
|
|
490
456
|
}
|
|
491
457
|
}, {
|
|
@@ -493,16 +459,9 @@ var BasePicker = /*#__PURE__*/function (_Component) {
|
|
|
493
459
|
value: function _icon() {
|
|
494
460
|
var _this6 = this;
|
|
495
461
|
|
|
496
|
-
var
|
|
497
|
-
|
|
498
|
-
|
|
499
|
-
var _this$props7 = this.props,
|
|
500
|
-
clearable = _this$props7.clearable,
|
|
501
|
-
type = _this$props7.type,
|
|
502
|
-
showTime = _this$props7.showTime,
|
|
503
|
-
disabled = _this$props7.disabled;
|
|
504
|
-
var iconCls = (0, _classnames["default"])('hi-datepicker__input-icon', 'hi-icon', texts[0].length && isFocus && clearable && !disabled ? 'icon-close-circle clear' : type.includes('time') || showTime ? 'icon-time' : 'icon-date');
|
|
505
|
-
return texts[0].length && isFocus && clearable ? /*#__PURE__*/_react["default"].createElement("span", {
|
|
462
|
+
var isFocus = this.state.isFocus;
|
|
463
|
+
var iconCls = (0, _classnames["default"])('hi-datepicker__input-icon', 'hi-icon', isFocus ? 'icon-close-circle clear' : 'icon-date');
|
|
464
|
+
return isFocus ? /*#__PURE__*/_react["default"].createElement("span", {
|
|
506
465
|
className: iconCls,
|
|
507
466
|
onClick: this._clear.bind(this)
|
|
508
467
|
}) : /*#__PURE__*/_react["default"].createElement("span", {
|
|
@@ -510,7 +469,7 @@ var BasePicker = /*#__PURE__*/function (_Component) {
|
|
|
510
469
|
onClick: function onClick(e) {
|
|
511
470
|
if (_this6.props.disabled) return;
|
|
512
471
|
|
|
513
|
-
_this6.calcPanelPos(_this6.inputRoot.
|
|
472
|
+
_this6.calcPanelPos(_this6.inputRoot.getBoundingClientRect());
|
|
514
473
|
|
|
515
474
|
_this6.setState({
|
|
516
475
|
showPanel: true,
|
|
@@ -522,117 +481,73 @@ var BasePicker = /*#__PURE__*/function (_Component) {
|
|
|
522
481
|
}, {
|
|
523
482
|
key: "renderRangeInput",
|
|
524
483
|
value: function renderRangeInput() {
|
|
525
|
-
var
|
|
526
|
-
|
|
527
|
-
|
|
528
|
-
|
|
529
|
-
disabled = _this$props8.disabled,
|
|
530
|
-
showTime = _this$props8.showTime,
|
|
531
|
-
type = _this$props8.type,
|
|
532
|
-
width = _this$props8.width,
|
|
533
|
-
theme = _this$props8.theme;
|
|
534
|
-
var _this$state4 = this.state,
|
|
535
|
-
isFocus = _this$state4.isFocus,
|
|
536
|
-
rangeInputIsError = _this$state4.rangeInputIsError;
|
|
484
|
+
var _this$props9 = this.props,
|
|
485
|
+
localeDatas = _this$props9.localeDatas,
|
|
486
|
+
disabled = _this$props9.disabled,
|
|
487
|
+
showTime = _this$props9.showTime;
|
|
537
488
|
|
|
538
|
-
var _cls = (0, _classnames["default"])('hi-datepicker__input',
|
|
489
|
+
var _cls = (0, _classnames["default"])('hi-datepicker__input', 'hi-datepicker__input--range', showTime && 'hi-datepicker__input--range-time', disabled && 'hi-datepicker__input--disabled');
|
|
539
490
|
|
|
540
491
|
return /*#__PURE__*/_react["default"].createElement("div", {
|
|
541
|
-
className: _cls
|
|
542
|
-
|
|
543
|
-
width: width
|
|
544
|
-
},
|
|
545
|
-
onMouseEnter: function onMouseEnter() {
|
|
546
|
-
_this7.setState({
|
|
547
|
-
isFocus: true
|
|
548
|
-
});
|
|
549
|
-
},
|
|
550
|
-
onMouseLeave: function onMouseLeave() {
|
|
551
|
-
_this7.setState({
|
|
552
|
-
isFocus: false
|
|
553
|
-
});
|
|
554
|
-
}
|
|
555
|
-
}, this._input(this.state.texts[0], 'input', this.state.leftPlaceholder), /*#__PURE__*/_react["default"].createElement("span", {
|
|
556
|
-
className: "hi-datepicker__input--connection"
|
|
557
|
-
}, localeDatas.datePicker.to), this._input(this.state.texts[1], 'rInput', this.state.rightPlaceholder), this._icon());
|
|
492
|
+
className: _cls
|
|
493
|
+
}, this._input(this.state.texts[0], 'input', this.state.leftPlaceholder), /*#__PURE__*/_react["default"].createElement("span", null, localeDatas.datePicker.to), this._input(this.state.texts[1], 'rInput', this.state.rightPlaceholder), this._icon());
|
|
558
494
|
}
|
|
559
495
|
}, {
|
|
560
496
|
key: "renderNormalInput",
|
|
561
497
|
value: function renderNormalInput() {
|
|
562
|
-
var
|
|
563
|
-
|
|
564
|
-
|
|
565
|
-
disabled = _this$props9.disabled,
|
|
566
|
-
showTime = _this$props9.showTime,
|
|
567
|
-
type = _this$props9.type,
|
|
568
|
-
width = _this$props9.width,
|
|
569
|
-
theme = _this$props9.theme;
|
|
570
|
-
var isFocus = this.state.isFocus;
|
|
498
|
+
var _this$props10 = this.props,
|
|
499
|
+
disabled = _this$props10.disabled,
|
|
500
|
+
showTime = _this$props10.showTime;
|
|
571
501
|
|
|
572
|
-
var _cls = (0, _classnames["default"])('hi-datepicker__input',
|
|
502
|
+
var _cls = (0, _classnames["default"])('hi-datepicker__input', 'hi-datepicker__input--normal', disabled && 'hi-datepicker__input--disabled', showTime && 'hi-datepicker__input--middle');
|
|
573
503
|
|
|
574
504
|
return /*#__PURE__*/_react["default"].createElement("div", {
|
|
575
|
-
className: _cls
|
|
576
|
-
style: {
|
|
577
|
-
width: width
|
|
578
|
-
},
|
|
579
|
-
onMouseEnter: function onMouseEnter() {
|
|
580
|
-
_this8.setState({
|
|
581
|
-
isFocus: true
|
|
582
|
-
});
|
|
583
|
-
},
|
|
584
|
-
onMouseLeave: function onMouseLeave() {
|
|
585
|
-
_this8.setState({
|
|
586
|
-
isFocus: false
|
|
587
|
-
});
|
|
588
|
-
}
|
|
505
|
+
className: _cls
|
|
589
506
|
}, this._input(this.state.texts[0], 'input', this.state.leftPlaceholder), this._icon());
|
|
590
507
|
}
|
|
591
508
|
}, {
|
|
592
509
|
key: "render",
|
|
593
510
|
value: function render() {
|
|
594
|
-
var
|
|
595
|
-
|
|
596
|
-
|
|
597
|
-
|
|
511
|
+
var _this7 = this;
|
|
512
|
+
|
|
513
|
+
var _this$props11 = this.props,
|
|
514
|
+
type = _this$props11.type,
|
|
515
|
+
showTime = _this$props11.showTime;
|
|
598
516
|
return /*#__PURE__*/_react["default"].createElement("span", {
|
|
599
|
-
ref:
|
|
600
|
-
|
|
601
|
-
|
|
602
|
-
|
|
603
|
-
}
|
|
517
|
+
ref: function ref(el) {
|
|
518
|
+
_this7.inputRoot = el;
|
|
519
|
+
},
|
|
520
|
+
className: "hi-datepicker__input-root"
|
|
604
521
|
}, type.indexOf('range') !== -1 || type === 'timeperiod' ? this.renderRangeInput() : this.renderNormalInput(), this.state.showPanel ? /*#__PURE__*/_react["default"].createElement(_Modal["default"], {
|
|
605
522
|
clickOutSide: this.clickOutSide.bind(this),
|
|
606
523
|
showTime: showTime
|
|
607
524
|
}, this.initPanel(this.state, this.props)) : null);
|
|
608
525
|
}
|
|
609
526
|
}]);
|
|
527
|
+
|
|
610
528
|
return BasePicker;
|
|
611
529
|
}(_react.Component);
|
|
612
530
|
|
|
613
|
-
BasePicker
|
|
531
|
+
_defineProperty(BasePicker, "propTypes", {
|
|
614
532
|
type: _propTypes["default"].oneOf(Object.values(_Type["default"])),
|
|
615
533
|
value: function value(props, propName, componentName) {
|
|
534
|
+
// Invalid Date
|
|
616
535
|
var val = props[propName];
|
|
617
536
|
|
|
618
537
|
if (val === undefined || val === null) {
|
|
619
538
|
return null;
|
|
620
539
|
}
|
|
621
540
|
|
|
622
|
-
if (!val) {
|
|
623
|
-
return null;
|
|
624
|
-
}
|
|
625
|
-
|
|
626
541
|
if (val.start && val.end) {
|
|
627
|
-
var _start = (0, _dateUtil.
|
|
542
|
+
var _start = (0, _dateUtil.dateFormat)(val.start);
|
|
628
543
|
|
|
629
|
-
var _end = (0, _dateUtil.
|
|
544
|
+
var _end = (0, _dateUtil.dateFormat)(val.end);
|
|
630
545
|
|
|
631
|
-
if (
|
|
546
|
+
if (_start === 'Invalid Date' || _end === 'Invalid Date') {
|
|
632
547
|
return new Error("Invalid prop ".concat(propName, " supplied to ").concat(componentName, ". Validation failed. start or end is an invalid date."));
|
|
633
548
|
}
|
|
634
549
|
} else {
|
|
635
|
-
if (
|
|
550
|
+
if ((0, _dateUtil.dateFormat)(val) === 'Invalid Date') {
|
|
636
551
|
return new Error("Invalid prop ".concat(propName, " supplied to ").concat(componentName, ". Validation failed. value is an invalid data."));
|
|
637
552
|
}
|
|
638
553
|
}
|
|
@@ -649,17 +564,16 @@ BasePicker.propTypes = {
|
|
|
649
564
|
if (val < 5 || val > 480 || val > 60 && val % 60 !== 0 || val < 60 && 60 % val !== 0) {
|
|
650
565
|
return new Error("Invalid prop ".concat(propName, " supplied to ").concat(componentName, ". This value must be greater than 5 and less than 480 and is a multiple of 60."));
|
|
651
566
|
}
|
|
652
|
-
}
|
|
653
|
-
|
|
654
|
-
|
|
655
|
-
BasePicker
|
|
567
|
+
}
|
|
568
|
+
});
|
|
569
|
+
|
|
570
|
+
_defineProperty(BasePicker, "defaultProps", {
|
|
656
571
|
type: 'date',
|
|
657
572
|
disabled: false,
|
|
658
573
|
showWeekNumber: true,
|
|
659
574
|
weekOffset: 0,
|
|
660
|
-
timeInterval: 240
|
|
661
|
-
|
|
662
|
-
|
|
663
|
-
};
|
|
575
|
+
timeInterval: 240
|
|
576
|
+
});
|
|
577
|
+
|
|
664
578
|
var _default = BasePicker;
|
|
665
579
|
exports["default"] = _default;
|