vxe-table 3.5.6 → 3.5.7

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 (89) hide show
  1. package/lib/all.js +15 -15
  2. package/lib/all.min.js +1 -1
  3. package/lib/button/style/style.css +0 -5
  4. package/lib/button/style/style.min.css +1 -1
  5. package/lib/checkbox/src/checkbox.js +12 -2
  6. package/lib/checkbox/src/checkbox.min.js +1 -1
  7. package/lib/checkbox/src/group.js +14 -2
  8. package/lib/checkbox/src/group.min.js +1 -1
  9. package/lib/edit/src/mixin.js +39 -4
  10. package/lib/edit/src/mixin.min.js +1 -1
  11. package/lib/form/src/form-config-item.js +185 -0
  12. package/lib/form/src/form-config-item.min.js +1 -0
  13. package/lib/form/src/form-gather.js +5 -1
  14. package/lib/form/src/form-gather.min.js +1 -1
  15. package/lib/form/src/form-item.js +17 -1
  16. package/lib/form/src/form-item.min.js +1 -1
  17. package/lib/form/src/form.js +35 -149
  18. package/lib/form/src/form.min.js +1 -1
  19. package/lib/form/src/util.js +3 -3
  20. package/lib/form/src/util.min.js +1 -1
  21. package/lib/form/style/style.css +6 -6
  22. package/lib/form/style/style.min.css +1 -1
  23. package/lib/icon/style/style.css +11 -9
  24. package/lib/icon/style/style.min.css +1 -1
  25. package/lib/index.css +1 -1
  26. package/lib/index.umd.js +1555 -1286
  27. package/lib/index.umd.min.js +1 -1
  28. package/lib/input/src/input.js +60 -7
  29. package/lib/input/src/input.min.js +1 -1
  30. package/lib/input/style/style.css +5 -0
  31. package/lib/input/style/style.min.css +1 -1
  32. package/lib/radio/src/button.js +12 -2
  33. package/lib/radio/src/button.min.js +1 -1
  34. package/lib/radio/src/group.js +14 -2
  35. package/lib/radio/src/group.min.js +1 -1
  36. package/lib/radio/src/radio.js +12 -2
  37. package/lib/radio/src/radio.min.js +1 -1
  38. package/lib/select/src/select.js +13 -1
  39. package/lib/select/src/select.min.js +1 -1
  40. package/lib/style.css +1 -1
  41. package/lib/style.min.css +1 -1
  42. package/lib/switch/src/switch.js +14 -1
  43. package/lib/switch/src/switch.min.js +1 -1
  44. package/lib/table/src/body.js +18 -9
  45. package/lib/table/src/body.min.js +1 -1
  46. package/lib/table/src/methods.js +1 -1
  47. package/lib/table/src/methods.min.js +1 -1
  48. package/lib/table/src/table.js +4 -2
  49. package/lib/table/src/table.min.js +1 -1
  50. package/lib/textarea/src/textarea.js +13 -1
  51. package/lib/textarea/src/textarea.min.js +1 -1
  52. package/lib/tools/log.js +1 -1
  53. package/lib/tools/log.min.js +1 -1
  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/validator/src/mixin.js +1 -1
  57. package/lib/validator/src/mixin.min.js +1 -1
  58. package/package.json +2 -2
  59. package/packages/all.js +0 -2
  60. package/packages/checkbox/src/checkbox.js +11 -1
  61. package/packages/checkbox/src/group.js +13 -1
  62. package/packages/edit/src/mixin.js +39 -4
  63. package/packages/form/src/form-config-item.js +150 -0
  64. package/packages/form/src/form-gather.js +5 -1
  65. package/packages/form/src/form-item.js +17 -1
  66. package/packages/form/src/form.js +31 -126
  67. package/packages/form/src/util.js +3 -3
  68. package/packages/input/src/input.js +45 -6
  69. package/packages/radio/src/button.js +11 -1
  70. package/packages/radio/src/group.js +13 -1
  71. package/packages/radio/src/radio.js +11 -1
  72. package/packages/select/src/select.js +12 -0
  73. package/packages/switch/src/switch.js +12 -0
  74. package/packages/table/src/body.js +16 -7
  75. package/packages/table/src/methods.js +1 -1
  76. package/packages/table/src/table.js +3 -2
  77. package/packages/textarea/src/textarea.js +12 -0
  78. package/packages/validator/src/mixin.js +1 -1
  79. package/styles/button.scss +0 -5
  80. package/styles/form.scss +17 -19
  81. package/styles/icon.scss +10 -9
  82. package/styles/input.scss +4 -0
  83. package/styles/variable.scss +1 -0
  84. package/types/all.d.ts +0 -1
  85. package/types/optgroup.d.ts +1 -1
  86. package/types/option.d.ts +1 -1
  87. package/types/pulldown.d.ts +1 -1
  88. package/types/radio-button.d.ts +1 -1
  89. package/types/radio-group.d.ts +1 -1
