@element-plus/nightly 0.0.20260720 → 0.0.20260721
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/components/affix/src/affix.d.ts +1 -1
- package/es/components/affix/src/affix.vue.d.ts +3 -3
- package/es/components/alert/src/alert.d.ts +2 -2
- package/es/components/anchor/src/anchor.d.ts +1 -1
- package/es/components/anchor/src/anchor.vue.d.ts +2 -2
- package/es/components/autocomplete/src/autocomplete.d.ts +7 -108
- package/es/components/autocomplete/src/autocomplete.mjs.map +1 -1
- package/es/components/autocomplete/src/autocomplete.vue.d.ts +5 -5
- package/es/components/autocomplete/src/autocomplete.vue_vue_type_script_setup_true_lang.mjs.map +1 -1
- package/es/components/autocomplete/src/autocomplete2.mjs.map +1 -1
- package/es/components/avatar/src/avatar-group-props.d.ts +9 -106
- package/es/components/avatar/src/avatar-group-props.mjs +9 -1
- package/es/components/avatar/src/avatar-group-props.mjs.map +1 -1
- package/es/components/avatar/src/avatar-group.d.ts +20 -213
- package/es/components/avatar/src/avatar.d.ts +3 -3
- package/es/components/backtop/src/backtop.vue.d.ts +1 -1
- package/es/components/badge/src/badge.d.ts +4 -8
- package/es/components/badge/src/badge.mjs +9 -1
- package/es/components/badge/src/badge.mjs.map +1 -1
- package/es/components/badge/src/badge.vue.d.ts +3 -1
- package/es/components/badge/src/badge.vue_vue_type_script_setup_true_lang.mjs.map +1 -1
- package/es/components/badge/src/badge2.mjs.map +1 -1
- package/es/components/button/src/button-group.d.ts +2 -2
- package/es/components/button/src/button-group.vue.d.ts +1 -1
- package/es/components/button/src/button.d.ts +2 -2
- package/es/components/button/src/button.vue.d.ts +4 -4
- package/es/components/button/src/use-button.d.ts +2 -2
- package/es/components/calendar/src/calendar.mjs.map +1 -1
- package/es/components/calendar/src/calendar.vue.d.ts +1 -1
- package/es/components/calendar/style/css.mjs +1 -1
- package/es/components/calendar/style/index.mjs +1 -1
- package/es/components/card/src/card.d.ts +8 -7
- package/es/components/card/src/card.mjs +27 -3
- package/es/components/card/src/card.mjs.map +1 -1
- package/es/components/card/src/card.vue.d.ts +4 -0
- package/es/components/card/src/card.vue_vue_type_script_setup_true_lang.mjs.map +1 -1
- package/es/components/card/src/card2.mjs.map +1 -1
- package/es/components/carousel/src/carousel.d.ts +1 -1
- package/es/components/carousel/src/carousel.vue.d.ts +4 -4
- package/es/components/cascader/src/cascader.d.ts +9 -110
- package/es/components/cascader/src/cascader.mjs.map +1 -1
- package/es/components/cascader/src/cascader.vue.d.ts +22 -20
- package/es/components/cascader/src/cascader.vue_vue_type_script_setup_true_lang.mjs.map +1 -1
- package/es/components/cascader/src/cascader2.mjs.map +1 -1
- package/es/components/cascader-panel/src/index.vue.d.ts +4 -4
- package/es/components/cascader-panel/src/menu.vue.d.ts +1 -1
- package/es/components/check-tag/src/check-tag.d.ts +1 -1
- package/es/components/checkbox/src/checkbox-button.vue.d.ts +6 -6
- package/es/components/checkbox/src/checkbox-group.d.ts +1 -1
- package/es/components/checkbox/src/checkbox-group.vue.d.ts +5 -5
- package/es/components/checkbox/src/checkbox.d.ts +9 -9
- package/es/components/checkbox/src/checkbox.vue.d.ts +6 -6
- package/es/components/checkbox/src/composables/use-checkbox-status.d.ts +2 -2
- package/es/components/checkbox/src/composables/use-checkbox.d.ts +2 -2
- package/es/components/col/src/col.vue.d.ts +1 -1
- package/es/components/collapse/src/collapse-item.vue.d.ts +1 -1
- package/es/components/collapse/src/collapse.d.ts +1 -1
- package/es/components/collapse/src/collapse.vue.d.ts +1 -1
- package/es/components/color-picker/src/color-picker.d.ts +5 -104
- package/es/components/color-picker/src/color-picker.mjs +1 -0
- package/es/components/color-picker/src/color-picker.mjs.map +1 -1
- package/es/components/color-picker/src/color-picker.vue.d.ts +12 -10
- package/es/components/color-picker-panel/src/color-picker-panel.d.ts +4 -10
- package/es/components/color-picker-panel/src/color-picker-panel.mjs +9 -5
- package/es/components/color-picker-panel/src/color-picker-panel.mjs.map +1 -1
- package/es/components/color-picker-panel/src/color-picker-panel.vue.d.ts +4 -1
- package/es/components/color-picker-panel/src/color-picker-panel.vue_vue_type_script_setup_true_lang.mjs.map +1 -1
- package/es/components/color-picker-panel/src/color-picker-panel2.mjs.map +1 -1
- package/es/components/config-provider/src/config-provider-props.d.ts +1 -1
- package/es/components/config-provider/src/config-provider.d.ts +2 -2
- package/es/components/config-provider/src/hooks/use-global-config.d.ts +1 -1
- package/es/components/date-picker/src/date-picker.d.ts +17 -217
- package/es/components/date-picker/src/props.d.ts +4 -104
- package/es/components/date-picker-panel/src/composables/use-basic-date-table.d.ts +1 -1
- package/es/components/date-picker-panel/src/date-picker-com/panel-date-pick.vue.d.ts +3 -3
- package/es/components/date-picker-panel/src/date-picker-com/panel-date-range.vue.d.ts +2 -2
- package/es/components/date-picker-panel/src/date-picker-com/panel-month-range.vue.d.ts +2 -2
- package/es/components/date-picker-panel/src/date-picker-com/panel-year-range.vue.d.ts +2 -2
- package/es/components/date-picker-panel/src/date-picker-panel.d.ts +4 -4
- package/es/components/date-picker-panel/src/panel-utils.d.ts +21 -21
- package/es/components/date-picker-panel/src/props/basic-date-table.mjs.map +1 -1
- package/es/components/descriptions/src/description-item.d.ts +18 -18
- package/es/components/descriptions/src/description.d.ts +1 -1
- package/es/components/descriptions/src/description.vue.d.ts +2 -2
- package/es/components/dialog/src/dialog-content.d.ts +10 -6
- package/es/components/dialog/src/dialog-content.mjs +32 -5
- package/es/components/dialog/src/dialog-content.mjs.map +1 -1
- package/es/components/dialog/src/dialog-content.vue.d.ts +5 -1
- package/es/components/dialog/src/dialog.d.ts +10 -5
- package/es/components/dialog/src/dialog.mjs +11 -14
- package/es/components/dialog/src/dialog.mjs.map +1 -1
- package/es/components/dialog/src/dialog.vue.d.ts +9 -4
- package/es/components/divider/src/divider.d.ts +1 -1
- package/es/components/divider/src/divider.vue.d.ts +1 -1
- package/es/components/drawer/src/drawer.d.ts +5 -4
- package/es/components/drawer/src/drawer.vue.d.ts +12 -7
- package/es/components/dropdown/src/dropdown-item-impl.vue.d.ts +2 -2
- package/es/components/dropdown/src/dropdown-item.vue.d.ts +5 -5
- package/es/components/dropdown/src/dropdown-menu.vue.d.ts +1 -1
- package/es/components/dropdown/src/dropdown.d.ts +5 -106
- package/es/components/dropdown/src/dropdown.vue.d.ts +115 -313
- package/es/components/dropdown/style/css.mjs +1 -1
- package/es/components/dropdown/style/index.mjs +1 -1
- package/es/components/form/src/form-item.d.ts +3 -3
- package/es/components/form/src/form-item.vue.d.ts +2 -2
- package/es/components/form/src/form.d.ts +4 -4
- package/es/components/form/src/hooks/use-form-common-props.d.ts +2 -2
- package/es/components/image/src/image.d.ts +1 -1
- package/es/components/image/src/image.mjs.map +1 -1
- package/es/components/image/src/image.vue.d.ts +4 -4
- package/es/components/image-viewer/src/image-viewer.mjs.map +1 -1
- package/es/components/image-viewer/src/image-viewer.vue.d.ts +4 -4
- package/es/components/input/src/input.d.ts +4 -4
- package/es/components/input/src/input.vue.d.ts +19 -19
- package/es/components/input-number/src/input-number.d.ts +3 -3
- package/es/components/input-number/src/input-number.vue.d.ts +10 -10
- package/es/components/input-otp/src/input-otp.vue.d.ts +7 -7
- package/es/components/input-tag/src/composables/use-input-tag.d.ts +1 -1
- package/es/components/input-tag/src/input-tag.d.ts +3 -3
- package/es/components/input-tag/src/input-tag.vue.d.ts +12 -12
- package/es/components/link/src/link.d.ts +2 -2
- package/es/components/link/src/link.mjs.map +1 -1
- package/es/components/mention/src/mention.d.ts +7 -108
- package/es/components/mention/src/mention.vue.d.ts +5 -5
- package/es/components/mention/src/mention.vue_vue_type_script_setup_true_lang.mjs.map +1 -1
- package/es/components/mention/src/mention2.mjs.map +1 -1
- package/es/components/menu/src/menu.d.ts +13 -25
- package/es/components/menu/src/menu.mjs +18 -2
- package/es/components/menu/src/menu.mjs.map +1 -1
- package/es/components/menu/src/sub-menu.d.ts +11 -23
- package/es/components/menu/src/sub-menu.mjs +18 -2
- package/es/components/menu/src/sub-menu.mjs.map +1 -1
- package/es/components/message/src/instance.d.ts +1 -1
- package/es/components/message/src/message.d.ts +5 -5
- package/es/components/message/src/message.mjs +6 -1
- package/es/components/message/src/message.mjs.map +1 -1
- package/es/components/message/src/message.vue.d.ts +7 -6
- package/es/components/message/src/method.mjs.map +1 -1
- package/es/components/message-box/src/index.vue.d.ts +73 -81
- package/es/components/notification/src/notification.d.ts +4 -3
- package/es/components/notification/src/notification.mjs +6 -1
- package/es/components/notification/src/notification.mjs.map +1 -1
- package/es/components/notification/src/notification.vue.d.ts +5 -4
- package/es/components/overlay/index.d.ts +4 -12
- package/es/components/overlay/src/overlay.d.ts +5 -18
- package/es/components/overlay/src/overlay.mjs +9 -5
- package/es/components/overlay/src/overlay.mjs.map +1 -1
- package/es/components/pagination/src/components/jumper.d.ts +1 -1
- package/es/components/pagination/src/components/jumper.vue.d.ts +2 -2
- package/es/components/pagination/src/components/sizes.d.ts +5 -14
- package/es/components/pagination/src/components/sizes.mjs +18 -2
- package/es/components/pagination/src/components/sizes.mjs.map +1 -1
- package/es/components/pagination/src/components/sizes.vue.d.ts +10 -27
- package/es/components/pagination/src/pagination.d.ts +16 -29
- package/es/components/pagination/src/pagination.mjs +15 -2
- package/es/components/pagination/src/pagination.mjs.map +1 -1
- package/es/components/popconfirm/src/popconfirm.d.ts +2 -2
- package/es/components/popconfirm/src/popconfirm.vue.d.ts +5 -5
- package/es/components/popover/src/popover.d.ts +5 -105
- package/es/components/popover/src/popover.mjs +1 -0
- package/es/components/popover/src/popover.mjs.map +1 -1
- package/es/components/popover/src/popover.vue.d.ts +14 -13
- package/es/components/popper/src/composables/use-content-dom.d.ts +2 -25
- package/es/components/popper/src/composables/use-content.d.ts +4 -4
- package/es/components/popper/src/content.d.ts +8 -18
- package/es/components/popper/src/content.mjs +13 -7
- package/es/components/popper/src/content.mjs.map +1 -1
- package/es/components/popper/src/content.vue.d.ts +19 -17
- package/es/components/popper/src/popper.d.ts +2 -2
- package/es/components/popper/src/popper.mjs.map +1 -1
- package/es/components/progress/src/progress.d.ts +1 -1
- package/es/components/progress/src/progress.vue.d.ts +2 -2
- package/es/components/radio/src/radio-button.d.ts +4 -4
- package/es/components/radio/src/radio-button.vue.d.ts +2 -2
- package/es/components/radio/src/radio-group.d.ts +1 -1
- package/es/components/radio/src/radio-group.vue.d.ts +6 -6
- package/es/components/radio/src/radio.d.ts +8 -8
- package/es/components/radio/src/radio.vue.d.ts +4 -4
- package/es/components/radio/src/use-radio.d.ts +1 -1
- package/es/components/rate/src/rate.d.ts +1 -1
- package/es/components/rate/src/rate.vue.d.ts +3 -3
- package/es/components/rate/src/rate.vue_vue_type_script_setup_true_lang.mjs.map +1 -1
- package/es/components/rate/src/rate2.mjs.map +1 -1
- package/es/components/result/src/result.d.ts +1 -1
- package/es/components/result/src/result.vue.d.ts +1 -1
- package/es/components/row/src/row.d.ts +1 -1
- package/es/components/scrollbar/src/scrollbar.d.ts +5 -4
- package/es/components/scrollbar/src/scrollbar.mjs +12 -2
- package/es/components/scrollbar/src/scrollbar.mjs.map +1 -1
- package/es/components/scrollbar/src/scrollbar.vue.d.ts +5 -4
- package/es/components/scrollbar/src/thumb.vue_vue_type_script_setup_true_lang.mjs.map +1 -1
- package/es/components/scrollbar/src/thumb2.mjs.map +1 -1
- package/es/components/segmented/index.d.ts +2 -2
- package/es/components/segmented/src/segmented.d.ts +2 -2
- package/es/components/segmented/src/segmented.vue.d.ts +1 -1
- package/es/components/select/src/option.d.ts +2 -2
- package/es/components/select/src/option.vue.d.ts +5 -5
- package/es/components/select/src/select-dropdown.vue.d.ts +2 -1
- package/es/components/select/src/select.d.ts +12 -16
- package/es/components/select/src/select.mjs +15 -2
- package/es/components/select/src/select.mjs.map +1 -1
- package/es/components/select/src/select.vue.d.ts +137 -143
- package/es/components/select/src/select.vue_vue_type_script_lang.mjs.map +1 -1
- package/es/components/select/src/select2.mjs.map +1 -1
- package/es/components/select/src/useOption.d.ts +2 -2
- package/es/components/select/src/useSelect.d.ts +7 -7
- package/es/components/select/src/useSelect.mjs.map +1 -1
- package/es/components/select-v2/src/defaults.d.ts +6 -106
- package/es/components/select-v2/src/option-item.vue.d.ts +1 -1
- package/es/components/select-v2/src/select.vue.d.ts +110 -308
- package/es/components/select-v2/src/useSelect.d.ts +2 -2
- package/es/components/skeleton/src/skeleton-item.d.ts +1 -1
- package/es/components/skeleton/src/skeleton.vue.d.ts +1 -1
- package/es/components/slider/src/button.d.ts +2 -1
- package/es/components/slider/src/button.mjs +10 -2
- package/es/components/slider/src/button.mjs.map +1 -1
- package/es/components/slider/src/button.vue.d.ts +6 -4
- package/es/components/slider/src/composables/use-marks.mjs.map +1 -1
- package/es/components/slider/src/slider.d.ts +4 -4
- package/es/components/slider/src/slider.mjs +6 -1
- package/es/components/slider/src/slider.mjs.map +1 -1
- package/es/components/slider/src/slider.vue.d.ts +16 -16
- package/es/components/space/src/space.d.ts +10 -10
- package/es/components/space/src/space.mjs +2 -1
- package/es/components/space/src/space.mjs.map +1 -1
- package/es/components/space/src/use-space.d.ts +2 -3
- package/es/components/splitter/src/split-bar.vue.d.ts +1 -1
- package/es/components/statistic/src/statistic.vue.d.ts +2 -2
- package/es/components/steps/src/item.d.ts +1 -1
- package/es/components/steps/src/item.vue.d.ts +1 -1
- package/es/components/steps/src/steps.d.ts +2 -2
- package/es/components/steps/src/steps.vue.d.ts +1 -1
- package/es/components/switch/src/switch.d.ts +1 -1
- package/es/components/switch/src/switch.vue.d.ts +4 -4
- package/es/components/table/src/filter-panel.vue.d.ts +107 -104
- package/es/components/table/src/table/defaults.d.ts +6 -6
- package/es/components/table/src/table/defaults.mjs.map +1 -1
- package/es/components/table/src/table/style-helper.d.ts +2 -2
- package/es/components/table/src/table-body/events-helper.mjs.map +1 -1
- package/es/components/table/src/table-column/defaults.d.ts +4 -4
- package/es/components/table/src/table-footer/index.d.ts +1 -1
- package/es/components/table/src/table-header/index.d.ts +19 -19
- package/es/components/table/src/table.vue.d.ts +5 -5
- package/es/components/table-v2/src/components/header.d.ts +1 -1
- package/es/components/table-v2/src/components/row.d.ts +1 -1
- package/es/components/table-v2/src/table-grid.d.ts +4 -4
- package/es/components/table-v2/src/table-v2.d.ts +5 -5
- package/es/components/tabs/src/tab-nav.d.ts +1 -1
- package/es/components/tabs/src/tabs.d.ts +6 -6
- package/es/components/tag/src/tag.d.ts +3 -3
- package/es/components/tag/src/tag.vue.d.ts +2 -2
- package/es/components/text/src/text.d.ts +2 -2
- package/es/components/time-picker/src/common/picker-range-trigger.vue.d.ts +6 -6
- package/es/components/time-picker/src/common/picker.vue.d.ts +23 -223
- package/es/components/time-picker/src/common/props.d.ts +4 -104
- package/es/components/time-picker/src/time-picker.d.ts +17 -217
- package/es/components/time-select/src/time-select.d.ts +7 -11
- package/es/components/time-select/src/time-select.mjs +15 -2
- package/es/components/time-select/src/time-select.mjs.map +1 -1
- package/es/components/time-select/src/time-select.vue.d.ts +11 -10
- package/es/components/timeline/src/timeline-item.d.ts +2 -2
- package/es/components/timeline/src/timeline-item.vue.d.ts +1 -1
- package/es/components/tooltip/src/content.d.ts +4 -199
- package/es/components/tooltip/src/content.vue.d.ts +18 -16
- package/es/components/tooltip/src/tooltip.d.ts +5 -202
- package/es/components/tooltip/src/tooltip.vue.d.ts +22 -21
- package/es/components/tooltip/src/trigger.d.ts +1 -1
- package/es/components/tour/src/content.d.ts +1 -1
- package/es/components/tour/src/content.vue.d.ts +1 -1
- package/es/components/tour/src/mask.vue.d.ts +1 -1
- package/es/components/tour/src/step.d.ts +1 -1
- package/es/components/tour/src/step.vue.d.ts +1 -1
- package/es/components/tour/src/tour.d.ts +1 -1
- package/es/components/tour/src/tour.vue.d.ts +7 -7
- package/es/components/transfer/src/transfer.vue.d.ts +1 -1
- package/es/components/tree/src/tree-node.vue.d.ts +18 -18
- package/es/components/tree/src/tree.vue.d.ts +22 -22
- package/es/components/tree-select/src/select.mjs +1 -5
- package/es/components/tree-select/src/select.mjs.map +1 -1
- package/es/components/tree-select/src/tree-select-option.d.ts +5 -5
- package/es/components/tree-select/src/tree-select.vue.d.ts +44 -52
- package/es/components/tree-v2/src/composables/useTree.d.ts +13 -12
- package/es/components/tree-v2/src/tree.vue.d.ts +5 -5
- package/es/components/upload/src/upload-content.d.ts +1 -1
- package/es/components/upload/src/upload-content.vue.d.ts +2 -2
- package/es/components/upload/src/upload-list.d.ts +1 -1
- package/es/components/upload/src/upload.d.ts +2 -2
- package/es/components/upload/src/upload.mjs.map +1 -1
- package/es/components/upload/src/upload.vue.d.ts +2 -2
- package/es/components/virtual-list/src/builders/build-grid.d.ts +5 -4
- package/es/components/virtual-list/src/builders/build-list.d.ts +7 -6
- package/es/components/virtual-list/src/components/dynamic-size-grid.d.ts +5 -4
- package/es/components/virtual-list/src/components/dynamic-size-list.d.ts +7 -6
- package/es/components/virtual-list/src/components/fixed-size-grid.d.ts +5 -4
- package/es/components/virtual-list/src/components/fixed-size-list.d.ts +7 -6
- package/es/components/virtual-list/src/components/scrollbar.d.ts +4 -2
- package/es/components/virtual-list/src/props.d.ts +5 -4
- package/es/components/virtual-list/src/props.mjs +15 -2
- package/es/components/virtual-list/src/props.mjs.map +1 -1
- package/es/components/watermark/src/watermark.mjs.map +1 -1
- package/es/components/watermark/src/watermark.vue.d.ts +1 -1
- package/es/hooks/use-floating/index.d.ts +12 -12
- package/es/hooks/use-popper/index.d.ts +4 -4
- package/es/hooks/use-size/index.d.ts +3 -3
- package/es/hooks/use-throttle-render/index.mjs.map +1 -1
- package/es/utils/index.d.ts +2 -2
- package/es/utils/typescript.d.ts +2 -1
- package/es/utils/typescript.mjs.map +1 -1
- package/es/utils/vue/size.d.ts +1 -1
- package/es/version.d.ts +1 -1
- package/es/version.mjs +1 -1
- package/es/version.mjs.map +1 -1
- package/lib/components/affix/src/affix.d.ts +1 -1
- package/lib/components/affix/src/affix.vue.d.ts +3 -3
- package/lib/components/alert/src/alert.d.ts +2 -2
- package/lib/components/anchor/src/anchor.d.ts +1 -1
- package/lib/components/anchor/src/anchor.vue.d.ts +2 -2
- package/lib/components/autocomplete/src/autocomplete.d.ts +7 -108
- package/lib/components/autocomplete/src/autocomplete.js.map +1 -1
- package/lib/components/autocomplete/src/autocomplete.vue.d.ts +5 -5
- package/lib/components/autocomplete/src/autocomplete.vue_vue_type_script_setup_true_lang.js.map +1 -1
- package/lib/components/autocomplete/src/autocomplete2.js.map +1 -1
- package/lib/components/avatar/src/avatar-group-props.d.ts +9 -106
- package/lib/components/avatar/src/avatar-group-props.js +9 -1
- package/lib/components/avatar/src/avatar-group-props.js.map +1 -1
- package/lib/components/avatar/src/avatar-group.d.ts +20 -213
- package/lib/components/avatar/src/avatar.d.ts +3 -3
- package/lib/components/backtop/src/backtop.vue.d.ts +1 -1
- package/lib/components/badge/src/badge.d.ts +4 -8
- package/lib/components/badge/src/badge.js +9 -1
- package/lib/components/badge/src/badge.js.map +1 -1
- package/lib/components/badge/src/badge.vue.d.ts +3 -1
- package/lib/components/badge/src/badge.vue_vue_type_script_setup_true_lang.js.map +1 -1
- package/lib/components/badge/src/badge2.js.map +1 -1
- package/lib/components/button/src/button-group.d.ts +2 -2
- package/lib/components/button/src/button-group.vue.d.ts +1 -1
- package/lib/components/button/src/button.d.ts +2 -2
- package/lib/components/button/src/button.vue.d.ts +4 -4
- package/lib/components/button/src/use-button.d.ts +2 -2
- package/lib/components/calendar/src/calendar.js.map +1 -1
- package/lib/components/calendar/src/calendar.vue.d.ts +1 -1
- package/lib/components/calendar/style/css.js +1 -1
- package/lib/components/calendar/style/index.js +1 -1
- package/lib/components/card/src/card.d.ts +8 -7
- package/lib/components/card/src/card.js +27 -3
- package/lib/components/card/src/card.js.map +1 -1
- package/lib/components/card/src/card.vue.d.ts +4 -0
- package/lib/components/card/src/card.vue_vue_type_script_setup_true_lang.js.map +1 -1
- package/lib/components/card/src/card2.js.map +1 -1
- package/lib/components/carousel/src/carousel.d.ts +1 -1
- package/lib/components/carousel/src/carousel.vue.d.ts +4 -4
- package/lib/components/cascader/src/cascader.d.ts +9 -110
- package/lib/components/cascader/src/cascader.js.map +1 -1
- package/lib/components/cascader/src/cascader.vue.d.ts +22 -20
- package/lib/components/cascader/src/cascader.vue_vue_type_script_setup_true_lang.js.map +1 -1
- package/lib/components/cascader/src/cascader2.js.map +1 -1
- package/lib/components/cascader-panel/src/index.vue.d.ts +4 -4
- package/lib/components/cascader-panel/src/menu.vue.d.ts +1 -1
- package/lib/components/check-tag/src/check-tag.d.ts +1 -1
- package/lib/components/checkbox/src/checkbox-button.vue.d.ts +6 -6
- package/lib/components/checkbox/src/checkbox-group.d.ts +1 -1
- package/lib/components/checkbox/src/checkbox-group.vue.d.ts +5 -5
- package/lib/components/checkbox/src/checkbox.d.ts +9 -9
- package/lib/components/checkbox/src/checkbox.vue.d.ts +6 -6
- package/lib/components/checkbox/src/composables/use-checkbox-status.d.ts +2 -2
- package/lib/components/checkbox/src/composables/use-checkbox.d.ts +2 -2
- package/lib/components/col/src/col.vue.d.ts +1 -1
- package/lib/components/collapse/src/collapse-item.vue.d.ts +1 -1
- package/lib/components/collapse/src/collapse.d.ts +1 -1
- package/lib/components/collapse/src/collapse.vue.d.ts +1 -1
- package/lib/components/color-picker/src/color-picker.d.ts +5 -104
- package/lib/components/color-picker/src/color-picker.js +1 -0
- package/lib/components/color-picker/src/color-picker.js.map +1 -1
- package/lib/components/color-picker/src/color-picker.vue.d.ts +12 -10
- package/lib/components/color-picker-panel/src/color-picker-panel.d.ts +4 -10
- package/lib/components/color-picker-panel/src/color-picker-panel.js +9 -5
- package/lib/components/color-picker-panel/src/color-picker-panel.js.map +1 -1
- package/lib/components/color-picker-panel/src/color-picker-panel.vue.d.ts +4 -1
- package/lib/components/color-picker-panel/src/color-picker-panel.vue_vue_type_script_setup_true_lang.js.map +1 -1
- package/lib/components/color-picker-panel/src/color-picker-panel2.js.map +1 -1
- package/lib/components/config-provider/src/config-provider-props.d.ts +1 -1
- package/lib/components/config-provider/src/config-provider.d.ts +2 -2
- package/lib/components/config-provider/src/hooks/use-global-config.d.ts +1 -1
- package/lib/components/date-picker/src/date-picker.d.ts +17 -217
- package/lib/components/date-picker/src/props.d.ts +4 -104
- package/lib/components/date-picker-panel/src/composables/use-basic-date-table.d.ts +1 -1
- package/lib/components/date-picker-panel/src/date-picker-com/panel-date-pick.vue.d.ts +3 -3
- package/lib/components/date-picker-panel/src/date-picker-com/panel-date-range.vue.d.ts +2 -2
- package/lib/components/date-picker-panel/src/date-picker-com/panel-month-range.vue.d.ts +2 -2
- package/lib/components/date-picker-panel/src/date-picker-com/panel-year-range.vue.d.ts +2 -2
- package/lib/components/date-picker-panel/src/date-picker-panel.d.ts +4 -4
- package/lib/components/date-picker-panel/src/panel-utils.d.ts +21 -21
- package/lib/components/date-picker-panel/src/props/basic-date-table.js.map +1 -1
- package/lib/components/descriptions/src/description-item.d.ts +18 -18
- package/lib/components/descriptions/src/description.d.ts +1 -1
- package/lib/components/descriptions/src/description.vue.d.ts +2 -2
- package/lib/components/dialog/src/dialog-content.d.ts +10 -6
- package/lib/components/dialog/src/dialog-content.js +31 -4
- package/lib/components/dialog/src/dialog-content.js.map +1 -1
- package/lib/components/dialog/src/dialog-content.vue.d.ts +5 -1
- package/lib/components/dialog/src/dialog.d.ts +10 -5
- package/lib/components/dialog/src/dialog.js +11 -14
- package/lib/components/dialog/src/dialog.js.map +1 -1
- package/lib/components/dialog/src/dialog.vue.d.ts +9 -4
- package/lib/components/divider/src/divider.d.ts +1 -1
- package/lib/components/divider/src/divider.vue.d.ts +1 -1
- package/lib/components/drawer/src/drawer.d.ts +5 -4
- package/lib/components/drawer/src/drawer.vue.d.ts +12 -7
- package/lib/components/dropdown/src/dropdown-item-impl.vue.d.ts +2 -2
- package/lib/components/dropdown/src/dropdown-item.vue.d.ts +5 -5
- package/lib/components/dropdown/src/dropdown-menu.vue.d.ts +1 -1
- package/lib/components/dropdown/src/dropdown.d.ts +5 -106
- package/lib/components/dropdown/src/dropdown.vue.d.ts +115 -313
- package/lib/components/dropdown/style/css.js +1 -1
- package/lib/components/dropdown/style/index.js +1 -1
- package/lib/components/form/src/form-item.d.ts +3 -3
- package/lib/components/form/src/form-item.vue.d.ts +2 -2
- package/lib/components/form/src/form.d.ts +4 -4
- package/lib/components/form/src/hooks/use-form-common-props.d.ts +2 -2
- package/lib/components/image/src/image.d.ts +1 -1
- package/lib/components/image/src/image.js.map +1 -1
- package/lib/components/image/src/image.vue.d.ts +4 -4
- package/lib/components/image-viewer/src/image-viewer.js.map +1 -1
- package/lib/components/image-viewer/src/image-viewer.vue.d.ts +4 -4
- package/lib/components/input/src/input.d.ts +4 -4
- package/lib/components/input/src/input.vue.d.ts +19 -19
- package/lib/components/input-number/src/input-number.d.ts +3 -3
- package/lib/components/input-number/src/input-number.vue.d.ts +10 -10
- package/lib/components/input-otp/src/input-otp.vue.d.ts +7 -7
- package/lib/components/input-tag/src/composables/use-input-tag.d.ts +1 -1
- package/lib/components/input-tag/src/input-tag.d.ts +3 -3
- package/lib/components/input-tag/src/input-tag.vue.d.ts +12 -12
- package/lib/components/link/src/link.d.ts +2 -2
- package/lib/components/link/src/link.js.map +1 -1
- package/lib/components/mention/src/mention.d.ts +7 -108
- package/lib/components/mention/src/mention.vue.d.ts +5 -5
- package/lib/components/mention/src/mention.vue_vue_type_script_setup_true_lang.js.map +1 -1
- package/lib/components/mention/src/mention2.js.map +1 -1
- package/lib/components/menu/src/menu.d.ts +13 -25
- package/lib/components/menu/src/menu.js +18 -2
- package/lib/components/menu/src/menu.js.map +1 -1
- package/lib/components/menu/src/sub-menu.d.ts +11 -23
- package/lib/components/menu/src/sub-menu.js +18 -2
- package/lib/components/menu/src/sub-menu.js.map +1 -1
- package/lib/components/message/src/instance.d.ts +1 -1
- package/lib/components/message/src/message.d.ts +5 -5
- package/lib/components/message/src/message.js +6 -1
- package/lib/components/message/src/message.js.map +1 -1
- package/lib/components/message/src/message.vue.d.ts +7 -6
- package/lib/components/message/src/method.js.map +1 -1
- package/lib/components/message-box/src/index.vue.d.ts +73 -81
- package/lib/components/notification/src/notification.d.ts +4 -3
- package/lib/components/notification/src/notification.js +6 -1
- package/lib/components/notification/src/notification.js.map +1 -1
- package/lib/components/notification/src/notification.vue.d.ts +5 -4
- package/lib/components/overlay/index.d.ts +4 -12
- package/lib/components/overlay/src/overlay.d.ts +5 -18
- package/lib/components/overlay/src/overlay.js +9 -5
- package/lib/components/overlay/src/overlay.js.map +1 -1
- package/lib/components/pagination/src/components/jumper.d.ts +1 -1
- package/lib/components/pagination/src/components/jumper.vue.d.ts +2 -2
- package/lib/components/pagination/src/components/sizes.d.ts +5 -14
- package/lib/components/pagination/src/components/sizes.js +18 -2
- package/lib/components/pagination/src/components/sizes.js.map +1 -1
- package/lib/components/pagination/src/components/sizes.vue.d.ts +10 -27
- package/lib/components/pagination/src/pagination.d.ts +16 -29
- package/lib/components/pagination/src/pagination.js +15 -2
- package/lib/components/pagination/src/pagination.js.map +1 -1
- package/lib/components/popconfirm/src/popconfirm.d.ts +2 -2
- package/lib/components/popconfirm/src/popconfirm.vue.d.ts +5 -5
- package/lib/components/popover/src/popover.d.ts +5 -105
- package/lib/components/popover/src/popover.js +1 -0
- package/lib/components/popover/src/popover.js.map +1 -1
- package/lib/components/popover/src/popover.vue.d.ts +14 -13
- package/lib/components/popper/src/composables/use-content-dom.d.ts +2 -25
- package/lib/components/popper/src/composables/use-content.d.ts +4 -4
- package/lib/components/popper/src/content.d.ts +8 -18
- package/lib/components/popper/src/content.js +13 -7
- package/lib/components/popper/src/content.js.map +1 -1
- package/lib/components/popper/src/content.vue.d.ts +19 -17
- package/lib/components/popper/src/popper.d.ts +2 -2
- package/lib/components/popper/src/popper.js.map +1 -1
- package/lib/components/progress/src/progress.d.ts +1 -1
- package/lib/components/progress/src/progress.vue.d.ts +2 -2
- package/lib/components/radio/src/radio-button.d.ts +4 -4
- package/lib/components/radio/src/radio-button.vue.d.ts +2 -2
- package/lib/components/radio/src/radio-group.d.ts +1 -1
- package/lib/components/radio/src/radio-group.vue.d.ts +6 -6
- package/lib/components/radio/src/radio.d.ts +8 -8
- package/lib/components/radio/src/radio.vue.d.ts +4 -4
- package/lib/components/radio/src/use-radio.d.ts +1 -1
- package/lib/components/rate/src/rate.d.ts +1 -1
- package/lib/components/rate/src/rate.vue.d.ts +3 -3
- package/lib/components/rate/src/rate.vue_vue_type_script_setup_true_lang.js.map +1 -1
- package/lib/components/rate/src/rate2.js.map +1 -1
- package/lib/components/result/src/result.d.ts +1 -1
- package/lib/components/result/src/result.vue.d.ts +1 -1
- package/lib/components/row/src/row.d.ts +1 -1
- package/lib/components/scrollbar/src/scrollbar.d.ts +5 -4
- package/lib/components/scrollbar/src/scrollbar.js +12 -2
- package/lib/components/scrollbar/src/scrollbar.js.map +1 -1
- package/lib/components/scrollbar/src/scrollbar.vue.d.ts +5 -4
- package/lib/components/scrollbar/src/thumb.vue_vue_type_script_setup_true_lang.js.map +1 -1
- package/lib/components/scrollbar/src/thumb2.js.map +1 -1
- package/lib/components/segmented/index.d.ts +2 -2
- package/lib/components/segmented/src/segmented.d.ts +2 -2
- package/lib/components/segmented/src/segmented.vue.d.ts +1 -1
- package/lib/components/select/src/option.d.ts +2 -2
- package/lib/components/select/src/option.vue.d.ts +5 -5
- package/lib/components/select/src/select-dropdown.vue.d.ts +2 -1
- package/lib/components/select/src/select.d.ts +12 -16
- package/lib/components/select/src/select.js +15 -2
- package/lib/components/select/src/select.js.map +1 -1
- package/lib/components/select/src/select.vue.d.ts +137 -143
- package/lib/components/select/src/select.vue_vue_type_script_lang.js.map +1 -1
- package/lib/components/select/src/select2.js.map +1 -1
- package/lib/components/select/src/useOption.d.ts +2 -2
- package/lib/components/select/src/useSelect.d.ts +7 -7
- package/lib/components/select/src/useSelect.js.map +1 -1
- package/lib/components/select-v2/src/defaults.d.ts +6 -106
- package/lib/components/select-v2/src/option-item.vue.d.ts +1 -1
- package/lib/components/select-v2/src/select.vue.d.ts +110 -308
- package/lib/components/select-v2/src/useSelect.d.ts +2 -2
- package/lib/components/skeleton/src/skeleton-item.d.ts +1 -1
- package/lib/components/skeleton/src/skeleton.vue.d.ts +1 -1
- package/lib/components/slider/src/button.d.ts +2 -1
- package/lib/components/slider/src/button.js +9 -1
- package/lib/components/slider/src/button.js.map +1 -1
- package/lib/components/slider/src/button.vue.d.ts +6 -4
- package/lib/components/slider/src/composables/use-marks.js.map +1 -1
- package/lib/components/slider/src/slider.d.ts +4 -4
- package/lib/components/slider/src/slider.js +6 -1
- package/lib/components/slider/src/slider.js.map +1 -1
- package/lib/components/slider/src/slider.vue.d.ts +16 -16
- package/lib/components/space/src/space.d.ts +10 -10
- package/lib/components/space/src/space.js +2 -1
- package/lib/components/space/src/space.js.map +1 -1
- package/lib/components/space/src/use-space.d.ts +2 -3
- package/lib/components/splitter/src/split-bar.vue.d.ts +1 -1
- package/lib/components/statistic/src/statistic.vue.d.ts +2 -2
- package/lib/components/steps/src/item.d.ts +1 -1
- package/lib/components/steps/src/item.vue.d.ts +1 -1
- package/lib/components/steps/src/steps.d.ts +2 -2
- package/lib/components/steps/src/steps.vue.d.ts +1 -1
- package/lib/components/switch/src/switch.d.ts +1 -1
- package/lib/components/switch/src/switch.vue.d.ts +4 -4
- package/lib/components/table/src/filter-panel.vue.d.ts +107 -104
- package/lib/components/table/src/table/defaults.d.ts +6 -6
- package/lib/components/table/src/table/defaults.js.map +1 -1
- package/lib/components/table/src/table/style-helper.d.ts +2 -2
- package/lib/components/table/src/table-body/events-helper.js.map +1 -1
- package/lib/components/table/src/table-column/defaults.d.ts +4 -4
- package/lib/components/table/src/table-footer/index.d.ts +1 -1
- package/lib/components/table/src/table-header/index.d.ts +19 -19
- package/lib/components/table/src/table.vue.d.ts +5 -5
- package/lib/components/table-v2/src/components/header.d.ts +1 -1
- package/lib/components/table-v2/src/components/row.d.ts +1 -1
- package/lib/components/table-v2/src/table-grid.d.ts +4 -4
- package/lib/components/table-v2/src/table-v2.d.ts +5 -5
- package/lib/components/tabs/src/tab-nav.d.ts +1 -1
- package/lib/components/tabs/src/tabs.d.ts +6 -6
- package/lib/components/tag/src/tag.d.ts +3 -3
- package/lib/components/tag/src/tag.vue.d.ts +2 -2
- package/lib/components/text/src/text.d.ts +2 -2
- package/lib/components/time-picker/src/common/picker-range-trigger.vue.d.ts +6 -6
- package/lib/components/time-picker/src/common/picker.vue.d.ts +23 -223
- package/lib/components/time-picker/src/common/props.d.ts +4 -104
- package/lib/components/time-picker/src/time-picker.d.ts +17 -217
- package/lib/components/time-select/src/time-select.d.ts +7 -11
- package/lib/components/time-select/src/time-select.js +15 -2
- package/lib/components/time-select/src/time-select.js.map +1 -1
- package/lib/components/time-select/src/time-select.vue.d.ts +11 -10
- package/lib/components/timeline/src/timeline-item.d.ts +2 -2
- package/lib/components/timeline/src/timeline-item.vue.d.ts +1 -1
- package/lib/components/tooltip/src/content.d.ts +4 -199
- package/lib/components/tooltip/src/content.vue.d.ts +18 -16
- package/lib/components/tooltip/src/tooltip.d.ts +5 -202
- package/lib/components/tooltip/src/tooltip.vue.d.ts +22 -21
- package/lib/components/tooltip/src/trigger.d.ts +1 -1
- package/lib/components/tour/src/content.d.ts +1 -1
- package/lib/components/tour/src/content.vue.d.ts +1 -1
- package/lib/components/tour/src/mask.vue.d.ts +1 -1
- package/lib/components/tour/src/step.d.ts +1 -1
- package/lib/components/tour/src/step.vue.d.ts +1 -1
- package/lib/components/tour/src/tour.d.ts +1 -1
- package/lib/components/tour/src/tour.vue.d.ts +7 -7
- package/lib/components/transfer/src/transfer.vue.d.ts +1 -1
- package/lib/components/tree/src/tree-node.vue.d.ts +18 -18
- package/lib/components/tree/src/tree.vue.d.ts +22 -22
- package/lib/components/tree-select/src/select.js +1 -5
- package/lib/components/tree-select/src/select.js.map +1 -1
- package/lib/components/tree-select/src/tree-select-option.d.ts +5 -5
- package/lib/components/tree-select/src/tree-select.vue.d.ts +44 -52
- package/lib/components/tree-v2/src/composables/useTree.d.ts +13 -12
- package/lib/components/tree-v2/src/tree.vue.d.ts +5 -5
- package/lib/components/upload/src/upload-content.d.ts +1 -1
- package/lib/components/upload/src/upload-content.vue.d.ts +2 -2
- package/lib/components/upload/src/upload-list.d.ts +1 -1
- package/lib/components/upload/src/upload.d.ts +2 -2
- package/lib/components/upload/src/upload.js.map +1 -1
- package/lib/components/upload/src/upload.vue.d.ts +2 -2
- package/lib/components/virtual-list/src/builders/build-grid.d.ts +5 -4
- package/lib/components/virtual-list/src/builders/build-list.d.ts +7 -6
- package/lib/components/virtual-list/src/components/dynamic-size-grid.d.ts +5 -4
- package/lib/components/virtual-list/src/components/dynamic-size-list.d.ts +7 -6
- package/lib/components/virtual-list/src/components/fixed-size-grid.d.ts +5 -4
- package/lib/components/virtual-list/src/components/fixed-size-list.d.ts +7 -6
- package/lib/components/virtual-list/src/components/scrollbar.d.ts +4 -2
- package/lib/components/virtual-list/src/props.d.ts +5 -4
- package/lib/components/virtual-list/src/props.js +15 -2
- package/lib/components/virtual-list/src/props.js.map +1 -1
- package/lib/components/watermark/src/watermark.js.map +1 -1
- package/lib/components/watermark/src/watermark.vue.d.ts +1 -1
- package/lib/hooks/use-floating/index.d.ts +12 -12
- package/lib/hooks/use-popper/index.d.ts +4 -4
- package/lib/hooks/use-size/index.d.ts +3 -3
- package/lib/hooks/use-throttle-render/index.js.map +1 -1
- package/lib/utils/index.d.ts +2 -2
- package/lib/utils/typescript.d.ts +2 -1
- package/lib/utils/typescript.js.map +1 -1
- package/lib/utils/vue/size.d.ts +1 -1
- package/lib/version.d.ts +1 -1
- package/lib/version.js +1 -1
- package/lib/version.js.map +1 -1
- package/package.json +2 -2
- package/web-types.json +1 -1
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"rate.vue_vue_type_script_setup_true_lang.js","names":[],"sources":["../../../../../../packages/components/rate/src/rate.vue"],"sourcesContent":["<template>\n <div\n :id=\"inputId\"\n :class=\"[rateClasses, ns.is('disabled', rateDisabled)]\"\n role=\"slider\"\n :aria-label=\"!isLabeledByFormItem ? ariaLabel || 'rating' : undefined\"\n :aria-labelledby=\"\n isLabeledByFormItem ? formItemContext?.labelId : undefined\n \"\n :aria-valuenow=\"currentValue\"\n :aria-valuetext=\"text || undefined\"\n aria-valuemin=\"0\"\n :aria-valuemax=\"max\"\n :style=\"rateStyles\"\n :tabindex=\"rateDisabled ? undefined : 0\"\n :aria-disabled=\"rateDisabled\"\n @keydown=\"handleKey\"\n >\n <span\n v-for=\"(item, key) in max\"\n :key=\"key\"\n :class=\"ns.e('item')\"\n @mousemove=\"setCurrentValue(item, $event)\"\n @mouseleave=\"resetCurrentValue\"\n @click=\"selectValue(item)\"\n >\n <el-icon\n ref=\"iconRefs\"\n :class=\"[\n ns.e('icon'),\n { hover: hoverIndex === item },\n ns.is('active', item <= currentValue),\n ns.is('focus-visible', item === Math.ceil(currentValue || 1)),\n ]\"\n >\n <component\n :is=\"activeComponent\"\n v-show=\"!showDecimalIcon(item) && item <= currentValue\"\n />\n <component\n :is=\"voidComponent\"\n v-show=\"!showDecimalIcon(item) && item > currentValue\"\n />\n <component\n :is=\"voidComponent\"\n v-show=\"showDecimalIcon(item)\"\n :class=\"[ns.em('decimal', 'box')]\"\n />\n <el-icon\n v-show=\"showDecimalIcon(item)\"\n :style=\"decimalStyle\"\n :class=\"[ns.e('icon'), ns.e('decimal')]\"\n >\n <component :is=\"decimalIconComponent\" />\n </el-icon>\n </el-icon>\n </span>\n <span\n v-if=\"showText || showScore\"\n :class=\"ns.e('text')\"\n :style=\"{ color: textColor }\"\n >\n {{ text }}\n </span>\n </div>\n</template>\n\n<script lang=\"ts\" setup>\nimport { computed, inject, markRaw, ref, watch } from 'vue'\nimport { clamp } from 'lodash-unified'\nimport {\n CHANGE_EVENT,\n EVENT_CODE,\n UPDATE_MODEL_EVENT,\n} from '@element-plus/constants'\nimport { getEventCode, isArray, isObject, isString } from '@element-plus/utils'\nimport {\n formItemContextKey,\n useFormDisabled,\n useFormItemInputId,\n useFormSize,\n} from '@element-plus/components/form'\nimport { ElIcon } from '@element-plus/components/icon'\nimport { Star, StarFilled } from '@element-plus/icons-vue'\nimport { useNamespace } from '@element-plus/hooks'\nimport { rateEmits } from './rate'\n\nimport type { CSSProperties, Component } from 'vue'\nimport type { IconInstance } from '@element-plus/components/icon'\nimport type { RateProps } from './rate'\n\nfunction getValueFromMap<T>(\n value: number,\n map: Record<string, T | { excluded?: boolean; value: T }>\n) {\n const isExcludedObject = (\n val: unknown\n ): val is { excluded?: boolean } & Record<any, unknown> => isObject(val)\n\n const matchedKeys = Object.keys(map)\n .map((key) => +key)\n .filter((key) => {\n const val = map[key]\n const excluded = isExcludedObject(val) ? val.excluded : false\n return excluded ? value < key : value <= key\n })\n .sort((a, b) => a - b)\n const matchedValue = map[matchedKeys[0]]\n return (isExcludedObject(matchedValue) && matchedValue.value) || matchedValue\n}\n\ndefineOptions({\n name: 'ElRate',\n})\n\nconst props = withDefaults(defineProps<RateProps>(), {\n modelValue: 0,\n id: undefined,\n lowThreshold: 2,\n highThreshold: 4,\n max: 5,\n colors: () => ['', '', ''],\n voidColor: '',\n disabledVoidColor: '',\n icons: () => [StarFilled, StarFilled, StarFilled],\n voidIcon: () => Star,\n disabledVoidIcon: () => StarFilled,\n disabled: undefined,\n textColor: '',\n texts: () => [\n 'Extremely bad',\n 'Disappointed',\n 'Fair',\n 'Satisfied',\n 'Surprise',\n ],\n scoreTemplate: '{value}',\n})\nconst emit = defineEmits(rateEmits)\n\nconst formItemContext = inject(formItemContextKey, undefined)\nconst rateSize = useFormSize()\nconst ns = useNamespace('rate')\nconst { inputId, isLabeledByFormItem } = useFormItemInputId(props, {\n formItemContext,\n})\n\nconst currentValue = ref(clamp(props.modelValue, 0, props.max))\nconst hoverIndex = ref(-1)\nconst pointerAtLeftHalf = ref(true)\n\nconst iconRefs = ref<IconInstance[]>([])\nconst iconClientWidths = computed<number[]>(() =>\n iconRefs.value.map((icon) => icon.$el.clientWidth)\n)\nconst rateClasses = computed(() => [ns.b(), ns.m(rateSize.value)])\nconst rateDisabled = useFormDisabled()\nconst rateStyles = computed(() => {\n return ns.cssVarBlock({\n 'void-color': props.voidColor,\n 'disabled-void-color': props.disabledVoidColor,\n 'fill-color': activeColor.value,\n }) as CSSProperties\n})\n\nconst text = computed(() => {\n let result = ''\n if (props.showScore) {\n result = props.scoreTemplate.replace(\n /\\{\\s*value\\s*\\}/,\n rateDisabled.value ? `${props.modelValue}` : `${currentValue.value}`\n )\n } else if (props.showText) {\n result = props.texts[Math.ceil(currentValue.value) - 1]\n }\n return result\n})\nconst valueDecimal = computed(\n () => props.modelValue * 100 - Math.floor(props.modelValue) * 100\n)\nconst colorMap = computed(() =>\n isArray(props.colors)\n ? {\n [props.lowThreshold]: props.colors[0],\n [props.highThreshold]: { value: props.colors[1], excluded: true },\n [props.max]: props.colors[2],\n }\n : props.colors\n)\nconst activeColor = computed(() => {\n const color = getValueFromMap(currentValue.value, colorMap.value)\n // {value: '', excluded: true} returned\n return isObject(color) ? '' : color\n})\nconst decimalStyle = computed(() => {\n let width = ''\n if (rateDisabled.value) {\n width = `${valueDecimal.value}%`\n } else if (props.allowHalf) {\n width = '50%'\n }\n return {\n color: activeColor.value,\n width,\n }\n})\nconst componentMap = computed(() => {\n let icons = isArray(props.icons) ? [...props.icons] : { ...props.icons }\n icons = markRaw(icons) as\n | Array<string | Component>\n | Record<number, string | Component>\n return isArray(icons)\n ? {\n [props.lowThreshold]: icons[0],\n [props.highThreshold]: {\n value: icons[1],\n excluded: true,\n },\n [props.max]: icons[2],\n }\n : icons\n})\nconst decimalIconComponent = computed(() =>\n getValueFromMap(props.modelValue, componentMap.value)\n)\nconst voidComponent = computed(() =>\n rateDisabled.value\n ? isString(props.disabledVoidIcon)\n ? props.disabledVoidIcon\n : (markRaw(props.disabledVoidIcon) as Component)\n : isString(props.voidIcon)\n ? props.voidIcon\n : (markRaw(props.voidIcon) as Component)\n)\nconst activeComponent = computed(() =>\n getValueFromMap(currentValue.value, componentMap.value)\n)\n\nfunction showDecimalIcon(item: number) {\n const showWhenDisabled =\n rateDisabled.value &&\n valueDecimal.value > 0 &&\n item - 1 < props.modelValue &&\n item > props.modelValue\n const showWhenAllowHalf =\n props.allowHalf &&\n pointerAtLeftHalf.value &&\n item - 0.5 <= currentValue.value &&\n item > currentValue.value\n return showWhenDisabled || showWhenAllowHalf\n}\n\nfunction emitValue(value: number) {\n // if allow clear, and selected value is same as modelValue, reset value to 0\n if (props.clearable && value === props.modelValue) {\n value = 0\n }\n\n emit(UPDATE_MODEL_EVENT, value)\n if (props.modelValue !== value) {\n emit(CHANGE_EVENT, value)\n }\n}\n\nfunction selectValue(value: number) {\n if (rateDisabled.value) {\n return\n }\n if (props.allowHalf && pointerAtLeftHalf.value) {\n emitValue(currentValue.value)\n } else {\n emitValue(value)\n }\n}\n\nfunction handleKey(e: KeyboardEvent) {\n if (rateDisabled.value) {\n return\n }\n const code = getEventCode(e)\n const step = props.allowHalf ? 0.5 : 1\n let _currentValue = currentValue.value\n\n switch (code) {\n case EVENT_CODE.up:\n case EVENT_CODE.right:\n _currentValue += step\n break\n case EVENT_CODE.left:\n case EVENT_CODE.down:\n _currentValue -= step\n break\n }\n\n _currentValue = clamp(_currentValue, 0, props.max)\n\n if (_currentValue === currentValue.value) {\n return\n }\n\n e.stopPropagation()\n e.preventDefault()\n emit(UPDATE_MODEL_EVENT, _currentValue)\n emit(CHANGE_EVENT, _currentValue)\n return _currentValue\n}\n\nfunction setCurrentValue(value: number, event?: MouseEvent) {\n if (rateDisabled.value) {\n return\n }\n if (props.allowHalf && event) {\n pointerAtLeftHalf.value =\n event.offsetX * 2 <= iconClientWidths.value[value - 1]\n currentValue.value = pointerAtLeftHalf.value ? value - 0.5 : value\n } else {\n currentValue.value = value\n }\n hoverIndex.value = value\n}\n\nfunction resetCurrentValue() {\n if (rateDisabled.value) {\n return\n }\n if (props.allowHalf) {\n pointerAtLeftHalf.value = props.modelValue !== Math.floor(props.modelValue)\n }\n currentValue.value = clamp(props.modelValue, 0, props.max)\n hoverIndex.value = -1\n}\n\nwatch(\n () => props.modelValue,\n (val) => {\n currentValue.value = clamp(val, 0, props.max)\n pointerAtLeftHalf.value = props.modelValue !== Math.floor(props.modelValue)\n }\n)\n\nif (!props.modelValue) {\n emit(UPDATE_MODEL_EVENT, 0)\n}\n\ndefineExpose({\n /** @description set current value */\n setCurrentValue,\n /** @description reset current value */\n resetCurrentValue,\n})\n</script>\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;EA2FA,SAAS,gBACP,OACA,KACA;GACA,MAAM,oBACJ,SAAA,GAAA,YAAA,UACkE,IAAG;GAUvE,MAAM,eAAe,IARD,OAAO,KAAK,IAAG,CAChC,KAAK,QAAQ,CAAC,IAAG,CACjB,QAAQ,QAAQ;IACf,MAAM,MAAM,IAAI;IAEhB,QADiB,iBAAiB,IAAI,GAAG,IAAI,WAAW,SACtC,QAAQ,MAAM,SAAS;KAC1C,CACA,MAAM,GAAG,MAAM,IAAI,EACc,CAAC;GACrC,OAAQ,iBAAiB,aAAa,IAAI,aAAa,SAAU;;EAOnE,MAAM,QAAQ;EAuBd,MAAM,OAAO;EAEb,MAAM,mBAAA,GAAA,IAAA,QAAyB,kBAAA,oBAAoB,KAAA,EAAS;EAC5D,MAAM,WAAW,8BAAA,aAAY;EAC7B,MAAM,KAAK,cAAA,aAAa,OAAM;EAC9B,MAAM,EAAE,SAAS,wBAAwB,sBAAA,mBAAmB,OAAO,EACjE,iBACD,CAAA;EAED,MAAM,gBAAA,GAAA,IAAA,MAAA,GAAA,eAAA,OAAyB,MAAM,YAAY,GAAG,MAAM,IAAI,CAAA;EAC9D,MAAM,cAAA,GAAA,IAAA,KAAiB,GAAE;EACzB,MAAM,qBAAA,GAAA,IAAA,KAAwB,KAAI;EAElC,MAAM,YAAA,GAAA,IAAA,KAA+B,EAAE,CAAA;EACvC,MAAM,oBAAA,GAAA,IAAA,gBACJ,SAAS,MAAM,KAAK,SAAS,KAAK,IAAI,YAAW,CACnD;EACA,MAAM,eAAA,GAAA,IAAA,gBAA6B,CAAC,GAAG,GAAG,EAAE,GAAG,EAAE,SAAS,MAAM,CAAC,CAAA;EACjE,MAA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AAK,EAAA,GAAA,IAAA,OAAG,GAAE,CAAC,GAAE,WAAA,MAAA,CAAA,CAAA,EAAA,EAAA,MAAA,GAAA,CAAA,QAAA,CAAA,GAAA,CAAA,CAAA,IAAA,OADN,gBAAgB,KAAI,CAAA,CAAA,CAAA;kEASpB,gBAAA,OAAA,EAAA;OAJP,QAAA,GAAA,IAAA,gBAAO,aAAA,MAAY;OACnB,QAAA,GAAA,IAAA,gBAAK,EAAA,GAAA,IAAA,OAAG,GAAE,CAAC,EAAC,OAAA,GAAA,GAAA,IAAA,OAAU,GAAE,CAAC,EAAC,UAAA,CAAA,CAAA;;uCAEa,GAAA,GAAA,IAAA,YAAA,GAAA,GAAA,IAAA,cAAA,GAAA,IAAA,yBAAxB,qBAAA,MAAoB,CAAA,EAAA,CAAA;;8CAJ5B,gBAAgB,KAAI,CAAA,CAAA,CAAA;;;;cAS1B,QAAA,YAAY,QAAA,cAAA,GAAA,IAAA,YAAA,GAAA,GAAA,IAAA,oBAKb,QAAA;;IAJJ,QAAA,GAAA,IAAA,iBAAA,GAAA,IAAA,OAAO,GAAE,CAAC,EAAC,OAAA,CAAA;IACX,QAAA,GAAA,IAAA,gBAAK,EAAA,OAAW,QAAA,WAAS,CAAA;+BAEvB,KAAA,MAAI,EAAA,EAAA,KAAA,GAAA,IAAA,oBAAA,QAAA,KAAA,CAAA,EAAA,IAAA,WAAA"}
|
|
1
|
+
{"version":3,"file":"rate.vue_vue_type_script_setup_true_lang.js","names":[],"sources":["../../../../../../packages/components/rate/src/rate.vue"],"sourcesContent":["<template>\n <div\n :id=\"inputId\"\n :class=\"[rateClasses, ns.is('disabled', rateDisabled)]\"\n role=\"slider\"\n :aria-label=\"!isLabeledByFormItem ? ariaLabel || 'rating' : undefined\"\n :aria-labelledby=\"\n isLabeledByFormItem ? formItemContext?.labelId : undefined\n \"\n :aria-valuenow=\"currentValue\"\n :aria-valuetext=\"text || undefined\"\n aria-valuemin=\"0\"\n :aria-valuemax=\"max\"\n :style=\"rateStyles\"\n :tabindex=\"rateDisabled ? undefined : 0\"\n :aria-disabled=\"rateDisabled\"\n @keydown=\"handleKey\"\n >\n <span\n v-for=\"(item, key) in max\"\n :key=\"key\"\n :class=\"ns.e('item')\"\n @mousemove=\"setCurrentValue(item, $event)\"\n @mouseleave=\"resetCurrentValue\"\n @click=\"selectValue(item)\"\n >\n <el-icon\n ref=\"iconRefs\"\n :class=\"[\n ns.e('icon'),\n { hover: hoverIndex === item },\n ns.is('active', item <= currentValue),\n ns.is('focus-visible', item === Math.ceil(currentValue || 1)),\n ]\"\n >\n <component\n :is=\"activeComponent\"\n v-show=\"!showDecimalIcon(item) && item <= currentValue\"\n />\n <component\n :is=\"voidComponent\"\n v-show=\"!showDecimalIcon(item) && item > currentValue\"\n />\n <component\n :is=\"voidComponent\"\n v-show=\"showDecimalIcon(item)\"\n :class=\"[ns.em('decimal', 'box')]\"\n />\n <el-icon\n v-show=\"showDecimalIcon(item)\"\n :style=\"decimalStyle\"\n :class=\"[ns.e('icon'), ns.e('decimal')]\"\n >\n <component :is=\"decimalIconComponent\" />\n </el-icon>\n </el-icon>\n </span>\n <span\n v-if=\"showText || showScore\"\n :class=\"ns.e('text')\"\n :style=\"{ color: textColor }\"\n >\n {{ text }}\n </span>\n </div>\n</template>\n\n<script lang=\"ts\" setup>\nimport { computed, inject, markRaw, ref, watch } from 'vue'\nimport { clamp } from 'lodash-unified'\nimport {\n CHANGE_EVENT,\n EVENT_CODE,\n UPDATE_MODEL_EVENT,\n} from '@element-plus/constants'\nimport { getEventCode, isArray, isObject, isString } from '@element-plus/utils'\nimport {\n formItemContextKey,\n useFormDisabled,\n useFormItemInputId,\n useFormSize,\n} from '@element-plus/components/form'\nimport { ElIcon } from '@element-plus/components/icon'\nimport { Star, StarFilled } from '@element-plus/icons-vue'\nimport { useNamespace } from '@element-plus/hooks'\nimport { rateEmits } from './rate'\n\nimport type { CSSProperties, Component } from 'vue'\nimport type { IconInstance } from '@element-plus/components/icon'\nimport type { RateProps } from './rate'\n\nfunction getValueFromMap<T>(\n value: number,\n map: Record<string, T | { excluded?: boolean; value: T }>\n) {\n const isExcludedObject = (\n val: unknown\n ): val is { excluded?: boolean } & Record<any, unknown> => isObject(val)\n\n const matchedKeys = Object.keys(map)\n .map((key) => +key)\n .filter((key) => {\n const val = map[key]\n const excluded = isExcludedObject(val) ? val.excluded : false\n return excluded ? value < key : value <= key\n })\n .sort((a, b) => a - b)\n const matchedValue = map[matchedKeys[0]]\n return (isExcludedObject(matchedValue) && matchedValue.value) || matchedValue\n}\n\ndefineOptions({\n name: 'ElRate',\n})\n\nconst props = withDefaults(defineProps<RateProps>(), {\n modelValue: 0,\n id: undefined,\n lowThreshold: 2,\n highThreshold: 4,\n max: 5,\n colors: () => ['', '', ''],\n voidColor: '',\n disabledVoidColor: '',\n icons: () => [StarFilled, StarFilled, StarFilled],\n voidIcon: () => Star,\n disabledVoidIcon: () => StarFilled,\n disabled: undefined,\n textColor: '',\n texts: () => [\n 'Extremely bad',\n 'Disappointed',\n 'Fair',\n 'Satisfied',\n 'Surprise',\n ],\n scoreTemplate: '{value}',\n})\nconst emit = defineEmits(rateEmits)\n\nconst formItemContext = inject(formItemContextKey, undefined)\nconst rateSize = useFormSize()\nconst ns = useNamespace('rate')\nconst { inputId, isLabeledByFormItem } = useFormItemInputId(props, {\n formItemContext,\n})\n\nconst currentValue = ref(clamp(props.modelValue, 0, props.max))\nconst hoverIndex = ref(-1)\nconst pointerAtLeftHalf = ref(true)\n\nconst iconRefs = ref<IconInstance[]>([])\nconst iconClientWidths = computed<number[]>(() =>\n iconRefs.value.map((icon) => icon.$el.clientWidth)\n)\nconst rateClasses = computed(() => [ns.b(), ns.m(rateSize.value)])\nconst rateDisabled = useFormDisabled()\nconst rateStyles = computed(() => {\n return ns.cssVarBlock({\n 'void-color': props.voidColor,\n 'disabled-void-color': props.disabledVoidColor,\n 'fill-color': activeColor.value,\n }) as CSSProperties\n})\n\nconst text = computed(() => {\n let result = ''\n if (props.showScore) {\n result = props.scoreTemplate.replace(\n /\\{\\s*value\\s*\\}/,\n rateDisabled.value ? `${props.modelValue}` : `${currentValue.value}`\n )\n } else if (props.showText) {\n result = props.texts[Math.ceil(currentValue.value) - 1]\n }\n return result\n})\nconst valueDecimal = computed(\n () => props.modelValue * 100 - Math.floor(props.modelValue) * 100\n)\nconst colorMap = computed(() =>\n isArray(props.colors)\n ? {\n [props.lowThreshold]: props.colors[0],\n [props.highThreshold]: { value: props.colors[1], excluded: true },\n [props.max]: props.colors[2],\n }\n : props.colors\n)\nconst activeColor = computed(() => {\n const color = getValueFromMap(currentValue.value, colorMap.value)\n // {value: '', excluded: true} returned\n return isObject(color) ? '' : color\n})\nconst decimalStyle = computed(() => {\n let width = ''\n if (rateDisabled.value) {\n width = `${valueDecimal.value}%`\n } else if (props.allowHalf) {\n width = '50%'\n }\n return {\n color: activeColor.value,\n width,\n }\n})\nconst componentMap = computed(() => {\n let icons = isArray(props.icons) ? [...props.icons] : { ...props.icons }\n icons = markRaw(icons) as\n Array<string | Component> | Record<number, string | Component>\n return isArray(icons)\n ? {\n [props.lowThreshold]: icons[0],\n [props.highThreshold]: {\n value: icons[1],\n excluded: true,\n },\n [props.max]: icons[2],\n }\n : icons\n})\nconst decimalIconComponent = computed(() =>\n getValueFromMap(props.modelValue, componentMap.value)\n)\nconst voidComponent = computed(() =>\n rateDisabled.value\n ? isString(props.disabledVoidIcon)\n ? props.disabledVoidIcon\n : (markRaw(props.disabledVoidIcon) as Component)\n : isString(props.voidIcon)\n ? props.voidIcon\n : (markRaw(props.voidIcon) as Component)\n)\nconst activeComponent = computed(() =>\n getValueFromMap(currentValue.value, componentMap.value)\n)\n\nfunction showDecimalIcon(item: number) {\n const showWhenDisabled =\n rateDisabled.value &&\n valueDecimal.value > 0 &&\n item - 1 < props.modelValue &&\n item > props.modelValue\n const showWhenAllowHalf =\n props.allowHalf &&\n pointerAtLeftHalf.value &&\n item - 0.5 <= currentValue.value &&\n item > currentValue.value\n return showWhenDisabled || showWhenAllowHalf\n}\n\nfunction emitValue(value: number) {\n // if allow clear, and selected value is same as modelValue, reset value to 0\n if (props.clearable && value === props.modelValue) {\n value = 0\n }\n\n emit(UPDATE_MODEL_EVENT, value)\n if (props.modelValue !== value) {\n emit(CHANGE_EVENT, value)\n }\n}\n\nfunction selectValue(value: number) {\n if (rateDisabled.value) {\n return\n }\n if (props.allowHalf && pointerAtLeftHalf.value) {\n emitValue(currentValue.value)\n } else {\n emitValue(value)\n }\n}\n\nfunction handleKey(e: KeyboardEvent) {\n if (rateDisabled.value) {\n return\n }\n const code = getEventCode(e)\n const step = props.allowHalf ? 0.5 : 1\n let _currentValue = currentValue.value\n\n switch (code) {\n case EVENT_CODE.up:\n case EVENT_CODE.right:\n _currentValue += step\n break\n case EVENT_CODE.left:\n case EVENT_CODE.down:\n _currentValue -= step\n break\n }\n\n _currentValue = clamp(_currentValue, 0, props.max)\n\n if (_currentValue === currentValue.value) {\n return\n }\n\n e.stopPropagation()\n e.preventDefault()\n emit(UPDATE_MODEL_EVENT, _currentValue)\n emit(CHANGE_EVENT, _currentValue)\n return _currentValue\n}\n\nfunction setCurrentValue(value: number, event?: MouseEvent) {\n if (rateDisabled.value) {\n return\n }\n if (props.allowHalf && event) {\n pointerAtLeftHalf.value =\n event.offsetX * 2 <= iconClientWidths.value[value - 1]\n currentValue.value = pointerAtLeftHalf.value ? value - 0.5 : value\n } else {\n currentValue.value = value\n }\n hoverIndex.value = value\n}\n\nfunction resetCurrentValue() {\n if (rateDisabled.value) {\n return\n }\n if (props.allowHalf) {\n pointerAtLeftHalf.value = props.modelValue !== Math.floor(props.modelValue)\n }\n currentValue.value = clamp(props.modelValue, 0, props.max)\n hoverIndex.value = -1\n}\n\nwatch(\n () => props.modelValue,\n (val) => {\n currentValue.value = clamp(val, 0, props.max)\n pointerAtLeftHalf.value = props.modelValue !== Math.floor(props.modelValue)\n }\n)\n\nif (!props.modelValue) {\n emit(UPDATE_MODEL_EVENT, 0)\n}\n\ndefineExpose({\n /** @description set current value */\n setCurrentValue,\n /** @description reset current value */\n resetCurrentValue,\n})\n</script>\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;EA2FA,SAAS,gBACP,OACA,KACA;GACA,MAAM,oBACJ,SAAA,GAAA,YAAA,UACkE,IAAG;GAUvE,MAAM,eAAe,IARD,OAAO,KAAK,IAAG,CAChC,KAAK,QAAQ,CAAC,IAAG,CACjB,QAAQ,QAAQ;IACf,MAAM,MAAM,IAAI;IAEhB,QADiB,iBAAiB,IAAI,GAAG,IAAI,WAAW,SACtC,QAAQ,MAAM,SAAS;KAC1C,CACA,MAAM,GAAG,MAAM,IAAI,EACc,CAAC;GACrC,OAAQ,iBAAiB,aAAa,IAAI,aAAa,SAAU;;EAOnE,MAAM,QAAQ;EAuBd,MAAM,OAAO;EAEb,MAAM,mBAAA,GAAA,IAAA,QAAyB,kBAAA,oBAAoB,KAAA,EAAS;EAC5D,MAAM,WAAW,8BAAA,aAAY;EAC7B,MAAM,KAAK,cAAA,aAAa,OAAM;EAC9B,MAAM,EAAE,SAAS,wBAAwB,sBAAA,mBAAmB,OAAO,EACjE,iBACD,CAAA;EAED,MAAM,gBAAA,GAAA,IAAA,MAAA,GAAA,eAAA,OAAyB,MAAM,YAAY,GAAG,MAAM,IAAI,CAAA;EAC9D,MAAM,cAAA,GAAA,IAAA,KAAiB,GAAE;EACzB,MAAM,qBAAA,GAAA,IAAA,KAAwB,KAAI;EAElC,MAAM,YAAA,GAAA,IAAA,KAA+B,EAAE,CAAA;EACvC,MAAM,oBAAA,GAAA,IAAA,gBACJ,SAAS,MAAM,KAAK,SAAS,KAAK,IAAI,YAAW,CACnD;EACA,MAAM,eAAA,GAAA,IAAA,gBAA6B,CAAC,GAAG,GAAG,EAAE,GAAG,EAAE,SAAS,MAAM,CAAC,CAAA;EACjE,MAAM,eAAe,8BAAA,iBAAgB;EACrC,MAAM,cAAA,GAAA,IAAA,gBAA4B;GAChC,OAAO,GAAG,YAAY;IAC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GAAA,CAAA,QAAA,CAAA,GAAA,CAAA,CAAA,IAAA,OADN,gBAAgB,KAAI,CAAA,CAAA,CAAA;kEASpB,gBAAA,OAAA,EAAA;OAJP,QAAA,GAAA,IAAA,gBAAO,aAAA,MAAY;OACnB,QAAA,GAAA,IAAA,gBAAK,EAAA,GAAA,IAAA,OAAG,GAAE,CAAC,EAAC,OAAA,GAAA,GAAA,IAAA,OAAU,GAAE,CAAC,EAAC,UAAA,CAAA,CAAA;;uCAEa,GAAA,GAAA,IAAA,YAAA,GAAA,GAAA,IAAA,cAAA,GAAA,IAAA,yBAAxB,qBAAA,MAAoB,CAAA,EAAA,CAAA;;8CAJ5B,gBAAgB,KAAI,CAAA,CAAA,CAAA;;;;cAS1B,QAAA,YAAY,QAAA,cAAA,GAAA,IAAA,YAAA,GAAA,GAAA,IAAA,oBAKb,QAAA;;IAJJ,QAAA,GAAA,IAAA,iBAAA,GAAA,IAAA,OAAO,GAAE,CAAC,EAAC,OAAA,CAAA;IACX,QAAA,GAAA,IAAA,gBAAK,EAAA,OAAW,QAAA,WAAS,CAAA;+BAEvB,KAAA,MAAI,EAAA,EAAA,KAAA,GAAA,IAAA,oBAAA,QAAA,KAAA,CAAA,EAAA,IAAA,WAAA"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"rate2.js","names":[],"sources":["../../../../../../packages/components/rate/src/rate.vue"],"sourcesContent":["<template>\n <div\n :id=\"inputId\"\n :class=\"[rateClasses, ns.is('disabled', rateDisabled)]\"\n role=\"slider\"\n :aria-label=\"!isLabeledByFormItem ? ariaLabel || 'rating' : undefined\"\n :aria-labelledby=\"\n isLabeledByFormItem ? formItemContext?.labelId : undefined\n \"\n :aria-valuenow=\"currentValue\"\n :aria-valuetext=\"text || undefined\"\n aria-valuemin=\"0\"\n :aria-valuemax=\"max\"\n :style=\"rateStyles\"\n :tabindex=\"rateDisabled ? undefined : 0\"\n :aria-disabled=\"rateDisabled\"\n @keydown=\"handleKey\"\n >\n <span\n v-for=\"(item, key) in max\"\n :key=\"key\"\n :class=\"ns.e('item')\"\n @mousemove=\"setCurrentValue(item, $event)\"\n @mouseleave=\"resetCurrentValue\"\n @click=\"selectValue(item)\"\n >\n <el-icon\n ref=\"iconRefs\"\n :class=\"[\n ns.e('icon'),\n { hover: hoverIndex === item },\n ns.is('active', item <= currentValue),\n ns.is('focus-visible', item === Math.ceil(currentValue || 1)),\n ]\"\n >\n <component\n :is=\"activeComponent\"\n v-show=\"!showDecimalIcon(item) && item <= currentValue\"\n />\n <component\n :is=\"voidComponent\"\n v-show=\"!showDecimalIcon(item) && item > currentValue\"\n />\n <component\n :is=\"voidComponent\"\n v-show=\"showDecimalIcon(item)\"\n :class=\"[ns.em('decimal', 'box')]\"\n />\n <el-icon\n v-show=\"showDecimalIcon(item)\"\n :style=\"decimalStyle\"\n :class=\"[ns.e('icon'), ns.e('decimal')]\"\n >\n <component :is=\"decimalIconComponent\" />\n </el-icon>\n </el-icon>\n </span>\n <span\n v-if=\"showText || showScore\"\n :class=\"ns.e('text')\"\n :style=\"{ color: textColor }\"\n >\n {{ text }}\n </span>\n </div>\n</template>\n\n<script lang=\"ts\" setup>\nimport { computed, inject, markRaw, ref, watch } from 'vue'\nimport { clamp } from 'lodash-unified'\nimport {\n CHANGE_EVENT,\n EVENT_CODE,\n UPDATE_MODEL_EVENT,\n} from '@element-plus/constants'\nimport { getEventCode, isArray, isObject, isString } from '@element-plus/utils'\nimport {\n formItemContextKey,\n useFormDisabled,\n useFormItemInputId,\n useFormSize,\n} from '@element-plus/components/form'\nimport { ElIcon } from '@element-plus/components/icon'\nimport { Star, StarFilled } from '@element-plus/icons-vue'\nimport { useNamespace } from '@element-plus/hooks'\nimport { rateEmits } from './rate'\n\nimport type { CSSProperties, Component } from 'vue'\nimport type { IconInstance } from '@element-plus/components/icon'\nimport type { RateProps } from './rate'\n\nfunction getValueFromMap<T>(\n value: number,\n map: Record<string, T | { excluded?: boolean; value: T }>\n) {\n const isExcludedObject = (\n val: unknown\n ): val is { excluded?: boolean } & Record<any, unknown> => isObject(val)\n\n const matchedKeys = Object.keys(map)\n .map((key) => +key)\n .filter((key) => {\n const val = map[key]\n const excluded = isExcludedObject(val) ? val.excluded : false\n return excluded ? value < key : value <= key\n })\n .sort((a, b) => a - b)\n const matchedValue = map[matchedKeys[0]]\n return (isExcludedObject(matchedValue) && matchedValue.value) || matchedValue\n}\n\ndefineOptions({\n name: 'ElRate',\n})\n\nconst props = withDefaults(defineProps<RateProps>(), {\n modelValue: 0,\n id: undefined,\n lowThreshold: 2,\n highThreshold: 4,\n max: 5,\n colors: () => ['', '', ''],\n voidColor: '',\n disabledVoidColor: '',\n icons: () => [StarFilled, StarFilled, StarFilled],\n voidIcon: () => Star,\n disabledVoidIcon: () => StarFilled,\n disabled: undefined,\n textColor: '',\n texts: () => [\n 'Extremely bad',\n 'Disappointed',\n 'Fair',\n 'Satisfied',\n 'Surprise',\n ],\n scoreTemplate: '{value}',\n})\nconst emit = defineEmits(rateEmits)\n\nconst formItemContext = inject(formItemContextKey, undefined)\nconst rateSize = useFormSize()\nconst ns = useNamespace('rate')\nconst { inputId, isLabeledByFormItem } = useFormItemInputId(props, {\n formItemContext,\n})\n\nconst currentValue = ref(clamp(props.modelValue, 0, props.max))\nconst hoverIndex = ref(-1)\nconst pointerAtLeftHalf = ref(true)\n\nconst iconRefs = ref<IconInstance[]>([])\nconst iconClientWidths = computed<number[]>(() =>\n iconRefs.value.map((icon) => icon.$el.clientWidth)\n)\nconst rateClasses = computed(() => [ns.b(), ns.m(rateSize.value)])\nconst rateDisabled = useFormDisabled()\nconst rateStyles = computed(() => {\n return ns.cssVarBlock({\n 'void-color': props.voidColor,\n 'disabled-void-color': props.disabledVoidColor,\n 'fill-color': activeColor.value,\n }) as CSSProperties\n})\n\nconst text = computed(() => {\n let result = ''\n if (props.showScore) {\n result = props.scoreTemplate.replace(\n /\\{\\s*value\\s*\\}/,\n rateDisabled.value ? `${props.modelValue}` : `${currentValue.value}`\n )\n } else if (props.showText) {\n result = props.texts[Math.ceil(currentValue.value) - 1]\n }\n return result\n})\nconst valueDecimal = computed(\n () => props.modelValue * 100 - Math.floor(props.modelValue) * 100\n)\nconst colorMap = computed(() =>\n isArray(props.colors)\n ? {\n [props.lowThreshold]: props.colors[0],\n [props.highThreshold]: { value: props.colors[1], excluded: true },\n [props.max]: props.colors[2],\n }\n : props.colors\n)\nconst activeColor = computed(() => {\n const color = getValueFromMap(currentValue.value, colorMap.value)\n // {value: '', excluded: true} returned\n return isObject(color) ? '' : color\n})\nconst decimalStyle = computed(() => {\n let width = ''\n if (rateDisabled.value) {\n width = `${valueDecimal.value}%`\n } else if (props.allowHalf) {\n width = '50%'\n }\n return {\n color: activeColor.value,\n width,\n }\n})\nconst componentMap = computed(() => {\n let icons = isArray(props.icons) ? [...props.icons] : { ...props.icons }\n icons = markRaw(icons) as\n
|
|
1
|
+
{"version":3,"file":"rate2.js","names":[],"sources":["../../../../../../packages/components/rate/src/rate.vue"],"sourcesContent":["<template>\n <div\n :id=\"inputId\"\n :class=\"[rateClasses, ns.is('disabled', rateDisabled)]\"\n role=\"slider\"\n :aria-label=\"!isLabeledByFormItem ? ariaLabel || 'rating' : undefined\"\n :aria-labelledby=\"\n isLabeledByFormItem ? formItemContext?.labelId : undefined\n \"\n :aria-valuenow=\"currentValue\"\n :aria-valuetext=\"text || undefined\"\n aria-valuemin=\"0\"\n :aria-valuemax=\"max\"\n :style=\"rateStyles\"\n :tabindex=\"rateDisabled ? undefined : 0\"\n :aria-disabled=\"rateDisabled\"\n @keydown=\"handleKey\"\n >\n <span\n v-for=\"(item, key) in max\"\n :key=\"key\"\n :class=\"ns.e('item')\"\n @mousemove=\"setCurrentValue(item, $event)\"\n @mouseleave=\"resetCurrentValue\"\n @click=\"selectValue(item)\"\n >\n <el-icon\n ref=\"iconRefs\"\n :class=\"[\n ns.e('icon'),\n { hover: hoverIndex === item },\n ns.is('active', item <= currentValue),\n ns.is('focus-visible', item === Math.ceil(currentValue || 1)),\n ]\"\n >\n <component\n :is=\"activeComponent\"\n v-show=\"!showDecimalIcon(item) && item <= currentValue\"\n />\n <component\n :is=\"voidComponent\"\n v-show=\"!showDecimalIcon(item) && item > currentValue\"\n />\n <component\n :is=\"voidComponent\"\n v-show=\"showDecimalIcon(item)\"\n :class=\"[ns.em('decimal', 'box')]\"\n />\n <el-icon\n v-show=\"showDecimalIcon(item)\"\n :style=\"decimalStyle\"\n :class=\"[ns.e('icon'), ns.e('decimal')]\"\n >\n <component :is=\"decimalIconComponent\" />\n </el-icon>\n </el-icon>\n </span>\n <span\n v-if=\"showText || showScore\"\n :class=\"ns.e('text')\"\n :style=\"{ color: textColor }\"\n >\n {{ text }}\n </span>\n </div>\n</template>\n\n<script lang=\"ts\" setup>\nimport { computed, inject, markRaw, ref, watch } from 'vue'\nimport { clamp } from 'lodash-unified'\nimport {\n CHANGE_EVENT,\n EVENT_CODE,\n UPDATE_MODEL_EVENT,\n} from '@element-plus/constants'\nimport { getEventCode, isArray, isObject, isString } from '@element-plus/utils'\nimport {\n formItemContextKey,\n useFormDisabled,\n useFormItemInputId,\n useFormSize,\n} from '@element-plus/components/form'\nimport { ElIcon } from '@element-plus/components/icon'\nimport { Star, StarFilled } from '@element-plus/icons-vue'\nimport { useNamespace } from '@element-plus/hooks'\nimport { rateEmits } from './rate'\n\nimport type { CSSProperties, Component } from 'vue'\nimport type { IconInstance } from '@element-plus/components/icon'\nimport type { RateProps } from './rate'\n\nfunction getValueFromMap<T>(\n value: number,\n map: Record<string, T | { excluded?: boolean; value: T }>\n) {\n const isExcludedObject = (\n val: unknown\n ): val is { excluded?: boolean } & Record<any, unknown> => isObject(val)\n\n const matchedKeys = Object.keys(map)\n .map((key) => +key)\n .filter((key) => {\n const val = map[key]\n const excluded = isExcludedObject(val) ? val.excluded : false\n return excluded ? value < key : value <= key\n })\n .sort((a, b) => a - b)\n const matchedValue = map[matchedKeys[0]]\n return (isExcludedObject(matchedValue) && matchedValue.value) || matchedValue\n}\n\ndefineOptions({\n name: 'ElRate',\n})\n\nconst props = withDefaults(defineProps<RateProps>(), {\n modelValue: 0,\n id: undefined,\n lowThreshold: 2,\n highThreshold: 4,\n max: 5,\n colors: () => ['', '', ''],\n voidColor: '',\n disabledVoidColor: '',\n icons: () => [StarFilled, StarFilled, StarFilled],\n voidIcon: () => Star,\n disabledVoidIcon: () => StarFilled,\n disabled: undefined,\n textColor: '',\n texts: () => [\n 'Extremely bad',\n 'Disappointed',\n 'Fair',\n 'Satisfied',\n 'Surprise',\n ],\n scoreTemplate: '{value}',\n})\nconst emit = defineEmits(rateEmits)\n\nconst formItemContext = inject(formItemContextKey, undefined)\nconst rateSize = useFormSize()\nconst ns = useNamespace('rate')\nconst { inputId, isLabeledByFormItem } = useFormItemInputId(props, {\n formItemContext,\n})\n\nconst currentValue = ref(clamp(props.modelValue, 0, props.max))\nconst hoverIndex = ref(-1)\nconst pointerAtLeftHalf = ref(true)\n\nconst iconRefs = ref<IconInstance[]>([])\nconst iconClientWidths = computed<number[]>(() =>\n iconRefs.value.map((icon) => icon.$el.clientWidth)\n)\nconst rateClasses = computed(() => [ns.b(), ns.m(rateSize.value)])\nconst rateDisabled = useFormDisabled()\nconst rateStyles = computed(() => {\n return ns.cssVarBlock({\n 'void-color': props.voidColor,\n 'disabled-void-color': props.disabledVoidColor,\n 'fill-color': activeColor.value,\n }) as CSSProperties\n})\n\nconst text = computed(() => {\n let result = ''\n if (props.showScore) {\n result = props.scoreTemplate.replace(\n /\\{\\s*value\\s*\\}/,\n rateDisabled.value ? `${props.modelValue}` : `${currentValue.value}`\n )\n } else if (props.showText) {\n result = props.texts[Math.ceil(currentValue.value) - 1]\n }\n return result\n})\nconst valueDecimal = computed(\n () => props.modelValue * 100 - Math.floor(props.modelValue) * 100\n)\nconst colorMap = computed(() =>\n isArray(props.colors)\n ? {\n [props.lowThreshold]: props.colors[0],\n [props.highThreshold]: { value: props.colors[1], excluded: true },\n [props.max]: props.colors[2],\n }\n : props.colors\n)\nconst activeColor = computed(() => {\n const color = getValueFromMap(currentValue.value, colorMap.value)\n // {value: '', excluded: true} returned\n return isObject(color) ? '' : color\n})\nconst decimalStyle = computed(() => {\n let width = ''\n if (rateDisabled.value) {\n width = `${valueDecimal.value}%`\n } else if (props.allowHalf) {\n width = '50%'\n }\n return {\n color: activeColor.value,\n width,\n }\n})\nconst componentMap = computed(() => {\n let icons = isArray(props.icons) ? [...props.icons] : { ...props.icons }\n icons = markRaw(icons) as\n Array<string | Component> | Record<number, string | Component>\n return isArray(icons)\n ? {\n [props.lowThreshold]: icons[0],\n [props.highThreshold]: {\n value: icons[1],\n excluded: true,\n },\n [props.max]: icons[2],\n }\n : icons\n})\nconst decimalIconComponent = computed(() =>\n getValueFromMap(props.modelValue, componentMap.value)\n)\nconst voidComponent = computed(() =>\n rateDisabled.value\n ? isString(props.disabledVoidIcon)\n ? props.disabledVoidIcon\n : (markRaw(props.disabledVoidIcon) as Component)\n : isString(props.voidIcon)\n ? props.voidIcon\n : (markRaw(props.voidIcon) as Component)\n)\nconst activeComponent = computed(() =>\n getValueFromMap(currentValue.value, componentMap.value)\n)\n\nfunction showDecimalIcon(item: number) {\n const showWhenDisabled =\n rateDisabled.value &&\n valueDecimal.value > 0 &&\n item - 1 < props.modelValue &&\n item > props.modelValue\n const showWhenAllowHalf =\n props.allowHalf &&\n pointerAtLeftHalf.value &&\n item - 0.5 <= currentValue.value &&\n item > currentValue.value\n return showWhenDisabled || showWhenAllowHalf\n}\n\nfunction emitValue(value: number) {\n // if allow clear, and selected value is same as modelValue, reset value to 0\n if (props.clearable && value === props.modelValue) {\n value = 0\n }\n\n emit(UPDATE_MODEL_EVENT, value)\n if (props.modelValue !== value) {\n emit(CHANGE_EVENT, value)\n }\n}\n\nfunction selectValue(value: number) {\n if (rateDisabled.value) {\n return\n }\n if (props.allowHalf && pointerAtLeftHalf.value) {\n emitValue(currentValue.value)\n } else {\n emitValue(value)\n }\n}\n\nfunction handleKey(e: KeyboardEvent) {\n if (rateDisabled.value) {\n return\n }\n const code = getEventCode(e)\n const step = props.allowHalf ? 0.5 : 1\n let _currentValue = currentValue.value\n\n switch (code) {\n case EVENT_CODE.up:\n case EVENT_CODE.right:\n _currentValue += step\n break\n case EVENT_CODE.left:\n case EVENT_CODE.down:\n _currentValue -= step\n break\n }\n\n _currentValue = clamp(_currentValue, 0, props.max)\n\n if (_currentValue === currentValue.value) {\n return\n }\n\n e.stopPropagation()\n e.preventDefault()\n emit(UPDATE_MODEL_EVENT, _currentValue)\n emit(CHANGE_EVENT, _currentValue)\n return _currentValue\n}\n\nfunction setCurrentValue(value: number, event?: MouseEvent) {\n if (rateDisabled.value) {\n return\n }\n if (props.allowHalf && event) {\n pointerAtLeftHalf.value =\n event.offsetX * 2 <= iconClientWidths.value[value - 1]\n currentValue.value = pointerAtLeftHalf.value ? value - 0.5 : value\n } else {\n currentValue.value = value\n }\n hoverIndex.value = value\n}\n\nfunction resetCurrentValue() {\n if (rateDisabled.value) {\n return\n }\n if (props.allowHalf) {\n pointerAtLeftHalf.value = props.modelValue !== Math.floor(props.modelValue)\n }\n currentValue.value = clamp(props.modelValue, 0, props.max)\n hoverIndex.value = -1\n}\n\nwatch(\n () => props.modelValue,\n (val) => {\n currentValue.value = clamp(val, 0, props.max)\n pointerAtLeftHalf.value = props.modelValue !== Math.floor(props.modelValue)\n }\n)\n\nif (!props.modelValue) {\n emit(UPDATE_MODEL_EVENT, 0)\n}\n\ndefineExpose({\n /** @description set current value */\n setCurrentValue,\n /** @description reset current value */\n resetCurrentValue,\n})\n</script>\n"],"mappings":""}
|
|
@@ -31,7 +31,7 @@ interface ResultProps {
|
|
|
31
31
|
declare const resultProps: {
|
|
32
32
|
readonly title: EpPropFinalized<StringConstructor, unknown, unknown, "", boolean>;
|
|
33
33
|
readonly subTitle: EpPropFinalized<StringConstructor, unknown, unknown, "", boolean>;
|
|
34
|
-
readonly icon: EpPropFinalized<StringConstructor, "
|
|
34
|
+
readonly icon: EpPropFinalized<StringConstructor, "primary" | "success" | "warning" | "info" | "error", unknown, "info", boolean>;
|
|
35
35
|
};
|
|
36
36
|
/**
|
|
37
37
|
* @deprecated Removed after 3.0.0, Use `ResultProps` instead.
|
|
@@ -13,8 +13,8 @@ type __VLS_Slots = {} & {
|
|
|
13
13
|
extra?: (props: typeof __VLS_12) => any;
|
|
14
14
|
};
|
|
15
15
|
declare const __VLS_base: _$vue.DefineComponent<ResultProps, {}, {}, {}, {}, _$vue.ComponentOptionsMixin, _$vue.ComponentOptionsMixin, {}, string, _$vue.PublicProps, Readonly<ResultProps> & Readonly<{}>, {
|
|
16
|
-
title: string;
|
|
17
16
|
icon: "primary" | "success" | "warning" | "info" | "error";
|
|
17
|
+
title: string;
|
|
18
18
|
subTitle: string;
|
|
19
19
|
}, {}, {}, {}, string, _$vue.ComponentProvideOptions, false, {}, any>;
|
|
20
20
|
declare const __VLS_export: __VLS_WithSlots<typeof __VLS_base, __VLS_Slots>;
|
|
@@ -32,7 +32,7 @@ declare const rowProps: {
|
|
|
32
32
|
readonly gutter: EpPropFinalized<NumberConstructor, unknown, unknown, 0, boolean>;
|
|
33
33
|
readonly justify: EpPropFinalized<StringConstructor, "space-around" | "space-between" | "space-evenly" | "center" | "end" | "start", unknown, "start", boolean>;
|
|
34
34
|
readonly align: {
|
|
35
|
-
readonly type: _$vue.PropType<EpPropMergeType<StringConstructor, "
|
|
35
|
+
readonly type: _$vue.PropType<EpPropMergeType<StringConstructor, "middle" | "bottom" | "top", unknown>>;
|
|
36
36
|
readonly required: false;
|
|
37
37
|
readonly validator: ((val: unknown) => boolean) | undefined;
|
|
38
38
|
__epPropKey: true;
|
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import { EpPropFinalized } from "../../../utils/vue/props/types.js";
|
|
2
|
+
import { ClassValue } from "../../../utils/typescript.js";
|
|
2
3
|
import _default from "./scrollbar.vue.js";
|
|
3
4
|
import * as _$vue from "vue";
|
|
4
5
|
import { ExtractPublicPropTypes, StyleValue } from "vue";
|
|
@@ -33,12 +34,12 @@ interface ScrollbarProps {
|
|
|
33
34
|
* @description class of wrap
|
|
34
35
|
* @default ''
|
|
35
36
|
*/
|
|
36
|
-
wrapClass?:
|
|
37
|
+
wrapClass?: ClassValue;
|
|
37
38
|
/**
|
|
38
39
|
* @description class of view
|
|
39
40
|
* @default ''
|
|
40
41
|
*/
|
|
41
|
-
viewClass?:
|
|
42
|
+
viewClass?: ClassValue;
|
|
42
43
|
/**
|
|
43
44
|
* @description style of view
|
|
44
45
|
* @default ''
|
|
@@ -100,8 +101,8 @@ declare const scrollbarProps: {
|
|
|
100
101
|
readonly maxHeight: EpPropFinalized<readonly [StringConstructor, NumberConstructor], unknown, unknown, "", boolean>;
|
|
101
102
|
readonly native: BooleanConstructor;
|
|
102
103
|
readonly wrapStyle: EpPropFinalized<(new (...args: any[]) => string | false | _$vue.CSSProperties | StyleValue[]) | (() => StyleValue) | (((new (...args: any[]) => string | false | _$vue.CSSProperties | StyleValue[]) | (() => StyleValue)) | null)[], unknown, unknown, "", boolean>;
|
|
103
|
-
readonly wrapClass: EpPropFinalized<
|
|
104
|
-
readonly viewClass: EpPropFinalized<
|
|
104
|
+
readonly wrapClass: EpPropFinalized<(new (...args: any[]) => string | false | Record<string, any> | ClassValue[]) | (() => ClassValue) | (((new (...args: any[]) => string | false | Record<string, any> | ClassValue[]) | (() => ClassValue)) | null)[], unknown, unknown, "", boolean>;
|
|
105
|
+
readonly viewClass: EpPropFinalized<(new (...args: any[]) => string | false | Record<string, any> | ClassValue[]) | (() => ClassValue) | (((new (...args: any[]) => string | false | Record<string, any> | ClassValue[]) | (() => ClassValue)) | null)[], unknown, unknown, "", boolean>;
|
|
105
106
|
readonly viewStyle: EpPropFinalized<(new (...args: any[]) => string | false | _$vue.CSSProperties | StyleValue[]) | (() => StyleValue) | (((new (...args: any[]) => string | false | _$vue.CSSProperties | StyleValue[]) | (() => StyleValue)) | null)[], unknown, unknown, "", boolean>;
|
|
106
107
|
readonly noresize: BooleanConstructor;
|
|
107
108
|
readonly tag: EpPropFinalized<StringConstructor, unknown, unknown, "div", boolean>;
|
|
@@ -48,14 +48,24 @@ const scrollbarProps = require_runtime.buildProps({
|
|
|
48
48
|
* @description class of wrap
|
|
49
49
|
*/
|
|
50
50
|
wrapClass: {
|
|
51
|
-
type: [
|
|
51
|
+
type: require_runtime.definePropType([
|
|
52
|
+
String,
|
|
53
|
+
Array,
|
|
54
|
+
Object,
|
|
55
|
+
Boolean
|
|
56
|
+
]),
|
|
52
57
|
default: ""
|
|
53
58
|
},
|
|
54
59
|
/**
|
|
55
60
|
* @description class of view
|
|
56
61
|
*/
|
|
57
62
|
viewClass: {
|
|
58
|
-
type: [
|
|
63
|
+
type: require_runtime.definePropType([
|
|
64
|
+
String,
|
|
65
|
+
Array,
|
|
66
|
+
Object,
|
|
67
|
+
Boolean
|
|
68
|
+
]),
|
|
59
69
|
default: ""
|
|
60
70
|
},
|
|
61
71
|
/**
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"scrollbar.js","names":["buildProps","definePropType","useAriaProps","isNumber"],"sources":["../../../../../../packages/components/scrollbar/src/scrollbar.ts"],"sourcesContent":["import { buildProps, definePropType, isNumber } from '@element-plus/utils'\nimport { useAriaProps } from '@element-plus/hooks'\n\nimport type { ExtractPublicPropTypes, StyleValue } from 'vue'\nimport type Scrollbar from './scrollbar.vue'\n\nexport interface ScrollbarProps {\n /**\n * @description trigger distance(px)\n * @default 0\n */\n distance?: number\n /**\n * @description height of scrollbar\n * @default ''\n */\n height?: number | string\n /**\n * @description max height of scrollbar\n * @default ''\n */\n maxHeight?: number | string\n /**\n * @description whether to use the native scrollbar\n */\n native?: boolean\n /**\n * @description style of wrap\n * @default ''\n */\n wrapStyle?: StyleValue\n /**\n * @description class of wrap\n * @default ''\n */\n wrapClass?:
|
|
1
|
+
{"version":3,"file":"scrollbar.js","names":["buildProps","definePropType","useAriaProps","isNumber"],"sources":["../../../../../../packages/components/scrollbar/src/scrollbar.ts"],"sourcesContent":["import { buildProps, definePropType, isNumber } from '@element-plus/utils'\nimport { useAriaProps } from '@element-plus/hooks'\n\nimport type { ClassValue } from '@element-plus/utils'\nimport type { ExtractPublicPropTypes, StyleValue } from 'vue'\nimport type Scrollbar from './scrollbar.vue'\n\nexport interface ScrollbarProps {\n /**\n * @description trigger distance(px)\n * @default 0\n */\n distance?: number\n /**\n * @description height of scrollbar\n * @default ''\n */\n height?: number | string\n /**\n * @description max height of scrollbar\n * @default ''\n */\n maxHeight?: number | string\n /**\n * @description whether to use the native scrollbar\n */\n native?: boolean\n /**\n * @description style of wrap\n * @default ''\n */\n wrapStyle?: StyleValue\n /**\n * @description class of wrap\n * @default ''\n */\n wrapClass?: ClassValue\n /**\n * @description class of view\n * @default ''\n */\n viewClass?: ClassValue\n /**\n * @description style of view\n * @default ''\n */\n viewStyle?: StyleValue\n /**\n * @description do not respond to container size changes, if the container size does not change, it is better to set it to optimize performance\n */\n noresize?: boolean\n /**\n * @description element tag of the view\n * @default 'div'\n */\n tag?: keyof HTMLElementTagNameMap | (string & {})\n /**\n * @description always show\n */\n always?: boolean\n /**\n * @description minimum size of scrollbar\n * @default 20\n */\n minSize?: number\n /**\n * @description Wrap tabindex\n * @default undefined\n */\n tabindex?: number | string\n /**\n * @description id of view\n */\n id?: string\n /**\n * @description role of view\n */\n role?: string\n /**\n * @description native `aria-label` attribute\n */\n ariaLabel?: string\n /**\n * @description native `aria-orientation` attribute\n */\n ariaOrientation?: 'horizontal' | 'vertical' | 'undefined'\n}\n\n/**\n * @deprecated Removed after 3.0.0, Use `ScrollbarProps` instead.\n */\nexport const scrollbarProps = buildProps({\n /**\n * @description trigger distance(px)\n */\n distance: {\n type: Number,\n default: 0,\n },\n /**\n * @description height of scrollbar\n */\n height: {\n type: [String, Number],\n default: '',\n },\n /**\n * @description max height of scrollbar\n */\n maxHeight: {\n type: [String, Number],\n default: '',\n },\n /**\n * @description whether to use the native scrollbar\n */\n native: Boolean,\n /**\n * @description style of wrap\n */\n wrapStyle: {\n type: definePropType<StyleValue>([String, Object, Array, Boolean]),\n default: '',\n },\n /**\n * @description class of wrap\n */\n wrapClass: {\n type: definePropType<ClassValue>([String, Array, Object, Boolean]),\n default: '',\n },\n /**\n * @description class of view\n */\n viewClass: {\n type: definePropType<ClassValue>([String, Array, Object, Boolean]),\n default: '',\n },\n /**\n * @description style of view\n */\n viewStyle: {\n type: definePropType<StyleValue>([String, Object, Array, Boolean]),\n default: '',\n },\n /**\n * @description do not respond to container size changes, if the container size does not change, it is better to set it to optimize performance\n */\n noresize: Boolean, // 如果 container 尺寸不会发生变化,最好设置它可以优化性能\n /**\n * @description element tag of the view\n */\n tag: {\n type: String,\n default: 'div',\n },\n /**\n * @description always show\n */\n always: Boolean,\n /**\n * @description minimum size of scrollbar\n */\n minSize: {\n type: Number,\n default: 20,\n },\n /**\n * @description Wrap tabindex\n */\n tabindex: {\n type: [String, Number],\n default: undefined,\n },\n /**\n * @description id of view\n */\n id: String,\n /**\n * @description role of view\n */\n role: String,\n ...useAriaProps(['ariaLabel', 'ariaOrientation']),\n} as const)\n\n/**\n * @deprecated Removed after 3.0.0, Use `ScrollbarProps` instead.\n */\nexport type ScrollbarPropsPublic = ExtractPublicPropTypes<typeof scrollbarProps>\n\nexport const scrollbarEmits = {\n 'end-reached': (direction: ScrollbarDirection) =>\n ['left', 'right', 'top', 'bottom'].includes(direction),\n scroll: ({\n scrollTop,\n scrollLeft,\n }: {\n scrollTop: number\n scrollLeft: number\n }) => [scrollTop, scrollLeft].every(isNumber),\n}\nexport type ScrollbarEmits = typeof scrollbarEmits\nexport type ScrollbarDirection = 'top' | 'bottom' | 'left' | 'right'\n\nexport type ScrollbarInstance = InstanceType<typeof Scrollbar> & unknown\n"],"mappings":";;;;;;;;AA2FA,MAAa,iBAAiBA,gBAAAA,WAAW;;;;CAIvC,UAAU;EACR,MAAM;EACN,SAAS;EACV;;;;CAID,QAAQ;EACN,MAAM,CAAC,QAAQ,OAAO;EACtB,SAAS;EACV;;;;CAID,WAAW;EACT,MAAM,CAAC,QAAQ,OAAO;EACtB,SAAS;EACV;;;;CAID,QAAQ;;;;CAIR,WAAW;EACT,MAAMC,gBAAAA,eAA2B;GAAC;GAAQ;GAAQ;GAAO;GAAQ,CAAC;EAClE,SAAS;EACV;;;;CAID,WAAW;EACT,MAAMA,gBAAAA,eAA2B;GAAC;GAAQ;GAAO;GAAQ;GAAQ,CAAC;EAClE,SAAS;EACV;;;;CAID,WAAW;EACT,MAAMA,gBAAAA,eAA2B;GAAC;GAAQ;GAAO;GAAQ;GAAQ,CAAC;EAClE,SAAS;EACV;;;;CAID,WAAW;EACT,MAAMA,gBAAAA,eAA2B;GAAC;GAAQ;GAAQ;GAAO;GAAQ,CAAC;EAClE,SAAS;EACV;;;;CAID,UAAU;;;;CAIV,KAAK;EACH,MAAM;EACN,SAAS;EACV;;;;CAID,QAAQ;;;;CAIR,SAAS;EACP,MAAM;EACN,SAAS;EACV;;;;CAID,UAAU;EACR,MAAM,CAAC,QAAQ,OAAO;EACtB,SAAS,KAAA;EACV;;;;CAID,IAAI;;;;CAIJ,MAAM;CACN,GAAGC,cAAAA,aAAa,CAAC,aAAa,kBAAkB,CAAC;CAClD,CAAU;AAOX,MAAa,iBAAiB;CAC5B,gBAAgB,cACd;EAAC;EAAQ;EAAS;EAAO;EAAS,CAAC,SAAS,UAAU;CACxD,SAAS,EACP,WACA,iBAII,CAAC,WAAW,WAAW,CAAC,MAAMC,cAAAA,SAAS;CAC9C"}
|
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import { ClassValue } from "../../../utils/typescript.js";
|
|
1
2
|
import { ScrollbarDirection, ScrollbarProps } from "./scrollbar.js";
|
|
2
3
|
import * as _$vue from "vue";
|
|
3
4
|
import { CSSProperties, StyleValue } from "vue";
|
|
@@ -29,14 +30,14 @@ declare const __VLS_base: _$vue.DefineComponent<ScrollbarProps, {
|
|
|
29
30
|
}) => any) | undefined;
|
|
30
31
|
"onEnd-reached"?: ((direction: ScrollbarDirection) => any) | undefined;
|
|
31
32
|
}>, {
|
|
32
|
-
height: number | string;
|
|
33
|
-
maxHeight: number | string;
|
|
34
33
|
tabindex: number | string;
|
|
34
|
+
height: number | string;
|
|
35
35
|
tag: keyof HTMLElementTagNameMap | (string & {});
|
|
36
36
|
distance: number;
|
|
37
|
+
maxHeight: number | string;
|
|
37
38
|
wrapStyle: string | false | CSSProperties | StyleValue[] | null;
|
|
38
|
-
wrapClass: string | string[];
|
|
39
|
-
viewClass: string | string[];
|
|
39
|
+
wrapClass: string | false | Record<string, any> | ClassValue[] | null;
|
|
40
|
+
viewClass: string | false | Record<string, any> | ClassValue[] | null;
|
|
40
41
|
viewStyle: string | false | CSSProperties | StyleValue[] | null;
|
|
41
42
|
minSize: number;
|
|
42
43
|
}, {}, {}, {}, string, _$vue.ComponentProvideOptions, false, {}, any>;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"thumb.vue_vue_type_script_setup_true_lang.js","names":[],"sources":["../../../../../../packages/components/scrollbar/src/thumb.vue"],"sourcesContent":["<template>\n <transition :name=\"ns.b('fade')\">\n <div\n v-show=\"always || visible\"\n ref=\"instance\"\n :class=\"[ns.e('bar'), ns.is(bar.key)]\"\n @mousedown=\"clickTrackHandler\"\n @click.stop\n >\n <div\n ref=\"thumb\"\n :class=\"ns.e('thumb')\"\n :style=\"thumbStyle\"\n @mousedown=\"clickThumbHandler\"\n />\n </div>\n </transition>\n</template>\n\n<script lang=\"ts\" setup>\nimport { computed, inject, onBeforeUnmount, ref, toRef } from 'vue'\nimport { useEventListener } from '@vueuse/core'\nimport { isClient, throwError } from '@element-plus/utils'\nimport { useNamespace } from '@element-plus/hooks'\nimport { scrollbarContextKey } from './constants'\nimport { BAR_MAP, renderThumbStyle } from './util'\n\nimport type { ThumbProps } from './thumb'\n\nconst COMPONENT_NAME = 'Thumb'\nconst props = defineProps<ThumbProps>()\n\nconst scrollbar = inject(scrollbarContextKey)\nconst ns = useNamespace('scrollbar')\n\nif (!scrollbar) throwError(COMPONENT_NAME, 'can not inject scrollbar context')\n\nconst instance = ref<HTMLDivElement>()\nconst thumb = ref<HTMLDivElement>()\n\nconst thumbState = ref<Partial<Record<'X' | 'Y', number>>>({})\nconst visible = ref(false)\n\nlet cursorDown = false\nlet cursorLeave = false\nlet baseScrollHeight = 0\nlet baseScrollWidth = 0\nlet originalOnSelectStart:\n
|
|
1
|
+
{"version":3,"file":"thumb.vue_vue_type_script_setup_true_lang.js","names":[],"sources":["../../../../../../packages/components/scrollbar/src/thumb.vue"],"sourcesContent":["<template>\n <transition :name=\"ns.b('fade')\">\n <div\n v-show=\"always || visible\"\n ref=\"instance\"\n :class=\"[ns.e('bar'), ns.is(bar.key)]\"\n @mousedown=\"clickTrackHandler\"\n @click.stop\n >\n <div\n ref=\"thumb\"\n :class=\"ns.e('thumb')\"\n :style=\"thumbStyle\"\n @mousedown=\"clickThumbHandler\"\n />\n </div>\n </transition>\n</template>\n\n<script lang=\"ts\" setup>\nimport { computed, inject, onBeforeUnmount, ref, toRef } from 'vue'\nimport { useEventListener } from '@vueuse/core'\nimport { isClient, throwError } from '@element-plus/utils'\nimport { useNamespace } from '@element-plus/hooks'\nimport { scrollbarContextKey } from './constants'\nimport { BAR_MAP, renderThumbStyle } from './util'\n\nimport type { ThumbProps } from './thumb'\n\nconst COMPONENT_NAME = 'Thumb'\nconst props = defineProps<ThumbProps>()\n\nconst scrollbar = inject(scrollbarContextKey)\nconst ns = useNamespace('scrollbar')\n\nif (!scrollbar) throwError(COMPONENT_NAME, 'can not inject scrollbar context')\n\nconst instance = ref<HTMLDivElement>()\nconst thumb = ref<HTMLDivElement>()\n\nconst thumbState = ref<Partial<Record<'X' | 'Y', number>>>({})\nconst visible = ref(false)\n\nlet cursorDown = false\nlet cursorLeave = false\nlet baseScrollHeight = 0\nlet baseScrollWidth = 0\nlet originalOnSelectStart:\n ((this: GlobalEventHandlers, ev: Event) => any) | null = isClient\n ? document.onselectstart\n : null\n\nconst bar = computed(() => BAR_MAP[props.vertical ? 'vertical' : 'horizontal'])\n\nconst thumbStyle = computed(() =>\n renderThumbStyle({\n size: props.size,\n move: props.move,\n bar: bar.value,\n })\n)\n\nconst offsetRatio = computed(\n () =>\n // offsetRatioX = original width of thumb / current width of thumb / ratioX\n // offsetRatioY = original height of thumb / current height of thumb / ratioY\n // instance height = wrap height - GAP\n instance.value![bar.value.offset] ** 2 /\n scrollbar.wrapElement![bar.value.scrollSize] /\n props.ratio /\n thumb.value![bar.value.offset]\n)\n\nconst clickThumbHandler = (e: MouseEvent) => {\n // prevent click event of middle and right button\n e.stopPropagation()\n if (e.ctrlKey || [1, 2].includes(e.button)) return\n\n window.getSelection()?.removeAllRanges()\n startDrag(e)\n\n const el = e.currentTarget as HTMLDivElement\n if (!el) return\n thumbState.value[bar.value.axis] =\n el[bar.value.offset] -\n (e[bar.value.client] - el.getBoundingClientRect()[bar.value.direction])\n}\n\nconst clickTrackHandler = (e: MouseEvent) => {\n if (!thumb.value || !instance.value || !scrollbar.wrapElement) return\n\n const offset = Math.abs(\n (e.target as HTMLElement).getBoundingClientRect()[bar.value.direction] -\n e[bar.value.client]\n )\n const thumbHalf = thumb.value[bar.value.offset] / 2\n const thumbPositionPercentage =\n ((offset - thumbHalf) * 100 * offsetRatio.value) /\n instance.value[bar.value.offset]\n\n scrollbar.wrapElement[bar.value.scroll] =\n (thumbPositionPercentage * scrollbar.wrapElement[bar.value.scrollSize]) /\n 100\n}\n\nconst startDrag = (e: MouseEvent) => {\n e.stopImmediatePropagation()\n cursorDown = true\n baseScrollHeight = scrollbar.wrapElement!.scrollHeight\n baseScrollWidth = scrollbar.wrapElement!.scrollWidth\n document.addEventListener('mousemove', mouseMoveDocumentHandler)\n document.addEventListener('mouseup', mouseUpDocumentHandler)\n originalOnSelectStart = document.onselectstart\n document.onselectstart = () => false\n}\n\nconst mouseMoveDocumentHandler = (e: MouseEvent) => {\n if (!instance.value || !thumb.value) return\n if (cursorDown === false) return\n\n const prevPage = thumbState.value[bar.value.axis]\n if (!prevPage) return\n\n const offset =\n (instance.value.getBoundingClientRect()[bar.value.direction] -\n e[bar.value.client]) *\n -1\n const thumbClickPosition = thumb.value[bar.value.offset] - prevPage\n const thumbPositionPercentage =\n ((offset - thumbClickPosition) * 100 * offsetRatio.value) /\n instance.value[bar.value.offset]\n\n if (bar.value.scroll === 'scrollLeft') {\n scrollbar.wrapElement![bar.value.scroll] =\n (thumbPositionPercentage * baseScrollWidth) / 100\n } else {\n scrollbar.wrapElement![bar.value.scroll] =\n (thumbPositionPercentage * baseScrollHeight) / 100\n }\n}\n\nconst mouseUpDocumentHandler = () => {\n cursorDown = false\n thumbState.value[bar.value.axis] = 0\n document.removeEventListener('mousemove', mouseMoveDocumentHandler)\n document.removeEventListener('mouseup', mouseUpDocumentHandler)\n restoreOnselectstart()\n if (cursorLeave) visible.value = false\n}\n\nconst mouseMoveScrollbarHandler = () => {\n cursorLeave = false\n visible.value = !!props.size\n}\n\nconst mouseLeaveScrollbarHandler = () => {\n cursorLeave = true\n visible.value = cursorDown\n}\n\nonBeforeUnmount(() => {\n restoreOnselectstart()\n document.removeEventListener('mouseup', mouseUpDocumentHandler)\n})\n\nconst restoreOnselectstart = () => {\n if (document.onselectstart !== originalOnSelectStart)\n document.onselectstart = originalOnSelectStart\n}\n\nuseEventListener(\n toRef(scrollbar, 'scrollbarElement'),\n 'mousemove',\n mouseMoveScrollbarHandler\n)\nuseEventListener(\n toRef(scrollbar, 'scrollbarElement'),\n 'mouseleave',\n mouseLeaveScrollbarHandler\n)\n</script>\n"],"mappings":";;;;;;;;;AA6BA,MAAM,iBAAiB;;;;;EACvB,MAAM,QAAQ;EAEd,MAAM,aAAA,GAAA,IAAA,QAAmB,kBAAA,oBAAmB;EAC5C,MAAM,KAAK,cAAA,aAAa,YAAW;EAEnC,IAAI,CAAC,WAAW,cAAA,WAAW,gBAAgB,mCAAkC;EAE7E,MAAM,YAAA,GAAA,IAAA,MAA+B;EACrC,MAAM,SAAA,GAAA,IAA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AA,GAAA,aAAA,mBAAA,GAAA,IAAA,OACQ,WAAW,mBAAmB,EACpC,aACA,0BACF;EACA,CAAA,GAAA,aAAA,mBAAA,GAAA,IAAA,OACQ,WAAW,mBAAmB,EACpC,cACA,2BACF;;qDAnKe,IAAA,YAAA;IAfA,OAAA,GAAA,IAAA,OAAM,GAAE,CAAC,EAAC,OAAA;IAAvB,WAAA;;oCAcQ,EAAA,GAAA,IAAA,iBAAA,GAAA,IAAA,oBAAA,OAAA;cAXA;KAAJ,KAAI;KACH,QAAA,GAAA,IAAA,gBAAK,EAAA,GAAA,IAAA,OAAG,GAAE,CAAC,EAAC,MAAA,GAAA,GAAA,IAAA,OAAS,GAAE,CAAC,GAAG,IAAA,MAAI,IAAG,CAAA,CAAA;KAClC,aAAW;KACX,SAAK,OAAA,OAAA,OAAA,MAAA,GAAA,IAAA,qBAAN,IAAW,CAAA,OAAA,CAAA;oCAOT,OAAA;cAJI;KAAJ,KAAI;KACH,QAAA,GAAA,IAAA,iBAAA,GAAA,IAAA,OAAO,GAAE,CAAC,EAAC,QAAA,CAAA;KACX,QAAA,GAAA,IAAA,gBAAO,WAAA,MAAU;KACjB,aAAW;qCAVN,QAAA,UAAU,QAAA,MAAO,CAAA,CAAA,CAAA,CAAA"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"thumb2.js","names":[],"sources":["../../../../../../packages/components/scrollbar/src/thumb.vue"],"sourcesContent":["<template>\n <transition :name=\"ns.b('fade')\">\n <div\n v-show=\"always || visible\"\n ref=\"instance\"\n :class=\"[ns.e('bar'), ns.is(bar.key)]\"\n @mousedown=\"clickTrackHandler\"\n @click.stop\n >\n <div\n ref=\"thumb\"\n :class=\"ns.e('thumb')\"\n :style=\"thumbStyle\"\n @mousedown=\"clickThumbHandler\"\n />\n </div>\n </transition>\n</template>\n\n<script lang=\"ts\" setup>\nimport { computed, inject, onBeforeUnmount, ref, toRef } from 'vue'\nimport { useEventListener } from '@vueuse/core'\nimport { isClient, throwError } from '@element-plus/utils'\nimport { useNamespace } from '@element-plus/hooks'\nimport { scrollbarContextKey } from './constants'\nimport { BAR_MAP, renderThumbStyle } from './util'\n\nimport type { ThumbProps } from './thumb'\n\nconst COMPONENT_NAME = 'Thumb'\nconst props = defineProps<ThumbProps>()\n\nconst scrollbar = inject(scrollbarContextKey)\nconst ns = useNamespace('scrollbar')\n\nif (!scrollbar) throwError(COMPONENT_NAME, 'can not inject scrollbar context')\n\nconst instance = ref<HTMLDivElement>()\nconst thumb = ref<HTMLDivElement>()\n\nconst thumbState = ref<Partial<Record<'X' | 'Y', number>>>({})\nconst visible = ref(false)\n\nlet cursorDown = false\nlet cursorLeave = false\nlet baseScrollHeight = 0\nlet baseScrollWidth = 0\nlet originalOnSelectStart:\n
|
|
1
|
+
{"version":3,"file":"thumb2.js","names":[],"sources":["../../../../../../packages/components/scrollbar/src/thumb.vue"],"sourcesContent":["<template>\n <transition :name=\"ns.b('fade')\">\n <div\n v-show=\"always || visible\"\n ref=\"instance\"\n :class=\"[ns.e('bar'), ns.is(bar.key)]\"\n @mousedown=\"clickTrackHandler\"\n @click.stop\n >\n <div\n ref=\"thumb\"\n :class=\"ns.e('thumb')\"\n :style=\"thumbStyle\"\n @mousedown=\"clickThumbHandler\"\n />\n </div>\n </transition>\n</template>\n\n<script lang=\"ts\" setup>\nimport { computed, inject, onBeforeUnmount, ref, toRef } from 'vue'\nimport { useEventListener } from '@vueuse/core'\nimport { isClient, throwError } from '@element-plus/utils'\nimport { useNamespace } from '@element-plus/hooks'\nimport { scrollbarContextKey } from './constants'\nimport { BAR_MAP, renderThumbStyle } from './util'\n\nimport type { ThumbProps } from './thumb'\n\nconst COMPONENT_NAME = 'Thumb'\nconst props = defineProps<ThumbProps>()\n\nconst scrollbar = inject(scrollbarContextKey)\nconst ns = useNamespace('scrollbar')\n\nif (!scrollbar) throwError(COMPONENT_NAME, 'can not inject scrollbar context')\n\nconst instance = ref<HTMLDivElement>()\nconst thumb = ref<HTMLDivElement>()\n\nconst thumbState = ref<Partial<Record<'X' | 'Y', number>>>({})\nconst visible = ref(false)\n\nlet cursorDown = false\nlet cursorLeave = false\nlet baseScrollHeight = 0\nlet baseScrollWidth = 0\nlet originalOnSelectStart:\n ((this: GlobalEventHandlers, ev: Event) => any) | null = isClient\n ? document.onselectstart\n : null\n\nconst bar = computed(() => BAR_MAP[props.vertical ? 'vertical' : 'horizontal'])\n\nconst thumbStyle = computed(() =>\n renderThumbStyle({\n size: props.size,\n move: props.move,\n bar: bar.value,\n })\n)\n\nconst offsetRatio = computed(\n () =>\n // offsetRatioX = original width of thumb / current width of thumb / ratioX\n // offsetRatioY = original height of thumb / current height of thumb / ratioY\n // instance height = wrap height - GAP\n instance.value![bar.value.offset] ** 2 /\n scrollbar.wrapElement![bar.value.scrollSize] /\n props.ratio /\n thumb.value![bar.value.offset]\n)\n\nconst clickThumbHandler = (e: MouseEvent) => {\n // prevent click event of middle and right button\n e.stopPropagation()\n if (e.ctrlKey || [1, 2].includes(e.button)) return\n\n window.getSelection()?.removeAllRanges()\n startDrag(e)\n\n const el = e.currentTarget as HTMLDivElement\n if (!el) return\n thumbState.value[bar.value.axis] =\n el[bar.value.offset] -\n (e[bar.value.client] - el.getBoundingClientRect()[bar.value.direction])\n}\n\nconst clickTrackHandler = (e: MouseEvent) => {\n if (!thumb.value || !instance.value || !scrollbar.wrapElement) return\n\n const offset = Math.abs(\n (e.target as HTMLElement).getBoundingClientRect()[bar.value.direction] -\n e[bar.value.client]\n )\n const thumbHalf = thumb.value[bar.value.offset] / 2\n const thumbPositionPercentage =\n ((offset - thumbHalf) * 100 * offsetRatio.value) /\n instance.value[bar.value.offset]\n\n scrollbar.wrapElement[bar.value.scroll] =\n (thumbPositionPercentage * scrollbar.wrapElement[bar.value.scrollSize]) /\n 100\n}\n\nconst startDrag = (e: MouseEvent) => {\n e.stopImmediatePropagation()\n cursorDown = true\n baseScrollHeight = scrollbar.wrapElement!.scrollHeight\n baseScrollWidth = scrollbar.wrapElement!.scrollWidth\n document.addEventListener('mousemove', mouseMoveDocumentHandler)\n document.addEventListener('mouseup', mouseUpDocumentHandler)\n originalOnSelectStart = document.onselectstart\n document.onselectstart = () => false\n}\n\nconst mouseMoveDocumentHandler = (e: MouseEvent) => {\n if (!instance.value || !thumb.value) return\n if (cursorDown === false) return\n\n const prevPage = thumbState.value[bar.value.axis]\n if (!prevPage) return\n\n const offset =\n (instance.value.getBoundingClientRect()[bar.value.direction] -\n e[bar.value.client]) *\n -1\n const thumbClickPosition = thumb.value[bar.value.offset] - prevPage\n const thumbPositionPercentage =\n ((offset - thumbClickPosition) * 100 * offsetRatio.value) /\n instance.value[bar.value.offset]\n\n if (bar.value.scroll === 'scrollLeft') {\n scrollbar.wrapElement![bar.value.scroll] =\n (thumbPositionPercentage * baseScrollWidth) / 100\n } else {\n scrollbar.wrapElement![bar.value.scroll] =\n (thumbPositionPercentage * baseScrollHeight) / 100\n }\n}\n\nconst mouseUpDocumentHandler = () => {\n cursorDown = false\n thumbState.value[bar.value.axis] = 0\n document.removeEventListener('mousemove', mouseMoveDocumentHandler)\n document.removeEventListener('mouseup', mouseUpDocumentHandler)\n restoreOnselectstart()\n if (cursorLeave) visible.value = false\n}\n\nconst mouseMoveScrollbarHandler = () => {\n cursorLeave = false\n visible.value = !!props.size\n}\n\nconst mouseLeaveScrollbarHandler = () => {\n cursorLeave = true\n visible.value = cursorDown\n}\n\nonBeforeUnmount(() => {\n restoreOnselectstart()\n document.removeEventListener('mouseup', mouseUpDocumentHandler)\n})\n\nconst restoreOnselectstart = () => {\n if (document.onselectstart !== originalOnSelectStart)\n document.onselectstart = originalOnSelectStart\n}\n\nuseEventListener(\n toRef(scrollbar, 'scrollbarElement'),\n 'mousemove',\n mouseMoveScrollbarHandler\n)\nuseEventListener(\n toRef(scrollbar, 'scrollbarElement'),\n 'mouseleave',\n mouseLeaveScrollbarHandler\n)\n</script>\n"],"mappings":""}
|
|
@@ -25,8 +25,8 @@ declare const ElSegmented: (<T extends Option = Option>(__VLS_props: NonNullable
|
|
|
25
25
|
id?: string | undefined;
|
|
26
26
|
name?: string | undefined;
|
|
27
27
|
ariaLabel?: string | undefined;
|
|
28
|
-
onChange?: ((val: any) => any) | undefined;
|
|
29
28
|
"onUpdate:modelValue"?: ((val: any) => any) | undefined;
|
|
29
|
+
onChange?: ((val: any) => any) | undefined;
|
|
30
30
|
} & (typeof globalThis extends {
|
|
31
31
|
__VLS_PROPS_FALLBACK: infer P;
|
|
32
32
|
} ? P : {});
|
|
@@ -47,7 +47,7 @@ declare const ElSegmented: (<T extends Option = Option>(__VLS_props: NonNullable
|
|
|
47
47
|
modelValue?: string | number | boolean | (() => string | number | boolean) | undefined;
|
|
48
48
|
props?: (() => Props) | undefined;
|
|
49
49
|
block?: boolean | (() => boolean) | undefined;
|
|
50
|
-
size?: "" | "
|
|
50
|
+
size?: "" | "small" | "default" | "large" | (() => "" | "small" | "default" | "large") | undefined;
|
|
51
51
|
disabled?: boolean | (() => boolean) | undefined;
|
|
52
52
|
validateEvent?: boolean | (() => boolean) | undefined;
|
|
53
53
|
id?: string | (() => string) | undefined;
|
|
@@ -63,11 +63,11 @@ declare const segmentedProps: {
|
|
|
63
63
|
ariaLabel: StringConstructor;
|
|
64
64
|
direction: EpPropFinalized<(new (...args: any[]) => "horizontal" | "vertical") | (() => "horizontal" | "vertical") | (((new (...args: any[]) => "horizontal" | "vertical") | (() => "horizontal" | "vertical")) | null)[], unknown, unknown, string, boolean>;
|
|
65
65
|
options: EpPropFinalized<(new (...args: any[]) => Option[]) | (() => Option[]) | (((new (...args: any[]) => Option[]) | (() => Option[])) | null)[], unknown, unknown, () => never[], boolean>;
|
|
66
|
-
modelValue: EpPropFinalized<(
|
|
66
|
+
modelValue: EpPropFinalized<(BooleanConstructor | StringConstructor | NumberConstructor)[], unknown, unknown, undefined, boolean>;
|
|
67
67
|
props: EpPropFinalized<(new (...args: any[]) => Props) | (() => Props) | (((new (...args: any[]) => Props) | (() => Props)) | null)[], unknown, unknown, () => Required<Props>, boolean>;
|
|
68
68
|
block: BooleanConstructor;
|
|
69
69
|
size: {
|
|
70
|
-
readonly type: _$vue.PropType<EpPropMergeType<StringConstructor, "" | "
|
|
70
|
+
readonly type: _$vue.PropType<EpPropMergeType<StringConstructor, "" | "small" | "default" | "large", never>>;
|
|
71
71
|
readonly required: false;
|
|
72
72
|
readonly validator: ((val: unknown) => boolean) | undefined;
|
|
73
73
|
__epPropKey: true;
|
|
@@ -5,8 +5,8 @@ import * as _$vue from "vue";
|
|
|
5
5
|
//#region ../../packages/components/segmented/src/segmented.vue.d.ts
|
|
6
6
|
declare const __VLS_export: <T extends Option = Option>(__VLS_props: NonNullable<Awaited<typeof __VLS_setup>>["props"], __VLS_ctx?: __VLS_PrettifyLocal<Pick<NonNullable<Awaited<typeof __VLS_setup>>, "attrs" | "emit" | "slots">>, __VLS_exposed?: NonNullable<Awaited<typeof __VLS_setup>>["expose"], __VLS_setup?: Promise<{
|
|
7
7
|
props: _$vue.PublicProps & __VLS_PrettifyLocal<SegmentedProps<T> & {
|
|
8
|
-
onChange?: ((val: any) => any) | undefined;
|
|
9
8
|
"onUpdate:modelValue"?: ((val: any) => any) | undefined;
|
|
9
|
+
onChange?: ((val: any) => any) | undefined;
|
|
10
10
|
}> & (typeof globalThis extends {
|
|
11
11
|
__VLS_PROPS_FALLBACK: infer P;
|
|
12
12
|
} ? P : {});
|
|
@@ -5,13 +5,13 @@ import * as _$vue from "vue";
|
|
|
5
5
|
declare const COMPONENT_NAME = "ElOption";
|
|
6
6
|
declare const optionProps: {
|
|
7
7
|
value: {
|
|
8
|
-
readonly type: _$vue.PropType<EpPropMergeType<(
|
|
8
|
+
readonly type: _$vue.PropType<EpPropMergeType<(BooleanConstructor | ObjectConstructor | StringConstructor | NumberConstructor)[], unknown, unknown>>;
|
|
9
9
|
readonly required: true;
|
|
10
10
|
readonly validator: ((val: unknown) => boolean) | undefined;
|
|
11
11
|
__epPropKey: true;
|
|
12
12
|
};
|
|
13
13
|
label: {
|
|
14
|
-
readonly type: _$vue.PropType<EpPropMergeType<(
|
|
14
|
+
readonly type: _$vue.PropType<EpPropMergeType<(StringConstructor | NumberConstructor)[], unknown, unknown>>;
|
|
15
15
|
readonly required: false;
|
|
16
16
|
readonly validator: ((val: unknown) => boolean) | undefined;
|
|
17
17
|
__epPropKey: true;
|
|
@@ -6,13 +6,13 @@ import * as _$vue from "vue";
|
|
|
6
6
|
declare const _default: typeof __VLS_export;
|
|
7
7
|
declare const __VLS_export: _$vue.DefineComponent<_$vue.ExtractPropTypes<{
|
|
8
8
|
value: {
|
|
9
|
-
readonly type: _$vue.PropType<EpPropMergeType<(
|
|
9
|
+
readonly type: _$vue.PropType<EpPropMergeType<(BooleanConstructor | ObjectConstructor | StringConstructor | NumberConstructor)[], unknown, unknown>>;
|
|
10
10
|
readonly required: true;
|
|
11
11
|
readonly validator: ((val: unknown) => boolean) | undefined;
|
|
12
12
|
__epPropKey: true;
|
|
13
13
|
};
|
|
14
14
|
label: {
|
|
15
|
-
readonly type: _$vue.PropType<EpPropMergeType<(
|
|
15
|
+
readonly type: _$vue.PropType<EpPropMergeType<(StringConstructor | NumberConstructor)[], unknown, unknown>>;
|
|
16
16
|
readonly required: false;
|
|
17
17
|
readonly validator: ((val: unknown) => boolean) | undefined;
|
|
18
18
|
__epPropKey: true;
|
|
@@ -40,7 +40,7 @@ declare const __VLS_export: _$vue.DefineComponent<_$vue.ExtractPropTypes<{
|
|
|
40
40
|
};
|
|
41
41
|
id: _$vue.Ref<string, string>;
|
|
42
42
|
containerKls: _$vue.ComputedRef<string[]>;
|
|
43
|
-
currentLabel: _$vue.ComputedRef<boolean | EpPropMergeType<(
|
|
43
|
+
currentLabel: _$vue.ComputedRef<boolean | EpPropMergeType<(StringConstructor | NumberConstructor)[], unknown, unknown>>;
|
|
44
44
|
itemSelected: _$vue.ComputedRef<boolean>;
|
|
45
45
|
isDisabled: _$vue.ComputedRef<boolean>;
|
|
46
46
|
select: SelectContext;
|
|
@@ -59,13 +59,13 @@ declare const __VLS_export: _$vue.DefineComponent<_$vue.ExtractPropTypes<{
|
|
|
59
59
|
selectOptionClick: () => void;
|
|
60
60
|
}, {}, {}, {}, _$vue.ComponentOptionsMixin, _$vue.ComponentOptionsMixin, {}, string, _$vue.PublicProps, Readonly<_$vue.ExtractPropTypes<{
|
|
61
61
|
value: {
|
|
62
|
-
readonly type: _$vue.PropType<EpPropMergeType<(
|
|
62
|
+
readonly type: _$vue.PropType<EpPropMergeType<(BooleanConstructor | ObjectConstructor | StringConstructor | NumberConstructor)[], unknown, unknown>>;
|
|
63
63
|
readonly required: true;
|
|
64
64
|
readonly validator: ((val: unknown) => boolean) | undefined;
|
|
65
65
|
__epPropKey: true;
|
|
66
66
|
};
|
|
67
67
|
label: {
|
|
68
|
-
readonly type: _$vue.PropType<EpPropMergeType<(
|
|
68
|
+
readonly type: _$vue.PropType<EpPropMergeType<(StringConstructor | NumberConstructor)[], unknown, unknown>>;
|
|
69
69
|
readonly required: false;
|
|
70
70
|
readonly validator: ((val: unknown) => boolean) | undefined;
|
|
71
71
|
__epPropKey: true;
|
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import { ClassValue } from "../../../utils/typescript.js";
|
|
1
2
|
import * as _$vue from "vue";
|
|
2
3
|
|
|
3
4
|
//#region ../../packages/components/select/src/select-dropdown.vue.d.ts
|
|
@@ -22,7 +23,7 @@ declare const __VLS_export: _$vue.DefineComponent<{}, {
|
|
|
22
23
|
cssVarBlockName: (name: string) => string;
|
|
23
24
|
};
|
|
24
25
|
minWidth: _$vue.Ref<string, string>;
|
|
25
|
-
popperClass: _$vue.ComputedRef<string>;
|
|
26
|
+
popperClass: _$vue.ComputedRef<string | false | Record<string, any> | ClassValue[] | null>;
|
|
26
27
|
isMultiple: _$vue.ComputedRef<boolean>;
|
|
27
28
|
isFitInputWidth: _$vue.ComputedRef<boolean>;
|
|
28
29
|
}, {}, {}, {}, _$vue.ComponentOptionsMixin, _$vue.ComponentOptionsMixin, {}, string, _$vue.PublicProps, Readonly<{}> & Readonly<{}>, {}, {}, {}, {}, string, _$vue.ComponentProvideOptions, true, {}, any>;
|
|
@@ -1,12 +1,13 @@
|
|
|
1
1
|
import { EmitFn } from "../../../utils/vue/typescript.js";
|
|
2
2
|
import { EpPropFinalized, EpPropMergeType } from "../../../utils/vue/props/types.js";
|
|
3
|
+
import { ClassValue } from "../../../utils/typescript.js";
|
|
3
4
|
import { PopperEffect } from "../../popper/src/popper.js";
|
|
4
5
|
import { Options, Placement } from "../../popper/index.js";
|
|
5
6
|
import { ScrollbarDirection } from "../../scrollbar/src/scrollbar.js";
|
|
6
7
|
import { Props } from "../../select-v2/src/useProps.js";
|
|
7
8
|
import _default from "./select.vue.js";
|
|
8
9
|
import * as _$vue from "vue";
|
|
9
|
-
import {
|
|
10
|
+
import { ExtractPropTypes, ExtractPublicPropTypes, StyleValue } from "vue";
|
|
10
11
|
|
|
11
12
|
//#region ../../packages/components/select/src/select.d.ts
|
|
12
13
|
/**
|
|
@@ -17,8 +18,8 @@ interface TagTooltipProps {
|
|
|
17
18
|
placement?: Placement;
|
|
18
19
|
fallbackPlacements?: Placement[];
|
|
19
20
|
effect?: PopperEffect;
|
|
20
|
-
popperClass?:
|
|
21
|
-
popperStyle?:
|
|
21
|
+
popperClass?: ClassValue;
|
|
22
|
+
popperStyle?: StyleValue;
|
|
22
23
|
transition?: string;
|
|
23
24
|
teleported?: boolean;
|
|
24
25
|
popperOptions?: Partial<Options>;
|
|
@@ -33,11 +34,11 @@ declare const selectProps: {
|
|
|
33
34
|
valueOnClear: EpPropFinalized<(new (...args: any[]) => string | number | boolean | Function) | (() => string | number | boolean | Function | null) | (((new (...args: any[]) => string | number | boolean | Function) | (() => string | number | boolean | Function | null)) | null)[], unknown, unknown, undefined, boolean>;
|
|
34
35
|
name: StringConstructor;
|
|
35
36
|
id: StringConstructor;
|
|
36
|
-
modelValue: EpPropFinalized<(new (...args: any[]) => string | number | boolean | Record<string, any> | EpPropMergeType<(
|
|
37
|
+
modelValue: EpPropFinalized<(new (...args: any[]) => string | number | boolean | Record<string, any> | EpPropMergeType<(BooleanConstructor | ObjectConstructor | StringConstructor | NumberConstructor)[], unknown, unknown>[]) | (() => EpPropMergeType<(BooleanConstructor | ObjectConstructor | StringConstructor | NumberConstructor)[], unknown, unknown> | EpPropMergeType<(BooleanConstructor | ObjectConstructor | StringConstructor | NumberConstructor)[], unknown, unknown>[] | null) | (((new (...args: any[]) => string | number | boolean | Record<string, any> | EpPropMergeType<(BooleanConstructor | ObjectConstructor | StringConstructor | NumberConstructor)[], unknown, unknown>[]) | (() => EpPropMergeType<(BooleanConstructor | ObjectConstructor | StringConstructor | NumberConstructor)[], unknown, unknown> | EpPropMergeType<(BooleanConstructor | ObjectConstructor | StringConstructor | NumberConstructor)[], unknown, unknown>[] | null)) | null)[], unknown, unknown, undefined, boolean>;
|
|
37
38
|
autocomplete: EpPropFinalized<StringConstructor, unknown, unknown, string, boolean>;
|
|
38
39
|
automaticDropdown: BooleanConstructor;
|
|
39
40
|
size: {
|
|
40
|
-
readonly type: _$vue.PropType<EpPropMergeType<StringConstructor, "" | "
|
|
41
|
+
readonly type: _$vue.PropType<EpPropMergeType<StringConstructor, "" | "small" | "default" | "large", never>>;
|
|
41
42
|
readonly required: false;
|
|
42
43
|
readonly validator: ((val: unknown) => boolean) | undefined;
|
|
43
44
|
__epPropKey: true;
|
|
@@ -48,13 +49,8 @@ declare const selectProps: {
|
|
|
48
49
|
filterable: BooleanConstructor;
|
|
49
50
|
allowCreate: BooleanConstructor;
|
|
50
51
|
loading: BooleanConstructor;
|
|
51
|
-
popperClass: EpPropFinalized<
|
|
52
|
-
popperStyle:
|
|
53
|
-
readonly type: _$vue.PropType<EpPropMergeType<(new (...args: any[]) => string | CSSProperties) | (() => string | CSSProperties) | (((new (...args: any[]) => string | CSSProperties) | (() => string | CSSProperties)) | null)[], unknown, unknown>>;
|
|
54
|
-
readonly required: false;
|
|
55
|
-
readonly validator: ((val: unknown) => boolean) | undefined;
|
|
56
|
-
__epPropKey: true;
|
|
57
|
-
};
|
|
52
|
+
popperClass: EpPropFinalized<(new (...args: any[]) => string | false | Record<string, any> | ClassValue[]) | (() => ClassValue) | (((new (...args: any[]) => string | false | Record<string, any> | ClassValue[]) | (() => ClassValue)) | null)[], unknown, unknown, string, boolean>;
|
|
53
|
+
popperStyle: EpPropFinalized<(new (...args: any[]) => string | false | _$vue.CSSProperties | StyleValue[]) | (() => StyleValue) | (((new (...args: any[]) => string | false | _$vue.CSSProperties | StyleValue[]) | (() => StyleValue)) | null)[], unknown, unknown, undefined, boolean>;
|
|
58
54
|
popperOptions: EpPropFinalized<(new (...args: any[]) => Partial<Options>) | (() => Partial<Options>) | (((new (...args: any[]) => Partial<Options>) | (() => Partial<Options>)) | null)[], unknown, unknown, () => Partial<Options>, boolean>;
|
|
59
55
|
remote: BooleanConstructor;
|
|
60
56
|
debounce: EpPropFinalized<NumberConstructor, unknown, unknown, number, boolean>;
|
|
@@ -95,14 +91,14 @@ declare const selectProps: {
|
|
|
95
91
|
suffixIcon: EpPropFinalized<(new (...args: any[]) => (string | _$vue.Component) & {}) | (() => string | _$vue.Component) | (((new (...args: any[]) => (string | _$vue.Component) & {}) | (() => string | _$vue.Component)) | null)[], unknown, unknown, _$vue.DefineComponent<{}, void, {}, {}, {}, _$vue.ComponentOptionsMixin, _$vue.ComponentOptionsMixin, {}, string, _$vue.PublicProps, Readonly<{}>, {}, {}, {}, {}, string, _$vue.ComponentProvideOptions, true, {}, any>, boolean>;
|
|
96
92
|
tagType: {
|
|
97
93
|
default: string;
|
|
98
|
-
type: _$vue.PropType<EpPropMergeType<StringConstructor, "
|
|
94
|
+
type: _$vue.PropType<EpPropMergeType<StringConstructor, "primary" | "success" | "warning" | "info" | "danger", unknown>>;
|
|
99
95
|
required: false;
|
|
100
96
|
validator: ((val: unknown) => boolean) | undefined;
|
|
101
97
|
__epPropKey: true;
|
|
102
98
|
};
|
|
103
99
|
tagEffect: {
|
|
104
100
|
default: string;
|
|
105
|
-
type: _$vue.PropType<EpPropMergeType<StringConstructor, "
|
|
101
|
+
type: _$vue.PropType<EpPropMergeType<StringConstructor, "dark" | "light" | "plain", unknown>>;
|
|
106
102
|
required: false;
|
|
107
103
|
validator: ((val: unknown) => boolean) | undefined;
|
|
108
104
|
__epPropKey: true;
|
|
@@ -111,9 +107,9 @@ declare const selectProps: {
|
|
|
111
107
|
remoteShowSuffix: BooleanConstructor;
|
|
112
108
|
showArrow: EpPropFinalized<BooleanConstructor, unknown, unknown, boolean, boolean>;
|
|
113
109
|
offset: EpPropFinalized<NumberConstructor, unknown, unknown, number, boolean>;
|
|
114
|
-
placement: EpPropFinalized<(new (...args: any[]) => "auto" | "
|
|
110
|
+
placement: EpPropFinalized<(new (...args: any[]) => "auto" | "left" | "right" | "bottom" | "top" | "auto-start" | "auto-end" | "top-start" | "top-end" | "bottom-start" | "bottom-end" | "right-start" | "right-end" | "left-start" | "left-end") | (() => Placement) | (((new (...args: any[]) => "auto" | "left" | "right" | "bottom" | "top" | "auto-start" | "auto-end" | "top-start" | "top-end" | "bottom-start" | "bottom-end" | "right-start" | "right-end" | "left-start" | "left-end") | (() => Placement)) | null)[], Placement, unknown, string, boolean>;
|
|
115
111
|
fallbackPlacements: EpPropFinalized<(new (...args: any[]) => Placement[]) | (() => Placement[]) | (((new (...args: any[]) => Placement[]) | (() => Placement[])) | null)[], unknown, unknown, string[], boolean>;
|
|
116
|
-
tabindex: EpPropFinalized<(
|
|
112
|
+
tabindex: EpPropFinalized<(StringConstructor | NumberConstructor)[], unknown, unknown, number, boolean>;
|
|
117
113
|
appendTo: {
|
|
118
114
|
readonly type: _$vue.PropType<EpPropMergeType<(new (...args: any[]) => string | HTMLElement) | (() => string | HTMLElement) | (((new (...args: any[]) => string | HTMLElement) | (() => string | HTMLElement)) | null)[], unknown, unknown>>;
|
|
119
115
|
readonly required: false;
|