dtable-ui-component 4.3.6 → 4.3.8

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 (122) hide show
  1. package/lib/AutoNumberFormatter/index.js +11 -24
  2. package/lib/ButtonFormatter/index.js +29 -45
  3. package/lib/CTimeFormatter/index.js +17 -32
  4. package/lib/CheckboxEditor/index.js +42 -49
  5. package/lib/CheckboxFormatter/index.js +17 -30
  6. package/lib/CollaboratorEditor/index.js +118 -135
  7. package/lib/CollaboratorEditor/mb-collaborator-editor-popover/index.js +90 -99
  8. package/lib/CollaboratorEditor/pc-collaborator-editor-popover/index.js +61 -69
  9. package/lib/CollaboratorFormatter/index.js +26 -42
  10. package/lib/CollaboratorItem/index.js +31 -44
  11. package/lib/CreatorFormatter/index.js +24 -40
  12. package/lib/DTableCustomizeCollaboratorSelect/index.js +80 -99
  13. package/lib/DTableCustomizeCollaboratorSelect/utils.js +12 -13
  14. package/lib/DTableCustomizeSelect/index.css +22 -59
  15. package/lib/DTableCustomizeSelect/index.js +99 -95
  16. package/lib/DTablePopover/index.js +52 -71
  17. package/lib/DTablePopover/utils.js +1 -1
  18. package/lib/DTableRadio/index.js +9 -7
  19. package/lib/DTableSearchInput/index.js +89 -99
  20. package/lib/DTableSearchInput/utils.js +2 -2
  21. package/lib/DTableSelect/dtable-select-label.js +5 -3
  22. package/lib/DTableSelect/index.js +50 -64
  23. package/lib/DTableSelect/utils.js +36 -41
  24. package/lib/DTableSwitch/index.js +7 -5
  25. package/lib/DateEditor/index.js +88 -94
  26. package/lib/DateEditor/mb-date-editor-popover/index.js +136 -134
  27. package/lib/DateEditor/pc-date-editor-popover.js +70 -77
  28. package/lib/DateFormatter/index.js +15 -28
  29. package/lib/DepartmentSingleSelectFormatter/index.js +9 -9
  30. package/lib/DigitalSignFormatter/index.js +55 -65
  31. package/lib/DigitalSignFormatter/utils.js +9 -8
  32. package/lib/DurationFormatter/index.js +14 -27
  33. package/lib/EditEditorButton/index.js +10 -22
  34. package/lib/EmailFormatter/index.js +11 -24
  35. package/lib/FieldDisplaySetting/field-item.js +18 -20
  36. package/lib/FieldDisplaySetting/index.js +41 -43
  37. package/lib/FileEditor/index.js +18 -29
  38. package/lib/FileFormatter/index.js +29 -43
  39. package/lib/FileItemFormatter/index.js +17 -32
  40. package/lib/FileItemFormatter/utils.js +5 -5
  41. package/lib/FileUploader/index.js +20 -33
  42. package/lib/FormulaFormatter/cell-value-validator.js +23 -8
  43. package/lib/FormulaFormatter/index.js +77 -83
  44. package/lib/FormulaFormatter/utils.js +27 -21
  45. package/lib/GeolocationFormatter/index.js +19 -32
  46. package/lib/HtmlLongTextFormatter/index.js +43 -52
  47. package/lib/HtmlLongTextFormatter/markdown2html.js +2 -2
  48. package/lib/HtmlLongTextFormatter/unified/index.js +1 -1
  49. package/lib/HtmlLongTextFormatter/vfile/core.js +10 -10
  50. package/lib/ImageFormatter/images-lazy-load.js +71 -79
  51. package/lib/ImageFormatter/index.js +86 -97
  52. package/lib/ImageFormatter/utils.js +1 -1
  53. package/lib/ImagePreviewerLightbox/index.js +20 -18
  54. package/lib/ImagePreviewerLightbox/utils.js +3 -3
  55. package/lib/LastModifierFormatter/index.js +24 -40
  56. package/lib/LinkEditor/index.js +163 -167
  57. package/lib/LinkEditor/link-editor-option.js +41 -56
  58. package/lib/LinkEditor/mb-link-editor-popover/index.js +90 -99
  59. package/lib/LinkEditor/pc-link-editor-popover/index.js +63 -71
  60. package/lib/LinkFormatter/index.js +75 -77
  61. package/lib/LongTextFormatter/index.js +5 -3
  62. package/lib/MBEditorHeader/index.js +25 -38
  63. package/lib/MTimeFormatter/index.js +17 -32
  64. package/lib/ModalPortal/index.js +15 -32
  65. package/lib/MultipleSelectEditor/index.js +118 -136
  66. package/lib/MultipleSelectFormatter/index.js +24 -40
  67. package/lib/NotificationPopover/index.js +68 -95
  68. package/lib/NumberEditor/index.js +75 -82
  69. package/lib/NumberFormatter/index.js +15 -28
  70. package/lib/RateFormatter/index.js +29 -45
  71. package/lib/RoleStatusEditor/index.js +20 -22
  72. package/lib/RowExpandEmailFormatter/index.js +24 -37
  73. package/lib/RowExpandFileFormatter/index.js +28 -42
  74. package/lib/RowExpandFileFormatter/row-expand-file-item-formatter.js +66 -82
  75. package/lib/RowExpandFormatter/index.js +92 -96
  76. package/lib/RowExpandFormulaFormatter/index.js +85 -91
  77. package/lib/RowExpandImageFormatter/index.js +65 -82
  78. package/lib/RowExpandImageFormatter/row-expand-image-item-formatter.js +71 -84
  79. package/lib/RowExpandImageFormatter/utils.js +1 -1
  80. package/lib/RowExpandLinkFormatter/collaborator-item-formatter.js +54 -68
  81. package/lib/RowExpandLinkFormatter/index.js +131 -137
  82. package/lib/RowExpandLinkFormatter/utils.js +23 -17
  83. package/lib/RowExpandLinkFormatter/value-display-utils.js +9 -7
  84. package/lib/RowExpandRateFormatter/index.js +27 -42
  85. package/lib/RowExpandUrlFormatter/index.js +27 -40
  86. package/lib/SelectItem/index.js +17 -33
  87. package/lib/SelectOptionGroup/index.css +103 -0
  88. package/lib/SelectOptionGroup/index.js +157 -135
  89. package/lib/SelectOptionGroup/option.js +31 -38
  90. package/lib/SimpleLongTextFormatter/index.js +55 -67
  91. package/lib/SimpleLongTextFormatter/normalize-long-text-value.js +23 -22
  92. package/lib/SimpleLongTextFormatter/widgets/LongTextPreview.js +42 -57
  93. package/lib/SimpleLongTextFormatter/widgets/dtable-markdown-viewer.js +31 -46
  94. package/lib/SingleSelectEditor/index.js +108 -119
  95. package/lib/SingleSelectFormatter/index.js +21 -37
  96. package/lib/TextEditor/index.js +45 -51
  97. package/lib/TextFormatter/index.js +17 -32
  98. package/lib/UrlFormatter/index.js +11 -24
  99. package/lib/cellFormatterFactory/index.js +8 -17
  100. package/lib/common/ClickOutside.js +28 -0
  101. package/lib/common/delete-tip.js +40 -65
  102. package/lib/common/modal-portal.js +15 -33
  103. package/lib/constants/index.js +5 -5
  104. package/lib/data/dtable-value.js +4 -4
  105. package/lib/formatterConfig/base-formatter-config.js +24 -3
  106. package/lib/formatterConfig/index.js +5 -4
  107. package/lib/lang/index.js +6 -6
  108. package/lib/locals/de.js +1 -1
  109. package/lib/locals/en.js +1 -1
  110. package/lib/locals/fr.js +1 -1
  111. package/lib/locals/zh-CN.js +1 -1
  112. package/lib/select-editor/mb-select-editor-popover/index.js +126 -137
  113. package/lib/select-editor/pc-select-editor-popover/index.js +75 -83
  114. package/lib/select-editor/select-editor-option.js +41 -56
  115. package/lib/toaster/alert.js +73 -88
  116. package/lib/toaster/index.js +1 -1
  117. package/lib/toaster/toast.js +75 -102
  118. package/lib/toaster/toastManager.js +55 -91
  119. package/lib/toaster/toaster.js +58 -57
  120. package/lib/utils/editor-utils.js +17 -19
  121. package/lib/utils/utils.js +14 -14
  122. package/package.json +4 -4
