vxe-table 3.8.5 → 3.8.6-beta.1

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 (50) hide show
  1. package/lib/all.js +2 -0
  2. package/lib/all.min.js +1 -1
  3. package/lib/custom/src/panel.js +25 -4
  4. package/lib/custom/src/panel.min.js +1 -1
  5. package/lib/export/style/style.css +1 -0
  6. package/lib/export/style/style.min.css +1 -1
  7. package/lib/icon/style/style.css +1 -1
  8. package/lib/icon/style/style.min.css +1 -1
  9. package/lib/index.css +1 -1
  10. package/lib/index.umd.js +117 -29
  11. package/lib/index.umd.min.js +1 -1
  12. package/lib/input/src/input.js +1 -0
  13. package/lib/input/src/input.min.js +1 -1
  14. package/lib/style.css +1 -1
  15. package/lib/style.min.css +1 -1
  16. package/lib/table/src/methods.js +64 -17
  17. package/lib/table/src/methods.min.js +1 -1
  18. package/lib/table/style/style.css +10 -0
  19. package/lib/table/style/style.min.css +1 -1
  20. package/lib/tools/dom.js +2 -4
  21. package/lib/tools/dom.min.js +1 -1
  22. package/lib/tools/log.js +1 -1
  23. package/lib/tools/log.min.js +1 -1
  24. package/lib/v-x-e-table/index.js +3 -1
  25. package/lib/v-x-e-table/index.min.js +1 -1
  26. package/lib/v-x-e-table/src/config.js +6 -2
  27. package/lib/v-x-e-table/src/config.min.js +1 -1
  28. package/lib/v-x-e-table/src/theme.js +17 -0
  29. package/lib/v-x-e-table/src/theme.min.js +1 -0
  30. package/lib/vxe-table/style/style.css +10 -0
  31. package/lib/vxe-table/style/style.min.css +1 -1
  32. package/lib/vxe-table-export-module/style/style.css +1 -0
  33. package/lib/vxe-table-export-module/style/style.min.css +1 -1
  34. package/package.json +1 -1
  35. package/packages/all.js +2 -0
  36. package/packages/custom/src/panel.js +24 -4
  37. package/packages/input/src/input.js +1 -0
  38. package/packages/table/src/methods.js +62 -14
  39. package/packages/tools/dom.js +2 -4
  40. package/packages/v-x-e-table/index.js +3 -0
  41. package/packages/v-x-e-table/src/config.js +6 -2
  42. package/packages/v-x-e-table/src/theme.js +11 -0
  43. package/styles/export.scss +1 -0
  44. package/styles/table.scss +8 -0
  45. /package/lib/icon/style/{iconfont.1715055533745.ttf → iconfont.1715224576202.ttf} +0 -0
  46. /package/lib/icon/style/{iconfont.1715055533745.woff → iconfont.1715224576202.woff} +0 -0
  47. /package/lib/icon/style/{iconfont.1715055533745.woff2 → iconfont.1715224576202.woff2} +0 -0
  48. /package/lib/{iconfont.1715055533745.ttf → iconfont.1715224576202.ttf} +0 -0
  49. /package/lib/{iconfont.1715055533745.woff → iconfont.1715224576202.woff} +0 -0
  50. /package/lib/{iconfont.1715055533745.woff2 → iconfont.1715224576202.woff2} +0 -0
@@ -1,3 +1,4 @@
1
+ import VXETable from '../../v-x-e-table'
1
2
  import UtilTools from '../../tools/utils'
2
3
  import DomTools from '../../tools/dom'
3
4
  import GlobalConfig from '../../v-x-e-table/src/conf'
@@ -457,7 +458,19 @@ export default {
457
458
  $xetable.emitCustomEvent('reset', evnt)
458
459
  },
459
460
  resetPopupCustomEvent (evnt) {
460
- this.resetCustomEvent(evnt)
461
+ if (VXETable.modal) {
462
+ VXETable.modal.confirm({
463
+ content: GlobalConfig.i18n('vxe.custom.cstmConfirmRestore'),
464
+ className: 'vxe-table--ignore-clear',
465
+ escClosable: true
466
+ }).then(type => {
467
+ if (type === 'confirm') {
468
+ this.resetCustomEvent(evnt)
469
+ }
470
+ })
471
+ } else {
472
+ this.resetCustomEvent(evnt)
473
+ }
461
474
  },
