Socket
Socket
Sign inDemoInstall

@uppy/form

Package Overview
Dependencies
Maintainers
5
Versions
80
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.1 to 4.0.0-beta.2

14

CHANGELOG.md
# @uppy/form
## 4.0.0-beta.2
Released: 2024-04-29
Included in: Uppy v4.0.0-beta.4
- @uppy/form: fix `submitOnSuccess` and `triggerUploadOnSubmit` combination (Merlijn Vos / #5058)
## 3.2.1
Released: 2024-04-29
Included in: Uppy v3.25.0
- @uppy/form: fix `submitOnSuccess` and `triggerUploadOnSubmit` combination (Merlijn Vos / #5058)
## 3.2.0

@@ -4,0 +18,0 @@

1

lib/index.d.ts

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

export default class Form<M extends Meta, B extends Body> extends BasePlugin<Opts, M, B> {
#private;
static VERSION: any;

@@ -23,0 +24,0 @@ form: HTMLFormElement;

@@ -0,1 +1,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; }
var id = 0;
function _classPrivateFieldLooseKey(name) { return "__private_" + id++ + "_" + name; }
import BasePlugin from '@uppy/core/lib/BasePlugin.js';

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

const packageJson = {
"version": "4.0.0-beta.1"
"version": "4.0.0-beta.2"
};

@@ -29,5 +32,4 @@ const defaultOptions = {

}
var _completed = /*#__PURE__*/_classPrivateFieldLooseKey("completed");
export default class Form extends BasePlugin {
// TODO: make this private (or at least, mark it as readonly)
constructor(uppy, opts) {

@@ -38,2 +40,11 @@ super(uppy, {

});
// TODO: make this private (or at least, mark it as readonly)
/**
* Unfortunately Uppy isn't a state machine in which we can guarantee it's
* currently in one state and one state only so we use this completed property which is set on `upload-success'.
*/
Object.defineProperty(this, _completed, {
writable: true,
value: false
});
this.type = 'acquirer';

@@ -48,2 +59,3 @@ this.id = this.opts.id || 'Form';

handleUploadStart() {
_classPrivateFieldLooseBase(this, _completed)[_completed] = false;
if (this.opts.getMetaFromForm) {

@@ -54,2 +66,3 @@ this.getMetaFromForm();

handleSuccess(result) {
_classPrivateFieldLooseBase(this, _completed)[_completed] = true;
if (this.opts.addResultToForm) {

@@ -63,3 +76,3 @@ this.addResultToForm(result);

handleFormSubmit(ev) {
if (this.opts.triggerUploadOnSubmit) {
if (this.opts.triggerUploadOnSubmit && !_classPrivateFieldLooseBase(this, _completed)[_completed]) {
ev.preventDefault();

@@ -66,0 +79,0 @@ const elements = toArray(ev.target.elements);

6

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

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

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

@@ -55,2 +55,8 @@ import BasePlugin, { type DefinePluginOpts } from '@uppy/core/lib/BasePlugin.js'

/**
* Unfortunately Uppy isn't a state machine in which we can guarantee it's
* currently in one state and one state only so we use this completed property which is set on `upload-success'.
*/
#completed = false
constructor(uppy: Uppy<M, B>, opts?: FormOptions) {

@@ -69,2 +75,3 @@ super(uppy, { ...defaultOptions, ...opts })

handleUploadStart(): void {
this.#completed = false
if (this.opts.getMetaFromForm) {

@@ -76,2 +83,3 @@ this.getMetaFromForm()

handleSuccess(result: Result<M, B>): void {
this.#completed = true
if (this.opts.addResultToForm) {

@@ -87,3 +95,3 @@ this.addResultToForm(result)

handleFormSubmit(ev: Event): void {
if (this.opts.triggerUploadOnSubmit) {
if (this.opts.triggerUploadOnSubmit && !this.#completed) {
ev.preventDefault()

@@ -90,0 +98,0 @@ const elements = toArray((ev.target as HTMLFormElement).elements)

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