dtable-ui-component 0.3.20 → 0.3.21
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/lib/AutoNumberFormatter/index.js +2 -9
- package/lib/ButtonFormatter/index.js +4 -17
- package/lib/CTimeFormatter/index.js +2 -15
- package/lib/CheckboxEditor/index.js +0 -13
- package/lib/CheckboxFormatter/index.js +2 -11
- package/lib/CollaboratorEditor/index.js +6 -44
- package/lib/CollaboratorEditor/mb-collaborator-editor-popover/index.js +2 -27
- package/lib/CollaboratorEditor/pc-collaborator-editor-popover/index.js +2 -20
- package/lib/CollaboratorFormatter/index.js +6 -23
- package/lib/CollaboratorItem/index.js +2 -14
- package/lib/CreatorFormatter/index.js +6 -22
- package/lib/DTableCustomizeCollaboratorSelect/index.js +16 -37
- package/lib/DTableCustomizeCollaboratorSelect/utils.js +6 -5
- package/lib/DTableCustomizeSelect/index.js +14 -37
- package/lib/DTablePopover/index.js +8 -26
- package/lib/DTableRadio/index.js +0 -2
- package/lib/DTableSearchInput/index.js +12 -36
- package/lib/DTableSelect/index.js +13 -27
- package/lib/DTableSwitch/index.js +4 -6
- package/lib/DateEditor/index.js +8 -27
- package/lib/DateEditor/mb-date-editor-popover/index.js +8 -42
- package/lib/DateEditor/pc-date-editor-popover.js +7 -27
- package/lib/DateFormatter/index.js +3 -12
- package/lib/DigitalSignFormatter/index.js +8 -26
- package/lib/DigitalSignFormatter/utils.js +3 -6
- package/lib/DurationFormatter/index.js +3 -10
- package/lib/EditEditorButton/index.js +0 -7
- package/lib/EmailFormatter/index.js +2 -9
- package/lib/FieldDisplaySetting/field-item.js +6 -20
- package/lib/FieldDisplaySetting/index.js +8 -13
- package/lib/FileEditor/index.js +0 -8
- package/lib/FileFormatter/index.js +3 -14
- package/lib/FileItemFormatter/index.js +0 -13
- package/lib/FileItemFormatter/utils.js +0 -6
- package/lib/FileUploader/index.js +0 -16
- package/lib/FormulaFormatter/cell-value-validator.js +0 -10
- package/lib/FormulaFormatter/index.js +8 -38
- package/lib/FormulaFormatter/utils.js +0 -17
- package/lib/GeolocationFormatter/index.js +4 -13
- package/lib/HtmlLongTextFormatter/index.js +0 -21
- package/lib/HtmlLongTextFormatter/markdown2html.js +2 -17
- package/lib/HtmlLongTextFormatter/unified/index.js +29 -102
- package/lib/HtmlLongTextFormatter/vfile/core.js +13 -32
- package/lib/HtmlLongTextFormatter/vfile/index.js +4 -11
- package/lib/ImageFormatter/images-lazy-load.js +5 -35
- package/lib/ImageFormatter/index.js +7 -34
- package/lib/ImageFormatter/utils.js +0 -1
- package/lib/ImagePreviewerLightbox/index.js +11 -13
- package/lib/LastModifierFormatter/index.js +6 -22
- package/lib/LinkEditor/index.js +23 -69
- package/lib/LinkEditor/link-editor-option.js +2 -18
- package/lib/LinkEditor/mb-link-editor-popover/index.js +2 -27
- package/lib/LinkEditor/pc-link-editor-popover/index.js +2 -20
- package/lib/LinkFormatter/index.js +12 -35
- package/lib/LongTextFormatter/index.js +2 -6
- package/lib/MBEditorHeader/index.js +6 -13
- package/lib/MTimeFormatter/index.js +2 -15
- package/lib/ModalPortal/index.js +0 -8
- package/lib/MultipleSelectEditor/index.js +4 -42
- package/lib/MultipleSelectFormatter/index.js +4 -17
- package/lib/NotificationPopover/index.js +3 -22
- package/lib/NumberEditor/index.js +7 -35
- package/lib/NumberFormatter/index.js +3 -12
- package/lib/RateFormatter/index.js +10 -25
- package/lib/RowExpandEmailFormatter/index.js +2 -13
- package/lib/RowExpandFileFormatter/index.js +6 -15
- package/lib/RowExpandFileFormatter/row-expand-file-item-formatter.js +6 -24
- package/lib/RowExpandFormatter/index.js +10 -60
- package/lib/RowExpandFormulaFormatter/index.js +10 -41
- package/lib/RowExpandImageFormatter/index.js +8 -27
- package/lib/RowExpandImageFormatter/row-expand-image-item-formatter.js +11 -27
- package/lib/RowExpandImageFormatter/utils.js +0 -1
- package/lib/RowExpandLinkFormatter/collaborator-item-formatter.js +4 -35
- package/lib/RowExpandLinkFormatter/index.js +6 -28
- package/lib/RowExpandLinkFormatter/utils.js +0 -4
- package/lib/RowExpandLinkFormatter/value-display-utils.js +2 -2
- package/lib/RowExpandRateFormatter/index.js +8 -23
- package/lib/RowExpandUrlFormatter/index.js +2 -14
- package/lib/SelectItem/index.js +2 -13
- package/lib/SelectOptionGroup/index.js +13 -42
- package/lib/SelectOptionGroup/option.js +0 -14
- package/lib/SimpleLongTextFormatter/index.js +0 -26
- package/lib/SimpleLongTextFormatter/normalize-long-text-value.js +2 -12
- package/lib/SimpleLongTextFormatter/widgets/LongTextPreview.js +1 -16
- package/lib/SimpleLongTextFormatter/widgets/dtable-markdown-viewer.js +0 -17
- package/lib/SingleSelectEditor/index.js +4 -37
- package/lib/SingleSelectFormatter/index.js +5 -17
- package/lib/TextEditor/index.js +3 -22
- package/lib/TextFormatter/index.js +2 -15
- package/lib/UrlFormatter/index.js +2 -9
- package/lib/cellFormatterFactory/index.js +0 -5
- package/lib/common/delete-tip.js +4 -16
- package/lib/common/modal-portal.js +0 -8
- package/lib/formatterConfig/base-formatter-config.js +0 -2
- package/lib/formatterConfig/index.js +0 -4
- package/lib/index.js +12 -6
- package/lib/lang/index.js +0 -7
- package/lib/select-editor/mb-select-editor-popover/index.js +6 -38
- package/lib/select-editor/pc-select-editor-popover/index.js +3 -25
- package/lib/select-editor/select-editor-option.js +2 -17
- package/lib/toaster/alert.js +0 -12
- package/lib/toaster/toast.js +1 -22
- package/lib/toaster/toastManager.js +7 -30
- package/lib/toaster/toaster.js +4 -15
- package/lib/utils/editor-utils.js +0 -20
- package/lib/utils/utils.js +2 -5
- package/package.json +5 -5
|
@@ -5,30 +5,22 @@ import _createSuper from "@babel/runtime/helpers/esm/createSuper";
|
|
|
5
5
|
import React, { Component, Fragment } from 'react';
|
|
6
6
|
import classnames from 'classnames';
|
|
7
7
|
import { isFunction } from './utils';
|
|
8
|
-
|
|
9
8
|
var DtableSearchInput = /*#__PURE__*/function (_Component) {
|
|
10
9
|
_inherits(DtableSearchInput, _Component);
|
|
11
|
-
|
|
12
10
|
var _super = _createSuper(DtableSearchInput);
|
|
13
|
-
|
|
14
11
|
function DtableSearchInput(props) {
|
|
15
12
|
var _this;
|
|
16
|
-
|
|
17
13
|
_classCallCheck(this, DtableSearchInput);
|
|
18
|
-
|
|
19
14
|
_this = _super.call(this, props);
|
|
20
|
-
|
|
21
15
|
_this.onCompositionStart = function () {
|
|
22
16
|
_this.isInputtingChinese = true;
|
|
23
17
|
};
|
|
24
|
-
|
|
25
18
|
_this.onChange = function (e) {
|
|
26
19
|
_this.timer && clearTimeout(_this.timer);
|
|
27
20
|
var _this$props = _this.props,
|
|
28
|
-
|
|
29
|
-
|
|
21
|
+
onChange = _this$props.onChange,
|
|
22
|
+
wait = _this$props.wait;
|
|
30
23
|
var text = e.target.value;
|
|
31
|
-
|
|
32
24
|
_this.setState({
|
|
33
25
|
searchValue: text || ''
|
|
34
26
|
}, function () {
|
|
@@ -38,45 +30,35 @@ var DtableSearchInput = /*#__PURE__*/function (_Component) {
|
|
|
38
30
|
}, wait);
|
|
39
31
|
});
|
|
40
32
|
};
|
|
41
|
-
|
|
42
33
|
_this.onCompositionEnd = function (e) {
|
|
43
34
|
_this.isInputtingChinese = false;
|
|
44
|
-
|
|
45
35
|
_this.onChange(e);
|
|
46
36
|
};
|
|
47
|
-
|
|
48
37
|
_this.clearSearch = function () {
|
|
49
38
|
var clearValue = _this.props.clearValue;
|
|
50
|
-
|
|
51
39
|
_this.setState({
|
|
52
40
|
searchValue: ''
|
|
53
41
|
}, function () {
|
|
54
42
|
clearValue && clearValue();
|
|
55
43
|
});
|
|
56
44
|
};
|
|
57
|
-
|
|
58
45
|
_this.setFocus = function (isSelectAllText) {
|
|
59
46
|
if (_this.inputRef === document.activeElement) return;
|
|
60
|
-
|
|
61
47
|
_this.inputRef.focus();
|
|
62
|
-
|
|
63
48
|
if (isSelectAllText) {
|
|
64
49
|
var txtLength = _this.state.searchValue.length;
|
|
65
|
-
|
|
66
50
|
_this.inputRef.setSelectionRange(0, txtLength);
|
|
67
51
|
}
|
|
68
52
|
};
|
|
69
|
-
|
|
70
53
|
_this.renderClear = function () {
|
|
71
54
|
var _this$props2 = _this.props,
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
55
|
+
isClearable = _this$props2.isClearable,
|
|
56
|
+
clearClassName = _this$props2.clearClassName,
|
|
57
|
+
_this$props2$componen = _this$props2.components,
|
|
58
|
+
components = _this$props2$componen === void 0 ? {} : _this$props2$componen;
|
|
76
59
|
var searchValue = _this.state.searchValue;
|
|
77
60
|
if (!isClearable || !searchValue) return null;
|
|
78
61
|
var ClearIndicator = components.ClearIndicator;
|
|
79
|
-
|
|
80
62
|
if (React.isValidElement(ClearIndicator)) {
|
|
81
63
|
return React.cloneElement(ClearIndicator, {
|
|
82
64
|
clearValue: _this.clearSearch
|
|
@@ -86,13 +68,11 @@ var DtableSearchInput = /*#__PURE__*/function (_Component) {
|
|
|
86
68
|
clearValue: _this.clearSearch
|
|
87
69
|
});
|
|
88
70
|
}
|
|
89
|
-
|
|
90
71
|
return /*#__PURE__*/React.createElement("i", {
|
|
91
72
|
className: classnames('search-text-clear input-icon-addon', clearClassName),
|
|
92
73
|
onClick: _this.clearSearch
|
|
93
74
|
}, "\xD7");
|
|
94
75
|
};
|
|
95
|
-
|
|
96
76
|
_this.state = {
|
|
97
77
|
searchValue: props.value
|
|
98
78
|
};
|
|
@@ -101,7 +81,6 @@ var DtableSearchInput = /*#__PURE__*/function (_Component) {
|
|
|
101
81
|
_this.inputRef = null;
|
|
102
82
|
return _this;
|
|
103
83
|
}
|
|
104
|
-
|
|
105
84
|
_createClass(DtableSearchInput, [{
|
|
106
85
|
key: "UNSAFE_componentWillReceiveProps",
|
|
107
86
|
value: function UNSAFE_componentWillReceiveProps(nextProps) {
|
|
@@ -122,14 +101,13 @@ var DtableSearchInput = /*#__PURE__*/function (_Component) {
|
|
|
122
101
|
key: "render",
|
|
123
102
|
value: function render() {
|
|
124
103
|
var _this2 = this;
|
|
125
|
-
|
|
126
104
|
var _this$props3 = this.props,
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
|
|
105
|
+
placeholder = _this$props3.placeholder,
|
|
106
|
+
autoFocus = _this$props3.autoFocus,
|
|
107
|
+
className = _this$props3.className,
|
|
108
|
+
onKeyDown = _this$props3.onKeyDown,
|
|
109
|
+
disabled = _this$props3.disabled,
|
|
110
|
+
style = _this$props3.style;
|
|
133
111
|
var searchValue = this.state.searchValue;
|
|
134
112
|
return /*#__PURE__*/React.createElement(Fragment, null, /*#__PURE__*/React.createElement("input", {
|
|
135
113
|
type: "text",
|
|
@@ -149,10 +127,8 @@ var DtableSearchInput = /*#__PURE__*/function (_Component) {
|
|
|
149
127
|
}), this.renderClear());
|
|
150
128
|
}
|
|
151
129
|
}]);
|
|
152
|
-
|
|
153
130
|
return DtableSearchInput;
|
|
154
131
|
}(Component);
|
|
155
|
-
|
|
156
132
|
DtableSearchInput.defaultProps = {
|
|
157
133
|
wait: 100,
|
|
158
134
|
disabled: false,
|
|
@@ -8,8 +8,8 @@ import Select, { components } from 'react-select';
|
|
|
8
8
|
var MenuSelectStyle = {
|
|
9
9
|
option: function option(provided, state) {
|
|
10
10
|
var isDisabled = state.isDisabled,
|
|
11
|
-
|
|
12
|
-
|
|
11
|
+
isSelected = state.isSelected,
|
|
12
|
+
isFocused = state.isFocused;
|
|
13
13
|
return _objectSpread(_objectSpread({}, provided), {}, {
|
|
14
14
|
cursor: isDisabled ? 'default' : 'pointer',
|
|
15
15
|
backgroundColor: isSelected ? '#20a0ff' : isFocused ? '#f5f5f5' : '#fff',
|
|
@@ -32,7 +32,6 @@ var MenuSelectStyle = {
|
|
|
32
32
|
},
|
|
33
33
|
indicatorSeparator: function indicatorSeparator() {}
|
|
34
34
|
};
|
|
35
|
-
|
|
36
35
|
var DropdownIndicator = function DropdownIndicator(props) {
|
|
37
36
|
return components.DropdownIndicator && /*#__PURE__*/React.createElement(components.DropdownIndicator, props, /*#__PURE__*/React.createElement("span", {
|
|
38
37
|
className: "dtable-font dtable-icon-drop-down",
|
|
@@ -41,7 +40,6 @@ var DropdownIndicator = function DropdownIndicator(props) {
|
|
|
41
40
|
}
|
|
42
41
|
}));
|
|
43
42
|
};
|
|
44
|
-
|
|
45
43
|
var MenuList = function MenuList(props) {
|
|
46
44
|
return /*#__PURE__*/React.createElement("div", {
|
|
47
45
|
onClick: function onClick(e) {
|
|
@@ -52,52 +50,42 @@ var MenuList = function MenuList(props) {
|
|
|
52
50
|
}
|
|
53
51
|
}, /*#__PURE__*/React.createElement(components.MenuList, props, props.children));
|
|
54
52
|
};
|
|
55
|
-
|
|
56
53
|
var Option = function Option(props) {
|
|
57
54
|
return /*#__PURE__*/React.createElement("div", {
|
|
58
55
|
style: props.data.style
|
|
59
56
|
}, /*#__PURE__*/React.createElement(components.Option, props));
|
|
60
57
|
};
|
|
61
|
-
|
|
62
58
|
var DtableSelect = /*#__PURE__*/function (_React$Component) {
|
|
63
59
|
_inherits(DtableSelect, _React$Component);
|
|
64
|
-
|
|
65
60
|
var _super = _createSuper(DtableSelect);
|
|
66
|
-
|
|
67
61
|
function DtableSelect() {
|
|
68
62
|
var _this;
|
|
69
|
-
|
|
70
63
|
_classCallCheck(this, DtableSelect);
|
|
71
|
-
|
|
72
64
|
for (var _len = arguments.length, args = new Array(_len), _key = 0; _key < _len; _key++) {
|
|
73
65
|
args[_key] = arguments[_key];
|
|
74
66
|
}
|
|
75
|
-
|
|
76
67
|
_this = _super.call.apply(_super, [this].concat(args));
|
|
77
|
-
|
|
78
68
|
_this.getMenuPortalTarget = function () {
|
|
79
69
|
var menuPortalTarget = _this.props.menuPortalTarget;
|
|
80
70
|
return document.querySelector(menuPortalTarget);
|
|
81
71
|
};
|
|
82
|
-
|
|
83
72
|
return _this;
|
|
84
73
|
}
|
|
85
|
-
|
|
86
74
|
_createClass(DtableSelect, [{
|
|
87
75
|
key: "render",
|
|
88
76
|
value: function render() {
|
|
89
77
|
var _this$props = this.props,
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
78
|
+
options = _this$props.options,
|
|
79
|
+
onChange = _this$props.onChange,
|
|
80
|
+
value = _this$props.value,
|
|
81
|
+
isSearchable = _this$props.isSearchable,
|
|
82
|
+
placeholder = _this$props.placeholder,
|
|
83
|
+
isMulti = _this$props.isMulti,
|
|
84
|
+
menuPosition = _this$props.menuPosition,
|
|
85
|
+
isClearable = _this$props.isClearable,
|
|
86
|
+
noOptionsMessage = _this$props.noOptionsMessage,
|
|
87
|
+
classNamePrefix = _this$props.classNamePrefix,
|
|
88
|
+
style = _this$props.style;
|
|
101
89
|
return /*#__PURE__*/React.createElement(Select, {
|
|
102
90
|
value: value,
|
|
103
91
|
onChange: onChange,
|
|
@@ -122,10 +110,8 @@ var DtableSelect = /*#__PURE__*/function (_React$Component) {
|
|
|
122
110
|
});
|
|
123
111
|
}
|
|
124
112
|
}]);
|
|
125
|
-
|
|
126
113
|
return DtableSelect;
|
|
127
114
|
}(React.Component);
|
|
128
|
-
|
|
129
115
|
DtableSelect.defaultProps = {
|
|
130
116
|
options: [],
|
|
131
117
|
value: {},
|
|
@@ -1,11 +1,10 @@
|
|
|
1
1
|
import React from 'react';
|
|
2
|
-
|
|
3
2
|
function DtableSwitch(props) {
|
|
4
3
|
var onChange = props.onChange,
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
4
|
+
checked = props.checked,
|
|
5
|
+
placeholder = props.placeholder,
|
|
6
|
+
disabled = props.disabled,
|
|
7
|
+
switchClassName = props.switchClassName;
|
|
9
8
|
return /*#__PURE__*/React.createElement("div", {
|
|
10
9
|
className: "dtable-switch position-relative ".concat(switchClassName || '')
|
|
11
10
|
}, /*#__PURE__*/React.createElement("label", {
|
|
@@ -23,5 +22,4 @@ function DtableSwitch(props) {
|
|
|
23
22
|
className: "custom-switch-indicator"
|
|
24
23
|
})));
|
|
25
24
|
}
|
|
26
|
-
|
|
27
25
|
export default DtableSwitch;
|
package/lib/DateEditor/index.js
CHANGED
|
@@ -9,62 +9,47 @@ import { getDateDisplayString } from 'dtable-utils';
|
|
|
9
9
|
import PCDateEditorPopover from './pc-date-editor-popover';
|
|
10
10
|
import MBDateEditorPopover from './mb-date-editor-popover';
|
|
11
11
|
import './index.css';
|
|
12
|
-
|
|
13
12
|
var DateEditor = /*#__PURE__*/function (_React$Component) {
|
|
14
13
|
_inherits(DateEditor, _React$Component);
|
|
15
|
-
|
|
16
14
|
var _super = _createSuper(DateEditor);
|
|
17
|
-
|
|
18
15
|
function DateEditor(props) {
|
|
19
16
|
var _this;
|
|
20
|
-
|
|
21
17
|
_classCallCheck(this, DateEditor);
|
|
22
|
-
|
|
23
18
|
_this = _super.call(this, props);
|
|
24
|
-
|
|
25
19
|
_this.getDateFormat = function () {
|
|
26
20
|
var column = _this.props.column;
|
|
27
21
|
var defaultDateFormat = 'YYYY-MM-DD';
|
|
28
22
|
var dateFormat = column.data && column.data.format;
|
|
29
23
|
return dateFormat || defaultDateFormat;
|
|
30
24
|
};
|
|
31
|
-
|
|
32
25
|
_this.onDateEditorToggle = function () {
|
|
33
26
|
var isReadOnly = _this.props.isReadOnly;
|
|
34
|
-
|
|
35
27
|
if (isReadOnly) {
|
|
36
28
|
return;
|
|
37
29
|
}
|
|
38
|
-
|
|
39
30
|
_this.setState({
|
|
40
31
|
isPopoverShow: !_this.state.isPopoverShow
|
|
41
32
|
});
|
|
42
33
|
};
|
|
43
|
-
|
|
44
34
|
_this.onValueChanged = function (value) {
|
|
45
35
|
if (value !== _this.state.newValue) {
|
|
46
36
|
_this.setState({
|
|
47
37
|
newValue: value
|
|
48
38
|
});
|
|
49
|
-
|
|
50
39
|
_this.onCommit(value);
|
|
51
40
|
}
|
|
52
41
|
};
|
|
53
|
-
|
|
54
42
|
_this.onCommit = function (newValue) {
|
|
55
43
|
var updated = {};
|
|
56
44
|
var column = _this.props.column;
|
|
57
45
|
updated[column.key] = newValue;
|
|
58
|
-
|
|
59
46
|
_this.props.onCommit(updated);
|
|
60
47
|
};
|
|
61
|
-
|
|
62
48
|
_this.onClosePopover = function () {
|
|
63
49
|
_this.setState({
|
|
64
50
|
isPopoverShow: false
|
|
65
51
|
});
|
|
66
52
|
};
|
|
67
|
-
|
|
68
53
|
_this.state = {
|
|
69
54
|
isDateInit: false,
|
|
70
55
|
newValue: '',
|
|
@@ -74,13 +59,12 @@ var DateEditor = /*#__PURE__*/function (_React$Component) {
|
|
|
74
59
|
};
|
|
75
60
|
return _this;
|
|
76
61
|
}
|
|
77
|
-
|
|
78
62
|
_createClass(DateEditor, [{
|
|
79
63
|
key: "componentDidMount",
|
|
80
64
|
value: function componentDidMount() {
|
|
81
65
|
var _this$props = this.props,
|
|
82
|
-
|
|
83
|
-
|
|
66
|
+
value = _this$props.value,
|
|
67
|
+
lang = _this$props.lang;
|
|
84
68
|
dayjs.locale(lang);
|
|
85
69
|
var dateFormat = this.getDateFormat();
|
|
86
70
|
this.setState({
|
|
@@ -102,15 +86,14 @@ var DateEditor = /*#__PURE__*/function (_React$Component) {
|
|
|
102
86
|
className: "control-form"
|
|
103
87
|
})));
|
|
104
88
|
}
|
|
105
|
-
|
|
106
89
|
var _this$props2 = this.props,
|
|
107
|
-
|
|
108
|
-
|
|
90
|
+
lang = _this$props2.lang,
|
|
91
|
+
column = _this$props2.column;
|
|
109
92
|
var _this$state = this.state,
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
93
|
+
newValue = _this$state.newValue,
|
|
94
|
+
isPopoverShow = _this$state.isPopoverShow,
|
|
95
|
+
dateFormat = _this$state.dateFormat,
|
|
96
|
+
showHourAndMinute = _this$state.showHourAndMinute;
|
|
114
97
|
return /*#__PURE__*/React.createElement("div", {
|
|
115
98
|
className: "cell-editor dtable-ui-date-editor"
|
|
116
99
|
}, !isPopoverShow && /*#__PURE__*/React.createElement("div", {
|
|
@@ -140,10 +123,8 @@ var DateEditor = /*#__PURE__*/function (_React$Component) {
|
|
|
140
123
|
}))));
|
|
141
124
|
}
|
|
142
125
|
}]);
|
|
143
|
-
|
|
144
126
|
return DateEditor;
|
|
145
127
|
}(React.Component);
|
|
146
|
-
|
|
147
128
|
DateEditor.defaultProps = {
|
|
148
129
|
isReadOnly: false,
|
|
149
130
|
value: '',
|
|
@@ -12,84 +12,61 @@ import { initDateEditorLanguage } from '../../utils/editor-utils';
|
|
|
12
12
|
import MBEditorHeader from '../../MBEditorHeader';
|
|
13
13
|
import '@seafile/seafile-calendar/assets/index.css';
|
|
14
14
|
import './index.css';
|
|
15
|
-
|
|
16
15
|
var DateEditorPopover = /*#__PURE__*/function (_React$PureComponent) {
|
|
17
16
|
_inherits(DateEditorPopover, _React$PureComponent);
|
|
18
|
-
|
|
19
17
|
var _super = _createSuper(DateEditorPopover);
|
|
20
|
-
|
|
21
18
|
function DateEditorPopover(props) {
|
|
22
19
|
var _this;
|
|
23
|
-
|
|
24
20
|
_classCallCheck(this, DateEditorPopover);
|
|
25
|
-
|
|
26
21
|
_this = _super.call(this, props);
|
|
27
|
-
|
|
28
22
|
_this.handleHistaryBack = function (e) {
|
|
29
23
|
e.preventDefault();
|
|
30
|
-
|
|
31
24
|
_this.closePopover();
|
|
32
25
|
};
|
|
33
|
-
|
|
34
26
|
_this.handleDateChange = function (date) {
|
|
35
27
|
var _this$props = _this.props,
|
|
36
|
-
|
|
37
|
-
|
|
28
|
+
dateFormat = _this$props.dateFormat,
|
|
29
|
+
showHourAndMinute = _this$props.showHourAndMinute;
|
|
38
30
|
var newValue = dayjs(date);
|
|
39
|
-
|
|
40
31
|
if (showHourAndMinute) {
|
|
41
32
|
var datePickerValue = _this.state.datePickerValue;
|
|
42
33
|
var HM = datePickerValue.format('HH:mm');
|
|
43
34
|
var format = dateFormat.split(' ')[0]; // 'YYYY-MM-DD HH:mm'
|
|
44
|
-
|
|
45
35
|
var newDate = dayjs(date).format(format) + ' ' + HM;
|
|
46
36
|
newValue = dayjs(newDate);
|
|
47
37
|
}
|
|
48
|
-
|
|
49
38
|
_this.setState({
|
|
50
39
|
datePickerValue: dayjs(date)
|
|
51
40
|
});
|
|
52
|
-
|
|
53
41
|
_this.props.onValueChanged(newValue.format(dateFormat));
|
|
54
42
|
};
|
|
55
|
-
|
|
56
43
|
_this.handleTimeChange = function (time) {
|
|
57
44
|
var datePickerValue = _this.state.datePickerValue;
|
|
58
45
|
var dateFormat = _this.props.dateFormat;
|
|
59
46
|
var format = dateFormat.split(' ')[0]; // 'YYYY-MM-DD HH:mm'
|
|
60
|
-
|
|
61
47
|
var YMD = datePickerValue.format(format);
|
|
62
48
|
var newDate = YMD + ' ' + dayjs(time).format('HH:mm');
|
|
63
49
|
var newValue = dayjs(newDate);
|
|
64
|
-
|
|
65
50
|
_this.setState({
|
|
66
51
|
datePickerValue: newValue
|
|
67
52
|
});
|
|
68
|
-
|
|
69
53
|
_this.props.onValueChanged(datePickerValue.format(dateFormat));
|
|
70
54
|
};
|
|
71
|
-
|
|
72
55
|
_this.closePopover = function () {
|
|
73
56
|
_this.props.onClosePopover();
|
|
74
57
|
};
|
|
75
|
-
|
|
76
58
|
_this.deleteDate = function () {
|
|
77
59
|
_this.props.onValueChanged('');
|
|
78
|
-
|
|
79
60
|
_this.closePopover();
|
|
80
61
|
};
|
|
81
|
-
|
|
82
62
|
_this.onChange = function (value) {
|
|
83
63
|
if (!value) return;
|
|
84
64
|
var dateFormat = _this.props.dateFormat;
|
|
85
|
-
|
|
86
65
|
_this.setState({
|
|
87
66
|
datePickerValue: value
|
|
88
67
|
});
|
|
89
|
-
|
|
90
68
|
_this.props.onValueChanged(value.format(dateFormat));
|
|
91
69
|
};
|
|
92
|
-
|
|
93
70
|
_this.onContainerClick = function (event) {
|
|
94
71
|
if (_this.editorPopover && _this.editorPopover.contains(event.target)) {
|
|
95
72
|
event.stopPropagation();
|
|
@@ -97,19 +74,16 @@ var DateEditorPopover = /*#__PURE__*/function (_React$PureComponent) {
|
|
|
97
74
|
return false;
|
|
98
75
|
}
|
|
99
76
|
};
|
|
100
|
-
|
|
101
77
|
_this.setEditorPopover = function (editorPopover) {
|
|
102
78
|
_this.editorPopover = editorPopover;
|
|
103
79
|
};
|
|
104
|
-
|
|
105
80
|
_this.getCalendarContainer = function () {
|
|
106
81
|
return _this.calendarContainerRef.current;
|
|
107
82
|
};
|
|
108
|
-
|
|
109
83
|
_this.getCalender = function () {
|
|
110
84
|
var _this$props2 = _this.props,
|
|
111
|
-
|
|
112
|
-
|
|
85
|
+
dateFormat = _this$props2.dateFormat,
|
|
86
|
+
lang = _this$props2.lang;
|
|
113
87
|
var defaultValue = dayjs().clone();
|
|
114
88
|
return /*#__PURE__*/React.createElement(Calendar, {
|
|
115
89
|
locale: initDateEditorLanguage(lang),
|
|
@@ -126,13 +100,10 @@ var DateEditorPopover = /*#__PURE__*/function (_React$PureComponent) {
|
|
|
126
100
|
}
|
|
127
101
|
});
|
|
128
102
|
};
|
|
129
|
-
|
|
130
103
|
_this.renderDataPicker = function () {
|
|
131
104
|
var dateFormat = _this.props.dateFormat;
|
|
132
105
|
var datePickerValue = _this.state.datePickerValue;
|
|
133
|
-
|
|
134
106
|
var calendar = _this.getCalender();
|
|
135
|
-
|
|
136
107
|
return /*#__PURE__*/React.createElement(SeaDatePicker, {
|
|
137
108
|
open: true,
|
|
138
109
|
style: {
|
|
@@ -162,7 +133,6 @@ var DateEditorPopover = /*#__PURE__*/function (_React$PureComponent) {
|
|
|
162
133
|
}));
|
|
163
134
|
});
|
|
164
135
|
};
|
|
165
|
-
|
|
166
136
|
_this.state = {
|
|
167
137
|
open: true,
|
|
168
138
|
datePickerValue: props.value ? dayjs(props.value) : dayjs().clone()
|
|
@@ -170,12 +140,10 @@ var DateEditorPopover = /*#__PURE__*/function (_React$PureComponent) {
|
|
|
170
140
|
_this.calendarContainerRef = React.createRef();
|
|
171
141
|
return _this;
|
|
172
142
|
}
|
|
173
|
-
|
|
174
143
|
_createClass(DateEditorPopover, [{
|
|
175
144
|
key: "componentDidMount",
|
|
176
145
|
value: function componentDidMount() {
|
|
177
146
|
history.pushState(null, null, '#'); // eslint-disable-line
|
|
178
|
-
|
|
179
147
|
window.addEventListener('popstate', this.handleHistaryBack, false);
|
|
180
148
|
}
|
|
181
149
|
}, {
|
|
@@ -187,10 +155,10 @@ var DateEditorPopover = /*#__PURE__*/function (_React$PureComponent) {
|
|
|
187
155
|
key: "render",
|
|
188
156
|
value: function render() {
|
|
189
157
|
var _this$props3 = this.props,
|
|
190
|
-
|
|
191
|
-
|
|
192
|
-
|
|
193
|
-
|
|
158
|
+
lang = _this$props3.lang,
|
|
159
|
+
column = _this$props3.column,
|
|
160
|
+
dateFormat = _this$props3.dateFormat,
|
|
161
|
+
showHourAndMinute = _this$props3.showHourAndMinute;
|
|
194
162
|
var leftFormat = dateFormat.split(' ')[0];
|
|
195
163
|
var rightFormat = dateFormat.split(' ')[1];
|
|
196
164
|
var datePickerValue = this.state.datePickerValue;
|
|
@@ -238,8 +206,6 @@ var DateEditorPopover = /*#__PURE__*/function (_React$PureComponent) {
|
|
|
238
206
|
}, getLocale('Clear')))));
|
|
239
207
|
}
|
|
240
208
|
}]);
|
|
241
|
-
|
|
242
209
|
return DateEditorPopover;
|
|
243
210
|
}(React.PureComponent);
|
|
244
|
-
|
|
245
211
|
export default DateEditorPopover;
|
|
@@ -9,66 +9,52 @@ import Calendar from '@seafile/seafile-calendar';
|
|
|
9
9
|
import { initDateEditorLanguage } from '../utils/editor-utils';
|
|
10
10
|
import '@seafile/seafile-calendar/assets/index.css';
|
|
11
11
|
import { getLocale } from '../lang';
|
|
12
|
-
|
|
13
12
|
var PCDateEditorPopover = /*#__PURE__*/function (_React$Component) {
|
|
14
13
|
_inherits(PCDateEditorPopover, _React$Component);
|
|
15
|
-
|
|
16
14
|
var _super = _createSuper(PCDateEditorPopover);
|
|
17
|
-
|
|
18
15
|
function PCDateEditorPopover(props) {
|
|
19
16
|
var _this;
|
|
20
|
-
|
|
21
17
|
_classCallCheck(this, PCDateEditorPopover);
|
|
22
|
-
|
|
23
18
|
_this = _super.call(this, props);
|
|
24
|
-
|
|
19
|
+
// event trigger sequence: onOpenChange --> onChange
|
|
25
20
|
_this.onChange = function (value) {
|
|
26
21
|
if (!value) return;
|
|
27
22
|
var dateFormat = _this.props.dateFormat;
|
|
28
|
-
|
|
29
23
|
_this.setState({
|
|
30
24
|
datePickerValue: value,
|
|
31
25
|
open: true // if value changed, don't close datePicker
|
|
32
|
-
|
|
33
26
|
});
|
|
34
27
|
|
|
35
28
|
_this.props.onValueChanged(value.format(dateFormat));
|
|
36
29
|
};
|
|
37
|
-
|
|
38
30
|
_this.onOpenChange = function (open) {
|
|
39
31
|
_this.setState({
|
|
40
32
|
open: open
|
|
41
33
|
});
|
|
42
|
-
|
|
43
34
|
return;
|
|
44
35
|
};
|
|
45
|
-
|
|
46
36
|
_this.onClear = function () {
|
|
47
37
|
_this.setState({
|
|
48
38
|
datePickerValue: null
|
|
49
39
|
});
|
|
50
40
|
};
|
|
51
|
-
|
|
52
41
|
_this.onFocusDatePicker = function () {
|
|
53
42
|
_this.setState({
|
|
54
43
|
open: true
|
|
55
44
|
});
|
|
56
45
|
};
|
|
57
|
-
|
|
58
46
|
_this.handleMouseDown = function (event) {
|
|
59
47
|
event.preventDefault();
|
|
60
48
|
event.stopPropagation();
|
|
61
49
|
};
|
|
62
|
-
|
|
63
50
|
_this.getCalendarContainer = function () {
|
|
64
51
|
return _this.calendarContainerRef.current;
|
|
65
52
|
};
|
|
66
|
-
|
|
67
53
|
_this.getCalender = function () {
|
|
68
54
|
var _this$props = _this.props,
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
55
|
+
dateFormat = _this$props.dateFormat,
|
|
56
|
+
showHourAndMinute = _this$props.showHourAndMinute,
|
|
57
|
+
lang = _this$props.lang;
|
|
72
58
|
var defaultValue = dayjs().clone();
|
|
73
59
|
return /*#__PURE__*/React.createElement(Calendar, {
|
|
74
60
|
locale: initDateEditorLanguage(lang),
|
|
@@ -84,25 +70,21 @@ var PCDateEditorPopover = /*#__PURE__*/function (_React$Component) {
|
|
|
84
70
|
onClear: _this.onClear
|
|
85
71
|
});
|
|
86
72
|
};
|
|
87
|
-
|
|
88
73
|
_this.state = {
|
|
89
74
|
open: true,
|
|
90
75
|
datePickerValue: props.value ? dayjs(props.value) : null
|
|
91
76
|
};
|
|
92
77
|
_this.calendarContainerRef = React.createRef();
|
|
93
78
|
return _this;
|
|
94
|
-
}
|
|
95
|
-
|
|
96
|
-
|
|
79
|
+
}
|
|
97
80
|
_createClass(PCDateEditorPopover, [{
|
|
98
81
|
key: "render",
|
|
99
82
|
value: function render() {
|
|
100
83
|
var _this2 = this;
|
|
101
|
-
|
|
102
84
|
var dateFormat = this.props.dateFormat;
|
|
103
85
|
var _this$state = this.state,
|
|
104
|
-
|
|
105
|
-
|
|
86
|
+
open = _this$state.open,
|
|
87
|
+
datePickerValue = _this$state.datePickerValue;
|
|
106
88
|
var calendar = this.getCalender();
|
|
107
89
|
return /*#__PURE__*/React.createElement(DatePicker, {
|
|
108
90
|
open: open,
|
|
@@ -135,8 +117,6 @@ var PCDateEditorPopover = /*#__PURE__*/function (_React$Component) {
|
|
|
135
117
|
});
|
|
136
118
|
}
|
|
137
119
|
}]);
|
|
138
|
-
|
|
139
120
|
return PCDateEditorPopover;
|
|
140
121
|
}(React.Component);
|
|
141
|
-
|
|
142
122
|
export default PCDateEditorPopover;
|
|
@@ -6,40 +6,31 @@ import React from 'react';
|
|
|
6
6
|
import classnames from 'classnames';
|
|
7
7
|
import { getDateDisplayString } from 'dtable-utils';
|
|
8
8
|
import './index.css';
|
|
9
|
-
|
|
10
9
|
var DateFormatter = /*#__PURE__*/function (_React$Component) {
|
|
11
10
|
_inherits(DateFormatter, _React$Component);
|
|
12
|
-
|
|
13
11
|
var _super = _createSuper(DateFormatter);
|
|
14
|
-
|
|
15
12
|
function DateFormatter() {
|
|
16
13
|
_classCallCheck(this, DateFormatter);
|
|
17
|
-
|
|
18
14
|
return _super.apply(this, arguments);
|
|
19
15
|
}
|
|
20
|
-
|
|
21
16
|
_createClass(DateFormatter, [{
|
|
22
17
|
key: "render",
|
|
23
18
|
value: function render() {
|
|
24
19
|
var _this$props = this.props,
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
20
|
+
date = _this$props.value,
|
|
21
|
+
format = _this$props.format,
|
|
22
|
+
containerClassName = _this$props.containerClassName;
|
|
28
23
|
var classname = classnames('dtable-ui cell-formatter-container date-formatter', containerClassName);
|
|
29
|
-
|
|
30
24
|
if (date !== '') {
|
|
31
25
|
date = getDateDisplayString(date, format);
|
|
32
26
|
}
|
|
33
|
-
|
|
34
27
|
return /*#__PURE__*/React.createElement("div", {
|
|
35
28
|
className: classname
|
|
36
29
|
}, date);
|
|
37
30
|
}
|
|
38
31
|
}]);
|
|
39
|
-
|
|
40
32
|
return DateFormatter;
|
|
41
33
|
}(React.Component);
|
|
42
|
-
|
|
43
34
|
DateFormatter.defaultProps = {
|
|
44
35
|
value: '',
|
|
45
36
|
format: 'YYYY-MM-DD',
|