dtable-ui-component 4.4.3 → 4.4.4-2

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