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,14 +1,12 @@
|
|
|
1
1
|
<template>
|
|
2
2
|
<r-input :class="`${$r.prefix}range`"
|
|
3
3
|
:modelValue="modelValue"
|
|
4
|
-
active
|
|
5
|
-
hide
|
|
6
|
-
tile
|
|
4
|
+
active-label
|
|
7
5
|
>
|
|
8
6
|
|
|
9
|
-
<div
|
|
7
|
+
<div ref="rangeRef" class="range-container">
|
|
10
8
|
<div
|
|
11
|
-
ref='
|
|
9
|
+
ref='dotRef'
|
|
12
10
|
v-touch="{'end':end,
|
|
13
11
|
'move':move}"
|
|
14
12
|
:style="{'transform':'translate3d('+x+'px,0,0)'}"
|
|
@@ -23,7 +21,7 @@
|
|
|
23
21
|
</div>
|
|
24
22
|
<div
|
|
25
23
|
v-if="isRange"
|
|
26
|
-
ref='
|
|
24
|
+
ref='dot2Ref'
|
|
27
25
|
v-touch="{'end':end2,
|
|
28
26
|
'move':move2}"
|
|
29
27
|
:style="{'transform':'translate3d('+x2+'px,0,0)'}"
|
|
@@ -47,172 +45,287 @@
|
|
|
47
45
|
</div>
|
|
48
46
|
</r-input>
|
|
49
47
|
</template>
|
|
50
|
-
<script>
|
|
51
|
-
|
|
52
|
-
export default {
|
|
53
|
-
name: 'r-range',
|
|
54
|
-
props: {
|
|
55
|
-
modelValue: {
|
|
56
|
-
type: [Number, Array]
|
|
57
|
-
},
|
|
58
|
-
min: {
|
|
59
|
-
type: Number,
|
|
60
|
-
default: 0
|
|
61
|
-
},
|
|
62
|
-
max: {
|
|
63
|
-
type: Number,
|
|
64
|
-
default: 100
|
|
65
|
-
},
|
|
66
|
-
color: {
|
|
67
|
-
type: String,
|
|
68
|
-
default: 'color-one'
|
|
69
|
-
},
|
|
70
|
-
step: {
|
|
71
|
-
type: Number,
|
|
72
|
-
default: 1
|
|
73
|
-
},
|
|
74
|
-
tooltipAlways: Boolean,
|
|
75
|
-
|
|
76
|
-
disabled: Boolean,
|
|
77
|
-
isRange: Boolean
|
|
78
48
|
|
|
49
|
+
<script setup>
|
|
50
|
+
import {ref, computed, onMounted, inject, nextTick, watch} from 'vue'
|
|
51
|
+
|
|
52
|
+
const props = defineProps({
|
|
53
|
+
/**
|
|
54
|
+
* The slider's model value
|
|
55
|
+
* @type {Number|Array}
|
|
56
|
+
*
|
|
57
|
+
* For single slider: Number
|
|
58
|
+
* For range slider: Array of two numbers [minValue, maxValue]
|
|
59
|
+
*/
|
|
60
|
+
modelValue: {
|
|
61
|
+
type: [Number, Array]
|
|
79
62
|
},
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
prePosition: 0,
|
|
89
|
-
prePosition2: 0,
|
|
90
|
-
preValue: 0,
|
|
91
|
-
preValue2: 0,
|
|
92
|
-
}
|
|
63
|
+
/**
|
|
64
|
+
* Minimum allowed value
|
|
65
|
+
* @type {Number}
|
|
66
|
+
* @default 0
|
|
67
|
+
*/
|
|
68
|
+
min: {
|
|
69
|
+
type: Number,
|
|
70
|
+
default: 0
|
|
93
71
|
},
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
this.preValue2 = this.max
|
|
103
|
-
}
|
|
104
|
-
if (this.modelValue !== undefined) {
|
|
105
|
-
this.preValue = this.isRange ? this.modelValue[0] : this.modelValue
|
|
106
|
-
this.preValue2 = this.modelValue[1]
|
|
107
|
-
}
|
|
108
|
-
|
|
109
|
-
this.set(this.preValue, this.preValue2)
|
|
110
|
-
|
|
72
|
+
/**
|
|
73
|
+
* Maximum allowed value
|
|
74
|
+
* @type {Number}
|
|
75
|
+
* @default 100
|
|
76
|
+
*/
|
|
77
|
+
max: {
|
|
78
|
+
type: Number,
|
|
79
|
+
default: 100
|
|
111
80
|
},
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
}
|
|
81
|
+
/**
|
|
82
|
+
* Color class for the slider track
|
|
83
|
+
* @type {String}
|
|
84
|
+
* @default 'color-one'
|
|
85
|
+
*/
|
|
86
|
+
color: {
|
|
87
|
+
type: String,
|
|
88
|
+
default: 'color-one'
|
|
121
89
|
},
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
|
|
146
|
-
|
|
147
|
-
const x = this.prePosition + e.goX
|
|
148
|
-
const r = this.$r.rtl ? -1 : 1
|
|
149
|
-
const value = (r * (this.max - this.min) * x / this.width) + this.min
|
|
150
|
-
if (value > this.max || (this.isRange && value > this.preValue2)) {
|
|
151
|
-
if (this.isRange) {
|
|
152
|
-
this.x = this.x2
|
|
153
|
-
} else {
|
|
154
|
-
this.x = this.width * r
|
|
155
|
-
}
|
|
156
|
-
this.$emit('update:modelValue', this.isRange ? [this.preValue2, this.preValue2] : this.max)
|
|
157
|
-
return
|
|
158
|
-
}
|
|
159
|
-
if (value < this.min) {
|
|
160
|
-
this.x = 0
|
|
161
|
-
this.$emit('update:modelValue', this.isRange ? [this.min, this.preValue2] : this.min)
|
|
162
|
-
return
|
|
163
|
-
}
|
|
164
|
-
this.x = x
|
|
165
|
-
this.emit(value)
|
|
166
|
-
},
|
|
167
|
-
end() {
|
|
168
|
-
this.inMove = false
|
|
169
|
-
this.prePosition = this.x
|
|
170
|
-
},
|
|
171
|
-
emit2(value) {
|
|
172
|
-
if (this.disabled) {
|
|
173
|
-
return
|
|
174
|
-
}
|
|
175
|
-
const v = Math.round(value / this.step) * this.step
|
|
176
|
-
if (v !== this.preValue2) {
|
|
177
|
-
this.$emit('update:modelValue', [this.preValue, v])
|
|
178
|
-
this.preValue2 = v
|
|
90
|
+
/**
|
|
91
|
+
* Step value for slider increments
|
|
92
|
+
* @type {Number}
|
|
93
|
+
* @default 1
|
|
94
|
+
*/
|
|
95
|
+
step: {
|
|
96
|
+
type: Number,
|
|
97
|
+
default: 1
|
|
98
|
+
},
|
|
99
|
+
/**
|
|
100
|
+
* Always show tooltip on slider handle
|
|
101
|
+
* @type {Boolean}
|
|
102
|
+
*/
|
|
103
|
+
tooltipAlways: Boolean,
|
|
104
|
+
/**
|
|
105
|
+
* Disable slider interaction
|
|
106
|
+
* @type {Boolean}
|
|
107
|
+
*/
|
|
108
|
+
disabled: Boolean,
|
|
109
|
+
/**
|
|
110
|
+
* Enable range slider with two handles
|
|
111
|
+
* @type {Boolean}
|
|
112
|
+
*/
|
|
113
|
+
isRange: Boolean
|
|
114
|
+
})
|
|
179
115
|
|
|
180
|
-
|
|
181
|
-
|
|
182
|
-
|
|
183
|
-
|
|
184
|
-
|
|
185
|
-
|
|
186
|
-
|
|
187
|
-
|
|
188
|
-
|
|
189
|
-
|
|
190
|
-
|
|
191
|
-
|
|
192
|
-
|
|
193
|
-
|
|
194
|
-
|
|
195
|
-
|
|
196
|
-
|
|
197
|
-
|
|
198
|
-
|
|
199
|
-
|
|
116
|
+
const emit = defineEmits([
|
|
117
|
+
/**
|
|
118
|
+
* Emitted when slider value changes
|
|
119
|
+
* @param {Number|Array} value - Updated slider value
|
|
120
|
+
*
|
|
121
|
+
* For single slider: Number value
|
|
122
|
+
* For range slider: Array [minValue, maxValue]
|
|
123
|
+
*/
|
|
124
|
+
'update:modelValue'
|
|
125
|
+
])
|
|
126
|
+
|
|
127
|
+
const {$r} = inject('renusify')
|
|
128
|
+
|
|
129
|
+
// Reactive data
|
|
130
|
+
const width = ref(0)
|
|
131
|
+
const inMove = ref(false)
|
|
132
|
+
const inMove2 = ref(false)
|
|
133
|
+
const x = ref(0)
|
|
134
|
+
const x2 = ref(0)
|
|
135
|
+
const prePosition = ref(0)
|
|
136
|
+
const prePosition2 = ref(0)
|
|
137
|
+
const preValue = ref(0)
|
|
138
|
+
const preValue2 = ref(0)
|
|
139
|
+
|
|
140
|
+
// Template refs
|
|
141
|
+
const rangeRef = ref(null)
|
|
142
|
+
const dotRef = ref(null)
|
|
143
|
+
const dot2Ref = ref(null)
|
|
144
|
+
|
|
145
|
+
// Computed properties
|
|
146
|
+
/**
|
|
147
|
+
* Right padding for RTL support (first handle in range mode)
|
|
148
|
+
* @returns {Number} Right padding value
|
|
149
|
+
*/
|
|
150
|
+
const padR = computed(() => {
|
|
151
|
+
const r = $r.rtl ? -1 : 1
|
|
152
|
+
return x.value * r
|
|
153
|
+
})
|
|
154
|
+
|
|
155
|
+
/**
|
|
156
|
+
* Left padding for RTL support (second handle in range mode)
|
|
157
|
+
* @returns {Number} Left padding value
|
|
158
|
+
*/
|
|
159
|
+
const padL = computed(() => {
|
|
160
|
+
const r = $r.rtl ? -1 : 1
|
|
161
|
+
return width.value - x2.value * r
|
|
162
|
+
})
|
|
163
|
+
|
|
164
|
+
// Methods - First handle (min value)
|
|
165
|
+
/**
|
|
166
|
+
* Emits updated value for first handle
|
|
167
|
+
* @param {Number} value - Raw value to emit
|
|
168
|
+
*/
|
|
169
|
+
const emitValue = (value) => {
|
|
170
|
+
if (props.disabled) {
|
|
171
|
+
return
|
|
172
|
+
}
|
|
173
|
+
const v = Math.round(value / props.step) * props.step
|
|
174
|
+
if (v !== preValue.value) {
|
|
175
|
+
emit('update:modelValue', props.isRange ? [v, preValue2.value] : v)
|
|
176
|
+
preValue.value = v
|
|
177
|
+
}
|
|
178
|
+
}
|
|
179
|
+
|
|
180
|
+
/**
|
|
181
|
+
* Sets slider handle positions based on values
|
|
182
|
+
* @param {Number} v - First handle value
|
|
183
|
+
* @param {Number} v2 - Second handle value
|
|
184
|
+
*/
|
|
185
|
+
const set = (v, v2) => {
|
|
186
|
+
const r = $r.rtl ? -1 : 1
|
|
187
|
+
const calcX = (v - props.min) / (r * (props.max - props.min) / width.value)
|
|
188
|
+
const calcX2 = (v2 - props.min) / (r * (props.max - props.min) / width.value)
|
|
189
|
+
x.value = calcX
|
|
190
|
+
x2.value = calcX2
|
|
191
|
+
end()
|
|
192
|
+
end2()
|
|
193
|
+
}
|
|
194
|
+
|
|
195
|
+
/**
|
|
196
|
+
* Handles first handle movement
|
|
197
|
+
* @param {Object} e - Movement event with goX property
|
|
198
|
+
*/
|
|
199
|
+
const move = (e) => {
|
|
200
|
+
if (props.disabled) {
|
|
201
|
+
return
|
|
202
|
+
}
|
|
203
|
+
inMove.value = true
|
|
204
|
+
const calcX = prePosition.value + e.goX
|
|
205
|
+
const r = $r.rtl ? -1 : 1
|
|
206
|
+
const value = (r * (props.max - props.min) * calcX / width.value) + props.min
|
|
200
207
|
|
|
201
|
-
|
|
202
|
-
|
|
203
|
-
|
|
204
|
-
|
|
205
|
-
|
|
206
|
-
this.prePosition2 = this.x2
|
|
208
|
+
if (value > props.max || (props.isRange && value > preValue2.value)) {
|
|
209
|
+
if (props.isRange) {
|
|
210
|
+
x.value = x2.value
|
|
211
|
+
} else {
|
|
212
|
+
x.value = width.value * r
|
|
207
213
|
}
|
|
214
|
+
emit('update:modelValue', props.isRange ? [preValue2.value, preValue2.value] : props.max)
|
|
215
|
+
return
|
|
216
|
+
}
|
|
217
|
+
|
|
218
|
+
if (value < props.min) {
|
|
219
|
+
x.value = 0
|
|
220
|
+
emit('update:modelValue', props.isRange ? [props.min, preValue2.value] : props.min)
|
|
221
|
+
return
|
|
222
|
+
}
|
|
223
|
+
|
|
224
|
+
x.value = calcX
|
|
225
|
+
emitValue(value)
|
|
226
|
+
}
|
|
227
|
+
|
|
228
|
+
/**
|
|
229
|
+
* Ends first handle movement
|
|
230
|
+
*/
|
|
231
|
+
const end = () => {
|
|
232
|
+
inMove.value = false
|
|
233
|
+
prePosition.value = x.value
|
|
234
|
+
}
|
|
235
|
+
|
|
236
|
+
// Methods - Second handle (max value, range mode only)
|
|
237
|
+
/**
|
|
238
|
+
* Emits updated value for second handle
|
|
239
|
+
* @param {Number} value - Raw value to emit
|
|
240
|
+
*/
|
|
241
|
+
const emitValue2 = (value) => {
|
|
242
|
+
if (props.disabled) {
|
|
243
|
+
return
|
|
244
|
+
}
|
|
245
|
+
const v = Math.round(value / props.step) * props.step
|
|
246
|
+
if (v !== preValue2.value) {
|
|
247
|
+
emit('update:modelValue', [preValue.value, v])
|
|
248
|
+
preValue2.value = v
|
|
208
249
|
}
|
|
209
250
|
}
|
|
251
|
+
|
|
252
|
+
/**
|
|
253
|
+
* Handles second handle movement
|
|
254
|
+
* @param {Object} e - Movement event with goX property
|
|
255
|
+
*/
|
|
256
|
+
const move2 = (e) => {
|
|
257
|
+
if (props.disabled) {
|
|
258
|
+
return
|
|
259
|
+
}
|
|
260
|
+
inMove2.value = true
|
|
261
|
+
const calcX = prePosition2.value + e.goX
|
|
262
|
+
const r = $r.rtl ? -1 : 1
|
|
263
|
+
const value = (r * (props.max - props.min) * calcX / width.value) + props.min
|
|
264
|
+
|
|
265
|
+
if (value > props.max) {
|
|
266
|
+
x2.value = width.value * r
|
|
267
|
+
emit('update:modelValue', [preValue.value, props.max])
|
|
268
|
+
return
|
|
269
|
+
}
|
|
270
|
+
|
|
271
|
+
if (value < props.min || value < preValue.value) {
|
|
272
|
+
x2.value = x.value
|
|
273
|
+
emit('update:modelValue', [preValue.value, preValue.value])
|
|
274
|
+
return
|
|
275
|
+
}
|
|
276
|
+
|
|
277
|
+
x2.value = calcX
|
|
278
|
+
emitValue2(value)
|
|
279
|
+
}
|
|
280
|
+
|
|
281
|
+
/**
|
|
282
|
+
* Ends second handle movement
|
|
283
|
+
*/
|
|
284
|
+
const end2 = () => {
|
|
285
|
+
inMove2.value = false
|
|
286
|
+
prePosition2.value = x2.value
|
|
287
|
+
}
|
|
288
|
+
|
|
289
|
+
/**
|
|
290
|
+
* Initializes slider dimensions and positions
|
|
291
|
+
*/
|
|
292
|
+
const init = () => {
|
|
293
|
+
nextTick(() => {
|
|
294
|
+
width.value = rangeRef.value.getBoundingClientRect().width - 10
|
|
295
|
+
preValue.value = props.min
|
|
296
|
+
|
|
297
|
+
if (props.isRange && (!props.modelValue || props.modelValue.length === 0)) {
|
|
298
|
+
emit('update:modelValue', [props.min, props.max])
|
|
299
|
+
const r = $r.rtl ? -1 : 1
|
|
300
|
+
x2.value = width.value * r
|
|
301
|
+
prePosition2.value = width.value * r
|
|
302
|
+
preValue2.value = props.max
|
|
303
|
+
}
|
|
304
|
+
|
|
305
|
+
if (props.modelValue && !(props.isRange && props.modelValue.length === 0)) {
|
|
306
|
+
preValue.value = props.isRange ? props.modelValue[0] : props.modelValue
|
|
307
|
+
preValue2.value = props.isRange ? props.modelValue[1] : props.max
|
|
308
|
+
}
|
|
309
|
+
|
|
310
|
+
set(preValue.value, preValue2.value)
|
|
311
|
+
})
|
|
312
|
+
}
|
|
313
|
+
|
|
314
|
+
onMounted(() => {
|
|
315
|
+
init()
|
|
316
|
+
})
|
|
317
|
+
|
|
318
|
+
watch(() => props.modelValue, () => {
|
|
319
|
+
if (!inMove.value && !inMove2.value) {
|
|
320
|
+
init()
|
|
321
|
+
}
|
|
322
|
+
}, {deep: true})
|
|
210
323
|
</script>
|
|
324
|
+
|
|
211
325
|
<style lang="scss">
|
|
212
|
-
@use "../../../style
|
|
213
|
-
@use "../../../style/mixins";
|
|
326
|
+
@use "../../../style" as *;
|
|
214
327
|
|
|
215
|
-
.#{
|
|
328
|
+
.#{$prefix}range {
|
|
216
329
|
height: 30px;
|
|
217
330
|
position: relative;
|
|
218
331
|
|
|
@@ -247,10 +360,10 @@ export default {
|
|
|
247
360
|
&:hover {
|
|
248
361
|
width: 16px;
|
|
249
362
|
height: 16px;
|
|
250
|
-
@include
|
|
363
|
+
@include rtl() {
|
|
251
364
|
transform: translate(2px, -2px);
|
|
252
365
|
}
|
|
253
|
-
@include
|
|
366
|
+
@include ltr() {
|
|
254
367
|
transform: translate(-2px, -2px);
|
|
255
368
|
}
|
|
256
369
|
border: 3px solid var(--color-one) !important;
|
|
@@ -275,10 +388,10 @@ export default {
|
|
|
275
388
|
width: auto;
|
|
276
389
|
height: 30px;
|
|
277
390
|
min-width: 30px;
|
|
278
|
-
@include
|
|
391
|
+
@include rtl() {
|
|
279
392
|
transform: translateX(calc(50% - 5px));
|
|
280
393
|
}
|
|
281
|
-
@include
|
|
394
|
+
@include ltr() {
|
|
282
395
|
transform: translateX(calc(-50% + 5px));
|
|
283
396
|
}
|
|
284
397
|
}
|
|
@@ -310,10 +423,10 @@ export default {
|
|
|
310
423
|
&:hover {
|
|
311
424
|
width: 16px;
|
|
312
425
|
height: 16px;
|
|
313
|
-
@include
|
|
426
|
+
@include rtl() {
|
|
314
427
|
transform: translate(2px, -2px);
|
|
315
428
|
}
|
|
316
|
-
@include
|
|
429
|
+
@include ltr() {
|
|
317
430
|
transform: translate(-2px, -2px);
|
|
318
431
|
}
|
|
319
432
|
border: 3px solid var(--color-one) !important;
|
|
@@ -338,10 +451,10 @@ export default {
|
|
|
338
451
|
width: auto;
|
|
339
452
|
height: 30px;
|
|
340
453
|
min-width: 30px;
|
|
341
|
-
@include
|
|
454
|
+
@include rtl() {
|
|
342
455
|
transform: translateX(calc(50% - 5px));
|
|
343
456
|
}
|
|
344
|
-
@include
|
|
457
|
+
@include ltr() {
|
|
345
458
|
transform: translateX(calc(-50% + 5px));
|
|
346
459
|
}
|
|
347
460
|
}
|
|
@@ -1,8 +1,10 @@
|
|
|
1
1
|
<template>
|
|
2
|
-
<div :class="`${$r.prefix}rating
|
|
3
|
-
<r-btn :key="i"
|
|
2
|
+
<div :class="`${$r.prefix}rating`">
|
|
3
|
+
<r-btn :key="i"
|
|
4
|
+
:class="`${Math.round(modelValue)>=i?'color-rating':''}`"
|
|
4
5
|
:readonly="readonly"
|
|
5
6
|
@click.prevent="select(i)"
|
|
7
|
+
:size="size"
|
|
6
8
|
icon
|
|
7
9
|
text
|
|
8
10
|
v-for="i in count">
|
|
@@ -11,74 +13,72 @@
|
|
|
11
13
|
</div>
|
|
12
14
|
</template>
|
|
13
15
|
|
|
14
|
-
<script>
|
|
16
|
+
<script setup>
|
|
15
17
|
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
default: 'default',
|
|
26
|
-
validator: function (value) {
|
|
27
|
-
return ['x-small', 'small', 'default', 'large', 'x-large'].indexOf(value) !== -1
|
|
28
|
-
}
|
|
29
|
-
},
|
|
30
|
-
modelValue: Number,
|
|
31
|
-
readonly: Boolean
|
|
18
|
+
const props = defineProps({
|
|
19
|
+
/**
|
|
20
|
+
* Total number of rating stars to display
|
|
21
|
+
* @type {Number}
|
|
22
|
+
* @default 5
|
|
23
|
+
*/
|
|
24
|
+
count: {
|
|
25
|
+
type: Number,
|
|
26
|
+
default: 5
|
|
32
27
|
},
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
28
|
+
/**
|
|
29
|
+
* Size of the rating stars
|
|
30
|
+
* @type {String}
|
|
31
|
+
* @default 'md'
|
|
32
|
+
* @validator ['xs', 'sm', 'md', 'lg', 'xl', 'xxl']
|
|
33
|
+
*/
|
|
34
|
+
size: {
|
|
35
|
+
type: String,
|
|
36
|
+
default: 'md',
|
|
37
|
+
validator: (value) => ['xs', 'sm', 'md', 'lg', 'xl', 'xxl'].includes(value)
|
|
38
38
|
},
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
39
|
+
/**
|
|
40
|
+
* Current rating value (0 to count)
|
|
41
|
+
* @type {Number}
|
|
42
|
+
*/
|
|
43
|
+
modelValue: Number,
|
|
44
|
+
/**
|
|
45
|
+
* Disable rating interaction
|
|
46
|
+
* @type {Boolean}
|
|
47
|
+
*/
|
|
48
|
+
readonly: Boolean
|
|
49
|
+
})
|
|
50
|
+
|
|
51
|
+
const emit = defineEmits([
|
|
52
|
+
/**
|
|
53
|
+
* Emitted when a rating is selected
|
|
54
|
+
* @param {Number} rating - The selected rating value (1 to count)
|
|
55
|
+
*/
|
|
56
|
+
'update:modelValue'
|
|
57
|
+
])
|
|
58
|
+
|
|
59
|
+
// Methods
|
|
60
|
+
/**
|
|
61
|
+
* Selects a rating value
|
|
62
|
+
* @param {Number} rating - The rating value to select
|
|
63
|
+
*/
|
|
64
|
+
const select = (rating) => {
|
|
65
|
+
if (props.readonly) return
|
|
66
|
+
emit('update:modelValue', rating)
|
|
44
67
|
}
|
|
45
68
|
</script>
|
|
69
|
+
|
|
46
70
|
<style lang="scss">
|
|
47
|
-
@use "../../../style
|
|
71
|
+
@use "../../../style" as *;
|
|
72
|
+
|
|
48
73
|
|
|
49
|
-
$
|
|
50
|
-
'x-small': 20,
|
|
51
|
-
'small': 25,
|
|
52
|
-
'default': 30,
|
|
53
|
-
'large': 35,
|
|
54
|
-
'x-large': 40
|
|
55
|
-
) !default;
|
|
56
|
-
.#{base.$prefix}rating {
|
|
74
|
+
.#{$prefix}rating {
|
|
57
75
|
max-width: 100%;
|
|
58
76
|
white-space: nowrap;
|
|
59
|
-
transition:
|
|
60
|
-
|
|
61
|
-
* {
|
|
62
|
-
color: var(--color-on-sheet-low);
|
|
63
|
-
}
|
|
77
|
+
transition: all $primary-transition;
|
|
64
78
|
|
|
65
79
|
.color-rating * {
|
|
66
80
|
color: #fbc02d !important;
|
|
67
81
|
}
|
|
68
|
-
|
|
69
|
-
@each $name, $size in $btn-sizes {
|
|
70
|
-
&.size-#{$name} {
|
|
71
|
-
.#{base.$prefix}btn {
|
|
72
|
-
height: #{$size}px;
|
|
73
|
-
width: #{$size}px
|
|
74
|
-
}
|
|
75
|
-
|
|
76
|
-
.#{base.$prefix}icon {
|
|
77
|
-
height: #{$size - 4px};
|
|
78
|
-
width: #{$size - 4px}
|
|
79
|
-
}
|
|
80
|
-
}
|
|
81
|
-
}
|
|
82
82
|
}
|
|
83
83
|
|
|
84
84
|
</style>
|
|
@@ -1,8 +1,6 @@
|
|
|
1
1
|
export * as rSelectInput from './index.vue'
|
|
2
2
|
export * as l_Input from '../input/index.js'
|
|
3
3
|
export * as l_icon from '../../icon/index.js'
|
|
4
|
-
export * as l_chip from '../../chip/index.js'
|
|
5
4
|
export * as l_line from '../../progress/line.js'
|
|
6
|
-
export * as
|
|
7
|
-
export * as l_list from '../../list/index.js'
|
|
5
|
+
export * as l_modal from '../../modal/index.js'
|
|
8
6
|
export * as d_clickOutside from '../../../directive/clickOutSide/index.js'
|