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
|
@@ -49,6 +49,9 @@ import { parseDuration } from '@sadais/piui-tool/tools/common'
|
|
|
49
49
|
const TAG = 'PiTabs'
|
|
50
50
|
const { tabs } = getConfig()
|
|
51
51
|
|
|
52
|
+
let MAX_RETRY = 10
|
|
53
|
+
let timer = null
|
|
54
|
+
|
|
52
55
|
export default {
|
|
53
56
|
name: 'PiTabs',
|
|
54
57
|
// 混入v-model
|
|
@@ -263,13 +266,14 @@ export default {
|
|
|
263
266
|
left: 0,
|
|
264
267
|
width: 0
|
|
265
268
|
}
|
|
266
|
-
if (
|
|
267
|
-
|
|
268
|
-
|
|
269
|
-
|
|
270
|
-
|
|
271
|
-
|
|
272
|
-
|
|
269
|
+
if (this.tabRects.length) {
|
|
270
|
+
const activeIndex =
|
|
271
|
+
this.activeIndex >= this.tabRects.length ? this.tabRects.length - 1 : this.activeIndex
|
|
272
|
+
rect.left = this.tabRects.slice(0, activeIndex).reduce((previous, current) => {
|
|
273
|
+
return previous + current.width
|
|
274
|
+
}, 0)
|
|
275
|
+
rect.width = this.tabRects[activeIndex].width
|
|
276
|
+
}
|
|
273
277
|
return rect
|
|
274
278
|
},
|
|
275
279
|
scrollLeft() {
|
|
@@ -284,6 +288,7 @@ export default {
|
|
|
284
288
|
height: this.getSliderBarHeight,
|
|
285
289
|
borderRadius: this.getSliderBarRadius,
|
|
286
290
|
transitionDuration: duration.css,
|
|
291
|
+
transform: `translate(${this.activeRect.left}px, -25%)`,
|
|
287
292
|
...this.sliderBarStyle
|
|
288
293
|
}
|
|
289
294
|
let sliderScrollLeft = this.activeRect.left
|
|
@@ -328,14 +333,39 @@ export default {
|
|
|
328
333
|
mounted() {
|
|
329
334
|
this.init()
|
|
330
335
|
},
|
|
336
|
+
beforeDestroy() {
|
|
337
|
+
this.clearTimer()
|
|
338
|
+
},
|
|
331
339
|
methods: {
|
|
340
|
+
clearTimer() {
|
|
341
|
+
if (timer) {
|
|
342
|
+
clearInterval(timer)
|
|
343
|
+
timer = null
|
|
344
|
+
MAX_RETRY = 10
|
|
345
|
+
}
|
|
346
|
+
},
|
|
332
347
|
async init() {
|
|
333
348
|
const srollWrapRect = await this.$pi.common.queryRect(this, '.pi-tabs', false)
|
|
334
349
|
if (srollWrapRect) {
|
|
335
350
|
this.tabsWidth = srollWrapRect.width
|
|
336
351
|
}
|
|
337
|
-
this.
|
|
338
|
-
|
|
352
|
+
this.initTabRects()
|
|
353
|
+
this.clearTimer()
|
|
354
|
+
timer = setInterval(() => {
|
|
355
|
+
this.initTabRects()
|
|
356
|
+
}, 200)
|
|
357
|
+
},
|
|
358
|
+
async initTabRects() {
|
|
359
|
+
MAX_RETRY--
|
|
360
|
+
const tabRects = await this.$pi.common.queryRect(this, '.pi-tab', true)
|
|
361
|
+
const tabWidth = this.tabRects.reduce((previous, current) => {
|
|
362
|
+
return previous + current.width
|
|
363
|
+
}, 0)
|
|
364
|
+
this.tabRects = tabRects
|
|
365
|
+
this.$forceUpdate()
|
|
366
|
+
if (tabWidth || MAX_RETRY <= 0) {
|
|
367
|
+
this.clearTimer()
|
|
368
|
+
}
|
|
339
369
|
},
|
|
340
370
|
handleSelectItem(item) {
|
|
341
371
|
if (item[this.disabledField]) return
|
|
@@ -359,7 +389,6 @@ export default {
|
|
|
359
389
|
display: inline-flex;
|
|
360
390
|
font-size: 30rpx;
|
|
361
391
|
text-align: center;
|
|
362
|
-
transition: all $pi-animation-duration $pi-animation-timing-function;
|
|
363
392
|
&.active {
|
|
364
393
|
color: $pi-primary-color;
|
|
365
394
|
}
|
|
@@ -397,3 +426,10 @@ export default {
|
|
|
397
426
|
}
|
|
398
427
|
}
|
|
399
428
|
</style>
|
|
429
|
+
|
|
430
|
+
<style lang="scss">
|
|
431
|
+
.pi-tabs scoped-slots-item {
|
|
432
|
+
width: 100%;
|
|
433
|
+
height: 100%;
|
|
434
|
+
}
|
|
435
|
+
</style>
|