mali-applet-ui 0.1.76 → 0.1.77

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.
@@ -24,6 +24,8 @@ export default {
24
24
  type: [Array, Boolean, Number, String],
25
25
  default: null
26
26
  },
27
+ isAllChecked: Boolean,
28
+ isAllIndeterminate: Boolean,
27
29
  type: String,
28
30
  vertical: Boolean,
29
31
  showPage: Boolean,
@@ -54,6 +56,7 @@ export default {
54
56
  total: 0
55
57
  },
56
58
  selectValue: null,
59
+ itemList: [],
57
60
  selection: []
58
61
  }
59
62
  },
@@ -94,6 +97,11 @@ export default {
94
97
  }
95
98
  })
96
99
  },
100
+ mounted () {
101
+ if (this.type === 'checkbox') {
102
+ setTimeout(() => this.updateStatus(), 10)
103
+ }
104
+ },
97
105
  methods: {
98
106
  getParams () {
99
107
  return this.showPage ? {
@@ -171,6 +179,12 @@ export default {
171
179
  }
172
180
  }
173
181
  },
182
+ updateStatus () {
183
+ const isAllChecked = this.selection.length > 0 && this.selection.length === this.itemList.length
184
+ const isAllIndeterminate = this.selection.length > 0 && this.selection.length < this.itemList.length
185
+ this.$emit('update:isAllChecked', isAllChecked)
186
+ this.$emit('update:isAllIndeterminate', isAllIndeterminate)
187
+ },
174
188
  updateChecked () {
175
189
  let rest = null
176
190
  this.updateModel = true
@@ -182,6 +196,7 @@ export default {
182
196
  this.$emit('update:checked', rest)
183
197
  }
184
198
  this.$emit('change', { checked: rest })
199
+ this.updateStatus()
185
200
  },
186
201
  toggleCheckboxRow (label) {
187
202
  const index = this.selection.indexOf(label)
@@ -21,6 +21,8 @@
21
21
  </template>
22
22
 
23
23
  <script>
24
+ import XEUtils from 'xe-utils'
25
+
24
26
  export default {
25
27
  name: 'MlListItem',
26
28
  options: {
@@ -54,6 +56,11 @@ export default {
54
56
  default: null
55
57
  }
56
58
  },
59
+ data () {
60
+ return {
61
+ mId: XEUtils.uniqueId('mlListItem')
62
+ }
63
+ },
57
64
  computed: {
58
65
  styles () {
59
66
  const cr = this.color ? `color:${this.color};` : ''
@@ -79,6 +86,21 @@ export default {
79
86
  return this.listGroup ? this.listGroup.type : ''
80
87
  }
81
88
  },
89
+ mounted () {
90
+ this.$nextTick(() => {
91
+ if (this.listGroup) {
92
+ this.listGroup.itemList.push({
93
+ mId: this.mId,
94
+ value: this.value,
95
+ })
96
+ }
97
+ })
98
+ },
99
+ beforeDestroy () {
100
+ if (this.listGroup) {
101
+ XEUtils.remove(this.listGroup.itemList, item => item.mId === this.mId)
102
+ }
103
+ },
82
104
  methods: {
83
105
  clickEvent () {
84
106
  this.$emit('click', {})
@@ -25,6 +25,8 @@ export default {
25
25
  type: [Array, Boolean, Number, String],
26
26
  default: null
27
27
  },
28
+ isAllChecked: Boolean,
29
+ isAllIndeterminate: Boolean,
28
30
  type: String,
29
31
  vertical: Boolean,
30
32
  prefixIcon: String,
@@ -34,6 +36,7 @@ export default {
34
36
  data () {
35
37
  return {
36
38
  selectValue: null,
39
+ itemList: [],
37
40
  selection: []
38
41
  }
39
42
  },
@@ -65,7 +68,18 @@ export default {
65
68
  }
66
69
  }
67
70
  },
71
+ mounted () {
72
+ if (this.type === 'checkbox') {
73
+ setTimeout(() => this.updateStatus(), 10)
74
+ }
75
+ },
68
76
  methods: {
77
+ updateStatus () {
78
+ const isAllChecked = this.selection.length > 0 && this.selection.length === this.itemList.length
79
+ const isAllIndeterminate = this.selection.length > 0 && this.selection.length < this.itemList.length
80
+ this.$emit('update:isAllChecked', isAllChecked)
81
+ this.$emit('update:isAllIndeterminate', isAllIndeterminate)
82
+ },
69
83
  updateChecked () {
70
84
  let rest = null
71
85
  this.updateModel = true
@@ -77,6 +91,7 @@ export default {
77
91
  this.$emit('update:checked', rest)
78
92
  }
79
93
  this.$emit('change', { checked: rest })
94
+ this.updateStatus()
80
95
  },
81
96
  toggleCheckboxRow (label) {
82
97
  const index = this.selection.indexOf(label)
@@ -24,6 +24,8 @@
24
24
  </template>
25
25
 
26
26
  <script>
27
+ import XEUtils from 'xe-utils'
28
+
27
29
  export default {
28
30
  name: 'MlListMenuItem',
29
31
  options: {
@@ -55,6 +57,11 @@ export default {
55
57
  default: null
56
58
  }
57
59
  },
60
+ data () {
61
+ return {
62
+ mId: XEUtils.uniqueId('mlListMenuItem')
63
+ }
64
+ },
58
65
  computed: {
59
66
  hasCheckedChecked () {
60
67
  return this.selection.includes(this.value)
@@ -75,6 +82,21 @@ export default {
75
82
  return this.listMenuGroup ? this.listMenuGroup.type : ''
76
83
  }
77
84
  },
85
+ mounted () {
86
+ this.$nextTick(() => {
87
+ if (this.listGroup) {
88
+ this.listGroup.itemList.push({
89
+ mId: this.mId,
90
+ value: this.value,
91
+ })
92
+ }
93
+ })
94
+ },
95
+ beforeDestroy () {
96
+ if (this.listGroup) {
97
+ XEUtils.remove(this.listGroup.itemList, item => item.mId === this.mId)
98
+ }
99
+ },
78
100
  methods: {
79
101
  getDotNum (num) {
80
102
  return num > 99 ? '99+' : num
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "mali-applet-ui",
3
- "version": "0.1.76",
3
+ "version": "0.1.77",
4
4
  "description": "码里云小程序组件库",
5
5
  "files": [
6
6
  "components",