vxe-table 3.5.0-beta.0 → 3.5.0-beta.3

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 (61) hide show
  1. package/helper/vetur/attributes.json +30 -10
  2. package/helper/vetur/tags.json +7 -2
  3. package/lib/form/src/form-item.js +2 -2
  4. package/lib/form/src/form-item.min.js +1 -1
  5. package/lib/form/src/form.js +32 -53
  6. package/lib/form/src/form.min.js +1 -1
  7. package/lib/form/src/render.js +14 -11
  8. package/lib/form/src/render.min.js +1 -1
  9. package/lib/index.css +1 -1
  10. package/lib/index.umd.js +410 -441
  11. package/lib/index.umd.min.js +1 -1
  12. package/lib/select/src/select.js +16 -5
  13. package/lib/select/src/select.min.js +1 -1
  14. package/lib/select/style/style.css +1 -1
  15. package/lib/select/style/style.min.css +1 -1
  16. package/lib/style.css +1 -1
  17. package/lib/style.min.css +1 -1
  18. package/lib/table/src/body.js +2 -5
  19. package/lib/table/src/body.min.js +1 -1
  20. package/lib/table/src/cell.js +3 -3
  21. package/lib/table/src/cell.min.js +1 -1
  22. package/lib/table/src/column.js +3 -1
  23. package/lib/table/src/column.min.js +1 -1
  24. package/lib/table/src/columnInfo.js +1 -0
  25. package/lib/table/src/columnInfo.min.js +1 -1
  26. package/lib/table/src/methods.js +184 -188
  27. package/lib/table/src/methods.min.js +1 -1
  28. package/lib/table/src/table.js +42 -73
  29. package/lib/table/src/table.min.js +1 -1
  30. package/lib/table/src/util.js +14 -0
  31. package/lib/table/src/util.min.js +1 -1
  32. package/lib/tools/log.js +1 -1
  33. package/lib/tools/log.min.js +1 -1
  34. package/lib/tools/utils.js +0 -13
  35. package/lib/tools/utils.min.js +1 -1
  36. package/lib/tooltip/src/tooltip.js +51 -28
  37. package/lib/tooltip/src/tooltip.min.js +1 -1
  38. package/lib/tooltip/style/style.css +1 -1
  39. package/lib/tooltip/style/style.min.css +1 -1
  40. package/lib/v-x-e-table/index.js +1 -1
  41. package/lib/v-x-e-table/index.min.js +1 -1
  42. package/lib/v-x-e-table/src/conf.js +13 -8
  43. package/lib/v-x-e-table/src/conf.min.js +1 -1
  44. package/package.json +1 -1
  45. package/packages/form/src/form-item.js +2 -2
  46. package/packages/form/src/form.js +12 -25
  47. package/packages/form/src/render.js +7 -7
  48. package/packages/select/src/select.js +14 -5
  49. package/packages/table/src/body.js +3 -3
  50. package/packages/table/src/cell.js +3 -3
  51. package/packages/table/src/column.js +3 -1
  52. package/packages/table/src/columnInfo.js +1 -0
  53. package/packages/table/src/methods.js +34 -50
  54. package/packages/table/src/table.js +34 -67
  55. package/packages/table/src/util.js +11 -0
  56. package/packages/tools/utils.js +0 -11
  57. package/packages/tooltip/src/tooltip.js +44 -25
  58. package/packages/v-x-e-table/src/conf.js +13 -8
  59. package/styles/select.scss +1 -1
  60. package/styles/tooltip.scss +1 -1
  61. package/types/table.d.ts +6 -6
@@ -2,13 +2,13 @@ import XEUtils from 'xe-utils'
2
2
  import GlobalConfig from '../../v-x-e-table/src/conf'
3
3
  import Cell from './cell'
4
4
  import VXETable from '../../v-x-e-table'
5
- import { clearTableAllStatus, handleFieldOrColumn, restoreScrollLocation, restoreScrollListener, toTreePathSeq } from './util'
5
+ import { getRowid, getRowkey, clearTableAllStatus, handleFieldOrColumn, restoreScrollLocation, restoreScrollListener, toTreePathSeq } from './util'
6
6
  import UtilTools, { eqEmptyValue, isEnableConf, getFuncText } from '../../tools/utils'
