dtable-ui-component 4.4.3-2 → 4.4.3-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 (149) hide show
  1. package/lib/AutoNumberFormatter/index.js +7 -14
  2. package/lib/ButtonFormatter/index.js +9 -16
  3. package/lib/CTimeFormatter/index.js +9 -16
  4. package/lib/CheckboxEditor/index.js +8 -15
  5. package/lib/CheckboxFormatter/index.js +8 -15
  6. package/lib/CollaboratorEditor/index.js +21 -29
  7. package/lib/CollaboratorEditor/mb-collaborator-editor-popover/index.js +25 -32
  8. package/lib/CollaboratorEditor/pc-collaborator-editor-popover/index.js +18 -25
  9. package/lib/CollaboratorFormatter/index.js +12 -19
  10. package/lib/CollaboratorItem/index.js +10 -17
  11. package/lib/CreatorFormatter/index.js +12 -19
  12. package/lib/DTableCommonAddTool/index.js +6 -13
  13. package/lib/DTableCustomizeCollaboratorSelect/index.js +18 -26
  14. package/lib/DTableCustomizeSelect/index.js +15 -23
  15. package/lib/DTableFiltersPopover/constants/index.js +33 -38
  16. package/lib/DTableFiltersPopover/index.js +31 -38
  17. package/lib/DTableFiltersPopover/utils/filter-item-utils.js +46 -53
  18. package/lib/DTableFiltersPopover/utils/index.js +99 -128
  19. package/lib/DTableFiltersPopover/widgets/collaborator-filter/index.js +26 -34
  20. package/lib/DTableFiltersPopover/widgets/department-select-filter/department-multiple-select-filter.js +25 -33
  21. package/lib/DTableFiltersPopover/widgets/department-select-filter/department-single-select-filter.js +26 -34
  22. package/lib/DTableFiltersPopover/widgets/filter-calendar.js +26 -34
  23. package/lib/DTableFiltersPopover/widgets/filter-item.js +120 -128
  24. package/lib/DTableFiltersPopover/widgets/filter-list/index.js +18 -26
  25. package/lib/DTableFiltersPopover/widgets/rate-item.js +8 -15
  26. package/lib/DTablePopover/index.js +8 -15
  27. package/lib/DTablePopover/utils.js +2 -9
  28. package/lib/DTableRadio/index.js +10 -17
  29. package/lib/DTableSearchInput/index.js +13 -21
  30. package/lib/DTableSearchInput/utils.js +2 -9
  31. package/lib/DTableSelect/dtable-select-label.js +6 -13
  32. package/lib/DTableSelect/index.js +10 -18
  33. package/lib/DTableSelect/utils.js +10 -20
  34. package/lib/DTableSwitch/index.js +7 -14
  35. package/lib/DateEditor/index.js +22 -30
  36. package/lib/DateEditor/mb-date-editor-popover/index.js +47 -55
  37. package/lib/DateEditor/pc-date-editor-popover.js +20 -27
  38. package/lib/DateFormatter/index.js +9 -16
  39. package/lib/Department-editor/constants.js +1 -7
  40. package/lib/Department-editor/department-multiple-select/index.js +24 -32
  41. package/lib/Department-editor/department-single-select.js +33 -41
  42. package/lib/Department-editor/index.js +14 -22
  43. package/lib/Department-editor/selected-departments/index.js +25 -32
  44. package/lib/Department-editor/utils.js +3 -11
  45. package/lib/DepartmentSingleSelectFormatter/index.js +9 -16
  46. package/lib/DigitalSignFormatter/index.js +15 -23
  47. package/lib/DigitalSignFormatter/utils.js +3 -11
  48. package/lib/DurationFormatter/index.js +9 -16
  49. package/lib/EditEditorButton/index.js +5 -12
  50. package/lib/EmailFormatter/index.js +7 -14
  51. package/lib/FieldDisplaySetting/field-item.js +14 -21
  52. package/lib/FieldDisplaySetting/index.js +19 -27
  53. package/lib/FileEditor/index.js +8 -15
  54. package/lib/FileEditor/pc-files-addition/index.js +0 -1
  55. package/lib/FileEditor/pc-files-addition/pc-file-uploaded-item.js +0 -1
  56. package/lib/FileEditor/pc-files-preview/index.js +0 -1
  57. package/lib/FileEditor/pc-files-preview/pc-file-item-preview.js +0 -1
  58. package/lib/FileFormatter/index.js +11 -19
  59. package/lib/FileItemFormatter/index.js +6 -14
  60. package/lib/FileItemFormatter/utils.js +2 -9
  61. package/lib/FileUploader/index.js +4 -11
  62. package/lib/FormulaFormatter/cell-value-validator.js +18 -24
  63. package/lib/FormulaFormatter/index.js +32 -39
  64. package/lib/FormulaFormatter/utils.js +13 -29
  65. package/lib/GeolocationFormatter/index.js +9 -16
  66. package/lib/HtmlLongTextFormatter/index.js +9 -17
  67. package/lib/HtmlLongTextFormatter/markdown2html.js +47 -0
  68. package/lib/HtmlLongTextFormatter/unified/index.js +400 -0
  69. package/lib/HtmlLongTextFormatter/vfile/core.js +155 -0
  70. package/lib/HtmlLongTextFormatter/vfile/index.js +40 -0
  71. package/lib/ImageFormatter/images-lazy-load.js +9 -16
  72. package/lib/ImageFormatter/index.js +16 -24
  73. package/lib/ImageFormatter/utils.js +2 -9
  74. package/lib/ImagePreviewerLightbox/index.js +12 -19
  75. package/lib/ImagePreviewerLightbox/utils.js +3 -11
  76. package/lib/LastModifierFormatter/index.js +12 -19
  77. package/lib/LinkEditor/index.js +25 -33
  78. package/lib/LinkEditor/link-editor-option.js +8 -15
  79. package/lib/LinkEditor/mb-link-editor-popover/index.js +23 -30
  80. package/lib/LinkEditor/pc-link-editor-popover/index.js +17 -24
  81. package/lib/LinkFormatter/index.js +13 -20
  82. package/lib/Loading/index.js +4 -11
  83. package/lib/LongTextFormatter/index.js +6 -13
  84. package/lib/MBEditorHeader/index.js +7 -14
  85. package/lib/MTimeFormatter/index.js +9 -16
  86. package/lib/ModalPortal/index.js +5 -12
  87. package/lib/MultipleSelectEditor/index.js +17 -25
  88. package/lib/MultipleSelectFormatter/index.js +10 -17
  89. package/lib/NotificationPopover/index.js +16 -24
  90. package/lib/NumberEditor/index.js +18 -25
  91. package/lib/NumberFormatter/index.js +9 -16
  92. package/lib/RateFormatter/index.js +8 -15
  93. package/lib/RoleStatusEditor/index.js +14 -22
  94. package/lib/RowExpandEmailFormatter/index.js +10 -17
  95. package/lib/RowExpandFileFormatter/index.js +8 -16
  96. package/lib/RowExpandFileFormatter/row-expand-file-item-formatter.js +18 -27
  97. package/lib/RowExpandFormatter/index.js +78 -86
  98. package/lib/RowExpandFormulaFormatter/index.js +34 -42
  99. package/lib/RowExpandImageFormatter/index.js +10 -19
  100. package/lib/RowExpandImageFormatter/row-expand-image-item-formatter.js +18 -27
  101. package/lib/RowExpandImageFormatter/utils.js +2 -9
  102. package/lib/RowExpandLinkFormatter/collaborator-item-formatter.js +7 -16
  103. package/lib/RowExpandLinkFormatter/index.js +37 -46
  104. package/lib/RowExpandLinkFormatter/utils.js +6 -17
  105. package/lib/RowExpandLinkFormatter/value-display-utils.js +5 -12
  106. package/lib/RowExpandRateFormatter/index.js +8 -15
  107. package/lib/RowExpandUrlFormatter/index.js +14 -21
  108. package/lib/SelectItem/index.js +4 -12
  109. package/lib/SelectOptionGroup/KeyCodes.js +1 -7
  110. package/lib/SelectOptionGroup/index.js +33 -32
  111. package/lib/SelectOptionGroup/option.js +4 -19
  112. package/lib/SimpleLongTextFormatter/index.js +20 -27
  113. package/lib/SimpleLongTextFormatter/normalize-long-text-value.js +1 -7
  114. package/lib/SimpleLongTextFormatter/widgets/LongTextPreview.js +8 -15
  115. package/lib/SimpleLongTextFormatter/widgets/dtable-markdown-viewer.js +7 -14
  116. package/lib/SingleSelectEditor/index.js +18 -26
  117. package/lib/SingleSelectFormatter/index.js +9 -16
  118. package/lib/TextEditor/index.js +7 -14
  119. package/lib/TextFormatter/index.js +7 -14
  120. package/lib/UrlFormatter/index.js +7 -14
  121. package/lib/cellFormatterFactory/index.js +4 -11
  122. package/lib/common/ClickOutside.js +4 -12
  123. package/lib/common/delete-tip.js +12 -20
  124. package/lib/common/modal-portal.js +5 -13
  125. package/lib/constants/index.js +9 -28
  126. package/lib/data/dtable-value.js +6 -11
  127. package/lib/formatterConfig/base-formatter-config.js +46 -53
  128. package/lib/formatterConfig/index.js +9 -16
  129. package/lib/hooks/common-hooks.js +4 -11
  130. package/lib/index.js +75 -432
  131. package/lib/lang/index.js +13 -24
  132. package/lib/locals/de.js +1 -7
  133. package/lib/locals/en.js +1 -7
  134. package/lib/locals/fr.js +1 -7
  135. package/lib/locals/zh-CN.js +1 -7
  136. package/lib/select-editor/index.js +4 -27
  137. package/lib/select-editor/mb-select-editor-popover/index.js +33 -41
  138. package/lib/select-editor/pc-select-editor-popover/index.js +19 -26
  139. package/lib/select-editor/select-editor-option.js +8 -15
  140. package/lib/toaster/alert.js +11 -18
  141. package/lib/toaster/index.js +3 -10
  142. package/lib/toaster/toast.js +8 -16
  143. package/lib/toaster/toastManager.js +5 -13
  144. package/lib/toaster/toaster.js +7 -15
  145. package/lib/utils/dayjs.js +4 -11
  146. package/lib/utils/editor-utils.js +5 -15
  147. package/lib/utils/event-bus.js +1 -7
  148. package/lib/utils/utils.js +6 -17
  149. package/package.json +77 -63
