vxe-table 3.17.7 → 3.17.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.
Files changed (47) hide show
  1. package/es/grid/src/grid.js +47 -29
  2. package/es/style.css +1 -1
  3. package/es/table/module/export/mixin.js +3 -1
  4. package/es/table/src/methods.js +109 -42
  5. package/es/table/src/props.js +1 -1
  6. package/es/table/src/table.js +7 -1
  7. package/es/table/src/util.js +0 -4
  8. package/es/toolbar/src/toolbar.js +2 -2
  9. package/es/ui/index.js +13 -4
  10. package/es/ui/src/log.js +1 -1
  11. package/lib/grid/src/grid.js +49 -26
  12. package/lib/grid/src/grid.min.js +1 -1
  13. package/lib/index.umd.js +13411 -13299
  14. package/lib/index.umd.min.js +1 -1
  15. package/lib/style.css +1 -1
  16. package/lib/table/module/export/mixin.js +5 -1
  17. package/lib/table/module/export/mixin.min.js +1 -1
  18. package/lib/table/src/methods.js +114 -43
  19. package/lib/table/src/methods.min.js +1 -1
  20. package/lib/table/src/props.js +2 -2
  21. package/lib/table/src/props.min.js +1 -1
  22. package/lib/table/src/table.js +8 -2
  23. package/lib/table/src/table.min.js +1 -1
  24. package/lib/table/src/util.js +0 -4
  25. package/lib/table/src/util.min.js +1 -1
  26. package/lib/toolbar/src/toolbar.js +2 -0
  27. package/lib/toolbar/src/toolbar.min.js +1 -1
  28. package/lib/ui/index.js +12 -3
  29. package/lib/ui/index.min.js +1 -1
  30. package/lib/ui/src/log.js +1 -1
  31. package/lib/ui/src/log.min.js +1 -1
  32. package/package.json +1 -1
  33. package/packages/grid/src/grid.ts +49 -30
  34. package/packages/table/module/export/mixin.ts +5 -3
  35. package/packages/table/src/methods.ts +118 -46
  36. package/packages/table/src/props.ts +1 -1
  37. package/packages/table/src/table.ts +7 -1
  38. package/packages/table/src/util.ts +0 -4
  39. package/packages/toolbar/src/toolbar.ts +2 -2
  40. package/packages/ui/index.ts +12 -2
  41. package/packages/ui/src/dom.ts +1 -1
  42. /package/es/{iconfont.1754614978390.ttf → iconfont.1754905462391.ttf} +0 -0
  43. /package/es/{iconfont.1754614978390.woff → iconfont.1754905462391.woff} +0 -0
  44. /package/es/{iconfont.1754614978390.woff2 → iconfont.1754905462391.woff2} +0 -0
  45. /package/lib/{iconfont.1754614978390.ttf → iconfont.1754905462391.ttf} +0 -0
  46. /package/lib/{iconfont.1754614978390.woff → iconfont.1754905462391.woff} +0 -0
  47. /package/lib/{iconfont.1754614978390.woff2 → iconfont.1754905462391.woff2} +0 -0
@@ -3,14 +3,14 @@ import XEUtils from 'xe-utils';
3
3
  import { getLastZIndex, nextZIndex, isEnableConf } from '../../ui/src/utils';
4
4
  import { getOffsetHeight, getPaddingTopBottomSize, getDomNode, toCssUnit } from '../../ui/src/dom';
5
5
  import { VxeUI } from '../../ui';
6
- import VxeTableComponent from '../../table/src/table';
7
- import VxeToolbarComponent from '../../toolbar/src/toolbar';
8
- import tableComponentProps from '../../table/src/props';
9
6
  import { getSlotVNs } from '../../ui/src/vn';
10
7
  import { warnLog, errLog } from '../../ui/src/log';
8
+ import { tableProps } from '../../table/src/props';
9
+ import VxeTableComponent from '../../table/src/table';
10
+ import VxeToolbarComponent from '../../toolbar/src/toolbar';
11
11
  const { getConfig, getI18n, commands, globalEvents, globalMixins, createEvent, GLOBAL_EVENT_KEYS, renderEmptyElement } = VxeUI;
12
12
  const tableMethods = {};
13
- const propKeys = Object.keys(tableComponentProps);
13
+ const propKeys = Object.keys(tableProps);
14
14
  const defaultLayouts = [['Form'], ['Toolbar', 'Top', 'Table', 'Bottom', 'Pager']];
