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.
Files changed (122) hide show
  1. package/lib/AutoNumberFormatter/index.js +11 -24
  2. package/lib/ButtonFormatter/index.js +29 -45
  3. package/lib/CTimeFormatter/index.js +17 -32
  4. package/lib/CheckboxEditor/index.js +42 -49
  5. package/lib/CheckboxFormatter/index.js +17 -30
  6. package/lib/CollaboratorEditor/index.js +118 -135
  7. package/lib/CollaboratorEditor/mb-collaborator-editor-popover/index.js +90 -99
  8. package/lib/CollaboratorEditor/pc-collaborator-editor-popover/index.js +61 -69
  9. package/lib/CollaboratorFormatter/index.js +26 -42
  10. package/lib/CollaboratorItem/index.js +31 -44
  11. package/lib/CreatorFormatter/index.js +24 -40
  12. package/lib/DTableCustomizeCollaboratorSelect/index.js +80 -99
  13. package/lib/DTableCustomizeCollaboratorSelect/utils.js +12 -13
  14. package/lib/DTableCustomizeSelect/index.css +22 -59
  15. package/lib/DTableCustomizeSelect/index.js +99 -95
  16. package/lib/DTablePopover/index.js +52 -71
  17. package/lib/DTablePopover/utils.js +1 -1
  18. package/lib/DTableRadio/index.js +9 -7
  19. package/lib/DTableSearchInput/index.js +89 -99
  20. package/lib/DTableSearchInput/utils.js +2 -2
  21. package/lib/DTableSelect/dtable-select-label.js +5 -3
  22. package/lib/DTableSelect/index.js +50 -64
  23. package/lib/DTableSelect/utils.js +36 -41
  24. package/lib/DTableSwitch/index.js +7 -5
  25. package/lib/DateEditor/index.js +88 -94
  26. package/lib/DateEditor/mb-date-editor-popover/index.js +136 -134
  27. package/lib/DateEditor/pc-date-editor-popover.js +70 -77
  28. package/lib/DateFormatter/index.js +15 -28
  29. package/lib/DepartmentSingleSelectFormatter/index.js +9 -9
  30. package/lib/DigitalSignFormatter/index.js +55 -65
  31. package/lib/DigitalSignFormatter/utils.js +9 -8
  32. package/lib/DurationFormatter/index.js +14 -27
  33. package/lib/EditEditorButton/index.js +10 -22
  34. package/lib/EmailFormatter/index.js +11 -24
  35. package/lib/FieldDisplaySetting/field-item.js +18 -20
  36. package/lib/FieldDisplaySetting/index.js +41 -43
  37. package/lib/FileEditor/index.js +18 -29
  38. package/lib/FileFormatter/index.js +29 -43
  39. package/lib/FileItemFormatter/index.js +17 -32
  40. package/lib/FileItemFormatter/utils.js +5 -5
  41. package/lib/FileUploader/index.js +20 -33
  42. package/lib/FormulaFormatter/cell-value-validator.js +23 -8
  43. package/lib/FormulaFormatter/index.js +77 -83
  44. package/lib/FormulaFormatter/utils.js +27 -21
  45. package/lib/GeolocationFormatter/index.js +19 -32
  46. package/lib/HtmlLongTextFormatter/index.js +43 -52
  47. package/lib/HtmlLongTextFormatter/markdown2html.js +2 -2
  48. package/lib/HtmlLongTextFormatter/unified/index.js +1 -1
  49. package/lib/HtmlLongTextFormatter/vfile/core.js +10 -10
  50. package/lib/ImageFormatter/images-lazy-load.js +71 -79
  51. package/lib/ImageFormatter/index.js +86 -97
  52. package/lib/ImageFormatter/utils.js +1 -1
  53. package/lib/ImagePreviewerLightbox/index.js +20 -18
  54. package/lib/ImagePreviewerLightbox/utils.js +3 -3
  55. package/lib/LastModifierFormatter/index.js +24 -40
  56. package/lib/LinkEditor/index.js +163 -167
  57. package/lib/LinkEditor/link-editor-option.js +41 -56
  58. package/lib/LinkEditor/mb-link-editor-popover/index.js +90 -99
  59. package/lib/LinkEditor/pc-link-editor-popover/index.js +63 -71
  60. package/lib/LinkFormatter/index.js +75 -77
  61. package/lib/LongTextFormatter/index.js +5 -3
  62. package/lib/MBEditorHeader/index.js +25 -38
  63. package/lib/MTimeFormatter/index.js +17 -32
  64. package/lib/ModalPortal/index.js +15 -32
  65. package/lib/MultipleSelectEditor/index.js +118 -136
  66. package/lib/MultipleSelectFormatter/index.js +24 -40
  67. package/lib/NotificationPopover/index.js +68 -95
  68. package/lib/NumberEditor/index.js +75 -82
  69. package/lib/NumberFormatter/index.js +15 -28
  70. package/lib/RateFormatter/index.js +29 -45
  71. package/lib/RoleStatusEditor/index.js +20 -22
  72. package/lib/RowExpandEmailFormatter/index.js +24 -37
  73. package/lib/RowExpandFileFormatter/index.js +28 -42
  74. package/lib/RowExpandFileFormatter/row-expand-file-item-formatter.js +66 -82
  75. package/lib/RowExpandFormatter/index.js +92 -96
  76. package/lib/RowExpandFormulaFormatter/index.js +85 -91
  77. package/lib/RowExpandImageFormatter/index.js +65 -82
  78. package/lib/RowExpandImageFormatter/row-expand-image-item-formatter.js +71 -84
  79. package/lib/RowExpandImageFormatter/utils.js +1 -1
  80. package/lib/RowExpandLinkFormatter/collaborator-item-formatter.js +54 -68
  81. package/lib/RowExpandLinkFormatter/index.js +131 -137
  82. package/lib/RowExpandLinkFormatter/utils.js +23 -17
  83. package/lib/RowExpandLinkFormatter/value-display-utils.js +9 -7
  84. package/lib/RowExpandRateFormatter/index.js +27 -42
  85. package/lib/RowExpandUrlFormatter/index.js +27 -40
  86. package/lib/SelectItem/index.js +17 -33
  87. package/lib/SelectOptionGroup/index.css +103 -0
  88. package/lib/SelectOptionGroup/index.js +157 -135
  89. package/lib/SelectOptionGroup/option.js +31 -38
  90. package/lib/SimpleLongTextFormatter/index.js +55 -67
  91. package/lib/SimpleLongTextFormatter/normalize-long-text-value.js +23 -22
  92. package/lib/SimpleLongTextFormatter/widgets/LongTextPreview.js +42 -57
  93. package/lib/SimpleLongTextFormatter/widgets/dtable-markdown-viewer.js +31 -46
  94. package/lib/SingleSelectEditor/index.js +108 -119
  95. package/lib/SingleSelectFormatter/index.js +21 -37
  96. package/lib/TextEditor/index.js +45 -51
  97. package/lib/TextFormatter/index.js +17 -32
  98. package/lib/UrlFormatter/index.js +11 -24
  99. package/lib/cellFormatterFactory/index.js +8 -17
  100. package/lib/common/ClickOutside.js +28 -0
  101. package/lib/common/delete-tip.js +40 -65
  102. package/lib/common/modal-portal.js +15 -33
  103. package/lib/constants/index.js +5 -5
  104. package/lib/data/dtable-value.js +4 -4
  105. package/lib/formatterConfig/base-formatter-config.js +24 -3
  106. package/lib/formatterConfig/index.js +5 -4
  107. package/lib/lang/index.js +6 -6
  108. package/lib/locals/de.js +1 -1
  109. package/lib/locals/en.js +1 -1
  110. package/lib/locals/fr.js +1 -1
  111. package/lib/locals/zh-CN.js +1 -1
  112. package/lib/select-editor/mb-select-editor-popover/index.js +126 -137
  113. package/lib/select-editor/pc-select-editor-popover/index.js +75 -83
  114. package/lib/select-editor/select-editor-option.js +41 -56
  115. package/lib/toaster/alert.js +73 -88
  116. package/lib/toaster/index.js +1 -1
  117. package/lib/toaster/toast.js +75 -102
  118. package/lib/toaster/toastManager.js +55 -91
  119. package/lib/toaster/toaster.js +58 -57
  120. package/lib/utils/editor-utils.js +17 -19
  121. package/lib/utils/utils.js +14 -14
  122. 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
