PluginProbe ʕ •ᴥ•ʔ
Booking for Appointments and Events Calendar – Amelia / 1.2.31
Booking for Appointments and Events Calendar – Amelia v1.2.31
2.4.9 2.4.8 2.4.7 2.4.6 2.4.5 2.4.4 2.4.3 2.4.2 2.4.1 2.4 trunk 1.2.1 1.2.10 1.2.11 1.2.12 1.2.13 1.2.14 1.2.15 1.2.16 1.2.17 1.2.18 1.2.19 1.2.2 1.2.20 1.2.21 1.2.22 1.2.23 1.2.24 1.2.25 1.2.26 1.2.27 1.2.28 1.2.29 1.2.3 1.2.30 1.2.31 1.2.32 1.2.33 1.2.34 1.2.35 1.2.36 1.2.37 1.2.38 1.2.4 1.2.5 1.2.6 1.2.7 1.2.8 1.2.9 2.0 2.0.1 2.0.2 2.1 2.1.1 2.1.2 2.1.3 2.2 2.2.1 2.3
ameliabooking / v3 / src / views / _components / input-number / AmInputNumber.vue
ameliabooking / v3 / src / views / _components / input-number Last commit date
AmInputNumber.vue 1 year ago
AmInputNumber.vue
311 lines
1 <template>
2 <el-input-number
3 :id="id"
4 ref="amInputNumber"
5 v-model="model"
6 class="am-input-number"
7 :class="[`am-input-number__${size}`]"
8 :style="cssVars"
9 :min="min"
10 :max="max"
11 :step="step"
12 :step-strictly="stepStrictly"
13 :precision="precision"
14 :readonly="readonly"
15 :disabled="disabled"
16 :controls="controls"
17 :controls-position="controlsPosition"
18 :name="name"
19 :aria-label="ariaLabel"
20 :place-holder="placeHolder"
21 @blur="(e) => $emit('blur', e)"
22 @focus="(e) => $emit('focus', e)"
23 @change="(currentValue, oldValue) => $emit('change', currentValue, oldValue)"
24 />
25 </template>
26
27 <script setup>
28 // * Import from Vue
29 import {
30 ref,
31 toRefs,
32 inject,
33 computed
34 } from 'vue'
35
36 // * Composables
37 import { useColorTransparency } from '../../../assets/js/common/colorManipulation'
38
39 /**
40 * Component Props
41 */
42 const props = defineProps({
43 id: {
44 type: String,
45 },
46 modelValue: {
47 type: Number,
48 },
49 min: {
50 type: Number,
51 required: true,
52 },
53 max: {
54 type: Number,
55 default: Infinity,
56 },
57 step: {
58 type: Number,
59 default: 1,
60 },
61 stepStrictly: {
62 type: Boolean,
63 default: false,
64 },
65 precision: {
66 type: Number,
67 },
68 size: {
69 type: String,
70 default: 'default',
71 validator(value) {
72 return ['default', 'medium', 'small'].includes(value)
73 },
74 },
75 readonly: {
76 type: Boolean,
77 default: false,
78 },
79 disabled: {
80 type: Boolean,
81 default: false,
82 },
83 controls: {
84 type: Boolean,
85 default: true,
86 },
87 controlsPosition: {
88 // right
89 type: String,
90 },
91 name: {
92 type: String,
93 default: '',
94 },
95 ariaLabel: {
96 type: String,
97 default: 'input-number',
98 },
99 placeHolder: {
100 type: String,
101 default: '',
102 },
103 })
104
105 /**
106 * Component Emits
107 * */
108 const emits = defineEmits([
109 'change',
110 'visible-change',
111 'clear',
112 'blur',
113 'focus',
114 'update:modelValue',
115 ])
116
117 /**
118 * Component model
119 */
120 let { modelValue } = toRefs(props)
121 let model = computed({
122 get: () => modelValue.value,
123 set: (val) => {
124 emits('update:modelValue', val)
125 },
126 })
127
128 /**
129 * Component reference
130 */
131 const amInputNumber = ref(null)
132
133 // * Colors
134 let amColors = inject(
135 'amColors',
136 ref({
137 colorPrimary: '#1246D6',
138 colorSuccess: '#019719',
139 colorError: '#B4190F',
140 colorWarning: '#CCA20C',
141 colorMainBgr: '#FFFFFF',
142 colorMainHeadingText: '#33434C',
143 colorMainText: '#1A2C37',
144 colorSbBgr: '#17295A',
145 colorSbText: '#FFFFFF',
146 colorInpBgr: '#FFFFFF',
147 colorInpBorder: '#D1D5D7',
148 colorInpText: '#1A2C37',
149 colorInpPlaceHolder: '#1A2C37',
150 colorDropBgr: '#FFFFFF',
151 colorDropBorder: '#D1D5D7',
152 colorDropText: '#0E1920',
153 colorBtnPrim: '#265CF2',
154 colorBtnPrimText: '#FFFFFF',
155 colorBtnSec: '#1A2C37',
156 colorBtnSecText: '#FFFFFF',
157 })
158 )
159 let cssVars = computed(() => {
160 return {
161 '--am-c-inp-number-bgr': amColors.value.colorInpBgr,
162 '--am-c-inp-number-border': amColors.value.colorInpBorder,
163 '--am-c-inp-number-text': amColors.value.colorInpText,
164 '--am-c-inp-number-text-op10': useColorTransparency(
165 amColors.value.colorInpText,
166 0.1
167 ),
168 '--am-c-inp-number-text-op03': useColorTransparency(
169 amColors.value.colorInpText,
170 0.03
171 ),
172 '--am-c-inp-number-text-op40': useColorTransparency(
173 amColors.value.colorInpText,
174 0.4
175 ),
176 '--am-c-inp-number-text-op60': useColorTransparency(
177 amColors.value.colorInpText,
178 0.6
179 ),
180 '--am-c-inp-number-placeholder': amColors.value.colorInpPlaceHolder,
181 }
182 })
183 </script>
184
185 <style lang="scss">
186 @mixin am-inp-number-block {
187 .am-input-number {
188 --am-c-inp-number-bgr: var(--am-c-inp-bgr);
189 --am-c-inp-number-border: var(--am-c-inp-border);
190 --am-c-inp-number-text: var(--am-c-inp-text);
191 --am-c-inp-number-placeholder: var(--am-c-inp-placeholder);
192 --am-rad-inp-number: var(--am-rad-inp);
193 --am-fs-inp-number: var(--am-fs-inp);
194
195 &__default {
196 --am-input-number-height: 40px;
197 --am-input-number-padding: 8px 34px;
198 }
199
200 &__medium {
201 --am-input-number-height: 36px;
202 --am-input-number-padding: 6px 34px;
203 }
204
205 &__small {
206 --am-input-number-height: 32px;
207 --am-input-number-padding: 4px 34px;
208 }
209 }
210
211 .el-input-number {
212 .el-input {
213 &__wrapper {
214 height: var(--am-input-number-height);
215 border: none;
216 border-radius: var(--am-rad-inp-number);
217 background-color: var(--am-c-inp-number-bgr);
218 box-shadow: 0 0 0 1px var(--am-c-inp-number-border);
219 padding: var(--am-input-number-padding);
220 box-sizing: border-box;
221 transition: all 0.3s ease-in-out;
222
223 &.is-focus {
224 --am-c-inp-number-border: var(--am-c-primary);
225 }
226 }
227
228 &__inner {
229 font-size: var(--am-fs-inp-number);
230 line-height: 1.6;
231 color: var(--am-c-inp-number-text);
232 border: none;
233 background: none;
234 padding: 0;
235 margin: 0;
236 max-width: 100%;
237
238 &::-webkit-input-placeholder {
239 /* Chrome/Opera/Safari */
240 color: var(--am-c-inp-number-placeholder);
241 }
242 &::-moz-placeholder {
243 /* Firefox 19+ */
244 color: var(--am-c-inp-number-placeholder);
245 }
246 &:-ms-input-placeholder {
247 /* IE 10+ */
248 color: var(--am-c-inp-number-placeholder);
249 }
250 &:-moz-placeholder {
251 /* Firefox 18- */
252 color: var(--am-c-inp-number-placeholder);
253 }
254 }
255 }
256
257 &__decrease {
258 border-right-color: transparent;
259 }
260
261 &__increase {
262 border-left-color: transparent;
263 }
264
265 &__decrease,
266 &__increase {
267 background-color: transparent;
268
269 &:hover {
270 .el-icon {
271 color: var(--am-c-inp-number-text);
272 border-radius: 4px;
273 background-color: var(--am-c-inp-number-text-op10);
274 }
275
276 ~ .el-input:not(.is-disabled) .el-input__wrapper {
277 --am-c-inp-number-border: var(--am-c-primary);
278 }
279 }
280
281 .el-icon {
282 width: 22px;
283 height: 22px;
284 color: var(--am-c-inp-number-text);
285 }
286 }
287
288 &.is-disabled {
289 .el-icon {
290 color: var(--am-c-inp-number-text-op40);
291 }
292
293 .el-input__wrapper {
294 background-color: var(--am-c-inp-number-text-op03);
295 color: var(--am-c-inp-number-text-op60);
296 }
297 }
298 }
299 }
300
301 // public
302 .amelia-v2-booking #amelia-container {
303 @include am-inp-number-block;
304 }
305
306 // admin
307 #amelia-app-backend-new {
308 @include am-inp-number-block;
309 }
310 </style>
311