vxe-table 3.4.15 → 3.5.0-beta.2

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 (168) hide show
  1. package/README.md +1 -1
  2. package/helper/vetur/attributes.json +30 -10
  3. package/helper/vetur/tags.json +7 -2
  4. package/lib/button/src/button.js +19 -9
  5. package/lib/button/src/button.min.js +1 -1
  6. package/lib/checkbox/src/checkbox.js +2 -2
  7. package/lib/checkbox/src/checkbox.min.js +1 -1
  8. package/lib/edit/src/mixin.js +26 -18
  9. package/lib/edit/src/mixin.min.js +1 -1
  10. package/lib/export/src/export-panel.js +2 -2
  11. package/lib/export/src/export-panel.min.js +1 -1
  12. package/lib/export/src/import-panel.js +2 -2
  13. package/lib/export/src/import-panel.min.js +1 -1
  14. package/lib/export/src/mixin.js +26 -24
  15. package/lib/export/src/mixin.min.js +1 -1
  16. package/lib/filter/src/mixin.js +4 -4
  17. package/lib/filter/src/mixin.min.js +1 -1
  18. package/lib/filter/src/panel.js +2 -2
  19. package/lib/filter/src/panel.min.js +1 -1
  20. package/lib/footer/src/footer.js +7 -4
  21. package/lib/footer/src/footer.min.js +1 -1
  22. package/lib/form/src/form-gather.js +2 -2
  23. package/lib/form/src/form-gather.min.js +1 -1
  24. package/lib/form/src/form-item.js +5 -5
  25. package/lib/form/src/form-item.min.js +1 -1
  26. package/lib/form/src/form.js +49 -64
  27. package/lib/form/src/form.min.js +1 -1
  28. package/lib/form/src/render.js +17 -14
  29. package/lib/form/src/render.min.js +1 -1
  30. package/lib/form/src/util.js +2 -2
  31. package/lib/form/src/util.min.js +1 -1
  32. package/lib/grid/src/grid.js +44 -34
  33. package/lib/grid/src/grid.min.js +1 -1
  34. package/lib/header/src/header.js +10 -8
  35. package/lib/header/src/header.min.js +1 -1
  36. package/lib/index.css +1 -1
  37. package/lib/index.umd.js +2390 -1553
  38. package/lib/index.umd.min.js +1 -2
  39. package/lib/input/src/input.js +30 -18
  40. package/lib/input/src/input.min.js +1 -1
  41. package/lib/keyboard/src/mixin.js +12 -8
  42. package/lib/keyboard/src/mixin.min.js +1 -1
  43. package/lib/list/src/list.js +7 -5
  44. package/lib/list/src/list.min.js +1 -1
  45. package/lib/menu/src/mixin.js +24 -14
  46. package/lib/menu/src/mixin.min.js +1 -1
  47. package/lib/menu/src/panel.js +3 -3
  48. package/lib/menu/src/panel.min.js +1 -1
  49. package/lib/modal/src/modal.js +24 -12
  50. package/lib/modal/src/modal.min.js +1 -1
  51. package/lib/pulldown/src/pulldown.js +16 -12
  52. package/lib/pulldown/src/pulldown.min.js +1 -1
  53. package/lib/radio/src/button.js +2 -2
  54. package/lib/radio/src/button.min.js +1 -1
  55. package/lib/radio/src/radio.js +2 -2
  56. package/lib/radio/src/radio.min.js +1 -1
  57. package/lib/select/src/select.js +42 -21
  58. package/lib/select/src/select.min.js +1 -1
  59. package/lib/select/style/style.css +1 -1
  60. package/lib/select/style/style.min.css +1 -1
  61. package/lib/style.css +1 -1
  62. package/lib/style.min.css +1 -1
  63. package/lib/switch/src/switch.js +4 -4
  64. package/lib/switch/src/switch.min.js +1 -1
  65. package/lib/table/src/body.js +34 -36
  66. package/lib/table/src/body.min.js +1 -1
  67. package/lib/table/src/cell.js +22 -14
  68. package/lib/table/src/cell.min.js +1 -1
  69. package/lib/table/src/column.js +6 -4
  70. package/lib/table/src/column.min.js +1 -1
  71. package/lib/table/src/columnInfo.js +202 -0
  72. package/lib/table/src/columnInfo.min.js +1 -0
  73. package/lib/table/src/methods.js +247 -263
  74. package/lib/table/src/methods.min.js +1 -1
  75. package/lib/table/src/table.js +104 -129
  76. package/lib/table/src/table.min.js +1 -1
  77. package/lib/table/src/util.js +52 -3
  78. package/lib/table/src/util.min.js +1 -1
  79. package/lib/textarea/src/textarea.js +2 -2
  80. package/lib/textarea/src/textarea.min.js +1 -1
  81. package/lib/toolbar/src/toolbar.js +16 -10
  82. package/lib/toolbar/src/toolbar.min.js +1 -1
  83. package/lib/tools/{src/dom.js → dom.js} +0 -0
  84. package/lib/tools/{src/dom.min.js → dom.min.js} +0 -0
  85. package/lib/tools/{src/event.js → event.js} +3 -6
  86. package/lib/tools/event.min.js +1 -0
  87. package/lib/tools/log.js +29 -0
  88. package/lib/tools/log.min.js +1 -0
  89. package/lib/tools/{src/resize.js → resize.js} +1 -1
  90. package/lib/tools/resize.min.js +1 -0
  91. package/lib/tools/utils.js +142 -0
  92. package/lib/tools/utils.min.js +1 -0
  93. package/lib/tooltip/src/tooltip.js +59 -34
  94. package/lib/tooltip/src/tooltip.min.js +1 -1
  95. package/lib/tooltip/style/style.css +1 -1
  96. package/lib/tooltip/style/style.min.css +1 -1
  97. package/lib/v-x-e-table/index.js +7 -4
  98. package/lib/v-x-e-table/index.min.js +1 -1
  99. package/lib/v-x-e-table/src/conf.js +14 -7
  100. package/lib/v-x-e-table/src/conf.min.js +1 -1
  101. package/lib/v-x-e-table/src/interceptor.js +4 -4
  102. package/lib/v-x-e-table/src/interceptor.min.js +1 -1
  103. package/lib/v-x-e-table/src/renderer.js +18 -10
  104. package/lib/v-x-e-table/src/renderer.min.js +1 -1
  105. package/lib/v-x-e-table/src/store.js +3 -3
  106. package/lib/v-x-e-table/src/store.min.js +1 -1
  107. package/lib/validator/src/mixin.js +4 -4
  108. package/lib/validator/src/mixin.min.js +1 -1
  109. package/package.json +1 -1
  110. package/packages/button/src/button.js +4 -2
  111. package/packages/checkbox/src/checkbox.js +2 -2
  112. package/packages/edit/src/mixin.js +7 -6
  113. package/packages/export/src/export-panel.js +1 -1
  114. package/packages/export/src/import-panel.js +1 -1
  115. package/packages/export/src/mixin.js +20 -19
  116. package/packages/filter/src/mixin.js +3 -3
  117. package/packages/filter/src/panel.js +1 -1
  118. package/packages/footer/src/footer.js +4 -2
  119. package/packages/form/src/form-gather.js +2 -2
  120. package/packages/form/src/form-item.js +4 -4
  121. package/packages/form/src/form.js +19 -32
  122. package/packages/form/src/render.js +9 -9
  123. package/packages/form/src/util.js +2 -2
  124. package/packages/grid/src/grid.js +22 -20
  125. package/packages/header/src/header.js +3 -2
  126. package/packages/input/src/input.js +6 -3
  127. package/packages/keyboard/src/mixin.js +1 -2
  128. package/packages/list/src/list.js +3 -2
  129. package/packages/menu/src/mixin.js +5 -3
  130. package/packages/menu/src/panel.js +3 -3
  131. package/packages/modal/src/modal.js +7 -4
  132. package/packages/pulldown/src/pulldown.js +3 -1
  133. package/packages/radio/src/button.js +2 -2
  134. package/packages/radio/src/radio.js +2 -2
  135. package/packages/select/src/select.js +19 -8
  136. package/packages/switch/src/switch.js +4 -4
  137. package/packages/table/src/body.js +26 -25
  138. package/packages/table/src/cell.js +8 -7
  139. package/packages/table/src/column.js +4 -2
  140. package/packages/table/src/columnInfo.js +149 -0
  141. package/packages/table/src/methods.js +73 -95
  142. package/packages/table/src/table.js +73 -103
  143. package/packages/table/src/util.js +30 -1
  144. package/packages/textarea/src/textarea.js +2 -2
  145. package/packages/toolbar/src/toolbar.js +7 -4
  146. package/packages/tools/{src/dom.js → dom.js} +0 -0
  147. package/packages/tools/{src/event.js → event.js} +1 -3
  148. package/packages/tools/log.js +16 -0
  149. package/packages/tools/{src/resize.js → resize.js} +1 -1
  150. package/packages/tools/utils.js +97 -0
  151. package/packages/tooltip/src/tooltip.js +46 -26
  152. package/packages/v-x-e-table/index.js +4 -2
  153. package/packages/v-x-e-table/src/conf.js +14 -7
  154. package/packages/v-x-e-table/src/interceptor.js +3 -3
  155. package/packages/v-x-e-table/src/renderer.js +4 -3
  156. package/packages/v-x-e-table/src/store.js +2 -2
  157. package/packages/validator/src/mixin.js +3 -3
  158. package/styles/select.scss +1 -1
  159. package/styles/tooltip.scss +1 -1
  160. package/types/v-x-e-table/index.d.ts +8 -0
  161. package/lib/tools/index.js +0 -76
  162. package/lib/tools/index.min.js +0 -1
  163. package/lib/tools/src/event.min.js +0 -1
  164. package/lib/tools/src/resize.min.js +0 -1
  165. package/lib/tools/src/utils.js +0 -365
  166. package/lib/tools/src/utils.min.js +0 -1
  167. package/packages/tools/index.js +0 -14
  168. package/packages/tools/src/utils.js +0 -272
