sadais-piui 1.2.7-beta15 → 1.2.7-beta151
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.
- package/.prettierrc +8 -0
- package/components/pi-action-sheet/index.vue +260 -247
- package/components/pi-badge/index.vue +11 -1
- package/components/pi-bottom-bar/index.vue +1 -1
- package/components/pi-calendar/index.vue +207 -182
- package/components/pi-calendar-input/index.vue +61 -30
- package/components/pi-calendar-panel/components/calendar-days/index.vue +91 -52
- package/components/pi-calendar-panel/index.vue +28 -12
- package/components/pi-canvas/index.vue +8 -1
- package/components/pi-cascader/index.vue +601 -0
- package/components/pi-checkbox/index.vue +8 -4
- package/components/pi-checkbox-group/index.vue +12 -11
- package/components/pi-circle-progress/index.vue +53 -16
- package/components/pi-code-input/index.vue +11 -3
- package/components/pi-collapse/index.vue +16 -6
- package/components/pi-collapse-item/index.vue +35 -22
- package/components/pi-date-picker/index.vue +512 -391
- package/components/pi-date-picker-input/index.vue +61 -30
- package/components/pi-dropdown/components/dropdown-tab.vue +33 -23
- package/components/pi-dropdown/index.vue +34 -19
- package/components/pi-dropdown-item/index.vue +70 -58
- package/components/pi-form-item/index.vue +98 -20
- package/components/pi-grid/index.vue +1 -1
- package/components/pi-grid-item/index.vue +4 -4
- package/components/pi-img/index.vue +275 -267
- package/components/pi-img-cropper/index.vue +6 -3
- package/components/pi-input/index.vue +97 -36
- package/components/pi-list-item/index.vue +1 -1
- package/components/pi-marquee/index.vue +322 -310
- package/components/pi-marquee-pure-css/index.vue +267 -0
- package/components/pi-mask/index.vue +3 -1
- package/components/pi-modal/index.vue +311 -303
- package/components/pi-pagination/index.vue +13 -0
- package/components/pi-picker/index.vue +332 -317
- package/components/pi-popup/index.vue +4 -1
- package/components/pi-popup-select/index.vue +13 -4
- package/components/pi-radio/index.vue +12 -11
- package/components/pi-radio-group/index.vue +25 -5
- package/components/pi-regions-select/index.vue +6 -1
- package/components/pi-regions-select-input/index.vue +69 -31
- package/components/pi-search/index.vue +37 -2
- package/components/pi-section/index.vue +1 -1
- package/components/pi-select/index.vue +237 -22
- package/components/pi-select-input/index.vue +106 -41
- package/components/pi-stepper/index.vue +135 -121
- package/components/pi-steps/index.vue +115 -36
- package/components/pi-swiper/index.vue +22 -7
- package/components/pi-switch/index.vue +5 -1
- package/components/pi-table/index.vue +351 -0
- package/components/pi-tabs/index.vue +46 -10
- package/components/pi-upload-img/index.vue +895 -44
- package/components/pi-webview/index.vue +95 -82
- package/config/actionSheet.js +0 -1
- package/config/calendarInput.js +2 -1
- package/config/calendarPanel.js +2 -1
- package/config/cascader.js +22 -0
- package/config/circleProgress.js +12 -4
- package/config/codeInput.js +2 -1
- package/config/datePicker.js +29 -24
- package/config/datePickerInput.js +2 -1
- package/config/dropdown.js +3 -1
- package/config/input.js +5 -3
- package/config/marqueePureCss.js +18 -0
- package/config/regionsSelectInput.js +2 -1
- package/config/select.js +13 -1
- package/config/selectInput.js +2 -1
- package/config/steps.js +1 -1
- package/config/table.js +9 -0
- package/config/uploadImg.js +33 -11
- package/mixin/emitter.js +8 -1
- package/mixin/value-sync.js +5 -0
- package/package.json +5 -2
- package/scss/common.scss +11 -14
- package/scss/icon/icon.scss +2 -1
- package/scss/mixin.scss +5 -5
|
@@ -1,267 +1,275 @@
|
|
|
1
|
-
<template>
|
|
2
|
-
<view class="pi-img" :style="[rectStyle]">
|
|
3
|
-
<view
|
|
4
|
-
class="pi-align-center"
|
|
5
|
-
:style="[rectStyle, imageStyle, customStyle]"
|
|
6
|
-
:class="[customClass]"
|
|
7
|
-
@tap="handleButtonTap"
|
|
8
|
-
>
|
|
9
|
-
<image
|
|
10
|
-
:src="src"
|
|
11
|
-
:mode="mode"
|
|
12
|
-
:lazy-load="lazyLoad"
|
|
13
|
-
:style="[rectStyle, imageStyle]"
|
|
14
|
-
:show-menu-by-longpress="showMenuByLongpress"
|
|
15
|
-
|
|
16
|
-
@
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
<
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
:
|
|
27
|
-
:
|
|
28
|
-
:
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
<
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
},
|
|
82
|
-
//
|
|
83
|
-
|
|
84
|
-
type: String,
|
|
85
|
-
// '
|
|
86
|
-
default: img.
|
|
87
|
-
},
|
|
88
|
-
//
|
|
89
|
-
|
|
90
|
-
type:
|
|
91
|
-
// '
|
|
92
|
-
default: img.
|
|
93
|
-
},
|
|
94
|
-
//
|
|
95
|
-
|
|
96
|
-
type: [String, Number],
|
|
97
|
-
// '
|
|
98
|
-
default: img.
|
|
99
|
-
},
|
|
100
|
-
//
|
|
101
|
-
|
|
102
|
-
type:
|
|
103
|
-
//
|
|
104
|
-
default: img.
|
|
105
|
-
},
|
|
106
|
-
//
|
|
107
|
-
|
|
108
|
-
type:
|
|
109
|
-
//
|
|
110
|
-
default: img.
|
|
111
|
-
},
|
|
112
|
-
//
|
|
113
|
-
|
|
114
|
-
type: [String, Number],
|
|
115
|
-
//
|
|
116
|
-
default: img.
|
|
117
|
-
},
|
|
118
|
-
//
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
},
|
|
134
|
-
//
|
|
135
|
-
|
|
136
|
-
type:
|
|
137
|
-
//
|
|
138
|
-
default: img.
|
|
139
|
-
},
|
|
140
|
-
//
|
|
141
|
-
|
|
142
|
-
type: Boolean,
|
|
143
|
-
// true
|
|
144
|
-
default: img.
|
|
145
|
-
},
|
|
146
|
-
//
|
|
147
|
-
|
|
148
|
-
type: Boolean,
|
|
149
|
-
// true
|
|
150
|
-
default: img.
|
|
151
|
-
},
|
|
152
|
-
//
|
|
153
|
-
|
|
154
|
-
type:
|
|
155
|
-
//
|
|
156
|
-
default: img.
|
|
157
|
-
},
|
|
158
|
-
//
|
|
159
|
-
|
|
160
|
-
|
|
161
|
-
|
|
162
|
-
|
|
163
|
-
|
|
164
|
-
|
|
165
|
-
|
|
166
|
-
|
|
167
|
-
|
|
168
|
-
|
|
169
|
-
|
|
170
|
-
|
|
171
|
-
|
|
172
|
-
|
|
173
|
-
},
|
|
174
|
-
//
|
|
175
|
-
|
|
176
|
-
type:
|
|
177
|
-
//
|
|
178
|
-
default: img.
|
|
179
|
-
},
|
|
180
|
-
//
|
|
181
|
-
|
|
182
|
-
type: Boolean,
|
|
183
|
-
//
|
|
184
|
-
default: img.
|
|
185
|
-
}
|
|
186
|
-
|
|
187
|
-
|
|
188
|
-
|
|
189
|
-
|
|
190
|
-
|
|
191
|
-
|
|
192
|
-
|
|
193
|
-
|
|
194
|
-
|
|
195
|
-
|
|
196
|
-
|
|
197
|
-
|
|
198
|
-
|
|
199
|
-
|
|
200
|
-
|
|
201
|
-
|
|
202
|
-
|
|
203
|
-
},
|
|
204
|
-
|
|
205
|
-
|
|
206
|
-
|
|
207
|
-
|
|
208
|
-
|
|
209
|
-
|
|
210
|
-
|
|
211
|
-
|
|
212
|
-
|
|
213
|
-
|
|
214
|
-
|
|
215
|
-
|
|
216
|
-
|
|
217
|
-
}
|
|
218
|
-
|
|
219
|
-
|
|
220
|
-
|
|
221
|
-
|
|
222
|
-
|
|
223
|
-
|
|
224
|
-
|
|
225
|
-
|
|
226
|
-
|
|
227
|
-
|
|
228
|
-
|
|
229
|
-
|
|
230
|
-
|
|
231
|
-
|
|
232
|
-
|
|
233
|
-
|
|
234
|
-
this
|
|
235
|
-
|
|
236
|
-
|
|
237
|
-
|
|
238
|
-
|
|
239
|
-
|
|
240
|
-
|
|
241
|
-
.
|
|
242
|
-
|
|
243
|
-
|
|
244
|
-
|
|
245
|
-
|
|
246
|
-
|
|
247
|
-
|
|
248
|
-
|
|
249
|
-
|
|
250
|
-
|
|
251
|
-
|
|
252
|
-
|
|
253
|
-
|
|
254
|
-
|
|
255
|
-
|
|
256
|
-
|
|
257
|
-
|
|
258
|
-
|
|
259
|
-
|
|
260
|
-
|
|
261
|
-
|
|
262
|
-
|
|
263
|
-
|
|
264
|
-
|
|
265
|
-
|
|
266
|
-
|
|
267
|
-
|
|
1
|
+
<template>
|
|
2
|
+
<view class="pi-img" :style="[rectStyle]">
|
|
3
|
+
<view
|
|
4
|
+
class="pi-align-center"
|
|
5
|
+
:style="[rectStyle, imageStyle, customStyle]"
|
|
6
|
+
:class="[customClass]"
|
|
7
|
+
@tap="handleButtonTap"
|
|
8
|
+
>
|
|
9
|
+
<image
|
|
10
|
+
:src="src"
|
|
11
|
+
:mode="mode"
|
|
12
|
+
:lazy-load="lazyLoad"
|
|
13
|
+
:style="[rectStyle, imageStyle]"
|
|
14
|
+
:show-menu-by-longpress="showMenuByLongpress"
|
|
15
|
+
:webp="webp"
|
|
16
|
+
@error="handleError"
|
|
17
|
+
@load="handleLoad"
|
|
18
|
+
/>
|
|
19
|
+
<view class="pi-abso-center">
|
|
20
|
+
<!-- 加载中 -->
|
|
21
|
+
<template v-if="src && loading">
|
|
22
|
+
<!-- 加载中样式 -->
|
|
23
|
+
<slot v-if="$slots.loading" name="loading" />
|
|
24
|
+
<pi-loading
|
|
25
|
+
v-else
|
|
26
|
+
:show="loading"
|
|
27
|
+
:type="loadingType"
|
|
28
|
+
:color="loadingColor"
|
|
29
|
+
:size="loadingSize"
|
|
30
|
+
/>
|
|
31
|
+
</template>
|
|
32
|
+
<!-- 加载失败 -->
|
|
33
|
+
<template v-if="src && error">
|
|
34
|
+
<!-- 加载失败样式 -->
|
|
35
|
+
<slot v-if="$slots.error" name="error" />
|
|
36
|
+
<view v-else class="pi-icon-pic" />
|
|
37
|
+
</template>
|
|
38
|
+
</view>
|
|
39
|
+
</view>
|
|
40
|
+
<view
|
|
41
|
+
v-if="badge || dot"
|
|
42
|
+
class="img-badge"
|
|
43
|
+
:class="{ dot }"
|
|
44
|
+
:style="[badgeStyle]"
|
|
45
|
+
>
|
|
46
|
+
{{ badge }}
|
|
47
|
+
</view>
|
|
48
|
+
<view v-if="dot" />
|
|
49
|
+
</view>
|
|
50
|
+
</template>
|
|
51
|
+
|
|
52
|
+
<script>
|
|
53
|
+
/**
|
|
54
|
+
* 注意,必须指定宽度和高度,否则没办法显示低图和加载错误占位图
|
|
55
|
+
* 如果要自定义loading底图和请求失败图,请使用slot对本组件进行二次封装
|
|
56
|
+
*/
|
|
57
|
+
import { getConfig } from '../../config'
|
|
58
|
+
import { debounce } from '@sadais/piui-tool/tools/common'
|
|
59
|
+
|
|
60
|
+
const TAG = 'PiImg'
|
|
61
|
+
const { img } = getConfig()
|
|
62
|
+
|
|
63
|
+
export default {
|
|
64
|
+
name: 'PiImg',
|
|
65
|
+
props: {
|
|
66
|
+
// 自定义样式
|
|
67
|
+
customStyle: {
|
|
68
|
+
type: Object,
|
|
69
|
+
default() {
|
|
70
|
+
// {}
|
|
71
|
+
return img.customStyle
|
|
72
|
+
}
|
|
73
|
+
},
|
|
74
|
+
// 自定义样式类
|
|
75
|
+
customClass: {
|
|
76
|
+
type: String,
|
|
77
|
+
default() {
|
|
78
|
+
// ''
|
|
79
|
+
return img.customClass
|
|
80
|
+
}
|
|
81
|
+
},
|
|
82
|
+
// 图片地址
|
|
83
|
+
src: {
|
|
84
|
+
type: String,
|
|
85
|
+
// ''
|
|
86
|
+
default: img.src
|
|
87
|
+
},
|
|
88
|
+
// 裁剪模式
|
|
89
|
+
mode: {
|
|
90
|
+
type: String,
|
|
91
|
+
// 'widthFix'
|
|
92
|
+
default: img.mode
|
|
93
|
+
},
|
|
94
|
+
// 宽度
|
|
95
|
+
width: {
|
|
96
|
+
type: [String, Number],
|
|
97
|
+
// '100%'
|
|
98
|
+
default: img.width
|
|
99
|
+
},
|
|
100
|
+
// 高度
|
|
101
|
+
height: {
|
|
102
|
+
type: [String, Number],
|
|
103
|
+
// 'auto'
|
|
104
|
+
default: img.height
|
|
105
|
+
},
|
|
106
|
+
// 是否显示图标右上角小红点
|
|
107
|
+
dot: {
|
|
108
|
+
type: Boolean,
|
|
109
|
+
// false
|
|
110
|
+
default: img.dot
|
|
111
|
+
},
|
|
112
|
+
// 小红点的半径
|
|
113
|
+
dotRadius: {
|
|
114
|
+
type: [String, Number],
|
|
115
|
+
// 16
|
|
116
|
+
default: img.dotRadius
|
|
117
|
+
},
|
|
118
|
+
// 图标右上角徽标的内容
|
|
119
|
+
badge: {
|
|
120
|
+
type: [String, Number],
|
|
121
|
+
// ''
|
|
122
|
+
default: img.badge
|
|
123
|
+
},
|
|
124
|
+
// 图片形状
|
|
125
|
+
shape: {
|
|
126
|
+
// `'round'-圆形` `'square'-方形`
|
|
127
|
+
type: String,
|
|
128
|
+
// 'square'
|
|
129
|
+
default: img.shape,
|
|
130
|
+
validator: function(value) {
|
|
131
|
+
return ['square', 'round'].includes(value)
|
|
132
|
+
}
|
|
133
|
+
},
|
|
134
|
+
// shape为square的时候设置
|
|
135
|
+
borderRadius: {
|
|
136
|
+
type: [String, Number],
|
|
137
|
+
// 0
|
|
138
|
+
default: img.borderRadius
|
|
139
|
+
},
|
|
140
|
+
// 是否懒加载
|
|
141
|
+
lazyLoad: {
|
|
142
|
+
type: Boolean,
|
|
143
|
+
// true
|
|
144
|
+
default: img.lazyLoad
|
|
145
|
+
},
|
|
146
|
+
// 开启长按图片显示识别微信小程序码菜单
|
|
147
|
+
showMenuByLongpress: {
|
|
148
|
+
type: Boolean,
|
|
149
|
+
// true
|
|
150
|
+
default: img.showMenuByLongpress
|
|
151
|
+
},
|
|
152
|
+
// 是否显示加载中的图标或者自定义的slot
|
|
153
|
+
showLoading: {
|
|
154
|
+
type: Boolean,
|
|
155
|
+
// true
|
|
156
|
+
default: img.showLoading
|
|
157
|
+
},
|
|
158
|
+
// 加载中颜色
|
|
159
|
+
loadingColor: {
|
|
160
|
+
type: String,
|
|
161
|
+
// '#c1c1c1'
|
|
162
|
+
default: img.loadingColor
|
|
163
|
+
},
|
|
164
|
+
// loading类型
|
|
165
|
+
loadingType: {
|
|
166
|
+
// `'spinner'-菊花` `'round'-圆环`
|
|
167
|
+
type: String,
|
|
168
|
+
// 'spinner'
|
|
169
|
+
default: img.loadingType,
|
|
170
|
+
validator: function(value) {
|
|
171
|
+
return ['spinner', 'round'].includes(value)
|
|
172
|
+
}
|
|
173
|
+
},
|
|
174
|
+
// 尺寸
|
|
175
|
+
loadingSize: {
|
|
176
|
+
type: [String, Number],
|
|
177
|
+
// 32
|
|
178
|
+
default: img.loadingSize
|
|
179
|
+
},
|
|
180
|
+
// 是否显示加载中的图标或者自定义的slot
|
|
181
|
+
showError: {
|
|
182
|
+
type: Boolean,
|
|
183
|
+
// true
|
|
184
|
+
default: img.showError
|
|
185
|
+
},
|
|
186
|
+
// 默认不解析 webP 格式,只支持网络资源
|
|
187
|
+
webp: {
|
|
188
|
+
type: Boolean,
|
|
189
|
+
// false
|
|
190
|
+
default: img.webp
|
|
191
|
+
}
|
|
192
|
+
},
|
|
193
|
+
data() {
|
|
194
|
+
return {
|
|
195
|
+
loading: this.showLoading,
|
|
196
|
+
// 图片是否加载错误,如果是,则显示错误占位图
|
|
197
|
+
error: false
|
|
198
|
+
}
|
|
199
|
+
},
|
|
200
|
+
computed: {
|
|
201
|
+
getDotRadius() {
|
|
202
|
+
return this.$pi.common.addUnit(this.dotRadius)
|
|
203
|
+
},
|
|
204
|
+
rectStyle() {
|
|
205
|
+
return {
|
|
206
|
+
width: this.$pi.common.addUnit(this.width),
|
|
207
|
+
height: this.$pi.common.addUnit(this.height)
|
|
208
|
+
}
|
|
209
|
+
},
|
|
210
|
+
badgeStyle() {
|
|
211
|
+
const style = {}
|
|
212
|
+
if (this.dot) {
|
|
213
|
+
style.width = this.getDotRadius
|
|
214
|
+
style.height = this.getDotRadius
|
|
215
|
+
}
|
|
216
|
+
return style
|
|
217
|
+
},
|
|
218
|
+
imageStyle() {
|
|
219
|
+
return {
|
|
220
|
+
overflow: 'hidden',
|
|
221
|
+
borderRadius:
|
|
222
|
+
this.shape === 'round'
|
|
223
|
+
? '50%'
|
|
224
|
+
: this.$pi.common.addUnit(this.borderRadius)
|
|
225
|
+
}
|
|
226
|
+
}
|
|
227
|
+
},
|
|
228
|
+
methods: {
|
|
229
|
+
handleButtonTap: debounce(function(e) {
|
|
230
|
+
this.$emit('click', e)
|
|
231
|
+
}, 200),
|
|
232
|
+
handleError() {
|
|
233
|
+
console.log(TAG, '图片加载失败')
|
|
234
|
+
this.error = true
|
|
235
|
+
this.loading = false
|
|
236
|
+
// 图片加载完成
|
|
237
|
+
this.$emit('load')
|
|
238
|
+
},
|
|
239
|
+
handleLoad() {
|
|
240
|
+
this.error = false
|
|
241
|
+
this.loading = false
|
|
242
|
+
this.$emit('load')
|
|
243
|
+
}
|
|
244
|
+
}
|
|
245
|
+
}
|
|
246
|
+
</script>
|
|
247
|
+
|
|
248
|
+
<style lang="scss" scoped>
|
|
249
|
+
.pi-img {
|
|
250
|
+
position: relative;
|
|
251
|
+
.img-badge {
|
|
252
|
+
position: absolute;
|
|
253
|
+
top: 0;
|
|
254
|
+
right: 0;
|
|
255
|
+
box-sizing: border-box;
|
|
256
|
+
min-width: 16px;
|
|
257
|
+
padding: 0 3px;
|
|
258
|
+
font-size: 12px;
|
|
259
|
+
font-weight: 500;
|
|
260
|
+
line-height: 1.2;
|
|
261
|
+
color: #ffffff;
|
|
262
|
+
text-align: center;
|
|
263
|
+
background-color: #ee0a24;
|
|
264
|
+
border: 1px solid #ffffff;
|
|
265
|
+
border-radius: 16px;
|
|
266
|
+
transform: translate(50%, -50%);
|
|
267
|
+
transform-origin: 100%;
|
|
268
|
+
&.dot {
|
|
269
|
+
min-width: 0;
|
|
270
|
+
background-color: #ee0a24;
|
|
271
|
+
border-radius: 100%;
|
|
272
|
+
}
|
|
273
|
+
}
|
|
274
|
+
}
|
|
275
|
+
</style>
|
|
@@ -18,7 +18,7 @@
|
|
|
18
18
|
v-if="canvasId"
|
|
19
19
|
:id="canvasId"
|
|
20
20
|
:canvas-id="canvasId"
|
|
21
|
-
style="position: absolute; left: -500000px; top: -500000px
|
|
21
|
+
style="position: absolute; left: -500000px; top: -500000px"
|
|
22
22
|
:style="canvasStyle"
|
|
23
23
|
/>
|
|
24
24
|
</view>
|
|
@@ -175,7 +175,7 @@ export default {
|
|
|
175
175
|
this.initImage()
|
|
176
176
|
}
|
|
177
177
|
},
|
|
178
|
-
|
|
178
|
+
mounted() {
|
|
179
179
|
uni.getSystemInfo({
|
|
180
180
|
success: result => {
|
|
181
181
|
this.ratio = result.windowWidth / 750
|
|
@@ -187,7 +187,10 @@ export default {
|
|
|
187
187
|
},
|
|
188
188
|
methods: {
|
|
189
189
|
async initUI() {
|
|
190
|
-
const { width, height } = await this.getContainerSize()
|
|
190
|
+
const { width, height } = (await this.getContainerSize()) || {
|
|
191
|
+
width: 0,
|
|
192
|
+
height: 0
|
|
193
|
+
}
|
|
191
194
|
this.root = {
|
|
192
195
|
width,
|
|
193
196
|
height
|