inviton-powerduck 0.0.138 → 0.0.140
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.
|
@@ -441,6 +441,16 @@ th.dt-header-index .dt-header-indexcheckbox {
|
|
|
441
441
|
display: none;
|
|
442
442
|
}
|
|
443
443
|
|
|
444
|
+
.dt-filter-dropdown-container .btn.btn-sm {
|
|
445
|
+
padding: 5px 15px;
|
|
446
|
+
font-size: 80%;
|
|
447
|
+
}
|
|
448
|
+
|
|
449
|
+
.dt-filter-dropdown-container .select2-search.select2-search--dropdown {
|
|
450
|
+
padding: 4px;
|
|
451
|
+
margin-bottom: 0;
|
|
452
|
+
}
|
|
453
|
+
|
|
444
454
|
.dt-table.dt-table-mode table > tbody > tr > td {
|
|
445
455
|
transition: background 150ms ease-in;
|
|
446
456
|
}
|
|
@@ -294,6 +294,7 @@ export interface TableColumn {
|
|
|
294
294
|
cssClass?: string;
|
|
295
295
|
visible?: boolean;
|
|
296
296
|
sortable?: boolean;
|
|
297
|
+
searchable?: boolean;
|
|
297
298
|
filterType?: DataTableFilterItemType;
|
|
298
299
|
filterItems?: DataTableFilterItemCollection;
|
|
299
300
|
filterAllowExclusivity?: boolean;
|
|
@@ -2283,15 +2284,15 @@ class DataTableComponent extends TsxComponent<DataTableArgs> implements DataTabl
|
|
|
2283
2284
|
return '';
|
|
2284
2285
|
} else if (filterType == DataTableFilterItemType.Text || filterType == null) {
|
|
2285
2286
|
return (<TextBox updateMode="input" cssClass="dt-filter-input" wrap={false} label={null} placeholder={`${capitalize(PowerduckState.getResourceValue('search'))}...`} value={this.currentAdvancedFilterState[dtColumn.id]} changed={(e) => { this.performInputFilter(dtColumn, e); }} appendIcon={closeIcon} appendIconClicked={appendIconClicked} />);
|
|
2286
|
-
// return (<input class="dt-filter-input" placeholder={AppState.resources.search.capitalize() + "..."} onKeyup={(e) => { this.performInputFilter(dtColumn, e) }} value={this.currentAdvancedFilterState[dtColumn.id]} />)
|
|
2287
2287
|
} else if (filterType == DataTableFilterItemType.Dropdown) {
|
|
2288
2288
|
return (
|
|
2289
2289
|
<div class="dt-filter-dropdown">
|
|
2290
2290
|
<DropdownList
|
|
2291
2291
|
label={null}
|
|
2292
|
+
containerCssClass="dt-filter-dropdown-container"
|
|
2292
2293
|
options={dtColumn.filterItems}
|
|
2293
2294
|
wrap={false}
|
|
2294
|
-
disableSearch={
|
|
2295
|
+
disableSearch={!dtColumn.searchable}
|
|
2295
2296
|
dropdownAutoWidth={true}
|
|
2296
2297
|
multiselect={true}
|
|
2297
2298
|
multiselectMode={MultiselectMode.Checkboxes}
|
|
@@ -84,12 +84,39 @@ import { PortalUtils } from '../../../common/utils/utils';
|
|
|
84
84
|
self.$element.select2({
|
|
85
85
|
allowClear: true,
|
|
86
86
|
ajax: {
|
|
87
|
-
transport(
|
|
87
|
+
transport (
|
|
88
88
|
params,
|
|
89
89
|
success,
|
|
90
90
|
failure,
|
|
91
91
|
) {
|
|
92
|
-
|
|
92
|
+
const stripDiacritics = (text: string) => {
|
|
93
|
+
const DIACRITICS = ($ as any).fn.select2.amd.require('select2/diacritics');
|
|
94
|
+
const match = a => DIACRITICS[a] || a;
|
|
95
|
+
return text.replace(/[^\u0000-\u007E]/g, match);
|
|
96
|
+
};
|
|
97
|
+
|
|
98
|
+
const normalizeForSearch = (text: string) => {
|
|
99
|
+
if (text == null) {
|
|
100
|
+
return null;
|
|
101
|
+
}
|
|
102
|
+
return stripDiacritics(text).toUpperCase();
|
|
103
|
+
};
|
|
104
|
+
|
|
105
|
+
let data = self.currentData || [];
|
|
106
|
+
const searchTerm = normalizeForSearch(params.data?.term?.trim());
|
|
107
|
+
|
|
108
|
+
if (searchTerm == null || searchTerm.trim() == '') {
|
|
109
|
+
success({ results: data || [] });
|
|
110
|
+
return;
|
|
111
|
+
}
|
|
112
|
+
|
|
113
|
+
const filteredData = data.filter(item => {
|
|
114
|
+
const itemText = normalizeForSearch(item.text);
|
|
115
|
+
return itemText.includes(searchTerm);
|
|
116
|
+
});
|
|
117
|
+
|
|
118
|
+
success({ results: filteredData || [] });
|
|
119
|
+
// success({ results: data || [] });
|
|
93
120
|
},
|
|
94
121
|
},
|
|
95
122
|
language: options.language,
|