@iamproperty/components 5.6.1-beta10 → 5.6.1-beta11
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/assets/css/core.min.css +1 -1
- package/assets/css/core.min.css.map +1 -1
- package/assets/css/style.min.css +1 -1
- package/assets/css/style.min.css.map +1 -1
- package/assets/js/components/accordion/accordion.component.min.js +1 -1
- package/assets/js/components/actionbar/actionbar.component.min.js +1 -1
- package/assets/js/components/address-lookup/address-lookup.component.min.js +1 -1
- package/assets/js/components/applied-filters/applied-filters.component.min.js +1 -1
- package/assets/js/components/card/card.component.min.js +1 -1
- package/assets/js/components/carousel/carousel.component.min.js +1 -1
- package/assets/js/components/collapsible-side/collapsible-side.component.min.js +1 -1
- package/assets/js/components/fileupload/fileupload.component.js +16 -0
- package/assets/js/components/fileupload/fileupload.component.min.js +6 -4
- package/assets/js/components/fileupload/fileupload.component.min.js.map +1 -1
- package/assets/js/components/filterlist/filterlist.component.min.js +1 -1
- package/assets/js/components/header/header.component.min.js +1 -1
- package/assets/js/components/inline-edit/inline-edit.component.min.js +1 -1
- package/assets/js/components/marketing/marketing.component.min.js +1 -1
- package/assets/js/components/multiselect/multiselect.component.min.js +1 -1
- package/assets/js/components/nav/nav.component.min.js +1 -1
- package/assets/js/components/notification/notification.component.min.js +1 -1
- package/assets/js/components/pagination/pagination.component.min.js +1 -1
- package/assets/js/components/search/search.component.min.js +1 -1
- package/assets/js/components/slider/slider.component.min.js +1 -1
- package/assets/js/components/table/table.component.min.js +1 -1
- package/assets/js/components/tabs/tabs.component.min.js +1 -1
- package/assets/js/dynamic.min.js +1 -1
- package/assets/js/modules/fileupload.js +30 -15
- package/assets/js/scripts.bundle.js +1 -1
- package/assets/js/scripts.bundle.min.js +1 -1
- package/assets/sass/elements/dialog.scss +1 -1
- package/assets/ts/components/fileupload/fileupload.component.ts +26 -0
- package/assets/ts/modules/fileupload.ts +42 -17
- package/dist/components.es.js +9 -9
- package/dist/components.umd.js +41 -39
- package/package.json +1 -1
|
@@ -5,6 +5,8 @@ function fileupload(fileupload: Element, wrapper: Element) {
|
|
|
5
5
|
const dropArea = wrapper.querySelector('.drop-area');
|
|
6
6
|
const input = fileupload.querySelector('input');
|
|
7
7
|
const maxSize = fileupload.hasAttribute('data-maxsize') ? fileupload.getAttribute('data-maxsize') : 0;
|
|
8
|
+
const errorMsgSize = wrapper.querySelector('.invalid-feedback.size');
|
|
9
|
+
const errorMsgExt = wrapper.querySelector('.invalid-feedback.ext');
|
|
8
10
|
|
|
9
11
|
// We clone the input field to work as a buffer input field, this allows us to add new files without losing the old ones
|
|
10
12
|
const cloneInput = input.cloneNode();
|
|
@@ -17,7 +19,7 @@ function fileupload(fileupload: Element, wrapper: Element) {
|
|
|
17
19
|
const button = event.target.closest('.btn-primary');
|
|
18
20
|
|
|
19
21
|
// If the input allows multiples then use the buffer clone input
|
|
20
|
-
const inputTrigger =
|
|
22
|
+
const inputTrigger = cloneInput;
|
|
21
23
|
|
|
22
24
|
inputTrigger.click();
|
|
23
25
|
}
|
|
@@ -56,33 +58,54 @@ function fileupload(fileupload: Element, wrapper: Element) {
|
|
|
56
58
|
}
|
|
57
59
|
});
|
|
58
60
|
|
|
61
|
+
|
|
62
|
+
let checkFileExt = function(filename){
|
|
63
|
+
|
|
64
|
+
if(!input.hasAttribute('accept'))
|
|
65
|
+
return true;
|
|
66
|
+
|
|
67
|
+
const nameExtension = filename.split('.').pop();
|
|
68
|
+
const acceptedTypes = input.getAttribute('accept');
|
|
69
|
+
|
|
70
|
+
if(acceptedTypes.includes(nameExtension))
|
|
71
|
+
return true;
|
|
72
|
+
|
|
73
|
+
return false;
|
|
74
|
+
}
|
|
75
|
+
|
|
59
76
|
// Buffer input change event
|
|
60
77
|
cloneInput.addEventListener('change', (event) => {
|
|
61
78
|
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
79
|
+
errorMsgExt.classList.remove('d-block');
|
|
80
|
+
errorMsgSize.classList.remove('d-block');
|
|
81
|
+
const filesArray = [...input.files, ...cloneInput.files];
|
|
82
|
+
|
|
83
|
+
let fileNames = [];
|
|
66
84
|
|
|
67
|
-
|
|
85
|
+
const dt = new DataTransfer();
|
|
68
86
|
|
|
69
|
-
|
|
70
|
-
|
|
87
|
+
for (let i = 0; i < filesArray.length; i++) {
|
|
88
|
+
const file = filesArray[i]
|
|
71
89
|
|
|
72
|
-
|
|
90
|
+
const size = file.size/1000;
|
|
73
91
|
|
|
74
|
-
|
|
75
|
-
|
|
92
|
+
if(!fileNames.includes(file.name) && (maxSize == 0 || size < maxSize) && checkFileExt(file.name))
|
|
93
|
+
dt.items.add(file) // here you exclude the file. thus removing it.
|
|
76
94
|
|
|
77
|
-
|
|
95
|
+
|
|
96
|
+
if(!checkFileExt(file.name)){
|
|
97
|
+
errorMsgExt.classList.add('d-block');
|
|
78
98
|
}
|
|
79
99
|
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
100
|
+
if(size > maxSize){
|
|
101
|
+
errorMsgSize.classList.add('d-block');
|
|
102
|
+
}
|
|
103
|
+
|
|
104
|
+
|
|
105
|
+
fileNames.push(file.name);
|
|
85
106
|
}
|
|
107
|
+
|
|
108
|
+
input.files = dt.files;
|
|
86
109
|
|
|
87
110
|
const changeEvent = new Event('change');
|
|
88
111
|
input.dispatchEvent(changeEvent);
|
|
@@ -118,6 +141,8 @@ function fileupload(fileupload: Element, wrapper: Element) {
|
|
|
118
141
|
|
|
119
142
|
if(fileupload.hasAttribute('data-filename')){
|
|
120
143
|
|
|
144
|
+
filesWrapper.innerHTML = '';
|
|
145
|
+
|
|
121
146
|
let filename = fileupload.getAttribute('data-filename');
|
|
122
147
|
|
|
123
148
|
if(filename)
|
package/dist/components.es.js
CHANGED
|
@@ -453,7 +453,7 @@ const N = /* @__PURE__ */ m(ne, [["render", Le]]), Se = {
|
|
|
453
453
|
},
|
|
454
454
|
created() {
|
|
455
455
|
this.$nextTick(function() {
|
|
456
|
-
import("./fileupload.component.min-
|
|
456
|
+
import("./fileupload.component.min-d04c9cbf.mjs").then((t) => {
|
|
457
457
|
window.customElements.get("iam-fileupload") || window.customElements.define("iam-fileupload", t.default);
|
|
458
458
|
}).catch((t) => {
|
|
459
459
|
console.log(t.message);
|
|
@@ -483,7 +483,7 @@ const qe = {
|
|
|
483
483
|
props: {},
|
|
484
484
|
mounted() {
|
|
485
485
|
this.$nextTick(function() {
|
|
486
|
-
import("./accordion.component.min-
|
|
486
|
+
import("./accordion.component.min-0f3749d3.mjs").then((t) => {
|
|
487
487
|
window.customElements.get("iam-accordion") || window.customElements.define("iam-accordion", t.default);
|
|
488
488
|
}).catch((t) => {
|
|
489
489
|
console.log(t.message);
|
|
@@ -619,7 +619,7 @@ const Va = /* @__PURE__ */ m(ze, [["render", Be]]), Oe = {
|
|
|
619
619
|
},
|
|
620
620
|
mounted() {
|
|
621
621
|
this.$nextTick(function() {
|
|
622
|
-
import("./carousel.component.min-
|
|
622
|
+
import("./carousel.component.min-f4ba4195.mjs").then((t) => {
|
|
623
623
|
window.customElements.get("iam-carousel") || window.customElements.define("iam-carousel", t.default);
|
|
624
624
|
}).catch((t) => {
|
|
625
625
|
console.log(t.message);
|
|
@@ -646,7 +646,7 @@ const Fa = /* @__PURE__ */ m(Oe, [["render", Ue]]), We = {
|
|
|
646
646
|
},
|
|
647
647
|
mounted() {
|
|
648
648
|
this.$nextTick(function() {
|
|
649
|
-
import("./header.component.min-
|
|
649
|
+
import("./header.component.min-0983036c.mjs").then((t) => {
|
|
650
650
|
window.customElements.get("iam-header") || window.customElements.define("iam-header", t.default);
|
|
651
651
|
}).catch((t) => {
|
|
652
652
|
console.log(t.message);
|
|
@@ -1042,7 +1042,7 @@ const Ua = /* @__PURE__ */ m(yt, [["render", Et]]), Ht = {
|
|
|
1042
1042
|
name: "Nav",
|
|
1043
1043
|
mounted() {
|
|
1044
1044
|
this.$nextTick(function() {
|
|
1045
|
-
import("./nav.component.min-
|
|
1045
|
+
import("./nav.component.min-8947100c.mjs").then((t) => {
|
|
1046
1046
|
window.customElements.get("iam-nav") || window.customElements.define("iam-nav", t.default);
|
|
1047
1047
|
}).catch((t) => {
|
|
1048
1048
|
console.log(t.message);
|
|
@@ -1162,7 +1162,7 @@ const Xt = {
|
|
|
1162
1162
|
name: "Tabs",
|
|
1163
1163
|
created() {
|
|
1164
1164
|
this.$nextTick(function() {
|
|
1165
|
-
import("./tabs.component.min-
|
|
1165
|
+
import("./tabs.component.min-22fd4142.mjs").then((t) => {
|
|
1166
1166
|
window.customElements.get("iam-tabs") || window.customElements.define("iam-tabs", t.default);
|
|
1167
1167
|
}).catch((t) => {
|
|
1168
1168
|
console.log(t.message);
|
|
@@ -1309,7 +1309,7 @@ function pa(t, a, e, i, r, s) {
|
|
|
1309
1309
|
}
|
|
1310
1310
|
const Za = /* @__PURE__ */ m(ma, [["render", pa]]);
|
|
1311
1311
|
/*!
|
|
1312
|
-
* iamKey v5.6.1-
|
|
1312
|
+
* iamKey v5.6.1-beta11
|
|
1313
1313
|
* Copyright 2022-2024 iamproperty
|
|
1314
1314
|
*/
|
|
1315
1315
|
function ha(t, a) {
|
|
@@ -1479,7 +1479,7 @@ const ts = /* @__PURE__ */ m($a, [["render", ka]]), Aa = {
|
|
|
1479
1479
|
props: {},
|
|
1480
1480
|
mounted() {
|
|
1481
1481
|
this.$nextTick(function() {
|
|
1482
|
-
import("./actionbar.component.min-
|
|
1482
|
+
import("./actionbar.component.min-0ca7ff8f.mjs").then((t) => {
|
|
1483
1483
|
window.customElements.get("iam-actionbar") || window.customElements.define("iam-actionbar", t.default);
|
|
1484
1484
|
}).catch((t) => {
|
|
1485
1485
|
console.log(t.message);
|
|
@@ -1494,7 +1494,7 @@ function xa(t, a, e, i, r, s) {
|
|
|
1494
1494
|
}
|
|
1495
1495
|
const as = /* @__PURE__ */ m(Aa, [["render", xa]]);
|
|
1496
1496
|
/*!
|
|
1497
|
-
* iamKey v5.6.1-
|
|
1497
|
+
* iamKey v5.6.1-beta11
|
|
1498
1498
|
* Copyright 2022-2024 iamproperty
|
|
1499
1499
|
*/
|
|
1500
1500
|
class R extends HTMLElement {
|