462
475
  handleOptionCheck (column) {
463
476
  const { $xetable } = this
@@ -586,9 +599,7 @@ export default {
586
599
  removeClass(trEl, 'active--drag-target')
587
600
  removeClass(trEl, 'active--drag-origin')
588
601
  // 更新顺序
589
- customColumnList.forEach((column, index) => {
590
- column.renderSortNumber = index
591
- })
602
+ this.updateColumnSort()
592
603
  },
593
604
  sortDragoverEvent (evnt) {
594
605
  const { $xetable, prevDropTrEl } = this
@@ -608,6 +619,15 @@ export default {
608
619
  this.prevDropTrEl = trEl
609
620
  }
610
621
  updateDropHint(this, evnt)
622
+ },
623
+ updateColumnSort () {
624
+ const { $xetable } = this
625
+ const { customColumnList } = $xetable
626
+ // 更新顺序
627
+ customColumnList.forEach((column, index) => {
628
+ const sortIndex = index + 1
629
+ column.renderSortNumber = sortIndex
630
+ })
611
631
  }
612
632
  }
613
633
  }
@@ -1995,6 +1995,7 @@ export default {
1995
1995
  }
1996
1996
  const { boundingTop, boundingLeft, visibleHeight, visibleWidth } = DomTools.getAbsolutePos(targetElem)
1997
1997
  let panelPlacement = 'bottom'
1998
+ console.log(DomTools.getAbsolutePos(targetElem))
1998
1999
  if (transfer) {
1999
2000
  let left = boundingLeft
2000
2001
  let top = boundingTop + targetHeight
@@ -567,12 +567,21 @@ const Methods = {
567
567
  return this.loadColumn(columns)
568
568
  })
569
569
  },
