vxe-table 3.8.2 → 3.8.3-beta.0

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 (74) hide show
  1. package/lib/checkbox/src/group.js +7 -2
  2. package/lib/checkbox/src/group.min.js +1 -1
  3. package/lib/custom/src/mixin.js +3 -1
  4. package/lib/custom/src/mixin.min.js +1 -1
  5. package/lib/custom/src/panel.js +198 -45
  6. package/lib/custom/src/panel.min.js +1 -1
  7. package/lib/custom/style/style.css +327 -80
  8. package/lib/custom/style/style.min.css +1 -1
  9. package/lib/icon/style/style.css +1 -1
  10. package/lib/icon/style/style.min.css +1 -1
  11. package/lib/index.css +1 -1
  12. package/lib/index.umd.js +308 -89
  13. package/lib/index.umd.min.js +1 -1
  14. package/lib/locale/lang/en-US.js +18 -7
  15. package/lib/locale/lang/en-US.min.js +1 -1
  16. package/lib/locale/lang/en-US.umd.js +18 -7
  17. package/lib/locale/lang/es-ES.js +18 -7
  18. package/lib/locale/lang/es-ES.min.js +1 -1
  19. package/lib/locale/lang/es-ES.umd.js +18 -7
  20. package/lib/locale/lang/ja-JP.js +18 -6
  21. package/lib/locale/lang/ja-JP.min.js +1 -1
  22. package/lib/locale/lang/ja-JP.umd.js +18 -6
  23. package/lib/locale/lang/pt-BR.js +18 -7
  24. package/lib/locale/lang/pt-BR.min.js +1 -1
  25. package/lib/locale/lang/pt-BR.umd.js +18 -7
  26. package/lib/locale/lang/zh-CN.js +18 -7
  27. package/lib/locale/lang/zh-CN.min.js +1 -1
  28. package/lib/locale/lang/zh-CN.umd.js +18 -7
  29. package/lib/locale/lang/zh-HK.min.js +1 -1
  30. package/lib/locale/lang/zh-HK.umd.js +18 -7
  31. package/lib/locale/lang/zh-MO.min.js +1 -1
  32. package/lib/locale/lang/zh-MO.umd.js +18 -7
  33. package/lib/locale/lang/zh-TC.js +18 -7
  34. package/lib/locale/lang/zh-TC.min.js +1 -1
  35. package/lib/locale/lang/zh-TC.umd.js +18 -7
  36. package/lib/locale/lang/zh-TW.min.js +1 -1
  37. package/lib/locale/lang/zh-TW.umd.js +18 -7
  38. package/lib/radio/src/group.js +7 -2
  39. package/lib/radio/src/group.min.js +1 -1
  40. package/lib/style.css +1 -1
  41. package/lib/style.min.css +1 -1
  42. package/lib/table/src/columnInfo.js +10 -1
  43. package/lib/table/src/columnInfo.min.js +1 -1
  44. package/lib/table/src/methods.js +56 -33
  45. package/lib/table/src/methods.min.js +1 -1
  46. package/lib/table/src/table.js +3 -2
  47. package/lib/table/src/table.min.js +1 -1
  48. package/lib/tools/log.js +1 -1
  49. package/lib/tools/log.min.js +1 -1
  50. package/lib/v-x-e-table/index.js +1 -1
  51. package/lib/v-x-e-table/index.min.js +1 -1
  52. package/lib/vxe-table-custom-module/style/style.css +327 -80
  53. package/lib/vxe-table-custom-module/style/style.min.css +1 -1
  54. package/package.json +1 -1
  55. package/packages/checkbox/src/group.js +6 -2
  56. package/packages/custom/src/mixin.js +2 -1
  57. package/packages/custom/src/panel.js +214 -52
  58. package/packages/locale/lang/en-US.js +18 -7
  59. package/packages/locale/lang/es-ES.js +18 -7
  60. package/packages/locale/lang/ja-JP.js +18 -6
  61. package/packages/locale/lang/pt-BR.js +18 -7
  62. package/packages/locale/lang/zh-CN.js +18 -7
  63. package/packages/locale/lang/zh-TC.js +18 -7
  64. package/packages/radio/src/group.js +6 -2
  65. package/packages/table/src/columnInfo.js +9 -3
  66. package/packages/table/src/methods.js +51 -33
  67. package/packages/table/src/table.js +3 -2
  68. package/styles/custom.scss +192 -86
  69. /package/lib/icon/style/{iconfont.1714101947757.ttf → iconfont.1714276918127.ttf} +0 -0
  70. /package/lib/icon/style/{iconfont.1714101947757.woff → iconfont.1714276918127.woff} +0 -0
  71. /package/lib/icon/style/{iconfont.1714101947757.woff2 → iconfont.1714276918127.woff2} +0 -0
  72. /package/lib/{iconfont.1714101947757.ttf → iconfont.1714276918127.ttf} +0 -0
  73. /package/lib/{iconfont.1714101947757.woff → iconfont.1714276918127.woff} +0 -0
  74. /package/lib/{iconfont.1714101947757.woff2 → iconfont.1714276918127.woff2} +0 -0
