@iamproperty/components 3.9.0-beta-1 → 4.0.1

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.
Files changed (101) hide show
  1. package/assets/css/components/actionbar-global.css +1 -1
  2. package/assets/css/components/actionbar-global.css.map +1 -1
  3. package/assets/css/components/actionbar.css +1 -1
  4. package/assets/css/components/actionbar.css.map +1 -1
  5. package/assets/css/components/admin-panel.css +1 -1
  6. package/assets/css/components/admin-panel.css.map +1 -1
  7. package/assets/css/components/card-global.css +1 -1
  8. package/assets/css/components/card-global.css.map +1 -1
  9. package/assets/css/components/card.css +1 -1
  10. package/assets/css/components/card.css.map +1 -1
  11. package/assets/css/components/charts.css.map +1 -1
  12. package/assets/css/components/collapsible-side.css +1 -0
  13. package/assets/css/components/collapsible-side.css.map +1 -0
  14. package/assets/css/components/dialog.css +1 -1
  15. package/assets/css/components/dialog.css.map +1 -1
  16. package/assets/css/components/fileupload.css.map +1 -1
  17. package/assets/css/components/forms.css +1 -1
  18. package/assets/css/components/forms.css.map +1 -1
  19. package/assets/css/components/header.css.map +1 -1
  20. package/assets/css/components/lists.css.map +1 -1
  21. package/assets/css/components/nav-global.css +1 -1
  22. package/assets/css/components/nav-global.css.map +1 -1
  23. package/assets/css/components/nav.css.map +1 -1
  24. package/assets/css/components/nav.old.css.map +1 -1
  25. package/assets/css/components/notification.css.map +1 -1
  26. package/assets/css/components/pagination.css.map +1 -1
  27. package/assets/css/components/property-searchbar.css.map +1 -1
  28. package/assets/css/components/table.css +1 -1
  29. package/assets/css/components/table.css.map +1 -1
  30. package/assets/css/core.min.css +1 -1
  31. package/assets/css/core.min.css.map +1 -1
  32. package/assets/css/style.min.css +1 -1
  33. package/assets/css/style.min.css.map +1 -1
  34. package/assets/js/components/accordion/accordion.component.min.js +2 -2
  35. package/assets/js/components/actionbar/actionbar.component.js +45 -0
  36. package/assets/js/components/actionbar/actionbar.component.min.js +4 -4
  37. package/assets/js/components/actionbar/actionbar.component.min.js.map +1 -1
  38. package/assets/js/components/applied-filters/applied-filters.component.min.js +3 -3
  39. package/assets/js/components/applied-filters/applied-filters.component.min.js.map +1 -1
  40. package/assets/js/components/card/card.component.js +9 -1
  41. package/assets/js/components/card/card.component.min.js +7 -5
  42. package/assets/js/components/card/card.component.min.js.map +1 -1
  43. package/assets/js/components/collapsible-side/collapsible-side.component.js +96 -0
  44. package/assets/js/components/collapsible-side/collapsible-side.component.min.js +27 -0
  45. package/assets/js/components/collapsible-side/collapsible-side.component.min.js.map +1 -0
  46. package/assets/js/components/filterlist/filterlist.component.min.js +1 -1
  47. package/assets/js/components/header/header.component.min.js +1 -1
  48. package/assets/js/components/nav/nav.component.min.js +1 -1
  49. package/assets/js/components/notification/notification.component.min.js +1 -1
  50. package/assets/js/components/pagination/pagination.component.min.js +1 -1
  51. package/assets/js/components/table/table.component.js +3 -0
  52. package/assets/js/components/table/table.component.min.js +10 -10
  53. package/assets/js/components/table/table.component.min.js.map +1 -1
  54. package/assets/js/components/tabs/tabs.component.min.js +1 -1
  55. package/assets/js/dynamic.min.js +4 -4
  56. package/assets/js/dynamic.min.js.map +1 -1
  57. package/assets/js/modules/applied-filters.js +6 -7
  58. package/assets/js/modules/dialogs.js +32 -4
  59. package/assets/js/modules/helpers.js +0 -13
  60. package/assets/js/modules/table.js +68 -13
  61. package/assets/js/scripts.bundle.js +18 -16
  62. package/assets/js/scripts.bundle.js.map +1 -1
  63. package/assets/js/scripts.bundle.min.js +2 -2
  64. package/assets/js/scripts.bundle.min.js.map +1 -1
  65. package/assets/sass/_corefiles.scss +0 -1
  66. package/assets/sass/_func.scss +1 -0
  67. package/assets/sass/_functions/mixins.scss +22 -0
  68. package/assets/sass/components/actionbar-global.scss +69 -7
  69. package/assets/sass/components/actionbar.scss +20 -8
  70. package/assets/sass/components/admin-panel.scss +47 -2
  71. package/assets/sass/components/card-global.scss +53 -1
  72. package/assets/sass/components/card.scss +14 -12
  73. package/assets/sass/components/charts.scss +1 -1
  74. package/assets/sass/components/collapsible-side.scss +327 -0
  75. package/assets/sass/components/dialog.scss +62 -61
  76. package/assets/sass/components/fileupload.scss +1 -1
  77. package/assets/sass/components/forms.scss +112 -102
  78. package/assets/sass/components/nav-global.scss +26 -9
  79. package/assets/sass/components/nav.scss +9 -10
  80. package/assets/sass/components/notification.scss +1 -1
  81. package/assets/sass/components/table.scss +85 -4
  82. package/assets/sass/core.scss +1 -0
  83. package/assets/sass/error.scss +2 -1
  84. package/assets/sass/foundations/root.scss +3 -3
  85. package/assets/sass/main.scss +4 -3
  86. package/assets/ts/components/actionbar/actionbar.component.ts +67 -2
  87. package/assets/ts/components/card/card.component.ts +12 -2
  88. package/assets/ts/components/collapsible-side/README.md +38 -0
  89. package/assets/ts/components/collapsible-side/collapsible-side.component.ts +134 -0
  90. package/assets/ts/components/table/table.component.ts +4 -0
  91. package/assets/ts/modules/applied-filters.ts +8 -10
  92. package/assets/ts/modules/dialogs.ts +42 -5
  93. package/assets/ts/modules/helpers.ts +0 -17
  94. package/assets/ts/modules/table.ts +82 -13
  95. package/dist/components.es.js +1270 -686
  96. package/dist/components.umd.js +132 -36
  97. package/dist/style.css +1 -1
  98. package/package.json +1 -1
  99. package/src/components/CollapsibleSideMenu/CollapsibleSideMenu.vue +20 -0
  100. package/src/components/CollapsibleSideMenu/README.md +23 -0
  101. package/src/index.js +8 -0
