ep-craft 0.1.34 → 0.1.35
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/dist/components/carousel/EpCarousel.vue.d.ts +39 -0
- package/dist/components/carousel/EpCarousel.vue.js +227 -0
- package/dist/components/carousel/EpCarousel2.vue.js +4 -0
- package/dist/components/carousel/carousel.d.ts +86 -0
- package/dist/components/carousel/carousel.js +113 -0
- package/dist/components/carousel/constants.d.ts +32 -0
- package/dist/components/carousel/constants.js +5 -0
- package/dist/components/carousel/index.d.ts +28 -2
- package/dist/components/carousel/index.js +11 -4
- package/dist/components/carousel/instance.d.ts +8 -0
- package/dist/components/carousel/use-carousel.d.ts +41 -0
- package/dist/components/carousel/use-carousel.js +200 -0
- package/dist/components/carousel-item/EpCarouselItem.vue.d.ts +16 -0
- package/dist/components/carousel-item/EpCarouselItem.vue.js +74 -0
- package/dist/components/carousel-item/EpCarouselItem2.vue.js +4 -0
- package/dist/components/carousel-item/carousel-item.d.ts +22 -0
- package/dist/components/carousel-item/carousel-item.js +22 -0
- package/dist/components/carousel-item/index.d.ts +14 -2
- package/dist/components/carousel-item/index.js +9 -4
- package/dist/components/carousel-item/use-carousel-item.d.ts +14 -0
- package/dist/components/carousel-item/use-carousel-item.js +79 -0
- package/dist/components/cascader/EpCascader.vue.d.ts +232 -0
- package/dist/components/cascader/EpCascader.vue.js +757 -0
- package/dist/components/cascader/EpCascader2.vue.js +4 -0
- package/dist/components/cascader/cascader.d.ts +313 -0
- package/dist/components/cascader/cascader.js +210 -0
- package/dist/components/cascader/index.d.ts +17 -2
- package/dist/components/cascader/index.js +9 -3
- package/dist/components/cascader/instances.d.ts +2 -0
- package/dist/components/cascader-panel/EpCascaderMenu.vue.d.ts +32 -0
- package/dist/components/cascader-panel/EpCascaderMenu.vue.js +204 -0
- package/dist/components/cascader-panel/EpCascaderMenu2.vue.js +4 -0
- package/dist/components/cascader-panel/EpCascaderNode.vue.d.ts +11 -0
- package/dist/components/cascader-panel/EpCascaderNode.vue.js +134 -0
- package/dist/components/cascader-panel/EpCascaderNode2.vue.js +4 -0
- package/dist/components/cascader-panel/EpCascaderPanel.vue.d.ts +290 -0
- package/dist/components/cascader-panel/EpCascaderPanel.vue.js +266 -0
- package/dist/components/cascader-panel/EpCascaderPanel2.vue.js +4 -0
- package/dist/components/cascader-panel/config.d.ts +102 -0
- package/dist/components/cascader-panel/config.js +136 -0
- package/dist/components/cascader-panel/index.d.ts +17 -2
- package/dist/components/cascader-panel/index.js +21 -4
- package/dist/components/cascader-panel/instance.d.ts +4 -0
- package/dist/components/cascader-panel/node-content.d.ts +14 -0
- package/dist/components/cascader-panel/node-content.js +50 -0
- package/dist/components/cascader-panel/node.d.ts +50 -0
- package/dist/components/cascader-panel/node.js +75 -0
- package/dist/components/cascader-panel/store.d.ts +17 -0
- package/dist/components/cascader-panel/store.js +49 -0
- package/dist/components/cascader-panel/types.d.ts +64 -0
- package/dist/components/cascader-panel/types.js +4 -0
- package/dist/components/cascader-panel/utils.d.ts +4 -0
- package/dist/components/cascader-panel/utils.js +26 -0
- package/dist/components/checkbox/EpCheckbox.vue.d.ts +1 -1
- package/dist/components/checkbox-button/EpCheckboxButton.vue.d.ts +1 -1
- package/dist/components/checkbox-group/index.js +4 -3
- package/dist/components/collapse-transition/index.js +4 -3
- package/dist/components/color-picker/EpColorPicker.vue.d.ts +53 -0
- package/dist/components/color-picker/EpColorPicker.vue.js +318 -0
- package/dist/components/color-picker/EpColorPicker2.vue.js +4 -0
- package/dist/components/color-picker/color-picker.d.ts +240 -0
- package/dist/components/color-picker/color-picker.js +124 -0
- package/dist/components/color-picker/index.d.ts +16 -2
- package/dist/components/color-picker/index.js +11 -4
- package/dist/components/color-picker-panel/EpColorPickerPanel.vue.d.ts +413 -0
- package/dist/components/color-picker-panel/EpColorPickerPanel.vue.js +142 -0
- package/dist/components/color-picker-panel/EpColorPickerPanel2.vue.js +4 -0
- package/dist/components/color-picker-panel/color-picker-panel.d.ts +91 -0
- package/dist/components/color-picker-panel/color-picker-panel.js +71 -0
- package/dist/components/color-picker-panel/components/EpAlphaSlider.vue.d.ts +19 -0
- package/dist/components/color-picker-panel/components/EpAlphaSlider.vue.js +92 -0
- package/dist/components/color-picker-panel/components/EpAlphaSlider2.vue.js +4 -0
- package/dist/components/color-picker-panel/components/EpHueSlider.vue.d.ts +20 -0
- package/dist/components/color-picker-panel/components/EpHueSlider.vue.js +84 -0
- package/dist/components/color-picker-panel/components/EpHueSlider2.vue.js +4 -0
- package/dist/components/color-picker-panel/components/EpPredefine.vue.d.ts +3 -0
- package/dist/components/color-picker-panel/components/EpPredefine.vue.js +39 -0
- package/dist/components/color-picker-panel/components/EpPredefine2.vue.js +4 -0
- package/dist/components/color-picker-panel/components/EpSvPanel.vue.d.ts +8 -0
- package/dist/components/color-picker-panel/components/EpSvPanel.vue.js +67 -0
- package/dist/components/color-picker-panel/components/EpSvPanel2.vue.js +4 -0
- package/dist/components/color-picker-panel/composables/use-common-color.d.ts +11 -0
- package/dist/components/color-picker-panel/composables/use-common-color.js +23 -0
- package/dist/components/color-picker-panel/composables/use-predefine.d.ts +14 -0
- package/dist/components/color-picker-panel/composables/use-predefine.js +66 -0
- package/dist/components/color-picker-panel/composables/use-slider.d.ts +35 -0
- package/dist/components/color-picker-panel/composables/use-slider.js +152 -0
- package/dist/components/color-picker-panel/composables/use-sv-panel.d.ts +25 -0
- package/dist/components/color-picker-panel/composables/use-sv-panel.js +123 -0
- package/dist/components/color-picker-panel/index.d.ts +4 -0
- package/dist/components/color-picker-panel/props/predefine.d.ts +36 -0
- package/dist/components/color-picker-panel/props/slider.d.ts +39 -0
- package/dist/components/color-picker-panel/props/sv-panel.d.ts +22 -0
- package/dist/components/color-picker-panel/utils/color.d.ts +28 -0
- package/dist/components/color-picker-panel/utils/color.js +62 -0
- package/dist/components/color-picker-panel/utils/draggable.d.ts +6 -0
- package/dist/components/color-picker-panel/utils/draggable.js +23 -0
- package/dist/components/descriptions/EpDescriptions.vue.d.ts +20 -0
- package/dist/components/descriptions/EpDescriptions.vue.js +100 -0
- package/dist/components/descriptions/EpDescriptions2.vue.js +4 -0
- package/dist/components/descriptions/EpDescriptionsRow.vue.d.ts +5 -0
- package/dist/components/descriptions/EpDescriptionsRow.vue.js +56 -0
- package/dist/components/descriptions/EpDescriptionsRow2.vue.js +4 -0
- package/dist/components/descriptions/constants.d.ts +1 -0
- package/dist/components/descriptions/constants.js +4 -0
- package/dist/components/descriptions/description.d.ts +66 -0
- package/dist/components/descriptions/description.js +61 -0
- package/dist/components/descriptions/descriptions-cell.d.ts +31 -0
- package/dist/components/descriptions/descriptions-cell.js +133 -0
- package/dist/components/descriptions/descriptions-row.d.ts +10 -0
- package/dist/components/descriptions/descriptions.type.d.ts +29 -0
- package/dist/components/descriptions/index.d.ts +22 -2
- package/dist/components/descriptions/index.js +9 -3
- package/dist/components/descriptions/token.d.ts +3 -0
- package/dist/components/descriptions/token.js +4 -0
- package/dist/components/descriptions-item/description-item.d.ts +84 -0
- package/dist/components/descriptions-item/description-item.js +87 -0
- package/dist/components/descriptions-item/index.d.ts +14 -2
- package/dist/components/descriptions-item/index.js +6 -4
- package/dist/components/dropdown/src/dropdown-item-impl2.vue.js +1 -1
- package/dist/components/dropdown/src/dropdown-item2.vue.js +1 -1
- package/dist/components/dropdown/src/dropdown-menu2.vue.js +1 -1
- package/dist/components/dropdown/src/dropdown2.vue.js +1 -1
- package/dist/components/input-number/index.js +3 -2
- package/dist/components/mention/EpMention.vue.d.ts +430 -0
- package/dist/components/mention/EpMention.vue.js +303 -0
- package/dist/components/mention/EpMention2.vue.js +4 -0
- package/dist/components/mention/EpMentionDropdown.vue.d.ts +34 -0
- package/dist/components/mention/EpMentionDropdown.vue.js +140 -0
- package/dist/components/mention/EpMentionDropdown2.vue.js +4 -0
- package/dist/components/mention/helper.d.ts +32 -0
- package/dist/components/mention/helper.js +112 -0
- package/dist/components/mention/index.d.ts +13 -2
- package/dist/components/mention/index.js +11 -4
- package/dist/components/mention/mention-dropdown.d.ts +21 -0
- package/dist/components/mention/mention-dropdown.js +22 -0
- package/dist/components/mention/mention.d.ts +313 -0
- package/dist/components/mention/mention.js +123 -0
- package/dist/components/mention/types.d.ts +19 -0
- package/dist/components/radio/index.js +4 -3
- package/dist/components/rate/EpRate.vue.d.ts +32 -0
- package/dist/components/rate/EpRate.vue.js +229 -0
- package/dist/components/rate/EpRate2.vue.js +4 -0
- package/dist/components/rate/index.d.ts +15 -2
- package/dist/components/rate/index.js +7 -4
- package/dist/components/rate/rate.d.ts +131 -0
- package/dist/components/rate/rate.js +158 -0
- package/dist/components/roving-focus-group/index.js +1 -1
- package/dist/components/roving-focus-group/src/roving-focus-item.vue.js +76 -18
- package/dist/components/roving-focus-group/src/roving-focus-item2.vue.js +18 -76
- package/dist/components/segmented/EpSegmented.vue.d.ts +22 -0
- package/dist/components/segmented/EpSegmented.vue.js +136 -0
- package/dist/components/segmented/EpSegmented2.vue.js +4 -0
- package/dist/components/segmented/index.d.ts +14 -2
- package/dist/components/segmented/index.js +11 -4
- package/dist/components/segmented/segmented.d.ts +85 -0
- package/dist/components/segmented/segmented.js +85 -0
- package/dist/components/segmented/types.d.ts +1 -0
- package/dist/components/select/index.d.ts +4 -2
- package/dist/components/select/index.js +3 -2
- package/dist/components/select/select2.vue.js +60 -61
- package/dist/components/select-v2/src/select.vue.d.ts +1 -1
- package/dist/components/slider/EpSlider.vue.d.ts +175 -0
- package/dist/components/slider/EpSlider.vue.js +211 -0
- package/dist/components/slider/EpSlider2.vue.js +4 -0
- package/dist/components/slider/EpSliderButton.vue.d.ts +26 -0
- package/dist/components/slider/EpSliderButton.vue.js +103 -0
- package/dist/components/slider/EpSliderButton2.vue.js +4 -0
- package/dist/components/slider/button.d.ts +28 -0
- package/dist/components/slider/button.js +28 -0
- package/dist/components/slider/composables/index.d.ts +7 -0
- package/dist/components/slider/composables/use-lifecycle.d.ts +4 -0
- package/dist/components/slider/composables/use-lifecycle.js +20 -0
- package/dist/components/slider/composables/use-marks.d.ts +7 -0
- package/dist/components/slider/composables/use-marks.js +30 -0
- package/dist/components/slider/composables/use-slide.d.ts +23 -0
- package/dist/components/slider/composables/use-slide.js +92 -0
- package/dist/components/slider/composables/use-slider-button.d.ts +18 -0
- package/dist/components/slider/composables/use-slider-button.js +179 -0
- package/dist/components/slider/composables/use-stops.d.ts +8 -0
- package/dist/components/slider/composables/use-stops.js +23 -0
- package/dist/components/slider/composables/use-watch.d.ts +4 -0
- package/dist/components/slider/composables/use-watch.js +42 -0
- package/dist/components/slider/constants.d.ts +17 -0
- package/dist/components/slider/constants.js +4 -0
- package/dist/components/slider/index.d.ts +18 -2
- package/dist/components/slider/index.js +10 -4
- package/dist/components/slider/marker.d.ts +64 -0
- package/dist/components/slider/marker.js +40 -0
- package/dist/components/slider/slider.d.ts +80 -0
- package/dist/components/slider/slider.js +170 -0
- package/dist/components/step/EpStep.vue.d.ts +38 -0
- package/dist/components/step/EpStep.vue.js +157 -0
- package/dist/components/step/EpStep2.vue.js +4 -0
- package/dist/components/step/index.d.ts +12 -2
- package/dist/components/step/index.js +8 -3
- package/dist/components/step/step.d.ts +42 -0
- package/dist/components/step/step.js +39 -0
- package/dist/components/steps/EpSteps.vue.d.ts +23 -0
- package/dist/components/steps/EpSteps.vue.js +57 -0
- package/dist/components/steps/EpSteps2.vue.js +4 -0
- package/dist/components/steps/index.d.ts +20 -2
- package/dist/components/steps/index.js +8 -4
- package/dist/components/steps/steps.d.ts +69 -0
- package/dist/components/steps/steps.js +66 -0
- package/dist/components/steps/tokens.d.ts +1 -0
- package/dist/components/steps/tokens.js +4 -0
- package/dist/components/switch/EpSwitch.vue.d.ts +50 -0
- package/dist/components/switch/EpSwitch.vue.js +251 -0
- package/dist/components/switch/EpSwitch2.vue.js +4 -0
- package/dist/components/switch/index.d.ts +15 -2
- package/dist/components/switch/index.js +10 -4
- package/dist/components/switch/switch.d.ts +157 -0
- package/dist/components/switch/switch.js +145 -0
- package/dist/components/table/src/filter-panel.vue.d.ts +3 -3
- package/dist/components/table/src/table-header/index.d.ts +3 -3
- package/dist/components/text/index.d.ts +4 -2
- package/dist/components/text/index.js +7 -4
- package/dist/components/text/src/text.d.ts +43 -0
- package/dist/components/text/src/text.js +45 -0
- package/dist/components/text/src/text.vue.d.ts +17 -0
- package/dist/components/text/src/text.vue.js +63 -0
- package/dist/components/text/src/text2.vue.js +4 -0
- package/dist/components/time-select/EpTimeSelect.vue.d.ts +38 -0
- package/dist/components/time-select/EpTimeSelect.vue.js +154 -0
- package/dist/components/time-select/EpTimeSelect2.vue.js +4 -0
- package/dist/components/time-select/index.d.ts +17 -2
- package/dist/components/time-select/index.js +12 -4
- package/dist/components/time-select/time-select.d.ts +143 -0
- package/dist/components/time-select/time-select.js +139 -0
- package/dist/components/time-select/utils.d.ts +11 -0
- package/dist/components/time-select/utils.js +39 -0
- package/dist/components/tour/EpTour.vue.d.ts +40 -0
- package/dist/components/tour/EpTour.vue.js +174 -0
- package/dist/components/tour/EpTour2.vue.js +4 -0
- package/dist/components/tour/EpTourContent.vue.d.ts +23 -0
- package/dist/components/tour/EpTourContent.vue.js +72 -0
- package/dist/components/tour/EpTourContent2.vue.js +4 -0
- package/dist/components/tour/EpTourMask.vue.d.ts +7 -0
- package/dist/components/tour/EpTourMask.vue.js +76 -0
- package/dist/components/tour/EpTourMask2.vue.js +4 -0
- package/dist/components/tour/constants.d.ts +10 -0
- package/dist/components/tour/constants.js +4 -0
- package/dist/components/tour/content.d.ts +49 -0
- package/dist/components/tour/content.js +70 -0
- package/dist/components/tour/helper.d.ts +36 -0
- package/dist/components/tour/helper.js +161 -0
- package/dist/components/tour/index.d.ts +28 -2
- package/dist/components/tour/index.js +19 -4
- package/dist/components/tour/mask.d.ts +43 -0
- package/dist/components/tour/steps.d.ts +19 -0
- package/dist/components/tour/steps.js +35 -0
- package/dist/components/tour/tour.d.ts +136 -0
- package/dist/components/tour/tour.js +120 -0
- package/dist/components/tour/types.d.ts +21 -0
- package/dist/components/tour-step/EpTourStep.vue.d.ts +25 -0
- package/dist/components/tour-step/EpTourStep.vue.js +179 -0
- package/dist/components/tour-step/EpTourStep2.vue.js +4 -0
- package/dist/components/tour-step/index.d.ts +13 -2
- package/dist/components/tour-step/index.js +10 -4
- package/dist/components/tour-step/step.d.ts +120 -0
- package/dist/components/tour-step/step.js +91 -0
- package/dist/components/transfer/EpTransfer.vue.d.ts +36 -0
- package/dist/components/transfer/EpTransfer.vue.js +195 -0
- package/dist/components/transfer/EpTransfer2.vue.js +4 -0
- package/dist/components/transfer/EpTransferPanel.vue.d.ts +24 -0
- package/dist/components/transfer/EpTransferPanel.vue.js +191 -0
- package/dist/components/transfer/EpTransferPanel2.vue.js +4 -0
- package/dist/components/transfer/composables/index.d.ts +5 -0
- package/dist/components/transfer/composables/use-check.d.ts +286 -0
- package/dist/components/transfer/composables/use-check.js +89 -0
- package/dist/components/transfer/composables/use-checked-change.d.ts +6 -0
- package/dist/components/transfer/composables/use-checked-change.js +12 -0
- package/dist/components/transfer/composables/use-computed-data.d.ts +5 -0
- package/dist/components/transfer/composables/use-computed-data.js +26 -0
- package/dist/components/transfer/composables/use-move.d.ts +6 -0
- package/dist/components/transfer/composables/use-move.js +27 -0
- package/dist/components/transfer/composables/use-props-alias.d.ts +8 -0
- package/dist/components/transfer/composables/use-props-alias.js +15 -0
- package/dist/components/transfer/index.d.ts +19 -2
- package/dist/components/transfer/index.js +13 -4
- package/dist/components/transfer/transfer-panel.d.ts +63 -0
- package/dist/components/transfer/transfer-panel.js +32 -0
- package/dist/components/transfer/transfer.d.ts +136 -0
- package/dist/components/transfer/transfer.js +130 -0
- package/dist/components/tree/index.d.ts +7 -2
- package/dist/components/tree/index.js +8 -4
- package/dist/components/tree/src/instance.d.ts +2 -0
- package/dist/components/tree/src/model/node.d.ts +63 -0
- package/dist/components/tree/src/model/node.js +263 -0
- package/dist/components/tree/src/model/tree-store.d.ts +51 -0
- package/dist/components/tree/src/model/tree-store.js +223 -0
- package/dist/components/tree/src/model/useDragNode.d.ts +459 -0
- package/dist/components/tree/src/model/useDragNode.js +98 -0
- package/dist/components/tree/src/model/useKeydown.d.ts +7 -0
- package/dist/components/tree/src/model/useKeydown.js +93 -0
- package/dist/components/tree/src/model/useNodeExpandEventBroadcast.d.ts +9 -0
- package/dist/components/tree/src/model/useNodeExpandEventBroadcast.js +27 -0
- package/dist/components/tree/src/model/util.d.ts +7 -0
- package/dist/components/tree/src/model/util.js +19 -0
- package/dist/components/tree/src/tokens.d.ts +3 -0
- package/dist/components/tree/src/tokens.js +6 -0
- package/dist/components/tree/src/tree-node-content.vue.d.ts +14 -0
- package/dist/components/tree/src/tree-node-content.vue.js +43 -0
- package/dist/components/tree/src/tree-node-content2.vue.js +4 -0
- package/dist/components/tree/src/tree-node.vue.d.ts +377 -0
- package/dist/components/tree/src/tree-node.vue.js +108 -0
- package/dist/components/tree/src/tree-node2.vue.js +166 -0
- package/dist/components/tree/src/tree.d.ts +103 -0
- package/dist/components/tree/src/tree.js +99 -0
- package/dist/components/tree/src/tree.type.d.ts +112 -0
- package/dist/components/tree/src/tree.vue.d.ts +1745 -0
- package/dist/components/tree/src/tree.vue.js +48 -0
- package/dist/components/tree/src/tree2.vue.js +192 -0
- package/dist/components/tree-select/index.d.ts +3 -2
- package/dist/components/tree-select/index.js +7 -4
- package/dist/components/tree-select/src/cache-options.d.ts +20 -0
- package/dist/components/tree-select/src/cache-options.js +36 -0
- package/dist/components/tree-select/src/instance.d.ts +6 -0
- package/dist/components/tree-select/src/select.d.ts +11 -0
- package/dist/components/tree-select/src/select.js +92 -0
- package/dist/components/tree-select/src/tree-select-option.d.ts +364 -0
- package/dist/components/tree-select/src/tree-select-option.js +32 -0
- package/dist/components/tree-select/src/tree-select.vue.d.ts +412 -0
- package/dist/components/tree-select/src/tree-select.vue.js +96 -0
- package/dist/components/tree-select/src/tree-select2.vue.js +4 -0
- package/dist/components/tree-select/src/tree.d.ts +12 -0
- package/dist/components/tree-select/src/tree.js +179 -0
- package/dist/components/tree-select/src/utils.d.ts +10 -0
- package/dist/components/tree-select/src/utils.js +49 -0
- package/dist/components/upload/src/upload-content.vue.d.ts +2 -2
- package/dist/components/upload/src/upload.vue.d.ts +2 -2
- package/dist/constants/column-alignment.js +4 -0
- package/dist/ep-craft.js +367 -279
- package/dist/hooks/index.d.ts +1 -0
- package/dist/hooks/use-lockscreen/index.d.ts +11 -0
- package/dist/hooks/use-lockscreen/index.js +34 -0
- package/dist/index.d.ts +98 -0
- package/dist/utils/arrays.js +4 -3
- package/dist/utils/dom/aria.js +23 -13
- package/dist/utils/dom/scroll.js +61 -46
- package/dist/utils/vue/icon.js +17 -14
- package/dist/utils/vue/validator.js +5 -0
- package/dist/utils/vue/vnode.js +24 -12
- package/dist/vendored-components.d.ts +1 -1
- package/dist/vendored-components.js +69 -5
- package/package.json +3 -2
|
@@ -0,0 +1,103 @@
|
|
|
1
|
+
import { defineComponent as N, reactive as z, computed as K, toRefs as T, openBlock as X, createElementBlock as Y, unref as t, normalizeStyle as F, normalizeClass as g, createVNode as L, withCtx as v, createElementVNode as b, toDisplayString as R } from "vue";
|
|
2
|
+
import { ElTooltip as j } from "../tooltip/index.js";
|
|
3
|
+
import { useNamespace as q } from "../../hooks/use-namespace/index.js";
|
|
4
|
+
import "@vue/shared";
|
|
5
|
+
import "lodash-unified";
|
|
6
|
+
import "@vueuse/core";
|
|
7
|
+
import "@element-plus/icons-vue";
|
|
8
|
+
import "../../hooks/use-size/index.js";
|
|
9
|
+
import "@popperjs/core";
|
|
10
|
+
import "../../hooks/use-z-index/index.js";
|
|
11
|
+
import "../../hooks/use-delayed-toggle/index.js";
|
|
12
|
+
import "../../hooks/use-aria/index.js";
|
|
13
|
+
import "../../hooks/use-model-toggle/index.js";
|
|
14
|
+
import "../../hooks/use-empty-values/index.js";
|
|
15
|
+
import "../form/index.js";
|
|
16
|
+
import { useSliderButton as A } from "./composables/use-slider-button.js";
|
|
17
|
+
import { sliderButtonEmits as G, sliderButtonProps as H } from "./button.js";
|
|
18
|
+
const I = ["tabindex"], pt = /* @__PURE__ */ N({
|
|
19
|
+
name: "EpSliderButton",
|
|
20
|
+
__name: "EpSliderButton",
|
|
21
|
+
props: H,
|
|
22
|
+
emits: G,
|
|
23
|
+
setup(c, { expose: w, emit: B }) {
|
|
24
|
+
const a = c, y = B, m = q("slider"), u = z({
|
|
25
|
+
hovering: !1,
|
|
26
|
+
dragging: !1,
|
|
27
|
+
isClick: !1,
|
|
28
|
+
startX: 0,
|
|
29
|
+
currentX: 0,
|
|
30
|
+
startY: 0,
|
|
31
|
+
currentY: 0,
|
|
32
|
+
startPosition: 0,
|
|
33
|
+
newPosition: 0,
|
|
34
|
+
oldValue: a.modelValue
|
|
35
|
+
}), E = K(
|
|
36
|
+
() => d.value ? C.value : !1
|
|
37
|
+
), {
|
|
38
|
+
disabled: k,
|
|
39
|
+
button: S,
|
|
40
|
+
tooltip: V,
|
|
41
|
+
showTooltip: d,
|
|
42
|
+
persistent: C,
|
|
43
|
+
tooltipVisible: M,
|
|
44
|
+
wrapperStyle: P,
|
|
45
|
+
formatValue: x,
|
|
46
|
+
handleMouseEnter: n,
|
|
47
|
+
handleMouseLeave: r,
|
|
48
|
+
onButtonDown: s,
|
|
49
|
+
onKeyDown: i,
|
|
50
|
+
setPosition: D
|
|
51
|
+
} = A(a, u, y), { hovering: l, dragging: p } = T(u);
|
|
52
|
+
return w({
|
|
53
|
+
onButtonDown: s,
|
|
54
|
+
onKeyDown: i,
|
|
55
|
+
setPosition: D,
|
|
56
|
+
hovering: l,
|
|
57
|
+
dragging: p
|
|
58
|
+
}), (f, e) => (X(), Y("div", {
|
|
59
|
+
ref_key: "button",
|
|
60
|
+
ref: S,
|
|
61
|
+
class: g([t(m).e("button-wrapper"), { hover: t(l), dragging: t(p) }]),
|
|
62
|
+
style: F(t(P)),
|
|
63
|
+
tabindex: t(k) ? void 0 : 0,
|
|
64
|
+
onMouseenter: e[0] || (e[0] = //@ts-ignore
|
|
65
|
+
(...o) => t(n) && t(n)(...o)),
|
|
66
|
+
onMouseleave: e[1] || (e[1] = //@ts-ignore
|
|
67
|
+
(...o) => t(r) && t(r)(...o)),
|
|
68
|
+
onMousedown: e[2] || (e[2] = //@ts-ignore
|
|
69
|
+
(...o) => t(s) && t(s)(...o)),
|
|
70
|
+
onFocus: e[3] || (e[3] = //@ts-ignore
|
|
71
|
+
(...o) => t(n) && t(n)(...o)),
|
|
72
|
+
onBlur: e[4] || (e[4] = //@ts-ignore
|
|
73
|
+
(...o) => t(r) && t(r)(...o)),
|
|
74
|
+
onKeydown: e[5] || (e[5] = //@ts-ignore
|
|
75
|
+
(...o) => t(i) && t(i)(...o))
|
|
76
|
+
}, [
|
|
77
|
+
L(t(j), {
|
|
78
|
+
ref_key: "tooltip",
|
|
79
|
+
ref: V,
|
|
80
|
+
visible: t(M),
|
|
81
|
+
placement: f.placement,
|
|
82
|
+
"fallback-placements": ["top", "bottom", "right", "left"],
|
|
83
|
+
"stop-popper-mouse-event": !1,
|
|
84
|
+
"popper-class": f.tooltipClass,
|
|
85
|
+
disabled: !t(d),
|
|
86
|
+
persistent: E.value
|
|
87
|
+
}, {
|
|
88
|
+
content: v(() => [
|
|
89
|
+
b("span", null, R(t(x)), 1)
|
|
90
|
+
]),
|
|
91
|
+
default: v(() => [
|
|
92
|
+
b("div", {
|
|
93
|
+
class: g([t(m).e("button"), { hover: t(l), dragging: t(p) }])
|
|
94
|
+
}, null, 2)
|
|
95
|
+
]),
|
|
96
|
+
_: 1
|
|
97
|
+
}, 8, ["visible", "placement", "popper-class", "disabled", "persistent"])
|
|
98
|
+
], 46, I));
|
|
99
|
+
}
|
|
100
|
+
});
|
|
101
|
+
export {
|
|
102
|
+
pt as default
|
|
103
|
+
};
|
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
import type { ComponentPublicInstance, ExtractPropTypes, ExtractPublicPropTypes, Ref } from 'vue';
|
|
2
|
+
import type Button from './EpSliderButton.vue';
|
|
3
|
+
export declare const sliderButtonProps: {
|
|
4
|
+
readonly modelValue: import("@element-plus/utils").EpPropFinalized<NumberConstructor, unknown, unknown, 0, boolean>;
|
|
5
|
+
readonly vertical: BooleanConstructor;
|
|
6
|
+
readonly tooltipClass: StringConstructor;
|
|
7
|
+
readonly placement: import("@element-plus/utils").EpPropFinalized<StringConstructor, import("element-plus").Placement, unknown, "top", boolean>;
|
|
8
|
+
};
|
|
9
|
+
export type SliderButtonProps = ExtractPropTypes<typeof sliderButtonProps>;
|
|
10
|
+
export type SliderButtonPropsPublic = ExtractPublicPropTypes<typeof sliderButtonProps>;
|
|
11
|
+
export declare const sliderButtonEmits: {
|
|
12
|
+
"update:modelValue": (value: number) => boolean;
|
|
13
|
+
};
|
|
14
|
+
export type SliderButtonEmits = typeof sliderButtonEmits;
|
|
15
|
+
export type SliderButtonInstance = ComponentPublicInstance<typeof Button>;
|
|
16
|
+
export type ButtonRefs = Record<'firstButton' | 'secondButton', Ref<SliderButtonInstance | undefined>>;
|
|
17
|
+
export interface SliderButtonInitData {
|
|
18
|
+
hovering: boolean;
|
|
19
|
+
dragging: boolean;
|
|
20
|
+
isClick: boolean;
|
|
21
|
+
startX: number;
|
|
22
|
+
currentX: number;
|
|
23
|
+
startY: number;
|
|
24
|
+
currentY: number;
|
|
25
|
+
startPosition: number;
|
|
26
|
+
newPosition: number;
|
|
27
|
+
oldValue: number;
|
|
28
|
+
}
|
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
import { placements as o } from "@popperjs/core";
|
|
2
|
+
import { isNumber as r } from "../../utils/types.js";
|
|
3
|
+
import "lodash-unified";
|
|
4
|
+
import "@vueuse/core";
|
|
5
|
+
import "@vue/shared";
|
|
6
|
+
import { UPDATE_MODEL_EVENT as m } from "../../constants/event.js";
|
|
7
|
+
import "@element-plus/icons-vue";
|
|
8
|
+
import { buildProps as e } from "../../utils/vue/props/runtime.js";
|
|
9
|
+
import "vue";
|
|
10
|
+
const c = e({
|
|
11
|
+
modelValue: {
|
|
12
|
+
type: Number,
|
|
13
|
+
default: 0
|
|
14
|
+
},
|
|
15
|
+
vertical: Boolean,
|
|
16
|
+
tooltipClass: String,
|
|
17
|
+
placement: {
|
|
18
|
+
type: String,
|
|
19
|
+
values: o,
|
|
20
|
+
default: "top"
|
|
21
|
+
}
|
|
22
|
+
}), E = {
|
|
23
|
+
[m]: (t) => r(t)
|
|
24
|
+
};
|
|
25
|
+
export {
|
|
26
|
+
E as sliderButtonEmits,
|
|
27
|
+
c as sliderButtonProps
|
|
28
|
+
};
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
export type { Mark } from './use-marks';
|
|
2
|
+
export { useMarks } from './use-marks';
|
|
3
|
+
export { useLifecycle } from './use-lifecycle';
|
|
4
|
+
export { useSlide } from './use-slide';
|
|
5
|
+
export { useSliderButton } from './use-slider-button';
|
|
6
|
+
export { useStops } from './use-stops';
|
|
7
|
+
export { useWatch } from './use-watch';
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
import { ref as V, onMounted as r, nextTick as f } from "vue";
|
|
2
|
+
import { useEventListener as d } from "@vueuse/core";
|
|
3
|
+
import { isNumber as o } from "../../../utils/types.js";
|
|
4
|
+
import "lodash-unified";
|
|
5
|
+
import { isArray as a } from "@vue/shared";
|
|
6
|
+
import "@element-plus/icons-vue";
|
|
7
|
+
const h = (e, l, m) => {
|
|
8
|
+
const u = V();
|
|
9
|
+
return r(async () => {
|
|
10
|
+
e.range ? (a(e.modelValue) ? (l.firstValue = Math.max(e.min, e.modelValue[0]), l.secondValue = Math.min(e.max, e.modelValue[1])) : (l.firstValue = e.min, l.secondValue = e.max), l.oldValue = [l.firstValue, l.secondValue]) : (!o(e.modelValue) || Number.isNaN(e.modelValue) ? l.firstValue = e.min : l.firstValue = Math.min(
|
|
11
|
+
e.max,
|
|
12
|
+
Math.max(e.min, e.modelValue)
|
|
13
|
+
), l.oldValue = l.firstValue), d(window, "resize", m), await f(), m();
|
|
14
|
+
}), {
|
|
15
|
+
sliderWrapper: u
|
|
16
|
+
};
|
|
17
|
+
};
|
|
18
|
+
export {
|
|
19
|
+
h as useLifecycle
|
|
20
|
+
};
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
import type { SliderProps } from '../slider';
|
|
2
|
+
import type { SliderMarkerProps } from '../marker';
|
|
3
|
+
export interface Mark extends SliderMarkerProps {
|
|
4
|
+
point: number;
|
|
5
|
+
position: number;
|
|
6
|
+
}
|
|
7
|
+
export declare const useMarks: (props: SliderProps) => import("vue").ComputedRef<Mark[]>;
|
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
import { computed as k, watchEffect as o } from "vue";
|
|
2
|
+
import "@vue/shared";
|
|
3
|
+
import "lodash-unified";
|
|
4
|
+
import "@vueuse/core";
|
|
5
|
+
import { debugWarn as n } from "../../../utils/error.js";
|
|
6
|
+
import "@element-plus/icons-vue";
|
|
7
|
+
const y = (e) => {
|
|
8
|
+
const t = k(() => e.marks ? Object.keys(e.marks).map(Number.parseFloat).sort((m, a) => m - a).filter((m) => m <= e.max && m >= e.min).map(
|
|
9
|
+
(m) => ({
|
|
10
|
+
point: m,
|
|
11
|
+
position: (m - e.min) * 100 / (e.max - e.min),
|
|
12
|
+
mark: e.marks[m]
|
|
13
|
+
})
|
|
14
|
+
) : []);
|
|
15
|
+
return o(() => {
|
|
16
|
+
if (e.step === "mark" && !e.marks && n("ElSlider", "marks prop must be provided when step is mark"), e.marks) {
|
|
17
|
+
const i = Object.keys(e.marks), m = t.value.map((r) => r.point), a = i.filter((r) => {
|
|
18
|
+
const s = Number.parseFloat(r);
|
|
19
|
+
return Number.isNaN(s) || !m.includes(s);
|
|
20
|
+
});
|
|
21
|
+
a.length > 0 && n(
|
|
22
|
+
"ElSlider",
|
|
23
|
+
`Some marks keys are invalid (not a number or out of [min, max]): [${a.map((r) => `'${r}'`).join(", ")}] and will be ignored.`
|
|
24
|
+
);
|
|
25
|
+
}
|
|
26
|
+
}), t;
|
|
27
|
+
};
|
|
28
|
+
export {
|
|
29
|
+
y as useMarks
|
|
30
|
+
};
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
import type { CSSProperties, Ref, SetupContext } from 'vue';
|
|
2
|
+
import type { SliderEmits, SliderInitData, SliderProps } from '../slider';
|
|
3
|
+
import type { SliderButtonInstance } from '../button';
|
|
4
|
+
export declare const useSlide: (props: SliderProps, initData: SliderInitData, emit: SetupContext<SliderEmits>["emit"]) => {
|
|
5
|
+
elFormItem: import("@element-plus/components/form").FormItemContext | undefined;
|
|
6
|
+
slider: import("vue").ShallowRef<HTMLElement | undefined, HTMLElement | undefined>;
|
|
7
|
+
firstButton: Ref<SliderButtonInstance | undefined, SliderButtonInstance | undefined>;
|
|
8
|
+
secondButton: Ref<SliderButtonInstance | undefined, SliderButtonInstance | undefined>;
|
|
9
|
+
sliderDisabled: import("vue").ComputedRef<boolean>;
|
|
10
|
+
minValue: import("vue").ComputedRef<number>;
|
|
11
|
+
maxValue: import("vue").ComputedRef<number>;
|
|
12
|
+
runwayStyle: import("vue").ComputedRef<CSSProperties>;
|
|
13
|
+
barStyle: import("vue").ComputedRef<CSSProperties>;
|
|
14
|
+
resetSize: () => void;
|
|
15
|
+
setPosition: (percent: number) => Ref<SliderButtonInstance | undefined>;
|
|
16
|
+
emitChange: () => Promise<void>;
|
|
17
|
+
onSliderWrapperPrevent: (event: TouchEvent) => void;
|
|
18
|
+
onSliderClick: (event: MouseEvent | TouchEvent) => void;
|
|
19
|
+
onSliderDown: (event: MouseEvent | TouchEvent) => Promise<void>;
|
|
20
|
+
onSliderMarkerDown: (position: number) => void;
|
|
21
|
+
setFirstValue: (firstValue: number | undefined) => void;
|
|
22
|
+
setSecondValue: (secondValue: number) => void;
|
|
23
|
+
};
|
|
@@ -0,0 +1,92 @@
|
|
|
1
|
+
import { shallowRef as F, ref as C, computed as i, nextTick as M } from "vue";
|
|
2
|
+
import { CHANGE_EVENT as I, UPDATE_MODEL_EVENT as O, INPUT_EVENT as X } from "../../../constants/event.js";
|
|
3
|
+
import "../../form/index.js";
|
|
4
|
+
import { useFormItem as Y } from "../../form/src/hooks/use-form-item.js";
|
|
5
|
+
import { useFormDisabled as $ } from "../../form/src/hooks/use-form-common-props.js";
|
|
6
|
+
const K = (t, l, s) => {
|
|
7
|
+
const { formItem: y } = Y(), c = F(), a = C(), h = C(), f = {
|
|
8
|
+
firstButton: a,
|
|
9
|
+
secondButton: h
|
|
10
|
+
}, d = $(), u = i(() => Math.min(l.firstValue, l.secondValue)), r = i(() => Math.max(l.firstValue, l.secondValue)), S = i(() => t.range ? `${100 * (r.value - u.value) / (t.max - t.min)}%` : `${100 * (l.firstValue - t.min) / (t.max - t.min)}%`), V = i(() => t.range ? `${100 * (u.value - t.min) / (t.max - t.min)}%` : "0%"), N = i(() => t.vertical ? { height: t.height } : {}), T = i(() => t.vertical ? {
|
|
11
|
+
height: S.value,
|
|
12
|
+
bottom: V.value
|
|
13
|
+
} : {
|
|
14
|
+
width: S.value,
|
|
15
|
+
left: V.value
|
|
16
|
+
}), b = () => {
|
|
17
|
+
if (c.value) {
|
|
18
|
+
const e = c.value.getBoundingClientRect();
|
|
19
|
+
l.sliderSize = e[t.vertical ? "height" : "width"];
|
|
20
|
+
}
|
|
21
|
+
}, k = (e) => {
|
|
22
|
+
const n = t.min + e * (t.max - t.min) / 100;
|
|
23
|
+
if (!t.range)
|
|
24
|
+
return a;
|
|
25
|
+
let o;
|
|
26
|
+
return Math.abs(u.value - n) < Math.abs(r.value - n) ? o = l.firstValue < l.secondValue ? "firstButton" : "secondButton" : o = l.firstValue > l.secondValue ? "firstButton" : "secondButton", f[o];
|
|
27
|
+
}, m = (e) => {
|
|
28
|
+
const n = k(e);
|
|
29
|
+
return n.value.setPosition(e), n;
|
|
30
|
+
}, z = (e) => {
|
|
31
|
+
l.firstValue = e ?? t.min, B(
|
|
32
|
+
t.range ? [u.value, r.value] : e ?? t.min
|
|
33
|
+
);
|
|
34
|
+
}, _ = (e) => {
|
|
35
|
+
l.secondValue = e, t.range && B([u.value, r.value]);
|
|
36
|
+
}, B = (e) => {
|
|
37
|
+
s(O, e), s(X, e);
|
|
38
|
+
}, g = async () => {
|
|
39
|
+
await M(), s(
|
|
40
|
+
I,
|
|
41
|
+
t.range ? [u.value, r.value] : t.modelValue
|
|
42
|
+
);
|
|
43
|
+
}, R = (e) => {
|
|
44
|
+
var o, w, E, P;
|
|
45
|
+
if (d.value || l.dragging) return;
|
|
46
|
+
b();
|
|
47
|
+
let n = 0;
|
|
48
|
+
if (t.vertical) {
|
|
49
|
+
const v = ((w = (o = e.touches) == null ? void 0 : o.item(0)) == null ? void 0 : w.clientY) ?? e.clientY;
|
|
50
|
+
n = (c.value.getBoundingClientRect().bottom - v) / l.sliderSize * 100;
|
|
51
|
+
} else {
|
|
52
|
+
const v = ((P = (E = e.touches) == null ? void 0 : E.item(0)) == null ? void 0 : P.clientX) ?? e.clientX, x = c.value.getBoundingClientRect().left;
|
|
53
|
+
n = (v - x) / l.sliderSize * 100;
|
|
54
|
+
}
|
|
55
|
+
if (!(n < 0 || n > 100))
|
|
56
|
+
return m(n);
|
|
57
|
+
};
|
|
58
|
+
return {
|
|
59
|
+
elFormItem: y,
|
|
60
|
+
slider: c,
|
|
61
|
+
firstButton: a,
|
|
62
|
+
secondButton: h,
|
|
63
|
+
sliderDisabled: d,
|
|
64
|
+
minValue: u,
|
|
65
|
+
maxValue: r,
|
|
66
|
+
runwayStyle: N,
|
|
67
|
+
barStyle: T,
|
|
68
|
+
resetSize: b,
|
|
69
|
+
setPosition: m,
|
|
70
|
+
emitChange: g,
|
|
71
|
+
onSliderWrapperPrevent: (e) => {
|
|
72
|
+
var n, o;
|
|
73
|
+
((n = f.firstButton.value) != null && n.dragging || (o = f.secondButton.value) != null && o.dragging) && e.preventDefault();
|
|
74
|
+
},
|
|
75
|
+
onSliderClick: (e) => {
|
|
76
|
+
R(e) && g();
|
|
77
|
+
},
|
|
78
|
+
onSliderDown: async (e) => {
|
|
79
|
+
const n = R(e);
|
|
80
|
+
n && (await M(), n.value.onButtonDown(e));
|
|
81
|
+
},
|
|
82
|
+
onSliderMarkerDown: (e) => {
|
|
83
|
+
if (d.value || l.dragging) return;
|
|
84
|
+
m(e) && g();
|
|
85
|
+
},
|
|
86
|
+
setFirstValue: z,
|
|
87
|
+
setSecondValue: _
|
|
88
|
+
};
|
|
89
|
+
};
|
|
90
|
+
export {
|
|
91
|
+
K as useSlide
|
|
92
|
+
};
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
import type { CSSProperties, ComputedRef, Ref, SetupContext } from 'vue';
|
|
2
|
+
import type { SliderButtonEmits, SliderButtonInitData, SliderButtonProps } from '../button';
|
|
3
|
+
import type { TooltipInstance } from '@element-plus/components/tooltip';
|
|
4
|
+
export declare const useSliderButton: (props: SliderButtonProps, initData: SliderButtonInitData, emit: SetupContext<SliderButtonEmits>["emit"]) => {
|
|
5
|
+
disabled: ComputedRef<boolean>;
|
|
6
|
+
button: Ref<HTMLDivElement | undefined, HTMLDivElement | undefined>;
|
|
7
|
+
tooltip: Ref<TooltipInstance | undefined, TooltipInstance | undefined>;
|
|
8
|
+
tooltipVisible: Ref<boolean, boolean>;
|
|
9
|
+
showTooltip: Ref<import("@element-plus/utils").EpPropMergeType<BooleanConstructor, unknown, unknown>, import("@element-plus/utils").EpPropMergeType<BooleanConstructor, unknown, unknown>>;
|
|
10
|
+
persistent: Ref<import("@element-plus/utils").EpPropMergeType<BooleanConstructor, unknown, unknown>, import("@element-plus/utils").EpPropMergeType<BooleanConstructor, unknown, unknown>>;
|
|
11
|
+
wrapperStyle: ComputedRef<CSSProperties>;
|
|
12
|
+
formatValue: ComputedRef<string | number>;
|
|
13
|
+
handleMouseEnter: () => void;
|
|
14
|
+
handleMouseLeave: () => void;
|
|
15
|
+
onButtonDown: (event: MouseEvent | TouchEvent) => void;
|
|
16
|
+
onKeyDown: (event: KeyboardEvent) => void;
|
|
17
|
+
setPosition: (newPosition: number) => Promise<void>;
|
|
18
|
+
};
|
|
@@ -0,0 +1,179 @@
|
|
|
1
|
+
import { inject as ee, ref as X, computed as w, watch as oe, nextTick as te } from "vue";
|
|
2
|
+
import { debounce as I, clamp as le } from "lodash-unified";
|
|
3
|
+
import { useEventListener as ne } from "@vueuse/core";
|
|
4
|
+
import { EVENT_CODE as m } from "../../../constants/aria.js";
|
|
5
|
+
import { UPDATE_MODEL_EVENT as re } from "../../../constants/event.js";
|
|
6
|
+
import { isNumber as y } from "../../../utils/types.js";
|
|
7
|
+
import "@vue/shared";
|
|
8
|
+
import { getEventCode as ue } from "../../../utils/dom/event.js";
|
|
9
|
+
import "@element-plus/icons-vue";
|
|
10
|
+
import { sliderContextKey as se } from "../constants.js";
|
|
11
|
+
const ae = (u, e, b) => {
|
|
12
|
+
const f = X(), r = X(!1), d = w(() => e.value instanceof Function), n = w(() => d.value && e.value(u.modelValue) || u.modelValue), E = I(() => {
|
|
13
|
+
b.value && (r.value = !0);
|
|
14
|
+
}, 50), T = I(() => {
|
|
15
|
+
b.value && (r.value = !1);
|
|
16
|
+
}, 50);
|
|
17
|
+
return {
|
|
18
|
+
tooltip: f,
|
|
19
|
+
tooltipVisible: r,
|
|
20
|
+
formatValue: n,
|
|
21
|
+
displayTooltip: E,
|
|
22
|
+
hideTooltip: T
|
|
23
|
+
};
|
|
24
|
+
}, be = (u, e, b) => {
|
|
25
|
+
const {
|
|
26
|
+
disabled: f,
|
|
27
|
+
min: r,
|
|
28
|
+
max: d,
|
|
29
|
+
step: n,
|
|
30
|
+
showTooltip: E,
|
|
31
|
+
persistent: T,
|
|
32
|
+
precision: B,
|
|
33
|
+
sliderSize: Y,
|
|
34
|
+
formatTooltip: O,
|
|
35
|
+
emitChange: h,
|
|
36
|
+
resetSize: U,
|
|
37
|
+
updateDragging: _,
|
|
38
|
+
markList: c
|
|
39
|
+
} = ee(se), { tooltip: C, tooltipVisible: z, formatValue: R, displayTooltip: N, hideTooltip: K } = ae(u, O, E), P = X(), k = w(() => `${(u.modelValue - r.value) / (d.value - r.value) * 100}%`), j = w(() => u.vertical ? { bottom: k.value } : { left: k.value }), L = w(() => n.value === "mark" && c.value.length > 0), A = () => {
|
|
40
|
+
e.hovering = !0, N();
|
|
41
|
+
}, H = () => {
|
|
42
|
+
e.hovering = !1, e.dragging || K();
|
|
43
|
+
}, S = (o) => {
|
|
44
|
+
f.value || (o.preventDefault(), D(o), window.addEventListener("mousemove", x), window.addEventListener("touchmove", x), window.addEventListener("mouseup", p), window.addEventListener("touchend", p), window.addEventListener("contextmenu", p), P.value.focus());
|
|
45
|
+
}, M = (o) => {
|
|
46
|
+
f.value || (e.newPosition = Number.parseFloat(k.value) + o / (d.value - r.value) * 100, g(e.newPosition), h());
|
|
47
|
+
}, V = (o) => {
|
|
48
|
+
if (f.value || !c.value.length) return;
|
|
49
|
+
const t = u.modelValue, l = Number.EPSILON, s = Math.abs(o);
|
|
50
|
+
let i;
|
|
51
|
+
if (o > 0) {
|
|
52
|
+
const v = c.value.findIndex(
|
|
53
|
+
(a) => a.point > t + l
|
|
54
|
+
);
|
|
55
|
+
if (v !== -1) {
|
|
56
|
+
const a = Math.min(
|
|
57
|
+
v + s - 1,
|
|
58
|
+
c.value.length - 1
|
|
59
|
+
);
|
|
60
|
+
i = c.value[a].point;
|
|
61
|
+
}
|
|
62
|
+
} else {
|
|
63
|
+
let v = -1;
|
|
64
|
+
for (let a = c.value.length - 1; a >= 0; a--)
|
|
65
|
+
if (c.value[a].point < t - l) {
|
|
66
|
+
v = a;
|
|
67
|
+
break;
|
|
68
|
+
}
|
|
69
|
+
if (v !== -1) {
|
|
70
|
+
const a = Math.max(v - (s - 1), 0);
|
|
71
|
+
i = c.value[a].point;
|
|
72
|
+
}
|
|
73
|
+
}
|
|
74
|
+
if (i !== void 0 && i !== t) {
|
|
75
|
+
const v = (i - r.value) / (d.value - r.value) * 100;
|
|
76
|
+
g(v), h();
|
|
77
|
+
}
|
|
78
|
+
}, W = () => {
|
|
79
|
+
L.value ? V(-1) : y(n.value) && M(-n.value);
|
|
80
|
+
}, $ = () => {
|
|
81
|
+
L.value ? V(1) : y(n.value) && M(n.value);
|
|
82
|
+
}, q = () => {
|
|
83
|
+
L.value ? V(-4) : y(n.value) && M(-n.value * 4);
|
|
84
|
+
}, G = () => {
|
|
85
|
+
L.value ? V(4) : y(n.value) && M(n.value * 4);
|
|
86
|
+
}, J = () => {
|
|
87
|
+
f.value || (g(0), h());
|
|
88
|
+
}, Q = () => {
|
|
89
|
+
f.value || (g(100), h());
|
|
90
|
+
}, Z = (o) => {
|
|
91
|
+
const t = ue(o);
|
|
92
|
+
let l = !0;
|
|
93
|
+
switch (t) {
|
|
94
|
+
case m.left:
|
|
95
|
+
case m.down:
|
|
96
|
+
W();
|
|
97
|
+
break;
|
|
98
|
+
case m.right:
|
|
99
|
+
case m.up:
|
|
100
|
+
$();
|
|
101
|
+
break;
|
|
102
|
+
case m.home:
|
|
103
|
+
J();
|
|
104
|
+
break;
|
|
105
|
+
case m.end:
|
|
106
|
+
Q();
|
|
107
|
+
break;
|
|
108
|
+
case m.pageDown:
|
|
109
|
+
q();
|
|
110
|
+
break;
|
|
111
|
+
case m.pageUp:
|
|
112
|
+
G();
|
|
113
|
+
break;
|
|
114
|
+
default:
|
|
115
|
+
l = !1;
|
|
116
|
+
break;
|
|
117
|
+
}
|
|
118
|
+
l && o.preventDefault();
|
|
119
|
+
}, F = (o) => {
|
|
120
|
+
let t, l;
|
|
121
|
+
return o.type.startsWith("touch") ? (l = o.touches[0].clientY, t = o.touches[0].clientX) : (l = o.clientY, t = o.clientX), {
|
|
122
|
+
clientX: t,
|
|
123
|
+
clientY: l
|
|
124
|
+
};
|
|
125
|
+
}, D = (o) => {
|
|
126
|
+
e.dragging = !0, e.isClick = !0;
|
|
127
|
+
const { clientX: t, clientY: l } = F(o);
|
|
128
|
+
u.vertical ? e.startY = l : e.startX = t, e.startPosition = Number.parseFloat(k.value), e.newPosition = e.startPosition;
|
|
129
|
+
}, x = (o) => {
|
|
130
|
+
if (e.dragging) {
|
|
131
|
+
e.isClick = !1, N(), U();
|
|
132
|
+
let t;
|
|
133
|
+
const { clientX: l, clientY: s } = F(o);
|
|
134
|
+
u.vertical ? (e.currentY = s, t = (e.startY - e.currentY) / Y.value * 100) : (e.currentX = l, t = (e.currentX - e.startX) / Y.value * 100), e.newPosition = e.startPosition + t, g(e.newPosition);
|
|
135
|
+
}
|
|
136
|
+
}, p = () => {
|
|
137
|
+
e.dragging && (setTimeout(() => {
|
|
138
|
+
e.dragging = !1, e.hovering || K(), e.isClick || g(e.newPosition), h();
|
|
139
|
+
}, 0), window.removeEventListener("mousemove", x), window.removeEventListener("touchmove", x), window.removeEventListener("mouseup", p), window.removeEventListener("touchend", p), window.removeEventListener("contextmenu", p));
|
|
140
|
+
}, g = async (o) => {
|
|
141
|
+
if (o === null || Number.isNaN(+o)) return;
|
|
142
|
+
o = le(o, 0, 100);
|
|
143
|
+
let t;
|
|
144
|
+
if (n.value === "mark")
|
|
145
|
+
c.value.length === 0 ? t = o <= 50 ? r.value : d.value : t = c.value.reduce((s, i) => Math.abs(i.position - o) < Math.abs(s.position - o) ? i : s).point;
|
|
146
|
+
else {
|
|
147
|
+
const l = Math.floor((d.value - r.value) / n.value), s = l * n.value / (d.value - r.value) * 100, i = s + (100 - s) / 2;
|
|
148
|
+
if (o < s) {
|
|
149
|
+
const v = s / l, a = Math.round(o / v);
|
|
150
|
+
t = r.value + a * n.value;
|
|
151
|
+
} else o < i ? t = r.value + l * n.value : t = d.value;
|
|
152
|
+
t = Number.parseFloat(t.toFixed(B.value));
|
|
153
|
+
}
|
|
154
|
+
t !== u.modelValue && b(re, t), !e.dragging && u.modelValue !== e.oldValue && (e.oldValue = u.modelValue), await te(), e.dragging && N(), C.value.updatePopper();
|
|
155
|
+
};
|
|
156
|
+
return oe(
|
|
157
|
+
() => e.dragging,
|
|
158
|
+
(o) => {
|
|
159
|
+
_(o);
|
|
160
|
+
}
|
|
161
|
+
), ne(P, "touchstart", S, { passive: !1 }), {
|
|
162
|
+
disabled: f,
|
|
163
|
+
button: P,
|
|
164
|
+
tooltip: C,
|
|
165
|
+
tooltipVisible: z,
|
|
166
|
+
showTooltip: E,
|
|
167
|
+
persistent: T,
|
|
168
|
+
wrapperStyle: j,
|
|
169
|
+
formatValue: R,
|
|
170
|
+
handleMouseEnter: A,
|
|
171
|
+
handleMouseLeave: H,
|
|
172
|
+
onButtonDown: S,
|
|
173
|
+
onKeyDown: Z,
|
|
174
|
+
setPosition: g
|
|
175
|
+
};
|
|
176
|
+
};
|
|
177
|
+
export {
|
|
178
|
+
be as useSliderButton
|
|
179
|
+
};
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
import type { CSSProperties, ComputedRef } from 'vue';
|
|
2
|
+
import type { SliderInitData, SliderProps } from '../slider';
|
|
3
|
+
type Stops = {
|
|
4
|
+
stops: ComputedRef<number[]>;
|
|
5
|
+
getStopStyle: (position: number) => CSSProperties;
|
|
6
|
+
};
|
|
7
|
+
export declare const useStops: (props: SliderProps, initData: SliderInitData, minValue: ComputedRef<number>, maxValue: ComputedRef<number>) => Stops;
|
|
8
|
+
export {};
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
import { computed as f } from "vue";
|
|
2
|
+
import "@vue/shared";
|
|
3
|
+
import "lodash-unified";
|
|
4
|
+
import "@vueuse/core";
|
|
5
|
+
import { debugWarn as c } from "../../../utils/error.js";
|
|
6
|
+
import "@element-plus/icons-vue";
|
|
7
|
+
const y = (t, i, a, l) => ({
|
|
8
|
+
stops: f(() => {
|
|
9
|
+
if (!t.showStops || t.min > t.max) return [];
|
|
10
|
+
if (t.step === "mark" || t.step === 0)
|
|
11
|
+
return t.step === 0 && c("ElSlider", "step should not be 0."), [];
|
|
12
|
+
const m = Math.ceil((t.max - t.min) / t.step), u = 100 * t.step / (t.max - t.min), n = Array.from({ length: m - 1 }).map(
|
|
13
|
+
(e, r) => (r + 1) * u
|
|
14
|
+
);
|
|
15
|
+
return t.range ? n.filter((e) => e < 100 * (a.value - t.min) / (t.max - t.min) || e > 100 * (l.value - t.min) / (t.max - t.min)) : n.filter(
|
|
16
|
+
(e) => e > 100 * (i.firstValue - t.min) / (t.max - t.min)
|
|
17
|
+
);
|
|
18
|
+
}),
|
|
19
|
+
getStopStyle: (m) => t.vertical ? { bottom: `${m}%` } : { left: `${m}%` }
|
|
20
|
+
});
|
|
21
|
+
export {
|
|
22
|
+
y as useStops
|
|
23
|
+
};
|
|
@@ -0,0 +1,4 @@
|
|
|
1
|
+
import type { ComputedRef, SetupContext } from 'vue';
|
|
2
|
+
import type { FormItemContext } from '@element-plus/components/form';
|
|
3
|
+
import type { SliderEmits, SliderInitData, SliderProps } from '../slider';
|
|
4
|
+
export declare const useWatch: (props: SliderProps, initData: SliderInitData, minValue: ComputedRef<number>, maxValue: ComputedRef<number>, emit: SetupContext<SliderEmits>["emit"], elFormItem: FormItemContext) => void;
|
|
@@ -0,0 +1,42 @@
|
|
|
1
|
+
import { watch as l } from "vue";
|
|
2
|
+
import { UPDATE_MODEL_EVENT as m, INPUT_EVENT as T } from "../../../constants/event.js";
|
|
3
|
+
import { isNumber as _ } from "../../../utils/types.js";
|
|
4
|
+
import "lodash-unified";
|
|
5
|
+
import "@vueuse/core";
|
|
6
|
+
import { throwError as b } from "../../../utils/error.js";
|
|
7
|
+
import { isArray as V, NOOP as h } from "@vue/shared";
|
|
8
|
+
import "@element-plus/icons-vue";
|
|
9
|
+
const L = (i, a, E, v, g, f) => {
|
|
10
|
+
const n = (e) => {
|
|
11
|
+
g(m, e), g(T, e);
|
|
12
|
+
}, x = () => i.range ? ![E.value, v.value].every(
|
|
13
|
+
(e, u) => e === a.oldValue[u]
|
|
14
|
+
) : i.modelValue !== a.oldValue, d = () => {
|
|
15
|
+
var u, c;
|
|
16
|
+
i.min > i.max && b("Slider", "min should not be greater than max.");
|
|
17
|
+
const e = i.modelValue;
|
|
18
|
+
i.range && V(e) ? e[1] < i.min ? n([i.min, i.min]) : e[0] > i.max ? n([i.max, i.max]) : e[0] < i.min ? n([i.min, e[1]]) : e[1] > i.max ? n([e[0], i.max]) : (a.firstValue = e[0], a.secondValue = e[1], x() && (i.validateEvent && ((u = f == null ? void 0 : f.validate) == null || u.call(f, "change").catch(h)), a.oldValue = e.slice())) : !i.range && _(e) && !Number.isNaN(e) && (e < i.min ? n(i.min) : e > i.max ? n(i.max) : (a.firstValue = e, x() && (i.validateEvent && ((c = f == null ? void 0 : f.validate) == null || c.call(f, "change").catch(h)), a.oldValue = e)));
|
|
19
|
+
};
|
|
20
|
+
d(), l(
|
|
21
|
+
() => a.dragging,
|
|
22
|
+
(e) => {
|
|
23
|
+
e || d();
|
|
24
|
+
}
|
|
25
|
+
), l(
|
|
26
|
+
() => i.modelValue,
|
|
27
|
+
(e, u) => {
|
|
28
|
+
a.dragging || V(e) && V(u) && e.every((c, N) => c === u[N]) && a.firstValue === e[0] && a.secondValue === e[1] || d();
|
|
29
|
+
},
|
|
30
|
+
{
|
|
31
|
+
deep: !0
|
|
32
|
+
}
|
|
33
|
+
), l(
|
|
34
|
+
() => [i.min, i.max],
|
|
35
|
+
() => {
|
|
36
|
+
d();
|
|
37
|
+
}
|
|
38
|
+
);
|
|
39
|
+
};
|
|
40
|
+
export {
|
|
41
|
+
L as useWatch
|
|
42
|
+
};
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
import type { ComputedRef, InjectionKey, Ref, ToRefs } from 'vue';
|
|
2
|
+
import type { SliderProps } from './slider';
|
|
3
|
+
import type { Mark } from './composables/use-marks';
|
|
4
|
+
export interface SliderContext extends ToRefs<SliderProps> {
|
|
5
|
+
precision: ComputedRef<number>;
|
|
6
|
+
sliderSize: Ref<number>;
|
|
7
|
+
emitChange: () => void;
|
|
8
|
+
resetSize: () => void;
|
|
9
|
+
updateDragging: (val: boolean) => void;
|
|
10
|
+
disabled: ComputedRef<boolean>;
|
|
11
|
+
markList: ComputedRef<Mark[]>;
|
|
12
|
+
}
|
|
13
|
+
/**
|
|
14
|
+
* 本地 Symbol:父组件 `EpSlider.vue` 的 provide 与按钮/组合式逻辑的 inject
|
|
15
|
+
* 必须共用本模块导出的键,拿 element-plus 包内的同名 Symbol 会静默失效。
|
|
16
|
+
*/
|
|
17
|
+
export declare const sliderContextKey: InjectionKey<SliderContext>;
|