15
15
  function getTableOns(_vm) {
16
16
  const { $listeners, proxyConfig, proxyOpts } = _vm;
@@ -40,9 +40,7 @@ XEUtils.each(VxeTableComponent.methods, (fn, name) => {
40
40
  };
41
41
  });
42
42
  function createInternalData() {
43
- return {
44
- connectTable: null
45
- };
43
+ return {};
46
44
  }
47
45
  export default {
48
46
  name: 'VxeGrid',
@@ -51,9 +49,7 @@ export default {
51
49
  ],
52
50
  props: Object.assign(Object.assign({
53
51
  // 以下仅用于类型
54
- round: { type: Boolean, default: () => getConfig().table.round }, height: [Number, String], minHeight: { type: [Number, String], default: () => getConfig().table.minHeight }, maxHeight: [Number, String], seqConfig: Object, sortConfig: Object, filterConfig: Object, editConfig: [Boolean, Object], loading: Boolean, validConfig: Object, editRules: Object, animat: { type: Boolean, default: () => getConfig().table.animat } }, tableComponentProps), {
55
- // 以上仅用于类型
56
- layouts: Array, columns: Array, pagerConfig: Object, proxyConfig: Object, toolbarConfig: Object, formConfig: Object, zoomConfig: Object, size: {
52
+ round: { type: Boolean, default: () => getConfig().table.round }, height: [Number, String], minHeight: { type: [Number, String], default: () => getConfig().table.minHeight }, maxHeight: [Number, String], seqConfig: Object, sortConfig: Object, filterConfig: Object, editConfig: [Boolean, Object], loading: Boolean, validConfig: Object, editRules: Object, animat: { type: Boolean, default: () => getConfig().table.animat } }, tableProps), { layouts: Array, columns: Array, pagerConfig: Object, proxyConfig: Object, toolbarConfig: Object, formConfig: Object, zoomConfig: Object, size: {
57
53
  type: String,
58
54
  default: () => getConfig().grid.size || getConfig().size
59
55
  } }),
@@ -312,7 +308,7 @@ export default {
312
308
  },
313
309
  methods: Object.assign(Object.assign({}, tableMethods), { dispatchEvent(type, params, evnt) {
314
310
  const $xeGrid = this;
315
- $xeGrid.$emit(type, createEvent(evnt, { $grid: $xeGrid }, params));
311
+ $xeGrid.$emit(type, createEvent(evnt, { $grid: $xeGrid, $gantt: null }, params));
316
312
  },
317
313
  initPages(propKey) {
318
314
  const $xeGrid = this;
@@ -394,7 +390,7 @@ export default {
394
390
  const $xeTable = $xeGrid.$refs.refTable;
395
391
  const $xeToolbar = $xeGrid.$refs.refToolbar;
396
392
  if ($xeTable && $xeToolbar) {
397
- $xeTable.connect($xeToolbar);
393
+ $xeTable.connectToolbar($xeToolbar);
398
394
  }
399
395
  });
400
396
  },
@@ -457,9 +453,10 @@ export default {
457
453
  const proxyOpts = $xeGrid.computeProxyOpts;
458
454
  const resConfigs = proxyOpts.response || proxyOpts.props || {};
459
455
  const messageProp = resConfigs.message;
456
+ const $xeTable = $xeGrid.$refs.refTable;
460
457
  let msg;
461
458
  if (rest && messageProp) {
462
- msg = XEUtils.isFunction(messageProp) ? messageProp({ data: rest, $grid: $xeGrid }) : XEUtils.get(rest, messageProp);
459
+ msg = XEUtils.isFunction(messageProp) ? messageProp({ data: rest, $table: $xeTable, $grid: $xeGrid, $gantt: null }) : XEUtils.get(rest, messageProp);
463
460
  }
464
461
  return msg || getI18n(defaultMsg);
465
462
  },
@@ -646,11 +643,13 @@ export default {
646
643
  }
647
644
  }
648
645
  const commitParams = {
646
+ $table: $xeTable,
647
+ $grid: $xeGrid,
648
+ $gantt: null,
649
649
  code,
650
650
  button,
651
651
  isInited,
652
652
  isReload,
653
- $grid: $xeGrid,
654
653
  page: pageParams,
655
654
  sort: sortList.length ? sortList[0] : {},
656
655
  sorts: sortList,
@@ -669,10 +668,10 @@ export default {
669
668
  if (rest) {
670
669
  if (pagerConfig && isEnableConf(pagerOpts)) {
671
670
  const totalProp = resConfigs.total;
672
- const total = (XEUtils.isFunction(totalProp) ? totalProp({ data: rest, $grid: $xeGrid }) : XEUtils.get(rest, totalProp || 'page.total')) || 0;
671
+ const total = (XEUtils.isFunction(totalProp) ? totalProp({ data: rest, $table: $xeTable, $grid: $xeGrid, $gantt: null }) : XEUtils.get(rest, totalProp || 'page.total')) || 0;
673
672
  tablePage.total = XEUtils.toNumber(total);
674
673
  const resultProp = resConfigs.result;
675
- tableData = (XEUtils.isFunction(resultProp) ? resultProp({ data: rest, $grid: $xeGrid }) : XEUtils.get(rest, resultProp || 'result')) || [];
674
+ tableData = (XEUtils.isFunction(resultProp) ? resultProp({ data: rest, $table: $xeTable, $grid: $xeGrid, $gantt: null }) : XEUtils.get(rest, resultProp || 'result')) || [];
676
675
  // 检验当前页码,不能超出当前最大页数
677
676
  const pageCount = Math.max(Math.ceil(total / tablePage.pageSize), 1);
678
677
  if (tablePage.currentPage > pageCount) {
@@ -681,7 +680,7 @@ export default {
681
680
  }
682
681
  else {
683
682
  const listProp = resConfigs.list;
684
- tableData = (listProp ? (XEUtils.isFunction(listProp) ? listProp({ data: rest, $grid: $xeGrid }) : XEUtils.get(rest, listProp)) : rest) || [];
683
+ tableData = (listProp ? (XEUtils.isFunction(listProp) ? listProp({ data: rest, $table: $xeTable, $grid: $xeGrid, $gantt: null }) : XEUtils.get(rest, listProp)) : rest) || [];
685
684
  }
686
685
  }
687
686
  if ($xeTable) {
@@ -722,7 +721,16 @@ export default {
722
721
  const selectRecords = $xeTable.getCheckboxRecords();
723
722
  const removeRecords = selectRecords.filter((row) => !$xeTable.isInsertByRow(row));
724
723
  const body = { removeRecords };
725
- const commitParams = { $grid: $xeGrid, code, button, body, form: formData, options: ajaxMethods };
724
+ const commitParams = {
725
+ $table: $xeTable,
726
+ $grid: $xeGrid,
727
+ $gantt: null,
728
+ code,
729
+ button,
730
+ body,
731
+ form: formData,
732
+ options: ajaxMethods
733
+ };
726
734
  const applyArgs = [commitParams].concat(args);
727
735
  if (selectRecords.length) {
728
736
  return $xeGrid.handleDeleteRow(code, 'vxe.grid.deleteSelectRecord', () => {
@@ -790,7 +798,16 @@ export default {
790
798
  if (ajaxMethods) {
791
799
  const body = $xeGrid.getRecordset();
792
800
  const { insertRecords, removeRecords, updateRecords, pendingRecords } = body;
793
- const commitParams = { $grid: $xeGrid, code, button, body, form: formData, options: ajaxMethods };
801
+ const commitParams = {
802
+ $table: $xeTable,
803
+ $grid: $xeGrid,
804
+ $gantt: null,
805
+ code,
806
+ button,
807
+ body,
808
+ form: formData,
809
+ options: ajaxMethods
810
+ };
794
811
  const applyArgs = [commitParams].concat(args);
795
812
  // 排除掉新增且标记为删除的数据
796
813
  if (insertRecords.length) {
@@ -868,8 +885,9 @@ export default {
868
885
  default: {
869
886
  const gCommandOpts = commands.get(code);
870
887
  if (gCommandOpts) {
871
- if (gCommandOpts.commandMethod) {
872
- gCommandOpts.commandMethod({ code, button, $grid: $xeGrid, $table: $xeTable }, ...args);
888
+ const tCommandMethod = gCommandOpts.tableCommandMethod || gCommandOpts.commandMethod;
889
+ if (tCommandMethod) {
890
+ tCommandMethod({ code, button, $grid: $xeGrid, $table: $xeTable, $gantt: null }, ...args);
873
891
  }
874
892
  else {
875
893
  errLog('vxe.error.notCommands', [code]);
@@ -1313,7 +1331,7 @@ export default {
1313
1331
  const beforeItem = proxyOpts.beforeItem;
1314
1332
  if (proxyOpts && beforeItem) {
1315
1333
  formOpts.items.forEach((item) => {
1316
- beforeItem.call($xeGrid, { $grid: $xeGrid, item });
1334
+ beforeItem.call($xeGrid, { $grid: $xeGrid, $gantt: null, item });
1317
1335
  });
1318
1336
  }
1319
1337
  }
@@ -1358,7 +1376,7 @@ export default {
1358
1376
  key: 'form',
1359
1377
  ref: 'refFormWrapper',
1360
1378
  class: 'vxe-grid--form-wrapper'
1361
- }, formSlot ? formSlot.call($xeGrid, { $grid: $xeGrid }) : $xeGrid.renderDefaultForm(h));
1379
+ }, formSlot ? formSlot.call($xeGrid, { $grid: $xeGrid, $gantt: null }) : $xeGrid.renderDefaultForm(h));
1362
1380
  }
1363
1381
  return renderEmptyElement($xeGrid);
1364
1382
  },
@@ -1376,7 +1394,7 @@ export default {
1376
1394
  ref: 'refToolbarWrapper',
1377
1395
  class: 'vxe-grid--toolbar-wrapper'
1378
1396
  }, toolbarSlot
1379
- ? toolbarSlot.call($xeGrid, { $grid: $xeGrid })
1397
+ ? toolbarSlot.call($xeGrid, { $grid: $xeGrid, $gantt: null })
1380
1398
  : [
1381
1399
  h(VxeToolbarComponent, {
1382
1400
  props: Object.assign({}, toolbarOpts, { slots: undefined }),
@@ -1396,7 +1414,7 @@ export default {
1396
1414
  key: 'top',
1397
1415
  ref: 'refTopWrapper',
1398
1416
  class: 'vxe-grid--top-wrapper'
1399
- }, topSlot.call($xeGrid, { $grid: $xeGrid }))
1417
+ }, topSlot.call($xeGrid, { $grid: $xeGrid, $gantt: null }))
1400
1418
  : renderEmptyElement($xeGrid);
1401
1419
  },
1402
1420
  renderTableLeft(h) {
@@ -1406,7 +1424,7 @@ export default {
1406
1424
  if (leftSlot) {
1407
1425
  return h('div', {
1408
1426
  class: 'vxe-grid--left-wrapper'
1409
- }, leftSlot({ $grid: $xeGrid }));
1427
+ }, leftSlot({ $grid: $xeGrid, $gantt: null }));
1410
1428
  }
1411
1429
  return renderEmptyElement($xeGrid);
1412
1430
  },
@@ -1417,7 +1435,7 @@ export default {
1417
1435
  if (rightSlot) {
1418
1436
  return h('div', {
1419
1437
  class: 'vxe-grid--right-wrapper'
1420
- }, rightSlot({ $grid: $xeGrid }));
1438
+ }, rightSlot({ $grid: $xeGrid, $gantt: null }));
1421
1439
  }
1422
1440
  return renderEmptyElement($xeGrid);
1423
1441
  },
@@ -1446,7 +1464,7 @@ export default {
1446
1464
  key: 'bottom',
1447
1465
  ref: 'refBottomWrapper',
1448
1466
  class: 'vxe-grid--bottom-wrapper'
1449
- }, bottomSlot.call($xeGrid, { $grid: $xeGrid }))
1467
+ }, bottomSlot.call($xeGrid, { $grid: $xeGrid, $gantt: null }))
1450
1468
  : renderEmptyElement($xeGrid);
1451
1469
  },
1452
1470
  renderPager(h) {
@@ -1465,7 +1483,7 @@ export default {
1465
1483
  key: 'pager',
1466
1484
  class: 'vxe-grid--pager-wrapper'
1467
1485
  }, pagerSlot
1468
- ? pagerSlot.call($xeGrid, { $grid: $xeGrid })
1486
+ ? pagerSlot.call($xeGrid, { $grid: $xeGrid, $gantt: null })
1469
1487
  : [
1470
1488
  VxeUIPagerComponent
1471
1489
  ? h(VxeUIPagerComponent, {