@seafile/seafile-calendar 0.0.28 → 0.0.29-alpha.2

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (168) hide show
  1. package/README.md +1 -1
  2. package/package.json +1 -1
  3. package/assets/index.css +0 -1177
  4. package/dist/rc-calendar.css +0 -1179
  5. package/dist/rc-calendar.css.map +0 -1
  6. package/dist/rc-calendar.js +0 -7043
  7. package/dist/rc-calendar.js.map +0 -1
  8. package/dist/rc-calendar.min.css +0 -1179
  9. package/dist/rc-calendar.min.css.map +0 -1
  10. package/dist/rc-calendar.min.js +0 -1
  11. package/es/Calendar.js +0 -436
  12. package/es/FullCalendar.js +0 -182
  13. package/es/MonthCalendar.js +0 -135
  14. package/es/Picker.js +0 -245
  15. package/es/RangeCalendar.js +0 -876
  16. package/es/calendar/CalendarFooter.js +0 -93
  17. package/es/calendar/CalendarHeader.js +0 -257
  18. package/es/calendar/CalendarRightPanel.js +0 -121
  19. package/es/calendar/OkButton.js +0 -22
  20. package/es/calendar/TimePickerButton.js +0 -28
  21. package/es/calendar/TodayButton.js +0 -28
  22. package/es/date/DateConstants.js +0 -4
  23. package/es/date/DateInput.js +0 -233
  24. package/es/date/DateTBody.js +0 -275
  25. package/es/date/DateTHead.js +0 -78
  26. package/es/date/DateTable.js +0 -32
  27. package/es/decade/DecadePanel.js +0 -181
  28. package/es/full-calendar/CalendarHeader.js +0 -180
  29. package/es/index.js +0 -3
  30. package/es/locale/ar_EG.js +0 -27
  31. package/es/locale/bg_BG.js +0 -27
  32. package/es/locale/ca_ES.js +0 -27
  33. package/es/locale/cs_CZ.js +0 -27
  34. package/es/locale/da_DK.js +0 -27
  35. package/es/locale/de_DE.js +0 -27
  36. package/es/locale/el_GR.js +0 -27
  37. package/es/locale/en_GB.js +0 -27
  38. package/es/locale/en_US.js +0 -28
  39. package/es/locale/es_ES.js +0 -27
  40. package/es/locale/et_EE.js +0 -27
  41. package/es/locale/fa_IR.js +0 -27
  42. package/es/locale/fi_FI.js +0 -27
  43. package/es/locale/fr_BE.js +0 -27
  44. package/es/locale/fr_FR.js +0 -27
  45. package/es/locale/he_IL.js +0 -28
  46. package/es/locale/hi_IN.js +0 -28
  47. package/es/locale/hr_HR.js +0 -28
  48. package/es/locale/hu_HU.js +0 -27
  49. package/es/locale/id_ID.js +0 -28
  50. package/es/locale/is_IS.js +0 -27
  51. package/es/locale/it_IT.js +0 -27
  52. package/es/locale/ja_JP.js +0 -26
  53. package/es/locale/kn_IN.js +0 -28
  54. package/es/locale/ko_KR.js +0 -27
  55. package/es/locale/ku_IQ.js +0 -27
  56. package/es/locale/lv_LV.js +0 -27
  57. package/es/locale/mm_MM.js +0 -28
  58. package/es/locale/mn_MN.js +0 -28
  59. package/es/locale/ms_MY.js +0 -27
  60. package/es/locale/nb_NO.js +0 -27
  61. package/es/locale/nl_BE.js +0 -27
  62. package/es/locale/nl_NL.js +0 -27
  63. package/es/locale/pl_PL.js +0 -27
  64. package/es/locale/pt_BR.js +0 -27
  65. package/es/locale/pt_PT.js +0 -27
  66. package/es/locale/ro_RO.js +0 -28
  67. package/es/locale/ru_RU.js +0 -27
  68. package/es/locale/sk_SK.js +0 -27
  69. package/es/locale/sl_SI.js +0 -27
  70. package/es/locale/sr_RS.js +0 -27
  71. package/es/locale/sv_SE.js +0 -27
  72. package/es/locale/ta_IN.js +0 -28
  73. package/es/locale/th_TH.js +0 -27
  74. package/es/locale/tr_TR.js +0 -27
  75. package/es/locale/ug_CN.js +0 -26
  76. package/es/locale/uk_UA.js +0 -27
  77. package/es/locale/vi_VN.js +0 -28
  78. package/es/locale/zh_CN.js +0 -27
  79. package/es/locale/zh_TW.js +0 -26
  80. package/es/mixin/CalendarMixin.js +0 -123
  81. package/es/mixin/CommonMixin.js +0 -85
  82. package/es/month/MonthPanel.js +0 -154
  83. package/es/month/MonthTable.js +0 -156
  84. package/es/picker/placements.js +0 -35
  85. package/es/range-calendar/CalendarPart.js +0 -151
  86. package/es/util/dayjs.js +0 -17
  87. package/es/util/index.js +0 -105
  88. package/es/util/toTime.js +0 -21
  89. package/es/year/YearPanel.js +0 -194
  90. package/lib/Calendar.js +0 -499
  91. package/lib/FullCalendar.js +0 -221
  92. package/lib/MonthCalendar.js +0 -172
  93. package/lib/Picker.js +0 -282
  94. package/lib/RangeCalendar.js +0 -925
  95. package/lib/calendar/CalendarFooter.js +0 -134
  96. package/lib/calendar/CalendarHeader.js +0 -290
  97. package/lib/calendar/CalendarRightPanel.js +0 -145
  98. package/lib/calendar/OkButton.js +0 -32
  99. package/lib/calendar/TimePickerButton.js +0 -41
  100. package/lib/calendar/TodayButton.js +0 -39
  101. package/lib/date/DateConstants.js +0 -8
  102. package/lib/date/DateInput.js +0 -265
  103. package/lib/date/DateTBody.js +0 -302
  104. package/lib/date/DateTHead.js +0 -95
  105. package/lib/date/DateTable.js +0 -54
  106. package/lib/decade/DecadePanel.js +0 -207
  107. package/lib/full-calendar/CalendarHeader.js +0 -201
  108. package/lib/index.js +0 -12
  109. package/lib/locale/ar_EG.js +0 -31
  110. package/lib/locale/bg_BG.js +0 -31
  111. package/lib/locale/ca_ES.js +0 -31
  112. package/lib/locale/cs_CZ.js +0 -31
  113. package/lib/locale/da_DK.js +0 -31
  114. package/lib/locale/de_DE.js +0 -31
  115. package/lib/locale/el_GR.js +0 -31
  116. package/lib/locale/en_GB.js +0 -31
  117. package/lib/locale/en_US.js +0 -32
  118. package/lib/locale/es_ES.js +0 -31
  119. package/lib/locale/et_EE.js +0 -31
  120. package/lib/locale/fa_IR.js +0 -31
  121. package/lib/locale/fi_FI.js +0 -31
  122. package/lib/locale/fr_BE.js +0 -31
  123. package/lib/locale/fr_FR.js +0 -31
  124. package/lib/locale/he_IL.js +0 -32
  125. package/lib/locale/hi_IN.js +0 -32
  126. package/lib/locale/hr_HR.js +0 -32
  127. package/lib/locale/hu_HU.js +0 -31
  128. package/lib/locale/id_ID.js +0 -32
  129. package/lib/locale/is_IS.js +0 -31
  130. package/lib/locale/it_IT.js +0 -31
  131. package/lib/locale/ja_JP.js +0 -30
  132. package/lib/locale/kn_IN.js +0 -32
  133. package/lib/locale/ko_KR.js +0 -31
  134. package/lib/locale/ku_IQ.js +0 -31
  135. package/lib/locale/lv_LV.js +0 -31
  136. package/lib/locale/mm_MM.js +0 -32
  137. package/lib/locale/mn_MN.js +0 -32
  138. package/lib/locale/ms_MY.js +0 -31
  139. package/lib/locale/nb_NO.js +0 -31
  140. package/lib/locale/nl_BE.js +0 -31
  141. package/lib/locale/nl_NL.js +0 -31
  142. package/lib/locale/pl_PL.js +0 -31
  143. package/lib/locale/pt_BR.js +0 -31
  144. package/lib/locale/pt_PT.js +0 -31
  145. package/lib/locale/ro_RO.js +0 -32
  146. package/lib/locale/ru_RU.js +0 -31
  147. package/lib/locale/sk_SK.js +0 -31
  148. package/lib/locale/sl_SI.js +0 -31
  149. package/lib/locale/sr_RS.js +0 -31
  150. package/lib/locale/sv_SE.js +0 -31
  151. package/lib/locale/ta_IN.js +0 -32
  152. package/lib/locale/th_TH.js +0 -31
  153. package/lib/locale/tr_TR.js +0 -31
  154. package/lib/locale/ug_CN.js +0 -30
  155. package/lib/locale/uk_UA.js +0 -31
  156. package/lib/locale/vi_VN.js +0 -32
  157. package/lib/locale/zh_CN.js +0 -31
  158. package/lib/locale/zh_TW.js +0 -30
  159. package/lib/mixin/CalendarMixin.js +0 -153
  160. package/lib/mixin/CommonMixin.js +0 -106
  161. package/lib/month/MonthPanel.js +0 -179
  162. package/lib/month/MonthTable.js +0 -181
  163. package/lib/picker/placements.js +0 -39
  164. package/lib/range-calendar/CalendarPart.js +0 -184
  165. package/lib/util/dayjs.js +0 -46
  166. package/lib/util/index.js +0 -130
  167. package/lib/util/toTime.js +0 -28
  168. package/lib/year/YearPanel.js +0 -219
