@dooboostore/dom-render
Version:
html view template engine
17 lines • 845 B
JavaScript
import { ValidatorArray } from './ValidatorArray';
export class ExcludeCheckedValidatorArray 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 unCheckedValue = valus.filter(it => !it.checked).map(it => it.value);
return unCheckedValue.length > 0 &&
(!(unCheckedValue.filter(it => !this.include.includes(it)).length > 0)) &&
(this.allRequired ? unCheckedValue.filter(it => this.include.includes(it)).length === this.include.length : true);
}
}
//# sourceMappingURL=ExcludeCheckedValidatorArray.js.map