foucui 1.0.1
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/README.md +43 -0
- package/components/QiuAffix/index.vue +186 -0
- package/components/QiuAlert/index.vue +208 -0
- package/components/QiuAnchor/context.ts +18 -0
- package/components/QiuAnchor/index.vue +180 -0
- package/components/QiuAnchorLink/index.vue +67 -0
- package/components/QiuApp/index.vue +9 -0
- package/components/QiuAutocomplete/index.vue +408 -0
- package/components/QiuAvatar/index.vue +140 -0
- package/components/QiuBacktop/index.vue +121 -0
- package/components/QiuBadge/api/index.ts +389 -0
- package/components/QiuBadge/components/BadgeImagePickerDialog.vue +243 -0
- package/components/QiuBadge/components/BadgeLibraryManagerDialog.vue +30 -0
- package/components/QiuBadge/components/BadgeLibraryPanel.vue +182 -0
- package/components/QiuBadge/composables/useTableHostHeight.ts +53 -0
- package/components/QiuBadge/index.ts +18 -0
- package/components/QiuBadge/shared/BadgeTemplateRenderer.vue +32 -0
- package/components/QiuBadge/shared/assetUrl.ts +26 -0
- package/components/QiuBadge/shared/badgeTemplate.ts +309 -0
- package/components/QiuBadge/utils/chinaAreaData.ts +44 -0
- package/components/QiuBadge/utils/hostRegion.ts +22 -0
- package/components/QiuBadge/utils/pca-code.json +1 -0
- package/components/QiuBadge/utils/pdfFromElement.ts +348 -0
- package/components/QiuBadge/views/BadgeLibraryView.vue +32 -0
- package/components/QiuBadge/views/BadgeManageView.vue +1364 -0
- package/components/QiuBadge/views/BadgeTemplateEditorView.vue +10 -0
- package/components/QiuBadge/views/BadgeTemplateListView.vue +229 -0
- package/components/QiuBadge/views/DeskLabelTemplateListView.vue +227 -0
- package/components/QiuBadge/views/DeskLabelView.vue +683 -0
- package/components/QiuBadgeDot/index.vue +87 -0
- package/components/QiuButton/index.vue +247 -0
- package/components/QiuButtonGroup/index.vue +63 -0
- package/components/QiuCanvasKit/QiuCanvasEditor.vue +5503 -0
- package/components/QiuCanvasKit/QiuCanvasRenderer.vue +348 -0
- package/components/QiuCanvasKit/assetUrl.ts +11 -0
- package/components/QiuCanvasKit/components/DataModulesPanel.vue +352 -0
- package/components/QiuCanvasKit/export/html.ts +132 -0
- package/components/QiuCanvasKit/export/pdf.ts +48 -0
- package/components/QiuCanvasKit/export/png.ts +50 -0
- package/components/QiuCanvasKit/index.ts +20 -0
- package/components/QiuCanvasKit/modules/badgeCompat.ts +84 -0
- package/components/QiuCanvasKit/modules/dataRegistry.ts +207 -0
- package/components/QiuCanvasKit/modules/merge.ts +71 -0
- package/components/QiuCanvasKit/presets/badge.ts +67 -0
- package/components/QiuCanvasKit/presets/banner.ts +79 -0
- package/components/QiuCanvasKit/types.ts +138 -0
- package/components/QiuCard/index.vue +104 -0
- package/components/QiuCarousel/context.ts +16 -0
- package/components/QiuCarousel/index.vue +343 -0
- package/components/QiuCarouselItem/index.vue +47 -0
- package/components/QiuCascader/index.vue +879 -0
- package/components/QiuCascader/types.ts +48 -0
- package/components/QiuCheckbox/QiuCheckboxGroup.vue +78 -0
- package/components/QiuCheckbox/index.vue +231 -0
- package/components/QiuCheckbox/types.ts +8 -0
- package/components/QiuCode/index.vue +64 -0
- package/components/QiuCol/col.scss +55 -0
- package/components/QiuCol/index.vue +64 -0
- package/components/QiuCollapse/context.ts +10 -0
- package/components/QiuCollapse/index.vue +70 -0
- package/components/QiuCollapseItem/index.vue +167 -0
- package/components/QiuColorField/index.vue +296 -0
- package/components/QiuColorPicker/README.md +118 -0
- package/components/QiuColorPicker/index.vue +60 -0
- package/components/QiuColorfulCard/index.vue +101 -0
- package/components/QiuCombobox/index.vue +277 -0
- package/components/QiuConfigProvider/index.vue +31 -0
- package/components/QiuContextMenu/index.vue +209 -0
- package/components/QiuDate/index.vue +1134 -0
- package/components/QiuDescriptions/context.ts +20 -0
- package/components/QiuDescriptions/index.vue +115 -0
- package/components/QiuDescriptionsItem/index.vue +103 -0
- package/components/QiuDialog/index.vue +828 -0
- package/components/QiuDigitalCard/index.vue +159 -0
- package/components/QiuDivider/index.vue +185 -0
- package/components/QiuDot/index.vue +83 -0
- package/components/QiuDrawer/index.vue +350 -0
- package/components/QiuDropdown/QiuDropdownItem.vue +74 -0
- package/components/QiuDropdown/QiuDropdownMenu.vue +22 -0
- package/components/QiuDropdown/context.ts +9 -0
- package/components/QiuDropdown/index.vue +189 -0
- package/components/QiuEmpty/index.vue +73 -0
- package/components/QiuForm/index.vue +172 -0
- package/components/QiuForm/types.ts +39 -0
- package/components/QiuFormItem/index.vue +276 -0
- package/components/QiuFullscreen/index.vue +11 -0
- package/components/QiuGrid/index.vue +408 -0
- package/components/QiuHoverCard/index.vue +192 -0
- package/components/QiuIcon/index.vue +117 -0
- package/components/QiuIconPicker/iconify.libraries.ts +182 -0
- package/components/QiuIconPicker/icons.catalog.ts +3072 -0
- package/components/QiuIconPicker/index.vue +488 -0
- package/components/QiuImage/index.vue +177 -0
- package/components/QiuInput/index.vue +328 -0
- package/components/QiuInputNumber/index.vue +295 -0
- package/components/QiuInputOtp/index.vue +190 -0
- package/components/QiuKbd/index.vue +57 -0
- package/components/QiuLayoutContainer/index.vue +50 -0
- package/components/QiuLinkPreview/index.vue +224 -0
- package/components/QiuLoading/index.ts +176 -0
- package/components/QiuLoading/spinner.vue +820 -0
- package/components/QiuLoading/types.ts +44 -0
- package/components/QiuMention/index.vue +299 -0
- package/components/QiuMenu/QiuMenuRoot.vue +241 -0
- package/components/QiuMenu/components/QiuMenuItem.vue +340 -0
- package/components/QiuMenu/components/QiuSubMenu.vue +504 -0
- package/components/QiuMenu/context.ts +21 -0
- package/components/QiuMenu/index.vue +43 -0
- package/components/QiuMenuNav/QiuMenuNavItem.vue +100 -0
- package/components/QiuMenuNav/QiuMenuNavSub.vue +120 -0
- package/components/QiuMenuNav/context.ts +14 -0
- package/components/QiuMenuNav/index.vue +148 -0
- package/components/QiuMsg/QiuMsgItem.vue +180 -0
- package/components/QiuMsg/index.ts +158 -0
- package/components/QiuMsg/types.ts +23 -0
- package/components/QiuMsgBox/index.ts +147 -0
- package/components/QiuNotification/QiuNotificationItem.vue +168 -0
- package/components/QiuNotification/index.ts +155 -0
- package/components/QiuNotification/types.ts +14 -0
- package/components/QiuPage/index.vue +12 -0
- package/components/QiuPageHeader/index.vue +115 -0
- package/components/QiuPageMain/index.vue +78 -0
- package/components/QiuPagination/index.vue +421 -0
- package/components/QiuPasswordStrength/index.vue +101 -0
- package/components/QiuPopconfirm/index.vue +196 -0
- package/components/QiuPopover/index.vue +277 -0
- package/components/QiuProgress/index.vue +235 -0
- package/components/QiuQrcode/index.vue +302 -0
- package/components/QiuQueryForm/components/QiuQueryFormBottomPanel.vue +13 -0
- package/components/QiuQueryForm/components/QiuQueryFormLeftPanel.vue +37 -0
- package/components/QiuQueryForm/components/QiuQueryFormRightPanel.vue +37 -0
- package/components/QiuQueryForm/components/QiuQueryFormTopPanel.vue +13 -0
- package/components/QiuQueryForm/index.vue +117 -0
- package/components/QiuRadio/QiuRadioGroup.vue +75 -0
- package/components/QiuRadio/index.vue +191 -0
- package/components/QiuRadio/types.ts +9 -0
- package/components/QiuRate/index.vue +184 -0
- package/components/QiuRefresh/index.vue +32 -0
- package/components/QiuResult/index.vue +103 -0
- package/components/QiuRow/index.vue +60 -0
- package/components/QiuRow/types.ts +5 -0
- package/components/QiuScrollbar/index.vue +107 -0
- package/components/QiuSearchBar/index.vue +154 -0
- package/components/QiuSegmented/index.vue +120 -0
- package/components/QiuSelect/QiuOption.vue +93 -0
- package/components/QiuSelect/index.vue +452 -0
- package/components/QiuSelect/types.ts +15 -0
- package/components/QiuSkeleton/index.vue +78 -0
- package/components/QiuSlider/index.vue +266 -0
- package/components/QiuSpace/index.vue +95 -0
- package/components/QiuSparkline/index.vue +92 -0
- package/components/QiuStatistic/index.vue +4 -0
- package/components/QiuStatistics/index.vue +123 -0
- package/components/QiuStep/index.vue +220 -0
- package/components/QiuSteps/context.ts +25 -0
- package/components/QiuSteps/index.vue +84 -0
- package/components/QiuSwitch/index.vue +145 -0
- package/components/QiuTabBar/index.vue +218 -0
- package/components/QiuTabBar/types.ts +19 -0
- package/components/QiuTabPane/index.vue +82 -0
- package/components/QiuTable/columns.ts +16 -0
- package/components/QiuTable/export.ts +102 -0
- package/components/QiuTable/index.ts +24 -0
- package/components/QiuTable/index.vue +3503 -0
- package/components/QiuTable/registry.ts +75 -0
- package/components/QiuTable/styles/table.scss +1230 -0
- package/components/QiuTable/types.ts +413 -0
- package/components/QiuTable/useArea.ts +202 -0
- package/components/QiuTable/useColumns.ts +325 -0
- package/components/QiuTable/useEdit.ts +136 -0
- package/components/QiuTable/useExtras.ts +115 -0
- package/components/QiuTable/useHistory.ts +77 -0
- package/components/QiuTable/useMerge.ts +105 -0
- package/components/QiuTable/useResize.ts +86 -0
- package/components/QiuTable/useScrollSync.ts +152 -0
- package/components/QiuTable/useVirtual.ts +97 -0
- package/components/QiuTable/utils.ts +165 -0
- package/components/QiuTableColumn/index.vue +101 -0
- package/components/QiuTag/index.vue +143 -0
- package/components/QiuText/index.vue +99 -0
- package/components/QiuTime/index.vue +548 -0
- package/components/QiuTimeAgo/index.vue +103 -0
- package/components/QiuTimeline/index.vue +54 -0
- package/components/QiuTimelineItem/index.vue +140 -0
- package/components/QiuTips/index.vue +323 -0
- package/components/QiuTooltip/index.vue +237 -0
- package/components/QiuTransfer/index.vue +277 -0
- package/components/QiuTree/QiuTreeNode.vue +146 -0
- package/components/QiuTree/index.vue +143 -0
- package/components/QiuTree/types.ts +30 -0
- package/components/QiuTreeSelect/index.vue +259 -0
- package/components/QiuTrend/index.vue +92 -0
- package/components/QiuUpload/index.vue +628 -0
- package/components/QiuUploadCrop/index.vue +1267 -0
- package/components/QiuWatermark/index.vue +121 -0
- package/components/useBodyScrollLock.ts +28 -0
- package/dist/components/QiuAnchor/context.d.ts +15 -0
- package/dist/components/QiuAnchorLink/index.vue.d.ts +23 -0
- package/dist/components/QiuBadge/api/index.d.ts +110 -0
- package/dist/components/QiuBadge/components/BadgeImagePickerDialog.vue.d.ts +16 -0
- package/dist/components/QiuBadge/components/BadgeLibraryManagerDialog.vue.d.ts +9 -0
- package/dist/components/QiuBadge/components/BadgeLibraryPanel.vue.d.ts +5 -0
- package/dist/components/QiuBadge/composables/useTableHostHeight.d.ts +7 -0
- package/dist/components/QiuBadge/index.d.ts +18 -0
- package/dist/components/QiuBadge/shared/BadgeTemplateRenderer.vue.d.ts +14 -0
- package/dist/components/QiuBadge/shared/assetUrl.d.ts +1 -0
- package/dist/components/QiuBadge/shared/badgeTemplate.d.ts +132 -0
- package/dist/components/QiuBadge/utils/chinaAreaData.d.ts +9 -0
- package/dist/components/QiuBadge/utils/hostRegion.d.ts +3 -0
- package/dist/components/QiuBadge/utils/pca-code.json.d.ts +3 -0
- package/dist/components/QiuBadge/utils/pdfFromElement.d.ts +14 -0
- package/dist/components/QiuBadge/views/BadgeLibraryView.vue.d.ts +2 -0
- package/dist/components/QiuBadge/views/BadgeManageView.vue.d.ts +7 -0
- package/dist/components/QiuBadge/views/BadgeTemplateListView.vue.d.ts +4 -0
- package/dist/components/QiuBadge/views/DeskLabelTemplateListView.vue.d.ts +4 -0
- package/dist/components/QiuBadge/views/DeskLabelView.vue.d.ts +4 -0
- package/dist/components/QiuButton/index.vue.d.ts +52 -0
- package/dist/components/QiuCanvasKit/QiuCanvasEditor.vue.d.ts +24 -0
- package/dist/components/QiuCanvasKit/QiuCanvasRenderer.vue.d.ts +13 -0
- package/dist/components/QiuCanvasKit/assetUrl.d.ts +7 -0
- package/dist/components/QiuCanvasKit/components/DataModulesPanel.vue.d.ts +23 -0
- package/dist/components/QiuCanvasKit/export/html.d.ts +12 -0
- package/dist/components/QiuCanvasKit/export/pdf.d.ts +9 -0
- package/dist/components/QiuCanvasKit/export/png.d.ts +8 -0
- package/dist/components/QiuCanvasKit/index.d.ts +19 -0
- package/dist/components/QiuCanvasKit/modules/badgeCompat.d.ts +8 -0
- package/dist/components/QiuCanvasKit/modules/dataRegistry.d.ts +23 -0
- package/dist/components/QiuCanvasKit/modules/merge.d.ts +12 -0
- package/dist/components/QiuCanvasKit/presets/badge.d.ts +12 -0
- package/dist/components/QiuCanvasKit/presets/banner.d.ts +4 -0
- package/dist/components/QiuCanvasKit/types.d.ts +119 -0
- package/dist/components/QiuCarousel/context.d.ts +13 -0
- package/dist/components/QiuCarouselItem/index.vue.d.ts +20 -0
- package/dist/components/QiuCascader/types.d.ts +25 -0
- package/dist/components/QiuCheckbox/QiuCheckboxGroup.vue.d.ts +33 -0
- package/dist/components/QiuCheckbox/index.vue.d.ts +38 -0
- package/dist/components/QiuCheckbox/types.d.ts +7 -0
- package/dist/components/QiuCode/index.vue.d.ts +15 -0
- package/dist/components/QiuCollapse/context.d.ts +8 -0
- package/dist/components/QiuCollapseItem/index.vue.d.ts +30 -0
- package/dist/components/QiuColorField/index.vue.d.ts +23 -0
- package/dist/components/QiuColorPicker/index.vue.d.ts +21 -0
- package/dist/components/QiuCombobox/index.vue.d.ts +54 -0
- package/dist/components/QiuContextMenu/index.vue.d.ts +46 -0
- package/dist/components/QiuDescriptions/context.d.ts +16 -0
- package/dist/components/QiuDescriptionsItem/index.vue.d.ts +25 -0
- package/dist/components/QiuDigitalCard/index.vue.d.ts +45 -0
- package/dist/components/QiuDropdown/QiuDropdownItem.vue.d.ts +30 -0
- package/dist/components/QiuDropdown/QiuDropdownMenu.vue.d.ts +17 -0
- package/dist/components/QiuDropdown/context.d.ts +7 -0
- package/dist/components/QiuDropdown/index.vue.d.ts +46 -0
- package/dist/components/QiuForm/types.d.ts +31 -0
- package/dist/components/QiuHoverCard/index.vue.d.ts +44 -0
- package/dist/components/QiuIcon/index.vue.d.ts +18 -0
- package/dist/components/QiuIconPicker/iconify.libraries.d.ts +18 -0
- package/dist/components/QiuIconPicker/icons.catalog.d.ts +12 -0
- package/dist/components/QiuInput/index.vue.d.ts +71 -0
- package/dist/components/QiuInputNumber/index.vue.d.ts +38 -0
- package/dist/components/QiuInputOtp/index.vue.d.ts +28 -0
- package/dist/components/QiuKbd/index.vue.d.ts +22 -0
- package/dist/components/QiuLayoutContainer/index.vue.d.ts +29 -0
- package/dist/components/QiuLinkPreview/index.vue.d.ts +43 -0
- package/dist/components/QiuLoading/index.d.ts +26 -0
- package/dist/components/QiuLoading/spinner.vue.d.ts +14 -0
- package/dist/components/QiuLoading/types.d.ts +2 -0
- package/dist/components/QiuMention/index.vue.d.ts +35 -0
- package/dist/components/QiuMenu/QiuMenuRoot.vue.d.ts +36 -0
- package/dist/components/QiuMenu/context.d.ts +19 -0
- package/dist/components/QiuMenuNav/QiuMenuNavItem.vue.d.ts +26 -0
- package/dist/components/QiuMenuNav/QiuMenuNavSub.vue.d.ts +25 -0
- package/dist/components/QiuMenuNav/context.d.ts +12 -0
- package/dist/components/QiuMenuNav/index.vue.d.ts +35 -0
- package/dist/components/QiuMsg/QiuMsgItem.vue.d.ts +15 -0
- package/dist/components/QiuMsg/index.d.ts +30 -0
- package/dist/components/QiuMsg/types.d.ts +12 -0
- package/dist/components/QiuMsgBox/index.d.ts +14 -0
- package/dist/components/QiuNotification/QiuNotificationItem.vue.d.ts +16 -0
- package/dist/components/QiuNotification/index.d.ts +30 -0
- package/dist/components/QiuNotification/types.d.ts +12 -0
- package/dist/components/QiuPageMain/index.vue.d.ts +27 -0
- package/dist/components/QiuPagination/index.vue.d.ts +44 -0
- package/dist/components/QiuPasswordStrength/index.vue.d.ts +9 -0
- package/dist/components/QiuQrcode/index.vue.d.ts +20 -0
- package/dist/components/QiuRadio/QiuRadioGroup.vue.d.ts +33 -0
- package/dist/components/QiuRadio/types.d.ts +8 -0
- package/dist/components/QiuRow/types.d.ts +4 -0
- package/dist/components/QiuSearchBar/index.vue.d.ts +38 -0
- package/dist/components/QiuSelect/QiuOption.vue.d.ts +24 -0
- package/dist/components/QiuSelect/index.vue.d.ts +52 -0
- package/dist/components/QiuSelect/types.d.ts +13 -0
- package/dist/components/QiuSparkline/index.vue.d.ts +18 -0
- package/dist/components/QiuStep/index.vue.d.ts +31 -0
- package/dist/components/QiuSteps/context.d.ts +21 -0
- package/dist/components/QiuSwitch/index.vue.d.ts +25 -0
- package/dist/components/QiuTabBar/index.vue.d.ts +32 -0
- package/dist/components/QiuTabBar/types.d.ts +16 -0
- package/dist/components/QiuTabPane/index.vue.d.ts +25 -0
- package/dist/components/QiuTable/columns.d.ts +1 -0
- package/dist/components/QiuTable/export.d.ts +18 -0
- package/dist/components/QiuTable/index.d.ts +3 -0
- package/dist/components/QiuTable/index.vue.d.ts +322 -0
- package/dist/components/QiuTable/registry.d.ts +39 -0
- package/dist/components/QiuTable/types.d.ts +353 -0
- package/dist/components/QiuTable/useArea.d.ts +51 -0
- package/dist/components/QiuTable/useColumns.d.ts +67 -0
- package/dist/components/QiuTable/useEdit.d.ts +36 -0
- package/dist/components/QiuTable/useExtras.d.ts +38 -0
- package/dist/components/QiuTable/useHistory.d.ts +44 -0
- package/dist/components/QiuTable/useMerge.d.ts +28 -0
- package/dist/components/QiuTable/useResize.d.ts +19 -0
- package/dist/components/QiuTable/useScrollSync.d.ts +25 -0
- package/dist/components/QiuTable/useVirtual.d.ts +30 -0
- package/dist/components/QiuTable/utils.d.ts +54 -0
- package/dist/components/QiuTime/index.vue.d.ts +43 -0
- package/dist/components/QiuTimeAgo/index.vue.d.ts +35 -0
- package/dist/components/QiuTimelineItem/index.vue.d.ts +35 -0
- package/dist/components/QiuTooltip/index.vue.d.ts +38 -0
- package/dist/components/QiuTree/types.d.ts +13 -0
- package/dist/components/QiuTrend/index.vue.d.ts +34 -0
- package/dist/components/QiuUpload/index.vue.d.ts +86 -0
- package/dist/components/QiuUploadCrop/index.vue.d.ts +136 -0
- package/dist/components/useBodyScrollLock.d.ts +4 -0
- package/dist/foucui.css +1 -0
- package/dist/foucui.js +26509 -0
- package/dist/foucui.umd.cjs +125 -0
- package/dist/index.d.ts +46 -0
- package/dist/src/bridge/@/api/media.d.ts +7 -0
- package/dist/src/bridge/@/api/notice.d.ts +5 -0
- package/dist/src/bridge/@/config/index.d.ts +29 -0
- package/dist/src/bridge/@/config/media.config.d.ts +15 -0
- package/dist/src/bridge/@/config/security.config.d.ts +7 -0
- package/dist/src/bridge/@/i18n/index.d.ts +7 -0
- package/dist/src/bridge/@/store/modules/bing.d.ts +3 -0
- package/dist/src/bridge/@/store/modules/errorLog.d.ts +3 -0
- package/dist/src/bridge/@/store/modules/media.d.ts +4 -0
- package/dist/src/bridge/@/store/modules/routes.d.ts +3 -0
- package/dist/src/bridge/@/store/modules/settings.d.ts +3 -0
- package/dist/src/bridge/@/store/modules/tabs.d.ts +3 -0
- package/dist/src/bridge/@/store/modules/user.d.ts +3 -0
- package/dist/src/bridge/@/utils/convertToCamelCase.d.ts +2 -0
- package/dist/src/bridge/@/utils/index.d.ts +5 -0
- package/dist/src/bridge/@/utils/pageTitle.d.ts +1 -0
- package/dist/src/bridge/@/utils/routes.d.ts +11 -0
- package/dist/src/bridge/@/utils/validate.d.ts +13 -0
- package/dist/src/bridge/@qiu/plugins/shortcuts.d.ts +2 -0
- package/dist/src/i18n.d.ts +2 -0
- package/package.json +83 -0
- package/plugins/qiu.ts +83 -0
- package/plugins/shortcuts.ts +69 -0
- package/src/bridge/@/api/media.ts +8 -0
- package/src/bridge/@/api/notice.ts +5 -0
- package/src/bridge/@/config/index.ts +38 -0
- package/src/bridge/@/config/media.config.ts +37 -0
- package/src/bridge/@/config/security.config.ts +8 -0
- package/src/bridge/@/i18n/index.ts +6 -0
- package/src/bridge/@/store/modules/bing.ts +9 -0
- package/src/bridge/@/store/modules/errorLog.ts +9 -0
- package/src/bridge/@/store/modules/media.ts +10 -0
- package/src/bridge/@/store/modules/routes.ts +10 -0
- package/src/bridge/@/store/modules/settings.ts +9 -0
- package/src/bridge/@/store/modules/tabs.ts +9 -0
- package/src/bridge/@/store/modules/user.ts +9 -0
- package/src/bridge/@/utils/convertToCamelCase.ts +11 -0
- package/src/bridge/@/utils/index.ts +9 -0
- package/src/bridge/@/utils/pageTitle.ts +4 -0
- package/src/bridge/@/utils/routes.ts +14 -0
- package/src/bridge/@/utils/validate.ts +17 -0
- package/src/bridge/@qiu/plugins/shortcuts.ts +3 -0
- package/src/i18n.ts +8 -0
- package/src/icons/qiu-logo.svg +1 -0
- package/styles/dark.scss +194 -0
- package/styles/normalize.css +349 -0
- package/styles/plain.scss +423 -0
- package/styles/qiu-tokens.scss +40 -0
- package/styles/qiu.scss +1149 -0
- package/styles/technology.scss +452 -0
- package/styles/var.scss +382 -0
- package/styles/variables.scss +77 -0
|
@@ -0,0 +1,488 @@
|
|
|
1
|
+
<template>
|
|
2
|
+
<div class="qiu-icon-picker">
|
|
3
|
+
<div class="qiu-icon-picker__trigger" @click="openDialog">
|
|
4
|
+
<span class="qiu-icon-picker__preview-wrap" :class="{ 'is-on': !!modelValue }">
|
|
5
|
+
<qiu-icon v-if="modelValue" :icon="modelValue" class="qiu-icon-picker__preview" />
|
|
6
|
+
<span v-else class="qiu-icon-picker__placeholder">{{ translate('选择图标') }}</span>
|
|
7
|
+
</span>
|
|
8
|
+
<qiu-input
|
|
9
|
+
:model-value="modelValue"
|
|
10
|
+
class="qiu-icon-picker__input"
|
|
11
|
+
:placeholder="placeholder"
|
|
12
|
+
clearable
|
|
13
|
+
@update:model-value="onInput"
|
|
14
|
+
@focus="openDialog"
|
|
15
|
+
@click.stop="openDialog"
|
|
16
|
+
/>
|
|
17
|
+
<qiu-button size="small" @click.stop="openDialog">
|
|
18
|
+
<qiu-icon icon="apps-2-line" />
|
|
19
|
+
</qiu-button>
|
|
20
|
+
</div>
|
|
21
|
+
|
|
22
|
+
<qiu-dialog
|
|
23
|
+
v-model="visible"
|
|
24
|
+
:title="translate('选择图标')"
|
|
25
|
+
width="920px"
|
|
26
|
+
:z-index="5300"
|
|
27
|
+
:show-minimize="false"
|
|
28
|
+
:show-fullscreen="false"
|
|
29
|
+
destroy-on-close
|
|
30
|
+
@opened="onDialogOpened"
|
|
31
|
+
>
|
|
32
|
+
<div class="qiu-icon-picker__body">
|
|
33
|
+
<qiu-loading-spinner v-if="loadingLib" class="qiu-icon-picker__loading" />
|
|
34
|
+
<aside class="qiu-icon-picker__libs">
|
|
35
|
+
<button
|
|
36
|
+
v-for="lib in libraryStats"
|
|
37
|
+
:key="lib.id"
|
|
38
|
+
type="button"
|
|
39
|
+
class="qiu-icon-picker__lib"
|
|
40
|
+
:class="{ 'is-active': activeLib === lib.id }"
|
|
41
|
+
@click="switchLib(lib.id)"
|
|
42
|
+
>
|
|
43
|
+
<strong>{{ lib.name }}</strong>
|
|
44
|
+
<span>{{ lib.count }} icons</span>
|
|
45
|
+
<em>{{ lib.license }}</em>
|
|
46
|
+
</button>
|
|
47
|
+
<p class="qiu-icon-picker__license-tip">
|
|
48
|
+
{{ translate('均为免费开源图标,可商用(按需懒加载)') }}
|
|
49
|
+
</p>
|
|
50
|
+
</aside>
|
|
51
|
+
|
|
52
|
+
<div class="qiu-icon-picker__main">
|
|
53
|
+
<qiu-input
|
|
54
|
+
v-model="keyword"
|
|
55
|
+
clearable
|
|
56
|
+
:placeholder="translate('搜索图标名')"
|
|
57
|
+
class="qiu-icon-picker__search"
|
|
58
|
+
@input="page = 1"
|
|
59
|
+
>
|
|
60
|
+
<template #prefix>
|
|
61
|
+
<qiu-icon icon="search-line" />
|
|
62
|
+
</template>
|
|
63
|
+
</qiu-input>
|
|
64
|
+
|
|
65
|
+
<div class="qiu-icon-picker__meta">
|
|
66
|
+
<span>{{ filteredIcons.length }} / {{ currentCatalog.length }}</span>
|
|
67
|
+
<span v-if="modelValue" class="qiu-icon-picker__current">
|
|
68
|
+
{{ translate('当前') }}:
|
|
69
|
+
<span class="qiu-icon-picker__current-icon">
|
|
70
|
+
<qiu-icon :icon="modelValue" />
|
|
71
|
+
</span>
|
|
72
|
+
<code>{{ modelValue }}</code>
|
|
73
|
+
</span>
|
|
74
|
+
<qiu-button v-if="modelValue" link type="danger" size="small" @click="clearIcon">
|
|
75
|
+
{{ translate('清除') }}
|
|
76
|
+
</qiu-button>
|
|
77
|
+
</div>
|
|
78
|
+
|
|
79
|
+
<div class="qiu-icon-picker__grid">
|
|
80
|
+
<button
|
|
81
|
+
type="button"
|
|
82
|
+
class="qiu-icon-picker__item is-clear"
|
|
83
|
+
:title="translate('清除图标')"
|
|
84
|
+
@click="clearIcon"
|
|
85
|
+
>
|
|
86
|
+
<qiu-icon icon="delete-bin-line" />
|
|
87
|
+
<span>{{ translate('清除') }}</span>
|
|
88
|
+
</button>
|
|
89
|
+
<button
|
|
90
|
+
v-for="name in pagedIcons"
|
|
91
|
+
:key="name"
|
|
92
|
+
type="button"
|
|
93
|
+
class="qiu-icon-picker__item"
|
|
94
|
+
:class="{ 'is-active': modelValue === toValue(name) }"
|
|
95
|
+
:title="toValue(name)"
|
|
96
|
+
@click="pick(name)"
|
|
97
|
+
>
|
|
98
|
+
<qiu-icon :icon="toValue(name)" />
|
|
99
|
+
<span>{{ name }}</span>
|
|
100
|
+
</button>
|
|
101
|
+
</div>
|
|
102
|
+
|
|
103
|
+
<qiu-empty v-if="!loadingLib && !filteredIcons.length" :description="translate('无匹配图标')" />
|
|
104
|
+
|
|
105
|
+
<div v-if="pageCount > 1" class="qiu-icon-picker__pager">
|
|
106
|
+
<qiu-pagination
|
|
107
|
+
v-model:current-page="page"
|
|
108
|
+
background
|
|
109
|
+
layout="prev, pager, next, jumper"
|
|
110
|
+
:page-size="pageSize"
|
|
111
|
+
:total="filteredIcons.length"
|
|
112
|
+
small
|
|
113
|
+
/>
|
|
114
|
+
</div>
|
|
115
|
+
</div>
|
|
116
|
+
</div>
|
|
117
|
+
</qiu-dialog>
|
|
118
|
+
</div>
|
|
119
|
+
</template>
|
|
120
|
+
|
|
121
|
+
<script lang="ts" setup>
|
|
122
|
+
import QiuLoadingSpinner from '../QiuLoading/spinner.vue'
|
|
123
|
+
import { translate } from '../../src/i18n'
|
|
124
|
+
import { remixIconCatalog } from './icons.catalog'
|
|
125
|
+
import {
|
|
126
|
+
detectLibraryId,
|
|
127
|
+
ensureIconifyLibrary,
|
|
128
|
+
iconifyLibraries,
|
|
129
|
+
toPickerValue,
|
|
130
|
+
type IconifyLibId,
|
|
131
|
+
type IconifyLibraryDef,
|
|
132
|
+
} from './iconify.libraries'
|
|
133
|
+
|
|
134
|
+
defineOptions({
|
|
135
|
+
name: 'QiuIconPicker',
|
|
136
|
+
})
|
|
137
|
+
|
|
138
|
+
const props = withDefaults(
|
|
139
|
+
defineProps<{
|
|
140
|
+
modelValue?: string
|
|
141
|
+
placeholder?: string
|
|
142
|
+
}>(),
|
|
143
|
+
{
|
|
144
|
+
modelValue: '',
|
|
145
|
+
placeholder: 'home-2-line / mdi:home',
|
|
146
|
+
}
|
|
147
|
+
)
|
|
148
|
+
|
|
149
|
+
const emit = defineEmits<{
|
|
150
|
+
'update:modelValue': [value: string]
|
|
151
|
+
}>()
|
|
152
|
+
|
|
153
|
+
const visible = ref(false)
|
|
154
|
+
const keyword = ref('')
|
|
155
|
+
const page = ref(1)
|
|
156
|
+
const pageSize = 60
|
|
157
|
+
const activeLib = ref<IconifyLibId>('remix')
|
|
158
|
+
const loadingLib = ref(false)
|
|
159
|
+
const catalogByLib = reactive<Record<string, string[]>>({
|
|
160
|
+
remix: remixIconCatalog,
|
|
161
|
+
})
|
|
162
|
+
const countByLib = reactive<Record<string, number>>({
|
|
163
|
+
remix: remixIconCatalog.length,
|
|
164
|
+
})
|
|
165
|
+
|
|
166
|
+
const currentLib = computed(
|
|
167
|
+
() => iconifyLibraries.find((l) => l.id === activeLib.value) || iconifyLibraries[0]
|
|
168
|
+
)
|
|
169
|
+
|
|
170
|
+
const libraryStats = computed(() =>
|
|
171
|
+
iconifyLibraries.map((lib) => ({
|
|
172
|
+
...lib,
|
|
173
|
+
count: countByLib[lib.id] || (lib.localRemix ? remixIconCatalog.length : '…'),
|
|
174
|
+
}))
|
|
175
|
+
)
|
|
176
|
+
|
|
177
|
+
const currentCatalog = computed(() => catalogByLib[activeLib.value] || [])
|
|
178
|
+
|
|
179
|
+
const filteredIcons = computed(() => {
|
|
180
|
+
const q = keyword.value.trim().toLowerCase()
|
|
181
|
+
if (!q) return currentCatalog.value
|
|
182
|
+
return currentCatalog.value.filter((name) => name.toLowerCase().includes(q))
|
|
183
|
+
})
|
|
184
|
+
|
|
185
|
+
const pageCount = computed(() => Math.max(1, Math.ceil(filteredIcons.value.length / pageSize)))
|
|
186
|
+
|
|
187
|
+
const pagedIcons = computed(() => {
|
|
188
|
+
const start = (page.value - 1) * pageSize
|
|
189
|
+
return filteredIcons.value.slice(start, start + pageSize)
|
|
190
|
+
})
|
|
191
|
+
|
|
192
|
+
const toValue = (iconName: string) => toPickerValue(currentLib.value, iconName)
|
|
193
|
+
|
|
194
|
+
const loadLib = async (lib: IconifyLibraryDef) => {
|
|
195
|
+
if (lib.localRemix) {
|
|
196
|
+
catalogByLib.remix = remixIconCatalog
|
|
197
|
+
countByLib.remix = remixIconCatalog.length
|
|
198
|
+
return
|
|
199
|
+
}
|
|
200
|
+
if (catalogByLib[lib.id]?.length) return
|
|
201
|
+
loadingLib.value = true
|
|
202
|
+
try {
|
|
203
|
+
const names = await ensureIconifyLibrary(lib)
|
|
204
|
+
catalogByLib[lib.id] = names
|
|
205
|
+
countByLib[lib.id] = names.length
|
|
206
|
+
} finally {
|
|
207
|
+
loadingLib.value = false
|
|
208
|
+
}
|
|
209
|
+
}
|
|
210
|
+
|
|
211
|
+
const switchLib = async (id: IconifyLibId) => {
|
|
212
|
+
activeLib.value = id
|
|
213
|
+
page.value = 1
|
|
214
|
+
keyword.value = ''
|
|
215
|
+
const lib = iconifyLibraries.find((l) => l.id === id)
|
|
216
|
+
if (lib) await loadLib(lib)
|
|
217
|
+
}
|
|
218
|
+
|
|
219
|
+
const openDialog = () => {
|
|
220
|
+
visible.value = true
|
|
221
|
+
}
|
|
222
|
+
|
|
223
|
+
const onDialogOpened = async () => {
|
|
224
|
+
activeLib.value = detectLibraryId(props.modelValue)
|
|
225
|
+
await loadLib(currentLib.value)
|
|
226
|
+
}
|
|
227
|
+
|
|
228
|
+
const pick = (name: string) => {
|
|
229
|
+
emit('update:modelValue', toValue(name))
|
|
230
|
+
visible.value = false
|
|
231
|
+
}
|
|
232
|
+
|
|
233
|
+
const clearIcon = () => {
|
|
234
|
+
emit('update:modelValue', '')
|
|
235
|
+
}
|
|
236
|
+
|
|
237
|
+
const onInput = (val: string) => {
|
|
238
|
+
emit('update:modelValue', val || '')
|
|
239
|
+
keyword.value = val?.includes(':') ? val.split(':')[1] || '' : val || ''
|
|
240
|
+
page.value = 1
|
|
241
|
+
visible.value = true
|
|
242
|
+
}
|
|
243
|
+
</script>
|
|
244
|
+
|
|
245
|
+
<style lang="scss" scoped>
|
|
246
|
+
.qiu-icon-picker {
|
|
247
|
+
width: 100%;
|
|
248
|
+
|
|
249
|
+
&__trigger {
|
|
250
|
+
display: flex;
|
|
251
|
+
gap: 8px;
|
|
252
|
+
align-items: center;
|
|
253
|
+
width: 100%;
|
|
254
|
+
}
|
|
255
|
+
|
|
256
|
+
&__preview-wrap {
|
|
257
|
+
display: inline-flex;
|
|
258
|
+
flex-shrink: 0;
|
|
259
|
+
align-items: center;
|
|
260
|
+
justify-content: center;
|
|
261
|
+
width: 36px;
|
|
262
|
+
height: 36px;
|
|
263
|
+
color: var(--qiu-text-color-secondary);
|
|
264
|
+
background: var(--qiu-fill-color-light);
|
|
265
|
+
border: 1px solid var(--qiu-border-color-lighter);
|
|
266
|
+
border-radius: 8px;
|
|
267
|
+
|
|
268
|
+
&.is-on {
|
|
269
|
+
color: var(--qiu-color-primary);
|
|
270
|
+
background: var(--qiu-color-primary-light-9);
|
|
271
|
+
border-color: color-mix(in srgb, var(--qiu-color-primary) 35%, transparent);
|
|
272
|
+
}
|
|
273
|
+
}
|
|
274
|
+
|
|
275
|
+
&__preview {
|
|
276
|
+
font-size: 20px;
|
|
277
|
+
}
|
|
278
|
+
|
|
279
|
+
&__placeholder {
|
|
280
|
+
font-size: 11px;
|
|
281
|
+
color: var(--qiu-text-color-placeholder);
|
|
282
|
+
text-align: center;
|
|
283
|
+
}
|
|
284
|
+
|
|
285
|
+
&__input {
|
|
286
|
+
flex: 1;
|
|
287
|
+
min-width: 0;
|
|
288
|
+
}
|
|
289
|
+
|
|
290
|
+
&__body {
|
|
291
|
+
position: relative;
|
|
292
|
+
display: grid;
|
|
293
|
+
grid-template-columns: 210px minmax(0, 1fr);
|
|
294
|
+
gap: 12px;
|
|
295
|
+
height: min(48vh, 420px);
|
|
296
|
+
max-height: min(48vh, 420px);
|
|
297
|
+
min-height: 280px;
|
|
298
|
+
}
|
|
299
|
+
|
|
300
|
+
&__loading {
|
|
301
|
+
position: absolute;
|
|
302
|
+
inset: 0;
|
|
303
|
+
z-index: 10;
|
|
304
|
+
pointer-events: auto;
|
|
305
|
+
}
|
|
306
|
+
|
|
307
|
+
&__libs {
|
|
308
|
+
display: flex;
|
|
309
|
+
flex-direction: column;
|
|
310
|
+
gap: 6px;
|
|
311
|
+
height: 100%;
|
|
312
|
+
min-height: 0;
|
|
313
|
+
padding: 4px;
|
|
314
|
+
overflow-x: hidden;
|
|
315
|
+
overflow-y: auto;
|
|
316
|
+
background: var(--qiu-fill-color-lighter);
|
|
317
|
+
border-radius: 8px;
|
|
318
|
+
}
|
|
319
|
+
|
|
320
|
+
&__lib {
|
|
321
|
+
display: flex;
|
|
322
|
+
flex-direction: column;
|
|
323
|
+
gap: 2px;
|
|
324
|
+
flex-shrink: 0;
|
|
325
|
+
align-items: flex-start;
|
|
326
|
+
padding: 10px 12px;
|
|
327
|
+
text-align: left;
|
|
328
|
+
cursor: pointer;
|
|
329
|
+
background: transparent;
|
|
330
|
+
border: 1px solid transparent;
|
|
331
|
+
border-radius: 8px;
|
|
332
|
+
|
|
333
|
+
strong {
|
|
334
|
+
font-size: 13px;
|
|
335
|
+
color: var(--qiu-text-color-primary);
|
|
336
|
+
}
|
|
337
|
+
|
|
338
|
+
span {
|
|
339
|
+
font-size: 12px;
|
|
340
|
+
color: var(--qiu-text-color-secondary);
|
|
341
|
+
}
|
|
342
|
+
|
|
343
|
+
em {
|
|
344
|
+
font-size: 11px;
|
|
345
|
+
font-style: normal;
|
|
346
|
+
color: var(--qiu-text-color-placeholder);
|
|
347
|
+
}
|
|
348
|
+
|
|
349
|
+
&:hover,
|
|
350
|
+
&.is-active {
|
|
351
|
+
background: var(--qiu-bg-color);
|
|
352
|
+
border-color: var(--qiu-color-primary-light-5);
|
|
353
|
+
box-shadow: 0 1px 4px rgb(0 0 0 / 6%);
|
|
354
|
+
}
|
|
355
|
+
|
|
356
|
+
&.is-active strong {
|
|
357
|
+
color: var(--qiu-color-primary);
|
|
358
|
+
}
|
|
359
|
+
}
|
|
360
|
+
|
|
361
|
+
&__license-tip {
|
|
362
|
+
flex-shrink: 0;
|
|
363
|
+
margin: 8px 4px 0;
|
|
364
|
+
font-size: 11px;
|
|
365
|
+
line-height: 1.4;
|
|
366
|
+
color: var(--qiu-text-color-placeholder);
|
|
367
|
+
}
|
|
368
|
+
|
|
369
|
+
&__main {
|
|
370
|
+
display: flex;
|
|
371
|
+
flex-direction: column;
|
|
372
|
+
height: 100%;
|
|
373
|
+
min-width: 0;
|
|
374
|
+
min-height: 0;
|
|
375
|
+
}
|
|
376
|
+
|
|
377
|
+
&__search {
|
|
378
|
+
flex-shrink: 0;
|
|
379
|
+
margin-bottom: 8px;
|
|
380
|
+
}
|
|
381
|
+
|
|
382
|
+
&__meta {
|
|
383
|
+
display: flex;
|
|
384
|
+
flex-shrink: 0;
|
|
385
|
+
flex-wrap: wrap;
|
|
386
|
+
gap: 12px;
|
|
387
|
+
align-items: center;
|
|
388
|
+
margin-bottom: 8px;
|
|
389
|
+
font-size: 12px;
|
|
390
|
+
color: var(--qiu-text-color-secondary);
|
|
391
|
+
}
|
|
392
|
+
|
|
393
|
+
&__current {
|
|
394
|
+
display: inline-flex;
|
|
395
|
+
gap: 6px;
|
|
396
|
+
align-items: center;
|
|
397
|
+
|
|
398
|
+
code {
|
|
399
|
+
font-size: 12px;
|
|
400
|
+
}
|
|
401
|
+
}
|
|
402
|
+
|
|
403
|
+
&__current-icon {
|
|
404
|
+
display: inline-flex;
|
|
405
|
+
align-items: center;
|
|
406
|
+
justify-content: center;
|
|
407
|
+
width: 26px;
|
|
408
|
+
height: 26px;
|
|
409
|
+
color: var(--qiu-color-primary);
|
|
410
|
+
background: var(--qiu-color-primary-light-9);
|
|
411
|
+
border-radius: 6px;
|
|
412
|
+
}
|
|
413
|
+
|
|
414
|
+
&__grid {
|
|
415
|
+
display: grid;
|
|
416
|
+
flex: 1 1 auto;
|
|
417
|
+
grid-template-columns: repeat(auto-fill, minmax(96px, 1fr));
|
|
418
|
+
gap: 8px;
|
|
419
|
+
align-content: start;
|
|
420
|
+
min-height: 0;
|
|
421
|
+
max-height: none;
|
|
422
|
+
padding-right: 4px;
|
|
423
|
+
overflow: auto;
|
|
424
|
+
}
|
|
425
|
+
|
|
426
|
+
&__item {
|
|
427
|
+
display: flex;
|
|
428
|
+
flex-direction: column;
|
|
429
|
+
gap: 6px;
|
|
430
|
+
align-items: center;
|
|
431
|
+
padding: 10px 6px;
|
|
432
|
+
font-size: 11px;
|
|
433
|
+
line-height: 1.2;
|
|
434
|
+
color: var(--qiu-text-color-regular);
|
|
435
|
+
cursor: pointer;
|
|
436
|
+
background: var(--qiu-fill-color-blank);
|
|
437
|
+
border: 1px solid var(--qiu-border-color-lighter);
|
|
438
|
+
border-radius: 8px;
|
|
439
|
+
transition: border-color 0.15s, background 0.15s, color 0.15s;
|
|
440
|
+
|
|
441
|
+
:deep(.qiu-icon) {
|
|
442
|
+
font-size: 22px;
|
|
443
|
+
}
|
|
444
|
+
|
|
445
|
+
span {
|
|
446
|
+
width: 100%;
|
|
447
|
+
overflow: hidden;
|
|
448
|
+
text-align: center;
|
|
449
|
+
text-overflow: ellipsis;
|
|
450
|
+
white-space: nowrap;
|
|
451
|
+
}
|
|
452
|
+
|
|
453
|
+
&:hover,
|
|
454
|
+
&.is-active {
|
|
455
|
+
color: var(--qiu-color-primary);
|
|
456
|
+
background: var(--qiu-color-primary-light-9);
|
|
457
|
+
border-color: var(--qiu-color-primary);
|
|
458
|
+
}
|
|
459
|
+
|
|
460
|
+
&.is-clear {
|
|
461
|
+
color: var(--qiu-color-danger);
|
|
462
|
+
border-style: dashed;
|
|
463
|
+
}
|
|
464
|
+
}
|
|
465
|
+
|
|
466
|
+
&__pager {
|
|
467
|
+
display: flex;
|
|
468
|
+
flex-shrink: 0;
|
|
469
|
+
justify-content: center;
|
|
470
|
+
margin-top: 12px;
|
|
471
|
+
}
|
|
472
|
+
}
|
|
473
|
+
|
|
474
|
+
@media (width <= 720px) {
|
|
475
|
+
.qiu-icon-picker__body {
|
|
476
|
+
grid-template-columns: 1fr;
|
|
477
|
+
height: min(60vh, 480px);
|
|
478
|
+
max-height: min(60vh, 480px);
|
|
479
|
+
}
|
|
480
|
+
|
|
481
|
+
.qiu-icon-picker__libs {
|
|
482
|
+
flex-direction: row;
|
|
483
|
+
height: auto;
|
|
484
|
+
max-height: 120px;
|
|
485
|
+
overflow: auto;
|
|
486
|
+
}
|
|
487
|
+
}
|
|
488
|
+
</style>
|
|
@@ -0,0 +1,177 @@
|
|
|
1
|
+
<template>
|
|
2
|
+
<div
|
|
3
|
+
class="qiu-image"
|
|
4
|
+
:class="{ 'is-preview': previewable }"
|
|
5
|
+
@click="onPreview"
|
|
6
|
+
>
|
|
7
|
+
<img
|
|
8
|
+
class="qiu-image__inner"
|
|
9
|
+
:src="src"
|
|
10
|
+
:alt="alt"
|
|
11
|
+
:loading="lazy ? 'lazy' : undefined"
|
|
12
|
+
:style="{ objectFit: fit }"
|
|
13
|
+
/>
|
|
14
|
+
<div v-if="previewable" class="qiu-image__mask">
|
|
15
|
+
<qiu-icon icon="zoom-in-line" />
|
|
16
|
+
</div>
|
|
17
|
+
|
|
18
|
+
<Teleport to="body">
|
|
19
|
+
<Transition name="qiu-image-fade">
|
|
20
|
+
<div
|
|
21
|
+
v-if="previewVisible"
|
|
22
|
+
class="qiu-image__viewer"
|
|
23
|
+
@click.self="closePreview"
|
|
24
|
+
>
|
|
25
|
+
<button type="button" class="qiu-image__close" aria-label="关闭" @click="closePreview">
|
|
26
|
+
<qiu-icon icon="close-line" />
|
|
27
|
+
</button>
|
|
28
|
+
<img
|
|
29
|
+
class="qiu-image__preview"
|
|
30
|
+
:src="currentPreviewSrc"
|
|
31
|
+
:alt="alt"
|
|
32
|
+
@click.stop
|
|
33
|
+
/>
|
|
34
|
+
</div>
|
|
35
|
+
</Transition>
|
|
36
|
+
</Teleport>
|
|
37
|
+
</div>
|
|
38
|
+
</template>
|
|
39
|
+
|
|
40
|
+
<script lang="ts" setup>
|
|
41
|
+
defineOptions({ name: 'QiuImage' })
|
|
42
|
+
|
|
43
|
+
const props = withDefaults(
|
|
44
|
+
defineProps<{
|
|
45
|
+
src?: string
|
|
46
|
+
fit?: 'fill' | 'contain' | 'cover' | 'none' | 'scale-down'
|
|
47
|
+
alt?: string
|
|
48
|
+
lazy?: boolean
|
|
49
|
+
previewSrcList?: string[]
|
|
50
|
+
hideOnClickModal?: boolean
|
|
51
|
+
}>(),
|
|
52
|
+
{
|
|
53
|
+
src: '',
|
|
54
|
+
fit: 'fill',
|
|
55
|
+
alt: '',
|
|
56
|
+
lazy: false,
|
|
57
|
+
previewSrcList: () => [],
|
|
58
|
+
hideOnClickModal: true,
|
|
59
|
+
}
|
|
60
|
+
)
|
|
61
|
+
|
|
62
|
+
const previewVisible = ref(false)
|
|
63
|
+
|
|
64
|
+
const previewable = computed(() => props.previewSrcList.length > 0 || !!props.src)
|
|
65
|
+
|
|
66
|
+
const currentPreviewSrc = computed(() => {
|
|
67
|
+
if (props.previewSrcList.length > 0) return props.previewSrcList[0]
|
|
68
|
+
return props.src
|
|
69
|
+
})
|
|
70
|
+
|
|
71
|
+
const onPreview = () => {
|
|
72
|
+
if (!previewable.value) return
|
|
73
|
+
previewVisible.value = true
|
|
74
|
+
}
|
|
75
|
+
|
|
76
|
+
const closePreview = () => {
|
|
77
|
+
if (!props.hideOnClickModal) return
|
|
78
|
+
previewVisible.value = false
|
|
79
|
+
}
|
|
80
|
+
|
|
81
|
+
const onKeydown = (e: KeyboardEvent) => {
|
|
82
|
+
if (e.key === 'Escape' && previewVisible.value) {
|
|
83
|
+
previewVisible.value = false
|
|
84
|
+
}
|
|
85
|
+
}
|
|
86
|
+
|
|
87
|
+
onMounted(() => window.addEventListener('keydown', onKeydown))
|
|
88
|
+
onUnmounted(() => window.removeEventListener('keydown', onKeydown))
|
|
89
|
+
</script>
|
|
90
|
+
|
|
91
|
+
<style lang="scss" scoped>
|
|
92
|
+
.qiu-image {
|
|
93
|
+
position: relative;
|
|
94
|
+
display: inline-block;
|
|
95
|
+
overflow: hidden;
|
|
96
|
+
line-height: 0;
|
|
97
|
+
background: var(--qiu-fill-color-light, var(--qiu-fill-color-light, #f5f7fa));
|
|
98
|
+
border-radius: var(--qiu-border-radius, var(--qiu-border-radius-base, 4px));
|
|
99
|
+
|
|
100
|
+
&.is-preview {
|
|
101
|
+
cursor: zoom-in;
|
|
102
|
+
}
|
|
103
|
+
}
|
|
104
|
+
|
|
105
|
+
.qiu-image__inner {
|
|
106
|
+
display: block;
|
|
107
|
+
width: 100%;
|
|
108
|
+
height: 100%;
|
|
109
|
+
}
|
|
110
|
+
|
|
111
|
+
.qiu-image__mask {
|
|
112
|
+
position: absolute;
|
|
113
|
+
inset: 0;
|
|
114
|
+
display: flex;
|
|
115
|
+
align-items: center;
|
|
116
|
+
justify-content: center;
|
|
117
|
+
font-size: 24px;
|
|
118
|
+
color: #fff;
|
|
119
|
+
background: rgb(0 0 0 / 35%);
|
|
120
|
+
opacity: 0;
|
|
121
|
+
transition: opacity 0.2s ease;
|
|
122
|
+
|
|
123
|
+
.qiu-image:hover & {
|
|
124
|
+
opacity: 1;
|
|
125
|
+
}
|
|
126
|
+
}
|
|
127
|
+
|
|
128
|
+
.qiu-image__viewer {
|
|
129
|
+
position: fixed;
|
|
130
|
+
inset: 0;
|
|
131
|
+
z-index: 3000;
|
|
132
|
+
display: flex;
|
|
133
|
+
align-items: center;
|
|
134
|
+
justify-content: center;
|
|
135
|
+
background: rgb(0 0 0 / 75%);
|
|
136
|
+
}
|
|
137
|
+
|
|
138
|
+
.qiu-image__preview {
|
|
139
|
+
max-width: 90vw;
|
|
140
|
+
max-height: 90vh;
|
|
141
|
+
object-fit: contain;
|
|
142
|
+
border-radius: 4px;
|
|
143
|
+
box-shadow: 0 8px 32px rgb(0 0 0 / 40%);
|
|
144
|
+
}
|
|
145
|
+
|
|
146
|
+
.qiu-image__close {
|
|
147
|
+
position: absolute;
|
|
148
|
+
top: 24px;
|
|
149
|
+
right: 24px;
|
|
150
|
+
display: inline-flex;
|
|
151
|
+
align-items: center;
|
|
152
|
+
justify-content: center;
|
|
153
|
+
width: 40px;
|
|
154
|
+
height: 40px;
|
|
155
|
+
font-size: 20px;
|
|
156
|
+
color: #fff;
|
|
157
|
+
cursor: pointer;
|
|
158
|
+
background: rgb(255 255 255 / 15%);
|
|
159
|
+
border: 0;
|
|
160
|
+
border-radius: 50%;
|
|
161
|
+
transition: background 0.2s ease;
|
|
162
|
+
|
|
163
|
+
&:hover {
|
|
164
|
+
background: rgb(255 255 255 / 25%);
|
|
165
|
+
}
|
|
166
|
+
}
|
|
167
|
+
|
|
168
|
+
.qiu-image-fade-enter-active,
|
|
169
|
+
.qiu-image-fade-leave-active {
|
|
170
|
+
transition: opacity 0.25s ease;
|
|
171
|
+
}
|
|
172
|
+
|
|
173
|
+
.qiu-image-fade-enter-from,
|
|
174
|
+
.qiu-image-fade-leave-to {
|
|
175
|
+
opacity: 0;
|
|
176
|
+
}
|
|
177
|
+
</style>
|