|
@@ -50,7 +50,7 @@ export default class Form<M extends Meta, B extends Body> extends BasePlugin<
|
|
|
> {
|
|
|
static VERSION = packageJson.version
|
|
|
|
|
|
- form: HTMLFormElement // TODO: make this private (or at least, mark it as readonly)
|
|
|
+ #form: HTMLFormElement
|
|
|
|
|
|
/**
|
|
|
* Unfortunately Uppy isn't a state machine in which we can guarantee it's
|
|
@@ -84,7 +84,7 @@ export default class Form<M extends Meta, B extends Body> extends BasePlugin<
|
|
|
}
|
|
|
|
|
|
if (this.opts.submitOnSuccess) {
|
|
|
- this.form.requestSubmit()
|
|
|
+ this.#form.requestSubmit()
|
|
|
}
|
|
|
}
|
|
|
|
|
@@ -128,7 +128,7 @@ export default class Form<M extends Meta, B extends Body> extends BasePlugin<
|
|
|
this.uppy.log('[Form] Adding result to the original form:')
|
|
|
this.uppy.log(result)
|
|
|
|
|
|
- let resultInput: HTMLInputElement | null = this.form.querySelector(
|
|
|
+ let resultInput: HTMLInputElement | null = this.#form.querySelector(
|
|
|
`[name="${this.opts.resultName}"]`,
|
|
|
)
|
|
|
if (resultInput) {
|
|
@@ -155,11 +155,11 @@ export default class Form<M extends Meta, B extends Body> extends BasePlugin<
|
|
|
resultInput.type = 'hidden'
|
|
|
resultInput.value = JSON.stringify([result])
|
|
|
|
|
|
- this.form.appendChild(resultInput)
|
|
|
+ this.#form.appendChild(resultInput)
|
|
|
}
|
|
|
|
|
|
getMetaFromForm(): void {
|
|
|
- const formMeta = getFormData(this.form)
|
|
|
+ const formMeta = getFormData(this.#form)
|
|
|
// We want to exclude meta the the Form plugin itself has added
|
|
|
// See https://github.com/transloadit/uppy/issues/1637
|
|
|
delete formMeta[this.opts.resultName]
|
|
@@ -167,15 +167,15 @@ export default class Form<M extends Meta, B extends Body> extends BasePlugin<
|
|
|
}
|
|
|
|
|
|
install(): void {
|
|
|
- this.form = assertHTMLFormElement(findDOMElement(this.opts.target))
|
|
|
+ this.#form = assertHTMLFormElement(findDOMElement(this.opts.target))
|
|
|
|
|
|
- this.form.addEventListener('submit', this.handleFormSubmit)
|
|
|
+ this.#form.addEventListener('submit', this.handleFormSubmit)
|
|
|
this.uppy.on('upload', this.handleUploadStart)
|
|
|
this.uppy.on('complete', this.handleSuccess)
|
|
|
}
|
|
|
|
|
|
uninstall(): void {
|
|
|
- this.form.removeEventListener('submit', this.handleFormSubmit)
|
|
|
+ this.#form.removeEventListener('submit', this.handleFormSubmit)
|
|
|
this.uppy.off('upload', this.handleUploadStart)
|
|
|
this.uppy.off('complete', this.handleSuccess)
|
|
|
}
|