34 lines
437 B
JavaScript
34 lines
437 B
JavaScript
export class Field {
|
|
isRequired = false;
|
|
defaultValue = null;
|
|
requiredIndex = null;
|
|
afterFieldName = null;
|
|
|
|
constructor(key) {
|
|
this.key = key;
|
|
}
|
|
|
|
validate() {
|
|
return true;
|
|
}
|
|
|
|
required() {
|
|
this.isRequired = true;
|
|
return this;
|
|
}
|
|
|
|
default(value) {
|
|
this.defaultValue = value;
|
|
return this;
|
|
}
|
|
|
|
atIndex(i) {
|
|
this.requiredIndex = i;
|
|
return this;
|
|
}
|
|
|
|
after(field) {
|
|
this.afterFieldName = field;
|
|
return this;
|
|
}
|
|
} |