Revert "#1032 test failing"

This reverts commit 681ac605ff.
This commit is contained in:
Gerard 2019-01-25 16:21:23 +01:00
parent 681ac605ff
commit c0a987b3d4
2 changed files with 8 additions and 22 deletions

View File

@ -271,9 +271,7 @@ export default class Autocomplete extends Input {
'where', 'where',
'order', 'order',
'limit', 'limit',
'params', 'searchFunction'
'searchFunction',
'paramsFunction'
]); ]);
} }
@ -304,10 +302,8 @@ ngModule.component('vnAutocomplete', {
where: '<?', where: '<?',
order: '@?', order: '@?',
limit: '<?', limit: '<?',
params: '<?',
translateFields: '<?', translateFields: '<?',
searchFunction: '&?', searchFunction: '&?'
paramsFunction: '&?'
}, },
transclude: { transclude: {
tplItem: '?tplItem' tplItem: '?tplItem'

View File

@ -404,19 +404,11 @@ export default class DropDown extends Component {
order, order,
limit: this.limit || 8 limit: this.limit || 8
}; };
let params = Object.assign({}, this.params);
if (model instanceof CrudModel) { if (model instanceof CrudModel) {
let searchExpr = null; let searchExpr = this._search == null
let searchParams = {$search: this._search}; ? null
: this.searchFunction({$search: this._search});
if (this._search != null) {
if (this.searchFunction)
searchExpr = this.searchFunction(searchParams);
if (this.paramsFunction)
Object.assign(params, this.paramsFunction(searchParams));
}
Object.assign(filter, { Object.assign(filter, {
fields: this.getFields(), fields: this.getFields(),
@ -425,10 +417,10 @@ export default class DropDown extends Component {
}); });
} else if (model instanceof ArrayModel) { } else if (model instanceof ArrayModel) {
if (this._search != null) if (this._search != null)
filter.where = this.searchFunction(searchParams); filter.where = this.searchFunction({$search: this._search});
} }
return this.model.applyFilter(filter, params); return this.model.applyFilter(filter);
} }
searchFunction(scope) { searchFunction(scope) {
@ -484,9 +476,7 @@ ngModule.component('vnDropDown', {
where: '<?', where: '<?',
order: '@?', order: '@?',
limit: '<?', limit: '<?',
params: '<?', searchFunction: '&?'
searchFunction: '&?',
paramsFunction: '&?'
}, },
transclude: { transclude: {
tplItem: '?tplItem' tplItem: '?tplItem'