@@ -3,8 +3,11 @@ import GlobalConfig from '../../v-x-e-table/src/conf'
3
3
  import VXETable from '../../v-x-e-table'
4
4
  import VxeTableBody from './body'
5
5
  import vSize from '../../mixins/size'
6
- import { UtilTools, GlobalEvent, createResizeEvent, isEnableConf } from '../../tools'
6
+ import { isEnableConf, getFuncText } from '../../tools/utils'
7
+ import { createResizeEvent } from '../../tools/resize'
8
+ import { GlobalEvent } from '../../tools/event'
7
9
  import methods from './methods'
10
+ import { warnLog, errLog } from '../../tools/log'
8
11
 
9
12
  /**
10
13
  * 渲染浮固定列
@@ -67,7 +70,7 @@ function renderEmptyContenet (h, _vm) {
67
70
  if (renderEmpty) {
68
71
  emptyContent = renderEmpty.call(_vm, h, emptyOpts, params)
69
72
  } else {
70
- emptyContent = UtilTools.getFuncText(_vm.emptyText) || GlobalConfig.i18n('vxe.table.emptyText')
73
+ emptyContent = getFuncText(_vm.emptyText) || GlobalConfig.i18n('vxe.table.emptyText')
71
74
  }
72
75
  }
73
76
  return emptyContent
@@ -92,7 +95,7 @@ export default {
92
95
  height: [Number, String],
93
96
  // 表格的最大高度
94
97
  maxHeight: [Number, String],
95
- // 所有列是否允许拖动列宽调整大小
98
+ // 已废弃,被 column-config.resizable 替换
96
99
  resizable: { type: Boolean, default: () => GlobalConfig.table.resizable },
97
100
  // 是否带有斑马纹
98
101
  stripe: { type: Boolean, default: () => GlobalConfig.table.stripe },
@@ -114,15 +117,15 @@ export default {
114
117
  footerAlign: { type: String, default: () => GlobalConfig.table.footerAlign },
115
118
  // 是否显示表头
116
119
  showHeader: { type: Boolean, default: () => GlobalConfig.table.showHeader },
117
- // (即将废弃)是否要高亮当前选中行
120
+ // 已废弃,被 row-config.isCurrent 替换
118
121
  highlightCurrentRow: { type: Boolean, default: () => GlobalConfig.table.highlightCurrentRow },
119
- // (即将废弃)鼠标移到行是否要高亮显示
122
+ // 已废弃,被 row-config.isHover 替换
120
123
  highlightHoverRow: { type: Boolean, default: () => GlobalConfig.table.highlightHoverRow },
121
- // (即将废弃)是否要高亮当前选中列
124
+ // 已废弃,被 column-config.isCurrent 替换
122
125
  highlightCurrentColumn: { type: Boolean, default: () => GlobalConfig.table.highlightCurrentColumn },
123
- // (即将废弃)鼠标移到列是否要高亮显示
126
+ // 已废弃,被 column-config.isHover 替换
124
127
  highlightHoverColumn: { type: Boolean, default: () => GlobalConfig.table.highlightHoverColumn },
125
- // (即将废弃)激活单元格编辑时是否高亮显示
128
+ // 已废弃,直接删除
126
129
  highlightCell: Boolean,
127
130
  // 是否显示表尾合计
128
131
  showFooter: Boolean,
@@ -168,9 +171,11 @@ export default {
168
171
  showFooterOverflow: { type: [Boolean, String], default: () => GlobalConfig.table.showFooterOverflow },
169
172
 
170
173
  /** 高级属性 */
