mali-applet-ui 1.1.65 → 1.1.66

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,20 +1,31 @@
1
1
  <template>
2
2
  <view class="ml-progress-bar" :class="className">
3
- <view class="progress-bar-header">
3
+ <view v-if="showHeader || title" class="progress-bar-header">
4
4
  <slot name="header">
5
5
  <view v-if="title" class="progress-header-title" :class="{'is-underline': titleUnderline}">{{ title }}</view>
6
- <view v-if="title && showNum" class="progress-header-num">{{ value || 0 }}{{ unit || '' }}</view>
6
+ <view v-if="showTitleNum" class="progress-header-num">{{ titleNum || (`${value || 0}${unit || ''}`) }}</view>
7
7
  </slot>
8
8
  </view>
9
- <view class="progress-bar-chart" :class="{'show-num': !title && showNum}" @click="barClick">
10
- <progress
9
+ <view class="progress-bar-chart" @click="barClick">
10
+ <view v-if="showBarTitle" class="progress-bar-left" :style="barLeftStyle">
11
+ <slot name="bar_title">
12
+ <text>{{ barTitle || '' }}</text>
13
+ </slot>
14
+ </view>
15
+ <view class="progress-bar-content">
16
+ <progress
11
17
  :percent="percNum"
12
18
  :activeColor="activeColor || '#1890FF'"
13
19
  :backgroundColor="backgroundColor"
14
20
  :strokeWidth="strokeWidth"
15
21
  :fontSize="fontSize"
16
22
  :border-radius="borderRadius" />
17
- <view v-if="!title && showNum" class="progress-bar-num">{{ value || 0 }}{{ unit || '' }}</view>
23
+ </view>
24
+ <view v-if="showBarNum" class="progress-bar-right">
25
+ <slot name="bar_num">
26
+ <text>{{ barNum || (`${value || 0}${unit || ''}`) }}</text>
27
+ </slot>
28
+ </view>
18
29
  </view>
19
30
  <view class="progress-bar-footer">
20
31
  <slot name="footer"></slot>
@@ -38,9 +49,13 @@ export default {
38
49
  },
39
50
  title: String,
40
51
  titleUnderline: Boolean,
52
+ showHeader: Boolean,
53
+ showBarTitle: Boolean,
54
+ barTitle: String,
55
+ barTitleWidth: [Number, String],
41
56
  strokeWidth: {
42
57
  type: [Number, String],
43
- default: 12
58
+ default: 14
44
59
  },
45
60
  activeColor: String,
46
61
  fontSize: {
@@ -52,11 +67,21 @@ export default {
52
67
  default: '4rpx'
53
68
  },
54
69
  backgroundColor: String,
55
- showNum: Boolean,
70
+ showTitleNum: Boolean,
71
+ titleNum: [Number, String],
72
+ showBarNum: Boolean,
73
+ barNum: Boolean,
56
74
  unit: String,
57
75
  className: String
58
76
  },
59
77
  computed: {
78
+ barLeftStyle () {
79
+ let stys = ''
80
+ if (this.barTitleWidth) {
81
+ stys = `width: ${XEUtils.isString(this.barTitleWidth) ? this.barTitleWidth : `${this.barTitleWidth}rpx`}`
82
+ }
83
+ return stys
84
+ },
60
85
  percNum () {
61
86
  return Math.ceil(XEUtils.toNumber(this.value) / (Math.max(1, XEUtils.toNumber(this.max)) / 100))
62
87
  },
@@ -81,19 +106,28 @@ export default {
81
106
  text-align: left;
82
107
  }
83
108
  .progress-bar-chart {
84
- height: 24rpx;
109
+ display: flex;
110
+ flex-direction: row;
85
111
  position: relative;
86
112
  margin: 12rpx 0;
87
- &.show-num {
88
- padding-right: 80rpx;
113
+ .progress-bar-left,
114
+ .progress-bar-right {
115
+ flex-shrink: 0;
116
+ font-size: 24rpx;
117
+ padding: 0 4rpx;
118
+ overflow: hidden;
119
+ text-overflow: ellipsis;
120
+ white-space: nowrap;
89
121
  }
90
- .progress-bar-num {
91
- position: absolute;
92
- right: 0;
93
- top: 0;
94
- line-height: 24rpx;
95
- min-width: 38rpx;
96
- text-align: left;
122
+ .progress-bar-left {
123
+ width: 80rpx;
124
+ }
125
+ .progress-bar-right {
126
+ width: 120rpx;
127
+ }
128
+ .progress-bar-content {
129
+ flex-grow: 1;
130
+ overflow: hidden;
97
131
  }
98
132
  }
99
133
  .progress-header-title {
@@ -107,9 +141,7 @@ export default {
107
141
  }
108
142
  }
109
143
  .progress-header-num {
110
- flex-grow: 1;
111
- min-width: 60rpx;
112
- text-align: right;
144
+ flex-shrink: 0;
113
145
  }
114
146
  }
115
147
  </style>
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "mali-applet-ui",
3
- "version": "1.1.65",
3
+ "version": "1.1.66",
4
4
  "description": "码里UI-小程序组件库(vue2)",
5
5
  "files": [
6
6
  "lib",