UNPKG

@dooboostore/dom-render

Version:
17 lines 836 B
import { ValidatorArray } from './ValidatorArray'; export class IncludeCheckedValidatorArray extends ValidatorArray { constructor(include, allRequired = false, value, target, event, autoValid = true) { super(value, target, event, autoValid); this.include = include; this.allRequired = allRequired; } valid() { var _a; const valus = (_a = this.value) !== null && _a !== void 0 ? _a : []; const checkedValue = valus.filter(it => it.checked).map(it => it.value); return checkedValue.length > 0 && (!(checkedValue.filter(it => !this.include.includes(it)).length > 0)) && (this.allRequired ? checkedValue.filter(it => this.include.includes(it)).length === this.include.length : true); } } //# sourceMappingURL=IncludeCheckedValidatorArray.js.map