dtable-ui-component 0.3.20 → 0.3.21

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 (107) hide show
  1. package/lib/AutoNumberFormatter/index.js +2 -9
  2. package/lib/ButtonFormatter/index.js +4 -17
  3. package/lib/CTimeFormatter/index.js +2 -15
  4. package/lib/CheckboxEditor/index.js +0 -13
  5. package/lib/CheckboxFormatter/index.js +2 -11
  6. package/lib/CollaboratorEditor/index.js +6 -44
  7. package/lib/CollaboratorEditor/mb-collaborator-editor-popover/index.js +2 -27
  8. package/lib/CollaboratorEditor/pc-collaborator-editor-popover/index.js +2 -20
  9. package/lib/CollaboratorFormatter/index.js +6 -23
  10. package/lib/CollaboratorItem/index.js +2 -14
  11. package/lib/CreatorFormatter/index.js +6 -22
  12. package/lib/DTableCustomizeCollaboratorSelect/index.js +16 -37
  13. package/lib/DTableCustomizeCollaboratorSelect/utils.js +6 -5
  14. package/lib/DTableCustomizeSelect/index.js +14 -37
  15. package/lib/DTablePopover/index.js +8 -26
  16. package/lib/DTableRadio/index.js +0 -2
  17. package/lib/DTableSearchInput/index.js +12 -36
  18. package/lib/DTableSelect/index.js +13 -27
  19. package/lib/DTableSwitch/index.js +4 -6
  20. package/lib/DateEditor/index.js +8 -27
  21. package/lib/DateEditor/mb-date-editor-popover/index.js +8 -42
  22. package/lib/DateEditor/pc-date-editor-popover.js +7 -27
  23. package/lib/DateFormatter/index.js +3 -12
  24. package/lib/DigitalSignFormatter/index.js +8 -26
  25. package/lib/DigitalSignFormatter/utils.js +3 -6
  26. package/lib/DurationFormatter/index.js +3 -10
  27. package/lib/EditEditorButton/index.js +0 -7
  28. package/lib/EmailFormatter/index.js +2 -9
  29. package/lib/FieldDisplaySetting/field-item.js +6 -20
  30. package/lib/FieldDisplaySetting/index.js +8 -13
  31. package/lib/FileEditor/index.js +0 -8
  32. package/lib/FileFormatter/index.js +3 -14
  33. package/lib/FileItemFormatter/index.js +0 -13
  34. package/lib/FileItemFormatter/utils.js +0 -6
  35. package/lib/FileUploader/index.js +0 -16
  36. package/lib/FormulaFormatter/cell-value-validator.js +0 -10
  37. package/lib/FormulaFormatter/index.js +8 -38
  38. package/lib/FormulaFormatter/utils.js +0 -17
  39. package/lib/GeolocationFormatter/index.js +4 -13
  40. package/lib/HtmlLongTextFormatter/index.js +0 -21
  41. package/lib/HtmlLongTextFormatter/markdown2html.js +2 -17
  42. package/lib/HtmlLongTextFormatter/unified/index.js +29 -102
  43. package/lib/HtmlLongTextFormatter/vfile/core.js +13 -32
  44. package/lib/HtmlLongTextFormatter/vfile/index.js +4 -11
  45. package/lib/ImageFormatter/images-lazy-load.js +5 -35
  46. package/lib/ImageFormatter/index.js +7 -34
  47. package/lib/ImageFormatter/utils.js +0 -1
  48. package/lib/ImagePreviewerLightbox/index.js +11 -13
  49. package/lib/LastModifierFormatter/index.js +6 -22
  50. package/lib/LinkEditor/index.js +23 -69
  51. package/lib/LinkEditor/link-editor-option.js +2 -18
  52. package/lib/LinkEditor/mb-link-editor-popover/index.js +2 -27
  53. package/lib/LinkEditor/pc-link-editor-popover/index.js +2 -20
  54. package/lib/LinkFormatter/index.js +12 -35
  55. package/lib/LongTextFormatter/index.js +2 -6
  56. package/lib/MBEditorHeader/index.js +6 -13
  57. package/lib/MTimeFormatter/index.js +2 -15
  58. package/lib/ModalPortal/index.js +0 -8
  59. package/lib/MultipleSelectEditor/index.js +4 -42
  60. package/lib/MultipleSelectFormatter/index.js +4 -17
  61. package/lib/NotificationPopover/index.js +3 -22
  62. package/lib/NumberEditor/index.js +7 -35
  63. package/lib/NumberFormatter/index.js +3 -12
  64. package/lib/RateFormatter/index.js +10 -25
  65. package/lib/RowExpandEmailFormatter/index.js +2 -13
  66. package/lib/RowExpandFileFormatter/index.js +6 -15
  67. package/lib/RowExpandFileFormatter/row-expand-file-item-formatter.js +6 -24
  68. package/lib/RowExpandFormatter/index.js +10 -60
  69. package/lib/RowExpandFormulaFormatter/index.js +10 -41
  70. package/lib/RowExpandImageFormatter/index.js +8 -27
  71. package/lib/RowExpandImageFormatter/row-expand-image-item-formatter.js +11 -27
  72. package/lib/RowExpandImageFormatter/utils.js +0 -1
  73. package/lib/RowExpandLinkFormatter/collaborator-item-formatter.js +4 -35
  74. package/lib/RowExpandLinkFormatter/index.js +6 -28
  75. package/lib/RowExpandLinkFormatter/utils.js +0 -4
  76. package/lib/RowExpandLinkFormatter/value-display-utils.js +2 -2
  77. package/lib/RowExpandRateFormatter/index.js +8 -23
  78. package/lib/RowExpandUrlFormatter/index.js +2 -14
  79. package/lib/SelectItem/index.js +2 -13
  80. package/lib/SelectOptionGroup/index.js +13 -42
  81. package/lib/SelectOptionGroup/option.js +0 -14
  82. package/lib/SimpleLongTextFormatter/index.js +0 -26
  83. package/lib/SimpleLongTextFormatter/normalize-long-text-value.js +2 -12
  84. package/lib/SimpleLongTextFormatter/widgets/LongTextPreview.js +1 -16
  85. package/lib/SimpleLongTextFormatter/widgets/dtable-markdown-viewer.js +0 -17
  86. package/lib/SingleSelectEditor/index.js +4 -37
  87. package/lib/SingleSelectFormatter/index.js +5 -17
  88. package/lib/TextEditor/index.js +3 -22
  89. package/lib/TextFormatter/index.js +2 -15
  90. package/lib/UrlFormatter/index.js +2 -9
  91. package/lib/cellFormatterFactory/index.js +0 -5
  92. package/lib/common/delete-tip.js +4 -16
  93. package/lib/common/modal-portal.js +0 -8
  94. package/lib/formatterConfig/base-formatter-config.js +0 -2
  95. package/lib/formatterConfig/index.js +0 -4
  96. package/lib/index.js +12 -6
  97. package/lib/lang/index.js +0 -7
  98. package/lib/select-editor/mb-select-editor-popover/index.js +6 -38
  99. package/lib/select-editor/pc-select-editor-popover/index.js +3 -25
  100. package/lib/select-editor/select-editor-option.js +2 -17
  101. package/lib/toaster/alert.js +0 -12
  102. package/lib/toaster/toast.js +1 -22
  103. package/lib/toaster/toastManager.js +7 -30
  104. package/lib/toaster/toaster.js +4 -15
  105. package/lib/utils/editor-utils.js +0 -20
  106. package/lib/utils/utils.js +2 -5
  107. package/package.json +5 -5
