vxe-table 3.4.14-beta.2 → 3.4.14-beta.3

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.
@@ -227,8 +227,8 @@ var _default = {
227
227
 
228
228
  var filterStore = this.filterStore,
229
229
  filterOpts = this.filterOpts,
230
- scrollXLoad = this.scrollXLoad,
231
- scrollYLoad = this.scrollYLoad;
230
+ oldScrollXLoad = this.scrollXLoad,
231
+ oldScrollYLoad = this.scrollYLoad;
232
232
  var column = filterStore.column;
233
233
  var property = column.property;
234
234
  var values = [];
@@ -244,19 +244,6 @@ var _default = {
244
244
  if (!filterOpts.remote) {
245
245
  this.handleTableData(true);
246
246
  this.checkSelectionStatus();
247
- this.updateFooter();
248
-
249
- if (scrollXLoad || scrollYLoad) {
250
- if (scrollXLoad) {
251
- this.updateScrollXSpace();
252
- }
253
-
254
- if (scrollYLoad) {
255
- this.updateScrollYSpace();
256
- }
257
-
258
- this.refreshScroll();
259
- }
260
247
  }
261
248
 
262
249
  this.emitEvent('filter-change', {
@@ -268,10 +255,30 @@ var _default = {
268
255
  filterList: filterList
269
256
  }, evnt);
270
257
  this.closeFilter();
271
- this.$nextTick(function () {
272
- _this2.recalculate();
258
+ this.updateFooter().then(function () {
259
+ var scrollXLoad = _this2.scrollXLoad,
260
+ scrollYLoad = _this2.scrollYLoad;
273
261
 
262
+ if (oldScrollXLoad || scrollXLoad || oldScrollYLoad || scrollYLoad) {
263
+ if (oldScrollXLoad || scrollXLoad) {
264
+ _this2.updateScrollXSpace();
265
+ }
266
+
267
+ if (oldScrollYLoad || scrollYLoad) {
268
+ _this2.updateScrollYSpace();
269
+ }
270
+
271
+ return _this2.refreshScroll();
272
+ }
273
+ }).then(function () {
274
274
  _this2.updateCellAreas();
275
+
276
+ return _this2.recalculate(true);
277
+ }).then(function () {
278
+ // 存在滚动行为未结束情况
279
+ setTimeout(function () {
280
+ return _this2.recalculate();
281
+ }, 50);
275
282
  });
276
283
  },
277
284
  handleClearFilter: function handleClearFilter(column) {
@@ -1 +1 @@
1
- "use strict";Object.defineProperty(exports,"__esModule",{value:!0}),exports.default=void 0;var _xeUtils=_interopRequireDefault(require("xe-utils")),_tools=require("../../tools"),_util=require("../../table/src/util"),_vXETable=_interopRequireDefault(require("../../v-x-e-table"));function _interopRequireDefault(e){return e&&e.__esModule?e:{default:e}}var _default={methods:{_openFilter:function(e){var t=(0,_util.handleFieldOrColumn)(this,e);if(t&&t.filters){var i=this.elemStore,l=t.fixed;return this.scrollToColumn(t).then(function(){var e=i["".concat(l||"main","-header-wrapper")]||i["main-header-wrapper"];e&&(e=e.querySelector(".vxe-header--column.".concat(t.id," .vxe-filter--btn")),_tools.DomTools.triggerEvent(e,"click"))})}return this.$nextTick()},_setFilter:function(e,t){e=(0,_util.handleFieldOrColumn)(this,e);return e&&e.filters&&t&&(e.filters=_tools.UtilTools.getFilters(t)),this.$nextTick()},checkFilterOptions:function(){var e=this.filterStore;e.isAllSelected=e.options.every(function(e){return e._checked}),e.isIndeterminate=!e.isAllSelected&&e.options.some(function(e){return e._checked})},triggerFilterEvent:function(e,u,t){var h,d,i,l,r,o,p,v=this,m=this.filterStore;m.column===u&&m.visible?m.visible=!1:(h=e.target,d=e.pageX,i=u.filters,l=u.filterMultiple,r=(r=u.filterRender)?_vXETable.default.renderer.get(r.name):null,o=u.filterRecoverMethod||(r?r.filterRecoverMethod:null),p=_tools.DomTools.getDomNode().visibleWidth,Object.assign(m,{args:t,multiple:l,options:i,column:u,style:null,visible:!0}),m.options.forEach(function(e){var t=e._checked,i=e.checked;(e._checked=i)||t===i||o&&o({option:e,column:u,$table:v})}),this.checkFilterOptions(),this.initStore.filter=!0,this.$nextTick(function(){var e=v.$refs,t=e.tableBody.$el,i=e.filterWrapper.$el,l=0,r=0,o=null,s=null;i&&(l=i.offsetWidth,r=i.offsetHeight,o=i.querySelector(".vxe-table--filter-header"),s=i.querySelector(".vxe-table--filter-footer"));var n,f,a=l/2,c=t.clientWidth-l-10,e={top:"".concat(h.offsetTop+h.offsetParent.offsetTop+h.offsetHeight+8,"px")},i=null;r>=t.clientHeight&&(i=Math.max(60,t.clientHeight-(s?s.offsetHeight:0)-(o?o.offsetHeight:0))),"left"===u.fixed?n=h.offsetLeft+h.offsetParent.offsetLeft-a:"right"===u.fixed?f=h.offsetParent.offsetWidth-h.offsetLeft+(h.offsetParent.offsetParent.offsetWidth-h.offsetParent.offsetLeft)-u.renderWidth-a:n=h.offsetLeft+h.offsetParent.offsetLeft-a-t.scrollLeft,n?(0<(t=d+l-a+10-p)&&(n-=t),e.left="".concat(Math.min(c,Math.max(10,n)),"px")):f&&(0<(a=d+l-a+10-p)&&(f+=a),e.right="".concat(Math.max(10,f),"px")),m.style=e,m.maxHeight=i})),this.emitEvent("filter-visible",{column:u,property:u.property,filterList:this.getCheckedFilters(),visible:m.visible},e)},_getCheckedFilters:function(){var e=this.tableFullColumn,o=[];return e.filter(function(e){var t=e.property,i=e.filters,l=[],r=[];i&&i.length&&(i.forEach(function(e){e.checked&&(l.push(e.value),r.push(e.data))}),l.length&&o.push({column:e,property:t,values:l,datas:r}))}),o},confirmFilterEvent:function(e){var t=this,i=this.filterStore,l=this.filterOpts,r=this.scrollXLoad,o=this.scrollYLoad,s=i.column,n=s.property,f=[],a=[];s.filters.forEach(function(e){e.checked&&(f.push(e.value),a.push(e.data))});i=this.getCheckedFilters();l.remote||(this.handleTableData(!0),this.checkSelectionStatus(),this.updateFooter(),(r||o)&&(r&&this.updateScrollXSpace(),o&&this.updateScrollYSpace(),this.refreshScroll())),this.emitEvent("filter-change",{column:s,property:n,values:f,datas:a,filters:i,filterList:i},e),this.closeFilter(),this.$nextTick(function(){t.recalculate(),t.updateCellAreas()})},handleClearFilter:function(e){var t,i,l;e&&(t=e.filters,i=e.filterRender,t&&(i=i?_vXETable.default.renderer.get(i.name):null,l=e.filterResetMethod||(i?i.filterResetMethod:null),t.forEach(function(e){e._checked=!1,e.checked=!1,l||(e.data=_xeUtils.default.clone(e.resetValue,!0))}),l&&l({options:t,column:e,$table:this})))},resetFilterEvent:function(e){this.handleClearFilter(this.filterStore.column),this.confirmFilterEvent(e)},_clearFilter:function(e){var t,i=this.filterStore;return e?(t=(0,_util.handleFieldOrColumn)(this,e))&&this.handleClearFilter(t):this.visibleColumn.forEach(this.handleClearFilter),e&&t===i.column||Object.assign(i,{isAllSelected:!1,isIndeterminate:!1,style:null,options:[],column:null,multiple:!1,visible:!1}),this.updateData()}}};exports.default=_default;
1
+ "use strict";Object.defineProperty(exports,"__esModule",{value:!0}),exports.default=void 0;var _xeUtils=_interopRequireDefault(require("xe-utils")),_tools=require("../../tools"),_util=require("../../table/src/util"),_vXETable=_interopRequireDefault(require("../../v-x-e-table"));function _interopRequireDefault(e){return e&&e.__esModule?e:{default:e}}var _default={methods:{_openFilter:function(e){var t=(0,_util.handleFieldOrColumn)(this,e);if(t&&t.filters){var l=this.elemStore,i=t.fixed;return this.scrollToColumn(t).then(function(){var e=l["".concat(i||"main","-header-wrapper")]||l["main-header-wrapper"];e&&(e=e.querySelector(".vxe-header--column.".concat(t.id," .vxe-filter--btn")),_tools.DomTools.triggerEvent(e,"click"))})}return this.$nextTick()},_setFilter:function(e,t){e=(0,_util.handleFieldOrColumn)(this,e);return e&&e.filters&&t&&(e.filters=_tools.UtilTools.getFilters(t)),this.$nextTick()},checkFilterOptions:function(){var e=this.filterStore;e.isAllSelected=e.options.every(function(e){return e._checked}),e.isIndeterminate=!e.isAllSelected&&e.options.some(function(e){return e._checked})},triggerFilterEvent:function(e,u,t){var h,d,l,i,r,o,p,v=this,m=this.filterStore;m.column===u&&m.visible?m.visible=!1:(h=e.target,d=e.pageX,l=u.filters,i=u.filterMultiple,r=(r=u.filterRender)?_vXETable.default.renderer.get(r.name):null,o=u.filterRecoverMethod||(r?r.filterRecoverMethod:null),p=_tools.DomTools.getDomNode().visibleWidth,Object.assign(m,{args:t,multiple:i,options:l,column:u,style:null,visible:!0}),m.options.forEach(function(e){var t=e._checked,l=e.checked;(e._checked=l)||t===l||o&&o({option:e,column:u,$table:v})}),this.checkFilterOptions(),this.initStore.filter=!0,this.$nextTick(function(){var e=v.$refs,t=e.tableBody.$el,l=e.filterWrapper.$el,i=0,r=0,o=null,n=null;l&&(i=l.offsetWidth,r=l.offsetHeight,o=l.querySelector(".vxe-table--filter-header"),n=l.querySelector(".vxe-table--filter-footer"));var s,f,a=i/2,c=t.clientWidth-i-10,e={top:"".concat(h.offsetTop+h.offsetParent.offsetTop+h.offsetHeight+8,"px")},l=null;r>=t.clientHeight&&(l=Math.max(60,t.clientHeight-(n?n.offsetHeight:0)-(o?o.offsetHeight:0))),"left"===u.fixed?s=h.offsetLeft+h.offsetParent.offsetLeft-a:"right"===u.fixed?f=h.offsetParent.offsetWidth-h.offsetLeft+(h.offsetParent.offsetParent.offsetWidth-h.offsetParent.offsetLeft)-u.renderWidth-a:s=h.offsetLeft+h.offsetParent.offsetLeft-a-t.scrollLeft,s?(0<(t=d+i-a+10-p)&&(s-=t),e.left="".concat(Math.min(c,Math.max(10,s)),"px")):f&&(0<(a=d+i-a+10-p)&&(f+=a),e.right="".concat(Math.max(10,f),"px")),m.style=e,m.maxHeight=l})),this.emitEvent("filter-visible",{column:u,property:u.property,filterList:this.getCheckedFilters(),visible:m.visible},e)},_getCheckedFilters:function(){var e=this.tableFullColumn,o=[];return e.filter(function(e){var t=e.property,l=e.filters,i=[],r=[];l&&l.length&&(l.forEach(function(e){e.checked&&(i.push(e.value),r.push(e.data))}),i.length&&o.push({column:e,property:t,values:i,datas:r}))}),o},confirmFilterEvent:function(e){var l=this,t=this.filterStore,i=this.filterOpts,r=this.scrollXLoad,o=this.scrollYLoad,n=t.column,s=n.property,f=[],a=[];n.filters.forEach(function(e){e.checked&&(f.push(e.value),a.push(e.data))});t=this.getCheckedFilters();i.remote||(this.handleTableData(!0),this.checkSelectionStatus()),this.emitEvent("filter-change",{column:n,property:s,values:f,datas:a,filters:t,filterList:t},e),this.closeFilter(),this.updateFooter().then(function(){var e=l.scrollXLoad,t=l.scrollYLoad;if(r||e||o||t)return(r||e)&&l.updateScrollXSpace(),(o||t)&&l.updateScrollYSpace(),l.refreshScroll()}).then(function(){return l.updateCellAreas(),l.recalculate(!0)}).then(function(){setTimeout(function(){return l.recalculate()},50)})},handleClearFilter:function(e){var t,l,i;e&&(t=e.filters,l=e.filterRender,t&&(l=l?_vXETable.default.renderer.get(l.name):null,i=e.filterResetMethod||(l?l.filterResetMethod:null),t.forEach(function(e){e._checked=!1,e.checked=!1,i||(e.data=_xeUtils.default.clone(e.resetValue,!0))}),i&&i({options:t,column:e,$table:this})))},resetFilterEvent:function(e){this.handleClearFilter(this.filterStore.column),this.confirmFilterEvent(e)},_clearFilter:function(e){var t,l=this.filterStore;return e?(t=(0,_util.handleFieldOrColumn)(this,e))&&this.handleClearFilter(t):this.visibleColumn.forEach(this.handleClearFilter),e&&t===l.column||Object.assign(l,{isAllSelected:!1,isIndeterminate:!1,style:null,options:[],column:null,multiple:!1,visible:!1}),this.updateData()}}};exports.default=_default;