@seafile/seafile-calendar 1.0.0-alpha.2 → 1.0.1-alpha.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/assets/index.css CHANGED
@@ -205,7 +205,7 @@
205
205
  .rc-calendar {
206
206
  position: relative;
207
207
  outline: none;
208
- font-family: Arial, 'Hiragino Sans GB', 'Microsoft Yahei', 'Microsoft Sans Serif', 'WenQuanYi Micro Hei', sans-serif;
208
+ font-family: Arial, "Hiragino Sans GB", "Microsoft Yahei", "Microsoft Sans Serif", "WenQuanYi Micro Hei", sans-serif;
209
209
  width: -moz-fit-content;
210
210
  width: fit-content;
211
211
  list-style: none;
@@ -277,8 +277,8 @@
277
277
  line-height: 1.5;
278
278
  }
279
279
  .rc-calendar-date-input input:focus {
280
- border-color: #ed7109;
281
- box-shadow: 0 0 3px #ed7109;
280
+ border-color: #1991eb;
281
+ box-shadow: 0 0 0 2px rgba(70, 127, 207, 0.25);
282
282
  outline: none;
283
283
  }
284
284
  .rc-calendar-text-input {
@@ -295,8 +295,8 @@
295
295
  transition: border 0.3s, background 0.3s, box-shadow 0.3s;
296
296
  }
297
297
  .rc-calendar-text-input:focus {
298
- border-color: #ed7109;
299
- box-shadow: 0 0 3px #ed7109;
298
+ border-color: #1991eb;
299
+ box-shadow: 0 0 0 2px rgba(70, 127, 207, 0.25);
300
300
  outline: none;
301
301
  }