- var RowExpandEmailFormatter = /*#__PURE__*/function (_React$Component) {
10
- _inherits(RowExpandEmailFormatter, _React$Component);
11
- var _super = _createSuper(RowExpandEmailFormatter);
12
- function RowExpandEmailFormatter() {
13
- var _this;
14
- _classCallCheck(this, RowExpandEmailFormatter);
15
- for (var _len = arguments.length, args = new Array(_len), _key = 0; _key < _len; _key++) {
16
- args[_key] = arguments[_key];
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
- _createClass(RowExpandEmailFormatter, [{
27
- key: "render",
28
- value: function render() {
29
- var _this$props = this.props,
30
- containerClassName = _this$props.containerClassName,
31
- value = _this$props.value;
32
- var classname = classnames('dtable-ui cell-formatter-container email-formatter', containerClassName);
33
- return /*#__PURE__*/React.createElement("div", {
34
- className: classname
35
- }, /*#__PURE__*/React.createElement("span", {
36
- className: "email-formatter-value text-truncate"
37
- }, value), getTrimmedString(value) && /*#__PURE__*/React.createElement("span", {
38
- className: "dtable-font dtable-icon-email row-expand-jump-link",
39
- onClick: this.onOpenEmailLink
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
- var RowExpandFileFormatter = /*#__PURE__*/function (_React$PureComponent) {
10
- _inherits(RowExpandFileFormatter, _React$PureComponent);
11
- var _super = _createSuper(RowExpandFileFormatter);
12
- function RowExpandFileFormatter() {
13
- _classCallCheck(this, RowExpandFileFormatter);
14
- return _super.apply(this, arguments);
15
- }
16
- _createClass(RowExpandFileFormatter, [{
17
- key: "render",
18
- value: function render() {
19
- var _this$props = this.props,
20
- value = _this$props.value,
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
- return RowExpandFileFormatter;
45
- }(React.PureComponent);
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
- var RowExpandFileItemFormatter = /*#__PURE__*/function (_Component) {
11
- _inherits(RowExpandFileItemFormatter, _Component);
12
- var _super = _createSuper(RowExpandFileItemFormatter);
13
- function RowExpandFileItemFormatter(props) {
14
- var _this;
15
- _classCallCheck(this, RowExpandFileItemFormatter);
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
- _this.closeDeleteTip = function () {
23
- _this.setState({
14
+ this.closeDeleteTip = () => {
15
+ this.setState({
24
16
  isDeleteTipOpen: false
25
17
  });
26
18
  };
27
- _this.onClickDelete = function (e) {
19
+ this.onClickDelete = e => {
28
20
  e.stopPropagation();
29
- _this.position = {
21
+ this.position = {
30
22
  top: e.clientY,
31
23
  left: e.clientX
32
24
  };
33
- _this.setState({
25
+ this.setState({
34
26
  isDeleteTipOpen: true
35
27
  });
36
28
  };
37
- _this.onDelete = function (e) {
29
+ this.onDelete = e => {
38
30
  e.stopPropagation();
39
- _this.closeDeleteTip();
40
- _this.props.deleteFile(_this.props.index);
31
+ this.closeDeleteTip();
32
+ this.props.deleteFile(this.props.index);
41
33
  };
42
- _this.getFileIconData = function (item) {
43
- var fileIconUrl = getFileIconUrl(item.name, item.type);
34
+ this.getFileIconData = item => {
35
+ let fileIconUrl = getFileIconUrl(item.name, item.type);
44
36
  return require('../FileItemFormatter/' + fileIconUrl);
45
37
  };
46
- _this.state = {
38
+ this.state = {
47
39
  isTooltipOpen: false,
48
40
  isDeleteTipOpen: false
49
41
  };
50
- return _this;
51
42
  }
52
- _createClass(RowExpandFileItemFormatter, [{
53
- key: "render",
54
- value: function render() {
55
- var _this2 = this;
56
- var _this$props = this.props,
57
- file = _this$props.file,
58
- column = _this$props.column,
59
- index = _this$props.index,
60
- readOnly = _this$props.readOnly,
61
- downloadFile = _this$props.downloadFile,
62
- deleteFile = _this$props.deleteFile;
63
- var id = 'file-list-preview-item' + column.key + index;
64
- var url = this.getFileIconData(file);
65
- return /*#__PURE__*/React.createElement(React.Fragment, null, /*#__PURE__*/React.createElement("div", {
66
- key: "file-".concat(index),
67
- className: "row-expand-item-file",
68
- id: id
69
- }, /*#__PURE__*/React.createElement("img", {
70
- src: url,
71
- id: "item-file-".concat(index),
72
- alt: file.name
73
- }), /*#__PURE__*/React.createElement("div", {
74
- className: "dtable-file-icons-choice"
75
- }, downloadFile && /*#__PURE__*/React.createElement("span", {
76
- className: "file-icon",
77
- onClick: function onClick(e) {
78
- return _this2.props.downloadFile(file, e);
79
- }
80
- }, /*#__PURE__*/React.createElement("i", {
81
- className: "dtable-font dtable-icon-download"
82
- })), !readOnly && deleteFile && /*#__PURE__*/React.createElement("span", {
83
- className: "file-icon",
84
- onClick: this.onClickDelete
85
- }, /*#__PURE__*/React.createElement("i", {
86
- className: "dtable-font dtable-icon-fork-number"
87
- })))), this.state.isDeleteTipOpen && /*#__PURE__*/React.createElement(DeleteTip, {
88
- position: this.position,
89
- toggle: this.closeDeleteTip,
90
- onDelete: this.onDelete,
91
- deleteTip: getLocale('Are_you_sure_you_want_to_delete_this_file')
92
- }), /*#__PURE__*/React.createElement(Tooltip, {
93
- placement: "bottom",
94
- isOpen: this.state.isTooltipOpen,
95
- toggle: this.toggleTooltip,
96
- target: id,
97
- delay: {
98
- show: 0,
99
- hide: 0
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
- var EditorFormatter = /*#__PURE__*/function (_React$Component) {
13
- _inherits(EditorFormatter, _React$Component);
14
- var _super = _createSuper(EditorFormatter);
15
- function EditorFormatter(_props) {
16
- var _this;
17
- _classCallCheck(this, EditorFormatter);
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
- _this.calculateCollaboratorData = function (props) {
25
- var row = props.row,
26
- column = props.column;
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
- var email = row[column.name];
29
- _this.loadCollaborator(email);
20
+ const email = row[column.name];
21
+ this.loadCollaborator(email);
30
22
  } else if (column.type === CellType.COLLABORATOR) {
31
- var emails = row[column.name];
23
+ const emails = row[column.name];
32
24
  if (Array.isArray(emails)) {
33
- emails.forEach(function (email) {
34
- _this.loadCollaborator(email);
25
+ emails.forEach(email => {
26
+ this.loadCollaborator(email);
35
27
  });
36
28
  }
37
29
  }
38
30
  };
39
- _this.getCollaborator = function () {
40
- var _this$props = _this.props,
41
- context = _this$props.context,
42
- collaborators = _this$props.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
- _this.loadCollaborator = function (email) {
49
- var context = _this.props.context;
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
- _this.renderEmpty = function () {
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
- _this.renderFormatter = function () {
60
- var _this$props2 = _this.props,
61
- column = _this$props2.column,
62
- row = _this$props2.row,
63
- className = _this$props2.className;
64
- var _column = column,
65
- columnType = _column.type;
66
- var collaborators = _this.state.collaborators;
67
- var containerClassName = "dtable-".concat(columnType, "-formatter ").concat(className || '');
68
- var cellValue = row[column.key] || row[column.name];
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
- var options = column.data ? column.data.options : [];
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
- var _options = column.data ? column.data.options : [];
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: _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: _this.props.downloadFile,
189
- deleteFile: _this.props.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: _this.props.downloadImage,
198
- deleteFile: _this.props.deleteFile,
199
- onRotateImage: _this.props.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
- var _column2 = column,
240
- data = _column2.data;
241
- var display_column_key = data.display_column_key,
242
- array_type = data.array_type,
243
- array_data = data.array_data;
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 = _objectSpread(_objectSpread({}, column), {}, {
246
- data: _objectSpread(_objectSpread({}, data), {}, {
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: _this.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: _this.props.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: _this.props.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: _this.props.departments
338
+ departments: this.props.departments
335
339
  });
336
340
  }
337
341
  default:
338
342
  return null;
339
343
  }
340
344
  };
341
- _this.state = {
342
- collaborators: _this.getCollaborator()
345
+ this.state = {
346
+ collaborators: this.getCollaborator()
343
347
  };
344
- return _this;
345
348
  }
346
- _createClass(EditorFormatter, [{
347
- key: "componentDidMount",
348
- value: function componentDidMount() {
349
- this.calculateCollaboratorData(this.props);
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
- key: "render",
368
- value: function render() {
369
- var className = this.props.className;
370
- return /*#__PURE__*/React.createElement("div", {
371
- className: classnames('dtable-ui dtable-row-expand-formatter', _defineProperty({}, className, className))
372
- }, this.renderFormatter());
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
- return EditorFormatter;
376
- }(React.Component);
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
+ };