naive-ui 2.41.1 → 2.43.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 +3349 -1068
- package/dist/index.mjs +3339 -1070
- package/dist/index.prod.js +1 -1
- package/dist/index.prod.mjs +1 -1
- package/es/_internal/icon/src/styles/index.cssr.mjs +0 -1
- package/es/_internal/icons/replaceable.mjs +1 -1
- package/es/_internal/scrollbar/src/Scrollbar.d.ts +3 -3
- package/es/_internal/select-menu/src/SelectMenu.d.ts +4 -4
- package/es/_internal/selection/src/Selection.d.ts +115 -13
- package/es/_internal/selection/styles/light.d.ts +14 -1
- package/es/_mixins/use-theme.mjs +1 -1
- package/es/_utils/index.d.ts +1 -0
- package/es/_utils/naive/prop.d.ts +19 -10
- package/es/_utils/naive/prop.mjs +21 -21
- package/es/_utils/ts/ts.d.ts +3 -0
- package/es/alert/src/Alert.d.ts +2 -2
- package/es/anchor/index.d.ts +1 -0
- package/es/anchor/src/AnchorAdapter.d.ts +1 -1
- package/es/anchor/src/BaseAnchor.mjs +29 -5
- package/es/anchor/src/Link.d.ts +3 -2
- package/es/anchor/src/Link.mjs +5 -2
- package/es/anchor/src/public-types.d.ts +5 -0
- package/es/anchor/src/public-types.mjs +1 -0
- package/es/auto-complete/src/AutoComplete.d.ts +155 -14
- package/es/auto-complete/styles/light.d.ts +14 -1
- package/es/avatar-group/index.d.ts +3 -2
- package/es/avatar-group/src/AvatarGroup.d.ts +1 -4
- package/es/avatar-group/src/generic-public-types.d.ts +18 -0
- package/es/avatar-group/src/generic-public-types.mjs +1 -0
- package/es/avatar-group/src/public-types.d.ts +10 -0
- package/es/avatar-group/src/public-types.mjs +1 -0
- package/es/back-top/src/BackTop.d.ts +1 -1
- package/es/badge/src/Badge.d.ts +1 -1
- package/es/button/src/Button.d.ts +1 -1
- package/es/card/src/Card.d.ts +7 -2
- package/es/card/src/Card.mjs +3 -1
- package/es/carousel/src/Carousel.d.ts +4 -4
- package/es/carousel/src/Carousel.mjs +2 -2
- package/es/carousel/src/CarouselDots.d.ts +2 -2
- package/es/carousel/src/CarouselItem.mjs +1 -1
- package/es/cascader/src/Cascader.d.ts +163 -20
- package/es/cascader/src/CascaderMenu.d.ts +56 -4
- package/es/cascader/src/CascaderOption.d.ts +56 -4
- package/es/cascader/src/CascaderSelectMenu.d.ts +57 -5
- package/es/cascader/src/CascaderSubmenu.d.ts +56 -4
- package/es/cascader/styles/light.d.ts +14 -1
- package/es/color-picker/src/ColorInputUnit.d.ts +26 -2
- package/es/color-picker/src/ColorPicker.d.ts +128 -11
- package/es/color-picker/src/ColorPickerTrigger.mjs +2 -1
- package/es/color-picker/src/utils.d.ts +2 -0
- package/es/color-picker/src/utils.mjs +23 -0
- package/es/color-picker/styles/light.d.ts +17 -4
- package/es/components.d.ts +1 -0
- package/es/components.mjs +1 -0
- package/es/config-provider/src/ConfigProvider.d.ts +1 -1
- package/es/config-provider/src/ConfigProvider.mjs +1 -1
- package/es/config-provider/src/internal-interface.d.ts +2 -0
- package/es/data-table/src/DataTable.d.ts +690 -68
- package/es/data-table/src/HeaderButton/FilterButton.d.ts +334 -26
- package/es/data-table/src/HeaderButton/FilterMenu.d.ts +332 -24
- package/es/data-table/src/TableParts/Body.d.ts +332 -24
- package/es/data-table/src/TableParts/Cell.mjs +1 -1
- package/es/data-table/src/TableParts/Header.d.ts +332 -24
- package/es/data-table/src/interface.d.ts +253 -18
- package/es/data-table/src/use-sorter.d.ts +2 -5
- package/es/data-table/src/use-table-data.d.ts +1 -4
- package/es/data-table/src/utils.mjs +4 -1
- package/es/data-table/styles/light.d.ts +84 -6
- package/es/date-picker/src/DatePicker.d.ts +229 -23
- package/es/date-picker/src/DatePicker.mjs +1 -1
- package/es/date-picker/src/panel/date.d.ts +110 -10
- package/es/date-picker/src/panel/daterange.d.ts +111 -11
- package/es/date-picker/src/panel/datetime.d.ts +111 -11
- package/es/date-picker/src/panel/datetime.mjs +1 -1
- package/es/date-picker/src/panel/datetimerange.d.ts +112 -12
- package/es/date-picker/src/panel/datetimerange.mjs +2 -2
- package/es/date-picker/src/panel/month.d.ts +110 -10
- package/es/date-picker/src/panel/monthrange.d.ts +111 -11
- package/es/date-picker/src/panel/panelHeader.d.ts +436 -36
- package/es/date-picker/src/panel/use-calendar.d.ts +109 -9
- package/es/date-picker/src/panel/use-dual-calendar.d.ts +110 -10
- package/es/date-picker/src/panel/use-dual-calendar.mjs +3 -3
- package/es/date-picker/src/panel/use-panel-common.d.ts +109 -9
- package/es/date-picker/src/panel/use-panel-common.mjs +1 -1
- package/es/date-picker/src/props.d.ts +85 -7
- package/es/date-picker/src/props.mjs +1 -1
- package/es/date-picker/src/utils.d.ts +2 -1
- package/es/date-picker/src/utils.mjs +4 -1
- package/es/date-picker/styles/light.d.ts +28 -2
- package/es/dialog/src/Dialog.d.ts +9 -6
- package/es/dialog/src/Dialog.mjs +1 -0
- package/es/dialog/src/DialogEnvironment.d.ts +11 -4
- package/es/dialog/src/DialogEnvironment.mjs +3 -0
- package/es/dialog/src/DialogProvider.d.ts +38 -34
- package/es/dialog/src/dialogProps.d.ts +2 -1
- package/es/dialog/src/dialogProps.mjs +2 -1
- package/es/drawer/src/Drawer.d.ts +4 -4
- package/es/drawer/src/DrawerBodyWrapper.d.ts +1 -1
- package/es/dropdown/src/Dropdown.d.ts +165 -24
- package/es/dropdown/src/DropdownMenu.d.ts +2 -2
- package/es/dropdown/src/DropdownOption.d.ts +2 -2
- package/es/dropdown/styles/light.d.ts +16 -3
- package/es/dynamic-input/src/DynamicInput.d.ts +153 -12
- package/es/dynamic-input/src/InputPreset.d.ts +52 -4
- package/es/dynamic-input/src/PairPreset.d.ts +52 -4
- package/es/dynamic-input/styles/light.d.ts +14 -1
- package/es/dynamic-tags/src/DynamicTags.d.ts +153 -12
- package/es/dynamic-tags/styles/light.d.ts +14 -1
- package/es/element/src/Element.mjs +1 -1
- package/es/ellipsis/src/Ellipsis.d.ts +154 -11
- package/es/ellipsis/src/PerformantEllipsis.d.ts +84 -6
- package/es/ellipsis/styles/light.d.ts +14 -1
- package/es/empty/src/Empty.d.ts +1 -1
- package/es/form/src/FormItem.d.ts +8 -2
- package/es/form/src/FormItem.mjs +6 -3
- package/es/form/src/FormItemCol.d.ts +7 -1
- package/es/form/src/FormItemGridItem.d.ts +7 -1
- package/es/form/src/FormItemRow.d.ts +7 -1
- package/es/form/src/utils.d.ts +1 -1
- package/es/form/src/utils.mjs +1 -1
- package/es/global-style/src/GlobalStyle.mjs +1 -1
- package/es/gradient-text/src/GradientText.d.ts +2 -2
- package/es/grid/src/GridItem.d.ts +1 -1
- package/es/heatmap/index.d.ts +6 -0
- package/es/heatmap/index.mjs +4 -0
- package/es/heatmap/src/ColorIndicator.d.ts +25 -0
- package/es/heatmap/src/ColorIndicator.mjs +41 -0
- package/es/heatmap/src/Heatmap.d.ts +385 -0
- package/es/heatmap/src/Heatmap.mjs +333 -0
- package/es/heatmap/src/Rect.d.ts +57 -0
- package/es/heatmap/src/Rect.mjs +67 -0
- package/es/heatmap/src/animationStyle.d.ts +6 -0
- package/es/heatmap/src/animationStyle.mjs +51 -0
- package/es/heatmap/src/interface.d.ts +7 -0
- package/es/heatmap/src/interface.mjs +1 -0
- package/es/heatmap/src/public-types.d.ts +16 -0
- package/es/heatmap/src/public-types.mjs +1 -0
- package/es/heatmap/src/styles/index.cssr.d.ts +2 -0
- package/es/heatmap/src/styles/index.cssr.mjs +102 -0
- package/es/heatmap/src/styles/rtl.cssr.d.ts +2 -0
- package/es/heatmap/src/styles/rtl.cssr.mjs +4 -0
- package/es/heatmap/src/theme.d.ts +8 -0
- package/es/heatmap/src/theme.mjs +7 -0
- package/es/heatmap/src/utils/index.d.ts +32 -0
- package/es/heatmap/src/utils/index.mjs +148 -0
- package/es/heatmap/styles/dark.d.ts +3 -0
- package/es/heatmap/styles/dark.mjs +16 -0
- package/es/heatmap/styles/index.d.ts +3 -0
- package/es/heatmap/styles/index.mjs +2 -0
- package/es/heatmap/styles/light.d.ts +31 -0
- package/es/heatmap/styles/light.mjs +45 -0
- package/es/heatmap/styles/rtl.d.ts +2 -0
- package/es/heatmap/styles/rtl.mjs +5 -0
- package/es/highlight/src/utils.mjs +10 -10
- package/es/icon/src/styles/index.cssr.mjs +0 -1
- package/es/image/index.d.ts +3 -1
- package/es/image/index.mjs +2 -1
- package/es/image/src/Image.d.ts +133 -23
- package/es/image/src/Image.mjs +48 -23
- package/es/image/src/ImageGroup.d.ts +200 -35
- package/es/image/src/ImageGroup.mjs +130 -26
- package/es/image/src/ImagePreview.d.ts +258 -23
- package/es/image/src/ImagePreview.mjs +84 -42
- package/es/image/src/interface.d.ts +42 -3
- package/es/image/src/public-types.d.ts +14 -0
- package/es/image/styles/light.d.ts +14 -1
- package/es/input/src/Input.d.ts +146 -12
- package/es/input/src/Input.mjs +6 -4
- package/es/input/src/InputGroupLabel.d.ts +129 -22
- package/es/input/src/InputGroupLabel.mjs +14 -8
- package/es/input/styles/dark.d.ts +139 -2
- package/es/input/styles/dark.mjs +114 -108
- package/es/input/styles/light.d.ts +76 -3
- package/es/input/styles/light.mjs +7 -2
- package/es/input-number/src/InputNumber.d.ts +152 -11
- package/es/input-number/styles/light.d.ts +14 -1
- package/es/input-otp/src/InputOtp.d.ts +158 -12
- package/es/input-otp/src/InputOtp.mjs +12 -4
- package/es/input-otp/src/public-types.d.ts +1 -0
- package/es/input-otp/src/styles/index.cssr.mjs +12 -3
- package/es/input-otp/styles/dark.mjs +1 -1
- package/es/input-otp/styles/light.d.ts +14 -1
- package/es/layout/src/LayoutSider.d.ts +1 -1
- package/es/legacy-transfer/src/Transfer.d.ts +154 -13
- package/es/legacy-transfer/src/TransferFilter.d.ts +52 -4
- package/es/legacy-transfer/src/TransferList.d.ts +52 -4
- package/es/legacy-transfer/src/TransferListItem.d.ts +52 -4
- package/es/legacy-transfer/styles/light.d.ts +14 -1
- package/es/locales/common/arDZ.mjs +6 -0
- package/es/locales/common/azAZ.mjs +6 -0
- package/es/locales/common/csCZ.mjs +6 -0
- package/es/locales/common/daDK.d.ts +3 -0
- package/es/locales/common/daDK.mjs +130 -0
- package/es/locales/common/deDE.mjs +6 -0
- package/es/locales/common/enGB.mjs +6 -0
- package/es/locales/common/enUS.d.ts +6 -0
- package/es/locales/common/enUS.mjs +6 -0
- package/es/locales/common/eo.mjs +6 -0
- package/es/locales/common/esAR.mjs +6 -0
- package/es/locales/common/etEE.mjs +6 -0
- package/es/locales/common/faIR.mjs +6 -0
- package/es/locales/common/frFR.mjs +6 -0
- package/es/locales/common/idID.mjs +6 -0
- package/es/locales/common/itIT.mjs +6 -0
- package/es/locales/common/jaJP.mjs +6 -0
- package/es/locales/common/kmKH.mjs +6 -0
- package/es/locales/common/koKR.mjs +6 -0
- package/es/locales/common/nbNO.mjs +6 -0
- package/es/locales/common/nlNL.mjs +6 -0
- package/es/locales/common/plPL.mjs +6 -0
- package/es/locales/common/ptBR.mjs +6 -0
- package/es/locales/common/ruRU.mjs +6 -0
- package/es/locales/common/skSK.mjs +6 -0
- package/es/locales/common/svSE.mjs +8 -2
- package/es/locales/common/thTH.mjs +6 -0
- package/es/locales/common/trTR.mjs +6 -0
- package/es/locales/common/ugCN.mjs +6 -0
- package/es/locales/common/ukUA.mjs +6 -0
- package/es/locales/common/uzUZ.mjs +6 -0
- package/es/locales/common/viVN.mjs +6 -0
- package/es/locales/common/zhCN.mjs +6 -0
- package/es/locales/common/zhTW.mjs +6 -0
- package/es/locales/date/daDK.d.ts +3 -0
- package/es/locales/date/daDK.mjs +6 -0
- package/es/locales/index.d.ts +2 -0
- package/es/locales/index.mjs +2 -0
- package/es/locales/utils/index.mjs +1 -1
- package/es/log/src/Log.d.ts +1 -1
- package/es/log/src/Log.mjs +1 -1
- package/es/marquee/src/Marquee.mjs +12 -10
- package/es/mention/src/Mention.d.ts +155 -14
- package/es/mention/styles/light.d.ts +14 -1
- package/es/menu/src/Menu.d.ts +314 -28
- package/es/menu/src/MenuOption.d.ts +113 -9
- package/es/menu/src/MenuOption.mjs +4 -3
- package/es/menu/src/MenuOptionContent.d.ts +1 -1
- package/es/menu/src/MenuOptionGroup.d.ts +1 -1
- package/es/menu/src/MenuOptionGroup.mjs +11 -4
- package/es/menu/src/Submenu.d.ts +114 -10
- package/es/menu/src/use-menu-child.d.ts +2 -0
- package/es/menu/src/use-menu-child.mjs +2 -1
- package/es/menu/styles/light.d.ts +33 -7
- package/es/message/src/Message.d.ts +1 -0
- package/es/message/src/Message.mjs +3 -1
- package/es/message/src/MessageProvider.d.ts +10 -1
- package/es/message/src/styles/index.cssr.mjs +1 -0
- package/es/message/styles/light.d.ts +1 -0
- package/es/message/styles/light.mjs +2 -1
- package/es/modal/src/BodyWrapper.d.ts +13 -7
- package/es/modal/src/BodyWrapper.mjs +4 -3
- package/es/modal/src/Modal.d.ts +32 -15
- package/es/modal/src/Modal.mjs +14 -6
- package/es/modal/src/ModalEnvironment.d.ts +22 -10
- package/es/modal/src/ModalEnvironment.mjs +1 -1
- package/es/modal/src/ModalProvider.d.ts +2 -1
- package/es/modal/src/ModalProvider.mjs +4 -2
- package/es/modal/src/presetProps.d.ts +3 -2
- package/es/modal/src/styles/index.cssr.mjs +4 -2
- package/es/notification/src/Notification.d.ts +2 -2
- package/es/notification/src/NotificationEnvironment.d.ts +1 -1
- package/es/notification/src/NotificationProvider.d.ts +5 -5
- package/es/number-animation/src/NumberAnimation.mjs +1 -1
- package/es/pagination/src/Pagination.d.ts +460 -33
- package/es/pagination/styles/light.d.ts +42 -3
- package/es/popconfirm/src/Popconfirm.d.ts +163 -22
- package/es/popconfirm/src/Popconfirm.mjs +3 -3
- package/es/popconfirm/src/PopconfirmPanel.d.ts +3 -3
- package/es/popconfirm/styles/light.d.ts +14 -1
- package/es/popover/src/Popover.d.ts +133 -16
- package/es/popover/src/PopoverBody.d.ts +129 -12
- package/es/popover/src/PopoverBody.mjs +8 -4
- package/es/popover/src/styles/index.cssr.mjs +1 -1
- package/es/popover/src/styles/rtl.cssr.d.ts +2 -0
- package/es/popover/src/styles/rtl.cssr.mjs +5 -0
- package/es/popover/styles/dark.mjs +4 -0
- package/es/popover/styles/index.d.ts +1 -0
- package/es/popover/styles/index.mjs +2 -1
- package/es/popover/styles/light.d.ts +27 -2
- package/es/popover/styles/light.mjs +7 -2
- package/es/popover/styles/rtl.d.ts +2 -0
- package/es/popover/styles/rtl.mjs +7 -0
- package/es/popselect/src/Popselect.d.ts +217 -76
- package/es/popselect/src/PopselectPanel.d.ts +55 -7
- package/es/popselect/styles/light.d.ts +14 -1
- package/es/progress/src/Circle.d.ts +1 -1
- package/es/progress/src/Circle.mjs +14 -3
- package/es/progress/src/Progress.d.ts +1 -1
- package/es/radio/src/Radio.mjs +5 -5
- package/es/radio/src/RadioButton.d.ts +2 -2
- package/es/radio/src/styles/radio.cssr.mjs +3 -7
- package/es/rate/src/Rate.d.ts +1 -1
- package/es/result/src/Result.d.ts +1 -1
- package/es/select/src/Select.d.ts +164 -21
- package/es/select/styles/light.d.ts +14 -1
- package/es/styles.d.ts +3 -3
- package/es/styles.mjs +3 -3
- package/es/tabs/src/Tab.d.ts +3 -3
- package/es/tabs/src/Tabs.d.ts +1 -1
- package/es/tabs/src/Tabs.mjs +1 -1
- package/es/tabs/src/styles/index.cssr.mjs +4 -4
- package/es/tag/src/Tag.d.ts +1 -1
- package/es/theme-editor/src/ThemeEditor.mjs +1 -1
- package/es/themes/dark.mjs +2 -0
- package/es/themes/light.mjs +2 -0
- package/es/time-picker/src/Panel.d.ts +59 -11
- package/es/time-picker/src/TimePicker.d.ts +156 -15
- package/es/time-picker/styles/light.d.ts +14 -1
- package/es/timeline/src/TimelineItem.d.ts +1 -1
- package/es/tooltip/src/Tooltip.d.ts +166 -25
- package/es/tooltip/styles/light.d.ts +16 -3
- package/es/transfer/src/Transfer.d.ts +154 -13
- package/es/transfer/src/TransferFilter.d.ts +52 -4
- package/es/transfer/src/TransferList.d.ts +52 -4
- package/es/transfer/src/TransferListItem.d.ts +52 -4
- package/es/transfer/styles/light.d.ts +14 -1
- package/es/tree/src/Tree.d.ts +42 -38
- package/es/tree/src/Tree.mjs +3 -1
- package/es/tree/src/TreeNode.d.ts +2 -2
- package/es/tree/src/TreeNodeContent.d.ts +3 -3
- package/es/tree/src/styles/index.cssr.mjs +7 -2
- package/es/tree/styles/light.d.ts +4 -4
- package/es/tree-select/src/TreeSelect.d.ts +172 -29
- package/es/tree-select/styles/index.d.ts +1 -0
- package/es/tree-select/styles/index.mjs +2 -1
- package/es/tree-select/styles/light.d.ts +22 -9
- package/es/tree-select/styles/rtl.d.ts +2 -0
- package/es/tree-select/styles/rtl.mjs +11 -0
- package/es/typography/src/create-header.d.ts +1 -1
- package/es/typography/src/headers.d.ts +6 -6
- package/es/upload/src/Upload.d.ts +1 -0
- package/es/upload/src/Upload.mjs +6 -3
- package/es/upload/src/UploadFile.d.ts +8 -6
- package/es/upload/src/UploadFile.mjs +1 -1
- package/es/upload/src/icons.d.ts +2 -2
- package/es/upload/src/icons.mjs +22 -18
- package/es/upload/src/styles/rtl.cssr.d.ts +2 -0
- package/es/upload/src/styles/rtl.cssr.mjs +5 -0
- package/es/upload/styles/index.d.ts +1 -0
- package/es/upload/styles/index.mjs +2 -1
- package/es/upload/styles/rtl.d.ts +2 -0
- package/es/upload/styles/rtl.mjs +5 -0
- package/es/version.d.ts +1 -1
- package/es/version.mjs +1 -1
- package/es/virtual-list/src/VirtualList.d.ts +1 -1
- package/generic/AvatarGroup.vue +26 -0
- package/generic/index.ts +1 -0
- package/lib/_internal/icon/src/styles/index.cssr.js +0 -1
- package/lib/_internal/scrollbar/src/Scrollbar.d.ts +3 -3
- package/lib/_internal/select-menu/src/SelectMenu.d.ts +4 -4
- package/lib/_internal/selection/src/Selection.d.ts +115 -13
- package/lib/_internal/selection/styles/light.d.ts +14 -1
- package/lib/_utils/index.d.ts +1 -0
- package/lib/_utils/naive/prop.d.ts +19 -10
- package/lib/_utils/naive/prop.js +21 -21
- package/lib/_utils/ts/ts.d.ts +3 -0
- package/lib/alert/src/Alert.d.ts +2 -2
- package/lib/anchor/index.d.ts +1 -0
- package/lib/anchor/src/AnchorAdapter.d.ts +1 -1
- package/lib/anchor/src/AnchorAdapter.js +17 -7
- package/lib/anchor/src/BaseAnchor.js +30 -5
- package/lib/anchor/src/Link.d.ts +3 -2
- package/lib/anchor/src/Link.js +4 -1
- package/lib/anchor/src/public-types.d.ts +5 -0
- package/lib/anchor/src/public-types.js +2 -0
- package/lib/auto-complete/src/AutoComplete.d.ts +155 -14
- package/lib/auto-complete/styles/light.d.ts +14 -1
- package/lib/avatar-group/index.d.ts +3 -2
- package/lib/avatar-group/src/AvatarGroup.d.ts +1 -4
- package/lib/avatar-group/src/generic-public-types.d.ts +18 -0
- package/lib/avatar-group/src/generic-public-types.js +2 -0
- package/lib/avatar-group/src/public-types.d.ts +10 -0
- package/lib/avatar-group/src/public-types.js +2 -0
- package/lib/back-top/src/BackTop.d.ts +1 -1
- package/lib/badge/src/Badge.d.ts +1 -1
- package/lib/button/src/Button.d.ts +1 -1
- package/lib/card/src/Card.d.ts +7 -2
- package/lib/card/src/Card.js +3 -2
- package/lib/carousel/src/Carousel.d.ts +4 -4
- package/lib/carousel/src/Carousel.js +19 -9
- package/lib/carousel/src/CarouselDots.d.ts +2 -2
- package/lib/cascader/src/Cascader.d.ts +163 -20
- package/lib/cascader/src/CascaderMenu.d.ts +56 -4
- package/lib/cascader/src/CascaderOption.d.ts +56 -4
- package/lib/cascader/src/CascaderSelectMenu.d.ts +57 -5
- package/lib/cascader/src/CascaderSubmenu.d.ts +56 -4
- package/lib/cascader/styles/light.d.ts +14 -1
- package/lib/color-picker/src/ColorInputUnit.d.ts +26 -2
- package/lib/color-picker/src/ColorPicker.d.ts +128 -11
- package/lib/color-picker/src/ColorPickerTrigger.js +2 -1
- package/lib/color-picker/src/utils.d.ts +2 -0
- package/lib/color-picker/src/utils.js +26 -0
- package/lib/color-picker/styles/light.d.ts +14 -1
- package/lib/components.d.ts +1 -0
- package/lib/components.js +1 -0
- package/lib/config-provider/src/ConfigProvider.d.ts +1 -1
- package/lib/config-provider/src/internal-interface.d.ts +2 -0
- package/lib/data-table/src/DataTable.d.ts +674 -52
- package/lib/data-table/src/HeaderButton/FilterButton.d.ts +333 -25
- package/lib/data-table/src/HeaderButton/FilterMenu.d.ts +332 -24
- package/lib/data-table/src/TableParts/Body.d.ts +332 -24
- package/lib/data-table/src/TableParts/Header.d.ts +332 -24
- package/lib/data-table/src/interface.d.ts +253 -18
- package/lib/data-table/src/use-sorter.d.ts +2 -5
- package/lib/data-table/src/use-table-data.d.ts +1 -4
- package/lib/data-table/src/utils.js +2 -1
- package/lib/data-table/styles/light.d.ts +84 -6
- package/lib/date-picker/src/DatePicker.d.ts +229 -23
- package/lib/date-picker/src/DatePicker.js +1 -1
- package/lib/date-picker/src/panel/date.d.ts +110 -10
- package/lib/date-picker/src/panel/daterange.d.ts +111 -11
- package/lib/date-picker/src/panel/datetime.d.ts +110 -10
- package/lib/date-picker/src/panel/datetime.js +1 -1
- package/lib/date-picker/src/panel/datetimerange.d.ts +111 -11
- package/lib/date-picker/src/panel/datetimerange.js +2 -2
- package/lib/date-picker/src/panel/month.d.ts +110 -10
- package/lib/date-picker/src/panel/monthrange.d.ts +111 -11
- package/lib/date-picker/src/panel/panelHeader.d.ts +436 -36
- package/lib/date-picker/src/panel/use-calendar.d.ts +109 -9
- package/lib/date-picker/src/panel/use-dual-calendar.d.ts +110 -10
- package/lib/date-picker/src/panel/use-dual-calendar.js +3 -3
- package/lib/date-picker/src/panel/use-panel-common.d.ts +109 -9
- package/lib/date-picker/src/panel/use-panel-common.js +1 -1
- package/lib/date-picker/src/props.d.ts +85 -7
- package/lib/date-picker/src/props.js +1 -1
- package/lib/date-picker/src/utils.d.ts +2 -1
- package/lib/date-picker/src/utils.js +5 -1
- package/lib/date-picker/styles/light.d.ts +28 -2
- package/lib/dialog/src/Dialog.d.ts +5 -2
- package/lib/dialog/src/Dialog.js +1 -1
- package/lib/dialog/src/DialogEnvironment.d.ts +11 -4
- package/lib/dialog/src/DialogEnvironment.js +3 -3
- package/lib/dialog/src/DialogProvider.d.ts +38 -34
- package/lib/dialog/src/dialogProps.d.ts +2 -1
- package/lib/dialog/src/dialogProps.js +2 -1
- package/lib/drawer/src/Drawer.d.ts +4 -4
- package/lib/drawer/src/DrawerBodyWrapper.d.ts +1 -1
- package/lib/dropdown/src/Dropdown.d.ts +162 -21
- package/lib/dropdown/src/DropdownMenu.d.ts +2 -2
- package/lib/dropdown/styles/light.d.ts +14 -1
- package/lib/dynamic-input/src/DynamicInput.d.ts +153 -12
- package/lib/dynamic-input/src/InputPreset.d.ts +52 -4
- package/lib/dynamic-input/src/PairPreset.d.ts +52 -4
- package/lib/dynamic-input/styles/light.d.ts +14 -1
- package/lib/dynamic-tags/src/DynamicTags.d.ts +153 -12
- package/lib/dynamic-tags/styles/light.d.ts +14 -1
- package/lib/ellipsis/src/Ellipsis.d.ts +154 -11
- package/lib/ellipsis/src/PerformantEllipsis.d.ts +84 -6
- package/lib/ellipsis/src/PerformantEllipsis.js +17 -7
- package/lib/ellipsis/styles/light.d.ts +14 -1
- package/lib/empty/src/Empty.d.ts +1 -1
- package/lib/form/src/FormItem.d.ts +8 -2
- package/lib/form/src/FormItem.js +3 -2
- package/lib/form/src/FormItemCol.d.ts +7 -1
- package/lib/form/src/FormItemCol.js +17 -7
- package/lib/form/src/FormItemGridItem.d.ts +7 -1
- package/lib/form/src/FormItemGridItem.js +17 -7
- package/lib/form/src/FormItemRow.d.ts +7 -1
- package/lib/form/src/FormItemRow.js +17 -7
- package/lib/form/src/utils.d.ts +1 -1
- package/lib/gradient-text/src/GradientText.d.ts +2 -2
- package/lib/grid/src/GridItem.d.ts +1 -1
- package/lib/heatmap/index.d.ts +6 -0
- package/lib/heatmap/index.js +27 -0
- package/lib/heatmap/src/ColorIndicator.d.ts +25 -0
- package/lib/heatmap/src/ColorIndicator.js +27 -0
- package/lib/heatmap/src/Heatmap.d.ts +385 -0
- package/lib/heatmap/src/Heatmap.js +248 -0
- package/lib/heatmap/src/Rect.d.ts +57 -0
- package/lib/heatmap/src/Rect.js +64 -0
- package/lib/heatmap/src/animationStyle.d.ts +6 -0
- package/lib/heatmap/src/animationStyle.js +52 -0
- package/lib/heatmap/src/interface.d.ts +7 -0
- package/lib/heatmap/src/interface.js +2 -0
- package/lib/heatmap/src/public-types.d.ts +16 -0
- package/lib/heatmap/src/public-types.js +2 -0
- package/lib/heatmap/src/styles/index.cssr.d.ts +2 -0
- package/lib/heatmap/src/styles/index.cssr.js +107 -0
- package/lib/heatmap/src/styles/rtl.cssr.d.ts +2 -0
- package/lib/heatmap/src/styles/rtl.cssr.js +9 -0
- package/lib/heatmap/src/theme.d.ts +8 -0
- package/lib/heatmap/src/theme.js +10 -0
- package/lib/heatmap/src/utils/index.d.ts +32 -0
- package/lib/heatmap/src/utils/index.js +135 -0
- package/lib/heatmap/styles/dark.d.ts +3 -0
- package/lib/heatmap/styles/dark.js +13 -0
- package/lib/heatmap/styles/index.d.ts +3 -0
- package/lib/heatmap/styles/index.js +10 -0
- package/lib/heatmap/styles/light.d.ts +31 -0
- package/lib/heatmap/styles/light.js +39 -0
- package/lib/heatmap/styles/rtl.d.ts +2 -0
- package/lib/heatmap/styles/rtl.js +11 -0
- package/lib/highlight/src/utils.js +10 -21
- package/lib/icon/src/styles/index.cssr.js +0 -1
- package/lib/image/index.d.ts +3 -1
- package/lib/image/index.js +4 -1
- package/lib/image/src/Image.d.ts +133 -23
- package/lib/image/src/Image.js +43 -23
- package/lib/image/src/ImageGroup.d.ts +200 -35
- package/lib/image/src/ImageGroup.js +111 -26
- package/lib/image/src/ImagePreview.d.ts +258 -23
- package/lib/image/src/ImagePreview.js +60 -33
- package/lib/image/src/interface.d.ts +42 -3
- package/lib/image/src/public-types.d.ts +14 -0
- package/lib/image/styles/light.d.ts +14 -1
- package/lib/input/src/Input.d.ts +146 -12
- package/lib/input/src/Input.js +24 -12
- package/lib/input/src/InputGroupLabel.d.ts +129 -22
- package/lib/input/src/InputGroupLabel.js +8 -6
- package/lib/input/styles/dark.d.ts +139 -2
- package/lib/input/styles/dark.js +35 -29
- package/lib/input/styles/light.d.ts +76 -3
- package/lib/input/styles/light.js +7 -2
- package/lib/input-number/src/InputNumber.d.ts +152 -11
- package/lib/input-number/styles/light.d.ts +14 -1
- package/lib/input-otp/src/InputOtp.d.ts +158 -12
- package/lib/input-otp/src/InputOtp.js +12 -16
- package/lib/input-otp/src/public-types.d.ts +1 -0
- package/lib/input-otp/src/styles/index.cssr.js +11 -2
- package/lib/input-otp/styles/dark.js +1 -1
- package/lib/input-otp/styles/light.d.ts +14 -1
- package/lib/layout/src/LayoutSider.d.ts +1 -1
- package/lib/legacy-transfer/src/Transfer.d.ts +154 -13
- package/lib/legacy-transfer/src/TransferFilter.d.ts +52 -4
- package/lib/legacy-transfer/src/TransferList.d.ts +52 -4
- package/lib/legacy-transfer/src/TransferListItem.d.ts +52 -4
- package/lib/legacy-transfer/styles/light.d.ts +14 -1
- package/lib/locales/common/arDZ.js +6 -0
- package/lib/locales/common/azAZ.js +6 -0
- package/lib/locales/common/csCZ.js +6 -0
- package/lib/locales/common/daDK.d.ts +3 -0
- package/lib/locales/common/daDK.js +132 -0
- package/lib/locales/common/deDE.js +6 -0
- package/lib/locales/common/enGB.js +6 -0
- package/lib/locales/common/enUS.d.ts +6 -0
- package/lib/locales/common/enUS.js +6 -0
- package/lib/locales/common/eo.js +6 -0
- package/lib/locales/common/esAR.js +6 -0
- package/lib/locales/common/etEE.js +6 -0
- package/lib/locales/common/faIR.js +6 -0
- package/lib/locales/common/frFR.js +6 -0
- package/lib/locales/common/idID.js +6 -0
- package/lib/locales/common/itIT.js +6 -0
- package/lib/locales/common/jaJP.js +6 -0
- package/lib/locales/common/kmKH.js +6 -0
- package/lib/locales/common/koKR.js +6 -0
- package/lib/locales/common/nbNO.js +6 -0
- package/lib/locales/common/nlNL.js +6 -0
- package/lib/locales/common/plPL.js +6 -0
- package/lib/locales/common/ptBR.js +6 -0
- package/lib/locales/common/ruRU.js +6 -0
- package/lib/locales/common/skSK.js +6 -0
- package/lib/locales/common/svSE.js +8 -2
- package/lib/locales/common/thTH.js +6 -0
- package/lib/locales/common/trTR.js +6 -0
- package/lib/locales/common/ugCN.js +6 -0
- package/lib/locales/common/ukUA.js +6 -0
- package/lib/locales/common/uzUZ.js +6 -0
- package/lib/locales/common/viVN.js +6 -0
- package/lib/locales/common/zhCN.js +6 -0
- package/lib/locales/common/zhTW.js +6 -0
- package/lib/locales/date/daDK.d.ts +3 -0
- package/lib/locales/date/daDK.js +8 -0
- package/lib/locales/index.d.ts +2 -0
- package/lib/locales/index.js +6 -2
- package/lib/log/src/Log.d.ts +1 -1
- package/lib/marquee/src/Marquee.js +4 -3
- package/lib/mention/src/Mention.d.ts +155 -14
- package/lib/mention/styles/light.d.ts +14 -1
- package/lib/menu/src/Menu.d.ts +314 -28
- package/lib/menu/src/MenuOption.d.ts +113 -9
- package/lib/menu/src/MenuOption.js +6 -4
- package/lib/menu/src/MenuOptionContent.d.ts +1 -1
- package/lib/menu/src/MenuOptionGroup.d.ts +1 -1
- package/lib/menu/src/MenuOptionGroup.js +8 -2
- package/lib/menu/src/Submenu.d.ts +114 -10
- package/lib/menu/src/use-menu-child.d.ts +2 -0
- package/lib/menu/src/use-menu-child.js +2 -1
- package/lib/menu/styles/light.d.ts +28 -2
- package/lib/message/src/Message.d.ts +1 -0
- package/lib/message/src/Message.js +3 -2
- package/lib/message/src/MessageProvider.d.ts +10 -1
- package/lib/message/src/styles/index.cssr.js +1 -0
- package/lib/message/styles/light.d.ts +1 -0
- package/lib/message/styles/light.js +1 -1
- package/lib/modal/src/BodyWrapper.d.ts +10 -4
- package/lib/modal/src/BodyWrapper.js +7 -3
- package/lib/modal/src/Modal.d.ts +28 -11
- package/lib/modal/src/Modal.js +10 -4
- package/lib/modal/src/ModalEnvironment.d.ts +22 -10
- package/lib/modal/src/ModalEnvironment.js +18 -8
- package/lib/modal/src/ModalProvider.d.ts +2 -1
- package/lib/modal/src/ModalProvider.js +4 -2
- package/lib/modal/src/presetProps.d.ts +2 -1
- package/lib/modal/src/styles/index.cssr.js +3 -1
- package/lib/notification/src/Notification.d.ts +2 -2
- package/lib/notification/src/NotificationEnvironment.d.ts +1 -1
- package/lib/notification/src/NotificationProvider.d.ts +5 -5
- package/lib/pagination/src/Pagination.d.ts +460 -33
- package/lib/pagination/styles/light.d.ts +42 -3
- package/lib/popconfirm/src/Popconfirm.d.ts +159 -18
- package/lib/popconfirm/src/Popconfirm.js +20 -15
- package/lib/popconfirm/src/PopconfirmPanel.d.ts +1 -1
- package/lib/popconfirm/styles/light.d.ts +14 -1
- package/lib/popover/src/Popover.d.ts +133 -16
- package/lib/popover/src/Popover.js +17 -7
- package/lib/popover/src/PopoverBody.d.ts +129 -12
- package/lib/popover/src/PopoverBody.js +5 -2
- package/lib/popover/src/styles/rtl.cssr.d.ts +2 -0
- package/lib/popover/src/styles/rtl.cssr.js +10 -0
- package/lib/popover/styles/dark.js +4 -0
- package/lib/popover/styles/index.d.ts +1 -0
- package/lib/popover/styles/index.js +3 -1
- package/lib/popover/styles/light.d.ts +27 -2
- package/lib/popover/styles/light.js +7 -2
- package/lib/popover/styles/rtl.d.ts +2 -0
- package/lib/popover/styles/rtl.js +13 -0
- package/lib/popselect/src/Popselect.d.ts +213 -72
- package/lib/popselect/src/Popselect.js +17 -7
- package/lib/popselect/src/PopselectPanel.d.ts +55 -7
- package/lib/popselect/styles/light.d.ts +14 -1
- package/lib/preset.js +17 -7
- package/lib/progress/src/Circle.d.ts +1 -1
- package/lib/progress/src/Circle.js +11 -2
- package/lib/progress/src/Progress.d.ts +1 -1
- package/lib/radio/src/Radio.js +2 -2
- package/lib/radio/src/RadioButton.d.ts +2 -2
- package/lib/radio/src/styles/radio.cssr.js +3 -7
- package/lib/rate/src/Rate.d.ts +1 -1
- package/lib/result/src/Result.d.ts +1 -1
- package/lib/select/src/Select.d.ts +164 -21
- package/lib/select/styles/light.d.ts +14 -1
- package/lib/styles.d.ts +3 -3
- package/lib/styles.js +5 -2
- package/lib/tabs/src/Tab.d.ts +3 -3
- package/lib/tabs/src/Tabs.d.ts +1 -1
- package/lib/tabs/src/styles/index.cssr.js +4 -4
- package/lib/tag/src/Tag.d.ts +1 -1
- package/lib/themes/dark.js +103 -101
- package/lib/themes/light.js +102 -100
- package/lib/time-picker/src/Panel.d.ts +59 -11
- package/lib/time-picker/src/TimePicker.d.ts +156 -15
- package/lib/time-picker/styles/light.d.ts +14 -1
- package/lib/timeline/src/TimelineItem.d.ts +1 -1
- package/lib/tooltip/src/Tooltip.d.ts +159 -18
- package/lib/tooltip/styles/light.d.ts +14 -1
- package/lib/transfer/src/Transfer.d.ts +154 -13
- package/lib/transfer/src/TransferFilter.d.ts +52 -4
- package/lib/transfer/src/TransferList.d.ts +52 -4
- package/lib/transfer/src/TransferListItem.d.ts +52 -4
- package/lib/transfer/styles/light.d.ts +14 -1
- package/lib/tree/src/Tree.d.ts +42 -38
- package/lib/tree/src/Tree.js +4 -3
- package/lib/tree/src/TreeNode.d.ts +2 -2
- package/lib/tree/src/TreeNodeContent.d.ts +3 -3
- package/lib/tree/src/styles/index.cssr.js +7 -2
- package/lib/tree-select/src/TreeSelect.d.ts +169 -26
- package/lib/tree-select/styles/index.d.ts +1 -0
- package/lib/tree-select/styles/index.js +3 -1
- package/lib/tree-select/styles/light.d.ts +14 -1
- package/lib/tree-select/styles/rtl.d.ts +2 -0
- package/lib/tree-select/styles/rtl.js +20 -0
- package/lib/typography/src/create-header.d.ts +1 -1
- package/lib/typography/src/headers.d.ts +6 -6
- package/lib/upload/src/Upload.d.ts +1 -0
- package/lib/upload/src/Upload.js +4 -3
- package/lib/upload/src/UploadFile.d.ts +4 -2
- package/lib/upload/src/UploadFile.js +1 -1
- package/lib/upload/src/icons.d.ts +2 -2
- package/lib/upload/src/icons.js +12 -7
- package/lib/upload/src/styles/rtl.cssr.d.ts +2 -0
- package/lib/upload/src/styles/rtl.cssr.js +10 -0
- package/lib/upload/styles/index.d.ts +1 -0
- package/lib/upload/styles/index.js +3 -1
- package/lib/upload/styles/rtl.d.ts +2 -0
- package/lib/upload/styles/rtl.js +11 -0
- package/lib/version.d.ts +1 -1
- package/lib/version.js +1 -1
- package/lib/virtual-list/src/VirtualList.d.ts +1 -1
- package/package.json +30 -19
- package/volar.d.ts +24 -22
- package/web-types.json +599 -61
- package/es/avatar-group/src/interface.d.ts +0 -8
- package/lib/avatar-group/src/interface.d.ts +0 -8
- /package/es/{avatar-group/src/interface.mjs → _utils/ts/ts.mjs} +0 -0
- /package/lib/{avatar-group/src/interface.js → _utils/ts/ts.js} +0 -0
package/es/image/src/Image.mjs
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { defineComponent, h, inject, onBeforeUnmount, onMounted, provide, ref, toRef, watchEffect } from 'vue';
|
|
1
|
+
import { computed, defineComponent, h, inject, onBeforeUnmount, onMounted, provide, ref, toRef, watchEffect } from 'vue';
|
|
2
2
|
import { useConfig } from "../../_mixins/index.mjs";
|
|
3
3
|
import { resolveSlot } from "../../_utils/index.mjs";
|
|
4
4
|
import { isImageSupportNativeLazy } from "../../_utils/env/is-native-lazy-load.mjs";
|
|
@@ -26,6 +26,7 @@ export const imageProps = Object.assign({
|
|
|
26
26
|
onError: Function,
|
|
27
27
|
onLoad: Function
|
|
28
28
|
}, imagePreviewSharedProps);
|
|
29
|
+
let uuid = 0;
|
|
29
30
|
export default defineComponent({
|
|
30
31
|
name: 'Image',
|
|
31
32
|
props: imageProps,
|
|
@@ -39,24 +40,30 @@ export default defineComponent({
|
|
|
39
40
|
const {
|
|
40
41
|
mergedClsPrefixRef
|
|
41
42
|
} = imageGroupHandle || useConfig(props);
|
|
43
|
+
const mergedPreviewSrcRef = computed(() => {
|
|
44
|
+
return props.previewSrc || props.src;
|
|
45
|
+
});
|
|
46
|
+
const previewShowRef = ref(false);
|
|
47
|
+
const imageId = uuid++;
|
|
48
|
+
const showPreview = () => {
|
|
49
|
+
if (props.previewDisabled || showErrorRef.value) return;
|
|
50
|
+
if (imageGroupHandle) {
|
|
51
|
+
imageGroupHandle.setThumbnailEl(imageRef.value);
|
|
52
|
+
imageGroupHandle.toggleShow(`r${imageId}`);
|
|
53
|
+
return;
|
|
54
|
+
}
|
|
55
|
+
const {
|
|
56
|
+
value: previewInst
|
|
57
|
+
} = previewInstRef;
|
|
58
|
+
if (!previewInst) return;
|
|
59
|
+
previewInst.setThumbnailEl(imageRef.value);
|
|
60
|
+
previewShowRef.value = true;
|
|
61
|
+
};
|
|
42
62
|
const exposedMethods = {
|
|
43
63
|
click: () => {
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
imageGroupHandle.setPreviewSrc(mergedPreviewSrc);
|
|
48
|
-
imageGroupHandle.setThumbnailEl(imageRef.value);
|
|
49
|
-
imageGroupHandle.toggleShow();
|
|
50
|
-
return;
|
|
51
|
-
}
|
|
52
|
-
const {
|
|
53
|
-
value: previewInst
|
|
54
|
-
} = previewInstRef;
|
|
55
|
-
if (!previewInst) return;
|
|
56
|
-
previewInst.setPreviewSrc(mergedPreviewSrc);
|
|
57
|
-
previewInst.setThumbnailEl(imageRef.value);
|
|
58
|
-
previewInst.toggleShow();
|
|
59
|
-
}
|
|
64
|
+
showPreview();
|
|
65
|
+
},
|
|
66
|
+
showPreview
|
|
60
67
|
};
|
|
61
68
|
const shouldStartLoadingRef = ref(!props.lazy);
|
|
62
69
|
onMounted(() => {
|
|
@@ -83,6 +90,21 @@ export default defineComponent({
|
|
|
83
90
|
void (props.src || ((_a = props.imgProps) === null || _a === void 0 ? void 0 : _a.src));
|
|
84
91
|
showErrorRef.value = false;
|
|
85
92
|
});
|
|
93
|
+
watchEffect(onInvalidate => {
|
|
94
|
+
var _a;
|
|
95
|
+
const unregister = (_a = imageGroupHandle === null || imageGroupHandle === void 0 ? void 0 : imageGroupHandle.registerImageUrl) === null || _a === void 0 ? void 0 : _a.call(imageGroupHandle, imageId, mergedPreviewSrcRef.value || '');
|
|
96
|
+
onInvalidate(() => {
|
|
97
|
+
unregister === null || unregister === void 0 ? void 0 : unregister();
|
|
98
|
+
});
|
|
99
|
+
});
|
|
100
|
+
function onImgClick(e) {
|
|
101
|
+
var _a, _b;
|
|
102
|
+
exposedMethods.showPreview();
|
|
103
|
+
(_b = (_a = props.imgProps) === null || _a === void 0 ? void 0 : _a.onClick) === null || _b === void 0 ? void 0 : _b.call(_a, e);
|
|
104
|
+
}
|
|
105
|
+
function onPreviewClose() {
|
|
106
|
+
previewShowRef.value = false;
|
|
107
|
+
}
|
|
86
108
|
const loadedRef = ref(false);
|
|
87
109
|
provide(imageContextKey, {
|
|
88
110
|
previewedImgPropsRef: toRef(props, 'previewedImgProps')
|
|
@@ -92,14 +114,14 @@ export default defineComponent({
|
|
|
92
114
|
groupId: imageGroupHandle === null || imageGroupHandle === void 0 ? void 0 : imageGroupHandle.groupId,
|
|
93
115
|
previewInstRef,
|
|
94
116
|
imageRef,
|
|
117
|
+
mergedPreviewSrc: mergedPreviewSrcRef,
|
|
95
118
|
showError: showErrorRef,
|
|
96
119
|
shouldStartLoading: shouldStartLoadingRef,
|
|
97
120
|
loaded: loadedRef,
|
|
98
121
|
mergedOnClick: e => {
|
|
99
|
-
|
|
100
|
-
exposedMethods.click();
|
|
101
|
-
(_b = (_a = props.imgProps) === null || _a === void 0 ? void 0 : _a.onClick) === null || _b === void 0 ? void 0 : _b.call(_a, e);
|
|
122
|
+
onImgClick(e);
|
|
102
123
|
},
|
|
124
|
+
onPreviewClose,
|
|
103
125
|
mergedOnError: e => {
|
|
104
126
|
if (!shouldStartLoadingRef.value) return;
|
|
105
127
|
showErrorRef.value = true;
|
|
@@ -122,7 +144,8 @@ export default defineComponent({
|
|
|
122
144
|
onLoad === null || onLoad === void 0 ? void 0 : onLoad(e);
|
|
123
145
|
imgPropsOnLoad === null || imgPropsOnLoad === void 0 ? void 0 : imgPropsOnLoad(e);
|
|
124
146
|
loadedRef.value = true;
|
|
125
|
-
}
|
|
147
|
+
},
|
|
148
|
+
previewShow: previewShowRef
|
|
126
149
|
}, exposedMethods);
|
|
127
150
|
},
|
|
128
151
|
render() {
|
|
@@ -165,11 +188,13 @@ export default defineComponent({
|
|
|
165
188
|
}), this.groupId ? imgNode : h(NImagePreview, {
|
|
166
189
|
theme: this.theme,
|
|
167
190
|
themeOverrides: this.themeOverrides,
|
|
168
|
-
clsPrefix: mergedClsPrefix,
|
|
169
191
|
ref: "previewInstRef",
|
|
170
192
|
showToolbar: this.showToolbar,
|
|
171
193
|
showToolbarTooltip: this.showToolbarTooltip,
|
|
172
|
-
renderToolbar: this.renderToolbar
|
|
194
|
+
renderToolbar: this.renderToolbar,
|
|
195
|
+
src: this.mergedPreviewSrc,
|
|
196
|
+
show: !this.previewDisabled && this.previewShow,
|
|
197
|
+
onClose: this.onPreviewClose
|
|
173
198
|
}, {
|
|
174
199
|
default: () => imgNode
|
|
175
200
|
}), !loaded && placeholderNode);
|
|
@@ -1,22 +1,38 @@
|
|
|
1
|
-
import type {
|
|
2
|
-
import type {
|
|
3
|
-
import {
|
|
4
|
-
import { type ExtractPublicPropTypes } from '../../_utils';
|
|
1
|
+
import type { PropType, Ref } from 'vue';
|
|
2
|
+
import type { ExtractPublicPropTypes, MaybeArray } from '../../_utils';
|
|
3
|
+
import type { ImagePreviewInst, ImageRenderToolbar } from './public-types';
|
|
5
4
|
export declare const imageGroupInjectionKey: import("vue").InjectionKey<ImagePreviewInst & {
|
|
6
5
|
groupId: string;
|
|
7
6
|
mergedClsPrefixRef: Ref<string>;
|
|
8
7
|
renderToolbarRef: Ref<ImageRenderToolbar | undefined>;
|
|
8
|
+
registerImageUrl: (id: number, url: string) => () => void;
|
|
9
|
+
toggleShow: (imageId: string) => void;
|
|
9
10
|
}>;
|
|
10
11
|
export declare const imageGroupProps: {
|
|
11
|
-
|
|
12
|
-
|
|
12
|
+
srcList: PropType<string[]>;
|
|
13
|
+
current: NumberConstructor;
|
|
14
|
+
defaultCurrent: {
|
|
15
|
+
type: NumberConstructor;
|
|
16
|
+
default: number;
|
|
17
|
+
};
|
|
18
|
+
show: {
|
|
19
|
+
type: BooleanConstructor;
|
|
20
|
+
default: undefined;
|
|
21
|
+
};
|
|
22
|
+
defaultShow: BooleanConstructor;
|
|
23
|
+
onUpdateShow: PropType<MaybeArray<(show: boolean) => void>>;
|
|
24
|
+
'onUpdate:show': PropType<MaybeArray<(show: boolean) => void>>;
|
|
25
|
+
onUpdateCurrent: PropType<MaybeArray<(current: number) => void>>;
|
|
26
|
+
'onUpdate:current': PropType<MaybeArray<(current: number) => void>>;
|
|
27
|
+
onPreviewPrev: PropType<() => void>;
|
|
28
|
+
onPreviewNext: PropType<() => void>;
|
|
13
29
|
showToolbar: {
|
|
14
30
|
type: BooleanConstructor;
|
|
15
31
|
default: boolean;
|
|
16
32
|
};
|
|
17
33
|
showToolbarTooltip: BooleanConstructor;
|
|
18
|
-
renderToolbar:
|
|
19
|
-
theme:
|
|
34
|
+
renderToolbar: PropType<ImageRenderToolbar>;
|
|
35
|
+
theme: PropType<import("../../_mixins").Theme<"Image", {
|
|
20
36
|
toolbarIconColor: string;
|
|
21
37
|
toolbarColor: string;
|
|
22
38
|
toolbarBoxShadow: string;
|
|
@@ -42,10 +58,23 @@ export declare const imageGroupProps: {
|
|
|
42
58
|
arrowOffsetVertical: string;
|
|
43
59
|
arrowHeight: string;
|
|
44
60
|
padding: string;
|
|
45
|
-
},
|
|
61
|
+
}, {
|
|
62
|
+
Scrollbar: import("../../_mixins").Theme<"Scrollbar", {
|
|
63
|
+
height: string;
|
|
64
|
+
width: string;
|
|
65
|
+
borderRadius: string;
|
|
66
|
+
color: string;
|
|
67
|
+
colorHover: string;
|
|
68
|
+
railInsetHorizontalBottom: string;
|
|
69
|
+
railInsetHorizontalTop: string;
|
|
70
|
+
railInsetVerticalRight: string;
|
|
71
|
+
railInsetVerticalLeft: string;
|
|
72
|
+
railColor: string;
|
|
73
|
+
}, any>;
|
|
74
|
+
}>;
|
|
46
75
|
}>;
|
|
47
76
|
}>>;
|
|
48
|
-
themeOverrides:
|
|
77
|
+
themeOverrides: PropType<import("../../_mixins/use-theme").ExtractThemeOverrides<import("../../_mixins").Theme<"Image", {
|
|
49
78
|
toolbarIconColor: string;
|
|
50
79
|
toolbarColor: string;
|
|
51
80
|
toolbarBoxShadow: string;
|
|
@@ -71,10 +100,23 @@ export declare const imageGroupProps: {
|
|
|
71
100
|
arrowOffsetVertical: string;
|
|
72
101
|
arrowHeight: string;
|
|
73
102
|
padding: string;
|
|
74
|
-
},
|
|
103
|
+
}, {
|
|
104
|
+
Scrollbar: import("../../_mixins").Theme<"Scrollbar", {
|
|
105
|
+
height: string;
|
|
106
|
+
width: string;
|
|
107
|
+
borderRadius: string;
|
|
108
|
+
color: string;
|
|
109
|
+
colorHover: string;
|
|
110
|
+
railInsetHorizontalBottom: string;
|
|
111
|
+
railInsetHorizontalTop: string;
|
|
112
|
+
railInsetVerticalRight: string;
|
|
113
|
+
railInsetVerticalLeft: string;
|
|
114
|
+
railColor: string;
|
|
115
|
+
}, any>;
|
|
116
|
+
}>;
|
|
75
117
|
}>;
|
|
76
118
|
}>>>;
|
|
77
|
-
builtinThemeOverrides:
|
|
119
|
+
builtinThemeOverrides: PropType<import("../../_mixins/use-theme").ExtractThemeOverrides<import("../../_mixins").Theme<"Image", {
|
|
78
120
|
toolbarIconColor: string;
|
|
79
121
|
toolbarColor: string;
|
|
80
122
|
toolbarBoxShadow: string;
|
|
@@ -100,21 +142,49 @@ export declare const imageGroupProps: {
|
|
|
100
142
|
arrowOffsetVertical: string;
|
|
101
143
|
arrowHeight: string;
|
|
102
144
|
padding: string;
|
|
103
|
-
},
|
|
145
|
+
}, {
|
|
146
|
+
Scrollbar: import("../../_mixins").Theme<"Scrollbar", {
|
|
147
|
+
height: string;
|
|
148
|
+
width: string;
|
|
149
|
+
borderRadius: string;
|
|
150
|
+
color: string;
|
|
151
|
+
colorHover: string;
|
|
152
|
+
railInsetHorizontalBottom: string;
|
|
153
|
+
railInsetHorizontalTop: string;
|
|
154
|
+
railInsetVerticalRight: string;
|
|
155
|
+
railInsetVerticalLeft: string;
|
|
156
|
+
railColor: string;
|
|
157
|
+
}, any>;
|
|
158
|
+
}>;
|
|
104
159
|
}>;
|
|
105
160
|
}>>>;
|
|
106
161
|
};
|
|
107
162
|
export type ImageGroupProps = ExtractPublicPropTypes<typeof imageGroupProps>;
|
|
108
163
|
declare const _default: import("vue").DefineComponent<import("vue").ExtractPropTypes<{
|
|
109
|
-
|
|
110
|
-
|
|
164
|
+
srcList: PropType<string[]>;
|
|
165
|
+
current: NumberConstructor;
|
|
166
|
+
defaultCurrent: {
|
|
167
|
+
type: NumberConstructor;
|
|
168
|
+
default: number;
|
|
169
|
+
};
|
|
170
|
+
show: {
|
|
171
|
+
type: BooleanConstructor;
|
|
172
|
+
default: undefined;
|
|
173
|
+
};
|
|
174
|
+
defaultShow: BooleanConstructor;
|
|
175
|
+
onUpdateShow: PropType<MaybeArray<(show: boolean) => void>>;
|
|
176
|
+
'onUpdate:show': PropType<MaybeArray<(show: boolean) => void>>;
|
|
177
|
+
onUpdateCurrent: PropType<MaybeArray<(current: number) => void>>;
|
|
178
|
+
'onUpdate:current': PropType<MaybeArray<(current: number) => void>>;
|
|
179
|
+
onPreviewPrev: PropType<() => void>;
|
|
180
|
+
onPreviewNext: PropType<() => void>;
|
|
111
181
|
showToolbar: {
|
|
112
182
|
type: BooleanConstructor;
|
|
113
183
|
default: boolean;
|
|
114
184
|
};
|
|
115
185
|
showToolbarTooltip: BooleanConstructor;
|
|
116
|
-
renderToolbar:
|
|
117
|
-
theme:
|
|
186
|
+
renderToolbar: PropType<ImageRenderToolbar>;
|
|
187
|
+
theme: PropType<import("../../_mixins").Theme<"Image", {
|
|
118
188
|
toolbarIconColor: string;
|
|
119
189
|
toolbarColor: string;
|
|
120
190
|
toolbarBoxShadow: string;
|
|
@@ -140,10 +210,23 @@ declare const _default: import("vue").DefineComponent<import("vue").ExtractPropT
|
|
|
140
210
|
arrowOffsetVertical: string;
|
|
141
211
|
arrowHeight: string;
|
|
142
212
|
padding: string;
|
|
143
|
-
},
|
|
213
|
+
}, {
|
|
214
|
+
Scrollbar: import("../../_mixins").Theme<"Scrollbar", {
|
|
215
|
+
height: string;
|
|
216
|
+
width: string;
|
|
217
|
+
borderRadius: string;
|
|
218
|
+
color: string;
|
|
219
|
+
colorHover: string;
|
|
220
|
+
railInsetHorizontalBottom: string;
|
|
221
|
+
railInsetHorizontalTop: string;
|
|
222
|
+
railInsetVerticalRight: string;
|
|
223
|
+
railInsetVerticalLeft: string;
|
|
224
|
+
railColor: string;
|
|
225
|
+
}, any>;
|
|
226
|
+
}>;
|
|
144
227
|
}>;
|
|
145
228
|
}>>;
|
|
146
|
-
themeOverrides:
|
|
229
|
+
themeOverrides: PropType<import("../../_mixins/use-theme").ExtractThemeOverrides<import("../../_mixins").Theme<"Image", {
|
|
147
230
|
toolbarIconColor: string;
|
|
148
231
|
toolbarColor: string;
|
|
149
232
|
toolbarBoxShadow: string;
|
|
@@ -169,10 +252,23 @@ declare const _default: import("vue").DefineComponent<import("vue").ExtractPropT
|
|
|
169
252
|
arrowOffsetVertical: string;
|
|
170
253
|
arrowHeight: string;
|
|
171
254
|
padding: string;
|
|
172
|
-
},
|
|
255
|
+
}, {
|
|
256
|
+
Scrollbar: import("../../_mixins").Theme<"Scrollbar", {
|
|
257
|
+
height: string;
|
|
258
|
+
width: string;
|
|
259
|
+
borderRadius: string;
|
|
260
|
+
color: string;
|
|
261
|
+
colorHover: string;
|
|
262
|
+
railInsetHorizontalBottom: string;
|
|
263
|
+
railInsetHorizontalTop: string;
|
|
264
|
+
railInsetVerticalRight: string;
|
|
265
|
+
railInsetVerticalLeft: string;
|
|
266
|
+
railColor: string;
|
|
267
|
+
}, any>;
|
|
268
|
+
}>;
|
|
173
269
|
}>;
|
|
174
270
|
}>>>;
|
|
175
|
-
builtinThemeOverrides:
|
|
271
|
+
builtinThemeOverrides: PropType<import("../../_mixins/use-theme").ExtractThemeOverrides<import("../../_mixins").Theme<"Image", {
|
|
176
272
|
toolbarIconColor: string;
|
|
177
273
|
toolbarColor: string;
|
|
178
274
|
toolbarBoxShadow: string;
|
|
@@ -198,32 +294,59 @@ declare const _default: import("vue").DefineComponent<import("vue").ExtractPropT
|
|
|
198
294
|
arrowOffsetVertical: string;
|
|
199
295
|
arrowHeight: string;
|
|
200
296
|
padding: string;
|
|
201
|
-
},
|
|
297
|
+
}, {
|
|
298
|
+
Scrollbar: import("../../_mixins").Theme<"Scrollbar", {
|
|
299
|
+
height: string;
|
|
300
|
+
width: string;
|
|
301
|
+
borderRadius: string;
|
|
302
|
+
color: string;
|
|
303
|
+
colorHover: string;
|
|
304
|
+
railInsetHorizontalBottom: string;
|
|
305
|
+
railInsetHorizontalTop: string;
|
|
306
|
+
railInsetVerticalRight: string;
|
|
307
|
+
railInsetVerticalLeft: string;
|
|
308
|
+
railColor: string;
|
|
309
|
+
}, any>;
|
|
310
|
+
}>;
|
|
202
311
|
}>;
|
|
203
312
|
}>>>;
|
|
204
313
|
}>, {
|
|
205
314
|
mergedClsPrefix: Ref<string, string>;
|
|
206
315
|
previewInstRef: Ref<{
|
|
207
316
|
setThumbnailEl: (e: HTMLImageElement | null) => void;
|
|
208
|
-
setPreviewSrc: (src?: string) => void;
|
|
209
|
-
toggleShow: () => void;
|
|
210
317
|
} | null, ImagePreviewInst | {
|
|
211
318
|
setThumbnailEl: (e: HTMLImageElement | null) => void;
|
|
212
|
-
setPreviewSrc: (src?: string) => void;
|
|
213
|
-
toggleShow: () => void;
|
|
214
319
|
} | null>;
|
|
320
|
+
mergedShow: import("vue").ComputedRef<boolean>;
|
|
321
|
+
src: import("vue").ComputedRef<string | undefined>;
|
|
322
|
+
onClose: () => void;
|
|
215
323
|
next: () => void;
|
|
216
324
|
prev: () => void;
|
|
217
325
|
}, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {}, string, import("vue").PublicProps, Readonly<import("vue").ExtractPropTypes<{
|
|
218
|
-
|
|
219
|
-
|
|
326
|
+
srcList: PropType<string[]>;
|
|
327
|
+
current: NumberConstructor;
|
|
328
|
+
defaultCurrent: {
|
|
329
|
+
type: NumberConstructor;
|
|
330
|
+
default: number;
|
|
331
|
+
};
|
|
332
|
+
show: {
|
|
333
|
+
type: BooleanConstructor;
|
|
334
|
+
default: undefined;
|
|
335
|
+
};
|
|
336
|
+
defaultShow: BooleanConstructor;
|
|
337
|
+
onUpdateShow: PropType<MaybeArray<(show: boolean) => void>>;
|
|
338
|
+
'onUpdate:show': PropType<MaybeArray<(show: boolean) => void>>;
|
|
339
|
+
onUpdateCurrent: PropType<MaybeArray<(current: number) => void>>;
|
|
340
|
+
'onUpdate:current': PropType<MaybeArray<(current: number) => void>>;
|
|
341
|
+
onPreviewPrev: PropType<() => void>;
|
|
342
|
+
onPreviewNext: PropType<() => void>;
|
|
220
343
|
showToolbar: {
|
|
221
344
|
type: BooleanConstructor;
|
|
222
345
|
default: boolean;
|
|
223
346
|
};
|
|
224
347
|
showToolbarTooltip: BooleanConstructor;
|
|
225
|
-
renderToolbar:
|
|
226
|
-
theme:
|
|
348
|
+
renderToolbar: PropType<ImageRenderToolbar>;
|
|
349
|
+
theme: PropType<import("../../_mixins").Theme<"Image", {
|
|
227
350
|
toolbarIconColor: string;
|
|
228
351
|
toolbarColor: string;
|
|
229
352
|
toolbarBoxShadow: string;
|
|
@@ -249,10 +372,23 @@ declare const _default: import("vue").DefineComponent<import("vue").ExtractPropT
|
|
|
249
372
|
arrowOffsetVertical: string;
|
|
250
373
|
arrowHeight: string;
|
|
251
374
|
padding: string;
|
|
252
|
-
},
|
|
375
|
+
}, {
|
|
376
|
+
Scrollbar: import("../../_mixins").Theme<"Scrollbar", {
|
|
377
|
+
height: string;
|
|
378
|
+
width: string;
|
|
379
|
+
borderRadius: string;
|
|
380
|
+
color: string;
|
|
381
|
+
colorHover: string;
|
|
382
|
+
railInsetHorizontalBottom: string;
|
|
383
|
+
railInsetHorizontalTop: string;
|
|
384
|
+
railInsetVerticalRight: string;
|
|
385
|
+
railInsetVerticalLeft: string;
|
|
386
|
+
railColor: string;
|
|
387
|
+
}, any>;
|
|
388
|
+
}>;
|
|
253
389
|
}>;
|
|
254
390
|
}>>;
|
|
255
|
-
themeOverrides:
|
|
391
|
+
themeOverrides: PropType<import("../../_mixins/use-theme").ExtractThemeOverrides<import("../../_mixins").Theme<"Image", {
|
|
256
392
|
toolbarIconColor: string;
|
|
257
393
|
toolbarColor: string;
|
|
258
394
|
toolbarBoxShadow: string;
|
|
@@ -278,10 +414,23 @@ declare const _default: import("vue").DefineComponent<import("vue").ExtractPropT
|
|
|
278
414
|
arrowOffsetVertical: string;
|
|
279
415
|
arrowHeight: string;
|
|
280
416
|
padding: string;
|
|
281
|
-
},
|
|
417
|
+
}, {
|
|
418
|
+
Scrollbar: import("../../_mixins").Theme<"Scrollbar", {
|
|
419
|
+
height: string;
|
|
420
|
+
width: string;
|
|
421
|
+
borderRadius: string;
|
|
422
|
+
color: string;
|
|
423
|
+
colorHover: string;
|
|
424
|
+
railInsetHorizontalBottom: string;
|
|
425
|
+
railInsetHorizontalTop: string;
|
|
426
|
+
railInsetVerticalRight: string;
|
|
427
|
+
railInsetVerticalLeft: string;
|
|
428
|
+
railColor: string;
|
|
429
|
+
}, any>;
|
|
430
|
+
}>;
|
|
282
431
|
}>;
|
|
283
432
|
}>>>;
|
|
284
|
-
builtinThemeOverrides:
|
|
433
|
+
builtinThemeOverrides: PropType<import("../../_mixins/use-theme").ExtractThemeOverrides<import("../../_mixins").Theme<"Image", {
|
|
285
434
|
toolbarIconColor: string;
|
|
286
435
|
toolbarColor: string;
|
|
287
436
|
toolbarBoxShadow: string;
|
|
@@ -307,11 +456,27 @@ declare const _default: import("vue").DefineComponent<import("vue").ExtractPropT
|
|
|
307
456
|
arrowOffsetVertical: string;
|
|
308
457
|
arrowHeight: string;
|
|
309
458
|
padding: string;
|
|
310
|
-
},
|
|
459
|
+
}, {
|
|
460
|
+
Scrollbar: import("../../_mixins").Theme<"Scrollbar", {
|
|
461
|
+
height: string;
|
|
462
|
+
width: string;
|
|
463
|
+
borderRadius: string;
|
|
464
|
+
color: string;
|
|
465
|
+
colorHover: string;
|
|
466
|
+
railInsetHorizontalBottom: string;
|
|
467
|
+
railInsetHorizontalTop: string;
|
|
468
|
+
railInsetVerticalRight: string;
|
|
469
|
+
railInsetVerticalLeft: string;
|
|
470
|
+
railColor: string;
|
|
471
|
+
}, any>;
|
|
472
|
+
}>;
|
|
311
473
|
}>;
|
|
312
474
|
}>>>;
|
|
313
475
|
}>> & Readonly<{}>, {
|
|
476
|
+
show: boolean;
|
|
477
|
+
defaultShow: boolean;
|
|
314
478
|
showToolbar: boolean;
|
|
315
479
|
showToolbarTooltip: boolean;
|
|
480
|
+
defaultCurrent: number;
|
|
316
481
|
}, {}, {}, {}, string, import("vue").ComponentProvideOptions, true, {}, any>;
|
|
317
482
|
export default _default;
|
|
@@ -1,56 +1,155 @@
|
|
|
1
1
|
import { createId } from 'seemly';
|
|
2
|
-
import {
|
|
2
|
+
import { useMergedState } from 'vooks';
|
|
3
|
+
import { computed, defineComponent, h, provide, ref, toRef } from 'vue';
|
|
3
4
|
import { useConfig } from "../../_mixins/index.mjs";
|
|
4
|
-
import { createInjectionKey } from "../../_utils/index.mjs";
|
|
5
|
+
import { call, createInjectionKey, throwError } from "../../_utils/index.mjs";
|
|
5
6
|
import NImagePreview from "./ImagePreview.mjs";
|
|
6
7
|
import { imagePreviewSharedProps } from "./interface.mjs";
|
|
7
8
|
export const imageGroupInjectionKey = createInjectionKey('n-image-group');
|
|
8
|
-
export const imageGroupProps = imagePreviewSharedProps
|
|
9
|
+
export const imageGroupProps = Object.assign(Object.assign({}, imagePreviewSharedProps), {
|
|
10
|
+
srcList: Array,
|
|
11
|
+
current: Number,
|
|
12
|
+
defaultCurrent: {
|
|
13
|
+
type: Number,
|
|
14
|
+
default: 0
|
|
15
|
+
},
|
|
16
|
+
show: {
|
|
17
|
+
type: Boolean,
|
|
18
|
+
default: undefined
|
|
19
|
+
},
|
|
20
|
+
defaultShow: Boolean,
|
|
21
|
+
onUpdateShow: [Function, Array],
|
|
22
|
+
'onUpdate:show': [Function, Array],
|
|
23
|
+
onUpdateCurrent: [Function, Array],
|
|
24
|
+
'onUpdate:current': [Function, Array]
|
|
25
|
+
});
|
|
9
26
|
export default defineComponent({
|
|
10
27
|
name: 'ImageGroup',
|
|
11
28
|
props: imageGroupProps,
|
|
12
29
|
setup(props) {
|
|
13
|
-
let currentSrc;
|
|
14
30
|
const {
|
|
15
31
|
mergedClsPrefixRef
|
|
16
32
|
} = useConfig(props);
|
|
17
33
|
const groupId = `c${createId()}`;
|
|
18
|
-
const vm = getCurrentInstance();
|
|
19
34
|
const previewInstRef = ref(null);
|
|
20
|
-
const
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
35
|
+
const uncontrolledShowRef = ref(props.defaultShow);
|
|
36
|
+
const controlledShowRef = toRef(props, 'show');
|
|
37
|
+
const mergedShowRef = useMergedState(controlledShowRef, uncontrolledShowRef);
|
|
38
|
+
const registeredImageUrlMap = ref(new Map());
|
|
39
|
+
const mergedImageUrlMap = computed(() => {
|
|
40
|
+
if (props.srcList) {
|
|
41
|
+
const map = new Map();
|
|
42
|
+
props.srcList.forEach((url, index) => {
|
|
43
|
+
map.set(`p${index}`, url);
|
|
44
|
+
});
|
|
45
|
+
return map;
|
|
46
|
+
}
|
|
47
|
+
return registeredImageUrlMap.value;
|
|
48
|
+
});
|
|
49
|
+
const imageIdListRef = computed(() => Array.from(mergedImageUrlMap.value.keys()));
|
|
50
|
+
const imageCountGetter = () => imageIdListRef.value.length;
|
|
51
|
+
function registerImageUrl(id, url) {
|
|
52
|
+
if (props.srcList) {
|
|
53
|
+
throwError('image-group', '`n-image` can\'t be placed inside `n-image-group` when image group\'s `src-list` prop is set.');
|
|
54
|
+
}
|
|
55
|
+
const sid = `r${id}`;
|
|
56
|
+
if (!registeredImageUrlMap.value.has(`r${sid}`)) {
|
|
57
|
+
registeredImageUrlMap.value.set(sid, url);
|
|
58
|
+
}
|
|
59
|
+
return function unregisterPreviewUrl() {
|
|
60
|
+
if (!registeredImageUrlMap.value.has(sid)) {
|
|
61
|
+
registeredImageUrlMap.value.delete(sid);
|
|
62
|
+
}
|
|
63
|
+
};
|
|
64
|
+
}
|
|
65
|
+
const uncontrolledCurrentRef = ref(props.defaultCurrent);
|
|
66
|
+
const controlledCurrentRef = toRef(props, 'current');
|
|
67
|
+
const mergedCurrentRef = useMergedState(controlledCurrentRef, uncontrolledCurrentRef);
|
|
68
|
+
const setCurrentIndex = index => {
|
|
69
|
+
if (index !== mergedCurrentRef.value) {
|
|
70
|
+
const {
|
|
71
|
+
onUpdateCurrent,
|
|
72
|
+
'onUpdate:current': _onUpdateCurrent
|
|
73
|
+
} = props;
|
|
74
|
+
if (onUpdateCurrent) {
|
|
75
|
+
call(onUpdateCurrent, index);
|
|
76
|
+
}
|
|
77
|
+
if (_onUpdateCurrent) {
|
|
78
|
+
call(_onUpdateCurrent, index);
|
|
79
|
+
}
|
|
80
|
+
uncontrolledCurrentRef.value = index;
|
|
81
|
+
}
|
|
82
|
+
};
|
|
83
|
+
const currentId = computed(() => imageIdListRef.value[mergedCurrentRef.value]);
|
|
84
|
+
const setCurrentId = nextId => {
|
|
85
|
+
const nextIndex = imageIdListRef.value.indexOf(nextId);
|
|
86
|
+
if (nextIndex !== mergedCurrentRef.value) {
|
|
87
|
+
setCurrentIndex(nextIndex);
|
|
88
|
+
}
|
|
24
89
|
};
|
|
90
|
+
const currentUrl = computed(() => mergedImageUrlMap.value.get(currentId.value));
|
|
91
|
+
function doUpdateShow(value) {
|
|
92
|
+
const {
|
|
93
|
+
onUpdateShow,
|
|
94
|
+
'onUpdate:show': _onUpdateShow
|
|
95
|
+
} = props;
|
|
96
|
+
if (onUpdateShow) {
|
|
97
|
+
call(onUpdateShow, value);
|
|
98
|
+
}
|
|
99
|
+
if (_onUpdateShow) {
|
|
100
|
+
call(_onUpdateShow, value);
|
|
101
|
+
}
|
|
102
|
+
uncontrolledShowRef.value = value;
|
|
103
|
+
}
|
|
104
|
+
function onClose() {
|
|
105
|
+
doUpdateShow(false);
|
|
106
|
+
}
|
|
107
|
+
const nextIndex = computed(() => {
|
|
108
|
+
const findNext = (start, end) => {
|
|
109
|
+
for (let i = start; i <= end; i++) {
|
|
110
|
+
const id = imageIdListRef.value[i];
|
|
111
|
+
if (mergedImageUrlMap.value.get(id)) {
|
|
112
|
+
return i;
|
|
113
|
+
}
|
|
114
|
+
}
|
|
115
|
+
return undefined;
|
|
116
|
+
};
|
|
117
|
+
const next = findNext(mergedCurrentRef.value + 1, imageCountGetter() - 1);
|
|
118
|
+
return next === undefined ? findNext(0, mergedCurrentRef.value - 1) : next;
|
|
119
|
+
});
|
|
120
|
+
const prevIndex = computed(() => {
|
|
121
|
+
const findPrev = (start, end) => {
|
|
122
|
+
for (let i = start; i >= end; i--) {
|
|
123
|
+
const id = imageIdListRef.value[i];
|
|
124
|
+
if (mergedImageUrlMap.value.get(id)) {
|
|
125
|
+
return i;
|
|
126
|
+
}
|
|
127
|
+
}
|
|
128
|
+
return undefined;
|
|
129
|
+
};
|
|
130
|
+
const prev = findPrev(mergedCurrentRef.value - 1, 0);
|
|
131
|
+
return prev === undefined ? findPrev(imageCountGetter() - 1, mergedCurrentRef.value + 1) : prev;
|
|
132
|
+
});
|
|
25
133
|
function go(step) {
|
|
26
134
|
var _a, _b;
|
|
27
|
-
if (!(vm === null || vm === void 0 ? void 0 : vm.proxy)) return;
|
|
28
|
-
const container = vm.proxy.$el.parentElement;
|
|
29
|
-
// use dom api since we can't get the correct order before all children are rendered
|
|
30
|
-
const imgs = container.querySelectorAll(`[data-group-id=${groupId}]:not([data-error=true])`);
|
|
31
|
-
if (!imgs.length) return;
|
|
32
|
-
const index = Array.from(imgs).findIndex(img => img.dataset.previewSrc === currentSrc);
|
|
33
|
-
if (~index) {
|
|
34
|
-
setPreviewSrc(imgs[(index + step + imgs.length) % imgs.length].dataset.previewSrc);
|
|
35
|
-
} else {
|
|
36
|
-
setPreviewSrc(imgs[0].dataset.previewSrc);
|
|
37
|
-
}
|
|
38
135
|
if (step === 1) {
|
|
136
|
+
prevIndex.value !== undefined && setCurrentIndex(nextIndex.value);
|
|
39
137
|
(_a = props.onPreviewNext) === null || _a === void 0 ? void 0 : _a.call(props);
|
|
40
138
|
} else {
|
|
139
|
+
nextIndex.value !== undefined && setCurrentIndex(prevIndex.value);
|
|
41
140
|
(_b = props.onPreviewPrev) === null || _b === void 0 ? void 0 : _b.call(props);
|
|
42
141
|
}
|
|
43
142
|
}
|
|
44
143
|
provide(imageGroupInjectionKey, {
|
|
45
144
|
mergedClsPrefixRef,
|
|
46
|
-
|
|
145
|
+
registerImageUrl,
|
|
47
146
|
setThumbnailEl: el => {
|
|
48
147
|
var _a;
|
|
49
148
|
(_a = previewInstRef.value) === null || _a === void 0 ? void 0 : _a.setThumbnailEl(el);
|
|
50
149
|
},
|
|
51
|
-
toggleShow:
|
|
52
|
-
|
|
53
|
-
(
|
|
150
|
+
toggleShow: imageId => {
|
|
151
|
+
doUpdateShow(true);
|
|
152
|
+
setCurrentId(imageId);
|
|
54
153
|
},
|
|
55
154
|
groupId,
|
|
56
155
|
renderToolbarRef: toRef(props, 'renderToolbar')
|
|
@@ -58,6 +157,9 @@ export default defineComponent({
|
|
|
58
157
|
return {
|
|
59
158
|
mergedClsPrefix: mergedClsPrefixRef,
|
|
60
159
|
previewInstRef,
|
|
160
|
+
mergedShow: mergedShowRef,
|
|
161
|
+
src: currentUrl,
|
|
162
|
+
onClose,
|
|
61
163
|
next: () => {
|
|
62
164
|
go(1);
|
|
63
165
|
},
|
|
@@ -70,13 +172,15 @@ export default defineComponent({
|
|
|
70
172
|
return h(NImagePreview, {
|
|
71
173
|
theme: this.theme,
|
|
72
174
|
themeOverrides: this.themeOverrides,
|
|
73
|
-
clsPrefix: this.mergedClsPrefix,
|
|
74
175
|
ref: "previewInstRef",
|
|
75
176
|
onPrev: this.prev,
|
|
76
177
|
onNext: this.next,
|
|
178
|
+
src: this.src,
|
|
179
|
+
show: this.mergedShow,
|
|
77
180
|
showToolbar: this.showToolbar,
|
|
78
181
|
showToolbarTooltip: this.showToolbarTooltip,
|
|
79
|
-
renderToolbar: this.renderToolbar
|
|
182
|
+
renderToolbar: this.renderToolbar,
|
|
183
|
+
onClose: this.onClose
|
|
80
184
|
}, this.$slots);
|
|
81
185
|
}
|
|
82
186
|
});
|