|
|
|
@@ -7,7 +7,7 @@ import {TextBoxComponent} from '@progress/kendo-angular-inputs'; |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
class Operator { op: string; value: string; } |
|
|
|
class Operator { op: string; value: string; description: string; } |
|
|
|
|
|
|
|
@Component({ |
|
|
|
selector: 'app-number-range-filter', |
|
|
|
@@ -23,23 +23,23 @@ export class NumberRangeFilterComponent extends BaseFilterCellComponent implemen |
|
|
|
@Input() public max = -1; |
|
|
|
@Input() public required = false; |
|
|
|
@Input() public fieldName = ''; |
|
|
|
@Input() public options = ['=', '≠', '>', '≥', '<', '≤', '⇩']; |
|
|
|
@Input() public options = ['eq', 'neq', 'gt', 'gte', 'lt', 'lte', 'range']; |
|
|
|
// ngModel control |
|
|
|
@ViewChild('single') ctlSingle: TextBoxComponent; |
|
|
|
@ViewChild('rangeFrom') ctlRangeFrom: TextBoxComponent; |
|
|
|
@ViewChild('rangeTo') ctlRangeTo: TextBoxComponent; |
|
|
|
|
|
|
|
public operator: Operator = {op: '=', value: 'eq'}; |
|
|
|
private defaultOperator: Operator = {op: '=', value: 'eq'}; |
|
|
|
public operator: Operator = {op: '=', value: 'eq', description: 'equal'}; |
|
|
|
private defaultOperator: Operator = {op: '=', value: 'eq', description: 'equal'}; |
|
|
|
public availableOperators: Operator[] = []; |
|
|
|
private AllOperatorMap = [ |
|
|
|
{op: '=', value: 'eq'}, |
|
|
|
{op: '≠', value: 'neq'}, |
|
|
|
{op: '>', value: 'gt'}, |
|
|
|
{op: '≥', value: 'gte'}, |
|
|
|
{op: '<', value: 'lt'}, |
|
|
|
{op: '≤', value: 'lte'}, |
|
|
|
{op: '⇩', value: 'range'} |
|
|
|
{op: '=', value: 'eq', description: 'equal to'}, |
|
|
|
{op: '≠', value: 'neq', description: 'not equal to '}, |
|
|
|
{op: '>', value: 'gt', description: 'greater than'}, |
|
|
|
{op: '≥', value: 'gte', description: 'greater than or equal to'}, |
|
|
|
{op: '<', value: 'lt', description: 'less than'}, |
|
|
|
{op: '≤', value: 'lte', description: 'less than or equal to'}, |
|
|
|
{op: '⇩', value: 'range', description: 'range'} |
|
|
|
]; |
|
|
|
|
|
|
|
public singleMode = true; |
|
|
|
@@ -85,7 +85,10 @@ export class NumberRangeFilterComponent extends BaseFilterCellComponent implemen |
|
|
|
} |
|
|
|
|
|
|
|
private initAvailableOperators(): void { |
|
|
|
this.availableOperators = this.AllOperatorMap.filter( v => this.options.indexOf(v.value) !== -1 ); |
|
|
|
this.availableOperators = this.AllOperatorMap.filter( v => { |
|
|
|
console.log(v, this.options.indexOf(v.value), this.options); |
|
|
|
return this.options.indexOf(v.value) !== -1; |
|
|
|
} ); |
|
|
|
if ( this.availableOperators.length === 0) { |
|
|
|
this.availableOperators = [this.defaultOperator]; |
|
|
|
this.operator = this.defaultOperator; |