vxe-table 3.15.0-beta.2 → 3.15.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.
@@ -1,7 +1,7 @@
1
1
  import XEUtils from 'xe-utils';
2
2
  import { VxeUI } from '../../../ui';
3
3
  import { toFilters, handleFieldOrColumn, getRefElem } from '../../src/util';
4
- import { getDomNode, triggerEvent } from '../../../ui/src/dom';
4
+ import { toCssUnit, triggerEvent } from '../../../ui/src/dom';
5
5
  import { isEnableConf } from '../../../ui/src/utils';
6
6
  const { renderer } = VxeUI;
7
7
  export default {
@@ -18,7 +18,7 @@ export default {
18
18
  return this.scrollToColumn(column).then(() => {
19
19
  const headerWrapperElem = elemStore[`${fixed || 'main'}-header-wrapper`] || elemStore['main-header-wrapper'];
20
20
  if (headerWrapperElem) {
21
- const filterBtnElem = headerWrapperElem.querySelector(`.vxe-header--column.${column.id} .vxe-filter--btn`);
21
+ const filterBtnElem = headerWrapperElem.querySelector(`.vxe-header--column.${column.id} .vxe-cell--filter`);
22
22
  triggerEvent(filterBtnElem, 'click');
23
23
  }
24
24
  });
@@ -70,11 +70,9 @@ export default {
70
70
  filterStore.visible = false;
71
71
  }
72
72
  else {
73
- const { clientY, pageX } = evnt;
74
73
  const el = $xeTable.$refs.refElem;
75
74
  const tableRect = el.getBoundingClientRect();
76
- const targetElem = evnt.target;
77
- const { visibleWidth } = getDomNode();
75
+ const btnElem = evnt.currentTarget;
78
76
  const { filters, filterMultiple, filterRender } = column;
79
77
  const compConf = isEnableConf(filterRender) ? renderer.get(filterRender.name) : null;
80
78
  const frMethod = column.filterRecoverMethod || (compConf ? (compConf.tableFilterRecoverMethod || compConf.filterRecoverMethod) : null);
@@ -108,44 +106,19 @@ export default {
108
106
  if (!filterWrapperElem) {
109
107
  return;
110
108
  }
109
+ const btnRect = btnElem.getBoundingClientRect();
111
110
  const filterWidth = filterWrapperElem.offsetWidth;
112
111
  const filterHeadElem = filterWrapperElem.querySelector('.vxe-table--filter-header');
113
112
  const filterFootElem = filterWrapperElem.querySelector('.vxe-table--filter-footer');
114
113
  const centerWidth = filterWidth / 2;
115
- const minMargin = 10;
116
- const maxLeft = el.clientWidth - filterWidth - minMargin;
117
- let left, right;
118
- const thEl = targetElem.offsetParent;
119
- const trEl = thEl.offsetParent;
120
- const style = {
121
- top: `${targetElem.offsetTop + thEl.offsetTop + targetElem.offsetHeight}px`
122
- };
114
+ const left = btnRect.left - tableRect.left - centerWidth;
115
+ const top = btnRect.top - tableRect.top + btnElem.clientHeight;
123
116
  // 判断面板不能大于表格高度
124
- const maxHeight = Math.max(40, el.clientHeight - (clientY - tableRect.y) - (filterHeadElem ? filterHeadElem.clientHeight : 0) - (filterFootElem ? filterFootElem.clientHeight : 0) - 14);
125
- if (column.fixed === 'left') {
126
- left = targetElem.offsetLeft + thEl.offsetLeft - centerWidth;
127
- }
128
- else if (column.fixed === 'right') {
129
- right = (thEl.offsetWidth - targetElem.offsetLeft) + (trEl.offsetWidth - trEl.offsetLeft) - column.renderWidth - centerWidth;
130
- }
131
- else {
132
- left = targetElem.offsetLeft + thEl.offsetLeft - centerWidth - headerScrollElem.scrollLeft;
133
- }
134
- if (left) {
135
- const overflowWidth = (pageX + filterWidth - centerWidth + minMargin) - visibleWidth;
136
- if (overflowWidth > 0) {
137
- left -= overflowWidth;
138
- }
139
- style.left = `${Math.min(maxLeft, Math.max(minMargin, left))}px`;
140
- }
141
- else if (right) {
142
- const overflowWidth = (pageX + filterWidth - centerWidth + minMargin) - visibleWidth;
143
- if (overflowWidth > 0) {
144
- right += overflowWidth;
145
- }
146
- style.right = `${Math.max(minMargin, right)}px`;
147
- }
148
- filterStore.style = style;
117
+ const maxHeight = Math.max(40, el.clientHeight - top - (filterHeadElem ? filterHeadElem.clientHeight : 0) - (filterFootElem ? filterFootElem.clientHeight : 0) - 14);
118
+ filterStore.style = {
119
+ top: toCssUnit(top),
120
+ left: toCssUnit(left)
121
+ };
149
122
  filterStore.maxHeight = maxHeight;
150
123
  });
151
124
  }
@@ -885,19 +885,19 @@ export const Cell = {
885
885
  h('span', {
886
886
  class: ['vxe-cell--filter', {
887
887
  'is--active': filterStore.visible && filterStore.column === column
888
- }]
888
+ }],
889
+ on: {
890
+ click(evnt) {
891
+ if ($table.triggerFilterEvent) {
892
+ $table.triggerFilterEvent(evnt, params.column, params);
893
+ }
894
+ }
895
+ }
889
896
  }, [
890
897
  h('i', {
891
898
  class: ['vxe-filter--btn', hasFilter ? (iconMatch || getIcon().TABLE_FILTER_MATCH) : (iconNone || getIcon().TABLE_FILTER_NONE)],
892
899
  attrs: {
893
900
  title: getI18n('vxe.table.filter')
894
- },
895
- on: {
896
- click(evnt) {
897
- if ($table.triggerFilterEvent) {
898
- $table.triggerFilterEvent(evnt, params.column, params);
899
- }
900
- }
901
901
  }
902
902
  })
903
903
  ])
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 = "3.15.0-beta.2";
3
+ export const version = "3.15.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${"3.15.0-beta.2"}`;
3
+ const version = `table v${"3.15.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
@@ -2220,7 +2220,7 @@ function getClass(property, params) {
2220
2220
  ;// CONCATENATED MODULE: ./packages/ui/index.ts
2221
2221
 
2222
2222
 
2223
- const version = "3.15.0-beta.2";
2223
+ const version = "3.15.0-beta.3";
2224
2224
  core_.VxeUI.version = version;
2225
2225
  core_.VxeUI.tableVersion = version;
2226
2226
  core_.VxeUI.setConfig({
@@ -2843,7 +2843,7 @@ function isNodeElement(elem) {
2843
2843
  const {
2844
2844
  log: log_log
2845
2845
  } = core_.VxeUI;
2846
- const log_version = `table v${"3.15.0-beta.2"}`;
2846
+ const log_version = `table v${"3.15.0-beta.3"}`;
2847
2847
  const warnLog = log_log.create('warn', log_version);
2848
2848
  const errLog = log_log.create('error', log_version);
2849
2849
  ;// CONCATENATED MODULE: ./packages/table/src/columnInfo.ts
@@ -4734,12 +4734,7 @@ const Cell = {
4734
4734
  return [h('span', {
4735
4735
  class: ['vxe-cell--filter', {
4736
4736
  'is--active': filterStore.visible && filterStore.column === column
4737
- }]
4738
- }, [h('i', {
4739
- class: ['vxe-filter--btn', hasFilter ? iconMatch || cell_getIcon().TABLE_FILTER_MATCH : iconNone || cell_getIcon().TABLE_FILTER_NONE],
4740
- attrs: {
4741
- title: cell_getI18n('vxe.table.filter')
4742
- },
4737
+ }],
4743
4738
  on: {
4744
4739
  click(evnt) {
4745
4740
  if ($table.triggerFilterEvent) {
@@ -4747,6 +4742,11 @@ const Cell = {
4747
4742
  }
4748
4743
  }
4749
4744
  }
4745
+ }, [h('i', {
4746
+ class: ['vxe-filter--btn', hasFilter ? iconMatch || cell_getIcon().TABLE_FILTER_MATCH : iconNone || cell_getIcon().TABLE_FILTER_NONE],
4747
+ attrs: {
4748
+ title: cell_getI18n('vxe.table.filter')
4749
+ }
4750
4750
  })])];
4751
4751
  }
4752
4752
  return [];
@@ -20563,7 +20563,7 @@ const {
20563
20563
  return this.scrollToColumn(column).then(() => {
20564
20564
  const headerWrapperElem = elemStore[`${fixed || 'main'}-header-wrapper`] || elemStore['main-header-wrapper'];
20565
20565
  if (headerWrapperElem) {
20566
- const filterBtnElem = headerWrapperElem.querySelector(`.vxe-header--column.${column.id} .vxe-filter--btn`);
20566
+ const filterBtnElem = headerWrapperElem.querySelector(`.vxe-header--column.${column.id} .vxe-cell--filter`);
20567
20567
  triggerEvent(filterBtnElem, 'click');
20568
20568
  }
20569
20569
  });
@@ -20622,16 +20622,9 @@ const {
20622
20622
  if (filterStore.column === column && filterStore.visible) {
20623
20623
  filterStore.visible = false;
20624
20624
  } else {
20625
- const {
20626
- clientY,
20627
- pageX
20628
- } = evnt;
20629
20625
  const el = $xeTable.$refs.refElem;
20630
20626
  const tableRect = el.getBoundingClientRect();
20631
- const targetElem = evnt.target;
20632
- const {
20633
- visibleWidth
20634
- } = getDomNode();
20627
+ const btnElem = evnt.currentTarget;
20635
20628
  const {
20636
20629
  filters,
20637
20630
  filterMultiple,
@@ -20676,41 +20669,19 @@ const {
20676
20669
  if (!filterWrapperElem) {
20677
20670
  return;
20678
20671
  }
20672
+ const btnRect = btnElem.getBoundingClientRect();
20679
20673
  const filterWidth = filterWrapperElem.offsetWidth;
20680
20674
  const filterHeadElem = filterWrapperElem.querySelector('.vxe-table--filter-header');
20681
20675
  const filterFootElem = filterWrapperElem.querySelector('.vxe-table--filter-footer');
20682
20676
  const centerWidth = filterWidth / 2;
20683
- const minMargin = 10;
20684
- const maxLeft = el.clientWidth - filterWidth - minMargin;
20685
- let left, right;
20686
- const thEl = targetElem.offsetParent;
20687
- const trEl = thEl.offsetParent;
20688
- const style = {
20689
- top: `${targetElem.offsetTop + thEl.offsetTop + targetElem.offsetHeight}px`
20690
- };
20677
+ const left = btnRect.left - tableRect.left - centerWidth;
20678
+ const top = btnRect.top - tableRect.top + btnElem.clientHeight;
20691
20679
  // 判断面板不能大于表格高度
20692
- const maxHeight = Math.max(40, el.clientHeight - (clientY - tableRect.y) - (filterHeadElem ? filterHeadElem.clientHeight : 0) - (filterFootElem ? filterFootElem.clientHeight : 0) - 14);
20693
- if (column.fixed === 'left') {
20694
- left = targetElem.offsetLeft + thEl.offsetLeft - centerWidth;
20695
- } else if (column.fixed === 'right') {
20696
- right = thEl.offsetWidth - targetElem.offsetLeft + (trEl.offsetWidth - trEl.offsetLeft) - column.renderWidth - centerWidth;
20697
- } else {
20698
- left = targetElem.offsetLeft + thEl.offsetLeft - centerWidth - headerScrollElem.scrollLeft;
20699
- }
20700
- if (left) {
20701
- const overflowWidth = pageX + filterWidth - centerWidth + minMargin - visibleWidth;
20702
- if (overflowWidth > 0) {
20703
- left -= overflowWidth;
20704
- }
20705
- style.left = `${Math.min(maxLeft, Math.max(minMargin, left))}px`;
20706
- } else if (right) {
20707
- const overflowWidth = pageX + filterWidth - centerWidth + minMargin - visibleWidth;
20708
- if (overflowWidth > 0) {
20709
- right += overflowWidth;
20710
- }
20711
- style.right = `${Math.max(minMargin, right)}px`;
20712
- }
20713
- filterStore.style = style;
20680
+ const maxHeight = Math.max(40, el.clientHeight - top - (filterHeadElem ? filterHeadElem.clientHeight : 0) - (filterFootElem ? filterFootElem.clientHeight : 0) - 14);
20681
+ filterStore.style = {
20682
+ top: toCssUnit(top),
20683
+ left: toCssUnit(left)
20684
+ };
20714
20685
  filterStore.maxHeight = maxHeight;
20715
20686
  });
20716
20687
  }