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,953 @@
|
|
|
1
|
+
import { n, P as PropTypes, m as moment, C as ConfigConsumer, l as locale, o as interopDefault, q as moment$1, L as LocaleReceiver, p as propTypesExports } from '../../config-provider.js';
|
|
2
|
+
import * as React from 'react';
|
|
3
|
+
import React__default, { Component } from 'react';
|
|
4
|
+
import { _ as _inherits$2, a as _classCallCheck$2, b as _possibleConstructorReturn$2, e as _extends$1 } from '../../icon.js';
|
|
5
|
+
import { p as polyfill } from '../../menu.js';
|
|
6
|
+
import { g as getMonthName, c as calendarMixinWrapper, a as commonMixinWrapper, b as getNowByCurrentStateValue, D as DateTable, M as MonthTable, d as calendarMixinPropTypes, p as propType, e as calendarMixinDefaultProps, f as defaultProp } from '../../CommonMixin.js';
|
|
7
|
+
import { S as Select } from '../../index12.js';
|
|
8
|
+
import { a as RadioGroup, R as RadioButton } from '../../index13.js';
|
|
9
|
+
import 'react-dom';
|
|
10
|
+
import '../../Divider.js';
|
|
11
|
+
import '../../index5.js';
|
|
12
|
+
import '../../tree.js';
|
|
13
|
+
import '../../input.js';
|
|
14
|
+
import '../../Checkbox.js';
|
|
15
|
+
|
|
16
|
+
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-fullcalendar {\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 border-top: 1px solid #d9d9d9;\n outline: none;\n}\n.ant-select.ant-fullcalendar-year-select {\n min-width: 90px;\n}\n.ant-select.ant-fullcalendar-year-select.ant-select-sm {\n min-width: 70px;\n}\n.ant-select.ant-fullcalendar-month-select {\n min-width: 80px;\n margin-left: 8px;\n}\n.ant-select.ant-fullcalendar-month-select.ant-select-sm {\n min-width: 70px;\n}\n.ant-fullcalendar-header {\n padding: 11px 16px 11px 0;\n text-align: right;\n}\n.ant-fullcalendar-header .ant-select-dropdown {\n text-align: left;\n}\n.ant-fullcalendar-header .ant-radio-group {\n margin-left: 8px;\n text-align: left;\n}\n.ant-fullcalendar-header label.ant-radio-button {\n height: 22px;\n padding: 0 10px;\n line-height: 20px;\n}\n.ant-fullcalendar-date-panel {\n position: relative;\n outline: none;\n}\n.ant-fullcalendar-calendar-body {\n padding: 8px 12px;\n}\n.ant-fullcalendar table {\n width: 100%;\n max-width: 100%;\n height: 256px;\n background-color: transparent;\n border-collapse: collapse;\n}\n.ant-fullcalendar table,\n.ant-fullcalendar th,\n.ant-fullcalendar td {\n border: 0;\n}\n.ant-fullcalendar td {\n position: relative;\n}\n.ant-fullcalendar-calendar-table {\n margin-bottom: 0;\n border-spacing: 0;\n}\n.ant-fullcalendar-column-header {\n width: 33px;\n padding: 0;\n line-height: 18px;\n text-align: center;\n}\n.ant-fullcalendar-column-header .ant-fullcalendar-column-header-inner {\n display: block;\n font-weight: normal;\n}\n.ant-fullcalendar-week-number-header .ant-fullcalendar-column-header-inner {\n display: none;\n}\n.ant-fullcalendar-month,\n.ant-fullcalendar-date {\n text-align: center;\n transition: all 0.3s;\n}\n.ant-fullcalendar-value {\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: 24px;\n background: transparent;\n border-radius: 2px;\n transition: all 0.3s;\n}\n.ant-fullcalendar-value:hover {\n background: #e6f7ff;\n cursor: pointer;\n}\n.ant-fullcalendar-value:active {\n color: #fff;\n background: #1890ff;\n}\n.ant-fullcalendar-month-panel-cell .ant-fullcalendar-value {\n width: 48px;\n}\n.ant-fullcalendar-today .ant-fullcalendar-value,\n.ant-fullcalendar-month-panel-current-cell .ant-fullcalendar-value {\n box-shadow: 0 0 0 1px #1890ff inset;\n}\n.ant-fullcalendar-selected-day .ant-fullcalendar-value,\n.ant-fullcalendar-month-panel-selected-cell .ant-fullcalendar-value {\n color: #fff;\n background: #1890ff;\n}\n.ant-fullcalendar-disabled-cell-first-of-row .ant-fullcalendar-value {\n border-top-left-radius: 4px;\n border-bottom-left-radius: 4px;\n}\n.ant-fullcalendar-disabled-cell-last-of-row .ant-fullcalendar-value {\n border-top-right-radius: 4px;\n border-bottom-right-radius: 4px;\n}\n.ant-fullcalendar-last-month-cell .ant-fullcalendar-value,\n.ant-fullcalendar-next-month-btn-day .ant-fullcalendar-value {\n color: rgba(0, 0, 0, 0.25);\n}\n.ant-fullcalendar-month-panel-table {\n width: 100%;\n table-layout: fixed;\n border-collapse: separate;\n}\n.ant-fullcalendar-content {\n position: absolute;\n bottom: -9px;\n left: 0;\n width: 100%;\n}\n.ant-fullcalendar-fullscreen {\n border-top: 0;\n}\n.ant-fullcalendar-fullscreen .ant-fullcalendar-table {\n table-layout: fixed;\n}\n.ant-fullcalendar-fullscreen .ant-fullcalendar-header .ant-radio-group {\n margin-left: 16px;\n}\n.ant-fullcalendar-fullscreen .ant-fullcalendar-header label.ant-radio-button {\n height: 32px;\n line-height: 30px;\n}\n.ant-fullcalendar-fullscreen .ant-fullcalendar-month,\n.ant-fullcalendar-fullscreen .ant-fullcalendar-date {\n display: block;\n height: 116px;\n margin: 0 4px;\n padding: 4px 8px;\n color: rgba(0, 0, 0, 0.65);\n text-align: left;\n border-top: 2px solid #e8e8e8;\n transition: background 0.3s;\n}\n.ant-fullcalendar-fullscreen .ant-fullcalendar-month:hover,\n.ant-fullcalendar-fullscreen .ant-fullcalendar-date:hover {\n background: #e6f7ff;\n cursor: pointer;\n}\n.ant-fullcalendar-fullscreen .ant-fullcalendar-month:active,\n.ant-fullcalendar-fullscreen .ant-fullcalendar-date:active {\n background: #bae7ff;\n}\n.ant-fullcalendar-fullscreen .ant-fullcalendar-column-header {\n padding-right: 12px;\n padding-bottom: 5px;\n text-align: right;\n}\n.ant-fullcalendar-fullscreen .ant-fullcalendar-value {\n width: auto;\n text-align: right;\n background: transparent;\n}\n.ant-fullcalendar-fullscreen .ant-fullcalendar-today .ant-fullcalendar-value {\n color: rgba(0, 0, 0, 0.65);\n}\n.ant-fullcalendar-fullscreen .ant-fullcalendar-month-panel-current-cell .ant-fullcalendar-month,\n.ant-fullcalendar-fullscreen .ant-fullcalendar-today .ant-fullcalendar-date {\n background: transparent;\n border-top-color: #1890ff;\n}\n.ant-fullcalendar-fullscreen .ant-fullcalendar-month-panel-current-cell .ant-fullcalendar-value,\n.ant-fullcalendar-fullscreen .ant-fullcalendar-today .ant-fullcalendar-value {\n box-shadow: none;\n}\n.ant-fullcalendar-fullscreen .ant-fullcalendar-month-panel-selected-cell .ant-fullcalendar-month,\n.ant-fullcalendar-fullscreen .ant-fullcalendar-selected-day .ant-fullcalendar-date {\n background: #e6f7ff;\n}\n.ant-fullcalendar-fullscreen .ant-fullcalendar-month-panel-selected-cell .ant-fullcalendar-value,\n.ant-fullcalendar-fullscreen .ant-fullcalendar-selected-day .ant-fullcalendar-value {\n color: #1890ff;\n}\n.ant-fullcalendar-fullscreen .ant-fullcalendar-last-month-cell .ant-fullcalendar-date,\n.ant-fullcalendar-fullscreen .ant-fullcalendar-next-month-btn-day .ant-fullcalendar-date {\n color: rgba(0, 0, 0, 0.25);\n}\n.ant-fullcalendar-fullscreen .ant-fullcalendar-content {\n position: static;\n width: auto;\n height: 88px;\n overflow-y: auto;\n}\n.ant-fullcalendar-disabled-cell .ant-fullcalendar-date,\n.ant-fullcalendar-disabled-cell .ant-fullcalendar-date:hover {\n cursor: not-allowed;\n}\n.ant-fullcalendar-disabled-cell:not(.ant-fullcalendar-today) .ant-fullcalendar-date,\n.ant-fullcalendar-disabled-cell:not(.ant-fullcalendar-today) .ant-fullcalendar-date:hover {\n background: transparent;\n}\n.ant-fullcalendar-disabled-cell .ant-fullcalendar-value {\n width: auto;\n color: rgba(0, 0, 0, 0.25);\n border-radius: 0;\n cursor: not-allowed;\n}\n/*# sourceMappingURL=index.css.map */";
|
|
17
|
+
n(css,{"prepend":true});
|
|
18
|
+
|
|
19
|
+
function noop$1() {}
|
|
20
|
+
|
|
21
|
+
var CalendarHeader = function (_Component) {
|
|
22
|
+
_inherits$2(CalendarHeader, _Component);
|
|
23
|
+
|
|
24
|
+
function CalendarHeader() {
|
|
25
|
+
_classCallCheck$2(this, CalendarHeader);
|
|
26
|
+
|
|
27
|
+
return _possibleConstructorReturn$2(this, _Component.apply(this, arguments));
|
|
28
|
+
}
|
|
29
|
+
|
|
30
|
+
CalendarHeader.prototype.onYearChange = function onYearChange(year) {
|
|
31
|
+
var newValue = this.props.value.clone();
|
|
32
|
+
newValue.year(parseInt(year, 10));
|
|
33
|
+
this.props.onValueChange(newValue);
|
|
34
|
+
};
|
|
35
|
+
|
|
36
|
+
CalendarHeader.prototype.onMonthChange = function onMonthChange(month) {
|
|
37
|
+
var newValue = this.props.value.clone();
|
|
38
|
+
newValue.month(parseInt(month, 10));
|
|
39
|
+
this.props.onValueChange(newValue);
|
|
40
|
+
};
|
|
41
|
+
|
|
42
|
+
CalendarHeader.prototype.yearSelectElement = function yearSelectElement(year) {
|
|
43
|
+
var _props = this.props,
|
|
44
|
+
yearSelectOffset = _props.yearSelectOffset,
|
|
45
|
+
yearSelectTotal = _props.yearSelectTotal,
|
|
46
|
+
prefixCls = _props.prefixCls,
|
|
47
|
+
Select = _props.Select;
|
|
48
|
+
|
|
49
|
+
var start = year - yearSelectOffset;
|
|
50
|
+
var end = start + yearSelectTotal;
|
|
51
|
+
|
|
52
|
+
var options = [];
|
|
53
|
+
for (var index = start; index < end; index++) {
|
|
54
|
+
options.push(React__default.createElement(
|
|
55
|
+
Select.Option,
|
|
56
|
+
{ key: '' + index },
|
|
57
|
+
index
|
|
58
|
+
));
|
|
59
|
+
}
|
|
60
|
+
return React__default.createElement(
|
|
61
|
+
Select,
|
|
62
|
+
{
|
|
63
|
+
className: prefixCls + '-header-year-select',
|
|
64
|
+
onChange: this.onYearChange.bind(this),
|
|
65
|
+
dropdownStyle: { zIndex: 2000 },
|
|
66
|
+
dropdownMenuStyle: { maxHeight: 250, overflow: 'auto', fontSize: 12 },
|
|
67
|
+
optionLabelProp: 'children',
|
|
68
|
+
value: String(year),
|
|
69
|
+
showSearch: false
|
|
70
|
+
},
|
|
71
|
+
options
|
|
72
|
+
);
|
|
73
|
+
};
|
|
74
|
+
|
|
75
|
+
CalendarHeader.prototype.monthSelectElement = function monthSelectElement(month) {
|
|
76
|
+
var props = this.props;
|
|
77
|
+
var t = props.value.clone();
|
|
78
|
+
var prefixCls = props.prefixCls;
|
|
79
|
+
|
|
80
|
+
var options = [];
|
|
81
|
+
var Select = props.Select;
|
|
82
|
+
|
|
83
|
+
for (var index = 0; index < 12; index++) {
|
|
84
|
+
t.month(index);
|
|
85
|
+
options.push(React__default.createElement(
|
|
86
|
+
Select.Option,
|
|
87
|
+
{ key: '' + index },
|
|
88
|
+
getMonthName(t)
|
|
89
|
+
));
|
|
90
|
+
}
|
|
91
|
+
|
|
92
|
+
return React__default.createElement(
|
|
93
|
+
Select,
|
|
94
|
+
{
|
|
95
|
+
className: prefixCls + '-header-month-select',
|
|
96
|
+
dropdownStyle: { zIndex: 2000 },
|
|
97
|
+
dropdownMenuStyle: { maxHeight: 250, overflow: 'auto', overflowX: 'hidden', fontSize: 12 },
|
|
98
|
+
optionLabelProp: 'children',
|
|
99
|
+
value: String(month),
|
|
100
|
+
showSearch: false,
|
|
101
|
+
onChange: this.onMonthChange.bind(this)
|
|
102
|
+
},
|
|
103
|
+
options
|
|
104
|
+
);
|
|
105
|
+
};
|
|
106
|
+
|
|
107
|
+
CalendarHeader.prototype.changeTypeToDate = function changeTypeToDate() {
|
|
108
|
+
this.props.onTypeChange('date');
|
|
109
|
+
};
|
|
110
|
+
|
|
111
|
+
CalendarHeader.prototype.changeTypeToMonth = function changeTypeToMonth() {
|
|
112
|
+
this.props.onTypeChange('month');
|
|
113
|
+
};
|
|
114
|
+
|
|
115
|
+
CalendarHeader.prototype.render = function render() {
|
|
116
|
+
var _props2 = this.props,
|
|
117
|
+
value = _props2.value,
|
|
118
|
+
locale = _props2.locale,
|
|
119
|
+
prefixCls = _props2.prefixCls,
|
|
120
|
+
type = _props2.type,
|
|
121
|
+
showTypeSwitch = _props2.showTypeSwitch,
|
|
122
|
+
headerComponents = _props2.headerComponents;
|
|
123
|
+
|
|
124
|
+
var year = value.year();
|
|
125
|
+
var month = value.month();
|
|
126
|
+
var yearSelect = this.yearSelectElement(year);
|
|
127
|
+
var monthSelect = type === 'month' ? null : this.monthSelectElement(month);
|
|
128
|
+
var switchCls = prefixCls + '-header-switcher';
|
|
129
|
+
var typeSwitcher = showTypeSwitch ? React__default.createElement(
|
|
130
|
+
'span',
|
|
131
|
+
{ className: switchCls },
|
|
132
|
+
type === 'date' ? React__default.createElement(
|
|
133
|
+
'span',
|
|
134
|
+
{ className: switchCls + '-focus' },
|
|
135
|
+
locale.month
|
|
136
|
+
) : React__default.createElement(
|
|
137
|
+
'span',
|
|
138
|
+
{
|
|
139
|
+
onClick: this.changeTypeToDate.bind(this),
|
|
140
|
+
className: switchCls + '-normal'
|
|
141
|
+
},
|
|
142
|
+
locale.month
|
|
143
|
+
),
|
|
144
|
+
type === 'month' ? React__default.createElement(
|
|
145
|
+
'span',
|
|
146
|
+
{ className: switchCls + '-focus' },
|
|
147
|
+
locale.year
|
|
148
|
+
) : React__default.createElement(
|
|
149
|
+
'span',
|
|
150
|
+
{
|
|
151
|
+
onClick: this.changeTypeToMonth.bind(this),
|
|
152
|
+
className: switchCls + '-normal'
|
|
153
|
+
},
|
|
154
|
+
locale.year
|
|
155
|
+
)
|
|
156
|
+
) : null;
|
|
157
|
+
|
|
158
|
+
return React__default.createElement(
|
|
159
|
+
'div',
|
|
160
|
+
{ className: prefixCls + '-header' },
|
|
161
|
+
typeSwitcher,
|
|
162
|
+
monthSelect,
|
|
163
|
+
yearSelect,
|
|
164
|
+
headerComponents
|
|
165
|
+
);
|
|
166
|
+
};
|
|
167
|
+
|
|
168
|
+
return CalendarHeader;
|
|
169
|
+
}(Component);
|
|
170
|
+
|
|
171
|
+
CalendarHeader.propTypes = {
|
|
172
|
+
value: PropTypes.object,
|
|
173
|
+
locale: PropTypes.object,
|
|
174
|
+
yearSelectOffset: PropTypes.number,
|
|
175
|
+
yearSelectTotal: PropTypes.number,
|
|
176
|
+
onValueChange: PropTypes.func,
|
|
177
|
+
onTypeChange: PropTypes.func,
|
|
178
|
+
Select: PropTypes.func,
|
|
179
|
+
prefixCls: PropTypes.string,
|
|
180
|
+
type: PropTypes.string,
|
|
181
|
+
showTypeSwitch: PropTypes.bool,
|
|
182
|
+
headerComponents: PropTypes.array
|
|
183
|
+
};
|
|
184
|
+
CalendarHeader.defaultProps = {
|
|
185
|
+
yearSelectOffset: 10,
|
|
186
|
+
yearSelectTotal: 20,
|
|
187
|
+
onValueChange: noop$1,
|
|
188
|
+
onTypeChange: noop$1
|
|
189
|
+
};
|
|
190
|
+
|
|
191
|
+
var FullCalendar = function (_React$Component) {
|
|
192
|
+
_inherits$2(FullCalendar, _React$Component);
|
|
193
|
+
|
|
194
|
+
function FullCalendar(props) {
|
|
195
|
+
_classCallCheck$2(this, FullCalendar);
|
|
196
|
+
|
|
197
|
+
var _this = _possibleConstructorReturn$2(this, _React$Component.call(this, props));
|
|
198
|
+
|
|
199
|
+
_initialiseProps.call(_this);
|
|
200
|
+
|
|
201
|
+
var type = void 0;
|
|
202
|
+
if ('type' in props) {
|
|
203
|
+
type = props.type;
|
|
204
|
+
} else {
|
|
205
|
+
type = props.defaultType;
|
|
206
|
+
}
|
|
207
|
+
|
|
208
|
+
_this.state = {
|
|
209
|
+
type: type,
|
|
210
|
+
value: props.value || props.defaultValue || moment(),
|
|
211
|
+
selectedValue: props.selectedValue || props.defaultSelectedValue
|
|
212
|
+
};
|
|
213
|
+
return _this;
|
|
214
|
+
}
|
|
215
|
+
|
|
216
|
+
FullCalendar.getDerivedStateFromProps = function getDerivedStateFromProps(nextProps, state) {
|
|
217
|
+
var newState = {};
|
|
218
|
+
var value = nextProps.value,
|
|
219
|
+
selectedValue = nextProps.selectedValue;
|
|
220
|
+
|
|
221
|
+
|
|
222
|
+
if ('type' in nextProps) {
|
|
223
|
+
newState = {
|
|
224
|
+
type: nextProps.type
|
|
225
|
+
};
|
|
226
|
+
}
|
|
227
|
+
if ('value' in nextProps) {
|
|
228
|
+
newState.value = value || nextProps.defaultValue || getNowByCurrentStateValue(state.value);
|
|
229
|
+
}
|
|
230
|
+
if ('selectedValue' in nextProps) {
|
|
231
|
+
newState.selectedValue = selectedValue;
|
|
232
|
+
}
|
|
233
|
+
|
|
234
|
+
return newState;
|
|
235
|
+
};
|
|
236
|
+
|
|
237
|
+
FullCalendar.prototype.render = function render() {
|
|
238
|
+
var props = this.props;
|
|
239
|
+
var locale = props.locale,
|
|
240
|
+
prefixCls = props.prefixCls,
|
|
241
|
+
fullscreen = props.fullscreen,
|
|
242
|
+
showHeader = props.showHeader,
|
|
243
|
+
headerComponent = props.headerComponent,
|
|
244
|
+
headerRender = props.headerRender,
|
|
245
|
+
disabledDate = props.disabledDate;
|
|
246
|
+
var _state = this.state,
|
|
247
|
+
value = _state.value,
|
|
248
|
+
type = _state.type;
|
|
249
|
+
|
|
250
|
+
|
|
251
|
+
var header = null;
|
|
252
|
+
if (showHeader) {
|
|
253
|
+
if (headerRender) {
|
|
254
|
+
header = headerRender(value, type, locale);
|
|
255
|
+
} else {
|
|
256
|
+
var TheHeader = headerComponent || CalendarHeader;
|
|
257
|
+
header = React__default.createElement(TheHeader, _extends$1({
|
|
258
|
+
key: 'calendar-header'
|
|
259
|
+
}, props, {
|
|
260
|
+
prefixCls: prefixCls + '-full',
|
|
261
|
+
type: type,
|
|
262
|
+
value: value,
|
|
263
|
+
onTypeChange: this.setType,
|
|
264
|
+
onValueChange: this.setValue
|
|
265
|
+
}));
|
|
266
|
+
}
|
|
267
|
+
}
|
|
268
|
+
|
|
269
|
+
var table = type === 'date' ? React__default.createElement(DateTable, {
|
|
270
|
+
dateRender: props.dateCellRender,
|
|
271
|
+
contentRender: props.dateCellContentRender,
|
|
272
|
+
locale: locale,
|
|
273
|
+
prefixCls: prefixCls,
|
|
274
|
+
onSelect: this.onSelect,
|
|
275
|
+
value: value,
|
|
276
|
+
disabledDate: disabledDate
|
|
277
|
+
}) : React__default.createElement(MonthTable, {
|
|
278
|
+
cellRender: props.monthCellRender,
|
|
279
|
+
contentRender: props.monthCellContentRender,
|
|
280
|
+
locale: locale,
|
|
281
|
+
onSelect: this.onMonthSelect,
|
|
282
|
+
prefixCls: prefixCls + '-month-panel',
|
|
283
|
+
value: value,
|
|
284
|
+
disabledDate: disabledDate
|
|
285
|
+
});
|
|
286
|
+
|
|
287
|
+
var children = [header, React__default.createElement(
|
|
288
|
+
'div',
|
|
289
|
+
{ key: 'calendar-body', className: prefixCls + '-calendar-body' },
|
|
290
|
+
table
|
|
291
|
+
)];
|
|
292
|
+
|
|
293
|
+
var className = [prefixCls + '-full'];
|
|
294
|
+
|
|
295
|
+
if (fullscreen) {
|
|
296
|
+
className.push(prefixCls + '-fullscreen');
|
|
297
|
+
}
|
|
298
|
+
|
|
299
|
+
return this.renderRoot({
|
|
300
|
+
children: children,
|
|
301
|
+
className: className.join(' ')
|
|
302
|
+
});
|
|
303
|
+
};
|
|
304
|
+
|
|
305
|
+
return FullCalendar;
|
|
306
|
+
}(React__default.Component);
|
|
307
|
+
|
|
308
|
+
FullCalendar.propTypes = _extends$1({}, calendarMixinPropTypes, propType, {
|
|
309
|
+
defaultType: PropTypes.string,
|
|
310
|
+
type: PropTypes.string,
|
|
311
|
+
prefixCls: PropTypes.string,
|
|
312
|
+
locale: PropTypes.object,
|
|
313
|
+
onTypeChange: PropTypes.func,
|
|
314
|
+
fullscreen: PropTypes.bool,
|
|
315
|
+
monthCellRender: PropTypes.func,
|
|
316
|
+
dateCellRender: PropTypes.func,
|
|
317
|
+
showTypeSwitch: PropTypes.bool,
|
|
318
|
+
Select: PropTypes.func.isRequired,
|
|
319
|
+
headerComponents: PropTypes.array,
|
|
320
|
+
headerComponent: PropTypes.object, // The whole header component
|
|
321
|
+
headerRender: PropTypes.func,
|
|
322
|
+
showHeader: PropTypes.bool,
|
|
323
|
+
disabledDate: PropTypes.func,
|
|
324
|
+
value: PropTypes.object,
|
|
325
|
+
defaultValue: PropTypes.object,
|
|
326
|
+
selectedValue: PropTypes.object,
|
|
327
|
+
defaultSelectedValue: PropTypes.object
|
|
328
|
+
});
|
|
329
|
+
FullCalendar.defaultProps = _extends$1({}, calendarMixinDefaultProps, defaultProp, {
|
|
330
|
+
defaultType: 'date',
|
|
331
|
+
fullscreen: false,
|
|
332
|
+
showTypeSwitch: true,
|
|
333
|
+
showHeader: true,
|
|
334
|
+
onTypeChange: function onTypeChange() {}
|
|
335
|
+
});
|
|
336
|
+
|
|
337
|
+
var _initialiseProps = function _initialiseProps() {
|
|
338
|
+
var _this2 = this;
|
|
339
|
+
|
|
340
|
+
this.onMonthSelect = function (value) {
|
|
341
|
+
_this2.onSelect(value, {
|
|
342
|
+
target: 'month'
|
|
343
|
+
});
|
|
344
|
+
};
|
|
345
|
+
|
|
346
|
+
this.setType = function (type) {
|
|
347
|
+
if (!('type' in _this2.props)) {
|
|
348
|
+
_this2.setState({
|
|
349
|
+
type: type
|
|
350
|
+
});
|
|
351
|
+
}
|
|
352
|
+
_this2.props.onTypeChange(type);
|
|
353
|
+
};
|
|
354
|
+
};
|
|
355
|
+
|
|
356
|
+
polyfill(FullCalendar);
|
|
357
|
+
|
|
358
|
+
var FullCalendar$1 = calendarMixinWrapper(commonMixinWrapper(FullCalendar));
|
|
359
|
+
|
|
360
|
+
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); }
|
|
361
|
+
|
|
362
|
+
function _slicedToArray$1(arr, i) { return _arrayWithHoles$1(arr) || _iterableToArrayLimit$1(arr, i) || _unsupportedIterableToArray$1(arr, i) || _nonIterableRest$1(); }
|
|
363
|
+
|
|
364
|
+
function _nonIterableRest$1() { throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method."); }
|
|
365
|
+
|
|
366
|
+
function _unsupportedIterableToArray$1(o, minLen) { if (!o) return; if (typeof o === "string") return _arrayLikeToArray$1(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$1(o, minLen); }
|
|
367
|
+
|
|
368
|
+
function _arrayLikeToArray$1(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; }
|
|
369
|
+
|
|
370
|
+
function _iterableToArrayLimit$1(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; }
|
|
371
|
+
|
|
372
|
+
function _arrayWithHoles$1(arr) { if (Array.isArray(arr)) return arr; }
|
|
373
|
+
|
|
374
|
+
function _classCallCheck$1(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
|
|
375
|
+
|
|
376
|
+
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); } }
|
|
377
|
+
|
|
378
|
+
function _createClass$1(Constructor, protoProps, staticProps) { if (protoProps) _defineProperties$1(Constructor.prototype, protoProps); return Constructor; }
|
|
379
|
+
|
|
380
|
+
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); }
|
|
381
|
+
|
|
382
|
+
function _setPrototypeOf$1(o, p) { _setPrototypeOf$1 = Object.setPrototypeOf || function _setPrototypeOf(o, p) { o.__proto__ = p; return o; }; return _setPrototypeOf$1(o, p); }
|
|
383
|
+
|
|
384
|
+
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); }; }
|
|
385
|
+
|
|
386
|
+
function _possibleConstructorReturn$1(self, call) { if (call && (_typeof$1(call) === "object" || typeof call === "function")) { return call; } return _assertThisInitialized$1(self); }
|
|
387
|
+
|
|
388
|
+
function _assertThisInitialized$1(self) { if (self === void 0) { throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); } return self; }
|
|
389
|
+
|
|
390
|
+
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; } }
|
|
391
|
+
|
|
392
|
+
function _getPrototypeOf$1(o) { _getPrototypeOf$1 = Object.setPrototypeOf ? Object.getPrototypeOf : function _getPrototypeOf(o) { return o.__proto__ || Object.getPrototypeOf(o); }; return _getPrototypeOf$1(o); }
|
|
393
|
+
var Option = Select.Option;
|
|
394
|
+
|
|
395
|
+
function getMonthsLocale(value) {
|
|
396
|
+
var current = value.clone();
|
|
397
|
+
var localeData = value.localeData();
|
|
398
|
+
var months = [];
|
|
399
|
+
|
|
400
|
+
for (var i = 0; i < 12; i++) {
|
|
401
|
+
current.month(i);
|
|
402
|
+
months.push(localeData.monthsShort(current));
|
|
403
|
+
}
|
|
404
|
+
|
|
405
|
+
return months;
|
|
406
|
+
}
|
|
407
|
+
|
|
408
|
+
var Header = /*#__PURE__*/function (_React$Component) {
|
|
409
|
+
_inherits$1(Header, _React$Component);
|
|
410
|
+
|
|
411
|
+
var _super = _createSuper$1(Header);
|
|
412
|
+
|
|
413
|
+
function Header() {
|
|
414
|
+
var _this;
|
|
415
|
+
|
|
416
|
+
_classCallCheck$1(this, Header);
|
|
417
|
+
|
|
418
|
+
_this = _super.apply(this, arguments);
|
|
419
|
+
|
|
420
|
+
_this.onYearChange = function (year) {
|
|
421
|
+
var _this$props = _this.props,
|
|
422
|
+
value = _this$props.value,
|
|
423
|
+
validRange = _this$props.validRange;
|
|
424
|
+
var newValue = value.clone();
|
|
425
|
+
newValue.year(parseInt(year, 10)); // switch the month so that it remains within range when year changes
|
|
426
|
+
|
|
427
|
+
if (validRange) {
|
|
428
|
+
var _validRange = _slicedToArray$1(validRange, 2),
|
|
429
|
+
start = _validRange[0],
|
|
430
|
+
end = _validRange[1];
|
|
431
|
+
|
|
432
|
+
var newYear = newValue.get('year');
|
|
433
|
+
var newMonth = newValue.get('month');
|
|
434
|
+
|
|
435
|
+
if (newYear === end.get('year') && newMonth > end.get('month')) {
|
|
436
|
+
newValue.month(end.get('month'));
|
|
437
|
+
}
|
|
438
|
+
|
|
439
|
+
if (newYear === start.get('year') && newMonth < start.get('month')) {
|
|
440
|
+
newValue.month(start.get('month'));
|
|
441
|
+
}
|
|
442
|
+
}
|
|
443
|
+
|
|
444
|
+
var onValueChange = _this.props.onValueChange;
|
|
445
|
+
|
|
446
|
+
if (onValueChange) {
|
|
447
|
+
onValueChange(newValue);
|
|
448
|
+
}
|
|
449
|
+
};
|
|
450
|
+
|
|
451
|
+
_this.onMonthChange = function (month) {
|
|
452
|
+
var newValue = _this.props.value.clone();
|
|
453
|
+
|
|
454
|
+
newValue.month(parseInt(month, 10));
|
|
455
|
+
var onValueChange = _this.props.onValueChange;
|
|
456
|
+
|
|
457
|
+
if (onValueChange) {
|
|
458
|
+
onValueChange(newValue);
|
|
459
|
+
}
|
|
460
|
+
};
|
|
461
|
+
|
|
462
|
+
_this.onInternalTypeChange = function (e) {
|
|
463
|
+
_this.onTypeChange(e.target.value);
|
|
464
|
+
};
|
|
465
|
+
|
|
466
|
+
_this.onTypeChange = function (type) {
|
|
467
|
+
var onTypeChange = _this.props.onTypeChange;
|
|
468
|
+
|
|
469
|
+
if (onTypeChange) {
|
|
470
|
+
onTypeChange(type);
|
|
471
|
+
}
|
|
472
|
+
};
|
|
473
|
+
|
|
474
|
+
_this.getCalenderHeaderNode = function (node) {
|
|
475
|
+
_this.calenderHeaderNode = node;
|
|
476
|
+
};
|
|
477
|
+
|
|
478
|
+
_this.getMonthYearSelections = function (getPrefixCls) {
|
|
479
|
+
var _this$props2 = _this.props,
|
|
480
|
+
customizePrefixCls = _this$props2.prefixCls,
|
|
481
|
+
type = _this$props2.type,
|
|
482
|
+
value = _this$props2.value;
|
|
483
|
+
var prefixCls = getPrefixCls('fullcalendar', customizePrefixCls);
|
|
484
|
+
|
|
485
|
+
var yearReactNode = _this.getYearSelectElement(prefixCls, value.year());
|
|
486
|
+
|
|
487
|
+
var monthReactNode = type === 'month' ? _this.getMonthSelectElement(prefixCls, value.month(), getMonthsLocale(value)) : null;
|
|
488
|
+
return {
|
|
489
|
+
yearReactNode: yearReactNode,
|
|
490
|
+
monthReactNode: monthReactNode
|
|
491
|
+
};
|
|
492
|
+
};
|
|
493
|
+
|
|
494
|
+
_this.getTypeSwitch = function () {
|
|
495
|
+
var _this$props3 = _this.props,
|
|
496
|
+
_this$props3$locale = _this$props3.locale,
|
|
497
|
+
locale = _this$props3$locale === void 0 ? {} : _this$props3$locale,
|
|
498
|
+
type = _this$props3.type,
|
|
499
|
+
fullscreen = _this$props3.fullscreen;
|
|
500
|
+
var size = fullscreen ? 'default' : 'small';
|
|
501
|
+
return /*#__PURE__*/React.createElement(RadioGroup, {
|
|
502
|
+
onChange: _this.onInternalTypeChange,
|
|
503
|
+
value: type,
|
|
504
|
+
size: size
|
|
505
|
+
}, /*#__PURE__*/React.createElement(RadioButton, {
|
|
506
|
+
value: "month"
|
|
507
|
+
}, locale.month), /*#__PURE__*/React.createElement(RadioButton, {
|
|
508
|
+
value: "year"
|
|
509
|
+
}, locale.year));
|
|
510
|
+
};
|
|
511
|
+
|
|
512
|
+
_this.headerRenderCustom = function (headerRender) {
|
|
513
|
+
var _this$props4 = _this.props,
|
|
514
|
+
type = _this$props4.type,
|
|
515
|
+
onValueChange = _this$props4.onValueChange,
|
|
516
|
+
value = _this$props4.value;
|
|
517
|
+
return headerRender({
|
|
518
|
+
value: value,
|
|
519
|
+
type: type || 'month',
|
|
520
|
+
onChange: onValueChange,
|
|
521
|
+
onTypeChange: _this.onTypeChange
|
|
522
|
+
});
|
|
523
|
+
};
|
|
524
|
+
|
|
525
|
+
_this.renderHeader = function (_ref) {
|
|
526
|
+
var getPrefixCls = _ref.getPrefixCls;
|
|
527
|
+
var _this$props5 = _this.props,
|
|
528
|
+
prefixCls = _this$props5.prefixCls,
|
|
529
|
+
headerRender = _this$props5.headerRender;
|
|
530
|
+
|
|
531
|
+
var typeSwitch = _this.getTypeSwitch();
|
|
532
|
+
|
|
533
|
+
var _this$getMonthYearSel = _this.getMonthYearSelections(getPrefixCls),
|
|
534
|
+
yearReactNode = _this$getMonthYearSel.yearReactNode,
|
|
535
|
+
monthReactNode = _this$getMonthYearSel.monthReactNode;
|
|
536
|
+
|
|
537
|
+
return headerRender ? _this.headerRenderCustom(headerRender) : /*#__PURE__*/React.createElement("div", {
|
|
538
|
+
className: "".concat(prefixCls, "-header"),
|
|
539
|
+
ref: _this.getCalenderHeaderNode
|
|
540
|
+
}, yearReactNode, monthReactNode, typeSwitch);
|
|
541
|
+
};
|
|
542
|
+
|
|
543
|
+
return _this;
|
|
544
|
+
}
|
|
545
|
+
|
|
546
|
+
_createClass$1(Header, [{
|
|
547
|
+
key: "getYearSelectElement",
|
|
548
|
+
value: function getYearSelectElement(prefixCls, year) {
|
|
549
|
+
var _this2 = this;
|
|
550
|
+
|
|
551
|
+
var _this$props6 = this.props,
|
|
552
|
+
yearSelectOffset = _this$props6.yearSelectOffset,
|
|
553
|
+
yearSelectTotal = _this$props6.yearSelectTotal,
|
|
554
|
+
_this$props6$locale = _this$props6.locale,
|
|
555
|
+
locale = _this$props6$locale === void 0 ? {} : _this$props6$locale,
|
|
556
|
+
fullscreen = _this$props6.fullscreen,
|
|
557
|
+
validRange = _this$props6.validRange;
|
|
558
|
+
var start = year - yearSelectOffset;
|
|
559
|
+
var end = start + yearSelectTotal;
|
|
560
|
+
|
|
561
|
+
if (validRange) {
|
|
562
|
+
start = validRange[0].get('year');
|
|
563
|
+
end = validRange[1].get('year') + 1;
|
|
564
|
+
}
|
|
565
|
+
|
|
566
|
+
var suffix = locale.year === '年' ? '年' : '';
|
|
567
|
+
var options = [];
|
|
568
|
+
|
|
569
|
+
for (var index = start; index < end; index++) {
|
|
570
|
+
options.push( /*#__PURE__*/React.createElement(Option, {
|
|
571
|
+
key: "".concat(index)
|
|
572
|
+
}, index + suffix));
|
|
573
|
+
}
|
|
574
|
+
|
|
575
|
+
return /*#__PURE__*/React.createElement(Select, {
|
|
576
|
+
size: fullscreen ? 'default' : 'small',
|
|
577
|
+
dropdownMatchSelectWidth: false,
|
|
578
|
+
className: "".concat(prefixCls, "-year-select"),
|
|
579
|
+
onChange: this.onYearChange,
|
|
580
|
+
value: String(year),
|
|
581
|
+
getPopupContainer: function getPopupContainer() {
|
|
582
|
+
return _this2.calenderHeaderNode;
|
|
583
|
+
}
|
|
584
|
+
}, options);
|
|
585
|
+
}
|
|
586
|
+
}, {
|
|
587
|
+
key: "getMonthSelectElement",
|
|
588
|
+
value: function getMonthSelectElement(prefixCls, month, months) {
|
|
589
|
+
var _this3 = this;
|
|
590
|
+
|
|
591
|
+
var _this$props7 = this.props,
|
|
592
|
+
fullscreen = _this$props7.fullscreen,
|
|
593
|
+
validRange = _this$props7.validRange,
|
|
594
|
+
value = _this$props7.value;
|
|
595
|
+
var options = [];
|
|
596
|
+
var start = 0;
|
|
597
|
+
var end = 12;
|
|
598
|
+
|
|
599
|
+
if (validRange) {
|
|
600
|
+
var _validRange2 = _slicedToArray$1(validRange, 2),
|
|
601
|
+
rangeStart = _validRange2[0],
|
|
602
|
+
rangeEnd = _validRange2[1];
|
|
603
|
+
|
|
604
|
+
var currentYear = value.get('year');
|
|
605
|
+
|
|
606
|
+
if (rangeEnd.get('year') === currentYear) {
|
|
607
|
+
end = rangeEnd.get('month') + 1;
|
|
608
|
+
}
|
|
609
|
+
|
|
610
|
+
if (rangeStart.get('year') === currentYear) {
|
|
611
|
+
start = rangeStart.get('month');
|
|
612
|
+
}
|
|
613
|
+
}
|
|
614
|
+
|
|
615
|
+
for (var index = start; index < end; index++) {
|
|
616
|
+
options.push( /*#__PURE__*/React.createElement(Option, {
|
|
617
|
+
key: "".concat(index)
|
|
618
|
+
}, months[index]));
|
|
619
|
+
}
|
|
620
|
+
|
|
621
|
+
return /*#__PURE__*/React.createElement(Select, {
|
|
622
|
+
size: fullscreen ? 'default' : 'small',
|
|
623
|
+
dropdownMatchSelectWidth: false,
|
|
624
|
+
className: "".concat(prefixCls, "-month-select"),
|
|
625
|
+
value: String(month),
|
|
626
|
+
onChange: this.onMonthChange,
|
|
627
|
+
getPopupContainer: function getPopupContainer() {
|
|
628
|
+
return _this3.calenderHeaderNode;
|
|
629
|
+
}
|
|
630
|
+
}, options);
|
|
631
|
+
}
|
|
632
|
+
}, {
|
|
633
|
+
key: "render",
|
|
634
|
+
value: function render() {
|
|
635
|
+
return /*#__PURE__*/React.createElement(ConfigConsumer, null, this.renderHeader);
|
|
636
|
+
}
|
|
637
|
+
}]);
|
|
638
|
+
|
|
639
|
+
return Header;
|
|
640
|
+
}(React.Component);
|
|
641
|
+
Header.defaultProps = {
|
|
642
|
+
yearSelectOffset: 10,
|
|
643
|
+
yearSelectTotal: 20
|
|
644
|
+
};
|
|
645
|
+
|
|
646
|
+
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); }
|
|
647
|
+
|
|
648
|
+
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); }
|
|
649
|
+
|
|
650
|
+
function _slicedToArray(arr, i) { return _arrayWithHoles(arr) || _iterableToArrayLimit(arr, i) || _unsupportedIterableToArray(arr, i) || _nonIterableRest(); }
|
|
651
|
+
|
|
652
|
+
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."); }
|
|
653
|
+
|
|
654
|
+
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); }
|
|
655
|
+
|
|
656
|
+
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; }
|
|
657
|
+
|
|
658
|
+
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; }
|
|
659
|
+
|
|
660
|
+
function _arrayWithHoles(arr) { if (Array.isArray(arr)) return arr; }
|
|
661
|
+
|
|
662
|
+
function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
|
|
663
|
+
|
|
664
|
+
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); } }
|
|
665
|
+
|
|
666
|
+
function _createClass(Constructor, protoProps, staticProps) { if (protoProps) _defineProperties(Constructor.prototype, protoProps); if (staticProps) _defineProperties(Constructor, staticProps); return Constructor; }
|
|
667
|
+
|
|
668
|
+
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); }
|
|
669
|
+
|
|
670
|
+
function _setPrototypeOf(o, p) { _setPrototypeOf = Object.setPrototypeOf || function _setPrototypeOf(o, p) { o.__proto__ = p; return o; }; return _setPrototypeOf(o, p); }
|
|
671
|
+
|
|
672
|
+
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); }; }
|
|
673
|
+
|
|
674
|
+
function _possibleConstructorReturn(self, call) { if (call && (_typeof(call) === "object" || typeof call === "function")) { return call; } return _assertThisInitialized(self); }
|
|
675
|
+
|
|
676
|
+
function _assertThisInitialized(self) { if (self === void 0) { throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); } return self; }
|
|
677
|
+
|
|
678
|
+
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; } }
|
|
679
|
+
|
|
680
|
+
function _getPrototypeOf(o) { _getPrototypeOf = Object.setPrototypeOf ? Object.getPrototypeOf : function _getPrototypeOf(o) { return o.__proto__ || Object.getPrototypeOf(o); }; return _getPrototypeOf(o); }
|
|
681
|
+
|
|
682
|
+
function noop() {
|
|
683
|
+
return null;
|
|
684
|
+
}
|
|
685
|
+
|
|
686
|
+
function zerofixed(v) {
|
|
687
|
+
if (v < 10) {
|
|
688
|
+
return "0".concat(v);
|
|
689
|
+
}
|
|
690
|
+
|
|
691
|
+
return "".concat(v);
|
|
692
|
+
}
|
|
693
|
+
|
|
694
|
+
var Calendar = /*#__PURE__*/function (_React$Component) {
|
|
695
|
+
_inherits(Calendar, _React$Component);
|
|
696
|
+
|
|
697
|
+
var _super = _createSuper(Calendar);
|
|
698
|
+
|
|
699
|
+
function Calendar(props) {
|
|
700
|
+
var _this;
|
|
701
|
+
|
|
702
|
+
_classCallCheck(this, Calendar);
|
|
703
|
+
|
|
704
|
+
_this = _super.call(this, props);
|
|
705
|
+
|
|
706
|
+
_this.onHeaderValueChange = function (value) {
|
|
707
|
+
_this.setValue(value, 'changePanel');
|
|
708
|
+
};
|
|
709
|
+
|
|
710
|
+
_this.onHeaderTypeChange = function (mode) {
|
|
711
|
+
_this.setState({
|
|
712
|
+
mode: mode
|
|
713
|
+
});
|
|
714
|
+
|
|
715
|
+
_this.onPanelChange(_this.state.value, mode);
|
|
716
|
+
};
|
|
717
|
+
|
|
718
|
+
_this.onSelect = function (value) {
|
|
719
|
+
_this.setValue(value, 'select');
|
|
720
|
+
};
|
|
721
|
+
|
|
722
|
+
_this.setValue = function (value, way) {
|
|
723
|
+
var prevValue = _this.props.value || _this.state.value;
|
|
724
|
+
var mode = _this.state.mode;
|
|
725
|
+
|
|
726
|
+
if (!('value' in _this.props)) {
|
|
727
|
+
_this.setState({
|
|
728
|
+
value: value
|
|
729
|
+
});
|
|
730
|
+
}
|
|
731
|
+
|
|
732
|
+
if (way === 'select') {
|
|
733
|
+
if (prevValue && prevValue.month() !== value.month()) {
|
|
734
|
+
_this.onPanelChange(value, mode);
|
|
735
|
+
}
|
|
736
|
+
|
|
737
|
+
if (_this.props.onSelect) {
|
|
738
|
+
_this.props.onSelect(value);
|
|
739
|
+
}
|
|
740
|
+
} else if (way === 'changePanel') {
|
|
741
|
+
_this.onPanelChange(value, mode);
|
|
742
|
+
}
|
|
743
|
+
};
|
|
744
|
+
|
|
745
|
+
_this.getDateRange = function (validRange, disabledDate) {
|
|
746
|
+
return function (current) {
|
|
747
|
+
if (!current) {
|
|
748
|
+
return false;
|
|
749
|
+
}
|
|
750
|
+
|
|
751
|
+
var _validRange = _slicedToArray(validRange, 2),
|
|
752
|
+
startDate = _validRange[0],
|
|
753
|
+
endDate = _validRange[1];
|
|
754
|
+
|
|
755
|
+
var inRange = !current.isBetween(startDate, endDate, 'days', '[]');
|
|
756
|
+
|
|
757
|
+
if (disabledDate) {
|
|
758
|
+
return disabledDate(current) || inRange;
|
|
759
|
+
}
|
|
760
|
+
|
|
761
|
+
return inRange;
|
|
762
|
+
};
|
|
763
|
+
};
|
|
764
|
+
|
|
765
|
+
_this.getDefaultLocale = function () {
|
|
766
|
+
var result = _extends(_extends({}, locale), _this.props.locale);
|
|
767
|
+
|
|
768
|
+
result.lang = _extends(_extends({}, result.lang), (_this.props.locale || {}).lang);
|
|
769
|
+
return result;
|
|
770
|
+
};
|
|
771
|
+
|
|
772
|
+
_this.monthCellRender = function (value) {
|
|
773
|
+
var _this$props$monthCell = _this.props.monthCellRender,
|
|
774
|
+
monthCellRender = _this$props$monthCell === void 0 ? noop : _this$props$monthCell;
|
|
775
|
+
|
|
776
|
+
var _assertThisInitialize = _assertThisInitialized(_this),
|
|
777
|
+
prefixCls = _assertThisInitialize.prefixCls;
|
|
778
|
+
|
|
779
|
+
return /*#__PURE__*/React.createElement("div", {
|
|
780
|
+
className: "".concat(prefixCls, "-month")
|
|
781
|
+
}, /*#__PURE__*/React.createElement("div", {
|
|
782
|
+
className: "".concat(prefixCls, "-value")
|
|
783
|
+
}, value.localeData().monthsShort(value)), /*#__PURE__*/React.createElement("div", {
|
|
784
|
+
className: "".concat(prefixCls, "-content")
|
|
785
|
+
}, monthCellRender(value)));
|
|
786
|
+
};
|
|
787
|
+
|
|
788
|
+
_this.dateCellRender = function (value) {
|
|
789
|
+
var _this$props$dateCellR = _this.props.dateCellRender,
|
|
790
|
+
dateCellRender = _this$props$dateCellR === void 0 ? noop : _this$props$dateCellR;
|
|
791
|
+
|
|
792
|
+
var _assertThisInitialize2 = _assertThisInitialized(_this),
|
|
793
|
+
prefixCls = _assertThisInitialize2.prefixCls;
|
|
794
|
+
|
|
795
|
+
return /*#__PURE__*/React.createElement("div", {
|
|
796
|
+
className: "".concat(prefixCls, "-date")
|
|
797
|
+
}, /*#__PURE__*/React.createElement("div", {
|
|
798
|
+
className: "".concat(prefixCls, "-value")
|
|
799
|
+
}, zerofixed(value.date())), /*#__PURE__*/React.createElement("div", {
|
|
800
|
+
className: "".concat(prefixCls, "-content")
|
|
801
|
+
}, dateCellRender(value)));
|
|
802
|
+
};
|
|
803
|
+
|
|
804
|
+
_this.renderCalendar = function (locale, localeCode) {
|
|
805
|
+
var _assertThisInitialize3 = _assertThisInitialized(_this),
|
|
806
|
+
state = _assertThisInitialize3.state,
|
|
807
|
+
props = _assertThisInitialize3.props;
|
|
808
|
+
|
|
809
|
+
var value = state.value,
|
|
810
|
+
mode = state.mode;
|
|
811
|
+
|
|
812
|
+
if (value && localeCode) {
|
|
813
|
+
value.locale(localeCode);
|
|
814
|
+
}
|
|
815
|
+
|
|
816
|
+
var customizePrefixCls = props.prefixCls,
|
|
817
|
+
style = props.style,
|
|
818
|
+
className = props.className,
|
|
819
|
+
fullscreen = props.fullscreen,
|
|
820
|
+
headerRender = props.headerRender,
|
|
821
|
+
dateFullCellRender = props.dateFullCellRender,
|
|
822
|
+
monthFullCellRender = props.monthFullCellRender;
|
|
823
|
+
var monthCellRender = monthFullCellRender || _this.monthCellRender;
|
|
824
|
+
var dateCellRender = dateFullCellRender || _this.dateCellRender;
|
|
825
|
+
var disabledDate = props.disabledDate;
|
|
826
|
+
|
|
827
|
+
if (props.validRange) {
|
|
828
|
+
disabledDate = _this.getDateRange(props.validRange, disabledDate);
|
|
829
|
+
}
|
|
830
|
+
|
|
831
|
+
return /*#__PURE__*/React.createElement(ConfigConsumer, null, function (_ref) {
|
|
832
|
+
var getPrefixCls = _ref.getPrefixCls;
|
|
833
|
+
var prefixCls = getPrefixCls('fullcalendar', customizePrefixCls); // To support old version react.
|
|
834
|
+
// Have to add prefixCls on the instance.
|
|
835
|
+
// https://github.com/facebook/react/issues/12397
|
|
836
|
+
|
|
837
|
+
_this.prefixCls = prefixCls;
|
|
838
|
+
var cls = className || '';
|
|
839
|
+
|
|
840
|
+
if (fullscreen) {
|
|
841
|
+
cls += " ".concat(prefixCls, "-fullscreen");
|
|
842
|
+
}
|
|
843
|
+
|
|
844
|
+
return /*#__PURE__*/React.createElement("div", {
|
|
845
|
+
className: cls,
|
|
846
|
+
style: style
|
|
847
|
+
}, /*#__PURE__*/React.createElement(Header, {
|
|
848
|
+
fullscreen: fullscreen,
|
|
849
|
+
type: mode,
|
|
850
|
+
headerRender: headerRender,
|
|
851
|
+
value: value,
|
|
852
|
+
locale: locale.lang,
|
|
853
|
+
prefixCls: prefixCls,
|
|
854
|
+
onTypeChange: _this.onHeaderTypeChange,
|
|
855
|
+
onValueChange: _this.onHeaderValueChange,
|
|
856
|
+
validRange: props.validRange
|
|
857
|
+
}), /*#__PURE__*/React.createElement(FullCalendar$1, _extends({}, props, {
|
|
858
|
+
disabledDate: disabledDate,
|
|
859
|
+
Select: noop,
|
|
860
|
+
locale: locale.lang,
|
|
861
|
+
type: mode === 'year' ? 'month' : 'date',
|
|
862
|
+
prefixCls: prefixCls,
|
|
863
|
+
showHeader: false,
|
|
864
|
+
value: value,
|
|
865
|
+
monthCellRender: monthCellRender,
|
|
866
|
+
dateCellRender: dateCellRender,
|
|
867
|
+
onSelect: _this.onSelect
|
|
868
|
+
})));
|
|
869
|
+
});
|
|
870
|
+
};
|
|
871
|
+
|
|
872
|
+
var value = props.value || props.defaultValue || interopDefault(moment$1)();
|
|
873
|
+
|
|
874
|
+
if (!interopDefault(moment$1).isMoment(value)) {
|
|
875
|
+
throw new Error('The value/defaultValue of Calendar must be a moment object after `antd@2.0`, ' + 'see: https://u.ant.design/calendar-value');
|
|
876
|
+
}
|
|
877
|
+
|
|
878
|
+
_this.state = {
|
|
879
|
+
value: value,
|
|
880
|
+
mode: props.mode || 'month'
|
|
881
|
+
};
|
|
882
|
+
return _this;
|
|
883
|
+
}
|
|
884
|
+
|
|
885
|
+
_createClass(Calendar, [{
|
|
886
|
+
key: "onPanelChange",
|
|
887
|
+
value: function onPanelChange(value, mode) {
|
|
888
|
+
var _this$props = this.props,
|
|
889
|
+
onPanelChange = _this$props.onPanelChange,
|
|
890
|
+
onChange = _this$props.onChange;
|
|
891
|
+
|
|
892
|
+
if (onPanelChange) {
|
|
893
|
+
onPanelChange(value, mode);
|
|
894
|
+
}
|
|
895
|
+
|
|
896
|
+
if (onChange && value !== this.state.value) {
|
|
897
|
+
onChange(value);
|
|
898
|
+
}
|
|
899
|
+
}
|
|
900
|
+
}, {
|
|
901
|
+
key: "render",
|
|
902
|
+
value: function render() {
|
|
903
|
+
return /*#__PURE__*/React.createElement(LocaleReceiver, {
|
|
904
|
+
componentName: "Calendar",
|
|
905
|
+
defaultLocale: this.getDefaultLocale
|
|
906
|
+
}, this.renderCalendar);
|
|
907
|
+
}
|
|
908
|
+
}], [{
|
|
909
|
+
key: "getDerivedStateFromProps",
|
|
910
|
+
value: function getDerivedStateFromProps(nextProps) {
|
|
911
|
+
var newState = {};
|
|
912
|
+
|
|
913
|
+
if ('value' in nextProps) {
|
|
914
|
+
newState.value = nextProps.value;
|
|
915
|
+
}
|
|
916
|
+
|
|
917
|
+
if ('mode' in nextProps) {
|
|
918
|
+
newState.mode = nextProps.mode;
|
|
919
|
+
}
|
|
920
|
+
|
|
921
|
+
return Object.keys(newState).length > 0 ? newState : null;
|
|
922
|
+
}
|
|
923
|
+
}]);
|
|
924
|
+
|
|
925
|
+
return Calendar;
|
|
926
|
+
}(React.Component);
|
|
927
|
+
|
|
928
|
+
Calendar.defaultProps = {
|
|
929
|
+
locale: {},
|
|
930
|
+
fullscreen: true,
|
|
931
|
+
onSelect: noop,
|
|
932
|
+
onPanelChange: noop,
|
|
933
|
+
onChange: noop
|
|
934
|
+
};
|
|
935
|
+
Calendar.propTypes = {
|
|
936
|
+
monthCellRender: propTypesExports.func,
|
|
937
|
+
dateCellRender: propTypesExports.func,
|
|
938
|
+
monthFullCellRender: propTypesExports.func,
|
|
939
|
+
dateFullCellRender: propTypesExports.func,
|
|
940
|
+
fullscreen: propTypesExports.bool,
|
|
941
|
+
locale: propTypesExports.object,
|
|
942
|
+
prefixCls: propTypesExports.string,
|
|
943
|
+
className: propTypesExports.string,
|
|
944
|
+
style: propTypesExports.object,
|
|
945
|
+
onPanelChange: propTypesExports.func,
|
|
946
|
+
value: propTypesExports.object,
|
|
947
|
+
onSelect: propTypesExports.func,
|
|
948
|
+
onChange: propTypesExports.func,
|
|
949
|
+
headerRender: propTypesExports.func
|
|
950
|
+
};
|
|
951
|
+
polyfill(Calendar);
|
|
952
|
+
|
|
953
|
+
export { Calendar as default };
|