Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

@uppy/form

Package Overview
Dependencies
Maintainers
5
Versions
81
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@uppy/form - npm Package Compare versions

Comparing version 4.0.0-beta.3 to 4.0.0-beta.4

7

CHANGELOG.md
# @uppy/form
## 4.0.0-beta.4
Released: 2024-06-04
Included in: Uppy v4.0.0-beta.10
- @uppy/form: move internal property to private field (Antoine du Hamel / #5214)
## 4.0.0-beta.2

@@ -4,0 +11,0 @@

1

lib/index.d.ts

@@ -23,3 +23,2 @@ import BasePlugin, { type DefinePluginOpts } from '@uppy/core/lib/BasePlugin.js';

static VERSION: any;
form: HTMLFormElement;
constructor(uppy: Uppy<M, B>, opts?: FormOptions);

@@ -26,0 +25,0 @@ handleUploadStart(): void;

@@ -1,4 +0,4 @@

function _classPrivateFieldLooseBase(receiver, privateKey) { if (!Object.prototype.hasOwnProperty.call(receiver, privateKey)) { throw new TypeError("attempted to use private field on non-instance"); } return receiver; }
function _classPrivateFieldLooseBase(e, t) { if (!{}.hasOwnProperty.call(e, t)) throw new TypeError("attempted to use private field on non-instance"); return e; }
var id = 0;
function _classPrivateFieldLooseKey(name) { return "__private_" + id++ + "_" + name; }
function _classPrivateFieldLooseKey(e) { return "__private_" + id++ + "_" + e; }
import BasePlugin from '@uppy/core/lib/BasePlugin.js';

@@ -14,3 +14,3 @@ import findDOMElement from '@uppy/utils/lib/findDOMElement';

const packageJson = {
"version": "4.0.0-beta.3"
"version": "4.0.0-beta.4"
};

@@ -32,2 +32,3 @@ const defaultOptions = {

}
var _form = /*#__PURE__*/_classPrivateFieldLooseKey("form");
var _completed = /*#__PURE__*/_classPrivateFieldLooseKey("completed");

@@ -40,3 +41,6 @@ export default class Form extends BasePlugin {

});
// TODO: make this private (or at least, mark it as readonly)
Object.defineProperty(this, _form, {
writable: true,
value: void 0
});
/**

@@ -70,3 +74,3 @@ * Unfortunately Uppy isn't a state machine in which we can guarantee it's

if (this.opts.submitOnSuccess) {
this.form.requestSubmit();
_classPrivateFieldLooseBase(this, _form)[_form].requestSubmit();
}

@@ -104,3 +108,3 @@ }

this.uppy.log(result);
let resultInput = this.form.querySelector(`[name="${this.opts.resultName}"]`);
let resultInput = _classPrivateFieldLooseBase(this, _form)[_form].querySelector(`[name="${this.opts.resultName}"]`);
if (resultInput) {

@@ -127,6 +131,6 @@ // Append new result to the previous result array.

resultInput.value = JSON.stringify([result]);
this.form.appendChild(resultInput);
_classPrivateFieldLooseBase(this, _form)[_form].appendChild(resultInput);
}
getMetaFromForm() {
const formMeta = getFormData(this.form);
const formMeta = getFormData(_classPrivateFieldLooseBase(this, _form)[_form]);
// We want to exclude meta the the Form plugin itself has added

@@ -138,4 +142,4 @@ // See https://github.com/transloadit/uppy/issues/1637

install() {
this.form = assertHTMLFormElement(findDOMElement(this.opts.target));
this.form.addEventListener('submit', this.handleFormSubmit);
_classPrivateFieldLooseBase(this, _form)[_form] = assertHTMLFormElement(findDOMElement(this.opts.target));
_classPrivateFieldLooseBase(this, _form)[_form].addEventListener('submit', this.handleFormSubmit);
this.uppy.on('upload', this.handleUploadStart);

@@ -145,3 +149,3 @@ this.uppy.on('complete', this.handleSuccess);

uninstall() {
this.form.removeEventListener('submit', this.handleFormSubmit);
_classPrivateFieldLooseBase(this, _form)[_form].removeEventListener('submit', this.handleFormSubmit);
this.uppy.off('upload', this.handleUploadStart);

@@ -148,0 +152,0 @@ this.uppy.off('complete', this.handleSuccess);

{
"name": "@uppy/form",
"description": "Connect Uppy to an existing HTML <form>.",
"version": "4.0.0-beta.3",
"version": "4.0.0-beta.4",
"license": "MIT",

@@ -23,9 +23,9 @@ "main": "lib/index.js",

"dependencies": {
"@uppy/utils": "^6.0.0-beta.5",
"@uppy/utils": "^6.0.0-beta.8",
"get-form-data": "^3.0.0"
},
"peerDependencies": {
"@uppy/core": "^4.0.0-beta.5"
"@uppy/core": "^4.0.0-beta.9"
},
"stableVersion": "3.2.0"
}

@@ -53,3 +53,3 @@ import BasePlugin, { type DefinePluginOpts } from '@uppy/core/lib/BasePlugin.js'

form: HTMLFormElement // TODO: make this private (or at least, mark it as readonly)
#form: HTMLFormElement

@@ -88,3 +88,3 @@ /**

if (this.opts.submitOnSuccess) {
this.form.requestSubmit()
this.#form.requestSubmit()
}

@@ -133,3 +133,3 @@ }

let resultInput: HTMLInputElement | null = this.form.querySelector(
let resultInput: HTMLInputElement | null = this.#form.querySelector(
`[name="${this.opts.resultName}"]`,

@@ -161,7 +161,7 @@ )

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

@@ -174,5 +174,5 @@ // See https://github.com/transloadit/uppy/issues/1637

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)

@@ -183,3 +183,3 @@ 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)

@@ -186,0 +186,0 @@ this.uppy.off('complete', this.handleSuccess)

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc