renusify 2.5.2 → 3.0.0
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 +208 -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 +87 -47
- 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 +323 -164
- 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 +249 -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 +1 -2
- package/components/infinite/index.vue +248 -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 +201 -91
- 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 +318 -156
- package/components/swiper/index.vue +254 -106
- 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 +244 -0
- package/directive/sortable/index.js +274 -0
- package/directive/title/index.js +75 -0
- package/directive/touch/index.js +268 -0
- package/index.js +10 -8
- 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 +154 -175
- package/style/variables/color.scss +0 -12
- package/style/variables/utilities.scss +0 -180
- package/tools/helper.js +0 -8
- package/tools/icons.js +6 -1
- 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,11 +1,17 @@
|
|
|
1
1
|
<template>
|
|
2
2
|
<div :class="`${$r.prefix}swiper`"
|
|
3
|
-
ref="
|
|
3
|
+
ref="swiperRef"
|
|
4
4
|
>
|
|
5
|
+
<!-- @slot Left navigation slot
|
|
6
|
+
@binding {Function} left - Function to navigate left/previous -->
|
|
5
7
|
<slot name="left" :left="left"></slot>
|
|
8
|
+
|
|
9
|
+
<!-- @slot Right navigation slot
|
|
10
|
+
@binding {Function} right - Function to navigate right/next -->
|
|
6
11
|
<slot name="right" :right="right"></slot>
|
|
12
|
+
|
|
7
13
|
<div class="swiper-container"
|
|
8
|
-
ref="
|
|
14
|
+
ref="containerRef"
|
|
9
15
|
:class="{
|
|
10
16
|
'in-move':inMove
|
|
11
17
|
}"
|
|
@@ -18,6 +24,9 @@
|
|
|
18
24
|
draggable="false"
|
|
19
25
|
:style="{'min-width':itemWidth&&itemWidth+'px','width':itemWidth&&itemWidth+'px'}"
|
|
20
26
|
v-for="(item,i) in items" :key="i">
|
|
27
|
+
<!-- @slot Default slot for swiper item content
|
|
28
|
+
@binding {*} item - Current item data
|
|
29
|
+
@binding {Number} index - Item index -->
|
|
21
30
|
<slot :item="item" :index="i">{{ item }}</slot>
|
|
22
31
|
</div>
|
|
23
32
|
</div>
|
|
@@ -27,6 +36,9 @@
|
|
|
27
36
|
:key="n"
|
|
28
37
|
class="swiper-dot"
|
|
29
38
|
v-for="n in slides">
|
|
39
|
+
<!-- @slot Slot for custom dots rendering
|
|
40
|
+
@binding {Function} go - Function to go to a specific slide
|
|
41
|
+
@binding {Number} index - Slide index -->
|
|
30
42
|
<slot name="dots" :go="goToSlide" :index="n">
|
|
31
43
|
<button @click.prevent="goToSlide(n)" type="button">{{ n }}</button>
|
|
32
44
|
</slot>
|
|
@@ -36,122 +48,258 @@
|
|
|
36
48
|
</div>
|
|
37
49
|
</template>
|
|
38
50
|
|
|
39
|
-
<script>
|
|
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
|
-
|
|
51
|
+
<script setup>
|
|
52
|
+
import {ref, computed, onMounted, onUnmounted, inject, nextTick, watch} from 'vue'
|
|
53
|
+
|
|
54
|
+
/**
|
|
55
|
+
* @example // Swiper usage
|
|
56
|
+
* <template>
|
|
57
|
+
* <r-swiper
|
|
58
|
+
* :items="items"
|
|
59
|
+
* :width-Item="widthItem"
|
|
60
|
+
* :dots="dots"
|
|
61
|
+
* :num-Show="numShow"
|
|
62
|
+
* >
|
|
63
|
+
* <template v-slot="{ item }">
|
|
64
|
+
* <r-card class="d-flex h-center v-center ma-2" style="height: 200px">
|
|
65
|
+
* {{ item.name }}
|
|
66
|
+
* </r-card>
|
|
67
|
+
* </template>
|
|
68
|
+
* </r-swiper>
|
|
69
|
+
* </template>
|
|
70
|
+
*
|
|
71
|
+
* <script>
|
|
72
|
+
* import { ref } from 'vue'
|
|
73
|
+
*
|
|
74
|
+
* const items = ref([
|
|
75
|
+
* { name: 'One' },
|
|
76
|
+
* { name: 'Two' },
|
|
77
|
+
* { name: 'Three' },
|
|
78
|
+
* { name: 'Four' },
|
|
79
|
+
* { name: 'Five' },
|
|
80
|
+
* { name: 'Six' },
|
|
81
|
+
* { name: 'Seven' },
|
|
82
|
+
* { name: 'Eight' },
|
|
83
|
+
* { name: 'Nine' },
|
|
84
|
+
* { name: 'Ten' }
|
|
85
|
+
* ])
|
|
86
|
+
*
|
|
87
|
+
* const widthItem = ref(null)
|
|
88
|
+
* const dots = ref(true)
|
|
89
|
+
* const numShow = ref(5)
|
|
90
|
+
* <//script>
|
|
91
|
+
*
|
|
92
|
+
*
|
|
93
|
+
* */
|
|
94
|
+
const props = defineProps({
|
|
95
|
+
/**
|
|
96
|
+
* Array of items to display in the swiper
|
|
97
|
+
* @type {Array}
|
|
98
|
+
*/
|
|
99
|
+
items: Array,
|
|
100
|
+
/**
|
|
101
|
+
* Fixed width for each swiper item in pixels
|
|
102
|
+
* @type {Number}
|
|
103
|
+
*/
|
|
104
|
+
widthItem: Number,
|
|
105
|
+
/**
|
|
106
|
+
* Shows navigation dots
|
|
107
|
+
* @type {Boolean}
|
|
108
|
+
*/
|
|
109
|
+
dots: Boolean,
|
|
110
|
+
/**
|
|
111
|
+
* Number of items to show simultaneously, or responsive object
|
|
112
|
+
* @type {Number|Object}
|
|
113
|
+
*/
|
|
114
|
+
numShow: [Number, Object]
|
|
115
|
+
})
|
|
116
|
+
|
|
117
|
+
const {$r} = inject('renusify')
|
|
118
|
+
|
|
119
|
+
const timer = ref(null)
|
|
120
|
+
const inMove = ref(false)
|
|
121
|
+
const x = ref(0)
|
|
122
|
+
const prePosition = ref(0)
|
|
123
|
+
const width = ref(null)
|
|
124
|
+
const slides = ref(0)
|
|
125
|
+
const currentSlide = ref(1)
|
|
126
|
+
|
|
127
|
+
const swiperRef = ref(null)
|
|
128
|
+
const containerRef = ref(null)
|
|
129
|
+
|
|
130
|
+
const itemWidth = computed(() => {
|
|
131
|
+
if (width.value) {
|
|
132
|
+
return width.value
|
|
133
|
+
}
|
|
134
|
+
if (props.widthItem) {
|
|
135
|
+
return props.widthItem
|
|
136
|
+
}
|
|
137
|
+
return false
|
|
138
|
+
})
|
|
139
|
+
|
|
140
|
+
|
|
141
|
+
const canGoNext = computed(() => {
|
|
142
|
+
const r = $r.rtl ? 1 : -1
|
|
143
|
+
const maxX = (containerRef.value?.scrollWidth - swiperRef.value?.offsetWidth) / r
|
|
144
|
+
return x.value * r < maxX
|
|
145
|
+
})
|
|
146
|
+
|
|
147
|
+
const canGoPrev = computed(() => {
|
|
148
|
+
const r = $r.rtl ? 1 : -1
|
|
149
|
+
return x.value * r > 0
|
|
150
|
+
})
|
|
151
|
+
|
|
152
|
+
|
|
153
|
+
/**
|
|
154
|
+
* Navigates to a specific slide
|
|
155
|
+
* @param {Number} n - Slide number (1-indexed)
|
|
156
|
+
*/
|
|
157
|
+
const goToSlide = (n) => {
|
|
158
|
+
if (!swiperRef.value) return
|
|
159
|
+
|
|
160
|
+
inMove.value = false
|
|
161
|
+
const s = $r.rtl ? 1 : -1
|
|
162
|
+
x.value = swiperRef.value.offsetWidth * (n - 1) * s
|
|
163
|
+
prePosition.value = 0
|
|
164
|
+
end(n)
|
|
165
|
+
}
|
|
166
|
+
|
|
167
|
+
/**
|
|
168
|
+
* Navigates to the next/right slide
|
|
169
|
+
* @param {Number|null} customX - Custom distance to move in pixels
|
|
170
|
+
*/
|
|
171
|
+
const right = (customX = null) => {
|
|
172
|
+
if (!canGoNext.value) return
|
|
173
|
+
|
|
174
|
+
const moveX = customX || itemWidth.value || 200
|
|
175
|
+
clearTimeout(timer.value)
|
|
176
|
+
|
|
177
|
+
timer.value = nextTick(() => {
|
|
178
|
+
inMove.value = true
|
|
179
|
+
const direction = $r.rtl ? 1 : -1
|
|
180
|
+
x.value = prePosition.value - (moveX * direction)
|
|
181
|
+
end()
|
|
182
|
+
clearTimeout(timer.value)
|
|
183
|
+
})
|
|
184
|
+
}
|
|
185
|
+
|
|
186
|
+
/**
|
|
187
|
+
* Navigates to the previous/left slide
|
|
188
|
+
* @param {Number|null} customX - Custom distance to move in pixels
|
|
189
|
+
*/
|
|
190
|
+
const left = (customX = null) => {
|
|
191
|
+
if (!canGoPrev.value) return
|
|
192
|
+
|
|
193
|
+
const moveX = customX || itemWidth.value || 200
|
|
194
|
+
clearTimeout(timer.value)
|
|
195
|
+
|
|
196
|
+
timer.value = setTimeout(() => {
|
|
197
|
+
inMove.value = true
|
|
198
|
+
const direction = $r.rtl ? 1 : -1
|
|
199
|
+
x.value = prePosition.value + (moveX * direction)
|
|
200
|
+
end()
|
|
201
|
+
clearTimeout(timer.value)
|
|
202
|
+
}, 50)
|
|
203
|
+
}
|
|
204
|
+
|
|
205
|
+
/**
|
|
206
|
+
* Handles touch/mouse move events
|
|
207
|
+
* @param {Object} e - Move event object with goX property
|
|
208
|
+
*/
|
|
209
|
+
const move = (e) => {
|
|
210
|
+
if (inMove.value || !e?.goX) return
|
|
211
|
+
|
|
212
|
+
inMove.value = true
|
|
213
|
+
clearTimeout(timer.value)
|
|
214
|
+
|
|
215
|
+
timer.value = setTimeout(() => {
|
|
216
|
+
x.value = prePosition.value + e.goX
|
|
217
|
+
inMove.value = false
|
|
218
|
+
}, 50)
|
|
219
|
+
}
|
|
220
|
+
|
|
221
|
+
/**
|
|
222
|
+
* Handles touch/mouse end events
|
|
223
|
+
* @param {Number|null} current - Current slide number for direct navigation
|
|
224
|
+
*/
|
|
225
|
+
const end = (current = null) => {
|
|
226
|
+
setTimeout(() => {
|
|
227
|
+
inMove.value = false
|
|
228
|
+
|
|
229
|
+
if (!swiperRef.value || !containerRef.value) return
|
|
230
|
+
|
|
231
|
+
const r = $r.rtl ? 1 : -1
|
|
232
|
+
const swiperWidth = swiperRef.value.offsetWidth
|
|
233
|
+
const containerWidth = containerRef.value.scrollWidth
|
|
234
|
+
|
|
235
|
+
if (x.value * r + swiperWidth >= containerWidth) {
|
|
236
|
+
x.value = (containerWidth - swiperWidth) / r
|
|
237
|
+
} else if (itemWidth.value) {
|
|
238
|
+
const diff = x.value - prePosition.value
|
|
239
|
+
const snapSteps = Math.round(diff / itemWidth.value)
|
|
240
|
+
x.value = prePosition.value + (snapSteps * itemWidth.value)
|
|
72
241
|
}
|
|
73
|
-
setTimeout(() => {
|
|
74
|
-
this.slides = Math.ceil(this.$refs.container.scrollWidth / this.$refs.swiper.offsetWidth)
|
|
75
|
-
}, 1000)
|
|
76
|
-
},
|
|
77
|
-
computed: {
|
|
78
|
-
itemWidth() {
|
|
79
|
-
if (this.width) {
|
|
80
|
-
return this.width
|
|
81
|
-
}
|
|
82
|
-
if (this.widthItem) {
|
|
83
|
-
return this.widthItem
|
|
84
|
-
}
|
|
85
242
|
|
|
86
|
-
|
|
243
|
+
if (x.value * r < 0) {
|
|
244
|
+
x.value = 0
|
|
87
245
|
}
|
|
88
|
-
},
|
|
89
|
-
methods: {
|
|
90
|
-
goToSlide(n) {
|
|
91
|
-
this.inMove = false
|
|
92
|
-
let s = -1
|
|
93
|
-
if (this.$r.rtl) {
|
|
94
|
-
s = 1
|
|
95
|
-
}
|
|
96
|
-
this.x = this.$refs.swiper.offsetWidth * (n - 1) * s
|
|
97
|
-
this.end()
|
|
98
|
-
},
|
|
99
|
-
right(x = null) {
|
|
100
|
-
if (x === null) {
|
|
101
|
-
x = this.itemWidth || 200
|
|
102
|
-
}
|
|
103
|
-
this.timer = setTimeout(() => {
|
|
104
|
-
this.inMove = true
|
|
105
|
-
this.x = this.prePosition - x
|
|
106
|
-
this.end()
|
|
107
|
-
clearTimeout(this.timer)
|
|
108
|
-
}, 50)
|
|
109
|
-
}, left(x = null) {
|
|
110
|
-
if (x === null) {
|
|
111
|
-
x = this.itemWidth || 200
|
|
112
|
-
}
|
|
113
|
-
this.timer = setTimeout(() => {
|
|
114
|
-
this.inMove = true
|
|
115
|
-
this.x = this.prePosition + x
|
|
116
|
-
this.end()
|
|
117
|
-
clearTimeout(this.timer)
|
|
118
|
-
}, 50)
|
|
119
|
-
}, move(e) {
|
|
120
|
-
if (this.inMove) {
|
|
121
|
-
return
|
|
122
|
-
}
|
|
123
|
-
this.inMove = true
|
|
124
|
-
this.timer = setTimeout(() => {
|
|
125
|
-
this.x = this.prePosition + e.goX
|
|
126
|
-
this.inMove = false
|
|
127
|
-
}, 50)
|
|
128
|
-
},
|
|
129
|
-
end(e) {
|
|
130
|
-
setTimeout(() => {
|
|
131
|
-
this.inMove = false
|
|
132
|
-
const r = this.$r.rtl ? 1 : -1
|
|
133
|
-
if (this.x * r + this.$refs.swiper.offsetWidth >= this.$refs.container.scrollWidth) {
|
|
134
|
-
this.x = (this.$refs.container.scrollWidth - this.$refs.swiper.offsetWidth) / r
|
|
135
|
-
} else if (this.itemWidth) {
|
|
136
|
-
this.x = this.prePosition + Math.round((this.x - this.prePosition) / this.itemWidth) * this.itemWidth
|
|
137
|
-
}
|
|
138
246
|
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
|
|
247
|
+
prePosition.value = x.value
|
|
248
|
+
if (typeof current === 'number') {
|
|
249
|
+
currentSlide.value = current
|
|
250
|
+
} else if (swiperWidth > 0) {
|
|
251
|
+
currentSlide.value = Math.ceil(x.value / swiperWidth * r) + 1
|
|
252
|
+
}
|
|
253
|
+
}, 60)
|
|
254
|
+
}
|
|
143
255
|
|
|
144
|
-
|
|
145
|
-
|
|
256
|
+
const handleResize = () => {
|
|
257
|
+
if (!swiperRef.value) return
|
|
146
258
|
|
|
259
|
+
if (props.numShow) {
|
|
260
|
+
if (typeof props.numShow === 'object') {
|
|
261
|
+
for (let name in props.numShow) {
|
|
262
|
+
if ($r.breakpoint && $r.breakpoint[name]) {
|
|
263
|
+
width.value = swiperRef.value.getBoundingClientRect().width / props.numShow[name]
|
|
264
|
+
break
|
|
265
|
+
}
|
|
266
|
+
}
|
|
267
|
+
} else {
|
|
268
|
+
width.value = swiperRef.value.getBoundingClientRect().width / props.numShow
|
|
147
269
|
}
|
|
148
270
|
}
|
|
271
|
+
|
|
272
|
+
nextTick(() => {
|
|
273
|
+
if (containerRef.value) {
|
|
274
|
+
slides.value = Math.ceil(containerRef.value.scrollWidth / swiperRef.value.offsetWidth)
|
|
275
|
+
}
|
|
276
|
+
})
|
|
277
|
+
|
|
149
278
|
}
|
|
279
|
+
|
|
280
|
+
|
|
281
|
+
onMounted(() => {
|
|
282
|
+
handleResize()
|
|
283
|
+
})
|
|
284
|
+
|
|
285
|
+
onUnmounted(() => {
|
|
286
|
+
clearTimeout(timer.value)
|
|
287
|
+
})
|
|
288
|
+
|
|
289
|
+
|
|
290
|
+
watch(() => props.items, () => {
|
|
291
|
+
x.value = 0
|
|
292
|
+
prePosition.value = 0
|
|
293
|
+
currentSlide.value = 1
|
|
294
|
+
|
|
295
|
+
handleResize()
|
|
296
|
+
}, {deep: true})
|
|
150
297
|
</script>
|
|
298
|
+
|
|
151
299
|
<style lang="scss">
|
|
152
|
-
@use "../../style
|
|
300
|
+
@use "../../style" as *;
|
|
153
301
|
|
|
154
|
-
.#{
|
|
302
|
+
.#{$prefix}swiper {
|
|
155
303
|
width: 100%;
|
|
156
304
|
max-width: 100%;
|
|
157
305
|
height: 100%;
|
|
@@ -20,14 +20,14 @@
|
|
|
20
20
|
<r-btn :disabled="page===1" @click.prevent="pageBtn('prev')" class="btn-shaped"
|
|
21
21
|
icon
|
|
22
22
|
text>
|
|
23
|
-
|
|
23
|
+
<r-icon v-html="$r.icons.chevron_left"></r-icon>
|
|
24
24
|
|
|
25
25
|
</r-btn>
|
|
26
26
|
<input name="input-page" type="text" :value="page" @input="pageN" class="input-page text-center">
|
|
27
27
|
<r-btn :disabled="endPage" @click.prevent="pageBtn('next')" class="btn-shaped"
|
|
28
28
|
icon
|
|
29
29
|
text>
|
|
30
|
-
|
|
30
|
+
<r-icon v-html="$r.icons.chevron_right"></r-icon>
|
|
31
31
|
|
|
32
32
|
</r-btn>
|
|
33
33
|
</div>
|
|
@@ -36,55 +36,79 @@
|
|
|
36
36
|
</r-container>
|
|
37
37
|
</div>
|
|
38
38
|
</template>
|
|
39
|
-
<script>
|
|
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
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
39
|
+
<script setup>
|
|
40
|
+
import {computed, inject} from 'vue'
|
|
41
|
+
|
|
42
|
+
const props = defineProps({
|
|
43
|
+
page: {type: Number, default: 1},
|
|
44
|
+
total: {},
|
|
45
|
+
perPage: {
|
|
46
|
+
type: Object,
|
|
47
|
+
default: () => ({name: '10', value: 10})
|
|
48
|
+
}
|
|
49
|
+
})
|
|
50
|
+
|
|
51
|
+
const emit = defineEmits(['update:per-page', 'update:page'])
|
|
52
|
+
|
|
53
|
+
const {$t} = inject('renusify')
|
|
54
|
+
|
|
55
|
+
const totalSetup = computed(() => {
|
|
56
|
+
let to = props.page * props.perPage.value
|
|
57
|
+
const from = to - props.perPage.value
|
|
58
|
+
|
|
59
|
+
if (to > props.total) {
|
|
60
|
+
to = props.total
|
|
61
|
+
}
|
|
62
|
+
|
|
63
|
+
return $t(['from_to_manage', [from, to, props.total]], 'renusify')
|
|
64
|
+
})
|
|
65
|
+
|
|
66
|
+
const endPage = computed(() => {
|
|
67
|
+
let to = props.page * props.perPage.value
|
|
68
|
+
if (to > props.total) {
|
|
69
|
+
to = props.total
|
|
70
|
+
}
|
|
71
|
+
|
|
72
|
+
return to === props.total
|
|
73
|
+
})
|
|
74
|
+
|
|
75
|
+
|
|
76
|
+
const totalPages = computed(() => {
|
|
77
|
+
if (!props.total || !props.perPage.value) return 1
|
|
78
|
+
return Math.ceil(props.total / props.perPage.value)
|
|
79
|
+
})
|
|
80
|
+
|
|
81
|
+
const perPageE = (e) => {
|
|
82
|
+
emit('update:per-page', e)
|
|
83
|
+
}
|
|
84
|
+
|
|
85
|
+
const pageN = (e) => {
|
|
86
|
+
let value = parseInt(e.target.value)
|
|
87
|
+
|
|
88
|
+
if (isNaN(value) || value < 1) {
|
|
89
|
+
value = 1
|
|
90
|
+
}
|
|
91
|
+
|
|
92
|
+
if (value > totalPages.value) {
|
|
93
|
+
value = totalPages.value
|
|
94
|
+
}
|
|
95
|
+
|
|
96
|
+
emit('update:page', value)
|
|
97
|
+
}
|
|
98
|
+
|
|
99
|
+
const pageBtn = (direction) => {
|
|
100
|
+
let newPage = props.page
|
|
101
|
+
|
|
102
|
+
if (direction === 'prev') {
|
|
103
|
+
newPage = Math.max(1, props.page - 1)
|
|
104
|
+
} else if (direction === 'next') {
|
|
105
|
+
newPage = Math.min(totalPages.value, props.page + 1)
|
|
106
|
+
} else if (direction === 'first') {
|
|
107
|
+
newPage = 1
|
|
108
|
+
} else if (direction === 'last') {
|
|
109
|
+
newPage = totalPages.value
|
|
110
|
+
}
|
|
111
|
+
|
|
112
|
+
emit('update:page', newPage)
|
|
113
|
+
}
|
|
90
114
|
</script>
|