From f50330a878849f10da84fddcaf632ca9b92644e1 Mon Sep 17 00:00:00 2001 From: milewski Date: Fri, 6 Dec 2019 12:36:33 +0800 Subject: [PATCH] tweak css style --- dist/js/filter.js | 2 +- resources/js/components/PillFilter.vue | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/dist/js/filter.js b/dist/js/filter.js index 606fbe6..bbef1d7 100644 --- a/dist/js/filter.js +++ b/dist/js/filter.js @@ -1 +1 @@ -!function(t){var e={};function i(n){if(e[n])return e[n].exports;var o=e[n]={i:n,l:!1,exports:{}};return t[n].call(o.exports,o,o.exports,i),o.l=!0,o.exports}i.m=t,i.c=e,i.d=function(t,e,n){i.o(t,e)||Object.defineProperty(t,e,{configurable:!1,enumerable:!0,get:n})},i.n=function(t){var e=t&&t.__esModule?function(){return t.default}:function(){return t};return i.d(e,"a",e),e},i.o=function(t,e){return Object.prototype.hasOwnProperty.call(t,e)},i.p="",i(i.s=1)}([function(t,e){t.exports=function(t,e,i,n,o,s){var r,c=t=t||{},l=typeof t.default;"object"!==l&&"function"!==l||(r=t,c=t.default);var h,a="function"==typeof c?c.options:c;if(e&&(a.render=e.render,a.staticRenderFns=e.staticRenderFns,a._compiled=!0),i&&(a.functional=!0),o&&(a._scopeId=o),s?(h=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__),n&&n.call(this,t),t&&t._registeredComponents&&t._registeredComponents.add(s)},a._ssrRegister=h):n&&(h=n),h){var u=a.functional,p=u?a.render:a.beforeCreate;u?(a._injectStyles=h,a.render=function(t,e){return h.call(e),p(t,e)}):a.beforeCreate=p?[].concat(p,h):[h]}return{esModule:r,exports:c,options:a}}},function(t,e,i){t.exports=i(2)},function(t,e,i){Nova.booting(function(t,e,n){t.component("pill-filter",i(3))})},function(t,e,i){var n=i(0)(i(4),i(9),!1,null,null,null);t.exports=n.exports},function(t,e,i){"use strict";Object.defineProperty(e,"__esModule",{value:!0});var n=i(5),o=i.n(n),s=i(8),r=i.n(s);e.default={name:"PillFilter",components:{Pill:o.a},props:{resourceName:{type:String,required:!0},filterKey:{type:String,required:!0}},mounted:function(){var t=this;if("drag"===this.filter.mode){var e=new r.a({viewport:this.$refs.viewport,mode:"x",emulateScroll:!0,textSelection:!0,onUpdate:function(e){t.$refs.content.style.transform="translateX("+-e.position.x+"px)"}});this.$on("beforeDestroy",function(){return e.destroy()})}},methods:{setFilter:function(t){this.$store.commit(this.resourceName+"/updateFilterState",{filterClass:this.filterKey,value:t}),this.$emit("change")},clearFilters:function(){this.setFilter([])},enableFilter:function(t){if(this.filter.single)return this.setFilter([t]);this.currentActive.includes(t)?this.currentActive.splice(this.currentActive.indexOf(t),1):this.currentActive.push(t),this.setFilter(this.currentActive)}},computed:{filter:function(){return this.$store.getters[this.resourceName+"/getFilter"](this.filterKey)},currentActive:function(){return this.filter.currentValue||[]}}}},function(t,e,i){var n=i(0)(i(6),i(7),!1,null,null,null);t.exports=n.exports},function(t,e,i){"use strict";Object.defineProperty(e,"__esModule",{value:!0}),e.default={name:"Pill",props:{active:{type:Boolean,required:!0}}}},function(t,e){t.exports={render:function(){var t=this.$createElement;return(this._self._c||t)("div",{staticClass:"rounded-lg cursor-pointer dim text-sm p-2 px-4 mr-2 mt-2 select-none whitespace-no-wrap",class:{"bg-primary text-white":this.active,"bg-20":!this.active}},[this._t("default")],2)},staticRenderFns:[]}},function(t,e,i){var n;"undefined"!=typeof self&&self,n=function(){return function(t){function e(n){if(i[n])return i[n].exports;var o=i[n]={i:n,l:!1,exports:{}};return t[n].call(o.exports,o,o.exports,e),o.l=!0,o.exports}var i={};return e.m=t,e.c=i,e.d=function(t,i,n){e.o(t,i)||Object.defineProperty(t,i,{configurable:!1,enumerable:!0,get:n})},e.n=function(t){var i=t&&t.__esModule?function(){return t.default}:function(){return t};return e.d(i,"a",i),i},e.o=function(t,e){return Object.prototype.hasOwnProperty.call(t,e)},e.p="/dist/",e(e.s=0)}([function(t,e,i){"use strict";function n(t){return Math.max(t.offsetWidth,t.scrollWidth)}function o(t){return Math.max(t.offsetHeight,t.scrollHeight)}Object.defineProperty(e,"__esModule",{value:!0});var s=Object.assign||function(t){for(var e=1;e0&&void 0!==arguments[0]?arguments[0]:{};if(function(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}(this,t),e.viewport&&e.viewport instanceof Element){var i={handle:e.viewport,content:e.viewport.children[0],bounce:!0,friction:.05,bounceForce:.1,textSelection:!1,onClick:function(){},shouldScroll:function(){return!0},onUpdate:function(){}};this.props=s({},i,e),this.props.content?(this.viewport={width:this.props.viewport.clientWidth,height:this.props.viewport.clientHeight},this.content={width:n(this.props.content),height:o(this.props.content)},this.position={x:0,y:0},this.velocity={x:0,y:0},this.friction=1-this.props.friction,this.bounceForce=this.props.bounceForce,this.isDragging=!1,this.dragStartPosition={x:0,y:0},this.dragOffsetPosition=s({},this.dragStartPosition),this.dragPosition=s({},this.position),this.isScrollEnabled=!!this.props.emulateScroll,this.isScrolling=!1,this.scrollOffset={x:0,y:0},this.bounce=this.props.bounce,this.textSelection=this.props.textSelection,this.boundX={from:Math.min(-this.content.width+this.viewport.width,0),to:0},this.boundY={from:Math.min(-this.content.height+this.viewport.height,0),to:0},this.mode={x:"x"==this.props.mode,y:"y"==this.props.mode,xy:"x"!==this.props.mode&&"y"!==this.props.mode},this.isRunning=!1,this.rafID=null,this.events={},this.animate(),this.handleEvents()):console.error("Viewport does not have any content")}else console.error('"viewport" config property must be present and must be Element')}return r(t,[{key:"run",value:function(){var t=this;this.isRunning=!0,cancelAnimationFrame(this.rafID),this.rafID=requestAnimationFrame(function(){return t.animate()})}},{key:"animate",value:function(){var t=this;this.isRunning&&(this.update(),this.notify(),this.rafID=requestAnimationFrame(function(){return t.animate()}))}},{key:"update",value:function(){this.applyBoundForce(),this.applyDragForce(),this.applyScrollForce(),this.velocity.x*=this.friction,this.velocity.y*=this.friction,this.mode.y||(this.position.x+=this.velocity.x),this.mode.x||(this.position.y+=this.velocity.y),this.bounce&&!this.isScrolling||(this.position.x=Math.max(Math.min(this.position.x,this.boundX.to),this.boundX.from),this.position.y=Math.max(Math.min(this.position.y,this.boundY.to),this.boundY.from)),!this.isDragging&&!this.isScrolling&&Math.abs(this.velocity.x)<.1&&Math.abs(this.velocity.y)<.1&&(this.isRunning=!1)}},{key:"applyForce",value:function(t){this.velocity.x+=t.x,this.velocity.y+=t.y}},{key:"applyBoundForce",value:function(){if(this.bounce&&!this.isDragging){var t=this.position.xthis.boundX.to,i=this.position.ythis.boundY.to,o={x:0,y:0};if(t||e){var s=(t?this.boundX.from:this.boundX.to)-this.position.x,r=s*this.bounceForce,c=this.position.x+(this.velocity.x+r)/(1-this.friction);t&&cthis.boundX.to||(r=s*this.bounceForce-this.velocity.x),o.x=r}if(i||n){var l=(i?this.boundY.from:this.boundY.to)-this.position.y,h=l*this.bounceForce,a=this.position.y+(this.velocity.y+h)/(1-this.friction);i&&athis.boundY.to||(h=l*this.bounceForce-this.velocity.y),o.y=h}this.applyForce(o)}}},{key:"applyDragForce",value:function(){if(this.isDragging){var t={x:this.dragPosition.x-this.position.x,y:this.dragPosition.y-this.position.y},e={x:t.x-this.velocity.x,y:t.y-this.velocity.y};this.applyForce(e)}}},{key:"applyScrollForce",value:function(){if(this.isScrolling){var t={x:this.scrollOffset.x-this.velocity.x,y:this.scrollOffset.y-this.velocity.y};this.scrollOffset.x=0,this.scrollOffset.y=0,this.applyForce(t)}}},{key:"setPosition",value:function(){var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};this.velocity.x=0,this.velocity.y=0,this.position.x=-t.x||0,this.position.y=-t.y||0,this.run()}},{key:"getUpdate",value:function(){return{isRunning:this.isRunning,isDragging:this.isDragging,isScrolling:this.isScrolling,position:{x:-this.position.x,y:-this.position.y},dragOffsetPosition:this.dragOffsetPosition,viewport:s({},this.viewport),content:s({},this.content)}}},{key:"notify",value:function(){this.props.onUpdate(this.getUpdate())}},{key:"updateMetrics",value:function(){this.viewport.width=this.props.viewport.clientWidth,this.viewport.height=this.props.viewport.clientHeight,this.content.width=n(this.props.content),this.content.height=o(this.props.content),this.boundX.from=Math.min(-this.content.width+this.viewport.width,0),this.boundY.from=Math.min(-this.content.height+this.viewport.height,0),this.run()}},{key:"handleEvents",value:function(){var t=this,e=this.props.viewport,i={x:0,y:0},n={x:0,y:0},o=!1,s=function(e){var i=void 0,s=void 0;o?(i=e.touches[0].pageX,s=e.touches[0].pageY):(i=e.pageX,s=e.pageY),t.dragOffsetPosition.x=i-n.x,t.dragOffsetPosition.y=s-n.y,t.dragPosition.x=t.dragStartPosition.x+t.dragOffsetPosition.x,t.dragPosition.y=t.dragStartPosition.y+t.dragOffsetPosition.y,o||e.preventDefault()};this.events.pointerdown=function(r){var c=void 0,l=void 0,h=void 0,a=void 0;(o=!(!r.touches||!r.touches[0]))?(c=r.touches[0].pageX,l=r.touches[0].pageY,h=r.touches[0].clientX,a=r.touches[0].clientY):(c=r.pageX,l=r.pageY,h=r.clientX,a=r.clientY);var u=e.getBoundingClientRect();if(!(h-u.left>=e.clientLeft+e.clientWidth)&&!(a-u.top>=e.clientTop+e.clientHeight)&&t.props.shouldScroll(t.getUpdate(),r)){if(t.textSelection){if(function(t,e,i){for(var n=void 0,o=t.childNodes,s=document.createRange(),r=0;n=o[r],r=c.left&&i>=c.top&&e<=c.right&&i<=c.bottom)return n}return!1}(r.target,h,a))return;!function(){var t=window.getSelection?window.getSelection():document.selection;t&&(t.removeAllRanges?t.removeAllRanges():t.empty&&t.empty())}()}t.isDragging=!0,(i.x||i.y)&&(t.position.x=i.x,t.position.y=i.y,i.x=0,i.y=0),n.x=c,n.y=l,t.dragStartPosition.x=t.position.x,t.dragStartPosition.y=t.position.y,s(r),t.run();var p,f=void 0;p=function(e){t.isDragging=!1,o?(window.removeEventListener("touchmove",s),window.removeEventListener("touchend",f)):(window.removeEventListener("mousemove",s),window.removeEventListener("mouseup",f))},o?(f=window.addEventListener("touchend",p),window.addEventListener("touchmove",s)):(f=window.addEventListener("mouseup",p),window.addEventListener("mousemove",s))}};var r=null;this.events.wheel=function(e){t.velocity.x=0,t.isScrollEnabled&&(t.isScrolling=!0,t.scrollOffset.x=-e.deltaX,t.scrollOffset.y=-e.deltaY,t.run(),clearTimeout(r),r=setTimeout(function(){return t.isScrolling=!1},80),e.preventDefault())},this.events.scroll=function(e){var n=t.props.viewport.scrollLeft,o=t.props.viewport.scrollTop;Math.abs(t.position.x+n)>3&&(t.position.x=-n,t.velocity.x=0),Math.abs(t.position.y+o)>3&&(t.position.y=-o,t.velocity.y=0),i.x=-t.props.viewport.scrollLeft,i.y=-t.props.viewport.scrollTop},this.events.click=function(e){t.props.onClick(t.getUpdate(),e)},this.events.resize=this.updateMetrics.bind(this),this.props.handle.addEventListener("mousedown",this.events.pointerdown),this.props.handle.addEventListener("touchstart",this.events.pointerdown),this.props.handle.addEventListener("click",this.events.click),this.props.viewport.addEventListener("wheel",this.events.wheel),this.props.viewport.addEventListener("scroll",this.events.scroll),window.addEventListener("resize",this.events.resize)}},{key:"destroy",value:function(){this.props.handle.removeEventListener("mousedown",this.events.pointerdown),this.props.handle.removeEventListener("touchstart",this.events.pointerdown),this.props.handle.removeEventListener("click",this.events.click),this.props.viewport.removeEventListener("wheel",this.events.wheel),this.props.viewport.removeEventListener("scroll",this.events.scroll),window.removeEventListener("resize",this.events.resize)}}]),t}();e.default=c,t.exports=e.default}])},t.exports=n()},function(t,e){t.exports={render:function(){var t=this,e=t.$createElement,i=t._self._c||e;return i("div",{ref:"viewport",staticClass:"overflow-hidden"},[i("div",[i("h3",{staticClass:"text-sm uppercase tracking-wide text-80 bg-30 p-3"},[t._v("\n "+t._s(t.filter.name)+"\n ")]),t._v(" "),i("div",{ref:"content",staticClass:"flex p-2 -mt-2",class:{"flex-wrap":"wrap"===t.filter.mode}},[t.filter.showSelectNoneButton?i("Pill",{attrs:{active:0===t.currentActive.length},nativeOn:{click:function(e){return t.clearFilters()}}},[t._v("\n\n "+t._s(t.filter.noneLabel)+"\n\n ")]):t._e(),t._v(" "),t._l(t.filter.options,function(e){return i("Pill",{key:e.value,attrs:{active:t.currentActive.includes(e.value)},nativeOn:{click:function(i){return t.enableFilter(e.value)}}},[t._v("\n\n "+t._s(e.name)+"\n\n ")])})],2)])])},staticRenderFns:[]}}]); \ No newline at end of file +!function(t){var e={};function i(n){if(e[n])return e[n].exports;var o=e[n]={i:n,l:!1,exports:{}};return t[n].call(o.exports,o,o.exports,i),o.l=!0,o.exports}i.m=t,i.c=e,i.d=function(t,e,n){i.o(t,e)||Object.defineProperty(t,e,{configurable:!1,enumerable:!0,get:n})},i.n=function(t){var e=t&&t.__esModule?function(){return t.default}:function(){return t};return i.d(e,"a",e),e},i.o=function(t,e){return Object.prototype.hasOwnProperty.call(t,e)},i.p="",i(i.s=1)}([function(t,e){t.exports=function(t,e,i,n,o,s){var r,c=t=t||{},l=typeof t.default;"object"!==l&&"function"!==l||(r=t,c=t.default);var h,a="function"==typeof c?c.options:c;if(e&&(a.render=e.render,a.staticRenderFns=e.staticRenderFns,a._compiled=!0),i&&(a.functional=!0),o&&(a._scopeId=o),s?(h=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__),n&&n.call(this,t),t&&t._registeredComponents&&t._registeredComponents.add(s)},a._ssrRegister=h):n&&(h=n),h){var u=a.functional,p=u?a.render:a.beforeCreate;u?(a._injectStyles=h,a.render=function(t,e){return h.call(e),p(t,e)}):a.beforeCreate=p?[].concat(p,h):[h]}return{esModule:r,exports:c,options:a}}},function(t,e,i){t.exports=i(2)},function(t,e,i){Nova.booting(function(t,e,n){t.component("pill-filter",i(3))})},function(t,e,i){var n=i(0)(i(4),i(9),!1,null,null,null);t.exports=n.exports},function(t,e,i){"use strict";Object.defineProperty(e,"__esModule",{value:!0});var n=i(5),o=i.n(n),s=i(8),r=i.n(s);e.default={name:"PillFilter",components:{Pill:o.a},props:{resourceName:{type:String,required:!0},filterKey:{type:String,required:!0}},mounted:function(){var t=this;if("drag"===this.filter.mode){var e=new r.a({viewport:this.$refs.viewport,mode:"x",emulateScroll:!0,textSelection:!0,onUpdate:function(e){t.$refs.content.style.transform="translateX("+-e.position.x+"px)"}});this.$on("beforeDestroy",function(){return e.destroy()})}},methods:{setFilter:function(t){this.$store.commit(this.resourceName+"/updateFilterState",{filterClass:this.filterKey,value:t}),this.$emit("change")},clearFilters:function(){this.setFilter([])},enableFilter:function(t){if(this.filter.single)return this.setFilter([t]);this.currentActive.includes(t)?this.currentActive.splice(this.currentActive.indexOf(t),1):this.currentActive.push(t),this.setFilter(this.currentActive)}},computed:{filter:function(){return this.$store.getters[this.resourceName+"/getFilter"](this.filterKey)},currentActive:function(){return this.filter.currentValue||[]}}}},function(t,e,i){var n=i(0)(i(6),i(7),!1,null,null,null);t.exports=n.exports},function(t,e,i){"use strict";Object.defineProperty(e,"__esModule",{value:!0}),e.default={name:"Pill",props:{active:{type:Boolean,required:!0}}}},function(t,e){t.exports={render:function(){var t=this.$createElement;return(this._self._c||t)("div",{staticClass:"rounded-lg cursor-pointer dim text-sm p-2 px-4 mr-2 mt-2 select-none whitespace-no-wrap",class:{"bg-primary text-white":this.active,"bg-20":!this.active}},[this._t("default")],2)},staticRenderFns:[]}},function(t,e,i){var n;"undefined"!=typeof self&&self,n=function(){return function(t){function e(n){if(i[n])return i[n].exports;var o=i[n]={i:n,l:!1,exports:{}};return t[n].call(o.exports,o,o.exports,e),o.l=!0,o.exports}var i={};return e.m=t,e.c=i,e.d=function(t,i,n){e.o(t,i)||Object.defineProperty(t,i,{configurable:!1,enumerable:!0,get:n})},e.n=function(t){var i=t&&t.__esModule?function(){return t.default}:function(){return t};return e.d(i,"a",i),i},e.o=function(t,e){return Object.prototype.hasOwnProperty.call(t,e)},e.p="/dist/",e(e.s=0)}([function(t,e,i){"use strict";function n(t){return Math.max(t.offsetWidth,t.scrollWidth)}function o(t){return Math.max(t.offsetHeight,t.scrollHeight)}Object.defineProperty(e,"__esModule",{value:!0});var s=Object.assign||function(t){for(var e=1;e0&&void 0!==arguments[0]?arguments[0]:{};if(function(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}(this,t),e.viewport&&e.viewport instanceof Element){var i={handle:e.viewport,content:e.viewport.children[0],bounce:!0,friction:.05,bounceForce:.1,textSelection:!1,onClick:function(){},shouldScroll:function(){return!0},onUpdate:function(){}};this.props=s({},i,e),this.props.content?(this.viewport={width:this.props.viewport.clientWidth,height:this.props.viewport.clientHeight},this.content={width:n(this.props.content),height:o(this.props.content)},this.position={x:0,y:0},this.velocity={x:0,y:0},this.friction=1-this.props.friction,this.bounceForce=this.props.bounceForce,this.isDragging=!1,this.dragStartPosition={x:0,y:0},this.dragOffsetPosition=s({},this.dragStartPosition),this.dragPosition=s({},this.position),this.isScrollEnabled=!!this.props.emulateScroll,this.isScrolling=!1,this.scrollOffset={x:0,y:0},this.bounce=this.props.bounce,this.textSelection=this.props.textSelection,this.boundX={from:Math.min(-this.content.width+this.viewport.width,0),to:0},this.boundY={from:Math.min(-this.content.height+this.viewport.height,0),to:0},this.mode={x:"x"==this.props.mode,y:"y"==this.props.mode,xy:"x"!==this.props.mode&&"y"!==this.props.mode},this.isRunning=!1,this.rafID=null,this.events={},this.animate(),this.handleEvents()):console.error("Viewport does not have any content")}else console.error('"viewport" config property must be present and must be Element')}return r(t,[{key:"run",value:function(){var t=this;this.isRunning=!0,cancelAnimationFrame(this.rafID),this.rafID=requestAnimationFrame(function(){return t.animate()})}},{key:"animate",value:function(){var t=this;this.isRunning&&(this.update(),this.notify(),this.rafID=requestAnimationFrame(function(){return t.animate()}))}},{key:"update",value:function(){this.applyBoundForce(),this.applyDragForce(),this.applyScrollForce(),this.velocity.x*=this.friction,this.velocity.y*=this.friction,this.mode.y||(this.position.x+=this.velocity.x),this.mode.x||(this.position.y+=this.velocity.y),this.bounce&&!this.isScrolling||(this.position.x=Math.max(Math.min(this.position.x,this.boundX.to),this.boundX.from),this.position.y=Math.max(Math.min(this.position.y,this.boundY.to),this.boundY.from)),!this.isDragging&&!this.isScrolling&&Math.abs(this.velocity.x)<.1&&Math.abs(this.velocity.y)<.1&&(this.isRunning=!1)}},{key:"applyForce",value:function(t){this.velocity.x+=t.x,this.velocity.y+=t.y}},{key:"applyBoundForce",value:function(){if(this.bounce&&!this.isDragging){var t=this.position.xthis.boundX.to,i=this.position.ythis.boundY.to,o={x:0,y:0};if(t||e){var s=(t?this.boundX.from:this.boundX.to)-this.position.x,r=s*this.bounceForce,c=this.position.x+(this.velocity.x+r)/(1-this.friction);t&&cthis.boundX.to||(r=s*this.bounceForce-this.velocity.x),o.x=r}if(i||n){var l=(i?this.boundY.from:this.boundY.to)-this.position.y,h=l*this.bounceForce,a=this.position.y+(this.velocity.y+h)/(1-this.friction);i&&athis.boundY.to||(h=l*this.bounceForce-this.velocity.y),o.y=h}this.applyForce(o)}}},{key:"applyDragForce",value:function(){if(this.isDragging){var t={x:this.dragPosition.x-this.position.x,y:this.dragPosition.y-this.position.y},e={x:t.x-this.velocity.x,y:t.y-this.velocity.y};this.applyForce(e)}}},{key:"applyScrollForce",value:function(){if(this.isScrolling){var t={x:this.scrollOffset.x-this.velocity.x,y:this.scrollOffset.y-this.velocity.y};this.scrollOffset.x=0,this.scrollOffset.y=0,this.applyForce(t)}}},{key:"setPosition",value:function(){var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};this.velocity.x=0,this.velocity.y=0,this.position.x=-t.x||0,this.position.y=-t.y||0,this.run()}},{key:"getUpdate",value:function(){return{isRunning:this.isRunning,isDragging:this.isDragging,isScrolling:this.isScrolling,position:{x:-this.position.x,y:-this.position.y},dragOffsetPosition:this.dragOffsetPosition,viewport:s({},this.viewport),content:s({},this.content)}}},{key:"notify",value:function(){this.props.onUpdate(this.getUpdate())}},{key:"updateMetrics",value:function(){this.viewport.width=this.props.viewport.clientWidth,this.viewport.height=this.props.viewport.clientHeight,this.content.width=n(this.props.content),this.content.height=o(this.props.content),this.boundX.from=Math.min(-this.content.width+this.viewport.width,0),this.boundY.from=Math.min(-this.content.height+this.viewport.height,0),this.run()}},{key:"handleEvents",value:function(){var t=this,e=this.props.viewport,i={x:0,y:0},n={x:0,y:0},o=!1,s=function(e){var i=void 0,s=void 0;o?(i=e.touches[0].pageX,s=e.touches[0].pageY):(i=e.pageX,s=e.pageY),t.dragOffsetPosition.x=i-n.x,t.dragOffsetPosition.y=s-n.y,t.dragPosition.x=t.dragStartPosition.x+t.dragOffsetPosition.x,t.dragPosition.y=t.dragStartPosition.y+t.dragOffsetPosition.y,o||e.preventDefault()};this.events.pointerdown=function(r){var c=void 0,l=void 0,h=void 0,a=void 0;(o=!(!r.touches||!r.touches[0]))?(c=r.touches[0].pageX,l=r.touches[0].pageY,h=r.touches[0].clientX,a=r.touches[0].clientY):(c=r.pageX,l=r.pageY,h=r.clientX,a=r.clientY);var u=e.getBoundingClientRect();if(!(h-u.left>=e.clientLeft+e.clientWidth)&&!(a-u.top>=e.clientTop+e.clientHeight)&&t.props.shouldScroll(t.getUpdate(),r)){if(t.textSelection){if(function(t,e,i){for(var n=void 0,o=t.childNodes,s=document.createRange(),r=0;n=o[r],r=c.left&&i>=c.top&&e<=c.right&&i<=c.bottom)return n}return!1}(r.target,h,a))return;!function(){var t=window.getSelection?window.getSelection():document.selection;t&&(t.removeAllRanges?t.removeAllRanges():t.empty&&t.empty())}()}t.isDragging=!0,(i.x||i.y)&&(t.position.x=i.x,t.position.y=i.y,i.x=0,i.y=0),n.x=c,n.y=l,t.dragStartPosition.x=t.position.x,t.dragStartPosition.y=t.position.y,s(r),t.run();var p,f=void 0;p=function(e){t.isDragging=!1,o?(window.removeEventListener("touchmove",s),window.removeEventListener("touchend",f)):(window.removeEventListener("mousemove",s),window.removeEventListener("mouseup",f))},o?(f=window.addEventListener("touchend",p),window.addEventListener("touchmove",s)):(f=window.addEventListener("mouseup",p),window.addEventListener("mousemove",s))}};var r=null;this.events.wheel=function(e){t.velocity.x=0,t.isScrollEnabled&&(t.isScrolling=!0,t.scrollOffset.x=-e.deltaX,t.scrollOffset.y=-e.deltaY,t.run(),clearTimeout(r),r=setTimeout(function(){return t.isScrolling=!1},80),e.preventDefault())},this.events.scroll=function(e){var n=t.props.viewport.scrollLeft,o=t.props.viewport.scrollTop;Math.abs(t.position.x+n)>3&&(t.position.x=-n,t.velocity.x=0),Math.abs(t.position.y+o)>3&&(t.position.y=-o,t.velocity.y=0),i.x=-t.props.viewport.scrollLeft,i.y=-t.props.viewport.scrollTop},this.events.click=function(e){t.props.onClick(t.getUpdate(),e)},this.events.resize=this.updateMetrics.bind(this),this.props.handle.addEventListener("mousedown",this.events.pointerdown),this.props.handle.addEventListener("touchstart",this.events.pointerdown),this.props.handle.addEventListener("click",this.events.click),this.props.viewport.addEventListener("wheel",this.events.wheel),this.props.viewport.addEventListener("scroll",this.events.scroll),window.addEventListener("resize",this.events.resize)}},{key:"destroy",value:function(){this.props.handle.removeEventListener("mousedown",this.events.pointerdown),this.props.handle.removeEventListener("touchstart",this.events.pointerdown),this.props.handle.removeEventListener("click",this.events.click),this.props.viewport.removeEventListener("wheel",this.events.wheel),this.props.viewport.removeEventListener("scroll",this.events.scroll),window.removeEventListener("resize",this.events.resize)}}]),t}();e.default=c,t.exports=e.default}])},t.exports=n()},function(t,e){t.exports={render:function(){var t=this,e=t.$createElement,i=t._self._c||e;return i("div",{ref:"viewport",staticClass:"overflow-hidden"},[i("div",[i("h3",{staticClass:"text-sm uppercase tracking-wide text-80 bg-30 p-3"},[t._v("\n "+t._s(t.filter.name)+"\n ")]),t._v(" "),i("div",{ref:"content",staticClass:"flex px-2 pb-2",class:{"flex-wrap":"wrap"===t.filter.mode}},[t.filter.showSelectNoneButton?i("Pill",{attrs:{active:0===t.currentActive.length},nativeOn:{click:function(e){return t.clearFilters()}}},[t._v("\n\n "+t._s(t.filter.noneLabel)+"\n\n ")]):t._e(),t._v(" "),t._l(t.filter.options,function(e){return i("Pill",{key:e.value,attrs:{active:t.currentActive.includes(e.value)},nativeOn:{click:function(i){return t.enableFilter(e.value)}}},[t._v("\n\n "+t._s(e.name)+"\n\n ")])})],2)])])},staticRenderFns:[]}}]); \ No newline at end of file diff --git a/resources/js/components/PillFilter.vue b/resources/js/components/PillFilter.vue index f7420d7..fec1b27 100644 --- a/resources/js/components/PillFilter.vue +++ b/resources/js/components/PillFilter.vue @@ -8,7 +8,7 @@ {{ filter.name }} -
+