171
- // 主键配置
174
+ // (即将废弃)columnKey 已废弃,被 column-config.useKey 替换
172
175
  columnKey: Boolean,
176
+ // (即将废弃)rowKey 已废弃,被 row-config.useKey 替换
173
177
  rowKey: Boolean,
178
+ // (即将废弃)rowId 已废弃,被 row-config.keyField 替换
174
179
  rowId: { type: String, default: () => GlobalConfig.table.rowId },
175
180
  zIndex: Number,
176
181
  emptyText: { type: String, default: () => GlobalConfig.table.emptyText },
@@ -237,6 +242,7 @@ export default {
237
242
  scrollY: Object,
238
243
  // (即将废弃)优化相关
239
244
  animat: { type: Boolean, default: () => GlobalConfig.table.animat },
245
+ // (可能会被废弃的参数,不要使用)
240
246
  delayHover: { type: Number, default: () => GlobalConfig.table.delayHover },
241
247
  // 额外的参数
242
248
  params: Object
@@ -383,6 +389,13 @@ export default {
383
389
  insertList: [],
384
390
  removeList: []
385
391
  },
392
+ // 存放 tooltip 相关信息
393
+ tooltipStore: {
394
+ row: null,
395
+ column: null,
396
+ visible: false,
397
+ currOpts: null
398
+ },
386
399
  // 存放数据校验相关信息
387
400
  validStore: {
388
401
  visible: false,
@@ -474,11 +487,10 @@ export default {
474
487
  return Object.assign({}, GlobalConfig.table.checkboxConfig, this.checkboxConfig)
475
488
  },
476
489
  tooltipOpts () {
477
- const opts = Object.assign({ leaveDelay: 300 }, GlobalConfig.table.tooltipConfig, this.tooltipConfig)
478
- if (opts.enterable) {
479
- opts.leaveMethod = this.handleTooltipLeaveMethod
480
- }
481
- return opts
490
+ return Object.assign({}, GlobalConfig.tooltip, GlobalConfig.table.tooltipConfig, this.tooltipConfig)
491
+ },
492
+ tipConfig () {
493
+ return { ...this.tooltipOpts, ...this.tooltipStore.currOpts }
482
494
  },
483
495
  validTipOpts () {
484
496
  return Object.assign({ isArrow: false }, this.tooltipOpts)
@@ -592,54 +604,6 @@ export default {
592
604
  }
593
605
  return false
594
606
  }
595
- // isMergeLeftFixedExceeded () {
596
- // const { mergeList, columnStore, visibleColumn } = this
597
- // const { leftList } = columnStore
598
- // const lastFCIndex = visibleColumn.indexOf(leftList[leftList.length - 1])
599
- // for (let i = 0, len = mergeList.length; i < len; i++) {
600
- // const item = mergeList[i]
601
- // if (item.col <= lastFCIndex && item.col + item.colspan > lastFCIndex) {
602
- // return true
603
- // }
604
- // }
605
- // return false
606
- // },
607
- // isMergeRightFixedExceeded () {
608
- // const { mergeList, columnStore, visibleColumn } = this
609
- // const { rightList } = columnStore
610
- // const firstFCIndex = visibleColumn.indexOf(rightList[0])
611
- // for (let i = 0, len = mergeList.length; i < len; i++) {
612
- // const item = mergeList[i]
613
- // if (item.col < firstFCIndex && item.col + item.colspan >= firstFCIndex) {
614
- // return true
615
- // }
616
- // }
617
- // return false
618
- // },
619
- // isMergeFooterLeftFixedExceeded () {
620
- // const { mergeFooterList, columnStore, visibleColumn } = this
621
- // const { leftList } = columnStore
622
- // const lastFCIndex = visibleColumn.indexOf(leftList[leftList.length - 1])
623
- // for (let i = 0, len = mergeFooterList.length; i < len; i++) {
624
- // const item = mergeFooterList[i]
625
- // if (item.col <= lastFCIndex && item.col + item.colspan > lastFCIndex) {
626
- // return true
627
- // }
628
- // }
629
- // return false
630
- // },
631
- // isMergeFooterRightFixedExceeded () {
632
- // const { mergeFooterList, columnStore, visibleColumn } = this
633
- // const { rightList } = columnStore
634
- // const firstFCIndex = visibleColumn.indexOf(rightList[0])
635
- // for (let i = 0, len = mergeFooterList.length; i < len; i++) {
636
- // const item = mergeFooterList[i]
637
- // if (item.col < firstFCIndex && item.col + item.colspan >= firstFCIndex) {
638
- // return true
639
- // }
640
- // }
641
- // return false
642
- // }
643
607
  },
644
608
  watch: {
645
609
  data (value) {
@@ -654,7 +618,7 @@ export default {
654
618
  this.handleInitDefaults()
655
619
  }
656
620
  if ((this.scrollXLoad || this.scrollYLoad) && this.expandColumn) {
657
- UtilTools.warn('vxe.error.scrollErrProp', ['column.type=expand'])
621
+ warnLog('vxe.error.scrollErrProp', ['column.type=expand'])
658
622
  }
659
623
  this.recalculate()
660
624
  })
@@ -700,15 +664,13 @@ export default {
700
664
  }
701
665
  },