7
7
  import DomTools, { browse, getPaddingTopBottomSize, setScrollTop, setScrollLeft } from '../../tools/dom'
8
8
  import { formats } from '../../v-x-e-table/src/formats'
9
9
  import { warnLog, errLog } from '../../tools/log'
10
10
 
11
- const { getRowid, getRowkey, setCellValue, hasChildrenList, getColumnList } = UtilTools
11
+ const { setCellValue, hasChildrenList, getColumnList } = UtilTools
12
12
  const { calcHeight, hasClass, addClass, removeClass, getEventTargetNode, isNodeElement } = DomTools
13
13
 
14
14
  const isWebkit = browse['-webkit'] && !browse.edge
@@ -1902,10 +1902,6 @@ const Methods = {
1902
1902
  footerSpanMethod,
1903
1903
  isAllOverflow,
1904
1904
  visibleColumn
1905
- // isMergeLeftFixedExceeded,
1906
- // isMergeRightFixedExceeded,
1907
- // isMergeFooterLeftFixedExceeded,
1908
- // isMergeFooterRightFixedExceeded
1909
1905
  } = this
1910
1906
  const containerList = ['main', 'left', 'right']
1911
1907
  const emptyPlaceholderElem = $refs.emptyPlaceholder
@@ -2023,14 +2019,6 @@ const Methods = {
2023
2019
  tableColumn = fixedColumn
2024
2020
  } else {
2025
2021
  tableColumn = visibleColumn
2026
- // 检查固定列是否被合并,合并范围是否超出固定列
2027
- // if (mergeList.length && !isMergeLeftFixedExceeded && fixedType === 'left') {
2028
- // tableColumn = fixedColumn
2029
- // } else if (mergeList.length && !isMergeRightFixedExceeded && fixedType === 'right') {
2030
- // tableColumn = fixedColumn
2031
- // } else {
2032
- // tableColumn = visibleColumn
2033
- // }
2034
2022
  }
