@milaboratories/uikit 2.6.2 → 2.6.4
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/.turbo/turbo-build.log +129 -129
- package/.turbo/turbo-type-check.log +1 -1
- package/CHANGELOG.md +13 -0
- package/dist/base/BtnBase.vue.js +18 -18
- package/dist/base/BtnBase.vue.js.map +1 -1
- package/dist/components/ContextProvider.vue.js.map +1 -1
- package/dist/components/DataTable/BaseCellComponent.vue.js +20 -20
- package/dist/components/DataTable/BaseCellComponent.vue.js.map +1 -1
- package/dist/components/DataTable/ColumnCaret.vue.js +6 -6
- package/dist/components/DataTable/ColumnCaret.vue.js.map +1 -1
- package/dist/components/DataTable/ColumnsCommandMenu.vue.js.map +1 -1
- package/dist/components/DataTable/RowsCommandMenu.vue.js.map +1 -1
- package/dist/components/DataTable/TScroll.vue.js +12 -12
- package/dist/components/DataTable/TScroll.vue.js.map +1 -1
- package/dist/components/DataTable/TableComponent.vue.js +1 -1
- package/dist/components/DataTable/TableComponent.vue.js.map +1 -1
- package/dist/components/DataTable/TdCell.vue.js +36 -36
- package/dist/components/DataTable/TdCell.vue.js.map +1 -1
- package/dist/components/DataTable/ThCell.vue.js +27 -27
- package/dist/components/DataTable/ThCell.vue.js.map +1 -1
- package/dist/components/DataTable/TrBody.vue.js +12 -12
- package/dist/components/DataTable/TrBody.vue.js.map +1 -1
- package/dist/components/DataTable/TrHead.vue.js.map +1 -1
- package/dist/components/DataTable/assets/TableIcon.vue.js +2 -2
- package/dist/components/DataTable/assets/TableIcon.vue.js.map +1 -1
- package/dist/components/DropdownListItem.vue.js +18 -18
- package/dist/components/DropdownListItem.vue.js.map +1 -1
- package/dist/components/HScroll.vue.js.map +1 -1
- package/dist/components/InputRange.vue.js.map +1 -1
- package/dist/components/LongText.vue.js +1 -1
- package/dist/components/LongText.vue.js.map +1 -1
- package/dist/components/LongText.vue3.js +1 -1
- package/dist/components/PlAccordion/{ExpandTransition.vue2.js → ExpandTransition.vue.js} +1 -1
- package/dist/components/PlAccordion/ExpandTransition.vue.js.map +1 -0
- package/dist/components/PlAccordion/ExpandTransition.vue3.js +1 -1
- package/dist/components/PlAccordion/PlAccordion.vue.js.map +1 -1
- package/dist/components/PlAccordion/PlAccordionSection.vue2.js +21 -21
- package/dist/components/PlAccordion/PlAccordionSection.vue2.js.map +1 -1
- package/dist/components/PlAlert/PlAlert.vue.js +23 -23
- package/dist/components/PlAlert/PlAlert.vue.js.map +1 -1
- package/dist/components/PlAutocomplete/PlAutocomplete.vue.js +86 -86
- package/dist/components/PlAutocomplete/PlAutocomplete.vue.js.map +1 -1
- package/dist/components/PlAutocompleteMulti/PlAutocompleteMulti.vue.js +83 -83
- package/dist/components/PlAutocompleteMulti/PlAutocompleteMulti.vue.js.map +1 -1
- package/dist/components/PlBtnAccent/PlBtnAccent.vue.js.map +1 -1
- package/dist/components/PlBtnDanger/PlBtnDanger.vue.js.map +1 -1
- package/dist/components/PlBtnGhost/PlBtnGhost.vue.js +21 -21
- package/dist/components/PlBtnGhost/PlBtnGhost.vue.js.map +1 -1
- package/dist/components/PlBtnGroup/PlBtnGroup.vue.js +34 -34
- package/dist/components/PlBtnGroup/PlBtnGroup.vue.js.map +1 -1
- package/dist/components/PlBtnLink/PlBtnLink.vue.js +12 -12
- package/dist/components/PlBtnLink/PlBtnLink.vue.js.map +1 -1
- package/dist/components/PlBtnPrimary/PlBtnPrimary.vue.js.map +1 -1
- package/dist/components/PlBtnSecondary/PlBtnSecondary.vue.js.map +1 -1
- package/dist/components/PlBtnSplit/PlBtnSplit.vue.js +31 -31
- package/dist/components/PlBtnSplit/PlBtnSplit.vue.js.map +1 -1
- package/dist/components/PlChartHistogram/PlChartHistogram.vue2.js +18 -18
- package/dist/components/PlChartHistogram/PlChartHistogram.vue2.js.map +1 -1
- package/dist/components/PlChartStackedBar/Legends.vue2.js.map +1 -1
- package/dist/components/PlChartStackedBar/PlChartStackedBar.vue2.js +15 -15
- package/dist/components/PlChartStackedBar/PlChartStackedBar.vue2.js.map +1 -1
- package/dist/components/PlChartStackedBar/PlChartStackedBarCompact.vue2.js.map +1 -1
- package/dist/components/PlChartStackedBar/StackedRow.vue2.js.map +1 -1
- package/dist/components/PlChartStackedBar/StackedRowCompact.vue2.js.map +1 -1
- package/dist/components/PlCheckbox/PlCheckbox.vue.js +13 -13
- package/dist/components/PlCheckbox/PlCheckbox.vue.js.map +1 -1
- package/dist/components/PlCheckbox/PlCheckboxBase.vue.js +6 -6
- package/dist/components/PlCheckbox/PlCheckboxBase.vue.js.map +1 -1
- package/dist/components/PlCheckboxGroup/PlCheckboxGroup.vue.js +28 -28
- package/dist/components/PlCheckboxGroup/PlCheckboxGroup.vue.js.map +1 -1
- package/dist/components/PlChip/PlChip.vue.js +20 -20
- package/dist/components/PlChip/PlChip.vue.js.map +1 -1
- package/dist/components/PlClipboard/PlClipboard.vue2.js.map +1 -1
- package/dist/components/PlConfirmDialog.vue.js +14 -14
- package/dist/components/PlConfirmDialog.vue.js.map +1 -1
- package/dist/components/PlDialogModal/PlDialogModal.vue.js +30 -30
- package/dist/components/PlDialogModal/PlDialogModal.vue.js.map +1 -1
- package/dist/components/PlDropdown/OptionList.vue.js +40 -40
- package/dist/components/PlDropdown/OptionList.vue.js.map +1 -1
- package/dist/components/PlDropdown/PlDropdown.vue.js +89 -89
- package/dist/components/PlDropdown/PlDropdown.vue.js.map +1 -1
- package/dist/components/PlDropdownLegacy/PlDropdownLegacy.vue.js +92 -92
- package/dist/components/PlDropdownLegacy/PlDropdownLegacy.vue.js.map +1 -1
- package/dist/components/PlDropdownLine/PlDropdownLine.vue.d.ts +1 -1
- package/dist/components/PlDropdownLine/PlDropdownLine.vue.js +4 -4
- package/dist/components/PlDropdownLine/PlDropdownLine.vue.js.map +1 -1
- package/dist/components/PlDropdownLine/ResizableInput.vue.js +12 -12
- package/dist/components/PlDropdownLine/ResizableInput.vue.js.map +1 -1
- package/dist/components/PlDropdownMulti/PlDropdownMulti.vue.js +70 -70
- package/dist/components/PlDropdownMulti/PlDropdownMulti.vue.js.map +1 -1
- package/dist/components/PlDropdownMultiRef/PlDropdownMultiRef.vue.d.ts +1 -1
- package/dist/components/PlDropdownMultiRef/PlDropdownMultiRef.vue.js.map +1 -1
- package/dist/components/PlDropdownRef/PlDropdownRef.vue.js +11 -11
- package/dist/components/PlDropdownRef/PlDropdownRef.vue.js.map +1 -1
- package/dist/components/PlEditableTitle/PlEditableTitle.vue.d.ts +1 -1
- package/dist/components/PlEditableTitle/PlEditableTitle.vue.js +36 -36
- package/dist/components/PlEditableTitle/PlEditableTitle.vue.js.map +1 -1
- package/dist/components/PlElementList/PlElementList.vue2.js.map +1 -1
- package/dist/components/PlElementList/PlElementListItem.vue2.js +67 -67
- package/dist/components/PlElementList/PlElementListItem.vue2.js.map +1 -1
- package/dist/components/PlErrorAlert/PlErrorAlert.vue2.js.map +1 -1
- package/dist/components/PlErrorBoundary/PlErrorBoundary.vue.js.map +1 -1
- package/dist/components/PlFileDialog/Local.vue.js +24 -24
- package/dist/components/PlFileDialog/Local.vue.js.map +1 -1
- package/dist/components/PlFileDialog/PlFileDialog.vue.js +38 -38
- package/dist/components/PlFileDialog/PlFileDialog.vue.js.map +1 -1
- package/dist/components/PlFileDialog/Remote.vue.js +2 -2
- package/dist/components/PlFileDialog/Remote.vue.js.map +1 -1
- package/dist/components/PlFileDialog/Shortcuts.vue2.js +4 -4
- package/dist/components/PlFileDialog/Shortcuts.vue2.js.map +1 -1
- package/dist/components/PlFileInput/PlFileInput.vue.d.ts +1 -1
- package/dist/components/PlFileInput/PlFileInput.vue.js +75 -75
- package/dist/components/PlFileInput/PlFileInput.vue.js.map +1 -1
- package/dist/components/PlIcon16/PlIcon16.vue2.js.map +1 -1
- package/dist/components/PlIcon24/PlIcon24.vue2.js.map +1 -1
- package/dist/components/PlLoaderCircular/PlLoaderCircular.vue.js +11 -11
- package/dist/components/PlLoaderCircular/PlLoaderCircular.vue.js.map +1 -1
- package/dist/components/PlLogView/PlLogView.vue.js +58 -58
- package/dist/components/PlLogView/PlLogView.vue.js.map +1 -1
- package/dist/components/PlNotificationAlert/PlNotificationAlert.vue.js +22 -22
- package/dist/components/PlNotificationAlert/PlNotificationAlert.vue.js.map +1 -1
- package/dist/components/PlNumberField/PlNumberField.vue.d.ts +1 -1
- package/dist/components/PlNumberField/PlNumberField.vue.js +75 -75
- package/dist/components/PlNumberField/PlNumberField.vue.js.map +1 -1
- package/dist/components/PlProgressBar/PlProgressBar.vue.js +12 -12
- package/dist/components/PlProgressBar/PlProgressBar.vue.js.map +1 -1
- package/dist/components/PlProgressCell/PlProgressCell.vue.js +20 -20
- package/dist/components/PlProgressCell/PlProgressCell.vue.js.map +1 -1
- package/dist/components/PlRadio/PlRadio.vue2.js.map +1 -1
- package/dist/components/PlRadio/PlRadioGroup.vue2.js +8 -8
- package/dist/components/PlRadio/PlRadioGroup.vue2.js.map +1 -1
- package/dist/components/PlSearchField/PlSearchField.vue2.js +19 -19
- package/dist/components/PlSearchField/PlSearchField.vue2.js.map +1 -1
- package/dist/components/PlSectionSeparator/PlSectionSeparator.vue2.js +8 -8
- package/dist/components/PlSectionSeparator/PlSectionSeparator.vue2.js.map +1 -1
- package/dist/components/PlSidebar/PlSidebarGroup.vue2.js.map +1 -1
- package/dist/components/PlSidebar/PlSidebarItem.vue2.js.map +1 -1
- package/dist/components/PlSlideModal/PlPureSlideModal.vue.js +1 -1
- package/dist/components/PlSlideModal/PlPureSlideModal.vue.js.map +1 -1
- package/dist/components/PlSlideModal/PlSlideModal.vue2.js.map +1 -1
- package/dist/components/PlSplash/PlSplash.vue.js +16 -16
- package/dist/components/PlSplash/PlSplash.vue.js.map +1 -1
- package/dist/components/PlStatusTag/PlStatusTag.vue.js +7 -7
- package/dist/components/PlStatusTag/PlStatusTag.vue.js.map +1 -1
- package/dist/components/PlSvg/PlSvg.vue2.js.map +1 -1
- package/dist/components/PlTabs/PlTabs.vue.js +18 -18
- package/dist/components/PlTabs/PlTabs.vue.js.map +1 -1
- package/dist/components/PlTabs/Tab.vue.js +9 -9
- package/dist/components/PlTabs/Tab.vue.js.map +1 -1
- package/dist/components/PlTextArea/PlTextArea.vue.js +51 -51
- package/dist/components/PlTextArea/PlTextArea.vue.js.map +1 -1
- package/dist/components/PlTextField/PlTextField.vue.js +62 -62
- package/dist/components/PlTextField/PlTextField.vue.js.map +1 -1
- package/dist/components/PlToggleSwitch/PlToggleSwitch.vue.js +14 -14
- package/dist/components/PlToggleSwitch/PlToggleSwitch.vue.js.map +1 -1
- package/dist/components/PlTooltip/Beak.vue.js +2 -2
- package/dist/components/PlTooltip/Beak.vue.js.map +1 -1
- package/dist/components/PlTooltip/PlTooltip.vue.js +50 -50
- package/dist/components/PlTooltip/PlTooltip.vue.js.map +1 -1
- package/dist/components/Scrollable.vue.js.map +1 -1
- package/dist/components/Slider.vue.js +35 -35
- package/dist/components/Slider.vue.js.map +1 -1
- package/dist/components/SliderRange.vue.js +47 -47
- package/dist/components/SliderRange.vue.js.map +1 -1
- package/dist/components/SliderRangeTriple.vue.js +47 -47
- package/dist/components/SliderRangeTriple.vue.js.map +1 -1
- package/dist/components/TabItem.vue.js.map +1 -1
- package/dist/components/ThemeSwitcher.vue.js +2 -2
- package/dist/components/ThemeSwitcher.vue.js.map +1 -1
- package/dist/components/TransitionSlidePanel.vue.js.map +1 -1
- package/dist/components/VScroll.vue.js.map +1 -1
- package/dist/components/contextMenu/Menu.vue2.js +12 -12
- package/dist/components/contextMenu/Menu.vue2.js.map +1 -1
- package/dist/index.js +1 -1
- package/dist/layout/PlBlockPage/PlBlockPage.vue.js +27 -27
- package/dist/layout/PlBlockPage/PlBlockPage.vue.js.map +1 -1
- package/dist/layout/PlContainer/PlContainer.vue.js +10 -10
- package/dist/layout/PlContainer/PlContainer.vue.js.map +1 -1
- package/dist/layout/PlGrid/PlGrid.vue.js.map +1 -1
- package/dist/layout/PlRow/PlRow.vue.js +8 -8
- package/dist/layout/PlRow/PlRow.vue.js.map +1 -1
- package/dist/layout/PlSpacer/PlSpacer.vue.js.map +1 -1
- package/dist/utils/DoubleContour.vue.js +9 -9
- package/dist/utils/DoubleContour.vue.js.map +1 -1
- package/dist/utils/DropdownOverlay/DropdownOverlay.vue.js.map +1 -1
- package/dist/utils/PlCloseModalBtn.vue.js +2 -2
- package/dist/utils/PlCloseModalBtn.vue.js.map +1 -1
- package/dist/utils/TextLabel.vue.js.map +1 -1
- package/package.json +5 -5
- package/dist/components/PlAccordion/ExpandTransition.vue2.js.map +0 -1
- package/dist/utils/DoubleContour.vue2.js +0 -23
- package/dist/utils/DoubleContour.vue2.js.map +0 -1
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"SliderRange.vue.js","sources":["../../src/components/SliderRange.vue"],"sourcesContent":["<script lang=\"ts\" setup>\nimport { computed, reactive, ref, unref, useSlots, watch } from 'vue';\nimport { useMouseCapture } from '../composition/useMouseCapture';\nimport { tapIf } from '../helpers/functions';\nimport { clamp } from '../helpers/math';\nimport { PlTooltip } from './PlTooltip';\nimport type { SliderMode } from '../types';\nimport InputRange from './InputRange.vue';\nimport { useSliderBreakpoints } from '../composition/useSliderBreakpoints';\nimport { getErrorMessage } from '../helpers/error.ts';\n\nconst slots = useSlots();\n\nconst emit = defineEmits(['update:modelValue']);\n\nconst props = withDefaults(\n defineProps<{\n modelValue: [number, number];\n min?: number;\n max: number;\n step?: number;\n label?: string;\n helper?: string;\n error?: unknown;\n mode?: SliderMode;\n measure?: string;\n breakpoints?: boolean;\n disabled?: boolean;\n }>(),\n {\n label: undefined,\n helper: undefined,\n error: undefined,\n min: 0,\n step: 1,\n mode: 'text',\n measure: '',\n breakpoints: false,\n disabled: false,\n },\n);\n\nconst data = reactive({\n deltaValue1: 0,\n deltaValue2: 0,\n});\n\nconst barRef = ref<HTMLElement>();\nconst thumbRef1 = ref<HTMLElement>();\nconst thumbRef2 = ref<HTMLElement>();\nconst inputRange = ref<[number, number]>(props.modelValue);\nconst leftDelta = ref(props.modelValue[0]);\nconst rightDelta = ref(props.modelValue[1]);\n\nconst propsRef = computed(() => props);\n\nconst breakpointsRef = useSliderBreakpoints(propsRef);\n\nconst textModelValue = computed(() => [leftDelta.value, rightDelta.value].sort((a, b) => a - b).join('-'));\n\nconst range = computed(() => props.max - props.min);\n\nconst localValue1 = computed(() => {\n return clamp((props.modelValue[0] ?? 0) + data.deltaValue1, props.min, props.max);\n});\n\nconst localValue2 = computed(() => clamp((props.modelValue[1] ?? 0) + data.deltaValue2, props.min, props.max));\n\nconst error = computed(() => {\n const v = props.modelValue as unknown;\n\n const isValidModel = Array.isArray(v) && v.length === 2 && v.every((it) => Number.isFinite(it));\n\n if (!isValidModel) {\n return 'Expected model [number, number]';\n }\n\n return getErrorMessage(props.error);\n});\n\nconst position1 = computed(() => {\n return (localValue1.value - props.min) / range.value;\n});\n\nconst position2 = computed(() => {\n return (localValue2.value - props.min) / range.value;\n});\n\nconst leftRight = computed(() => getLeftAndRight());\n\nconst progressStyle = computed(() => ({\n right: leftRight.value[0] + '%',\n left: 100 - leftRight.value[1] + '%',\n}));\n\nconst thumbStyle1 = computed(() => ({\n right: Math.ceil((1 - position1.value) * 100) + '%',\n}));\n\nconst thumbStyle2 = computed(() => ({\n right: Math.ceil((1 - position2.value) * 100) + '%',\n}));\n\nwatch(\n () => props.modelValue,\n (value: [number, number]) => {\n inputRange.value = value;\n leftDelta.value = +value[0];\n rightDelta.value = +value[1];\n },\n { immediate: true },\n);\n\nuseMouseCapture(thumbRef1, (ev) => {\n tapIf(unref(barRef)?.getBoundingClientRect(), (rect) => {\n const { dx } = ev;\n\n data.deltaValue1 = (dx / rect.width) * range.value;\n\n leftDelta.value = round(clamp((props.modelValue[0] ?? 0) + data.deltaValue1, props.min, props.max));\n\n inputRange.value = ([leftDelta.value, rightDelta.value] as [number, number]).sort((a, b) => a - b);\n\n if (ev.stop) {\n setModelValue([round(localValue1.value), round(localValue2.value)]);\n data.deltaValue1 = 0;\n }\n });\n});\n\nuseMouseCapture(thumbRef2, (ev) => {\n tapIf(unref(barRef)?.getBoundingClientRect(), (rect) => {\n const { dx } = ev;\n\n data.deltaValue2 = (dx / rect.width) * range.value;\n\n rightDelta.value = round(clamp((props.modelValue[1] ?? 0) + data.deltaValue2, props.min, props.max));\n\n inputRange.value = ([leftDelta.value, rightDelta.value] as [number, number]).sort((a, b) => a - b);\n\n if (ev.stop) {\n setModelValue([round(localValue1.value), round(localValue2.value)]);\n data.deltaValue2 = 0;\n }\n });\n});\n\nfunction getLeftAndRight() {\n const point1 = Math.ceil((1 - position1.value) * 100);\n const point2 = Math.ceil((1 - position2.value) * 100);\n return [point1, point2].sort((a, b) => a - b);\n}\n\nfunction round(value: number) {\n const v = clamp(value, props.min, props.max);\n // This is the same as Math.round(v / props.step) * props.step but here we need this magic to avoid numbers like 3.00000000000000000004\n return Math.round((v + Number.EPSILON) * (1 / props.step)) / (1 / props.step);\n}\n\nfunction setModelValue(value: [number, number]) {\n emit('update:modelValue', value);\n}\n\nfunction handleKeyPress(e: { code: string; preventDefault(): void }, index: number) {\n if (['ArrowDown', 'ArrowUp', 'ArrowRight', 'ArrowLeft', 'Enter'].includes(e.code)) {\n e.preventDefault();\n }\n\n const nextStep\n = e.code === 'ArrowUp' || e.code === 'ArrowRight' ? props.step * 1 : e.code === 'ArrowDown' || e.code === 'ArrowLeft' ? props.step * -1 : 0;\n\n const arr: [number, number] = [...props.modelValue];\n arr[index] = clamp(arr[index] + nextStep, props.min, props.max);\n setModelValue(arr);\n}\n</script>\n\n<template>\n <!-- {{ leftDelta }} {{ rightDelta }} -->\n <div :class=\"props.disabled ? 'ui-slider__disabled' : undefined\" class=\"ui-slider__envelope\">\n <div :class=\"`ui-slider__mode-${props.mode}`\" class=\"ui-slider\">\n <div class=\"ui-slider__wrapper\">\n <div class=\"ui-slider__label-section\">\n <label v-if=\"label\" class=\"text-s\">\n <span>{{ label }}</span>\n <PlTooltip v-if=\"slots.tooltip\" class=\"info\" position=\"top\">\n <template #tooltip>\n <slot name=\"tooltip\" />\n </template>\n </PlTooltip>\n </label>\n <div v-if=\"props.mode === 'text'\" class=\"ui-slider__value-static text-s\">{{ textModelValue }}</div>\n </div>\n <div class=\"ui-slider__base\">\n <div class=\"ui-slider__container\">\n <div ref=\"barRef\" class=\"ui-slider__bar\">\n <div class=\"ui-slider__progress\" :style=\"progressStyle\" />\n </div>\n </div>\n <div class=\"ui-slider__container ui-slider__container-thumb\">\n <template v-if=\"props.breakpoints\">\n <div v-for=\"(item, index) in breakpointsRef\" :key=\"index\" :style=\"{ right: `${item}%` }\" class=\"ui-slider__thumb-step\"/>\n </template>\n <div ref=\"thumbRef1\" :style=\"thumbStyle1\" class=\"ui-slider__thumb\" tabindex=\"0\" @keydown=\"handleKeyPress($event, 0)\">\n <div class=\"ui-slider__thumb-focused-contour\" />\n </div>\n <div ref=\"thumbRef2\" :style=\"thumbStyle2\" class=\"ui-slider__thumb\" tabindex=\"0\" @keydown=\"handleKeyPress($event, 1)\">\n <div class=\"ui-slider__thumb-focused-contour\" />\n </div>\n </div>\n </div>\n </div>\n\n <div class=\"ui-slider__input-wrapper d-flex\">\n <InputRange v-if=\"props.mode === 'input'\" v-model=\"inputRange\" class=\"ui-focused-border\" @change=\"setModelValue\" />\n </div>\n </div>\n <!-- <div v-if=\"helper\" class=\"ui-slider__helper\">\n {{ helper }}\n </div> -->\n <div v-if=\"error\" class=\"ui-slider__error\">\n {{ error }}\n </div>\n </div>\n</template>\n"],"names":["slots","useSlots","emit","__emit","props","__props","data","reactive","barRef","ref","thumbRef1","thumbRef2","inputRange","leftDelta","rightDelta","propsRef","computed","breakpointsRef","useSliderBreakpoints","textModelValue","a","b","range","localValue1","clamp","localValue2","error","v","it","getErrorMessage","position1","position2","leftRight","getLeftAndRight","progressStyle","thumbStyle1","thumbStyle2","watch","value","useMouseCapture","ev","tapIf","_a","unref","rect","dx","round","setModelValue","point1","point2","handleKeyPress","e","index","nextStep","arr"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;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O,KAAK,GAEtIkD,IAAwB,CAAC,GAAGlD,EAAM,UAAU;AAClD,MAAAkD,EAAIF,CAAK,IAAI5B,EAAM8B,EAAIF,CAAK,IAAIC,GAAUjD,EAAM,KAAKA,EAAM,GAAG,GAC9D2C,EAAcO,CAAG;AAAA,IACnB;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;"}
|
|
1
|
+
{"version":3,"file":"SliderRange.vue.js","sources":["../../src/components/SliderRange.vue"],"sourcesContent":["<script lang=\"ts\" setup>\nimport { computed, reactive, ref, unref, useSlots, watch } from 'vue';\nimport { useMouseCapture } from '../composition/useMouseCapture';\nimport { tapIf } from '../helpers/functions';\nimport { clamp } from '../helpers/math';\nimport { PlTooltip } from './PlTooltip';\nimport type { SliderMode } from '../types';\nimport InputRange from './InputRange.vue';\nimport { useSliderBreakpoints } from '../composition/useSliderBreakpoints';\nimport { getErrorMessage } from '../helpers/error.ts';\n\nconst slots = useSlots();\n\nconst emit = defineEmits(['update:modelValue']);\n\nconst props = withDefaults(\n defineProps<{\n modelValue: [number, number];\n min?: number;\n max: number;\n step?: number;\n label?: string;\n helper?: string;\n error?: unknown;\n mode?: SliderMode;\n measure?: string;\n breakpoints?: boolean;\n disabled?: boolean;\n }>(),\n {\n label: undefined,\n helper: undefined,\n error: undefined,\n min: 0,\n step: 1,\n mode: 'text',\n measure: '',\n breakpoints: false,\n disabled: false,\n },\n);\n\nconst data = reactive({\n deltaValue1: 0,\n deltaValue2: 0,\n});\n\nconst barRef = ref<HTMLElement>();\nconst thumbRef1 = ref<HTMLElement>();\nconst thumbRef2 = ref<HTMLElement>();\nconst inputRange = ref<[number, number]>(props.modelValue);\nconst leftDelta = ref(props.modelValue[0]);\nconst rightDelta = ref(props.modelValue[1]);\n\nconst propsRef = computed(() => props);\n\nconst breakpointsRef = useSliderBreakpoints(propsRef);\n\nconst textModelValue = computed(() => [leftDelta.value, rightDelta.value].sort((a, b) => a - b).join('-'));\n\nconst range = computed(() => props.max - props.min);\n\nconst localValue1 = computed(() => {\n return clamp((props.modelValue[0] ?? 0) + data.deltaValue1, props.min, props.max);\n});\n\nconst localValue2 = computed(() => clamp((props.modelValue[1] ?? 0) + data.deltaValue2, props.min, props.max));\n\nconst error = computed(() => {\n const v = props.modelValue as unknown;\n\n const isValidModel = Array.isArray(v) && v.length === 2 && v.every((it) => Number.isFinite(it));\n\n if (!isValidModel) {\n return 'Expected model [number, number]';\n }\n\n return getErrorMessage(props.error);\n});\n\nconst position1 = computed(() => {\n return (localValue1.value - props.min) / range.value;\n});\n\nconst position2 = computed(() => {\n return (localValue2.value - props.min) / range.value;\n});\n\nconst leftRight = computed(() => getLeftAndRight());\n\nconst progressStyle = computed(() => ({\n right: leftRight.value[0] + '%',\n left: 100 - leftRight.value[1] + '%',\n}));\n\nconst thumbStyle1 = computed(() => ({\n right: Math.ceil((1 - position1.value) * 100) + '%',\n}));\n\nconst thumbStyle2 = computed(() => ({\n right: Math.ceil((1 - position2.value) * 100) + '%',\n}));\n\nwatch(\n () => props.modelValue,\n (value: [number, number]) => {\n inputRange.value = value;\n leftDelta.value = +value[0];\n rightDelta.value = +value[1];\n },\n { immediate: true },\n);\n\nuseMouseCapture(thumbRef1, (ev) => {\n tapIf(unref(barRef)?.getBoundingClientRect(), (rect) => {\n const { dx } = ev;\n\n data.deltaValue1 = (dx / rect.width) * range.value;\n\n leftDelta.value = round(clamp((props.modelValue[0] ?? 0) + data.deltaValue1, props.min, props.max));\n\n inputRange.value = ([leftDelta.value, rightDelta.value] as [number, number]).sort((a, b) => a - b);\n\n if (ev.stop) {\n setModelValue([round(localValue1.value), round(localValue2.value)]);\n data.deltaValue1 = 0;\n }\n });\n});\n\nuseMouseCapture(thumbRef2, (ev) => {\n tapIf(unref(barRef)?.getBoundingClientRect(), (rect) => {\n const { dx } = ev;\n\n data.deltaValue2 = (dx / rect.width) * range.value;\n\n rightDelta.value = round(clamp((props.modelValue[1] ?? 0) + data.deltaValue2, props.min, props.max));\n\n inputRange.value = ([leftDelta.value, rightDelta.value] as [number, number]).sort((a, b) => a - b);\n\n if (ev.stop) {\n setModelValue([round(localValue1.value), round(localValue2.value)]);\n data.deltaValue2 = 0;\n }\n });\n});\n\nfunction getLeftAndRight() {\n const point1 = Math.ceil((1 - position1.value) * 100);\n const point2 = Math.ceil((1 - position2.value) * 100);\n return [point1, point2].sort((a, b) => a - b);\n}\n\nfunction round(value: number) {\n const v = clamp(value, props.min, props.max);\n // This is the same as Math.round(v / props.step) * props.step but here we need this magic to avoid numbers like 3.00000000000000000004\n return Math.round((v + Number.EPSILON) * (1 / props.step)) / (1 / props.step);\n}\n\nfunction setModelValue(value: [number, number]) {\n emit('update:modelValue', value);\n}\n\nfunction handleKeyPress(e: { code: string; preventDefault(): void }, index: number) {\n if (['ArrowDown', 'ArrowUp', 'ArrowRight', 'ArrowLeft', 'Enter'].includes(e.code)) {\n e.preventDefault();\n }\n\n const nextStep\n = e.code === 'ArrowUp' || e.code === 'ArrowRight' ? props.step * 1 : e.code === 'ArrowDown' || e.code === 'ArrowLeft' ? props.step * -1 : 0;\n\n const arr: [number, number] = [...props.modelValue];\n arr[index] = clamp(arr[index] + nextStep, props.min, props.max);\n setModelValue(arr);\n}\n</script>\n\n<template>\n <!-- {{ leftDelta }} {{ rightDelta }} -->\n <div :class=\"props.disabled ? 'ui-slider__disabled' : undefined\" class=\"ui-slider__envelope\">\n <div :class=\"`ui-slider__mode-${props.mode}`\" class=\"ui-slider\">\n <div class=\"ui-slider__wrapper\">\n <div class=\"ui-slider__label-section\">\n <label v-if=\"label\" class=\"text-s\">\n <span>{{ label }}</span>\n <PlTooltip v-if=\"slots.tooltip\" class=\"info\" position=\"top\">\n <template #tooltip>\n <slot name=\"tooltip\" />\n </template>\n </PlTooltip>\n </label>\n <div v-if=\"props.mode === 'text'\" class=\"ui-slider__value-static text-s\">{{ textModelValue }}</div>\n </div>\n <div class=\"ui-slider__base\">\n <div class=\"ui-slider__container\">\n <div ref=\"barRef\" class=\"ui-slider__bar\">\n <div class=\"ui-slider__progress\" :style=\"progressStyle\" />\n </div>\n </div>\n <div class=\"ui-slider__container ui-slider__container-thumb\">\n <template v-if=\"props.breakpoints\">\n <div v-for=\"(item, index) in breakpointsRef\" :key=\"index\" :style=\"{ right: `${item}%` }\" class=\"ui-slider__thumb-step\"/>\n </template>\n <div ref=\"thumbRef1\" :style=\"thumbStyle1\" class=\"ui-slider__thumb\" tabindex=\"0\" @keydown=\"handleKeyPress($event, 0)\">\n <div class=\"ui-slider__thumb-focused-contour\" />\n </div>\n <div ref=\"thumbRef2\" :style=\"thumbStyle2\" class=\"ui-slider__thumb\" tabindex=\"0\" @keydown=\"handleKeyPress($event, 1)\">\n <div class=\"ui-slider__thumb-focused-contour\" />\n </div>\n </div>\n </div>\n </div>\n\n <div class=\"ui-slider__input-wrapper d-flex\">\n <InputRange v-if=\"props.mode === 'input'\" v-model=\"inputRange\" class=\"ui-focused-border\" @change=\"setModelValue\" />\n </div>\n </div>\n <!-- <div v-if=\"helper\" class=\"ui-slider__helper\">\n {{ helper }}\n </div> -->\n <div v-if=\"error\" class=\"ui-slider__error\">\n {{ error }}\n </div>\n </div>\n</template>\n"],"names":["slots","useSlots","emit","__emit","props","__props","data","reactive","barRef","ref","thumbRef1","thumbRef2","inputRange","leftDelta","rightDelta","propsRef","computed","breakpointsRef","useSliderBreakpoints","textModelValue","a","b","range","localValue1","clamp","localValue2","error","v","it","getErrorMessage","position1","position2","leftRight","getLeftAndRight","progressStyle","thumbStyle1","thumbStyle2","watch","value","useMouseCapture","ev","tapIf","_a","unref","rect","dx","round","setModelValue","point1","point2","handleKeyPress","e","index","nextStep","arr","_createElementBlock","_createElementVNode","_normalizeClass","_hoisted_1","_hoisted_2","_openBlock","_hoisted_3","_unref","_createBlock","PlTooltip","_renderSlot","_ctx","_hoisted_4","_toDisplayString","_hoisted_5","_hoisted_6","_hoisted_7","_Fragment","_renderList","item","_c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lock as d, normalizeClass as
|
|
2
|
-
import { useMouseCapture as
|
|
3
|
-
import { tapIf as
|
|
1
|
+
import { defineComponent as W, useSlots as X, reactive as Y, ref as w, computed as r, onMounted as Z, createElementBlock as h, openBlock as d, normalizeClass as P, createElementVNode as o, createCommentVNode as R, createBlock as ee, toDisplayString as T, unref as m, withCtx as te, renderSlot as le, normalizeStyle as _, Fragment as ae, renderList as ie } from "vue";
|
|
2
|
+
import { useMouseCapture as $ } from "../composition/useMouseCapture.js";
|
|
3
|
+
import { tapIf as D } from "../helpers/functions.js";
|
|
4
4
|
import { clamp as c } from "../helpers/math.js";
|
|
5
5
|
import oe from "./PlTooltip/PlTooltip.vue.js";
|
|
6
6
|
import { useSliderBreakpoints as re } from "../composition/useSliderBreakpoints.js";
|
|
@@ -27,12 +27,12 @@ const ue = { class: "ui-slider__wrapper" }, ne = { class: "ui-slider__label-sect
|
|
|
27
27
|
disabled: { type: Boolean, default: !1 }
|
|
28
28
|
},
|
|
29
29
|
emits: ["update:modelValue"],
|
|
30
|
-
setup(
|
|
31
|
-
const j = X(), H = U, e =
|
|
30
|
+
setup(k, { emit: U }) {
|
|
31
|
+
const j = X(), H = U, e = k, s = Y({
|
|
32
32
|
deltaValue1: 0,
|
|
33
33
|
deltaValue2: 0,
|
|
34
34
|
deltaValue3: 0
|
|
35
|
-
}), b = w(), p = w(), v = w(), f = w(), n = r(() => e.max - e.min), O = r(() => e), q = re(O), g = r(() => c((e.modelValue[0] ?? 0) + s.deltaValue1, e.min, e.max)), V = r(() => c((e.modelValue[1] ?? 0) + s.deltaValue2, e.min, e.max)), y = r(() => c((e.modelValue[2] ?? 0) + s.deltaValue3, e.min, e.max)),
|
|
35
|
+
}), b = w(), p = w(), v = w(), f = w(), n = r(() => e.max - e.min), O = r(() => e), q = re(O), g = r(() => c((e.modelValue[0] ?? 0) + s.deltaValue1, e.min, e.max)), V = r(() => c((e.modelValue[1] ?? 0) + s.deltaValue2, e.min, e.max)), y = r(() => c((e.modelValue[2] ?? 0) + s.deltaValue3, e.min, e.max)), L = r(() => {
|
|
36
36
|
const l = e.modelValue;
|
|
37
37
|
if (!(Array.isArray(l) && l.length === 3 && l.every((a) => Number.isFinite(a))))
|
|
38
38
|
return "Expected model [number, number, number]";
|
|
@@ -40,42 +40,42 @@ const ue = { class: "ui-slider__wrapper" }, ne = { class: "ui-slider__label-sect
|
|
|
40
40
|
return [...e.modelValue].forEach((a) => {
|
|
41
41
|
a > e.max && i.push(`Max model value must be lower than max props ${e.max}.`), a < e.min && i.push("Min model value must be greater than max props.");
|
|
42
42
|
}), i.length > 0 ? i.join(" ") : se(e.error);
|
|
43
|
-
}),
|
|
44
|
-
right:
|
|
45
|
-
left: 100 -
|
|
46
|
-
})), k = r(() => ({
|
|
47
|
-
right: Math.ceil((1 - L.value) * 100) + "%"
|
|
43
|
+
}), K = r(() => (g.value - e.min) / n.value), F = r(() => (V.value - e.min) / n.value), z = r(() => (y.value - e.min) / n.value), I = r(() => J()), G = r(() => ({
|
|
44
|
+
right: I.value[0] + "%",
|
|
45
|
+
left: 100 - I.value[2] + "%"
|
|
48
46
|
})), M = r(() => ({
|
|
49
47
|
right: Math.ceil((1 - K.value) * 100) + "%"
|
|
50
48
|
})), S = r(() => ({
|
|
51
49
|
right: Math.ceil((1 - F.value) * 100) + "%"
|
|
50
|
+
})), A = r(() => ({
|
|
51
|
+
right: Math.ceil((1 - z.value) * 100) + "%"
|
|
52
52
|
}));
|
|
53
|
-
|
|
53
|
+
$(p, (l) => {
|
|
54
54
|
var t;
|
|
55
|
-
|
|
55
|
+
D((t = m(b)) == null ? void 0 : t.getBoundingClientRect(), (i) => {
|
|
56
56
|
const { dx: a } = l;
|
|
57
|
-
s.deltaValue1 = a / i.width * n.value, p.value &&
|
|
57
|
+
s.deltaValue1 = a / i.width * n.value, p.value && B(p.value, e.modelValue[0], s.deltaValue1), l.stop && (x([u(g.value), u(V.value), u(y.value)]), s.deltaValue1 = 0);
|
|
58
58
|
});
|
|
59
|
-
}),
|
|
59
|
+
}), $(v, (l) => {
|
|
60
60
|
var t;
|
|
61
|
-
|
|
61
|
+
D((t = m(b)) == null ? void 0 : t.getBoundingClientRect(), (i) => {
|
|
62
62
|
const { dx: a } = l;
|
|
63
|
-
s.deltaValue2 = a / i.width * n.value, v.value &&
|
|
63
|
+
s.deltaValue2 = a / i.width * n.value, v.value && B(v.value, e.modelValue[1], s.deltaValue2), l.stop && (x([u(g.value), u(V.value), u(y.value)]), s.deltaValue2 = 0);
|
|
64
64
|
});
|
|
65
|
-
}),
|
|
65
|
+
}), $(f, (l) => {
|
|
66
66
|
var t;
|
|
67
|
-
|
|
67
|
+
D((t = m(b)) == null ? void 0 : t.getBoundingClientRect(), (i) => {
|
|
68
68
|
const { dx: a } = l;
|
|
69
|
-
s.deltaValue3 = a / i.width * n.value, f.value &&
|
|
69
|
+
s.deltaValue3 = a / i.width * n.value, f.value && B(f.value, e.modelValue[2], s.deltaValue3), l.stop && (x([u(g.value), u(V.value), u(y.value)]), s.deltaValue3 = 0);
|
|
70
70
|
});
|
|
71
71
|
});
|
|
72
|
-
function
|
|
72
|
+
function B(l, t, i) {
|
|
73
73
|
const a = u(c((t ?? 0) + i, e.min, e.max));
|
|
74
|
-
l.dataset.percent = `${a}${e.measure}`,
|
|
74
|
+
l.dataset.percent = `${a}${e.measure}`, C();
|
|
75
75
|
}
|
|
76
76
|
function J() {
|
|
77
|
-
const l = Math.ceil((1 -
|
|
78
|
-
return [l, t, i].sort((a,
|
|
77
|
+
const l = Math.ceil((1 - K.value) * 100), t = Math.ceil((1 - F.value) * 100), i = Math.ceil((1 - z.value) * 100);
|
|
78
|
+
return [l, t, i].sort((a, E) => a - E);
|
|
79
79
|
}
|
|
80
80
|
function u(l) {
|
|
81
81
|
const t = c(l, e.min, e.max);
|
|
@@ -84,31 +84,31 @@ const ue = { class: "ui-slider__wrapper" }, ne = { class: "ui-slider__label-sect
|
|
|
84
84
|
function x(l) {
|
|
85
85
|
H("update:modelValue", l);
|
|
86
86
|
}
|
|
87
|
-
function
|
|
88
|
-
const l = Number(
|
|
87
|
+
function C() {
|
|
88
|
+
const l = Number(M.value.right.substring(0, M.value.right.length - 1)), t = Number(S.value.right.substring(0, S.value.right.length - 1)), i = Number(A.value.right.substring(0, A.value.right.length - 1)), a = [
|
|
89
89
|
{ r: l, th: p },
|
|
90
90
|
{ r: t, th: v },
|
|
91
91
|
{ r: i, th: f }
|
|
92
|
-
].sort((
|
|
92
|
+
].sort((E, Q) => E.r - Q.r);
|
|
93
93
|
a[0].th.value && (a[0].th.value.dataset.hint = "high"), a[1].th.value && (a[1].th.value.dataset.hint = "mid"), a[2].th.value && (a[2].th.value.dataset.hint = "low");
|
|
94
94
|
}
|
|
95
|
-
function
|
|
95
|
+
function N(l, t) {
|
|
96
96
|
["ArrowDown", "ArrowUp", "ArrowRight", "ArrowLeft", "Enter"].includes(l.code) && l.preventDefault();
|
|
97
97
|
const i = l.code === "ArrowUp" || l.code === "ArrowRight" ? e.step * 1 : l.code === "ArrowDown" || l.code === "ArrowLeft" ? e.step * -1 : 0, a = [...e.modelValue];
|
|
98
|
-
a[t] = c(a[t] + i, e.min, e.max), x(a),
|
|
98
|
+
a[t] = c(a[t] + i, e.min, e.max), x(a), C();
|
|
99
99
|
}
|
|
100
100
|
return Z(() => {
|
|
101
|
-
|
|
101
|
+
C();
|
|
102
102
|
}), (l, t) => (d(), h("div", {
|
|
103
|
-
class:
|
|
103
|
+
class: P([e.disabled ? "ui-slider__disabled" : void 0, "ui-slider__envelope ui-slider__triple"])
|
|
104
104
|
}, [
|
|
105
105
|
o("div", {
|
|
106
|
-
class:
|
|
106
|
+
class: P([`ui-slider__mode-${e.mode}`, "ui-slider"])
|
|
107
107
|
}, [
|
|
108
108
|
o("div", ue, [
|
|
109
109
|
o("div", ne, [
|
|
110
|
-
|
|
111
|
-
o("span", null,
|
|
110
|
+
k.label ? (d(), h("label", de, [
|
|
111
|
+
o("span", null, T(k.label), 1),
|
|
112
112
|
m(j).tooltip ? (d(), ee(m(oe), {
|
|
113
113
|
key: 0,
|
|
114
114
|
class: "info",
|
|
@@ -143,45 +143,45 @@ const ue = { class: "ui-slider__wrapper" }, ne = { class: "ui-slider__label-sect
|
|
|
143
143
|
o("div", {
|
|
144
144
|
ref_key: "thumbRef1",
|
|
145
145
|
ref: p,
|
|
146
|
-
style: _(
|
|
146
|
+
style: _(M.value),
|
|
147
147
|
"data-percent": e.modelValue[0] + "%",
|
|
148
148
|
class: "ui-slider__thumb ui-slider__triple-thumb",
|
|
149
149
|
r1: "",
|
|
150
150
|
tabindex: "0",
|
|
151
|
-
onKeydown: t[0] || (t[0] = (i) =>
|
|
152
|
-
}, t[3] || (t[3] = [
|
|
151
|
+
onKeydown: t[0] || (t[0] = (i) => N(i, 0))
|
|
152
|
+
}, [...t[3] || (t[3] = [
|
|
153
153
|
o("div", { class: "ui-slider__thumb-focused-contour" }, null, -1)
|
|
154
|
-
]), 44, ve),
|
|
154
|
+
])], 44, ve),
|
|
155
155
|
o("div", {
|
|
156
156
|
ref_key: "thumbRef2",
|
|
157
157
|
ref: v,
|
|
158
|
-
style: _(
|
|
158
|
+
style: _(S.value),
|
|
159
159
|
"data-percent": e.modelValue[1] + "%",
|
|
160
160
|
class: "ui-slider__thumb ui-slider__triple-thumb",
|
|
161
161
|
r2: "",
|
|
162
162
|
tabindex: "0",
|
|
163
|
-
onKeydown: t[1] || (t[1] = (i) =>
|
|
164
|
-
}, t[4] || (t[4] = [
|
|
163
|
+
onKeydown: t[1] || (t[1] = (i) => N(i, 1))
|
|
164
|
+
}, [...t[4] || (t[4] = [
|
|
165
165
|
o("div", { class: "ui-slider__thumb-focused-contour" }, null, -1)
|
|
166
|
-
]), 44, fe),
|
|
166
|
+
])], 44, fe),
|
|
167
167
|
o("div", {
|
|
168
168
|
ref_key: "thumbRef3",
|
|
169
169
|
ref: f,
|
|
170
|
-
style: _(
|
|
170
|
+
style: _(A.value),
|
|
171
171
|
"data-percent": e.modelValue[2] + "%",
|
|
172
172
|
class: "ui-slider__thumb ui-slider__triple-thumb",
|
|
173
173
|
r3: "",
|
|
174
174
|
tabindex: "0",
|
|
175
|
-
onKeydown: t[2] || (t[2] = (i) =>
|
|
176
|
-
}, t[5] || (t[5] = [
|
|
175
|
+
onKeydown: t[2] || (t[2] = (i) => N(i, 2))
|
|
176
|
+
}, [...t[5] || (t[5] = [
|
|
177
177
|
o("div", { class: "ui-slider__thumb-focused-contour" }, null, -1)
|
|
178
|
-
]), 44, he)
|
|
178
|
+
])], 44, he)
|
|
179
179
|
])
|
|
180
180
|
])
|
|
181
181
|
]),
|
|
182
182
|
t[6] || (t[6] = o("div", { class: "ui-slider__input-wrapper d-flex" }, null, -1))
|
|
183
183
|
], 2),
|
|
184
|
-
|
|
184
|
+
L.value ? (d(), h("div", _e, T(L.value), 1)) : R("", !0)
|
|
185
185
|
], 2));
|
|
186
186
|
}
|
|
187
187
|
});
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"SliderRangeTriple.vue.js","sources":["../../src/components/SliderRangeTriple.vue"],"sourcesContent":["<script lang=\"ts\" setup>\nimport { computed, onMounted, reactive, ref, unref, useSlots } from 'vue';\nimport { useMouseCapture } from '../composition/useMouseCapture';\nimport { tapIf } from '../helpers/functions';\nimport { clamp } from '../helpers/math';\nimport { PlTooltip } from './PlTooltip';\nimport type { SliderMode } from '../types';\nimport { useSliderBreakpoints } from '../composition/useSliderBreakpoints';\nimport { getErrorMessage } from '../helpers/error.ts';\n\ntype ModelType = [number, number, number];\nconst slots = useSlots();\n\nconst emit = defineEmits(['update:modelValue']);\n\nconst props = withDefaults(\n defineProps<{\n modelValue: ModelType;\n min?: number;\n max: number;\n step?: number;\n label?: string;\n helper?: string;\n error?: unknown;\n mode?: SliderMode;\n measure?: string;\n breakpoints?: boolean;\n disabled?: boolean;\n }>(),\n {\n label: undefined,\n helper: undefined,\n error: undefined,\n min: 0,\n step: 1,\n mode: 'text',\n measure: '%',\n breakpoints: false,\n disabled: false,\n },\n);\n\nconst data = reactive({\n deltaValue1: 0,\n deltaValue2: 0,\n deltaValue3: 0,\n});\n\nconst barRef = ref<HTMLElement>();\nconst thumbRef1 = ref<HTMLElement>();\nconst thumbRef2 = ref<HTMLElement>();\nconst thumbRef3 = ref<HTMLElement>();\n\nconst range = computed(() => props.max - props.min);\n\nconst propsRef = computed(() => props);\n\nconst breakpointsRef = useSliderBreakpoints(propsRef);\n\nconst localValue1 = computed(() => clamp((props.modelValue[0] ?? 0) + data.deltaValue1, props.min, props.max));\nconst localValue2 = computed(() => clamp((props.modelValue[1] ?? 0) + data.deltaValue2, props.min, props.max));\nconst localValue3 = computed(() => clamp((props.modelValue[2] ?? 0) + data.deltaValue3, props.min, props.max));\n\nconst error = computed(() => {\n const v = props.modelValue as unknown;\n\n const isValidModel = Array.isArray(v) && v.length === 3 && v.every((it) => Number.isFinite(it));\n\n if (!isValidModel) {\n return 'Expected model [number, number, number]';\n }\n\n const errors: string[] = [];\n\n [...props.modelValue].forEach((v) => {\n if (v > props.max) {\n errors.push(`Max model value must be lower than max props ${props.max}.`);\n }\n if (v < props.min) {\n errors.push('Min model value must be greater than max props.');\n }\n });\n\n if (errors.length > 0) {\n return errors.join(' ');\n }\n\n return getErrorMessage(props.error);\n});\n\nconst position1 = computed(() => {\n return (localValue1.value - props.min) / range.value;\n});\n\nconst position2 = computed(() => {\n return (localValue2.value - props.min) / range.value;\n});\n\nconst position3 = computed(() => {\n return (localValue3.value - props.min) / range.value;\n});\n\nconst leftRight = computed(() => getLeftAndRight());\n\nconst progressStyle = computed(() => ({\n right: leftRight.value[0] + '%',\n left: 100 - leftRight.value[2] + '%',\n}));\n\nconst thumbStyle1 = computed(() => ({\n right: Math.ceil((1 - position1.value) * 100) + '%',\n}));\n\nconst thumbStyle2 = computed(() => ({\n right: Math.ceil((1 - position2.value) * 100) + '%',\n}));\n\nconst thumbStyle3 = computed(() => ({\n right: Math.ceil((1 - position3.value) * 100) + '%',\n}));\n\nuseMouseCapture(thumbRef1, (ev) => {\n tapIf(unref(barRef)?.getBoundingClientRect(), (rect) => {\n const { dx } = ev;\n data.deltaValue1 = (dx / rect.width) * range.value;\n\n if (thumbRef1.value) {\n updateDatasetForThumb(thumbRef1.value, props.modelValue[0], data.deltaValue1);\n }\n\n if (ev.stop) {\n setModelValue([round(localValue1.value), round(localValue2.value), round(localValue3.value)]);\n data.deltaValue1 = 0;\n }\n });\n});\n\nuseMouseCapture(thumbRef2, (ev) => {\n tapIf(unref(barRef)?.getBoundingClientRect(), (rect) => {\n const { dx } = ev;\n data.deltaValue2 = (dx / rect.width) * range.value;\n\n if (thumbRef2.value) {\n updateDatasetForThumb(thumbRef2.value, props.modelValue[1], data.deltaValue2);\n }\n\n if (ev.stop) {\n setModelValue([round(localValue1.value), round(localValue2.value), round(localValue3.value)]);\n data.deltaValue2 = 0;\n }\n });\n});\n\nuseMouseCapture(thumbRef3, (ev) => {\n tapIf(unref(barRef)?.getBoundingClientRect(), (rect) => {\n const { dx } = ev;\n data.deltaValue3 = (dx / rect.width) * range.value;\n\n if (thumbRef3.value) {\n updateDatasetForThumb(thumbRef3.value, props.modelValue[2], data.deltaValue3);\n }\n\n if (ev.stop) {\n setModelValue([round(localValue1.value), round(localValue2.value), round(localValue3.value)]);\n data.deltaValue3 = 0;\n }\n });\n});\n\nfunction updateDatasetForThumb(thumb: HTMLElement, modelVal: number, delta: number) {\n const value = round(clamp((modelVal ?? 0) + delta, props.min, props.max));\n thumb.dataset.percent = `${value}${props.measure}`;\n getHint();\n}\n\nfunction getLeftAndRight() {\n const point1 = Math.ceil((1 - position1.value) * 100);\n const point2 = Math.ceil((1 - position2.value) * 100);\n const point3 = Math.ceil((1 - position3.value) * 100);\n return [point1, point2, point3].sort((a, b) => a - b);\n}\n\nfunction round(value: number) {\n const v = clamp(value, props.min, props.max);\n // This is the same as Math.round(v / props.step) * props.step but here we need this magic to avoid numbers like 3.00000000000000000004\n return Math.round((v + Number.EPSILON) * (1 / props.step)) / (1 / props.step);\n}\n\nfunction setModelValue(value: ModelType) {\n emit('update:modelValue', value);\n}\n\nfunction getHint() {\n const right1 = Number(thumbStyle1.value.right.substring(0, thumbStyle1.value.right.length - 1));\n const right2 = Number(thumbStyle2.value.right.substring(0, thumbStyle2.value.right.length - 1));\n const right3 = Number(thumbStyle3.value.right.substring(0, thumbStyle3.value.right.length - 1));\n\n const arr = [\n { r: right1, th: thumbRef1 },\n { r: right2, th: thumbRef2 },\n { r: right3, th: thumbRef3 },\n ].sort((a, b) => a.r - b.r);\n\n if (arr[0].th.value) {\n arr[0].th.value.dataset.hint = 'high';\n }\n if (arr[1].th.value) {\n arr[1].th.value.dataset.hint = 'mid';\n }\n\n if (arr[2].th.value) {\n arr[2].th.value.dataset.hint = 'low';\n }\n}\n\nfunction handleKeyPress(e: { code: string; preventDefault(): void }, index: number) {\n if (['ArrowDown', 'ArrowUp', 'ArrowRight', 'ArrowLeft', 'Enter'].includes(e.code)) {\n e.preventDefault();\n }\n\n const nextStep\n = e.code === 'ArrowUp' || e.code === 'ArrowRight' ? props.step * 1 : e.code === 'ArrowDown' || e.code === 'ArrowLeft' ? props.step * -1 : 0;\n\n const arr: ModelType = [...props.modelValue];\n arr[index] = clamp(arr[index] + nextStep, props.min, props.max);\n setModelValue(arr);\n getHint();\n}\n\nonMounted(() => {\n getHint();\n});\n</script>\n\n<template>\n <div :class=\"props.disabled ? 'ui-slider__disabled' : undefined\" class=\"ui-slider__envelope ui-slider__triple\">\n <div :class=\"`ui-slider__mode-${props.mode}`\" class=\"ui-slider\">\n <div class=\"ui-slider__wrapper\">\n <div class=\"ui-slider__label-section\">\n <label v-if=\"label\" class=\"text-s\">\n <span>{{ label }}</span>\n <PlTooltip v-if=\"slots.tooltip\" class=\"info\" position=\"top\">\n <template #tooltip>\n <slot name=\"tooltip\" />\n </template>\n </PlTooltip>\n </label>\n </div>\n <div class=\"ui-slider__base\">\n <div class=\"ui-slider__container\">\n <div ref=\"barRef\" class=\"ui-slider__bar\">\n <div class=\"ui-slider__progress\" :style=\"progressStyle\" />\n </div>\n </div>\n <div class=\"ui-slider__container ui-slider__container-thumb\">\n <template v-if=\"props.breakpoints\">\n <div v-for=\"(item, index) in breakpointsRef\" :key=\"index\" :style=\"{ right: `${item}%` }\" class=\"ui-slider__thumb-step\"/>\n </template>\n <div\n ref=\"thumbRef1\"\n :style=\"thumbStyle1\"\n :data-percent=\"props.modelValue[0] + '%'\"\n class=\"ui-slider__thumb ui-slider__triple-thumb\"\n r1\n tabindex=\"0\"\n @keydown=\"handleKeyPress($event, 0)\"\n >\n <div class=\"ui-slider__thumb-focused-contour\" />\n </div>\n <div\n ref=\"thumbRef2\"\n :style=\"thumbStyle2\"\n :data-percent=\"props.modelValue[1] + '%'\"\n class=\"ui-slider__thumb ui-slider__triple-thumb\"\n r2\n tabindex=\"0\"\n @keydown=\"handleKeyPress($event, 1)\"\n >\n <div class=\"ui-slider__thumb-focused-contour\" />\n </div>\n <div\n ref=\"thumbRef3\"\n :style=\"thumbStyle3\"\n :data-percent=\"props.modelValue[2] + '%'\"\n class=\"ui-slider__thumb ui-slider__triple-thumb\"\n r3\n tabindex=\"0\"\n @keydown=\"handleKeyPress($event, 2)\"\n >\n <div class=\"ui-slider__thumb-focused-contour\" />\n </div>\n </div>\n </div>\n </div>\n\n <div class=\"ui-slider__input-wrapper d-flex\">\n <!-- {{ props.modelValue }} -->\n <!-- <InputRange v-if=\"props.mode === 'input'\" v-model=\"inputRange\" class=\"ui-focused-border\" /> -->\n </div>\n </div>\n <!-- <div v-if=\"helper\" class=\"ui-slider__helper\">\n {{ helper }}\n </div> -->\n <div v-if=\"error\" class=\"ui-slider__error\">\n {{ error }}\n </div>\n </div>\n</template>\n\n<style></style>\n"],"names":["slots","useSlots","emit","__emit","props","__props","data","reactive","barRef","ref","thumbRef1","thumbRef2","thumbRef3","range","computed","propsRef","breakpointsRef","useSliderBreakpoints","localValue1","clamp","localValue2","localValue3","error","v","it","errors","getErrorMessage","position1","position2","position3","leftRight","getLeftAndRight","progressStyle","thumbStyle1","thumbStyle2","thumbStyle3","useMouseCapture","ev","tapIf","_a","unref","rect","dx","updateDatasetForThumb","setModelValue","round","thumb","modelVal","delta","value","getHint","point1","point2","point3","b","right1","right2","right3","arr","a","handleKeyPress","e","index","nextStep","onMounted"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAWA,UAAMA,IAAQC,EAAA,GAERC,IAAOC,GAEPC,IAAQC,GA2BRC,IAAOC,EAAS;AAAA,MACpB,aAAa;AAAA,MACb,aAAa;AAAA,MACb,aAAa;AAAA,IAAA,CACd,GAEKC,IAASC,EAAA,GACTC,IAAYD,EAAA,GACZE,IAAYF,EAAA,GACZG,IAAYH,EAAA,GAEZI,IAAQC,EAAS,MAAMV,EAAM,MAAMA,EAAM,GAAG,GAE5CW,IAAWD,EAAS,MAAMV,CAAK,GAE/BY,IAAiBC,GAAqBF,CAAQ,GAE9CG,IAAcJ,EAAS,MAAMK,GAAOf,EAAM,WAAW,CAAC,KAAK,KAAKE,EAAK,aAAaF,EAAM,KAAKA,EAAM,GAAG,CAAC,GACvGgB,IAAcN,EAAS,MAAMK,GAAOf,EAAM,WAAW,CAAC,KAAK,KAAKE,EAAK,aAAaF,EAAM,KAAKA,EAAM,GAAG,CAAC,GACvGiB,IAAcP,EAAS,MAAMK,GAAOf,EAAM,WAAW,CAAC,KAAK,KAAKE,EAAK,aAAaF,EAAM,KAAKA,EAAM,GAAG,CAAC,GAEvGkB,IAAQR,EAAS,MAAM;AAC3B,YAAMS,IAAInB,EAAM;AAIhB,UAAI,EAFiB,MAAM,QAAQmB,CAAC,KAAKA,EAAE,WAAW,KAAKA,EAAE,MAAM,CAACC,MAAO,OAAO,SAASA,CAAE,CAAC;AAG5F,eAAO;AAGT,YAAMC,IAAmB,CAAA;AAWzB,aATA,CAAC,GAAGrB,EAAM,UAAU,EAAE,QAAQ,CAACmB,MAAM;AACnC,QAAIA,IAAInB,EAAM,OACZqB,EAAO,KAAK,gDAAgDrB,EAAM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O,SAE7BA,EAAI,CAAC,EAAE,GAAG,UACZA,EAAI,CAAC,EAAE,GAAG,MAAM,QAAQ,OAAO,QAG7BA,EAAI,CAAC,EAAE,GAAG,UACZA,EAAI,CAAC,EAAE,GAAG,MAAM,QAAQ,OAAO;AAAA,IAEnC;AAEA,aAASE,EAAeC,GAA6CC,GAAe;AAClF,MAAI,CAAC,aAAa,WAAW,cAAc,aAAa,OAAO,EAAE,SAASD,EAAE,IAAI,KAC9EA,EAAE,eAAA;AAGJ,YAAME,IACFF,EAAE,SAAS,aAAaA,EAAE,SAAS,eAAezD,EAAM,OAAO,IAAIyD,EAAE,SAAS,eAAeA,EAAE,SAAS,cAAczD,EAAM,OAAO,KAAK,GAEtIsD,IAAiB,CAAC,GAAGtD,EAAM,UAAU;AAC3C,MAAAsD,EAAII,CAAK,IAAI3C,EAAMuC,EAAII,CAAK,IAAIC,GAAU3D,EAAM,KAAKA,EAAM,GAAG,GAC9DwC,EAAcc,CAAG,GACjBR,EAAA;AAAA,IACF;AAEA,WAAAc,EAAU,MAAM;AACd,MAAAd,EAAA;AAAA,IACF,CAAC;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;"}
|
|
1
|
+
{"version":3,"file":"SliderRangeTriple.vue.js","sources":["../../src/components/SliderRangeTriple.vue"],"sourcesContent":["<script lang=\"ts\" setup>\nimport { computed, onMounted, reactive, ref, unref, useSlots } from 'vue';\nimport { useMouseCapture } from '../composition/useMouseCapture';\nimport { tapIf } from '../helpers/functions';\nimport { clamp } from '../helpers/math';\nimport { PlTooltip } from './PlTooltip';\nimport type { SliderMode } from '../types';\nimport { useSliderBreakpoints } from '../composition/useSliderBreakpoints';\nimport { getErrorMessage } from '../helpers/error.ts';\n\ntype ModelType = [number, number, number];\nconst slots = useSlots();\n\nconst emit = defineEmits(['update:modelValue']);\n\nconst props = withDefaults(\n defineProps<{\n modelValue: ModelType;\n min?: number;\n max: number;\n step?: number;\n label?: string;\n helper?: string;\n error?: unknown;\n mode?: SliderMode;\n measure?: string;\n breakpoints?: boolean;\n disabled?: boolean;\n }>(),\n {\n label: undefined,\n helper: undefined,\n error: undefined,\n min: 0,\n step: 1,\n mode: 'text',\n measure: '%',\n breakpoints: false,\n disabled: false,\n },\n);\n\nconst data = reactive({\n deltaValue1: 0,\n deltaValue2: 0,\n deltaValue3: 0,\n});\n\nconst barRef = ref<HTMLElement>();\nconst thumbRef1 = ref<HTMLElement>();\nconst thumbRef2 = ref<HTMLElement>();\nconst thumbRef3 = ref<HTMLElement>();\n\nconst range = computed(() => props.max - props.min);\n\nconst propsRef = computed(() => props);\n\nconst breakpointsRef = useSliderBreakpoints(propsRef);\n\nconst localValue1 = computed(() => clamp((props.modelValue[0] ?? 0) + data.deltaValue1, props.min, props.max));\nconst localValue2 = computed(() => clamp((props.modelValue[1] ?? 0) + data.deltaValue2, props.min, props.max));\nconst localValue3 = computed(() => clamp((props.modelValue[2] ?? 0) + data.deltaValue3, props.min, props.max));\n\nconst error = computed(() => {\n const v = props.modelValue as unknown;\n\n const isValidModel = Array.isArray(v) && v.length === 3 && v.every((it) => Number.isFinite(it));\n\n if (!isValidModel) {\n return 'Expected model [number, number, number]';\n }\n\n const errors: string[] = [];\n\n [...props.modelValue].forEach((v) => {\n if (v > props.max) {\n errors.push(`Max model value must be lower than max props ${props.max}.`);\n }\n if (v < props.min) {\n errors.push('Min model value must be greater than max props.');\n }\n });\n\n if (errors.length > 0) {\n return errors.join(' ');\n }\n\n return getErrorMessage(props.error);\n});\n\nconst position1 = computed(() => {\n return (localValue1.value - props.min) / range.value;\n});\n\nconst position2 = computed(() => {\n return (localValue2.value - props.min) / range.value;\n});\n\nconst position3 = computed(() => {\n return (localValue3.value - props.min) / range.value;\n});\n\nconst leftRight = computed(() => getLeftAndRight());\n\nconst progressStyle = computed(() => ({\n right: leftRight.value[0] + '%',\n left: 100 - leftRight.value[2] + '%',\n}));\n\nconst thumbStyle1 = computed(() => ({\n right: Math.ceil((1 - position1.value) * 100) + '%',\n}));\n\nconst thumbStyle2 = computed(() => ({\n right: Math.ceil((1 - position2.value) * 100) + '%',\n}));\n\nconst thumbStyle3 = computed(() => ({\n right: Math.ceil((1 - position3.value) * 100) + '%',\n}));\n\nuseMouseCapture(thumbRef1, (ev) => {\n tapIf(unref(barRef)?.getBoundingClientRect(), (rect) => {\n const { dx } = ev;\n data.deltaValue1 = (dx / rect.width) * range.value;\n\n if (thumbRef1.value) {\n updateDatasetForThumb(thumbRef1.value, props.modelValue[0], data.deltaValue1);\n }\n\n if (ev.stop) {\n setModelValue([round(localValue1.value), round(localValue2.value), round(localValue3.value)]);\n data.deltaValue1 = 0;\n }\n });\n});\n\nuseMouseCapture(thumbRef2, (ev) => {\n tapIf(unref(barRef)?.getBoundingClientRect(), (rect) => {\n const { dx } = ev;\n data.deltaValue2 = (dx / rect.width) * range.value;\n\n if (thumbRef2.value) {\n updateDatasetForThumb(thumbRef2.value, props.modelValue[1], data.deltaValue2);\n }\n\n if (ev.stop) {\n setModelValue([round(localValue1.value), round(localValue2.value), round(localValue3.value)]);\n data.deltaValue2 = 0;\n }\n });\n});\n\nuseMouseCapture(thumbRef3, (ev) => {\n tapIf(unref(barRef)?.getBoundingClientRect(), (rect) => {\n const { dx } = ev;\n data.deltaValue3 = (dx / rect.width) * range.value;\n\n if (thumbRef3.value) {\n updateDatasetForThumb(thumbRef3.value, props.modelValue[2], data.deltaValue3);\n }\n\n if (ev.stop) {\n setModelValue([round(localValue1.value), round(localValue2.value), round(localValue3.value)]);\n data.deltaValue3 = 0;\n }\n });\n});\n\nfunction updateDatasetForThumb(thumb: HTMLElement, modelVal: number, delta: number) {\n const value = round(clamp((modelVal ?? 0) + delta, props.min, props.max));\n thumb.dataset.percent = `${value}${props.measure}`;\n getHint();\n}\n\nfunction getLeftAndRight() {\n const point1 = Math.ceil((1 - position1.value) * 100);\n const point2 = Math.ceil((1 - position2.value) * 100);\n const point3 = Math.ceil((1 - position3.value) * 100);\n return [point1, point2, point3].sort((a, b) => a - b);\n}\n\nfunction round(value: number) {\n const v = clamp(value, props.min, props.max);\n // This is the same as Math.round(v / props.step) * props.step but here we need this magic to avoid numbers like 3.00000000000000000004\n return Math.round((v + Number.EPSILON) * (1 / props.step)) / (1 / props.step);\n}\n\nfunction setModelValue(value: ModelType) {\n emit('update:modelValue', value);\n}\n\nfunction getHint() {\n const right1 = Number(thumbStyle1.value.right.substring(0, thumbStyle1.value.right.length - 1));\n const right2 = Number(thumbStyle2.value.right.substring(0, thumbStyle2.value.right.length - 1));\n const right3 = Number(thumbStyle3.value.right.substring(0, thumbStyle3.value.right.length - 1));\n\n const arr = [\n { r: right1, th: thumbRef1 },\n { r: right2, th: thumbRef2 },\n { r: right3, th: thumbRef3 },\n ].sort((a, b) => a.r - b.r);\n\n if (arr[0].th.value) {\n arr[0].th.value.dataset.hint = 'high';\n }\n if (arr[1].th.value) {\n arr[1].th.value.dataset.hint = 'mid';\n }\n\n if (arr[2].th.value) {\n arr[2].th.value.dataset.hint = 'low';\n }\n}\n\nfunction handleKeyPress(e: { code: string; preventDefault(): void }, index: number) {\n if (['ArrowDown', 'ArrowUp', 'ArrowRight', 'ArrowLeft', 'Enter'].includes(e.code)) {\n e.preventDefault();\n }\n\n const nextStep\n = e.code === 'ArrowUp' || e.code === 'ArrowRight' ? props.step * 1 : e.code === 'ArrowDown' || e.code === 'ArrowLeft' ? props.step * -1 : 0;\n\n const arr: ModelType = [...props.modelValue];\n arr[index] = clamp(arr[index] + nextStep, props.min, props.max);\n setModelValue(arr);\n getHint();\n}\n\nonMounted(() => {\n getHint();\n});\n</script>\n\n<template>\n <div :class=\"props.disabled ? 'ui-slider__disabled' : undefined\" class=\"ui-slider__envelope ui-slider__triple\">\n <div :class=\"`ui-slider__mode-${props.mode}`\" class=\"ui-slider\">\n <div class=\"ui-slider__wrapper\">\n <div class=\"ui-slider__label-section\">\n <label v-if=\"label\" class=\"text-s\">\n <span>{{ label }}</span>\n <PlTooltip v-if=\"slots.tooltip\" class=\"info\" position=\"top\">\n <template #tooltip>\n <slot name=\"tooltip\" />\n </template>\n </PlTooltip>\n </label>\n </div>\n <div class=\"ui-slider__base\">\n <div class=\"ui-slider__container\">\n <div ref=\"barRef\" class=\"ui-slider__bar\">\n <div class=\"ui-slider__progress\" :style=\"progressStyle\" />\n </div>\n </div>\n <div class=\"ui-slider__container ui-slider__container-thumb\">\n <template v-if=\"props.breakpoints\">\n <div v-for=\"(item, index) in breakpointsRef\" :key=\"index\" :style=\"{ right: `${item}%` }\" class=\"ui-slider__thumb-step\"/>\n </template>\n <div\n ref=\"thumbRef1\"\n :style=\"thumbStyle1\"\n :data-percent=\"props.modelValue[0] + '%'\"\n class=\"ui-slider__thumb ui-slider__triple-thumb\"\n r1\n tabindex=\"0\"\n @keydown=\"handleKeyPress($event, 0)\"\n >\n <div class=\"ui-slider__thumb-focused-contour\" />\n </div>\n <div\n ref=\"thumbRef2\"\n :style=\"thumbStyle2\"\n :data-percent=\"props.modelValue[1] + '%'\"\n class=\"ui-slider__thumb ui-slider__triple-thumb\"\n r2\n tabindex=\"0\"\n @keydown=\"handleKeyPress($event, 1)\"\n >\n <div class=\"ui-slider__thumb-focused-contour\" />\n </div>\n <div\n ref=\"thumbRef3\"\n :style=\"thumbStyle3\"\n :data-percent=\"props.modelValue[2] + '%'\"\n class=\"ui-slider__thumb ui-slider__triple-thumb\"\n r3\n tabindex=\"0\"\n @keydown=\"handleKeyPress($event, 2)\"\n >\n <div class=\"ui-slider__thumb-focused-contour\" />\n </div>\n </div>\n </div>\n </div>\n\n <div class=\"ui-slider__input-wrapper d-flex\">\n <!-- {{ props.modelValue }} -->\n <!-- <InputRange v-if=\"props.mode === 'input'\" v-model=\"inputRange\" class=\"ui-focused-border\" /> -->\n </div>\n </div>\n <!-- <div v-if=\"helper\" class=\"ui-slider__helper\">\n {{ helper }}\n </div> -->\n <div v-if=\"error\" class=\"ui-slider__error\">\n {{ error }}\n </div>\n </div>\n</template>\n\n<style></style>\n"],"names":["slots","useSlots","emit","__emit","props","__props","data","reactive","barRef","ref","thumbRef1","thumbRef2","thumbRef3","range","computed","propsRef","breakpointsRef","useSliderBreakpoints","localValue1","clamp","localValue2","localValue3","error","v","it","errors","getErrorMessage","position1","position2","position3","leftRight","getLeftAndRight","progressStyle","thumbStyle1","thumbStyle2","thumbStyle3","useMouseCapture","ev","tapIf","_a","unref","rect","dx","updateDatasetForThumb","setModelValue","round","thumb","modelVal","delta","value","getHint","point1","point2","point3","b","right1","right2","right3","arr","a","handleKeyPress","e","index","nextStep","onMounted","_createElementBlock","_createElementVNode","_normalizeClass","_hoisted_1","_hoisted_2","_openBlock","_hoisted_3","_unref","_createBlock","PlTooltip","_renderSlot","_ctx","_hoisted_4","_hoisted_5","_hoisted_6","_Fragment","_renderList","item","_cache","$event","_hoisted_10","_toDisplayString"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAWA,UAAMA,IAAQC,EAAA,GAERC,IAAOC,GAEPC,IAAQC,GA2BRC,IAAOC,EAAS;AAAA,MACpB,aAAa;AAAA,MACb,aAAa;AAAA,MACb,aAAa;AAAA,IAAA,CACd,GAEKC,IAASC,EAAA,GACTC,IAAYD,EAAA,GACZE,IAAYF,EAAA,GACZG,IAAYH,EAAA,GAEZI,IAAQC,EAAS,MAAMV,EAAM,MAAMA,EAAM,GAAG,GAE5CW,IAAWD,EAAS,MAAMV,CAAK,GAE/BY,IAAiBC,GAAqBF,CAAQ,GAE9CG,IAAcJ,EAAS,MAAMK,GAAOf,EAAM,WAAW,CAAC,KAAK,KAAKE,EAAK,aAAaF,EAAM,KAAKA,EAAM,GAAG,CAAC,GACvGgB,IAAcN,EAAS,MAAMK,GAAOf,EAAM,WAAW,CAAC,KAAK,KAAKE,EAAK,aAAaF,EAAM,KAAKA,EAAM,GAAG,CAAC,GACvGiB,IAAcP,EAAS,MAAMK,GAAOf,EAAM,WAAW,CAAC,KAAK,KAAKE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AAA;AAAA,cAAA;gBAE/BlB,EAAgD,OAAA,EAA3C,OAAM,mCAAA,GAAkC,MAAA,EAAA;AAAA,cAAA;cAE/CA,EAUM,OAAA;AAAA,yBATA;AAAA,gBAAJ,KAAIvD;AAAA,gBACH,SAAOuB,EAAA,KAAW;AAAA,gBAClB,gBAAc9B,EAAM,WAAU,CAAA,IAAA;AAAA,gBAC/B,OAAM;AAAA,gBACN,IAAA;AAAA,gBACA,UAAS;AAAA,gBACR,WAAO+E,EAAA,CAAA,MAAAA,EAAA,CAAA,IAAA,CAAAC,MAAExB,EAAewB,GAAM,CAAA;AAAA,cAAA;gBAE/BlB,EAAgD,OAAA,EAA3C,OAAM,mCAAA,GAAkC,MAAA,EAAA;AAAA,cAAA;cAE/CA,EAUM,OAAA;AAAA,yBATA;AAAA,gBAAJ,KAAItD;AAAA,gBACH,SAAOuB,EAAA,KAAW;AAAA,gBAClB,gBAAc/B,EAAM,WAAU,CAAA,IAAA;AAAA,gBAC/B,OAAM;AAAA,gBACN,IAAA;AAAA,gBACA,UAAS;AAAA,gBACR,WAAO+E,EAAA,CAAA,MAAAA,EAAA,CAAA,IAAA,CAAAC,MAAExB,EAAewB,GAAM,CAAA;AAAA,cAAA;gBAE/BlB,EAAgD,OAAA,EAA3C,OAAM,mCAAA,GAAkC,MAAA,EAAA;AAAA,cAAA;;;;wBAMrDA,EAGM,OAAA,EAHD,OAAM,qCAAiC,MAAA,EAAA;AAAA,MAAA;MAQnC5C,EAAA,cAAX2C,EAEM,OAFNoB,IAEMC,EADDhE,EAAA,KAAK,GAAA,CAAA;;;;"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"TabItem.vue.js","sources":["../../src/components/TabItem.vue"],"sourcesContent":["<script setup lang=\"ts\">\nimport { computed } from 'vue';\nimport type { ListOptionNormalized } from '../types';\n\nconst props = withDefaults(\n defineProps<{\n option: ListOptionNormalized;\n isSelected: boolean;\n isHovered: boolean;\n }>(),\n {\n isSelected: false,\n isHovered: false,\n },\n);\n\nconst label = computed(() => props.option.label);\n\nconst classes = computed<string>(() => {\n const classList: string[] = [];\n if (props.isSelected) {\n classList.push('dropdown-tab-item__selected');\n }\n if (props.isHovered) {\n classList.push('hovered-item');\n }\n return classList.join(' ');\n});\n</script>\n<template>\n <div :class=\"classes\" class=\"dropdown-tab-item\">\n <div class=\"dropdown-tab-item__title text-caps13\">\n {{ label }}\n </div>\n </div>\n</template>\n"],"names":["props","__props","label","computed","classes","classList"],"mappings":";;;;;;;;;AAIA,UAAMA,IAAQC,GAYRC,IAAQC,EAAS,MAAMH,EAAM,OAAO,KAAK,GAEzCI,IAAUD,EAAiB,MAAM;AACrC,YAAME,IAAsB,CAAA;AAC5B,aAAIL,EAAM,cACRK,EAAU,KAAK,6BAA6B,GAE1CL,EAAM,aACRK,EAAU,KAAK,cAAc,GAExBA,EAAU,KAAK,GAAG;AAAA,IAC3B,CAAC
|
|
1
|
+
{"version":3,"file":"TabItem.vue.js","sources":["../../src/components/TabItem.vue"],"sourcesContent":["<script setup lang=\"ts\">\nimport { computed } from 'vue';\nimport type { ListOptionNormalized } from '../types';\n\nconst props = withDefaults(\n defineProps<{\n option: ListOptionNormalized;\n isSelected: boolean;\n isHovered: boolean;\n }>(),\n {\n isSelected: false,\n isHovered: false,\n },\n);\n\nconst label = computed(() => props.option.label);\n\nconst classes = computed<string>(() => {\n const classList: string[] = [];\n if (props.isSelected) {\n classList.push('dropdown-tab-item__selected');\n }\n if (props.isHovered) {\n classList.push('hovered-item');\n }\n return classList.join(' ');\n});\n</script>\n<template>\n <div :class=\"classes\" class=\"dropdown-tab-item\">\n <div class=\"dropdown-tab-item__title text-caps13\">\n {{ label }}\n </div>\n </div>\n</template>\n"],"names":["props","__props","label","computed","classes","classList","_createElementBlock","_normalizeClass","_createElementVNode","_hoisted_1","_toDisplayString"],"mappings":";;;;;;;;;AAIA,UAAMA,IAAQC,GAYRC,IAAQC,EAAS,MAAMH,EAAM,OAAO,KAAK,GAEzCI,IAAUD,EAAiB,MAAM;AACrC,YAAME,IAAsB,CAAA;AAC5B,aAAIL,EAAM,cACRK,EAAU,KAAK,6BAA6B,GAE1CL,EAAM,aACRK,EAAU,KAAK,cAAc,GAExBA,EAAU,KAAK,GAAG;AAAA,IAC3B,CAAC;2BAGCC,EAIM,OAAA;AAAA,MAJA,OAAKC,EAAA,CAAEH,EAAA,OAAe,mBAAmB,CAAA;AAAA,IAAA;MAC7CI,EAEM,OAFNC,GAEMC,EADDR,EAAA,KAAK,GAAA,CAAA;AAAA,IAAA;;;"}
|
|
@@ -8,9 +8,9 @@ const h = /* @__PURE__ */ m({
|
|
|
8
8
|
class: i(["ui-theme-switcher", t(o)]),
|
|
9
9
|
onClick: e[0] || (e[0] = //@ts-ignore
|
|
10
10
|
(...r) => t(n) && t(n)(...r))
|
|
11
|
-
}, e[1] || (e[1] = [
|
|
11
|
+
}, [...e[1] || (e[1] = [
|
|
12
12
|
u("div", null, null, -1)
|
|
13
|
-
]), 2));
|
|
13
|
+
])], 2));
|
|
14
14
|
}
|
|
15
15
|
});
|
|
16
16
|
export {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"ThemeSwitcher.vue.js","sources":["../../src/components/ThemeSwitcher.vue"],"sourcesContent":["<script lang=\"ts\" setup>\nimport { useTheme } from '../composition/useTheme';\nconst [theme, toggleTheme] = useTheme();\n</script>\n\n<template>\n <div class=\"ui-theme-switcher\" :class=\"theme\" @click=\"toggleTheme\">\n <div />\n </div>\n</template>\n"],"names":["theme","toggleTheme","useTheme"],"mappings":";;;;;AAEA,UAAM,CAACA,GAAOC,CAAW,IAAIC,EAAA
|
|
1
|
+
{"version":3,"file":"ThemeSwitcher.vue.js","sources":["../../src/components/ThemeSwitcher.vue"],"sourcesContent":["<script lang=\"ts\" setup>\nimport { useTheme } from '../composition/useTheme';\nconst [theme, toggleTheme] = useTheme();\n</script>\n\n<template>\n <div class=\"ui-theme-switcher\" :class=\"theme\" @click=\"toggleTheme\">\n <div />\n </div>\n</template>\n"],"names":["theme","toggleTheme","useTheme","_createElementBlock","_normalizeClass","_unref","_cache","args","_createElementVNode"],"mappings":";;;;;AAEA,UAAM,CAACA,GAAOC,CAAW,IAAIC,EAAA;2BAI3BC,EAEM,OAAA;AAAA,MAFD,OAAKC,EAAA,CAAC,qBAA4BC,EAAAL,CAAA,CAAK,CAAA;AAAA,MAAG,SAAKM,EAAA,CAAA,MAAAA,EAAA,CAAA;AAAA,gBAAED,EAAAJ,CAAA,KAAAI,EAAAJ,CAAA,EAAA,GAAAM,CAAA;AAAA,IAAA;MACpDC,EAAO,OAAA,MAAA,MAAA,EAAA;AAAA,IAAA;;;"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"TransitionSlidePanel.vue.js","sources":["../../src/components/TransitionSlidePanel.vue"],"sourcesContent":["<script lang=\"ts\" setup>\nfunction onAfterEnter() {\n window.dispatchEvent(new CustomEvent('adjust'));\n}\n\nfunction onAfterLeave() {\n window.dispatchEvent(new CustomEvent('adjust'));\n}\n</script>\n\n<template>\n <Transition name=\"slide-panel\" @after-enter=\"onAfterEnter\" @after-leave=\"onAfterLeave\">\n <slot />\n </Transition>\n</template>\n"],"names":["onAfterEnter","onAfterLeave"],"mappings":";;;;AACA,aAASA,IAAe;AACtB,aAAO,cAAc,IAAI,YAAY,QAAQ,CAAC;AAAA,IAChD;AAEA,aAASC,IAAe;AACtB,aAAO,cAAc,IAAI,YAAY,QAAQ,CAAC;AAAA,IAChD
|
|
1
|
+
{"version":3,"file":"TransitionSlidePanel.vue.js","sources":["../../src/components/TransitionSlidePanel.vue"],"sourcesContent":["<script lang=\"ts\" setup>\nfunction onAfterEnter() {\n window.dispatchEvent(new CustomEvent('adjust'));\n}\n\nfunction onAfterLeave() {\n window.dispatchEvent(new CustomEvent('adjust'));\n}\n</script>\n\n<template>\n <Transition name=\"slide-panel\" @after-enter=\"onAfterEnter\" @after-leave=\"onAfterLeave\">\n <slot />\n </Transition>\n</template>\n"],"names":["onAfterEnter","onAfterLeave","_createBlock","_Transition","_renderSlot","_ctx"],"mappings":";;;;AACA,aAASA,IAAe;AACtB,aAAO,cAAc,IAAI,YAAY,QAAQ,CAAC;AAAA,IAChD;AAEA,aAASC,IAAe;AACtB,aAAO,cAAc,IAAI,YAAY,QAAQ,CAAC;AAAA,IAChD;2BAIEC,EAEaC,GAAA;AAAA,MAFD,MAAK;AAAA,MAAe,cAAAH;AAAA,MAA4B,cAAAC;AAAA,IAAA;iBAC1D,MAAQ;AAAA,QAARG,EAAQC,EAAA,QAAA,SAAA;AAAA,MAAA;;;;;"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"VScroll.vue.js","sources":["../../src/components/VScroll.vue"],"sourcesContent":["<script lang=\"ts\" setup>\nimport { computed, ref, unref } from 'vue';\nimport { useEventListener } from '../composition/useEventListener';\nimport { eventListener } from '../helpers/dom';\n\nconst emit = defineEmits(['update:scrollTop']);\n\nconst props = defineProps<{\n scrollTop: number;\n clientHeight: number;\n scrollHeight: number;\n}>();\n\nconst scrollRef = ref<EventTarget>();\n\nconst ratioRef = computed(() => props.clientHeight / (props.scrollHeight || 1));\n\nconst visibleRef = computed(() => {\n return ratioRef.value < 1;\n});\n\nconst scrollbarStyle = computed(() => {\n const ratio = unref(ratioRef);\n return {\n top: props.scrollTop * ratio + 'px',\n height: Math.floor(props.clientHeight * ratio) + 'px',\n };\n});\n\nuseEventListener(scrollRef, 'pointerdown', (down: PointerEvent) => {\n const s = {\n clientY: down.clientY,\n };\n\n const update = (e: MouseEvent) => {\n const dy = (e.clientY - s.clientY) / ratioRef.value;\n emit('update:scrollTop', props.scrollTop + dy);\n s.clientY = e.clientY;\n };\n\n // eslint-disable-next-line @typescript-eslint/no-explicit-any\n const removePointerMove = eventListener(document as any, 'mousemove', update);\n\n ['mouseup', 'pointercancel'].forEach((eventType) => {\n document.addEventListener(eventType, removePointerMove, { once: true });\n });\n});\n</script>\n\n<template>\n <div v-if=\"visibleRef\" ref=\"scrollRef\" class=\"v-scroll\">\n <div class=\"v-scroll__scrollbar\" :style=\"scrollbarStyle\" />\n </div>\n</template>\n"],"names":["emit","__emit","props","__props","scrollRef","ref","ratioRef","computed","visibleRef","scrollbarStyle","ratio","unref","useEventListener","down","s","removePointerMove","eventListener","e","dy","eventType"],"mappings":";;;;;;;;;;;;AAKA,UAAMA,IAAOC,GAEPC,IAAQC,GAMRC,IAAYC,EAAA,GAEZC,IAAWC,EAAS,MAAML,EAAM,gBAAgBA,EAAM,gBAAgB,EAAE,GAExEM,IAAaD,EAAS,MACnBD,EAAS,QAAQ,CACzB,GAEKG,IAAiBF,EAAS,MAAM;AACpC,YAAMG,IAAQC,EAAML,CAAQ;AAC5B,aAAO;AAAA,QACL,KAAKJ,EAAM,YAAYQ,IAAQ;AAAA,QAC/B,QAAQ,KAAK,MAAMR,EAAM,eAAeQ,CAAK,IAAI;AAAA,MAAA;AAAA,IAErD,CAAC;AAED,WAAAE,EAAiBR,GAAW,eAAe,CAACS,MAAuB;AACjE,YAAMC,IAAI;AAAA,QACR,SAASD,EAAK;AAAA,MAAA,GAUVE,IAAoBC,EAAc,UAAiB,aAP1C,CAACC,MAAkB;AAChC,cAAMC,KAAMD,EAAE,UAAUH,EAAE,WAAWR,EAAS;AAC9C,QAAAN,EAAK,oBAAoBE,EAAM,YAAYgB,CAAE,GAC7CJ,EAAE,UAAUG,EAAE;AAAA,MAChB,CAG4E;AAE5E,OAAC,WAAW,eAAe,EAAE,QAAQ,CAACE,MAAc;AAClD,iBAAS,iBAAiBA,GAAWJ,GAAmB,EAAE,MAAM,IAAM;AAAA,MACxE,CAAC;AAAA,IACH,CAAC
|
|
1
|
+
{"version":3,"file":"VScroll.vue.js","sources":["../../src/components/VScroll.vue"],"sourcesContent":["<script lang=\"ts\" setup>\nimport { computed, ref, unref } from 'vue';\nimport { useEventListener } from '../composition/useEventListener';\nimport { eventListener } from '../helpers/dom';\n\nconst emit = defineEmits(['update:scrollTop']);\n\nconst props = defineProps<{\n scrollTop: number;\n clientHeight: number;\n scrollHeight: number;\n}>();\n\nconst scrollRef = ref<EventTarget>();\n\nconst ratioRef = computed(() => props.clientHeight / (props.scrollHeight || 1));\n\nconst visibleRef = computed(() => {\n return ratioRef.value < 1;\n});\n\nconst scrollbarStyle = computed(() => {\n const ratio = unref(ratioRef);\n return {\n top: props.scrollTop * ratio + 'px',\n height: Math.floor(props.clientHeight * ratio) + 'px',\n };\n});\n\nuseEventListener(scrollRef, 'pointerdown', (down: PointerEvent) => {\n const s = {\n clientY: down.clientY,\n };\n\n const update = (e: MouseEvent) => {\n const dy = (e.clientY - s.clientY) / ratioRef.value;\n emit('update:scrollTop', props.scrollTop + dy);\n s.clientY = e.clientY;\n };\n\n // eslint-disable-next-line @typescript-eslint/no-explicit-any\n const removePointerMove = eventListener(document as any, 'mousemove', update);\n\n ['mouseup', 'pointercancel'].forEach((eventType) => {\n document.addEventListener(eventType, removePointerMove, { once: true });\n });\n});\n</script>\n\n<template>\n <div v-if=\"visibleRef\" ref=\"scrollRef\" class=\"v-scroll\">\n <div class=\"v-scroll__scrollbar\" :style=\"scrollbarStyle\" />\n </div>\n</template>\n"],"names":["emit","__emit","props","__props","scrollRef","ref","ratioRef","computed","visibleRef","scrollbarStyle","ratio","unref","useEventListener","down","s","removePointerMove","eventListener","e","dy","eventType","_createElementBlock","_createElementVNode"],"mappings":";;;;;;;;;;;;AAKA,UAAMA,IAAOC,GAEPC,IAAQC,GAMRC,IAAYC,EAAA,GAEZC,IAAWC,EAAS,MAAML,EAAM,gBAAgBA,EAAM,gBAAgB,EAAE,GAExEM,IAAaD,EAAS,MACnBD,EAAS,QAAQ,CACzB,GAEKG,IAAiBF,EAAS,MAAM;AACpC,YAAMG,IAAQC,EAAML,CAAQ;AAC5B,aAAO;AAAA,QACL,KAAKJ,EAAM,YAAYQ,IAAQ;AAAA,QAC/B,QAAQ,KAAK,MAAMR,EAAM,eAAeQ,CAAK,IAAI;AAAA,MAAA;AAAA,IAErD,CAAC;AAED,WAAAE,EAAiBR,GAAW,eAAe,CAACS,MAAuB;AACjE,YAAMC,IAAI;AAAA,QACR,SAASD,EAAK;AAAA,MAAA,GAUVE,IAAoBC,EAAc,UAAiB,aAP1C,CAACC,MAAkB;AAChC,cAAMC,KAAMD,EAAE,UAAUH,EAAE,WAAWR,EAAS;AAC9C,QAAAN,EAAK,oBAAoBE,EAAM,YAAYgB,CAAE,GAC7CJ,EAAE,UAAUG,EAAE;AAAA,MAChB,CAG4E;AAE5E,OAAC,WAAW,eAAe,EAAE,QAAQ,CAACE,MAAc;AAClD,iBAAS,iBAAiBA,GAAWJ,GAAmB,EAAE,MAAM,IAAM;AAAA,MACxE,CAAC;AAAA,IACH,CAAC,aAIYP,EAAA,cAAXY,EAEM,OAAA;AAAA;eAFqB;AAAA,MAAJ,KAAIhB;AAAA,MAAY,OAAM;AAAA,IAAA;MAC3CiB,EAA2D,OAAA;AAAA,QAAtD,OAAM;AAAA,QAAuB,SAAOZ,EAAA,KAAc;AAAA,MAAA;;;;"}
|
|
@@ -1,25 +1,25 @@
|
|
|
1
|
-
import { defineComponent as
|
|
2
|
-
const
|
|
1
|
+
import { defineComponent as m, createElementBlock as e, openBlock as t, Fragment as p, renderList as a, withModifiers as u, createElementVNode as _, toDisplayString as d } from "vue";
|
|
2
|
+
const k = { class: "context-menu" }, f = ["onClick"], v = /* @__PURE__ */ m({
|
|
3
3
|
__name: "Menu",
|
|
4
4
|
props: {
|
|
5
5
|
options: {}
|
|
6
6
|
},
|
|
7
7
|
emits: ["close"],
|
|
8
|
-
setup(
|
|
9
|
-
const
|
|
10
|
-
|
|
8
|
+
setup(s, { emit: i }) {
|
|
9
|
+
const c = i, r = (n) => {
|
|
10
|
+
n.cb(), c("close");
|
|
11
11
|
};
|
|
12
|
-
return (
|
|
13
|
-
(
|
|
14
|
-
key:
|
|
15
|
-
onClick:
|
|
12
|
+
return (n, h) => (t(), e("div", k, [
|
|
13
|
+
(t(!0), e(p, null, a(s.options, (o, l) => (t(), e("div", {
|
|
14
|
+
key: l,
|
|
15
|
+
onClick: u((x) => r(o), ["stop"])
|
|
16
16
|
}, [
|
|
17
|
-
_("span", null,
|
|
18
|
-
], 8,
|
|
17
|
+
_("span", null, d(o.text), 1)
|
|
18
|
+
], 8, f))), 128))
|
|
19
19
|
]));
|
|
20
20
|
}
|
|
21
21
|
});
|
|
22
22
|
export {
|
|
23
|
-
|
|
23
|
+
v as default
|
|
24
24
|
};
|
|
25
25
|
//# sourceMappingURL=Menu.vue2.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Menu.vue2.js","sources":["../../../src/components/contextMenu/Menu.vue"],"sourcesContent":["<script lang=\"ts\" setup>\nimport type { ContextOption } from './types';\n\nconst emit = defineEmits(['close']);\n\ndefineProps<{\n options: readonly ContextOption[];\n}>();\n\nconst onClickOption = (opt: ContextOption) => {\n opt.cb();\n emit('close');\n};\n</script>\n\n<template>\n <div class=\"context-menu\">\n <div v-for=\"(opt, i) in options\" :key=\"i\" @click.stop=\"onClickOption(opt)\">\n <span>{{ opt.text }}</span>\n </div>\n </div>\n</template>\n\n<style lang=\"scss\" scoped>\n.context-menu {\n display: block;\n position: absolute;\n top: 50px;\n left: 50px;\n z-index: var(--z-context-menu);\n\n margin: 0;\n padding: 3px 0 4px;\n\n background: rgba(255, 255, 255, 0.95);\n box-shadow: 0px 8px 15px rgba(0, 0, 0, 0.35);\n border-radius: 4px;\n\n font-family:\n Lucida Grande,\n sans-serif;\n font-size: 14px;\n line-height: 15px;\n\n &::before {\n display: block;\n position: absolute;\n content: '';\n top: -1px;\n left: -1px;\n bottom: -1px;\n right: -1px;\n\n border-radius: 4px;\n border: 1px solid rgba(0, 0, 0, 0.125);\n z-index: -1;\n }\n\n hr {\n border: none;\n height: 1px;\n background: rgba(0, 0, 0, 0.1);\n margin: 6px 1px 5px;\n padding: 0;\n }\n\n > div {\n display: block;\n padding: 0 20px;\n border-top: 1px solid rgba(0, 0, 0, 0);\n border-bottom: 1px solid rgba(0, 0, 0, 0);\n\n span {\n vertical-align: 2px;\n user-select: none;\n }\n\n &:hover {\n background: -webkit-linear-gradient(top, #648bf5, #2866f2);\n background: linear-gradient(to bottom, #648bf5 0%, #2866f2 100%);\n border-top: 1px solid #5a82eb;\n border-bottom: 1px solid #1758e7;\n }\n\n &:hover::after {\n color: #fff;\n }\n }\n}\n</style>\n"],"names":["emit","__emit","onClickOption","opt"],"mappings":";;;;;;;;AAGA,UAAMA,IAAOC,GAMPC,IAAgB,CAACC,MAAuB;AAC5C,MAAAA,EAAI,GAAA,GACJH,EAAK,OAAO;AAAA,IACd
|
|
1
|
+
{"version":3,"file":"Menu.vue2.js","sources":["../../../src/components/contextMenu/Menu.vue"],"sourcesContent":["<script lang=\"ts\" setup>\nimport type { ContextOption } from './types';\n\nconst emit = defineEmits(['close']);\n\ndefineProps<{\n options: readonly ContextOption[];\n}>();\n\nconst onClickOption = (opt: ContextOption) => {\n opt.cb();\n emit('close');\n};\n</script>\n\n<template>\n <div class=\"context-menu\">\n <div v-for=\"(opt, i) in options\" :key=\"i\" @click.stop=\"onClickOption(opt)\">\n <span>{{ opt.text }}</span>\n </div>\n </div>\n</template>\n\n<style lang=\"scss\" scoped>\n.context-menu {\n display: block;\n position: absolute;\n top: 50px;\n left: 50px;\n z-index: var(--z-context-menu);\n\n margin: 0;\n padding: 3px 0 4px;\n\n background: rgba(255, 255, 255, 0.95);\n box-shadow: 0px 8px 15px rgba(0, 0, 0, 0.35);\n border-radius: 4px;\n\n font-family:\n Lucida Grande,\n sans-serif;\n font-size: 14px;\n line-height: 15px;\n\n &::before {\n display: block;\n position: absolute;\n content: '';\n top: -1px;\n left: -1px;\n bottom: -1px;\n right: -1px;\n\n border-radius: 4px;\n border: 1px solid rgba(0, 0, 0, 0.125);\n z-index: -1;\n }\n\n hr {\n border: none;\n height: 1px;\n background: rgba(0, 0, 0, 0.1);\n margin: 6px 1px 5px;\n padding: 0;\n }\n\n > div {\n display: block;\n padding: 0 20px;\n border-top: 1px solid rgba(0, 0, 0, 0);\n border-bottom: 1px solid rgba(0, 0, 0, 0);\n\n span {\n vertical-align: 2px;\n user-select: none;\n }\n\n &:hover {\n background: -webkit-linear-gradient(top, #648bf5, #2866f2);\n background: linear-gradient(to bottom, #648bf5 0%, #2866f2 100%);\n border-top: 1px solid #5a82eb;\n border-bottom: 1px solid #1758e7;\n }\n\n &:hover::after {\n color: #fff;\n }\n }\n}\n</style>\n"],"names":["emit","__emit","onClickOption","opt","_openBlock","_createElementBlock","_hoisted_1","_Fragment","_renderList","__props","i","_withModifiers","$event","_createElementVNode","_toDisplayString"],"mappings":";;;;;;;;AAGA,UAAMA,IAAOC,GAMPC,IAAgB,CAACC,MAAuB;AAC5C,MAAAA,EAAI,GAAA,GACJH,EAAK,OAAO;AAAA,IACd;sBAIEI,EAAA,GAAAC,EAIM,OAJNC,GAIM;AAAA,OAHJF,EAAA,EAAA,GAAAC,EAEME,GAAA,MAAAC,EAFkBC,EAAA,SAAO,CAAlBN,GAAKO,YAAlBL,EAEM,OAAA;AAAA,QAF4B,KAAKK;AAAA,QAAI,SAAKC,EAAA,CAAAC,MAAOV,EAAcC,CAAG,GAAA,CAAA,MAAA,CAAA;AAAA,MAAA;QACtEU,EAA2B,QAAA,MAAAC,EAAlBX,EAAI,IAAI,GAAA,CAAA;AAAA,MAAA;;;;"}
|