@kupola/kupola 1.5.4 → 1.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/css/components-ext.css +3 -3
- package/dist/css/components-ext.css +3 -3
- package/dist/kupola.cjs.js +17 -17
- package/dist/kupola.cjs.js.map +1 -1
- package/dist/kupola.esm.js +880 -843
- package/dist/kupola.esm.js.map +1 -1
- package/dist/kupola.umd.js +17 -17
- package/dist/kupola.umd.js.map +1 -1
- package/js/datepicker.js +8 -3
- package/js/dropdown.js +14 -3
- package/js/kupola-config.js +14 -0
- package/js/message.js +5 -2
- package/js/notification.js +5 -2
- package/js/select.js +9 -2
- package/js/tooltip.js +6 -2
- package/package.json +1 -1
package/js/datepicker.js
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { globalEvents } from './global-events.js';
|
|
2
2
|
import { kupolaInitializer } from './initializer.js';
|
|
3
|
-
import { getUiConfig } from './kupola-config.js';
|
|
3
|
+
import { getUiConfig, getZIndexConfig } from './kupola-config.js';
|
|
4
4
|
|
|
5
5
|
class Datepicker {
|
|
6
6
|
constructor(element, options = {}) {
|
|
@@ -249,9 +249,13 @@ class Datepicker {
|
|
|
249
249
|
this._originalTop = this.calendarEl.style.top;
|
|
250
250
|
this._originalLeft = this.calendarEl.style.left;
|
|
251
251
|
this._originalWidth = this.calendarEl.style.width;
|
|
252
|
+
this._originalTransform = this.calendarEl.style.transform;
|
|
253
|
+
this._originalZIndex = this.calendarEl.style.zIndex;
|
|
252
254
|
|
|
255
|
+
const zIndex = getZIndexConfig().datepicker;
|
|
253
256
|
this.calendarEl.style.position = 'fixed';
|
|
254
|
-
this.calendarEl.style.zIndex =
|
|
257
|
+
this.calendarEl.style.zIndex = zIndex;
|
|
258
|
+
this.calendarEl.style.transform = 'translateZ(0)';
|
|
255
259
|
document.body.appendChild(this.calendarEl);
|
|
256
260
|
}
|
|
257
261
|
|
|
@@ -262,7 +266,8 @@ class Datepicker {
|
|
|
262
266
|
this.calendarEl.style.top = this._originalTop || '';
|
|
263
267
|
this.calendarEl.style.left = this._originalLeft || '';
|
|
264
268
|
this.calendarEl.style.width = this._originalWidth || '';
|
|
265
|
-
this.calendarEl.style.zIndex = '';
|
|
269
|
+
this.calendarEl.style.zIndex = this._originalZIndex || '';
|
|
270
|
+
this.calendarEl.style.transform = this._originalTransform || '';
|
|
266
271
|
this._originalParent = null;
|
|
267
272
|
}
|
|
268
273
|
|
package/js/dropdown.js
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { globalEvents } from './global-events.js';
|
|
2
2
|
import { kupolaInitializer } from './initializer.js';
|
|
3
|
-
import { getUiConfig } from './kupola-config.js';
|
|
3
|
+
import { getUiConfig, getZIndexConfig } from './kupola-config.js';
|
|
4
4
|
|
|
5
5
|
class Dropdown {
|
|
6
6
|
constructor(element, options = {}) {
|
|
@@ -48,13 +48,19 @@ class Dropdown {
|
|
|
48
48
|
|
|
49
49
|
// Item click handler
|
|
50
50
|
this._itemClickHandler = (e) => {
|
|
51
|
+
e.stopPropagation();
|
|
51
52
|
const item = e.currentTarget;
|
|
52
53
|
if (item.classList.contains('is-disabled') || item.classList.contains('ds-dropdown__divider')) {return;}
|
|
53
54
|
|
|
55
|
+
this.menu.querySelectorAll('.ds-dropdown__item').forEach(i => i.classList.remove('is-selected'));
|
|
56
|
+
item.classList.add('is-selected');
|
|
57
|
+
|
|
54
58
|
if (this.triggerText && !item.hasAttribute('data-no-update-trigger')) {
|
|
55
59
|
this.triggerText.textContent = item.textContent.trim();
|
|
56
60
|
}
|
|
57
61
|
|
|
62
|
+
this.element.setAttribute('data-value', item.getAttribute('data-value') || '');
|
|
63
|
+
|
|
58
64
|
if (this.onSelect) {
|
|
59
65
|
this.onSelect({ item, value: item.getAttribute('data-value'), text: item.textContent.trim() });
|
|
60
66
|
}
|
|
@@ -296,9 +302,13 @@ class Dropdown {
|
|
|
296
302
|
this._originalBottom = this.menu.style.bottom;
|
|
297
303
|
this._originalMarginBottom = this.menu.style.marginBottom;
|
|
298
304
|
this._originalWidth = this.menu.style.width;
|
|
305
|
+
this._originalTransform = this.menu.style.transform;
|
|
306
|
+
this._originalZIndex = this.menu.style.zIndex;
|
|
299
307
|
|
|
308
|
+
const zIndex = getZIndexConfig().dropdown;
|
|
300
309
|
this.menu.style.position = 'fixed';
|
|
301
|
-
this.menu.style.zIndex =
|
|
310
|
+
this.menu.style.zIndex = zIndex;
|
|
311
|
+
this.menu.style.transform = 'translateZ(0)';
|
|
302
312
|
document.body.appendChild(this.menu);
|
|
303
313
|
}
|
|
304
314
|
|
|
@@ -312,7 +322,8 @@ class Dropdown {
|
|
|
312
322
|
this.menu.style.bottom = this._originalBottom || '';
|
|
313
323
|
this.menu.style.marginBottom = this._originalMarginBottom || '';
|
|
314
324
|
this.menu.style.width = this._originalWidth || '';
|
|
315
|
-
this.menu.style.zIndex = '';
|
|
325
|
+
this.menu.style.zIndex = this._originalZIndex || '';
|
|
326
|
+
this.menu.style.transform = this._originalTransform || '';
|
|
316
327
|
this._originalParent = null;
|
|
317
328
|
}
|
|
318
329
|
|
package/js/kupola-config.js
CHANGED
|
@@ -17,6 +17,16 @@ const config = {
|
|
|
17
17
|
headers: {},
|
|
18
18
|
withCredentials: false,
|
|
19
19
|
},
|
|
20
|
+
zIndex: {
|
|
21
|
+
modal: 1000,
|
|
22
|
+
dropdown: 2000,
|
|
23
|
+
tooltip: 2100,
|
|
24
|
+
popover: 2200,
|
|
25
|
+
datepicker: 2300,
|
|
26
|
+
message: 3000,
|
|
27
|
+
notification: 3100,
|
|
28
|
+
loading: 5000,
|
|
29
|
+
},
|
|
20
30
|
ui: {
|
|
21
31
|
defaultSize: 'md',
|
|
22
32
|
modal: {
|
|
@@ -117,6 +127,10 @@ export function getUiConfig() {
|
|
|
117
127
|
return config.ui;
|
|
118
128
|
}
|
|
119
129
|
|
|
130
|
+
export function getZIndexConfig() {
|
|
131
|
+
return config.zIndex;
|
|
132
|
+
}
|
|
133
|
+
|
|
120
134
|
export function getSecurityConfig() {
|
|
121
135
|
return config.security;
|
|
122
136
|
}
|
package/js/message.js
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { getMessageConfig } from './kupola-config.js';
|
|
1
|
+
import { getMessageConfig, getZIndexConfig } from './kupola-config.js';
|
|
2
2
|
|
|
3
3
|
const Message = {
|
|
4
4
|
normal: function (message, options = {}) {
|
|
@@ -42,6 +42,9 @@ const Message = {
|
|
|
42
42
|
if (!container) {
|
|
43
43
|
container = document.createElement('div');
|
|
44
44
|
container.className = `ds-message ds-message--${position}`;
|
|
45
|
+
const zIndex = getZIndexConfig().message;
|
|
46
|
+
container.style.zIndex = zIndex;
|
|
47
|
+
container.style.transform = 'translateZ(0)';
|
|
45
48
|
document.body.appendChild(container);
|
|
46
49
|
}
|
|
47
50
|
|
|
@@ -72,4 +75,4 @@ const Message = {
|
|
|
72
75
|
|
|
73
76
|
function initMessages() {}
|
|
74
77
|
|
|
75
|
-
export { Message, initMessages };
|
|
78
|
+
export { Message, initMessages };
|
package/js/notification.js
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { getNotificationConfig } from './kupola-config.js';
|
|
1
|
+
import { getNotificationConfig, getZIndexConfig } from './kupola-config.js';
|
|
2
2
|
|
|
3
3
|
const Notification = {
|
|
4
4
|
normal: function (options) {
|
|
@@ -48,6 +48,9 @@ const Notification = {
|
|
|
48
48
|
if (!container) {
|
|
49
49
|
container = document.createElement('div');
|
|
50
50
|
container.className = `ds-notification ds-notification--${position}`;
|
|
51
|
+
const zIndex = getZIndexConfig().notification;
|
|
52
|
+
container.style.zIndex = zIndex;
|
|
53
|
+
container.style.transform = 'translateZ(0)';
|
|
51
54
|
document.body.appendChild(container);
|
|
52
55
|
}
|
|
53
56
|
|
|
@@ -75,4 +78,4 @@ const Notification = {
|
|
|
75
78
|
|
|
76
79
|
function initNotifications() {}
|
|
77
80
|
|
|
78
|
-
export { Notification, initNotifications };
|
|
81
|
+
export { Notification, initNotifications };
|
package/js/select.js
CHANGED
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import { globalEvents } from './global-events.js';
|
|
2
2
|
import { kupolaInitializer } from './initializer.js';
|
|
3
|
+
import { getZIndexConfig } from './kupola-config.js';
|
|
3
4
|
|
|
4
5
|
class Select {
|
|
5
6
|
constructor(element, options = {}) {
|
|
@@ -74,6 +75,7 @@ class Select {
|
|
|
74
75
|
|
|
75
76
|
// Option click handler
|
|
76
77
|
this._optionClickHandler = (e) => {
|
|
78
|
+
e.stopPropagation();
|
|
77
79
|
const option = e.currentTarget;
|
|
78
80
|
if (option.classList.contains('is-disabled')) return;
|
|
79
81
|
|
|
@@ -495,9 +497,13 @@ class Select {
|
|
|
495
497
|
this._originalLeft = this.optionsEl.style.left;
|
|
496
498
|
this._originalRight = this.optionsEl.style.right;
|
|
497
499
|
this._originalWidth = this.optionsEl.style.width;
|
|
500
|
+
this._originalTransform = this.optionsEl.style.transform;
|
|
501
|
+
this._originalZIndex = this.optionsEl.style.zIndex;
|
|
498
502
|
|
|
503
|
+
const zIndex = getZIndexConfig().dropdown;
|
|
499
504
|
this.optionsEl.style.position = 'fixed';
|
|
500
|
-
this.optionsEl.style.zIndex =
|
|
505
|
+
this.optionsEl.style.zIndex = zIndex;
|
|
506
|
+
this.optionsEl.style.transform = 'translateZ(0)';
|
|
501
507
|
document.body.appendChild(this.optionsEl);
|
|
502
508
|
}
|
|
503
509
|
|
|
@@ -509,7 +515,8 @@ class Select {
|
|
|
509
515
|
this.optionsEl.style.left = this._originalLeft || '';
|
|
510
516
|
this.optionsEl.style.right = this._originalRight || '';
|
|
511
517
|
this.optionsEl.style.width = this._originalWidth || '';
|
|
512
|
-
this.optionsEl.style.zIndex = '';
|
|
518
|
+
this.optionsEl.style.zIndex = this._originalZIndex || '';
|
|
519
|
+
this.optionsEl.style.transform = this._originalTransform || '';
|
|
513
520
|
this._originalParent = null;
|
|
514
521
|
}
|
|
515
522
|
|
package/js/tooltip.js
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { kupolaInitializer } from './initializer.js';
|
|
2
|
-
import { getUiConfig } from './kupola-config.js';
|
|
2
|
+
import { getUiConfig, getZIndexConfig } from './kupola-config.js';
|
|
3
3
|
|
|
4
4
|
class Tooltip {
|
|
5
5
|
constructor(element, options = {}) {
|
|
@@ -118,6 +118,10 @@ class Tooltip {
|
|
|
118
118
|
this.tooltipEl = document.createElement('div');
|
|
119
119
|
this.tooltipEl.className = `ds-tooltip ds-tooltip--${this.position} ds-tooltip--${this.theme}`;
|
|
120
120
|
|
|
121
|
+
const zIndex = getZIndexConfig().tooltip;
|
|
122
|
+
this.tooltipEl.style.zIndex = zIndex;
|
|
123
|
+
this.tooltipEl.style.transform = 'translateZ(0)';
|
|
124
|
+
|
|
121
125
|
if (this.html) {
|
|
122
126
|
this.tooltipEl.innerHTML = text;
|
|
123
127
|
} else {
|
|
@@ -346,4 +350,4 @@ function cleanupTooltip(element) {
|
|
|
346
350
|
|
|
347
351
|
export { Tooltip, initTooltip, initTooltips, cleanupTooltip };
|
|
348
352
|
|
|
349
|
-
kupolaInitializer.register('tooltip', initTooltip, cleanupTooltip);
|
|
353
|
+
kupolaInitializer.register('tooltip', initTooltip, cleanupTooltip);
|
package/package.json
CHANGED