mali-applet-ui 1.1.65 → 1.1.67

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