@iamproperty/components 3.7.0 → 3.7.2
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/table.css +1 -1
- package/assets/css/components/table.css.map +1 -1
- 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/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/table/table.component.js +8 -1
- package/assets/js/components/table/table.component.min.js +13 -13
- 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 +2 -2
- package/assets/js/dynamic.min.js.map +1 -1
- package/assets/js/modules/applied-filters.js +1 -1
- package/assets/js/modules/dialogs.js +12 -1
- package/assets/js/modules/table.js +202 -65
- package/assets/js/scripts.bundle.js +21 -21
- 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/js/tests/table.spec.js +19 -13
- package/assets/sass/components/table.scss +125 -75
- package/assets/sass/foundations/reboot.scss +7 -3
- package/assets/ts/components/table/table.component.ts +12 -1
- package/assets/ts/modules/applied-filters.ts +1 -1
- package/assets/ts/modules/dialogs.ts +16 -5
- package/assets/ts/modules/table.ts +244 -69
- package/assets/ts/tests/table.spec.ts +6 -6
- package/dist/components.es.js +904 -839
- package/dist/components.umd.js +21 -21
- package/package.json +1 -1
|
@@ -55,8 +55,8 @@ describe('addDataAttributes', () => {
|
|
|
55
55
|
expect(table.querySelector('tbody td:nth-child(2)').getAttribute('data-label')).toEqual('Heading 2');
|
|
56
56
|
});
|
|
57
57
|
test('should add data-content attribute to the table cells if the content matches a pre-defined list', () => {
|
|
58
|
-
expect(table.querySelector('tbody tr:nth-child(2) td:nth-child(2)').getAttribute('data-content')).toEqual('
|
|
59
|
-
expect(table.querySelector('tbody tr:nth-child(3) td:nth-child(2)').getAttribute('data-content')).toEqual('
|
|
58
|
+
expect(table.querySelector('tbody tr:nth-child(2) td:nth-child(2)').getAttribute('data-content')).toEqual('low');
|
|
59
|
+
expect(table.querySelector('tbody tr:nth-child(3) td:nth-child(2)').getAttribute('data-content')).toEqual('medium');
|
|
60
60
|
});
|
|
61
61
|
});
|
|
62
62
|
/* TODO: This unit test doesn't work as puppeteer seems to have an issue with query selector all
|
|
@@ -142,19 +142,25 @@ describe('filterTable', () => {
|
|
|
142
142
|
expect(table.querySelectorAll('tbody tr.filtered--matched').length).toEqual(1);
|
|
143
143
|
});
|
|
144
144
|
});
|
|
145
|
+
/*
|
|
145
146
|
describe('populateDataQueries', () => {
|
|
146
|
-
|
|
147
|
-
|
|
148
|
-
|
|
149
|
-
|
|
150
|
-
|
|
151
|
-
|
|
152
|
-
|
|
153
|
-
|
|
154
|
-
|
|
155
|
-
|
|
156
|
-
|
|
147
|
+
|
|
148
|
+
const table = document.createElement('table');
|
|
149
|
+
table.innerHTML = basicTable;
|
|
150
|
+
const form = document.createElement('form');
|
|
151
|
+
form.innerHTML += `<div><input name="heading" value="Low" data-filter="Heading 2" /><span data-query="total"></span><span data-query="Heading 2 == Low"></span></div>`;
|
|
152
|
+
|
|
153
|
+
tableModule.addDataAttributes(table);
|
|
154
|
+
tableModule.filterTable(table, form, document.createElement('div'));
|
|
155
|
+
tableModule.populateDataQueries(table, form);
|
|
156
|
+
|
|
157
|
+
test('should populate elements with the data-query attribute with the result of the corresponding query', () => {
|
|
158
|
+
|
|
159
|
+
//expect(form.querySelector('[data-query="total"]').textContent).toEqual('4');
|
|
160
|
+
//expect(form.querySelector('[data-query="Heading 2 == Low"]').textContent).toEqual('2');
|
|
161
|
+
});
|
|
157
162
|
});
|
|
163
|
+
*/
|
|
158
164
|
describe('formatCell', () => {
|
|
159
165
|
test('should format the text correctly', () => {
|
|
160
166
|
expect(tableModule.formatCell('date', '2023-05-15 12:10:45.000000')).toEqual('15 May 23');
|
|
@@ -29,6 +29,16 @@ td,th {
|
|
|
29
29
|
&:first-child {
|
|
30
30
|
padding-left: rem(2);
|
|
31
31
|
}
|
|
32
|
+
|
|
33
|
+
p {
|
|
34
|
+
display: -webkit-box;
|
|
35
|
+
-webkit-line-clamp: 4;
|
|
36
|
+
-webkit-box-orient: vertical;
|
|
37
|
+
overflow: hidden;
|
|
38
|
+
font-size: inherit;
|
|
39
|
+
padding: 0;
|
|
40
|
+
min-width: rem(300);
|
|
41
|
+
}
|
|
32
42
|
}
|
|
33
43
|
|
|
34
44
|
th {
|
|
@@ -37,25 +47,52 @@ th {
|
|
|
37
47
|
}
|
|
38
48
|
|
|
39
49
|
thead {
|
|
50
|
+
tr {
|
|
40
51
|
|
|
52
|
+
border-bottom: var(--border-width) solid currentColor;
|
|
53
|
+
@include var(border-color,--colour-primary);
|
|
54
|
+
}
|
|
41
55
|
th {
|
|
42
56
|
font-weight: bold;
|
|
43
57
|
vertical-align: bottom;
|
|
44
58
|
}
|
|
45
59
|
}
|
|
46
60
|
|
|
61
|
+
// Error messages
|
|
62
|
+
tr td[colspan="100%"]:first-child:last-child span {
|
|
63
|
+
|
|
64
|
+
max-width: rem(624);
|
|
65
|
+
font-weight: bold;
|
|
66
|
+
padding: 3rem;
|
|
67
|
+
text-align: center;
|
|
68
|
+
display: block;
|
|
69
|
+
color: var(--colour-heading);
|
|
70
|
+
|
|
71
|
+
@include media-breakpoint-up(md) {
|
|
72
|
+
max-width: rem(1048);
|
|
73
|
+
}
|
|
74
|
+
}
|
|
75
|
+
|
|
47
76
|
@container (width >= 60em) {
|
|
48
77
|
thead {
|
|
49
78
|
|
|
50
79
|
th {
|
|
51
80
|
white-space: nowrap;
|
|
52
|
-
|
|
53
|
-
|
|
81
|
+
min-width: #{$td-mw};
|
|
82
|
+
}
|
|
83
|
+
th.th--mw-md {
|
|
84
|
+
min-width: rem(240);
|
|
85
|
+
}
|
|
86
|
+
th.th--mw-lg {
|
|
87
|
+
min-width: rem(360);
|
|
88
|
+
}
|
|
54
89
|
}
|
|
55
90
|
}
|
|
56
91
|
|
|
57
92
|
tbody tr {
|
|
58
93
|
|
|
94
|
+
border-bottom: var(--border-width) solid currentColor;
|
|
95
|
+
@include var(border-color,--colour-border);
|
|
59
96
|
|
|
60
97
|
&:is(:hover,:focus-within,.hover) {
|
|
61
98
|
|
|
@@ -69,21 +106,6 @@ tbody tr {
|
|
|
69
106
|
}
|
|
70
107
|
}
|
|
71
108
|
|
|
72
|
-
:is(td, th) {
|
|
73
|
-
|
|
74
|
-
border-top: var(--border-width) solid currentColor;
|
|
75
|
-
@include var(border-color,--colour-border);
|
|
76
|
-
}
|
|
77
|
-
|
|
78
|
-
&:first-child :is(td, th){
|
|
79
|
-
border-top: var(--border-width) solid currentColor;
|
|
80
|
-
@include var(border-color,--colour-primary);
|
|
81
|
-
}
|
|
82
|
-
|
|
83
|
-
&:last-child :is(td, th){
|
|
84
|
-
border-bottom: var(--border-width) solid currentColor;
|
|
85
|
-
@include var(border-color,--colour-border);
|
|
86
|
-
}
|
|
87
109
|
}
|
|
88
110
|
|
|
89
111
|
.border-0 > table,
|
|
@@ -162,6 +184,7 @@ table.border-0 {
|
|
|
162
184
|
margin-inline: 1.5rem;
|
|
163
185
|
margin-bottom: 1.5rem;
|
|
164
186
|
width: calc(100% - 3rem);
|
|
187
|
+
display: block;
|
|
165
188
|
|
|
166
189
|
thead {
|
|
167
190
|
display: none;
|
|
@@ -195,18 +218,6 @@ table.border-0 {
|
|
|
195
218
|
background: transparent;
|
|
196
219
|
}
|
|
197
220
|
}
|
|
198
|
-
|
|
199
|
-
&:last-child td:not(:last-child) {
|
|
200
|
-
border-bottom:none;
|
|
201
|
-
}
|
|
202
|
-
|
|
203
|
-
&:first-child td:first-child {
|
|
204
|
-
border-top: none;
|
|
205
|
-
border-color: var(--colour-border);
|
|
206
|
-
}
|
|
207
|
-
&:first-child td {
|
|
208
|
-
border-color: var(--colour-border);
|
|
209
|
-
}
|
|
210
221
|
}
|
|
211
222
|
|
|
212
223
|
td,
|
|
@@ -304,7 +315,7 @@ table.border-0 {
|
|
|
304
315
|
display: none !important;;
|
|
305
316
|
}
|
|
306
317
|
}
|
|
307
|
-
.table--cta:not(.table--fullwidth) tr td:last-child {
|
|
318
|
+
.table--cta:not(.table--fullwidth) tr td:not(:first-child):last-child {
|
|
308
319
|
display: block!important;
|
|
309
320
|
position: static;
|
|
310
321
|
width: 100%;
|
|
@@ -313,6 +324,10 @@ table.border-0 {
|
|
|
313
324
|
padding-left: 0;
|
|
314
325
|
text-align: left;
|
|
315
326
|
min-height: 0;
|
|
327
|
+
|
|
328
|
+
&:after {
|
|
329
|
+
display: none;
|
|
330
|
+
}
|
|
316
331
|
}
|
|
317
332
|
|
|
318
333
|
}
|
|
@@ -326,64 +341,66 @@ table.border-0 {
|
|
|
326
341
|
--cta-width: 8rem;
|
|
327
342
|
}
|
|
328
343
|
|
|
344
|
+
:is(iam-table).table--loading {
|
|
345
|
+
|
|
346
|
+
--cta-width: 1.5rem!important;
|
|
347
|
+
}
|
|
348
|
+
|
|
329
349
|
:not(iam-table).table--cta {
|
|
330
350
|
|
|
331
351
|
position: relative;
|
|
332
352
|
margin-right: calc(var(--cta-width) - 1.5rem);
|
|
333
|
-
|
|
334
|
-
&::after {
|
|
335
|
-
content: "";
|
|
336
|
-
display: block;
|
|
337
|
-
position: absolute;
|
|
338
|
-
bottom: 0;
|
|
339
|
-
left: 0;
|
|
340
|
-
width: calc(100% + calc(var(--cta-width) - 1.5rem));
|
|
341
|
-
border-bottom: 2px solid currentColor;
|
|
342
|
-
@include var(border-color,--colour-border);
|
|
343
|
-
z-index: 99;
|
|
344
|
-
}
|
|
345
353
|
}
|
|
346
354
|
|
|
347
355
|
.table--cta .table__wrapper {
|
|
348
356
|
overflow-y: hidden;
|
|
349
357
|
margin-bottom: 0;
|
|
350
358
|
}
|
|
351
|
-
|
|
352
|
-
.table--cta {
|
|
359
|
+
|
|
360
|
+
.table--cta:not(.table--loading):has(tr:first-child td:first-child:last-child) {
|
|
361
|
+
padding-right: calc(var(--wrapper-padding) + 1.5rem);
|
|
362
|
+
}
|
|
363
|
+
.table--cta:not(.table--loading):not(:has(tr:first-child td:first-child:last-child)) {
|
|
353
364
|
|
|
354
|
-
tr > *:last-child {
|
|
365
|
+
tr > *:not(:first-child):last-child {
|
|
355
366
|
|
|
356
367
|
position: absolute;
|
|
357
368
|
left: 100%;
|
|
358
369
|
top: auto;
|
|
359
370
|
z-index: 3;
|
|
360
371
|
background: transparent;
|
|
361
|
-
width: var(--cta-width);
|
|
372
|
+
width: calc(var(--cta-width) + 1.5rem);
|
|
362
373
|
padding-left: rem(40);
|
|
363
374
|
margin-left: rem(-40);
|
|
364
|
-
min-width: fit-content;
|
|
365
375
|
min-height: var(--row-height);
|
|
366
376
|
text-align: right;
|
|
367
377
|
background: linear-gradient(90deg, transparent 0%, var(--colour-canvas-2) 1.25rem);
|
|
368
378
|
|
|
379
|
+
&:after {
|
|
380
|
+
bottom: 0;
|
|
381
|
+
left: 0;
|
|
382
|
+
content: "";
|
|
383
|
+
position: absolute;
|
|
384
|
+
width: 100%;
|
|
385
|
+
height: 2px;
|
|
386
|
+
background-color: var(--colour-border);
|
|
387
|
+
}
|
|
388
|
+
|
|
369
389
|
a {
|
|
370
390
|
white-space: nowrap;
|
|
371
391
|
}
|
|
372
392
|
}
|
|
373
393
|
|
|
374
|
-
tr
|
|
394
|
+
tr > th:not(:first-child):last-child {
|
|
395
|
+
--colour-border: var(--colour-primary);
|
|
396
|
+
}
|
|
375
397
|
|
|
398
|
+
tbody tr:hover > *:not(:first-child):last-child {
|
|
376
399
|
background: linear-gradient(90deg, transparent 0%, var(--hover-background) 1.25rem);
|
|
377
400
|
}
|
|
378
401
|
|
|
379
|
-
|
|
380
|
-
margin-top:
|
|
381
|
-
}
|
|
382
|
-
tbody tr {
|
|
383
|
-
|
|
384
|
-
&:last-child td{
|
|
385
|
-
border-bottom: none;
|
|
386
|
-
}
|
|
402
|
+
thead tr > *:not(:first-child):last-child {
|
|
403
|
+
margin-top: 1px;
|
|
387
404
|
}
|
|
388
405
|
}
|
|
389
406
|
}
|
|
@@ -453,23 +470,50 @@ iam-table:is(.mh-sm,.mh-md,.mh-lg):not(.table--cta) {
|
|
|
453
470
|
display: none!important;
|
|
454
471
|
}
|
|
455
472
|
|
|
456
|
-
table:not(.table--filtered) tbody tr:nth-child(15) ~ tr {
|
|
473
|
+
table:not(.table--filtered):not(.table--ajax) tbody tr:nth-child(15) ~ tr {
|
|
457
474
|
display: none;
|
|
458
475
|
}
|
|
459
476
|
|
|
460
|
-
// Statuses
|
|
461
477
|
|
|
478
|
+
// Loading via ajax
|
|
479
|
+
.table--loading {
|
|
480
|
+
pointer-events: none;
|
|
481
|
+
position: relative;
|
|
482
|
+
|
|
483
|
+
table {
|
|
484
|
+
min-height: 20rem;
|
|
485
|
+
opacity: 0.5;
|
|
486
|
+
}
|
|
487
|
+
|
|
488
|
+
&::after {
|
|
489
|
+
content: "Loading...";
|
|
490
|
+
position: absolute;
|
|
491
|
+
top: rem(100);
|
|
492
|
+
left: 50%;
|
|
493
|
+
transform: translate(-50%,0);
|
|
494
|
+
font-weight: bold;
|
|
495
|
+
color: var(--colour-heading);
|
|
496
|
+
font-size: 1.5rem;
|
|
497
|
+
text-shadow: 0px 0px 10px var(--colour-canvas-2);
|
|
498
|
+
padding-inline: 2rem;
|
|
499
|
+
text-shadow: 0px 0px 10px var(--colour-canvas-2);
|
|
500
|
+
background: radial-gradient(var(--colour-canvas-2), transparent);
|
|
501
|
+
}
|
|
502
|
+
}
|
|
503
|
+
|
|
504
|
+
// Statuses
|
|
462
505
|
table {
|
|
463
506
|
|
|
464
|
-
:is([data-content="
|
|
465
|
-
[data-content="
|
|
466
|
-
[data-content="
|
|
467
|
-
[data-content="
|
|
468
|
-
[data-content="
|
|
469
|
-
[data-content="
|
|
470
|
-
[data-content="
|
|
471
|
-
[data-content="
|
|
472
|
-
|
|
507
|
+
:is([data-content="low"],
|
|
508
|
+
[data-content="medium"],
|
|
509
|
+
[data-content="high"],
|
|
510
|
+
[data-content="unknown"],
|
|
511
|
+
[data-content="incomplete"],
|
|
512
|
+
[data-content="requires approval"],
|
|
513
|
+
[data-content="verified"],
|
|
514
|
+
[data-content="not started"],
|
|
515
|
+
[data-content="completed"],
|
|
516
|
+
.alert-status:not([data-content="0"])
|
|
473
517
|
) {
|
|
474
518
|
|
|
475
519
|
position: relative;
|
|
@@ -485,7 +529,6 @@ table {
|
|
|
485
529
|
position: absolute;
|
|
486
530
|
top: 1rem;
|
|
487
531
|
left: 0;
|
|
488
|
-
content: "";
|
|
489
532
|
font-size: rem(16);
|
|
490
533
|
line-height: 1;
|
|
491
534
|
height: rem(16);
|
|
@@ -494,48 +537,55 @@ table {
|
|
|
494
537
|
}
|
|
495
538
|
}
|
|
496
539
|
|
|
497
|
-
[data-content="
|
|
540
|
+
[data-content="high"]:after {
|
|
498
541
|
content: "\f325";
|
|
499
542
|
font-weight: normal;
|
|
500
543
|
color: var(--colour-danger);
|
|
501
544
|
}
|
|
502
545
|
|
|
503
|
-
[data-content="
|
|
546
|
+
[data-content="medium"]:after {
|
|
504
547
|
|
|
505
548
|
content: "\f7a4";
|
|
506
549
|
font-weight: normal;
|
|
507
550
|
color: var(--colour-warning);
|
|
508
551
|
}
|
|
509
552
|
|
|
510
|
-
[data-content="
|
|
553
|
+
[data-content="low"]:after {
|
|
511
554
|
|
|
512
555
|
content: "\e404";
|
|
513
556
|
font-weight: normal;
|
|
514
557
|
color: var(--colour-complete);
|
|
515
558
|
}
|
|
516
559
|
|
|
517
|
-
|
|
560
|
+
[data-content="unknown"]:after {
|
|
561
|
+
|
|
562
|
+
content: "\e404";
|
|
563
|
+
font-weight: normal;
|
|
564
|
+
color: var(--colour-muted);
|
|
565
|
+
}
|
|
566
|
+
|
|
567
|
+
:is([data-content="not started"],[data-content="incomplete"]):after {
|
|
518
568
|
|
|
519
569
|
content: "\f024";
|
|
520
570
|
font-weight: light;
|
|
521
571
|
color: var(--colour-danger);
|
|
522
572
|
}
|
|
523
573
|
|
|
524
|
-
[data-content="
|
|
574
|
+
[data-content="requires approval"]:after {
|
|
525
575
|
|
|
526
576
|
content: "\f024";
|
|
527
577
|
font-weight: light;
|
|
528
578
|
color: var(--colour-warning);
|
|
529
579
|
}
|
|
530
580
|
|
|
531
|
-
:is([data-content="
|
|
581
|
+
:is([data-content="verified"],[data-content="completed"]):after {
|
|
532
582
|
|
|
533
583
|
content: "\f00c";
|
|
534
584
|
font-weight: normal;
|
|
535
585
|
color: var(--colour-complete);
|
|
536
586
|
}
|
|
537
587
|
|
|
538
|
-
.alert-status:not(:empty):after {
|
|
588
|
+
.alert-status:not([data-content="0"]):not(:empty):after {
|
|
539
589
|
|
|
540
590
|
content: "\f06a";
|
|
541
591
|
font-weight: light;
|
|
@@ -56,19 +56,23 @@ body {
|
|
|
56
56
|
// #region scrollbars
|
|
57
57
|
:is(div,form,fieldset)::-webkit-scrollbar {
|
|
58
58
|
width: 10px;
|
|
59
|
-
height:
|
|
59
|
+
height: 10px;
|
|
60
60
|
}
|
|
61
61
|
|
|
62
62
|
:is(div,form,fieldset)::-webkit-scrollbar-track {
|
|
63
63
|
background-color: #f1f1f1;
|
|
64
|
-
border-
|
|
64
|
+
border-top: 4px solid var(--colour-canvas-2);
|
|
65
|
+
border-left: 4px solid var(--colour-canvas-2);
|
|
65
66
|
}
|
|
66
67
|
|
|
67
68
|
:is(div,form,fieldset)::-webkit-scrollbar-thumb {
|
|
68
69
|
background-color: #c1c1c1;
|
|
69
70
|
width: 6px;
|
|
70
|
-
border-
|
|
71
|
+
border-top: 4px solid var(--colour-canvas-2);
|
|
72
|
+
border-left: 4px solid var(--colour-canvas-2);
|
|
71
73
|
}
|
|
74
|
+
|
|
75
|
+
|
|
72
76
|
//#endregion
|
|
73
77
|
|
|
74
78
|
body > footer,
|
|
@@ -52,6 +52,9 @@ class iamTable extends HTMLElement {
|
|
|
52
52
|
if(!this.hasAttribute('data-show'))
|
|
53
53
|
this.setAttribute('data-show', 15);
|
|
54
54
|
|
|
55
|
+
if(!this.hasAttribute('data-increment'))
|
|
56
|
+
this.setAttribute('data-increment', 15);
|
|
57
|
+
|
|
55
58
|
this.setAttribute('data-pages', Math.ceil(this.getAttribute('data-total') / this.getAttribute('data-show')));
|
|
56
59
|
}
|
|
57
60
|
|
|
@@ -72,6 +75,10 @@ class iamTable extends HTMLElement {
|
|
|
72
75
|
this.table.parentNode.insertBefore(this.form, this.table.nextSibling);
|
|
73
76
|
}
|
|
74
77
|
|
|
78
|
+
// Set ajax class
|
|
79
|
+
if(this.form.hasAttribute('data-ajax'))
|
|
80
|
+
this.table.classList.add('table--ajax');
|
|
81
|
+
|
|
75
82
|
// Create a data list if a search input is present
|
|
76
83
|
tableModule.createSearchDataList(this.table, this.form);
|
|
77
84
|
|
|
@@ -100,8 +107,12 @@ class iamTable extends HTMLElement {
|
|
|
100
107
|
|
|
101
108
|
this.shadowRoot.querySelector('.table__wrapper').addEventListener("scroll", (event) => {
|
|
102
109
|
|
|
103
|
-
if(this.table.querySelector('dialog[open]'))
|
|
110
|
+
if(this.table.querySelector('dialog[open]')){
|
|
111
|
+
|
|
104
112
|
this.table.querySelector('dialog[open]').close();
|
|
113
|
+
this.table.querySelector('.dialog__wrapper > button.active').classList.remove('active');
|
|
114
|
+
}
|
|
115
|
+
|
|
105
116
|
});
|
|
106
117
|
}
|
|
107
118
|
|
|
@@ -121,7 +121,7 @@ function createAppliedFilters(container,filters) {
|
|
|
121
121
|
if(name.match(/\[(.*)\]/)){
|
|
122
122
|
let newName = name.replace(/\[(.*)\]/,`[]`);
|
|
123
123
|
let value = name.replace(/.*\[(.*)\]/,`$1`);
|
|
124
|
-
selector = `[
|
|
124
|
+
selector = `[value="${value}"]`;
|
|
125
125
|
}
|
|
126
126
|
|
|
127
127
|
let inputs = container.querySelectorAll(selector);
|
|
@@ -31,11 +31,8 @@ const extendDialogs = (body) => {
|
|
|
31
31
|
|
|
32
32
|
// Open the modal!
|
|
33
33
|
dialog.showModal();
|
|
34
|
-
|
|
35
34
|
dialog.focus();
|
|
36
35
|
|
|
37
|
-
console.log(dialog.querySelector('button'));
|
|
38
|
-
|
|
39
36
|
window.dataLayer = window.dataLayer || [];
|
|
40
37
|
window.dataLayer.push({
|
|
41
38
|
"event": "openModal",
|
|
@@ -49,7 +46,12 @@ const extendDialogs = (body) => {
|
|
|
49
46
|
|
|
50
47
|
event.preventDefault();
|
|
51
48
|
dialog.close()
|
|
52
|
-
|
|
49
|
+
|
|
50
|
+
// Remove active class from exiting active buttons
|
|
51
|
+
Array.from(document.querySelectorAll('.dialog__wrapper > button')).forEach((btnElement,index) => {
|
|
52
|
+
btnElement.classList.remove('active');
|
|
53
|
+
});
|
|
54
|
+
|
|
53
55
|
window.dataLayer = window.dataLayer || [];
|
|
54
56
|
window.dataLayer.push({
|
|
55
57
|
"event": "closeModal",
|
|
@@ -61,6 +63,11 @@ const extendDialogs = (body) => {
|
|
|
61
63
|
if (event && event.target instanceof HTMLElement && event.target.closest('button[formmethod="dialog"]')){
|
|
62
64
|
const dialog = event.target.closest('dialog[open]');
|
|
63
65
|
|
|
66
|
+
// Remove active class from exiting active buttons
|
|
67
|
+
Array.from(document.querySelectorAll('.dialog__wrapper > button')).forEach((btnElement,index) => {
|
|
68
|
+
btnElement.classList.remove('active');
|
|
69
|
+
});
|
|
70
|
+
|
|
64
71
|
window.dataLayer = window.dataLayer || [];
|
|
65
72
|
window.dataLayer.push({
|
|
66
73
|
"event": "closeModal",
|
|
@@ -105,6 +112,11 @@ const extendDialogs = (body) => {
|
|
|
105
112
|
document.querySelector('dialog[open]').close();
|
|
106
113
|
|
|
107
114
|
|
|
115
|
+
// Remove active class from exiting active buttons
|
|
116
|
+
Array.from(document.querySelectorAll('.dialog__wrapper > button')).forEach((btnElement,index) => {
|
|
117
|
+
btnElement.classList.remove('active');
|
|
118
|
+
});
|
|
119
|
+
|
|
108
120
|
if(popover.hasAttribute('open')){
|
|
109
121
|
|
|
110
122
|
popover.close();
|
|
@@ -128,7 +140,6 @@ const extendDialogs = (body) => {
|
|
|
128
140
|
|
|
129
141
|
topOffset -= container.top;
|
|
130
142
|
leftOffset -= container.left;
|
|
131
|
-
|
|
132
143
|
}
|
|
133
144
|
|
|
134
145
|
if(popover.classList.contains('dialog--fix')){
|