vxe-table 3.4.10-beta.0 → 3.4.12-beta.0

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.
@@ -9,7 +9,8 @@ export default {
9
9
  title: [String, Number],
10
10
  content: [String, Number],
11
11
  disabled: Boolean,
12
- size: { type: String, default: () => GlobalConfig.radio.size || GlobalConfig.size }
12
+ strict: { type: Boolean, default: () => GlobalConfig.radioButton.strict },
13
+ size: { type: String, default: () => GlobalConfig.radioButton.size || GlobalConfig.size }
13
14
  },
14
15
  inject: {
15
16
  $xeradiogroup: {
@@ -23,6 +24,10 @@ export default {
23
24
  isDisabled () {
24
25
  const { $xeradiogroup } = this
25
26
  return this.disabled || ($xeradiogroup && $xeradiogroup.disabled)
27
+ },
28
+ isStrict () {
29
+ const { $xeradiogroup } = this
30
+ return $xeradiogroup ? $xeradiogroup.strict : this.strict
26
31
  }
27
32
  },
28
33
  render (h) {
@@ -49,7 +54,8 @@ export default {
49
54
  checked: $xeradiogroup ? $xeradiogroup.value === label : value === label
50
55
  },
51
56
  on: {
52
- change: this.changeEvent
57
+ change: this.changeEvent,
58
+ click: this.clickEvent
53
59
  }
54
60
  }),
55
61
  h('span', {
@@ -58,15 +64,27 @@ export default {
58
64
  ])
59
65
  },
60
66
  methods: {
67
+ handleValue (label, evnt) {
68
+ const { $xeradiogroup } = this
69
+ const params = { label, $event: evnt }
70
+ if ($xeradiogroup) {
71
+ $xeradiogroup.handleChecked(params)
72
+ } else {
73
+ this.$emit('input', label)
74
+ this.$emit('change', params)
75
+ }
76
+ },
61
77
  changeEvent (evnt) {
62
- const { $xeradiogroup, isDisabled, label } = this
78
+ const { isDisabled } = this
63
79
  if (!isDisabled) {
64
- const params = { label, $event: evnt }
65
- if ($xeradiogroup) {
66
- $xeradiogroup.handleChecked(params)
67
- } else {
68
- this.$emit('input', label)
69
- this.$emit('change', params)
80
+ this.handleValue(this.label, evnt)
81
+ }
82
+ },
83
+ clickEvent (evnt) {
84
+ const { $xeradiogroup, isDisabled, isStrict } = this
85
+ if (!isDisabled && !isStrict) {
86
+ if (this.label === ($xeradiogroup ? $xeradiogroup.value : this.value)) {
87
+ this.handleValue(null, evnt)
70
88
  }
71
89
  }
72
90
  }
@@ -6,7 +6,8 @@ export default {
6
6
  props: {
7
7
  value: [String, Number, Boolean],
8
8
  disabled: Boolean,
9
- size: { type: String, default: () => GlobalConfig.radio.size || GlobalConfig.size }
9
+ strict: { type: Boolean, default: () => GlobalConfig.radioGroup.strict },
10
+ size: { type: String, default: () => GlobalConfig.radioGroup.size || GlobalConfig.size }
10
11
  },
11
12
  provide () {
12
13
  return {
@@ -12,6 +12,7 @@ export default {
12
12
  content: [String, Number],
13
13
  disabled: Boolean,
14
14
  name: String,
15
+ strict: { type: Boolean, default: () => GlobalConfig.radio.strict },
15
16
  size: { type: String, default: () => GlobalConfig.radio.size || GlobalConfig.size }
16
17
  },
17
18
  inject: {
@@ -23,6 +24,10 @@ export default {
23
24
  isDisabled () {
24
25
  const { $xeradiogroup } = this
25
26
  return this.disabled || ($xeradiogroup && $xeradiogroup.disabled)
27
+ },
28
+ isStrict () {
29
+ const { $xeradiogroup } = this
30
+ return $xeradiogroup ? $xeradiogroup.strict : this.strict
26
31
  }
27
32
  },
28
33
  render (h) {
@@ -49,17 +54,8 @@ export default {
49
54
  checked: $xeradiogroup ? $xeradiogroup.value === label : value === label
50
55
  },
51
56
  on: {
52
- change: evnt => {
53
- if (!isDisabled) {
54
- const params = { label, $event: evnt }
55
- if ($xeradiogroup) {
56
- $xeradiogroup.handleChecked(params)
57
- } else {
58
- this.$emit('input', label)
59
- this.$emit('change', params)
60
- }
61
- }
62
- }
57
+ change: this.changeEvent,
58
+ click: this.clickEvent
63
59
  }
64
60
  }),
65
61
  h('span', {
@@ -71,15 +67,27 @@ export default {
71
67
  ])
72
68
  },
73
69
  methods: {
70
+ handleValue (label, evnt) {
71
+ const { $xeradiogroup } = this
72
+ const params = { label, $event: evnt }
73
+ if ($xeradiogroup) {
74
+ $xeradiogroup.handleChecked(params)
75
+ } else {
76
+ this.$emit('input', label)
77
+ this.$emit('change', params)
78
+ }
79
+ },
74
80
  changeEvent (evnt) {
75
- const { $xeradiogroup, isDisabled, label } = this
81
+ const { isDisabled } = this
76
82
  if (!isDisabled) {
77
- const params = { label, $event: evnt }
78
- if ($xeradiogroup) {
79
- $xeradiogroup.handleChecked(params)
80
- } else {
81
- this.$emit('input', label)
82
- this.$emit('change', params)
83
+ this.handleValue(this.label, evnt)
84
+ }
85
+ },
86
+ clickEvent (evnt) {
87
+ const { $xeradiogroup, isDisabled, isStrict } = this
88
+ if (!isDisabled && !isStrict) {
89
+ if (this.label === ($xeradiogroup ? $xeradiogroup.value : this.value)) {
90
+ this.handleValue(null, evnt)
83
91
  }
84
92
  }
85
93
  }
@@ -606,7 +606,7 @@ const Methods = {
606
606
  }
607
607
  XEUtils.eachTree(rows, (childRow, index, items, path, parent, nodes) => {
608
608
  const rowid = getRowid(this, childRow)
609
- const rest = { row: childRow, rowid, seq: -1, index: -1, _index: -1, $index: -1, items, parent, level: parentLevel + nodes.length }
609
+ const rest = { row: childRow, rowid, seq: -1, index, _index: -1, $index: -1, items, parent, level: parentLevel + nodes.length }
610
610
  fullDataRowIdData[rowid] = rest
611
611
  fullDataRowMap.set(childRow, rest)
612
612
  fullAllDataRowIdData[rowid] = rest
@@ -616,6 +616,7 @@ const Methods = {
616
616
  if (transform) {
617
617
  row[mapChildren] = rows
618
618
  }
619
+ this.updateAfterDataIndex()
619
620
  return rows
620
621
  })
621
622
  },
@@ -1250,7 +1251,7 @@ const Methods = {
1250
1251
  fullAllDataRowIdData[rowid] = rest
1251
1252
  fullDataRowIdData[rowid] = rest
1252
1253
  }
1253
- }, { children: treeOpts.mapChildren })
1254
+ }, { children: treeOpts.transform ? treeOpts.mapChildren : treeOpts.children })
1254
1255
  } else {
1255
1256
  afterFullData.forEach((row, index) => {
1256
1257
  const rowid = getRowid(this, row)
@@ -4554,10 +4555,14 @@ const Methods = {
4554
4555
  }
4555
4556
  }
4556
4557
  return cellLabel
4557
- }
4558
+ },
4558
4559
  /*************************
4559
4560
  * Publish methods
4560
4561
  *************************/
4562
+
4563
+ getSetupOptions () {
4564
+ return GlobalConfig
4565
+ }
4561
4566
  }
4562
4567
 
4563
4568
  // Module methods
@@ -292,7 +292,16 @@ export default {
292
292
  // transfer: false
293
293
  },
294
294
  radio: {
295
- // size: null
295
+ // size: null,
296
+ strict: true
297
+ },
298
+ radioButton: {
299
+ // size: null,
300
+ strict: true
301
+ },
302
+ radioGroup: {
303
+ // size: null,
304
+ strict: true
296
305
  },
297
306
  checkbox: {
298
307
  // size: null
@@ -166,7 +166,7 @@ export default {
166
166
  cb(validRest)
167
167
  resolve()
168
168
  } else {
169
- if (GlobalConfig.validToReject) {
169
+ if (GlobalConfig.validToReject === 'obsolete') {
170
170
  // 已废弃,校验失败将不会执行catch
171
171
  reject(validRest)
172
172
  } else {