mali-applet-ui 1.0.66 → 1.0.68

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.
@@ -128,25 +128,27 @@ export default {
128
128
  context: true
129
129
  })
130
130
  .exec(res => {
131
- const canvasNode = res[0].node
132
- const ratio = getAppDpr()
133
- const canvasWidth = res[0].width
134
- const canvasHeight = res[0].height
135
- this.cvsWidth = canvasWidth
136
- this.cvsHeight = canvasHeight
137
- this.ctx = canvasNode.getContext('2d')
138
- const canvas = new WxCanvas(this.ctx, this.canvasId, true, canvasNode)
139
- echarts.setCanvasCreator(() => {
140
- return canvas
141
- })
142
- const chart = echarts.init(canvas, null, {
143
- width: canvasWidth,
144
- height: canvasHeight,
145
- devicePixelRatio: ratio
146
- })
147
- canvas.setChart(chart)
148
- this.chart = chart
149
- this.loadChart()
131
+ if (res && res[0]) {
132
+ const canvasNode = res[0].node
133
+ const ratio = getAppDpr()
134
+ const canvasWidth = res[0].width
135
+ const canvasHeight = res[0].height
136
+ this.cvsWidth = canvasWidth
137
+ this.cvsHeight = canvasHeight
138
+ this.ctx = canvasNode.getContext('2d')
139
+ const canvas = new WxCanvas(this.ctx, this.canvasId, true, canvasNode)
140
+ echarts.setCanvasCreator(() => {
141
+ return canvas
142
+ })
143
+ const chart = echarts.init(canvas, null, {
144
+ width: canvasWidth,
145
+ height: canvasHeight,
146
+ devicePixelRatio: ratio
147
+ })
148
+ canvas.setChart(chart)
149
+ this.chart = chart
150
+ this.loadChart()
151
+ }
150
152
  })
151
153
  },
152
154
  // #endif
