vxe-table 3.17.6 → 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 (48) 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 +147 -48
  5. package/es/table/src/props.js +1 -1
  6. package/es/table/src/table.js +12 -12
  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 +13627 -13483
  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 +158 -49
  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 +13 -13
  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 +157 -52
  36. package/packages/table/src/props.ts +1 -1
  37. package/packages/table/src/table.ts +12 -14
  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/styles/cssvar.scss +0 -2
  43. /package/es/{iconfont.1754534807189.ttf → iconfont.1754905462391.ttf} +0 -0
  44. /package/es/{iconfont.1754534807189.woff → iconfont.1754905462391.woff} +0 -0
  45. /package/es/{iconfont.1754534807189.woff2 → iconfont.1754905462391.woff2} +0 -0
  46. /package/lib/{iconfont.1754534807189.ttf → iconfont.1754905462391.ttf} +0 -0
  47. /package/lib/{iconfont.1754534807189.woff → iconfont.1754905462391.woff} +0 -0
  48. /package/lib/{iconfont.1754534807189.woff2 → iconfont.1754905462391.woff2} +0 -0
@@ -4,19 +4,19 @@ import XEUtils from 'xe-utils'
4
4
  import { getLastZIndex, nextZIndex, isEnableConf } from '../../ui/src/utils'
5
5
  import { getOffsetHeight, getPaddingTopBottomSize, getDomNode, toCssUnit } from '../../ui/src/dom'
6
6
  import { VxeUI } from '../../ui'
7
- import VxeTableComponent from '../../table/src/table'
8
- import VxeToolbarComponent from '../../toolbar/src/toolbar'
9
- import tableComponentProps from '../../table/src/props'
10
7
  import { getSlotVNs } from '../../ui/src/vn'
11
8
  import { warnLog, errLog } from '../../ui/src/log'
9
+ import { tableProps } from '../../table/src/props'
10
+ import VxeTableComponent from '../../table/src/table'
11
+ import VxeToolbarComponent from '../../toolbar/src/toolbar'
12
12
 
13
13
  import type { VxeFormItemProps, VxeFormDefines, VxeComponentStyleType, VxeComponentSizeType, ValueOf, VxeFormInstance, VxeFormItemPropTypes, VxePagerInstance } from 'vxe-pc-ui'
14
- import type { GridReactData, VxeTablePropTypes, VxeGridConstructor, VxeToolbarPropTypes, VxeToolbarInstance, VxeGridPropTypes, VxeTableMethods, GridInternalData, VxeGridEmits, VxePagerDefines, VxeTableConstructor, VxeTableDefines, VxeTablePrivateMethods, TableInternalData } from '../../../types'
14
+ import type { GridReactData, VxeTablePropTypes, VxeGridConstructor, VxeToolbarPropTypes, VxeToolbarInstance, VxeGridPropTypes, VxeTableMethods, GridInternalData, VxeGridEmits, VxePagerDefines, VxeTableConstructor, VxeTableDefines, VxeTablePrivateMethods, TableInternalData, VxeTableProps } from '../../../types'
15
15
 
16
16
  const { getConfig, getI18n, commands, globalEvents, globalMixins, createEvent, GLOBAL_EVENT_KEYS, renderEmptyElement } = VxeUI
17
17
 
18
18
  const tableMethods: VxeTableMethods = {} as VxeTableMethods
19
- const propKeys = Object.keys(tableComponentProps)
19
+ const propKeys = Object.keys(tableProps) as (keyof VxeTableProps)[]
20
20
 
21
21
  const defaultLayouts: VxeGridPropTypes.Layouts = [['Form'], ['Toolbar', 'Top', 'Table', 'Bottom', 'Pager']]
22
22
 
@@ -42,7 +42,7 @@ function getTableOns (_vm: any) {
42
42
  }
43
43
 
