From 85299063395ae3ddc3237b68839609ee1cff3798 Mon Sep 17 00:00:00 2001 From: nobilo Date: Wed, 28 Jul 2021 11:39:43 +0200 Subject: [PATCH] fix(): #314, bal-file-upload: clear state of html input file on change to fix the bug, emit change event only if list of files changed - not if rejection happened --- packages/components/package-lock.json | 10 ---- .../bal-file-upload/bal-file-upload.tsx | 9 ++-- packages/testing/package-lock.json | 47 +------------------ 3 files changed, 8 insertions(+), 58 deletions(-) diff --git a/packages/components/package-lock.json b/packages/components/package-lock.json index 0b12f9a31f..b44f133fe9 100644 --- a/packages/components/package-lock.json +++ b/packages/components/package-lock.json @@ -350,16 +350,6 @@ "integrity": "sha512-kCto783YapOwu0b4c6NYrwEUdv5FipitZhQHM6x2HHRixhlKqhrraIe9YMZrPu1/ZcjdmIKj0jVwLa2722jhrw==", "dev": true }, - "@baloise/design-system-fonts": { - "version": "1.0.1", - "resolved": "https://registry.npmjs.org/@baloise/design-system-fonts/-/design-system-fonts-1.0.1.tgz", - "integrity": "sha512-M+ednxwXukKOiMrUA8G9rUAAbe6y6EOUfPEnkW6M+nnu4ias+PkJTuuraGz7DRpsX7iX11Pci+wZnDnxl0F+lQ==" - }, - "@baloise/design-system-icons": { - "version": "1.0.1", - "resolved": "https://registry.npmjs.org/@baloise/design-system-icons/-/design-system-icons-1.0.1.tgz", - "integrity": "sha512-iRKu8V1dHiecUZ6AumyTKMbZhBTTMys4XSv3lUPuuL728ysjLWPepZgmotsJQFYXN1S+WbRWPbtZIvUAuqmDfQ==" - }, "@baloise/vue-output-target": { "version": "0.1.3", "resolved": "https://registry.npmjs.org/@baloise/vue-output-target/-/vue-output-target-0.1.3.tgz", diff --git a/packages/components/src/components/bal-file-upload/bal-file-upload.tsx b/packages/components/src/components/bal-file-upload/bal-file-upload.tsx index 43366e67d9..a8bf53440a 100644 --- a/packages/components/src/components/bal-file-upload/bal-file-upload.tsx +++ b/packages/components/src/components/bal-file-upload/bal-file-upload.tsx @@ -134,8 +134,10 @@ export class FileUpload { } } } - this.files = [...list] - this.balChangeEventEmitter.emit(this.files) + if(this.files.length !== list.length) { + this.files = [...list] + this.balChangeEventEmitter.emit(this.files) + } } } @@ -172,9 +174,10 @@ export class FileUpload { } onChange = (): void => { - if ((this.fileInput, this.fileInput.files)) { + if (this.fileInput?.files) { const files = this.fileInput.files this.handleFiles(files) + this.fileInput.value = '' } } diff --git a/packages/testing/package-lock.json b/packages/testing/package-lock.json index 4efcf49b86..f697ec8c6c 100644 --- a/packages/testing/package-lock.json +++ b/packages/testing/package-lock.json @@ -4,30 +4,6 @@ "lockfileVersion": 1, "requires": true, "dependencies": { - "@baloise/design-system-components": { - "version": "1.3.0", - "resolved": "https://registry.npmjs.org/@baloise/design-system-components/-/design-system-components-1.3.0.tgz", - "integrity": "sha512-V54DE8rrgsUL4xgDChEHwK10dwvSCd4ryQdwAjIsGJbtDuzQI0vIvgTCYpHBQPPWUJgY0vFC0Wsm2BabjnmvzA==", - "requires": { - "@baloise/design-system-fonts": "^1.3.0", - "@baloise/design-system-icons": "^1.3.0", - "@stencil/core": "^2.5.2", - "@types/lodash": "^4.14.169", - "bulma": "^0.9.2", - "filesize.js": "^2.0.0", - "lodash": "^4.17.21" - } - }, - "@baloise/design-system-fonts": { - "version": "1.3.0", - "resolved": "https://registry.npmjs.org/@baloise/design-system-fonts/-/design-system-fonts-1.3.0.tgz", - "integrity": "sha512-qqUvdhXz6UiIfPwsYFHwQ4tvTyyhbdF/lKd5kglc5ezgJpxmP21Sste2j2FAA3jtB/YFWyuzE1cRitFs7XnOzQ==" - }, - "@baloise/design-system-icons": { - "version": "1.3.0", - "resolved": "https://registry.npmjs.org/@baloise/design-system-icons/-/design-system-icons-1.3.0.tgz", - "integrity": "sha512-3bZNotbLXLCbJEF/eO1QGrRxihcO8Aly2Oj6QZs5vli5QTbPHo1mv1IQObyTLmdS7KrEgw9D49hvCi7IKNY9Lw==" - }, "@cypress/listr-verbose-renderer": { "version": "0.4.1", "resolved": "https://registry.npmjs.org/@cypress/listr-verbose-renderer/-/listr-verbose-renderer-0.4.1.tgz", @@ -155,11 +131,6 @@ "integrity": "sha512-RNiOoTPkptFtSVzQevY/yWtZwf/RxyVnPy/OcA9HBM3MlGDnBEYL5B41H0MTn0Uec8Hi+2qUtTfG2WWZBmMejQ==", "dev": true }, - "@stencil/core": { - "version": "2.6.0", - "resolved": "https://registry.npmjs.org/@stencil/core/-/core-2.6.0.tgz", - "integrity": "sha512-QsxWayZyusnqSZrlCl81R71rA3KqFjVVQSH4E0rGN15F1GdQaFonKlHLyCOLKLig1zzC+DQkLLiUuocexuvdeQ==" - }, "@types/chai": { "version": "4.2.18", "resolved": "https://registry.npmjs.org/@types/chai/-/chai-4.2.18.tgz", @@ -175,11 +146,6 @@ "@types/sizzle": "*" } }, - "@types/lodash": { - "version": "4.14.170", - "resolved": "https://registry.npmjs.org/@types/lodash/-/lodash-4.14.170.tgz", - "integrity": "sha512-bpcvu/MKHHeYX+qeEN8GE7DIravODWdACVA1ctevD8CN24RhPZIKMn9ntfAsrvLfSX3cR5RrBKAbYm9bGs0A+Q==" - }, "@types/node": { "version": "14.14.44", "resolved": "https://registry.npmjs.org/@types/node/-/node-14.14.44.tgz", @@ -355,11 +321,6 @@ "integrity": "sha512-MQcXEUbCKtEo7bhqEs6560Hyd4XaovZlO/k9V3hjVUF/zwW7KBVdSK4gIt/bzwS9MbR5qob+F5jusZsb0YQK2A==", "dev": true }, - "bulma": { - "version": "0.9.3", - "resolved": "https://registry.npmjs.org/bulma/-/bulma-0.9.3.tgz", - "integrity": "sha512-0d7GNW1PY4ud8TWxdNcP6Cc8Bu7MxcntD/RRLGWuiw/s0a9P+XlH/6QoOIrmbj6o8WWJzJYhytiu9nFjTszk1g==" - }, "cachedir": { "version": "2.3.0", "resolved": "https://registry.npmjs.org/cachedir/-/cachedir-2.3.0.tgz", @@ -839,11 +800,6 @@ "object-assign": "^4.1.0" } }, - "filesize.js": { - "version": "2.0.0", - "resolved": "https://registry.npmjs.org/filesize.js/-/filesize.js-2.0.0.tgz", - "integrity": "sha512-dOngzfsRfjwTQkG3UPY3GI+OqbBj4mO1UW1FoDYN2SF/p7hACKXHKGjgA62ug4KtORXcXdlEKOXrgfzt+qB2Nw==" - }, "follow-redirects": { "version": "1.13.2", "resolved": "https://registry.npmjs.org/follow-redirects/-/follow-redirects-1.13.2.tgz", @@ -1399,7 +1355,8 @@ "lodash": { "version": "4.17.21", "resolved": "https://registry.npmjs.org/lodash/-/lodash-4.17.21.tgz", - "integrity": "sha512-v2kDEe57lecTulaDIuNTPy3Ry4gLGJ6Z1O3vE1krgXZNrsQ+LFTGHVxVjcXPs17LhbZVGedAJv8XZ1tvj5FvSg==" + "integrity": "sha512-v2kDEe57lecTulaDIuNTPy3Ry4gLGJ6Z1O3vE1krgXZNrsQ+LFTGHVxVjcXPs17LhbZVGedAJv8XZ1tvj5FvSg==", + "dev": true }, "lodash.once": { "version": "4.1.1",