email-dns-tools/assets/scripts/Field.js

48 lines
668 B
JavaScript

/**
* Defines any key-value pair in any type of DNS-record
* Used for input fields on DNS creator pages
*/
export class Field {
displayName = null;
description = null;
categoryName = null;
isHidden = false;
constructor(key) {
this.key = key;
this.id = "field-" + key;
}
// 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;
}
}