naive-ui 2.31.0 → 2.32.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/index.js +3197 -1769
- package/dist/index.prod.js +1 -1
- package/es/_internal/scrollbar/src/Scrollbar.d.ts +5 -0
- package/es/_internal/scrollbar/src/Scrollbar.js +49 -26
- package/es/_internal/scrollbar/src/styles/index.cssr.js +1 -1
- package/es/_internal/scrollbar/src/styles/rtl.cssr.d.ts +2 -0
- package/es/_internal/scrollbar/src/styles/rtl.cssr.js +10 -0
- package/es/_internal/scrollbar/styles/index.d.ts +1 -0
- package/es/_internal/scrollbar/styles/index.js +1 -0
- package/es/_internal/scrollbar/styles/rtl.d.ts +3 -0
- package/es/_internal/scrollbar/styles/rtl.js +6 -0
- package/es/_internal/selection/src/Selection.js +4 -2
- package/es/_internal/selection/src/styles/index.cssr.js +4 -1
- package/es/_mixins/index.d.ts +1 -0
- package/es/_mixins/index.js +1 -0
- package/es/_utils/naive/extract-public-props.d.ts +4 -1
- package/es/auto-complete/src/AutoComplete.d.ts +1 -0
- package/es/avatar/src/Avatar.d.ts +0 -1
- package/es/avatar/src/Avatar.js +12 -10
- package/es/button/src/Button.js +3 -0
- package/es/carousel/src/Carousel.d.ts +16 -37
- package/es/carousel/src/Carousel.js +269 -272
- package/es/carousel/src/CarouselArrow.js +3 -5
- package/es/carousel/src/CarouselContext.d.ts +21 -0
- package/es/carousel/src/CarouselContext.js +11 -0
- package/es/carousel/src/CarouselDots.d.ts +1 -1
- package/es/carousel/src/CarouselDots.js +23 -31
- package/es/carousel/src/CarouselItem.d.ts +4 -4
- package/es/carousel/src/CarouselItem.js +17 -36
- package/es/carousel/src/interface.d.ts +12 -31
- package/es/carousel/src/interface.js +1 -3
- package/es/carousel/src/styles/index.cssr.js +8 -3
- package/es/carousel/src/{utils.d.ts → utils/duplicatedLogic.d.ts} +3 -8
- package/es/carousel/src/utils/duplicatedLogic.js +46 -0
- package/es/carousel/src/utils/event.d.ts +1 -0
- package/es/carousel/src/utils/event.js +3 -0
- package/es/carousel/src/utils/index.d.ts +6 -0
- package/es/carousel/src/{utils.js → utils/index.js} +3 -28
- package/es/checkbox/src/CheckboxGroup.d.ts +27 -22
- package/es/checkbox/src/CheckboxGroup.js +58 -28
- package/es/code/src/Code.d.ts +16 -0
- package/es/code/src/Code.js +53 -12
- package/es/code/src/styles/index.cssr.js +14 -2
- package/es/code/styles/dark.js +4 -2
- package/es/code/styles/light.d.ts +1 -0
- package/es/code/styles/light.js +4 -2
- package/es/components.d.ts +1 -0
- package/es/components.js +1 -0
- package/es/config-provider/src/ConfigProvider.d.ts +24 -3
- package/es/config-provider/src/internal-interface.d.ts +4 -0
- package/es/date-picker/src/DatePicker.d.ts +1 -0
- package/es/date-picker/src/panel/daterange.d.ts +0 -1
- package/es/date-picker/src/panel/daterange.js +1 -1
- package/es/date-picker/src/panel/datetimerange.d.ts +0 -1
- package/es/date-picker/src/panel/datetimerange.js +1 -1
- package/es/date-picker/src/panel/monthrange.d.ts +0 -1
- package/es/date-picker/src/panel/monthrange.js +1 -1
- package/es/date-picker/src/panel/use-dual-calendar.d.ts +0 -1
- package/es/date-picker/src/panel/use-dual-calendar.js +0 -11
- package/es/dialog/src/DialogEnvironment.d.ts +4 -0
- package/es/dialog/src/DialogEnvironment.js +11 -4
- package/es/dialog/src/DialogProvider.d.ts +1 -0
- package/es/dynamic-tags/src/DynamicTags.d.ts +1 -0
- package/es/image/src/utils.d.ts +1 -1
- package/es/input/src/Input.d.ts +1 -0
- package/es/input/src/Input.js +19 -8
- package/es/input/src/interface.d.ts +1 -0
- package/es/input/src/styles/input.cssr.js +1 -6
- package/es/input-number/src/InputNumber.d.ts +1 -0
- package/es/input-number/src/InputNumber.js +4 -0
- package/es/legacy-grid/src/Row.d.ts +1 -0
- package/es/legacy-grid/src/Row.js +8 -3
- package/es/legacy-grid/src/styles/rtl.cssr.d.ts +2 -0
- package/es/legacy-grid/src/styles/rtl.cssr.js +21 -0
- package/es/legacy-grid/styles/dark.d.ts +4 -0
- package/es/legacy-grid/styles/dark.js +6 -0
- package/es/legacy-grid/styles/index.d.ts +4 -0
- package/es/legacy-grid/styles/index.js +3 -0
- package/es/legacy-grid/styles/light.d.ts +4 -0
- package/es/legacy-grid/styles/light.js +6 -0
- package/es/legacy-grid/styles/rtl.d.ts +2 -0
- package/es/legacy-grid/styles/rtl.js +5 -0
- package/es/legacy-transfer/index.d.ts +3 -0
- package/es/legacy-transfer/index.js +1 -0
- package/es/legacy-transfer/src/Transfer.d.ts +3631 -0
- package/es/legacy-transfer/src/Transfer.js +214 -0
- package/es/legacy-transfer/src/TransferFilter.d.ts +509 -0
- package/es/legacy-transfer/src/TransferFilter.js +40 -0
- package/es/legacy-transfer/src/TransferHeader.d.ts +25 -0
- package/es/legacy-transfer/src/TransferHeader.js +47 -0
- package/es/legacy-transfer/src/TransferList.d.ts +556 -0
- package/es/legacy-transfer/src/TransferList.js +93 -0
- package/es/legacy-transfer/src/TransferListItem.d.ts +513 -0
- package/es/legacy-transfer/src/TransferListItem.js +65 -0
- package/es/legacy-transfer/src/interface.d.ts +31 -0
- package/es/legacy-transfer/src/interface.js +2 -0
- package/es/legacy-transfer/src/styles/index.cssr.d.ts +2 -0
- package/es/legacy-transfer/src/styles/index.cssr.js +215 -0
- package/es/legacy-transfer/src/use-transfer-data.d.ts +41 -0
- package/es/legacy-transfer/src/use-transfer-data.js +145 -0
- package/es/legacy-transfer/styles/_common.d.ts +5 -0
- package/es/legacy-transfer/styles/_common.js +4 -0
- package/es/legacy-transfer/styles/dark.d.ts +3 -0
- package/es/legacy-transfer/styles/dark.js +27 -0
- package/es/legacy-transfer/styles/index.d.ts +3 -0
- package/es/legacy-transfer/styles/index.js +2 -0
- package/es/legacy-transfer/styles/light.d.ts +363 -0
- package/es/legacy-transfer/styles/light.js +31 -0
- package/es/locales/common/deDE.js +11 -6
- package/es/locales/common/enGB.js +8 -1
- package/es/locales/common/enUS.d.ts +8 -1
- package/es/locales/common/enUS.js +8 -1
- package/es/locales/common/eo.js +10 -2
- package/es/locales/common/esAR.js +9 -1
- package/es/locales/common/frFR.js +9 -1
- package/es/locales/common/idID.js +9 -1
- package/es/locales/common/itIT.js +9 -1
- package/es/locales/common/jaJP.js +9 -1
- package/es/locales/common/koKR.js +9 -1
- package/es/locales/common/nbNO.js +9 -1
- package/es/locales/common/nlNL.js +9 -1
- package/es/locales/common/plPL.js +9 -1
- package/es/locales/common/ptBR.js +9 -1
- package/es/locales/common/ruRU.js +9 -1
- package/es/locales/common/skSK.js +9 -1
- package/es/locales/common/thTH.js +9 -1
- package/es/locales/common/ukUA.js +9 -1
- package/es/locales/common/viVN.js +9 -1
- package/es/locales/common/zhCN.js +8 -1
- package/es/locales/common/zhTW.js +9 -1
- package/es/log/src/Log.d.ts +10 -0
- package/es/log/styles/light.d.ts +1 -0
- package/es/mention/src/Mention.d.ts +1 -0
- package/es/notification/src/Notification.d.ts +11 -1
- package/es/notification/src/Notification.js +6 -4
- package/es/notification/src/NotificationEnvironment.d.ts +12 -0
- package/es/notification/src/NotificationEnvironment.js +27 -2
- package/es/notification/src/NotificationProvider.d.ts +7 -0
- package/es/notification/src/NotificationProvider.js +4 -2
- package/es/pagination/src/Pagination.d.ts +1 -0
- package/es/progress/src/Circle.js +3 -1
- package/es/select/src/Select.js +3 -0
- package/es/statistic/src/Statistic.d.ts +1 -0
- package/es/statistic/src/Statistic.js +9 -3
- package/es/statistic/src/styles/rtl.cssr.d.ts +2 -0
- package/es/statistic/src/styles/rtl.cssr.js +9 -0
- package/es/statistic/styles/index.d.ts +1 -0
- package/es/statistic/styles/index.js +1 -0
- package/es/statistic/styles/rtl.d.ts +2 -0
- package/es/statistic/styles/rtl.js +5 -0
- package/es/styles.d.ts +6 -3
- package/es/styles.js +6 -3
- package/es/themes/dark.js +4 -0
- package/es/themes/light.js +4 -0
- package/es/thing/src/Thing.js +9 -3
- package/es/thing/src/styles/rtl.cssr.d.ts +2 -0
- package/es/thing/src/styles/rtl.cssr.js +8 -0
- package/es/thing/styles/index.d.ts +1 -0
- package/es/thing/styles/index.js +1 -0
- package/es/thing/styles/rtl.d.ts +2 -0
- package/es/thing/styles/rtl.js +8 -0
- package/es/time-picker/src/TimePicker.d.ts +1 -0
- package/es/transfer/index.d.ts +1 -1
- package/es/transfer/src/Transfer.d.ts +210 -90
- package/es/transfer/src/Transfer.js +67 -106
- package/es/transfer/src/TransferFilter.d.ts +18 -21
- package/es/transfer/src/TransferFilter.js +2 -10
- package/es/transfer/src/TransferHeader.d.ts +10 -12
- package/es/transfer/src/TransferHeader.js +24 -29
- package/es/transfer/src/TransferList.d.ts +20 -29
- package/es/transfer/src/TransferList.js +15 -32
- package/es/transfer/src/TransferListItem.d.ts +32 -19
- package/es/transfer/src/TransferListItem.js +33 -29
- package/es/transfer/src/interface.d.ts +21 -15
- package/es/transfer/src/styles/index.cssr.js +75 -139
- package/es/transfer/src/use-transfer-data.d.ts +13 -31
- package/es/transfer/src/use-transfer-data.js +45 -121
- package/es/transfer/styles/_common.d.ts +11 -2
- package/es/transfer/styles/_common.js +11 -2
- package/es/transfer/styles/dark.js +8 -4
- package/es/transfer/styles/light.d.ts +36 -10
- package/es/transfer/styles/light.js +7 -5
- package/es/tree/src/Tree.d.ts +1 -0
- package/es/tree/src/Tree.js +22 -16
- package/es/tree/src/TreeNode.d.ts +1 -0
- package/es/tree/src/TreeNode.js +5 -3
- package/es/tree/src/styles/rtl.cssr.d.ts +2 -0
- package/es/tree/src/styles/rtl.cssr.js +17 -0
- package/es/tree/styles/index.d.ts +1 -0
- package/es/tree/styles/index.js +1 -0
- package/es/tree/styles/rtl.d.ts +2 -0
- package/es/tree/styles/rtl.js +5 -0
- package/es/upload/src/interface.d.ts +2 -2
- package/es/version.d.ts +1 -1
- package/es/version.js +1 -1
- package/es/watermark/src/Watermark.d.ts +13 -0
- package/es/watermark/src/Watermark.js +35 -14
- package/es/watermark/src/styles/index.cssr.js +13 -0
- package/lib/_internal/scrollbar/src/Scrollbar.d.ts +5 -0
- package/lib/_internal/scrollbar/src/Scrollbar.js +47 -24
- package/lib/_internal/scrollbar/src/styles/index.cssr.js +1 -1
- package/lib/_internal/scrollbar/src/styles/rtl.cssr.d.ts +2 -0
- package/lib/_internal/scrollbar/src/styles/rtl.cssr.js +17 -0
- package/lib/_internal/scrollbar/styles/index.d.ts +1 -0
- package/lib/_internal/scrollbar/styles/index.js +3 -1
- package/lib/_internal/scrollbar/styles/rtl.d.ts +3 -0
- package/lib/_internal/scrollbar/styles/rtl.js +12 -0
- package/lib/_internal/selection/src/Selection.js +4 -2
- package/lib/_internal/selection/src/styles/index.cssr.js +4 -1
- package/lib/_mixins/index.d.ts +1 -0
- package/lib/_mixins/index.js +3 -1
- package/lib/_utils/naive/extract-public-props.d.ts +4 -1
- package/lib/auto-complete/src/AutoComplete.d.ts +1 -0
- package/lib/avatar/src/Avatar.d.ts +0 -1
- package/lib/avatar/src/Avatar.js +12 -10
- package/lib/button/src/Button.js +3 -0
- package/lib/carousel/src/Carousel.d.ts +16 -37
- package/lib/carousel/src/Carousel.js +290 -270
- package/lib/carousel/src/CarouselArrow.js +2 -4
- package/lib/carousel/src/CarouselContext.d.ts +21 -0
- package/lib/carousel/src/CarouselContext.js +16 -0
- package/lib/carousel/src/CarouselDots.d.ts +1 -1
- package/lib/carousel/src/CarouselDots.js +22 -30
- package/lib/carousel/src/CarouselItem.d.ts +4 -4
- package/lib/carousel/src/CarouselItem.js +18 -35
- package/lib/carousel/src/interface.d.ts +12 -31
- package/lib/carousel/src/interface.js +0 -5
- package/lib/carousel/src/styles/index.cssr.js +8 -3
- package/lib/carousel/src/{utils.d.ts → utils/duplicatedLogic.d.ts} +3 -8
- package/lib/carousel/src/utils/duplicatedLogic.js +55 -0
- package/lib/carousel/src/utils/event.d.ts +1 -0
- package/lib/carousel/src/utils/event.js +7 -0
- package/lib/carousel/src/utils/index.d.ts +6 -0
- package/lib/carousel/src/utils/index.js +53 -0
- package/lib/checkbox/src/CheckboxGroup.d.ts +27 -22
- package/lib/checkbox/src/CheckboxGroup.js +56 -26
- package/lib/code/src/Code.d.ts +16 -0
- package/lib/code/src/Code.js +53 -12
- package/lib/code/src/styles/index.cssr.js +13 -1
- package/lib/code/styles/dark.js +4 -2
- package/lib/code/styles/light.d.ts +1 -0
- package/lib/code/styles/light.js +4 -2
- package/lib/components.d.ts +1 -0
- package/lib/components.js +1 -0
- package/lib/config-provider/src/ConfigProvider.d.ts +24 -3
- package/lib/config-provider/src/internal-interface.d.ts +4 -0
- package/lib/date-picker/src/DatePicker.d.ts +1 -0
- package/lib/date-picker/src/panel/daterange.d.ts +0 -1
- package/lib/date-picker/src/panel/daterange.js +1 -1
- package/lib/date-picker/src/panel/datetimerange.d.ts +0 -1
- package/lib/date-picker/src/panel/datetimerange.js +1 -1
- package/lib/date-picker/src/panel/monthrange.d.ts +0 -1
- package/lib/date-picker/src/panel/monthrange.js +1 -1
- package/lib/date-picker/src/panel/use-dual-calendar.d.ts +0 -1
- package/lib/date-picker/src/panel/use-dual-calendar.js +0 -11
- package/lib/dialog/src/DialogEnvironment.d.ts +4 -0
- package/lib/dialog/src/DialogEnvironment.js +11 -4
- package/lib/dialog/src/DialogProvider.d.ts +1 -0
- package/lib/dynamic-tags/src/DynamicTags.d.ts +1 -0
- package/lib/image/src/utils.d.ts +1 -1
- package/lib/input/src/Input.d.ts +1 -0
- package/lib/input/src/Input.js +19 -8
- package/lib/input/src/interface.d.ts +1 -0
- package/lib/input/src/styles/input.cssr.js +1 -6
- package/lib/input-number/src/InputNumber.d.ts +1 -0
- package/lib/input-number/src/InputNumber.js +4 -0
- package/lib/legacy-grid/src/Row.d.ts +1 -0
- package/lib/legacy-grid/src/Row.js +7 -2
- package/lib/legacy-grid/src/styles/rtl.cssr.d.ts +2 -0
- package/lib/legacy-grid/src/styles/rtl.cssr.js +28 -0
- package/lib/legacy-grid/styles/dark.d.ts +4 -0
- package/lib/legacy-grid/styles/dark.js +8 -0
- package/lib/legacy-grid/styles/index.d.ts +4 -0
- package/lib/legacy-grid/styles/index.js +12 -0
- package/lib/legacy-grid/styles/light.d.ts +4 -0
- package/lib/legacy-grid/styles/light.js +8 -0
- package/lib/legacy-grid/styles/rtl.d.ts +2 -0
- package/lib/legacy-grid/styles/rtl.js +11 -0
- package/lib/legacy-transfer/index.d.ts +3 -0
- package/lib/legacy-transfer/index.js +9 -0
- package/lib/legacy-transfer/src/Transfer.d.ts +3631 -0
- package/lib/legacy-transfer/src/Transfer.js +220 -0
- package/lib/legacy-transfer/src/TransferFilter.d.ts +509 -0
- package/lib/legacy-transfer/src/TransferFilter.js +42 -0
- package/lib/legacy-transfer/src/TransferHeader.d.ts +25 -0
- package/lib/legacy-transfer/src/TransferHeader.js +49 -0
- package/lib/legacy-transfer/src/TransferList.d.ts +556 -0
- package/lib/legacy-transfer/src/TransferList.js +98 -0
- package/lib/legacy-transfer/src/TransferListItem.d.ts +513 -0
- package/lib/legacy-transfer/src/TransferListItem.js +67 -0
- package/lib/legacy-transfer/src/interface.d.ts +31 -0
- package/lib/legacy-transfer/src/interface.js +5 -0
- package/lib/legacy-transfer/src/styles/index.cssr.d.ts +2 -0
- package/lib/legacy-transfer/src/styles/index.cssr.js +223 -0
- package/lib/legacy-transfer/src/use-transfer-data.d.ts +41 -0
- package/lib/legacy-transfer/src/use-transfer-data.js +149 -0
- package/lib/legacy-transfer/styles/_common.d.ts +5 -0
- package/lib/legacy-transfer/styles/_common.js +6 -0
- package/lib/legacy-transfer/styles/dark.d.ts +3 -0
- package/lib/legacy-transfer/styles/dark.js +32 -0
- package/lib/legacy-transfer/styles/index.d.ts +3 -0
- package/lib/legacy-transfer/styles/index.js +10 -0
- package/lib/legacy-transfer/styles/light.d.ts +363 -0
- package/lib/legacy-transfer/styles/light.js +36 -0
- package/lib/locales/common/deDE.js +11 -6
- package/lib/locales/common/enGB.js +8 -1
- package/lib/locales/common/enUS.d.ts +8 -1
- package/lib/locales/common/enUS.js +8 -1
- package/lib/locales/common/eo.js +10 -2
- package/lib/locales/common/esAR.js +9 -1
- package/lib/locales/common/frFR.js +9 -1
- package/lib/locales/common/idID.js +9 -1
- package/lib/locales/common/itIT.js +9 -1
- package/lib/locales/common/jaJP.js +9 -1
- package/lib/locales/common/koKR.js +9 -1
- package/lib/locales/common/nbNO.js +9 -1
- package/lib/locales/common/nlNL.js +9 -1
- package/lib/locales/common/plPL.js +9 -1
- package/lib/locales/common/ptBR.js +9 -1
- package/lib/locales/common/ruRU.js +9 -1
- package/lib/locales/common/skSK.js +9 -1
- package/lib/locales/common/thTH.js +9 -1
- package/lib/locales/common/ukUA.js +9 -1
- package/lib/locales/common/viVN.js +9 -1
- package/lib/locales/common/zhCN.js +8 -1
- package/lib/locales/common/zhTW.js +9 -1
- package/lib/log/src/Log.d.ts +10 -0
- package/lib/log/styles/light.d.ts +1 -0
- package/lib/mention/src/Mention.d.ts +1 -0
- package/lib/notification/src/Notification.d.ts +11 -1
- package/lib/notification/src/Notification.js +6 -4
- package/lib/notification/src/NotificationEnvironment.d.ts +12 -0
- package/lib/notification/src/NotificationEnvironment.js +27 -2
- package/lib/notification/src/NotificationProvider.d.ts +7 -0
- package/lib/notification/src/NotificationProvider.js +4 -2
- package/lib/pagination/src/Pagination.d.ts +1 -0
- package/lib/progress/src/Circle.js +3 -1
- package/lib/select/src/Select.js +3 -0
- package/lib/statistic/src/Statistic.d.ts +1 -0
- package/lib/statistic/src/Statistic.js +8 -2
- package/lib/statistic/src/styles/rtl.cssr.d.ts +2 -0
- package/lib/statistic/src/styles/rtl.cssr.js +16 -0
- package/lib/statistic/styles/index.d.ts +1 -0
- package/lib/statistic/styles/index.js +3 -1
- package/lib/statistic/styles/rtl.d.ts +2 -0
- package/lib/statistic/styles/rtl.js +11 -0
- package/lib/styles.d.ts +6 -3
- package/lib/styles.js +151 -142
- package/lib/themes/dark.js +82 -78
- package/lib/themes/light.js +82 -78
- package/lib/thing/src/Thing.js +8 -2
- package/lib/thing/src/styles/rtl.cssr.d.ts +2 -0
- package/lib/thing/src/styles/rtl.cssr.js +15 -0
- package/lib/thing/styles/index.d.ts +1 -0
- package/lib/thing/styles/index.js +3 -1
- package/lib/thing/styles/rtl.d.ts +2 -0
- package/lib/thing/styles/rtl.js +14 -0
- package/lib/time-picker/src/TimePicker.d.ts +1 -0
- package/lib/transfer/index.d.ts +1 -1
- package/lib/transfer/src/Transfer.d.ts +210 -90
- package/lib/transfer/src/Transfer.js +63 -102
- package/lib/transfer/src/TransferFilter.d.ts +18 -21
- package/lib/transfer/src/TransferFilter.js +2 -10
- package/lib/transfer/src/TransferHeader.d.ts +10 -12
- package/lib/transfer/src/TransferHeader.js +23 -28
- package/lib/transfer/src/TransferList.d.ts +20 -29
- package/lib/transfer/src/TransferList.js +14 -31
- package/lib/transfer/src/TransferListItem.d.ts +32 -19
- package/lib/transfer/src/TransferListItem.js +33 -29
- package/lib/transfer/src/interface.d.ts +21 -15
- package/lib/transfer/src/styles/index.cssr.js +74 -139
- package/lib/transfer/src/use-transfer-data.d.ts +13 -31
- package/lib/transfer/src/use-transfer-data.js +44 -120
- package/lib/transfer/styles/_common.d.ts +11 -2
- package/lib/transfer/styles/_common.js +11 -2
- package/lib/transfer/styles/dark.js +8 -4
- package/lib/transfer/styles/light.d.ts +36 -10
- package/lib/transfer/styles/light.js +7 -5
- package/lib/tree/src/Tree.d.ts +1 -0
- package/lib/tree/src/Tree.js +21 -15
- package/lib/tree/src/TreeNode.d.ts +1 -0
- package/lib/tree/src/TreeNode.js +5 -3
- package/lib/tree/src/styles/rtl.cssr.d.ts +2 -0
- package/lib/tree/src/styles/rtl.cssr.js +24 -0
- package/lib/tree/styles/index.d.ts +1 -0
- package/lib/tree/styles/index.js +3 -1
- package/lib/tree/styles/rtl.d.ts +2 -0
- package/lib/tree/styles/rtl.js +11 -0
- package/lib/upload/src/interface.d.ts +2 -2
- package/lib/version.d.ts +1 -1
- package/lib/version.js +1 -1
- package/lib/watermark/src/Watermark.d.ts +13 -0
- package/lib/watermark/src/Watermark.js +34 -13
- package/lib/watermark/src/styles/index.cssr.js +13 -0
- package/package.json +4 -3
- package/volar.d.ts +1 -0
- package/web-types.json +183 -1
- package/lib/carousel/src/utils.js +0 -69
|
@@ -1,4 +1,27 @@
|
|
|
1
1
|
"use strict";
|
|
2
|
+
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
3
|
+
if (k2 === undefined) k2 = k;
|
|
4
|
+
var desc = Object.getOwnPropertyDescriptor(m, k);
|
|
5
|
+
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
|
6
|
+
desc = { enumerable: true, get: function() { return m[k]; } };
|
|
7
|
+
}
|
|
8
|
+
Object.defineProperty(o, k2, desc);
|
|
9
|
+
}) : (function(o, m, k, k2) {
|
|
10
|
+
if (k2 === undefined) k2 = k;
|
|
11
|
+
o[k2] = m[k];
|
|
12
|
+
}));
|
|
13
|
+
var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
|
|
14
|
+
Object.defineProperty(o, "default", { enumerable: true, value: v });
|
|
15
|
+
}) : function(o, v) {
|
|
16
|
+
o["default"] = v;
|
|
17
|
+
});
|
|
18
|
+
var __importStar = (this && this.__importStar) || function (mod) {
|
|
19
|
+
if (mod && mod.__esModule) return mod;
|
|
20
|
+
var result = {};
|
|
21
|
+
if (mod != null) for (var k in mod) if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k);
|
|
22
|
+
__setModuleDefault(result, mod);
|
|
23
|
+
return result;
|
|
24
|
+
};
|
|
2
25
|
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
3
26
|
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
4
27
|
};
|
|
@@ -6,17 +29,21 @@ Object.defineProperty(exports, "__esModule", { value: true });
|
|
|
6
29
|
exports.carouselProps = void 0;
|
|
7
30
|
const vue_1 = require("vue");
|
|
8
31
|
const vueuc_1 = require("vueuc");
|
|
32
|
+
const vooks_1 = require("vooks");
|
|
9
33
|
const evtd_1 = require("evtd");
|
|
10
34
|
const _mixins_1 = require("../../_mixins");
|
|
11
35
|
const _utils_1 = require("../../_utils");
|
|
12
36
|
const styles_1 = require("../styles");
|
|
13
37
|
const utils_1 = require("./utils");
|
|
38
|
+
const CarouselContext_1 = require("./CarouselContext");
|
|
14
39
|
const CarouselDots_1 = __importDefault(require("./CarouselDots"));
|
|
15
40
|
const CarouselArrow_1 = __importDefault(require("./CarouselArrow"));
|
|
16
|
-
const CarouselItem_1 =
|
|
17
|
-
const interface_1 = require("./interface");
|
|
41
|
+
const CarouselItem_1 = __importStar(require("./CarouselItem"));
|
|
18
42
|
const index_cssr_1 = __importDefault(require("./styles/index.cssr"));
|
|
19
|
-
const transitionProperties =
|
|
43
|
+
const transitionProperties = [
|
|
44
|
+
'transitionDuration',
|
|
45
|
+
'transitionTimingFunction'
|
|
46
|
+
];
|
|
20
47
|
exports.carouselProps = Object.assign(Object.assign({}, _mixins_1.useTheme.props), { defaultIndex: {
|
|
21
48
|
type: Number,
|
|
22
49
|
default: 0
|
|
@@ -68,67 +95,54 @@ exports.default = (0, vue_1.defineComponent)({
|
|
|
68
95
|
const { mergedClsPrefixRef, inlineThemeDisabled } = (0, _mixins_1.useConfig)(props);
|
|
69
96
|
// Dom
|
|
70
97
|
const selfElRef = (0, vue_1.ref)(null);
|
|
71
|
-
const
|
|
98
|
+
const slidesElRef = (0, vue_1.ref)(null);
|
|
99
|
+
const slideElsRef = (0, vue_1.ref)([]);
|
|
72
100
|
const slideVNodesRef = { value: [] };
|
|
101
|
+
// Computed states
|
|
102
|
+
const verticalRef = (0, vue_1.computed)(() => props.direction === 'vertical');
|
|
103
|
+
const sizeAxisRef = (0, vue_1.computed)(() => (verticalRef.value ? 'height' : 'width'));
|
|
104
|
+
const spaceAxisRef = (0, vue_1.computed)(() => verticalRef.value ? 'bottom' : 'right');
|
|
105
|
+
const sequenceLayoutRef = (0, vue_1.computed)(() => props.effect === 'slide');
|
|
106
|
+
const duplicatedableRef = (0, vue_1.computed)(
|
|
107
|
+
// duplicate the copy operation in `slide` mode,
|
|
108
|
+
// because only its DOM is sequence layout
|
|
109
|
+
() => props.loop && props.slidesPerView === 1 && sequenceLayoutRef.value);
|
|
73
110
|
// user wants to control the transition animation
|
|
74
111
|
const userWantsControlRef = (0, vue_1.computed)(() => props.effect === 'custom');
|
|
75
|
-
const translateableRef = (0, vue_1.computed)(() => !userWantsControlRef.value && props.effect === 'slide');
|
|
76
|
-
// TODO
|
|
77
|
-
const allowLoopRef = (0, vue_1.computed)(() => props.loop && props.slidesPerView === 1);
|
|
78
|
-
// Because of the nature of the loop slide work,
|
|
79
|
-
// we need to add duplicates to the left and right of the carousel
|
|
80
|
-
// slot [ 0 1 2 ]
|
|
81
|
-
// display 2 0 1 2 0
|
|
82
|
-
// index 0 1 2 3 4
|
|
83
|
-
const duplicatedableRef = (0, vue_1.computed)(
|
|
84
|
-
// only duplicate the copy operation in `slide` mode,
|
|
85
|
-
// because other effects have special process
|
|
86
|
-
() => translateableRef.value && allowLoopRef.value);
|
|
87
112
|
// used to calculate total views
|
|
88
|
-
const displaySlidesPerViewRef = (0, vue_1.computed)(() =>
|
|
89
|
-
props.centeredSlides ||
|
|
90
|
-
props.effect !== 'slide'
|
|
91
|
-
? 1
|
|
92
|
-
: props.slidesPerView);
|
|
113
|
+
const displaySlidesPerViewRef = (0, vue_1.computed)(() => !sequenceLayoutRef.value || props.centeredSlides ? 1 : props.slidesPerView);
|
|
93
114
|
// used to calculate the size of each slide
|
|
94
115
|
const realSlidesPerViewRef = (0, vue_1.computed)(() => userWantsControlRef.value ? 1 : props.slidesPerView);
|
|
95
116
|
// we automatically calculate total view for special slides per view
|
|
96
117
|
const autoSlideSizeRef = (0, vue_1.computed)(() => displaySlidesPerViewRef.value === 'auto' ||
|
|
97
118
|
(props.slidesPerView === 'auto' && props.centeredSlides));
|
|
98
|
-
|
|
99
|
-
? (0, _utils_1.keep)(props.transitionStyle, transitionProperties)
|
|
100
|
-
: {});
|
|
101
|
-
const speedRef = (0, vue_1.computed)(() => userWantsControlRef.value
|
|
102
|
-
? 0
|
|
103
|
-
: (0, utils_1.resolveSpeed)(transitionStyleRef.value.transitionDuration));
|
|
104
|
-
const verticalRef = (0, vue_1.computed)(() => props.direction === 'vertical');
|
|
105
|
-
const sizeAxisRef = (0, vue_1.computed)(() => (verticalRef.value ? 'height' : 'width'));
|
|
119
|
+
// Carousel size
|
|
106
120
|
const perViewSizeRef = (0, vue_1.ref)({ width: 0, height: 0 });
|
|
107
121
|
const slideSizesRef = (0, vue_1.computed)(() => {
|
|
108
|
-
const { value: slidesEls } =
|
|
109
|
-
|
|
110
|
-
if (!length)
|
|
122
|
+
const { value: slidesEls } = slideElsRef;
|
|
123
|
+
if (!slidesEls.length)
|
|
111
124
|
return [];
|
|
112
|
-
|
|
125
|
+
const { value: autoSlideSize } = autoSlideSizeRef;
|
|
126
|
+
if (autoSlideSize) {
|
|
113
127
|
return slidesEls.map((slide) => (0, utils_1.calculateSize)(slide));
|
|
114
128
|
}
|
|
115
129
|
const { value: slidesPerView } = realSlidesPerViewRef;
|
|
116
130
|
const { value: perViewSize } = perViewSizeRef;
|
|
117
131
|
const { value: axis } = sizeAxisRef;
|
|
118
|
-
let
|
|
132
|
+
let axisSize = perViewSize[axis];
|
|
119
133
|
if (slidesPerView !== 'auto') {
|
|
120
134
|
const { spaceBetween } = props;
|
|
121
|
-
const remaining =
|
|
135
|
+
const remaining = axisSize - (slidesPerView - 1) * spaceBetween;
|
|
122
136
|
const percentage = 1 / Math.max(1, slidesPerView);
|
|
123
|
-
|
|
137
|
+
axisSize = remaining * percentage;
|
|
124
138
|
}
|
|
125
|
-
|
|
139
|
+
const slideSize = Object.assign(Object.assign({}, perViewSize), { [axis]: axisSize });
|
|
140
|
+
return slidesEls.map(() => slideSize);
|
|
126
141
|
});
|
|
127
142
|
// The translate required to reach each slide
|
|
128
143
|
const slideTranlatesRef = (0, vue_1.computed)(() => {
|
|
129
144
|
const { value: slideSizes } = slideSizesRef;
|
|
130
|
-
|
|
131
|
-
if (!length)
|
|
145
|
+
if (!slideSizes.length)
|
|
132
146
|
return [];
|
|
133
147
|
const { centeredSlides, spaceBetween } = props;
|
|
134
148
|
const { value: axis } = sizeAxisRef;
|
|
@@ -143,48 +157,58 @@ exports.default = (0, vue_1.defineComponent)({
|
|
|
143
157
|
return translate;
|
|
144
158
|
});
|
|
145
159
|
});
|
|
146
|
-
|
|
160
|
+
// Styles
|
|
161
|
+
const isMountedRef = (0, vue_1.ref)(false);
|
|
162
|
+
const transitionStyleRef = (0, vue_1.computed)(() => {
|
|
163
|
+
const { transitionStyle } = props;
|
|
164
|
+
return transitionStyle
|
|
165
|
+
? (0, _utils_1.keep)(transitionStyle, transitionProperties)
|
|
166
|
+
: {};
|
|
167
|
+
});
|
|
168
|
+
const speedRef = (0, vue_1.computed)(() => userWantsControlRef.value
|
|
169
|
+
? 0
|
|
170
|
+
: (0, utils_1.resolveSpeed)(transitionStyleRef.value.transitionDuration));
|
|
147
171
|
const slideStylesRef = (0, vue_1.computed)(() => {
|
|
148
|
-
const { value:
|
|
149
|
-
|
|
150
|
-
if (!length)
|
|
172
|
+
const { value: slidesEls } = slideElsRef;
|
|
173
|
+
if (!slidesEls.length)
|
|
151
174
|
return [];
|
|
152
|
-
const
|
|
153
|
-
|
|
175
|
+
const useComputedSize = !(autoSlideSizeRef.value || realSlidesPerViewRef.value === 1);
|
|
176
|
+
const getSlideSize = (index) => {
|
|
177
|
+
if (useComputedSize) {
|
|
178
|
+
const { value: axis } = sizeAxisRef;
|
|
179
|
+
return {
|
|
180
|
+
[axis]: `${slideSizesRef.value[index][axis]}px`
|
|
181
|
+
};
|
|
182
|
+
}
|
|
183
|
+
};
|
|
154
184
|
if (userWantsControlRef.value) {
|
|
155
|
-
|
|
156
|
-
|
|
157
|
-
|
|
185
|
+
// We center each slide when user wants to control the transition animation,
|
|
186
|
+
// so there is no need to calculate the offset
|
|
187
|
+
return slidesEls.map((_, i) => getSlideSize(i));
|
|
158
188
|
}
|
|
159
189
|
const { effect, spaceBetween } = props;
|
|
160
|
-
const { value:
|
|
161
|
-
|
|
162
|
-
|
|
163
|
-
|
|
164
|
-
|
|
165
|
-
const style = {
|
|
166
|
-
[axis]: `${size}px`,
|
|
167
|
-
[`margin-${spaceAxis}`]: `${spaceBetween}px`
|
|
168
|
-
};
|
|
169
|
-
if (isMounted && (effect === 'fade' || effect === 'card')) {
|
|
190
|
+
const { value: spaceAxis } = spaceAxisRef;
|
|
191
|
+
return slidesEls.reduce((styles, _, i) => {
|
|
192
|
+
const style = Object.assign(Object.assign({}, getSlideSize(i)), { [`margin-${spaceAxis}`]: `${spaceBetween}px` });
|
|
193
|
+
styles.push(style);
|
|
194
|
+
if (isMountedRef.value && (effect === 'fade' || effect === 'card')) {
|
|
170
195
|
Object.assign(style, transitionStyleRef.value);
|
|
171
196
|
}
|
|
172
|
-
|
|
173
|
-
}
|
|
174
|
-
return slideStyles;
|
|
197
|
+
return styles;
|
|
198
|
+
}, []);
|
|
175
199
|
});
|
|
176
200
|
// Total
|
|
177
201
|
const totalViewRef = (0, vue_1.computed)(() => {
|
|
178
202
|
const { value: slidesPerView } = displaySlidesPerViewRef;
|
|
179
|
-
const { length:
|
|
203
|
+
const { length: totalSlides } = slideElsRef.value;
|
|
180
204
|
if (slidesPerView !== 'auto') {
|
|
181
|
-
return
|
|
205
|
+
return Math.max(totalSlides - slidesPerView, 0) + 1;
|
|
182
206
|
}
|
|
183
207
|
else {
|
|
184
208
|
const { value: slideSizes } = slideSizesRef;
|
|
185
209
|
const { length } = slideSizes;
|
|
186
210
|
if (!length)
|
|
187
|
-
return
|
|
211
|
+
return totalSlides;
|
|
188
212
|
const { value: translates } = slideTranlatesRef;
|
|
189
213
|
const { value: axis } = sizeAxisRef;
|
|
190
214
|
const perViewSize = perViewSizeRef.value[axis];
|
|
@@ -194,59 +218,25 @@ exports.default = (0, vue_1.defineComponent)({
|
|
|
194
218
|
i--;
|
|
195
219
|
lastViewSize += translates[i] - translates[i - 1];
|
|
196
220
|
}
|
|
197
|
-
|
|
198
|
-
i++;
|
|
199
|
-
if (i < 1)
|
|
200
|
-
i = 1;
|
|
201
|
-
return i;
|
|
221
|
+
return (0, utils_1.clampValue)(i + 1, 1, length);
|
|
202
222
|
}
|
|
203
223
|
});
|
|
204
|
-
const displayTotalViewRef = (0, vue_1.computed)(() =>
|
|
205
|
-
const { value: totalView } = totalViewRef;
|
|
206
|
-
return duplicatedableRef.value && totalView > 3
|
|
207
|
-
? totalView - 2
|
|
208
|
-
: totalView;
|
|
209
|
-
});
|
|
224
|
+
const displayTotalViewRef = (0, vue_1.computed)(() => (0, utils_1.getDisplayTotalView)(totalViewRef.value, duplicatedableRef.value));
|
|
210
225
|
// Index
|
|
211
|
-
const
|
|
212
|
-
const
|
|
213
|
-
const
|
|
214
|
-
const realIndexRef = (0, vue_1.
|
|
215
|
-
// record the translate of each slide, so that it can be restored at touch
|
|
216
|
-
let previousTranslate = 0;
|
|
226
|
+
const defaultRealIndex = (0, utils_1.getRealIndex)(props.defaultIndex, duplicatedableRef.value);
|
|
227
|
+
const uncontrolledDisplayIndexRef = (0, vue_1.ref)((0, utils_1.getDisplayIndex)(defaultRealIndex, totalViewRef.value, duplicatedableRef.value));
|
|
228
|
+
const mergedDisplayIndexRef = (0, vooks_1.useMergedState)((0, vue_1.toRef)(props, 'currentIndex'), uncontrolledDisplayIndexRef);
|
|
229
|
+
const realIndexRef = (0, vue_1.computed)(() => (0, utils_1.getRealIndex)(mergedDisplayIndexRef.value, duplicatedableRef.value));
|
|
217
230
|
// Reality methods
|
|
218
|
-
function toRealIndex(index
|
|
231
|
+
function toRealIndex(index) {
|
|
219
232
|
var _a, _b;
|
|
220
|
-
|
|
221
|
-
|
|
222
|
-
|
|
223
|
-
|
|
224
|
-
|
|
225
|
-
|
|
226
|
-
|
|
227
|
-
index = 0;
|
|
228
|
-
}
|
|
229
|
-
else if (lastDisplayIndex === displayTotalViewRef.value - 1 &&
|
|
230
|
-
index === 1) {
|
|
231
|
-
index = length - 1;
|
|
232
|
-
}
|
|
233
|
-
}
|
|
234
|
-
const displayIndex = (displayIndexRef.value = (0, utils_1.getDisplayIndex)(index, totalViewRef.value, duplicatedableRef.value));
|
|
235
|
-
virtualIndexRef.value = index;
|
|
236
|
-
realIndexRef.value = (0, utils_1.getRealIndex)(displayIndex, duplicatedableRef.value);
|
|
237
|
-
if (translateableRef.value) {
|
|
238
|
-
translateTo(index, speed);
|
|
239
|
-
}
|
|
240
|
-
else {
|
|
241
|
-
if (!userWantsControlRef.value && speed > 0) {
|
|
242
|
-
inTransition = true;
|
|
243
|
-
}
|
|
244
|
-
fixTranslate();
|
|
245
|
-
}
|
|
246
|
-
if (displayIndex !== lastDisplayIndex) {
|
|
247
|
-
(_a = props['onUpdate:currentIndex']) === null || _a === void 0 ? void 0 : _a.call(props, displayIndex, lastDisplayIndex);
|
|
248
|
-
(_b = props.onUpdateCurrentIndex) === null || _b === void 0 ? void 0 : _b.call(props, displayIndex, lastDisplayIndex);
|
|
249
|
-
}
|
|
233
|
+
index = (0, utils_1.clampValue)(index, 0, totalViewRef.value - 1);
|
|
234
|
+
const displayIndex = (0, utils_1.getDisplayIndex)(index, totalViewRef.value, duplicatedableRef.value);
|
|
235
|
+
const { value: lastDisplayIndex } = mergedDisplayIndexRef;
|
|
236
|
+
if (displayIndex !== mergedDisplayIndexRef.value) {
|
|
237
|
+
uncontrolledDisplayIndexRef.value = displayIndex;
|
|
238
|
+
(_a = props['onUpdate:currentIndex']) === null || _a === void 0 ? void 0 : _a.call(props, displayIndex, lastDisplayIndex);
|
|
239
|
+
(_b = props.onUpdateCurrentIndex) === null || _b === void 0 ? void 0 : _b.call(props, displayIndex, lastDisplayIndex);
|
|
250
240
|
}
|
|
251
241
|
}
|
|
252
242
|
function getRealPrevIndex(index = realIndexRef.value) {
|
|
@@ -269,7 +259,7 @@ exports.default = (0, vue_1.defineComponent)({
|
|
|
269
259
|
// Display methods
|
|
270
260
|
// They are used to deal with the actual values displayed on the UI
|
|
271
261
|
function isDisplayActive(index) {
|
|
272
|
-
return
|
|
262
|
+
return mergedDisplayIndexRef.value === index;
|
|
273
263
|
}
|
|
274
264
|
function isPrevDisabled() {
|
|
275
265
|
return getRealPrevIndex() === null;
|
|
@@ -277,52 +267,63 @@ exports.default = (0, vue_1.defineComponent)({
|
|
|
277
267
|
function isNextDisabled() {
|
|
278
268
|
return getRealNextIndex() === null;
|
|
279
269
|
}
|
|
280
|
-
//
|
|
270
|
+
// To
|
|
281
271
|
function to(index) {
|
|
282
|
-
const realIndex = (0, utils_1.getRealIndex)(index, duplicatedableRef.value);
|
|
283
|
-
if (index !==
|
|
272
|
+
const realIndex = (0, utils_1.clampValue)((0, utils_1.getRealIndex)(index, duplicatedableRef.value), 0, totalViewRef.value);
|
|
273
|
+
if (index !== mergedDisplayIndexRef.value ||
|
|
274
|
+
realIndex !== realIndexRef.value) {
|
|
284
275
|
toRealIndex(realIndex);
|
|
285
276
|
}
|
|
286
277
|
}
|
|
287
278
|
function prev() {
|
|
288
279
|
const prevIndex = getRealPrevIndex();
|
|
289
|
-
if (prevIndex !== null)
|
|
280
|
+
if (prevIndex !== null)
|
|
290
281
|
toRealIndex(prevIndex);
|
|
291
|
-
}
|
|
292
282
|
}
|
|
293
283
|
function next() {
|
|
294
284
|
const nextIndex = getRealNextIndex();
|
|
295
|
-
if (nextIndex !== null)
|
|
285
|
+
if (nextIndex !== null)
|
|
296
286
|
toRealIndex(nextIndex);
|
|
297
|
-
|
|
287
|
+
}
|
|
288
|
+
function prevIfSlideTransitionEnd() {
|
|
289
|
+
if (!inTransition || !duplicatedableRef.value)
|
|
290
|
+
prev();
|
|
291
|
+
}
|
|
292
|
+
function nextIfSlideTransitionEnd() {
|
|
293
|
+
if (!inTransition || !duplicatedableRef.value)
|
|
294
|
+
next();
|
|
298
295
|
}
|
|
299
296
|
// Translate to
|
|
300
|
-
const translateStyleRef = (0, vue_1.ref)({});
|
|
301
297
|
let inTransition = false;
|
|
298
|
+
// record the translate of each slide, so that it can be restored at touch
|
|
299
|
+
let previousTranslate = 0;
|
|
300
|
+
const translateStyleRef = (0, vue_1.ref)({});
|
|
302
301
|
function updateTranslate(translate, speed = 0) {
|
|
303
|
-
const isVersical = props.direction === 'vertical';
|
|
304
302
|
translateStyleRef.value = Object.assign({}, transitionStyleRef.value, {
|
|
305
|
-
transform:
|
|
303
|
+
transform: verticalRef.value
|
|
306
304
|
? `translateY(${-translate}px)`
|
|
307
305
|
: `translateX(${-translate}px)`,
|
|
308
306
|
transitionDuration: `${speed}ms`
|
|
309
307
|
});
|
|
310
308
|
}
|
|
311
309
|
function fixTranslate(speed = 0) {
|
|
312
|
-
if (
|
|
310
|
+
if (sequenceLayoutRef.value) {
|
|
313
311
|
translateTo(realIndexRef.value, speed);
|
|
314
312
|
}
|
|
315
313
|
else if (previousTranslate !== 0) {
|
|
314
|
+
if (!inTransition && speed > 0) {
|
|
315
|
+
inTransition = true;
|
|
316
|
+
}
|
|
316
317
|
updateTranslate((previousTranslate = 0), speed);
|
|
317
318
|
}
|
|
318
319
|
}
|
|
319
|
-
function translateTo(index, speed
|
|
320
|
+
function translateTo(index, speed) {
|
|
320
321
|
const translate = getTranslate(index);
|
|
321
322
|
if (translate !== previousTranslate && speed > 0) {
|
|
322
323
|
inTransition = true;
|
|
323
324
|
}
|
|
324
|
-
updateTranslate(translate, speed);
|
|
325
325
|
previousTranslate = getTranslate(realIndexRef.value);
|
|
326
|
+
updateTranslate(translate, speed);
|
|
326
327
|
}
|
|
327
328
|
function getTranslate(index) {
|
|
328
329
|
let translate;
|
|
@@ -358,37 +359,63 @@ exports.default = (0, vue_1.defineComponent)({
|
|
|
358
359
|
}
|
|
359
360
|
}
|
|
360
361
|
// Provide
|
|
362
|
+
const carouselContext = {
|
|
363
|
+
currentIndexRef: mergedDisplayIndexRef,
|
|
364
|
+
to,
|
|
365
|
+
prev: prevIfSlideTransitionEnd,
|
|
366
|
+
next: nextIfSlideTransitionEnd,
|
|
367
|
+
isVertical: () => verticalRef.value,
|
|
368
|
+
isHorizontal: () => !verticalRef.value,
|
|
369
|
+
isPrev: isRealPrev,
|
|
370
|
+
isNext: isRealNext,
|
|
371
|
+
isActive: isRealActive,
|
|
372
|
+
isPrevDisabled,
|
|
373
|
+
isNextDisabled,
|
|
374
|
+
getSlideIndex,
|
|
375
|
+
getSlideStyle,
|
|
376
|
+
addSlide,
|
|
377
|
+
removeSlide,
|
|
378
|
+
onCarouselItemClick
|
|
379
|
+
};
|
|
380
|
+
(0, CarouselContext_1.provideCarouselContext)(carouselContext);
|
|
361
381
|
function addSlide(slide) {
|
|
362
382
|
if (!slide)
|
|
363
383
|
return;
|
|
364
|
-
|
|
384
|
+
slideElsRef.value.push(slide);
|
|
365
385
|
}
|
|
366
386
|
function removeSlide(slide) {
|
|
367
387
|
if (!slide)
|
|
368
388
|
return;
|
|
369
389
|
const index = getSlideIndex(slide);
|
|
370
390
|
if (index !== -1) {
|
|
371
|
-
|
|
391
|
+
slideElsRef.value.splice(index, 1);
|
|
372
392
|
}
|
|
373
393
|
}
|
|
374
394
|
function getSlideIndex(slideOrIndex) {
|
|
375
395
|
return typeof slideOrIndex === 'number'
|
|
376
396
|
? slideOrIndex
|
|
377
|
-
:
|
|
397
|
+
: slideOrIndex
|
|
398
|
+
? slideElsRef.value.indexOf(slideOrIndex)
|
|
399
|
+
: -1;
|
|
378
400
|
}
|
|
379
401
|
function getSlideStyle(slide) {
|
|
380
402
|
const index = getSlideIndex(slide);
|
|
381
403
|
if (index !== -1) {
|
|
382
|
-
|
|
404
|
+
const styles = [slideStylesRef.value[index]];
|
|
405
|
+
const isPrev = carouselContext.isPrev(index);
|
|
406
|
+
const isNext = carouselContext.isNext(index);
|
|
407
|
+
if (isPrev) {
|
|
408
|
+
styles.push(props.prevSlideStyle || '');
|
|
409
|
+
}
|
|
410
|
+
if (isNext) {
|
|
411
|
+
styles.push(props.nextSlideStyle || '');
|
|
412
|
+
}
|
|
413
|
+
return (0, vue_1.normalizeStyle)(styles);
|
|
383
414
|
}
|
|
384
415
|
}
|
|
385
416
|
function onCarouselItemClick(index, event) {
|
|
386
|
-
|
|
387
|
-
|
|
388
|
-
if (props.effect === 'card' &&
|
|
389
|
-
!userWantsControlRef.value &&
|
|
390
|
-
!(dragStatus & 8 /* SUCCESS */) &&
|
|
391
|
-
!isRealActive(index)) {
|
|
417
|
+
let allowClick = !inTransition && !dragging && !isEffectiveDrag;
|
|
418
|
+
if (props.effect === 'card' && allowClick && !isRealActive(index)) {
|
|
392
419
|
to(index);
|
|
393
420
|
allowClick = false;
|
|
394
421
|
}
|
|
@@ -397,54 +424,19 @@ exports.default = (0, vue_1.defineComponent)({
|
|
|
397
424
|
event.stopPropagation();
|
|
398
425
|
}
|
|
399
426
|
}
|
|
400
|
-
const carouselMethods = {
|
|
401
|
-
to,
|
|
402
|
-
prev: () => {
|
|
403
|
-
// wait transition end
|
|
404
|
-
if (!inTransition || !duplicatedableRef.value)
|
|
405
|
-
prev();
|
|
406
|
-
},
|
|
407
|
-
next: () => {
|
|
408
|
-
// wait transition end
|
|
409
|
-
if (!inTransition || !duplicatedableRef.value)
|
|
410
|
-
next();
|
|
411
|
-
},
|
|
412
|
-
isVertical: () => verticalRef.value,
|
|
413
|
-
isHorizontal: () => !verticalRef.value,
|
|
414
|
-
isPrev: isRealPrev,
|
|
415
|
-
isNext: isRealNext,
|
|
416
|
-
isActive: isRealActive,
|
|
417
|
-
isPrevDisabled,
|
|
418
|
-
isNextDisabled,
|
|
419
|
-
getCurrentIndex: () => displayIndexRef.value,
|
|
420
|
-
getSlideIndex,
|
|
421
|
-
getSlideStyle,
|
|
422
|
-
addSlide,
|
|
423
|
-
removeSlide,
|
|
424
|
-
onCarouselItemClick,
|
|
425
|
-
prevSlideStyleRef: (0, vue_1.toRef)(props, 'prevSlideStyle'),
|
|
426
|
-
nextSlideStyleRef: (0, vue_1.toRef)(props, 'nextSlideStyle')
|
|
427
|
-
};
|
|
428
|
-
(0, vue_1.provide)(interface_1.carouselMethodsInjectionKey, carouselMethods);
|
|
429
427
|
// Autoplay
|
|
430
428
|
let autoplayTimer = null;
|
|
431
|
-
function
|
|
429
|
+
function stopAutoplay() {
|
|
432
430
|
if (autoplayTimer) {
|
|
433
431
|
clearInterval(autoplayTimer);
|
|
434
432
|
autoplayTimer = null;
|
|
435
433
|
}
|
|
436
|
-
const { autoplay, interval } = props;
|
|
437
|
-
if (autoplay && interval && !cleanOnly) {
|
|
438
|
-
autoplayTimer = window.setInterval(next, interval);
|
|
439
|
-
}
|
|
440
434
|
}
|
|
441
|
-
function
|
|
442
|
-
|
|
443
|
-
|
|
444
|
-
|
|
445
|
-
|
|
446
|
-
else if (displayTotalViewRef.value < 2) {
|
|
447
|
-
resetAutoplay(true);
|
|
435
|
+
function resetAutoplay() {
|
|
436
|
+
stopAutoplay();
|
|
437
|
+
const disabled = !props.autoplay || displayTotalViewRef.value < 2;
|
|
438
|
+
if (!disabled) {
|
|
439
|
+
autoplayTimer = window.setInterval(next, props.interval);
|
|
448
440
|
}
|
|
449
441
|
}
|
|
450
442
|
// Drag
|
|
@@ -452,14 +444,19 @@ exports.default = (0, vue_1.defineComponent)({
|
|
|
452
444
|
let dragStartY = 0;
|
|
453
445
|
let dragOffset = 0;
|
|
454
446
|
let dragStartTime = 0;
|
|
455
|
-
let
|
|
447
|
+
let dragging = false;
|
|
448
|
+
let isEffectiveDrag = false;
|
|
456
449
|
function handleTouchstart(event) {
|
|
450
|
+
var _a;
|
|
457
451
|
if (globalDragging)
|
|
458
452
|
return;
|
|
459
|
-
|
|
460
|
-
|
|
453
|
+
if (!((_a = slidesElRef.value) === null || _a === void 0 ? void 0 : _a.contains(event.target)))
|
|
454
|
+
return;
|
|
461
455
|
globalDragging = true;
|
|
462
|
-
|
|
456
|
+
dragging = true;
|
|
457
|
+
isEffectiveDrag = false;
|
|
458
|
+
dragStartTime = Date.now();
|
|
459
|
+
stopAutoplay();
|
|
463
460
|
if (event.type !== 'touchstart' &&
|
|
464
461
|
!event.target.isContentEditable) {
|
|
465
462
|
event.preventDefault();
|
|
@@ -472,7 +469,7 @@ exports.default = (0, vue_1.defineComponent)({
|
|
|
472
469
|
dragStartX = touchEvent.clientX;
|
|
473
470
|
}
|
|
474
471
|
if (props.touchable) {
|
|
475
|
-
(0, evtd_1.on)('touchmove', document, handleTouchmove);
|
|
472
|
+
(0, evtd_1.on)('touchmove', document, handleTouchmove, { passive: true });
|
|
476
473
|
(0, evtd_1.on)('touchend', document, handleTouchend);
|
|
477
474
|
(0, evtd_1.on)('touchcancel', document, handleTouchend);
|
|
478
475
|
}
|
|
@@ -483,25 +480,24 @@ exports.default = (0, vue_1.defineComponent)({
|
|
|
483
480
|
}
|
|
484
481
|
function handleTouchmove(event) {
|
|
485
482
|
const { value: vertical } = verticalRef;
|
|
486
|
-
const
|
|
487
|
-
const perViewSize = perViewSizeRef.value[axis];
|
|
483
|
+
const { value: axis } = sizeAxisRef;
|
|
488
484
|
const touchEvent = (0, utils_1.isTouchEvent)(event) ? event.touches[0] : event;
|
|
489
485
|
const offset = vertical
|
|
490
486
|
? touchEvent.clientY - dragStartY
|
|
491
487
|
: touchEvent.clientX - dragStartX;
|
|
488
|
+
const perViewSize = perViewSizeRef.value[axis];
|
|
492
489
|
dragOffset = (0, utils_1.clampValue)(offset, -perViewSize, perViewSize);
|
|
493
|
-
|
|
494
|
-
|
|
490
|
+
if (event.cancelable) {
|
|
491
|
+
event.preventDefault();
|
|
492
|
+
}
|
|
493
|
+
if (sequenceLayoutRef.value) {
|
|
495
494
|
updateTranslate(previousTranslate - dragOffset, 0);
|
|
496
495
|
}
|
|
497
496
|
}
|
|
498
497
|
function handleTouchend() {
|
|
499
|
-
const duration = Date.now() - dragStartTime;
|
|
500
|
-
const { value: axis } = sizeAxisRef;
|
|
501
498
|
const { value: realIndex } = realIndexRef;
|
|
502
|
-
const { value: translateable } = translateableRef;
|
|
503
499
|
let currentIndex = realIndex;
|
|
504
|
-
if (!inTransition &&
|
|
500
|
+
if (!inTransition && dragOffset !== 0 && sequenceLayoutRef.value) {
|
|
505
501
|
const currentTranslate = previousTranslate - dragOffset;
|
|
506
502
|
const translates = [
|
|
507
503
|
...slideTranlatesRef.value.slice(0, totalViewRef.value - 1),
|
|
@@ -518,39 +514,39 @@ exports.default = (0, vue_1.defineComponent)({
|
|
|
518
514
|
}
|
|
519
515
|
}
|
|
520
516
|
if (currentIndex === realIndex) {
|
|
517
|
+
const timeElapsed = Date.now() - dragStartTime;
|
|
518
|
+
const { value: axis } = sizeAxisRef;
|
|
521
519
|
const perViewSize = perViewSizeRef.value[axis];
|
|
522
520
|
// more than 50% width or faster than 0.4px per ms
|
|
523
|
-
if (dragOffset > perViewSize / 2 || dragOffset /
|
|
521
|
+
if (dragOffset > perViewSize / 2 || dragOffset / timeElapsed > 0.4) {
|
|
524
522
|
currentIndex = getRealPrevIndex(realIndex);
|
|
525
523
|
}
|
|
526
524
|
else if (dragOffset < -perViewSize / 2 ||
|
|
527
|
-
dragOffset /
|
|
525
|
+
dragOffset / timeElapsed < -0.4) {
|
|
528
526
|
currentIndex = getRealNextIndex(realIndex);
|
|
529
527
|
}
|
|
530
528
|
}
|
|
531
529
|
if (currentIndex !== null && currentIndex !== realIndex) {
|
|
532
|
-
|
|
530
|
+
isEffectiveDrag = true;
|
|
533
531
|
toRealIndex(currentIndex);
|
|
532
|
+
void (0, vue_1.nextTick)(() => {
|
|
533
|
+
if (!duplicatedableRef.value ||
|
|
534
|
+
uncontrolledDisplayIndexRef.value !== mergedDisplayIndexRef.value) {
|
|
535
|
+
fixTranslate(speedRef.value);
|
|
536
|
+
}
|
|
537
|
+
});
|
|
534
538
|
}
|
|
535
539
|
else {
|
|
536
|
-
if (dragStatus & 4 /* PROGRESS */) {
|
|
537
|
-
dragStatus = 16 /* FAIL */;
|
|
538
|
-
}
|
|
539
|
-
else {
|
|
540
|
-
dragStatus = 32 /* END */;
|
|
541
|
-
}
|
|
542
540
|
fixTranslate(speedRef.value);
|
|
543
541
|
}
|
|
544
|
-
mesureAutoplay();
|
|
545
542
|
resetDragStatus();
|
|
543
|
+
resetAutoplay();
|
|
546
544
|
}
|
|
547
545
|
function resetDragStatus() {
|
|
548
|
-
if (
|
|
546
|
+
if (dragging) {
|
|
549
547
|
globalDragging = false;
|
|
550
|
-
if (dragStatus & (2 /* START */ | 4 /* PROGRESS */)) {
|
|
551
|
-
dragStatus = 1 /* NORMAL */;
|
|
552
|
-
}
|
|
553
548
|
}
|
|
549
|
+
dragging = false;
|
|
554
550
|
dragStartX = 0;
|
|
555
551
|
dragStartY = 0;
|
|
556
552
|
dragOffset = 0;
|
|
@@ -562,15 +558,14 @@ exports.default = (0, vue_1.defineComponent)({
|
|
|
562
558
|
(0, evtd_1.off)('mouseup', document, handleTouchend);
|
|
563
559
|
}
|
|
564
560
|
function handleTransitionEnd() {
|
|
565
|
-
|
|
566
|
-
|
|
567
|
-
if (inTransition && virtualIndex !== realIndex) {
|
|
561
|
+
if (sequenceLayoutRef.value && inTransition) {
|
|
562
|
+
const { value: realIndex } = realIndexRef;
|
|
568
563
|
translateTo(realIndex, 0);
|
|
569
564
|
}
|
|
570
565
|
else {
|
|
571
566
|
resetAutoplay();
|
|
572
567
|
}
|
|
573
|
-
if (
|
|
568
|
+
if (sequenceLayoutRef.value) {
|
|
574
569
|
translateStyleRef.value.transitionDuration = '0ms';
|
|
575
570
|
}
|
|
576
571
|
inTransition = false;
|
|
@@ -579,28 +574,27 @@ exports.default = (0, vue_1.defineComponent)({
|
|
|
579
574
|
event.preventDefault();
|
|
580
575
|
if (inTransition)
|
|
581
576
|
return;
|
|
582
|
-
const { value: vertical } = verticalRef;
|
|
583
577
|
let { deltaX, deltaY } = event;
|
|
584
578
|
if (event.shiftKey && !deltaX) {
|
|
585
579
|
deltaX = deltaY;
|
|
586
580
|
}
|
|
587
|
-
const
|
|
588
|
-
const
|
|
589
|
-
const
|
|
581
|
+
const prevMultiplier = -1;
|
|
582
|
+
const nextMultiplier = 1;
|
|
583
|
+
const m = (deltaX || deltaY) > 0 ? nextMultiplier : prevMultiplier;
|
|
590
584
|
let rx = 0;
|
|
591
585
|
let ry = 0;
|
|
592
|
-
if (
|
|
593
|
-
ry =
|
|
586
|
+
if (verticalRef.value) {
|
|
587
|
+
ry = m;
|
|
594
588
|
}
|
|
595
589
|
else {
|
|
596
|
-
rx =
|
|
590
|
+
rx = m;
|
|
597
591
|
}
|
|
598
|
-
const
|
|
599
|
-
if (ry * deltaY >=
|
|
600
|
-
if (
|
|
592
|
+
const responseStep = 10;
|
|
593
|
+
if (ry * deltaY >= responseStep || rx * deltaX >= responseStep) {
|
|
594
|
+
if (m === nextMultiplier && !isNextDisabled()) {
|
|
601
595
|
next();
|
|
602
596
|
}
|
|
603
|
-
else if (
|
|
597
|
+
else if (m === prevMultiplier && !isPrevDisabled()) {
|
|
604
598
|
prev();
|
|
605
599
|
}
|
|
606
600
|
}
|
|
@@ -616,17 +610,27 @@ exports.default = (0, vue_1.defineComponent)({
|
|
|
616
610
|
slideSizesRef.effect.run();
|
|
617
611
|
}
|
|
618
612
|
}
|
|
613
|
+
function handleMouseenter() {
|
|
614
|
+
if (props.autoplay) {
|
|
615
|
+
stopAutoplay();
|
|
616
|
+
}
|
|
617
|
+
}
|
|
618
|
+
function handleMouseleave() {
|
|
619
|
+
if (props.autoplay) {
|
|
620
|
+
resetAutoplay();
|
|
621
|
+
}
|
|
622
|
+
}
|
|
619
623
|
(0, vue_1.onMounted)(() => {
|
|
620
|
-
(0, vue_1.watchEffect)(
|
|
621
|
-
|
|
624
|
+
(0, vue_1.watchEffect)(resetAutoplay);
|
|
625
|
+
requestAnimationFrame(() => (isMountedRef.value = true));
|
|
622
626
|
});
|
|
623
627
|
(0, vue_1.onBeforeUnmount)(() => {
|
|
624
628
|
resetDragStatus();
|
|
625
|
-
|
|
629
|
+
stopAutoplay();
|
|
626
630
|
});
|
|
627
631
|
// Fix index when remounting
|
|
628
632
|
(0, vue_1.onUpdated)(() => {
|
|
629
|
-
const { value: slidesEls } =
|
|
633
|
+
const { value: slidesEls } = slideElsRef;
|
|
630
634
|
const { value: slideVNodes } = slideVNodesRef;
|
|
631
635
|
const indexMap = new Map();
|
|
632
636
|
const getDisplayIndex = (el) =>
|
|
@@ -644,12 +648,31 @@ exports.default = (0, vue_1.defineComponent)({
|
|
|
644
648
|
slidesEls.sort((a, b) => getDisplayIndex(a) - getDisplayIndex(b));
|
|
645
649
|
}
|
|
646
650
|
});
|
|
647
|
-
(0, vue_1.watch)(
|
|
648
|
-
|
|
649
|
-
|
|
651
|
+
(0, vue_1.watch)(realIndexRef, (realIndex, lastRealIndex) => {
|
|
652
|
+
if (realIndex === lastRealIndex)
|
|
653
|
+
return;
|
|
654
|
+
resetAutoplay();
|
|
655
|
+
if (sequenceLayoutRef.value) {
|
|
656
|
+
if (duplicatedableRef.value) {
|
|
657
|
+
const { value: length } = totalViewRef;
|
|
658
|
+
if (realIndex === length - 2 && lastRealIndex === 1) {
|
|
659
|
+
realIndex = 0;
|
|
660
|
+
}
|
|
661
|
+
else if (realIndex === 1 && lastRealIndex === length - 2) {
|
|
662
|
+
realIndex = length - 1;
|
|
663
|
+
}
|
|
664
|
+
}
|
|
665
|
+
translateTo(realIndex, speedRef.value);
|
|
666
|
+
}
|
|
667
|
+
else {
|
|
668
|
+
fixTranslate();
|
|
669
|
+
}
|
|
670
|
+
}, { immediate: true });
|
|
671
|
+
(0, vue_1.watch)([duplicatedableRef, displaySlidesPerViewRef], () => void (0, vue_1.nextTick)(() => toRealIndex(realIndexRef.value)));
|
|
672
|
+
(0, vue_1.watch)(slideTranlatesRef, () => sequenceLayoutRef.value && fixTranslate(), {
|
|
650
673
|
deep: true
|
|
651
674
|
});
|
|
652
|
-
(0, vue_1.watch)(
|
|
675
|
+
(0, vue_1.watch)(sequenceLayoutRef, (value) => {
|
|
653
676
|
if (!value) {
|
|
654
677
|
inTransition = false;
|
|
655
678
|
// if the current mode does not support translate, reset the position of the wrapper
|
|
@@ -659,22 +682,27 @@ exports.default = (0, vue_1.defineComponent)({
|
|
|
659
682
|
fixTranslate();
|
|
660
683
|
}
|
|
661
684
|
});
|
|
662
|
-
const
|
|
663
|
-
|
|
664
|
-
|
|
665
|
-
|
|
666
|
-
|
|
667
|
-
|
|
668
|
-
|
|
669
|
-
|
|
670
|
-
|
|
671
|
-
|
|
672
|
-
|
|
673
|
-
|
|
674
|
-
|
|
675
|
-
};
|
|
685
|
+
const slidesControlListenersRef = (0, vue_1.computed)(() => {
|
|
686
|
+
return {
|
|
687
|
+
onTouchstartPassive: props.touchable ? handleTouchstart : undefined,
|
|
688
|
+
onMousedown: props.draggable ? handleTouchstart : undefined,
|
|
689
|
+
onWheel: props.mousewheel ? handleMousewheel : undefined
|
|
690
|
+
};
|
|
691
|
+
});
|
|
692
|
+
const arrowSlotPropsRef = (0, vue_1.computed)(() => (Object.assign(Object.assign({}, (0, _utils_1.keep)(carouselContext, [
|
|
693
|
+
'to',
|
|
694
|
+
'prev',
|
|
695
|
+
'next',
|
|
696
|
+
'isPrevDisabled',
|
|
697
|
+
'isNextDisabled'
|
|
698
|
+
])), { total: displayTotalViewRef.value, currentIndex: mergedDisplayIndexRef.value })));
|
|
699
|
+
const dotSlotPropsRef = (0, vue_1.computed)(() => ({
|
|
700
|
+
total: displayTotalViewRef.value,
|
|
701
|
+
currentIndex: mergedDisplayIndexRef.value,
|
|
702
|
+
to: carouselContext.to
|
|
703
|
+
}));
|
|
676
704
|
const caroulseExposedMethod = {
|
|
677
|
-
getCurrentIndex: () =>
|
|
705
|
+
getCurrentIndex: () => mergedDisplayIndexRef.value,
|
|
678
706
|
to: to,
|
|
679
707
|
prev: prev,
|
|
680
708
|
next: next
|
|
@@ -696,15 +724,16 @@ exports.default = (0, vue_1.defineComponent)({
|
|
|
696
724
|
const themeClassHandle = inlineThemeDisabled
|
|
697
725
|
? (0, _mixins_1.useThemeClass)('carousel', undefined, cssVarsRef, props)
|
|
698
726
|
: undefined;
|
|
699
|
-
return Object.assign(Object.assign(
|
|
700
|
-
handleTransitionEnd,
|
|
701
|
-
handleMousewheel,
|
|
727
|
+
return Object.assign(Object.assign({ mergedClsPrefix: mergedClsPrefixRef, selfElRef,
|
|
728
|
+
slidesElRef, slideVNodes: slideVNodesRef, duplicatedable: duplicatedableRef, userWantsControl: userWantsControlRef, autoSlideSize: autoSlideSizeRef, displayIndex: mergedDisplayIndexRef, realIndex: realIndexRef, slideStyles: slideStylesRef, translateStyle: translateStyleRef, slidesControlListeners: slidesControlListenersRef, handleTransitionEnd,
|
|
702
729
|
handleResize,
|
|
703
|
-
handleSlideResize,
|
|
730
|
+
handleSlideResize,
|
|
731
|
+
handleMouseenter,
|
|
732
|
+
handleMouseleave, isActive: isDisplayActive, arrowSlotProps: arrowSlotPropsRef, dotSlotProps: dotSlotPropsRef }, caroulseExposedMethod), { cssVars: inlineThemeDisabled ? undefined : cssVarsRef, themeClass: themeClassHandle === null || themeClassHandle === void 0 ? void 0 : themeClassHandle.themeClass, onRender: themeClassHandle === null || themeClassHandle === void 0 ? void 0 : themeClassHandle.onRender });
|
|
704
733
|
},
|
|
705
734
|
render() {
|
|
706
735
|
var _a;
|
|
707
|
-
const { mergedClsPrefix, showArrow, userWantsControl,
|
|
736
|
+
const { mergedClsPrefix, showArrow, userWantsControl, slideStyles, dotType, dotPlacement, slidesControlListeners, transitionProps = {}, arrowSlotProps, dotSlotProps, $slots: { default: defaultSlot, dots: dotsSlot, arrow: arrowSlot } } = this;
|
|
708
737
|
const children = (defaultSlot && (0, _utils_1.flatten)(defaultSlot())) || [];
|
|
709
738
|
let slides = filterCarouselItem(children);
|
|
710
739
|
if (!slides.length) {
|
|
@@ -712,10 +741,8 @@ exports.default = (0, vue_1.defineComponent)({
|
|
|
712
741
|
default: () => (0, vue_1.cloneVNode)(ch)
|
|
713
742
|
})));
|
|
714
743
|
}
|
|
715
|
-
|
|
716
|
-
|
|
717
|
-
slides.push(duplicateSlide(slides[0], 0, 'append'));
|
|
718
|
-
slides.unshift(duplicateSlide(slides[realLength - 1], realLength - 1, 'prepend'));
|
|
744
|
+
if (this.duplicatedable) {
|
|
745
|
+
slides = (0, utils_1.addDuplicateSlides)(slides);
|
|
719
746
|
}
|
|
720
747
|
this.slideVNodes.value = slides;
|
|
721
748
|
// When users need to customize the size of the slide,
|
|
@@ -726,7 +753,7 @@ exports.default = (0, vue_1.defineComponent)({
|
|
|
726
753
|
})));
|
|
727
754
|
}
|
|
728
755
|
(_a = this.onRender) === null || _a === void 0 ? void 0 : _a.call(this);
|
|
729
|
-
return ((0, vue_1.h)("div", { ref: "selfElRef", class: [
|
|
756
|
+
return ((0, vue_1.h)("div", Object.assign({ ref: "selfElRef", class: [
|
|
730
757
|
this.themeClass,
|
|
731
758
|
`${mergedClsPrefix}-carousel`,
|
|
732
759
|
this.direction === 'vertical' &&
|
|
@@ -736,17 +763,18 @@ exports.default = (0, vue_1.defineComponent)({
|
|
|
736
763
|
`${mergedClsPrefix}-carousel--${this.direction}`,
|
|
737
764
|
`${mergedClsPrefix}-carousel--${this.effect}`,
|
|
738
765
|
userWantsControl && `${mergedClsPrefix}-carousel--usercontrol`
|
|
739
|
-
], style: this.cssVars },
|
|
766
|
+
], style: this.cssVars }, slidesControlListeners, { onMouseenter: this.handleMouseenter, onMouseleave: this.handleMouseleave }),
|
|
740
767
|
(0, vue_1.h)(vueuc_1.VResizeObserver, { onResize: this.handleResize }, {
|
|
741
|
-
default: () => ((0, vue_1.h)("div", { class: `${mergedClsPrefix}-carousel__slides`, role: "listbox", style: this.translateStyle,
|
|
768
|
+
default: () => ((0, vue_1.h)("div", { ref: "slidesElRef", class: `${mergedClsPrefix}-carousel__slides`, role: "listbox", style: this.translateStyle, onTransitionend: this.handleTransitionEnd }, userWantsControl
|
|
742
769
|
? slides.map((slide, i) => ((0, vue_1.h)("div", { style: slideStyles[i], key: i }, (0, vue_1.withDirectives)((0, vue_1.h)(vue_1.Transition, Object.assign({}, transitionProps), {
|
|
743
770
|
default: () => slide
|
|
744
771
|
}), [[vue_1.vShow, this.isActive(i)]]))))
|
|
745
772
|
: slides))
|
|
746
773
|
}),
|
|
747
774
|
this.showDots &&
|
|
775
|
+
dotSlotProps.total > 1 &&
|
|
748
776
|
(0, _utils_1.resolveSlotWithProps)(dotsSlot, dotSlotProps, () => [
|
|
749
|
-
|
|
777
|
+
(0, vue_1.h)(CarouselDots_1.default, { key: dotType + dotPlacement, total: dotSlotProps.total, currentIndex: dotSlotProps.currentIndex, dotType: dotType, trigger: this.trigger, keyboard: this.keyboard })
|
|
750
778
|
]),
|
|
751
779
|
showArrow &&
|
|
752
780
|
(0, _utils_1.resolveSlotWithProps)(arrowSlot, arrowSlotProps, () => [
|
|
@@ -754,19 +782,11 @@ exports.default = (0, vue_1.defineComponent)({
|
|
|
754
782
|
])));
|
|
755
783
|
}
|
|
756
784
|
});
|
|
757
|
-
function filterCarouselItem(vnodes
|
|
758
|
-
|
|
759
|
-
|
|
760
|
-
|
|
761
|
-
|
|
762
|
-
|
|
763
|
-
|
|
764
|
-
}
|
|
765
|
-
return carouselItems;
|
|
766
|
-
}
|
|
767
|
-
function duplicateSlide(child, index, position) {
|
|
768
|
-
return (0, vue_1.cloneVNode)(child, {
|
|
769
|
-
// for patch
|
|
770
|
-
key: `carousel-item-duplicate-${index}-${position}`
|
|
771
|
-
});
|
|
785
|
+
function filterCarouselItem(vnodes) {
|
|
786
|
+
return vnodes.reduce((carouselItems, vnode) => {
|
|
787
|
+
if ((0, CarouselItem_1.isCarouselItem)(vnode)) {
|
|
788
|
+
carouselItems.push(vnode);
|
|
789
|
+
}
|
|
790
|
+
return carouselItems;
|
|
791
|
+
}, []);
|
|
772
792
|
}
|