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,48 +8,34 @@ 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 SingleSelectEditor = /*#__PURE__*/function (_React$Component) {
|
|
13
12
|
_inherits(SingleSelectEditor, _React$Component);
|
|
14
|
-
|
|
15
13
|
var _super = _createSuper(SingleSelectEditor);
|
|
16
|
-
|
|
17
14
|
function SingleSelectEditor(props) {
|
|
18
15
|
var _this;
|
|
19
|
-
|
|
20
16
|
_classCallCheck(this, SingleSelectEditor);
|
|
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.formatOption = function () {
|
|
31
24
|
var newValue = _this.state.newValue;
|
|
32
|
-
|
|
33
25
|
var option = _this.options.find(function (option) {
|
|
34
26
|
return option.name === newValue;
|
|
35
27
|
});
|
|
36
|
-
|
|
37
28
|
return option;
|
|
38
29
|
};
|
|
39
|
-
|
|
40
30
|
_this.onAddOptionToggle = function (event) {
|
|
41
31
|
event.nativeEvent.stopImmediatePropagation();
|
|
42
32
|
event.stopPropagation();
|
|
43
|
-
|
|
44
33
|
if (_this.props.isReadOnly) {
|
|
45
34
|
return;
|
|
46
35
|
}
|
|
47
|
-
|
|
48
36
|
var isPopoverShow = !_this.state.isPopoverShow;
|
|
49
|
-
|
|
50
37
|
if (isPopoverShow) {
|
|
51
38
|
var popoverPosition = _this.caculatePopoverPosition();
|
|
52
|
-
|
|
53
39
|
_this.setState({
|
|
54
40
|
isPopoverShow: isPopoverShow,
|
|
55
41
|
popoverPosition: popoverPosition
|
|
@@ -60,41 +46,32 @@ var SingleSelectEditor = /*#__PURE__*/function (_React$Component) {
|
|
|
60
46
|
});
|
|
61
47
|
}
|
|
62
48
|
};
|
|
63
|
-
|
|
64
49
|
_this.onCommit = function (newValue) {
|
|
65
50
|
var updated = {};
|
|
66
51
|
var column = _this.props.column;
|
|
67
52
|
updated[column.name] = newValue;
|
|
68
|
-
|
|
69
53
|
_this.props.onCommit(updated);
|
|
70
54
|
};
|
|
71
|
-
|
|
72
55
|
_this.onOptionItemToggle = function (option) {
|
|
73
56
|
var newValue = _this.state.newValue === option.name ? '' : option.name;
|
|
74
|
-
|
|
75
57
|
_this.setState({
|
|
76
58
|
newValue: newValue
|
|
77
59
|
}, function () {
|
|
78
60
|
_this.onCommit(newValue);
|
|
79
|
-
|
|
80
61
|
_this.onClosePopover();
|
|
81
62
|
});
|
|
82
63
|
};
|
|
83
|
-
|
|
84
64
|
_this.caculatePopoverPosition = function () {
|
|
85
65
|
var POPOVER_MAX_HEIGHT = 200;
|
|
86
66
|
var innerHeight = window.innerHeight;
|
|
87
|
-
|
|
88
67
|
var _this$editor$getClien = _this.editor.getClientRects()[0],
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
68
|
+
top = _this$editor$getClien.top,
|
|
69
|
+
height = _this$editor$getClien.height;
|
|
92
70
|
var isBelow = innerHeight - (top + height) > POPOVER_MAX_HEIGHT;
|
|
93
71
|
var position = {
|
|
94
72
|
top: height + 1,
|
|
95
73
|
left: 0
|
|
96
74
|
};
|
|
97
|
-
|
|
98
75
|
if (!isBelow) {
|
|
99
76
|
var bottom = height + 1;
|
|
100
77
|
position = {
|
|
@@ -102,30 +79,23 @@ var SingleSelectEditor = /*#__PURE__*/function (_React$Component) {
|
|
|
102
79
|
left: 0
|
|
103
80
|
};
|
|
104
81
|
}
|
|
105
|
-
|
|
106
82
|
return position;
|
|
107
83
|
};
|
|
108
|
-
|
|
109
84
|
_this.onAddNewOption = function (optionName) {
|
|
110
85
|
_this.props.onAddNewOption(optionName);
|
|
111
|
-
|
|
112
86
|
_this.onClosePopover();
|
|
113
87
|
};
|
|
114
|
-
|
|
115
88
|
_this.onClosePopover = function () {
|
|
116
89
|
_this.setState({
|
|
117
90
|
isPopoverShow: false
|
|
118
91
|
});
|
|
119
92
|
};
|
|
120
|
-
|
|
121
93
|
_this.setEditorContainerRef = function (editorContainer) {
|
|
122
94
|
_this.editorContainer = editorContainer;
|
|
123
95
|
};
|
|
124
|
-
|
|
125
96
|
_this.setEditorRef = function (editor) {
|
|
126
97
|
_this.editor = editor;
|
|
127
98
|
};
|
|
128
|
-
|
|
129
99
|
_this.state = {
|
|
130
100
|
newValue: props.value,
|
|
131
101
|
isPopoverShow: false,
|
|
@@ -135,7 +105,6 @@ var SingleSelectEditor = /*#__PURE__*/function (_React$Component) {
|
|
|
135
105
|
_this.options = _column.data && (_column.data.options || []);
|
|
136
106
|
return _this;
|
|
137
107
|
}
|
|
138
|
-
|
|
139
108
|
_createClass(SingleSelectEditor, [{
|
|
140
109
|
key: "componentDidMount",
|
|
141
110
|
value: function componentDidMount() {
|
|
@@ -150,8 +119,8 @@ var SingleSelectEditor = /*#__PURE__*/function (_React$Component) {
|
|
|
150
119
|
key: "render",
|
|
151
120
|
value: function render() {
|
|
152
121
|
var _this$state = this.state,
|
|
153
|
-
|
|
154
|
-
|
|
122
|
+
isPopoverShow = _this$state.isPopoverShow,
|
|
123
|
+
popoverPosition = _this$state.popoverPosition;
|
|
155
124
|
var option = this.formatOption();
|
|
156
125
|
var options = this.options;
|
|
157
126
|
var selectedOptions = option ? [option] : [];
|
|
@@ -192,10 +161,8 @@ var SingleSelectEditor = /*#__PURE__*/function (_React$Component) {
|
|
|
192
161
|
}))));
|
|
193
162
|
}
|
|
194
163
|
}]);
|
|
195
|
-
|
|
196
164
|
return SingleSelectEditor;
|
|
197
165
|
}(React.Component);
|
|
198
|
-
|
|
199
166
|
SingleSelectEditor.defaultProps = {
|
|
200
167
|
isReadOnly: false,
|
|
201
168
|
value: ''
|
|
@@ -6,32 +6,24 @@ 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 SingleSelectFormatter = /*#__PURE__*/function (_React$PureComponent) {
|
|
11
10
|
_inherits(SingleSelectFormatter, _React$PureComponent);
|
|
12
|
-
|
|
13
11
|
var _super = _createSuper(SingleSelectFormatter);
|
|
14
|
-
|
|
15
12
|
function SingleSelectFormatter() {
|
|
16
13
|
var _this;
|
|
17
|
-
|
|
18
14
|
_classCallCheck(this, SingleSelectFormatter);
|
|
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.getOption = function () {
|
|
27
20
|
var _this$props = _this.props,
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
21
|
+
value = _this$props.value,
|
|
22
|
+
options = _this$props.options,
|
|
23
|
+
fontSize = _this$props.fontSize;
|
|
31
24
|
var option = options.find(function (item) {
|
|
32
25
|
return item.id === value || item.name === value;
|
|
33
26
|
});
|
|
34
|
-
|
|
35
27
|
if (option) {
|
|
36
28
|
return /*#__PURE__*/React.createElement(SelectItem, {
|
|
37
29
|
option: option,
|
|
@@ -39,26 +31,22 @@ var SingleSelectFormatter = /*#__PURE__*/function (_React$PureComponent) {
|
|
|
39
31
|
});
|
|
40
32
|
}
|
|
41
33
|
};
|
|
42
|
-
|
|
43
34
|
return _this;
|
|
44
35
|
}
|
|
45
|
-
|
|
46
36
|
_createClass(SingleSelectFormatter, [{
|
|
47
37
|
key: "render",
|
|
48
38
|
value: function render() {
|
|
49
39
|
var _this$props2 = this.props,
|
|
50
|
-
|
|
51
|
-
|
|
40
|
+
containerClassName = _this$props2.containerClassName,
|
|
41
|
+
value = _this$props2.value;
|
|
52
42
|
var classname = classnames('dtable-ui cell-formatter-container single-select-formatter', containerClassName);
|
|
53
43
|
return /*#__PURE__*/React.createElement("div", {
|
|
54
44
|
className: classname
|
|
55
45
|
}, value ? this.getOption() : '');
|
|
56
46
|
}
|
|
57
47
|
}]);
|
|
58
|
-
|
|
59
48
|
return SingleSelectFormatter;
|
|
60
49
|
}(React.PureComponent);
|
|
61
|
-
|
|
62
50
|
SingleSelectFormatter.defaultProps = {
|
|
63
51
|
options: []
|
|
64
52
|
};
|
package/lib/TextEditor/index.js
CHANGED
|
@@ -5,46 +5,34 @@ import _createSuper from "@babel/runtime/helpers/esm/createSuper";
|
|
|
5
5
|
import React from 'react';
|
|
6
6
|
import isHotkey from 'is-hotkey';
|
|
7
7
|
import { Input } from 'reactstrap';
|
|
8
|
-
|
|
9
8
|
var TextEditor = /*#__PURE__*/function (_React$Component) {
|
|
10
9
|
_inherits(TextEditor, _React$Component);
|
|
11
|
-
|
|
12
10
|
var _super = _createSuper(TextEditor);
|
|
13
|
-
|
|
14
11
|
function TextEditor(props) {
|
|
15
12
|
var _this;
|
|
16
|
-
|
|
17
13
|
_classCallCheck(this, TextEditor);
|
|
18
|
-
|
|
19
14
|
_this = _super.call(this, props);
|
|
20
|
-
|
|
21
15
|
_this.onCommit = function () {
|
|
22
16
|
var updated = {};
|
|
23
17
|
var column = _this.props.column;
|
|
24
18
|
var newValue = _this.state.newValue;
|
|
25
19
|
updated[column.name] = newValue ? newValue.trim() : '';
|
|
26
|
-
|
|
27
20
|
_this.props.onCommit(updated);
|
|
28
21
|
};
|
|
29
|
-
|
|
30
22
|
_this.onBlur = function () {
|
|
31
23
|
_this.onCommit();
|
|
32
24
|
};
|
|
33
|
-
|
|
34
25
|
_this.onChange = function (event) {
|
|
35
26
|
var value = event.target.value;
|
|
36
|
-
|
|
37
27
|
_this.setState({
|
|
38
28
|
newValue: value
|
|
39
29
|
});
|
|
40
30
|
};
|
|
41
|
-
|
|
42
31
|
_this.onKeyDown = function (event) {
|
|
43
32
|
var _event$currentTarget = event.currentTarget,
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
33
|
+
selectionStart = _event$currentTarget.selectionStart,
|
|
34
|
+
selectionEnd = _event$currentTarget.selectionEnd,
|
|
35
|
+
value = _event$currentTarget.value;
|
|
48
36
|
if (isHotkey('enter', event)) {
|
|
49
37
|
event.preventDefault();
|
|
50
38
|
event.target.blur();
|
|
@@ -52,25 +40,20 @@ var TextEditor = /*#__PURE__*/function (_React$Component) {
|
|
|
52
40
|
event.stopPropagation();
|
|
53
41
|
}
|
|
54
42
|
};
|
|
55
|
-
|
|
56
43
|
_this.onPaste = function (e) {
|
|
57
44
|
e.stopPropagation();
|
|
58
45
|
};
|
|
59
|
-
|
|
60
46
|
_this.onCut = function (e) {
|
|
61
47
|
e.stopPropagation();
|
|
62
48
|
};
|
|
63
|
-
|
|
64
49
|
_this.setInputRef = function (input) {
|
|
65
50
|
_this.input = input;
|
|
66
51
|
};
|
|
67
|
-
|
|
68
52
|
_this.state = {
|
|
69
53
|
newValue: props.value
|
|
70
54
|
};
|
|
71
55
|
return _this;
|
|
72
56
|
}
|
|
73
|
-
|
|
74
57
|
_createClass(TextEditor, [{
|
|
75
58
|
key: "render",
|
|
76
59
|
value: function render() {
|
|
@@ -88,10 +71,8 @@ var TextEditor = /*#__PURE__*/function (_React$Component) {
|
|
|
88
71
|
});
|
|
89
72
|
}
|
|
90
73
|
}]);
|
|
91
|
-
|
|
92
74
|
return TextEditor;
|
|
93
75
|
}(React.Component);
|
|
94
|
-
|
|
95
76
|
TextEditor.defaultProps = {
|
|
96
77
|
isReadOnly: false,
|
|
97
78
|
value: ''
|
|
@@ -5,44 +5,33 @@ 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 TextFormatter = /*#__PURE__*/function (_React$Component) {
|
|
10
9
|
_inherits(TextFormatter, _React$Component);
|
|
11
|
-
|
|
12
10
|
var _super = _createSuper(TextFormatter);
|
|
13
|
-
|
|
14
11
|
function TextFormatter() {
|
|
15
12
|
var _this;
|
|
16
|
-
|
|
17
13
|
_classCallCheck(this, TextFormatter);
|
|
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.getFormattedValue = function (val) {
|
|
26
19
|
if (typeof val === 'object') {
|
|
27
20
|
return null;
|
|
28
21
|
}
|
|
29
|
-
|
|
30
22
|
if (Object.prototype.toString.call(val) === '[object Boolean]') {
|
|
31
23
|
return val + '';
|
|
32
24
|
}
|
|
33
|
-
|
|
34
25
|
return val;
|
|
35
26
|
};
|
|
36
|
-
|
|
37
27
|
return _this;
|
|
38
28
|
}
|
|
39
|
-
|
|
40
29
|
_createClass(TextFormatter, [{
|
|
41
30
|
key: "render",
|
|
42
31
|
value: function render() {
|
|
43
32
|
var _this$props = this.props,
|
|
44
|
-
|
|
45
|
-
|
|
33
|
+
containerClassName = _this$props.containerClassName,
|
|
34
|
+
value = _this$props.value;
|
|
46
35
|
var classname = classnames('dtable-ui cell-formatter-container text-formatter', containerClassName);
|
|
47
36
|
var formattedValue = this.getFormattedValue(value);
|
|
48
37
|
return /*#__PURE__*/React.createElement("div", {
|
|
@@ -51,8 +40,6 @@ var TextFormatter = /*#__PURE__*/function (_React$Component) {
|
|
|
51
40
|
}, formattedValue);
|
|
52
41
|
}
|
|
53
42
|
}]);
|
|
54
|
-
|
|
55
43
|
return TextFormatter;
|
|
56
44
|
}(React.Component);
|
|
57
|
-
|
|
58
45
|
export default TextFormatter;
|
|
@@ -5,32 +5,25 @@ 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 UrlFormatter = /*#__PURE__*/function (_React$Component) {
|
|
10
9
|
_inherits(UrlFormatter, _React$Component);
|
|
11
|
-
|
|
12
10
|
var _super = _createSuper(UrlFormatter);
|
|
13
|
-
|
|
14
11
|
function UrlFormatter() {
|
|
15
12
|
_classCallCheck(this, UrlFormatter);
|
|
16
|
-
|
|
17
13
|
return _super.apply(this, arguments);
|
|
18
14
|
}
|
|
19
|
-
|
|
20
15
|
_createClass(UrlFormatter, [{
|
|
21
16
|
key: "render",
|
|
22
17
|
value: function render() {
|
|
23
18
|
var _this$props = this.props,
|
|
24
|
-
|
|
25
|
-
|
|
19
|
+
containerClassName = _this$props.containerClassName,
|
|
20
|
+
value = _this$props.value;
|
|
26
21
|
var classname = classnames('dtable-ui cell-formatter-container url-formatter', containerClassName);
|
|
27
22
|
return /*#__PURE__*/React.createElement("div", {
|
|
28
23
|
className: classname
|
|
29
24
|
}, value);
|
|
30
25
|
}
|
|
31
26
|
}]);
|
|
32
|
-
|
|
33
27
|
return UrlFormatter;
|
|
34
28
|
}(React.Component);
|
|
35
|
-
|
|
36
29
|
export default UrlFormatter;
|
|
@@ -1,25 +1,20 @@
|
|
|
1
1
|
import _classCallCheck from "@babel/runtime/helpers/esm/classCallCheck";
|
|
2
2
|
import _createClass from "@babel/runtime/helpers/esm/createClass";
|
|
3
3
|
import FormatterConfig from '../formatterConfig';
|
|
4
|
-
|
|
5
4
|
var CellFormatterFactory = /*#__PURE__*/function () {
|
|
6
5
|
function CellFormatterFactory() {
|
|
7
6
|
_classCallCheck(this, CellFormatterFactory);
|
|
8
7
|
}
|
|
9
|
-
|
|
10
8
|
_createClass(CellFormatterFactory, [{
|
|
11
9
|
key: "createFormatter",
|
|
12
10
|
value: function createFormatter(formatterType) {
|
|
13
11
|
if (FormatterConfig[formatterType]) {
|
|
14
12
|
return FormatterConfig[formatterType];
|
|
15
13
|
}
|
|
16
|
-
|
|
17
14
|
return null;
|
|
18
15
|
}
|
|
19
16
|
}]);
|
|
20
|
-
|
|
21
17
|
return CellFormatterFactory;
|
|
22
18
|
}();
|
|
23
|
-
|
|
24
19
|
var cellFormatterFactory = new CellFormatterFactory();
|
|
25
20
|
export default cellFormatterFactory;
|
package/lib/common/delete-tip.js
CHANGED
|
@@ -6,32 +6,23 @@ import React from 'react';
|
|
|
6
6
|
import ModalPortal from './modal-portal';
|
|
7
7
|
import { getLocale } from '../lang';
|
|
8
8
|
import './delete-tip.css';
|
|
9
|
-
|
|
10
9
|
var DeleteTip = /*#__PURE__*/function (_React$Component) {
|
|
11
10
|
_inherits(DeleteTip, _React$Component);
|
|
12
|
-
|
|
13
11
|
var _super = _createSuper(DeleteTip);
|
|
14
|
-
|
|
15
12
|
function DeleteTip() {
|
|
16
13
|
var _this;
|
|
17
|
-
|
|
18
14
|
_classCallCheck(this, DeleteTip);
|
|
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.handleOutsideClick = function (e) {
|
|
27
20
|
if (_this.tipContainer && !_this.tipContainer.contains(e.target)) {
|
|
28
21
|
_this.props.toggle();
|
|
29
22
|
}
|
|
30
23
|
};
|
|
31
|
-
|
|
32
24
|
return _this;
|
|
33
25
|
}
|
|
34
|
-
|
|
35
26
|
_createClass(DeleteTip, [{
|
|
36
27
|
key: "componentDidMount",
|
|
37
28
|
value: function componentDidMount() {
|
|
@@ -46,12 +37,11 @@ var DeleteTip = /*#__PURE__*/function (_React$Component) {
|
|
|
46
37
|
key: "render",
|
|
47
38
|
value: function render() {
|
|
48
39
|
var _this2 = this;
|
|
49
|
-
|
|
50
40
|
var _this$props = this.props,
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
41
|
+
toggle = _this$props.toggle,
|
|
42
|
+
onDelete = _this$props.onDelete,
|
|
43
|
+
position = _this$props.position,
|
|
44
|
+
deleteTip = _this$props.deleteTip;
|
|
55
45
|
return /*#__PURE__*/React.createElement(ModalPortal, null, /*#__PURE__*/React.createElement("div", {
|
|
56
46
|
ref: function ref(node) {
|
|
57
47
|
return _this2.tipContainer = node;
|
|
@@ -77,8 +67,6 @@ var DeleteTip = /*#__PURE__*/function (_React$Component) {
|
|
|
77
67
|
}, getLocale('Delete')))));
|
|
78
68
|
}
|
|
79
69
|
}]);
|
|
80
|
-
|
|
81
70
|
return DeleteTip;
|
|
82
71
|
}(React.Component);
|
|
83
|
-
|
|
84
72
|
export { DeleteTip as default };
|
|
@@ -5,22 +5,16 @@ import _createSuper from "@babel/runtime/helpers/esm/createSuper";
|
|
|
5
5
|
import React from 'react';
|
|
6
6
|
import ReactDOM from 'react-dom';
|
|
7
7
|
var modalRoot = document.getElementById('modal-wrapper');
|
|
8
|
-
|
|
9
8
|
var ModalPortal = /*#__PURE__*/function (_React$Component) {
|
|
10
9
|
_inherits(ModalPortal, _React$Component);
|
|
11
|
-
|
|
12
10
|
var _super = _createSuper(ModalPortal);
|
|
13
|
-
|
|
14
11
|
function ModalPortal(props) {
|
|
15
12
|
var _this;
|
|
16
|
-
|
|
17
13
|
_classCallCheck(this, ModalPortal);
|
|
18
|
-
|
|
19
14
|
_this = _super.call(this, props);
|
|
20
15
|
_this.el = document.createElement('div');
|
|
21
16
|
return _this;
|
|
22
17
|
}
|
|
23
|
-
|
|
24
18
|
_createClass(ModalPortal, [{
|
|
25
19
|
key: "componentDidMount",
|
|
26
20
|
value: function componentDidMount() {
|
|
@@ -37,8 +31,6 @@ var ModalPortal = /*#__PURE__*/function (_React$Component) {
|
|
|
37
31
|
return ReactDOM.createPortal(this.props.children, this.el);
|
|
38
32
|
}
|
|
39
33
|
}]);
|
|
40
|
-
|
|
41
34
|
return ModalPortal;
|
|
42
35
|
}(React.Component);
|
|
43
|
-
|
|
44
36
|
export { ModalPortal as default };
|
|
@@ -1,14 +1,10 @@
|
|
|
1
1
|
import _defineProperty from "@babel/runtime/helpers/esm/defineProperty";
|
|
2
2
|
import _objectSpread from "@babel/runtime/helpers/esm/objectSpread2";
|
|
3
|
-
|
|
4
3
|
var _objectSpread2;
|
|
5
|
-
|
|
6
4
|
import React from 'react';
|
|
7
5
|
import { CellType } from '../constants';
|
|
8
6
|
import BaseFormatterConfig from './base-formatter-config';
|
|
9
7
|
import LinkFormatter from '../LinkFormatter';
|
|
10
8
|
import FormulaFormatter from '../FormulaFormatter';
|
|
11
|
-
|
|
12
9
|
var FormatterConfig = _objectSpread(_objectSpread({}, BaseFormatterConfig), {}, (_objectSpread2 = {}, _defineProperty(_objectSpread2, CellType.FORMULA, /*#__PURE__*/React.createElement(FormulaFormatter, null)), _defineProperty(_objectSpread2, CellType.LINK, /*#__PURE__*/React.createElement(LinkFormatter, null)), _objectSpread2));
|
|
13
|
-
|
|
14
10
|
export default FormatterConfig;
|
package/lib/index.js
CHANGED
|
@@ -1,9 +1,11 @@
|
|
|
1
1
|
// toaster
|
|
2
|
-
export { default as toaster } from './toaster';
|
|
2
|
+
export { default as toaster } from './toaster';
|
|
3
3
|
|
|
4
|
+
// Loading
|
|
4
5
|
export { default as Loading } from './Loading';
|
|
5
|
-
export { setLocale } from './lang';
|
|
6
|
+
export { setLocale } from './lang';
|
|
6
7
|
|
|
8
|
+
// formatter
|
|
7
9
|
export { default as CheckboxFormatter } from './CheckboxFormatter';
|
|
8
10
|
export { default as ImageFormatter } from './ImageFormatter';
|
|
9
11
|
export { default as LongTextFormatter } from './LongTextFormatter';
|
|
@@ -32,8 +34,9 @@ export { default as ImagePreviewerLightbox } from './ImagePreviewerLightbox';
|
|
|
32
34
|
export { default as CollaboratorItem } from './CollaboratorItem';
|
|
33
35
|
export { default as FileItemFormatter } from './FileItemFormatter';
|
|
34
36
|
export { default as DigitalSignFormatter } from './DigitalSignFormatter';
|
|
35
|
-
export { default as SimpleLongTextFormatter } from './SimpleLongTextFormatter';
|
|
37
|
+
export { default as SimpleLongTextFormatter } from './SimpleLongTextFormatter';
|
|
36
38
|
|
|
39
|
+
// row expand formatter
|
|
37
40
|
export { default as RowExpandFileFormatter } from './RowExpandFileFormatter';
|
|
38
41
|
export { default as RowExpandImageFormatter } from './RowExpandImageFormatter';
|
|
39
42
|
export { default as RowExpandLinkFormatter } from './RowExpandLinkFormatter';
|
|
@@ -41,8 +44,9 @@ export { default as RowExpandRateFormatter } from './RowExpandRateFormatter';
|
|
|
41
44
|
export { default as RowExpandEmailFormatter } from './RowExpandEmailFormatter';
|
|
42
45
|
export { default as RowExpandUrlFormatter } from './RowExpandUrlFormatter';
|
|
43
46
|
export { default as RowExpandFormulaFormatter } from './RowExpandFormulaFormatter';
|
|
44
|
-
export { default as RowExpandFormatter } from './RowExpandFormatter';
|
|
47
|
+
export { default as RowExpandFormatter } from './RowExpandFormatter';
|
|
45
48
|
|
|
49
|
+
// editor
|
|
46
50
|
export { default as TextEditor } from './TextEditor';
|
|
47
51
|
export { default as NumberEditor } from './NumberEditor';
|
|
48
52
|
export { default as CheckboxEditor } from './CheckboxEditor';
|
|
@@ -50,8 +54,9 @@ export { default as SingleSelectEditor } from './SingleSelectEditor';
|
|
|
50
54
|
export { default as MultipleSelectEditor } from './MultipleSelectEditor';
|
|
51
55
|
export { default as CollaboratorEditor } from './CollaboratorEditor';
|
|
52
56
|
export { default as DateEditor } from './DateEditor';
|
|
53
|
-
export { default as LinkEditor } from './LinkEditor';
|
|
57
|
+
export { default as LinkEditor } from './LinkEditor';
|
|
54
58
|
|
|
59
|
+
// dtable custom
|
|
55
60
|
export { default as DTablePopover } from './DTablePopover';
|
|
56
61
|
export { default as NotificationPopover } from './NotificationPopover';
|
|
57
62
|
export { default as DTableSelect } from './DTableSelect';
|
|
@@ -59,6 +64,7 @@ export { default as DTableSwitch } from './DTableSwitch';
|
|
|
59
64
|
export { default as DTableCustomizeSelect } from './DTableCustomizeSelect';
|
|
60
65
|
export { default as DTableCustomizeCollaboratorSelect } from './DTableCustomizeCollaboratorSelect';
|
|
61
66
|
export { default as DTableSearchInput } from './DTableSearchInput';
|
|
62
|
-
export { default as ModalPortal } from './ModalPortal';
|
|
67
|
+
export { default as ModalPortal } from './ModalPortal';
|
|
63
68
|
|
|
69
|
+
// setting
|
|
64
70
|
export { default as FieldDisplaySetting } from './FieldDisplaySetting';
|
package/lib/lang/index.js
CHANGED
|
@@ -16,11 +16,9 @@ export function setLocale(args) {
|
|
|
16
16
|
}
|
|
17
17
|
export function getLocale(key, def) {
|
|
18
18
|
if (!key) return def;
|
|
19
|
-
|
|
20
19
|
if (!LANGUAGE_MAP[key]) {
|
|
21
20
|
return def || key;
|
|
22
21
|
}
|
|
23
|
-
|
|
24
22
|
return LANGUAGE_MAP[key];
|
|
25
23
|
}
|
|
26
24
|
export function substitute(str, obj) {
|
|
@@ -28,23 +26,18 @@ export function substitute(str, obj) {
|
|
|
28
26
|
if (str.indexOf('{') < 0) {
|
|
29
27
|
return str;
|
|
30
28
|
}
|
|
31
|
-
|
|
32
29
|
return str.replace(/\\?\{([^{}]+)\}/g, function (match, name) {
|
|
33
30
|
if (match.charAt(0) === '\\') {
|
|
34
31
|
return match.slice(1);
|
|
35
32
|
}
|
|
36
|
-
|
|
37
33
|
return obj[name] === null || obj[name] === undefined ? '' : obj[name];
|
|
38
34
|
});
|
|
39
35
|
} else if (typeof str === 'function') {
|
|
40
36
|
var val = str(obj);
|
|
41
|
-
|
|
42
37
|
if (val === obj && typeof val === 'object') {
|
|
43
38
|
val = Object.assign({}, obj);
|
|
44
39
|
}
|
|
45
|
-
|
|
46
40
|
return val;
|
|
47
41
|
}
|
|
48
|
-
|
|
49
42
|
return '';
|
|
50
43
|
}
|