dtable-ui-component 4.3.7 → 4.3.9-alpha1

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 (123) 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.css +1 -1
  13. package/lib/DTableCustomizeCollaboratorSelect/index.js +80 -99
  14. package/lib/DTableCustomizeCollaboratorSelect/utils.js +12 -13
  15. package/lib/DTableCustomizeSelect/index.js +92 -103
  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 +1 -1
  88. package/lib/SelectOptionGroup/index.js +141 -159
  89. package/lib/SelectOptionGroup/option.js +24 -40
  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 +22 -43
  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 +41 -135
  116. package/lib/toaster/index.css +116 -0
  117. package/lib/toaster/index.js +1 -1
  118. package/lib/toaster/toast.js +71 -136
  119. package/lib/toaster/toastManager.js +54 -100
  120. package/lib/toaster/toaster.js +59 -57
  121. package/lib/utils/editor-utils.js +17 -19
  122. package/lib/utils/utils.js +14 -14
  123. package/package.json +5 -6
@@ -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, { Fragment } from 'react';
6
2
  import MediaQuery from 'react-responsive';
7
3
  import { getLocale } from '../lang';
@@ -10,101 +6,96 @@ import EditEditorButton from '../EditEditorButton';
10
6
  import PCCollaboratorEditorPopover from './pc-collaborator-editor-popover';
11
7
  import MBCollaboratorEditorPopover from './mb-collaborator-editor-popover';
12
8
  import './index.css';
