vxe-table 3.5.0-beta.0 → 3.5.0-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 (44) 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 +326 -380
  11. package/lib/index.umd.min.js +1 -1
  12. package/lib/select/style/style.css +1 -1
  13. package/lib/select/style/style.min.css +1 -1
  14. package/lib/style.css +1 -1
  15. package/lib/style.min.css +1 -1
  16. package/lib/table/src/cell.js +3 -3
  17. package/lib/table/src/cell.min.js +1 -1
  18. package/lib/table/src/column.js +3 -1
  19. package/lib/table/src/column.min.js +1 -1
  20. package/lib/table/src/columnInfo.js +1 -0
  21. package/lib/table/src/columnInfo.min.js +1 -1
  22. package/lib/table/src/methods.js +140 -154
  23. package/lib/table/src/methods.min.js +1 -1
  24. package/lib/table/src/table.js +20 -63
  25. package/lib/table/src/table.min.js +1 -1
  26. package/lib/tooltip/src/tooltip.js +51 -28
  27. package/lib/tooltip/src/tooltip.min.js +1 -1
  28. package/lib/tooltip/style/style.css +1 -1
  29. package/lib/tooltip/style/style.min.css +1 -1
  30. package/lib/v-x-e-table/src/conf.js +8 -6
  31. package/lib/v-x-e-table/src/conf.min.js +1 -1
  32. package/package.json +1 -1
  33. package/packages/form/src/form-item.js +2 -2
  34. package/packages/form/src/form.js +12 -25
  35. package/packages/form/src/render.js +7 -7
  36. package/packages/table/src/cell.js +3 -3
  37. package/packages/table/src/column.js +3 -1
  38. package/packages/table/src/columnInfo.js +1 -0
  39. package/packages/table/src/methods.js +22 -44
  40. package/packages/table/src/table.js +13 -58
  41. package/packages/tooltip/src/tooltip.js +44 -25
  42. package/packages/v-x-e-table/src/conf.js +8 -6
  43. package/styles/select.scss +1 -1
  44. package/styles/tooltip.scss +1 -1
@@ -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()
@@ -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
  // 表格高度
@@ -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) {
@@ -984,7 +940,6 @@ export default {
984
940
  highlightHoverColumn,
985
941
  editConfig,
986
942
  validTipOpts,
987
- tooltipOpts,
988
943
  initStore,
989
944
  columnStore,
990
945
  filterStore,
@@ -1176,7 +1131,7 @@ export default {
1176
1131
  */
1177
1132
  hasTip ? h('vxe-tooltip', {
1178
1133
  ref: 'tooltip',
1179
- props: tooltipOpts
1134
+ props: this.tipConfig
1180
1135
  }) : _e(),
1181
1136
  /**
1182
1137
  * 校验提示
@@ -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
  }
@@ -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'
@@ -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: {
@@ -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;