uikit 3.11.1 → 3.11.2-dev.03e47c2ff
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 +59 -17
- 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 +127 -201
- package/dist/css/uikit-core-rtl.min.css +1 -1
- package/dist/css/uikit-core.css +127 -201
- package/dist/css/uikit-core.min.css +1 -1
- package/dist/css/uikit-rtl.css +129 -207
- package/dist/css/uikit-rtl.min.css +1 -1
- package/dist/css/uikit.css +129 -207
- 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 +408 -439
- package/dist/js/components/filter.min.js +1 -1
- package/dist/js/components/lightbox-panel.js +1098 -1316
- package/dist/js/components/lightbox-panel.min.js +1 -1
- package/dist/js/components/lightbox.js +1144 -1393
- 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 +345 -362
- package/dist/js/components/parallax.min.js +1 -1
- package/dist/js/components/slider-parallax.js +343 -350
- package/dist/js/components/slider-parallax.min.js +1 -1
- package/dist/js/components/slider.js +768 -843
- package/dist/js/components/slider.min.js +1 -1
- package/dist/js/components/slideshow-parallax.js +343 -350
- package/dist/js/components/slideshow-parallax.min.js +1 -1
- package/dist/js/components/slideshow.js +645 -793
- package/dist/js/components/slideshow.min.js +1 -1
- package/dist/js/components/sortable.js +587 -621
- 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 +5430 -6690
- 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 +8143 -9784
- 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 +15 -28
- package/src/js/api/global.js +6 -12
- package/src/js/api/hooks.js +14 -33
- package/src/js/api/instance.js +7 -15
- package/src/js/api/state.js +79 -100
- package/src/js/components/countdown.js +24 -50
- package/src/js/components/filter.js +70 -66
- package/src/js/components/index.js +13 -13
- package/src/js/components/internal/lightbox-animations.js +14 -25
- package/src/js/components/internal/slider-preload.js +37 -0
- package/src/js/components/internal/slider-transitioner.js +66 -45
- package/src/js/components/internal/slideshow-animations.js +46 -64
- package/src/js/components/lightbox-panel.js +107 -105
- package/src/js/components/lightbox.js +17 -39
- package/src/js/components/notification.js +49 -43
- package/src/js/components/parallax.js +21 -46
- package/src/js/components/slider-parallax.js +13 -23
- package/src/js/components/slider.js +95 -64
- package/src/js/components/slideshow-parallax.js +1 -1
- package/src/js/components/slideshow.js +15 -13
- package/src/js/components/sortable.js +126 -108
- 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 +9 -17
- package/src/js/core/core.js +74 -53
- package/src/js/core/cover.js +11 -15
- package/src/js/core/drop.js +107 -93
- 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 +29 -36
- package/src/js/core/icon.js +47 -52
- package/src/js/core/img.js +156 -138
- 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 +49 -36
- package/src/js/core/nav.js +2 -4
- package/src/js/core/navbar.js +113 -85
- 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 +194 -123
- package/src/js/core/svg.js +68 -83
- package/src/js/core/switcher.js +47 -46
- package/src/js/core/tab.js +7 -10
- package/src/js/core/toggle.js +66 -67
- 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 +58 -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 +175 -121
- 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 +48 -55
- package/src/js/mixin/slideshow.js +13 -19
- package/src/js/mixin/togglable.js +89 -63
- package/src/js/uikit-core.js +2 -4
- package/src/js/uikit.js +2 -4
- package/src/js/util/ajax.js +25 -40
- package/src/js/util/animation.js +77 -75
- package/src/js/util/attr.js +17 -21
- package/src/js/util/class.js +14 -52
- package/src/js/util/dimensions.js +78 -49
- package/src/js/util/dom.js +39 -66
- package/src/js/util/env.js +7 -12
- package/src/js/util/event.js +60 -59
- package/src/js/util/fastdom.js +3 -8
- package/src/js/util/filter.js +17 -34
- package/src/js/util/index.js +0 -1
- package/src/js/util/lang.js +82 -121
- package/src/js/util/mouse.js +19 -17
- package/src/js/util/options.js +35 -49
- package/src/js/util/player.js +41 -36
- package/src/js/util/position.js +54 -46
- package/src/js/util/selector.js +43 -58
- package/src/js/util/style.js +39 -49
- package/src/js/util/viewport.js +81 -66
- package/src/less/components/base.less +10 -33
- package/src/less/components/flex.less +0 -9
- package/src/less/components/form-range.less +48 -95
- package/src/less/components/form.less +0 -1
- package/src/less/components/height.less +3 -0
- package/src/less/components/leader.less +0 -1
- package/src/less/components/lightbox.less +0 -1
- package/src/less/components/modal.less +3 -7
- package/src/less/components/navbar.less +0 -7
- package/src/less/components/progress.less +14 -36
- package/src/less/components/slider.less +0 -3
- package/src/less/components/slideshow.less +0 -3
- package/src/less/components/text.less +16 -32
- package/src/less/components/utility.less +22 -0
- package/src/scss/components/base.scss +10 -33
- package/src/scss/components/flex.scss +0 -9
- package/src/scss/components/form-range.scss +48 -95
- package/src/scss/components/form.scss +3 -4
- package/src/scss/components/height.scss +3 -0
- package/src/scss/components/icon.scss +2 -2
- package/src/scss/components/leader.scss +0 -1
- package/src/scss/components/lightbox.scss +0 -1
- package/src/scss/components/modal.scss +3 -7
- package/src/scss/components/navbar.scss +0 -7
- package/src/scss/components/progress.scss +14 -36
- package/src/scss/components/search.scss +1 -1
- package/src/scss/components/slider.scss +0 -3
- package/src/scss/components/slideshow.scss +0 -3
- package/src/scss/components/text.scss +16 -32
- package/src/scss/components/utility.scss +22 -0
- package/src/scss/mixins-theme.scss +1 -1
- package/src/scss/mixins.scss +1 -1
- package/src/scss/variables-theme.scss +9 -9
- package/src/scss/variables.scss +9 -9
- package/tests/align.html +10 -10
- package/tests/animation.html +2 -2
- package/tests/article.html +2 -2
- package/tests/base.html +3 -3
- package/tests/card.html +10 -10
- package/tests/column.html +3 -3
- package/tests/comment.html +9 -9
- package/tests/dotnav.html +3 -3
- package/tests/image.html +296 -64
- package/tests/images/image-type.avif +0 -0
- package/tests/images/image-type.jpeg +0 -0
- package/tests/images/image-type.webp +0 -0
- package/tests/index.html +8 -8
- package/tests/js/index.js +114 -85
- package/tests/lightbox.html +10 -10
- package/tests/marker.html +2 -2
- package/tests/modal.html +8 -9
- package/tests/navbar.html +2 -2
- package/tests/overlay.html +7 -7
- package/tests/parallax.html +14 -5
- package/tests/position.html +12 -12
- package/tests/slidenav.html +12 -12
- package/tests/slider.html +20 -20
- package/tests/sortable.html +1 -1
- package/tests/sticky-parallax.html +86 -98
- package/tests/sticky.html +56 -24
- package/tests/svg.html +6 -6
- package/tests/table.html +11 -11
- package/tests/thumbnav.html +12 -12
- package/tests/transition.html +30 -30
- package/tests/utility.html +33 -33
- package/tests/video.html +1 -1
- package/tests/width.html +1 -1
- package/src/js/mixin/flex-bug.js +0 -56
- package/src/js/util/promise.js +0 -191
- package/tests/images/animated.gif +0 -0
|
@@ -2,16 +2,16 @@ import Class from '../mixin/class';
|
|
|
2
2
|
import Slideshow from '../mixin/slideshow';
|
|
3
3
|
import Animations from './internal/slideshow-animations';
|
|
4
4
|
import SliderReactive from '../mixin/slider-reactive';
|
|
5
|
-
import
|
|
5
|
+
import SliderPreload from './internal/slider-preload';
|
|
6
|
+
import { boxModelAdjust, css } from 'uikit-util';
|
|
6
7
|
|
|
7
8
|
export default {
|
|
8
|
-
|
|
9
|
-
mixins: [Class, Slideshow, SliderReactive],
|
|
9
|
+
mixins: [Class, Slideshow, SliderReactive, SliderPreload],
|
|
10
10
|
|
|
11
11
|
props: {
|
|
12
12
|
ratio: String,
|
|
13
13
|
minHeight: Number,
|
|
14
|
-
maxHeight: Number
|
|
14
|
+
maxHeight: Number,
|
|
15
15
|
},
|
|
16
16
|
|
|
17
17
|
data: {
|
|
@@ -21,20 +21,18 @@ export default {
|
|
|
21
21
|
selList: '.uk-slideshow-items',
|
|
22
22
|
attrItem: 'uk-slideshow-item',
|
|
23
23
|
selNav: '.uk-slideshow-nav',
|
|
24
|
-
Animations
|
|
24
|
+
Animations,
|
|
25
25
|
},
|
|
26
26
|
|
|
27
27
|
update: {
|
|
28
|
-
|
|
29
28
|
read() {
|
|
30
|
-
|
|
31
29
|
if (!this.list) {
|
|
32
30
|
return false;
|
|
33
31
|
}
|
|
34
32
|
|
|
35
33
|
let [width, height] = this.ratio.split(':').map(Number);
|
|
36
34
|
|
|
37
|
-
height = height * this.list.offsetWidth / width || 0;
|
|
35
|
+
height = (height * this.list.offsetWidth) / width || 0;
|
|
38
36
|
|
|
39
37
|
if (this.minHeight) {
|
|
40
38
|
height = Math.max(this.minHeight, height);
|
|
@@ -44,15 +42,19 @@ export default {
|
|
|
44
42
|
height = Math.min(this.maxHeight, height);
|
|
45
43
|
}
|
|
46
44
|
|
|
47
|
-
return {height: height - boxModelAdjust(this.list, 'height', 'content-box')};
|
|
45
|
+
return { height: height - boxModelAdjust(this.list, 'height', 'content-box') };
|
|
48
46
|
},
|
|
49
47
|
|
|
50
|
-
write({height}) {
|
|
48
|
+
write({ height }) {
|
|
51
49
|
height > 0 && css(this.list, 'minHeight', height);
|
|
52
50
|
},
|
|
53
51
|
|
|
54
|
-
events: ['resize']
|
|
55
|
-
|
|
56
|
-
}
|
|
52
|
+
events: ['resize'],
|
|
53
|
+
},
|
|
57
54
|
|
|
55
|
+
methods: {
|
|
56
|
+
getAdjacentSlides() {
|
|
57
|
+
return [1, -1].map((i) => this.slides[this.getIndex(this.index + i)]);
|
|
58
|
+
},
|
|
59
|
+
},
|
|
58
60
|
};
|
|
@@ -1,9 +1,40 @@
|
|
|
1
1
|
import Animate from '../mixin/animate';
|
|
2
2
|
import Class from '../mixin/class';
|
|
3
|
-
import {
|
|
3
|
+
import {
|
|
4
|
+
$$,
|
|
5
|
+
addClass,
|
|
6
|
+
append,
|
|
7
|
+
assign,
|
|
8
|
+
before,
|
|
9
|
+
children,
|
|
10
|
+
css,
|
|
11
|
+
findIndex,
|
|
12
|
+
getEventPos,
|
|
13
|
+
getViewport,
|
|
14
|
+
hasTouch,
|
|
15
|
+
height,
|
|
16
|
+
index,
|
|
17
|
+
isEmpty,
|
|
18
|
+
isInput,
|
|
19
|
+
off,
|
|
20
|
+
offset,
|
|
21
|
+
on,
|
|
22
|
+
parent,
|
|
23
|
+
pointerDown,
|
|
24
|
+
pointerMove,
|
|
25
|
+
pointerUp,
|
|
26
|
+
pointInRect,
|
|
27
|
+
remove,
|
|
28
|
+
removeClass,
|
|
29
|
+
scrollParents,
|
|
30
|
+
scrollTop,
|
|
31
|
+
toggleClass,
|
|
32
|
+
Transition,
|
|
33
|
+
trigger,
|
|
34
|
+
within,
|
|
35
|
+
} from 'uikit-util';
|
|
4
36
|
|
|
5
37
|
export default {
|
|
6
|
-
|
|
7
38
|
mixins: [Class, Animate],
|
|
8
39
|
|
|
9
40
|
props: {
|
|
@@ -17,7 +48,7 @@ export default {
|
|
|
17
48
|
clsNoDrag: String,
|
|
18
49
|
clsEmpty: String,
|
|
19
50
|
clsCustom: String,
|
|
20
|
-
handle: String
|
|
51
|
+
handle: String,
|
|
21
52
|
},
|
|
22
53
|
|
|
23
54
|
data: {
|
|
@@ -32,29 +63,26 @@ export default {
|
|
|
32
63
|
clsEmpty: 'uk-sortable-empty',
|
|
33
64
|
clsCustom: '',
|
|
34
65
|
handle: false,
|
|
35
|
-
pos: {}
|
|
66
|
+
pos: {},
|
|
36
67
|
},
|
|
37
68
|
|
|
38
69
|
created() {
|
|
39
|
-
['init', 'start', 'move', 'end']
|
|
70
|
+
for (const key of ['init', 'start', 'move', 'end']) {
|
|
40
71
|
const fn = this[key];
|
|
41
|
-
this[key] = e => {
|
|
72
|
+
this[key] = (e) => {
|
|
42
73
|
assign(this.pos, getEventPos(e));
|
|
43
74
|
fn(e);
|
|
44
75
|
};
|
|
45
|
-
}
|
|
76
|
+
}
|
|
46
77
|
},
|
|
47
78
|
|
|
48
79
|
events: {
|
|
49
|
-
|
|
50
80
|
name: pointerDown,
|
|
51
81
|
passive: false,
|
|
52
|
-
handler: 'init'
|
|
53
|
-
|
|
82
|
+
handler: 'init',
|
|
54
83
|
},
|
|
55
84
|
|
|
56
85
|
computed: {
|
|
57
|
-
|
|
58
86
|
target() {
|
|
59
87
|
return (this.$el.tBodies || [this.$el])[0];
|
|
60
88
|
},
|
|
@@ -64,7 +92,6 @@ export default {
|
|
|
64
92
|
},
|
|
65
93
|
|
|
66
94
|
isEmpty: {
|
|
67
|
-
|
|
68
95
|
get() {
|
|
69
96
|
return isEmpty(this.items);
|
|
70
97
|
},
|
|
@@ -73,40 +100,38 @@ export default {
|
|
|
73
100
|
toggleClass(this.target, this.clsEmpty, empty);
|
|
74
101
|
},
|
|
75
102
|
|
|
76
|
-
immediate: true
|
|
77
|
-
|
|
103
|
+
immediate: true,
|
|
78
104
|
},
|
|
79
105
|
|
|
80
106
|
handles: {
|
|
81
|
-
|
|
82
|
-
get({handle}, el) {
|
|
107
|
+
get({ handle }, el) {
|
|
83
108
|
return handle ? $$(handle, el) : this.items;
|
|
84
109
|
},
|
|
85
110
|
|
|
86
111
|
watch(handles, prev) {
|
|
87
|
-
css(prev, {touchAction: '', userSelect: ''});
|
|
88
|
-
css(handles, {touchAction: hasTouch ? 'none' : '', userSelect: 'none'}); // touchAction set to 'none' causes a performance drop in Chrome 80
|
|
112
|
+
css(prev, { touchAction: '', userSelect: '' });
|
|
113
|
+
css(handles, { touchAction: hasTouch ? 'none' : '', userSelect: 'none' }); // touchAction set to 'none' causes a performance drop in Chrome 80
|
|
89
114
|
},
|
|
90
115
|
|
|
91
|
-
immediate: true
|
|
92
|
-
|
|
93
|
-
}
|
|
94
|
-
|
|
116
|
+
immediate: true,
|
|
117
|
+
},
|
|
95
118
|
},
|
|
96
119
|
|
|
97
120
|
update: {
|
|
98
|
-
|
|
99
121
|
write(data) {
|
|
100
|
-
|
|
101
122
|
if (!this.drag || !parent(this.placeholder)) {
|
|
102
123
|
return;
|
|
103
124
|
}
|
|
104
125
|
|
|
105
|
-
const {
|
|
126
|
+
const {
|
|
127
|
+
pos: { x, y },
|
|
128
|
+
origin: { offsetTop, offsetLeft },
|
|
129
|
+
placeholder,
|
|
130
|
+
} = this;
|
|
106
131
|
|
|
107
132
|
css(this.drag, {
|
|
108
133
|
top: y - offsetTop,
|
|
109
|
-
left: x - offsetLeft
|
|
134
|
+
left: x - offsetLeft,
|
|
110
135
|
});
|
|
111
136
|
|
|
112
137
|
const sortable = this.getSortable(document.elementFromPoint(x, y));
|
|
@@ -115,20 +140,27 @@ export default {
|
|
|
115
140
|
return;
|
|
116
141
|
}
|
|
117
142
|
|
|
118
|
-
const {items} = sortable;
|
|
143
|
+
const { items } = sortable;
|
|
119
144
|
|
|
120
145
|
if (items.some(Transition.inProgress)) {
|
|
121
146
|
return;
|
|
122
147
|
}
|
|
123
148
|
|
|
124
|
-
const target = findTarget(items, {x, y});
|
|
149
|
+
const target = findTarget(items, { x, y });
|
|
125
150
|
|
|
126
151
|
if (items.length && (!target || target === placeholder)) {
|
|
127
152
|
return;
|
|
128
153
|
}
|
|
129
154
|
|
|
130
155
|
const previous = this.getSortable(placeholder);
|
|
131
|
-
const insertTarget = findInsertTarget(
|
|
156
|
+
const insertTarget = findInsertTarget(
|
|
157
|
+
sortable.target,
|
|
158
|
+
target,
|
|
159
|
+
placeholder,
|
|
160
|
+
x,
|
|
161
|
+
y,
|
|
162
|
+
sortable === previous && data.moved !== target
|
|
163
|
+
);
|
|
132
164
|
|
|
133
165
|
if (insertTarget === false) {
|
|
134
166
|
return;
|
|
@@ -150,23 +182,21 @@ export default {
|
|
|
150
182
|
this.touched.add(sortable);
|
|
151
183
|
},
|
|
152
184
|
|
|
153
|
-
events: ['move']
|
|
154
|
-
|
|
185
|
+
events: ['move'],
|
|
155
186
|
},
|
|
156
187
|
|
|
157
188
|
methods: {
|
|
158
|
-
|
|
159
189
|
init(e) {
|
|
160
|
-
|
|
161
|
-
const
|
|
162
|
-
|
|
163
|
-
|
|
164
|
-
|
|
165
|
-
||
|
|
166
|
-
|
|
167
|
-
|
|
168
|
-
|
|
169
|
-
|
|
190
|
+
const { target, button, defaultPrevented } = e;
|
|
191
|
+
const [placeholder] = this.items.filter((el) => within(target, el));
|
|
192
|
+
|
|
193
|
+
if (
|
|
194
|
+
!placeholder ||
|
|
195
|
+
defaultPrevented ||
|
|
196
|
+
button > 0 ||
|
|
197
|
+
isInput(target) ||
|
|
198
|
+
within(target, `.${this.clsNoDrag}`) ||
|
|
199
|
+
(this.handle && !within(target, this.handle))
|
|
170
200
|
) {
|
|
171
201
|
return;
|
|
172
202
|
}
|
|
@@ -175,7 +205,7 @@ export default {
|
|
|
175
205
|
|
|
176
206
|
this.touched = new Set([this]);
|
|
177
207
|
this.placeholder = placeholder;
|
|
178
|
-
this.origin =
|
|
208
|
+
this.origin = { target, index: index(placeholder), ...this.pos };
|
|
179
209
|
|
|
180
210
|
on(document, pointerMove, this.move);
|
|
181
211
|
on(document, pointerUp, this.end);
|
|
@@ -183,14 +213,12 @@ export default {
|
|
|
183
213
|
if (!this.threshold) {
|
|
184
214
|
this.start(e);
|
|
185
215
|
}
|
|
186
|
-
|
|
187
216
|
},
|
|
188
217
|
|
|
189
218
|
start(e) {
|
|
190
|
-
|
|
191
219
|
this.drag = appendDrag(this.$container, this.placeholder);
|
|
192
|
-
const {left, top} = this.placeholder.getBoundingClientRect();
|
|
193
|
-
assign(this.origin, {offsetLeft: this.pos.x - left, offsetTop: this.pos.y - top});
|
|
220
|
+
const { left, top } = this.placeholder.getBoundingClientRect();
|
|
221
|
+
assign(this.origin, { offsetLeft: this.pos.x - left, offsetTop: this.pos.y - top });
|
|
194
222
|
|
|
195
223
|
addClass(this.drag, this.clsDrag, this.clsCustom);
|
|
196
224
|
addClass(this.placeholder, this.clsPlaceholder);
|
|
@@ -205,20 +233,19 @@ export default {
|
|
|
205
233
|
},
|
|
206
234
|
|
|
207
235
|
move(e) {
|
|
208
|
-
|
|
209
236
|
if (this.drag) {
|
|
210
237
|
this.$emit('move');
|
|
211
|
-
} else if (
|
|
238
|
+
} else if (
|
|
239
|
+
Math.abs(this.pos.x - this.origin.x) > this.threshold ||
|
|
240
|
+
Math.abs(this.pos.y - this.origin.y) > this.threshold
|
|
241
|
+
) {
|
|
212
242
|
this.start(e);
|
|
213
243
|
}
|
|
214
|
-
|
|
215
244
|
},
|
|
216
245
|
|
|
217
246
|
end() {
|
|
218
|
-
|
|
219
247
|
off(document, pointerMove, this.move);
|
|
220
248
|
off(document, pointerUp, this.end);
|
|
221
|
-
off(window, 'scroll', this.scroll);
|
|
222
249
|
|
|
223
250
|
if (!this.drag) {
|
|
224
251
|
return;
|
|
@@ -242,87 +269,77 @@ export default {
|
|
|
242
269
|
remove(this.drag);
|
|
243
270
|
this.drag = null;
|
|
244
271
|
|
|
245
|
-
|
|
246
|
-
this.touched
|
|
247
|
-
removeClass(sortable.items, clsPlaceholder, clsItem)
|
|
248
|
-
|
|
249
|
-
|
|
272
|
+
for (const { clsPlaceholder, clsItem } of this.touched) {
|
|
273
|
+
for (const sortable of this.touched) {
|
|
274
|
+
removeClass(sortable.items, clsPlaceholder, clsItem);
|
|
275
|
+
}
|
|
276
|
+
}
|
|
250
277
|
this.touched = null;
|
|
251
278
|
removeClass(document.documentElement, this.clsDragState);
|
|
252
|
-
|
|
253
279
|
},
|
|
254
280
|
|
|
255
281
|
insert(element, target) {
|
|
256
|
-
|
|
257
282
|
addClass(this.items, this.clsItem);
|
|
258
283
|
|
|
259
|
-
const insert = () => target
|
|
260
|
-
? before(target, element)
|
|
261
|
-
: append(this.target, element);
|
|
284
|
+
const insert = () => (target ? before(target, element) : append(this.target, element));
|
|
262
285
|
|
|
263
286
|
this.animate(insert);
|
|
264
|
-
|
|
265
287
|
},
|
|
266
288
|
|
|
267
289
|
remove(element) {
|
|
268
|
-
|
|
269
290
|
if (!within(element, this.target)) {
|
|
270
291
|
return;
|
|
271
292
|
}
|
|
272
293
|
|
|
273
294
|
this.animate(() => remove(element));
|
|
274
|
-
|
|
275
295
|
},
|
|
276
296
|
|
|
277
297
|
getSortable(element) {
|
|
278
298
|
do {
|
|
279
299
|
const sortable = this.$getComponent(element, 'sortable');
|
|
280
300
|
|
|
281
|
-
if (
|
|
301
|
+
if (
|
|
302
|
+
sortable &&
|
|
303
|
+
(sortable === this || (this.group !== false && sortable.group === this.group))
|
|
304
|
+
) {
|
|
282
305
|
return sortable;
|
|
283
306
|
}
|
|
284
307
|
} while ((element = parent(element)));
|
|
285
|
-
}
|
|
286
|
-
|
|
287
|
-
}
|
|
288
|
-
|
|
308
|
+
},
|
|
309
|
+
},
|
|
289
310
|
};
|
|
290
311
|
|
|
291
312
|
let trackTimer;
|
|
292
313
|
function trackScroll(pos) {
|
|
293
|
-
|
|
294
314
|
let last = Date.now();
|
|
295
315
|
trackTimer = setInterval(() => {
|
|
316
|
+
let { x, y } = pos;
|
|
317
|
+
y += scrollTop(window);
|
|
296
318
|
|
|
297
|
-
|
|
298
|
-
y += window.pageYOffset;
|
|
299
|
-
|
|
300
|
-
const dist = (Date.now() - last) * .3;
|
|
319
|
+
const dist = (Date.now() - last) * 0.3;
|
|
301
320
|
last = Date.now();
|
|
302
321
|
|
|
303
|
-
scrollParents(document.elementFromPoint(x, pos.y), /auto|scroll/)
|
|
304
|
-
|
|
305
|
-
|
|
306
|
-
|
|
307
|
-
const {top, bottom, height} = offset(getViewport(scrollEl));
|
|
308
|
-
|
|
309
|
-
if (top < y && top + 35 > y) {
|
|
310
|
-
scroll -= dist;
|
|
311
|
-
} else if (bottom > y && bottom - 35 < y) {
|
|
312
|
-
scroll += dist;
|
|
313
|
-
} else {
|
|
314
|
-
return;
|
|
315
|
-
}
|
|
322
|
+
scrollParents(document.elementFromPoint(x, pos.y), /auto|scroll/)
|
|
323
|
+
.reverse()
|
|
324
|
+
.some((scrollEl) => {
|
|
325
|
+
let { scrollTop: scroll, scrollHeight } = scrollEl;
|
|
316
326
|
|
|
317
|
-
|
|
318
|
-
scrollTop(scrollEl, scroll);
|
|
319
|
-
return true;
|
|
320
|
-
}
|
|
327
|
+
const { top, bottom, height } = offset(getViewport(scrollEl));
|
|
321
328
|
|
|
322
|
-
|
|
329
|
+
if (top < y && top + 35 > y) {
|
|
330
|
+
scroll -= dist;
|
|
331
|
+
} else if (bottom > y && bottom - 35 < y) {
|
|
332
|
+
scroll += dist;
|
|
333
|
+
} else {
|
|
334
|
+
return;
|
|
335
|
+
}
|
|
323
336
|
|
|
337
|
+
if (scroll > 0 && scroll < scrollHeight - height) {
|
|
338
|
+
scrollTop(scrollEl, scroll);
|
|
339
|
+
return true;
|
|
340
|
+
}
|
|
341
|
+
});
|
|
324
342
|
}, 15);
|
|
325
|
-
|
|
326
343
|
}
|
|
327
344
|
|
|
328
345
|
function untrackScroll() {
|
|
@@ -330,14 +347,18 @@ function untrackScroll() {
|
|
|
330
347
|
}
|
|
331
348
|
|
|
332
349
|
function appendDrag(container, element) {
|
|
333
|
-
const clone = append(
|
|
350
|
+
const clone = append(
|
|
351
|
+
container,
|
|
352
|
+
element.outerHTML.replace(/(^<)(?:li|tr)|(?:li|tr)(\/>$)/g, '$1div$2')
|
|
353
|
+
);
|
|
334
354
|
|
|
335
355
|
css(clone, 'margin', '0', 'important');
|
|
336
|
-
css(clone,
|
|
356
|
+
css(clone, {
|
|
337
357
|
boxSizing: 'border-box',
|
|
338
358
|
width: element.offsetWidth,
|
|
339
|
-
height: element.offsetHeight
|
|
340
|
-
|
|
359
|
+
height: element.offsetHeight,
|
|
360
|
+
padding: css(element, 'padding'),
|
|
361
|
+
});
|
|
341
362
|
|
|
342
363
|
height(clone.firstElementChild, height(element.firstElementChild));
|
|
343
364
|
|
|
@@ -345,22 +366,18 @@ function appendDrag(container, element) {
|
|
|
345
366
|
}
|
|
346
367
|
|
|
347
368
|
function findTarget(items, point) {
|
|
348
|
-
return items[findIndex(items, item => pointInRect(point, item.getBoundingClientRect()))];
|
|
369
|
+
return items[findIndex(items, (item) => pointInRect(point, item.getBoundingClientRect()))];
|
|
349
370
|
}
|
|
350
371
|
|
|
351
372
|
function findInsertTarget(list, target, placeholder, x, y, sameList) {
|
|
352
|
-
|
|
353
373
|
if (!children(list).length) {
|
|
354
374
|
return;
|
|
355
375
|
}
|
|
356
376
|
|
|
357
377
|
const rect = target.getBoundingClientRect();
|
|
358
378
|
if (!sameList) {
|
|
359
|
-
|
|
360
379
|
if (!isHorizontal(list, placeholder)) {
|
|
361
|
-
return y < rect.top + rect.height / 2
|
|
362
|
-
? target
|
|
363
|
-
: target.nextElementSibling;
|
|
380
|
+
return y < rect.top + rect.height / 2 ? target : target.nextElementSibling;
|
|
364
381
|
}
|
|
365
382
|
|
|
366
383
|
return target;
|
|
@@ -377,10 +394,12 @@ function findInsertTarget(list, target, placeholder, x, y, sameList) {
|
|
|
377
394
|
const startProp = sameRow ? 'left' : 'top';
|
|
378
395
|
const endProp = sameRow ? 'right' : 'bottom';
|
|
379
396
|
|
|
380
|
-
const diff =
|
|
397
|
+
const diff =
|
|
398
|
+
placeholderRect[lengthProp] < rect[lengthProp]
|
|
399
|
+
? rect[lengthProp] - placeholderRect[lengthProp]
|
|
400
|
+
: 0;
|
|
381
401
|
|
|
382
402
|
if (placeholderRect[startProp] < rect[startProp]) {
|
|
383
|
-
|
|
384
403
|
if (diff && pointerPos < rect[startProp] + diff) {
|
|
385
404
|
return false;
|
|
386
405
|
}
|
|
@@ -396,7 +415,6 @@ function findInsertTarget(list, target, placeholder, x, y, sameList) {
|
|
|
396
415
|
}
|
|
397
416
|
|
|
398
417
|
function isHorizontal(list, placeholder) {
|
|
399
|
-
|
|
400
418
|
const single = children(list).length === 1;
|
|
401
419
|
|
|
402
420
|
if (single) {
|
|
@@ -406,7 +424,7 @@ function isHorizontal(list, placeholder) {
|
|
|
406
424
|
const items = children(list);
|
|
407
425
|
const isHorizontal = items.some((el, i) => {
|
|
408
426
|
const rectA = el.getBoundingClientRect();
|
|
409
|
-
return items.slice(i + 1).some(el => {
|
|
427
|
+
return items.slice(i + 1).some((el) => {
|
|
410
428
|
const rectB = el.getBoundingClientRect();
|
|
411
429
|
return !linesIntersect([rectA.left, rectA.right], [rectB.left, rectB.right]);
|
|
412
430
|
});
|
|
@@ -1,17 +1,31 @@
|
|
|
1
1
|
import Container from '../mixin/container';
|
|
2
2
|
import Togglable from '../mixin/togglable';
|
|
3
3
|
import Position from '../mixin/position';
|
|
4
|
-
import {
|
|
4
|
+
import {
|
|
5
|
+
append,
|
|
6
|
+
attr,
|
|
7
|
+
flipPosition,
|
|
8
|
+
hasAttr,
|
|
9
|
+
isFocusable,
|
|
10
|
+
isTouch,
|
|
11
|
+
matches,
|
|
12
|
+
on,
|
|
13
|
+
once,
|
|
14
|
+
pointerDown,
|
|
15
|
+
pointerEnter,
|
|
16
|
+
pointerLeave,
|
|
17
|
+
remove,
|
|
18
|
+
within,
|
|
19
|
+
} from 'uikit-util';
|
|
5
20
|
|
|
6
21
|
export default {
|
|
7
|
-
|
|
8
22
|
mixins: [Container, Togglable, Position],
|
|
9
23
|
|
|
10
24
|
args: 'title',
|
|
11
25
|
|
|
12
26
|
props: {
|
|
13
27
|
delay: Number,
|
|
14
|
-
title: String
|
|
28
|
+
title: String,
|
|
15
29
|
},
|
|
16
30
|
|
|
17
31
|
data: {
|
|
@@ -21,7 +35,7 @@ export default {
|
|
|
21
35
|
animation: ['uk-animation-scale-up'],
|
|
22
36
|
duration: 100,
|
|
23
37
|
cls: 'uk-active',
|
|
24
|
-
clsPos: 'uk-tooltip'
|
|
38
|
+
clsPos: 'uk-tooltip',
|
|
25
39
|
},
|
|
26
40
|
|
|
27
41
|
beforeConnect() {
|
|
@@ -37,25 +51,27 @@ export default {
|
|
|
37
51
|
},
|
|
38
52
|
|
|
39
53
|
methods: {
|
|
40
|
-
|
|
41
54
|
show() {
|
|
42
|
-
|
|
43
55
|
if (this.isToggled(this.tooltip || null) || !this.title) {
|
|
44
56
|
return;
|
|
45
57
|
}
|
|
46
58
|
|
|
47
|
-
this._unbind = once(
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
59
|
+
this._unbind = once(
|
|
60
|
+
document,
|
|
61
|
+
`show keydown ${pointerDown}`,
|
|
62
|
+
this.hide,
|
|
63
|
+
false,
|
|
64
|
+
(e) =>
|
|
65
|
+
(e.type === pointerDown && !within(e.target, this.$el)) ||
|
|
66
|
+
(e.type === 'keydown' && e.keyCode === 27) ||
|
|
67
|
+
(e.type === 'show' && e.detail[0] !== this && e.detail[0].$name === this.$name)
|
|
51
68
|
);
|
|
52
69
|
|
|
53
70
|
clearTimeout(this.showTimer);
|
|
54
71
|
this.showTimer = setTimeout(this._show, this.delay);
|
|
55
72
|
},
|
|
56
73
|
|
|
57
|
-
hide() {
|
|
58
|
-
|
|
74
|
+
async hide() {
|
|
59
75
|
if (matches(this.$el, 'input:focus')) {
|
|
60
76
|
return;
|
|
61
77
|
}
|
|
@@ -66,23 +82,21 @@ export default {
|
|
|
66
82
|
return;
|
|
67
83
|
}
|
|
68
84
|
|
|
69
|
-
this.toggleElement(this.tooltip, false, false)
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
});
|
|
85
|
+
await this.toggleElement(this.tooltip, false, false);
|
|
86
|
+
remove(this.tooltip);
|
|
87
|
+
this.tooltip = null;
|
|
88
|
+
this._unbind();
|
|
74
89
|
},
|
|
75
90
|
|
|
76
91
|
_show() {
|
|
77
|
-
|
|
78
|
-
|
|
92
|
+
this.tooltip = append(
|
|
93
|
+
this.container,
|
|
79
94
|
`<div class="${this.clsPos}">
|
|
80
95
|
<div class="${this.clsPos}-inner">${this.title}</div>
|
|
81
96
|
</div>`
|
|
82
97
|
);
|
|
83
98
|
|
|
84
99
|
on(this.tooltip, 'toggled', (e, toggled) => {
|
|
85
|
-
|
|
86
100
|
this.updateAria(toggled);
|
|
87
101
|
|
|
88
102
|
if (!toggled) {
|
|
@@ -91,23 +105,21 @@ export default {
|
|
|
91
105
|
|
|
92
106
|
this.positionAt(this.tooltip, this.$el);
|
|
93
107
|
|
|
94
|
-
this.origin =
|
|
95
|
-
|
|
96
|
-
|
|
108
|
+
this.origin =
|
|
109
|
+
this.getAxis() === 'y'
|
|
110
|
+
? `${flipPosition(this.dir)}-${this.align}`
|
|
111
|
+
: `${this.align}-${flipPosition(this.dir)}`;
|
|
97
112
|
});
|
|
98
113
|
|
|
99
114
|
this.toggleElement(this.tooltip, true);
|
|
100
|
-
|
|
101
115
|
},
|
|
102
116
|
|
|
103
117
|
updateAria(toggled) {
|
|
104
118
|
attr(this.$el, 'aria-expanded', toggled);
|
|
105
|
-
}
|
|
106
|
-
|
|
119
|
+
},
|
|
107
120
|
},
|
|
108
121
|
|
|
109
122
|
events: {
|
|
110
|
-
|
|
111
123
|
focus: 'show',
|
|
112
124
|
blur: 'hide',
|
|
113
125
|
|
|
@@ -123,10 +135,8 @@ export default {
|
|
|
123
135
|
if (isTouch(e)) {
|
|
124
136
|
this.show();
|
|
125
137
|
}
|
|
126
|
-
}
|
|
127
|
-
|
|
128
|
-
}
|
|
129
|
-
|
|
138
|
+
},
|
|
139
|
+
},
|
|
130
140
|
};
|
|
131
141
|
|
|
132
142
|
function makeFocusable(el) {
|