nimble-ui
Version:
1 lines • 16.7 kB
JavaScript
module.exports=function(t){var e={};function n(o){if(e[o])return e[o].exports;var i=e[o]={i:o,l:!1,exports:{}};return t[o].call(i.exports,i,i.exports,n),i.l=!0,i.exports}return n.m=t,n.c=e,n.d=function(t,e,o){n.o(t,e)||Object.defineProperty(t,e,{configurable:!1,enumerable:!0,get:o})},n.n=function(t){var e=t&&t.__esModule?function(){return t.default}:function(){return t};return n.d(e,"a",e),e},n.o=function(t,e){return Object.prototype.hasOwnProperty.call(t,e)},n.p="/",n(n.s="KUZl")}({"0Zk/":function(t,e,n){"use strict";e.a=function(t,e){return Object(o.a)(t,e).replace(/^[a-z]/,function(t){return t.toUpperCase()})};var o=n("lXuC")},"2tHm":function(t,e,n){"use strict";var o=n("zagf");e.a=function(t,e,n,i){var r=i/(n/e);!function n(s,c){setTimeout(function(){Object(o.a)(t,[c]),(i>0&&c<i||i<0&&c>i)&&s>0?n(s-e,c+r):Object(o.a)(t,[i])},e)}(n,0)}},"4qRk":function(t,e,n){"use strict";e.a=function(t){t&&!t.install&&(t.install=function(e){var n=t.name||"",o=e.component(n);o||e.component(n,t)});return t}},"5fCB":function(t,e,n){"use strict";var o=n("E5mE"),i=n("eY/N");e.a=function t(){for(var e=!0,n=void 0,r=arguments.length,s=Array(r),c=0;c<r;c++)s[c]=arguments[c];if(s instanceof Array&&(n=s.slice(0,1)[0]),"boolean"==typeof n&&(e=n,s.splice(0,1),e||(n=s.splice(0,1)[0])),s&&s.length<1)return"boolean"==typeof n?s[1]:n;e&&(n=null);for(var a=0;a<s.length;a++){var u=s[a];if(u instanceof Object)if(e){for(var f in n&&n instanceof Object||(n=u instanceof Array?[]:{}),u)if(u.hasOwnProperty(f)){var l=u[f];if(p(l)){var h=p(n[f])&&n[f]||(l instanceof Array?[]:{});n[f]=t(h,l)}else void 0!==l?n[f]=l:void 0!==n[f]&&(n[f]=l)}}else n=n&&n instanceof Object?Object.assign(n,u):u}return n;function p(t){return t&&(Object(o.a)(t,"Array")||Object(i.a)(t))||!1}}},"B/FW":function(t,e){},E5mE:function(t,e,n){"use strict";e.a=function(t,e){var n=!1;try{n=Object.prototype.toString.call(t)==="[object "+e+"]"}catch(t){}return n}},FNmr:function(t,e,n){"use strict";e.a=function(t,e){var n="";if(t&&e)if(e.name){var i="$s"+(n=Object(o.a)(e.name));t.prototype&&!t.prototype[i]&&function(t,e,n){if(t&&e&&n){t[n]=e;try{Object.defineProperty(t,n,{get:function(){var t=this;return e._getParent=function(){return t},e},enumerable:!1,configurable:!1})}catch(t){}}}(t.prototype,e,i)}else console.error("Mount is not defined for the image name");return n};var o=n("0Zk/")},HDd3:function(t,e,n){"use strict";var o={extends:n("Lv3q").a},i=n("VU/8")(o,null,!1,null,null,null);e.a=i.exports},Hxsb:function(t,e,n){"use strict";e.a=function(t,e){var n;e=e||{};var r={};r[t=(t||"")+""]=e.value||{};var s="my"+Object(i.a)(t);return{props:r,data:function(){var n={};return n[s]=Object(o.a)(e.myValueInit||this[t],[this[t]],this),n},watch:(n={},n[t]=function(t,n){var i=Object(o.a)(e.mValueChange,[t,n],this);!1!==i&&(this[s]=t)},n[s]=function(n,i){var r=Object(o.a)(e.myValueChange,[n,i],this);!1!==r&&this.$emit("update:"+t,n)},n)}};var o=n("ekq3"),i=n("WGR+")},I3JS:function(t,e,n){"use strict";var o,i=n("qd2b"),r=n("Krqh"),s=n("fk+x"),c=n("MEnT");!function(t){t.ITEM_MOVE="itemmove"}(o||(o={}));var a=function(t){function e(n){!function(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}(this,e);var o=function(t,e){if(!t)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return!e||"object"!=typeof e&&"function"!=typeof e?t:e}(this,t.call(this,n));return o.name="NavIndex",o._maxHeight=0,o._minHeight=0,o._offsetList=null,o.refresh(),o}return function(t,e){if("function"!=typeof e&&null!==e)throw new TypeError("Super expression must either be null or a function, not "+typeof e);t.prototype=Object.create(e&&e.prototype,{constructor:{value:t,enumerable:!1,writable:!0,configurable:!0}}),e&&(Object.setPrototypeOf?Object.setPrototypeOf(t,e):t.__proto__=e)}(e,t),e.prototype.refresh=function(t){this._maxHeight=0,this._minHeight=0,this._offsetList=t&&this._initListOffset(t,!0)||null},e.prototype.getItem=function(t,e){return(this._initListOffset(e)||[])[t]||{}},e.prototype.getScrollTop=function(t){var e=this._initListOffset(t),n=e&&e[0],o=0,i=void 0;if(n){var r=n.el,a=this._isFixed;for(void 0===a&&(a=r&&r.offsetParent&&"fixed"===Object(s.a)(r.offsetParent,"position")||!1),this._isFixed=a,a&&(r=document.body);r;)o+=(r=Object(c.a)(r))&&(r.scrollTop||r.scrollY||0)||0,i=r,r=r.parentNode;o=(a?0-o:o)||0}return{scrollTop:o,el:i,isFixed:!!this._isFixed}},e.prototype.getIndex=function(t,e){t=t||0;var n=this._initListOffset(e)||[],i=n[0]||{},r=i&&i.top||0,s=n.length||0,c=this._getRegion(t-r,this._minHeight,this._maxHeight),a=Math.min(Math.max(s,1),c.endIndex),u=Math.max(0,Math.min(c.startIndex,a-1)),f=this._calcIndex(u,a-1,t,n);null===f&&(n[0]&&(n[0].bottom||0)>=t?f=0:n[s-1]&&(n[s-1].bottom||0)<=t&&(f=s-1));var l=n&&n[f||0];if(l){var h=(l.bottom||0)-t,p=(l.top||0)-t;this.$emit(o.ITEM_MOVE,{index:f,top:Math.min(p,0),bottom:Math.max(h,0)})}return f||0},e.prototype._initListOffset=function(t,e){var n=this._offsetList;return!e&&n&&n.length?n:(n=t&&this._getListOffset(t)||null,this._offsetList=n,n)},e.prototype._getListOffset=function(t){var e=this,n=t||[],o=[];return n&&n.length&&n.forEach(function(t,n){var i=t.$el||t,s={};if(i){var c=i.offsetHeight,a=0;s={top:a=0===n?Object(r.a)(i):o[n-1].bottom||0,height:c,bottom:a+c,el:i}}s.height&&((e._maxHeight||0)<s.height&&(e._maxHeight=s.height),(!e._minHeight||e._minHeight>s.height)&&(e._minHeight=s.height)),o.push(s)}),o},e.prototype._getRegion=function(t,e,n){e=e||1,n=n||1,t=t||0;var o=Math.floor(t/n-.5),i=Math.ceil(t/e+.5);return{startIndex:Math.max(Math.min(o,i-1),0),endIndex:Math.max(i,1)}},e.prototype._calcIndex=function(t,e,n,o){var i=null,r=Math.ceil((e-t)/2);if(e>=t&&e>=0&&t>=0&&o&&o.length)if(r>1){var s=t+r,c=o[s];c.top<=n&&c.bottom>n?i=s:c.top>n&&o[t].top<=n?i=o[t].bottom>n?t:this._calcIndex(t,s-1,n,o):c.bottom<=n&&o[e].bottom>n&&(i=o[e].top<=n?e:this._calcIndex(s+1,e-1,n,o))}else if(r>=0)for(var a=t;a<=e;a++){var u=o[a];if(u.top<=n&&u.bottom>n){i=a;break}}return i},e}(i.a);e.a=function(t){return a.instance(t)}},KUZl:function(t,e,n){"use strict";Object.defineProperty(e,"__esModule",{value:!0});var o=n("2tHm"),i=n("I3JS"),r=n("ekq3"),s={extends:n("HDd3").a},c=n("VU/8")(s,null,!1,null,null,null).exports,a=n("Hxsb"),u={extends:c,props:{nameText:{},itemkey:{},isNavTouch:{}},mixins:[Object(a.a)("activeIndex",{mValueChange:function(t){t===this.itemkey&&this.$emit("checked",{itemkey:t})}})],computed:{myName:function(){var t=this.nameText;return void 0===t&&(t=this.itemkey),t}},methods:{_click:function(t){this._onClick(t),this.myActiveIndex=this.itemkey},_tap:function(t){this._onTap(t),this.myActiveIndex=this.itemkey},_onMouseover:function(){this.$emit("selectChange",this.itemkey)},_onTouchStart:function(t){this.isNavTouch&&(this.myActiveIndex=this.itemkey),this.$emit("touchstart",t)},_onTouchMove:function(t){this.$emit("touchmove",t)}}},f={render:function(){var t=this,e=t.$createElement;return(t._self._c||e)("li",{staticClass:"nus_nav-item",class:[t.activeIndex===t.itemkey&&"nu_active"],on:{click:t._click,tap:t._tap,mouseover:function(e){e.stopPropagation(),e.preventDefault(),t._onMouseover(e)},touchmove:t._onTouchMove,touchstart:t._onTouchStart}},[t._t("default",[t._v("\n "+t._s(t.myName||"")+"\n ")])],2)},staticRenderFns:[]};var l=n("VU/8")(u,f,!1,function(t){n("X5jY")},null,null).exports,h={name:"NuScrollnav",extends:c,props:{list:{type:Array},filterKey:{type:Function},isNavTouch:{default:!0}},components:{navItem:l},mixins:[Object(a.a)("activeIndex")],watch:{list:function(){var t=this;t.$nextTick(function(){t.indexList.refresh(t.$refs.hook_navItems)})}},created:function(){this.indexList=Object(i.a)()},mounted:function(){var t=this;t.$nextTick(function(){t.indexList.refresh(t.$refs.hook_navItems),!t.activeIndex&&t._toActiveIndex(0)}),t.resize=function(){t.indexList.refresh(t.$refs.hook_navItems)},setTimeout(function(){t.indexList.refresh(t.$refs.hook_navItems)},200),window.addEventListener("resize",t.resize)},beforeDestroy:function(){window.removeEventListener("resize",this.resize),window.removeEventListener("mouseup",this._setMouseStart)},methods:{_filterKey:function(t,e){var n=e;return t&&void 0!==t.index&&(n=t.index),Object(r.a)(this.filterKey||n,[t,e])},_onChecked:function(t){var e=this,n=e.indexList.getItem(0),i=e.indexList.getItem(t||0).top-n.top+n.height/2-e.$el.offsetHeight/2,r=e.$el.scrollTop;Object(o.a)(function(t){e.$el.scrollTop=r+t},10,200,i-r)},_onMousedown:function(){var t=this;t.isNavTouch&&(t._mouseStart=!0,t._setMouseStart=t._setMouseStart||function(){t._mouseStart=!1,window.removeEventListener("mouseup",t._setMouseStart)},window.addEventListener("mouseup",t._setMouseStart))},_selectChange:function(t){this._mouseStart&&(this.myActiveIndex=t)},_toActiveIndex:function(t){this.myIndex!==t&&(this.myIndex=t,this.myActiveIndex=this._filterKey(this.list&&this.list[t],t))},_getEvent:function(t){return t.touches&&t.touches[0]||t},_onTouchStart:function(){this.isNavTouch&&(this.myIndex=null,this._scrollTop=this._getScrollTop(!0))},_onTouchMove:function(t){if(this.isNavTouch){t.preventDefault(),t.stopPropagation();var e=(t=this._getEvent(t)).pageY;if(Math.abs((this.pageY||0)-e)>4){this._scrollTop=this._getScrollTop(),this.pageY=e;var n=this.indexList.getIndex(e+this._scrollTop);this._toActiveIndex(n)}}},_getScrollTop:function(t){if(t||"number"!=typeof this._scrollTop||this._scrollEl===window){var e=this.indexList.getScrollTop()||{};this._scrollTop=this._hasWinScroll(t)&&e.isFixed||!this._hasWinScroll(t)&&!e.isFixed?0:e.scrollTop,this._scrollEl=e.el}return this._scrollTop||0},_hasWinScroll:function(t){(t||"boolean"!=typeof this._isWinScroll)&&((document.body.scrollHeight||document.documentElement.scrollHeight)<=window.innerHeight-5?this._isWinScroll=!0:this._isWinScroll=!1);return!!this._isWinScroll}}},p={render:function(){var t=this,e=t.$createElement,n=t._self._c||e;return t.list&&t.list.length?n("ul",{staticClass:"nus_scrollnav",on:{mousedown:t._onMousedown,touchmove:t._onTouchMove,touchstart:t._onTouchStart}},[t._l(t.list,function(e,o){return[n("nav-item",{key:o,ref:"hook_navItems",refInFor:!0,staticClass:"nu_nav-item",attrs:{activeIndex:t.myActiveIndex,itemkey:t._filterKey(e,o),nameText:e.navName,isNavTouch:t.isNavTouch},on:{"update:activeIndex":function(e){t.myActiveIndex=e},checked:function(e){t._onChecked(o)},selectChange:t._selectChange}},[t._t("default",null,{itemIndex:o,itemData:e,isNavTouch:t.isNavTouch,filterKey:t.filterKey})],2)]})],2):t._e()},staticRenderFns:[]};var v=n("VU/8")(h,p,!1,function(t){n("oixg")},null,null).exports,d=n("4qRk");e.default=Object(d.a)(v)},Krqh:function(t,e,n){"use strict";e.a=function(t){var e=t.offsetTop;t=t.offsetParent;for(;null!=t;)e+=t.offsetTop,t=t.offsetParent;return e}},Lv3q:function(t,e,n){"use strict";n("B/FW");var o=n("VU/8")({methods:{_onClick:function(t){this.$emit("click",t)},_onTap:function(t){this.$emit("tap",t)},_onClickItem:function(t){this.$emit("clickItem",t)}}},null,!1,null,null,null);e.a=o.exports},MEnT:function(t,e,n){"use strict";e.a=function(t){if("undefined"==typeof HTMLElement||!(t instanceof HTMLElement))return window;var e=t;for(;e&&e!==document.body&&e!==document.documentElement;){if(e!==t){if(e._isScroll)return e;if(!e.parentNode)break;if(!1!==e._isScroll){if(/(scroll|auto)/.test(i(e)))return e._isScroll=!0,e;e._isScroll=!1}}e=e.parentNode}return window};var o=n("fk+x");function i(t){return Object(o.a)(t,"overflow")+Object(o.a)(t,"overflow-y")+Object(o.a)(t,"overflow-x")}},"VU/8":function(t,e){t.exports=function(t,e,n,o,i,r){var s,c=t=t||{},a=typeof t.default;"object"!==a&&"function"!==a||(s=t,c=t.default);var u,f="function"==typeof c?c.options:c;if(e&&(f.render=e.render,f.staticRenderFns=e.staticRenderFns,f._compiled=!0),n&&(f.functional=!0),i&&(f._scopeId=i),r?(u=function(t){(t=t||this.$vnode&&this.$vnode.ssrContext||this.parent&&this.parent.$vnode&&this.parent.$vnode.ssrContext)||"undefined"==typeof __VUE_SSR_CONTEXT__||(t=__VUE_SSR_CONTEXT__),o&&o.call(this,t),t&&t._registeredComponents&&t._registeredComponents.add(r)},f._ssrRegister=u):o&&(u=o),u){var l=f.functional,h=l?f.render:f.beforeCreate;l?(f._injectStyles=u,f.render=function(t,e){return u.call(e),h(t,e)}):f.beforeCreate=h?[].concat(h,u):[u]}return{esModule:s,exports:c,options:f}}},"WGR+":function(t,e,n){"use strict";var o=n("0Zk/");e.a=o.a},X5jY:function(t,e){},XAAj:function(t,e,n){"use strict";e.a=function(t){var e=document.createEvent("undefined"!=typeof MouseEvent?"MouseEvents":"Event");return e.initEvent(t,!0,!1),e}},Z05q:function(t,e,n){"use strict";e.a=function(t,e,n){if(t&&(t.tagName||t===window||t===document)&&e&&"string"==typeof e){var r=Object(o.a)(e);r._constructed=!0,r=Object(i.a)(!1,r,n),t.dispatchEvent(r)}};var o=n("XAAj"),i=n("5fCB")},"eY/N":function(t,e,n){"use strict";e.a=function(t){if(!Object(o.a)(t,"Object"))return!1;var e=Object.getPrototypeOf(t);if(!e)return!0;var n=i.call(e,"constructor")&&e.constructor;return"function"==typeof n&&i.toString.call(n)===i.toString.call(Object)};var o=n("E5mE"),i=Object.prototype.hasOwnProperty},ekq3:function(t,e,n){"use strict";var o=n("zagf");e.a=o.a},"fk+x":function(t,e,n){"use strict";e.a=function(t,e){return("undefined"!=typeof getComputedStyle?getComputedStyle(t,null).getPropertyValue(e):t.style[e])||""}},lXuC:function(t,e,n){"use strict";e.a=function(t,e){var n="("+(e||"_|-")+")";return t=(t=(t=(t+"").replace(new RegExp(n+"?(?:(?:[A-Z]{2,}[A-Z]"+n+"*$)|(?:[A-Z]{2,}(?=[A-Z])))","g"),function(t){return(((e||"")+"").split("|")[0]||"-")+(t=t.replace(new RegExp(n),"")).toLowerCase()})).replace(new RegExp("(?:^"+n+"?([a-z]))|(?:"+n+"$)","gi"),function(t,e,n){return(n||"").toLowerCase()})).replace(new RegExp(n+"([a-z])","gi"),function(t,e,n){return(n||"").toUpperCase()})}},oixg:function(t,e){},qd2b:function(t,e,n){"use strict";var o=n("5fCB"),i=n("Z05q"),r=n("zagf");var s=function(){function t(){!function(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}(this,t),this._events={}}return t.prototype.$dispatchEvent=function(t,e,n){return Object(i.a)(t,e,n)},t.prototype.$on=function(t,e){var n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:this;this._events=this._events||{},this._events[t]=this._events[t]||[],this._events[t].push([e,n])},t.prototype.$once=function(t,e){var n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:this,o=this,i=!1,r=function r(){o.$off(t,r),i||(i=!0,e.apply(n,arguments))};r.fn=e,o.$on(t,r)},t.prototype.$off=function(t,e){var n=this._events&&this._events[t];if(n)for(var o=n.length;o--;)(n[o][0]===e||n[o][0]&&n[o][0].fn===e)&&(n[o][0]=void 0)},t.prototype.$emit=function(t){var e=this._events&&this._events[t];if(e){for(var n=e.length,o=[].concat(e),i=arguments.length,s=Array(i>1?i-1:0),c=1;c<i;c++)s[c-1]=arguments[c];for(var a=0;a<n;a++){var u=o[a],f=u[0],l=u[1];Object(r.a)(f,s,l)}}},t}(),c=n("FNmr");n.d(e,"a",function(){return a});var a=function(t){function e(n){!function(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}(this,e);var o=function(t,e){if(!t)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return!e||"object"!=typeof e&&"function"!=typeof e?t:e}(this,t.call(this));return o.name="",o.defaultOption={},o.setDefaultOptions(!0,n),o}return function(t,e){if("function"!=typeof e&&null!==e)throw new TypeError("Super expression must either be null or a function, not "+typeof e);t.prototype=Object.create(e&&e.prototype,{constructor:{value:t,enumerable:!1,writable:!0,configurable:!0}}),e&&(Object.setPrototypeOf?Object.setPrototypeOf(t,e):t.__proto__=e)}(e,t),e.singleton=function(t){var e=this._singleton||this.instance(t);return this._singleton=e,e},e.instance=function(t){return new this(t)},e.install=function(t,e){var n=this.instance(e);return t&&t.use instanceof Function&&t.use(n,e),n},e.prototype.getParent=function(){return Object(r.a)(this._getParent||this._vue&&this._vue.prototype||null,[],this)},e.prototype.install=function(t,e){this._vue=this._vue||t;var n=Object(c.a)(t,this);return this.setDefaultOptions(e&&n&&e[n]||e),this},e.prototype.setDefaultOptions=function(t){var e=void 0,n=!0;"boolean"==typeof t?(n=t,e=arguments[1]||{}):e=t,e&&(this.defaultOption=Object(o.a)(n,this.defaultOption||{},e))},e.prototype.getOptions=function(){for(var t=[{},this.defaultOption||{}],e=!0,n=arguments.length,i=Array(n),r=0;r<n;r++)i[r]=arguments[r];return"boolean"==typeof i[0]&&(e=i[0],i.splice(0,1)),i&&i.length>0&&(t=t.concat(i)),o.a.apply(void 0,[e].concat(t))},e.prototype.preload=function(){var t=this;return new Promise(function(e,n){e(t)})},e}(s)},zagf:function(t,e,n){"use strict";e.a=function(t,e,n){var o=t;t instanceof Function&&(o=t.apply(n,e));return o}}});