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,45 +1,32 @@
|
|
|
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 { getTrimmedString } from '../utils/editor-utils';
|
|
8
4
|
import './index.css';
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
}
|
|
18
|
-
_this = _super.call.apply(_super, [this].concat(args));
|
|
19
|
-
_this.onOpenEmailLink = function () {
|
|
20
|
-
var value = _this.props.value;
|
|
21
|
-
var newValue = value.trim();
|
|
5
|
+
class RowExpandEmailFormatter extends React.Component {
|
|
6
|
+
constructor() {
|
|
7
|
+
super(...arguments);
|
|
8
|
+
this.onOpenEmailLink = () => {
|
|
9
|
+
const {
|
|
10
|
+
value
|
|
11
|
+
} = this.props;
|
|
12
|
+
let newValue = value.trim();
|
|
22
13
|
window.location.href = "mailto:".concat(newValue);
|
|
23
14
|
};
|
|
24
|
-
return _this;
|
|
25
15
|
}
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
}]);
|
|
43
|
-
return RowExpandEmailFormatter;
|
|
44
|
-
}(React.Component);
|
|
16
|
+
render() {
|
|
17
|
+
const {
|
|
18
|
+
containerClassName,
|
|
19
|
+
value
|
|
20
|
+
} = this.props;
|
|
21
|
+
let classname = classnames('dtable-ui cell-formatter-container email-formatter', containerClassName);
|
|
22
|
+
return /*#__PURE__*/React.createElement("div", {
|
|
23
|
+
className: classname
|
|
24
|
+
}, /*#__PURE__*/React.createElement("span", {
|
|
25
|
+
className: "email-formatter-value text-truncate"
|
|
26
|
+
}, value), getTrimmedString(value) && /*#__PURE__*/React.createElement("span", {
|
|
27
|
+
className: "dtable-font dtable-icon-email row-expand-jump-link",
|
|
28
|
+
onClick: this.onOpenEmailLink
|
|
29
|
+
}));
|
|
30
|
+
}
|
|
31
|
+
}
|
|
45
32
|
export default RowExpandEmailFormatter;
|
|
@@ -1,50 +1,36 @@
|
|
|
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 classname from 'classnames';
|
|
7
3
|
import RowExpandFileItemFormatter from './row-expand-file-item-formatter';
|
|
8
4
|
import './index.css';
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
containerClassName = _this$props.containerClassName,
|
|
22
|
-
column = _this$props.column,
|
|
23
|
-
downloadFile = _this$props.downloadFile,
|
|
24
|
-
deleteFile = _this$props.deleteFile,
|
|
25
|
-
readOnly = _this$props.readOnly;
|
|
26
|
-
if (!Array.isArray(value) || value.length === 0) {
|
|
27
|
-
return null;
|
|
28
|
-
}
|
|
29
|
-
return /*#__PURE__*/React.createElement("div", {
|
|
30
|
-
className: classname('dtable-ui cell-formatter-container row-expand-file-formatter', containerClassName)
|
|
31
|
-
}, value.map(function (item, index) {
|
|
32
|
-
return /*#__PURE__*/React.createElement(RowExpandFileItemFormatter, {
|
|
33
|
-
file: item,
|
|
34
|
-
key: index,
|
|
35
|
-
index: index,
|
|
36
|
-
column: column,
|
|
37
|
-
downloadFile: downloadFile,
|
|
38
|
-
deleteFile: deleteFile,
|
|
39
|
-
readOnly: readOnly
|
|
40
|
-
});
|
|
41
|
-
}));
|
|
5
|
+
export default class RowExpandFileFormatter extends React.PureComponent {
|
|
6
|
+
render() {
|
|
7
|
+
let {
|
|
8
|
+
value,
|
|
9
|
+
containerClassName,
|
|
10
|
+
column,
|
|
11
|
+
downloadFile,
|
|
12
|
+
deleteFile,
|
|
13
|
+
readOnly
|
|
14
|
+
} = this.props;
|
|
15
|
+
if (!Array.isArray(value) || value.length === 0) {
|
|
16
|
+
return null;
|
|
42
17
|
}
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
}(
|
|
18
|
+
return /*#__PURE__*/React.createElement("div", {
|
|
19
|
+
className: classname('dtable-ui cell-formatter-container row-expand-file-formatter', containerClassName)
|
|
20
|
+
}, value.map((item, index) => {
|
|
21
|
+
return /*#__PURE__*/React.createElement(RowExpandFileItemFormatter, {
|
|
22
|
+
file: item,
|
|
23
|
+
key: index,
|
|
24
|
+
index: index,
|
|
25
|
+
column: column,
|
|
26
|
+
downloadFile: downloadFile,
|
|
27
|
+
deleteFile: deleteFile,
|
|
28
|
+
readOnly: readOnly
|
|
29
|
+
});
|
|
30
|
+
}));
|
|
31
|
+
}
|
|
32
|
+
}
|
|
46
33
|
RowExpandFileFormatter.defaultProps = {
|
|
47
34
|
value: [],
|
|
48
35
|
containerClassName: ''
|
|
49
|
-
};
|
|
50
|
-
export { RowExpandFileFormatter as default };
|
|
36
|
+
};
|
|
@@ -1,107 +1,91 @@
|
|
|
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, { Component } from 'react';
|
|
6
2
|
import { Tooltip } from 'reactstrap';
|
|
7
3
|
import { getLocale } from '../lang';
|
|
8
4
|
import { getFileIconUrl } from '../FileItemFormatter/utils';
|
|
9
5
|
import DeleteTip from '../common/delete-tip';
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
_this = _super.call(this, props);
|
|
17
|
-
_this.toggleTooltip = function () {
|
|
18
|
-
_this.setState({
|
|
19
|
-
isTooltipOpen: !_this.state.isTooltipOpen
|
|
6
|
+
export default class RowExpandFileItemFormatter extends Component {
|
|
7
|
+
constructor(props) {
|
|
8
|
+
super(props);
|
|
9
|
+
this.toggleTooltip = () => {
|
|
10
|
+
this.setState({
|
|
11
|
+
isTooltipOpen: !this.state.isTooltipOpen
|
|
20
12
|
});
|
|
21
13
|
};
|
|
22
|
-
|
|
23
|
-
|
|
14
|
+
this.closeDeleteTip = () => {
|
|
15
|
+
this.setState({
|
|
24
16
|
isDeleteTipOpen: false
|
|
25
17
|
});
|
|
26
18
|
};
|
|
27
|
-
|
|
19
|
+
this.onClickDelete = e => {
|
|
28
20
|
e.stopPropagation();
|
|
29
|
-
|
|
21
|
+
this.position = {
|
|
30
22
|
top: e.clientY,
|
|
31
23
|
left: e.clientX
|
|
32
24
|
};
|
|
33
|
-
|
|
25
|
+
this.setState({
|
|
34
26
|
isDeleteTipOpen: true
|
|
35
27
|
});
|
|
36
28
|
};
|
|
37
|
-
|
|
29
|
+
this.onDelete = e => {
|
|
38
30
|
e.stopPropagation();
|
|
39
|
-
|
|
40
|
-
|
|
31
|
+
this.closeDeleteTip();
|
|
32
|
+
this.props.deleteFile(this.props.index);
|
|
41
33
|
};
|
|
42
|
-
|
|
43
|
-
|
|
34
|
+
this.getFileIconData = item => {
|
|
35
|
+
let fileIconUrl = getFileIconUrl(item.name, item.type);
|
|
44
36
|
return require('../FileItemFormatter/' + fileIconUrl);
|
|
45
37
|
};
|
|
46
|
-
|
|
38
|
+
this.state = {
|
|
47
39
|
isTooltipOpen: false,
|
|
48
40
|
isDeleteTipOpen: false
|
|
49
41
|
};
|
|
50
|
-
return _this;
|
|
51
42
|
}
|
|
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
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
fade: false
|
|
102
|
-
}, file.name));
|
|
103
|
-
}
|
|
104
|
-
}]);
|
|
105
|
-
return RowExpandFileItemFormatter;
|
|
106
|
-
}(Component);
|
|
107
|
-
export { RowExpandFileItemFormatter as default };
|
|
43
|
+
render() {
|
|
44
|
+
const {
|
|
45
|
+
file,
|
|
46
|
+
column,
|
|
47
|
+
index,
|
|
48
|
+
readOnly,
|
|
49
|
+
downloadFile,
|
|
50
|
+
deleteFile
|
|
51
|
+
} = this.props;
|
|
52
|
+
const id = 'file-list-preview-item' + column.key + index;
|
|
53
|
+
const url = this.getFileIconData(file);
|
|
54
|
+
return /*#__PURE__*/React.createElement(React.Fragment, null, /*#__PURE__*/React.createElement("div", {
|
|
55
|
+
key: "file-".concat(index),
|
|
56
|
+
className: "row-expand-item-file",
|
|
57
|
+
id: id
|
|
58
|
+
}, /*#__PURE__*/React.createElement("img", {
|
|
59
|
+
src: url,
|
|
60
|
+
id: "item-file-".concat(index),
|
|
61
|
+
alt: file.name
|
|
62
|
+
}), /*#__PURE__*/React.createElement("div", {
|
|
63
|
+
className: "dtable-file-icons-choice"
|
|
64
|
+
}, downloadFile && /*#__PURE__*/React.createElement("span", {
|
|
65
|
+
className: "file-icon",
|
|
66
|
+
onClick: e => this.props.downloadFile(file, e)
|
|
67
|
+
}, /*#__PURE__*/React.createElement("i", {
|
|
68
|
+
className: "dtable-font dtable-icon-download"
|
|
69
|
+
})), !readOnly && deleteFile && /*#__PURE__*/React.createElement("span", {
|
|
70
|
+
className: "file-icon",
|
|
71
|
+
onClick: this.onClickDelete
|
|
72
|
+
}, /*#__PURE__*/React.createElement("i", {
|
|
73
|
+
className: "dtable-font dtable-icon-fork-number"
|
|
74
|
+
})))), this.state.isDeleteTipOpen && /*#__PURE__*/React.createElement(DeleteTip, {
|
|
75
|
+
position: this.position,
|
|
76
|
+
toggle: this.closeDeleteTip,
|
|
77
|
+
onDelete: this.onDelete,
|
|
78
|
+
deleteTip: getLocale('Are_you_sure_you_want_to_delete_this_file')
|
|
79
|
+
}), /*#__PURE__*/React.createElement(Tooltip, {
|
|
80
|
+
placement: "bottom",
|
|
81
|
+
isOpen: this.state.isTooltipOpen,
|
|
82
|
+
toggle: this.toggleTooltip,
|
|
83
|
+
target: id,
|
|
84
|
+
delay: {
|
|
85
|
+
show: 0,
|
|
86
|
+
hide: 0
|
|
87
|
+
},
|
|
88
|
+
fade: false
|
|
89
|
+
}, file.name));
|
|
90
|
+
}
|
|
91
|
+
}
|
|
@@ -1,71 +1,70 @@
|
|
|
1
|
-
import _defineProperty from "@babel/runtime/helpers/esm/defineProperty";
|
|
2
|
-
import _objectSpread from "@babel/runtime/helpers/esm/objectSpread2";
|
|
3
|
-
import _classCallCheck from "@babel/runtime/helpers/esm/classCallCheck";
|
|
4
|
-
import _createClass from "@babel/runtime/helpers/esm/createClass";
|
|
5
|
-
import _inherits from "@babel/runtime/helpers/esm/inherits";
|
|
6
|
-
import _createSuper from "@babel/runtime/helpers/esm/createSuper";
|
|
7
1
|
import React from 'react';
|
|
8
2
|
import classnames from 'classnames';
|
|
9
3
|
import { TextFormatter, NumberFormatter, CheckboxFormatter, DateFormatter, SingleSelectFormatter, MultipleSelectFormatter, CollaboratorFormatter, LongTextFormatter, GeolocationFormatter, CTimeFormatter, CreatorFormatter, LastModifierFormatter, MTimeFormatter, AutoNumberFormatter, DurationFormatter, ButtonFormatter, RowExpandUrlFormatter, RowExpandEmailFormatter, RowExpandRateFormatter, RowExpandImageFormatter, RowExpandFileFormatter, RowExpandLinkFormatter, RowExpandFormulaFormatter, DigitalSignFormatter, DepartmentSingleSelectFormatter } from '../index';
|
|
10
4
|
import { CellType } from '../constants';
|
|
11
5
|
import './index.css';
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
_this = _super.call(this, _props);
|
|
19
|
-
_this.updateCollaborators = function () {
|
|
20
|
-
_this.setState({
|
|
21
|
-
collaborators: _this.getCollaborator()
|
|
6
|
+
export default class EditorFormatter extends React.Component {
|
|
7
|
+
constructor(_props) {
|
|
8
|
+
super(_props);
|
|
9
|
+
this.updateCollaborators = () => {
|
|
10
|
+
this.setState({
|
|
11
|
+
collaborators: this.getCollaborator()
|
|
22
12
|
});
|
|
23
13
|
};
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
14
|
+
this.calculateCollaboratorData = props => {
|
|
15
|
+
const {
|
|
16
|
+
row,
|
|
17
|
+
column
|
|
18
|
+
} = props;
|
|
27
19
|
if (column.type === CellType.CREATOR || column.type === CellType.LAST_MODIFIER) {
|
|
28
|
-
|
|
29
|
-
|
|
20
|
+
const email = row[column.name];
|
|
21
|
+
this.loadCollaborator(email);
|
|
30
22
|
} else if (column.type === CellType.COLLABORATOR) {
|
|
31
|
-
|
|
23
|
+
const emails = row[column.name];
|
|
32
24
|
if (Array.isArray(emails)) {
|
|
33
|
-
emails.forEach(
|
|
34
|
-
|
|
25
|
+
emails.forEach(email => {
|
|
26
|
+
this.loadCollaborator(email);
|
|
35
27
|
});
|
|
36
28
|
}
|
|
37
29
|
}
|
|
38
30
|
};
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
context
|
|
42
|
-
collaborators
|
|
31
|
+
this.getCollaborator = () => {
|
|
32
|
+
const {
|
|
33
|
+
context,
|
|
34
|
+
collaborators
|
|
35
|
+
} = this.props;
|
|
43
36
|
if (context && context.getCollaboratorsFromCache) {
|
|
44
37
|
return context.getCollaboratorsFromCache();
|
|
45
38
|
}
|
|
46
39
|
return collaborators || [];
|
|
47
40
|
};
|
|
48
|
-
|
|
49
|
-
|
|
41
|
+
this.loadCollaborator = email => {
|
|
42
|
+
const {
|
|
43
|
+
context
|
|
44
|
+
} = this.props;
|
|
50
45
|
if (context && context.loadCollaborator) {
|
|
51
46
|
context.loadCollaborator(email);
|
|
52
47
|
}
|
|
53
48
|
};
|
|
54
|
-
|
|
49
|
+
this.renderEmpty = () => {
|
|
55
50
|
return /*#__PURE__*/React.createElement("div", {
|
|
56
51
|
className: "d-flex align-items-center form-control disabled h-auto"
|
|
57
52
|
});
|
|
58
53
|
};
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
column
|
|
62
|
-
row
|
|
63
|
-
className
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
54
|
+
this.renderFormatter = () => {
|
|
55
|
+
let {
|
|
56
|
+
column,
|
|
57
|
+
row,
|
|
58
|
+
className
|
|
59
|
+
} = this.props;
|
|
60
|
+
let {
|
|
61
|
+
type: columnType
|
|
62
|
+
} = column;
|
|
63
|
+
const {
|
|
64
|
+
collaborators
|
|
65
|
+
} = this.state;
|
|
66
|
+
const containerClassName = "dtable-".concat(columnType, "-formatter ").concat(className || '');
|
|
67
|
+
let cellValue = row[column.key] || row[column.name];
|
|
69
68
|
switch (columnType) {
|
|
70
69
|
case CellType.TEXT:
|
|
71
70
|
{
|
|
@@ -160,7 +159,7 @@ var EditorFormatter = /*#__PURE__*/function (_React$Component) {
|
|
|
160
159
|
}
|
|
161
160
|
case CellType.MULTIPLE_SELECT:
|
|
162
161
|
{
|
|
163
|
-
|
|
162
|
+
const options = column.data ? column.data.options : [];
|
|
164
163
|
return /*#__PURE__*/React.createElement("div", {
|
|
165
164
|
className: "form-control d-flex align-items-center w-100 h-auto"
|
|
166
165
|
}, /*#__PURE__*/React.createElement(MultipleSelectFormatter, {
|
|
@@ -171,12 +170,12 @@ var EditorFormatter = /*#__PURE__*/function (_React$Component) {
|
|
|
171
170
|
}
|
|
172
171
|
case CellType.SINGLE_SELECT:
|
|
173
172
|
{
|
|
174
|
-
|
|
173
|
+
const options = column.data ? column.data.options : [];
|
|
175
174
|
return /*#__PURE__*/React.createElement("div", {
|
|
176
175
|
className: "form-control d-flex align-items-center w-100"
|
|
177
176
|
}, /*#__PURE__*/React.createElement(SingleSelectFormatter, {
|
|
178
177
|
value: cellValue,
|
|
179
|
-
options:
|
|
178
|
+
options: options,
|
|
180
179
|
containerClassName: containerClassName
|
|
181
180
|
}));
|
|
182
181
|
}
|
|
@@ -185,8 +184,8 @@ var EditorFormatter = /*#__PURE__*/function (_React$Component) {
|
|
|
185
184
|
return /*#__PURE__*/React.createElement(RowExpandFileFormatter, {
|
|
186
185
|
value: cellValue,
|
|
187
186
|
column: column,
|
|
188
|
-
downloadFile:
|
|
189
|
-
deleteFile:
|
|
187
|
+
downloadFile: this.props.downloadFile,
|
|
188
|
+
deleteFile: this.props.deleteFile
|
|
190
189
|
});
|
|
191
190
|
}
|
|
192
191
|
case CellType.IMAGE:
|
|
@@ -194,9 +193,9 @@ var EditorFormatter = /*#__PURE__*/function (_React$Component) {
|
|
|
194
193
|
return /*#__PURE__*/React.createElement(RowExpandImageFormatter, {
|
|
195
194
|
value: cellValue,
|
|
196
195
|
column: column,
|
|
197
|
-
downloadImage:
|
|
198
|
-
deleteFile:
|
|
199
|
-
onRotateImage:
|
|
196
|
+
downloadImage: this.props.downloadImage,
|
|
197
|
+
deleteFile: this.props.deleteFile,
|
|
198
|
+
onRotateImage: this.props.onRotateImage
|
|
200
199
|
});
|
|
201
200
|
}
|
|
202
201
|
case CellType.CHECKBOX:
|
|
@@ -236,28 +235,33 @@ var EditorFormatter = /*#__PURE__*/function (_React$Component) {
|
|
|
236
235
|
case CellType.LINK:
|
|
237
236
|
{
|
|
238
237
|
// handle link column do not have column.data.display_column
|
|
239
|
-
|
|
240
|
-
data
|
|
241
|
-
|
|
242
|
-
|
|
243
|
-
|
|
238
|
+
const {
|
|
239
|
+
data
|
|
240
|
+
} = column;
|
|
241
|
+
const {
|
|
242
|
+
display_column_key,
|
|
243
|
+
array_type,
|
|
244
|
+
array_data
|
|
245
|
+
} = data;
|
|
244
246
|
if (!data.display_column) {
|
|
245
|
-
column =
|
|
246
|
-
|
|
247
|
+
column = {
|
|
248
|
+
...column,
|
|
249
|
+
data: {
|
|
250
|
+
...data,
|
|
247
251
|
display_column: {
|
|
248
252
|
key: display_column_key || '0000',
|
|
249
253
|
type: array_type || CellType.TEXT,
|
|
250
254
|
data: array_data || null
|
|
251
255
|
}
|
|
252
|
-
}
|
|
253
|
-
}
|
|
256
|
+
}
|
|
257
|
+
};
|
|
254
258
|
}
|
|
255
259
|
return /*#__PURE__*/React.createElement(RowExpandLinkFormatter, {
|
|
256
260
|
value: cellValue,
|
|
257
261
|
column: column,
|
|
258
262
|
collaborators: collaborators,
|
|
259
263
|
containerClassName: containerClassName,
|
|
260
|
-
renderEmpty:
|
|
264
|
+
renderEmpty: this.renderEmpty
|
|
261
265
|
});
|
|
262
266
|
}
|
|
263
267
|
case CellType.AUTO_NUMBER:
|
|
@@ -316,7 +320,7 @@ var EditorFormatter = /*#__PURE__*/function (_React$Component) {
|
|
|
316
320
|
return /*#__PURE__*/React.createElement(ButtonFormatter, {
|
|
317
321
|
data: column.data,
|
|
318
322
|
containerClassName: containerClassName,
|
|
319
|
-
onClickButton:
|
|
323
|
+
onClickButton: this.props.onClickButton
|
|
320
324
|
});
|
|
321
325
|
}
|
|
322
326
|
case CellType.DIGITAL_SIGN:
|
|
@@ -324,57 +328,49 @@ var EditorFormatter = /*#__PURE__*/function (_React$Component) {
|
|
|
324
328
|
return /*#__PURE__*/React.createElement(DigitalSignFormatter, {
|
|
325
329
|
value: cellValue,
|
|
326
330
|
containerClassName: containerClassName,
|
|
327
|
-
config:
|
|
331
|
+
config: this.props.config
|
|
328
332
|
});
|
|
329
333
|
}
|
|
330
334
|
case CellType.DEPARTMENT_SINGLE_SELECT:
|
|
331
335
|
{
|
|
332
336
|
return /*#__PURE__*/React.createElement(DepartmentSingleSelectFormatter, {
|
|
333
337
|
value: cellValue,
|
|
334
|
-
departments:
|
|
338
|
+
departments: this.props.departments
|
|
335
339
|
});
|
|
336
340
|
}
|
|
337
341
|
default:
|
|
338
342
|
return null;
|
|
339
343
|
}
|
|
340
344
|
};
|
|
341
|
-
|
|
342
|
-
collaborators:
|
|
345
|
+
this.state = {
|
|
346
|
+
collaborators: this.getCollaborator()
|
|
343
347
|
};
|
|
344
|
-
return _this;
|
|
345
348
|
}
|
|
346
|
-
|
|
347
|
-
|
|
348
|
-
|
|
349
|
-
this.
|
|
350
|
-
if (this.props.eventBus) {
|
|
351
|
-
this.unsubscribeCollaboratorsUpdated = this.props.eventBus.subscribe('collaborators-updated', this.updateCollaborators);
|
|
352
|
-
}
|
|
353
|
-
}
|
|
354
|
-
}, {
|
|
355
|
-
key: "UNSAFE_componentWillReceiveProps",
|
|
356
|
-
value: function UNSAFE_componentWillReceiveProps(nextProps) {
|
|
357
|
-
this.calculateCollaboratorData(nextProps);
|
|
358
|
-
}
|
|
359
|
-
}, {
|
|
360
|
-
key: "componentWillUnmount",
|
|
361
|
-
value: function componentWillUnmount() {
|
|
362
|
-
if (this.props.eventBus && this.unsubscribeCollaboratorsUpdated) {
|
|
363
|
-
this.unsubscribeCollaboratorsUpdated();
|
|
364
|
-
}
|
|
349
|
+
componentDidMount() {
|
|
350
|
+
this.calculateCollaboratorData(this.props);
|
|
351
|
+
if (this.props.eventBus) {
|
|
352
|
+
this.unsubscribeCollaboratorsUpdated = this.props.eventBus.subscribe('collaborators-updated', this.updateCollaborators);
|
|
365
353
|
}
|
|
366
|
-
}
|
|
367
|
-
|
|
368
|
-
|
|
369
|
-
|
|
370
|
-
|
|
371
|
-
|
|
372
|
-
|
|
354
|
+
}
|
|
355
|
+
UNSAFE_componentWillReceiveProps(nextProps) {
|
|
356
|
+
this.calculateCollaboratorData(nextProps);
|
|
357
|
+
}
|
|
358
|
+
componentWillUnmount() {
|
|
359
|
+
if (this.props.eventBus && this.unsubscribeCollaboratorsUpdated) {
|
|
360
|
+
this.unsubscribeCollaboratorsUpdated();
|
|
373
361
|
}
|
|
374
|
-
}
|
|
375
|
-
|
|
376
|
-
|
|
362
|
+
}
|
|
363
|
+
render() {
|
|
364
|
+
const {
|
|
365
|
+
className
|
|
366
|
+
} = this.props;
|
|
367
|
+
return /*#__PURE__*/React.createElement("div", {
|
|
368
|
+
className: classnames('dtable-ui dtable-row-expand-formatter', {
|
|
369
|
+
[className]: className
|
|
370
|
+
})
|
|
371
|
+
}, this.renderFormatter());
|
|
372
|
+
}
|
|
373
|
+
}
|
|
377
374
|
EditorFormatter.defaultProps = {
|
|
378
375
|
className: ''
|
|
379
|
-
};
|
|
380
|
-
export { EditorFormatter as default };
|
|
376
|
+
};
|