bi-eleme 2.0.13 → 2.1.1

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.
package/lib/table.js CHANGED
@@ -3755,12 +3755,20 @@ var convertToRows = function convertToRows(originColumns) {
3755
3755
  if (isGroup) this.$parent.isGroup = true;
3756
3756
  return h(
3757
3757
  'table',
3758
- { 'class': 'el-table__header', attrs: { cellspacing: '0', cellpadding: '0', border: '0' }
3758
+ {
3759
+ 'class': 'el-table__header',
3760
+ attrs: { cellspacing: '0',
3761
+ cellpadding: '0',
3762
+ border: '0'
3763
+ }
3759
3764
  },
3760
3765
  [h('colgroup', [this.columns.map(function (column) {
3761
3766
  return h('col', {
3762
- attrs: { name: column.id },
3763
- key: column.id });
3767
+ attrs: {
3768
+ name: column.id
3769
+ },
3770
+ key: column.id
3771
+ });
3764
3772
  }), this.hasGutter ? h('col', {
3765
3773
  attrs: { name: 'gutter' }
3766
3774
  }) : '']), h(
@@ -3769,12 +3777,18 @@ var convertToRows = function convertToRows(originColumns) {
3769
3777
  [this._l(columnRows, function (columns, rowIndex) {
3770
3778
  return h(
3771
3779
  'tr',
3772
- { style: _this.getHeaderRowStyle(rowIndex), 'class': _this.getHeaderRowClass(rowIndex) },
3780
+ {
3781
+ style: _this.getHeaderRowStyle(rowIndex),
3782
+ 'class': _this.getHeaderRowClass(rowIndex)
3783
+ },
3773
3784
  [columns.map(function (column, cellIndex) {
3774
3785
  return h(
3775
3786
  'th',
3776
3787
  {
3777
- attrs: { colspan: column.colSpan, rowspan: column.rowSpan },
3788
+ attrs: {
3789
+ colspan: column.colSpan,
3790
+ rowspan: column.rowSpan
3791
+ },
3778
3792
  on: {
3779
3793
  'mousemove': function mousemove($event) {
3780
3794
  return _this.handleMouseMove($event, column);
@@ -3786,28 +3800,41 @@ var convertToRows = function convertToRows(originColumns) {
3786
3800
  'click': function click($event) {
3787
3801
  return _this.handleHeaderClick($event, column);
3788
3802
  },
3803
+ 'dblclick': function dblclick($event) {
3804
+ return _this.handleHeaderDblclick($event, column);
3805
+ },
3789
3806
  'contextmenu': function contextmenu($event) {
3790
3807
  return _this.handleHeaderContextMenu($event, column);
3791
3808
  }
3792
3809
  },
3793
- style: _this.getHeaderCellStyle(rowIndex, cellIndex, columns, column), 'class': _this.getHeaderCellClass(rowIndex, cellIndex, columns, column), key: column.id },
3810
+
3811
+ style: _this.getHeaderCellStyle(rowIndex, cellIndex, columns, column),
3812
+ 'class': _this.getHeaderCellClass(rowIndex, cellIndex, columns, column),
3813
+ key: column.id
3814
+ },
3794
3815
  [h(
3795
3816
  'div',
3796
3817
  { 'class': ['cell', column.filteredValue && column.filteredValue.length > 0 ? 'highlight' : '', column.labelClassName] },
3797
3818
  [column.renderHeader ? column.renderHeader.call(_this._renderProxy, h, { column: column, $index: cellIndex, store: _this.store, _self: _this.$parent.$vnode.context }) : column.label, column.sortable ? h(
3798
3819
  'span',
3799
- { 'class': 'caret-wrapper', on: {
3820
+ {
3821
+ 'class': 'caret-wrapper',
3822
+ on: {
3800
3823
  'click': function click($event) {
3801
3824
  return _this.handleSortClick($event, column);
3802
3825
  }
3803
3826
  }
3804
3827
  },
3805
- [h('i', { 'class': 'sort-caret ascending', on: {
3828
+ [h('i', {
3829
+ 'class': 'sort-caret ascending',
3830
+ on: {
3806
3831
  'click': function click($event) {
3807
3832
  return _this.handleSortClick($event, column, 'ascending');
3808
3833
  }
3809
3834
  }
3810
- }), h('i', { 'class': 'sort-caret descending', on: {
3835
+ }), h('i', {
3836
+ 'class': 'sort-caret descending',
3837
+ on: {
3811
3838
  'click': function click($event) {
3812
3839
  return _this.handleSortClick($event, column, 'descending');
3813
3840
  }
@@ -3815,7 +3842,9 @@ var convertToRows = function convertToRows(originColumns) {
3815
3842
  })]
3816
3843
  ) : '', column.filterable ? h(
3817
3844
  'span',
3818
- { 'class': 'el-table__column-filter-trigger', on: {
3845
+ {
3846
+ 'class': 'el-table__column-filter-trigger',
3847
+ on: {
3819
3848
  'click': function click($event) {
3820
3849
  return _this.handleFilterClick($event, column);
3821
3850
  }
@@ -4015,19 +4044,28 @@ var convertToRows = function convertToRows(originColumns) {
4015
4044
  }, 16);
4016
4045
  },
4017
4046
  handleHeaderClick: function handleHeaderClick(event, column) {
4018
- if (!column.filters && column.sortable) {
4019
- this.handleSortClick(event, column);
4020
- } else if (column.filterable && !column.sortable) {
4021
- this.handleFilterClick(event, column);
4022
- }
4047
+ var _this3 = this;
4023
4048
 
4024
- this.$parent.$emit('header-click', column, event);
4049
+ clearTimeout(this.clickTimer);
4050
+ this.clickTimer = setTimeout(function () {
4051
+ if (!column.filters && column.sortable) {
4052
+ _this3.handleSortClick(event, column);
4053
+ } else if (column.filterable && !column.sortable) {
4054
+ _this3.handleFilterClick(event, column);
4055
+ }
4056
+ _this3.$parent.$emit('header-click', column, event);
4057
+ }, 400);
4058
+ },
4059
+ handleHeaderDblclick: function handleHeaderDblclick(event, column) {
4060
+ // event.stopPropagation()
4061
+ clearTimeout(this.clickTimer);
4062
+ this.$parent.$emit('header-dblclick', column, event);
4025
4063
  },
4026
4064
  handleHeaderContextMenu: function handleHeaderContextMenu(event, column) {
4027
4065
  this.$parent.$emit('header-contextmenu', column, event);
4028
4066
  },
4029
4067
  handleMouseDown: function handleMouseDown(event, column) {
4030
- var _this3 = this;
4068
+ var _this4 = this;
4031
4069
 
4032
4070
  if (this.$isServer) return;
4033
4071
  if (column.children && column.children.length > 0) return;
@@ -4064,15 +4102,15 @@ var convertToRows = function convertToRows(originColumns) {
4064
4102
  };
4065
4103
 
4066
4104
  var handleMouseMove = function handleMouseMove(event) {
4067
- var deltaLeft = event.clientX - _this3.dragState.startMouseLeft;
4068
- var proxyLeft = _this3.dragState.startLeft + deltaLeft;
4105
+ var deltaLeft = event.clientX - _this4.dragState.startMouseLeft;
4106
+ var proxyLeft = _this4.dragState.startLeft + deltaLeft;
4069
4107
 
4070
4108
  resizeProxy.style.left = Math.max(minLeft, proxyLeft) + 'px';
4071
4109
  };
4072
4110
 
4073
4111
  var handleMouseUp = function handleMouseUp() {
4074
- if (_this3.dragging) {
4075
- var _dragState = _this3.dragState,
4112
+ if (_this4.dragging) {
4113
+ var _dragState = _this4.dragState,
4076
4114
  startColumnLeft = _dragState.startColumnLeft,
4077
4115
  startLeft = _dragState.startLeft;
4078
4116
 
@@ -4081,12 +4119,12 @@ var convertToRows = function convertToRows(originColumns) {
4081
4119
  column.width = column.realWidth = columnWidth;
4082
4120
  table.$emit('header-dragend', column.width, startLeft - startColumnLeft, column, event);
4083
4121
 
4084
- _this3.store.scheduleLayout();
4122
+ _this4.store.scheduleLayout();
4085
4123
 
4086
4124
  document.body.style.cursor = '';
4087
- _this3.dragging = false;
4088
- _this3.draggingColumn = null;
4089
- _this3.dragState = {};
4125
+ _this4.dragging = false;
4126
+ _this4.draggingColumn = null;
4127
+ _this4.dragState = {};
4090
4128
 
4091
4129
  table.resizeProxyVisible = false;
4092
4130
  }
@@ -4193,7 +4231,8 @@ var convertToRows = function convertToRows(originColumns) {
4193
4231
  return {
4194
4232
  draggingColumn: null,
4195
4233
  dragging: false,
4196
- dragState: {}
4234
+ dragState: {},
4235
+ clickTimer: null
4197
4236
  };
4198
4237
  }
4199
4238
  });