fixed catalog filter bugs #1352
This commit is contained in:
parent
2c5dd324ea
commit
d2006e60bb
|
@ -23,7 +23,8 @@
|
||||||
order="name"
|
order="name"
|
||||||
show-field="name"
|
show-field="name"
|
||||||
value-field="field"
|
value-field="field"
|
||||||
label="Order by">
|
label="Order by"
|
||||||
|
disabled="!model.data">
|
||||||
</vn-autocomplete>
|
</vn-autocomplete>
|
||||||
<vn-autocomplete vn-one
|
<vn-autocomplete vn-one
|
||||||
data="$ctrl.wayList"
|
data="$ctrl.wayList"
|
||||||
|
@ -32,7 +33,8 @@
|
||||||
translate-fields="['name']"
|
translate-fields="['name']"
|
||||||
show-field="name"
|
show-field="name"
|
||||||
value-field="way"
|
value-field="way"
|
||||||
label="Order">
|
label="Order"
|
||||||
|
disabled="!model.data">
|
||||||
</vn-autocomplete>
|
</vn-autocomplete>
|
||||||
</vn-auto>
|
</vn-auto>
|
||||||
</vn-horizontal>
|
</vn-horizontal>
|
||||||
|
|
|
@ -74,8 +74,7 @@ class Controller {
|
||||||
set way(value) {
|
set way(value) {
|
||||||
this._way = value;
|
this._way = value;
|
||||||
|
|
||||||
if (value)
|
if (value) this.applyOrder();
|
||||||
this.applyOrder();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -88,8 +87,7 @@ class Controller {
|
||||||
set field(value) {
|
set field(value) {
|
||||||
this._field = value;
|
this._field = value;
|
||||||
|
|
||||||
if (value)
|
if (value) this.applyOrder();
|
||||||
this.applyOrder();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|
|
@ -64,7 +64,7 @@ class Controller {
|
||||||
if (this.tags.length > 0)
|
if (this.tags.length > 0)
|
||||||
this.applyFilters();
|
this.applyFilters();
|
||||||
|
|
||||||
if (value)
|
if (this._category)
|
||||||
this.updateItemTypes();
|
this.updateItemTypes();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -97,8 +97,8 @@ class Controller {
|
||||||
}
|
}
|
||||||
|
|
||||||
onSearchById(event) {
|
onSearchById(event) {
|
||||||
if (event.key !== 'Enter' || !this.itemFk) return;
|
if (event.key === 'Enter' && (this.tags.length > 0 || this.itemFk || this.type))
|
||||||
this.applyFilters();
|
this.applyFilters();
|
||||||
}
|
}
|
||||||
|
|
||||||
onSearchByTag(event) {
|
onSearchByTag(event) {
|
||||||
|
@ -113,7 +113,7 @@ class Controller {
|
||||||
remove(index) {
|
remove(index) {
|
||||||
this.tags.splice(index, 1);
|
this.tags.splice(index, 1);
|
||||||
|
|
||||||
if (this.tags.length == 0 && this.category && this.type)
|
if (this.tags.length >= 0 || this.itemFk || this.type)
|
||||||
this.applyFilters();
|
this.applyFilters();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -137,11 +137,13 @@ describe('Order', () => {
|
||||||
|
|
||||||
describe('remove()', () => {
|
describe('remove()', () => {
|
||||||
it(`should remove a tag from tags property`, () => {
|
it(`should remove a tag from tags property`, () => {
|
||||||
|
spyOn(controller, 'applyFilters');
|
||||||
controller.tags = [{tagFk: 1, value: 'Blue'}, {tagFk: 2, value: '70'}];
|
controller.tags = [{tagFk: 1, value: 'Blue'}, {tagFk: 2, value: '70'}];
|
||||||
controller.remove(0);
|
controller.remove(0);
|
||||||
|
|
||||||
expect(controller.tags.length).toEqual(1);
|
expect(controller.tags.length).toEqual(1);
|
||||||
expect(controller.tags[0].tagFk).toEqual(2);
|
expect(controller.tags[0].tagFk).toEqual(2);
|
||||||
|
expect(controller.applyFilters).toHaveBeenCalledWith();
|
||||||
});
|
});
|
||||||
|
|
||||||
it(`should remove a tag from tags property and call applyFilters() if there's no more tags`, () => {
|
it(`should remove a tag from tags property and call applyFilters() if there's no more tags`, () => {
|
||||||
|
|
Loading…
Reference in New Issue