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
|
@@ -3,30 +3,21 @@ import _createClass from "@babel/runtime/helpers/esm/createClass";
|
|
|
3
3
|
import _inherits from "@babel/runtime/helpers/esm/inherits";
|
|
4
4
|
import _createSuper from "@babel/runtime/helpers/esm/createSuper";
|
|
5
5
|
import React from 'react';
|
|
6
|
-
|
|
7
6
|
var LinkEditorOption = /*#__PURE__*/function (_React$Component) {
|
|
8
7
|
_inherits(LinkEditorOption, _React$Component);
|
|
9
|
-
|
|
10
8
|
var _super = _createSuper(LinkEditorOption);
|
|
11
|
-
|
|
12
9
|
function LinkEditorOption() {
|
|
13
10
|
var _this;
|
|
14
|
-
|
|
15
11
|
_classCallCheck(this, LinkEditorOption);
|
|
16
|
-
|
|
17
12
|
for (var _len = arguments.length, args = new Array(_len), _key = 0; _key < _len; _key++) {
|
|
18
13
|
args[_key] = arguments[_key];
|
|
19
14
|
}
|
|
20
|
-
|
|
21
15
|
_this = _super.call.apply(_super, [this].concat(args));
|
|
22
|
-
|
|
23
16
|
_this.onDeleteOption = function (event) {
|
|
24
17
|
event.nativeEvent.stopImmediatePropagation();
|
|
25
18
|
event.stopPropagation();
|
|
26
|
-
|
|
27
19
|
_this.props.onDeleteLinkOption(_this.props.option);
|
|
28
20
|
};
|
|
29
|
-
|
|
30
21
|
_this.getContainerStyle = function () {
|
|
31
22
|
return {
|
|
32
23
|
display: 'inline-flex',
|
|
@@ -39,7 +30,6 @@ var LinkEditorOption = /*#__PURE__*/function (_React$Component) {
|
|
|
39
30
|
cursor: 'pointer'
|
|
40
31
|
};
|
|
41
32
|
};
|
|
42
|
-
|
|
43
33
|
_this.getOptionStyle = function () {
|
|
44
34
|
return {
|
|
45
35
|
flex: 1,
|
|
@@ -48,7 +38,6 @@ var LinkEditorOption = /*#__PURE__*/function (_React$Component) {
|
|
|
48
38
|
margin: '0 4px 0 2px'
|
|
49
39
|
};
|
|
50
40
|
};
|
|
51
|
-
|
|
52
41
|
_this.getOptionNameStyle = function () {
|
|
53
42
|
return {
|
|
54
43
|
maxWidth: '230px',
|
|
@@ -57,7 +46,6 @@ var LinkEditorOption = /*#__PURE__*/function (_React$Component) {
|
|
|
57
46
|
textOverflow: 'ellipsis'
|
|
58
47
|
};
|
|
59
48
|
};
|
|
60
|
-
|
|
61
49
|
_this.getOperationStyle = function () {
|
|
62
50
|
return {
|
|
63
51
|
height: '20px',
|
|
@@ -67,16 +55,14 @@ var LinkEditorOption = /*#__PURE__*/function (_React$Component) {
|
|
|
67
55
|
transform: 'scale(.8)'
|
|
68
56
|
};
|
|
69
57
|
};
|
|
70
|
-
|
|
71
58
|
return _this;
|
|
72
59
|
}
|
|
73
|
-
|
|
74
60
|
_createClass(LinkEditorOption, [{
|
|
75
61
|
key: "render",
|
|
76
62
|
value: function render() {
|
|
77
63
|
var _this$props = this.props,
|
|
78
|
-
|
|
79
|
-
|
|
64
|
+
option = _this$props.option,
|
|
65
|
+
isShowRemoveIcon = _this$props.isShowRemoveIcon;
|
|
80
66
|
var containerStyle = this.getContainerStyle();
|
|
81
67
|
var optionStyle = this.getOptionStyle();
|
|
82
68
|
var optionNameStyle = this.getOptionNameStyle();
|
|
@@ -104,10 +90,8 @@ var LinkEditorOption = /*#__PURE__*/function (_React$Component) {
|
|
|
104
90
|
})));
|
|
105
91
|
}
|
|
106
92
|
}]);
|
|
107
|
-
|
|
108
93
|
return LinkEditorOption;
|
|
109
94
|
}(React.Component);
|
|
110
|
-
|
|
111
95
|
LinkEditorOption.defaultProps = {
|
|
112
96
|
isShowRemoveIcon: false
|
|
113
97
|
};
|
|
@@ -7,25 +7,17 @@ import React from 'react';
|
|
|
7
7
|
import { getLocale } from '../../lang';
|
|
8
8
|
import MBEditorHeader from '../../MBEditorHeader';
|
|
9
9
|
import './index.css';
|
|
10
|
-
|
|
11
10
|
var MBLinkEditorPopover = /*#__PURE__*/function (_React$Component) {
|
|
12
11
|
_inherits(MBLinkEditorPopover, _React$Component);
|
|
13
|
-
|
|
14
12
|
var _super = _createSuper(MBLinkEditorPopover);
|
|
15
|
-
|
|
16
13
|
function MBLinkEditorPopover(props) {
|
|
17
14
|
var _this;
|
|
18
|
-
|
|
19
15
|
_classCallCheck(this, MBLinkEditorPopover);
|
|
20
|
-
|
|
21
16
|
_this = _super.call(this, props);
|
|
22
|
-
|
|
23
17
|
_this.handleHistaryBack = function (e) {
|
|
24
18
|
e.preventDefault();
|
|
25
|
-
|
|
26
19
|
_this.props.onClosePopover();
|
|
27
20
|
};
|
|
28
|
-
|
|
29
21
|
_this.onContainerClick = function (event) {
|
|
30
22
|
if (_this.editorPopover && _this.editorPopover.contains(event.target)) {
|
|
31
23
|
event.stopPropagation();
|
|
@@ -33,35 +25,27 @@ var MBLinkEditorPopover = /*#__PURE__*/function (_React$Component) {
|
|
|
33
25
|
return false;
|
|
34
26
|
}
|
|
35
27
|
};
|
|
36
|
-
|
|
37
28
|
_this.onChangeSearch = function (event) {
|
|
38
29
|
var searchVal = _this.state.searchVal;
|
|
39
|
-
|
|
40
30
|
if (searchVal === event.target.value) {
|
|
41
31
|
return;
|
|
42
32
|
}
|
|
43
|
-
|
|
44
33
|
searchVal = event.target.value;
|
|
45
|
-
|
|
46
34
|
_this.setState({
|
|
47
35
|
searchVal: searchVal
|
|
48
36
|
});
|
|
49
37
|
};
|
|
50
|
-
|
|
51
38
|
_this.getSelectedOptions = function () {
|
|
52
39
|
var _this$props = _this.props,
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
40
|
+
value = _this$props.value,
|
|
41
|
+
options = _this$props.options;
|
|
56
42
|
if (!Array.isArray(value)) {
|
|
57
43
|
return [];
|
|
58
44
|
}
|
|
59
|
-
|
|
60
45
|
return options.filter(function (option) {
|
|
61
46
|
return value.indexOf(option.email) > -1;
|
|
62
47
|
});
|
|
63
48
|
};
|
|
64
|
-
|
|
65
49
|
_this.getFilterOptions = function () {
|
|
66
50
|
var options = _this.props.options;
|
|
67
51
|
var searchVal = _this.state.searchVal;
|
|
@@ -69,15 +53,12 @@ var MBLinkEditorPopover = /*#__PURE__*/function (_React$Component) {
|
|
|
69
53
|
return item.name.indexOf(searchVal) > -1;
|
|
70
54
|
}) : options;
|
|
71
55
|
};
|
|
72
|
-
|
|
73
56
|
_this.onSelectOption = function (option) {
|
|
74
57
|
_this.props.onOptionItemToggle(option);
|
|
75
58
|
};
|
|
76
|
-
|
|
77
59
|
_this.onRemoveOption = function (option) {
|
|
78
60
|
_this.props.onOptionItemToggle(option);
|
|
79
61
|
};
|
|
80
|
-
|
|
81
62
|
_this.renderFilteredOptions = function (options) {
|
|
82
63
|
var value = _this.props.value;
|
|
83
64
|
return options.map(function (option, index) {
|
|
@@ -98,22 +79,18 @@ var MBLinkEditorPopover = /*#__PURE__*/function (_React$Component) {
|
|
|
98
79
|
}));
|
|
99
80
|
});
|
|
100
81
|
};
|
|
101
|
-
|
|
102
82
|
_this.setEditorPopover = function (editorPopover) {
|
|
103
83
|
_this.editorPopover = editorPopover;
|
|
104
84
|
};
|
|
105
|
-
|
|
106
85
|
_this.state = {
|
|
107
86
|
searchVal: ''
|
|
108
87
|
};
|
|
109
88
|
return _this;
|
|
110
89
|
}
|
|
111
|
-
|
|
112
90
|
_createClass(MBLinkEditorPopover, [{
|
|
113
91
|
key: "componentDidMount",
|
|
114
92
|
value: function componentDidMount() {
|
|
115
93
|
history.pushState(null, null, '#'); // eslint-disable-line
|
|
116
|
-
|
|
117
94
|
window.addEventListener('popstate', this.handleHistaryBack, false);
|
|
118
95
|
}
|
|
119
96
|
}, {
|
|
@@ -161,10 +138,8 @@ var MBLinkEditorPopover = /*#__PURE__*/function (_React$Component) {
|
|
|
161
138
|
}, getLocale('No_options_available')), filterOptions.length > 0 && this.renderFilteredOptions(filterOptions)))));
|
|
162
139
|
}
|
|
163
140
|
}]);
|
|
164
|
-
|
|
165
141
|
return MBLinkEditorPopover;
|
|
166
142
|
}(React.Component);
|
|
167
|
-
|
|
168
143
|
MBLinkEditorPopover.defaultProps = {
|
|
169
144
|
isReadOnly: false,
|
|
170
145
|
value: []
|
|
@@ -6,65 +6,49 @@ import _createSuper from "@babel/runtime/helpers/esm/createSuper";
|
|
|
6
6
|
import React from 'react';
|
|
7
7
|
import { getLocale } from '../../lang';
|
|
8
8
|
import './index.css';
|
|
9
|
-
|
|
10
9
|
var PCLinkEditorPopover = /*#__PURE__*/function (_React$Component) {
|
|
11
10
|
_inherits(PCLinkEditorPopover, _React$Component);
|
|
12
|
-
|
|
13
11
|
var _super = _createSuper(PCLinkEditorPopover);
|
|
14
|
-
|
|
15
12
|
function PCLinkEditorPopover(props) {
|
|
16
13
|
var _this;
|
|
17
|
-
|
|
18
14
|
_classCallCheck(this, PCLinkEditorPopover);
|
|
19
|
-
|
|
20
15
|
_this = _super.call(this, props);
|
|
21
|
-
|
|
22
16
|
_this.onValueChanged = function (event) {
|
|
23
17
|
var value = event.target.value;
|
|
24
|
-
|
|
25
18
|
_this.setState({
|
|
26
19
|
searchValue: value
|
|
27
20
|
});
|
|
28
21
|
};
|
|
29
|
-
|
|
30
22
|
_this.onInputClick = function (event) {
|
|
31
23
|
event.nativeEvent.stopImmediatePropagation();
|
|
32
24
|
event.stopPropagation();
|
|
33
25
|
};
|
|
34
|
-
|
|
35
26
|
_this.onOptionItemToggle = function (item) {
|
|
36
27
|
_this.props.onOptionItemToggle(item);
|
|
37
28
|
};
|
|
38
|
-
|
|
39
29
|
_this.getFilterOptions = function () {
|
|
40
30
|
var options = _this.props.options;
|
|
41
|
-
|
|
42
31
|
var filter = _this.state.searchValue.toLowerCase();
|
|
43
|
-
|
|
44
32
|
if (!filter) {
|
|
45
33
|
return options;
|
|
46
34
|
}
|
|
47
|
-
|
|
48
35
|
return options.filter(function (option) {
|
|
49
36
|
return option.name.toString().toLowerCase().indexOf(filter) > -1;
|
|
50
37
|
});
|
|
51
38
|
};
|
|
52
|
-
|
|
53
39
|
_this.state = {
|
|
54
40
|
searchValue: ''
|
|
55
41
|
};
|
|
56
42
|
return _this;
|
|
57
43
|
}
|
|
58
|
-
|
|
59
44
|
_createClass(PCLinkEditorPopover, [{
|
|
60
45
|
key: "render",
|
|
61
46
|
value: function render() {
|
|
62
47
|
var _this2 = this;
|
|
63
|
-
|
|
64
48
|
var options = this.getFilterOptions();
|
|
65
49
|
var _this$props = this.props,
|
|
66
|
-
|
|
67
|
-
|
|
50
|
+
popoverPosition = _this$props.popoverPosition,
|
|
51
|
+
selectedOptions = _this$props.selectedOptions;
|
|
68
52
|
var searchValue = this.state.searchValue;
|
|
69
53
|
var popoverStyle = Object.assign({}, _objectSpread({}, popoverPosition), {
|
|
70
54
|
position: 'absolute'
|
|
@@ -105,10 +89,8 @@ var PCLinkEditorPopover = /*#__PURE__*/function (_React$Component) {
|
|
|
105
89
|
}, getLocale('No_options_available'))));
|
|
106
90
|
}
|
|
107
91
|
}]);
|
|
108
|
-
|
|
109
92
|
return PCLinkEditorPopover;
|
|
110
93
|
}(React.Component);
|
|
111
|
-
|
|
112
94
|
PCLinkEditorPopover.defaultProps = {
|
|
113
95
|
popoverPosition: {},
|
|
114
96
|
options: []
|
|
@@ -6,62 +6,48 @@ import _createSuper from "@babel/runtime/helpers/esm/createSuper";
|
|
|
6
6
|
import React from 'react';
|
|
7
7
|
import classnames from 'classnames';
|
|
8
8
|
import { CellType, getNumberDisplayString, getDateDisplayString } from 'dtable-utils';
|
|
9
|
-
|
|
10
9
|
// link value is get form parant's interface
|
|
11
10
|
var LinkFormatter = /*#__PURE__*/function (_React$Component) {
|
|
12
11
|
_inherits(LinkFormatter, _React$Component);
|
|
13
|
-
|
|
14
12
|
var _super = _createSuper(LinkFormatter);
|
|
15
|
-
|
|
16
13
|
function LinkFormatter(props) {
|
|
17
14
|
var _this;
|
|
18
|
-
|
|
19
15
|
_classCallCheck(this, LinkFormatter);
|
|
20
|
-
|
|
21
16
|
_this = _super.call(this, props);
|
|
22
|
-
|
|
23
17
|
_this.getLinkedCellValue = function (row) {
|
|
24
18
|
if (!row) return [];
|
|
25
19
|
var _this$props = _this.props,
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
20
|
+
column = _this$props.column,
|
|
21
|
+
currentTableId = _this$props.currentTableId,
|
|
22
|
+
linkMetaData = _this$props.linkMetaData;
|
|
30
23
|
var _ref = column.data || {},
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
24
|
+
link_id = _ref.link_id,
|
|
25
|
+
table_id = _ref.table_id,
|
|
26
|
+
other_table_id = _ref.other_table_id;
|
|
35
27
|
_this.linkID = link_id;
|
|
36
28
|
_this.tableID = currentTableId === table_id ? table_id : other_table_id;
|
|
37
29
|
_this.otherTableID = _this.tableID === table_id ? other_table_id : table_id;
|
|
38
30
|
return linkMetaData.getLinkedCellValue(_this.linkID, _this.tableID, _this.otherTableID, row._id);
|
|
39
31
|
};
|
|
40
|
-
|
|
41
32
|
_this.expandLinkedTableRow = function (row) {
|
|
42
33
|
var _this$props2 = _this.props,
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
34
|
+
enableOpenLinkedRow = _this$props2.enableOpenLinkedRow,
|
|
35
|
+
linkMetaData = _this$props2.linkMetaData;
|
|
46
36
|
if (enableOpenLinkedRow) {
|
|
47
37
|
linkMetaData.expandLinkedTableRow(row, _this.otherTableID);
|
|
48
38
|
}
|
|
49
39
|
};
|
|
50
|
-
|
|
51
40
|
_this.getDisplayValues = function () {
|
|
52
41
|
var _this$props3 = _this.props,
|
|
53
|
-
|
|
54
|
-
|
|
42
|
+
column = _this$props3.column,
|
|
43
|
+
linkMetaData = _this$props3.linkMetaData;
|
|
55
44
|
var rowIds = _this.state.value;
|
|
56
|
-
|
|
57
45
|
if (rowIds && Array.isArray(rowIds) && rowIds.length > 0) {
|
|
58
46
|
var linkedTable = linkMetaData.getLinkedTable(_this.otherTableID);
|
|
59
47
|
var linkedRows = linkMetaData.getLinkedRows(_this.otherTableID, rowIds);
|
|
60
48
|
var result = linkedRows.map(function (row, index) {
|
|
61
49
|
var displayColumnKey = column.data.display_column_key;
|
|
62
|
-
|
|
63
50
|
var displayValue = _this.getDisplayValue(linkedTable, row, displayColumnKey);
|
|
64
|
-
|
|
65
51
|
return /*#__PURE__*/React.createElement("div", {
|
|
66
52
|
key: index,
|
|
67
53
|
className: "link-item",
|
|
@@ -73,35 +59,30 @@ var LinkFormatter = /*#__PURE__*/function (_React$Component) {
|
|
|
73
59
|
});
|
|
74
60
|
return result;
|
|
75
61
|
}
|
|
76
|
-
|
|
77
62
|
return null;
|
|
78
63
|
};
|
|
79
|
-
|
|
80
64
|
_this.getDisplayValue = function (linkedTable, row, displayColumnKey) {
|
|
81
65
|
var value = row[displayColumnKey];
|
|
82
66
|
var linkedColumn = linkedTable.columns.find(function (column) {
|
|
83
67
|
return column.key === displayColumnKey;
|
|
84
68
|
});
|
|
85
69
|
var type = linkedColumn.type,
|
|
86
|
-
|
|
87
|
-
|
|
70
|
+
data = linkedColumn.data;
|
|
71
|
+
// todo: improve
|
|
88
72
|
switch (type) {
|
|
89
73
|
case CellType.NUMBER:
|
|
90
74
|
{
|
|
91
75
|
return getNumberDisplayString(value, data);
|
|
92
76
|
}
|
|
93
|
-
|
|
94
77
|
case CellType.DATE:
|
|
95
78
|
{
|
|
96
79
|
var format = data.format;
|
|
97
80
|
return getDateDisplayString(value, format);
|
|
98
81
|
}
|
|
99
|
-
|
|
100
82
|
default:
|
|
101
83
|
return value;
|
|
102
84
|
}
|
|
103
85
|
};
|
|
104
|
-
|
|
105
86
|
_this.linkID = '';
|
|
106
87
|
_this.tableID = '';
|
|
107
88
|
_this.otherTableID = '';
|
|
@@ -110,12 +91,10 @@ var LinkFormatter = /*#__PURE__*/function (_React$Component) {
|
|
|
110
91
|
};
|
|
111
92
|
return _this;
|
|
112
93
|
}
|
|
113
|
-
|
|
114
94
|
_createClass(LinkFormatter, [{
|
|
115
95
|
key: "UNSAFE_componentWillReceiveProps",
|
|
116
96
|
value: function UNSAFE_componentWillReceiveProps(nextProps) {
|
|
117
97
|
var nextRow = nextProps.row;
|
|
118
|
-
|
|
119
98
|
if (nextRow._id !== this.props.row._id) {
|
|
120
99
|
this.setState({
|
|
121
100
|
value: this.getLinkedCellValue(nextRow)
|
|
@@ -133,10 +112,8 @@ var LinkFormatter = /*#__PURE__*/function (_React$Component) {
|
|
|
133
112
|
}, displayValues);
|
|
134
113
|
}
|
|
135
114
|
}]);
|
|
136
|
-
|
|
137
115
|
return LinkFormatter;
|
|
138
116
|
}(React.Component);
|
|
139
|
-
|
|
140
117
|
LinkFormatter.defaultProps = {
|
|
141
118
|
enableOpenLinkedRow: false,
|
|
142
119
|
currentTableId: '',
|
|
@@ -1,25 +1,21 @@
|
|
|
1
1
|
import React from 'react';
|
|
2
2
|
import HtmlLongTextFormatter from '../HtmlLongTextFormatter';
|
|
3
3
|
import SimpleLongTextFormatter from '../SimpleLongTextFormatter';
|
|
4
|
-
|
|
5
4
|
function LongTextFormatter(props) {
|
|
6
5
|
var isSample = props.isSample,
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
6
|
+
value = props.value,
|
|
7
|
+
containerClassName = props.containerClassName;
|
|
10
8
|
if (isSample) {
|
|
11
9
|
return /*#__PURE__*/React.createElement(SimpleLongTextFormatter, {
|
|
12
10
|
value: value,
|
|
13
11
|
containerClassName: containerClassName
|
|
14
12
|
});
|
|
15
13
|
}
|
|
16
|
-
|
|
17
14
|
return /*#__PURE__*/React.createElement(HtmlLongTextFormatter, {
|
|
18
15
|
value: value,
|
|
19
16
|
containerClassName: containerClassName
|
|
20
17
|
});
|
|
21
18
|
}
|
|
22
|
-
|
|
23
19
|
LongTextFormatter.defaultProps = {
|
|
24
20
|
isSample: true
|
|
25
21
|
};
|
|
@@ -3,28 +3,23 @@ import _createClass from "@babel/runtime/helpers/esm/createClass";
|
|
|
3
3
|
import _inherits from "@babel/runtime/helpers/esm/inherits";
|
|
4
4
|
import _createSuper from "@babel/runtime/helpers/esm/createSuper";
|
|
5
5
|
import React from 'react';
|
|
6
|
-
|
|
7
6
|
var MBEditorHeader = /*#__PURE__*/function (_React$Component) {
|
|
8
7
|
_inherits(MBEditorHeader, _React$Component);
|
|
9
|
-
|
|
10
8
|
var _super = _createSuper(MBEditorHeader);
|
|
11
|
-
|
|
12
9
|
function MBEditorHeader() {
|
|
13
10
|
_classCallCheck(this, MBEditorHeader);
|
|
14
|
-
|
|
15
11
|
return _super.apply(this, arguments);
|
|
16
12
|
}
|
|
17
|
-
|
|
18
13
|
_createClass(MBEditorHeader, [{
|
|
19
14
|
key: "render",
|
|
20
15
|
value: function render() {
|
|
21
16
|
var _this$props = this.props,
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
17
|
+
title = _this$props.title,
|
|
18
|
+
titleClass = _this$props.titleClass,
|
|
19
|
+
leftContent = _this$props.leftContent,
|
|
20
|
+
rightContent = _this$props.rightContent,
|
|
21
|
+
onLeftClick = _this$props.onLeftClick,
|
|
22
|
+
onRightClick = _this$props.onRightClick;
|
|
28
23
|
return /*#__PURE__*/React.createElement("div", {
|
|
29
24
|
className: "dtable-ui-mb-editor-header ".concat(titleClass ? titleClass : '')
|
|
30
25
|
}, /*#__PURE__*/React.createElement("span", {
|
|
@@ -41,8 +36,6 @@ var MBEditorHeader = /*#__PURE__*/function (_React$Component) {
|
|
|
41
36
|
}, rightContent));
|
|
42
37
|
}
|
|
43
38
|
}]);
|
|
44
|
-
|
|
45
39
|
return MBEditorHeader;
|
|
46
40
|
}(React.Component);
|
|
47
|
-
|
|
48
41
|
export default MBEditorHeader;
|
|
@@ -6,51 +6,38 @@ import React from 'react';
|
|
|
6
6
|
import classnames from 'classnames';
|
|
7
7
|
import dayjs from 'dayjs';
|
|
8
8
|
import './index.css';
|
|
9
|
-
|
|
10
9
|
var MTimeFormatter = /*#__PURE__*/function (_React$Component) {
|
|
11
10
|
_inherits(MTimeFormatter, _React$Component);
|
|
12
|
-
|
|
13
11
|
var _super = _createSuper(MTimeFormatter);
|
|
14
|
-
|
|
15
12
|
function MTimeFormatter() {
|
|
16
13
|
var _this;
|
|
17
|
-
|
|
18
14
|
_classCallCheck(this, MTimeFormatter);
|
|
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.formatDate = function (date) {
|
|
27
20
|
return dayjs(date).format('YYYY-MM-DD HH:mm:ss');
|
|
28
21
|
};
|
|
29
|
-
|
|
30
22
|
return _this;
|
|
31
23
|
}
|
|
32
|
-
|
|
33
24
|
_createClass(MTimeFormatter, [{
|
|
34
25
|
key: "render",
|
|
35
26
|
value: function render() {
|
|
36
27
|
var _this$props = this.props,
|
|
37
|
-
|
|
38
|
-
|
|
28
|
+
date = _this$props.value,
|
|
29
|
+
containerClassName = _this$props.containerClassName;
|
|
39
30
|
var classname = classnames('dtable-ui cell-formatter-container ctime-formatter', containerClassName);
|
|
40
|
-
|
|
41
31
|
if (date !== '') {
|
|
42
32
|
date = this.formatDate(date);
|
|
43
33
|
}
|
|
44
|
-
|
|
45
34
|
return /*#__PURE__*/React.createElement("div", {
|
|
46
35
|
className: classname
|
|
47
36
|
}, date);
|
|
48
37
|
}
|
|
49
38
|
}]);
|
|
50
|
-
|
|
51
39
|
return MTimeFormatter;
|
|
52
40
|
}(React.Component);
|
|
53
|
-
|
|
54
41
|
MTimeFormatter.defaultProps = {
|
|
55
42
|
value: '',
|
|
56
43
|
containerClassName: ''
|
package/lib/ModalPortal/index.js
CHANGED
|
@@ -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 default ModalPortal;
|