renusify 2.5.2 → 3.0.1
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/components/app/index.vue +74 -22
- package/components/app/toast/index.vue +76 -71
- package/components/app/toast/toast.vue +62 -44
- package/components/avatar/index.vue +207 -84
- package/components/button/buttonConfirm.vue +53 -26
- package/components/button/buttonGroup.js +0 -2
- package/components/button/buttonGroup.vue +310 -62
- package/components/button/index.vue +584 -100
- package/components/calendar/index.js +0 -2
- package/components/calendar/index.vue +326 -262
- package/components/calendar/month.vue +64 -55
- package/components/calendar/year.vue +30 -25
- package/components/card/index.vue +139 -59
- package/components/codeEditor/highlightCss.vue +38 -39
- package/components/codeEditor/highlightHtml.vue +64 -64
- package/components/codeEditor/highlightJs.vue +37 -38
- package/components/codeEditor/index.vue +129 -79
- package/components/codeEditor/run.vue +225 -39
- package/components/codeEditor/useCodeFormatter.js +150 -0
- package/components/confirm/index.vue +139 -80
- package/components/container/col.vue +5 -4
- package/components/container/divider.vue +28 -19
- package/components/container/index.vue +34 -15
- package/components/container/row.vue +26 -9
- package/components/container/spacer.vue +2 -4
- package/components/container/style.scss +3 -0
- package/components/content/index.vue +49 -32
- package/components/cropper/index.vue +401 -244
- package/components/float/index.vue +542 -415
- package/components/form/addressInput/index.vue +184 -109
- package/components/form/camInput/index.vue +370 -244
- package/components/form/checkInput/index.vue +138 -71
- package/components/form/checkboxInput/index.vue +93 -49
- package/components/form/colorInput/Alpha.vue +81 -83
- package/components/form/colorInput/Hue.vue +91 -68
- package/components/form/colorInput/Preview.vue +43 -47
- package/components/form/colorInput/Saturation.vue +101 -86
- package/components/form/colorInput/index.vue +71 -39
- package/components/form/colorInput/picker.vue +111 -106
- package/components/form/colorInput/useColor.js +153 -0
- package/components/form/dateInput/index.vue +691 -356
- package/components/form/dateInput/month.vue +63 -54
- package/components/form/dateInput/year.vue +35 -25
- package/components/form/fileInput/index.js +0 -1
- package/components/form/fileInput/index.vue +263 -106
- package/components/form/fileInput/single.vue +332 -168
- package/components/form/groupInput/index.vue +199 -101
- package/components/form/index.vue +189 -83
- package/components/form/input/index.vue +416 -377
- package/components/form/jsonInput/JsonView.vue +54 -56
- package/components/form/jsonInput/index.vue +247 -165
- package/components/form/maskInput/index.vue +252 -132
- package/components/form/numberInput/index.js +0 -1
- package/components/form/numberInput/index.vue +226 -117
- package/components/form/passwordInput/index.js +2 -1
- package/components/form/passwordInput/index.vue +269 -102
- package/components/form/radioInput/index.vue +143 -72
- package/components/form/rangeInput/index.vue +280 -167
- package/components/form/ratingInput/index.vue +57 -57
- package/components/form/selectInput/index.js +1 -3
- package/components/form/selectInput/index.vue +584 -296
- package/components/form/switchInput/index.vue +73 -59
- package/components/form/telInput/index.js +0 -1
- package/components/form/telInput/index.vue +238 -135
- package/components/form/textArea/index.vue +72 -35
- package/components/form/textEditor/index.vue +739 -0
- package/components/form/{text-editor → textEditor}/style.scss +8 -16
- package/components/form/textInput/index.vue +54 -32
- package/components/form/timeInput/index.vue +82 -55
- package/components/form/timeInput/range.vue +115 -94
- package/components/form/timeInput/timepicker.vue +382 -449
- package/components/form/uniqueInput/index.vue +105 -48
- package/components/form/unitInput/index.vue +139 -84
- package/components/formCreator/index.js +0 -1
- package/components/formCreator/index.vue +314 -148
- package/components/highlight/index.vue +41 -25
- package/components/highlight/style.scss +2 -2
- package/components/highlight/{mixin.js → useHighlight.js} +181 -160
- package/components/icon/index.vue +79 -33
- package/components/img/index.vue +250 -147
- package/components/img/preview.vue +180 -198
- package/components/img/svgImg.vue +42 -39
- package/components/index.js +5 -20
- package/components/infinite/index.js +3 -3
- package/components/infinite/index.vue +290 -66
- package/components/map/index.vue +428 -261
- package/components/map/route.vue +794 -487
- package/components/map/select.vue +118 -58
- package/components/menu/index.vue +206 -94
- package/components/meta/meta.js +26 -3
- package/components/modal/index.vue +382 -156
- package/components/notify/index.vue +204 -86
- package/components/notify/notification.vue +38 -55
- package/components/progress/circle.vue +189 -70
- package/components/progress/line.vue +266 -46
- package/components/searchBox/index.js +1 -3
- package/components/searchBox/index.vue +194 -101
- package/components/skeleton/index.vue +45 -20
- package/components/slider/index.vue +319 -156
- package/components/swiper/index.vue +237 -108
- package/components/table/crud/footer.vue +77 -53
- package/components/table/crud/header.vue +71 -72
- package/components/table/crud/index.vue +629 -399
- package/components/table/index.vue +721 -278
- package/components/timeAgo/index.vue +145 -96
- package/components/tour/index.vue +338 -235
- package/components/tree/index.vue +235 -89
- package/components/tree/tree-element.vue +106 -106
- package/directive/animate/index.js +77 -0
- package/directive/clickOutSide/index.js +98 -0
- package/directive/drag/index.js +153 -0
- package/directive/index.js +11 -13
- package/directive/intersect/index.js +263 -0
- package/directive/mask/index.js +67 -0
- package/directive/parallax/index.js +78 -0
- package/directive/ripple/index.js +14 -0
- package/directive/scroll/index.js +272 -24
- package/directive/sortable/index.js +274 -0
- package/directive/title/index.js +75 -0
- package/directive/touch/index.js +268 -0
- package/index.js +11 -19
- package/package.json +5 -2
- package/plugins/validation/Validate.js +88 -79
- package/scripts/generate-docs.mjs +226 -0
- package/scripts/menu.mjs +240 -0
- package/scripts/parser.mjs +1086 -0
- package/style/_index.scss +7 -0
- package/style/app.scss +13 -65
- package/style/colors.scss +5 -22
- package/style/functions/index.scss +8 -0
- package/style/mixins/index.scss +17 -5
- package/style/variables/base.scss +155 -178
- package/style/variables/color.scss +0 -12
- package/style/variables/utilities.scss +0 -180
- package/tools/helper.js +0 -8
- package/tools/icons.js +7 -2
- package/tools/root.js +71 -0
- package/components/app/style.scss +0 -41
- package/components/app/toast/style.scss +0 -20
- package/components/avatar/style.scss +0 -32
- package/components/bar/bottomNav.js +0 -1
- package/components/bar/bottomNav.vue +0 -28
- package/components/bar/bottomNavigationCircle.js +0 -2
- package/components/bar/bottomNavigationCircle.vue +0 -99
- package/components/bar/scss/bottomNav.scss +0 -67
- package/components/bar/scss/toolbar.scss +0 -174
- package/components/bar/toolbar/index.js +0 -8
- package/components/bar/toolbar/index.vue +0 -35
- package/components/bar/toolbar/laptop.vue +0 -33
- package/components/bar/toolbar/menuChilds.vue +0 -41
- package/components/bar/toolbar/menuLaptop.vue +0 -41
- package/components/bar/toolbar/menuMob.vue +0 -39
- package/components/bar/toolbar/mixin.js +0 -43
- package/components/bar/toolbar/mobile.vue +0 -34
- package/components/breadcrumb/bredcrumbItem.vue +0 -39
- package/components/breadcrumb/index.js +0 -3
- package/components/breadcrumb/index.vue +0 -71
- package/components/breadcrumb/style.scss +0 -51
- package/components/button/style.scss +0 -411
- package/components/card/style.scss +0 -86
- package/components/chart/chart.js +0 -1
- package/components/chart/chart.vue +0 -69
- package/components/chart/worldMap.js +0 -2
- package/components/chart/worldMap.vue +0 -1112
- package/components/chat/MessageList.vue +0 -163
- package/components/chat/chatInput.vue +0 -150
- package/components/chat/chatMsg.vue +0 -276
- package/components/chat/index.js +0 -11
- package/components/chat/index.vue +0 -113
- package/components/chip/index.js +0 -3
- package/components/chip/index.vue +0 -77
- package/components/chip/style.scss +0 -199
- package/components/codeEditor/mixin.js +0 -145
- package/components/countdown/index.js +0 -1
- package/components/countdown/index.vue +0 -105
- package/components/form/colorInput/mixin.js +0 -132
- package/components/form/fileInput/file.js +0 -148
- package/components/form/telInput/assets/flags.png +0 -0
- package/components/form/telInput/assets/flags@2x.png +0 -0
- package/components/form/text-editor/index.vue +0 -705
- package/components/icon/style.scss +0 -17
- package/components/infinite/div.js +0 -6
- package/components/infinite/div.vue +0 -193
- package/components/infinite/page.js +0 -3
- package/components/infinite/page.vue +0 -105
- package/components/list/index.js +0 -3
- package/components/list/index.vue +0 -122
- package/components/list/style.scss +0 -66
- package/components/message/index.js +0 -4
- package/components/message/index.vue +0 -40
- package/components/modal/style.scss +0 -146
- package/components/nestable/NestableItem.vue +0 -307
- package/components/nestable/editable.js +0 -44
- package/components/nestable/index.js +0 -1
- package/components/nestable/index.vue +0 -226
- package/components/nestable/methods.js +0 -416
- package/components/progress/style.scss +0 -229
- package/components/table/style.scss +0 -338
- package/components/tabs/index.js +0 -3
- package/components/tabs/index.vue +0 -151
- package/components/timeline/index.js +0 -6
- package/components/timeline/index.vue +0 -76
- package/directive/resize/index.js +0 -30
- package/directive/skeleton/index.js +0 -27
- package/directive/skeleton/style.scss +0 -37
- package/plugins/request/Request.js +0 -68
- package/style/animation.scss +0 -94
- package/style/style.scss +0 -8
- package/tools/rootable.js +0 -75
- /package/components/form/{text-editor → textEditor}/index.js +0 -0
- /package/components/form/{text-editor → textEditor}/preview.js +0 -0
- /package/components/form/{text-editor → textEditor}/preview.vue +0 -0
|
@@ -1,37 +1,62 @@
|
|
|
1
1
|
<template>
|
|
2
2
|
<div :class="[$r.prefix+'skeleton']">
|
|
3
|
+
<!-- Main content slot - shown when loading is true or showPreData is true
|
|
4
|
+
@example
|
|
5
|
+
<div class="tilte-1">title</div>
|
|
6
|
+
-->
|
|
3
7
|
<slot v-if="loading||showPreData"></slot>
|
|
8
|
+
|
|
9
|
+
<!-- Skeleton slot - shown when loading is false -->
|
|
4
10
|
<slot v-if="!loading" name="case">
|
|
5
11
|
<div :class="['sk-'+type]" :style="{width:width,height:height}"></div>
|
|
6
12
|
</slot>
|
|
7
13
|
</div>
|
|
8
14
|
</template>
|
|
9
15
|
|
|
10
|
-
<script>
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
16
|
+
<script setup>
|
|
17
|
+
defineProps({
|
|
18
|
+
/**
|
|
19
|
+
* Shows pre-loaded data content instead of skeleton
|
|
20
|
+
* @type {Boolean}
|
|
21
|
+
*/
|
|
22
|
+
showPreData: Boolean,
|
|
23
|
+
/**
|
|
24
|
+
* Controls loading state - shows skeleton when false, shows content when true
|
|
25
|
+
* @type {Boolean}
|
|
26
|
+
*/
|
|
27
|
+
loading: Boolean,
|
|
28
|
+
/**
|
|
29
|
+
* Width of the skeleton element
|
|
30
|
+
* @type {String}
|
|
31
|
+
*/
|
|
32
|
+
width: String,
|
|
33
|
+
/**
|
|
34
|
+
* Height of the skeleton element
|
|
35
|
+
* @type {String}
|
|
36
|
+
*/
|
|
37
|
+
height: String,
|
|
38
|
+
/**
|
|
39
|
+
* Type of skeleton to display
|
|
40
|
+
* @type {String}
|
|
41
|
+
* @default 'card'
|
|
42
|
+
* @values 'line', 'avatar', 'card'
|
|
43
|
+
*/
|
|
44
|
+
type: {
|
|
45
|
+
type: String,
|
|
46
|
+
default: 'card',
|
|
47
|
+
validator: function (value) {
|
|
48
|
+
return ['line', 'avatar', 'card'].indexOf(value) !== -1
|
|
49
|
+
}
|
|
50
|
+
},
|
|
51
|
+
})
|
|
27
52
|
</script>
|
|
28
53
|
|
|
29
54
|
<style lang="scss">
|
|
30
55
|
@use "sass:map";
|
|
31
|
-
@use "../../style
|
|
56
|
+
@use "../../style" as *;
|
|
32
57
|
|
|
33
58
|
|
|
34
|
-
.#{
|
|
59
|
+
.#{$prefix}skeleton {
|
|
35
60
|
.sk-card, .sk-line, .sk-avatar {
|
|
36
61
|
background: rgba(0, 0, 0, 0.12);
|
|
37
62
|
overflow: hidden;
|
|
@@ -57,7 +82,7 @@ export default {
|
|
|
57
82
|
}
|
|
58
83
|
|
|
59
84
|
.sk-card {
|
|
60
|
-
border-radius: map.get(
|
|
85
|
+
border-radius: map.get($borders, 'sm');
|
|
61
86
|
}
|
|
62
87
|
|
|
63
88
|
.sk-line {
|
|
@@ -4,7 +4,7 @@
|
|
|
4
4
|
width:width+'px',
|
|
5
5
|
height:(width/wPH)+'px'
|
|
6
6
|
}"
|
|
7
|
-
ref="
|
|
7
|
+
ref="sliderRef"
|
|
8
8
|
v-touch="{
|
|
9
9
|
'left':$r.rtl?prev:next,
|
|
10
10
|
'right':$r.rtl?next:prev
|
|
@@ -22,6 +22,8 @@
|
|
|
22
22
|
class="slider-slides">
|
|
23
23
|
<r-progress-line v-if="autoplay&&progress" :model-value="remain" class="slider-progress"
|
|
24
24
|
color="color-one"></r-progress-line>
|
|
25
|
+
<!-- @slot Default slot for slide content.
|
|
26
|
+
Provide item(Current slide data), width(Width of the slide container), height(Height of the slide container) -->
|
|
25
27
|
<slot v-if="width>0" :item="currentSlide" :width="width" :height="width/wPH">
|
|
26
28
|
{{ currentSlide }}
|
|
27
29
|
</slot>
|
|
@@ -33,8 +35,11 @@
|
|
|
33
35
|
:key="n"
|
|
34
36
|
class="slider-dot"
|
|
35
37
|
v-for="(i,n) in slides">
|
|
38
|
+
<!-- Slot for custom dots rendering
|
|
39
|
+
Provide {Function} go - Function to go to a specific slide
|
|
40
|
+
Provide {Number} index - Slide index -->
|
|
36
41
|
<slot name="dots" :go="goToSlide" :index="n">
|
|
37
|
-
<
|
|
42
|
+
<span @click.prevent="goToSlide(n)">{{ n }}</span>
|
|
38
43
|
</slot>
|
|
39
44
|
</li>
|
|
40
45
|
</ul>
|
|
@@ -42,154 +47,312 @@
|
|
|
42
47
|
</div>
|
|
43
48
|
</template>
|
|
44
49
|
|
|
45
|
-
<script>
|
|
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
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
50
|
+
<script setup>
|
|
51
|
+
import {ref, computed, onMounted, onUnmounted,watch} from 'vue'
|
|
52
|
+
|
|
53
|
+
/**
|
|
54
|
+
* @example // Slider usage
|
|
55
|
+
* <template>
|
|
56
|
+
* <r-slider
|
|
57
|
+
* :slides="slides"
|
|
58
|
+
* :startIndex="startIndex"
|
|
59
|
+
* :appear="appear"
|
|
60
|
+
* :speed="speed"
|
|
61
|
+
* :w-p-h="wPH"
|
|
62
|
+
* :slidesClass="slidesClass"
|
|
63
|
+
* :mode="mode"
|
|
64
|
+
* :transitionRight="transitionRight"
|
|
65
|
+
* :transitionLeft="transitionLeft"
|
|
66
|
+
* :autoplay="autoplay"
|
|
67
|
+
* :progress="progress"
|
|
68
|
+
* :arrow="arrow"
|
|
69
|
+
* :dots="dots"
|
|
70
|
+
* @index="log('index', $event)"
|
|
71
|
+
* >
|
|
72
|
+
* <template v-slot="{ item }">
|
|
73
|
+
* <div
|
|
74
|
+
* class="d-flex w-full h-full v-center h-center display-4 color-white-text"
|
|
75
|
+
* :style="{ backgroundColor: item.color }"
|
|
76
|
+
* >
|
|
77
|
+
* {{ item.name }}
|
|
78
|
+
* </div>
|
|
79
|
+
* </template>
|
|
80
|
+
* </r-slider>
|
|
81
|
+
* </template>
|
|
82
|
+
*
|
|
83
|
+
* <script>
|
|
84
|
+
* import { ref } from 'vue'
|
|
85
|
+
*
|
|
86
|
+
* const slides = ref([
|
|
87
|
+
* { name: "one", color: "red" },
|
|
88
|
+
* { name: "two", color: "blue" },
|
|
89
|
+
* { name: "three", color: "green" }
|
|
90
|
+
* ])
|
|
91
|
+
*
|
|
92
|
+
* const speed = ref(5000)
|
|
93
|
+
* const wPH = ref(2)
|
|
94
|
+
* const autoplay = ref(false)
|
|
95
|
+
* const progress = ref(false)
|
|
96
|
+
* const arrow = ref(false)
|
|
97
|
+
* const dots = ref(true)
|
|
98
|
+
* const startIndex = ref(0)
|
|
99
|
+
* const appear = ref(true)
|
|
100
|
+
* const slidesClass = ref("position-absolute h-full")
|
|
101
|
+
* const mode = ref("")
|
|
102
|
+
* const transitionRight = ref("slide-start-to-end")
|
|
103
|
+
* const transitionLeft = ref("slide-end-to-start")
|
|
104
|
+
*
|
|
105
|
+
* // Methods
|
|
106
|
+
* const log = (name, e) => {
|
|
107
|
+
* console.log(name, e)
|
|
108
|
+
* }
|
|
109
|
+
* <//script>
|
|
110
|
+
*
|
|
111
|
+
* */
|
|
112
|
+
const props = defineProps({
|
|
113
|
+
/**
|
|
114
|
+
* Array of slide data items
|
|
115
|
+
* @type {Array}
|
|
116
|
+
* @default () => []
|
|
117
|
+
*/
|
|
118
|
+
slides: {
|
|
119
|
+
type: Array,
|
|
120
|
+
default: () => []
|
|
92
121
|
},
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
width: null,
|
|
102
|
-
remain_id: null,
|
|
103
|
-
remain: 0,
|
|
104
|
-
}
|
|
122
|
+
/**
|
|
123
|
+
* Autoplay interval in milliseconds
|
|
124
|
+
* @type {Number}
|
|
125
|
+
* @default 5000
|
|
126
|
+
*/
|
|
127
|
+
speed: {
|
|
128
|
+
type: Number,
|
|
129
|
+
default: 5000
|
|
105
130
|
},
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
131
|
+
/**
|
|
132
|
+
* Width to height ratio (width/height)
|
|
133
|
+
* @type {Number}
|
|
134
|
+
* @default 2
|
|
135
|
+
*/
|
|
136
|
+
wPH: {
|
|
137
|
+
type: Number,
|
|
138
|
+
default: 2
|
|
109
139
|
},
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
clearInterval(this.remain_id)
|
|
119
|
-
}
|
|
120
|
-
}, 100)
|
|
121
|
-
},
|
|
122
|
-
init() {
|
|
123
|
-
const w = this.$refs.slider.clientWidth
|
|
124
|
-
this.width = w || 1200
|
|
125
|
-
this.startSlide()
|
|
126
|
-
this.loaded = true
|
|
127
|
-
},
|
|
128
|
-
toggle() {
|
|
129
|
-
clearInterval(this.timer)
|
|
130
|
-
this.loaded = false
|
|
131
|
-
clearTimeout(this.loaded_timer)
|
|
132
|
-
this.loaded_timer = setTimeout(() => {
|
|
133
|
-
this.loaded = true
|
|
134
|
-
}, 500)
|
|
135
|
-
this.startSlide()
|
|
136
|
-
},
|
|
137
|
-
startSlide: function () {
|
|
138
|
-
if (this.autoplay) {
|
|
139
|
-
this.timer = setInterval(this.next, this.speed)
|
|
140
|
-
this.do_remain()
|
|
141
|
-
}
|
|
142
|
-
},
|
|
143
|
-
|
|
144
|
-
next: function () {
|
|
145
|
-
this.toggle()
|
|
146
|
-
this.direction = this.transitionRight
|
|
147
|
-
if (this.currentIndex > this.slides.length - 2) {
|
|
148
|
-
this.currentIndex = 0
|
|
149
|
-
} else {
|
|
150
|
-
this.currentIndex += 1
|
|
151
|
-
}
|
|
152
|
-
this.$emit('index', this.currentIndex)
|
|
153
|
-
},
|
|
154
|
-
prev: function () {
|
|
155
|
-
this.toggle()
|
|
156
|
-
this.direction = this.transitionLeft
|
|
157
|
-
if (this.currentIndex === 0) {
|
|
158
|
-
this.currentIndex = this.slides.length - 1
|
|
159
|
-
} else {
|
|
160
|
-
this.currentIndex -= 1
|
|
161
|
-
}
|
|
162
|
-
this.$emit('index', this.currentIndex)
|
|
163
|
-
},
|
|
164
|
-
goToSlide(i) {
|
|
165
|
-
this.toggle()
|
|
166
|
-
if (i < this.currentIndex) {
|
|
167
|
-
this.direction = this.transitionLeft
|
|
168
|
-
} else {
|
|
169
|
-
this.direction = this.transitionRight
|
|
170
|
-
}
|
|
171
|
-
|
|
172
|
-
this.currentIndex = i
|
|
173
|
-
this.$emit('index', this.currentIndex)
|
|
174
|
-
}
|
|
140
|
+
/**
|
|
141
|
+
* Initial slide index to display
|
|
142
|
+
* @type {Number}
|
|
143
|
+
* @default 0
|
|
144
|
+
*/
|
|
145
|
+
startIndex: {
|
|
146
|
+
type: Number,
|
|
147
|
+
default: 0
|
|
175
148
|
},
|
|
176
|
-
|
|
177
|
-
|
|
178
|
-
|
|
179
|
-
|
|
180
|
-
|
|
149
|
+
/**
|
|
150
|
+
* Enables automatic slide progression
|
|
151
|
+
* @type {Boolean}
|
|
152
|
+
* @default false
|
|
153
|
+
*/
|
|
154
|
+
autoplay: {
|
|
155
|
+
type: Boolean,
|
|
156
|
+
default: false
|
|
157
|
+
},
|
|
158
|
+
/**
|
|
159
|
+
* Shows progress bar during autoplay
|
|
160
|
+
* @type {Boolean}
|
|
161
|
+
* @default false
|
|
162
|
+
*/
|
|
163
|
+
progress: {
|
|
164
|
+
type: Boolean,
|
|
165
|
+
default: false
|
|
181
166
|
},
|
|
182
|
-
|
|
183
|
-
|
|
184
|
-
|
|
185
|
-
|
|
167
|
+
/**
|
|
168
|
+
* Shows navigation arrows
|
|
169
|
+
* @type {Boolean}
|
|
170
|
+
* @default false
|
|
171
|
+
*/
|
|
172
|
+
arrow: {
|
|
173
|
+
type: Boolean,
|
|
174
|
+
default: false
|
|
175
|
+
},
|
|
176
|
+
/**
|
|
177
|
+
* Shows navigation dots
|
|
178
|
+
* @type {Boolean}
|
|
179
|
+
* @default true
|
|
180
|
+
*/
|
|
181
|
+
dots: {
|
|
182
|
+
type: Boolean,
|
|
183
|
+
default: true
|
|
184
|
+
},
|
|
185
|
+
/**
|
|
186
|
+
* Enables appear transition on initial render
|
|
187
|
+
* @type {Boolean}
|
|
188
|
+
* @default true
|
|
189
|
+
*/
|
|
190
|
+
appear: {
|
|
191
|
+
type: Boolean,
|
|
192
|
+
default: true
|
|
193
|
+
},
|
|
194
|
+
/**
|
|
195
|
+
* Additional CSS classes for slides container
|
|
196
|
+
* @type {String|Object|Array}
|
|
197
|
+
*/
|
|
198
|
+
slidesClass: [String, Object, Array],
|
|
199
|
+
/**
|
|
200
|
+
* Vue transition mode
|
|
201
|
+
* @type {String}
|
|
202
|
+
* @default 'out-in'
|
|
203
|
+
*/
|
|
204
|
+
mode: {type: String, default: 'out-in'},
|
|
205
|
+
/**
|
|
206
|
+
* CSS transition name for right/next direction
|
|
207
|
+
* @type {String}
|
|
208
|
+
* @default 'slider-right'
|
|
209
|
+
*/
|
|
210
|
+
transitionRight: {type: String, default: 'slider-right'},
|
|
211
|
+
/**
|
|
212
|
+
* CSS transition name for left/previous direction
|
|
213
|
+
* @type {String}
|
|
214
|
+
* @default 'slider-left'
|
|
215
|
+
*/
|
|
216
|
+
transitionLeft: {type: String, default: 'slider-left'}
|
|
217
|
+
})
|
|
218
|
+
|
|
219
|
+
const emit = defineEmits([
|
|
220
|
+
/**
|
|
221
|
+
* Emitted when slide index changes
|
|
222
|
+
* @param {Number} index - New slide index
|
|
223
|
+
*/
|
|
224
|
+
'index'
|
|
225
|
+
])
|
|
226
|
+
|
|
227
|
+
const direction = ref(props.transitionRight)
|
|
228
|
+
const loaded = ref(false)
|
|
229
|
+
const currentIndex = ref(props.startIndex)
|
|
230
|
+
const loadedTimer = ref(null)
|
|
231
|
+
const timer = ref(null)
|
|
232
|
+
const width = ref(null)
|
|
233
|
+
const remainId = ref(null)
|
|
234
|
+
const remain = ref(0)
|
|
235
|
+
const sliderRef = ref(null)
|
|
236
|
+
|
|
237
|
+
const currentSlide = computed(() => {
|
|
238
|
+
if (!props.slides.length) return null
|
|
239
|
+
return props.slides[currentIndex.value % props.slides.length]
|
|
240
|
+
})
|
|
241
|
+
|
|
242
|
+
const doRemain = () => {
|
|
243
|
+
remain.value = 0
|
|
244
|
+
clearInterval(remainId.value)
|
|
245
|
+
|
|
246
|
+
if (!props.autoplay || !props.progress) return
|
|
247
|
+
|
|
248
|
+
remainId.value = setInterval(() => {
|
|
249
|
+
remain.value += 10000 / props.speed
|
|
250
|
+
if (remain.value >= 100) {
|
|
251
|
+
remain.value = 100
|
|
252
|
+
clearInterval(remainId.value)
|
|
253
|
+
}
|
|
254
|
+
}, 100)
|
|
255
|
+
}
|
|
256
|
+
|
|
257
|
+
const init = () => {
|
|
258
|
+
if (sliderRef.value) {
|
|
259
|
+
const w = sliderRef.value.clientWidth
|
|
260
|
+
width.value = w || 1200
|
|
261
|
+
startSlide()
|
|
262
|
+
loaded.value = true
|
|
263
|
+
}
|
|
264
|
+
}
|
|
265
|
+
|
|
266
|
+
const toggle = () => {
|
|
267
|
+
clearInterval(timer.value)
|
|
268
|
+
loaded.value = false
|
|
269
|
+
|
|
270
|
+
clearTimeout(loadedTimer.value)
|
|
271
|
+
loadedTimer.value = setTimeout(() => {
|
|
272
|
+
loaded.value = true
|
|
273
|
+
}, 500)
|
|
274
|
+
|
|
275
|
+
startSlide()
|
|
276
|
+
}
|
|
277
|
+
|
|
278
|
+
const startSlide = () => {
|
|
279
|
+
if (props.autoplay && props.slides.length > 1) {
|
|
280
|
+
clearInterval(timer.value)
|
|
281
|
+
timer.value = setInterval(next, props.speed)
|
|
282
|
+
doRemain()
|
|
283
|
+
}
|
|
284
|
+
}
|
|
285
|
+
|
|
286
|
+
/**
|
|
287
|
+
* Navigates to the next slide
|
|
288
|
+
*/
|
|
289
|
+
const next = () => {
|
|
290
|
+
if (props.slides.length <= 1) return
|
|
291
|
+
|
|
292
|
+
toggle()
|
|
293
|
+
direction.value = props.transitionRight
|
|
294
|
+
|
|
295
|
+
if (currentIndex.value > props.slides.length - 2) {
|
|
296
|
+
currentIndex.value = 0
|
|
297
|
+
} else {
|
|
298
|
+
currentIndex.value += 1
|
|
186
299
|
}
|
|
300
|
+
|
|
301
|
+
emit('index', currentIndex.value)
|
|
187
302
|
}
|
|
303
|
+
|
|
304
|
+
/**
|
|
305
|
+
* Navigates to the previous slide
|
|
306
|
+
*/
|
|
307
|
+
const prev = () => {
|
|
308
|
+
if (props.slides.length <= 1) return
|
|
309
|
+
|
|
310
|
+
toggle()
|
|
311
|
+
direction.value = props.transitionLeft
|
|
312
|
+
|
|
313
|
+
if (currentIndex.value === 0) {
|
|
314
|
+
currentIndex.value = props.slides.length - 1
|
|
315
|
+
} else {
|
|
316
|
+
currentIndex.value -= 1
|
|
317
|
+
}
|
|
318
|
+
|
|
319
|
+
emit('index', currentIndex.value)
|
|
320
|
+
}
|
|
321
|
+
|
|
322
|
+
/**
|
|
323
|
+
* Navigates to a specific slide
|
|
324
|
+
* @param {Number} i - Slide index to navigate to
|
|
325
|
+
*/
|
|
326
|
+
const goToSlide = (i) => {
|
|
327
|
+
if (i === currentIndex.value || i < 0 || i >= props.slides.length) return
|
|
328
|
+
|
|
329
|
+
toggle()
|
|
330
|
+
|
|
331
|
+
if (i < currentIndex.value) {
|
|
332
|
+
direction.value = props.transitionLeft
|
|
333
|
+
} else {
|
|
334
|
+
direction.value = props.transitionRight
|
|
335
|
+
}
|
|
336
|
+
|
|
337
|
+
currentIndex.value = i
|
|
338
|
+
emit('index', currentIndex.value)
|
|
339
|
+
}
|
|
340
|
+
|
|
341
|
+
watch(()=>props.slides,()=>{init()})
|
|
342
|
+
onMounted(() => {
|
|
343
|
+
init()
|
|
344
|
+
})
|
|
345
|
+
|
|
346
|
+
onUnmounted(() => {
|
|
347
|
+
clearInterval(timer.value)
|
|
348
|
+
clearTimeout(loadedTimer.value)
|
|
349
|
+
clearInterval(remainId.value)
|
|
350
|
+
})
|
|
188
351
|
</script>
|
|
352
|
+
|
|
189
353
|
<style lang="scss">
|
|
190
354
|
@use "sass:map";
|
|
191
|
-
@use "../../style
|
|
192
|
-
@use "../../style/mixins";
|
|
355
|
+
@use "../../style" as *;
|
|
193
356
|
|
|
194
357
|
|
|
195
358
|
.slider-progress {
|
|
@@ -202,25 +365,25 @@ export default {
|
|
|
202
365
|
.btn-left-arrow {
|
|
203
366
|
position: absolute;
|
|
204
367
|
top: 50%;
|
|
205
|
-
@include
|
|
368
|
+
@include ltr() {
|
|
206
369
|
left: 20px;
|
|
207
370
|
}
|
|
208
|
-
@include
|
|
371
|
+
@include rtl() {
|
|
209
372
|
right: 20px
|
|
210
373
|
}
|
|
211
|
-
z-index: map.get(
|
|
374
|
+
z-index: map.get($z-index, 'low');
|
|
212
375
|
}
|
|
213
376
|
|
|
214
377
|
.btn-right-arrow {
|
|
215
378
|
position: absolute;
|
|
216
379
|
top: 50%;
|
|
217
|
-
@include
|
|
380
|
+
@include rtl() {
|
|
218
381
|
left: 20px;
|
|
219
382
|
}
|
|
220
|
-
@include
|
|
383
|
+
@include ltr() {
|
|
221
384
|
right: 20px
|
|
222
385
|
}
|
|
223
|
-
z-index: map.get(
|
|
386
|
+
z-index: map.get($z-index, 'low');
|
|
224
387
|
}
|
|
225
388
|
|
|
226
389
|
.slider-right {
|
|
@@ -233,10 +396,10 @@ export default {
|
|
|
233
396
|
}
|
|
234
397
|
|
|
235
398
|
&-enter-from {
|
|
236
|
-
@include
|
|
399
|
+
@include rtl() {
|
|
237
400
|
transform: translateX(-200px);
|
|
238
401
|
}
|
|
239
|
-
@include
|
|
402
|
+
@include ltr() {
|
|
240
403
|
transform: translateX(200px);
|
|
241
404
|
}
|
|
242
405
|
|
|
@@ -244,10 +407,10 @@ export default {
|
|
|
244
407
|
}
|
|
245
408
|
|
|
246
409
|
&-leave-to {
|
|
247
|
-
@include
|
|
410
|
+
@include rtl() {
|
|
248
411
|
transform: translateX(200px);
|
|
249
412
|
}
|
|
250
|
-
@include
|
|
413
|
+
@include ltr() {
|
|
251
414
|
transform: translateX(-200px);
|
|
252
415
|
}
|
|
253
416
|
|
|
@@ -265,10 +428,10 @@ export default {
|
|
|
265
428
|
}
|
|
266
429
|
|
|
267
430
|
&-enter-from {
|
|
268
|
-
@include
|
|
431
|
+
@include rtl() {
|
|
269
432
|
transform: translateX(200px);
|
|
270
433
|
}
|
|
271
|
-
@include
|
|
434
|
+
@include ltr() {
|
|
272
435
|
transform: translateX(-200px);
|
|
273
436
|
}
|
|
274
437
|
|
|
@@ -276,10 +439,10 @@ export default {
|
|
|
276
439
|
}
|
|
277
440
|
|
|
278
441
|
&-leave-to {
|
|
279
|
-
@include
|
|
442
|
+
@include rtl() {
|
|
280
443
|
transform: translateX(-200px);
|
|
281
444
|
}
|
|
282
|
-
@include
|
|
445
|
+
@include ltr() {
|
|
283
446
|
transform: translateX(200px);
|
|
284
447
|
}
|
|
285
448
|
|
|
@@ -318,7 +481,7 @@ export default {
|
|
|
318
481
|
display: flex;
|
|
319
482
|
padding: 5px;
|
|
320
483
|
|
|
321
|
-
|
|
484
|
+
span {
|
|
322
485
|
transition: 0.3s all ease-in-out;
|
|
323
486
|
background-color: #bfbfbf;
|
|
324
487
|
outline: none;
|
|
@@ -335,7 +498,7 @@ export default {
|
|
|
335
498
|
}
|
|
336
499
|
}
|
|
337
500
|
|
|
338
|
-
.slider-dot--current
|
|
501
|
+
.slider-dot--current span {
|
|
339
502
|
transition: 0.5s all ease-in-out;
|
|
340
503
|
background-color: currentColor;
|
|
341
504
|
width: 30px;
|