@@ -1,26 +1,18 @@
1
- "use strict";
2
-
3
- var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault").default;
4
- var _interopRequireWildcard = require("@babel/runtime/helpers/interopRequireWildcard").default;
5
- Object.defineProperty(exports, "__esModule", {
6
- value: true
7
- });
8
- exports.default = void 0;
9
- var _react = _interopRequireWildcard(require("react"));
10
- var _classnames = _interopRequireDefault(require("classnames"));
11
- var _reactstrap = require("reactstrap");
12
- var _dtableUtils = require("dtable-utils");
13
- var _DTableCustomizeSelect = _interopRequireDefault(require("../../DTableCustomizeSelect"));
14
- var _DTableSearchInput = _interopRequireDefault(require("../../DTableSearchInput"));
15
- var _collaboratorFilter = _interopRequireDefault(require("./collaborator-filter"));
16
- var _departmentSingleSelectFilter = _interopRequireDefault(require("./department-select-filter/department-single-select-filter"));
17
- var _departmentMultipleSelectFilter = _interopRequireDefault(require("./department-select-filter/department-multiple-select-filter"));
18
- var _rateItem = _interopRequireDefault(require("./rate-item"));
19
- var _filterCalendar = _interopRequireDefault(require("./filter-calendar"));
20
- var _utils = require("../utils");
21
- var _lang = require("../../lang");
22
- const EMPTY_PREDICATE = [_dtableUtils.FILTER_PREDICATE_TYPE.EMPTY, _dtableUtils.FILTER_PREDICATE_TYPE.NOT_EMPTY];
23
- class FilterItem extends _react.default.Component {
1
+ import React, { Fragment } from 'react';
2
+ import classnames from 'classnames';
3
+ import { UncontrolledTooltip } from 'reactstrap';
4
+ import { CellType, COLLABORATOR_COLUMN_TYPES, DATE_COLUMN_OPTIONS, FORMULA_RESULT_TYPE, FILTER_PREDICATE_TYPE, FILTER_TERM_MODIFIER_TYPE, filterTermModifierIsWithin, isDateColumn } from 'dtable-utils';
5
+ import DTableCustomizeSelect from '../../DTableCustomizeSelect';
6
+ import DtableSearchInput from '../../DTableSearchInput';
7
+ import CollaboratorFilter from './collaborator-filter';
8
+ import DepartmentSingleSelectFilter from './department-select-filter/department-single-select-filter';
9
+ import DepartmentMultipleSelectFilter from './department-select-filter/department-multiple-select-filter';
10
+ import RateItem from './rate-item';
11
+ import FilterCalendar from './filter-calendar';
12
+ import { FilterItemUtils, getFilterByColumn, getUpdatedFilterBySelectSingle, getUpdatedFilterBySelectMultiple, getUpdatedFilterByCreator, getUpdatedFilterByCollaborator, getColumnOptions, getUpdatedFilterByPredicate, isCheckboxColumn, generateDefaultUser } from '../utils';
13
+ import { getLocale } from '../../lang';
14
+ const EMPTY_PREDICATE = [FILTER_PREDICATE_TYPE.EMPTY, FILTER_PREDICATE_TYPE.NOT_EMPTY];
15
+ class FilterItem extends React.Component {
24
16
  constructor(_props) {
25
17
  var _this;
26
18
  super(_props);
@@ -34,20 +26,20 @@ class FilterItem extends _react.default.Component {
34
26
  let {
35
27
  filterPredicateList,
36
28
  filterTermModifierList
37
- } = (0, _utils.getColumnOptions)(filterColumn, value);
29
+ } = getColumnOptions(filterColumn, value);
38
30
  // The value of the calculation formula column does not exist in the shared view
39
31
  this.filterPredicateOptions = filterPredicateList ? filterPredicateList.map(predicate => {
40
- return _utils.FilterItemUtils.generatorPredicateOption(predicate);
32
+ return FilterItemUtils.generatorPredicateOption(predicate);
41
33
  }).filter(item => item) : [];
42
34
  const {
43
35
  filter_predicate
44
36
  } = filter;
45
- if ((0, _dtableUtils.isDateColumn)(filterColumn)) {
46
- if (filter_predicate === _dtableUtils.FILTER_PREDICATE_TYPE.IS_WITHIN) {
47
- filterTermModifierList = _dtableUtils.filterTermModifierIsWithin;
37
+ if (isDateColumn(filterColumn)) {
38
+ if (filter_predicate === FILTER_PREDICATE_TYPE.IS_WITHIN) {
39
+ filterTermModifierList = filterTermModifierIsWithin;
48
40
  }
49
41
  this.filterTermModifierOptions = filterTermModifierList.map(termModifier => {
50
- return _utils.FilterItemUtils.generatorTermModifierOption(termModifier);
42
+ return FilterItemUtils.generatorTermModifierOption(termModifier);
51
43
  });
52
44
  }
53
45
  };
@@ -81,7 +73,7 @@ class FilterItem extends _react.default.Component {
81
73
  column
82
74
  } = value;
83
75
  if (column.key === filter.column_key) return;
84
- let newFilter = (0, _utils.getFilterByColumn)(column, filter);
76
+ let newFilter = getFilterByColumn(column, filter);
85
77
  if (!newFilter) return;
86
78
  this.resetState(newFilter);
87
79
  this.props.updateFilter(index, newFilter);
@@ -98,7 +90,7 @@ class FilterItem extends _react.default.Component {
98
90
  if (filter.filter_predicate === filterPredicate) {
99
91
  return;
100
92
  }
101
- let newFilter = (0, _utils.getUpdatedFilterByPredicate)(filter, filterColumn, filterPredicate);
93
+ let newFilter = getUpdatedFilterByPredicate(filter, filterColumn, filterPredicate);
102
94
  this.resetState(newFilter);
103
95
  this.props.updateFilter(index, newFilter);
104
96
  };
@@ -110,7 +102,7 @@ class FilterItem extends _react.default.Component {
110
102
  const {
111
103
  filterTermModifier
112
104
  } = value;
113
- const inputRangeLabel = [_dtableUtils.FILTER_TERM_MODIFIER_TYPE.EXACT_DATE, _dtableUtils.FILTER_TERM_MODIFIER_TYPE.NUMBER_OF_DAYS_AGO, _dtableUtils.FILTER_TERM_MODIFIER_TYPE.NUMBER_OF_DAYS_FROM_NOW, _dtableUtils.FILTER_TERM_MODIFIER_TYPE.THE_NEXT_NUMBERS_OF_DAYS, _dtableUtils.FILTER_TERM_MODIFIER_TYPE.THE_PAST_NUMBERS_OF_DAYS];
105
+ const inputRangeLabel = [FILTER_TERM_MODIFIER_TYPE.EXACT_DATE, FILTER_TERM_MODIFIER_TYPE.NUMBER_OF_DAYS_AGO, FILTER_TERM_MODIFIER_TYPE.NUMBER_OF_DAYS_FROM_NOW, FILTER_TERM_MODIFIER_TYPE.THE_NEXT_NUMBERS_OF_DAYS, FILTER_TERM_MODIFIER_TYPE.THE_PAST_NUMBERS_OF_DAYS];
114
106
  if (filter.filter_term_modifier === filterTermModifier) {
115
107
  return;
116
108
  }
@@ -136,7 +128,7 @@ class FilterItem extends _react.default.Component {
136
128
  if (filter.filter_term === option.id) {
137
129
  return;
138
130
  }
139
- let newFilter = (0, _utils.getUpdatedFilterBySelectSingle)(filter, option);
131
+ let newFilter = getUpdatedFilterBySelectSingle(filter, option);
140
132
  this.resetState(newFilter);
141
133
  this.props.updateFilter(index, newFilter);
142
134
  };
@@ -148,7 +140,7 @@ class FilterItem extends _react.default.Component {
148
140
  const {
149
141
  columnOption: option
150
142
  } = value;
151
- let newFilter = (0, _utils.getUpdatedFilterBySelectMultiple)(filter, option);
143
+ let newFilter = getUpdatedFilterBySelectMultiple(filter, option);
152
144
  this.resetState(newFilter);
153
145
  this.props.updateFilter(index, newFilter);
154
146
  };
@@ -160,7 +152,7 @@ class FilterItem extends _react.default.Component {
160
152
  const {
161
153
  columnOption: collaborator
162
154
  } = value;
163
- let newFilter = (0, _utils.getUpdatedFilterByCollaborator)(filter, collaborator);
155
+ let newFilter = getUpdatedFilterByCollaborator(filter, collaborator);
164
156
  this.resetState(newFilter);
165
157
  this.props.updateFilter(index, newFilter);
166
158
  };
@@ -172,7 +164,7 @@ class FilterItem extends _react.default.Component {
172
164
  const {
173
165
  columnOption: collaborator
174
166
  } = value;
175
- let newFilter = (0, _utils.getUpdatedFilterByCreator)(filter, collaborator);
167
+ let newFilter = getUpdatedFilterByCreator(filter, collaborator);
176
168
  // the predicate is 'is' or 'is not'
177
169
  if (!newFilter) {
178
170
  return;
@@ -222,14 +214,14 @@ class FilterItem extends _react.default.Component {
222
214
  filterTerm
223
215
  } = this.state;
224
216
  if (type === 'text') {
225
- return /*#__PURE__*/_react.default.createElement(_DTableSearchInput.default, {
217
+ return /*#__PURE__*/React.createElement(DtableSearchInput, {
226
218
  value: filterTerm,
227
219
  onChange: this.onFilterTermTextChanged,
228
220
  autoFocus: false,
229
- className: (0, _classnames.default)('text-truncate')
221
+ className: classnames('text-truncate')
230
222
  });
231
223
  } else if (type === 'checkbox') {
232
- return /*#__PURE__*/_react.default.createElement("input", {
224
+ return /*#__PURE__*/React.createElement("input", {
233
225
  type: "checkbox",
234
226
  checked: filterTerm,
235
227
  onChange: this.onFilterTermCheckboxChanged
@@ -249,8 +241,8 @@ class FilterItem extends _react.default.Component {
249
241
  }
250
242
  case 1:
251
243
  {
252
- const activeConjunction = _utils.FilterItemUtils.getActiveConjunctionOption(filterConjunction);
253
- return /*#__PURE__*/_react.default.createElement(_DTableCustomizeSelect.default, {
244
+ const activeConjunction = FilterItemUtils.getActiveConjunctionOption(filterConjunction);
245
+ return /*#__PURE__*/React.createElement(DTableCustomizeSelect, {
254
246
  value: activeConjunction,
255
247
  options: conjunctionOptions,
256
248
  onSelectOption: this.onSelectConjunction
@@ -258,9 +250,9 @@ class FilterItem extends _react.default.Component {
258
250
  }
259
251
  default:
260
252
  {
261
- return /*#__PURE__*/_react.default.createElement("span", {
253
+ return /*#__PURE__*/React.createElement("span", {
262
254
  className: "selected-conjunction-show"
263
- }, (0, _lang.getLocale)(filterConjunction));
255
+ }, getLocale(filterConjunction));
264
256
  }
265
257
  }
266
258
  };
@@ -275,7 +267,7 @@ class FilterItem extends _react.default.Component {
275
267
  } = filter;
276
268
  let isSupportMultipleSelect = false;
277
269
  //The first two options are used for single selection, and the last four options are used for multiple selection
278
- const supportMultipleSelectOptions = [_dtableUtils.FILTER_PREDICATE_TYPE.IS_ANY_OF, _dtableUtils.FILTER_PREDICATE_TYPE.IS_NONE_OF, _dtableUtils.FILTER_PREDICATE_TYPE.HAS_ANY_OF, _dtableUtils.FILTER_PREDICATE_TYPE.HAS_ALL_OF, _dtableUtils.FILTER_PREDICATE_TYPE.HAS_NONE_OF, _dtableUtils.FILTER_PREDICATE_TYPE.IS_EXACTLY];
270
+ const supportMultipleSelectOptions = [FILTER_PREDICATE_TYPE.IS_ANY_OF, FILTER_PREDICATE_TYPE.IS_NONE_OF, FILTER_PREDICATE_TYPE.HAS_ANY_OF, FILTER_PREDICATE_TYPE.HAS_ALL_OF, FILTER_PREDICATE_TYPE.HAS_NONE_OF, FILTER_PREDICATE_TYPE.IS_EXACTLY];
279
271
  if (supportMultipleSelectOptions.includes(filter_predicate)) {
280
272
  isSupportMultipleSelect = true;
281
273
  }
@@ -290,7 +282,7 @@ class FilterItem extends _react.default.Component {
290
282
  background: inOption.color,
291
283
  color: inOption.textColor || null
292
284
  };
293
- labelArray.push( /*#__PURE__*/_react.default.createElement("span", {
285
+ labelArray.push( /*#__PURE__*/React.createElement("span", {
294
286
  className: className,
295
287
  style: optionStyle,
296
288
  key: 'option_' + item,
@@ -301,20 +293,20 @@ class FilterItem extends _react.default.Component {
301
293
  });
302
294
  }
303
295
  const selectedOptionNames = labelArray.length > 0 ? {
304
- label: /*#__PURE__*/_react.default.createElement(_react.Fragment, null, labelArray)
296
+ label: /*#__PURE__*/React.createElement(Fragment, null, labelArray)
305
297
  } : {};
306
298
  const dataOptions = options.map(option => {
307
- return _utils.FilterItemUtils.generatorMultipleSelectOption(option, filterTerm);
299
+ return FilterItemUtils.generatorMultipleSelectOption(option, filterTerm);
308
300
  });
309
- return /*#__PURE__*/_react.default.createElement(_DTableCustomizeSelect.default, {
301
+ return /*#__PURE__*/React.createElement(DTableCustomizeSelect, {
310
302
  className: "selector-multiple-select",
311
303
  value: selectedOptionNames,
312
304
  options: dataOptions,
313
305
  onSelectOption: _this.onSelectMultiple,
314
- placeholder: (0, _lang.getLocale)('Select_option(s)'),
306
+ placeholder: getLocale('Select_option(s)'),
315
307
  searchable: true,
316
- searchPlaceholder: (0, _lang.getLocale)('Find_an_option'),
317
- noOptionsPlaceholder: (0, _lang.getLocale)('No_options_available'),
308
+ searchPlaceholder: getLocale('Find_an_option'),
309
+ noOptionsPlaceholder: getLocale('No_options_available'),
318
310
  supportMultipleSelect: isSupportMultipleSelect
319
311
  });
320
312
  };
@@ -346,11 +338,11 @@ class FilterItem extends _react.default.Component {
346
338
  // 2. CTIME: create-time
347
339
  // 3. MTIME: modify-time
348
340
  // 4. FORMULA: result_type is date
349
- if ((0, _dtableUtils.isDateColumn)(filterColumn)) {
350
- const inputRangeLabel = [_dtableUtils.FILTER_TERM_MODIFIER_TYPE.EXACT_DATE, _dtableUtils.FILTER_TERM_MODIFIER_TYPE.NUMBER_OF_DAYS_AGO, _dtableUtils.FILTER_TERM_MODIFIER_TYPE.NUMBER_OF_DAYS_FROM_NOW, _dtableUtils.FILTER_TERM_MODIFIER_TYPE.THE_NEXT_NUMBERS_OF_DAYS, _dtableUtils.FILTER_TERM_MODIFIER_TYPE.THE_PAST_NUMBERS_OF_DAYS];
341
+ if (isDateColumn(filterColumn)) {
342
+ const inputRangeLabel = [FILTER_TERM_MODIFIER_TYPE.EXACT_DATE, FILTER_TERM_MODIFIER_TYPE.NUMBER_OF_DAYS_AGO, FILTER_TERM_MODIFIER_TYPE.NUMBER_OF_DAYS_FROM_NOW, FILTER_TERM_MODIFIER_TYPE.THE_NEXT_NUMBERS_OF_DAYS, FILTER_TERM_MODIFIER_TYPE.THE_PAST_NUMBERS_OF_DAYS];
351
343
  if (inputRangeLabel.indexOf(filter_term_modifier) > -1) {
352
344
  if (filter_term_modifier === 'exact_date') {
353
- return /*#__PURE__*/_react.default.createElement(_filterCalendar.default, {
345
+ return /*#__PURE__*/React.createElement(FilterCalendar, {
354
346
  lang: lang,
355
347
  value: this.state.filterTerm,
356
348
  filterColumn: filterColumn,
@@ -362,32 +354,32 @@ class FilterItem extends _react.default.Component {
362
354
  return null;
363
355
  }
364
356
  switch (type) {
365
- case _dtableUtils.CellType.TEXT:
366
- case _dtableUtils.CellType.LONG_TEXT:
367
- case _dtableUtils.CellType.GEOLOCATION:
368
- case _dtableUtils.CellType.NUMBER:
369
- case _dtableUtils.CellType.AUTO_NUMBER:
370
- case _dtableUtils.CellType.DURATION:
371
- case _dtableUtils.CellType.EMAIL:
372
- case _dtableUtils.CellType.URL:
357
+ case CellType.TEXT:
358
+ case CellType.LONG_TEXT:
359
+ case CellType.GEOLOCATION:
360
+ case CellType.NUMBER:
361
+ case CellType.AUTO_NUMBER:
362
+ case CellType.DURATION:
363
+ case CellType.EMAIL:
364
+ case CellType.URL:
373
365
  {
374
366
  // The data in the formula column is a date type that has been excluded
375
- if (filter_predicate === _dtableUtils.FILTER_PREDICATE_TYPE.IS_CURRENT_USER_ID) {
367
+ if (filter_predicate === FILTER_PREDICATE_TYPE.IS_CURRENT_USER_ID) {
376
368
  return null;
377
369
  }
378
370
  return this.getInputComponent('text');
379
371
  }
380
- case _dtableUtils.CellType.CHECKBOX:
372
+ case CellType.CHECKBOX:
381
373
  {
382
374
  return this.getInputComponent('checkbox');
383
375
  }
384
- case _dtableUtils.CellType.SINGLE_SELECT:
376
+ case CellType.SINGLE_SELECT:
385
377
  {
386
378
  // get options
387
379
  let {
388
380
  options = []
389
381
  } = filterColumn.data || {};
390
- if ([_dtableUtils.FILTER_PREDICATE_TYPE.IS_ANY_OF, _dtableUtils.FILTER_PREDICATE_TYPE.IS_NONE_OF].includes(filter_predicate)) {
382
+ if ([FILTER_PREDICATE_TYPE.IS_ANY_OF, FILTER_PREDICATE_TYPE.IS_NONE_OF].includes(filter_predicate)) {
391
383
  return this.renderMultipleSelectOption(options, filter_term);
392
384
  }
393
385
  let selectedOption = options.find(option => option.id === filter_term);
@@ -399,7 +391,7 @@ class FilterItem extends _react.default.Component {
399
391
  color: selectedOption.textColor || null
400
392
  };
401
393
  selectedOptionName = {
402
- label: /*#__PURE__*/_react.default.createElement("span", {
394
+ label: /*#__PURE__*/React.createElement("span", {
403
395
  className: className,
404
396
  style: style,
405
397
  title: selectedOption.name,
@@ -408,30 +400,30 @@ class FilterItem extends _react.default.Component {
408
400
  };
409
401
  }
410
402
  let dataOptions = options.map(option => {
411
- return _utils.FilterItemUtils.generatorSingleSelectOption(option);
403
+ return FilterItemUtils.generatorSingleSelectOption(option);
412
404
  });
413
- return /*#__PURE__*/_react.default.createElement(_DTableCustomizeSelect.default, {
405
+ return /*#__PURE__*/React.createElement(DTableCustomizeSelect, {
414
406
  className: "selector-single-select",
415
407
  value: selectedOptionName,
416
408
  options: dataOptions,
417
409
  onSelectOption: this.onSelectSingle,
418
- placeholder: (0, _lang.getLocale)('Select_an_option'),
410
+ placeholder: getLocale('Select_an_option'),
419
411
  searchable: true,
420
- searchPlaceholder: (0, _lang.getLocale)('Find_an_option'),
421
- noOptionsPlaceholder: (0, _lang.getLocale)('No_options_available')
412
+ searchPlaceholder: getLocale('Find_an_option'),
413
+ noOptionsPlaceholder: getLocale('No_options_available')
422
414
  });
423
415
  }
424
- case _dtableUtils.CellType.MULTIPLE_SELECT:
416
+ case CellType.MULTIPLE_SELECT:
425
417
  {
426
418
  let {
427
419
  options = []
428
420
  } = filterColumn.data || {};
429
421
  return this.renderMultipleSelectOption(options, filter_term);
430
422
  }
431
- case _dtableUtils.CellType.DEPARTMENT_SINGLE_SELECT:
423
+ case CellType.DEPARTMENT_SINGLE_SELECT:
432
424
  {
433
- if ([_dtableUtils.FILTER_PREDICATE_TYPE.IS_ANY_OF, _dtableUtils.FILTER_PREDICATE_TYPE.IS_NONE_OF].includes(filter_predicate)) {
434
- return /*#__PURE__*/_react.default.createElement(_departmentMultipleSelectFilter.default, {
425
+ if ([FILTER_PREDICATE_TYPE.IS_ANY_OF, FILTER_PREDICATE_TYPE.IS_NONE_OF].includes(filter_predicate)) {
426
+ return /*#__PURE__*/React.createElement(DepartmentMultipleSelectFilter, {
435
427
  column: filterColumn,
436
428
  value: filter_term || [],
437
429
  userDepartmentIdsMap: userDepartmentIdsMap,
@@ -439,7 +431,7 @@ class FilterItem extends _react.default.Component {
439
431
  onCommit: this.onSelectMultiple
440
432
  });
441
433
  }
442
- return /*#__PURE__*/_react.default.createElement(_departmentSingleSelectFilter.default, {
434
+ return /*#__PURE__*/React.createElement(DepartmentSingleSelectFilter, {
443
435
  roleId: roleId,
444
436
  column: filterColumn,
445
437
  value: filter_term || '',
@@ -448,43 +440,43 @@ class FilterItem extends _react.default.Component {
448
440
  onCommit: this.onSelectSingle
449
441
  });
450
442
  }
451
- case _dtableUtils.CellType.COLLABORATOR:
443
+ case CellType.COLLABORATOR:
452
444
  {
453
- if (filter_predicate === _dtableUtils.FILTER_PREDICATE_TYPE.INCLUDE_ME) {
445
+ if (filter_predicate === FILTER_PREDICATE_TYPE.INCLUDE_ME) {
454
446
  return null;
455
447
  }
456
- return /*#__PURE__*/_react.default.createElement(_collaboratorFilter.default, {
448
+ return /*#__PURE__*/React.createElement(CollaboratorFilter, {
457
449
  filterIndex: index,
458
450
  filterTerm: filter_term || [],
459
451
  filter_predicate: filter_predicate,
460
452
  collaborators: collaborators,
461
453
  onSelectCollaborator: this.onSelectCollaborator,
462
- placeholder: (0, _lang.getLocale)('Add_collaborator')
454
+ placeholder: getLocale('Add_collaborator')
463
455
  });
464
456
  }
465
- case _dtableUtils.CellType.CREATOR:
466
- case _dtableUtils.CellType.LAST_MODIFIER:
457
+ case CellType.CREATOR:
458
+ case CellType.LAST_MODIFIER:
467
459
  {
468
- if (filter_predicate === _dtableUtils.FILTER_PREDICATE_TYPE.INCLUDE_ME) {
460
+ if (filter_predicate === FILTER_PREDICATE_TYPE.INCLUDE_ME) {
469
461
  return null;
470
462
  }
471
- const creators = collaborators.concat([(0, _utils.generateDefaultUser)('anonymous')]);
472
- return /*#__PURE__*/_react.default.createElement(_collaboratorFilter.default, {
463
+ const creators = collaborators.concat([generateDefaultUser('anonymous')]);
464
+ return /*#__PURE__*/React.createElement(CollaboratorFilter, {
473
465
  filterIndex: index,
474
466
  filterTerm: filter_term || [],
475
467
  collaborators: creators,
476
468
  onSelectCollaborator: this.onSelectCreator,
477
- placeholder: type === _dtableUtils.CellType.CREATOR ? (0, _lang.getLocale)('Add_a_creator') : (0, _lang.getLocale)('Add_a_last_modifier')
469
+ placeholder: type === CellType.CREATOR ? getLocale('Add_a_creator') : getLocale('Add_a_last_modifier')
478
470
  });
479
471
  }
480
- case _dtableUtils.CellType.RATE:
472
+ case CellType.RATE:
481
473
  {
482
474
  let {
483
475
  rate_max_number
484
476
  } = filterColumn.data || {};
485
477
  let rateList = [];
486
478
  for (let i = 0; i < rate_max_number; i++) {
487
- let rateItem = /*#__PURE__*/_react.default.createElement(_rateItem.default, {
479
+ let rateItem = /*#__PURE__*/React.createElement(RateItem, {
488
480
  key: i,
489
481
  enterRateItemIndex: this.state.enterRateItemIndex,
490
482
  rateItemIndex: i + 1,
@@ -498,16 +490,16 @@ class FilterItem extends _react.default.Component {
498
490
  });
499
491
  rateList.push(rateItem);
500
492
  }
501
- return /*#__PURE__*/_react.default.createElement("div", {
493
+ return /*#__PURE__*/React.createElement("div", {
502
494
  className: "filter-rate-list"
503
495
  }, rateList);
504
496
  }
505
- case _dtableUtils.CellType.FORMULA:
506
- case _dtableUtils.CellType.LINK_FORMULA:
497
+ case CellType.FORMULA:
498
+ case CellType.LINK_FORMULA:
507
499
  {
508
500
  return this.renderFormulaFilterTerm(filter_predicate, filter_term, index, filterColumn);
509
501
  }
510
- case _dtableUtils.CellType.LINK:
502
+ case CellType.LINK:
511
503
  {
512
504
  return this.renderLinkFilterTerm(filter_predicate, filter_term, index, filterColumn);
513
505
  }
@@ -524,16 +516,16 @@ class FilterItem extends _react.default.Component {
524
516
  const {
525
517
  result_type
526
518
  } = data || {};
527
- if (filterPredicate === _dtableUtils.FILTER_PREDICATE_TYPE.IS_CURRENT_USER_ID) {
519
+ if (filterPredicate === FILTER_PREDICATE_TYPE.IS_CURRENT_USER_ID) {
528
520
  return null;
529
521
  }
530
- if (result_type === _dtableUtils.FORMULA_RESULT_TYPE.ARRAY) {
522
+ if (result_type === FORMULA_RESULT_TYPE.ARRAY) {
531
523
  return this.renderFilterTermByArrayType(filterPredicate, filterTerm, index, filterColumn);
532
524
  }
533
525
  return this.getInputComponent('text');
534
526
  };
535
527
  this.renderLinkFilterTerm = (filterPredicate, filterTerm, index, filterColumn) => {
536
- if (filterPredicate === _dtableUtils.FILTER_PREDICATE_TYPE.IS_CURRENT_USER_ID) {
528
+ if (filterPredicate === FILTER_PREDICATE_TYPE.IS_CURRENT_USER_ID) {
537
529
  return null;
538
530
  }
539
531
  return this.renderFilterTermByArrayType(filterPredicate, filterTerm, index, filterColumn);
@@ -556,40 +548,40 @@ class FilterItem extends _react.default.Component {
556
548
  type: array_type,
557
549
  data: array_data
558
550
  };
559
- if (array_type === _dtableUtils.CellType.SINGLE_SELECT || array_type === _dtableUtils.CellType.MULTIPLE_SELECT) {
551
+ if (array_type === CellType.SINGLE_SELECT || array_type === CellType.MULTIPLE_SELECT) {
560
552
  let {
561
553
  options = []
562
554
  } = array_data || {};
563
555
  return this.renderMultipleSelectOption(options, filterTerm);
564
556
  }
565
- if (_dtableUtils.DATE_COLUMN_OPTIONS.includes(array_type) || array_type === _dtableUtils.CellType.RATE || array_type === _dtableUtils.CellType.CHECKBOX) {
557
+ if (DATE_COLUMN_OPTIONS.includes(array_type) || array_type === CellType.RATE || array_type === CellType.CHECKBOX) {
566
558
  return this.renderFilterTerm(linkedColumn);
567
559
  }
568
- if (_dtableUtils.COLLABORATOR_COLUMN_TYPES.includes(array_type)) {
569
- if (filterPredicate === _dtableUtils.FILTER_PREDICATE_TYPE.INCLUDE_ME) {
560
+ if (COLLABORATOR_COLUMN_TYPES.includes(array_type)) {
561
+ if (filterPredicate === FILTER_PREDICATE_TYPE.INCLUDE_ME) {
570
562
  return null;
571
563
  }
572
- return /*#__PURE__*/_react.default.createElement(_collaboratorFilter.default, {
564
+ return /*#__PURE__*/React.createElement(CollaboratorFilter, {
573
565
  filterIndex: index,
574
566
  filterTerm: filterTerm || [],
575
567
  collaborators: collaborators,
576
568
  onSelectCollaborator: this.onSelectCollaborator,
577
- placeholder: (0, _lang.getLocale)('Add_collaborator')
569
+ placeholder: getLocale('Add_collaborator')
578
570
  });
579
571
  }
580
572
  return this.getInputComponent('text');
581
573
  };
582
574
  this.renderErrorMessage = () => {
583
- return /*#__PURE__*/_react.default.createElement("div", {
575
+ return /*#__PURE__*/React.createElement("div", {
584
576
  className: "ml-2"
585
- }, /*#__PURE__*/_react.default.createElement("span", {
577
+ }, /*#__PURE__*/React.createElement("span", {
586
578
  ref: this.invalidFilterTip,
587
579
  className: "dtable-font dtable-icon-exclamation-triangle invalid-filter"
588
- }), /*#__PURE__*/_react.default.createElement(_reactstrap.UncontrolledTooltip, {
580
+ }), /*#__PURE__*/React.createElement(UncontrolledTooltip, {
589
581
  target: this.invalidFilterTip,
590
582
  placement: "bottom",
591
583
  fade: false
592
- }, (0, _lang.getLocale)('Invalid_filter')));
584
+ }, getLocale('Invalid_filter')));
593
585
  };
594
586
  this.state = {
595
587
  filterTerm: _props.filter.filter_term,
@@ -597,7 +589,7 @@ class FilterItem extends _react.default.Component {
597
589
  };
598
590
  this.filterPredicateOptions = null;
599
591
  this.filterTermModifierOptions = null;
600
- this.invalidFilterTip = /*#__PURE__*/_react.default.createRef();
592
+ this.invalidFilterTip = React.createRef();
601
593
  this.initSelectOptions(_props);
602
594
  }
603
595
  UNSAFE_componentWillReceiveProps(nextProps) {
@@ -631,55 +623,55 @@ class FilterItem extends _react.default.Component {
631
623
  filter_predicate,
632
624
  filter_term_modifier
633
625
  } = filter;
634
- const activeColumn = _utils.FilterItemUtils.generatorColumnOption(filterColumn);
635
- const activePredicate = _utils.FilterItemUtils.generatorPredicateOption(filter_predicate);
626
+ const activeColumn = FilterItemUtils.generatorColumnOption(filterColumn);
627
+ const activePredicate = FilterItemUtils.generatorPredicateOption(filter_predicate);
636
628
  let activeTermModifier = null;
637
629
  let _isCheckboxColumn = false;
638
- if ((0, _dtableUtils.isDateColumn)(filterColumn)) {
639
- activeTermModifier = _utils.FilterItemUtils.generatorTermModifierOption(filter_term_modifier);
640
- } else if ((0, _utils.isCheckboxColumn)(filterColumn)) {
630
+ if (isDateColumn(filterColumn)) {
631
+ activeTermModifier = FilterItemUtils.generatorTermModifierOption(filter_term_modifier);
632
+ } else if (isCheckboxColumn(filterColumn)) {
641
633
  _isCheckboxColumn = true;
642
634
  }
643
635
 
644
636
  // current predicate is not empty
645
637
  const isNeedShowTermModifier = !EMPTY_PREDICATE.includes(filter_predicate);
646
- return /*#__PURE__*/_react.default.createElement("div", {
638
+ return /*#__PURE__*/React.createElement("div", {
647
639
  className: "filter-item"
648
- }, /*#__PURE__*/_react.default.createElement("div", {
640
+ }, /*#__PURE__*/React.createElement("div", {
649
641
  className: "delete-filter",
650
642
  onClick: this.onDeleteFilter
651
- }, /*#__PURE__*/_react.default.createElement("i", {
643
+ }, /*#__PURE__*/React.createElement("i", {
652
644
  className: "dtable-font dtable-icon-fork-number"
653
- })), /*#__PURE__*/_react.default.createElement("div", {
645
+ })), /*#__PURE__*/React.createElement("div", {
654
646
  className: "condition"
655
- }, /*#__PURE__*/_react.default.createElement("div", {
647
+ }, /*#__PURE__*/React.createElement("div", {
656
648
  className: "filter-conjunction"
657
- }, this.renderConjunction()), /*#__PURE__*/_react.default.createElement("div", {
649
+ }, this.renderConjunction()), /*#__PURE__*/React.createElement("div", {
658
650
  className: "filter-container"
659
- }, /*#__PURE__*/_react.default.createElement("div", {
651
+ }, /*#__PURE__*/React.createElement("div", {
660
652
  className: "filter-column"
661
- }, /*#__PURE__*/_react.default.createElement(_DTableCustomizeSelect.default, {
653
+ }, /*#__PURE__*/React.createElement(DTableCustomizeSelect, {
662
654
  value: activeColumn,
663
655
  options: filterColumnOptions,
664
656
  onSelectOption: this.onSelectColumn,
665
657
  searchable: true,
666
- searchPlaceholder: (0, _lang.getLocale)('Find_column'),
667
- noOptionsPlaceholder: (0, _lang.getLocale)('No_results')
668
- })), /*#__PURE__*/_react.default.createElement("div", {
658
+ searchPlaceholder: getLocale('Find_column'),
659
+ noOptionsPlaceholder: getLocale('No_results')
660
+ })), /*#__PURE__*/React.createElement("div", {
669
661
  className: "filter-predicate ml-2 ".concat(_isCheckboxColumn ? 'filter-checkbox-predicate' : '')
670
- }, /*#__PURE__*/_react.default.createElement(_DTableCustomizeSelect.default, {
662
+ }, /*#__PURE__*/React.createElement(DTableCustomizeSelect, {
671
663
  value: activePredicate,
672
664
  options: filterPredicateOptions,
673
665
  onSelectOption: this.onSelectPredicate
674
- })), (0, _dtableUtils.isDateColumn)(filterColumn) && isNeedShowTermModifier && /*#__PURE__*/_react.default.createElement("div", {
666
+ })), isDateColumn(filterColumn) && isNeedShowTermModifier && /*#__PURE__*/React.createElement("div", {
675
667
  className: "filter-term-modifier ml-2"
676
- }, /*#__PURE__*/_react.default.createElement(_DTableCustomizeSelect.default, {
668
+ }, /*#__PURE__*/React.createElement(DTableCustomizeSelect, {
677
669
  value: activeTermModifier,
678
670
  options: filterTermModifierOptions,
679
671
  onSelectOption: this.onSelectTermModifier
680
- })), /*#__PURE__*/_react.default.createElement("div", {
672
+ })), /*#__PURE__*/React.createElement("div", {
681
673
  className: "filter-term ml-2"
682
674
  }, this.renderFilterTerm(filterColumn)), errMsg && this.renderErrorMessage())));
683
675
  }
684
676
  }
685
- var _default = exports.default = FilterItem;
677
+ export default FilterItem;