vxe-table 3.12.0-beta.11 → 3.12.0-beta.13

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.12.0-beta.11";
2223
+ const version = "3.12.0-beta.13";
2224
2224
  core_.VxeUI.version = version;
2225
2225
  core_.VxeUI.tableVersion = version;
2226
2226
  core_.VxeUI.setConfig({
@@ -2808,7 +2808,7 @@ function isNodeElement(elem) {
2808
2808
  const {
2809
2809
  log: log_log
2810
2810
  } = core_.VxeUI;
2811
- const log_version = `table v${"3.12.0-beta.11"}`;
2811
+ const log_version = `table v${"3.12.0-beta.13"}`;
2812
2812
  const warnLog = log_log.create('warn', log_version);
2813
2813
  const errLog = log_log.create('error', log_version);
2814
2814
  ;// CONCATENATED MODULE: ./packages/table/src/columnInfo.ts
@@ -3514,6 +3514,9 @@ function getChangeEvent(renderOpts) {
3514
3514
  return 'change';
3515
3515
  }
3516
3516
  function getSlotVNs(vns) {
3517
+ if (vns === null || vns === undefined) {
3518
+ return [];
3519
+ }
3517
3520
  if (external_root_XEUtils_commonjs_xe_utils_commonjs2_xe_utils_amd_xe_utils_default().isArray(vns)) {
3518
3521
  return vns;
3519
3522
  }
@@ -20219,7 +20222,6 @@ function createHtmlPage(opts, content) {
20219
20222
 
20220
20223
 
20221
20224
 
20222
-
20223
20225
  const {
20224
20226
  getI18n: export_mixin_getI18n,
20225
20227
  renderer: export_mixin_renderer
@@ -20228,15 +20230,8 @@ let htmlCellElem;
20228
20230
  // 导入
20229
20231
  let fileForm;
20230
20232
  let fileInput;
20231
- // 打印
20232
- let printFrame;
20233
20233
  const csvBOM = '\ufeff';
20234
20234
  const enterSymbol = '\r\n';
20235
- function createFrame() {
20236
- const frame = document.createElement('iframe');
20237
- frame.className = 'vxe-table--print-frame';
20238
- return frame;
20239
- }
20240
20235
  function hasTreeChildren($xetable, row) {
20241
20236
  const treeOpts = $xetable.treeOpts;
20242
20237
  const childrenField = treeOpts.children || treeOpts.childrenField;
@@ -20868,7 +20863,8 @@ function clearColumnConvert(columns) {
20868
20863
  children: 'children'
20869
20864
  });
20870
20865
  }
20871
- function handleExport($xetable, opts) {
20866
+ function handleExport($xeTable, opts) {
20867
+ const $xeGrid = $xeTable.$xeGrid;
20872
20868
  const {
20873
20869
  remote,
20874
20870
  columns,
@@ -20880,19 +20876,19 @@ function handleExport($xetable, opts) {
20880
20876
  if (remote) {
20881
20877
  const params = {
20882
20878
  options: opts,
20883
- $table: $xetable,
20884
- $grid: $xetable.$xegrid
20879
+ $table: $xeTable,
20880
+ $grid: $xeGrid
20885
20881
  };
20886
20882
  resolve(exportMethod ? exportMethod(params) : params);
20887
20883
  } else {
20888
- const datas = getExportData($xetable, opts);
20889
- resolve($xetable.preventEvent(null, 'event.export', {
20884
+ const datas = getExportData($xeTable, opts);
20885
+ resolve($xeTable.preventEvent(null, 'event.export', {
20890
20886
  options: opts,
20891
20887
  columns,
20892
20888
  colgroups,
20893
20889
  datas
20894
20890
  }, () => {
20895
- return downloadFile($xetable, opts, getContent($xetable, opts, columns, datas));
20891
+ return downloadFile($xeTable, opts, getContent($xeTable, opts, columns, datas));
20896
20892
  }));
20897
20893
  }
20898
20894
  }).then(params => {
@@ -20902,8 +20898,8 @@ function handleExport($xetable, opts) {
20902
20898
  afterExportMethod({
20903
20899
  status: true,
20904
20900
  options: opts,
20905
- $table: $xetable,
20906
- $grid: $xetable.$xegrid
20901
+ $table: $xeTable,
20902
+ $grid: $xeGrid
20907
20903
  });
20908
20904
  }
20909
20905
  }
@@ -20917,8 +20913,8 @@ function handleExport($xetable, opts) {
20917
20913
  afterExportMethod({
20918
20914
  status: false,
20919
20915
  options: opts,
20920
- $table: $xetable,
20921
- $grid: $xetable.$xegrid
20916
+ $table: $xeTable,
20917
+ $grid: $xeGrid
20922
20918
  });
20923
20919
  }
20924
20920
  }
@@ -21341,61 +21337,9 @@ function readLocalFile(options = {}) {
21341
21337
  fileInput.click();
21342
21338
  });
21343
21339
  }
21344
- function removePrintFrame() {
21345
- if (printFrame) {
21346
- if (printFrame.parentNode) {
21347
- try {
21348
- printFrame.contentDocument.write('');
21349
- } catch (e) {}
21350
- printFrame.parentNode.removeChild(printFrame);
21351
- }
21352
- printFrame = null;
21353
- }
21354
- }
21355
- function appendPrintFrame() {
21356
- if (!printFrame.parentNode) {
21357
- document.body.appendChild(printFrame);
21358
- }
21359
- }
21360
- function afterPrintEvent() {
21361
- requestAnimationFrame(removePrintFrame);
21362
- }
21363
- function handlePrint($xetable, opts, content) {
21340
+ function handleExportAndPrint($xeTable, options, isPrint) {
21341
+ const $xeGrid = $xeTable.$xeGrid;
21364
21342
  const {
21365
- beforePrintMethod
21366
- } = opts;
21367
- if (beforePrintMethod) {
21368
- content = beforePrintMethod({
21369
- content,
21370
- options: opts,
21371
- $table: $xetable
21372
- }) || '';
21373
- }
21374
- content = createHtmlPage(opts, content);
21375
- const blob = getExportBlobByContent(content, opts);
21376
- if (browse.msie) {
21377
- removePrintFrame();
21378
- printFrame = createFrame();
21379
- appendPrintFrame();
21380
- printFrame.contentDocument.write(content);
21381
- printFrame.contentDocument.execCommand('print');
21382
- } else {
21383
- if (!printFrame) {
21384
- printFrame = createFrame();
21385
- printFrame.onload = evnt => {
21386
- if (evnt.target.src) {
21387
- evnt.target.contentWindow.onafterprint = afterPrintEvent;
21388
- evnt.target.contentWindow.print();
21389
- }
21390
- };
21391
- }
21392
- appendPrintFrame();
21393
- printFrame.src = URL.createObjectURL(blob);
21394
- }
21395
- }
21396
- function handleExportAndPrint($xetable, options, isPrint) {
21397
- const {
21398
- $xegrid,
21399
21343
  initStore,
21400
21344
  customOpts,
21401
21345
  collectColumn,
@@ -21405,9 +21349,9 @@ function handleExportAndPrint($xetable, options, isPrint) {
21405
21349
  isGroup,
21406
21350
  exportParams,
21407
21351
  exportOpts
21408
- } = $xetable;
21409
- const proxyOpts = $xegrid ? $xegrid.proxyOpts : {};
21410
- const selectRecords = $xetable.getCheckboxRecords();
21352
+ } = $xeTable;
21353
+ const proxyOpts = $xeGrid ? $xeGrid.computeProxyOpts : {};
21354
+ const selectRecords = $xeTable.getCheckboxRecords();
21411
21355
  const hasFooter = !!footerTableData.length;
21412
21356
  const hasTree = treeConfig;
21413
21357
  const hasMerge = !hasTree && mergeList.length;
@@ -21475,7 +21419,7 @@ function handleExportAndPrint($xetable, options, isPrint) {
21475
21419
  }
21476
21420
  });
21477
21421
  // 更新条件
21478
- Object.assign($xetable.exportStore, {
21422
+ Object.assign($xeTable.exportStore, {
21479
21423
  columns: exportColumns,
21480
21424
  typeList,
21481
21425
  modeList,
@@ -21490,14 +21434,42 @@ function handleExportAndPrint($xetable, options, isPrint) {
21490
21434
  Object.assign(exportParams, {
21491
21435
  mode: selectRecords.length ? 'selected' : 'current'
21492
21436
  }, defOpts);
21493
- if (!modeList.some(item => item.value === exportParams.mode)) {
21437
+ const {
21438
+ filename,
21439
+ sheetName,
21440
+ mode,
21441
+ type
21442
+ } = exportParams;
21443
+ if (filename) {
21444
+ if (external_root_XEUtils_commonjs_xe_utils_commonjs2_xe_utils_amd_xe_utils_default().isFunction(filename)) {
21445
+ exportParams.filename = filename({
21446
+ options: defOpts,
21447
+ $table: $xeTable,
21448
+ $grid: $xeGrid
21449
+ });
21450
+ } else {
21451
+ exportParams.filename = `${filename}`;
21452
+ }
21453
+ }
21454
+ if (sheetName) {
21455
+ if (external_root_XEUtils_commonjs_xe_utils_commonjs2_xe_utils_amd_xe_utils_default().isFunction(sheetName)) {
21456
+ exportParams.sheetName = sheetName({
21457
+ options: defOpts,
21458
+ $table: $xeTable,
21459
+ $grid: $xeGrid
21460
+ });
21461
+ } else {
21462
+ exportParams.sheetName = `${sheetName}`;
21463
+ }
21464
+ }
21465
+ if (!modeList.some(item => item.value === mode)) {
21494
21466
  exportParams.mode = modeList[0].value;
21495
21467
  }
21496
- if (!typeList.some(item => item.value === exportParams.type)) {
21468
+ if (!typeList.some(item => item.value === type)) {
21497
21469
  exportParams.type = typeList[0].value;
21498
21470
  }
21499
21471
  initStore.export = true;
21500
- return $xetable.$nextTick();
21472
+ return $xeTable.$nextTick();
21501
21473
  }
21502
21474
  const getConvertColumns = columns => {
21503
21475
  const result = [];
@@ -21555,12 +21527,13 @@ const convertToRows = originColumns => {
21555
21527
  /**
21556
21528
  * 导出文件,支持 csv/html/xml/txt
21557
21529
  * 如果是树表格,则默认是导出所有节点
21558
- * 如果是启用了虚拟滚动,则只能导出数据源,可以配合 dataFilterMethod 函数自行转换数据
21530
+ * 如果是启用了虚拟滚动,则只能导出数据源,可以配合 dataFilterMethod 函数转换数据
21559
21531
  * @param {Object} options 参数
21560
21532
  */
21561
21533
  _exportData(options) {
21534
+ const $xeTable = this;
21535
+ const $xeGrid = $xeTable.$xeGrid;
21562
21536
  const {
21563
- $xegrid,
21564
21537
  isGroup,
21565
21538
  tableGroupColumn,
21566
21539
  tableFullColumn,
@@ -21594,20 +21567,29 @@ const convertToRows = originColumns => {
21594
21567
  print: false
21595
21568
  }, options);
21596
21569
  const {
21570
+ filename,
21571
+ sheetName,
21597
21572
  type,
21598
21573
  mode,
21599
21574
  columns,
21600
21575
  original,
21576
+ columnFilterMethod,
21601
21577
  beforeExportMethod,
21602
- excludeFields,
21603
- includeFields
21578
+ includeFields,
21579
+ excludeFields
21604
21580
  } = opts;
21605
21581
  let groups = [];
21606
21582
  const customCols = columns && columns.length ? columns : null;
21583
+ const handleOptions = Object.assign({}, opts, {
21584
+ filename: '',
21585
+ sheetName: '',
21586
+ colgroups: [],
21587
+ columns: [],
21588
+ data: []
21589
+ });
21607
21590
  // 如果设置源数据,则默认导出设置了字段的列
21608
- let columnFilterMethod = opts.columnFilterMethod;
21609
21591
  if (!customCols && !columnFilterMethod) {
21610
- columnFilterMethod = ({
21592
+ handleOptions.columnFilterMethod = ({
21611
21593
  column
21612
21594
  }) => {
21613
21595
  if (excludeFields) {
@@ -21625,24 +21607,24 @@ const convertToRows = originColumns => {
21625
21607
  };
21626
21608
  }
21627
21609
  if (customCols) {
21628
- opts._isCustomColumn = true;
21610
+ handleOptions._isCustomColumn = true;
21629
21611
  groups = external_root_XEUtils_commonjs_xe_utils_commonjs2_xe_utils_amd_xe_utils_default().searchTree(external_root_XEUtils_commonjs_xe_utils_commonjs2_xe_utils_amd_xe_utils_default().mapTree(customCols, item => {
21630
21612
  let targetColumn;
21631
21613
  if (item) {
21632
21614
  if (isColumnInfo(item)) {
21633
21615
  targetColumn = item;
21634
21616
  } else if (external_root_XEUtils_commonjs_xe_utils_commonjs2_xe_utils_amd_xe_utils_default().isString(item)) {
21635
- targetColumn = this.getColumnByField(item);
21617
+ targetColumn = $xeTable.getColumnByField(item);
21636
21618
  } else {
21637
21619
  const colid = item.id || item.colId;
21638
21620
  const type = item.type;
21639
21621
  const field = item.field;
21640
21622
  if (colid) {
21641
- targetColumn = this.getColumnById(colid);
21623
+ targetColumn = $xeTable.getColumnById(colid);
21642
21624
  } else if (field && type) {
21643
21625
  targetColumn = tableFullColumn.find(column => column.field === field && column.type === type);
21644
21626
  } else if (field) {
21645
- targetColumn = this.getColumnByField(field);
21627
+ targetColumn = $xeTable.getColumnByField(field);
21646
21628
  } else if (type) {
21647
21629
  targetColumn = tableFullColumn.find(column => column.type === type);
21648
21630
  }
@@ -21653,7 +21635,7 @@ const convertToRows = originColumns => {
21653
21635
  children: 'childNodes',
21654
21636
  mapChildren: '_children'
21655
21637
  }), (column, index) => isColumnInfo(column) && (!columnFilterMethod || columnFilterMethod({
21656
- column,
21638
+ column: column,
21657
21639
  $columnIndex: index
21658
21640
  })), {
21659
21641
  children: '_children',
@@ -21681,16 +21663,38 @@ const convertToRows = originColumns => {
21681
21663
  children: 'childNodes'
21682
21664
  });
21683
21665
  // 构建分组层级
21684
- opts.columns = cols;
21685
- opts.colgroups = convertToRows(groups);
21686
- if (!opts.filename) {
21687
- opts.filename = export_mixin_getI18n(opts.original ? 'vxe.table.expOriginFilename' : 'vxe.table.expFilename', [external_root_XEUtils_commonjs_xe_utils_commonjs2_xe_utils_amd_xe_utils_default().toDateString(Date.now(), 'yyyyMMddHHmmss')]);
21666
+ handleOptions.columns = cols;
21667
+ handleOptions.colgroups = convertToRows(groups);
21668
+ if (filename) {
21669
+ if (external_root_XEUtils_commonjs_xe_utils_commonjs2_xe_utils_amd_xe_utils_default().isFunction(filename)) {
21670
+ handleOptions.filename = filename({
21671
+ options: opts,
21672
+ $table: $xeTable,
21673
+ $grid: $xeGrid
21674
+ });
21675
+ } else {
21676
+ handleOptions.filename = `${filename}`;
21677
+ }
21688
21678
  }
21689
- if (!opts.sheetName) {
21690
- opts.sheetName = document.title;
21679
+ if (!handleOptions.filename) {
21680
+ handleOptions.filename = export_mixin_getI18n(handleOptions.original ? 'vxe.table.expOriginFilename' : 'vxe.table.expFilename', [external_root_XEUtils_commonjs_xe_utils_commonjs2_xe_utils_amd_xe_utils_default().toDateString(Date.now(), 'yyyyMMddHHmmss')]);
21681
+ }
21682
+ if (sheetName) {
21683
+ if (external_root_XEUtils_commonjs_xe_utils_commonjs2_xe_utils_amd_xe_utils_default().isFunction(sheetName)) {
21684
+ handleOptions.sheetName = sheetName({
21685
+ options: opts,
21686
+ $table: $xeTable,
21687
+ $grid: $xeGrid
21688
+ });
21689
+ } else {
21690
+ handleOptions.sheetName = `${sheetName}`;
21691
+ }
21692
+ }
21693
+ if (!handleOptions.sheetName) {
21694
+ handleOptions.sheetName = document.title || '';
21691
21695
  }
21692
21696
  // 检查类型,如果为自定义导出,则不需要校验类型
21693
- if (!opts.exportMethod && !external_root_XEUtils_commonjs_xe_utils_commonjs2_xe_utils_amd_xe_utils_default().includes(external_root_XEUtils_commonjs_xe_utils_commonjs2_xe_utils_amd_xe_utils_default().keys(exportOpts._typeMaps), type)) {
21697
+ if (!handleOptions.exportMethod && !external_root_XEUtils_commonjs_xe_utils_commonjs2_xe_utils_amd_xe_utils_default().includes(external_root_XEUtils_commonjs_xe_utils_commonjs2_xe_utils_amd_xe_utils_default().keys(exportOpts._typeMaps), type)) {
21694
21698
  errLog('vxe.error.notType', [type]);
21695
21699
  if (true) {
21696
21700
  if (['xlsx', 'pdf'].includes(type)) {
@@ -21702,21 +21706,21 @@ const convertToRows = originColumns => {
21702
21706
  };
21703
21707
  return Promise.reject(params);
21704
21708
  }
21705
- if (!opts.print) {
21709
+ if (!handleOptions.print) {
21706
21710
  if (beforeExportMethod) {
21707
21711
  beforeExportMethod({
21708
- options: opts,
21709
- $table: this,
21710
- $grid: $xegrid
21712
+ options: handleOptions,
21713
+ $table: $xeTable,
21714
+ $grid: $xeGrid
21711
21715
  });
21712
21716
  }
21713
21717
  }
21714
21718
  if (!opts.data) {
21715
- opts.data = [];
21719
+ handleOptions.data = [];
21716
21720
  if (mode === 'selected') {
21717
- const selectRecords = this.getCheckboxRecords();
21721
+ const selectRecords = $xeTable.getCheckboxRecords();
21718
21722
  if (['html', 'pdf'].indexOf(type) > -1 && treeConfig) {
21719
- opts.data = external_root_XEUtils_commonjs_xe_utils_commonjs2_xe_utils_amd_xe_utils_default().searchTree(this.getTableData().fullData, item => selectRecords.indexOf(item) > -1, Object.assign({}, treeOpts, {
21723
+ opts.data = external_root_XEUtils_commonjs_xe_utils_commonjs2_xe_utils_amd_xe_utils_default().searchTree($xeTable.getTableData().fullData, item => $xeTable.findRowIndexOf(selectRecords, item) > -1, Object.assign({}, treeOpts, {
21720
21724
  data: '_row'
21721
21725
  }));
21722
21726
  } else {
@@ -21724,17 +21728,22 @@ const convertToRows = originColumns => {
21724
21728
  }
21725
21729
  } else if (mode === 'all') {
21726
21730
  if (true) {
21727
- if (!$xegrid) {
21731
+ if (!$xeGrid) {
21728
21732
  warnLog('vxe.error.errProp', ['all', 'mode=current,selected']);
21729
21733
  }
21730
21734
  }
21731
- if ($xegrid && !opts.remote) {
21735
+ if ($xeGrid && !handleOptions.remote) {
21736
+ const gridReactData = $xeGrid;
21737
+ const proxyOpts = $xeGrid.computeProxyOpts;
21738
+ const {
21739
+ sortData
21740
+ } = gridReactData;
21732
21741
  const {
21733
21742
  beforeQueryAll,
21734
21743
  afterQueryAll,
21735
- ajax = {},
21736
- props = {}
21737
- } = $xegrid.proxyOpts;
21744
+ ajax = {}
21745
+ } = proxyOpts;
21746
+ const resConfigs = proxyOpts.response || proxyOpts.props || {};
21738
21747
  const ajaxMethods = ajax.queryAll;
21739
21748
  const queryAllSuccessMethods = ajax.queryAllSuccess;
21740
21749
  const queryAllErrorMethods = ajax.queryAllError;
@@ -21745,16 +21754,20 @@ const convertToRows = originColumns => {
21745
21754
  }
21746
21755
  if (ajaxMethods) {
21747
21756
  const params = {
21748
- $table: this,
21749
- $grid: $xegrid,
21750
- sort: $xegrid.sortData,
21751
- filters: $xegrid.filterData,
21752
- form: $xegrid.formData,
21753
- target: ajaxMethods,
21754
- options: opts
21757
+ $table: $xeTable,
21758
+ $grid: $xeGrid,
21759
+ sort: sortData.length ? sortData[0] : {},
21760
+ sorts: sortData,
21761
+ filters: gridReactData.filterData,
21762
+ form: gridReactData.formData,
21763
+ options: handleOptions
21755
21764
  };
21756
21765
  return Promise.resolve((beforeQueryAll || ajaxMethods)(params)).then(rest => {
21757
- opts.data = (props.list ? external_root_XEUtils_commonjs_xe_utils_commonjs2_xe_utils_amd_xe_utils_default().get(rest, props.list) : rest) || [];
21766
+ const listProp = resConfigs.list;
21767
+ handleOptions.data = (listProp ? external_root_XEUtils_commonjs_xe_utils_commonjs2_xe_utils_amd_xe_utils_default().isFunction(listProp) ? listProp({
21768
+ data: rest,
21769
+ $grid: $xeGrid
21770
+ }) : external_root_XEUtils_commonjs_xe_utils_commonjs2_xe_utils_amd_xe_utils_default().get(rest, listProp) : rest) || [];
21758
21771
  if (afterQueryAll) {
21759
21772
  afterQueryAll(params);
21760
21773
  }
@@ -21764,7 +21777,7 @@ const convertToRows = originColumns => {
21764
21777
  response: rest
21765
21778
  });
21766
21779
  }
21767
- return handleExport(this, opts);
21780
+ return handleExport($xeTable, handleOptions);
21768
21781
  }).catch(rest => {
21769
21782
  if (queryAllErrorMethods) {
21770
21783
  queryAllErrorMethods({
@@ -21776,10 +21789,10 @@ const convertToRows = originColumns => {
21776
21789
  }
21777
21790
  }
21778
21791
  } else if (mode === 'current') {
21779
- opts.data = afterFullData;
21792
+ handleOptions.data = afterFullData;
21780
21793
  }
21781
21794
  }
21782
- return handleExport(this, opts);
21795
+ return handleExport($xeTable, opts);
21783
21796
  },
21784
21797
  _importByFile(file, options) {
21785
21798
  const opts = Object.assign({}, options);
@@ -21836,6 +21849,8 @@ const convertToRows = originColumns => {
21836
21849
  return readLocalFile(options);
21837
21850
  },
21838
21851
  _print(options) {
21852
+ const $xeTable = this;
21853
+ const $xeGrid = $xeTable.$xeGrid;
21839
21854
  const opts = Object.assign({
21840
21855
  original: false
21841
21856
  // beforePrintMethod
@@ -21845,25 +21860,76 @@ const convertToRows = originColumns => {
21845
21860
  remote: false,
21846
21861
  print: true
21847
21862
  });
21848
- if (!opts.sheetName) {
21849
- opts.sheetName = document.title;
21850
- }
21851
- return new Promise(resolve => {
21852
- if (opts.content) {
21853
- resolve(handlePrint(this, opts, opts.content));
21863
+ const {
21864
+ sheetName
21865
+ } = opts;
21866
+ let printTitle = '';
21867
+ if (sheetName) {
21868
+ if (external_root_XEUtils_commonjs_xe_utils_commonjs2_xe_utils_amd_xe_utils_default().isFunction(sheetName)) {
21869
+ printTitle = sheetName({
21870
+ options: opts,
21871
+ $table: $xeTable,
21872
+ $grid: $xeGrid
21873
+ });
21854
21874
  } else {
21855
- resolve(this.exportData(opts).then(({
21856
- content
21857
- }) => {
21858
- return handlePrint(this, opts, content);
21859
- }));
21875
+ printTitle = `${sheetName}`;
21876
+ }
21877
+ }
21878
+ if (!printTitle) {
21879
+ printTitle = document.title || '';
21880
+ }
21881
+ const beforePrintMethod = opts.beforePrintMethod;
21882
+ const tableHtml = opts.html || opts.content;
21883
+ return new Promise((resolve, reject) => {
21884
+ if (core_.VxeUI.print) {
21885
+ if (tableHtml) {
21886
+ resolve(core_.VxeUI.print({
21887
+ title: printTitle,
21888
+ html: tableHtml,
21889
+ customStyle: opts.style,
21890
+ beforeMethod: beforePrintMethod ? ({
21891
+ html
21892
+ }) => {
21893
+ return beforePrintMethod({
21894
+ html,
21895
+ content: html,
21896
+ options: opts,
21897
+ $table: $xeTable
21898
+ });
21899
+ } : undefined
21900
+ }));
21901
+ } else {
21902
+ resolve($xeTable.exportData(opts).then(({
21903
+ content
21904
+ }) => {
21905
+ return core_.VxeUI.print({
21906
+ title: printTitle,
21907
+ html: content,
21908
+ customStyle: opts.style,
21909
+ beforeMethod: beforePrintMethod ? ({
21910
+ html
21911
+ }) => {
21912
+ return beforePrintMethod({
21913
+ html,
21914
+ content: html,
21915
+ options: opts,
21916
+ $table: $xeTable
21917
+ });
21918
+ } : undefined
21919
+ });
21920
+ }));
21921
+ }
21922
+ } else {
21923
+ const e = {
21924
+ status: false
21925
+ };
21926
+ reject(e);
21860
21927
  }
21861
21928
  });
21862
21929
  },
21863
21930
  _getPrintHtml(options) {
21864
- const {
21865
- printOpts
21866
- } = this;
21931
+ const $xeTable = this;
21932
+ const printOpts = $xeTable.computePrintOpts;
21867
21933
  const opts = Object.assign({
21868
21934
  original: false
21869
21935
  // beforePrintMethod
@@ -21873,7 +21939,7 @@ const convertToRows = originColumns => {
21873
21939
  remote: false,
21874
21940
  print: true
21875
21941
  });
21876
- return this.exportData(opts).then(({
21942
+ return $xeTable.exportData(opts).then(({
21877
21943
  content
21878
21944
  }) => {
21879
21945
  return {
@@ -25264,11 +25330,12 @@ const {
25264
25330
  /**
25265
25331
  * 渲染按钮
25266
25332
  */
25267
- renderBtns(h) {
25333
+ renderLeftBtns(h) {
25268
25334
  // 使用已安装的组件,如果未安装则不渲染
25269
25335
  const VxeUIButtonComponent = core_.VxeUI.getComponent('VxeButton');
25270
25336
  const $xeToolbar = this;
25271
25337
  const props = $xeToolbar;
25338
+ const slots = $xeToolbar.$scopedSlots;
25272
25339
  const internalData = $xeToolbar.internalData;
25273
25340
  const $xeGrid = $xeToolbar.$xeGrid;
25274
25341
  const {
@@ -25278,7 +25345,16 @@ const {
25278
25345
  connectTable
25279
25346
  } = internalData;
25280
25347
  const $table = connectTable;
25348
+ const buttonPrefixSlot = slots.buttonPrefix || slots['button-prefix'];
25349
+ const buttonSuffixSlot = slots.buttonSuffix || slots['button-suffix'];
25281
25350
  const btnVNs = [];
25351
+ if (buttonPrefixSlot) {
25352
+ btnVNs.push(...getSlotVNs(buttonPrefixSlot.call($xeToolbar, {
25353
+ buttons: buttons || [],
25354
+ $grid: $xeGrid,
25355
+ $table: $table
25356
+ })));
25357
+ }
25282
25358
  if (buttons) {
25283
25359
  buttons.forEach(item => {
25284
25360
  const {
@@ -25333,6 +25409,13 @@ const {
25333
25409
  }
25334
25410
  });
25335
25411
  }
25412
+ if (buttonSuffixSlot) {
25413
+ btnVNs.push(...getSlotVNs(buttonSuffixSlot.call($xeToolbar, {
25414
+ buttons: buttons || [],
25415
+ $grid: $xeGrid,
25416
+ $table: $table
25417
+ })));
25418
+ }
25336
25419
  return btnVNs;
25337
25420
  },
25338
25421
  /**
@@ -25343,6 +25426,7 @@ const {
25343
25426
  const VxeUIButtonComponent = core_.VxeUI.getComponent('VxeButton');
25344
25427
  const $xeToolbar = this;
25345
25428
  const props = $xeToolbar;
25429
+ const slots = $xeToolbar.$scopedSlots;
25346
25430
  const internalData = $xeToolbar.internalData;
25347
25431
  const $xeGrid = $xeToolbar.$xeGrid;
25348
25432
  const {
@@ -25352,7 +25436,16 @@ const {
25352
25436
  connectTable
25353
25437
  } = internalData;
25354
25438
  const $table = connectTable;
25439
+ const toolPrefixSlot = slots.toolPrefix || slots['tool-prefix'];
25440
+ const toolSuffixSlot = slots.toolSuffix || slots['tool-suffix'];
25355
25441
  const btnVNs = [];
25442
+ if (toolPrefixSlot) {
25443
+ btnVNs.push(...getSlotVNs(toolPrefixSlot.call($xeToolbar, {
25444
+ tools: tools || [],
25445
+ $grid: $xeGrid,
25446
+ $table: $table
25447
+ })));
25448
+ }
25356
25449
  if (tools) {
25357
25450
  tools.forEach((item, tIndex) => {
25358
25451
  const {
@@ -25410,6 +25503,13 @@ const {
25410
25503
  }
25411
25504
  });
25412
25505
  }
25506
+ if (toolSuffixSlot) {
25507
+ btnVNs.push(...getSlotVNs(toolSuffixSlot.call($xeToolbar, {
25508
+ tools: tools || [],
25509
+ $grid: $xeGrid,
25510
+ $table: $table
25511
+ })));
25512
+ }
25413
25513
  return btnVNs;
25414
25514
  },
25415
25515
  renderToolImport(h) {
@@ -25562,7 +25662,7 @@ const {
25562
25662
  }, buttonsSlot ? buttonsSlot({
25563
25663
  $grid: $xeGrid,
25564
25664
  $table: $table
25565
- }) : $xeToolbar.renderBtns(h)), h('div', {
25665
+ }) : $xeToolbar.renderLeftBtns(h)), h('div', {
25566
25666
  class: 'vxe-tools--wrapper'
25567
25667
  }, toolsSlot ? toolsSlot({
25568
25668
  $grid: $xeGrid,