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
|
@@ -7,101 +7,168 @@
|
|
|
7
7
|
@click.prevent="handleClick">
|
|
8
8
|
<div class="check-input-container v-center">
|
|
9
9
|
<input :autofocus="autofocus"
|
|
10
|
+
ref="inputRef"
|
|
10
11
|
:type="type"
|
|
11
12
|
@focusin="active=true"
|
|
12
13
|
@focusout="active=false"
|
|
13
|
-
|
|
14
|
+
:placeholder="placeholder"
|
|
14
15
|
:value="lazyValue"
|
|
15
16
|
autocomplete="no"
|
|
16
|
-
|
|
17
|
+
@input="emitValue"
|
|
17
18
|
/>
|
|
18
|
-
<r-btn
|
|
19
|
-
:
|
|
20
|
-
|
|
21
|
-
:loading="loading" @click.prevent="check()" class="elevation-none mx-1">
|
|
19
|
+
<r-btn :class="{'color-success-text pe-1':pass!==null && pass!==false,'color-error-text pe-1':pass===false}"
|
|
20
|
+
:loading="loading"
|
|
21
|
+
class="elevation-none ms-1 btn-check" size="xs" @click.prevent="check()">
|
|
22
22
|
{{ $t('check', 'renusify') }}
|
|
23
|
-
<r-icon v-if="pass!==null && pass!==false" class="color-success-text" exact height="20" width="20"
|
|
23
|
+
<r-icon v-if="pass!==null && pass!==false" class="color-success-text ms-1" exact height="20" width="20"
|
|
24
24
|
v-html="$r.icons.check"></r-icon>
|
|
25
|
-
<r-icon v-if="
|
|
25
|
+
<r-icon v-if="pass===false" class="color-error-text ms-1" height="20" width="20"
|
|
26
|
+
v-html="$r.icons.close"></r-icon>
|
|
26
27
|
</r-btn>
|
|
27
28
|
</div>
|
|
28
29
|
</r-input>
|
|
29
30
|
</template>
|
|
30
|
-
<script>
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
link: String,
|
|
43
|
-
modelValue: [String, Number],
|
|
44
|
-
autofocus: Boolean,
|
|
45
|
-
headers: Object
|
|
46
|
-
},
|
|
47
|
-
emits:['update:modelValue','data'],
|
|
48
|
-
data() {
|
|
49
|
-
return {
|
|
50
|
-
lazyValue: this.modelValue,
|
|
51
|
-
msg: null,
|
|
52
|
-
pass: null,
|
|
53
|
-
loading: false,
|
|
54
|
-
active: false
|
|
55
|
-
}
|
|
31
|
+
<script setup>
|
|
32
|
+
import {ref, watch, inject, useAttrs} from 'vue'
|
|
33
|
+
|
|
34
|
+
const props = defineProps({
|
|
35
|
+
/**
|
|
36
|
+
* Input type attribute
|
|
37
|
+
* @type {String}
|
|
38
|
+
* @default 'text'
|
|
39
|
+
*/
|
|
40
|
+
type: {
|
|
41
|
+
type: String,
|
|
42
|
+
default: 'text'
|
|
56
43
|
},
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
44
|
+
|
|
45
|
+
/**
|
|
46
|
+
* Input name attribute
|
|
47
|
+
* @type {String}
|
|
48
|
+
* @default 'text'
|
|
49
|
+
*/
|
|
50
|
+
name: {
|
|
51
|
+
type: String,
|
|
52
|
+
default: 'text'
|
|
64
53
|
},
|
|
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
|
-
|
|
92
|
-
|
|
54
|
+
|
|
55
|
+
/**
|
|
56
|
+
* API endpoint URL for validation/checking
|
|
57
|
+
* @type {String}
|
|
58
|
+
*/
|
|
59
|
+
link: String,
|
|
60
|
+
|
|
61
|
+
/**
|
|
62
|
+
* The model value for the input (v-model)
|
|
63
|
+
* @type {String|Number}
|
|
64
|
+
*/
|
|
65
|
+
modelValue: [String, Number],
|
|
66
|
+
|
|
67
|
+
/**
|
|
68
|
+
* Additional headers for the API request
|
|
69
|
+
* @type {Object}
|
|
70
|
+
*/
|
|
71
|
+
headers: Object
|
|
72
|
+
})
|
|
73
|
+
|
|
74
|
+
const attr = useAttrs()
|
|
75
|
+
const placeholder = attr.placeholder
|
|
76
|
+
const autofocus = attr.autofocus
|
|
77
|
+
|
|
78
|
+
const emit = defineEmits([
|
|
79
|
+
/**
|
|
80
|
+
* Emitted when the model value changes
|
|
81
|
+
* @param {String|Number} value - The new value
|
|
82
|
+
*/
|
|
83
|
+
'update:modelValue',
|
|
84
|
+
|
|
85
|
+
/**
|
|
86
|
+
* Emitted when API validation/check completes
|
|
87
|
+
* @param {Object} data - Response data from the API
|
|
88
|
+
*/
|
|
89
|
+
'data'
|
|
90
|
+
])
|
|
91
|
+
|
|
92
|
+
const {$t} = inject('renusify')
|
|
93
|
+
const $axios = inject('axios')
|
|
94
|
+
|
|
95
|
+
const lazyValue = ref(props.modelValue)
|
|
96
|
+
const msg = ref(null)
|
|
97
|
+
const pass = ref(null)
|
|
98
|
+
const loading = ref(false)
|
|
99
|
+
const active = ref(false)
|
|
100
|
+
|
|
101
|
+
const inputRef = ref(null)
|
|
102
|
+
|
|
103
|
+
watch(() => props.modelValue, (newValue) => {
|
|
104
|
+
msg.value = null
|
|
105
|
+
pass.value = null
|
|
106
|
+
emit('data', {})
|
|
107
|
+
lazyValue.value = newValue
|
|
108
|
+
})
|
|
109
|
+
|
|
110
|
+
/**
|
|
111
|
+
* Validates the input value against the API endpoint
|
|
112
|
+
* @async
|
|
113
|
+
*/
|
|
114
|
+
const check = async () => {
|
|
115
|
+
if (!props.link || !$axios) return
|
|
116
|
+
|
|
117
|
+
loading.value = true
|
|
118
|
+
|
|
119
|
+
try {
|
|
120
|
+
const response = await $axios.post(props.link, {
|
|
121
|
+
[props.name]: lazyValue.value
|
|
122
|
+
}, {headers: props.headers})
|
|
123
|
+
|
|
124
|
+
emit('data', response.data)
|
|
125
|
+
msg.value = null
|
|
126
|
+
pass.value = true
|
|
127
|
+
} catch (error) {
|
|
128
|
+
if (error.response?.data?.msg) {
|
|
129
|
+
msg.value = $t ? $t(error.response.data.msg, 'renusify') : error.response.data.msg
|
|
130
|
+
} else {
|
|
131
|
+
msg.value = error.message || 'An error occurred'
|
|
93
132
|
}
|
|
133
|
+
|
|
134
|
+
emit('data', error.response?.data || {error: error.message})
|
|
135
|
+
pass.value = false
|
|
136
|
+
} finally {
|
|
137
|
+
loading.value = false
|
|
94
138
|
}
|
|
95
139
|
}
|
|
96
140
|
|
|
141
|
+
/**
|
|
142
|
+
* Focuses the input element
|
|
143
|
+
*/
|
|
144
|
+
const handleClick = () => {
|
|
145
|
+
if (inputRef.value) {
|
|
146
|
+
inputRef.value.focus()
|
|
147
|
+
}
|
|
148
|
+
}
|
|
149
|
+
|
|
150
|
+
/**
|
|
151
|
+
* Handles input change and emits the updated value
|
|
152
|
+
* @param {Event} event - Input change event
|
|
153
|
+
*/
|
|
154
|
+
const emitValue = (event) => {
|
|
155
|
+
lazyValue.value = event.target.value
|
|
156
|
+
emit('update:modelValue', lazyValue.value)
|
|
157
|
+
}
|
|
97
158
|
</script>
|
|
98
159
|
<style lang="scss">
|
|
99
|
-
@use "../../../style
|
|
160
|
+
@use "../../../style" as *;
|
|
100
161
|
|
|
101
|
-
.#{
|
|
162
|
+
.#{$prefix}check-input {
|
|
102
163
|
.check-input-container {
|
|
103
164
|
display: flex;
|
|
104
165
|
width: 100%;
|
|
166
|
+
border-radius: inherit;
|
|
167
|
+
}
|
|
168
|
+
|
|
169
|
+
.btn-check.#{$prefix}btn {
|
|
170
|
+
max-height: 30px;
|
|
171
|
+
border-radius: inherit;
|
|
105
172
|
}
|
|
106
173
|
}
|
|
107
174
|
</style>
|
|
@@ -1,77 +1,111 @@
|
|
|
1
1
|
<template>
|
|
2
2
|
<r-input :class="{
|
|
3
|
-
[`${
|
|
4
|
-
'checkbox-readonly':
|
|
3
|
+
[`${$r.prefix}checkbox`]:true,
|
|
4
|
+
'checkbox-readonly': readonly,
|
|
5
5
|
}" :modelValue="lazyValue" hide>
|
|
6
6
|
<template v-slot="{isRequired}">
|
|
7
|
-
<div class="
|
|
7
|
+
<div class="checkbox-holder">
|
|
8
8
|
<span class="checkbox-input" :class="{
|
|
9
9
|
[size]:true,
|
|
10
10
|
'br-circle':rounded,
|
|
11
11
|
'checkbox-select':modelValue
|
|
12
|
-
}" @click.prevent="
|
|
12
|
+
}" @click.prevent="toggle">
|
|
13
13
|
<transition name="scale">
|
|
14
14
|
<r-icon v-if="modelValue"
|
|
15
15
|
class="color-white-text"
|
|
16
16
|
v-html="$r.icons.check" exact></r-icon>
|
|
17
17
|
</transition>
|
|
18
18
|
</span>
|
|
19
|
-
<span class="ms-2 checkbox-label" @click.prevent="
|
|
19
|
+
<span class="ms-2 checkbox-label" @click.prevent="toggle">
|
|
20
20
|
<span class="color-error-text" v-if="isRequired">*</span>
|
|
21
|
+
<!-- Slot for custom label.-->
|
|
21
22
|
<slot name="label">{{ label }}</slot>
|
|
22
23
|
</span>
|
|
23
24
|
</div>
|
|
24
25
|
</template>
|
|
25
26
|
</r-input>
|
|
26
27
|
</template>
|
|
27
|
-
<script>
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
28
|
+
<script setup>
|
|
29
|
+
import {ref, watch} from 'vue'
|
|
30
|
+
|
|
31
|
+
const props = defineProps({
|
|
32
|
+
/**
|
|
33
|
+
* Label text for the component
|
|
34
|
+
* @type {String}
|
|
35
|
+
*/
|
|
36
|
+
label: String,
|
|
37
|
+
|
|
38
|
+
/**
|
|
39
|
+
* Makes the component read-only
|
|
40
|
+
* @type {Boolean}
|
|
41
|
+
*/
|
|
42
|
+
readonly: Boolean,
|
|
43
|
+
|
|
44
|
+
/**
|
|
45
|
+
* Applies rounded corners to the component
|
|
46
|
+
* @type {Boolean}
|
|
47
|
+
*/
|
|
48
|
+
rounded: Boolean,
|
|
49
|
+
|
|
50
|
+
/**
|
|
51
|
+
* The model value for the component (v-model)
|
|
52
|
+
* @type {Boolean}
|
|
53
|
+
*/
|
|
54
|
+
modelValue: Boolean,
|
|
55
|
+
|
|
56
|
+
/**
|
|
57
|
+
* Size of the component
|
|
58
|
+
* @type {String}
|
|
59
|
+
* @default 'default'
|
|
60
|
+
* @values xs, sm, md, lg, xl, xxl
|
|
61
|
+
*/
|
|
62
|
+
size: {
|
|
63
|
+
type: String,
|
|
64
|
+
default: 'md',
|
|
65
|
+
validator: (value) => {
|
|
66
|
+
return ['xs', 'sm', 'md', 'lg', 'xl', 'xxl'].includes(value)
|
|
47
67
|
}
|
|
48
68
|
},
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
69
|
+
})
|
|
70
|
+
|
|
71
|
+
const emit = defineEmits([
|
|
72
|
+
/**
|
|
73
|
+
* Emitted when the model value changes
|
|
74
|
+
* @param {Boolean} value - The new value
|
|
75
|
+
*/
|
|
76
|
+
'update:modelValue'
|
|
77
|
+
])
|
|
78
|
+
|
|
79
|
+
const lazyValue = ref(props.modelValue)
|
|
80
|
+
|
|
81
|
+
watch(() => props.modelValue, (newValue) => {
|
|
82
|
+
lazyValue.value = newValue
|
|
83
|
+
})
|
|
84
|
+
|
|
85
|
+
/**
|
|
86
|
+
* Toggles the component's value
|
|
87
|
+
*/
|
|
88
|
+
const toggle = () => {
|
|
89
|
+
if (props.readonly) {
|
|
90
|
+
return
|
|
63
91
|
}
|
|
64
|
-
}
|
|
65
92
|
|
|
93
|
+
lazyValue.value = !lazyValue.value
|
|
94
|
+
emit('update:modelValue', lazyValue.value)
|
|
95
|
+
}
|
|
66
96
|
</script>
|
|
67
97
|
<style lang="scss">
|
|
68
98
|
@use "sass:map";
|
|
69
|
-
@use "../../../style
|
|
99
|
+
@use "../../../style" as *;
|
|
70
100
|
|
|
71
|
-
.#{
|
|
101
|
+
.#{$prefix}checkbox {
|
|
72
102
|
width: 100%;
|
|
73
103
|
cursor: pointer;
|
|
74
104
|
|
|
105
|
+
.checkbox-holder{
|
|
106
|
+
display: flex;
|
|
107
|
+
align-items: center;
|
|
108
|
+
}
|
|
75
109
|
.checkbox-label {
|
|
76
110
|
color: var(--color-on-sheet);
|
|
77
111
|
}
|
|
@@ -80,7 +114,7 @@ export default {
|
|
|
80
114
|
border: 1px solid var(--color-on-sheet-low)
|
|
81
115
|
}
|
|
82
116
|
|
|
83
|
-
.#{
|
|
117
|
+
.#{$prefix}icon {
|
|
84
118
|
width: 100%;
|
|
85
119
|
height: 100%;
|
|
86
120
|
display: flex;
|
|
@@ -90,10 +124,10 @@ export default {
|
|
|
90
124
|
|
|
91
125
|
.checkbox-input {
|
|
92
126
|
text-align: center;
|
|
93
|
-
border-radius: map.get(
|
|
127
|
+
border-radius: map.get($borders, 'sm');
|
|
94
128
|
transition: .3s all ease-in-out;
|
|
95
129
|
|
|
96
|
-
&.
|
|
130
|
+
&.xs {
|
|
97
131
|
width: 17px;
|
|
98
132
|
height: 17px;
|
|
99
133
|
|
|
@@ -103,7 +137,7 @@ export default {
|
|
|
103
137
|
}
|
|
104
138
|
}
|
|
105
139
|
|
|
106
|
-
&.
|
|
140
|
+
&.sm {
|
|
107
141
|
width: 20px;
|
|
108
142
|
height: 20px;
|
|
109
143
|
|
|
@@ -113,7 +147,7 @@ export default {
|
|
|
113
147
|
}
|
|
114
148
|
}
|
|
115
149
|
|
|
116
|
-
&.
|
|
150
|
+
&.md {
|
|
117
151
|
width: 22px;
|
|
118
152
|
height: 22px;
|
|
119
153
|
|
|
@@ -123,7 +157,7 @@ export default {
|
|
|
123
157
|
}
|
|
124
158
|
}
|
|
125
159
|
|
|
126
|
-
&.
|
|
160
|
+
&.lg {
|
|
127
161
|
width: 25px;
|
|
128
162
|
height: 25px;
|
|
129
163
|
|
|
@@ -133,7 +167,7 @@ export default {
|
|
|
133
167
|
}
|
|
134
168
|
}
|
|
135
169
|
|
|
136
|
-
&.
|
|
170
|
+
&.xl {
|
|
137
171
|
width: 30px;
|
|
138
172
|
height: 30px;
|
|
139
173
|
|
|
@@ -142,6 +176,16 @@ export default {
|
|
|
142
176
|
height: 25px;
|
|
143
177
|
}
|
|
144
178
|
}
|
|
179
|
+
|
|
180
|
+
&.xxl {
|
|
181
|
+
width: 40px;
|
|
182
|
+
height: 40px;
|
|
183
|
+
|
|
184
|
+
svg {
|
|
185
|
+
width: 35px;
|
|
186
|
+
height: 35px;
|
|
187
|
+
}
|
|
188
|
+
}
|
|
145
189
|
}
|
|
146
190
|
|
|
147
191
|
&.checkbox-readonly {
|
|
@@ -1,94 +1,92 @@
|
|
|
1
1
|
<template>
|
|
2
2
|
<div class="color-alpha ms-1">
|
|
3
|
-
<canvas
|
|
4
|
-
|
|
5
|
-
|
|
3
|
+
<canvas
|
|
4
|
+
ref="canvasRef"
|
|
5
|
+
v-touch="{'end': handleMove, 'move': handleMove}"
|
|
6
|
+
:height="height"
|
|
7
|
+
:width="width"
|
|
8
|
+
/>
|
|
9
|
+
<div :style="slideStyle" class="slide"/>
|
|
6
10
|
</div>
|
|
7
11
|
</template>
|
|
8
12
|
|
|
9
|
-
<script>
|
|
10
|
-
|
|
11
|
-
import {
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
default: '#000000',
|
|
18
|
-
},
|
|
19
|
-
rgba: {
|
|
20
|
-
type: Object,
|
|
21
|
-
default: null,
|
|
22
|
-
},
|
|
23
|
-
width: {
|
|
24
|
-
type: Number,
|
|
25
|
-
default: 15,
|
|
26
|
-
},
|
|
27
|
-
height: {
|
|
28
|
-
type: Number,
|
|
29
|
-
default: 152,
|
|
30
|
-
},
|
|
31
|
-
},
|
|
32
|
-
mixins: [color],
|
|
33
|
-
emits: ['selectAlpha'],
|
|
34
|
-
data() {
|
|
35
|
-
return {
|
|
36
|
-
style: {},
|
|
37
|
-
alphaSize: 5,
|
|
38
|
-
ctx: null
|
|
39
|
-
}
|
|
13
|
+
<script setup>
|
|
14
|
+
import {ref, watch, onMounted, computed} from 'vue'
|
|
15
|
+
import {useColor} from './useColor.js'
|
|
16
|
+
|
|
17
|
+
const props = defineProps({
|
|
18
|
+
color: {
|
|
19
|
+
type: String,
|
|
20
|
+
default: '#000000',
|
|
40
21
|
},
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
},
|
|
45
|
-
'rgba.a'() {
|
|
46
|
-
this.renderSlide()
|
|
47
|
-
},
|
|
22
|
+
rgba: {
|
|
23
|
+
type: Object,
|
|
24
|
+
default: () => ({a: 1}),
|
|
48
25
|
},
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
this.renderSlide()
|
|
26
|
+
width: {
|
|
27
|
+
type: Number,
|
|
28
|
+
default: 15,
|
|
53
29
|
},
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
return
|
|
58
|
-
}
|
|
59
|
-
const canvasSquare = this.createAlphaSquare(this.alphaSize)
|
|
60
|
-
this.ctx.fillStyle = this.ctx.createPattern(canvasSquare, 'repeat')
|
|
61
|
-
this.ctx.fillRect(0, 0, this.width, this.height)
|
|
62
|
-
|
|
63
|
-
this.createLinearGradient(
|
|
64
|
-
'p',
|
|
65
|
-
this.ctx,
|
|
66
|
-
this.width,
|
|
67
|
-
this.height,
|
|
68
|
-
'rgba(255,255,255,0)',
|
|
69
|
-
this.color
|
|
70
|
-
)
|
|
71
|
-
},
|
|
72
|
-
renderSlide() {
|
|
73
|
-
this.style = {
|
|
74
|
-
top: this.rgba.a * this.height + 'px',
|
|
75
|
-
}
|
|
76
|
-
},
|
|
77
|
-
move(e) {
|
|
78
|
-
let y = e.current.y
|
|
79
|
-
if (y <= 0) {
|
|
80
|
-
this.$emit('selectAlpha', 0)
|
|
81
|
-
return
|
|
82
|
-
}
|
|
83
|
-
if (y >= this.height) {
|
|
84
|
-
this.$emit('selectAlpha', 1)
|
|
85
|
-
return
|
|
86
|
-
}
|
|
87
|
-
|
|
88
|
-
let a = parseFloat((y / this.height).toFixed(2))
|
|
89
|
-
this.$emit('selectAlpha', a)
|
|
90
|
-
}
|
|
30
|
+
height: {
|
|
31
|
+
type: Number,
|
|
32
|
+
default: 152,
|
|
91
33
|
},
|
|
34
|
+
})
|
|
35
|
+
|
|
36
|
+
const emit = defineEmits(['selectAlpha'])
|
|
37
|
+
|
|
38
|
+
const {createAlphaSquare, createLinearGradient} = useColor()
|
|
39
|
+
|
|
40
|
+
const canvasRef = ref(null)
|
|
41
|
+
const ctx = ref(null)
|
|
42
|
+
const alphaSize = 5
|
|
43
|
+
|
|
44
|
+
const slideStyle = computed(() => ({
|
|
45
|
+
top: `${(props.rgba?.a || 1) * props.height}px`,
|
|
46
|
+
}))
|
|
47
|
+
|
|
48
|
+
watch(() => props.color, renderColor)
|
|
49
|
+
|
|
50
|
+
|
|
51
|
+
onMounted(() => {
|
|
52
|
+
if (canvasRef.value) {
|
|
53
|
+
ctx.value = canvasRef.value.getContext('2d', {willReadFrequently: true})
|
|
54
|
+
renderColor()
|
|
55
|
+
}
|
|
56
|
+
})
|
|
57
|
+
|
|
58
|
+
function renderColor() {
|
|
59
|
+
if (!ctx.value) return
|
|
60
|
+
|
|
61
|
+
const canvasSquare = createAlphaSquare(alphaSize)
|
|
62
|
+
ctx.value.fillStyle = ctx.value.createPattern(canvasSquare, 'repeat')
|
|
63
|
+
ctx.value.fillRect(0, 0, props.width, props.height)
|
|
64
|
+
|
|
65
|
+
createLinearGradient(
|
|
66
|
+
'p',
|
|
67
|
+
ctx.value,
|
|
68
|
+
props.width,
|
|
69
|
+
props.height,
|
|
70
|
+
'rgba(255,255,255,0)',
|
|
71
|
+
props.color
|
|
72
|
+
)
|
|
73
|
+
}
|
|
74
|
+
|
|
75
|
+
function handleMove(e) {
|
|
76
|
+
let y = e.current.y
|
|
77
|
+
|
|
78
|
+
if (y <= 0) {
|
|
79
|
+
emit('selectAlpha', 0)
|
|
80
|
+
return
|
|
81
|
+
}
|
|
82
|
+
|
|
83
|
+
if (y >= props.height) {
|
|
84
|
+
emit('selectAlpha', 1)
|
|
85
|
+
return
|
|
86
|
+
}
|
|
87
|
+
|
|
88
|
+
let a = parseFloat((y / props.height).toFixed(2))
|
|
89
|
+
emit('selectAlpha', a)
|
|
92
90
|
}
|
|
93
91
|
</script>
|
|
94
92
|
|
|
@@ -108,4 +106,4 @@ export default {
|
|
|
108
106
|
pointer-events: none;
|
|
109
107
|
}
|
|
110
108
|
}
|
|
111
|
-
</style>
|
|
109
|
+
</style>
|