@iamproperty/components 5.6.1-beta11 → 5.6.1-beta13
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/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.js +13 -7
- package/assets/js/components/address-lookup/address-lookup.component.min.js +4 -4
- package/assets/js/components/address-lookup/address-lookup.component.min.js.map +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.min.js +4 -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 +54 -37
- package/assets/js/scripts.bundle.js +1 -1
- package/assets/js/scripts.bundle.min.js +1 -1
- package/assets/ts/components/address-lookup/address-lookup.component.ts +16 -8
- package/assets/ts/modules/fileupload.ts +74 -55
- package/dist/components.es.js +10 -10
- package/dist/components.umd.js +33 -33
- package/package.json +1 -1
|
@@ -12,6 +12,20 @@ function fileupload(fileupload: Element, wrapper: Element) {
|
|
|
12
12
|
const cloneInput = input.cloneNode();
|
|
13
13
|
dropArea.append(cloneInput);
|
|
14
14
|
|
|
15
|
+
let checkFileExt = function(filename){
|
|
16
|
+
|
|
17
|
+
if(!input.hasAttribute('accept'))
|
|
18
|
+
return true;
|
|
19
|
+
|
|
20
|
+
const nameExtension = filename.split('.').pop();
|
|
21
|
+
const acceptedTypes = input.getAttribute('accept');
|
|
22
|
+
|
|
23
|
+
if(acceptedTypes.includes(nameExtension))
|
|
24
|
+
return true;
|
|
25
|
+
|
|
26
|
+
return false;
|
|
27
|
+
}
|
|
28
|
+
|
|
15
29
|
wrapper.addEventListener('click', (event) => {
|
|
16
30
|
|
|
17
31
|
if (event && event.target instanceof HTMLElement && event.target.closest('.btn-primary')){
|
|
@@ -19,7 +33,10 @@ function fileupload(fileupload: Element, wrapper: Element) {
|
|
|
19
33
|
const button = event.target.closest('.btn-primary');
|
|
20
34
|
|
|
21
35
|
// If the input allows multiples then use the buffer clone input
|
|
22
|
-
|
|
36
|
+
|
|
37
|
+
errorMsgExt.classList.remove('d-block');
|
|
38
|
+
errorMsgSize.classList.remove('d-block');
|
|
39
|
+
const inputTrigger = input.hasAttribute('multiple') ? cloneInput : input;
|
|
23
40
|
|
|
24
41
|
inputTrigger.click();
|
|
25
42
|
}
|
|
@@ -29,7 +46,6 @@ function fileupload(fileupload: Element, wrapper: Element) {
|
|
|
29
46
|
|
|
30
47
|
if (event && event.target instanceof HTMLElement && event.target.closest('.files button')){
|
|
31
48
|
|
|
32
|
-
|
|
33
49
|
const dt = new DataTransfer();
|
|
34
50
|
const { files } = input;
|
|
35
51
|
const button = event.target.closest('.files button');
|
|
@@ -44,74 +60,51 @@ function fileupload(fileupload: Element, wrapper: Element) {
|
|
|
44
60
|
|
|
45
61
|
input.files = dt.files // Assign the updates list
|
|
46
62
|
|
|
47
|
-
|
|
48
|
-
if(input.files.length == 0){
|
|
49
|
-
const emptyEvent = new Event('empty');
|
|
50
|
-
fileupload.dispatchEvent(emptyEvent);
|
|
51
|
-
}
|
|
52
|
-
|
|
53
63
|
const changeEvent = new Event('change');
|
|
54
64
|
input.dispatchEvent(changeEvent);
|
|
55
|
-
|
|
56
|
-
const elementChangeEvent = new Event('elementChange');
|
|
57
|
-
fileupload.dispatchEvent(elementChangeEvent);
|
|
58
65
|
}
|
|
59
66
|
});
|
|
60
67
|
|
|
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
|
-
|
|
76
68
|
// Buffer input change event
|
|
77
69
|
cloneInput.addEventListener('change', (event) => {
|
|
78
70
|
|
|
79
|
-
|
|
80
|
-
errorMsgSize.classList.remove('d-block');
|
|
81
|
-
const filesArray = [...input.files, ...cloneInput.files];
|
|
82
|
-
|
|
83
|
-
let fileNames = [];
|
|
84
|
-
|
|
85
|
-
const dt = new DataTransfer();
|
|
71
|
+
if(input.hasAttribute('multiple')){
|
|
86
72
|
|
|
87
|
-
|
|
88
|
-
|
|
73
|
+
const filesArray = [...input.files, ...cloneInput.files];
|
|
74
|
+
|
|
75
|
+
let fileNames = [];
|
|
89
76
|
|
|
90
|
-
const
|
|
77
|
+
const dt = new DataTransfer();
|
|
91
78
|
|
|
92
|
-
|
|
93
|
-
|
|
79
|
+
for (let i = 0; i < filesArray.length; i++) {
|
|
80
|
+
const file = filesArray[i]
|
|
94
81
|
|
|
82
|
+
const size = file.size/1000;
|
|
95
83
|
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
84
|
+
if(!fileNames.includes(file.name) && (maxSize == 0 || size < maxSize) && checkFileExt(file.name))
|
|
85
|
+
dt.items.add(file) // here you exclude the file. thus removing it.
|
|
86
|
+
|
|
87
|
+
|
|
88
|
+
if(!checkFileExt(file.name)){
|
|
89
|
+
errorMsgExt.classList.add('d-block');
|
|
90
|
+
}
|
|
91
|
+
|
|
92
|
+
if(size > maxSize){
|
|
93
|
+
errorMsgSize.classList.add('d-block');
|
|
94
|
+
}
|
|
99
95
|
|
|
100
|
-
|
|
101
|
-
errorMsgSize.classList.add('d-block');
|
|
96
|
+
fileNames.push(file.name);
|
|
102
97
|
}
|
|
103
98
|
|
|
104
|
-
|
|
105
|
-
|
|
99
|
+
input.files = dt.files;
|
|
100
|
+
}
|
|
101
|
+
else {
|
|
102
|
+
|
|
103
|
+
input.files = cloneInput.files;
|
|
106
104
|
}
|
|
107
105
|
|
|
108
|
-
input.files = dt.files;
|
|
109
|
-
|
|
110
106
|
const changeEvent = new Event('change');
|
|
111
107
|
input.dispatchEvent(changeEvent);
|
|
112
|
-
|
|
113
|
-
const elementChangeEvent = new Event('elementChange');
|
|
114
|
-
fileupload.dispatchEvent(elementChangeEvent);
|
|
115
108
|
});
|
|
116
109
|
|
|
117
110
|
|
|
@@ -132,23 +125,49 @@ function fileupload(fileupload: Element, wrapper: Element) {
|
|
|
132
125
|
|
|
133
126
|
input.addEventListener('change', (event) => {
|
|
134
127
|
|
|
128
|
+
if(input.files.length == 1) {
|
|
129
|
+
|
|
130
|
+
let file = input.files[0];
|
|
131
|
+
|
|
132
|
+
const size = file.size/1000;
|
|
133
|
+
|
|
134
|
+
if(!checkFileExt(file.name)){
|
|
135
|
+
errorMsgExt.classList.add('d-block');
|
|
136
|
+
|
|
137
|
+
const dt = new DataTransfer();
|
|
138
|
+
input.files = dt.files;
|
|
139
|
+
}
|
|
140
|
+
if(size > maxSize){
|
|
141
|
+
errorMsgSize.classList.add('d-block');
|
|
142
|
+
|
|
143
|
+
const dt = new DataTransfer();
|
|
144
|
+
input.files = dt.files;
|
|
145
|
+
}
|
|
146
|
+
}
|
|
147
|
+
|
|
135
148
|
// Reset
|
|
136
149
|
filesWrapper.innerHTML = '';
|
|
137
150
|
|
|
138
|
-
for (const file of input.files)
|
|
151
|
+
for (const file of input.files){
|
|
139
152
|
filesWrapper.innerHTML += `<span class="file">${file.name} <button data-file="${file.name}">Remove</button></span>`;
|
|
153
|
+
}
|
|
154
|
+
|
|
155
|
+
const elementChangeEvent = new CustomEvent('elementchange', {detail: {"files": input.files}});
|
|
156
|
+
fileupload.dispatchEvent(elementChangeEvent);
|
|
157
|
+
|
|
158
|
+
if(input.files.length == 0){
|
|
159
|
+
const emptyEvent = new CustomEvent('empty');
|
|
160
|
+
fileupload.dispatchEvent(emptyEvent);
|
|
161
|
+
}
|
|
140
162
|
});
|
|
141
163
|
|
|
142
164
|
if(fileupload.hasAttribute('data-filename')){
|
|
143
165
|
|
|
144
|
-
filesWrapper.innerHTML = '';
|
|
145
|
-
|
|
146
166
|
let filename = fileupload.getAttribute('data-filename');
|
|
147
167
|
|
|
148
168
|
if(filename)
|
|
149
169
|
filesWrapper.innerHTML += `<span class="file">${filename} <button data-file="${filename}">Remove</button></span>`;
|
|
150
170
|
}
|
|
151
|
-
|
|
152
171
|
}
|
|
153
172
|
|
|
154
|
-
export default fileupload;
|
|
173
|
+
export default fileupload;
|
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-1941bab6.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-9c045157.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-dbd0a1ae.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-6ce9f8cf.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-2ee34530.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-90dcc089.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-beta13
|
|
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-4314469e.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-beta13
|
|
1498
1498
|
* Copyright 2022-2024 iamproperty
|
|
1499
1499
|
*/
|
|
1500
1500
|
class R extends HTMLElement {
|
|
@@ -1619,7 +1619,7 @@ const ss = /* @__PURE__ */ m(Sa, [["render", qa]]), Ta = {
|
|
|
1619
1619
|
name: "Address Lookup",
|
|
1620
1620
|
mounted() {
|
|
1621
1621
|
this.$nextTick(function() {
|
|
1622
|
-
import("./address-lookup.component.min-
|
|
1622
|
+
import("./address-lookup.component.min-d3b27db0.mjs").then((t) => {
|
|
1623
1623
|
window.customElements.get("iam-address-lookup") || window.customElements.define("iam-address-lookup", t.default);
|
|
1624
1624
|
}).catch((t) => {
|
|
1625
1625
|
console.log(t.message);
|