From 79f1f0233ac5b2a1248ed86031e4fc88c6cf2759 Mon Sep 17 00:00:00 2001 From: robin Date: Mon, 10 Feb 2020 18:39:09 +0800 Subject: [PATCH] upgrade version to v0.3.1 --- dist/index.js | 2 +- package.json | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/dist/index.js b/dist/index.js index f19e72e..9fa4a0a 100644 --- a/dist/index.js +++ b/dist/index.js @@ -1,4 +1,4 @@ -!function(e,t){"object"==typeof exports&&"object"==typeof module?module.exports=t():"function"==typeof define&&define.amd?define("FlexTable",[],t):"object"==typeof exports?exports.FlexTable=t():e.FlexTable=t()}(window,function(){return n={},e.m=t=[function(e,t,n){"use strict";function o(e,t,n,o,i,r,l,a){var s,d="function"==typeof e?e.options:e;if(t&&(d.render=t,d.staticRenderFns=n,d._compiled=!0),o&&(d.functional=!0),r&&(d._scopeId="data-v-"+r),l?(s=function(e){(e=e||this.$vnode&&this.$vnode.ssrContext||this.parent&&this.parent.$vnode&&this.parent.$vnode.ssrContext)||"undefined"==typeof __VUE_SSR_CONTEXT__||(e=__VUE_SSR_CONTEXT__),i&&i.call(this,e),e&&e._registeredComponents&&e._registeredComponents.add(l)},d._ssrRegister=s):i&&(s=a?function(){i.call(this,this.$root.$options.shadowRoot)}:i),s)if(d.functional){d._injectStyles=s;var c=d.render;d.render=function(e,t){return s.call(t),c(e,t)}}else{var u=d.beforeCreate;d.beforeCreate=u?[].concat(u,s):[s]}return{exports:e,options:d}}n.d(t,"a",function(){return o})},function(e,t){e.exports=function(e){return e&&e.__esModule?e:{default:e}}},function(e,t,n){"use strict";var o=n(1);Object.defineProperty(t,"__esModule",{value:!0}),t.default=void 0;var i=o(n(37)),r={props:{calWidth:{type:Object,required:!0}},computed:{owner:function(){for(var e=this.$parent;e&&!e.tableId;)e=e.$parent;return e}},methods:{setCellStyle:function(e){var t=this.calWidth[e.key],n={};return t&&(n.width="".concat(t,"px"),n.flex="none"),e.align&&(n["text-align"]=e.align),n},alignCls:function(e){var t,n=1this.maxHeight},getFixedHeadClass:function(){return this.isFixedHead?"flex-table-head-fixed-layout is-fixed":"flex-table-head-fixed-layout"}},mounted:function(){this.doLayout(),window.addEventListener("resize",this.doLayout),window.addEventListener("scroll",this.winScroll,!1),this.resizable&&(window.addEventListener("mouseup",this.onColResizeEnd),this.$el.addEventListener("mousemove",this.onColResizeMove))},watch:{data:{handler:function(){this.initData(),this.doLayout()},deep:!0,immediate:!0},height:function(e){this.calHeight()},columns:{handler:function(e){var t=[],n=[],o=[];e.forEach(function(e){"left"===e.fixed?t.push(e):"right"===e.fixed?n.push(e):o.push(e)}),this.tableColumns=[].concat(t,o,n)},immediate:!0},tableColumns:{handler:function(e){var t=this;this.doLayout(),this.$nextTick(function(){t.hasFixedLeft=t.computedFixedLeft(),t.hasFixedRight=t.computedFixedRight()}),this.$emit("update:columns",e)},deep:!0,immediate:!0},sum:function(){this.calHeight()},showScrollBar:function(){this.resize()}},updated:function(){},beforeDestroy:function(){this.shouldEachRenderQueue=!1,this._queueId=null,window.removeEventListener("resize",this.doLayout),window.removeEventListener("scroll",this.winScroll,!1),window.removeEventListener("mouseup",this.onColResizeEnd),this.$el.removeEventListener("mousemove",this.onColResizeMove)},methods:{syncScroll:(0,c.default)(function(e){var t=e.target.scrollTop;this.scrollTop=t},20),updateHoverIndex:(0,d.default)(function(e){this.hoverIndex=e},100),handleMousewheel:function(e){var t=(0,u.default)(e);if(0o;(i||r)&&(e.preventDefault(),this.scrollTop+=Math.ceil(t.pixelY),this.scrollTop=Math.max(this.scrollTop,0))}},doLayout:(0,d.default)(function(){this.resize(),this.calHeight()},50,{leading:!0}),computedFixedLeft:function(){return this.tableColumns.some(function(e){return"left"===e.fixed})},computedFixedRight:function(){return this.tableColumns.some(function(e){return"right"===e.fixed})},initData:function(){var e=this;this._queueId=(new Date).getTime(),this.rowHeight={header:0,footer:0},this.dataList=[],0this.asyncRender?(this.shouldEachRenderQueue=!0,this.eachQueue(this.data,this.asyncRender,this._queueId)):(this.isRenderDone=!0,this.$emit("on-render-done"))):this.data.forEach(function(t,n){e.copyItem(t,n)})},copyItem:function(e,t){var n=this,o=JSON.parse(JSON.stringify(e));o._isChecked=!!o._checked,o._isDisabled=!!o._disabled,o._expanded=o.expandStatus||!!o._expanded,o._disableExpand=!!o._disableExpand,this.$set(this.rowHeight,t,0),this.dataList.push(o),this.$nextTick(function(){var e=n.showScrollBar?16:0,t=n.$el.offsetWidth-2-e;n.fixedHeadStyle.width!==t+"px"&&(n.fixedHeadStyle.width=t+"px")})},eachQueue:function(e,t,n){var o=this;if(this.shouldEachRenderQueue)return new Promise(function(i,r){requestAnimationFrame(function(){o._queueId!==n?r():(o.copyItem(e[t],t++),i())})}).then(function(){e.length<=t?(o.doLayout(),o.isRenderDone=!0,o.$emit("on-render-done"),o.shouldEachRenderQueue=!1):o.eachQueue(e,t,n)}).catch(function(){})},toggleSelect:function(e){var t=this.dataList[e];t._isDisabled||(t._isChecked=!t._isChecked);var n=this.getSelection(),o=JSON.parse(JSON.stringify(t));t._isChecked||this.$emit("on-selection-cancel",o),this.$emit("on-selection-change",n,o)},getSelection:function(){var e=[];return this.dataList.forEach(function(t){t._isChecked&&e.push(t)}),JSON.parse(JSON.stringify(e))},selectAll:function(e){var t=this.getSelection();this.dataList.forEach(function(t){t._isDisabled||(t._isChecked=e)});var n=this.getSelection();e?this.$emit("on-selection-change",n):this.$emit("on-all-cancel",t)},onColResizeMove:function(e){var t=this.colResize;if(t.onColResizing){var n=e.clientX-t.nTableLeft,o=n-t.originX;o<0&&o>=t.minX?t.currentX=n:0t.top?(this.isFixedHead=!0,this.fixedHeadStyle.left=t.left+(this.border?1:0)+"px",this.fixedHeadStyle.position="fixed",this.fixedHeadStyle.top=this.fixedHeadTop+"px"):(this.isFixedHead=!1,this.fixedHeadStyle.position="absolute",this.fixedHeadStyle.left=0,this.fixedHeadStyle.top=0)},resize:function(){var e=this;requestAnimationFrame(function(){var t=e.showScrollBar?16:0,n=e.$el.offsetWidth-2-t;e.fixedHeadStyle.width=n+"px";var o={},i=0,r=0;if(e.tableColumns.forEach(function(t){var n=t.key||t.title,l=t.width;l?(l=e.limitWidth(l,t),o[n]=l,i+=l):r++}),0n.parts.length&&(o.parts.length=n.parts.length)}else{var l=[];for(i=0;iinput{opacity:0;position:absolute}.radio-component>input+label>.input-box{display:inline-block;border:1px solid #000;border-radius:50%;margin:0;padding:0;width:1em;height:1em;background:#fff;overflow:hidden;vertical-align:-5%;user-select:none}.radio-component>input+label>.input-box>.input-box-circle{display:block;margin:50%;width:0;height:0%;background:#000;border-radius:50%;opacity:0;transition:width .15s ease-in,height .15s ease-in,margin .15s ease-in}.radio-component>input:checked+label>.input-box>.input-box-circle{opacity:1;margin:22%;width:56%;height:56%}.radio-component>input:focus+label>.input-box{box-shadow:0 0 2px 3px #73b9ff}.radio-component>input:disabled+label{opacity:.7}",""])},function(e,t,n){(e.exports=n(0)(void 0)).push([e.i,".checkbox-component>input{opacity:0;position:absolute}.checkbox-component>input+label>.input-box{display:inline-block;border:1px solid #000;border-radius:14%;margin:0;padding:0;width:1em;height:1em;background:#fff;overflow:hidden;vertical-align:-5%;user-select:none}.checkbox-component>input+label>.input-box>.input-box-tick{width:100%;height:100%}.checkbox-component>input+label>.input-box>.input-box-tick>path{opacity:0;stroke:#000;stroke-width:2.3px;stroke-dashoffset:20;stroke-dasharray:20;transition:stroke-dashoffset .15s ease-in}.checkbox-component>input:checked+label>.input-box>.input-box-tick>path{opacity:1;stroke-dashoffset:0}.checkbox-component>input:focus+label>.input-box{box-shadow:0 0 2px 3px rgba(115,185,255,.69)}.checkbox-component>input:disabled+label{opacity:.7}",""])},function(e,t){e.exports={render:function(){var e=this,t=e.$createElement,n=e._self._c||t;return n("div",{staticClass:"radio-component"},[n("input",{class:e.className,attrs:{type:"radio",id:e.id,name:e.name,required:e.required,disabled:e.disabled},domProps:{value:e.value,checked:e.state},on:{change:e.onChange}}),e._v(" "),n("label",{attrs:{for:e.id}},[e._t("input-box",[e._m(0)]),e._v(" "),e._t("default")],2)])},staticRenderFns:[function(){var e=this.$createElement,t=this._self._c||e;return t("span",{staticClass:"input-box"},[t("span",{staticClass:"input-box-circle"})])}]}},function(e,t){e.exports={render:function(){var e=this,t=e.$createElement,n=e._self._c||t;return n("div",{staticClass:"checkbox-component"},[n("input",{class:e.className,attrs:{type:"checkbox",id:e.id,name:e.name,required:e.required,disabled:e.disabled},domProps:{value:e.value,checked:e.state},on:{change:e.onChange}}),e._v(" "),n("label",{attrs:{for:e.id}},[e._t("input-box",[n("span",{staticClass:"input-box"},[n("svg",{staticClass:"input-box-tick",attrs:{viewBox:"0 0 16 16"}},[n("path",{attrs:{fill:"none",d:"M1.7,7.8l3.8,3.4l9-8.8"}})])])]),e._v(" "),e._t("default")],2)])},staticRenderFns:[]}},function(e,t,n){var o=n(8);"string"==typeof o&&(o=[[e.i,o,""]]),o.locals&&(e.exports=o.locals),n(2)("141dde0d",o,!0)},function(e,t,n){var o=n(9);"string"==typeof o&&(o=[[e.i,o,""]]),o.locals&&(e.exports=o.locals),n(2)("0734c2c4",o,!0)},function(e,t){e.exports=function(e,t){for(var n=[],o={},i=0;ithis.maxHeight},getFixedHeadClass:function(){return this.isFixedHead?"flex-table-head-fixed-layout is-fixed":"flex-table-head-fixed-layout"}},mounted:function(){this.doLayout(),window.addEventListener("resize",this.doLayout),window.addEventListener("scroll",this.winScroll,!1),this.resizable&&(window.addEventListener("mouseup",this.onColResizeEnd),this.$el.addEventListener("mousemove",this.onColResizeMove))},watch:{data:{handler:function(){this.initData(),this.doLayout()},deep:!0,immediate:!0},height:function(e){this.calHeight()},columns:{handler:function(e){var t=[],n=[],o=[];e.forEach(function(e){"left"===e.fixed?t.push(e):"right"===e.fixed?n.push(e):o.push(e)}),this.tableColumns=[].concat(t,o,n)},immediate:!0},tableColumns:{handler:function(e){var t=this;this.doLayout(),this.$nextTick(function(){t.hasFixedLeft=t.computedFixedLeft(),t.hasFixedRight=t.computedFixedRight()}),this.$emit("update:columns",e)},deep:!0,immediate:!0},sum:function(){this.calHeight()},showScrollBar:function(){this.resize()},scrollLeft:function(e){this.$refs.flexTableLayout.scrollLeft=e;var t=this.$refs.flexTableFixedHead;t&&(t.scrollLeft=e)}},updated:function(){},beforeDestroy:function(){this.shouldEachRenderQueue=!1,this._queueId=null,window.removeEventListener("resize",this.doLayout),window.removeEventListener("scroll",this.winScroll,!1),window.removeEventListener("mouseup",this.onColResizeEnd),this.$el.removeEventListener("mousemove",this.onColResizeMove)},methods:{onScroll:function(e){this.scrollLeft=e.target.scrollLeft},syncScroll:(0,c.default)(function(e){var t=e.target.scrollTop;this.scrollTop=t},20),updateHoverIndex:(0,d.default)(function(e){this.hoverIndex=e},100),handleMousewheel:function(e){var t=(0,u.default)(e);if(0o;(i||r)&&(e.preventDefault(),this.scrollTop+=Math.ceil(t.pixelY),this.scrollTop=Math.max(this.scrollTop,0))}if(0s;(d||c)&&(e.preventDefault(),this.scrollLeft+=Math.ceil(t.pixelX),this.scrollLeft=Math.max(this.scrollLeft,0),this.$emit("on-scroll-x",e))}},doLayout:(0,d.default)(function(){this.resize(),this.calHeight()},50,{leading:!0}),computedFixedLeft:function(){return this.tableColumns.some(function(e){return"left"===e.fixed})},computedFixedRight:function(){return this.tableColumns.some(function(e){return"right"===e.fixed})},initData:function(){var e=this;this._queueId=(new Date).getTime(),this.rowHeight={header:0,footer:0},this.dataList=[],0this.asyncRender?(this.shouldEachRenderQueue=!0,this.eachQueue(this.data,this.asyncRender,this._queueId)):(this.isRenderDone=!0,this.$emit("on-render-done"))):this.data.forEach(function(t,n){e.copyItem(t,n)})},copyItem:function(e,t){var n=this,o=JSON.parse(JSON.stringify(e));o._isChecked=!!o._checked,o._isDisabled=!!o._disabled,o._expanded=o.expandStatus||!!o._expanded,o._disableExpand=!!o._disableExpand,this.$set(this.rowHeight,t,0),this.dataList.push(o),this.$nextTick(function(){var e=n.showScrollBar?16:0,t=n.$el.offsetWidth-2-e;n.fixedHeadStyle.width!==t+"px"&&(n.fixedHeadStyle.width=t+"px")})},eachQueue:function(e,t,n){var o=this;if(this.shouldEachRenderQueue)return new Promise(function(i,r){requestAnimationFrame(function(){o._queueId!==n?r():(o.copyItem(e[t],t++),i())})}).then(function(){e.length<=t?(o.doLayout(),o.isRenderDone=!0,o.$emit("on-render-done"),o.shouldEachRenderQueue=!1):o.eachQueue(e,t,n)}).catch(function(){})},toggleSelect:function(e){var t=this.dataList[e];t._isDisabled||(t._isChecked=!t._isChecked);var n=this.getSelection(),o=JSON.parse(JSON.stringify(t));t._isChecked||this.$emit("on-selection-cancel",o),this.$emit("on-selection-change",n,o)},getSelection:function(){var e=[];return this.dataList.forEach(function(t){t._isChecked&&e.push(t)}),JSON.parse(JSON.stringify(e))},selectAll:function(e){var t=this.getSelection();this.dataList.forEach(function(t){t._isDisabled||(t._isChecked=e)});var n=this.getSelection();e?this.$emit("on-selection-change",n):this.$emit("on-all-cancel",t)},onColResizeMove:function(e){var t=this.colResize;if(t.onColResizing){var n=e.clientX-t.nTableLeft,o=n-t.originX;o<0&&o>=t.minX?t.currentX=n:0t.top?(this.isFixedHead=!0,this.fixedHeadStyle.left=t.left+(this.border?1:0)+"px",this.fixedHeadStyle.position="fixed",this.fixedHeadStyle.top=this.fixedHeadTop+"px"):(this.isFixedHead=!1,this.fixedHeadStyle.position="absolute",this.fixedHeadStyle.left=0,this.fixedHeadStyle.top=0)},resize:function(){var e=this;requestAnimationFrame(function(){var t=e.showScrollBar?16:0,n=e.$el.offsetWidth-2-t;e.fixedHeadStyle.width=n+"px";var o={},i=0,r=0;if(e.tableColumns.forEach(function(t){var n=t.key||t.title,l=t.width;l?(l=e.limitWidth(l,t),o[n]=l,i+=l):r++}),0n.parts.length&&(o.parts.length=n.parts.length)}else{var l=[];for(i=0;iinput{opacity:0;position:absolute}.radio-component>input+label>.input-box{display:inline-block;border:1px solid #000;border-radius:50%;margin:0;padding:0;width:1em;height:1em;background:#fff;overflow:hidden;vertical-align:-5%;user-select:none}.radio-component>input+label>.input-box>.input-box-circle{display:block;margin:50%;width:0;height:0%;background:#000;border-radius:50%;opacity:0;transition:width .15s ease-in,height .15s ease-in,margin .15s ease-in}.radio-component>input:checked+label>.input-box>.input-box-circle{opacity:1;margin:22%;width:56%;height:56%}.radio-component>input:focus+label>.input-box{box-shadow:0 0 2px 3px #73b9ff}.radio-component>input:disabled+label{opacity:.7}",""])},function(e,t,n){(e.exports=n(0)(void 0)).push([e.i,".checkbox-component>input{opacity:0;position:absolute}.checkbox-component>input+label>.input-box{display:inline-block;border:1px solid #000;border-radius:14%;margin:0;padding:0;width:1em;height:1em;background:#fff;overflow:hidden;vertical-align:-5%;user-select:none}.checkbox-component>input+label>.input-box>.input-box-tick{width:100%;height:100%}.checkbox-component>input+label>.input-box>.input-box-tick>path{opacity:0;stroke:#000;stroke-width:2.3px;stroke-dashoffset:20;stroke-dasharray:20;transition:stroke-dashoffset .15s ease-in}.checkbox-component>input:checked+label>.input-box>.input-box-tick>path{opacity:1;stroke-dashoffset:0}.checkbox-component>input:focus+label>.input-box{box-shadow:0 0 2px 3px rgba(115,185,255,.69)}.checkbox-component>input:disabled+label{opacity:.7}",""])},function(e,t){e.exports={render:function(){var e=this,t=e.$createElement,n=e._self._c||t;return n("div",{staticClass:"radio-component"},[n("input",{class:e.className,attrs:{type:"radio",id:e.id,name:e.name,required:e.required,disabled:e.disabled},domProps:{value:e.value,checked:e.state},on:{change:e.onChange}}),e._v(" "),n("label",{attrs:{for:e.id}},[e._t("input-box",[e._m(0)]),e._v(" "),e._t("default")],2)])},staticRenderFns:[function(){var e=this.$createElement,t=this._self._c||e;return t("span",{staticClass:"input-box"},[t("span",{staticClass:"input-box-circle"})])}]}},function(e,t){e.exports={render:function(){var e=this,t=e.$createElement,n=e._self._c||t;return n("div",{staticClass:"checkbox-component"},[n("input",{class:e.className,attrs:{type:"checkbox",id:e.id,name:e.name,required:e.required,disabled:e.disabled},domProps:{value:e.value,checked:e.state},on:{change:e.onChange}}),e._v(" "),n("label",{attrs:{for:e.id}},[e._t("input-box",[n("span",{staticClass:"input-box"},[n("svg",{staticClass:"input-box-tick",attrs:{viewBox:"0 0 16 16"}},[n("path",{attrs:{fill:"none",d:"M1.7,7.8l3.8,3.4l9-8.8"}})])])]),e._v(" "),e._t("default")],2)])},staticRenderFns:[]}},function(e,t,n){var o=n(8);"string"==typeof o&&(o=[[e.i,o,""]]),o.locals&&(e.exports=o.locals),n(2)("141dde0d",o,!0)},function(e,t,n){var o=n(9);"string"==typeof o&&(o=[[e.i,o,""]]),o.locals&&(e.exports=o.locals),n(2)("0734c2c4",o,!0)},function(e,t){e.exports=function(e,t){for(var n=[],o={},i=0;i