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.
- package/lib/AutoNumberFormatter/index.js +7 -14
- package/lib/ButtonFormatter/index.js +9 -16
- package/lib/CTimeFormatter/index.js +9 -16
- package/lib/CheckboxEditor/index.js +8 -15
- package/lib/CheckboxFormatter/index.js +8 -15
- package/lib/CollaboratorEditor/index.js +21 -29
- package/lib/CollaboratorEditor/mb-collaborator-editor-popover/index.js +25 -32
- package/lib/CollaboratorEditor/pc-collaborator-editor-popover/index.js +18 -25
- package/lib/CollaboratorFormatter/index.js +12 -19
- package/lib/CollaboratorItem/index.js +10 -17
- package/lib/CreatorFormatter/index.js +12 -19
- package/lib/DTableCommonAddTool/index.js +6 -13
- package/lib/DTableCustomizeCollaboratorSelect/index.js +18 -26
- package/lib/DTableCustomizeSelect/index.js +15 -23
- package/lib/DTableFiltersPopover/constants/index.js +33 -38
- package/lib/DTableFiltersPopover/index.js +31 -38
- package/lib/DTableFiltersPopover/utils/filter-item-utils.js +46 -53
- package/lib/DTableFiltersPopover/utils/index.js +99 -128
- package/lib/DTableFiltersPopover/widgets/collaborator-filter/index.js +26 -34
- package/lib/DTableFiltersPopover/widgets/department-select-filter/department-multiple-select-filter.js +25 -33
- package/lib/DTableFiltersPopover/widgets/department-select-filter/department-single-select-filter.js +26 -34
- package/lib/DTableFiltersPopover/widgets/filter-calendar.js +26 -34
- package/lib/DTableFiltersPopover/widgets/filter-item.js +120 -128
- package/lib/DTableFiltersPopover/widgets/filter-list/index.js +18 -26
- package/lib/DTableFiltersPopover/widgets/rate-item.js +8 -15
- package/lib/DTablePopover/index.js +8 -15
- package/lib/DTablePopover/utils.js +2 -9
- package/lib/DTableRadio/index.js +10 -17
- package/lib/DTableSearchInput/index.js +13 -21
- package/lib/DTableSearchInput/utils.js +2 -9
- package/lib/DTableSelect/dtable-select-label.js +6 -13
- package/lib/DTableSelect/index.js +10 -18
- package/lib/DTableSelect/utils.js +10 -20
- package/lib/DTableSwitch/index.js +7 -14
- package/lib/DateEditor/index.js +22 -30
- package/lib/DateEditor/mb-date-editor-popover/index.js +47 -55
- package/lib/DateEditor/pc-date-editor-popover.js +20 -27
- package/lib/DateFormatter/index.js +9 -16
- package/lib/Department-editor/constants.js +1 -7
- package/lib/Department-editor/department-multiple-select/index.js +24 -32
- package/lib/Department-editor/department-single-select.js +33 -41
- package/lib/Department-editor/index.js +14 -22
- package/lib/Department-editor/selected-departments/index.js +25 -32
- package/lib/Department-editor/utils.js +3 -11
- package/lib/DepartmentSingleSelectFormatter/index.js +9 -16
- package/lib/DigitalSignFormatter/index.js +15 -23
- package/lib/DigitalSignFormatter/utils.js +3 -11
- package/lib/DurationFormatter/index.js +9 -16
- package/lib/EditEditorButton/index.js +5 -12
- package/lib/EmailFormatter/index.js +7 -14
- package/lib/FieldDisplaySetting/field-item.js +14 -21
- package/lib/FieldDisplaySetting/index.js +19 -27
- package/lib/FileEditor/index.js +8 -15
- package/lib/FileEditor/pc-files-addition/index.js +0 -1
- package/lib/FileEditor/pc-files-addition/pc-file-uploaded-item.js +0 -1
- package/lib/FileEditor/pc-files-preview/index.js +0 -1
- package/lib/FileEditor/pc-files-preview/pc-file-item-preview.js +0 -1
- package/lib/FileFormatter/index.js +11 -19
- package/lib/FileItemFormatter/index.js +6 -14
- package/lib/FileItemFormatter/utils.js +2 -9
- package/lib/FileUploader/index.js +4 -11
- package/lib/FormulaFormatter/cell-value-validator.js +18 -24
- package/lib/FormulaFormatter/index.js +32 -39
- package/lib/FormulaFormatter/utils.js +13 -29
- package/lib/GeolocationFormatter/index.js +9 -16
- package/lib/HtmlLongTextFormatter/index.js +9 -17
- package/lib/HtmlLongTextFormatter/markdown2html.js +47 -0
- package/lib/HtmlLongTextFormatter/unified/index.js +400 -0
- package/lib/HtmlLongTextFormatter/vfile/core.js +155 -0
- package/lib/HtmlLongTextFormatter/vfile/index.js +40 -0
- package/lib/ImageFormatter/images-lazy-load.js +9 -16
- package/lib/ImageFormatter/index.js +16 -24
- package/lib/ImageFormatter/utils.js +2 -9
- package/lib/ImagePreviewerLightbox/index.js +12 -19
- package/lib/ImagePreviewerLightbox/utils.js +3 -11
- package/lib/LastModifierFormatter/index.js +12 -19
- package/lib/LinkEditor/index.js +25 -33
- package/lib/LinkEditor/link-editor-option.js +8 -15
- package/lib/LinkEditor/mb-link-editor-popover/index.js +23 -30
- package/lib/LinkEditor/pc-link-editor-popover/index.js +17 -24
- package/lib/LinkFormatter/index.js +13 -20
- package/lib/Loading/index.js +4 -11
- package/lib/LongTextFormatter/index.js +6 -13
- package/lib/MBEditorHeader/index.js +7 -14
- package/lib/MTimeFormatter/index.js +9 -16
- package/lib/ModalPortal/index.js +5 -12
- package/lib/MultipleSelectEditor/index.js +17 -25
- package/lib/MultipleSelectFormatter/index.js +10 -17
- package/lib/NotificationPopover/index.js +16 -24
- package/lib/NumberEditor/index.js +18 -25
- package/lib/NumberFormatter/index.js +9 -16
- package/lib/RateFormatter/index.js +8 -15
- package/lib/RoleStatusEditor/index.js +14 -22
- package/lib/RowExpandEmailFormatter/index.js +10 -17
- package/lib/RowExpandFileFormatter/index.js +8 -16
- package/lib/RowExpandFileFormatter/row-expand-file-item-formatter.js +18 -27
- package/lib/RowExpandFormatter/index.js +78 -86
- package/lib/RowExpandFormulaFormatter/index.js +34 -42
- package/lib/RowExpandImageFormatter/index.js +10 -19
- package/lib/RowExpandImageFormatter/row-expand-image-item-formatter.js +18 -27
- package/lib/RowExpandImageFormatter/utils.js +2 -9
- package/lib/RowExpandLinkFormatter/collaborator-item-formatter.js +7 -16
- package/lib/RowExpandLinkFormatter/index.js +37 -46
- package/lib/RowExpandLinkFormatter/utils.js +6 -17
- package/lib/RowExpandLinkFormatter/value-display-utils.js +5 -12
- package/lib/RowExpandRateFormatter/index.js +8 -15
- package/lib/RowExpandUrlFormatter/index.js +14 -21
- package/lib/SelectItem/index.js +4 -12
- package/lib/SelectOptionGroup/KeyCodes.js +1 -7
- package/lib/SelectOptionGroup/index.js +33 -32
- package/lib/SelectOptionGroup/option.js +4 -19
- package/lib/SimpleLongTextFormatter/index.js +20 -27
- package/lib/SimpleLongTextFormatter/normalize-long-text-value.js +1 -7
- package/lib/SimpleLongTextFormatter/widgets/LongTextPreview.js +8 -15
- package/lib/SimpleLongTextFormatter/widgets/dtable-markdown-viewer.js +7 -14
- package/lib/SingleSelectEditor/index.js +18 -26
- package/lib/SingleSelectFormatter/index.js +9 -16
- package/lib/TextEditor/index.js +7 -14
- package/lib/TextFormatter/index.js +7 -14
- package/lib/UrlFormatter/index.js +7 -14
- package/lib/cellFormatterFactory/index.js +4 -11
- package/lib/common/ClickOutside.js +4 -12
- package/lib/common/delete-tip.js +12 -20
- package/lib/common/modal-portal.js +5 -13
- package/lib/constants/index.js +9 -28
- package/lib/data/dtable-value.js +6 -11
- package/lib/formatterConfig/base-formatter-config.js +46 -53
- package/lib/formatterConfig/index.js +9 -16
- package/lib/hooks/common-hooks.js +4 -11
- package/lib/index.js +75 -432
- package/lib/lang/index.js +13 -24
- package/lib/locals/de.js +1 -7
- package/lib/locals/en.js +1 -7
- package/lib/locals/fr.js +1 -7
- package/lib/locals/zh-CN.js +1 -7
- package/lib/select-editor/index.js +4 -27
- package/lib/select-editor/mb-select-editor-popover/index.js +33 -41
- package/lib/select-editor/pc-select-editor-popover/index.js +19 -26
- package/lib/select-editor/select-editor-option.js +8 -15
- package/lib/toaster/alert.js +11 -18
- package/lib/toaster/index.js +3 -10
- package/lib/toaster/toast.js +8 -16
- package/lib/toaster/toastManager.js +5 -13
- package/lib/toaster/toaster.js +7 -15
- package/lib/utils/dayjs.js +4 -11
- package/lib/utils/editor-utils.js +5 -15
- package/lib/utils/event-bus.js +1 -7
- package/lib/utils/utils.js +6 -17
- package/package.json +77 -63
|
@@ -1,26 +1,18 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
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
|
-
} =
|
|
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
|
|
32
|
+
return FilterItemUtils.generatorPredicateOption(predicate);
|
|
41
33
|
}).filter(item => item) : [];
|
|
42
34
|
const {
|
|
43
35
|
filter_predicate
|
|
44
36
|
} = filter;
|
|
45
|
-
if (
|
|
46
|
-
if (filter_predicate ===
|
|
47
|
-
filterTermModifierList =
|
|
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
|
|
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 =
|
|
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 =
|
|
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 = [
|
|
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 =
|
|
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 =
|
|
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 =
|
|
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 =
|
|
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__*/
|
|
217
|
+
return /*#__PURE__*/React.createElement(DtableSearchInput, {
|
|
226
218
|
value: filterTerm,
|
|
227
219
|
onChange: this.onFilterTermTextChanged,
|
|
228
220
|
autoFocus: false,
|
|
229
|
-
className: (
|
|
221
|
+
className: classnames('text-truncate')
|
|
230
222
|
});
|
|
231
223
|
} else if (type === 'checkbox') {
|
|
232
|
-
return /*#__PURE__*/
|
|
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 =
|
|
253
|
-
return /*#__PURE__*/
|
|
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__*/
|
|
253
|
+
return /*#__PURE__*/React.createElement("span", {
|
|
262
254
|
className: "selected-conjunction-show"
|
|
263
|
-
},
|
|
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 = [
|
|
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__*/
|
|
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__*/
|
|
296
|
+
label: /*#__PURE__*/React.createElement(Fragment, null, labelArray)
|
|
305
297
|
} : {};
|
|
306
298
|
const dataOptions = options.map(option => {
|
|
307
|
-
return
|
|
299
|
+
return FilterItemUtils.generatorMultipleSelectOption(option, filterTerm);
|
|
308
300
|
});
|
|
309
|
-
return /*#__PURE__*/
|
|
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:
|
|
306
|
+
placeholder: getLocale('Select_option(s)'),
|
|
315
307
|
searchable: true,
|
|
316
|
-
searchPlaceholder:
|
|
317
|
-
noOptionsPlaceholder:
|
|
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 (
|
|
350
|
-
const inputRangeLabel = [
|
|
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__*/
|
|
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
|
|
366
|
-
case
|
|
367
|
-
case
|
|
368
|
-
case
|
|
369
|
-
case
|
|
370
|
-
case
|
|
371
|
-
case
|
|
372
|
-
case
|
|
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 ===
|
|
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
|
|
372
|
+
case CellType.CHECKBOX:
|
|
381
373
|
{
|
|
382
374
|
return this.getInputComponent('checkbox');
|
|
383
375
|
}
|
|
384
|
-
case
|
|
376
|
+
case CellType.SINGLE_SELECT:
|
|
385
377
|
{
|
|
386
378
|
// get options
|
|
387
379
|
let {
|
|
388
380
|
options = []
|
|
389
381
|
} = filterColumn.data || {};
|
|
390
|
-
if ([
|
|
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__*/
|
|
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
|
|
403
|
+
return FilterItemUtils.generatorSingleSelectOption(option);
|
|
412
404
|
});
|
|
413
|
-
return /*#__PURE__*/
|
|
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:
|
|
410
|
+
placeholder: getLocale('Select_an_option'),
|
|
419
411
|
searchable: true,
|
|
420
|
-
searchPlaceholder:
|
|
421
|
-
noOptionsPlaceholder:
|
|
412
|
+
searchPlaceholder: getLocale('Find_an_option'),
|
|
413
|
+
noOptionsPlaceholder: getLocale('No_options_available')
|
|
422
414
|
});
|
|
423
415
|
}
|
|
424
|
-
case
|
|
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
|
|
423
|
+
case CellType.DEPARTMENT_SINGLE_SELECT:
|
|
432
424
|
{
|
|
433
|
-
if ([
|
|
434
|
-
return /*#__PURE__*/
|
|
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__*/
|
|
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
|
|
443
|
+
case CellType.COLLABORATOR:
|
|
452
444
|
{
|
|
453
|
-
if (filter_predicate ===
|
|
445
|
+
if (filter_predicate === FILTER_PREDICATE_TYPE.INCLUDE_ME) {
|
|
454
446
|
return null;
|
|
455
447
|
}
|
|
456
|
-
return /*#__PURE__*/
|
|
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:
|
|
454
|
+
placeholder: getLocale('Add_collaborator')
|
|
463
455
|
});
|
|
464
456
|
}
|
|
465
|
-
case
|
|
466
|
-
case
|
|
457
|
+
case CellType.CREATOR:
|
|
458
|
+
case CellType.LAST_MODIFIER:
|
|
467
459
|
{
|
|
468
|
-
if (filter_predicate ===
|
|
460
|
+
if (filter_predicate === FILTER_PREDICATE_TYPE.INCLUDE_ME) {
|
|
469
461
|
return null;
|
|
470
462
|
}
|
|
471
|
-
const creators = collaborators.concat([
|
|
472
|
-
return /*#__PURE__*/
|
|
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 ===
|
|
469
|
+
placeholder: type === CellType.CREATOR ? getLocale('Add_a_creator') : getLocale('Add_a_last_modifier')
|
|
478
470
|
});
|
|
479
471
|
}
|
|
480
|
-
case
|
|
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__*/
|
|
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__*/
|
|
493
|
+
return /*#__PURE__*/React.createElement("div", {
|
|
502
494
|
className: "filter-rate-list"
|
|
503
495
|
}, rateList);
|
|
504
496
|
}
|
|
505
|
-
case
|
|
506
|
-
case
|
|
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
|
|
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 ===
|
|
519
|
+
if (filterPredicate === FILTER_PREDICATE_TYPE.IS_CURRENT_USER_ID) {
|
|
528
520
|
return null;
|
|
529
521
|
}
|
|
530
|
-
if (result_type ===
|
|
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 ===
|
|
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 ===
|
|
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 (
|
|
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 (
|
|
569
|
-
if (filterPredicate ===
|
|
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__*/
|
|
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:
|
|
569
|
+
placeholder: getLocale('Add_collaborator')
|
|
578
570
|
});
|
|
579
571
|
}
|
|
580
572
|
return this.getInputComponent('text');
|
|
581
573
|
};
|
|
582
574
|
this.renderErrorMessage = () => {
|
|
583
|
-
return /*#__PURE__*/
|
|
575
|
+
return /*#__PURE__*/React.createElement("div", {
|
|
584
576
|
className: "ml-2"
|
|
585
|
-
}, /*#__PURE__*/
|
|
577
|
+
}, /*#__PURE__*/React.createElement("span", {
|
|
586
578
|
ref: this.invalidFilterTip,
|
|
587
579
|
className: "dtable-font dtable-icon-exclamation-triangle invalid-filter"
|
|
588
|
-
}), /*#__PURE__*/
|
|
580
|
+
}), /*#__PURE__*/React.createElement(UncontrolledTooltip, {
|
|
589
581
|
target: this.invalidFilterTip,
|
|
590
582
|
placement: "bottom",
|
|
591
583
|
fade: false
|
|
592
|
-
},
|
|
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 =
|
|
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 =
|
|
635
|
-
const activePredicate =
|
|
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 (
|
|
639
|
-
activeTermModifier =
|
|
640
|
-
} else if (
|
|
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__*/
|
|
638
|
+
return /*#__PURE__*/React.createElement("div", {
|
|
647
639
|
className: "filter-item"
|
|
648
|
-
}, /*#__PURE__*/
|
|
640
|
+
}, /*#__PURE__*/React.createElement("div", {
|
|
649
641
|
className: "delete-filter",
|
|
650
642
|
onClick: this.onDeleteFilter
|
|
651
|
-
}, /*#__PURE__*/
|
|
643
|
+
}, /*#__PURE__*/React.createElement("i", {
|
|
652
644
|
className: "dtable-font dtable-icon-fork-number"
|
|
653
|
-
})), /*#__PURE__*/
|
|
645
|
+
})), /*#__PURE__*/React.createElement("div", {
|
|
654
646
|
className: "condition"
|
|
655
|
-
}, /*#__PURE__*/
|
|
647
|
+
}, /*#__PURE__*/React.createElement("div", {
|
|
656
648
|
className: "filter-conjunction"
|
|
657
|
-
}, this.renderConjunction()), /*#__PURE__*/
|
|
649
|
+
}, this.renderConjunction()), /*#__PURE__*/React.createElement("div", {
|
|
658
650
|
className: "filter-container"
|
|
659
|
-
}, /*#__PURE__*/
|
|
651
|
+
}, /*#__PURE__*/React.createElement("div", {
|
|
660
652
|
className: "filter-column"
|
|
661
|
-
}, /*#__PURE__*/
|
|
653
|
+
}, /*#__PURE__*/React.createElement(DTableCustomizeSelect, {
|
|
662
654
|
value: activeColumn,
|
|
663
655
|
options: filterColumnOptions,
|
|
664
656
|
onSelectOption: this.onSelectColumn,
|
|
665
657
|
searchable: true,
|
|
666
|
-
searchPlaceholder:
|
|
667
|
-
noOptionsPlaceholder:
|
|
668
|
-
})), /*#__PURE__*/
|
|
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__*/
|
|
662
|
+
}, /*#__PURE__*/React.createElement(DTableCustomizeSelect, {
|
|
671
663
|
value: activePredicate,
|
|
672
664
|
options: filterPredicateOptions,
|
|
673
665
|
onSelectOption: this.onSelectPredicate
|
|
674
|
-
})),
|
|
666
|
+
})), isDateColumn(filterColumn) && isNeedShowTermModifier && /*#__PURE__*/React.createElement("div", {
|
|
675
667
|
className: "filter-term-modifier ml-2"
|
|
676
|
-
}, /*#__PURE__*/
|
|
668
|
+
}, /*#__PURE__*/React.createElement(DTableCustomizeSelect, {
|
|
677
669
|
value: activeTermModifier,
|
|
678
670
|
options: filterTermModifierOptions,
|
|
679
671
|
onSelectOption: this.onSelectTermModifier
|
|
680
|
-
})), /*#__PURE__*/
|
|
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
|
-
|
|
677
|
+
export default FilterItem;
|