@@ -1,181 +0,0 @@
1
- 'use strict';
2
-
3
- exports.__esModule = true;
4
-
5
- var _classCallCheck2 = require('babel-runtime/helpers/classCallCheck');
6
-
7
- var _classCallCheck3 = _interopRequireDefault(_classCallCheck2);
8
-
9
- var _possibleConstructorReturn2 = require('babel-runtime/helpers/possibleConstructorReturn');
10
-
11
- var _possibleConstructorReturn3 = _interopRequireDefault(_possibleConstructorReturn2);
12
-
13
- var _inherits2 = require('babel-runtime/helpers/inherits');
14
-
15
- var _inherits3 = _interopRequireDefault(_inherits2);
16
-
17
- var _react = require('react');
18
-
19
- var _react2 = _interopRequireDefault(_react);
20
-
21
- var _propTypes = require('prop-types');
22
-
23
- var _propTypes2 = _interopRequireDefault(_propTypes);
24
-
25
- var _classnames = require('classnames');
26
-
27
- var _classnames2 = _interopRequireDefault(_classnames);
28
-
29
- var _index = require('../util/index');
30
-
31
- function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { 'default': obj }; }
32
-
33
- var ROW = 4;
34
- var COL = 3;
35
-
36
- function chooseMonth(month) {
37
- var next = this.state.value.clone();
38
- next = next.month(month);
39
- this.setAndSelectValue(next);
40
- }
41
-
42
- function noop() {}
43
-
44
- var MonthTable = function (_Component) {
45
- (0, _inherits3['default'])(MonthTable, _Component);
46
-
47
- function MonthTable(props) {
48
- (0, _classCallCheck3['default'])(this, MonthTable);
49
-
50
- var _this = (0, _possibleConstructorReturn3['default'])(this, _Component.call(this, props));
51
-
52
- _this.state = {
53
- value: props.value
54
- };
55
- return _this;
56
- }
57
-
58
- MonthTable.prototype.componentWillReceiveProps = function componentWillReceiveProps(nextProps) {
59
- if ('value' in nextProps) {
60
- this.setState({
61
- value: nextProps.value
62
- });
63
- }
64
- };
65
-
66
- MonthTable.prototype.setAndSelectValue = function setAndSelectValue(value) {
67
- this.setState({
68
- value: value
69
- });
70
- this.props.onSelect(value);
71
- };
72
-
73
- MonthTable.prototype.months = function months() {
74
- var value = this.state.value;
75
- var current = value.clone();
76
- var months = [];
77
- var index = 0;
78
- for (var rowIndex = 0; rowIndex < ROW; rowIndex++) {
79
- months[rowIndex] = [];
80
- for (var colIndex = 0; colIndex < COL; colIndex++) {
81
- current = current.month(index);
82
- var content = (0, _index.getMonthName)(current);
83
- months[rowIndex][colIndex] = {
84
- value: index,
85
- content: content,
86
- title: content
87
- };
88
- index++;
89
- }
90
- }
91
- return months;
92
- };
93
-
94
- MonthTable.prototype.render = function render() {
95
- var _this2 = this;
96
-
97
- var props = this.props;
98
- var value = this.state.value;
99
- var today = (0, _index.getTodayTime)(value);
100
- var months = this.months();
101
- var currentMonth = value.month();
102
- var prefixCls = props.prefixCls,
103
- locale = props.locale,
104
- contentRender = props.contentRender,
105
- cellRender = props.cellRender;
106
-
107
- var monthsEls = months.map(function (month, index) {
108
- var tds = month.map(function (monthData) {
109
- var _classNameMap;
110
-
111
- var disabled = false;
112
- if (props.disabledDate) {
113
- var testValue = value.clone();
114
- testValue = testValue.month(monthData.value);
115
- disabled = props.disabledDate(testValue);
116
- }
117
- var classNameMap = (_classNameMap = {}, _classNameMap[prefixCls + '-cell'] = 1, _classNameMap[prefixCls + '-cell-disabled'] = disabled, _classNameMap[prefixCls + '-selected-cell'] = monthData.value === currentMonth, _classNameMap[prefixCls + '-current-cell'] = today.year() === value.year() && monthData.value === today.month(), _classNameMap);
118
- var cellEl = void 0;
119
- if (cellRender) {
120
- var currentValue = value.clone();
121
- currentValue = currentValue.month(monthData.value);
122
- cellEl = cellRender(currentValue, locale);
123
- } else {
124
- var content = void 0;
125
- if (contentRender) {
126
- var _currentValue = value.clone();
127
- _currentValue = _currentValue.month(monthData.value);
128
- content = contentRender(_currentValue, locale);
129
- } else {
130
- content = monthData.content;
131
- }
132
- cellEl = _react2['default'].createElement(
133
- 'a',
134
- { className: prefixCls + '-month' },
135
- content
136
- );
137
- }
138
- return _react2['default'].createElement(
139
- 'td',
140
- {
141
- role: 'gridcell',
142
- key: monthData.value,
143
- onClick: disabled ? null : chooseMonth.bind(_this2, monthData.value),
144
- title: monthData.title,
145
- className: (0, _classnames2['default'])(classNameMap)
146
- },
147
- cellEl
148
- );
149
- });
150
- return _react2['default'].createElement(
151
- 'tr',
152
- { key: index, role: 'row' },
153
- tds
154
- );
155
- });
156
-
157
- return _react2['default'].createElement(
158
- 'table',
159
- { className: prefixCls + '-table', cellSpacing: '0', role: 'grid' },
160
- _react2['default'].createElement(
161
- 'tbody',
162
- { className: prefixCls + '-tbody' },
163
- monthsEls
164
- )
165
- );
166
- };
167
-
168
- return MonthTable;
169
- }(_react.Component);
170
-
171
- MonthTable.defaultProps = {
172
- onSelect: noop
173
- };
174
- MonthTable.propTypes = {
175
- onSelect: _propTypes2['default'].func,
176
- cellRender: _propTypes2['default'].func,
177
- prefixCls: _propTypes2['default'].string,
178
- value: _propTypes2['default'].object
179
- };
180
- exports['default'] = MonthTable;
181
- module.exports = exports['default'];
@@ -1,39 +0,0 @@
1
- 'use strict';
2
-
3
- exports.__esModule = true;
4
- var autoAdjustOverflow = {
5
- adjustX: 1,
6
- adjustY: 1
7
- };
8
-
9
- var targetOffset = [0, 0];
10
-
11
- var placements = {
12
- bottomLeft: {
13
- points: ['tl', 'tl'],
14
- overflow: autoAdjustOverflow,
15
- offset: [0, -3],
16
- targetOffset: targetOffset
17
- },
18
- bottomRight: {
19
- points: ['tr', 'tr'],
20
- overflow: autoAdjustOverflow,
21
- offset: [0, -3],
22
- targetOffset: targetOffset
23
- },
24
- topRight: {
25
- points: ['br', 'br'],
26
- overflow: autoAdjustOverflow,
27
- offset: [0, 3],
28
- targetOffset: targetOffset
29
- },
30
- topLeft: {
31
- points: ['bl', 'bl'],
32
- overflow: autoAdjustOverflow,
33
- offset: [0, 3],
34
- targetOffset: targetOffset
35
- }
36
- };
37
-
38
- exports['default'] = placements;
39
- module.exports = exports['default'];
@@ -1,184 +0,0 @@
1
- 'use strict';
2
-
3
- exports.__esModule = true;
4
-
5
- var _extends2 = require('babel-runtime/helpers/extends');
6
-
7
- var _extends3 = _interopRequireDefault(_extends2);
8
-
9
- var _classCallCheck2 = require('babel-runtime/helpers/classCallCheck');
10
-
11
- var _classCallCheck3 = _interopRequireDefault(_classCallCheck2);
12
-
13
- var _possibleConstructorReturn2 = require('babel-runtime/helpers/possibleConstructorReturn');
14
-
15
- var _possibleConstructorReturn3 = _interopRequireDefault(_possibleConstructorReturn2);
16
-
17
- var _inherits2 = require('babel-runtime/helpers/inherits');
18
-
19
- var _inherits3 = _interopRequireDefault(_inherits2);
20
-
21
- var _react = require('react');
22
-
23
- var _react2 = _interopRequireDefault(_react);
24
-
25
- var _propTypes = require('prop-types');
26
-
27
- var _propTypes2 = _interopRequireDefault(_propTypes);
28
-
29
- var _CalendarHeader = require('../calendar/CalendarHeader');
30
-
31
- var _CalendarHeader2 = _interopRequireDefault(_CalendarHeader);
32
-
33
- var _DateTable = require('../date/DateTable');
34
-
35
- var _DateTable2 = _interopRequireDefault(_DateTable);
36
-
37
- var _DateInput = require('../date/DateInput');
38
-
39
- var _DateInput2 = _interopRequireDefault(_DateInput);
40
-
41
- var _index = require('../util/index');
42
-
43
- function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { 'default': obj }; }
44
-
45
- var CalendarPart = function (_React$Component) {
46
- (0, _inherits3['default'])(CalendarPart, _React$Component);
47
-
48
- function CalendarPart() {
49
- (0, _classCallCheck3['default'])(this, CalendarPart);
50
- return (0, _possibleConstructorReturn3['default'])(this, _React$Component.apply(this, arguments));
51
- }
52
-
53
- CalendarPart.prototype.render = function render() {
54
- var props = this.props;
55
- var prefixCls = props.prefixCls,
56
- value = props.value,
57
- hoverValue = props.hoverValue,
58
- selectedValue = props.selectedValue,
59
- mode = props.mode,
60
- direction = props.direction,
61
- locale = props.locale,
62
- format = props.format,
63
- placeholder = props.placeholder,
64
- disabledDate = props.disabledDate,
65
- timePicker = props.timePicker,
66
- disabledTime = props.disabledTime,
67
- timePickerDisabledTime = props.timePickerDisabledTime,
68
- showTimePicker = props.showTimePicker,
69
- onInputChange = props.onInputChange,
70
- onInputSelect = props.onInputSelect,
71
- enablePrev = props.enablePrev,
72
- enableNext = props.enableNext,
73
- clearIcon = props.clearIcon,
74
- showClear = props.showClear,
75
- inputMode = props.inputMode;
76
-
77
- var shouldShowTimePicker = showTimePicker && timePicker;
78
- var disabledTimeConfig = shouldShowTimePicker && disabledTime ? (0, _index.getTimeConfig)(selectedValue, disabledTime) : null;
79
- var rangeClassName = prefixCls + '-range';
80
- var newProps = {
81
- locale: locale,
82
- value: value,
83
- prefixCls: prefixCls,
84
- showTimePicker: showTimePicker
85
- };
86
- var index = direction === 'left' ? 0 : 1;
87
- var timePickerEle = shouldShowTimePicker && _react2['default'].cloneElement(timePicker, (0, _extends3['default'])({
88
- showHour: true,
89
- showMinute: true,
90
- showSecond: true
91
- }, timePicker.props, disabledTimeConfig, timePickerDisabledTime, {
92
- onChange: onInputChange,
93
- defaultOpenValue: value,
94
- value: selectedValue[index]
95
- }));
96
-
97
- var dateInputElement = props.showDateInput && _react2['default'].createElement(_DateInput2['default'], {
98
- format: format,
99
- locale: locale,
100
- prefixCls: prefixCls,
101
- timePicker: timePicker,
102
- disabledDate: disabledDate,
103
- placeholder: placeholder,
104
- disabledTime: disabledTime,
105
- value: value,
106
- showClear: showClear || false,
107
- selectedValue: selectedValue[index],
108
- onChange: onInputChange,
109
- onSelect: onInputSelect,
110
- clearIcon: clearIcon,
111
- inputMode: inputMode
112
- });
113
-
114
- return _react2['default'].createElement(
115
- 'div',
116
- {
117
- className: rangeClassName + '-part ' + rangeClassName + '-' + direction
118
- },
119
- dateInputElement,
120
- _react2['default'].createElement(
121
- 'div',
122
- { style: { outline: 'none' } },
123
- _react2['default'].createElement(_CalendarHeader2['default'], (0, _extends3['default'])({}, newProps, {
124
- mode: mode,
125
- enableNext: enableNext,
126
- enablePrev: enablePrev,
127
- onValueChange: props.onValueChange,
128
- onPanelChange: props.onPanelChange,
129
- disabledMonth: props.disabledMonth
130
- })),
131
- showTimePicker ? _react2['default'].createElement(
132
- 'div',
133
- { className: prefixCls + '-time-picker' },
134
- _react2['default'].createElement(
135
- 'div',
136
- { className: prefixCls + '-time-picker-panel' },
137
- timePickerEle
138
- )
139
- ) : null,
140
- _react2['default'].createElement(
141
- 'div',
142
- { className: prefixCls + '-body' },
143
- _react2['default'].createElement(_DateTable2['default'], (0, _extends3['default'])({}, newProps, {
144
- hoverValue: hoverValue,
145
- selectedValue: selectedValue,
146
- dateRender: props.dateRender,
147
- onSelect: props.onSelect,
148
- onDayHover: props.onDayHover,
149
- disabledDate: disabledDate,
150
- showWeekNumber: props.showWeekNumber
151
- }))
152
- )
153
- )
154
- );
155
- };
156
-
157
- return CalendarPart;
158
- }(_react2['default'].Component);
159
-
160
- CalendarPart.propTypes = {
161
- prefixCls: _propTypes2['default'].string,
162
- value: _propTypes2['default'].any,
163
- hoverValue: _propTypes2['default'].any,
164
- selectedValue: _propTypes2['default'].any,
165
- direction: _propTypes2['default'].any,
166
- locale: _propTypes2['default'].any,
167
- showDateInput: _propTypes2['default'].bool,
168
- showTimePicker: _propTypes2['default'].bool,
169
- format: _propTypes2['default'].any,
170
- placeholder: _propTypes2['default'].any,
171
- disabledDate: _propTypes2['default'].any,
172
- timePicker: _propTypes2['default'].any,
173
- disabledTime: _propTypes2['default'].any,
174
- onInputChange: _propTypes2['default'].func,
175
- onInputSelect: _propTypes2['default'].func,
176
- timePickerDisabledTime: _propTypes2['default'].object,
177
- enableNext: _propTypes2['default'].any,
178
- enablePrev: _propTypes2['default'].any,
179
- clearIcon: _propTypes2['default'].node,
180
- dateRender: _propTypes2['default'].func,
181
- inputMode: _propTypes2['default'].string
182
- };
183
- exports['default'] = CalendarPart;
184
- module.exports = exports['default'];
package/lib/util/dayjs.js DELETED
@@ -1,46 +0,0 @@
1
- 'use strict';
2
-
3
- exports.__esModule = true;
4
-
5
- var _dayjs = require('dayjs');
6
-
7
- var _dayjs2 = _interopRequireDefault(_dayjs);
8
-
9
- var _localeData = require('dayjs/plugin/localeData');
10
-
11
- var _localeData2 = _interopRequireDefault(_localeData);
12
-
13
- var _weekOfYear = require('dayjs/plugin/weekOfYear');
14
-
15
- var _weekOfYear2 = _interopRequireDefault(_weekOfYear);
16
-
17
- var _utc = require('dayjs/plugin/utc');
18
-
19
- var _utc2 = _interopRequireDefault(_utc);
20
-
21
- var _advancedFormat = require('dayjs/plugin/advancedFormat');
22
-
23
- var _advancedFormat2 = _interopRequireDefault(_advancedFormat);
24
-
25
- var _customParseFormat = require('dayjs/plugin/customParseFormat');
26
-
27
- var _customParseFormat2 = _interopRequireDefault(_customParseFormat);
28
-
29
- var _badMutable = require('dayjs/plugin/badMutable');
30
-
31
- var _badMutable2 = _interopRequireDefault(_badMutable);
32
-
33
- require('dayjs/locale/zh-cn');
34
-
35
- require('dayjs/locale/en-gb');
36
-
37
- function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { 'default': obj }; }
38
-
39
- _dayjs2['default'].extend(_localeData2['default']);
40
- _dayjs2['default'].extend(_weekOfYear2['default']);
41
- _dayjs2['default'].extend(_utc2['default']);
42
- _dayjs2['default'].extend(_advancedFormat2['default']);
43
- _dayjs2['default'].extend(_customParseFormat2['default']);
44
- _dayjs2['default'].extend(_badMutable2['default']);
45
- exports['default'] = _dayjs2['default'];
46
- module.exports = exports['default'];
package/lib/util/index.js DELETED
@@ -1,130 +0,0 @@
1
- 'use strict';
2
-
3
- exports.__esModule = true;
4
-
5
- var _extends2 = require('babel-runtime/helpers/extends');
6
-
7
- var _extends3 = _interopRequireDefault(_extends2);
8
-
9
- exports.getTodayTime = getTodayTime;
10
- exports.getTitleString = getTitleString;
11
- exports.getTodayTimeStr = getTodayTimeStr;
12
- exports.getMonthName = getMonthName;
13
- exports.syncTime = syncTime;
14
- exports.getTimeConfig = getTimeConfig;
15
- exports.isTimeValidByConfig = isTimeValidByConfig;
16
- exports.isTimeValid = isTimeValid;
17
- exports.isAllowedDate = isAllowedDate;
18
- exports.formatDate = formatDate;
19
-
20
- var _dayjs = require('dayjs');
21
-
22
- var _dayjs2 = _interopRequireDefault(_dayjs);
23
-
24
- var _utc = require('dayjs/plugin/utc');
25
-
26
- var _utc2 = _interopRequireDefault(_utc);
27
-
28
- function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { 'default': obj }; }
29
-
30
- _dayjs2['default'].extend(_utc2['default']);
31
-
32
- var defaultDisabledTime = {
33
- disabledHours: function disabledHours() {
34
- return [];
35
- },
36
- disabledMinutes: function disabledMinutes() {
37
- return [];
38
- },
39
- disabledSeconds: function disabledSeconds() {
40
- return [];
41
- }
42
- };
43
-
44
- function getTodayTime(value) {
45
- var today = (0, _dayjs2['default'])();
46
- today = today.locale(value.locale()).utcOffset(value.utcOffset());
47
- return today;
48
- }
49
-
50
- function getTitleString(value) {
51
- return value.format('LL');
52
- }
53
-
54
- function getTodayTimeStr(value) {
55
- var today = getTodayTime(value);
56
- return getTitleString(today);
57
- }
58
-
59
- function getMonthName(month) {
60
- var locale = month.locale();
61
- var localeData = month.localeData();
62
- return localeData[locale === 'zh-cn' ? 'months' : 'monthsShort'](month);
63
- }
64
-
65
- function syncTime(from, to) {
66
- if (!_dayjs2['default'].isDayjs(from) || !_dayjs2['default'].isDayjs(to)) return;
67
- to = to.hour(from.hour());
68
- to = to.minute(from.minute());
69
- to = to.second(from.second());
70
- to = to.millisecond(from.millisecond());
71
- }
72
-
73
- function getTimeConfig(value, disabledTime) {
74
- var disabledTimeConfig = disabledTime ? disabledTime(value) : {};
75
- disabledTimeConfig = (0, _extends3['default'])({}, defaultDisabledTime, disabledTimeConfig);
76
- return disabledTimeConfig;
77
- }
78
-
79
- function isTimeValidByConfig(value, disabledTimeConfig) {
80
- var invalidTime = false;
81
- if (value) {
82
- var hour = value.hour();
83
- var minutes = value.minute();
84
- var seconds = value.second();
85
- var disabledHours = disabledTimeConfig.disabledHours();
86
- if (disabledHours.indexOf(hour) === -1) {
87
- var disabledMinutes = disabledTimeConfig.disabledMinutes(hour);
88
- if (disabledMinutes.indexOf(minutes) === -1) {
89
- var disabledSeconds = disabledTimeConfig.disabledSeconds(hour, minutes);
90
- invalidTime = disabledSeconds.indexOf(seconds) !== -1;
91
- } else {
92
- invalidTime = true;
93
- }
94
- } else {
95
- invalidTime = true;
96
- }
97
- }
98
- return !invalidTime;
99
- }
100
-
101
- function isTimeValid(value, disabledTime) {
102
- var disabledTimeConfig = getTimeConfig(value, disabledTime);
103
- return isTimeValidByConfig(value, disabledTimeConfig);
104
- }
105
-
106
- function isAllowedDate(value, disabledDate, disabledTime) {
107
- if (disabledDate) {
108
- if (disabledDate(value)) {
109
- return false;
110
- }
111
- }
112
- if (disabledTime) {
113
- if (!isTimeValid(value, disabledTime)) {
114
- return false;
115
- }
116
- }
117
- return true;
118
- }
119
-
120
- function formatDate(value, format) {
121
- if (!value) {
122
- return '';
123
- }
124
-
125
- if (Array.isArray(format)) {
126
- format = format[0];
127
- }
128
-
129
- return value.format(format);
130
- }
@@ -1,28 +0,0 @@
1
- 'use strict';
2
-
3
- exports.__esModule = true;
4
- exports.goStartMonth = goStartMonth;
5
- exports.goEndMonth = goEndMonth;
6
- exports.goTime = goTime;
7
- exports.includesTime = includesTime;
8
- function goStartMonth(time) {
9
- return time.clone().startOf('month');
10
- }
11
-
12
- function goEndMonth(time) {
13
- return time.clone().endOf('month');
14
- }
15
-
16
- function goTime(time, direction, unit) {
17
- return time.clone().add(direction, unit);
18
- }
19
-
20
- function includesTime() {
21
- var timeList = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : [];
22
- var time = arguments[1];
23
- var unit = arguments[2];
24
-
25
- return timeList.some(function (t) {
26
- return t.isSame(time, unit);
27
- });
28
- }