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,92 +1,84 @@
|
|
|
1
|
-
import _objectSpread from "@babel/runtime/helpers/esm/objectSpread2";
|
|
2
|
-
import _classCallCheck from "@babel/runtime/helpers/esm/classCallCheck";
|
|
3
|
-
import _createClass from "@babel/runtime/helpers/esm/createClass";
|
|
4
|
-
import _inherits from "@babel/runtime/helpers/esm/inherits";
|
|
5
|
-
import _createSuper from "@babel/runtime/helpers/esm/createSuper";
|
|
6
1
|
import React from 'react';
|
|
7
2
|
import { getLocale } from '../../lang';
|
|
8
3
|
import CollaboratorItem from '../../CollaboratorItem';
|
|
9
4
|
import './index.css';
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
_this = _super.call(this, props);
|
|
17
|
-
_this.onValueChanged = function (event) {
|
|
18
|
-
var value = event.target.value;
|
|
19
|
-
_this.setState({
|
|
5
|
+
class PCCollaboratorEditorPopover extends React.Component {
|
|
6
|
+
constructor(props) {
|
|
7
|
+
super(props);
|
|
8
|
+
this.onValueChanged = event => {
|
|
9
|
+
let value = event.target.value;
|
|
10
|
+
this.setState({
|
|
20
11
|
searchValue: value
|
|
21
12
|
});
|
|
22
13
|
};
|
|
23
|
-
|
|
14
|
+
this.onInputClick = event => {
|
|
24
15
|
event.nativeEvent.stopImmediatePropagation();
|
|
25
16
|
event.stopPropagation();
|
|
26
17
|
};
|
|
27
|
-
|
|
28
|
-
|
|
18
|
+
this.onCollaboratorItemToggle = item => {
|
|
19
|
+
this.props.onCollaboratorItemToggle(item);
|
|
29
20
|
};
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
21
|
+
this.getFilterCollaborator = () => {
|
|
22
|
+
let {
|
|
23
|
+
collaborators
|
|
24
|
+
} = this.props;
|
|
25
|
+
let filter = this.state.searchValue.toLowerCase();
|
|
33
26
|
if (!filter) {
|
|
34
27
|
return collaborators;
|
|
35
28
|
}
|
|
36
|
-
return collaborators.filter(
|
|
29
|
+
return collaborators.filter(collaborator => {
|
|
37
30
|
return collaborator.name.toString().toLowerCase().indexOf(filter) > -1;
|
|
38
31
|
});
|
|
39
32
|
};
|
|
40
|
-
|
|
33
|
+
this.state = {
|
|
41
34
|
searchValue: ''
|
|
42
35
|
};
|
|
43
|
-
return _this;
|
|
44
36
|
}
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
37
|
+
render() {
|
|
38
|
+
let {
|
|
39
|
+
searchValue
|
|
40
|
+
} = this.state;
|
|
41
|
+
let {
|
|
42
|
+
selectedCollaborators,
|
|
43
|
+
popoverPosition
|
|
44
|
+
} = this.props;
|
|
45
|
+
let collaborators = this.getFilterCollaborator();
|
|
46
|
+
let popoverStyle = Object.assign({}, {
|
|
47
|
+
...popoverPosition
|
|
48
|
+
}, {
|
|
49
|
+
position: 'absolute'
|
|
50
|
+
});
|
|
51
|
+
return /*#__PURE__*/React.createElement("div", {
|
|
52
|
+
className: "dtable-ui-editor-popover dtable-ui-collaborator-editor-popover",
|
|
53
|
+
style: popoverStyle
|
|
54
|
+
}, /*#__PURE__*/React.createElement("div", {
|
|
55
|
+
className: "collaborator-search-container"
|
|
56
|
+
}, /*#__PURE__*/React.createElement("input", {
|
|
57
|
+
className: "form-control",
|
|
58
|
+
value: searchValue,
|
|
59
|
+
onChange: this.onValueChanged,
|
|
60
|
+
onClick: this.onInputClick,
|
|
61
|
+
placeholder: getLocale('Find_a_collaborator')
|
|
62
|
+
})), /*#__PURE__*/React.createElement("div", {
|
|
63
|
+
className: "collaborator-list-container"
|
|
64
|
+
}, collaborators.length > 0 && collaborators.map((collaborator, index) => {
|
|
65
|
+
const isSelect = selectedCollaborators.some(selectedCollaborator => {
|
|
66
|
+
return selectedCollaborator.email === collaborator.email;
|
|
56
67
|
});
|
|
57
68
|
return /*#__PURE__*/React.createElement("div", {
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
});
|
|
74
|
-
return /*#__PURE__*/React.createElement("div", {
|
|
75
|
-
key: index,
|
|
76
|
-
className: "collaborator-item-container",
|
|
77
|
-
onClick: _this2.onCollaboratorItemToggle.bind(_this2, collaborator)
|
|
78
|
-
}, /*#__PURE__*/React.createElement(CollaboratorItem, {
|
|
79
|
-
collaborator: collaborator
|
|
80
|
-
}), /*#__PURE__*/React.createElement("div", {
|
|
81
|
-
className: "collaborator-checked"
|
|
82
|
-
}, isSelect && /*#__PURE__*/React.createElement("i", {
|
|
83
|
-
className: "dtable-font dtable-icon-check-mark"
|
|
84
|
-
})));
|
|
85
|
-
}), collaborators.length === 0 && /*#__PURE__*/React.createElement("div", {
|
|
86
|
-
className: "search-option-null"
|
|
87
|
-
}, getLocale('No_collaborators_available'))));
|
|
88
|
-
}
|
|
89
|
-
}]);
|
|
90
|
-
return PCCollaboratorEditorPopover;
|
|
91
|
-
}(React.Component);
|
|
69
|
+
key: index,
|
|
70
|
+
className: "collaborator-item-container",
|
|
71
|
+
onClick: this.onCollaboratorItemToggle.bind(this, collaborator)
|
|
72
|
+
}, /*#__PURE__*/React.createElement(CollaboratorItem, {
|
|
73
|
+
collaborator: collaborator
|
|
74
|
+
}), /*#__PURE__*/React.createElement("div", {
|
|
75
|
+
className: "collaborator-checked"
|
|
76
|
+
}, isSelect && /*#__PURE__*/React.createElement("i", {
|
|
77
|
+
className: "dtable-font dtable-icon-check-mark"
|
|
78
|
+
})));
|
|
79
|
+
}), collaborators.length === 0 && /*#__PURE__*/React.createElement("div", {
|
|
80
|
+
className: "search-option-null"
|
|
81
|
+
}, getLocale('No_collaborators_available'))));
|
|
82
|
+
}
|
|
83
|
+
}
|
|
92
84
|
export default PCCollaboratorEditorPopover;
|
|
@@ -1,7 +1,3 @@
|
|
|
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 CollaboratorItem from '../CollaboratorItem';
|
|
@@ -12,29 +8,21 @@ import './index.css';
|
|
|
12
8
|
// 2 value is exist, but can't find in collaborators
|
|
13
9
|
// 3 value is exist, typeof value is a string
|
|
14
10
|
// 4 value is exist, typeof value is array
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
_this.getCollaborators = function () {
|
|
26
|
-
var _this$props = _this.props,
|
|
27
|
-
value = _this$props.value,
|
|
28
|
-
collaborators = _this$props.collaborators,
|
|
29
|
-
enableDeleteCollaborator = _this$props.enableDeleteCollaborator,
|
|
30
|
-
onDeleteCollaborator = _this$props.onDeleteCollaborator;
|
|
11
|
+
class CollaboratorFormatter extends React.PureComponent {
|
|
12
|
+
constructor() {
|
|
13
|
+
super(...arguments);
|
|
14
|
+
this.getCollaborators = () => {
|
|
15
|
+
let {
|
|
16
|
+
value,
|
|
17
|
+
collaborators,
|
|
18
|
+
enableDeleteCollaborator,
|
|
19
|
+
onDeleteCollaborator
|
|
20
|
+
} = this.props;
|
|
31
21
|
if (!Array.isArray(value)) {
|
|
32
22
|
value = [value];
|
|
33
23
|
}
|
|
34
|
-
return value.map(
|
|
35
|
-
|
|
36
|
-
return collaborator.email === item;
|
|
37
|
-
});
|
|
24
|
+
return value.map((item, index) => {
|
|
25
|
+
let collaborator = collaborators.find(collaborator => collaborator.email === item);
|
|
38
26
|
if (!collaborator) {
|
|
39
27
|
collaborator = {
|
|
40
28
|
name: item,
|
|
@@ -49,28 +37,24 @@ var CollaboratorFormatter = /*#__PURE__*/function (_React$PureComponent) {
|
|
|
49
37
|
});
|
|
50
38
|
});
|
|
51
39
|
};
|
|
52
|
-
return _this;
|
|
53
40
|
}
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
if (!value || Array.isArray(value) && value.length === 0) {
|
|
62
|
-
return /*#__PURE__*/React.createElement("div", {
|
|
63
|
-
className: classname
|
|
64
|
-
});
|
|
65
|
-
}
|
|
66
|
-
var collaborators = this.getCollaborators();
|
|
41
|
+
render() {
|
|
42
|
+
const {
|
|
43
|
+
containerClassName,
|
|
44
|
+
value
|
|
45
|
+
} = this.props;
|
|
46
|
+
const classname = classnames('dtable-ui cell-formatter-container collaborator-formatter', containerClassName);
|
|
47
|
+
if (!value || Array.isArray(value) && value.length === 0) {
|
|
67
48
|
return /*#__PURE__*/React.createElement("div", {
|
|
68
49
|
className: classname
|
|
69
|
-
}
|
|
50
|
+
});
|
|
70
51
|
}
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
52
|
+
const collaborators = this.getCollaborators();
|
|
53
|
+
return /*#__PURE__*/React.createElement("div", {
|
|
54
|
+
className: classname
|
|
55
|
+
}, collaborators);
|
|
56
|
+
}
|
|
57
|
+
}
|
|
74
58
|
CollaboratorFormatter.defaultProps = {
|
|
75
59
|
value: []
|
|
76
60
|
};
|
|
@@ -1,51 +1,38 @@
|
|
|
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 './index.css';
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
}
|
|
16
|
-
_this = _super.call.apply(_super, [this].concat(args));
|
|
17
|
-
_this.onDeleteCollaborator = function () {
|
|
18
|
-
var collaborator = _this.props.collaborator;
|
|
19
|
-
_this.props.onDeleteCollaborator(collaborator);
|
|
3
|
+
class CollaboratorItem extends React.Component {
|
|
4
|
+
constructor() {
|
|
5
|
+
super(...arguments);
|
|
6
|
+
this.onDeleteCollaborator = () => {
|
|
7
|
+
let {
|
|
8
|
+
collaborator
|
|
9
|
+
} = this.props;
|
|
10
|
+
this.props.onDeleteCollaborator(collaborator);
|
|
20
11
|
};
|
|
21
|
-
return _this;
|
|
22
12
|
}
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
}]);
|
|
47
|
-
return CollaboratorItem;
|
|
48
|
-
}(React.Component);
|
|
13
|
+
render() {
|
|
14
|
+
const {
|
|
15
|
+
collaborator,
|
|
16
|
+
enableDeleteCollaborator
|
|
17
|
+
} = this.props;
|
|
18
|
+
return /*#__PURE__*/React.createElement("div", {
|
|
19
|
+
className: "dtable-ui collaborator-item"
|
|
20
|
+
}, /*#__PURE__*/React.createElement("span", {
|
|
21
|
+
className: "collaborator-avatar"
|
|
22
|
+
}, /*#__PURE__*/React.createElement("img", {
|
|
23
|
+
className: "collaborator-avatar-icon",
|
|
24
|
+
alt: collaborator.name,
|
|
25
|
+
src: collaborator.avatar_url
|
|
26
|
+
})), /*#__PURE__*/React.createElement("span", {
|
|
27
|
+
className: "collaborator-name"
|
|
28
|
+
}, collaborator.name), enableDeleteCollaborator && /*#__PURE__*/React.createElement("span", {
|
|
29
|
+
className: "collaborator-remove",
|
|
30
|
+
onClick: this.onDeleteCollaborator
|
|
31
|
+
}, /*#__PURE__*/React.createElement("i", {
|
|
32
|
+
className: "dtable-font dtable-icon-fork-number"
|
|
33
|
+
})));
|
|
34
|
+
}
|
|
35
|
+
}
|
|
49
36
|
CollaboratorItem.defaultProps = {
|
|
50
37
|
enableDelete: false
|
|
51
38
|
};
|
|
@@ -1,7 +1,3 @@
|
|
|
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 CollaboratorItem from '../CollaboratorItem';
|
|
@@ -12,27 +8,19 @@ import './index.css';
|
|
|
12
8
|
// 2 value is exist, but can't find in collaborators
|
|
13
9
|
// 3 value is exist, typeof value is a string
|
|
14
10
|
// 4 value is exist, typeof value is array
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
}
|
|
24
|
-
_this = _super.call.apply(_super, [this].concat(args));
|
|
25
|
-
_this.getCollaborators = function () {
|
|
26
|
-
var _this$props = _this.props,
|
|
27
|
-
value = _this$props.value,
|
|
28
|
-
collaborators = _this$props.collaborators;
|
|
11
|
+
class CreatorFormatter extends React.PureComponent {
|
|
12
|
+
constructor() {
|
|
13
|
+
super(...arguments);
|
|
14
|
+
this.getCollaborators = () => {
|
|
15
|
+
let {
|
|
16
|
+
value,
|
|
17
|
+
collaborators
|
|
18
|
+
} = this.props;
|
|
29
19
|
if (!Array.isArray(value)) {
|
|
30
20
|
value = [value];
|
|
31
21
|
}
|
|
32
|
-
return value.map(
|
|
33
|
-
|
|
34
|
-
return collaborator.email === item;
|
|
35
|
-
});
|
|
22
|
+
return value.map((item, index) => {
|
|
23
|
+
let collaborator = collaborators.find(collaborator => collaborator.email === item);
|
|
36
24
|
// the collaborator can be not exist, because the row created by third app
|
|
37
25
|
if (!collaborator) {
|
|
38
26
|
collaborator = {
|
|
@@ -46,28 +34,24 @@ var CreatorFormatter = /*#__PURE__*/function (_React$PureComponent) {
|
|
|
46
34
|
});
|
|
47
35
|
});
|
|
48
36
|
};
|
|
49
|
-
return _this;
|
|
50
37
|
}
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
if (!value || Array.isArray(value) && value.length === 0) {
|
|
59
|
-
return /*#__PURE__*/React.createElement("div", {
|
|
60
|
-
className: classname
|
|
61
|
-
});
|
|
62
|
-
}
|
|
63
|
-
var collaborators = this.getCollaborators();
|
|
38
|
+
render() {
|
|
39
|
+
const {
|
|
40
|
+
containerClassName,
|
|
41
|
+
value
|
|
42
|
+
} = this.props;
|
|
43
|
+
const classname = classnames('dtable-ui cell-formatter-container creator-formatter', containerClassName);
|
|
44
|
+
if (!value || Array.isArray(value) && value.length === 0) {
|
|
64
45
|
return /*#__PURE__*/React.createElement("div", {
|
|
65
46
|
className: classname
|
|
66
|
-
}
|
|
47
|
+
});
|
|
67
48
|
}
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
49
|
+
const collaborators = this.getCollaborators();
|
|
50
|
+
return /*#__PURE__*/React.createElement("div", {
|
|
51
|
+
className: classname
|
|
52
|
+
}, collaborators);
|
|
53
|
+
}
|
|
54
|
+
}
|
|
71
55
|
CreatorFormatter.defaultProps = {
|
|
72
56
|
value: ''
|
|
73
57
|
};
|