vxe-table 3.5.9-beta.7 → 3.5.9

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 (84) hide show
  1. package/lib/button/src/button.js +5 -1
  2. package/lib/button/src/button.min.js +1 -1
  3. package/lib/edit/src/mixin.js +13 -9
  4. package/lib/edit/src/mixin.min.js +1 -1
  5. package/lib/export/src/mixin.js +1 -1
  6. package/lib/export/src/mixin.min.js +1 -1
  7. package/lib/filter/src/panel.js +7 -2
  8. package/lib/filter/src/panel.min.js +1 -1
  9. package/lib/form/src/form-config-item.js +10 -13
  10. package/lib/form/src/form-config-item.min.js +1 -1
  11. package/lib/form/src/form-gather.js +1 -3
  12. package/lib/form/src/form-gather.min.js +1 -1
  13. package/lib/form/src/form-item.js +13 -13
  14. package/lib/form/src/form-item.min.js +1 -1
  15. package/lib/form/src/form.js +6 -3
  16. package/lib/form/src/form.min.js +1 -1
  17. package/lib/form/src/util.js +41 -0
  18. package/lib/form/src/util.min.js +1 -1
  19. package/lib/grid/src/grid.js +3 -1
  20. package/lib/grid/src/grid.min.js +1 -1
  21. package/lib/grid/style/style.css +1 -1
  22. package/lib/grid/style/style.min.css +1 -1
  23. package/lib/header/src/header.js +9 -2
  24. package/lib/header/src/header.min.js +1 -1
  25. package/lib/header/style/style.css +0 -100
  26. package/lib/header/style/style.min.css +0 -1
  27. package/lib/index.css +1 -1
  28. package/lib/index.umd.js +494 -401
  29. package/lib/index.umd.min.js +1 -1
  30. package/lib/modal/src/modal.js +9 -7
  31. package/lib/modal/src/modal.min.js +1 -1
  32. package/lib/modal/style/style.css +2 -2
  33. package/lib/modal/style/style.min.css +1 -1
  34. package/lib/pager/style/style.css +1 -1
  35. package/lib/pager/style/style.min.css +1 -1
  36. package/lib/select/src/select.js +3 -1
  37. package/lib/select/src/select.min.js +1 -1
  38. package/lib/style.css +1 -1
  39. package/lib/style.min.css +1 -1
  40. package/lib/table/src/body.js +5 -2
  41. package/lib/table/src/body.min.js +1 -1
  42. package/lib/table/src/cell.js +14 -8
  43. package/lib/table/src/cell.min.js +1 -1
  44. package/lib/table/src/methods.js +33 -13
  45. package/lib/table/src/methods.min.js +1 -1
  46. package/lib/table/style/style.css +101 -0
  47. package/lib/table/style/style.min.css +1 -1
  48. package/lib/toolbar/style/style.css +1 -1
  49. package/lib/toolbar/style/style.min.css +1 -1
  50. package/lib/tools/log.js +1 -1
  51. package/lib/tools/log.min.js +1 -1
  52. package/lib/tools/vn.js +18 -0
  53. package/lib/tools/vn.min.js +1 -0
  54. package/lib/v-x-e-table/index.js +1 -1
  55. package/lib/v-x-e-table/index.min.js +1 -1
  56. package/lib/v-x-e-table/src/store.js +10 -5
  57. package/lib/v-x-e-table/src/store.min.js +1 -1
  58. package/lib/v-x-e-table/style/style.css +1 -1
  59. package/lib/v-x-e-table/style/style.min.css +1 -1
  60. package/package.json +2 -2
  61. package/packages/button/src/button.js +7 -1
  62. package/packages/edit/src/mixin.js +12 -9
  63. package/packages/export/src/mixin.js +2 -2
  64. package/packages/filter/src/panel.js +13 -6
  65. package/packages/form/src/form-config-item.js +23 -19
  66. package/packages/form/src/form-gather.js +1 -3
  67. package/packages/form/src/form-item.js +24 -18
  68. package/packages/form/src/form.js +6 -4
  69. package/packages/form/src/util.js +23 -0
  70. package/packages/grid/src/grid.js +2 -1
  71. package/packages/header/src/header.js +3 -2
  72. package/packages/modal/src/modal.js +5 -4
  73. package/packages/select/src/select.js +2 -1
  74. package/packages/table/src/body.js +38 -23
  75. package/packages/table/src/cell.js +9 -5
  76. package/packages/table/src/methods.js +24 -11
  77. package/packages/tools/vn.js +8 -0
  78. package/packages/v-x-e-table/src/store.js +8 -4
  79. package/styles/header.scss +0 -134
  80. package/styles/table.scss +134 -0
  81. package/styles/variable.scss +1 -1
  82. package/types/column.d.ts +8 -8
  83. package/types/component.d.ts +3 -1
  84. package/types/v-x-e-table/renderer.d.ts +15 -2
@@ -3,6 +3,8 @@ import GlobalConfig from '../../v-x-e-table/src/conf'
3
3
  import VXETable from '../../v-x-e-table'
