@iamproperty/components 3.5.0 → 3.6.0
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/accordion.css.map +1 -1
- package/assets/css/components/admin-panel.css +1 -1
- package/assets/css/components/admin-panel.css.map +1 -1
- package/assets/css/components/applied-filters.css +1 -1
- package/assets/css/components/applied-filters.css.map +1 -1
- package/assets/css/components/card.css +1 -1
- package/assets/css/components/card.css.map +1 -1
- package/assets/css/components/charts.css +1 -1
- package/assets/css/components/charts.css.map +1 -1
- package/assets/css/components/dialog.css +1 -1
- package/assets/css/components/dialog.css.map +1 -1
- package/assets/css/components/forms.css +1 -1
- package/assets/css/components/forms.css.map +1 -1
- package/assets/css/components/header.css +1 -1
- package/assets/css/components/header.css.map +1 -1
- package/assets/css/components/lists.css.map +1 -1
- package/assets/css/components/nav.css +1 -1
- package/assets/css/components/nav.css.map +1 -1
- package/assets/css/components/pagination.css +1 -1
- package/assets/css/components/pagination.css.map +1 -1
- package/assets/css/components/property-searchbar.css +1 -1
- package/assets/css/components/property-searchbar.css.map +1 -1
- package/assets/css/components/table.css +1 -1
- package/assets/css/components/table.css.map +1 -1
- package/assets/css/components/tabs.css +1 -1
- package/assets/css/components/tabs.css.map +1 -1
- package/assets/css/components/tooltips.css +1 -1
- package/assets/css/components/tooltips.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.js +1 -1
- package/assets/js/components/card/card.component.min.js +5 -5
- package/assets/js/components/card/card.component.min.js.map +1 -1
- package/assets/js/components/filterlist/filterlist.component.js +13 -9
- package/assets/js/components/filterlist/filterlist.component.min.js +14 -5
- package/assets/js/components/filterlist/filterlist.component.min.js.map +1 -1
- package/assets/js/components/header/header.component.min.js +5 -5
- package/assets/js/components/table/table.component.js +12 -1
- package/assets/js/components/table/table.component.min.js +21 -11
- package/assets/js/components/table/table.component.min.js.map +1 -1
- package/assets/js/components/tabs/tabs.component.js +6 -2
- package/assets/js/components/tabs/tabs.component.min.js +7 -5
- package/assets/js/components/tabs/tabs.component.min.js.map +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 +6 -2
- package/assets/js/modules/helpers.js +5 -0
- package/assets/js/modules/table.js +25 -13
- package/assets/js/modules/tabs.js +4 -2
- package/assets/js/scripts.bundle.js +56 -34
- 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 +1 -2
- package/assets/sass/_corefiles.scss +3 -0
- package/assets/sass/_functions/functions.scss +2 -3
- package/assets/sass/_functions/mixins.scss +2 -18
- package/assets/sass/_functions/utilities.scss +35 -3
- package/assets/sass/_functions/variables.scss +82 -69
- package/assets/sass/_tests/colours.spec.scss +8 -8
- package/assets/sass/_tests/func.spec.scss +1 -1
- package/assets/sass/components/admin-panel.scss +105 -37
- package/assets/sass/components/applied-filters.scss +4 -0
- package/assets/sass/components/card.scss +12 -8
- package/assets/sass/components/charts.scss +2 -2
- package/assets/sass/components/dialog.scss +22 -14
- package/assets/sass/components/forms.scss +2 -2
- package/assets/sass/components/pagination.scss +4 -0
- package/assets/sass/components/table.scss +145 -30
- package/assets/sass/components/tabs.scss +54 -98
- package/assets/sass/components/tooltips.scss +1 -1
- package/assets/sass/foundations/buttons.scss +61 -46
- package/assets/sass/foundations/reboot.scss +5 -4
- package/assets/sass/foundations/root.scss +42 -48
- package/assets/sass/foundations/type.scss +4 -0
- package/assets/sass/helpers/max-height.scss +3 -0
- package/assets/ts/components/card/card.component.ts +1 -1
- package/assets/ts/components/filterlist/filterlist.component.ts +13 -11
- package/assets/ts/components/table/table.component.ts +12 -1
- package/assets/ts/components/tabs/tabs.component.ts +7 -2
- package/assets/ts/modules/applied-filters.ts +9 -3
- package/assets/ts/modules/helpers.ts +9 -1
- package/assets/ts/modules/table.ts +34 -14
- package/assets/ts/modules/tabs.ts +7 -2
- package/assets/ts/tests/table.spec.ts +1 -4
- package/dist/components.es.js +157 -126
- package/dist/components.umd.js +37 -15
- package/dist/style.css +1 -1
- package/package.json +1 -1
|
@@ -3,6 +3,14 @@
|
|
|
3
3
|
// #region button primary
|
|
4
4
|
.btn {
|
|
5
5
|
|
|
6
|
+
--btn-margin: #{rem(16)};
|
|
7
|
+
|
|
8
|
+
@include media-breakpoint-up(sm) {
|
|
9
|
+
|
|
10
|
+
--btn-margin: #{rem(24)};
|
|
11
|
+
}
|
|
12
|
+
|
|
13
|
+
|
|
6
14
|
&:not(.btn-secondary)[class*="colour-"]{
|
|
7
15
|
--colour-btn-bg: var(--colour);
|
|
8
16
|
--colour-btn-border: var(--colour);
|
|
@@ -28,8 +36,8 @@
|
|
|
28
36
|
line-height: rem(24);
|
|
29
37
|
padding: calc(rem(12) - 2px) calc(rem(40) - 2px);
|
|
30
38
|
border-radius: rem(24);
|
|
31
|
-
margin-bottom:
|
|
32
|
-
margin-right:
|
|
39
|
+
margin-bottom: var(--btn-margin);
|
|
40
|
+
margin-right: var(--btn-margin);
|
|
33
41
|
transition: background .5s, color .5s;
|
|
34
42
|
height: auto;
|
|
35
43
|
max-width: fit-content;
|
|
@@ -146,11 +154,13 @@ a:is(:hover, :focus, .hover, :active, .active):not([disabled]) .btn-secondary,
|
|
|
146
154
|
|
|
147
155
|
text-align: center;
|
|
148
156
|
width: calc(rem(48) - 4px);
|
|
157
|
+
min-width: calc(rem(48) - 4px);
|
|
158
|
+
max-width: calc(rem(48) - 4px);
|
|
149
159
|
height: calc(rem(48) - 4px)!important;
|
|
150
160
|
text-indent: -300px;
|
|
151
161
|
overflow: hidden;
|
|
152
|
-
|
|
153
162
|
position: relative;
|
|
163
|
+
font-size: rem(20);
|
|
154
164
|
|
|
155
165
|
&:before {
|
|
156
166
|
position: absolute;
|
|
@@ -175,7 +185,7 @@ a:is(:hover, :focus, .hover, :active, .active):not([disabled]) .btn-secondary,
|
|
|
175
185
|
|
|
176
186
|
&.btn-secondary:is(:hover, :focus, .hover, :active, .active, :focus-within):not([disabled]) {
|
|
177
187
|
background-color: var(--colour);
|
|
178
|
-
color: var(--colour-primary);
|
|
188
|
+
color: var(--colour-primary-theme);
|
|
179
189
|
|
|
180
190
|
&:is(.colour-primary,.colour-dark,.colour-danger,.colour-black) {
|
|
181
191
|
color: var(--colour-inverted);
|
|
@@ -189,6 +199,7 @@ a:is(:hover, :focus, .hover, :active, .active):not([disabled]) .btn-secondary,
|
|
|
189
199
|
|
|
190
200
|
--colour-btn-bg-hover: var(--colour);
|
|
191
201
|
--colour-btn-border-hover: var(--colour);
|
|
202
|
+
--colour-btn-hover: var(--colour-primary-theme);
|
|
192
203
|
position: relative;
|
|
193
204
|
padding-left: rem(56);
|
|
194
205
|
padding-right: rem(56);
|
|
@@ -198,7 +209,7 @@ a:is(:hover, :focus, .hover, :active, .active):not([disabled]) .btn-secondary,
|
|
|
198
209
|
|
|
199
210
|
padding-left: rem(40);
|
|
200
211
|
padding-right: rem(40);
|
|
201
|
-
|
|
212
|
+
|
|
202
213
|
&:before {
|
|
203
214
|
content: "\f00c";
|
|
204
215
|
font-family: "Font Awesome 6 Pro";
|
|
@@ -313,54 +324,58 @@ a:is(:hover, :focus, .hover, :active, .active):not([disabled]) .btn-secondary,
|
|
|
313
324
|
// #endregion
|
|
314
325
|
|
|
315
326
|
|
|
316
|
-
// #region
|
|
327
|
+
// #region Tertiary Button
|
|
317
328
|
|
|
318
|
-
.btn {
|
|
329
|
+
.btn.btn-tertiary {
|
|
319
330
|
|
|
320
|
-
|
|
321
|
-
|
|
322
|
-
|
|
323
|
-
|
|
324
|
-
|
|
325
|
-
|
|
326
|
-
|
|
327
|
-
|
|
328
|
-
|
|
329
|
-
|
|
330
|
-
position: relative;
|
|
331
|
-
|
|
332
|
-
&:not(.text-decoration-none):after {
|
|
333
|
-
position: absolute;
|
|
334
|
-
content: "";
|
|
335
|
-
top: 100%;
|
|
336
|
-
left: 50%;
|
|
337
|
-
height: 2px;
|
|
338
|
-
width: 100%;
|
|
339
|
-
transform: translate(-50%,0);
|
|
340
|
-
background: var(--colour-underline);
|
|
341
|
-
transition: width 0.5s;
|
|
342
|
-
}
|
|
331
|
+
background-color: transparent;
|
|
332
|
+
border: none;
|
|
333
|
+
color: var(--colour-link);
|
|
334
|
+
margin: 0 var(--btn-margin) var(--btn-margin) 0;
|
|
335
|
+
padding: 0;
|
|
336
|
+
font-size: rem(18);
|
|
337
|
+
font-weight: normal;
|
|
338
|
+
line-height: rem(24);
|
|
339
|
+
min-height: rem(24);
|
|
340
|
+
position: relative;
|
|
343
341
|
|
|
344
|
-
|
|
345
|
-
|
|
346
|
-
|
|
347
|
-
|
|
348
|
-
|
|
349
|
-
|
|
350
|
-
|
|
351
|
-
|
|
342
|
+
&:after {
|
|
343
|
+
position: absolute;
|
|
344
|
+
content: "";
|
|
345
|
+
top: 100%;
|
|
346
|
+
left: 50%;
|
|
347
|
+
height: 2px;
|
|
348
|
+
width: 100%;
|
|
349
|
+
transform: translate(-50%,0);
|
|
350
|
+
background: var(--colour-underline);
|
|
351
|
+
transition: width 0.5s;
|
|
352
|
+
}
|
|
352
353
|
|
|
353
|
-
&:is(:hover, :focus, .hover, :focus-within):not([disabled], :active, .active) {
|
|
354
354
|
|
|
355
|
-
|
|
356
|
-
width: 60%;
|
|
357
|
-
}
|
|
358
|
-
}
|
|
359
|
-
&:is(:active, .active):not([disabled]) {
|
|
355
|
+
&.text-decoration-none:after {
|
|
360
356
|
|
|
361
|
-
|
|
357
|
+
width: 0%;
|
|
358
|
+
}
|
|
359
|
+
|
|
360
|
+
[class*=fa-] {
|
|
361
|
+
margin-left: 0;
|
|
362
|
+
margin-right: 0.5rem;
|
|
363
|
+
}
|
|
364
|
+
[class*=fa-]:not(:first-child) {
|
|
365
|
+
margin-left: 0.5rem;
|
|
366
|
+
margin-right: 0;
|
|
367
|
+
}
|
|
368
|
+
|
|
369
|
+
&:is(:hover, :focus, .hover, :focus-within):not([disabled], :active, .active) {
|
|
370
|
+
|
|
371
|
+
&:after {
|
|
372
|
+
width: 60%!important;
|
|
362
373
|
}
|
|
363
374
|
}
|
|
375
|
+
&:is(:active, .active):not([disabled]) {
|
|
376
|
+
|
|
377
|
+
color: var(--colour-active);
|
|
378
|
+
}
|
|
364
379
|
|
|
365
380
|
}
|
|
366
|
-
|
|
381
|
+
// #endregion
|
|
@@ -55,18 +55,19 @@ body {
|
|
|
55
55
|
|
|
56
56
|
// #region scrollbars
|
|
57
57
|
div::-webkit-scrollbar {
|
|
58
|
-
width:
|
|
59
|
-
height:
|
|
58
|
+
width: 10px;
|
|
59
|
+
height: 6px;
|
|
60
60
|
}
|
|
61
61
|
|
|
62
62
|
div::-webkit-scrollbar-track {
|
|
63
63
|
background-color: #f1f1f1;
|
|
64
|
-
border-
|
|
64
|
+
border-left: 4px solid var(--bg-colour,var(--colour-canvas));
|
|
65
65
|
}
|
|
66
66
|
|
|
67
67
|
div::-webkit-scrollbar-thumb {
|
|
68
68
|
background-color: #c1c1c1;
|
|
69
|
-
|
|
69
|
+
width: 6px;
|
|
70
|
+
border-left: 4px solid var(--bg-colour,var(--colour-canvas));
|
|
70
71
|
}
|
|
71
72
|
//#endregion
|
|
72
73
|
|
|
@@ -26,88 +26,82 @@
|
|
|
26
26
|
|
|
27
27
|
// Extra vars needed
|
|
28
28
|
--content-max-width: #{$content-max-width};
|
|
29
|
-
|
|
30
29
|
--colour-brand: var(--colour-primary);
|
|
31
|
-
|
|
32
30
|
}
|
|
33
31
|
|
|
34
32
|
// Dark mode; functional colours get updated
|
|
35
33
|
@media screen and (prefers-color-scheme: dark) {
|
|
36
34
|
:root {
|
|
35
|
+
|
|
36
|
+
@each $color, $value in $dark-mode-colors {
|
|
37
|
+
--colour-#{$color}: #{$value};
|
|
38
|
+
}
|
|
37
39
|
@include invert-colours();
|
|
38
40
|
}
|
|
39
|
-
|
|
40
|
-
body .text-primary {
|
|
41
|
-
color: #{$colour-inverted}!important;
|
|
42
|
-
}
|
|
43
|
-
|
|
44
|
-
|
|
45
41
|
}
|
|
46
42
|
|
|
47
|
-
@media screen {
|
|
43
|
+
@media screen and (prefers-color-scheme: light) {
|
|
48
44
|
|
|
49
45
|
// Reset the colours of lighter backgrounds to make sure they aren't over written by dark mode. Some other tweaks to colours are applied
|
|
50
|
-
[class*="bg-"]:not(.bg-primary):not(.bg-dark):not(.bg-danger):not(.bg-canvas):not(.invert-colours) {
|
|
46
|
+
[class*="bg-"]:not(.bg-primary):not(.bg-dark):not(.bg-danger):not(.bg-white):not(.bg-canvas):not(.bg-canvas-2):not(.invert-colours) {
|
|
51
47
|
|
|
48
|
+
@each $color, $value in $theme-colors {
|
|
49
|
+
--colour-#{$color}: #{$value};
|
|
50
|
+
}
|
|
52
51
|
@include reset-colours();
|
|
53
|
-
|
|
54
52
|
--colour-body: var(--colour-primary);
|
|
55
|
-
--colour-heading: var(--colour-primary);
|
|
56
53
|
color: var(--colour-body);
|
|
57
|
-
--colour-underline: var(--colour-primary);
|
|
58
|
-
}
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
// Slight colour adjustments on the light background to match brand guidelines
|
|
63
|
-
.bg-light[class*="bg-"]:not(.bg-primary):not(.bg-dark):not(.bg-danger):not(.prevent-invert) {
|
|
64
|
-
--colour-canvas: var(--colour-light);
|
|
65
|
-
--colour-heading: var(--colour-dark);
|
|
66
|
-
color: var(--colour-dark);
|
|
67
54
|
}
|
|
68
55
|
|
|
69
56
|
// Override the colours when on a dark background, similiar to dark mode but on a module level
|
|
70
|
-
.bg-
|
|
71
|
-
.bg-dark:not(.prevent-invert),
|
|
72
|
-
.bg-danger:not(.prevent-invert),
|
|
73
|
-
.bg-black:not(.prevent-invert),
|
|
57
|
+
[class*="bg-"]:not(.bg-info):not(.bg-success):not(.bg-light):not(.bg-white):not(.bg-canvas):not(.bg-canvas-2):not(.prevent-invert),
|
|
74
58
|
.invert-colours {
|
|
75
59
|
|
|
76
|
-
|
|
60
|
+
@include invert-colours();
|
|
77
61
|
|
|
78
|
-
@if $compatible != "true" {
|
|
79
|
-
|
|
80
|
-
@include invert-colours();
|
|
81
|
-
}
|
|
82
62
|
color: #{$colour-inverted};
|
|
83
63
|
}
|
|
64
|
+
}
|
|
84
65
|
|
|
66
|
+
@media screen and (prefers-color-scheme: dark) {
|
|
85
67
|
|
|
86
|
-
//
|
|
87
|
-
.bg-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
--colour-underline: #{$colour-inverted};
|
|
68
|
+
// Reset the colours of lighter backgrounds to make sure they aren't over written by dark mode. Some other tweaks to colours are applied
|
|
69
|
+
[class*="bg-"]:not(.bg-canvas):not(.bg-canvas-2) {
|
|
70
|
+
|
|
71
|
+
@include reset-colours();
|
|
72
|
+
--colour-body: #{$primary};
|
|
73
|
+
color: var(--colour-body);
|
|
93
74
|
}
|
|
94
|
-
}
|
|
95
75
|
|
|
76
|
+
@each $color, $value in $theme-colors {
|
|
96
77
|
|
|
78
|
+
.bg-#{$color}[class*="gradient-"] {
|
|
97
79
|
|
|
98
|
-
|
|
80
|
+
background-color: var(--colour-#{$color}-theme) !important;
|
|
81
|
+
}
|
|
82
|
+
}
|
|
83
|
+
|
|
84
|
+
[class*="bg-"][class*="gradient-"]:not(.bg-primary):not(.bg-dark):not(.bg-danger) {
|
|
99
85
|
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
@if $compatible != "true" {
|
|
103
|
-
|
|
104
|
-
@include invert-colours();
|
|
86
|
+
@each $color, $value in $theme-colors {
|
|
87
|
+
--colour-#{$color}: #{$value};
|
|
105
88
|
}
|
|
89
|
+
@include reset-colours();
|
|
90
|
+
--colour-body: var(--colour-primary-theme);
|
|
91
|
+
color: var(--colour-body);
|
|
92
|
+
}
|
|
93
|
+
|
|
94
|
+
[class*="bg-"][class*="gradient-"]:not(.bg-info):not(.bg-success):not(.bg-light):not(.prevent-invert) {
|
|
95
|
+
|
|
96
|
+
@include invert-colours();
|
|
97
|
+
|
|
106
98
|
color: #{$colour-inverted};
|
|
107
|
-
--colour-underline: #{$colour-inverted};
|
|
108
99
|
}
|
|
100
|
+
}
|
|
109
101
|
|
|
110
|
-
|
|
111
|
-
|
|
102
|
+
|
|
103
|
+
@media (forced-colors: active) {
|
|
104
|
+
:root {
|
|
105
|
+
--contrast-outline-width: 1px;
|
|
112
106
|
}
|
|
113
107
|
}
|
|
@@ -8,7 +8,7 @@ class iamCard extends HTMLElement {
|
|
|
8
8
|
const assetLocation = document.body.hasAttribute('data-assets-location') ? document.body.getAttribute('data-assets-location') : '/assets';
|
|
9
9
|
const loadCSS = `@import "${assetLocation}/css/components/card.css";`;
|
|
10
10
|
|
|
11
|
-
if(this.querySelector('.
|
|
11
|
+
if(this.querySelector('.fa'))
|
|
12
12
|
this.classList.add('card--has-icon');
|
|
13
13
|
|
|
14
14
|
let classList = this.classList.toString();
|
|
@@ -22,14 +22,23 @@ class iamFilterlist extends HTMLElement {
|
|
|
22
22
|
${this.hasAttribute('css') ? `@import "${this.getAttribute('css')}";` : ``}
|
|
23
23
|
|
|
24
24
|
:host {
|
|
25
|
-
margin-bottom:
|
|
25
|
+
margin-bottom: 1rem;
|
|
26
26
|
display:block;
|
|
27
27
|
}
|
|
28
|
+
:host(.mh-sm){
|
|
29
|
+
max-height: none!important;
|
|
30
|
+
}
|
|
31
|
+
:host(.mh-md){
|
|
32
|
+
max-height: none!important;
|
|
33
|
+
}
|
|
34
|
+
:host(.mh-lg){
|
|
35
|
+
max-height: none!important;
|
|
36
|
+
}
|
|
28
37
|
</style>
|
|
29
38
|
<div class="form-control__wrapper">
|
|
30
39
|
<label for="search" class="visually-hidden">Search</label>
|
|
31
40
|
<span class="suffix" role="presentation"><slot name="icon"></slot></span>
|
|
32
|
-
<input name="search" id="search" type="text" class="form-control" autocomplete="off"
|
|
41
|
+
<input name="search" id="search" type="text" class="form-control" autocomplete="off" placeholder="Search" />
|
|
33
42
|
</div>
|
|
34
43
|
<div class="list__wrapper">
|
|
35
44
|
<slot></slot>
|
|
@@ -40,15 +49,8 @@ class iamFilterlist extends HTMLElement {
|
|
|
40
49
|
|
|
41
50
|
connectedCallback() {
|
|
42
51
|
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
"medium": "25rem",
|
|
46
|
-
"large": "37.5rem"
|
|
47
|
-
}
|
|
48
|
-
|
|
49
|
-
let maxHeightClass = (this.hasAttribute('data-max-height') && maxHeights[this.getAttribute('data-max-height')] ? 'list__wrapper--'+this.getAttribute('data-max-height') : '');
|
|
50
|
-
|
|
51
|
-
this.shadowRoot.querySelector('.list__wrapper').classList.add(maxHeightClass);
|
|
52
|
+
let classList = this.classList.toString();
|
|
53
|
+
this.shadowRoot.querySelector('.list__wrapper').setAttribute('class',`list__wrapper ${classList}`);
|
|
52
54
|
|
|
53
55
|
if(!this.querySelector('i.fa-search'))
|
|
54
56
|
this.innerHTML += '<i class="fa fa-light fa-search" aria-hidden="true" slot="icon"></i>';
|
|
@@ -20,6 +20,16 @@ class iamTable extends HTMLElement {
|
|
|
20
20
|
template.innerHTML = `
|
|
21
21
|
<style>
|
|
22
22
|
@import "${assetLocation}/css/core.min.css";
|
|
23
|
+
|
|
24
|
+
:host(.mh-sm){
|
|
25
|
+
max-height: none!important;
|
|
26
|
+
}
|
|
27
|
+
:host(.mh-md){
|
|
28
|
+
max-height: none!important;
|
|
29
|
+
}
|
|
30
|
+
:host(.mh-lg){
|
|
31
|
+
max-height: none!important;
|
|
32
|
+
}
|
|
23
33
|
</style>
|
|
24
34
|
${isCTA ? '<div class="table--cta">' : ''}
|
|
25
35
|
<div class="table__wrapper ${classList}">
|
|
@@ -48,7 +58,7 @@ class iamTable extends HTMLElement {
|
|
|
48
58
|
connectedCallback() {
|
|
49
59
|
|
|
50
60
|
this.table = this.querySelector('table');
|
|
51
|
-
this.savedTableBody = this.querySelector('tbody').cloneNode(true);
|
|
61
|
+
this.savedTableBody = this.table.querySelector('tbody').cloneNode(true);
|
|
52
62
|
this.pagination = this.shadowRoot.querySelector('.table__pagination');
|
|
53
63
|
|
|
54
64
|
// Set events on the filter table
|
|
@@ -82,6 +92,7 @@ class iamTable extends HTMLElement {
|
|
|
82
92
|
tableModule.makeTableFunctional(this.table, this.form, this.pagination, this);
|
|
83
93
|
tableModule.filterTable(this.table, this.form,this);
|
|
84
94
|
createPaginationButttons(this,this.pagination);
|
|
95
|
+
tableModule.populateDataQueries(this.table, this.form);
|
|
85
96
|
}
|
|
86
97
|
|
|
87
98
|
this.shadowRoot.querySelector('.table__wrapper').addEventListener("scroll", (event) => {
|
|
@@ -15,12 +15,14 @@ class iamTabs extends HTMLElement {
|
|
|
15
15
|
this.attachShadow({ mode: 'open'});
|
|
16
16
|
|
|
17
17
|
const assetLocation = document.body.hasAttribute('data-assets-location') ? document.body.getAttribute('data-assets-location') : '/assets';
|
|
18
|
-
const loadCSS = `@import "${assetLocation}/css/components/tabs.css";`;
|
|
19
18
|
const template = document.createElement('template');
|
|
20
19
|
template.innerHTML = `
|
|
21
20
|
<style>
|
|
22
21
|
@import "${assetLocation}/css/core.min.css";
|
|
23
|
-
|
|
22
|
+
|
|
23
|
+
:host(.admin-panel){
|
|
24
|
+
display: contents!important;
|
|
25
|
+
}
|
|
24
26
|
|
|
25
27
|
${this.hasAttribute('css') ? `@import "${this.getAttribute('css')}";` : ``}
|
|
26
28
|
</style>
|
|
@@ -33,6 +35,9 @@ class iamTabs extends HTMLElement {
|
|
|
33
35
|
}
|
|
34
36
|
|
|
35
37
|
connectedCallback() {
|
|
38
|
+
|
|
39
|
+
let classList = this.classList.toString().replace('container','');
|
|
40
|
+
this.shadowRoot.querySelector('.tabs').setAttribute('class',`tabs ${classList}`);
|
|
36
41
|
|
|
37
42
|
tabs(this);
|
|
38
43
|
}
|
|
@@ -103,7 +103,7 @@ function createAppliedFilters(container,filters) {
|
|
|
103
103
|
|
|
104
104
|
let input = event.target.closest('input[data-filter-text]');
|
|
105
105
|
|
|
106
|
-
addFilterButton (filters, input)
|
|
106
|
+
addFilterButton (filters, input);
|
|
107
107
|
};
|
|
108
108
|
|
|
109
109
|
}, false);
|
|
@@ -125,13 +125,19 @@ function createAppliedFilters(container,filters) {
|
|
|
125
125
|
}
|
|
126
126
|
|
|
127
127
|
let inputs = container.querySelectorAll(selector);
|
|
128
|
+
|
|
128
129
|
for(var i=0;i<inputs.length;i++){
|
|
129
130
|
let input = inputs[i];
|
|
130
131
|
|
|
132
|
+
|
|
131
133
|
if(input.getAttribute('type') != 'radio' && input.getAttribute('type') != 'checkbox')
|
|
132
|
-
|
|
134
|
+
input.value = "";
|
|
135
|
+
else {
|
|
136
|
+
input.checked = false;
|
|
133
137
|
|
|
134
|
-
|
|
138
|
+
var event = new Event('force');
|
|
139
|
+
input.closest('form').dispatchEvent(event);
|
|
140
|
+
}
|
|
135
141
|
}
|
|
136
142
|
}
|
|
137
143
|
|
|
@@ -75,6 +75,12 @@ export const addGlobalEvents = (body) => {
|
|
|
75
75
|
// Create close button is needed
|
|
76
76
|
dialog.innerHTML = `<button class="dialog__close">Close</button>${dialog.innerHTML}`;
|
|
77
77
|
|
|
78
|
+
// remove close button when dialog is closed
|
|
79
|
+
dialog.addEventListener("close", () => {
|
|
80
|
+
const closeButton = dialog.querySelector('.dialog__close');
|
|
81
|
+
dialog.removeChild(closeButton);
|
|
82
|
+
}, { once: true }); // only adds this once
|
|
83
|
+
|
|
78
84
|
let videoButton = dialog.querySelector('.youtube-embed a');
|
|
79
85
|
|
|
80
86
|
if (videoButton){
|
|
@@ -89,8 +95,8 @@ export const addGlobalEvents = (body) => {
|
|
|
89
95
|
"id": modalID
|
|
90
96
|
});
|
|
91
97
|
};
|
|
92
|
-
// Close modal
|
|
93
98
|
|
|
99
|
+
// Close modal
|
|
94
100
|
if (event && event.target instanceof HTMLElement && event.target.closest('button.dialog__close')){
|
|
95
101
|
const dialog = event.target.closest('dialog[open]');
|
|
96
102
|
|
|
@@ -107,7 +113,9 @@ export const addGlobalEvents = (body) => {
|
|
|
107
113
|
if (event && event.target instanceof HTMLElement && event.target.closest('dialog[open]')){
|
|
108
114
|
const dialog = event.target.closest('dialog[open]');
|
|
109
115
|
const dialogDimensions = dialog.getBoundingClientRect()
|
|
116
|
+
|
|
110
117
|
if (event.clientX < dialogDimensions.left || event.clientX > dialogDimensions.right || event.clientY < dialogDimensions.top || event.clientY > dialogDimensions.bottom) {
|
|
118
|
+
|
|
111
119
|
dialog.close()
|
|
112
120
|
|
|
113
121
|
window.dataLayer = window.dataLayer || [];
|
|
@@ -23,8 +23,8 @@ export const addDataAttributes = (table) => {
|
|
|
23
23
|
let headingText = tempDiv.textContent || tempDiv.innerText || "";
|
|
24
24
|
cell.setAttribute('data-label',headingText);
|
|
25
25
|
|
|
26
|
-
if(heading.hasAttribute('class'))
|
|
27
|
-
cell.setAttribute('class',heading.getAttribute('class'))
|
|
26
|
+
if(heading.hasAttribute('data-td-class'))
|
|
27
|
+
cell.setAttribute('class',heading.getAttribute('data-td-class'))
|
|
28
28
|
|
|
29
29
|
if(heading.hasAttribute('data-format')){
|
|
30
30
|
cell.setAttribute('data-format',heading.getAttribute('data-format'))
|
|
@@ -70,7 +70,15 @@ export const createMobileButton = (table) => {
|
|
|
70
70
|
Array.from(table.querySelectorAll('tbody tr')).forEach((row, index) => {
|
|
71
71
|
let firstCol = row.querySelector(':scope > :is(td,th):first-child');
|
|
72
72
|
let colContent = firstCol.textContent;
|
|
73
|
-
|
|
73
|
+
|
|
74
|
+
if(colContent != "")
|
|
75
|
+
firstCol.innerHTML =`<span class="td__content">${colContent}</span><button type="button" class="d-none">${colContent}</button>`;
|
|
76
|
+
else {
|
|
77
|
+
|
|
78
|
+
let secondCol = row.querySelector(':scope > :is(td,th):nth-child(2)');
|
|
79
|
+
let secondColContent = secondCol.textContent;
|
|
80
|
+
secondCol.innerHTML =`<span class="td__content">${secondColContent}</span><button type="button" class="d-none">${secondColContent}</button>`;
|
|
81
|
+
}
|
|
74
82
|
});
|
|
75
83
|
}
|
|
76
84
|
|
|
@@ -140,6 +148,7 @@ export const addFilterEventListeners = (table, form, pagination, wrapper, savedT
|
|
|
140
148
|
else {
|
|
141
149
|
filterTable(table, form, wrapper);
|
|
142
150
|
createPaginationButttons(wrapper,pagination);
|
|
151
|
+
populateDataQueries(table,form);
|
|
143
152
|
}
|
|
144
153
|
}
|
|
145
154
|
|
|
@@ -172,6 +181,11 @@ export const addFilterEventListeners = (table, form, pagination, wrapper, savedT
|
|
|
172
181
|
formSubmit();
|
|
173
182
|
}
|
|
174
183
|
|
|
184
|
+
if (event && event.target instanceof HTMLElement && event.target.closest('[data-filter]') && event.target.closest('form .dialog__wrapper > dialog')){
|
|
185
|
+
|
|
186
|
+
formSubmit();
|
|
187
|
+
}
|
|
188
|
+
|
|
175
189
|
if (event && event.target instanceof HTMLElement && event.target.closest('[data-filter]') && !event.target.closest('form dialog')){
|
|
176
190
|
|
|
177
191
|
formSubmit();
|
|
@@ -223,6 +237,11 @@ export const addFilterEventListeners = (table, form, pagination, wrapper, savedT
|
|
|
223
237
|
|
|
224
238
|
formSubmit();
|
|
225
239
|
});
|
|
240
|
+
|
|
241
|
+
form.addEventListener('force', (event) => {
|
|
242
|
+
|
|
243
|
+
formSubmit();
|
|
244
|
+
});
|
|
226
245
|
}
|
|
227
246
|
|
|
228
247
|
export const sortTable = (table, form, savedTableBody) => {
|
|
@@ -301,6 +320,15 @@ export const filterTable = (table, form, wrapper) => {
|
|
|
301
320
|
let page = form.querySelector('[data-pagination]') ? parseInt(form.querySelector('[data-pagination]').value) : 1;
|
|
302
321
|
let showRows = form.querySelector('[data-show]') ? parseInt(form.querySelector('[data-show]').value) : 15;
|
|
303
322
|
|
|
323
|
+
// Reset
|
|
324
|
+
Array.from(table.querySelectorAll('tbody tr')).forEach((row, index) => {
|
|
325
|
+
row.classList.remove('filtered');
|
|
326
|
+
row.classList.remove('filtered--matched');
|
|
327
|
+
row.classList.remove('filtered--show');
|
|
328
|
+
|
|
329
|
+
row.removeAttribute('data-filtered-by');
|
|
330
|
+
});
|
|
331
|
+
|
|
304
332
|
// Filter
|
|
305
333
|
let filterInputs = Array.from(form.querySelectorAll('[data-filter]'));
|
|
306
334
|
|
|
@@ -348,6 +376,7 @@ export const filterTable = (table, form, wrapper) => {
|
|
|
348
376
|
Array.from(form.querySelectorAll('[data-filter-count]')).forEach((element, index) => {
|
|
349
377
|
element.innerHTML = '';
|
|
350
378
|
});
|
|
379
|
+
|
|
351
380
|
if(filters.length) {
|
|
352
381
|
|
|
353
382
|
Array.from(form.querySelectorAll('[data-filter-count]')).forEach((element, index) => {
|
|
@@ -361,14 +390,6 @@ export const filterTable = (table, form, wrapper) => {
|
|
|
361
390
|
|
|
362
391
|
table.classList.add('table--filtered');
|
|
363
392
|
|
|
364
|
-
// Reset
|
|
365
|
-
Array.from(table.querySelectorAll('tbody tr')).forEach((row, index) => {
|
|
366
|
-
row.classList.remove('filtered');
|
|
367
|
-
row.classList.remove('filtered--matched');
|
|
368
|
-
row.classList.remove('filtered--show');
|
|
369
|
-
|
|
370
|
-
row.removeAttribute('data-filtered-by');
|
|
371
|
-
});
|
|
372
393
|
|
|
373
394
|
// Filter the table
|
|
374
395
|
|
|
@@ -495,7 +516,6 @@ export const filterTable = (table, form, wrapper) => {
|
|
|
495
516
|
wrapper.setAttribute('data-show',showRows);
|
|
496
517
|
}
|
|
497
518
|
|
|
498
|
-
populateDataQueries(table,form);
|
|
499
519
|
}
|
|
500
520
|
|
|
501
521
|
export const populateDataQueries = (table,form) => {
|
|
@@ -508,7 +528,7 @@ export const populateDataQueries = (table,form) => {
|
|
|
508
528
|
let numberOfMatchedRows: 0;
|
|
509
529
|
|
|
510
530
|
if(query == 'total'){
|
|
511
|
-
numberOfMatchedRows = table.classList.contains('table--filtered') ? table.querySelectorAll('tbody tr
|
|
531
|
+
numberOfMatchedRows = table.classList.contains('table--filtered') ? table.querySelectorAll('tbody tr').length : table.querySelectorAll('tbody tr').length;
|
|
512
532
|
}
|
|
513
533
|
else if(!query.includes(' == ') && query.includes(' & ')){
|
|
514
534
|
|
|
@@ -548,7 +568,7 @@ export const populateDataQueries = (table,form) => {
|
|
|
548
568
|
else {
|
|
549
569
|
|
|
550
570
|
let queryParts = query.split(' == ');
|
|
551
|
-
numberOfMatchedRows = Array.from(table.querySelectorAll(`tbody tr
|
|
571
|
+
numberOfMatchedRows = Array.from(table.querySelectorAll(`tbody tr.filtered--matched td[data-label="${queryParts[0]}"], tbody tr[data-filtered-by="${queryParts[0]}"] td[data-label="${queryParts[0]}"]`)).filter(function(element){
|
|
552
572
|
return element.textContent === queryParts[1];
|
|
553
573
|
}).length;
|
|
554
574
|
}
|
|
@@ -46,15 +46,20 @@ export const setTabsEventHandlers = function(tabsElement: Element){
|
|
|
46
46
|
|
|
47
47
|
let details = tabsElement.querySelectorAll(':scope > details');
|
|
48
48
|
let summaries = tabsElement.querySelectorAll(':scope > details > summary');
|
|
49
|
-
let buttons = tabsElement.querySelectorAll(':scope
|
|
49
|
+
let buttons = tabsElement.querySelectorAll(':scope .tabs__links > .link');
|
|
50
50
|
|
|
51
51
|
if(tabsElement.shadowRoot)
|
|
52
|
-
buttons = tabsElement.shadowRoot.querySelectorAll('.tabs__links >
|
|
52
|
+
buttons = tabsElement.shadowRoot.querySelectorAll('.tabs__links > .link');
|
|
53
|
+
|
|
54
|
+
console.log(buttons)
|
|
53
55
|
|
|
54
56
|
// Set the on click for the tab buttons, these will open the details box it matches too
|
|
55
57
|
buttons.forEach((button) => {
|
|
56
58
|
|
|
57
59
|
button.addEventListener("click", (e) => {
|
|
60
|
+
|
|
61
|
+
console.log('hi')
|
|
62
|
+
|
|
58
63
|
e.preventDefault();
|
|
59
64
|
buttons.forEach((buttonLoopItem) => {
|
|
60
65
|
|