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.
- package/lib/AutoNumberFormatter/index.js +11 -24
- package/lib/ButtonFormatter/index.js +29 -45
- package/lib/CTimeFormatter/index.js +17 -32
- package/lib/CheckboxEditor/index.js +42 -49
- package/lib/CheckboxFormatter/index.js +17 -30
- package/lib/CollaboratorEditor/index.js +118 -135
- package/lib/CollaboratorEditor/mb-collaborator-editor-popover/index.js +90 -99
- package/lib/CollaboratorEditor/pc-collaborator-editor-popover/index.js +61 -69
- package/lib/CollaboratorFormatter/index.js +26 -42
- package/lib/CollaboratorItem/index.js +31 -44
- package/lib/CreatorFormatter/index.js +24 -40
- package/lib/DTableCustomizeCollaboratorSelect/index.js +80 -99
- package/lib/DTableCustomizeCollaboratorSelect/utils.js +12 -13
- package/lib/DTableCustomizeSelect/index.css +22 -59
- package/lib/DTableCustomizeSelect/index.js +99 -95
- package/lib/DTablePopover/index.js +52 -71
- package/lib/DTablePopover/utils.js +1 -1
- package/lib/DTableRadio/index.js +9 -7
- package/lib/DTableSearchInput/index.js +89 -99
- package/lib/DTableSearchInput/utils.js +2 -2
- package/lib/DTableSelect/dtable-select-label.js +5 -3
- package/lib/DTableSelect/index.js +50 -64
- package/lib/DTableSelect/utils.js +36 -41
- package/lib/DTableSwitch/index.js +7 -5
- package/lib/DateEditor/index.js +88 -94
- package/lib/DateEditor/mb-date-editor-popover/index.js +136 -134
- package/lib/DateEditor/pc-date-editor-popover.js +70 -77
- package/lib/DateFormatter/index.js +15 -28
- package/lib/DepartmentSingleSelectFormatter/index.js +9 -9
- package/lib/DigitalSignFormatter/index.js +55 -65
- package/lib/DigitalSignFormatter/utils.js +9 -8
- package/lib/DurationFormatter/index.js +14 -27
- package/lib/EditEditorButton/index.js +10 -22
- package/lib/EmailFormatter/index.js +11 -24
- package/lib/FieldDisplaySetting/field-item.js +18 -20
- package/lib/FieldDisplaySetting/index.js +41 -43
- package/lib/FileEditor/index.js +18 -29
- package/lib/FileFormatter/index.js +29 -43
- package/lib/FileItemFormatter/index.js +17 -32
- package/lib/FileItemFormatter/utils.js +5 -5
- package/lib/FileUploader/index.js +20 -33
- package/lib/FormulaFormatter/cell-value-validator.js +23 -8
- package/lib/FormulaFormatter/index.js +77 -83
- package/lib/FormulaFormatter/utils.js +27 -21
- package/lib/GeolocationFormatter/index.js +19 -32
- package/lib/HtmlLongTextFormatter/index.js +43 -52
- package/lib/HtmlLongTextFormatter/markdown2html.js +2 -2
- package/lib/HtmlLongTextFormatter/unified/index.js +1 -1
- package/lib/HtmlLongTextFormatter/vfile/core.js +10 -10
- package/lib/ImageFormatter/images-lazy-load.js +71 -79
- package/lib/ImageFormatter/index.js +86 -97
- package/lib/ImageFormatter/utils.js +1 -1
- package/lib/ImagePreviewerLightbox/index.js +20 -18
- package/lib/ImagePreviewerLightbox/utils.js +3 -3
- package/lib/LastModifierFormatter/index.js +24 -40
- package/lib/LinkEditor/index.js +163 -167
- package/lib/LinkEditor/link-editor-option.js +41 -56
- package/lib/LinkEditor/mb-link-editor-popover/index.js +90 -99
- package/lib/LinkEditor/pc-link-editor-popover/index.js +63 -71
- package/lib/LinkFormatter/index.js +75 -77
- package/lib/LongTextFormatter/index.js +5 -3
- package/lib/MBEditorHeader/index.js +25 -38
- package/lib/MTimeFormatter/index.js +17 -32
- package/lib/ModalPortal/index.js +15 -32
- package/lib/MultipleSelectEditor/index.js +118 -136
- package/lib/MultipleSelectFormatter/index.js +24 -40
- package/lib/NotificationPopover/index.js +68 -95
- package/lib/NumberEditor/index.js +75 -82
- package/lib/NumberFormatter/index.js +15 -28
- package/lib/RateFormatter/index.js +29 -45
- package/lib/RoleStatusEditor/index.js +20 -22
- package/lib/RowExpandEmailFormatter/index.js +24 -37
- package/lib/RowExpandFileFormatter/index.js +28 -42
- package/lib/RowExpandFileFormatter/row-expand-file-item-formatter.js +66 -82
- package/lib/RowExpandFormatter/index.js +92 -96
- package/lib/RowExpandFormulaFormatter/index.js +85 -91
- package/lib/RowExpandImageFormatter/index.js +65 -82
- package/lib/RowExpandImageFormatter/row-expand-image-item-formatter.js +71 -84
- package/lib/RowExpandImageFormatter/utils.js +1 -1
- package/lib/RowExpandLinkFormatter/collaborator-item-formatter.js +54 -68
- package/lib/RowExpandLinkFormatter/index.js +131 -137
- package/lib/RowExpandLinkFormatter/utils.js +23 -17
- package/lib/RowExpandLinkFormatter/value-display-utils.js +9 -7
- package/lib/RowExpandRateFormatter/index.js +27 -42
- package/lib/RowExpandUrlFormatter/index.js +27 -40
- package/lib/SelectItem/index.js +17 -33
- package/lib/SelectOptionGroup/index.css +103 -0
- package/lib/SelectOptionGroup/index.js +157 -135
- package/lib/SelectOptionGroup/option.js +31 -38
- package/lib/SimpleLongTextFormatter/index.js +55 -67
- package/lib/SimpleLongTextFormatter/normalize-long-text-value.js +23 -22
- package/lib/SimpleLongTextFormatter/widgets/LongTextPreview.js +42 -57
- package/lib/SimpleLongTextFormatter/widgets/dtable-markdown-viewer.js +31 -46
- package/lib/SingleSelectEditor/index.js +108 -119
- package/lib/SingleSelectFormatter/index.js +21 -37
- package/lib/TextEditor/index.js +45 -51
- package/lib/TextFormatter/index.js +17 -32
- package/lib/UrlFormatter/index.js +11 -24
- package/lib/cellFormatterFactory/index.js +8 -17
- package/lib/common/ClickOutside.js +28 -0
- package/lib/common/delete-tip.js +40 -65
- package/lib/common/modal-portal.js +15 -33
- package/lib/constants/index.js +5 -5
- package/lib/data/dtable-value.js +4 -4
- package/lib/formatterConfig/base-formatter-config.js +24 -3
- package/lib/formatterConfig/index.js +5 -4
- package/lib/lang/index.js +6 -6
- package/lib/locals/de.js +1 -1
- package/lib/locals/en.js +1 -1
- package/lib/locals/fr.js +1 -1
- package/lib/locals/zh-CN.js +1 -1
- package/lib/select-editor/mb-select-editor-popover/index.js +126 -137
- package/lib/select-editor/pc-select-editor-popover/index.js +75 -83
- package/lib/select-editor/select-editor-option.js +41 -56
- package/lib/toaster/alert.js +73 -88
- package/lib/toaster/index.js +1 -1
- package/lib/toaster/toast.js +75 -102
- package/lib/toaster/toastManager.js +55 -91
- package/lib/toaster/toaster.js +58 -57
- package/lib/utils/editor-utils.js +17 -19
- package/lib/utils/utils.js +14 -14
- package/package.json +4 -4
|
@@ -1,112 +1,85 @@
|
|
|
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 from 'react';
|
|
6
2
|
import { Popover } from 'reactstrap';
|
|
7
3
|
import './index.css';
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
for (var _len = arguments.length, args = new Array(_len), _key = 0; _key < _len; _key++) {
|
|
15
|
-
args[_key] = arguments[_key];
|
|
16
|
-
}
|
|
17
|
-
_this = _super.call.apply(_super, [this].concat(args));
|
|
18
|
-
_this.handleOutsideClick = function (e) {
|
|
19
|
-
if (!_this.notificationContainerRef.contains(e.target)) {
|
|
20
|
-
document.removeEventListener('mousedown', _this.handleOutsideClick);
|
|
4
|
+
export default class NotificationPopover extends React.Component {
|
|
5
|
+
constructor() {
|
|
6
|
+
super(...arguments);
|
|
7
|
+
this.handleOutsideClick = e => {
|
|
8
|
+
if (!this.notificationContainerRef.contains(e.target)) {
|
|
9
|
+
document.removeEventListener('mousedown', this.handleOutsideClick);
|
|
21
10
|
if (e.target.className === 'tool notification' || e.target.parentNode.className === 'tool notification') {
|
|
22
11
|
return;
|
|
23
12
|
}
|
|
24
|
-
|
|
13
|
+
this.props.onNotificationListToggle();
|
|
25
14
|
}
|
|
26
15
|
};
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
16
|
+
this.onNotificationDialogToggle = () => {
|
|
17
|
+
this.props.onNotificationDialogToggle();
|
|
18
|
+
this.props.onNotificationListToggle();
|
|
30
19
|
};
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
20
|
+
this.onWeixinQRCodeDialogToggle = () => {
|
|
21
|
+
this.props.onOpenWeixinQRCodeDialog();
|
|
22
|
+
this.props.onNotificationListToggle();
|
|
34
23
|
};
|
|
35
|
-
|
|
36
|
-
if (
|
|
37
|
-
|
|
24
|
+
this.onHandleScroll = () => {
|
|
25
|
+
if (this.notificationListRef.offsetHeight + this.notificationListRef.scrollTop + 1 >= this.notificationsWrapperRef.offsetHeight) {
|
|
26
|
+
this.props.listNotifications && this.props.listNotifications();
|
|
38
27
|
}
|
|
39
28
|
};
|
|
40
|
-
return _this;
|
|
41
29
|
}
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
}
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
return _this2.notificationListRef = _ref2;
|
|
94
|
-
}
|
|
95
|
-
}, /*#__PURE__*/React.createElement("div", {
|
|
96
|
-
ref: function ref(_ref) {
|
|
97
|
-
return _this2.notificationsWrapperRef = _ref;
|
|
98
|
-
}
|
|
99
|
-
}, this.props.children)), /*#__PURE__*/React.createElement("div", {
|
|
100
|
-
className: "notification-footer",
|
|
101
|
-
onClick: this.onNotificationDialogToggle
|
|
102
|
-
}, footerText))));
|
|
103
|
-
}
|
|
104
|
-
}]);
|
|
105
|
-
return NotificationPopover;
|
|
106
|
-
}(React.Component);
|
|
30
|
+
componentDidMount() {
|
|
31
|
+
document.addEventListener('mousedown', this.handleOutsideClick);
|
|
32
|
+
}
|
|
33
|
+
componentWillUnmount() {
|
|
34
|
+
document.removeEventListener('mousedown', this.handleOutsideClick);
|
|
35
|
+
}
|
|
36
|
+
render() {
|
|
37
|
+
const {
|
|
38
|
+
headerText,
|
|
39
|
+
bodyText,
|
|
40
|
+
footerText
|
|
41
|
+
} = this.props;
|
|
42
|
+
return /*#__PURE__*/React.createElement(Popover, {
|
|
43
|
+
className: "notification-wrapper",
|
|
44
|
+
target: "notification-popover",
|
|
45
|
+
isOpen: true,
|
|
46
|
+
fade: false,
|
|
47
|
+
hideArrow: true,
|
|
48
|
+
placement: "bottom"
|
|
49
|
+
}, /*#__PURE__*/React.createElement("div", {
|
|
50
|
+
className: "notification-container",
|
|
51
|
+
ref: ref => this.notificationContainerRef = ref
|
|
52
|
+
}, /*#__PURE__*/React.createElement("div", {
|
|
53
|
+
className: "notification-header"
|
|
54
|
+
}, headerText, /*#__PURE__*/React.createElement("span", {
|
|
55
|
+
className: "dtable-font dtable-icon-x notification-close-icon",
|
|
56
|
+
onClick: this.props.onNotificationListToggle
|
|
57
|
+
})), /*#__PURE__*/React.createElement("div", {
|
|
58
|
+
className: "notification-body"
|
|
59
|
+
}, this.props.enableWeixin && /*#__PURE__*/React.createElement("div", {
|
|
60
|
+
className: "show-weixin-qrcode",
|
|
61
|
+
onClick: this.onWeixinQRCodeDialogToggle
|
|
62
|
+
}, /*#__PURE__*/React.createElement("i", {
|
|
63
|
+
className: "dtable-font dtable-icon-wechat weixin-icon"
|
|
64
|
+
}), /*#__PURE__*/React.createElement("span", {
|
|
65
|
+
className: "ml-2"
|
|
66
|
+
}, "\u5173\u6CE8\u516C\u4F17\u53F7\u83B7\u53D6\u5B9E\u65F6\u901A\u77E5")), /*#__PURE__*/React.createElement("div", {
|
|
67
|
+
className: "mark-notifications",
|
|
68
|
+
onClick: this.props.onMarkAllNotifications
|
|
69
|
+
}, bodyText), /*#__PURE__*/React.createElement("div", {
|
|
70
|
+
className: "notification-list-container",
|
|
71
|
+
onScroll: this.onHandleScroll,
|
|
72
|
+
ref: ref => this.notificationListRef = ref
|
|
73
|
+
}, /*#__PURE__*/React.createElement("div", {
|
|
74
|
+
ref: ref => this.notificationsWrapperRef = ref
|
|
75
|
+
}, this.props.children)), /*#__PURE__*/React.createElement("div", {
|
|
76
|
+
className: "notification-footer",
|
|
77
|
+
onClick: this.onNotificationDialogToggle
|
|
78
|
+
}, footerText))));
|
|
79
|
+
}
|
|
80
|
+
}
|
|
107
81
|
NotificationPopover.defaultProps = {
|
|
108
82
|
headerText: '',
|
|
109
83
|
bodyText: '',
|
|
110
84
|
footerText: ''
|
|
111
|
-
};
|
|
112
|
-
export { NotificationPopover as default };
|
|
85
|
+
};
|
|
@@ -1,132 +1,125 @@
|
|
|
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 from 'react';
|
|
6
2
|
import isHotkey from 'is-hotkey';
|
|
7
3
|
import { getNumberDisplayString, formatStringToNumber, replaceNumberNotAllowInput } from 'dtable-utils';
|
|
8
4
|
import { NUMBER_TYPES } from '../constants';
|
|
9
5
|
import { isMac } from '../utils/utils';
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
_classCallCheck(this, NumberEditor);
|
|
16
|
-
_this = _super.call(this, props);
|
|
17
|
-
_this.onEditorHandle = function () {
|
|
18
|
-
if (_this.props.isReadOnly) {
|
|
6
|
+
class NumberEditor extends React.Component {
|
|
7
|
+
constructor(props) {
|
|
8
|
+
super(props);
|
|
9
|
+
this.onEditorHandle = () => {
|
|
10
|
+
if (this.props.isReadOnly) {
|
|
19
11
|
return;
|
|
20
12
|
}
|
|
21
|
-
|
|
13
|
+
this.setState({
|
|
22
14
|
isEditorShow: true,
|
|
23
|
-
inputValue:
|
|
24
|
-
},
|
|
25
|
-
|
|
15
|
+
inputValue: this.state.textValue
|
|
16
|
+
}, () => {
|
|
17
|
+
this.input.focus();
|
|
26
18
|
});
|
|
27
19
|
};
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
20
|
+
this.onCommit = () => {
|
|
21
|
+
let updated = {};
|
|
22
|
+
let {
|
|
23
|
+
column
|
|
24
|
+
} = this.props;
|
|
25
|
+
let inputValue = this.state.inputValue ? this.state.inputValue.toString() : '';
|
|
26
|
+
let value = inputValue ? formatStringToNumber(inputValue) : ''; // format the number to submit
|
|
33
27
|
updated[column.key] = value;
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
28
|
+
this.props.onCommit(updated);
|
|
29
|
+
let newValue = getNumberDisplayString(value, column.data); // format the number to display
|
|
30
|
+
this.setState({
|
|
37
31
|
isEditorShow: false,
|
|
38
32
|
textValue: newValue
|
|
39
33
|
});
|
|
40
34
|
};
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
35
|
+
this.onChange = event => {
|
|
36
|
+
const {
|
|
37
|
+
data
|
|
38
|
+
} = this.props.column; // data maybe 'null'
|
|
39
|
+
let value = event.target.value.trim();
|
|
40
|
+
let currency_symbol = null;
|
|
45
41
|
if (data && data.format === 'custom_currency') {
|
|
46
42
|
currency_symbol = data['currency_symbol'];
|
|
47
43
|
}
|
|
48
44
|
|
|
49
45
|
//Prevent the repetition of periods bug in the Chinese input method of the Windows system
|
|
50
46
|
if (!isMac() && value.indexOf('.。') > -1) return;
|
|
51
|
-
value = replaceNumberNotAllowInput(value,
|
|
52
|
-
if (value ===
|
|
53
|
-
|
|
47
|
+
value = replaceNumberNotAllowInput(value, this.dataFormat, currency_symbol);
|
|
48
|
+
if (value === this.state.inputValue) return;
|
|
49
|
+
this.setState({
|
|
54
50
|
inputValue: value
|
|
55
51
|
});
|
|
56
52
|
};
|
|
57
|
-
|
|
58
|
-
|
|
53
|
+
this.onBlur = () => {
|
|
54
|
+
this.onCommit();
|
|
59
55
|
};
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
selectionStart
|
|
63
|
-
selectionEnd
|
|
64
|
-
value
|
|
56
|
+
this.onKeyDown = event => {
|
|
57
|
+
let {
|
|
58
|
+
selectionStart,
|
|
59
|
+
selectionEnd,
|
|
60
|
+
value
|
|
61
|
+
} = event.currentTarget;
|
|
65
62
|
if (isHotkey('enter', event)) {
|
|
66
63
|
event.preventDefault();
|
|
67
|
-
|
|
64
|
+
this.onBlur();
|
|
68
65
|
} else if (event.keyCode === 37 && selectionStart === 0 || event.keyCode === 39 && selectionEnd === value.length) {
|
|
69
66
|
event.stopPropagation();
|
|
70
67
|
}
|
|
71
68
|
};
|
|
72
|
-
|
|
69
|
+
this.onPaste = e => {
|
|
73
70
|
e.stopPropagation();
|
|
74
71
|
};
|
|
75
|
-
|
|
72
|
+
this.onCut = e => {
|
|
76
73
|
e.stopPropagation();
|
|
77
74
|
};
|
|
78
|
-
|
|
75
|
+
this.getStyle = () => {
|
|
79
76
|
return {
|
|
80
77
|
width: '320px',
|
|
81
78
|
textAlign: 'left'
|
|
82
79
|
};
|
|
83
80
|
};
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
return
|
|
81
|
+
this.setInputRef = input => {
|
|
82
|
+
this.input = input;
|
|
83
|
+
return this.input;
|
|
87
84
|
};
|
|
88
|
-
|
|
89
|
-
_value
|
|
90
|
-
_column
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
85
|
+
let {
|
|
86
|
+
value: _value,
|
|
87
|
+
column: _column
|
|
88
|
+
} = this.props;
|
|
89
|
+
let dataFormat = _column.data && _column.data.format;
|
|
90
|
+
this.dataFormat = dataFormat || NUMBER_TYPES.NUMBER;
|
|
91
|
+
let initValue = getNumberDisplayString(_value, _column.data); // format the number to display
|
|
94
92
|
|
|
95
|
-
|
|
93
|
+
this.state = {
|
|
96
94
|
inputValue: initValue,
|
|
97
95
|
textValue: initValue,
|
|
98
96
|
isEditorShow: false
|
|
99
97
|
};
|
|
100
|
-
return _this;
|
|
101
98
|
}
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
}
|
|
127
|
-
}]);
|
|
128
|
-
return NumberEditor;
|
|
129
|
-
}(React.Component);
|
|
99
|
+
render() {
|
|
100
|
+
let style = this.getStyle();
|
|
101
|
+
return /*#__PURE__*/React.createElement("div", {
|
|
102
|
+
className: "cell-editor number-editor"
|
|
103
|
+
}, /*#__PURE__*/React.createElement("div", {
|
|
104
|
+
className: "number-editor-container"
|
|
105
|
+
}, !this.state.isEditorShow && /*#__PURE__*/React.createElement("div", {
|
|
106
|
+
className: "form-control",
|
|
107
|
+
style: style,
|
|
108
|
+
onClick: this.onEditorHandle
|
|
109
|
+
}, this.state.textValue), this.state.isEditorShow && /*#__PURE__*/React.createElement("input", {
|
|
110
|
+
ref: this.setInputRef,
|
|
111
|
+
type: "text",
|
|
112
|
+
className: "form-control",
|
|
113
|
+
style: style,
|
|
114
|
+
value: this.state.inputValue,
|
|
115
|
+
onChange: this.onChange,
|
|
116
|
+
onBlur: this.onBlur,
|
|
117
|
+
onCut: this.onCut,
|
|
118
|
+
onPaste: this.onPaste,
|
|
119
|
+
onKeyDown: this.onKeyDown
|
|
120
|
+
})));
|
|
121
|
+
}
|
|
122
|
+
}
|
|
130
123
|
NumberEditor.defaultProps = {
|
|
131
124
|
isReadOnly: false,
|
|
132
125
|
value: ''
|
|
@@ -1,36 +1,23 @@
|
|
|
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 from 'react';
|
|
6
2
|
import classnames from 'classnames';
|
|
7
3
|
import { getNumberDisplayString } from 'dtable-utils';
|
|
8
4
|
import './index.css';
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
var _this$props = this.props,
|
|
20
|
-
number = _this$props.value,
|
|
21
|
-
data = _this$props.data,
|
|
22
|
-
containerClassName = _this$props.containerClassName;
|
|
23
|
-
var classname = classnames('dtable-ui cell-formatter-container number-formatter', containerClassName);
|
|
24
|
-
if (number || number === 0) {
|
|
25
|
-
number = getNumberDisplayString(number, data);
|
|
26
|
-
}
|
|
27
|
-
return /*#__PURE__*/React.createElement("div", {
|
|
28
|
-
className: classname
|
|
29
|
-
}, number);
|
|
5
|
+
class NumberFormatter extends React.Component {
|
|
6
|
+
render() {
|
|
7
|
+
let {
|
|
8
|
+
value: number,
|
|
9
|
+
data,
|
|
10
|
+
containerClassName
|
|
11
|
+
} = this.props;
|
|
12
|
+
let classname = classnames('dtable-ui cell-formatter-container number-formatter', containerClassName);
|
|
13
|
+
if (number || number === 0) {
|
|
14
|
+
number = getNumberDisplayString(number, data);
|
|
30
15
|
}
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
}
|
|
16
|
+
return /*#__PURE__*/React.createElement("div", {
|
|
17
|
+
className: classname
|
|
18
|
+
}, number);
|
|
19
|
+
}
|
|
20
|
+
}
|
|
34
21
|
NumberFormatter.defaultProps = {
|
|
35
22
|
value: '',
|
|
36
23
|
containerClassName: ''
|
|
@@ -1,34 +1,22 @@
|
|
|
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 from 'react';
|
|
6
2
|
import classnames from 'classnames';
|
|
7
3
|
import './index.css';
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
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;
|
|
29
|
-
var validValue = Math.min(rate_max_number, value);
|
|
30
|
-
var rateList = [];
|
|
31
|
-
for (var i = 0; i < validValue; i++) {
|
|
4
|
+
class RateFormatter extends React.Component {
|
|
5
|
+
constructor() {
|
|
6
|
+
super(...arguments);
|
|
7
|
+
this.getRateList = () => {
|
|
8
|
+
const {
|
|
9
|
+
data,
|
|
10
|
+
value
|
|
11
|
+
} = this.props;
|
|
12
|
+
const {
|
|
13
|
+
rate_max_number = 5,
|
|
14
|
+
rate_style_color = '#e5e5e5',
|
|
15
|
+
rate_style_type = 'dtable-icon-rate'
|
|
16
|
+
} = data || {};
|
|
17
|
+
const validValue = Math.min(rate_max_number, value);
|
|
18
|
+
let rateList = [];
|
|
19
|
+
for (let i = 0; i < validValue; i++) {
|
|
32
20
|
rateList.push( /*#__PURE__*/React.createElement("i", {
|
|
33
21
|
key: "dtable-ui-component-rate-".concat(i),
|
|
34
22
|
className: "dtable-font ".concat(rate_style_type),
|
|
@@ -39,24 +27,20 @@ var RateFormatter = /*#__PURE__*/function (_React$Component) {
|
|
|
39
27
|
}
|
|
40
28
|
return rateList;
|
|
41
29
|
};
|
|
42
|
-
return _this;
|
|
43
30
|
}
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
}]);
|
|
58
|
-
return RateFormatter;
|
|
59
|
-
}(React.Component);
|
|
31
|
+
render() {
|
|
32
|
+
const {
|
|
33
|
+
value: number,
|
|
34
|
+
containerClassName
|
|
35
|
+
} = this.props;
|
|
36
|
+
const className = classnames('dtable-ui cell-formatter-container rate-formatter', containerClassName);
|
|
37
|
+
if (!number) return null;
|
|
38
|
+
const rateList = this.getRateList();
|
|
39
|
+
return /*#__PURE__*/React.createElement("div", {
|
|
40
|
+
className: className
|
|
41
|
+
}, rateList);
|
|
42
|
+
}
|
|
43
|
+
}
|
|
60
44
|
RateFormatter.defaultProps = {
|
|
61
45
|
value: '',
|
|
62
46
|
containerClassName: ''
|
|
@@ -1,20 +1,20 @@
|
|
|
1
|
-
import _slicedToArray from "@babel/runtime/helpers/esm/slicedToArray";
|
|
2
1
|
import React, { useState } from 'react';
|
|
3
2
|
import { Dropdown, DropdownToggle, DropdownMenu, DropdownItem } from 'reactstrap';
|
|
4
3
|
import classnames from 'classnames';
|
|
5
4
|
import './index.css';
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
5
|
+
const RoleStatusEditor = _ref => {
|
|
6
|
+
let {
|
|
7
|
+
isShowDropdownIcon,
|
|
8
|
+
currentOption,
|
|
9
|
+
menuOptions,
|
|
10
|
+
onChangeOption,
|
|
11
|
+
closeShowDropdownIcon
|
|
12
|
+
} = _ref;
|
|
13
|
+
const [isOpen, setIsOpen] = useState(false);
|
|
14
|
+
const handleClickMenuOption = menuOption => {
|
|
15
|
+
const {
|
|
16
|
+
value
|
|
17
|
+
} = menuOption;
|
|
18
18
|
closeShowDropdownIcon && closeShowDropdownIcon();
|
|
19
19
|
if (value === currentOption.value) return;
|
|
20
20
|
onChangeOption(value);
|
|
@@ -22,9 +22,7 @@ var RoleStatusEditor = function RoleStatusEditor(_ref) {
|
|
|
22
22
|
return /*#__PURE__*/React.createElement(Dropdown, {
|
|
23
23
|
isOpen: isOpen,
|
|
24
24
|
className: "role-status-editor",
|
|
25
|
-
toggle:
|
|
26
|
-
return setIsOpen(!isOpen);
|
|
27
|
-
}
|
|
25
|
+
toggle: () => setIsOpen(!isOpen)
|
|
28
26
|
}, /*#__PURE__*/React.createElement(DropdownToggle, {
|
|
29
27
|
className: "dropdown-toggle-button d-flex align-items-center",
|
|
30
28
|
tag: "div"
|
|
@@ -41,14 +39,14 @@ var RoleStatusEditor = function RoleStatusEditor(_ref) {
|
|
|
41
39
|
boundariesElement: document.body
|
|
42
40
|
}
|
|
43
41
|
}
|
|
44
|
-
}, menuOptions.map(
|
|
45
|
-
|
|
46
|
-
|
|
42
|
+
}, menuOptions.map(option => {
|
|
43
|
+
const {
|
|
44
|
+
value,
|
|
45
|
+
label
|
|
46
|
+
} = option;
|
|
47
47
|
return /*#__PURE__*/React.createElement(DropdownItem, {
|
|
48
48
|
key: "item-".concat(value),
|
|
49
|
-
onClick:
|
|
50
|
-
return handleClickMenuOption(option);
|
|
51
|
-
}
|
|
49
|
+
onClick: () => handleClickMenuOption(option)
|
|
52
50
|
}, label, value === currentOption.value && /*#__PURE__*/React.createElement("i", {
|
|
53
51
|
className: "dtable-font dtable-icon-check-mark ml-2"
|
|
54
52
|
}));
|