@@ -7,75 +7,59 @@ import { Tooltip } from 'reactstrap';
7
7
  import { getLocale } from '../lang';
8
8
  import { getFileIconUrl } from '../FileItemFormatter/utils';
9
9
  import DeleteTip from '../common/delete-tip';
10
-
11
10
  var RowExpandFileItemFormatter = /*#__PURE__*/function (_Component) {
12
11
  _inherits(RowExpandFileItemFormatter, _Component);
13
-
14
12
  var _super = _createSuper(RowExpandFileItemFormatter);
15
-
16
13
  function RowExpandFileItemFormatter(props) {
17
14
  var _this;
18
-
19
15
  _classCallCheck(this, RowExpandFileItemFormatter);
20
-
21
16
  _this = _super.call(this, props);
22
-
23
17
  _this.toggleTooltip = function () {
24
18
  _this.setState({
25
19
  isTooltipOpen: !_this.state.isTooltipOpen
26
20
  });
27
21
  };
28
-
29
22
  _this.closeDeleteTip = function () {
30
23
  _this.setState({
31
24
  isDeleteTipOpen: false
32
25
  });
33
26
  };
34
-
35
27
  _this.onClickDelete = function (e) {
36
28
  e.stopPropagation();
37
29
  _this.position = {
38
30
  top: e.clientY,
39
31
  left: e.clientX
40
32
  };
41
-
42
33
  _this.setState({
43
34
  isDeleteTipOpen: true
44
35
  });
45
36
  };
46
-
47
37
  _this.onDelete = function (e) {
48
38
  e.stopPropagation();
49
-
50
39
  _this.closeDeleteTip();
51
-
52
40
  _this.props.deleteFile(_this.props.index);
53
41
  };
54
-
55
42
  _this.getFileIconData = function (item) {
56
43
  var fileIconUrl = getFileIconUrl(item.name, item.type);
57
44
  return require('../FileItemFormatter/' + fileIconUrl);
58
45
  };
59
-
60
46
  _this.state = {
61
47
  isTooltipOpen: false,
62
48
  isDeleteTipOpen: false
63
49
  };
64
50
  return _this;
65
51
  }
66
-
67
52
  _createClass(RowExpandFileItemFormatter, [{
68
53
  key: "render",
69
54
  value: function render() {
70
55
  var _this2 = this;
71
-
72
56
  var _this$props = this.props,
73
- file = _this$props.file,
74
- column = _this$props.column,
75
- index = _this$props.index,
76
- readOnly = _this$props.readOnly,
77
- downloadFile = _this$props.downloadFile,
78
- deleteFile = _this$props.deleteFile;
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;
79
63
  var id = 'file-list-preview-item' + column.key + index;
80
64
  var url = this.getFileIconData(file);
81
65
  return /*#__PURE__*/React.createElement(React.Fragment, null, /*#__PURE__*/React.createElement("div", {
@@ -118,8 +102,6 @@ var RowExpandFileItemFormatter = /*#__PURE__*/function (_Component) {
118
102
  }, file.name));
119
103
  }
120
104
  }]);
121
-
122
105
  return RowExpandFileItemFormatter;
123
106
  }(Component);
124
-
125
107
  export { RowExpandFileItemFormatter as default };
@@ -9,36 +9,26 @@ import classnames from 'classnames';
9
9
  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 } from '../index';
