@iamproperty/components 3.7.8 → 3.7.9-beta
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/applied-filters/applied-filters.component.min.js +1 -1
- package/assets/js/components/card/card.component.min.js +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/notification/notification.component.min.js +1 -1
- package/assets/js/components/pagination/pagination.component.min.js +1 -1
- package/assets/js/components/table/table.component.min.js +10 -10
- package/assets/js/components/table/table.component.min.js.map +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/table.js +49 -31
- package/assets/js/scripts.bundle.js +13 -13
- package/assets/js/scripts.bundle.js.map +1 -1
- package/assets/js/scripts.bundle.min.js +2 -2
- package/assets/js/scripts.bundle.min.js.map +1 -1
- package/assets/ts/components/accordion/README.md +15 -0
- package/assets/ts/components/applied-filters/README.md +15 -0
- package/assets/ts/components/card/README.md +15 -0
- package/assets/ts/components/fileupload/README.md +15 -0
- package/assets/ts/components/filterlist/README.md +15 -0
- package/assets/ts/components/header/README.md +16 -3
- package/assets/ts/components/notification/README.md +15 -0
- package/assets/ts/components/pagination/README.md +15 -0
- package/assets/ts/components/table/README.md +15 -0
- package/assets/ts/components/tabs/README.md +15 -0
- package/assets/ts/modules/table.ts +67 -44
- package/dist/components.es.js +1035 -1097
- package/dist/components.umd.js +43 -43
- package/package.json +1 -1
- package/src/components/Card/Card.vue +8 -4
|
@@ -1,3 +1,18 @@
|
|
|
1
|
+
**Add the below to your initialise script**
|
|
2
|
+
|
|
3
|
+
```
|
|
4
|
+
import('../node_modules/@iamproperty/components/assets/js/components/accordion/accordion.component.min').then(module => { // Might need to update the path
|
|
5
|
+
|
|
6
|
+
if (!window.customElements.get(`iam-accordion`))
|
|
7
|
+
window.customElements.define(`iam-accordion`, module.default);
|
|
8
|
+
|
|
9
|
+
}).catch((err) => {
|
|
10
|
+
console.log(err.message);
|
|
11
|
+
});
|
|
12
|
+
```
|
|
13
|
+
|
|
14
|
+
**Add the below HTML code to where you want the component to live.**
|
|
15
|
+
|
|
1
16
|
```
|
|
2
17
|
<iam-accordion class="container">
|
|
3
18
|
<details id="question1" class="accordion-item">
|
|
@@ -1,3 +1,18 @@
|
|
|
1
|
+
**Add the below to your initialise script**
|
|
2
|
+
|
|
3
|
+
```
|
|
4
|
+
import('../node_modules/@iamproperty/components/assets/js/components/applied-filters/applied-filters.component.min').then(module => { // Might need to update the path
|
|
5
|
+
|
|
6
|
+
if (!window.customElements.get(`iam-applied-filters`))
|
|
7
|
+
window.customElements.define(`iam-applied-filters`, module.default);
|
|
8
|
+
|
|
9
|
+
}).catch((err) => {
|
|
10
|
+
console.log(err.message);
|
|
11
|
+
});
|
|
12
|
+
```
|
|
13
|
+
|
|
14
|
+
**Add the below HTML code to where you want the component to live.**
|
|
15
|
+
|
|
1
16
|
```
|
|
2
17
|
<iam-applied-filters></iam-applied-filters>
|
|
3
18
|
```
|
|
@@ -1,3 +1,18 @@
|
|
|
1
|
+
**Add the below to your initialise script**
|
|
2
|
+
|
|
3
|
+
```
|
|
4
|
+
import('../node_modules/@iamproperty/components/assets/js/components/card/card.component.min').then(module => { // Might need to update the path
|
|
5
|
+
|
|
6
|
+
if (!window.customElements.get(`iam-card`))
|
|
7
|
+
window.customElements.define(`iam-card`, module.default);
|
|
8
|
+
|
|
9
|
+
}).catch((err) => {
|
|
10
|
+
console.log(err.message);
|
|
11
|
+
});
|
|
12
|
+
```
|
|
13
|
+
|
|
14
|
+
**Add the below HTML code to where you want the component to live.**
|
|
15
|
+
|
|
1
16
|
```
|
|
2
17
|
<a href="/link-url">
|
|
3
18
|
<iam-card>Link content</iam-card>
|
|
@@ -1,3 +1,18 @@
|
|
|
1
|
+
**Add the below to your initialise script**
|
|
2
|
+
|
|
3
|
+
```
|
|
4
|
+
import('../node_modules/@iamproperty/components/assets/js/components/fileupload/fileupload.component.min').then(module => { // Might need to update the path
|
|
5
|
+
|
|
6
|
+
if (!window.customElements.get(`iam-fileupload`))
|
|
7
|
+
window.customElements.define(`iam-fileupload`, module.default);
|
|
8
|
+
|
|
9
|
+
}).catch((err) => {
|
|
10
|
+
console.log(err.message);
|
|
11
|
+
});
|
|
12
|
+
```
|
|
13
|
+
|
|
14
|
+
**Add the below HTML code to where you want the component to live.**
|
|
15
|
+
|
|
1
16
|
```
|
|
2
17
|
<iam-fileupload data-maxsize="500"><input type="file" name="files[]" multiple="multiple" accept=".pdf, .csv, .jpg, .png" /></iam-fileupload>
|
|
3
18
|
```
|
|
@@ -1,3 +1,18 @@
|
|
|
1
|
+
**Add the below to your initialise script**
|
|
2
|
+
|
|
3
|
+
```
|
|
4
|
+
import('../node_modules/@iamproperty/components/assets/js/components/filterlist/filterlist.component.min').then(module => { // Might need to update the path
|
|
5
|
+
|
|
6
|
+
if (!window.customElements.get(`iam-filterlist`))
|
|
7
|
+
window.customElements.define(`iam-filterlist`, module.default);
|
|
8
|
+
|
|
9
|
+
}).catch((err) => {
|
|
10
|
+
console.log(err.message);
|
|
11
|
+
});
|
|
12
|
+
```
|
|
13
|
+
|
|
14
|
+
**Add the below HTML code to where you want the component to live.**
|
|
15
|
+
|
|
1
16
|
```
|
|
2
17
|
<iam-filterlist>
|
|
3
18
|
<ul>
|
|
@@ -1,4 +1,17 @@
|
|
|
1
|
-
|
|
1
|
+
**Add the below to your initialise script**
|
|
2
|
+
|
|
3
|
+
```
|
|
4
|
+
import('../node_modules/@iamproperty/components/assets/js/components/filterlist/filterlist.component.min').then(module => { // Might need to update the path
|
|
5
|
+
|
|
6
|
+
if (!window.customElements.get(`iam-filterlist`))
|
|
7
|
+
window.customElements.define(`iam-filterlist`, module.default);
|
|
8
|
+
|
|
9
|
+
}).catch((err) => {
|
|
10
|
+
console.log(err.message);
|
|
11
|
+
});
|
|
12
|
+
```
|
|
13
|
+
|
|
14
|
+
**Add the below HTML code to where you want the component to live.**
|
|
2
15
|
|
|
3
16
|
```
|
|
4
17
|
<iam-header class="bg-secondary" image="/shutterstock_1229155495.webp">
|
|
@@ -11,14 +24,14 @@
|
|
|
11
24
|
</iam-header>
|
|
12
25
|
```
|
|
13
26
|
|
|
14
|
-
|
|
27
|
+
**Properties**
|
|
15
28
|
|
|
16
29
|
| Option | Type | Default Value | Description |
|
|
17
30
|
| ------ | ---- | ------------- | ----------- |
|
|
18
31
|
| image | String | - | Optional image url to display in the background |
|
|
19
32
|
|
|
20
33
|
|
|
21
|
-
|
|
34
|
+
**Slots**
|
|
22
35
|
|
|
23
36
|
| Option | Default Value | Description |
|
|
24
37
|
| ------ | ------------- | ----------- |
|
|
@@ -1,3 +1,18 @@
|
|
|
1
|
+
**Add the below to your initialise script**
|
|
2
|
+
|
|
3
|
+
```
|
|
4
|
+
import('../node_modules/@iamproperty/components/assets/js/components/notification/notification.component.min').then(module => { // Might need to update the path
|
|
5
|
+
|
|
6
|
+
if (!window.customElements.get(`iam-notification`))
|
|
7
|
+
window.customElements.define(`iam-notification`, module.default);
|
|
8
|
+
|
|
9
|
+
}).catch((err) => {
|
|
10
|
+
console.log(err.message);
|
|
11
|
+
});
|
|
12
|
+
```
|
|
13
|
+
|
|
14
|
+
**Add the below HTML code to where you want the component to live.**
|
|
15
|
+
|
|
1
16
|
```
|
|
2
17
|
<!-- Inline -->
|
|
3
18
|
<iam-notification data-status="danger" data-dismiss="">
|
|
@@ -1,3 +1,18 @@
|
|
|
1
|
+
**Add the below to your initialise script**
|
|
2
|
+
|
|
3
|
+
```
|
|
4
|
+
import('../node_modules/@iamproperty/components/assets/js/components/pagination/pagination.component.min').then(module => { // Might need to update the path
|
|
5
|
+
|
|
6
|
+
if (!window.customElements.get(`iam-pagination`))
|
|
7
|
+
window.customElements.define(`iam-pagination`, module.default);
|
|
8
|
+
|
|
9
|
+
}).catch((err) => {
|
|
10
|
+
console.log(err.message);
|
|
11
|
+
});
|
|
12
|
+
```
|
|
13
|
+
|
|
14
|
+
**Add the below HTML code to where you want the component to live.**
|
|
15
|
+
|
|
1
16
|
```
|
|
2
17
|
<iam-pagination data-total="12"></iam-pagination>
|
|
3
18
|
```
|
|
@@ -1,3 +1,18 @@
|
|
|
1
|
+
**Add the below to your initialise script**
|
|
2
|
+
|
|
3
|
+
```
|
|
4
|
+
import('../node_modules/@iamproperty/components/assets/js/components/table/table.component.min').then(module => { // Might need to update the path
|
|
5
|
+
|
|
6
|
+
if (!window.customElements.get(`iam-table`))
|
|
7
|
+
window.customElements.define(`iam-table`, module.default);
|
|
8
|
+
|
|
9
|
+
}).catch((err) => {
|
|
10
|
+
console.log(err.message);
|
|
11
|
+
});
|
|
12
|
+
```
|
|
13
|
+
|
|
14
|
+
**Add the below HTML code to where you want the component to live.**
|
|
15
|
+
|
|
1
16
|
```
|
|
2
17
|
<iam-table class="container">
|
|
3
18
|
<table>
|
|
@@ -1,3 +1,18 @@
|
|
|
1
|
+
**Add the below to your initialise script**
|
|
2
|
+
|
|
3
|
+
```
|
|
4
|
+
import('../node_modules/@iamproperty/components/assets/js/components/tabs/tabs.component.min').then(module => { // Might need to update the path
|
|
5
|
+
|
|
6
|
+
if (!window.customElements.get(`iam-tabs`))
|
|
7
|
+
window.customElements.define(`iam-tabs`, module.default);
|
|
8
|
+
|
|
9
|
+
}).catch((err) => {
|
|
10
|
+
console.log(err.message);
|
|
11
|
+
});
|
|
12
|
+
```
|
|
13
|
+
|
|
14
|
+
**Add the below HTML code to where you want the component to live.**
|
|
15
|
+
|
|
1
16
|
```
|
|
2
17
|
<iam-tabs class="container">
|
|
3
18
|
<details>
|
|
@@ -160,6 +160,16 @@ export const addFilterEventListeners = (table, form, pagination, wrapper, savedT
|
|
|
160
160
|
createPaginationButttons(wrapper,pagination);
|
|
161
161
|
populateDataQueries(table,form);
|
|
162
162
|
}
|
|
163
|
+
|
|
164
|
+
// Pass post data back to the page
|
|
165
|
+
if(form.hasAttribute('data-ajax-post')){
|
|
166
|
+
|
|
167
|
+
let formData = new FormData(form);
|
|
168
|
+
let queryString = new URLSearchParams(formData).toString();
|
|
169
|
+
const http = new XMLHttpRequest()
|
|
170
|
+
http.open('GET', `${window.location.href}?ajax=true&${queryString}`);
|
|
171
|
+
http.send();
|
|
172
|
+
}
|
|
163
173
|
}
|
|
164
174
|
|
|
165
175
|
form.addEventListener('keyup', (event) => {
|
|
@@ -417,7 +427,7 @@ export const filterTable = (table, form, wrapper) => {
|
|
|
417
427
|
|
|
418
428
|
table.classList.remove('table--filtered');
|
|
419
429
|
|
|
420
|
-
let filters =
|
|
430
|
+
let filters = filterFilters(form);
|
|
421
431
|
let searches = [];
|
|
422
432
|
let matched = 0;
|
|
423
433
|
let page = form.querySelector('[data-pagination]') ? parseInt(form.querySelector('[data-pagination]').value) : 1;
|
|
@@ -432,40 +442,6 @@ export const filterTable = (table, form, wrapper) => {
|
|
|
432
442
|
row.removeAttribute('data-filtered-by');
|
|
433
443
|
});
|
|
434
444
|
|
|
435
|
-
// Filter
|
|
436
|
-
let filterInputs = Array.from(form.querySelectorAll('[data-filter]'));
|
|
437
|
-
|
|
438
|
-
filterInputs.forEach((filterInput, index) => {
|
|
439
|
-
|
|
440
|
-
// Ignore uncked radio inputs
|
|
441
|
-
if(filterInput.type == 'radio' && !filterInput.checked){
|
|
442
|
-
return;
|
|
443
|
-
}
|
|
444
|
-
|
|
445
|
-
if(filterInput.type == 'checkbox' && !filterInput.checked){
|
|
446
|
-
return;
|
|
447
|
-
}
|
|
448
|
-
|
|
449
|
-
|
|
450
|
-
if(filterInput.getAttribute('data-filter') == "multi"){
|
|
451
|
-
|
|
452
|
-
for (const [key, value] of Object.entries(JSON.parse(filterInput.value))) {
|
|
453
|
-
filters[filterInput.getAttribute('data-filter')].push(value);
|
|
454
|
-
}
|
|
455
|
-
}
|
|
456
|
-
else if (filterInput && filterInput.value) {
|
|
457
|
-
|
|
458
|
-
let dataFilter = filterInput.getAttribute('data-filter');
|
|
459
|
-
|
|
460
|
-
if(!filters[dataFilter])
|
|
461
|
-
filters[dataFilter] = new Array();
|
|
462
|
-
|
|
463
|
-
filters[dataFilter].push(filterInput.value);
|
|
464
|
-
}
|
|
465
|
-
|
|
466
|
-
});
|
|
467
|
-
|
|
468
|
-
|
|
469
445
|
// Add search columns too
|
|
470
446
|
if(form.querySelector('[data-search]')){
|
|
471
447
|
let searchInput = form.querySelector('[data-search]');
|
|
@@ -482,10 +458,10 @@ export const filterTable = (table, form, wrapper) => {
|
|
|
482
458
|
element.innerHTML = '';
|
|
483
459
|
});
|
|
484
460
|
|
|
485
|
-
if(filters.length) {
|
|
461
|
+
if(Object.keys(filters).length) {
|
|
486
462
|
|
|
487
463
|
Array.from(form.querySelectorAll('[data-filter-count]')).forEach((element, index) => {
|
|
488
|
-
element.innerHTML += `(${filters.length})`;
|
|
464
|
+
element.innerHTML += `(${Object.keys(filters).length})`;
|
|
489
465
|
});
|
|
490
466
|
}
|
|
491
467
|
|
|
@@ -804,7 +780,37 @@ export const makeTableFunctional = function(table, form, pagination, wrapper){
|
|
|
804
780
|
}
|
|
805
781
|
}
|
|
806
782
|
|
|
783
|
+
const filterFilters = function(form){
|
|
784
|
+
|
|
785
|
+
let filters = new Object();
|
|
807
786
|
|
|
787
|
+
// Filter
|
|
788
|
+
let filterInputs = Array.from(form.querySelectorAll('[data-filter]'));
|
|
789
|
+
|
|
790
|
+
filterInputs.forEach((filterInput, index) => {
|
|
791
|
+
|
|
792
|
+
// Ignore uncked radio inputs
|
|
793
|
+
if(filterInput.type == 'radio' && !filterInput.checked){
|
|
794
|
+
return;
|
|
795
|
+
}
|
|
796
|
+
|
|
797
|
+
if(filterInput.type == 'checkbox' && !filterInput.checked){
|
|
798
|
+
return;
|
|
799
|
+
}
|
|
800
|
+
|
|
801
|
+
if (filterInput && filterInput.value) {
|
|
802
|
+
|
|
803
|
+
let dataFilter = filterInput.getAttribute('data-filter');
|
|
804
|
+
|
|
805
|
+
if(!filters[dataFilter])
|
|
806
|
+
filters[dataFilter] = new Array();
|
|
807
|
+
|
|
808
|
+
filters[dataFilter].push(filterInput.value);
|
|
809
|
+
}
|
|
810
|
+
});
|
|
811
|
+
|
|
812
|
+
return filters;
|
|
813
|
+
}
|
|
808
814
|
|
|
809
815
|
export const loadAjaxTable = async function (table, form, pagination, wrapper){
|
|
810
816
|
|
|
@@ -818,6 +824,20 @@ export const loadAjaxTable = async function (table, form, pagination, wrapper){
|
|
|
818
824
|
|
|
819
825
|
wrapper.classList.add('table--loading');
|
|
820
826
|
|
|
827
|
+
// Display the filter count
|
|
828
|
+
let filters = filterFilters(form);
|
|
829
|
+
|
|
830
|
+
Array.from(form.querySelectorAll('[data-filter-count]')).forEach((element, index) => {
|
|
831
|
+
element.innerHTML = '';
|
|
832
|
+
});
|
|
833
|
+
|
|
834
|
+
if(Object.keys(filters).length) {
|
|
835
|
+
|
|
836
|
+
Array.from(form.querySelectorAll('[data-filter-count]')).forEach((element, index) => {
|
|
837
|
+
element.innerHTML += `(${Object.keys(filters).length})`;
|
|
838
|
+
});
|
|
839
|
+
}
|
|
840
|
+
|
|
821
841
|
// Setup controller vars if not already set
|
|
822
842
|
if(!window.controller)
|
|
823
843
|
window.controller = [];
|
|
@@ -927,6 +947,16 @@ export const loadAjaxTable = async function (table, form, pagination, wrapper){
|
|
|
927
947
|
makeTableFunctional(table, form, pagination, wrapper);
|
|
928
948
|
createPaginationButttons(wrapper, pagination);
|
|
929
949
|
|
|
950
|
+
Array.from(form.querySelectorAll('[data-ajax-query]')).forEach((queryElement, index) => {
|
|
951
|
+
|
|
952
|
+
let totalNumber = resolvePath(response, queryElement.getAttribute('data-ajax-query'), '');
|
|
953
|
+
|
|
954
|
+
if(queryElement.hasAttribute('data-total'))
|
|
955
|
+
queryElement.setAttribute('data-total', totalNumber);
|
|
956
|
+
else
|
|
957
|
+
queryElement.innerHTML = totalNumber;
|
|
958
|
+
});
|
|
959
|
+
|
|
930
960
|
if(parseInt(totalNumber) == 0){
|
|
931
961
|
tbody.innerHTML = `<tr><td colspan="100%"><span>${emptyMsg}</span></td></tr>`;
|
|
932
962
|
}
|
|
@@ -943,13 +973,6 @@ export const loadAjaxTable = async function (table, form, pagination, wrapper){
|
|
|
943
973
|
else {
|
|
944
974
|
tbody.innerHTML = '<tr><td colspan="100%"><span>Error loading table</span></td></tr>';
|
|
945
975
|
}
|
|
946
|
-
|
|
947
|
-
// Pass post data back to the page
|
|
948
|
-
if(form.hasAttribute('data-ajax-post')){
|
|
949
|
-
const http = new XMLHttpRequest()
|
|
950
|
-
http.open('GET', `${window.location.href}?ajax=true&${queryString}`);
|
|
951
|
-
http.send();
|
|
952
|
-
}
|
|
953
976
|
});
|
|
954
977
|
} catch (error) {
|
|
955
978
|
console.log(error);
|