570
+ initColumnSort () {
571
+ const { collectColumn } = this
572
+ collectColumn.forEach((column, index) => {
573
+ const sortIndex = index + 1
574
+ column.sortNumber = sortIndex
575
+ column.renderSortNumber = sortIndex
576
+ })
577
+ },
570
578
  handleColumn (collectColumn) {
571
579
  this.collectColumn = collectColumn
572
580
  const tableFullColumn = getColumnList(collectColumn)
573
581
  this.tableFullColumn = tableFullColumn
574
- this.cacheColumnMap(true)
582
+ this.initColumnSort()
575
583
  this.restoreCustomStorage()
584
+ this.cacheColumnMap()
576
585
  this.parseColumns().then(() => {
577
586
  if (this.scrollXLoad) {
578
587
  this.loadScrollXData(true)
@@ -699,7 +708,7 @@ const Methods = {
699
708
  * 更新数据列的 Map
700
709
  * 牺牲数据组装的耗时,用来换取使用过程中的流畅
701
710
  */
702
- cacheColumnMap (isInit) {
711
+ cacheColumnMap () {
703
712
  const { tableFullColumn, collectColumn, fullColumnMap, showOverflow, columnOpts, rowOpts } = this
704
713
  const fullColumnIdData = this.fullColumnIdData = {}
705
714
  const fullColumnFieldData = this.fullColumnFieldData = {}
@@ -795,9 +804,6 @@ const Methods = {
795
804
  if (fullColumnIdData[colid]) {
796
805
  errLog('vxe.error.colRepet', ['colId', colid])
797
806
  }
798
- if (isInit) {
799
- column.sortNumber = index
800
- }
801
807
  fullColumnIdData[colid] = rest
802
808
  fullColumnMap.set(column, rest)
803
809
  }
@@ -1575,6 +1581,9 @@ const Methods = {
1575
1581
  if (opts.resizable) {
1576
1582
  this.saveCustomResizable(true)
1577
1583
  }
1584
+ if (opts.sort) {
1585
+ this.saveCustomSort(true)
1586
+ }
1578
1587
  if (opts.fixed) {
1579
1588
  this.saveCustomFixed()
1580
1589
  }
@@ -1592,6 +1601,7 @@ const Methods = {
1592
1601
  }
1593
1602
  }
1594
1603
  this.saveCustomVisible()
1604
+ this.saveCustomSort()
1595
1605
  this.analyColumnWidth()
1596
1606
  return this.refreshColumn(true)
1597
1607
  },
@@ -1599,7 +1609,7 @@ const Methods = {
1599
1609
  * 还原自定义列操作状态
1600
1610
  */
1601
1611
  restoreCustomStorage () {
1602
- const { id, collectColumn, customConfig, customOpts } = this
1612
+ const { id, customConfig, customOpts } = this
1603
1613
  const { storage } = customOpts
1604
1614
  const isAllStorage = storage === true
1605
1615
  const storageOpts = isAllStorage ? {} : Object.assign({}, storage || {})
@@ -1637,16 +1647,18 @@ const Methods = {
1637
1647
  }
1638
1648
  }
1639
1649
  // 自定义顺序
1650
+ let hasCustomSort = false
1640
1651
  if (isCustomSort) {
1641
1652
  const columnSortStorage = getCustomStorageMap(sortStorageKey)[id]
1642
1653
  if (columnSortStorage) {
1643
- const colOrderSeqs = columnSortStorage.split(',')
1644
- colOrderSeqs.forEach((orderConf) => {
1645
- const [colKey, sortNumber] = orderConf.split('|')
1654
+ XEUtils.each(columnSortStorage, (renderSortNumber, colKey) => {
1646
1655
  if (customMap[colKey]) {
1647
- customMap[colKey].sortNumber = sortNumber
1656
+ customMap[colKey].renderSortNumber = renderSortNumber
1648
1657
  } else {
1649
- customMap[colKey] = { sortNumber }
1658
+ customMap[colKey] = { renderSortNumber }
1659
+ }
1660
+ if (!hasCustomSort) {
1661
+ hasCustomSort = true
1650
1662
  }
1651
1663
  })
1652
1664
  }
@@ -1673,6 +1685,7 @@ const Methods = {
1673
1685
  })
1674
1686
  }
1675
1687
  }
1688
+ let { collectColumn } = this
1676
1689
  const keyMap = {}
1677
1690
  XEUtils.eachTree(collectColumn, column => {
1678
1691
  const colKey = column.getKey()
@@ -1680,7 +1693,7 @@ const Methods = {
1680
1693
  keyMap[colKey] = column
1681
1694
  }
1682
1695
  })
1683
- XEUtils.each(customMap, ({ visible, resizeWidth, fixed, sortNumber }, field) => {
1696
+ XEUtils.each(customMap, ({ visible, resizeWidth, fixed, renderSortNumber }, field) => {
1684
1697
  const column = keyMap[field]
1685
1698
  if (column) {
1686
1699
  if (XEUtils.isNumber(resizeWidth)) {
@@ -1692,11 +1705,17 @@ const Methods = {
1692
1705
  if (fixed) {
1693
1706
  column.fixed = fixed
1694
1707
  }
1695
- if (sortNumber) {
1696
- column.colSeq = Number(sortNumber)
1708
+ if (renderSortNumber) {
1709
+ column.renderSortNumber = Number(renderSortNumber)
1697
1710
  }
1698
1711
  }
1699
1712
  })
1713
+ // 如果自定义了顺序
1714
+ if (hasCustomSort) {
1715
+ collectColumn = XEUtils.orderBy(collectColumn, 'renderSortNumber')
1716
+ this.collectColumn = collectColumn
1717
+ this.tableFullColumn = getColumnList(collectColumn)
1718
+ }
1700
1719
  }
1701
1720
  },
1702
1721
  saveCustomFixed () {
@@ -1785,6 +1804,35 @@ const Methods = {
1785
1804
  localStorage.setItem(resizableStorageKey, XEUtils.toJSONString(columnWidthStorageMap))
1786
1805
  }
1787
1806
  },
1807
+ saveCustomSort (isReset) {
1808
+ const { id, collectColumn, customConfig, customOpts } = this
1809
+ const { storage } = customOpts
1810
+ const isAllStorage = storage === true
1811
+ const storageOpts = isAllStorage ? {} : Object.assign({}, storage || {})
1812
+ const isSort = isAllStorage || storageOpts.sort
1813
+ if (customConfig && isSort) {
1814
+ const columnSortStorageMap = getCustomStorageMap(sortStorageKey)
1815
+ let columnWidthStorage
1816
+ if (!id) {
1817
+ errLog('vxe.error.reqProp', ['id'])
1818
+ return
1819
+ }
1820
+ if (!isReset) {
1821
+ columnWidthStorage = XEUtils.isPlainObject(columnSortStorageMap[id]) ? columnSortStorageMap[id] : {}
1822
+ // 排序只支持一级
1823
+ collectColumn.forEach(column => {
1824
+ if (column.sortNumber !== column.renderSortNumber) {
1825
+ const colKey = column.getKey()
1826
+ if (colKey) {
1827
+ columnWidthStorage[colKey] = column.renderSortNumber
1828
+ }
1829
+ }
1830
+ })
1831
+ }
1832
+ columnSortStorageMap[id] = XEUtils.isEmpty(columnWidthStorage) ? undefined : columnWidthStorage
1833
+ localStorage.setItem(sortStorageKey, XEUtils.toJSONString(columnSortStorageMap))
1834
+ }
1835
+ },
1788
1836
  handleUpdateDataQueue () {
1789
1837
  this.upDataFlag++
1790
1838
  },
@@ -133,11 +133,9 @@ export const DomTools = {
133
133
  return getNodeOffset(elem, container, { left: 0, top: 0 })
134
134
  },
135
135
  getAbsolutePos (elem) {
136
- // 当主页面嵌套在iframe时,elem.getBoundingClientRect()仅计算在当前body内的边界距离,忽略了body所在的边界距离
137
- const bodyBounding = document.body.getBoundingClientRect()
138
136
  const bounding = elem.getBoundingClientRect()
139
- const boundingTop = bounding.top - bodyBounding.top
140
- const boundingLeft = bounding.left - bodyBounding.left
137
+ const boundingTop = bounding.top
138
+ const boundingLeft = bounding.left
141
139
  const { scrollTop, scrollLeft, visibleHeight, visibleWidth } = getDomNode()
142
140
  return { boundingTop, top: scrollTop + boundingTop, boundingLeft, left: scrollLeft + boundingLeft, visibleHeight, visibleWidth }
143
141
  },
@@ -7,6 +7,7 @@ import { menus } from './src/menus'
7
7
  import { formats } from './src/formats'
8
8
  import { validators } from './src/validators'
9
9
  import { config } from './src/config'
10
+ import { setTheme } from './src/theme'
10
11
  import { UtilTools } from '../tools/utils'
11
12
  import { errLog } from '../tools/log'
12
13
 
@@ -114,6 +115,8 @@ export const VXETable = {
114
115
  globalConfs
115
116
  }
116
117
 
118
+ setTheme(globalStore)
119
+
117
120
  export * from './src/interceptor'
118
121
  export * from './src/renderer'
119
122
  export * from './src/commands'
@@ -1,13 +1,17 @@
1
1
  import GlobalConfig from './conf'
2
2
  import DomZIndex from 'dom-zindex'
3
3
  import XEUtils from 'xe-utils'
4
+ import { setTheme } from './theme'
4
5
 
5
6
  /**
6
7
  * 全局参数设置
7
8
  */
8
9
  export function config (options) {
9
- if (options && options.zIndex) {
10
- DomZIndex.setCurrent(options.zIndex)
10
+ if (options) {
11
+ setTheme(options)
12
+ if (options.zIndex) {
13
+ DomZIndex.setCurrent(options.zIndex)
14
+ }
11
15
  }
12
16
  return XEUtils.merge(GlobalConfig, options)
13
17
  }
@@ -0,0 +1,11 @@
1
+ import GlobalConfig from '../../v-x-e-table/src/conf'
2
+
3
+ export function setTheme (options) {
4
+ const theme = (options ? options.theme : null) || GlobalConfig.theme || 'default'
5
+ if (typeof document !== 'undefined') {
6
+ const documentElement = document.documentElement
7
+ if (documentElement) {
8
+ documentElement.setAttribute('data-vxe-table-theme', theme)
9
+ }
10
+ }
11
+ }
@@ -103,6 +103,7 @@
103
103
  outline: 0;
104
104
  border-radius: $vxe-border-radius;
105
105
  background-color: $vxe-input-background-color;
106
+ color: inherit;
106
107
  user-select: none;
107
108
  cursor: pointer;
108
109
  &:focus {
package/styles/table.scss CHANGED
@@ -33,6 +33,9 @@
33
33
  border: 0;
34
34
  }
35
35
 
36
+ .vxe-table--render-wrapper {
37
+ background-color: $vxe-table-body-background-color;
38
+ }
36
39
  .vxe-table--body-wrapper {
37
40
  scroll-behavior: auto;
38
41
  }
@@ -610,6 +613,11 @@
610
613
  user-select: none;
611
614
  }
612
615
  }
616
+ &.drag--range {
617
+ .vxe-cell--checkbox {
618
+ user-select: none;
619
+ }
620
+ }
613
621
  .vxe-header--column,
614
622
  .vxe-body--column,
615
623
  .vxe-footer--column {