mali-applet-ui 0.2.63 → 0.2.65

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.
@@ -66,9 +66,9 @@ export default {
66
66
  return
67
67
  }
68
68
  if (globalStore.approval && globalStore.approval.record) {
69
- const optionMethod = globalStore.approval.record.optionMethod
70
- if (optionMethod) {
71
- Promise.resolve(optionMethod({
69
+ const loadOptionMethod = globalStore.approval.record.loadOption
70
+ if (loadOptionMethod) {
71
+ Promise.resolve(loadOptionMethod({
72
72
  value: this.value,
73
73
  code: this.code
74
74
  })).then(options => {
@@ -37,7 +37,13 @@ export default {
37
37
  },
38
38
  data () {
39
39
  return {
40
- flowOptions: []
40
+ flowOptions: [],
41
+ approvalData: {
42
+ flowHandlers: [],
43
+ module: null,
44
+ flowSettingCode: null,
45
+ enableFlag: false
46
+ }
41
47
  }
42
48
  },
43
49
  watch: {
@@ -47,21 +53,30 @@ export default {
47
53
  },
48
54
  created () {
49
55
  this.flowOptions = this.options || []
56
+ this.approvalData.module = this.code
57
+ this.approvalData.flowSettingCode = this.code
50
58
  this.load()
51
59
  },
52
60
  methods: {
53
- load () {
61
+ updateModel () {
62
+ this.$emit('input', this.approvalData)
63
+ },
64
+ async load () {
65
+ await this.$nextTick()
54
66
  if (!this.code) {
55
67
  return
56
68
  }
57
69
  if (globalStore.approval && globalStore.approval.select) {
58
- const optionMethod = globalStore.approval.select.optionMethod
59
- if (optionMethod) {
60
- Promise.resolve(optionMethod({
61
- value: this.value,
70
+ const loadFlowMethod = globalStore.approval.select.loadFlow
71
+ if (loadFlowMethod) {
72
+ Promise.resolve(loadFlowMethod({
62
73
  code: this.code
63
- })).then(options => {
64
- this.flowOptions = options
74
+ })).then(res => {
75
+ this.approvalData.enableFlag = res.enableFlag
76
+ this.approvalData.flowSettingCode = res.flowSettingCode
77
+ this.approvalData.module = res.module
78
+ this.flowOptions = res.flowItems
79
+ this.updateModel()
65
80
  })
66
81
  }
67
82
  }
@@ -133,8 +148,8 @@ export default {
133
148
  text-align: center;
134
149
  width: 140rpx;
135
150
  .ml-approval-select-user-picture {
136
- width: 100rpx;
137
- height: 100rpx;
151
+ width: 80rpx;
152
+ height: 80rpx;
138
153
  border-radius: 50%;
139
154
  margin: 0 auto;
140
155
  }
@@ -2,10 +2,12 @@
2
2
  <view class="ml-chunk-group" :class="[className || '', status ? `ss-${status}` : '', align ? `align-${align}` : '', {'is-status': !!status, 'is-vertical': vertical, 'is-header': title || $slots.title}]">
3
3
  <view v-if="title || $slots.title" class="ml-chunk-group-title">
4
4
  <slot name="title">
5
- <view v-if="prefixIcon" class="ml-chunk-group-left-icon">
6
- <ml-icon :className="prefixIcon" :status="status"></ml-icon>
5
+ <view class="ml-chunk-group-title-warpper">
6
+ <view v-if="prefixIcon" class="ml-chunk-group-left-icon">
7
+ <ml-icon :className="prefixIcon" :status="status"></ml-icon>
8
+ </view>
9
+ <view class="ml-chunk-group-title-content">{{ title }}</view>
7
10
  </view>
8
- <text class="ml-chunk-group-title-content">{{ title }}</text>
9
11
  </slot>
10
12
  </view>
11
13
  <view class="ml-chunk-group-body">
@@ -51,11 +53,24 @@ export default {
51
53
  height: 80rpx;
52
54
  padding: 0 20rpx ;
53
55
  }
56
+ .ml-chunk-group-title-warpper {
57
+ display: flex;
58
+ flex-direction: row;
59
+ align-items: center;
60
+ overflow: hidden;
61
+ }
54
62
  .ml-chunk-group-left-icon {
63
+ flex-shrink: 0;
55
64
  font-size: 38rpx;
56
65
  flex-shrink: 0;
57
66
  padding-right: 10rpx;
58
67
  }
68
+ .ml-chunk-group-title-content {
69
+ flex-grow: 1;
70
+ overflow: hidden;
71
+ text-overflow: ellipsis;
72
+ white-space: nowrap;
73
+ }
59
74
  .ml-chunk-group-content {
60
75
  display: flex;
61
76
  flex-direction: row;
@@ -180,7 +180,9 @@ export default {
180
180
  }
181
181
  },
182
182
  updateStatus () {
183
- const isAllChecked = this.selection.length > 0 && this.selection.length === this.itemList.length
183
+ const disableItems = this.itemList.filter(item => item.disabled)
184
+ const allSelectSize = this.selection.length + disableItems.length
185
+ const isAllChecked = allSelectSize > 0 && allSelectSize >= this.itemList.length
184
186
  const isAllIndeterminate = this.selection.length > 0 && this.selection.length < this.itemList.length
185
187
  this.$emit('update:isAllChecked', isAllChecked)
186
188
  this.$emit('update:isAllIndeterminate', isAllIndeterminate)
@@ -213,14 +215,17 @@ export default {
213
215
  labels = [label]
214
216
  }
215
217
  labels.forEach(val => {
216
- if (checked) {
217
- if (!this.selection.includes(val)) {
218
- this.selection.push(val)
219
- }
220
- } else {
221
- const index = this.selection.indexOf(val)
222
- if (index > -1) {
223
- this.selection.splice(index, 1)
218
+ const item = this.itemList.find(item => item.value === val)
219
+ if (item && !item.disabled) {
220
+ if (checked) {
221
+ if (!this.selection.includes(val)) {
222
+ this.selection.push(val)
223
+ }
224
+ } else {
225
+ const index = this.selection.indexOf(val)
226
+ if (index > -1) {
227
+ this.selection.splice(index, 1)
228
+ }
224
229
  }
225
230
  }
226
231
  })
@@ -1,10 +1,10 @@
1
1
  <template>
2
2
  <view class="ml-list-item" :class="[className || '', itemType ? `type-${itemType}` : '', {'is-padding': padding, 'is-vertical': itemVertical}]" :style="styles" @click="clickEvent" @tap="tapEvent">
3
3
  <view v-if="itemType === 'checkbox'" class="ml-list-checkbox-icon">
4
- <ml-checkbox :value="hasCheckedChecked"></ml-checkbox>
4
+ <ml-checkbox :value="hasCheckedChecked" :disabled="disabled"></ml-checkbox>
5
5
  </view>
6
6
  <view v-else-if="itemType === 'radio'" class="ml-list-radio-icon">
7
- <ml-radio :value="hasRadioChecked" :label="value"></ml-radio>
7
+ <ml-radio :value="hasRadioChecked" :label="value" :disabled="disabled"></ml-radio>
8
8
  </view>
9
9
  <view v-if="prefixIcon && prefixIcon !== 'none'" class="ml-list-item-left-icon">
10
10
  <ml-icon :className="prefixIcon"></ml-icon>
@@ -34,8 +34,9 @@ export default {
34
34
  default: null
35
35
  },
36
36
  content: String,
37
- prefixIcon: String,
38
37
  vertical: Boolean,
38
+ disabled: Boolean,
39
+ prefixIcon: String,
39
40
  suffixIcon: {
40
41
  type: String,
41
42
  default: 'mlicon-arrow-right'
@@ -86,12 +87,21 @@ export default {
86
87
  return this.listGroup ? this.listGroup.type : ''
87
88
  }
88
89
  },
90
+ watch: {
91
+ value () {
92
+ this.updateProp('value')
93
+ },
94
+ disabled () {
95
+ this.updateProp('disabled')
96
+ }
97
+ },
89
98
  mounted () {
90
99
  this.$nextTick(() => {
91
100
  if (this.listGroup) {
92
101
  this.listGroup.itemList.push({
93
102
  mId: this.mId,
94
103
  value: this.value,
104
+ disabled: this.disabled
95
105
  })
96
106
  }
97
107
  })
@@ -102,9 +112,20 @@ export default {
102
112
  }
103
113
  },
104
114
  methods: {
115
+ updateProp (prop) {
116
+ if (this.listGroup) {
117
+ const item = this.listGroup.itemList.find(item => item.mId === this.mId)
118
+ if (item) {
119
+ item[prop] = this[prop]
120
+ }
121
+ }
122
+ },
105
123
  clickEvent () {
106
124
  },
107
125
  tapEvent () {
126
+ if (this.disabled) {
127
+ return
128
+ }
108
129
  if (this.listGroup) {
109
130
  this.listGroup.triggerItemEvent({ value: this.value })
110
131
  }
@@ -77,7 +77,9 @@ export default {
77
77
  },
78
78
  methods: {
79
79
  updateStatus () {
80
- const isAllChecked = this.selection.length > 0 && this.selection.length === this.itemList.length
80
+ const disableItems = this.itemList.filter(item => item.disabled)
81
+ const allSelectSize = this.selection.length + disableItems.length
82
+ const isAllChecked = allSelectSize > 0 && allSelectSize >= this.itemList.length
81
83
  const isAllIndeterminate = this.selection.length > 0 && this.selection.length < this.itemList.length
82
84
  this.$emit('update:isAllChecked', isAllChecked)
83
85
  this.$emit('update:isAllIndeterminate', isAllIndeterminate)
@@ -110,14 +112,17 @@ export default {
110
112
  labels = [label]
111
113
  }
112
114
  labels.forEach(val => {
113
- if (checked) {
114
- if (!this.selection.includes(val)) {
115
- this.selection.push(val)
116
- }
117
- } else {
118
- const index = this.selection.indexOf(val)
119
- if (index > -1) {
120
- this.selection.splice(index, 1)
115
+ const item = this.itemList.find(item => item.value === val)
116
+ if (item && !item.disabled) {
117
+ if (checked) {
118
+ if (!this.selection.includes(val)) {
119
+ this.selection.push(val)
120
+ }
121
+ } else {
122
+ const index = this.selection.indexOf(val)
123
+ if (index > -1) {
124
+ this.selection.splice(index, 1)
125
+ }
121
126
  }
122
127
  }
123
128
  })
@@ -1,10 +1,10 @@
1
1
  <template>
2
2
  <view class="ml-list-menu-item" :class="[className || '', itemType ? `type-${itemType}` : '', {'is-vertical': itemVertical}]" @click="clickEvent" @tap="tapEvent">
3
3
  <view v-if="itemType === 'checkbox'" class="ml-list-menu-checkbox-icon">
4
- <ml-checkbox :value="hasCheckedChecked"></ml-checkbox>
4
+ <ml-checkbox :value="hasCheckedChecked" :disabled="disabled"></ml-checkbox>
5
5
  </view>
6
6
  <view v-else-if="itemType === 'radio'" class="ml-list-menu-radio-icon">
7
- <ml-radio :value="hasRadioChecked" :label="value"></ml-radio>
7
+ <ml-radio :value="hasRadioChecked" :label="value" :disabled="disabled"></ml-radio>
8
8
  </view>
9
9
  <view v-if="prefixIcon && prefixIcon !== 'none'" class="ml-list-menu-item-left-icon">
10
10
  <ml-icon :className="prefixIcon"></ml-icon>
@@ -39,6 +39,7 @@ export default {
39
39
  name: String,
40
40
  content: String,
41
41
  vertical: Boolean,
42
+ disabled: Boolean,
42
43
  prefixIcon: String,
43
44
  suffixIcon: {
44
45
  type: String,
@@ -82,22 +83,39 @@ export default {
82
83
  return this.listMenuGroup ? this.listMenuGroup.type : ''
83
84
  }
84
85
  },
86
+ watch: {
87
+ value () {
88
+ this.updateProp('value')
89
+ },
90
+ disabled () {
91
+ this.updateProp('disabled')
92
+ }
93
+ },
85
94
  mounted () {
86
95
  this.$nextTick(() => {
87
- if (this.listGroup) {
88
- this.listGroup.itemList.push({
96
+ if (this.listMenuGroup) {
97
+ this.listMenuGroup.itemList.push({
89
98
  mId: this.mId,
90
99
  value: this.value,
100
+ disabled: this.disabled
91
101
  })
92
102
  }
93
103
  })
94
104
  },
95
105
  beforeDestroy () {
96
- if (this.listGroup) {
97
- XEUtils.remove(this.listGroup.itemList, item => item.mId === this.mId)
106
+ if (this.listMenuGroup) {
107
+ XEUtils.remove(this.listMenuGroup.itemList, item => item.mId === this.mId)
98
108
  }
99
109
  },
100
110
  methods: {
111
+ updateProp (prop) {
112
+ if (this.listMenuGroup) {
113
+ const item = this.listMenuGroup.itemList.find(item => item.mId === this.mId)
114
+ if (item) {
115
+ item[prop] = this[prop]
116
+ }
117
+ }
118
+ },
101
119
  getDotNum (num) {
102
120
  return num > 99 ? '99+' : num
103
121
  },
@@ -105,6 +123,9 @@ export default {
105
123
  // this.$emit('click', {})
106
124
  },
107
125
  tapEvent () {
126
+ if (this.disabled) {
127
+ return
128
+ }
108
129
  if (this.listMenuGroup) {
109
130
  this.listMenuGroup.triggerItemEvent({ value: this.value })
110
131
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "mali-applet-ui",
3
- "version": "0.2.63",
3
+ "version": "0.2.65",
4
4
  "description": "码里云小程序组件库",
5
5
  "scripts": {
6
6
  "release": "node script/release.js && npm publish"