vxe-table 3.15.0-beta.2 → 3.15.0-beta.4

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.
Files changed (37) hide show
  1. package/es/grid/src/grid.js +8 -8
  2. package/es/style.css +1 -1
  3. package/es/table/module/filter/mixin.js +11 -38
  4. package/es/table/src/cell.js +8 -8
  5. package/es/table/src/methods.js +27 -9
  6. package/es/table/src/table.js +6 -0
  7. package/es/ui/index.js +1 -1
  8. package/es/ui/src/log.js +1 -1
  9. package/lib/grid/src/grid.js +10 -10
  10. package/lib/grid/src/grid.min.js +1 -1
  11. package/lib/index.umd.js +74 -74
  12. package/lib/index.umd.min.js +1 -1
  13. package/lib/style.css +1 -1
  14. package/lib/table/module/filter/mixin.js +10 -39
  15. package/lib/table/module/filter/mixin.min.js +1 -1
  16. package/lib/table/src/cell.js +6 -6
  17. package/lib/table/src/cell.min.js +1 -1
  18. package/lib/table/src/methods.js +38 -17
  19. package/lib/table/src/methods.min.js +1 -1
  20. package/lib/table/src/table.js +6 -0
  21. package/lib/table/src/table.min.js +1 -1
  22. package/lib/ui/index.js +1 -1
  23. package/lib/ui/index.min.js +1 -1
  24. package/lib/ui/src/log.js +1 -1
  25. package/lib/ui/src/log.min.js +1 -1
  26. package/package.json +2 -2
  27. package/packages/grid/src/grid.ts +21 -21
  28. package/packages/table/module/filter/mixin.ts +10 -34
  29. package/packages/table/src/cell.ts +8 -8
  30. package/packages/table/src/methods.ts +29 -13
  31. package/packages/table/src/table.ts +6 -0
  32. /package/es/{iconfont.1743992159333.ttf → iconfont.1744095177947.ttf} +0 -0
  33. /package/es/{iconfont.1743992159333.woff → iconfont.1744095177947.woff} +0 -0
  34. /package/es/{iconfont.1743992159333.woff2 → iconfont.1744095177947.woff2} +0 -0
  35. /package/lib/{iconfont.1743992159333.ttf → iconfont.1744095177947.ttf} +0 -0
  36. /package/lib/{iconfont.1743992159333.woff → iconfont.1744095177947.woff} +0 -0
  37. /package/lib/{iconfont.1743992159333.woff2 → iconfont.1744095177947.woff2} +0 -0
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.4";
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.4"}`;
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 [];
@@ -12578,13 +12578,14 @@ const Methods = {
12578
12578
  */
12579
12579
  triggerRadioRowEvent(evnt, params) {
12580
12580
  const $xeTable = this;
12581
+ const reactData = $xeTable;
12581
12582
  const {
12582
- selectRadioRow: oldValue,
12583
- radioOpts
12584
- } = this;
12583
+ selectRadioRow: oldValue
12584
+ } = reactData;
12585
12585
  const {
12586
12586
  row
12587
12587
  } = params;
12588
+ const radioOpts = $xeTable.computeRadioOpts;
12588
12589
  const {
12589
12590
  trigger
12590
12591
  } = radioOpts;
@@ -12600,11 +12601,11 @@ const Methods = {
12600
12601
  isChange = oldValue === newValue;
12601
12602
  if (isChange) {
12602
12603
  newValue = null;
12603
- this.clearRadioRow();
12604
+ $xeTable.clearRadioRow();
12604
12605
  }
12605
12606
  }
12606
12607
  if (isChange) {
12607
- this.emitEvent('radio-change', {
12608
+ $xeTable.dispatchEvent('radio-change', {
12608
12609
  oldValue,
12609
12610
  newValue,
12610
12611
  ...params
@@ -12613,17 +12614,31 @@ const Methods = {
12613
12614
  },
12614
12615
  triggerCurrentColumnEvent(evnt, params) {
12615
12616
  const $xeTable = this;
12616
- const columnOpts = $xeTable.computeColumnOpts;
12617
+ const reactData = $xeTable;
12617
12618
  const {
12618
- currentMethod
12619
- } = columnOpts;
12619
+ currentColumn: oldValue
12620
+ } = reactData;
12621
+ const columnOpts = $xeTable.computeColumnOpts;
12622
+ const currentColumnOpts = $xeTable.computeCurrentColumnOpts;
12623
+ const beforeRowMethod = currentColumnOpts.beforeSelectMethod || columnOpts.currentMethod;
12620
12624
  const {
12621
- column
12625
+ column: newValue
12622
12626
  } = params;
12623
- if (!currentMethod || currentMethod({
12624
- column
12627
+ const isChange = oldValue !== newValue;
12628
+ if (!beforeRowMethod || beforeRowMethod({
12629
+ column: newValue,
12630
+ $table: $xeTable
12625
12631
  })) {
12626
- $xeTable.setCurrentColumn(column);
12632
+ $xeTable.setCurrentColumn(newValue);
12633
+ if (isChange) {
12634
+ $xeTable.dispatchEvent('current-column-change', {
12635
+ oldValue,
12636
+ newValue,
12637
+ ...params
12638
+ }, evnt);
12639
+ }
12640
+ } else {
12641
+ $xeTable.dispatchEvent('current-column-disabled', params, evnt);
12627
12642
  }
12628
12643
  },
12629
12644
  triggerCurrentRowEvent(evnt, params) {
@@ -12633,24 +12648,32 @@ const Methods = {
12633
12648
  currentRow: oldValue
12634
12649
  } = reactData;
12635
12650
  const rowOpts = $xeTable.computeRowOpts;
12636
- const {
12637
- currentMethod
12638
- } = rowOpts;
12651
+ const currentRowOpts = $xeTable.computeCurrentRowOpts;
12652
+ const beforeRowMethod = currentRowOpts.beforeSelectMethod || rowOpts.currentMethod;
12639
12653
  const {
12640
12654
  row: newValue
12641
12655
  } = params;
12642
12656
  const isChange = oldValue !== newValue;
12643
- if (!currentMethod || currentMethod({
12644
- row: newValue
12657
+ if (!beforeRowMethod || beforeRowMethod({
12658
+ row: newValue,
12659
+ $table: $xeTable
12645
12660
  })) {
12646
12661
  $xeTable.setCurrentRow(newValue);
12647
12662
  if (isChange) {
12663
+ $xeTable.dispatchEvent('current-row-change', {
12664
+ oldValue,
12665
+ newValue,
12666
+ ...params
12667
+ }, evnt);
12668
+ // 已废弃
12648
12669
  $xeTable.dispatchEvent('current-change', {
12649
12670
  oldValue,
12650
12671
  newValue,
12651
12672
  ...params
12652
12673
  }, evnt);
12653
12674
  }
12675
+ } else {
12676
+ $xeTable.dispatchEvent('current-row-disabled', params, evnt);
12654
12677
  }
12655
12678
  },
12656
12679
  /**
@@ -20563,7 +20586,7 @@ const {
20563
20586
  return this.scrollToColumn(column).then(() => {
20564
20587
  const headerWrapperElem = elemStore[`${fixed || 'main'}-header-wrapper`] || elemStore['main-header-wrapper'];
20565
20588
  if (headerWrapperElem) {
20566
- const filterBtnElem = headerWrapperElem.querySelector(`.vxe-header--column.${column.id} .vxe-filter--btn`);
20589
+ const filterBtnElem = headerWrapperElem.querySelector(`.vxe-header--column.${column.id} .vxe-cell--filter`);
20567
20590
  triggerEvent(filterBtnElem, 'click');
20568
20591
  }
20569
20592
  });
@@ -20622,16 +20645,9 @@ const {
20622
20645
  if (filterStore.column === column && filterStore.visible) {
20623
20646
  filterStore.visible = false;
20624
20647
  } else {
20625
- const {
20626
- clientY,
20627
- pageX
20628
- } = evnt;
20629
20648
  const el = $xeTable.$refs.refElem;
20630
20649
  const tableRect = el.getBoundingClientRect();
20631
- const targetElem = evnt.target;
20632
- const {
20633
- visibleWidth
20634
- } = getDomNode();
20650
+ const btnElem = evnt.currentTarget;
20635
20651
  const {
20636
20652
  filters,
20637
20653
  filterMultiple,
@@ -20676,41 +20692,19 @@ const {
20676
20692
  if (!filterWrapperElem) {
20677
20693
  return;
20678
20694
  }
20695
+ const btnRect = btnElem.getBoundingClientRect();
20679
20696
  const filterWidth = filterWrapperElem.offsetWidth;
20680
20697
  const filterHeadElem = filterWrapperElem.querySelector('.vxe-table--filter-header');
20681
20698
  const filterFootElem = filterWrapperElem.querySelector('.vxe-table--filter-footer');
20682
20699
  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
- };
20700
+ const left = btnRect.left - tableRect.left - centerWidth;
20701
+ const top = btnRect.top - tableRect.top + btnElem.clientHeight;
20691
20702
  // 判断面板不能大于表格高度
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;
20703
+ const maxHeight = Math.max(40, el.clientHeight - top - (filterHeadElem ? filterHeadElem.clientHeight : 0) - (filterFootElem ? filterFootElem.clientHeight : 0) - 14);
20704
+ filterStore.style = {
20705
+ top: toCssUnit(top),
20706
+ left: toCssUnit(left)
20707
+ };
20714
20708
  filterStore.maxHeight = maxHeight;
20715
20709
  });
20716
20710
  }
@@ -27585,6 +27579,12 @@ function renderBody(h, $xeTable) {
27585
27579
  if (props.emptyRender && !external_root_XEUtils_commonjs_xe_utils_commonjs2_xe_utils_amd_xe_utils_default().isObject(props.emptyRender)) {
27586
27580
  warnLog('vxe.error.errProp', [`table.empty-render=${props.emptyRender}`, 'table.empty-render={}']);
27587
27581
  }
27582
+ if (rowOpts.currentMethod) {
27583
+ warnLog('vxe.error.delProp', ['row-config.currentMethod', 'current-row-config.beforeSelectMethod']);
27584
+ }
27585
+ if (columnOpts.currentMethod) {
27586
+ warnLog('vxe.error.delProp', ['row-config.currentMethod', 'current-column-config.beforeSelectMethod']);
27587
+ }
27588
27588
  if ((rowOpts.isCurrent || highlightCurrentRow) && props.keyboardConfig && keyboardOpts.isArrow && !external_root_XEUtils_commonjs_xe_utils_commonjs2_xe_utils_amd_xe_utils_default().isBoolean(currentRowOpts.isFollowSelected)) {
27589
27589
  warnLog('vxe.error.notConflictProp', ['row-config.isCurrent', 'current-row-config.isFollowSelected']);
27590
27590
  }
@@ -29679,16 +29679,16 @@ Object.keys(table.methods).forEach(name => {
29679
29679
  const btnParams = button ? button.params : null;
29680
29680
  switch (code) {
29681
29681
  case 'insert':
29682
- return this.insert();
29682
+ return $xeTable.insert({});
29683
29683
  case 'insert_edit':
29684
- return this.insert().then(({
29684
+ return $xeTable.insert({}).then(({
29685
29685
  row
29686
- }) => this.setEditRow(row));
29686
+ }) => $xeTable.setEditRow(row));
29687
29687
  // 已废弃
29688
29688
  case 'insert_actived':
29689
- return this.insert().then(({
29689
+ return $xeTable.insert({}).then(({
29690
29690
  row
29691
- }) => this.setEditRow(row));
29691
+ }) => $xeTable.setEditRow(row));
29692
29692
  // 已废弃
29693
29693
  case 'mark_cancel':
29694
29694
  this.triggerPendingEvent(code);
@@ -29696,19 +29696,19 @@ Object.keys(table.methods).forEach(name => {
29696
29696
  case 'remove':
29697
29697
  return this.handleDeleteRow(code, 'vxe.grid.removeSelectRecord', () => this.removeCheckboxRow());
29698
29698
  case 'import':
29699
- this.importData(btnParams);
29699
+ $xeTable.importData(btnParams);
29700
29700
  break;
29701
29701
  case 'open_import':
29702
- this.openImport(btnParams);
29702
+ $xeTable.openImport(btnParams);
29703
29703
  break;
29704
29704
  case 'export':
29705
- this.exportData(btnParams);
29705
+ $xeTable.exportData(btnParams);
29706
29706
  break;
29707
29707
  case 'open_export':
29708
- this.openExport(btnParams);
29708
+ $xeTable.openExport(btnParams);
29709
29709
  break;
29710
29710
  case 'reset_custom':
29711
- this.resetCustom(true);
29711
+ $xeTable.resetCustom(true);
29712
29712
  break;
29713
29713
  case '_init':
29714
29714
  case 'reload':