vxe-table 4.13.0-beta.2 → 4.13.0-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.
@@ -2,7 +2,7 @@ import { nextTick } from 'vue';
2
2
  import XEUtils from 'xe-utils';
3
3
  import { VxeUI } from '../../../ui';
4
4
  import { toFilters, handleFieldOrColumn, getRefElem } from '../../src/util';
5
- import { getDomNode, triggerEvent } from '../../../ui/src/dom';
5
+ import { toCssUnit, triggerEvent } from '../../../ui/src/dom';
6
6
  import { isEnableConf } from '../../../ui/src/utils';
7
7
  const { renderer, hooks } = VxeUI;
8
8
  const tableFilterMethodKeys = ['openFilter', 'setFilter', 'clearFilter', 'saveFilterPanel', 'resetFilterPanel', 'getCheckedFilters', 'updateFilterOptionStatus'];
@@ -66,11 +66,9 @@ hooks.add('tableFilterModule', {
66
66
  filterStore.visible = false;
67
67
  }
68
68
  else {
69
- const { clientY, pageX } = evnt;
70
69
  const el = refElem.value;
71
70
  const tableRect = el.getBoundingClientRect();
72
- const targetElem = evnt.target;
73
- const { visibleWidth } = getDomNode();
71
+ const btnElem = evnt.currentTarget;
74
72
  const { filters, filterMultiple, filterRender } = column;
75
73
  const compConf = isEnableConf(filterRender) ? renderer.get(filterRender.name) : null;
76
74
  const frMethod = column.filterRecoverMethod || (compConf ? (compConf.tableFilterRecoverMethod || compConf.filterRecoverMethod) : null);
@@ -104,44 +102,19 @@ hooks.add('tableFilterModule', {
104
102
  if (!filterWrapperElem) {
105
103
  return;
106
104
  }
105
+ const btnRect = btnElem.getBoundingClientRect();
107
106
  const filterWidth = filterWrapperElem.offsetWidth;
108
107
  const filterHeadElem = filterWrapperElem.querySelector('.vxe-table--filter-header');
109
108
  const filterFootElem = filterWrapperElem.querySelector('.vxe-table--filter-footer');
110
109
  const centerWidth = filterWidth / 2;
111
- const minMargin = 10;
112
- const maxLeft = el.clientWidth - filterWidth - minMargin;
113
- let left, right;
114
- const thEl = targetElem.offsetParent;
115
- const trEl = thEl.offsetParent;
116
- const style = {
117
- top: `${targetElem.offsetTop + thEl.offsetTop + targetElem.offsetHeight}px`
118
- };
110
+ const left = btnRect.left - tableRect.left - centerWidth;
111
+ const top = btnRect.top - tableRect.top + btnElem.clientHeight;
119
112
  // 判断面板不能大于表格高度
120
- const maxHeight = Math.max(40, el.clientHeight - (clientY - tableRect.y) - (filterHeadElem ? filterHeadElem.clientHeight : 0) - (filterFootElem ? filterFootElem.clientHeight : 0) - 14);
121
- if (column.fixed === 'left') {
122
- left = targetElem.offsetLeft + thEl.offsetLeft - centerWidth;
123
- }
124
- else if (column.fixed === 'right') {
125
- right = (thEl.offsetWidth - targetElem.offsetLeft) + (trEl.offsetWidth - trEl.offsetLeft) - column.renderWidth - centerWidth;
126
- }
127
- else {
128
- left = targetElem.offsetLeft + thEl.offsetLeft - centerWidth - headerScrollElem.scrollLeft;
129
- }
130
- if (left) {
131
- const overflowWidth = (pageX + filterWidth - centerWidth + minMargin) - visibleWidth;
132
- if (overflowWidth > 0) {
133
- left -= overflowWidth;
134
- }
135
- style.left = `${Math.min(maxLeft, Math.max(minMargin, left))}px`;
136
- }
137
- else if (right) {
138
- const overflowWidth = (pageX + filterWidth - centerWidth + minMargin) - visibleWidth;
139
- if (overflowWidth > 0) {
140
- right += overflowWidth;
141
- }
142
- style.right = `${Math.max(minMargin, right)}px`;
143
- }
144
- filterStore.style = style;
113
+ const maxHeight = Math.max(40, el.clientHeight - top - (filterHeadElem ? filterHeadElem.clientHeight : 0) - (filterFootElem ? filterFootElem.clientHeight : 0) - 14);
114
+ filterStore.style = {
115
+ top: toCssUnit(top),
116
+ left: toCssUnit(left)
117
+ };
145
118
  filterStore.maxHeight = maxHeight;
146
119
  });
147
120
  }
@@ -251,7 +224,7 @@ hooks.add('tableFilterModule', {
251
224
  return $xeTable.scrollToColumn(column).then(() => {
252
225
  const headerWrapperElem = getRefElem(elemStore[`${fixed || 'main'}-header-wrapper`] || elemStore['main-header-wrapper']);
253
226
  if (headerWrapperElem) {
254
- const filterBtnElem = headerWrapperElem.querySelector(`.vxe-header--column.${column.id} .vxe-filter--btn`);
227
+ const filterBtnElem = headerWrapperElem.querySelector(`.vxe-header--column.${column.id} .vxe-cell--filter`);
255
228
  triggerEvent(filterBtnElem, 'click');
256
229
  }
257
230
  });
@@ -882,16 +882,16 @@ export const Cell = {
882
882
  h('span', {
883
883
  class: ['vxe-cell--filter', {
884
884
  'is--active': filterStore.visible && filterStore.column === column
885
- }]
885
+ }],
886
+ onClick(evnt) {
887
+ if ($table.triggerFilterEvent) {
888
+ $table.triggerFilterEvent(evnt, params.column, params);
889
+ }
890
+ }
886
891
  }, [
887
892
  h('i', {
888
893
  class: ['vxe-filter--btn', hasFilter ? (iconMatch || getIcon().TABLE_FILTER_MATCH) : (iconNone || getIcon().TABLE_FILTER_NONE)],
889
- title: getI18n('vxe.table.filter'),
890
- onClick(evnt) {
891
- if ($table.triggerFilterEvent) {
892
- $table.triggerFilterEvent(evnt, params.column, params);
893
- }
894
- }
894
+ title: getI18n('vxe.table.filter')
895
895
  })
896
896
  ])
897
897
  ];
package/es/ui/index.js CHANGED
@@ -1,6 +1,6 @@
1
1
  import { VxeUI } from '@vxe-ui/core';
2
2
  import { getFuncText } from './src/utils';
3
- export const version = "4.13.0-beta.2";
3
+ export const version = "4.13.0-beta.3";
4
4
  VxeUI.version = version;
5
5
  VxeUI.tableVersion = version;
6
6
  VxeUI.setConfig({
package/es/ui/src/log.js CHANGED
@@ -1,5 +1,5 @@
1
1
  import { VxeUI } from '@vxe-ui/core';
2
2
  const { log } = VxeUI;
3
- const version = `table v${"4.13.0-beta.2"}`;
3
+ const version = `table v${"4.13.0-beta.3"}`;
4
4
  export const warnLog = log.create('warn', version);
5
5
  export const errLog = log.create('error', version);
package/lib/index.umd.js CHANGED
@@ -3138,7 +3138,7 @@ function eqEmptyValue(cellValue) {
3138
3138
  ;// ./packages/ui/index.ts
3139
3139
 
3140
3140
 
3141
- const version = "4.13.0-beta.2";
3141
+ const version = "4.13.0-beta.3";
3142
3142
  core_.VxeUI.version = version;
3143
3143
  core_.VxeUI.tableVersion = version;
3144
3144
  core_.VxeUI.setConfig({
@@ -3587,7 +3587,7 @@ var esnext_iterator_some = __webpack_require__(7550);
3587
3587
  const {
3588
3588
  log: log_log
3589
3589
  } = core_.VxeUI;
3590
- const log_version = `table v${"4.13.0-beta.2"}`;
3590
+ const log_version = `table v${"4.13.0-beta.3"}`;
3591
3591
  const warnLog = log_log.create('warn', log_version);
3592
3592
  const errLog = log_log.create('error', log_version);
3593
3593
  ;// ./packages/table/src/columnInfo.ts
@@ -5806,15 +5806,15 @@ const Cell = {
5806
5806
  return [(0,external_commonjs_vue_commonjs2_vue_root_Vue_.h)('span', {
5807
5807
  class: ['vxe-cell--filter', {
5808
5808
  'is--active': filterStore.visible && filterStore.column === column
5809
- }]
5810
- }, [(0,external_commonjs_vue_commonjs2_vue_root_Vue_.h)('i', {
5811
- class: ['vxe-filter--btn', hasFilter ? iconMatch || cell_getIcon().TABLE_FILTER_MATCH : iconNone || cell_getIcon().TABLE_FILTER_NONE],
5812
- title: cell_getI18n('vxe.table.filter'),
5809
+ }],
5813
5810
  onClick(evnt) {
5814
5811
  if ($table.triggerFilterEvent) {
5815
5812
  $table.triggerFilterEvent(evnt, params.column, params);
5816
5813
  }
5817
5814
  }
5815
+ }, [(0,external_commonjs_vue_commonjs2_vue_root_Vue_.h)('i', {
5816
+ class: ['vxe-filter--btn', hasFilter ? iconMatch || cell_getIcon().TABLE_FILTER_MATCH : iconNone || cell_getIcon().TABLE_FILTER_NONE],
5817
+ title: cell_getI18n('vxe.table.filter')
5818
5818
  })])];
5819
5819
  }
5820
5820
  return [];
@@ -13664,16 +13664,9 @@ hook_hooks.add('tableFilterModule', {
13664
13664
  if (filterStore.column === column && filterStore.visible) {
13665
13665
  filterStore.visible = false;
13666
13666
  } else {
13667
- const {
13668
- clientY,
13669
- pageX
13670
- } = evnt;
13671
13667
  const el = refElem.value;
13672
13668
  const tableRect = el.getBoundingClientRect();
13673
- const targetElem = evnt.target;
13674
- const {
13675
- visibleWidth
13676
- } = getDomNode();
13669
+ const btnElem = evnt.currentTarget;
13677
13670
  const {
13678
13671
  filters,
13679
13672
  filterMultiple,
@@ -13718,41 +13711,19 @@ hook_hooks.add('tableFilterModule', {
13718
13711
  if (!filterWrapperElem) {
13719
13712
  return;
13720
13713
  }
13714
+ const btnRect = btnElem.getBoundingClientRect();
13721
13715
  const filterWidth = filterWrapperElem.offsetWidth;
13722
13716
  const filterHeadElem = filterWrapperElem.querySelector('.vxe-table--filter-header');
13723
13717
  const filterFootElem = filterWrapperElem.querySelector('.vxe-table--filter-footer');
13724
13718
  const centerWidth = filterWidth / 2;
13725
- const minMargin = 10;
13726
- const maxLeft = el.clientWidth - filterWidth - minMargin;
13727
- let left, right;
13728
- const thEl = targetElem.offsetParent;
13729
- const trEl = thEl.offsetParent;
13730
- const style = {
13731
- top: `${targetElem.offsetTop + thEl.offsetTop + targetElem.offsetHeight}px`
13732
- };
13719
+ const left = btnRect.left - tableRect.left - centerWidth;
13720
+ const top = btnRect.top - tableRect.top + btnElem.clientHeight;
13733
13721
  // 判断面板不能大于表格高度
13734
- const maxHeight = Math.max(40, el.clientHeight - (clientY - tableRect.y) - (filterHeadElem ? filterHeadElem.clientHeight : 0) - (filterFootElem ? filterFootElem.clientHeight : 0) - 14);
13735
- if (column.fixed === 'left') {
13736
- left = targetElem.offsetLeft + thEl.offsetLeft - centerWidth;
13737
- } else if (column.fixed === 'right') {
13738
- right = thEl.offsetWidth - targetElem.offsetLeft + (trEl.offsetWidth - trEl.offsetLeft) - column.renderWidth - centerWidth;
13739
- } else {
13740
- left = targetElem.offsetLeft + thEl.offsetLeft - centerWidth - headerScrollElem.scrollLeft;
13741
- }
13742
- if (left) {
13743
- const overflowWidth = pageX + filterWidth - centerWidth + minMargin - visibleWidth;
13744
- if (overflowWidth > 0) {
13745
- left -= overflowWidth;
13746
- }
13747
- style.left = `${Math.min(maxLeft, Math.max(minMargin, left))}px`;
13748
- } else if (right) {
13749
- const overflowWidth = pageX + filterWidth - centerWidth + minMargin - visibleWidth;
13750
- if (overflowWidth > 0) {
13751
- right += overflowWidth;
13752
- }
13753
- style.right = `${Math.max(minMargin, right)}px`;
13754
- }
13755
- filterStore.style = style;
13722
+ const maxHeight = Math.max(40, el.clientHeight - top - (filterHeadElem ? filterHeadElem.clientHeight : 0) - (filterFootElem ? filterFootElem.clientHeight : 0) - 14);
13723
+ filterStore.style = {
13724
+ top: toCssUnit(top),
13725
+ left: toCssUnit(left)
13726
+ };
13756
13727
  filterStore.maxHeight = maxHeight;
13757
13728
  });
13758
13729
  }
@@ -13904,7 +13875,7 @@ hook_hooks.add('tableFilterModule', {
13904
13875
  return $xeTable.scrollToColumn(column).then(() => {
13905
13876
  const headerWrapperElem = getRefElem(elemStore[`${fixed || 'main'}-header-wrapper`] || elemStore['main-header-wrapper']);
13906
13877
  if (headerWrapperElem) {
13907
- const filterBtnElem = headerWrapperElem.querySelector(`.vxe-header--column.${column.id} .vxe-filter--btn`);
13878
+ const filterBtnElem = headerWrapperElem.querySelector(`.vxe-header--column.${column.id} .vxe-cell--filter`);
13908
13879
  triggerEvent(filterBtnElem, 'click');
13909
13880
  }
13910
13881
  });