10
10
  import { CellType } from '../constants';
11
11
  import './index.css';
12
-
13
12
  var EditorFormatter = /*#__PURE__*/function (_React$Component) {
14
13
  _inherits(EditorFormatter, _React$Component);
15
-
16
14
  var _super = _createSuper(EditorFormatter);
17
-
18
15
  function EditorFormatter(_props) {
19
16
  var _this;
20
-
21
17
  _classCallCheck(this, EditorFormatter);
22
-
23
18
  _this = _super.call(this, _props);
24
-
25
19
  _this.updateCollaborators = function () {
26
20
  _this.setState({
27
21
  collaborators: _this.getCollaborator()
28
22
  });
29
23
  };
30
-
31
24
  _this.calculateCollaboratorData = function (props) {
32
25
  var row = props.row,
33
- column = props.column;
34
-
26
+ column = props.column;
35
27
  if (column.type === CellType.CREATOR || column.type === CellType.LAST_MODIFIER) {
36
28
  var email = row[column.name];
37
-
38
29
  _this.loadCollaborator(email);
39
30
  } else if (column.type === CellType.COLLABORATOR) {
40
31
  var emails = row[column.name];
41
-
42
32
  if (Array.isArray(emails)) {
43
33
  emails.forEach(function (email) {
44
34
  _this.loadCollaborator(email);
@@ -46,44 +36,36 @@ var EditorFormatter = /*#__PURE__*/function (_React$Component) {
46
36
  }
47
37
  }
48
38
  };
49
-
50
39
  _this.getCollaborator = function () {
51
40
  var _this$props = _this.props,
52
- context = _this$props.context,
53
- collaborators = _this$props.collaborators;
54
-
41
+ context = _this$props.context,
42
+ collaborators = _this$props.collaborators;
55
43
  if (context && context.getCollaboratorsFromCache) {
56
44
  return context.getCollaboratorsFromCache();
57
45
  }
58
-
59
46
  return collaborators || [];
60
47
  };
61
-
62
48
  _this.loadCollaborator = function (email) {
63
49
  var context = _this.props.context;
64
-
65
50
  if (context && context.loadCollaborator) {
66
51
  context.loadCollaborator(email);
67
52
  }
68
53
  };
69
-
70
54
  _this.renderEmpty = function () {
71
55
  return /*#__PURE__*/React.createElement("div", {
72
56
  className: "d-flex align-items-center form-control disabled h-auto"
73
57
  });
74
58
  };
75
-
76
59
  _this.renderFormatter = function () {
77
60
  var _this$props2 = _this.props,
78
- column = _this$props2.column,
79
- row = _this$props2.row,
80
- className = _this$props2.className;
61
+ column = _this$props2.column,
62
+ row = _this$props2.row,
63
+ className = _this$props2.className;
81
64
  var _column = column,
82
- columnType = _column.type;
65
+ columnType = _column.type;
83
66
  var collaborators = _this.state.collaborators;
84
67
  var containerClassName = "dtable-".concat(columnType, "-formatter ").concat(className || '');
85
68
  var cellValue = row[column.key] || row[column.name];
86
-
87
69
  switch (columnType) {
88
70
  case CellType.TEXT:
89
71
  {
@@ -94,7 +76,6 @@ var EditorFormatter = /*#__PURE__*/function (_React$Component) {
94
76
  containerClassName: containerClassName
95
77
  }));
96
78
  }
97
-
98
79
  case CellType.COLLABORATOR:
99
80
  {
100
81
  return /*#__PURE__*/React.createElement("div", {
@@ -105,7 +86,6 @@ var EditorFormatter = /*#__PURE__*/function (_React$Component) {
105
86
  containerClassName: containerClassName
106
87
  }));
107
88
  }
108
-
109
89
  case CellType.LONG_TEXT:
110
90
  {
111
91
  return /*#__PURE__*/React.createElement("div", {
@@ -116,7 +96,6 @@ var EditorFormatter = /*#__PURE__*/function (_React$Component) {
116
96
  isSample: false
117
97
  }));
118
98
  }
119
-
120
99
  case CellType.GEOLOCATION:
121
100
  {
122
101
  if (typeof cellValue !== 'object') return null;
@@ -128,7 +107,6 @@ var EditorFormatter = /*#__PURE__*/function (_React$Component) {
128
107
  containerClassName: containerClassName
129
108
  }));
130
109
  }
131
-
132
110
  case CellType.NUMBER:
133
111
  {
134
112
  return /*#__PURE__*/React.createElement("div", {
@@ -142,7 +120,6 @@ var EditorFormatter = /*#__PURE__*/function (_React$Component) {
142
120
  containerClassName: containerClassName
143
121
  }));
144
122
  }
145
-
146
123
  case CellType.DATE:
147
124
  {
148
125
  return /*#__PURE__*/React.createElement("div", {
@@ -156,7 +133,6 @@ var EditorFormatter = /*#__PURE__*/function (_React$Component) {
156
133
  containerClassName: containerClassName
157
134
  }));
158
135
  }
159
-
160
136
  case CellType.CTIME:
161
137
  {
162
138
  return /*#__PURE__*/React.createElement("div", {
@@ -169,7 +145,6 @@ var EditorFormatter = /*#__PURE__*/function (_React$Component) {
169
145
  containerClassName: containerClassName
170
146
  }));
171
147
  }
172
-
173
148
  case CellType.MTIME:
174
149
  {
175
150
  return /*#__PURE__*/React.createElement("div", {
@@ -182,7 +157,6 @@ var EditorFormatter = /*#__PURE__*/function (_React$Component) {
182
157
  containerClassName: containerClassName
183
158
  }));
184
159
  }
185
-
186
160
  case CellType.MULTIPLE_SELECT:
187
161
  {
188
162
  var options = column.data ? column.data.options : [];
@@ -194,11 +168,9 @@ var EditorFormatter = /*#__PURE__*/function (_React$Component) {
194
168
  containerClassName: containerClassName
195
169
  }));
196
170
  }
197
-
198
171
  case CellType.SINGLE_SELECT:
199
172
  {
200
173
  var _options = column.data ? column.data.options : [];
201
-
202
174
  return /*#__PURE__*/React.createElement("div", {
203
175
  className: "form-control d-flex align-items-center w-100"
204
176
  }, /*#__PURE__*/React.createElement(SingleSelectFormatter, {
@@ -207,7 +179,6 @@ var EditorFormatter = /*#__PURE__*/function (_React$Component) {
207
179
  containerClassName: containerClassName
208
180
  }));
209
181
  }
210
-
211
182
  case CellType.FILE:
212
183
  {
213
184
  return /*#__PURE__*/React.createElement(RowExpandFileFormatter, {
@@ -217,7 +188,6 @@ var EditorFormatter = /*#__PURE__*/function (_React$Component) {
217
188
  deleteFile: _this.props.deleteFile
218
189
  });
219
190
  }
220
-
221
191
  case CellType.IMAGE:
222
192
  {
223
193
  return /*#__PURE__*/React.createElement(RowExpandImageFormatter, {
@@ -228,7 +198,6 @@ var EditorFormatter = /*#__PURE__*/function (_React$Component) {
228
198
  onRotateImage: _this.props.onRotateImage
229
199
  });
230
200
  }
231
-
232
201
  case CellType.CHECKBOX:
233
202
  {
234
203
  return /*#__PURE__*/React.createElement("div", {
@@ -237,7 +206,6 @@ var EditorFormatter = /*#__PURE__*/function (_React$Component) {
237
206
  value: cellValue
238
207
  }));
239
208
  }
240
-
241
209
  case CellType.CREATOR:
242
210
  {
243
211
  return /*#__PURE__*/React.createElement(CreatorFormatter, {
@@ -246,7 +214,6 @@ var EditorFormatter = /*#__PURE__*/function (_React$Component) {
246
214
  containerClassName: containerClassName
247
215
  });
248
216
  }
249
-
250
217
  case CellType.LAST_MODIFIER:
251
218
  {
252
219
  return /*#__PURE__*/React.createElement(LastModifierFormatter, {
@@ -255,7 +222,6 @@ var EditorFormatter = /*#__PURE__*/function (_React$Component) {
255
222
  containerClassName: containerClassName
256
223
  });
257
224
  }
258
-
259
225
  case CellType.FORMULA:
260
226
  case CellType.LINK_FORMULA:
261
227
  {
@@ -266,16 +232,14 @@ var EditorFormatter = /*#__PURE__*/function (_React$Component) {
266
232
  containerClassName: containerClassName
267
233
  });
268
234
  }
269
-
270
235
  case CellType.LINK:
271
236
  {
272
237
  // handle link column do not have column.data.display_column
273
238
  var _column2 = column,
274
- data = _column2.data;
239
+ data = _column2.data;
275
240
  var display_column_key = data.display_column_key,
276
- array_type = data.array_type,
277
- array_data = data.array_data;
278
-
241
+ array_type = data.array_type,
242
+ array_data = data.array_data;
279
243
  if (!data.display_column) {
280
244
  column = _objectSpread(_objectSpread({}, column), {}, {
281
245
  data: _objectSpread(_objectSpread({}, data), {}, {
@@ -287,7 +251,6 @@ var EditorFormatter = /*#__PURE__*/function (_React$Component) {
287
251
  })
288
252
  });
289
253
  }
290
-
291
254
  return /*#__PURE__*/React.createElement(RowExpandLinkFormatter, {
292
255
  value: cellValue,
293
256
  column: column,
@@ -296,7 +259,6 @@ var EditorFormatter = /*#__PURE__*/function (_React$Component) {
296
259
  renderEmpty: _this.renderEmpty
297
260
  });
298
261
  }
299
-
300
262
  case CellType.AUTO_NUMBER:
301
263
  {
302
264
  return /*#__PURE__*/React.createElement(AutoNumberFormatter, {
@@ -304,7 +266,6 @@ var EditorFormatter = /*#__PURE__*/function (_React$Component) {
304
266
  containerClassName: containerClassName
305
267
  });
306
268
  }
307
-
308
269
  case CellType.URL:
309
270
  {
310
271
  return /*#__PURE__*/React.createElement("div", {
@@ -314,7 +275,6 @@ var EditorFormatter = /*#__PURE__*/function (_React$Component) {
314
275
  containerClassName: containerClassName
315
276
  }));
316
277
  }
317
-
318
278
  case CellType.EMAIL:
319
279
  {
320
280
  return /*#__PURE__*/React.createElement("div", {
@@ -324,7 +284,6 @@ var EditorFormatter = /*#__PURE__*/function (_React$Component) {
324
284
  containerClassName: containerClassName
325
285
  }));
326
286
  }
327
-
328
287
  case CellType.DURATION:
329
288
  {
330
289
  return /*#__PURE__*/React.createElement("div", {
@@ -338,7 +297,6 @@ var EditorFormatter = /*#__PURE__*/function (_React$Component) {
338
297
  containerClassName: containerClassName
339
298
  }));
340
299
  }
341
-
342
300
  case CellType.RATE:
343
301
  {
344
302
  return /*#__PURE__*/React.createElement("div", {
@@ -352,7 +310,6 @@ var EditorFormatter = /*#__PURE__*/function (_React$Component) {
352
310
  containerClassName: containerClassName
353
311
  }));
354
312
  }
355
-
356
313
  case CellType.BUTTON:
357
314
  {
358
315
  return /*#__PURE__*/React.createElement(ButtonFormatter, {
@@ -361,7 +318,6 @@ var EditorFormatter = /*#__PURE__*/function (_React$Component) {
361
318
  onClickButton: _this.props.onClickButton
362
319
  });
363
320
  }
364
-
365
321
  case CellType.DIGITAL_SIGN:
366
322
  {
367
323
  return /*#__PURE__*/React.createElement(DigitalSignFormatter, {
@@ -370,23 +326,19 @@ var EditorFormatter = /*#__PURE__*/function (_React$Component) {
370
326
  config: _this.props.config
371
327
  });
372
328
  }
373
-
374
329
  default:
375
330
  return null;
376
331
  }
377
332
  };
378
-
379
333
  _this.state = {
380
334
  collaborators: _this.getCollaborator()
381
335
  };
382
336
  return _this;
383
337
  }
384
-
385
338
  _createClass(EditorFormatter, [{
386
339
  key: "componentDidMount",
387
340
  value: function componentDidMount() {
388
341
  this.calculateCollaboratorData(this.props);
389
-
390
342
  if (this.props.eventBus) {
391
343
  this.listenCollaboratorsUpdated = this.props.eventBus.subscribe('collaborators-updated', this.updateCollaborators);
392
344
  }
@@ -410,10 +362,8 @@ var EditorFormatter = /*#__PURE__*/function (_React$Component) {
410
362
  }, this.renderFormatter());
411
363
  }
412
364
  }]);
413
-
414
365
  return EditorFormatter;
415
366
  }(React.Component);
416
-
417
367
  EditorFormatter.defaultProps = {
418
368
  className: ''
419
369
  };
@@ -10,70 +10,53 @@ import TextFormatter from '../TextFormatter';
10
10
  import { isArrayFormatColumn, isSimpleCellFormatter, isFunction, getFormulaArrayValue, convertValueToDtableLongTextValue } from '../FormulaFormatter/utils';
11
11
  import cellValueValidator from '../FormulaFormatter/cell-value-validator';
12
12
  import '../FormulaFormatter/index.css';
13
-
14
13
  var RowExpandFormulaFormatter = /*#__PURE__*/function (_React$Component) {
15
14
  _inherits(RowExpandFormulaFormatter, _React$Component);
16
-
17
15
  var _super = _createSuper(RowExpandFormulaFormatter);
18
-
19
16
  function RowExpandFormulaFormatter() {
20
17
  var _this;
21
-
22
18
  _classCallCheck(this, RowExpandFormulaFormatter);
23
-
24
19
  for (var _len = arguments.length, args = new Array(_len), _key = 0; _key < _len; _key++) {
25
20
  args[_key] = arguments[_key];
26
21
  }
27
-
28
22
  _this = _super.call.apply(_super, [this].concat(args));
29
-
30
23
  _this.renderBorder = function (dom) {
31
24
  var column = _this.props.column;
32
25
  var result_type = column.data.result_type;
33
26
  var style = {
34
27
  minHeight: '38px'
35
28
  };
36
-
37
29
  if (result_type === FORMULA_RESULT_TYPE.DATE || result_type === FORMULA_RESULT_TYPE.NUMBER) {
38
30
  style = {
39
31
  width: '320px'
40
32
  };
41
33
  }
42
-
43
34
  return /*#__PURE__*/React.createElement("div", {
44
35
  className: "d-flex align-items-center form-control disabled h-auto",
45
36
  style: style
46
37
  }, dom);
47
38
  };
48
-
49
39
  _this.renderOtherColumnFormatter = function () {
50
40
  var _this$props = _this.props,
51
- value = _this$props.value,
52
- column = _this$props.column,
53
- collaborators = _this$props.collaborators;
41
+ value = _this$props.value,
42
+ column = _this$props.column,
43
+ collaborators = _this$props.collaborators;
54
44
  var _column$data = column.data,
55
- array_type = _column$data.array_type,
56
- array_data = _column$data.array_data;
57
-
45
+ array_type = _column$data.array_type,
46
+ array_data = _column$data.array_data;
58
47
  if (!array_type || array_type === CellType.LINK) {
59
48
  return null;
60
49
  }
61
-
62
50
  var Formatter = BaseFormatterConfig[array_type];
63
-
64
51
  var formatterProps = _this.getFormatterProps(array_type, array_data, collaborators);
65
-
66
52
  if (isArrayFormatColumn(array_type)) {
67
53
  formatterProps.value = value;
68
54
  return _this.renderBorder(_this.createColumnFormatter(Formatter, formatterProps));
69
55
  }
70
-
71
56
  var cellValue = value;
72
-
73
57
  if (!Array.isArray(value)) {
74
58
  cellValue = cellValueValidator(value, array_type) ? [value] : [];
75
59
  }
76
-
77
60
  return _this.renderBorder( /*#__PURE__*/React.createElement("div", {
78
61
  className: "dtable-ui formula-formatter multiple"
79
62
  }, cellValue.map(function (v, index) {
@@ -84,7 +67,6 @@ var RowExpandFormulaFormatter = /*#__PURE__*/function (_React$Component) {
84
67
  }, _this.createColumnFormatter(Formatter, formatterProps));
85
68
  })));
86
69
  };
87
-
88
70
  _this.getFormatterProps = function (array_type, array_data, collaborators) {
89
71
  switch (array_type) {
90
72
  case CellType.DURATION:
@@ -94,7 +76,6 @@ var RowExpandFormulaFormatter = /*#__PURE__*/function (_React$Component) {
94
76
  format: duration_format
95
77
  };
96
78
  }
97
-
98
79
  case CellType.NUMBER:
99
80
  case CellType.RATE:
100
81
  case CellType.GEOLOCATION:
@@ -103,7 +84,6 @@ var RowExpandFormulaFormatter = /*#__PURE__*/function (_React$Component) {
103
84
  data: array_data
104
85
  };
105
86
  }
106
-
107
87
  default:
108
88
  {
109
89
  return _objectSpread(_objectSpread({}, array_data), {}, {
@@ -112,10 +92,8 @@ var RowExpandFormulaFormatter = /*#__PURE__*/function (_React$Component) {
112
92
  }
113
93
  }
114
94
  };
115
-
116
95
  return _this;
117
96
  }
118
-
119
97
  _createClass(RowExpandFormulaFormatter, [{
120
98
  key: "createColumnFormatter",
121
99
  value: function createColumnFormatter(Formatter, formatterProps) {
@@ -131,42 +109,35 @@ var RowExpandFormulaFormatter = /*#__PURE__*/function (_React$Component) {
131
109
  key: "render",
132
110
  value: function render() {
133
111
  var _this$props2 = this.props,
134
- containerClassName = _this$props2.containerClassName,
135
- column = _this$props2.column,
136
- collaborators = _this$props2.collaborators,
137
- value = _this$props2.value;
112
+ containerClassName = _this$props2.containerClassName,
113
+ column = _this$props2.column,
114
+ collaborators = _this$props2.collaborators,
115
+ value = _this$props2.value;
138
116
  var data = column.data;
139
117
  var array_type = data.array_type,
140
- result_type = data.result_type;
118
+ result_type = data.result_type;
141
119
  if (!value) return null;
142
-
143
120
  if (Array.isArray(value)) {
144
121
  value = getFormulaArrayValue(value);
145
-
146
122
  if (array_type === CellType.LONG_TEXT) {
147
123
  value = value.map(function (item) {
148
124
  return convertValueToDtableLongTextValue(item);
149
125
  });
150
126
  }
151
127
  }
152
-
153
128
  if (result_type === FORMULA_RESULT_TYPE.ARRAY) {
154
129
  return this.renderOtherColumnFormatter();
155
130
  }
156
-
157
131
  if (typeof value === 'object') {
158
132
  return null;
159
133
  }
160
-
161
134
  var formattedValue = getFormulaDisplayString(value, data, {
162
135
  collaborators: collaborators
163
136
  });
164
137
  var className = "dtable-ui cell-formatter-container formula-formatter ".concat(containerClassName);
165
-
166
138
  if (result_type === FORMULA_RESULT_TYPE.NUMBER) {
167
139
  className = className + ' text-right';
168
140
  }
169
-
170
141
  return this.renderBorder( /*#__PURE__*/React.createElement("div", {
171
142
  className: className,
172
143
  title: formattedValue,
@@ -174,8 +145,6 @@ var RowExpandFormulaFormatter = /*#__PURE__*/function (_React$Component) {
174
145
  }, formattedValue));
175
146
  }
176
147
  }]);
177
-
178
148
  return RowExpandFormulaFormatter;
179
149
  }(React.Component);
180
-
181
150
  export { RowExpandFormulaFormatter as default };
@@ -7,84 +7,67 @@ import classnames from 'classnames';
7
7
  import RowExpandImageImageFormatter from './row-expand-image-item-formatter';
8
8
  import ImagePreviewerLightbox from '../ImagePreviewerLightbox';
9
9
  import './index.css';
10
-
11
10
  var RowExpandImageFormatter = /*#__PURE__*/function (_React$Component) {
12
11
  _inherits(RowExpandImageFormatter, _React$Component);
13
-
14
12
  var _super = _createSuper(RowExpandImageFormatter);
15
-
16
13
  function RowExpandImageFormatter(props) {
17
14
  var _this;
18
-
19
15
  _classCallCheck(this, RowExpandImageFormatter);
20
-
21
16
  _this = _super.call(this, props);
22
-
23
17
  _this.onImageClick = function (index) {
24
18
  _this.setState({
25
19
  isPreviewImage: true,
26
20
  previewImageIndex: index
27
21
  });
28
22
  };
29
-
30
23
  _this.closeImagePopup = function () {
31
24
  if (_this.props.onCloseCallback) {
32
25
  _this.props.onCloseCallback();
33
26
  }
34
-
35
27
  _this.setState({
36
28
  isPreviewImage: false,
37
29
  previewImageIndex: -1
38
30
  });
39
31
  };
40
-
41
32
  _this.movePrev = function () {
42
33
  var images = _this.props.value;
43
-
44
34
  _this.setState(function (prevState) {
45
35
  return {
46
36
  previewImageIndex: (prevState.previewImageIndex + images.length - 1) % images.length
47
37
  };
48
38
  });
49
39
  };
50
-
51
40
  _this.moveNext = function () {
52
41
  var images = _this.props.value;
53
-
54
42
  _this.setState(function (prevState) {
55
43
  return {
56
44
  previewImageIndex: (prevState.previewImageIndex + 1) % images.length
57
45
  };
58
46
  });
59
47
  };
60
-
61
48
  _this.state = {
62
49
  isPreviewImage: false,
63
50
  previewImageIndex: -1
64
51
  };
65
52
  return _this;
66
53
  }
67
-
68
54
  _createClass(RowExpandImageFormatter, [{
69
55
  key: "render",
70
56
  value: function render() {
71
57
  var _this2 = this;
72
-
73
58
  var _this$props = this.props,
74
- value = _this$props.value,
75
- server = _this$props.server,
76
- containerClassName = _this$props.containerClassName,
77
- readOnly = _this$props.readOnly,
78
- column = _this$props.column,
79
- downloadImage = _this$props.downloadImage;
59
+ value = _this$props.value,
60
+ server = _this$props.server,
61
+ containerClassName = _this$props.containerClassName,
62
+ readOnly = _this$props.readOnly,
63
+ column = _this$props.column,
64
+ downloadImage = _this$props.downloadImage;
80
65
  var _this$state = this.state,
81
- isPreviewImage = _this$state.isPreviewImage,
82
- previewImageIndex = _this$state.previewImageIndex;
83
-
66
+ isPreviewImage = _this$state.isPreviewImage,
67
+ previewImageIndex = _this$state.previewImageIndex;
84
68
  if (!Array.isArray(value) || value.length === 0) {
85
69
  return null;
86
70
  }
87
-
88
71
  return /*#__PURE__*/React.createElement(Fragment, null, /*#__PURE__*/React.createElement("div", {
89
72
  className: classnames('dtable-ui cell-formatter-container row-expand-image-formatter', containerClassName)
90
73
  }, value.map(function (item, index) {
@@ -114,10 +97,8 @@ var RowExpandImageFormatter = /*#__PURE__*/function (_React$Component) {
114
97
  }));
115
98
  }
116
99
  }]);
117
-
118
100
  return RowExpandImageFormatter;
119
101
  }(React.Component);
120
-
121
102
  RowExpandImageFormatter.defaultProps = {
122
103
  readOnly: true,
123
104
  value: [],