4
4
  import { isEnableConf, getFuncText } from '../../tools/utils'
5
5
  import { renderTitle } from './render'
6
+ import { isActivetem } from './util'
7
+ import { getSlotVNs } from '../../tools/vn'
6
8
 
7
9
  /**
8
10
  * 配置式项
@@ -20,23 +22,21 @@ const VxeFormConfigItem = {
20
22
  provide () {
21
23
  return {
22
24
  $xeformgather: null,
23
- $xeformiteminfo: {
24
- itemConfig: this.itemConfig
25
- }
25
+ $xeformiteminfo: this
26
26
  }
27
27
  },
28
28
  render (h) {
29
29
  const { _e, $xeform, itemConfig: item } = this
30
30
  const { rules, data, collapseAll, validOpts, titleAlign: allTitleAlign, titleWidth: allTitleWidth, titleColon: allTitleColon, titleAsterisk: allTitleAsterisk, titleOverflow: allTitleOverflow } = $xeform
31
- const { slots, title, folding, visible, visibleMethod, field, collapseNode, itemRender, showError, errRule, className, titleOverflow, children } = item
31
+ const { slots, title, folding, visible, field, collapseNode, itemRender, showError, errRule, className, titleOverflow, children } = item
32
32
  const compConf = isEnableConf(itemRender) ? VXETable.renderer.get(itemRender.name) : null
33
+ const itemClassName = compConf ? compConf.itemClassName : ''
33
34
  const span = item.span || $xeform.span
34
35
  const align = item.align || $xeform.align
35
36
  const titleAlign = XEUtils.eqNull(item.titleAlign) ? allTitleAlign : item.titleAlign
36
37
  const titleWidth = XEUtils.eqNull(item.titleWidth) ? allTitleWidth : item.titleWidth
37
38
  const titleColon = XEUtils.eqNull(item.titleColon) ? allTitleColon : item.titleColon
38
39
  const titleAsterisk = XEUtils.eqNull(item.titleAsterisk) ? allTitleAsterisk : item.titleAsterisk
39
- let itemVisibleMethod = visibleMethod
40
40
  const itemOverflow = (XEUtils.isUndefined(titleOverflow) || XEUtils.isNull(titleOverflow)) ? allTitleOverflow : titleOverflow
41
41
  const showEllipsis = itemOverflow === 'ellipsis'
42
42
  const showTitle = itemOverflow === 'title'
@@ -62,9 +62,6 @@ const VxeFormConfigItem = {
62
62
  class: ['vxe-form--gather vxe-row', item.id, span ? `vxe-col--${span} is--span` : '', className ? (XEUtils.isFunction(className) ? className(params) : className) : '']
63
63
  }, childVNs) : _e()
64
64
  }
65
- if (!itemVisibleMethod && compConf && compConf.itemVisibleMethod) {
66
- itemVisibleMethod = compConf.itemVisibleMethod
67
- }
68
65
  if (rules) {
69
66
  const itemRules = rules[field]
70
67
  if (itemRules) {
@@ -75,9 +72,9 @@ const VxeFormConfigItem = {
75
72
  if (slots && slots.default) {
76
73
  contentVNs = $xeform.callSlot(slots.default, params, h)
77
74
  } else if (compConf && compConf.renderItemContent) {
78
- contentVNs = compConf.renderItemContent.call($xeform, h, itemRender, params)
75
+ contentVNs = getSlotVNs(compConf.renderItemContent.call($xeform, h, itemRender, params))
79
76
  } else if (compConf && compConf.renderItem) {
80
- contentVNs = compConf.renderItem.call($xeform, h, itemRender, params)
77
+ contentVNs = getSlotVNs(compConf.renderItem.call($xeform, h, itemRender, params))
81
78
  } else if (field) {
82
79
  contentVNs = [XEUtils.toValueString(XEUtils.get(data, field))]
83
80
  }
@@ -88,15 +85,22 @@ const VxeFormConfigItem = {
88
85
  mouseleave: $xeform.handleTitleTipLeaveEvent
89
86
  } : {}
90
87
  return h('div', {
91
- class: ['vxe-form--item', item.id, span ? `vxe-col--${span} is--span` : null, className ? (XEUtils.isFunction(className) ? className(params) : className) : '', {
92
- 'is--title': title,
93
- 'is--colon': titleColon,
94
- 'is--asterisk': titleAsterisk,
95
- 'is--required': isRequired,
96
- 'is--hidden': folding && collapseAll,
97
- 'is--active': !itemVisibleMethod || itemVisibleMethod(params),
98
- 'is--error': showError
99
- }],
88
+ class: [
89
+ 'vxe-form--item',
90
+ item.id,
91
+ span ? `vxe-col--${span} is--span` : null,
92
+ className ? (XEUtils.isFunction(className) ? className(params) : className) : '',
93
+ itemClassName ? (XEUtils.isFunction(itemClassName) ? itemClassName(params) : itemClassName) : '',
94
+ {
95
+ 'is--title': title,
96
+ 'is--colon': titleColon,
97
+ 'is--asterisk': titleAsterisk,
98
+ 'is--required': isRequired,
99
+ 'is--hidden': folding && collapseAll,
100
+ 'is--active': isActivetem($xeform, item),
101
+ 'is--error': showError
102
+ }
103
+ ],
100
104
  props: {
101
105
  itemConfig: item
102
106
  },
@@ -8,9 +8,7 @@ export default {
8
8
  return {
9
9
  $xeformgather: this,
10
10
  xeformitem: null,
11
- $xeformiteminfo: {
12
- itemConfig: this.itemConfig
13
- }
11
+ $xeformiteminfo: this
14
12
  }
15
13
  },
16
14
  created () {
@@ -2,8 +2,9 @@ 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 { isEnableConf, getFuncText } from '../../tools/utils'
5
- import { createItem, destroyItem, assemItem } from './util'
5
+ import { createItem, destroyItem, assemItem, isActivetem } from './util'
6
6
  import { renderTitle } from './render'
7
+ import { getSlotVNs } from '../../tools/vn'
7
8
 
8
9
  const props = {
9
10
  title: String,
@@ -41,14 +42,14 @@ Object.keys(props).forEach(name => {
41
42
  })
42
43
 
43
44
  const renderItem = (h, _vm, item, slots) => {
44
- const { rules, data, collapseAll, validOpts, titleOverflow: allTitleOverflow } = _vm
45
- const { title, folding, visible, visibleMethod, field, collapseNode, itemRender, showError, errRule, className, titleOverflow } = item
45
+ const { _e, rules, data, collapseAll, validOpts, titleOverflow: allTitleOverflow } = _vm
46
+ const { title, folding, visible, field, collapseNode, itemRender, showError, errRule, className, titleOverflow } = item
46
47
  const compConf = isEnableConf(itemRender) ? VXETable.renderer.get(itemRender.name) : null
48
+ const itemClassName = compConf ? compConf.itemClassName : ''
47
49
  const span = item.span || _vm.span
48
50
  const align = item.align || _vm.align
49
51
  const titleAlign = item.titleAlign || _vm.titleAlign
50
52
  const titleWidth = item.titleWidth || _vm.titleWidth
51
- let itemVisibleMethod = visibleMethod
52
53
  const itemOverflow = (XEUtils.isUndefined(titleOverflow) || XEUtils.isNull(titleOverflow)) ? allTitleOverflow : titleOverflow
53
54
  const showEllipsis = itemOverflow === 'ellipsis'
54
55
  const showTitle = itemOverflow === 'title'
@@ -56,8 +57,8 @@ const renderItem = (h, _vm, item, slots) => {
56
57
  const hasEllipsis = showTitle || showTooltip || showEllipsis
57
58
  const params = { data, field, property: field, item, $form: _vm }
58
59
  let isRequired
59
- if (!itemVisibleMethod && compConf && compConf.itemVisibleMethod) {
60
- itemVisibleMethod = compConf.itemVisibleMethod
60
+ if (visible === false) {
61
+ return _e()
61
62
  }
62
63
  if (rules) {
63
64
  const itemRules = rules[field]
@@ -69,9 +70,9 @@ const renderItem = (h, _vm, item, slots) => {
69
70
  if (slots && slots.default) {
70
71
  contentVNs = _vm.callSlot(slots.default, params, h)
71
72
  } else if (compConf && compConf.renderItemContent) {
72
- contentVNs = compConf.renderItemContent.call(_vm, h, itemRender, params)
73
+ contentVNs = getSlotVNs(compConf.renderItemContent.call(_vm, h, itemRender, params))
73
74
  } else if (compConf && compConf.renderItem) {
74
- contentVNs = compConf.renderItem.call(_vm, h, itemRender, params)
75
+ contentVNs = getSlotVNs(compConf.renderItem.call(_vm, h, itemRender, params))
75
76
  } else if (field) {
76
77
  contentVNs = [`${XEUtils.get(data, field)}`]
77
78
  }
@@ -82,13 +83,20 @@ const renderItem = (h, _vm, item, slots) => {
82
83
  mouseleave: _vm.handleTitleTipLeaveEvent
83
84
  } : {}
84
85
  return h('div', {
85
- class: ['vxe-form--item', item.id, span ? `vxe-col--${span} is--span` : null, className ? (XEUtils.isFunction(className) ? className(params) : className) : '', {
86
- 'is--title': title,
87
- 'is--required': isRequired,
88
- 'is--hidden': visible === false || (folding && collapseAll),
89
- 'is--active': !itemVisibleMethod || itemVisibleMethod(params),
90
- 'is--error': showError
91
- }]
86
+ class: [
87
+ 'vxe-form--item',
88
+ item.id,
89
+ span ? `vxe-col--${span} is--span` : '',
90
+ className ? (XEUtils.isFunction(className) ? className(params) : className) : '',
91
+ itemClassName ? (XEUtils.isFunction(itemClassName) ? itemClassName(params) : itemClassName) : '',
92
+ {
93
+ 'is--title': title,
94
+ 'is--required': isRequired,
95
+ 'is--hidden': folding && collapseAll,
96
+ 'is--active': isActivetem(_vm, item),
97
+ 'is--error': showError
98
+ }
99
+ ]
92
100
  }, [
93
101
  h('div', {
94
102
  class: 'vxe-form--item-inner'
@@ -148,9 +156,7 @@ export default {
148
156
  provide () {
149
157
  return {
150
158
  $xeformitem: this,
151
- $xeformiteminfo: {
152
- itemConfig: this.itemConfig
153
- }
159
+ $xeformiteminfo: this
154
160
  }
155
161
  },
156
162
  data () {
@@ -4,10 +4,11 @@ import vSize from '../../mixins/size'
4
4
  import VXETable from '../../v-x-e-table'
5
5
  import { isEnableConf, eqEmptyValue, getFuncText } from '../../tools/utils'
6
6
  import DomTools, { browse } from '../../tools/dom'
7
- import { createItem, handleFieldOrItem } from './util'
7
+ import { createItem, handleFieldOrItem, isHiddenItem, isActivetem } from './util'
8
8
  import { errLog } from '../../tools/log'
9
9
  import VxeFormConfigItem from './form-config-item'
10
10
  import VxeLoading from '../../loading/index'
11
+ import { getSlotVNs } from '../../tools/vn'
11
12
 
12
13
  class Rule {
13
14
  constructor (rule) {
@@ -79,6 +80,7 @@ export default {
79
80
  titleAsterisk: { type: Boolean, default: () => GlobalConfig.form.titleAsterisk },
80
81
  titleOverflow: { type: [Boolean, String], default: null },
81
82
  className: [String, Function],
83
+ readonly: Boolean,
82
84
  items: Array,
83
85
  rules: Object,
84
86
  preventSubmit: { type: Boolean, default: () => GlobalConfig.form.preventSubmit },
@@ -193,7 +195,7 @@ export default {
193
195
  slotFunc = $scopedSlots[slotFunc] || null
194
196
  }
195
197
  if (XEUtils.isFunction(slotFunc)) {
196
- return slotFunc.call(this, params, h)
198
+ return getSlotVNs(slotFunc.call(this, params, h))
197
199
  }
198
200
  }
199
201
  return []
@@ -357,7 +359,7 @@ export default {
357
359
  if (data && formRules) {
358
360
  itemList.forEach(item => {
359
361
  const { field } = item
360
- if (field) {
362
+ if (field && !isHiddenItem(this, item) && isActivetem(this, item)) {
361
363
  itemValids.push(
362
364
  this.validItemRules(type || 'all', field).then(() => {
363
365
  item.errRule = null
@@ -506,7 +508,7 @@ export default {
506
508
  },
507
509
  triggerItemEvent (evnt, field, itemValue) {
508
510
  if (field) {
509
- return this.validItemRules(evnt ? evnt.type : 'all', field, itemValue)
511
+ return this.validItemRules(evnt ? (['blur'].includes(evnt.type) ? 'blur' : 'change') : 'all', field, itemValue)
510
512
  .then(() => {
511
513
  this.clearValidate(field)
512
514
  })
@@ -1,6 +1,7 @@
1
1
  import XEUtils from 'xe-utils'
2
2
  import VXETable from '../../v-x-e-table'
3
3
  import { warnLog } from '../../tools/log'
4
+ import { isEnableConf } from '../../tools/utils'
4
5
 
5
6
  class ItemConfig {
6
7
  constructor ($xeform, item) {
@@ -58,6 +59,28 @@ export const handleFieldOrItem = ($xeform, fieldOrItem) => {
58
59
  return null
59
60
  }
60
61
 
62
+ export function isHiddenItem ($xeform, formItem) {
63
+ const { collapseAll } = $xeform
64
+ const { folding, visible } = formItem
65
+ return visible === false || (folding && collapseAll)
66
+ }
67
+
68
+ export function isActivetem ($xeform, formItem) {
69
+ let { visibleMethod, itemRender, visible, field } = formItem
70
+ if (visible === false) {
71
+ return visible
72
+ }
73
+ const compConf = isEnableConf(itemRender) ? VXETable.renderer.get(itemRender.name) : null
74
+ if (!visibleMethod && compConf && compConf.itemVisibleMethod) {
75
+ visibleMethod = compConf.itemVisibleMethod
76
+ }
77
+ if (!visibleMethod) {
78
+ return true
79
+ }
80
+ const { data } = $xeform
81
+ return visibleMethod({ data, field, property: field, item: formItem, $form: $xeform })
82
+ }
83
+
61
84
  export function createItem ($xeform, _vm) {
62
85
  return getItemConfig($xeform, _vm)
63
86
  }
@@ -7,6 +7,7 @@ import UtilTools, { isEnableConf } from '../../tools/utils'
7
7
  import DomTools, { getOffsetHeight, getPaddingTopBottomSize } from '../../tools/dom'
8
8
  import { GlobalEvent } from '../../tools/event'
9
9
  import { warnLog, errLog } from '../../tools/log'
10
+ import { getSlotVNs } from '../../tools/vn'
10
11
 
11
12
  const methods = {}
12
13
  const propKeys = Object.keys(Table.props)
@@ -372,7 +373,7 @@ export default {
372
373
  slotFunc = $scopedSlots[slotFunc] || null
373
374
  }
374
375
  if (XEUtils.isFunction(slotFunc)) {
375
- return slotFunc.call(this, params, h, vNodes)
376
+ return getSlotVNs(slotFunc.call(this, params, h, vNodes))
376
377
  }
377
378
  }
378
379
  return []
@@ -272,7 +272,8 @@ export default {
272
272
  document.onmouseup = function (evnt) {
273
273
  document.onmousemove = domMousemove
274
274
  document.onmouseup = domMouseup
275
- column.resizeWidth = column.renderWidth + (isRightFixed ? dragPosLeft - dragLeft : dragLeft - dragPosLeft)
275
+ const resizeWidth = column.renderWidth + (isRightFixed ? dragPosLeft - dragLeft : dragLeft - dragPosLeft)
276
+ column.resizeWidth = resizeWidth
276
277
  resizeBarElem.style.display = 'none'
277
278
  $xetable._isResize = false
278
279
  $xetable._lastResizeTime = Date.now()
@@ -280,7 +281,7 @@ export default {
280
281
  $xetable.recalculate(true).then(() => {
281
282
  $xetable.saveCustomResizable()
282
283
  $xetable.updateCellAreas()
283
- $xetable.emitEvent('resizable-change', params, evnt)
284
+ $xetable.emitEvent('resizable-change', { ...params, resizeWidth }, evnt)
284
285
  })
285
286
  DomTools.removeClass($xetable.$el, 'drag--resize')
286
287
  }
@@ -5,6 +5,7 @@ import UtilTools, { getFuncText } from '../../tools/utils'
5
5
  import DomTools from '../../tools/dom'
6
6
  import { GlobalEvent } from '../../tools/event'
7
7
  import { errLog } from '../../tools/log'
8
+ import { getSlotVNs } from '../../tools/vn'
8
9
  import VxeLoading from '../../loading/index'
9
10
 
10
11
  export const allActivedModals = []
@@ -168,8 +169,8 @@ export default {
168
169
  'is--ellipsis': !isMsg && showTitleOverflow
169
170
  }],
170
171
  on: headerOns
171
- }, headerSlot ? (!inited || (destroyOnClose && !visible) ? [] : headerSlot.call(this, { $modal: this }, h)) : [
172
- titleSlot ? titleSlot.call(this, { $modal: this }, h) : h('span', {
172
+ }, headerSlot ? (!inited || (destroyOnClose && !visible) ? [] : getSlotVNs(headerSlot.call(this, { $modal: this }, h))) : [
173
+ titleSlot ? getSlotVNs(titleSlot.call(this, { $modal: this }, h)) : h('span', {
173
174
  class: 'vxe-modal--title'
174
175
  }, title ? getFuncText(title) : GlobalConfig.i18n('vxe.alert.title')),
175
176
  showZoom ? h('i', {
@@ -203,7 +204,7 @@ export default {
203
204
  ]) : null,
204
205
  h('div', {
205
206
  class: 'vxe-modal--content'
206
- }, defaultSlot ? (!inited || (destroyOnClose && !visible) ? [] : defaultSlot.call(this, { $modal: this }, h)) : getFuncText(content)),
207
+ }, defaultSlot ? (!inited || (destroyOnClose && !visible) ? [] : getSlotVNs(defaultSlot.call(this, { $modal: this }, h))) : getFuncText(content)),
207
208
  /**
208
209
  * 加载中
209
210
  */