@@ -5,8 +5,8 @@ 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
7
  import { createItem, handleFieldOrItem } from './util'
8
- import { renderTitle } from './render'
9
8
  import { errLog } from '../../tools/log'
9
+ import VxeFormConfigItem from './form-config-item'
10
10
 
11
11
  class Rule {
12
12
  constructor (rule) {
@@ -62,114 +62,6 @@ function getResetValue (value, resetValue) {
62
62
  return resetValue
63
63
  }
64
64
 
65
- function renderItems (h, _vm, itemList) {
66
- const { _e, rules, data, collapseAll, validOpts, titleOverflow: allTitleOverflow } = _vm
67
- return itemList.map((item) => {
68
- const { slots, title, folding, visible, visibleMethod, field, collapseNode, itemRender, showError, errRule, className, titleOverflow, children } = item
69
- const compConf = isEnableConf(itemRender) ? VXETable.renderer.get(itemRender.name) : null
70
- const span = item.span || _vm.span
71
- const align = item.align || _vm.align
72
- const titleAlign = item.titleAlign || _vm.titleAlign
73
- const titleWidth = item.titleWidth || _vm.titleWidth
74
- let itemVisibleMethod = visibleMethod
75
- const itemOverflow = (XEUtils.isUndefined(titleOverflow) || XEUtils.isNull(titleOverflow)) ? allTitleOverflow : titleOverflow
76
- const showEllipsis = itemOverflow === 'ellipsis'
77
- const showTitle = itemOverflow === 'title'
78
- const showTooltip = itemOverflow === true || itemOverflow === 'tooltip'
79
- const hasEllipsis = showTitle || showTooltip || showEllipsis
80
- const params = { data, field, property: field, item, $form: _vm }
81
- let isRequired
82
- if (visible === false) {
83
- return _e()
84
- }
85
- // 如果为项集合
86
- const isGather = children && children.length > 0
87
- if (isGather) {
88
- const childVNs = renderItems(h, _vm, item.children)
89
- return childVNs.length ? h('div', {
90
- class: ['vxe-form--gather vxe-row', item.id, span ? `vxe-col--${span} is--span` : '', className ? (XEUtils.isFunction(className) ? className(params) : className) : '']
91
- }, childVNs) : _e()
92
- }
93
- if (!itemVisibleMethod && compConf && compConf.itemVisibleMethod) {
94
- itemVisibleMethod = compConf.itemVisibleMethod
95
- }
96
- if (rules) {
97
- const itemRules = rules[field]
98
- if (itemRules) {
99
- isRequired = itemRules.some(rule => rule.required)
100
- }
101
- }
102
- let contentVNs = []
103
- if (slots && slots.default) {
104
- contentVNs = _vm.callSlot(slots.default, params, h)
105
- } else if (compConf && compConf.renderItemContent) {
106
- contentVNs = compConf.renderItemContent.call(_vm, h, itemRender, params)
107
- } else if (compConf && compConf.renderItem) {
108
- contentVNs = compConf.renderItem.call(_vm, h, itemRender, params)
109
- } else if (field) {
110
- contentVNs = [`${XEUtils.get(data, field)}`]
111
- }
112
- const ons = showTooltip ? {
113
- mouseenter (evnt) {
114
- _vm.triggerTitleTipEvent(evnt, params)
115
- },
116
- mouseleave: _vm.handleTitleTipLeaveEvent
117
- } : {}
118
- return h('div', {
119
- class: ['vxe-form--item', item.id, span ? `vxe-col--${span} is--span` : null, className ? (XEUtils.isFunction(className) ? className(params) : className) : '', {
120
- 'is--title': title,
121
- 'is--required': isRequired,
122
- 'is--hidden': folding && collapseAll,
123
- 'is--active': !itemVisibleMethod || itemVisibleMethod(params),
124
- 'is--error': showError
125
- }],
126
- key: item.id
127
- }, [
128
- h('div', {
129
- class: 'vxe-form--item-inner'
130
- }, [
131
- title || (slots && slots.title) ? h('div', {
132
- class: ['vxe-form--item-title', titleAlign ? `align--${titleAlign}` : null, {
133
- 'is--ellipsis': hasEllipsis
134
- }],
135
- style: titleWidth ? {
136
- width: isNaN(titleWidth) ? titleWidth : `${titleWidth}px`
137
- } : null,
138
- attrs: {
139
- title: showTitle ? getFuncText(title) : null
140
- },
141
- on: ons
142
- }, renderTitle(h, _vm, item)) : null,
143
- h('div', {
144
- class: ['vxe-form--item-content', align ? `align--${align}` : null]
145
- }, contentVNs.concat(
146
- [
147
- collapseNode ? h('div', {
148
- class: 'vxe-form--item-trigger-node',
149
- on: {
150
- click: _vm.toggleCollapseEvent
151
- }
152
- }, [
153
- h('span', {
154
- class: 'vxe-form--item-trigger-text'
155
- }, collapseAll ? GlobalConfig.i18n('vxe.form.unfolding') : GlobalConfig.i18n('vxe.form.folding')),
156
- h('i', {
157
- class: ['vxe-form--item-trigger-icon', collapseAll ? GlobalConfig.icon.FORM_FOLDING : GlobalConfig.icon.FORM_UNFOLDING]
158
- })
159
- ]) : null,
160
- errRule && validOpts.showMessage ? h('div', {
161
- class: 'vxe-form--item-valid',
162
- style: errRule.maxWidth ? {
163
- width: `${errRule.maxWidth}px`
164
- } : null
165
- }, errRule.content) : null
166
- ])
167
- )
168
- ])
169
- ])
170
- })
171
- }
172
-
173
65
  export default {
174
66
  name: 'VxeForm',
175
67
  mixins: [vSize],
@@ -208,7 +100,10 @@ export default {
208
100
  },
209
101
  provide () {
210
102
  return {
211
- $xeform: this
103
+ $xeform: this,
104
+ $xeformgather: null,
105
+ $xeformitem: null,
106
+ $xeformiteminfo: null
212
107
  }
213
108
  },
214
109
  computed: {
@@ -246,11 +141,10 @@ export default {
246
141
  render (h) {
247
142
  const { _e, loading, className, data, vSize, tooltipOpts, formItems, customLayout } = this
248
143
  const hasUseTooltip = VXETable._tooltip
144
+ const defaultSlot = this.$scopedSlots.default
249
145
  return h('form', {
250
146
  class: ['vxe-form', className ? (XEUtils.isFunction(className) ? className({ items: formItems, data, $form: this }) : className) : '', {
251
147
  [`size--${vSize}`]: vSize,
252
- 'is--colon': this.titleColon,
253
- 'is--asterisk': this.titleAsterisk,
254
148
  'is--loading': loading
255
149
  }],
256
150
  on: {
@@ -260,11 +154,18 @@ export default {
260
154
  }, [
261
155
  h('div', {
262
156
  class: 'vxe-form--wrapper vxe-row'
263
- }, customLayout ? this.$slots.default : renderItems(h, this, formItems)),
157
+ }, customLayout ? (defaultSlot ? defaultSlot.call(this, h, {}) : []) : formItems.map((item, index) => {
158
+ return h(VxeFormConfigItem, {
159
+ key: index,
160
+ props: {
161
+ itemConfig: item
162
+ }
163
+ })
164
+ })),
264
165
  h('div', {
265
166
  class: 'vxe-form-slots',
266
167
  ref: 'hideItem'
267
- }, customLayout ? [] : this.$slots.default),
168
+ }, customLayout ? [] : (defaultSlot ? defaultSlot.call(this, h, {}) : [])),
268
169
  h('div', {
269
170
  class: ['vxe-loading', {
270
171
  'is--visible': loading
@@ -553,7 +454,7 @@ export default {
553
454
  }
554
455
  } else {
555
456
  const isArrType = type === 'array'
556
- const hasEmpty = isArrType ? (!XEUtils.isArray(itemValue) || !itemValue.length) : eqEmptyValue(itemValue)
457
+ const hasEmpty = isArrType || XEUtils.isArray(itemValue) ? (!XEUtils.isArray(itemValue) || !itemValue.length) : eqEmptyValue(itemValue)
557
458
  if (required ? (hasEmpty || validErrorRuleValue(rule, itemValue)) : (!hasEmpty && validErrorRuleValue(rule, itemValue))) {
558
459
  errorRules.push(new Rule(rule))
559
460
  }
@@ -602,26 +503,30 @@ export default {
602
503
  }
603
504
  })
604
505
  },
605
- /**
606
- * 更新项状态
607
- * 如果组件值 v-model 发生 change 时,调用改函数用于更新某一项编辑状态
608
- * 如果单元格配置了校验规则,则会进行校验
609
- */
610
- updateStatus (scope, itemValue) {
611
- const { property } = scope
612
- if (property) {
613
- this.validItemRules('change', property, itemValue)
506
+ triggerItemEvent (evnt, field, itemValue) {
507
+ if (field) {
508
+ return this.validItemRules(evnt ? evnt.type : 'all', field, itemValue)
614
509
  .then(() => {
615
- this.clearValidate(property)
510
+ this.clearValidate(field)
616
511
  })
617
512
  .catch(({ rule }) => {
618
- const item = this.getItemByField(property)
513
+ const item = this.getItemByField(field)
619
514
  if (item) {
620
515
  item.showError = true
621
516
  item.errRule = rule
622
517
  }
623
518
  })
624
519
  }
520
+ return this.$nextTick()
521
+ },
522
+ /**
523
+ * 更新项状态
524
+ * 如果组件值 v-model 发生 change 时,调用改函数用于更新某一项编辑状态
525
+ * 如果单元格配置了校验规则,则会进行校验
526
+ */
527
+ updateStatus (scope, itemValue) {
528
+ const { field } = scope
529
+ return this.triggerItemEvent(new Event('change'), field, itemValue)
625
530
  }
626
531
  }
627
532
  }
@@ -69,14 +69,14 @@ export function destroyItem (_vm) {
69
69
  }
70
70
 
71
71
  export function assemItem (_vm) {
72
- const { $el, $xeform, xeformgather, itemConfig } = _vm
73
- const itemGather = xeformgather ? xeformgather.itemConfig : null
72
+ const { $el, $xeform, $xeformgather, itemConfig } = _vm
73
+ const itemGather = $xeformgather ? $xeformgather.itemConfig : null
74
74
  itemConfig.slots = _vm.$scopedSlots
75
75
  if (itemGather) {
76
76
  if (!itemGather.children) {
77
77
  itemGather.children = []
78
78
  }
79
- itemGather.children.splice([].indexOf.call(xeformgather.$el.children, $el), 0, itemConfig)
79
+ itemGather.children.splice([].indexOf.call($xeformgather.$el.children, $el), 0, itemConfig)
80
80
  } else {
81
81
  $xeform.staticItems.splice([].indexOf.call($xeform.$refs.hideItem.children, $el), 0, itemConfig)
82
82
  }
@@ -463,7 +463,9 @@ function renderNumberIcon (h, _vm) {
463
463
  class: 'vxe-input--number-suffix'
464
464
  }, [
465
465
  h('span', {
466
- class: 'vxe-input--number-prev is--prev',
466
+ class: ['vxe-input--number-prev is--prev', {
467
+ 'is--disabled': _vm.isDisabledAddNumber
468
+ }],
467
469
  on: {
468
470
  mousedown: _vm.numberMousedownEvent,
469
471
  mouseup: _vm.numberStopDown,
@@ -475,7 +477,9 @@ function renderNumberIcon (h, _vm) {
475
477
  })
476
478
  ]),
477
479
  h('span', {
478
- class: 'vxe-input--number-next is--next',
480
+ class: ['vxe-input--number-next is--next', {
481
+ 'is--disabled': _vm.isDisabledSubtractNumber
482
+ }],
479
483
  on: {
480
484
  mousedown: _vm.numberMousedownEvent,
481
485
  mouseup: _vm.numberStopDown,
@@ -662,6 +666,14 @@ export default {
662
666
  placement: String,
663
667
  transfer: { type: Boolean, default: () => GlobalConfig.input.transfer }
664
668
  },
669
+ inject: {
670
+ $xeform: {
671
+ default: null
672
+ },
673
+ $xeformiteminfo: {
674
+ default: null
675
+ }
676
+ },
665
677
  data () {
666
678
  return {
667
679
  panelIndex: 0,
@@ -1027,6 +1039,29 @@ export default {
1027
1039
  inpReadonly () {
1028
1040
  const { type, readonly, editable, multiple } = this
1029
1041
  return readonly || multiple || !editable || (type === 'week' || type === 'quarter')
1042
+ },
1043
+ numValue () {
1044
+ const { type, isNumType, inputValue } = this
1045
+ if (isNumType) {
1046
+ return type === 'integer' ? XEUtils.toInteger(handleNumber(inputValue)) : XEUtils.toNumber(handleNumber(inputValue))
1047
+ }
1048
+ return 0
1049
+ },
1050
+ isDisabledSubtractNumber () {
1051
+ const { min, isNumType, inputValue, numValue } = this
1052
+ // 当有值时再进行判断
1053
+ if ((inputValue || inputValue === 0) && isNumType && min !== null) {
1054
+ return numValue <= XEUtils.toNumber(min)
1055
+ }
1056
+ return false
1057
+ },
1058
+ isDisabledAddNumber () {
1059
+ const { max, isNumType, inputValue, numValue } = this
1060
+ // 当有值时再进行判断
1061
+ if ((inputValue || inputValue === 0) && isNumType && max !== null) {
1062
+ return numValue >= XEUtils.toNumber(max)
1063
+ }
1064
+ return false
1030
1065
  }
1031
1066
  },
1032
1067
  watch: {
@@ -1168,6 +1203,10 @@ export default {
1168
1203
  this.$emit('input', { value, $event: evnt })
1169
1204
  if (XEUtils.toValueString(this.value) !== value) {
1170
1205
  this.$emit('change', { value, $event: evnt })
1206
+ // 自动更新校验状态
1207
+ if (this.$xeform && this.$xeformiteminfo) {
1208
+ this.$xeform.triggerItemEvent(evnt, this.$xeformiteminfo.itemConfig.field, value)
1209
+ }
1171
1210
  }
1172
1211
  },
1173
1212
  emitInputEvent (value, evnt) {
@@ -1433,17 +1472,17 @@ export default {
1433
1472
  }
1434
1473
  },
1435
1474
  numberPrevEvent (evnt) {
1436
- const { disabled, readonly } = this
1475
+ const { disabled, readonly, isDisabledAddNumber } = this
1437
1476
  clearTimeout(this.downbumTimeout)
1438
- if (!disabled && !readonly) {
1477
+ if (!disabled && !readonly && !isDisabledAddNumber) {
1439
1478
  this.numberChange(true, evnt)
1440
1479
  }
1441
1480
  this.$emit('prev-number', { $event: evnt })
1442
1481
  },
1443
1482
  numberNextEvent (evnt) {
1444
- const { disabled, readonly } = this
1483
+ const { disabled, readonly, isDisabledSubtractNumber } = this
1445
1484
  clearTimeout(this.downbumTimeout)
1446
- if (!disabled && !readonly) {
1485
+ if (!disabled && !readonly && !isDisabledSubtractNumber) {
1447
1486
  this.numberChange(false, evnt)
1448
1487
  }
1449
1488
  this.$emit('next-number', { $event: evnt })
@@ -15,6 +15,12 @@ export default {
15
15
  inject: {
16
16
  $xeradiogroup: {
17
17
  default: null
18
+ },
19
+ $xeform: {
20
+ default: null
21
+ },
22
+ $xeformiteminfo: {
23
+ default: null
18
24
  }
19
25
  },
20
26
  computed: {
@@ -68,10 +74,14 @@ export default {
68
74
  const { $xeradiogroup } = this
69
75
  const params = { label, $event: evnt }
70
76
  if ($xeradiogroup) {
71
- $xeradiogroup.handleChecked(params)
77
+ $xeradiogroup.handleChecked(params, evnt)
72
78
  } else {
73
79
  this.$emit('input', label)
74
80
  this.$emit('change', params)
81
+ // 自动更新校验状态
82
+ if (this.$xeform && this.$xeformiteminfo) {
83
+ this.$xeform.triggerItemEvent(evnt, this.$xeformiteminfo.itemConfig.field, label)
84
+ }
75
85
  }
76
86
  },
77
87
  changeEvent (evnt) {
@@ -9,6 +9,14 @@ export default {
9
9
  strict: { type: Boolean, default: () => GlobalConfig.radioGroup.strict },
10
10
  size: { type: String, default: () => GlobalConfig.radioGroup.size || GlobalConfig.size }
11
11
  },
12
+ inject: {
13
+ $xeform: {
14
+ default: null
15
+ },
16
+ $xeformiteminfo: {
17
+ default: null
18
+ }
19
+ },
12
20
  provide () {
13
21
  return {
14
22
  $xeradiogroup: this
@@ -31,9 +39,13 @@ export default {
31
39
  }, $scopedSlots.default ? $scopedSlots.default.call(this, {}) : [])
32
40
  },
33
41
  methods: {
34
- handleChecked (params) {
42
+ handleChecked (params, evnt) {
35
43
  this.$emit('input', params.label)
36
44
  this.$emit('change', params)
45
+ // 自动更新校验状态
46
+ if (this.$xeform && this.$xeformiteminfo) {
47
+ this.$xeform.triggerItemEvent(evnt, this.$xeformiteminfo.itemConfig.field, params.label)
48
+ }
37
49
  }
38
50
  }
39
51
  }
@@ -18,6 +18,12 @@ export default {
18
18
  inject: {
19
19
  $xeradiogroup: {
20
20
  default: null
21
+ },
22
+ $xeform: {
23
+ default: null
24
+ },
25
+ $xeformiteminfo: {
26
+ default: null
21
27
  }
22
28
  },
23
29
  computed: {
@@ -71,10 +77,14 @@ export default {
71
77
  const { $xeradiogroup } = this
72
78
  const params = { label, $event: evnt }
73
79
  if ($xeradiogroup) {
74
- $xeradiogroup.handleChecked(params)
80
+ $xeradiogroup.handleChecked(params, evnt)
75
81
  } else {
76
82
  this.$emit('input', label)
77
83
  this.$emit('change', params)
84
+ // 自动更新校验状态
85
+ if (this.$xeform && this.$xeformiteminfo) {
86
+ this.$xeform.triggerItemEvent(evnt, this.$xeformiteminfo.itemConfig.field, label)
87
+ }
78
88
  }
79
89
  },
80
90
  changeEvent (evnt) {
@@ -229,6 +229,14 @@ export default {
229
229
  components: {
230
230
  VxeInput
231
231
  },
232
+ inject: {
233
+ $xeform: {
234
+ default: null
235
+ },
236
+ $xeformiteminfo: {
237
+ default: null
238
+ }
239
+ },
232
240
  provide () {
233
241
  return {
234
242
  $xeselect: this
@@ -483,6 +491,10 @@ export default {
483
491
  if (selectValue !== this.value) {
484
492
  this.$emit('input', selectValue)
485
493
  this.$emit('change', { value: selectValue, $event: evnt })
494
+ // 自动更新校验状态
495
+ if (this.$xeform && this.$xeformiteminfo) {
496
+ this.$xeform.triggerItemEvent(evnt, this.$xeformiteminfo.itemConfig.field, selectValue)
497
+ }
486
498
  }
487
499
  },
488
500
  mousedownOptionEvent (evnt) {
@@ -18,6 +18,14 @@ export default {
18
18
  openIcon: String,
19
19
  closeIcon: String
20
20
  },
21
+ inject: {
22
+ $xeform: {
23
+ default: null
24
+ },
25
+ $xeformiteminfo: {
26
+ default: null
27
+ }
28
+ },
21
29
  data () {
22
30
  return {
23
31
  isActivated: false,
@@ -107,6 +115,10 @@ export default {
107
115
  }
108
116
  this.$emit('input', value)
109
117
  this.$emit('change', { value, $event: evnt })
118
+ // 自动更新校验状态
119
+ if (this.$xeform && this.$xeformiteminfo) {
120
+ this.$xeform.triggerItemEvent(evnt, this.$xeformiteminfo.itemConfig.field, value)
121
+ }
110
122
  this.activeTimeout = setTimeout(() => {
111
123
  this.hasAnimat = false
112
124
  }, 400)
@@ -327,15 +327,27 @@ function renderRows (h, _vm, $xetable, fixedType, tableData, tableColumn) {
327
327
  const rowLevel = rest ? rest.level : 0
328
328
  const seq = rest ? rest.seq : -1
329
329
  const params = { $table: $xetable, seq, rowid, fixed: fixedType, type: renderType, level: rowLevel, row, rowIndex, $rowIndex }
330
+ // 行是否被展开
331
+ const isExpandRow = expandColumn && rowExpandeds.length && rowExpandeds.indexOf(row) > -1
332
+ // 树节点是否被展开
333
+ let isExpandTree = false
334
+ let rowChildren = []
335
+ // 是否新增行
330
336
  let isNewRow = false
331
337
  if (editConfig) {
332
338
  isNewRow = editStore.insertList.indexOf(row) > -1
333
339
  }
340
+ if (treeConfig && !scrollYLoad && !treeOpts.transform && treeExpandeds.length) {
341
+ rowChildren = row[treeOpts.children]
342
+ isExpandTree = rowChildren && rowChildren.length && treeExpandeds.indexOf(row) > -1
343
+ }
334
344
  rows.push(
335
345
  h('tr', {
336
- class: ['vxe-body--row', {
346
+ class: ['vxe-body--row', treeConfig ? `row--level-${rowLevel}` : '', {
337
347
  'row--stripe': stripe && ($xetable.getVTRowIndex(row) + 1) % 2 === 0,
338
348
  'is--new': isNewRow,
349
+ 'is--expand-row': isExpandRow,
350
+ 'is--expand-tree': isExpandTree,
339
351
  'row--new': isNewRow && (editOpts.showStatus || editOpts.showInsertStatus),
340
352
  'row--radio': radioOpts.highlight && $xetable.selectRow === row,
341
353
  'row--checked': checkboxOpts.highlight && $xetable.isCheckedByCheckboxRow(row)
@@ -351,7 +363,7 @@ function renderRows (h, _vm, $xetable, fixedType, tableData, tableColumn) {
351
363
  }))
352
364
  )
353
365
  // 如果行被展开了
354
- if (expandColumn && rowExpandeds.length && rowExpandeds.indexOf(row) > -1) {
366
+ if (isExpandRow) {
355
367
  let cellStyle
356
368
  if (treeConfig) {
357
369
  cellStyle = {
@@ -388,11 +400,8 @@ function renderRows (h, _vm, $xetable, fixedType, tableData, tableColumn) {
388
400
  )
389
401
  }
390
402
  // 如果是树形表格
391
- if (treeConfig && !scrollYLoad && !treeOpts.transform && treeExpandeds.length) {
392
- const rowChildren = row[treeOpts.children]
393
- if (rowChildren && rowChildren.length && treeExpandeds.indexOf(row) > -1) {
394
- rows.push(...renderRows(h, _vm, $xetable, fixedType, rowChildren, tableColumn))
395
- }
403
+ if (isExpandTree) {
404
+ rows.push(...renderRows(h, _vm, $xetable, fixedType, rowChildren, tableColumn))
396
405
  }
397
406
  })
398
407
  return rows
@@ -4644,7 +4644,7 @@ const Methods = {
4644
4644
  }
4645
4645
 
4646
4646
  // Module methods
4647
- const funcs = 'setFilter,openFilter,clearFilter,getCheckedFilters,closeMenu,setActiveCellArea,getActiveCellArea,getCellAreas,clearCellAreas,copyCellArea,cutCellArea,pasteCellArea,getCopyCellArea,getCopyCellAreas,clearCopyCellArea,setCellAreas,openFind,openReplace,closeFNR,getSelectedCell,clearSelected,insert,insertAt,remove,removeCheckboxRow,removeRadioRow,removeCurrentRow,getRecordset,getInsertRecords,getRemoveRecords,getUpdateRecords,clearActived,getActiveRecord,isActiveByRow,setActiveRow,setActiveCell,setSelectCell,clearValidate,fullValidate,validate,openExport,openPrint,exportData,openImport,importData,saveFile,readFile,importByFile,print'.split(',')
4647
+ const funcs = 'setFilter,openFilter,clearFilter,getCheckedFilters,closeMenu,setActiveCellArea,getActiveCellArea,getCellAreas,clearCellAreas,copyCellArea,cutCellArea,pasteCellArea,getCopyCellArea,getCopyCellAreas,clearCopyCellArea,setCellAreas,openFind,openReplace,closeFNR,getSelectedCell,clearSelected,insert,insertAt,remove,removeCheckboxRow,removeRadioRow,removeCurrentRow,getRecordset,getInsertRecords,getRemoveRecords,getUpdateRecords,clearEdit,clearActived,getEditRecord,getActiveRecord,isEditByRow,isActiveByRow,setEditRow,setActiveRow,setEditCell,setActiveCell,setSelectCell,clearValidate,fullValidate,validate,openExport,openPrint,exportData,openImport,importData,saveFile,readFile,importByFile,print'.split(',')
4648
4648
 
4649
4649
  funcs.forEach(name => {
4650
4650
  Methods[name] = function (...args) {
@@ -2,6 +2,7 @@ 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 VxeTableBody from './body'
5
+ import VxeTableHeader from '../../header'
5
6
  import vSize from '../../mixins/size'
6
7
  import { isEnableConf, getFuncText } from '../../tools/utils'
7
8
  import { createResizeEvent } from '../../tools/resize'
@@ -24,7 +25,7 @@ function renderFixed (h, $xetable, fixedType) {
24
25
  class: `vxe-table--fixed-${fixedType}-wrapper`,
25
26
  ref: `${fixedType}Container`
26
27
  }, [
27
- showHeader ? h('vxe-table-header', {
28
+ showHeader ? h(VxeTableHeader, {
28
29
  props: {
29
30
  fixedType,
30
31
  tableData,
@@ -1007,7 +1008,7 @@ export default {
1007
1008
  /**
1008
1009
  * 表头
1009
1010
  */
1010
- showHeader ? h('vxe-table-header', {
1011
+ showHeader ? h(VxeTableHeader, {
1011
1012
  ref: 'tableHeader',
1012
1013
  props: {
1013
1014
  tableData,
@@ -30,6 +30,14 @@ export default {
30
30
  className: String,
31
31
  size: { type: String, default: () => GlobalConfig.textarea.size || GlobalConfig.size }
32
32
  },
33
+ inject: {
34
+ $xeform: {
35
+ default: null
36
+ },
37
+ $xeformiteminfo: {
38
+ default: null
39
+ }
40
+ },
33
41
  data () {
34
42
  return {
35
43
  inputValue: this.value
@@ -132,6 +140,10 @@ export default {
132
140
  this.$emit('modelValue', value)
133
141
  if (this.value !== value) {
134
142
  this.$emit('change', { value, $event: evnt })
143
+ // 自动更新校验状态
144
+ if (this.$xeform && this.$xeformiteminfo) {
145
+ this.$xeform.triggerItemEvent(evnt, this.$xeformiteminfo.itemConfig.field, value)
146
+ }
135
147
  }
136
148
  },
137
149
  inputEvent (evnt) {
@@ -278,7 +278,7 @@ export default {
278
278
  }
279
279
  } else {
280
280
  const isArrType = type === 'array'
281
- const hasEmpty = isArrType ? (!XEUtils.isArray(cellValue) || !cellValue.length) : eqEmptyValue(cellValue)
281
+ const hasEmpty = isArrType || XEUtils.isArray(cellValue) ? (!XEUtils.isArray(cellValue) || !cellValue.length) : eqEmptyValue(cellValue)
282
282
  if (required ? (hasEmpty || validErrorRuleValue(rule, cellValue)) : (!hasEmpty && validErrorRuleValue(rule, cellValue))) {
283
283
  this.validRuleErr = true
284
284
  errorRules.push(new Rule(rule))
@@ -272,11 +272,6 @@ $btnThemeList: (
272
272
  }
273
273
  }
274
274
  .vxe-button--loading-icon,
275
- .vxe-button--icon,
276
- .vxe-button--content {
277
- vertical-align: middle;
278
- }
279
- .vxe-button--loading-icon,
280
275
  .vxe-button--icon {
281
276
  min-width: $vxe-font-size;
282
277
  &+.vxe-button--content {
package/styles/form.scss CHANGED
@@ -106,22 +106,9 @@
106
106
  }
107
107
  }
108
108
  }
109
- &.is--asterisk {
110
- .vxe-form--item {
111
- &.is--required {
112
- .vxe-form--item-title-content {
113
- &:before {
114
- content: "*";
115
- color: $vxe-form-validate-error-color;
116
- font-family: Verdana,Arial,Tahoma;
117
- margin-right: 0.2em;
118
- font-weight: normal;
119
- vertical-align: middle;
120
- }
121
- }
122
- }
123
- }
124
- }
109
+ }
110
+
111
+ .vxe-form--item {
125
112
  &.is--colon {
126
113
  .vxe-form--item-title-postfix {
127
114
  &:after {
@@ -131,9 +118,20 @@
131
118
  }
132
119
  }
133
120
  }
134
- }
135
-
136
- .vxe-form--item {
121
+ &.is--asterisk {
122
+ &.is--required {
123
+ .vxe-form--item-title-content {
124
+ &:before {
125
+ content: "*";
126
+ color: $vxe-form-validate-error-color;
127
+ font-family: Verdana,Arial,Tahoma;
128
+ margin-right: 0.2em;
129
+ font-weight: normal;
130
+ vertical-align: middle;
131
+ }
132
+ }
133
+ }
134
+ }
137
135
  &.is--span {
138
136
  .vxe-default-input:not([type="submit"]):not([type="reset"]),
139
137
  .vxe-default-textarea,