uikit 3.11.2-dev.c2430c233 → 3.11.2-dev.c7ed3c19b
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/.eslintrc.json +4 -49
- package/.prettierignore +14 -0
- package/.prettierrc.json +13 -0
- package/.webstorm.js +3 -3
- package/CHANGELOG.md +5 -0
- package/build/.eslintrc.json +1 -3
- package/build/build.js +26 -28
- package/build/icons.js +7 -11
- package/build/less.js +48 -36
- package/build/package.json +2 -2
- package/build/prefix.js +21 -18
- package/build/publishDev.js +6 -8
- package/build/release.js +20 -17
- package/build/scope.js +21 -11
- package/build/scss.js +72 -39
- package/build/util.js +71 -62
- package/build/wrapper/icons.js +0 -2
- package/dist/css/uikit-core-rtl.css +1 -1
- package/dist/css/uikit-core-rtl.min.css +1 -1
- package/dist/css/uikit-core.css +1 -1
- package/dist/css/uikit-core.min.css +1 -1
- package/dist/css/uikit-rtl.css +1 -1
- package/dist/css/uikit-rtl.min.css +1 -1
- package/dist/css/uikit.css +1 -1
- package/dist/css/uikit.min.css +1 -1
- package/dist/js/components/countdown.js +88 -133
- package/dist/js/components/countdown.min.js +1 -1
- package/dist/js/components/filter.js +409 -438
- package/dist/js/components/filter.min.js +1 -1
- package/dist/js/components/lightbox-panel.js +1116 -1305
- package/dist/js/components/lightbox-panel.min.js +1 -1
- package/dist/js/components/lightbox.js +1164 -1383
- package/dist/js/components/lightbox.min.js +1 -1
- package/dist/js/components/notification.js +94 -114
- package/dist/js/components/notification.min.js +1 -1
- package/dist/js/components/parallax.js +294 -345
- package/dist/js/components/parallax.min.js +1 -1
- package/dist/js/components/slider-parallax.js +292 -344
- package/dist/js/components/slider-parallax.min.js +1 -1
- package/dist/js/components/slider.js +727 -850
- package/dist/js/components/slider.min.js +1 -1
- package/dist/js/components/slideshow-parallax.js +292 -344
- package/dist/js/components/slideshow-parallax.min.js +1 -1
- package/dist/js/components/slideshow.js +615 -799
- package/dist/js/components/slideshow.min.js +1 -1
- package/dist/js/components/sortable.js +588 -619
- package/dist/js/components/sortable.min.js +1 -1
- package/dist/js/components/tooltip.js +324 -356
- package/dist/js/components/tooltip.min.js +1 -1
- package/dist/js/components/upload.js +155 -167
- package/dist/js/components/upload.min.js +1 -1
- package/dist/js/uikit-core.js +5356 -6705
- package/dist/js/uikit-core.min.js +1 -1
- package/dist/js/uikit-icons.js +7 -9
- package/dist/js/uikit-icons.min.js +1 -1
- package/dist/js/uikit.js +8116 -9909
- package/dist/js/uikit.min.js +1 -1
- package/jsconfig.json +1 -1
- package/package.json +64 -60
- package/src/js/api/boot.js +25 -32
- package/src/js/api/component.js +23 -27
- package/src/js/api/global.js +6 -12
- package/src/js/api/hooks.js +13 -32
- package/src/js/api/instance.js +7 -15
- package/src/js/api/state.js +65 -82
- package/src/js/components/countdown.js +24 -50
- package/src/js/components/filter.js +71 -66
- package/src/js/components/index.js +13 -13
- package/src/js/components/internal/lightbox-animations.js +11 -23
- package/src/js/components/internal/slider-transitioner.js +66 -45
- package/src/js/components/internal/slideshow-animations.js +42 -61
- package/src/js/components/lightbox-panel.js +135 -109
- package/src/js/components/lightbox.js +18 -39
- package/src/js/components/notification.js +49 -43
- package/src/js/components/parallax.js +16 -30
- package/src/js/components/slider-parallax.js +13 -23
- package/src/js/components/slider.js +75 -64
- package/src/js/components/slideshow-parallax.js +1 -1
- package/src/js/components/slideshow.js +8 -13
- package/src/js/components/sortable.js +125 -106
- package/src/js/components/tooltip.js +41 -31
- package/src/js/components/upload.js +52 -63
- package/src/js/core/accordion.js +53 -48
- package/src/js/core/alert.js +10 -17
- package/src/js/core/core.js +74 -53
- package/src/js/core/cover.js +11 -15
- package/src/js/core/drop.js +106 -92
- package/src/js/core/form-custom.js +20 -25
- package/src/js/core/gif.js +3 -7
- package/src/js/core/grid.js +57 -58
- package/src/js/core/height-match.js +16 -29
- package/src/js/core/height-viewport.js +28 -35
- package/src/js/core/icon.js +38 -50
- package/src/js/core/img.js +59 -58
- package/src/js/core/index.js +39 -39
- package/src/js/core/leader.js +9 -18
- package/src/js/core/margin.js +21 -37
- package/src/js/core/modal.js +50 -36
- package/src/js/core/nav.js +2 -4
- package/src/js/core/navbar.js +112 -88
- package/src/js/core/offcanvas.js +49 -53
- package/src/js/core/overflow-auto.js +13 -17
- package/src/js/core/responsive.js +14 -12
- package/src/js/core/scroll.js +10 -20
- package/src/js/core/scrollspy-nav.js +34 -31
- package/src/js/core/scrollspy.js +37 -54
- package/src/js/core/sticky.js +130 -91
- package/src/js/core/svg.js +60 -79
- package/src/js/core/switcher.js +47 -46
- package/src/js/core/tab.js +7 -10
- package/src/js/core/toggle.js +64 -66
- package/src/js/core/video.js +11 -22
- package/src/js/mixin/animate.js +19 -20
- package/src/js/mixin/class.js +2 -4
- package/src/js/mixin/container.js +7 -11
- package/src/js/mixin/internal/animate-fade.js +73 -30
- package/src/js/mixin/internal/animate-slide.js +61 -41
- package/src/js/mixin/internal/slideshow-animations.js +7 -14
- package/src/js/mixin/internal/slideshow-transitioner.js +10 -17
- package/src/js/mixin/media.js +5 -10
- package/src/js/mixin/modal.js +89 -66
- package/src/js/mixin/parallax.js +53 -48
- package/src/js/mixin/position.js +26 -20
- package/src/js/mixin/slider-autoplay.js +12 -21
- package/src/js/mixin/slider-drag.js +64 -65
- package/src/js/mixin/slider-nav.js +26 -35
- package/src/js/mixin/slider-reactive.js +2 -8
- package/src/js/mixin/slider.js +51 -50
- package/src/js/mixin/slideshow.js +13 -19
- package/src/js/mixin/togglable.js +90 -63
- package/src/js/uikit-core.js +2 -4
- package/src/js/uikit.js +2 -4
- package/src/js/util/ajax.js +27 -43
- package/src/js/util/animation.js +82 -75
- package/src/js/util/attr.js +17 -21
- package/src/js/util/class.js +14 -52
- package/src/js/util/dimensions.js +56 -43
- package/src/js/util/dom.js +40 -73
- package/src/js/util/env.js +7 -12
- package/src/js/util/event.js +60 -59
- package/src/js/util/fastdom.js +1 -6
- package/src/js/util/filter.js +17 -34
- package/src/js/util/index.js +0 -1
- package/src/js/util/lang.js +79 -119
- package/src/js/util/mouse.js +19 -17
- package/src/js/util/options.js +44 -49
- package/src/js/util/player.js +40 -36
- package/src/js/util/position.js +54 -46
- package/src/js/util/selector.js +34 -49
- package/src/js/util/style.js +36 -46
- package/src/js/util/viewport.js +75 -64
- package/tests/js/index.js +114 -85
- package/src/js/mixin/flex-bug.js +0 -56
- package/src/js/util/promise.js +0 -191
|
@@ -1,14 +1,25 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import {
|
|
2
|
+
assign,
|
|
3
|
+
children,
|
|
4
|
+
css,
|
|
5
|
+
fastdom,
|
|
6
|
+
includes,
|
|
7
|
+
index,
|
|
8
|
+
isVisible,
|
|
9
|
+
noop,
|
|
10
|
+
offset,
|
|
11
|
+
parent,
|
|
12
|
+
position,
|
|
13
|
+
Transition,
|
|
14
|
+
} from 'uikit-util';
|
|
2
15
|
|
|
3
16
|
export default function (action, target, duration) {
|
|
4
|
-
|
|
5
|
-
return new Promise(resolve =>
|
|
17
|
+
return new Promise((resolve) =>
|
|
6
18
|
requestAnimationFrame(() => {
|
|
7
|
-
|
|
8
19
|
let nodes = children(target);
|
|
9
20
|
|
|
10
21
|
// Get current state
|
|
11
|
-
const currentProps = nodes.map(el => getProps(el, true));
|
|
22
|
+
const currentProps = nodes.map((el) => getProps(el, true));
|
|
12
23
|
const targetProps = css(target, ['height', 'padding']);
|
|
13
24
|
|
|
14
25
|
// Cancel previous animations
|
|
@@ -20,11 +31,10 @@ export default function (action, target, duration) {
|
|
|
20
31
|
action();
|
|
21
32
|
|
|
22
33
|
// Find new nodes
|
|
23
|
-
nodes = nodes.concat(children(target).filter(el => !includes(nodes, el)));
|
|
34
|
+
nodes = nodes.concat(children(target).filter((el) => !includes(nodes, el)));
|
|
24
35
|
|
|
25
36
|
// Wait for update to propagate
|
|
26
37
|
Promise.resolve().then(() => {
|
|
27
|
-
|
|
28
38
|
// Force update
|
|
29
39
|
fastdom.flush();
|
|
30
40
|
|
|
@@ -34,53 +44,63 @@ export default function (action, target, duration) {
|
|
|
34
44
|
|
|
35
45
|
// Reset to previous state
|
|
36
46
|
nodes.forEach((el, i) => propsFrom[i] && css(el, propsFrom[i]));
|
|
37
|
-
css(target, assign({display: 'block'}, targetProps));
|
|
47
|
+
css(target, assign({ display: 'block' }, targetProps));
|
|
38
48
|
|
|
39
49
|
// Start transitions on next frame
|
|
40
50
|
requestAnimationFrame(() => {
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
+
const transitions = nodes
|
|
52
|
+
.map(
|
|
53
|
+
(el, i) =>
|
|
54
|
+
parent(el) === target &&
|
|
55
|
+
Transition.start(el, propsTo[i], duration, 'ease')
|
|
56
|
+
)
|
|
57
|
+
.concat(Transition.start(target, targetPropsTo, duration, 'ease'));
|
|
58
|
+
|
|
59
|
+
Promise.all(transitions)
|
|
60
|
+
.then(() => {
|
|
61
|
+
nodes.forEach(
|
|
62
|
+
(el, i) =>
|
|
63
|
+
parent(el) === target &&
|
|
64
|
+
css(el, 'display', propsTo[i].opacity === 0 ? 'none' : '')
|
|
65
|
+
);
|
|
66
|
+
reset(target);
|
|
67
|
+
}, noop)
|
|
68
|
+
.then(resolve);
|
|
51
69
|
});
|
|
52
70
|
});
|
|
53
|
-
})
|
|
71
|
+
})
|
|
72
|
+
);
|
|
54
73
|
}
|
|
55
74
|
|
|
56
75
|
function getProps(el, opacity) {
|
|
57
|
-
|
|
58
76
|
const zIndex = css(el, 'zIndex');
|
|
59
77
|
|
|
60
78
|
return isVisible(el)
|
|
61
|
-
? assign(
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
79
|
+
? assign(
|
|
80
|
+
{
|
|
81
|
+
display: '',
|
|
82
|
+
opacity: opacity ? css(el, 'opacity') : '0',
|
|
83
|
+
pointerEvents: 'none',
|
|
84
|
+
position: 'absolute',
|
|
85
|
+
zIndex: zIndex === 'auto' ? index(el) : zIndex,
|
|
86
|
+
},
|
|
87
|
+
getPositionWithMargin(el)
|
|
88
|
+
)
|
|
68
89
|
: false;
|
|
69
90
|
}
|
|
70
91
|
|
|
71
92
|
function getTransitionProps(target, nodes, currentProps) {
|
|
72
|
-
|
|
73
93
|
const propsTo = nodes.map((el, i) =>
|
|
74
94
|
parent(el) && i in currentProps
|
|
75
95
|
? currentProps[i]
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
: false
|
|
96
|
+
? isVisible(el)
|
|
97
|
+
? getPositionWithMargin(el)
|
|
98
|
+
: { opacity: 0 }
|
|
99
|
+
: { opacity: isVisible(el) ? 1 : 0 }
|
|
100
|
+
: false
|
|
101
|
+
);
|
|
81
102
|
|
|
82
103
|
const propsFrom = propsTo.map((props, i) => {
|
|
83
|
-
|
|
84
104
|
const from = parent(nodes[i]) === target && (currentProps[i] || getProps(nodes[i]));
|
|
85
105
|
|
|
86
106
|
if (!from) {
|
|
@@ -90,7 +110,7 @@ function getTransitionProps(target, nodes, currentProps) {
|
|
|
90
110
|
if (!props) {
|
|
91
111
|
delete from.opacity;
|
|
92
112
|
} else if (!('opacity' in props)) {
|
|
93
|
-
const {opacity} = from;
|
|
113
|
+
const { opacity } = from;
|
|
94
114
|
|
|
95
115
|
if (opacity % 1) {
|
|
96
116
|
props.opacity = 1;
|
|
@@ -117,15 +137,15 @@ function reset(el) {
|
|
|
117
137
|
marginLeft: '',
|
|
118
138
|
transform: '',
|
|
119
139
|
width: '',
|
|
120
|
-
zIndex: ''
|
|
140
|
+
zIndex: '',
|
|
121
141
|
});
|
|
122
|
-
css(el, {height: '', display: '', padding: ''});
|
|
142
|
+
css(el, { height: '', display: '', padding: '' });
|
|
123
143
|
}
|
|
124
144
|
|
|
125
145
|
function getPositionWithMargin(el) {
|
|
126
|
-
const {height, width} = offset(el);
|
|
127
|
-
const {top, left} = position(el);
|
|
128
|
-
const {marginLeft, marginTop} = css(el, ['marginTop', 'marginLeft']);
|
|
146
|
+
const { height, width } = offset(el);
|
|
147
|
+
const { top, left } = position(el);
|
|
148
|
+
const { marginLeft, marginTop } = css(el, ['marginTop', 'marginLeft']);
|
|
129
149
|
|
|
130
|
-
return {top, left, height, width, marginLeft, marginTop, transform: ''};
|
|
150
|
+
return { top, left, height, width, marginLeft, marginTop, transform: '' };
|
|
131
151
|
}
|
|
@@ -1,14 +1,9 @@
|
|
|
1
|
-
import {css
|
|
1
|
+
import { css } from 'uikit-util';
|
|
2
2
|
|
|
3
3
|
export default {
|
|
4
|
-
|
|
5
4
|
slide: {
|
|
6
|
-
|
|
7
5
|
show(dir) {
|
|
8
|
-
return [
|
|
9
|
-
{transform: translate(dir * -100)},
|
|
10
|
-
{transform: translate()}
|
|
11
|
-
];
|
|
6
|
+
return [{ transform: translate(dir * -100) }, { transform: translate() }];
|
|
12
7
|
},
|
|
13
8
|
|
|
14
9
|
percent(current) {
|
|
@@ -17,13 +12,11 @@ export default {
|
|
|
17
12
|
|
|
18
13
|
translate(percent, dir) {
|
|
19
14
|
return [
|
|
20
|
-
{transform: translate(dir * -100 * percent)},
|
|
21
|
-
{transform: translate(dir * 100 * (1 - percent))}
|
|
15
|
+
{ transform: translate(dir * -100 * percent) },
|
|
16
|
+
{ transform: translate(dir * 100 * (1 - percent)) },
|
|
22
17
|
];
|
|
23
|
-
}
|
|
24
|
-
|
|
25
|
-
}
|
|
26
|
-
|
|
18
|
+
},
|
|
19
|
+
},
|
|
27
20
|
};
|
|
28
21
|
|
|
29
22
|
export function translated(el) {
|
|
@@ -32,7 +25,7 @@ export function translated(el) {
|
|
|
32
25
|
|
|
33
26
|
export function translate(value = 0, unit = '%') {
|
|
34
27
|
value += value ? unit : '';
|
|
35
|
-
return
|
|
28
|
+
return `translate3d(${value}, 0, 0)`;
|
|
36
29
|
}
|
|
37
30
|
|
|
38
31
|
export function scale3d(value) {
|
|
@@ -1,28 +1,25 @@
|
|
|
1
|
-
import {clamp, createEvent, css, Deferred, noop,
|
|
1
|
+
import { clamp, createEvent, css, Deferred, noop, Transition, trigger } from 'uikit-util';
|
|
2
2
|
|
|
3
|
-
export default function Transitioner(prev, next, dir, {animation, easing}) {
|
|
4
|
-
|
|
5
|
-
const {percent, translate, show = noop} = animation;
|
|
3
|
+
export default function Transitioner(prev, next, dir, { animation, easing }) {
|
|
4
|
+
const { percent, translate, show = noop } = animation;
|
|
6
5
|
const props = show(dir);
|
|
7
6
|
const deferred = new Deferred();
|
|
8
7
|
|
|
9
8
|
return {
|
|
10
|
-
|
|
11
9
|
dir,
|
|
12
10
|
|
|
13
11
|
show(duration, percent = 0, linear) {
|
|
14
|
-
|
|
15
12
|
const timing = linear ? 'linear' : easing;
|
|
16
13
|
duration -= Math.round(duration * clamp(percent, -1, 1));
|
|
17
14
|
|
|
18
15
|
this.translate(percent);
|
|
19
16
|
|
|
20
|
-
triggerUpdate(next, 'itemin', {percent, duration, timing, dir});
|
|
21
|
-
triggerUpdate(prev, 'itemout', {percent: 1 - percent, duration, timing, dir});
|
|
17
|
+
triggerUpdate(next, 'itemin', { percent, duration, timing, dir });
|
|
18
|
+
triggerUpdate(prev, 'itemout', { percent: 1 - percent, duration, timing, dir });
|
|
22
19
|
|
|
23
20
|
Promise.all([
|
|
24
21
|
Transition.start(next, props[1], duration, timing),
|
|
25
|
-
Transition.start(prev, props[0], duration, timing)
|
|
22
|
+
Transition.start(prev, props[0], duration, timing),
|
|
26
23
|
]).then(() => {
|
|
27
24
|
this.reset();
|
|
28
25
|
deferred.resolve();
|
|
@@ -47,15 +44,13 @@ export default function Transitioner(prev, next, dir, {animation, easing}) {
|
|
|
47
44
|
},
|
|
48
45
|
|
|
49
46
|
translate(percent) {
|
|
50
|
-
|
|
51
47
|
this.reset();
|
|
52
48
|
|
|
53
49
|
const props = translate(percent, dir);
|
|
54
50
|
css(next, props[1]);
|
|
55
51
|
css(prev, props[0]);
|
|
56
|
-
triggerUpdate(next, 'itemtranslatein', {percent, dir});
|
|
57
|
-
triggerUpdate(prev, 'itemtranslateout', {percent: 1 - percent, dir});
|
|
58
|
-
|
|
52
|
+
triggerUpdate(next, 'itemtranslatein', { percent, dir });
|
|
53
|
+
triggerUpdate(prev, 'itemtranslateout', { percent: 1 - percent, dir });
|
|
59
54
|
},
|
|
60
55
|
|
|
61
56
|
percent() {
|
|
@@ -63,11 +58,9 @@ export default function Transitioner(prev, next, dir, {animation, easing}) {
|
|
|
63
58
|
},
|
|
64
59
|
|
|
65
60
|
getDistance() {
|
|
66
|
-
return prev
|
|
67
|
-
}
|
|
68
|
-
|
|
61
|
+
return prev?.offsetWidth;
|
|
62
|
+
},
|
|
69
63
|
};
|
|
70
|
-
|
|
71
64
|
}
|
|
72
65
|
|
|
73
66
|
function triggerUpdate(el, type, data) {
|
package/src/js/mixin/media.js
CHANGED
|
@@ -1,28 +1,23 @@
|
|
|
1
|
-
import {getCssVar, isString, toFloat} from 'uikit-util';
|
|
1
|
+
import { getCssVar, isString, toFloat } from 'uikit-util';
|
|
2
2
|
|
|
3
3
|
export default {
|
|
4
|
-
|
|
5
4
|
props: {
|
|
6
|
-
media: Boolean
|
|
5
|
+
media: Boolean,
|
|
7
6
|
},
|
|
8
7
|
|
|
9
8
|
data: {
|
|
10
|
-
media: false
|
|
9
|
+
media: false,
|
|
11
10
|
},
|
|
12
11
|
|
|
13
12
|
computed: {
|
|
14
|
-
|
|
15
13
|
matchMedia() {
|
|
16
14
|
const media = toMedia(this.media);
|
|
17
15
|
return !media || window.matchMedia(media).matches;
|
|
18
|
-
}
|
|
19
|
-
|
|
20
|
-
}
|
|
21
|
-
|
|
16
|
+
},
|
|
17
|
+
},
|
|
22
18
|
};
|
|
23
19
|
|
|
24
20
|
function toMedia(value) {
|
|
25
|
-
|
|
26
21
|
if (isString(value)) {
|
|
27
22
|
if (value[0] === '@') {
|
|
28
23
|
const name = `breakpoint-${value.substr(1)}`;
|
package/src/js/mixin/modal.js
CHANGED
|
@@ -1,4 +1,24 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import {
|
|
2
|
+
$,
|
|
3
|
+
addClass,
|
|
4
|
+
append,
|
|
5
|
+
attr,
|
|
6
|
+
css,
|
|
7
|
+
includes,
|
|
8
|
+
isFocusable,
|
|
9
|
+
last,
|
|
10
|
+
on,
|
|
11
|
+
once,
|
|
12
|
+
parent,
|
|
13
|
+
pointerCancel,
|
|
14
|
+
pointerDown,
|
|
15
|
+
pointerUp,
|
|
16
|
+
removeClass,
|
|
17
|
+
toFloat,
|
|
18
|
+
toMs,
|
|
19
|
+
width,
|
|
20
|
+
within,
|
|
21
|
+
} from 'uikit-util';
|
|
2
22
|
import Class from './class';
|
|
3
23
|
import Container from './container';
|
|
4
24
|
import Togglable from './togglable';
|
|
@@ -6,7 +26,6 @@ import Togglable from './togglable';
|
|
|
6
26
|
const active = [];
|
|
7
27
|
|
|
8
28
|
export default {
|
|
9
|
-
|
|
10
29
|
mixins: [Class, Container, Togglable],
|
|
11
30
|
|
|
12
31
|
props: {
|
|
@@ -14,7 +33,7 @@ export default {
|
|
|
14
33
|
selClose: String,
|
|
15
34
|
escClose: Boolean,
|
|
16
35
|
bgClose: Boolean,
|
|
17
|
-
stack: Boolean
|
|
36
|
+
stack: Boolean,
|
|
18
37
|
},
|
|
19
38
|
|
|
20
39
|
data: {
|
|
@@ -22,12 +41,11 @@ export default {
|
|
|
22
41
|
escClose: true,
|
|
23
42
|
bgClose: true,
|
|
24
43
|
overlay: true,
|
|
25
|
-
stack: false
|
|
44
|
+
stack: false,
|
|
26
45
|
},
|
|
27
46
|
|
|
28
47
|
computed: {
|
|
29
|
-
|
|
30
|
-
panel({selPanel}, $el) {
|
|
48
|
+
panel({ selPanel }, $el) {
|
|
31
49
|
return $(selPanel, $el);
|
|
32
50
|
},
|
|
33
51
|
|
|
@@ -35,10 +53,9 @@ export default {
|
|
|
35
53
|
return this.panel;
|
|
36
54
|
},
|
|
37
55
|
|
|
38
|
-
bgClose({bgClose}) {
|
|
56
|
+
bgClose({ bgClose }) {
|
|
39
57
|
return bgClose && this.panel;
|
|
40
|
-
}
|
|
41
|
-
|
|
58
|
+
},
|
|
42
59
|
},
|
|
43
60
|
|
|
44
61
|
beforeDisconnect() {
|
|
@@ -48,9 +65,7 @@ export default {
|
|
|
48
65
|
},
|
|
49
66
|
|
|
50
67
|
events: [
|
|
51
|
-
|
|
52
68
|
{
|
|
53
|
-
|
|
54
69
|
name: 'click',
|
|
55
70
|
|
|
56
71
|
delegate() {
|
|
@@ -60,18 +75,15 @@ export default {
|
|
|
60
75
|
handler(e) {
|
|
61
76
|
e.preventDefault();
|
|
62
77
|
this.hide();
|
|
63
|
-
}
|
|
64
|
-
|
|
78
|
+
},
|
|
65
79
|
},
|
|
66
80
|
|
|
67
81
|
{
|
|
68
|
-
|
|
69
82
|
name: 'toggle',
|
|
70
83
|
|
|
71
84
|
self: true,
|
|
72
85
|
|
|
73
|
-
handler(e
|
|
74
|
-
|
|
86
|
+
handler(e) {
|
|
75
87
|
if (e.defaultPrevented) {
|
|
76
88
|
return;
|
|
77
89
|
}
|
|
@@ -81,8 +93,7 @@ export default {
|
|
|
81
93
|
if (this.isToggled() === includes(active, this)) {
|
|
82
94
|
this.toggle();
|
|
83
95
|
}
|
|
84
|
-
}
|
|
85
|
-
|
|
96
|
+
},
|
|
86
97
|
},
|
|
87
98
|
|
|
88
99
|
{
|
|
@@ -91,29 +102,25 @@ export default {
|
|
|
91
102
|
self: true,
|
|
92
103
|
|
|
93
104
|
handler(e) {
|
|
94
|
-
|
|
95
105
|
if (includes(active, this)) {
|
|
96
106
|
return false;
|
|
97
107
|
}
|
|
98
108
|
|
|
99
109
|
if (!this.stack && active.length) {
|
|
100
|
-
Promise.all(active.map(modal => modal.hide())).then(this.show);
|
|
110
|
+
Promise.all(active.map((modal) => modal.hide())).then(this.show);
|
|
101
111
|
e.preventDefault();
|
|
102
112
|
} else {
|
|
103
113
|
active.push(this);
|
|
104
114
|
}
|
|
105
|
-
}
|
|
106
|
-
|
|
115
|
+
},
|
|
107
116
|
},
|
|
108
117
|
|
|
109
118
|
{
|
|
110
|
-
|
|
111
119
|
name: 'show',
|
|
112
120
|
|
|
113
121
|
self: true,
|
|
114
122
|
|
|
115
123
|
handler() {
|
|
116
|
-
|
|
117
124
|
const docEl = document.documentElement;
|
|
118
125
|
|
|
119
126
|
if (width(window) > docEl.clientWidth && this.overlay) {
|
|
@@ -127,30 +134,50 @@ export default {
|
|
|
127
134
|
addClass(docEl, this.clsPage);
|
|
128
135
|
|
|
129
136
|
if (this.bgClose) {
|
|
130
|
-
once(
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
|
|
137
|
+
once(
|
|
138
|
+
this.$el,
|
|
139
|
+
'hide',
|
|
140
|
+
on(document, pointerDown, ({ target }) => {
|
|
141
|
+
if (
|
|
142
|
+
last(active) !== this ||
|
|
143
|
+
(this.overlay && !within(target, this.$el)) ||
|
|
144
|
+
within(target, this.panel)
|
|
145
|
+
) {
|
|
146
|
+
return;
|
|
139
147
|
}
|
|
140
|
-
}, true);
|
|
141
148
|
|
|
142
|
-
|
|
149
|
+
once(
|
|
150
|
+
document,
|
|
151
|
+
`${pointerUp} ${pointerCancel} scroll`,
|
|
152
|
+
({ defaultPrevented, type, target: newTarget }) => {
|
|
153
|
+
if (
|
|
154
|
+
!defaultPrevented &&
|
|
155
|
+
type === pointerUp &&
|
|
156
|
+
target === newTarget
|
|
157
|
+
) {
|
|
158
|
+
this.hide();
|
|
159
|
+
}
|
|
160
|
+
},
|
|
161
|
+
true
|
|
162
|
+
);
|
|
163
|
+
}),
|
|
164
|
+
{ self: true }
|
|
165
|
+
);
|
|
143
166
|
}
|
|
144
167
|
|
|
145
168
|
if (this.escClose) {
|
|
146
|
-
once(
|
|
147
|
-
|
|
148
|
-
|
|
149
|
-
|
|
150
|
-
|
|
169
|
+
once(
|
|
170
|
+
this.$el,
|
|
171
|
+
'hide',
|
|
172
|
+
on(document, 'keydown', (e) => {
|
|
173
|
+
if (e.keyCode === 27 && last(active) === this) {
|
|
174
|
+
this.hide();
|
|
175
|
+
}
|
|
176
|
+
}),
|
|
177
|
+
{ self: true }
|
|
178
|
+
);
|
|
151
179
|
}
|
|
152
|
-
}
|
|
153
|
-
|
|
180
|
+
},
|
|
154
181
|
},
|
|
155
182
|
|
|
156
183
|
{
|
|
@@ -166,17 +193,15 @@ export default {
|
|
|
166
193
|
if (!$(':focus', this.$el)) {
|
|
167
194
|
this.$el.focus();
|
|
168
195
|
}
|
|
169
|
-
}
|
|
196
|
+
},
|
|
170
197
|
},
|
|
171
198
|
|
|
172
199
|
{
|
|
173
|
-
|
|
174
200
|
name: 'hidden',
|
|
175
201
|
|
|
176
202
|
self: true,
|
|
177
203
|
|
|
178
204
|
handler() {
|
|
179
|
-
|
|
180
205
|
if (includes(active, this)) {
|
|
181
206
|
active.splice(active.indexOf(this), 1);
|
|
182
207
|
}
|
|
@@ -187,18 +212,14 @@ export default {
|
|
|
187
212
|
|
|
188
213
|
css(this.$el, 'zIndex', '');
|
|
189
214
|
|
|
190
|
-
if (!active.some(modal => modal.clsPage === this.clsPage)) {
|
|
215
|
+
if (!active.some((modal) => modal.clsPage === this.clsPage)) {
|
|
191
216
|
removeClass(document.documentElement, this.clsPage);
|
|
192
217
|
}
|
|
193
|
-
|
|
194
|
-
|
|
195
|
-
|
|
196
|
-
}
|
|
197
|
-
|
|
218
|
+
},
|
|
219
|
+
},
|
|
198
220
|
],
|
|
199
221
|
|
|
200
222
|
methods: {
|
|
201
|
-
|
|
202
223
|
toggle() {
|
|
203
224
|
return this.isToggled() ? this.hide() : this.show();
|
|
204
225
|
},
|
|
@@ -206,10 +227,8 @@ export default {
|
|
|
206
227
|
show() {
|
|
207
228
|
if (this.container && parent(this.$el) !== this.container) {
|
|
208
229
|
append(this.container, this.$el);
|
|
209
|
-
return new Promise(resolve =>
|
|
210
|
-
requestAnimationFrame(() =>
|
|
211
|
-
this.show().then(resolve)
|
|
212
|
-
)
|
|
230
|
+
return new Promise((resolve) =>
|
|
231
|
+
requestAnimationFrame(() => this.show().then(resolve))
|
|
213
232
|
);
|
|
214
233
|
}
|
|
215
234
|
|
|
@@ -218,13 +237,11 @@ export default {
|
|
|
218
237
|
|
|
219
238
|
hide() {
|
|
220
239
|
return this.toggleElement(this.$el, false, animate(this));
|
|
221
|
-
}
|
|
222
|
-
|
|
223
|
-
}
|
|
224
|
-
|
|
240
|
+
},
|
|
241
|
+
},
|
|
225
242
|
};
|
|
226
243
|
|
|
227
|
-
function animate({transitionElement, _toggle}) {
|
|
244
|
+
function animate({ transitionElement, _toggle }) {
|
|
228
245
|
return (el, show) =>
|
|
229
246
|
new Promise((resolve, reject) =>
|
|
230
247
|
once(el, 'show hide', () => {
|
|
@@ -233,16 +250,22 @@ function animate({transitionElement, _toggle}) {
|
|
|
233
250
|
|
|
234
251
|
_toggle(el, show);
|
|
235
252
|
|
|
236
|
-
const off = once(
|
|
237
|
-
|
|
238
|
-
|
|
239
|
-
|
|
253
|
+
const off = once(
|
|
254
|
+
transitionElement,
|
|
255
|
+
'transitionstart',
|
|
256
|
+
() => {
|
|
257
|
+
once(transitionElement, 'transitionend transitioncancel', resolve, {
|
|
258
|
+
self: true,
|
|
259
|
+
});
|
|
260
|
+
clearTimeout(timer);
|
|
261
|
+
},
|
|
262
|
+
{ self: true }
|
|
263
|
+
);
|
|
240
264
|
|
|
241
265
|
const timer = setTimeout(() => {
|
|
242
266
|
off();
|
|
243
267
|
resolve();
|
|
244
268
|
}, toMs(css(transitionElement, 'transitionDuration')));
|
|
245
|
-
|
|
246
269
|
})
|
|
247
270
|
).then(() => delete el._reject);
|
|
248
271
|
}
|