vxe-table 3.19.34 → 3.19.35

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.
@@ -88,7 +88,7 @@ function insertTreeRow($xeTable, newRecords, isAppend) {
88
88
  }
89
89
  // function insertGroupRow ($xeTable: VxeTableConstructor & VxeTablePrivateMethods, newRecords: any[], isAppend: boolean) {
90
90
  // }
91
- function handleInsertRowAt($xeTable, records, targetRow, isInsertNextRow) {
91
+ function handleInsertRowAt($xeTable, records, targetRowOrRowid, isInsertNextRow) {
92
92
  const props = $xeTable;
93
93
  const reactData = $xeTable;
94
94
  const internalData = $xeTable;
@@ -101,6 +101,13 @@ function handleInsertRowAt($xeTable, records, targetRow, isInsertNextRow) {
101
101
  if (!XEUtils.isArray(records)) {
102
102
  records = [records];
103
103
  }
104
+ let targetRow = targetRowOrRowid;
105
+ if (XEUtils.isString(targetRowOrRowid) || XEUtils.isNumber(targetRowOrRowid)) {
106
+ const rowRest = fullAllDataRowIdData[targetRowOrRowid];
107
+ if (rowRest) {
108
+ targetRow = rowRest.row;
109
+ }
110
+ }
104
111
  const newRecords = $xeTable.defineField(records.map(record => Object.assign(treeConfig && transform ? { [mapChildrenField]: [], [childrenField]: [] } : {}, record)));
105
112
  let treeRecords = [];
106
113
  if (treeConfig && transform) {
@@ -312,16 +319,25 @@ function handleInsertRowAt($xeTable, records, targetRow, isInsertNextRow) {
312
319
  };
313
320
  });
314
321
  }
315
- function handleInsertChildRowAt($xeTable, records, parentRow, targetRow, isInsertNextRow) {
322
+ function handleInsertChildRowAt($xeTable, records, parentRowOrParentId, targetRowOrRowid, isInsertNextRow) {
316
323
  const props = $xeTable;
324
+ const internalData = $xeTable;
317
325
  const { treeConfig } = props;
326
+ const { fullAllDataRowIdData } = internalData;
318
327
  const treeOpts = $xeTable.computeTreeOpts;
319
328
  const { transform, rowField, parentField } = treeOpts;
320
329
  if (treeConfig && transform) {
321
330
  if (!XEUtils.isArray(records)) {
322
331
  records = [records];
323
332
  }
324
- return handleInsertRowAt($xeTable, records.map((item) => Object.assign({}, item, { [parentField]: parentRow[rowField] })), targetRow, isInsertNextRow);
333
+ let parentRow = parentRowOrParentId;
334
+ if (XEUtils.isString(parentRowOrParentId) || XEUtils.isNumber(parentRowOrParentId)) {
335
+ const rowRest = fullAllDataRowIdData[parentRowOrParentId];
336
+ if (rowRest) {
337
+ parentRow = rowRest.row;
338
+ }
339
+ }
340
+ return handleInsertRowAt($xeTable, records.map((item) => Object.assign({}, item, { [parentField]: parentRow[rowField] })), targetRowOrRowid, isInsertNextRow);
325
341
  }
326
342
  else {
327
343
  errLog('vxe.error.errProp', ['tree-config.transform=false', 'tree-config.transform=true']);
@@ -509,24 +525,22 @@ export default {
509
525
  * 如果 row 为空则从插入到顶部
510
526
  * 如果 row 为 -1 则从插入到底部
511
527
  * 如果 row 为有效行则插入到该行的位置
512
- * @param {Object/Array} records 新的数据
513
- * @param {Row} targetRow 指定行
514
528
  * @returns
515
529
  */
516
- _insertAt(records, targetRow) {
517
- return handleInsertRowAt(this, records, targetRow);
530
+ _insertAt(records, targetRowOrRowid) {
531
+ return handleInsertRowAt(this, records, targetRowOrRowid);
518
532
  },
519
- _insertNextAt(records, targetRow) {
520
- return handleInsertRowAt(this, records, targetRow, true);
533
+ _insertNextAt(records, targetRowOrRowid) {
534
+ return handleInsertRowAt(this, records, targetRowOrRowid, true);
521
535
  },
522
- _insertChild(records, parentRow) {
523
- return handleInsertChildRowAt(this, records, parentRow, null);
536
+ _insertChild(records, parentRowOrParentId) {
537
+ return handleInsertChildRowAt(this, records, parentRowOrParentId, null);
524
538
  },
525
- _insertChildAt(records, parentRow, targetRow) {
526
- return handleInsertChildRowAt(this, records, parentRow, targetRow);
539
+ _insertChildAt(records, parentRowOrParentId, targetRowOrRowid) {
540
+ return handleInsertChildRowAt(this, records, parentRowOrParentId, targetRowOrRowid);
527
541
  },
528
- _insertChildNextAt(records, parentRow, targetRow) {
529
- return handleInsertChildRowAt(this, records, parentRow, targetRow, true);
542
+ _insertChildNextAt(records, parentRowOrParentId, targetRowOrRowid) {
543
+ return handleInsertChildRowAt(this, records, parentRowOrParentId, targetRowOrRowid, true);
530
544
  },
531
545
  /**
532
546
  * 删除指定行数据
@@ -5594,19 +5594,6 @@ const tableMethods = {
5594
5594
  const { treeConfig } = props;
5595
5595
  const { tableFullData, tableFullTreeData } = internalData;
5596
5596
  if (treeConfig) {
5597
- const treeOpts = $xeTable.computeTreeOpts;
5598
- const { transform, mapChildrenField, rowField, parentField } = treeOpts;
5599
- const childrenField = treeOpts.children || treeOpts.childrenField;
5600
- if (transform) {
5601
- return XEUtils.toArrayTree(XEUtils.toTreeArray(tableFullTreeData, {
5602
- children: mapChildrenField
5603
- }), {
5604
- key: rowField,
5605
- parentKey: parentField,
5606
- children: childrenField,
5607
- mapChildren: mapChildrenField
5608
- });
5609
- }
5610
5597
  return tableFullTreeData.slice(0);
5611
5598
  }
5612
5599
  return tableFullData.slice(0);
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.19.34";
3
+ export const version = "3.19.35";
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.19.34"}`;
3
+ const version = `table v${"3.19.35"}`;
4
4
  export const warnLog = log.create('warn', version);
5
5
  export const errLog = log.create('error', version);
package/lib/index.umd.js CHANGED
@@ -2005,7 +2005,7 @@ function getClass(property, params) {
2005
2005
  ;// CONCATENATED MODULE: ./packages/ui/index.ts
2006
2006
 
2007
2007
 
2008
- const version = "3.19.34";
2008
+ const version = "3.19.35";
2009
2009
  core_.VxeUI.version = version;
2010
2010
  core_.VxeUI.tableVersion = version;
2011
2011
  core_.VxeUI.setConfig({
@@ -2715,7 +2715,7 @@ function isNodeElement(elem) {
2715
2715
  const {
2716
2716
  log: log_log
2717
2717
  } = core_.VxeUI;
2718
- const log_version = `table v${"3.19.34"}`;
2718
+ const log_version = `table v${"3.19.35"}`;
2719
2719
  const warnLog = log_log.create('warn', log_version);
2720
2720
  const errLog = log_log.create('error', log_version);
2721
2721
  ;// CONCATENATED MODULE: ./packages/table/src/columnInfo.ts
@@ -6311,7 +6311,7 @@ if(!rowRest){return false;}const row=rowRest.row;const oRow=sourceDataRowIdData[
6311
6311
  * 如果存在排序,继续处理
6312
6312
  */getTableData(){const $xeTable=this;const props=$xeTable;const reactData=$xeTable;const internalData=$xeTable;const{tableData,footerTableData}=reactData;const{tableFullData,afterFullData,tableFullTreeData}=internalData;return{fullData:props.treeConfig?tableFullTreeData.slice(0):tableFullData.slice(0),visibleData:afterFullData.slice(0),tableData:tableData.slice(0),footerData:footerTableData.slice(0)};},/**
6313
6313
  * 获取表格的全量数据,如果是 tree-config 则返回带层级的树结构
6314
- */getFullData(){const $xeTable=this;const props=$xeTable;const internalData=$xeTable;const{treeConfig}=props;const{tableFullData,tableFullTreeData}=internalData;if(treeConfig){const treeOpts=$xeTable.computeTreeOpts;const{transform,mapChildrenField,rowField,parentField}=treeOpts;const childrenField=treeOpts.children||treeOpts.childrenField;if(transform){return external_root_XEUtils_commonjs_xe_utils_commonjs2_xe_utils_amd_xe_utils_default().toArrayTree(external_root_XEUtils_commonjs_xe_utils_commonjs2_xe_utils_amd_xe_utils_default().toTreeArray(tableFullTreeData,{children:mapChildrenField}),{key:rowField,parentKey:parentField,children:childrenField,mapChildren:mapChildrenField});}return tableFullTreeData.slice(0);}return tableFullData.slice(0);},/**
6314
+ */getFullData(){const $xeTable=this;const props=$xeTable;const internalData=$xeTable;const{treeConfig}=props;const{tableFullData,tableFullTreeData}=internalData;if(treeConfig){return tableFullTreeData.slice(0);}return tableFullData.slice(0);},/**
6315
6315
  * 处理数据加载默认行为
6316
6316
  * 默认执行一次,除非被重置
6317
6317
  */handleLoadDefaults(){const $xeTable=this;handleLoadDefaults($xeTable);},/**
@@ -12450,7 +12450,7 @@ function insertTreeRow($xeTable, newRecords, isAppend) {
12450
12450
  }
12451
12451
  // function insertGroupRow ($xeTable: VxeTableConstructor & VxeTablePrivateMethods, newRecords: any[], isAppend: boolean) {
12452
12452
  // }
12453
- function handleInsertRowAt($xeTable, records, targetRow, isInsertNextRow) {
12453
+ function handleInsertRowAt($xeTable, records, targetRowOrRowid, isInsertNextRow) {
12454
12454
  const props = $xeTable;
12455
12455
  const reactData = $xeTable;
12456
12456
  const internalData = $xeTable;
@@ -12481,6 +12481,13 @@ function handleInsertRowAt($xeTable, records, targetRow, isInsertNextRow) {
12481
12481
  if (!external_root_XEUtils_commonjs_xe_utils_commonjs2_xe_utils_amd_xe_utils_default().isArray(records)) {
12482
12482
  records = [records];
12483
12483
  }
12484
+ let targetRow = targetRowOrRowid;
12485
+ if (external_root_XEUtils_commonjs_xe_utils_commonjs2_xe_utils_amd_xe_utils_default().isString(targetRowOrRowid) || external_root_XEUtils_commonjs_xe_utils_commonjs2_xe_utils_amd_xe_utils_default().isNumber(targetRowOrRowid)) {
12486
+ const rowRest = fullAllDataRowIdData[targetRowOrRowid];
12487
+ if (rowRest) {
12488
+ targetRow = rowRest.row;
12489
+ }
12490
+ }
12484
12491
  const newRecords = $xeTable.defineField(records.map(record => Object.assign(treeConfig && transform ? {
12485
12492
  [mapChildrenField]: [],
12486
12493
  [childrenField]: []
@@ -12747,11 +12754,15 @@ function handleInsertRowAt($xeTable, records, targetRow, isInsertNextRow) {
12747
12754
  };
12748
12755
  });
12749
12756
  }
12750
- function handleInsertChildRowAt($xeTable, records, parentRow, targetRow, isInsertNextRow) {
12757
+ function handleInsertChildRowAt($xeTable, records, parentRowOrParentId, targetRowOrRowid, isInsertNextRow) {
12751
12758
  const props = $xeTable;
12759
+ const internalData = $xeTable;
12752
12760
  const {
12753
12761
  treeConfig
12754
12762
  } = props;
12763
+ const {
12764
+ fullAllDataRowIdData
12765
+ } = internalData;
12755
12766
  const treeOpts = $xeTable.computeTreeOpts;
12756
12767
  const {
12757
12768
  transform,
@@ -12762,9 +12773,16 @@ function handleInsertChildRowAt($xeTable, records, parentRow, targetRow, isInser
12762
12773
  if (!external_root_XEUtils_commonjs_xe_utils_commonjs2_xe_utils_amd_xe_utils_default().isArray(records)) {
12763
12774
  records = [records];
12764
12775
  }
12776
+ let parentRow = parentRowOrParentId;
12777
+ if (external_root_XEUtils_commonjs_xe_utils_commonjs2_xe_utils_amd_xe_utils_default().isString(parentRowOrParentId) || external_root_XEUtils_commonjs_xe_utils_commonjs2_xe_utils_amd_xe_utils_default().isNumber(parentRowOrParentId)) {
12778
+ const rowRest = fullAllDataRowIdData[parentRowOrParentId];
12779
+ if (rowRest) {
12780
+ parentRow = rowRest.row;
12781
+ }
12782
+ }
12765
12783
  return handleInsertRowAt($xeTable, records.map(item => Object.assign({}, item, {
12766
12784
  [parentField]: parentRow[rowField]
12767
- })), targetRow, isInsertNextRow);
12785
+ })), targetRowOrRowid, isInsertNextRow);
12768
12786
  } else {
12769
12787
  errLog('vxe.error.errProp', ['tree-config.transform=false', 'tree-config.transform=true']);
12770
12788
  }
@@ -12990,24 +13008,22 @@ function handleEditCell($xeTable, row, fieldOrColumn, isPos) {
12990
13008
  * 如果 row 为空则从插入到顶部
12991
13009
  * 如果 row 为 -1 则从插入到底部
12992
13010
  * 如果 row 为有效行则插入到该行的位置
12993
- * @param {Object/Array} records 新的数据
12994
- * @param {Row} targetRow 指定行
12995
13011
  * @returns
12996
13012
  */
12997
- _insertAt(records, targetRow) {
12998
- return handleInsertRowAt(this, records, targetRow);
13013
+ _insertAt(records, targetRowOrRowid) {
13014
+ return handleInsertRowAt(this, records, targetRowOrRowid);
12999
13015
  },
13000
- _insertNextAt(records, targetRow) {
13001
- return handleInsertRowAt(this, records, targetRow, true);
13016
+ _insertNextAt(records, targetRowOrRowid) {
13017
+ return handleInsertRowAt(this, records, targetRowOrRowid, true);
13002
13018
  },
13003
- _insertChild(records, parentRow) {
13004
- return handleInsertChildRowAt(this, records, parentRow, null);
13019
+ _insertChild(records, parentRowOrParentId) {
13020
+ return handleInsertChildRowAt(this, records, parentRowOrParentId, null);
13005
13021
  },
13006
- _insertChildAt(records, parentRow, targetRow) {
13007
- return handleInsertChildRowAt(this, records, parentRow, targetRow);
13022
+ _insertChildAt(records, parentRowOrParentId, targetRowOrRowid) {
13023
+ return handleInsertChildRowAt(this, records, parentRowOrParentId, targetRowOrRowid);
13008
13024
  },
13009
- _insertChildNextAt(records, parentRow, targetRow) {
13010
- return handleInsertChildRowAt(this, records, parentRow, targetRow, true);
13025
+ _insertChildNextAt(records, parentRowOrParentId, targetRowOrRowid) {
13026
+ return handleInsertChildRowAt(this, records, parentRowOrParentId, targetRowOrRowid, true);
13011
13027
  },
13012
13028
  /**
13013
13029
  * 删除指定行数据