antd3-esm 1.0.1
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/LICENSE +21 -0
- package/dist/Checkbox.js +164 -0
- package/dist/CommonMixin.js +816 -0
- package/dist/Divider.js +646 -0
- package/dist/Notification.js +279 -0
- package/dist/Pagination.js +1106 -0
- package/dist/PortalWrapper.js +347 -0
- package/dist/RowContext.js +5 -0
- package/dist/Sider.js +533 -0
- package/dist/TextArea.js +432 -0
- package/dist/_arrayMap.js +68 -0
- package/dist/_assignValue.js +95 -0
- package/dist/_copyArray.js +31 -0
- package/dist/_hasPath.js +53 -0
- package/dist/_overArg.js +437 -0
- package/dist/_stringToArray.js +136 -0
- package/dist/antd/es/affix.js +12 -0
- package/dist/antd/es/alert.js +5 -0
- package/dist/antd/es/anchor.js +466 -0
- package/dist/antd/es/auto-complete.js +5 -0
- package/dist/antd/es/avatar.js +5 -0
- package/dist/antd/es/back-top.js +5 -0
- package/dist/antd/es/badge.js +5 -0
- package/dist/antd/es/breadcrumb.js +18 -0
- package/dist/antd/es/button.js +12 -0
- package/dist/antd/es/calendar.js +953 -0
- package/dist/antd/es/card.js +5 -0
- package/dist/antd/es/carousel.js +5 -0
- package/dist/antd/es/cascader.js +1275 -0
- package/dist/antd/es/checkbox.js +11 -0
- package/dist/antd/es/col.js +4 -0
- package/dist/antd/es/collapse.js +688 -0
- package/dist/antd/es/comment.js +5 -0
- package/dist/antd/es/config-provider.js +2 -0
- package/dist/antd/es/date-picker.js +4322 -0
- package/dist/antd/es/descriptions.js +342 -0
- package/dist/antd/es/divider.js +53 -0
- package/dist/antd/es/drawer.js +1115 -0
- package/dist/antd/es/dropdown.js +14 -0
- package/dist/antd/es/empty.js +6 -0
- package/dist/antd/es/form.js +5008 -0
- package/dist/antd/es/grid.js +13 -0
- package/dist/antd/es/icon.js +6 -0
- package/dist/antd/es/input-number.js +5 -0
- package/dist/antd/es/input.js +16 -0
- package/dist/antd/es/layout.js +14 -0
- package/dist/antd/es/list.js +5 -0
- package/dist/antd/es/locale/ar_EG.js +102 -0
- package/dist/antd/es/locale/bg_BG.js +98 -0
- package/dist/antd/es/locale/ca_ES.js +96 -0
- package/dist/antd/es/locale/cs_CZ.js +96 -0
- package/dist/antd/es/locale/da_DK.js +98 -0
- package/dist/antd/es/locale/de_DE.js +98 -0
- package/dist/antd/es/locale/default.js +2 -0
- package/dist/antd/es/locale/el_GR.js +98 -0
- package/dist/antd/es/locale/en_GB.js +98 -0
- package/dist/antd/es/locale/en_US.js +2 -0
- package/dist/antd/es/locale/es_ES.js +114 -0
- package/dist/antd/es/locale/et_EE.js +98 -0
- package/dist/antd/es/locale/fa_IR.js +98 -0
- package/dist/antd/es/locale/fi_FI.js +99 -0
- package/dist/antd/es/locale/fr_BE.js +102 -0
- package/dist/antd/es/locale/fr_FR.js +102 -0
- package/dist/antd/es/locale/ga_IE.js +99 -0
- package/dist/antd/es/locale/he_IL.js +99 -0
- package/dist/antd/es/locale/hi_IN.js +107 -0
- package/dist/antd/es/locale/hr_HR.js +113 -0
- package/dist/antd/es/locale/hu_HU.js +99 -0
- package/dist/antd/es/locale/hy_AM.js +109 -0
- package/dist/antd/es/locale/id_ID.js +101 -0
- package/dist/antd/es/locale/is_IS.js +98 -0
- package/dist/antd/es/locale/it_IT.js +111 -0
- package/dist/antd/es/locale/ja_JP.js +96 -0
- package/dist/antd/es/locale/kn_IN.js +107 -0
- package/dist/antd/es/locale/ko_KR.js +98 -0
- package/dist/antd/es/locale/ku_IQ.js +98 -0
- package/dist/antd/es/locale/lv_LV.js +98 -0
- package/dist/antd/es/locale/mk_MK.js +113 -0
- package/dist/antd/es/locale/mn_MN.js +99 -0
- package/dist/antd/es/locale/ms_MY.js +118 -0
- package/dist/antd/es/locale/nb_NO.js +97 -0
- package/dist/antd/es/locale/ne_NP.js +44 -0
- package/dist/antd/es/locale/nl_BE.js +98 -0
- package/dist/antd/es/locale/nl_NL.js +117 -0
- package/dist/antd/es/locale/pl_PL.js +98 -0
- package/dist/antd/es/locale/pt_BR.js +104 -0
- package/dist/antd/es/locale/pt_PT.js +127 -0
- package/dist/antd/es/locale/ro_RO.js +118 -0
- package/dist/antd/es/locale/ru_RU.js +110 -0
- package/dist/antd/es/locale/sk_SK.js +118 -0
- package/dist/antd/es/locale/sl_SI.js +96 -0
- package/dist/antd/es/locale/sr_RS.js +97 -0
- package/dist/antd/es/locale/sv_SE.js +101 -0
- package/dist/antd/es/locale/ta_IN.js +119 -0
- package/dist/antd/es/locale/th_TH.js +117 -0
- package/dist/antd/es/locale/tr_TR.js +112 -0
- package/dist/antd/es/locale/uk_UA.js +97 -0
- package/dist/antd/es/locale/vi_VN.js +99 -0
- package/dist/antd/es/locale/zh_CN.js +104 -0
- package/dist/antd/es/locale/zh_TW.js +100 -0
- package/dist/antd/es/locale-provider.js +6 -0
- package/dist/antd/es/mention.js +23215 -0
- package/dist/antd/es/mentions.js +961 -0
- package/dist/antd/es/menu.js +5 -0
- package/dist/antd/es/message.js +161 -0
- package/dist/antd/es/modal.js +885 -0
- package/dist/antd/es/notification.js +216 -0
- package/dist/antd/es/page-header.js +350 -0
- package/dist/antd/es/pagination.js +15 -0
- package/dist/antd/es/popconfirm.js +215 -0
- package/dist/antd/es/popover.js +5 -0
- package/dist/antd/es/progress.js +10 -0
- package/dist/antd/es/radio.js +10 -0
- package/dist/antd/es/rate.js +5 -0
- package/dist/antd/es/result.js +828 -0
- package/dist/antd/es/row.js +9 -0
- package/dist/antd/es/select.js +5 -0
- package/dist/antd/es/skeleton.js +370 -0
- package/dist/antd/es/slider.js +5 -0
- package/dist/antd/es/spin.js +11 -0
- package/dist/antd/es/statistic.js +650 -0
- package/dist/antd/es/steps.js +5 -0
- package/dist/antd/es/style.js +5 -0
- package/dist/antd/es/switch.js +5 -0
- package/dist/antd/es/table.js +7057 -0
- package/dist/antd/es/tabs.js +5 -0
- package/dist/antd/es/tag.js +12 -0
- package/dist/antd/es/time-picker.js +10 -0
- package/dist/antd/es/timeline.js +206 -0
- package/dist/antd/es/tooltip.js +9 -0
- package/dist/antd/es/transfer.js +2508 -0
- package/dist/antd/es/tree-select.js +5 -0
- package/dist/antd/es/tree.js +10 -0
- package/dist/antd/es/typography.js +1246 -0
- package/dist/antd/es/upload.js +3418 -0
- package/dist/antd/es/version.js +7 -0
- package/dist/col.js +142 -0
- package/dist/config-provider.js +6949 -0
- package/dist/dropdown.js +442 -0
- package/dist/get.js +1043 -0
- package/dist/icon.js +6138 -0
- package/dist/identity.js +230 -0
- package/dist/index.js +462 -0
- package/dist/index10.js +478 -0
- package/dist/index11.js +232 -0
- package/dist/index12.js +2766 -0
- package/dist/index13.js +422 -0
- package/dist/index14.js +283 -0
- package/dist/index15.js +1755 -0
- package/dist/index2.js +374 -0
- package/dist/index3.js +407 -0
- package/dist/index4.js +522 -0
- package/dist/index5.js +601 -0
- package/dist/index6.js +601 -0
- package/dist/index7.js +364 -0
- package/dist/index8.js +436 -0
- package/dist/index9.js +130 -0
- package/dist/input.js +475 -0
- package/dist/isLength.js +402 -0
- package/dist/keys.js +292 -0
- package/dist/menu.js +8138 -0
- package/dist/progress.js +852 -0
- package/dist/raf.js +34 -0
- package/dist/responsiveObserve.js +444 -0
- package/dist/row.js +173 -0
- package/dist/scrollTo.js +66 -0
- package/dist/toInteger.js +123 -0
- package/dist/toString.js +84 -0
- package/dist/transButton.js +121 -0
- package/dist/tree.js +3017 -0
- package/dist/warning.js +55 -0
- package/dist/wave.js +230 -0
- package/dist/zh_CN.js +17 -0
- package/package.json +160 -0
|
@@ -0,0 +1,4322 @@
|
|
|
1
|
+
import { n, P as PropTypes, c as classNames, m as moment, o as interopDefault, q as moment$1, C as ConfigConsumer, l as locale, L as LocaleReceiver, w as warning } from '../../config-provider.js';
|
|
2
|
+
import { _ as _inherits$4, a as _classCallCheck$4, b as _possibleConstructorReturn$4, e as _extends$5, I as Icon } from '../../icon.js';
|
|
3
|
+
import * as React from 'react';
|
|
4
|
+
import React__default from 'react';
|
|
5
|
+
import ReactDOM__default from 'react-dom';
|
|
6
|
+
import { p as polyfill, K as KeyCode, b as Trigger, c as createChainedFunction, s as shallowEqual } from '../../menu.js';
|
|
7
|
+
import { M as MonthTable, i as isAllowedDate, h as getTodayTime, j as getTodayTimeStr, k as formatDate$1, b as getNowByCurrentStateValue, l as getTimeConfig, D as DateTable, d as calendarMixinPropTypes, p as propType, e as calendarMixinDefaultProps, f as defaultProp, s as syncTime, c as calendarMixinWrapper, a as commonMixinWrapper } from '../../CommonMixin.js';
|
|
8
|
+
import { o as omit } from '../../input.js';
|
|
9
|
+
import { g as generateShowHourMinuteSecond, P as Panel } from '../../index15.js';
|
|
10
|
+
import { T as Tag } from '../../index14.js';
|
|
11
|
+
import '../../wave.js';
|
|
12
|
+
import '../../raf.js';
|
|
13
|
+
|
|
14
|
+
function getDataOrAriaProps(props) {
|
|
15
|
+
return Object.keys(props).reduce(function (prev, key) {
|
|
16
|
+
if ((key.substr(0, 5) === 'data-' || key.substr(0, 5) === 'aria-' || key === 'role') && key.substr(0, 7) !== 'data-__') {
|
|
17
|
+
prev[key] = props[key];
|
|
18
|
+
}
|
|
19
|
+
|
|
20
|
+
return prev;
|
|
21
|
+
}, {});
|
|
22
|
+
}
|
|
23
|
+
|
|
24
|
+
var css = "/* stylelint-disable at-rule-empty-line-before,at-rule-name-space-after,at-rule-no-unknown */\n/* stylelint-disable no-duplicate-selectors */\n/* stylelint-disable */\n/* stylelint-disable declaration-bang-space-before,no-duplicate-selectors,string-no-newline */\n.ant-calendar-picker-container {\n box-sizing: border-box;\n margin: 0;\n padding: 0;\n color: rgba(0, 0, 0, 0.65);\n font-size: 14px;\n font-variant: tabular-nums;\n line-height: 1.5;\n list-style: none;\n font-feature-settings: 'tnum';\n position: absolute;\n z-index: 1050;\n font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', 'PingFang SC', 'Hiragino Sans GB', 'Microsoft YaHei', 'Helvetica Neue', Helvetica, Arial, sans-serif, 'Apple Color Emoji', 'Segoe UI Emoji', 'Segoe UI Symbol';\n}\n.ant-calendar-picker-container.slide-up-enter.slide-up-enter-active.ant-calendar-picker-container-placement-topLeft,\n.ant-calendar-picker-container.slide-up-enter.slide-up-enter-active.ant-calendar-picker-container-placement-topRight,\n.ant-calendar-picker-container.slide-up-appear.slide-up-appear-active.ant-calendar-picker-container-placement-topLeft,\n.ant-calendar-picker-container.slide-up-appear.slide-up-appear-active.ant-calendar-picker-container-placement-topRight {\n animation-name: antSlideDownIn;\n}\n.ant-calendar-picker-container.slide-up-enter.slide-up-enter-active.ant-calendar-picker-container-placement-bottomLeft,\n.ant-calendar-picker-container.slide-up-enter.slide-up-enter-active.ant-calendar-picker-container-placement-bottomRight,\n.ant-calendar-picker-container.slide-up-appear.slide-up-appear-active.ant-calendar-picker-container-placement-bottomLeft,\n.ant-calendar-picker-container.slide-up-appear.slide-up-appear-active.ant-calendar-picker-container-placement-bottomRight {\n animation-name: antSlideUpIn;\n}\n.ant-calendar-picker-container.slide-up-leave.slide-up-leave-active.ant-calendar-picker-container-placement-topLeft,\n.ant-calendar-picker-container.slide-up-leave.slide-up-leave-active.ant-calendar-picker-container-placement-topRight {\n animation-name: antSlideDownOut;\n}\n.ant-calendar-picker-container.slide-up-leave.slide-up-leave-active.ant-calendar-picker-container-placement-bottomLeft,\n.ant-calendar-picker-container.slide-up-leave.slide-up-leave-active.ant-calendar-picker-container-placement-bottomRight {\n animation-name: antSlideUpOut;\n}\n.ant-calendar-picker {\n box-sizing: border-box;\n margin: 0;\n padding: 0;\n color: rgba(0, 0, 0, 0.65);\n font-size: 14px;\n font-variant: tabular-nums;\n line-height: 1.5;\n list-style: none;\n font-feature-settings: 'tnum';\n position: relative;\n display: inline-block;\n outline: none;\n cursor: text;\n transition: opacity 0.3s;\n}\n.ant-calendar-picker-input {\n outline: none;\n}\n.ant-calendar-picker-input.ant-input {\n line-height: 1.5;\n}\n.ant-calendar-picker-input.ant-input-sm {\n padding-top: 0;\n padding-bottom: 0;\n}\n.ant-calendar-picker:hover .ant-calendar-picker-input:not(.ant-input-disabled) {\n border-color: #40a9ff;\n}\n.ant-calendar-picker:focus .ant-calendar-picker-input:not(.ant-input-disabled) {\n border-color: #40a9ff;\n border-right-width: 1px !important;\n outline: 0;\n box-shadow: 0 0 0 2px rgba(24, 144, 255, 0.2);\n}\n.ant-calendar-picker-clear,\n.ant-calendar-picker-icon {\n position: absolute;\n top: 50%;\n right: 12px;\n z-index: 1;\n width: 14px;\n height: 14px;\n margin-top: -7px;\n font-size: 12px;\n line-height: 14px;\n transition: all 0.3s;\n user-select: none;\n}\n.ant-calendar-picker-clear {\n z-index: 2;\n color: rgba(0, 0, 0, 0.25);\n font-size: 14px;\n background: #fff;\n cursor: pointer;\n opacity: 0;\n pointer-events: none;\n}\n.ant-calendar-picker-clear:hover {\n color: rgba(0, 0, 0, 0.45);\n}\n.ant-calendar-picker:hover .ant-calendar-picker-clear {\n opacity: 1;\n pointer-events: auto;\n}\n.ant-calendar-picker-icon {\n display: inline-block;\n color: rgba(0, 0, 0, 0.25);\n font-size: 14px;\n line-height: 1;\n}\n.ant-input-disabled + .ant-calendar-picker-icon {\n cursor: not-allowed;\n}\n.ant-calendar-picker-small .ant-calendar-picker-clear,\n.ant-calendar-picker-small .ant-calendar-picker-icon {\n right: 8px;\n}\n.ant-calendar {\n position: relative;\n width: 280px;\n font-size: 14px;\n line-height: 1.5;\n text-align: left;\n list-style: none;\n background-color: #fff;\n background-clip: padding-box;\n border: 1px solid #fff;\n border-radius: 4px;\n outline: none;\n box-shadow: 0 2px 8px rgba(0, 0, 0, 0.15);\n}\n.ant-calendar-input-wrap {\n height: 34px;\n padding: 6px 10px;\n border-bottom: 1px solid #e8e8e8;\n}\n.ant-calendar-input {\n width: 100%;\n height: 22px;\n color: rgba(0, 0, 0, 0.65);\n background: #fff;\n border: 0;\n outline: 0;\n cursor: auto;\n}\n.ant-calendar-input::-moz-placeholder {\n color: #bfbfbf;\n opacity: 1;\n}\n.ant-calendar-input:-ms-input-placeholder {\n color: #bfbfbf;\n}\n.ant-calendar-input::-webkit-input-placeholder {\n color: #bfbfbf;\n}\n.ant-calendar-input:placeholder-shown {\n text-overflow: ellipsis;\n}\n.ant-calendar-week-number {\n width: 286px;\n}\n.ant-calendar-week-number-cell {\n text-align: center;\n}\n.ant-calendar-header {\n height: 40px;\n line-height: 40px;\n text-align: center;\n border-bottom: 1px solid #e8e8e8;\n user-select: none;\n}\n.ant-calendar-header a:hover {\n color: #40a9ff;\n}\n.ant-calendar-header .ant-calendar-century-select,\n.ant-calendar-header .ant-calendar-decade-select,\n.ant-calendar-header .ant-calendar-year-select,\n.ant-calendar-header .ant-calendar-month-select {\n display: inline-block;\n padding: 0 2px;\n color: rgba(0, 0, 0, 0.85);\n font-weight: 500;\n line-height: 40px;\n}\n.ant-calendar-header .ant-calendar-century-select-arrow,\n.ant-calendar-header .ant-calendar-decade-select-arrow,\n.ant-calendar-header .ant-calendar-year-select-arrow,\n.ant-calendar-header .ant-calendar-month-select-arrow {\n display: none;\n}\n.ant-calendar-header .ant-calendar-prev-century-btn,\n.ant-calendar-header .ant-calendar-next-century-btn,\n.ant-calendar-header .ant-calendar-prev-decade-btn,\n.ant-calendar-header .ant-calendar-next-decade-btn,\n.ant-calendar-header .ant-calendar-prev-month-btn,\n.ant-calendar-header .ant-calendar-next-month-btn,\n.ant-calendar-header .ant-calendar-prev-year-btn,\n.ant-calendar-header .ant-calendar-next-year-btn {\n position: absolute;\n top: 0;\n display: inline-block;\n padding: 0 5px;\n color: rgba(0, 0, 0, 0.45);\n font-size: 16px;\n font-family: Arial, 'Hiragino Sans GB', 'Microsoft Yahei', 'Microsoft Sans Serif', sans-serif;\n line-height: 40px;\n}\n.ant-calendar-header .ant-calendar-prev-century-btn,\n.ant-calendar-header .ant-calendar-prev-decade-btn,\n.ant-calendar-header .ant-calendar-prev-year-btn {\n left: 7px;\n height: 100%;\n}\n.ant-calendar-header .ant-calendar-prev-century-btn::before,\n.ant-calendar-header .ant-calendar-prev-decade-btn::before,\n.ant-calendar-header .ant-calendar-prev-year-btn::before,\n.ant-calendar-header .ant-calendar-prev-century-btn::after,\n.ant-calendar-header .ant-calendar-prev-decade-btn::after,\n.ant-calendar-header .ant-calendar-prev-year-btn::after {\n position: relative;\n top: -1px;\n display: inline-block;\n width: 8px;\n height: 8px;\n vertical-align: middle;\n border: 0 solid #aaa;\n border-width: 1.5px 0 0 1.5px;\n border-radius: 1px;\n transform: rotate(-45deg) scale(0.8);\n transition: all 0.3s;\n content: '';\n}\n.ant-calendar-header .ant-calendar-prev-century-btn:hover::before,\n.ant-calendar-header .ant-calendar-prev-decade-btn:hover::before,\n.ant-calendar-header .ant-calendar-prev-year-btn:hover::before,\n.ant-calendar-header .ant-calendar-prev-century-btn:hover::after,\n.ant-calendar-header .ant-calendar-prev-decade-btn:hover::after,\n.ant-calendar-header .ant-calendar-prev-year-btn:hover::after {\n border-color: rgba(0, 0, 0, 0.65);\n}\n.ant-calendar-header .ant-calendar-prev-century-btn::after,\n.ant-calendar-header .ant-calendar-prev-decade-btn::after,\n.ant-calendar-header .ant-calendar-prev-year-btn::after {\n display: none;\n}\n.ant-calendar-header .ant-calendar-prev-century-btn::after,\n.ant-calendar-header .ant-calendar-prev-decade-btn::after,\n.ant-calendar-header .ant-calendar-prev-year-btn::after {\n position: relative;\n left: -3px;\n display: inline-block;\n}\n.ant-calendar-header .ant-calendar-next-century-btn,\n.ant-calendar-header .ant-calendar-next-decade-btn,\n.ant-calendar-header .ant-calendar-next-year-btn {\n right: 7px;\n height: 100%;\n}\n.ant-calendar-header .ant-calendar-next-century-btn::before,\n.ant-calendar-header .ant-calendar-next-decade-btn::before,\n.ant-calendar-header .ant-calendar-next-year-btn::before,\n.ant-calendar-header .ant-calendar-next-century-btn::after,\n.ant-calendar-header .ant-calendar-next-decade-btn::after,\n.ant-calendar-header .ant-calendar-next-year-btn::after {\n position: relative;\n top: -1px;\n display: inline-block;\n width: 8px;\n height: 8px;\n vertical-align: middle;\n border: 0 solid #aaa;\n border-width: 1.5px 0 0 1.5px;\n border-radius: 1px;\n transform: rotate(-45deg) scale(0.8);\n transition: all 0.3s;\n content: '';\n}\n.ant-calendar-header .ant-calendar-next-century-btn:hover::before,\n.ant-calendar-header .ant-calendar-next-decade-btn:hover::before,\n.ant-calendar-header .ant-calendar-next-year-btn:hover::before,\n.ant-calendar-header .ant-calendar-next-century-btn:hover::after,\n.ant-calendar-header .ant-calendar-next-decade-btn:hover::after,\n.ant-calendar-header .ant-calendar-next-year-btn:hover::after {\n border-color: rgba(0, 0, 0, 0.65);\n}\n.ant-calendar-header .ant-calendar-next-century-btn::after,\n.ant-calendar-header .ant-calendar-next-decade-btn::after,\n.ant-calendar-header .ant-calendar-next-year-btn::after {\n display: none;\n}\n.ant-calendar-header .ant-calendar-next-century-btn::before,\n.ant-calendar-header .ant-calendar-next-decade-btn::before,\n.ant-calendar-header .ant-calendar-next-year-btn::before,\n.ant-calendar-header .ant-calendar-next-century-btn::after,\n.ant-calendar-header .ant-calendar-next-decade-btn::after,\n.ant-calendar-header .ant-calendar-next-year-btn::after {\n transform: rotate(135deg) scale(0.8);\n}\n.ant-calendar-header .ant-calendar-next-century-btn::before,\n.ant-calendar-header .ant-calendar-next-decade-btn::before,\n.ant-calendar-header .ant-calendar-next-year-btn::before {\n position: relative;\n left: 3px;\n}\n.ant-calendar-header .ant-calendar-next-century-btn::after,\n.ant-calendar-header .ant-calendar-next-decade-btn::after,\n.ant-calendar-header .ant-calendar-next-year-btn::after {\n display: inline-block;\n}\n.ant-calendar-header .ant-calendar-prev-month-btn {\n left: 29px;\n height: 100%;\n}\n.ant-calendar-header .ant-calendar-prev-month-btn::before,\n.ant-calendar-header .ant-calendar-prev-month-btn::after {\n position: relative;\n top: -1px;\n display: inline-block;\n width: 8px;\n height: 8px;\n vertical-align: middle;\n border: 0 solid #aaa;\n border-width: 1.5px 0 0 1.5px;\n border-radius: 1px;\n transform: rotate(-45deg) scale(0.8);\n transition: all 0.3s;\n content: '';\n}\n.ant-calendar-header .ant-calendar-prev-month-btn:hover::before,\n.ant-calendar-header .ant-calendar-prev-month-btn:hover::after {\n border-color: rgba(0, 0, 0, 0.65);\n}\n.ant-calendar-header .ant-calendar-prev-month-btn::after {\n display: none;\n}\n.ant-calendar-header .ant-calendar-next-month-btn {\n right: 29px;\n height: 100%;\n}\n.ant-calendar-header .ant-calendar-next-month-btn::before,\n.ant-calendar-header .ant-calendar-next-month-btn::after {\n position: relative;\n top: -1px;\n display: inline-block;\n width: 8px;\n height: 8px;\n vertical-align: middle;\n border: 0 solid #aaa;\n border-width: 1.5px 0 0 1.5px;\n border-radius: 1px;\n transform: rotate(-45deg) scale(0.8);\n transition: all 0.3s;\n content: '';\n}\n.ant-calendar-header .ant-calendar-next-month-btn:hover::before,\n.ant-calendar-header .ant-calendar-next-month-btn:hover::after {\n border-color: rgba(0, 0, 0, 0.65);\n}\n.ant-calendar-header .ant-calendar-next-month-btn::after {\n display: none;\n}\n.ant-calendar-header .ant-calendar-next-month-btn::before,\n.ant-calendar-header .ant-calendar-next-month-btn::after {\n transform: rotate(135deg) scale(0.8);\n}\n.ant-calendar-body {\n padding: 8px 12px;\n}\n.ant-calendar table {\n width: 100%;\n max-width: 100%;\n background-color: transparent;\n border-collapse: collapse;\n}\n.ant-calendar table,\n.ant-calendar th,\n.ant-calendar td {\n text-align: center;\n border: 0;\n}\n.ant-calendar-calendar-table {\n margin-bottom: 0;\n border-spacing: 0;\n}\n.ant-calendar-column-header {\n width: 33px;\n padding: 6px 0;\n line-height: 18px;\n text-align: center;\n}\n.ant-calendar-column-header .ant-calendar-column-header-inner {\n display: block;\n font-weight: normal;\n}\n.ant-calendar-week-number-header .ant-calendar-column-header-inner {\n display: none;\n}\n.ant-calendar-cell {\n height: 30px;\n padding: 3px 0;\n}\n.ant-calendar-date {\n display: block;\n width: 24px;\n height: 24px;\n margin: 0 auto;\n padding: 0;\n color: rgba(0, 0, 0, 0.65);\n line-height: 22px;\n text-align: center;\n background: transparent;\n border: 1px solid transparent;\n border-radius: 2px;\n transition: background 0.3s ease;\n}\n.ant-calendar-date-panel {\n position: relative;\n outline: none;\n}\n.ant-calendar-date:hover {\n background: #e6f7ff;\n cursor: pointer;\n}\n.ant-calendar-date:active {\n color: #fff;\n background: #40a9ff;\n}\n.ant-calendar-today .ant-calendar-date {\n color: #1890ff;\n font-weight: bold;\n border-color: #1890ff;\n}\n.ant-calendar-selected-day .ant-calendar-date {\n background: #bae7ff;\n}\n.ant-calendar-last-month-cell .ant-calendar-date,\n.ant-calendar-next-month-btn-day .ant-calendar-date,\n.ant-calendar-last-month-cell .ant-calendar-date:hover,\n.ant-calendar-next-month-btn-day .ant-calendar-date:hover {\n color: rgba(0, 0, 0, 0.25);\n background: transparent;\n border-color: transparent;\n}\n.ant-calendar-disabled-cell .ant-calendar-date {\n position: relative;\n width: auto;\n color: rgba(0, 0, 0, 0.25);\n background: #f5f5f5;\n border: 1px solid transparent;\n border-radius: 0;\n cursor: not-allowed;\n}\n.ant-calendar-disabled-cell .ant-calendar-date:hover {\n background: #f5f5f5;\n}\n.ant-calendar-disabled-cell.ant-calendar-selected-day .ant-calendar-date::before {\n position: absolute;\n top: -1px;\n left: 5px;\n width: 24px;\n height: 24px;\n background: rgba(0, 0, 0, 0.1);\n border-radius: 2px;\n content: '';\n}\n.ant-calendar-disabled-cell.ant-calendar-today .ant-calendar-date {\n position: relative;\n padding-right: 5px;\n padding-left: 5px;\n}\n.ant-calendar-disabled-cell.ant-calendar-today .ant-calendar-date::before {\n position: absolute;\n top: -1px;\n left: 5px;\n width: 24px;\n height: 24px;\n border: 1px solid rgba(0, 0, 0, 0.25);\n border-radius: 2px;\n content: ' ';\n}\n.ant-calendar-disabled-cell-first-of-row .ant-calendar-date {\n border-top-left-radius: 4px;\n border-bottom-left-radius: 4px;\n}\n.ant-calendar-disabled-cell-last-of-row .ant-calendar-date {\n border-top-right-radius: 4px;\n border-bottom-right-radius: 4px;\n}\n.ant-calendar-footer {\n padding: 0 12px;\n line-height: 38px;\n border-top: 1px solid #e8e8e8;\n}\n.ant-calendar-footer:empty {\n border-top: 0;\n}\n.ant-calendar-footer-btn {\n display: block;\n text-align: center;\n}\n.ant-calendar-footer-extra {\n text-align: left;\n}\n.ant-calendar .ant-calendar-today-btn,\n.ant-calendar .ant-calendar-clear-btn {\n display: inline-block;\n margin: 0 0 0 8px;\n text-align: center;\n}\n.ant-calendar .ant-calendar-today-btn-disabled,\n.ant-calendar .ant-calendar-clear-btn-disabled {\n color: rgba(0, 0, 0, 0.25);\n cursor: not-allowed;\n}\n.ant-calendar .ant-calendar-today-btn:only-child,\n.ant-calendar .ant-calendar-clear-btn:only-child {\n margin: 0;\n}\n.ant-calendar .ant-calendar-clear-btn {\n position: absolute;\n top: 7px;\n right: 5px;\n display: none;\n width: 20px;\n height: 20px;\n margin: 0;\n overflow: hidden;\n line-height: 20px;\n text-align: center;\n text-indent: -76px;\n}\n.ant-calendar .ant-calendar-clear-btn::after {\n display: inline-block;\n width: 20px;\n color: rgba(0, 0, 0, 0.25);\n font-size: 14px;\n line-height: 1;\n text-indent: 43px;\n transition: color 0.3s ease;\n}\n.ant-calendar .ant-calendar-clear-btn:hover::after {\n color: rgba(0, 0, 0, 0.45);\n}\n.ant-calendar .ant-calendar-ok-btn {\n position: relative;\n display: inline-block;\n font-weight: 400;\n white-space: nowrap;\n text-align: center;\n background-image: none;\n border: 1px solid transparent;\n box-shadow: 0 2px 0 rgba(0, 0, 0, 0.015);\n cursor: pointer;\n transition: all 0.3s cubic-bezier(0.645, 0.045, 0.355, 1);\n user-select: none;\n touch-action: manipulation;\n height: 32px;\n padding: 0 15px;\n color: #fff;\n background-color: #1890ff;\n border-color: #1890ff;\n text-shadow: 0 -1px 0 rgba(0, 0, 0, 0.12);\n box-shadow: 0 2px 0 rgba(0, 0, 0, 0.045);\n height: 24px;\n padding: 0 7px;\n font-size: 14px;\n border-radius: 4px;\n line-height: 22px;\n}\n.ant-calendar .ant-calendar-ok-btn > .anticon {\n line-height: 1;\n}\n.ant-calendar .ant-calendar-ok-btn,\n.ant-calendar .ant-calendar-ok-btn:active,\n.ant-calendar .ant-calendar-ok-btn:focus {\n outline: 0;\n}\n.ant-calendar .ant-calendar-ok-btn:not([disabled]):hover {\n text-decoration: none;\n}\n.ant-calendar .ant-calendar-ok-btn:not([disabled]):active {\n outline: 0;\n box-shadow: none;\n}\n.ant-calendar .ant-calendar-ok-btn.disabled,\n.ant-calendar .ant-calendar-ok-btn[disabled] {\n cursor: not-allowed;\n}\n.ant-calendar .ant-calendar-ok-btn.disabled > *,\n.ant-calendar .ant-calendar-ok-btn[disabled] > * {\n pointer-events: none;\n}\n.ant-calendar .ant-calendar-ok-btn-lg {\n height: 40px;\n padding: 0 15px;\n font-size: 16px;\n border-radius: 4px;\n}\n.ant-calendar .ant-calendar-ok-btn-sm {\n height: 24px;\n padding: 0 7px;\n font-size: 14px;\n border-radius: 4px;\n}\n.ant-calendar .ant-calendar-ok-btn > a:only-child {\n color: currentColor;\n}\n.ant-calendar .ant-calendar-ok-btn > a:only-child::after {\n position: absolute;\n top: 0;\n right: 0;\n bottom: 0;\n left: 0;\n background: transparent;\n content: '';\n}\n.ant-calendar .ant-calendar-ok-btn:hover,\n.ant-calendar .ant-calendar-ok-btn:focus {\n color: #fff;\n background-color: #40a9ff;\n border-color: #40a9ff;\n}\n.ant-calendar .ant-calendar-ok-btn:hover > a:only-child,\n.ant-calendar .ant-calendar-ok-btn:focus > a:only-child {\n color: currentColor;\n}\n.ant-calendar .ant-calendar-ok-btn:hover > a:only-child::after,\n.ant-calendar .ant-calendar-ok-btn:focus > a:only-child::after {\n position: absolute;\n top: 0;\n right: 0;\n bottom: 0;\n left: 0;\n background: transparent;\n content: '';\n}\n.ant-calendar .ant-calendar-ok-btn:active,\n.ant-calendar .ant-calendar-ok-btn.active {\n color: #fff;\n background-color: #096dd9;\n border-color: #096dd9;\n}\n.ant-calendar .ant-calendar-ok-btn:active > a:only-child,\n.ant-calendar .ant-calendar-ok-btn.active > a:only-child {\n color: currentColor;\n}\n.ant-calendar .ant-calendar-ok-btn:active > a:only-child::after,\n.ant-calendar .ant-calendar-ok-btn.active > a:only-child::after {\n position: absolute;\n top: 0;\n right: 0;\n bottom: 0;\n left: 0;\n background: transparent;\n content: '';\n}\n.ant-calendar .ant-calendar-ok-btn-disabled,\n.ant-calendar .ant-calendar-ok-btn.disabled,\n.ant-calendar .ant-calendar-ok-btn[disabled],\n.ant-calendar .ant-calendar-ok-btn-disabled:hover,\n.ant-calendar .ant-calendar-ok-btn.disabled:hover,\n.ant-calendar .ant-calendar-ok-btn[disabled]:hover,\n.ant-calendar .ant-calendar-ok-btn-disabled:focus,\n.ant-calendar .ant-calendar-ok-btn.disabled:focus,\n.ant-calendar .ant-calendar-ok-btn[disabled]:focus,\n.ant-calendar .ant-calendar-ok-btn-disabled:active,\n.ant-calendar .ant-calendar-ok-btn.disabled:active,\n.ant-calendar .ant-calendar-ok-btn[disabled]:active,\n.ant-calendar .ant-calendar-ok-btn-disabled.active,\n.ant-calendar .ant-calendar-ok-btn.disabled.active,\n.ant-calendar .ant-calendar-ok-btn[disabled].active {\n color: rgba(0, 0, 0, 0.25);\n background-color: #f5f5f5;\n border-color: #d9d9d9;\n text-shadow: none;\n box-shadow: none;\n}\n.ant-calendar .ant-calendar-ok-btn-disabled > a:only-child,\n.ant-calendar .ant-calendar-ok-btn.disabled > a:only-child,\n.ant-calendar .ant-calendar-ok-btn[disabled] > a:only-child,\n.ant-calendar .ant-calendar-ok-btn-disabled:hover > a:only-child,\n.ant-calendar .ant-calendar-ok-btn.disabled:hover > a:only-child,\n.ant-calendar .ant-calendar-ok-btn[disabled]:hover > a:only-child,\n.ant-calendar .ant-calendar-ok-btn-disabled:focus > a:only-child,\n.ant-calendar .ant-calendar-ok-btn.disabled:focus > a:only-child,\n.ant-calendar .ant-calendar-ok-btn[disabled]:focus > a:only-child,\n.ant-calendar .ant-calendar-ok-btn-disabled:active > a:only-child,\n.ant-calendar .ant-calendar-ok-btn.disabled:active > a:only-child,\n.ant-calendar .ant-calendar-ok-btn[disabled]:active > a:only-child,\n.ant-calendar .ant-calendar-ok-btn-disabled.active > a:only-child,\n.ant-calendar .ant-calendar-ok-btn.disabled.active > a:only-child,\n.ant-calendar .ant-calendar-ok-btn[disabled].active > a:only-child {\n color: currentColor;\n}\n.ant-calendar .ant-calendar-ok-btn-disabled > a:only-child::after,\n.ant-calendar .ant-calendar-ok-btn.disabled > a:only-child::after,\n.ant-calendar .ant-calendar-ok-btn[disabled] > a:only-child::after,\n.ant-calendar .ant-calendar-ok-btn-disabled:hover > a:only-child::after,\n.ant-calendar .ant-calendar-ok-btn.disabled:hover > a:only-child::after,\n.ant-calendar .ant-calendar-ok-btn[disabled]:hover > a:only-child::after,\n.ant-calendar .ant-calendar-ok-btn-disabled:focus > a:only-child::after,\n.ant-calendar .ant-calendar-ok-btn.disabled:focus > a:only-child::after,\n.ant-calendar .ant-calendar-ok-btn[disabled]:focus > a:only-child::after,\n.ant-calendar .ant-calendar-ok-btn-disabled:active > a:only-child::after,\n.ant-calendar .ant-calendar-ok-btn.disabled:active > a:only-child::after,\n.ant-calendar .ant-calendar-ok-btn[disabled]:active > a:only-child::after,\n.ant-calendar .ant-calendar-ok-btn-disabled.active > a:only-child::after,\n.ant-calendar .ant-calendar-ok-btn.disabled.active > a:only-child::after,\n.ant-calendar .ant-calendar-ok-btn[disabled].active > a:only-child::after {\n position: absolute;\n top: 0;\n right: 0;\n bottom: 0;\n left: 0;\n background: transparent;\n content: '';\n}\n.ant-calendar .ant-calendar-ok-btn-disabled,\n.ant-calendar .ant-calendar-ok-btn.disabled,\n.ant-calendar .ant-calendar-ok-btn[disabled],\n.ant-calendar .ant-calendar-ok-btn-disabled:hover,\n.ant-calendar .ant-calendar-ok-btn.disabled:hover,\n.ant-calendar .ant-calendar-ok-btn[disabled]:hover,\n.ant-calendar .ant-calendar-ok-btn-disabled:focus,\n.ant-calendar .ant-calendar-ok-btn.disabled:focus,\n.ant-calendar .ant-calendar-ok-btn[disabled]:focus,\n.ant-calendar .ant-calendar-ok-btn-disabled:active,\n.ant-calendar .ant-calendar-ok-btn.disabled:active,\n.ant-calendar .ant-calendar-ok-btn[disabled]:active,\n.ant-calendar .ant-calendar-ok-btn-disabled.active,\n.ant-calendar .ant-calendar-ok-btn.disabled.active,\n.ant-calendar .ant-calendar-ok-btn[disabled].active {\n color: rgba(0, 0, 0, 0.25);\n background-color: #f5f5f5;\n border-color: #d9d9d9;\n text-shadow: none;\n box-shadow: none;\n}\n.ant-calendar .ant-calendar-ok-btn-disabled > a:only-child,\n.ant-calendar .ant-calendar-ok-btn.disabled > a:only-child,\n.ant-calendar .ant-calendar-ok-btn[disabled] > a:only-child,\n.ant-calendar .ant-calendar-ok-btn-disabled:hover > a:only-child,\n.ant-calendar .ant-calendar-ok-btn.disabled:hover > a:only-child,\n.ant-calendar .ant-calendar-ok-btn[disabled]:hover > a:only-child,\n.ant-calendar .ant-calendar-ok-btn-disabled:focus > a:only-child,\n.ant-calendar .ant-calendar-ok-btn.disabled:focus > a:only-child,\n.ant-calendar .ant-calendar-ok-btn[disabled]:focus > a:only-child,\n.ant-calendar .ant-calendar-ok-btn-disabled:active > a:only-child,\n.ant-calendar .ant-calendar-ok-btn.disabled:active > a:only-child,\n.ant-calendar .ant-calendar-ok-btn[disabled]:active > a:only-child,\n.ant-calendar .ant-calendar-ok-btn-disabled.active > a:only-child,\n.ant-calendar .ant-calendar-ok-btn.disabled.active > a:only-child,\n.ant-calendar .ant-calendar-ok-btn[disabled].active > a:only-child {\n color: currentColor;\n}\n.ant-calendar .ant-calendar-ok-btn-disabled > a:only-child::after,\n.ant-calendar .ant-calendar-ok-btn.disabled > a:only-child::after,\n.ant-calendar .ant-calendar-ok-btn[disabled] > a:only-child::after,\n.ant-calendar .ant-calendar-ok-btn-disabled:hover > a:only-child::after,\n.ant-calendar .ant-calendar-ok-btn.disabled:hover > a:only-child::after,\n.ant-calendar .ant-calendar-ok-btn[disabled]:hover > a:only-child::after,\n.ant-calendar .ant-calendar-ok-btn-disabled:focus > a:only-child::after,\n.ant-calendar .ant-calendar-ok-btn.disabled:focus > a:only-child::after,\n.ant-calendar .ant-calendar-ok-btn[disabled]:focus > a:only-child::after,\n.ant-calendar .ant-calendar-ok-btn-disabled:active > a:only-child::after,\n.ant-calendar .ant-calendar-ok-btn.disabled:active > a:only-child::after,\n.ant-calendar .ant-calendar-ok-btn[disabled]:active > a:only-child::after,\n.ant-calendar .ant-calendar-ok-btn-disabled.active > a:only-child::after,\n.ant-calendar .ant-calendar-ok-btn.disabled.active > a:only-child::after,\n.ant-calendar .ant-calendar-ok-btn[disabled].active > a:only-child::after {\n position: absolute;\n top: 0;\n right: 0;\n bottom: 0;\n left: 0;\n background: transparent;\n content: '';\n}\n.ant-calendar-range-picker-input {\n width: 44%;\n height: 99%;\n text-align: center;\n background-color: transparent;\n border: 0;\n outline: 0;\n}\n.ant-calendar-range-picker-input::-moz-placeholder {\n color: #bfbfbf;\n opacity: 1;\n}\n.ant-calendar-range-picker-input:-ms-input-placeholder {\n color: #bfbfbf;\n}\n.ant-calendar-range-picker-input::-webkit-input-placeholder {\n color: #bfbfbf;\n}\n.ant-calendar-range-picker-input:placeholder-shown {\n text-overflow: ellipsis;\n}\n.ant-calendar-range-picker-input[disabled] {\n cursor: not-allowed;\n}\n.ant-calendar-range-picker-separator {\n display: inline-block;\n min-width: 10px;\n height: 100%;\n color: rgba(0, 0, 0, 0.45);\n white-space: nowrap;\n text-align: center;\n vertical-align: top;\n pointer-events: none;\n}\n.ant-calendar-range {\n width: 552px;\n overflow: hidden;\n}\n.ant-calendar-range .ant-calendar-date-panel::after {\n display: block;\n clear: both;\n height: 0;\n visibility: hidden;\n content: '.';\n}\n.ant-calendar-range-part {\n position: relative;\n width: 50%;\n}\n.ant-calendar-range-left {\n float: left;\n}\n.ant-calendar-range-left .ant-calendar-time-picker-inner {\n border-right: 1px solid #e8e8e8;\n}\n.ant-calendar-range-right {\n float: right;\n}\n.ant-calendar-range-right .ant-calendar-time-picker-inner {\n border-left: 1px solid #e8e8e8;\n}\n.ant-calendar-range-middle {\n position: absolute;\n left: 50%;\n z-index: 1;\n height: 34px;\n margin: 1px 0 0 0;\n padding: 0 200px 0 0;\n color: rgba(0, 0, 0, 0.45);\n line-height: 34px;\n text-align: center;\n transform: translateX(-50%);\n pointer-events: none;\n}\n.ant-calendar-range-right .ant-calendar-date-input-wrap {\n margin-left: -90px;\n}\n.ant-calendar-range.ant-calendar-time .ant-calendar-range-middle {\n padding: 0 10px 0 0;\n transform: translateX(-50%);\n}\n.ant-calendar-range .ant-calendar-today :not(.ant-calendar-disabled-cell) :not(.ant-calendar-last-month-cell) :not(.ant-calendar-next-month-btn-day) .ant-calendar-date {\n color: #1890ff;\n background: #bae7ff;\n border-color: #1890ff;\n}\n.ant-calendar-range .ant-calendar-selected-start-date .ant-calendar-date,\n.ant-calendar-range .ant-calendar-selected-end-date .ant-calendar-date {\n color: #fff;\n background: #1890ff;\n border: 1px solid transparent;\n}\n.ant-calendar-range .ant-calendar-selected-start-date .ant-calendar-date:hover,\n.ant-calendar-range .ant-calendar-selected-end-date .ant-calendar-date:hover {\n background: #1890ff;\n}\n.ant-calendar-range.ant-calendar-time .ant-calendar-range-right .ant-calendar-date-input-wrap {\n margin-left: 0;\n}\n.ant-calendar-range .ant-calendar-input-wrap {\n position: relative;\n height: 34px;\n}\n.ant-calendar-range .ant-calendar-input,\n.ant-calendar-range .ant-calendar-time-picker-input {\n position: relative;\n display: inline-block;\n width: 100%;\n height: 32px;\n padding: 4px 11px;\n color: rgba(0, 0, 0, 0.65);\n font-size: 14px;\n line-height: 1.5;\n background-color: #fff;\n background-image: none;\n border: 1px solid #d9d9d9;\n border-radius: 4px;\n transition: all 0.3s;\n height: 24px;\n padding-right: 0;\n padding-left: 0;\n line-height: 24px;\n border: 0;\n box-shadow: none;\n}\n.ant-calendar-range .ant-calendar-input::-moz-placeholder,\n.ant-calendar-range .ant-calendar-time-picker-input::-moz-placeholder {\n color: #bfbfbf;\n opacity: 1;\n}\n.ant-calendar-range .ant-calendar-input:-ms-input-placeholder,\n.ant-calendar-range .ant-calendar-time-picker-input:-ms-input-placeholder {\n color: #bfbfbf;\n}\n.ant-calendar-range .ant-calendar-input::-webkit-input-placeholder,\n.ant-calendar-range .ant-calendar-time-picker-input::-webkit-input-placeholder {\n color: #bfbfbf;\n}\n.ant-calendar-range .ant-calendar-input:placeholder-shown,\n.ant-calendar-range .ant-calendar-time-picker-input:placeholder-shown {\n text-overflow: ellipsis;\n}\n.ant-calendar-range .ant-calendar-input:hover,\n.ant-calendar-range .ant-calendar-time-picker-input:hover {\n border-color: #40a9ff;\n border-right-width: 1px !important;\n}\n.ant-calendar-range .ant-calendar-input:focus,\n.ant-calendar-range .ant-calendar-time-picker-input:focus {\n border-color: #40a9ff;\n border-right-width: 1px !important;\n outline: 0;\n box-shadow: 0 0 0 2px rgba(24, 144, 255, 0.2);\n}\n.ant-calendar-range .ant-calendar-input-disabled,\n.ant-calendar-range .ant-calendar-time-picker-input-disabled {\n color: rgba(0, 0, 0, 0.25);\n background-color: #f5f5f5;\n cursor: not-allowed;\n opacity: 1;\n}\n.ant-calendar-range .ant-calendar-input-disabled:hover,\n.ant-calendar-range .ant-calendar-time-picker-input-disabled:hover {\n border-color: #d9d9d9;\n border-right-width: 1px !important;\n}\n.ant-calendar-range .ant-calendar-input[disabled],\n.ant-calendar-range .ant-calendar-time-picker-input[disabled] {\n color: rgba(0, 0, 0, 0.25);\n background-color: #f5f5f5;\n cursor: not-allowed;\n opacity: 1;\n}\n.ant-calendar-range .ant-calendar-input[disabled]:hover,\n.ant-calendar-range .ant-calendar-time-picker-input[disabled]:hover {\n border-color: #d9d9d9;\n border-right-width: 1px !important;\n}\ntextarea.ant-calendar-range .ant-calendar-input,\ntextarea.ant-calendar-range .ant-calendar-time-picker-input {\n max-width: 100%;\n height: auto;\n min-height: 32px;\n line-height: 1.5;\n vertical-align: bottom;\n transition: all 0.3s, height 0s;\n}\n.ant-calendar-range .ant-calendar-input-lg,\n.ant-calendar-range .ant-calendar-time-picker-input-lg {\n height: 40px;\n padding: 6px 11px;\n font-size: 16px;\n}\n.ant-calendar-range .ant-calendar-input-sm,\n.ant-calendar-range .ant-calendar-time-picker-input-sm {\n height: 24px;\n padding: 1px 7px;\n}\n.ant-calendar-range .ant-calendar-input:focus,\n.ant-calendar-range .ant-calendar-time-picker-input:focus {\n box-shadow: none;\n}\n.ant-calendar-range .ant-calendar-time-picker-icon {\n display: none;\n}\n.ant-calendar-range.ant-calendar-week-number {\n width: 574px;\n}\n.ant-calendar-range.ant-calendar-week-number .ant-calendar-range-part {\n width: 286px;\n}\n.ant-calendar-range .ant-calendar-year-panel,\n.ant-calendar-range .ant-calendar-month-panel,\n.ant-calendar-range .ant-calendar-decade-panel {\n top: 34px;\n}\n.ant-calendar-range .ant-calendar-month-panel .ant-calendar-year-panel {\n top: 0;\n}\n.ant-calendar-range .ant-calendar-decade-panel-table,\n.ant-calendar-range .ant-calendar-year-panel-table,\n.ant-calendar-range .ant-calendar-month-panel-table {\n height: 208px;\n}\n.ant-calendar-range .ant-calendar-in-range-cell {\n position: relative;\n border-radius: 0;\n}\n.ant-calendar-range .ant-calendar-in-range-cell > div {\n position: relative;\n z-index: 1;\n}\n.ant-calendar-range .ant-calendar-in-range-cell::before {\n position: absolute;\n top: 4px;\n right: 0;\n bottom: 4px;\n left: 0;\n display: block;\n background: #e6f7ff;\n border: 0;\n border-radius: 0;\n content: '';\n}\n.ant-calendar-range .ant-calendar-footer-extra {\n float: left;\n}\ndiv.ant-calendar-range-quick-selector {\n text-align: left;\n}\ndiv.ant-calendar-range-quick-selector > a {\n margin-right: 8px;\n}\n.ant-calendar-range .ant-calendar-header,\n.ant-calendar-range .ant-calendar-month-panel-header,\n.ant-calendar-range .ant-calendar-year-panel-header,\n.ant-calendar-range .ant-calendar-decade-panel-header {\n border-bottom: 0;\n}\n.ant-calendar-range .ant-calendar-body,\n.ant-calendar-range .ant-calendar-month-panel-body,\n.ant-calendar-range .ant-calendar-year-panel-body,\n.ant-calendar-range .ant-calendar-decade-panel-body {\n border-top: 1px solid #e8e8e8;\n}\n.ant-calendar-range.ant-calendar-time .ant-calendar-time-picker {\n top: 68px;\n z-index: 2;\n width: 100%;\n height: 207px;\n}\n.ant-calendar-range.ant-calendar-time .ant-calendar-time-picker-panel {\n height: 267px;\n margin-top: -34px;\n}\n.ant-calendar-range.ant-calendar-time .ant-calendar-time-picker-inner {\n height: 100%;\n padding-top: 40px;\n background: none;\n}\n.ant-calendar-range.ant-calendar-time .ant-calendar-time-picker-combobox {\n display: inline-block;\n height: 100%;\n background-color: #fff;\n border-top: 1px solid #e8e8e8;\n}\n.ant-calendar-range.ant-calendar-time .ant-calendar-time-picker-select {\n height: 100%;\n}\n.ant-calendar-range.ant-calendar-time .ant-calendar-time-picker-select ul {\n max-height: 100%;\n}\n.ant-calendar-range.ant-calendar-time .ant-calendar-footer .ant-calendar-time-picker-btn {\n margin-right: 8px;\n}\n.ant-calendar-range.ant-calendar-time .ant-calendar-today-btn {\n height: 22px;\n margin: 8px 12px;\n line-height: 22px;\n}\n.ant-calendar-range-with-ranges.ant-calendar-time .ant-calendar-time-picker {\n height: 233px;\n}\n.ant-calendar-range.ant-calendar-show-time-picker .ant-calendar-body {\n border-top-color: transparent;\n}\n.ant-calendar-time-picker {\n position: absolute;\n top: 40px;\n width: 100%;\n background-color: #fff;\n}\n.ant-calendar-time-picker-panel {\n position: absolute;\n z-index: 1050;\n width: 100%;\n}\n.ant-calendar-time-picker-inner {\n position: relative;\n display: inline-block;\n width: 100%;\n overflow: hidden;\n font-size: 14px;\n line-height: 1.5;\n text-align: left;\n list-style: none;\n background-color: #fff;\n background-clip: padding-box;\n outline: none;\n}\n.ant-calendar-time-picker-combobox {\n width: 100%;\n}\n.ant-calendar-time-picker-column-1,\n.ant-calendar-time-picker-column-1 .ant-calendar-time-picker-select {\n width: 100%;\n}\n.ant-calendar-time-picker-column-2 .ant-calendar-time-picker-select {\n width: 50%;\n}\n.ant-calendar-time-picker-column-3 .ant-calendar-time-picker-select {\n width: 33.33%;\n}\n.ant-calendar-time-picker-column-4 .ant-calendar-time-picker-select {\n width: 25%;\n}\n.ant-calendar-time-picker-input-wrap {\n display: none;\n}\n.ant-calendar-time-picker-select {\n position: relative;\n float: left;\n height: 226px;\n overflow: hidden;\n font-size: 14px;\n border-right: 1px solid #e8e8e8;\n}\n.ant-calendar-time-picker-select:hover {\n overflow-y: auto;\n}\n.ant-calendar-time-picker-select:first-child {\n margin-left: 0;\n border-left: 0;\n}\n.ant-calendar-time-picker-select:last-child {\n border-right: 0;\n}\n.ant-calendar-time-picker-select ul {\n width: 100%;\n max-height: 206px;\n margin: 0;\n padding: 0;\n list-style: none;\n}\n.ant-calendar-time-picker-select li {\n width: 100%;\n height: 24px;\n margin: 0;\n line-height: 24px;\n text-align: center;\n list-style: none;\n cursor: pointer;\n transition: all 0.3s;\n user-select: none;\n}\n.ant-calendar-time-picker-select li:last-child::after {\n display: block;\n height: 202px;\n content: '';\n}\n.ant-calendar-time-picker-select li:hover {\n background: #e6f7ff;\n}\n.ant-calendar-time-picker-select li:focus {\n color: #1890ff;\n font-weight: 600;\n outline: none;\n}\nli.ant-calendar-time-picker-select-option-selected {\n font-weight: 600;\n background: #f5f5f5;\n}\nli.ant-calendar-time-picker-select-option-disabled {\n color: rgba(0, 0, 0, 0.25);\n}\nli.ant-calendar-time-picker-select-option-disabled:hover {\n background: transparent;\n cursor: not-allowed;\n}\n.ant-calendar-time .ant-calendar-day-select {\n display: inline-block;\n padding: 0 2px;\n color: rgba(0, 0, 0, 0.85);\n font-weight: 500;\n line-height: 34px;\n}\n.ant-calendar-time .ant-calendar-footer {\n position: relative;\n height: auto;\n}\n.ant-calendar-time .ant-calendar-footer-btn {\n text-align: right;\n}\n.ant-calendar-time .ant-calendar-footer .ant-calendar-today-btn {\n float: left;\n margin: 0;\n}\n.ant-calendar-time .ant-calendar-footer .ant-calendar-time-picker-btn {\n display: inline-block;\n margin-right: 8px;\n}\n.ant-calendar-time .ant-calendar-footer .ant-calendar-time-picker-btn-disabled {\n color: rgba(0, 0, 0, 0.25);\n}\n.ant-calendar-month-panel {\n position: absolute;\n top: 0;\n right: 0;\n bottom: 0;\n left: 0;\n z-index: 10;\n background: #fff;\n border-radius: 4px;\n outline: none;\n}\n.ant-calendar-month-panel > div {\n display: flex;\n flex-direction: column;\n height: 100%;\n}\n.ant-calendar-month-panel-hidden {\n display: none;\n}\n.ant-calendar-month-panel-header {\n height: 40px;\n line-height: 40px;\n text-align: center;\n border-bottom: 1px solid #e8e8e8;\n user-select: none;\n position: relative;\n}\n.ant-calendar-month-panel-header a:hover {\n color: #40a9ff;\n}\n.ant-calendar-month-panel-header .ant-calendar-month-panel-century-select,\n.ant-calendar-month-panel-header .ant-calendar-month-panel-decade-select,\n.ant-calendar-month-panel-header .ant-calendar-month-panel-year-select,\n.ant-calendar-month-panel-header .ant-calendar-month-panel-month-select {\n display: inline-block;\n padding: 0 2px;\n color: rgba(0, 0, 0, 0.85);\n font-weight: 500;\n line-height: 40px;\n}\n.ant-calendar-month-panel-header .ant-calendar-month-panel-century-select-arrow,\n.ant-calendar-month-panel-header .ant-calendar-month-panel-decade-select-arrow,\n.ant-calendar-month-panel-header .ant-calendar-month-panel-year-select-arrow,\n.ant-calendar-month-panel-header .ant-calendar-month-panel-month-select-arrow {\n display: none;\n}\n.ant-calendar-month-panel-header .ant-calendar-month-panel-prev-century-btn,\n.ant-calendar-month-panel-header .ant-calendar-month-panel-next-century-btn,\n.ant-calendar-month-panel-header .ant-calendar-month-panel-prev-decade-btn,\n.ant-calendar-month-panel-header .ant-calendar-month-panel-next-decade-btn,\n.ant-calendar-month-panel-header .ant-calendar-month-panel-prev-month-btn,\n.ant-calendar-month-panel-header .ant-calendar-month-panel-next-month-btn,\n.ant-calendar-month-panel-header .ant-calendar-month-panel-prev-year-btn,\n.ant-calendar-month-panel-header .ant-calendar-month-panel-next-year-btn {\n position: absolute;\n top: 0;\n display: inline-block;\n padding: 0 5px;\n color: rgba(0, 0, 0, 0.45);\n font-size: 16px;\n font-family: Arial, 'Hiragino Sans GB', 'Microsoft Yahei', 'Microsoft Sans Serif', sans-serif;\n line-height: 40px;\n}\n.ant-calendar-month-panel-header .ant-calendar-month-panel-prev-century-btn,\n.ant-calendar-month-panel-header .ant-calendar-month-panel-prev-decade-btn,\n.ant-calendar-month-panel-header .ant-calendar-month-panel-prev-year-btn {\n left: 7px;\n height: 100%;\n}\n.ant-calendar-month-panel-header .ant-calendar-month-panel-prev-century-btn::before,\n.ant-calendar-month-panel-header .ant-calendar-month-panel-prev-decade-btn::before,\n.ant-calendar-month-panel-header .ant-calendar-month-panel-prev-year-btn::before,\n.ant-calendar-month-panel-header .ant-calendar-month-panel-prev-century-btn::after,\n.ant-calendar-month-panel-header .ant-calendar-month-panel-prev-decade-btn::after,\n.ant-calendar-month-panel-header .ant-calendar-month-panel-prev-year-btn::after {\n position: relative;\n top: -1px;\n display: inline-block;\n width: 8px;\n height: 8px;\n vertical-align: middle;\n border: 0 solid #aaa;\n border-width: 1.5px 0 0 1.5px;\n border-radius: 1px;\n transform: rotate(-45deg) scale(0.8);\n transition: all 0.3s;\n content: '';\n}\n.ant-calendar-month-panel-header .ant-calendar-month-panel-prev-century-btn:hover::before,\n.ant-calendar-month-panel-header .ant-calendar-month-panel-prev-decade-btn:hover::before,\n.ant-calendar-month-panel-header .ant-calendar-month-panel-prev-year-btn:hover::before,\n.ant-calendar-month-panel-header .ant-calendar-month-panel-prev-century-btn:hover::after,\n.ant-calendar-month-panel-header .ant-calendar-month-panel-prev-decade-btn:hover::after,\n.ant-calendar-month-panel-header .ant-calendar-month-panel-prev-year-btn:hover::after {\n border-color: rgba(0, 0, 0, 0.65);\n}\n.ant-calendar-month-panel-header .ant-calendar-month-panel-prev-century-btn::after,\n.ant-calendar-month-panel-header .ant-calendar-month-panel-prev-decade-btn::after,\n.ant-calendar-month-panel-header .ant-calendar-month-panel-prev-year-btn::after {\n display: none;\n}\n.ant-calendar-month-panel-header .ant-calendar-month-panel-prev-century-btn::after,\n.ant-calendar-month-panel-header .ant-calendar-month-panel-prev-decade-btn::after,\n.ant-calendar-month-panel-header .ant-calendar-month-panel-prev-year-btn::after {\n position: relative;\n left: -3px;\n display: inline-block;\n}\n.ant-calendar-month-panel-header .ant-calendar-month-panel-next-century-btn,\n.ant-calendar-month-panel-header .ant-calendar-month-panel-next-decade-btn,\n.ant-calendar-month-panel-header .ant-calendar-month-panel-next-year-btn {\n right: 7px;\n height: 100%;\n}\n.ant-calendar-month-panel-header .ant-calendar-month-panel-next-century-btn::before,\n.ant-calendar-month-panel-header .ant-calendar-month-panel-next-decade-btn::before,\n.ant-calendar-month-panel-header .ant-calendar-month-panel-next-year-btn::before,\n.ant-calendar-month-panel-header .ant-calendar-month-panel-next-century-btn::after,\n.ant-calendar-month-panel-header .ant-calendar-month-panel-next-decade-btn::after,\n.ant-calendar-month-panel-header .ant-calendar-month-panel-next-year-btn::after {\n position: relative;\n top: -1px;\n display: inline-block;\n width: 8px;\n height: 8px;\n vertical-align: middle;\n border: 0 solid #aaa;\n border-width: 1.5px 0 0 1.5px;\n border-radius: 1px;\n transform: rotate(-45deg) scale(0.8);\n transition: all 0.3s;\n content: '';\n}\n.ant-calendar-month-panel-header .ant-calendar-month-panel-next-century-btn:hover::before,\n.ant-calendar-month-panel-header .ant-calendar-month-panel-next-decade-btn:hover::before,\n.ant-calendar-month-panel-header .ant-calendar-month-panel-next-year-btn:hover::before,\n.ant-calendar-month-panel-header .ant-calendar-month-panel-next-century-btn:hover::after,\n.ant-calendar-month-panel-header .ant-calendar-month-panel-next-decade-btn:hover::after,\n.ant-calendar-month-panel-header .ant-calendar-month-panel-next-year-btn:hover::after {\n border-color: rgba(0, 0, 0, 0.65);\n}\n.ant-calendar-month-panel-header .ant-calendar-month-panel-next-century-btn::after,\n.ant-calendar-month-panel-header .ant-calendar-month-panel-next-decade-btn::after,\n.ant-calendar-month-panel-header .ant-calendar-month-panel-next-year-btn::after {\n display: none;\n}\n.ant-calendar-month-panel-header .ant-calendar-month-panel-next-century-btn::before,\n.ant-calendar-month-panel-header .ant-calendar-month-panel-next-decade-btn::before,\n.ant-calendar-month-panel-header .ant-calendar-month-panel-next-year-btn::before,\n.ant-calendar-month-panel-header .ant-calendar-month-panel-next-century-btn::after,\n.ant-calendar-month-panel-header .ant-calendar-month-panel-next-decade-btn::after,\n.ant-calendar-month-panel-header .ant-calendar-month-panel-next-year-btn::after {\n transform: rotate(135deg) scale(0.8);\n}\n.ant-calendar-month-panel-header .ant-calendar-month-panel-next-century-btn::before,\n.ant-calendar-month-panel-header .ant-calendar-month-panel-next-decade-btn::before,\n.ant-calendar-month-panel-header .ant-calendar-month-panel-next-year-btn::before {\n position: relative;\n left: 3px;\n}\n.ant-calendar-month-panel-header .ant-calendar-month-panel-next-century-btn::after,\n.ant-calendar-month-panel-header .ant-calendar-month-panel-next-decade-btn::after,\n.ant-calendar-month-panel-header .ant-calendar-month-panel-next-year-btn::after {\n display: inline-block;\n}\n.ant-calendar-month-panel-header .ant-calendar-month-panel-prev-month-btn {\n left: 29px;\n height: 100%;\n}\n.ant-calendar-month-panel-header .ant-calendar-month-panel-prev-month-btn::before,\n.ant-calendar-month-panel-header .ant-calendar-month-panel-prev-month-btn::after {\n position: relative;\n top: -1px;\n display: inline-block;\n width: 8px;\n height: 8px;\n vertical-align: middle;\n border: 0 solid #aaa;\n border-width: 1.5px 0 0 1.5px;\n border-radius: 1px;\n transform: rotate(-45deg) scale(0.8);\n transition: all 0.3s;\n content: '';\n}\n.ant-calendar-month-panel-header .ant-calendar-month-panel-prev-month-btn:hover::before,\n.ant-calendar-month-panel-header .ant-calendar-month-panel-prev-month-btn:hover::after {\n border-color: rgba(0, 0, 0, 0.65);\n}\n.ant-calendar-month-panel-header .ant-calendar-month-panel-prev-month-btn::after {\n display: none;\n}\n.ant-calendar-month-panel-header .ant-calendar-month-panel-next-month-btn {\n right: 29px;\n height: 100%;\n}\n.ant-calendar-month-panel-header .ant-calendar-month-panel-next-month-btn::before,\n.ant-calendar-month-panel-header .ant-calendar-month-panel-next-month-btn::after {\n position: relative;\n top: -1px;\n display: inline-block;\n width: 8px;\n height: 8px;\n vertical-align: middle;\n border: 0 solid #aaa;\n border-width: 1.5px 0 0 1.5px;\n border-radius: 1px;\n transform: rotate(-45deg) scale(0.8);\n transition: all 0.3s;\n content: '';\n}\n.ant-calendar-month-panel-header .ant-calendar-month-panel-next-month-btn:hover::before,\n.ant-calendar-month-panel-header .ant-calendar-month-panel-next-month-btn:hover::after {\n border-color: rgba(0, 0, 0, 0.65);\n}\n.ant-calendar-month-panel-header .ant-calendar-month-panel-next-month-btn::after {\n display: none;\n}\n.ant-calendar-month-panel-header .ant-calendar-month-panel-next-month-btn::before,\n.ant-calendar-month-panel-header .ant-calendar-month-panel-next-month-btn::after {\n transform: rotate(135deg) scale(0.8);\n}\n.ant-calendar-month-panel-body {\n flex: 1;\n}\n.ant-calendar-month-panel-footer {\n border-top: 1px solid #e8e8e8;\n}\n.ant-calendar-month-panel-footer .ant-calendar-footer-extra {\n padding: 0 12px;\n}\n.ant-calendar-month-panel-table {\n width: 100%;\n height: 100%;\n table-layout: fixed;\n border-collapse: separate;\n}\n.ant-calendar-month-panel-selected-cell .ant-calendar-month-panel-month {\n color: #fff;\n background: #1890ff;\n}\n.ant-calendar-month-panel-selected-cell .ant-calendar-month-panel-month:hover {\n color: #fff;\n background: #1890ff;\n}\n.ant-calendar-month-panel-cell {\n text-align: center;\n}\n.ant-calendar-month-panel-cell-disabled .ant-calendar-month-panel-month,\n.ant-calendar-month-panel-cell-disabled .ant-calendar-month-panel-month:hover {\n color: rgba(0, 0, 0, 0.25);\n background: #f5f5f5;\n cursor: not-allowed;\n}\n.ant-calendar-month-panel-month {\n display: inline-block;\n height: 24px;\n margin: 0 auto;\n padding: 0 8px;\n color: rgba(0, 0, 0, 0.65);\n line-height: 24px;\n text-align: center;\n background: transparent;\n border-radius: 2px;\n transition: background 0.3s ease;\n}\n.ant-calendar-month-panel-month:hover {\n background: #e6f7ff;\n cursor: pointer;\n}\n.ant-calendar-year-panel {\n position: absolute;\n top: 0;\n right: 0;\n bottom: 0;\n left: 0;\n z-index: 10;\n background: #fff;\n border-radius: 4px;\n outline: none;\n}\n.ant-calendar-year-panel > div {\n display: flex;\n flex-direction: column;\n height: 100%;\n}\n.ant-calendar-year-panel-hidden {\n display: none;\n}\n.ant-calendar-year-panel-header {\n height: 40px;\n line-height: 40px;\n text-align: center;\n border-bottom: 1px solid #e8e8e8;\n user-select: none;\n position: relative;\n}\n.ant-calendar-year-panel-header a:hover {\n color: #40a9ff;\n}\n.ant-calendar-year-panel-header .ant-calendar-year-panel-century-select,\n.ant-calendar-year-panel-header .ant-calendar-year-panel-decade-select,\n.ant-calendar-year-panel-header .ant-calendar-year-panel-year-select,\n.ant-calendar-year-panel-header .ant-calendar-year-panel-month-select {\n display: inline-block;\n padding: 0 2px;\n color: rgba(0, 0, 0, 0.85);\n font-weight: 500;\n line-height: 40px;\n}\n.ant-calendar-year-panel-header .ant-calendar-year-panel-century-select-arrow,\n.ant-calendar-year-panel-header .ant-calendar-year-panel-decade-select-arrow,\n.ant-calendar-year-panel-header .ant-calendar-year-panel-year-select-arrow,\n.ant-calendar-year-panel-header .ant-calendar-year-panel-month-select-arrow {\n display: none;\n}\n.ant-calendar-year-panel-header .ant-calendar-year-panel-prev-century-btn,\n.ant-calendar-year-panel-header .ant-calendar-year-panel-next-century-btn,\n.ant-calendar-year-panel-header .ant-calendar-year-panel-prev-decade-btn,\n.ant-calendar-year-panel-header .ant-calendar-year-panel-next-decade-btn,\n.ant-calendar-year-panel-header .ant-calendar-year-panel-prev-month-btn,\n.ant-calendar-year-panel-header .ant-calendar-year-panel-next-month-btn,\n.ant-calendar-year-panel-header .ant-calendar-year-panel-prev-year-btn,\n.ant-calendar-year-panel-header .ant-calendar-year-panel-next-year-btn {\n position: absolute;\n top: 0;\n display: inline-block;\n padding: 0 5px;\n color: rgba(0, 0, 0, 0.45);\n font-size: 16px;\n font-family: Arial, 'Hiragino Sans GB', 'Microsoft Yahei', 'Microsoft Sans Serif', sans-serif;\n line-height: 40px;\n}\n.ant-calendar-year-panel-header .ant-calendar-year-panel-prev-century-btn,\n.ant-calendar-year-panel-header .ant-calendar-year-panel-prev-decade-btn,\n.ant-calendar-year-panel-header .ant-calendar-year-panel-prev-year-btn {\n left: 7px;\n height: 100%;\n}\n.ant-calendar-year-panel-header .ant-calendar-year-panel-prev-century-btn::before,\n.ant-calendar-year-panel-header .ant-calendar-year-panel-prev-decade-btn::before,\n.ant-calendar-year-panel-header .ant-calendar-year-panel-prev-year-btn::before,\n.ant-calendar-year-panel-header .ant-calendar-year-panel-prev-century-btn::after,\n.ant-calendar-year-panel-header .ant-calendar-year-panel-prev-decade-btn::after,\n.ant-calendar-year-panel-header .ant-calendar-year-panel-prev-year-btn::after {\n position: relative;\n top: -1px;\n display: inline-block;\n width: 8px;\n height: 8px;\n vertical-align: middle;\n border: 0 solid #aaa;\n border-width: 1.5px 0 0 1.5px;\n border-radius: 1px;\n transform: rotate(-45deg) scale(0.8);\n transition: all 0.3s;\n content: '';\n}\n.ant-calendar-year-panel-header .ant-calendar-year-panel-prev-century-btn:hover::before,\n.ant-calendar-year-panel-header .ant-calendar-year-panel-prev-decade-btn:hover::before,\n.ant-calendar-year-panel-header .ant-calendar-year-panel-prev-year-btn:hover::before,\n.ant-calendar-year-panel-header .ant-calendar-year-panel-prev-century-btn:hover::after,\n.ant-calendar-year-panel-header .ant-calendar-year-panel-prev-decade-btn:hover::after,\n.ant-calendar-year-panel-header .ant-calendar-year-panel-prev-year-btn:hover::after {\n border-color: rgba(0, 0, 0, 0.65);\n}\n.ant-calendar-year-panel-header .ant-calendar-year-panel-prev-century-btn::after,\n.ant-calendar-year-panel-header .ant-calendar-year-panel-prev-decade-btn::after,\n.ant-calendar-year-panel-header .ant-calendar-year-panel-prev-year-btn::after {\n display: none;\n}\n.ant-calendar-year-panel-header .ant-calendar-year-panel-prev-century-btn::after,\n.ant-calendar-year-panel-header .ant-calendar-year-panel-prev-decade-btn::after,\n.ant-calendar-year-panel-header .ant-calendar-year-panel-prev-year-btn::after {\n position: relative;\n left: -3px;\n display: inline-block;\n}\n.ant-calendar-year-panel-header .ant-calendar-year-panel-next-century-btn,\n.ant-calendar-year-panel-header .ant-calendar-year-panel-next-decade-btn,\n.ant-calendar-year-panel-header .ant-calendar-year-panel-next-year-btn {\n right: 7px;\n height: 100%;\n}\n.ant-calendar-year-panel-header .ant-calendar-year-panel-next-century-btn::before,\n.ant-calendar-year-panel-header .ant-calendar-year-panel-next-decade-btn::before,\n.ant-calendar-year-panel-header .ant-calendar-year-panel-next-year-btn::before,\n.ant-calendar-year-panel-header .ant-calendar-year-panel-next-century-btn::after,\n.ant-calendar-year-panel-header .ant-calendar-year-panel-next-decade-btn::after,\n.ant-calendar-year-panel-header .ant-calendar-year-panel-next-year-btn::after {\n position: relative;\n top: -1px;\n display: inline-block;\n width: 8px;\n height: 8px;\n vertical-align: middle;\n border: 0 solid #aaa;\n border-width: 1.5px 0 0 1.5px;\n border-radius: 1px;\n transform: rotate(-45deg) scale(0.8);\n transition: all 0.3s;\n content: '';\n}\n.ant-calendar-year-panel-header .ant-calendar-year-panel-next-century-btn:hover::before,\n.ant-calendar-year-panel-header .ant-calendar-year-panel-next-decade-btn:hover::before,\n.ant-calendar-year-panel-header .ant-calendar-year-panel-next-year-btn:hover::before,\n.ant-calendar-year-panel-header .ant-calendar-year-panel-next-century-btn:hover::after,\n.ant-calendar-year-panel-header .ant-calendar-year-panel-next-decade-btn:hover::after,\n.ant-calendar-year-panel-header .ant-calendar-year-panel-next-year-btn:hover::after {\n border-color: rgba(0, 0, 0, 0.65);\n}\n.ant-calendar-year-panel-header .ant-calendar-year-panel-next-century-btn::after,\n.ant-calendar-year-panel-header .ant-calendar-year-panel-next-decade-btn::after,\n.ant-calendar-year-panel-header .ant-calendar-year-panel-next-year-btn::after {\n display: none;\n}\n.ant-calendar-year-panel-header .ant-calendar-year-panel-next-century-btn::before,\n.ant-calendar-year-panel-header .ant-calendar-year-panel-next-decade-btn::before,\n.ant-calendar-year-panel-header .ant-calendar-year-panel-next-year-btn::before,\n.ant-calendar-year-panel-header .ant-calendar-year-panel-next-century-btn::after,\n.ant-calendar-year-panel-header .ant-calendar-year-panel-next-decade-btn::after,\n.ant-calendar-year-panel-header .ant-calendar-year-panel-next-year-btn::after {\n transform: rotate(135deg) scale(0.8);\n}\n.ant-calendar-year-panel-header .ant-calendar-year-panel-next-century-btn::before,\n.ant-calendar-year-panel-header .ant-calendar-year-panel-next-decade-btn::before,\n.ant-calendar-year-panel-header .ant-calendar-year-panel-next-year-btn::before {\n position: relative;\n left: 3px;\n}\n.ant-calendar-year-panel-header .ant-calendar-year-panel-next-century-btn::after,\n.ant-calendar-year-panel-header .ant-calendar-year-panel-next-decade-btn::after,\n.ant-calendar-year-panel-header .ant-calendar-year-panel-next-year-btn::after {\n display: inline-block;\n}\n.ant-calendar-year-panel-header .ant-calendar-year-panel-prev-month-btn {\n left: 29px;\n height: 100%;\n}\n.ant-calendar-year-panel-header .ant-calendar-year-panel-prev-month-btn::before,\n.ant-calendar-year-panel-header .ant-calendar-year-panel-prev-month-btn::after {\n position: relative;\n top: -1px;\n display: inline-block;\n width: 8px;\n height: 8px;\n vertical-align: middle;\n border: 0 solid #aaa;\n border-width: 1.5px 0 0 1.5px;\n border-radius: 1px;\n transform: rotate(-45deg) scale(0.8);\n transition: all 0.3s;\n content: '';\n}\n.ant-calendar-year-panel-header .ant-calendar-year-panel-prev-month-btn:hover::before,\n.ant-calendar-year-panel-header .ant-calendar-year-panel-prev-month-btn:hover::after {\n border-color: rgba(0, 0, 0, 0.65);\n}\n.ant-calendar-year-panel-header .ant-calendar-year-panel-prev-month-btn::after {\n display: none;\n}\n.ant-calendar-year-panel-header .ant-calendar-year-panel-next-month-btn {\n right: 29px;\n height: 100%;\n}\n.ant-calendar-year-panel-header .ant-calendar-year-panel-next-month-btn::before,\n.ant-calendar-year-panel-header .ant-calendar-year-panel-next-month-btn::after {\n position: relative;\n top: -1px;\n display: inline-block;\n width: 8px;\n height: 8px;\n vertical-align: middle;\n border: 0 solid #aaa;\n border-width: 1.5px 0 0 1.5px;\n border-radius: 1px;\n transform: rotate(-45deg) scale(0.8);\n transition: all 0.3s;\n content: '';\n}\n.ant-calendar-year-panel-header .ant-calendar-year-panel-next-month-btn:hover::before,\n.ant-calendar-year-panel-header .ant-calendar-year-panel-next-month-btn:hover::after {\n border-color: rgba(0, 0, 0, 0.65);\n}\n.ant-calendar-year-panel-header .ant-calendar-year-panel-next-month-btn::after {\n display: none;\n}\n.ant-calendar-year-panel-header .ant-calendar-year-panel-next-month-btn::before,\n.ant-calendar-year-panel-header .ant-calendar-year-panel-next-month-btn::after {\n transform: rotate(135deg) scale(0.8);\n}\n.ant-calendar-year-panel-body {\n flex: 1;\n}\n.ant-calendar-year-panel-footer {\n border-top: 1px solid #e8e8e8;\n}\n.ant-calendar-year-panel-footer .ant-calendar-footer-extra {\n padding: 0 12px;\n}\n.ant-calendar-year-panel-table {\n width: 100%;\n height: 100%;\n table-layout: fixed;\n border-collapse: separate;\n}\n.ant-calendar-year-panel-cell {\n text-align: center;\n}\n.ant-calendar-year-panel-year {\n display: inline-block;\n height: 24px;\n margin: 0 auto;\n padding: 0 8px;\n color: rgba(0, 0, 0, 0.65);\n line-height: 24px;\n text-align: center;\n background: transparent;\n border-radius: 2px;\n transition: background 0.3s ease;\n}\n.ant-calendar-year-panel-year:hover {\n background: #e6f7ff;\n cursor: pointer;\n}\n.ant-calendar-year-panel-selected-cell .ant-calendar-year-panel-year {\n color: #fff;\n background: #1890ff;\n}\n.ant-calendar-year-panel-selected-cell .ant-calendar-year-panel-year:hover {\n color: #fff;\n background: #1890ff;\n}\n.ant-calendar-year-panel-last-decade-cell .ant-calendar-year-panel-year,\n.ant-calendar-year-panel-next-decade-cell .ant-calendar-year-panel-year {\n color: rgba(0, 0, 0, 0.25);\n user-select: none;\n}\n.ant-calendar-decade-panel {\n position: absolute;\n top: 0;\n right: 0;\n bottom: 0;\n left: 0;\n z-index: 10;\n display: flex;\n flex-direction: column;\n background: #fff;\n border-radius: 4px;\n outline: none;\n}\n.ant-calendar-decade-panel-hidden {\n display: none;\n}\n.ant-calendar-decade-panel-header {\n height: 40px;\n line-height: 40px;\n text-align: center;\n border-bottom: 1px solid #e8e8e8;\n user-select: none;\n position: relative;\n}\n.ant-calendar-decade-panel-header a:hover {\n color: #40a9ff;\n}\n.ant-calendar-decade-panel-header .ant-calendar-decade-panel-century-select,\n.ant-calendar-decade-panel-header .ant-calendar-decade-panel-decade-select,\n.ant-calendar-decade-panel-header .ant-calendar-decade-panel-year-select,\n.ant-calendar-decade-panel-header .ant-calendar-decade-panel-month-select {\n display: inline-block;\n padding: 0 2px;\n color: rgba(0, 0, 0, 0.85);\n font-weight: 500;\n line-height: 40px;\n}\n.ant-calendar-decade-panel-header .ant-calendar-decade-panel-century-select-arrow,\n.ant-calendar-decade-panel-header .ant-calendar-decade-panel-decade-select-arrow,\n.ant-calendar-decade-panel-header .ant-calendar-decade-panel-year-select-arrow,\n.ant-calendar-decade-panel-header .ant-calendar-decade-panel-month-select-arrow {\n display: none;\n}\n.ant-calendar-decade-panel-header .ant-calendar-decade-panel-prev-century-btn,\n.ant-calendar-decade-panel-header .ant-calendar-decade-panel-next-century-btn,\n.ant-calendar-decade-panel-header .ant-calendar-decade-panel-prev-decade-btn,\n.ant-calendar-decade-panel-header .ant-calendar-decade-panel-next-decade-btn,\n.ant-calendar-decade-panel-header .ant-calendar-decade-panel-prev-month-btn,\n.ant-calendar-decade-panel-header .ant-calendar-decade-panel-next-month-btn,\n.ant-calendar-decade-panel-header .ant-calendar-decade-panel-prev-year-btn,\n.ant-calendar-decade-panel-header .ant-calendar-decade-panel-next-year-btn {\n position: absolute;\n top: 0;\n display: inline-block;\n padding: 0 5px;\n color: rgba(0, 0, 0, 0.45);\n font-size: 16px;\n font-family: Arial, 'Hiragino Sans GB', 'Microsoft Yahei', 'Microsoft Sans Serif', sans-serif;\n line-height: 40px;\n}\n.ant-calendar-decade-panel-header .ant-calendar-decade-panel-prev-century-btn,\n.ant-calendar-decade-panel-header .ant-calendar-decade-panel-prev-decade-btn,\n.ant-calendar-decade-panel-header .ant-calendar-decade-panel-prev-year-btn {\n left: 7px;\n height: 100%;\n}\n.ant-calendar-decade-panel-header .ant-calendar-decade-panel-prev-century-btn::before,\n.ant-calendar-decade-panel-header .ant-calendar-decade-panel-prev-decade-btn::before,\n.ant-calendar-decade-panel-header .ant-calendar-decade-panel-prev-year-btn::before,\n.ant-calendar-decade-panel-header .ant-calendar-decade-panel-prev-century-btn::after,\n.ant-calendar-decade-panel-header .ant-calendar-decade-panel-prev-decade-btn::after,\n.ant-calendar-decade-panel-header .ant-calendar-decade-panel-prev-year-btn::after {\n position: relative;\n top: -1px;\n display: inline-block;\n width: 8px;\n height: 8px;\n vertical-align: middle;\n border: 0 solid #aaa;\n border-width: 1.5px 0 0 1.5px;\n border-radius: 1px;\n transform: rotate(-45deg) scale(0.8);\n transition: all 0.3s;\n content: '';\n}\n.ant-calendar-decade-panel-header .ant-calendar-decade-panel-prev-century-btn:hover::before,\n.ant-calendar-decade-panel-header .ant-calendar-decade-panel-prev-decade-btn:hover::before,\n.ant-calendar-decade-panel-header .ant-calendar-decade-panel-prev-year-btn:hover::before,\n.ant-calendar-decade-panel-header .ant-calendar-decade-panel-prev-century-btn:hover::after,\n.ant-calendar-decade-panel-header .ant-calendar-decade-panel-prev-decade-btn:hover::after,\n.ant-calendar-decade-panel-header .ant-calendar-decade-panel-prev-year-btn:hover::after {\n border-color: rgba(0, 0, 0, 0.65);\n}\n.ant-calendar-decade-panel-header .ant-calendar-decade-panel-prev-century-btn::after,\n.ant-calendar-decade-panel-header .ant-calendar-decade-panel-prev-decade-btn::after,\n.ant-calendar-decade-panel-header .ant-calendar-decade-panel-prev-year-btn::after {\n display: none;\n}\n.ant-calendar-decade-panel-header .ant-calendar-decade-panel-prev-century-btn::after,\n.ant-calendar-decade-panel-header .ant-calendar-decade-panel-prev-decade-btn::after,\n.ant-calendar-decade-panel-header .ant-calendar-decade-panel-prev-year-btn::after {\n position: relative;\n left: -3px;\n display: inline-block;\n}\n.ant-calendar-decade-panel-header .ant-calendar-decade-panel-next-century-btn,\n.ant-calendar-decade-panel-header .ant-calendar-decade-panel-next-decade-btn,\n.ant-calendar-decade-panel-header .ant-calendar-decade-panel-next-year-btn {\n right: 7px;\n height: 100%;\n}\n.ant-calendar-decade-panel-header .ant-calendar-decade-panel-next-century-btn::before,\n.ant-calendar-decade-panel-header .ant-calendar-decade-panel-next-decade-btn::before,\n.ant-calendar-decade-panel-header .ant-calendar-decade-panel-next-year-btn::before,\n.ant-calendar-decade-panel-header .ant-calendar-decade-panel-next-century-btn::after,\n.ant-calendar-decade-panel-header .ant-calendar-decade-panel-next-decade-btn::after,\n.ant-calendar-decade-panel-header .ant-calendar-decade-panel-next-year-btn::after {\n position: relative;\n top: -1px;\n display: inline-block;\n width: 8px;\n height: 8px;\n vertical-align: middle;\n border: 0 solid #aaa;\n border-width: 1.5px 0 0 1.5px;\n border-radius: 1px;\n transform: rotate(-45deg) scale(0.8);\n transition: all 0.3s;\n content: '';\n}\n.ant-calendar-decade-panel-header .ant-calendar-decade-panel-next-century-btn:hover::before,\n.ant-calendar-decade-panel-header .ant-calendar-decade-panel-next-decade-btn:hover::before,\n.ant-calendar-decade-panel-header .ant-calendar-decade-panel-next-year-btn:hover::before,\n.ant-calendar-decade-panel-header .ant-calendar-decade-panel-next-century-btn:hover::after,\n.ant-calendar-decade-panel-header .ant-calendar-decade-panel-next-decade-btn:hover::after,\n.ant-calendar-decade-panel-header .ant-calendar-decade-panel-next-year-btn:hover::after {\n border-color: rgba(0, 0, 0, 0.65);\n}\n.ant-calendar-decade-panel-header .ant-calendar-decade-panel-next-century-btn::after,\n.ant-calendar-decade-panel-header .ant-calendar-decade-panel-next-decade-btn::after,\n.ant-calendar-decade-panel-header .ant-calendar-decade-panel-next-year-btn::after {\n display: none;\n}\n.ant-calendar-decade-panel-header .ant-calendar-decade-panel-next-century-btn::before,\n.ant-calendar-decade-panel-header .ant-calendar-decade-panel-next-decade-btn::before,\n.ant-calendar-decade-panel-header .ant-calendar-decade-panel-next-year-btn::before,\n.ant-calendar-decade-panel-header .ant-calendar-decade-panel-next-century-btn::after,\n.ant-calendar-decade-panel-header .ant-calendar-decade-panel-next-decade-btn::after,\n.ant-calendar-decade-panel-header .ant-calendar-decade-panel-next-year-btn::after {\n transform: rotate(135deg) scale(0.8);\n}\n.ant-calendar-decade-panel-header .ant-calendar-decade-panel-next-century-btn::before,\n.ant-calendar-decade-panel-header .ant-calendar-decade-panel-next-decade-btn::before,\n.ant-calendar-decade-panel-header .ant-calendar-decade-panel-next-year-btn::before {\n position: relative;\n left: 3px;\n}\n.ant-calendar-decade-panel-header .ant-calendar-decade-panel-next-century-btn::after,\n.ant-calendar-decade-panel-header .ant-calendar-decade-panel-next-decade-btn::after,\n.ant-calendar-decade-panel-header .ant-calendar-decade-panel-next-year-btn::after {\n display: inline-block;\n}\n.ant-calendar-decade-panel-header .ant-calendar-decade-panel-prev-month-btn {\n left: 29px;\n height: 100%;\n}\n.ant-calendar-decade-panel-header .ant-calendar-decade-panel-prev-month-btn::before,\n.ant-calendar-decade-panel-header .ant-calendar-decade-panel-prev-month-btn::after {\n position: relative;\n top: -1px;\n display: inline-block;\n width: 8px;\n height: 8px;\n vertical-align: middle;\n border: 0 solid #aaa;\n border-width: 1.5px 0 0 1.5px;\n border-radius: 1px;\n transform: rotate(-45deg) scale(0.8);\n transition: all 0.3s;\n content: '';\n}\n.ant-calendar-decade-panel-header .ant-calendar-decade-panel-prev-month-btn:hover::before,\n.ant-calendar-decade-panel-header .ant-calendar-decade-panel-prev-month-btn:hover::after {\n border-color: rgba(0, 0, 0, 0.65);\n}\n.ant-calendar-decade-panel-header .ant-calendar-decade-panel-prev-month-btn::after {\n display: none;\n}\n.ant-calendar-decade-panel-header .ant-calendar-decade-panel-next-month-btn {\n right: 29px;\n height: 100%;\n}\n.ant-calendar-decade-panel-header .ant-calendar-decade-panel-next-month-btn::before,\n.ant-calendar-decade-panel-header .ant-calendar-decade-panel-next-month-btn::after {\n position: relative;\n top: -1px;\n display: inline-block;\n width: 8px;\n height: 8px;\n vertical-align: middle;\n border: 0 solid #aaa;\n border-width: 1.5px 0 0 1.5px;\n border-radius: 1px;\n transform: rotate(-45deg) scale(0.8);\n transition: all 0.3s;\n content: '';\n}\n.ant-calendar-decade-panel-header .ant-calendar-decade-panel-next-month-btn:hover::before,\n.ant-calendar-decade-panel-header .ant-calendar-decade-panel-next-month-btn:hover::after {\n border-color: rgba(0, 0, 0, 0.65);\n}\n.ant-calendar-decade-panel-header .ant-calendar-decade-panel-next-month-btn::after {\n display: none;\n}\n.ant-calendar-decade-panel-header .ant-calendar-decade-panel-next-month-btn::before,\n.ant-calendar-decade-panel-header .ant-calendar-decade-panel-next-month-btn::after {\n transform: rotate(135deg) scale(0.8);\n}\n.ant-calendar-decade-panel-body {\n flex: 1;\n}\n.ant-calendar-decade-panel-footer {\n border-top: 1px solid #e8e8e8;\n}\n.ant-calendar-decade-panel-footer .ant-calendar-footer-extra {\n padding: 0 12px;\n}\n.ant-calendar-decade-panel-table {\n width: 100%;\n height: 100%;\n table-layout: fixed;\n border-collapse: separate;\n}\n.ant-calendar-decade-panel-cell {\n white-space: nowrap;\n text-align: center;\n}\n.ant-calendar-decade-panel-decade {\n display: inline-block;\n height: 24px;\n margin: 0 auto;\n padding: 0 6px;\n color: rgba(0, 0, 0, 0.65);\n line-height: 24px;\n text-align: center;\n background: transparent;\n border-radius: 2px;\n transition: background 0.3s ease;\n}\n.ant-calendar-decade-panel-decade:hover {\n background: #e6f7ff;\n cursor: pointer;\n}\n.ant-calendar-decade-panel-selected-cell .ant-calendar-decade-panel-decade {\n color: #fff;\n background: #1890ff;\n}\n.ant-calendar-decade-panel-selected-cell .ant-calendar-decade-panel-decade:hover {\n color: #fff;\n background: #1890ff;\n}\n.ant-calendar-decade-panel-last-century-cell .ant-calendar-decade-panel-decade,\n.ant-calendar-decade-panel-next-century-cell .ant-calendar-decade-panel-decade {\n color: rgba(0, 0, 0, 0.25);\n user-select: none;\n}\n.ant-calendar-month .ant-calendar-month-header-wrap {\n position: relative;\n height: 288px;\n}\n.ant-calendar-month .ant-calendar-month-panel,\n.ant-calendar-month .ant-calendar-year-panel {\n top: 0;\n height: 100%;\n}\n.ant-calendar-week-number-cell {\n opacity: 0.5;\n}\n.ant-calendar-week-number .ant-calendar-body tr {\n cursor: pointer;\n transition: all 0.3s;\n}\n.ant-calendar-week-number .ant-calendar-body tr:hover {\n background: #e6f7ff;\n}\n.ant-calendar-week-number .ant-calendar-body tr.ant-calendar-active-week {\n font-weight: bold;\n background: #bae7ff;\n}\n.ant-calendar-week-number .ant-calendar-body tr .ant-calendar-selected-day .ant-calendar-date,\n.ant-calendar-week-number .ant-calendar-body tr .ant-calendar-selected-day:hover .ant-calendar-date {\n color: rgba(0, 0, 0, 0.65);\n background: transparent;\n}\n/*# sourceMappingURL=index.css.map */";
|
|
25
|
+
n(css,{"prepend":true});
|
|
26
|
+
|
|
27
|
+
function mirror(o) {
|
|
28
|
+
return o;
|
|
29
|
+
}
|
|
30
|
+
|
|
31
|
+
function mapSelf(children) {
|
|
32
|
+
// return ReactFragment
|
|
33
|
+
return React__default.Children.map(children, mirror);
|
|
34
|
+
}
|
|
35
|
+
|
|
36
|
+
function goYear$3(direction) {
|
|
37
|
+
this.props.changeYear(direction);
|
|
38
|
+
}
|
|
39
|
+
|
|
40
|
+
function noop$3() {}
|
|
41
|
+
|
|
42
|
+
var MonthPanel = function (_React$Component) {
|
|
43
|
+
_inherits$4(MonthPanel, _React$Component);
|
|
44
|
+
|
|
45
|
+
function MonthPanel(props) {
|
|
46
|
+
_classCallCheck$4(this, MonthPanel);
|
|
47
|
+
|
|
48
|
+
var _this = _possibleConstructorReturn$4(this, _React$Component.call(this, props));
|
|
49
|
+
|
|
50
|
+
_this.setAndSelectValue = function (value) {
|
|
51
|
+
_this.setValue(value);
|
|
52
|
+
_this.props.onSelect(value);
|
|
53
|
+
};
|
|
54
|
+
|
|
55
|
+
_this.setValue = function (value) {
|
|
56
|
+
if ('value' in _this.props) {
|
|
57
|
+
_this.setState({
|
|
58
|
+
value: value
|
|
59
|
+
});
|
|
60
|
+
}
|
|
61
|
+
};
|
|
62
|
+
|
|
63
|
+
_this.nextYear = goYear$3.bind(_this, 1);
|
|
64
|
+
_this.previousYear = goYear$3.bind(_this, -1);
|
|
65
|
+
_this.prefixCls = props.rootPrefixCls + '-month-panel';
|
|
66
|
+
|
|
67
|
+
_this.state = {
|
|
68
|
+
value: props.value || props.defaultValue
|
|
69
|
+
};
|
|
70
|
+
return _this;
|
|
71
|
+
}
|
|
72
|
+
|
|
73
|
+
MonthPanel.getDerivedStateFromProps = function getDerivedStateFromProps(props) {
|
|
74
|
+
var newState = {};
|
|
75
|
+
|
|
76
|
+
if ('value' in props) {
|
|
77
|
+
newState = {
|
|
78
|
+
value: props.value
|
|
79
|
+
};
|
|
80
|
+
}
|
|
81
|
+
|
|
82
|
+
return newState;
|
|
83
|
+
};
|
|
84
|
+
|
|
85
|
+
MonthPanel.prototype.render = function render() {
|
|
86
|
+
var props = this.props;
|
|
87
|
+
var value = this.state.value;
|
|
88
|
+
var locale = props.locale,
|
|
89
|
+
cellRender = props.cellRender,
|
|
90
|
+
contentRender = props.contentRender,
|
|
91
|
+
renderFooter = props.renderFooter;
|
|
92
|
+
|
|
93
|
+
var year = value.year();
|
|
94
|
+
var prefixCls = this.prefixCls;
|
|
95
|
+
|
|
96
|
+
var footer = renderFooter && renderFooter('month');
|
|
97
|
+
|
|
98
|
+
return React__default.createElement(
|
|
99
|
+
'div',
|
|
100
|
+
{ className: prefixCls, style: props.style },
|
|
101
|
+
React__default.createElement(
|
|
102
|
+
'div',
|
|
103
|
+
null,
|
|
104
|
+
React__default.createElement(
|
|
105
|
+
'div',
|
|
106
|
+
{ className: prefixCls + '-header' },
|
|
107
|
+
React__default.createElement('a', {
|
|
108
|
+
className: prefixCls + '-prev-year-btn',
|
|
109
|
+
role: 'button',
|
|
110
|
+
onClick: this.previousYear,
|
|
111
|
+
title: locale.previousYear
|
|
112
|
+
}),
|
|
113
|
+
React__default.createElement(
|
|
114
|
+
'a',
|
|
115
|
+
{
|
|
116
|
+
className: prefixCls + '-year-select',
|
|
117
|
+
role: 'button',
|
|
118
|
+
onClick: props.onYearPanelShow,
|
|
119
|
+
title: locale.yearSelect
|
|
120
|
+
},
|
|
121
|
+
React__default.createElement(
|
|
122
|
+
'span',
|
|
123
|
+
{ className: prefixCls + '-year-select-content' },
|
|
124
|
+
year
|
|
125
|
+
),
|
|
126
|
+
React__default.createElement(
|
|
127
|
+
'span',
|
|
128
|
+
{ className: prefixCls + '-year-select-arrow' },
|
|
129
|
+
'x'
|
|
130
|
+
)
|
|
131
|
+
),
|
|
132
|
+
React__default.createElement('a', {
|
|
133
|
+
className: prefixCls + '-next-year-btn',
|
|
134
|
+
role: 'button',
|
|
135
|
+
onClick: this.nextYear,
|
|
136
|
+
title: locale.nextYear
|
|
137
|
+
})
|
|
138
|
+
),
|
|
139
|
+
React__default.createElement(
|
|
140
|
+
'div',
|
|
141
|
+
{ className: prefixCls + '-body' },
|
|
142
|
+
React__default.createElement(MonthTable, {
|
|
143
|
+
disabledDate: props.disabledDate,
|
|
144
|
+
onSelect: this.setAndSelectValue,
|
|
145
|
+
locale: locale,
|
|
146
|
+
value: value,
|
|
147
|
+
cellRender: cellRender,
|
|
148
|
+
contentRender: contentRender,
|
|
149
|
+
prefixCls: prefixCls
|
|
150
|
+
})
|
|
151
|
+
),
|
|
152
|
+
footer && React__default.createElement(
|
|
153
|
+
'div',
|
|
154
|
+
{ className: prefixCls + '-footer' },
|
|
155
|
+
footer
|
|
156
|
+
)
|
|
157
|
+
)
|
|
158
|
+
);
|
|
159
|
+
};
|
|
160
|
+
|
|
161
|
+
return MonthPanel;
|
|
162
|
+
}(React__default.Component);
|
|
163
|
+
|
|
164
|
+
MonthPanel.propTypes = {
|
|
165
|
+
onChange: PropTypes.func,
|
|
166
|
+
disabledDate: PropTypes.func,
|
|
167
|
+
onSelect: PropTypes.func,
|
|
168
|
+
renderFooter: PropTypes.func,
|
|
169
|
+
rootPrefixCls: PropTypes.string,
|
|
170
|
+
value: PropTypes.object,
|
|
171
|
+
defaultValue: PropTypes.object
|
|
172
|
+
};
|
|
173
|
+
MonthPanel.defaultProps = {
|
|
174
|
+
onChange: noop$3,
|
|
175
|
+
onSelect: noop$3
|
|
176
|
+
};
|
|
177
|
+
|
|
178
|
+
|
|
179
|
+
polyfill(MonthPanel);
|
|
180
|
+
|
|
181
|
+
var ROW$1 = 4;
|
|
182
|
+
var COL$1 = 3;
|
|
183
|
+
|
|
184
|
+
function goYear$2(direction) {
|
|
185
|
+
var value = this.state.value.clone();
|
|
186
|
+
value.add(direction, 'year');
|
|
187
|
+
this.setState({
|
|
188
|
+
value: value
|
|
189
|
+
});
|
|
190
|
+
}
|
|
191
|
+
|
|
192
|
+
function chooseYear(year) {
|
|
193
|
+
var value = this.state.value.clone();
|
|
194
|
+
value.year(year);
|
|
195
|
+
value.month(this.state.value.month());
|
|
196
|
+
this.setState({
|
|
197
|
+
value: value
|
|
198
|
+
});
|
|
199
|
+
this.props.onSelect(value);
|
|
200
|
+
}
|
|
201
|
+
|
|
202
|
+
var YearPanel = function (_React$Component) {
|
|
203
|
+
_inherits$4(YearPanel, _React$Component);
|
|
204
|
+
|
|
205
|
+
function YearPanel(props) {
|
|
206
|
+
_classCallCheck$4(this, YearPanel);
|
|
207
|
+
|
|
208
|
+
var _this = _possibleConstructorReturn$4(this, _React$Component.call(this, props));
|
|
209
|
+
|
|
210
|
+
_this.prefixCls = props.rootPrefixCls + '-year-panel';
|
|
211
|
+
_this.state = {
|
|
212
|
+
value: props.value || props.defaultValue
|
|
213
|
+
};
|
|
214
|
+
_this.nextDecade = goYear$2.bind(_this, 10);
|
|
215
|
+
_this.previousDecade = goYear$2.bind(_this, -10);
|
|
216
|
+
return _this;
|
|
217
|
+
}
|
|
218
|
+
|
|
219
|
+
YearPanel.prototype.years = function years() {
|
|
220
|
+
var value = this.state.value;
|
|
221
|
+
var currentYear = value.year();
|
|
222
|
+
var startYear = parseInt(currentYear / 10, 10) * 10;
|
|
223
|
+
var previousYear = startYear - 1;
|
|
224
|
+
var years = [];
|
|
225
|
+
var index = 0;
|
|
226
|
+
for (var rowIndex = 0; rowIndex < ROW$1; rowIndex++) {
|
|
227
|
+
years[rowIndex] = [];
|
|
228
|
+
for (var colIndex = 0; colIndex < COL$1; colIndex++) {
|
|
229
|
+
var year = previousYear + index;
|
|
230
|
+
var content = String(year);
|
|
231
|
+
years[rowIndex][colIndex] = {
|
|
232
|
+
content: content,
|
|
233
|
+
year: year,
|
|
234
|
+
title: content
|
|
235
|
+
};
|
|
236
|
+
index++;
|
|
237
|
+
}
|
|
238
|
+
}
|
|
239
|
+
return years;
|
|
240
|
+
};
|
|
241
|
+
|
|
242
|
+
YearPanel.prototype.render = function render() {
|
|
243
|
+
var _this2 = this;
|
|
244
|
+
|
|
245
|
+
var props = this.props;
|
|
246
|
+
var value = this.state.value;
|
|
247
|
+
var locale = props.locale,
|
|
248
|
+
renderFooter = props.renderFooter;
|
|
249
|
+
|
|
250
|
+
var years = this.years();
|
|
251
|
+
var currentYear = value.year();
|
|
252
|
+
var startYear = parseInt(currentYear / 10, 10) * 10;
|
|
253
|
+
var endYear = startYear + 9;
|
|
254
|
+
var prefixCls = this.prefixCls;
|
|
255
|
+
|
|
256
|
+
var yeasEls = years.map(function (row, index) {
|
|
257
|
+
var tds = row.map(function (yearData) {
|
|
258
|
+
var _classNameMap;
|
|
259
|
+
|
|
260
|
+
var classNameMap = (_classNameMap = {}, _classNameMap[prefixCls + '-cell'] = 1, _classNameMap[prefixCls + '-selected-cell'] = yearData.year === currentYear, _classNameMap[prefixCls + '-last-decade-cell'] = yearData.year < startYear, _classNameMap[prefixCls + '-next-decade-cell'] = yearData.year > endYear, _classNameMap);
|
|
261
|
+
var clickHandler = void 0;
|
|
262
|
+
if (yearData.year < startYear) {
|
|
263
|
+
clickHandler = _this2.previousDecade;
|
|
264
|
+
} else if (yearData.year > endYear) {
|
|
265
|
+
clickHandler = _this2.nextDecade;
|
|
266
|
+
} else {
|
|
267
|
+
clickHandler = chooseYear.bind(_this2, yearData.year);
|
|
268
|
+
}
|
|
269
|
+
return React__default.createElement(
|
|
270
|
+
'td',
|
|
271
|
+
{
|
|
272
|
+
role: 'gridcell',
|
|
273
|
+
title: yearData.title,
|
|
274
|
+
key: yearData.content,
|
|
275
|
+
onClick: clickHandler,
|
|
276
|
+
className: classNames(classNameMap)
|
|
277
|
+
},
|
|
278
|
+
React__default.createElement(
|
|
279
|
+
'a',
|
|
280
|
+
{
|
|
281
|
+
className: prefixCls + '-year'
|
|
282
|
+
},
|
|
283
|
+
yearData.content
|
|
284
|
+
)
|
|
285
|
+
);
|
|
286
|
+
});
|
|
287
|
+
return React__default.createElement(
|
|
288
|
+
'tr',
|
|
289
|
+
{ key: index, role: 'row' },
|
|
290
|
+
tds
|
|
291
|
+
);
|
|
292
|
+
});
|
|
293
|
+
|
|
294
|
+
var footer = renderFooter && renderFooter('year');
|
|
295
|
+
|
|
296
|
+
return React__default.createElement(
|
|
297
|
+
'div',
|
|
298
|
+
{ className: this.prefixCls },
|
|
299
|
+
React__default.createElement(
|
|
300
|
+
'div',
|
|
301
|
+
null,
|
|
302
|
+
React__default.createElement(
|
|
303
|
+
'div',
|
|
304
|
+
{ className: prefixCls + '-header' },
|
|
305
|
+
React__default.createElement('a', {
|
|
306
|
+
className: prefixCls + '-prev-decade-btn',
|
|
307
|
+
role: 'button',
|
|
308
|
+
onClick: this.previousDecade,
|
|
309
|
+
title: locale.previousDecade
|
|
310
|
+
}),
|
|
311
|
+
React__default.createElement(
|
|
312
|
+
'a',
|
|
313
|
+
{
|
|
314
|
+
className: prefixCls + '-decade-select',
|
|
315
|
+
role: 'button',
|
|
316
|
+
onClick: props.onDecadePanelShow,
|
|
317
|
+
title: locale.decadeSelect
|
|
318
|
+
},
|
|
319
|
+
React__default.createElement(
|
|
320
|
+
'span',
|
|
321
|
+
{ className: prefixCls + '-decade-select-content' },
|
|
322
|
+
startYear,
|
|
323
|
+
'-',
|
|
324
|
+
endYear
|
|
325
|
+
),
|
|
326
|
+
React__default.createElement(
|
|
327
|
+
'span',
|
|
328
|
+
{ className: prefixCls + '-decade-select-arrow' },
|
|
329
|
+
'x'
|
|
330
|
+
)
|
|
331
|
+
),
|
|
332
|
+
React__default.createElement('a', {
|
|
333
|
+
className: prefixCls + '-next-decade-btn',
|
|
334
|
+
role: 'button',
|
|
335
|
+
onClick: this.nextDecade,
|
|
336
|
+
title: locale.nextDecade
|
|
337
|
+
})
|
|
338
|
+
),
|
|
339
|
+
React__default.createElement(
|
|
340
|
+
'div',
|
|
341
|
+
{ className: prefixCls + '-body' },
|
|
342
|
+
React__default.createElement(
|
|
343
|
+
'table',
|
|
344
|
+
{ className: prefixCls + '-table', cellSpacing: '0', role: 'grid' },
|
|
345
|
+
React__default.createElement(
|
|
346
|
+
'tbody',
|
|
347
|
+
{ className: prefixCls + '-tbody' },
|
|
348
|
+
yeasEls
|
|
349
|
+
)
|
|
350
|
+
)
|
|
351
|
+
),
|
|
352
|
+
footer && React__default.createElement(
|
|
353
|
+
'div',
|
|
354
|
+
{ className: prefixCls + '-footer' },
|
|
355
|
+
footer
|
|
356
|
+
)
|
|
357
|
+
)
|
|
358
|
+
);
|
|
359
|
+
};
|
|
360
|
+
|
|
361
|
+
return YearPanel;
|
|
362
|
+
}(React__default.Component);
|
|
363
|
+
|
|
364
|
+
|
|
365
|
+
YearPanel.propTypes = {
|
|
366
|
+
rootPrefixCls: PropTypes.string,
|
|
367
|
+
value: PropTypes.object,
|
|
368
|
+
defaultValue: PropTypes.object,
|
|
369
|
+
renderFooter: PropTypes.func
|
|
370
|
+
};
|
|
371
|
+
|
|
372
|
+
YearPanel.defaultProps = {
|
|
373
|
+
onSelect: function onSelect() {}
|
|
374
|
+
};
|
|
375
|
+
|
|
376
|
+
var ROW = 4;
|
|
377
|
+
var COL = 3;
|
|
378
|
+
|
|
379
|
+
function goYear$1(direction) {
|
|
380
|
+
var next = this.state.value.clone();
|
|
381
|
+
next.add(direction, 'years');
|
|
382
|
+
this.setState({
|
|
383
|
+
value: next
|
|
384
|
+
});
|
|
385
|
+
}
|
|
386
|
+
|
|
387
|
+
function chooseDecade(year, event) {
|
|
388
|
+
var next = this.state.value.clone();
|
|
389
|
+
next.year(year);
|
|
390
|
+
next.month(this.state.value.month());
|
|
391
|
+
this.props.onSelect(next);
|
|
392
|
+
event.preventDefault();
|
|
393
|
+
}
|
|
394
|
+
|
|
395
|
+
var DecadePanel = function (_React$Component) {
|
|
396
|
+
_inherits$4(DecadePanel, _React$Component);
|
|
397
|
+
|
|
398
|
+
function DecadePanel(props) {
|
|
399
|
+
_classCallCheck$4(this, DecadePanel);
|
|
400
|
+
|
|
401
|
+
var _this = _possibleConstructorReturn$4(this, _React$Component.call(this, props));
|
|
402
|
+
|
|
403
|
+
_this.state = {
|
|
404
|
+
value: props.value || props.defaultValue
|
|
405
|
+
};
|
|
406
|
+
|
|
407
|
+
// bind methods
|
|
408
|
+
_this.prefixCls = props.rootPrefixCls + '-decade-panel';
|
|
409
|
+
_this.nextCentury = goYear$1.bind(_this, 100);
|
|
410
|
+
_this.previousCentury = goYear$1.bind(_this, -100);
|
|
411
|
+
return _this;
|
|
412
|
+
}
|
|
413
|
+
|
|
414
|
+
DecadePanel.prototype.render = function render() {
|
|
415
|
+
var _this2 = this;
|
|
416
|
+
|
|
417
|
+
var value = this.state.value;
|
|
418
|
+
var _props = this.props,
|
|
419
|
+
locale = _props.locale,
|
|
420
|
+
renderFooter = _props.renderFooter;
|
|
421
|
+
|
|
422
|
+
var currentYear = value.year();
|
|
423
|
+
var startYear = parseInt(currentYear / 100, 10) * 100;
|
|
424
|
+
var preYear = startYear - 10;
|
|
425
|
+
var endYear = startYear + 99;
|
|
426
|
+
var decades = [];
|
|
427
|
+
var index = 0;
|
|
428
|
+
var prefixCls = this.prefixCls;
|
|
429
|
+
|
|
430
|
+
for (var rowIndex = 0; rowIndex < ROW; rowIndex++) {
|
|
431
|
+
decades[rowIndex] = [];
|
|
432
|
+
for (var colIndex = 0; colIndex < COL; colIndex++) {
|
|
433
|
+
var startDecade = preYear + index * 10;
|
|
434
|
+
var endDecade = preYear + index * 10 + 9;
|
|
435
|
+
decades[rowIndex][colIndex] = {
|
|
436
|
+
startDecade: startDecade,
|
|
437
|
+
endDecade: endDecade
|
|
438
|
+
};
|
|
439
|
+
index++;
|
|
440
|
+
}
|
|
441
|
+
}
|
|
442
|
+
|
|
443
|
+
var footer = renderFooter && renderFooter('decade');
|
|
444
|
+
|
|
445
|
+
var decadesEls = decades.map(function (row, decadeIndex) {
|
|
446
|
+
var tds = row.map(function (decadeData) {
|
|
447
|
+
var _classNameMap;
|
|
448
|
+
|
|
449
|
+
var dStartDecade = decadeData.startDecade;
|
|
450
|
+
var dEndDecade = decadeData.endDecade;
|
|
451
|
+
var isLast = dStartDecade < startYear;
|
|
452
|
+
var isNext = dEndDecade > endYear;
|
|
453
|
+
var classNameMap = (_classNameMap = {}, _classNameMap[prefixCls + '-cell'] = 1, _classNameMap[prefixCls + '-selected-cell'] = dStartDecade <= currentYear && currentYear <= dEndDecade, _classNameMap[prefixCls + '-last-century-cell'] = isLast, _classNameMap[prefixCls + '-next-century-cell'] = isNext, _classNameMap);
|
|
454
|
+
var content = dStartDecade + '-' + dEndDecade;
|
|
455
|
+
var clickHandler = void 0;
|
|
456
|
+
if (isLast) {
|
|
457
|
+
clickHandler = _this2.previousCentury;
|
|
458
|
+
} else if (isNext) {
|
|
459
|
+
clickHandler = _this2.nextCentury;
|
|
460
|
+
} else {
|
|
461
|
+
clickHandler = chooseDecade.bind(_this2, dStartDecade);
|
|
462
|
+
}
|
|
463
|
+
return React__default.createElement(
|
|
464
|
+
'td',
|
|
465
|
+
{
|
|
466
|
+
key: dStartDecade,
|
|
467
|
+
onClick: clickHandler,
|
|
468
|
+
role: 'gridcell',
|
|
469
|
+
className: classNames(classNameMap)
|
|
470
|
+
},
|
|
471
|
+
React__default.createElement(
|
|
472
|
+
'a',
|
|
473
|
+
{
|
|
474
|
+
className: prefixCls + '-decade'
|
|
475
|
+
},
|
|
476
|
+
content
|
|
477
|
+
)
|
|
478
|
+
);
|
|
479
|
+
});
|
|
480
|
+
return React__default.createElement(
|
|
481
|
+
'tr',
|
|
482
|
+
{ key: decadeIndex, role: 'row' },
|
|
483
|
+
tds
|
|
484
|
+
);
|
|
485
|
+
});
|
|
486
|
+
|
|
487
|
+
return React__default.createElement(
|
|
488
|
+
'div',
|
|
489
|
+
{ className: this.prefixCls },
|
|
490
|
+
React__default.createElement(
|
|
491
|
+
'div',
|
|
492
|
+
{ className: prefixCls + '-header' },
|
|
493
|
+
React__default.createElement('a', {
|
|
494
|
+
className: prefixCls + '-prev-century-btn',
|
|
495
|
+
role: 'button',
|
|
496
|
+
onClick: this.previousCentury,
|
|
497
|
+
title: locale.previousCentury
|
|
498
|
+
}),
|
|
499
|
+
React__default.createElement(
|
|
500
|
+
'div',
|
|
501
|
+
{ className: prefixCls + '-century' },
|
|
502
|
+
startYear,
|
|
503
|
+
'-',
|
|
504
|
+
endYear
|
|
505
|
+
),
|
|
506
|
+
React__default.createElement('a', {
|
|
507
|
+
className: prefixCls + '-next-century-btn',
|
|
508
|
+
role: 'button',
|
|
509
|
+
onClick: this.nextCentury,
|
|
510
|
+
title: locale.nextCentury
|
|
511
|
+
})
|
|
512
|
+
),
|
|
513
|
+
React__default.createElement(
|
|
514
|
+
'div',
|
|
515
|
+
{ className: prefixCls + '-body' },
|
|
516
|
+
React__default.createElement(
|
|
517
|
+
'table',
|
|
518
|
+
{ className: prefixCls + '-table', cellSpacing: '0', role: 'grid' },
|
|
519
|
+
React__default.createElement(
|
|
520
|
+
'tbody',
|
|
521
|
+
{ className: prefixCls + '-tbody' },
|
|
522
|
+
decadesEls
|
|
523
|
+
)
|
|
524
|
+
)
|
|
525
|
+
),
|
|
526
|
+
footer && React__default.createElement(
|
|
527
|
+
'div',
|
|
528
|
+
{ className: prefixCls + '-footer' },
|
|
529
|
+
footer
|
|
530
|
+
)
|
|
531
|
+
);
|
|
532
|
+
};
|
|
533
|
+
|
|
534
|
+
return DecadePanel;
|
|
535
|
+
}(React__default.Component);
|
|
536
|
+
|
|
537
|
+
|
|
538
|
+
DecadePanel.propTypes = {
|
|
539
|
+
locale: PropTypes.object,
|
|
540
|
+
value: PropTypes.object,
|
|
541
|
+
defaultValue: PropTypes.object,
|
|
542
|
+
rootPrefixCls: PropTypes.string,
|
|
543
|
+
renderFooter: PropTypes.func
|
|
544
|
+
};
|
|
545
|
+
|
|
546
|
+
DecadePanel.defaultProps = {
|
|
547
|
+
onSelect: function onSelect() {}
|
|
548
|
+
};
|
|
549
|
+
|
|
550
|
+
function goMonth(direction) {
|
|
551
|
+
var next = this.props.value.clone();
|
|
552
|
+
next.add(direction, 'months');
|
|
553
|
+
this.props.onValueChange(next);
|
|
554
|
+
}
|
|
555
|
+
|
|
556
|
+
function goYear(direction) {
|
|
557
|
+
var next = this.props.value.clone();
|
|
558
|
+
next.add(direction, 'years');
|
|
559
|
+
this.props.onValueChange(next);
|
|
560
|
+
}
|
|
561
|
+
|
|
562
|
+
function showIf(condition, el) {
|
|
563
|
+
return condition ? el : null;
|
|
564
|
+
}
|
|
565
|
+
|
|
566
|
+
var CalendarHeader = function (_React$Component) {
|
|
567
|
+
_inherits$4(CalendarHeader, _React$Component);
|
|
568
|
+
|
|
569
|
+
function CalendarHeader(props) {
|
|
570
|
+
_classCallCheck$4(this, CalendarHeader);
|
|
571
|
+
|
|
572
|
+
var _this = _possibleConstructorReturn$4(this, _React$Component.call(this, props));
|
|
573
|
+
|
|
574
|
+
_initialiseProps$4.call(_this);
|
|
575
|
+
|
|
576
|
+
_this.nextMonth = goMonth.bind(_this, 1);
|
|
577
|
+
_this.previousMonth = goMonth.bind(_this, -1);
|
|
578
|
+
_this.nextYear = goYear.bind(_this, 1);
|
|
579
|
+
_this.previousYear = goYear.bind(_this, -1);
|
|
580
|
+
|
|
581
|
+
_this.state = { yearPanelReferer: null };
|
|
582
|
+
return _this;
|
|
583
|
+
}
|
|
584
|
+
|
|
585
|
+
CalendarHeader.prototype.render = function render() {
|
|
586
|
+
var _this2 = this;
|
|
587
|
+
|
|
588
|
+
var props = this.props;
|
|
589
|
+
var prefixCls = props.prefixCls,
|
|
590
|
+
locale = props.locale,
|
|
591
|
+
mode = props.mode,
|
|
592
|
+
value = props.value,
|
|
593
|
+
showTimePicker = props.showTimePicker,
|
|
594
|
+
enableNext = props.enableNext,
|
|
595
|
+
enablePrev = props.enablePrev,
|
|
596
|
+
disabledMonth = props.disabledMonth,
|
|
597
|
+
renderFooter = props.renderFooter;
|
|
598
|
+
|
|
599
|
+
|
|
600
|
+
var panel = null;
|
|
601
|
+
if (mode === 'month') {
|
|
602
|
+
panel = React__default.createElement(MonthPanel, {
|
|
603
|
+
locale: locale,
|
|
604
|
+
value: value,
|
|
605
|
+
rootPrefixCls: prefixCls,
|
|
606
|
+
onSelect: this.onMonthSelect,
|
|
607
|
+
onYearPanelShow: function onYearPanelShow() {
|
|
608
|
+
return _this2.showYearPanel('month');
|
|
609
|
+
},
|
|
610
|
+
disabledDate: disabledMonth,
|
|
611
|
+
cellRender: props.monthCellRender,
|
|
612
|
+
contentRender: props.monthCellContentRender,
|
|
613
|
+
renderFooter: renderFooter,
|
|
614
|
+
changeYear: this.changeYear
|
|
615
|
+
});
|
|
616
|
+
}
|
|
617
|
+
if (mode === 'year') {
|
|
618
|
+
panel = React__default.createElement(YearPanel, {
|
|
619
|
+
locale: locale,
|
|
620
|
+
defaultValue: value,
|
|
621
|
+
rootPrefixCls: prefixCls,
|
|
622
|
+
onSelect: this.onYearSelect,
|
|
623
|
+
onDecadePanelShow: this.showDecadePanel,
|
|
624
|
+
renderFooter: renderFooter
|
|
625
|
+
});
|
|
626
|
+
}
|
|
627
|
+
if (mode === 'decade') {
|
|
628
|
+
panel = React__default.createElement(DecadePanel, {
|
|
629
|
+
locale: locale,
|
|
630
|
+
defaultValue: value,
|
|
631
|
+
rootPrefixCls: prefixCls,
|
|
632
|
+
onSelect: this.onDecadeSelect,
|
|
633
|
+
renderFooter: renderFooter
|
|
634
|
+
});
|
|
635
|
+
}
|
|
636
|
+
|
|
637
|
+
return React__default.createElement(
|
|
638
|
+
'div',
|
|
639
|
+
{ className: prefixCls + '-header' },
|
|
640
|
+
React__default.createElement(
|
|
641
|
+
'div',
|
|
642
|
+
{ style: { position: 'relative' } },
|
|
643
|
+
showIf(enablePrev && !showTimePicker, React__default.createElement('a', {
|
|
644
|
+
className: prefixCls + '-prev-year-btn',
|
|
645
|
+
role: 'button',
|
|
646
|
+
onClick: this.previousYear,
|
|
647
|
+
title: locale.previousYear
|
|
648
|
+
})),
|
|
649
|
+
showIf(enablePrev && !showTimePicker, React__default.createElement('a', {
|
|
650
|
+
className: prefixCls + '-prev-month-btn',
|
|
651
|
+
role: 'button',
|
|
652
|
+
onClick: this.previousMonth,
|
|
653
|
+
title: locale.previousMonth
|
|
654
|
+
})),
|
|
655
|
+
this.monthYearElement(showTimePicker),
|
|
656
|
+
showIf(enableNext && !showTimePicker, React__default.createElement('a', {
|
|
657
|
+
className: prefixCls + '-next-month-btn',
|
|
658
|
+
onClick: this.nextMonth,
|
|
659
|
+
title: locale.nextMonth
|
|
660
|
+
})),
|
|
661
|
+
showIf(enableNext && !showTimePicker, React__default.createElement('a', {
|
|
662
|
+
className: prefixCls + '-next-year-btn',
|
|
663
|
+
onClick: this.nextYear,
|
|
664
|
+
title: locale.nextYear
|
|
665
|
+
}))
|
|
666
|
+
),
|
|
667
|
+
panel
|
|
668
|
+
);
|
|
669
|
+
};
|
|
670
|
+
|
|
671
|
+
return CalendarHeader;
|
|
672
|
+
}(React__default.Component);
|
|
673
|
+
|
|
674
|
+
CalendarHeader.propTypes = {
|
|
675
|
+
prefixCls: PropTypes.string,
|
|
676
|
+
value: PropTypes.object,
|
|
677
|
+
onValueChange: PropTypes.func,
|
|
678
|
+
showTimePicker: PropTypes.bool,
|
|
679
|
+
onPanelChange: PropTypes.func,
|
|
680
|
+
locale: PropTypes.object,
|
|
681
|
+
enablePrev: PropTypes.any,
|
|
682
|
+
enableNext: PropTypes.any,
|
|
683
|
+
disabledMonth: PropTypes.func,
|
|
684
|
+
renderFooter: PropTypes.func,
|
|
685
|
+
onMonthSelect: PropTypes.func
|
|
686
|
+
};
|
|
687
|
+
CalendarHeader.defaultProps = {
|
|
688
|
+
enableNext: 1,
|
|
689
|
+
enablePrev: 1,
|
|
690
|
+
onPanelChange: function onPanelChange() {},
|
|
691
|
+
onValueChange: function onValueChange() {}
|
|
692
|
+
};
|
|
693
|
+
|
|
694
|
+
var _initialiseProps$4 = function _initialiseProps() {
|
|
695
|
+
var _this3 = this;
|
|
696
|
+
|
|
697
|
+
this.onMonthSelect = function (value) {
|
|
698
|
+
_this3.props.onPanelChange(value, 'date');
|
|
699
|
+
if (_this3.props.onMonthSelect) {
|
|
700
|
+
_this3.props.onMonthSelect(value);
|
|
701
|
+
} else {
|
|
702
|
+
_this3.props.onValueChange(value);
|
|
703
|
+
}
|
|
704
|
+
};
|
|
705
|
+
|
|
706
|
+
this.onYearSelect = function (value) {
|
|
707
|
+
var referer = _this3.state.yearPanelReferer;
|
|
708
|
+
_this3.setState({ yearPanelReferer: null });
|
|
709
|
+
_this3.props.onPanelChange(value, referer);
|
|
710
|
+
_this3.props.onValueChange(value);
|
|
711
|
+
};
|
|
712
|
+
|
|
713
|
+
this.onDecadeSelect = function (value) {
|
|
714
|
+
_this3.props.onPanelChange(value, 'year');
|
|
715
|
+
_this3.props.onValueChange(value);
|
|
716
|
+
};
|
|
717
|
+
|
|
718
|
+
this.changeYear = function (direction) {
|
|
719
|
+
if (direction > 0) {
|
|
720
|
+
_this3.nextYear();
|
|
721
|
+
} else {
|
|
722
|
+
_this3.previousYear();
|
|
723
|
+
}
|
|
724
|
+
};
|
|
725
|
+
|
|
726
|
+
this.monthYearElement = function (showTimePicker) {
|
|
727
|
+
var props = _this3.props;
|
|
728
|
+
var prefixCls = props.prefixCls;
|
|
729
|
+
var locale = props.locale;
|
|
730
|
+
var value = props.value;
|
|
731
|
+
var localeData = value.localeData();
|
|
732
|
+
var monthBeforeYear = locale.monthBeforeYear;
|
|
733
|
+
var selectClassName = prefixCls + '-' + (monthBeforeYear ? 'my-select' : 'ym-select');
|
|
734
|
+
var timeClassName = showTimePicker ? ' ' + prefixCls + '-time-status' : '';
|
|
735
|
+
var year = React__default.createElement(
|
|
736
|
+
'a',
|
|
737
|
+
{
|
|
738
|
+
className: prefixCls + '-year-select' + timeClassName,
|
|
739
|
+
role: 'button',
|
|
740
|
+
onClick: showTimePicker ? null : function () {
|
|
741
|
+
return _this3.showYearPanel('date');
|
|
742
|
+
},
|
|
743
|
+
title: showTimePicker ? null : locale.yearSelect
|
|
744
|
+
},
|
|
745
|
+
value.format(locale.yearFormat)
|
|
746
|
+
);
|
|
747
|
+
var month = React__default.createElement(
|
|
748
|
+
'a',
|
|
749
|
+
{
|
|
750
|
+
className: prefixCls + '-month-select' + timeClassName,
|
|
751
|
+
role: 'button',
|
|
752
|
+
onClick: showTimePicker ? null : _this3.showMonthPanel,
|
|
753
|
+
title: showTimePicker ? null : locale.monthSelect
|
|
754
|
+
},
|
|
755
|
+
locale.monthFormat ? value.format(locale.monthFormat) : localeData.monthsShort(value)
|
|
756
|
+
);
|
|
757
|
+
var day = void 0;
|
|
758
|
+
if (showTimePicker) {
|
|
759
|
+
day = React__default.createElement(
|
|
760
|
+
'a',
|
|
761
|
+
{
|
|
762
|
+
className: prefixCls + '-day-select' + timeClassName,
|
|
763
|
+
role: 'button'
|
|
764
|
+
},
|
|
765
|
+
value.format(locale.dayFormat)
|
|
766
|
+
);
|
|
767
|
+
}
|
|
768
|
+
var my = [];
|
|
769
|
+
if (monthBeforeYear) {
|
|
770
|
+
my = [month, day, year];
|
|
771
|
+
} else {
|
|
772
|
+
my = [year, month, day];
|
|
773
|
+
}
|
|
774
|
+
return React__default.createElement(
|
|
775
|
+
'span',
|
|
776
|
+
{ className: selectClassName },
|
|
777
|
+
mapSelf(my)
|
|
778
|
+
);
|
|
779
|
+
};
|
|
780
|
+
|
|
781
|
+
this.showMonthPanel = function () {
|
|
782
|
+
// null means that users' interaction doesn't change value
|
|
783
|
+
_this3.props.onPanelChange(null, 'month');
|
|
784
|
+
};
|
|
785
|
+
|
|
786
|
+
this.showYearPanel = function (referer) {
|
|
787
|
+
_this3.setState({ yearPanelReferer: referer });
|
|
788
|
+
_this3.props.onPanelChange(null, 'year');
|
|
789
|
+
};
|
|
790
|
+
|
|
791
|
+
this.showDecadePanel = function () {
|
|
792
|
+
_this3.props.onPanelChange(null, 'decade');
|
|
793
|
+
};
|
|
794
|
+
};
|
|
795
|
+
|
|
796
|
+
function TodayButton(_ref) {
|
|
797
|
+
var prefixCls = _ref.prefixCls,
|
|
798
|
+
locale = _ref.locale,
|
|
799
|
+
value = _ref.value,
|
|
800
|
+
timePicker = _ref.timePicker,
|
|
801
|
+
disabled = _ref.disabled,
|
|
802
|
+
disabledDate = _ref.disabledDate,
|
|
803
|
+
onToday = _ref.onToday,
|
|
804
|
+
text = _ref.text;
|
|
805
|
+
|
|
806
|
+
var localeNow = (!text && timePicker ? locale.now : text) || locale.today;
|
|
807
|
+
var disabledToday = disabledDate && !isAllowedDate(getTodayTime(value), disabledDate);
|
|
808
|
+
var isDisabled = disabledToday || disabled;
|
|
809
|
+
var disabledTodayClass = isDisabled ? prefixCls + '-today-btn-disabled' : '';
|
|
810
|
+
return React__default.createElement(
|
|
811
|
+
'a',
|
|
812
|
+
{
|
|
813
|
+
className: prefixCls + '-today-btn ' + disabledTodayClass,
|
|
814
|
+
role: 'button',
|
|
815
|
+
onClick: isDisabled ? null : onToday,
|
|
816
|
+
title: getTodayTimeStr(value)
|
|
817
|
+
},
|
|
818
|
+
localeNow
|
|
819
|
+
);
|
|
820
|
+
}
|
|
821
|
+
|
|
822
|
+
function OkButton(_ref) {
|
|
823
|
+
var prefixCls = _ref.prefixCls,
|
|
824
|
+
locale = _ref.locale,
|
|
825
|
+
okDisabled = _ref.okDisabled,
|
|
826
|
+
onOk = _ref.onOk;
|
|
827
|
+
|
|
828
|
+
var className = prefixCls + "-ok-btn";
|
|
829
|
+
if (okDisabled) {
|
|
830
|
+
className += " " + prefixCls + "-ok-btn-disabled";
|
|
831
|
+
}
|
|
832
|
+
return React__default.createElement(
|
|
833
|
+
"a",
|
|
834
|
+
{
|
|
835
|
+
className: className,
|
|
836
|
+
role: "button",
|
|
837
|
+
onClick: okDisabled ? null : onOk
|
|
838
|
+
},
|
|
839
|
+
locale.ok
|
|
840
|
+
);
|
|
841
|
+
}
|
|
842
|
+
|
|
843
|
+
function TimePickerButton(_ref) {
|
|
844
|
+
var _classnames;
|
|
845
|
+
|
|
846
|
+
var prefixCls = _ref.prefixCls,
|
|
847
|
+
locale = _ref.locale,
|
|
848
|
+
showTimePicker = _ref.showTimePicker,
|
|
849
|
+
onOpenTimePicker = _ref.onOpenTimePicker,
|
|
850
|
+
onCloseTimePicker = _ref.onCloseTimePicker,
|
|
851
|
+
timePickerDisabled = _ref.timePickerDisabled;
|
|
852
|
+
|
|
853
|
+
var className = classNames((_classnames = {}, _classnames[prefixCls + '-time-picker-btn'] = true, _classnames[prefixCls + '-time-picker-btn-disabled'] = timePickerDisabled, _classnames));
|
|
854
|
+
var onClick = null;
|
|
855
|
+
if (!timePickerDisabled) {
|
|
856
|
+
onClick = showTimePicker ? onCloseTimePicker : onOpenTimePicker;
|
|
857
|
+
}
|
|
858
|
+
return React__default.createElement(
|
|
859
|
+
'a',
|
|
860
|
+
{
|
|
861
|
+
className: className,
|
|
862
|
+
role: 'button',
|
|
863
|
+
onClick: onClick
|
|
864
|
+
},
|
|
865
|
+
showTimePicker ? locale.dateSelect : locale.timeSelect
|
|
866
|
+
);
|
|
867
|
+
}
|
|
868
|
+
|
|
869
|
+
var CalendarFooter = function (_React$Component) {
|
|
870
|
+
_inherits$4(CalendarFooter, _React$Component);
|
|
871
|
+
|
|
872
|
+
function CalendarFooter() {
|
|
873
|
+
_classCallCheck$4(this, CalendarFooter);
|
|
874
|
+
|
|
875
|
+
return _possibleConstructorReturn$4(this, _React$Component.apply(this, arguments));
|
|
876
|
+
}
|
|
877
|
+
|
|
878
|
+
CalendarFooter.prototype.onSelect = function onSelect(value) {
|
|
879
|
+
this.props.onSelect(value);
|
|
880
|
+
};
|
|
881
|
+
|
|
882
|
+
CalendarFooter.prototype.getRootDOMNode = function getRootDOMNode() {
|
|
883
|
+
return ReactDOM__default.findDOMNode(this);
|
|
884
|
+
};
|
|
885
|
+
|
|
886
|
+
CalendarFooter.prototype.render = function render() {
|
|
887
|
+
var props = this.props;
|
|
888
|
+
var value = props.value,
|
|
889
|
+
prefixCls = props.prefixCls,
|
|
890
|
+
showOk = props.showOk,
|
|
891
|
+
timePicker = props.timePicker,
|
|
892
|
+
renderFooter = props.renderFooter,
|
|
893
|
+
mode = props.mode;
|
|
894
|
+
|
|
895
|
+
var footerEl = null;
|
|
896
|
+
var extraFooter = renderFooter && renderFooter(mode);
|
|
897
|
+
if (props.showToday || timePicker || extraFooter) {
|
|
898
|
+
var _cx;
|
|
899
|
+
|
|
900
|
+
var nowEl = void 0;
|
|
901
|
+
if (props.showToday) {
|
|
902
|
+
nowEl = React__default.createElement(TodayButton, _extends$5({}, props, { value: value }));
|
|
903
|
+
}
|
|
904
|
+
var okBtn = void 0;
|
|
905
|
+
if (showOk === true || showOk !== false && !!props.timePicker) {
|
|
906
|
+
okBtn = React__default.createElement(OkButton, props);
|
|
907
|
+
}
|
|
908
|
+
var timePickerBtn = void 0;
|
|
909
|
+
if (!!props.timePicker) {
|
|
910
|
+
timePickerBtn = React__default.createElement(TimePickerButton, props);
|
|
911
|
+
}
|
|
912
|
+
|
|
913
|
+
var footerBtn = void 0;
|
|
914
|
+
if (nowEl || timePickerBtn || okBtn || extraFooter) {
|
|
915
|
+
footerBtn = React__default.createElement(
|
|
916
|
+
'span',
|
|
917
|
+
{ className: prefixCls + '-footer-btn' },
|
|
918
|
+
extraFooter,
|
|
919
|
+
mapSelf([nowEl, timePickerBtn, okBtn])
|
|
920
|
+
);
|
|
921
|
+
}
|
|
922
|
+
var cls = classNames(prefixCls + '-footer', (_cx = {}, _cx[prefixCls + '-footer-show-ok'] = okBtn, _cx));
|
|
923
|
+
footerEl = React__default.createElement(
|
|
924
|
+
'div',
|
|
925
|
+
{ className: cls },
|
|
926
|
+
footerBtn
|
|
927
|
+
);
|
|
928
|
+
}
|
|
929
|
+
return footerEl;
|
|
930
|
+
};
|
|
931
|
+
|
|
932
|
+
return CalendarFooter;
|
|
933
|
+
}(React__default.Component);
|
|
934
|
+
|
|
935
|
+
CalendarFooter.propTypes = {
|
|
936
|
+
prefixCls: PropTypes.string,
|
|
937
|
+
showDateInput: PropTypes.bool,
|
|
938
|
+
disabledTime: PropTypes.any,
|
|
939
|
+
timePicker: PropTypes.element,
|
|
940
|
+
selectedValue: PropTypes.any,
|
|
941
|
+
showOk: PropTypes.bool,
|
|
942
|
+
onSelect: PropTypes.func,
|
|
943
|
+
value: PropTypes.object,
|
|
944
|
+
renderFooter: PropTypes.func,
|
|
945
|
+
defaultValue: PropTypes.object,
|
|
946
|
+
mode: PropTypes.string
|
|
947
|
+
};
|
|
948
|
+
|
|
949
|
+
var cachedSelectionStart = void 0;
|
|
950
|
+
var cachedSelectionEnd = void 0;
|
|
951
|
+
var dateInputInstance = void 0;
|
|
952
|
+
|
|
953
|
+
var DateInput = function (_React$Component) {
|
|
954
|
+
_inherits$4(DateInput, _React$Component);
|
|
955
|
+
|
|
956
|
+
function DateInput(props) {
|
|
957
|
+
_classCallCheck$4(this, DateInput);
|
|
958
|
+
|
|
959
|
+
var _this = _possibleConstructorReturn$4(this, _React$Component.call(this, props));
|
|
960
|
+
|
|
961
|
+
_initialiseProps$3.call(_this);
|
|
962
|
+
|
|
963
|
+
var selectedValue = props.selectedValue;
|
|
964
|
+
|
|
965
|
+
_this.state = {
|
|
966
|
+
str: formatDate$1(selectedValue, _this.props.format),
|
|
967
|
+
invalid: false,
|
|
968
|
+
hasFocus: false
|
|
969
|
+
};
|
|
970
|
+
return _this;
|
|
971
|
+
}
|
|
972
|
+
|
|
973
|
+
DateInput.prototype.componentDidUpdate = function componentDidUpdate() {
|
|
974
|
+
if (dateInputInstance && this.state.hasFocus && !this.state.invalid && !(cachedSelectionStart === 0 && cachedSelectionEnd === 0)) {
|
|
975
|
+
dateInputInstance.setSelectionRange(cachedSelectionStart, cachedSelectionEnd);
|
|
976
|
+
}
|
|
977
|
+
};
|
|
978
|
+
|
|
979
|
+
DateInput.getDerivedStateFromProps = function getDerivedStateFromProps(nextProps, state) {
|
|
980
|
+
var newState = {};
|
|
981
|
+
|
|
982
|
+
if (dateInputInstance) {
|
|
983
|
+
cachedSelectionStart = dateInputInstance.selectionStart;
|
|
984
|
+
cachedSelectionEnd = dateInputInstance.selectionEnd;
|
|
985
|
+
}
|
|
986
|
+
// when popup show, click body will call this, bug!
|
|
987
|
+
var selectedValue = nextProps.selectedValue;
|
|
988
|
+
if (!state.hasFocus) {
|
|
989
|
+
newState = {
|
|
990
|
+
str: formatDate$1(selectedValue, nextProps.format),
|
|
991
|
+
invalid: false
|
|
992
|
+
};
|
|
993
|
+
}
|
|
994
|
+
|
|
995
|
+
return newState;
|
|
996
|
+
};
|
|
997
|
+
|
|
998
|
+
DateInput.getInstance = function getInstance() {
|
|
999
|
+
return dateInputInstance;
|
|
1000
|
+
};
|
|
1001
|
+
|
|
1002
|
+
DateInput.prototype.render = function render() {
|
|
1003
|
+
var props = this.props;
|
|
1004
|
+
var _state = this.state,
|
|
1005
|
+
invalid = _state.invalid,
|
|
1006
|
+
str = _state.str;
|
|
1007
|
+
var locale = props.locale,
|
|
1008
|
+
prefixCls = props.prefixCls,
|
|
1009
|
+
placeholder = props.placeholder,
|
|
1010
|
+
clearIcon = props.clearIcon,
|
|
1011
|
+
inputMode = props.inputMode;
|
|
1012
|
+
|
|
1013
|
+
var invalidClass = invalid ? prefixCls + '-input-invalid' : '';
|
|
1014
|
+
return React__default.createElement(
|
|
1015
|
+
'div',
|
|
1016
|
+
{ className: prefixCls + '-input-wrap' },
|
|
1017
|
+
React__default.createElement(
|
|
1018
|
+
'div',
|
|
1019
|
+
{ className: prefixCls + '-date-input-wrap' },
|
|
1020
|
+
React__default.createElement('input', {
|
|
1021
|
+
ref: this.saveDateInput,
|
|
1022
|
+
className: prefixCls + '-input ' + invalidClass,
|
|
1023
|
+
value: str,
|
|
1024
|
+
disabled: props.disabled,
|
|
1025
|
+
placeholder: placeholder,
|
|
1026
|
+
onChange: this.onInputChange,
|
|
1027
|
+
onKeyDown: this.onKeyDown,
|
|
1028
|
+
onFocus: this.onFocus,
|
|
1029
|
+
onBlur: this.onBlur,
|
|
1030
|
+
inputMode: inputMode
|
|
1031
|
+
})
|
|
1032
|
+
),
|
|
1033
|
+
props.showClear ? React__default.createElement(
|
|
1034
|
+
'a',
|
|
1035
|
+
{
|
|
1036
|
+
role: 'button',
|
|
1037
|
+
title: locale.clear,
|
|
1038
|
+
onClick: this.onClear
|
|
1039
|
+
},
|
|
1040
|
+
clearIcon || React__default.createElement('span', { className: prefixCls + '-clear-btn' })
|
|
1041
|
+
) : null
|
|
1042
|
+
);
|
|
1043
|
+
};
|
|
1044
|
+
|
|
1045
|
+
return DateInput;
|
|
1046
|
+
}(React__default.Component);
|
|
1047
|
+
|
|
1048
|
+
DateInput.propTypes = {
|
|
1049
|
+
prefixCls: PropTypes.string,
|
|
1050
|
+
timePicker: PropTypes.object,
|
|
1051
|
+
value: PropTypes.object,
|
|
1052
|
+
disabledTime: PropTypes.any,
|
|
1053
|
+
format: PropTypes.oneOfType([PropTypes.string, PropTypes.arrayOf(PropTypes.string)]),
|
|
1054
|
+
locale: PropTypes.object,
|
|
1055
|
+
disabledDate: PropTypes.func,
|
|
1056
|
+
onChange: PropTypes.func,
|
|
1057
|
+
onClear: PropTypes.func,
|
|
1058
|
+
placeholder: PropTypes.string,
|
|
1059
|
+
onSelect: PropTypes.func,
|
|
1060
|
+
selectedValue: PropTypes.object,
|
|
1061
|
+
clearIcon: PropTypes.node,
|
|
1062
|
+
inputMode: PropTypes.string
|
|
1063
|
+
};
|
|
1064
|
+
|
|
1065
|
+
var _initialiseProps$3 = function _initialiseProps() {
|
|
1066
|
+
var _this2 = this;
|
|
1067
|
+
|
|
1068
|
+
this.onClear = function () {
|
|
1069
|
+
_this2.setState({
|
|
1070
|
+
str: ''
|
|
1071
|
+
});
|
|
1072
|
+
_this2.props.onClear(null);
|
|
1073
|
+
};
|
|
1074
|
+
|
|
1075
|
+
this.onInputChange = function (event) {
|
|
1076
|
+
var str = event.target.value;
|
|
1077
|
+
var _props = _this2.props,
|
|
1078
|
+
disabledDate = _props.disabledDate,
|
|
1079
|
+
format = _props.format,
|
|
1080
|
+
onChange = _props.onChange,
|
|
1081
|
+
selectedValue = _props.selectedValue;
|
|
1082
|
+
|
|
1083
|
+
// 没有内容,合法并直接退出
|
|
1084
|
+
|
|
1085
|
+
if (!str) {
|
|
1086
|
+
onChange(null);
|
|
1087
|
+
_this2.setState({
|
|
1088
|
+
invalid: false,
|
|
1089
|
+
str: str
|
|
1090
|
+
});
|
|
1091
|
+
return;
|
|
1092
|
+
}
|
|
1093
|
+
|
|
1094
|
+
// 不合法直接退出
|
|
1095
|
+
var parsed = moment(str, format, true);
|
|
1096
|
+
if (!parsed.isValid()) {
|
|
1097
|
+
_this2.setState({
|
|
1098
|
+
invalid: true,
|
|
1099
|
+
str: str
|
|
1100
|
+
});
|
|
1101
|
+
return;
|
|
1102
|
+
}
|
|
1103
|
+
|
|
1104
|
+
var value = _this2.props.value.clone();
|
|
1105
|
+
value.year(parsed.year()).month(parsed.month()).date(parsed.date()).hour(parsed.hour()).minute(parsed.minute()).second(parsed.second());
|
|
1106
|
+
|
|
1107
|
+
if (!value || disabledDate && disabledDate(value)) {
|
|
1108
|
+
_this2.setState({
|
|
1109
|
+
invalid: true,
|
|
1110
|
+
str: str
|
|
1111
|
+
});
|
|
1112
|
+
return;
|
|
1113
|
+
}
|
|
1114
|
+
|
|
1115
|
+
if (selectedValue !== value || selectedValue && value && !selectedValue.isSame(value)) {
|
|
1116
|
+
_this2.setState({
|
|
1117
|
+
invalid: false,
|
|
1118
|
+
str: str
|
|
1119
|
+
});
|
|
1120
|
+
onChange(value);
|
|
1121
|
+
}
|
|
1122
|
+
};
|
|
1123
|
+
|
|
1124
|
+
this.onFocus = function () {
|
|
1125
|
+
_this2.setState({ hasFocus: true });
|
|
1126
|
+
};
|
|
1127
|
+
|
|
1128
|
+
this.onBlur = function () {
|
|
1129
|
+
_this2.setState(function (prevState, prevProps) {
|
|
1130
|
+
return {
|
|
1131
|
+
hasFocus: false,
|
|
1132
|
+
str: formatDate$1(prevProps.value, prevProps.format)
|
|
1133
|
+
};
|
|
1134
|
+
});
|
|
1135
|
+
};
|
|
1136
|
+
|
|
1137
|
+
this.onKeyDown = function (event) {
|
|
1138
|
+
var keyCode = event.keyCode;
|
|
1139
|
+
var _props2 = _this2.props,
|
|
1140
|
+
onSelect = _props2.onSelect,
|
|
1141
|
+
value = _props2.value,
|
|
1142
|
+
disabledDate = _props2.disabledDate;
|
|
1143
|
+
|
|
1144
|
+
if (keyCode === KeyCode.ENTER && onSelect) {
|
|
1145
|
+
var validateDate = !disabledDate || !disabledDate(value);
|
|
1146
|
+
if (validateDate) {
|
|
1147
|
+
onSelect(value.clone());
|
|
1148
|
+
}
|
|
1149
|
+
event.preventDefault();
|
|
1150
|
+
}
|
|
1151
|
+
};
|
|
1152
|
+
|
|
1153
|
+
this.getRootDOMNode = function () {
|
|
1154
|
+
return ReactDOM__default.findDOMNode(_this2);
|
|
1155
|
+
};
|
|
1156
|
+
|
|
1157
|
+
this.focus = function () {
|
|
1158
|
+
if (dateInputInstance) {
|
|
1159
|
+
dateInputInstance.focus();
|
|
1160
|
+
}
|
|
1161
|
+
};
|
|
1162
|
+
|
|
1163
|
+
this.saveDateInput = function (dateInput) {
|
|
1164
|
+
dateInputInstance = dateInput;
|
|
1165
|
+
};
|
|
1166
|
+
};
|
|
1167
|
+
|
|
1168
|
+
polyfill(DateInput);
|
|
1169
|
+
|
|
1170
|
+
function goStartMonth(time) {
|
|
1171
|
+
return time.clone().startOf('month');
|
|
1172
|
+
}
|
|
1173
|
+
|
|
1174
|
+
function goEndMonth(time) {
|
|
1175
|
+
return time.clone().endOf('month');
|
|
1176
|
+
}
|
|
1177
|
+
|
|
1178
|
+
function goTime(time, direction, unit) {
|
|
1179
|
+
return time.clone().add(direction, unit);
|
|
1180
|
+
}
|
|
1181
|
+
|
|
1182
|
+
function includesTime() {
|
|
1183
|
+
var timeList = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : [];
|
|
1184
|
+
var time = arguments[1];
|
|
1185
|
+
var unit = arguments[2];
|
|
1186
|
+
|
|
1187
|
+
return timeList.some(function (t) {
|
|
1188
|
+
return t.isSame(time, unit);
|
|
1189
|
+
});
|
|
1190
|
+
}
|
|
1191
|
+
|
|
1192
|
+
function noop$2() {}
|
|
1193
|
+
|
|
1194
|
+
var getMomentObjectIfValid = function getMomentObjectIfValid(date) {
|
|
1195
|
+
if (moment.isMoment(date) && date.isValid()) {
|
|
1196
|
+
return date;
|
|
1197
|
+
}
|
|
1198
|
+
return false;
|
|
1199
|
+
};
|
|
1200
|
+
|
|
1201
|
+
var Calendar = function (_React$Component) {
|
|
1202
|
+
_inherits$4(Calendar, _React$Component);
|
|
1203
|
+
|
|
1204
|
+
function Calendar(props) {
|
|
1205
|
+
_classCallCheck$4(this, Calendar);
|
|
1206
|
+
|
|
1207
|
+
var _this = _possibleConstructorReturn$4(this, _React$Component.call(this, props));
|
|
1208
|
+
|
|
1209
|
+
_initialiseProps$2.call(_this);
|
|
1210
|
+
|
|
1211
|
+
_this.state = {
|
|
1212
|
+
mode: _this.props.mode || 'date',
|
|
1213
|
+
value: getMomentObjectIfValid(props.value) || getMomentObjectIfValid(props.defaultValue) || moment(),
|
|
1214
|
+
selectedValue: props.selectedValue || props.defaultSelectedValue
|
|
1215
|
+
};
|
|
1216
|
+
return _this;
|
|
1217
|
+
}
|
|
1218
|
+
|
|
1219
|
+
Calendar.prototype.componentDidMount = function componentDidMount() {
|
|
1220
|
+
if (this.props.showDateInput) {
|
|
1221
|
+
this.saveFocusElement(DateInput.getInstance());
|
|
1222
|
+
}
|
|
1223
|
+
};
|
|
1224
|
+
|
|
1225
|
+
Calendar.getDerivedStateFromProps = function getDerivedStateFromProps(nextProps, state) {
|
|
1226
|
+
var value = nextProps.value,
|
|
1227
|
+
selectedValue = nextProps.selectedValue;
|
|
1228
|
+
|
|
1229
|
+
var newState = {};
|
|
1230
|
+
|
|
1231
|
+
if ('mode' in nextProps && state.mode !== nextProps.mode) {
|
|
1232
|
+
newState = { mode: nextProps.mode };
|
|
1233
|
+
}
|
|
1234
|
+
if ('value' in nextProps) {
|
|
1235
|
+
newState.value = getMomentObjectIfValid(value) || getMomentObjectIfValid(nextProps.defaultValue) || getNowByCurrentStateValue(state.value);
|
|
1236
|
+
}
|
|
1237
|
+
if ('selectedValue' in nextProps) {
|
|
1238
|
+
newState.selectedValue = selectedValue;
|
|
1239
|
+
}
|
|
1240
|
+
|
|
1241
|
+
return newState;
|
|
1242
|
+
};
|
|
1243
|
+
|
|
1244
|
+
Calendar.prototype.render = function render() {
|
|
1245
|
+
var props = this.props,
|
|
1246
|
+
state = this.state;
|
|
1247
|
+
var locale = props.locale,
|
|
1248
|
+
prefixCls = props.prefixCls,
|
|
1249
|
+
disabledDate = props.disabledDate,
|
|
1250
|
+
dateInputPlaceholder = props.dateInputPlaceholder,
|
|
1251
|
+
timePicker = props.timePicker,
|
|
1252
|
+
disabledTime = props.disabledTime,
|
|
1253
|
+
clearIcon = props.clearIcon,
|
|
1254
|
+
renderFooter = props.renderFooter,
|
|
1255
|
+
inputMode = props.inputMode,
|
|
1256
|
+
monthCellRender = props.monthCellRender,
|
|
1257
|
+
monthCellContentRender = props.monthCellContentRender;
|
|
1258
|
+
var value = state.value,
|
|
1259
|
+
selectedValue = state.selectedValue,
|
|
1260
|
+
mode = state.mode;
|
|
1261
|
+
|
|
1262
|
+
var showTimePicker = mode === 'time';
|
|
1263
|
+
var disabledTimeConfig = showTimePicker && disabledTime && timePicker ? getTimeConfig(selectedValue, disabledTime) : null;
|
|
1264
|
+
|
|
1265
|
+
var timePickerEle = null;
|
|
1266
|
+
|
|
1267
|
+
if (timePicker && showTimePicker) {
|
|
1268
|
+
var timePickerProps = _extends$5({
|
|
1269
|
+
showHour: true,
|
|
1270
|
+
showSecond: true,
|
|
1271
|
+
showMinute: true
|
|
1272
|
+
}, timePicker.props, disabledTimeConfig, {
|
|
1273
|
+
onChange: this.onDateInputChange,
|
|
1274
|
+
value: selectedValue,
|
|
1275
|
+
disabledTime: disabledTime
|
|
1276
|
+
});
|
|
1277
|
+
|
|
1278
|
+
if (timePicker.props.defaultValue !== undefined) {
|
|
1279
|
+
timePickerProps.defaultOpenValue = timePicker.props.defaultValue;
|
|
1280
|
+
}
|
|
1281
|
+
|
|
1282
|
+
timePickerEle = React__default.cloneElement(timePicker, timePickerProps);
|
|
1283
|
+
}
|
|
1284
|
+
|
|
1285
|
+
var dateInputElement = props.showDateInput ? React__default.createElement(DateInput, {
|
|
1286
|
+
format: this.getFormat(),
|
|
1287
|
+
key: 'date-input',
|
|
1288
|
+
value: value,
|
|
1289
|
+
locale: locale,
|
|
1290
|
+
placeholder: dateInputPlaceholder,
|
|
1291
|
+
showClear: true,
|
|
1292
|
+
disabledTime: disabledTime,
|
|
1293
|
+
disabledDate: disabledDate,
|
|
1294
|
+
onClear: this.onClear,
|
|
1295
|
+
prefixCls: prefixCls,
|
|
1296
|
+
selectedValue: selectedValue,
|
|
1297
|
+
onChange: this.onDateInputChange,
|
|
1298
|
+
onSelect: this.onDateInputSelect,
|
|
1299
|
+
clearIcon: clearIcon,
|
|
1300
|
+
inputMode: inputMode
|
|
1301
|
+
}) : null;
|
|
1302
|
+
|
|
1303
|
+
var children = [];
|
|
1304
|
+
if (props.renderSidebar) {
|
|
1305
|
+
children.push(props.renderSidebar());
|
|
1306
|
+
}
|
|
1307
|
+
children.push(React__default.createElement(
|
|
1308
|
+
'div',
|
|
1309
|
+
{ className: prefixCls + '-panel', key: 'panel' },
|
|
1310
|
+
dateInputElement,
|
|
1311
|
+
React__default.createElement(
|
|
1312
|
+
'div',
|
|
1313
|
+
{
|
|
1314
|
+
tabIndex: this.props.focusablePanel ? 0 : undefined,
|
|
1315
|
+
className: prefixCls + '-date-panel'
|
|
1316
|
+
},
|
|
1317
|
+
React__default.createElement(CalendarHeader, {
|
|
1318
|
+
locale: locale,
|
|
1319
|
+
mode: mode,
|
|
1320
|
+
value: value,
|
|
1321
|
+
onValueChange: this.setValue,
|
|
1322
|
+
onPanelChange: this.onPanelChange,
|
|
1323
|
+
renderFooter: renderFooter,
|
|
1324
|
+
showTimePicker: showTimePicker,
|
|
1325
|
+
prefixCls: prefixCls,
|
|
1326
|
+
monthCellRender: monthCellRender,
|
|
1327
|
+
monthCellContentRender: monthCellContentRender
|
|
1328
|
+
}),
|
|
1329
|
+
timePicker && showTimePicker ? React__default.createElement(
|
|
1330
|
+
'div',
|
|
1331
|
+
{ className: prefixCls + '-time-picker' },
|
|
1332
|
+
React__default.createElement(
|
|
1333
|
+
'div',
|
|
1334
|
+
{ className: prefixCls + '-time-picker-panel' },
|
|
1335
|
+
timePickerEle
|
|
1336
|
+
)
|
|
1337
|
+
) : null,
|
|
1338
|
+
React__default.createElement(
|
|
1339
|
+
'div',
|
|
1340
|
+
{ className: prefixCls + '-body' },
|
|
1341
|
+
React__default.createElement(DateTable, {
|
|
1342
|
+
locale: locale,
|
|
1343
|
+
value: value,
|
|
1344
|
+
selectedValue: selectedValue,
|
|
1345
|
+
prefixCls: prefixCls,
|
|
1346
|
+
dateRender: props.dateRender,
|
|
1347
|
+
onSelect: this.onDateTableSelect,
|
|
1348
|
+
disabledDate: disabledDate,
|
|
1349
|
+
showWeekNumber: props.showWeekNumber
|
|
1350
|
+
})
|
|
1351
|
+
),
|
|
1352
|
+
React__default.createElement(CalendarFooter, {
|
|
1353
|
+
showOk: props.showOk,
|
|
1354
|
+
mode: mode,
|
|
1355
|
+
renderFooter: props.renderFooter,
|
|
1356
|
+
locale: locale,
|
|
1357
|
+
prefixCls: prefixCls,
|
|
1358
|
+
showToday: props.showToday,
|
|
1359
|
+
disabledTime: disabledTime,
|
|
1360
|
+
showTimePicker: showTimePicker,
|
|
1361
|
+
showDateInput: props.showDateInput,
|
|
1362
|
+
timePicker: timePicker,
|
|
1363
|
+
selectedValue: selectedValue,
|
|
1364
|
+
timePickerDisabled: !selectedValue,
|
|
1365
|
+
value: value,
|
|
1366
|
+
disabledDate: disabledDate,
|
|
1367
|
+
okDisabled: props.showOk !== false && (!selectedValue || !this.isAllowedDate(selectedValue)),
|
|
1368
|
+
onOk: this.onOk,
|
|
1369
|
+
onSelect: this.onSelect,
|
|
1370
|
+
onToday: this.onToday,
|
|
1371
|
+
onOpenTimePicker: this.openTimePicker,
|
|
1372
|
+
onCloseTimePicker: this.closeTimePicker
|
|
1373
|
+
})
|
|
1374
|
+
)
|
|
1375
|
+
));
|
|
1376
|
+
|
|
1377
|
+
return this.renderRoot({
|
|
1378
|
+
children: children,
|
|
1379
|
+
className: props.showWeekNumber ? prefixCls + '-week-number' : ''
|
|
1380
|
+
});
|
|
1381
|
+
};
|
|
1382
|
+
|
|
1383
|
+
return Calendar;
|
|
1384
|
+
}(React__default.Component);
|
|
1385
|
+
|
|
1386
|
+
Calendar.propTypes = _extends$5({}, calendarMixinPropTypes, propType, {
|
|
1387
|
+
prefixCls: PropTypes.string,
|
|
1388
|
+
className: PropTypes.string,
|
|
1389
|
+
style: PropTypes.object,
|
|
1390
|
+
defaultValue: PropTypes.object,
|
|
1391
|
+
value: PropTypes.object,
|
|
1392
|
+
selectedValue: PropTypes.object,
|
|
1393
|
+
defaultSelectedValue: PropTypes.object,
|
|
1394
|
+
mode: PropTypes.oneOf(['time', 'date', 'month', 'year', 'decade']),
|
|
1395
|
+
locale: PropTypes.object,
|
|
1396
|
+
showDateInput: PropTypes.bool,
|
|
1397
|
+
showWeekNumber: PropTypes.bool,
|
|
1398
|
+
showToday: PropTypes.bool,
|
|
1399
|
+
showOk: PropTypes.bool,
|
|
1400
|
+
onSelect: PropTypes.func,
|
|
1401
|
+
onOk: PropTypes.func,
|
|
1402
|
+
onKeyDown: PropTypes.func,
|
|
1403
|
+
timePicker: PropTypes.element,
|
|
1404
|
+
dateInputPlaceholder: PropTypes.any,
|
|
1405
|
+
onClear: PropTypes.func,
|
|
1406
|
+
onChange: PropTypes.func,
|
|
1407
|
+
onPanelChange: PropTypes.func,
|
|
1408
|
+
disabledDate: PropTypes.func,
|
|
1409
|
+
disabledTime: PropTypes.any,
|
|
1410
|
+
dateRender: PropTypes.func,
|
|
1411
|
+
renderFooter: PropTypes.func,
|
|
1412
|
+
renderSidebar: PropTypes.func,
|
|
1413
|
+
clearIcon: PropTypes.node,
|
|
1414
|
+
focusablePanel: PropTypes.bool,
|
|
1415
|
+
inputMode: PropTypes.string,
|
|
1416
|
+
onBlur: PropTypes.func
|
|
1417
|
+
});
|
|
1418
|
+
Calendar.defaultProps = _extends$5({}, calendarMixinDefaultProps, defaultProp, {
|
|
1419
|
+
showToday: true,
|
|
1420
|
+
showDateInput: true,
|
|
1421
|
+
timePicker: null,
|
|
1422
|
+
onOk: noop$2,
|
|
1423
|
+
onPanelChange: noop$2,
|
|
1424
|
+
focusablePanel: true
|
|
1425
|
+
});
|
|
1426
|
+
|
|
1427
|
+
var _initialiseProps$2 = function _initialiseProps() {
|
|
1428
|
+
var _this2 = this;
|
|
1429
|
+
|
|
1430
|
+
this.onPanelChange = function (value, mode) {
|
|
1431
|
+
var props = _this2.props,
|
|
1432
|
+
state = _this2.state;
|
|
1433
|
+
|
|
1434
|
+
if (!('mode' in props)) {
|
|
1435
|
+
_this2.setState({ mode: mode });
|
|
1436
|
+
}
|
|
1437
|
+
props.onPanelChange(value || state.value, mode);
|
|
1438
|
+
};
|
|
1439
|
+
|
|
1440
|
+
this.onKeyDown = function (event) {
|
|
1441
|
+
if (event.target.nodeName.toLowerCase() === 'input') {
|
|
1442
|
+
return undefined;
|
|
1443
|
+
}
|
|
1444
|
+
var keyCode = event.keyCode;
|
|
1445
|
+
// mac
|
|
1446
|
+
var ctrlKey = event.ctrlKey || event.metaKey;
|
|
1447
|
+
var disabledDate = _this2.props.disabledDate;
|
|
1448
|
+
var value = _this2.state.value;
|
|
1449
|
+
|
|
1450
|
+
switch (keyCode) {
|
|
1451
|
+
case KeyCode.DOWN:
|
|
1452
|
+
_this2.goTime(1, 'weeks');
|
|
1453
|
+
event.preventDefault();
|
|
1454
|
+
return 1;
|
|
1455
|
+
case KeyCode.UP:
|
|
1456
|
+
_this2.goTime(-1, 'weeks');
|
|
1457
|
+
event.preventDefault();
|
|
1458
|
+
return 1;
|
|
1459
|
+
case KeyCode.LEFT:
|
|
1460
|
+
if (ctrlKey) {
|
|
1461
|
+
_this2.goTime(-1, 'years');
|
|
1462
|
+
} else {
|
|
1463
|
+
_this2.goTime(-1, 'days');
|
|
1464
|
+
}
|
|
1465
|
+
event.preventDefault();
|
|
1466
|
+
return 1;
|
|
1467
|
+
case KeyCode.RIGHT:
|
|
1468
|
+
if (ctrlKey) {
|
|
1469
|
+
_this2.goTime(1, 'years');
|
|
1470
|
+
} else {
|
|
1471
|
+
_this2.goTime(1, 'days');
|
|
1472
|
+
}
|
|
1473
|
+
event.preventDefault();
|
|
1474
|
+
return 1;
|
|
1475
|
+
case KeyCode.HOME:
|
|
1476
|
+
_this2.setValue(goStartMonth(_this2.state.value));
|
|
1477
|
+
event.preventDefault();
|
|
1478
|
+
return 1;
|
|
1479
|
+
case KeyCode.END:
|
|
1480
|
+
_this2.setValue(goEndMonth(_this2.state.value));
|
|
1481
|
+
event.preventDefault();
|
|
1482
|
+
return 1;
|
|
1483
|
+
case KeyCode.PAGE_DOWN:
|
|
1484
|
+
_this2.goTime(1, 'month');
|
|
1485
|
+
event.preventDefault();
|
|
1486
|
+
return 1;
|
|
1487
|
+
case KeyCode.PAGE_UP:
|
|
1488
|
+
_this2.goTime(-1, 'month');
|
|
1489
|
+
event.preventDefault();
|
|
1490
|
+
return 1;
|
|
1491
|
+
case KeyCode.ENTER:
|
|
1492
|
+
if (!disabledDate || !disabledDate(value)) {
|
|
1493
|
+
_this2.onSelect(value, {
|
|
1494
|
+
source: 'keyboard'
|
|
1495
|
+
});
|
|
1496
|
+
}
|
|
1497
|
+
event.preventDefault();
|
|
1498
|
+
return 1;
|
|
1499
|
+
default:
|
|
1500
|
+
_this2.props.onKeyDown(event);
|
|
1501
|
+
return 1;
|
|
1502
|
+
}
|
|
1503
|
+
};
|
|
1504
|
+
|
|
1505
|
+
this.onClear = function () {
|
|
1506
|
+
_this2.onSelect(null);
|
|
1507
|
+
_this2.props.onClear();
|
|
1508
|
+
};
|
|
1509
|
+
|
|
1510
|
+
this.onOk = function () {
|
|
1511
|
+
var selectedValue = _this2.state.selectedValue;
|
|
1512
|
+
|
|
1513
|
+
if (_this2.isAllowedDate(selectedValue)) {
|
|
1514
|
+
_this2.props.onOk(selectedValue);
|
|
1515
|
+
}
|
|
1516
|
+
};
|
|
1517
|
+
|
|
1518
|
+
this.onDateInputChange = function (value) {
|
|
1519
|
+
_this2.onSelect(value, {
|
|
1520
|
+
source: 'dateInput'
|
|
1521
|
+
});
|
|
1522
|
+
};
|
|
1523
|
+
|
|
1524
|
+
this.onDateInputSelect = function (value) {
|
|
1525
|
+
_this2.onSelect(value, {
|
|
1526
|
+
source: 'dateInputSelect'
|
|
1527
|
+
});
|
|
1528
|
+
};
|
|
1529
|
+
|
|
1530
|
+
this.onDateTableSelect = function (value) {
|
|
1531
|
+
var timePicker = _this2.props.timePicker;
|
|
1532
|
+
var selectedValue = _this2.state.selectedValue;
|
|
1533
|
+
|
|
1534
|
+
if (!selectedValue && timePicker) {
|
|
1535
|
+
var timePickerDefaultValue = timePicker.props.defaultValue;
|
|
1536
|
+
if (timePickerDefaultValue) {
|
|
1537
|
+
syncTime(timePickerDefaultValue, value);
|
|
1538
|
+
}
|
|
1539
|
+
}
|
|
1540
|
+
_this2.onSelect(value);
|
|
1541
|
+
};
|
|
1542
|
+
|
|
1543
|
+
this.onToday = function () {
|
|
1544
|
+
var value = _this2.state.value;
|
|
1545
|
+
|
|
1546
|
+
var now = getTodayTime(value);
|
|
1547
|
+
_this2.onSelect(now, {
|
|
1548
|
+
source: 'todayButton'
|
|
1549
|
+
});
|
|
1550
|
+
};
|
|
1551
|
+
|
|
1552
|
+
this.onBlur = function (event) {
|
|
1553
|
+
setTimeout(function () {
|
|
1554
|
+
var dateInput = DateInput.getInstance();
|
|
1555
|
+
var rootInstance = _this2.rootInstance;
|
|
1556
|
+
|
|
1557
|
+
if (!rootInstance || rootInstance.contains(document.activeElement) || dateInput && dateInput.contains(document.activeElement)) {
|
|
1558
|
+
// focused element is still part of Calendar
|
|
1559
|
+
return;
|
|
1560
|
+
}
|
|
1561
|
+
|
|
1562
|
+
if (_this2.props.onBlur) {
|
|
1563
|
+
_this2.props.onBlur(event);
|
|
1564
|
+
}
|
|
1565
|
+
}, 0);
|
|
1566
|
+
};
|
|
1567
|
+
|
|
1568
|
+
this.getRootDOMNode = function () {
|
|
1569
|
+
return ReactDOM__default.findDOMNode(_this2);
|
|
1570
|
+
};
|
|
1571
|
+
|
|
1572
|
+
this.openTimePicker = function () {
|
|
1573
|
+
_this2.onPanelChange(null, 'time');
|
|
1574
|
+
};
|
|
1575
|
+
|
|
1576
|
+
this.closeTimePicker = function () {
|
|
1577
|
+
_this2.onPanelChange(null, 'date');
|
|
1578
|
+
};
|
|
1579
|
+
|
|
1580
|
+
this.goTime = function (direction, unit) {
|
|
1581
|
+
_this2.setValue(goTime(_this2.state.value, direction, unit));
|
|
1582
|
+
};
|
|
1583
|
+
};
|
|
1584
|
+
|
|
1585
|
+
polyfill(Calendar);
|
|
1586
|
+
|
|
1587
|
+
var Calendar$1 = calendarMixinWrapper(commonMixinWrapper(Calendar));
|
|
1588
|
+
|
|
1589
|
+
var MonthCalendar = function (_React$Component) {
|
|
1590
|
+
_inherits$4(MonthCalendar, _React$Component);
|
|
1591
|
+
|
|
1592
|
+
function MonthCalendar(props) {
|
|
1593
|
+
_classCallCheck$4(this, MonthCalendar);
|
|
1594
|
+
|
|
1595
|
+
var _this = _possibleConstructorReturn$4(this, _React$Component.call(this, props));
|
|
1596
|
+
|
|
1597
|
+
_this.onKeyDown = function (event) {
|
|
1598
|
+
var keyCode = event.keyCode;
|
|
1599
|
+
var ctrlKey = event.ctrlKey || event.metaKey;
|
|
1600
|
+
var stateValue = _this.state.value;
|
|
1601
|
+
var disabledDate = _this.props.disabledDate;
|
|
1602
|
+
|
|
1603
|
+
var value = stateValue;
|
|
1604
|
+
switch (keyCode) {
|
|
1605
|
+
case KeyCode.DOWN:
|
|
1606
|
+
value = stateValue.clone();
|
|
1607
|
+
value.add(3, 'months');
|
|
1608
|
+
break;
|
|
1609
|
+
case KeyCode.UP:
|
|
1610
|
+
value = stateValue.clone();
|
|
1611
|
+
value.add(-3, 'months');
|
|
1612
|
+
break;
|
|
1613
|
+
case KeyCode.LEFT:
|
|
1614
|
+
value = stateValue.clone();
|
|
1615
|
+
if (ctrlKey) {
|
|
1616
|
+
value.add(-1, 'years');
|
|
1617
|
+
} else {
|
|
1618
|
+
value.add(-1, 'months');
|
|
1619
|
+
}
|
|
1620
|
+
break;
|
|
1621
|
+
case KeyCode.RIGHT:
|
|
1622
|
+
value = stateValue.clone();
|
|
1623
|
+
if (ctrlKey) {
|
|
1624
|
+
value.add(1, 'years');
|
|
1625
|
+
} else {
|
|
1626
|
+
value.add(1, 'months');
|
|
1627
|
+
}
|
|
1628
|
+
break;
|
|
1629
|
+
case KeyCode.ENTER:
|
|
1630
|
+
if (!disabledDate || !disabledDate(stateValue)) {
|
|
1631
|
+
_this.onSelect(stateValue);
|
|
1632
|
+
}
|
|
1633
|
+
event.preventDefault();
|
|
1634
|
+
return 1;
|
|
1635
|
+
default:
|
|
1636
|
+
return undefined;
|
|
1637
|
+
}
|
|
1638
|
+
if (value !== stateValue) {
|
|
1639
|
+
_this.setValue(value);
|
|
1640
|
+
event.preventDefault();
|
|
1641
|
+
return 1;
|
|
1642
|
+
}
|
|
1643
|
+
};
|
|
1644
|
+
|
|
1645
|
+
_this.handlePanelChange = function (_, mode) {
|
|
1646
|
+
if (mode !== 'date') {
|
|
1647
|
+
_this.setState({ mode: mode });
|
|
1648
|
+
}
|
|
1649
|
+
};
|
|
1650
|
+
|
|
1651
|
+
_this.state = {
|
|
1652
|
+
mode: 'month',
|
|
1653
|
+
value: props.value || props.defaultValue || moment(),
|
|
1654
|
+
selectedValue: props.selectedValue || props.defaultSelectedValue
|
|
1655
|
+
};
|
|
1656
|
+
return _this;
|
|
1657
|
+
}
|
|
1658
|
+
|
|
1659
|
+
MonthCalendar.prototype.render = function render() {
|
|
1660
|
+
var props = this.props,
|
|
1661
|
+
state = this.state;
|
|
1662
|
+
var mode = state.mode,
|
|
1663
|
+
value = state.value;
|
|
1664
|
+
|
|
1665
|
+
var children = React__default.createElement(
|
|
1666
|
+
'div',
|
|
1667
|
+
{ className: props.prefixCls + '-month-calendar-content' },
|
|
1668
|
+
React__default.createElement(
|
|
1669
|
+
'div',
|
|
1670
|
+
{ className: props.prefixCls + '-month-header-wrap' },
|
|
1671
|
+
React__default.createElement(CalendarHeader, {
|
|
1672
|
+
prefixCls: props.prefixCls,
|
|
1673
|
+
mode: mode,
|
|
1674
|
+
value: value,
|
|
1675
|
+
locale: props.locale,
|
|
1676
|
+
disabledMonth: props.disabledDate,
|
|
1677
|
+
monthCellRender: props.monthCellRender,
|
|
1678
|
+
monthCellContentRender: props.monthCellContentRender,
|
|
1679
|
+
onMonthSelect: this.onSelect,
|
|
1680
|
+
onValueChange: this.setValue,
|
|
1681
|
+
onPanelChange: this.handlePanelChange
|
|
1682
|
+
})
|
|
1683
|
+
),
|
|
1684
|
+
React__default.createElement(CalendarFooter, {
|
|
1685
|
+
prefixCls: props.prefixCls,
|
|
1686
|
+
renderFooter: props.renderFooter
|
|
1687
|
+
})
|
|
1688
|
+
);
|
|
1689
|
+
return this.renderRoot({
|
|
1690
|
+
className: props.prefixCls + '-month-calendar',
|
|
1691
|
+
children: children
|
|
1692
|
+
});
|
|
1693
|
+
};
|
|
1694
|
+
|
|
1695
|
+
return MonthCalendar;
|
|
1696
|
+
}(React__default.Component);
|
|
1697
|
+
|
|
1698
|
+
MonthCalendar.propTypes = _extends$5({}, calendarMixinPropTypes, propType, {
|
|
1699
|
+
monthCellRender: PropTypes.func,
|
|
1700
|
+
value: PropTypes.object,
|
|
1701
|
+
defaultValue: PropTypes.object,
|
|
1702
|
+
selectedValue: PropTypes.object,
|
|
1703
|
+
defaultSelectedValue: PropTypes.object,
|
|
1704
|
+
disabledDate: PropTypes.func
|
|
1705
|
+
});
|
|
1706
|
+
MonthCalendar.defaultProps = _extends$5({}, defaultProp, calendarMixinDefaultProps);
|
|
1707
|
+
|
|
1708
|
+
|
|
1709
|
+
var MonthCalendar$1 = polyfill(calendarMixinWrapper(commonMixinWrapper(MonthCalendar)));
|
|
1710
|
+
|
|
1711
|
+
var autoAdjustOverflow = {
|
|
1712
|
+
adjustX: 1,
|
|
1713
|
+
adjustY: 1
|
|
1714
|
+
};
|
|
1715
|
+
|
|
1716
|
+
var targetOffset = [0, 0];
|
|
1717
|
+
|
|
1718
|
+
var placements = {
|
|
1719
|
+
bottomLeft: {
|
|
1720
|
+
points: ['tl', 'tl'],
|
|
1721
|
+
overflow: autoAdjustOverflow,
|
|
1722
|
+
offset: [0, -3],
|
|
1723
|
+
targetOffset: targetOffset
|
|
1724
|
+
},
|
|
1725
|
+
bottomRight: {
|
|
1726
|
+
points: ['tr', 'tr'],
|
|
1727
|
+
overflow: autoAdjustOverflow,
|
|
1728
|
+
offset: [0, -3],
|
|
1729
|
+
targetOffset: targetOffset
|
|
1730
|
+
},
|
|
1731
|
+
topRight: {
|
|
1732
|
+
points: ['br', 'br'],
|
|
1733
|
+
overflow: autoAdjustOverflow,
|
|
1734
|
+
offset: [0, 3],
|
|
1735
|
+
targetOffset: targetOffset
|
|
1736
|
+
},
|
|
1737
|
+
topLeft: {
|
|
1738
|
+
points: ['bl', 'bl'],
|
|
1739
|
+
overflow: autoAdjustOverflow,
|
|
1740
|
+
offset: [0, 3],
|
|
1741
|
+
targetOffset: targetOffset
|
|
1742
|
+
}
|
|
1743
|
+
};
|
|
1744
|
+
|
|
1745
|
+
function noop$1() {}
|
|
1746
|
+
|
|
1747
|
+
function refFn(field, component) {
|
|
1748
|
+
this[field] = component;
|
|
1749
|
+
}
|
|
1750
|
+
|
|
1751
|
+
var Picker = function (_React$Component) {
|
|
1752
|
+
_inherits$4(Picker, _React$Component);
|
|
1753
|
+
|
|
1754
|
+
function Picker(props) {
|
|
1755
|
+
_classCallCheck$4(this, Picker);
|
|
1756
|
+
|
|
1757
|
+
var _this = _possibleConstructorReturn$4(this, _React$Component.call(this, props));
|
|
1758
|
+
|
|
1759
|
+
_initialiseProps$1.call(_this);
|
|
1760
|
+
|
|
1761
|
+
var open = void 0;
|
|
1762
|
+
if ('open' in props) {
|
|
1763
|
+
open = props.open;
|
|
1764
|
+
} else {
|
|
1765
|
+
open = props.defaultOpen;
|
|
1766
|
+
}
|
|
1767
|
+
var value = props.value || props.defaultValue;
|
|
1768
|
+
_this.saveCalendarRef = refFn.bind(_this, 'calendarInstance');
|
|
1769
|
+
|
|
1770
|
+
_this.state = {
|
|
1771
|
+
open: open,
|
|
1772
|
+
value: value
|
|
1773
|
+
};
|
|
1774
|
+
return _this;
|
|
1775
|
+
}
|
|
1776
|
+
|
|
1777
|
+
Picker.prototype.componentDidUpdate = function componentDidUpdate(_, prevState) {
|
|
1778
|
+
if (!prevState.open && this.state.open) {
|
|
1779
|
+
// setTimeout is for making sure saveCalendarRef happen before focusCalendar
|
|
1780
|
+
this.focusTimeout = setTimeout(this.focusCalendar, 0, this);
|
|
1781
|
+
}
|
|
1782
|
+
};
|
|
1783
|
+
|
|
1784
|
+
Picker.prototype.componentWillUnmount = function componentWillUnmount() {
|
|
1785
|
+
clearTimeout(this.focusTimeout);
|
|
1786
|
+
};
|
|
1787
|
+
|
|
1788
|
+
Picker.getDerivedStateFromProps = function getDerivedStateFromProps(nextProps) {
|
|
1789
|
+
var newState = {};
|
|
1790
|
+
var value = nextProps.value,
|
|
1791
|
+
open = nextProps.open;
|
|
1792
|
+
|
|
1793
|
+
if ('value' in nextProps) {
|
|
1794
|
+
newState.value = value;
|
|
1795
|
+
}
|
|
1796
|
+
if (open !== undefined) {
|
|
1797
|
+
newState.open = open;
|
|
1798
|
+
}
|
|
1799
|
+
return newState;
|
|
1800
|
+
};
|
|
1801
|
+
|
|
1802
|
+
Picker.prototype.render = function render() {
|
|
1803
|
+
var props = this.props;
|
|
1804
|
+
var prefixCls = props.prefixCls,
|
|
1805
|
+
placement = props.placement,
|
|
1806
|
+
style = props.style,
|
|
1807
|
+
getCalendarContainer = props.getCalendarContainer,
|
|
1808
|
+
align = props.align,
|
|
1809
|
+
animation = props.animation,
|
|
1810
|
+
disabled = props.disabled,
|
|
1811
|
+
dropdownClassName = props.dropdownClassName,
|
|
1812
|
+
transitionName = props.transitionName,
|
|
1813
|
+
children = props.children;
|
|
1814
|
+
|
|
1815
|
+
var state = this.state;
|
|
1816
|
+
return React__default.createElement(
|
|
1817
|
+
Trigger,
|
|
1818
|
+
{
|
|
1819
|
+
popup: this.getCalendarElement(),
|
|
1820
|
+
popupAlign: align,
|
|
1821
|
+
builtinPlacements: placements,
|
|
1822
|
+
popupPlacement: placement,
|
|
1823
|
+
action: disabled && !state.open ? [] : ['click'],
|
|
1824
|
+
destroyPopupOnHide: true,
|
|
1825
|
+
getPopupContainer: getCalendarContainer,
|
|
1826
|
+
popupStyle: style,
|
|
1827
|
+
popupAnimation: animation,
|
|
1828
|
+
popupTransitionName: transitionName,
|
|
1829
|
+
popupVisible: state.open,
|
|
1830
|
+
onPopupVisibleChange: this.onVisibleChange,
|
|
1831
|
+
prefixCls: prefixCls,
|
|
1832
|
+
popupClassName: dropdownClassName
|
|
1833
|
+
},
|
|
1834
|
+
React__default.cloneElement(children(state, props), { onKeyDown: this.onKeyDown })
|
|
1835
|
+
);
|
|
1836
|
+
};
|
|
1837
|
+
|
|
1838
|
+
return Picker;
|
|
1839
|
+
}(React__default.Component);
|
|
1840
|
+
|
|
1841
|
+
Picker.propTypes = {
|
|
1842
|
+
animation: PropTypes.oneOfType([PropTypes.func, PropTypes.string]),
|
|
1843
|
+
disabled: PropTypes.bool,
|
|
1844
|
+
transitionName: PropTypes.string,
|
|
1845
|
+
onChange: PropTypes.func,
|
|
1846
|
+
onOpenChange: PropTypes.func,
|
|
1847
|
+
children: PropTypes.func,
|
|
1848
|
+
getCalendarContainer: PropTypes.func,
|
|
1849
|
+
calendar: PropTypes.element,
|
|
1850
|
+
style: PropTypes.object,
|
|
1851
|
+
open: PropTypes.bool,
|
|
1852
|
+
defaultOpen: PropTypes.bool,
|
|
1853
|
+
prefixCls: PropTypes.string,
|
|
1854
|
+
placement: PropTypes.any,
|
|
1855
|
+
value: PropTypes.oneOfType([PropTypes.object, PropTypes.array]),
|
|
1856
|
+
defaultValue: PropTypes.oneOfType([PropTypes.object, PropTypes.array]),
|
|
1857
|
+
align: PropTypes.object,
|
|
1858
|
+
dateRender: PropTypes.func,
|
|
1859
|
+
onBlur: PropTypes.func
|
|
1860
|
+
};
|
|
1861
|
+
Picker.defaultProps = {
|
|
1862
|
+
prefixCls: 'rc-calendar-picker',
|
|
1863
|
+
style: {},
|
|
1864
|
+
align: {},
|
|
1865
|
+
placement: 'bottomLeft',
|
|
1866
|
+
defaultOpen: false,
|
|
1867
|
+
onChange: noop$1,
|
|
1868
|
+
onOpenChange: noop$1,
|
|
1869
|
+
onBlur: noop$1
|
|
1870
|
+
};
|
|
1871
|
+
|
|
1872
|
+
var _initialiseProps$1 = function _initialiseProps() {
|
|
1873
|
+
var _this2 = this;
|
|
1874
|
+
|
|
1875
|
+
this.onCalendarKeyDown = function (event) {
|
|
1876
|
+
if (event.keyCode === KeyCode.ESC) {
|
|
1877
|
+
event.stopPropagation();
|
|
1878
|
+
_this2.close(_this2.focus);
|
|
1879
|
+
}
|
|
1880
|
+
};
|
|
1881
|
+
|
|
1882
|
+
this.onCalendarSelect = function (value) {
|
|
1883
|
+
var cause = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {};
|
|
1884
|
+
|
|
1885
|
+
var props = _this2.props;
|
|
1886
|
+
if (!('value' in props)) {
|
|
1887
|
+
_this2.setState({
|
|
1888
|
+
value: value
|
|
1889
|
+
});
|
|
1890
|
+
}
|
|
1891
|
+
if (cause.source === 'keyboard' || cause.source === 'dateInputSelect' || !props.calendar.props.timePicker && cause.source !== 'dateInput' || cause.source === 'todayButton') {
|
|
1892
|
+
_this2.close(_this2.focus);
|
|
1893
|
+
}
|
|
1894
|
+
props.onChange(value);
|
|
1895
|
+
};
|
|
1896
|
+
|
|
1897
|
+
this.onKeyDown = function (event) {
|
|
1898
|
+
if (!_this2.state.open && (event.keyCode === KeyCode.DOWN || event.keyCode === KeyCode.ENTER)) {
|
|
1899
|
+
_this2.open();
|
|
1900
|
+
event.preventDefault();
|
|
1901
|
+
}
|
|
1902
|
+
};
|
|
1903
|
+
|
|
1904
|
+
this.onCalendarOk = function () {
|
|
1905
|
+
_this2.close(_this2.focus);
|
|
1906
|
+
};
|
|
1907
|
+
|
|
1908
|
+
this.onCalendarClear = function () {
|
|
1909
|
+
_this2.close(_this2.focus);
|
|
1910
|
+
};
|
|
1911
|
+
|
|
1912
|
+
this.onCalendarBlur = function () {
|
|
1913
|
+
_this2.setOpen(false);
|
|
1914
|
+
};
|
|
1915
|
+
|
|
1916
|
+
this.onVisibleChange = function (open) {
|
|
1917
|
+
_this2.setOpen(open);
|
|
1918
|
+
};
|
|
1919
|
+
|
|
1920
|
+
this.getCalendarElement = function () {
|
|
1921
|
+
var props = _this2.props;
|
|
1922
|
+
var state = _this2.state;
|
|
1923
|
+
var calendarProps = props.calendar.props;
|
|
1924
|
+
var value = state.value;
|
|
1925
|
+
|
|
1926
|
+
var defaultValue = value;
|
|
1927
|
+
var extraProps = {
|
|
1928
|
+
ref: _this2.saveCalendarRef,
|
|
1929
|
+
defaultValue: defaultValue || calendarProps.defaultValue,
|
|
1930
|
+
selectedValue: value,
|
|
1931
|
+
onKeyDown: _this2.onCalendarKeyDown,
|
|
1932
|
+
onOk: createChainedFunction(calendarProps.onOk, _this2.onCalendarOk),
|
|
1933
|
+
onSelect: createChainedFunction(calendarProps.onSelect, _this2.onCalendarSelect),
|
|
1934
|
+
onClear: createChainedFunction(calendarProps.onClear, _this2.onCalendarClear),
|
|
1935
|
+
onBlur: createChainedFunction(calendarProps.onBlur, _this2.onCalendarBlur)
|
|
1936
|
+
};
|
|
1937
|
+
|
|
1938
|
+
return React__default.cloneElement(props.calendar, extraProps);
|
|
1939
|
+
};
|
|
1940
|
+
|
|
1941
|
+
this.setOpen = function (open, callback) {
|
|
1942
|
+
var onOpenChange = _this2.props.onOpenChange;
|
|
1943
|
+
|
|
1944
|
+
if (_this2.state.open !== open) {
|
|
1945
|
+
if (!('open' in _this2.props)) {
|
|
1946
|
+
_this2.setState({
|
|
1947
|
+
open: open
|
|
1948
|
+
}, callback);
|
|
1949
|
+
}
|
|
1950
|
+
onOpenChange(open);
|
|
1951
|
+
}
|
|
1952
|
+
};
|
|
1953
|
+
|
|
1954
|
+
this.open = function (callback) {
|
|
1955
|
+
_this2.setOpen(true, callback);
|
|
1956
|
+
};
|
|
1957
|
+
|
|
1958
|
+
this.close = function (callback) {
|
|
1959
|
+
_this2.setOpen(false, callback);
|
|
1960
|
+
};
|
|
1961
|
+
|
|
1962
|
+
this.focus = function () {
|
|
1963
|
+
if (!_this2.state.open) {
|
|
1964
|
+
ReactDOM__default.findDOMNode(_this2).focus();
|
|
1965
|
+
}
|
|
1966
|
+
};
|
|
1967
|
+
|
|
1968
|
+
this.focusCalendar = function () {
|
|
1969
|
+
if (_this2.state.open && !!_this2.calendarInstance) {
|
|
1970
|
+
_this2.calendarInstance.focus();
|
|
1971
|
+
}
|
|
1972
|
+
};
|
|
1973
|
+
};
|
|
1974
|
+
|
|
1975
|
+
polyfill(Picker);
|
|
1976
|
+
|
|
1977
|
+
// eslint-disable-next-line import/prefer-default-export
|
|
1978
|
+
function formatDate(value, format) {
|
|
1979
|
+
if (!value) {
|
|
1980
|
+
return '';
|
|
1981
|
+
}
|
|
1982
|
+
|
|
1983
|
+
if (Array.isArray(format)) {
|
|
1984
|
+
format = format[0];
|
|
1985
|
+
}
|
|
1986
|
+
|
|
1987
|
+
return value.format(format);
|
|
1988
|
+
}
|
|
1989
|
+
|
|
1990
|
+
function _typeof$3(obj) { "@babel/helpers - typeof"; if (typeof Symbol === "function" && typeof Symbol.iterator === "symbol") { _typeof$3 = function _typeof(obj) { return typeof obj; }; } else { _typeof$3 = function _typeof(obj) { return obj && typeof Symbol === "function" && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; }; } return _typeof$3(obj); }
|
|
1991
|
+
|
|
1992
|
+
function _extends$4() { _extends$4 = Object.assign || function (target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { target[key] = source[key]; } } } return target; }; return _extends$4.apply(this, arguments); }
|
|
1993
|
+
|
|
1994
|
+
function _defineProperty$3(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; }
|
|
1995
|
+
|
|
1996
|
+
function _classCallCheck$3(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
|
|
1997
|
+
|
|
1998
|
+
function _defineProperties$3(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); } }
|
|
1999
|
+
|
|
2000
|
+
function _createClass$3(Constructor, protoProps, staticProps) { if (protoProps) _defineProperties$3(Constructor.prototype, protoProps); if (staticProps) _defineProperties$3(Constructor, staticProps); return Constructor; }
|
|
2001
|
+
|
|
2002
|
+
function _inherits$3(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$3(subClass, superClass); }
|
|
2003
|
+
|
|
2004
|
+
function _setPrototypeOf$3(o, p) { _setPrototypeOf$3 = Object.setPrototypeOf || function _setPrototypeOf(o, p) { o.__proto__ = p; return o; }; return _setPrototypeOf$3(o, p); }
|
|
2005
|
+
|
|
2006
|
+
function _createSuper$3(Derived) { var hasNativeReflectConstruct = _isNativeReflectConstruct$3(); return function _createSuperInternal() { var Super = _getPrototypeOf$3(Derived), result; if (hasNativeReflectConstruct) { var NewTarget = _getPrototypeOf$3(this).constructor; result = Reflect.construct(Super, arguments, NewTarget); } else { result = Super.apply(this, arguments); } return _possibleConstructorReturn$3(this, result); }; }
|
|
2007
|
+
|
|
2008
|
+
function _possibleConstructorReturn$3(self, call) { if (call && (_typeof$3(call) === "object" || typeof call === "function")) { return call; } return _assertThisInitialized$3(self); }
|
|
2009
|
+
|
|
2010
|
+
function _assertThisInitialized$3(self) { if (self === void 0) { throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); } return self; }
|
|
2011
|
+
|
|
2012
|
+
function _isNativeReflectConstruct$3() { 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; } }
|
|
2013
|
+
|
|
2014
|
+
function _getPrototypeOf$3(o) { _getPrototypeOf$3 = Object.setPrototypeOf ? Object.getPrototypeOf : function _getPrototypeOf(o) { return o.__proto__ || Object.getPrototypeOf(o); }; return _getPrototypeOf$3(o); }
|
|
2015
|
+
function createPicker(TheCalendar) {
|
|
2016
|
+
var CalenderWrapper = /*#__PURE__*/function (_React$Component) {
|
|
2017
|
+
_inherits$3(CalenderWrapper, _React$Component);
|
|
2018
|
+
|
|
2019
|
+
var _super = _createSuper$3(CalenderWrapper);
|
|
2020
|
+
|
|
2021
|
+
function CalenderWrapper(props) {
|
|
2022
|
+
var _this;
|
|
2023
|
+
|
|
2024
|
+
_classCallCheck$3(this, CalenderWrapper);
|
|
2025
|
+
|
|
2026
|
+
_this = _super.call(this, props);
|
|
2027
|
+
|
|
2028
|
+
_this.saveInput = function (node) {
|
|
2029
|
+
_this.input = node;
|
|
2030
|
+
};
|
|
2031
|
+
|
|
2032
|
+
_this.clearSelection = function (e) {
|
|
2033
|
+
e.preventDefault();
|
|
2034
|
+
e.stopPropagation();
|
|
2035
|
+
|
|
2036
|
+
_this.handleChange(null);
|
|
2037
|
+
};
|
|
2038
|
+
|
|
2039
|
+
_this.handleChange = function (value) {
|
|
2040
|
+
var _assertThisInitialize = _assertThisInitialized$3(_this),
|
|
2041
|
+
props = _assertThisInitialize.props;
|
|
2042
|
+
|
|
2043
|
+
if (!('value' in props)) {
|
|
2044
|
+
_this.setState({
|
|
2045
|
+
value: value,
|
|
2046
|
+
showDate: value
|
|
2047
|
+
});
|
|
2048
|
+
}
|
|
2049
|
+
|
|
2050
|
+
props.onChange(value, formatDate(value, props.format));
|
|
2051
|
+
};
|
|
2052
|
+
|
|
2053
|
+
_this.handleCalendarChange = function (value) {
|
|
2054
|
+
_this.setState({
|
|
2055
|
+
showDate: value
|
|
2056
|
+
});
|
|
2057
|
+
};
|
|
2058
|
+
|
|
2059
|
+
_this.handleOpenChange = function (open) {
|
|
2060
|
+
var onOpenChange = _this.props.onOpenChange;
|
|
2061
|
+
|
|
2062
|
+
if (!('open' in _this.props)) {
|
|
2063
|
+
_this.setState({
|
|
2064
|
+
open: open
|
|
2065
|
+
});
|
|
2066
|
+
}
|
|
2067
|
+
|
|
2068
|
+
if (onOpenChange) {
|
|
2069
|
+
onOpenChange(open);
|
|
2070
|
+
}
|
|
2071
|
+
};
|
|
2072
|
+
|
|
2073
|
+
_this.renderFooter = function () {
|
|
2074
|
+
var renderExtraFooter = _this.props.renderExtraFooter;
|
|
2075
|
+
|
|
2076
|
+
var _assertThisInitialize2 = _assertThisInitialized$3(_this),
|
|
2077
|
+
prefixCls = _assertThisInitialize2.prefixCls;
|
|
2078
|
+
|
|
2079
|
+
return renderExtraFooter ? /*#__PURE__*/React.createElement("div", {
|
|
2080
|
+
className: "".concat(prefixCls, "-footer-extra")
|
|
2081
|
+
}, renderExtraFooter.apply(void 0, arguments)) : null;
|
|
2082
|
+
};
|
|
2083
|
+
|
|
2084
|
+
_this.renderPicker = function (_ref) {
|
|
2085
|
+
var _classNames, _classNames2;
|
|
2086
|
+
|
|
2087
|
+
var getPrefixCls = _ref.getPrefixCls;
|
|
2088
|
+
var _this$state = _this.state,
|
|
2089
|
+
value = _this$state.value,
|
|
2090
|
+
showDate = _this$state.showDate,
|
|
2091
|
+
open = _this$state.open;
|
|
2092
|
+
var props = omit(_this.props, ['onChange']);
|
|
2093
|
+
var customizePrefixCls = props.prefixCls,
|
|
2094
|
+
locale = props.locale,
|
|
2095
|
+
localeCode = props.localeCode,
|
|
2096
|
+
suffixIcon = props.suffixIcon;
|
|
2097
|
+
var prefixCls = getPrefixCls('calendar', customizePrefixCls); // To support old version react.
|
|
2098
|
+
// Have to add prefixCls on the instance.
|
|
2099
|
+
// https://github.com/facebook/react/issues/12397
|
|
2100
|
+
|
|
2101
|
+
_this.prefixCls = prefixCls;
|
|
2102
|
+
var placeholder = 'placeholder' in props ? props.placeholder : locale.lang.placeholder;
|
|
2103
|
+
var disabledTime = props.showTime ? props.disabledTime : null;
|
|
2104
|
+
var calendarClassName = classNames((_classNames = {}, _defineProperty$3(_classNames, "".concat(prefixCls, "-time"), props.showTime), _defineProperty$3(_classNames, "".concat(prefixCls, "-month"), MonthCalendar$1 === TheCalendar), _classNames));
|
|
2105
|
+
|
|
2106
|
+
if (value && localeCode) {
|
|
2107
|
+
value.locale(localeCode);
|
|
2108
|
+
}
|
|
2109
|
+
|
|
2110
|
+
var pickerProps = {};
|
|
2111
|
+
var calendarProps = {};
|
|
2112
|
+
var pickerStyle = {};
|
|
2113
|
+
|
|
2114
|
+
if (props.showTime) {
|
|
2115
|
+
calendarProps = {
|
|
2116
|
+
// fix https://github.com/ant-design/ant-design/issues/1902
|
|
2117
|
+
onSelect: _this.handleChange
|
|
2118
|
+
};
|
|
2119
|
+
pickerStyle.minWidth = 195;
|
|
2120
|
+
} else {
|
|
2121
|
+
pickerProps = {
|
|
2122
|
+
onChange: _this.handleChange
|
|
2123
|
+
};
|
|
2124
|
+
}
|
|
2125
|
+
|
|
2126
|
+
if ('mode' in props) {
|
|
2127
|
+
calendarProps.mode = props.mode;
|
|
2128
|
+
}
|
|
2129
|
+
var calendar = /*#__PURE__*/React.createElement(TheCalendar, _extends$4({}, calendarProps, {
|
|
2130
|
+
disabledDate: props.disabledDate,
|
|
2131
|
+
disabledTime: disabledTime,
|
|
2132
|
+
locale: locale.lang,
|
|
2133
|
+
timePicker: props.timePicker,
|
|
2134
|
+
defaultValue: props.defaultPickerValue || interopDefault(moment$1)(),
|
|
2135
|
+
dateInputPlaceholder: placeholder,
|
|
2136
|
+
prefixCls: prefixCls,
|
|
2137
|
+
className: calendarClassName,
|
|
2138
|
+
onOk: props.onOk,
|
|
2139
|
+
dateRender: props.dateRender,
|
|
2140
|
+
format: props.format,
|
|
2141
|
+
showToday: props.showToday,
|
|
2142
|
+
monthCellContentRender: props.monthCellContentRender,
|
|
2143
|
+
renderFooter: _this.renderFooter,
|
|
2144
|
+
onPanelChange: props.onPanelChange,
|
|
2145
|
+
onChange: _this.handleCalendarChange,
|
|
2146
|
+
value: showDate
|
|
2147
|
+
}));
|
|
2148
|
+
var clearIcon = !props.disabled && props.allowClear && value ? /*#__PURE__*/React.createElement(Icon, {
|
|
2149
|
+
type: "close-circle",
|
|
2150
|
+
className: "".concat(prefixCls, "-picker-clear"),
|
|
2151
|
+
onClick: _this.clearSelection,
|
|
2152
|
+
theme: "filled"
|
|
2153
|
+
}) : null;
|
|
2154
|
+
var inputIcon = suffixIcon && ( /*#__PURE__*/React.isValidElement(suffixIcon) ? /*#__PURE__*/React.cloneElement(suffixIcon, {
|
|
2155
|
+
className: classNames((_classNames2 = {}, _defineProperty$3(_classNames2, suffixIcon.props.className, suffixIcon.props.className), _defineProperty$3(_classNames2, "".concat(prefixCls, "-picker-icon"), true), _classNames2))
|
|
2156
|
+
}) : /*#__PURE__*/React.createElement("span", {
|
|
2157
|
+
className: "".concat(prefixCls, "-picker-icon")
|
|
2158
|
+
}, suffixIcon)) || /*#__PURE__*/React.createElement(Icon, {
|
|
2159
|
+
type: "calendar",
|
|
2160
|
+
className: "".concat(prefixCls, "-picker-icon")
|
|
2161
|
+
});
|
|
2162
|
+
var dataOrAriaProps = getDataOrAriaProps(props);
|
|
2163
|
+
|
|
2164
|
+
var input = function input(_ref2) {
|
|
2165
|
+
var inputValue = _ref2.value;
|
|
2166
|
+
return /*#__PURE__*/React.createElement("div", null, /*#__PURE__*/React.createElement("input", _extends$4({
|
|
2167
|
+
ref: _this.saveInput,
|
|
2168
|
+
disabled: props.disabled,
|
|
2169
|
+
readOnly: true,
|
|
2170
|
+
value: formatDate(inputValue, props.format),
|
|
2171
|
+
placeholder: placeholder,
|
|
2172
|
+
className: props.pickerInputClass,
|
|
2173
|
+
tabIndex: props.tabIndex,
|
|
2174
|
+
name: props.name
|
|
2175
|
+
}, dataOrAriaProps)), clearIcon, inputIcon);
|
|
2176
|
+
};
|
|
2177
|
+
|
|
2178
|
+
return /*#__PURE__*/React.createElement("span", {
|
|
2179
|
+
id: props.id,
|
|
2180
|
+
className: classNames(props.className, props.pickerClass),
|
|
2181
|
+
style: _extends$4(_extends$4({}, pickerStyle), props.style),
|
|
2182
|
+
onFocus: props.onFocus,
|
|
2183
|
+
onBlur: props.onBlur,
|
|
2184
|
+
onMouseEnter: props.onMouseEnter,
|
|
2185
|
+
onMouseLeave: props.onMouseLeave
|
|
2186
|
+
}, /*#__PURE__*/React.createElement(Picker, _extends$4({}, props, pickerProps, {
|
|
2187
|
+
calendar: calendar,
|
|
2188
|
+
value: value,
|
|
2189
|
+
prefixCls: "".concat(prefixCls, "-picker-container"),
|
|
2190
|
+
style: props.popupStyle,
|
|
2191
|
+
open: open,
|
|
2192
|
+
onOpenChange: _this.handleOpenChange
|
|
2193
|
+
}), input));
|
|
2194
|
+
};
|
|
2195
|
+
|
|
2196
|
+
var value = props.value || props.defaultValue;
|
|
2197
|
+
|
|
2198
|
+
if (value && !interopDefault(moment$1).isMoment(value)) {
|
|
2199
|
+
throw new Error('The value/defaultValue of DatePicker or MonthPicker must be ' + 'a moment object after `antd@2.0`, see: https://u.ant.design/date-picker-value');
|
|
2200
|
+
}
|
|
2201
|
+
|
|
2202
|
+
_this.state = {
|
|
2203
|
+
value: value,
|
|
2204
|
+
showDate: value,
|
|
2205
|
+
open: false
|
|
2206
|
+
};
|
|
2207
|
+
return _this;
|
|
2208
|
+
}
|
|
2209
|
+
|
|
2210
|
+
_createClass$3(CalenderWrapper, [{
|
|
2211
|
+
key: "componentDidUpdate",
|
|
2212
|
+
value: function componentDidUpdate(_, prevState) {
|
|
2213
|
+
if (!('open' in this.props) && prevState.open && !this.state.open) {
|
|
2214
|
+
this.focus();
|
|
2215
|
+
}
|
|
2216
|
+
}
|
|
2217
|
+
}, {
|
|
2218
|
+
key: "focus",
|
|
2219
|
+
value: function focus() {
|
|
2220
|
+
this.input.focus();
|
|
2221
|
+
}
|
|
2222
|
+
}, {
|
|
2223
|
+
key: "blur",
|
|
2224
|
+
value: function blur() {
|
|
2225
|
+
this.input.blur();
|
|
2226
|
+
}
|
|
2227
|
+
}, {
|
|
2228
|
+
key: "render",
|
|
2229
|
+
value: function render() {
|
|
2230
|
+
return /*#__PURE__*/React.createElement(ConfigConsumer, null, this.renderPicker);
|
|
2231
|
+
}
|
|
2232
|
+
}], [{
|
|
2233
|
+
key: "getDerivedStateFromProps",
|
|
2234
|
+
value: function getDerivedStateFromProps(nextProps, prevState) {
|
|
2235
|
+
var state = {};
|
|
2236
|
+
var open = prevState.open;
|
|
2237
|
+
|
|
2238
|
+
if ('open' in nextProps) {
|
|
2239
|
+
state.open = nextProps.open;
|
|
2240
|
+
open = nextProps.open || false;
|
|
2241
|
+
}
|
|
2242
|
+
|
|
2243
|
+
if ('value' in nextProps) {
|
|
2244
|
+
state.value = nextProps.value;
|
|
2245
|
+
|
|
2246
|
+
if (nextProps.value !== prevState.value || !open && nextProps.value !== prevState.showDate) {
|
|
2247
|
+
state.showDate = nextProps.value;
|
|
2248
|
+
}
|
|
2249
|
+
}
|
|
2250
|
+
|
|
2251
|
+
return Object.keys(state).length > 0 ? state : null;
|
|
2252
|
+
}
|
|
2253
|
+
}]);
|
|
2254
|
+
|
|
2255
|
+
return CalenderWrapper;
|
|
2256
|
+
}(React.Component);
|
|
2257
|
+
|
|
2258
|
+
CalenderWrapper.defaultProps = {
|
|
2259
|
+
allowClear: true,
|
|
2260
|
+
showToday: true
|
|
2261
|
+
};
|
|
2262
|
+
polyfill(CalenderWrapper);
|
|
2263
|
+
return CalenderWrapper;
|
|
2264
|
+
}
|
|
2265
|
+
|
|
2266
|
+
function _typeof$2(obj) { "@babel/helpers - typeof"; if (typeof Symbol === "function" && typeof Symbol.iterator === "symbol") { _typeof$2 = function _typeof(obj) { return typeof obj; }; } else { _typeof$2 = function _typeof(obj) { return obj && typeof Symbol === "function" && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; }; } return _typeof$2(obj); }
|
|
2267
|
+
|
|
2268
|
+
function _defineProperty$2(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; }
|
|
2269
|
+
|
|
2270
|
+
function _extends$3() { _extends$3 = Object.assign || function (target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { target[key] = source[key]; } } } return target; }; return _extends$3.apply(this, arguments); }
|
|
2271
|
+
|
|
2272
|
+
function _classCallCheck$2(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
|
|
2273
|
+
|
|
2274
|
+
function _defineProperties$2(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); } }
|
|
2275
|
+
|
|
2276
|
+
function _createClass$2(Constructor, protoProps, staticProps) { if (protoProps) _defineProperties$2(Constructor.prototype, protoProps); if (staticProps) _defineProperties$2(Constructor, staticProps); return Constructor; }
|
|
2277
|
+
|
|
2278
|
+
function _inherits$2(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$2(subClass, superClass); }
|
|
2279
|
+
|
|
2280
|
+
function _setPrototypeOf$2(o, p) { _setPrototypeOf$2 = Object.setPrototypeOf || function _setPrototypeOf(o, p) { o.__proto__ = p; return o; }; return _setPrototypeOf$2(o, p); }
|
|
2281
|
+
|
|
2282
|
+
function _createSuper$2(Derived) { var hasNativeReflectConstruct = _isNativeReflectConstruct$2(); return function _createSuperInternal() { var Super = _getPrototypeOf$2(Derived), result; if (hasNativeReflectConstruct) { var NewTarget = _getPrototypeOf$2(this).constructor; result = Reflect.construct(Super, arguments, NewTarget); } else { result = Super.apply(this, arguments); } return _possibleConstructorReturn$2(this, result); }; }
|
|
2283
|
+
|
|
2284
|
+
function _possibleConstructorReturn$2(self, call) { if (call && (_typeof$2(call) === "object" || typeof call === "function")) { return call; } return _assertThisInitialized$2(self); }
|
|
2285
|
+
|
|
2286
|
+
function _assertThisInitialized$2(self) { if (self === void 0) { throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); } return self; }
|
|
2287
|
+
|
|
2288
|
+
function _isNativeReflectConstruct$2() { 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; } }
|
|
2289
|
+
|
|
2290
|
+
function _getPrototypeOf$2(o) { _getPrototypeOf$2 = Object.setPrototypeOf ? Object.getPrototypeOf : function _getPrototypeOf(o) { return o.__proto__ || Object.getPrototypeOf(o); }; return _getPrototypeOf$2(o); }
|
|
2291
|
+
var DEFAULT_FORMAT = {
|
|
2292
|
+
date: 'YYYY-MM-DD',
|
|
2293
|
+
dateTime: 'YYYY-MM-DD HH:mm:ss',
|
|
2294
|
+
week: 'gggg-wo',
|
|
2295
|
+
month: 'YYYY-MM'
|
|
2296
|
+
};
|
|
2297
|
+
var LOCALE_FORMAT_MAPPING = {
|
|
2298
|
+
date: 'dateFormat',
|
|
2299
|
+
dateTime: 'dateTimeFormat',
|
|
2300
|
+
week: 'weekFormat',
|
|
2301
|
+
month: 'monthFormat'
|
|
2302
|
+
};
|
|
2303
|
+
|
|
2304
|
+
function getColumns(_ref) {
|
|
2305
|
+
var showHour = _ref.showHour,
|
|
2306
|
+
showMinute = _ref.showMinute,
|
|
2307
|
+
showSecond = _ref.showSecond,
|
|
2308
|
+
use12Hours = _ref.use12Hours;
|
|
2309
|
+
var column = 0;
|
|
2310
|
+
|
|
2311
|
+
if (showHour) {
|
|
2312
|
+
column += 1;
|
|
2313
|
+
}
|
|
2314
|
+
|
|
2315
|
+
if (showMinute) {
|
|
2316
|
+
column += 1;
|
|
2317
|
+
}
|
|
2318
|
+
|
|
2319
|
+
if (showSecond) {
|
|
2320
|
+
column += 1;
|
|
2321
|
+
}
|
|
2322
|
+
|
|
2323
|
+
if (use12Hours) {
|
|
2324
|
+
column += 1;
|
|
2325
|
+
}
|
|
2326
|
+
|
|
2327
|
+
return column;
|
|
2328
|
+
}
|
|
2329
|
+
|
|
2330
|
+
function checkValidate(value, propName) {
|
|
2331
|
+
var values = Array.isArray(value) ? value : [value];
|
|
2332
|
+
values.forEach(function (val) {
|
|
2333
|
+
if (!val) return;
|
|
2334
|
+
warning(!interopDefault(moment$1).isMoment(val) || val.isValid());
|
|
2335
|
+
});
|
|
2336
|
+
}
|
|
2337
|
+
|
|
2338
|
+
function wrapPicker(Picker, pickerType) {
|
|
2339
|
+
var PickerWrapper = /*#__PURE__*/function (_React$Component) {
|
|
2340
|
+
_inherits$2(PickerWrapper, _React$Component);
|
|
2341
|
+
|
|
2342
|
+
var _super = _createSuper$2(PickerWrapper);
|
|
2343
|
+
|
|
2344
|
+
function PickerWrapper() {
|
|
2345
|
+
var _this;
|
|
2346
|
+
|
|
2347
|
+
_classCallCheck$2(this, PickerWrapper);
|
|
2348
|
+
|
|
2349
|
+
_this = _super.apply(this, arguments); // Since we need call `getDerivedStateFromProps` for check. Need leave an empty `state` here.
|
|
2350
|
+
|
|
2351
|
+
_this.state = {};
|
|
2352
|
+
|
|
2353
|
+
_this.savePicker = function (node) {
|
|
2354
|
+
_this.picker = node;
|
|
2355
|
+
};
|
|
2356
|
+
|
|
2357
|
+
_this.getDefaultLocale = function () {
|
|
2358
|
+
var result = _extends$3(_extends$3({}, locale), _this.props.locale);
|
|
2359
|
+
|
|
2360
|
+
result.lang = _extends$3(_extends$3({}, result.lang), (_this.props.locale || {}).lang);
|
|
2361
|
+
return result;
|
|
2362
|
+
};
|
|
2363
|
+
|
|
2364
|
+
_this.handleOpenChange = function (open) {
|
|
2365
|
+
var onOpenChange = _this.props.onOpenChange;
|
|
2366
|
+
onOpenChange(open);
|
|
2367
|
+
};
|
|
2368
|
+
|
|
2369
|
+
_this.handleFocus = function (e) {
|
|
2370
|
+
var onFocus = _this.props.onFocus;
|
|
2371
|
+
|
|
2372
|
+
if (onFocus) {
|
|
2373
|
+
onFocus(e);
|
|
2374
|
+
}
|
|
2375
|
+
};
|
|
2376
|
+
|
|
2377
|
+
_this.handleBlur = function (e) {
|
|
2378
|
+
var onBlur = _this.props.onBlur;
|
|
2379
|
+
|
|
2380
|
+
if (onBlur) {
|
|
2381
|
+
onBlur(e);
|
|
2382
|
+
}
|
|
2383
|
+
};
|
|
2384
|
+
|
|
2385
|
+
_this.handleMouseEnter = function (e) {
|
|
2386
|
+
var onMouseEnter = _this.props.onMouseEnter;
|
|
2387
|
+
|
|
2388
|
+
if (onMouseEnter) {
|
|
2389
|
+
onMouseEnter(e);
|
|
2390
|
+
}
|
|
2391
|
+
};
|
|
2392
|
+
|
|
2393
|
+
_this.handleMouseLeave = function (e) {
|
|
2394
|
+
var onMouseLeave = _this.props.onMouseLeave;
|
|
2395
|
+
|
|
2396
|
+
if (onMouseLeave) {
|
|
2397
|
+
onMouseLeave(e);
|
|
2398
|
+
}
|
|
2399
|
+
};
|
|
2400
|
+
|
|
2401
|
+
_this.renderPicker = function (locale, localeCode) {
|
|
2402
|
+
var _this$props = _this.props,
|
|
2403
|
+
format = _this$props.format,
|
|
2404
|
+
showTime = _this$props.showTime;
|
|
2405
|
+
var mergedPickerType = showTime ? "".concat(pickerType, "Time") : pickerType;
|
|
2406
|
+
var mergedFormat = format || locale[LOCALE_FORMAT_MAPPING[mergedPickerType]] || DEFAULT_FORMAT[mergedPickerType];
|
|
2407
|
+
return /*#__PURE__*/React.createElement(ConfigConsumer, null, function (_ref2) {
|
|
2408
|
+
var _classNames2;
|
|
2409
|
+
|
|
2410
|
+
var getPrefixCls = _ref2.getPrefixCls,
|
|
2411
|
+
getContextPopupContainer = _ref2.getPopupContainer;
|
|
2412
|
+
var _this$props2 = _this.props,
|
|
2413
|
+
customizePrefixCls = _this$props2.prefixCls,
|
|
2414
|
+
customizeInputPrefixCls = _this$props2.inputPrefixCls,
|
|
2415
|
+
getCalendarContainer = _this$props2.getCalendarContainer,
|
|
2416
|
+
size = _this$props2.size,
|
|
2417
|
+
disabled = _this$props2.disabled;
|
|
2418
|
+
var getPopupContainer = getCalendarContainer || getContextPopupContainer;
|
|
2419
|
+
var prefixCls = getPrefixCls('calendar', customizePrefixCls);
|
|
2420
|
+
var inputPrefixCls = getPrefixCls('input', customizeInputPrefixCls);
|
|
2421
|
+
var pickerClass = classNames("".concat(prefixCls, "-picker"), _defineProperty$2({}, "".concat(prefixCls, "-picker-").concat(size), !!size));
|
|
2422
|
+
var pickerInputClass = classNames("".concat(prefixCls, "-picker-input"), inputPrefixCls, (_classNames2 = {}, _defineProperty$2(_classNames2, "".concat(inputPrefixCls, "-lg"), size === 'large'), _defineProperty$2(_classNames2, "".concat(inputPrefixCls, "-sm"), size === 'small'), _defineProperty$2(_classNames2, "".concat(inputPrefixCls, "-disabled"), disabled), _classNames2));
|
|
2423
|
+
var timeFormat = showTime && showTime.format || 'HH:mm:ss';
|
|
2424
|
+
|
|
2425
|
+
var rcTimePickerProps = _extends$3(_extends$3({}, generateShowHourMinuteSecond(timeFormat)), {
|
|
2426
|
+
format: timeFormat,
|
|
2427
|
+
use12Hours: showTime && showTime.use12Hours
|
|
2428
|
+
});
|
|
2429
|
+
|
|
2430
|
+
var columns = getColumns(rcTimePickerProps);
|
|
2431
|
+
var timePickerCls = "".concat(prefixCls, "-time-picker-column-").concat(columns);
|
|
2432
|
+
var timePicker = showTime ? /*#__PURE__*/React.createElement(Panel, _extends$3({}, rcTimePickerProps, showTime, {
|
|
2433
|
+
prefixCls: "".concat(prefixCls, "-time-picker"),
|
|
2434
|
+
className: timePickerCls,
|
|
2435
|
+
placeholder: locale.timePickerLocale.placeholder,
|
|
2436
|
+
transitionName: "slide-up",
|
|
2437
|
+
onEsc: function onEsc() {}
|
|
2438
|
+
})) : null;
|
|
2439
|
+
return /*#__PURE__*/React.createElement(Picker, _extends$3({}, _this.props, {
|
|
2440
|
+
getCalendarContainer: getPopupContainer,
|
|
2441
|
+
format: mergedFormat,
|
|
2442
|
+
ref: _this.savePicker,
|
|
2443
|
+
pickerClass: pickerClass,
|
|
2444
|
+
pickerInputClass: pickerInputClass,
|
|
2445
|
+
locale: locale,
|
|
2446
|
+
localeCode: localeCode,
|
|
2447
|
+
timePicker: timePicker,
|
|
2448
|
+
onOpenChange: _this.handleOpenChange,
|
|
2449
|
+
onFocus: _this.handleFocus,
|
|
2450
|
+
onBlur: _this.handleBlur,
|
|
2451
|
+
onMouseEnter: _this.handleMouseEnter,
|
|
2452
|
+
onMouseLeave: _this.handleMouseLeave
|
|
2453
|
+
}));
|
|
2454
|
+
});
|
|
2455
|
+
};
|
|
2456
|
+
|
|
2457
|
+
return _this;
|
|
2458
|
+
}
|
|
2459
|
+
|
|
2460
|
+
_createClass$2(PickerWrapper, [{
|
|
2461
|
+
key: "componentDidMount",
|
|
2462
|
+
value: function componentDidMount() {
|
|
2463
|
+
var _this$props3 = this.props,
|
|
2464
|
+
autoFocus = _this$props3.autoFocus,
|
|
2465
|
+
disabled = _this$props3.disabled;
|
|
2466
|
+
|
|
2467
|
+
if (autoFocus && !disabled) {
|
|
2468
|
+
this.focus();
|
|
2469
|
+
}
|
|
2470
|
+
}
|
|
2471
|
+
}, {
|
|
2472
|
+
key: "focus",
|
|
2473
|
+
value: function focus() {
|
|
2474
|
+
this.picker.focus();
|
|
2475
|
+
}
|
|
2476
|
+
}, {
|
|
2477
|
+
key: "blur",
|
|
2478
|
+
value: function blur() {
|
|
2479
|
+
this.picker.blur();
|
|
2480
|
+
}
|
|
2481
|
+
}, {
|
|
2482
|
+
key: "render",
|
|
2483
|
+
value: function render() {
|
|
2484
|
+
return /*#__PURE__*/React.createElement(LocaleReceiver, {
|
|
2485
|
+
componentName: "DatePicker",
|
|
2486
|
+
defaultLocale: this.getDefaultLocale
|
|
2487
|
+
}, this.renderPicker);
|
|
2488
|
+
}
|
|
2489
|
+
}], [{
|
|
2490
|
+
key: "getDerivedStateFromProps",
|
|
2491
|
+
value: function getDerivedStateFromProps(_ref3) {
|
|
2492
|
+
var value = _ref3.value,
|
|
2493
|
+
defaultValue = _ref3.defaultValue;
|
|
2494
|
+
checkValidate(defaultValue);
|
|
2495
|
+
checkValidate(value);
|
|
2496
|
+
return {};
|
|
2497
|
+
}
|
|
2498
|
+
}]);
|
|
2499
|
+
|
|
2500
|
+
return PickerWrapper;
|
|
2501
|
+
}(React.Component);
|
|
2502
|
+
|
|
2503
|
+
PickerWrapper.defaultProps = {
|
|
2504
|
+
transitionName: 'slide-up',
|
|
2505
|
+
popupStyle: {},
|
|
2506
|
+
onChange: function onChange() {},
|
|
2507
|
+
onOk: function onOk() {},
|
|
2508
|
+
onOpenChange: function onOpenChange() {},
|
|
2509
|
+
locale: {}
|
|
2510
|
+
};
|
|
2511
|
+
polyfill(PickerWrapper);
|
|
2512
|
+
return PickerWrapper;
|
|
2513
|
+
}
|
|
2514
|
+
|
|
2515
|
+
var CalendarPart = function (_React$Component) {
|
|
2516
|
+
_inherits$4(CalendarPart, _React$Component);
|
|
2517
|
+
|
|
2518
|
+
function CalendarPart() {
|
|
2519
|
+
_classCallCheck$4(this, CalendarPart);
|
|
2520
|
+
|
|
2521
|
+
return _possibleConstructorReturn$4(this, _React$Component.apply(this, arguments));
|
|
2522
|
+
}
|
|
2523
|
+
|
|
2524
|
+
CalendarPart.prototype.render = function render() {
|
|
2525
|
+
var props = this.props;
|
|
2526
|
+
var prefixCls = props.prefixCls,
|
|
2527
|
+
value = props.value,
|
|
2528
|
+
hoverValue = props.hoverValue,
|
|
2529
|
+
selectedValue = props.selectedValue,
|
|
2530
|
+
mode = props.mode,
|
|
2531
|
+
direction = props.direction,
|
|
2532
|
+
locale = props.locale,
|
|
2533
|
+
format = props.format,
|
|
2534
|
+
placeholder = props.placeholder,
|
|
2535
|
+
disabledDate = props.disabledDate,
|
|
2536
|
+
timePicker = props.timePicker,
|
|
2537
|
+
disabledTime = props.disabledTime,
|
|
2538
|
+
timePickerDisabledTime = props.timePickerDisabledTime,
|
|
2539
|
+
showTimePicker = props.showTimePicker,
|
|
2540
|
+
onInputChange = props.onInputChange,
|
|
2541
|
+
onInputSelect = props.onInputSelect,
|
|
2542
|
+
enablePrev = props.enablePrev,
|
|
2543
|
+
enableNext = props.enableNext,
|
|
2544
|
+
clearIcon = props.clearIcon,
|
|
2545
|
+
showClear = props.showClear,
|
|
2546
|
+
inputMode = props.inputMode;
|
|
2547
|
+
|
|
2548
|
+
var shouldShowTimePicker = showTimePicker && timePicker;
|
|
2549
|
+
var disabledTimeConfig = shouldShowTimePicker && disabledTime ? getTimeConfig(selectedValue, disabledTime) : null;
|
|
2550
|
+
var rangeClassName = prefixCls + '-range';
|
|
2551
|
+
var newProps = {
|
|
2552
|
+
locale: locale,
|
|
2553
|
+
value: value,
|
|
2554
|
+
prefixCls: prefixCls,
|
|
2555
|
+
showTimePicker: showTimePicker
|
|
2556
|
+
};
|
|
2557
|
+
var index = direction === 'left' ? 0 : 1;
|
|
2558
|
+
var timePickerEle = shouldShowTimePicker && React__default.cloneElement(timePicker, _extends$5({
|
|
2559
|
+
showHour: true,
|
|
2560
|
+
showMinute: true,
|
|
2561
|
+
showSecond: true
|
|
2562
|
+
}, timePicker.props, disabledTimeConfig, timePickerDisabledTime, {
|
|
2563
|
+
onChange: onInputChange,
|
|
2564
|
+
defaultOpenValue: value,
|
|
2565
|
+
value: selectedValue[index]
|
|
2566
|
+
}));
|
|
2567
|
+
|
|
2568
|
+
var dateInputElement = props.showDateInput && React__default.createElement(DateInput, {
|
|
2569
|
+
format: format,
|
|
2570
|
+
locale: locale,
|
|
2571
|
+
prefixCls: prefixCls,
|
|
2572
|
+
timePicker: timePicker,
|
|
2573
|
+
disabledDate: disabledDate,
|
|
2574
|
+
placeholder: placeholder,
|
|
2575
|
+
disabledTime: disabledTime,
|
|
2576
|
+
value: value,
|
|
2577
|
+
showClear: showClear || false,
|
|
2578
|
+
selectedValue: selectedValue[index],
|
|
2579
|
+
onChange: onInputChange,
|
|
2580
|
+
onSelect: onInputSelect,
|
|
2581
|
+
clearIcon: clearIcon,
|
|
2582
|
+
inputMode: inputMode
|
|
2583
|
+
});
|
|
2584
|
+
|
|
2585
|
+
return React__default.createElement(
|
|
2586
|
+
'div',
|
|
2587
|
+
{
|
|
2588
|
+
className: rangeClassName + '-part ' + rangeClassName + '-' + direction
|
|
2589
|
+
},
|
|
2590
|
+
dateInputElement,
|
|
2591
|
+
React__default.createElement(
|
|
2592
|
+
'div',
|
|
2593
|
+
{ style: { outline: 'none' } },
|
|
2594
|
+
React__default.createElement(CalendarHeader, _extends$5({}, newProps, {
|
|
2595
|
+
mode: mode,
|
|
2596
|
+
enableNext: enableNext,
|
|
2597
|
+
enablePrev: enablePrev,
|
|
2598
|
+
onValueChange: props.onValueChange,
|
|
2599
|
+
onPanelChange: props.onPanelChange,
|
|
2600
|
+
disabledMonth: props.disabledMonth
|
|
2601
|
+
})),
|
|
2602
|
+
showTimePicker ? React__default.createElement(
|
|
2603
|
+
'div',
|
|
2604
|
+
{ className: prefixCls + '-time-picker' },
|
|
2605
|
+
React__default.createElement(
|
|
2606
|
+
'div',
|
|
2607
|
+
{ className: prefixCls + '-time-picker-panel' },
|
|
2608
|
+
timePickerEle
|
|
2609
|
+
)
|
|
2610
|
+
) : null,
|
|
2611
|
+
React__default.createElement(
|
|
2612
|
+
'div',
|
|
2613
|
+
{ className: prefixCls + '-body' },
|
|
2614
|
+
React__default.createElement(DateTable, _extends$5({}, newProps, {
|
|
2615
|
+
hoverValue: hoverValue,
|
|
2616
|
+
selectedValue: selectedValue,
|
|
2617
|
+
dateRender: props.dateRender,
|
|
2618
|
+
onSelect: props.onSelect,
|
|
2619
|
+
onDayHover: props.onDayHover,
|
|
2620
|
+
disabledDate: disabledDate,
|
|
2621
|
+
showWeekNumber: props.showWeekNumber
|
|
2622
|
+
}))
|
|
2623
|
+
)
|
|
2624
|
+
)
|
|
2625
|
+
);
|
|
2626
|
+
};
|
|
2627
|
+
|
|
2628
|
+
return CalendarPart;
|
|
2629
|
+
}(React__default.Component);
|
|
2630
|
+
|
|
2631
|
+
CalendarPart.propTypes = {
|
|
2632
|
+
prefixCls: PropTypes.string,
|
|
2633
|
+
value: PropTypes.any,
|
|
2634
|
+
hoverValue: PropTypes.any,
|
|
2635
|
+
selectedValue: PropTypes.any,
|
|
2636
|
+
direction: PropTypes.any,
|
|
2637
|
+
locale: PropTypes.any,
|
|
2638
|
+
showDateInput: PropTypes.bool,
|
|
2639
|
+
showTimePicker: PropTypes.bool,
|
|
2640
|
+
format: PropTypes.any,
|
|
2641
|
+
placeholder: PropTypes.any,
|
|
2642
|
+
disabledDate: PropTypes.any,
|
|
2643
|
+
timePicker: PropTypes.any,
|
|
2644
|
+
disabledTime: PropTypes.any,
|
|
2645
|
+
onInputChange: PropTypes.func,
|
|
2646
|
+
onInputSelect: PropTypes.func,
|
|
2647
|
+
timePickerDisabledTime: PropTypes.object,
|
|
2648
|
+
enableNext: PropTypes.any,
|
|
2649
|
+
enablePrev: PropTypes.any,
|
|
2650
|
+
clearIcon: PropTypes.node,
|
|
2651
|
+
dateRender: PropTypes.func,
|
|
2652
|
+
inputMode: PropTypes.string
|
|
2653
|
+
};
|
|
2654
|
+
|
|
2655
|
+
function noop() {}
|
|
2656
|
+
|
|
2657
|
+
function isEmptyArray$1(arr) {
|
|
2658
|
+
return Array.isArray(arr) && (arr.length === 0 || arr.every(function (i) {
|
|
2659
|
+
return !i;
|
|
2660
|
+
}));
|
|
2661
|
+
}
|
|
2662
|
+
|
|
2663
|
+
function isArraysEqual(a, b) {
|
|
2664
|
+
if (a === b) return true;
|
|
2665
|
+
if (a === null || typeof a === 'undefined' || b === null || typeof b === 'undefined') {
|
|
2666
|
+
return false;
|
|
2667
|
+
}
|
|
2668
|
+
if (a.length !== b.length) return false;
|
|
2669
|
+
|
|
2670
|
+
for (var i = 0; i < a.length; ++i) {
|
|
2671
|
+
if (a[i] !== b[i]) return false;
|
|
2672
|
+
}
|
|
2673
|
+
return true;
|
|
2674
|
+
}
|
|
2675
|
+
|
|
2676
|
+
function getValueFromSelectedValue(selectedValue) {
|
|
2677
|
+
var start = selectedValue[0],
|
|
2678
|
+
end = selectedValue[1];
|
|
2679
|
+
|
|
2680
|
+
if (end && (start === undefined || start === null)) {
|
|
2681
|
+
start = end.clone().subtract(1, 'month');
|
|
2682
|
+
}
|
|
2683
|
+
|
|
2684
|
+
if (start && (end === undefined || end === null)) {
|
|
2685
|
+
end = start.clone().add(1, 'month');
|
|
2686
|
+
}
|
|
2687
|
+
return [start, end];
|
|
2688
|
+
}
|
|
2689
|
+
|
|
2690
|
+
function normalizeAnchor(props, init) {
|
|
2691
|
+
var selectedValue = props.selectedValue || init && props.defaultSelectedValue;
|
|
2692
|
+
var value = props.value || init && props.defaultValue;
|
|
2693
|
+
var normalizedValue = value ? getValueFromSelectedValue(value) : getValueFromSelectedValue(selectedValue);
|
|
2694
|
+
return !isEmptyArray$1(normalizedValue) ? normalizedValue : init && [moment(), moment().add(1, 'months')];
|
|
2695
|
+
}
|
|
2696
|
+
|
|
2697
|
+
function generateOptions(length, extraOptionGen) {
|
|
2698
|
+
var arr = extraOptionGen ? extraOptionGen().concat() : [];
|
|
2699
|
+
for (var value = 0; value < length; value++) {
|
|
2700
|
+
if (arr.indexOf(value) === -1) {
|
|
2701
|
+
arr.push(value);
|
|
2702
|
+
}
|
|
2703
|
+
}
|
|
2704
|
+
return arr;
|
|
2705
|
+
}
|
|
2706
|
+
|
|
2707
|
+
function onInputSelect(direction, value, cause) {
|
|
2708
|
+
if (!value) {
|
|
2709
|
+
return;
|
|
2710
|
+
}
|
|
2711
|
+
var originalValue = this.state.selectedValue;
|
|
2712
|
+
var selectedValue = originalValue.concat();
|
|
2713
|
+
var index = direction === 'left' ? 0 : 1;
|
|
2714
|
+
selectedValue[index] = value;
|
|
2715
|
+
if (selectedValue[0] && this.compare(selectedValue[0], selectedValue[1]) > 0) {
|
|
2716
|
+
selectedValue[1 - index] = this.state.showTimePicker ? selectedValue[index] : undefined;
|
|
2717
|
+
}
|
|
2718
|
+
this.props.onInputSelect(selectedValue);
|
|
2719
|
+
this.fireSelectValueChange(selectedValue, null, cause || { source: 'dateInput' });
|
|
2720
|
+
}
|
|
2721
|
+
|
|
2722
|
+
var RangeCalendar = function (_React$Component) {
|
|
2723
|
+
_inherits$4(RangeCalendar, _React$Component);
|
|
2724
|
+
|
|
2725
|
+
function RangeCalendar(props) {
|
|
2726
|
+
_classCallCheck$4(this, RangeCalendar);
|
|
2727
|
+
|
|
2728
|
+
var _this = _possibleConstructorReturn$4(this, _React$Component.call(this, props));
|
|
2729
|
+
|
|
2730
|
+
_initialiseProps.call(_this);
|
|
2731
|
+
|
|
2732
|
+
var selectedValue = props.selectedValue || props.defaultSelectedValue;
|
|
2733
|
+
var value = normalizeAnchor(props, 1);
|
|
2734
|
+
_this.state = {
|
|
2735
|
+
selectedValue: selectedValue,
|
|
2736
|
+
prevSelectedValue: selectedValue,
|
|
2737
|
+
firstSelectedValue: null,
|
|
2738
|
+
hoverValue: props.hoverValue || [],
|
|
2739
|
+
value: value,
|
|
2740
|
+
showTimePicker: false,
|
|
2741
|
+
mode: props.mode || ['date', 'date'],
|
|
2742
|
+
panelTriggerSource: '' // Trigger by which picker panel: 'start' & 'end'
|
|
2743
|
+
};
|
|
2744
|
+
return _this;
|
|
2745
|
+
}
|
|
2746
|
+
|
|
2747
|
+
RangeCalendar.getDerivedStateFromProps = function getDerivedStateFromProps(nextProps, state) {
|
|
2748
|
+
var newState = {};
|
|
2749
|
+
if ('value' in nextProps) {
|
|
2750
|
+
newState.value = normalizeAnchor(nextProps, 0);
|
|
2751
|
+
}
|
|
2752
|
+
if ('hoverValue' in nextProps && !isArraysEqual(state.hoverValue, nextProps.hoverValue)) {
|
|
2753
|
+
newState.hoverValue = nextProps.hoverValue;
|
|
2754
|
+
}
|
|
2755
|
+
if ('selectedValue' in nextProps) {
|
|
2756
|
+
newState.selectedValue = nextProps.selectedValue;
|
|
2757
|
+
newState.prevSelectedValue = nextProps.selectedValue;
|
|
2758
|
+
}
|
|
2759
|
+
if ('mode' in nextProps && !isArraysEqual(state.mode, nextProps.mode)) {
|
|
2760
|
+
newState.mode = nextProps.mode;
|
|
2761
|
+
}
|
|
2762
|
+
return newState;
|
|
2763
|
+
};
|
|
2764
|
+
|
|
2765
|
+
// get disabled hours for second picker
|
|
2766
|
+
|
|
2767
|
+
|
|
2768
|
+
RangeCalendar.prototype.render = function render() {
|
|
2769
|
+
var _className, _classnames;
|
|
2770
|
+
|
|
2771
|
+
var props = this.props,
|
|
2772
|
+
state = this.state;
|
|
2773
|
+
var prefixCls = props.prefixCls,
|
|
2774
|
+
dateInputPlaceholder = props.dateInputPlaceholder,
|
|
2775
|
+
seperator = props.seperator,
|
|
2776
|
+
timePicker = props.timePicker,
|
|
2777
|
+
showOk = props.showOk,
|
|
2778
|
+
locale = props.locale,
|
|
2779
|
+
showClear = props.showClear,
|
|
2780
|
+
showToday = props.showToday,
|
|
2781
|
+
type = props.type,
|
|
2782
|
+
clearIcon = props.clearIcon;
|
|
2783
|
+
var hoverValue = state.hoverValue,
|
|
2784
|
+
selectedValue = state.selectedValue,
|
|
2785
|
+
mode = state.mode,
|
|
2786
|
+
showTimePicker = state.showTimePicker;
|
|
2787
|
+
|
|
2788
|
+
var className = (_className = {}, _className[props.className] = !!props.className, _className[prefixCls] = 1, _className[prefixCls + '-hidden'] = !props.visible, _className[prefixCls + '-range'] = 1, _className[prefixCls + '-show-time-picker'] = showTimePicker, _className[prefixCls + '-week-number'] = props.showWeekNumber, _className);
|
|
2789
|
+
var classes = classNames(className);
|
|
2790
|
+
var newProps = {
|
|
2791
|
+
selectedValue: state.selectedValue,
|
|
2792
|
+
onSelect: this.onSelect,
|
|
2793
|
+
onDayHover: type === 'start' && selectedValue[1] || type === 'end' && selectedValue[0] || !!hoverValue.length ? this.onDayHover : undefined
|
|
2794
|
+
};
|
|
2795
|
+
|
|
2796
|
+
var placeholder1 = void 0;
|
|
2797
|
+
var placeholder2 = void 0;
|
|
2798
|
+
|
|
2799
|
+
if (dateInputPlaceholder) {
|
|
2800
|
+
if (Array.isArray(dateInputPlaceholder)) {
|
|
2801
|
+
placeholder1 = dateInputPlaceholder[0];
|
|
2802
|
+
placeholder2 = dateInputPlaceholder[1];
|
|
2803
|
+
} else {
|
|
2804
|
+
placeholder1 = placeholder2 = dateInputPlaceholder;
|
|
2805
|
+
}
|
|
2806
|
+
}
|
|
2807
|
+
var showOkButton = showOk === true || showOk !== false && !!timePicker;
|
|
2808
|
+
var cls = classNames((_classnames = {}, _classnames[prefixCls + '-footer'] = true, _classnames[prefixCls + '-range-bottom'] = true, _classnames[prefixCls + '-footer-show-ok'] = showOkButton, _classnames));
|
|
2809
|
+
|
|
2810
|
+
var startValue = this.getStartValue();
|
|
2811
|
+
var endValue = this.getEndValue();
|
|
2812
|
+
var todayTime = getTodayTime(startValue);
|
|
2813
|
+
var thisMonth = todayTime.month();
|
|
2814
|
+
var thisYear = todayTime.year();
|
|
2815
|
+
var isTodayInView = startValue.year() === thisYear && startValue.month() === thisMonth || endValue.year() === thisYear && endValue.month() === thisMonth;
|
|
2816
|
+
var nextMonthOfStart = startValue.clone().add(1, 'months');
|
|
2817
|
+
var isClosestMonths = nextMonthOfStart.year() === endValue.year() && nextMonthOfStart.month() === endValue.month();
|
|
2818
|
+
|
|
2819
|
+
var extraFooter = props.renderFooter();
|
|
2820
|
+
|
|
2821
|
+
return React__default.createElement(
|
|
2822
|
+
'div',
|
|
2823
|
+
{
|
|
2824
|
+
ref: this.saveRoot,
|
|
2825
|
+
className: classes,
|
|
2826
|
+
style: props.style,
|
|
2827
|
+
tabIndex: '0',
|
|
2828
|
+
onKeyDown: this.onKeyDown
|
|
2829
|
+
},
|
|
2830
|
+
props.renderSidebar(),
|
|
2831
|
+
React__default.createElement(
|
|
2832
|
+
'div',
|
|
2833
|
+
{ className: prefixCls + '-panel' },
|
|
2834
|
+
showClear && selectedValue[0] && selectedValue[1] ? React__default.createElement(
|
|
2835
|
+
'a',
|
|
2836
|
+
{
|
|
2837
|
+
role: 'button',
|
|
2838
|
+
title: locale.clear,
|
|
2839
|
+
onClick: this.clear
|
|
2840
|
+
},
|
|
2841
|
+
clearIcon || React__default.createElement('span', { className: prefixCls + '-clear-btn' })
|
|
2842
|
+
) : null,
|
|
2843
|
+
React__default.createElement(
|
|
2844
|
+
'div',
|
|
2845
|
+
{
|
|
2846
|
+
className: prefixCls + '-date-panel',
|
|
2847
|
+
onMouseLeave: type !== 'both' ? this.onDatePanelLeave : undefined,
|
|
2848
|
+
onMouseEnter: type !== 'both' ? this.onDatePanelEnter : undefined
|
|
2849
|
+
},
|
|
2850
|
+
React__default.createElement(CalendarPart, _extends$5({}, props, newProps, {
|
|
2851
|
+
hoverValue: hoverValue,
|
|
2852
|
+
direction: 'left',
|
|
2853
|
+
disabledTime: this.disabledStartTime,
|
|
2854
|
+
disabledMonth: this.disabledStartMonth,
|
|
2855
|
+
format: this.getFormat(),
|
|
2856
|
+
value: startValue,
|
|
2857
|
+
mode: mode[0],
|
|
2858
|
+
placeholder: placeholder1,
|
|
2859
|
+
onInputChange: this.onStartInputChange,
|
|
2860
|
+
onInputSelect: this.onStartInputSelect,
|
|
2861
|
+
onValueChange: this.onStartValueChange,
|
|
2862
|
+
onPanelChange: this.onStartPanelChange,
|
|
2863
|
+
showDateInput: this.props.showDateInput,
|
|
2864
|
+
timePicker: timePicker,
|
|
2865
|
+
showTimePicker: showTimePicker || mode[0] === 'time',
|
|
2866
|
+
enablePrev: true,
|
|
2867
|
+
enableNext: !isClosestMonths || this.isMonthYearPanelShow(mode[1]),
|
|
2868
|
+
clearIcon: clearIcon
|
|
2869
|
+
})),
|
|
2870
|
+
React__default.createElement(
|
|
2871
|
+
'span',
|
|
2872
|
+
{ className: prefixCls + '-range-middle' },
|
|
2873
|
+
seperator
|
|
2874
|
+
),
|
|
2875
|
+
React__default.createElement(CalendarPart, _extends$5({}, props, newProps, {
|
|
2876
|
+
hoverValue: hoverValue,
|
|
2877
|
+
direction: 'right',
|
|
2878
|
+
format: this.getFormat(),
|
|
2879
|
+
timePickerDisabledTime: this.getEndDisableTime(),
|
|
2880
|
+
placeholder: placeholder2,
|
|
2881
|
+
value: endValue,
|
|
2882
|
+
mode: mode[1],
|
|
2883
|
+
onInputChange: this.onEndInputChange,
|
|
2884
|
+
onInputSelect: this.onEndInputSelect,
|
|
2885
|
+
onValueChange: this.onEndValueChange,
|
|
2886
|
+
onPanelChange: this.onEndPanelChange,
|
|
2887
|
+
showDateInput: this.props.showDateInput,
|
|
2888
|
+
timePicker: timePicker,
|
|
2889
|
+
showTimePicker: showTimePicker || mode[1] === 'time',
|
|
2890
|
+
disabledTime: this.disabledEndTime,
|
|
2891
|
+
disabledMonth: this.disabledEndMonth,
|
|
2892
|
+
enablePrev: !isClosestMonths || this.isMonthYearPanelShow(mode[0]),
|
|
2893
|
+
enableNext: true,
|
|
2894
|
+
clearIcon: clearIcon
|
|
2895
|
+
}))
|
|
2896
|
+
),
|
|
2897
|
+
React__default.createElement(
|
|
2898
|
+
'div',
|
|
2899
|
+
{ className: cls },
|
|
2900
|
+
showToday || props.timePicker || showOkButton || extraFooter ? React__default.createElement(
|
|
2901
|
+
'div',
|
|
2902
|
+
{ className: prefixCls + '-footer-btn' },
|
|
2903
|
+
extraFooter,
|
|
2904
|
+
showToday ? React__default.createElement(TodayButton, _extends$5({}, props, {
|
|
2905
|
+
disabled: isTodayInView,
|
|
2906
|
+
value: state.value[0],
|
|
2907
|
+
onToday: this.onToday,
|
|
2908
|
+
text: locale.backToToday
|
|
2909
|
+
})) : null,
|
|
2910
|
+
props.timePicker ? React__default.createElement(TimePickerButton, _extends$5({}, props, {
|
|
2911
|
+
showTimePicker: showTimePicker || mode[0] === 'time' && mode[1] === 'time',
|
|
2912
|
+
onOpenTimePicker: this.onOpenTimePicker,
|
|
2913
|
+
onCloseTimePicker: this.onCloseTimePicker,
|
|
2914
|
+
timePickerDisabled: !this.hasSelectedValue() || hoverValue.length
|
|
2915
|
+
})) : null,
|
|
2916
|
+
showOkButton ? React__default.createElement(OkButton, _extends$5({}, props, {
|
|
2917
|
+
onOk: this.onOk,
|
|
2918
|
+
okDisabled: !this.isAllowedDateAndTime(selectedValue) || !this.hasSelectedValue() || hoverValue.length
|
|
2919
|
+
})) : null
|
|
2920
|
+
) : null
|
|
2921
|
+
)
|
|
2922
|
+
)
|
|
2923
|
+
);
|
|
2924
|
+
};
|
|
2925
|
+
|
|
2926
|
+
return RangeCalendar;
|
|
2927
|
+
}(React__default.Component);
|
|
2928
|
+
|
|
2929
|
+
RangeCalendar.propTypes = _extends$5({}, propType, {
|
|
2930
|
+
prefixCls: PropTypes.string,
|
|
2931
|
+
dateInputPlaceholder: PropTypes.any,
|
|
2932
|
+
seperator: PropTypes.string,
|
|
2933
|
+
defaultValue: PropTypes.any,
|
|
2934
|
+
value: PropTypes.any,
|
|
2935
|
+
hoverValue: PropTypes.any,
|
|
2936
|
+
mode: PropTypes.arrayOf(PropTypes.oneOf(['time', 'date', 'month', 'year', 'decade'])),
|
|
2937
|
+
showDateInput: PropTypes.bool,
|
|
2938
|
+
timePicker: PropTypes.any,
|
|
2939
|
+
showOk: PropTypes.bool,
|
|
2940
|
+
showToday: PropTypes.bool,
|
|
2941
|
+
defaultSelectedValue: PropTypes.array,
|
|
2942
|
+
selectedValue: PropTypes.array,
|
|
2943
|
+
onOk: PropTypes.func,
|
|
2944
|
+
showClear: PropTypes.bool,
|
|
2945
|
+
locale: PropTypes.object,
|
|
2946
|
+
onChange: PropTypes.func,
|
|
2947
|
+
onSelect: PropTypes.func,
|
|
2948
|
+
onValueChange: PropTypes.func,
|
|
2949
|
+
onHoverChange: PropTypes.func,
|
|
2950
|
+
onPanelChange: PropTypes.func,
|
|
2951
|
+
format: PropTypes.oneOfType([PropTypes.string, PropTypes.arrayOf(PropTypes.string)]),
|
|
2952
|
+
onClear: PropTypes.func,
|
|
2953
|
+
type: PropTypes.any,
|
|
2954
|
+
disabledDate: PropTypes.func,
|
|
2955
|
+
disabledTime: PropTypes.func,
|
|
2956
|
+
clearIcon: PropTypes.node,
|
|
2957
|
+
onKeyDown: PropTypes.func
|
|
2958
|
+
});
|
|
2959
|
+
RangeCalendar.defaultProps = _extends$5({}, defaultProp, {
|
|
2960
|
+
type: 'both',
|
|
2961
|
+
seperator: '~',
|
|
2962
|
+
defaultSelectedValue: [],
|
|
2963
|
+
onValueChange: noop,
|
|
2964
|
+
onHoverChange: noop,
|
|
2965
|
+
onPanelChange: noop,
|
|
2966
|
+
disabledTime: noop,
|
|
2967
|
+
onInputSelect: noop,
|
|
2968
|
+
showToday: true,
|
|
2969
|
+
showDateInput: true
|
|
2970
|
+
});
|
|
2971
|
+
|
|
2972
|
+
var _initialiseProps = function _initialiseProps() {
|
|
2973
|
+
var _this2 = this;
|
|
2974
|
+
|
|
2975
|
+
this.onDatePanelEnter = function () {
|
|
2976
|
+
if (_this2.hasSelectedValue()) {
|
|
2977
|
+
_this2.fireHoverValueChange(_this2.state.selectedValue.concat());
|
|
2978
|
+
}
|
|
2979
|
+
};
|
|
2980
|
+
|
|
2981
|
+
this.onDatePanelLeave = function () {
|
|
2982
|
+
if (_this2.hasSelectedValue()) {
|
|
2983
|
+
_this2.fireHoverValueChange([]);
|
|
2984
|
+
}
|
|
2985
|
+
};
|
|
2986
|
+
|
|
2987
|
+
this.onSelect = function (value) {
|
|
2988
|
+
var type = _this2.props.type;
|
|
2989
|
+
var _state = _this2.state,
|
|
2990
|
+
selectedValue = _state.selectedValue,
|
|
2991
|
+
prevSelectedValue = _state.prevSelectedValue,
|
|
2992
|
+
firstSelectedValue = _state.firstSelectedValue;
|
|
2993
|
+
|
|
2994
|
+
var nextSelectedValue = void 0;
|
|
2995
|
+
if (type === 'both') {
|
|
2996
|
+
if (!firstSelectedValue) {
|
|
2997
|
+
syncTime(prevSelectedValue[0], value);
|
|
2998
|
+
nextSelectedValue = [value];
|
|
2999
|
+
} else if (_this2.compare(firstSelectedValue, value) < 0) {
|
|
3000
|
+
syncTime(prevSelectedValue[1], value);
|
|
3001
|
+
nextSelectedValue = [firstSelectedValue, value];
|
|
3002
|
+
} else {
|
|
3003
|
+
syncTime(prevSelectedValue[0], value);
|
|
3004
|
+
syncTime(prevSelectedValue[1], firstSelectedValue);
|
|
3005
|
+
nextSelectedValue = [value, firstSelectedValue];
|
|
3006
|
+
}
|
|
3007
|
+
} else if (type === 'start') {
|
|
3008
|
+
syncTime(prevSelectedValue[0], value);
|
|
3009
|
+
var endValue = selectedValue[1];
|
|
3010
|
+
nextSelectedValue = endValue && _this2.compare(endValue, value) > 0 ? [value, endValue] : [value];
|
|
3011
|
+
} else {
|
|
3012
|
+
// type === 'end'
|
|
3013
|
+
var startValue = selectedValue[0];
|
|
3014
|
+
if (startValue && _this2.compare(startValue, value) <= 0) {
|
|
3015
|
+
syncTime(prevSelectedValue[1], value);
|
|
3016
|
+
nextSelectedValue = [startValue, value];
|
|
3017
|
+
} else {
|
|
3018
|
+
syncTime(prevSelectedValue[0], value);
|
|
3019
|
+
nextSelectedValue = [value];
|
|
3020
|
+
}
|
|
3021
|
+
}
|
|
3022
|
+
|
|
3023
|
+
_this2.fireSelectValueChange(nextSelectedValue);
|
|
3024
|
+
};
|
|
3025
|
+
|
|
3026
|
+
this.onKeyDown = function (event) {
|
|
3027
|
+
if (event.target.nodeName.toLowerCase() === 'input') {
|
|
3028
|
+
return;
|
|
3029
|
+
}
|
|
3030
|
+
|
|
3031
|
+
var keyCode = event.keyCode;
|
|
3032
|
+
|
|
3033
|
+
var ctrlKey = event.ctrlKey || event.metaKey;
|
|
3034
|
+
|
|
3035
|
+
var _state2 = _this2.state,
|
|
3036
|
+
selectedValue = _state2.selectedValue,
|
|
3037
|
+
hoverValue = _state2.hoverValue,
|
|
3038
|
+
firstSelectedValue = _state2.firstSelectedValue,
|
|
3039
|
+
value = _state2.value;
|
|
3040
|
+
var _props = _this2.props,
|
|
3041
|
+
onKeyDown = _props.onKeyDown,
|
|
3042
|
+
disabledDate = _props.disabledDate;
|
|
3043
|
+
|
|
3044
|
+
// Update last time of the picker
|
|
3045
|
+
|
|
3046
|
+
var updateHoverPoint = function updateHoverPoint(func) {
|
|
3047
|
+
// Change hover to make focus in UI
|
|
3048
|
+
var currentHoverTime = void 0;
|
|
3049
|
+
var nextHoverTime = void 0;
|
|
3050
|
+
var nextHoverValue = void 0;
|
|
3051
|
+
|
|
3052
|
+
if (!firstSelectedValue) {
|
|
3053
|
+
currentHoverTime = hoverValue[0] || selectedValue[0] || value[0] || moment();
|
|
3054
|
+
nextHoverTime = func(currentHoverTime);
|
|
3055
|
+
nextHoverValue = [nextHoverTime];
|
|
3056
|
+
_this2.fireHoverValueChange(nextHoverValue);
|
|
3057
|
+
} else {
|
|
3058
|
+
if (hoverValue.length === 1) {
|
|
3059
|
+
currentHoverTime = hoverValue[0].clone();
|
|
3060
|
+
nextHoverTime = func(currentHoverTime);
|
|
3061
|
+
nextHoverValue = _this2.onDayHover(nextHoverTime);
|
|
3062
|
+
} else {
|
|
3063
|
+
currentHoverTime = hoverValue[0].isSame(firstSelectedValue, 'day') ? hoverValue[1] : hoverValue[0];
|
|
3064
|
+
nextHoverTime = func(currentHoverTime);
|
|
3065
|
+
nextHoverValue = _this2.onDayHover(nextHoverTime);
|
|
3066
|
+
}
|
|
3067
|
+
}
|
|
3068
|
+
|
|
3069
|
+
// Find origin hover time on value index
|
|
3070
|
+
if (nextHoverValue.length >= 2) {
|
|
3071
|
+
var miss = nextHoverValue.some(function (ht) {
|
|
3072
|
+
return !includesTime(value, ht, 'month');
|
|
3073
|
+
});
|
|
3074
|
+
if (miss) {
|
|
3075
|
+
var newValue = nextHoverValue.slice().sort(function (t1, t2) {
|
|
3076
|
+
return t1.valueOf() - t2.valueOf();
|
|
3077
|
+
});
|
|
3078
|
+
if (newValue[0].isSame(newValue[1], 'month')) {
|
|
3079
|
+
newValue[1] = newValue[0].clone().add(1, 'month');
|
|
3080
|
+
}
|
|
3081
|
+
_this2.fireValueChange(newValue);
|
|
3082
|
+
}
|
|
3083
|
+
} else if (nextHoverValue.length === 1) {
|
|
3084
|
+
// If only one value, let's keep the origin panel
|
|
3085
|
+
var oriValueIndex = value.findIndex(function (time) {
|
|
3086
|
+
return time.isSame(currentHoverTime, 'month');
|
|
3087
|
+
});
|
|
3088
|
+
if (oriValueIndex === -1) oriValueIndex = 0;
|
|
3089
|
+
|
|
3090
|
+
if (value.every(function (time) {
|
|
3091
|
+
return !time.isSame(nextHoverTime, 'month');
|
|
3092
|
+
})) {
|
|
3093
|
+
var _newValue = value.slice();
|
|
3094
|
+
_newValue[oriValueIndex] = nextHoverTime.clone();
|
|
3095
|
+
_this2.fireValueChange(_newValue);
|
|
3096
|
+
}
|
|
3097
|
+
}
|
|
3098
|
+
|
|
3099
|
+
event.preventDefault();
|
|
3100
|
+
|
|
3101
|
+
return nextHoverTime;
|
|
3102
|
+
};
|
|
3103
|
+
|
|
3104
|
+
switch (keyCode) {
|
|
3105
|
+
case KeyCode.DOWN:
|
|
3106
|
+
updateHoverPoint(function (time) {
|
|
3107
|
+
return goTime(time, 1, 'weeks');
|
|
3108
|
+
});
|
|
3109
|
+
return;
|
|
3110
|
+
case KeyCode.UP:
|
|
3111
|
+
updateHoverPoint(function (time) {
|
|
3112
|
+
return goTime(time, -1, 'weeks');
|
|
3113
|
+
});
|
|
3114
|
+
return;
|
|
3115
|
+
case KeyCode.LEFT:
|
|
3116
|
+
if (ctrlKey) {
|
|
3117
|
+
updateHoverPoint(function (time) {
|
|
3118
|
+
return goTime(time, -1, 'years');
|
|
3119
|
+
});
|
|
3120
|
+
} else {
|
|
3121
|
+
updateHoverPoint(function (time) {
|
|
3122
|
+
return goTime(time, -1, 'days');
|
|
3123
|
+
});
|
|
3124
|
+
}
|
|
3125
|
+
return;
|
|
3126
|
+
case KeyCode.RIGHT:
|
|
3127
|
+
if (ctrlKey) {
|
|
3128
|
+
updateHoverPoint(function (time) {
|
|
3129
|
+
return goTime(time, 1, 'years');
|
|
3130
|
+
});
|
|
3131
|
+
} else {
|
|
3132
|
+
updateHoverPoint(function (time) {
|
|
3133
|
+
return goTime(time, 1, 'days');
|
|
3134
|
+
});
|
|
3135
|
+
}
|
|
3136
|
+
return;
|
|
3137
|
+
case KeyCode.HOME:
|
|
3138
|
+
updateHoverPoint(function (time) {
|
|
3139
|
+
return goStartMonth(time);
|
|
3140
|
+
});
|
|
3141
|
+
return;
|
|
3142
|
+
case KeyCode.END:
|
|
3143
|
+
updateHoverPoint(function (time) {
|
|
3144
|
+
return goEndMonth(time);
|
|
3145
|
+
});
|
|
3146
|
+
return;
|
|
3147
|
+
case KeyCode.PAGE_DOWN:
|
|
3148
|
+
updateHoverPoint(function (time) {
|
|
3149
|
+
return goTime(time, 1, 'month');
|
|
3150
|
+
});
|
|
3151
|
+
return;
|
|
3152
|
+
case KeyCode.PAGE_UP:
|
|
3153
|
+
updateHoverPoint(function (time) {
|
|
3154
|
+
return goTime(time, -1, 'month');
|
|
3155
|
+
});
|
|
3156
|
+
return;
|
|
3157
|
+
case KeyCode.ENTER:
|
|
3158
|
+
{
|
|
3159
|
+
var lastValue = void 0;
|
|
3160
|
+
if (hoverValue.length === 0) {
|
|
3161
|
+
lastValue = updateHoverPoint(function (time) {
|
|
3162
|
+
return time;
|
|
3163
|
+
});
|
|
3164
|
+
} else if (hoverValue.length === 1) {
|
|
3165
|
+
lastValue = hoverValue[0];
|
|
3166
|
+
} else {
|
|
3167
|
+
lastValue = hoverValue[0].isSame(firstSelectedValue, 'day') ? hoverValue[1] : hoverValue[0];
|
|
3168
|
+
}
|
|
3169
|
+
if (lastValue && (!disabledDate || !disabledDate(lastValue))) {
|
|
3170
|
+
_this2.onSelect(lastValue);
|
|
3171
|
+
}
|
|
3172
|
+
event.preventDefault();
|
|
3173
|
+
return;
|
|
3174
|
+
}
|
|
3175
|
+
default:
|
|
3176
|
+
if (onKeyDown) {
|
|
3177
|
+
onKeyDown(event);
|
|
3178
|
+
}
|
|
3179
|
+
}
|
|
3180
|
+
};
|
|
3181
|
+
|
|
3182
|
+
this.onDayHover = function (value) {
|
|
3183
|
+
var hoverValue = [];
|
|
3184
|
+
var _state3 = _this2.state,
|
|
3185
|
+
selectedValue = _state3.selectedValue,
|
|
3186
|
+
firstSelectedValue = _state3.firstSelectedValue;
|
|
3187
|
+
var type = _this2.props.type;
|
|
3188
|
+
|
|
3189
|
+
if (type === 'start' && selectedValue[1]) {
|
|
3190
|
+
hoverValue = _this2.compare(value, selectedValue[1]) < 0 ? [value, selectedValue[1]] : [value];
|
|
3191
|
+
} else if (type === 'end' && selectedValue[0]) {
|
|
3192
|
+
hoverValue = _this2.compare(value, selectedValue[0]) > 0 ? [selectedValue[0], value] : [];
|
|
3193
|
+
} else {
|
|
3194
|
+
if (!firstSelectedValue) {
|
|
3195
|
+
if (_this2.state.hoverValue.length) {
|
|
3196
|
+
_this2.setState({ hoverValue: [] });
|
|
3197
|
+
}
|
|
3198
|
+
return hoverValue;
|
|
3199
|
+
}
|
|
3200
|
+
hoverValue = _this2.compare(value, firstSelectedValue) < 0 ? [value, firstSelectedValue] : [firstSelectedValue, value];
|
|
3201
|
+
}
|
|
3202
|
+
_this2.fireHoverValueChange(hoverValue);
|
|
3203
|
+
|
|
3204
|
+
return hoverValue;
|
|
3205
|
+
};
|
|
3206
|
+
|
|
3207
|
+
this.onToday = function () {
|
|
3208
|
+
var startValue = getTodayTime(_this2.state.value[0]);
|
|
3209
|
+
var endValue = startValue.clone().add(1, 'months');
|
|
3210
|
+
_this2.setState({ value: [startValue, endValue] });
|
|
3211
|
+
};
|
|
3212
|
+
|
|
3213
|
+
this.onOpenTimePicker = function () {
|
|
3214
|
+
_this2.setState({
|
|
3215
|
+
showTimePicker: true
|
|
3216
|
+
});
|
|
3217
|
+
};
|
|
3218
|
+
|
|
3219
|
+
this.onCloseTimePicker = function () {
|
|
3220
|
+
_this2.setState({
|
|
3221
|
+
showTimePicker: false
|
|
3222
|
+
});
|
|
3223
|
+
};
|
|
3224
|
+
|
|
3225
|
+
this.onOk = function () {
|
|
3226
|
+
var selectedValue = _this2.state.selectedValue;
|
|
3227
|
+
|
|
3228
|
+
if (_this2.isAllowedDateAndTime(selectedValue)) {
|
|
3229
|
+
_this2.props.onOk(_this2.state.selectedValue);
|
|
3230
|
+
}
|
|
3231
|
+
};
|
|
3232
|
+
|
|
3233
|
+
this.onStartInputChange = function () {
|
|
3234
|
+
for (var _len = arguments.length, oargs = Array(_len), _key = 0; _key < _len; _key++) {
|
|
3235
|
+
oargs[_key] = arguments[_key];
|
|
3236
|
+
}
|
|
3237
|
+
|
|
3238
|
+
var args = ['left'].concat(oargs);
|
|
3239
|
+
return onInputSelect.apply(_this2, args);
|
|
3240
|
+
};
|
|
3241
|
+
|
|
3242
|
+
this.onEndInputChange = function () {
|
|
3243
|
+
for (var _len2 = arguments.length, oargs = Array(_len2), _key2 = 0; _key2 < _len2; _key2++) {
|
|
3244
|
+
oargs[_key2] = arguments[_key2];
|
|
3245
|
+
}
|
|
3246
|
+
|
|
3247
|
+
var args = ['right'].concat(oargs);
|
|
3248
|
+
return onInputSelect.apply(_this2, args);
|
|
3249
|
+
};
|
|
3250
|
+
|
|
3251
|
+
this.onStartInputSelect = function (value) {
|
|
3252
|
+
var args = ['left', value, { source: 'dateInputSelect' }];
|
|
3253
|
+
return onInputSelect.apply(_this2, args);
|
|
3254
|
+
};
|
|
3255
|
+
|
|
3256
|
+
this.onEndInputSelect = function (value) {
|
|
3257
|
+
var args = ['right', value, { source: 'dateInputSelect' }];
|
|
3258
|
+
return onInputSelect.apply(_this2, args);
|
|
3259
|
+
};
|
|
3260
|
+
|
|
3261
|
+
this.onStartValueChange = function (leftValue) {
|
|
3262
|
+
var value = [].concat(_this2.state.value);
|
|
3263
|
+
value[0] = leftValue;
|
|
3264
|
+
return _this2.fireValueChange(value);
|
|
3265
|
+
};
|
|
3266
|
+
|
|
3267
|
+
this.onEndValueChange = function (rightValue) {
|
|
3268
|
+
var value = [].concat(_this2.state.value);
|
|
3269
|
+
value[1] = rightValue;
|
|
3270
|
+
return _this2.fireValueChange(value);
|
|
3271
|
+
};
|
|
3272
|
+
|
|
3273
|
+
this.onStartPanelChange = function (value, mode) {
|
|
3274
|
+
var props = _this2.props,
|
|
3275
|
+
state = _this2.state;
|
|
3276
|
+
|
|
3277
|
+
var newMode = [mode, state.mode[1]];
|
|
3278
|
+
var newState = {
|
|
3279
|
+
panelTriggerSource: 'start'
|
|
3280
|
+
};
|
|
3281
|
+
if (!('mode' in props)) {
|
|
3282
|
+
newState.mode = newMode;
|
|
3283
|
+
}
|
|
3284
|
+
_this2.setState(newState);
|
|
3285
|
+
var newValue = [value || state.value[0], state.value[1]];
|
|
3286
|
+
props.onPanelChange(newValue, newMode);
|
|
3287
|
+
};
|
|
3288
|
+
|
|
3289
|
+
this.onEndPanelChange = function (value, mode) {
|
|
3290
|
+
var props = _this2.props,
|
|
3291
|
+
state = _this2.state;
|
|
3292
|
+
|
|
3293
|
+
var newMode = [state.mode[0], mode];
|
|
3294
|
+
var newState = {
|
|
3295
|
+
panelTriggerSource: 'end'
|
|
3296
|
+
};
|
|
3297
|
+
if (!('mode' in props)) {
|
|
3298
|
+
newState.mode = newMode;
|
|
3299
|
+
}
|
|
3300
|
+
_this2.setState(newState);
|
|
3301
|
+
var newValue = [state.value[0], value || state.value[1]];
|
|
3302
|
+
props.onPanelChange(newValue, newMode);
|
|
3303
|
+
};
|
|
3304
|
+
|
|
3305
|
+
this.getStartValue = function () {
|
|
3306
|
+
var _state4 = _this2.state,
|
|
3307
|
+
selectedValue = _state4.selectedValue,
|
|
3308
|
+
showTimePicker = _state4.showTimePicker,
|
|
3309
|
+
value = _state4.value,
|
|
3310
|
+
mode = _state4.mode,
|
|
3311
|
+
panelTriggerSource = _state4.panelTriggerSource;
|
|
3312
|
+
|
|
3313
|
+
var startValue = value[0];
|
|
3314
|
+
// keep selectedTime when select date
|
|
3315
|
+
if (selectedValue[0] && _this2.props.timePicker) {
|
|
3316
|
+
startValue = startValue.clone();
|
|
3317
|
+
syncTime(selectedValue[0], startValue);
|
|
3318
|
+
}
|
|
3319
|
+
if (showTimePicker && selectedValue[0]) {
|
|
3320
|
+
startValue = selectedValue[0];
|
|
3321
|
+
}
|
|
3322
|
+
|
|
3323
|
+
// Adjust month if date not align
|
|
3324
|
+
if (panelTriggerSource === 'end' && mode[0] === 'date' && mode[1] === 'date' && startValue.isSame(value[1], 'month')) {
|
|
3325
|
+
startValue = startValue.clone().subtract(1, 'month');
|
|
3326
|
+
}
|
|
3327
|
+
|
|
3328
|
+
return startValue;
|
|
3329
|
+
};
|
|
3330
|
+
|
|
3331
|
+
this.getEndValue = function () {
|
|
3332
|
+
var _state5 = _this2.state,
|
|
3333
|
+
value = _state5.value,
|
|
3334
|
+
selectedValue = _state5.selectedValue,
|
|
3335
|
+
showTimePicker = _state5.showTimePicker,
|
|
3336
|
+
mode = _state5.mode,
|
|
3337
|
+
panelTriggerSource = _state5.panelTriggerSource;
|
|
3338
|
+
|
|
3339
|
+
var endValue = value[1] ? value[1].clone() : value[0].clone().add(1, 'month');
|
|
3340
|
+
// keep selectedTime when select date
|
|
3341
|
+
if (selectedValue[1] && _this2.props.timePicker) {
|
|
3342
|
+
syncTime(selectedValue[1], endValue);
|
|
3343
|
+
}
|
|
3344
|
+
if (showTimePicker) {
|
|
3345
|
+
endValue = selectedValue[1] ? selectedValue[1] : _this2.getStartValue();
|
|
3346
|
+
}
|
|
3347
|
+
|
|
3348
|
+
// Adjust month if date not align
|
|
3349
|
+
if (!showTimePicker && panelTriggerSource !== 'end' && mode[0] === 'date' && mode[1] === 'date' && endValue.isSame(value[0], 'month')) {
|
|
3350
|
+
endValue = endValue.clone().add(1, 'month');
|
|
3351
|
+
}
|
|
3352
|
+
|
|
3353
|
+
return endValue;
|
|
3354
|
+
};
|
|
3355
|
+
|
|
3356
|
+
this.getEndDisableTime = function () {
|
|
3357
|
+
var _state6 = _this2.state,
|
|
3358
|
+
selectedValue = _state6.selectedValue,
|
|
3359
|
+
value = _state6.value;
|
|
3360
|
+
var disabledTime = _this2.props.disabledTime;
|
|
3361
|
+
|
|
3362
|
+
var userSettingDisabledTime = disabledTime(selectedValue, 'end') || {};
|
|
3363
|
+
var startValue = selectedValue && selectedValue[0] || value[0].clone();
|
|
3364
|
+
// if startTime and endTime is same day..
|
|
3365
|
+
// the second time picker will not able to pick time before first time picker
|
|
3366
|
+
if (!selectedValue[1] || startValue.isSame(selectedValue[1], 'day')) {
|
|
3367
|
+
var hours = startValue.hour();
|
|
3368
|
+
var minutes = startValue.minute();
|
|
3369
|
+
var second = startValue.second();
|
|
3370
|
+
var _disabledHours = userSettingDisabledTime.disabledHours,
|
|
3371
|
+
_disabledMinutes = userSettingDisabledTime.disabledMinutes,
|
|
3372
|
+
_disabledSeconds = userSettingDisabledTime.disabledSeconds;
|
|
3373
|
+
|
|
3374
|
+
var oldDisabledMinutes = _disabledMinutes ? _disabledMinutes() : [];
|
|
3375
|
+
var olddisabledSeconds = _disabledSeconds ? _disabledSeconds() : [];
|
|
3376
|
+
_disabledHours = generateOptions(hours, _disabledHours);
|
|
3377
|
+
_disabledMinutes = generateOptions(minutes, _disabledMinutes);
|
|
3378
|
+
_disabledSeconds = generateOptions(second, _disabledSeconds);
|
|
3379
|
+
return {
|
|
3380
|
+
disabledHours: function disabledHours() {
|
|
3381
|
+
return _disabledHours;
|
|
3382
|
+
},
|
|
3383
|
+
disabledMinutes: function disabledMinutes(hour) {
|
|
3384
|
+
if (hour === hours) {
|
|
3385
|
+
return _disabledMinutes;
|
|
3386
|
+
}
|
|
3387
|
+
return oldDisabledMinutes;
|
|
3388
|
+
},
|
|
3389
|
+
disabledSeconds: function disabledSeconds(hour, minute) {
|
|
3390
|
+
if (hour === hours && minute === minutes) {
|
|
3391
|
+
return _disabledSeconds;
|
|
3392
|
+
}
|
|
3393
|
+
return olddisabledSeconds;
|
|
3394
|
+
}
|
|
3395
|
+
};
|
|
3396
|
+
}
|
|
3397
|
+
return userSettingDisabledTime;
|
|
3398
|
+
};
|
|
3399
|
+
|
|
3400
|
+
this.isAllowedDateAndTime = function (selectedValue) {
|
|
3401
|
+
return isAllowedDate(selectedValue[0], _this2.props.disabledDate, _this2.disabledStartTime) && isAllowedDate(selectedValue[1], _this2.props.disabledDate, _this2.disabledEndTime);
|
|
3402
|
+
};
|
|
3403
|
+
|
|
3404
|
+
this.isMonthYearPanelShow = function (mode) {
|
|
3405
|
+
return ['month', 'year', 'decade'].indexOf(mode) > -1;
|
|
3406
|
+
};
|
|
3407
|
+
|
|
3408
|
+
this.hasSelectedValue = function () {
|
|
3409
|
+
var selectedValue = _this2.state.selectedValue;
|
|
3410
|
+
|
|
3411
|
+
return !!selectedValue[1] && !!selectedValue[0];
|
|
3412
|
+
};
|
|
3413
|
+
|
|
3414
|
+
this.compare = function (v1, v2) {
|
|
3415
|
+
if (_this2.props.timePicker) {
|
|
3416
|
+
return v1.diff(v2);
|
|
3417
|
+
}
|
|
3418
|
+
return v1.diff(v2, 'days');
|
|
3419
|
+
};
|
|
3420
|
+
|
|
3421
|
+
this.fireSelectValueChange = function (selectedValue, direct, cause) {
|
|
3422
|
+
var timePicker = _this2.props.timePicker;
|
|
3423
|
+
var prevSelectedValue = _this2.state.prevSelectedValue;
|
|
3424
|
+
|
|
3425
|
+
if (timePicker && timePicker.props.defaultValue) {
|
|
3426
|
+
var timePickerDefaultValue = timePicker.props.defaultValue;
|
|
3427
|
+
if (!prevSelectedValue[0] && selectedValue[0]) {
|
|
3428
|
+
syncTime(timePickerDefaultValue[0], selectedValue[0]);
|
|
3429
|
+
}
|
|
3430
|
+
if (!prevSelectedValue[1] && selectedValue[1]) {
|
|
3431
|
+
syncTime(timePickerDefaultValue[1], selectedValue[1]);
|
|
3432
|
+
}
|
|
3433
|
+
}
|
|
3434
|
+
|
|
3435
|
+
if (!('selectedValue' in _this2.props)) {
|
|
3436
|
+
_this2.setState({
|
|
3437
|
+
selectedValue: selectedValue
|
|
3438
|
+
});
|
|
3439
|
+
}
|
|
3440
|
+
|
|
3441
|
+
// 尚未选择过时间,直接输入的话
|
|
3442
|
+
if (!_this2.state.selectedValue[0] || !_this2.state.selectedValue[1]) {
|
|
3443
|
+
var startValue = selectedValue[0] || moment();
|
|
3444
|
+
var endValue = selectedValue[1] || startValue.clone().add(1, 'months');
|
|
3445
|
+
_this2.setState({
|
|
3446
|
+
selectedValue: selectedValue,
|
|
3447
|
+
value: getValueFromSelectedValue([startValue, endValue])
|
|
3448
|
+
});
|
|
3449
|
+
}
|
|
3450
|
+
|
|
3451
|
+
if (selectedValue[0] && !selectedValue[1]) {
|
|
3452
|
+
_this2.setState({ firstSelectedValue: selectedValue[0] });
|
|
3453
|
+
_this2.fireHoverValueChange(selectedValue.concat());
|
|
3454
|
+
}
|
|
3455
|
+
_this2.props.onChange(selectedValue);
|
|
3456
|
+
if (direct || selectedValue[0] && selectedValue[1]) {
|
|
3457
|
+
_this2.setState({
|
|
3458
|
+
prevSelectedValue: selectedValue,
|
|
3459
|
+
firstSelectedValue: null
|
|
3460
|
+
});
|
|
3461
|
+
_this2.fireHoverValueChange([]);
|
|
3462
|
+
_this2.props.onSelect(selectedValue, cause);
|
|
3463
|
+
}
|
|
3464
|
+
};
|
|
3465
|
+
|
|
3466
|
+
this.fireValueChange = function (value) {
|
|
3467
|
+
var props = _this2.props;
|
|
3468
|
+
if (!('value' in props)) {
|
|
3469
|
+
_this2.setState({
|
|
3470
|
+
value: value
|
|
3471
|
+
});
|
|
3472
|
+
}
|
|
3473
|
+
props.onValueChange(value);
|
|
3474
|
+
};
|
|
3475
|
+
|
|
3476
|
+
this.fireHoverValueChange = function (hoverValue) {
|
|
3477
|
+
var props = _this2.props;
|
|
3478
|
+
if (!('hoverValue' in props)) {
|
|
3479
|
+
_this2.setState({ hoverValue: hoverValue });
|
|
3480
|
+
}
|
|
3481
|
+
props.onHoverChange(hoverValue);
|
|
3482
|
+
};
|
|
3483
|
+
|
|
3484
|
+
this.clear = function () {
|
|
3485
|
+
_this2.fireSelectValueChange([], true);
|
|
3486
|
+
_this2.props.onClear();
|
|
3487
|
+
};
|
|
3488
|
+
|
|
3489
|
+
this.disabledStartTime = function (time) {
|
|
3490
|
+
return _this2.props.disabledTime(time, 'start');
|
|
3491
|
+
};
|
|
3492
|
+
|
|
3493
|
+
this.disabledEndTime = function (time) {
|
|
3494
|
+
return _this2.props.disabledTime(time, 'end');
|
|
3495
|
+
};
|
|
3496
|
+
|
|
3497
|
+
this.disabledStartMonth = function (month) {
|
|
3498
|
+
var value = _this2.state.value;
|
|
3499
|
+
|
|
3500
|
+
return month.isAfter(value[1], 'month');
|
|
3501
|
+
};
|
|
3502
|
+
|
|
3503
|
+
this.disabledEndMonth = function (month) {
|
|
3504
|
+
var value = _this2.state.value;
|
|
3505
|
+
|
|
3506
|
+
return month.isBefore(value[0], 'month');
|
|
3507
|
+
};
|
|
3508
|
+
};
|
|
3509
|
+
|
|
3510
|
+
polyfill(RangeCalendar);
|
|
3511
|
+
|
|
3512
|
+
var RangeCalendar$1 = commonMixinWrapper(RangeCalendar);
|
|
3513
|
+
|
|
3514
|
+
function _defineProperty$1(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; }
|
|
3515
|
+
function InputIcon(props) {
|
|
3516
|
+
var _classNames;
|
|
3517
|
+
|
|
3518
|
+
var suffixIcon = props.suffixIcon,
|
|
3519
|
+
prefixCls = props.prefixCls;
|
|
3520
|
+
return suffixIcon && ( /*#__PURE__*/React.isValidElement(suffixIcon) ? /*#__PURE__*/React.cloneElement(suffixIcon, {
|
|
3521
|
+
className: classNames((_classNames = {}, _defineProperty$1(_classNames, suffixIcon.props.className, suffixIcon.props.className), _defineProperty$1(_classNames, "".concat(prefixCls, "-picker-icon"), true), _classNames))
|
|
3522
|
+
}) : /*#__PURE__*/React.createElement("span", {
|
|
3523
|
+
className: "".concat(prefixCls, "-picker-icon")
|
|
3524
|
+
}, suffixIcon)) || /*#__PURE__*/React.createElement(Icon, {
|
|
3525
|
+
type: "calendar",
|
|
3526
|
+
className: "".concat(prefixCls, "-picker-icon")
|
|
3527
|
+
});
|
|
3528
|
+
}
|
|
3529
|
+
|
|
3530
|
+
function _typeof$1(obj) { "@babel/helpers - typeof"; if (typeof Symbol === "function" && typeof Symbol.iterator === "symbol") { _typeof$1 = function _typeof(obj) { return typeof obj; }; } else { _typeof$1 = function _typeof(obj) { return obj && typeof Symbol === "function" && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; }; } return _typeof$1(obj); }
|
|
3531
|
+
|
|
3532
|
+
function _extends$2() { _extends$2 = Object.assign || function (target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { target[key] = source[key]; } } } return target; }; return _extends$2.apply(this, arguments); }
|
|
3533
|
+
|
|
3534
|
+
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; }
|
|
3535
|
+
|
|
3536
|
+
function _classCallCheck$1(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
|
|
3537
|
+
|
|
3538
|
+
function _defineProperties$1(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); } }
|
|
3539
|
+
|
|
3540
|
+
function _createClass$1(Constructor, protoProps, staticProps) { if (protoProps) _defineProperties$1(Constructor.prototype, protoProps); if (staticProps) _defineProperties$1(Constructor, staticProps); return Constructor; }
|
|
3541
|
+
|
|
3542
|
+
function _inherits$1(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$1(subClass, superClass); }
|
|
3543
|
+
|
|
3544
|
+
function _setPrototypeOf$1(o, p) { _setPrototypeOf$1 = Object.setPrototypeOf || function _setPrototypeOf(o, p) { o.__proto__ = p; return o; }; return _setPrototypeOf$1(o, p); }
|
|
3545
|
+
|
|
3546
|
+
function _createSuper$1(Derived) { var hasNativeReflectConstruct = _isNativeReflectConstruct$1(); return function _createSuperInternal() { var Super = _getPrototypeOf$1(Derived), result; if (hasNativeReflectConstruct) { var NewTarget = _getPrototypeOf$1(this).constructor; result = Reflect.construct(Super, arguments, NewTarget); } else { result = Super.apply(this, arguments); } return _possibleConstructorReturn$1(this, result); }; }
|
|
3547
|
+
|
|
3548
|
+
function _possibleConstructorReturn$1(self, call) { if (call && (_typeof$1(call) === "object" || typeof call === "function")) { return call; } return _assertThisInitialized$1(self); }
|
|
3549
|
+
|
|
3550
|
+
function _assertThisInitialized$1(self) { if (self === void 0) { throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); } return self; }
|
|
3551
|
+
|
|
3552
|
+
function _isNativeReflectConstruct$1() { 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; } }
|
|
3553
|
+
|
|
3554
|
+
function _getPrototypeOf$1(o) { _getPrototypeOf$1 = Object.setPrototypeOf ? Object.getPrototypeOf : function _getPrototypeOf(o) { return o.__proto__ || Object.getPrototypeOf(o); }; return _getPrototypeOf$1(o); }
|
|
3555
|
+
|
|
3556
|
+
function _slicedToArray(arr, i) { return _arrayWithHoles(arr) || _iterableToArrayLimit(arr, i) || _unsupportedIterableToArray(arr, i) || _nonIterableRest(); }
|
|
3557
|
+
|
|
3558
|
+
function _nonIterableRest() { throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method."); }
|
|
3559
|
+
|
|
3560
|
+
function _unsupportedIterableToArray(o, minLen) { if (!o) return; if (typeof o === "string") return _arrayLikeToArray(o, minLen); var n = Object.prototype.toString.call(o).slice(8, -1); if (n === "Object" && o.constructor) n = o.constructor.name; if (n === "Map" || n === "Set") return Array.from(o); if (n === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)) return _arrayLikeToArray(o, minLen); }
|
|
3561
|
+
|
|
3562
|
+
function _arrayLikeToArray(arr, len) { if (len == null || len > arr.length) len = arr.length; for (var i = 0, arr2 = new Array(len); i < len; i++) { arr2[i] = arr[i]; } return arr2; }
|
|
3563
|
+
|
|
3564
|
+
function _iterableToArrayLimit(arr, i) { if (typeof Symbol === "undefined" || !(Symbol.iterator in Object(arr))) return; var _arr = []; var _n = true; var _d = false; var _e = undefined; try { for (var _i = arr[Symbol.iterator](), _s; !(_n = (_s = _i.next()).done); _n = true) { _arr.push(_s.value); if (i && _arr.length === i) break; } } catch (err) { _d = true; _e = err; } finally { try { if (!_n && _i["return"] != null) _i["return"](); } finally { if (_d) throw _e; } } return _arr; }
|
|
3565
|
+
|
|
3566
|
+
function _arrayWithHoles(arr) { if (Array.isArray(arr)) return arr; }
|
|
3567
|
+
|
|
3568
|
+
function getShowDateFromValue(value, mode) {
|
|
3569
|
+
var _value = _slicedToArray(value, 2),
|
|
3570
|
+
start = _value[0],
|
|
3571
|
+
end = _value[1]; // value could be an empty array, then we should not reset showDate
|
|
3572
|
+
|
|
3573
|
+
|
|
3574
|
+
if (!start && !end) {
|
|
3575
|
+
return;
|
|
3576
|
+
}
|
|
3577
|
+
|
|
3578
|
+
if (mode && mode[0] === 'month') {
|
|
3579
|
+
return [start, end];
|
|
3580
|
+
}
|
|
3581
|
+
|
|
3582
|
+
var newEnd = end && end.isSame(start, 'month') ? end.clone().add(1, 'month') : end;
|
|
3583
|
+
return [start, newEnd];
|
|
3584
|
+
}
|
|
3585
|
+
|
|
3586
|
+
function pickerValueAdapter(value) {
|
|
3587
|
+
if (!value) {
|
|
3588
|
+
return;
|
|
3589
|
+
}
|
|
3590
|
+
|
|
3591
|
+
if (Array.isArray(value)) {
|
|
3592
|
+
return value;
|
|
3593
|
+
}
|
|
3594
|
+
|
|
3595
|
+
return [value, value.clone().add(1, 'month')];
|
|
3596
|
+
}
|
|
3597
|
+
|
|
3598
|
+
function isEmptyArray(arr) {
|
|
3599
|
+
if (Array.isArray(arr)) {
|
|
3600
|
+
return arr.length === 0 || arr.every(function (i) {
|
|
3601
|
+
return !i;
|
|
3602
|
+
});
|
|
3603
|
+
}
|
|
3604
|
+
|
|
3605
|
+
return false;
|
|
3606
|
+
}
|
|
3607
|
+
|
|
3608
|
+
function fixLocale(value, localeCode) {
|
|
3609
|
+
if (!localeCode) {
|
|
3610
|
+
return;
|
|
3611
|
+
}
|
|
3612
|
+
|
|
3613
|
+
if (!value || value.length === 0) {
|
|
3614
|
+
return;
|
|
3615
|
+
}
|
|
3616
|
+
|
|
3617
|
+
var _value2 = _slicedToArray(value, 2),
|
|
3618
|
+
start = _value2[0],
|
|
3619
|
+
end = _value2[1];
|
|
3620
|
+
|
|
3621
|
+
if (start) {
|
|
3622
|
+
start.locale(localeCode);
|
|
3623
|
+
}
|
|
3624
|
+
|
|
3625
|
+
if (end) {
|
|
3626
|
+
end.locale(localeCode);
|
|
3627
|
+
}
|
|
3628
|
+
}
|
|
3629
|
+
|
|
3630
|
+
var RangePicker = /*#__PURE__*/function (_React$Component) {
|
|
3631
|
+
_inherits$1(RangePicker, _React$Component);
|
|
3632
|
+
|
|
3633
|
+
var _super = _createSuper$1(RangePicker);
|
|
3634
|
+
|
|
3635
|
+
function RangePicker(props) {
|
|
3636
|
+
var _this;
|
|
3637
|
+
|
|
3638
|
+
_classCallCheck$1(this, RangePicker);
|
|
3639
|
+
|
|
3640
|
+
_this = _super.call(this, props);
|
|
3641
|
+
|
|
3642
|
+
_this.savePicker = function (node) {
|
|
3643
|
+
_this.picker = node;
|
|
3644
|
+
};
|
|
3645
|
+
|
|
3646
|
+
_this.clearSelection = function (e) {
|
|
3647
|
+
e.preventDefault();
|
|
3648
|
+
e.stopPropagation();
|
|
3649
|
+
|
|
3650
|
+
_this.setState({
|
|
3651
|
+
value: []
|
|
3652
|
+
});
|
|
3653
|
+
|
|
3654
|
+
_this.handleChange([]);
|
|
3655
|
+
};
|
|
3656
|
+
|
|
3657
|
+
_this.clearHoverValue = function () {
|
|
3658
|
+
return _this.setState({
|
|
3659
|
+
hoverValue: []
|
|
3660
|
+
});
|
|
3661
|
+
};
|
|
3662
|
+
|
|
3663
|
+
_this.handleChange = function (value) {
|
|
3664
|
+
var _assertThisInitialize = _assertThisInitialized$1(_this),
|
|
3665
|
+
props = _assertThisInitialize.props;
|
|
3666
|
+
|
|
3667
|
+
if (!('value' in props)) {
|
|
3668
|
+
_this.setState(function (_ref) {
|
|
3669
|
+
var showDate = _ref.showDate;
|
|
3670
|
+
return {
|
|
3671
|
+
value: value,
|
|
3672
|
+
showDate: getShowDateFromValue(value) || showDate
|
|
3673
|
+
};
|
|
3674
|
+
});
|
|
3675
|
+
}
|
|
3676
|
+
|
|
3677
|
+
if (value[0] && value[1] && value[0].diff(value[1]) > 0) {
|
|
3678
|
+
value[1] = undefined;
|
|
3679
|
+
}
|
|
3680
|
+
|
|
3681
|
+
var _value3 = _slicedToArray(value, 2),
|
|
3682
|
+
start = _value3[0],
|
|
3683
|
+
end = _value3[1];
|
|
3684
|
+
|
|
3685
|
+
if (typeof props.onChange === 'function') {
|
|
3686
|
+
props.onChange(value, [formatDate(start, props.format), formatDate(end, props.format)]);
|
|
3687
|
+
}
|
|
3688
|
+
};
|
|
3689
|
+
|
|
3690
|
+
_this.handleOpenChange = function (open) {
|
|
3691
|
+
if (!('open' in _this.props)) {
|
|
3692
|
+
_this.setState({
|
|
3693
|
+
open: open
|
|
3694
|
+
});
|
|
3695
|
+
}
|
|
3696
|
+
|
|
3697
|
+
if (open === false) {
|
|
3698
|
+
_this.clearHoverValue();
|
|
3699
|
+
}
|
|
3700
|
+
|
|
3701
|
+
var onOpenChange = _this.props.onOpenChange;
|
|
3702
|
+
|
|
3703
|
+
if (onOpenChange) {
|
|
3704
|
+
onOpenChange(open);
|
|
3705
|
+
}
|
|
3706
|
+
};
|
|
3707
|
+
|
|
3708
|
+
_this.handleShowDateChange = function (showDate) {
|
|
3709
|
+
return _this.setState({
|
|
3710
|
+
showDate: showDate
|
|
3711
|
+
});
|
|
3712
|
+
};
|
|
3713
|
+
|
|
3714
|
+
_this.handleHoverChange = function (hoverValue) {
|
|
3715
|
+
return _this.setState({
|
|
3716
|
+
hoverValue: hoverValue
|
|
3717
|
+
});
|
|
3718
|
+
};
|
|
3719
|
+
|
|
3720
|
+
_this.handleRangeMouseLeave = function () {
|
|
3721
|
+
if (_this.state.open) {
|
|
3722
|
+
_this.clearHoverValue();
|
|
3723
|
+
}
|
|
3724
|
+
};
|
|
3725
|
+
|
|
3726
|
+
_this.handleCalendarInputSelect = function (value) {
|
|
3727
|
+
var _value4 = _slicedToArray(value, 1),
|
|
3728
|
+
start = _value4[0];
|
|
3729
|
+
|
|
3730
|
+
if (!start) {
|
|
3731
|
+
return;
|
|
3732
|
+
}
|
|
3733
|
+
|
|
3734
|
+
_this.setState(function (_ref2) {
|
|
3735
|
+
var showDate = _ref2.showDate;
|
|
3736
|
+
return {
|
|
3737
|
+
value: value,
|
|
3738
|
+
showDate: getShowDateFromValue(value) || showDate
|
|
3739
|
+
};
|
|
3740
|
+
});
|
|
3741
|
+
};
|
|
3742
|
+
|
|
3743
|
+
_this.handleRangeClick = function (value) {
|
|
3744
|
+
if (typeof value === 'function') {
|
|
3745
|
+
value = value();
|
|
3746
|
+
}
|
|
3747
|
+
|
|
3748
|
+
_this.setValue(value, true);
|
|
3749
|
+
|
|
3750
|
+
var _this$props = _this.props,
|
|
3751
|
+
onOk = _this$props.onOk,
|
|
3752
|
+
onOpenChange = _this$props.onOpenChange;
|
|
3753
|
+
|
|
3754
|
+
if (onOk) {
|
|
3755
|
+
onOk(value);
|
|
3756
|
+
}
|
|
3757
|
+
|
|
3758
|
+
if (onOpenChange) {
|
|
3759
|
+
onOpenChange(false);
|
|
3760
|
+
}
|
|
3761
|
+
};
|
|
3762
|
+
|
|
3763
|
+
_this.renderFooter = function () {
|
|
3764
|
+
var _this$props2 = _this.props,
|
|
3765
|
+
ranges = _this$props2.ranges,
|
|
3766
|
+
renderExtraFooter = _this$props2.renderExtraFooter;
|
|
3767
|
+
|
|
3768
|
+
var _assertThisInitialize2 = _assertThisInitialized$1(_this),
|
|
3769
|
+
prefixCls = _assertThisInitialize2.prefixCls,
|
|
3770
|
+
tagPrefixCls = _assertThisInitialize2.tagPrefixCls;
|
|
3771
|
+
|
|
3772
|
+
if (!ranges && !renderExtraFooter) {
|
|
3773
|
+
return null;
|
|
3774
|
+
}
|
|
3775
|
+
|
|
3776
|
+
var customFooter = renderExtraFooter ? /*#__PURE__*/React.createElement("div", {
|
|
3777
|
+
className: "".concat(prefixCls, "-footer-extra"),
|
|
3778
|
+
key: "extra"
|
|
3779
|
+
}, renderExtraFooter()) : null;
|
|
3780
|
+
var operations = ranges && Object.keys(ranges).map(function (range) {
|
|
3781
|
+
var value = ranges[range];
|
|
3782
|
+
var hoverValue = typeof value === 'function' ? value.call(_assertThisInitialized$1(_this)) : value;
|
|
3783
|
+
return /*#__PURE__*/React.createElement(Tag, {
|
|
3784
|
+
key: range,
|
|
3785
|
+
prefixCls: tagPrefixCls,
|
|
3786
|
+
color: "blue",
|
|
3787
|
+
onClick: function onClick() {
|
|
3788
|
+
return _this.handleRangeClick(value);
|
|
3789
|
+
},
|
|
3790
|
+
onMouseEnter: function onMouseEnter() {
|
|
3791
|
+
return _this.setState({
|
|
3792
|
+
hoverValue: hoverValue
|
|
3793
|
+
});
|
|
3794
|
+
},
|
|
3795
|
+
onMouseLeave: _this.handleRangeMouseLeave
|
|
3796
|
+
}, range);
|
|
3797
|
+
});
|
|
3798
|
+
var rangeNode = operations && operations.length > 0 ? /*#__PURE__*/React.createElement("div", {
|
|
3799
|
+
className: "".concat(prefixCls, "-footer-extra ").concat(prefixCls, "-range-quick-selector"),
|
|
3800
|
+
key: "range"
|
|
3801
|
+
}, operations) : null;
|
|
3802
|
+
return [rangeNode, customFooter];
|
|
3803
|
+
};
|
|
3804
|
+
|
|
3805
|
+
_this.renderRangePicker = function (_ref3) {
|
|
3806
|
+
var _classNames;
|
|
3807
|
+
|
|
3808
|
+
var getPrefixCls = _ref3.getPrefixCls;
|
|
3809
|
+
|
|
3810
|
+
var _assertThisInitialize3 = _assertThisInitialized$1(_this),
|
|
3811
|
+
state = _assertThisInitialize3.state,
|
|
3812
|
+
props = _assertThisInitialize3.props;
|
|
3813
|
+
|
|
3814
|
+
var value = state.value,
|
|
3815
|
+
showDate = state.showDate,
|
|
3816
|
+
hoverValue = state.hoverValue,
|
|
3817
|
+
open = state.open;
|
|
3818
|
+
var customizePrefixCls = props.prefixCls,
|
|
3819
|
+
customizeTagPrefixCls = props.tagPrefixCls,
|
|
3820
|
+
popupStyle = props.popupStyle,
|
|
3821
|
+
style = props.style,
|
|
3822
|
+
disabledDate = props.disabledDate,
|
|
3823
|
+
disabledTime = props.disabledTime,
|
|
3824
|
+
showTime = props.showTime,
|
|
3825
|
+
showToday = props.showToday,
|
|
3826
|
+
ranges = props.ranges,
|
|
3827
|
+
onOk = props.onOk,
|
|
3828
|
+
locale = props.locale,
|
|
3829
|
+
localeCode = props.localeCode,
|
|
3830
|
+
format = props.format,
|
|
3831
|
+
dateRender = props.dateRender,
|
|
3832
|
+
onCalendarChange = props.onCalendarChange,
|
|
3833
|
+
suffixIcon = props.suffixIcon,
|
|
3834
|
+
separator = props.separator;
|
|
3835
|
+
var prefixCls = getPrefixCls('calendar', customizePrefixCls);
|
|
3836
|
+
var tagPrefixCls = getPrefixCls('tag', customizeTagPrefixCls); // To support old version react.
|
|
3837
|
+
// Have to add prefixCls on the instance.
|
|
3838
|
+
// https://github.com/facebook/react/issues/12397
|
|
3839
|
+
|
|
3840
|
+
_this.prefixCls = prefixCls;
|
|
3841
|
+
_this.tagPrefixCls = tagPrefixCls;
|
|
3842
|
+
fixLocale(value, localeCode);
|
|
3843
|
+
fixLocale(showDate, localeCode);
|
|
3844
|
+
var calendarClassName = classNames((_classNames = {}, _defineProperty(_classNames, "".concat(prefixCls, "-time"), showTime), _defineProperty(_classNames, "".concat(prefixCls, "-range-with-ranges"), ranges), _classNames)); // 需要选择时间时,点击 ok 时才触发 onChange
|
|
3845
|
+
|
|
3846
|
+
var pickerChangeHandler = {
|
|
3847
|
+
onChange: _this.handleChange
|
|
3848
|
+
};
|
|
3849
|
+
var calendarProps = {
|
|
3850
|
+
onOk: _this.handleChange
|
|
3851
|
+
};
|
|
3852
|
+
|
|
3853
|
+
if (props.timePicker) {
|
|
3854
|
+
pickerChangeHandler.onChange = function (changedValue) {
|
|
3855
|
+
return _this.handleChange(changedValue);
|
|
3856
|
+
};
|
|
3857
|
+
} else {
|
|
3858
|
+
calendarProps = {};
|
|
3859
|
+
}
|
|
3860
|
+
|
|
3861
|
+
if ('mode' in props) {
|
|
3862
|
+
calendarProps.mode = props.mode;
|
|
3863
|
+
}
|
|
3864
|
+
|
|
3865
|
+
var startPlaceholder = Array.isArray(props.placeholder) ? props.placeholder[0] : locale.lang.rangePlaceholder[0];
|
|
3866
|
+
var endPlaceholder = Array.isArray(props.placeholder) ? props.placeholder[1] : locale.lang.rangePlaceholder[1];
|
|
3867
|
+
var calendar = /*#__PURE__*/React.createElement(RangeCalendar$1, _extends$2({}, calendarProps, {
|
|
3868
|
+
seperator: separator,
|
|
3869
|
+
onChange: onCalendarChange,
|
|
3870
|
+
format: format,
|
|
3871
|
+
prefixCls: prefixCls,
|
|
3872
|
+
className: calendarClassName,
|
|
3873
|
+
renderFooter: _this.renderFooter,
|
|
3874
|
+
timePicker: props.timePicker,
|
|
3875
|
+
disabledDate: disabledDate,
|
|
3876
|
+
disabledTime: disabledTime,
|
|
3877
|
+
dateInputPlaceholder: [startPlaceholder, endPlaceholder],
|
|
3878
|
+
locale: locale.lang,
|
|
3879
|
+
onOk: onOk,
|
|
3880
|
+
dateRender: dateRender,
|
|
3881
|
+
value: showDate,
|
|
3882
|
+
onValueChange: _this.handleShowDateChange,
|
|
3883
|
+
hoverValue: hoverValue,
|
|
3884
|
+
onHoverChange: _this.handleHoverChange,
|
|
3885
|
+
onPanelChange: props.onPanelChange,
|
|
3886
|
+
showToday: showToday,
|
|
3887
|
+
onInputSelect: _this.handleCalendarInputSelect
|
|
3888
|
+
})); // default width for showTime
|
|
3889
|
+
|
|
3890
|
+
var pickerStyle = {};
|
|
3891
|
+
|
|
3892
|
+
if (props.showTime) {
|
|
3893
|
+
pickerStyle.width = style && style.width || 350;
|
|
3894
|
+
}
|
|
3895
|
+
|
|
3896
|
+
var _value5 = _slicedToArray(value, 2),
|
|
3897
|
+
startValue = _value5[0],
|
|
3898
|
+
endValue = _value5[1];
|
|
3899
|
+
|
|
3900
|
+
var clearIcon = !props.disabled && props.allowClear && value && (startValue || endValue) ? /*#__PURE__*/React.createElement(Icon, {
|
|
3901
|
+
type: "close-circle",
|
|
3902
|
+
className: "".concat(prefixCls, "-picker-clear"),
|
|
3903
|
+
onClick: _this.clearSelection,
|
|
3904
|
+
theme: "filled"
|
|
3905
|
+
}) : null;
|
|
3906
|
+
var inputIcon = /*#__PURE__*/React.createElement(InputIcon, {
|
|
3907
|
+
suffixIcon: suffixIcon,
|
|
3908
|
+
prefixCls: prefixCls
|
|
3909
|
+
});
|
|
3910
|
+
|
|
3911
|
+
var input = function input(_ref4) {
|
|
3912
|
+
var inputValue = _ref4.value;
|
|
3913
|
+
|
|
3914
|
+
var _inputValue = _slicedToArray(inputValue, 2),
|
|
3915
|
+
start = _inputValue[0],
|
|
3916
|
+
end = _inputValue[1];
|
|
3917
|
+
|
|
3918
|
+
return /*#__PURE__*/React.createElement("span", {
|
|
3919
|
+
className: props.pickerInputClass
|
|
3920
|
+
}, /*#__PURE__*/React.createElement("input", {
|
|
3921
|
+
disabled: props.disabled,
|
|
3922
|
+
readOnly: true,
|
|
3923
|
+
value: formatDate(start, props.format),
|
|
3924
|
+
placeholder: startPlaceholder,
|
|
3925
|
+
className: "".concat(prefixCls, "-range-picker-input"),
|
|
3926
|
+
tabIndex: -1
|
|
3927
|
+
}), /*#__PURE__*/React.createElement("span", {
|
|
3928
|
+
className: "".concat(prefixCls, "-range-picker-separator")
|
|
3929
|
+
}, " ", separator, " "), /*#__PURE__*/React.createElement("input", {
|
|
3930
|
+
disabled: props.disabled,
|
|
3931
|
+
readOnly: true,
|
|
3932
|
+
value: formatDate(end, props.format),
|
|
3933
|
+
placeholder: endPlaceholder,
|
|
3934
|
+
className: "".concat(prefixCls, "-range-picker-input"),
|
|
3935
|
+
tabIndex: -1
|
|
3936
|
+
}), clearIcon, inputIcon);
|
|
3937
|
+
};
|
|
3938
|
+
|
|
3939
|
+
return /*#__PURE__*/React.createElement("span", {
|
|
3940
|
+
ref: _this.savePicker,
|
|
3941
|
+
id: typeof props.id === 'number' ? props.id.toString() : props.id,
|
|
3942
|
+
className: classNames(props.className, props.pickerClass),
|
|
3943
|
+
style: _extends$2(_extends$2({}, style), pickerStyle),
|
|
3944
|
+
tabIndex: props.disabled ? -1 : 0,
|
|
3945
|
+
onFocus: props.onFocus,
|
|
3946
|
+
onBlur: props.onBlur,
|
|
3947
|
+
onMouseEnter: props.onMouseEnter,
|
|
3948
|
+
onMouseLeave: props.onMouseLeave
|
|
3949
|
+
}, /*#__PURE__*/React.createElement(Picker, _extends$2({}, props, pickerChangeHandler, {
|
|
3950
|
+
calendar: calendar,
|
|
3951
|
+
value: value,
|
|
3952
|
+
open: open,
|
|
3953
|
+
onOpenChange: _this.handleOpenChange,
|
|
3954
|
+
prefixCls: "".concat(prefixCls, "-picker-container"),
|
|
3955
|
+
style: popupStyle
|
|
3956
|
+
}), input));
|
|
3957
|
+
};
|
|
3958
|
+
|
|
3959
|
+
var value = props.value || props.defaultValue || [];
|
|
3960
|
+
|
|
3961
|
+
var _value6 = _slicedToArray(value, 2),
|
|
3962
|
+
start = _value6[0],
|
|
3963
|
+
end = _value6[1];
|
|
3964
|
+
|
|
3965
|
+
if (start && !interopDefault(moment$1).isMoment(start) || end && !interopDefault(moment$1).isMoment(end)) {
|
|
3966
|
+
throw new Error('The value/defaultValue of RangePicker must be a moment object array after `antd@2.0`, ' + 'see: https://u.ant.design/date-picker-value');
|
|
3967
|
+
}
|
|
3968
|
+
|
|
3969
|
+
var pickerValue = !value || isEmptyArray(value) ? props.defaultPickerValue : value;
|
|
3970
|
+
_this.state = {
|
|
3971
|
+
value: value,
|
|
3972
|
+
showDate: pickerValueAdapter(pickerValue || interopDefault(moment$1)()),
|
|
3973
|
+
open: props.open,
|
|
3974
|
+
hoverValue: []
|
|
3975
|
+
};
|
|
3976
|
+
return _this;
|
|
3977
|
+
}
|
|
3978
|
+
|
|
3979
|
+
_createClass$1(RangePicker, [{
|
|
3980
|
+
key: "componentDidUpdate",
|
|
3981
|
+
value: function componentDidUpdate(_, prevState) {
|
|
3982
|
+
if (!('open' in this.props) && prevState.open && !this.state.open) {
|
|
3983
|
+
this.focus();
|
|
3984
|
+
}
|
|
3985
|
+
}
|
|
3986
|
+
}, {
|
|
3987
|
+
key: "setValue",
|
|
3988
|
+
value: function setValue(value, hidePanel) {
|
|
3989
|
+
this.handleChange(value);
|
|
3990
|
+
|
|
3991
|
+
if ((hidePanel || !this.props.showTime) && !('open' in this.props)) {
|
|
3992
|
+
this.setState({
|
|
3993
|
+
open: false
|
|
3994
|
+
});
|
|
3995
|
+
}
|
|
3996
|
+
}
|
|
3997
|
+
}, {
|
|
3998
|
+
key: "focus",
|
|
3999
|
+
value: function focus() {
|
|
4000
|
+
this.picker.focus();
|
|
4001
|
+
}
|
|
4002
|
+
}, {
|
|
4003
|
+
key: "blur",
|
|
4004
|
+
value: function blur() {
|
|
4005
|
+
this.picker.blur();
|
|
4006
|
+
}
|
|
4007
|
+
}, {
|
|
4008
|
+
key: "render",
|
|
4009
|
+
value: function render() {
|
|
4010
|
+
return /*#__PURE__*/React.createElement(ConfigConsumer, null, this.renderRangePicker);
|
|
4011
|
+
}
|
|
4012
|
+
}], [{
|
|
4013
|
+
key: "getDerivedStateFromProps",
|
|
4014
|
+
value: function getDerivedStateFromProps(nextProps, prevState) {
|
|
4015
|
+
var state = null;
|
|
4016
|
+
|
|
4017
|
+
if ('value' in nextProps) {
|
|
4018
|
+
var value = nextProps.value || [];
|
|
4019
|
+
state = {
|
|
4020
|
+
value: value
|
|
4021
|
+
};
|
|
4022
|
+
|
|
4023
|
+
if (!shallowEqual(nextProps.value, prevState.value)) {
|
|
4024
|
+
state = _extends$2(_extends$2({}, state), {
|
|
4025
|
+
showDate: getShowDateFromValue(value, nextProps.mode) || prevState.showDate
|
|
4026
|
+
});
|
|
4027
|
+
}
|
|
4028
|
+
}
|
|
4029
|
+
|
|
4030
|
+
if ('open' in nextProps && prevState.open !== nextProps.open) {
|
|
4031
|
+
state = _extends$2(_extends$2({}, state), {
|
|
4032
|
+
open: nextProps.open
|
|
4033
|
+
});
|
|
4034
|
+
}
|
|
4035
|
+
|
|
4036
|
+
return state;
|
|
4037
|
+
}
|
|
4038
|
+
}]);
|
|
4039
|
+
|
|
4040
|
+
return RangePicker;
|
|
4041
|
+
}(React.Component);
|
|
4042
|
+
|
|
4043
|
+
RangePicker.defaultProps = {
|
|
4044
|
+
allowClear: true,
|
|
4045
|
+
showToday: false,
|
|
4046
|
+
separator: '~'
|
|
4047
|
+
};
|
|
4048
|
+
polyfill(RangePicker);
|
|
4049
|
+
|
|
4050
|
+
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); }
|
|
4051
|
+
|
|
4052
|
+
function _extends$1() { _extends$1 = Object.assign || function (target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { target[key] = source[key]; } } } return target; }; return _extends$1.apply(this, arguments); }
|
|
4053
|
+
|
|
4054
|
+
function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
|
|
4055
|
+
|
|
4056
|
+
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); } }
|
|
4057
|
+
|
|
4058
|
+
function _createClass(Constructor, protoProps, staticProps) { if (protoProps) _defineProperties(Constructor.prototype, protoProps); if (staticProps) _defineProperties(Constructor, staticProps); return Constructor; }
|
|
4059
|
+
|
|
4060
|
+
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); }
|
|
4061
|
+
|
|
4062
|
+
function _setPrototypeOf(o, p) { _setPrototypeOf = Object.setPrototypeOf || function _setPrototypeOf(o, p) { o.__proto__ = p; return o; }; return _setPrototypeOf(o, p); }
|
|
4063
|
+
|
|
4064
|
+
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); }; }
|
|
4065
|
+
|
|
4066
|
+
function _possibleConstructorReturn(self, call) { if (call && (_typeof(call) === "object" || typeof call === "function")) { return call; } return _assertThisInitialized(self); }
|
|
4067
|
+
|
|
4068
|
+
function _assertThisInitialized(self) { if (self === void 0) { throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); } return self; }
|
|
4069
|
+
|
|
4070
|
+
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; } }
|
|
4071
|
+
|
|
4072
|
+
function _getPrototypeOf(o) { _getPrototypeOf = Object.setPrototypeOf ? Object.getPrototypeOf : function _getPrototypeOf(o) { return o.__proto__ || Object.getPrototypeOf(o); }; return _getPrototypeOf(o); }
|
|
4073
|
+
|
|
4074
|
+
function formatValue(value, format) {
|
|
4075
|
+
return value && value.format(format) || '';
|
|
4076
|
+
}
|
|
4077
|
+
|
|
4078
|
+
var WeekPicker = /*#__PURE__*/function (_React$Component) {
|
|
4079
|
+
_inherits(WeekPicker, _React$Component);
|
|
4080
|
+
|
|
4081
|
+
var _super = _createSuper(WeekPicker);
|
|
4082
|
+
|
|
4083
|
+
function WeekPicker(props) {
|
|
4084
|
+
var _this;
|
|
4085
|
+
|
|
4086
|
+
_classCallCheck(this, WeekPicker);
|
|
4087
|
+
|
|
4088
|
+
_this = _super.call(this, props);
|
|
4089
|
+
|
|
4090
|
+
_this.saveInput = function (node) {
|
|
4091
|
+
_this.input = node;
|
|
4092
|
+
};
|
|
4093
|
+
|
|
4094
|
+
_this.weekDateRender = function (current) {
|
|
4095
|
+
var selectedValue = _this.state.value;
|
|
4096
|
+
|
|
4097
|
+
var _assertThisInitialize = _assertThisInitialized(_this),
|
|
4098
|
+
prefixCls = _assertThisInitialize.prefixCls;
|
|
4099
|
+
|
|
4100
|
+
var dateRender = _this.props.dateRender;
|
|
4101
|
+
var dateNode = dateRender ? dateRender(current) : current.date();
|
|
4102
|
+
|
|
4103
|
+
if (selectedValue && current.year() === selectedValue.year() && current.week() === selectedValue.week()) {
|
|
4104
|
+
return /*#__PURE__*/React.createElement("div", {
|
|
4105
|
+
className: "".concat(prefixCls, "-selected-day")
|
|
4106
|
+
}, /*#__PURE__*/React.createElement("div", {
|
|
4107
|
+
className: "".concat(prefixCls, "-date")
|
|
4108
|
+
}, dateNode));
|
|
4109
|
+
}
|
|
4110
|
+
|
|
4111
|
+
return /*#__PURE__*/React.createElement("div", {
|
|
4112
|
+
className: "".concat(prefixCls, "-date")
|
|
4113
|
+
}, dateNode);
|
|
4114
|
+
};
|
|
4115
|
+
|
|
4116
|
+
_this.handleChange = function (value) {
|
|
4117
|
+
if (!('value' in _this.props)) {
|
|
4118
|
+
_this.setState({
|
|
4119
|
+
value: value
|
|
4120
|
+
});
|
|
4121
|
+
}
|
|
4122
|
+
|
|
4123
|
+
_this.props.onChange(value, formatValue(value, _this.props.format));
|
|
4124
|
+
};
|
|
4125
|
+
|
|
4126
|
+
_this.handleOpenChange = function (open) {
|
|
4127
|
+
var onOpenChange = _this.props.onOpenChange;
|
|
4128
|
+
|
|
4129
|
+
if (!('open' in _this.props)) {
|
|
4130
|
+
_this.setState({
|
|
4131
|
+
open: open
|
|
4132
|
+
});
|
|
4133
|
+
}
|
|
4134
|
+
|
|
4135
|
+
if (onOpenChange) {
|
|
4136
|
+
onOpenChange(open);
|
|
4137
|
+
}
|
|
4138
|
+
};
|
|
4139
|
+
|
|
4140
|
+
_this.clearSelection = function (e) {
|
|
4141
|
+
e.preventDefault();
|
|
4142
|
+
e.stopPropagation();
|
|
4143
|
+
|
|
4144
|
+
_this.handleChange(null);
|
|
4145
|
+
};
|
|
4146
|
+
|
|
4147
|
+
_this.renderFooter = function () {
|
|
4148
|
+
var _this$props = _this.props,
|
|
4149
|
+
prefixCls = _this$props.prefixCls,
|
|
4150
|
+
renderExtraFooter = _this$props.renderExtraFooter;
|
|
4151
|
+
return renderExtraFooter ? /*#__PURE__*/React.createElement("div", {
|
|
4152
|
+
className: "".concat(prefixCls, "-footer-extra")
|
|
4153
|
+
}, renderExtraFooter.apply(void 0, arguments)) : null;
|
|
4154
|
+
};
|
|
4155
|
+
|
|
4156
|
+
_this.renderWeekPicker = function (_ref) {
|
|
4157
|
+
var getPrefixCls = _ref.getPrefixCls;
|
|
4158
|
+
var _this$props2 = _this.props,
|
|
4159
|
+
customizePrefixCls = _this$props2.prefixCls,
|
|
4160
|
+
className = _this$props2.className,
|
|
4161
|
+
disabled = _this$props2.disabled,
|
|
4162
|
+
pickerClass = _this$props2.pickerClass,
|
|
4163
|
+
popupStyle = _this$props2.popupStyle,
|
|
4164
|
+
pickerInputClass = _this$props2.pickerInputClass,
|
|
4165
|
+
format = _this$props2.format,
|
|
4166
|
+
allowClear = _this$props2.allowClear,
|
|
4167
|
+
locale = _this$props2.locale,
|
|
4168
|
+
localeCode = _this$props2.localeCode,
|
|
4169
|
+
disabledDate = _this$props2.disabledDate,
|
|
4170
|
+
style = _this$props2.style,
|
|
4171
|
+
onFocus = _this$props2.onFocus,
|
|
4172
|
+
onBlur = _this$props2.onBlur,
|
|
4173
|
+
id = _this$props2.id,
|
|
4174
|
+
suffixIcon = _this$props2.suffixIcon,
|
|
4175
|
+
defaultPickerValue = _this$props2.defaultPickerValue;
|
|
4176
|
+
var prefixCls = getPrefixCls('calendar', customizePrefixCls); // To support old version react.
|
|
4177
|
+
// Have to add prefixCls on the instance.
|
|
4178
|
+
// https://github.com/facebook/react/issues/12397
|
|
4179
|
+
|
|
4180
|
+
_this.prefixCls = prefixCls;
|
|
4181
|
+
var _this$state = _this.state,
|
|
4182
|
+
open = _this$state.open,
|
|
4183
|
+
pickerValue = _this$state.value;
|
|
4184
|
+
|
|
4185
|
+
if (pickerValue && localeCode) {
|
|
4186
|
+
pickerValue.locale(localeCode);
|
|
4187
|
+
}
|
|
4188
|
+
|
|
4189
|
+
var placeholder = 'placeholder' in _this.props ? _this.props.placeholder : locale.lang.placeholder;
|
|
4190
|
+
var calendar = /*#__PURE__*/React.createElement(Calendar$1, {
|
|
4191
|
+
showWeekNumber: true,
|
|
4192
|
+
dateRender: _this.weekDateRender,
|
|
4193
|
+
prefixCls: prefixCls,
|
|
4194
|
+
format: format,
|
|
4195
|
+
locale: locale.lang,
|
|
4196
|
+
showDateInput: false,
|
|
4197
|
+
showToday: false,
|
|
4198
|
+
disabledDate: disabledDate,
|
|
4199
|
+
renderFooter: _this.renderFooter,
|
|
4200
|
+
defaultValue: defaultPickerValue
|
|
4201
|
+
});
|
|
4202
|
+
var clearIcon = !disabled && allowClear && _this.state.value ? /*#__PURE__*/React.createElement(Icon, {
|
|
4203
|
+
type: "close-circle",
|
|
4204
|
+
className: "".concat(prefixCls, "-picker-clear"),
|
|
4205
|
+
onClick: _this.clearSelection,
|
|
4206
|
+
theme: "filled"
|
|
4207
|
+
}) : null;
|
|
4208
|
+
var inputIcon = /*#__PURE__*/React.createElement(InputIcon, {
|
|
4209
|
+
suffixIcon: suffixIcon,
|
|
4210
|
+
prefixCls: prefixCls
|
|
4211
|
+
});
|
|
4212
|
+
|
|
4213
|
+
var input = function input(_ref2) {
|
|
4214
|
+
var value = _ref2.value;
|
|
4215
|
+
return /*#__PURE__*/React.createElement("span", {
|
|
4216
|
+
style: {
|
|
4217
|
+
display: 'inline-block',
|
|
4218
|
+
width: '100%'
|
|
4219
|
+
}
|
|
4220
|
+
}, /*#__PURE__*/React.createElement("input", {
|
|
4221
|
+
ref: _this.saveInput,
|
|
4222
|
+
disabled: disabled,
|
|
4223
|
+
readOnly: true,
|
|
4224
|
+
value: value && value.format(format) || '',
|
|
4225
|
+
placeholder: placeholder,
|
|
4226
|
+
className: pickerInputClass,
|
|
4227
|
+
onFocus: onFocus,
|
|
4228
|
+
onBlur: onBlur
|
|
4229
|
+
}), clearIcon, inputIcon);
|
|
4230
|
+
};
|
|
4231
|
+
|
|
4232
|
+
return /*#__PURE__*/React.createElement("span", {
|
|
4233
|
+
className: classNames(className, pickerClass),
|
|
4234
|
+
style: style,
|
|
4235
|
+
id: id
|
|
4236
|
+
}, /*#__PURE__*/React.createElement(Picker, _extends$1({}, _this.props, {
|
|
4237
|
+
calendar: calendar,
|
|
4238
|
+
prefixCls: "".concat(prefixCls, "-picker-container"),
|
|
4239
|
+
value: pickerValue,
|
|
4240
|
+
onChange: _this.handleChange,
|
|
4241
|
+
open: open,
|
|
4242
|
+
onOpenChange: _this.handleOpenChange,
|
|
4243
|
+
style: popupStyle
|
|
4244
|
+
}), input));
|
|
4245
|
+
};
|
|
4246
|
+
|
|
4247
|
+
var value = props.value || props.defaultValue;
|
|
4248
|
+
|
|
4249
|
+
if (value && !interopDefault(moment$1).isMoment(value)) {
|
|
4250
|
+
throw new Error('The value/defaultValue of WeekPicker must be ' + 'a moment object after `antd@2.0`, see: https://u.ant.design/date-picker-value');
|
|
4251
|
+
}
|
|
4252
|
+
|
|
4253
|
+
_this.state = {
|
|
4254
|
+
value: value,
|
|
4255
|
+
open: props.open
|
|
4256
|
+
};
|
|
4257
|
+
return _this;
|
|
4258
|
+
}
|
|
4259
|
+
|
|
4260
|
+
_createClass(WeekPicker, [{
|
|
4261
|
+
key: "componentDidUpdate",
|
|
4262
|
+
value: function componentDidUpdate(_, prevState) {
|
|
4263
|
+
if (!('open' in this.props) && prevState.open && !this.state.open) {
|
|
4264
|
+
this.focus();
|
|
4265
|
+
}
|
|
4266
|
+
}
|
|
4267
|
+
}, {
|
|
4268
|
+
key: "focus",
|
|
4269
|
+
value: function focus() {
|
|
4270
|
+
this.input.focus();
|
|
4271
|
+
}
|
|
4272
|
+
}, {
|
|
4273
|
+
key: "blur",
|
|
4274
|
+
value: function blur() {
|
|
4275
|
+
this.input.blur();
|
|
4276
|
+
}
|
|
4277
|
+
}, {
|
|
4278
|
+
key: "render",
|
|
4279
|
+
value: function render() {
|
|
4280
|
+
return /*#__PURE__*/React.createElement(ConfigConsumer, null, this.renderWeekPicker);
|
|
4281
|
+
}
|
|
4282
|
+
}], [{
|
|
4283
|
+
key: "getDerivedStateFromProps",
|
|
4284
|
+
value: function getDerivedStateFromProps(nextProps) {
|
|
4285
|
+
if ('value' in nextProps || 'open' in nextProps) {
|
|
4286
|
+
var state = {};
|
|
4287
|
+
|
|
4288
|
+
if ('value' in nextProps) {
|
|
4289
|
+
state.value = nextProps.value;
|
|
4290
|
+
}
|
|
4291
|
+
|
|
4292
|
+
if ('open' in nextProps) {
|
|
4293
|
+
state.open = nextProps.open;
|
|
4294
|
+
}
|
|
4295
|
+
|
|
4296
|
+
return state;
|
|
4297
|
+
}
|
|
4298
|
+
|
|
4299
|
+
return null;
|
|
4300
|
+
}
|
|
4301
|
+
}]);
|
|
4302
|
+
|
|
4303
|
+
return WeekPicker;
|
|
4304
|
+
}(React.Component);
|
|
4305
|
+
|
|
4306
|
+
WeekPicker.defaultProps = {
|
|
4307
|
+
format: 'gggg-wo',
|
|
4308
|
+
allowClear: true
|
|
4309
|
+
};
|
|
4310
|
+
polyfill(WeekPicker);
|
|
4311
|
+
|
|
4312
|
+
function _extends() { _extends = Object.assign || function (target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { target[key] = source[key]; } } } return target; }; return _extends.apply(this, arguments); }
|
|
4313
|
+
var DatePicker = wrapPicker(createPicker(Calendar$1), 'date');
|
|
4314
|
+
var MonthPicker = wrapPicker(createPicker(MonthCalendar$1), 'month');
|
|
4315
|
+
|
|
4316
|
+
_extends(DatePicker, {
|
|
4317
|
+
RangePicker: wrapPicker(RangePicker, 'date'),
|
|
4318
|
+
MonthPicker: MonthPicker,
|
|
4319
|
+
WeekPicker: wrapPicker(WeekPicker, 'week')
|
|
4320
|
+
});
|
|
4321
|
+
|
|
4322
|
+
export { DatePicker as default };
|