302
302
  .rc-calendar-header {
@@ -350,7 +350,7 @@
350
350
  .rc-calendar-month-select:hover,
351
351
  .rc-calendar-day-select:hover {
352
352
  cursor: pointer;
353
- color: #f09f4f;
353
+ color: #ed7109;
354
354
  }
355
355
  .rc-calendar-year-select.rc-calendar-time-status:hover,
356
356
  .rc-calendar-month-select.rc-calendar-time-status:hover,
@@ -376,7 +376,7 @@
376
376
  .rc-calendar-next-month-btn:hover,
377
377
  .rc-calendar-prev-year-btn:hover,
378
378
  .rc-calendar-next-year-btn:hover {
379
- color: #555;
379
+ color: #ed7109;
380
380
  }
381
381
  .rc-calendar-next-year-btn {
382
382
  right: 0;
@@ -445,11 +445,11 @@
445
445
  cursor: pointer;
446
446
  }
447
447
  .rc-calendar-selected-date .rc-calendar-date {
448
- background: #ed7109;
448
+ background: #ff9800;
449
449
  color: #fff;
450
450
  }
451
451
  .rc-calendar-selected-date .rc-calendar-date:hover {
452
- background: #ed7109;
452
+ background: #ff9800;
453
453
  }
454
454
  .rc-calendar-disabled-cell .rc-calendar-date {
455
455
  cursor: not-allowed;
@@ -478,7 +478,7 @@
478
478
  }
479
479
  .rc-calendar-today .rc-calendar-date::before {
480
480
  content: '';
481
- background: #ed7109;
481
+ background: #ff9800;
482
482
  position: absolute;
483
483
  width: 4px;
484
484
  height: 4px;
@@ -528,12 +528,14 @@
528
528
  border-radius: 3px;
529
529
  }
530
530
  .rc-calendar-right-panel-item:hover {
531
- background: rgba(237, 113, 9, 0.1);
531
+ background: rgba(255, 152, 0, 0.1);
532
+ color: #212529;
532
533
  }
533
- .rc-calendar-right-panel-item-selected {
534
- background: rgba(237, 113, 9, 0.1);
534
+ .rc-calendar-right-panel-item-selected,
535
+ .rc-calendar-right-panel-item-selected:hover {
536
+ background: #ff9800;
535
537
  border-radius: 3px;
536
- color: #212529;
538
+ color: #fff;
537
539
  }
538
540
  .rc-calendar-right-panel-col::-webkit-scrollbar {
539
541
  width: 0;
@@ -595,8 +597,8 @@
595
597
  width: 100%;
596
598
  }
597
599
  .rc-calendar-time-input:focus {
598
- border-color: #ed7109;
599
- box-shadow: 0 0 3px #ed7109;
600
+ border-color: #1991eb;
601
+ box-shadow: 0 0 0 2px rgba(70, 127, 207, 0.25);
600
602
  }
601
603
  .rc-calendar-time-panel {
602
604
  left: 0;
@@ -667,7 +669,8 @@
667
669
  left: 0;
668
670
  top: 0;
669
671
  bottom: 0;
670
- right: 0;
672
+ right: auto;
673
+ width: 288px;
671
674
  background: #ffffff;
672
675
  z-index: 10;
673
676
  position: absolute;
@@ -701,10 +704,11 @@
701
704
  padding: 4px 5px;
702
705
  text-align: center;
703
706
  width: 30px;
707
+ color: #212529;
704
708
  }
705
709
  .rc-calendar-month-panel-header > a:hover {
706
710
  cursor: pointer;
707
- color: #f09f4f;
711
+ color: #ed7109;
708
712
  }
709
713
  .rc-calendar-month-panel-prev-year-btn,
710
714
  .rc-calendar-month-panel-next-year-btn {
@@ -759,7 +763,7 @@
759
763
  display: block;
760
764
  width: 46px;
761
765
  margin: 0 auto;
762
- color: #666;
766
+ color: #212529;
763
767
  border-radius: 4px 4px;
764
768
  height: 36px;
765
769
  padding: 0;
@@ -768,6 +772,7 @@
768
772
  text-align: center;
769
773
  }
770
774
  .rc-calendar-month-panel-cell .rc-calendar-month-panel-month:hover {
775
+ color: #212529;
771
776
  background: #fcecd9;
772
777
  cursor: pointer;
773
778
  }
@@ -779,7 +784,7 @@
779
784
  cursor: not-allowed;
780
785
  }
781
786
  .rc-calendar-month-panel-selected-cell .rc-calendar-month-panel-month {
782
- background: #ed7109;
787
+ background: #ff9800;
783
788
  color: #fff;
784
789
  }
785
790
  .rc-calendar-month-panel-selected-cell .rc-calendar-month-panel-month:hover {
@@ -794,7 +799,8 @@
794
799
  left: 0;
795
800
  top: 0;
796
801
  bottom: 0;
797
- right: 0;
802
+ right: auto;
803
+ width: 288px;
798
804
  background: #ffffff;
799
805
  z-index: 10;
800
806
  position: absolute;
@@ -823,15 +829,22 @@
823
829
  border-bottom: 1px solid #ccc;
824
830
  }
825
831
  .rc-calendar-year-panel-header > a {
832
+ height: 100%;
826
833
  font-weight: bold;
827
- display: inline-block;
834
+ display: -ms-inline-flexbox;
835
+ display: inline-flex;
836
+ -ms-flex-pack: center;
837
+ justify-content: center;
838
+ -ms-flex-align: center;
839
+ align-items: center;
828
840
  padding: 4px 5px;
829
841
  text-align: center;
830
842
  width: 30px;
843
+ color: #212529;
831
844
  }
832
845
  .rc-calendar-year-panel-header > a:hover {
833
846
  cursor: pointer;
834
- color: #f09f4f;
847
+ color: #ed7109;
835
848
  }
836
849
  .rc-calendar-year-panel-prev-decade-btn,
837
850
  .rc-calendar-year-panel-next-decade-btn {
@@ -886,7 +899,7 @@
886
899
  display: block;
887
900
  width: 46px;
888
901
  margin: 0 auto;
889
- color: #666;
902
+ color: #212529;
890
903
  border-radius: 4px 4px;
891
904
  height: 36px;
892
905
  padding: 0;
@@ -895,22 +908,24 @@
895
908
  text-align: center;
896
909
  }
897
910
  .rc-calendar-year-panel-year:hover {
911
+ color: #212529;
898
912
  background: #fcecd9;
899
913
  cursor: pointer;
900
914
  }
901
915
  .rc-calendar-year-panel-selected-cell .rc-calendar-year-panel-year {
902
- background: #ed7109;
916
+ background: #ff9800;
903
917
  color: #fff;
904
918
  }
905
919
  .rc-calendar-year-panel-selected-cell .rc-calendar-year-panel-year:hover {
906
- background: #ed7109;
920
+ background: #ff9800;
907
921
  color: #fff;
908
922
  }
909
923
  .rc-calendar-decade-panel {
910
924
  left: 0;
911
925
  top: 0;
912
926
  bottom: 0;
913
- right: 0;
927
+ right: auto;
928
+ width: 288px;
914
929
  background: #ffffff;
915
930
  z-index: 10;
916
931
  position: absolute;
@@ -927,6 +942,12 @@
927
942
  padding: 0 10px;
928
943
  height: 34px;
929
944
  line-height: 34px;
945
+ display: -ms-inline-flexbox;
946
+ display: inline-flex;
947
+ -ms-flex-pack: center;
948
+ justify-content: center;
949
+ -ms-flex-align: center;
950
+ align-items: center;
930
951
  position: relative;
931
952
  text-align: center;
932
953
  -moz-user-select: none;
@@ -936,15 +957,22 @@
936
957
  border-bottom: 1px solid #ccc;
937
958
  }
938
959
  .rc-calendar-decade-panel-header > a {
960
+ height: 100%;
939
961
  font-weight: bold;
940
- display: inline-block;
962
+ display: -ms-inline-flexbox;
963
+ display: inline-flex;
964
+ -ms-flex-pack: center;
965
+ justify-content: center;
966
+ -ms-flex-align: center;
967
+ align-items: center;
941
968
  padding: 1px 5px;
942
969
  text-align: center;
943
970
  width: 30px;
971
+ color: #212529;
944
972
  }
945
973
  .rc-calendar-decade-panel-header > a:hover {
946
974
  cursor: pointer;
947
- color: #f09f4f;
975
+ color: #ed7109;
948
976
  }
949
977
  .rc-calendar-decade-panel-prev-century-btn,
950
978
  .rc-calendar-decade-panel-next-century-btn {
@@ -988,11 +1016,15 @@
988
1016
  }
989
1017
  .rc-calendar-decade-panel-cell {
990
1018
  text-align: center;
1019
+ color: #212529;
1020
+ }
1021
+ .rc-calendar-decade-panel-cell a:hover {
1022
+ color: inherit;
991
1023
  }
992
1024
  .rc-calendar-decade-panel-decade {
993
1025
  display: block;
994
1026
  margin: 0 auto;
995
- color: #666;
1027
+ color: #212529;
996
1028
  border-radius: 4px 4px;
997
1029
  height: 36px;
998
1030
  padding: 0;
@@ -1005,7 +1037,7 @@
1005
1037
  cursor: pointer;
1006
1038
  }
1007
1039
  .rc-calendar-decade-panel-selected-cell .rc-calendar-decade-panel-decade {
1008
- background: #f09f3f;
1040
+ background: #ff9800;
1009
1041
  color: #fff;
1010
1042
  }
1011
1043
  .rc-calendar-decade-panel-selected-cell .rc-calendar-decade-panel-decade:hover {
package/es/Calendar.js CHANGED
@@ -164,6 +164,9 @@ var Calendar = function (_React$Component) {
164
164
  if (props.renderSidebar) {
165
165
  children.push(props.renderSidebar());
166
166
  }
167
+
168
+ var showTimeControls = showHourAndMinute && mode === 'date';
169
+
167
170
  children.push(React.createElement(
168
171
  'div',
169
172
  { className: prefixCls + '-panel', key: 'panel' },
@@ -179,7 +182,7 @@ var Calendar = function (_React$Component) {
179
182
  dateInputElement
180
183
  )
181
184
  ),
182
- showHourAndMinute && React.createElement(
185
+ showTimeControls && React.createElement(
183
186
  'div',
184
187
  { className: prefixCls + '-time-input-col' },
185
188
  timeInputTopElement
@@ -230,16 +233,13 @@ var Calendar = function (_React$Component) {
230
233
  })
231
234
  )
232
235
  ),
233
- showHourAndMinute && React.createElement(CalendarRightPanel, {
236
+ showTimeControls && React.createElement(CalendarRightPanel, {
234
237
  prefixCls: prefixCls,
235
238
  value: value,
236
239
  selectedValue: selectedValue,
237
240
  locale: locale,
238
241
  onSelect: function onSelect(v) {
239
- if (!_this2.state.hasExplicitTime) {
240
- _this2.setState({ hasExplicitTime: true });
241
- }
242
- _this2.onDateTableSelect(v);
242
+ return _this2.onDateTableSelect(v);
243
243
  },
244
244
  onClickRightPanelTime: onClickRightPanelTime,
245
245
  defaultMinutesTime: this.props.defaultMinutesTime,
@@ -407,7 +407,7 @@ var _initialiseProps = function _initialiseProps() {
407
407
  this.onClear = function () {
408
408
  _this3.onSelect(null);
409
409
  _this3.props.onClear();
410
- _this3.setState({ currentStatus: CALENDAR_STATUS.CURRENT_TIME, hasExplicitTime: false });
410
+ _this3.setState({ currentStatus: CALENDAR_STATUS.CURRENT_TIME });
411
411
  };
412
412
 
413
413
  this.onOk = function () {
@@ -471,16 +471,10 @@ var _initialiseProps = function _initialiseProps() {
471
471
  };
472
472
 
473
473
  this.onTimeInputChange = function (value) {
474
- if (!_this3.state.hasExplicitTime) {
475
- _this3.setState({ hasExplicitTime: true });
476
- }
477
474
  _this3.onSelect(value, { source: 'timeInputChange' });
478
475
  };
479
476
 
480
477
  this.onTimeInputSelect = function (value) {
481
- if (!_this3.state.hasExplicitTime) {
482
- _this3.setState({ hasExplicitTime: true });
483
- }
484
478
  _this3.onSelect(value, { source: 'timeInputSelect' });
485
479
  };
486
480
 
@@ -211,7 +211,8 @@ var CalendarRightPanel = function (_React$Component) {
211
211
  onClick: function onClick() {
212
212
  return _this4.onSelectHour(h);
213
213
  },
214
- className: prefixCls + '-right-panel-item ' + (h === selectedHour ? prefixCls + '-right-panel-item-selected' : '')
214
+ className: prefixCls + '-right-panel-item ' + (h === selectedHour ? prefixCls + '-right-panel-item-selected' : ''),
215
+ title: h
215
216
  },
216
217
  h
217
218
  );
@@ -232,7 +233,8 @@ var CalendarRightPanel = function (_React$Component) {
232
233
  onClick: function onClick() {
233
234
  return _this4.onSelectMinute(m);
234
235
  },
235
- className: prefixCls + '-right-panel-item ' + (m === selectedMinute ? prefixCls + '-right-panel-item-selected' : '')
236
+ className: prefixCls + '-right-panel-item ' + (m === selectedMinute ? prefixCls + '-right-panel-item-selected' : ''),
237
+ title: m
236
238
  },
237
239
  m
238
240
  );
@@ -115,8 +115,6 @@ var TimeInput = function (_React$Component) {
115
115
  return _this;
116
116
  }
117
117
 
118
- // Do not set state in componentDidMount; derive from props below to avoid being overwritten
119
-
120
118
  TimeInput.getDerivedStateFromProps = function getDerivedStateFromProps(nextProps, state) {
121
119
  var newState = null;
122
120
  if (timeInputInstance) {
package/es/util/dayjs.js CHANGED
@@ -3,6 +3,7 @@ import localeData from 'dayjs/plugin/localeData';
3
3
  import weekOfYear from 'dayjs/plugin/weekOfYear';
4
4
  import utc from 'dayjs/plugin/utc';
5
5
  import advancedFormat from 'dayjs/plugin/advancedFormat';
6
+ import localizedFormat from 'dayjs/plugin/localizedFormat';
6
7
  import customParseFormat from 'dayjs/plugin/customParseFormat';
7
8
  import badMutable from 'dayjs/plugin/badMutable';
8
9
  import 'dayjs/locale/zh-cn';
@@ -12,6 +13,7 @@ dayjs.extend(localeData);
12
13
  dayjs.extend(weekOfYear);
13
14
  dayjs.extend(utc);
14
15
  dayjs.extend(advancedFormat);
16
+ dayjs.extend(localizedFormat);
15
17
  dayjs.extend(customParseFormat);
16
18
  dayjs.extend(badMutable);
17
19
  export default dayjs;
package/es/util/index.js CHANGED
@@ -1,8 +1,10 @@
1
1
  import _extends from 'babel-runtime/helpers/extends';
2
2
  import dayjs from 'dayjs';
3
3
  import utc from 'dayjs/plugin/utc';
4
+ import localeData from 'dayjs/plugin/localeData';
4
5
 
5
6
  dayjs.extend(utc);
7
+ dayjs.extend(localeData);
6
8
  export var getCurrentDate = function getCurrentDate() {
7
9
  return dayjs().date();
8
10
  };
package/lib/Calendar.js CHANGED
@@ -229,6 +229,9 @@ var Calendar = function (_React$Component) {
229
229
  if (props.renderSidebar) {
230
230
  children.push(props.renderSidebar());
231
231
  }
232
+
233
+ var showTimeControls = showHourAndMinute && mode === 'date';
234
+
232
235
  children.push(_react2['default'].createElement(
233
236
  'div',
234
237
  { className: prefixCls + '-panel', key: 'panel' },
@@ -244,7 +247,7 @@ var Calendar = function (_React$Component) {
244
247
  dateInputElement
245
248
  )
246
249
  ),
247
- showHourAndMinute && _react2['default'].createElement(
250
+ showTimeControls && _react2['default'].createElement(
248
251
  'div',
249
252
  { className: prefixCls + '-time-input-col' },
250
253
  timeInputTopElement
@@ -295,16 +298,13 @@ var Calendar = function (_React$Component) {
295
298
  })
296
299
  )
297
300
  ),
298
- showHourAndMinute && _react2['default'].createElement(_CalendarRightPanel2['default'], {
301
+ showTimeControls && _react2['default'].createElement(_CalendarRightPanel2['default'], {
299
302
  prefixCls: prefixCls,
300
303
  value: value,
301
304
  selectedValue: selectedValue,
302
305
  locale: locale,
303
306
  onSelect: function onSelect(v) {
304
- if (!_this2.state.hasExplicitTime) {
305
- _this2.setState({ hasExplicitTime: true });
306
- }
307
- _this2.onDateTableSelect(v);
307
+ return _this2.onDateTableSelect(v);
308
308
  },
309
309
  onClickRightPanelTime: onClickRightPanelTime,
310
310
  defaultMinutesTime: this.props.defaultMinutesTime,
@@ -472,7 +472,7 @@ var _initialiseProps = function _initialiseProps() {
472
472
  this.onClear = function () {
473
473
  _this3.onSelect(null);
474
474
  _this3.props.onClear();
475
- _this3.setState({ currentStatus: _util.CALENDAR_STATUS.CURRENT_TIME, hasExplicitTime: false });
475
+ _this3.setState({ currentStatus: _util.CALENDAR_STATUS.CURRENT_TIME });
476
476
  };
477
477
 
478
478
  this.onOk = function () {
@@ -536,16 +536,10 @@ var _initialiseProps = function _initialiseProps() {
536
536
  };
537
537
 
538
538
  this.onTimeInputChange = function (value) {
539
- if (!_this3.state.hasExplicitTime) {
540
- _this3.setState({ hasExplicitTime: true });
541
- }
542
539
  _this3.onSelect(value, { source: 'timeInputChange' });
543
540
  };
544
541
 
545
542
  this.onTimeInputSelect = function (value) {
546
- if (!_this3.state.hasExplicitTime) {
547
- _this3.setState({ hasExplicitTime: true });
548
- }
549
543
  _this3.onSelect(value, { source: 'timeInputSelect' });
550
544
  };
551
545
 
@@ -234,7 +234,8 @@ var CalendarRightPanel = function (_React$Component) {
234
234
  onClick: function onClick() {
235
235
  return _this4.onSelectHour(h);
236
236
  },
237
- className: prefixCls + '-right-panel-item ' + (h === selectedHour ? prefixCls + '-right-panel-item-selected' : '')
237
+ className: prefixCls + '-right-panel-item ' + (h === selectedHour ? prefixCls + '-right-panel-item-selected' : ''),
238
+ title: h
238
239
  },
239
240
  h
240
241
  );
@@ -255,7 +256,8 @@ var CalendarRightPanel = function (_React$Component) {
255
256
  onClick: function onClick() {
256
257
  return _this4.onSelectMinute(m);
257
258
  },
258
- className: prefixCls + '-right-panel-item ' + (m === selectedMinute ? prefixCls + '-right-panel-item-selected' : '')
259
+ className: prefixCls + '-right-panel-item ' + (m === selectedMinute ? prefixCls + '-right-panel-item-selected' : ''),
260
+ title: m
259
261
  },
260
262
  m
261
263
  );
@@ -139,8 +139,6 @@ var TimeInput = function (_React$Component) {
139
139
  return _this;
140
140
  }
141
141
 
142
- // Do not set state in componentDidMount; derive from props below to avoid being overwritten
143
-
144
142
  TimeInput.getDerivedStateFromProps = function getDerivedStateFromProps(nextProps, state) {
145
143
  var newState = null;
146
144
  if (timeInputInstance) {
package/lib/util/dayjs.js CHANGED
@@ -22,6 +22,10 @@ var _advancedFormat = require('dayjs/plugin/advancedFormat');
22
22
 
23
23
  var _advancedFormat2 = _interopRequireDefault(_advancedFormat);
24
24
 
25
+ var _localizedFormat = require('dayjs/plugin/localizedFormat');
26
+
27
+ var _localizedFormat2 = _interopRequireDefault(_localizedFormat);
28
+
25
29
  var _customParseFormat = require('dayjs/plugin/customParseFormat');
26
30
 
27
31
  var _customParseFormat2 = _interopRequireDefault(_customParseFormat);
@@ -40,6 +44,7 @@ _dayjs2['default'].extend(_localeData2['default']);
40
44
  _dayjs2['default'].extend(_weekOfYear2['default']);
41
45
  _dayjs2['default'].extend(_utc2['default']);
42
46
  _dayjs2['default'].extend(_advancedFormat2['default']);
47
+ _dayjs2['default'].extend(_localizedFormat2['default']);
43
48
  _dayjs2['default'].extend(_customParseFormat2['default']);
44
49
  _dayjs2['default'].extend(_badMutable2['default']);
45
50
  exports['default'] = _dayjs2['default'];
package/lib/util/index.js CHANGED
@@ -35,9 +35,14 @@ var _utc = require('dayjs/plugin/utc');
35
35
 
36
36
  var _utc2 = _interopRequireDefault(_utc);
37
37
 
38
+ var _localeData = require('dayjs/plugin/localeData');
39
+
40
+ var _localeData2 = _interopRequireDefault(_localeData);
41
+
38
42
  function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { 'default': obj }; }
39
43
 
40
44
  _dayjs2['default'].extend(_utc2['default']);
45
+ _dayjs2['default'].extend(_localeData2['default']);
41
46
  var getCurrentDate = exports.getCurrentDate = function getCurrentDate() {
42
47
  return (0, _dayjs2['default'])().date();
43
48
  };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@seafile/seafile-calendar",
3
- "version": "1.0.0-alpha.2",
3
+ "version": "1.0.1-alpha.1",
4
4
  "description": "React Calendar",
5
5
  "keywords": [
6
6
  "react",