dtable-ui-component 6.0.38-alpha.2 → 6.0.39-al31
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/CheckboxEditor/index.css +7 -6
- package/lib/DTableFiltersPopover/constants/index.js +2 -30
- package/lib/DTableFiltersPopover/index.css +14 -50
- 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 -20
- package/lib/DTableFiltersPopover/widgets/filter-calendar.js +24 -7
- package/lib/DTableFiltersPopover/widgets/filter-item.js +55 -138
- package/lib/DTableFiltersPopover/widgets/filter-list/index.css +10 -119
- package/lib/DTableFiltersPopover/widgets/filter-list/index.js +39 -226
- package/lib/DateEditor/mb-editor/index.js +3 -2
- package/lib/DateEditor/pc-editor.js +2 -1
- package/lib/DateFormatter/index.js +2 -2
- package/lib/GeolocationEditor/mb-editor/map-editor/index.css +5 -2
- package/lib/GeolocationEditor/mb-editor/map-editor/index.js +96 -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/InputItem/custom-input.js +3 -1
- 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/lib/utils/dateFormat.js +238 -0
- package/package.json +3 -3
- 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,32 +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 &&
|
|
88
|
-
target: selectorRef.current,
|
|
86
|
+
})), isShowSelector && /*#__PURE__*/_react.default.createElement(_DepartmentSingleSelectEditor.default, {
|
|
89
87
|
enableSelectRange: false,
|
|
90
|
-
isInModal: isInModal,
|
|
91
88
|
column: column,
|
|
92
89
|
value: value,
|
|
93
90
|
onCommit: onCommit,
|
|
94
91
|
userDepartmentIdsMap: userDepartmentIdsMap,
|
|
95
92
|
departments: departments,
|
|
96
93
|
renderUserDepartmentOptions: renderUserDepartmentOptions
|
|
97
|
-
})
|
|
98
|
-
target: selectorRef.current,
|
|
99
|
-
enableSelectRange: false,
|
|
100
|
-
isInModal: isInModal,
|
|
101
|
-
column: column,
|
|
102
|
-
value: value,
|
|
103
|
-
position: selectorRef.current.getBoundingClientRect(),
|
|
104
|
-
onCommit: onCommit,
|
|
105
|
-
userDepartmentIdsMap: userDepartmentIdsMap,
|
|
106
|
-
departments: departments,
|
|
107
|
-
renderUserDepartmentOptions: renderUserDepartmentOptions
|
|
108
|
-
})));
|
|
94
|
+
}));
|
|
109
95
|
}
|
|
110
96
|
var _default = exports.default = DepartmentSingleSelectFilter;
|
|
@@ -14,6 +14,7 @@ var _seafileCalendar = _interopRequireDefault(require("@seafile/seafile-calendar
|
|
|
14
14
|
var _Picker = _interopRequireDefault(require("@seafile/seafile-calendar/lib/Picker"));
|
|
15
15
|
var _lang = require("../../lang");
|
|
16
16
|
var _columnUtils = require("../../utils/column-utils");
|
|
17
|
+
var _dateFormat = require("../../utils/dateFormat.js");
|
|
17
18
|
require("@seafile/seafile-calendar/assets/index.css");
|
|
18
19
|
let now = (0, _dayjs.default)();
|
|
19
20
|
class FilterCalendar extends _react.Component {
|
|
@@ -26,12 +27,18 @@ class FilterCalendar extends _react.Component {
|
|
|
26
27
|
const {
|
|
27
28
|
onChange
|
|
28
29
|
} = this.props;
|
|
29
|
-
const searchFormat =
|
|
30
|
+
const searchFormat = this.columnDataFormat;
|
|
30
31
|
this.setState({
|
|
31
32
|
value
|
|
32
33
|
}, () => {
|
|
33
34
|
if (this.state.value) {
|
|
34
|
-
|
|
35
|
+
console.log('value', this.state.value);
|
|
36
|
+
const filterStr = this.state.value.format(this.getCalendarFormat()[0]);
|
|
37
|
+
if (typeof filterStr === 'string') {
|
|
38
|
+
const changeVal = (0, _dateFormat.filterChangeValue)(filterStr, searchFormat);
|
|
39
|
+
console.log('changeVal', changeVal);
|
|
40
|
+
onChange(changeVal);
|
|
41
|
+
}
|
|
35
42
|
}
|
|
36
43
|
});
|
|
37
44
|
};
|
|
@@ -85,6 +92,9 @@ class FilterCalendar extends _react.Component {
|
|
|
85
92
|
this.columnDataFormat = DataFormat.split(' ')[0];
|
|
86
93
|
this.calendarContainerRef = /*#__PURE__*/_react.default.createRef();
|
|
87
94
|
this.defaultCalendarValue = null;
|
|
95
|
+
this.formatDay = this.props.value ? (0, _dateFormat.getDay)(this.props.value, this.getCalendarFormat()[0]) : null;
|
|
96
|
+
this.formatMonth = this.props.value ? (0, _dateFormat.getMonth)(this.props.value, this.getCalendarFormat()[0]) : null;
|
|
97
|
+
this.formatYear = this.props.value ? (0, _dateFormat.getYear)(this.props.value, this.getCalendarFormat()[0]) : null;
|
|
88
98
|
}
|
|
89
99
|
componentDidMount() {
|
|
90
100
|
const {
|
|
@@ -92,6 +102,9 @@ class FilterCalendar extends _react.Component {
|
|
|
92
102
|
lang
|
|
93
103
|
} = this.props;
|
|
94
104
|
const iszhcn = lang === 'zh-cn';
|
|
105
|
+
console.log('formatDay', this.formatDay);
|
|
106
|
+
console.log('formatMonth', this.formatMonth);
|
|
107
|
+
console.log('formatYear', this.formatYear);
|
|
95
108
|
if (iszhcn) {
|
|
96
109
|
now = now.locale('zh-cn');
|
|
97
110
|
} else {
|
|
@@ -101,7 +114,7 @@ class FilterCalendar extends _react.Component {
|
|
|
101
114
|
if (value && (0, _dayjs.default)(value).isValid()) {
|
|
102
115
|
let validValue = (0, _dayjs.default)(value).isValid() ? (0, _dayjs.default)(value) : (0, _dayjs.default)(this.defaultCalendarValue);
|
|
103
116
|
this.setState({
|
|
104
|
-
value: iszhcn ? (0, _dayjs.default)(validValue).locale('zh-cn') : (0, _dayjs.default)(validValue).locale('en-gb')
|
|
117
|
+
value: iszhcn ? (0, _dayjs.default)(validValue).year(this.formatYear).month(this.formatMonth).date(this.formatDay).locale('zh-cn') : (0, _dayjs.default)(validValue).year(this.formatYear).month(this.formatMonth).date(this.formatDay).locale('en-gb')
|
|
105
118
|
});
|
|
106
119
|
}
|
|
107
120
|
}
|
|
@@ -111,12 +124,16 @@ class FilterCalendar extends _react.Component {
|
|
|
111
124
|
firstDayOfWeek
|
|
112
125
|
} = this.props;
|
|
113
126
|
const state = this.state;
|
|
127
|
+
const calendarFormat = this.getCalendarFormat();
|
|
128
|
+
const inputStr = state.value ? state.value.format(this.columnDataFormat) : '';
|
|
129
|
+
const displayContentValue = (0, _dateFormat.renderFilterInputFormat)(inputStr, calendarFormat[0], (0, _dateFormat.delimate)(calendarFormat[0]));
|
|
114
130
|
if (isReadOnly) return /*#__PURE__*/_react.default.createElement("input", {
|
|
115
131
|
className: "ant-calendar-picker-input ant-input form-control",
|
|
116
|
-
value:
|
|
132
|
+
value: displayContentValue,
|
|
117
133
|
disabled: true
|
|
118
134
|
});
|
|
119
|
-
const
|
|
135
|
+
const calendarFormat1 = ['YYYY-MM-DD'];
|
|
136
|
+
console.log('calendarFormat', calendarFormat, displayContentValue);
|
|
120
137
|
const clearStyle = {
|
|
121
138
|
position: 'absolute',
|
|
122
139
|
top: '15px',
|
|
@@ -134,7 +151,7 @@ class FilterCalendar extends _react.Component {
|
|
|
134
151
|
style: {
|
|
135
152
|
zIndex: 1001
|
|
136
153
|
},
|
|
137
|
-
format:
|
|
154
|
+
format: calendarFormat1,
|
|
138
155
|
defaultValue: this.defaultCalendarValue,
|
|
139
156
|
showDateInput: true,
|
|
140
157
|
focusablePanel: false,
|
|
@@ -165,7 +182,7 @@ class FilterCalendar extends _react.Component {
|
|
|
165
182
|
tabIndex: "-1",
|
|
166
183
|
readOnly: true,
|
|
167
184
|
className: "ant-calendar-picker-input ant-input form-control",
|
|
168
|
-
value:
|
|
185
|
+
value: displayContentValue,
|
|
169
186
|
onMouseDown: this.handleMouseDown
|
|
170
187
|
}), /*#__PURE__*/_react.default.createElement("div", {
|
|
171
188
|
ref: this.calendarContainerRef
|
|
@@ -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
|
|
|
@@ -384,6 +350,8 @@ class FilterItem extends _react.default.Component {
|
|
|
384
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];
|
|
385
351
|
if (inputRangeLabel.indexOf(filter_term_modifier) > -1) {
|
|
386
352
|
if (filter_term_modifier === 'exact_date') {
|
|
353
|
+
console.log('filterTerm', this.state.filterTerm);
|
|
354
|
+
console.log('filterColumn', filterColumn);
|
|
387
355
|
return /*#__PURE__*/_react.default.createElement(_filterCalendar.default, {
|
|
388
356
|
lang: lang,
|
|
389
357
|
value: this.state.filterTerm,
|
|
@@ -400,6 +368,7 @@ class FilterItem extends _react.default.Component {
|
|
|
400
368
|
case _dtableUtils.CellType.TEXT:
|
|
401
369
|
case _dtableUtils.CellType.LONG_TEXT:
|
|
402
370
|
case _dtableUtils.CellType.GEOLOCATION:
|
|
371
|
+
case _dtableUtils.CellType.NUMBER:
|
|
403
372
|
case _dtableUtils.CellType.AUTO_NUMBER:
|
|
404
373
|
case _dtableUtils.CellType.DURATION:
|
|
405
374
|
case _dtableUtils.CellType.EMAIL:
|
|
@@ -409,15 +378,11 @@ class FilterItem extends _react.default.Component {
|
|
|
409
378
|
if (filter_predicate === _dtableUtils.FILTER_PREDICATE_TYPE.IS_CURRENT_USER_ID) {
|
|
410
379
|
return null;
|
|
411
380
|
}
|
|
412
|
-
return this.getInputComponent(
|
|
413
|
-
}
|
|
414
|
-
case _dtableUtils.CellType.NUMBER:
|
|
415
|
-
{
|
|
416
|
-
return this.getInputComponent(_constants.INPUT_CMP_TYPE_MAP.NUMBER);
|
|
381
|
+
return this.getInputComponent('text');
|
|
417
382
|
}
|
|
418
383
|
case _dtableUtils.CellType.CHECKBOX:
|
|
419
384
|
{
|
|
420
|
-
return this.getInputComponent(
|
|
385
|
+
return this.getInputComponent('checkbox');
|
|
421
386
|
}
|
|
422
387
|
case _dtableUtils.CellType.SINGLE_SELECT:
|
|
423
388
|
{
|
|
@@ -446,7 +411,7 @@ class FilterItem extends _react.default.Component {
|
|
|
446
411
|
};
|
|
447
412
|
}
|
|
448
413
|
let dataOptions = options.map(option => {
|
|
449
|
-
return
|
|
414
|
+
return _utils.FilterItemUtils.generatorSingleSelectOption(option);
|
|
450
415
|
});
|
|
451
416
|
return /*#__PURE__*/_react.default.createElement(_DTableCustomizeSelect.default, {
|
|
452
417
|
className: "selector-single-select",
|
|
@@ -456,8 +421,7 @@ class FilterItem extends _react.default.Component {
|
|
|
456
421
|
placeholder: (0, _lang.getLocale)('Select_an_option'),
|
|
457
422
|
searchable: true,
|
|
458
423
|
searchPlaceholder: (0, _lang.getLocale)('Search_option'),
|
|
459
|
-
noOptionsPlaceholder: (0, _lang.getLocale)('No_options_available')
|
|
460
|
-
isInModal: this.props.isInModal
|
|
424
|
+
noOptionsPlaceholder: (0, _lang.getLocale)('No_options_available')
|
|
461
425
|
});
|
|
462
426
|
}
|
|
463
427
|
case _dtableUtils.CellType.MULTIPLE_SELECT:
|
|
@@ -474,8 +438,7 @@ class FilterItem extends _react.default.Component {
|
|
|
474
438
|
value: filter_term || [],
|
|
475
439
|
userDepartmentIdsMap: userDepartmentIdsMap,
|
|
476
440
|
departments: departments,
|
|
477
|
-
onCommit: this.onSelectMultiple
|
|
478
|
-
isInModal: this.props.isInModal
|
|
441
|
+
onCommit: this.onSelectMultiple
|
|
479
442
|
});
|
|
480
443
|
}
|
|
481
444
|
return /*#__PURE__*/_react.default.createElement(_departmentSingleSelectFilter.default, {
|
|
@@ -483,8 +446,7 @@ class FilterItem extends _react.default.Component {
|
|
|
483
446
|
value: filter_term || '',
|
|
484
447
|
userDepartmentIdsMap: userDepartmentIdsMap,
|
|
485
448
|
departments: departments,
|
|
486
|
-
onCommit: this.onSelectSingle
|
|
487
|
-
isInModal: this.props.isInModal
|
|
449
|
+
onCommit: this.onSelectSingle
|
|
488
450
|
});
|
|
489
451
|
}
|
|
490
452
|
case _dtableUtils.CellType.COLLABORATOR:
|
|
@@ -497,8 +459,7 @@ class FilterItem extends _react.default.Component {
|
|
|
497
459
|
filterTerm: filter_term || [],
|
|
498
460
|
filter_predicate: filter_predicate,
|
|
499
461
|
collaborators: collaborators,
|
|
500
|
-
onSelectCollaborator: this.onSelectCollaborator
|
|
501
|
-
isInModal: this.props.isInModal
|
|
462
|
+
onSelectCollaborator: this.onSelectCollaborator
|
|
502
463
|
});
|
|
503
464
|
}
|
|
504
465
|
case _dtableUtils.CellType.CREATOR:
|
|
@@ -512,8 +473,7 @@ class FilterItem extends _react.default.Component {
|
|
|
512
473
|
filterIndex: index,
|
|
513
474
|
filterTerm: filter_term || [],
|
|
514
475
|
collaborators: creators,
|
|
515
|
-
onSelectCollaborator: this.onSelectCreator
|
|
516
|
-
isInModal: this.props.isInModal
|
|
476
|
+
onSelectCollaborator: this.onSelectCreator
|
|
517
477
|
});
|
|
518
478
|
}
|
|
519
479
|
case _dtableUtils.CellType.RATE:
|
|
@@ -566,19 +526,10 @@ class FilterItem extends _react.default.Component {
|
|
|
566
526
|
if (filterPredicate === _dtableUtils.FILTER_PREDICATE_TYPE.IS_CURRENT_USER_ID) {
|
|
567
527
|
return null;
|
|
568
528
|
}
|
|
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
529
|
if (result_type === _dtableUtils.FORMULA_RESULT_TYPE.ARRAY) {
|
|
579
530
|
return this.renderFilterTermByArrayType(filterPredicate, filterTerm, index, filterColumn);
|
|
580
531
|
}
|
|
581
|
-
return this.getInputComponent(
|
|
532
|
+
return this.getInputComponent('text');
|
|
582
533
|
};
|
|
583
534
|
this.renderLinkFilterTerm = (filterPredicate, filterTerm, index, filterColumn) => {
|
|
584
535
|
if (filterPredicate === _dtableUtils.FILTER_PREDICATE_TYPE.IS_CURRENT_USER_ID) {
|
|
@@ -615,8 +566,7 @@ class FilterItem extends _react.default.Component {
|
|
|
615
566
|
return /*#__PURE__*/_react.default.createElement(_departmentMultipleSelectFilter.default, {
|
|
616
567
|
value: filterTerm || [],
|
|
617
568
|
departments: departments,
|
|
618
|
-
onCommit: this.onSelectMultiple
|
|
619
|
-
isInModal: this.props.isInModal
|
|
569
|
+
onCommit: this.onSelectMultiple
|
|
620
570
|
});
|
|
621
571
|
}
|
|
622
572
|
if (_dtableUtils.DATE_COLUMN_OPTIONS.includes(array_type) || array_type === _dtableUtils.CellType.RATE || array_type === _dtableUtils.CellType.CHECKBOX) {
|
|
@@ -631,22 +581,12 @@ class FilterItem extends _react.default.Component {
|
|
|
631
581
|
filterTerm: filterTerm || [],
|
|
632
582
|
collaborators: collaborators,
|
|
633
583
|
onSelectCollaborator: this.onSelectCollaborator,
|
|
634
|
-
placeholder: (0, _lang.getLocale)('Add_collaborator')
|
|
635
|
-
isInModal: this.props.isInModal
|
|
584
|
+
placeholder: (0, _lang.getLocale)('Add_collaborator')
|
|
636
585
|
});
|
|
637
586
|
}
|
|
638
587
|
return this.getInputComponent('text');
|
|
639
588
|
};
|
|
640
|
-
this.isRenderErrorTips = () => {
|
|
641
|
-
const {
|
|
642
|
-
errMsg
|
|
643
|
-
} = this.props;
|
|
644
|
-
return errMsg && errMsg !== _dtableUtils.FILTER_ERR_MSG.INCOMPLETE_FILTER;
|
|
645
|
-
};
|
|
646
589
|
this.renderErrorMessage = () => {
|
|
647
|
-
if (!this.isRenderErrorTips()) {
|
|
648
|
-
return null;
|
|
649
|
-
}
|
|
650
590
|
return /*#__PURE__*/_react.default.createElement("div", {
|
|
651
591
|
className: "ml-2"
|
|
652
592
|
}, /*#__PURE__*/_react.default.createElement("span", {
|
|
@@ -664,7 +604,6 @@ class FilterItem extends _react.default.Component {
|
|
|
664
604
|
};
|
|
665
605
|
this.filterPredicateOptions = null;
|
|
666
606
|
this.filterTermModifierOptions = null;
|
|
667
|
-
this.filterToolTip = /*#__PURE__*/_react.default.createRef();
|
|
668
607
|
this.invalidFilterTip = /*#__PURE__*/_react.default.createRef();
|
|
669
608
|
this.initSelectOptions(_props);
|
|
670
609
|
}
|
|
@@ -692,31 +631,25 @@ class FilterItem extends _react.default.Component {
|
|
|
692
631
|
const {
|
|
693
632
|
filter,
|
|
694
633
|
filterColumn,
|
|
695
|
-
filterColumnOptions
|
|
634
|
+
filterColumnOptions,
|
|
635
|
+
errMsg
|
|
696
636
|
} = this.props;
|
|
697
637
|
const {
|
|
698
638
|
filter_predicate,
|
|
699
639
|
filter_term_modifier
|
|
700
640
|
} = filter;
|
|
701
|
-
const activeColumn =
|
|
702
|
-
const activePredicate =
|
|
641
|
+
const activeColumn = _utils.FilterItemUtils.generatorColumnOption(filterColumn);
|
|
642
|
+
const activePredicate = _utils.FilterItemUtils.generatorPredicateOption(filter_predicate);
|
|
703
643
|
let activeTermModifier = null;
|
|
704
644
|
let _isCheckboxColumn = false;
|
|
705
645
|
if ((0, _dtableUtils.isDateColumn)(filterColumn)) {
|
|
706
|
-
activeTermModifier =
|
|
707
|
-
} else if ((0,
|
|
646
|
+
activeTermModifier = _utils.FilterItemUtils.generatorTermModifierOption(filter_term_modifier);
|
|
647
|
+
} else if ((0, _utils.isCheckboxColumn)(filterColumn)) {
|
|
708
648
|
_isCheckboxColumn = true;
|
|
709
649
|
}
|
|
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
650
|
|
|
718
651
|
// current predicate is not empty
|
|
719
|
-
const isNeedShowTermModifier = !
|
|
652
|
+
const isNeedShowTermModifier = !EMPTY_PREDICATE.includes(filter_predicate);
|
|
720
653
|
return /*#__PURE__*/_react.default.createElement("div", {
|
|
721
654
|
className: "filter-item"
|
|
722
655
|
}, /*#__PURE__*/_react.default.createElement("div", {
|
|
@@ -738,38 +671,22 @@ class FilterItem extends _react.default.Component {
|
|
|
738
671
|
onSelectOption: this.onSelectColumn,
|
|
739
672
|
searchable: true,
|
|
740
673
|
searchPlaceholder: (0, _lang.getLocale)('Search_column'),
|
|
741
|
-
noOptionsPlaceholder: (0, _lang.getLocale)('No_results')
|
|
742
|
-
isInModal: this.props.isInModal
|
|
674
|
+
noOptionsPlaceholder: (0, _lang.getLocale)('No_results')
|
|
743
675
|
})), /*#__PURE__*/_react.default.createElement("div", {
|
|
744
676
|
className: "filter-predicate ml-2 ".concat(_isCheckboxColumn ? 'filter-checkbox-predicate' : '')
|
|
745
677
|
}, /*#__PURE__*/_react.default.createElement(_DTableCustomizeSelect.default, {
|
|
746
678
|
value: activePredicate,
|
|
747
679
|
options: filterPredicateOptions,
|
|
748
|
-
onSelectOption: this.onSelectPredicate
|
|
749
|
-
isInModal: this.props.isInModal
|
|
680
|
+
onSelectOption: this.onSelectPredicate
|
|
750
681
|
})), (0, _dtableUtils.isDateColumn)(filterColumn) && isNeedShowTermModifier && /*#__PURE__*/_react.default.createElement("div", {
|
|
751
682
|
className: "filter-term-modifier ml-2"
|
|
752
683
|
}, /*#__PURE__*/_react.default.createElement(_DTableCustomizeSelect.default, {
|
|
753
684
|
value: activeTermModifier,
|
|
754
685
|
options: filterTermModifierOptions,
|
|
755
|
-
onSelectOption: this.onSelectTermModifier
|
|
756
|
-
isInModal: this.props.isInModal
|
|
686
|
+
onSelectOption: this.onSelectTermModifier
|
|
757
687
|
})), /*#__PURE__*/_react.default.createElement("div", {
|
|
758
688
|
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())));
|
|
689
|
+
}, this.renderFilterTerm(filterColumn)), errMsg && this.renderErrorMessage())));
|
|
773
690
|
}
|
|
774
691
|
}
|
|
775
692
|
var _default = exports.default = FilterItem;
|