@@ -84,7 +84,7 @@ export default {
84
84
  left: 0;
85
85
  width: $ml-page-full-width;
86
86
  bottom: 0;
87
- z-index: 20;
87
+ z-index: 22;
88
88
  box-shadow: 0px -2px 4px 0px rgba(0,0,0,0.1);
89
89
  // #ifdef H5
90
90
  left: 50%;
@@ -81,7 +81,7 @@ export default {
81
81
  position: fixed;
82
82
  left: 0;
83
83
  top: 0;
84
- z-index: 20;
84
+ z-index: 33;
85
85
  width: $ml-page-full-width;
86
86
  box-shadow: 0px 2px 4px 0px rgba(0, 0, 0, 0.1);
87
87
  // #ifdef H5
@@ -42,7 +42,10 @@ export default {
42
42
  align: String,
43
43
  required: Boolean,
44
44
  titleAlign: String,
45
- vertical: Boolean,
45
+ vertical: {
46
+ type: Boolean,
47
+ default: null
48
+ },
46
49
  visible: {
47
50
  type: Boolean,
48
51
  default: true
@@ -135,10 +138,10 @@ export default {
135
138
  return this.form ? this.form.titleAlign : ''
136
139
  },
137
140
  itemVertical () {
138
- if (this.vertical) {
139
- return true
141
+ if (this.vertical === null) {
142
+ return this.form ? this.form.vertical : false
140
143
  }
141
- return this.form ? this.form.vertical : false
144
+ return !!this.vertical
142
145
  },
143
146
  itemLabelWidth () {
144
147
  let labelWidth = this.labelWidth
@@ -74,8 +74,15 @@ export default {
74
74
  },
75
75
  resetDownEvent () {
76
76
  const { filterForm } = this
77
- XEUtils.clear(filterForm, null)
78
- this.$emit('update:filterForm', filterForm)
77
+ const newValue = {}
78
+ XEUtils.each(filterForm, (item, key) => {
79
+ if (XEUtils.isArray(item)) {
80
+ newValue[key] = []
81
+ } else {
82
+ newValue[key] = null
83
+ }
84
+ })
85
+ this.$emit('update:filterForm', newValue)
79
86
  this.$emit('reset')
80
87
  },
81
88
  confirmDownEvent () {
@@ -1,5 +1,5 @@
1
1
  <template>
2
- <view class="ml-list-item-title">
2
+ <view class="ml-list-item-title" @tap="tapEvent">
3
3
  <view class="ml-list-item-title-left">
4
4
  <text v-if="showSeq" class="ml-list-item-title-seq">{{ itemIndex + 1 }}</text>
5
5
  <text v-if="icon" class="ml-list-item-title-icon">
@@ -36,6 +36,12 @@ export default {
36
36
  }
37
37
  return text
38
38
  }
39
+ },
40
+ methods: {
41
+ tapEvent () {
42
+ this.$emit('tap', {})
43
+ this.$emit('click', {})
44
+ }
39
45
  }
40
46
  }
41
47
  </script>
@@ -1,5 +1,11 @@
1
1
  <template>
2
- <switch class="ml-switch" :class="className" :checked="value" :color="color" @change="changeEvent"></switch>
2
+ <view class="ml-switch" :style="styles">
3
+ <view v-if="openLabel && closeLabel" class="ml-switch-warpper" @tap="toggleEvent">
4
+ <view class="ml-switch-btn" :class="{'is-active': checked}">{{ openLabel }}</view>
5
+ <view class="ml-switch-btn" :class="{'is-active': !checked}">{{ closeLabel }}</view>
6
+ </view>
7
+ <switch v-else class="ml-switch-native" :class="className" :checked="checked" :color="color" @change="changeEvent"></switch>
8
+ </view>
3
9
  </template>
4
10
 
5
11
  <script>
@@ -9,16 +15,41 @@ export default {
9
15
  virtualHost: true
10
16
  },
11
17
  props: {
12
- value: Boolean,
18
+ value: [String, Number, Boolean],
13
19
  color: {
14
20
  type: String,
15
21
  default: '#007aff'
16
22
  },
23
+ width: String,
24
+ openLabel: String,
25
+ closeLabel: String,
26
+ openValue: {
27
+ type: [String, Number, Boolean],
28
+ default: true
29
+ },
30
+ closeValue: {
31
+ type: [String, Number, Boolean],
32
+ default: false
33
+ },
17
34
  className: String
18
35
  },
36
+ computed: {
37
+ styles () {
38
+ const wSys = this.width ? `width: ${this.width};` : ''
39
+ return `${wSys}`
40
+ },
41
+ checked () {
42
+ return this.value === this.openValue
43
+ }
44
+ },
19
45
  methods: {
20
46
  changeEvent (e) {
21
- const value = e.detail.value
47
+ const value = e.detail.value ? this.openValue : this.closeValue
48
+ this.$emit('input', value)
49
+ this.$emit('change', { value })
50
+ },
51
+ toggleEvent () {
52
+ const value = this.checked ? this.closeValue : this.openValue
22
53
  this.$emit('input', value)
23
54
  this.$emit('change', { value })
24
55
  }
@@ -28,6 +59,28 @@ export default {
28
59
 
29
60
  <style lang="scss">
30
61
  .ml-switch {
31
- transform: scale(0.8);
62
+ display: inline-flex;
63
+ .ml-switch-native {
64
+ transform: scale(0.8);
65
+ }
66
+ .ml-switch-warpper {
67
+ display: inline-flex;
68
+ flex-direction: row;
69
+ padding: 8rpx;
70
+ border-radius: $ml-border-radius;
71
+ background: #e5e6e8;
72
+ .ml-switch-btn {
73
+ flex-grow: 1;
74
+ padding: 0 24rpx;
75
+ height: 44rpx;
76
+ line-height: 44rpx;
77
+ font-size: $ml-describe-font-size;
78
+ transition: all 0.3s;
79
+ &.is-active {
80
+ background: #ffffff;
81
+ border-radius: $ml-border-radius;
82
+ }
83
+ }
84
+ }
32
85
  }
33
- </style>
86
+ </style>
@@ -20,13 +20,18 @@ export default {
20
20
  props: {
21
21
  data: Array,
22
22
  height: String,
23
- checkStrictly: Boolean,
24
- showRadio: Boolean,
25
- showCheckbox: Boolean,
23
+ // 是否显示顶部全选按钮
26
24
  showAllCheckbox: Boolean,
27
- indeterminateToChecked: Boolean,
25
+ // 是是否显示顶部操作按钮
28
26
  showCheckboxBtn: Boolean,
27
+ // 单选框
28
+ showRadio: Boolean,
29
+ // 复选框
30
+ showCheckbox: Boolean,
31
+ // (复选框)父子不关联
32
+ checkStrictly: Boolean,
29
33
  checkRowKeys: Array,
34
+ halfRowKeys: Array,
30
35
  nodeProps: Object
31
36
  },
32
37
  provide () {
@@ -72,8 +77,7 @@ export default {
72
77
  },
73
78
  checkRowKeys (value) {
74
79
  if (!this.isCheckboxModelUpdate) {
75
- this.selectCheckboxRowKeys = []
76
- this.setCheckboxRow(value, true)
80
+ this.initCheckboxRows(value)
77
81
  }
78
82
  this.isCheckboxModelUpdate = false
79
83
  }
@@ -135,6 +139,7 @@ export default {
135
139
  this.isCheckboxModelUpdate = true
136
140
  this.$emit('checkbox-change', { row: nodeData, checked, checkedKeys: this.selectCheckboxRowKeys })
137
141
  this.$emit('update:checkRowKeys', [...this.selectCheckboxRowKeys])
142
+ this.$emit('update:halfRowKeys', [...this.indeterminateRowKeys])
138
143
  },
139
144
  expandNodeEvent ({ nodeData, nodeKey }) {
140
145
  const nodeIndex = this.expandRowKeys.indexOf(nodeKey)
@@ -183,6 +188,17 @@ export default {
183
188
  this.isAllCheckboxChecked = this.treeData.every(item => this.selectCheckboxRowKeys.includes(item[keyField]))
184
189
  this.isAllCheckboxIndeterminate = !this.isAllCheckboxChecked && this.treeData.some(item => this.selectCheckboxRowKeys.includes(item[keyField]))
185
190
  },
191
+ initCheckboxRows (selecKeys) {
192
+ this.selectCheckboxRowKeys = []
193
+ this.indeterminateRowKeys = []
194
+ selecKeys.forEach(nodeKey => {
195
+ if (!this.selectCheckboxRowKeys.includes(nodeKey)) {
196
+ this.selectCheckboxRowKeys.push(nodeKey)
197
+ }
198
+ })
199
+ // 更新全部节点半选状态
200
+ this.updateCheckStatus()
201
+ },
186
202
  setCheckboxRow (key, checked) {
187
203
  let keys = key
188
204
  if (!XEUtils.isArray(key)) {
@@ -209,6 +225,7 @@ export default {
209
225
  this.isCheckboxModelUpdate = true
210
226
  this.$emit('checkbox-all', { checkedKeys: this.selectCheckboxRowKeys, checkedRows: [] })
211
227
  this.$emit('update:checkRowKeys', [...this.selectCheckboxRowKeys])
228
+ this.$emit('update:halfRowKeys', [...this.indeterminateRowKeys])
212
229
  },
213
230
  toggleAllCheckboxRow () {
214
231
  const { keyField, childrenField } = this
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "mali-applet-ui",
3
- "version": "1.0.66",
3
+ "version": "1.0.68",
4
4
  "description": "码里云小程序组件库",
5
5
  "files": [
6
6
  "lib",