mali-applet-ui 0.2.6 → 0.2.7

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.
@@ -1,7 +1,10 @@
1
1
  <template>
2
- <view v-if="isFromReadonly" class="ml-amount-input is-readonly">
2
+ <view v-if="isFromReadonly" class="ml-amount-input is-readonly" :class="[className || '', {'is-right': align === 'right'}]">
3
3
  <view class="ml-amount-input-readonly-content">¥{{ amountLabel }}</view>
4
4
  </view>
5
+ <view v-else-if="!editable && platformEnv.isQW" class="ml-amount-input not-edit" :class="[className || '', {'is-right': align === 'right', 'is-border': border}]">
6
+ <view class="ml-amount-input-simulate">{{ inpVal }}</view>
7
+ </view>
5
8
  <view v-else class="ml-amount-input" :class="[{'is-right': align === 'right', 'is-border': border, 'is-disabled': disabled, 'is-clear': clearable && inpVal}, className]">
6
9
  <view v-if="showTip" class="ml-amount-tip">
7
10
  <view>首位:</view>
@@ -25,7 +28,7 @@
25
28
 
26
29
  <script>
27
30
  import XEUtils from 'xe-utils'
28
- import { toAmountString, toWanAmountString } from '../../utils'
31
+ import { getPlatformEnv, toAmountString, toWanAmountString } from '../../utils'
29
32
 
