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,350 @@
|
|
|
1
|
+
<template>
|
|
2
|
+
<Teleport to="body" :disabled="!appendToBody">
|
|
3
|
+
<Transition :name="transitionName">
|
|
4
|
+
<div
|
|
5
|
+
v-if="drawerVisible"
|
|
6
|
+
class="qiu-drawer-root"
|
|
7
|
+
:class="[`qiu-drawer-root--${direction}`]"
|
|
8
|
+
:style="{ zIndex: String(zIndex) }"
|
|
9
|
+
>
|
|
10
|
+
<div
|
|
11
|
+
v-if="modal"
|
|
12
|
+
class="qiu-drawer__mask"
|
|
13
|
+
@click="onMaskClick"
|
|
14
|
+
/>
|
|
15
|
+
|
|
16
|
+
<div
|
|
17
|
+
class="qiu-drawer"
|
|
18
|
+
:class="[
|
|
19
|
+
`qiu-drawer--${direction}`,
|
|
20
|
+
{ 'qiu-drawer--animated': animated },
|
|
21
|
+
attrs.class,
|
|
22
|
+
]"
|
|
23
|
+
v-bind="attrsWithoutClass"
|
|
24
|
+
:style="drawerStyle"
|
|
25
|
+
role="dialog"
|
|
26
|
+
aria-modal="true"
|
|
27
|
+
>
|
|
28
|
+
<div v-if="showClose || title || $slots.header" class="qiu-drawer__header">
|
|
29
|
+
<div class="qiu-drawer__title">
|
|
30
|
+
<slot name="header">{{ title }}</slot>
|
|
31
|
+
</div>
|
|
32
|
+
<button
|
|
33
|
+
v-if="showClose"
|
|
34
|
+
type="button"
|
|
35
|
+
class="qiu-drawer__close"
|
|
36
|
+
aria-label="close"
|
|
37
|
+
@click="requestClose"
|
|
38
|
+
>
|
|
39
|
+
×
|
|
40
|
+
</button>
|
|
41
|
+
</div>
|
|
42
|
+
|
|
43
|
+
<div class="qiu-drawer__body">
|
|
44
|
+
<slot />
|
|
45
|
+
</div>
|
|
46
|
+
|
|
47
|
+
<div v-if="$slots.footer" class="qiu-drawer__footer">
|
|
48
|
+
<slot name="footer" />
|
|
49
|
+
</div>
|
|
50
|
+
</div>
|
|
51
|
+
</div>
|
|
52
|
+
</Transition>
|
|
53
|
+
</Teleport>
|
|
54
|
+
</template>
|
|
55
|
+
|
|
56
|
+
<script lang="ts" setup>
|
|
57
|
+
import { useBodyScrollLock } from '../useBodyScrollLock'
|
|
58
|
+
defineOptions({ name: 'QiuDrawer', inheritAttrs: false })
|
|
59
|
+
|
|
60
|
+
type Direction = 'rtl' | 'ltr' | 'ttb' | 'btt'
|
|
61
|
+
|
|
62
|
+
const attrs = useAttrs()
|
|
63
|
+
const attrsWithoutClass = computed(() => {
|
|
64
|
+
const { class: _c, style: _s, ...rest } = attrs as Record<string, unknown>
|
|
65
|
+
return rest
|
|
66
|
+
})
|
|
67
|
+
|
|
68
|
+
const props = withDefaults(
|
|
69
|
+
defineProps<{
|
|
70
|
+
modelValue?: boolean
|
|
71
|
+
title?: string
|
|
72
|
+
direction?: Direction
|
|
73
|
+
size?: string | number
|
|
74
|
+
modal?: boolean
|
|
75
|
+
closeOnClickModal?: boolean
|
|
76
|
+
closeOnPressEscape?: boolean
|
|
77
|
+
showClose?: boolean
|
|
78
|
+
animated?: boolean
|
|
79
|
+
zIndex?: number
|
|
80
|
+
/** 兼容 Element 风格;当前始终 Teleport 到 body,false 时禁用 Teleport */
|
|
81
|
+
appendToBody?: boolean
|
|
82
|
+
beforeClose?: (done: () => void) => void
|
|
83
|
+
}>(),
|
|
84
|
+
{
|
|
85
|
+
modelValue: false,
|
|
86
|
+
title: '',
|
|
87
|
+
direction: 'rtl',
|
|
88
|
+
size: '30%',
|
|
89
|
+
modal: true,
|
|
90
|
+
closeOnClickModal: true,
|
|
91
|
+
closeOnPressEscape: false,
|
|
92
|
+
showClose: true,
|
|
93
|
+
animated: true,
|
|
94
|
+
zIndex: 2000,
|
|
95
|
+
appendToBody: true,
|
|
96
|
+
}
|
|
97
|
+
)
|
|
98
|
+
|
|
99
|
+
const appendToBody = computed(() => props.appendToBody !== false)
|
|
100
|
+
|
|
101
|
+
const emit = defineEmits<{
|
|
102
|
+
'update:modelValue': [boolean]
|
|
103
|
+
open: []
|
|
104
|
+
opened: []
|
|
105
|
+
close: []
|
|
106
|
+
closed: []
|
|
107
|
+
}>()
|
|
108
|
+
|
|
109
|
+
const drawerVisible = useVModel(props, 'modelValue', emit)
|
|
110
|
+
|
|
111
|
+
const resolvedSize = computed(() =>
|
|
112
|
+
typeof props.size === 'number' ? `${props.size}px` : String(props.size)
|
|
113
|
+
)
|
|
114
|
+
|
|
115
|
+
const drawerStyle = computed(() => {
|
|
116
|
+
const size = resolvedSize.value
|
|
117
|
+
switch (props.direction) {
|
|
118
|
+
case 'ltr':
|
|
119
|
+
return { width: size, height: '100%' }
|
|
120
|
+
case 'ttb':
|
|
121
|
+
return { width: '100%', height: size }
|
|
122
|
+
case 'btt':
|
|
123
|
+
return { width: '100%', height: size }
|
|
124
|
+
default:
|
|
125
|
+
return { width: size, height: '100%' }
|
|
126
|
+
}
|
|
127
|
+
})
|
|
128
|
+
|
|
129
|
+
const transitionName = computed(() => {
|
|
130
|
+
switch (props.direction) {
|
|
131
|
+
case 'ltr':
|
|
132
|
+
return 'qiu-drawer-slide-left'
|
|
133
|
+
case 'ttb':
|
|
134
|
+
return 'qiu-drawer-slide-top'
|
|
135
|
+
case 'btt':
|
|
136
|
+
return 'qiu-drawer-slide-bottom'
|
|
137
|
+
default:
|
|
138
|
+
return 'qiu-drawer-slide-right'
|
|
139
|
+
}
|
|
140
|
+
})
|
|
141
|
+
|
|
142
|
+
const { lock: lockBodyScroll, unlock: unlockBodyScroll } = useBodyScrollLock()
|
|
143
|
+
|
|
144
|
+
const doClose = () => {
|
|
145
|
+
emit('close')
|
|
146
|
+
drawerVisible.value = false
|
|
147
|
+
}
|
|
148
|
+
|
|
149
|
+
const requestClose = () => {
|
|
150
|
+
if (props.beforeClose) {
|
|
151
|
+
props.beforeClose(() => doClose())
|
|
152
|
+
return
|
|
153
|
+
}
|
|
154
|
+
doClose()
|
|
155
|
+
}
|
|
156
|
+
|
|
157
|
+
const onMaskClick = () => {
|
|
158
|
+
if (props.closeOnClickModal) requestClose()
|
|
159
|
+
}
|
|
160
|
+
|
|
161
|
+
const needLock = computed(() => props.modal && drawerVisible.value)
|
|
162
|
+
|
|
163
|
+
watch(needLock, async (v) => {
|
|
164
|
+
if (v) {
|
|
165
|
+
lockBodyScroll()
|
|
166
|
+
emit('open')
|
|
167
|
+
await nextTick()
|
|
168
|
+
emit('opened')
|
|
169
|
+
} else {
|
|
170
|
+
unlockBodyScroll()
|
|
171
|
+
emit('closed')
|
|
172
|
+
}
|
|
173
|
+
})
|
|
174
|
+
|
|
175
|
+
const onKeydown = (e: KeyboardEvent) => {
|
|
176
|
+
if (props.closeOnPressEscape && e.key === 'Escape') requestClose()
|
|
177
|
+
}
|
|
178
|
+
|
|
179
|
+
watch(drawerVisible, (v) => {
|
|
180
|
+
if (v) window.addEventListener('keydown', onKeydown)
|
|
181
|
+
else window.removeEventListener('keydown', onKeydown)
|
|
182
|
+
})
|
|
183
|
+
|
|
184
|
+
onMounted(() => {
|
|
185
|
+
if (needLock.value) lockBodyScroll()
|
|
186
|
+
})
|
|
187
|
+
|
|
188
|
+
onBeforeUnmount(() => {
|
|
189
|
+
unlockBodyScroll()
|
|
190
|
+
window.removeEventListener('keydown', onKeydown)
|
|
191
|
+
})
|
|
192
|
+
</script>
|
|
193
|
+
|
|
194
|
+
<style lang="scss" scoped>
|
|
195
|
+
.qiu-drawer-root {
|
|
196
|
+
position: fixed;
|
|
197
|
+
inset: 0;
|
|
198
|
+
pointer-events: none;
|
|
199
|
+
}
|
|
200
|
+
|
|
201
|
+
.qiu-drawer__mask {
|
|
202
|
+
position: absolute;
|
|
203
|
+
inset: 0;
|
|
204
|
+
pointer-events: auto;
|
|
205
|
+
background: var(--qiu-drawer-mask-bg, var(--qiu-overlay-color-lighter, rgba(0, 0, 0, 0.45)));
|
|
206
|
+
}
|
|
207
|
+
|
|
208
|
+
.qiu-drawer {
|
|
209
|
+
position: absolute;
|
|
210
|
+
display: flex;
|
|
211
|
+
flex-direction: column;
|
|
212
|
+
pointer-events: auto;
|
|
213
|
+
background: var(--qiu-bg-color, var(--qiu-bg-color, #fff));
|
|
214
|
+
box-shadow: var(--qiu-box-shadow, 0 8px 24px rgba(0, 0, 0, 0.12));
|
|
215
|
+
box-sizing: border-box;
|
|
216
|
+
overflow: hidden;
|
|
217
|
+
|
|
218
|
+
&--rtl {
|
|
219
|
+
top: 0;
|
|
220
|
+
right: 0;
|
|
221
|
+
}
|
|
222
|
+
|
|
223
|
+
&--ltr {
|
|
224
|
+
top: 0;
|
|
225
|
+
left: 0;
|
|
226
|
+
}
|
|
227
|
+
|
|
228
|
+
&--ttb {
|
|
229
|
+
top: 0;
|
|
230
|
+
left: 0;
|
|
231
|
+
}
|
|
232
|
+
|
|
233
|
+
&--btt {
|
|
234
|
+
bottom: 0;
|
|
235
|
+
left: 0;
|
|
236
|
+
}
|
|
237
|
+
}
|
|
238
|
+
|
|
239
|
+
.qiu-drawer__header {
|
|
240
|
+
display: flex;
|
|
241
|
+
flex-shrink: 0;
|
|
242
|
+
align-items: center;
|
|
243
|
+
justify-content: space-between;
|
|
244
|
+
padding: 16px 20px;
|
|
245
|
+
border-bottom: 1px solid var(--qiu-border-color-lighter, var(--qiu-border-color-lighter, #ebeef5));
|
|
246
|
+
}
|
|
247
|
+
|
|
248
|
+
.qiu-drawer__title {
|
|
249
|
+
flex: 1;
|
|
250
|
+
min-width: 0;
|
|
251
|
+
font-size: 16px;
|
|
252
|
+
font-weight: 600;
|
|
253
|
+
color: var(--qiu-text-color-primary, var(--qiu-text-color-primary, #303133));
|
|
254
|
+
}
|
|
255
|
+
|
|
256
|
+
.qiu-drawer__close {
|
|
257
|
+
display: inline-flex;
|
|
258
|
+
align-items: center;
|
|
259
|
+
justify-content: center;
|
|
260
|
+
width: 32px;
|
|
261
|
+
height: 32px;
|
|
262
|
+
margin-left: 8px;
|
|
263
|
+
padding: 0;
|
|
264
|
+
font-size: 20px;
|
|
265
|
+
line-height: 1;
|
|
266
|
+
color: var(--qiu-text-color-secondary, var(--qiu-text-color-secondary, #909399));
|
|
267
|
+
cursor: pointer;
|
|
268
|
+
background: transparent;
|
|
269
|
+
border: 0;
|
|
270
|
+
border-radius: 4px;
|
|
271
|
+
|
|
272
|
+
&:hover {
|
|
273
|
+
color: var(--qiu-color-primary, var(--qiu-color-primary, #409eff));
|
|
274
|
+
background: var(--qiu-fill-color-light, var(--qiu-fill-color-light, #f5f7fa));
|
|
275
|
+
}
|
|
276
|
+
}
|
|
277
|
+
|
|
278
|
+
.qiu-drawer__body {
|
|
279
|
+
display: flex;
|
|
280
|
+
flex-direction: column;
|
|
281
|
+
flex: 1;
|
|
282
|
+
min-height: 0;
|
|
283
|
+
min-width: 0;
|
|
284
|
+
padding: 16px 20px;
|
|
285
|
+
overflow: auto;
|
|
286
|
+
color: var(--qiu-text-color-regular, var(--qiu-text-color-regular, #606266));
|
|
287
|
+
font-size: 14px;
|
|
288
|
+
}
|
|
289
|
+
|
|
290
|
+
.qiu-drawer__footer {
|
|
291
|
+
flex-shrink: 0;
|
|
292
|
+
display: flex;
|
|
293
|
+
gap: 8px;
|
|
294
|
+
justify-content: flex-end;
|
|
295
|
+
padding: 12px 20px;
|
|
296
|
+
border-top: 1px solid var(--qiu-border-color-lighter, var(--qiu-border-color-lighter, #ebeef5));
|
|
297
|
+
}
|
|
298
|
+
|
|
299
|
+
/* slide transitions */
|
|
300
|
+
.qiu-drawer-slide-right-enter-active,
|
|
301
|
+
.qiu-drawer-slide-right-leave-active,
|
|
302
|
+
.qiu-drawer-slide-left-enter-active,
|
|
303
|
+
.qiu-drawer-slide-left-leave-active,
|
|
304
|
+
.qiu-drawer-slide-top-enter-active,
|
|
305
|
+
.qiu-drawer-slide-top-leave-active,
|
|
306
|
+
.qiu-drawer-slide-bottom-enter-active,
|
|
307
|
+
.qiu-drawer-slide-bottom-leave-active {
|
|
308
|
+
transition: opacity 0.25s ease;
|
|
309
|
+
|
|
310
|
+
.qiu-drawer {
|
|
311
|
+
transition: transform 0.25s ease;
|
|
312
|
+
}
|
|
313
|
+
}
|
|
314
|
+
|
|
315
|
+
.qiu-drawer-slide-right-enter-from,
|
|
316
|
+
.qiu-drawer-slide-right-leave-to {
|
|
317
|
+
opacity: 0;
|
|
318
|
+
|
|
319
|
+
.qiu-drawer {
|
|
320
|
+
transform: translateX(100%);
|
|
321
|
+
}
|
|
322
|
+
}
|
|
323
|
+
|
|
324
|
+
.qiu-drawer-slide-left-enter-from,
|
|
325
|
+
.qiu-drawer-slide-left-leave-to {
|
|
326
|
+
opacity: 0;
|
|
327
|
+
|
|
328
|
+
.qiu-drawer {
|
|
329
|
+
transform: translateX(-100%);
|
|
330
|
+
}
|
|
331
|
+
}
|
|
332
|
+
|
|
333
|
+
.qiu-drawer-slide-top-enter-from,
|
|
334
|
+
.qiu-drawer-slide-top-leave-to {
|
|
335
|
+
opacity: 0;
|
|
336
|
+
|
|
337
|
+
.qiu-drawer {
|
|
338
|
+
transform: translateY(-100%);
|
|
339
|
+
}
|
|
340
|
+
}
|
|
341
|
+
|
|
342
|
+
.qiu-drawer-slide-bottom-enter-from,
|
|
343
|
+
.qiu-drawer-slide-bottom-leave-to {
|
|
344
|
+
opacity: 0;
|
|
345
|
+
|
|
346
|
+
.qiu-drawer {
|
|
347
|
+
transform: translateY(100%);
|
|
348
|
+
}
|
|
349
|
+
}
|
|
350
|
+
</style>
|
|
@@ -0,0 +1,74 @@
|
|
|
1
|
+
<template>
|
|
2
|
+
<li
|
|
3
|
+
class="qiu-dropdown-item"
|
|
4
|
+
:class="{
|
|
5
|
+
'is-disabled': disabled,
|
|
6
|
+
'is-divided': divided,
|
|
7
|
+
}"
|
|
8
|
+
role="menuitem"
|
|
9
|
+
@click="onClick"
|
|
10
|
+
>
|
|
11
|
+
<slot />
|
|
12
|
+
</li>
|
|
13
|
+
</template>
|
|
14
|
+
|
|
15
|
+
<script lang="ts" setup>
|
|
16
|
+
import { QIU_DROPDOWN_KEY } from './context'
|
|
17
|
+
|
|
18
|
+
defineOptions({ name: 'QiuDropdownItem' })
|
|
19
|
+
|
|
20
|
+
const props = withDefaults(
|
|
21
|
+
defineProps<{
|
|
22
|
+
command?: string | number
|
|
23
|
+
disabled?: boolean
|
|
24
|
+
divided?: boolean
|
|
25
|
+
}>(),
|
|
26
|
+
{
|
|
27
|
+
command: '',
|
|
28
|
+
disabled: false,
|
|
29
|
+
divided: false,
|
|
30
|
+
}
|
|
31
|
+
)
|
|
32
|
+
|
|
33
|
+
const emit = defineEmits<{
|
|
34
|
+
click: [MouseEvent]
|
|
35
|
+
}>()
|
|
36
|
+
|
|
37
|
+
const dropdown = inject(QIU_DROPDOWN_KEY, null)
|
|
38
|
+
|
|
39
|
+
const onClick = (e: MouseEvent) => {
|
|
40
|
+
if (props.disabled) return
|
|
41
|
+
emit('click', e)
|
|
42
|
+
dropdown?.emitCommand(props.command)
|
|
43
|
+
}
|
|
44
|
+
</script>
|
|
45
|
+
|
|
46
|
+
<style lang="scss" scoped>
|
|
47
|
+
.qiu-dropdown-item {
|
|
48
|
+
display: flex;
|
|
49
|
+
align-items: center;
|
|
50
|
+
gap: 8px;
|
|
51
|
+
padding: 8px 16px;
|
|
52
|
+
font-size: 14px;
|
|
53
|
+
line-height: 1.4;
|
|
54
|
+
color: var(--qiu-text-color-regular, var(--qiu-text-color-regular, #606266));
|
|
55
|
+
cursor: pointer;
|
|
56
|
+
white-space: nowrap;
|
|
57
|
+
transition: background 0.15s ease, color 0.15s ease;
|
|
58
|
+
|
|
59
|
+
&:hover:not(.is-disabled) {
|
|
60
|
+
color: var(--qiu-color-primary, var(--qiu-color-primary, #409eff));
|
|
61
|
+
background: var(--qiu-fill-color-light, var(--qiu-fill-color-light, #f5f7fa));
|
|
62
|
+
}
|
|
63
|
+
|
|
64
|
+
&.is-disabled {
|
|
65
|
+
color: var(--qiu-text-color-placeholder, var(--qiu-text-color-placeholder, #a8abb2));
|
|
66
|
+
cursor: not-allowed;
|
|
67
|
+
}
|
|
68
|
+
|
|
69
|
+
&.is-divided {
|
|
70
|
+
margin-top: 4px;
|
|
71
|
+
border-top: 1px solid var(--qiu-border-color-lighter, var(--qiu-border-color-lighter, #ebeef5));
|
|
72
|
+
}
|
|
73
|
+
}
|
|
74
|
+
</style>
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
<template>
|
|
2
|
+
<ul class="qiu-dropdown-menu" role="menu">
|
|
3
|
+
<slot />
|
|
4
|
+
</ul>
|
|
5
|
+
</template>
|
|
6
|
+
|
|
7
|
+
<script lang="ts" setup>
|
|
8
|
+
defineOptions({ name: 'QiuDropdownMenu' })
|
|
9
|
+
</script>
|
|
10
|
+
|
|
11
|
+
<style lang="scss" scoped>
|
|
12
|
+
.qiu-dropdown-menu {
|
|
13
|
+
margin: 0;
|
|
14
|
+
padding: 4px 0;
|
|
15
|
+
list-style: none;
|
|
16
|
+
background: var(--qiu-bg-color, var(--qiu-bg-color, #fff));
|
|
17
|
+
border: 1px solid var(--qiu-border-color-lighter, var(--qiu-border-color-lighter, #ebeef5));
|
|
18
|
+
border-radius: 4px;
|
|
19
|
+
box-shadow: var(--qiu-box-shadow-light, 0 4px 12px rgba(0, 0, 0, 0.1));
|
|
20
|
+
box-sizing: border-box;
|
|
21
|
+
}
|
|
22
|
+
</style>
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import type { InjectionKey, Ref } from 'vue'
|
|
2
|
+
|
|
3
|
+
export interface QiuDropdownContext {
|
|
4
|
+
visible: Ref<boolean>
|
|
5
|
+
close: () => void
|
|
6
|
+
emitCommand: (command: string | number) => void
|
|
7
|
+
}
|
|
8
|
+
|
|
9
|
+
export const QIU_DROPDOWN_KEY: InjectionKey<QiuDropdownContext> = Symbol('QiuDropdown')
|
|
@@ -0,0 +1,189 @@
|
|
|
1
|
+
<template>
|
|
2
|
+
<span ref="triggerRef" class="qiu-dropdown">
|
|
3
|
+
<span class="qiu-dropdown__trigger" @click.stop="toggle">
|
|
4
|
+
<slot />
|
|
5
|
+
</span>
|
|
6
|
+
|
|
7
|
+
<Teleport to="body">
|
|
8
|
+
<Transition name="qiu-dropdown-fade">
|
|
9
|
+
<div
|
|
10
|
+
v-if="visible"
|
|
11
|
+
ref="menuHostRef"
|
|
12
|
+
class="qiu-dropdown__popper"
|
|
13
|
+
:class="popperClass"
|
|
14
|
+
:style="popperStyle"
|
|
15
|
+
@click.stop
|
|
16
|
+
>
|
|
17
|
+
<slot name="dropdown" />
|
|
18
|
+
</div>
|
|
19
|
+
</Transition>
|
|
20
|
+
</Teleport>
|
|
21
|
+
</span>
|
|
22
|
+
</template>
|
|
23
|
+
|
|
24
|
+
<script lang="ts" setup>
|
|
25
|
+
import { QIU_DROPDOWN_KEY } from './context'
|
|
26
|
+
|
|
27
|
+
defineOptions({ name: 'QiuDropdown' })
|
|
28
|
+
|
|
29
|
+
const props = withDefaults(
|
|
30
|
+
defineProps<{
|
|
31
|
+
/** 禁用下拉 */
|
|
32
|
+
disabled?: boolean
|
|
33
|
+
/** 弹出位置 */
|
|
34
|
+
placement?: 'bottom-start' | 'bottom-end' | 'top-start' | 'top-end' | 'bottom' | 'top'
|
|
35
|
+
/** 附加到弹层的 class */
|
|
36
|
+
popperClass?: string
|
|
37
|
+
}>(),
|
|
38
|
+
{
|
|
39
|
+
disabled: false,
|
|
40
|
+
placement: 'bottom-start',
|
|
41
|
+
popperClass: '',
|
|
42
|
+
}
|
|
43
|
+
)
|
|
44
|
+
|
|
45
|
+
const emit = defineEmits<{
|
|
46
|
+
command: [string | number]
|
|
47
|
+
visibleChange: [boolean]
|
|
48
|
+
}>()
|
|
49
|
+
|
|
50
|
+
const triggerRef = ref<HTMLElement | null>(null)
|
|
51
|
+
const menuHostRef = ref<HTMLElement | null>(null)
|
|
52
|
+
const visible = ref(false)
|
|
53
|
+
const popperStyle = ref<Record<string, string>>({
|
|
54
|
+
position: 'fixed',
|
|
55
|
+
top: '-9999px',
|
|
56
|
+
left: '-9999px',
|
|
57
|
+
zIndex: '3000',
|
|
58
|
+
})
|
|
59
|
+
|
|
60
|
+
const close = () => {
|
|
61
|
+
if (!visible.value) return
|
|
62
|
+
visible.value = false
|
|
63
|
+
emit('visibleChange', false)
|
|
64
|
+
}
|
|
65
|
+
|
|
66
|
+
const open = async () => {
|
|
67
|
+
if (props.disabled) return
|
|
68
|
+
visible.value = true
|
|
69
|
+
emit('visibleChange', true)
|
|
70
|
+
await nextTick()
|
|
71
|
+
updatePosition()
|
|
72
|
+
// 再测一次:内容渲染后尺寸更准(尤其是 tabs more 面板)
|
|
73
|
+
requestAnimationFrame(() => updatePosition())
|
|
74
|
+
}
|
|
75
|
+
|
|
76
|
+
const toggle = () => {
|
|
77
|
+
if (props.disabled) return
|
|
78
|
+
if (visible.value) close()
|
|
79
|
+
else open()
|
|
80
|
+
}
|
|
81
|
+
|
|
82
|
+
const emitCommand = (command: string | number) => {
|
|
83
|
+
emit('command', command)
|
|
84
|
+
close()
|
|
85
|
+
}
|
|
86
|
+
|
|
87
|
+
provide(QIU_DROPDOWN_KEY, { visible, close, emitCommand })
|
|
88
|
+
|
|
89
|
+
const updatePosition = () => {
|
|
90
|
+
const trigger = triggerRef.value
|
|
91
|
+
const menu = menuHostRef.value
|
|
92
|
+
if (!trigger || !menu) return
|
|
93
|
+
|
|
94
|
+
const rect = trigger.getBoundingClientRect()
|
|
95
|
+
const menuRect = menu.getBoundingClientRect()
|
|
96
|
+
const gap = 4
|
|
97
|
+
const vw = window.innerWidth
|
|
98
|
+
const vh = window.innerHeight
|
|
99
|
+
const place = props.placement
|
|
100
|
+
|
|
101
|
+
let top = place.startsWith('top') ? rect.top - menuRect.height - gap : rect.bottom + gap
|
|
102
|
+
let left = rect.left
|
|
103
|
+
|
|
104
|
+
if (place.endsWith('end')) {
|
|
105
|
+
left = rect.right - menuRect.width
|
|
106
|
+
} else if (place === 'bottom' || place === 'top') {
|
|
107
|
+
left = rect.left + (rect.width - menuRect.width) / 2
|
|
108
|
+
}
|
|
109
|
+
|
|
110
|
+
if (left + menuRect.width > vw - 4) left = vw - menuRect.width - 4
|
|
111
|
+
if (left < 4) left = 4
|
|
112
|
+
if (top + menuRect.height > vh - 4) top = rect.top - menuRect.height - gap
|
|
113
|
+
if (top < 4) top = 4
|
|
114
|
+
|
|
115
|
+
popperStyle.value = {
|
|
116
|
+
position: 'fixed',
|
|
117
|
+
top: `${Math.round(top)}px`,
|
|
118
|
+
left: `${Math.round(left)}px`,
|
|
119
|
+
zIndex: '3000',
|
|
120
|
+
}
|
|
121
|
+
}
|
|
122
|
+
|
|
123
|
+
const onDocClick = (e: MouseEvent) => {
|
|
124
|
+
if (!visible.value) return
|
|
125
|
+
const t = e.target as Node
|
|
126
|
+
if (triggerRef.value?.contains(t) || menuHostRef.value?.contains(t)) return
|
|
127
|
+
close()
|
|
128
|
+
}
|
|
129
|
+
|
|
130
|
+
const onScrollOrResize = () => {
|
|
131
|
+
if (visible.value) updatePosition()
|
|
132
|
+
}
|
|
133
|
+
|
|
134
|
+
watch(visible, (v) => {
|
|
135
|
+
if (v) {
|
|
136
|
+
document.addEventListener('click', onDocClick, true)
|
|
137
|
+
window.addEventListener('scroll', onScrollOrResize, true)
|
|
138
|
+
window.addEventListener('resize', onScrollOrResize)
|
|
139
|
+
} else {
|
|
140
|
+
document.removeEventListener('click', onDocClick, true)
|
|
141
|
+
window.removeEventListener('scroll', onScrollOrResize, true)
|
|
142
|
+
window.removeEventListener('resize', onScrollOrResize)
|
|
143
|
+
}
|
|
144
|
+
})
|
|
145
|
+
|
|
146
|
+
onBeforeUnmount(() => {
|
|
147
|
+
document.removeEventListener('click', onDocClick, true)
|
|
148
|
+
window.removeEventListener('scroll', onScrollOrResize, true)
|
|
149
|
+
window.removeEventListener('resize', onScrollOrResize)
|
|
150
|
+
})
|
|
151
|
+
|
|
152
|
+
defineExpose({ open, close, toggle })
|
|
153
|
+
</script>
|
|
154
|
+
|
|
155
|
+
<style lang="scss" scoped>
|
|
156
|
+
.qiu-dropdown {
|
|
157
|
+
display: inline-flex;
|
|
158
|
+
flex-shrink: 0;
|
|
159
|
+
align-items: center;
|
|
160
|
+
justify-content: center;
|
|
161
|
+
vertical-align: middle;
|
|
162
|
+
}
|
|
163
|
+
|
|
164
|
+
.qiu-dropdown__trigger {
|
|
165
|
+
display: inline-flex;
|
|
166
|
+
align-items: center;
|
|
167
|
+
justify-content: center;
|
|
168
|
+
line-height: 1;
|
|
169
|
+
cursor: pointer;
|
|
170
|
+
}
|
|
171
|
+
|
|
172
|
+
.qiu-dropdown__popper {
|
|
173
|
+
position: fixed;
|
|
174
|
+
z-index: 3000;
|
|
175
|
+
min-width: 120px;
|
|
176
|
+
pointer-events: auto;
|
|
177
|
+
}
|
|
178
|
+
|
|
179
|
+
.qiu-dropdown-fade-enter-active,
|
|
180
|
+
.qiu-dropdown-fade-leave-active {
|
|
181
|
+
transition: opacity 0.15s ease, transform 0.15s ease;
|
|
182
|
+
}
|
|
183
|
+
|
|
184
|
+
.qiu-dropdown-fade-enter-from,
|
|
185
|
+
.qiu-dropdown-fade-leave-to {
|
|
186
|
+
opacity: 0;
|
|
187
|
+
transform: translateY(-4px);
|
|
188
|
+
}
|
|
189
|
+
</style>
|
|
@@ -0,0 +1,73 @@
|
|
|
1
|
+
<template>
|
|
2
|
+
<div class="qiu-empty">
|
|
3
|
+
<div class="qiu-empty__image">
|
|
4
|
+
<slot name="image">
|
|
5
|
+
<svg
|
|
6
|
+
class="qiu-empty__svg"
|
|
7
|
+
viewBox="0 0 120 80"
|
|
8
|
+
xmlns="http://www.w3.org/2000/svg"
|
|
9
|
+
aria-hidden="true"
|
|
10
|
+
>
|
|
11
|
+
<rect x="10" y="20" width="100" height="50" rx="4" fill="var(--qiu-fill-color, var(--qiu-fill-color, #f0f2f5))" />
|
|
12
|
+
<rect x="20" y="30" width="40" height="6" rx="2" fill="var(--qiu-border-color, var(--qiu-border-color, #dcdfe6))" />
|
|
13
|
+
<rect x="20" y="42" width="60" height="6" rx="2" fill="var(--qiu-border-color-lighter, var(--qiu-border-color-lighter, #ebeef5))" />
|
|
14
|
+
<rect x="20" y="54" width="30" height="6" rx="2" fill="var(--qiu-border-color-lighter, var(--qiu-border-color-lighter, #ebeef5))" />
|
|
15
|
+
</svg>
|
|
16
|
+
</slot>
|
|
17
|
+
</div>
|
|
18
|
+
<p v-if="description || $slots.description" class="qiu-empty__description">
|
|
19
|
+
<slot name="description">{{ description }}</slot>
|
|
20
|
+
</p>
|
|
21
|
+
<div v-if="$slots.default" class="qiu-empty__actions">
|
|
22
|
+
<slot />
|
|
23
|
+
</div>
|
|
24
|
+
</div>
|
|
25
|
+
</template>
|
|
26
|
+
|
|
27
|
+
<script lang="ts" setup>
|
|
28
|
+
defineOptions({ name: 'QiuEmpty' })
|
|
29
|
+
|
|
30
|
+
withDefaults(
|
|
31
|
+
defineProps<{
|
|
32
|
+
description?: string
|
|
33
|
+
}>(),
|
|
34
|
+
{
|
|
35
|
+
description: '暂无数据',
|
|
36
|
+
}
|
|
37
|
+
)
|
|
38
|
+
</script>
|
|
39
|
+
|
|
40
|
+
<style lang="scss" scoped>
|
|
41
|
+
.qiu-empty {
|
|
42
|
+
display: flex;
|
|
43
|
+
flex-direction: column;
|
|
44
|
+
align-items: center;
|
|
45
|
+
justify-content: center;
|
|
46
|
+
padding: 32px 16px;
|
|
47
|
+
text-align: center;
|
|
48
|
+
}
|
|
49
|
+
|
|
50
|
+
.qiu-empty__image {
|
|
51
|
+
margin-bottom: 16px;
|
|
52
|
+
}
|
|
53
|
+
|
|
54
|
+
.qiu-empty__svg {
|
|
55
|
+
width: 120px;
|
|
56
|
+
height: 80px;
|
|
57
|
+
}
|
|
58
|
+
|
|
59
|
+
.qiu-empty__description {
|
|
60
|
+
margin: 0 0 16px;
|
|
61
|
+
font-size: 14px;
|
|
62
|
+
line-height: 1.5;
|
|
63
|
+
color: var(--qiu-text-color-secondary, var(--qiu-text-color-secondary, #909399));
|
|
64
|
+
}
|
|
65
|
+
|
|
66
|
+
.qiu-empty__actions {
|
|
67
|
+
display: flex;
|
|
68
|
+
flex-wrap: wrap;
|
|
69
|
+
gap: 8px;
|
|
70
|
+
align-items: center;
|
|
71
|
+
justify-content: center;
|
|
72
|
+
}
|
|
73
|
+
</style>
|