dtable-ui-component 6.0.38-alpha.1 → 6.0.38
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/DTableFiltersPopover/constants/index.js +2 -30
- package/lib/DTableFiltersPopover/index.css +17 -36
- package/lib/DTableFiltersPopover/index.js +136 -118
- package/lib/DTableFiltersPopover/utils/filter-item-utils.js +4 -10
- package/lib/DTableFiltersPopover/utils/index.js +82 -358
- package/lib/DTableFiltersPopover/widgets/collaborator-filter/index.css +0 -0
- package/lib/DTableFiltersPopover/widgets/collaborator-filter/index.js +4 -6
- package/lib/DTableFiltersPopover/widgets/department-select-filter/department-multiple-select-filter.js +2 -13
- package/lib/DTableFiltersPopover/widgets/department-select-filter/department-single-select-filter.js +6 -18
- package/lib/DTableFiltersPopover/widgets/filter-item.js +53 -138
- package/lib/DTableFiltersPopover/widgets/filter-list/index.css +16 -113
- package/lib/DTableFiltersPopover/widgets/filter-list/index.js +39 -226
- package/lib/GeolocationEditor/mb-editor/map-editor/index.css +5 -2
- package/lib/GeolocationEditor/mb-editor/map-editor/index.js +93 -51
- package/lib/GeolocationEditor/pc-editor/index.css +6 -15
- package/lib/GeolocationEditor/pc-editor/index.js +4 -1
- package/lib/GeolocationEditor/pc-editor/map-editor/index.css +33 -0
- package/lib/GeolocationEditor/pc-editor/map-editor/index.js +143 -99
- package/lib/GeolocationEditor/pc-editor/map-editor/large-editor/index.css +13 -11
- package/lib/GeolocationEditor/pc-editor/map-editor/large-editor/index.js +100 -70
- package/lib/GeolocationEditor/pc-editor/map-selection-editor/index.js +20 -11
- package/lib/GeolocationEditor/pc-editor/map-selection-editor/large-editor/index.js +2 -2
- package/lib/RowExpandEditor/geolocation-editor/pc-editor/index.js +19 -5
- package/lib/locales/de.json +5 -3
- package/lib/locales/en.json +5 -8
- package/lib/locales/es.json +5 -3
- package/lib/locales/fr.json +5 -3
- package/lib/locales/pt.json +5 -3
- package/lib/locales/ru.json +5 -3
- package/lib/locales/zh-CN.json +5 -8
- package/lib/utils/column-utils.js +2 -21
- package/package.json +2 -2
- package/lib/DTableFiltersPopover/widgets/filter-group.js +0 -185
package/lib/DTableFiltersPopover/widgets/department-select-filter/department-single-select-filter.js
CHANGED
|
@@ -11,16 +11,14 @@ var _classnames = _interopRequireDefault(require("classnames"));
|
|
|
11
11
|
var _SelectedDepartments = _interopRequireDefault(require("../../../SelectedDepartments"));
|
|
12
12
|
var _DepartmentSingleSelectEditor = _interopRequireDefault(require("../../../DepartmentSingleSelectEditor"));
|
|
13
13
|
var _departments = require("../../../constants/departments");
|
|
14
|
-
var _ModalPortal = _interopRequireDefault(require("../../../ModalPortal"));
|
|
15
14
|
var _commonHooks = require("../../../hooks/common-hooks");
|
|
16
15
|
var _lang = require("../../../lang");
|
|
17
16
|
function DepartmentSingleSelectFilter(props) {
|
|
18
17
|
const {
|
|
19
18
|
value,
|
|
20
19
|
column,
|
|
21
|
-
|
|
22
|
-
userDepartmentIdsMap
|
|
23
|
-
departments
|
|
20
|
+
departments,
|
|
21
|
+
userDepartmentIdsMap
|
|
24
22
|
} = props;
|
|
25
23
|
const [isShowSelector, setIsShowSelector] = (0, _react.useState)(false);
|
|
26
24
|
const [selectedDepartment, setSelectedDepartment] = (0, _react.useState)(value || '');
|
|
@@ -79,30 +77,20 @@ function DepartmentSingleSelectFilter(props) {
|
|
|
79
77
|
}, value ? /*#__PURE__*/_react.default.createElement("span", {
|
|
80
78
|
className: "selected-option-show"
|
|
81
79
|
}, /*#__PURE__*/_react.default.createElement(_SelectedDepartments.default, {
|
|
82
|
-
value: selectedDepartmentIds
|
|
80
|
+
value: selectedDepartmentIds,
|
|
81
|
+
departments: departments
|
|
83
82
|
})) : /*#__PURE__*/_react.default.createElement("span", {
|
|
84
83
|
className: "select-placeholder"
|
|
85
84
|
}, (0, _lang.getLocale)('Select_department')), /*#__PURE__*/_react.default.createElement("span", {
|
|
86
85
|
className: "dtable-font dtable-icon-down3"
|
|
87
|
-
})), isShowSelector &&
|
|
86
|
+
})), isShowSelector && /*#__PURE__*/_react.default.createElement(_DepartmentSingleSelectEditor.default, {
|
|
88
87
|
enableSelectRange: false,
|
|
89
|
-
isInModal: isInModal,
|
|
90
88
|
column: column,
|
|
91
89
|
value: value,
|
|
92
90
|
onCommit: onCommit,
|
|
93
91
|
userDepartmentIdsMap: userDepartmentIdsMap,
|
|
94
92
|
departments: departments,
|
|
95
93
|
renderUserDepartmentOptions: renderUserDepartmentOptions
|
|
96
|
-
})
|
|
97
|
-
enableSelectRange: false,
|
|
98
|
-
isInModal: isInModal,
|
|
99
|
-
column: column,
|
|
100
|
-
value: value,
|
|
101
|
-
position: selectorRef.current.getBoundingClientRect(),
|
|
102
|
-
onCommit: onCommit,
|
|
103
|
-
userDepartmentIdsMap: userDepartmentIdsMap,
|
|
104
|
-
departments: departments,
|
|
105
|
-
renderUserDepartmentOptions: renderUserDepartmentOptions
|
|
106
|
-
})));
|
|
94
|
+
}));
|
|
107
95
|
}
|
|
108
96
|
var _default = exports.default = DepartmentSingleSelectFilter;
|
|
@@ -17,13 +17,9 @@ var _departmentSingleSelectFilter = _interopRequireDefault(require("./department
|
|
|
17
17
|
var _departmentMultipleSelectFilter = _interopRequireDefault(require("./department-select-filter/department-multiple-select-filter"));
|
|
18
18
|
var _rateItem = _interopRequireDefault(require("./rate-item"));
|
|
19
19
|
var _filterCalendar = _interopRequireDefault(require("./filter-calendar"));
|
|
20
|
-
var _filterItemUtils = _interopRequireDefault(require("../utils/filter-item-utils"));
|
|
21
20
|
var _utils = require("../utils");
|
|
22
|
-
var _columnUtils = require("../../utils/column-utils");
|
|
23
|
-
var _CheckboxEditor = _interopRequireDefault(require("../../CheckboxEditor"));
|
|
24
|
-
var _NumberEditor = _interopRequireDefault(require("../../NumberEditor"));
|
|
25
|
-
var _constants = require("../constants");
|
|
26
21
|
var _lang = require("../../lang");
|
|
22
|
+
const EMPTY_PREDICATE = [_dtableUtils.FILTER_PREDICATE_TYPE.EMPTY, _dtableUtils.FILTER_PREDICATE_TYPE.NOT_EMPTY];
|
|
27
23
|
class FilterItem extends _react.default.Component {
|
|
28
24
|
constructor(_props) {
|
|
29
25
|
var _this;
|
|
@@ -32,15 +28,16 @@ class FilterItem extends _react.default.Component {
|
|
|
32
28
|
this.initSelectOptions = props => {
|
|
33
29
|
const {
|
|
34
30
|
filter,
|
|
35
|
-
filterColumn
|
|
31
|
+
filterColumn,
|
|
32
|
+
value
|
|
36
33
|
} = props;
|
|
37
34
|
let {
|
|
38
35
|
filterPredicateList,
|
|
39
36
|
filterTermModifierList
|
|
40
|
-
} = (0, _utils.getColumnOptions)(filterColumn);
|
|
37
|
+
} = (0, _utils.getColumnOptions)(filterColumn, value);
|
|
41
38
|
// The value of the calculation formula column does not exist in the shared view
|
|
42
39
|
this.filterPredicateOptions = filterPredicateList ? filterPredicateList.map(predicate => {
|
|
43
|
-
return
|
|
40
|
+
return _utils.FilterItemUtils.generatorPredicateOption(predicate);
|
|
44
41
|
}).filter(item => item) : [];
|
|
45
42
|
const {
|
|
46
43
|
filter_predicate
|
|
@@ -50,7 +47,7 @@ class FilterItem extends _react.default.Component {
|
|
|
50
47
|
filterTermModifierList = _dtableUtils.filterTermModifierIsWithin;
|
|
51
48
|
}
|
|
52
49
|
this.filterTermModifierOptions = filterTermModifierList.map(termModifier => {
|
|
53
|
-
return
|
|
50
|
+
return _utils.FilterItemUtils.generatorTermModifierOption(termModifier);
|
|
54
51
|
});
|
|
55
52
|
}
|
|
56
53
|
};
|
|
@@ -183,21 +180,12 @@ class FilterItem extends _react.default.Component {
|
|
|
183
180
|
this.resetState(newFilter);
|
|
184
181
|
this.props.updateFilter(index, newFilter);
|
|
185
182
|
};
|
|
186
|
-
this.onFilterTermCheckboxChanged =
|
|
187
|
-
|
|
188
|
-
filterColumn
|
|
189
|
-
} = this.props;
|
|
190
|
-
const value = this.checkboxEditor.getValue();
|
|
191
|
-
const checked = value[filterColumn.key];
|
|
192
|
-
this.onFilterTermChanged(checked);
|
|
183
|
+
this.onFilterTermCheckboxChanged = e => {
|
|
184
|
+
this.onFilterTermChanged(e.target.checked);
|
|
193
185
|
};
|
|
194
186
|
this.onFilterTermTextChanged = value => {
|
|
195
187
|
this.onFilterTermChanged(value);
|
|
196
188
|
};
|
|
197
|
-
this.onFilterTermNumberChanged = () => {
|
|
198
|
-
const value = this.numberEditor.getValue();
|
|
199
|
-
this.onFilterTermChanged(Object.values(value)[0]);
|
|
200
|
-
};
|
|
201
189
|
this.onFilterTermChanged = newFilterTerm => {
|
|
202
190
|
const {
|
|
203
191
|
index,
|
|
@@ -230,13 +218,10 @@ class FilterItem extends _react.default.Component {
|
|
|
230
218
|
this.onFilterTermChanged(index);
|
|
231
219
|
};
|
|
232
220
|
this.getInputComponent = type => {
|
|
233
|
-
const {
|
|
234
|
-
filterColumn
|
|
235
|
-
} = this.props;
|
|
236
221
|
const {
|
|
237
222
|
filterTerm
|
|
238
223
|
} = this.state;
|
|
239
|
-
if (type ===
|
|
224
|
+
if (type === 'text') {
|
|
240
225
|
return /*#__PURE__*/_react.default.createElement(_DTableSearchInput.default, {
|
|
241
226
|
value: filterTerm,
|
|
242
227
|
onChange: this.onFilterTermTextChanged,
|
|
@@ -244,22 +229,10 @@ class FilterItem extends _react.default.Component {
|
|
|
244
229
|
className: (0, _classnames.default)('text-truncate')
|
|
245
230
|
});
|
|
246
231
|
} else if (type === 'checkbox') {
|
|
247
|
-
return /*#__PURE__*/_react.default.createElement("
|
|
248
|
-
|
|
249
|
-
|
|
250
|
-
|
|
251
|
-
column: filterColumn,
|
|
252
|
-
value: filterTerm,
|
|
253
|
-
extraClassName: "filter-item-checkbox",
|
|
254
|
-
onChange: this.onFilterTermCheckboxChanged,
|
|
255
|
-
readOnly: false
|
|
256
|
-
}));
|
|
257
|
-
} else if (type === 'number') {
|
|
258
|
-
return /*#__PURE__*/_react.default.createElement(_NumberEditor.default, {
|
|
259
|
-
ref: ref => this.numberEditor = ref,
|
|
260
|
-
column: filterColumn,
|
|
261
|
-
value: filterTerm,
|
|
262
|
-
onCommit: this.onFilterTermNumberChanged
|
|
232
|
+
return /*#__PURE__*/_react.default.createElement("input", {
|
|
233
|
+
type: "checkbox",
|
|
234
|
+
checked: filterTerm,
|
|
235
|
+
onChange: this.onFilterTermCheckboxChanged
|
|
263
236
|
});
|
|
264
237
|
}
|
|
265
238
|
};
|
|
@@ -276,12 +249,11 @@ class FilterItem extends _react.default.Component {
|
|
|
276
249
|
}
|
|
277
250
|
case 1:
|
|
278
251
|
{
|
|
279
|
-
const activeConjunction =
|
|
252
|
+
const activeConjunction = _utils.FilterItemUtils.getActiveConjunctionOption(filterConjunction);
|
|
280
253
|
return /*#__PURE__*/_react.default.createElement(_DTableCustomizeSelect.default, {
|
|
281
254
|
value: activeConjunction,
|
|
282
255
|
options: conjunctionOptions,
|
|
283
|
-
onSelectOption: this.onSelectConjunction
|
|
284
|
-
isInModal: this.props.isInModal
|
|
256
|
+
onSelectOption: this.onSelectConjunction
|
|
285
257
|
});
|
|
286
258
|
}
|
|
287
259
|
default:
|
|
@@ -312,32 +284,27 @@ class FilterItem extends _react.default.Component {
|
|
|
312
284
|
if (Array.isArray(options) && Array.isArray(filterTerm)) {
|
|
313
285
|
filterTerm.forEach(item => {
|
|
314
286
|
let inOption = options.find(option => option.id === item);
|
|
315
|
-
let optionStyle = {
|
|
316
|
-
margin: '0 10px 0 0'
|
|
317
|
-
};
|
|
318
|
-
let optionName = null;
|
|
319
287
|
if (inOption) {
|
|
320
|
-
|
|
321
|
-
|
|
322
|
-
|
|
323
|
-
|
|
324
|
-
|
|
325
|
-
|
|
288
|
+
let optionStyle = {
|
|
289
|
+
margin: '0 10px 0 0',
|
|
290
|
+
background: inOption.color,
|
|
291
|
+
color: inOption.textColor || null
|
|
292
|
+
};
|
|
293
|
+
labelArray.push( /*#__PURE__*/_react.default.createElement("span", {
|
|
294
|
+
className: className,
|
|
295
|
+
style: optionStyle,
|
|
296
|
+
key: 'option_' + item,
|
|
297
|
+
title: inOption.name,
|
|
298
|
+
"aria-label": inOption.name
|
|
299
|
+
}, inOption.name));
|
|
326
300
|
}
|
|
327
|
-
labelArray.push( /*#__PURE__*/_react.default.createElement("span", {
|
|
328
|
-
className: className,
|
|
329
|
-
style: optionStyle,
|
|
330
|
-
key: 'option_' + item,
|
|
331
|
-
title: optionName,
|
|
332
|
-
"aria-label": optionName
|
|
333
|
-
}, optionName));
|
|
334
301
|
});
|
|
335
302
|
}
|
|
336
303
|
const selectedOptionNames = labelArray.length > 0 ? {
|
|
337
304
|
label: /*#__PURE__*/_react.default.createElement(_react.Fragment, null, labelArray)
|
|
338
305
|
} : {};
|
|
339
306
|
const dataOptions = options.map(option => {
|
|
340
|
-
return
|
|
307
|
+
return _utils.FilterItemUtils.generatorMultipleSelectOption(option, filterTerm);
|
|
341
308
|
});
|
|
342
309
|
return /*#__PURE__*/_react.default.createElement(_DTableCustomizeSelect.default, {
|
|
343
310
|
className: "selector-multiple-select",
|
|
@@ -348,8 +315,7 @@ class FilterItem extends _react.default.Component {
|
|
|
348
315
|
searchable: true,
|
|
349
316
|
searchPlaceholder: (0, _lang.getLocale)('Search_option'),
|
|
350
317
|
noOptionsPlaceholder: (0, _lang.getLocale)('No_options_available'),
|
|
351
|
-
supportMultipleSelect: isSupportMultipleSelect
|
|
352
|
-
isInModal: _this.props.isInModal
|
|
318
|
+
supportMultipleSelect: isSupportMultipleSelect
|
|
353
319
|
});
|
|
354
320
|
};
|
|
355
321
|
this.renderFilterTerm = filterColumn => {
|
|
@@ -371,7 +337,7 @@ class FilterItem extends _react.default.Component {
|
|
|
371
337
|
filter_term_modifier
|
|
372
338
|
} = filter;
|
|
373
339
|
// predicate is empty or not empty
|
|
374
|
-
if (
|
|
340
|
+
if (EMPTY_PREDICATE.includes(filter_predicate)) {
|
|
375
341
|
return null;
|
|
376
342
|
}
|
|
377
343
|
|
|
@@ -400,6 +366,7 @@ class FilterItem extends _react.default.Component {
|
|
|
400
366
|
case _dtableUtils.CellType.TEXT:
|
|
401
367
|
case _dtableUtils.CellType.LONG_TEXT:
|
|
402
368
|
case _dtableUtils.CellType.GEOLOCATION:
|
|
369
|
+
case _dtableUtils.CellType.NUMBER:
|
|
403
370
|
case _dtableUtils.CellType.AUTO_NUMBER:
|
|
404
371
|
case _dtableUtils.CellType.DURATION:
|
|
405
372
|
case _dtableUtils.CellType.EMAIL:
|
|
@@ -409,15 +376,11 @@ class FilterItem extends _react.default.Component {
|
|
|
409
376
|
if (filter_predicate === _dtableUtils.FILTER_PREDICATE_TYPE.IS_CURRENT_USER_ID) {
|
|
410
377
|
return null;
|
|
411
378
|
}
|
|
412
|
-
return this.getInputComponent(
|
|
413
|
-
}
|
|
414
|
-
case _dtableUtils.CellType.NUMBER:
|
|
415
|
-
{
|
|
416
|
-
return this.getInputComponent(_constants.INPUT_CMP_TYPE_MAP.NUMBER);
|
|
379
|
+
return this.getInputComponent('text');
|
|
417
380
|
}
|
|
418
381
|
case _dtableUtils.CellType.CHECKBOX:
|
|
419
382
|
{
|
|
420
|
-
return this.getInputComponent(
|
|
383
|
+
return this.getInputComponent('checkbox');
|
|
421
384
|
}
|
|
422
385
|
case _dtableUtils.CellType.SINGLE_SELECT:
|
|
423
386
|
{
|
|
@@ -446,7 +409,7 @@ class FilterItem extends _react.default.Component {
|
|
|
446
409
|
};
|
|
447
410
|
}
|
|
448
411
|
let dataOptions = options.map(option => {
|
|
449
|
-
return
|
|
412
|
+
return _utils.FilterItemUtils.generatorSingleSelectOption(option);
|
|
450
413
|
});
|
|
451
414
|
return /*#__PURE__*/_react.default.createElement(_DTableCustomizeSelect.default, {
|
|
452
415
|
className: "selector-single-select",
|
|
@@ -456,8 +419,7 @@ class FilterItem extends _react.default.Component {
|
|
|
456
419
|
placeholder: (0, _lang.getLocale)('Select_an_option'),
|
|
457
420
|
searchable: true,
|
|
458
421
|
searchPlaceholder: (0, _lang.getLocale)('Search_option'),
|
|
459
|
-
noOptionsPlaceholder: (0, _lang.getLocale)('No_options_available')
|
|
460
|
-
isInModal: this.props.isInModal
|
|
422
|
+
noOptionsPlaceholder: (0, _lang.getLocale)('No_options_available')
|
|
461
423
|
});
|
|
462
424
|
}
|
|
463
425
|
case _dtableUtils.CellType.MULTIPLE_SELECT:
|
|
@@ -474,8 +436,7 @@ class FilterItem extends _react.default.Component {
|
|
|
474
436
|
value: filter_term || [],
|
|
475
437
|
userDepartmentIdsMap: userDepartmentIdsMap,
|
|
476
438
|
departments: departments,
|
|
477
|
-
onCommit: this.onSelectMultiple
|
|
478
|
-
isInModal: this.props.isInModal
|
|
439
|
+
onCommit: this.onSelectMultiple
|
|
479
440
|
});
|
|
480
441
|
}
|
|
481
442
|
return /*#__PURE__*/_react.default.createElement(_departmentSingleSelectFilter.default, {
|
|
@@ -483,8 +444,7 @@ class FilterItem extends _react.default.Component {
|
|
|
483
444
|
value: filter_term || '',
|
|
484
445
|
userDepartmentIdsMap: userDepartmentIdsMap,
|
|
485
446
|
departments: departments,
|
|
486
|
-
onCommit: this.onSelectSingle
|
|
487
|
-
isInModal: this.props.isInModal
|
|
447
|
+
onCommit: this.onSelectSingle
|
|
488
448
|
});
|
|
489
449
|
}
|
|
490
450
|
case _dtableUtils.CellType.COLLABORATOR:
|
|
@@ -497,8 +457,7 @@ class FilterItem extends _react.default.Component {
|
|
|
497
457
|
filterTerm: filter_term || [],
|
|
498
458
|
filter_predicate: filter_predicate,
|
|
499
459
|
collaborators: collaborators,
|
|
500
|
-
onSelectCollaborator: this.onSelectCollaborator
|
|
501
|
-
isInModal: this.props.isInModal
|
|
460
|
+
onSelectCollaborator: this.onSelectCollaborator
|
|
502
461
|
});
|
|
503
462
|
}
|
|
504
463
|
case _dtableUtils.CellType.CREATOR:
|
|
@@ -512,8 +471,7 @@ class FilterItem extends _react.default.Component {
|
|
|
512
471
|
filterIndex: index,
|
|
513
472
|
filterTerm: filter_term || [],
|
|
514
473
|
collaborators: creators,
|
|
515
|
-
onSelectCollaborator: this.onSelectCreator
|
|
516
|
-
isInModal: this.props.isInModal
|
|
474
|
+
onSelectCollaborator: this.onSelectCreator
|
|
517
475
|
});
|
|
518
476
|
}
|
|
519
477
|
case _dtableUtils.CellType.RATE:
|
|
@@ -566,19 +524,10 @@ class FilterItem extends _react.default.Component {
|
|
|
566
524
|
if (filterPredicate === _dtableUtils.FILTER_PREDICATE_TYPE.IS_CURRENT_USER_ID) {
|
|
567
525
|
return null;
|
|
568
526
|
}
|
|
569
|
-
if (result_type === _dtableUtils.FORMULA_RESULT_TYPE.NUMBER) {
|
|
570
|
-
const {
|
|
571
|
-
format
|
|
572
|
-
} = filterColumn.data || {};
|
|
573
|
-
if (format === _dtableUtils.CellType.DURATION) {
|
|
574
|
-
return this.getInputComponent(_constants.INPUT_CMP_TYPE_MAP.DURATION, filterColumn);
|
|
575
|
-
}
|
|
576
|
-
return this.getInputComponent(_constants.INPUT_CMP_TYPE_MAP.NUMBER, filterColumn);
|
|
577
|
-
}
|
|
578
527
|
if (result_type === _dtableUtils.FORMULA_RESULT_TYPE.ARRAY) {
|
|
579
528
|
return this.renderFilterTermByArrayType(filterPredicate, filterTerm, index, filterColumn);
|
|
580
529
|
}
|
|
581
|
-
return this.getInputComponent(
|
|
530
|
+
return this.getInputComponent('text');
|
|
582
531
|
};
|
|
583
532
|
this.renderLinkFilterTerm = (filterPredicate, filterTerm, index, filterColumn) => {
|
|
584
533
|
if (filterPredicate === _dtableUtils.FILTER_PREDICATE_TYPE.IS_CURRENT_USER_ID) {
|
|
@@ -615,8 +564,7 @@ class FilterItem extends _react.default.Component {
|
|
|
615
564
|
return /*#__PURE__*/_react.default.createElement(_departmentMultipleSelectFilter.default, {
|
|
616
565
|
value: filterTerm || [],
|
|
617
566
|
departments: departments,
|
|
618
|
-
onCommit: this.onSelectMultiple
|
|
619
|
-
isInModal: this.props.isInModal
|
|
567
|
+
onCommit: this.onSelectMultiple
|
|
620
568
|
});
|
|
621
569
|
}
|
|
622
570
|
if (_dtableUtils.DATE_COLUMN_OPTIONS.includes(array_type) || array_type === _dtableUtils.CellType.RATE || array_type === _dtableUtils.CellType.CHECKBOX) {
|
|
@@ -631,22 +579,12 @@ class FilterItem extends _react.default.Component {
|
|
|
631
579
|
filterTerm: filterTerm || [],
|
|
632
580
|
collaborators: collaborators,
|
|
633
581
|
onSelectCollaborator: this.onSelectCollaborator,
|
|
634
|
-
placeholder: (0, _lang.getLocale)('Add_collaborator')
|
|
635
|
-
isInModal: this.props.isInModal
|
|
582
|
+
placeholder: (0, _lang.getLocale)('Add_collaborator')
|
|
636
583
|
});
|
|
637
584
|
}
|
|
638
585
|
return this.getInputComponent('text');
|
|
639
586
|
};
|
|
640
|
-
this.isRenderErrorTips = () => {
|
|
641
|
-
const {
|
|
642
|
-
errMsg
|
|
643
|
-
} = this.props;
|
|
644
|
-
return errMsg && errMsg !== _dtableUtils.FILTER_ERR_MSG.INCOMPLETE_FILTER;
|
|
645
|
-
};
|
|
646
587
|
this.renderErrorMessage = () => {
|
|
647
|
-
if (!this.isRenderErrorTips()) {
|
|
648
|
-
return null;
|
|
649
|
-
}
|
|
650
588
|
return /*#__PURE__*/_react.default.createElement("div", {
|
|
651
589
|
className: "ml-2"
|
|
652
590
|
}, /*#__PURE__*/_react.default.createElement("span", {
|
|
@@ -664,7 +602,6 @@ class FilterItem extends _react.default.Component {
|
|
|
664
602
|
};
|
|
665
603
|
this.filterPredicateOptions = null;
|
|
666
604
|
this.filterTermModifierOptions = null;
|
|
667
|
-
this.filterToolTip = /*#__PURE__*/_react.default.createRef();
|
|
668
605
|
this.invalidFilterTip = /*#__PURE__*/_react.default.createRef();
|
|
669
606
|
this.initSelectOptions(_props);
|
|
670
607
|
}
|
|
@@ -692,31 +629,25 @@ class FilterItem extends _react.default.Component {
|
|
|
692
629
|
const {
|
|
693
630
|
filter,
|
|
694
631
|
filterColumn,
|
|
695
|
-
filterColumnOptions
|
|
632
|
+
filterColumnOptions,
|
|
633
|
+
errMsg
|
|
696
634
|
} = this.props;
|
|
697
635
|
const {
|
|
698
636
|
filter_predicate,
|
|
699
637
|
filter_term_modifier
|
|
700
638
|
} = filter;
|
|
701
|
-
const activeColumn =
|
|
702
|
-
const activePredicate =
|
|
639
|
+
const activeColumn = _utils.FilterItemUtils.generatorColumnOption(filterColumn);
|
|
640
|
+
const activePredicate = _utils.FilterItemUtils.generatorPredicateOption(filter_predicate);
|
|
703
641
|
let activeTermModifier = null;
|
|
704
642
|
let _isCheckboxColumn = false;
|
|
705
643
|
if ((0, _dtableUtils.isDateColumn)(filterColumn)) {
|
|
706
|
-
activeTermModifier =
|
|
707
|
-
} else if ((0,
|
|
644
|
+
activeTermModifier = _utils.FilterItemUtils.generatorTermModifierOption(filter_term_modifier);
|
|
645
|
+
} else if ((0, _utils.isCheckboxColumn)(filterColumn)) {
|
|
708
646
|
_isCheckboxColumn = true;
|
|
709
647
|
}
|
|
710
|
-
const {
|
|
711
|
-
type
|
|
712
|
-
} = filterColumn;
|
|
713
|
-
const computedColumnTypes = [_dtableUtils.CellType.FORMULA, _dtableUtils.CellType.LINK_FORMULA, _dtableUtils.CellType.LINK];
|
|
714
|
-
const isContainPredicate = [_dtableUtils.FILTER_PREDICATE_TYPE.CONTAINS, _dtableUtils.FILTER_PREDICATE_TYPE.NOT_CONTAIN].includes(filter_predicate);
|
|
715
|
-
const isRenderErrorTips = this.isRenderErrorTips();
|
|
716
|
-
const showToolTip = computedColumnTypes.includes(type) && isContainPredicate && !isRenderErrorTips;
|
|
717
648
|
|
|
718
649
|
// current predicate is not empty
|
|
719
|
-
const isNeedShowTermModifier = !
|
|
650
|
+
const isNeedShowTermModifier = !EMPTY_PREDICATE.includes(filter_predicate);
|
|
720
651
|
return /*#__PURE__*/_react.default.createElement("div", {
|
|
721
652
|
className: "filter-item"
|
|
722
653
|
}, /*#__PURE__*/_react.default.createElement("div", {
|
|
@@ -738,38 +669,22 @@ class FilterItem extends _react.default.Component {
|
|
|
738
669
|
onSelectOption: this.onSelectColumn,
|
|
739
670
|
searchable: true,
|
|
740
671
|
searchPlaceholder: (0, _lang.getLocale)('Search_column'),
|
|
741
|
-
noOptionsPlaceholder: (0, _lang.getLocale)('No_results')
|
|
742
|
-
isInModal: this.props.isInModal
|
|
672
|
+
noOptionsPlaceholder: (0, _lang.getLocale)('No_results')
|
|
743
673
|
})), /*#__PURE__*/_react.default.createElement("div", {
|
|
744
674
|
className: "filter-predicate ml-2 ".concat(_isCheckboxColumn ? 'filter-checkbox-predicate' : '')
|
|
745
675
|
}, /*#__PURE__*/_react.default.createElement(_DTableCustomizeSelect.default, {
|
|
746
676
|
value: activePredicate,
|
|
747
677
|
options: filterPredicateOptions,
|
|
748
|
-
onSelectOption: this.onSelectPredicate
|
|
749
|
-
isInModal: this.props.isInModal
|
|
678
|
+
onSelectOption: this.onSelectPredicate
|
|
750
679
|
})), (0, _dtableUtils.isDateColumn)(filterColumn) && isNeedShowTermModifier && /*#__PURE__*/_react.default.createElement("div", {
|
|
751
680
|
className: "filter-term-modifier ml-2"
|
|
752
681
|
}, /*#__PURE__*/_react.default.createElement(_DTableCustomizeSelect.default, {
|
|
753
682
|
value: activeTermModifier,
|
|
754
683
|
options: filterTermModifierOptions,
|
|
755
|
-
onSelectOption: this.onSelectTermModifier
|
|
756
|
-
isInModal: this.props.isInModal
|
|
684
|
+
onSelectOption: this.onSelectTermModifier
|
|
757
685
|
})), /*#__PURE__*/_react.default.createElement("div", {
|
|
758
686
|
className: "filter-term ml-2"
|
|
759
|
-
}, this.renderFilterTerm(filterColumn)),
|
|
760
|
-
className: "ml-2"
|
|
761
|
-
}, /*#__PURE__*/_react.default.createElement("span", {
|
|
762
|
-
ref: this.filterToolTip,
|
|
763
|
-
id: "filter_tool_tip",
|
|
764
|
-
"aria-hidden": "true",
|
|
765
|
-
className: "dtable-font dtable-icon-exclamation-triangle",
|
|
766
|
-
style: {
|
|
767
|
-
color: '#FFC92C'
|
|
768
|
-
}
|
|
769
|
-
}), /*#__PURE__*/_react.default.createElement(_reactstrap.UncontrolledTooltip, {
|
|
770
|
-
placement: "bottom",
|
|
771
|
-
target: this.filterToolTip
|
|
772
|
-
}, (0, _lang.getLocale)('filter_tip_message'))), this.renderErrorMessage())));
|
|
687
|
+
}, this.renderFilterTerm(filterColumn)), errMsg && this.renderErrorMessage())));
|
|
773
688
|
}
|
|
774
689
|
}
|
|
775
690
|
var _default = exports.default = FilterItem;
|