44
44
  XEUtils.each(VxeTableComponent.methods, (fn, name) => {
45
- (tableMethods as any)[name] = function (...args: any[]) {
45
+ tableMethods[name as keyof VxeTableMethods] = function (this: any, ...args: any[]) {
46
46
  const $xeGrid = this
47
47
  const $xeTable = $xeGrid.$refs.refTable
48
48
 
@@ -52,7 +52,6 @@ XEUtils.each(VxeTableComponent.methods, (fn, name) => {
52
52
 
53
53
  function createInternalData (): GridInternalData {
54
54
  return {
55
- connectTable: null
56
55
  }
57
56
  }
58
57
 
@@ -75,11 +74,10 @@ export default /* define-vxe-component start */ defineVxeComponent({
75
74
  validConfig: Object as PropType<VxeTablePropTypes.ValidConfig>,
76
75
  editRules: Object as PropType<VxeTablePropTypes.EditRules>,
77
76
  animat: { type: Boolean, default: () => getConfig().table.animat },
78
-
79
- // eslint-disable-next-line @typescript-eslint/ban-types
80
- ...(tableComponentProps as {}),
81
77
  // 以上仅用于类型
82
78
 
79
+ // eslint-disable-next-line @typescript-eslint/ban-types
80
+ ...(tableProps as {}),
83
81
  layouts: Array as PropType<VxeGridPropTypes.Layouts>,
84
82
  columns: Array as PropType<VxeGridPropTypes.Columns<any>>,
85
83
  pagerConfig: Object as PropType<VxeGridPropTypes.PagerConfig>,
@@ -385,7 +383,7 @@ export default /* define-vxe-component start */ defineVxeComponent({
385
383
  ...tableMethods,
386
384
  dispatchEvent (type: ValueOf<VxeGridEmits>, params: Record<string, any>, evnt: Event | null) {
387
385
  const $xeGrid = this
388
- $xeGrid.$emit(type, createEvent(evnt, { $grid: $xeGrid }, params))
386
+ $xeGrid.$emit(type, createEvent(evnt, { $grid: $xeGrid, $gantt: null }, params))
389
387
  },
390
388
  initPages (propKey?: 'currentPage' | 'pageSize' | 'total') {
391
389
  const $xeGrid = this
@@ -472,7 +470,7 @@ export default /* define-vxe-component start */ defineVxeComponent({
472
470
  const $xeTable = $xeGrid.$refs.refTable as VxeTableConstructor & VxeTablePrivateMethods
473
471
  const $xeToolbar = $xeGrid.$refs.refToolbar as VxeToolbarInstance
474
472
  if ($xeTable && $xeToolbar) {
475
- $xeTable.connect($xeToolbar)
473
+ $xeTable.connectToolbar($xeToolbar)
476
474
  }
477
475
  })
478
476
  },
@@ -538,9 +536,10 @@ export default /* define-vxe-component start */ defineVxeComponent({
538
536
  const proxyOpts = $xeGrid.computeProxyOpts
539
537
  const resConfigs = proxyOpts.response || proxyOpts.props || {}
540
538
  const messageProp = resConfigs.message
539
+ const $xeTable = $xeGrid.$refs.refTable as VxeTableConstructor & VxeTablePrivateMethods
541
540
  let msg
542
541
  if (rest && messageProp) {
543
- msg = XEUtils.isFunction(messageProp) ? messageProp({ data: rest, $grid: $xeGrid as unknown as VxeGridConstructor }) : XEUtils.get(rest, messageProp)
542
+ msg = XEUtils.isFunction(messageProp) ? messageProp({ data: rest, $table: $xeTable, $grid: $xeGrid as VxeGridConstructor, $gantt: null }) : XEUtils.get(rest, messageProp)
544
543
  }
545
544
  return msg || getI18n(defaultMsg)
546
545
  },
@@ -727,11 +726,13 @@ export default /* define-vxe-component start */ defineVxeComponent({
727
726
  }
728
727
  }
729
728
  const commitParams = {
729
+ $table: $xeTable,
730
+ $grid: $xeGrid as VxeGridConstructor,
731
+ $gantt: null,
730
732
  code,
731
733
  button,
732
734
  isInited,
733
735
  isReload,
734
- $grid: $xeGrid as unknown as VxeGridConstructor,
735
736
  page: pageParams,
736
737
  sort: sortList.length ? sortList[0] : {},
737
738
  sorts: sortList,
@@ -750,10 +751,10 @@ export default /* define-vxe-component start */ defineVxeComponent({
750
751
  if (rest) {
751
752
  if (pagerConfig && isEnableConf(pagerOpts)) {
752
753
  const totalProp = resConfigs.total
753
- const total = (XEUtils.isFunction(totalProp) ? totalProp({ data: rest, $grid: $xeGrid as unknown as VxeGridConstructor }) : XEUtils.get(rest, totalProp || 'page.total')) || 0
754
+ const total = (XEUtils.isFunction(totalProp) ? totalProp({ data: rest, $table: $xeTable, $grid: $xeGrid as VxeGridConstructor, $gantt: null }) : XEUtils.get(rest, totalProp || 'page.total')) || 0
754
755
  tablePage.total = XEUtils.toNumber(total)
755
756
  const resultProp = resConfigs.result
756
- tableData = (XEUtils.isFunction(resultProp) ? resultProp({ data: rest, $grid: $xeGrid as unknown as VxeGridConstructor }) : XEUtils.get(rest, resultProp || 'result')) || []
757
+ tableData = (XEUtils.isFunction(resultProp) ? resultProp({ data: rest, $table: $xeTable, $grid: $xeGrid as VxeGridConstructor, $gantt: null }) : XEUtils.get(rest, resultProp || 'result')) || []
757
758
  // 检验当前页码,不能超出当前最大页数
758
759
  const pageCount = Math.max(Math.ceil(total / tablePage.pageSize), 1)
759
760
  if (tablePage.currentPage > pageCount) {
@@ -761,7 +762,7 @@ export default /* define-vxe-component start */ defineVxeComponent({
761
762
  }
762
763
  } else {
763
764
  const listProp = resConfigs.list
764
- tableData = (listProp ? (XEUtils.isFunction(listProp) ? listProp({ data: rest, $grid: $xeGrid as unknown as VxeGridConstructor }) : XEUtils.get(rest, listProp)) : rest) || []
765
+ tableData = (listProp ? (XEUtils.isFunction(listProp) ? listProp({ data: rest, $table: $xeTable, $grid: $xeGrid as VxeGridConstructor, $gantt: null }) : XEUtils.get(rest, listProp)) : rest) || []
765
766
  }
766
767
  }
767
768
  if ($xeTable as any) {
@@ -800,7 +801,16 @@ export default /* define-vxe-component start */ defineVxeComponent({
800
801
  const selectRecords = $xeTable.getCheckboxRecords()
801
802
  const removeRecords = selectRecords.filter((row) => !$xeTable.isInsertByRow(row))
802
803
  const body = { removeRecords }
803
- const commitParams = { $grid: $xeGrid, code, button, body, form: formData, options: ajaxMethods }
804
+ const commitParams = {
805
+ $table: $xeTable,
806
+ $grid: $xeGrid as VxeGridConstructor,
807
+ $gantt: null,
808
+ code,
809
+ button,
810
+ body,
811
+ form: formData,
812
+ options: ajaxMethods
813
+ }
804
814
  const applyArgs = [commitParams].concat(args)
805
815
  if (selectRecords.length) {
806
816
  return $xeGrid.handleDeleteRow(code, 'vxe.grid.deleteSelectRecord', () => {
@@ -865,7 +875,16 @@ export default /* define-vxe-component start */ defineVxeComponent({
865
875
  if (ajaxMethods) {
866
876
  const body = $xeGrid.getRecordset()
867
877
  const { insertRecords, removeRecords, updateRecords, pendingRecords } = body
868
- const commitParams = { $grid: $xeGrid, code, button, body, form: formData, options: ajaxMethods }
878
+ const commitParams = {
879
+ $table: $xeTable,
880
+ $grid: $xeGrid as VxeGridConstructor,
881
+ $gantt: null,
882
+ code,
883
+ button,
884
+ body,
885
+ form: formData,
886
+ options: ajaxMethods
887
+ }
869
888
  const applyArgs = [commitParams].concat(args)
870
889
  // 排除掉新增且标记为删除的数据
871
890
  if (insertRecords.length) {
@@ -940,8 +959,9 @@ export default /* define-vxe-component start */ defineVxeComponent({
940
959
  default: {
941
960
  const gCommandOpts = commands.get(code)
942
961
  if (gCommandOpts) {
943
- if (gCommandOpts.commandMethod) {
944
- gCommandOpts.commandMethod({ code, button, $grid: $xeGrid as unknown as VxeGridConstructor, $table: $xeTable }, ...args)
962
+ const tCommandMethod = gCommandOpts.tableCommandMethod || gCommandOpts.commandMethod
963
+ if (tCommandMethod) {
964
+ tCommandMethod({ code, button, $grid: $xeGrid as VxeGridConstructor, $table: $xeTable, $gantt: null }, ...args)
945
965
  } else {
946
966
  errLog('vxe.error.notCommands', [code])
947
967
  }
@@ -1431,7 +1451,7 @@ export default /* define-vxe-component start */ defineVxeComponent({
1431
1451
  const beforeItem = proxyOpts.beforeItem
1432
1452
  if (proxyOpts && beforeItem) {
1433
1453
  formOpts.items.forEach((item: any) => {
1434
- beforeItem.call($xeGrid, { $grid: $xeGrid, item })
1454
+ beforeItem.call($xeGrid, { $grid: $xeGrid, $gantt: null, item })
1435
1455
  })
1436
1456
  }
1437
1457
  }
@@ -1478,7 +1498,7 @@ export default /* define-vxe-component start */ defineVxeComponent({
1478
1498
  key: 'form',
1479
1499
  ref: 'refFormWrapper',
1480
1500
  class: 'vxe-grid--form-wrapper'
1481
- }, formSlot ? formSlot.call($xeGrid, { $grid: $xeGrid }) : $xeGrid.renderDefaultForm(h))
1501
+ }, formSlot ? formSlot.call($xeGrid, { $grid: $xeGrid, $gantt: null }) : $xeGrid.renderDefaultForm(h))
1482
1502
  }
1483
1503
  return renderEmptyElement($xeGrid)
1484
1504
  },
@@ -1498,7 +1518,7 @@ export default /* define-vxe-component start */ defineVxeComponent({
1498
1518
  ref: 'refToolbarWrapper',
1499
1519
  class: 'vxe-grid--toolbar-wrapper'
1500
1520
  }, toolbarSlot
1501
- ? toolbarSlot.call($xeGrid, { $grid: $xeGrid })
1521
+ ? toolbarSlot.call($xeGrid, { $grid: $xeGrid, $gantt: null })
1502
1522
  : [
1503
1523
  h(VxeToolbarComponent, {
1504
1524
  props: Object.assign({}, toolbarOpts, { slots: undefined }),
@@ -1520,7 +1540,7 @@ export default /* define-vxe-component start */ defineVxeComponent({
1520
1540
  key: 'top',
1521
1541
  ref: 'refTopWrapper',
1522
1542
  class: 'vxe-grid--top-wrapper'
1523
- }, topSlot.call($xeGrid, { $grid: $xeGrid }))
1543
+ }, topSlot.call($xeGrid, { $grid: $xeGrid, $gantt: null }))
1524
1544
  : renderEmptyElement($xeGrid)
1525
1545
  },
1526
1546
  renderTableLeft (h: CreateElement) {
@@ -1531,7 +1551,7 @@ export default /* define-vxe-component start */ defineVxeComponent({
1531
1551
  if (leftSlot) {
1532
1552
  return h('div', {
1533
1553
  class: 'vxe-grid--left-wrapper'
1534
- }, leftSlot({ $grid: $xeGrid }))
1554
+ }, leftSlot({ $grid: $xeGrid, $gantt: null }))
1535
1555
  }
1536
1556
  return renderEmptyElement($xeGrid)
1537
1557
  },
@@ -1543,7 +1563,7 @@ export default /* define-vxe-component start */ defineVxeComponent({
1543
1563
  if (rightSlot) {
1544
1564
  return h('div', {
1545
1565
  class: 'vxe-grid--right-wrapper'
1546
- }, rightSlot({ $grid: $xeGrid }))
1566
+ }, rightSlot({ $grid: $xeGrid, $gantt: null }))
1547
1567
  }
1548
1568
  return renderEmptyElement($xeGrid)
1549
1569
  },
@@ -1570,13 +1590,12 @@ export default /* define-vxe-component start */ defineVxeComponent({
1570
1590
  const slots = $xeGrid.$scopedSlots
1571
1591
 
1572
1592
  const bottomSlot = slots.bottom
1573
-
1574
1593
  return bottomSlot
1575
1594
  ? h('div', {
1576
1595
  key: 'bottom',
1577
1596
  ref: 'refBottomWrapper',
1578
1597
  class: 'vxe-grid--bottom-wrapper'
1579
- }, bottomSlot.call($xeGrid, { $grid: $xeGrid }))
1598
+ }, bottomSlot.call($xeGrid, { $grid: $xeGrid, $gantt: null }))
1580
1599
  : renderEmptyElement($xeGrid)
1581
1600
  },
1582
1601
  renderPager (h: CreateElement) {
@@ -1597,7 +1616,7 @@ export default /* define-vxe-component start */ defineVxeComponent({
1597
1616
  key: 'pager',
1598
1617
  class: 'vxe-grid--pager-wrapper'
1599
1618
  }, pagerSlot
1600
- ? pagerSlot.call($xeGrid, { $grid: $xeGrid })
1619
+ ? pagerSlot.call($xeGrid, { $grid: $xeGrid, $gantt: null })
1601
1620
  : [
1602
1621
  VxeUIPagerComponent
1603
1622
  ? h(VxeUIPagerComponent, {
@@ -6,7 +6,7 @@ import { hasClass } from '../../../ui/src/dom'
6
6
  import { createHtmlPage, getExportBlobByContent } from './util'
7
7
  import { warnLog, errLog } from '../../../ui/src/log'
8
8
 
9
- import type { VxeTablePropTypes, VxeGridConstructor, VxeTableDefines, TableReactData, VxeTablePrivateMethods, TableInternalData, GridReactData, VxeColumnPropTypes, VxeTableConstructor } from '../../../../types'
9
+ import type { VxeTablePropTypes, VxeTableDefines, TableReactData, VxeTablePrivateMethods, TableInternalData, GridReactData, VxeColumnPropTypes, VxeTableConstructor } from '../../../../types'
10
10
 
11
11
  const { getI18n, renderer } = VxeUI
12
12
 
@@ -1176,7 +1176,8 @@ export default {
1176
1176
  const props = $xeTable
1177
1177
  const reactData = $xeTable as unknown as TableReactData
1178
1178
  const internalData = $xeTable as unknown as TableInternalData
1179
- const $xeGrid = $xeTable.$xeGrid as VxeGridConstructor
1179
+ const $xeGrid = $xeTable.$xeGrid
1180
+ const $xeGantt = $xeTable.$xeGantt
1180
1181
 
1181
1182
  const { treeConfig, showHeader, showFooter } = props
1182
1183
  const { isGroup } = reactData
@@ -1382,6 +1383,7 @@ export default {
1382
1383
  const params = {
1383
1384
  $table: $xeTable,
1384
1385
  $grid: $xeGrid,
1386
+ $gantt: $xeGantt,
1385
1387
  sort: sortData.length ? sortData[0] : {} as any,
1386
1388
  sorts: sortData as any[],
1387
1389
  filters: gridReactData.filterData,
@@ -1391,7 +1393,7 @@ export default {
1391
1393
  return Promise.resolve((beforeQueryAll || ajaxMethods)(params))
1392
1394
  .then(rest => {
1393
1395
  const listProp = resConfigs.list
1394
- handleOptions.data = (listProp ? (XEUtils.isFunction(listProp) ? listProp({ data: rest, $grid: $xeGrid }) : XEUtils.get(rest, listProp)) : rest) || []
1396
+ handleOptions.data = (listProp ? (XEUtils.isFunction(listProp) ? listProp({ data: rest, $table: $xeTable, $grid: $xeGrid, $gantt: $xeGantt }) : XEUtils.get(rest, listProp)) : rest) || []
1395
1397
  if (afterQueryAll) {
1396
1398
  afterQueryAll(params)
1397
1399
  }