uikit 3.11.2-dev.f2970ffaa → 3.11.2-dev.f3ade19c4
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 +54 -18
- 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 +133 -201
- package/dist/css/uikit-core-rtl.min.css +1 -1
- package/dist/css/uikit-core.css +133 -201
- package/dist/css/uikit-core.min.css +1 -1
- package/dist/css/uikit-rtl.css +135 -207
- package/dist/css/uikit-rtl.min.css +1 -1
- package/dist/css/uikit.css +135 -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 +1091 -1319
- package/dist/js/components/lightbox-panel.min.js +1 -1
- package/dist/js/components/lightbox.js +1137 -1396
- 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 +347 -372
- package/dist/js/components/parallax.min.js +1 -1
- package/dist/js/components/slider-parallax.js +345 -360
- package/dist/js/components/slider-parallax.min.js +1 -1
- package/dist/js/components/slider.js +749 -843
- package/dist/js/components/slider.min.js +1 -1
- package/dist/js/components/slideshow-parallax.js +345 -360
- package/dist/js/components/slideshow-parallax.min.js +1 -1
- package/dist/js/components/slideshow.js +628 -798
- package/dist/js/components/slideshow.min.js +1 -1
- package/dist/js/components/sortable.js +587 -620
- 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 +5326 -6526
- 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 +8031 -9659
- 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 +199 -187
- package/src/js/components/countdown.js +26 -52
- 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 +9 -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 +117 -89
- package/src/js/components/slideshow-parallax.js +1 -1
- package/src/js/components/slideshow.js +15 -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 +58 -48
- package/src/js/core/alert.js +9 -17
- package/src/js/core/core.js +17 -69
- package/src/js/core/cover.js +15 -15
- package/src/js/core/drop.js +110 -94
- package/src/js/core/form-custom.js +22 -27
- 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 +30 -34
- package/src/js/core/icon.js +47 -52
- package/src/js/core/img.js +153 -143
- 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 +51 -54
- 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 +175 -123
- package/src/js/core/svg.js +68 -83
- package/src/js/core/switcher.js +56 -47
- package/src/js/core/tab.js +7 -10
- package/src/js/core/toggle.js +69 -68
- package/src/js/core/video.js +22 -21
- 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/lazyload.js +20 -0
- package/src/js/mixin/media.js +5 -10
- package/src/js/mixin/modal.js +89 -66
- package/src/js/mixin/parallax.js +149 -107
- 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 +47 -60
- package/src/js/mixin/slideshow.js +12 -22
- package/src/js/mixin/swipe.js +72 -0
- 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 +1 -6
- package/src/js/util/filter.js +17 -34
- package/src/js/util/index.js +1 -1
- package/src/js/util/lang.js +82 -121
- package/src/js/util/mouse.js +19 -17
- package/src/js/util/observer.js +36 -0
- 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 +75 -64
- 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 +25 -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 +25 -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 +16 -7
- 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 +87 -99
- 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 +50 -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
|
@@ -1 +1 @@
|
|
|
1
|
-
/*! UIkit 3.11.2-dev.
|
|
1
|
+
/*! UIkit 3.11.2-dev.f3ade19c4 | https://www.getuikit.com | (c) 2014 - 2022 YOOtheme | MIT License */(function(s,d){typeof exports=="object"&&typeof module<"u"?module.exports=d(require("uikit-util")):typeof define=="function"&&define.amd?define("uikittooltip",["uikit-util"],d):(s=typeof globalThis<"u"?globalThis:s||self,s.UIkitTooltip=d(s.UIkit.util))})(this,function(s){"use strict";var d={props:{container:Boolean},data:{container:!0},computed:{container(t){let{container:o}=t;return o===!0&&this.$container||o&&s.$(o)}}},u={props:{cls:Boolean,animation:"list",duration:Number,origin:String,transition:String},data:{cls:!1,animation:[!1],duration:200,origin:!1,transition:"linear",clsEnter:"uk-togglabe-enter",clsLeave:"uk-togglabe-leave",initProps:{overflow:"",height:"",paddingTop:"",paddingBottom:"",marginTop:"",marginBottom:""},hideProps:{overflow:"hidden",height:0,paddingTop:0,paddingBottom:0,marginTop:0,marginBottom:0}},computed:{hasAnimation(t){let{animation:o}=t;return!!o[0]},hasTransition(t){let{animation:o}=t;return this.hasAnimation&&o[0]===!0}},methods:{toggleElement(t,o,r){return new Promise(i=>Promise.all(s.toNodes(t).map(n=>{const h=s.isBoolean(o)?o:!this.isToggled(n);if(!s.trigger(n,"before"+(h?"show":"hide"),[this]))return Promise.reject();const a=(s.isFunction(r)?r:r===!1||!this.hasAnimation?this._toggle:this.hasTransition?w(this):T(this))(n,h),e=h?this.clsEnter:this.clsLeave;s.addClass(n,e),s.trigger(n,h?"show":"hide",[this]);const p=()=>{s.removeClass(n,e),s.trigger(n,h?"shown":"hidden",[this]),this.$update(n)};return a?a.then(p,()=>(s.removeClass(n,e),Promise.reject())):p()})).then(i,s.noop))},isToggled(t){return t===void 0&&(t=this.$el),[t]=s.toNodes(t),s.hasClass(t,this.clsEnter)?!0:s.hasClass(t,this.clsLeave)?!1:this.cls?s.hasClass(t,this.cls.split(" ")[0]):s.isVisible(t)},_toggle(t,o){if(!t)return;o=Boolean(o);let r;this.cls?(r=s.includes(this.cls," ")||o!==s.hasClass(t,this.cls),r&&s.toggleClass(t,this.cls,s.includes(this.cls," ")?void 0:o)):(r=o===t.hidden,r&&(t.hidden=!o)),s.$$("[autofocus]",t).some(i=>s.isVisible(i)?i.focus()||!0:i.blur()),r&&(s.trigger(t,"toggled",[o,this]),this.$update(t))}}};function w(t){let{isToggled:o,duration:r,initProps:i,hideProps:n,transition:h,_toggle:a}=t;return(e,p)=>{const l=s.Transition.inProgress(e),m=e.hasChildNodes?s.toFloat(s.css(e.firstElementChild,"marginTop"))+s.toFloat(s.css(e.lastElementChild,"marginBottom")):0,c=s.isVisible(e)?s.height(e)+(l?0:m):0;s.Transition.cancel(e),o(e)||a(e,!0),s.height(e,""),s.fastdom.flush();const g=s.height(e)+(l?0:m);return s.height(e,c),(p?s.Transition.start(e,{...i,overflow:"hidden",height:g},Math.round(r*(1-c/g)),h):s.Transition.start(e,n,Math.round(r*(c/g)),h).then(()=>a(e,!1))).then(()=>s.css(e,i))}}function T(t){return(o,r)=>{s.Animation.cancel(o);const{animation:i,duration:n,_toggle:h}=t;return r?(h(o,!0),s.Animation.in(o,i[0],n,t.origin)):s.Animation.out(o,i[1]||i[0],n,t.origin).then(()=>h(o,!1))}}var v={props:{pos:String,offset:null,flip:Boolean,clsPos:String},data:{pos:"bottom-"+(s.isRtl?"right":"left"),flip:!0,offset:!1,clsPos:""},computed:{pos(t){let{pos:o}=t;return o.split("-").concat("center").slice(0,2)},dir(){return this.pos[0]},align(){return this.pos[1]}},methods:{positionAt(t,o,r){s.removeClasses(t,this.clsPos+"-(top|bottom|left|right)(-[a-z]+)?");let{offset:i}=this;const n=this.getAxis();if(!s.isNumeric(i)){const e=s.$(i);i=e?s.offset(e)[n==="x"?"left":"top"]-s.offset(o)[n==="x"?"right":"bottom"]:0}const{x:h,y:a}=s.positionAt(t,o,n==="x"?s.flipPosition(this.dir)+" "+this.align:this.align+" "+s.flipPosition(this.dir),n==="x"?this.dir+" "+this.align:this.align+" "+this.dir,n==="x"?""+(this.dir==="left"?-i:i):" "+(this.dir==="top"?-i:i),null,this.flip,r).target;this.dir=n==="x"?h:a,this.align=n==="x"?a:h,s.toggleClass(t,this.clsPos+"-"+this.dir+"-"+this.align,this.offset===!1)},getAxis(){return this.dir==="top"||this.dir==="bottom"?"y":"x"}}},f={mixins:[d,u,v],args:"title",props:{delay:Number,title:String},data:{pos:"top",title:"",delay:0,animation:["uk-animation-scale-up"],duration:100,cls:"uk-active",clsPos:"uk-tooltip"},beforeConnect(){this._hasTitle=s.hasAttr(this.$el,"title"),s.attr(this.$el,"title",""),this.updateAria(!1),P(this.$el)},disconnected(){this.hide(),s.attr(this.$el,"title",this._hasTitle?this.title:null)},methods:{show(){this.isToggled(this.tooltip||null)||!this.title||(this._unbind=s.once(document,"show keydown "+s.pointerDown,this.hide,!1,t=>t.type===s.pointerDown&&!s.within(t.target,this.$el)||t.type==="keydown"&&t.keyCode===27||t.type==="show"&&t.detail[0]!==this&&t.detail[0].$name===this.$name),clearTimeout(this.showTimer),this.showTimer=setTimeout(this._show,this.delay))},async hide(){s.matches(this.$el,"input:focus")||(clearTimeout(this.showTimer),!!this.isToggled(this.tooltip||null)&&(await this.toggleElement(this.tooltip,!1,!1),s.remove(this.tooltip),this.tooltip=null,this._unbind()))},_show(){this.tooltip=s.append(this.container,'<div class="'+this.clsPos+'"> <div class="'+this.clsPos+'-inner">'+this.title+"</div> </div>"),s.on(this.tooltip,"toggled",(t,o)=>{this.updateAria(o),!!o&&(this.positionAt(this.tooltip,this.$el),this.origin=this.getAxis()==="y"?s.flipPosition(this.dir)+"-"+this.align:this.align+"-"+s.flipPosition(this.dir))}),this.toggleElement(this.tooltip,!0)},updateAria(t){s.attr(this.$el,"aria-expanded",t)}},events:{focus:"show",blur:"hide",[s.pointerEnter+" "+s.pointerLeave](t){s.isTouch(t)||this[t.type===s.pointerEnter?"show":"hide"]()},[s.pointerDown](t){s.isTouch(t)&&this.show()}}};function P(t){s.isFocusable(t)||s.attr(t,"tabindex","0")}return typeof window<"u"&&window.UIkit&&window.UIkit.component("tooltip",f),f});
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
/*! UIkit 3.11.2-dev.
|
|
1
|
+
/*! UIkit 3.11.2-dev.f3ade19c4 | https://www.getuikit.com | (c) 2014 - 2022 YOOtheme | MIT License */
|
|
2
2
|
|
|
3
3
|
(function (global, factory) {
|
|
4
4
|
typeof exports === 'object' && typeof module !== 'undefined' ? module.exports = factory(require('uikit-util')) :
|
|
@@ -7,209 +7,197 @@
|
|
|
7
7
|
})(this, (function (uikitUtil) { 'use strict';
|
|
8
8
|
|
|
9
9
|
var Component = {
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
10
|
+
props: {
|
|
11
|
+
allow: String,
|
|
12
|
+
clsDragover: String,
|
|
13
|
+
concurrent: Number,
|
|
14
|
+
maxSize: Number,
|
|
15
|
+
method: String,
|
|
16
|
+
mime: String,
|
|
17
|
+
msgInvalidMime: String,
|
|
18
|
+
msgInvalidName: String,
|
|
19
|
+
msgInvalidSize: String,
|
|
20
|
+
multiple: Boolean,
|
|
21
|
+
name: String,
|
|
22
|
+
params: Object,
|
|
23
|
+
type: String,
|
|
24
|
+
url: String },
|
|
25
|
+
|
|
26
|
+
|
|
27
|
+
data: {
|
|
28
|
+
allow: false,
|
|
29
|
+
clsDragover: 'uk-dragover',
|
|
30
|
+
concurrent: 1,
|
|
31
|
+
maxSize: 0,
|
|
32
|
+
method: 'POST',
|
|
33
|
+
mime: false,
|
|
34
|
+
msgInvalidMime: 'Invalid File Type: %s',
|
|
35
|
+
msgInvalidName: 'Invalid File Name: %s',
|
|
36
|
+
msgInvalidSize: 'Invalid File Size: %s Kilobytes Max',
|
|
37
|
+
multiple: false,
|
|
38
|
+
name: 'files[]',
|
|
39
|
+
params: {},
|
|
40
|
+
type: '',
|
|
41
|
+
url: '',
|
|
42
|
+
abort: uikitUtil.noop,
|
|
43
|
+
beforeAll: uikitUtil.noop,
|
|
44
|
+
beforeSend: uikitUtil.noop,
|
|
45
|
+
complete: uikitUtil.noop,
|
|
46
|
+
completeAll: uikitUtil.noop,
|
|
47
|
+
error: uikitUtil.noop,
|
|
48
|
+
fail: uikitUtil.noop,
|
|
49
|
+
load: uikitUtil.noop,
|
|
50
|
+
loadEnd: uikitUtil.noop,
|
|
51
|
+
loadStart: uikitUtil.noop,
|
|
52
|
+
progress: uikitUtil.noop },
|
|
53
|
+
|
|
54
|
+
|
|
55
|
+
events: {
|
|
56
|
+
change(e) {
|
|
57
|
+
if (!uikitUtil.matches(e.target, 'input[type="file"]')) {
|
|
58
|
+
return;
|
|
59
|
+
}
|
|
60
|
+
|
|
61
|
+
e.preventDefault();
|
|
62
|
+
|
|
63
|
+
if (e.target.files) {
|
|
64
|
+
this.upload(e.target.files);
|
|
65
|
+
}
|
|
66
|
+
|
|
67
|
+
e.target.value = '';
|
|
54
68
|
},
|
|
55
69
|
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
change: function(e) {
|
|
59
|
-
|
|
60
|
-
if (!uikitUtil.matches(e.target, 'input[type="file"]')) {
|
|
61
|
-
return;
|
|
62
|
-
}
|
|
63
|
-
|
|
64
|
-
e.preventDefault();
|
|
65
|
-
|
|
66
|
-
if (e.target.files) {
|
|
67
|
-
this.upload(e.target.files);
|
|
68
|
-
}
|
|
69
|
-
|
|
70
|
-
e.target.value = '';
|
|
71
|
-
},
|
|
72
|
-
|
|
73
|
-
drop: function(e) {
|
|
74
|
-
stop(e);
|
|
70
|
+
drop(e) {
|
|
71
|
+
stop(e);
|
|
75
72
|
|
|
76
|
-
|
|
73
|
+
const transfer = e.dataTransfer;
|
|
77
74
|
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
75
|
+
if (!(transfer != null && transfer.files)) {
|
|
76
|
+
return;
|
|
77
|
+
}
|
|
81
78
|
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
this.upload(transfer.files);
|
|
85
|
-
},
|
|
86
|
-
|
|
87
|
-
dragenter: function(e) {
|
|
88
|
-
stop(e);
|
|
89
|
-
},
|
|
90
|
-
|
|
91
|
-
dragover: function(e) {
|
|
92
|
-
stop(e);
|
|
93
|
-
uikitUtil.addClass(this.$el, this.clsDragover);
|
|
94
|
-
},
|
|
95
|
-
|
|
96
|
-
dragleave: function(e) {
|
|
97
|
-
stop(e);
|
|
98
|
-
uikitUtil.removeClass(this.$el, this.clsDragover);
|
|
99
|
-
}
|
|
79
|
+
uikitUtil.removeClass(this.$el, this.clsDragover);
|
|
100
80
|
|
|
81
|
+
this.upload(transfer.files);
|
|
101
82
|
},
|
|
102
83
|
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
var this$1$1 = this;
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
if (!files.length) {
|
|
110
|
-
return;
|
|
111
|
-
}
|
|
112
|
-
|
|
113
|
-
uikitUtil.trigger(this.$el, 'upload', [files]);
|
|
114
|
-
|
|
115
|
-
for (var i = 0; i < files.length; i++) {
|
|
116
|
-
|
|
117
|
-
if (this.maxSize && this.maxSize * 1000 < files[i].size) {
|
|
118
|
-
this.fail(this.msgInvalidSize.replace('%s', this.maxSize));
|
|
119
|
-
return;
|
|
120
|
-
}
|
|
121
|
-
|
|
122
|
-
if (this.allow && !match(this.allow, files[i].name)) {
|
|
123
|
-
this.fail(this.msgInvalidName.replace('%s', this.allow));
|
|
124
|
-
return;
|
|
125
|
-
}
|
|
126
|
-
|
|
127
|
-
if (this.mime && !match(this.mime, files[i].type)) {
|
|
128
|
-
this.fail(this.msgInvalidMime.replace('%s', this.mime));
|
|
129
|
-
return;
|
|
130
|
-
}
|
|
84
|
+
dragenter(e) {
|
|
85
|
+
stop(e);
|
|
86
|
+
},
|
|
131
87
|
|
|
132
|
-
|
|
88
|
+
dragover(e) {
|
|
89
|
+
stop(e);
|
|
90
|
+
uikitUtil.addClass(this.$el, this.clsDragover);
|
|
91
|
+
},
|
|
133
92
|
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
|
|
93
|
+
dragleave(e) {
|
|
94
|
+
stop(e);
|
|
95
|
+
uikitUtil.removeClass(this.$el, this.clsDragover);
|
|
96
|
+
} },
|
|
137
97
|
|
|
138
|
-
this.beforeAll(this, files);
|
|
139
98
|
|
|
140
|
-
|
|
141
|
-
|
|
99
|
+
methods: {
|
|
100
|
+
async upload(files) {
|
|
101
|
+
if (!files.length) {
|
|
102
|
+
return;
|
|
103
|
+
}
|
|
142
104
|
|
|
143
|
-
|
|
105
|
+
uikitUtil.trigger(this.$el, 'upload', [files]);
|
|
144
106
|
|
|
145
|
-
|
|
107
|
+
for (const file of files) {
|
|
108
|
+
if (this.maxSize && this.maxSize * 1000 < file.size) {
|
|
109
|
+
this.fail(this.msgInvalidSize.replace('%s', this.maxSize));
|
|
110
|
+
return;
|
|
111
|
+
}
|
|
146
112
|
|
|
147
|
-
|
|
148
|
-
|
|
149
|
-
|
|
113
|
+
if (this.allow && !match(this.allow, file.name)) {
|
|
114
|
+
this.fail(this.msgInvalidName.replace('%s', this.allow));
|
|
115
|
+
return;
|
|
116
|
+
}
|
|
150
117
|
|
|
151
|
-
|
|
152
|
-
|
|
153
|
-
|
|
154
|
-
|
|
155
|
-
|
|
118
|
+
if (this.mime && !match(this.mime, file.type)) {
|
|
119
|
+
this.fail(this.msgInvalidMime.replace('%s', this.mime));
|
|
120
|
+
return;
|
|
121
|
+
}
|
|
122
|
+
}
|
|
156
123
|
|
|
157
|
-
|
|
158
|
-
|
|
159
|
-
|
|
160
|
-
);
|
|
124
|
+
if (!this.multiple) {
|
|
125
|
+
files = files.slice(0, 1);
|
|
126
|
+
}
|
|
161
127
|
|
|
162
|
-
|
|
128
|
+
this.beforeAll(this, files);
|
|
163
129
|
|
|
164
|
-
|
|
165
|
-
|
|
166
|
-
|
|
130
|
+
const chunks = chunk(files, this.concurrent);
|
|
131
|
+
const upload = async (files) => {
|
|
132
|
+
const data = new FormData();
|
|
167
133
|
|
|
168
|
-
|
|
134
|
+
files.forEach((file) => data.append(this.name, file));
|
|
169
135
|
|
|
170
|
-
|
|
171
|
-
|
|
172
|
-
|
|
173
|
-
this$1$1.completeAll(xhr);
|
|
174
|
-
}
|
|
136
|
+
for (const key in this.params) {
|
|
137
|
+
data.append(key, this.params[key]);
|
|
138
|
+
}
|
|
175
139
|
|
|
176
|
-
|
|
177
|
-
|
|
178
|
-
|
|
140
|
+
try {
|
|
141
|
+
const xhr = await uikitUtil.ajax(this.url, {
|
|
142
|
+
data,
|
|
143
|
+
method: this.method,
|
|
144
|
+
responseType: this.type,
|
|
145
|
+
beforeSend: (env) => {
|
|
146
|
+
const { xhr } = env;
|
|
147
|
+
xhr.upload && uikitUtil.on(xhr.upload, 'progress', this.progress);
|
|
148
|
+
for (const type of ['loadStart', 'load', 'loadEnd', 'abort']) {
|
|
149
|
+
uikitUtil.on(xhr, type.toLowerCase(), this[type]);
|
|
150
|
+
}
|
|
151
|
+
|
|
152
|
+
return this.beforeSend(env);
|
|
153
|
+
} });
|
|
154
|
+
|
|
155
|
+
|
|
156
|
+
this.complete(xhr);
|
|
157
|
+
|
|
158
|
+
if (chunks.length) {
|
|
159
|
+
await upload(chunks.shift());
|
|
160
|
+
} else {
|
|
161
|
+
this.completeAll(xhr);
|
|
162
|
+
}
|
|
163
|
+
} catch (e) {
|
|
164
|
+
this.error(e);
|
|
165
|
+
}
|
|
166
|
+
};
|
|
179
167
|
|
|
180
|
-
|
|
168
|
+
await upload(chunks.shift());
|
|
169
|
+
} } };
|
|
181
170
|
|
|
182
|
-
upload(chunks.shift());
|
|
183
171
|
|
|
184
|
-
}
|
|
185
172
|
|
|
186
|
-
|
|
173
|
+
function match(pattern, path) {
|
|
174
|
+
return path.match(
|
|
175
|
+
new RegExp("^" +
|
|
176
|
+
pattern.
|
|
177
|
+
replace(/\//g, '\\/').
|
|
178
|
+
replace(/\*\*/g, '(\\/[^\\/]+)*').
|
|
179
|
+
replace(/\*/g, '[^\\/]+').
|
|
180
|
+
replace(/((?!\\))\?/g, '$1.') + "$",
|
|
181
|
+
'i'));
|
|
187
182
|
|
|
188
|
-
};
|
|
189
183
|
|
|
190
|
-
function match(pattern, path) {
|
|
191
|
-
return path.match(new RegExp(("^" + (pattern.replace(/\//g, '\\/').replace(/\*\*/g, '(\\/[^\\/]+)*').replace(/\*/g, '[^\\/]+').replace(/((?!\\))\?/g, '$1.')) + "$"), 'i'));
|
|
192
184
|
}
|
|
193
185
|
|
|
194
186
|
function chunk(files, size) {
|
|
195
|
-
|
|
196
|
-
|
|
197
|
-
|
|
198
|
-
|
|
199
|
-
|
|
200
|
-
}
|
|
201
|
-
chunks.push(chunk);
|
|
202
|
-
}
|
|
203
|
-
return chunks;
|
|
187
|
+
const chunks = [];
|
|
188
|
+
for (let i = 0; i < files.length; i += size) {
|
|
189
|
+
chunks.push(files.slice(i, i + size));
|
|
190
|
+
}
|
|
191
|
+
return chunks;
|
|
204
192
|
}
|
|
205
193
|
|
|
206
194
|
function stop(e) {
|
|
207
|
-
|
|
208
|
-
|
|
195
|
+
e.preventDefault();
|
|
196
|
+
e.stopPropagation();
|
|
209
197
|
}
|
|
210
198
|
|
|
211
199
|
if (typeof window !== 'undefined' && window.UIkit) {
|
|
212
|
-
|
|
200
|
+
window.UIkit.component('upload', Component);
|
|
213
201
|
}
|
|
214
202
|
|
|
215
203
|
return Component;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
/*! UIkit 3.11.2-dev.
|
|
1
|
+
/*! UIkit 3.11.2-dev.f3ade19c4 | https://www.getuikit.com | (c) 2014 - 2022 YOOtheme | MIT License */(function(t,r){typeof exports=="object"&&typeof module<"u"?module.exports=r(require("uikit-util")):typeof define=="function"&&define.amd?define("uikitupload",["uikit-util"],r):(t=typeof globalThis<"u"?globalThis:t||self,t.UIkitUpload=r(t.UIkit.util))})(this,function(t){"use strict";var r={props:{allow:String,clsDragover:String,concurrent:Number,maxSize:Number,method:String,mime:String,msgInvalidMime:String,msgInvalidName:String,msgInvalidSize:String,multiple:Boolean,name:String,params:Object,type:String,url:String},data:{allow:!1,clsDragover:"uk-dragover",concurrent:1,maxSize:0,method:"POST",mime:!1,msgInvalidMime:"Invalid File Type: %s",msgInvalidName:"Invalid File Name: %s",msgInvalidSize:"Invalid File Size: %s Kilobytes Max",multiple:!1,name:"files[]",params:{},type:"",url:"",abort:t.noop,beforeAll:t.noop,beforeSend:t.noop,complete:t.noop,completeAll:t.noop,error:t.noop,fail:t.noop,load:t.noop,loadEnd:t.noop,loadStart:t.noop,progress:t.noop},events:{change(e){!t.matches(e.target,'input[type="file"]')||(e.preventDefault(),e.target.files&&this.upload(e.target.files),e.target.value="")},drop(e){i(e);const o=e.dataTransfer;!(o!=null&&o.files)||(t.removeClass(this.$el,this.clsDragover),this.upload(o.files))},dragenter(e){i(e)},dragover(e){i(e),t.addClass(this.$el,this.clsDragover)},dragleave(e){i(e),t.removeClass(this.$el,this.clsDragover)}},methods:{async upload(e){if(!e.length)return;t.trigger(this.$el,"upload",[e]);for(const a of e){if(this.maxSize&&this.maxSize*1e3<a.size){this.fail(this.msgInvalidSize.replace("%s",this.maxSize));return}if(this.allow&&!d(this.allow,a.name)){this.fail(this.msgInvalidName.replace("%s",this.allow));return}if(this.mime&&!d(this.mime,a.type)){this.fail(this.msgInvalidMime.replace("%s",this.mime));return}}this.multiple||(e=e.slice(0,1)),this.beforeAll(this,e);const o=c(e,this.concurrent),s=async a=>{const l=new FormData;a.forEach(n=>l.append(this.name,n));for(const n in this.params)l.append(n,this.params[n]);try{const n=await t.ajax(this.url,{data:l,method:this.method,responseType:this.type,beforeSend:h=>{const{xhr:p}=h;p.upload&&t.on(p.upload,"progress",this.progress);for(const m of["loadStart","load","loadEnd","abort"])t.on(p,m.toLowerCase(),this[m]);return this.beforeSend(h)}});this.complete(n),o.length?await s(o.shift()):this.completeAll(n)}catch(n){this.error(n)}};await s(o.shift())}}};function d(e,o){return o.match(new RegExp("^"+e.replace(/\//g,"\\/").replace(/\*\*/g,"(\\/[^\\/]+)*").replace(/\*/g,"[^\\/]+").replace(/((?!\\))\?/g,"$1.")+"$","i"))}function c(e,o){const s=[];for(let a=0;a<e.length;a+=o)s.push(e.slice(a,a+o));return s}function i(e){e.preventDefault(),e.stopPropagation()}return typeof window<"u"&&window.UIkit&&window.UIkit.component("upload",r),r});
|