30
33
  function eqEmptyNull (value) {
31
34
  return value === '' || XEUtils.eqNull(value)
@@ -60,6 +63,10 @@ export default {
60
63
  type: Boolean,
61
64
  default: false
62
65
  },
66
+ editable: {
67
+ type: Boolean,
68
+ default: true
69
+ },
63
70
  showTip: Boolean,
64
71
  clearable: Boolean,
65
72
  className: String
@@ -72,6 +79,7 @@ export default {
72
79
  },
73
80
  data () {
74
81
  return {
82
+ platformEnv: getPlatformEnv(),
75
83
  inpVal: ''
76
84
  }
77
85
  },
@@ -205,13 +213,24 @@ export default {
205
213
  .ml-amount-input-readonly-content {
206
214
  padding: 20rpx 4rpx;
207
215
  }
216
+ .ml-amount-input-simulate {
217
+ padding: 0 10rpx;
218
+ height: 70rpx;
219
+ line-height: 70rpx;
220
+ overflow: hidden;
221
+ text-overflow: ellipsis;
222
+ white-space: nowrap;
223
+ background: #ffffff;
224
+ }
208
225
  &.is-right {
209
- .ml-amount-input-inp {
226
+ .ml-amount-input-inp
227
+ .ml-amount-input-simulate {
210
228
  text-align: right;
211
229
  }
212
230
  }
213
231
  &.is-border {
214
- .ml-amount-input-inp {
232
+ .ml-amount-input-inp
233
+ .ml-amount-input-simulate {
215
234
  border: 1px solid #e5e5e5;
216
235
  border-radius: $ml-border-radius;
217
236
  }
@@ -228,7 +247,8 @@ export default {
228
247
  text-align: right;
229
248
  }
230
249
  }
231
- .ml-amount-input-inp {
250
+ .ml-amount-input-inp
251
+ .ml-amount-input-simulate {
232
252
  font-size: $uni-font-size-base;
233
253
  width: 100%;
234
254
  height: 70rpx;
@@ -1,8 +1,8 @@
1
1
  <template>
2
- <view v-if="isFromReadonly" class="ml-input is-readonly" :class="[className || '', {'is-right': align === 'right', 'is-border': border}]">
2
+ <view v-if="isFromReadonly" class="ml-input is-readonly" :class="[className || '', {'is-right': align === 'right'}]">
3
3
  <view class="ml-input-readonly-content">{{ inpVal }}</view>
4
4
  </view>
5
- <view v-else-if="!editable" class="ml-input not-edit" :class="[className || '', {'is-right': align === 'right', 'is-border': border}]">
5
+ <view v-else-if="!editable && platformEnv.isQW" class="ml-input not-edit" :class="[className || '', {'is-right': align === 'right', 'is-border': border}]">
6
6
  <view class="ml-input-simulate">{{ inpVal }}</view>
7
7
  </view>
8
8
  <view v-else class="ml-input" :class="[className || '', {'is-right': align === 'right', 'is-border': border, 'is-prefix': prefixIcon || type === 'search', 'is-suffix': suffixIcon, 'is-disabled': disabled, 'is-clear': clearable && inpVal}]">
@@ -33,6 +33,8 @@
33
33
  </template>
34
34
 
35
35
  <script>
36
+ import { getPlatformEnv } from '../../utils/applet'
37
+
36
38
  export default {
37
39
  name: 'MlInput',
38
40
  options: {
@@ -70,6 +72,7 @@ export default {
70
72
  },
71
73
  data () {
72
74
  return {
75
+ platformEnv: getPlatformEnv(),
73
76
  inpVal: ''
74
77
  }
75
78
  },
@@ -167,7 +170,8 @@ export default {
167
170
  border-left: 0;
168
171
  }
169
172
  &.is-right {
170
- .ml-input-inp {
173
+ .ml-input-inp,
174
+ .ml-input-simulate {
171
175
  text-align: right;
172
176
  }
173
177
  }
@@ -2,6 +2,9 @@
2
2
  <view v-if="isFromReadonly" class="ml-number-input is-readonly">
3
3
  <view class="ml-number-input-readonly-content">{{ inpVal }}</view>
4
4
  </view>
5
+ <view v-else-if="!editable && platformEnv.isQW" class="ml-number-input not-edit" :class="[className || '', {'is-right': align === 'right', 'is-border': border}]">
6
+ <view class="ml-number-input-simulate">{{ inpVal }}</view>
7
+ </view>
5
8
  <view v-else class="ml-number-input" :class="[{'is-right': align === 'right', 'is-border': border, 'is-disabled': disabled, 'is-clear': clearable && inpVal}, className]">
6
9
  <input
7
10
  class="ml-number-input-inp"
@@ -22,6 +25,7 @@
22
25
 
23
26
  <script>
24
27
  import XEUtils from 'xe-utils'
28
+ import { getPlatformEnv } from '../../utils/applet'
25
29
 
26
30
  function eqEmptyNull (value) {
27
31
  return value === '' || XEUtils.eqNull(value)
@@ -49,11 +53,16 @@ export default {
49
53
  type: Boolean,
50
54
  default: false
51
55
  },
56
+ editable: {
57
+ type: Boolean,
58
+ default: true
59
+ },
52
60
  clearable: Boolean,
53
61
  className: String
54
62
  },
55
63
  data () {
56
64
  return {
65
+ platformEnv: getPlatformEnv(),
57
66
  inpVal: ''
58
67
  }
59
68
  },
@@ -118,14 +127,30 @@ export default {
118
127
  .ml-number-input-readonly-content {
119
128
  padding: 20rpx 4rpx;
120
129
  }
130
+ .ml-number-input-simulate {
131
+ padding: 0 10rpx;
132
+ height: 70rpx;
133
+ line-height: 70rpx;
134
+ overflow: hidden;
135
+ text-overflow: ellipsis;
136
+ white-space: nowrap;
137
+ background: #ffffff;
138
+ }
121
139
  &.is-right {
122
- text-align: right;
140
+ .ml-number-input-inp,
141
+ .ml-number-input-simulate {
142
+ text-align: right;
143
+ }
123
144
  }
124
145
  &.is-border {
125
- border: 1px solid #e5e5e5;
126
- border-radius: $ml-border-radius;
146
+ .ml-number-input-inp,
147
+ .ml-number-input-simulate {
148
+ border: 1px solid #e5e5e5;
149
+ border-radius: $ml-border-radius;
150
+ }
127
151
  }
128
- .ml-number-input-inp {
152
+ .ml-number-input-inp,
153
+ .ml-number-input-simulate {
129
154
  font-size: $uni-font-size-base;
130
155
  width: 100%;
131
156
  height: 70rpx;
@@ -1,8 +1,8 @@
1
1
  <template>
2
- <view v-if="isFromReadonly" class="ml-textarea is-readonly" :class="[className || '', {'is-right': align === 'right', 'is-border': border}]">
2
+ <view v-if="isFromReadonly" class="ml-textarea is-readonly" :class="[className || '', {'is-right': align === 'right'}]">
3
3
  <view class="ml-textarea-readonly-content">{{ inpVal }}</view>
4
4
  </view>
5
- <view v-else-if="!editable" class="ml-textarea not-edit" :class="[className || '', {'is-right': align === 'right', 'is-border': border}]">
5
+ <view v-else-if="!editable && platformEnv.isQW" class="ml-textarea not-edit" :class="[className || '', {'is-right': align === 'right', 'is-border': border}]">
6
6
  <view class="ml-textarea-simulate" :style="{color: fontColor, height: `${rows * 30}rpx`}">{{ inpVal }}</view>
7
7
  <view v-if="showWordLimit && !disabled" class="ml-textarea-word-count">
8
8
  <!-- <VoiceInput v-if="showVoice" v-model="inpVal" @input="inputEvent"></VoiceInput> -->
@@ -32,6 +32,7 @@
32
32
  </template>
33
33
 
34
34
  <script>
35
+ import { getPlatformEnv } from '../../utils/applet'
35
36
  // import VoiceInput from './voice-input.vue'
36
37
 
37
38
  export default {
@@ -85,6 +86,7 @@ export default {
85
86
  },
86
87
  data () {
87
88
  return {
89
+ platformEnv: getPlatformEnv(),
88
90
  inpVal: ''
89
91
  }
90
92
  },
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "mali-applet-ui",
3
- "version": "0.2.6",
3
+ "version": "0.2.7",
4
4
  "description": "码里云小程序组件库",
5
5
  "scripts": {
6
6
  "release": "node script/release.js && npm publish"
package/utils/applet.js CHANGED
@@ -1,7 +1,7 @@
1
1
  /**
2
- * 获取当前平台信息
2
+ * 当前小程序运行环境
3
3
  */
4
- export function getPlatformInfo () {
4
+ export function getPlatformEnv () {
5
5
  const sysRes = uni.getSystemInfoSync()
6
6
  const hostName = sysRes.hostName
7
7
  const platform = {