@@ -216,7 +217,7 @@ export default {
216
217
  ]),
217
218
  showFooter ? h('div', {
218
219
  class: 'vxe-modal--footer'
219
- }, footerSlot ? (!inited || (destroyOnClose && !visible) ? [] : footerSlot.call(this, { $modal: this }, h)) : [
220
+ }, footerSlot ? (!inited || (destroyOnClose && !visible) ? [] : getSlotVNs(footerSlot.call(this, { $modal: this }, h))) : [
220
221
  type === 'confirm' ? h('vxe-button', {
221
222
  ref: 'cancelBtn',
222
223
  on: {
@@ -5,6 +5,7 @@ import vSize from '../../mixins/size'
5
5
  import UtilTools, { getFuncText } from '../../tools/utils'
6
6
  import DomTools from '../../tools/dom'
7
7
  import { GlobalEvent, hasEventKey, EVENT_KEYS } from '../../tools/event'
8
+ import { getSlotVNs } from '../../tools/vn'
8
9
 
9
10
  function isOptionVisible (option) {
10
11
  return option.visible !== false
@@ -474,7 +475,7 @@ export default {
474
475
  slotFunc = $scopedSlots[slotFunc] || null
475
476
  }
476
477
  if (XEUtils.isFunction(slotFunc)) {
477
- return slotFunc.call(this, params, h)
478
+ return getSlotVNs(slotFunc.call(this, params, h))
478
479
  }
479
480
  }
480
481
  return []
@@ -66,7 +66,7 @@ function renderColumn (h, _vm, $xetable, seq, rowid, fixedType, rowLevel, row, r
66
66
  isAllOverflow,
67
67
  align: allAlign,
68
68
  currentColumn,
69
- cellClassName,
69
+ cellClassName: allCellClassName,
70
70
  cellStyle,
71
71
  mergeList,
72
72
  spanMethod,
@@ -90,6 +90,9 @@ function renderColumn (h, _vm, $xetable, seq, rowid, fixedType, rowLevel, row, r
90
90
  const { actived } = editStore
91
91
  const { rHeight: scrollYRHeight } = sYOpts
92
92
  const { height: rowHeight } = rowOpts
93
+ const renderOpts = editRender || cellRender
94
+ const compConf = renderOpts ? VXETable.renderer.get(renderOpts.name) : null
95
+ const cellClassName = compConf ? compConf.cellClassName : ''
93
96
  const showAllTip = tooltipOpts.showAll || tooltipOpts.enabled
94
97
  const columnIndex = $xetable.getColumnIndex(column)
95
98
  const _columnIndex = $xetable.getVTColumnIndex(column)
@@ -255,19 +258,26 @@ function renderColumn (h, _vm, $xetable, seq, rowid, fixedType, rowLevel, row, r
255
258
  }
256
259
  }
257
260
  return h('td', {
258
- class: ['vxe-body--column', column.id, {
259
- [`col--${cellAlign}`]: cellAlign,
260
- [`col--${type}`]: type,
261
- 'col--last': $columnIndex === columns.length - 1,
262
- 'col--tree-node': treeNode,
263
- 'col--edit': isEdit,
264
- 'col--ellipsis': hasEllipsis,
265
- 'fixed--hidden': fixedHiddenColumn,
266
- 'col--dirty': isDirty,
267
- 'col--actived': editConfig && isEdit && (actived.row === row && (actived.column === column || editOpts.mode === 'row')),
268
- 'col--valid-error': hasValidError,
269
- 'col--current': currentColumn === column
270
- }, UtilTools.getClass(className, params), UtilTools.getClass(cellClassName, params)],
261
+ class: [
262
+ 'vxe-body--column',
263
+ column.id,
264
+ {
265
+ [`col--${cellAlign}`]: cellAlign,
266
+ [`col--${type}`]: type,
267
+ 'col--last': $columnIndex === columns.length - 1,
268
+ 'col--tree-node': treeNode,
269
+ 'col--edit': isEdit,
270
+ 'col--ellipsis': hasEllipsis,
271
+ 'fixed--hidden': fixedHiddenColumn,
272
+ 'col--dirty': isDirty,
273
+ 'col--actived': editConfig && isEdit && (actived.row === row && (actived.column === column || editOpts.mode === 'row')),
274
+ 'col--valid-error': hasValidError,
275
+ 'col--current': currentColumn === column
276
+ },
277
+ UtilTools.getClass(cellClassName, params),
278
+ UtilTools.getClass(className, params),
279
+ UtilTools.getClass(allCellClassName, params)
280
+ ],
271
281
  key: columnKey || columnOpts.useKey ? column.id : $columnIndex,
272
282
  attrs,
273
283
  style: Object.assign({
@@ -343,15 +353,20 @@ function renderRows (h, _vm, $xetable, fixedType, tableData, tableColumn) {
343
353
  }
344
354
  rows.push(
345
355
  h('tr', {
346
- class: ['vxe-body--row', treeConfig ? `row--level-${rowLevel}` : '', {
347
- 'row--stripe': stripe && ($xetable.getVTRowIndex(row) + 1) % 2 === 0,
348
- 'is--new': isNewRow,
349
- 'is--expand-row': isExpandRow,
350
- 'is--expand-tree': isExpandTree,
351
- 'row--new': isNewRow && (editOpts.showStatus || editOpts.showInsertStatus),
352
- 'row--radio': radioOpts.highlight && $xetable.selectRow === row,
353
- 'row--checked': checkboxOpts.highlight && $xetable.isCheckedByCheckboxRow(row)
354
- }, rowClassName ? (XEUtils.isFunction(rowClassName) ? rowClassName(params) : rowClassName) : ''],
356
+ class: [
357
+ 'vxe-body--row',
358
+ treeConfig ? `row--level-${rowLevel}` : '',
359
+ {
360
+ 'row--stripe': stripe && ($xetable.getVTRowIndex(row) + 1) % 2 === 0,
361
+ 'is--new': isNewRow,
362
+ 'is--expand-row': isExpandRow,
363
+ 'is--expand-tree': isExpandTree,
364
+ 'row--new': isNewRow && (editOpts.showStatus || editOpts.showInsertStatus),
365
+ 'row--radio': radioOpts.highlight && $xetable.selectRow === row,
366
+ 'row--checked': checkboxOpts.highlight && $xetable.isCheckedByCheckboxRow(row)
367
+ },
368
+ rowClassName ? (XEUtils.isFunction(rowClassName) ? rowClassName(params) : rowClassName) : ''
369
+ ],
355
370
  attrs: {
356
371
  rowid: rowid
357
372
  },
@@ -4,6 +4,7 @@ import VXETable from '../../v-x-e-table'
4
4
  import DomTools from '../../tools/dom'
5
5
  import UtilTools, { eqEmptyValue, isEnableConf, getFuncText } from '../../tools/utils'
6
6
  import { getColumnConfig } from './util'
7
+ import { getSlotVNs } from '../../tools/vn'
7
8
 
8
9
  function renderHelpIcon (h, params) {
9
10
  const { $table, column } = params
@@ -78,7 +79,7 @@ function getFooterContent (h, params) {
78
79
  if (renderOpts) {
79
80
  const compConf = VXETable.renderer.get(renderOpts.name)
80
81
  if (compConf && compConf.renderFooter) {
81
- return compConf.renderFooter.call($table, h, renderOpts, params)
82
+ return getSlotVNs(compConf.renderFooter.call($table, h, renderOpts, params))
82
83
  }
83
84
  }
84
85
  return [UtilTools.formatText(items[_columnIndex], 1)]
@@ -152,7 +153,7 @@ export const Cell = {
152
153
  if (renderOpts) {
153
154
  const compConf = VXETable.renderer.get(renderOpts.name)
154
155
  if (compConf && compConf.renderHeader) {
155
- return renderTitleContent(h, params, compConf.renderHeader.call($table, h, renderOpts, params))
156
+ return getSlotVNs(renderTitleContent(h, params, compConf.renderHeader.call($table, h, renderOpts, params)))
156
157
  }
157
158
  }
158
159
  return renderTitleContent(h, params, UtilTools.formatText(column.getTitle(), 1))
@@ -171,7 +172,7 @@ export const Cell = {
171
172
  const funName = editRender ? 'renderCell' : 'renderDefault'
172
173
  const compConf = VXETable.renderer.get(renderOpts.name)
173
174
  if (compConf && compConf[funName]) {
174
- return compConf[funName].call($table, h, renderOpts, Object.assign({ $type: editRender ? 'edit' : 'cell' }, params))
175
+ return getSlotVNs(compConf[funName].call($table, h, renderOpts, Object.assign({ $type: editRender ? 'edit' : 'cell' }, params)))
175
176
  }
176
177
  }
177
178
  const cellValue = $table.getCellLabel(row, column)
@@ -592,7 +593,7 @@ export const Cell = {
592
593
  if (contentRender) {
593
594
  const compConf = VXETable.renderer.get(contentRender.name)
594
595
  if (compConf && compConf.renderExpand) {
595
- return compConf.renderExpand.call($table, h, contentRender, params)
596
+ return getSlotVNs(compConf.renderExpand.call($table, h, contentRender, params))
596
597
  }
597
598
  }
598
599
  return []
@@ -756,7 +757,10 @@ export const Cell = {
756
757
  if (slots && slots.edit) {
757
758
  return $table.callSlot(slots.edit, params, h)
758
759
  }
759
- return compConf && compConf.renderEdit ? compConf.renderEdit.call($table, h, editRender, Object.assign({ $type: 'edit' }, params)) : []
760
+ if (compConf && compConf.renderEdit) {
761
+ return getSlotVNs(compConf.renderEdit.call($table, h, editRender, Object.assign({ $type: 'edit' }, params)))
762
+ }
763
+ return []
760
764
  }
761
765
  if (slots && slots.default) {
762
766
  return $table.callSlot(slots.default, params, h)
@@ -7,6 +7,7 @@ import UtilTools, { eqEmptyValue, isEnableConf, getFuncText } from '../../tools/
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
+ import { getSlotVNs } from '../../tools/vn'
10
11
 
11
12
  const { setCellValue, hasChildrenList, getColumnList } = UtilTools
12
13
  const { calcHeight, hasClass, addClass, removeClass, getEventTargetNode, isNodeElement } = DomTools
@@ -138,12 +139,12 @@ function calculateMergerOffserIndex (list, offsetItem, type) {
138
139
  function setMerges (_vm, merges, mList, rowList) {
139
140
  if (merges) {
140
141
  const { treeConfig, visibleColumn } = _vm
141
- if (treeConfig) {
142
- throw new Error(UtilTools.getLog('vxe.error.noTree', ['merge-footer-items']))
143
- }
144
142
  if (!XEUtils.isArray(merges)) {
145
143
  merges = [merges]
146
144
  }
145
+ if (treeConfig && merges.length) {
146
+ errLog('vxe.error.noTree', ['merge-cells | merge-footer-items'])
147
+ }
147
148
  merges.forEach(item => {
148
149
  let { row, col, rowspan, colspan } = item
149
150
  if (rowList && XEUtils.isNumber(row)) {
@@ -187,12 +188,12 @@ function removeMerges (_vm, merges, mList, rowList) {
187
188
  const rest = []
188
189
  if (merges) {
189
190
  const { treeConfig, visibleColumn } = _vm
190
- if (treeConfig) {
191
- throw new Error(UtilTools.getLog('vxe.error.noTree', ['merge-cells']))
192
- }
193
191
  if (!XEUtils.isArray(merges)) {
194
192
  merges = [merges]
195
193
  }
194
+ if (treeConfig && merges.length) {
195
+ errLog('vxe.error.noTree', ['merge-cells | merge-footer-items'])
196
+ }
196
197
  merges.forEach(item => {
197
198
  let { row, col } = item
198
199
  if (rowList && XEUtils.isNumber(row)) {
@@ -245,7 +246,7 @@ const Methods = {
245
246
  return $xegrid.callSlot(slotFunc, params, h, vNodes)
246
247
  }
247
248
  if (XEUtils.isFunction(slotFunc)) {
248
- return slotFunc.call(this, params, h, vNodes)
249
+ return getSlotVNs(slotFunc.call(this, params, h, vNodes))
249
250
  }
250
251
  }
251
252
  return []
@@ -963,7 +964,7 @@ const Methods = {
963
964
  if (!this.isInsertByRow(row)) {
964
965
  const rowIndex = this.getRowIndex(row)
965
966
  if (treeConfig && rowIndex === -1) {
966
- throw new Error(UtilTools.getLog('vxe.error.noTree', ['revertData']))
967
+ errLog('vxe.error.noTree', ['revertData'])
967
968
  }
968
969
  const oRow = tableSourceData[rowIndex]
969
970
  if (oRow && row) {
@@ -2227,7 +2228,7 @@ const Methods = {
2227
2228
  // 如果点击了当前表格之外
2228
2229
  !getEventTargetNode(evnt, $el).flag
2229
2230
  ) {
2230
- setTimeout(() => this.clearActived(evnt))
2231
+ setTimeout(() => this.clearEdit(evnt))
2231
2232
  }
2232
2233
  })
2233
2234
  }
@@ -2288,7 +2289,7 @@ const Methods = {
2288
2289
  // 如果是激活编辑状态,则取消编辑
2289
2290
  if (actived.row) {
2290
2291
  const params = actived.args
2291
- this.clearActived(evnt)
2292
+ this.clearEdit(evnt)
2292
2293
  // 如果配置了选中功能,则为选中状态
2293
2294
  if (mouseConfig && mouseOpts.selected) {
2294
2295
  this.$nextTick(() => this.handleSelected(params, evnt))
@@ -2377,7 +2378,7 @@ const Methods = {
2377
2378
  // 如果是激活编辑状态,则取消编辑
2378
2379
  if (actived.row) {
2379
2380
  params = actived.args
2380
- this.clearActived(evnt)
2381
+ this.clearEdit(evnt)
2381
2382
  // 如果配置了选中功能,则为选中状态
2382
2383
  if (mouseConfig && mouseOpts.selected) {
2383
2384
  this.$nextTick(() => this.handleSelected(params, evnt))
@@ -4645,6 +4646,18 @@ const Methods = {
4645
4646
  }
4646
4647
  return cellLabel
4647
4648
  },
4649
+ findRowIndexOf (list, row) {
4650
+ return row ? XEUtils.findIndexOf(list, item => this.eqRow(item, row)) : -1
4651
+ },
4652
+ eqRow (row1, row2) {
4653
+ if (row1 && row2) {
4654
+ if (row1 === row2) {
4655
+ return true
4656
+ }
4657
+ return getRowid(this, row1) === getRowid(this, row2)
4658
+ }
4659
+ return false
4660
+ },
4648
4661
  /*************************
4649
4662
  * Publish methods
4650
4663
  *************************/
@@ -0,0 +1,8 @@
1
+ import XEUtils from 'xe-utils'
2
+
3
+ export function getSlotVNs (vns) {
4
+ if (XEUtils.isArray(vns)) {
5
+ return vns
6
+ }
7
+ return [vns]
8
+ }
@@ -19,13 +19,17 @@ class Store {
19
19
  }
20
20
 
21
21
  add (name, render) {
22
+ const conf = this.store[name]
22
23
  // 检测是否覆盖
23
24
  if (process.env.VUE_APP_VXE_TABLE_ENV === 'development') {
24
- if (!XEUtils.eqNull(this.store[name]) && this.store[name] !== render) {
25
- warnLog('vxe.error.coverProp', [this._name, name])
26
- }
25
+ const confKeys = XEUtils.keys(conf)
26
+ XEUtils.each(render, (item, key) => {
27
+ if (confKeys.includes(key)) {
28
+ warnLog('vxe.error.coverProp', [name, key])
29
+ }
30
+ })
27
31
  }
28
- this.store[name] = render
32
+ this.store[name] = conf ? XEUtils.merge(conf, render) : render
29
33
  return Store
30
34
  }
31
35