mali-applet-ui 0.0.98 → 0.0.100

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.
@@ -5,7 +5,7 @@
5
5
  </view>
6
6
  <view class="ml-checkbox-content">
7
7
  <slot>
8
- <text>{{ content }}</text>
8
+ <view>{{ content }}</view>
9
9
  </slot>
10
10
  </view>
11
11
  </view>
@@ -53,13 +53,13 @@ export default {
53
53
 
54
54
  <style lang="scss">
55
55
  .ml-checkbox {
56
- display: inline-block;
56
+ display: inline-flex;
57
57
  margin-right: 20rpx;
58
+ align-items: center;
58
59
  &.is-checked {
59
60
  color: $uni-color-primary;
60
61
  }
61
62
  .ml-checkbox-icon {
62
- display: inline-block;
63
63
  width: 40rpx;
64
64
  margin-right: 10rpx;
65
65
  text-align: center;
@@ -67,10 +67,9 @@ export default {
67
67
  }
68
68
  .ml-checkbox-icon,
69
69
  .ml-checkbox-content {
70
- vertical-align: middle;
71
- }
72
- .ml-checkbox-content {
73
- display: inline-block;
70
+ display: inline-flex;
71
+ align-items: center;
72
+ flex-direction: row;
74
73
  }
75
74
  }
76
75
  </style>
@@ -1,6 +1,6 @@
1
1
  <template>
2
- <view class="ml-radio-group" :class="[className || '', {'is-disabled': disabled, 'is-vertical': vertical}]">
3
- <view class="ml-radio-group-item" v-for="(item, index) in options" :key="index">
2
+ <view class="ml-checkbox-group" :class="[className || '', {'is-disabled': disabled, 'is-vertical': vertical}]">
3
+ <view class="ml-checkbox-group-item" v-for="(item, index) in options" :key="index">
4
4
  <ml-checkbox :value="value.includes(item.value) ? item.value : null" :label="item.value" :content="item.label" :disabled="disabled || item.disabled" @change="changeEvent"></ml-checkbox>
5
5
  </view>
6
6
  </view>
@@ -33,12 +33,12 @@ export default {
33
33
  </script>
34
34
 
35
35
  <style lang="scss">
36
- .ml-radio-group {
36
+ .ml-checkbox-group {
37
37
  display: inline-flex;
38
38
  &.is-vertical {
39
39
  width: 100%;
40
40
  flex-direction: column;
41
- & > .ml-radio-group-item {
41
+ & > .ml-checkbox-group-item {
42
42
  margin: 4rpx 0;
43
43
  }
44
44
  }
@@ -1,5 +1,5 @@
1
1
  <template>
2
- <view class="ml-list-group" :class="className">
2
+ <view class="ml-list-group" :class="[className || '']">
3
3
  <view class="ml-list-group-content" :style="contentStyle">
4
4
  <scroll-view scroll-y>
5
5
  <slot></slot>
@@ -74,12 +74,9 @@ export default {
74
74
  display: flex;
75
75
  flex-direction: row;
76
76
  padding: 20rpx;
77
- margin: 20rpx 0;
77
+ margin-bottom: 20rpx;
78
78
  border-radius: 10rpx;
79
79
  background: #ffffff;
80
- &:first-child {
81
- margin-top: 0;
82
- }
83
80
  &:last-child {
84
81
  margin-bottom: 0;
85
82
  }
@@ -81,10 +81,11 @@ export default {
81
81
  .ml-list-menu-item {
82
82
  display: flex;
83
83
  flex-direction: row;
84
+ align-items: center;
84
85
  border-bottom: 1px solid #e5e5e5;
85
- line-height: 90rpx;
86
+ min-height: 90rpx;
86
87
  font-size: 30rpx;
87
- padding: 0 20rpx;
88
+ padding: 10rpx 20rpx;
88
89
  background: #ffffff;
89
90
  &:first-child {
90
91
  border-top: 1px solid #e5e5e5;
@@ -1,17 +1,19 @@
1
1
  <template>
2
- <view class="ml-popup" :class="[className || '', {'is-visible': value}]">
3
- <view v-if="value" class="ml-popup-warpper">
2
+ <view class="ml-popup" :class="[className || '', {'is-visible': visible, 'is-animate': isAnimate}]" @tap="tapMaskEvent">
3
+ <view v-if="visible" class="ml-popup-warpper" @tap.stop>
4
4
  <view v-if="showHeader" class="ml-popup-header">
5
5
  <slot name="header">
6
6
  <view v-if="title" class="ml-popup-header-title">{{ title }}</view>
7
7
  </slot>
8
8
  </view>
9
9
  <view class="ml-popup-body" :style="bodyStyles">
10
- <slot></slot>
10
+ <scroll-view scroll-y>
11
+ <slot></slot>
12
+ </scroll-view>
11
13
  </view>
12
14
  <view v-if="showConfirmButton || showCancelButton" class="ml-popup-footer">
13
- <ml-button width="40%" round>{{ cancelButtonText }}</ml-button>
14
- <ml-button status="primary" width="40%" round>{{ confirmButtonText }}</ml-button>
15
+ <ml-button v-if="showCancelButton" width="40%" round @click="cancelEvent">{{ cancelButtonText }}</ml-button>
16
+ <ml-button v-if="showConfirmButton" status="primary" width="40%" round @click="confirmEvent">{{ confirmButtonText }}</ml-button>
15
17
  </view>
16
18
  </view>
17
19
  </view>
@@ -28,29 +30,91 @@ export default {
28
30
  type: Boolean,
29
31
  default: true
30
32
  },
33
+ maskClosable: Boolean,
31
34
  showConfirmButton: Boolean,
32
35
  confirmButtonText: {
33
36
  type: String,
34
37
  default: '确认'
35
38
  },
39
+ confirmClosable: Boolean,
36
40
  showCancelButton: Boolean,
37
41
  cancelButtonText: {
38
42
  type: String,
39
43
  default: '取消'
40
44
  },
45
+ cancelClosable: {
46
+ type: Boolean,
47
+ default: true
48
+ },
41
49
  className: String
42
50
  },
51
+ data () {
52
+ return {
53
+ visible: false,
54
+ isAnimate: false,
55
+ animateTime: null
56
+ }
57
+ },
43
58
  computed: {
44
59
  bodyStyles () {
45
60
  return this.height ? `height:${this.height};` : ''
46
61
  }
47
62
  },
63
+ watch: {
64
+ value (val) {
65
+ if (val) {
66
+ this.open()
67
+ } else {
68
+ this.close()
69
+ }
70
+ }
71
+ },
72
+ created () {
73
+ this.$nextTick(() => {
74
+ if (this.value) {
75
+ this.open()
76
+ } else {
77
+ this.close()
78
+ }
79
+ })
80
+ },
48
81
  methods: {
49
82
  close () {
50
-
83
+ clearTimeout(this.animateTime)
84
+ this.isAnimate = true
85
+ this.isAnimate = false
86
+ this.animateTime = setTimeout(() => {
87
+ this.visible = false
88
+ this.$emit('input', false)
89
+ this.$emit('show', {})
90
+ }, 300)
51
91
  },
52
92
  open () {
53
-
93
+ clearTimeout(this.animateTime)
94
+ this.isAnimate = false
95
+ this.visible = true
96
+ this.animateTime = setTimeout(() => {
97
+ this.isAnimate = true
98
+ this.$emit('hide', {})
99
+ }, 20)
100
+ this.$emit('input', true)
101
+ },
102
+ tapMaskEvent () {
103
+ if (this.maskClosable) {
104
+ this.close()
105
+ }
106
+ },
107
+ cancelEvent () {
108
+ if (this.cancelClosable) {
109
+ this.close()
110
+ }
111
+ this.$emit('cancel', {})
112
+ },
113
+ confirmEvent () {
114
+ if (this.confirmClosable) {
115
+ this.close()
116
+ }
117
+ this.$emit('confirm', {})
54
118
  }
55
119
  }
56
120
  }
@@ -68,6 +132,8 @@ export default {
68
132
  background-color: rgba(0, 0, 0, 0.4);
69
133
  &.is-visible {
70
134
  display: block;
135
+ }
136
+ &.is-animate {
71
137
  .ml-popup-warpper {
72
138
  transform: translateY(0);
73
139
  }
@@ -78,22 +144,28 @@ export default {
78
144
  bottom: 0;
79
145
  left: 0;
80
146
  width: 100%;
147
+ padding-bottom: 20rpx;
81
148
  transform: translateY(100%);
82
- transition: transform 300ms ease 0ms, transform 300ms ease 0ms;
149
+ transition: transform 0.3s ease, transform 0.3s ease;
83
150
  background: #fff;
84
151
  }
85
152
  .ml-popup-header-title {
86
153
  text-align: center;
87
154
  height: 70rpx;
88
155
  line-height: 70rpx;
156
+ font-size: $uni-font-size-base;
157
+ overflow: hidden;
158
+ text-overflow: ellipsis;
159
+ white-space: nowrap;
89
160
  }
90
161
  .ml-popup-body {
91
162
  padding: 20rpx;
92
163
  overflow: auto;
93
- height: 600rpx;
164
+ height: 500rpx;
94
165
  }
95
166
  .ml-popup-footer {
96
167
  display: flex;
97
168
  flex-direction: row;
169
+ padding: 20rpx;
98
170
  }
99
171
  </style>
@@ -5,7 +5,7 @@
5
5
  </view>
6
6
  <view class="ml-radio-content">
7
7
  <slot>
8
- <text>{{ content }}</text>
8
+ <view>{{ content }}</view>
9
9
  </slot>
10
10
  </view>
11
11
  </view>
@@ -44,22 +44,21 @@ export default {
44
44
 
45
45
  <style lang="scss">
46
46
  .ml-radio {
47
- display: inline-block;
47
+ display: inline-flex;
48
48
  margin-right: 20rpx;
49
+ align-items: center;
49
50
  &.is-checked {
50
51
  color: $uni-color-primary;
51
52
  }
52
53
  .ml-radio-icon {
53
- display: inline-block;
54
54
  margin-right: 10rpx;
55
55
  font-size: 1.4em;
56
56
  }
57
57
  .ml-radio-icon,
58
58
  .ml-radio-content {
59
- vertical-align: middle;
60
- }
61
- .ml-radio-content {
62
- display: inline-block;
59
+ display: inline-flex;
60
+ align-items: center;
61
+ flex-direction: row;
63
62
  }
64
63
  }
65
64
  </style>
@@ -143,10 +143,17 @@ export default {
143
143
  })
144
144
  this.selectUniFileList = this.urlList.map(url => {
145
145
  const name = this.getUrlName(url)
146
+ const extname = this.getSuffix(name)
147
+ const obj = {
148
+ [this.nameField]: name,
149
+ [this.typeField]: extname,
150
+ [this.urlField]: url
151
+ }
146
152
  return {
153
+ ...obj,
147
154
  name: name,
148
- extname: this.getSuffix(name),
149
- url: url
155
+ extname: extname,
156
+ url: this.getUrl(obj)
150
157
  }
151
158
  })
152
159
  this.isUpdate = true
@@ -158,9 +165,10 @@ export default {
158
165
  })
159
166
  this.selectUniFileList = this.value.map(item => {
160
167
  return {
168
+ ...item,
161
169
  name: item[this.nameField],
162
170
  extname: item[this.typeField],
163
- url: item[this.urlField]
171
+ url: this.getUrl(item)
164
172
  }
165
173
  })
166
174
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "mali-applet-ui",
3
- "version": "0.0.98",
3
+ "version": "0.0.100",
4
4
  "description": "码里云小程序组件库",
5
5
  "files": [
6
6
  "components",