@@ -76,7 +76,7 @@ tr td[colspan="100%"]:first-child:last-child span {
76
76
  @container (width >= 60em) {
77
77
  thead {
78
78
 
79
- th {
79
+ th:not(:empty) {
80
80
  white-space: nowrap;
81
81
  min-width: #{$td-mw};
82
82
  }
@@ -136,12 +136,17 @@ table.border-0 {
136
136
  margin-bottom: 0;
137
137
 
138
138
  td:has(input[type="checkbox"]) {
139
- width: rem(30);
140
- min-width: rem(30);
141
- max-width: rem(30);
139
+ width: rem(40);
140
+ min-width: rem(40);
141
+ max-width: rem(40);
142
142
  }
143
143
  }
144
144
 
145
+ @media screen and (prefers-color-scheme: dark) {
146
+
147
+ background: var(--colour-canvas-2);
148
+ }
149
+
145
150
  @media (forced-colors: active) {
146
151
  --wrapper-padding: 0;
147
152
  background: var(--colour-canvas-2);
@@ -170,6 +175,11 @@ table.border-0 {
170
175
  margin-right: -1.5rem;
171
176
  margin-bottom: 0;
172
177
  background: white;
178
+
179
+ @media screen and (prefers-color-scheme: dark) {
180
+
181
+ background: var(--colour-canvas-2);
182
+ }
173
183
  }
174
184
 
175
185
 
@@ -381,7 +391,13 @@ table.border-0 {
381
391
  margin-left: rem(-40);
382
392
  min-height: var(--row-height);
383
393
  text-align: right;
394
+ background: linear-gradient(90deg, transparent 0%, white 1.25rem);
395
+ cursor: default;
396
+
397
+ @media screen and (prefers-color-scheme: dark) {
398
+
384
399
  background: linear-gradient(90deg, transparent 0%, var(--colour-canvas-2) 1.25rem);
400
+ }
385
401
 
386
402
  &:after {
387
403
  bottom: 0;
@@ -622,3 +638,68 @@ table {
622
638
  color: var(--colour-primary);
623
639
  }
624
640
  }
641
+
642
+ // #region Table with actionbar
643
+
644
+ iam-table {
645
+
646
+ td:has([type="checkbox"]){
647
+ position: static!important;
648
+ width: rem(40);
649
+ }
650
+
651
+ input:is([type="radio"],[type="checkbox"]) + label {
652
+ padding-left: 0!important;
653
+ margin: 0!important;
654
+
655
+ &:before,
656
+ &:after {
657
+ top: 0!important;
658
+ }
659
+ }
660
+
661
+ table:has([type="checkbox"]:checked) tr:has([type="checkbox"]){
662
+
663
+ cursor: pointer;
664
+
665
+ &:is(:hover, :focus) {
666
+
667
+ background: var(--hover-background);
668
+ }
669
+
670
+ td {
671
+ background: transparent;
672
+ }
673
+
674
+ [type="checkbox"] {
675
+ width: 100%;
676
+ height: 100%;
677
+ max-height: var(--row-height);
678
+ max-width: 100%;
679
+ cursor: pointer;
680
+ pointer-events: all;
681
+ top: auto;
682
+ margin: 0;
683
+ margin-top: -0.75rem;
684
+ }
685
+
686
+ }
687
+ }
688
+
689
+ @container (width < 23.4375em) {
690
+
691
+ iam-table:has([slot="before"]) {
692
+
693
+ iam-actionbar {
694
+ background-color: #e6eaec;
695
+ }
696
+ .actionbar__sticky + * {
697
+ margin-top: 0!important;
698
+ }
699
+ }
700
+
701
+ .table__wrapper.has-actionbar {
702
+ margin-top: calc(-100vh - -6.75rem)!important;
703
+ }
704
+ }
705
+ // #endregion
@@ -2,5 +2,6 @@
2
2
 
3
3
  @use "_fonts";
4
4
  @use "_corefiles";
5
+ @use '../../assets/sass/components/nav-global.scss';
5
6
  @use "_forms";
6
7
  @use "_print";
@@ -2,4 +2,5 @@
2
2
 
3
3
  // Set mobile only variable so that the media query mixin doesn't print out non mobile rules
4
4
  @use "_func" as *;
5
- @import "_corefiles";
5
+ @import "_corefiles";
6
+ @import '../../assets/sass/components/nav-global.scss';
@@ -39,7 +39,7 @@
39
39
  }
40
40
 
41
41
  // Dark mode; functional colours get updated
42
- @media screen and (prefers-color-scheme: dark) {
42
+ @include dark-mode() {
43
43
  :root {
44
44
 
45
45
  @each $color, $value in $dark-mode-colors {
@@ -49,7 +49,7 @@
49
49
  }
50
50
  }
51
51
 
52
- @media screen and (prefers-color-scheme: light) {
52
+ @include light-mode() {
53
53
 
54
54
  // Reset the colours of lighter backgrounds to make sure they aren't over written by dark mode. Some other tweaks to colours are applied
55
55
  [class*="bg-"]:not(.bg-primary):not(.bg-dark):not(.bg-danger):not(.bg-white):not(.bg-canvas):not(.bg-canvas-2):not(.invert-colours) {
@@ -72,7 +72,7 @@
72
72
  }
73
73
  }
74
74
 
75
- @media screen and (prefers-color-scheme: dark) {
75
+ @include dark-mode() {
76
76
 
77
77
  // Reset the colours of lighter backgrounds to make sure they aren't over written by dark mode. Some other tweaks to colours are applied
78
78
  [class*="bg-"]:not(.bg-canvas):not(.bg-canvas-2) {
@@ -2,6 +2,7 @@
2
2
 
3
3
  @use "_fonts";
4
4
  @use "_corefiles";
5
- @use "_forms";
6
- @use "_components";
7
- @use "_print";
5
+ @import '../../assets/sass/components/nav-global.scss';
6
+ @import "_forms";
7
+ @import "_components";
8
+ @import "_print";
@@ -132,6 +132,43 @@ class iamActionbar extends HTMLElement {
132
132
  });
133
133
  }
134
134
  }
135
+
136
+ // Wtach div for the select inputs
137
+ if(this.hasAttribute('data-select-watch')){
138
+
139
+ const element = document.getElementById(this.getAttribute('data-select-watch'));
140
+ element.setAttribute('data-select-container','true');
141
+ Array.from(element.querySelectorAll('input[type="checkbox"]')).forEach((input,index) => {
142
+ input.parentElement.setAttribute('slot','checkbox');
143
+ });
144
+ element.addEventListener('change',(event) => {
145
+
146
+ if (event && event.target instanceof HTMLElement && event.target.closest('[type="checkbox"]')){
147
+
148
+ let count = element.querySelectorAll('input[type="checkbox"]').length;
149
+ let countChecked = element.querySelectorAll('input[type="checkbox"]:checked').length;
150
+ that.setAttribute('data-selected', count == countChecked ? "all" : countChecked);
151
+
152
+ let input = event.target.closest('[type="checkbox"]');
153
+
154
+ if(countChecked){
155
+ Array.from(element.querySelectorAll('input[type="checkbox"]')).forEach((input,index) => {
156
+
157
+ if(input.closest('iam-card'))
158
+ input.closest('iam-card').setAttribute('data-selected','true');
159
+ });
160
+ }
161
+ else {
162
+ Array.from(element.querySelectorAll('input[type="checkbox"]')).forEach((input,index) => {
163
+
164
+ if(input.closest('iam-card'))
165
+ input.closest('iam-card').removeAttribute('data-selected');
166
+ });
167
+ }
168
+
169
+ };
170
+ });
171
+ }
135
172
  // #endregion
136
173
 
137
174
  // #region switchviews
@@ -385,8 +422,36 @@ class iamActionbar extends HTMLElement {
385
422
 
386
423
  if(selectAll)
387
424
  setSelectAllInput(selectAll, newVal);
388
- const event = new CustomEvent("selected", { detail: { selected: newVal } });
389
- this.dispatchEvent(event);
425
+
426
+ const event = new CustomEvent("selected", { detail: { selected: newVal } });
427
+ this.dispatchEvent(event);
428
+
429
+ if(newVal == "all" && this.hasAttribute('data-select-watch')){
430
+
431
+ const element = document.getElementById(this.getAttribute('data-select-watch'));
432
+
433
+ Array.from(element.querySelectorAll('input[type="checkbox"]')).forEach((input,index) => {
434
+
435
+ input.checked = true;
436
+
437
+ if(input.closest('iam-card'))
438
+ input.closest('iam-card').setAttribute('data-selected','true');
439
+ });
440
+ }
441
+
442
+ if(newVal == "0" && this.hasAttribute('data-select-watch')){
443
+
444
+ const element = document.getElementById(this.getAttribute('data-select-watch'));
445
+
446
+ Array.from(element.querySelectorAll('input[type="checkbox"]')).forEach((input,index) => {
447
+
448
+ input.checked = false;
449
+
450
+ if(input.closest('iam-card'))
451
+ input.closest('iam-card').removeAttribute('data-selected','true');
452
+ });
453
+ }
454
+
390
455
  break;
391
456
  }
392
457
  }
@@ -37,6 +37,8 @@ class iamCard extends HTMLElement {
37
37
  ${this.hasAttribute('data-illustration') ? `<div class="card__illustration"><img src="${this.getAttribute('data-illustration')}" alt="" loading="lazy" /></div>` : ''}
38
38
  <slot></slot>
39
39
  </div>
40
+
41
+ <slot name="checkbox"></slot>
40
42
  ${this.hasAttribute('data-cta') ? `<div class="card__footer"><span class="link">${this.getAttribute('data-cta')}</span></div>` : ''}
41
43
  </div>
42
44
  `;
@@ -44,7 +46,7 @@ class iamCard extends HTMLElement {
44
46
  }
45
47
 
46
48
  connectedCallback() {
47
-
49
+
48
50
  this.classList.add('loaded');
49
51
 
50
52
  // Mimic clicking the parent node so the focus and target events can be on the card
@@ -64,6 +66,13 @@ class iamCard extends HTMLElement {
64
66
  card.classList.remove('checked');
65
67
  }
66
68
 
69
+ // Click event down
70
+ this.addEventListener('click', (event) => {
71
+
72
+ let clickEvent = new Event('click');
73
+ card.dispatchEvent(clickEvent);
74
+ });
75
+
67
76
  card.addEventListener('click', (event) => {
68
77
 
69
78
  if(parentNode.matches('label[for]')){
@@ -151,7 +160,8 @@ class iamCard extends HTMLElement {
151
160
  attributeChangedCallback(attrName, oldVal, newVal) {
152
161
  switch (attrName) {
153
162
  case "data-total": {
154
- this.shadowRoot.querySelector('.card__total').innerHTML = newVal;
163
+ if(this.shadowRoot.querySelector('.card__total'))
164
+ this.shadowRoot.querySelector('.card__total').innerHTML = newVal;
155
165
  break;
156
166
  }
157
167
  case "class": {
@@ -0,0 +1,38 @@
1
+ **Add the below to your initialise script**
2
+
3
+ ```
4
+ import('../node_modules/@iamproperty/components/assets/js/components/collapsible-side/collapsible-side.component.min').then(module => { // Might need to update the path
5
+
6
+ if (!window.customElements.get(`iam-collapsible-side`))
7
+ window.customElements.define(`iam-collapsible-side`, 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
+
16
+ ```
17
+ <iam-collapsible-side data-title="Configuration">
18
+
19
+ <div slot="menu">
20
+ <label for="test1">Active branch</label>
21
+ <select class="form-select" name="test1" id="test1">
22
+ <option value="1" selected>Newcastle</option>
23
+ <option value="2">Two</option>
24
+ <option value="2">Three</option>
25
+ <option value="2">Four</option>
26
+ </select>
27
+ </div>
28
+
29
+ <hr slot="menu"/>
30
+ <a href="/" slot="menu">Agency settings</a>
31
+ <a href="/" slot="menu">Control panel</a>
32
+ <a href="/" slot="menu" class="selected">Contact us</a>
33
+
34
+ <h1>Inspections</h1>
35
+ <p>Lorem Ipsum is simply dummy text of the printing and typesetting industry. Lorem Ipsum has been the industry's standard dummy text ever since the 1500s, when an unknown printer took a galley of type and scrambled it to make a type specimen book. It has survived not only five centuries, but also the leap into electronic typesetting, remaining essentially unchanged. It was popularised in the 1960s with the release of Letraset sheets containing Lorem Ipsum passages, and more recently with desktop publishing software like Aldus PageMaker including versions of Lorem Ipsum.</p>
36
+
37
+ </iam-collapsible-side>
38
+ ```
@@ -0,0 +1,134 @@
1
+ // @ts-nocheck
2
+ // Data layer Web component created
3
+ window.dataLayer = window.dataLayer || [];
4
+ window.dataLayer.push({
5
+ "event": "customElementRegistered",
6
+ "element": "collapsible side menu"
7
+ });
8
+
9
+ class iamCollapsibleSideMenu extends HTMLElement {
10
+
11
+ constructor(){
12
+ super();
13
+ this.attachShadow({ mode: 'open'});
14
+
15
+ const assetLocation = document.body.hasAttribute('data-assets-location') ? document.body.getAttribute('data-assets-location') : '/assets'
16
+ const coreCSS = document.body.hasAttribute('data-core-css') ? document.body.getAttribute('data-core-css') : `${assetLocation}/css/core.min.css`;
17
+ const loadCSS = `@import "${assetLocation}/css/components/collapsible-side.css";`;
18
+
19
+ const template = document.createElement('template');
20
+ template.innerHTML = `
21
+ <style class="styles">
22
+ @import "${coreCSS}";
23
+ ${loadCSS}
24
+ ${this.hasAttribute('css') ? `@import "${this.getAttribute('css')}";` : ``}
25
+ </style>
26
+ <link rel="stylesheet" href="https://kit.fontawesome.com/26fdbf0179.css" crossorigin="anonymous">
27
+ <div class="container">
28
+
29
+ <div class="side-menu">
30
+ <button class="btn btn-compact fa-chevron-right btn-secondary btn-sm">Open or close Collapsible menu</button>
31
+ <div class="side-menu-content closed">
32
+ <slot name="menu"></slot>
33
+ </div>
34
+ </div>
35
+
36
+ <div class="main-content">
37
+ <slot></slot>
38
+ </div>
39
+
40
+ </div>
41
+ `;
42
+ this.shadowRoot.appendChild(template.content.cloneNode(true));
43
+ }
44
+
45
+ connectedCallback() {
46
+
47
+ const sideMenu = this.shadowRoot.querySelector('.side-menu');
48
+ const sideMenuContent = this.shadowRoot.querySelector('.side-menu-content');
49
+ const mainContent = this.shadowRoot.querySelector('.main-content')
50
+ const button = this.shadowRoot.querySelector('.side-menu > .btn');
51
+
52
+ // Load external CSS if needed
53
+ if(this.hasAttribute('data-css'))
54
+ this.shadowRoot.querySelector('.styles').insertAdjacentHTML('beforeend', `@import "${this.getAttribute('data-css')}";`);
55
+
56
+ // Set sde nav title
57
+ if(!this.hasAttribute('data-title'))
58
+ this.setAttribute('data-title','configuration')
59
+
60
+ sideMenuContent.insertAdjacentHTML('afterbegin',`<span class="h3">${this.getAttribute('data-title')}</span>`);
61
+ mainContent.insertAdjacentHTML('afterbegin',`<span class="h3">${this.getAttribute('data-title')}</span>`);
62
+
63
+
64
+ if(this.querySelector(':scope > :is(h1,h2,h3,h4,h5,h6)')){
65
+ this.querySelector(':scope > :is(h1,h2,h3,h4,h5,h6)').classList.add('h4');
66
+ this.querySelector(':scope > :is(h1,h2,h3,h4,h5,h6)').classList.add('main-content__title');
67
+ }
68
+
69
+ // Open the menu
70
+ button.addEventListener('click', (event) => {
71
+
72
+
73
+ if(!sideMenu.classList.contains('open')){
74
+
75
+ sideMenuContent.classList.remove('closed');
76
+
77
+
78
+ setTimeout(function(){
79
+ sideMenu.classList.add('open');
80
+ }, 100);
81
+
82
+
83
+ }
84
+ else {
85
+
86
+ sideMenu.classList.remove('open');
87
+ setTimeout(function(){ sideMenuContent.classList.add('closed') }, 1000); // Delay until its close so the animation is broken
88
+
89
+ // While the menu is closing dont allow the hover to re-open it until its fully closed.
90
+ sideMenu.classList.add('pe-none');
91
+ setTimeout(function(){ sideMenu.classList.remove('pe-none')}, 1000);
92
+ }
93
+ });
94
+
95
+ // Mimic hover event on desktop so that we can control when classes are set and which order
96
+ sideMenu.addEventListener('mouseenter', (event) => {
97
+
98
+ if(window.innerWidth > 992){
99
+
100
+ if(!sideMenu.classList.contains('open'))
101
+ sideMenuContent.classList.remove('closed');
102
+
103
+ sideMenu.classList.add('hover');
104
+
105
+ }
106
+ });
107
+
108
+ sideMenu.addEventListener('mousemove', (event) => {
109
+
110
+ if(window.innerWidth > 992){
111
+
112
+ if(!sideMenu.classList.contains('open'))
113
+ sideMenuContent.classList.remove('closed');
114
+ }
115
+ });
116
+
117
+ sideMenu.addEventListener('mouseleave', (event) => {
118
+
119
+ if(window.innerWidth > 992){
120
+
121
+ sideMenu.classList.remove('hover');
122
+
123
+ if(!sideMenu.classList.contains('open'))
124
+ setTimeout(function(){ sideMenuContent.classList.add('closed') }, 1000); // Delay until its close so the animation is broken
125
+ }
126
+ });
127
+
128
+
129
+
130
+ }
131
+
132
+ }
133
+
134
+ export default iamCollapsibleSideMenu;
@@ -65,6 +65,10 @@ class iamTable extends HTMLElement {
65
65
  classList = classList.replace('table--loading','');
66
66
  this.shadowRoot.querySelector('.table__wrapper').className += ` ${classList}`;
67
67
 
68
+ // set actionbar class if needed
69
+ if(this.querySelector('.actionbar__sticky'))
70
+ this.shadowRoot.querySelector('.table__wrapper').classList.add('has-actionbar');
71
+
68
72
  this.table = this.querySelector('table');
69
73
  this.savedTableBody = this.table.querySelector('tbody').cloneNode(true);
70
74
  this.pagination = this.shadowRoot.querySelector('.table__pagination');
@@ -96,17 +96,14 @@ function createAppliedFilters(container,filters) {
96
96
  Array.from(container.querySelectorAll('input[type="checkbox"]:checked')).forEach((input, index) => {
97
97
  addFilterButton(filters, input)
98
98
  });
99
-
100
- container.addEventListener('change', function(event){
101
99
 
102
- if (event && event.target instanceof HTMLElement && event.target.closest('input[data-filter-text]')){
103
-
104
- let input = event.target.closest('input[data-filter-text]');
105
-
106
- addFilterButton (filters, input);
107
- };
100
+ Array.from(container.querySelectorAll('input[data-filter-text]')).forEach((input, index) => {
108
101
 
109
- }, false);
102
+ input.addEventListener('change', function(event){
103
+
104
+ addFilterButton(filters, input)
105
+ });
106
+ });
110
107
 
111
108
  filters.addEventListener('click', function(event){
112
109
 
@@ -136,7 +133,8 @@ function createAppliedFilters(container,filters) {
136
133
  input.checked = false;
137
134
 
138
135
  var event = new Event('force');
139
- input.closest('form').dispatchEvent(event);
136
+ if(!container.hasAttribute('data-nosubmit'))
137
+ input.closest('form').dispatchEvent(event);
140
138
  }
141
139
  }
142
140
  }
@@ -36,6 +36,23 @@ const extendDialogs = (body) => {
36
36
  dialog.showModal();
37
37
  dialog.focus();
38
38
 
39
+ let firstWidth = dialog.offsetWidth;
40
+ dialog.setAttribute('style',`max-width: ${firstWidth}px;`);
41
+
42
+ // When the modal is opened we want to make sure any duplicate checkboxes are matching the originals
43
+ Array.from(dialog.querySelectorAll('[data-duplicate]')).forEach((element,index) => {
44
+
45
+ const id = element.getAttribute('data-duplicate');
46
+ const originalInput = document.getElementById(id);
47
+
48
+ if(element.checked != originalInput.checked){
49
+
50
+ element.checked = originalInput.checked;
51
+ let changeEvent = new Event('change');
52
+ element.dispatchEvent(changeEvent);
53
+ }
54
+ });
55
+
39
56
  window.dataLayer = window.dataLayer || [];
40
57
  window.dataLayer.push({
41
58
  "event": "openModal",
@@ -244,6 +261,7 @@ export const createMultiFormDialog = (dialog) => {
244
261
 
245
262
  let buttons = "";
246
263
  let fieldsets = Array.from(dialog.querySelectorAll('fieldset[data-title]'));
264
+ let form = dialog.querySelector('form');
247
265
 
248
266
  fieldsets.forEach((fieldset,index) => {
249
267
  buttons += `<button data-title="${fieldset.getAttribute('data-title')}" type="button" class="${index == 0 ? "active":""}" tabindex="-1">${fieldset.getAttribute('data-title')}</button>`;
@@ -258,8 +276,18 @@ export const createMultiFormDialog = (dialog) => {
258
276
  if(index != fieldsets.length - 1)
259
277
  btnWrapper.innerHTML += `<button data-title="${fieldsets[index+1].getAttribute('data-title')}" class="btn btn-primary mb-0" data-next type="button">Next</button>`;
260
278
 
261
- if(index == fieldsets.length - 1)
262
- btnWrapper.innerHTML += `<button data-title="${fieldsets[index].getAttribute('data-title')}" class="btn btn-primary mb-0" data-next type="submit">Submit</button>`;
279
+ // Last fieldset
280
+ if(index == fieldsets.length - 1){
281
+ if(form && form.querySelector(':scope > button[type="submit"]')){
282
+
283
+ let existingButton = form.querySelector(':scope > button[type="submit"]');
284
+ existingButton.classList.add('mb-0')
285
+
286
+ btnWrapper.insertAdjacentElement('beforeend',existingButton);
287
+ }
288
+ else
289
+ btnWrapper.innerHTML += `<button data-title="${fieldsets[index].getAttribute('data-title')}" class="btn btn-primary mb-0" data-next type="submit">Submit</button>`;
290
+ }
263
291
  });
264
292
 
265
293
  dialog.insertAdjacentHTML('afterbegin',`<div class="steps bg-primary">${buttons}</div>`);
@@ -359,11 +387,12 @@ export const createMultiFormDialog = (dialog) => {
359
387
 
360
388
  const button = event.target.closest('button');
361
389
 
362
- if(event.keyCode == 13){
390
+ if(event.keyCode == 13 && button.getAttribute('type') != "submit"){
363
391
 
364
392
  event.preventDefault();
365
393
  validateFieldset(button);
366
394
  }
395
+
367
396
  }
368
397
 
369
398
  if (event && event.target instanceof HTMLElement && event.target.closest('input')){
@@ -371,13 +400,21 @@ export const createMultiFormDialog = (dialog) => {
371
400
 
372
401
  input.classList.remove('is-invalid');
373
402
 
374
-
403
+ if(event.keyCode == 13){
404
+
405
+ event.preventDefault();
406
+ }
375
407
  }
376
408
  });
377
409
 
378
410
 
379
411
  dialog.addEventListener('click', (event) => {
380
- if (event && event.target instanceof HTMLElement && event.target.closest('button[data-title]')){
412
+ if (event && event.target instanceof HTMLElement && event.target.closest('button[type="submit"]')){
413
+
414
+ const form = event.target.closest('form');
415
+ form.classList.add('was-validated');
416
+ }
417
+ else if (event && event.target instanceof HTMLElement && event.target.closest('button[data-title]')){
381
418
 
382
419
  const button = event.target.closest('button[data-title]');
383
420
  validateFieldset(button);
@@ -17,23 +17,6 @@ export const addBodyClasses = (body) => {
17
17
  body.classList.add("ie");
18
18
  }
19
19
 
20
- let nav = document.querySelector('nav');
21
- if(nav) {
22
- let navHeight = nav.offsetHeight;
23
- document.querySelector('body').style.setProperty("--nav-height", `${navHeight}px`);
24
-
25
- function outputsize() {
26
-
27
- navHeight = nav.offsetHeight;
28
- document.querySelector('body').style.setProperty("--nav-height", `${navHeight}px`);
29
- }
30
-
31
- new ResizeObserver(outputsize).observe(nav);
32
- }
33
- else {
34
- document.querySelector('body').style.setProperty("--nav-height", `0px`);
35
- }
36
-
37
20
  return null
38
21
  }
39
22