mirror of
https://github.com/dzeiocom/FormManager.git
synced 2025-06-23 15:59:21 +00:00
Fix tsc
errors
1 error is still here because I don't know why it popup Signed-off-by: Avior <florian.bouillon@delta-wings.net>
This commit is contained in:
@ -234,7 +234,7 @@ export default class FormManager {
|
|||||||
public fillFromURI(uri: string, callback?: () => void) {
|
public fillFromURI(uri: string, callback?: () => void) {
|
||||||
let ajax = new XMLHttpRequest
|
let ajax = new XMLHttpRequest
|
||||||
ajax.open("GET", uri, true)
|
ajax.open("GET", uri, true)
|
||||||
ajax.addEventListener("loadend", (e) => {
|
ajax.addEventListener("loadend", () => {
|
||||||
if (ajax.readyState === 4 && ajax.status === 200) {
|
if (ajax.readyState === 4 && ajax.status === 200) {
|
||||||
let json = JSON.parse(ajax.responseText)
|
let json = JSON.parse(ajax.responseText)
|
||||||
this.fillFromJSON(json)
|
this.fillFromJSON(json)
|
||||||
@ -288,14 +288,12 @@ export default class FormManager {
|
|||||||
*/
|
*/
|
||||||
public clear() {
|
public clear() {
|
||||||
if (this.attributeManager.trigger(AttributeListeners.PRE_CLEAR) === false) return
|
if (this.attributeManager.trigger(AttributeListeners.PRE_CLEAR) === false) return
|
||||||
(this.form.querySelectorAll("[name]") as NodeListOf<HTMLInputElement>).forEach((el: HTMLInputElement) => {
|
for (const name in this.inputs) {
|
||||||
for (const name in this.inputs) {
|
if (this.inputs.hasOwnProperty(name)) {
|
||||||
if (this.inputs.hasOwnProperty(name)) {
|
const input = this.inputs[name];
|
||||||
const input = this.inputs[name];
|
input.setValue(undefined)
|
||||||
input.setValue(undefined)
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
})
|
}
|
||||||
this.attributeManager.trigger(AttributeListeners.POST_CLEAR)
|
this.attributeManager.trigger(AttributeListeners.POST_CLEAR)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -25,7 +25,7 @@ import AttributeIdentity from "./Interfaces/AttributeIdentity";
|
|||||||
*/
|
*/
|
||||||
export default class AutosetAttribute
|
export default class AutosetAttribute
|
||||||
extends AttributeAbstract {
|
extends AttributeAbstract {
|
||||||
public trigger(event: AttributeListeners, data?: any): boolean | void | object {
|
public trigger(): boolean | void | object {
|
||||||
|
|
||||||
let str = this.input.element.getAttribute("data-autoset") || ""
|
let str = this.input.element.getAttribute("data-autoset") || ""
|
||||||
if (evalF(str, (ster) => {this.input.setValue(ster)})) return
|
if (evalF(str, (ster) => {this.input.setValue(ster)})) return
|
||||||
|
@ -25,7 +25,7 @@ import AttributeIdentity from "./Interfaces/AttributeIdentity";
|
|||||||
*/
|
*/
|
||||||
export default class DefaultAttribute
|
export default class DefaultAttribute
|
||||||
extends AttributeAbstract {
|
extends AttributeAbstract {
|
||||||
public trigger(event: AttributeListeners, data?: any): boolean | void | object {
|
public trigger(): boolean | void | object {
|
||||||
this.run()
|
this.run()
|
||||||
return true
|
return true
|
||||||
}
|
}
|
||||||
|
@ -34,7 +34,7 @@ export default class RepeatInput extends DefaultInput {
|
|||||||
})
|
})
|
||||||
|
|
||||||
// Observer to handle attributes changes
|
// Observer to handle attributes changes
|
||||||
const observer = new MutationObserver((mutationList: any, observer: any) => {
|
const observer = new MutationObserver((mutationList: any) => {
|
||||||
for (let mutation of mutationList) {
|
for (let mutation of mutationList) {
|
||||||
if (mutation.type === 'attributes' && mutation.attributeName === "disabled") {
|
if (mutation.type === 'attributes' && mutation.attributeName === "disabled") {
|
||||||
(this.element.querySelectorAll(".fmr-add, .fmr-del") as NodeListOf<HTMLElement>).forEach((el: HTMLElement) => {
|
(this.element.querySelectorAll(".fmr-add, .fmr-del") as NodeListOf<HTMLElement>).forEach((el: HTMLElement) => {
|
||||||
|
@ -11,7 +11,7 @@ export default class SelectInput extends DefaultInput {
|
|||||||
|
|
||||||
public formatValue(value: any): any {
|
public formatValue(value: any): any {
|
||||||
if (typeof value === "undefined") {
|
if (typeof value === "undefined") {
|
||||||
const opt: HTMLOptionElement = this.element.querySelector("option[selected]")
|
const opt: HTMLOptionElement|null = this.element.querySelector("option[selected]")
|
||||||
if (opt) {
|
if (opt) {
|
||||||
return opt.value
|
return opt.value
|
||||||
}
|
}
|
||||||
|
Reference in New Issue
Block a user