AmAdvancedSelect.vue
928 lines
| 1 | <template> |
| 2 | <div ref="advSelectWrapperRef" class="am-adv-select__wrapper"> |
| 3 | <el-cascader |
| 4 | ref="advSelect" |
| 5 | v-model="model" |
| 6 | class="am-adv-select" |
| 7 | :class="[ |
| 8 | `am-adv-select--${size}`, |
| 9 | { 'am-adv-select--disabled': disabled }, |
| 10 | { 'am-rtl': isRtl }, |
| 11 | ]" |
| 12 | :options="props.options" |
| 13 | :props="props.propsData" |
| 14 | :placeholder="props.placeholder" |
| 15 | :disabled="props.disabled" |
| 16 | :clearable="props.clearable" |
| 17 | :show-all-levels="props.showAllLevels" |
| 18 | :collapse-tags="props.collapseTags" |
| 19 | :collapse-tags-tooltip="props.collapseTagsTooltip" |
| 20 | :separator="props.separator" |
| 21 | :filterable="props.filterable" |
| 22 | :filter-method="props.filterMethod" |
| 23 | :debounce="props.debounce" |
| 24 | :before-filter="props.beforeFilter" |
| 25 | :popper-class="popperClasses" |
| 26 | :teleported="props.teleported" |
| 27 | :tag-type="props.tagType" |
| 28 | :tag-effect="props.tagEffect" |
| 29 | :validate-event="props.validateEvent" |
| 30 | :max-collapse-tags="props.maxCollapseTags" |
| 31 | :persistent="props.persistent" |
| 32 | :fallback-placements="props.fallbackPlacements" |
| 33 | :placement="props.placement" |
| 34 | :style="cssVars" |
| 35 | :aria-label="props.ariaLabel" |
| 36 | @change="handleChange" |
| 37 | @expand-change="handleExpandChange" |
| 38 | @blur="(e) => emits('blur', e)" |
| 39 | @focus="(e) => emits('focus', e)" |
| 40 | @visible-change="handleVisibleChange" |
| 41 | @remove-tag="(val) => emits('remove-tag', val)" |
| 42 | > |
| 43 | <template v-if="props.prefixIcon" #prefix> |
| 44 | <component :is="props.prefixIcon" v-if="typeof props.prefixIcon === 'object'" /> |
| 45 | <span v-if="typeof props.prefixIcon === 'string'" :class="`am-icon-${props.prefixIcon}`" /> |
| 46 | </template> |
| 47 | <template #empty> |
| 48 | <span> |
| 49 | {{ emptyStateString }} |
| 50 | </span> |
| 51 | </template> |
| 52 | <template #default="{ node, data }"> |
| 53 | <div v-if="!node.isLeaf" class="am-adv-select__item" :style="cssDropdownVars"> |
| 54 | <span class="am-adv-select__item-label"> |
| 55 | {{ data[props.propsData.label] }} |
| 56 | </span> |
| 57 | <span class="am-adv-select__item-quantity"> |
| 58 | {{ `(${data[props.propsData.children].length})` }} |
| 59 | </span> |
| 60 | </div> |
| 61 | <div |
| 62 | v-if="node.isLeaf" |
| 63 | class="am-adv-select__item" |
| 64 | :class="{ 'am-adv-select__item-checked': node.checked }" |
| 65 | :style="cssDropdownVars" |
| 66 | > |
| 67 | <span class="am-adv-select__item-label"> |
| 68 | {{ data[props.propsData.label] }} |
| 69 | </span> |
| 70 | <span v-if="data.price" class="am-adv-select__item-price"> |
| 71 | {{ ` ${useFormattedPrice(data.price)}` }} |
| 72 | <span v-if="taxVisibility(data.id)" class="am-adv-select__item-tax"> |
| 73 | <template v-if="props.taxOptions.find((a) => a.id === data.id).excluded"> |
| 74 | {{ props.taxLabel }} |
| 75 | </template> |
| 76 | <template v-else> |
| 77 | {{ props.taxLabelIncl }} |
| 78 | </template> |
| 79 | </span> |
| 80 | </span> |
| 81 | </div> |
| 82 | </template> |
| 83 | </el-cascader> |
| 84 | |
| 85 | <teleport |
| 86 | v-if="teleportCategoryDisable && categoryName" |
| 87 | :to="`${popperId} .am-adv-select__popper-${uniqueClassSuffix} .el-cascader-panel .el-cascader-menu:nth-child(1)`" |
| 88 | :disabled="!teleportCategoryDisable && categoryName" |
| 89 | > |
| 90 | <span v-if="options.length" class="am-adv-select__popper-heading" :style="cssTeleport"> |
| 91 | {{ categoryName }} |
| 92 | </span> |
| 93 | </teleport> |
| 94 | |
| 95 | <teleport |
| 96 | v-if="teleportSubCategoryDisable && subCategoryName" |
| 97 | :to="`${popperId} .am-adv-select__popper-${uniqueClassSuffix} .el-cascader-panel .el-cascader-menu:nth-child(2)`" |
| 98 | :disabled="!teleportSubCategoryDisable && subCategoryName" |
| 99 | > |
| 100 | <span v-if="options.length" class="am-adv-select__popper-heading" :style="cssTeleport"> |
| 101 | {{ subCategoryName }} |
| 102 | </span> |
| 103 | </teleport> |
| 104 | </div> |
| 105 | </template> |
| 106 | |
| 107 | <script setup> |
| 108 | import { computed, inject, nextTick, ref, toRefs } from 'vue' |
| 109 | import { useColorTransparency } from '../../../assets/js/common/colorManipulation' |
| 110 | import { useFormattedPrice } from '../../../assets/js/common/formatting' |
| 111 | import { useElementSize } from '@vueuse/core' |
| 112 | |
| 113 | /** |
| 114 | * Component Props |
| 115 | */ |
| 116 | const props = defineProps({ |
| 117 | id: { |
| 118 | type: String, |
| 119 | }, |
| 120 | modelValue: { |
| 121 | type: [String, Array, Object, Number], |
| 122 | }, |
| 123 | options: { |
| 124 | // * data of the options, the key of value and label can be customize by CascaderProps |
| 125 | type: Array, |
| 126 | default: () => [], |
| 127 | }, |
| 128 | propsData: { |
| 129 | // * configuration options, see the following CascaderProps table. |
| 130 | type: Object, |
| 131 | }, |
| 132 | size: { |
| 133 | // default / medium / small / mini / micro |
| 134 | type: String, |
| 135 | default: 'default', |
| 136 | validator(value) { |
| 137 | return ['default', 'medium', 'small', 'mini', 'micro'].includes(value) |
| 138 | }, |
| 139 | }, |
| 140 | placeholder: { |
| 141 | type: String, |
| 142 | default: '', |
| 143 | }, |
| 144 | disabled: { |
| 145 | // * whether Cascader is disabled |
| 146 | type: Boolean, |
| 147 | default: false, |
| 148 | }, |
| 149 | clearable: { |
| 150 | // * whether selected value can be cleared |
| 151 | type: Boolean, |
| 152 | default: true, |
| 153 | }, |
| 154 | showAllLevels: { |
| 155 | // * whether to display all levels of the selected value in the input |
| 156 | type: Boolean, |
| 157 | default: true, |
| 158 | }, |
| 159 | collapseTags: { |
| 160 | // * whether to collapse tags in multiple selection mode |
| 161 | type: Boolean, |
| 162 | default: true, |
| 163 | }, |
| 164 | collapseTagsTooltip: { |
| 165 | // * whether show all selected tags when mouse hover text of collapse-tags. To use this, collapse-tags must be true |
| 166 | type: Boolean, |
| 167 | default: false, |
| 168 | }, |
| 169 | separator: { |
| 170 | // * option label separator |
| 171 | type: String, |
| 172 | default: ' / ', |
| 173 | }, |
| 174 | filterable: { |
| 175 | // * whether to filter options |
| 176 | type: Boolean, |
| 177 | default: true, |
| 178 | }, |
| 179 | filterMethod: { |
| 180 | // * customize search logic, the first parameter is node, the second is keyword, and need return a boolean value indicating whether it hits. |
| 181 | type: Function, |
| 182 | default: (node, keyword) => { |
| 183 | let search = keyword.toLowerCase() |
| 184 | let label = node.text.toLowerCase() |
| 185 | |
| 186 | return label.includes(search) |
| 187 | }, |
| 188 | }, |
| 189 | debounce: { |
| 190 | // * debounce delay when typing filter keyword, in milliseconds |
| 191 | type: Number, |
| 192 | default: 300, |
| 193 | }, |
| 194 | beforeFilter: { |
| 195 | // * hook function before filtering with the value to be filtered as its parameter. If false is returned or a Promise is returned and then is rejected, filtering will be aborted |
| 196 | type: Function, |
| 197 | }, |
| 198 | popperClass: { |
| 199 | // * custom class name for Cascader's dropdown |
| 200 | type: String, |
| 201 | default: '', |
| 202 | }, |
| 203 | teleported: { |
| 204 | // * whether cascader popup is teleported |
| 205 | type: Boolean, |
| 206 | default: true, |
| 207 | }, |
| 208 | tagType: { |
| 209 | // * tag type |
| 210 | type: String, |
| 211 | default: 'info', |
| 212 | validator(value) { |
| 213 | return ['info', 'success', 'warning', 'danger'].includes(value) |
| 214 | }, |
| 215 | }, |
| 216 | tagEffect: { |
| 217 | // * tag effect |
| 218 | type: String, |
| 219 | default: 'light', |
| 220 | validator(value) { |
| 221 | return ['dark', 'light', 'plain'].includes(value) |
| 222 | }, |
| 223 | }, |
| 224 | validateEvent: { |
| 225 | // * event name that triggers validation |
| 226 | type: Boolean, |
| 227 | default: true, |
| 228 | }, |
| 229 | maxCollapseTags: { |
| 230 | // * The max tags number to be shown. To use this, collpase-tags must be true |
| 231 | type: Number, |
| 232 | default: 1, |
| 233 | }, |
| 234 | persistent: { |
| 235 | // * when dropdown is inactive and persistent is false, dropdown will be destroyed |
| 236 | type: Boolean, |
| 237 | default: true, |
| 238 | }, |
| 239 | fallbackPlacements: { |
| 240 | // * ist of possible positions for Tooltip popper.js |
| 241 | type: Array, |
| 242 | default: () => ['bottom-start', 'top-start', 'right', 'left'], |
| 243 | }, |
| 244 | placement: { |
| 245 | // * placement of the dropdown, default is bottom-start |
| 246 | type: String, |
| 247 | default: 'bottom-start', |
| 248 | validator(value) { |
| 249 | return [ |
| 250 | 'top', |
| 251 | 'top-start', |
| 252 | 'top-end', |
| 253 | 'bottom', |
| 254 | 'bottom-start', |
| 255 | 'bottom-end', |
| 256 | 'left', |
| 257 | 'left-start', |
| 258 | 'left-end', |
| 259 | 'right', |
| 260 | 'right-start', |
| 261 | 'right-end', |
| 262 | ].includes(value) |
| 263 | }, |
| 264 | }, |
| 265 | prefixIcon: { |
| 266 | type: [String, Object], |
| 267 | default: '', |
| 268 | }, |
| 269 | currencySymbol: { |
| 270 | type: String, |
| 271 | default: '$', |
| 272 | }, |
| 273 | categoryName: { |
| 274 | type: String, |
| 275 | default: '', |
| 276 | }, |
| 277 | subCategoryName: { |
| 278 | type: String, |
| 279 | default: '', |
| 280 | }, |
| 281 | emptyStateString: { |
| 282 | type: String, |
| 283 | default: 'No matching data', |
| 284 | }, |
| 285 | taxOptions: { |
| 286 | type: [Object, Array], |
| 287 | default: () => { |
| 288 | return [] |
| 289 | }, |
| 290 | }, |
| 291 | taxLabel: { |
| 292 | type: String, |
| 293 | default: '', |
| 294 | }, |
| 295 | taxLabelIncl: { |
| 296 | type: String, |
| 297 | default: '', |
| 298 | }, |
| 299 | taxVisible: { |
| 300 | type: Boolean, |
| 301 | default: true, |
| 302 | }, |
| 303 | ariaLabel: { |
| 304 | type: String, |
| 305 | default: 'dropdown', |
| 306 | }, |
| 307 | }) |
| 308 | |
| 309 | /** |
| 310 | * Component Emits |
| 311 | * @type {EmitFn<(string)[]>} |
| 312 | */ |
| 313 | const emits = defineEmits([ |
| 314 | 'change', |
| 315 | 'expand-change', |
| 316 | 'blur', |
| 317 | 'focus', |
| 318 | 'visible-change', |
| 319 | 'remove-tag', |
| 320 | 'update:modelValue', |
| 321 | ]) |
| 322 | |
| 323 | // * Component model |
| 324 | let { modelValue } = toRefs(props) |
| 325 | let model = computed({ |
| 326 | get: () => modelValue.value, |
| 327 | set: (val) => { |
| 328 | emits('update:modelValue', val) |
| 329 | }, |
| 330 | }) |
| 331 | |
| 332 | // * Tat Visibility |
| 333 | function taxVisibility(id) { |
| 334 | return props.taxVisible && !!props.taxOptions.filter((a) => a.id === id).length |
| 335 | } |
| 336 | |
| 337 | // * Container Width |
| 338 | let cWidth = inject('containerWidth', 0) |
| 339 | let checkScreen = computed(() => cWidth.value < 560 || (cWidth.value > 560 && cWidth.value < 640)) |
| 340 | |
| 341 | // * Element Wrapper Size |
| 342 | const advSelectWrapperRef = ref(null) |
| 343 | |
| 344 | const { width: wrapperWidth } = useElementSize(advSelectWrapperRef) |
| 345 | |
| 346 | // * Component reference |
| 347 | const advSelect = ref(null) |
| 348 | |
| 349 | // * Component text orientation |
| 350 | let isRtl = computed(() => { |
| 351 | if (document) { |
| 352 | return document.documentElement.dir === 'rtl' |
| 353 | } |
| 354 | |
| 355 | return false |
| 356 | }) |
| 357 | |
| 358 | /** |
| 359 | * Dropdown (Popper) ID |
| 360 | */ |
| 361 | const popperId = ref('') |
| 362 | |
| 363 | /** |
| 364 | * Dropdown (Popper) identifier class |
| 365 | */ |
| 366 | let uniqueClassSuffix = ref(Math.floor(Math.random() * 1000) + 1) |
| 367 | |
| 368 | /** |
| 369 | * Dropdown (Popper) Classes |
| 370 | * @type {ComputedRef<string>} |
| 371 | */ |
| 372 | let popperClasses = computed(() => { |
| 373 | return ( |
| 374 | `am-adv-select__popper-${uniqueClassSuffix.value} am-adv-select__popper${props.popperClass ? ' ' + props.popperClass : ''}` + |
| 375 | (checkScreen.value ? ' am-adv-select__popper-mobile' : '') |
| 376 | ) |
| 377 | }) |
| 378 | |
| 379 | /** |
| 380 | * Teleport Variables - category and subcategory name in drop down |
| 381 | */ |
| 382 | let teleportSubCategoryDisable = ref(false) |
| 383 | let teleportCategoryDisable = ref(false) |
| 384 | |
| 385 | // * Fonts |
| 386 | let amFonts = inject( |
| 387 | 'amFonts', |
| 388 | ref({ |
| 389 | fontFamily: 'Amelia Roboto, sans-serif', |
| 390 | fontUrl: '', |
| 391 | customFontFamily: '', |
| 392 | fontFormat: '', |
| 393 | customFontSelected: false, |
| 394 | }), |
| 395 | ) |
| 396 | |
| 397 | // * Colors |
| 398 | let amColors = inject( |
| 399 | 'amColors', |
| 400 | ref({ |
| 401 | colorPrimary: '#1246D6', |
| 402 | colorSuccess: '#019719', |
| 403 | colorError: '#B4190F', |
| 404 | colorWarning: '#CCA20C', |
| 405 | colorMainBgr: '#FFFFFF', |
| 406 | colorMainHeadingText: '#33434C', |
| 407 | colorMainText: '#1A2C37', |
| 408 | colorSbBgr: '#17295A', |
| 409 | colorSbText: '#FFFFFF', |
| 410 | colorInpBgr: '#FFFFFF', |
| 411 | colorInpBorder: '#D1D5D7', |
| 412 | colorInpText: '#1A2C37', |
| 413 | colorInpPlaceHolder: '#1A2C37', |
| 414 | colorDropBgr: '#FFFFFF', |
| 415 | colorDropBorder: '#D1D5D7', |
| 416 | colorDropText: '#0E1920', |
| 417 | colorBtnPrim: '#265CF2', |
| 418 | colorBtnPrimText: '#FFFFFF', |
| 419 | colorBtnSec: '#1A2C37', |
| 420 | colorBtnSecText: '#FFFFFF', |
| 421 | }), |
| 422 | ) |
| 423 | |
| 424 | // * Adv css vars |
| 425 | let cssVars = computed(() => { |
| 426 | return { |
| 427 | '--am-c-advs-bgr': amColors.value.colorInpBgr, |
| 428 | '--am-c-advs-border': amColors.value.colorInpBorder, |
| 429 | '--am-c-advs-text': amColors.value.colorInpText, |
| 430 | '--am-c-advs-placeholder': amColors.value.colorInpPlaceHolder, |
| 431 | '--am-c-advs-shadow': useColorTransparency(amColors.value.colorInpText, 0.05), |
| 432 | '--am-c-advs-text-op60': useColorTransparency(amColors.value.colorInpText, 0.6), |
| 433 | '--am-c-advs-text-op40': useColorTransparency(amColors.value.colorInpText, 0.4), |
| 434 | '--am-c-advs-text-op10': useColorTransparency(amColors.value.colorInpText, 0.03), |
| 435 | '--am-font-family': amFonts.value.fontFamily, |
| 436 | } |
| 437 | }) |
| 438 | |
| 439 | // * Adv dropdown css vars |
| 440 | let cssDropdownVars = computed(() => { |
| 441 | return { |
| 442 | '--am-c-advs-item-price': amColors.value.colorPrimary, |
| 443 | '--am-c-advs-item-price-op10': useColorTransparency(amColors.value.colorPrimary, 0.1), |
| 444 | '--am-c-advs-item-selected': amColors.value.colorPrimary, |
| 445 | '--am-c-advs-item-label-op40': useColorTransparency(amColors.value.colorDropText, 0.4), |
| 446 | '--am-font-family': amFonts.value.fontFamily, |
| 447 | } |
| 448 | }) |
| 449 | |
| 450 | /** |
| 451 | * Change Function |
| 452 | * @param val |
| 453 | */ |
| 454 | function handleChange(val) { |
| 455 | emits('change', val) |
| 456 | emits('update:modelValue', val) |
| 457 | } |
| 458 | |
| 459 | /** |
| 460 | * Dropdown expand detection and width of dropdown control |
| 461 | * @param val |
| 462 | */ |
| 463 | function handleExpandChange(val) { |
| 464 | nextTick(() => { |
| 465 | if (val && val.length > 0) { |
| 466 | teleportSubCategoryDisable.value = true |
| 467 | } |
| 468 | }) |
| 469 | emits('expand-change', val) |
| 470 | } |
| 471 | |
| 472 | /** |
| 473 | * Dropdown visibility control |
| 474 | * @param e |
| 475 | */ |
| 476 | function handleVisibleChange(e) { |
| 477 | nextTick(() => { |
| 478 | if (!e && !model.value) { |
| 479 | teleportSubCategoryDisable.value = false |
| 480 | } |
| 481 | |
| 482 | teleportCategoryDisable.value = true |
| 483 | if (advSelect.value) { |
| 484 | advSelect.value.contentRef.style.setProperty( |
| 485 | '--am-c-advs-item-bgr', |
| 486 | amColors.value.colorDropBgr, |
| 487 | ) |
| 488 | advSelect.value.contentRef.style.setProperty( |
| 489 | '--am-c-advs-item-border', |
| 490 | amColors.value.colorDropBorder, |
| 491 | ) |
| 492 | advSelect.value.contentRef.style.setProperty( |
| 493 | '--am-c-advs-item-bgr-op10', |
| 494 | useColorTransparency(amColors.value.colorDropText, 0.1), |
| 495 | ) |
| 496 | advSelect.value.contentRef.style.setProperty( |
| 497 | '--am-c-advs-item-label', |
| 498 | amColors.value.colorDropText, |
| 499 | ) |
| 500 | advSelect.value.contentRef.style.setProperty( |
| 501 | '--am-c-advs-item-label-op65', |
| 502 | useColorTransparency(amColors.value.colorDropText, 0.65), |
| 503 | ) |
| 504 | advSelect.value.contentRef.style.setProperty( |
| 505 | '--am-c-advs-item-border-op10', |
| 506 | useColorTransparency(amColors.value.colorDropText, 0.1), |
| 507 | ) |
| 508 | advSelect.value.contentRef.style.setProperty('--am-font-family', amFonts.value.fontFamily) |
| 509 | advSelect.value.contentRef.style.setProperty('width', `${wrapperWidth.value}px`) |
| 510 | } |
| 511 | }) |
| 512 | emits('visible-change', e) |
| 513 | } |
| 514 | |
| 515 | let cssTeleport = computed(() => { |
| 516 | return { |
| 517 | '--am-h-advs-item-heading': checkScreen.value ? '32px' : '26px', |
| 518 | '--am-fs-advs-item-heading': checkScreen.value ? '16px' : '12px', |
| 519 | '--am-c-advs-item-heading-op65': useColorTransparency(amColors.value.colorDropText, 0.65), |
| 520 | '--am-c-advs-shadow': useColorTransparency(amColors.value.colorInpText, 0.05), |
| 521 | } |
| 522 | }) |
| 523 | </script> |
| 524 | |
| 525 | <style lang="scss"> |
| 526 | @mixin am-adv-select-block { |
| 527 | // Adv Select |
| 528 | .am-adv-select { |
| 529 | // -c- color |
| 530 | // -rad- border radius |
| 531 | // -h- height |
| 532 | // -fs- font size |
| 533 | // -padd- padding |
| 534 | // -bgr background |
| 535 | // -advs- advanced select |
| 536 | --am-c-advs-bgr: var(--am-c-inp-bgr); |
| 537 | --am-c-advs-border: var(--am-c-inp-border); |
| 538 | --am-c-advs-text: var(--am-c-inp-text); |
| 539 | --am-c-advs-placeholder: var(--am-color-input-placeholder); |
| 540 | --am-rad-advs: var(--am-rad-inp); |
| 541 | --am-fs-advs: var(--am-fs-inp); |
| 542 | --am-h-advs: var(--am-h-inp); |
| 543 | --am-padd-advs: 0 12px; |
| 544 | width: 100%; |
| 545 | |
| 546 | &__wrapper { |
| 547 | width: 100%; |
| 548 | } |
| 549 | |
| 550 | // Size - default / medium / small / mini / micro |
| 551 | &--default { |
| 552 | --am-h-advs: 40px; |
| 553 | } |
| 554 | &--medium { |
| 555 | --am-h-advs: 36px; |
| 556 | } |
| 557 | &--small { |
| 558 | --am-h-advs: 32px; |
| 559 | } |
| 560 | &--mini { |
| 561 | --am-h-advs: 28px; |
| 562 | } |
| 563 | &--micro { |
| 564 | --am-h-advs: 24px; |
| 565 | } |
| 566 | |
| 567 | // Disabled |
| 568 | &--disabled { |
| 569 | --am-c-advs-bgr: var(--am-c-advs-text-op10); |
| 570 | --am-c-advs-text: var(--am-c-advs-text-op60); |
| 571 | } |
| 572 | |
| 573 | // Element visual presentation |
| 574 | .el-input { |
| 575 | border: none; |
| 576 | border-radius: 4px; |
| 577 | box-shadow: 0 2px 2px var(--am-c-advs-shadow); |
| 578 | |
| 579 | &.is-focus { |
| 580 | // prevent hover color to be applied |
| 581 | .el-input__wrapper { |
| 582 | --am-c-advs-border: var(--am-c-primary); |
| 583 | } |
| 584 | } |
| 585 | |
| 586 | &.el-input--prefix { |
| 587 | --am-padd-advs: 0 8px; |
| 588 | } |
| 589 | |
| 590 | // Visual presentation of input |
| 591 | &__wrapper { |
| 592 | display: inline-flex; |
| 593 | align-items: center; |
| 594 | gap: 0 6px; |
| 595 | background-image: none; |
| 596 | background-color: var(--am-c-advs-bgr); |
| 597 | border: none; |
| 598 | border-radius: var(--am-rad-advs); |
| 599 | box-shadow: 0 0 0 1px var(--am-c-advs-border); |
| 600 | padding: var(--am-padd-advs); |
| 601 | height: var(--am-h-advs); |
| 602 | transition: 0.3s; |
| 603 | |
| 604 | &:hover { |
| 605 | --am-c-advs-border: var(--am-c-advs-text-op40); |
| 606 | } |
| 607 | |
| 608 | &:focus, |
| 609 | &:active &.is-focus { |
| 610 | --am-c-advs-border: var(--am-c-primary); |
| 611 | } |
| 612 | } |
| 613 | |
| 614 | &__inner { |
| 615 | height: 24px; |
| 616 | font-size: var(--am-fs-advs); |
| 617 | font-weight: 400; |
| 618 | line-height: 1.6; |
| 619 | color: var(--am-c-advs-text); |
| 620 | background-color: transparent; |
| 621 | border: none; |
| 622 | border-radius: var(--am-rad-advs); |
| 623 | padding: 0; |
| 624 | width: 100%; |
| 625 | |
| 626 | &::-webkit-input-placeholder { |
| 627 | /* Chrome/Opera/Safari */ |
| 628 | color: var(--am-c-advs-placeholder); |
| 629 | } |
| 630 | &::-moz-placeholder { |
| 631 | /* Firefox 19+ */ |
| 632 | color: var(--am-c-advs-placeholder); |
| 633 | } |
| 634 | &:-ms-input-placeholder { |
| 635 | /* IE 10+ */ |
| 636 | color: var(--am-c-advs-placeholder); |
| 637 | } |
| 638 | &:-moz-placeholder { |
| 639 | /* Firefox 18- */ |
| 640 | color: var(--am-c-advs-placeholder); |
| 641 | } |
| 642 | |
| 643 | &:focus { |
| 644 | border: none; |
| 645 | box-shadow: none; |
| 646 | } |
| 647 | } |
| 648 | |
| 649 | &__suffix { |
| 650 | .el-input__validateIcon { |
| 651 | border: none; |
| 652 | } |
| 653 | |
| 654 | .el-icon { |
| 655 | font-family: 'amelia-icons'; |
| 656 | font-size: 18px; |
| 657 | color: var(--am-c-advs-text); |
| 658 | |
| 659 | &.icon-arrow-down { |
| 660 | &:before { |
| 661 | font-family: 'amelia-icons' !important; |
| 662 | font-size: 18px; |
| 663 | content: $am-icon-arrow-down; |
| 664 | } |
| 665 | |
| 666 | svg { |
| 667 | display: none; |
| 668 | } |
| 669 | } |
| 670 | |
| 671 | &.icon-circle-close { |
| 672 | &:before { |
| 673 | font-family: 'amelia-icons' !important; |
| 674 | font-size: 18px; |
| 675 | content: $am-icon-close; |
| 676 | } |
| 677 | |
| 678 | svg { |
| 679 | display: none; |
| 680 | } |
| 681 | } |
| 682 | } |
| 683 | } |
| 684 | |
| 685 | &__prefix { |
| 686 | [class^='am-icon']^='am-icon'] { |
| 687 | font-size: 24px; |
| 688 | line-height: 1; |
| 689 | color: var(--am-c-advs-text); |
| 690 | } |
| 691 | } |
| 692 | } |
| 693 | |
| 694 | &.am-rtl { |
| 695 | .el-input { |
| 696 | &__suffix { |
| 697 | right: unset; |
| 698 | left: 12px; |
| 699 | } |
| 700 | } |
| 701 | } |
| 702 | } |
| 703 | } |
| 704 | |
| 705 | // public |
| 706 | .amelia-v2-booking #amelia-container { |
| 707 | @include am-adv-select-block; |
| 708 | } |
| 709 | |
| 710 | // admin |
| 711 | #amelia-app-backend-new { |
| 712 | @include am-adv-select-block; |
| 713 | } |
| 714 | |
| 715 | // Adv Select Dropdown - Popper |
| 716 | .am-adv-select__popper { |
| 717 | --am-c-advs-item-bgr: var(--am-c-drop-bgr); |
| 718 | --am-c-advs-item-label: var(--am-c-main-text); |
| 719 | --am-c-advs-item-price: var(--am-c-primary); |
| 720 | --am-c-advs-item-selected: var(--am-c-primary); |
| 721 | --am-h-advs-item-heading: 26px; |
| 722 | --am-fs-advs-item-heading: 12px; |
| 723 | |
| 724 | max-width: 454px; |
| 725 | width: 100%; |
| 726 | z-index: 9999999999 !important; |
| 727 | |
| 728 | &.el-cascader__dropdown.el-popper[role='tooltip']='tooltip'] { |
| 729 | background-color: transparent; |
| 730 | border-color: var(--am-c-advs-item-border); |
| 731 | overflow: hidden; |
| 732 | } |
| 733 | |
| 734 | * { |
| 735 | font-family: var(--am-font-family); |
| 736 | border-radius: unset; |
| 737 | box-sizing: border-box; |
| 738 | } |
| 739 | |
| 740 | // Adv Select Dropdown Category Name |
| 741 | &-heading { |
| 742 | position: absolute; |
| 743 | top: 0; |
| 744 | left: 0; |
| 745 | display: flex; |
| 746 | align-items: center; |
| 747 | width: 100%; |
| 748 | height: var(--am-h-advs-item-heading); |
| 749 | font-size: var(--am-fs-advs-item-heading); |
| 750 | font-weight: 700; |
| 751 | font-style: normal; |
| 752 | line-height: 1.5; |
| 753 | color: var(--am-c-advs-item-heading-op65); |
| 754 | background-color: var(--am-c-advs-item-bgr); |
| 755 | padding-left: 8px; |
| 756 | } |
| 757 | |
| 758 | .el-cascader { |
| 759 | // Panel - dropdown |
| 760 | &-panel { |
| 761 | display: flex; |
| 762 | background-color: var(--am-c-advs-item-bgr); |
| 763 | max-width: 454px; |
| 764 | width: 100%; |
| 765 | } |
| 766 | |
| 767 | // Panel sides (columns) - Menu |
| 768 | &-menu { |
| 769 | width: 100%; |
| 770 | min-width: 170px; |
| 771 | |
| 772 | // First column |
| 773 | &:nth-child(1) { |
| 774 | padding-top: 26px; |
| 775 | flex-shrink: 2; |
| 776 | border-color: var(--am-c-advs-item-border-op10); |
| 777 | } |
| 778 | |
| 779 | // Second column |
| 780 | &:nth-child(2) { |
| 781 | padding-top: 26px; |
| 782 | flex-shrink: 1; |
| 783 | } |
| 784 | |
| 785 | &:last-child { |
| 786 | .el-cascader-node { |
| 787 | padding: 0; |
| 788 | } |
| 789 | } |
| 790 | |
| 791 | .el-scrollbar__bar.is-vertical { |
| 792 | display: block !important; |
| 793 | top: var(--am-h-advs-item-heading); |
| 794 | padding-top: 6px; |
| 795 | |
| 796 | .el-scrollbar__thumb { |
| 797 | background: var(--am-c-advs-item-label); |
| 798 | opacity: 0.3; |
| 799 | } |
| 800 | } |
| 801 | } |
| 802 | |
| 803 | &-node { |
| 804 | height: unset; |
| 805 | padding: 0; |
| 806 | |
| 807 | &:not(.is-disabled):hover, |
| 808 | &:not(.is-disabled):focus { |
| 809 | background-color: var(--am-c-advs-item-bgr-op10); |
| 810 | } |
| 811 | |
| 812 | &.in-active-path { |
| 813 | .am-adv-select__item-label { |
| 814 | color: var(--am-c-advs-item-selected); |
| 815 | } |
| 816 | } |
| 817 | |
| 818 | &__label { |
| 819 | display: flex; |
| 820 | align-items: center; |
| 821 | justify-content: space-between; |
| 822 | padding: 4px 16px 4px 8px; |
| 823 | } |
| 824 | |
| 825 | i { |
| 826 | display: none; |
| 827 | } |
| 828 | } |
| 829 | |
| 830 | &__suggestion-list { |
| 831 | background-color: var(--am-c-advs-item-bgr); |
| 832 | color: var(--am-c-advs-item-label-op65); |
| 833 | } |
| 834 | } |
| 835 | |
| 836 | .am-adv-select { |
| 837 | &__item { |
| 838 | width: 100%; |
| 839 | display: flex; |
| 840 | align-items: center; |
| 841 | justify-content: space-between; |
| 842 | |
| 843 | &-checked { |
| 844 | .am-adv-select__item-label { |
| 845 | color: var(--am-c-advs-item-selected); |
| 846 | } |
| 847 | } |
| 848 | |
| 849 | &-label { |
| 850 | display: block; |
| 851 | font-size: 14px; |
| 852 | font-weight: 400; |
| 853 | line-height: 1.43; |
| 854 | color: var(--am-c-advs-item-label); |
| 855 | white-space: nowrap; |
| 856 | overflow: hidden; |
| 857 | text-overflow: ellipsis; |
| 858 | } |
| 859 | |
| 860 | &-quantity { |
| 861 | font-size: 14px; |
| 862 | font-weight: 400; |
| 863 | line-height: 1.714; |
| 864 | color: var(--am-c-advs-item-label-op40); |
| 865 | } |
| 866 | |
| 867 | &-price { |
| 868 | font-size: 14px; |
| 869 | font-weight: 400; |
| 870 | line-height: 1.714; |
| 871 | color: var(--am-c-advs-item-price); |
| 872 | } |
| 873 | |
| 874 | &-tax { |
| 875 | display: inline-flex; |
| 876 | font-size: 14px; |
| 877 | font-weight: 400; |
| 878 | line-height: 1; |
| 879 | color: var(--am-c-advs-item-price); |
| 880 | background-color: var(--am-c-advs-item-price-op10); |
| 881 | border-radius: 10px; |
| 882 | padding: 3px 8px; |
| 883 | } |
| 884 | } |
| 885 | } |
| 886 | |
| 887 | .el-popper__arrow { |
| 888 | display: none; |
| 889 | } |
| 890 | |
| 891 | // Mobile |
| 892 | &-mobile { |
| 893 | width: calc(100% - 20px); |
| 894 | |
| 895 | .el-cascader { |
| 896 | // Panel - dropdown |
| 897 | &-panel { |
| 898 | height: min-content; |
| 899 | max-width: 100%; |
| 900 | width: 100%; |
| 901 | display: flex; |
| 902 | flex-direction: column; |
| 903 | |
| 904 | .am-adv-select__popper-heading { |
| 905 | height: var(--am-h-advs-item-heading); |
| 906 | font-size: var(--am-fs-advs-item-heading); |
| 907 | box-shadow: 0 2px 2px var(--am-c-advs-shadow); |
| 908 | } |
| 909 | } |
| 910 | |
| 911 | &-menu { |
| 912 | min-height: 160px; |
| 913 | |
| 914 | &:first-child:not(:only-child) { |
| 915 | border-bottom: 1px solid var(--am-c-inp-border); |
| 916 | } |
| 917 | |
| 918 | &__wrap { |
| 919 | height: min-content; |
| 920 | max-height: 160px; |
| 921 | overflow-y: scroll; |
| 922 | } |
| 923 | } |
| 924 | } |
| 925 | } |
| 926 | } |
| 927 | </style> |
| 928 |