@iamproperty/components 3.6.0 → 3.7.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.
- 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/card.css +1 -1
- package/assets/css/components/card.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.map +1 -1
- package/assets/css/components/lists.css +1 -1
- package/assets/css/components/lists.css.map +1 -1
- 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/bundle.js +2 -0
- package/assets/js/components/accordion/accordion.component.min.js +1 -1
- package/assets/js/components/card/card.component.js +2 -2
- package/assets/js/components/card/card.component.min.js +4 -4
- package/assets/js/components/card/card.component.min.js.map +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 +19 -9
- 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 +2 -2
- package/assets/js/components/tabs/tabs.component.min.js.map +1 -1
- package/assets/js/dynamic.js +3 -1
- package/assets/js/dynamic.min.js +2 -2
- package/assets/js/dynamic.min.js.map +1 -1
- package/assets/js/flat-components.js +2 -0
- package/assets/js/modules/applied-filters.js +1 -1
- package/assets/js/modules/dialogs.js +184 -0
- package/assets/js/modules/helpers.js +1 -89
- package/assets/js/modules/table.js +113 -37
- package/assets/js/modules/tabs.js +0 -2
- package/assets/js/scripts.bundle.js +26 -26
- 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 +34 -13
- package/assets/sass/_functions/variables.scss +3 -28
- package/assets/sass/components/admin-panel.scss +0 -10
- package/assets/sass/components/card.scss +32 -25
- package/assets/sass/components/dialog.scss +332 -28
- package/assets/sass/components/lists.scss +16 -33
- package/assets/sass/components/table.scss +125 -92
- package/assets/sass/foundations/buttons.scss +9 -13
- package/assets/sass/foundations/icons.scss +14 -69
- package/assets/sass/foundations/reboot.scss +19 -7
- package/assets/sass/foundations/root.scss +9 -0
- package/assets/sass/helpers/max-height.scss +15 -0
- package/assets/ts/bundle.ts +2 -0
- package/assets/ts/components/card/README.md +2 -1
- package/assets/ts/components/card/card.component.ts +2 -2
- package/assets/ts/components/table/table.component.ts +24 -10
- package/assets/ts/dynamic.ts +3 -1
- package/assets/ts/flat-components.ts +2 -0
- package/assets/ts/html.d.ts +7 -1
- package/assets/ts/modules/applied-filters.ts +1 -1
- package/assets/ts/modules/dialogs.ts +248 -0
- package/assets/ts/modules/helpers.ts +1 -123
- package/assets/ts/modules/table.ts +153 -47
- package/assets/ts/modules/tabs.ts +0 -4
- package/assets/ts/tests/table.spec.ts +21 -6
- package/dist/components.es.js +1114 -1101
- package/dist/components.umd.js +23 -19
- package/package.json +2 -3
- package/src/components/Card/Card.vue +2 -2
- package/src/components/Card/README.md +1 -1
- package/src/components/Nav/Nav.vue +1 -3
- package/src/index.js +0 -1
- package/assets/svg/icons.svg +0 -599
- package/src/foundations/Icon/Icon.spec.js +0 -24
- package/src/foundations/Icon/Icon.vue +0 -24
- package/src/foundations/Icon/README.md +0 -11
package/assets/ts/dynamic.ts
CHANGED
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
// @ts-nocheck
|
|
2
2
|
// Modules
|
|
3
3
|
import * as helpers from '../js/modules/helpers'
|
|
4
|
+
import extendDialogs from '../js/modules/dialogs'
|
|
4
5
|
import createDataLayer from '../js/modules/data-layer'
|
|
5
6
|
import nav from '../js/modules/nav'
|
|
6
7
|
import table from '../js/modules/table'
|
|
@@ -16,7 +17,7 @@ const options = {
|
|
|
16
17
|
rootMargin: '50px',
|
|
17
18
|
threshold: 0.1
|
|
18
19
|
}
|
|
19
|
-
const componentExt = ".component.js";
|
|
20
|
+
const componentExt = ".component.min.js";
|
|
20
21
|
|
|
21
22
|
// Load components - Each component will load once the first of its type has been loaded
|
|
22
23
|
components.forEach((component) => {
|
|
@@ -59,6 +60,7 @@ document.addEventListener("DOMContentLoaded", function() {
|
|
|
59
60
|
helpers.addBodyClasses(document.body);
|
|
60
61
|
helpers.addGlobalEvents(document.body);
|
|
61
62
|
//helpers.checkElements(document.body);
|
|
63
|
+
extendDialogs(document.body);
|
|
62
64
|
|
|
63
65
|
// ANav
|
|
64
66
|
Array.from(document.querySelectorAll('.nav')).forEach((arrayElement) => {
|
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
// @ts-nocheck
|
|
2
2
|
// Modules
|
|
3
3
|
import * as helpers from '../js/modules/helpers'
|
|
4
|
+
import extendDialogs from '../js/modules/dialogs'
|
|
4
5
|
import createDataLayer from '../js/modules/data-layer'
|
|
5
6
|
import nav from '../js/modules/nav'
|
|
6
7
|
import * as tableModule from './modules/table'
|
|
@@ -22,6 +23,7 @@ document.addEventListener("DOMContentLoaded", function() {
|
|
|
22
23
|
helpers.addBodyClasses(document.body);
|
|
23
24
|
helpers.addGlobalEvents(document.body);
|
|
24
25
|
//helpers.checkElements(document.body);
|
|
26
|
+
extendDialogs(document.body);
|
|
25
27
|
|
|
26
28
|
// ANav
|
|
27
29
|
Array.from(document.querySelectorAll('.nav')).forEach((arrayElement) => {
|
package/assets/ts/html.d.ts
CHANGED
|
@@ -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);
|
|
@@ -0,0 +1,248 @@
|
|
|
1
|
+
// @ts-nocheck
|
|
2
|
+
import { createEmbed } from "./youtubevideo";
|
|
3
|
+
|
|
4
|
+
const extendDialogs = (body) => {
|
|
5
|
+
|
|
6
|
+
// Dialogs/modals
|
|
7
|
+
body.addEventListener('click', (event) => {
|
|
8
|
+
|
|
9
|
+
// Modal
|
|
10
|
+
if (event && event.target instanceof HTMLElement && event.target.closest('[data-modal]')){
|
|
11
|
+
|
|
12
|
+
const button = event.target.closest('[data-modal]');
|
|
13
|
+
const modalID = button.hasAttribute('data-modal') ? button.getAttribute('data-modal') : button.getAttribute('data-filter');
|
|
14
|
+
const dialog = document.querySelector(`dialog#${modalID}`);
|
|
15
|
+
|
|
16
|
+
createDialog(dialog);
|
|
17
|
+
|
|
18
|
+
|
|
19
|
+
// Prevent the user from escaping the model when transactional
|
|
20
|
+
if(dialog.querySelector(':scope > .mh-lg > form:last-child > button:last-child, :scope > .mh-lg > button:last-child') && !dialog.classList.contains('dialog--multi')) {
|
|
21
|
+
dialog.addEventListener("cancel", (e) => {
|
|
22
|
+
e.preventDefault();
|
|
23
|
+
});
|
|
24
|
+
}
|
|
25
|
+
|
|
26
|
+
// Create the video embed
|
|
27
|
+
let videoButton = dialog.querySelector('.youtube-embed a');
|
|
28
|
+
if (videoButton){
|
|
29
|
+
createEmbed(videoButton)
|
|
30
|
+
}
|
|
31
|
+
|
|
32
|
+
// Open the modal!
|
|
33
|
+
dialog.showModal();
|
|
34
|
+
dialog.focus();
|
|
35
|
+
|
|
36
|
+
window.dataLayer = window.dataLayer || [];
|
|
37
|
+
window.dataLayer.push({
|
|
38
|
+
"event": "openModal",
|
|
39
|
+
"id": modalID
|
|
40
|
+
});
|
|
41
|
+
};
|
|
42
|
+
|
|
43
|
+
// Close modal
|
|
44
|
+
if (event && event.target instanceof HTMLElement && event.target.closest('button.dialog__close')){
|
|
45
|
+
const dialog = event.target.closest('dialog[open]');
|
|
46
|
+
|
|
47
|
+
event.preventDefault();
|
|
48
|
+
dialog.close()
|
|
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
|
+
|
|
55
|
+
window.dataLayer = window.dataLayer || [];
|
|
56
|
+
window.dataLayer.push({
|
|
57
|
+
"event": "closeModal",
|
|
58
|
+
"id": dialog.getAttribute('id')
|
|
59
|
+
});
|
|
60
|
+
}
|
|
61
|
+
|
|
62
|
+
// Track default close buttons
|
|
63
|
+
if (event && event.target instanceof HTMLElement && event.target.closest('button[formmethod="dialog"]')){
|
|
64
|
+
const dialog = event.target.closest('dialog[open]');
|
|
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
|
+
|
|
71
|
+
window.dataLayer = window.dataLayer || [];
|
|
72
|
+
window.dataLayer.push({
|
|
73
|
+
"event": "closeModal",
|
|
74
|
+
"id": dialog.getAttribute('id')
|
|
75
|
+
});
|
|
76
|
+
}
|
|
77
|
+
|
|
78
|
+
// Close the modal when clicked on the backdrop
|
|
79
|
+
if (event && event.target instanceof HTMLElement && event.target.closest('dialog[open]')){
|
|
80
|
+
const dialog = event.target.closest('dialog[open]');
|
|
81
|
+
|
|
82
|
+
// Dont allow the backdrop to be clicked when transactional
|
|
83
|
+
if(!dialog.querySelector(':scope > .mh-lg > form:last-child > button:last-child, :scope > .mh-lg > button:last-child') || dialog.classList.contains('dialog--multi')){
|
|
84
|
+
|
|
85
|
+
const dialogDimensions = dialog.getBoundingClientRect()
|
|
86
|
+
|
|
87
|
+
if (event.clientX < dialogDimensions.left || event.clientX > dialogDimensions.right || event.clientY < dialogDimensions.top || event.clientY > dialogDimensions.bottom) {
|
|
88
|
+
|
|
89
|
+
dialog.close()
|
|
90
|
+
|
|
91
|
+
window.dataLayer = window.dataLayer || [];
|
|
92
|
+
window.dataLayer.push({
|
|
93
|
+
"event": "closeModal",
|
|
94
|
+
"id": dialog.getAttribute('id')
|
|
95
|
+
});
|
|
96
|
+
}
|
|
97
|
+
}
|
|
98
|
+
}
|
|
99
|
+
|
|
100
|
+
// Popover
|
|
101
|
+
if (event && event.target instanceof HTMLElement && event.target.closest('.dialog__wrapper > button')){
|
|
102
|
+
|
|
103
|
+
// Close existing open popover
|
|
104
|
+
|
|
105
|
+
let btn = event.target.closest('.dialog__wrapper > button');
|
|
106
|
+
let parent = event.target.closest('.dialog__wrapper > button').parentNode;
|
|
107
|
+
let dataEvent = "openPopover"
|
|
108
|
+
let popover = parent.querySelector(':scope > dialog');
|
|
109
|
+
|
|
110
|
+
|
|
111
|
+
if(document.querySelector('dialog[open]') && document.querySelector('dialog[open]') != popover)
|
|
112
|
+
document.querySelector('dialog[open]').close();
|
|
113
|
+
|
|
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
|
+
|
|
120
|
+
if(popover.hasAttribute('open')){
|
|
121
|
+
|
|
122
|
+
popover.close();
|
|
123
|
+
dataEvent = "closePopover"
|
|
124
|
+
|
|
125
|
+
popover.removeAttribute('style');
|
|
126
|
+
btn.classList.remove('active');
|
|
127
|
+
}
|
|
128
|
+
else {
|
|
129
|
+
|
|
130
|
+
popover.show();
|
|
131
|
+
btn.classList.add('active');
|
|
132
|
+
|
|
133
|
+
var position = btn.getBoundingClientRect();
|
|
134
|
+
let topOffset = position.top;
|
|
135
|
+
let leftOffset = position.left;
|
|
136
|
+
|
|
137
|
+
if(btn.closest('iam-table')){
|
|
138
|
+
|
|
139
|
+
let container = btn.closest('iam-table').parentNode.getBoundingClientRect();
|
|
140
|
+
|
|
141
|
+
topOffset -= container.top;
|
|
142
|
+
leftOffset -= container.left;
|
|
143
|
+
}
|
|
144
|
+
|
|
145
|
+
if(popover.classList.contains('dialog--fix')){
|
|
146
|
+
popover.setAttribute('style',`position:fixed;top: ${topOffset}px; left: ${leftOffset}px; margin: 3rem 0 0 0;`)
|
|
147
|
+
}
|
|
148
|
+
}
|
|
149
|
+
|
|
150
|
+
// When the dialog is fixed it could dip under the viewport
|
|
151
|
+
// Lets check the dimensions and transform it to appear above
|
|
152
|
+
let boundingRec = popover.getBoundingClientRect();
|
|
153
|
+
let popoverBottom = boundingRec.bottom - window.scrollY;
|
|
154
|
+
let windowPos = window.innerHeight - window.scrollY;
|
|
155
|
+
if(popoverBottom > windowPos){
|
|
156
|
+
|
|
157
|
+
let currentStyle = popover.getAttribute('style');
|
|
158
|
+
|
|
159
|
+
popover.setAttribute('style',currentStyle+`transform: translate(0, calc(-100% - 4rem))`);
|
|
160
|
+
}
|
|
161
|
+
|
|
162
|
+
window.dataLayer = window.dataLayer || [];
|
|
163
|
+
|
|
164
|
+
window.dataLayer.push({
|
|
165
|
+
"event": dataEvent,
|
|
166
|
+
"id": btn.textContent
|
|
167
|
+
});
|
|
168
|
+
};
|
|
169
|
+
});
|
|
170
|
+
|
|
171
|
+
return null
|
|
172
|
+
}
|
|
173
|
+
|
|
174
|
+
export const createDialog = (dialog) => {
|
|
175
|
+
|
|
176
|
+
// Multi dialog
|
|
177
|
+
if(dialog.classList.contains('dialog--multi') && !dialog.querySelector(':scope > .steps')) {
|
|
178
|
+
createMultiFormDialog(dialog);
|
|
179
|
+
}
|
|
180
|
+
|
|
181
|
+
if(!dialog.querySelector(':scope > .mh-lg') && !dialog.classList.contains('dialog--multi')){
|
|
182
|
+
dialog.innerHTML = `<div class="mh-lg">${dialog.innerHTML}</div>`;
|
|
183
|
+
|
|
184
|
+
let dialogContent = dialog.querySelector('.mh-lg');
|
|
185
|
+
let titleElement = dialog.querySelector('.mh-lg :is(.h1,.h2,.h3,.h4,.h5,.h6)');
|
|
186
|
+
|
|
187
|
+
if(titleElement){
|
|
188
|
+
|
|
189
|
+
let optionalElement = titleElement.previousSibling;
|
|
190
|
+
|
|
191
|
+
dialogContent.before(titleElement);
|
|
192
|
+
|
|
193
|
+
if(optionalElement)
|
|
194
|
+
titleElement.before(optionalElement);
|
|
195
|
+
}
|
|
196
|
+
}
|
|
197
|
+
|
|
198
|
+
// Create close button is needed
|
|
199
|
+
if(!dialog.querySelector(':scope > button:first-child'))
|
|
200
|
+
dialog.innerHTML = `<button class="dialog__close">Close</button>${dialog.innerHTML}`;
|
|
201
|
+
|
|
202
|
+
}
|
|
203
|
+
|
|
204
|
+
const createMultiFormDialog = (dialog) => {
|
|
205
|
+
let buttons = "";
|
|
206
|
+
let fieldsets = Array.from(dialog.querySelectorAll('fieldset[data-title]'));
|
|
207
|
+
fieldsets.forEach((fieldset,index) => {
|
|
208
|
+
buttons += `<button data-title="${fieldset.getAttribute('data-title')}" type="button" class="${index == 0 ? "active":""}">${fieldset.getAttribute('data-title')}</button>`;
|
|
209
|
+
|
|
210
|
+
const btnWrapper = document.createElement("div");
|
|
211
|
+
btnWrapper.classList.add('btn--wrapper');
|
|
212
|
+
fieldset.appendChild(btnWrapper);
|
|
213
|
+
|
|
214
|
+
|
|
215
|
+
if(index != 0)
|
|
216
|
+
btnWrapper.innerHTML += `<button data-title="${fieldsets[index-1].getAttribute('data-title')}" class="btn btn-secondary mb-0" type="button">Previous</button>`;
|
|
217
|
+
|
|
218
|
+
if(index != fieldsets.length - 1)
|
|
219
|
+
btnWrapper.innerHTML += `<button data-title="${fieldsets[index+1].getAttribute('data-title')}" class="btn btn-primary mb-0" type="button">Next</button>`;
|
|
220
|
+
|
|
221
|
+
if(index == fieldsets.length - 1)
|
|
222
|
+
btnWrapper.innerHTML += `<button class="btn btn-primary mb-0">Submit</button>`;
|
|
223
|
+
});
|
|
224
|
+
|
|
225
|
+
dialog.innerHTML = `<div class="steps bg-primary">${buttons}</div>${dialog.innerHTML}`;
|
|
226
|
+
|
|
227
|
+
|
|
228
|
+
dialog.addEventListener('click', (event) => {
|
|
229
|
+
if (event && event.target instanceof HTMLElement && event.target.closest('button[data-title]')){
|
|
230
|
+
const button = event.target.closest('button[data-title]');
|
|
231
|
+
const fieldset = dialog.querySelector(`fieldset[data-title="${button.getAttribute('data-title')}"]`);
|
|
232
|
+
const step = dialog.querySelector(`.steps button[data-title="${button.getAttribute('data-title')}"]`);
|
|
233
|
+
|
|
234
|
+
Array.from(dialog.querySelectorAll('button')).forEach((button, index) => {
|
|
235
|
+
button.classList.remove('active');
|
|
236
|
+
});
|
|
237
|
+
Array.from(dialog.querySelectorAll('fieldset')).forEach((button, index) => {
|
|
238
|
+
button.classList.remove('active');
|
|
239
|
+
});
|
|
240
|
+
|
|
241
|
+
step.classList.add('active');
|
|
242
|
+
fieldset.classList.add('active');
|
|
243
|
+
};
|
|
244
|
+
return null
|
|
245
|
+
});
|
|
246
|
+
}
|
|
247
|
+
|
|
248
|
+
export default extendDialogs;
|
|
@@ -1,6 +1,4 @@
|
|
|
1
1
|
// @ts-nocheck
|
|
2
|
-
import { createEmbed } from "./youtubevideo";
|
|
3
|
-
|
|
4
2
|
/**
|
|
5
3
|
* Global helper functions to help maintain and enhance framework elements.
|
|
6
4
|
* @module Helpers
|
|
@@ -49,7 +47,7 @@ export const addGlobalEvents = (body) => {
|
|
|
49
47
|
|
|
50
48
|
addEventListener("popstate", (event) => {
|
|
51
49
|
|
|
52
|
-
if(event.state.type == "pagination"){
|
|
50
|
+
if(event && event.state.type && event.state.type == "pagination"){
|
|
53
51
|
let form = document.querySelector(`#${event.state.form}`);
|
|
54
52
|
let pageInput = document.querySelector(`#${event.state.form} [data-pagination]`);
|
|
55
53
|
|
|
@@ -62,126 +60,6 @@ export const addGlobalEvents = (body) => {
|
|
|
62
60
|
}
|
|
63
61
|
});
|
|
64
62
|
|
|
65
|
-
// Dialogs/modals
|
|
66
|
-
document.addEventListener('click', (event) => {
|
|
67
|
-
|
|
68
|
-
// Modal
|
|
69
|
-
if (event && event.target instanceof HTMLElement && event.target.closest('[data-modal]')){
|
|
70
|
-
|
|
71
|
-
const button = event.target.closest('[data-modal]');
|
|
72
|
-
const modalID = button.hasAttribute('data-modal') ? button.getAttribute('data-modal') : button.getAttribute('data-filter');
|
|
73
|
-
const dialog = document.querySelector(`dialog#${modalID}`);
|
|
74
|
-
|
|
75
|
-
// Create close button is needed
|
|
76
|
-
dialog.innerHTML = `<button class="dialog__close">Close</button>${dialog.innerHTML}`;
|
|
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
|
-
|
|
84
|
-
let videoButton = dialog.querySelector('.youtube-embed a');
|
|
85
|
-
|
|
86
|
-
if (videoButton){
|
|
87
|
-
createEmbed(videoButton)
|
|
88
|
-
}
|
|
89
|
-
|
|
90
|
-
dialog.showModal();
|
|
91
|
-
|
|
92
|
-
window.dataLayer = window.dataLayer || [];
|
|
93
|
-
window.dataLayer.push({
|
|
94
|
-
"event": "openModal",
|
|
95
|
-
"id": modalID
|
|
96
|
-
});
|
|
97
|
-
};
|
|
98
|
-
|
|
99
|
-
// Close modal
|
|
100
|
-
if (event && event.target instanceof HTMLElement && event.target.closest('button.dialog__close')){
|
|
101
|
-
const dialog = event.target.closest('dialog[open]');
|
|
102
|
-
|
|
103
|
-
event.preventDefault();
|
|
104
|
-
dialog.close()
|
|
105
|
-
|
|
106
|
-
window.dataLayer = window.dataLayer || [];
|
|
107
|
-
window.dataLayer.push({
|
|
108
|
-
"event": "closeModal",
|
|
109
|
-
"id": dialog.getAttribute('id')
|
|
110
|
-
});
|
|
111
|
-
}
|
|
112
|
-
|
|
113
|
-
if (event && event.target instanceof HTMLElement && event.target.closest('dialog[open]')){
|
|
114
|
-
const dialog = event.target.closest('dialog[open]');
|
|
115
|
-
const dialogDimensions = dialog.getBoundingClientRect()
|
|
116
|
-
|
|
117
|
-
if (event.clientX < dialogDimensions.left || event.clientX > dialogDimensions.right || event.clientY < dialogDimensions.top || event.clientY > dialogDimensions.bottom) {
|
|
118
|
-
|
|
119
|
-
dialog.close()
|
|
120
|
-
|
|
121
|
-
window.dataLayer = window.dataLayer || [];
|
|
122
|
-
window.dataLayer.push({
|
|
123
|
-
"event": "closeModal",
|
|
124
|
-
"id": dialog.getAttribute('id')
|
|
125
|
-
});
|
|
126
|
-
}
|
|
127
|
-
}
|
|
128
|
-
|
|
129
|
-
// Popover
|
|
130
|
-
if (event && event.target instanceof HTMLElement && event.target.closest('.dialog__wrapper > button')){
|
|
131
|
-
|
|
132
|
-
// Close existing open popover
|
|
133
|
-
|
|
134
|
-
let btn = event.target.closest('.dialog__wrapper > button');
|
|
135
|
-
let parent = event.target.closest('.dialog__wrapper > button').parentNode;
|
|
136
|
-
let dataEvent = "openPopover"
|
|
137
|
-
let popover = parent.querySelector(':scope > dialog');
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
if(document.querySelector('dialog[open]') && document.querySelector('dialog[open]') != popover)
|
|
141
|
-
document.querySelector('dialog[open]').close();
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
if(popover.hasAttribute('open')){
|
|
145
|
-
|
|
146
|
-
popover.close();
|
|
147
|
-
dataEvent = "closePopover"
|
|
148
|
-
|
|
149
|
-
popover.removeAttribute('style');
|
|
150
|
-
btn.classList.remove('active');
|
|
151
|
-
}
|
|
152
|
-
else {
|
|
153
|
-
|
|
154
|
-
popover.show();
|
|
155
|
-
btn.classList.add('active');
|
|
156
|
-
|
|
157
|
-
var position = btn.getBoundingClientRect();
|
|
158
|
-
let topOffset = position.top;
|
|
159
|
-
let leftOffset = position.left;
|
|
160
|
-
|
|
161
|
-
if(btn.closest('iam-table')){
|
|
162
|
-
|
|
163
|
-
let container = btn.closest('iam-table').parentNode.getBoundingClientRect();
|
|
164
|
-
|
|
165
|
-
topOffset -= container.top;
|
|
166
|
-
leftOffset -= container.left;
|
|
167
|
-
|
|
168
|
-
}
|
|
169
|
-
|
|
170
|
-
if(popover.classList.contains('dialog--fix')){
|
|
171
|
-
popover.setAttribute('style',`position:fixed;top: ${topOffset}px; left: ${leftOffset}px; margin: 3rem 0 0 0;`)
|
|
172
|
-
}
|
|
173
|
-
}
|
|
174
|
-
|
|
175
|
-
|
|
176
|
-
window.dataLayer = window.dataLayer || [];
|
|
177
|
-
|
|
178
|
-
window.dataLayer.push({
|
|
179
|
-
"event": dataEvent,
|
|
180
|
-
"id": btn.textContent
|
|
181
|
-
});
|
|
182
|
-
};
|
|
183
|
-
});
|
|
184
|
-
|
|
185
63
|
return null
|
|
186
64
|
}
|
|
187
65
|
|