naive-ui 2.20.2 → 2.21.2
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/es/_internal/scrollbar/src/ScrollBar.d.ts +1 -0
- package/es/_internal/scrollbar/src/ScrollBar.js +9 -4
- package/es/_internal/select-menu/src/SelectMenu.d.ts +5 -1
- package/es/_internal/selection/src/Selection.d.ts +5 -1
- package/es/_internal/suffix/src/Suffix.d.ts +5 -2
- package/es/_internal/suffix/src/Suffix.js +4 -1
- package/es/_styles/common/dark.js +2 -1
- package/es/_styles/common/light.d.ts +4 -0
- package/es/_styles/common/light.js +5 -2
- package/es/_styles/global/index.cssr.js +9 -4
- package/es/_styles/transitions/icon-switch.cssr.js +6 -2
- package/es/_utils/naive/extract-public-props.d.ts +1 -1
- package/es/alert/src/Alert.d.ts +4 -0
- package/es/auto-complete/src/AutoComplete.d.ts +9 -1
- package/es/auto-complete/src/AutoComplete.js +5 -2
- package/es/avatar/src/Avatar.d.ts +8 -1
- package/es/avatar/src/Avatar.js +41 -9
- package/es/avatar/src/styles/index.cssr.js +2 -2
- package/es/button/src/Button.d.ts +149 -52
- package/es/button/src/Button.js +128 -56
- package/es/button/src/interface.d.ts +1 -1
- package/es/button/src/styles/button.cssr.js +1 -0
- package/es/button/styles/dark.js +3 -0
- package/es/button/styles/light.d.ts +14 -5
- package/es/button/styles/light.js +10 -3
- package/es/calendar/src/Calendar.d.ts +144 -50
- package/es/calendar/styles/light.d.ts +14 -5
- package/es/card/src/Card.d.ts +4 -0
- package/es/cascader/src/Cascader.d.ts +4 -0
- package/es/cascader/src/CascaderOption.d.ts +4 -0
- package/es/cascader/src/CascaderSelectMenu.d.ts +4 -0
- package/es/cascader/src/CascaderSubmenu.d.ts +4 -0
- package/es/checkbox/src/Checkbox.d.ts +9 -5
- package/es/checkbox/src/Checkbox.js +8 -9
- package/es/collapse/src/Collapse.d.ts +4 -0
- package/es/color-picker/src/ColorInputUnit.d.ts +18 -5
- package/es/color-picker/src/ColorPicker.d.ts +126 -45
- package/es/color-picker/styles/light.d.ts +14 -5
- package/es/data-table/src/DataTable.d.ts +184 -51
- package/es/data-table/src/DataTable.js +11 -6
- package/es/data-table/src/HeaderButton/FilterButton.d.ts +21 -5
- package/es/data-table/src/HeaderButton/FilterMenu.d.ts +22 -6
- package/es/data-table/src/TableParts/Body.d.ts +26 -6
- package/es/data-table/src/TableParts/Body.js +77 -39
- package/es/data-table/src/TableParts/BodyCheckbox.js +1 -1
- package/es/data-table/src/TableParts/Cell.d.ts +42 -10
- package/es/data-table/src/TableParts/Header.d.ts +21 -5
- package/es/data-table/src/TableParts/Header.js +1 -1
- package/es/data-table/src/interface.d.ts +4 -1
- package/es/data-table/src/styles/index.cssr.js +9 -10
- package/es/data-table/src/use-table-data.js +3 -3
- package/es/data-table/styles/light.d.ts +20 -5
- package/es/data-table/styles/light.js +4 -4
- package/es/date-picker/src/DatePicker.d.ts +329 -127
- package/es/date-picker/src/DatePicker.js +7 -17
- package/es/date-picker/src/config.d.ts +9 -0
- package/es/date-picker/src/config.js +8 -0
- package/es/date-picker/src/panel/date.d.ts +53 -20
- package/es/date-picker/src/panel/daterange.d.ts +52 -19
- package/es/date-picker/src/panel/datetime.d.ts +53 -20
- package/es/date-picker/src/panel/datetimerange.d.ts +52 -19
- package/es/date-picker/src/panel/month.d.ts +88 -61
- package/es/date-picker/src/panel/month.js +9 -6
- package/es/date-picker/src/panel/use-calendar.d.ts +61 -28
- package/es/date-picker/src/panel/use-calendar.js +9 -2
- package/es/date-picker/src/panel/use-dual-calendar.d.ts +50 -17
- package/es/date-picker/src/panel/use-dual-calendar.js +4 -0
- package/es/date-picker/src/panel/use-panel-common.d.ts +48 -15
- package/es/date-picker/styles/_common.d.ts +2 -0
- package/es/date-picker/styles/_common.js +3 -1
- package/es/date-picker/styles/light.d.ts +32 -10
- package/es/dialog/src/Dialog.d.ts +105 -38
- package/es/dialog/src/DialogEnvironment.d.ts +2 -2
- package/es/dialog/src/DialogProvider.d.ts +2 -2
- package/es/dialog/styles/light.d.ts +14 -5
- package/es/drawer/src/Drawer.d.ts +4 -0
- package/es/drawer/src/DrawerBodyWrapper.d.ts +4 -0
- package/es/drawer/src/DrawerContent.d.ts +4 -0
- package/es/dropdown/index.d.ts +1 -1
- package/es/dropdown/src/Dropdown.d.ts +11 -7
- package/es/dropdown/src/DropdownGroup.d.ts +2 -3
- package/es/dropdown/src/DropdownGroupHeader.js +3 -3
- package/es/dropdown/src/DropdownMenu.d.ts +3 -4
- package/es/dropdown/src/DropdownMenu.js +5 -4
- package/es/dropdown/src/DropdownOption.d.ts +3 -4
- package/es/dropdown/src/DropdownOption.js +5 -4
- package/es/dropdown/src/DropdownRenderOption.d.ts +2 -3
- package/es/dropdown/src/interface.d.ts +9 -30
- package/es/dynamic-input/src/DynamicInput.d.ts +144 -50
- package/es/dynamic-input/src/InputPreset.d.ts +18 -5
- package/es/dynamic-input/src/PairPreset.d.ts +18 -5
- package/es/dynamic-input/styles/light.d.ts +14 -5
- package/es/dynamic-tags/src/DynamicTags.d.ts +145 -50
- package/es/dynamic-tags/styles/light.d.ts +14 -5
- package/es/ellipsis/src/Ellipsis.d.ts +4 -0
- package/es/form/src/FormItemGridItem.d.ts +2 -2
- package/es/global-style/src/GlobalStyle.js +2 -0
- package/es/grid/src/Grid.js +1 -0
- package/es/grid/src/GridItem.d.ts +2 -2
- package/es/image/src/ImagePreview.d.ts +1 -0
- package/es/image/src/ImagePreview.js +51 -4
- package/es/image/src/interface.d.ts +6 -0
- package/es/image/src/interface.js +1 -0
- package/es/input/src/Input.d.ts +5 -0
- package/es/input/src/Input.js +9 -3
- package/es/input/src/interface.d.ts +1 -0
- package/es/input-number/src/InputNumber.d.ts +179 -50
- package/es/input-number/src/InputNumber.js +22 -6
- package/es/input-number/styles/light.d.ts +14 -5
- package/es/layout/src/Layout.d.ts +8 -0
- package/es/layout/src/LayoutContent.d.ts +4 -0
- package/es/layout/src/LayoutSider.d.ts +4 -0
- package/es/locales/index.d.ts +2 -0
- package/es/locales/index.js +1 -0
- package/es/locales/utils/index.d.ts +8 -0
- package/es/locales/utils/index.js +4 -0
- package/es/log/src/Log.d.ts +10 -25
- package/es/log/src/Log.js +2 -11
- package/es/log/src/LogLine.d.ts +1 -0
- package/es/log/src/LogLine.js +12 -10
- package/es/mention/src/Mention.d.ts +5 -0
- package/es/menu/index.d.ts +1 -1
- package/es/menu/src/Menu.d.ts +33 -8
- package/es/menu/src/Menu.js +32 -10
- package/es/menu/src/MenuDivider.d.ts +2 -0
- package/es/menu/src/MenuDivider.js +11 -0
- package/es/menu/src/MenuOption.d.ts +12 -2
- package/es/menu/src/MenuOptionContent.d.ts +7 -2
- package/es/menu/src/Submenu.d.ts +21 -17
- package/es/menu/src/interface.d.ts +23 -4
- package/es/menu/src/styles/index.cssr.js +6 -1
- package/es/menu/src/utils.d.ts +4 -2
- package/es/menu/src/utils.js +16 -2
- package/es/menu/styles/light.d.ts +2 -0
- package/es/menu/styles/light.js +3 -2
- package/es/modal/src/BodyWrapper.d.ts +34 -12
- package/es/modal/src/Modal.d.ts +174 -66
- package/es/modal/src/presetProps.d.ts +1 -1
- package/es/modal/styles/light.d.ts +14 -5
- package/es/notification/src/NotificationContainer.d.ts +11 -0
- package/es/notification/src/NotificationContainer.js +7 -2
- package/es/notification/src/NotificationProvider.d.ts +17 -0
- package/es/notification/src/NotificationProvider.js +38 -3
- package/es/notification/src/styles/index.cssr.d.ts +2 -1
- package/es/notification/src/styles/index.cssr.js +41 -12
- package/es/pagination/index.d.ts +1 -1
- package/es/pagination/src/Pagination.d.ts +21 -12
- package/es/pagination/src/Pagination.js +16 -6
- package/es/pagination/src/interface.d.ts +2 -0
- package/es/popconfirm/src/Popconfirm.d.ts +151 -57
- package/es/popconfirm/src/PopconfirmPanel.d.ts +2 -2
- package/es/popconfirm/styles/light.d.ts +14 -5
- package/es/popover/src/Popover.d.ts +6 -6
- package/es/popover/src/Popover.js +2 -5
- package/es/popover/src/PopoverBody.d.ts +5 -5
- package/es/popover/src/PopoverBody.js +2 -1
- package/es/popover/src/styles/index.cssr.js +0 -1
- package/es/popselect/src/Popselect.d.ts +9 -5
- package/es/popselect/src/PopselectPanel.d.ts +4 -0
- package/es/radio/src/Radio.d.ts +3 -0
- package/es/radio/src/RadioButton.d.ts +3 -0
- package/es/radio/src/use-radio.d.ts +2 -0
- package/es/radio/src/use-radio.js +6 -3
- package/es/select/src/Select.d.ts +4 -0
- package/es/slider/src/Slider.d.ts +71 -91
- package/es/slider/src/Slider.js +342 -583
- package/es/slider/src/interface.d.ts +1 -1
- package/es/slider/src/styles/index.cssr.js +86 -16
- package/es/slider/src/utils.d.ts +10 -1
- package/es/slider/src/utils.js +9 -0
- package/es/slider/styles/_common.d.ts +1 -0
- package/es/slider/styles/_common.js +1 -0
- package/es/slider/styles/light.d.ts +1 -0
- package/es/space/src/Space.js +2 -0
- package/es/steps/src/Step.js +1 -1
- package/es/table/src/Table.d.ts +35 -0
- package/es/table/src/Table.js +8 -4
- package/es/table/src/styles/index.cssr.js +1 -1
- package/es/table/styles/light.d.ts +3 -0
- package/es/table/styles/light.js +2 -2
- package/es/tabs/index.d.ts +2 -0
- package/es/tabs/index.js +1 -0
- package/es/tabs/src/Tab.d.ts +35 -18
- package/es/tabs/src/Tab.js +11 -12
- package/es/tabs/src/Tabs.js +58 -18
- package/es/tag/src/Tag.d.ts +8 -3
- package/es/tag/src/Tag.js +10 -2
- package/es/tag/src/styles/index.cssr.js +10 -5
- package/es/tag/src/styles/rtl.cssr.js +7 -1
- package/es/theme-editor/src/ThemeEditor.d.ts +4 -0
- package/es/time-picker/src/Panel.d.ts +18 -5
- package/es/time-picker/src/TimePicker.d.ts +145 -50
- package/es/time-picker/src/TimePicker.js +3 -0
- package/es/time-picker/styles/light.d.ts +14 -5
- package/es/tooltip/src/Tooltip.d.ts +9 -5
- package/es/transfer/src/Transfer.d.ts +146 -52
- package/es/transfer/src/TransferFilter.d.ts +18 -5
- package/es/transfer/src/TransferList.d.ts +18 -5
- package/es/transfer/src/TransferListItem.d.ts +18 -5
- package/es/transfer/styles/light.d.ts +14 -5
- package/es/tree/src/Tree.d.ts +10 -6
- package/es/tree/src/TreeNodeCheckbox.d.ts +4 -0
- package/es/tree/src/TreeNodeSwitcher.d.ts +1 -1
- package/es/tree-select/src/TreeSelect.d.ts +6 -2
- package/es/upload/index.d.ts +1 -2
- package/es/upload/src/Upload.d.ts +151 -59
- package/es/upload/src/Upload.js +69 -16
- package/es/upload/src/UploadFile.d.ts +19 -6
- package/es/upload/src/UploadProgress.d.ts +18 -5
- package/es/upload/src/interface.d.ts +14 -1
- package/es/upload/styles/light.d.ts +14 -5
- package/es/version.d.ts +1 -1
- package/es/version.js +1 -1
- package/lib/_internal/scrollbar/src/ScrollBar.d.ts +1 -0
- package/lib/_internal/scrollbar/src/ScrollBar.js +9 -4
- package/lib/_internal/select-menu/src/SelectMenu.d.ts +5 -1
- package/lib/_internal/selection/src/Selection.d.ts +5 -1
- package/lib/_internal/suffix/src/Suffix.d.ts +5 -2
- package/lib/_internal/suffix/src/Suffix.js +4 -1
- package/lib/_styles/common/dark.js +2 -1
- package/lib/_styles/common/light.d.ts +4 -0
- package/lib/_styles/common/light.js +5 -2
- package/lib/_styles/global/index.cssr.js +10 -5
- package/lib/_styles/transitions/icon-switch.cssr.js +7 -2
- package/lib/_utils/naive/extract-public-props.d.ts +1 -1
- package/lib/alert/src/Alert.d.ts +4 -0
- package/lib/auto-complete/src/AutoComplete.d.ts +9 -1
- package/lib/auto-complete/src/AutoComplete.js +5 -2
- package/lib/avatar/src/Avatar.d.ts +8 -1
- package/lib/avatar/src/Avatar.js +40 -8
- package/lib/avatar/src/styles/index.cssr.js +2 -2
- package/lib/button/src/Button.d.ts +149 -52
- package/lib/button/src/Button.js +126 -54
- package/lib/button/src/interface.d.ts +1 -1
- package/lib/button/src/styles/button.cssr.js +1 -0
- package/lib/button/styles/dark.js +3 -0
- package/lib/button/styles/light.d.ts +14 -5
- package/lib/button/styles/light.js +10 -3
- package/lib/calendar/src/Calendar.d.ts +144 -50
- package/lib/calendar/styles/light.d.ts +14 -5
- package/lib/card/src/Card.d.ts +4 -0
- package/lib/cascader/src/Cascader.d.ts +4 -0
- package/lib/cascader/src/CascaderOption.d.ts +4 -0
- package/lib/cascader/src/CascaderSelectMenu.d.ts +4 -0
- package/lib/cascader/src/CascaderSubmenu.d.ts +4 -0
- package/lib/checkbox/src/Checkbox.d.ts +9 -5
- package/lib/checkbox/src/Checkbox.js +8 -9
- package/lib/collapse/src/Collapse.d.ts +4 -0
- package/lib/color-picker/src/ColorInputUnit.d.ts +18 -5
- package/lib/color-picker/src/ColorPicker.d.ts +126 -45
- package/lib/color-picker/styles/light.d.ts +14 -5
- package/lib/data-table/src/DataTable.d.ts +184 -51
- package/lib/data-table/src/DataTable.js +11 -6
- package/lib/data-table/src/HeaderButton/FilterButton.d.ts +21 -5
- package/lib/data-table/src/HeaderButton/FilterMenu.d.ts +22 -6
- package/lib/data-table/src/TableParts/Body.d.ts +26 -6
- package/lib/data-table/src/TableParts/Body.js +77 -39
- package/lib/data-table/src/TableParts/BodyCheckbox.js +1 -1
- package/lib/data-table/src/TableParts/Cell.d.ts +42 -10
- package/lib/data-table/src/TableParts/Header.d.ts +21 -5
- package/lib/data-table/src/TableParts/Header.js +1 -1
- package/lib/data-table/src/interface.d.ts +4 -1
- package/lib/data-table/src/styles/index.cssr.js +9 -10
- package/lib/data-table/src/use-table-data.js +3 -3
- package/lib/data-table/styles/light.d.ts +20 -5
- package/lib/data-table/styles/light.js +4 -4
- package/lib/date-picker/src/DatePicker.d.ts +329 -127
- package/lib/date-picker/src/DatePicker.js +7 -17
- package/lib/date-picker/src/config.d.ts +9 -0
- package/lib/date-picker/src/config.js +9 -1
- package/lib/date-picker/src/panel/date.d.ts +53 -20
- package/lib/date-picker/src/panel/daterange.d.ts +52 -19
- package/lib/date-picker/src/panel/datetime.d.ts +53 -20
- package/lib/date-picker/src/panel/datetimerange.d.ts +52 -19
- package/lib/date-picker/src/panel/month.d.ts +88 -61
- package/lib/date-picker/src/panel/month.js +9 -6
- package/lib/date-picker/src/panel/use-calendar.d.ts +61 -28
- package/lib/date-picker/src/panel/use-calendar.js +8 -1
- package/lib/date-picker/src/panel/use-dual-calendar.d.ts +50 -17
- package/lib/date-picker/src/panel/use-dual-calendar.js +4 -0
- package/lib/date-picker/src/panel/use-panel-common.d.ts +48 -15
- package/lib/date-picker/styles/_common.d.ts +2 -0
- package/lib/date-picker/styles/_common.js +3 -1
- package/lib/date-picker/styles/light.d.ts +32 -10
- package/lib/dialog/src/Dialog.d.ts +105 -38
- package/lib/dialog/src/DialogEnvironment.d.ts +2 -2
- package/lib/dialog/src/DialogProvider.d.ts +2 -2
- package/lib/dialog/styles/light.d.ts +14 -5
- package/lib/drawer/src/Drawer.d.ts +4 -0
- package/lib/drawer/src/DrawerBodyWrapper.d.ts +4 -0
- package/lib/drawer/src/DrawerContent.d.ts +4 -0
- package/lib/dropdown/index.d.ts +1 -1
- package/lib/dropdown/src/Dropdown.d.ts +11 -7
- package/lib/dropdown/src/DropdownGroup.d.ts +2 -3
- package/lib/dropdown/src/DropdownGroupHeader.js +3 -3
- package/lib/dropdown/src/DropdownMenu.d.ts +3 -4
- package/lib/dropdown/src/DropdownMenu.js +5 -4
- package/lib/dropdown/src/DropdownOption.d.ts +3 -4
- package/lib/dropdown/src/DropdownOption.js +5 -4
- package/lib/dropdown/src/DropdownRenderOption.d.ts +2 -3
- package/lib/dropdown/src/interface.d.ts +9 -30
- package/lib/dynamic-input/src/DynamicInput.d.ts +144 -50
- package/lib/dynamic-input/src/InputPreset.d.ts +18 -5
- package/lib/dynamic-input/src/PairPreset.d.ts +18 -5
- package/lib/dynamic-input/styles/light.d.ts +14 -5
- package/lib/dynamic-tags/src/DynamicTags.d.ts +145 -50
- package/lib/dynamic-tags/styles/light.d.ts +14 -5
- package/lib/ellipsis/src/Ellipsis.d.ts +4 -0
- package/lib/form/src/FormItemGridItem.d.ts +2 -2
- package/lib/global-style/src/GlobalStyle.js +2 -0
- package/lib/grid/src/Grid.js +1 -0
- package/lib/grid/src/GridItem.d.ts +2 -2
- package/lib/image/src/ImagePreview.d.ts +1 -0
- package/lib/image/src/ImagePreview.js +51 -4
- package/lib/image/src/interface.d.ts +6 -0
- package/lib/image/src/interface.js +2 -0
- package/lib/input/src/Input.d.ts +5 -0
- package/lib/input/src/Input.js +9 -3
- package/lib/input/src/interface.d.ts +1 -0
- package/lib/input-number/src/InputNumber.d.ts +179 -50
- package/lib/input-number/src/InputNumber.js +22 -6
- package/lib/input-number/styles/light.d.ts +14 -5
- package/lib/layout/src/Layout.d.ts +8 -0
- package/lib/layout/src/LayoutContent.d.ts +4 -0
- package/lib/layout/src/LayoutSider.d.ts +4 -0
- package/lib/locales/index.d.ts +2 -0
- package/lib/locales/index.js +3 -1
- package/lib/locales/utils/index.d.ts +8 -0
- package/lib/locales/utils/index.js +8 -0
- package/lib/log/src/Log.d.ts +10 -25
- package/lib/log/src/Log.js +2 -11
- package/lib/log/src/LogLine.d.ts +1 -0
- package/lib/log/src/LogLine.js +11 -9
- package/lib/mention/src/Mention.d.ts +5 -0
- package/lib/menu/index.d.ts +1 -1
- package/lib/menu/src/Menu.d.ts +33 -8
- package/lib/menu/src/Menu.js +31 -9
- package/lib/menu/src/MenuDivider.d.ts +2 -0
- package/lib/menu/src/MenuDivider.js +13 -0
- package/lib/menu/src/MenuOption.d.ts +12 -2
- package/lib/menu/src/MenuOptionContent.d.ts +7 -2
- package/lib/menu/src/Submenu.d.ts +21 -17
- package/lib/menu/src/interface.d.ts +23 -4
- package/lib/menu/src/styles/index.cssr.js +6 -1
- package/lib/menu/src/utils.d.ts +4 -2
- package/lib/menu/src/utils.js +22 -3
- package/lib/menu/styles/light.d.ts +2 -0
- package/lib/menu/styles/light.js +3 -2
- package/lib/modal/src/BodyWrapper.d.ts +34 -12
- package/lib/modal/src/Modal.d.ts +174 -66
- package/lib/modal/src/presetProps.d.ts +1 -1
- package/lib/modal/styles/light.d.ts +14 -5
- package/lib/notification/src/NotificationContainer.d.ts +11 -0
- package/lib/notification/src/NotificationContainer.js +7 -2
- package/lib/notification/src/NotificationProvider.d.ts +17 -0
- package/lib/notification/src/NotificationProvider.js +38 -3
- package/lib/notification/src/styles/index.cssr.d.ts +2 -1
- package/lib/notification/src/styles/index.cssr.js +41 -12
- package/lib/pagination/index.d.ts +1 -1
- package/lib/pagination/src/Pagination.d.ts +21 -12
- package/lib/pagination/src/Pagination.js +16 -6
- package/lib/pagination/src/interface.d.ts +2 -0
- package/lib/popconfirm/src/Popconfirm.d.ts +151 -57
- package/lib/popconfirm/src/PopconfirmPanel.d.ts +2 -2
- package/lib/popconfirm/styles/light.d.ts +14 -5
- package/lib/popover/src/Popover.d.ts +6 -6
- package/lib/popover/src/Popover.js +2 -5
- package/lib/popover/src/PopoverBody.d.ts +5 -5
- package/lib/popover/src/PopoverBody.js +2 -1
- package/lib/popover/src/styles/index.cssr.js +0 -1
- package/lib/popselect/src/Popselect.d.ts +9 -5
- package/lib/popselect/src/PopselectPanel.d.ts +4 -0
- package/lib/radio/src/Radio.d.ts +3 -0
- package/lib/radio/src/RadioButton.d.ts +3 -0
- package/lib/radio/src/use-radio.d.ts +2 -0
- package/lib/radio/src/use-radio.js +6 -3
- package/lib/select/src/Select.d.ts +4 -0
- package/lib/slider/src/Slider.d.ts +71 -91
- package/lib/slider/src/Slider.js +340 -581
- package/lib/slider/src/interface.d.ts +1 -1
- package/lib/slider/src/styles/index.cssr.js +86 -16
- package/lib/slider/src/utils.d.ts +10 -1
- package/lib/slider/src/utils.js +11 -1
- package/lib/slider/styles/_common.d.ts +1 -0
- package/lib/slider/styles/_common.js +1 -0
- package/lib/slider/styles/light.d.ts +1 -0
- package/lib/space/src/Space.js +2 -0
- package/lib/steps/src/Step.js +1 -1
- package/lib/table/src/Table.d.ts +35 -0
- package/lib/table/src/Table.js +8 -4
- package/lib/table/src/styles/index.cssr.js +1 -1
- package/lib/table/styles/light.d.ts +3 -0
- package/lib/table/styles/light.js +2 -2
- package/lib/tabs/index.d.ts +2 -0
- package/lib/tabs/index.js +3 -1
- package/lib/tabs/src/Tab.d.ts +35 -18
- package/lib/tabs/src/Tab.js +10 -11
- package/lib/tabs/src/Tabs.js +57 -17
- package/lib/tag/src/Tag.d.ts +8 -3
- package/lib/tag/src/Tag.js +10 -1
- package/lib/tag/src/styles/index.cssr.js +10 -5
- package/lib/tag/src/styles/rtl.cssr.js +7 -1
- package/lib/theme-editor/src/ThemeEditor.d.ts +4 -0
- package/lib/time-picker/src/Panel.d.ts +18 -5
- package/lib/time-picker/src/TimePicker.d.ts +145 -50
- package/lib/time-picker/src/TimePicker.js +3 -0
- package/lib/time-picker/styles/light.d.ts +14 -5
- package/lib/tooltip/src/Tooltip.d.ts +9 -5
- package/lib/transfer/src/Transfer.d.ts +146 -52
- package/lib/transfer/src/TransferFilter.d.ts +18 -5
- package/lib/transfer/src/TransferList.d.ts +18 -5
- package/lib/transfer/src/TransferListItem.d.ts +18 -5
- package/lib/transfer/styles/light.d.ts +14 -5
- package/lib/tree/src/Tree.d.ts +10 -6
- package/lib/tree/src/TreeNodeCheckbox.d.ts +4 -0
- package/lib/tree/src/TreeNodeSwitcher.d.ts +1 -1
- package/lib/tree-select/src/TreeSelect.d.ts +6 -2
- package/lib/upload/index.d.ts +1 -2
- package/lib/upload/src/Upload.d.ts +151 -59
- package/lib/upload/src/Upload.js +69 -16
- package/lib/upload/src/UploadFile.d.ts +19 -6
- package/lib/upload/src/UploadProgress.d.ts +18 -5
- package/lib/upload/src/interface.d.ts +14 -1
- package/lib/upload/styles/light.d.ts +14 -5
- package/lib/version.d.ts +1 -1
- package/lib/version.js +1 -1
- package/package.json +10 -9
- package/web-types.json +205 -14
package/lib/slider/src/Slider.js
CHANGED
|
@@ -10,8 +10,10 @@ const evtd_1 = require("evtd");
|
|
|
10
10
|
const _mixins_1 = require("../../_mixins");
|
|
11
11
|
const _utils_1 = require("../../_utils");
|
|
12
12
|
const styles_1 = require("../styles");
|
|
13
|
-
const index_cssr_1 = __importDefault(require("./styles/index.cssr"));
|
|
14
13
|
const utils_1 = require("./utils");
|
|
14
|
+
const index_cssr_1 = __importDefault(require("./styles/index.cssr"));
|
|
15
|
+
// ref: https://developer.mozilla.org/zh-CN/docs/Web/API/MouseEvent/button
|
|
16
|
+
const eventButtonLeft = 0;
|
|
15
17
|
const sliderProps = Object.assign(Object.assign({}, _mixins_1.useTheme.props), { to: _utils_1.useAdjustedTo.propTo, defaultValue: {
|
|
16
18
|
type: [Number, Array],
|
|
17
19
|
default: 0
|
|
@@ -25,150 +27,149 @@ const sliderProps = Object.assign(Object.assign({}, _mixins_1.useTheme.props), {
|
|
|
25
27
|
type: Number,
|
|
26
28
|
default: 100
|
|
27
29
|
}, step: {
|
|
28
|
-
type: Number,
|
|
30
|
+
type: [Number, String],
|
|
29
31
|
default: 1
|
|
30
|
-
}, range: Boolean, value: [Number, Array], placement: {
|
|
31
|
-
type: String,
|
|
32
|
-
default: 'top'
|
|
33
|
-
}, showTooltip: {
|
|
32
|
+
}, range: Boolean, value: [Number, Array], placement: String, showTooltip: {
|
|
34
33
|
type: Boolean,
|
|
35
34
|
default: undefined
|
|
36
35
|
}, tooltip: {
|
|
37
36
|
type: Boolean,
|
|
38
37
|
default: true
|
|
39
|
-
}, 'onUpdate:value': [Function, Array], onUpdateValue: [Function, Array]
|
|
40
|
-
// deprecated
|
|
41
|
-
onChange: {
|
|
42
|
-
type: [Function, Array],
|
|
43
|
-
validator: () => {
|
|
44
|
-
if (process.env.NODE_ENV !== 'production') {
|
|
45
|
-
(0, _utils_1.warn)('slider', '`on-change` is deprecated, please use `on-update:value` instead.');
|
|
46
|
-
}
|
|
47
|
-
return true;
|
|
48
|
-
},
|
|
49
|
-
default: undefined
|
|
50
|
-
} });
|
|
38
|
+
}, vertical: Boolean, reverse: Boolean, 'onUpdate:value': [Function, Array], onUpdateValue: [Function, Array] });
|
|
51
39
|
exports.default = (0, vue_1.defineComponent)({
|
|
52
40
|
name: 'Slider',
|
|
53
41
|
props: sliderProps,
|
|
54
42
|
setup(props) {
|
|
55
43
|
const { mergedClsPrefixRef, namespaceRef } = (0, _mixins_1.useConfig)(props);
|
|
56
44
|
const themeRef = (0, _mixins_1.useTheme)('Slider', 'Slider', index_cssr_1.default, styles_1.sliderLight, props, mergedClsPrefixRef);
|
|
45
|
+
// dom ref
|
|
46
|
+
const handleRailRef = (0, vue_1.ref)(null);
|
|
47
|
+
const [handleRefs, setHandleRefs] = (0, utils_1.useRefs)();
|
|
48
|
+
const [followerRefs, setFollowerRefs] = (0, utils_1.useRefs)();
|
|
49
|
+
const followerEnabledIndexSetRef = (0, vue_1.ref)(new Set());
|
|
50
|
+
// data ref
|
|
57
51
|
const formItem = (0, _mixins_1.useFormItem)(props);
|
|
58
52
|
const { mergedDisabledRef } = formItem;
|
|
59
|
-
const handleRef1 = (0, vue_1.ref)(null);
|
|
60
|
-
const handleRef2 = (0, vue_1.ref)(null);
|
|
61
|
-
const railRef = (0, vue_1.ref)(null);
|
|
62
|
-
const followerRef1 = (0, vue_1.ref)(null);
|
|
63
|
-
const followerRef2 = (0, vue_1.ref)(null);
|
|
64
53
|
const precisionRef = (0, vue_1.computed)(() => {
|
|
65
|
-
const
|
|
66
|
-
|
|
67
|
-
return
|
|
68
|
-
|
|
69
|
-
|
|
54
|
+
const { step } = props;
|
|
55
|
+
if (step <= 0 || step === 'mark')
|
|
56
|
+
return 0;
|
|
57
|
+
const stepString = step.toString();
|
|
58
|
+
let precision = 0;
|
|
59
|
+
if (stepString.includes('.')) {
|
|
60
|
+
precision = stepString.length - stepString.indexOf('.') - 1;
|
|
61
|
+
}
|
|
62
|
+
return precision;
|
|
70
63
|
});
|
|
71
64
|
const uncontrolledValueRef = (0, vue_1.ref)(props.defaultValue);
|
|
72
65
|
const controlledValueRef = (0, vue_1.toRef)(props, 'value');
|
|
73
66
|
const mergedValueRef = (0, vooks_1.useMergedState)(controlledValueRef, uncontrolledValueRef);
|
|
74
|
-
const
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
const
|
|
79
|
-
const
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
67
|
+
const arrifiedValueRef = (0, vue_1.computed)(() => {
|
|
68
|
+
const { value: mergedValue } = mergedValueRef;
|
|
69
|
+
return (props.range ? mergedValue : [mergedValue]).map(clampValue);
|
|
70
|
+
});
|
|
71
|
+
const handleCountExceeds2Ref = (0, vue_1.computed)(() => arrifiedValueRef.value.length > 2);
|
|
72
|
+
const mergedPlacementRef = (0, vue_1.computed)(() => {
|
|
73
|
+
return props.placement === undefined
|
|
74
|
+
? props.vertical
|
|
75
|
+
? 'right'
|
|
76
|
+
: 'top'
|
|
77
|
+
: props.placement;
|
|
78
|
+
});
|
|
79
|
+
const markValuesRef = (0, vue_1.computed)(() => {
|
|
80
|
+
const { marks } = props;
|
|
81
|
+
return marks ? Object.keys(marks).map(parseFloat) : null;
|
|
82
|
+
});
|
|
83
|
+
// status ref
|
|
84
|
+
const activeIndexRef = (0, vue_1.ref)(-1);
|
|
85
|
+
const previousIndexRef = (0, vue_1.ref)(-1);
|
|
86
|
+
const hoverIndexRef = (0, vue_1.ref)(-1);
|
|
87
|
+
const draggingRef = (0, vue_1.ref)(false);
|
|
88
|
+
// style ref
|
|
83
89
|
const dotTransitionDisabledRef = (0, vue_1.ref)(false);
|
|
84
|
-
const
|
|
85
|
-
|
|
90
|
+
const styleDirectionRef = (0, vue_1.computed)(() => {
|
|
91
|
+
const { vertical, reverse } = props;
|
|
92
|
+
const left = reverse ? 'right' : 'left';
|
|
93
|
+
const bottom = reverse ? 'top' : 'bottom';
|
|
94
|
+
return vertical ? bottom : left;
|
|
86
95
|
});
|
|
87
|
-
const
|
|
88
|
-
|
|
89
|
-
|
|
96
|
+
const fillStyleRef = (0, vue_1.computed)(() => {
|
|
97
|
+
if (handleCountExceeds2Ref.value)
|
|
98
|
+
return;
|
|
99
|
+
const values = arrifiedValueRef.value;
|
|
100
|
+
const start = valueToPercentage(props.range ? Math.min(...values) : props.min);
|
|
101
|
+
const end = valueToPercentage(props.range ? Math.max(...values) : values[0]);
|
|
102
|
+
const { value: styleDirection } = styleDirectionRef;
|
|
103
|
+
return props.vertical
|
|
104
|
+
? {
|
|
105
|
+
[styleDirection]: `${start}%`,
|
|
106
|
+
height: `${end - start}%`
|
|
107
|
+
}
|
|
108
|
+
: {
|
|
109
|
+
[styleDirection]: `${start}%`,
|
|
110
|
+
width: `${end - start}%`
|
|
111
|
+
};
|
|
90
112
|
});
|
|
91
113
|
const markInfosRef = (0, vue_1.computed)(() => {
|
|
92
114
|
const mergedMarks = [];
|
|
93
|
-
const { marks
|
|
115
|
+
const { marks } = props;
|
|
94
116
|
if (marks) {
|
|
95
|
-
const
|
|
117
|
+
const orderValues = arrifiedValueRef.value.slice();
|
|
118
|
+
orderValues.sort((a, b) => a - b);
|
|
119
|
+
const { value: styleDirection } = styleDirectionRef;
|
|
120
|
+
const { value: handleCountExceeds2 } = handleCountExceeds2Ref;
|
|
121
|
+
const { range } = props;
|
|
122
|
+
const isActive = handleCountExceeds2
|
|
123
|
+
? () => false
|
|
124
|
+
: (num) => range
|
|
125
|
+
? num >= orderValues[0] &&
|
|
126
|
+
num <= orderValues[orderValues.length - 1]
|
|
127
|
+
: num <= orderValues[0];
|
|
96
128
|
for (const key of Object.keys(marks)) {
|
|
97
129
|
const num = Number(key);
|
|
98
130
|
mergedMarks.push({
|
|
99
|
-
active:
|
|
100
|
-
? mergedValue[0] <= num && mergedValue[1] >= num
|
|
101
|
-
: mergedValue !== null
|
|
102
|
-
? mergedValue >= num
|
|
103
|
-
: false,
|
|
131
|
+
active: isActive(num),
|
|
104
132
|
label: marks[key],
|
|
105
133
|
style: {
|
|
106
|
-
|
|
134
|
+
[styleDirection]: `${valueToPercentage(num)}%`
|
|
107
135
|
}
|
|
108
136
|
});
|
|
109
137
|
}
|
|
110
138
|
}
|
|
111
139
|
return mergedMarks;
|
|
112
140
|
});
|
|
113
|
-
|
|
114
|
-
const
|
|
115
|
-
|
|
116
|
-
return {
|
|
117
|
-
left: `${((handleValue1Ref.value - min) / (max - min)) * 100}%`,
|
|
118
|
-
width: `${((handleValue2Ref.value - handleValue1Ref.value) / (max - min)) *
|
|
119
|
-
100}%`
|
|
120
|
-
};
|
|
121
|
-
}
|
|
122
|
-
else {
|
|
123
|
-
return {
|
|
124
|
-
left: 0,
|
|
125
|
-
width: `${((handleValue1Ref.value - min) / (max - min)) * 100}%`
|
|
126
|
-
};
|
|
127
|
-
}
|
|
128
|
-
});
|
|
129
|
-
const handleValue1Ref = (0, vue_1.computed)(() => {
|
|
130
|
-
const { value: mergedValue } = mergedValueRef;
|
|
131
|
-
if (Array.isArray(mergedValue)) {
|
|
132
|
-
return sanitizeValue(mergedValue[0]);
|
|
133
|
-
}
|
|
134
|
-
else {
|
|
135
|
-
return sanitizeValue(mergedValue);
|
|
136
|
-
}
|
|
137
|
-
});
|
|
138
|
-
const handleValue2Ref = (0, vue_1.computed)(() => {
|
|
139
|
-
const { value: mergedValue } = mergedValueRef;
|
|
140
|
-
if (Array.isArray(mergedValue)) {
|
|
141
|
-
return sanitizeValue(mergedValue[1]);
|
|
142
|
-
}
|
|
143
|
-
return 0;
|
|
144
|
-
});
|
|
145
|
-
const firstHandleStyleRef = (0, vue_1.computed)(() => {
|
|
146
|
-
const { value: handleValue1 } = handleValue1Ref;
|
|
147
|
-
const { value: handleClicked1 } = handleClicked1Ref;
|
|
148
|
-
const { max, min } = props;
|
|
149
|
-
const percentage = ((handleValue1 - min) / (max - min)) * 100;
|
|
150
|
-
return {
|
|
151
|
-
left: `${percentage}%`,
|
|
152
|
-
transform: `translateX(${-percentage}%)`,
|
|
153
|
-
zIndex: handleClicked1 ? 1 : 0
|
|
154
|
-
};
|
|
155
|
-
});
|
|
156
|
-
const secondHandleStyleRef = (0, vue_1.computed)(() => {
|
|
157
|
-
const { value: handleValue2 } = handleValue2Ref;
|
|
158
|
-
const { value: handleClicked2 } = handleClicked2Ref;
|
|
159
|
-
const { max, min } = props;
|
|
160
|
-
const percentage = ((handleValue2 - min) / (max - min)) * 100;
|
|
141
|
+
function getHandleStyle(value, index) {
|
|
142
|
+
const percentage = valueToPercentage(value);
|
|
143
|
+
const { value: styleDirection } = styleDirectionRef;
|
|
161
144
|
return {
|
|
162
|
-
|
|
163
|
-
|
|
164
|
-
zIndex: handleClicked2 ? 1 : 0
|
|
145
|
+
[styleDirection]: `${percentage}%`,
|
|
146
|
+
zIndex: index === activeIndexRef.value ? 1 : 0
|
|
165
147
|
};
|
|
166
|
-
}
|
|
148
|
+
}
|
|
149
|
+
function isShowTooltip(index) {
|
|
150
|
+
return (props.showTooltip ||
|
|
151
|
+
hoverIndexRef.value === index ||
|
|
152
|
+
(activeIndexRef.value === index && draggingRef.value));
|
|
153
|
+
}
|
|
154
|
+
function isSkipCSSDetection(index) {
|
|
155
|
+
return !(activeIndexRef.value === index && previousIndexRef.value === index);
|
|
156
|
+
}
|
|
157
|
+
function focusActiveHandle(index) {
|
|
158
|
+
var _a;
|
|
159
|
+
if (~index) {
|
|
160
|
+
activeIndexRef.value = index;
|
|
161
|
+
(_a = handleRefs.value.get(index)) === null || _a === void 0 ? void 0 : _a.focus();
|
|
162
|
+
}
|
|
163
|
+
}
|
|
164
|
+
function syncPosition() {
|
|
165
|
+
followerRefs.value.forEach((inst, index) => {
|
|
166
|
+
if (isShowTooltip(index))
|
|
167
|
+
inst.syncPosition();
|
|
168
|
+
});
|
|
169
|
+
}
|
|
167
170
|
function doUpdateValue(value) {
|
|
168
|
-
const {
|
|
171
|
+
const { 'onUpdate:value': _onUpdateValue, onUpdateValue } = props;
|
|
169
172
|
const { nTriggerFormInput, nTriggerFormChange } = formItem;
|
|
170
|
-
if (onChange)
|
|
171
|
-
(0, _utils_1.call)(onChange, value);
|
|
172
173
|
if (onUpdateValue)
|
|
173
174
|
(0, _utils_1.call)(onUpdateValue, value);
|
|
174
175
|
if (_onUpdateValue)
|
|
@@ -177,411 +178,240 @@ exports.default = (0, vue_1.defineComponent)({
|
|
|
177
178
|
nTriggerFormInput();
|
|
178
179
|
nTriggerFormChange();
|
|
179
180
|
}
|
|
180
|
-
function
|
|
181
|
-
|
|
182
|
-
|
|
181
|
+
function dispatchValueUpdate(value) {
|
|
182
|
+
const { range } = props;
|
|
183
|
+
if (range) {
|
|
184
|
+
if (Array.isArray(value)) {
|
|
185
|
+
const { value: oldValues } = arrifiedValueRef;
|
|
186
|
+
if (value.join() !== oldValues.join()) {
|
|
187
|
+
doUpdateValue(value);
|
|
188
|
+
}
|
|
189
|
+
}
|
|
183
190
|
}
|
|
184
|
-
if (
|
|
185
|
-
|
|
191
|
+
else if (!Array.isArray(value)) {
|
|
192
|
+
const oldValue = arrifiedValueRef.value[0];
|
|
193
|
+
if (oldValue !== value) {
|
|
194
|
+
doUpdateValue(value);
|
|
195
|
+
}
|
|
186
196
|
}
|
|
187
197
|
}
|
|
188
|
-
function
|
|
189
|
-
|
|
190
|
-
|
|
191
|
-
|
|
198
|
+
function doDispatchValue(value, index) {
|
|
199
|
+
if (props.range) {
|
|
200
|
+
const values = arrifiedValueRef.value.slice();
|
|
201
|
+
values.splice(index, 1, value);
|
|
202
|
+
dispatchValueUpdate(values);
|
|
203
|
+
}
|
|
204
|
+
else {
|
|
205
|
+
dispatchValueUpdate(value);
|
|
206
|
+
}
|
|
192
207
|
}
|
|
193
|
-
|
|
194
|
-
|
|
195
|
-
|
|
196
|
-
|
|
208
|
+
// value conversion
|
|
209
|
+
function sanitizeValue(value, currentValue, stepBuffer) {
|
|
210
|
+
const stepping = stepBuffer !== undefined;
|
|
211
|
+
if (!stepBuffer) {
|
|
212
|
+
stepBuffer = value - currentValue > 0 ? 1 : -1;
|
|
213
|
+
}
|
|
214
|
+
const markValues = markValuesRef.value || [];
|
|
215
|
+
const { step } = props;
|
|
216
|
+
if (step === 'mark') {
|
|
217
|
+
const closestMark = getClosestMark(value, markValues.concat(currentValue), stepping ? stepBuffer : undefined);
|
|
218
|
+
return closestMark ? closestMark.value : currentValue;
|
|
219
|
+
}
|
|
220
|
+
if (step <= 0)
|
|
221
|
+
return currentValue;
|
|
222
|
+
const { value: precision } = precisionRef;
|
|
223
|
+
let closestMark;
|
|
224
|
+
// if it is a stepping, priority will be given to the marks
|
|
225
|
+
// on the rail, otherwise take the nearest one
|
|
226
|
+
if (stepping) {
|
|
227
|
+
const currentStep = Number((currentValue / step).toFixed(precision));
|
|
228
|
+
const actualStep = Math.floor(currentStep);
|
|
229
|
+
const leftStep = currentStep > actualStep ? actualStep : actualStep - 1;
|
|
230
|
+
const rightStep = currentStep < actualStep ? actualStep : actualStep + 1;
|
|
231
|
+
closestMark = getClosestMark(currentValue, [
|
|
232
|
+
Number((leftStep * step).toFixed(precision)),
|
|
233
|
+
Number((rightStep * step).toFixed(precision)),
|
|
234
|
+
...markValues
|
|
235
|
+
], stepBuffer);
|
|
236
|
+
}
|
|
237
|
+
else {
|
|
238
|
+
const roundValue = getRoundValue(value);
|
|
239
|
+
closestMark = getClosestMark(value, [...markValues, roundValue]);
|
|
240
|
+
}
|
|
241
|
+
return closestMark ? clampValue(closestMark.value) : currentValue;
|
|
197
242
|
}
|
|
198
|
-
function
|
|
199
|
-
|
|
200
|
-
return;
|
|
201
|
-
doUpdateShow(false, true);
|
|
243
|
+
function clampValue(value) {
|
|
244
|
+
return Math.min(props.max, Math.max(props.min, value));
|
|
202
245
|
}
|
|
203
|
-
function
|
|
204
|
-
|
|
205
|
-
|
|
206
|
-
doUpdateShow(false, false);
|
|
246
|
+
function valueToPercentage(value) {
|
|
247
|
+
const { max, min } = props;
|
|
248
|
+
return ((value - min) / (max - min)) * 100;
|
|
207
249
|
}
|
|
208
|
-
function
|
|
209
|
-
|
|
210
|
-
|
|
211
|
-
doUpdateShow(false, false);
|
|
250
|
+
function percentageToValue(percentage) {
|
|
251
|
+
const { max, min } = props;
|
|
252
|
+
return min + (max - min) * percentage;
|
|
212
253
|
}
|
|
213
|
-
function
|
|
214
|
-
|
|
215
|
-
if (
|
|
216
|
-
return;
|
|
217
|
-
const
|
|
218
|
-
|
|
219
|
-
|
|
220
|
-
|
|
221
|
-
|
|
222
|
-
|
|
223
|
-
|
|
224
|
-
|
|
225
|
-
|
|
226
|
-
|
|
227
|
-
|
|
228
|
-
if (
|
|
229
|
-
|
|
230
|
-
|
|
231
|
-
|
|
232
|
-
|
|
233
|
-
|
|
234
|
-
|
|
235
|
-
|
|
236
|
-
|
|
237
|
-
dispatchValueUpdate([handleValue1Ref.value, newValue], {
|
|
238
|
-
source: 'click'
|
|
239
|
-
});
|
|
240
|
-
(_c = handleRef2.value) === null || _c === void 0 ? void 0 : _c.focus();
|
|
241
|
-
}
|
|
242
|
-
}
|
|
243
|
-
else {
|
|
244
|
-
dispatchValueUpdate([newValue, newValue], { source: 'click' });
|
|
245
|
-
(_d = handleRef1.value) === null || _d === void 0 ? void 0 : _d.focus();
|
|
254
|
+
function getRoundValue(value) {
|
|
255
|
+
const { step, min } = props;
|
|
256
|
+
if (step <= 0 || step === 'mark')
|
|
257
|
+
return value;
|
|
258
|
+
const newValue = Math.round((value - min) / step) * step + min;
|
|
259
|
+
return Number(newValue.toFixed(precisionRef.value));
|
|
260
|
+
}
|
|
261
|
+
function getClosestMark(currentValue, markValues = markValuesRef.value, buffer) {
|
|
262
|
+
if (!markValues || !markValues.length)
|
|
263
|
+
return null;
|
|
264
|
+
let closestMark = null;
|
|
265
|
+
let index = -1;
|
|
266
|
+
while (++index < markValues.length) {
|
|
267
|
+
const diff = markValues[index] - currentValue;
|
|
268
|
+
const distance = Math.abs(diff);
|
|
269
|
+
if (
|
|
270
|
+
// find marks in the same direction
|
|
271
|
+
(buffer === undefined || diff * buffer > 0) &&
|
|
272
|
+
(closestMark === null || distance < closestMark.distance)) {
|
|
273
|
+
closestMark = {
|
|
274
|
+
index,
|
|
275
|
+
distance,
|
|
276
|
+
value: markValues[index]
|
|
277
|
+
};
|
|
246
278
|
}
|
|
247
279
|
}
|
|
280
|
+
return closestMark;
|
|
248
281
|
}
|
|
249
|
-
function
|
|
250
|
-
|
|
282
|
+
function getPointValue(event) {
|
|
283
|
+
const railEl = handleRailRef.value;
|
|
284
|
+
if (!railEl)
|
|
251
285
|
return;
|
|
252
|
-
const
|
|
253
|
-
const
|
|
254
|
-
|
|
255
|
-
|
|
256
|
-
|
|
257
|
-
const newValue = min + (max - min) * offsetRatio;
|
|
258
|
-
if (range) {
|
|
259
|
-
if (handleIndex === 0) {
|
|
260
|
-
dispatchValueUpdate([memoziedOtherValueRef.value, newValue]);
|
|
261
|
-
}
|
|
262
|
-
else {
|
|
263
|
-
dispatchValueUpdate([newValue, memoziedOtherValueRef.value]);
|
|
264
|
-
}
|
|
286
|
+
const touchEvent = (0, utils_1.isTouchEvent)(event) ? event.touches[0] : event;
|
|
287
|
+
const railRect = railEl.getBoundingClientRect();
|
|
288
|
+
let percentage;
|
|
289
|
+
if (props.vertical) {
|
|
290
|
+
percentage = (railRect.bottom - touchEvent.clientY) / railRect.height;
|
|
265
291
|
}
|
|
266
292
|
else {
|
|
267
|
-
|
|
293
|
+
percentage = (touchEvent.clientX - railRect.left) / railRect.width;
|
|
294
|
+
}
|
|
295
|
+
if (props.reverse) {
|
|
296
|
+
percentage = 1 - percentage;
|
|
268
297
|
}
|
|
298
|
+
return percentageToValue(percentage);
|
|
269
299
|
}
|
|
270
|
-
|
|
300
|
+
// dom event handle
|
|
301
|
+
function handleRailKeyDown(e) {
|
|
271
302
|
if (mergedDisabledRef.value)
|
|
272
303
|
return;
|
|
304
|
+
const { vertical, reverse } = props;
|
|
273
305
|
switch (e.code) {
|
|
306
|
+
case 'ArrowUp':
|
|
307
|
+
e.preventDefault();
|
|
308
|
+
handleStepValue(vertical && reverse ? -1 : 1);
|
|
309
|
+
break;
|
|
274
310
|
case 'ArrowRight':
|
|
275
|
-
|
|
311
|
+
e.preventDefault();
|
|
312
|
+
handleStepValue(!vertical && reverse ? -1 : 1);
|
|
313
|
+
break;
|
|
314
|
+
case 'ArrowDown':
|
|
315
|
+
e.preventDefault();
|
|
316
|
+
handleStepValue(vertical && reverse ? 1 : -1);
|
|
276
317
|
break;
|
|
277
318
|
case 'ArrowLeft':
|
|
278
|
-
|
|
319
|
+
e.preventDefault();
|
|
320
|
+
handleStepValue(!vertical && reverse ? 1 : -1);
|
|
279
321
|
break;
|
|
280
322
|
}
|
|
281
323
|
}
|
|
282
|
-
function
|
|
283
|
-
|
|
324
|
+
function handleStepValue(ratio) {
|
|
325
|
+
const activeIndex = activeIndexRef.value;
|
|
326
|
+
if (activeIndex === -1)
|
|
284
327
|
return;
|
|
285
|
-
|
|
286
|
-
|
|
287
|
-
|
|
288
|
-
|
|
289
|
-
|
|
290
|
-
|
|
291
|
-
|
|
292
|
-
|
|
293
|
-
}
|
|
294
|
-
const { step, marks } = props;
|
|
295
|
-
let nextValue = Math.floor(handleValue / step) * step + step;
|
|
296
|
-
if (marks) {
|
|
297
|
-
for (const key of Object.keys(marks)) {
|
|
298
|
-
const numberKey = Number(key);
|
|
299
|
-
if (numberKey > handleValue && numberKey < nextValue) {
|
|
300
|
-
nextValue = numberKey;
|
|
301
|
-
}
|
|
302
|
-
}
|
|
303
|
-
}
|
|
304
|
-
if (props.range) {
|
|
305
|
-
if (firstHandleFocused) {
|
|
306
|
-
dispatchValueUpdate([nextValue, handleValue2Ref.value], {
|
|
307
|
-
source: 'keyboard'
|
|
308
|
-
});
|
|
309
|
-
}
|
|
310
|
-
else {
|
|
311
|
-
dispatchValueUpdate([handleValue1Ref.value, nextValue], {
|
|
312
|
-
source: 'keyboard'
|
|
313
|
-
});
|
|
314
|
-
}
|
|
315
|
-
}
|
|
316
|
-
else {
|
|
317
|
-
dispatchValueUpdate(nextValue, { source: 'keyboard' });
|
|
318
|
-
}
|
|
328
|
+
const { step } = props;
|
|
329
|
+
const currentValue = arrifiedValueRef.value[activeIndex];
|
|
330
|
+
const nextValue = step <= 0 || step === 'mark'
|
|
331
|
+
? currentValue
|
|
332
|
+
: currentValue + step * ratio;
|
|
333
|
+
doDispatchValue(
|
|
334
|
+
// Avoid the number of value does not change when `step` is null
|
|
335
|
+
sanitizeValue(nextValue, currentValue, ratio > 0 ? 1 : -1), activeIndex);
|
|
319
336
|
}
|
|
320
|
-
function
|
|
321
|
-
|
|
337
|
+
function handleRailMouseDown(event) {
|
|
338
|
+
var _a, _b;
|
|
339
|
+
if (mergedDisabledRef.value)
|
|
322
340
|
return;
|
|
323
|
-
|
|
324
|
-
let handleValue = null;
|
|
325
|
-
if (document.activeElement === handleRef1.value) {
|
|
326
|
-
firstHandleFocused = true;
|
|
327
|
-
handleValue = handleValue1Ref.value;
|
|
328
|
-
}
|
|
329
|
-
else if (document.activeElement === handleRef2.value) {
|
|
330
|
-
handleValue = handleValue2Ref.value;
|
|
331
|
-
}
|
|
332
|
-
else {
|
|
341
|
+
if (!(0, utils_1.isTouchEvent)(event) && event.button !== eventButtonLeft) {
|
|
333
342
|
return;
|
|
334
343
|
}
|
|
335
|
-
const
|
|
336
|
-
|
|
337
|
-
if (marks) {
|
|
338
|
-
for (const key of Object.keys(marks)) {
|
|
339
|
-
const numberKey = Number(key);
|
|
340
|
-
if (numberKey < handleValue && numberKey > nextValue) {
|
|
341
|
-
nextValue = numberKey;
|
|
342
|
-
}
|
|
343
|
-
}
|
|
344
|
-
}
|
|
345
|
-
if (props.range) {
|
|
346
|
-
if (firstHandleFocused) {
|
|
347
|
-
dispatchValueUpdate([nextValue, handleValue2Ref.value], {
|
|
348
|
-
source: 'keyboard'
|
|
349
|
-
});
|
|
350
|
-
}
|
|
351
|
-
else {
|
|
352
|
-
dispatchValueUpdate([handleValue1Ref.value, nextValue], {
|
|
353
|
-
source: 'keyboard'
|
|
354
|
-
});
|
|
355
|
-
}
|
|
356
|
-
}
|
|
357
|
-
else {
|
|
358
|
-
dispatchValueUpdate(nextValue, { source: 'keyboard' });
|
|
359
|
-
}
|
|
360
|
-
}
|
|
361
|
-
function switchFocus() {
|
|
362
|
-
if (props.range) {
|
|
363
|
-
const firstHandle = handleRef1.value;
|
|
364
|
-
const secondHandle = handleRef2.value;
|
|
365
|
-
if (firstHandle && secondHandle) {
|
|
366
|
-
if (handleActive1Ref.value &&
|
|
367
|
-
document.activeElement === secondHandle) {
|
|
368
|
-
disableTransitionOneTick();
|
|
369
|
-
firstHandle.focus();
|
|
370
|
-
if (handleClicked2Ref.value) {
|
|
371
|
-
handleClicked2Ref.value = false;
|
|
372
|
-
handleClicked1Ref.value = true;
|
|
373
|
-
}
|
|
374
|
-
}
|
|
375
|
-
else if (handleActive2Ref.value &&
|
|
376
|
-
document.activeElement === firstHandle) {
|
|
377
|
-
disableTransitionOneTick();
|
|
378
|
-
secondHandle.focus();
|
|
379
|
-
if (handleClicked1Ref.value) {
|
|
380
|
-
handleClicked1Ref.value = false;
|
|
381
|
-
handleClicked2Ref.value = true;
|
|
382
|
-
}
|
|
383
|
-
}
|
|
384
|
-
}
|
|
385
|
-
}
|
|
386
|
-
}
|
|
387
|
-
function getClosestMarkValue(currentValue) {
|
|
388
|
-
const { marks } = props;
|
|
389
|
-
if (marks) {
|
|
390
|
-
const markValues = Object.keys(marks).map((key) => Number(key));
|
|
391
|
-
let diff = null;
|
|
392
|
-
let closestValue = null;
|
|
393
|
-
for (const value of markValues) {
|
|
394
|
-
if (closestValue === null) {
|
|
395
|
-
closestValue = value;
|
|
396
|
-
diff = Math.abs(value - currentValue);
|
|
397
|
-
}
|
|
398
|
-
else {
|
|
399
|
-
const newDiff = Math.abs(value - currentValue);
|
|
400
|
-
if (newDiff < diff) {
|
|
401
|
-
closestValue = value;
|
|
402
|
-
diff = newDiff;
|
|
403
|
-
}
|
|
404
|
-
}
|
|
405
|
-
}
|
|
406
|
-
return closestValue;
|
|
407
|
-
}
|
|
408
|
-
return null;
|
|
409
|
-
}
|
|
410
|
-
function sanitizeValue(value) {
|
|
411
|
-
let justifiedValue = value;
|
|
412
|
-
const { min, max, marks, step } = props;
|
|
413
|
-
justifiedValue = Math.max(min, justifiedValue);
|
|
414
|
-
justifiedValue = Math.min(max, justifiedValue);
|
|
415
|
-
justifiedValue = Math.round((justifiedValue - min) / step) * step + min;
|
|
416
|
-
justifiedValue = parseFloat(justifiedValue.toFixed(precisionRef.value));
|
|
417
|
-
if (marks) {
|
|
418
|
-
const closestMarkValue = getClosestMarkValue(value);
|
|
419
|
-
if (closestMarkValue !== null &&
|
|
420
|
-
Math.abs(justifiedValue - value) > Math.abs(closestMarkValue - value)) {
|
|
421
|
-
justifiedValue = closestMarkValue;
|
|
422
|
-
}
|
|
423
|
-
}
|
|
424
|
-
return justifiedValue;
|
|
425
|
-
}
|
|
426
|
-
function handleFirstHandleMouseDown(e) {
|
|
427
|
-
if (mergedDisabledRef.value)
|
|
344
|
+
const pointValue = getPointValue(event);
|
|
345
|
+
if (pointValue === undefined)
|
|
428
346
|
return;
|
|
429
|
-
|
|
430
|
-
|
|
431
|
-
|
|
432
|
-
|
|
347
|
+
const values = arrifiedValueRef.value.slice();
|
|
348
|
+
const activeIndex = props.range
|
|
349
|
+
? (_b = (_a = getClosestMark(pointValue, values)) === null || _a === void 0 ? void 0 : _a.index) !== null && _b !== void 0 ? _b : -1
|
|
350
|
+
: 0;
|
|
351
|
+
if (activeIndex !== -1) {
|
|
352
|
+
// avoid triggering scrolling on touch
|
|
353
|
+
event.preventDefault();
|
|
354
|
+
focusActiveHandle(activeIndex);
|
|
355
|
+
startDragging();
|
|
356
|
+
doDispatchValue(sanitizeValue(pointValue, arrifiedValueRef.value[activeIndex]), activeIndex);
|
|
433
357
|
}
|
|
434
|
-
doUpdateShow(true, false);
|
|
435
|
-
handleClicked1Ref.value = true;
|
|
436
|
-
(0, evtd_1.on)('touchend', document, handleHandleMouseUp);
|
|
437
|
-
(0, evtd_1.on)('mouseup', document, handleHandleMouseUp);
|
|
438
|
-
(0, evtd_1.on)('touchmove', document, handleFirstHandleMouseMove);
|
|
439
|
-
(0, evtd_1.on)('mousemove', document, handleFirstHandleMouseMove);
|
|
440
358
|
}
|
|
441
|
-
function
|
|
442
|
-
if (
|
|
443
|
-
|
|
444
|
-
|
|
445
|
-
|
|
446
|
-
|
|
447
|
-
|
|
359
|
+
function startDragging() {
|
|
360
|
+
if (!draggingRef.value) {
|
|
361
|
+
draggingRef.value = true;
|
|
362
|
+
(0, evtd_1.on)('touchend', document, handleMouseUp);
|
|
363
|
+
(0, evtd_1.on)('mouseup', document, handleMouseUp);
|
|
364
|
+
(0, evtd_1.on)('touchmove', document, handleMouseMove);
|
|
365
|
+
(0, evtd_1.on)('mousemove', document, handleMouseMove);
|
|
448
366
|
}
|
|
449
|
-
doUpdateShow(false, true);
|
|
450
|
-
handleClicked2Ref.value = true;
|
|
451
|
-
(0, evtd_1.on)('touchend', document, handleHandleMouseUp);
|
|
452
|
-
(0, evtd_1.on)('mouseup', document, handleHandleMouseUp);
|
|
453
|
-
(0, evtd_1.on)('touchmove', document, handleSecondHandleMouseMove);
|
|
454
|
-
(0, evtd_1.on)('mousemove', document, handleSecondHandleMouseMove);
|
|
455
367
|
}
|
|
456
|
-
function
|
|
457
|
-
|
|
458
|
-
|
|
459
|
-
(
|
|
460
|
-
|
|
461
|
-
|
|
368
|
+
function stopDragging() {
|
|
369
|
+
if (draggingRef.value) {
|
|
370
|
+
draggingRef.value = false;
|
|
371
|
+
(0, evtd_1.off)('touchend', document, handleMouseUp);
|
|
372
|
+
(0, evtd_1.off)('mouseup', document, handleMouseUp);
|
|
373
|
+
(0, evtd_1.off)('touchmove', document, handleMouseMove);
|
|
374
|
+
(0, evtd_1.off)('mousemove', document, handleMouseMove);
|
|
462
375
|
}
|
|
463
|
-
handleClicked2Ref.value = false;
|
|
464
|
-
handleClicked1Ref.value = false;
|
|
465
|
-
(0, evtd_1.off)('touchend', document, handleHandleMouseUp);
|
|
466
|
-
(0, evtd_1.off)('mouseup', document, handleHandleMouseUp);
|
|
467
|
-
(0, evtd_1.off)('touchmove', document, handleFirstHandleMouseMove);
|
|
468
|
-
(0, evtd_1.off)('touchmove', document, handleSecondHandleMouseMove);
|
|
469
|
-
(0, evtd_1.off)('mousemove', document, handleFirstHandleMouseMove);
|
|
470
|
-
(0, evtd_1.off)('mousemove', document, handleSecondHandleMouseMove);
|
|
471
376
|
}
|
|
472
|
-
function
|
|
473
|
-
const {
|
|
474
|
-
|
|
475
|
-
|
|
476
|
-
|
|
477
|
-
if (value[0] > value[1]) {
|
|
478
|
-
value = [sanitizeValue(value[1]), sanitizeValue(value[0])];
|
|
479
|
-
}
|
|
480
|
-
else {
|
|
481
|
-
value = [sanitizeValue(value[0]), sanitizeValue(value[1])];
|
|
482
|
-
}
|
|
483
|
-
const { value: oldValue } = mergedValueRef;
|
|
484
|
-
if (!Array.isArray(oldValue) ||
|
|
485
|
-
oldValue[0] !== value[0] ||
|
|
486
|
-
oldValue[1] !== value[1]) {
|
|
487
|
-
changeSourceRef.value = source;
|
|
488
|
-
doUpdateValue(value);
|
|
489
|
-
}
|
|
490
|
-
}
|
|
491
|
-
}
|
|
492
|
-
else {
|
|
493
|
-
if (!Array.isArray(value)) {
|
|
494
|
-
const { max, min } = props;
|
|
495
|
-
const { value: oldValue } = mergedValueRef;
|
|
496
|
-
if (value > max) {
|
|
497
|
-
if (oldValue !== max) {
|
|
498
|
-
changeSourceRef.value = source;
|
|
499
|
-
doUpdateValue(max);
|
|
500
|
-
}
|
|
501
|
-
}
|
|
502
|
-
else if (value < min) {
|
|
503
|
-
if (oldValue !== min) {
|
|
504
|
-
changeSourceRef.value = source;
|
|
505
|
-
doUpdateValue(min);
|
|
506
|
-
}
|
|
507
|
-
}
|
|
508
|
-
else {
|
|
509
|
-
const newValue = sanitizeValue(value);
|
|
510
|
-
if (oldValue !== newValue) {
|
|
511
|
-
changeSourceRef.value = source;
|
|
512
|
-
doUpdateValue(newValue);
|
|
513
|
-
}
|
|
514
|
-
}
|
|
515
|
-
}
|
|
377
|
+
function handleMouseMove(event) {
|
|
378
|
+
const { value: activeIndex } = activeIndexRef;
|
|
379
|
+
if (!draggingRef.value || activeIndex === -1) {
|
|
380
|
+
stopDragging();
|
|
381
|
+
return;
|
|
516
382
|
}
|
|
383
|
+
const pointValue = getPointValue(event);
|
|
384
|
+
doDispatchValue(sanitizeValue(pointValue, arrifiedValueRef.value[activeIndex]), activeIndex);
|
|
517
385
|
}
|
|
518
|
-
function
|
|
519
|
-
|
|
520
|
-
}
|
|
521
|
-
function handleSecondHandleMouseMove(e) {
|
|
522
|
-
handleHandleMouseMove(e, 1);
|
|
386
|
+
function handleMouseUp() {
|
|
387
|
+
stopDragging();
|
|
523
388
|
}
|
|
524
|
-
function
|
|
525
|
-
|
|
526
|
-
|
|
527
|
-
|
|
528
|
-
|
|
529
|
-
});
|
|
389
|
+
function handleHandleFocus(index) {
|
|
390
|
+
activeIndexRef.value = index;
|
|
391
|
+
// Wake focus style
|
|
392
|
+
if (!mergedDisabledRef.value) {
|
|
393
|
+
hoverIndexRef.value = index;
|
|
530
394
|
}
|
|
531
395
|
}
|
|
532
|
-
function
|
|
533
|
-
if (
|
|
534
|
-
|
|
535
|
-
|
|
536
|
-
doUpdateShow(false, false);
|
|
396
|
+
function handleHandleBlur(index) {
|
|
397
|
+
if (activeIndexRef.value === index) {
|
|
398
|
+
activeIndexRef.value = -1;
|
|
399
|
+
stopDragging();
|
|
537
400
|
}
|
|
538
|
-
|
|
539
|
-
|
|
401
|
+
if (hoverIndexRef.value === index) {
|
|
402
|
+
hoverIndexRef.value = -1;
|
|
540
403
|
}
|
|
541
404
|
}
|
|
542
|
-
function
|
|
543
|
-
|
|
544
|
-
doUpdateShow(undefined, true);
|
|
545
|
-
void (0, vue_1.nextTick)(() => {
|
|
546
|
-
syncPosition();
|
|
547
|
-
});
|
|
548
|
-
}
|
|
405
|
+
function handleHandleMouseEnter(index) {
|
|
406
|
+
hoverIndexRef.value = index;
|
|
549
407
|
}
|
|
550
|
-
function
|
|
551
|
-
if (
|
|
552
|
-
|
|
553
|
-
if (!activeRef.value) {
|
|
554
|
-
doUpdateShow(false, false);
|
|
555
|
-
}
|
|
556
|
-
else if (!clickedRef.value) {
|
|
557
|
-
doUpdateShow(false, false);
|
|
408
|
+
function handleHandleMouseLeave(index) {
|
|
409
|
+
if (hoverIndexRef.value === index) {
|
|
410
|
+
hoverIndexRef.value = -1;
|
|
558
411
|
}
|
|
559
412
|
}
|
|
560
|
-
|
|
561
|
-
|
|
562
|
-
handleRef1.value.style.transition = 'none';
|
|
563
|
-
void (0, vue_1.nextTick)(() => {
|
|
564
|
-
if (handleRef1.value) {
|
|
565
|
-
handleRef1.value.style.transition = '';
|
|
566
|
-
}
|
|
567
|
-
});
|
|
568
|
-
}
|
|
569
|
-
if (handleRef2.value) {
|
|
570
|
-
handleRef2.value.style.transition = 'none';
|
|
571
|
-
void (0, vue_1.nextTick)(() => {
|
|
572
|
-
if (handleRef2.value) {
|
|
573
|
-
handleRef2.value.style.transition = '';
|
|
574
|
-
}
|
|
575
|
-
});
|
|
576
|
-
}
|
|
577
|
-
}
|
|
578
|
-
(0, vue_1.watch)(activeRef, (value) => {
|
|
579
|
-
void (0, vue_1.nextTick)(() => {
|
|
580
|
-
prevActiveRef.value = value;
|
|
581
|
-
});
|
|
582
|
-
});
|
|
583
|
-
(0, vue_1.watch)(mergedValueRef, (newValue, oldValue) => {
|
|
584
|
-
const { value: changeSource } = changeSourceRef;
|
|
413
|
+
(0, vue_1.watch)(activeIndexRef, (_, previous) => void (0, vue_1.nextTick)(() => (previousIndexRef.value = previous)));
|
|
414
|
+
(0, vue_1.watch)(mergedValueRef, () => {
|
|
585
415
|
if (props.marks) {
|
|
586
416
|
if (dotTransitionDisabledRef.value)
|
|
587
417
|
return;
|
|
@@ -590,57 +420,7 @@ exports.default = (0, vue_1.defineComponent)({
|
|
|
590
420
|
dotTransitionDisabledRef.value = false;
|
|
591
421
|
});
|
|
592
422
|
}
|
|
593
|
-
|
|
594
|
-
if (oldValue && oldValue[1] !== newValue[1]) {
|
|
595
|
-
void (0, vue_1.nextTick)(() => {
|
|
596
|
-
if (!(changeSource === 'click')) {
|
|
597
|
-
doUpdateShow(false, true);
|
|
598
|
-
}
|
|
599
|
-
switchFocus();
|
|
600
|
-
});
|
|
601
|
-
}
|
|
602
|
-
else if (oldValue && oldValue[0] !== newValue[0]) {
|
|
603
|
-
void (0, vue_1.nextTick)(() => {
|
|
604
|
-
if (!(changeSource === 'click')) {
|
|
605
|
-
doUpdateShow(true, false);
|
|
606
|
-
}
|
|
607
|
-
switchFocus();
|
|
608
|
-
});
|
|
609
|
-
}
|
|
610
|
-
else if (newValue[0] === newValue[1]) {
|
|
611
|
-
void (0, vue_1.nextTick)(() => {
|
|
612
|
-
if (!(changeSource === 'click')) {
|
|
613
|
-
doUpdateShow(false, true);
|
|
614
|
-
}
|
|
615
|
-
switchFocus();
|
|
616
|
-
});
|
|
617
|
-
}
|
|
618
|
-
}
|
|
619
|
-
void (0, vue_1.nextTick)(() => {
|
|
620
|
-
// dom has changed but event is not fired, use marco task to make sure
|
|
621
|
-
// relevant event handler is called
|
|
622
|
-
setTimeout(() => {
|
|
623
|
-
changeSourceRef.value = null;
|
|
624
|
-
}, 0);
|
|
625
|
-
if (props.range) {
|
|
626
|
-
if (Array.isArray(newValue) && Array.isArray(oldValue)) {
|
|
627
|
-
if (newValue[0] !== oldValue[0] || newValue[1] !== oldValue[1]) {
|
|
628
|
-
syncPosition();
|
|
629
|
-
}
|
|
630
|
-
}
|
|
631
|
-
}
|
|
632
|
-
else {
|
|
633
|
-
syncPosition();
|
|
634
|
-
}
|
|
635
|
-
});
|
|
636
|
-
});
|
|
637
|
-
(0, vue_1.onBeforeUnmount)(() => {
|
|
638
|
-
(0, evtd_1.off)('touchmove', document, handleFirstHandleMouseMove);
|
|
639
|
-
(0, evtd_1.off)('touchmove', document, handleSecondHandleMouseMove);
|
|
640
|
-
(0, evtd_1.off)('mousemove', document, handleFirstHandleMouseMove);
|
|
641
|
-
(0, evtd_1.off)('mousemove', document, handleSecondHandleMouseMove);
|
|
642
|
-
(0, evtd_1.off)('touchend', document, handleHandleMouseUp);
|
|
643
|
-
(0, evtd_1.off)('mouseup', document, handleHandleMouseUp);
|
|
423
|
+
void (0, vue_1.nextTick)(syncPosition);
|
|
644
424
|
});
|
|
645
425
|
return {
|
|
646
426
|
mergedClsPrefix: mergedClsPrefixRef,
|
|
@@ -648,43 +428,27 @@ exports.default = (0, vue_1.defineComponent)({
|
|
|
648
428
|
uncontrolledValue: uncontrolledValueRef,
|
|
649
429
|
mergedValue: mergedValueRef,
|
|
650
430
|
mergedDisabled: mergedDisabledRef,
|
|
431
|
+
mergedPlacement: mergedPlacementRef,
|
|
651
432
|
isMounted: (0, vooks_1.useIsMounted)(),
|
|
652
433
|
adjustedTo: (0, _utils_1.useAdjustedTo)(props),
|
|
653
|
-
handleValue1: handleValue1Ref,
|
|
654
|
-
handleValue2: handleValue2Ref,
|
|
655
|
-
mergedShowTooltip1: mergedShowTooltip1Ref,
|
|
656
|
-
mergedShowTooltip2: mergedShowTooltip2Ref,
|
|
657
|
-
handleActive1: handleActive1Ref,
|
|
658
|
-
handleActive2: handleActive2Ref,
|
|
659
|
-
handleClicked1: handleClicked1Ref,
|
|
660
|
-
handleClicked2: handleClicked2Ref,
|
|
661
|
-
memoziedOtherValue: memoziedOtherValueRef,
|
|
662
|
-
active: activeRef,
|
|
663
|
-
prevActive: prevActiveRef,
|
|
664
|
-
clicked: clickedRef,
|
|
665
434
|
dotTransitionDisabled: dotTransitionDisabledRef,
|
|
666
435
|
markInfos: markInfosRef,
|
|
667
|
-
|
|
668
|
-
|
|
669
|
-
|
|
670
|
-
|
|
671
|
-
|
|
672
|
-
followerRef2,
|
|
673
|
-
firstHandleStyle: firstHandleStyleRef,
|
|
674
|
-
secondHandleStyle: secondHandleStyleRef,
|
|
436
|
+
isShowTooltip,
|
|
437
|
+
isSkipCSSDetection,
|
|
438
|
+
handleRailRef,
|
|
439
|
+
setHandleRefs,
|
|
440
|
+
setFollowerRefs,
|
|
675
441
|
fillStyle: fillStyleRef,
|
|
676
|
-
|
|
677
|
-
|
|
678
|
-
|
|
679
|
-
|
|
680
|
-
|
|
681
|
-
|
|
682
|
-
|
|
683
|
-
|
|
684
|
-
|
|
685
|
-
|
|
686
|
-
handleSecondHandleMouseEnter,
|
|
687
|
-
handleSecondHandleMouseLeave,
|
|
442
|
+
getHandleStyle,
|
|
443
|
+
activeIndex: activeIndexRef,
|
|
444
|
+
arrifiedValues: arrifiedValueRef,
|
|
445
|
+
followerEnabledIndexSet: followerEnabledIndexSetRef,
|
|
446
|
+
handleRailMouseDown,
|
|
447
|
+
handleHandleFocus,
|
|
448
|
+
handleHandleBlur,
|
|
449
|
+
handleHandleMouseEnter,
|
|
450
|
+
handleHandleMouseLeave,
|
|
451
|
+
handleRailKeyDown,
|
|
688
452
|
indicatorCssVars: (0, vue_1.computed)(() => {
|
|
689
453
|
const { self: { fontSize, indicatorColor, indicatorBoxShadow, indicatorTextColor, indicatorBorderRadius } } = themeRef.value;
|
|
690
454
|
return {
|
|
@@ -696,7 +460,7 @@ exports.default = (0, vue_1.defineComponent)({
|
|
|
696
460
|
};
|
|
697
461
|
}),
|
|
698
462
|
cssVars: (0, vue_1.computed)(() => {
|
|
699
|
-
const { self: { railColor, railColorHover, fillColor, fillColorHover, handleColor, opacityDisabled, dotColor, dotColorModal, handleBoxShadow, handleBoxShadowHover, handleBoxShadowActive, handleBoxShadowFocus, dotBorder, dotBoxShadow, railHeight, handleSize, dotHeight, dotWidth, dotBorderRadius, fontSize, dotBorderActive, dotColorPopover }, common: { cubicBezierEaseInOut } } = themeRef.value;
|
|
463
|
+
const { self: { railColor, railColorHover, fillColor, fillColorHover, handleColor, opacityDisabled, dotColor, dotColorModal, handleBoxShadow, handleBoxShadowHover, handleBoxShadowActive, handleBoxShadowFocus, dotBorder, dotBoxShadow, railHeight, railWidthVertical, handleSize, dotHeight, dotWidth, dotBorderRadius, fontSize, dotBorderActive, dotColorPopover }, common: { cubicBezierEaseInOut } } = themeRef.value;
|
|
700
464
|
return {
|
|
701
465
|
'--bezier': cubicBezierEaseInOut,
|
|
702
466
|
'--dot-border': dotBorder,
|
|
@@ -720,7 +484,8 @@ exports.default = (0, vue_1.defineComponent)({
|
|
|
720
484
|
'--opacity-disabled': opacityDisabled,
|
|
721
485
|
'--rail-color': railColor,
|
|
722
486
|
'--rail-color-hover': railColorHover,
|
|
723
|
-
'--rail-height': railHeight
|
|
487
|
+
'--rail-height': railHeight,
|
|
488
|
+
'--rail-width-vertical': railWidthVertical
|
|
724
489
|
};
|
|
725
490
|
})
|
|
726
491
|
};
|
|
@@ -731,11 +496,13 @@ exports.default = (0, vue_1.defineComponent)({
|
|
|
731
496
|
`${mergedClsPrefix}-slider`,
|
|
732
497
|
{
|
|
733
498
|
[`${mergedClsPrefix}-slider--disabled`]: this.mergedDisabled,
|
|
734
|
-
[`${mergedClsPrefix}-slider--active`]: this.
|
|
735
|
-
[`${mergedClsPrefix}-slider--with-mark`]: this.marks
|
|
499
|
+
[`${mergedClsPrefix}-slider--active`]: this.activeIndex !== -1,
|
|
500
|
+
[`${mergedClsPrefix}-slider--with-mark`]: this.marks,
|
|
501
|
+
[`${mergedClsPrefix}-slider--vertical`]: this.vertical,
|
|
502
|
+
[`${mergedClsPrefix}-slider--reverse`]: this.reverse
|
|
736
503
|
}
|
|
737
|
-
], style: this.cssVars, onKeydown: this.
|
|
738
|
-
(0, vue_1.h)("div", {
|
|
504
|
+
], style: this.cssVars, onKeydown: this.handleRailKeyDown, onMousedown: this.handleRailMouseDown, onTouchstart: this.handleRailMouseDown },
|
|
505
|
+
(0, vue_1.h)("div", { class: `${mergedClsPrefix}-slider-rail` },
|
|
739
506
|
(0, vue_1.h)("div", { class: `${mergedClsPrefix}-slider-rail__fill`, style: this.fillStyle }),
|
|
740
507
|
this.marks ? ((0, vue_1.h)("div", { class: [
|
|
741
508
|
`${mergedClsPrefix}-slider-dots`,
|
|
@@ -747,35 +514,27 @@ exports.default = (0, vue_1.defineComponent)({
|
|
|
747
514
|
{
|
|
748
515
|
[`${mergedClsPrefix}-slider-dot--active`]: mark.active
|
|
749
516
|
}
|
|
750
|
-
], style: mark.style }))))) : null
|
|
751
|
-
|
|
752
|
-
|
|
753
|
-
(0, vue_1.h)(vueuc_1.
|
|
754
|
-
default: () =>
|
|
755
|
-
|
|
756
|
-
|
|
757
|
-
|
|
758
|
-
|
|
759
|
-
|
|
760
|
-
|
|
761
|
-
|
|
762
|
-
|
|
763
|
-
|
|
764
|
-
|
|
765
|
-
|
|
766
|
-
|
|
767
|
-
|
|
768
|
-
|
|
769
|
-
})
|
|
770
|
-
|
|
771
|
-
|
|
772
|
-
default: () => this.mergedShowTooltip2 ? ((0, vue_1.h)("div", { class: `${mergedClsPrefix}-slider-handle-indicator`, style: this.indicatorCssVars }, typeof formatTooltip === 'function'
|
|
773
|
-
? formatTooltip(this.handleValue2)
|
|
774
|
-
: this.handleValue2)) : null
|
|
775
|
-
}))
|
|
776
|
-
})
|
|
777
|
-
]
|
|
778
|
-
})) : null,
|
|
779
|
-
this.marks ? ((0, vue_1.h)("div", { class: `${mergedClsPrefix}-slider-marks` }, this.markInfos.map((mark) => ((0, vue_1.h)("div", { key: mark.label, class: `${mergedClsPrefix}-slider-mark`, style: mark.style }, mark.label))))) : null));
|
|
517
|
+
], style: mark.style }))))) : null,
|
|
518
|
+
(0, vue_1.h)("div", { ref: "handleRailRef", class: `${mergedClsPrefix}-slider-handles` }, this.arrifiedValues.map((value, index) => {
|
|
519
|
+
const showTooltip = this.isShowTooltip(index);
|
|
520
|
+
return ((0, vue_1.h)(vueuc_1.VBinder, null, {
|
|
521
|
+
default: () => [
|
|
522
|
+
(0, vue_1.h)(vueuc_1.VTarget, null, {
|
|
523
|
+
default: () => ((0, vue_1.h)("div", { ref: this.setHandleRefs(index), class: `${mergedClsPrefix}-slider-handle`, tabindex: this.mergedDisabled ? -1 : 0, style: this.getHandleStyle(value, index), onFocus: () => this.handleHandleFocus(index), onBlur: () => this.handleHandleBlur(index), onMouseenter: () => this.handleHandleMouseEnter(index), onMouseleave: () => this.handleHandleMouseLeave(index) }))
|
|
524
|
+
}),
|
|
525
|
+
this.tooltip && ((0, vue_1.h)(vueuc_1.VFollower, { ref: this.setFollowerRefs(index), show: showTooltip, to: this.adjustedTo, enabled: this.followerEnabledIndexSet.has(index), teleportDisabled: this.adjustedTo === _utils_1.useAdjustedTo.tdkey, placement: this.mergedPlacement, containerClass: this.namespace }, {
|
|
526
|
+
default: () => ((0, vue_1.h)(vue_1.Transition, { name: "fade-in-scale-up-transition", appear: this.isMounted, css: this.isSkipCSSDetection(index), onEnter: () => this.followerEnabledIndexSet.add(index), onAfterLeave: () => this.followerEnabledIndexSet.delete(index) }, {
|
|
527
|
+
default: () => showTooltip ? ((0, vue_1.h)("div", { class: [
|
|
528
|
+
`${mergedClsPrefix}-slider-handle-indicator`,
|
|
529
|
+
`${mergedClsPrefix}-slider-handle-indicator--${this.mergedPlacement}`
|
|
530
|
+
], style: this.indicatorCssVars }, typeof formatTooltip === 'function'
|
|
531
|
+
? formatTooltip(value)
|
|
532
|
+
: value)) : null
|
|
533
|
+
}))
|
|
534
|
+
}))
|
|
535
|
+
]
|
|
536
|
+
}));
|
|
537
|
+
})),
|
|
538
|
+
this.marks ? ((0, vue_1.h)("div", { class: `${mergedClsPrefix}-slider-marks` }, this.markInfos.map((mark) => ((0, vue_1.h)("div", { key: mark.label, class: `${mergedClsPrefix}-slider-mark`, style: mark.style }, mark.label))))) : null)));
|
|
780
539
|
}
|
|
781
540
|
});
|