shineout 1.7.1 → 1.8.0-beta.2
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/css/DatePicker/utils.js +1 -1
- package/css/Form/Field.js +8 -4
- package/css/Form/Form.js +3 -0
- package/css/Form/Item.js +1 -1
- package/css/Form/index.d.ts +1 -0
- package/css/Form/inputable.js +1 -1
- package/css/Pagination/Jumper.js +3 -0
- package/css/index.d.ts +1 -1
- package/css/index.js +1 -1
- package/dist/shineout.js +24 -14
- package/dist/shineout.js.map +1 -1
- package/dist/shineout.min.js +1 -1
- package/es/Alert/index.js +127 -107
- package/es/Alert/styles/index.js +3 -4
- package/es/AnimationList/AbsoluteList.js +257 -193
- package/es/AnimationList/LazyList.js +120 -92
- package/es/AnimationList/List.js +43 -23
- package/es/AnimationList/index.js +19 -14
- package/es/AnimationList/styles/index.js +3 -4
- package/es/Breadcrumb/index.js +77 -69
- package/es/Breadcrumb/styles/index.js +3 -4
- package/es/Button/Button.js +91 -74
- package/es/Button/Group.js +42 -28
- package/es/Button/Once.js +39 -23
- package/es/Button/index.js +7 -10
- package/es/Button/styles/index.js +3 -4
- package/es/Card/Accordion.js +58 -45
- package/es/Card/Body.js +55 -42
- package/es/Card/Card.js +85 -79
- package/es/Card/Footer.js +38 -15
- package/es/Card/Header.js +52 -34
- package/es/Card/Submit.js +51 -33
- package/es/Card/context.js +22 -16
- package/es/Card/index.js +16 -19
- package/es/Card/styles/index.js +3 -4
- package/es/CardGroup/CardGroup.js +93 -69
- package/es/CardGroup/Item.js +61 -43
- package/es/CardGroup/context.js +12 -10
- package/es/CardGroup/index.js +7 -10
- package/es/CardGroup/styles/index.js +3 -4
- package/es/Carousel/Item.js +31 -17
- package/es/Carousel/index.js +156 -123
- package/es/Carousel/styles/index.js +3 -4
- package/es/Cascader/Cascader.js +397 -346
- package/es/Cascader/FilterList.js +185 -142
- package/es/Cascader/Input.js +102 -79
- package/es/Cascader/List.js +66 -41
- package/es/Cascader/Node.js +153 -110
- package/es/Cascader/Result.js +289 -232
- package/es/Cascader/filter.js +92 -61
- package/es/Cascader/index.js +13 -18
- package/es/Cascader/styles/index.js +3 -4
- package/es/Checkbox/CheckItem.js +168 -154
- package/es/Checkbox/Checkbox.js +2 -3
- package/es/Checkbox/Group.js +106 -85
- package/es/Checkbox/context.js +12 -10
- package/es/Checkbox/index.js +14 -21
- package/es/Checkbox/styles/index.js +3 -4
- package/es/DataList/BaseItem.js +39 -21
- package/es/DataList/Extra.js +33 -17
- package/es/DataList/List.js +166 -140
- package/es/DataList/Meta.js +109 -74
- package/es/DataList/Pagination.js +9 -10
- package/es/DataList/index.js +13 -19
- package/es/DataList/styles/index.js +3 -4
- package/es/DatePicker/Container.js +468 -449
- package/es/DatePicker/Day.js +265 -258
- package/es/DatePicker/Icon.js +34 -20
- package/es/DatePicker/Month.js +101 -79
- package/es/DatePicker/Picker.js +110 -83
- package/es/DatePicker/Quick.js +52 -39
- package/es/DatePicker/Range.js +241 -192
- package/es/DatePicker/Text.js +103 -91
- package/es/DatePicker/Time.js +165 -147
- package/es/DatePicker/TimeScroll.js +148 -116
- package/es/DatePicker/Year.js +74 -53
- package/es/DatePicker/index.js +16 -18
- package/es/DatePicker/paramUtils.js +92 -58
- package/es/DatePicker/styles/index.js +3 -4
- package/es/DatePicker/utils.js +189 -198
- package/es/DatePicker/value.js +139 -98
- package/es/Datum/Form.js +333 -282
- package/es/Datum/List.js +319 -201
- package/es/Datum/Tree.js +298 -239
- package/es/Datum/hoc.js +104 -69
- package/es/Datum/index.js +7 -8
- package/es/Datum/types.js +20 -25
- package/es/Divider/index.js +50 -32
- package/es/Divider/styles/index.js +3 -4
- package/es/Drawer/index.js +14 -9
- package/es/Dropdown/Item.js +56 -43
- package/es/Dropdown/index.js +273 -259
- package/es/Dropdown/styles/index.js +3 -4
- package/es/EditableArea/EditableArea.js +157 -136
- package/es/EditableArea/index.js +8 -15
- package/es/EditableArea/styles/index.js +3 -4
- package/es/Form/Block.js +83 -57
- package/es/Form/BlockField.js +32 -17
- package/es/Form/Field.js +59 -35
- package/es/Form/FieldError.js +27 -21
- package/es/Form/FieldSet.js +214 -156
- package/es/Form/Flow.js +51 -32
- package/es/Form/Form.js +181 -144
- package/es/Form/Item.js +181 -166
- package/es/Form/Loop.js +202 -146
- package/es/Form/formButton.js +58 -42
- package/es/Form/formContext.js +104 -95
- package/es/Form/index.d.ts +1 -0
- package/es/Form/index.js +40 -45
- package/es/Form/inputable.js +368 -292
- package/es/Form/mode.js +15 -9
- package/es/Form/styles/index.js +4 -5
- package/es/Gap/index.js +71 -47
- package/es/Gap/styles/index.js +3 -4
- package/es/Gap/support.js +11 -14
- package/es/Grid/index.js +88 -58
- package/es/Grid/utils.js +57 -58
- package/es/Icon/Icon.js +43 -42
- package/es/Icon/index.js +39 -22
- package/es/Icon/styles/index.js +3 -4
- package/es/Image/Gallery.js +128 -113
- package/es/Image/Group.js +60 -36
- package/es/Image/Image.js +227 -153
- package/es/Image/Magnify.js +123 -94
- package/es/Image/events.js +29 -26
- package/es/Image/index.js +6 -9
- package/es/Image/styles/index.js +3 -4
- package/es/Input/Group.js +17 -11
- package/es/Input/Input.js +158 -134
- package/es/Input/Number.js +199 -175
- package/es/Input/Password.js +54 -31
- package/es/Input/clear.js +41 -25
- package/es/Input/index.js +23 -35
- package/es/Input/styles/index.js +3 -4
- package/es/Lazyload/index.js +63 -42
- package/es/Lazyload/styles/index.js +3 -4
- package/es/Menu/Item.js +275 -236
- package/es/Menu/List.js +75 -67
- package/es/Menu/Root.js +372 -334
- package/es/Menu/context.js +18 -12
- package/es/Menu/index.js +3 -5
- package/es/Menu/styles/index.js +3 -4
- package/es/Message/Container.js +155 -119
- package/es/Message/index.js +42 -30
- package/es/Message/messager.js +29 -33
- package/es/Message/styles/index.js +3 -4
- package/es/Modal/Modal.js +80 -60
- package/es/Modal/Panel.js +258 -234
- package/es/Modal/context.js +15 -15
- package/es/Modal/events.js +213 -182
- package/es/Modal/index.js +12 -14
- package/es/Modal/styles/index.js +3 -4
- package/es/Pagination/Item.js +46 -32
- package/es/Pagination/Jumper.js +79 -66
- package/es/Pagination/Links.js +110 -82
- package/es/Pagination/Next.js +52 -31
- package/es/Pagination/PageSizeList.js +57 -40
- package/es/Pagination/Pagination.js +78 -54
- package/es/Pagination/Prev.js +49 -30
- package/es/Pagination/Simple.js +32 -18
- package/es/Pagination/index.js +68 -41
- package/es/Pagination/styles/index.js +3 -4
- package/es/Popover/Confirm.js +107 -64
- package/es/Popover/Panel.js +284 -231
- package/es/Popover/context.js +15 -12
- package/es/Popover/events.js +80 -86
- package/es/Popover/index.js +12 -14
- package/es/Popover/styles/index.js +3 -4
- package/es/Progress/Circle.js +70 -59
- package/es/Progress/Line.js +51 -39
- package/es/Progress/Popup.js +42 -24
- package/es/Progress/analyzeColor.js +18 -9
- package/es/Progress/index.js +13 -15
- package/es/Progress/styles/index.js +3 -4
- package/es/Radio/Group.js +105 -94
- package/es/Radio/Radio.js +2 -3
- package/es/Radio/index.js +15 -17
- package/es/Radio/styles/index.js +1 -1
- package/es/Rate/Rate.js +216 -167
- package/es/Rate/index.js +17 -10
- package/es/Rate/styles/index.js +3 -4
- package/es/Rule/convert.js +48 -57
- package/es/Rule/index.js +63 -40
- package/es/Rule/length.js +53 -38
- package/es/Rule/regExp.js +23 -14
- package/es/Rule/required.js +26 -18
- package/es/Rule/styles/index.js +1 -1
- package/es/Rule/type.js +26 -18
- package/es/Scroll/Bar.js +145 -117
- package/es/Scroll/Scroll.js +277 -217
- package/es/Scroll/context.js +20 -13
- package/es/Scroll/fixedLength.js +33 -24
- package/es/Scroll/index.js +89 -55
- package/es/Scroll/styles/index.js +3 -4
- package/es/Select/BoxList.js +218 -189
- package/es/Select/BoxOption.js +64 -38
- package/es/Select/FlexBox.js +107 -75
- package/es/Select/FlexResult.js +65 -49
- package/es/Select/Input.js +137 -113
- package/es/Select/More.js +124 -121
- package/es/Select/Option.js +73 -52
- package/es/Select/OptionList.js +236 -200
- package/es/Select/OptionTree.js +111 -96
- package/es/Select/Result.js +297 -271
- package/es/Select/Select.js +517 -491
- package/es/Select/filter.js +221 -148
- package/es/Select/group.js +74 -45
- package/es/Select/index.js +32 -31
- package/es/Select/styles/index.js +3 -4
- package/es/Slider/Container.js +145 -132
- package/es/Slider/Indicator.js +28 -13
- package/es/Slider/Slider.js +132 -103
- package/es/Slider/index.js +5 -8
- package/es/Slider/styles/index.js +3 -4
- package/es/Slider/utils.js +26 -30
- package/es/Spin/Multiple.js +153 -109
- package/es/Spin/Simple.js +33 -22
- package/es/Spin/Spin.js +29 -29
- package/es/Spin/index.js +66 -84
- package/es/Spin/styles/index.js +27 -30
- package/es/Sticky/context.js +12 -10
- package/es/Sticky/index.js +255 -194
- package/es/Sticky/styles/index.js +1 -1
- package/es/Switch/Switch.js +2 -3
- package/es/Switch/index.js +8 -14
- package/es/Table/Checkbox.js +68 -39
- package/es/Table/CheckboxAll.js +121 -64
- package/es/Table/Colgroup.js +72 -47
- package/es/Table/Expand.js +63 -43
- package/es/Table/SeperateTable.js +594 -444
- package/es/Table/SimpleTable.js +215 -136
- package/es/Table/Sorter.js +83 -62
- package/es/Table/Table.js +157 -157
- package/es/Table/Tbody.js +240 -176
- package/es/Table/Td.js +169 -130
- package/es/Table/Thead.js +206 -177
- package/es/Table/Tr.js +249 -205
- package/es/Table/TreeExpand.js +151 -116
- package/es/Table/context.js +15 -15
- package/es/Table/fixedAuto.js +82 -59
- package/es/Table/index.js +309 -228
- package/es/Table/resizable.js +89 -56
- package/es/Table/select.js +238 -215
- package/es/Table/styles/index.js +3 -4
- package/es/Tabs/Header.js +203 -160
- package/es/Tabs/Link.js +46 -28
- package/es/Tabs/Panel.js +49 -33
- package/es/Tabs/Tab.js +97 -79
- package/es/Tabs/Tabs.js +211 -177
- package/es/Tabs/Wrapper.js +37 -17
- package/es/Tabs/index.js +7 -10
- package/es/Tabs/styles/index.js +3 -4
- package/es/Tag/Input.js +70 -54
- package/es/Tag/Tag.js +198 -156
- package/es/Tag/index.js +5 -8
- package/es/Tag/styles/index.js +3 -4
- package/es/Textarea/Textarea.js +139 -118
- package/es/Textarea/index.js +10 -19
- package/es/Tooltip/Container.js +140 -127
- package/es/Tooltip/events.js +49 -55
- package/es/Tooltip/index.js +5 -8
- package/es/Tooltip/styles/index.js +3 -4
- package/es/Transfer/Card.js +212 -177
- package/es/Transfer/Transfer.js +160 -153
- package/es/Transfer/btns.js +97 -80
- package/es/Transfer/context.js +2 -3
- package/es/Transfer/filter.js +65 -35
- package/es/Transfer/index.js +9 -13
- package/es/Transfer/item.js +66 -41
- package/es/Transfer/select.js +15 -16
- package/es/Transfer/styles/index.js +3 -4
- package/es/Tree/Checkbox.js +72 -50
- package/es/Tree/Content.js +136 -95
- package/es/Tree/List.js +82 -53
- package/es/Tree/Node.js +237 -202
- package/es/Tree/Root.js +23 -19
- package/es/Tree/Tree.js +262 -197
- package/es/Tree/index.js +6 -9
- package/es/Tree/styles/index.js +3 -4
- package/es/Tree/toggle.js +89 -51
- package/es/TreeSelect/Input.js +73 -60
- package/es/TreeSelect/Result.js +213 -181
- package/es/TreeSelect/TreeSelect.js +327 -312
- package/es/TreeSelect/datum.js +56 -44
- package/es/TreeSelect/filter.js +134 -96
- package/es/TreeSelect/index.js +15 -23
- package/es/TreeSelect/styles/index.js +3 -4
- package/es/TreeSelect/tiled.js +143 -106
- package/es/Upload/Dragger.js +63 -39
- package/es/Upload/Drop.js +79 -57
- package/es/Upload/File.js +61 -48
- package/es/Upload/FileInput.js +53 -40
- package/es/Upload/Image.js +158 -115
- package/es/Upload/ImageFile.js +63 -43
- package/es/Upload/ImageResult.js +139 -114
- package/es/Upload/Progress.js +117 -105
- package/es/Upload/RemoveConfirm.js +58 -42
- package/es/Upload/Result.js +73 -58
- package/es/Upload/Upload.js +649 -490
- package/es/Upload/accept.js +33 -13
- package/es/Upload/context.js +12 -10
- package/es/Upload/index.js +16 -20
- package/es/Upload/request.js +48 -46
- package/es/Upload/styles/index.js +3 -4
- package/es/component.js +45 -24
- package/es/config.js +27 -19
- package/es/context/implementation.js +132 -94
- package/es/context/index.js +3 -4
- package/es/hoc/coin.js +118 -81
- package/es/hoc/config.js +31 -17
- package/es/hoc/delay.js +99 -55
- package/es/hoc/draggable.js +90 -80
- package/es/hoc/fetch.js +56 -33
- package/es/hoc/hidable.js +119 -98
- package/es/hoc/inputBorder.js +158 -158
- package/es/hoc/moveable.js +124 -96
- package/es/hoc/pagable.js +74 -55
- package/es/hoc/resizable.js +132 -100
- package/es/hoc/styles/index.js +7 -8
- package/es/hoc/trim.js +54 -32
- package/es/icons/Caret.js +14 -15
- package/es/icons/index.js +31 -85
- package/es/index.d.ts +1 -1
- package/es/index.js +58 -57
- package/es/locale/en_US.js +9 -30
- package/es/locale/index.js +13 -14
- package/es/locale/zh-CN.js +9 -17
- package/es/styles/expose.js +3 -4
- package/es/styles/index.js +1 -1
- package/es/utils/accept.js +15 -12
- package/es/utils/classname.js +23 -12
- package/es/utils/cleanProps.js +9 -21
- package/es/utils/clone.js +34 -27
- package/es/utils/color.js +310 -276
- package/es/utils/css-accessors.js +94 -45
- package/es/utils/dom/detect.js +29 -29
- package/es/utils/dom/document.js +23 -19
- package/es/utils/dom/element.js +139 -105
- package/es/utils/dom/getDataset.js +9 -9
- package/es/utils/dom/isDOMElement.js +3 -5
- package/es/utils/dom/normalizeWheel.js +32 -28
- package/es/utils/dom/popContainer.js +12 -13
- package/es/utils/dom/popover.js +79 -59
- package/es/utils/dom/ready.js +5 -6
- package/es/utils/dom/translate.js +10 -12
- package/es/utils/errors.js +47 -28
- package/es/utils/expose.js +97 -58
- package/es/utils/flat.js +122 -107
- package/es/utils/func.js +38 -20
- package/es/utils/hash.js +24 -20
- package/es/utils/index.js +24 -49
- package/es/utils/is.js +91 -70
- package/es/utils/lazyload.js +104 -86
- package/es/utils/notification.js +34 -20
- package/es/utils/numbers.js +61 -51
- package/es/utils/objects.js +221 -140
- package/es/utils/proptypes.js +21 -34
- package/es/utils/shallowEqual.js +46 -42
- package/es/utils/strings.js +50 -32
- package/es/utils/transform.js +24 -9
- package/es/utils/tree.js +78 -63
- package/es/utils/uid.js +14 -17
- package/es/utils/validate/index.js +71 -50
- package/es/utils/validate/isJson.js +7 -10
- package/es/utils/validate/nullable.js +10 -9
- package/es/utils/validate/range.js +22 -19
- package/es/utils/validate/rangeLength.js +19 -16
- package/es/utils/validate/regExp.js +10 -10
- package/es/utils/validate/required.js +11 -8
- package/es/utils/validate/type.js +56 -59
- package/es/utils/vars-inject.js +3420 -4248
- package/lib/DatePicker/utils.js +1 -1
- package/lib/Form/Field.js +8 -4
- package/lib/Form/Form.js +3 -0
- package/lib/Form/Item.js +1 -1
- package/lib/Form/index.d.ts +1 -0
- package/lib/Form/inputable.js +1 -1
- package/lib/Pagination/Jumper.js +3 -0
- package/lib/index.d.ts +1 -1
- package/lib/index.js +1 -1
- package/package.json +3 -2
package/es/DatePicker/Day.js
CHANGED
|
@@ -1,296 +1,304 @@
|
|
|
1
|
-
import
|
|
2
|
-
import
|
|
3
|
-
import
|
|
4
|
-
import
|
|
5
|
-
import
|
|
6
|
-
import
|
|
7
|
-
import
|
|
8
|
-
import
|
|
9
|
-
import
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
1
|
+
import _extends from "@babel/runtime/helpers/extends";
|
|
2
|
+
import _inheritsLoose from "@babel/runtime/helpers/inheritsLoose";
|
|
3
|
+
import _assertThisInitialized from "@babel/runtime/helpers/assertThisInitialized";
|
|
4
|
+
import React from 'react';
|
|
5
|
+
import PropTypes from 'prop-types';
|
|
6
|
+
import { datepickerClass } from './styles';
|
|
7
|
+
import utils from './utils';
|
|
8
|
+
import paramUtils from './paramUtils';
|
|
9
|
+
import Icon from './Icon';
|
|
10
|
+
import { getLocale } from '../locale';
|
|
11
|
+
import { PureComponent } from '../component';
|
|
12
|
+
import Time from './Time';
|
|
13
|
+
var minStr = 'yyyy-MM-dd 00:00:00';
|
|
14
|
+
var maxStr = 'yyyy-MM-dd 23:59:59';
|
|
15
|
+
|
|
16
|
+
var Day =
|
|
17
|
+
/*#__PURE__*/
|
|
18
|
+
function (_PureComponent) {
|
|
19
|
+
_inheritsLoose(Day, _PureComponent);
|
|
20
|
+
|
|
21
|
+
function Day(props) {
|
|
22
|
+
var _this;
|
|
23
|
+
|
|
24
|
+
_this = _PureComponent.call(this, props) || this;
|
|
25
|
+
_this.state = {
|
|
26
|
+
hover: null
|
|
27
|
+
};
|
|
28
|
+
_this.handleNextMonth = _this.handleMonth.bind(_assertThisInitialized(_assertThisInitialized(_this)), 1);
|
|
29
|
+
_this.handlePrevMonth = _this.handleMonth.bind(_assertThisInitialized(_assertThisInitialized(_this)), -1);
|
|
30
|
+
_this.handleNextYear = _this.handleMonth.bind(_assertThisInitialized(_assertThisInitialized(_this)), 12);
|
|
31
|
+
_this.handlePrevYear = _this.handleMonth.bind(_assertThisInitialized(_assertThisInitialized(_this)), -12);
|
|
32
|
+
_this.handleMonthMode = _this.handleModeChange.bind(_assertThisInitialized(_assertThisInitialized(_this)), 'month');
|
|
33
|
+
_this.handleYearMode = _this.handleModeChange.bind(_assertThisInitialized(_assertThisInitialized(_this)), 'year');
|
|
34
|
+
_this.handleWeekLeave = _this.handleWeek.bind(_assertThisInitialized(_assertThisInitialized(_this)), null);
|
|
35
|
+
_this.handleTimeChange = _this.handleTimeChange.bind(_assertThisInitialized(_assertThisInitialized(_this)));
|
|
36
|
+
_this.formatWithDefaultTime = _this.formatWithDefaultTime.bind(_assertThisInitialized(_assertThisInitialized(_this)));
|
|
37
|
+
return _this;
|
|
31
38
|
}
|
|
32
39
|
|
|
33
|
-
|
|
34
|
-
const { current } = this.props
|
|
35
|
-
if (!current) return this.cachedDays
|
|
36
|
-
const date = utils.clearHMS(current)
|
|
37
|
-
if (this.cachedDate && utils.isSameMonth(this.cachedDate, date) && this.cachedDays) {
|
|
38
|
-
return this.cachedDays
|
|
39
|
-
}
|
|
40
|
-
this.cachedDays = utils.getDaysOfMonth(date)
|
|
41
|
-
this.cachedDate = date
|
|
40
|
+
var _proto = Day.prototype;
|
|
42
41
|
|
|
43
|
-
|
|
44
|
-
|
|
42
|
+
_proto.getDays = function getDays() {
|
|
43
|
+
var current = this.props.current;
|
|
44
|
+
if (!current) return this.cachedDays;
|
|
45
|
+
var date = utils.clearHMS(current);
|
|
45
46
|
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
if (typeof index === 'number') idx = index
|
|
50
|
-
if (typeof i === 'number') idx = i
|
|
51
|
-
if (!defaultTime[idx]) return current
|
|
52
|
-
return utils.cloneTime(current, defaultTime[idx], utils.TIME_FORMAT)
|
|
53
|
-
}
|
|
47
|
+
if (this.cachedDate && utils.isSameMonth(this.cachedDate, date) && this.cachedDays) {
|
|
48
|
+
return this.cachedDays;
|
|
49
|
+
}
|
|
54
50
|
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
51
|
+
this.cachedDays = utils.getDaysOfMonth(date);
|
|
52
|
+
this.cachedDate = date;
|
|
53
|
+
return this.cachedDays;
|
|
54
|
+
};
|
|
55
|
+
|
|
56
|
+
_proto.formatWithDefaultTime = function formatWithDefaultTime(i) {
|
|
57
|
+
var idx = 0;
|
|
58
|
+
var _this$props = this.props,
|
|
59
|
+
current = _this$props.current,
|
|
60
|
+
defaultTime = _this$props.defaultTime,
|
|
61
|
+
index = _this$props.index;
|
|
62
|
+
if (typeof index === 'number') idx = index;
|
|
63
|
+
if (typeof i === 'number') idx = i;
|
|
64
|
+
if (!defaultTime[idx]) return current;
|
|
65
|
+
return utils.cloneTime(current, defaultTime[idx], utils.TIME_FORMAT);
|
|
66
|
+
};
|
|
67
|
+
|
|
68
|
+
_proto.handleDayDoubleClick = function handleDayDoubleClick(date) {
|
|
69
|
+
var _this$props2 = this.props,
|
|
70
|
+
type = _this$props2.type,
|
|
71
|
+
defaultTime = _this$props2.defaultTime,
|
|
72
|
+
index = _this$props2.index; // range & datetime & deafultTime
|
|
73
|
+
|
|
74
|
+
if (type !== 'datetime' || !defaultTime.length || index === undefined) return;
|
|
75
|
+
this.handleDayClick(date, 0);
|
|
76
|
+
this.handleDayClick(date, 1);
|
|
77
|
+
};
|
|
78
|
+
|
|
79
|
+
_proto.handleDayClick = function handleDayClick(date, sync) {
|
|
80
|
+
var _this$props3 = this.props,
|
|
81
|
+
type = _this$props3.type,
|
|
82
|
+
allowSingle = _this$props3.allowSingle,
|
|
83
|
+
rangeDate = _this$props3.rangeDate,
|
|
84
|
+
min = _this$props3.min,
|
|
85
|
+
max = _this$props3.max,
|
|
86
|
+
index = _this$props3.index,
|
|
87
|
+
value = _this$props3.value;
|
|
88
|
+
var current = index === sync && value || this.formatWithDefaultTime(sync);
|
|
89
|
+
var onChange = typeof sync === 'number' ? this.props.onChangeSync.bind(this.props, sync) : this.props.onChange;
|
|
62
90
|
|
|
63
|
-
handleDayClick(date, sync) {
|
|
64
|
-
const { type, allowSingle, rangeDate, min, max, index, value } = this.props
|
|
65
|
-
const current = (index === sync && value) || this.formatWithDefaultTime(sync)
|
|
66
|
-
const onChange = typeof sync === 'number' ? this.props.onChangeSync.bind(this.props, sync) : this.props.onChange
|
|
67
91
|
if (type === 'week') {
|
|
68
|
-
onChange(
|
|
92
|
+
onChange.apply(void 0, paramUtils.weekHandleChangeParams(date, true, true));
|
|
69
93
|
} else {
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
current.getSeconds()
|
|
77
|
-
)
|
|
78
|
-
// only can select day with the same day of min/max
|
|
79
|
-
if (min && utils.compareAsc(newDate, min) < 0) utils.setTime(newDate, min)
|
|
80
|
-
if (max && utils.compareAsc(newDate, max) > 0) utils.setTime(newDate, max)
|
|
81
|
-
|
|
82
|
-
if (
|
|
83
|
-
allowSingle &&
|
|
84
|
-
rangeDate[index] &&
|
|
85
|
-
utils.clearHMS(newDate).getTime() === utils.clearHMS(rangeDate[index]).getTime()
|
|
86
|
-
)
|
|
87
|
-
newDate = ''
|
|
88
|
-
|
|
89
|
-
onChange(...paramUtils.dayHandleChangeParams(newDate, true, type !== 'datetime'))
|
|
94
|
+
var newDate = new Date(date.getFullYear(), date.getMonth(), date.getDate(), current.getHours(), current.getMinutes(), current.getSeconds()); // only can select day with the same day of min/max
|
|
95
|
+
|
|
96
|
+
if (min && utils.compareAsc(newDate, min) < 0) utils.setTime(newDate, min);
|
|
97
|
+
if (max && utils.compareAsc(newDate, max) > 0) utils.setTime(newDate, max);
|
|
98
|
+
if (allowSingle && rangeDate[index] && utils.clearHMS(newDate).getTime() === utils.clearHMS(rangeDate[index]).getTime()) newDate = '';
|
|
99
|
+
onChange.apply(void 0, paramUtils.dayHandleChangeParams(newDate, true, type !== 'datetime'));
|
|
90
100
|
}
|
|
91
|
-
}
|
|
101
|
+
};
|
|
92
102
|
|
|
93
|
-
handleTimeChange(time, change, end, mode) {
|
|
94
|
-
|
|
95
|
-
}
|
|
103
|
+
_proto.handleTimeChange = function handleTimeChange(time, change, end, mode) {
|
|
104
|
+
var _this$props4;
|
|
96
105
|
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
}
|
|
106
|
+
(_this$props4 = this.props).onChange.apply(_this$props4, paramUtils.timeHandleChangeParams(time, true, false, mode));
|
|
107
|
+
};
|
|
100
108
|
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
return
|
|
107
|
-
}
|
|
108
|
-
onChange(...paramUtils.monthHandleChangeParams(utils.addMonths(current, month)))
|
|
109
|
-
}
|
|
109
|
+
_proto.handleWeek = function handleWeek(hover) {
|
|
110
|
+
this.setState({
|
|
111
|
+
hover: hover
|
|
112
|
+
});
|
|
113
|
+
};
|
|
110
114
|
|
|
111
|
-
|
|
112
|
-
this.props
|
|
113
|
-
|
|
115
|
+
_proto.handleMonth = function handleMonth(month) {
|
|
116
|
+
var _this$props5 = this.props,
|
|
117
|
+
current = _this$props5.current,
|
|
118
|
+
onChange = _this$props5.onChange; // warning: month === 12 || month === -12, this is statement is year mode.
|
|
114
119
|
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
120
|
+
if (month === -12 || month === 12) {
|
|
121
|
+
onChange.apply(void 0, paramUtils.yearHandleChangeParams(utils.addMonths(current, month)));
|
|
122
|
+
return;
|
|
123
|
+
}
|
|
118
124
|
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
125
|
+
onChange.apply(void 0, paramUtils.monthHandleChangeParams(utils.addMonths(current, month)));
|
|
126
|
+
};
|
|
127
|
+
|
|
128
|
+
_proto.handleModeChange = function handleModeChange(mode) {
|
|
129
|
+
this.props.onModeChange(mode);
|
|
130
|
+
};
|
|
131
|
+
|
|
132
|
+
_proto.handleDayHover = function handleDayHover(date) {
|
|
133
|
+
this.props.onDayHover(date);
|
|
134
|
+
};
|
|
135
|
+
|
|
136
|
+
_proto.renderDay = function renderDay(date, minD, maxD) {
|
|
137
|
+
var _this$props6 = this.props,
|
|
138
|
+
current = _this$props6.current,
|
|
139
|
+
disabled = _this$props6.disabled,
|
|
140
|
+
value = _this$props6.value,
|
|
141
|
+
index = _this$props6.index,
|
|
142
|
+
type = _this$props6.type,
|
|
143
|
+
rangeDate = _this$props6.rangeDate,
|
|
144
|
+
range = _this$props6.range,
|
|
145
|
+
rangeTemp = _this$props6.rangeTemp,
|
|
146
|
+
min = _this$props6.min,
|
|
147
|
+
max = _this$props6.max;
|
|
148
|
+
var hover = this.state.hover;
|
|
149
|
+
var hmsDate = utils.toDate(date);
|
|
150
|
+
utils.setTime(hmsDate, current);
|
|
151
|
+
var isDisabled = disabled ? disabled(date) : false; // only for single, single picker don't has index
|
|
125
152
|
|
|
126
|
-
// only for single, single picker don't has index
|
|
127
153
|
if (index === undefined && !isDisabled) {
|
|
128
|
-
if (
|
|
154
|
+
if (minD && utils.compareAsc(date, minD) < 0 || maxD && utils.compareAsc(date, maxD) > 0) isDisabled = true;
|
|
129
155
|
}
|
|
156
|
+
|
|
130
157
|
if (!isDisabled && index === 1) {
|
|
131
|
-
if (
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
utils.compareAsc(date, max) > 0
|
|
136
|
-
) {
|
|
137
|
-
isDisabled = true
|
|
138
|
-
}
|
|
139
|
-
// if (utils.compareAsc(date, min) < 0) isDisabled = true
|
|
158
|
+
if (typeof range === 'number' && utils.compareAsc(date, utils.addSeconds(rangeTemp, range)) > 0 || utils.compareAsc(date, utils.clearHMS(rangeTemp)) < 0 || utils.compareAsc(date, utils.clearHMS(min)) < 0 || utils.compareAsc(date, max) > 0) {
|
|
159
|
+
isDisabled = true;
|
|
160
|
+
} // if (utils.compareAsc(date, min) < 0) isDisabled = true
|
|
161
|
+
|
|
140
162
|
}
|
|
141
163
|
|
|
142
164
|
if (!isDisabled && index === 0) {
|
|
143
165
|
if (utils.compareAsc(date, utils.clearHMS(min)) < 0 || utils.compareAsc(date, max) > 0) {
|
|
144
|
-
isDisabled = true
|
|
166
|
+
isDisabled = true;
|
|
145
167
|
}
|
|
146
168
|
}
|
|
147
169
|
|
|
148
|
-
|
|
149
|
-
|
|
150
|
-
|
|
151
|
-
|
|
152
|
-
|
|
170
|
+
var classList = [utils.isSameDay(date, this.today) && 'today', current.getMonth() !== date.getMonth() && 'other-month', isDisabled && 'disabled'];
|
|
171
|
+
var hoverClass;
|
|
172
|
+
var hoverProps = {};
|
|
173
|
+
var weekStart = getLocale('startOfWeek');
|
|
174
|
+
var weekEnd = weekStart ? 0 : 6;
|
|
153
175
|
|
|
154
|
-
let hoverClass
|
|
155
|
-
const hoverProps = {}
|
|
156
|
-
const weekStart = getLocale('startOfWeek')
|
|
157
|
-
const weekEnd = weekStart ? 0 : 6
|
|
158
176
|
if (type === 'week') {
|
|
159
|
-
hoverProps.onMouseEnter = this.handleWeek.bind(this, date)
|
|
160
|
-
hoverProps.onMouseLeave = this.handleWeekLeave
|
|
161
|
-
|
|
162
|
-
|
|
163
|
-
|
|
164
|
-
|
|
165
|
-
|
|
166
|
-
|
|
167
|
-
|
|
168
|
-
|
|
169
|
-
|
|
170
|
-
)
|
|
171
|
-
} else if (
|
|
172
|
-
hover &&
|
|
173
|
-
utils.isSameWeek(date, hover, {
|
|
174
|
-
weekStartsOn: weekStart,
|
|
175
|
-
})
|
|
176
|
-
) {
|
|
177
|
-
hoverClass = datepickerClass(
|
|
178
|
-
'hover',
|
|
179
|
-
date.getDay() === weekStart && 'hover-start',
|
|
180
|
-
date.getDay() === weekEnd && 'hover-end'
|
|
181
|
-
)
|
|
177
|
+
hoverProps.onMouseEnter = this.handleWeek.bind(this, date);
|
|
178
|
+
hoverProps.onMouseLeave = this.handleWeekLeave;
|
|
179
|
+
|
|
180
|
+
if (utils.isSameWeek(date, value, {
|
|
181
|
+
weekStartsOn: weekStart
|
|
182
|
+
})) {
|
|
183
|
+
hoverClass = datepickerClass('active', date.getDay() === weekStart && 'hover-start', date.getDay() === weekEnd && 'hover-end');
|
|
184
|
+
} else if (hover && utils.isSameWeek(date, hover, {
|
|
185
|
+
weekStartsOn: weekStart
|
|
186
|
+
})) {
|
|
187
|
+
hoverClass = datepickerClass('hover', date.getDay() === weekStart && 'hover-start', date.getDay() === weekEnd && 'hover-end');
|
|
182
188
|
}
|
|
183
189
|
} else if (rangeDate && current.getMonth() === date.getMonth()) {
|
|
184
|
-
hoverProps.onMouseEnter = this.handleDayHover.bind(this, date)
|
|
185
|
-
|
|
186
|
-
|
|
187
|
-
|
|
188
|
-
hoverClass = datepickerClass(
|
|
189
|
-
utils.compareAsc(rangeDate[0], date) <= 0 && utils.compareAsc(rangeDate[1], date) >= 0 && 'hover',
|
|
190
|
-
// Datetime Picker range end datetime classname #330
|
|
191
|
-
utils.isSameDay(rangeDate[index], date) && `hover-${index === 0 ? 'start' : 'end'} active`
|
|
192
|
-
)
|
|
190
|
+
hoverProps.onMouseEnter = this.handleDayHover.bind(this, date);
|
|
191
|
+
classList.push(utils.isSameDay(date, rangeDate[index]) && 'active');
|
|
192
|
+
hoverClass = datepickerClass(utils.compareAsc(rangeDate[0], date) <= 0 && utils.compareAsc(rangeDate[1], date) >= 0 && 'hover', // Datetime Picker range end datetime classname #330
|
|
193
|
+
utils.isSameDay(rangeDate[index], date) && "hover-" + (index === 0 ? 'start' : 'end') + " active");
|
|
193
194
|
} else if (value) {
|
|
194
|
-
classList.push(utils.isSameDay(date, value) && 'active')
|
|
195
|
+
classList.push(utils.isSameDay(date, value) && 'active');
|
|
195
196
|
}
|
|
196
197
|
|
|
197
|
-
return (
|
|
198
|
-
|
|
199
|
-
|
|
200
|
-
|
|
201
|
-
|
|
202
|
-
|
|
203
|
-
|
|
204
|
-
|
|
205
|
-
|
|
206
|
-
|
|
207
|
-
|
|
208
|
-
|
|
209
|
-
|
|
210
|
-
|
|
211
|
-
|
|
212
|
-
if (this.props.type !== 'datetime') return undefined
|
|
213
|
-
if (!showTimePicker) return undefined
|
|
198
|
+
return React.createElement("div", _extends({
|
|
199
|
+
key: date.getTime(),
|
|
200
|
+
className: hoverClass,
|
|
201
|
+
onClick: isDisabled ? undefined : this.handleDayClick.bind(this, date),
|
|
202
|
+
onDoubleClick: isDisabled ? undefined : this.handleDayDoubleClick.bind(this, date)
|
|
203
|
+
}, hoverProps), React.createElement("span", {
|
|
204
|
+
className: datepickerClass.apply(void 0, classList)
|
|
205
|
+
}, date.getDate()));
|
|
206
|
+
};
|
|
207
|
+
|
|
208
|
+
_proto.renderTimepicker = function renderTimepicker() {
|
|
209
|
+
var _this$props7 = this.props,
|
|
210
|
+
rangeDate = _this$props7.rangeDate,
|
|
211
|
+
index = _this$props7.index,
|
|
212
|
+
showTimePicker = _this$props7.showTimePicker;
|
|
213
|
+
if (this.props.type !== 'datetime') return undefined;
|
|
214
|
+
if (!showTimePicker) return undefined;
|
|
215
|
+
var format = this.props.format;
|
|
214
216
|
|
|
215
|
-
let { format } = this.props
|
|
216
217
|
if (/^[T|t]$/.test(format)) {
|
|
217
|
-
format = 'HH:mm:ss'
|
|
218
|
+
format = 'HH:mm:ss';
|
|
218
219
|
} else {
|
|
219
|
-
|
|
220
|
-
// eslint-disable-next-line
|
|
221
|
-
if (match) format = match[0]
|
|
222
|
-
}
|
|
220
|
+
var match = format.match(/[H|h].*/); // eslint-disable-next-line
|
|
223
221
|
|
|
224
|
-
|
|
225
|
-
|
|
222
|
+
if (match) format = match[0];
|
|
223
|
+
}
|
|
226
224
|
|
|
227
|
-
|
|
228
|
-
|
|
229
|
-
|
|
230
|
-
|
|
231
|
-
|
|
232
|
-
|
|
233
|
-
|
|
234
|
-
|
|
225
|
+
var value = rangeDate ? utils.toDateWithFormat(rangeDate[index], format) : this.props.value;
|
|
226
|
+
if (!value) return undefined;
|
|
227
|
+
return React.createElement("div", {
|
|
228
|
+
className: datepickerClass('datetime')
|
|
229
|
+
}, React.createElement(Icon, {
|
|
230
|
+
name: "Clock",
|
|
231
|
+
className: "clock"
|
|
232
|
+
}), React.createElement(Time, _extends({}, this.props, {
|
|
233
|
+
format: format,
|
|
234
|
+
value: value,
|
|
235
|
+
onChange: this.handleTimeChange
|
|
236
|
+
})), React.createElement("span", null, utils.format(value, format)));
|
|
237
|
+
};
|
|
238
|
+
|
|
239
|
+
_proto.render = function render() {
|
|
240
|
+
var _this2 = this;
|
|
241
|
+
|
|
242
|
+
var _this$props8 = this.props,
|
|
243
|
+
current = _this$props8.current,
|
|
244
|
+
min = _this$props8.min,
|
|
245
|
+
index = _this$props8.index,
|
|
246
|
+
max = _this$props8.max;
|
|
247
|
+
var days = this.getDays();
|
|
248
|
+
this.today = utils.newDate();
|
|
249
|
+
var minDate = min && utils.toDate(utils.format(min, minStr, new Date()));
|
|
250
|
+
var maxDate = max && utils.toDate(utils.format(max, maxStr, new Date()));
|
|
251
|
+
return React.createElement("div", {
|
|
252
|
+
className: datepickerClass('day-picker')
|
|
253
|
+
}, React.createElement("div", {
|
|
254
|
+
className: datepickerClass('title')
|
|
255
|
+
}, getLocale('pickerTitle')[index]), React.createElement("div", {
|
|
256
|
+
className: datepickerClass('header')
|
|
257
|
+
}, React.createElement(Icon, {
|
|
258
|
+
name: "AngleDoubleLeft",
|
|
259
|
+
className: "left",
|
|
260
|
+
disabled: !!(min && current.getFullYear() <= min.getFullYear()),
|
|
261
|
+
onClick: this.handlePrevYear
|
|
262
|
+
}), React.createElement(Icon, {
|
|
263
|
+
name: "AngleLeft",
|
|
264
|
+
className: "left",
|
|
265
|
+
disabled: !!(min && utils.compareMonth(current, min) <= 0),
|
|
266
|
+
onClick: this.handlePrevMonth
|
|
267
|
+
}), React.createElement("span", {
|
|
268
|
+
className: datepickerClass('ym')
|
|
269
|
+
}, React.createElement("span", {
|
|
270
|
+
onClick: this.handleYearMode
|
|
271
|
+
}, current.getFullYear()), React.createElement("span", {
|
|
272
|
+
onClick: this.handleMonthMode
|
|
273
|
+
}, getLocale('monthValues.short')[current.getMonth()])), React.createElement(Icon, {
|
|
274
|
+
name: "AngleRight",
|
|
275
|
+
className: "right" // disabled={max && utils.compareMonth(current, max, 0) >= 0}
|
|
276
|
+
,
|
|
277
|
+
onClick: this.handleNextMonth
|
|
278
|
+
}), React.createElement(Icon, {
|
|
279
|
+
onClick: this.handleNextYear // disabled={max && current.getFullYear() >= max.getFullYear()}
|
|
280
|
+
,
|
|
281
|
+
name: "AngleDoubleRight",
|
|
282
|
+
className: "right"
|
|
283
|
+
})), React.createElement("div", {
|
|
284
|
+
className: datepickerClass('week')
|
|
285
|
+
}, getLocale('weekdayValues.narrow').map(function (w) {
|
|
286
|
+
return React.createElement("span", {
|
|
287
|
+
key: w
|
|
288
|
+
}, w);
|
|
289
|
+
})), React.createElement("div", {
|
|
290
|
+
className: datepickerClass('list')
|
|
291
|
+
}, days.map(function (d) {
|
|
292
|
+
return _this2.renderDay(d, minDate, maxDate);
|
|
293
|
+
})), React.createElement("div", {
|
|
294
|
+
style: {
|
|
295
|
+
flex: 1
|
|
296
|
+
}
|
|
297
|
+
}), this.renderTimepicker());
|
|
298
|
+
};
|
|
235
299
|
|
|
236
|
-
|
|
237
|
-
|
|
238
|
-
const days = this.getDays()
|
|
239
|
-
this.today = utils.newDate()
|
|
240
|
-
const minDate = min && utils.toDate(utils.format(min, minStr, new Date()))
|
|
241
|
-
const maxDate = max && utils.toDate(utils.format(max, maxStr, new Date()))
|
|
242
|
-
|
|
243
|
-
return (
|
|
244
|
-
<div className={datepickerClass('day-picker')}>
|
|
245
|
-
<div className={datepickerClass('title')}>{getLocale('pickerTitle')[index]}</div>
|
|
246
|
-
<div className={datepickerClass('header')}>
|
|
247
|
-
<Icon
|
|
248
|
-
name="AngleDoubleLeft"
|
|
249
|
-
className="left"
|
|
250
|
-
disabled={!!(min && current.getFullYear() <= min.getFullYear())}
|
|
251
|
-
onClick={this.handlePrevYear}
|
|
252
|
-
/>
|
|
253
|
-
<Icon
|
|
254
|
-
name="AngleLeft"
|
|
255
|
-
className="left"
|
|
256
|
-
disabled={!!(min && utils.compareMonth(current, min) <= 0)}
|
|
257
|
-
onClick={this.handlePrevMonth}
|
|
258
|
-
/>
|
|
259
|
-
|
|
260
|
-
<span className={datepickerClass('ym')}>
|
|
261
|
-
<span onClick={this.handleYearMode}>{current.getFullYear()}</span>
|
|
262
|
-
<span onClick={this.handleMonthMode}>{getLocale('monthValues.short')[current.getMonth()]}</span>
|
|
263
|
-
</span>
|
|
264
|
-
|
|
265
|
-
<Icon
|
|
266
|
-
name="AngleRight"
|
|
267
|
-
className="right"
|
|
268
|
-
// disabled={max && utils.compareMonth(current, max, 0) >= 0}
|
|
269
|
-
onClick={this.handleNextMonth}
|
|
270
|
-
/>
|
|
271
|
-
<Icon
|
|
272
|
-
onClick={this.handleNextYear}
|
|
273
|
-
// disabled={max && current.getFullYear() >= max.getFullYear()}
|
|
274
|
-
name="AngleDoubleRight"
|
|
275
|
-
className="right"
|
|
276
|
-
/>
|
|
277
|
-
</div>
|
|
278
|
-
|
|
279
|
-
<div className={datepickerClass('week')}>
|
|
280
|
-
{getLocale('weekdayValues.narrow').map(w => (
|
|
281
|
-
<span key={w}>{w}</span>
|
|
282
|
-
))}
|
|
283
|
-
</div>
|
|
284
|
-
|
|
285
|
-
<div className={datepickerClass('list')}>{days.map(d => this.renderDay(d, minDate, maxDate))}</div>
|
|
286
|
-
|
|
287
|
-
<div style={{ flex: 1 }} />
|
|
288
|
-
|
|
289
|
-
{this.renderTimepicker()}
|
|
290
|
-
</div>
|
|
291
|
-
)
|
|
292
|
-
}
|
|
293
|
-
}
|
|
300
|
+
return Day;
|
|
301
|
+
}(PureComponent);
|
|
294
302
|
|
|
295
303
|
Day.propTypes = {
|
|
296
304
|
current: PropTypes.object.isRequired,
|
|
@@ -310,7 +318,6 @@ Day.propTypes = {
|
|
|
310
318
|
type: PropTypes.string.isRequired,
|
|
311
319
|
value: PropTypes.object,
|
|
312
320
|
defaultTime: PropTypes.array,
|
|
313
|
-
allowSingle: PropTypes.bool
|
|
314
|
-
}
|
|
315
|
-
|
|
316
|
-
export default Day
|
|
321
|
+
allowSingle: PropTypes.bool
|
|
322
|
+
};
|
|
323
|
+
export default Day;
|
package/es/DatePicker/Icon.js
CHANGED
|
@@ -1,31 +1,45 @@
|
|
|
1
|
-
import
|
|
2
|
-
import
|
|
3
|
-
import
|
|
4
|
-
import
|
|
1
|
+
import _inheritsLoose from "@babel/runtime/helpers/inheritsLoose";
|
|
2
|
+
import { createElement, PureComponent } from 'react';
|
|
3
|
+
import PropTypes from 'prop-types';
|
|
4
|
+
import icons from '../icons';
|
|
5
|
+
import { datepickerClass } from './styles';
|
|
5
6
|
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
7
|
+
var Icon =
|
|
8
|
+
/*#__PURE__*/
|
|
9
|
+
function (_PureComponent) {
|
|
10
|
+
_inheritsLoose(Icon, _PureComponent);
|
|
9
11
|
|
|
10
|
-
|
|
12
|
+
function Icon() {
|
|
13
|
+
return _PureComponent.apply(this, arguments) || this;
|
|
14
|
+
}
|
|
15
|
+
|
|
16
|
+
var _proto = Icon.prototype;
|
|
17
|
+
|
|
18
|
+
_proto.render = function render() {
|
|
19
|
+
var _this$props = this.props,
|
|
20
|
+
className = _this$props.className,
|
|
21
|
+
name = _this$props.name,
|
|
22
|
+
onClick = _this$props.onClick,
|
|
23
|
+
tag = _this$props.tag,
|
|
24
|
+
disabled = _this$props.disabled;
|
|
25
|
+
var newProps = {
|
|
11
26
|
className: datepickerClass(className, 'icon', disabled && 'disabled'),
|
|
12
|
-
onClick: disabled ? undefined : onClick
|
|
13
|
-
}
|
|
27
|
+
onClick: disabled ? undefined : onClick
|
|
28
|
+
};
|
|
29
|
+
return createElement(tag, newProps, icons[name]);
|
|
30
|
+
};
|
|
14
31
|
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
}
|
|
32
|
+
return Icon;
|
|
33
|
+
}(PureComponent);
|
|
18
34
|
|
|
19
35
|
Icon.propTypes = {
|
|
20
36
|
className: PropTypes.string,
|
|
21
37
|
disabled: PropTypes.bool,
|
|
22
38
|
name: PropTypes.string.isRequired,
|
|
23
39
|
onClick: PropTypes.func,
|
|
24
|
-
tag: PropTypes.string
|
|
25
|
-
}
|
|
26
|
-
|
|
40
|
+
tag: PropTypes.string
|
|
41
|
+
};
|
|
27
42
|
Icon.defaultProps = {
|
|
28
|
-
tag: 'span'
|
|
29
|
-
}
|
|
30
|
-
|
|
31
|
-
export default Icon
|
|
43
|
+
tag: 'span'
|
|
44
|
+
};
|
|
45
|
+
export default Icon;
|