uikit 3.14.4-dev.838f092aa → 3.14.4-dev.8a6d8c5ed
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/CHANGELOG.md +41 -12
- package/build/util.js +1 -0
- package/dist/css/uikit-core-rtl.css +380 -101
- package/dist/css/uikit-core-rtl.min.css +1 -1
- package/dist/css/uikit-core.css +380 -101
- package/dist/css/uikit-core.min.css +1 -1
- package/dist/css/uikit-rtl.css +397 -106
- package/dist/css/uikit-rtl.min.css +1 -1
- package/dist/css/uikit.css +397 -106
- package/dist/css/uikit.min.css +1 -1
- package/dist/js/components/countdown.js +1 -1
- package/dist/js/components/countdown.min.js +1 -1
- package/dist/js/components/filter.js +7 -5
- package/dist/js/components/filter.min.js +1 -1
- package/dist/js/components/lightbox-panel.js +111 -139
- package/dist/js/components/lightbox-panel.min.js +1 -1
- package/dist/js/components/lightbox.js +111 -139
- package/dist/js/components/lightbox.min.js +1 -1
- package/dist/js/components/notification.js +1 -1
- package/dist/js/components/notification.min.js +1 -1
- package/dist/js/components/parallax.js +4 -5
- package/dist/js/components/parallax.min.js +1 -1
- package/dist/js/components/slider-parallax.js +4 -5
- package/dist/js/components/slider-parallax.min.js +1 -1
- package/dist/js/components/slider.js +22 -7
- package/dist/js/components/slider.min.js +1 -1
- package/dist/js/components/slideshow-parallax.js +4 -5
- package/dist/js/components/slideshow-parallax.min.js +1 -1
- package/dist/js/components/slideshow.js +22 -7
- package/dist/js/components/slideshow.min.js +1 -1
- package/dist/js/components/sortable.js +3 -3
- package/dist/js/components/sortable.min.js +1 -1
- package/dist/js/components/tooltip.js +107 -137
- package/dist/js/components/tooltip.min.js +1 -1
- package/dist/js/components/upload.js +1 -1
- package/dist/js/components/upload.min.js +1 -1
- package/dist/js/uikit-core.js +516 -458
- package/dist/js/uikit-core.min.js +14 -1
- package/dist/js/uikit-icons.js +1 -1
- package/dist/js/uikit-icons.min.js +1 -1
- package/dist/js/uikit.js +569 -494
- package/dist/js/uikit.min.js +14 -1
- package/package.json +1 -1
- package/src/images/{backgrounds/nav-parent-open.svg → components/nav-parent-icon-large.svg} +0 -0
- package/src/images/components/nav-parent-icon.svg +3 -0
- package/src/images/components/navbar-parent-icon.svg +3 -0
- package/src/images/components/navbar-toggle-icon.svg +22 -3
- package/src/js/api/state.js +2 -2
- package/src/js/components/filter.js +5 -3
- package/src/js/components/sortable.js +2 -3
- package/src/js/core/accordion.js +9 -17
- package/src/js/core/alert.js +35 -14
- package/src/js/core/drop.js +89 -62
- package/src/js/core/height-viewport.js +14 -6
- package/src/js/core/icon.js +16 -0
- package/src/js/core/index.js +2 -0
- package/src/js/core/leader.js +2 -2
- package/src/js/core/navbar.js +44 -30
- package/src/js/core/scroll.js +37 -10
- package/src/js/core/sticky.js +8 -9
- package/src/js/core/toggle.js +3 -5
- package/src/js/mixin/media.js +4 -5
- package/src/js/mixin/modal.js +10 -7
- package/src/js/mixin/position.js +26 -11
- package/src/js/mixin/slider-drag.js +20 -8
- package/src/js/mixin/style.js +11 -0
- package/src/js/mixin/togglable.js +88 -133
- package/src/js/util/animation.js +4 -3
- package/src/js/util/dimensions.js +6 -6
- package/src/js/util/filter.js +3 -7
- package/src/js/util/position.js +108 -107
- package/src/js/util/style.js +4 -13
- package/src/js/util/viewport.js +5 -32
- package/src/less/components/_import.less +1 -0
- package/src/less/components/drop.less +1 -18
- package/src/less/components/dropbar.less +115 -0
- package/src/less/components/dropdown.less +16 -16
- package/src/less/components/leader.less +1 -1
- package/src/less/components/nav.less +240 -63
- package/src/less/components/navbar.less +73 -27
- package/src/less/components/utility.less +21 -4
- package/src/less/theme/_import.less +1 -0
- package/src/less/theme/dropbar.less +44 -0
- package/src/less/theme/dropdown.less +0 -11
- package/src/less/theme/nav.less +43 -9
- package/src/less/theme/navbar.less +4 -10
- package/src/scss/components/_import.scss +1 -0
- package/src/scss/components/drop.scss +1 -18
- package/src/scss/components/dropbar.scss +115 -0
- package/src/scss/components/dropdown.scss +16 -16
- package/src/scss/components/leader.scss +1 -1
- package/src/scss/components/nav.scss +189 -51
- package/src/scss/components/navbar.scss +61 -27
- package/src/scss/components/utility.scss +19 -3
- package/src/scss/mixins-theme.scss +93 -25
- package/src/scss/mixins.scss +89 -17
- package/src/scss/theme/_import.scss +1 -0
- package/src/scss/theme/dropbar.scss +44 -0
- package/src/scss/theme/dropdown.scss +0 -8
- package/src/scss/theme/nav.scss +41 -9
- package/src/scss/theme/navbar.scss +4 -7
- package/src/scss/variables-theme.scss +69 -17
- package/src/scss/variables.scss +58 -13
- package/tests/accordion.html +2 -2
- package/tests/alert.html +2 -2
- package/tests/countdown.html +1 -1
- package/tests/drop.html +451 -371
- package/tests/dropbar.html +456 -0
- package/tests/dropdown.html +26 -401
- package/tests/filter.html +9 -12
- package/tests/form.html +1 -1
- package/tests/index.html +126 -107
- package/tests/js/index.js +1 -4
- package/tests/lightbox.html +5 -5
- package/tests/list.html +8 -8
- package/tests/modal.html +13 -13
- package/tests/nav.html +117 -75
- package/tests/navbar.html +2001 -1130
- package/tests/offcanvas.html +17 -21
- package/tests/parallax.html +1 -1
- package/tests/position.html +18 -16
- package/tests/progress.html +9 -9
- package/tests/scroll.html +7 -10
- package/tests/search.html +5 -5
- package/tests/slider.html +6 -5
- package/tests/slideshow.html +8 -8
- package/tests/sortable.html +6 -8
- package/tests/sticky-navbar.html +6 -6
- package/tests/sticky.html +8 -8
- package/tests/switcher.html +1 -1
- package/tests/tab.html +1 -1
- package/tests/table.html +7 -7
- package/tests/toggle.html +2 -2
- package/tests/tooltip.html +1 -1
- package/tests/upload.html +11 -11
- package/tests/utility.html +19 -0
- package/src/images/backgrounds/nav-parent-close.svg +0 -3
package/src/js/core/navbar.js
CHANGED
|
@@ -19,6 +19,7 @@ import {
|
|
|
19
19
|
offset,
|
|
20
20
|
once,
|
|
21
21
|
parent,
|
|
22
|
+
parents,
|
|
22
23
|
query,
|
|
23
24
|
remove,
|
|
24
25
|
selFocusable,
|
|
@@ -36,7 +37,9 @@ export default {
|
|
|
36
37
|
align: String,
|
|
37
38
|
offset: Number,
|
|
38
39
|
boundary: Boolean,
|
|
39
|
-
|
|
40
|
+
target: Boolean,
|
|
41
|
+
targetX: Boolean,
|
|
42
|
+
targetY: Boolean,
|
|
40
43
|
clsDrop: String,
|
|
41
44
|
delayShow: Number,
|
|
42
45
|
delayHide: Number,
|
|
@@ -53,9 +56,12 @@ export default {
|
|
|
53
56
|
offset: undefined,
|
|
54
57
|
delayShow: undefined,
|
|
55
58
|
delayHide: undefined,
|
|
56
|
-
|
|
57
|
-
|
|
59
|
+
flip: false,
|
|
60
|
+
shift: true,
|
|
58
61
|
boundary: true,
|
|
62
|
+
target: false,
|
|
63
|
+
targetX: false,
|
|
64
|
+
targetY: false,
|
|
59
65
|
dropbar: false,
|
|
60
66
|
dropbarAnchor: false,
|
|
61
67
|
duration: 200,
|
|
@@ -90,7 +96,7 @@ export default {
|
|
|
90
96
|
},
|
|
91
97
|
|
|
92
98
|
watch(dropbar) {
|
|
93
|
-
addClass(dropbar, 'uk-navbar-dropbar');
|
|
99
|
+
addClass(dropbar, 'uk-dropbar', 'uk-dropbar-top', 'uk-navbar-dropbar');
|
|
94
100
|
},
|
|
95
101
|
|
|
96
102
|
immediate: true,
|
|
@@ -106,7 +112,7 @@ export default {
|
|
|
106
112
|
|
|
107
113
|
if (this.dropContainer !== $el) {
|
|
108
114
|
for (const el of $$(`.${clsDrop}`, this.dropContainer)) {
|
|
109
|
-
const target = this.getDropdown(el)?.
|
|
115
|
+
const target = this.getDropdown(el)?.targetEl;
|
|
110
116
|
if (!includes(dropdowns, el) && target && within(target, this.$el)) {
|
|
111
117
|
dropdowns.push(el);
|
|
112
118
|
}
|
|
@@ -124,7 +130,6 @@ export default {
|
|
|
124
130
|
...this.$props,
|
|
125
131
|
boundary: this.boundary,
|
|
126
132
|
pos: this.pos,
|
|
127
|
-
offset: this.dropbar || this.offset,
|
|
128
133
|
}
|
|
129
134
|
);
|
|
130
135
|
},
|
|
@@ -169,8 +174,8 @@ export default {
|
|
|
169
174
|
if (
|
|
170
175
|
active &&
|
|
171
176
|
includes(active.mode, 'hover') &&
|
|
172
|
-
active.
|
|
173
|
-
!within(active.
|
|
177
|
+
active.targetEl &&
|
|
178
|
+
!within(active.targetEl, current) &&
|
|
174
179
|
!active.isDelaying
|
|
175
180
|
) {
|
|
176
181
|
active.hide(false);
|
|
@@ -192,7 +197,7 @@ export default {
|
|
|
192
197
|
if (keyCode === keyMap.DOWN && hasAttr(current, 'aria-expanded')) {
|
|
193
198
|
e.preventDefault();
|
|
194
199
|
|
|
195
|
-
if (!active || active.
|
|
200
|
+
if (!active || active.targetEl !== current) {
|
|
196
201
|
current.click();
|
|
197
202
|
once(this.dropContainer, 'show', ({ target }) =>
|
|
198
203
|
focusFirstFocusableElement(target)
|
|
@@ -243,7 +248,7 @@ export default {
|
|
|
243
248
|
}
|
|
244
249
|
|
|
245
250
|
if (keyCode === keyMap.ESC) {
|
|
246
|
-
active?.
|
|
251
|
+
active?.targetEl?.focus();
|
|
247
252
|
}
|
|
248
253
|
|
|
249
254
|
handleNavItemNavigation(e, this.toggles, active);
|
|
@@ -285,8 +290,8 @@ export default {
|
|
|
285
290
|
return this.dropbar;
|
|
286
291
|
},
|
|
287
292
|
|
|
288
|
-
handler(
|
|
289
|
-
if (!
|
|
293
|
+
handler({ target }) {
|
|
294
|
+
if (!this.isDropbarDrop(target)) {
|
|
290
295
|
return;
|
|
291
296
|
}
|
|
292
297
|
|
|
@@ -294,7 +299,7 @@ export default {
|
|
|
294
299
|
after(this.dropbarAnchor || this.$el, this.dropbar);
|
|
295
300
|
}
|
|
296
301
|
|
|
297
|
-
addClass(
|
|
302
|
+
addClass(target, `${this.clsDrop}-dropbar`);
|
|
298
303
|
},
|
|
299
304
|
},
|
|
300
305
|
|
|
@@ -309,19 +314,24 @@ export default {
|
|
|
309
314
|
return this.dropbar;
|
|
310
315
|
},
|
|
311
316
|
|
|
312
|
-
handler(
|
|
313
|
-
if (!
|
|
317
|
+
handler({ target }) {
|
|
318
|
+
if (!this.isDropbarDrop(target)) {
|
|
314
319
|
return;
|
|
315
320
|
}
|
|
316
321
|
|
|
317
|
-
this._observer = observeResize(
|
|
322
|
+
this._observer = observeResize(target, () => {
|
|
323
|
+
const targetOffsets = parents(target, `.${this.clsDrop}`)
|
|
324
|
+
.concat(target)
|
|
325
|
+
.map((el) => offset(el));
|
|
326
|
+
const minTop = Math.min(...targetOffsets.map(({ top }) => top));
|
|
327
|
+
const maxBottom = Math.max(...targetOffsets.map(({ bottom }) => bottom));
|
|
328
|
+
const dropbarOffset = offset(this.dropbar);
|
|
329
|
+
css(this.dropbar, 'top', this.dropbar.offsetTop - (dropbarOffset.top - minTop));
|
|
318
330
|
this.transitionTo(
|
|
319
|
-
|
|
320
|
-
|
|
321
|
-
|
|
322
|
-
|
|
323
|
-
)
|
|
324
|
-
);
|
|
331
|
+
maxBottom - minTop + toFloat(css(target, 'marginBottom')),
|
|
332
|
+
target
|
|
333
|
+
);
|
|
334
|
+
});
|
|
325
335
|
},
|
|
326
336
|
},
|
|
327
337
|
|
|
@@ -336,13 +346,13 @@ export default {
|
|
|
336
346
|
return this.dropbar;
|
|
337
347
|
},
|
|
338
348
|
|
|
339
|
-
handler(e
|
|
349
|
+
handler(e) {
|
|
340
350
|
const active = this.getActive();
|
|
341
351
|
|
|
342
352
|
if (
|
|
343
353
|
matches(this.dropbar, ':hover') &&
|
|
344
|
-
active?.$el ===
|
|
345
|
-
!this.toggles.some((el) => active.
|
|
354
|
+
active?.$el === e.target &&
|
|
355
|
+
!this.toggles.some((el) => active.targetEl !== el && matches(el, ':focus'))
|
|
346
356
|
) {
|
|
347
357
|
e.preventDefault();
|
|
348
358
|
}
|
|
@@ -360,8 +370,8 @@ export default {
|
|
|
360
370
|
return this.dropbar;
|
|
361
371
|
},
|
|
362
372
|
|
|
363
|
-
handler(
|
|
364
|
-
if (!
|
|
373
|
+
handler({ target }) {
|
|
374
|
+
if (!this.isDropbarDrop(target)) {
|
|
365
375
|
return;
|
|
366
376
|
}
|
|
367
377
|
|
|
@@ -369,7 +379,7 @@ export default {
|
|
|
369
379
|
|
|
370
380
|
const active = this.getActive();
|
|
371
381
|
|
|
372
|
-
if (!active || active?.$el ===
|
|
382
|
+
if (!active || active?.$el === target) {
|
|
373
383
|
this.transitionTo(0);
|
|
374
384
|
}
|
|
375
385
|
},
|
|
@@ -378,7 +388,7 @@ export default {
|
|
|
378
388
|
|
|
379
389
|
methods: {
|
|
380
390
|
getActive() {
|
|
381
|
-
return active && within(active.
|
|
391
|
+
return active && within(active.targetEl, this.$el) && active;
|
|
382
392
|
},
|
|
383
393
|
|
|
384
394
|
transitionTo(newHeight, el) {
|
|
@@ -409,12 +419,16 @@ export default {
|
|
|
409
419
|
getDropdown(el) {
|
|
410
420
|
return this.$getComponent(el, 'drop') || this.$getComponent(el, 'dropdown');
|
|
411
421
|
},
|
|
422
|
+
|
|
423
|
+
isDropbarDrop(el) {
|
|
424
|
+
return this.getDropdown(el) && hasClass(el, this.clsDrop);
|
|
425
|
+
},
|
|
412
426
|
},
|
|
413
427
|
};
|
|
414
428
|
|
|
415
429
|
function handleNavItemNavigation(e, toggles, active) {
|
|
416
430
|
const { current, keyCode } = e;
|
|
417
|
-
const target = active?.
|
|
431
|
+
const target = active?.targetEl || current;
|
|
418
432
|
const i = toggles.indexOf(target);
|
|
419
433
|
|
|
420
434
|
// Left
|
package/src/js/core/scroll.js
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { $, scrollIntoView, trigger } from 'uikit-util';
|
|
1
|
+
import { $, off, on, scrollIntoView, trigger, within } from 'uikit-util';
|
|
2
2
|
|
|
3
3
|
export default {
|
|
4
4
|
props: {
|
|
@@ -9,6 +9,14 @@ export default {
|
|
|
9
9
|
offset: 0,
|
|
10
10
|
},
|
|
11
11
|
|
|
12
|
+
connected() {
|
|
13
|
+
registerClick(this);
|
|
14
|
+
},
|
|
15
|
+
|
|
16
|
+
disconnected() {
|
|
17
|
+
unregisterClick(this);
|
|
18
|
+
},
|
|
19
|
+
|
|
12
20
|
methods: {
|
|
13
21
|
async scrollTo(el) {
|
|
14
22
|
el = (el && $(el)) || document.body;
|
|
@@ -19,18 +27,37 @@ export default {
|
|
|
19
27
|
}
|
|
20
28
|
},
|
|
21
29
|
},
|
|
30
|
+
};
|
|
22
31
|
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
32
|
+
const components = new Set();
|
|
33
|
+
function registerClick(cmp) {
|
|
34
|
+
if (!components.size) {
|
|
35
|
+
on(document, 'click', clickHandler);
|
|
36
|
+
}
|
|
37
|
+
|
|
38
|
+
components.add(cmp);
|
|
39
|
+
}
|
|
28
40
|
|
|
41
|
+
function unregisterClick(cmp) {
|
|
42
|
+
components.delete(cmp);
|
|
43
|
+
|
|
44
|
+
if (!components.length) {
|
|
45
|
+
off(document, 'click', clickHandler);
|
|
46
|
+
}
|
|
47
|
+
}
|
|
48
|
+
|
|
49
|
+
function clickHandler(e) {
|
|
50
|
+
if (e.defaultPrevented) {
|
|
51
|
+
return;
|
|
52
|
+
}
|
|
53
|
+
|
|
54
|
+
for (const component of components) {
|
|
55
|
+
if (within(e.target, component.$el)) {
|
|
29
56
|
e.preventDefault();
|
|
30
|
-
|
|
31
|
-
}
|
|
32
|
-
}
|
|
33
|
-
}
|
|
57
|
+
component.scrollTo(getTargetElement(component.$el));
|
|
58
|
+
}
|
|
59
|
+
}
|
|
60
|
+
}
|
|
34
61
|
|
|
35
62
|
export function getTargetElement(el) {
|
|
36
63
|
return document.getElementById(decodeURIComponent(el.hash).substring(1));
|
package/src/js/core/sticky.js
CHANGED
|
@@ -23,7 +23,6 @@ import {
|
|
|
23
23
|
remove,
|
|
24
24
|
removeClass,
|
|
25
25
|
replaceClass,
|
|
26
|
-
scrollTop,
|
|
27
26
|
toFloat,
|
|
28
27
|
toggleClass,
|
|
29
28
|
toPx,
|
|
@@ -125,7 +124,9 @@ export default {
|
|
|
125
124
|
},
|
|
126
125
|
|
|
127
126
|
handler() {
|
|
128
|
-
|
|
127
|
+
const { scrollingElement } = document;
|
|
128
|
+
|
|
129
|
+
if (!location.hash || scrollingElement.scrollTop === 0) {
|
|
129
130
|
return;
|
|
130
131
|
}
|
|
131
132
|
|
|
@@ -134,13 +135,11 @@ export default {
|
|
|
134
135
|
const elOffset = getOffset(this.$el);
|
|
135
136
|
|
|
136
137
|
if (this.isFixed && intersectRect(targetOffset, elOffset)) {
|
|
137
|
-
scrollTop
|
|
138
|
-
window,
|
|
138
|
+
scrollingElement.scrollTop =
|
|
139
139
|
targetOffset.top -
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
);
|
|
140
|
+
elOffset.height -
|
|
141
|
+
toPx(this.targetOffset, 'height', this.placeholder) -
|
|
142
|
+
toPx(this.offset, 'height', this.placeholder);
|
|
144
143
|
}
|
|
145
144
|
});
|
|
146
145
|
},
|
|
@@ -238,7 +237,7 @@ export default {
|
|
|
238
237
|
start,
|
|
239
238
|
end,
|
|
240
239
|
}) {
|
|
241
|
-
const scroll = scrollTop
|
|
240
|
+
const scroll = document.scrollingElement.scrollTop;
|
|
242
241
|
const dir = prevScroll <= scroll ? 'down' : 'up';
|
|
243
242
|
|
|
244
243
|
return {
|
package/src/js/core/toggle.js
CHANGED
|
@@ -181,7 +181,7 @@ export default {
|
|
|
181
181
|
},
|
|
182
182
|
|
|
183
183
|
{
|
|
184
|
-
name: '
|
|
184
|
+
name: 'hide show',
|
|
185
185
|
|
|
186
186
|
self: true,
|
|
187
187
|
|
|
@@ -189,10 +189,8 @@ export default {
|
|
|
189
189
|
return this.target;
|
|
190
190
|
},
|
|
191
191
|
|
|
192
|
-
handler(
|
|
193
|
-
|
|
194
|
-
this.updateAria(toggled);
|
|
195
|
-
}
|
|
192
|
+
handler({ type }) {
|
|
193
|
+
this.updateAria(type === 'show');
|
|
196
194
|
},
|
|
197
195
|
},
|
|
198
196
|
|
package/src/js/mixin/media.js
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import {
|
|
2
2
|
createEvent,
|
|
3
|
-
|
|
3
|
+
css,
|
|
4
4
|
isNumeric,
|
|
5
5
|
isString,
|
|
6
6
|
on,
|
|
@@ -19,7 +19,7 @@ export default {
|
|
|
19
19
|
},
|
|
20
20
|
|
|
21
21
|
connected() {
|
|
22
|
-
const media = toMedia(this.media);
|
|
22
|
+
const media = toMedia(this.media, this.$el);
|
|
23
23
|
this.matchMedia = true;
|
|
24
24
|
if (media) {
|
|
25
25
|
this.mediaObj = window.matchMedia(media);
|
|
@@ -40,11 +40,10 @@ export default {
|
|
|
40
40
|
},
|
|
41
41
|
};
|
|
42
42
|
|
|
43
|
-
function toMedia(value) {
|
|
43
|
+
function toMedia(value, element) {
|
|
44
44
|
if (isString(value)) {
|
|
45
45
|
if (startsWith(value, '@')) {
|
|
46
|
-
|
|
47
|
-
value = toFloat(getCssVar(name));
|
|
46
|
+
value = toFloat(css(element, `--uk-breakpoint-${value.substr(1)}`));
|
|
48
47
|
} else if (isNaN(value)) {
|
|
49
48
|
return value;
|
|
50
49
|
}
|
package/src/js/mixin/modal.js
CHANGED
|
@@ -9,6 +9,7 @@ import {
|
|
|
9
9
|
includes,
|
|
10
10
|
isFocusable,
|
|
11
11
|
last,
|
|
12
|
+
noop,
|
|
12
13
|
on,
|
|
13
14
|
once,
|
|
14
15
|
parent,
|
|
@@ -127,15 +128,15 @@ export default {
|
|
|
127
128
|
this.$el,
|
|
128
129
|
'hide',
|
|
129
130
|
on(document, 'focusin', (e) => {
|
|
130
|
-
if (!within(e.target, this
|
|
131
|
+
if (last(active) === this && !within(e.target, this.$el)) {
|
|
131
132
|
this.$el.focus();
|
|
132
133
|
}
|
|
133
134
|
})
|
|
134
135
|
);
|
|
135
136
|
|
|
136
137
|
if (this.overlay) {
|
|
137
|
-
once(this.$el, '
|
|
138
|
-
once(this.$el, '
|
|
138
|
+
once(this.$el, 'hidden', preventOverscroll(this.$el), { self: true });
|
|
139
|
+
once(this.$el, 'hidden', preventBackgroundScroll(), { self: true });
|
|
139
140
|
}
|
|
140
141
|
|
|
141
142
|
if (this.stack) {
|
|
@@ -217,10 +218,6 @@ export default {
|
|
|
217
218
|
active.splice(active.indexOf(this), 1);
|
|
218
219
|
}
|
|
219
220
|
|
|
220
|
-
if (!active.length) {
|
|
221
|
-
css(document.body, 'overflowY', '');
|
|
222
|
-
}
|
|
223
|
-
|
|
224
221
|
css(this.$el, 'zIndex', '');
|
|
225
222
|
|
|
226
223
|
if (!active.some((modal) => modal.clsPage === this.clsPage)) {
|
|
@@ -337,7 +334,12 @@ export function preventOverscroll(el) {
|
|
|
337
334
|
return () => events.forEach((fn) => fn());
|
|
338
335
|
}
|
|
339
336
|
|
|
337
|
+
let prevented;
|
|
340
338
|
export function preventBackgroundScroll() {
|
|
339
|
+
if (prevented) {
|
|
340
|
+
return noop;
|
|
341
|
+
}
|
|
342
|
+
prevented = true;
|
|
341
343
|
const { body, documentElement } = document;
|
|
342
344
|
css(body, {
|
|
343
345
|
overflowY: width(window) > documentElement.clientWidth ? 'scroll' : '',
|
|
@@ -345,6 +347,7 @@ export function preventBackgroundScroll() {
|
|
|
345
347
|
});
|
|
346
348
|
css(documentElement, 'overflowY', 'hidden');
|
|
347
349
|
return () => {
|
|
350
|
+
prevented = false;
|
|
348
351
|
css(documentElement, 'overflowY', '');
|
|
349
352
|
css(body, { overflowY: '', touchAction: '' });
|
|
350
353
|
};
|
package/src/js/mixin/position.js
CHANGED
|
@@ -2,10 +2,10 @@ import {
|
|
|
2
2
|
css,
|
|
3
3
|
dimensions,
|
|
4
4
|
flipPosition,
|
|
5
|
-
getCssVar,
|
|
6
5
|
includes,
|
|
7
6
|
isRtl,
|
|
8
7
|
positionAt,
|
|
8
|
+
scrollParents,
|
|
9
9
|
toPx,
|
|
10
10
|
} from 'uikit-util';
|
|
11
11
|
|
|
@@ -14,12 +14,16 @@ export default {
|
|
|
14
14
|
pos: String,
|
|
15
15
|
offset: null,
|
|
16
16
|
flip: Boolean,
|
|
17
|
+
shift: Boolean,
|
|
18
|
+
inset: Boolean,
|
|
17
19
|
},
|
|
18
20
|
|
|
19
21
|
data: {
|
|
20
22
|
pos: `bottom-${isRtl ? 'right' : 'left'}`,
|
|
21
|
-
flip: true,
|
|
22
23
|
offset: false,
|
|
24
|
+
flip: true,
|
|
25
|
+
shift: true,
|
|
26
|
+
inset: false,
|
|
23
27
|
},
|
|
24
28
|
|
|
25
29
|
connected() {
|
|
@@ -31,19 +35,24 @@ export default {
|
|
|
31
35
|
methods: {
|
|
32
36
|
positionAt(element, target, boundary) {
|
|
33
37
|
let offset = [this.getPositionOffset(element), this.getShiftOffset(element)];
|
|
38
|
+
const placement = [this.flip && 'flip', this.shift && 'shift'];
|
|
34
39
|
|
|
35
40
|
const attach = {
|
|
36
|
-
element: [flipPosition(this.dir), this.align],
|
|
41
|
+
element: [this.inset ? this.dir : flipPosition(this.dir), this.align],
|
|
37
42
|
target: [this.dir, this.align],
|
|
38
43
|
};
|
|
39
44
|
|
|
40
45
|
if (this.axis === 'y') {
|
|
41
46
|
for (const prop in attach) {
|
|
42
|
-
attach[prop]
|
|
47
|
+
attach[prop].reverse();
|
|
43
48
|
}
|
|
44
|
-
offset
|
|
49
|
+
offset.reverse();
|
|
50
|
+
placement.reverse();
|
|
45
51
|
}
|
|
46
52
|
|
|
53
|
+
const [scrollElement] = scrollParents(element, /auto|scroll/);
|
|
54
|
+
const { scrollTop, scrollLeft } = scrollElement;
|
|
55
|
+
|
|
47
56
|
// Ensure none positioned element does not generate scrollbars
|
|
48
57
|
const elDim = dimensions(element);
|
|
49
58
|
css(element, { top: -elDim.height, left: -elDim.width });
|
|
@@ -52,33 +61,39 @@ export default {
|
|
|
52
61
|
attach,
|
|
53
62
|
offset,
|
|
54
63
|
boundary,
|
|
55
|
-
|
|
64
|
+
placement,
|
|
56
65
|
viewportOffset: this.getViewportOffset(element),
|
|
57
66
|
});
|
|
67
|
+
|
|
68
|
+
// Restore scroll position
|
|
69
|
+
scrollElement.scrollTop = scrollTop;
|
|
70
|
+
scrollElement.scrollLeft = scrollLeft;
|
|
58
71
|
},
|
|
59
72
|
|
|
60
73
|
getPositionOffset(element) {
|
|
61
74
|
return (
|
|
62
75
|
toPx(
|
|
63
|
-
this.offset === false ?
|
|
76
|
+
this.offset === false ? css(element, '--uk-position-offset') : this.offset,
|
|
64
77
|
this.axis === 'x' ? 'width' : 'height',
|
|
65
78
|
element
|
|
66
|
-
) *
|
|
79
|
+
) *
|
|
80
|
+
(includes(['left', 'top'], this.dir) ? -1 : 1) *
|
|
81
|
+
(this.inset ? -1 : 1)
|
|
67
82
|
);
|
|
68
83
|
},
|
|
69
84
|
|
|
70
85
|
getShiftOffset(element) {
|
|
71
|
-
return
|
|
86
|
+
return this.align === 'center'
|
|
72
87
|
? 0
|
|
73
88
|
: toPx(
|
|
74
|
-
|
|
89
|
+
css(element, '--uk-position-shift-offset'),
|
|
75
90
|
this.axis === 'y' ? 'width' : 'height',
|
|
76
91
|
element
|
|
77
92
|
) * (includes(['left', 'top'], this.align) ? 1 : -1);
|
|
78
93
|
},
|
|
79
94
|
|
|
80
95
|
getViewportOffset(element) {
|
|
81
|
-
return toPx(
|
|
96
|
+
return toPx(css(element, '--uk-position-viewport-offset'));
|
|
82
97
|
},
|
|
83
98
|
},
|
|
84
99
|
};
|
|
@@ -5,16 +5,18 @@ import {
|
|
|
5
5
|
includes,
|
|
6
6
|
isRtl,
|
|
7
7
|
isTouch,
|
|
8
|
+
noop,
|
|
8
9
|
off,
|
|
9
10
|
on,
|
|
10
|
-
pointerCancel,
|
|
11
|
-
pointerDown,
|
|
12
|
-
pointerMove,
|
|
13
|
-
pointerUp,
|
|
14
11
|
selInput,
|
|
15
12
|
trigger,
|
|
16
13
|
} from 'uikit-util';
|
|
17
14
|
|
|
15
|
+
const pointerOptions = { passive: false, capture: true };
|
|
16
|
+
const pointerDown = 'touchstart mousedown';
|
|
17
|
+
const pointerMove = 'touchmove mousemove';
|
|
18
|
+
const pointerUp = 'touchend touchcancel mouseup click input';
|
|
19
|
+
|
|
18
20
|
export default {
|
|
19
21
|
props: {
|
|
20
22
|
draggable: Boolean,
|
|
@@ -69,6 +71,16 @@ export default {
|
|
|
69
71
|
e.preventDefault();
|
|
70
72
|
},
|
|
71
73
|
},
|
|
74
|
+
|
|
75
|
+
{
|
|
76
|
+
// iOS workaround for slider stopping if swiping fast
|
|
77
|
+
name: `${pointerMove} ${pointerUp}`,
|
|
78
|
+
el() {
|
|
79
|
+
return this.list;
|
|
80
|
+
},
|
|
81
|
+
handler: noop,
|
|
82
|
+
...pointerOptions,
|
|
83
|
+
},
|
|
72
84
|
],
|
|
73
85
|
|
|
74
86
|
methods: {
|
|
@@ -89,10 +101,10 @@ export default {
|
|
|
89
101
|
this.prevIndex = this.index;
|
|
90
102
|
}
|
|
91
103
|
|
|
92
|
-
on(document, pointerMove, this.move,
|
|
104
|
+
on(document, pointerMove, this.move, pointerOptions);
|
|
93
105
|
|
|
94
106
|
// 'input' event is triggered by video controls
|
|
95
|
-
on(document,
|
|
107
|
+
on(document, pointerUp, this.end, pointerOptions);
|
|
96
108
|
|
|
97
109
|
css(this.list, 'userSelect', 'none');
|
|
98
110
|
},
|
|
@@ -172,8 +184,8 @@ export default {
|
|
|
172
184
|
},
|
|
173
185
|
|
|
174
186
|
end() {
|
|
175
|
-
off(document, pointerMove, this.move,
|
|
176
|
-
off(document,
|
|
187
|
+
off(document, pointerMove, this.move, pointerOptions);
|
|
188
|
+
off(document, pointerUp, this.end, pointerOptions);
|
|
177
189
|
|
|
178
190
|
if (this.dragging) {
|
|
179
191
|
this.dragging = null;
|