13
- var CollaboratorEditor = /*#__PURE__*/function (_React$Component) {
14
- _inherits(CollaboratorEditor, _React$Component);
15
- var _super = _createSuper(CollaboratorEditor);
16
- function CollaboratorEditor(props) {
17
- var _this;
18
- _classCallCheck(this, CollaboratorEditor);
19
- _this = _super.call(this, props);
20
- _this.onDocumentToggle = function (e) {
21
- if (_this.editorContainer !== e.target && !_this.editorContainer.contains(e.target)) {
22
- _this.onClosePopover();
9
+ class CollaboratorEditor extends React.Component {
10
+ constructor(props) {
11
+ super(props);
12
+ this.onDocumentToggle = e => {
13
+ if (this.editorContainer !== e.target && !this.editorContainer.contains(e.target)) {
14
+ this.onClosePopover();
23
15
  }
24
16
  };
25
- _this.getFormattedCollaborators = function () {
26
- var newValue = _this.state.newValue;
17
+ this.getFormattedCollaborators = () => {
18
+ let {
19
+ newValue
20
+ } = this.state;
27
21
  if (Array.isArray(newValue) && newValue.length > 0) {
28
- var collaborators = _this.props.collaborators;
29
- return newValue.map(function (collaboratorEmail) {
30
- return collaborators.find(function (collaborator) {
31
- return collaborator.email === collaboratorEmail;
32
- });
33
- }).filter(function (collaborator) {
34
- return !!collaborator;
35
- });
22
+ const {
23
+ collaborators
24
+ } = this.props;
25
+ return newValue.map(collaboratorEmail => {
26
+ return collaborators.find(collaborator => collaborator.email === collaboratorEmail);
27
+ }).filter(collaborator => !!collaborator);
36
28
  }
37
29
  return [];
38
30
  };
39
- _this.onAddOptionToggle = function (event) {
31
+ this.onAddOptionToggle = event => {
40
32
  event.nativeEvent.stopImmediatePropagation();
41
33
  event.stopPropagation();
42
- if (_this.props.isReadOnly) {
34
+ if (this.props.isReadOnly) {
43
35
  return;
44
36
  }
45
- var isPopoverShow = !_this.state.isPopoverShow;
37
+ let isPopoverShow = !this.state.isPopoverShow;
46
38
  if (isPopoverShow) {
47
- var popoverPosition = _this.caculatePopoverPosition();
48
- _this.setState({
49
- isPopoverShow: isPopoverShow,
50
- popoverPosition: popoverPosition
39
+ let popoverPosition = this.caculatePopoverPosition();
40
+ this.setState({
41
+ isPopoverShow,
42
+ popoverPosition
51
43
  });
52
44
  } else {
53
- _this.setState({
54
- isPopoverShow: isPopoverShow
45
+ this.setState({
46
+ isPopoverShow
55
47
  });
56
48
  }
57
49
  };
58
- _this.onCommit = function (newValue) {
59
- var updated = {};
60
- var column = _this.props.column;
50
+ this.onCommit = newValue => {
51
+ let updated = {};
52
+ let {
53
+ column
54
+ } = this.props;
61
55
  updated[column.name] = newValue;
62
- _this.props.onCommit(updated);
56
+ this.props.onCommit(updated);
63
57
  };
64
- _this.onCollaboratorItemToggle = function (collaborator) {
65
- var newValue = _this.state.newValue.slice();
66
- var collaboratorIndex = newValue.findIndex(function (collaboratorEmail) {
67
- return collaboratorEmail === collaborator.email;
68
- });
58
+ this.onCollaboratorItemToggle = collaborator => {
59
+ let newValue = this.state.newValue.slice();
60
+ let collaboratorIndex = newValue.findIndex(collaboratorEmail => collaboratorEmail === collaborator.email);
69
61
  if (collaboratorIndex !== -1) {
70
62
  newValue.splice(collaboratorIndex, 1);
71
63
  } else {
72
64
  newValue.push(collaborator.email);
73
65
  }
74
- _this.setState({
75
- newValue: newValue
76
- }, function () {
77
- _this.onCommit(newValue);
78
- _this.onClosePopover();
66
+ this.setState({
67
+ newValue
68
+ }, () => {
69
+ this.onCommit(newValue);
70
+ this.onClosePopover();
79
71
  });
80
72
  };
81
- _this.onDeleteCollaborator = function (collaborator) {
82
- var newValue = _this.state.newValue.slice();
83
- var optionIndex = newValue.findIndex(function (collaboratorEmail) {
84
- return collaboratorEmail === collaborator.email;
85
- });
73
+ this.onDeleteCollaborator = collaborator => {
74
+ let newValue = this.state.newValue.slice();
75
+ let optionIndex = newValue.findIndex(collaboratorEmail => collaboratorEmail === collaborator.email);
86
76
  if (optionIndex > -1) {
87
77
  newValue.splice(optionIndex, 1);
88
- _this.setState({
89
- newValue: newValue
90
- }, function () {
91
- _this.onCommit(newValue);
78
+ this.setState({
79
+ newValue
80
+ }, () => {
81
+ this.onCommit(newValue);
92
82
  });
93
83
  }
94
84
  };
95
- _this.caculatePopoverPosition = function () {
96
- var POPOVER_MAX_HEIGHT = 200;
97
- var innerHeight = window.innerHeight;
98
- var _this$editor$getClien = _this.editor.getClientRects()[0],
99
- top = _this$editor$getClien.top,
100
- height = _this$editor$getClien.height;
101
- var isBelow = innerHeight - (top + height) > POPOVER_MAX_HEIGHT;
102
- var position = {
85
+ this.caculatePopoverPosition = () => {
86
+ const POPOVER_MAX_HEIGHT = 200;
87
+ let innerHeight = window.innerHeight;
88
+ let {
89
+ top,
90
+ height
91
+ } = this.editor.getClientRects()[0];
92
+ let isBelow = innerHeight - (top + height) > POPOVER_MAX_HEIGHT;
93
+ let position = {
103
94
  top: height + 1,
104
95
  left: 0
105
96
  };
106
97
  if (!isBelow) {
107
- var bottom = height + 1;
98
+ let bottom = height + 1;
108
99
  position = {
109
100
  bottom: bottom,
110
101
  left: 0
@@ -112,86 +103,78 @@ var CollaboratorEditor = /*#__PURE__*/function (_React$Component) {
112
103
  }
113
104
  return position;
114
105
  };
115
- _this.onClosePopover = function () {
116
- _this.setState({
106
+ this.onClosePopover = () => {
107
+ this.setState({
117
108
  isPopoverShow: false
118
109
  });
119
110
  };
120
- _this.setEditorContainerRef = function (editorContainer) {
121
- _this.editorContainer = editorContainer;
111
+ this.setEditorContainerRef = editorContainer => {
112
+ this.editorContainer = editorContainer;
122
113
  };
123
- _this.setEditorRef = function (editor) {
124
- _this.editor = editor;
114
+ this.setEditorRef = editor => {
115
+ this.editor = editor;
125
116
  };
126
- _this.state = {
117
+ this.state = {
127
118
  newValue: Array.isArray(props.value) ? props.value : [],
128
119
  isPopoverShow: false,
129
120
  popoverPosition: {}
130
121
  };
131
- return _this;
132
122
  }
133
- _createClass(CollaboratorEditor, [{
134
- key: "componentDidMount",
135
- value: function componentDidMount() {
136
- document.addEventListener('click', this.onDocumentToggle);
137
- }
138
- }, {
139
- key: "componentWillUnmount",
140
- value: function componentWillUnmount() {
141
- document.removeEventListener('click', this.onDocumentToggle);
142
- }
143
- }, {
144
- key: "render",
145
- value: function render() {
146
- var _this2 = this;
147
- var _this$props = this.props,
148
- collaborators = _this$props.collaborators,
149
- isReadOnly = _this$props.isReadOnly;
150
- var _this$state = this.state,
151
- isPopoverShow = _this$state.isPopoverShow,
152
- popoverPosition = _this$state.popoverPosition;
153
- var selectedCollaborators = this.getFormattedCollaborators();
154
- var enableDeleteCollaborator = !isReadOnly;
155
- return /*#__PURE__*/React.createElement("div", {
156
- ref: this.setEditorContainerRef,
157
- className: "dtable-ui-collaborator-editor"
158
- }, /*#__PURE__*/React.createElement("div", {
159
- ref: this.setEditorRef,
160
- className: "dtable-ui-collaborator-editor-container"
161
- }, /*#__PURE__*/React.createElement(EditEditorButton, {
162
- text: getLocale('Add_a_collaborator'),
163
- onClick: this.onAddOptionToggle
164
- }), selectedCollaborators.length > 0 && /*#__PURE__*/React.createElement("div", {
165
- className: "collaborators-container mt-2"
166
- }, selectedCollaborators.map(function (collaborator) {
167
- return /*#__PURE__*/React.createElement(CollaboratorItem, {
168
- key: collaborator.email,
169
- collaborator: collaborator,
170
- enableDeleteCollaborator: enableDeleteCollaborator,
171
- onDeleteCollaborator: _this2.onDeleteCollaborator
172
- });
173
- }))), isPopoverShow && /*#__PURE__*/React.createElement(Fragment, null, /*#__PURE__*/React.createElement(MediaQuery, {
174
- query: '(min-width: 768px)'
175
- }, /*#__PURE__*/React.createElement(PCCollaboratorEditorPopover, {
176
- popoverPosition: popoverPosition,
177
- isReadOnly: this.props.isReadOnly,
178
- selectedCollaborators: selectedCollaborators,
179
- collaborators: collaborators,
180
- onCollaboratorItemToggle: this.onCollaboratorItemToggle
181
- })), /*#__PURE__*/React.createElement(MediaQuery, {
182
- query: '(max-width: 767.8px)'
183
- }, /*#__PURE__*/React.createElement(MBCollaboratorEditorPopover, {
184
- isReadOnly: this.props.isReadOnly,
185
- value: this.state.newValue,
186
- column: this.props.column,
187
- collaborators: this.props.collaborators,
188
- onCollaboratorItemToggle: this.onCollaboratorItemToggle,
189
- onClosePopover: this.onClosePopover
190
- }))));
191
- }
192
- }]);
193
- return CollaboratorEditor;
194
- }(React.Component);
123
+ componentDidMount() {
124
+ document.addEventListener('click', this.onDocumentToggle);
125
+ }
126
+ componentWillUnmount() {
127
+ document.removeEventListener('click', this.onDocumentToggle);
128
+ }
129
+ render() {
130
+ let {
131
+ collaborators,
132
+ isReadOnly
133
+ } = this.props;
134
+ let {
135
+ isPopoverShow,
136
+ popoverPosition
137
+ } = this.state;
138
+ let selectedCollaborators = this.getFormattedCollaborators();
139
+ let enableDeleteCollaborator = !isReadOnly;
140
+ return /*#__PURE__*/React.createElement("div", {
141
+ ref: this.setEditorContainerRef,
142
+ className: "dtable-ui-collaborator-editor"
143
+ }, /*#__PURE__*/React.createElement("div", {
144
+ ref: this.setEditorRef,
145
+ className: "dtable-ui-collaborator-editor-container"
146
+ }, /*#__PURE__*/React.createElement(EditEditorButton, {
147
+ text: getLocale('Add_a_collaborator'),
148
+ onClick: this.onAddOptionToggle
149
+ }), selectedCollaborators.length > 0 && /*#__PURE__*/React.createElement("div", {
150
+ className: "collaborators-container mt-2"
151
+ }, selectedCollaborators.map(collaborator => {
152
+ return /*#__PURE__*/React.createElement(CollaboratorItem, {
153
+ key: collaborator.email,
154
+ collaborator: collaborator,
155
+ enableDeleteCollaborator: enableDeleteCollaborator,
156
+ onDeleteCollaborator: this.onDeleteCollaborator
157
+ });
158
+ }))), isPopoverShow && /*#__PURE__*/React.createElement(Fragment, null, /*#__PURE__*/React.createElement(MediaQuery, {
159
+ query: '(min-width: 768px)'
160
+ }, /*#__PURE__*/React.createElement(PCCollaboratorEditorPopover, {
161
+ popoverPosition: popoverPosition,
162
+ isReadOnly: this.props.isReadOnly,
163
+ selectedCollaborators: selectedCollaborators,
164
+ collaborators: collaborators,
165
+ onCollaboratorItemToggle: this.onCollaboratorItemToggle
166
+ })), /*#__PURE__*/React.createElement(MediaQuery, {
167
+ query: '(max-width: 767.8px)'
168
+ }, /*#__PURE__*/React.createElement(MBCollaboratorEditorPopover, {
169
+ isReadOnly: this.props.isReadOnly,
170
+ value: this.state.newValue,
171
+ column: this.props.column,
172
+ collaborators: this.props.collaborators,
173
+ onCollaboratorItemToggle: this.onCollaboratorItemToggle,
174
+ onClosePopover: this.onClosePopover
175
+ }))));
176
+ }
177
+ }
195
178
  CollaboratorEditor.defaultProps = {
196
179
  isReadOnly: false,
197
180
  value: []
@@ -1,74 +1,70 @@
1
- import _classCallCheck from "@babel/runtime/helpers/esm/classCallCheck";
2
- import _createClass from "@babel/runtime/helpers/esm/createClass";
3
- import _assertThisInitialized from "@babel/runtime/helpers/esm/assertThisInitialized";
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 MBEditorHeader from '../../MBEditorHeader';
9
4
  import './index.css';
10
- var MBCollaboratorEditorPopover = /*#__PURE__*/function (_React$Component) {
11
- _inherits(MBCollaboratorEditorPopover, _React$Component);
12
- var _super = _createSuper(MBCollaboratorEditorPopover);
13
- function MBCollaboratorEditorPopover(props) {
14
- var _this;
15
- _classCallCheck(this, MBCollaboratorEditorPopover);
16
- _this = _super.call(this, props);
17
- _this.handleHistaryBack = function (e) {
5
+ class MBCollaboratorEditorPopover extends React.Component {
6
+ constructor(props) {
7
+ super(props);
8
+ this.handleHistaryBack = e => {
18
9
  e.preventDefault();
19
- _this.props.onClosePopover();
10
+ this.props.onClosePopover();
20
11
  };
21
- _this.onContainerClick = function (event) {
22
- if (_this.editorPopover && _this.editorPopover.contains(event.target)) {
12
+ this.onContainerClick = event => {
13
+ if (this.editorPopover && this.editorPopover.contains(event.target)) {
23
14
  event.stopPropagation();
24
15
  event.nativeEvent.stopImmediatePropagation();
25
16
  return false;
26
17
  }
27
18
  };
28
- _this.onChangeSearch = function (event) {
29
- var searchVal = _this.state.searchVal;
19
+ this.onChangeSearch = event => {
20
+ let {
21
+ searchVal
22
+ } = this.state;
30
23
  if (searchVal === event.target.value) {
31
24
  return;
32
25
  }
33
26
  searchVal = event.target.value;
34
- _this.setState({
35
- searchVal: searchVal
27
+ this.setState({
28
+ searchVal
36
29
  });
37
30
  };
38
- _this.getSelectedCollaborators = function () {
39
- var _this$props = _this.props,
40
- value = _this$props.value,
41
- collaborators = _this$props.collaborators;
31
+ this.getSelectedCollaborators = () => {
32
+ let {
33
+ value,
34
+ collaborators
35
+ } = this.props;
42
36
  if (!Array.isArray(value)) {
43
37
  return [];
44
38
  }
45
- return collaborators.filter(function (collaborator) {
39
+ return collaborators.filter(collaborator => {
46
40
  return value.indexOf(collaborator.email) > -1;
47
41
  });
48
42
  };
49
- _this.getFilteredCollaborators = function () {
50
- var collaborators = _this.props.collaborators;
51
- var searchVal = _this.state.searchVal;
52
- return searchVal ? collaborators.filter(function (item) {
53
- return item.name.indexOf(searchVal) > -1;
54
- }) : collaborators;
43
+ this.getFilteredCollaborators = () => {
44
+ let {
45
+ collaborators
46
+ } = this.props;
47
+ let {
48
+ searchVal
49
+ } = this.state;
50
+ return searchVal ? collaborators.filter(item => item.name.indexOf(searchVal) > -1) : collaborators;
55
51
  };
56
- _this.onSelectCollaborator = function (collaborator) {
57
- _this.props.onCollaboratorItemToggle(collaborator);
52
+ this.onSelectCollaborator = collaborator => {
53
+ this.props.onCollaboratorItemToggle(collaborator);
58
54
  };
59
- _this.onRemoveCollaborator = function (collaborator) {
60
- _this.props.onCollaboratorItemToggle(collaborator);
55
+ this.onRemoveCollaborator = collaborator => {
56
+ this.props.onCollaboratorItemToggle(collaborator);
61
57
  };
62
- _this.renderFilteredCollaborators = function (collaborators) {
63
- var value = _this.props.value;
64
- return collaborators.map(function (collaborator, index) {
65
- var isSelect = value.some(function (item) {
66
- return item === collaborator.email;
67
- });
58
+ this.renderFilteredCollaborators = collaborators => {
59
+ let {
60
+ value
61
+ } = this.props;
62
+ return collaborators.map((collaborator, index) => {
63
+ let isSelect = value.some(item => item === collaborator.email);
68
64
  return /*#__PURE__*/React.createElement("div", {
69
65
  className: "mb-collaborator-option-item",
70
66
  key: index,
71
- onMouseDown: _this.onSelectCollaborator.bind(_assertThisInitialized(_this), collaborator)
67
+ onMouseDown: this.onSelectCollaborator.bind(this, collaborator)
72
68
  }, /*#__PURE__*/React.createElement("span", {
73
69
  className: "mb-collaborator-info"
74
70
  }, /*#__PURE__*/React.createElement("span", {
@@ -85,67 +81,62 @@ var MBCollaboratorEditorPopover = /*#__PURE__*/function (_React$Component) {
85
81
  }));
86
82
  });
87
83
  };
88
- _this.setEditorPopover = function (editorPopover) {
89
- _this.editorPopover = editorPopover;
84
+ this.setEditorPopover = editorPopover => {
85
+ this.editorPopover = editorPopover;
90
86
  };
91
- _this.state = {
87
+ this.state = {
92
88
  searchVal: ''
93
89
  };
94
- return _this;
95
90
  }
96
- _createClass(MBCollaboratorEditorPopover, [{
97
- key: "componentDidMount",
98
- value: function componentDidMount() {
99
- history.pushState(null, null, '#'); // eslint-disable-line
100
- window.addEventListener('popstate', this.handleHistaryBack, false);
101
- }
102
- }, {
103
- key: "componentWillUnmount",
104
- value: function componentWillUnmount() {
105
- window.removeEventListener('popstate', this.handleHistaryBack, false);
106
- }
107
- }, {
108
- key: "render",
109
- value: function render() {
110
- var column = this.props.column;
111
- var searchVal = this.state.searchVal;
112
- var filteredCollaborators = this.getFilteredCollaborators();
113
- return /*#__PURE__*/React.createElement("div", {
114
- ref: this.setEditorPopover,
115
- className: "dtable-ui-mb-editor-popover mb-collaborator-editor-popover",
116
- onClick: this.onContainerClick
117
- }, /*#__PURE__*/React.createElement(MBEditorHeader, {
118
- title: column.name,
119
- leftContent: /*#__PURE__*/React.createElement("i", {
120
- className: "dtable-font dtable-icon-return"
121
- }),
122
- rightContent: /*#__PURE__*/React.createElement("span", null, getLocale('Done')),
123
- onLeftClick: this.props.onClosePopover,
124
- onRightClick: this.props.onClosePopover
125
- }), /*#__PURE__*/React.createElement("div", {
126
- className: "dtable-ui-mb-editor-body dtable-ui-mb-collaborator-editor-body"
127
- }, /*#__PURE__*/React.createElement("div", {
128
- className: "mb-search-collaborator-items"
129
- }, /*#__PURE__*/React.createElement("input", {
130
- className: "form-control",
131
- type: "text",
132
- placeholder: getLocale('Find_a_collaborator'),
133
- value: searchVal,
134
- onChange: this.onChangeSearch,
135
- onClick: this.onInputClick
136
- })), /*#__PURE__*/React.createElement("div", {
137
- className: "mb-collaborators-container"
138
- }, /*#__PURE__*/React.createElement("div", {
139
- className: "title"
140
- }, getLocale('Choose_a_collaborator')), /*#__PURE__*/React.createElement("div", {
141
- className: "content"
142
- }, filteredCollaborators.length === 0 && /*#__PURE__*/React.createElement("div", {
143
- className: "search-result-none"
144
- }, getLocale('No_collaborators_avaliable')), filteredCollaborators.length > 0 && this.renderFilteredCollaborators(filteredCollaborators)))));
145
- }
146
- }]);
147
- return MBCollaboratorEditorPopover;
148
- }(React.Component);
91
+ componentDidMount() {
92
+ history.pushState(null, null, '#'); // eslint-disable-line
93
+ window.addEventListener('popstate', this.handleHistaryBack, false);
94
+ }
95
+ componentWillUnmount() {
96
+ window.removeEventListener('popstate', this.handleHistaryBack, false);
97
+ }
98
+ render() {
99
+ const {
100
+ column
101
+ } = this.props;
102
+ const {
103
+ searchVal
104
+ } = this.state;
105
+ let filteredCollaborators = this.getFilteredCollaborators();
106
+ return /*#__PURE__*/React.createElement("div", {
107
+ ref: this.setEditorPopover,
108
+ className: "dtable-ui-mb-editor-popover mb-collaborator-editor-popover",
109
+ onClick: this.onContainerClick
110
+ }, /*#__PURE__*/React.createElement(MBEditorHeader, {
111
+ title: column.name,
112
+ leftContent: /*#__PURE__*/React.createElement("i", {
113
+ className: "dtable-font dtable-icon-return"
114
+ }),
115
+ rightContent: /*#__PURE__*/React.createElement("span", null, getLocale('Done')),
116
+ onLeftClick: this.props.onClosePopover,
117
+ onRightClick: this.props.onClosePopover
118
+ }), /*#__PURE__*/React.createElement("div", {
119
+ className: "dtable-ui-mb-editor-body dtable-ui-mb-collaborator-editor-body"
120
+ }, /*#__PURE__*/React.createElement("div", {
121
+ className: "mb-search-collaborator-items"
122
+ }, /*#__PURE__*/React.createElement("input", {
123
+ className: "form-control",
124
+ type: "text",
125
+ placeholder: getLocale('Find_a_collaborator'),
126
+ value: searchVal,
127
+ onChange: this.onChangeSearch,
128
+ onClick: this.onInputClick
129
+ })), /*#__PURE__*/React.createElement("div", {
130
+ className: "mb-collaborators-container"
131
+ }, /*#__PURE__*/React.createElement("div", {
132
+ className: "title"
133
+ }, getLocale('Choose_a_collaborator')), /*#__PURE__*/React.createElement("div", {
134
+ className: "content"
135
+ }, filteredCollaborators.length === 0 && /*#__PURE__*/React.createElement("div", {
136
+ className: "search-result-none"
137
+ }, getLocale('No_collaborators_avaliable')), filteredCollaborators.length > 0 && this.renderFilteredCollaborators(filteredCollaborators)))));
138
+ }
139
+ }
149
140
  MBCollaboratorEditorPopover.defaultProps = {
150
141
  isReadOnly: false,
151
142
  value: []