!function(e,t){"object"==typeof exports&&"object"==typeof module?module.exports=t():"function"==typeof define&&define.amd?define([],t):"object"==typeof exports?exports["design-grid"]=t():e["design-grid"]=t()}("undefined"!=typeof self?self:this,function(){return function(e){function t(i){if(n[i])return n[i].exports;var o=n[i]={i:i,l:!1,exports:{}};return e[i].call(o.exports,o,o.exports,t),o.l=!0,o.exports}var n={};return t.m=e,t.c=n,t.d=function(e,n,i){t.o(e,n)||Object.defineProperty(e,n,{configurable:!1,enumerable:!0,get:i})},t.n=function(e){var n=e&&e.__esModule?function(){return e.default}:function(){return e};return t.d(n,"a",n),n},t.o=function(e,t){return Object.prototype.hasOwnProperty.call(e,t)},t.p="/dist/",t(t.s=7)}([function(e,t,n){"use strict";var i="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e};t.a={DEFAULT_LINE_HEIGHT:26,assign:function(e,t){if(null==t)return e;if("function"==typeof Object.assign)return Object.assign(e,t);if(e=Object(e),null!=t)for(var n in t)Object.prototype.hasOwnProperty.call(t,n)&&(e[n]=t[n]);return e},set:function(e,t,n){Object.prototype.hasOwnProperty.call(e,t)?e[t]=n:Object.defineProperty(e,t,{value:n,writable:!0,configurable:!0,enumerable:!1})},value:function(e,t,n,i){if(null==t)return"";var o=n[e||"filter"],s=void 0;return s="function"==typeof o?o.call(this,t,i):t&&t["string"==typeof o?o:n.key],null==s?"":String(s)},style:function(e,t,n,o){if(null==t)return null;var s=n[e||"style"];switch(void 0===s?"undefined":i(s)){case"function":return s.call(this,t,o);case"string":return t&&t[s];default:return s}},math:{trunc:function(e){var t=Number(e);return isNaN(t)?e:(t>0?Math.floor:Math.ceil)(t)}},ui:{getClientX:function(e){if(null==e)return null;null!=e.originalEvent&&(e=e.originalEvent);var t=e.touches&&e.touches[0]&&e.touches[0].clientX;return void 0===t?e.clientX:t},getClientY:function(e){if(null==e)return null;null!=e.originalEvent&&(e=e.originalEvent);var t=e.touches&&e.touches[0]&&e.touches[0].clientY;return void 0===t?e.clientY:t},getOffsetLeft:function(e){for(var t=0;e;)t+=e.offsetLeft,e=e.offsetParent;return t}},func:{debounce:function(e){for(var t=arguments.length,n=Array(t>3?t-3:0),i=3;i1&&void 0!==arguments[1]?arguments[1]:100,s=arguments.length>2&&void 0!==arguments[2]?arguments[2]:window;"function"==typeof e&&(clearTimeout(e.tiid),e.tiid=setTimeout(function(){return e.apply(s,n)},o))},throttle:function(e){for(var t=arguments.length,n=Array(t>3?t-3:0),i=3;i1&&void 0!==arguments[1]?arguments[1]:100,s=arguments.length>2&&void 0!==arguments[2]?arguments[2]:window;if("function"==typeof e){clearTimeout(e.tiid);var l=new Date;null==e.tdate||l-e.tdate>o?(e.apply(s,n),e.tdate=l):e.tiid=setTimeout(function(){return e.apply(s,n)},o)}}}}},function(e,t,n){"use strict";function i(e,t,n,i,o,s,l,r){e=e||{};var u=typeof e.default;"object"!==u&&"function"!==u||(e=e.default);var d="function"==typeof e?e.options:e;t&&(d.render=t,d.staticRenderFns=n,d._compiled=!0),i&&(d.functional=!0),s&&(d._scopeId=s);var a;if(l?(a=function(e){e=e||this.$vnode&&this.$vnode.ssrContext||this.parent&&this.parent.$vnode&&this.parent.$vnode.ssrContext,e||"undefined"==typeof __VUE_SSR_CONTEXT__||(e=__VUE_SSR_CONTEXT__),o&&o.call(this,e),e&&e._registeredComponents&&e._registeredComponents.add(l)},d._ssrRegister=a):o&&(a=r?function(){o.call(this,this.$root.$options.shadowRoot)}:o),a)if(d.functional){d._injectStyles=a;var c=d.render;d.render=function(e,t){return a.call(t),c(e,t)}}else{var h=d.beforeCreate;d.beforeCreate=h?[].concat(h,a):[a]}return{exports:e,options:d}}t.a=i},function(e,t,n){"use strict";function i(e,t){if(t===e)return!0;if(null!=t&&null!=e&&t.length===e.length){var n=[];t.forEach(function(e){return n[e]=1}),e.forEach(function(e){return n[e]--});var i=!1;if(n.forEach(function(e){return i=i&&0!==n[e]}),!i)return!0}return!1}var o=n(8),s=n(10),l=n(12),r=n(0),u=n(4),d=n(14);n.n(d);t.a={name:"design-grid",components:{"d-column-header":o.a,"d-grid-row-header":l.a,"d-column-input":s.a},props:{enabled:{type:Boolean,default:function(){return!0}},columns:{type:Array,default:function(){return[]},required:!0},source:{type:Array,default:function(){return[]}},window:{default:function(){return window}},defaultHeight:{type:Number,default:function(){return r.a.DEFAULT_LINE_HEIGHT}}},data:function(){return{selectedIndexes:[],selectedColIndexes:[]}},watch:{selectedIndexes:function(e){i(e,this._oldSelectedIndexes)||(this.$emit("selected-indexes-changed",e,this._oldSelectedIndexes),this._oldSelectedIndexes=e)},selectedColIndexes:function(e){i(e,this._oldSelectedColIndexes)||(this.$emit("selected-col-indexes-changed",e,this._oldSelectedColIndexes),this._oldSelectedColIndexes=e)}},mounted:function(){u.a.wrapColumns.call(this,this.columns),this.__window.addEventListener("resize",this.__window_on_resize,!1)},beforeDestroy:function(){this.__window.removeEventListener("resize",this.__window_on_resize)},updated:function(){u.a.updateBodyTop.call(this)},computed:{selectedIndex:function(){var e=this.selectedIndexes&&this.selectedIndexes.length;return e>0?this.selectedIndexes[e-1]:null},selectedColIndex:function(){var e=this.selectedColIndexes&&this.selectedColIndexes.length;return e>0?this.selectedColIndexes[e-1]:null},__window:function(){return this.window||window}},methods:{__window_on_resize:function(){r.a.func.throttle(u.a.windowResizing,8,this)},__column_header_on_mouse_down:function(e,t){null!=this.selectedIndex&&(this.selectedIndexes=[]),(this.selectedColIndex!==t||this.selectedColIndexes&&this.selectedColIndexes.length>1)&&(this.selectedColIndexes=[t]),this.$emit("column-header-mouse-down",e,t)},__column_header_on_dblclick:function(e,t){this.$emit("column-dbl-click",e,t)},__column_header_on_width_changing:function(e,t){u.a.updateBodyTop.call(this),r.a.func.throttle(u.a.widthChanging,8,this,e,t)},__column_header_on_width_changed:function(e,t){u.a.resizeColumn.call(this,e,t),this.$emit("column-width-changed",e,t)},__row_header_on_height_changing:function(e,t){r.a.func.throttle(u.a.heightChanging,8,this,e,t)},__row_header_on_height_changed:function(e,t){this.$emit("row-height-changed",e,t)},__contains_index:function(e,t){return null!=e&&e.indexOf(t)>=0},__mixin_style:function(e,t){var n=Number(t.__height);isNaN(n)&&(n=this.defaultHeight);var i=r.a.assign({},e);return"0px"===i.width&&(i.display="none"),i.height=n+"px",i},__grid_body_on_scroll:function(e){var t=e.target.scrollLeft;this._scrollLeft!==t&&(r.a.set(this,"_scrollLeft",t),this.$refs.header.parentElement.style.marginLeft=-t+"px")},__row_on_mousedown:function(e,t){if(this.enabled){var n=void 0,i=void 0;"boolean"==typeof t?(n=t?-2:-1,(i=e<0)||this.$emit("row-header-mouse-down",e)):(n=u.a.getSelectedColumnIndex.call(this,t),i=e<0||"d-grid-row"===t.target.className),-1===n&&"boolean"==typeof t||(i?null!=this.selectedIndex&&(this.selectedIndexes=[]):(this.selectedIndex!==e||this.selectedIndexes&&this.selectedIndexes.length>1)&&(this.selectedIndexes=[e])),n<0?this.selectedColIndexes=[]:(this.selectedColIndex!==n||this.selectedColIndexes&&this.selectedColIndexes.length>1)&&(this.selectedColIndexes=[n])}},__row_header_on_dblclick:function(e){this.$emit("row-header-dbl-click",e)},_row_on_dblclick:function(e){if(this.enabled){var t=u.a.getSelectedColumnIndex.call(this,e);t>=0&&this.$emit("cell-dbl-click",this.selectedIndex,t)}},__row_on_value_changed:function(e,t,n){this.$emit("cell-value-changed",e,t,n)}}}},function(e,t,n){"use strict";var i=n(0),o=n(4);t.a={props:{index:Number,column:null,window:null,enabled:Boolean},computed:{headerClass:function(){return o.a.setColumnStyle.call(this,this.column),{width:this.column.width+"px",textAlign:"center"}}},methods:{onMouseDown:function(e){this.enabled&&this.$emit("columnMouseDown",this.column.key,this.index)},onDblClick:function(e){this.enabled&&this.$emit("columnDblClick",this.column.key,this.index)},onResizeStart:function(e){this._cX=i.a.ui.getClientX(e),this._width=this.column.width,this._index=this.index,this.window.addEventListener("mousemove",this.onResizeMove,!1),this.window.addEventListener("mouseup",this.onResizeEnd,!1),this.window.addEventListener("touchmove",this.onResizeMove,!1),this.window.addEventListener("touchend",this.onResizeEnd,!1)},onResizeMove:function(e){this._isResizing=!0;var t=i.a.ui.getClientX(e),n=this._width+(t-this._cX);n=27&&this.$refs.gridbody.offsetTop!==e&&(this.$refs.gridbody.style.top=e+"px")}},widthChanging:function(e,t){var n=this.$refs.gridrows,i=t+"px";if(n&&n.length>0)for(var o=void 0,s=0;s0?"none"===l.style.display?"":null:"none"!==l.style.display?"none":null),null!=o&&(l.style.display=o),l.style.width=i,l.style.minWidth=i,l.style.maxWidth=i}},heightChanging:function(e,t){var n=this.$refs.gridrows[e],i=t+"px";if(n&&n.children)for(var o=1;o