59 lines
869 B
JavaScript
59 lines
869 B
JavaScript
import { FieldInput } from "./FieldInput.js";
|
|
|
|
/**
|
|
* Represents any key-value pair in any type of DNS-record
|
|
* Used for validation and to create input fields on DNS creator pages
|
|
*/
|
|
export class Field {
|
|
displayName = null;
|
|
description = null;
|
|
categoryName = null;
|
|
isHidden = false;
|
|
isDisabled = false;
|
|
|
|
constructor(key) {
|
|
this.key = key;
|
|
}
|
|
|
|
createInput(parentElem) {
|
|
return new FieldInput(this, parentElem);
|
|
}
|
|
|
|
// Virtual methods
|
|
|
|
getInputHtml() {
|
|
return null;
|
|
}
|
|
|
|
getInputValue() {
|
|
return null;
|
|
}
|
|
|
|
// Builder methods
|
|
|
|
label(label) {
|
|
this.displayName = label;
|
|
return this;
|
|
}
|
|
|
|
desc(description) {
|
|
this.description = description;
|
|
return this;
|
|
}
|
|
|
|
category(category) {
|
|
this.categoryName = category;
|
|
return this;
|
|
}
|
|
|
|
hidden() {
|
|
this.isHidden = true;
|
|
return this;
|
|
}
|
|
|
|
disabled() {
|
|
this.isDisabled = true;
|
|
return this;
|
|
}
|
|
}
|