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
|
@@ -12,7 +12,12 @@
|
|
|
12
12
|
:style="[computedLabelStyle, getLabelStyle]"
|
|
13
13
|
:class="[{ border: getWrap && getLabelWrapBorder }]"
|
|
14
14
|
>
|
|
15
|
-
<view
|
|
15
|
+
<view
|
|
16
|
+
v-if="required"
|
|
17
|
+
style="color: #ed2235;"
|
|
18
|
+
class="pi-mg-right-12"
|
|
19
|
+
:style="[requiredStyle]"
|
|
20
|
+
>
|
|
16
21
|
*
|
|
17
22
|
</view>
|
|
18
23
|
<!-- 表单项label -->
|
|
@@ -28,7 +33,11 @@
|
|
|
28
33
|
:class="[
|
|
29
34
|
{ 'pi-flex-sub': !getWrap },
|
|
30
35
|
getInputAlign,
|
|
31
|
-
{
|
|
36
|
+
{
|
|
37
|
+
'wrap': getWrap,
|
|
38
|
+
'nowrap': !getWrap,
|
|
39
|
+
'wrap-bottom': getWrap && getWrapBottomGap
|
|
40
|
+
}
|
|
32
41
|
]"
|
|
33
42
|
:style="[contentWrapStyle]"
|
|
34
43
|
>
|
|
@@ -41,7 +50,11 @@
|
|
|
41
50
|
<slot />
|
|
42
51
|
</view>
|
|
43
52
|
<view
|
|
44
|
-
v-if="
|
|
53
|
+
v-if="
|
|
54
|
+
getErrorType === 'message' &&
|
|
55
|
+
validateState === 'error' &&
|
|
56
|
+
validateMessage
|
|
57
|
+
"
|
|
45
58
|
class="form-valid"
|
|
46
59
|
>
|
|
47
60
|
<view class="form-valid-item">{{ validateMessage }}</view>
|
|
@@ -262,17 +275,24 @@ export default {
|
|
|
262
275
|
},
|
|
263
276
|
data() {
|
|
264
277
|
return {
|
|
278
|
+
componentDestroy: false,
|
|
265
279
|
initialValue: '', // 初始值
|
|
266
|
-
validateState: '', // 是否校验成功
|
|
280
|
+
validateState: 'success', // 是否校验成功
|
|
267
281
|
validateMessage: '' // 校验失败的提示语
|
|
268
282
|
}
|
|
269
283
|
},
|
|
270
284
|
computed: {
|
|
271
285
|
getShowRightIcon() {
|
|
272
|
-
return this.$pi.expand.getPropValue(
|
|
286
|
+
return this.$pi.expand.getPropValue(
|
|
287
|
+
this.inheritProps.showRightIcon,
|
|
288
|
+
this.showRightIcon
|
|
289
|
+
)
|
|
273
290
|
},
|
|
274
291
|
getRightIcon() {
|
|
275
|
-
const rightIcon = this.$pi.lang.mergeDeep(
|
|
292
|
+
const rightIcon = this.$pi.lang.mergeDeep(
|
|
293
|
+
this.inheritProps.rightIcon,
|
|
294
|
+
this.rightIcon
|
|
295
|
+
)
|
|
276
296
|
return this.$pi.lang.mergeDeep(formItem.rightIcon, rightIcon)
|
|
277
297
|
},
|
|
278
298
|
getBorder() {
|
|
@@ -282,7 +302,10 @@ export default {
|
|
|
282
302
|
return this.$pi.expand.getPropValue(this.inheritProps.wrap, this.wrap)
|
|
283
303
|
},
|
|
284
304
|
getWrapBottomGap() {
|
|
285
|
-
return this.$pi.expand.getPropValue(
|
|
305
|
+
return this.$pi.expand.getPropValue(
|
|
306
|
+
this.inheritProps.wrapBottomGap,
|
|
307
|
+
this.wrapBottomGap
|
|
308
|
+
)
|
|
286
309
|
},
|
|
287
310
|
getLabelWrapBorder() {
|
|
288
311
|
return this.inheritProps.labelWrapBorder !== null
|
|
@@ -293,23 +316,38 @@ export default {
|
|
|
293
316
|
return this.$pi.expand.getPropValue(this.inheritProps.colon, this.colon)
|
|
294
317
|
},
|
|
295
318
|
getDisabled() {
|
|
296
|
-
return this.$pi.expand.getPropValue(
|
|
319
|
+
return this.$pi.expand.getPropValue(
|
|
320
|
+
this.inheritProps.disabled,
|
|
321
|
+
this.disabled
|
|
322
|
+
)
|
|
297
323
|
},
|
|
298
324
|
getLabelAlign() {
|
|
299
|
-
return this.$pi.expand.getPropValue(
|
|
325
|
+
return this.$pi.expand.getPropValue(
|
|
326
|
+
this.inheritProps.labelAlign,
|
|
327
|
+
this.labelAlign
|
|
328
|
+
)
|
|
300
329
|
},
|
|
301
330
|
getInputAlign() {
|
|
302
|
-
return this.$pi.expand.getPropValue(
|
|
331
|
+
return this.$pi.expand.getPropValue(
|
|
332
|
+
this.inheritProps.inputAlign,
|
|
333
|
+
this.inputAlign
|
|
334
|
+
)
|
|
303
335
|
},
|
|
304
336
|
getErrorType() {
|
|
305
337
|
return this.inheritProps.errorType
|
|
306
338
|
},
|
|
307
339
|
getPadding() {
|
|
308
|
-
const padding = this.$pi.expand.getPropValue(
|
|
340
|
+
const padding = this.$pi.expand.getPropValue(
|
|
341
|
+
this.inheritProps.padding,
|
|
342
|
+
this.padding
|
|
343
|
+
)
|
|
309
344
|
return this.$pi.common.addUnit(padding)
|
|
310
345
|
},
|
|
311
346
|
getHeight() {
|
|
312
|
-
const height = this.$pi.expand.getPropValue(
|
|
347
|
+
const height = this.$pi.expand.getPropValue(
|
|
348
|
+
this.inheritProps.height,
|
|
349
|
+
this.height
|
|
350
|
+
)
|
|
313
351
|
return this.$pi.common.addUnit(height)
|
|
314
352
|
},
|
|
315
353
|
itemStyle() {
|
|
@@ -320,7 +358,10 @@ export default {
|
|
|
320
358
|
return style
|
|
321
359
|
},
|
|
322
360
|
getLabelStyle() {
|
|
323
|
-
return this.$pi.expand.getPropValue(
|
|
361
|
+
return this.$pi.expand.getPropValue(
|
|
362
|
+
this.inheritProps.labelStyle,
|
|
363
|
+
this.labelStyle
|
|
364
|
+
)
|
|
324
365
|
},
|
|
325
366
|
getItemVerticalAlign() {
|
|
326
367
|
return this.$pi.expand.getPropValue(
|
|
@@ -374,6 +415,12 @@ export default {
|
|
|
374
415
|
mounted() {
|
|
375
416
|
this.initRulesValidation()
|
|
376
417
|
},
|
|
418
|
+
created() {
|
|
419
|
+
this.componentDestroy = false
|
|
420
|
+
},
|
|
421
|
+
beforeDestroy() {
|
|
422
|
+
this.componentDestroy = true
|
|
423
|
+
},
|
|
377
424
|
methods: {
|
|
378
425
|
handleItemClick(e) {
|
|
379
426
|
this.$emit('click', e)
|
|
@@ -400,7 +447,7 @@ export default {
|
|
|
400
447
|
// 从pi-form的rules属性中,取出当前pi-form-item的校验规则
|
|
401
448
|
getRules() {
|
|
402
449
|
// 父组件的所有规则
|
|
403
|
-
const parentRules = this._parent &&
|
|
450
|
+
const parentRules = this._parent && this._parent.validRules
|
|
404
451
|
const rules = parentRules ? parentRules[this.prop] : []
|
|
405
452
|
return [].concat(rules || [])
|
|
406
453
|
},
|
|
@@ -409,7 +456,22 @@ export default {
|
|
|
409
456
|
let rules = this.getRules()
|
|
410
457
|
// 整体验证表单时,triggerType为空字符串
|
|
411
458
|
if (!triggerType) return rules
|
|
412
|
-
return rules.filter(
|
|
459
|
+
return rules.filter(
|
|
460
|
+
res => res.trigger && res.trigger.indexOf(triggerType) !== -1
|
|
461
|
+
)
|
|
462
|
+
},
|
|
463
|
+
getFieldValue(obj, keypath) {
|
|
464
|
+
if (obj) {
|
|
465
|
+
return keypath.split('-').reduce((prev, key) => {
|
|
466
|
+
let tmpKey = key
|
|
467
|
+
if (/^\[\d+\]$/.test(key)) {
|
|
468
|
+
tmpKey = tmpKey.slice(1, -1)
|
|
469
|
+
}
|
|
470
|
+
prev = prev && prev[tmpKey]
|
|
471
|
+
return prev
|
|
472
|
+
}, obj)
|
|
473
|
+
}
|
|
474
|
+
return undefined
|
|
413
475
|
},
|
|
414
476
|
// 校验数据
|
|
415
477
|
validation(trigger) {
|
|
@@ -422,10 +484,20 @@ export default {
|
|
|
422
484
|
}
|
|
423
485
|
return new Promise((resolve, reject) => {
|
|
424
486
|
const rules = this.getFilteredRule(trigger)
|
|
425
|
-
if (
|
|
487
|
+
if (
|
|
488
|
+
this.componentDestroy ||
|
|
489
|
+
!this.prop ||
|
|
490
|
+
!rules ||
|
|
491
|
+
rules.length === 0
|
|
492
|
+
) {
|
|
493
|
+
this.validateState = 'success'
|
|
494
|
+
this.validateMessage = ''
|
|
495
|
+
console.log(TAG, '字段无需校验', this.prop)
|
|
426
496
|
return resolve(_getResolve())
|
|
427
497
|
}
|
|
428
|
-
const fieldValue = this._parent
|
|
498
|
+
const fieldValue = this._parent
|
|
499
|
+
? this.getFieldValue(this._parent.model, this.prop)
|
|
500
|
+
: undefined
|
|
429
501
|
// 设置当前的装填,标识为校验中
|
|
430
502
|
this.validateState = 'validating'
|
|
431
503
|
// 调用async-validator的方法
|
|
@@ -449,7 +521,11 @@ export default {
|
|
|
449
521
|
resolve(_getResolve())
|
|
450
522
|
})
|
|
451
523
|
.catch(({ errors, fields }) => {
|
|
452
|
-
console.log(
|
|
524
|
+
console.log(
|
|
525
|
+
TAG,
|
|
526
|
+
'表单校验失败',
|
|
527
|
+
`字段名:${this.prop},字段值:${fieldValue}`
|
|
528
|
+
)
|
|
453
529
|
console.log(TAG, '字段值:', fieldValue)
|
|
454
530
|
console.log(TAG, '错误信息', errors)
|
|
455
531
|
console.log(TAG, '校验规则', fields)
|
|
@@ -490,7 +566,7 @@ export default {
|
|
|
490
566
|
}
|
|
491
567
|
&.border {
|
|
492
568
|
@include pi-border;
|
|
493
|
-
&::
|
|
569
|
+
&::before {
|
|
494
570
|
border: 0 solid $pi-form-border-color;
|
|
495
571
|
border-bottom-width: $pi-form-border-width;
|
|
496
572
|
}
|
|
@@ -498,15 +574,17 @@ export default {
|
|
|
498
574
|
.form-label {
|
|
499
575
|
font-weight: $pi-form-label-weight;
|
|
500
576
|
color: $pi-form-label-color;
|
|
577
|
+
white-space: nowrap;
|
|
501
578
|
&.border {
|
|
502
579
|
@include pi-border;
|
|
503
|
-
&::
|
|
580
|
+
&::before {
|
|
504
581
|
border: 0 solid $pi-form-border-color;
|
|
505
582
|
border-bottom-width: $pi-form-border-width;
|
|
506
583
|
}
|
|
507
584
|
}
|
|
508
585
|
}
|
|
509
586
|
.content-wrap {
|
|
587
|
+
overflow: hidden;
|
|
510
588
|
&.nowrap {
|
|
511
589
|
margin-left: 24rpx;
|
|
512
590
|
}
|
|
@@ -192,21 +192,21 @@ export default {
|
|
|
192
192
|
vertical-align: middle;
|
|
193
193
|
&.border {
|
|
194
194
|
@include pi-border;
|
|
195
|
-
&::
|
|
195
|
+
&::before {
|
|
196
196
|
border: 0 solid $pi-grid-border-color;
|
|
197
197
|
// 只生成右下边框
|
|
198
198
|
border-right-width: $pi-grid-border-width;
|
|
199
199
|
border-bottom-width: $pi-grid-border-width;
|
|
200
200
|
}
|
|
201
|
-
&.gap::
|
|
201
|
+
&.gap::before {
|
|
202
202
|
// 如果有间隔的情况下(边框全部生成)
|
|
203
203
|
border-width: $pi-grid-border-width;
|
|
204
204
|
}
|
|
205
|
-
&.first-row::
|
|
205
|
+
&.first-row::before {
|
|
206
206
|
// 首行生成上边框
|
|
207
207
|
border-top-width: $pi-grid-border-width;
|
|
208
208
|
}
|
|
209
|
-
&.first-col::
|
|
209
|
+
&.first-col::before {
|
|
210
210
|
// 首列生成左边框
|
|
211
211
|
border-left-width: $pi-grid-border-width;
|
|
212
212
|
}
|