@iamproperty/components 5.5.1-beta-4 → 5.5.1-beta-5
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/components/actionbar.css +1 -1
- package/assets/css/components/actionbar.css.map +1 -1
- package/assets/css/components/actionbar.global.css +1 -1
- package/assets/css/components/actionbar.global.css.map +1 -1
- package/assets/js/components/accordion/accordion.component.min.js +1 -1
- package/assets/js/components/actionbar/actionbar.component.js +2 -0
- package/assets/js/components/actionbar/actionbar.component.min.js +5 -3
- package/assets/js/components/actionbar/actionbar.component.min.js.map +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/collapsible-side/collapsible-side.component.min.js +1 -1
- package/assets/js/components/fileupload/fileupload.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/inline-edit/inline-edit.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/table/table.component.js +26 -14
- package/assets/js/components/table/table.component.min.js +4 -4
- 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 +36 -18
- package/assets/js/scripts.bundle.js +2 -2
- 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/sass/components/actionbar.global.scss +10 -0
- package/assets/sass/components/actionbar.scss +20 -3
- package/assets/ts/components/actionbar/actionbar.component.ts +2 -0
- package/assets/ts/components/table/table.component.ts +28 -21
- package/assets/ts/modules/table.ts +40 -19
- package/dist/components.es.js +66 -65
- package/dist/components.umd.js +61 -64
- package/package.json +1 -1
- package/src/components/Table/Table.vue +2 -1
|
@@ -170,3 +170,13 @@ button[slot="selected-overflow"] {
|
|
|
170
170
|
}
|
|
171
171
|
}
|
|
172
172
|
// #endregion
|
|
173
|
+
|
|
174
|
+
// Select all done with vue
|
|
175
|
+
|
|
176
|
+
|
|
177
|
+
iam-actionbar:has(.selectall input:checked) {
|
|
178
|
+
--selectall-opacity: 1;
|
|
179
|
+
--selectall-pe: all;
|
|
180
|
+
--selectall-actionbar-opactiy: 0;
|
|
181
|
+
--selectall-action-pe: none;
|
|
182
|
+
}
|
|
@@ -13,10 +13,13 @@
|
|
|
13
13
|
|
|
14
14
|
// #region View states (Default, search, selected)
|
|
15
15
|
.views,
|
|
16
|
-
.selectall
|
|
16
|
+
.selectall,
|
|
17
|
+
slot[name="selectall"] {
|
|
18
|
+
display: block;
|
|
17
19
|
position: absolute!important;
|
|
18
20
|
top: 50%;
|
|
19
21
|
left: rem(24);
|
|
22
|
+
margin-left: 0;
|
|
20
23
|
|
|
21
24
|
@include media-breakpoint-up(sm) {
|
|
22
25
|
left: rem(32);
|
|
@@ -30,7 +33,8 @@
|
|
|
30
33
|
}
|
|
31
34
|
}
|
|
32
35
|
|
|
33
|
-
.selectall
|
|
36
|
+
.selectall,
|
|
37
|
+
slot[name="selectall"] {
|
|
34
38
|
|
|
35
39
|
width: rem(40);
|
|
36
40
|
overflow: hidden;
|
|
@@ -113,12 +117,25 @@
|
|
|
113
117
|
}
|
|
114
118
|
|
|
115
119
|
// Show selected bar
|
|
120
|
+
.actionbar {
|
|
121
|
+
|
|
122
|
+
opacity: var(--selectall-actionbar-opacity,1);
|
|
123
|
+
pointer-events: var(--selectall-actionbar-pe,all);
|
|
124
|
+
}
|
|
125
|
+
|
|
126
|
+
.actionbar--selected {
|
|
127
|
+
|
|
128
|
+
opacity: var(--selectall-opacity,0);
|
|
129
|
+
pointer-events: var(--selectall-pe,none);
|
|
130
|
+
}
|
|
131
|
+
|
|
116
132
|
.selectall:has(input:checked) ~ .actionbar,
|
|
117
133
|
.selectall:has(input:indeterminate) ~ .actionbar {
|
|
118
134
|
|
|
119
135
|
opacity: 0;
|
|
120
136
|
pointer-events: none;
|
|
121
137
|
}
|
|
138
|
+
|
|
122
139
|
.selectall:has(input:checked) ~ .actionbar--selected,
|
|
123
140
|
.selectall:has(input:indeterminate) ~ .actionbar--selected {
|
|
124
141
|
|
|
@@ -140,7 +157,7 @@
|
|
|
140
157
|
// #endregion
|
|
141
158
|
|
|
142
159
|
// #region Slotted elements
|
|
143
|
-
::slotted(
|
|
160
|
+
::slotted(.btn){
|
|
144
161
|
margin-top: 0!important;
|
|
145
162
|
margin-bottom: 0!important;
|
|
146
163
|
margin-left: rem(16)!important;
|
|
@@ -56,7 +56,9 @@ class iamActionbar extends HTMLElement {
|
|
|
56
56
|
</style>
|
|
57
57
|
<link rel="stylesheet" href="https://kit.fontawesome.com/26fdbf0179.css" crossorigin="anonymous">
|
|
58
58
|
<div class="actionbar__wrapper">
|
|
59
|
+
|
|
59
60
|
<div class="actionbar">
|
|
61
|
+
<slot name="selectall"></slot>
|
|
60
62
|
<div class="safe-area">
|
|
61
63
|
<slot></slot>
|
|
62
64
|
<div class="body">
|
|
@@ -39,8 +39,9 @@ class iamTable extends HTMLElement {
|
|
|
39
39
|
this.shadowRoot.appendChild(template.content.cloneNode(true));
|
|
40
40
|
|
|
41
41
|
// insert extra CSS
|
|
42
|
-
if(!document.getElementById('tableExtras'))
|
|
42
|
+
if(!document.getElementById('tableExtras')){
|
|
43
43
|
document.head.insertAdjacentHTML('beforeend',`<style id="tableExtras">${loadExtraCSS}</style>`);
|
|
44
|
+
}
|
|
44
45
|
}
|
|
45
46
|
|
|
46
47
|
connectedCallback() {
|
|
@@ -48,17 +49,22 @@ class iamTable extends HTMLElement {
|
|
|
48
49
|
const params = new URLSearchParams(window.location.search)
|
|
49
50
|
|
|
50
51
|
// Set default attributes
|
|
51
|
-
if(!this.hasAttribute('data-total'))
|
|
52
|
+
if(!this.hasAttribute('data-total')){
|
|
52
53
|
this.setAttribute('data-total', this.querySelectorAll('table tbody tr').length);
|
|
54
|
+
}
|
|
53
55
|
|
|
54
|
-
if(!this.hasAttribute('data-page'))
|
|
56
|
+
if(!this.hasAttribute('data-page')){
|
|
55
57
|
this.setAttribute('data-page', (params.has('page') ? params.get('page') : 1));
|
|
58
|
+
}
|
|
56
59
|
|
|
57
|
-
if(!this.hasAttribute('data-show'))
|
|
60
|
+
if(!this.hasAttribute('data-show')){
|
|
58
61
|
this.setAttribute('data-show', (params.has('show') ? params.get('show') : 15));
|
|
59
|
-
|
|
60
|
-
|
|
62
|
+
}
|
|
63
|
+
|
|
64
|
+
if(!this.hasAttribute('data-increment')){
|
|
61
65
|
this.setAttribute('data-increment', this.getAttribute('data-show'));
|
|
66
|
+
}
|
|
67
|
+
|
|
62
68
|
|
|
63
69
|
// Update table__wrapper class
|
|
64
70
|
let classList = this.classList.toString();
|
|
@@ -69,8 +75,9 @@ class iamTable extends HTMLElement {
|
|
|
69
75
|
this.shadowRoot.querySelector('.table__wrapper').className += ` ${classList}`;
|
|
70
76
|
|
|
71
77
|
// set actionbar class if needed
|
|
72
|
-
if(this.querySelector('.actionbar__sticky'))
|
|
78
|
+
if(this.querySelector('.actionbar__sticky')){
|
|
73
79
|
this.shadowRoot.querySelector('.table__wrapper').classList.add('has-actionbar');
|
|
80
|
+
}
|
|
74
81
|
|
|
75
82
|
this.table = this.querySelector('table');
|
|
76
83
|
this.savedTableBody = this.table.querySelector('tbody').cloneNode(true);
|
|
@@ -81,21 +88,21 @@ class iamTable extends HTMLElement {
|
|
|
81
88
|
this.pagination.setAttribute('data-show', this.getAttribute('data-show'));
|
|
82
89
|
this.pagination.setAttribute('data-increment', this.getAttribute('data-show'));
|
|
83
90
|
|
|
84
|
-
if(this.hasAttribute('data-page-jump'))
|
|
91
|
+
if(this.hasAttribute('data-page-jump')){
|
|
85
92
|
this.pagination.setAttribute('data-page-jump', 'true');
|
|
86
|
-
|
|
87
|
-
if(this.hasAttribute('data-per-page'))
|
|
93
|
+
}
|
|
94
|
+
if(this.hasAttribute('data-per-page')){
|
|
88
95
|
this.pagination.setAttribute('data-per-page', 'true');
|
|
89
|
-
|
|
90
|
-
if(this.hasAttribute('data-item-count'))
|
|
96
|
+
}
|
|
97
|
+
if(this.hasAttribute('data-item-count')){
|
|
91
98
|
this.pagination.setAttribute('data-item-count', 'true');
|
|
92
|
-
|
|
93
|
-
if(this.hasAttribute('data-loading'))
|
|
99
|
+
}
|
|
100
|
+
if(this.hasAttribute('data-loading')){
|
|
94
101
|
this.pagination.setAttribute('data-loading', 'true');
|
|
95
|
-
|
|
96
|
-
if(this.classList.contains('table--fullwidth'))
|
|
102
|
+
}
|
|
103
|
+
if(this.classList.contains('table--fullwidth')){
|
|
97
104
|
this.pagination.setAttribute('data-minimal', 'true');
|
|
98
|
-
|
|
105
|
+
}
|
|
99
106
|
|
|
100
107
|
// Remove table CTA
|
|
101
108
|
const isCTA = this.classList.contains('table--cta');
|
|
@@ -115,9 +122,9 @@ class iamTable extends HTMLElement {
|
|
|
115
122
|
}
|
|
116
123
|
|
|
117
124
|
// Set ajax class
|
|
118
|
-
if(this.form.hasAttribute('data-ajax'))
|
|
125
|
+
if(this.form.hasAttribute('data-ajax')){
|
|
119
126
|
this.table.classList.add('table--ajax');
|
|
120
|
-
|
|
127
|
+
}
|
|
121
128
|
// Create a data list if a search input is present
|
|
122
129
|
tableModule.createSearchDataList(this.table, this.form);
|
|
123
130
|
|
|
@@ -150,9 +157,9 @@ class iamTable extends HTMLElement {
|
|
|
150
157
|
|
|
151
158
|
// Add in the checkboxes
|
|
152
159
|
|
|
153
|
-
if(this.querySelector('iam-actionbar[data-selectall]')){
|
|
160
|
+
if(this.querySelector('iam-actionbar[data-selectall]') || document.querySelector(`iam-actionbar[data-for='${this.getAttribute('id')}']`)){
|
|
154
161
|
|
|
155
|
-
const actionbar = this.querySelector('iam-actionbar[data-selectall]');
|
|
162
|
+
const actionbar = this.querySelector('iam-actionbar[data-selectall]') ? this.querySelector('iam-actionbar[data-selectall]') : document.querySelector(`iam-actionbar[data-for='${this.getAttribute('id')}']`);
|
|
156
163
|
|
|
157
164
|
Array.from(this.table.querySelectorAll('thead tr')).forEach((row,index) => {
|
|
158
165
|
|
|
@@ -195,8 +195,9 @@ export const addFilterEventListeners = (table, form, pagination, wrapper, savedT
|
|
|
195
195
|
|
|
196
196
|
loadAjaxTable(table, form, pagination,wrapper);
|
|
197
197
|
}
|
|
198
|
-
else if(form.hasAttribute('data-submit'))
|
|
198
|
+
else if(form.hasAttribute('data-submit')){
|
|
199
199
|
form.submit();
|
|
200
|
+
}
|
|
200
201
|
else {
|
|
201
202
|
filterTable(table, form, wrapper);
|
|
202
203
|
populateDataQueries(table,form);
|
|
@@ -247,8 +248,9 @@ export const addFilterEventListeners = (table, form, pagination, wrapper, savedT
|
|
|
247
248
|
|
|
248
249
|
if (event && event.target instanceof HTMLElement && event.target.closest('[data-sort]')){
|
|
249
250
|
|
|
250
|
-
if(!form.hasAttribute('data-submit'))
|
|
251
|
+
if(!form.hasAttribute('data-submit')){
|
|
251
252
|
sortTable(table, form, savedTableBody);
|
|
253
|
+
}
|
|
252
254
|
|
|
253
255
|
formSubmit(event);
|
|
254
256
|
}
|
|
@@ -353,8 +355,9 @@ export const addFilterEventListeners = (table, form, pagination, wrapper, savedT
|
|
|
353
355
|
|
|
354
356
|
form.classList.remove('processing');
|
|
355
357
|
|
|
356
|
-
if(!form.hasAttribute('data-submit'))
|
|
358
|
+
if(!form.hasAttribute('data-submit')){
|
|
357
359
|
sortTable(table, form, savedTableBody);
|
|
360
|
+
}
|
|
358
361
|
|
|
359
362
|
formSubmit(event);
|
|
360
363
|
}
|
|
@@ -364,8 +367,9 @@ export const addFilterEventListeners = (table, form, pagination, wrapper, savedT
|
|
|
364
367
|
|
|
365
368
|
clearTimeout(timer);
|
|
366
369
|
|
|
367
|
-
if(!form.hasAttribute('data-submit'))
|
|
370
|
+
if(!form.hasAttribute('data-submit')){
|
|
368
371
|
event.preventDefault();
|
|
372
|
+
}
|
|
369
373
|
|
|
370
374
|
formSubmit(event);
|
|
371
375
|
});
|
|
@@ -396,11 +400,13 @@ export const addFilterEventListeners = (table, form, pagination, wrapper, savedT
|
|
|
396
400
|
|
|
397
401
|
let parentForm = mimicInput.closest('form');
|
|
398
402
|
|
|
399
|
-
if(!forms.includes(parentForm))
|
|
403
|
+
if(!forms.includes(parentForm)){
|
|
400
404
|
forms.push(parentForm);
|
|
405
|
+
}
|
|
401
406
|
|
|
402
|
-
if(!fields.includes(mimicField))
|
|
407
|
+
if(!fields.includes(mimicField)){
|
|
403
408
|
fields.push(mimicField);
|
|
409
|
+
}
|
|
404
410
|
|
|
405
411
|
});
|
|
406
412
|
});
|
|
@@ -495,20 +501,23 @@ export const sortTable = (table, form, savedTableBody) => {
|
|
|
495
501
|
|
|
496
502
|
let rowIndex = tableRow.querySelector('td[data-label="'+sortBy+'"], th[data-label="'+sortBy+'"]').textContent.trim();
|
|
497
503
|
|
|
498
|
-
if(tableRow.querySelector('[data-label="'+sortBy+'"] .td__content'))
|
|
504
|
+
if(tableRow.querySelector('[data-label="'+sortBy+'"] .td__content')){
|
|
499
505
|
rowIndex = tableRow.querySelector('[data-label="'+sortBy+'"] .td__content').textContent.trim();
|
|
506
|
+
}
|
|
500
507
|
|
|
501
508
|
// If a predefined order set replace the search term with an ordered numeric value so it can be sorted
|
|
502
509
|
if(orderArray.length && orderArray.includes(rowIndex)){
|
|
503
510
|
rowIndex = orderArray.indexOf(rowIndex);
|
|
504
511
|
}
|
|
505
512
|
|
|
506
|
-
if(isNumeric(rowIndex))
|
|
507
|
-
rowIndex = zeroPad(rowIndex,10)
|
|
513
|
+
if(isNumeric(rowIndex)){
|
|
514
|
+
rowIndex = zeroPad(rowIndex,10);
|
|
515
|
+
}
|
|
508
516
|
|
|
509
517
|
// If the sort format is date then lets transform the index to a sortable date (this is never displayed)
|
|
510
|
-
if(format && format == "date")
|
|
518
|
+
if(format && format == "date"){
|
|
511
519
|
rowIndex = new Date(rowIndex);
|
|
520
|
+
}
|
|
512
521
|
|
|
513
522
|
const dataRow = {
|
|
514
523
|
index: rowIndex,
|
|
@@ -521,8 +530,10 @@ export const sortTable = (table, form, savedTableBody) => {
|
|
|
521
530
|
tableArr.sort((a, b) => (a.index > b.index) ? 1 : -1)
|
|
522
531
|
|
|
523
532
|
// Reverse if descending
|
|
524
|
-
if(order == "descending" || order == "desc")
|
|
533
|
+
if(order == "descending" || order == "desc"){
|
|
525
534
|
tableArr = tableArr.reverse();
|
|
535
|
+
}
|
|
536
|
+
|
|
526
537
|
|
|
527
538
|
// Create a string to return and populate the tbody
|
|
528
539
|
let strTbody = '';
|
|
@@ -571,10 +582,13 @@ export const filterTable = (table, form, wrapper) => {
|
|
|
571
582
|
let filterCount = 0;
|
|
572
583
|
Object.values(filters).forEach((filter, index) => {
|
|
573
584
|
|
|
574
|
-
if(typeof filter == "object" && Object.values(filter).length)
|
|
585
|
+
if(typeof filter == "object" && Object.values(filter).length){
|
|
575
586
|
filterCount += Object.values(filter).length;
|
|
576
|
-
|
|
587
|
+
}
|
|
588
|
+
else {
|
|
577
589
|
filterCount++;
|
|
590
|
+
}
|
|
591
|
+
|
|
578
592
|
});
|
|
579
593
|
|
|
580
594
|
if(filterCount) {
|
|
@@ -634,8 +648,9 @@ export const filterTable = (table, form, wrapper) => {
|
|
|
634
648
|
}
|
|
635
649
|
|
|
636
650
|
// Dynamic values
|
|
637
|
-
if(filter && filter == "$today")
|
|
651
|
+
if(filter && filter == "$today"){
|
|
638
652
|
filter = formatCell('date', new Date());
|
|
653
|
+
}
|
|
639
654
|
else if(filter && filter == "$yesterday"){
|
|
640
655
|
|
|
641
656
|
let yesterday = new Date();
|
|
@@ -725,8 +740,9 @@ export const filterTable = (table, form, wrapper) => {
|
|
|
725
740
|
|
|
726
741
|
});
|
|
727
742
|
|
|
728
|
-
if(!isSearched)
|
|
743
|
+
if(!isSearched){
|
|
729
744
|
row.classList.add('filtered');
|
|
745
|
+
}
|
|
730
746
|
});
|
|
731
747
|
|
|
732
748
|
// Work out what to display after pagination
|
|
@@ -738,8 +754,9 @@ export const filterTable = (table, form, wrapper) => {
|
|
|
738
754
|
|
|
739
755
|
// pagination bit
|
|
740
756
|
let matchesPage = Math.ceil(matched/showRows);
|
|
741
|
-
if(matchesPage == parseInt(page))
|
|
757
|
+
if(matchesPage == parseInt(page)){
|
|
742
758
|
row.classList.add('filtered--show');
|
|
759
|
+
}
|
|
743
760
|
});
|
|
744
761
|
|
|
745
762
|
if(wrapper){
|
|
@@ -808,10 +825,13 @@ export const populateDataQueries = (table,form,wrapper) => {
|
|
|
808
825
|
}).length;
|
|
809
826
|
}
|
|
810
827
|
|
|
811
|
-
if(queryElement.hasAttribute('data-total'))
|
|
828
|
+
if(queryElement.hasAttribute('data-total')){
|
|
812
829
|
queryElement.setAttribute('data-total', numberOfMatchedRows);
|
|
813
|
-
|
|
830
|
+
}
|
|
831
|
+
else {
|
|
814
832
|
queryElement.innerHTML = numberOfMatchedRows;
|
|
833
|
+
}
|
|
834
|
+
|
|
815
835
|
});
|
|
816
836
|
}
|
|
817
837
|
|
|
@@ -858,8 +878,9 @@ export const addPaginationEventListeners = function(table, form, pagination, wra
|
|
|
858
878
|
// Export CSV Data
|
|
859
879
|
export const addExportEventListeners = (button, table) => {
|
|
860
880
|
|
|
861
|
-
if(!button)
|
|
881
|
+
if(!button){
|
|
862
882
|
return false;
|
|
883
|
+
}
|
|
863
884
|
|
|
864
885
|
button.addEventListener('click', (event) => {
|
|
865
886
|
exportAsCSV(table);
|