2035
2023
  } else {
2036
2024
  tableColumn = visibleColumn
@@ -2056,14 +2044,6 @@ const Methods = {
2056
2044
  tableColumn = fixedColumn
2057
2045
  } else {
2058
2046
  tableColumn = visibleColumn
2059
- // 检查固定列是否被合并,合并范围是否超出固定列
2060
- // if (mergeFooterList.length && !isMergeFooterLeftFixedExceeded && fixedType === 'left') {
2061
- // tableColumn = fixedColumn
2062
- // } else if (mergeFooterList.length && !isMergeFooterRightFixedExceeded && fixedType === 'right') {
2063
- // tableColumn = fixedColumn
2064
- // } else {
2065
- // tableColumn = visibleColumn
2066
- // }
2067
2047
  }
2068
2048
  } else {
2069
2049
  tableColumn = visibleColumn
@@ -2284,6 +2264,7 @@ const Methods = {
2284
2264
  const isEsc = keyCode === 27
2285
2265
  if (isEsc) {
2286
2266
  this.preventEvent(evnt, 'event.keydown', null, () => {
2267
+ this.emitEvent('keydown-start', {}, evnt)
2287
2268
  if (keyboardConfig && mouseConfig && mouseOpts.area && this.handleKeyboardEvent) {
2288
2269
  this.handleKeyboardEvent(evnt)
2289
2270
  } else if (actived.row || filterStore.visible || ctxMenuStore.visible) {
@@ -2304,6 +2285,7 @@ const Methods = {
2304
2285
  }
2305
2286
  }
2306
2287
  this.emitEvent('keydown', {}, evnt)
2288
+ this.emitEvent('keydown-end', {}, evnt)
2307
2289
  })
2308
2290
  }
2309
2291
  },
@@ -2549,19 +2531,9 @@ const Methods = {
2549
2531
  this.updateCellAreas()
2550
2532
  this.recalculate(true)
2551
2533
  },
2552
- handleTooltipLeaveMethod () {
2553
- const tooltipOpts = this.tooltipOpts
2554
- setTimeout(() => {
2555
- if (!this.tooltipActive) {
2556
- this.closeTooltip()
2557
- }
2558
- }, tooltipOpts.leaveDelay)
2559
- return false
2560
- },
2561
2534
  handleTargetEnterEvent (isClear) {
2562
2535
  const $tooltip = this.$refs.tooltip
2563
2536
  clearTimeout(this.tooltipTimeout)
2564
- this.tooltipActive = true
2565
2537
  if (isClear) {
2566
2538
  this.closeTooltip()
2567
2539
  } else {
@@ -2573,7 +2545,6 @@ const Methods = {
2573
2545
  handleTargetLeaveEvent () {
2574
2546
  const tooltipOpts = this.tooltipOpts
2575
2547
  let $tooltip = this.$refs.tooltip
2576
- this.tooltipActive = false
2577
2548
  if ($tooltip) {
2578
2549
  $tooltip.setActived(false)
2579
2550
  }
@@ -2590,16 +2561,19 @@ const Methods = {
2590
2561
  },
2591
2562
  triggerHeaderHelpEvent (evnt, params) {
2592
2563
  const { column } = params
2593
- const { titleHelp } = column
2594
- if (titleHelp.content || titleHelp.message) {
2564
+ const titlePrefix = column.titlePrefix || column.titleHelp
2565
+ if (titlePrefix.content || titlePrefix.message) {
2595
2566
  const { $refs, tooltipStore } = this
2596
- const $tooltip = $refs.tooltip
2597
- const content = getFuncText(titleHelp.content || titleHelp.message)
2567
+ const content = getFuncText(titlePrefix.content || titlePrefix.message)
2598
2568
  this.handleTargetEnterEvent(true)
2599
2569
  tooltipStore.visible = true
2600
- if ($tooltip) {
2601
- $tooltip.open(evnt.currentTarget, content)
2602
- }
2570
+ tooltipStore.currOpts = { ...titlePrefix, content: null }
2571
+ this.$nextTick(() => {
2572
+ const $tooltip = $refs.tooltip
2573
+ if ($tooltip) {
2574
+ $tooltip.open(evnt.currentTarget, content)
2575
+ }
2576
+ })
2603
2577
  }
2604
2578
  },
2605
2579
  /**
@@ -2665,7 +2639,6 @@ const Methods = {
2665
2639
  const { $refs, tooltipOpts, tooltipStore } = this
2666
2640
  const { column, row } = params
2667
2641
  const { showAll, enabled, contentMethod } = tooltipOpts
2668
- const tooltip = $refs.tooltip
2669
2642
  const customContent = contentMethod ? contentMethod(params) : null
2670
2643
  const useCustom = contentMethod && !XEUtils.eqNull(customContent)
2671
2644
  const content = useCustom ? customContent : (column.type === 'html' ? overflowElem.innerText : overflowElem.textContent).trim()
@@ -2674,11 +2647,15 @@ const Methods = {
2674
2647
  Object.assign(tooltipStore, {
2675
2648
  row,
2676
2649
  column,
2677
- visible: true
2650
+ visible: true,
2651
+ currOpts: null
2652
+ })
2653
+ this.$nextTick(() => {
2654
+ const $tooltip = $refs.tooltip
2655
+ if ($tooltip) {
2656
+ $tooltip.open(isCellOverflow ? overflowElem : (tipElem || overflowElem), UtilTools.formatText(content))
2657
+ }
2678
2658
  })
2679
- if (tooltip) {
2680
- tooltip.open(isCellOverflow ? overflowElem : (tipElem || overflowElem), UtilTools.formatText(content))
2681
- }
2682
2659
  }
2683
2660
  return this.$nextTick()
2684
2661
  },
@@ -2702,7 +2679,8 @@ const Methods = {
2702
2679
  row: null,
2703
2680
  column: null,
2704
2681
  content: null,
2705
- visible: false
2682
+ visible: false,
2683
+ currOpts: null
2706
2684
  })
2707
2685
  if (tooltip) {
2708
2686
  tooltip.close()
@@ -4268,8 +4246,11 @@ const Methods = {
4268
4246
  this.tableColumn = scrollXLoad ? visibleColumn.slice(scrollXStore.startIndex, scrollXStore.endIndex) : visibleColumn.slice(0)
4269
4247
  },
4270
4248
  updateScrollXData () {
4271
- this.handleTableColumn()
4272
- this.updateScrollXSpace()
4249
+ this.tableColumn = []
4250
+ this.$nextTick(() => {
4251
+ this.handleTableColumn()
4252
+ this.updateScrollXSpace()
4253
+ })
4273
4254
  },
4274
4255
  // 更新横向 X 可视渲染上下剩余空间大小
4275
4256
  updateScrollXSpace () {
@@ -4308,8 +4289,11 @@ const Methods = {
4308
4289
  }
4309
4290
  },
4310
4291
  updateScrollYData () {
4311
- this.handleTableData()
4312
- this.updateScrollYSpace()
4292
+ this.tableData = []
4293
+ this.$nextTick(() => {
4294
+ this.handleTableData()
4295
+ this.updateScrollYSpace()
4296
+ })
4313
4297
  },
4314
4298
  // 更新纵向 Y 可视渲染上下剩余空间大小
4315
4299
  updateScrollYSpace () {
@@ -95,7 +95,7 @@ export default {
95
95
  height: [Number, String],
96
96
  // 表格的最大高度
97
97
  maxHeight: [Number, String],
98
- // (即将废弃)所有列是否允许拖动列宽调整大小
98
+ // 已废弃,被 column-config.resizable 替换
99
99
  resizable: { type: Boolean, default: () => GlobalConfig.table.resizable },
100
100
  // 是否带有斑马纹
101
101
  stripe: { type: Boolean, default: () => GlobalConfig.table.stripe },
@@ -117,15 +117,15 @@ export default {
117
117
  footerAlign: { type: String, default: () => GlobalConfig.table.footerAlign },
118
118
  // 是否显示表头
119
119
  showHeader: { type: Boolean, default: () => GlobalConfig.table.showHeader },
120
- // (即将废弃)是否要高亮当前选中行
120
+ // 已废弃,被 row-config.isCurrent 替换
121
121
  highlightCurrentRow: { type: Boolean, default: () => GlobalConfig.table.highlightCurrentRow },
122
- // (即将废弃)鼠标移到行是否要高亮显示
122
+ // 已废弃,被 row-config.isHover 替换
123
123
  highlightHoverRow: { type: Boolean, default: () => GlobalConfig.table.highlightHoverRow },
124
- // (即将废弃)是否要高亮当前选中列
124
+ // 已废弃,被 column-config.isCurrent 替换
125
125
  highlightCurrentColumn: { type: Boolean, default: () => GlobalConfig.table.highlightCurrentColumn },
126
- // (即将废弃)鼠标移到列是否要高亮显示
126
+ // 已废弃,被 column-config.isHover 替换
127
127
  highlightHoverColumn: { type: Boolean, default: () => GlobalConfig.table.highlightHoverColumn },
128
- // (即将废弃)激活单元格编辑时是否高亮显示
128
+ // 已废弃,直接删除
129
129
  highlightCell: Boolean,
130
130
  // 是否显示表尾合计
131
131
  showFooter: Boolean,
@@ -389,6 +389,13 @@ export default {
389
389
  insertList: [],
390
390
  removeList: []
391
391
  },
392
+ // 存放 tooltip 相关信息
393
+ tooltipStore: {
394
+ row: null,
395
+ column: null,
396
+ visible: false,
397
+ currOpts: null
398
+ },
392
399
  // 存放数据校验相关信息
393
400
  validStore: {
394
401
  visible: false,
@@ -480,11 +487,10 @@ export default {
480
487
  return Object.assign({}, GlobalConfig.table.checkboxConfig, this.checkboxConfig)
481
488
  },
482
489
  tooltipOpts () {
483
- const opts = Object.assign({ leaveDelay: 300 }, GlobalConfig.table.tooltipConfig, this.tooltipConfig)
484
- if (opts.enterable) {
485
- opts.leaveMethod = this.handleTooltipLeaveMethod
486
- }
487
- return opts
490
+ return Object.assign({}, GlobalConfig.tooltip, GlobalConfig.table.tooltipConfig, this.tooltipConfig)
491
+ },
492
+ tipConfig () {
493
+ return { ...this.tooltipOpts, ...this.tooltipStore.currOpts }
488
494
  },
489
495
  validTipOpts () {
490
496
  return Object.assign({ isArrow: false }, this.tooltipOpts)
@@ -598,54 +604,6 @@ export default {
598
604
  }
599
605
  return false
600
606
  }
601
- // isMergeLeftFixedExceeded () {
602
- // const { mergeList, columnStore, visibleColumn } = this
603
- // const { leftList } = columnStore
604
- // const lastFCIndex = visibleColumn.indexOf(leftList[leftList.length - 1])
605
- // for (let i = 0, len = mergeList.length; i < len; i++) {
606
- // const item = mergeList[i]
607
- // if (item.col <= lastFCIndex && item.col + item.colspan > lastFCIndex) {
608
- // return true
609
- // }
610
- // }
611
- // return false
612
- // },
613
- // isMergeRightFixedExceeded () {
614
- // const { mergeList, columnStore, visibleColumn } = this
615
- // const { rightList } = columnStore
616
- // const firstFCIndex = visibleColumn.indexOf(rightList[0])
617
- // for (let i = 0, len = mergeList.length; i < len; i++) {
618
- // const item = mergeList[i]
619
- // if (item.col < firstFCIndex && item.col + item.colspan >= firstFCIndex) {
620
- // return true
621
- // }
622
- // }
623
- // return false
624
- // },
625
- // isMergeFooterLeftFixedExceeded () {
626
- // const { mergeFooterList, columnStore, visibleColumn } = this
627
- // const { leftList } = columnStore
628
- // const lastFCIndex = visibleColumn.indexOf(leftList[leftList.length - 1])
629
- // for (let i = 0, len = mergeFooterList.length; i < len; i++) {
630
- // const item = mergeFooterList[i]
631
- // if (item.col <= lastFCIndex && item.col + item.colspan > lastFCIndex) {
632
- // return true
633
- // }
634
- // }
635
- // return false
636
- // },
637
- // isMergeFooterRightFixedExceeded () {
638
- // const { mergeFooterList, columnStore, visibleColumn } = this
639
- // const { rightList } = columnStore
640
- // const firstFCIndex = visibleColumn.indexOf(rightList[0])
641
- // for (let i = 0, len = mergeFooterList.length; i < len; i++) {
642
- // const item = mergeFooterList[i]
643
- // if (item.col < firstFCIndex && item.col + item.colspan >= firstFCIndex) {
644
- // return true
645
- // }
646
- // }
647
- // return false
648
- // }
649
607
  },
650
608
  watch: {
651
609
  data (value) {
@@ -713,8 +671,6 @@ export default {
713
671
  scrollXStore: {},
714
672
  // 存放纵向 Y 虚拟滚动相关信息
715
673
  scrollYStore: {},
716
- // 存放 tooltip 相关信息
717
- tooltipStore: {},
718
674
  // 表格宽度
719
675
  tableWidth: 0,
720
676
  // 表格高度
@@ -757,13 +713,13 @@ export default {
757
713
 
758
714
  if (process.env.VUE_APP_VXE_TABLE_ENV === 'development') {
759
715
  // if (this.rowId) {
760
- // warnLog('vxe.error.delProp', ['rowId', 'row-config.keyField'])
716
+ // warnLog('vxe.error.delProp', ['row-id', 'row-config.keyField'])
761
717
  // }
762
718
  // if (this.rowKey) {
763
- // warnLog('vxe.error.delProp', ['rowId', 'row-config.useKey'])
719
+ // warnLog('vxe.error.delProp', ['row-id', 'row-config.useKey'])
764
720
  // }
765
721
  // if (this.columnKey) {
766
- // warnLog('vxe.error.delProp', ['rowId', 'column-config.useKey'])
722
+ // warnLog('vxe.error.delProp', ['row-id', 'column-config.useKey'])
767
723
  // }
768
724
  if (!(this.rowId || rowOpts.keyField) && (this.checkboxOpts.reserve || this.checkboxOpts.checkRowKeys || this.radioOpts.reserve || this.radioOpts.checkRowKey || this.expandOpts.expandRowKeys || this.treeOpts.expandRowKeys)) {
769
725
  warnLog('vxe.error.reqProp', ['row-config.keyField'])
@@ -771,7 +727,7 @@ export default {
771
727
  if (this.editConfig && editOpts.showStatus && !this.keepSource) {
772
728
  warnLog('vxe.error.reqProp', ['keep-source'])
773
729
  }
774
- if (treeConfig && treeOpts.line && (!this.rowKey || !rowOpts.useKey || !showOverflow)) {
730
+ if (treeConfig && treeOpts.line && (!(this.rowKey || rowOpts.useKey) || !showOverflow)) {
775
731
  warnLog('vxe.error.reqProp', ['row-config.useKey | show-overflow'])
776
732
  }
777
733
  if (this.showFooter && !this.footerMethod) {
@@ -783,6 +739,18 @@ export default {
783
739
  if (this.tooltipOpts.enabled) {
784
740
  warnLog('vxe.error.delProp', ['tooltip-config.enabled', 'tooltip-config.showAll'])
785
741
  }
742
+ // if (this.highlightCurrentRow) {
743
+ // warnLog('vxe.error.delProp', ['highlight-current-row', 'row-config.isCurrent'])
744
+ // }
745
+ // if (this.highlightHoverRow) {
746
+ // warnLog('vxe.error.delProp', ['highlight-hover-row', 'row-config.isHover'])
747
+ // }
748
+ // if (this.highlightCurrentColumn) {
749
+ // warnLog('vxe.error.delProp', ['highlight-current-column', 'column-config.isCurrent'])
750
+ // }
751
+ // if (this.highlightHoverColumn) {
752
+ // warnLog('vxe.error.delProp', ['highlight-hover-column', 'column-config.isHover'])
753
+ // }
786
754
  // 检查导入导出类型,如果自定义导入导出方法,则不校验类型
787
755
  const { exportConfig, exportOpts, importConfig, importOpts } = this
788
756
  if (importConfig && importOpts.types && !importOpts.importMethod && !XEUtils.includeArrays(VXETable.config.importTypes, importOpts.types)) {
@@ -984,7 +952,6 @@ export default {
984
952
  highlightHoverColumn,
985
953
  editConfig,
986
954
  validTipOpts,
987
- tooltipOpts,
988
955
  initStore,
989
956
  columnStore,
990
957
  filterStore,
@@ -1176,7 +1143,7 @@ export default {
1176
1143
  */
1177
1144
  hasTip ? h('vxe-tooltip', {
1178
1145
  ref: 'tooltip',
1179
- props: tooltipOpts
1146
+ props: this.tipConfig
1180
1147
  }) : _e(),
1181
1148
  /**
1182
1149
  * 校验提示
@@ -37,6 +37,17 @@ export function restoreScrollListener (scrollElem) {
37
37
  }
38
38
  }
39
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
+
40
51
  function getPaddingLeftRightSize (elem) {
41
52
  if (elem) {
42
53
  const computedStyle = getComputedStyle(elem)
@@ -20,11 +20,6 @@ export function getFuncText (content) {
20
20
  return XEUtils.isFunction(content) ? content() : (GlobalConfig.translate ? GlobalConfig.translate(content) : content)
21
21
  }
22
22
 
23
- // 行主键 key
24
- export function getRowkey ($xetable) {
25
- return $xetable.rowOpts.keyField || $xetable.rowId || '_X_ID'
26
- }
27
-
28
23
  // 获取所有的列,排除分组
29
24
  export function getColumnList (columns) {
30
25
  const result = []
@@ -42,12 +37,6 @@ export const UtilTools = {
42
37
  getLastZIndex () {
43
38
  return lastZindex
44
39
  },
45
- getRowkey,
46
- // 行主键 value
47
- getRowid ($xetable, row) {
48
- const rowid = XEUtils.get(row, getRowkey($xetable))
49
- return XEUtils.eqNull(rowid) ? '' : encodeURIComponent(rowid)
50
- },
51
40
  getColumnList,
52
41
  getClass (property, params) {
53
42
  return property ? XEUtils.isFunction(property) ? property(params) : property : ''
@@ -41,6 +41,29 @@ function showTip (_vm) {
41
41
  return _vm.updatePlacement()
42
42
  }
43
43
 
44
+ function renderContent (h, _vm) {
45
+ const { $scopedSlots, useHTML, tipContent } = _vm
46
+ if ($scopedSlots.content) {
47
+ return h('div', {
48
+ key: 1,
49
+ class: 'vxe-table--tooltip-content'
50
+ }, $scopedSlots.content.call(this, {}))
51
+ }
52
+ if (useHTML) {
53
+ return h('div', {
54
+ key: 2,
55
+ class: 'vxe-table--tooltip-content',
56
+ domProps: {
57
+ innerHTML: tipContent
58
+ }
59
+ })
60
+ }
61
+ return h('div', {
62
+ key: 3,
63
+ class: 'vxe-table--tooltip-content'
64
+ }, UtilTools.formatText(tipContent))
65
+ }
66
+
44
67
  export default {
45
68
  name: 'VxeTooltip',
46
69
  mixins: [vSize],
@@ -49,19 +72,19 @@ export default {
49
72
  size: { type: String, default: () => GlobalConfig.tooltip.size || GlobalConfig.size },
50
73
  trigger: { type: String, default: () => GlobalConfig.tooltip.trigger },
51
74
  theme: { type: String, default: () => GlobalConfig.tooltip.theme },
52
- content: [String, Number],
75
+ content: { type: [String, Number], default: null },
76
+ useHTML: Boolean,
53
77
  zIndex: [String, Number],
54
78
  isArrow: { type: Boolean, default: true },
55
79
  enterable: Boolean,
56
80
  enterDelay: { type: Number, default: () => GlobalConfig.tooltip.enterDelay },
57
- leaveDelay: { type: Number, default: () => GlobalConfig.tooltip.leaveDelay },
58
- leaveMethod: Function
81
+ leaveDelay: { type: Number, default: () => GlobalConfig.tooltip.leaveDelay }
59
82
  },
60
83
  data () {
61
84
  return {
62
85
  isUpdate: false,
63
86
  visible: false,
64
- message: '',
87
+ tipContent: '',
65
88
  tipActive: false,
66
89
  tipTarget: null,
67
90
  tipZindex: 0,
@@ -74,7 +97,7 @@ export default {
74
97
  },
75
98
  watch: {
76
99
  content (value) {
77
- this.message = value
100
+ this.tipContent = value
78
101
  },
79
102
  value (value) {
80
103
  if (!this.isUpdate) {
@@ -94,7 +117,7 @@ export default {
94
117
  const { $el, trigger, content, value } = this
95
118
  const parentNode = $el.parentNode
96
119
  let target
97
- this.message = content
120
+ this.tipContent = content
98
121
  this.tipZindex = UtilTools.nextZIndex()
99
122
  XEUtils.arrayEach($el.children, (elem, index) => {
100
123
  if (index > 1) {
@@ -134,7 +157,7 @@ export default {
134
157
  }
135
158
  },
136
159
  render (h) {
137
- const { $scopedSlots, vSize, theme, message, tipActive, isArrow, visible, tipStore, enterable } = this
160
+ const { $scopedSlots, vSize, theme, tipActive, isArrow, visible, tipStore, enterable } = this
138
161
  let on
139
162
  if (enterable) {
140
163
  on = {
@@ -155,9 +178,7 @@ export default {
155
178
  ref: 'tipWrapper',
156
179
  on
157
180
  }, [
158
- h('div', {
159
- class: 'vxe-table--tooltip-content'
160
- }, $scopedSlots.content ? $scopedSlots.content.call(this, {}) : message),
181
+ renderContent(h, this),
161
182
  h('div', {
162
183
  class: 'vxe-table--tooltip-arrow',
163
184
  style: tipStore.arrowStyle
@@ -165,8 +186,8 @@ export default {
165
186
  ].concat($scopedSlots.default ? $scopedSlots.default.call(this, {}) : []))
166
187
  },
167
188
  methods: {
168
- open (target, message) {
169
- return this.toVisible(target || this.target, message)
189
+ open (target, content) {
190
+ return this.toVisible(target || this.target, content)
170
191
  },
171
192
  close () {
172
193
  this.tipTarget = null
@@ -193,13 +214,13 @@ export default {
193
214
  this.tipZindex = UtilTools.nextZIndex()
194
215
  }
195
216
  },
196
- toVisible (target, message) {
217
+ toVisible (target, content) {
197
218
  if (target) {
198
219
  const { trigger, enterDelay } = this
199
220
  this.tipActive = true
200
221
  this.tipTarget = target
201
- if (message) {
202
- this.message = message
222
+ if (content) {
223
+ this.tipContent = content
203
224
  }
204
225
  if (enterDelay && trigger === 'hover') {
205
226
  this.showDelayTip()
@@ -246,17 +267,15 @@ export default {
246
267
  wrapperMouseenterEvent () {
247
268
  this.tipActive = true
248
269
  },
249
- wrapperMouseleaveEvent (evnt) {
250
- const { leaveMethod, trigger, enterable, leaveDelay } = this
270
+ wrapperMouseleaveEvent () {
271
+ const { trigger, enterable, leaveDelay } = this
251
272
  this.tipActive = false
252
- if (!leaveMethod || leaveMethod({ $event: evnt }) !== false) {
253
- if (enterable && trigger === 'hover') {
254
- setTimeout(() => {
255
- if (!this.tipActive) {
256
- this.close()
257
- }
258
- }, leaveDelay)
259
- }
273
+ if (enterable && trigger === 'hover') {
274
+ setTimeout(() => {
275
+ if (!this.tipActive) {
276
+ this.close()
277
+ }
278
+ }, leaveDelay)
260
279
  }
261
280
  }
262
281
  }
@@ -27,7 +27,7 @@ export default {
27
27
  // name: ''
28
28
  // },
29
29
  // rowConfig: {
30
- // keyField: '_X_ID' // 行数据的唯一主键字段名
30
+ // keyField: '_X_ROW_KEY' // 行数据的唯一主键字段名
31
31
  // },
32
32
  radioConfig: {
33
33
  // trigger: 'default'
@@ -37,10 +37,9 @@ export default {
37
37
  // trigger: 'default',
38
38
  strict: true
39
39
  },
40
- // tooltipConfig: {
41
- // theme: 'dark',
42
- // enterable: false
43
- // },
40
+ tooltipConfig: {
41
+ enterable: true
42
+ },
44
43
  validConfig: {
45
44
  showMessage: true,
46
45
  message: 'default'
@@ -69,7 +68,7 @@ export default {
69
68
  parentField: 'parentId',
70
69
  children: 'children',
71
70
  hasChild: 'hasChild',
72
- mapChildren: '_X_CHILD',
71
+ mapChildren: '_X_ROW_CHILD',
73
72
  indent: 20,
74
73
  showIcon: true
75
74
  },
@@ -244,12 +243,15 @@ export default {
244
243
  },
245
244
  form: {
246
245
  // preventSubmit: false,
246
+ // size: null,
247
+ // colon: false,
247
248
  validConfig: {
248
249
  showMessage: true,
249
250
  autoPos: true
250
251
  },
251
- // size: null,
252
- // colon: false,
252
+ tooltipConfig: {
253
+ enterable: true
254
+ },
253
255
  titleAsterisk: true
254
256
  },
255
257
  input: {
@@ -275,6 +277,9 @@ export default {
275
277
  select: {
276
278
  // size: null,
277
279
  // transfer: false,
280
+ // optionConfig: {
281
+ // keyField: '_X_OPTION_KEY'
282
+ // },
278
283
  multiCharOverflow: 8
279
284
  },
280
285
  toolbar: {
@@ -104,7 +104,7 @@
104
104
 
105
105
  .vxe-select-option {
106
106
  padding: 0 10px;
107
- max-width: 400px;
107
+ max-width: 600px;
108
108
  white-space: nowrap;
109
109
  overflow: hidden;
110
110
  text-overflow: ellipsis;
@@ -7,7 +7,7 @@
7
7
  top: -100%;
8
8
  left: -100%;
9
9
  font-size: 12px;
10
- max-width: 500px;
10
+ max-width: 600px;
11
11
  border-radius: $vxe-border-radius;
12
12
  padding: 8px 12px;
13
13
  white-space: normal;