dtable-ui-component 4.4.4 → 4.4.6
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 +14 -7
- package/lib/ButtonFormatter/index.js +16 -9
- package/lib/CTimeFormatter/index.js +16 -9
- package/lib/CheckboxEditor/index.js +15 -8
- package/lib/CheckboxFormatter/index.js +15 -8
- package/lib/CollaboratorEditor/index.js +29 -21
- package/lib/CollaboratorEditor/mb-collaborator-editor-popover/index.js +32 -25
- package/lib/CollaboratorEditor/pc-collaborator-editor-popover/index.js +25 -18
- package/lib/CollaboratorFormatter/index.js +19 -12
- package/lib/CollaboratorItem/index.js +17 -10
- package/lib/CreatorFormatter/index.js +19 -12
- package/lib/DTableCommonAddTool/index.js +13 -6
- package/lib/DTableCustomizeCollaboratorSelect/index.js +26 -18
- package/lib/DTableCustomizeSelect/index.js +23 -15
- package/lib/DTableFiltersPopover/constants/index.js +38 -33
- package/lib/DTableFiltersPopover/index.js +38 -31
- package/lib/DTableFiltersPopover/utils/filter-item-utils.js +53 -46
- package/lib/DTableFiltersPopover/utils/index.js +128 -99
- package/lib/DTableFiltersPopover/widgets/collaborator-filter/index.js +34 -26
- package/lib/DTableFiltersPopover/widgets/department-select-filter/department-multiple-select-filter.js +33 -25
- package/lib/DTableFiltersPopover/widgets/department-select-filter/department-single-select-filter.js +34 -26
- package/lib/DTableFiltersPopover/widgets/filter-calendar.js +34 -26
- package/lib/DTableFiltersPopover/widgets/filter-item.js +128 -120
- package/lib/DTableFiltersPopover/widgets/filter-list/index.js +26 -18
- package/lib/DTableFiltersPopover/widgets/rate-item.js +15 -8
- package/lib/DTablePopover/index.js +15 -8
- package/lib/DTablePopover/utils.js +9 -2
- package/lib/DTableRadio/index.js +17 -10
- package/lib/DTableSearchInput/index.js +21 -13
- package/lib/DTableSearchInput/utils.js +9 -2
- package/lib/DTableSelect/dtable-select-label.js +13 -6
- package/lib/DTableSelect/index.js +18 -10
- package/lib/DTableSelect/utils.js +20 -10
- package/lib/DTableSwitch/index.js +14 -7
- package/lib/DateEditor/index.js +30 -22
- package/lib/DateEditor/mb-date-editor-popover/index.js +55 -47
- package/lib/DateEditor/pc-date-editor-popover.js +27 -20
- package/lib/DateFormatter/index.js +16 -9
- package/lib/Department-editor/constants.js +7 -1
- package/lib/Department-editor/department-multiple-select/index.js +32 -24
- package/lib/Department-editor/department-single-select.js +41 -33
- package/lib/Department-editor/index.js +22 -14
- package/lib/Department-editor/selected-departments/index.js +32 -25
- package/lib/Department-editor/utils.js +11 -3
- package/lib/DepartmentSingleSelectFormatter/index.js +16 -9
- package/lib/DigitalSignFormatter/index.js +23 -15
- package/lib/DigitalSignFormatter/utils.js +11 -3
- package/lib/DurationFormatter/index.js +16 -9
- package/lib/EditEditorButton/index.js +12 -5
- package/lib/EmailFormatter/index.js +14 -7
- package/lib/FieldDisplaySetting/field-item.js +21 -14
- package/lib/FieldDisplaySetting/index.js +27 -19
- package/lib/FileEditor/index.js +15 -8
- package/lib/FileEditor/pc-files-addition/index.js +1 -0
- package/lib/FileEditor/pc-files-addition/pc-file-uploaded-item.js +1 -0
- package/lib/FileEditor/pc-files-preview/index.js +1 -0
- package/lib/FileEditor/pc-files-preview/pc-file-item-preview.js +1 -0
- package/lib/FileFormatter/index.js +19 -11
- package/lib/FileItemFormatter/index.js +14 -6
- package/lib/FileItemFormatter/utils.js +9 -2
- package/lib/FileUploader/index.js +11 -4
- package/lib/FormulaFormatter/cell-value-validator.js +24 -18
- package/lib/FormulaFormatter/index.js +39 -32
- package/lib/FormulaFormatter/utils.js +29 -13
- package/lib/GeolocationFormatter/index.js +16 -9
- package/lib/HtmlLongTextFormatter/index.js +17 -9
- package/lib/ImageFormatter/images-lazy-load.js +16 -9
- package/lib/ImageFormatter/index.js +24 -16
- package/lib/ImageFormatter/utils.js +9 -2
- package/lib/ImagePreviewerLightbox/index.js +19 -12
- package/lib/ImagePreviewerLightbox/utils.js +11 -3
- package/lib/LastModifierFormatter/index.js +19 -12
- package/lib/LinkEditor/index.js +33 -25
- package/lib/LinkEditor/link-editor-option.js +15 -8
- package/lib/LinkEditor/mb-link-editor-popover/index.js +30 -23
- package/lib/LinkEditor/pc-link-editor-popover/index.js +24 -17
- package/lib/LinkFormatter/index.js +20 -13
- package/lib/Loading/index.js +11 -4
- package/lib/LongTextFormatter/index.js +13 -6
- package/lib/MBEditorHeader/index.js +14 -7
- package/lib/MTimeFormatter/index.js +16 -9
- package/lib/ModalPortal/index.js +12 -5
- package/lib/MultipleSelectEditor/index.js +25 -17
- package/lib/MultipleSelectFormatter/index.js +17 -10
- package/lib/NotificationPopover/index.js +24 -16
- package/lib/NumberEditor/index.js +25 -18
- package/lib/NumberFormatter/index.js +16 -9
- package/lib/RateFormatter/index.js +15 -8
- package/lib/RoleStatusEditor/index.js +22 -14
- package/lib/RowExpandEmailFormatter/index.js +17 -10
- package/lib/RowExpandFileFormatter/index.js +16 -8
- package/lib/RowExpandFileFormatter/row-expand-file-item-formatter.js +27 -18
- package/lib/RowExpandFormatter/index.js +86 -78
- package/lib/RowExpandFormulaFormatter/index.js +42 -34
- package/lib/RowExpandImageFormatter/index.js +19 -10
- package/lib/RowExpandImageFormatter/row-expand-image-item-formatter.js +27 -18
- package/lib/RowExpandImageFormatter/utils.js +9 -2
- package/lib/RowExpandLinkFormatter/collaborator-item-formatter.js +16 -7
- package/lib/RowExpandLinkFormatter/index.js +46 -37
- package/lib/RowExpandLinkFormatter/utils.js +17 -6
- package/lib/RowExpandLinkFormatter/value-display-utils.js +12 -5
- package/lib/RowExpandRateFormatter/index.js +15 -8
- package/lib/RowExpandUrlFormatter/index.js +21 -14
- package/lib/SelectItem/index.js +12 -4
- package/lib/SelectOptionGroup/KeyCodes.js +7 -1
- package/lib/SelectOptionGroup/index.js +28 -20
- package/lib/SelectOptionGroup/option.js +11 -4
- package/lib/SimpleLongTextFormatter/index.js +27 -20
- package/lib/SimpleLongTextFormatter/normalize-long-text-value.js +7 -1
- package/lib/SimpleLongTextFormatter/widgets/LongTextPreview.js +15 -8
- package/lib/SimpleLongTextFormatter/widgets/dtable-markdown-viewer.js +14 -7
- package/lib/SingleSelectEditor/index.js +26 -18
- package/lib/SingleSelectFormatter/index.js +16 -9
- package/lib/TextEditor/index.js +14 -7
- package/lib/TextFormatter/index.js +14 -7
- package/lib/UrlFormatter/index.js +14 -7
- package/lib/cellFormatterFactory/index.js +11 -4
- package/lib/common/ClickOutside.js +12 -4
- package/lib/common/delete-tip.js +20 -12
- package/lib/common/modal-portal.js +13 -5
- package/lib/constants/index.js +28 -9
- package/lib/css/mb-cell-editor.css +1 -1
- package/lib/data/dtable-value.js +11 -6
- package/lib/formatterConfig/base-formatter-config.js +53 -46
- package/lib/formatterConfig/index.js +16 -9
- package/lib/hooks/common-hooks.js +11 -4
- package/lib/index.js +432 -75
- package/lib/lang/index.js +24 -13
- package/lib/locals/de.js +7 -1
- package/lib/locals/en.js +7 -1
- package/lib/locals/fr.js +7 -1
- package/lib/locals/zh-CN.js +7 -1
- package/lib/select-editor/index.js +27 -4
- package/lib/select-editor/mb-select-editor-popover/index.js +41 -33
- package/lib/select-editor/pc-select-editor-popover/index.js +26 -19
- package/lib/select-editor/select-editor-option.js +15 -8
- package/lib/toaster/alert.js +18 -11
- package/lib/toaster/index.js +10 -3
- package/lib/toaster/toast.js +16 -8
- package/lib/toaster/toastManager.js +13 -5
- package/lib/toaster/toaster.js +15 -7
- package/lib/utils/dayjs.js +11 -4
- package/lib/utils/editor-utils.js +15 -5
- package/lib/utils/event-bus.js +7 -1
- package/lib/utils/utils.js +17 -6
- package/package.json +80 -68
|
@@ -1,29 +1,42 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault").default;
|
|
4
|
+
Object.defineProperty(exports, "__esModule", {
|
|
5
|
+
value: true
|
|
6
|
+
});
|
|
7
|
+
Object.defineProperty(exports, "FilterItemUtils", {
|
|
8
|
+
enumerable: true,
|
|
9
|
+
get: function () {
|
|
10
|
+
return _filterItemUtils.default;
|
|
11
|
+
}
|
|
12
|
+
});
|
|
13
|
+
exports.isFilterTermArray = exports.isCheckboxColumn = exports.getUpdatedFilterByTermModifier = exports.getUpdatedFilterBySpecialTerm = exports.getUpdatedFilterBySelectSingle = exports.getUpdatedFilterBySelectMultiple = exports.getUpdatedFilterByRate = exports.getUpdatedFilterByPredicate = exports.getUpdatedFilterByNormalTerm = exports.getUpdatedFilterByCreator = exports.getUpdatedFilterByColumn = exports.getUpdatedFilterByCollaborator = exports.getFormulaColumnFilter = exports.getFilterByColumn = exports.getDateColumnFormat = exports.getColumnOptions = exports.getColumnByKey = exports.generateDefaultUser = void 0;
|
|
14
|
+
var _dtableUtils = require("dtable-utils");
|
|
15
|
+
var _filterItemUtils = _interopRequireDefault(require("./filter-item-utils"));
|
|
16
|
+
var _constants = require("../constants");
|
|
4
17
|
const isArrayFilterTermByArrayType = array_type => {
|
|
5
|
-
return COLLABORATOR_COLUMN_TYPES.includes(array_type) || array_type === CellType.SINGLE_SELECT || array_type === CellType.MULTIPLE_SELECT;
|
|
18
|
+
return _dtableUtils.COLLABORATOR_COLUMN_TYPES.includes(array_type) || array_type === _dtableUtils.CellType.SINGLE_SELECT || array_type === _dtableUtils.CellType.MULTIPLE_SELECT;
|
|
6
19
|
};
|
|
7
|
-
|
|
20
|
+
const isFilterTermArray = (column, filterPredicate) => {
|
|
8
21
|
const {
|
|
9
22
|
type,
|
|
10
23
|
data
|
|
11
24
|
} = column;
|
|
12
|
-
if (MULTIPLE_SELECTOR_COLUMNS.includes(type)) {
|
|
25
|
+
if (_constants.MULTIPLE_SELECTOR_COLUMNS.includes(type)) {
|
|
13
26
|
return true;
|
|
14
27
|
}
|
|
15
|
-
if (type === CellType.SINGLE_SELECT && [FILTER_PREDICATE_TYPE.IS_ANY_OF, FILTER_PREDICATE_TYPE.IS_NONE_OF].includes(filterPredicate)) {
|
|
28
|
+
if (type === _dtableUtils.CellType.SINGLE_SELECT && [_dtableUtils.FILTER_PREDICATE_TYPE.IS_ANY_OF, _dtableUtils.FILTER_PREDICATE_TYPE.IS_NONE_OF].includes(filterPredicate)) {
|
|
16
29
|
return true;
|
|
17
30
|
}
|
|
18
|
-
if (FORMULA_COLUMN_TYPES.includes(type)) {
|
|
31
|
+
if (_constants.FORMULA_COLUMN_TYPES.includes(type)) {
|
|
19
32
|
const {
|
|
20
33
|
result_type,
|
|
21
34
|
array_type
|
|
22
35
|
} = data || {};
|
|
23
|
-
if (result_type !== FORMULA_RESULT_TYPE.ARRAY) return false;
|
|
36
|
+
if (result_type !== _dtableUtils.FORMULA_RESULT_TYPE.ARRAY) return false;
|
|
24
37
|
return isArrayFilterTermByArrayType(array_type);
|
|
25
38
|
}
|
|
26
|
-
if (type === CellType.LINK) {
|
|
39
|
+
if (type === _dtableUtils.CellType.LINK) {
|
|
27
40
|
const {
|
|
28
41
|
array_type
|
|
29
42
|
} = data || {};
|
|
@@ -31,8 +44,9 @@ export const isFilterTermArray = (column, filterPredicate) => {
|
|
|
31
44
|
}
|
|
32
45
|
return false;
|
|
33
46
|
};
|
|
34
|
-
|
|
35
|
-
|
|
47
|
+
exports.isFilterTermArray = isFilterTermArray;
|
|
48
|
+
const getUpdatedFilterByCreator = (filter, collaborator) => {
|
|
49
|
+
const multipleSelectType = [_dtableUtils.FILTER_PREDICATE_TYPE.CONTAINS, _dtableUtils.FILTER_PREDICATE_TYPE.NOT_CONTAIN];
|
|
36
50
|
let {
|
|
37
51
|
filter_predicate,
|
|
38
52
|
filter_term: filterTerm
|
|
@@ -56,10 +70,11 @@ export const getUpdatedFilterByCreator = (filter, collaborator) => {
|
|
|
56
70
|
filter_term: filterTerm
|
|
57
71
|
});
|
|
58
72
|
};
|
|
59
|
-
|
|
73
|
+
exports.getUpdatedFilterByCreator = getUpdatedFilterByCreator;
|
|
74
|
+
const getUpdatedFilterBySelectSingle = (filter, columnOption) => {
|
|
60
75
|
let new_filter_term;
|
|
61
76
|
// if predicate is any of / is none of, filter_term is array; else filter_term is string
|
|
62
|
-
if (filter.filter_predicate === FILTER_PREDICATE_TYPE.IS_ANY_OF || filter.filter_predicate === FILTER_PREDICATE_TYPE.IS_NONE_OF) {
|
|
77
|
+
if (filter.filter_predicate === _dtableUtils.FILTER_PREDICATE_TYPE.IS_ANY_OF || filter.filter_predicate === _dtableUtils.FILTER_PREDICATE_TYPE.IS_NONE_OF) {
|
|
63
78
|
new_filter_term = Array.isArray(filter.filter_term) ? [...filter.filter_term] : [];
|
|
64
79
|
const index = new_filter_term.indexOf(columnOption.id);
|
|
65
80
|
if (index === -1) {
|
|
@@ -74,7 +89,8 @@ export const getUpdatedFilterBySelectSingle = (filter, columnOption) => {
|
|
|
74
89
|
filter_term: new_filter_term
|
|
75
90
|
});
|
|
76
91
|
};
|
|
77
|
-
|
|
92
|
+
exports.getUpdatedFilterBySelectSingle = getUpdatedFilterBySelectSingle;
|
|
93
|
+
const getUpdatedFilterBySelectMultiple = (filter, columnOption) => {
|
|
78
94
|
let filterTerm = filter.filter_term ? filter.filter_term : [];
|
|
79
95
|
let index = filterTerm.indexOf(columnOption.id);
|
|
80
96
|
if (index > -1) {
|
|
@@ -86,7 +102,8 @@ export const getUpdatedFilterBySelectMultiple = (filter, columnOption) => {
|
|
|
86
102
|
filter_term: filterTerm
|
|
87
103
|
});
|
|
88
104
|
};
|
|
89
|
-
|
|
105
|
+
exports.getUpdatedFilterBySelectMultiple = getUpdatedFilterBySelectMultiple;
|
|
106
|
+
const getUpdatedFilterByCollaborator = (filter, collaborator) => {
|
|
90
107
|
let filterTerm = filter.filter_term ? filter.filter_term.slice(0) : [];
|
|
91
108
|
let selectedEmail = collaborator.email;
|
|
92
109
|
let collaborator_index = filterTerm.indexOf(selectedEmail);
|
|
@@ -99,7 +116,8 @@ export const getUpdatedFilterByCollaborator = (filter, collaborator) => {
|
|
|
99
116
|
filter_term: filterTerm
|
|
100
117
|
});
|
|
101
118
|
};
|
|
102
|
-
|
|
119
|
+
exports.getUpdatedFilterByCollaborator = getUpdatedFilterByCollaborator;
|
|
120
|
+
const getUpdatedFilterByRate = (filter, value) => {
|
|
103
121
|
if (filter.filter_term === value) {
|
|
104
122
|
return;
|
|
105
123
|
}
|
|
@@ -107,28 +125,30 @@ export const getUpdatedFilterByRate = (filter, value) => {
|
|
|
107
125
|
filter_term: value
|
|
108
126
|
});
|
|
109
127
|
};
|
|
110
|
-
|
|
128
|
+
exports.getUpdatedFilterByRate = getUpdatedFilterByRate;
|
|
129
|
+
const getColumnOptions = column => {
|
|
111
130
|
const {
|
|
112
131
|
type,
|
|
113
132
|
data
|
|
114
133
|
} = column;
|
|
115
|
-
if (FORMULA_COLUMN_TYPES.includes(type)) {
|
|
134
|
+
if (_constants.FORMULA_COLUMN_TYPES.includes(type)) {
|
|
116
135
|
return getFormulaColumnFilterOptions(column);
|
|
117
136
|
}
|
|
118
|
-
if (type === CellType.LINK) {
|
|
137
|
+
if (type === _dtableUtils.CellType.LINK) {
|
|
119
138
|
const {
|
|
120
139
|
array_type
|
|
121
140
|
} = data || {};
|
|
122
|
-
if (array_type === FORMULA_RESULT_TYPE.BOOL) {
|
|
123
|
-
return FILTER_COLUMN_OPTIONS[CellType.CHECKBOX];
|
|
141
|
+
if (array_type === _dtableUtils.FORMULA_RESULT_TYPE.BOOL) {
|
|
142
|
+
return _dtableUtils.FILTER_COLUMN_OPTIONS[_dtableUtils.CellType.CHECKBOX];
|
|
124
143
|
}
|
|
125
|
-
if (array_type === FORMULA_RESULT_TYPE.STRING) {
|
|
126
|
-
return FILTER_COLUMN_OPTIONS[CellType.TEXT];
|
|
144
|
+
if (array_type === _dtableUtils.FORMULA_RESULT_TYPE.STRING) {
|
|
145
|
+
return _dtableUtils.FILTER_COLUMN_OPTIONS[_dtableUtils.CellType.TEXT];
|
|
127
146
|
}
|
|
128
147
|
return getFilterOptionsByArrayType(array_type);
|
|
129
148
|
}
|
|
130
|
-
return FILTER_COLUMN_OPTIONS[type] || {};
|
|
149
|
+
return _dtableUtils.FILTER_COLUMN_OPTIONS[type] || {};
|
|
131
150
|
};
|
|
151
|
+
exports.getColumnOptions = getColumnOptions;
|
|
132
152
|
const getFormulaColumnFilterOptions = column => {
|
|
133
153
|
const {
|
|
134
154
|
data
|
|
@@ -137,54 +157,54 @@ const getFormulaColumnFilterOptions = column => {
|
|
|
137
157
|
result_type,
|
|
138
158
|
array_type
|
|
139
159
|
} = data || {};
|
|
140
|
-
if (result_type === FORMULA_RESULT_TYPE.BOOL) {
|
|
141
|
-
return FILTER_COLUMN_OPTIONS[CellType.CHECKBOX];
|
|
160
|
+
if (result_type === _dtableUtils.FORMULA_RESULT_TYPE.BOOL) {
|
|
161
|
+
return _dtableUtils.FILTER_COLUMN_OPTIONS[_dtableUtils.CellType.CHECKBOX];
|
|
142
162
|
}
|
|
143
|
-
if (result_type === FORMULA_RESULT_TYPE.STRING) {
|
|
144
|
-
return FILTER_COLUMN_OPTIONS[CellType.TEXT];
|
|
163
|
+
if (result_type === _dtableUtils.FORMULA_RESULT_TYPE.STRING) {
|
|
164
|
+
return _dtableUtils.FILTER_COLUMN_OPTIONS[_dtableUtils.CellType.TEXT];
|
|
145
165
|
}
|
|
146
|
-
if ([FORMULA_RESULT_TYPE.NUMBER, FORMULA_RESULT_TYPE.DATE].includes(result_type)) {
|
|
147
|
-
return FILTER_COLUMN_OPTIONS[result_type];
|
|
166
|
+
if ([_dtableUtils.FORMULA_RESULT_TYPE.NUMBER, _dtableUtils.FORMULA_RESULT_TYPE.DATE].includes(result_type)) {
|
|
167
|
+
return _dtableUtils.FILTER_COLUMN_OPTIONS[result_type];
|
|
148
168
|
}
|
|
149
|
-
if (result_type === FORMULA_RESULT_TYPE.ARRAY) {
|
|
169
|
+
if (result_type === _dtableUtils.FORMULA_RESULT_TYPE.ARRAY) {
|
|
150
170
|
return getFilterOptionsByArrayType(array_type);
|
|
151
171
|
}
|
|
152
|
-
return FILTER_COLUMN_OPTIONS[CellType.TEXT];
|
|
172
|
+
return _dtableUtils.FILTER_COLUMN_OPTIONS[_dtableUtils.CellType.TEXT];
|
|
153
173
|
};
|
|
154
174
|
const getFilterOptionsByArrayType = array_type => {
|
|
155
175
|
if (!array_type) {
|
|
156
176
|
return {};
|
|
157
177
|
}
|
|
158
178
|
let checkType = array_type;
|
|
159
|
-
if (COLLABORATOR_COLUMN_TYPES.includes(array_type)) {
|
|
160
|
-
checkType = CellType.COLLABORATOR;
|
|
161
|
-
} else if (array_type === CellType.SINGLE_SELECT) {
|
|
162
|
-
checkType = CellType.MULTIPLE_SELECT;
|
|
163
|
-
} else if (DATE_COLUMN_OPTIONS.includes(array_type)) {
|
|
164
|
-
checkType = CellType.DATE;
|
|
165
|
-
} else if (isNumericColumn({
|
|
179
|
+
if (_dtableUtils.COLLABORATOR_COLUMN_TYPES.includes(array_type)) {
|
|
180
|
+
checkType = _dtableUtils.CellType.COLLABORATOR;
|
|
181
|
+
} else if (array_type === _dtableUtils.CellType.SINGLE_SELECT) {
|
|
182
|
+
checkType = _dtableUtils.CellType.MULTIPLE_SELECT;
|
|
183
|
+
} else if (_dtableUtils.DATE_COLUMN_OPTIONS.includes(array_type)) {
|
|
184
|
+
checkType = _dtableUtils.CellType.DATE;
|
|
185
|
+
} else if ((0, _dtableUtils.isNumericColumn)({
|
|
166
186
|
type: array_type
|
|
167
187
|
})) {
|
|
168
|
-
checkType = CellType.NUMBER;
|
|
188
|
+
checkType = _dtableUtils.CellType.NUMBER;
|
|
169
189
|
}
|
|
170
190
|
|
|
171
191
|
// only support: is
|
|
172
|
-
if (checkType === CellType.CHECKBOX || checkType === CellType.BOOL) {
|
|
173
|
-
return FILTER_COLUMN_OPTIONS[CellType.CHECKBOX];
|
|
192
|
+
if (checkType === _dtableUtils.CellType.CHECKBOX || checkType === _dtableUtils.CellType.BOOL) {
|
|
193
|
+
return _dtableUtils.FILTER_COLUMN_OPTIONS[_dtableUtils.CellType.CHECKBOX];
|
|
174
194
|
}
|
|
175
|
-
let filterOptions = FILTER_COLUMN_OPTIONS[checkType] || FILTER_COLUMN_OPTIONS[CellType.TEXT];
|
|
195
|
+
let filterOptions = _dtableUtils.FILTER_COLUMN_OPTIONS[checkType] || _dtableUtils.FILTER_COLUMN_OPTIONS[_dtableUtils.CellType.TEXT];
|
|
176
196
|
let {
|
|
177
197
|
filterPredicateList
|
|
178
198
|
} = filterOptions;
|
|
179
|
-
if (filterPredicateList && !filterPredicateList.includes(FILTER_PREDICATE_TYPE.EMPTY)) {
|
|
180
|
-
filterPredicateList.push(FILTER_PREDICATE_TYPE.EMPTY);
|
|
199
|
+
if (filterPredicateList && !filterPredicateList.includes(_dtableUtils.FILTER_PREDICATE_TYPE.EMPTY)) {
|
|
200
|
+
filterPredicateList.push(_dtableUtils.FILTER_PREDICATE_TYPE.EMPTY);
|
|
181
201
|
}
|
|
182
|
-
if (filterPredicateList && !filterPredicateList.includes(FILTER_PREDICATE_TYPE.NOT_EMPTY)) {
|
|
183
|
-
filterPredicateList.push(FILTER_PREDICATE_TYPE.NOT_EMPTY);
|
|
202
|
+
if (filterPredicateList && !filterPredicateList.includes(_dtableUtils.FILTER_PREDICATE_TYPE.NOT_EMPTY)) {
|
|
203
|
+
filterPredicateList.push(_dtableUtils.FILTER_PREDICATE_TYPE.NOT_EMPTY);
|
|
184
204
|
}
|
|
185
205
|
return filterOptions;
|
|
186
206
|
};
|
|
187
|
-
|
|
207
|
+
const getFilterByColumn = function (column, value) {
|
|
188
208
|
let {
|
|
189
209
|
textDefaultPredicate
|
|
190
210
|
} = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : {};
|
|
@@ -198,7 +218,7 @@ export const getFilterByColumn = function (column, value) {
|
|
|
198
218
|
} = getColumnOptions(column, value);
|
|
199
219
|
if (!filterPredicateList) return;
|
|
200
220
|
let filterPredicate = filterPredicateList[0];
|
|
201
|
-
if (textDefaultPredicate && columnType === CellType.TEXT && filterPredicateList.includes(textDefaultPredicate)) {
|
|
221
|
+
if (textDefaultPredicate && columnType === _dtableUtils.CellType.TEXT && filterPredicateList.includes(textDefaultPredicate)) {
|
|
202
222
|
filterPredicate = textDefaultPredicate;
|
|
203
223
|
}
|
|
204
224
|
let updatedFilter = Object.assign({}, filter, {
|
|
@@ -211,12 +231,12 @@ export const getFilterByColumn = function (column, value) {
|
|
|
211
231
|
updatedFilter.filter_term = '';
|
|
212
232
|
|
|
213
233
|
// checkbox
|
|
214
|
-
if (columnType === CellType.CHECKBOX) {
|
|
234
|
+
if (columnType === _dtableUtils.CellType.CHECKBOX) {
|
|
215
235
|
updatedFilter.filter_term = false;
|
|
216
236
|
return updatedFilter;
|
|
217
237
|
}
|
|
218
238
|
// rate
|
|
219
|
-
if (columnType === CellType.RATE) {
|
|
239
|
+
if (columnType === _dtableUtils.CellType.RATE) {
|
|
220
240
|
const {
|
|
221
241
|
rate_max_number
|
|
222
242
|
} = columnData;
|
|
@@ -229,14 +249,14 @@ export const getFilterByColumn = function (column, value) {
|
|
|
229
249
|
return updatedFilter;
|
|
230
250
|
}
|
|
231
251
|
// date | ctime | mtime
|
|
232
|
-
if (isDateColumn(column)) {
|
|
233
|
-
let filterTermModifier = filterPredicate === FILTER_PREDICATE_TYPE.IS_WITHIN ? filterTermModifierIsWithin[0] : filterTermModifierNotWithin[0];
|
|
252
|
+
if ((0, _dtableUtils.isDateColumn)(column)) {
|
|
253
|
+
let filterTermModifier = filterPredicate === _dtableUtils.FILTER_PREDICATE_TYPE.IS_WITHIN ? _dtableUtils.filterTermModifierIsWithin[0] : _dtableUtils.filterTermModifierNotWithin[0];
|
|
234
254
|
updatedFilter.filter_term_modifier = filterTermModifier;
|
|
235
255
|
updatedFilter.filter_term = '';
|
|
236
256
|
return updatedFilter;
|
|
237
257
|
}
|
|
238
258
|
// formula | link-formula
|
|
239
|
-
if (FORMULA_COLUMN_TYPES.includes(columnType)) {
|
|
259
|
+
if (_constants.FORMULA_COLUMN_TYPES.includes(columnType)) {
|
|
240
260
|
const newUpdatedFilter = getFormulaColumnFilter(column, value, filter);
|
|
241
261
|
if (newUpdatedFilter) {
|
|
242
262
|
updatedFilter.filter_term = newUpdatedFilter.filter_term;
|
|
@@ -244,17 +264,17 @@ export const getFilterByColumn = function (column, value) {
|
|
|
244
264
|
return updatedFilter;
|
|
245
265
|
}
|
|
246
266
|
// link
|
|
247
|
-
if (columnType === CellType.LINK) {
|
|
267
|
+
if (columnType === _dtableUtils.CellType.LINK) {
|
|
248
268
|
let {
|
|
249
269
|
array_type,
|
|
250
270
|
array_data
|
|
251
271
|
} = columnData || {};
|
|
252
272
|
if (array_type) {
|
|
253
|
-
if (array_type === FORMULA_RESULT_TYPE.BOOL) {
|
|
254
|
-
array_type = CellType.CHECKBOX;
|
|
273
|
+
if (array_type === _dtableUtils.FORMULA_RESULT_TYPE.BOOL) {
|
|
274
|
+
array_type = _dtableUtils.CellType.CHECKBOX;
|
|
255
275
|
}
|
|
256
|
-
if (array_type === FORMULA_RESULT_TYPE.STRING) {
|
|
257
|
-
array_type = CellType.TEXT;
|
|
276
|
+
if (array_type === _dtableUtils.FORMULA_RESULT_TYPE.STRING) {
|
|
277
|
+
array_type = _dtableUtils.CellType.TEXT;
|
|
258
278
|
}
|
|
259
279
|
const linkedColumn = {
|
|
260
280
|
key: column.key,
|
|
@@ -270,7 +290,8 @@ export const getFilterByColumn = function (column, value) {
|
|
|
270
290
|
}
|
|
271
291
|
return updatedFilter;
|
|
272
292
|
};
|
|
273
|
-
|
|
293
|
+
exports.getFilterByColumn = getFilterByColumn;
|
|
294
|
+
const getFormulaColumnFilter = (column, value, filter) => {
|
|
274
295
|
const {
|
|
275
296
|
data
|
|
276
297
|
} = column;
|
|
@@ -279,7 +300,7 @@ export const getFormulaColumnFilter = (column, value, filter) => {
|
|
|
279
300
|
array_type,
|
|
280
301
|
array_data
|
|
281
302
|
} = data || {};
|
|
282
|
-
if (result_type === FORMULA_RESULT_TYPE.ARRAY) {
|
|
303
|
+
if (result_type === _dtableUtils.FORMULA_RESULT_TYPE.ARRAY) {
|
|
283
304
|
const linkedColumn = {
|
|
284
305
|
key: column.key,
|
|
285
306
|
type: array_type,
|
|
@@ -288,11 +309,11 @@ export const getFormulaColumnFilter = (column, value, filter) => {
|
|
|
288
309
|
return getFilterByColumn(linkedColumn, value, filter);
|
|
289
310
|
}
|
|
290
311
|
// result_type: string | number | bool | date
|
|
291
|
-
if (result_type === FORMULA_RESULT_TYPE.BOOL) {
|
|
292
|
-
array_type = CellType.CHECKBOX;
|
|
312
|
+
if (result_type === _dtableUtils.FORMULA_RESULT_TYPE.BOOL) {
|
|
313
|
+
array_type = _dtableUtils.CellType.CHECKBOX;
|
|
293
314
|
}
|
|
294
|
-
if (result_type === FORMULA_RESULT_TYPE.STRING) {
|
|
295
|
-
array_type = CellType.TEXT;
|
|
315
|
+
if (result_type === _dtableUtils.FORMULA_RESULT_TYPE.STRING) {
|
|
316
|
+
array_type = _dtableUtils.CellType.TEXT;
|
|
296
317
|
}
|
|
297
318
|
const linkedColumn = {
|
|
298
319
|
key: column.key,
|
|
@@ -306,32 +327,33 @@ export const getFormulaColumnFilter = (column, value, filter) => {
|
|
|
306
327
|
// text, long-text, number, single-select, date, ctime, mtime, formula, link, geolocation : string
|
|
307
328
|
// checkbox : boolean
|
|
308
329
|
// multiple-select, collaborator, creator, last modifier : array
|
|
309
|
-
|
|
310
|
-
|
|
330
|
+
exports.getFormulaColumnFilter = getFormulaColumnFilter;
|
|
331
|
+
const getUpdatedFilterByColumn = (filters, value, filterIndex, column) => {
|
|
311
332
|
const filter = filters[filterIndex];
|
|
312
333
|
if (filter.column_key === column.key) {
|
|
313
334
|
return;
|
|
314
335
|
}
|
|
315
336
|
return getFilterByColumn(column, value, filter);
|
|
316
337
|
};
|
|
317
|
-
|
|
338
|
+
exports.getUpdatedFilterByColumn = getUpdatedFilterByColumn;
|
|
339
|
+
const getUpdatedFilterByPredicate = (filter, column, filterPredicate) => {
|
|
318
340
|
let updatedFilter = Object.assign({}, filter, {
|
|
319
341
|
filter_predicate: filterPredicate
|
|
320
342
|
});
|
|
321
343
|
let {
|
|
322
344
|
type: columnType
|
|
323
345
|
} = column;
|
|
324
|
-
if (columnType === CellType.CHECKBOX) {
|
|
346
|
+
if (columnType === _dtableUtils.CellType.CHECKBOX) {
|
|
325
347
|
updatedFilter.filter_term = false;
|
|
326
348
|
return updatedFilter;
|
|
327
349
|
}
|
|
328
|
-
if ([CellType.SINGLE_SELECT, CellType.DEPARTMENT_SINGLE_SELECT].includes(columnType)) {
|
|
329
|
-
if (ARRAY_PREDICATE[filterPredicate]) {
|
|
330
|
-
if (ARRAY_PREDICATE[filter.filter_predicate] !== ARRAY_PREDICATE[filterPredicate]) {
|
|
350
|
+
if ([_dtableUtils.CellType.SINGLE_SELECT, _dtableUtils.CellType.DEPARTMENT_SINGLE_SELECT].includes(columnType)) {
|
|
351
|
+
if (_constants.ARRAY_PREDICATE[filterPredicate]) {
|
|
352
|
+
if (_constants.ARRAY_PREDICATE[filter.filter_predicate] !== _constants.ARRAY_PREDICATE[filterPredicate]) {
|
|
331
353
|
updatedFilter.filter_term = [];
|
|
332
354
|
}
|
|
333
|
-
} else if (STRING_PREDICATE[filterPredicate]) {
|
|
334
|
-
if (STRING_PREDICATE[filter.filter_predicate] !== STRING_PREDICATE[filterPredicate]) {
|
|
355
|
+
} else if (_constants.STRING_PREDICATE[filterPredicate]) {
|
|
356
|
+
if (_constants.STRING_PREDICATE[filter.filter_predicate] !== _constants.STRING_PREDICATE[filterPredicate]) {
|
|
335
357
|
updatedFilter.filter_term = '';
|
|
336
358
|
}
|
|
337
359
|
} else {
|
|
@@ -339,25 +361,26 @@ export const getUpdatedFilterByPredicate = (filter, column, filterPredicate) =>
|
|
|
339
361
|
}
|
|
340
362
|
return updatedFilter;
|
|
341
363
|
}
|
|
342
|
-
if ([CellType.CREATOR, CellType.LAST_MODIFIER].includes(columnType)) {
|
|
343
|
-
if (STRING_PREDICATE[filter.filter_predicate] !== STRING_PREDICATE[filterPredicate] || filterPredicate === FILTER_PREDICATE_TYPE.INCLUDE_ME) {
|
|
364
|
+
if ([_dtableUtils.CellType.CREATOR, _dtableUtils.CellType.LAST_MODIFIER].includes(columnType)) {
|
|
365
|
+
if (_constants.STRING_PREDICATE[filter.filter_predicate] !== _constants.STRING_PREDICATE[filterPredicate] || filterPredicate === _dtableUtils.FILTER_PREDICATE_TYPE.INCLUDE_ME) {
|
|
344
366
|
updatedFilter.filter_term = [];
|
|
345
367
|
}
|
|
346
368
|
}
|
|
347
369
|
if (isFilterTermArray(column, filterPredicate)) {
|
|
348
|
-
if (DATE_EMPTY_LABEL_MAP[filterPredicate] || filterPredicate === FILTER_PREDICATE_TYPE.INCLUDE_ME) {
|
|
370
|
+
if (_constants.DATE_EMPTY_LABEL_MAP[filterPredicate] || filterPredicate === _dtableUtils.FILTER_PREDICATE_TYPE.INCLUDE_ME) {
|
|
349
371
|
updatedFilter.filter_term = [];
|
|
350
372
|
}
|
|
351
373
|
return updatedFilter;
|
|
352
374
|
}
|
|
353
|
-
if (isDateColumn(column)) {
|
|
354
|
-
let filterTermModifier = filterPredicate === FILTER_PREDICATE_TYPE.IS_WITHIN ? filterTermModifierIsWithin[0] : filterTermModifierNotWithin[0];
|
|
375
|
+
if ((0, _dtableUtils.isDateColumn)(column)) {
|
|
376
|
+
let filterTermModifier = filterPredicate === _dtableUtils.FILTER_PREDICATE_TYPE.IS_WITHIN ? _dtableUtils.filterTermModifierIsWithin[0] : _dtableUtils.filterTermModifierNotWithin[0];
|
|
355
377
|
updatedFilter.filter_term_modifier = filterTermModifier;
|
|
356
378
|
return updatedFilter;
|
|
357
379
|
}
|
|
358
380
|
return updatedFilter;
|
|
359
381
|
};
|
|
360
|
-
|
|
382
|
+
exports.getUpdatedFilterByPredicate = getUpdatedFilterByPredicate;
|
|
383
|
+
const getUpdatedFilterByTermModifier = (filters, filterIndex, filterTermModifier) => {
|
|
361
384
|
const filter = filters[filterIndex];
|
|
362
385
|
if (filter.filter_term_modifier === filterTermModifier) {
|
|
363
386
|
return;
|
|
@@ -366,10 +389,11 @@ export const getUpdatedFilterByTermModifier = (filters, filterIndex, filterTermM
|
|
|
366
389
|
filter_term_modifier: filterTermModifier
|
|
367
390
|
});
|
|
368
391
|
};
|
|
369
|
-
|
|
392
|
+
exports.getUpdatedFilterByTermModifier = getUpdatedFilterByTermModifier;
|
|
393
|
+
const getUpdatedFilterByNormalTerm = (filters, column, filterIndex, event) => {
|
|
370
394
|
const filter = filters[filterIndex];
|
|
371
395
|
let filterTerm;
|
|
372
|
-
if (column.type === CellType.CHECKBOX) {
|
|
396
|
+
if (column.type === _dtableUtils.CellType.CHECKBOX) {
|
|
373
397
|
filterTerm = event.target.checked;
|
|
374
398
|
} else {
|
|
375
399
|
filterTerm = event.target.value;
|
|
@@ -381,26 +405,27 @@ export const getUpdatedFilterByNormalTerm = (filters, column, filterIndex, event
|
|
|
381
405
|
filter_term: filterTerm
|
|
382
406
|
});
|
|
383
407
|
};
|
|
384
|
-
|
|
408
|
+
exports.getUpdatedFilterByNormalTerm = getUpdatedFilterByNormalTerm;
|
|
409
|
+
const getUpdatedFilterBySpecialTerm = (filters, filterIndex, type, value) => {
|
|
385
410
|
const filter = filters[filterIndex];
|
|
386
411
|
switch (type) {
|
|
387
|
-
case SPECIAL_TERM_TYPE.CREATOR:
|
|
412
|
+
case _constants.SPECIAL_TERM_TYPE.CREATOR:
|
|
388
413
|
{
|
|
389
414
|
return getUpdatedFilterByCreator(filter, value);
|
|
390
415
|
}
|
|
391
|
-
case SPECIAL_TERM_TYPE.SINGLE_SELECT:
|
|
416
|
+
case _constants.SPECIAL_TERM_TYPE.SINGLE_SELECT:
|
|
392
417
|
{
|
|
393
418
|
return getUpdatedFilterBySelectSingle(filter, value);
|
|
394
419
|
}
|
|
395
|
-
case SPECIAL_TERM_TYPE.MULTIPLE_SELECT:
|
|
420
|
+
case _constants.SPECIAL_TERM_TYPE.MULTIPLE_SELECT:
|
|
396
421
|
{
|
|
397
422
|
return getUpdatedFilterBySelectMultiple(filter, value);
|
|
398
423
|
}
|
|
399
|
-
case SPECIAL_TERM_TYPE.COLLABORATOR:
|
|
424
|
+
case _constants.SPECIAL_TERM_TYPE.COLLABORATOR:
|
|
400
425
|
{
|
|
401
426
|
return getUpdatedFilterByCollaborator(filter, value);
|
|
402
427
|
}
|
|
403
|
-
case SPECIAL_TERM_TYPE.RATE:
|
|
428
|
+
case _constants.SPECIAL_TERM_TYPE.RATE:
|
|
404
429
|
{
|
|
405
430
|
return getUpdatedFilterByRate(filter, value);
|
|
406
431
|
}
|
|
@@ -410,37 +435,41 @@ export const getUpdatedFilterBySpecialTerm = (filters, filterIndex, type, value)
|
|
|
410
435
|
}
|
|
411
436
|
}
|
|
412
437
|
};
|
|
413
|
-
|
|
438
|
+
exports.getUpdatedFilterBySpecialTerm = getUpdatedFilterBySpecialTerm;
|
|
439
|
+
const getColumnByKey = (columns, columnKey) => {
|
|
414
440
|
if (!Array.isArray(columns) || !columnKey) return null;
|
|
415
441
|
return columns.find(column => column.key === columnKey);
|
|
416
442
|
};
|
|
417
|
-
|
|
443
|
+
exports.getColumnByKey = getColumnByKey;
|
|
444
|
+
const isCheckboxColumn = column => {
|
|
418
445
|
let {
|
|
419
446
|
type,
|
|
420
447
|
data
|
|
421
448
|
} = column;
|
|
422
|
-
if (FORMULA_COLUMN_TYPES_MAP[type]) {
|
|
449
|
+
if (_dtableUtils.FORMULA_COLUMN_TYPES_MAP[type]) {
|
|
423
450
|
const {
|
|
424
451
|
result_type,
|
|
425
452
|
array_type
|
|
426
453
|
} = data || {};
|
|
427
|
-
if (result_type === FORMULA_RESULT_TYPE.ARRAY) {
|
|
428
|
-
return array_type === CellType.CHECKBOX;
|
|
454
|
+
if (result_type === _dtableUtils.FORMULA_RESULT_TYPE.ARRAY) {
|
|
455
|
+
return array_type === _dtableUtils.CellType.CHECKBOX;
|
|
429
456
|
}
|
|
430
457
|
return false;
|
|
431
458
|
}
|
|
432
|
-
return type === CellType.CHECKBOX;
|
|
459
|
+
return type === _dtableUtils.CellType.CHECKBOX;
|
|
433
460
|
};
|
|
434
|
-
|
|
435
|
-
|
|
461
|
+
exports.isCheckboxColumn = isCheckboxColumn;
|
|
462
|
+
const getDateColumnFormat = column => {
|
|
463
|
+
const format = column && column.data && column.data.format ? column.data.format : _dtableUtils.DEFAULT_DATE_FORMAT;
|
|
436
464
|
// Old Europe format is D/M/YYYY new format is DD/MM/YYYY
|
|
437
465
|
return format;
|
|
438
466
|
};
|
|
467
|
+
exports.getDateColumnFormat = getDateColumnFormat;
|
|
439
468
|
const getMediaUrl = () => {
|
|
440
469
|
var _window, _window$dtable, _window2, _window2$dtablePlugin;
|
|
441
470
|
return ((_window = window) === null || _window === void 0 ? void 0 : (_window$dtable = _window.dtable) === null || _window$dtable === void 0 ? void 0 : _window$dtable.mediaUrl) || ((_window2 = window) === null || _window2 === void 0 ? void 0 : (_window2$dtablePlugin = _window2.dtablePluginConfig) === null || _window2$dtablePlugin === void 0 ? void 0 : _window2$dtablePlugin.mediaUrl) || '/media/';
|
|
442
471
|
};
|
|
443
|
-
|
|
472
|
+
const generateDefaultUser = name => {
|
|
444
473
|
const mediaUrl = getMediaUrl();
|
|
445
474
|
const defaultAvatarUrl = "".concat(mediaUrl, "avatars/default.png");
|
|
446
475
|
return {
|
|
@@ -449,4 +478,4 @@ export const generateDefaultUser = name => {
|
|
|
449
478
|
avatar_url: defaultAvatarUrl
|
|
450
479
|
};
|
|
451
480
|
};
|
|
452
|
-
|
|
481
|
+
exports.generateDefaultUser = generateDefaultUser;
|
|
@@ -1,9 +1,17 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
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 _dtableUtils = require("dtable-utils");
|
|
11
|
+
var _DTableCustomizeSelect = _interopRequireDefault(require("../../../DTableCustomizeSelect"));
|
|
12
|
+
var _lang = require("../../../lang");
|
|
13
|
+
require("./index.css");
|
|
14
|
+
class CollaboratorFilter extends _react.Component {
|
|
7
15
|
constructor(props) {
|
|
8
16
|
super(props);
|
|
9
17
|
this.createCollaboratorOptions = (filterIndex, collaborators, filterTerm) => {
|
|
@@ -14,28 +22,28 @@ class CollaboratorFilter extends Component {
|
|
|
14
22
|
filterIndex,
|
|
15
23
|
columnOption: collaborator
|
|
16
24
|
},
|
|
17
|
-
label: /*#__PURE__*/
|
|
25
|
+
label: /*#__PURE__*/_react.default.createElement(_react.Fragment, null, /*#__PURE__*/_react.default.createElement("div", {
|
|
18
26
|
className: "select-option-name option-collaborator"
|
|
19
|
-
}, /*#__PURE__*/
|
|
27
|
+
}, /*#__PURE__*/_react.default.createElement("div", {
|
|
20
28
|
className: "collaborator-container"
|
|
21
|
-
}, /*#__PURE__*/
|
|
29
|
+
}, /*#__PURE__*/_react.default.createElement("div", {
|
|
22
30
|
className: "collaborator"
|
|
23
|
-
}, /*#__PURE__*/
|
|
31
|
+
}, /*#__PURE__*/_react.default.createElement("span", {
|
|
24
32
|
className: "collaborator-avatar-container"
|
|
25
|
-
}, /*#__PURE__*/
|
|
33
|
+
}, /*#__PURE__*/_react.default.createElement("img", {
|
|
26
34
|
className: "collaborator-avatar",
|
|
27
35
|
alt: collaborator.name,
|
|
28
36
|
src: collaborator.avatar_url
|
|
29
|
-
})), /*#__PURE__*/
|
|
37
|
+
})), /*#__PURE__*/_react.default.createElement("span", {
|
|
30
38
|
className: "collaborator-name text-truncate",
|
|
31
39
|
style: {
|
|
32
40
|
maxWidth: '200px'
|
|
33
41
|
},
|
|
34
42
|
title: collaborator.name,
|
|
35
43
|
"aria-label": collaborator.name
|
|
36
|
-
}, collaborator.name))), /*#__PURE__*/
|
|
44
|
+
}, collaborator.name))), /*#__PURE__*/_react.default.createElement("div", {
|
|
37
45
|
className: "collaborator-check-icon"
|
|
38
|
-
}, isSelected && /*#__PURE__*/
|
|
46
|
+
}, isSelected && /*#__PURE__*/_react.default.createElement("i", {
|
|
39
47
|
className: "option-edit dtable-font dtable-icon-check-mark"
|
|
40
48
|
}))))
|
|
41
49
|
};
|
|
@@ -47,7 +55,7 @@ class CollaboratorFilter extends Component {
|
|
|
47
55
|
columnOption: collaborator
|
|
48
56
|
});
|
|
49
57
|
};
|
|
50
|
-
this.supportMultipleSelectOptions = [FILTER_PREDICATE_TYPE.HAS_ANY_OF, FILTER_PREDICATE_TYPE.HAS_ALL_OF, FILTER_PREDICATE_TYPE.HAS_NONE_OF, FILTER_PREDICATE_TYPE.IS_EXACTLY];
|
|
58
|
+
this.supportMultipleSelectOptions = [_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];
|
|
51
59
|
}
|
|
52
60
|
render() {
|
|
53
61
|
let {
|
|
@@ -61,35 +69,35 @@ class CollaboratorFilter extends Component {
|
|
|
61
69
|
let selectedCollaborators = Array.isArray(filterTerm) && filterTerm.length > 0 && filterTerm.map(item => {
|
|
62
70
|
let collaborator = collaborators.find(c => c.email === item);
|
|
63
71
|
if (!collaborator) return null;
|
|
64
|
-
return /*#__PURE__*/
|
|
72
|
+
return /*#__PURE__*/_react.default.createElement("div", {
|
|
65
73
|
key: item,
|
|
66
74
|
className: "collaborator"
|
|
67
|
-
}, /*#__PURE__*/
|
|
75
|
+
}, /*#__PURE__*/_react.default.createElement("span", {
|
|
68
76
|
className: "collaborator-avatar-container"
|
|
69
|
-
}, /*#__PURE__*/
|
|
77
|
+
}, /*#__PURE__*/_react.default.createElement("img", {
|
|
70
78
|
className: "collaborator-avatar",
|
|
71
79
|
alt: collaborator.name,
|
|
72
80
|
src: collaborator.avatar_url
|
|
73
|
-
})), /*#__PURE__*/
|
|
81
|
+
})), /*#__PURE__*/_react.default.createElement("span", {
|
|
74
82
|
className: "collaborator-name text-truncate",
|
|
75
83
|
title: collaborator.name,
|
|
76
84
|
"aria-label": collaborator.name
|
|
77
|
-
}, collaborator.name), /*#__PURE__*/
|
|
85
|
+
}, collaborator.name), /*#__PURE__*/_react.default.createElement("span", {
|
|
78
86
|
className: "remove-container"
|
|
79
|
-
}, /*#__PURE__*/
|
|
87
|
+
}, /*#__PURE__*/_react.default.createElement("span", {
|
|
80
88
|
className: "remove-icon",
|
|
81
89
|
onClick: e => {
|
|
82
90
|
this.onClick(e, collaborator);
|
|
83
91
|
}
|
|
84
|
-
}, /*#__PURE__*/
|
|
92
|
+
}, /*#__PURE__*/_react.default.createElement("i", {
|
|
85
93
|
className: "dtable-font dtable-icon-fork-number"
|
|
86
94
|
}))));
|
|
87
95
|
});
|
|
88
96
|
let value = selectedCollaborators ? {
|
|
89
|
-
label: /*#__PURE__*/
|
|
97
|
+
label: /*#__PURE__*/_react.default.createElement(_react.default.Fragment, null, selectedCollaborators)
|
|
90
98
|
} : {};
|
|
91
99
|
let options = Array.isArray(filterTerm) ? this.createCollaboratorOptions(filterIndex, collaborators, filterTerm) : [];
|
|
92
|
-
return /*#__PURE__*/
|
|
100
|
+
return /*#__PURE__*/_react.default.createElement(_DTableCustomizeSelect.default, {
|
|
93
101
|
className: "selector-collaborator",
|
|
94
102
|
value: value,
|
|
95
103
|
onSelectOption: this.props.onSelectCollaborator,
|
|
@@ -98,9 +106,9 @@ class CollaboratorFilter extends Component {
|
|
|
98
106
|
isLocked: this.props.isLocked,
|
|
99
107
|
supportMultipleSelect: isSupportMultipleSelect,
|
|
100
108
|
searchable: true,
|
|
101
|
-
searchPlaceholder: getLocale('Find_a_collaborator'),
|
|
109
|
+
searchPlaceholder: (0, _lang.getLocale)('Find_a_collaborator'),
|
|
102
110
|
isShowSelected: false
|
|
103
111
|
});
|
|
104
112
|
}
|
|
105
113
|
}
|
|
106
|
-
|
|
114
|
+
var _default = exports.default = CollaboratorFilter;
|