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
|
@@ -8,28 +8,20 @@ import { getLocale } from '../lang';
|
|
|
8
8
|
import EditEditorButton from '../EditEditorButton';
|
|
9
9
|
import { SelectEditorOption, PCSelectEditorPopover, MBSelectEditorPopover } from '../select-editor';
|
|
10
10
|
import './index.css';
|
|
11
|
-
|
|
12
11
|
var MultipleSelectEditor = /*#__PURE__*/function (_React$Component) {
|
|
13
12
|
_inherits(MultipleSelectEditor, _React$Component);
|
|
14
|
-
|
|
15
13
|
var _super = _createSuper(MultipleSelectEditor);
|
|
16
|
-
|
|
17
14
|
function MultipleSelectEditor(props) {
|
|
18
15
|
var _this;
|
|
19
|
-
|
|
20
16
|
_classCallCheck(this, MultipleSelectEditor);
|
|
21
|
-
|
|
22
17
|
_this = _super.call(this, props);
|
|
23
|
-
|
|
24
18
|
_this.onDocumentToggle = function (e) {
|
|
25
19
|
if (_this.editorContainer !== e.target && !_this.editorContainer.contains(e.target)) {
|
|
26
20
|
_this.onClosePopover();
|
|
27
21
|
}
|
|
28
22
|
};
|
|
29
|
-
|
|
30
23
|
_this.getFormattedOptions = function () {
|
|
31
24
|
var newValue = _this.state.newValue;
|
|
32
|
-
|
|
33
25
|
if (Array.isArray(newValue) && newValue.length > 0) {
|
|
34
26
|
return newValue.map(function (option_id) {
|
|
35
27
|
return _this.options.find(function (option) {
|
|
@@ -39,23 +31,17 @@ var MultipleSelectEditor = /*#__PURE__*/function (_React$Component) {
|
|
|
39
31
|
return !!option;
|
|
40
32
|
});
|
|
41
33
|
}
|
|
42
|
-
|
|
43
34
|
return [];
|
|
44
35
|
};
|
|
45
|
-
|
|
46
36
|
_this.onAddOptionToggle = function (event) {
|
|
47
37
|
event.nativeEvent.stopImmediatePropagation();
|
|
48
38
|
event.stopPropagation();
|
|
49
|
-
|
|
50
39
|
if (_this.props.isReadOnly) {
|
|
51
40
|
return;
|
|
52
41
|
}
|
|
53
|
-
|
|
54
42
|
var isPopoverShow = !_this.state.isPopoverShow;
|
|
55
|
-
|
|
56
43
|
if (isPopoverShow) {
|
|
57
44
|
var popoverPosition = _this.caculatePopoverPosition();
|
|
58
|
-
|
|
59
45
|
_this.setState({
|
|
60
46
|
isPopoverShow: isPopoverShow,
|
|
61
47
|
popoverPosition: popoverPosition
|
|
@@ -66,70 +52,55 @@ var MultipleSelectEditor = /*#__PURE__*/function (_React$Component) {
|
|
|
66
52
|
});
|
|
67
53
|
}
|
|
68
54
|
};
|
|
69
|
-
|
|
70
55
|
_this.onCommit = function (newValue) {
|
|
71
56
|
var updated = {};
|
|
72
57
|
var column = _this.props.column;
|
|
73
58
|
updated[column.key] = newValue;
|
|
74
|
-
|
|
75
59
|
_this.props.onCommit(updated);
|
|
76
60
|
};
|
|
77
|
-
|
|
78
61
|
_this.onOptionItemToggle = function (option) {
|
|
79
62
|
var newValue = _this.state.newValue.slice();
|
|
80
|
-
|
|
81
63
|
var optionIndex = newValue.findIndex(function (option_id) {
|
|
82
64
|
return option_id === option.id;
|
|
83
65
|
});
|
|
84
|
-
|
|
85
66
|
if (optionIndex !== -1) {
|
|
86
67
|
newValue.splice(optionIndex, 1);
|
|
87
68
|
} else {
|
|
88
69
|
newValue.push(option.id);
|
|
89
70
|
}
|
|
90
|
-
|
|
91
71
|
_this.setState({
|
|
92
72
|
newValue: newValue
|
|
93
73
|
}, function () {
|
|
94
74
|
_this.onCommit(newValue);
|
|
95
75
|
});
|
|
96
76
|
};
|
|
97
|
-
|
|
98
77
|
_this.onDeleteOption = function (option) {
|
|
99
78
|
var newValue = _this.state.newValue.slice();
|
|
100
|
-
|
|
101
79
|
var optionIndex = newValue.findIndex(function (option_id) {
|
|
102
80
|
return option_id === option.id;
|
|
103
81
|
});
|
|
104
82
|
newValue.splice(optionIndex, 1);
|
|
105
|
-
|
|
106
83
|
_this.setState({
|
|
107
84
|
newValue: newValue
|
|
108
85
|
}, function () {
|
|
109
86
|
_this.onCommit(newValue);
|
|
110
87
|
});
|
|
111
88
|
};
|
|
112
|
-
|
|
113
89
|
_this.onAddNewOption = function (optionName) {
|
|
114
90
|
_this.props.onAddNewOption(optionName);
|
|
115
|
-
|
|
116
91
|
_this.onClosePopover();
|
|
117
92
|
};
|
|
118
|
-
|
|
119
93
|
_this.caculatePopoverPosition = function () {
|
|
120
94
|
var POPOVER_MAX_HEIGHT = 200;
|
|
121
95
|
var innerHeight = window.innerHeight;
|
|
122
|
-
|
|
123
96
|
var _this$editor$getClien = _this.editor.getClientRects()[0],
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
97
|
+
top = _this$editor$getClien.top,
|
|
98
|
+
height = _this$editor$getClien.height;
|
|
127
99
|
var isBelow = innerHeight - (top + height) > POPOVER_MAX_HEIGHT;
|
|
128
100
|
var position = {
|
|
129
101
|
top: height + 1,
|
|
130
102
|
left: 0
|
|
131
103
|
};
|
|
132
|
-
|
|
133
104
|
if (!isBelow) {
|
|
134
105
|
var bottom = height + 1;
|
|
135
106
|
position = {
|
|
@@ -137,24 +108,19 @@ var MultipleSelectEditor = /*#__PURE__*/function (_React$Component) {
|
|
|
137
108
|
left: 0
|
|
138
109
|
};
|
|
139
110
|
}
|
|
140
|
-
|
|
141
111
|
return position;
|
|
142
112
|
};
|
|
143
|
-
|
|
144
113
|
_this.onClosePopover = function () {
|
|
145
114
|
_this.setState({
|
|
146
115
|
isPopoverShow: false
|
|
147
116
|
});
|
|
148
117
|
};
|
|
149
|
-
|
|
150
118
|
_this.setEditorContainerRef = function (editorContainer) {
|
|
151
119
|
_this.editorContainer = editorContainer;
|
|
152
120
|
};
|
|
153
|
-
|
|
154
121
|
_this.setEditorRef = function (editor) {
|
|
155
122
|
_this.editor = editor;
|
|
156
123
|
};
|
|
157
|
-
|
|
158
124
|
_this.state = {
|
|
159
125
|
newValue: Array.isArray(props.value) ? props.value : [],
|
|
160
126
|
isPopoverShow: false,
|
|
@@ -164,7 +130,6 @@ var MultipleSelectEditor = /*#__PURE__*/function (_React$Component) {
|
|
|
164
130
|
_this.options = _column.data && (_column.data.options || []);
|
|
165
131
|
return _this;
|
|
166
132
|
}
|
|
167
|
-
|
|
168
133
|
_createClass(MultipleSelectEditor, [{
|
|
169
134
|
key: "componentDidMount",
|
|
170
135
|
value: function componentDidMount() {
|
|
@@ -179,10 +144,9 @@ var MultipleSelectEditor = /*#__PURE__*/function (_React$Component) {
|
|
|
179
144
|
key: "render",
|
|
180
145
|
value: function render() {
|
|
181
146
|
var _this2 = this;
|
|
182
|
-
|
|
183
147
|
var _this$state = this.state,
|
|
184
|
-
|
|
185
|
-
|
|
148
|
+
isPopoverShow = _this$state.isPopoverShow,
|
|
149
|
+
popoverPosition = _this$state.popoverPosition;
|
|
186
150
|
var options = this.options;
|
|
187
151
|
var selectedOptions = this.getFormattedOptions();
|
|
188
152
|
return /*#__PURE__*/React.createElement("div", {
|
|
@@ -225,10 +189,8 @@ var MultipleSelectEditor = /*#__PURE__*/function (_React$Component) {
|
|
|
225
189
|
}))));
|
|
226
190
|
}
|
|
227
191
|
}]);
|
|
228
|
-
|
|
229
192
|
return MultipleSelectEditor;
|
|
230
193
|
}(React.Component);
|
|
231
|
-
|
|
232
194
|
MultipleSelectEditor.defaultProps = {
|
|
233
195
|
isReadOnly: false,
|
|
234
196
|
value: []
|
|
@@ -6,27 +6,20 @@ import React from 'react';
|
|
|
6
6
|
import classnames from 'classnames';
|
|
7
7
|
import SelectItem from '../SelectItem';
|
|
8
8
|
import './index.css';
|
|
9
|
-
|
|
10
9
|
var MultipleSelectFormatter = /*#__PURE__*/function (_React$PureComponent) {
|
|
11
10
|
_inherits(MultipleSelectFormatter, _React$PureComponent);
|
|
12
|
-
|
|
13
11
|
var _super = _createSuper(MultipleSelectFormatter);
|
|
14
|
-
|
|
15
12
|
function MultipleSelectFormatter() {
|
|
16
13
|
var _this;
|
|
17
|
-
|
|
18
14
|
_classCallCheck(this, MultipleSelectFormatter);
|
|
19
|
-
|
|
20
15
|
for (var _len = arguments.length, args = new Array(_len), _key = 0; _key < _len; _key++) {
|
|
21
16
|
args[_key] = arguments[_key];
|
|
22
17
|
}
|
|
23
|
-
|
|
24
18
|
_this = _super.call.apply(_super, [this].concat(args));
|
|
25
|
-
|
|
26
19
|
_this.getOptions = function () {
|
|
27
20
|
var _this$props = _this.props,
|
|
28
|
-
|
|
29
|
-
|
|
21
|
+
value = _this$props.value,
|
|
22
|
+
options = _this$props.options;
|
|
30
23
|
if (!Array.isArray(value) || !Array.isArray(options)) return [];
|
|
31
24
|
var selectedOptions = options.filter(function (option) {
|
|
32
25
|
return value.includes(option.id) || value.includes(option.name);
|
|
@@ -39,34 +32,28 @@ var MultipleSelectFormatter = /*#__PURE__*/function (_React$PureComponent) {
|
|
|
39
32
|
});
|
|
40
33
|
});
|
|
41
34
|
};
|
|
42
|
-
|
|
43
35
|
return _this;
|
|
44
36
|
}
|
|
45
|
-
|
|
46
37
|
_createClass(MultipleSelectFormatter, [{
|
|
47
38
|
key: "render",
|
|
48
39
|
value: function render() {
|
|
49
40
|
var _this$props2 = this.props,
|
|
50
|
-
|
|
51
|
-
|
|
41
|
+
value = _this$props2.value,
|
|
42
|
+
containerClassName = _this$props2.containerClassName;
|
|
52
43
|
var classname = classnames('dtable-ui cell-formatter-container multiple-select-formatter', containerClassName);
|
|
53
|
-
|
|
54
44
|
if (!value || Array.isArray(value) && value.length === 0) {
|
|
55
45
|
return /*#__PURE__*/React.createElement("div", {
|
|
56
46
|
className: classname
|
|
57
47
|
});
|
|
58
48
|
}
|
|
59
|
-
|
|
60
49
|
var options = this.getOptions();
|
|
61
50
|
return /*#__PURE__*/React.createElement("div", {
|
|
62
51
|
className: classname
|
|
63
52
|
}, options);
|
|
64
53
|
}
|
|
65
54
|
}]);
|
|
66
|
-
|
|
67
55
|
return MultipleSelectFormatter;
|
|
68
56
|
}(React.PureComponent);
|
|
69
|
-
|
|
70
57
|
MultipleSelectFormatter.defaultProps = {
|
|
71
58
|
options: []
|
|
72
59
|
};
|
|
@@ -5,56 +5,40 @@ import _createSuper from "@babel/runtime/helpers/esm/createSuper";
|
|
|
5
5
|
import React from 'react';
|
|
6
6
|
import { Popover } from 'reactstrap';
|
|
7
7
|
import './index.css';
|
|
8
|
-
|
|
9
8
|
var NotificationPopover = /*#__PURE__*/function (_React$Component) {
|
|
10
9
|
_inherits(NotificationPopover, _React$Component);
|
|
11
|
-
|
|
12
10
|
var _super = _createSuper(NotificationPopover);
|
|
13
|
-
|
|
14
11
|
function NotificationPopover() {
|
|
15
12
|
var _this;
|
|
16
|
-
|
|
17
13
|
_classCallCheck(this, NotificationPopover);
|
|
18
|
-
|
|
19
14
|
for (var _len = arguments.length, args = new Array(_len), _key = 0; _key < _len; _key++) {
|
|
20
15
|
args[_key] = arguments[_key];
|
|
21
16
|
}
|
|
22
|
-
|
|
23
17
|
_this = _super.call.apply(_super, [this].concat(args));
|
|
24
|
-
|
|
25
18
|
_this.handleOutsideClick = function (e) {
|
|
26
19
|
if (!_this.notificationContainerRef.contains(e.target)) {
|
|
27
20
|
document.removeEventListener('mousedown', _this.handleOutsideClick);
|
|
28
|
-
|
|
29
21
|
if (e.target.className === 'tool notification' || e.target.parentNode.className === 'tool notification') {
|
|
30
22
|
return;
|
|
31
23
|
}
|
|
32
|
-
|
|
33
24
|
_this.props.onNotificationListToggle();
|
|
34
25
|
}
|
|
35
26
|
};
|
|
36
|
-
|
|
37
27
|
_this.onNotificationDialogToggle = function () {
|
|
38
28
|
_this.props.onNotificationDialogToggle();
|
|
39
|
-
|
|
40
29
|
_this.props.onNotificationListToggle();
|
|
41
30
|
};
|
|
42
|
-
|
|
43
31
|
_this.onWeixinQRCodeDialogToggle = function () {
|
|
44
32
|
_this.props.onOpenWeixinQRCodeDialog();
|
|
45
|
-
|
|
46
33
|
_this.props.onNotificationListToggle();
|
|
47
34
|
};
|
|
48
|
-
|
|
49
35
|
_this.onHandleScroll = function () {
|
|
50
36
|
if (_this.notificationListRef.offsetHeight + _this.notificationListRef.scrollTop + 1 >= _this.notificationsWrapperRef.offsetHeight) {
|
|
51
37
|
_this.props.listNotifications && _this.props.listNotifications();
|
|
52
38
|
}
|
|
53
39
|
};
|
|
54
|
-
|
|
55
40
|
return _this;
|
|
56
41
|
}
|
|
57
|
-
|
|
58
42
|
_createClass(NotificationPopover, [{
|
|
59
43
|
key: "componentDidMount",
|
|
60
44
|
value: function componentDidMount() {
|
|
@@ -69,11 +53,10 @@ var NotificationPopover = /*#__PURE__*/function (_React$Component) {
|
|
|
69
53
|
key: "render",
|
|
70
54
|
value: function render() {
|
|
71
55
|
var _this2 = this;
|
|
72
|
-
|
|
73
56
|
var _this$props = this.props,
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
57
|
+
headerText = _this$props.headerText,
|
|
58
|
+
bodyText = _this$props.bodyText,
|
|
59
|
+
footerText = _this$props.footerText;
|
|
77
60
|
return /*#__PURE__*/React.createElement(Popover, {
|
|
78
61
|
className: "notification-wrapper",
|
|
79
62
|
target: "notification-popover",
|
|
@@ -119,10 +102,8 @@ var NotificationPopover = /*#__PURE__*/function (_React$Component) {
|
|
|
119
102
|
}, footerText))));
|
|
120
103
|
}
|
|
121
104
|
}]);
|
|
122
|
-
|
|
123
105
|
return NotificationPopover;
|
|
124
106
|
}(React.Component);
|
|
125
|
-
|
|
126
107
|
NotificationPopover.defaultProps = {
|
|
127
108
|
headerText: '',
|
|
128
109
|
bodyText: '',
|
|
@@ -7,24 +7,17 @@ import isHotkey from 'is-hotkey';
|
|
|
7
7
|
import { getNumberDisplayString, formatStringToNumber, replaceNumberNotAllowInput } from 'dtable-utils';
|
|
8
8
|
import { NUMBER_TYPES } from '../constants';
|
|
9
9
|
import { isMac } from '../utils/utils';
|
|
10
|
-
|
|
11
10
|
var NumberEditor = /*#__PURE__*/function (_React$Component) {
|
|
12
11
|
_inherits(NumberEditor, _React$Component);
|
|
13
|
-
|
|
14
12
|
var _super = _createSuper(NumberEditor);
|
|
15
|
-
|
|
16
13
|
function NumberEditor(props) {
|
|
17
14
|
var _this;
|
|
18
|
-
|
|
19
15
|
_classCallCheck(this, NumberEditor);
|
|
20
|
-
|
|
21
16
|
_this = _super.call(this, props);
|
|
22
|
-
|
|
23
17
|
_this.onEditorHandle = function () {
|
|
24
18
|
if (_this.props.isReadOnly) {
|
|
25
19
|
return;
|
|
26
20
|
}
|
|
27
|
-
|
|
28
21
|
_this.setState({
|
|
29
22
|
isEditorShow: true,
|
|
30
23
|
inputValue: _this.state.textValue
|
|
@@ -32,87 +25,69 @@ var NumberEditor = /*#__PURE__*/function (_React$Component) {
|
|
|
32
25
|
_this.input.focus();
|
|
33
26
|
});
|
|
34
27
|
};
|
|
35
|
-
|
|
36
28
|
_this.onCommit = function () {
|
|
37
29
|
var updated = {};
|
|
38
30
|
var column = _this.props.column;
|
|
39
31
|
var inputValue = _this.state.inputValue ? _this.state.inputValue.toString() : '';
|
|
40
32
|
var value = inputValue ? formatStringToNumber(inputValue) : ''; // format the number to submit
|
|
41
|
-
|
|
42
33
|
updated[column.key] = value;
|
|
43
|
-
|
|
44
34
|
_this.props.onCommit(updated);
|
|
45
|
-
|
|
46
35
|
var newValue = getNumberDisplayString(value, column.data); // format the number to display
|
|
47
|
-
|
|
48
36
|
_this.setState({
|
|
49
37
|
isEditorShow: false,
|
|
50
38
|
textValue: newValue
|
|
51
39
|
});
|
|
52
40
|
};
|
|
53
|
-
|
|
54
41
|
_this.onChange = function (event) {
|
|
55
42
|
var data = _this.props.column.data; // data maybe 'null'
|
|
56
|
-
|
|
57
43
|
var value = event.target.value.trim();
|
|
58
44
|
var currency_symbol = null;
|
|
59
|
-
|
|
60
45
|
if (data && data.format === 'custom_currency') {
|
|
61
46
|
currency_symbol = data['currency_symbol'];
|
|
62
|
-
}
|
|
63
|
-
|
|
47
|
+
}
|
|
64
48
|
|
|
49
|
+
//Prevent the repetition of periods bug in the Chinese input method of the Windows system
|
|
65
50
|
if (!isMac() && value.indexOf('.。') > -1) return;
|
|
66
51
|
value = replaceNumberNotAllowInput(value, _this.dataFormat, currency_symbol);
|
|
67
52
|
if (value === _this.state.inputValue) return;
|
|
68
|
-
|
|
69
53
|
_this.setState({
|
|
70
54
|
inputValue: value
|
|
71
55
|
});
|
|
72
56
|
};
|
|
73
|
-
|
|
74
57
|
_this.onBlur = function () {
|
|
75
58
|
_this.onCommit();
|
|
76
59
|
};
|
|
77
|
-
|
|
78
60
|
_this.onKeyDown = function (event) {
|
|
79
61
|
var _event$currentTarget = event.currentTarget,
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
62
|
+
selectionStart = _event$currentTarget.selectionStart,
|
|
63
|
+
selectionEnd = _event$currentTarget.selectionEnd,
|
|
64
|
+
value = _event$currentTarget.value;
|
|
84
65
|
if (isHotkey('enter', event)) {
|
|
85
66
|
event.preventDefault();
|
|
86
|
-
|
|
87
67
|
_this.onBlur();
|
|
88
68
|
} else if (event.keyCode === 37 && selectionStart === 0 || event.keyCode === 39 && selectionEnd === value.length) {
|
|
89
69
|
event.stopPropagation();
|
|
90
70
|
}
|
|
91
71
|
};
|
|
92
|
-
|
|
93
72
|
_this.onPaste = function (e) {
|
|
94
73
|
e.stopPropagation();
|
|
95
74
|
};
|
|
96
|
-
|
|
97
75
|
_this.onCut = function (e) {
|
|
98
76
|
e.stopPropagation();
|
|
99
77
|
};
|
|
100
|
-
|
|
101
78
|
_this.getStyle = function () {
|
|
102
79
|
return {
|
|
103
80
|
width: '320px',
|
|
104
81
|
textAlign: 'left'
|
|
105
82
|
};
|
|
106
83
|
};
|
|
107
|
-
|
|
108
84
|
_this.setInputRef = function (input) {
|
|
109
85
|
_this.input = input;
|
|
110
86
|
return _this.input;
|
|
111
87
|
};
|
|
112
|
-
|
|
113
88
|
var _this$props = _this.props,
|
|
114
|
-
|
|
115
|
-
|
|
89
|
+
_value = _this$props.value,
|
|
90
|
+
_column = _this$props.column;
|
|
116
91
|
var dataFormat = _column.data && _column.data.format;
|
|
117
92
|
_this.dataFormat = dataFormat || NUMBER_TYPES.NUMBER;
|
|
118
93
|
var initValue = getNumberDisplayString(_value, _column.data); // format the number to display
|
|
@@ -124,7 +99,6 @@ var NumberEditor = /*#__PURE__*/function (_React$Component) {
|
|
|
124
99
|
};
|
|
125
100
|
return _this;
|
|
126
101
|
}
|
|
127
|
-
|
|
128
102
|
_createClass(NumberEditor, [{
|
|
129
103
|
key: "render",
|
|
130
104
|
value: function render() {
|
|
@@ -151,10 +125,8 @@ var NumberEditor = /*#__PURE__*/function (_React$Component) {
|
|
|
151
125
|
})));
|
|
152
126
|
}
|
|
153
127
|
}]);
|
|
154
|
-
|
|
155
128
|
return NumberEditor;
|
|
156
129
|
}(React.Component);
|
|
157
|
-
|
|
158
130
|
NumberEditor.defaultProps = {
|
|
159
131
|
isReadOnly: false,
|
|
160
132
|
value: ''
|
|
@@ -6,40 +6,31 @@ import React from 'react';
|
|
|
6
6
|
import classnames from 'classnames';
|
|
7
7
|
import { getNumberDisplayString } from 'dtable-utils';
|
|
8
8
|
import './index.css';
|
|
9
|
-
|
|
10
9
|
var NumberFormatter = /*#__PURE__*/function (_React$Component) {
|
|
11
10
|
_inherits(NumberFormatter, _React$Component);
|
|
12
|
-
|
|
13
11
|
var _super = _createSuper(NumberFormatter);
|
|
14
|
-
|
|
15
12
|
function NumberFormatter() {
|
|
16
13
|
_classCallCheck(this, NumberFormatter);
|
|
17
|
-
|
|
18
14
|
return _super.apply(this, arguments);
|
|
19
15
|
}
|
|
20
|
-
|
|
21
16
|
_createClass(NumberFormatter, [{
|
|
22
17
|
key: "render",
|
|
23
18
|
value: function render() {
|
|
24
19
|
var _this$props = this.props,
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
20
|
+
number = _this$props.value,
|
|
21
|
+
data = _this$props.data,
|
|
22
|
+
containerClassName = _this$props.containerClassName;
|
|
28
23
|
var classname = classnames('dtable-ui cell-formatter-container number-formatter', containerClassName);
|
|
29
|
-
|
|
30
24
|
if (number || number === 0) {
|
|
31
25
|
number = getNumberDisplayString(number, data);
|
|
32
26
|
}
|
|
33
|
-
|
|
34
27
|
return /*#__PURE__*/React.createElement("div", {
|
|
35
28
|
className: classname
|
|
36
29
|
}, number);
|
|
37
30
|
}
|
|
38
31
|
}]);
|
|
39
|
-
|
|
40
32
|
return NumberFormatter;
|
|
41
33
|
}(React.Component);
|
|
42
|
-
|
|
43
34
|
NumberFormatter.defaultProps = {
|
|
44
35
|
value: '',
|
|
45
36
|
containerClassName: ''
|
|
@@ -5,39 +5,29 @@ import _createSuper from "@babel/runtime/helpers/esm/createSuper";
|
|
|
5
5
|
import React from 'react';
|
|
6
6
|
import classnames from 'classnames';
|
|
7
7
|
import './index.css';
|
|
8
|
-
|
|
9
8
|
var RateFormatter = /*#__PURE__*/function (_React$Component) {
|
|
10
9
|
_inherits(RateFormatter, _React$Component);
|
|
11
|
-
|
|
12
10
|
var _super = _createSuper(RateFormatter);
|
|
13
|
-
|
|
14
11
|
function RateFormatter() {
|
|
15
12
|
var _this;
|
|
16
|
-
|
|
17
13
|
_classCallCheck(this, RateFormatter);
|
|
18
|
-
|
|
19
14
|
for (var _len = arguments.length, args = new Array(_len), _key = 0; _key < _len; _key++) {
|
|
20
15
|
args[_key] = arguments[_key];
|
|
21
16
|
}
|
|
22
|
-
|
|
23
17
|
_this = _super.call.apply(_super, [this].concat(args));
|
|
24
|
-
|
|
25
18
|
_this.getRateList = function () {
|
|
26
19
|
var _this$props = _this.props,
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
20
|
+
data = _this$props.data,
|
|
21
|
+
value = _this$props.value;
|
|
30
22
|
var _ref = data || {},
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
23
|
+
_ref$rate_max_number = _ref.rate_max_number,
|
|
24
|
+
rate_max_number = _ref$rate_max_number === void 0 ? 5 : _ref$rate_max_number,
|
|
25
|
+
_ref$rate_style_color = _ref.rate_style_color,
|
|
26
|
+
rate_style_color = _ref$rate_style_color === void 0 ? '#e5e5e5' : _ref$rate_style_color,
|
|
27
|
+
_ref$rate_style_type = _ref.rate_style_type,
|
|
28
|
+
rate_style_type = _ref$rate_style_type === void 0 ? 'dtable-icon-rate' : _ref$rate_style_type;
|
|
38
29
|
var validValue = Math.min(rate_max_number, value);
|
|
39
30
|
var rateList = [];
|
|
40
|
-
|
|
41
31
|
for (var i = 0; i < validValue; i++) {
|
|
42
32
|
rateList.push( /*#__PURE__*/React.createElement("i", {
|
|
43
33
|
key: "dtable-ui-component-rate-".concat(i),
|
|
@@ -47,19 +37,16 @@ var RateFormatter = /*#__PURE__*/function (_React$Component) {
|
|
|
47
37
|
}
|
|
48
38
|
}));
|
|
49
39
|
}
|
|
50
|
-
|
|
51
40
|
return rateList;
|
|
52
41
|
};
|
|
53
|
-
|
|
54
42
|
return _this;
|
|
55
43
|
}
|
|
56
|
-
|
|
57
44
|
_createClass(RateFormatter, [{
|
|
58
45
|
key: "render",
|
|
59
46
|
value: function render() {
|
|
60
47
|
var _this$props2 = this.props,
|
|
61
|
-
|
|
62
|
-
|
|
48
|
+
number = _this$props2.value,
|
|
49
|
+
containerClassName = _this$props2.containerClassName;
|
|
63
50
|
var className = classnames('dtable-ui cell-formatter-container rate-formatter', containerClassName);
|
|
64
51
|
if (!number) return null;
|
|
65
52
|
var rateList = this.getRateList();
|
|
@@ -68,10 +55,8 @@ var RateFormatter = /*#__PURE__*/function (_React$Component) {
|
|
|
68
55
|
}, rateList);
|
|
69
56
|
}
|
|
70
57
|
}]);
|
|
71
|
-
|
|
72
58
|
return RateFormatter;
|
|
73
59
|
}(React.Component);
|
|
74
|
-
|
|
75
60
|
RateFormatter.defaultProps = {
|
|
76
61
|
value: '',
|
|
77
62
|
containerClassName: ''
|
|
@@ -6,38 +6,29 @@ import React from 'react';
|
|
|
6
6
|
import classnames from 'classnames';
|
|
7
7
|
import { getTrimmedString } from '../utils/editor-utils';
|
|
8
8
|
import './index.css';
|
|
9
|
-
|
|
10
9
|
var RowExpandEmailFormatter = /*#__PURE__*/function (_React$Component) {
|
|
11
10
|
_inherits(RowExpandEmailFormatter, _React$Component);
|
|
12
|
-
|
|
13
11
|
var _super = _createSuper(RowExpandEmailFormatter);
|
|
14
|
-
|
|
15
12
|
function RowExpandEmailFormatter() {
|
|
16
13
|
var _this;
|
|
17
|
-
|
|
18
14
|
_classCallCheck(this, RowExpandEmailFormatter);
|
|
19
|
-
|
|
20
15
|
for (var _len = arguments.length, args = new Array(_len), _key = 0; _key < _len; _key++) {
|
|
21
16
|
args[_key] = arguments[_key];
|
|
22
17
|
}
|
|
23
|
-
|
|
24
18
|
_this = _super.call.apply(_super, [this].concat(args));
|
|
25
|
-
|
|
26
19
|
_this.onOpenEmailLink = function () {
|
|
27
20
|
var value = _this.props.value;
|
|
28
21
|
var newValue = value.trim();
|
|
29
22
|
window.location.href = "mailto:".concat(newValue);
|
|
30
23
|
};
|
|
31
|
-
|
|
32
24
|
return _this;
|
|
33
25
|
}
|
|
34
|
-
|
|
35
26
|
_createClass(RowExpandEmailFormatter, [{
|
|
36
27
|
key: "render",
|
|
37
28
|
value: function render() {
|
|
38
29
|
var _this$props = this.props,
|
|
39
|
-
|
|
40
|
-
|
|
30
|
+
containerClassName = _this$props.containerClassName,
|
|
31
|
+
value = _this$props.value;
|
|
41
32
|
var classname = classnames('dtable-ui cell-formatter-container email-formatter', containerClassName);
|
|
42
33
|
return /*#__PURE__*/React.createElement("div", {
|
|
43
34
|
className: classname
|
|
@@ -49,8 +40,6 @@ var RowExpandEmailFormatter = /*#__PURE__*/function (_React$Component) {
|
|
|
49
40
|
}));
|
|
50
41
|
}
|
|
51
42
|
}]);
|
|
52
|
-
|
|
53
43
|
return RowExpandEmailFormatter;
|
|
54
44
|
}(React.Component);
|
|
55
|
-
|
|
56
45
|
export default RowExpandEmailFormatter;
|
|
@@ -6,33 +6,26 @@ import React from 'react';
|
|
|
6
6
|
import classname from 'classnames';
|
|
7
7
|
import RowExpandFileItemFormatter from './row-expand-file-item-formatter';
|
|
8
8
|
import './index.css';
|
|
9
|
-
|
|
10
9
|
var RowExpandFileFormatter = /*#__PURE__*/function (_React$PureComponent) {
|
|
11
10
|
_inherits(RowExpandFileFormatter, _React$PureComponent);
|
|
12
|
-
|
|
13
11
|
var _super = _createSuper(RowExpandFileFormatter);
|
|
14
|
-
|
|
15
12
|
function RowExpandFileFormatter() {
|
|
16
13
|
_classCallCheck(this, RowExpandFileFormatter);
|
|
17
|
-
|
|
18
14
|
return _super.apply(this, arguments);
|
|
19
15
|
}
|
|
20
|
-
|
|
21
16
|
_createClass(RowExpandFileFormatter, [{
|
|
22
17
|
key: "render",
|
|
23
18
|
value: function render() {
|
|
24
19
|
var _this$props = this.props,
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
20
|
+
value = _this$props.value,
|
|
21
|
+
containerClassName = _this$props.containerClassName,
|
|
22
|
+
column = _this$props.column,
|
|
23
|
+
downloadFile = _this$props.downloadFile,
|
|
24
|
+
deleteFile = _this$props.deleteFile,
|
|
25
|
+
readOnly = _this$props.readOnly;
|
|
32
26
|
if (!Array.isArray(value) || value.length === 0) {
|
|
33
27
|
return null;
|
|
34
28
|
}
|
|
35
|
-
|
|
36
29
|
return /*#__PURE__*/React.createElement("div", {
|
|
37
30
|
className: classname('dtable-ui cell-formatter-container row-expand-file-formatter', containerClassName)
|
|
38
31
|
}, value.map(function (item, index) {
|
|
@@ -48,10 +41,8 @@ var RowExpandFileFormatter = /*#__PURE__*/function (_React$PureComponent) {
|
|
|
48
41
|
}));
|
|
49
42
|
}
|
|
50
43
|
}]);
|
|
51
|
-
|
|
52
44
|
return RowExpandFileFormatter;
|
|
53
45
|
}(React.PureComponent);
|
|
54
|
-
|
|
55
46
|
RowExpandFileFormatter.defaultProps = {
|
|
56
47
|
value: [],
|
|
57
48
|
containerClassName: ''
|