@@ -1,10 +1,12 @@
1
1
  import React from 'react';
2
2
  function DtableSwitch(props) {
3
- var onChange = props.onChange,
4
- checked = props.checked,
5
- placeholder = props.placeholder,
6
- disabled = props.disabled,
7
- switchClassName = props.switchClassName;
3
+ const {
4
+ onChange,
5
+ checked,
6
+ placeholder,
7
+ disabled,
8
+ switchClassName
9
+ } = props;
8
10
  return /*#__PURE__*/React.createElement("div", {
9
11
  className: "dtable-switch position-relative ".concat(switchClassName || '')
10
12
  }, /*#__PURE__*/React.createElement("label", {
@@ -1,7 +1,3 @@
1
- import _classCallCheck from "@babel/runtime/helpers/esm/classCallCheck";
2
- import _createClass from "@babel/runtime/helpers/esm/createClass";
3
- import _inherits from "@babel/runtime/helpers/esm/inherits";
4
- import _createSuper from "@babel/runtime/helpers/esm/createSuper";
5
1
  import React, { Fragment } from 'react';
6
2
  import MediaQuery from 'react-responsive';
7
3
  import dayjs from 'dayjs';
@@ -9,122 +5,120 @@ import { getDateDisplayString } from 'dtable-utils';
9
5
  import PCDateEditorPopover from './pc-date-editor-popover';
10
6
  import MBDateEditorPopover from './mb-date-editor-popover';
11
7
  import './index.css';
12
- var DateEditor = /*#__PURE__*/function (_React$Component) {
13
- _inherits(DateEditor, _React$Component);
14
- var _super = _createSuper(DateEditor);
15
- function DateEditor(props) {
16
- var _this;
17
- _classCallCheck(this, DateEditor);
18
- _this = _super.call(this, props);
19
- _this.getDateFormat = function () {
20
- var column = _this.props.column;
21
- var defaultDateFormat = 'YYYY-MM-DD';
22
- var dateFormat = column.data && column.data.format;
8
+ class DateEditor extends React.Component {
9
+ constructor(props) {
10
+ super(props);
11
+ this.getDateFormat = () => {
12
+ let {
13
+ column
14
+ } = this.props;
15
+ let defaultDateFormat = 'YYYY-MM-DD';
16
+ let dateFormat = column.data && column.data.format;
23
17
  return dateFormat || defaultDateFormat;
24
18
  };
25
- _this.onDateEditorToggle = function () {
26
- var isReadOnly = _this.props.isReadOnly;
19
+ this.onDateEditorToggle = () => {
20
+ const {
21
+ isReadOnly
22
+ } = this.props;
27
23
  if (isReadOnly) {
28
24
  return;
29
25
  }
30
- _this.setState({
31
- isPopoverShow: !_this.state.isPopoverShow
26
+ this.setState({
27
+ isPopoverShow: !this.state.isPopoverShow
32
28
  });
33
29
  };
34
- _this.onValueChanged = function (value) {
35
- if (value !== _this.state.newValue) {
36
- _this.setState({
30
+ this.onValueChanged = value => {
31
+ if (value !== this.state.newValue) {
32
+ this.setState({
37
33
  newValue: value
38
34
  });
39
- _this.onCommit(value);
35
+ this.onCommit(value);
40
36
  }
41
37
  };
42
- _this.onCommit = function (newValue) {
43
- var updated = {};
44
- var column = _this.props.column;
38
+ this.onCommit = newValue => {
39
+ let updated = {};
40
+ let {
41
+ column
42
+ } = this.props;
45
43
  updated[column.key] = newValue;
46
- _this.props.onCommit(updated);
44
+ this.props.onCommit(updated);
47
45
  };
48
- _this.onClosePopover = function () {
49
- _this.setState({
46
+ this.onClosePopover = () => {
47
+ this.setState({
50
48
  isPopoverShow: false
51
49
  });
52
50
  };
53
- _this.state = {
51
+ this.state = {
54
52
  isDateInit: false,
55
53
  newValue: '',
56
54
  isPopoverShow: false,
57
55
  showHourAndMinute: false,
58
56
  defaultCalendarValue: null
59
57
  };
60
- return _this;
61
58
  }
62
- _createClass(DateEditor, [{
63
- key: "componentDidMount",
64
- value: function componentDidMount() {
65
- var _this$props = this.props,
66
- value = _this$props.value,
67
- lang = _this$props.lang;
68
- dayjs.locale(lang);
69
- var dateFormat = this.getDateFormat();
70
- this.setState({
71
- isDateInit: true,
72
- newValue: value,
73
- dateFormat: dateFormat,
74
- showHourAndMinute: dateFormat.indexOf('HH:mm') > -1
75
- });
76
- }
77
- }, {
78
- key: "render",
79
- value: function render() {
80
- if (!this.state.isDateInit) {
81
- return /*#__PURE__*/React.createElement("div", {
82
- className: "cell-editor date-editor"
83
- }, /*#__PURE__*/React.createElement("div", {
84
- className: "date-editor-container"
85
- }, /*#__PURE__*/React.createElement("div", {
86
- className: "control-form"
87
- })));
88
- }
89
- var _this$props2 = this.props,
90
- lang = _this$props2.lang,
91
- column = _this$props2.column;
92
- var _this$state = this.state,
93
- newValue = _this$state.newValue,
94
- isPopoverShow = _this$state.isPopoverShow,
95
- dateFormat = _this$state.dateFormat,
96
- showHourAndMinute = _this$state.showHourAndMinute;
59
+ componentDidMount() {
60
+ const {
61
+ value,
62
+ lang
63
+ } = this.props;
64
+ dayjs.locale(lang);
65
+ let dateFormat = this.getDateFormat();
66
+ this.setState({
67
+ isDateInit: true,
68
+ newValue: value,
69
+ dateFormat: dateFormat,
70
+ showHourAndMinute: dateFormat.indexOf('HH:mm') > -1
71
+ });
72
+ }
73
+ render() {
74
+ if (!this.state.isDateInit) {
97
75
  return /*#__PURE__*/React.createElement("div", {
98
- className: "cell-editor dtable-ui-date-editor"
99
- }, !isPopoverShow && /*#__PURE__*/React.createElement("div", {
100
- className: "dtable-ui-date-editor-container"
76
+ className: "cell-editor date-editor"
101
77
  }, /*#__PURE__*/React.createElement("div", {
102
- className: "form-control",
103
- onClick: this.onDateEditorToggle
104
- }, getDateDisplayString(newValue, dateFormat))), isPopoverShow && /*#__PURE__*/React.createElement(Fragment, null, /*#__PURE__*/React.createElement(MediaQuery, {
105
- query: '(min-width: 768px)'
106
- }, /*#__PURE__*/React.createElement(PCDateEditorPopover, {
107
- lang: lang,
108
- value: newValue,
109
- dateFormat: dateFormat,
110
- showHourAndMinute: showHourAndMinute,
111
- onValueChanged: this.onValueChanged
112
- })), /*#__PURE__*/React.createElement(MediaQuery, {
113
- query: '(max-width: 767.8px)'
114
- }, /*#__PURE__*/React.createElement(MBDateEditorPopover, {
115
- isReadOnly: this.props.isReadOnly,
116
- lang: lang,
117
- value: newValue,
118
- dateFormat: dateFormat,
119
- showHourAndMinute: showHourAndMinute,
120
- column: column,
121
- onValueChanged: this.onValueChanged,
122
- onClosePopover: this.onClosePopover
123
- }))));
78
+ className: "date-editor-container"
79
+ }, /*#__PURE__*/React.createElement("div", {
80
+ className: "control-form"
81
+ })));
124
82
  }
125
- }]);
126
- return DateEditor;
127
- }(React.Component);
83
+ let {
84
+ lang,
85
+ column
86
+ } = this.props;
87
+ let {
88
+ newValue,
89
+ isPopoverShow,
90
+ dateFormat,
91
+ showHourAndMinute
92
+ } = this.state;
93
+ return /*#__PURE__*/React.createElement("div", {
94
+ className: "cell-editor dtable-ui-date-editor"
95
+ }, !isPopoverShow && /*#__PURE__*/React.createElement("div", {
96
+ className: "dtable-ui-date-editor-container"
97
+ }, /*#__PURE__*/React.createElement("div", {
98
+ className: "form-control",
99
+ onClick: this.onDateEditorToggle
100
+ }, getDateDisplayString(newValue, dateFormat))), isPopoverShow && /*#__PURE__*/React.createElement(Fragment, null, /*#__PURE__*/React.createElement(MediaQuery, {
101
+ query: '(min-width: 768px)'
102
+ }, /*#__PURE__*/React.createElement(PCDateEditorPopover, {
103
+ lang: lang,
104
+ value: newValue,
105
+ dateFormat: dateFormat,
106
+ showHourAndMinute: showHourAndMinute,
107
+ onValueChanged: this.onValueChanged
108
+ })), /*#__PURE__*/React.createElement(MediaQuery, {
109
+ query: '(max-width: 767.8px)'
110
+ }, /*#__PURE__*/React.createElement(MBDateEditorPopover, {
111
+ isReadOnly: this.props.isReadOnly,
112
+ lang: lang,
113
+ value: newValue,
114
+ dateFormat: dateFormat,
115
+ showHourAndMinute: showHourAndMinute,
116
+ column: column,
117
+ onValueChanged: this.onValueChanged,
118
+ onClosePopover: this.onClosePopover
119
+ }))));
120
+ }
121
+ }
128
122
  DateEditor.defaultProps = {
129
123
  isReadOnly: false,
130
124
  value: '',
@@ -1,8 +1,4 @@
1
1
  import _DatePicker from "antd-mobile/lib/date-picker";
2
- import _classCallCheck from "@babel/runtime/helpers/esm/classCallCheck";
3
- import _createClass from "@babel/runtime/helpers/esm/createClass";
4
- import _inherits from "@babel/runtime/helpers/esm/inherits";
5
- import _createSuper from "@babel/runtime/helpers/esm/createSuper";
6
2
  import React from 'react';
7
3
  import dayjs from 'dayjs';
8
4
  import Calendar from '@seafile/seafile-calendar';
@@ -12,79 +8,85 @@ import { initDateEditorLanguage } from '../../utils/editor-utils';
12
8
  import MBEditorHeader from '../../MBEditorHeader';
13
9
  import '@seafile/seafile-calendar/assets/index.css';
14
10
  import './index.css';
15
- var DateEditorPopover = /*#__PURE__*/function (_React$PureComponent) {
16
- _inherits(DateEditorPopover, _React$PureComponent);
17
- var _super = _createSuper(DateEditorPopover);
18
- function DateEditorPopover(props) {
19
- var _this;
20
- _classCallCheck(this, DateEditorPopover);
21
- _this = _super.call(this, props);
22
- _this.handleHistaryBack = function (e) {
11
+ class DateEditorPopover extends React.PureComponent {
12
+ constructor(props) {
13
+ super(props);
14
+ this.handleHistaryBack = e => {
23
15
  e.preventDefault();
24
- _this.closePopover();
16
+ this.closePopover();
25
17
  };
26
- _this.handleDateChange = function (date) {
27
- var _this$props = _this.props,
28
- dateFormat = _this$props.dateFormat,
29
- showHourAndMinute = _this$props.showHourAndMinute;
30
- var newValue = dayjs(date);
18
+ this.handleDateChange = date => {
19
+ let {
20
+ dateFormat,
21
+ showHourAndMinute
22
+ } = this.props;
23
+ let newValue = dayjs(date);
31
24
  if (showHourAndMinute) {
32
- var datePickerValue = _this.state.datePickerValue;
33
- var HM = datePickerValue.format('HH:mm');
34
- var format = dateFormat.split(' ')[0]; // 'YYYY-MM-DD HH:mm'
35
- var newDate = dayjs(date).format(format) + ' ' + HM;
25
+ const {
26
+ datePickerValue
27
+ } = this.state;
28
+ const HM = datePickerValue.format('HH:mm');
29
+ const format = dateFormat.split(' ')[0]; // 'YYYY-MM-DD HH:mm'
30
+ const newDate = dayjs(date).format(format) + ' ' + HM;
36
31
  newValue = dayjs(newDate);
37
32
  }
38
- _this.setState({
33
+ this.setState({
39
34
  datePickerValue: dayjs(date)
40
35
  });
41
- _this.props.onValueChanged(newValue.format(dateFormat));
36
+ this.props.onValueChanged(newValue.format(dateFormat));
42
37
  };
43
- _this.handleTimeChange = function (time) {
44
- var datePickerValue = _this.state.datePickerValue;
45
- var dateFormat = _this.props.dateFormat;
46
- var format = dateFormat.split(' ')[0]; // 'YYYY-MM-DD HH:mm'
47
- var YMD = datePickerValue.format(format);
48
- var newDate = YMD + ' ' + dayjs(time).format('HH:mm');
49
- var newValue = dayjs(newDate);
50
- _this.setState({
38
+ this.handleTimeChange = time => {
39
+ const {
40
+ datePickerValue
41
+ } = this.state;
42
+ const {
43
+ dateFormat
44
+ } = this.props;
45
+ const format = dateFormat.split(' ')[0]; // 'YYYY-MM-DD HH:mm'
46
+ const YMD = datePickerValue.format(format);
47
+ const newDate = YMD + ' ' + dayjs(time).format('HH:mm');
48
+ const newValue = dayjs(newDate);
49
+ this.setState({
51
50
  datePickerValue: newValue
52
51
  });
53
- _this.props.onValueChanged(datePickerValue.format(dateFormat));
52
+ this.props.onValueChanged(datePickerValue.format(dateFormat));
54
53
  };
55
- _this.closePopover = function () {
56
- _this.props.onClosePopover();
54
+ this.closePopover = () => {
55
+ this.props.onClosePopover();
57
56
  };
58
- _this.deleteDate = function () {
59
- _this.props.onValueChanged('');
60
- _this.closePopover();
57
+ this.deleteDate = () => {
58
+ this.props.onValueChanged('');
59
+ this.closePopover();
61
60
  };
62
- _this.onChange = function (value) {
61
+ this.onChange = value => {
63
62
  if (!value) return;
64
- var dateFormat = _this.props.dateFormat;
65
- _this.setState({
63
+ let {
64
+ dateFormat
65
+ } = this.props;
66
+ this.setState({
66
67
  datePickerValue: value
67
68
  });
68
- _this.props.onValueChanged(value.format(dateFormat));
69
+ this.props.onValueChanged(value.format(dateFormat));
69
70
  };
70
- _this.onContainerClick = function (event) {
71
- if (_this.editorPopover && _this.editorPopover.contains(event.target)) {
71
+ this.onContainerClick = event => {
72
+ if (this.editorPopover && this.editorPopover.contains(event.target)) {
72
73
  event.stopPropagation();
73
74
  event.nativeEvent.stopImmediatePropagation();
74
75
  return false;
75
76
  }
76
77
  };
77
- _this.setEditorPopover = function (editorPopover) {
78
- _this.editorPopover = editorPopover;
78
+ this.setEditorPopover = editorPopover => {
79
+ this.editorPopover = editorPopover;
79
80
  };
80
- _this.getCalendarContainer = function () {
81
- return _this.calendarContainerRef.current;
81
+ this.getCalendarContainer = () => {
82
+ return this.calendarContainerRef.current;
82
83
  };
83
- _this.getCalender = function () {
84
- var _this$props2 = _this.props,
85
- dateFormat = _this$props2.dateFormat,
86
- lang = _this$props2.lang;
87
- var defaultValue = dayjs().clone();
84
+ this.getCalender = () => {
85
+ let {
86
+ dateFormat,
87
+ lang
88
+ } = this.props;
89
+ let defaultValue = dayjs().clone();
88
90
  return /*#__PURE__*/React.createElement(Calendar, {
89
91
  locale: initDateEditorLanguage(lang),
90
92
  format: dateFormat,
@@ -100,10 +102,14 @@ var DateEditorPopover = /*#__PURE__*/function (_React$PureComponent) {
100
102
  }
101
103
  });
102
104
  };
103
- _this.renderDataPicker = function () {
104
- var dateFormat = _this.props.dateFormat;
105
- var datePickerValue = _this.state.datePickerValue;
106
- var calendar = _this.getCalender();
105
+ this.renderDataPicker = () => {
106
+ let {
107
+ dateFormat
108
+ } = this.props;
109
+ let {
110
+ datePickerValue
111
+ } = this.state;
112
+ let calendar = this.getCalender();
107
113
  return /*#__PURE__*/React.createElement(SeaDatePicker, {
108
114
  open: true,
109
115
  style: {
@@ -111,14 +117,16 @@ var DateEditorPopover = /*#__PURE__*/function (_React$PureComponent) {
111
117
  },
112
118
  calendar: calendar,
113
119
  value: datePickerValue,
114
- getCalendarContainer: _this.getCalendarContainer,
115
- onChange: _this.onChange
116
- }, function (_ref) {
117
- var value = _ref.value;
120
+ getCalendarContainer: this.getCalendarContainer,
121
+ onChange: this.onChange
122
+ }, _ref => {
123
+ let {
124
+ value
125
+ } = _ref;
118
126
  value = value && value.format(dateFormat);
119
127
  return /*#__PURE__*/React.createElement("div", {
120
128
  tabIndex: "0",
121
- onFocus: _this.onReadOnlyFocus
129
+ onFocus: this.onReadOnlyFocus
122
130
  }, /*#__PURE__*/React.createElement("input", {
123
131
  placeholder: getLocale('Please_select'),
124
132
  readOnly: true,
@@ -126,86 +134,80 @@ var DateEditorPopover = /*#__PURE__*/function (_React$PureComponent) {
126
134
  className: "form-control",
127
135
  value: value || ''
128
136
  }), /*#__PURE__*/React.createElement("div", {
129
- ref: _this.calendarContainerRef,
137
+ ref: this.calendarContainerRef,
130
138
  style: {
131
139
  height: '22rem'
132
140
  }
133
141
  }));
134
142
  });
135
143
  };
136
- _this.state = {
144
+ this.state = {
137
145
  open: true,
138
146
  datePickerValue: props.value ? dayjs(props.value) : dayjs().clone()
139
147
  };
140
- _this.calendarContainerRef = React.createRef();
141
- return _this;
148
+ this.calendarContainerRef = React.createRef();
142
149
  }
143
- _createClass(DateEditorPopover, [{
144
- key: "componentDidMount",
145
- value: function componentDidMount() {
146
- history.pushState(null, null, '#'); // eslint-disable-line
147
- window.addEventListener('popstate', this.handleHistaryBack, false);
148
- }
149
- }, {
150
- key: "componentWillUnmount",
151
- value: function componentWillUnmount() {
152
- window.removeEventListener('popstate', this.handleHistaryBack, false);
153
- }
154
- }, {
155
- key: "render",
156
- value: function render() {
157
- var _this$props3 = this.props,
158
- lang = _this$props3.lang,
159
- column = _this$props3.column,
160
- dateFormat = _this$props3.dateFormat,
161
- showHourAndMinute = _this$props3.showHourAndMinute;
162
- var leftFormat = dateFormat.split(' ')[0];
163
- var rightFormat = dateFormat.split(' ')[1];
164
- var datePickerValue = this.state.datePickerValue;
165
- return /*#__PURE__*/React.createElement("div", {
166
- ref: this.setEditorPopover,
167
- className: "dtable-ui-mb-editor-popover mb-date-editor-popover",
168
- onClick: this.onContainerClick
169
- }, /*#__PURE__*/React.createElement(MBEditorHeader, {
170
- title: column.name,
171
- leftContent: /*#__PURE__*/React.createElement("i", {
172
- className: "dtable-font dtable-icon-return"
173
- }),
174
- rightContent: /*#__PURE__*/React.createElement("span", null, getLocale('Done')),
175
- onLeftClick: this.props.onClosePopover,
176
- onRightClick: this.props.onClosePopover
177
- }), /*#__PURE__*/React.createElement("div", {
178
- className: "dtable-ui-mb-editor-body dtable-ui-mb-date-editor-body"
179
- }, /*#__PURE__*/React.createElement("div", {
180
- className: "mb-date-editor-input"
181
- }, /*#__PURE__*/React.createElement("div", {
182
- className: "date-input"
183
- }, /*#__PURE__*/React.createElement(_DatePicker, {
184
- mode: "date",
185
- locale: initDateEditorLanguage(lang),
186
- value: this.state.value,
187
- onChange: this.handleDateChange
188
- }, /*#__PURE__*/React.createElement("div", {
189
- className: "date-input-day"
190
- }, datePickerValue && datePickerValue.format(leftFormat)))), showHourAndMinute && /*#__PURE__*/React.createElement("div", {
191
- className: "date-input"
192
- }, /*#__PURE__*/React.createElement(_DatePicker, {
193
- mode: "time",
194
- locale: initDateEditorLanguage(lang),
195
- value: this.state.value,
196
- onChange: this.handleTimeChange
197
- }, /*#__PURE__*/React.createElement("div", {
198
- className: "date-input-day"
199
- }, datePickerValue && datePickerValue.format(rightFormat))))), /*#__PURE__*/React.createElement("div", {
200
- className: "dtable-ui mb-date-editor-picker"
201
- }, this.renderDataPicker()), /*#__PURE__*/React.createElement("div", {
202
- className: "mb-date-editor-clear"
203
- }, /*#__PURE__*/React.createElement("div", {
204
- onClick: this.deleteDate,
205
- className: "clear-date"
206
- }, getLocale('Clear')))));
207
- }
208
- }]);
209
- return DateEditorPopover;
210
- }(React.PureComponent);
150
+ componentDidMount() {
151
+ history.pushState(null, null, '#'); // eslint-disable-line
152
+ window.addEventListener('popstate', this.handleHistaryBack, false);
153
+ }
154
+ componentWillUnmount() {
155
+ window.removeEventListener('popstate', this.handleHistaryBack, false);
156
+ }
157
+ render() {
158
+ const {
159
+ lang,
160
+ column,
161
+ dateFormat,
162
+ showHourAndMinute
163
+ } = this.props;
164
+ const leftFormat = dateFormat.split(' ')[0];
165
+ const rightFormat = dateFormat.split(' ')[1];
166
+ const {
167
+ datePickerValue
168
+ } = this.state;
169
+ return /*#__PURE__*/React.createElement("div", {
170
+ ref: this.setEditorPopover,
171
+ className: "dtable-ui-mb-editor-popover mb-date-editor-popover",
172
+ onClick: this.onContainerClick
173
+ }, /*#__PURE__*/React.createElement(MBEditorHeader, {
174
+ title: column.name,
175
+ leftContent: /*#__PURE__*/React.createElement("i", {
176
+ className: "dtable-font dtable-icon-return"
177
+ }),
178
+ rightContent: /*#__PURE__*/React.createElement("span", null, getLocale('Done')),
179
+ onLeftClick: this.props.onClosePopover,
180
+ onRightClick: this.props.onClosePopover
181
+ }), /*#__PURE__*/React.createElement("div", {
182
+ className: "dtable-ui-mb-editor-body dtable-ui-mb-date-editor-body"
183
+ }, /*#__PURE__*/React.createElement("div", {
184
+ className: "mb-date-editor-input"
185
+ }, /*#__PURE__*/React.createElement("div", {
186
+ className: "date-input"
187
+ }, /*#__PURE__*/React.createElement(_DatePicker, {
188
+ mode: "date",
189
+ locale: initDateEditorLanguage(lang),
190
+ value: this.state.value,
191
+ onChange: this.handleDateChange
192
+ }, /*#__PURE__*/React.createElement("div", {
193
+ className: "date-input-day"
194
+ }, datePickerValue && datePickerValue.format(leftFormat)))), showHourAndMinute && /*#__PURE__*/React.createElement("div", {
195
+ className: "date-input"
196
+ }, /*#__PURE__*/React.createElement(_DatePicker, {
197
+ mode: "time",
198
+ locale: initDateEditorLanguage(lang),
199
+ value: this.state.value,
200
+ onChange: this.handleTimeChange
201
+ }, /*#__PURE__*/React.createElement("div", {
202
+ className: "date-input-day"
203
+ }, datePickerValue && datePickerValue.format(rightFormat))))), /*#__PURE__*/React.createElement("div", {
204
+ className: "dtable-ui mb-date-editor-picker"
205
+ }, this.renderDataPicker()), /*#__PURE__*/React.createElement("div", {
206
+ className: "mb-date-editor-clear"
207
+ }, /*#__PURE__*/React.createElement("div", {
208
+ onClick: this.deleteDate,
209
+ className: "clear-date"
210
+ }, getLocale('Clear')))));
211
+ }
212
+ }
211
213
  export default DateEditorPopover;