dtable-ui-component 4.3.7 → 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 (120) 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.js +92 -103
  15. package/lib/DTablePopover/index.js +52 -71
  16. package/lib/DTablePopover/utils.js +1 -1
  17. package/lib/DTableRadio/index.js +9 -7
  18. package/lib/DTableSearchInput/index.js +89 -99
  19. package/lib/DTableSearchInput/utils.js +2 -2
  20. package/lib/DTableSelect/dtable-select-label.js +5 -3
  21. package/lib/DTableSelect/index.js +50 -64
  22. package/lib/DTableSelect/utils.js +36 -41
  23. package/lib/DTableSwitch/index.js +7 -5
  24. package/lib/DateEditor/index.js +88 -94
  25. package/lib/DateEditor/mb-date-editor-popover/index.js +136 -134
  26. package/lib/DateEditor/pc-date-editor-popover.js +70 -77
  27. package/lib/DateFormatter/index.js +15 -28
  28. package/lib/DepartmentSingleSelectFormatter/index.js +9 -9
  29. package/lib/DigitalSignFormatter/index.js +55 -65
  30. package/lib/DigitalSignFormatter/utils.js +9 -8
  31. package/lib/DurationFormatter/index.js +14 -27
  32. package/lib/EditEditorButton/index.js +10 -22
  33. package/lib/EmailFormatter/index.js +11 -24
  34. package/lib/FieldDisplaySetting/field-item.js +18 -20
  35. package/lib/FieldDisplaySetting/index.js +41 -43
  36. package/lib/FileEditor/index.js +18 -29
  37. package/lib/FileFormatter/index.js +29 -43
  38. package/lib/FileItemFormatter/index.js +17 -32
  39. package/lib/FileItemFormatter/utils.js +5 -5
  40. package/lib/FileUploader/index.js +20 -33
  41. package/lib/FormulaFormatter/cell-value-validator.js +23 -8
  42. package/lib/FormulaFormatter/index.js +77 -83
  43. package/lib/FormulaFormatter/utils.js +27 -21
  44. package/lib/GeolocationFormatter/index.js +19 -32
  45. package/lib/HtmlLongTextFormatter/index.js +43 -52
  46. package/lib/HtmlLongTextFormatter/markdown2html.js +2 -2
  47. package/lib/HtmlLongTextFormatter/unified/index.js +1 -1
  48. package/lib/HtmlLongTextFormatter/vfile/core.js +10 -10
  49. package/lib/ImageFormatter/images-lazy-load.js +71 -79
  50. package/lib/ImageFormatter/index.js +86 -97
  51. package/lib/ImageFormatter/utils.js +1 -1
  52. package/lib/ImagePreviewerLightbox/index.js +20 -18
  53. package/lib/ImagePreviewerLightbox/utils.js +3 -3
  54. package/lib/LastModifierFormatter/index.js +24 -40
  55. package/lib/LinkEditor/index.js +163 -167
  56. package/lib/LinkEditor/link-editor-option.js +41 -56
  57. package/lib/LinkEditor/mb-link-editor-popover/index.js +90 -99
  58. package/lib/LinkEditor/pc-link-editor-popover/index.js +63 -71
  59. package/lib/LinkFormatter/index.js +75 -77
  60. package/lib/LongTextFormatter/index.js +5 -3
  61. package/lib/MBEditorHeader/index.js +25 -38
  62. package/lib/MTimeFormatter/index.js +17 -32
  63. package/lib/ModalPortal/index.js +15 -32
  64. package/lib/MultipleSelectEditor/index.js +118 -136
  65. package/lib/MultipleSelectFormatter/index.js +24 -40
  66. package/lib/NotificationPopover/index.js +68 -95
  67. package/lib/NumberEditor/index.js +75 -82
  68. package/lib/NumberFormatter/index.js +15 -28
  69. package/lib/RateFormatter/index.js +29 -45
  70. package/lib/RoleStatusEditor/index.js +20 -22
  71. package/lib/RowExpandEmailFormatter/index.js +24 -37
  72. package/lib/RowExpandFileFormatter/index.js +28 -42
  73. package/lib/RowExpandFileFormatter/row-expand-file-item-formatter.js +66 -82
  74. package/lib/RowExpandFormatter/index.js +92 -96
  75. package/lib/RowExpandFormulaFormatter/index.js +85 -91
  76. package/lib/RowExpandImageFormatter/index.js +65 -82
  77. package/lib/RowExpandImageFormatter/row-expand-image-item-formatter.js +71 -84
  78. package/lib/RowExpandImageFormatter/utils.js +1 -1
  79. package/lib/RowExpandLinkFormatter/collaborator-item-formatter.js +54 -68
  80. package/lib/RowExpandLinkFormatter/index.js +131 -137
  81. package/lib/RowExpandLinkFormatter/utils.js +23 -17
  82. package/lib/RowExpandLinkFormatter/value-display-utils.js +9 -7
  83. package/lib/RowExpandRateFormatter/index.js +27 -42
  84. package/lib/RowExpandUrlFormatter/index.js +27 -40
  85. package/lib/SelectItem/index.js +17 -33
  86. package/lib/SelectOptionGroup/index.js +141 -159
  87. package/lib/SelectOptionGroup/option.js +24 -40
  88. package/lib/SimpleLongTextFormatter/index.js +55 -67
  89. package/lib/SimpleLongTextFormatter/normalize-long-text-value.js +23 -22
  90. package/lib/SimpleLongTextFormatter/widgets/LongTextPreview.js +42 -57
  91. package/lib/SimpleLongTextFormatter/widgets/dtable-markdown-viewer.js +31 -46
  92. package/lib/SingleSelectEditor/index.js +108 -119
  93. package/lib/SingleSelectFormatter/index.js +21 -37
  94. package/lib/TextEditor/index.js +45 -51
  95. package/lib/TextFormatter/index.js +17 -32
  96. package/lib/UrlFormatter/index.js +11 -24
  97. package/lib/cellFormatterFactory/index.js +8 -17
  98. package/lib/common/ClickOutside.js +22 -43
  99. package/lib/common/delete-tip.js +40 -65
  100. package/lib/common/modal-portal.js +15 -33
  101. package/lib/constants/index.js +5 -5
  102. package/lib/data/dtable-value.js +4 -4
  103. package/lib/formatterConfig/base-formatter-config.js +24 -3
  104. package/lib/formatterConfig/index.js +5 -4
  105. package/lib/lang/index.js +6 -6
  106. package/lib/locals/de.js +1 -1
  107. package/lib/locals/en.js +1 -1
  108. package/lib/locals/fr.js +1 -1
  109. package/lib/locals/zh-CN.js +1 -1
  110. package/lib/select-editor/mb-select-editor-popover/index.js +126 -137
  111. package/lib/select-editor/pc-select-editor-popover/index.js +75 -83
  112. package/lib/select-editor/select-editor-option.js +41 -56
  113. package/lib/toaster/alert.js +73 -88
  114. package/lib/toaster/index.js +1 -1
  115. package/lib/toaster/toast.js +75 -102
  116. package/lib/toaster/toastManager.js +55 -91
  117. package/lib/toaster/toaster.js +58 -57
  118. package/lib/utils/editor-utils.js +17 -19
  119. package/lib/utils/utils.js +14 -14
  120. package/package.json +4 -4