@@ -8,7 +8,7 @@ export default {
8
8
  text: '加载中...'
9
9
  },
10
10
  error: {
11
- groupFixed: '如果使用分组表头,固定列必须按组设置',
11
+ groupFixed: '如果使用分组表头,冻结列必须按组设置',
12
12
  groupMouseRange: '分组表头与 "{0}" 不能同时使用,这可能会出现错误',
13
13
  groupTag: '分组列头应该使用 "{0}" 而不是 "{1}",这可能会出现错误',
14
14
  scrollErrProp: '启用虚拟滚动后不支持该参数 "{0}"',
@@ -61,7 +61,7 @@ export default {
61
61
  customAll: '全部',
62
62
  customConfirm: '确认',
63
63
  customRestore: '重置',
64
- maxFixedCol: '最大固定列的数量不能超过 {0} 个'
64
+ maxFixedCol: '最大冻结列的数量不能超过 {0} 个'
65
65
  },
66
66
  grid: {
67
67
  selectOneRecord: '请至少选择一条记录!',
@@ -96,7 +96,7 @@ export default {
96
96
  endPageTitle: '末页'
97
97
  },
98
98
  alert: {
99
- title: '消息提示'
99
+ title: '系统提示'
100
100
  },
101
101
  button: {
102
102
  confirm: '确认',
@@ -109,7 +109,18 @@ export default {
109
109
  cstmTitle: '列设置',
110
110
  cstmRestore: '恢复默认',
111
111
  cstmCancel: '取消',
112
- cstmConfirm: '确定'
112
+ cstmConfirm: '确定',
113
+ cstmConfirmRestore: '请确认是否恢复成默认列配置?',
114
+ cstmDragTarget: '移动目标:{0}',
115
+ setting: {
116
+ colSort: '排序',
117
+ colTitle: '标题',
118
+ colVisible: '是否显示',
119
+ colFixed: '冻结列',
120
+ fixedLeft: '左侧',
121
+ fixedUnset: '不设置',
122
+ fixedRight: '右侧'
123
+ }
113
124
  },
114
125
  import: {
115
126
  modes: {
@@ -188,9 +199,9 @@ export default {
188
199
  customAll: '全部',
189
200
  customConfirm: '确认',
190
201
  customRestore: '重置',
191
- fixedLeft: '固定在左侧',
192
- fixedRight: '固定在右侧',
193
- cancelfixed: '取消固定'
202
+ fixedLeft: '冻结在左侧',
203
+ fixedRight: '冻结在右侧',
204
+ cancelfixed: '取消冻结列'
194
205
  },
195
206
  input: {
196
207
  date: {
@@ -8,7 +8,7 @@ export default {
8
8
  text: '加載中...'
9
9
  },
10
10
  error: {
11
- groupFixed: '如果使用分組表頭,固定列必須按組設定',
11
+ groupFixed: '如果使用分組表頭,冻结列必須按組設定',
12
12
  groupMouseRange: '分组表頭與 "{0}" 不能同時使用,這可能會出現錯誤',
13
13
  groupTag: '分組列頭應該使用 "{0}" 而不是 "{1}",這可能會出現錯誤',
14
14
  scrollErrProp: '啟用虛擬滾動後不支持該參數 "{0}"',
@@ -61,7 +61,7 @@ export default {
61
61
  customAll: '全部',
62
62
  customConfirm: '確認',
63
63
  customRestore: '重置',
64
- maxFixedCol: '最大固定列的數量不能超過 {0} 個'
64
+ maxFixedCol: '最大冻结列的數量不能超過 {0} 個'
65
65
  },
66
66
  grid: {
67
67
  selectOneRecord: '請至少選擇一條記錄!',
@@ -96,7 +96,7 @@ export default {
96
96
  endPageTitle: '末頁'
97
97
  },
98
98
  alert: {
99
- title: '訊息提示'
99
+ title: '系統提示'
100
100
  },
101
101
  button: {
102
102
  confirm: '確認',
@@ -109,7 +109,18 @@ export default {
109
109
  cstmTitle: '列設定',
110
110
  cstmRestore: '恢復默認',
111
111
  cstmCancel: '取消',
112
- cstmConfirm: '確認'
112
+ cstmConfirm: '確認',
113
+ cstmConfirmRestore: '請確認是否恢復成默認列配置?',
114
+ cstmDragTarget: '移動目標:{0}',
115
+ setting: {
116
+ colSort: '排序',
117
+ colTitle: '標題',
118
+ colVisible: '是否顯示',
119
+ colFixed: '冻结列',
120
+ fixedLeft: '左側',
121
+ fixedUnset: '不設定',
122
+ fixedRight: '右側'
123
+ }
113
124
  },
114
125
  import: {
115
126
  modes: {
@@ -188,9 +199,9 @@ export default {
188
199
  customAll: '全部',
189
200
  customConfirm: '確認',
190
201
  customRestore: '重置',
191
- fixedLeft: '固定在左側',
192
- fixedRight: '固定在右側',
193
- cancelfixed: '取消固定'
202
+ fixedLeft: '冻结在左側',
203
+ fixedRight: '冻结在右側',
204
+ cancelfixed: '取消冻结列'
194
205
  },
195
206
  input: {
196
207
  date: {
@@ -37,6 +37,9 @@ export default {
37
37
  },
38
38
  valueField () {
39
39
  return this.propsOpts.value || 'value'
40
+ },
41
+ disabledField () {
42
+ return this.propsOpts.disabled || 'disabled'
40
43
  }
41
44
  },
42
45
  data () {
@@ -45,7 +48,7 @@ export default {
45
48
  }
46
49
  },
47
50
  render (h) {
48
- const { $scopedSlots, options, type, valueField, labelField } = this
51
+ const { $scopedSlots, options, type, valueField, labelField, disabledField } = this
49
52
  const defaultSlot = $scopedSlots.default
50
53
  const btnComp = type === 'button' ? 'vxe-radio-button' : 'vxe-radio'
51
54
  return h('div', {
@@ -54,7 +57,8 @@ export default {
54
57
  return h(btnComp, {
55
58
  props: {
56
59
  label: item[valueField],
57
- content: item[labelField]
60
+ content: item[labelField],
61
+ disabled: item[disabledField]
58
62
  }
59
63
  })
60
64
  }) : []))
@@ -112,9 +112,15 @@ export class ColumnInfo {
112
112
  level: 1,
113
113
  rowSpan: 1,
114
114
  colSpan: 1,
115
- order: null,
116
- sortTime: 0,
117
- customOrder: 0,
115
+
116
+ // 数据排序
117
+ order: null, // 用于记录排序类型,升序和倒序
118
+ sortTime: 0, // 用于多列的先后顺序
119
+
120
+ // 列排序
121
+ sortNumber: 0, // 用于记录自定义列顺序
122
+ renderSortNumber: 0, // 用于记录自定义列顺序
123
+
118
124
  renderWidth: 0,
119
125
  renderHeight: 0,
120
126
  resizeWidth: 0,
@@ -18,7 +18,7 @@ const debounceScrollYDuration = browse.msie ? 80 : 20
18
18
  const resizableStorageKey = 'VXE_TABLE_CUSTOM_COLUMN_WIDTH'
19
19
  const visibleStorageKey = 'VXE_TABLE_CUSTOM_COLUMN_VISIBLE'
20
20
  const fixedStorageKey = 'VXE_TABLE_CUSTOM_COLUMN_FIXED'
21
- const orderStorageKey = 'VXE_TABLE_CUSTOM_COLUMN_ORDER'
21
+ const sortStorageKey = 'VXE_TABLE_CUSTOM_COLUMN_SORT'
22
22
 
23
23
  /**
24
24
  * 生成行的唯一主键
@@ -571,7 +571,7 @@ const Methods = {
571
571
  this.collectColumn = collectColumn
572
572
  const tableFullColumn = getColumnList(collectColumn)
573
573
  this.tableFullColumn = tableFullColumn
574
- this.cacheColumnMap()
574
+ this.cacheColumnMap(true)
575
575
  this.restoreCustomStorage()
576
576
  this.parseColumns().then(() => {
577
577
  if (this.scrollXLoad) {
@@ -699,7 +699,7 @@ const Methods = {
699
699
  * 更新数据列的 Map
700
700
  * 牺牲数据组装的耗时,用来换取使用过程中的流畅
701
701
  */
702
- cacheColumnMap () {
702
+ cacheColumnMap (isInit) {
703
703
  const { tableFullColumn, collectColumn, fullColumnMap, showOverflow, columnOpts, rowOpts } = this
704
704
  const fullColumnIdData = this.fullColumnIdData = {}
705
705
  const fullColumnFieldData = this.fullColumnFieldData = {}
@@ -795,6 +795,9 @@ const Methods = {
795
795
  if (fullColumnIdData[colid]) {
796
796
  errLog('vxe.error.colRepet', ['colId', colid])
797
797
  }
798
+ if (isInit) {
799
+ column.sortNumber = index
800
+ }
798
801
  fullColumnIdData[colid] = rest
799
802
  fullColumnMap.set(column, rest)
800
803
  }
@@ -1552,7 +1555,8 @@ const Methods = {
1552
1555
  const opts = Object.assign({
1553
1556
  visible: true,
1554
1557
  resizable: options === true,
1555
- fixed: options === true
1558
+ fixed: options === true,
1559
+ sort: options === true
1556
1560
  }, options)
1557
1561
  XEUtils.eachTree(collectColumn, (column) => {
1558
1562
  if (opts.resizable) {
@@ -1561,6 +1565,9 @@ const Methods = {
1561
1565
  if (opts.fixed) {
1562
1566
  column.fixed = column.defaultFixed
1563
1567
  }
1568
+ if (opts.sort) {
1569
+ column.renderSortNumber = column.sortNumber
1570
+ }
1564
1571
  if (!checkMethod || checkMethod({ column })) {
1565
1572
  column.visible = column.defaultVisible
1566
1573
  }
@@ -1576,7 +1583,7 @@ const Methods = {
1576
1583
  handleCustom () {
1577
1584
  this.saveCustomVisible()
1578
1585
  this.analyColumnWidth()
1579
- return this.refreshColumn()
1586
+ return this.refreshColumn(true)
1580
1587
  },
1581
1588
  /**
1582
1589
  * 还原自定义列操作状态
@@ -1584,12 +1591,13 @@ const Methods = {
1584
1591
  restoreCustomStorage () {
1585
1592
  const { id, collectColumn, customConfig, customOpts } = this
1586
1593
  const { storage } = customOpts
1587
- const isAllStorage = customOpts.storage === true
1588
- const isCustomResizable = isAllStorage || (storage && storage.resizable)
1589
- const isCustomVisible = isAllStorage || (storage && storage.visible)
1590
- const isCustomFixed = storage === true || (storage && storage.fixed)
1591
- const isCustomOrder = storage === true || (storage && storage.order)
1592
- if (customConfig && (isCustomResizable || isCustomVisible || isCustomFixed || isCustomOrder)) {
1594
+ const isAllStorage = storage === true
1595
+ const storageOpts = isAllStorage ? {} : Object.assign({}, storage || {})
1596
+ const isCustomResizable = isAllStorage || storageOpts.resizable
1597
+ const isCustomVisible = isAllStorage || storageOpts.visible
1598
+ const isCustomFixed = isAllStorage || storageOpts.fixed
1599
+ const isCustomSort = isAllStorage || storageOpts.sort
1600
+ if (customConfig && (isCustomResizable || isCustomVisible || isCustomFixed || isCustomSort)) {
1593
1601
  const customMap = {}
1594
1602
  if (!id) {
1595
1603
  errLog('vxe.error.reqProp', ['id'])
@@ -1619,18 +1627,18 @@ const Methods = {
1619
1627
  }
1620
1628
  }
1621
1629
  // 自定义顺序
1622
- if (isCustomOrder) {
1623
- const columnOrderStorage = getCustomStorageMap(orderStorageKey)[id]
1624
- if (columnOrderStorage) {
1625
- // const colOrderSeqs = columnOrderStorage.split(',')
1626
- // colOrderSeqs.forEach((orderConf) => {
1627
- // const [colKey, order] = orderConf.split('|')
1628
- // if (customMap[colKey]) {
1629
- // customMap[colKey].order = order
1630
- // } else {
1631
- // customMap[colKey] = { order }
1632
- // }
1633
- // })
1630
+ if (isCustomSort) {
1631
+ const columnSortStorage = getCustomStorageMap(sortStorageKey)[id]
1632
+ if (columnSortStorage) {
1633
+ const colOrderSeqs = columnSortStorage.split(',')
1634
+ colOrderSeqs.forEach((orderConf) => {
1635
+ const [colKey, sortNumber] = orderConf.split('|')
1636
+ if (customMap[colKey]) {
1637
+ customMap[colKey].sortNumber = sortNumber
1638
+ } else {
1639
+ customMap[colKey] = { sortNumber }
1640
+ }
1641
+ })
1634
1642
  }
1635
1643
  }
1636
1644
  if (isCustomVisible) {
@@ -1662,7 +1670,7 @@ const Methods = {
1662
1670
  keyMap[colKey] = column
1663
1671
  }
1664
1672
  })
1665
- XEUtils.each(customMap, ({ visible, resizeWidth, fixed, order }, field) => {
1673
+ XEUtils.each(customMap, ({ visible, resizeWidth, fixed, sortNumber }, field) => {
1666
1674
  const column = keyMap[field]
1667
1675
  if (column) {
1668
1676
  if (XEUtils.isNumber(resizeWidth)) {
@@ -1674,8 +1682,8 @@ const Methods = {
1674
1682
  if (fixed) {
1675
1683
  column.fixed = fixed
1676
1684
  }
1677
- if (order) {
1678
- column.colSeq = order
1685
+ if (sortNumber) {
1686
+ column.colSeq = Number(sortNumber)
1679
1687
  }
1680
1688
  }
1681
1689
  })
@@ -1684,8 +1692,9 @@ const Methods = {
1684
1692
  saveCustomFixed () {
1685
1693
  const { id, collectColumn, customConfig, customOpts } = this
1686
1694
  const { storage } = customOpts
1687
- const isAllStorage = customOpts.storage === true
1688
- const isCustomFixed = isAllStorage || (storage && storage.fixed)
1695
+ const isAllStorage = storage === true
1696
+ const storageOpts = isAllStorage ? {} : Object.assign({}, storage || {})
1697
+ const isCustomFixed = isAllStorage || storageOpts.fixed
1689
1698
  if (customConfig && isCustomFixed) {
1690
1699
  const columnFixedStorageMap = getCustomStorageMap(fixedStorageKey)
1691
1700
  const colFixeds = []
@@ -1708,8 +1717,9 @@ const Methods = {
1708
1717
  saveCustomVisible () {
1709
1718
  const { id, collectColumn, customConfig, customOpts } = this
1710
1719
  const { checkMethod, storage } = customOpts
1711
- const isAllStorage = customOpts.storage === true
1712
- const isCustomVisible = isAllStorage || (storage && storage.visible)
1720
+ const isAllStorage = storage === true
1721
+ const storageOpts = isAllStorage ? {} : Object.assign({}, storage || {})
1722
+ const isCustomVisible = isAllStorage || storageOpts.visible
1713
1723
  if (customConfig && isCustomVisible) {
1714
1724
  const columnVisibleStorageMap = getCustomStorageMap(visibleStorageKey)
1715
1725
  const colHides = []
@@ -1740,8 +1750,9 @@ const Methods = {
1740
1750
  saveCustomResizable (isReset) {
1741
1751
  const { id, collectColumn, customConfig, customOpts } = this
1742
1752
  const { storage } = customOpts
1743
- const isAllStorage = customOpts.storage === true
1744
- const isResizable = isAllStorage || (storage && storage.resizable)
1753
+ const isAllStorage = storage === true
1754
+ const storageOpts = isAllStorage ? {} : Object.assign({}, storage || {})
1755
+ const isResizable = isAllStorage || storageOpts.resizable
1745
1756
  if (customConfig && isResizable) {
1746
1757
  const columnWidthStorageMap = getCustomStorageMap(resizableStorageKey)
1747
1758
  let columnWidthStorage
@@ -1773,7 +1784,14 @@ const Methods = {
1773
1784
  /**
1774
1785
  * 刷新列配置
1775
1786
  */
1776
- refreshColumn () {
1787
+ refreshColumn (resiveOrder) {
1788
+ if (resiveOrder) {
1789
+ const columnList = XEUtils.orderBy(this.collectColumn, 'renderSortNumber')
1790
+ this.collectColumn = columnList
1791
+ const tableFullColumn = getColumnList(columnList)
1792
+ this.tableFullColumn = tableFullColumn
1793
+ this.cacheColumnMap()
1794
+ }
1777
1795
  return this.parseColumns().then(() => {
1778
1796
  return this.refreshScroll()
1779
1797
  }).then(() => {
@@ -340,6 +340,7 @@ export default {
340
340
  export: false,
341
341
  custom: false
342
342
  },
343
+ customColumnList: [],
343
344
  // 刷新列标识,当列筛选被改变时,触发表格刷新数据
344
345
  upDataFlag: 0,
345
346
  // 刷新列标识,当列的特定属性被改变时,触发表格刷新列
@@ -605,9 +606,9 @@ export default {
605
606
  return Object.assign({}, GlobalConfig.table.customConfig, this.customConfig)
606
607
  },
607
608
  fixedColumnSize () {
608
- const { tableFullColumn } = this
609
+ const { collectColumn } = this
609
610
  let fixedSize = 0
610
- tableFullColumn.forEach((column) => {
611
+ collectColumn.forEach((column) => {
611
612
  if (column.fixed) {
612
613
  fixedSize++
613
614
  }