import { Component } from '@angular/core'; import { ControlWidget } from '@delon/form'; @Component({ selector: 'sl-noun', template: ` `, preserveWhitespaces: false, styles: [ ` .number-input { width: calc(50% - 15px); } `, ], }) // tslint:disable-next-line: component-class-suffix export class NounWidget extends ControlWidget { static readonly KEY = 'noun'; min!: number | null; max!: number | null; val: any[] = []; _change(value: any, index: number) { if (value.toString().trim() === '') { value = null; } if (index === 0) { this.min = value; } if (index === 1) { this.max = value; } this.val[index] = value; if (this.val.length === 2 && this.val[0] !== null && this.val[1] !== null) { this.setValue(this.val); } else { this.setValue(null); } } reset(value: string) { this.min = null; this.max = null; } }