@@ -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 { getNumberDisplayString, getDateDisplayString } from 'dtable-utils';
@@ -12,44 +8,47 @@ import LinkEditorOption from './link-editor-option';
12
8
  import PCLinkEditorPopover from './pc-link-editor-popover';
13
9
  import MBLinkEditorPopover from './mb-link-editor-popover';
14
10
  import './index.css';
15
- var LinkEditor = /*#__PURE__*/function (_React$Component) {
16
- _inherits(LinkEditor, _React$Component);
17
- var _super = _createSuper(LinkEditor);
18
- function LinkEditor(props) {
19
- var _this;
20
- _classCallCheck(this, LinkEditor);
21
- _this = _super.call(this, props);
22
- _this.onDocumentToggle = function (e) {
23
- if (_this.editorContainer !== e.target && !_this.editorContainer.contains(e.target)) {
24
- _this.onClosePopover();
11
+ class LinkEditor extends React.Component {
12
+ constructor(props) {
13
+ super(props);
14
+ this.onDocumentToggle = e => {
15
+ if (this.editorContainer !== e.target && !this.editorContainer.contains(e.target)) {
16
+ this.onClosePopover();
25
17
  }
26
18
  };
27
- _this.getLinkedCellValue = function () {
28
- var _this$props = _this.props,
29
- row = _this$props.row,
30
- column = _this$props.column,
31
- linkMetaData = _this$props.linkMetaData;
32
- var _ref = column.data || {},
33
- link_id = _ref.link_id,
34
- table_id = _ref.table_id,
35
- other_table_id = _ref.other_table_id;
36
- _this.linkId = link_id;
37
- _this.tableId = table_id;
38
- _this.otherTableId = other_table_id;
39
- return linkMetaData.getLinkedCellValue(_this.linkId, _this.tableId, _this.otherTableId, row._id);
19
+ this.getLinkedCellValue = () => {
20
+ let {
21
+ row,
22
+ column,
23
+ linkMetaData
24
+ } = this.props;
25
+ let {
26
+ link_id,
27
+ table_id,
28
+ other_table_id
29
+ } = column.data || {};
30
+ this.linkId = link_id;
31
+ this.tableId = table_id;
32
+ this.otherTableId = other_table_id;
33
+ return linkMetaData.getLinkedCellValue(this.linkId, this.tableId, this.otherTableId, row._id);
40
34
  };
41
- _this.formatLinkedValuesToOptions = function () {
42
- var _this$props2 = _this.props,
43
- column = _this$props2.column,
44
- linkMetaData = _this$props2.linkMetaData;
45
- var rowIds = _this.state.newValue;
35
+ this.formatLinkedValuesToOptions = () => {
36
+ let {
37
+ column,
38
+ linkMetaData
39
+ } = this.props;
40
+ let {
41
+ newValue: rowIds
42
+ } = this.state;
46
43
  if (rowIds && Array.isArray(rowIds) && rowIds.length > 0) {
47
- var linkedRows = linkMetaData.getLinkedRows(_this.otherTableId, rowIds);
48
- var linkedTable = linkMetaData.getLinkedTable(_this.otherTableId);
49
- return linkedRows.map(function (linkedRow) {
50
- var displayColumnKey = column.data.display_column_key;
44
+ let linkedRows = linkMetaData.getLinkedRows(this.otherTableId, rowIds);
45
+ let linkedTable = linkMetaData.getLinkedTable(this.otherTableId);
46
+ return linkedRows.map(linkedRow => {
47
+ let {
48
+ display_column_key: displayColumnKey
49
+ } = column.data;
51
50
  // format value to display
52
- var displayValue = _this.getDisplayValue(linkedTable, linkedRow, displayColumnKey);
51
+ let displayValue = this.getDisplayValue(linkedTable, linkedRow, displayColumnKey);
53
52
  return {
54
53
  id: linkedRow._id,
55
54
  name: displayValue
@@ -58,13 +57,13 @@ var LinkEditor = /*#__PURE__*/function (_React$Component) {
58
57
  }
59
58
  return [];
60
59
  };
61
- _this.getDisplayValue = function (linkedTable, linkedRow, displayColumnKey) {
62
- var value = linkedRow[displayColumnKey];
63
- var linkedColumn = linkedTable.columns.find(function (column) {
64
- return column.key === displayColumnKey;
65
- });
66
- var type = linkedColumn.type,
67
- data = linkedColumn.data;
60
+ this.getDisplayValue = (linkedTable, linkedRow, displayColumnKey) => {
61
+ let value = linkedRow[displayColumnKey];
62
+ let linkedColumn = linkedTable.columns.find(column => column.key === displayColumnKey);
63
+ let {
64
+ type,
65
+ data
66
+ } = linkedColumn;
68
67
  switch (type) {
69
68
  case CellType.NUMBER:
70
69
  {
@@ -72,24 +71,29 @@ var LinkEditor = /*#__PURE__*/function (_React$Component) {
72
71
  }
73
72
  case CellType.DATE:
74
73
  {
75
- var format = data.format;
74
+ let {
75
+ format
76
+ } = data;
76
77
  return getDateDisplayString(value, format);
77
78
  }
78
79
  default:
79
80
  return value;
80
81
  }
81
82
  };
82
- _this.getAvailableLinkedOptions = function () {
83
- var _this$props3 = _this.props,
84
- column = _this$props3.column,
85
- linkMetaData = _this$props3.linkMetaData;
86
- var displayColumnKey = column.data.display_column_key;
87
- var linkedTable = linkMetaData.getLinkedTable(_this.otherTableId);
88
- var availableRows = linkedTable.rows.filter(function (row) {
83
+ this.getAvailableLinkedOptions = () => {
84
+ let {
85
+ column,
86
+ linkMetaData
87
+ } = this.props;
88
+ let {
89
+ display_column_key: displayColumnKey
90
+ } = column.data;
91
+ let linkedTable = linkMetaData.getLinkedTable(this.otherTableId);
92
+ let availableRows = linkedTable.rows.filter(row => {
89
93
  return !!row[displayColumnKey];
90
94
  });
91
- var availableOptions = availableRows.map(function (row) {
92
- var displayValue = _this.getDisplayValue(linkedTable, row, displayColumnKey);
95
+ let availableOptions = availableRows.map(row => {
96
+ let displayValue = this.getDisplayValue(linkedTable, row, displayColumnKey);
93
97
  return {
94
98
  id: row._id,
95
99
  name: displayValue
@@ -97,75 +101,74 @@ var LinkEditor = /*#__PURE__*/function (_React$Component) {
97
101
  });
98
102
  return availableOptions;
99
103
  };
100
- _this.onCommit = function (newValue) {
104
+ this.onCommit = newValue => {
101
105
  // nothing todo
102
106
  };
103
- _this.onAddOptionToggle = function (event) {
107
+ this.onAddOptionToggle = event => {
104
108
  event.nativeEvent.stopImmediatePropagation();
105
109
  event.stopPropagation();
106
- if (_this.props.isReadOnly) {
110
+ if (this.props.isReadOnly) {
107
111
  return;
108
112
  }
109
- var isPopoverShow = !_this.state.isPopoverShow;
113
+ let isPopoverShow = !this.state.isPopoverShow;
110
114
  if (isPopoverShow) {
111
- var popoverPosition = _this.caculatePopoverPosition();
112
- _this.setState({
113
- isPopoverShow: isPopoverShow,
114
- popoverPosition: popoverPosition
115
+ let popoverPosition = this.caculatePopoverPosition();
116
+ this.setState({
117
+ isPopoverShow,
118
+ popoverPosition
115
119
  });
116
120
  } else {
117
- _this.setState({
118
- isPopoverShow: isPopoverShow
121
+ this.setState({
122
+ isPopoverShow
119
123
  });
120
124
  }
121
125
  };
122
- _this.onOptionItemToggle = function (option) {
123
- var _this$props4 = _this.props,
124
- row = _this$props4.row,
125
- linkMetaData = _this$props4.linkMetaData;
126
- var newValue = _this.state.newValue.slice();
127
- var optionIndex = newValue.findIndex(function (option_id) {
128
- return option_id === option.id;
129
- });
126
+ this.onOptionItemToggle = option => {
127
+ let {
128
+ row,
129
+ linkMetaData
130
+ } = this.props;
131
+ let newValue = this.state.newValue.slice();
132
+ let optionIndex = newValue.findIndex(option_id => option_id === option.id);
130
133
  if (optionIndex !== -1) {
131
134
  newValue.splice(optionIndex, 1);
132
- linkMetaData.removeLink(_this.linkId, _this.tableId, _this.otherTableId, row._id, option.id);
135
+ linkMetaData.removeLink(this.linkId, this.tableId, this.otherTableId, row._id, option.id);
133
136
  } else {
134
137
  newValue.push(option.id);
135
- linkMetaData.addLink(_this.linkId, _this.tableId, _this.otherTableId, row._id, option.id);
138
+ linkMetaData.addLink(this.linkId, this.tableId, this.otherTableId, row._id, option.id);
136
139
  }
137
- _this.setState({
138
- newValue: newValue
140
+ this.setState({
141
+ newValue
139
142
  });
140
143
  };
141
- _this.onDeleteOption = function (option) {
142
- var _this$props5 = _this.props,
143
- row = _this$props5.row,
144
- linkMetaData = _this$props5.linkMetaData;
145
- var newValue = _this.state.newValue.slice();
146
- var optionIndex = newValue.findIndex(function (option_id) {
147
- return option_id === option.id;
148
- });
144
+ this.onDeleteOption = option => {
145
+ let {
146
+ row,
147
+ linkMetaData
148
+ } = this.props;
149
+ let newValue = this.state.newValue.slice();
150
+ let optionIndex = newValue.findIndex(option_id => option_id === option.id);
149
151
  newValue.splice(optionIndex, 1);
150
- _this.setState({
151
- newValue: newValue
152
- }, function () {
153
- linkMetaData.removeLink(_this.linkId, _this.tableId, _this.otherTableId, row._id, option.id);
152
+ this.setState({
153
+ newValue
154
+ }, () => {
155
+ linkMetaData.removeLink(this.linkId, this.tableId, this.otherTableId, row._id, option.id);
154
156
  });
155
157
  };
156
- _this.caculatePopoverPosition = function () {
157
- var POPOVER_MAX_HEIGHT = 200;
158
- var innerHeight = window.innerHeight;
159
- var _this$editor$getClien = _this.editor.getClientRects()[0],
160
- top = _this$editor$getClien.top,
161
- height = _this$editor$getClien.height;
162
- var isBelow = innerHeight - (top + height) > POPOVER_MAX_HEIGHT;
163
- var position = {
158
+ this.caculatePopoverPosition = () => {
159
+ const POPOVER_MAX_HEIGHT = 200;
160
+ let innerHeight = window.innerHeight;
161
+ let {
162
+ top,
163
+ height
164
+ } = this.editor.getClientRects()[0];
165
+ let isBelow = innerHeight - (top + height) > POPOVER_MAX_HEIGHT;
166
+ let position = {
164
167
  top: height + 1,
165
168
  left: 0
166
169
  };
167
170
  if (!isBelow) {
168
- var bottom = height + 1;
171
+ let bottom = height + 1;
169
172
  position = {
170
173
  bottom: bottom,
171
174
  left: 0
@@ -173,85 +176,78 @@ var LinkEditor = /*#__PURE__*/function (_React$Component) {
173
176
  }
174
177
  return position;
175
178
  };
176
- _this.onClosePopover = function () {
177
- _this.setState({
179
+ this.onClosePopover = () => {
180
+ this.setState({
178
181
  isPopoverShow: false
179
182
  });
180
183
  };
181
- _this.setEditorContainerRef = function (editorContainer) {
182
- _this.editorContainer = editorContainer;
184
+ this.setEditorContainerRef = editorContainer => {
185
+ this.editorContainer = editorContainer;
183
186
  };
184
- _this.setEditorRef = function (editor) {
185
- _this.editor = editor;
187
+ this.setEditorRef = editor => {
188
+ this.editor = editor;
186
189
  };
187
- _this.linkId = '';
188
- _this.tableId = '';
189
- _this.otherTableId = '';
190
- _this.state = {
191
- newValue: _this.getLinkedCellValue(),
190
+ this.linkId = '';
191
+ this.tableId = '';
192
+ this.otherTableId = '';
193
+ this.state = {
194
+ newValue: this.getLinkedCellValue(),
192
195
  isPopoverShow: false,
193
196
  popoverPosition: {}
194
197
  };
195
- return _this;
196
198
  }
197
- _createClass(LinkEditor, [{
198
- key: "componentDidMount",
199
- value: function componentDidMount() {
200
- document.addEventListener('click', this.onDocumentToggle);
201
- }
202
- }, {
203
- key: "componentWillUnmount",
204
- value: function componentWillUnmount() {
205
- document.removeEventListener('click', this.onDocumentToggle);
206
- }
207
- }, {
208
- key: "render",
209
- value: function render() {
210
- var _this2 = this;
211
- var isReadOnly = this.props.isReadOnly;
212
- var _this$state = this.state,
213
- isPopoverShow = _this$state.isPopoverShow,
214
- popoverPosition = _this$state.popoverPosition;
215
- var options = this.getAvailableLinkedOptions();
216
- var selectedOptions = this.formatLinkedValuesToOptions();
217
- var isShowRemoveIcon = !isReadOnly;
218
- return /*#__PURE__*/React.createElement("div", {
219
- ref: this.setEditorContainerRef,
220
- className: "dtable-ui-link-editor"
221
- }, /*#__PURE__*/React.createElement("div", {
222
- ref: this.setEditorRef,
223
- className: "dtable-ui-link-editor-container",
224
- onClick: this.onAddOptionToggle
225
- }, selectedOptions.length === 0 && /*#__PURE__*/React.createElement(EditEditorButton, {
226
- text: getLocale('Add_an_option')
227
- }), selectedOptions.length !== 0 && selectedOptions.map(function (option) {
228
- return /*#__PURE__*/React.createElement(LinkEditorOption, {
229
- key: option.id,
230
- option: option,
231
- isShowRemoveIcon: isShowRemoveIcon,
232
- onDeleteLinkOption: _this2.onDeleteOption
233
- });
234
- })), isPopoverShow && /*#__PURE__*/React.createElement(Fragment, null, /*#__PURE__*/React.createElement(MediaQuery, {
235
- query: "(min-width: 768px)"
236
- }, /*#__PURE__*/React.createElement(PCLinkEditorPopover, {
237
- popoverPosition: popoverPosition,
238
- options: options,
239
- selectedOptions: selectedOptions,
240
- onOptionItemToggle: this.onOptionItemToggle
241
- })), /*#__PURE__*/React.createElement(MediaQuery, {
242
- query: "(max-width: 767.8px)"
243
- }, /*#__PURE__*/React.createElement(MBLinkEditorPopover, {
244
- isReadOnly: this.props.isReadOnly,
245
- value: this.state.newValue,
246
- column: this.props.column,
247
- options: options,
248
- onOptionItemToggle: this.onOptionItemToggle,
249
- onClosePopover: this.onClosePopover
250
- }))));
251
- }
252
- }]);
253
- return LinkEditor;
254
- }(React.Component);
199
+ componentDidMount() {
200
+ document.addEventListener('click', this.onDocumentToggle);
201
+ }
202
+ componentWillUnmount() {
203
+ document.removeEventListener('click', this.onDocumentToggle);
204
+ }
205
+ render() {
206
+ let {
207
+ isReadOnly
208
+ } = this.props;
209
+ let {
210
+ isPopoverShow,
211
+ popoverPosition
212
+ } = this.state;
213
+ let options = this.getAvailableLinkedOptions();
214
+ let selectedOptions = this.formatLinkedValuesToOptions();
215
+ let isShowRemoveIcon = !isReadOnly;
216
+ return /*#__PURE__*/React.createElement("div", {
217
+ ref: this.setEditorContainerRef,
218
+ className: "dtable-ui-link-editor"
219
+ }, /*#__PURE__*/React.createElement("div", {
220
+ ref: this.setEditorRef,
221
+ className: "dtable-ui-link-editor-container",
222
+ onClick: this.onAddOptionToggle
223
+ }, selectedOptions.length === 0 && /*#__PURE__*/React.createElement(EditEditorButton, {
224
+ text: getLocale('Add_an_option')
225
+ }), selectedOptions.length !== 0 && selectedOptions.map(option => {
226
+ return /*#__PURE__*/React.createElement(LinkEditorOption, {
227
+ key: option.id,
228
+ option: option,
229
+ isShowRemoveIcon: isShowRemoveIcon,
230
+ onDeleteLinkOption: this.onDeleteOption
231
+ });
232
+ })), isPopoverShow && /*#__PURE__*/React.createElement(Fragment, null, /*#__PURE__*/React.createElement(MediaQuery, {
233
+ query: "(min-width: 768px)"
234
+ }, /*#__PURE__*/React.createElement(PCLinkEditorPopover, {
235
+ popoverPosition: popoverPosition,
236
+ options: options,
237
+ selectedOptions: selectedOptions,
238
+ onOptionItemToggle: this.onOptionItemToggle
239
+ })), /*#__PURE__*/React.createElement(MediaQuery, {
240
+ query: "(max-width: 767.8px)"
241
+ }, /*#__PURE__*/React.createElement(MBLinkEditorPopover, {
242
+ isReadOnly: this.props.isReadOnly,
243
+ value: this.state.newValue,
244
+ column: this.props.column,
245
+ options: options,
246
+ onOptionItemToggle: this.onOptionItemToggle,
247
+ onClosePopover: this.onClosePopover
248
+ }))));
249
+ }
250
+ }
255
251
  LinkEditor.defaultProps = {
256
252
  isReadOnly: false
257
253
  };
@@ -1,24 +1,13 @@
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
- var LinkEditorOption = /*#__PURE__*/function (_React$Component) {
7
- _inherits(LinkEditorOption, _React$Component);
8
- var _super = _createSuper(LinkEditorOption);
9
- function LinkEditorOption() {
10
- var _this;
11
- _classCallCheck(this, LinkEditorOption);
12
- for (var _len = arguments.length, args = new Array(_len), _key = 0; _key < _len; _key++) {
13
- args[_key] = arguments[_key];
14
- }
15
- _this = _super.call.apply(_super, [this].concat(args));
16
- _this.onDeleteOption = function (event) {
2
+ class LinkEditorOption extends React.Component {
3
+ constructor() {
4
+ super(...arguments);
5
+ this.onDeleteOption = event => {
17
6
  event.nativeEvent.stopImmediatePropagation();
18
7
  event.stopPropagation();
19
- _this.props.onDeleteLinkOption(_this.props.option);
8
+ this.props.onDeleteLinkOption(this.props.option);
20
9
  };
21
- _this.getContainerStyle = function () {
10
+ this.getContainerStyle = () => {
22
11
  return {
23
12
  display: 'inline-flex',
24
13
  marginRight: '10px',
@@ -30,7 +19,7 @@ var LinkEditorOption = /*#__PURE__*/function (_React$Component) {
30
19
  cursor: 'pointer'
31
20
  };
32
21
  };
33
- _this.getOptionStyle = function () {
22
+ this.getOptionStyle = () => {
34
23
  return {
35
24
  flex: 1,
36
25
  display: 'flex',
@@ -38,7 +27,7 @@ var LinkEditorOption = /*#__PURE__*/function (_React$Component) {
38
27
  margin: '0 4px 0 2px'
39
28
  };
40
29
  };
41
- _this.getOptionNameStyle = function () {
30
+ this.getOptionNameStyle = () => {
42
31
  return {
43
32
  maxWidth: '230px',
44
33
  overflow: 'hidden',
@@ -46,7 +35,7 @@ var LinkEditorOption = /*#__PURE__*/function (_React$Component) {
46
35
  textOverflow: 'ellipsis'
47
36
  };
48
37
  };
49
- _this.getOperationStyle = function () {
38
+ this.getOperationStyle = () => {
50
39
  return {
51
40
  height: '20px',
52
41
  width: '16px',
@@ -55,43 +44,39 @@ var LinkEditorOption = /*#__PURE__*/function (_React$Component) {
55
44
  transform: 'scale(.8)'
56
45
  };
57
46
  };
58
- return _this;
59
47
  }
60
- _createClass(LinkEditorOption, [{
61
- key: "render",
62
- value: function render() {
63
- var _this$props = this.props,
64
- option = _this$props.option,
65
- isShowRemoveIcon = _this$props.isShowRemoveIcon;
66
- var containerStyle = this.getContainerStyle();
67
- var optionStyle = this.getOptionStyle();
68
- var optionNameStyle = this.getOptionNameStyle();
69
- var operationStyle = this.getOperationStyle();
70
- return /*#__PURE__*/React.createElement("div", {
71
- className: "dtable-ui link-option-item",
72
- style: containerStyle
73
- }, /*#__PURE__*/React.createElement("div", {
74
- className: "option-info",
75
- style: optionStyle
76
- }, /*#__PURE__*/React.createElement("div", {
77
- className: "option-name",
78
- style: optionNameStyle,
79
- title: option.name
80
- }, option.name)), isShowRemoveIcon && /*#__PURE__*/React.createElement("div", {
81
- className: "option-remove",
82
- style: operationStyle,
83
- onClick: this.onDeleteOption
84
- }, /*#__PURE__*/React.createElement("i", {
85
- className: "dtable-font dtable-icon-fork-number",
86
- style: {
87
- fontSize: '12px',
88
- lineHeight: '20px'
89
- }
90
- })));
91
- }
92
- }]);
93
- return LinkEditorOption;
94
- }(React.Component);
48
+ render() {
49
+ let {
50
+ option,
51
+ isShowRemoveIcon
52
+ } = this.props;
53
+ let containerStyle = this.getContainerStyle();
54
+ let optionStyle = this.getOptionStyle();
55
+ let optionNameStyle = this.getOptionNameStyle();
56
+ let operationStyle = this.getOperationStyle();
57
+ return /*#__PURE__*/React.createElement("div", {
58
+ className: "dtable-ui link-option-item",
59
+ style: containerStyle
60
+ }, /*#__PURE__*/React.createElement("div", {
61
+ className: "option-info",
62
+ style: optionStyle
63
+ }, /*#__PURE__*/React.createElement("div", {
64
+ className: "option-name",
65
+ style: optionNameStyle,
66
+ title: option.name
67
+ }, option.name)), isShowRemoveIcon && /*#__PURE__*/React.createElement("div", {
68
+ className: "option-remove",
69
+ style: operationStyle,
70
+ onClick: this.onDeleteOption
71
+ }, /*#__PURE__*/React.createElement("i", {
72
+ className: "dtable-font dtable-icon-fork-number",
73
+ style: {
74
+ fontSize: '12px',
75
+ lineHeight: '20px'
76
+ }
77
+ })));
78
+ }
79
+ }
95
80
  LinkEditorOption.defaultProps = {
96
81
  isShowRemoveIcon: false
97
82
  };