vxe-table 3.18.6 → 3.18.8

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.
@@ -2695,7 +2695,7 @@ function clearRowDragData($xeTable) {
2695
2695
  * @param {Event} evnt 事件
2696
2696
  * @param {Row} row 行对象
2697
2697
  */
2698
- function handleTooltip($xeTable, evnt, tdEl, overflowElem, tipElem, params) {
2698
+ function handleTooltip($xeTable, evnt, type, tdEl, overflowElem, tipElem, params) {
2699
2699
  const reactData = $xeTable;
2700
2700
  const tipOverEl = overflowElem || tdEl;
2701
2701
  if (!tipOverEl) {
@@ -2711,16 +2711,19 @@ function handleTooltip($xeTable, evnt, tdEl, overflowElem, tipElem, params) {
2711
2711
  const content = useCustom ? customContent : XEUtils.toString(column.type === 'html' ? tipOverEl.innerText : tipOverEl.textContent).trim();
2712
2712
  const isOver = tipOverEl.scrollWidth > tipOverEl.clientWidth;
2713
2713
  if (content && (showAll || useCustom || isOver)) {
2714
+ const tipContent = formatText(content);
2714
2715
  Object.assign(tooltipStore, {
2715
2716
  row,
2716
2717
  column,
2717
2718
  visible: true,
2719
+ content: tipContent,
2720
+ type,
2718
2721
  currOpts: {}
2719
2722
  });
2720
2723
  $xeTable.$nextTick(() => {
2721
2724
  const $tooltip = $xeTable.$refs.refTooltip;
2722
2725
  if ($tooltip && $tooltip.open) {
2723
- $tooltip.open(isOver ? tipOverEl : tipElem, formatText(content));
2726
+ $tooltip.open(isOver ? tipOverEl : tipElem, tipContent);
2724
2727
  }
2725
2728
  });
2726
2729
  }
@@ -6886,7 +6889,7 @@ const Methods = {
6886
6889
  }
6887
6890
  if (tooltipStore.column !== column || !tooltipStore.visible) {
6888
6891
  const ctEl = thEl.querySelector('.vxe-cell--title');
6889
- handleTooltip($xeTable, evnt, thEl, (hasClass(thEl, 'col--ellipsis') ? ctEl : cWrapperEl) || cWrapperEl, ctEl || cellEl, params);
6892
+ handleTooltip($xeTable, evnt, 'header', thEl, (hasClass(thEl, 'col--ellipsis') ? ctEl : cWrapperEl) || cWrapperEl, ctEl || cellEl, params);
6890
6893
  }
6891
6894
  },
6892
6895
  /**
@@ -6925,7 +6928,7 @@ const Methods = {
6925
6928
  if (!tipEl) {
6926
6929
  tipEl = ctEl;
6927
6930
  }
6928
- handleTooltip($xeTable, evnt, tdEl, ovEl || ctEl, tipEl, params);
6931
+ handleTooltip($xeTable, evnt, 'body', tdEl, ovEl || ctEl, tipEl, params);
6929
6932
  }
6930
6933
  },
6931
6934
  /**
@@ -6948,7 +6951,7 @@ const Methods = {
6948
6951
  if (!tipEl) {
6949
6952
  tipEl = ctEl;
6950
6953
  }
6951
- handleTooltip($xeTable, evnt, tdEl, ovEl || ctEl, tipEl, params);
6954
+ handleTooltip($xeTable, evnt, 'footer', tdEl, ovEl || ctEl, tipEl, params);
6952
6955
  }
6953
6956
  },
6954
6957
  openTooltip(target, content) {
@@ -6974,6 +6977,7 @@ const Methods = {
6974
6977
  column: null,
6975
6978
  content: null,
6976
6979
  visible: false,
6980
+ type: null,
6977
6981
  currOpts: {}
6978
6982
  });
6979
6983
  if (tooltip) {
@@ -9990,6 +9994,29 @@ const Methods = {
9990
9994
  }
9991
9995
  return $xeTable.$nextTick();
9992
9996
  },
9997
+ getRowGroups() {
9998
+ const $xeTable = this;
9999
+ const props = $xeTable;
10000
+ const reactData = $xeTable;
10001
+ const internalData = $xeTable;
10002
+ const { aggregateConfig, rowGroupConfig } = props;
10003
+ const { fullColumnFieldData } = internalData;
10004
+ if (aggregateConfig || rowGroupConfig) {
10005
+ const { rowGroupList } = reactData;
10006
+ return rowGroupList.map(({ field }) => {
10007
+ const colRet = fullColumnFieldData[field];
10008
+ if (colRet) {
10009
+ return colRet.column;
10010
+ }
10011
+ return { field };
10012
+ });
10013
+ }
10014
+ return [];
10015
+ },
10016
+ getRowGroupFields() {
10017
+ const $xeTable = this;
10018
+ return $xeTable.getRowGroups().map(item => item.field);
10019
+ },
9993
10020
  clearRowGroups() {
9994
10021
  const $xeTable = this;
9995
10022
  const props = $xeTable;
@@ -631,6 +631,7 @@ export default {
631
631
  column: null,
632
632
  content: null,
633
633
  visible: false,
634
+ type: null,
634
635
  currOpts: {}
635
636
  },
636
637
  // 存放数据校验相关信息
@@ -1865,9 +1866,15 @@ export default {
1865
1866
  const reactData = $xeTable;
1866
1867
  const { xID } = $xeTable;
1867
1868
  const { loading, stripe, showHeader, height, treeConfig, mouseConfig, showFooter, highlightCell, highlightHoverRow, highlightHoverColumn, editConfig, editRules } = props;
1868
- const { isGroup, overflowX, overflowY, scrollXLoad, scrollYLoad, tableData, initStore, isRowGroupStatus, columnStore, filterStore, customStore } = reactData;
1869
+ const { isGroup, overflowX, overflowY, scrollXLoad, scrollYLoad, tableData, initStore, isRowGroupStatus, columnStore, filterStore, customStore, tooltipStore } = reactData;
1869
1870
  const { leftList, rightList } = columnStore;
1870
1871
  const loadingSlot = slots.loading;
1872
+ const tipSlots = {
1873
+ header: slots.headerTooltip || slots['header-tooltip'],
1874
+ body: slots.tooltip,
1875
+ footer: slots.footerTooltip || slots['footer-tooltip']
1876
+ };
1877
+ const currTooltipSlot = tooltipStore.visible && tooltipStore.type ? tipSlots[tooltipStore.type] : null;
1871
1878
  const rowDragOpts = $xeTable.computeRowDragOpts;
1872
1879
  const tableTipConfig = $xeTable.computeTableTipConfig;
1873
1880
  const validTipConfig = $xeTable.computeValidTipConfig;
@@ -2141,8 +2148,39 @@ export default {
2141
2148
  enterable: tableTipConfig.enterable,
2142
2149
  enterDelay: tableTipConfig.enterDelay,
2143
2150
  leaveDelay: tableTipConfig.leaveDelay,
2144
- useHTML: tableTipConfig.useHTML
2145
- }
2151
+ useHTML: tableTipConfig.useHTML,
2152
+ width: tableTipConfig.width,
2153
+ height: tableTipConfig.height,
2154
+ minWidth: tableTipConfig.minWidth,
2155
+ minHeight: tableTipConfig.minHeight,
2156
+ maxWidth: tableTipConfig.maxWidth,
2157
+ maxHeight: tableTipConfig.maxHeight
2158
+ },
2159
+ scopedSlots: currTooltipSlot
2160
+ ? {
2161
+ content: () => {
2162
+ const { type, row, column, content: tooltipContent } = tooltipStore;
2163
+ if (currTooltipSlot) {
2164
+ if (column && type === 'header') {
2165
+ return h('div', {
2166
+ key: type
2167
+ }, currTooltipSlot({ column, tooltipContent, $table: $xeTable, $grid: $xeGrid, $gantt: $xeGantt }));
2168
+ }
2169
+ if (row && column && type === 'body') {
2170
+ return h('div', {
2171
+ key: type
2172
+ }, currTooltipSlot({ row, column, tooltipContent, $table: $xeTable, $grid: $xeGrid, $gantt: $xeGantt }));
2173
+ }
2174
+ if (row && column && type === 'footer') {
2175
+ return h('div', {
2176
+ key: type
2177
+ }, currTooltipSlot({ row, column, tooltipContent, $table: $xeTable, $grid: $xeGrid, $gantt: $xeGantt }));
2178
+ }
2179
+ }
2180
+ return renderEmptyElement($xeTable);
2181
+ }
2182
+ }
2183
+ : {}
2146
2184
  })
2147
2185
  : renderEmptyElement($xeTable),
2148
2186
  /**
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.18.6";
3
+ export const version = "3.18.8";
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.18.6"}`;
3
+ const version = `table v${"3.18.8"}`;
4
4
  export const warnLog = log.create('warn', version);
5
5
  export const errLog = log.create('error', version);
package/lib/index.umd.js CHANGED
@@ -2002,7 +2002,7 @@ function getClass(property, params) {
2002
2002
  ;// CONCATENATED MODULE: ./packages/ui/index.ts
2003
2003
 
2004
2004
 
2005
- const version = "3.18.6";
2005
+ const version = "3.18.8";
2006
2006
  core_.VxeUI.version = version;
2007
2007
  core_.VxeUI.tableVersion = version;
2008
2008
  core_.VxeUI.setConfig({
@@ -2678,7 +2678,7 @@ function isNodeElement(elem) {
2678
2678
  const {
2679
2679
  log: log_log
2680
2680
  } = core_.VxeUI;
2681
- const log_version = `table v${"3.18.6"}`;
2681
+ const log_version = `table v${"3.18.8"}`;
2682
2682
  const warnLog = log_log.create('warn', log_version);
2683
2683
  const errLog = log_log.create('error', log_version);
2684
2684
  ;// CONCATENATED MODULE: ./packages/table/src/columnInfo.ts
@@ -9067,7 +9067,7 @@ function clearRowDragData($xeTable) {
9067
9067
  * @param {Event} evnt 事件
9068
9068
  * @param {Row} row 行对象
9069
9069
  */
9070
- function handleTooltip($xeTable, evnt, tdEl, overflowElem, tipElem, params) {
9070
+ function handleTooltip($xeTable, evnt, type, tdEl, overflowElem, tipElem, params) {
9071
9071
  const reactData = $xeTable;
9072
9072
  const tipOverEl = overflowElem || tdEl;
9073
9073
  if (!tipOverEl) {
@@ -9091,16 +9091,19 @@ function handleTooltip($xeTable, evnt, tdEl, overflowElem, tipElem, params) {
9091
9091
  const content = useCustom ? customContent : external_root_XEUtils_commonjs_xe_utils_commonjs2_xe_utils_amd_xe_utils_default().toString(column.type === 'html' ? tipOverEl.innerText : tipOverEl.textContent).trim();
9092
9092
  const isOver = tipOverEl.scrollWidth > tipOverEl.clientWidth;
9093
9093
  if (content && (showAll || useCustom || isOver)) {
9094
+ const tipContent = formatText(content);
9094
9095
  Object.assign(tooltipStore, {
9095
9096
  row,
9096
9097
  column,
9097
9098
  visible: true,
9099
+ content: tipContent,
9100
+ type,
9098
9101
  currOpts: {}
9099
9102
  });
9100
9103
  $xeTable.$nextTick(() => {
9101
9104
  const $tooltip = $xeTable.$refs.refTooltip;
9102
9105
  if ($tooltip && $tooltip.open) {
9103
- $tooltip.open(isOver ? tipOverEl : tipElem, formatText(content));
9106
+ $tooltip.open(isOver ? tipOverEl : tipElem, tipContent);
9104
9107
  }
9105
9108
  });
9106
9109
  }
@@ -13857,7 +13860,7 @@ const Methods = {
13857
13860
  }
13858
13861
  if (tooltipStore.column !== column || !tooltipStore.visible) {
13859
13862
  const ctEl = thEl.querySelector('.vxe-cell--title');
13860
- handleTooltip($xeTable, evnt, thEl, (hasClass(thEl, 'col--ellipsis') ? ctEl : cWrapperEl) || cWrapperEl, ctEl || cellEl, params);
13863
+ handleTooltip($xeTable, evnt, 'header', thEl, (hasClass(thEl, 'col--ellipsis') ? ctEl : cWrapperEl) || cWrapperEl, ctEl || cellEl, params);
13861
13864
  }
13862
13865
  },
13863
13866
  /**
@@ -13907,7 +13910,7 @@ const Methods = {
13907
13910
  if (!tipEl) {
13908
13911
  tipEl = ctEl;
13909
13912
  }
13910
- handleTooltip($xeTable, evnt, tdEl, ovEl || ctEl, tipEl, params);
13913
+ handleTooltip($xeTable, evnt, 'body', tdEl, ovEl || ctEl, tipEl, params);
13911
13914
  }
13912
13915
  },
13913
13916
  /**
@@ -13934,7 +13937,7 @@ const Methods = {
13934
13937
  if (!tipEl) {
13935
13938
  tipEl = ctEl;
13936
13939
  }
13937
- handleTooltip($xeTable, evnt, tdEl, ovEl || ctEl, tipEl, params);
13940
+ handleTooltip($xeTable, evnt, 'footer', tdEl, ovEl || ctEl, tipEl, params);
13938
13941
  }
13939
13942
  },
13940
13943
  openTooltip(target, content) {
@@ -13964,6 +13967,7 @@ const Methods = {
13964
13967
  column: null,
13965
13968
  content: null,
13966
13969
  visible: false,
13970
+ type: null,
13967
13971
  currOpts: {}
13968
13972
  });
13969
13973
  if (tooltip) {
@@ -17509,6 +17513,40 @@ const Methods = {
17509
17513
  }
17510
17514
  return $xeTable.$nextTick();
17511
17515
  },
17516
+ getRowGroups() {
17517
+ const $xeTable = this;
17518
+ const props = $xeTable;
17519
+ const reactData = $xeTable;
17520
+ const internalData = $xeTable;
17521
+ const {
17522
+ aggregateConfig,
17523
+ rowGroupConfig
17524
+ } = props;
17525
+ const {
17526
+ fullColumnFieldData
17527
+ } = internalData;
17528
+ if (aggregateConfig || rowGroupConfig) {
17529
+ const {
17530
+ rowGroupList
17531
+ } = reactData;
17532
+ return rowGroupList.map(({
17533
+ field
17534
+ }) => {
17535
+ const colRet = fullColumnFieldData[field];
17536
+ if (colRet) {
17537
+ return colRet.column;
17538
+ }
17539
+ return {
17540
+ field
17541
+ };
17542
+ });
17543
+ }
17544
+ return [];
17545
+ },
17546
+ getRowGroupFields() {
17547
+ const $xeTable = this;
17548
+ return $xeTable.getRowGroups().map(item => item.field);
17549
+ },
17512
17550
  clearRowGroups() {
17513
17551
  const $xeTable = this;
17514
17552
  const props = $xeTable;
@@ -30135,6 +30173,7 @@ function renderBody(h, $xeTable) {
30135
30173
  column: null,
30136
30174
  content: null,
30137
30175
  visible: false,
30176
+ type: null,
30138
30177
  currOpts: {}
30139
30178
  },
30140
30179
  // 存放数据校验相关信息
@@ -31505,13 +31544,20 @@ function renderBody(h, $xeTable) {
31505
31544
  isRowGroupStatus,
31506
31545
  columnStore,
31507
31546
  filterStore,
31508
- customStore
31547
+ customStore,
31548
+ tooltipStore
31509
31549
  } = reactData;
31510
31550
  const {
31511
31551
  leftList,
31512
31552
  rightList
31513
31553
  } = columnStore;
31514
31554
  const loadingSlot = slots.loading;
31555
+ const tipSlots = {
31556
+ header: slots.headerTooltip || slots['header-tooltip'],
31557
+ body: slots.tooltip,
31558
+ footer: slots.footerTooltip || slots['footer-tooltip']
31559
+ };
31560
+ const currTooltipSlot = tooltipStore.visible && tooltipStore.type ? tipSlots[tooltipStore.type] : null;
31515
31561
  const rowDragOpts = $xeTable.computeRowDragOpts;
31516
31562
  const tableTipConfig = $xeTable.computeTableTipConfig;
31517
31563
  const validTipConfig = $xeTable.computeValidTipConfig;
@@ -31748,8 +31794,62 @@ function renderBody(h, $xeTable) {
31748
31794
  enterable: tableTipConfig.enterable,
31749
31795
  enterDelay: tableTipConfig.enterDelay,
31750
31796
  leaveDelay: tableTipConfig.leaveDelay,
31751
- useHTML: tableTipConfig.useHTML
31752
- }
31797
+ useHTML: tableTipConfig.useHTML,
31798
+ width: tableTipConfig.width,
31799
+ height: tableTipConfig.height,
31800
+ minWidth: tableTipConfig.minWidth,
31801
+ minHeight: tableTipConfig.minHeight,
31802
+ maxWidth: tableTipConfig.maxWidth,
31803
+ maxHeight: tableTipConfig.maxHeight
31804
+ },
31805
+ scopedSlots: currTooltipSlot ? {
31806
+ content: () => {
31807
+ const {
31808
+ type,
31809
+ row,
31810
+ column,
31811
+ content: tooltipContent
31812
+ } = tooltipStore;
31813
+ if (currTooltipSlot) {
31814
+ if (column && type === 'header') {
31815
+ return h('div', {
31816
+ key: type
31817
+ }, currTooltipSlot({
31818
+ column,
31819
+ tooltipContent,
31820
+ $table: $xeTable,
31821
+ $grid: $xeGrid,
31822
+ $gantt: $xeGantt
31823
+ }));
31824
+ }
31825
+ if (row && column && type === 'body') {
31826
+ return h('div', {
31827
+ key: type
31828
+ }, currTooltipSlot({
31829
+ row,
31830
+ column,
31831
+ tooltipContent,
31832
+ $table: $xeTable,
31833
+ $grid: $xeGrid,
31834
+ $gantt: $xeGantt
31835
+ }));
31836
+ }
31837
+ if (row && column && type === 'footer') {
31838
+ return h('div', {
31839
+ key: type
31840
+ }, currTooltipSlot({
31841
+ row,
31842
+ column,
31843
+ tooltipContent,
31844
+ $table: $xeTable,
31845
+ $grid: $xeGrid,
31846
+ $gantt: $xeGantt
31847
+ }));
31848
+ }
31849
+ }
31850
+ return table_renderEmptyElement($xeTable);
31851
+ }
31852
+ } : {}
31753
31853
  }) : table_renderEmptyElement($xeTable),
31754
31854
  /**
31755
31855
  * 校验提示