702
666
  created () {
703
- const { scrollXStore, sYOpts, scrollYStore, data, editOpts, treeOpts, treeConfig, showOverflow } = Object.assign(this, {
667
+ const { scrollXStore, sYOpts, scrollYStore, data, editOpts, treeOpts, treeConfig, showOverflow, rowOpts } = Object.assign(this, {
704
668
  tZindex: 0,
705
669
  elemStore: {},
706
670
  // 存放横向 X 虚拟滚动相关的信息
707
671
  scrollXStore: {},
708
672
  // 存放纵向 Y 虚拟滚动相关信息
709
673
  scrollYStore: {},
710
- // 存放 tooltip 相关信息
711
- tooltipStore: {},
712
674
  // 表格宽度
713
675
  tableWidth: 0,
714
676
  // 表格高度
@@ -750,65 +712,74 @@ export default {
750
712
  })
751
713
 
752
714
  if (process.env.VUE_APP_VXE_TABLE_ENV === 'development') {
753
- if (!this.rowId && (this.checkboxOpts.reserve || this.checkboxOpts.checkRowKeys || this.radioOpts.reserve || this.radioOpts.checkRowKey || this.expandOpts.expandRowKeys || this.treeOpts.expandRowKeys)) {
754
- UtilTools.warn('vxe.error.reqProp', ['row-id'])
715
+ // if (this.rowId) {
716
+ // warnLog('vxe.error.delProp', ['rowId', 'row-config.keyField'])
717
+ // }
718
+ // if (this.rowKey) {
719
+ // warnLog('vxe.error.delProp', ['rowId', 'row-config.useKey'])
720
+ // }
721
+ // if (this.columnKey) {
722
+ // warnLog('vxe.error.delProp', ['rowId', 'column-config.useKey'])
723
+ // }
724
+ if (!(this.rowId || rowOpts.keyField) && (this.checkboxOpts.reserve || this.checkboxOpts.checkRowKeys || this.radioOpts.reserve || this.radioOpts.checkRowKey || this.expandOpts.expandRowKeys || this.treeOpts.expandRowKeys)) {
725
+ warnLog('vxe.error.reqProp', ['row-config.keyField'])
755
726
  }
756
727
  if (this.editConfig && editOpts.showStatus && !this.keepSource) {
757
- UtilTools.warn('vxe.error.reqProp', ['keep-source'])
728
+ warnLog('vxe.error.reqProp', ['keep-source'])
758
729
  }
759
- if (treeConfig && treeOpts.line && (!this.rowKey || !showOverflow)) {
760
- UtilTools.warn('vxe.error.reqProp', ['row-key | show-overflow'])
730
+ if (treeConfig && treeOpts.line && (!(this.rowKey || rowOpts.useKey) || !showOverflow)) {
731
+ warnLog('vxe.error.reqProp', ['row-config.useKey | show-overflow'])
761
732
  }
762
733
  if (this.showFooter && !this.footerMethod) {
763
- UtilTools.warn('vxe.error.reqProp', ['footer-method'])
734
+ warnLog('vxe.error.reqProp', ['footer-method'])
764
735
  }
765
736
  if (treeConfig && this.stripe) {
766
- UtilTools.warn('vxe.error.noTree', ['stripe'])
737
+ warnLog('vxe.error.noTree', ['stripe'])
767
738
  }
768
739
  if (this.tooltipOpts.enabled) {
769
- UtilTools.warn('vxe.error.delProp', ['tooltip-config.enabled', 'tooltip-config.showAll'])
740
+ warnLog('vxe.error.delProp', ['tooltip-config.enabled', 'tooltip-config.showAll'])
770
741
  }
771
742
  // 检查导入导出类型,如果自定义导入导出方法,则不校验类型
772
743
  const { exportConfig, exportOpts, importConfig, importOpts } = this
773
744
  if (importConfig && importOpts.types && !importOpts.importMethod && !XEUtils.includeArrays(VXETable.config.importTypes, importOpts.types)) {
774
- UtilTools.warn('vxe.error.errProp', [`export-config.types=${importOpts.types.join(',')}`, importOpts.types.filter(type => XEUtils.includes(VXETable.config.importTypes, type)).join(',') || VXETable.config.importTypes.join(',')])
745
+ warnLog('vxe.error.errProp', [`export-config.types=${importOpts.types.join(',')}`, importOpts.types.filter(type => XEUtils.includes(VXETable.config.importTypes, type)).join(',') || VXETable.config.importTypes.join(',')])
775
746
  }
776
747
  if (exportConfig && exportOpts.types && !exportOpts.exportMethod && !XEUtils.includeArrays(VXETable.config.exportTypes, exportOpts.types)) {
777
- UtilTools.warn('vxe.error.errProp', [`export-config.types=${exportOpts.types.join(',')}`, exportOpts.types.filter(type => XEUtils.includes(VXETable.config.exportTypes, type)).join(',') || VXETable.config.exportTypes.join(',')])
748
+ warnLog('vxe.error.errProp', [`export-config.types=${exportOpts.types.join(',')}`, exportOpts.types.filter(type => XEUtils.includes(VXETable.config.exportTypes, type)).join(',') || VXETable.config.exportTypes.join(',')])
778
749
  }
779
750
  }
780
751
 
781
752
  if (process.env.VUE_APP_VXE_TABLE_ENV === 'development') {
782
753
  const customOpts = this.customOpts
783
754
  if (!this.id && this.customConfig && (customOpts.storage === true || (customOpts.storage && customOpts.storage.resizable) || (customOpts.storage && customOpts.storage.visible))) {
784
- UtilTools.error('vxe.error.reqProp', ['id'])
755
+ errLog('vxe.error.reqProp', ['id'])
785
756
  }
786
757
  if (this.treeConfig && this.checkboxOpts.range) {
787
- UtilTools.error('vxe.error.noTree', ['checkbox-config.range'])
758
+ errLog('vxe.error.noTree', ['checkbox-config.range'])
788
759
  }
789
760
  if (this.rowOpts.height && !this.showOverflow) {
790
- UtilTools.warn('vxe.error.notProp', ['table.show-overflow'])
761
+ warnLog('vxe.error.notProp', ['table.show-overflow'])
791
762
  }
792
763
  if (!this.handleUpdateCellAreas) {
793
764
  if (this.clipConfig) {
794
- UtilTools.warn('vxe.error.notProp', ['clip-config'])
765
+ warnLog('vxe.error.notProp', ['clip-config'])
795
766
  }
796
767
  if (this.fnrConfig) {
797
- UtilTools.warn('vxe.error.notProp', ['fnr-config'])
768
+ warnLog('vxe.error.notProp', ['fnr-config'])
798
769
  }
799
770
  if (this.mouseOpts.area) {
800
- UtilTools.error('vxe.error.notProp', ['mouse-config.area'])
771
+ errLog('vxe.error.notProp', ['mouse-config.area'])
801
772
  return
802
773
  }
803
774
  }
804
775
  if (this.mouseOpts.area && this.mouseOpts.selected) {
805
- UtilTools.warn('vxe.error.errConflicts', ['mouse-config.area', 'mouse-config.selected'])
776
+ warnLog('vxe.error.errConflicts', ['mouse-config.area', 'mouse-config.selected'])
806
777
  }
807
778
  if (this.mouseOpts.area && this.checkboxOpts.range) {
808
- UtilTools.warn('vxe.error.errConflicts', ['mouse-config.area', 'checkbox-config.range'])
779
+ warnLog('vxe.error.errConflicts', ['mouse-config.area', 'checkbox-config.range'])
809
780
  }
810
781
  if (this.treeConfig && this.mouseOpts.area) {
811
- UtilTools.error('vxe.error.noTree', ['mouse-config.area'])
782
+ errLog('vxe.error.noTree', ['mouse-config.area'])
812
783
  }
813
784
  }
814
785
 
@@ -816,50 +787,50 @@ export default {
816
787
  if (process.env.VUE_APP_VXE_TABLE_ENV === 'development') {
817
788
  // 在 v3.0 中废弃 context-menu
818
789
  if (this.contextMenu) {
819
- UtilTools.warn('vxe.error.delProp', ['context-menu', 'menu-config'])
790
+ warnLog('vxe.error.delProp', ['context-menu', 'menu-config'])
820
791
  if (!XEUtils.isObject(this.contextMenu)) {
821
- UtilTools.warn('vxe.error.errProp', [`table.context-menu=${this.contextMenu}`, 'table.context-menu={}'])
792
+ warnLog('vxe.error.errProp', [`table.context-menu=${this.contextMenu}`, 'table.context-menu={}'])
822
793
  }
823
794
  }
824
795
  if (this.menuConfig && !XEUtils.isObject(this.menuConfig)) {
825
- UtilTools.warn('vxe.error.errProp', [`table.menu-config=${this.menuConfig}`, 'table.menu-config={}'])
796
+ warnLog('vxe.error.errProp', [`table.menu-config=${this.menuConfig}`, 'table.menu-config={}'])
826
797
  }
827
798
  if (this.exportConfig && !XEUtils.isObject(this.exportConfig)) {
828
- UtilTools.warn('vxe.error.errProp', [`table.export-config=${this.exportConfig}`, 'table.export-config={}'])
799
+ warnLog('vxe.error.errProp', [`table.export-config=${this.exportConfig}`, 'table.export-config={}'])
829
800
  }
830
801
  if (this.importConfig && !XEUtils.isObject(this.importConfig)) {
831
- UtilTools.warn('vxe.error.errProp', [`table.import-config=${this.importConfig}`, 'table.import-config={}'])
802
+ warnLog('vxe.error.errProp', [`table.import-config=${this.importConfig}`, 'table.import-config={}'])
832
803
  }
833
804
  if (this.printConfig && !XEUtils.isObject(this.printConfig)) {
834
- UtilTools.warn('vxe.error.errProp', [`table.print-config=${this.printConfig}`, 'table.print-config={}'])
805
+ warnLog('vxe.error.errProp', [`table.print-config=${this.printConfig}`, 'table.print-config={}'])
835
806
  }
836
807
  if (this.treeConfig && !XEUtils.isObject(this.treeConfig)) {
837
- UtilTools.warn('vxe.error.errProp', [`table.tree-config=${this.treeConfig}`, 'table.tree-config={}'])
808
+ warnLog('vxe.error.errProp', [`table.tree-config=${this.treeConfig}`, 'table.tree-config={}'])
838
809
  }
839
810
  if (this.customConfig && !XEUtils.isObject(this.customConfig)) {
840
- UtilTools.warn('vxe.error.errProp', [`table.custom-config=${this.customConfig}`, 'table.custom-config={}'])
811
+ warnLog('vxe.error.errProp', [`table.custom-config=${this.customConfig}`, 'table.custom-config={}'])
841
812
  }
842
813
  if (this.editConfig && !XEUtils.isObject(this.editConfig)) {
843
- UtilTools.warn('vxe.error.errProp', [`table.edit-config=${this.editConfig}`, 'table.edit-config={}'])
814
+ warnLog('vxe.error.errProp', [`table.edit-config=${this.editConfig}`, 'table.edit-config={}'])
844
815
  }
845
816
  if (this.emptyRender && !XEUtils.isObject(this.emptyRender)) {
846
- UtilTools.warn('vxe.error.errProp', [`table.empty-render=${this.emptyRender}`, 'table.empty-render={}'])
817
+ warnLog('vxe.error.errProp', [`table.empty-render=${this.emptyRender}`, 'table.empty-render={}'])
847
818
  }
848
819
  }
849
820
 
850
821
  // 检查是否有安装需要的模块
851
822
  if (process.env.VUE_APP_VXE_TABLE_ENV === 'development') {
852
823
  if (this.editConfig && !this._insert) {
853
- UtilTools.error('vxe.error.reqModule', ['Edit'])
824
+ errLog('vxe.error.reqModule', ['Edit'])
854
825
  }
855
826
  if (this.editRules && !this._validate) {
856
- UtilTools.error('vxe.error.reqModule', ['Validator'])
827
+ errLog('vxe.error.reqModule', ['Validator'])
857
828
  }
858
829
  if ((this.checkboxOpts.range || this.keyboardConfig || this.mouseConfig) && !this.triggerCellMousedownEvent) {
859
- UtilTools.error('vxe.error.reqModule', ['Keyboard'])
830
+ errLog('vxe.error.reqModule', ['Keyboard'])
860
831
  }
861
832
  if ((this.printConfig || this.importConfig || this.exportConfig) && !this._exportData) {
862
- UtilTools.error('vxe.error.reqModule', ['Export'])
833
+ errLog('vxe.error.reqModule', ['Export'])
863
834
  }
864
835
  }
865
836
 
@@ -898,10 +869,10 @@ export default {
898
869
  if (process.env.VUE_APP_VXE_TABLE_ENV === 'development') {
899
870
  const { $listeners } = this
900
871
  if (!this.menuConfig && ($listeners['menu-click'] || $listeners['cell-menu'] || $listeners['header-cell-menu'] || $listeners['footer-cell-menu'])) {
901
- UtilTools.warn('vxe.error.reqProp', ['menu-config'])
872
+ warnLog('vxe.error.reqProp', ['menu-config'])
902
873
  }
903
874
  if (!this.tooltipConfig && ($listeners['cell-mouseenter'] || $listeners['cell-mouseleave'])) {
904
- UtilTools.warn('vxe.error.reqProp', ['tooltip-config'])
875
+ warnLog('vxe.error.reqProp', ['tooltip-config'])
905
876
  }
906
877
  }
907
878
  if (this.autoResize) {
@@ -969,7 +940,6 @@ export default {
969
940
  highlightHoverColumn,
970
941
  editConfig,
971
942
  validTipOpts,
972
- tooltipOpts,
973
943
  initStore,
974
944
  columnStore,
975
945
  filterStore,
@@ -1161,7 +1131,7 @@ export default {
1161
1131
  */
1162
1132
  hasTip ? h('vxe-tooltip', {
1163
1133
  ref: 'tooltip',
1164
- props: tooltipOpts
1134
+ props: this.tipConfig
1165
1135
  }) : _e(),
1166
1136
  /**
1167
1137
  * 校验提示
@@ -1,6 +1,7 @@
1
1
  import VXETable from '../../v-x-e-table'
2
2
  import XEUtils from 'xe-utils'
3
- import { DomTools } from '../../tools'
3
+ import { ColumnInfo } from './columnInfo'
4
+ import DomTools from '../../tools/dom'
4
5
 
5
6
  const lineOffsetSizes = {
6
7
  mini: 3,
@@ -36,6 +37,17 @@ export function restoreScrollListener (scrollElem) {
36
37
  }
37
38
  }
38
39
 
40
+ // 行主键 key
41
+ export function getRowkey ($xetable) {
42
+ return $xetable.rowOpts.keyField || $xetable.rowId || '_X_ROW_KEY'
43
+ }
44
+
45
+ // 行主键 value
46
+ export function getRowid ($xetable, row) {
47
+ const rowid = XEUtils.get(row, getRowkey($xetable))
48
+ return XEUtils.eqNull(rowid) ? '' : encodeURIComponent(rowid)
49
+ }
50
+
39
51
  function getPaddingLeftRightSize (elem) {
40
52
  if (elem) {
41
53
  const computedStyle = getComputedStyle(elem)
@@ -67,6 +79,15 @@ function queryCellElement (cell, selector) {
67
79
  return cell.querySelector('.vxe-cell' + selector)
68
80
  }
69
81
 
82
+ export function toFilters (filters) {
83
+ if (filters && XEUtils.isArray(filters)) {
84
+ return filters.map(({ label, value, data, resetValue, checked }) => {
85
+ return { label, value, data, resetValue, checked: !!checked, _checked: !!checked }
86
+ })
87
+ }
88
+ return filters
89
+ }
90
+
70
91
  export function getColMinWidth (params) {
71
92
  const { $table, column, cell } = params
72
93
  const { showHeaderOverflow: allColumnHeaderOverflow, resizableOpts } = $table
@@ -187,3 +208,11 @@ export function clearTableAllStatus (_vm) {
187
208
  }
188
209
  return clearTableDefaultStatus(_vm)
189
210
  }
211
+
212
+ export function isColumnInfo (column) {
213
+ return column instanceof ColumnInfo
214
+ }
215
+
216
+ export function getColumnConfig ($xetable, _vm, options) {
217
+ return isColumnInfo(_vm) ? _vm : new ColumnInfo($xetable, _vm, options)
218
+ }
@@ -1,7 +1,7 @@
1
1
  import XEUtils from 'xe-utils'
2
2
  import GlobalConfig from '../../v-x-e-table/src/conf'
3
3
  import vSize from '../../mixins/size'
4
- import { UtilTools } from '../../tools'
4
+ import { getFuncText } from '../../tools/utils'
5
5
 
6
6
  let autoTxtElem
7
7
 
@@ -84,7 +84,7 @@ export default {
84
84
  cols
85
85
  }
86
86
  if (placeholder) {
87
- attrs.placeholder = UtilTools.getFuncText(placeholder)
87
+ attrs.placeholder = getFuncText(placeholder)
88
88
  }
89
89
  return h('div', {
90
90
  class: ['vxe-textarea', className, {
@@ -2,7 +2,10 @@ import XEUtils from 'xe-utils'
2
2
  import GlobalConfig from '../../v-x-e-table/src/conf'
3
3
  import VXETable from '../../v-x-e-table'
4
4
  import vSize from '../../mixins/size'
5
- import { UtilTools, DomTools, GlobalEvent } from '../../tools'
5
+ import UtilTools from '../../tools/utils'
6
+ import DomTools from '../../tools/dom'
7
+ import { GlobalEvent } from '../../tools/event'
8
+ import { warnLog, errLog } from '../../tools/log'
6
9
 
7
10
  const renderDropdowns = (h, _vm, item, isBtn) => {
8
11
  const { _e } = _vm
@@ -313,7 +316,7 @@ export default {
313
316
  this.$nextTick(() => {
314
317
  const $xetable = this.fintTable()
315
318
  if (refresh && !this.$xegrid && !refreshOpts.query) {
316
- UtilTools.warn('vxe.error.notFunc', ['query'])
319
+ warnLog('vxe.error.notFunc', ['query'])
317
320
  }
318
321
  if ($xetable) {
319
322
  $xetable.connect(this)
@@ -324,7 +327,7 @@ export default {
324
327
  const { buttonRender } = item
325
328
  const compConf = buttonRender ? VXETable.renderer.get(buttonRender.name) : null
326
329
  if (compConf && compConf.renderButton) {
327
- UtilTools.warn('vxe.error.delFunc', ['renderButton', 'renderToolbarButton'])
330
+ warnLog('vxe.error.delFunc', ['renderButton', 'renderToolbarButton'])
328
331
  }
329
332
  })
330
333
  }
@@ -434,7 +437,7 @@ export default {
434
437
  if (this.$xetable) {
435
438
  return true
436
439
  }
437
- UtilTools.error('vxe.error.barUnableLink')
440
+ errLog('vxe.error.barUnableLink')
438
441
  },
439
442
  showCustom () {
440
443
  this.customStore.visible = true
File without changes
@@ -1,5 +1,5 @@
1
1
  import XEUtils from 'xe-utils'
2
- import { browse } from '../../tools/src/dom'
2
+ import { browse } from './dom'
3
3
 
4
4
  export const EVENT_KEYS = {
5
5
  F2: 'F2',
@@ -80,5 +80,3 @@ if (browse.isDoc) {
80
80
  window.addEventListener('resize', GlobalEvent.trigger, false)
81
81
  window.addEventListener(wheelName, XEUtils.throttle(GlobalEvent.trigger, 100, { leading: true, trailing: false }), false)
82
82
  }
83
-
84
- export default GlobalEvent
@@ -0,0 +1,16 @@
1
+ import GlobalConfig from '../v-x-e-table/src/conf'
2
+
3
+ export function getLog (message, params) {
4
+ return `[vxe-table v${process.env.VUE_APP_VXE_TABLE_VERSION}] ${GlobalConfig.i18n(message, params)}`
5
+ }
6
+
7
+ function outLog (type) {
8
+ return function (message, params) {
9
+ const msg = getLog(message, params)
10
+ console[type](msg)
11
+ return msg
12
+ }
13
+ }
14
+
15
+ export const warnLog = outLog('warn')
16
+ export const errLog = outLog('error')
@@ -1,5 +1,5 @@
1
1
  import XEUtils from 'xe-utils'
2
- import GlobalConfig from '../../v-x-e-table/src/conf'
2
+ import GlobalConfig from '../v-x-e-table/src/conf'
3
3
 
4
4
  /**
5
5
  * 监听 resize 事件
@@ -0,0 +1,97 @@
1
+ import XEUtils from 'xe-utils'
2
+ import GlobalConfig from '../v-x-e-table/src/conf'
3
+ import { warnLog, errLog } from '../tools/log'
4
+
5
+ let zindexIndex = 0
6
+ let lastZindex = 1
7
+
8
+ export function isEnableConf (conf) {
9
+ return conf && conf.enabled !== false
10
+ }
11
+
12
+ /**
13
+ * 判断值为:'' | null | undefined 时都属于空值
14
+ */
15
+ export function eqEmptyValue (cellValue) {
16
+ return cellValue === '' || XEUtils.eqNull(cellValue)
17
+ }
18
+
19
+ export function getFuncText (content) {
20
+ return XEUtils.isFunction(content) ? content() : (GlobalConfig.translate ? GlobalConfig.translate(content) : content)
21
+ }
22
+
23
+ // 获取所有的列,排除分组
24
+ export function getColumnList (columns) {
25
+ const result = []
26
+ columns.forEach(column => {
27
+ result.push(...(column.children && column.children.length ? getColumnList(column.children) : [column]))
28
+ })
29
+ return result
30
+ }
31
+
32
+ export const UtilTools = {
33
+ nextZIndex () {
34
+ lastZindex = GlobalConfig.zIndex + zindexIndex++
35
+ return lastZindex
36
+ },
37
+ getLastZIndex () {
38
+ return lastZindex
39
+ },
40
+ getColumnList,
41
+ getClass (property, params) {
42
+ return property ? XEUtils.isFunction(property) ? property(params) : property : ''
43
+ },
44
+ formatText (value, placeholder) {
45
+ return '' + (value === '' || value === null || value === undefined ? (placeholder ? GlobalConfig.emptyCell : '') : value)
46
+ },
47
+ getCellValue (row, column) {
48
+ return XEUtils.get(row, column.property)
49
+ },
50
+ setCellValue (row, column, value) {
51
+ return XEUtils.set(row, column.property, value)
52
+ },
53
+ // 组装列配置
54
+ assemColumn (_vm) {
55
+ const { $el, $xetable, $xecolumn, columnConfig } = _vm
56
+ const groupConfig = $xecolumn ? $xecolumn.columnConfig : null
57
+ columnConfig.slots = _vm.$scopedSlots
58
+ if (groupConfig) {
59
+ if (process.env.VUE_APP_VXE_TABLE_ENV === 'development') {
60
+ if ($xecolumn.$options._componentTag === 'vxe-table-column') {
61
+ errLog('vxe.error.groupTag', [`<vxe-table-colgroup title=${$xecolumn.title} ...>`, `<vxe-table-column title=${$xecolumn.title} ...>`])
62
+ } else if ($xecolumn.$options._componentTag === 'vxe-column') {
63
+ warnLog('vxe.error.groupTag', [`<vxe-colgroup title=${$xecolumn.title} ...>`, `<vxe-column title=${$xecolumn.title} ...>`])
64
+ }
65
+ }
66
+ if (!groupConfig.children) {
67
+ groupConfig.children = []
68
+ }
69
+ groupConfig.children.splice([].indexOf.call($xecolumn.$el.children, $el), 0, columnConfig)
70
+ } else {
71
+ $xetable.staticColumns.splice([].indexOf.call($xetable.$refs.hideColumn.children, $el), 0, columnConfig)
72
+ }
73
+ },
74
+ // 销毁列
75
+ destroyColumn (_vm) {
76
+ const { $xetable, columnConfig } = _vm
77
+ const matchObj = XEUtils.findTree($xetable.staticColumns, column => column === columnConfig)
78
+ if (matchObj) {
79
+ matchObj.items.splice(matchObj.index, 1)
80
+ }
81
+ },
82
+ hasChildrenList (item) {
83
+ return item && item.children && item.children.length > 0
84
+ },
85
+ parseFile (file) {
86
+ const name = file.name
87
+ const tIndex = XEUtils.lastIndexOf(name, '.')
88
+ const type = name.substring(tIndex + 1, name.length)
89
+ const filename = name.substring(0, tIndex)
90
+ return { filename, type }
91
+ },
92
+ isNumVal (num) {
93
+ return !isNaN(parseFloat('' + num))
94
+ }
95
+ }
96
+
97
+ export default UtilTools