vxe-table 3.11.30 → 3.11.31

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/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.11.30";
2223
+ const version = "3.11.31";
2224
2224
  core_.VxeUI.version = version;
2225
2225
  core_.VxeUI.tableVersion = version;
2226
2226
  core_.VxeUI.setConfig({
@@ -2790,7 +2790,7 @@ function isNodeElement(elem) {
2790
2790
  const {
2791
2791
  log: log_log
2792
2792
  } = core_.VxeUI;
2793
- const log_version = `table v${"3.11.30"}`;
2793
+ const log_version = `table v${"3.11.31"}`;
2794
2794
  const warnLog = log_log.create('warn', log_version);
2795
2795
  const errLog = log_log.create('error', log_version);
2796
2796
  ;// CONCATENATED MODULE: ./packages/table/src/columnInfo.ts
@@ -5802,7 +5802,6 @@ const Methods = {
5802
5802
  */
5803
5803
  loadData(datas) {
5804
5804
  const {
5805
- inited,
5806
5805
  initStatus
5807
5806
  } = this;
5808
5807
  return this.loadTableData(datas).then(() => {
@@ -5811,9 +5810,6 @@ const Methods = {
5811
5810
  if (!initStatus) {
5812
5811
  this.handleLoadDefaults();
5813
5812
  }
5814
- if (!inited) {
5815
- this.handleInitDefaults();
5816
- }
5817
5813
  return this.recalculate();
5818
5814
  });
5819
5815
  },
@@ -5822,18 +5818,12 @@ const Methods = {
5822
5818
  * @param {Array} datas 数据
5823
5819
  */
5824
5820
  reloadData(datas) {
5825
- const {
5826
- inited
5827
- } = this;
5828
5821
  return this.clearAll().then(() => {
5829
5822
  this.inited = true;
5830
5823
  this.initStatus = true;
5831
5824
  return this.loadTableData(datas);
5832
5825
  }).then(() => {
5833
5826
  this.handleLoadDefaults();
5834
- if (!inited) {
5835
- this.handleInitDefaults();
5836
- }
5837
5827
  return this.recalculate();
5838
5828
  });
5839
5829
  },
@@ -9560,29 +9550,84 @@ const Methods = {
9560
9550
  * @param {Array/Row} rows 行数据
9561
9551
  * @param {Boolean} value 是否选中
9562
9552
  */
9563
- setCheckboxRow(rows, value) {
9553
+ setCheckboxRow(rows, checked) {
9554
+ const $xeTable = this;
9564
9555
  if (rows && !external_root_XEUtils_commonjs_xe_utils_commonjs2_xe_utils_amd_xe_utils_default().isArray(rows)) {
9565
9556
  rows = [rows];
9566
9557
  }
9567
- return this.handleCheckedCheckboxRow(rows, value, true);
9558
+ return $xeTable.handleCheckedCheckboxRow(rows, checked, true);
9559
+ },
9560
+ setCheckboxRowKey(keys, checked) {
9561
+ const $xeTable = this;
9562
+ const internalData = $xeTable;
9563
+ const {
9564
+ fullAllDataRowIdData
9565
+ } = internalData;
9566
+ if (keys && !external_root_XEUtils_commonjs_xe_utils_commonjs2_xe_utils_amd_xe_utils_default().isArray(keys)) {
9567
+ keys = [keys];
9568
+ }
9569
+ const rows = [];
9570
+ keys.forEach(rowid => {
9571
+ const rowRest = fullAllDataRowIdData[rowid];
9572
+ if (rowRest) {
9573
+ rows.push(rowRest.row);
9574
+ }
9575
+ });
9576
+ return $xeTable.handleCheckedCheckboxRow(rows, checked, true);
9568
9577
  },
9569
9578
  isCheckedByCheckboxRow(row) {
9579
+ const $xeTable = this;
9580
+ const reactData = $xeTable;
9570
9581
  const {
9571
9582
  selectCheckboxMaps
9572
- } = this;
9583
+ } = reactData;
9584
+ const checkboxOpts = $xeTable.computeCheckboxOpts;
9573
9585
  const {
9574
9586
  checkField
9575
- } = this.checkboxOpts;
9587
+ } = checkboxOpts;
9576
9588
  if (checkField) {
9577
9589
  return external_root_XEUtils_commonjs_xe_utils_commonjs2_xe_utils_amd_xe_utils_default().get(row, checkField);
9578
9590
  }
9579
- return !!selectCheckboxMaps[getRowid(this, row)];
9591
+ return !!selectCheckboxMaps[getRowid($xeTable, row)];
9592
+ },
9593
+ isCheckedByCheckboxRowKey(rowid) {
9594
+ const $xeTable = this;
9595
+ const reactData = $xeTable;
9596
+ const internalData = $xeTable;
9597
+ const {
9598
+ selectCheckboxMaps
9599
+ } = reactData;
9600
+ const {
9601
+ fullAllDataRowIdData
9602
+ } = internalData;
9603
+ const checkboxOpts = $xeTable.computeCheckboxOpts;
9604
+ const {
9605
+ checkField
9606
+ } = checkboxOpts;
9607
+ if (checkField) {
9608
+ const rowRest = fullAllDataRowIdData[rowid];
9609
+ if (rowRest) {
9610
+ return external_root_XEUtils_commonjs_xe_utils_commonjs2_xe_utils_amd_xe_utils_default().get(rowRest.row, checkField);
9611
+ }
9612
+ return false;
9613
+ }
9614
+ return !!selectCheckboxMaps[rowid];
9580
9615
  },
9581
9616
  isIndeterminateByCheckboxRow(row) {
9617
+ const $xeTable = this;
9618
+ const reactData = $xeTable;
9582
9619
  const {
9583
9620
  treeIndeterminateMaps
9584
- } = this;
9585
- return !!treeIndeterminateMaps[getRowid(this, row)] && !this.isCheckedByCheckboxRow(row);
9621
+ } = reactData;
9622
+ return !!treeIndeterminateMaps[getRowid($xeTable, row)] && !$xeTable.isCheckedByCheckboxRow(row);
9623
+ },
9624
+ isIndeterminateByCheckboxRowKey(rowid) {
9625
+ const $xeTable = this;
9626
+ const reactData = $xeTable;
9627
+ const {
9628
+ treeIndeterminateMaps
9629
+ } = reactData;
9630
+ return !!treeIndeterminateMaps[rowid] && !$xeTable.isCheckedByCheckboxRowKey(rowid);
9586
9631
  },
9587
9632
  /**
9588
9633
  * 切换选中
@@ -10490,7 +10535,26 @@ const Methods = {
10490
10535
  return this.$nextTick();
10491
10536
  },
10492
10537
  isCheckedByRadioRow(row) {
10493
- return this.selectRadioRow === row;
10538
+ const $xeTable = this;
10539
+ const reactData = $xeTable;
10540
+ const {
10541
+ selectRadioRow
10542
+ } = reactData;
10543
+ if (row && selectRadioRow) {
10544
+ return $xeTable.eqRow(selectRadioRow, row);
10545
+ }
10546
+ return false;
10547
+ },
10548
+ isCheckedByRadioRowKey(key) {
10549
+ const $xeTable = this;
10550
+ const reactData = $xeTable;
10551
+ const {
10552
+ selectRadioRow
10553
+ } = reactData;
10554
+ if (selectRadioRow) {
10555
+ return key === getRowid($xeTable, selectRadioRow);
10556
+ }
10557
+ return false;
10494
10558
  },
10495
10559
  handleCheckedRadioRow(row, isForce) {
10496
10560
  const {
@@ -10512,7 +10576,24 @@ const Methods = {
10512
10576
  * @param {Row} row 行对象
10513
10577
  */
10514
10578
  setRadioRow(row) {
10515
- return this.handleCheckedRadioRow(row, true);
10579
+ const $xeTable = this;
10580
+ return $xeTable.handleCheckedRadioRow(row, true);
10581
+ },
10582
+ /**
10583
+ * 用于单选行,设置某一行为选中状态
10584
+ * @param key 行主键
10585
+ */
10586
+ setRadioRowKey(rowid) {
10587
+ const $xeTable = this;
10588
+ const internalData = $xeTable;
10589
+ const {
10590
+ fullAllDataRowIdData
10591
+ } = internalData;
10592
+ const rowRest = fullAllDataRowIdData[rowid];
10593
+ if (rowRest) {
10594
+ return $xeTable.handleCheckedRadioRow(rowRest.row, true);
10595
+ }
10596
+ return $xeTable.$nextTick();
10516
10597
  },
10517
10598
  /**
10518
10599
  * 用于当前行,手动清空当前高亮的状态
@@ -10667,6 +10748,7 @@ const Methods = {
10667
10748
  * 如果是双击模式,则单击后选中状态
10668
10749
  */
10669
10750
  triggerCellClickEvent(evnt, params) {
10751
+ const $xeTable = this;
10670
10752
  const {
10671
10753
  highlightCurrentRow,
10672
10754
  editStore,
@@ -10756,6 +10838,20 @@ const Methods = {
10756
10838
  }
10757
10839
  }
10758
10840
  }
10841
+ // 如果是双击编辑模式
10842
+ if (isEnableConf(editConfig) && editOpts.trigger === 'dblclick') {
10843
+ if (actived.row && actived.column) {
10844
+ if (editOpts.mode === 'row') {
10845
+ if (!$xeTable.eqRow(actived.row, row)) {
10846
+ $xeTable.handleClearEdit(evnt);
10847
+ }
10848
+ } else if (editOpts.mode === 'cell') {
10849
+ if (!$xeTable.eqRow(actived.row, row) || actived.column.id !== column.id) {
10850
+ $xeTable.handleClearEdit(evnt);
10851
+ }
10852
+ }
10853
+ }
10854
+ }
10759
10855
  this.emitEvent('cell-click', params, evnt);
10760
10856
  },
10761
10857
  /**
@@ -11435,66 +11531,67 @@ const Methods = {
11435
11531
  reactData.isDragColMove = false;
11436
11532
  },
11437
11533
  setPendingRow(rows, status) {
11438
- const pendingMaps = {
11439
- ...this.pendingRowMaps
11440
- };
11441
- const pendingList = [...this.pendingRowList];
11534
+ const $xeTable = this;
11535
+ const reactData = $xeTable;
11536
+ const pendingMaps = Object.assign({}, reactData.pendingRowMaps);
11442
11537
  if (rows && !external_root_XEUtils_commonjs_xe_utils_commonjs2_xe_utils_amd_xe_utils_default().isArray(rows)) {
11443
11538
  rows = [rows];
11444
11539
  }
11445
11540
  if (status) {
11446
11541
  rows.forEach(row => {
11447
- const rowid = getRowid(this, row);
11542
+ const rowid = getRowid($xeTable, row);
11448
11543
  if (rowid && !pendingMaps[rowid]) {
11449
- pendingList.push(row);
11450
11544
  pendingMaps[rowid] = row;
11451
11545
  }
11452
11546
  });
11453
11547
  } else {
11454
11548
  rows.forEach(row => {
11455
- const rowid = getRowid(this, row);
11549
+ const rowid = getRowid($xeTable, row);
11456
11550
  if (rowid && pendingMaps[rowid]) {
11457
- const pendingIndex = this.findRowIndexOf(pendingList, row);
11458
- if (pendingIndex > -1) {
11459
- pendingList.splice(pendingIndex, 1);
11460
- }
11461
11551
  delete pendingMaps[rowid];
11462
11552
  }
11463
11553
  });
11464
11554
  }
11465
- this.pendingRowMaps = pendingMaps;
11466
- this.pendingRowList = pendingList;
11467
- return this.$nextTick();
11555
+ reactData.pendingRowMaps = pendingMaps;
11556
+ return $xeTable.$nextTick();
11468
11557
  },
11469
11558
  togglePendingRow(rows) {
11470
- const pendingMaps = {
11471
- ...this.pendingRowMaps
11472
- };
11473
- const pendingList = [...this.pendingRowList];
11559
+ const $xeTable = this;
11560
+ const reactData = $xeTable;
11561
+ const pendingMaps = Object.assign({}, reactData.pendingRowMaps);
11474
11562
  if (rows && !external_root_XEUtils_commonjs_xe_utils_commonjs2_xe_utils_amd_xe_utils_default().isArray(rows)) {
11475
11563
  rows = [rows];
11476
11564
  }
11477
11565
  rows.forEach(row => {
11478
- const rowid = getRowid(this, row);
11566
+ const rowid = getRowid($xeTable, row);
11479
11567
  if (rowid) {
11480
11568
  if (pendingMaps[rowid]) {
11481
- const pendingIndex = this.findRowIndexOf(pendingList, row);
11482
- if (pendingIndex > -1) {
11483
- pendingList.splice(pendingIndex, 1);
11484
- }
11485
11569
  delete pendingMaps[rowid];
11486
11570
  } else {
11487
- pendingList.push(row);
11488
11571
  pendingMaps[rowid] = row;
11489
11572
  }
11490
11573
  }
11491
11574
  });
11492
- this.pendingRowMaps = pendingMaps;
11493
- this.pendingRowList = pendingList;
11494
- return this.$nextTick();
11575
+ reactData.pendingRowMaps = pendingMaps;
11576
+ return $xeTable.$nextTick();
11495
11577
  },
11496
11578
  getPendingRecords() {
11497
- return this.pendingRowList.slice(0);
11579
+ const $xeTable = this;
11580
+ const reactData = $xeTable;
11581
+ const internalData = $xeTable;
11582
+ const {
11583
+ pendingRowMaps
11584
+ } = reactData;
11585
+ const {
11586
+ fullAllDataRowIdData
11587
+ } = internalData;
11588
+ const insertRecords = [];
11589
+ external_root_XEUtils_commonjs_xe_utils_commonjs2_xe_utils_amd_xe_utils_default().each(pendingRowMaps, (row, rowid) => {
11590
+ if (fullAllDataRowIdData[rowid]) {
11591
+ insertRecords.push(row);
11592
+ }
11593
+ });
11594
+ return insertRecords;
11498
11595
  },
11499
11596
  hasPendingByRow(row) {
11500
11597
  const {
@@ -11505,7 +11602,6 @@ const Methods = {
11505
11602
  },
11506
11603
  clearPendingRow() {
11507
11604
  this.pendingRowMaps = {};
11508
- this.pendingRowList = [];
11509
11605
  return this.$nextTick();
11510
11606
  },
11511
11607
  sort(sortConfs, sortOrder) {
@@ -12645,6 +12741,8 @@ const Methods = {
12645
12741
  }
12646
12742
  internalData.lastScrollTop = scrollTop;
12647
12743
  }
12744
+ reactData.isDragColMove = false;
12745
+ reactData.isDragRowMove = false;
12648
12746
  reactData.lastScrollTime = Date.now();
12649
12747
  const evntParams = {
12650
12748
  scrollTop,
@@ -13879,7 +13977,6 @@ function renderRows(h, _vm, $xeTable, fixedType, tableData, tableColumn) {
13879
13977
  hasFixedColumn,
13880
13978
  fullAllDataRowIdData,
13881
13979
  rowOpts,
13882
- pendingRowList,
13883
13980
  pendingRowMaps,
13884
13981
  columnOpts,
13885
13982
  isDragColMove
@@ -13972,7 +14069,7 @@ function renderRows(h, _vm, $xeTable, fixedType, tableData, tableColumn) {
13972
14069
  'row--new': isNewRow && (editOpts.showStatus || editOpts.showInsertStatus),
13973
14070
  'row--radio': radioOpts.highlight && $xeTable.selectRadioRow === row,
13974
14071
  'row--checked': checkboxOpts.highlight && $xeTable.isCheckedByCheckboxRow(row),
13975
- 'row--pending': pendingRowList.length && !!pendingRowMaps[rowid]
14072
+ 'row--pending': !!pendingRowMaps[rowid]
13976
14073
  }, rowClassName ? external_root_XEUtils_commonjs_xe_utils_commonjs2_xe_utils_amd_xe_utils_default().isFunction(rowClassName) ? rowClassName(params) : rowClassName : ''];
13977
14074
  const tdVNs = tableColumn.map((column, $columnIndex) => {
13978
14075
  return renderColumn(h, _vm, $xeTable, seq, rowid, fixedType, rowLevel, row, rowIndex, $rowIndex, _rowIndex, column, $columnIndex, tableColumn, tableData);
@@ -23111,8 +23208,6 @@ function handleUupdateResize(_vm) {
23111
23208
  reColumnFlag: 0,
23112
23209
  // 已标记的对象集
23113
23210
  pendingRowMaps: {},
23114
- // 已标记的行
23115
- pendingRowList: [],
23116
23211
  // 自定义列相关的信息
23117
23212
  customStore: {
23118
23213
  btnEl: null,
@@ -23629,6 +23724,19 @@ function handleUupdateResize(_vm) {
23629
23724
  y: overflowY && scrollYLoad
23630
23725
  };
23631
23726
  },
23727
+ computeTableStyle() {
23728
+ const $xeTable = this;
23729
+ const reactData = $xeTable;
23730
+ const {
23731
+ tableData
23732
+ } = reactData;
23733
+ const columnOpts = $xeTable.computeColumnOpts;
23734
+ const stys = {};
23735
+ if (columnOpts.drag) {
23736
+ stys['--vxe-ui-table-drag-column-move-delay'] = `${Math.max(0.06, Math.min(0.3, tableData.length / 800))}s`;
23737
+ }
23738
+ return stys;
23739
+ },
23632
23740
  tabsResizeFlag() {
23633
23741
  const $xeTable = this;
23634
23742
  const $xeTabs = $xeTable.$xeTabs;
@@ -23638,7 +23746,6 @@ function handleUupdateResize(_vm) {
23638
23746
  watch: {
23639
23747
  data(value) {
23640
23748
  const {
23641
- inited,
23642
23749
  initStatus
23643
23750
  } = this;
23644
23751
  this.loadTableData(value).then(() => {
@@ -23647,9 +23754,6 @@ function handleUupdateResize(_vm) {
23647
23754
  if (!initStatus) {
23648
23755
  this.handleLoadDefaults();
23649
23756
  }
23650
- if (!inited) {
23651
- this.handleInitDefaults();
23652
- }
23653
23757
  // const checkboxColumn = this.tableFullColumn.find(column => column.type === 'checkbox')
23654
23758
  // if (checkboxColumn && this.tableFullData.length > 300 && !this.checkboxOpts.checkField) {
23655
23759
  // warnLog('vxe.error.checkProp', ['checkbox-config.checkField'])
@@ -23953,8 +24057,8 @@ function handleUupdateResize(_vm) {
23953
24057
  this.inited = true;
23954
24058
  this.initStatus = true;
23955
24059
  this.handleLoadDefaults();
23956
- this.handleInitDefaults();
23957
24060
  }
24061
+ this.handleInitDefaults();
23958
24062
  this.updateStyle();
23959
24063
  });
23960
24064
  table_globalEvents.on(this, 'paste', this.handleGlobalPasteEvent);
@@ -24107,6 +24211,7 @@ function handleUupdateResize(_vm) {
24107
24211
  const vSize = computeSize;
24108
24212
  const virtualScrollBars = $xeTable.computeVirtualScrollBars;
24109
24213
  const isArea = mouseConfig && mouseOpts.area;
24214
+ const tableStyle = $xeTable.computeTableStyle;
24110
24215
  return h('div', {
24111
24216
  ref: 'refElem',
24112
24217
  class: ['vxe-table', 'vxe-table--render-default', `tid_${tId}`, vSize ? `size--${vSize}` : '', `border--${tableBorder}`, {
@@ -24139,9 +24244,7 @@ function handleUupdateResize(_vm) {
24139
24244
  'is--virtual-x': scrollXLoad,
24140
24245
  'is--virtual-y': scrollYLoad
24141
24246
  }],
24142
- style: {
24143
- '--vxe-ui-table-drag-column-move-delay': `${Math.max(0.05, Math.min(0.3, tableData.length / 800))}s`
24144
- },
24247
+ style: tableStyle,
24145
24248
  attrs: {
24146
24249
  spellcheck: false
24147
24250
  },
@@ -25636,6 +25739,11 @@ Object.keys(table.methods).forEach(name => {
25636
25739
  tableProps.editConfig = Object.assign({}, editConfig);
25637
25740
  }
25638
25741
  return tableProps;
25742
+ },
25743
+ computePageConfFlag() {
25744
+ const $xeGrid = this;
25745
+ const pagerOpts = $xeGrid.computePagerOpts;
25746
+ return `${pagerOpts.currentPage}${pagerOpts.pageSize}`;
25639
25747
  }
25640
25748
  },
25641
25749
  watch: {
@@ -25655,7 +25763,7 @@ Object.keys(table.methods).forEach(name => {
25655
25763
  proxyConfig() {
25656
25764
  this.initProxy();
25657
25765
  },
25658
- pagerConfig() {
25766
+ computePageConfFlag() {
25659
25767
  this.initPages();
25660
25768
  }
25661
25769
  },
@@ -26523,7 +26631,9 @@ Object.keys(table.methods).forEach(name => {
26523
26631
  const {
26524
26632
  proxyConfig
26525
26633
  } = this;
26634
+ const $xeTable = this.$refs.xTable;
26526
26635
  if (proxyConfig) {
26636
+ $xeTable.clearScroll();
26527
26637
  this.commitProxy('reload').then(rest => {
26528
26638
  this.$emit('proxy-query', {
26529
26639
  ...rest,