diff options
Diffstat (limited to 'catalog-ui/src/app/models/ui-models')
-rw-r--r-- | catalog-ui/src/app/models/ui-models/constraint-object-ui.ts | 26 |
1 files changed, 26 insertions, 0 deletions
diff --git a/catalog-ui/src/app/models/ui-models/constraint-object-ui.ts b/catalog-ui/src/app/models/ui-models/constraint-object-ui.ts new file mode 100644 index 0000000000..48cf2abdc6 --- /dev/null +++ b/catalog-ui/src/app/models/ui-models/constraint-object-ui.ts @@ -0,0 +1,26 @@ +import {FilterConstraint} from "../filter-constraint"; + +export class ConstraintObjectUI extends FilterConstraint { + isValidValue: boolean; + + constructor(input?: any) { + super(input); + if (input) { + this.isValidValue = input.isValidValue ? input.isValidValue : input.value !== ''; + } + } + + public updateValidity(isValidValue: boolean) { + this.isValidValue = isValidValue; + } + + public isValidRule() { + const isValidValue = this.isStatic() ? this.isValidValue : true; + return this.servicePropertyName != null && this.servicePropertyName !== '' + && this.value != null && this.value !== '' && isValidValue; + } + + private isStatic() { + return this.sourceName === 'static'; + } +}
\ No newline at end of file |