GRID
This commit is contained in:
50
dist/tryton-sao.js
vendored
50
dist/tryton-sao.js
vendored
@@ -22212,9 +22212,14 @@ function eval_pyson(value){
|
||||
this.clearButton.type = 'button';
|
||||
this.clearButton.className = 'btn btn-default btn-xs';
|
||||
this.clearButton.textContent = 'Clear';
|
||||
this.applySearchButton = document.createElement('button');
|
||||
this.applySearchButton.type = 'button';
|
||||
this.applySearchButton.className = 'btn btn-primary btn-xs';
|
||||
this.applySearchButton.textContent = 'OK';
|
||||
actions.appendChild(this.allButton);
|
||||
actions.appendChild(this.noneButton);
|
||||
actions.appendChild(this.clearButton);
|
||||
actions.appendChild(this.applySearchButton);
|
||||
this.gui.appendChild(actions);
|
||||
|
||||
this.list = document.createElement('div');
|
||||
@@ -22224,6 +22229,15 @@ function eval_pyson(value){
|
||||
this._renderOptions();
|
||||
|
||||
this.search.addEventListener('input', () => this._applySearch());
|
||||
this.search.addEventListener('keydown', event => {
|
||||
if (event.key != 'Enter') {
|
||||
return;
|
||||
}
|
||||
event.preventDefault();
|
||||
this._selectSearchMatches('search-enter');
|
||||
params.filterChangedCallback();
|
||||
this._closePopup();
|
||||
});
|
||||
this.noneButton.addEventListener('pointerdown', event => {
|
||||
if (event.isTrusted) {
|
||||
this._noneButtonUserIntent = true;
|
||||
@@ -22304,11 +22318,17 @@ function eval_pyson(value){
|
||||
this._notifySelectionChanged('clear-button');
|
||||
params.filterChangedCallback();
|
||||
});
|
||||
this.applySearchButton.addEventListener('click', () => {
|
||||
this._selectSearchMatches('search-ok-button');
|
||||
params.filterChangedCallback();
|
||||
this._closePopup();
|
||||
});
|
||||
};
|
||||
Sao.View.AGGridValueSetFilter.prototype.getGui = function() {
|
||||
return this.gui;
|
||||
};
|
||||
Sao.View.AGGridValueSetFilter.prototype.afterGuiAttached = function() {
|
||||
Sao.View.AGGridValueSetFilter.prototype.afterGuiAttached = function(params) {
|
||||
this.hidePopup = params && params.hidePopup || null;
|
||||
this._refreshValuesFromGrid();
|
||||
this._trace('after-gui-attached', {
|
||||
selected: Array.from(this.selected).sort(),
|
||||
@@ -22366,6 +22386,28 @@ function eval_pyson(value){
|
||||
'' : 'none';
|
||||
});
|
||||
};
|
||||
Sao.View.AGGridValueSetFilter.prototype._getSearchMatchingValues = function() {
|
||||
var query = (this.search.value || '').toLowerCase();
|
||||
if (!query) {
|
||||
return this.values.slice();
|
||||
}
|
||||
return this.values.filter(value =>
|
||||
String(value).toLowerCase().indexOf(query) >= 0);
|
||||
};
|
||||
Sao.View.AGGridValueSetFilter.prototype._selectSearchMatches = function(source) {
|
||||
this.selected = new Set(this._getSearchMatchingValues());
|
||||
this._syncCheckboxes();
|
||||
this._trace(source || 'search-apply', {
|
||||
query: this.search && this.search.value || '',
|
||||
selected: Array.from(this.selected).sort(),
|
||||
});
|
||||
this._notifySelectionChanged(source || 'search-apply');
|
||||
};
|
||||
Sao.View.AGGridValueSetFilter.prototype._closePopup = function() {
|
||||
if (this.hidePopup) {
|
||||
this.hidePopup();
|
||||
}
|
||||
};
|
||||
Sao.View.AGGridValueSetFilter.prototype.destroy = function() {};
|
||||
Sao.View.AGGridValueSetFilter.prototype._notifySelectionChanged = function(source) {
|
||||
if (!this.onSelectionChanged || !this.colId) {
|
||||
@@ -26494,12 +26536,6 @@ function eval_pyson(value){
|
||||
changed = true;
|
||||
return;
|
||||
}
|
||||
var has_selected_value = Array.from(filters[col_id].selected || [])
|
||||
.some(value => all.has(value));
|
||||
if (!has_selected_value) {
|
||||
delete filters[col_id];
|
||||
changed = true;
|
||||
}
|
||||
});
|
||||
return changed;
|
||||
},
|
||||
|
||||
Reference in New Issue
Block a user