knight-ui 1.0.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/README.md +2189 -0
- package/base/AbstractComponent.d.ts +29 -0
- package/base/AbstractUI.d.ts +45 -0
- package/base/index.d.ts +2 -0
- package/component/_internal/BodyScrollLock.d.ts +13 -0
- package/component/_internal/ClickOutside.d.ts +21 -0
- package/component/_internal/Mask.d.ts +15 -0
- package/component/_internal/OverlayZIndex.d.ts +13 -0
- package/component/_internal/Portal.d.ts +9 -0
- package/component/_internal/index.d.ts +5 -0
- package/component/_tokens/index.d.ts +33 -0
- package/component/_types/base.d.ts +19 -0
- package/component/_types/index.d.ts +1 -0
- package/component/ai/AIChatDialogue.d.ts +44 -0
- package/component/ai/AIChatInput.d.ts +45 -0
- package/component/ai/Sidebar.d.ts +38 -0
- package/component/ai/index.d.ts +6 -0
- package/component/basic/Button.d.ts +36 -0
- package/component/basic/Divider.d.ts +28 -0
- package/component/basic/FloatButton.d.ts +53 -0
- package/component/basic/Grid.d.ts +41 -0
- package/component/basic/Icon.d.ts +30 -0
- package/component/basic/Layout.d.ts +43 -0
- package/component/basic/Resizable.d.ts +76 -0
- package/component/basic/Space.d.ts +26 -0
- package/component/basic/Typography.d.ts +64 -0
- package/component/basic/icon-paths.generated.d.ts +2 -0
- package/component/basic/icons/IconAbsoluteStroked.d.ts +3 -0
- package/component/basic/icons/IconActivity.d.ts +3 -0
- package/component/basic/icons/IconAiBellLevel1.d.ts +3 -0
- package/component/basic/icons/IconAiBellLevel2.d.ts +3 -0
- package/component/basic/icons/IconAiBellLevel3.d.ts +3 -0
- package/component/basic/icons/IconAiEditLevel1.d.ts +3 -0
- package/component/basic/icons/IconAiEditLevel2.d.ts +3 -0
- package/component/basic/icons/IconAiEditLevel3.d.ts +3 -0
- package/component/basic/icons/IconAiFileLevel1.d.ts +3 -0
- package/component/basic/icons/IconAiFileLevel2.d.ts +3 -0
- package/component/basic/icons/IconAiFileLevel3.d.ts +3 -0
- package/component/basic/icons/IconAiFilledLevel1.d.ts +3 -0
- package/component/basic/icons/IconAiFilledLevel2.d.ts +3 -0
- package/component/basic/icons/IconAiFilledLevel3.d.ts +3 -0
- package/component/basic/icons/IconAiImageLevel1.d.ts +3 -0
- package/component/basic/icons/IconAiImageLevel2.d.ts +3 -0
- package/component/basic/icons/IconAiImageLevel3.d.ts +3 -0
- package/component/basic/icons/IconAiLoading.d.ts +3 -0
- package/component/basic/icons/IconAiSearchLevel1.d.ts +3 -0
- package/component/basic/icons/IconAiSearchLevel2.d.ts +3 -0
- package/component/basic/icons/IconAiSearchLevel3.d.ts +3 -0
- package/component/basic/icons/IconAiStrokedLevel1.d.ts +3 -0
- package/component/basic/icons/IconAiStrokedLevel2.d.ts +3 -0
- package/component/basic/icons/IconAiStrokedLevel3.d.ts +3 -0
- package/component/basic/icons/IconAiWandLevel1.d.ts +3 -0
- package/component/basic/icons/IconAiWandLevel2.d.ts +3 -0
- package/component/basic/icons/IconAiWandLevel3.d.ts +3 -0
- package/component/basic/icons/IconAlarm.d.ts +3 -0
- package/component/basic/icons/IconAlarmStroked.d.ts +3 -0
- package/component/basic/icons/IconAlertCircle.d.ts +3 -0
- package/component/basic/icons/IconAlertTriangle.d.ts +3 -0
- package/component/basic/icons/IconAlignBottom.d.ts +3 -0
- package/component/basic/icons/IconAlignCenter.d.ts +3 -0
- package/component/basic/icons/IconAlignCenterVertical.d.ts +3 -0
- package/component/basic/icons/IconAlignHCenterStroked.d.ts +3 -0
- package/component/basic/icons/IconAlignHLeftStroked.d.ts +3 -0
- package/component/basic/icons/IconAlignHRightStroked.d.ts +3 -0
- package/component/basic/icons/IconAlignJustify.d.ts +3 -0
- package/component/basic/icons/IconAlignLeft.d.ts +3 -0
- package/component/basic/icons/IconAlignRight.d.ts +3 -0
- package/component/basic/icons/IconAlignTop.d.ts +3 -0
- package/component/basic/icons/IconAlignVBotStroked.d.ts +3 -0
- package/component/basic/icons/IconAlignVBottomStroked.d.ts +3 -0
- package/component/basic/icons/IconAlignVCenterStroked.d.ts +3 -0
- package/component/basic/icons/IconAlignVTopStroked.d.ts +3 -0
- package/component/basic/icons/IconApartment.d.ts +3 -0
- package/component/basic/icons/IconAppCenter.d.ts +3 -0
- package/component/basic/icons/IconApps.d.ts +3 -0
- package/component/basic/icons/IconArchive.d.ts +3 -0
- package/component/basic/icons/IconArrowDown.d.ts +3 -0
- package/component/basic/icons/IconArrowDownLeft.d.ts +3 -0
- package/component/basic/icons/IconArrowDownRight.d.ts +3 -0
- package/component/basic/icons/IconArrowLeft.d.ts +3 -0
- package/component/basic/icons/IconArrowRight.d.ts +3 -0
- package/component/basic/icons/IconArrowUp.d.ts +3 -0
- package/component/basic/icons/IconArrowUpLeft.d.ts +3 -0
- package/component/basic/icons/IconArrowUpRight.d.ts +3 -0
- package/component/basic/icons/IconArticle.d.ts +3 -0
- package/component/basic/icons/IconAscend.d.ts +3 -0
- package/component/basic/icons/IconAt.d.ts +3 -0
- package/component/basic/icons/IconBackTop.d.ts +3 -0
- package/component/basic/icons/IconBackward.d.ts +3 -0
- package/component/basic/icons/IconBarChartHStroked.d.ts +3 -0
- package/component/basic/icons/IconBarChartVStroked.d.ts +3 -0
- package/component/basic/icons/IconBeaker.d.ts +3 -0
- package/component/basic/icons/IconBell.d.ts +3 -0
- package/component/basic/icons/IconBellStroked.d.ts +3 -0
- package/component/basic/icons/IconBold.d.ts +3 -0
- package/component/basic/icons/IconBolt.d.ts +3 -0
- package/component/basic/icons/IconBook.d.ts +3 -0
- package/component/basic/icons/IconBookH5Stroked.d.ts +3 -0
- package/component/basic/icons/IconBookOpenStroked.d.ts +3 -0
- package/component/basic/icons/IconBookStroked.d.ts +3 -0
- package/component/basic/icons/IconBookmark.d.ts +3 -0
- package/component/basic/icons/IconBookmarkAddStroked.d.ts +3 -0
- package/component/basic/icons/IconBookmarkDeleteStroked.d.ts +3 -0
- package/component/basic/icons/IconBottomCenterStroked.d.ts +3 -0
- package/component/basic/icons/IconBottomLeftStroked.d.ts +3 -0
- package/component/basic/icons/IconBottomRightStroked.d.ts +3 -0
- package/component/basic/icons/IconBox.d.ts +3 -0
- package/component/basic/icons/IconBrackets.d.ts +3 -0
- package/component/basic/icons/IconBranch.d.ts +3 -0
- package/component/basic/icons/IconBriefStroked.d.ts +3 -0
- package/component/basic/icons/IconBriefcase.d.ts +3 -0
- package/component/basic/icons/IconBriefcaseStroked.d.ts +3 -0
- package/component/basic/icons/IconBulb.d.ts +3 -0
- package/component/basic/icons/IconButtonStroked.d.ts +3 -0
- package/component/basic/icons/IconBytedanceLogo.d.ts +3 -0
- package/component/basic/icons/IconCalendar.d.ts +3 -0
- package/component/basic/icons/IconCalendarClock.d.ts +3 -0
- package/component/basic/icons/IconCalendarClockStroked.d.ts +3 -0
- package/component/basic/icons/IconCalendarStroked.d.ts +3 -0
- package/component/basic/icons/IconCamera.d.ts +3 -0
- package/component/basic/icons/IconCameraStroked.d.ts +3 -0
- package/component/basic/icons/IconCandlestickChartStroked.d.ts +3 -0
- package/component/basic/icons/IconCaretdown.d.ts +3 -0
- package/component/basic/icons/IconCaretup.d.ts +3 -0
- package/component/basic/icons/IconCarouselStroked.d.ts +3 -0
- package/component/basic/icons/IconCart.d.ts +3 -0
- package/component/basic/icons/IconCartStroked.d.ts +3 -0
- package/component/basic/icons/IconCaseSensitive.d.ts +3 -0
- package/component/basic/icons/IconCenterLeftStroked.d.ts +3 -0
- package/component/basic/icons/IconCenterRightStroked.d.ts +3 -0
- package/component/basic/icons/IconChainStroked.d.ts +3 -0
- package/component/basic/icons/IconCheckChoiceStroked.d.ts +3 -0
- package/component/basic/icons/IconCheckCircleStroked.d.ts +3 -0
- package/component/basic/icons/IconCheckList.d.ts +3 -0
- package/component/basic/icons/IconCheckboxIndeterminate.d.ts +3 -0
- package/component/basic/icons/IconCheckboxTick.d.ts +3 -0
- package/component/basic/icons/IconChecklistStroked.d.ts +3 -0
- package/component/basic/icons/IconChevronDown.d.ts +3 -0
- package/component/basic/icons/IconChevronDownStroked.d.ts +3 -0
- package/component/basic/icons/IconChevronLeft.d.ts +3 -0
- package/component/basic/icons/IconChevronRight.d.ts +3 -0
- package/component/basic/icons/IconChevronRightStroked.d.ts +3 -0
- package/component/basic/icons/IconChevronUp.d.ts +3 -0
- package/component/basic/icons/IconChevronUpDown.d.ts +3 -0
- package/component/basic/icons/IconClear.d.ts +3 -0
- package/component/basic/icons/IconClock.d.ts +3 -0
- package/component/basic/icons/IconClockStroked.d.ts +3 -0
- package/component/basic/icons/IconClose.d.ts +3 -0
- package/component/basic/icons/IconCloud.d.ts +3 -0
- package/component/basic/icons/IconCloudStroked.d.ts +3 -0
- package/component/basic/icons/IconCloudUploadStroked.d.ts +3 -0
- package/component/basic/icons/IconCode.d.ts +3 -0
- package/component/basic/icons/IconCodeStroked.d.ts +3 -0
- package/component/basic/icons/IconCoinMoney.d.ts +3 -0
- package/component/basic/icons/IconCoinMoneyStroked.d.ts +3 -0
- package/component/basic/icons/IconColorPalette.d.ts +3 -0
- package/component/basic/icons/IconColumnsStroked.d.ts +3 -0
- package/component/basic/icons/IconCommand.d.ts +3 -0
- package/component/basic/icons/IconComment.d.ts +3 -0
- package/component/basic/icons/IconCommentStroked.d.ts +3 -0
- package/component/basic/icons/IconComponent.d.ts +3 -0
- package/component/basic/icons/IconComponentPlaceholderStroked.d.ts +3 -0
- package/component/basic/icons/IconComponentStroked.d.ts +3 -0
- package/component/basic/icons/IconConfigStroked.d.ts +3 -0
- package/component/basic/icons/IconConnectionPoint1.d.ts +3 -0
- package/component/basic/icons/IconConnectionPoint2.d.ts +3 -0
- package/component/basic/icons/IconContrast.d.ts +3 -0
- package/component/basic/icons/IconCopy.d.ts +3 -0
- package/component/basic/icons/IconCopyAdd.d.ts +3 -0
- package/component/basic/icons/IconCopyStroked.d.ts +3 -0
- package/component/basic/icons/IconCornerRadiusStroked.d.ts +3 -0
- package/component/basic/icons/IconCreditCard.d.ts +3 -0
- package/component/basic/icons/IconCreditCardStroked.d.ts +3 -0
- package/component/basic/icons/IconCrop.d.ts +3 -0
- package/component/basic/icons/IconCrossCircleStroked.d.ts +3 -0
- package/component/basic/icons/IconCrossStroked.d.ts +3 -0
- package/component/basic/icons/IconCrown.d.ts +3 -0
- package/component/basic/icons/IconCrownStroked.d.ts +3 -0
- package/component/basic/icons/IconCustomerSupport.d.ts +3 -0
- package/component/basic/icons/IconCustomerSupportStroked.d.ts +3 -0
- package/component/basic/icons/IconCustomize.d.ts +3 -0
- package/component/basic/icons/IconDelete.d.ts +3 -0
- package/component/basic/icons/IconDeleteStroked.d.ts +3 -0
- package/component/basic/icons/IconDescend.d.ts +3 -0
- package/component/basic/icons/IconDescend2.d.ts +3 -0
- package/component/basic/icons/IconDesktop.d.ts +3 -0
- package/component/basic/icons/IconDisc.d.ts +3 -0
- package/component/basic/icons/IconDislikeThumb.d.ts +3 -0
- package/component/basic/icons/IconDivide.d.ts +3 -0
- package/component/basic/icons/IconDongchediLogo.d.ts +3 -0
- package/component/basic/icons/IconDoubleChevronLeft.d.ts +3 -0
- package/component/basic/icons/IconDoubleChevronRight.d.ts +3 -0
- package/component/basic/icons/IconDownCircle.d.ts +3 -0
- package/component/basic/icons/IconDownCircleStroked.d.ts +3 -0
- package/component/basic/icons/IconDownload.d.ts +3 -0
- package/component/basic/icons/IconDownloadStroked.d.ts +3 -0
- package/component/basic/icons/IconDuration.d.ts +3 -0
- package/component/basic/icons/IconEdit.d.ts +3 -0
- package/component/basic/icons/IconEdit2.d.ts +3 -0
- package/component/basic/icons/IconEdit2Stroked.d.ts +3 -0
- package/component/basic/icons/IconEditStroked.d.ts +3 -0
- package/component/basic/icons/IconElementStroked.d.ts +3 -0
- package/component/basic/icons/IconEmoji.d.ts +3 -0
- package/component/basic/icons/IconExcel.d.ts +3 -0
- package/component/basic/icons/IconExit.d.ts +3 -0
- package/component/basic/icons/IconExpand.d.ts +3 -0
- package/component/basic/icons/IconExport.d.ts +3 -0
- package/component/basic/icons/IconExternalOpen.d.ts +3 -0
- package/component/basic/icons/IconExternalOpenStroked.d.ts +3 -0
- package/component/basic/icons/IconEyeClosed.d.ts +3 -0
- package/component/basic/icons/IconEyeClosedSolid.d.ts +3 -0
- package/component/basic/icons/IconEyeClosedSolidStroked.d.ts +3 -0
- package/component/basic/icons/IconEyeClosedStroked.d.ts +3 -0
- package/component/basic/icons/IconEyeOpened.d.ts +3 -0
- package/component/basic/icons/IconEyeOpenedStroked.d.ts +3 -0
- package/component/basic/icons/IconEyedropper.d.ts +3 -0
- package/component/basic/icons/IconFacebook.d.ts +3 -0
- package/component/basic/icons/IconFaceuLogo.d.ts +3 -0
- package/component/basic/icons/IconFastForward.d.ts +3 -0
- package/component/basic/icons/IconFastFoward.d.ts +3 -0
- package/component/basic/icons/IconFavoriteList.d.ts +3 -0
- package/component/basic/icons/IconFeishuLogo.d.ts +3 -0
- package/component/basic/icons/IconFemale.d.ts +3 -0
- package/component/basic/icons/IconFigma.d.ts +3 -0
- package/component/basic/icons/IconFile.d.ts +3 -0
- package/component/basic/icons/IconFillStroked.d.ts +3 -0
- package/component/basic/icons/IconFilledArrowDown.d.ts +3 -0
- package/component/basic/icons/IconFilledArrowUp.d.ts +3 -0
- package/component/basic/icons/IconFilpVertical.d.ts +3 -0
- package/component/basic/icons/IconFilter.d.ts +3 -0
- package/component/basic/icons/IconFilterStroked.d.ts +3 -0
- package/component/basic/icons/IconFingerLeftStroked.d.ts +3 -0
- package/component/basic/icons/IconFixedStroked.d.ts +3 -0
- package/component/basic/icons/IconFlag.d.ts +3 -0
- package/component/basic/icons/IconFlagStroked.d.ts +3 -0
- package/component/basic/icons/IconFlipHorizontal.d.ts +3 -0
- package/component/basic/icons/IconFlowChartStroked.d.ts +3 -0
- package/component/basic/icons/IconFolder.d.ts +3 -0
- package/component/basic/icons/IconFolderOpen.d.ts +3 -0
- package/component/basic/icons/IconFolderOpenStroked.d.ts +3 -0
- package/component/basic/icons/IconFolderStroked.d.ts +3 -0
- package/component/basic/icons/IconFollowStroked.d.ts +3 -0
- package/component/basic/icons/IconFont.d.ts +3 -0
- package/component/basic/icons/IconFontColor.d.ts +3 -0
- package/component/basic/icons/IconForward.d.ts +3 -0
- package/component/basic/icons/IconForwardStroked.d.ts +3 -0
- package/component/basic/icons/IconFullScreenStroked.d.ts +3 -0
- package/component/basic/icons/IconGallery.d.ts +3 -0
- package/component/basic/icons/IconGift.d.ts +3 -0
- package/component/basic/icons/IconGiftStroked.d.ts +3 -0
- package/component/basic/icons/IconGit.d.ts +3 -0
- package/component/basic/icons/IconGithubLogo.d.ts +3 -0
- package/component/basic/icons/IconGitlabLogo.d.ts +3 -0
- package/component/basic/icons/IconGlobe.d.ts +3 -0
- package/component/basic/icons/IconGlobeStroke.d.ts +3 -0
- package/component/basic/icons/IconGlobeStrokeStroked.d.ts +3 -0
- package/component/basic/icons/IconGlobeStroked.d.ts +3 -0
- package/component/basic/icons/IconGridRectangle.d.ts +3 -0
- package/component/basic/icons/IconGridSquare.d.ts +3 -0
- package/component/basic/icons/IconGridStroked.d.ts +3 -0
- package/component/basic/icons/IconGridView.d.ts +3 -0
- package/component/basic/icons/IconGridView1.d.ts +3 -0
- package/component/basic/icons/IconH1.d.ts +3 -0
- package/component/basic/icons/IconH2.d.ts +3 -0
- package/component/basic/icons/IconH3.d.ts +3 -0
- package/component/basic/icons/IconH4.d.ts +3 -0
- package/component/basic/icons/IconH5.d.ts +3 -0
- package/component/basic/icons/IconH6.d.ts +3 -0
- package/component/basic/icons/IconH7.d.ts +3 -0
- package/component/basic/icons/IconH8.d.ts +3 -0
- package/component/basic/icons/IconH9.d.ts +3 -0
- package/component/basic/icons/IconHandle.d.ts +3 -0
- package/component/basic/icons/IconHash.d.ts +3 -0
- package/component/basic/icons/IconHeartStroked.d.ts +3 -0
- package/component/basic/icons/IconHelm.d.ts +3 -0
- package/component/basic/icons/IconHelpCircle.d.ts +3 -0
- package/component/basic/icons/IconHelpCircleStroked.d.ts +3 -0
- package/component/basic/icons/IconHistogram.d.ts +3 -0
- package/component/basic/icons/IconHistory.d.ts +3 -0
- package/component/basic/icons/IconHn.d.ts +3 -0
- package/component/basic/icons/IconHome.d.ts +3 -0
- package/component/basic/icons/IconHomeStroked.d.ts +3 -0
- package/component/basic/icons/IconHorn.d.ts +3 -0
- package/component/basic/icons/IconHornStroked.d.ts +3 -0
- package/component/basic/icons/IconHourglass.d.ts +3 -0
- package/component/basic/icons/IconHourglassStroked.d.ts +3 -0
- package/component/basic/icons/IconIdCard.d.ts +3 -0
- package/component/basic/icons/IconIdCardStroked.d.ts +3 -0
- package/component/basic/icons/IconIdentity.d.ts +3 -0
- package/component/basic/icons/IconImage.d.ts +3 -0
- package/component/basic/icons/IconImageStroked.d.ts +3 -0
- package/component/basic/icons/IconImport.d.ts +3 -0
- package/component/basic/icons/IconInbox.d.ts +3 -0
- package/component/basic/icons/IconIndenpentCornersStroked.d.ts +3 -0
- package/component/basic/icons/IconIndentLeft.d.ts +3 -0
- package/component/basic/icons/IconIndentRight.d.ts +3 -0
- package/component/basic/icons/IconIndependentCornersStroked.d.ts +3 -0
- package/component/basic/icons/IconInfoCircle.d.ts +3 -0
- package/component/basic/icons/IconInherit.d.ts +3 -0
- package/component/basic/icons/IconInheritStroked.d.ts +3 -0
- package/component/basic/icons/IconInnerSectionStroked.d.ts +3 -0
- package/component/basic/icons/IconInstagram.d.ts +3 -0
- package/component/basic/icons/IconInteractiveStroked.d.ts +3 -0
- package/component/basic/icons/IconInviteStroked.d.ts +3 -0
- package/component/basic/icons/IconIssueStroked.d.ts +3 -0
- package/component/basic/icons/IconItalic.d.ts +3 -0
- package/component/basic/icons/IconJianying.d.ts +3 -0
- package/component/basic/icons/IconKanban.d.ts +3 -0
- package/component/basic/icons/IconKey.d.ts +3 -0
- package/component/basic/icons/IconKeyStroked.d.ts +3 -0
- package/component/basic/icons/IconLanguage.d.ts +3 -0
- package/component/basic/icons/IconLayers.d.ts +3 -0
- package/component/basic/icons/IconLeftCircle.d.ts +3 -0
- package/component/basic/icons/IconLeftCircleStroked.d.ts +3 -0
- package/component/basic/icons/IconLightningStroked.d.ts +3 -0
- package/component/basic/icons/IconLikeHeart.d.ts +3 -0
- package/component/basic/icons/IconLikeThumb.d.ts +3 -0
- package/component/basic/icons/IconLineChartStroked.d.ts +3 -0
- package/component/basic/icons/IconLineHeight.d.ts +3 -0
- package/component/basic/icons/IconLink.d.ts +3 -0
- package/component/basic/icons/IconList.d.ts +3 -0
- package/component/basic/icons/IconListView.d.ts +3 -0
- package/component/basic/icons/IconLive.d.ts +3 -0
- package/component/basic/icons/IconLoading.d.ts +3 -0
- package/component/basic/icons/IconLock.d.ts +3 -0
- package/component/basic/icons/IconLockStroked.d.ts +3 -0
- package/component/basic/icons/IconLoopTextStroked.d.ts +3 -0
- package/component/basic/icons/IconMail.d.ts +3 -0
- package/component/basic/icons/IconMailStroked.d.ts +3 -0
- package/component/basic/icons/IconMailStroked1.d.ts +3 -0
- package/component/basic/icons/IconMale.d.ts +3 -0
- package/component/basic/icons/IconMapPin.d.ts +3 -0
- package/component/basic/icons/IconMapPinStroked.d.ts +3 -0
- package/component/basic/icons/IconMarginLeftStroked.d.ts +3 -0
- package/component/basic/icons/IconMarginStroked.d.ts +3 -0
- package/component/basic/icons/IconMark.d.ts +3 -0
- package/component/basic/icons/IconMaximize.d.ts +3 -0
- package/component/basic/icons/IconMaximize2.d.ts +3 -0
- package/component/basic/icons/IconMaximize2Stroked.d.ts +3 -0
- package/component/basic/icons/IconMember.d.ts +3 -0
- package/component/basic/icons/IconMenu.d.ts +3 -0
- package/component/basic/icons/IconMicrophone.d.ts +3 -0
- package/component/basic/icons/IconMicrophoneOff.d.ts +3 -0
- package/component/basic/icons/IconMicrophoneOffStroked.d.ts +3 -0
- package/component/basic/icons/IconMicrophoneStroked.d.ts +3 -0
- package/component/basic/icons/IconMiniPlayer.d.ts +3 -0
- package/component/basic/icons/IconMinimize.d.ts +3 -0
- package/component/basic/icons/IconMinus.d.ts +3 -0
- package/component/basic/icons/IconMinusCircle.d.ts +3 -0
- package/component/basic/icons/IconMinusCircleStroked.d.ts +3 -0
- package/component/basic/icons/IconMinusStroked.d.ts +3 -0
- package/component/basic/icons/IconModalStroked.d.ts +3 -0
- package/component/basic/icons/IconMoneyExchangeStroked.d.ts +3 -0
- package/component/basic/icons/IconMonitorStroked.d.ts +3 -0
- package/component/basic/icons/IconMoon.d.ts +3 -0
- package/component/basic/icons/IconMoonStroked.d.ts +3 -0
- package/component/basic/icons/IconMore.d.ts +3 -0
- package/component/basic/icons/IconMoreStroked.d.ts +3 -0
- package/component/basic/icons/IconMusic.d.ts +3 -0
- package/component/basic/icons/IconMusicNoteStroked.d.ts +3 -0
- package/component/basic/icons/IconMute.d.ts +3 -0
- package/component/basic/icons/IconMuteStroked.d.ts +3 -0
- package/component/basic/icons/IconNineGridStroked.d.ts +3 -0
- package/component/basic/icons/IconNoteMoney.d.ts +3 -0
- package/component/basic/icons/IconNoteMoneyStroked.d.ts +3 -0
- package/component/basic/icons/IconOption.d.ts +3 -0
- package/component/basic/icons/IconOrderedList.d.ts +3 -0
- package/component/basic/icons/IconOrderedListStroked.d.ts +3 -0
- package/component/basic/icons/IconPaperclip.d.ts +3 -0
- package/component/basic/icons/IconPaperclipStroked.d.ts +3 -0
- package/component/basic/icons/IconPause.d.ts +3 -0
- package/component/basic/icons/IconPdf.d.ts +3 -0
- package/component/basic/icons/IconPercentage.d.ts +3 -0
- package/component/basic/icons/IconPhone.d.ts +3 -0
- package/component/basic/icons/IconPhoneStroke.d.ts +3 -0
- package/component/basic/icons/IconPhoneStroked.d.ts +3 -0
- package/component/basic/icons/IconPieChart2Stroked.d.ts +3 -0
- package/component/basic/icons/IconPieChartStroked.d.ts +3 -0
- package/component/basic/icons/IconPiechartH5Stroked.d.ts +3 -0
- package/component/basic/icons/IconPipixiaLogo.d.ts +3 -0
- package/component/basic/icons/IconPlay.d.ts +3 -0
- package/component/basic/icons/IconPlayCircle.d.ts +3 -0
- package/component/basic/icons/IconPlus.d.ts +3 -0
- package/component/basic/icons/IconPlusCircle.d.ts +3 -0
- package/component/basic/icons/IconPlusCircleStroked.d.ts +3 -0
- package/component/basic/icons/IconPlusStroked.d.ts +3 -0
- package/component/basic/icons/IconPriceTag.d.ts +3 -0
- package/component/basic/icons/IconPrint.d.ts +3 -0
- package/component/basic/icons/IconPrize.d.ts +3 -0
- package/component/basic/icons/IconPrizeStroked.d.ts +3 -0
- package/component/basic/icons/IconPulse.d.ts +3 -0
- package/component/basic/icons/IconPuzzle.d.ts +3 -0
- package/component/basic/icons/IconQingyan.d.ts +3 -0
- package/component/basic/icons/IconQrCode.d.ts +3 -0
- package/component/basic/icons/IconQuit.d.ts +3 -0
- package/component/basic/icons/IconQuote.d.ts +3 -0
- package/component/basic/icons/IconRankingCardStroked.d.ts +3 -0
- package/component/basic/icons/IconRealSize.d.ts +3 -0
- package/component/basic/icons/IconRealSizeStroked.d.ts +3 -0
- package/component/basic/icons/IconRedo.d.ts +3 -0
- package/component/basic/icons/IconRedoStroked.d.ts +3 -0
- package/component/basic/icons/IconRefresh.d.ts +3 -0
- package/component/basic/icons/IconRefresh2.d.ts +3 -0
- package/component/basic/icons/IconRegExp.d.ts +3 -0
- package/component/basic/icons/IconReply.d.ts +3 -0
- package/component/basic/icons/IconReplyStroked.d.ts +3 -0
- package/component/basic/icons/IconResso.d.ts +3 -0
- package/component/basic/icons/IconRestart.d.ts +3 -0
- package/component/basic/icons/IconRestore.d.ts +3 -0
- package/component/basic/icons/IconRestoreStroked.d.ts +3 -0
- package/component/basic/icons/IconRingChartStroked.d.ts +3 -0
- package/component/basic/icons/IconRotate.d.ts +3 -0
- package/component/basic/icons/IconRotationStroked.d.ts +3 -0
- package/component/basic/icons/IconRoute.d.ts +3 -0
- package/component/basic/icons/IconRowsStroked.d.ts +3 -0
- package/component/basic/icons/IconSafe.d.ts +3 -0
- package/component/basic/icons/IconSafeStroked.d.ts +3 -0
- package/component/basic/icons/IconSave.d.ts +3 -0
- package/component/basic/icons/IconSaveStroked.d.ts +3 -0
- package/component/basic/icons/IconScan.d.ts +3 -0
- package/component/basic/icons/IconScissors.d.ts +3 -0
- package/component/basic/icons/IconScissorsStroked.d.ts +3 -0
- package/component/basic/icons/IconSearch.d.ts +3 -0
- package/component/basic/icons/IconSearchStroked.d.ts +3 -0
- package/component/basic/icons/IconSectionStroked.d.ts +3 -0
- package/component/basic/icons/IconSemiLogo.d.ts +3 -0
- package/component/basic/icons/IconSend.d.ts +3 -0
- package/component/basic/icons/IconSendMsgStroked.d.ts +3 -0
- package/component/basic/icons/IconSendStroked.d.ts +3 -0
- package/component/basic/icons/IconServer.d.ts +3 -0
- package/component/basic/icons/IconServerStroked.d.ts +3 -0
- package/component/basic/icons/IconSetting.d.ts +3 -0
- package/component/basic/icons/IconSettingStroked.d.ts +3 -0
- package/component/basic/icons/IconShare.d.ts +3 -0
- package/component/basic/icons/IconShareMoneyStroked.d.ts +3 -0
- package/component/basic/icons/IconShareStroked.d.ts +3 -0
- package/component/basic/icons/IconShield.d.ts +3 -0
- package/component/basic/icons/IconShieldStroked.d.ts +3 -0
- package/component/basic/icons/IconShift.d.ts +3 -0
- package/component/basic/icons/IconShoppingBag.d.ts +3 -0
- package/component/basic/icons/IconShoppingBagStroked.d.ts +3 -0
- package/component/basic/icons/IconShrink.d.ts +3 -0
- package/component/basic/icons/IconShrinkScreenStroked.d.ts +3 -0
- package/component/basic/icons/IconSidebar.d.ts +3 -0
- package/component/basic/icons/IconSignal.d.ts +3 -0
- package/component/basic/icons/IconSimilarity.d.ts +3 -0
- package/component/basic/icons/IconSmallTriangleDown.d.ts +3 -0
- package/component/basic/icons/IconSmallTriangleLeft.d.ts +3 -0
- package/component/basic/icons/IconSmallTriangleRight.d.ts +3 -0
- package/component/basic/icons/IconSmallTriangleTop.d.ts +3 -0
- package/component/basic/icons/IconSmartphoneCheckStroked.d.ts +3 -0
- package/component/basic/icons/IconSmartphoneStroked.d.ts +3 -0
- package/component/basic/icons/IconSong.d.ts +3 -0
- package/component/basic/icons/IconSonicStroked.d.ts +3 -0
- package/component/basic/icons/IconSort.d.ts +3 -0
- package/component/basic/icons/IconSortStroked.d.ts +3 -0
- package/component/basic/icons/IconSourceControl.d.ts +3 -0
- package/component/basic/icons/IconSpin.d.ts +3 -0
- package/component/basic/icons/IconStackBarChartStroked.d.ts +3 -0
- package/component/basic/icons/IconStar.d.ts +3 -0
- package/component/basic/icons/IconStarStroked.d.ts +3 -0
- package/component/basic/icons/IconStop.d.ts +3 -0
- package/component/basic/icons/IconStopwatchStroked.d.ts +3 -0
- package/component/basic/icons/IconStoryStroked.d.ts +3 -0
- package/component/basic/icons/IconStrikeThrough.d.ts +3 -0
- package/component/basic/icons/IconSun.d.ts +3 -0
- package/component/basic/icons/IconSunStroked.d.ts +3 -0
- package/component/basic/icons/IconSync.d.ts +3 -0
- package/component/basic/icons/IconTabArrowStroked.d.ts +3 -0
- package/component/basic/icons/IconTabsStroked.d.ts +3 -0
- package/component/basic/icons/IconTaskMoneyStroked.d.ts +3 -0
- package/component/basic/icons/IconTemplate.d.ts +3 -0
- package/component/basic/icons/IconTemplateStroked.d.ts +3 -0
- package/component/basic/icons/IconTerminal.d.ts +3 -0
- package/component/basic/icons/IconTestScore.d.ts +3 -0
- package/component/basic/icons/IconTestScoreStroked.d.ts +3 -0
- package/component/basic/icons/IconText.d.ts +3 -0
- package/component/basic/icons/IconTextRectangle.d.ts +3 -0
- package/component/basic/icons/IconTextStroked.d.ts +3 -0
- package/component/basic/icons/IconThumbUpStroked.d.ts +3 -0
- package/component/basic/icons/IconTick.d.ts +3 -0
- package/component/basic/icons/IconTickCircle.d.ts +3 -0
- package/component/basic/icons/IconTicketCode.d.ts +3 -0
- package/component/basic/icons/IconTicketCodeExchangeStroked.d.ts +3 -0
- package/component/basic/icons/IconTicketCodeStroked.d.ts +3 -0
- package/component/basic/icons/IconTiktokLogo.d.ts +3 -0
- package/component/basic/icons/IconTop.d.ts +3 -0
- package/component/basic/icons/IconTopCenterStroked.d.ts +3 -0
- package/component/basic/icons/IconTopLeftStroked.d.ts +3 -0
- package/component/basic/icons/IconTopRightStroked.d.ts +3 -0
- package/component/basic/icons/IconTopbuzzLogo.d.ts +3 -0
- package/component/basic/icons/IconToutiaoLogo.d.ts +3 -0
- package/component/basic/icons/IconTransparentStroked.d.ts +3 -0
- package/component/basic/icons/IconTreeTriangleDown.d.ts +3 -0
- package/component/basic/icons/IconTreeTriangleRight.d.ts +3 -0
- package/component/basic/icons/IconTriangleArrow.d.ts +3 -0
- package/component/basic/icons/IconTriangleArrowVertical.d.ts +3 -0
- package/component/basic/icons/IconTriangleDown.d.ts +3 -0
- package/component/basic/icons/IconTriangleUp.d.ts +3 -0
- package/component/basic/icons/IconTrueFalseStroked.d.ts +3 -0
- package/component/basic/icons/IconTvCheckedStroked.d.ts +3 -0
- package/component/basic/icons/IconTwitter.d.ts +3 -0
- package/component/basic/icons/IconTypograph.d.ts +3 -0
- package/component/basic/icons/IconUnChainStroked.d.ts +3 -0
- package/component/basic/icons/IconUnderline.d.ts +3 -0
- package/component/basic/icons/IconUndo.d.ts +3 -0
- package/component/basic/icons/IconUnlink.d.ts +3 -0
- package/component/basic/icons/IconUnlock.d.ts +3 -0
- package/component/basic/icons/IconUnlockStroked.d.ts +3 -0
- package/component/basic/icons/IconUpload.d.ts +3 -0
- package/component/basic/icons/IconUploadError.d.ts +3 -0
- package/component/basic/icons/IconUser.d.ts +3 -0
- package/component/basic/icons/IconUserAdd.d.ts +3 -0
- package/component/basic/icons/IconUserCardPhone.d.ts +3 -0
- package/component/basic/icons/IconUserCardVideo.d.ts +3 -0
- package/component/basic/icons/IconUserCardVideoStroked.d.ts +3 -0
- package/component/basic/icons/IconUserCircle.d.ts +3 -0
- package/component/basic/icons/IconUserCircleStroked.d.ts +3 -0
- package/component/basic/icons/IconUserGroup.d.ts +3 -0
- package/component/basic/icons/IconUserList.d.ts +3 -0
- package/component/basic/icons/IconUserListStroked.d.ts +3 -0
- package/component/basic/icons/IconUserSetting.d.ts +3 -0
- package/component/basic/icons/IconUserStroked.d.ts +3 -0
- package/component/basic/icons/IconVennChartStroked.d.ts +3 -0
- package/component/basic/icons/IconVerify.d.ts +3 -0
- package/component/basic/icons/IconVersionStroked.d.ts +3 -0
- package/component/basic/icons/IconVideo.d.ts +3 -0
- package/component/basic/icons/IconVideoDouyinStroked.d.ts +3 -0
- package/component/basic/icons/IconVideoListStroked.d.ts +3 -0
- package/component/basic/icons/IconVideoStroked.d.ts +3 -0
- package/component/basic/icons/IconVideoUrlStroked.d.ts +3 -0
- package/component/basic/icons/IconVigoLogo.d.ts +3 -0
- package/component/basic/icons/IconVolume1.d.ts +3 -0
- package/component/basic/icons/IconVolume1Stroked.d.ts +3 -0
- package/component/basic/icons/IconVolume2.d.ts +3 -0
- package/component/basic/icons/IconVolume2Stroked.d.ts +3 -0
- package/component/basic/icons/IconVolumeSilentStroked.d.ts +3 -0
- package/component/basic/icons/IconVolumnSilent.d.ts +3 -0
- package/component/basic/icons/IconVoteStroked.d.ts +3 -0
- package/component/basic/icons/IconVoteVideoStroked.d.ts +3 -0
- package/component/basic/icons/IconWeibo.d.ts +3 -0
- package/component/basic/icons/IconWholeWord.d.ts +3 -0
- package/component/basic/icons/IconWifi.d.ts +3 -0
- package/component/basic/icons/IconWindowAdaptionStroked.d.ts +3 -0
- package/component/basic/icons/IconWord.d.ts +3 -0
- package/component/basic/icons/IconWrench.d.ts +3 -0
- package/component/basic/icons/IconWrenchStroked.d.ts +3 -0
- package/component/basic/icons/IconXiguaLogo.d.ts +3 -0
- package/component/basic/icons/IconYoutube.d.ts +3 -0
- package/component/basic/icons/index.d.ts +522 -0
- package/component/basic/index.d.ts +19 -0
- package/component/display/Avatar.d.ts +22 -0
- package/component/display/Badge.d.ts +22 -0
- package/component/display/Calendar.d.ts +28 -0
- package/component/display/Card.d.ts +32 -0
- package/component/display/Carousel.d.ts +32 -0
- package/component/display/Collapse.d.ts +34 -0
- package/component/display/Collapsible.d.ts +31 -0
- package/component/display/Cropper.d.ts +47 -0
- package/component/display/Descriptions.d.ts +46 -0
- package/component/display/Dropdown.d.ts +57 -0
- package/component/display/Empty.d.ts +18 -0
- package/component/display/Highlight.d.ts +20 -0
- package/component/display/Image.d.ts +33 -0
- package/component/display/List.d.ts +23 -0
- package/component/display/Modal.d.ts +43 -0
- package/component/display/OverflowList.d.ts +28 -0
- package/component/display/Popover.d.ts +40 -0
- package/component/display/ScrollList.d.ts +70 -0
- package/component/display/SideSheet.d.ts +40 -0
- package/component/display/Table.d.ts +59 -0
- package/component/display/Tag.d.ts +24 -0
- package/component/display/Timeline.d.ts +28 -0
- package/component/display/Tooltip.d.ts +50 -0
- package/component/display/UserGuide.d.ts +31 -0
- package/component/display/VChart.d.ts +23 -0
- package/component/display/index.d.ts +50 -0
- package/component/feedback/Banner.d.ts +31 -0
- package/component/feedback/Feedback.d.ts +62 -0
- package/component/feedback/Notification.d.ts +38 -0
- package/component/feedback/Popconfirm.d.ts +75 -0
- package/component/feedback/Progress.d.ts +49 -0
- package/component/feedback/Skeleton.d.ts +68 -0
- package/component/feedback/Spin.d.ts +31 -0
- package/component/feedback/Toast.d.ts +60 -0
- package/component/feedback/index.d.ts +14 -0
- package/component/index.d.ts +8 -0
- package/component/input/AutoComplete.d.ts +60 -0
- package/component/input/Cascader.d.ts +77 -0
- package/component/input/Checkbox.d.ts +63 -0
- package/component/input/ColorPicker.d.ts +78 -0
- package/component/input/DatePicker.d.ts +113 -0
- package/component/input/Form.d.ts +97 -0
- package/component/input/Input.d.ts +56 -0
- package/component/input/InputNumber.d.ts +46 -0
- package/component/input/KeyValueEditor.d.ts +32 -0
- package/component/input/PinCode.d.ts +46 -0
- package/component/input/Radio.d.ts +60 -0
- package/component/input/Rating.d.ts +39 -0
- package/component/input/Select.d.ts +80 -0
- package/component/input/Slider.d.ts +40 -0
- package/component/input/Switch.d.ts +33 -0
- package/component/input/TagInput.d.ts +44 -0
- package/component/input/TimePicker.d.ts +74 -0
- package/component/input/Transfer.d.ts +49 -0
- package/component/input/TreeSelect.d.ts +68 -0
- package/component/input/Upload.d.ts +95 -0
- package/component/input/index.d.ts +40 -0
- package/component/navigation/Anchor.d.ts +40 -0
- package/component/navigation/BackTop.d.ts +28 -0
- package/component/navigation/Breadcrumb.d.ts +33 -0
- package/component/navigation/Navigation.d.ts +48 -0
- package/component/navigation/Pagination.d.ts +32 -0
- package/component/navigation/Steps.d.ts +52 -0
- package/component/navigation/Tabs.d.ts +54 -0
- package/component/navigation/Tree.d.ts +68 -0
- package/component/navigation/index.d.ts +16 -0
- package/component/other/ConfigProvider.d.ts +24 -0
- package/component/other/LocaleProvider.d.ts +30 -0
- package/component/other/index.d.ts +4 -0
- package/component/plus/AudioPlayer.d.ts +70 -0
- package/component/plus/Chat.d.ts +39 -0
- package/component/plus/CodeEditor.d.ts +86 -0
- package/component/plus/CodeHighlight.d.ts +33 -0
- package/component/plus/DragMove.d.ts +51 -0
- package/component/plus/HotKeys.d.ts +29 -0
- package/component/plus/JsonViewer.d.ts +34 -0
- package/component/plus/Lottie.d.ts +40 -0
- package/component/plus/Markdown.d.ts +22 -0
- package/component/plus/VideoPlayer.d.ts +84 -0
- package/component/plus/index.d.ts +20 -0
- package/index.d.ts +3 -0
- package/index.js +2 -0
- package/index.js.map +1 -0
- package/package.json +41 -0
- package/test/UITestApp.d.ts +120 -0
- package/test/index.d.ts +1 -0
package/README.md
ADDED
|
@@ -0,0 +1,2189 @@
|
|
|
1
|
+
# Knight-UI
|
|
2
|
+
|
|
3
|
+
基于 React 18+ 的企业级前端 UI 组件库,提供 80+ 高质量组件。
|
|
4
|
+
|
|
5
|
+
## 目录
|
|
6
|
+
|
|
7
|
+
- [安装](#安装)
|
|
8
|
+
- [快速开始](#快速开始)
|
|
9
|
+
- [主题定制](#主题定制)
|
|
10
|
+
- [通用 Props](#通用-propsuiprops)
|
|
11
|
+
- Basic 基础
|
|
12
|
+
- [Button 按钮](#button-按钮)
|
|
13
|
+
- [FloatButton 悬浮按钮](#floatbutton-悬浮按钮)
|
|
14
|
+
- [Icon 图标](#icon-图标)
|
|
15
|
+
- [Typography 排版](#typography-排版)
|
|
16
|
+
- [Divider 分割线](#divider-分割线)
|
|
17
|
+
- [Space 间距](#space-间距)
|
|
18
|
+
- [Layout 布局](#layout-布局)
|
|
19
|
+
- [Grid 栅格](#grid-栅格)
|
|
20
|
+
- [Resizable 可调整尺寸](#resizable-可调整尺寸)
|
|
21
|
+
- Input 输入
|
|
22
|
+
- [Input 输入框](#input-输入框)
|
|
23
|
+
- [InputNumber 数字输入](#inputnumber-数字输入)
|
|
24
|
+
- [Select 选择器](#select-选择器)
|
|
25
|
+
- [Cascader 级联选择](#cascader-级联选择)
|
|
26
|
+
- [DatePicker 日期选择](#datepicker-日期选择)
|
|
27
|
+
- [TimePicker 时间选择](#timepicker-时间选择)
|
|
28
|
+
- [Checkbox 复选框](#checkbox-复选框)
|
|
29
|
+
- [Radio 单选框](#radio-单选框)
|
|
30
|
+
- [Switch 开关](#switch-开关)
|
|
31
|
+
- [Slider 滑块](#slider-滑块)
|
|
32
|
+
- [Rating 评分](#rating-评分)
|
|
33
|
+
- [TagInput 标签输入](#taginput-标签输入)
|
|
34
|
+
- [ColorPicker 颜色选择器](#colorpicker-颜色选择器)
|
|
35
|
+
- [Upload 上传](#upload-上传)
|
|
36
|
+
- [AutoComplete 自动完成](#autocomplete-自动完成)
|
|
37
|
+
- [Transfer 穿梭框](#transfer-穿梭框)
|
|
38
|
+
- [TreeSelect 树选择](#treeselect-树选择)
|
|
39
|
+
- [PinCode 验证码输入](#pincode-验证码输入)
|
|
40
|
+
- [Form 表单](#form-表单)
|
|
41
|
+
- Navigation 导航
|
|
42
|
+
- [Navigation 导航菜单](#navigation-导航菜单)
|
|
43
|
+
- [Tabs 标签页](#tabs-标签页)
|
|
44
|
+
- [Tree 树](#tree-树)
|
|
45
|
+
- [Breadcrumb 面包屑](#breadcrumb-面包屑)
|
|
46
|
+
- [Steps 步骤条](#steps-步骤条)
|
|
47
|
+
- [Pagination 分页](#pagination-分页)
|
|
48
|
+
- [Anchor 锚点](#anchor-锚点)
|
|
49
|
+
- [BackTop 回到顶部](#backtop-回到顶部)
|
|
50
|
+
- Display 展示
|
|
51
|
+
- [Avatar 头像](#avatar-头像)
|
|
52
|
+
- [Badge 角标](#badge-角标)
|
|
53
|
+
- [Card 卡片](#card-卡片)
|
|
54
|
+
- [Tag 标签](#tag-标签)
|
|
55
|
+
- [Collapse 折叠面板](#collapse-折叠面板)
|
|
56
|
+
- [Collapsible 轻量折叠](#collapsible-轻量折叠)
|
|
57
|
+
- [Descriptions 描述列表](#descriptions-描述列表)
|
|
58
|
+
- [Empty 空状态](#empty-空状态)
|
|
59
|
+
- [Image 图片](#image-图片)
|
|
60
|
+
- [List 列表](#list-列表)
|
|
61
|
+
- [Table 表格](#table-表格)
|
|
62
|
+
- [Modal 模态框](#modal-模态框)
|
|
63
|
+
- [SideSheet 侧边面板](#sidesheet-侧边面板)
|
|
64
|
+
- [Dropdown 下拉菜单](#dropdown-下拉菜单)
|
|
65
|
+
- [Popover 气泡卡片](#popover-气泡卡片)
|
|
66
|
+
- [Tooltip 文字提示](#tooltip-文字提示)
|
|
67
|
+
- [Popconfirm 气泡确认框](#popconfirm-气泡确认框)
|
|
68
|
+
- [Calendar 日历](#calendar-日历)
|
|
69
|
+
- [Carousel 轮播](#carousel-轮播)
|
|
70
|
+
- [Timeline 时间轴](#timeline-时间轴)
|
|
71
|
+
- [ScrollList 滚动列表](#scrolllist-滚动列表)
|
|
72
|
+
- [Highlight 高亮](#highlight-高亮)
|
|
73
|
+
- [Cropper 裁剪](#cropper-裁剪)
|
|
74
|
+
- [UserGuide 用户引导](#userguide-用户引导)
|
|
75
|
+
- [VChart 图表](#vchart-图表)
|
|
76
|
+
- [OverflowList 溢出列表](#overflowlist-溢出列表)
|
|
77
|
+
- Feedback 反馈
|
|
78
|
+
- [Toast 轻提示](#toast-轻提示命令式)
|
|
79
|
+
- [Notification 通知](#notification-通知命令式)
|
|
80
|
+
- [Banner 横幅](#banner-横幅)
|
|
81
|
+
- [Progress 进度条](#progress-进度条)
|
|
82
|
+
- [Skeleton 骨架屏](#skeleton-骨架屏)
|
|
83
|
+
- [Spin 加载中](#spin-加载中)
|
|
84
|
+
- [Feedback 反馈组件](#feedback-反馈组件)
|
|
85
|
+
- Plus 增强
|
|
86
|
+
- [Markdown](#markdown)
|
|
87
|
+
- [CodeEditor 代码编辑器](#codeeditor-代码编辑器)
|
|
88
|
+
- [CodeHighlight 代码高亮](#codehighlight-代码高亮)
|
|
89
|
+
- [JsonViewer JSON 查看器](#jsonviewer-json-查看器)
|
|
90
|
+
- [Chat 聊天](#chat-聊天)
|
|
91
|
+
- [AudioPlayer 音频播放器](#audioplayer-音频播放器)
|
|
92
|
+
- [VideoPlayer 视频播放器](#videoplayer-视频播放器)
|
|
93
|
+
- [DragMove 拖拽移动](#dragmove-拖拽移动)
|
|
94
|
+
- [HotKeys 快捷键](#hotkeys-快捷键)
|
|
95
|
+
- [Lottie 动画](#lottie-动画)
|
|
96
|
+
- AI 智能
|
|
97
|
+
- [AIChatInput AI 对话输入](#aichatinput-ai-对话输入)
|
|
98
|
+
- [AIChatDialogue AI 对话展示](#aichatdialogue-ai-对话展示)
|
|
99
|
+
- [Sidebar AI 侧栏](#sidebar-ai-侧栏)
|
|
100
|
+
- Other 其他
|
|
101
|
+
- [ConfigProvider 全局配置](#configprovider-全局配置)
|
|
102
|
+
- [LocaleProvider 国际化](#localeprovider-国际化)
|
|
103
|
+
- [Peer 依赖](#peer-依赖)
|
|
104
|
+
|
|
105
|
+
## 安装
|
|
106
|
+
|
|
107
|
+
```bash
|
|
108
|
+
npm install knight-ui
|
|
109
|
+
```
|
|
110
|
+
|
|
111
|
+
## 快速开始
|
|
112
|
+
|
|
113
|
+
```tsx
|
|
114
|
+
import React from "react";
|
|
115
|
+
import { createRoot } from "react-dom/client";
|
|
116
|
+
import { Button, ConfigProvider } from "knight-ui";
|
|
117
|
+
|
|
118
|
+
const App = () => (
|
|
119
|
+
<ConfigProvider componentSize="default">
|
|
120
|
+
<Button type="primary" onClick={() => alert("Hello Knight-UI")}>
|
|
121
|
+
点击按钮
|
|
122
|
+
</Button>
|
|
123
|
+
</ConfigProvider>
|
|
124
|
+
);
|
|
125
|
+
|
|
126
|
+
createRoot(document.getElementById("root")!).render(<App />);
|
|
127
|
+
```
|
|
128
|
+
|
|
129
|
+
同时引入样式 Token(CSS 变量):
|
|
130
|
+
|
|
131
|
+
```tsx
|
|
132
|
+
import "knight-ui/component/_tokens/tokens.css";
|
|
133
|
+
```
|
|
134
|
+
|
|
135
|
+
## 主题定制
|
|
136
|
+
|
|
137
|
+
Knight-UI 通过 CSS 自定义属性(CSS Variables)实现主题系统。在 `<html>` 上设置 `data-ku-theme` 属性切换暗亮模式:
|
|
138
|
+
|
|
139
|
+
```html
|
|
140
|
+
<html data-ku-theme="dark"><!-- 暗色模式 --></html>
|
|
141
|
+
<html data-ku-theme="light"><!-- 亮色模式 --></html>
|
|
142
|
+
```
|
|
143
|
+
|
|
144
|
+
常用 Token 变量:
|
|
145
|
+
|
|
146
|
+
| 变量名 | 说明 |
|
|
147
|
+
|---|---|
|
|
148
|
+
| `--ku-color-primary` | 主色 |
|
|
149
|
+
| `--ku-color-text-0` | 主要文本色 |
|
|
150
|
+
| `--ku-color-text-1` | 次要文本色 |
|
|
151
|
+
| `--ku-color-bg-0` | 主背景色 |
|
|
152
|
+
| `--ku-color-bg-1` | 次背景色 |
|
|
153
|
+
| `--ku-color-bg-2` | 三级背景色 |
|
|
154
|
+
| `--ku-color-border` | 边框色 |
|
|
155
|
+
| `--ku-font-family` | 全局字体 |
|
|
156
|
+
|
|
157
|
+
## 通用 Props(UIProps)
|
|
158
|
+
|
|
159
|
+
所有组件继承以下通用属性:
|
|
160
|
+
|
|
161
|
+
| 属性 | 类型 | 说明 |
|
|
162
|
+
|---|---|---|
|
|
163
|
+
| `style` | `React.CSSProperties` | 内联样式 |
|
|
164
|
+
| `className` | `string` | 自定义类名 |
|
|
165
|
+
| `disabled` | `boolean` | 是否禁用 |
|
|
166
|
+
| `visible` | `boolean` | 是否可见 |
|
|
167
|
+
| `id` | `string` | DOM id |
|
|
168
|
+
| `theme` | `string` | 主题变体 |
|
|
169
|
+
| `cssVars` | `Record<string, string>` | CSS 变量覆盖 |
|
|
170
|
+
|
|
171
|
+
---
|
|
172
|
+
|
|
173
|
+
## Basic 基础
|
|
174
|
+
|
|
175
|
+
### Button 按钮
|
|
176
|
+
|
|
177
|
+
```tsx
|
|
178
|
+
import { Button } from "knight-ui";
|
|
179
|
+
|
|
180
|
+
// 基础用法
|
|
181
|
+
<Button type="primary" onClick={() => console.log("clicked")}>主要按钮</Button>
|
|
182
|
+
<Button type="secondary">次要按钮</Button>
|
|
183
|
+
<Button type="danger">危险按钮</Button>
|
|
184
|
+
|
|
185
|
+
// 带图标 + 加载
|
|
186
|
+
<Button type="primary" icon={<IconSearch />} loading>搜索中</Button>
|
|
187
|
+
|
|
188
|
+
// 按钮组
|
|
189
|
+
<Button.Group>
|
|
190
|
+
<Button type="secondary" theme="light">左</Button>
|
|
191
|
+
<Button type="primary" theme="light">中</Button>
|
|
192
|
+
<Button type="secondary" theme="light">右</Button>
|
|
193
|
+
</Button.Group>
|
|
194
|
+
```
|
|
195
|
+
|
|
196
|
+
| 属性 | 类型 | 默认值 | 说明 |
|
|
197
|
+
|---|---|---|---|
|
|
198
|
+
| `type` | `"primary" \| "secondary" \| "tertiary" \| "warning" \| "danger"` | `"primary"` | 按钮类型 |
|
|
199
|
+
| `theme` | `"solid" \| "borderless" \| "light"` | `"solid"` | 按钮主题 |
|
|
200
|
+
| `size` | `"small" \| "default" \| "large"` | `"default"` | 按钮尺寸 |
|
|
201
|
+
| `shape` | `"circle" \| "round"` | — | 按钮形状 |
|
|
202
|
+
| `icon` | `React.ReactNode` | — | 图标 |
|
|
203
|
+
| `iconPosition` | `"left" \| "right"` | `"left"` | 图标位置 |
|
|
204
|
+
| `loading` | `boolean` | `false` | 加载中 |
|
|
205
|
+
| `block` | `boolean` | `false` | 通栏 100% 宽度 |
|
|
206
|
+
| `htmlType` | `"button" \| "submit" \| "reset"` | `"button"` | 原生 type |
|
|
207
|
+
| `onClick` | `(e: MouseEvent) => void` | — | 点击回调 |
|
|
208
|
+
|
|
209
|
+
### FloatButton 悬浮按钮
|
|
210
|
+
|
|
211
|
+
```tsx
|
|
212
|
+
import { FloatButton } from "knight-ui";
|
|
213
|
+
|
|
214
|
+
<FloatButton icon={<IconPlus />} size={40} onClick={() => console.log("clicked")} />
|
|
215
|
+
|
|
216
|
+
// 按钮组
|
|
217
|
+
<FloatButton.Group icon={<IconPlus />} size={40} direction="vertical">
|
|
218
|
+
<IconEdit />
|
|
219
|
+
<IconStar />
|
|
220
|
+
<IconSetting />
|
|
221
|
+
</FloatButton.Group>
|
|
222
|
+
```
|
|
223
|
+
|
|
224
|
+
| 属性 | 类型 | 默认值 | 说明 |
|
|
225
|
+
|---|---|---|---|
|
|
226
|
+
| `icon` | `React.ReactNode` | — | 图标 |
|
|
227
|
+
| `size` | `number` | — | 尺寸(px) |
|
|
228
|
+
| `position` | `{ right?, bottom?, left?, top? }` | — | 定位偏移 |
|
|
229
|
+
| `onClick` | `(e: MouseEvent) => void` | — | 点击回调 |
|
|
230
|
+
|
|
231
|
+
**FloatButton.Group** 额外支持 `direction: "vertical" | "horizontal"`。
|
|
232
|
+
|
|
233
|
+
### Icon 图标
|
|
234
|
+
|
|
235
|
+
```tsx
|
|
236
|
+
import { Icon, IconStar, IconDelete, IconRefresh } from "knight-ui";
|
|
237
|
+
|
|
238
|
+
// 通用 Icon 组件
|
|
239
|
+
<Icon type="IconStar" size="large" color="#f59e0b" />
|
|
240
|
+
|
|
241
|
+
// 独立组件(推荐,支持 tree-shaking)
|
|
242
|
+
<IconStar size="large" color="#f59e0b" />
|
|
243
|
+
<IconDelete size="large" color="#ef4444" onClick={() => console.log("delete")} />
|
|
244
|
+
<IconRefresh spin size="large" />
|
|
245
|
+
<IconArrowRight rotate={90} />
|
|
246
|
+
```
|
|
247
|
+
|
|
248
|
+
| 属性 | 类型 | 默认值 | 说明 |
|
|
249
|
+
|---|---|---|---|
|
|
250
|
+
| `type` | `IconType` | — | 图标类型(200+) |
|
|
251
|
+
| `size` | `"extraSmall" \| "small" \| "default" \| "large" \| "extraLarge"` | `"default"` | 尺寸 |
|
|
252
|
+
| `color` | `string` | — | 颜色 |
|
|
253
|
+
| `spin` | `boolean` | `false` | 旋转动画 |
|
|
254
|
+
| `rotate` | `number` | — | 固定旋转角度 |
|
|
255
|
+
| `onClick` | `(e: MouseEvent) => void` | — | 点击回调 |
|
|
256
|
+
|
|
257
|
+
### Typography 排版
|
|
258
|
+
|
|
259
|
+
```tsx
|
|
260
|
+
import { Title, Text, Paragraph } from "knight-ui";
|
|
261
|
+
|
|
262
|
+
<Title heading={1}>H1 标题</Title>
|
|
263
|
+
<Text type="secondary" strong>加粗次要文本</Text>
|
|
264
|
+
<Text mark>高亮文本</Text>
|
|
265
|
+
<Text code>const x = 1;</Text>
|
|
266
|
+
<Text delete>已删除文本</Text>
|
|
267
|
+
<Text ellipsis>超长文本溢出省略...</Text>
|
|
268
|
+
|
|
269
|
+
<Paragraph spacing="extended">
|
|
270
|
+
段落内容,spacing 控制段落间距。
|
|
271
|
+
</Paragraph>
|
|
272
|
+
```
|
|
273
|
+
|
|
274
|
+
**Title**:`heading: 1-6`、`ellipsis`
|
|
275
|
+
|
|
276
|
+
**Text**:`type`(`"primary" | "secondary" | "tertiary" | "quaternary" | "warning" | "danger" | "success"`)、`strong`、`underline`、`delete`、`mark`、`code`、`ellipsis`
|
|
277
|
+
|
|
278
|
+
**Paragraph**:`spacing: "normal" | "extended"`、`ellipsis`
|
|
279
|
+
|
|
280
|
+
### Divider 分割线
|
|
281
|
+
|
|
282
|
+
```tsx
|
|
283
|
+
import { Divider } from "knight-ui";
|
|
284
|
+
|
|
285
|
+
// 水平
|
|
286
|
+
<Divider />
|
|
287
|
+
<Divider align="left">左侧文字</Divider>
|
|
288
|
+
<Divider dashed />
|
|
289
|
+
<Divider color="#a78bfa" margin={24}>紫色分割线</Divider>
|
|
290
|
+
|
|
291
|
+
// 垂直
|
|
292
|
+
<div style={{ display: "flex", alignItems: "center", height: 60 }}>
|
|
293
|
+
<Text>左</Text>
|
|
294
|
+
<Divider layout="vertical" />
|
|
295
|
+
<Text>右</Text>
|
|
296
|
+
</div>
|
|
297
|
+
```
|
|
298
|
+
|
|
299
|
+
| 属性 | 类型 | 默认值 | 说明 |
|
|
300
|
+
|---|---|---|---|
|
|
301
|
+
| `layout` | `"horizontal" \| "vertical"` | `"horizontal"` | 方向 |
|
|
302
|
+
| `dashed` | `boolean` | `false` | 虚线 |
|
|
303
|
+
| `align` | `"left" \| "center" \| "right"` | `"center"` | 文字对齐 |
|
|
304
|
+
| `margin` | `string \| number` | — | 间距 |
|
|
305
|
+
| `color` | `string` | — | 颜色 |
|
|
306
|
+
|
|
307
|
+
### Space 间距
|
|
308
|
+
|
|
309
|
+
```tsx
|
|
310
|
+
import { Space, Button } from "knight-ui";
|
|
311
|
+
|
|
312
|
+
// 水平排列
|
|
313
|
+
<Space spacing="medium">
|
|
314
|
+
<Button>A</Button>
|
|
315
|
+
<Button>B</Button>
|
|
316
|
+
<Button>C</Button>
|
|
317
|
+
</Space>
|
|
318
|
+
|
|
319
|
+
// 垂直 + 自动换行
|
|
320
|
+
<Space vertical spacing={16} wrap align="start">
|
|
321
|
+
<Button>第一行</Button>
|
|
322
|
+
<Button>第二行</Button>
|
|
323
|
+
</Space>
|
|
324
|
+
```
|
|
325
|
+
|
|
326
|
+
| 属性 | 类型 | 默认值 | 说明 |
|
|
327
|
+
|---|---|---|---|
|
|
328
|
+
| `spacing` | `"tight" \| "medium" \| "loose" \| "extraLoose" \| number` | `"medium"` | 间距 |
|
|
329
|
+
| `align` | `"start" \| "center" \| "end" \| "baseline"` | `"center"` | 对齐方式 |
|
|
330
|
+
| `vertical` | `boolean` | `false` | 垂直排列 |
|
|
331
|
+
| `wrap` | `boolean` | `false` | 自动换行 |
|
|
332
|
+
|
|
333
|
+
### Layout 布局
|
|
334
|
+
|
|
335
|
+
```tsx
|
|
336
|
+
import { Layout, Text } from "knight-ui";
|
|
337
|
+
|
|
338
|
+
<Layout style={{ height: 400 }}>
|
|
339
|
+
<Layout.Header style={{ padding: 16, background: "#1e1e2e" }}>
|
|
340
|
+
<Text strong>Header</Text>
|
|
341
|
+
</Layout.Header>
|
|
342
|
+
<div style={{ display: "flex", flex: 1 }}>
|
|
343
|
+
<Layout.Sider width={200} style={{ background: "#16162a", padding: 16 }}>
|
|
344
|
+
<Text>Sider</Text>
|
|
345
|
+
</Layout.Sider>
|
|
346
|
+
<Layout.Content style={{ padding: 16 }}>
|
|
347
|
+
<Text>Content</Text>
|
|
348
|
+
</Layout.Content>
|
|
349
|
+
</div>
|
|
350
|
+
<Layout.Footer style={{ padding: 8, background: "#1e1e2e", textAlign: "center" }}>
|
|
351
|
+
<Text>Footer</Text>
|
|
352
|
+
</Layout.Footer>
|
|
353
|
+
</Layout>
|
|
354
|
+
```
|
|
355
|
+
|
|
356
|
+
子组件:`Layout.Header`、`Layout.Sider`、`Layout.Content`、`Layout.Footer`
|
|
357
|
+
|
|
358
|
+
**Layout.Sider**:`width`、`collapsedWidth`、`defaultCollapsed`、`trigger`
|
|
359
|
+
|
|
360
|
+
### Grid 栅格
|
|
361
|
+
|
|
362
|
+
```tsx
|
|
363
|
+
import { Row, Col } from "knight-ui";
|
|
364
|
+
|
|
365
|
+
<Row gutter={16} justify="center">
|
|
366
|
+
<Col span={8}><div>col-8</div></Col>
|
|
367
|
+
<Col span={8}><div>col-8</div></Col>
|
|
368
|
+
<Col span={8}><div>col-8</div></Col>
|
|
369
|
+
</Row>
|
|
370
|
+
|
|
371
|
+
<Row gutter={[16, 24]}>
|
|
372
|
+
<Col span={12} offset={6}><div>col-12 offset-6</div></Col>
|
|
373
|
+
</Row>
|
|
374
|
+
```
|
|
375
|
+
|
|
376
|
+
**Row**:`gutter`、`justify`(`"start" | "end" | "center" | "space-around" | "space-between"`)、`align`(`"top" | "middle" | "bottom"`)
|
|
377
|
+
|
|
378
|
+
**Col**:`span`(24 等分)、`offset`、`xs/sm/md/lg/xl/xxl`
|
|
379
|
+
|
|
380
|
+
### Resizable 可调整尺寸
|
|
381
|
+
|
|
382
|
+
```tsx
|
|
383
|
+
import { Resizable } from "knight-ui";
|
|
384
|
+
|
|
385
|
+
<Resizable
|
|
386
|
+
defaultWidth={400}
|
|
387
|
+
defaultHeight={300}
|
|
388
|
+
minWidth={200}
|
|
389
|
+
minHeight={150}
|
|
390
|
+
maxWidth={800}
|
|
391
|
+
maxHeight={600}
|
|
392
|
+
onResize={(w, h) => console.log(w, h)}
|
|
393
|
+
>
|
|
394
|
+
<div>拖拽边缘或角落调整尺寸</div>
|
|
395
|
+
</Resizable>
|
|
396
|
+
|
|
397
|
+
// 仅右侧可拖拽
|
|
398
|
+
<Resizable defaultWidth={300} resizeEdge={["right"]} minWidth={150}>
|
|
399
|
+
<div>拖拽右边缘</div>
|
|
400
|
+
</Resizable>
|
|
401
|
+
|
|
402
|
+
// 等比缩放
|
|
403
|
+
<Resizable defaultWidth={400} defaultHeight={300} lockAspectRatio>
|
|
404
|
+
<div>锁定宽高比</div>
|
|
405
|
+
</Resizable>
|
|
406
|
+
```
|
|
407
|
+
|
|
408
|
+
| 属性 | 类型 | 默认值 | 说明 |
|
|
409
|
+
|---|---|---|---|
|
|
410
|
+
| `defaultWidth / defaultHeight` | `number` | — | 默认尺寸 |
|
|
411
|
+
| `minWidth / minHeight` | `number` | — | 最小尺寸 |
|
|
412
|
+
| `maxWidth / maxHeight` | `number` | — | 最大尺寸 |
|
|
413
|
+
| `resizeEdge` | `ResizeEdge[]` | 全部 | 可拖拽边缘 |
|
|
414
|
+
| `lockAspectRatio` | `boolean` | `false` | 锁定宽高比 |
|
|
415
|
+
| `onResize` | `(w, h) => void` | — | 尺寸变化回调 |
|
|
416
|
+
|
|
417
|
+
---
|
|
418
|
+
|
|
419
|
+
## Input 输入
|
|
420
|
+
|
|
421
|
+
### Input 输入框
|
|
422
|
+
|
|
423
|
+
```tsx
|
|
424
|
+
import { Input } from "knight-ui";
|
|
425
|
+
|
|
426
|
+
<Input placeholder="请输入" onChange={(v) => console.log(v)} />
|
|
427
|
+
<Input showClear defaultValue="可清除" />
|
|
428
|
+
<Input prefix={<IconSearch />} placeholder="搜索" />
|
|
429
|
+
<Input addonBefore="https://" addonAfter=".com" placeholder="域名" />
|
|
430
|
+
<Input type="password" placeholder="密码" />
|
|
431
|
+
<Input size="large" placeholder="大尺寸" />
|
|
432
|
+
|
|
433
|
+
// 多行文本
|
|
434
|
+
<Input.TextArea rows={4} placeholder="多行文本" onChange={(v) => console.log(v)} />
|
|
435
|
+
```
|
|
436
|
+
|
|
437
|
+
| 属性 | 类型 | 默认值 | 说明 |
|
|
438
|
+
|---|---|---|---|
|
|
439
|
+
| `type` | `"text" \| "password"` | `"text"` | 输入类型 |
|
|
440
|
+
| `placeholder` | `string` | — | 占位符 |
|
|
441
|
+
| `size` | `"small" \| "default" \| "large"` | `"default"` | 尺寸 |
|
|
442
|
+
| `prefix / suffix` | `React.ReactNode` | — | 前/后缀图标 |
|
|
443
|
+
| `addonBefore / addonAfter` | `React.ReactNode` | — | 前/后置标签 |
|
|
444
|
+
| `showClear` | `boolean` | `false` | 清除按钮 |
|
|
445
|
+
| `validateStatus` | `"warning" \| "error" \| "success"` | — | 校验状态 |
|
|
446
|
+
| `onChange` | `(value: string) => void` | — | 变更回调 |
|
|
447
|
+
|
|
448
|
+
### InputNumber 数字输入
|
|
449
|
+
|
|
450
|
+
```tsx
|
|
451
|
+
import { InputNumber } from "knight-ui";
|
|
452
|
+
|
|
453
|
+
<InputNumber defaultValue={50} min={0} max={100} onChange={(v) => console.log(v)} />
|
|
454
|
+
<InputNumber defaultValue={10} step={0.1} min={0} max={1} />
|
|
455
|
+
<InputNumber prefix="¥" defaultValue={99} />
|
|
456
|
+
<InputNumber suffix="px" defaultValue={16} />
|
|
457
|
+
<InputNumber defaultValue={50} innerButtons />
|
|
458
|
+
```
|
|
459
|
+
|
|
460
|
+
| 属性 | 类型 | 默认值 | 说明 |
|
|
461
|
+
|---|---|---|---|
|
|
462
|
+
| `min / max` | `number` | — | 最小/最大值 |
|
|
463
|
+
| `step` | `number` | `1` | 步长 |
|
|
464
|
+
| `innerButtons` | `boolean` | `false` | 内部步进按钮 |
|
|
465
|
+
| `hideButtons` | `boolean` | `false` | 隐藏步进按钮 |
|
|
466
|
+
| `onChange` | `(value: number) => void` | — | 变更回调 |
|
|
467
|
+
|
|
468
|
+
### Select 选择器
|
|
469
|
+
|
|
470
|
+
```tsx
|
|
471
|
+
import { Select } from "knight-ui";
|
|
472
|
+
|
|
473
|
+
const options = [
|
|
474
|
+
{ label: "选项一", value: "1" },
|
|
475
|
+
{ label: "选项二", value: "2" },
|
|
476
|
+
{ label: "选项三", value: "3" },
|
|
477
|
+
];
|
|
478
|
+
|
|
479
|
+
<Select optionList={options} defaultValue="1" onChange={(v) => console.log(v)} />
|
|
480
|
+
<Select optionList={options} multiple defaultValue={["1", "2"]} max={3} />
|
|
481
|
+
<Select optionList={options} filter placeholder="搜索选择" />
|
|
482
|
+
<Select optionList={options} loading />
|
|
483
|
+
```
|
|
484
|
+
|
|
485
|
+
子组件:`Select.Option`、`Select.OptGroup`
|
|
486
|
+
|
|
487
|
+
| 属性 | 类型 | 默认值 | 说明 |
|
|
488
|
+
|---|---|---|---|
|
|
489
|
+
| `optionList` | `SelectOption[]` | — | 选项列表 |
|
|
490
|
+
| `multiple` | `boolean` | `false` | 多选 |
|
|
491
|
+
| `filter` | `boolean` | `false` | 可搜索 |
|
|
492
|
+
| `max` | `number` | — | 多选最大数量 |
|
|
493
|
+
| `maxTagCount` | `number` | — | 最多显示标签数 |
|
|
494
|
+
| `onChange` | `(value) => void` | — | 变更回调 |
|
|
495
|
+
|
|
496
|
+
### Cascader 级联选择
|
|
497
|
+
|
|
498
|
+
```tsx
|
|
499
|
+
import { Cascader } from "knight-ui";
|
|
500
|
+
|
|
501
|
+
const treeData = [
|
|
502
|
+
{
|
|
503
|
+
label: "浙江", value: "zj",
|
|
504
|
+
children: [
|
|
505
|
+
{ label: "杭州", value: "hz" },
|
|
506
|
+
{ label: "宁波", value: "nb" },
|
|
507
|
+
],
|
|
508
|
+
},
|
|
509
|
+
{ label: "江苏", value: "js", children: [{ label: "南京", value: "nj" }] },
|
|
510
|
+
];
|
|
511
|
+
|
|
512
|
+
<Cascader treeData={treeData} onChange={(v) => console.log(v)} />
|
|
513
|
+
<Cascader treeData={treeData} multiple filter placeholder="搜索" />
|
|
514
|
+
```
|
|
515
|
+
|
|
516
|
+
| 属性 | 类型 | 默认值 | 说明 |
|
|
517
|
+
|---|---|---|---|
|
|
518
|
+
| `treeData` | `CascaderOption[]` | — | 级联数据 |
|
|
519
|
+
| `multiple` | `boolean` | `false` | 多选 |
|
|
520
|
+
| `filter` | `boolean` | `false` | 可搜索 |
|
|
521
|
+
| `changeOnSelect` | `boolean` | `false` | 任意选中即改变 |
|
|
522
|
+
| `onChange` | `(value: string[]) => void` | — | 变更回调 |
|
|
523
|
+
|
|
524
|
+
### DatePicker 日期选择
|
|
525
|
+
|
|
526
|
+
```tsx
|
|
527
|
+
import { DatePicker } from "knight-ui";
|
|
528
|
+
|
|
529
|
+
<DatePicker onChange={(date, dateStr) => console.log(date, dateStr)} />
|
|
530
|
+
<DatePicker type="dateRange" defaultValue={[new Date(), new Date()]} />
|
|
531
|
+
<DatePicker type="dateTime" showClear />
|
|
532
|
+
<DatePicker format="yyyy-MM-dd" presets={[{ label: "今天", value: new Date() }]} />
|
|
533
|
+
<DatePicker disabledDate={(d) => d.getTime() < Date.now()} />
|
|
534
|
+
```
|
|
535
|
+
|
|
536
|
+
| 属性 | 类型 | 默认值 | 说明 |
|
|
537
|
+
|---|---|---|---|
|
|
538
|
+
| `type` | `"date" \| "dateRange" \| "dateTime" \| "dateTimeRange" \| "month"` | `"date"` | 类型 |
|
|
539
|
+
| `format` | `string` | — | 显示格式 |
|
|
540
|
+
| `presets` | `DatePickerPreset[]` | — | 预设快捷选项 |
|
|
541
|
+
| `disabledDate` | `(date: Date) => boolean` | — | 禁用日期 |
|
|
542
|
+
| `onChange` | `(date, dateString) => void` | — | 变更回调 |
|
|
543
|
+
|
|
544
|
+
### TimePicker 时间选择
|
|
545
|
+
|
|
546
|
+
```tsx
|
|
547
|
+
import { TimePicker } from "knight-ui";
|
|
548
|
+
|
|
549
|
+
<TimePicker onChange={(v) => console.log(v)} />
|
|
550
|
+
<TimePicker format="HH:mm:ss" defaultValue="14:30:00" />
|
|
551
|
+
<TimePicker hourStep={2} minuteStep={15} />
|
|
552
|
+
```
|
|
553
|
+
|
|
554
|
+
| 属性 | 类型 | 默认值 | 说明 |
|
|
555
|
+
|---|---|---|---|
|
|
556
|
+
| `value / defaultValue` | `string` | — | 值(HH:mm 或 HH:mm:ss) |
|
|
557
|
+
| `format` | `"HH:mm" \| "HH:mm:ss"` | `"HH:mm"` | 格式 |
|
|
558
|
+
| `hourStep / minuteStep / secondStep` | `number` | `1` | 步长 |
|
|
559
|
+
| `onChange` | `(value: string) => void` | — | 变更回调 |
|
|
560
|
+
|
|
561
|
+
### Checkbox 复选框
|
|
562
|
+
|
|
563
|
+
```tsx
|
|
564
|
+
import { Checkbox } from "knight-ui";
|
|
565
|
+
|
|
566
|
+
// 单个
|
|
567
|
+
<Checkbox defaultChecked onChange={(checked) => console.log(checked)}>同意协议</Checkbox>
|
|
568
|
+
<Checkbox indeterminate>半选状态</Checkbox>
|
|
569
|
+
|
|
570
|
+
// 组合
|
|
571
|
+
<Checkbox.Group defaultValue={["a", "c"]} onChange={(v) => console.log(v)}>
|
|
572
|
+
<Checkbox value="a">选项 A</Checkbox>
|
|
573
|
+
<Checkbox value="b">选项 B</Checkbox>
|
|
574
|
+
<Checkbox value="c">选项 C</Checkbox>
|
|
575
|
+
</Checkbox.Group>
|
|
576
|
+
|
|
577
|
+
// 垂直排列
|
|
578
|
+
<Checkbox.Group direction="vertical" disabled>
|
|
579
|
+
<Checkbox value="1">禁用的选项</Checkbox>
|
|
580
|
+
</Checkbox.Group>
|
|
581
|
+
```
|
|
582
|
+
|
|
583
|
+
| 属性 | 类型 | 默认值 | 说明 |
|
|
584
|
+
|---|---|---|---|
|
|
585
|
+
| `checked / defaultChecked` | `boolean` | — | 选中状态 |
|
|
586
|
+
| `indeterminate` | `boolean` | `false` | 半选状态 |
|
|
587
|
+
| `onChange` | `(checked: boolean) => void` | — | 变更回调 |
|
|
588
|
+
|
|
589
|
+
**Checkbox.Group**:`value/defaultValue`、`direction`、`disabled`、`onChange`
|
|
590
|
+
|
|
591
|
+
### Radio 单选框
|
|
592
|
+
|
|
593
|
+
```tsx
|
|
594
|
+
import { Radio } from "knight-ui";
|
|
595
|
+
|
|
596
|
+
<Radio.Group defaultValue="b" onChange={(v) => console.log(v)}>
|
|
597
|
+
<Radio value="a">选项 A</Radio>
|
|
598
|
+
<Radio value="b">选项 B</Radio>
|
|
599
|
+
<Radio value="c">选项 C</Radio>
|
|
600
|
+
</Radio.Group>
|
|
601
|
+
|
|
602
|
+
// 按钮样式
|
|
603
|
+
<Radio.Group type="button" defaultValue="a">
|
|
604
|
+
<Radio value="a">A</Radio>
|
|
605
|
+
<Radio value="b">B</Radio>
|
|
606
|
+
</Radio.Group>
|
|
607
|
+
```
|
|
608
|
+
|
|
609
|
+
| 属性 | 类型 | 默认值 | 说明 |
|
|
610
|
+
|---|---|---|---|
|
|
611
|
+
| `checked` | `boolean` | — | 选中状态 |
|
|
612
|
+
| `type` | `"default" \| "button" \| "card"` | `"default"` | 样式类型 |
|
|
613
|
+
|
|
614
|
+
**Radio.Group**:`value/defaultValue`、`direction`、`type`、`disabled`、`onChange`
|
|
615
|
+
|
|
616
|
+
### Switch 开关
|
|
617
|
+
|
|
618
|
+
```tsx
|
|
619
|
+
import { Switch } from "knight-ui";
|
|
620
|
+
|
|
621
|
+
<Switch defaultChecked onChange={(v) => console.log(v)} />
|
|
622
|
+
<Switch checkedText="开" uncheckedText="关" defaultChecked />
|
|
623
|
+
<Switch size="large" loading />
|
|
624
|
+
<Switch disabled />
|
|
625
|
+
```
|
|
626
|
+
|
|
627
|
+
| 属性 | 类型 | 默认值 | 说明 |
|
|
628
|
+
|---|---|---|---|
|
|
629
|
+
| `checked / defaultChecked` | `boolean` | — | 开关状态 |
|
|
630
|
+
| `size` | `"small" \| "default" \| "large"` | `"default"` | 尺寸 |
|
|
631
|
+
| `loading` | `boolean` | `false` | 加载中 |
|
|
632
|
+
| `checkedText / uncheckedText` | `React.ReactNode` | — | 开关文字 |
|
|
633
|
+
| `onChange` | `(checked: boolean) => void` | — | 变更回调 |
|
|
634
|
+
|
|
635
|
+
### Slider 滑块
|
|
636
|
+
|
|
637
|
+
```tsx
|
|
638
|
+
import { Slider } from "knight-ui";
|
|
639
|
+
|
|
640
|
+
<Slider defaultValue={30} onChange={(v) => console.log(v)} />
|
|
641
|
+
|
|
642
|
+
// 范围滑块
|
|
643
|
+
<Slider range defaultValue={[20, 60]} showMinMax />
|
|
644
|
+
|
|
645
|
+
// 带刻度
|
|
646
|
+
<Slider defaultValue={50} step={10} tooltipVisible showMinMax />
|
|
647
|
+
```
|
|
648
|
+
|
|
649
|
+
| 属性 | 类型 | 默认值 | 说明 |
|
|
650
|
+
|---|---|---|---|
|
|
651
|
+
| `value / defaultValue` | `number \| [number, number]` | — | 值 |
|
|
652
|
+
| `min / max` | `number` | `0 / 100` | 范围 |
|
|
653
|
+
| `step` | `number` | `1` | 步长 |
|
|
654
|
+
| `range` | `boolean` | `false` | 范围选择 |
|
|
655
|
+
| `tooltipVisible` | `boolean` | `false` | 显示提示 |
|
|
656
|
+
| `showMinMax` | `boolean` | `false` | 显示最值标签 |
|
|
657
|
+
| `marks` | `Record<number, string>` | — | 刻度标记 |
|
|
658
|
+
| `onChange` | `(value) => void` | — | 变更回调 |
|
|
659
|
+
|
|
660
|
+
### Rating 评分
|
|
661
|
+
|
|
662
|
+
```tsx
|
|
663
|
+
import { Rating } from "knight-ui";
|
|
664
|
+
|
|
665
|
+
<Rating defaultValue={3} onChange={(v) => console.log(v)} />
|
|
666
|
+
<Rating defaultValue={3.5} allowHalf />
|
|
667
|
+
<Rating defaultValue={7} count={10} />
|
|
668
|
+
<Rating size="large" disabled defaultValue={4} />
|
|
669
|
+
```
|
|
670
|
+
|
|
671
|
+
| 属性 | 类型 | 默认值 | 说明 |
|
|
672
|
+
|---|---|---|---|
|
|
673
|
+
| `count` | `number` | `5` | 星星数量 |
|
|
674
|
+
| `allowHalf` | `boolean` | `false` | 允许半星 |
|
|
675
|
+
| `size` | `"small" \| "default" \| "large"` | `"default"` | 尺寸 |
|
|
676
|
+
| `character` | `React.ReactNode` | — | 自定义图标 |
|
|
677
|
+
| `tooltips` | `string[]` | — | 提示文字 |
|
|
678
|
+
| `onChange` | `(value: number) => void` | — | 变更回调 |
|
|
679
|
+
|
|
680
|
+
### TagInput 标签输入
|
|
681
|
+
|
|
682
|
+
```tsx
|
|
683
|
+
import { TagInput } from "knight-ui";
|
|
684
|
+
|
|
685
|
+
<TagInput defaultValue={["React", "TypeScript"]} onChange={(v) => console.log(v)} />
|
|
686
|
+
|
|
687
|
+
<TagInput placeholder="按回车添加" max={5} maxTagCount={3} />
|
|
688
|
+
|
|
689
|
+
<TagInput separator="," placeholder="逗号分隔" />
|
|
690
|
+
```
|
|
691
|
+
|
|
692
|
+
| 属性 | 类型 | 默认值 | 说明 |
|
|
693
|
+
|---|---|---|---|
|
|
694
|
+
| `value / defaultValue` | `string[]` | — | 标签列表 |
|
|
695
|
+
| `max` | `number` | — | 最大标签数 |
|
|
696
|
+
| `maxTagCount` | `number` | — | 最多显示数 |
|
|
697
|
+
| `separator` | `string` | — | 分隔符 |
|
|
698
|
+
| `onChange` | `(value: string[]) => void` | — | 变更回调 |
|
|
699
|
+
|
|
700
|
+
### ColorPicker 颜色选择器
|
|
701
|
+
|
|
702
|
+
```tsx
|
|
703
|
+
import { ColorPicker } from "knight-ui";
|
|
704
|
+
|
|
705
|
+
<ColorPicker defaultValue="#8b5cf6" onChange={(v) => console.log(v)} />
|
|
706
|
+
<ColorPicker alpha defaultFormat="rgba" />
|
|
707
|
+
<ColorPicker eyeDropper />
|
|
708
|
+
```
|
|
709
|
+
|
|
710
|
+
| 属性 | 类型 | 默认值 | 说明 |
|
|
711
|
+
|---|---|---|---|
|
|
712
|
+
| `value / defaultValue` | `ColorValue` | — | 颜色值 |
|
|
713
|
+
| `defaultFormat` | `"hex" \| "rgba" \| "hsva"` | `"hex"` | 格式 |
|
|
714
|
+
| `alpha` | `boolean` | `false` | 透明度通道 |
|
|
715
|
+
| `eyeDropper` | `boolean` | `false` | 取色器 |
|
|
716
|
+
| `onChange` | `(value: ColorValue) => void` | — | 变更回调 |
|
|
717
|
+
|
|
718
|
+
### Upload 上传
|
|
719
|
+
|
|
720
|
+
```tsx
|
|
721
|
+
import { Upload, Button } from "knight-ui";
|
|
722
|
+
|
|
723
|
+
<Upload action="/api/upload" accept=".jpg,.png" onChange={(files) => console.log(files)}>
|
|
724
|
+
<Button type="primary">上传文件</Button>
|
|
725
|
+
</Upload>
|
|
726
|
+
|
|
727
|
+
<Upload listType="pictureCard" limit={3} multiple>
|
|
728
|
+
<span>+ 上传图片</span>
|
|
729
|
+
</Upload>
|
|
730
|
+
|
|
731
|
+
<Upload
|
|
732
|
+
customRequest={async (options) => {
|
|
733
|
+
const formData = new FormData();
|
|
734
|
+
formData.append("file", options.file);
|
|
735
|
+
await fetch("/api/upload", { method: "POST", body: formData });
|
|
736
|
+
options.onSuccess();
|
|
737
|
+
}}
|
|
738
|
+
>
|
|
739
|
+
<Button>自定义上传</Button>
|
|
740
|
+
</Upload>
|
|
741
|
+
```
|
|
742
|
+
|
|
743
|
+
| 属性 | 类型 | 默认值 | 说明 |
|
|
744
|
+
|---|---|---|---|
|
|
745
|
+
| `action` | `string` | — | 上传地址 |
|
|
746
|
+
| `accept` | `string` | — | 文件类型 |
|
|
747
|
+
| `listType` | `"picture" \| "list" \| "pictureCard"` | `"list"` | 列表类型 |
|
|
748
|
+
| `limit` | `number` | — | 最大数量 |
|
|
749
|
+
| `multiple` | `boolean` | `false` | 多文件 |
|
|
750
|
+
| `beforeUpload` | `(file) => boolean` | — | 上传前校验 |
|
|
751
|
+
| `customRequest` | `(options) => Promise<void>` | — | 自定义上传 |
|
|
752
|
+
| `onChange` | `(fileList) => void` | — | 变更回调 |
|
|
753
|
+
|
|
754
|
+
### AutoComplete 自动完成
|
|
755
|
+
|
|
756
|
+
```tsx
|
|
757
|
+
import { AutoComplete } from "knight-ui";
|
|
758
|
+
|
|
759
|
+
const data = ["Apple", "Banana", "Orange", "Grape"];
|
|
760
|
+
|
|
761
|
+
<AutoComplete data={data} onSelect={(opt) => console.log(opt)} />
|
|
762
|
+
|
|
763
|
+
<AutoComplete
|
|
764
|
+
data={data}
|
|
765
|
+
filter
|
|
766
|
+
onSearch={(keyword) => console.log(keyword)}
|
|
767
|
+
placeholder="输入搜索"
|
|
768
|
+
/>
|
|
769
|
+
```
|
|
770
|
+
|
|
771
|
+
| 属性 | 类型 | 默认值 | 说明 |
|
|
772
|
+
|---|---|---|---|
|
|
773
|
+
| `data` | `(string \| AutoCompleteOption)[]` | — | 数据源 |
|
|
774
|
+
| `filter` | `boolean` | — | 本地过滤 |
|
|
775
|
+
| `onSearch` | `(inputValue) => void` | — | 搜索回调 |
|
|
776
|
+
| `onSelect` | `(option) => void` | — | 选中回调 |
|
|
777
|
+
|
|
778
|
+
### Transfer 穿梭框
|
|
779
|
+
|
|
780
|
+
```tsx
|
|
781
|
+
import { Transfer } from "knight-ui";
|
|
782
|
+
|
|
783
|
+
const data = [
|
|
784
|
+
{ key: "1", title: "选项一" },
|
|
785
|
+
{ key: "2", title: "选项二" },
|
|
786
|
+
{ key: "3", title: "选项三" },
|
|
787
|
+
];
|
|
788
|
+
|
|
789
|
+
<Transfer dataSource={data} defaultValue={["1"]} titles={["待选", "已选"]} onChange={(keys) => console.log(keys)} />
|
|
790
|
+
```
|
|
791
|
+
|
|
792
|
+
| 属性 | 类型 | 默认值 | 说明 |
|
|
793
|
+
|---|---|---|---|
|
|
794
|
+
| `dataSource` | `TransferItem[]` | — | 数据源 |
|
|
795
|
+
| `titles` | `[string, string]` | — | 左右标题 |
|
|
796
|
+
| `filter` | `boolean` | — | 可搜索 |
|
|
797
|
+
| `onChange` | `(targetKeys: string[]) => void` | — | 变更回调 |
|
|
798
|
+
|
|
799
|
+
### TreeSelect 树选择
|
|
800
|
+
|
|
801
|
+
```tsx
|
|
802
|
+
import { TreeSelect } from "knight-ui";
|
|
803
|
+
|
|
804
|
+
const treeData = [
|
|
805
|
+
{ label: "Node 1", value: "1", children: [{ label: "Node 1-1", value: "1-1" }] },
|
|
806
|
+
{ label: "Node 2", value: "2" },
|
|
807
|
+
];
|
|
808
|
+
|
|
809
|
+
<TreeSelect treeData={treeData} onChange={(v) => console.log(v)} />
|
|
810
|
+
<TreeSelect treeData={treeData} multiple filter placeholder="搜索" />
|
|
811
|
+
```
|
|
812
|
+
|
|
813
|
+
| 属性 | 类型 | 默认值 | 说明 |
|
|
814
|
+
|---|---|---|---|
|
|
815
|
+
| `treeData` | `TreeSelectNode[]` | — | 树数据 |
|
|
816
|
+
| `multiple` | `boolean` | `false` | 多选 |
|
|
817
|
+
| `filter` | `boolean` | `false` | 可搜索 |
|
|
818
|
+
| `onChange` | `(value) => void` | — | 变更回调 |
|
|
819
|
+
|
|
820
|
+
### PinCode 验证码输入
|
|
821
|
+
|
|
822
|
+
```tsx
|
|
823
|
+
import { PinCode } from "knight-ui";
|
|
824
|
+
|
|
825
|
+
<PinCode count={6} onComplete={(v) => console.log("complete:", v)} />
|
|
826
|
+
<PinCode count={4} format="number" autoFocus size="large" />
|
|
827
|
+
```
|
|
828
|
+
|
|
829
|
+
| 属性 | 类型 | 默认值 | 说明 |
|
|
830
|
+
|---|---|---|---|
|
|
831
|
+
| `count` | `number` | — | 位数 |
|
|
832
|
+
| `format` | `"number" \| "mixed" \| RegExp` | — | 字符格式 |
|
|
833
|
+
| `autoFocus` | `boolean` | `false` | 自动聚焦 |
|
|
834
|
+
| `onComplete` | `(value: string) => void` | — | 输入完成回调 |
|
|
835
|
+
|
|
836
|
+
### Form 表单
|
|
837
|
+
|
|
838
|
+
```tsx
|
|
839
|
+
import { Form, Input, Button } from "knight-ui";
|
|
840
|
+
|
|
841
|
+
<Form
|
|
842
|
+
layout="horizontal"
|
|
843
|
+
labelWidth={100}
|
|
844
|
+
onSubmit={(values) => console.log(values)}
|
|
845
|
+
onSubmitFail={(errors) => console.log(errors)}
|
|
846
|
+
getFormApi={(api) => (window.formApi = api)}
|
|
847
|
+
>
|
|
848
|
+
<Form.Field field="name" label="姓名" rules={[{ required: true, message: "请输入姓名" }]}>
|
|
849
|
+
<Input placeholder="请输入姓名" />
|
|
850
|
+
</Form.Field>
|
|
851
|
+
<Form.Field field="email" label="邮箱" rules={[{ required: true, type: "email" }]}>
|
|
852
|
+
<Input placeholder="请输入邮箱" />
|
|
853
|
+
</Form.Field>
|
|
854
|
+
<Button type="primary" htmlType="submit">提交</Button>
|
|
855
|
+
</Form>
|
|
856
|
+
```
|
|
857
|
+
|
|
858
|
+
| 属性 | 类型 | 默认值 | 说明 |
|
|
859
|
+
|---|---|---|---|
|
|
860
|
+
| `layout` | `"horizontal" \| "vertical"` | `"horizontal"` | 布局 |
|
|
861
|
+
| `labelPosition` | `"left" \| "top"` | `"left"` | 标签位置 |
|
|
862
|
+
| `labelWidth` | `number` | — | 标签宽度 |
|
|
863
|
+
| `getFormApi` | `(api: FormApi) => void` | — | 获取表单 API |
|
|
864
|
+
| `onSubmit` | `(values) => void` | — | 提交回调 |
|
|
865
|
+
| `onSubmitFail` | `(values) => void` | — | 校验失败回调 |
|
|
866
|
+
|
|
867
|
+
**Form.Field**:`field`、`label`、`rules`、`trigger`
|
|
868
|
+
|
|
869
|
+
---
|
|
870
|
+
|
|
871
|
+
## Navigation 导航
|
|
872
|
+
|
|
873
|
+
### Navigation 导航菜单
|
|
874
|
+
|
|
875
|
+
```tsx
|
|
876
|
+
import { Navigation } from "knight-ui";
|
|
877
|
+
|
|
878
|
+
const items = [
|
|
879
|
+
{ key: "home", label: "首页" },
|
|
880
|
+
{
|
|
881
|
+
key: "docs", label: "文档",
|
|
882
|
+
children: [
|
|
883
|
+
{ key: "guide", label: "快速开始" },
|
|
884
|
+
{ key: "api", label: "API 参考" },
|
|
885
|
+
],
|
|
886
|
+
},
|
|
887
|
+
{ key: "about", label: "关于" },
|
|
888
|
+
];
|
|
889
|
+
|
|
890
|
+
<Navigation items={items} mode="vertical" defaultSelectedKeys={["home"]} onSelect={(k) => console.log(k)} />
|
|
891
|
+
<Navigation items={items} mode="horizontal" trigger="click" />
|
|
892
|
+
```
|
|
893
|
+
|
|
894
|
+
| 属性 | 类型 | 默认值 | 说明 |
|
|
895
|
+
|---|---|---|---|
|
|
896
|
+
| `items` | `NavItem[]` | — | 菜单项 |
|
|
897
|
+
| `mode` | `"horizontal" \| "vertical"` | `"vertical"` | 排列模式 |
|
|
898
|
+
| `trigger` | `"hover" \| "click"` | `"hover"` | 子菜单触发方式 |
|
|
899
|
+
| `onSelect` | `(key: string) => void` | — | 选中回调 |
|
|
900
|
+
|
|
901
|
+
### Tabs 标签页
|
|
902
|
+
|
|
903
|
+
```tsx
|
|
904
|
+
import { Tabs } from "knight-ui";
|
|
905
|
+
|
|
906
|
+
const items = [
|
|
907
|
+
{ key: "a", label: "标签 A", content: <div>内容 A</div> },
|
|
908
|
+
{ key: "b", label: "标签 B", content: <div>内容 B</div> },
|
|
909
|
+
{ key: "c", label: "标签 C", content: <div>内容 C</div>, closable: true },
|
|
910
|
+
];
|
|
911
|
+
|
|
912
|
+
<Tabs items={items} defaultActiveKey="a" onChange={(k) => console.log(k)} />
|
|
913
|
+
<Tabs items={items} type="card" />
|
|
914
|
+
<Tabs items={items} type="button" />
|
|
915
|
+
<Tabs items={items} collapsible addable onTabClose={(k) => console.log("close", k)} />
|
|
916
|
+
```
|
|
917
|
+
|
|
918
|
+
| 属性 | 类型 | 默认值 | 说明 |
|
|
919
|
+
|---|---|---|---|
|
|
920
|
+
| `items` | `TabItem[]` | — | 标签项 |
|
|
921
|
+
| `activeKey / defaultActiveKey` | `string` | — | 当前选中 |
|
|
922
|
+
| `type` | `"line" \| "card" \| "button"` | `"line"` | 样式类型 |
|
|
923
|
+
| `tabPosition` | `"top" \| "left" \| "right" \| "bottom"` | `"top"` | 位置 |
|
|
924
|
+
| `collapsible` | `boolean` | `false` | 折叠模式 |
|
|
925
|
+
| `addable` | `boolean` | `false` | 可新增标签 |
|
|
926
|
+
| `onChange` | `(key: string) => void` | — | 切换回调 |
|
|
927
|
+
| `onTabClose` | `(key: string) => void` | — | 关闭回调 |
|
|
928
|
+
|
|
929
|
+
### Tree 树
|
|
930
|
+
|
|
931
|
+
```tsx
|
|
932
|
+
import { Tree } from "knight-ui";
|
|
933
|
+
|
|
934
|
+
const treeData = [
|
|
935
|
+
{
|
|
936
|
+
key: "1", title: "节点 1",
|
|
937
|
+
children: [
|
|
938
|
+
{ key: "1-1", title: "节点 1-1" },
|
|
939
|
+
{ key: "1-2", title: "节点 1-2" },
|
|
940
|
+
],
|
|
941
|
+
},
|
|
942
|
+
{ key: "2", title: "节点 2" },
|
|
943
|
+
];
|
|
944
|
+
|
|
945
|
+
<Tree treeData={treeData} defaultExpandAll onSelect={(keys) => console.log(keys)} />
|
|
946
|
+
<Tree treeData={treeData} checkable onCheck={(keys) => console.log(keys)} />
|
|
947
|
+
<Tree treeData={treeData} multiple />
|
|
948
|
+
```
|
|
949
|
+
|
|
950
|
+
| 属性 | 类型 | 默认值 | 说明 |
|
|
951
|
+
|---|---|---|---|
|
|
952
|
+
| `treeData` | `TreeNodeData[]` | — | 树数据 |
|
|
953
|
+
| `checkable` | `boolean` | `false` | 可复选 |
|
|
954
|
+
| `multiple` | `boolean` | `false` | 多选 |
|
|
955
|
+
| `defaultExpandAll` | `boolean` | `false` | 默认全部展开 |
|
|
956
|
+
| `onSelect` | `(keys, selected, node) => void` | — | 选中回调 |
|
|
957
|
+
| `onCheck` | `(keys, state) => void` | — | 勾选回调 |
|
|
958
|
+
|
|
959
|
+
### Breadcrumb 面包屑
|
|
960
|
+
|
|
961
|
+
```tsx
|
|
962
|
+
import { Breadcrumb } from "knight-ui";
|
|
963
|
+
|
|
964
|
+
<Breadcrumb>
|
|
965
|
+
<Breadcrumb.Item onClick={() => console.log("Home")}>Home</Breadcrumb.Item>
|
|
966
|
+
<Breadcrumb.Item href="/products">Products</Breadcrumb.Item>
|
|
967
|
+
<Breadcrumb.Item>Detail</Breadcrumb.Item>
|
|
968
|
+
</Breadcrumb>
|
|
969
|
+
|
|
970
|
+
// 路由模式
|
|
971
|
+
<Breadcrumb routes={[
|
|
972
|
+
{ name: "首页", path: "/" },
|
|
973
|
+
{ name: "列表", path: "/list" },
|
|
974
|
+
{ name: "详情" },
|
|
975
|
+
]} />
|
|
976
|
+
|
|
977
|
+
// 自定义分隔符
|
|
978
|
+
<Breadcrumb separator=">">
|
|
979
|
+
<Breadcrumb.Item>Home</Breadcrumb.Item>
|
|
980
|
+
<Breadcrumb.Item>Detail</Breadcrumb.Item>
|
|
981
|
+
</Breadcrumb>
|
|
982
|
+
```
|
|
983
|
+
|
|
984
|
+
**Breadcrumb.Item**:`href`、`onClick`、`icon`
|
|
985
|
+
|
|
986
|
+
### Steps 步骤条
|
|
987
|
+
|
|
988
|
+
```tsx
|
|
989
|
+
import { Steps } from "knight-ui";
|
|
990
|
+
|
|
991
|
+
<Steps current={1}>
|
|
992
|
+
<Steps.Step title="步骤一" description="填写基本信息" />
|
|
993
|
+
<Steps.Step title="步骤二" description="验证身份信息" />
|
|
994
|
+
<Steps.Step title="步骤三" description="完成注册" />
|
|
995
|
+
</Steps>
|
|
996
|
+
|
|
997
|
+
// 垂直方向
|
|
998
|
+
<Steps direction="vertical" current={1}>
|
|
999
|
+
<Steps.Step title="填写信息" />
|
|
1000
|
+
<Steps.Step title="确认提交" />
|
|
1001
|
+
<Steps.Step title="完成" />
|
|
1002
|
+
</Steps>
|
|
1003
|
+
|
|
1004
|
+
// Fill 样式
|
|
1005
|
+
<Steps type="primary" current={1} status="error">
|
|
1006
|
+
<Steps.Step title="步骤一" />
|
|
1007
|
+
<Steps.Step title="步骤二" description="出错了" />
|
|
1008
|
+
</Steps>
|
|
1009
|
+
```
|
|
1010
|
+
|
|
1011
|
+
| 属性 | 类型 | 默认值 | 说明 |
|
|
1012
|
+
|---|---|---|---|
|
|
1013
|
+
| `current` | `number` | — | 当前步骤 |
|
|
1014
|
+
| `status` | `"wait" \| "process" \| "finish" \| "error" \| "warning"` | — | 状态 |
|
|
1015
|
+
| `direction` | `"horizontal" \| "vertical"` | `"horizontal"` | 方向 |
|
|
1016
|
+
| `type` | `"primary" \| "basic" \| "nav"` | `"basic"` | 样式类型 |
|
|
1017
|
+
| `onChange` | `(index: number) => void` | — | 步骤切换 |
|
|
1018
|
+
|
|
1019
|
+
### Pagination 分页
|
|
1020
|
+
|
|
1021
|
+
```tsx
|
|
1022
|
+
import { Pagination } from "knight-ui";
|
|
1023
|
+
|
|
1024
|
+
<Pagination total={200} defaultCurrent={3} onChange={(page, size) => console.log(page, size)} />
|
|
1025
|
+
<Pagination total={500} showSizeChanger showQuickJumper />
|
|
1026
|
+
```
|
|
1027
|
+
|
|
1028
|
+
| 属性 | 类型 | 默认值 | 说明 |
|
|
1029
|
+
|---|---|---|---|
|
|
1030
|
+
| `total` | `number` | **必填** | 数据总数 |
|
|
1031
|
+
| `current / defaultCurrent` | `number` | `1` | 当前页 |
|
|
1032
|
+
| `pageSize / defaultPageSize` | `number` | — | 每页条数 |
|
|
1033
|
+
| `showSizeChanger` | `boolean` | `false` | 条数切换 |
|
|
1034
|
+
| `showQuickJumper` | `boolean` | `false` | 快速跳转 |
|
|
1035
|
+
| `onChange` | `(page, pageSize) => void` | — | 页码变化回调 |
|
|
1036
|
+
|
|
1037
|
+
### Anchor 锚点
|
|
1038
|
+
|
|
1039
|
+
```tsx
|
|
1040
|
+
import { Anchor } from "knight-ui";
|
|
1041
|
+
|
|
1042
|
+
<Anchor onChange={(key) => console.log(key)}>
|
|
1043
|
+
<Anchor.Link href="#section-1" title="基本介绍" />
|
|
1044
|
+
<Anchor.Link href="#section-2" title="API 参考" />
|
|
1045
|
+
</Anchor>
|
|
1046
|
+
```
|
|
1047
|
+
|
|
1048
|
+
### BackTop 回到顶部
|
|
1049
|
+
|
|
1050
|
+
```tsx
|
|
1051
|
+
import { BackTop } from "knight-ui";
|
|
1052
|
+
|
|
1053
|
+
<BackTop visibilityHeight={200} onClick={() => console.log("back to top")} />
|
|
1054
|
+
|
|
1055
|
+
// 指定目标容器
|
|
1056
|
+
<BackTop target={() => document.getElementById("scroll-container")!} />
|
|
1057
|
+
```
|
|
1058
|
+
|
|
1059
|
+
| 属性 | 类型 | 默认值 | 说明 |
|
|
1060
|
+
|---|---|---|---|
|
|
1061
|
+
| `visibilityHeight` | `number` | — | 显示阈值 |
|
|
1062
|
+
| `duration` | `number` | — | 滚动时长(ms) |
|
|
1063
|
+
| `target` | `() => HTMLElement \| Window` | `window` | 目标容器 |
|
|
1064
|
+
|
|
1065
|
+
---
|
|
1066
|
+
|
|
1067
|
+
## Display 展示
|
|
1068
|
+
|
|
1069
|
+
### Avatar 头像
|
|
1070
|
+
|
|
1071
|
+
```tsx
|
|
1072
|
+
import { Avatar } from "knight-ui";
|
|
1073
|
+
|
|
1074
|
+
<Avatar size="medium">Alice</Avatar>
|
|
1075
|
+
<Avatar size="large" src="https://picsum.photos/80" alt="avatar" />
|
|
1076
|
+
<Avatar shape="square" color="#ec4899">S</Avatar>
|
|
1077
|
+
```
|
|
1078
|
+
|
|
1079
|
+
| 属性 | 类型 | 默认值 | 说明 |
|
|
1080
|
+
|---|---|---|---|
|
|
1081
|
+
| `size` | `"extra-small" \| "small" \| "default" \| "medium" \| "large" \| number` | `"default"` | 尺寸 |
|
|
1082
|
+
| `shape` | `"circle" \| "square"` | `"circle"` | 形状 |
|
|
1083
|
+
| `src` | `string` | — | 图片地址 |
|
|
1084
|
+
| `color` | `string` | — | 自定义颜色 |
|
|
1085
|
+
|
|
1086
|
+
### Badge 角标
|
|
1087
|
+
|
|
1088
|
+
```tsx
|
|
1089
|
+
import { Badge, Button } from "knight-ui";
|
|
1090
|
+
|
|
1091
|
+
<Badge count={5}><Button>消息</Button></Badge>
|
|
1092
|
+
<Badge count={120} overflowCount={99}><Button>通知</Button></Badge>
|
|
1093
|
+
<Badge dot><span>新消息</span></Badge>
|
|
1094
|
+
<Badge dot type="success" position="leftTop"><span>在线</span></Badge>
|
|
1095
|
+
```
|
|
1096
|
+
|
|
1097
|
+
| 属性 | 类型 | 默认值 | 说明 |
|
|
1098
|
+
|---|---|---|---|
|
|
1099
|
+
| `count` | `number \| React.ReactNode` | — | 角标内容 |
|
|
1100
|
+
| `dot` | `boolean` | `false` | 圆点模式 |
|
|
1101
|
+
| `overflowCount` | `number` | `99` | 溢出显示值 |
|
|
1102
|
+
| `type` | `"primary" \| "success" \| "warning" \| "danger"` | `"primary"` | 类型 |
|
|
1103
|
+
| `position` | `"leftTop" \| "leftBottom" \| "rightTop" \| "rightBottom"` | `"rightTop"` | 位置 |
|
|
1104
|
+
|
|
1105
|
+
### Card 卡片
|
|
1106
|
+
|
|
1107
|
+
```tsx
|
|
1108
|
+
import { Card, Text, Button, Avatar } from "knight-ui";
|
|
1109
|
+
|
|
1110
|
+
<Card style={{ width: 360 }}
|
|
1111
|
+
cover={<div style={{ height: 140, background: "linear-gradient(135deg, #8b5cf6, #ec4899)" }} />}
|
|
1112
|
+
header="卡片标题"
|
|
1113
|
+
actions={[<Button key="1" type="tertiary" size="small">操作</Button>]}
|
|
1114
|
+
footer="底部信息"
|
|
1115
|
+
>
|
|
1116
|
+
<Card.Meta title="Meta 标题" description="Meta 描述" avatar={<Avatar size="small">A</Avatar>} />
|
|
1117
|
+
</Card>
|
|
1118
|
+
|
|
1119
|
+
<Card bordered={false} shadows="always">
|
|
1120
|
+
<Text>无边框阴影卡片</Text>
|
|
1121
|
+
</Card>
|
|
1122
|
+
```
|
|
1123
|
+
|
|
1124
|
+
| 属性 | 类型 | 默认值 | 说明 |
|
|
1125
|
+
|---|---|---|---|
|
|
1126
|
+
| `cover` | `React.ReactNode` | — | 封面 |
|
|
1127
|
+
| `header / footer` | `React.ReactNode` | — | 头部/底部 |
|
|
1128
|
+
| `actions` | `React.ReactNode[]` | — | 操作区 |
|
|
1129
|
+
| `bordered` | `boolean` | `true` | 边框 |
|
|
1130
|
+
| `shadows` | `"hover" \| "always" \| "none"` | `"hover"` | 阴影 |
|
|
1131
|
+
|
|
1132
|
+
### Tag 标签
|
|
1133
|
+
|
|
1134
|
+
```tsx
|
|
1135
|
+
import { Tag } from "knight-ui";
|
|
1136
|
+
|
|
1137
|
+
<Tag color="blue">蓝色标签</Tag>
|
|
1138
|
+
<Tag type="solid" color="green">实心绿色</Tag>
|
|
1139
|
+
<Tag type="ghost" color="orange">幽灵橙色</Tag>
|
|
1140
|
+
<Tag closable onClose={() => console.log("closed")}>可关闭</Tag>
|
|
1141
|
+
<Tag size="large" color="#ec4899">粉色</Tag>
|
|
1142
|
+
```
|
|
1143
|
+
|
|
1144
|
+
| 属性 | 类型 | 默认值 | 说明 |
|
|
1145
|
+
|---|---|---|---|
|
|
1146
|
+
| `type` | `"ghost" \| "solid" \| "light"` | `"light"` | 样式 |
|
|
1147
|
+
| `color` | `string` | — | 颜色 |
|
|
1148
|
+
| `size` | `"small" \| "default" \| "large"` | `"default"` | 尺寸 |
|
|
1149
|
+
| `closable` | `boolean` | `false` | 可关闭 |
|
|
1150
|
+
| `avatar` | `React.ReactNode` | — | 头像 |
|
|
1151
|
+
|
|
1152
|
+
### Collapse 折叠面板
|
|
1153
|
+
|
|
1154
|
+
```tsx
|
|
1155
|
+
import { Collapse, Text } from "knight-ui";
|
|
1156
|
+
|
|
1157
|
+
<Collapse defaultActiveKey={["1"]}>
|
|
1158
|
+
<Collapse.Panel header="面板一" itemKey="1">
|
|
1159
|
+
<Text>面板一的内容</Text>
|
|
1160
|
+
</Collapse.Panel>
|
|
1161
|
+
<Collapse.Panel header="面板二" itemKey="2">
|
|
1162
|
+
<Text>面板二的内容</Text>
|
|
1163
|
+
</Collapse.Panel>
|
|
1164
|
+
<Collapse.Panel header="禁用面板" itemKey="3" disabled>
|
|
1165
|
+
<Text>不可见</Text>
|
|
1166
|
+
</Collapse.Panel>
|
|
1167
|
+
</Collapse>
|
|
1168
|
+
|
|
1169
|
+
// 手风琴模式
|
|
1170
|
+
<Collapse accordion>
|
|
1171
|
+
<Collapse.Panel header="面板 A" itemKey="a"><Text>内容 A</Text></Collapse.Panel>
|
|
1172
|
+
<Collapse.Panel header="面板 B" itemKey="b"><Text>内容 B</Text></Collapse.Panel>
|
|
1173
|
+
</Collapse>
|
|
1174
|
+
```
|
|
1175
|
+
|
|
1176
|
+
| 属性 | 类型 | 默认值 | 说明 |
|
|
1177
|
+
|---|---|---|---|
|
|
1178
|
+
| `activeKey / defaultActiveKey` | `string \| string[]` | — | 展开面板 |
|
|
1179
|
+
| `accordion` | `boolean` | `false` | 手风琴模式 |
|
|
1180
|
+
| `onChange` | `(activeKey) => void` | — | 切换回调 |
|
|
1181
|
+
|
|
1182
|
+
### Collapsible 轻量折叠
|
|
1183
|
+
|
|
1184
|
+
```tsx
|
|
1185
|
+
import { Collapsible, Button } from "knight-ui";
|
|
1186
|
+
|
|
1187
|
+
const [collapsed, setCollapsed] = useState(false);
|
|
1188
|
+
|
|
1189
|
+
<Button onClick={() => setCollapsed(!collapsed)}>{collapsed ? "展开" : "折叠"}</Button>
|
|
1190
|
+
<Collapsible collapsed={collapsed}>
|
|
1191
|
+
<div style={{ padding: 16, background: "#f0f0f0" }}>可折叠内容区域</div>
|
|
1192
|
+
</Collapsible>
|
|
1193
|
+
```
|
|
1194
|
+
|
|
1195
|
+
| 属性 | 类型 | 默认值 | 说明 |
|
|
1196
|
+
|---|---|---|---|
|
|
1197
|
+
| `collapsed` | `boolean` | — | 折叠状态 |
|
|
1198
|
+
| `motion` | `boolean` | `true` | 动画过渡 |
|
|
1199
|
+
| `keepDOM` | `boolean` | `false` | 保留 DOM |
|
|
1200
|
+
|
|
1201
|
+
### Descriptions 描述列表
|
|
1202
|
+
|
|
1203
|
+
```tsx
|
|
1204
|
+
import { Descriptions } from "knight-ui";
|
|
1205
|
+
|
|
1206
|
+
const data = [
|
|
1207
|
+
{ key: "姓名", value: "张三" },
|
|
1208
|
+
{ key: "手机号", value: "138****8888" },
|
|
1209
|
+
{ key: "地址", value: "北京市朝阳区", span: 2 },
|
|
1210
|
+
];
|
|
1211
|
+
|
|
1212
|
+
<Descriptions layout="horizontal" column={2} data={data} bordered />
|
|
1213
|
+
|
|
1214
|
+
// Item 子组件
|
|
1215
|
+
<Descriptions column={2}>
|
|
1216
|
+
<Descriptions.Item itemKey="创建人">李四</Descriptions.Item>
|
|
1217
|
+
<Descriptions.Item itemKey="状态">
|
|
1218
|
+
<Tag color="green">已完成</Tag>
|
|
1219
|
+
</Descriptions.Item>
|
|
1220
|
+
</Descriptions>
|
|
1221
|
+
```
|
|
1222
|
+
|
|
1223
|
+
| 属性 | 类型 | 默认值 | 说明 |
|
|
1224
|
+
|---|---|---|---|
|
|
1225
|
+
| `data` | `DescriptionsData[]` | — | 数据 |
|
|
1226
|
+
| `layout` | `"horizontal" \| "vertical"` | `"vertical"` | 布局 |
|
|
1227
|
+
| `column` | `number` | `3` | 列数 |
|
|
1228
|
+
| `size` | `"small" \| "medium" \| "large"` | `"medium"` | 尺寸 |
|
|
1229
|
+
| `row` | `boolean` | `false` | 双行模式 |
|
|
1230
|
+
| `bordered` | `boolean` | `false` | 边框 |
|
|
1231
|
+
|
|
1232
|
+
### Empty 空状态
|
|
1233
|
+
|
|
1234
|
+
```tsx
|
|
1235
|
+
import { Empty } from "knight-ui";
|
|
1236
|
+
|
|
1237
|
+
<Empty />
|
|
1238
|
+
<Empty title="暂无数据" description="当前列表为空,请先添加数据" />
|
|
1239
|
+
<Empty image={<IconAlertTriangle size="extraLarge" />} description="加载失败" />
|
|
1240
|
+
```
|
|
1241
|
+
|
|
1242
|
+
| 属性 | 类型 | 默认值 | 说明 |
|
|
1243
|
+
|---|---|---|---|
|
|
1244
|
+
| `image` | `React.ReactNode` | — | 自定义图片 |
|
|
1245
|
+
| `title` | `React.ReactNode` | — | 标题 |
|
|
1246
|
+
| `description` | `React.ReactNode` | — | 描述 |
|
|
1247
|
+
|
|
1248
|
+
### Image 图片
|
|
1249
|
+
|
|
1250
|
+
```tsx
|
|
1251
|
+
import { Image } from "knight-ui";
|
|
1252
|
+
|
|
1253
|
+
<Image src="https://picsum.photos/400/300" width={200} height={150} />
|
|
1254
|
+
<Image src="https://picsum.photos/400/300" preview />
|
|
1255
|
+
<Image src="/not-exist.jpg" fallback="https://picsum.photos/200/150" />
|
|
1256
|
+
<Image src="/large.jpg" lazy width={300} />
|
|
1257
|
+
```
|
|
1258
|
+
|
|
1259
|
+
| 属性 | 类型 | 默认值 | 说明 |
|
|
1260
|
+
|---|---|---|---|
|
|
1261
|
+
| `src` | `string` | — | 图片地址 |
|
|
1262
|
+
| `preview` | `boolean` | `false` | 可预览 |
|
|
1263
|
+
| `fallback` | `string` | — | 加载失败回退 |
|
|
1264
|
+
| `lazy` | `boolean` | — | 懒加载 |
|
|
1265
|
+
| `width / height` | `number \| string` | — | 宽高 |
|
|
1266
|
+
|
|
1267
|
+
### List 列表
|
|
1268
|
+
|
|
1269
|
+
```tsx
|
|
1270
|
+
import { List, Text } from "knight-ui";
|
|
1271
|
+
|
|
1272
|
+
const data = ["列表项 A", "列表项 B", "列表项 C"];
|
|
1273
|
+
|
|
1274
|
+
<List
|
|
1275
|
+
dataSource={data}
|
|
1276
|
+
renderItem={(item) => <Text>{item}</Text>}
|
|
1277
|
+
header="列表标题"
|
|
1278
|
+
footer="底部"
|
|
1279
|
+
bordered
|
|
1280
|
+
/>
|
|
1281
|
+
|
|
1282
|
+
// 加载 / 空状态
|
|
1283
|
+
<List dataSource={[]} loading />
|
|
1284
|
+
<List dataSource={[]} empty={<Empty description="暂无数据" />} />
|
|
1285
|
+
```
|
|
1286
|
+
|
|
1287
|
+
| 属性 | 类型 | 默认值 | 说明 |
|
|
1288
|
+
|---|---|---|---|
|
|
1289
|
+
| `dataSource` | `any[]` | — | 数据源 |
|
|
1290
|
+
| `renderItem` | `(item, index) => ReactNode` | — | 渲染函数 |
|
|
1291
|
+
| `header / footer` | `React.ReactNode` | — | 头部/底部 |
|
|
1292
|
+
| `loading` | `boolean` | `false` | 加载中 |
|
|
1293
|
+
| `bordered` | `boolean` | `false` | 边框 |
|
|
1294
|
+
|
|
1295
|
+
### Table 表格
|
|
1296
|
+
|
|
1297
|
+
```tsx
|
|
1298
|
+
import { Table } from "knight-ui";
|
|
1299
|
+
|
|
1300
|
+
const columns = [
|
|
1301
|
+
{ key: "name", title: "名称", dataIndex: "name", width: 120 },
|
|
1302
|
+
{ key: "age", title: "年龄", dataIndex: "age", width: 80, sorter: (a, b) => a - b },
|
|
1303
|
+
{ key: "city", title: "城市", dataIndex: "city" },
|
|
1304
|
+
];
|
|
1305
|
+
const data = [
|
|
1306
|
+
{ name: "张三", age: 28, city: "北京" },
|
|
1307
|
+
{ name: "李四", age: 32, city: "上海" },
|
|
1308
|
+
];
|
|
1309
|
+
|
|
1310
|
+
<Table columns={columns} dataSource={data} rowKey="name" bordered />
|
|
1311
|
+
<Table columns={columns} dataSource={data} pagination={{ total: 100 }} loading />
|
|
1312
|
+
<Table columns={columns} dataSource={data} rowSelection selectedRowKeys={["张三"]} />
|
|
1313
|
+
```
|
|
1314
|
+
|
|
1315
|
+
| 属性 | 类型 | 默认值 | 说明 |
|
|
1316
|
+
|---|---|---|---|
|
|
1317
|
+
| `columns` | `TableColumn[]` | — | 列定义 |
|
|
1318
|
+
| `dataSource` | `Record<string, any>[]` | — | 数据源 |
|
|
1319
|
+
| `rowKey` | `string` | — | 行唯一 key |
|
|
1320
|
+
| `pagination` | `boolean \| PaginationConfig` | — | 分页 |
|
|
1321
|
+
| `loading` | `boolean` | `false` | 加载中 |
|
|
1322
|
+
| `bordered` | `boolean` | `false` | 边框 |
|
|
1323
|
+
| `striped` | `boolean` | `false` | 斑马纹 |
|
|
1324
|
+
| `rowSelection` | `boolean` | — | 行选择 |
|
|
1325
|
+
|
|
1326
|
+
### Modal 模态框
|
|
1327
|
+
|
|
1328
|
+
```tsx
|
|
1329
|
+
import { Modal, Button } from "knight-ui";
|
|
1330
|
+
|
|
1331
|
+
const [visible, setVisible] = useState(false);
|
|
1332
|
+
|
|
1333
|
+
<Button type="primary" onClick={() => setVisible(true)}>打开 Modal</Button>
|
|
1334
|
+
|
|
1335
|
+
<Modal
|
|
1336
|
+
title="确认操作"
|
|
1337
|
+
visible={visible}
|
|
1338
|
+
onOk={() => { setVisible(false); console.log("ok"); }}
|
|
1339
|
+
onCancel={() => setVisible(false)}
|
|
1340
|
+
>
|
|
1341
|
+
<Text>确定要执行此操作吗?</Text>
|
|
1342
|
+
</Modal>
|
|
1343
|
+
|
|
1344
|
+
// 大型 + 自定义按钮
|
|
1345
|
+
<Modal
|
|
1346
|
+
title="大型模态框"
|
|
1347
|
+
visible={visible}
|
|
1348
|
+
size="large"
|
|
1349
|
+
okText="确认"
|
|
1350
|
+
cancelText="取消"
|
|
1351
|
+
centered
|
|
1352
|
+
onOk={() => setVisible(false)}
|
|
1353
|
+
onCancel={() => setVisible(false)}
|
|
1354
|
+
>
|
|
1355
|
+
<div>大型模态框内容区域</div>
|
|
1356
|
+
</Modal>
|
|
1357
|
+
```
|
|
1358
|
+
|
|
1359
|
+
| 属性 | 类型 | 默认值 | 说明 |
|
|
1360
|
+
|---|---|---|---|
|
|
1361
|
+
| `visible` | `boolean` | — | 显示状态 |
|
|
1362
|
+
| `title` | `React.ReactNode` | — | 标题 |
|
|
1363
|
+
| `size` | `"small" \| "medium" \| "large"` | `"medium"` | 尺寸 |
|
|
1364
|
+
| `okText / cancelText` | `string` | — | 按钮文字 |
|
|
1365
|
+
| `maskClosable` | `boolean` | `true` | 点击遮罩关闭 |
|
|
1366
|
+
| `centered` | `boolean` | `false` | 居中 |
|
|
1367
|
+
| `onOk` | `() => void \| Promise<void>` | — | 确认回调 |
|
|
1368
|
+
| `onCancel` | `() => void` | — | 取消回调 |
|
|
1369
|
+
|
|
1370
|
+
### SideSheet 侧边面板
|
|
1371
|
+
|
|
1372
|
+
```tsx
|
|
1373
|
+
import { SideSheet, Button } from "knight-ui";
|
|
1374
|
+
|
|
1375
|
+
const [visible, setVisible] = useState(false);
|
|
1376
|
+
|
|
1377
|
+
<Button onClick={() => setVisible(true)}>打开侧边面板</Button>
|
|
1378
|
+
|
|
1379
|
+
<SideSheet
|
|
1380
|
+
title="详情面板"
|
|
1381
|
+
visible={visible}
|
|
1382
|
+
placement="right"
|
|
1383
|
+
size="medium"
|
|
1384
|
+
onCancel={() => setVisible(false)}
|
|
1385
|
+
>
|
|
1386
|
+
<div style={{ padding: 16 }}>面板内容</div>
|
|
1387
|
+
</SideSheet>
|
|
1388
|
+
```
|
|
1389
|
+
|
|
1390
|
+
| 属性 | 类型 | 默认值 | 说明 |
|
|
1391
|
+
|---|---|---|---|
|
|
1392
|
+
| `visible` | `boolean` | — | 显示状态 |
|
|
1393
|
+
| `title` | `React.ReactNode` | — | 标题 |
|
|
1394
|
+
| `placement` | `"left" \| "right"` | `"right"` | 滑出方向 |
|
|
1395
|
+
| `size` | `"small" \| "medium" \| "large"` | `"medium"` | 尺寸 |
|
|
1396
|
+
| `maskClosable` | `boolean` | `true` | 点击遮罩关闭 |
|
|
1397
|
+
| `onCancel` | `() => void` | — | 关闭回调 |
|
|
1398
|
+
|
|
1399
|
+
### Dropdown 下拉菜单
|
|
1400
|
+
|
|
1401
|
+
```tsx
|
|
1402
|
+
import { Dropdown, Button } from "knight-ui";
|
|
1403
|
+
|
|
1404
|
+
const menu = [
|
|
1405
|
+
{ key: "1", label: "选项一" },
|
|
1406
|
+
{ key: "2", label: "选项二" },
|
|
1407
|
+
{ key: "div", label: "", divider: true },
|
|
1408
|
+
{ key: "3", label: "删除", danger: true },
|
|
1409
|
+
];
|
|
1410
|
+
|
|
1411
|
+
<Dropdown trigger="click" menu={menu} onClickItem={(key) => console.log(key)}>
|
|
1412
|
+
<Button>点击展开菜单</Button>
|
|
1413
|
+
</Dropdown>
|
|
1414
|
+
|
|
1415
|
+
<Dropdown trigger="hover" menu={menu} position="bottomLeft">
|
|
1416
|
+
<Button type="secondary">悬停展开</Button>
|
|
1417
|
+
</Dropdown>
|
|
1418
|
+
```
|
|
1419
|
+
|
|
1420
|
+
| 属性 | 类型 | 默认值 | 说明 |
|
|
1421
|
+
|---|---|---|---|
|
|
1422
|
+
| `menu` | `DropdownItem[]` | — | 菜单项 |
|
|
1423
|
+
| `trigger` | `"click" \| "hover"` | `"click"` | 触发方式 |
|
|
1424
|
+
| `position` | `Position` | `"bottom"` | 弹出位置 |
|
|
1425
|
+
| `onClickItem` | `(key: string) => void` | — | 菜单项点击 |
|
|
1426
|
+
|
|
1427
|
+
### Popover 气泡卡片
|
|
1428
|
+
|
|
1429
|
+
```tsx
|
|
1430
|
+
import { Popover, Button } from "knight-ui";
|
|
1431
|
+
|
|
1432
|
+
<Popover trigger="click" content="这是气泡提示内容" position="bottom">
|
|
1433
|
+
<Button>点击弹出</Button>
|
|
1434
|
+
</Popover>
|
|
1435
|
+
|
|
1436
|
+
<Popover trigger="hover" title="提示标题" content={<Text>丰富的气泡内容</Text>} position="top">
|
|
1437
|
+
<Text style={{ borderBottom: "1px dashed", cursor: "help" }}>悬停查看</Text>
|
|
1438
|
+
</Popover>
|
|
1439
|
+
```
|
|
1440
|
+
|
|
1441
|
+
| 属性 | 类型 | 默认值 | 说明 |
|
|
1442
|
+
|---|---|---|---|
|
|
1443
|
+
| `content` | `React.ReactNode` | — | 内容 |
|
|
1444
|
+
| `title` | `React.ReactNode` | — | 标题 |
|
|
1445
|
+
| `position` | `"top" \| "bottom" \| "left" \| "right"` | `"bottom"` | 位置 |
|
|
1446
|
+
| `trigger` | `"hover" \| "click" \| "focus" \| "custom"` | `"hover"` | 触发方式 |
|
|
1447
|
+
| `showArrow` | `boolean` | — | 显示箭头 |
|
|
1448
|
+
|
|
1449
|
+
### Tooltip 文字提示
|
|
1450
|
+
|
|
1451
|
+
```tsx
|
|
1452
|
+
import { Tooltip, Button } from "knight-ui";
|
|
1453
|
+
|
|
1454
|
+
<Tooltip content="这是一段提示文字" position="top">
|
|
1455
|
+
<Button>悬停查看提示</Button>
|
|
1456
|
+
</Tooltip>
|
|
1457
|
+
|
|
1458
|
+
<Tooltip content="左侧提示" position="left" theme="light">
|
|
1459
|
+
<span>悬停文本</span>
|
|
1460
|
+
</Tooltip>
|
|
1461
|
+
```
|
|
1462
|
+
|
|
1463
|
+
| 属性 | 类型 | 默认值 | 说明 |
|
|
1464
|
+
|---|---|---|---|
|
|
1465
|
+
| `content` | `React.ReactNode` | — | 提示内容 |
|
|
1466
|
+
| `position` | `Position` | `"top"` | 位置 |
|
|
1467
|
+
| `trigger` | `"hover" \| "click" \| "focus" \| "custom"` | `"hover"` | 触发方式 |
|
|
1468
|
+
| `theme` | `"dark" \| "light"` | `"dark"` | 主题 |
|
|
1469
|
+
|
|
1470
|
+
### Popconfirm 气泡确认框
|
|
1471
|
+
|
|
1472
|
+
```tsx
|
|
1473
|
+
import { Popconfirm, Button } from "knight-ui";
|
|
1474
|
+
|
|
1475
|
+
<Popconfirm
|
|
1476
|
+
title="确定删除?"
|
|
1477
|
+
content="删除后不可恢复"
|
|
1478
|
+
trigger="click"
|
|
1479
|
+
onConfirm={() => console.log("confirmed")}
|
|
1480
|
+
onCancel={() => console.log("cancelled")}
|
|
1481
|
+
>
|
|
1482
|
+
<Button type="danger">删除</Button>
|
|
1483
|
+
</Popconfirm>
|
|
1484
|
+
```
|
|
1485
|
+
|
|
1486
|
+
| 属性 | 类型 | 默认值 | 说明 |
|
|
1487
|
+
|---|---|---|---|
|
|
1488
|
+
| `title` | `React.ReactNode` | — | 标题 |
|
|
1489
|
+
| `content` | `React.ReactNode` | — | 内容 |
|
|
1490
|
+
| `okText / cancelText` | `string` | — | 按钮文字 |
|
|
1491
|
+
| `onConfirm` | `(e) => void` | — | 确认回调 |
|
|
1492
|
+
| `onCancel` | `(e) => void` | — | 取消回调 |
|
|
1493
|
+
|
|
1494
|
+
### Calendar 日历
|
|
1495
|
+
|
|
1496
|
+
```tsx
|
|
1497
|
+
import { Calendar } from "knight-ui";
|
|
1498
|
+
|
|
1499
|
+
<Calendar onChange={(date) => console.log(date)} />
|
|
1500
|
+
<Calendar disabledDate={(d) => d.getTime() < Date.now() - 86400000} />
|
|
1501
|
+
```
|
|
1502
|
+
|
|
1503
|
+
| 属性 | 类型 | 默认值 | 说明 |
|
|
1504
|
+
|---|---|---|---|
|
|
1505
|
+
| `mode` | `"month" \| "year" \| "day"` | `"month"` | 视图模式 |
|
|
1506
|
+
| `disabledDate` | `(date) => boolean` | — | 禁用日期 |
|
|
1507
|
+
| `onChange` | `(date: Date) => void` | — | 变更回调 |
|
|
1508
|
+
|
|
1509
|
+
### Carousel 轮播
|
|
1510
|
+
|
|
1511
|
+
```tsx
|
|
1512
|
+
import { Carousel } from "knight-ui";
|
|
1513
|
+
|
|
1514
|
+
<Carousel style={{ width: 500, height: 200 }} autoPlay interval={3000}>
|
|
1515
|
+
<div style={{ height: 200, background: "#8b5cf6", color: "#fff" }}>Slide 1</div>
|
|
1516
|
+
<div style={{ height: 200, background: "#22c55e", color: "#fff" }}>Slide 2</div>
|
|
1517
|
+
<div style={{ height: 200, background: "#3b82f6", color: "#fff" }}>Slide 3</div>
|
|
1518
|
+
</Carousel>
|
|
1519
|
+
```
|
|
1520
|
+
|
|
1521
|
+
| 属性 | 类型 | 默认值 | 说明 |
|
|
1522
|
+
|---|---|---|---|
|
|
1523
|
+
| `autoPlay` | `boolean` | `false` | 自动播放 |
|
|
1524
|
+
| `interval` | `number` | `3000` | 间隔(ms) |
|
|
1525
|
+
| `effect` | `"slide" \| "fade"` | `"slide"` | 切换效果 |
|
|
1526
|
+
| `showDots` | `boolean` | `true` | 指示器 |
|
|
1527
|
+
| `showArrow` | `boolean` | `true` | 箭头 |
|
|
1528
|
+
|
|
1529
|
+
### Timeline 时间轴
|
|
1530
|
+
|
|
1531
|
+
```tsx
|
|
1532
|
+
import { Timeline } from "knight-ui";
|
|
1533
|
+
|
|
1534
|
+
<Timeline>
|
|
1535
|
+
<Timeline.Item time="2024-01-01" type="success">项目启动</Timeline.Item>
|
|
1536
|
+
<Timeline.Item time="2024-03-15" color="#8b5cf6">版本 v1.0 发布</Timeline.Item>
|
|
1537
|
+
<Timeline.Item time="2024-06-01" type="warning">迭代中</Timeline.Item>
|
|
1538
|
+
</Timeline>
|
|
1539
|
+
```
|
|
1540
|
+
|
|
1541
|
+
| 属性 | 类型 | 默认值 | 说明 |
|
|
1542
|
+
|---|---|---|---|
|
|
1543
|
+
| `mode` | `"left" \| "alternate" \| "right"` | `"left"` | 排列模式 |
|
|
1544
|
+
| `pending` | `React.ReactNode` | — | 加载节点 |
|
|
1545
|
+
|
|
1546
|
+
**Timeline.Item**:`time`、`dot`、`color`、`type`(`"default" | "success" | "warning" | "danger"`)
|
|
1547
|
+
|
|
1548
|
+
### ScrollList 滚动列表
|
|
1549
|
+
|
|
1550
|
+
```tsx
|
|
1551
|
+
import { ScrollList } from "knight-ui";
|
|
1552
|
+
|
|
1553
|
+
const hours = Array.from({ length: 24 }, (_, i) => ({ value: i, text: String(i).padStart(2, "0") }));
|
|
1554
|
+
|
|
1555
|
+
<ScrollList header="选择小时" bodyHeight={200}>
|
|
1556
|
+
<ScrollList.Item
|
|
1557
|
+
list={hours}
|
|
1558
|
+
mode="wheel"
|
|
1559
|
+
selectedIndex={12}
|
|
1560
|
+
onSelect={(data) => console.log(data.value)}
|
|
1561
|
+
/>
|
|
1562
|
+
</ScrollList>
|
|
1563
|
+
```
|
|
1564
|
+
|
|
1565
|
+
**ScrollList.Item**:`list`、`mode`(`"normal" | "wheel"`)、`cycled`、`selectedIndex`、`onSelect`
|
|
1566
|
+
|
|
1567
|
+
### Highlight 高亮
|
|
1568
|
+
|
|
1569
|
+
```tsx
|
|
1570
|
+
import { Highlight } from "knight-ui";
|
|
1571
|
+
|
|
1572
|
+
<Highlight sourceString="React 是一个用于构建用户界面的 JavaScript 库"
|
|
1573
|
+
searchWords={["React", "JavaScript"]} />
|
|
1574
|
+
|
|
1575
|
+
<Highlight sourceString="Hello World" searchWords={["hello"]}
|
|
1576
|
+
highlightStyle={{ color: "#f59e0b", background: "rgba(245,158,11,0.15)" }} />
|
|
1577
|
+
```
|
|
1578
|
+
|
|
1579
|
+
| 属性 | 类型 | 默认值 | 说明 |
|
|
1580
|
+
|---|---|---|---|
|
|
1581
|
+
| `sourceString` | `string` | — | 源文本 |
|
|
1582
|
+
| `searchWords` | `string[]` | — | 关键词 |
|
|
1583
|
+
| `highlightStyle` | `React.CSSProperties` | — | 高亮样式 |
|
|
1584
|
+
|
|
1585
|
+
### Cropper 裁剪
|
|
1586
|
+
|
|
1587
|
+
```tsx
|
|
1588
|
+
import { Cropper } from "knight-ui";
|
|
1589
|
+
|
|
1590
|
+
<Cropper src="https://picsum.photos/600/400" cropShape="rect" aspectRatio={16 / 9}
|
|
1591
|
+
onCrop={(result) => console.log(result)} />
|
|
1592
|
+
|
|
1593
|
+
<Cropper src="/avatar.jpg" cropShape="round" aspectRatio={1} />
|
|
1594
|
+
```
|
|
1595
|
+
|
|
1596
|
+
| 属性 | 类型 | 默认值 | 说明 |
|
|
1597
|
+
|---|---|---|---|
|
|
1598
|
+
| `src` | `string` | — | 图片地址 |
|
|
1599
|
+
| `cropShape` | `"rect" \| "round"` | `"rect"` | 裁剪形状 |
|
|
1600
|
+
| `aspectRatio` | `number` | — | 裁剪比例 |
|
|
1601
|
+
| `onCrop` | `(result: CropResult) => void` | — | 裁剪回调 |
|
|
1602
|
+
|
|
1603
|
+
### UserGuide 用户引导
|
|
1604
|
+
|
|
1605
|
+
```tsx
|
|
1606
|
+
import { UserGuide } from "knight-ui";
|
|
1607
|
+
|
|
1608
|
+
const steps = [
|
|
1609
|
+
{ target: "#step-1", title: "第一步", content: "这是第一个引导步骤", placement: "bottom" },
|
|
1610
|
+
{ target: "#step-2", title: "第二步", content: "这是第二个引导步骤", placement: "right" },
|
|
1611
|
+
];
|
|
1612
|
+
|
|
1613
|
+
<UserGuide steps={steps} visible currentStep={0}
|
|
1614
|
+
onChange={(s) => console.log(s)}
|
|
1615
|
+
onSkip={() => console.log("skip")}
|
|
1616
|
+
onFinish={() => console.log("finish")}
|
|
1617
|
+
/>
|
|
1618
|
+
```
|
|
1619
|
+
|
|
1620
|
+
### VChart 图表
|
|
1621
|
+
|
|
1622
|
+
```tsx
|
|
1623
|
+
import { VChart } from "knight-ui";
|
|
1624
|
+
|
|
1625
|
+
const data = [
|
|
1626
|
+
{ label: "一月", value: 30 },
|
|
1627
|
+
{ label: "二月", value: 50 },
|
|
1628
|
+
{ label: "三月", value: 40 },
|
|
1629
|
+
];
|
|
1630
|
+
|
|
1631
|
+
<VChart type="line" data={data} width={400} height={300} />
|
|
1632
|
+
<VChart type="bar" data={data} colors={["#8b5cf6", "#22c55e", "#f59e0b"]} />
|
|
1633
|
+
<VChart type="pie" data={data} width={300} height={300} />
|
|
1634
|
+
```
|
|
1635
|
+
|
|
1636
|
+
| 属性 | 类型 | 默认值 | 说明 |
|
|
1637
|
+
|---|---|---|---|
|
|
1638
|
+
| `type` | `"line" \| "bar" \| "pie" \| "area" \| "scatter"` | — | 图表类型 |
|
|
1639
|
+
| `data` | `{ label: string; value: number }[]` | — | 数据 |
|
|
1640
|
+
| `width / height` | `number` | — | 宽高 |
|
|
1641
|
+
| `colors` | `string[]` | — | 颜色数组 |
|
|
1642
|
+
|
|
1643
|
+
### OverflowList 溢出列表
|
|
1644
|
+
|
|
1645
|
+
```tsx
|
|
1646
|
+
import { OverflowList, Tag } from "knight-ui";
|
|
1647
|
+
|
|
1648
|
+
const items = ["Item A", "Item B", "Item C", "Item D", "Item E", "Item F"];
|
|
1649
|
+
|
|
1650
|
+
<OverflowList
|
|
1651
|
+
items={items}
|
|
1652
|
+
minVisibleItems={3}
|
|
1653
|
+
collapseFrom="end"
|
|
1654
|
+
renderItem={(item) => <Tag type="light">{item}</Tag>}
|
|
1655
|
+
overflowRender={(overflow) => <Tag type="light">+{overflow.length} 更多</Tag>}
|
|
1656
|
+
/>
|
|
1657
|
+
|
|
1658
|
+
// 开头折叠
|
|
1659
|
+
<OverflowList items={items} minVisibleItems={3} collapseFrom="start"
|
|
1660
|
+
renderItem={(item) => <Tag color="blue">{item}</Tag>}
|
|
1661
|
+
overflowRender={(o) => <Tag>+{o.length}</Tag>}
|
|
1662
|
+
/>
|
|
1663
|
+
```
|
|
1664
|
+
|
|
1665
|
+
| 属性 | 类型 | 默认值 | 说明 |
|
|
1666
|
+
|---|---|---|---|
|
|
1667
|
+
| `items` | `any[]` | — | 数据 |
|
|
1668
|
+
| `collapseFrom` | `"start" \| "end"` | `"end"` | 折叠方向 |
|
|
1669
|
+
| `minVisibleItems` | `number` | — | 最小可见数 |
|
|
1670
|
+
| `renderItem` | `(item, index) => ReactNode` | — | 渲染项 |
|
|
1671
|
+
| `overflowRender` | `(overflow) => ReactNode` | — | 溢出渲染 |
|
|
1672
|
+
|
|
1673
|
+
---
|
|
1674
|
+
|
|
1675
|
+
## Feedback 反馈
|
|
1676
|
+
|
|
1677
|
+
### Toast 轻提示(命令式)
|
|
1678
|
+
|
|
1679
|
+
```tsx
|
|
1680
|
+
import { Toast } from "knight-ui";
|
|
1681
|
+
|
|
1682
|
+
// 快捷方法
|
|
1683
|
+
Toast.success("操作成功");
|
|
1684
|
+
Toast.info("提示信息");
|
|
1685
|
+
Toast.warning("警告信息", 3000);
|
|
1686
|
+
Toast.error("错误信息");
|
|
1687
|
+
|
|
1688
|
+
// 通用方法
|
|
1689
|
+
const id = Toast.open({
|
|
1690
|
+
content: "自定义内容",
|
|
1691
|
+
duration: 3000,
|
|
1692
|
+
type: "success",
|
|
1693
|
+
position: "top",
|
|
1694
|
+
});
|
|
1695
|
+
Toast.close(id);
|
|
1696
|
+
Toast.destroyAll();
|
|
1697
|
+
|
|
1698
|
+
// Hook 用法
|
|
1699
|
+
const { success, error } = Toast.useToast();
|
|
1700
|
+
success("保存成功");
|
|
1701
|
+
```
|
|
1702
|
+
|
|
1703
|
+
### Notification 通知(命令式)
|
|
1704
|
+
|
|
1705
|
+
```tsx
|
|
1706
|
+
import { Notification } from "knight-ui";
|
|
1707
|
+
|
|
1708
|
+
Notification.success({ title: "成功", content: "操作已完成" });
|
|
1709
|
+
Notification.info({ title: "提示", content: "这是一条通知" });
|
|
1710
|
+
Notification.warning({ title: "警告", content: "请注意检查" });
|
|
1711
|
+
Notification.error({ title: "错误", content: "操作失败" });
|
|
1712
|
+
|
|
1713
|
+
Notification.open({
|
|
1714
|
+
title: "自定义",
|
|
1715
|
+
content: "通知内容",
|
|
1716
|
+
duration: 5000,
|
|
1717
|
+
position: "topRight",
|
|
1718
|
+
});
|
|
1719
|
+
Notification.close(id);
|
|
1720
|
+
Notification.destroyAll();
|
|
1721
|
+
```
|
|
1722
|
+
|
|
1723
|
+
### Banner 横幅
|
|
1724
|
+
|
|
1725
|
+
```tsx
|
|
1726
|
+
import { Banner } from "knight-ui";
|
|
1727
|
+
|
|
1728
|
+
<Banner
|
|
1729
|
+
visible
|
|
1730
|
+
type="warning"
|
|
1731
|
+
title="系统维护通知"
|
|
1732
|
+
description="系统将于今晚 22:00-02:00 进行维护升级"
|
|
1733
|
+
onClose={() => console.log("closed")}
|
|
1734
|
+
/>
|
|
1735
|
+
|
|
1736
|
+
<Banner visible type="success" title="操作成功" fullMode bordered
|
|
1737
|
+
actions={<Button type="primary" size="small">查看详情</Button>}
|
|
1738
|
+
/>
|
|
1739
|
+
```
|
|
1740
|
+
|
|
1741
|
+
| 属性 | 类型 | 默认值 | 说明 |
|
|
1742
|
+
|---|---|---|---|
|
|
1743
|
+
| `type` | `"info" \| "success" \| "warning" \| "danger"` | `"info"` | 类型 |
|
|
1744
|
+
| `title` | `React.ReactNode` | — | 标题 |
|
|
1745
|
+
| `description` | `React.ReactNode` | — | 描述 |
|
|
1746
|
+
| `fullMode` | `boolean` | — | 通栏模式 |
|
|
1747
|
+
| `bordered` | `boolean` | — | 边框 |
|
|
1748
|
+
| `actions` | `React.ReactNode` | — | 操作区 |
|
|
1749
|
+
|
|
1750
|
+
### Progress 进度条
|
|
1751
|
+
|
|
1752
|
+
```tsx
|
|
1753
|
+
import { Progress } from "knight-ui";
|
|
1754
|
+
|
|
1755
|
+
<Progress percent={60} />
|
|
1756
|
+
<Progress type="circle" percent={75} />
|
|
1757
|
+
<Progress percent={80} strokeColor="#22c55e" status="success" />
|
|
1758
|
+
<Progress percent={50} strokeColor={[{ percent: 30, color: "#ef4444" }, { percent: 100, color: "#f59e0b" }]} />
|
|
1759
|
+
```
|
|
1760
|
+
|
|
1761
|
+
| 属性 | 类型 | 默认值 | 说明 |
|
|
1762
|
+
|---|---|---|---|
|
|
1763
|
+
| `type` | `"line" \| "circle"` | `"line"` | 类型 |
|
|
1764
|
+
| `percent` | `number` | — | 进度百分比 |
|
|
1765
|
+
| `strokeWidth` | `number` | — | 线条宽度 |
|
|
1766
|
+
| `strokeColor` | `string \| Array` | — | 颜色 |
|
|
1767
|
+
| `status` | `"normal" \| "success" \| "exception"` | `"normal"` | 状态 |
|
|
1768
|
+
| `direction` | `"horizontal" \| "vertical"` | `"horizontal"` | 方向 |
|
|
1769
|
+
|
|
1770
|
+
### Skeleton 骨架屏
|
|
1771
|
+
|
|
1772
|
+
```tsx
|
|
1773
|
+
import { Skeleton } from "knight-ui";
|
|
1774
|
+
|
|
1775
|
+
// 组合使用
|
|
1776
|
+
<Skeleton loading={isLoading} placeholder={<div>实际内容</div>}>
|
|
1777
|
+
<Skeleton.Title />
|
|
1778
|
+
<Skeleton.Paragraph rows={3} />
|
|
1779
|
+
</Skeleton>
|
|
1780
|
+
|
|
1781
|
+
// 单独组件
|
|
1782
|
+
<Skeleton.Avatar size="large" />
|
|
1783
|
+
<Skeleton.Button />
|
|
1784
|
+
<Skeleton.Image style={{ width: 200, height: 150 }} />
|
|
1785
|
+
```
|
|
1786
|
+
|
|
1787
|
+
子组件:`Skeleton.Avatar`、`Skeleton.Title`、`Skeleton.Paragraph`、`Skeleton.Button`、`Skeleton.Image`
|
|
1788
|
+
|
|
1789
|
+
### Spin 加载中
|
|
1790
|
+
|
|
1791
|
+
```tsx
|
|
1792
|
+
import { Spin } from "knight-ui";
|
|
1793
|
+
|
|
1794
|
+
<Spin spinning={loading}>
|
|
1795
|
+
<div>包裹的内容区域</div>
|
|
1796
|
+
</Spin>
|
|
1797
|
+
|
|
1798
|
+
<Spin size="large" tip="加载中..." />
|
|
1799
|
+
```
|
|
1800
|
+
|
|
1801
|
+
| 属性 | 类型 | 默认值 | 说明 |
|
|
1802
|
+
|---|---|---|---|
|
|
1803
|
+
| `spinning` | `boolean` | `true` | 加载状态 |
|
|
1804
|
+
| `size` | `"small" \| "middle" \| "large"` | `"middle"` | 尺寸 |
|
|
1805
|
+
| `tip` | `React.ReactNode` | — | 提示文字 |
|
|
1806
|
+
| `delay` | `number` | — | 延迟显示(ms) |
|
|
1807
|
+
|
|
1808
|
+
### Feedback 反馈组件
|
|
1809
|
+
|
|
1810
|
+
```tsx
|
|
1811
|
+
import { Feedback } from "knight-ui";
|
|
1812
|
+
|
|
1813
|
+
<Feedback
|
|
1814
|
+
type="emoji"
|
|
1815
|
+
title="这次体验如何?"
|
|
1816
|
+
visible
|
|
1817
|
+
onOk={(result) => console.log(result)}
|
|
1818
|
+
onCancel={() => setVisible(false)}
|
|
1819
|
+
/>
|
|
1820
|
+
|
|
1821
|
+
<Feedback
|
|
1822
|
+
type="radio"
|
|
1823
|
+
title="请选择原因"
|
|
1824
|
+
options={[
|
|
1825
|
+
{ value: "bug", text: "有 Bug" },
|
|
1826
|
+
{ value: "slow", text: "加载慢" },
|
|
1827
|
+
]}
|
|
1828
|
+
onOk={(result) => console.log(result)}
|
|
1829
|
+
/>
|
|
1830
|
+
```
|
|
1831
|
+
|
|
1832
|
+
| 属性 | 类型 | 默认值 | 说明 |
|
|
1833
|
+
|---|---|---|---|
|
|
1834
|
+
| `type` | `"emoji" \| "text" \| "radio" \| "checkbox" \| "custom"` | — | 类型 |
|
|
1835
|
+
| `title` | `React.ReactNode` | — | 标题 |
|
|
1836
|
+
| `options` | `FeedbackOption[]` | — | 选项 |
|
|
1837
|
+
| `onOk` | `(result) => void` | — | 确认回调 |
|
|
1838
|
+
|
|
1839
|
+
---
|
|
1840
|
+
|
|
1841
|
+
## Plus 增强
|
|
1842
|
+
|
|
1843
|
+
### Markdown
|
|
1844
|
+
|
|
1845
|
+
```tsx
|
|
1846
|
+
import { Markdown } from "knight-ui";
|
|
1847
|
+
|
|
1848
|
+
const md = `# 标题
|
|
1849
|
+
这是一段 **Markdown** 文本。
|
|
1850
|
+
|
|
1851
|
+
- 列表项 1
|
|
1852
|
+
- 列表项 2
|
|
1853
|
+
|
|
1854
|
+
\`\`\`js
|
|
1855
|
+
console.log("hello");
|
|
1856
|
+
\`\`\`
|
|
1857
|
+
`;
|
|
1858
|
+
|
|
1859
|
+
<Markdown source={md} />
|
|
1860
|
+
<Markdown source={md} renderMode="preview" />
|
|
1861
|
+
```
|
|
1862
|
+
|
|
1863
|
+
| 属性 | 类型 | 默认值 | 说明 |
|
|
1864
|
+
|---|---|---|---|
|
|
1865
|
+
| `source` | `string` | — | Markdown 文本 |
|
|
1866
|
+
| `renderMode` | `"default" \| "preview" \| "raw"` | `"default"` | 渲染模式 |
|
|
1867
|
+
| `rows` | `number` | — | raw 模式行数 |
|
|
1868
|
+
|
|
1869
|
+
### CodeEditor 代码编辑器
|
|
1870
|
+
|
|
1871
|
+
```tsx
|
|
1872
|
+
import { CodeEditor } from "knight-ui";
|
|
1873
|
+
|
|
1874
|
+
<CodeEditor
|
|
1875
|
+
defaultValue="console.log('hello');"
|
|
1876
|
+
language="javascript"
|
|
1877
|
+
height={300}
|
|
1878
|
+
theme="vs-dark"
|
|
1879
|
+
onChange={(value) => console.log(value)}
|
|
1880
|
+
/>
|
|
1881
|
+
|
|
1882
|
+
<CodeEditor language="typescript" readOnly showCopyBtn showFormatBtn />
|
|
1883
|
+
```
|
|
1884
|
+
|
|
1885
|
+
| 属性 | 类型 | 默认值 | 说明 |
|
|
1886
|
+
|---|---|---|---|
|
|
1887
|
+
| `language` | `string` | — | 语言 |
|
|
1888
|
+
| `theme` | `"vs-dark" \| "light" \| "hc-black"` | `"vs-dark"` | 主题 |
|
|
1889
|
+
| `readOnly` | `boolean` | `false` | 只读 |
|
|
1890
|
+
| `height / minHeight` | `number` | — | 高度 |
|
|
1891
|
+
| `showCopyBtn / showFormatBtn` | `boolean` | `true` | 复制/格式化按钮 |
|
|
1892
|
+
| `fontSize` | `number` | — | 字号 |
|
|
1893
|
+
| `onChange` | `(value: string) => void` | — | 变更回调 |
|
|
1894
|
+
|
|
1895
|
+
### CodeHighlight 代码高亮
|
|
1896
|
+
|
|
1897
|
+
```tsx
|
|
1898
|
+
import { CodeHighlight } from "knight-ui";
|
|
1899
|
+
|
|
1900
|
+
const code = `function hello() {
|
|
1901
|
+
console.log("Hello World");
|
|
1902
|
+
}`;
|
|
1903
|
+
|
|
1904
|
+
<CodeHighlight code={code} language="javascript" />
|
|
1905
|
+
<CodeHighlight code={code} language="typescript" showLineNumbers copyable />
|
|
1906
|
+
```
|
|
1907
|
+
|
|
1908
|
+
| 属性 | 类型 | 默认值 | 说明 |
|
|
1909
|
+
|---|---|---|---|
|
|
1910
|
+
| `code` | `string` | — | 代码文本 |
|
|
1911
|
+
| `language` | `string` | — | 语言 |
|
|
1912
|
+
| `theme` | `"vs-dark" \| "light" \| "hc-black"` | `"vs-dark"` | 主题 |
|
|
1913
|
+
| `showLineNumbers` | `boolean` | — | 行号 |
|
|
1914
|
+
| `copyable` | `boolean` | `true` | 可复制 |
|
|
1915
|
+
|
|
1916
|
+
### JsonViewer JSON 查看器
|
|
1917
|
+
|
|
1918
|
+
```tsx
|
|
1919
|
+
import { JsonViewer } from "knight-ui";
|
|
1920
|
+
|
|
1921
|
+
<JsonViewer value={{ name: "Knight", version: "1.0.0" }} />
|
|
1922
|
+
|
|
1923
|
+
<JsonViewer value='{"key": "value"}' theme="light" readOnly height={300} />
|
|
1924
|
+
```
|
|
1925
|
+
|
|
1926
|
+
| 属性 | 类型 | 默认值 | 说明 |
|
|
1927
|
+
|---|---|---|---|
|
|
1928
|
+
| `value` | `string \| object` | — | JSON 内容 |
|
|
1929
|
+
| `readOnly` | `boolean` | `false` | 只读 |
|
|
1930
|
+
| `height` | `number` | — | 高度 |
|
|
1931
|
+
| `theme` | `"vs-dark" \| "light"` | `"vs-dark"` | 主题 |
|
|
1932
|
+
| `onChange` | `(value: string) => void` | — | 变更回调 |
|
|
1933
|
+
|
|
1934
|
+
### Chat 聊天
|
|
1935
|
+
|
|
1936
|
+
```tsx
|
|
1937
|
+
import { Chat } from "knight-ui";
|
|
1938
|
+
|
|
1939
|
+
const messages = [
|
|
1940
|
+
{ id: "1", content: "你好!", role: "user", timestamp: Date.now() },
|
|
1941
|
+
{ id: "2", content: "你好,有什么可以帮助你的?", role: "assistant", timestamp: Date.now() },
|
|
1942
|
+
];
|
|
1943
|
+
|
|
1944
|
+
<Chat
|
|
1945
|
+
dataSource={messages}
|
|
1946
|
+
onSend={(content) => console.log("send:", content)}
|
|
1947
|
+
placeholder="输入消息..."
|
|
1948
|
+
/>
|
|
1949
|
+
```
|
|
1950
|
+
|
|
1951
|
+
| 属性 | 类型 | 默认值 | 说明 |
|
|
1952
|
+
|---|---|---|---|
|
|
1953
|
+
| `dataSource` | `ChatMessage[]` | — | 消息列表 |
|
|
1954
|
+
| `loading` | `boolean` | `false` | 加载中 |
|
|
1955
|
+
| `showInput` | `boolean` | `true` | 显示输入框 |
|
|
1956
|
+
| `onSend` | `(content: string) => void` | — | 发送回调 |
|
|
1957
|
+
|
|
1958
|
+
### AudioPlayer 音频播放器
|
|
1959
|
+
|
|
1960
|
+
```tsx
|
|
1961
|
+
import { AudioPlayer } from "knight-ui";
|
|
1962
|
+
|
|
1963
|
+
<AudioPlayer src="/audio.mp3" theme="dark" />
|
|
1964
|
+
<AudioPlayer src="/audio.mp3" autoPlay loop volume={0.5} />
|
|
1965
|
+
```
|
|
1966
|
+
|
|
1967
|
+
| 属性 | 类型 | 默认值 | 说明 |
|
|
1968
|
+
|---|---|---|---|
|
|
1969
|
+
| `src` | `string` | — | 音频地址 |
|
|
1970
|
+
| `autoPlay` | `boolean` | `false` | 自动播放 |
|
|
1971
|
+
| `loop` | `boolean` | `false` | 循环 |
|
|
1972
|
+
| `theme` | `"dark" \| "light"` | `"dark"` | 主题 |
|
|
1973
|
+
| `volume` | `number` | — | 音量 0-1 |
|
|
1974
|
+
|
|
1975
|
+
### VideoPlayer 视频播放器
|
|
1976
|
+
|
|
1977
|
+
```tsx
|
|
1978
|
+
import { VideoPlayer } from "knight-ui";
|
|
1979
|
+
|
|
1980
|
+
<VideoPlayer src="/video.mp4" poster="/poster.jpg" width={640} />
|
|
1981
|
+
<VideoPlayer src="/video.mp4" autoPlay muted loop />
|
|
1982
|
+
```
|
|
1983
|
+
|
|
1984
|
+
| 属性 | 类型 | 默认值 | 说明 |
|
|
1985
|
+
|---|---|---|---|
|
|
1986
|
+
| `src` | `string` | — | 视频地址 |
|
|
1987
|
+
| `poster` | `string` | — | 封面图 |
|
|
1988
|
+
| `autoPlay` | `boolean` | `false` | 自动播放 |
|
|
1989
|
+
| `loop` | `boolean` | `false` | 循环 |
|
|
1990
|
+
| `muted` | `boolean` | — | 静音 |
|
|
1991
|
+
|
|
1992
|
+
### DragMove 拖拽移动
|
|
1993
|
+
|
|
1994
|
+
```tsx
|
|
1995
|
+
import { DragMove } from "knight-ui";
|
|
1996
|
+
|
|
1997
|
+
<DragMove
|
|
1998
|
+
initialPosition={{ x: 100, y: 100 }}
|
|
1999
|
+
bounds={{ left: 0, top: 0, right: 500, bottom: 500 }}
|
|
2000
|
+
onDragEnd={(pos) => console.log(pos)}
|
|
2001
|
+
>
|
|
2002
|
+
<div style={{ width: 100, height: 100, background: "#8b5cf6", cursor: "move" }}>
|
|
2003
|
+
拖拽我
|
|
2004
|
+
</div>
|
|
2005
|
+
</DragMove>
|
|
2006
|
+
|
|
2007
|
+
// 限制 X 轴
|
|
2008
|
+
<DragMove axis="x">
|
|
2009
|
+
<div>只能水平拖拽</div>
|
|
2010
|
+
</DragMove>
|
|
2011
|
+
```
|
|
2012
|
+
|
|
2013
|
+
| 属性 | 类型 | 默认值 | 说明 |
|
|
2014
|
+
|---|---|---|---|
|
|
2015
|
+
| `initialPosition` | `{ x, y }` | — | 初始位置 |
|
|
2016
|
+
| `bounds` | `{ top?, left?, right?, bottom? }` | — | 边界 |
|
|
2017
|
+
| `axis` | `"x" \| "y"` | — | 限制方向 |
|
|
2018
|
+
| `onDragStart / onDrag / onDragEnd` | `(pos) => void` | — | 拖拽回调 |
|
|
2019
|
+
|
|
2020
|
+
### HotKeys 快捷键
|
|
2021
|
+
|
|
2022
|
+
```tsx
|
|
2023
|
+
import { HotKeys } from "knight-ui";
|
|
2024
|
+
|
|
2025
|
+
<HotKeys
|
|
2026
|
+
keys={["ctrl+s", "ctrl+shift+f"]}
|
|
2027
|
+
onKeyDown={(e) => console.log("keydown:", e.keys)}
|
|
2028
|
+
onKeyUp={(e) => console.log("keyup:", e.keys)}
|
|
2029
|
+
/>
|
|
2030
|
+
```
|
|
2031
|
+
|
|
2032
|
+
| 属性 | 类型 | 默认值 | 说明 |
|
|
2033
|
+
|---|---|---|---|
|
|
2034
|
+
| `keys` | `string[]` | — | 快捷键组合 |
|
|
2035
|
+
| `attach` | `HTMLElement \| Document` | `document` | 挂载节点 |
|
|
2036
|
+
| `onKeyDown / onKeyUp` | `(e) => void` | — | 按键回调 |
|
|
2037
|
+
|
|
2038
|
+
### Lottie 动画
|
|
2039
|
+
|
|
2040
|
+
```tsx
|
|
2041
|
+
import { Lottie } from "knight-ui";
|
|
2042
|
+
|
|
2043
|
+
// 需要宿主应用注入 lottie-web 实例
|
|
2044
|
+
<Lottie lottie={lottieWeb} src="/animation.json" autoPlay loop width={200} height={200} />
|
|
2045
|
+
<Lottie lottie={lottieWeb} src={animationData} speed={1.5} onComplete={() => console.log("done")} />
|
|
2046
|
+
```
|
|
2047
|
+
|
|
2048
|
+
| 属性 | 类型 | 默认值 | 说明 |
|
|
2049
|
+
|---|---|---|---|
|
|
2050
|
+
| `lottie` | `any` | — | `lottie-web` 实例(由宿主注入) |
|
|
2051
|
+
| `src` | `string \| object` | — | 动画数据或 URL |
|
|
2052
|
+
| `autoPlay` | `boolean` | `true` | 自动播放 |
|
|
2053
|
+
| `loop` | `boolean` | `true` | 循环 |
|
|
2054
|
+
| `speed` | `number` | `1` | 播放速度 |
|
|
2055
|
+
| `onComplete` | `() => void` | — | 播放完成回调 |
|
|
2056
|
+
|
|
2057
|
+
---
|
|
2058
|
+
|
|
2059
|
+
## AI 智能
|
|
2060
|
+
|
|
2061
|
+
### AIChatInput AI 对话输入
|
|
2062
|
+
|
|
2063
|
+
```tsx
|
|
2064
|
+
import { AIChatInput } from "knight-ui";
|
|
2065
|
+
|
|
2066
|
+
<AIChatInput
|
|
2067
|
+
placeholder="输入你的问题..."
|
|
2068
|
+
onSend={(value, attachments) => console.log(value, attachments)}
|
|
2069
|
+
onChange={(value) => console.log(value)}
|
|
2070
|
+
/>
|
|
2071
|
+
|
|
2072
|
+
<AIChatInput loading disabled placeholder="AI 正在回复..." />
|
|
2073
|
+
```
|
|
2074
|
+
|
|
2075
|
+
| 属性 | 类型 | 默认值 | 说明 |
|
|
2076
|
+
|---|---|---|---|
|
|
2077
|
+
| `value / defaultValue` | `string` | — | 输入值 |
|
|
2078
|
+
| `placeholder` | `string` | — | 占位符 |
|
|
2079
|
+
| `loading` | `boolean` | `false` | 加载中 |
|
|
2080
|
+
| `minRows / maxRows` | `number` | — | 行数范围 |
|
|
2081
|
+
| `attachments` | `Attachment[]` | — | 附件列表 |
|
|
2082
|
+
| `onSend` | `(value, attachments) => void` | — | 发送回调 |
|
|
2083
|
+
|
|
2084
|
+
### AIChatDialogue AI 对话展示
|
|
2085
|
+
|
|
2086
|
+
```tsx
|
|
2087
|
+
import { AIChatDialogue } from "knight-ui";
|
|
2088
|
+
|
|
2089
|
+
const messages = [
|
|
2090
|
+
{ id: "1", role: "user", content: "这段代码有什么问题?" },
|
|
2091
|
+
{ id: "2", role: "assistant", content: "我来帮你分析一下..." },
|
|
2092
|
+
];
|
|
2093
|
+
|
|
2094
|
+
<AIChatDialogue
|
|
2095
|
+
dataSource={messages}
|
|
2096
|
+
typing
|
|
2097
|
+
userNickname="User"
|
|
2098
|
+
assistantNickname="AI Assistant"
|
|
2099
|
+
onCopy={(msg) => navigator.clipboard.writeText(msg.content)}
|
|
2100
|
+
/>
|
|
2101
|
+
```
|
|
2102
|
+
|
|
2103
|
+
| 属性 | 类型 | 默认值 | 说明 |
|
|
2104
|
+
|---|---|---|---|
|
|
2105
|
+
| `dataSource` | `AIMessage[]` | — | 消息列表 |
|
|
2106
|
+
| `typing` | `boolean` | `false` | 打字效果 |
|
|
2107
|
+
| `userAvatar / assistantAvatar` | `string` | — | 头像 |
|
|
2108
|
+
| `userNickname / assistantNickname` | `string` | — | 昵称 |
|
|
2109
|
+
| `maxHeight` | `number` | — | 最大高度 |
|
|
2110
|
+
| `onCopy` | `(msg) => void` | — | 复制回调 |
|
|
2111
|
+
| `onRetry` | `(msg, index) => void` | — | 重试回调 |
|
|
2112
|
+
|
|
2113
|
+
### Sidebar AI 侧栏
|
|
2114
|
+
|
|
2115
|
+
```tsx
|
|
2116
|
+
import { Sidebar } from "knight-ui";
|
|
2117
|
+
|
|
2118
|
+
const items = [
|
|
2119
|
+
{ key: "chat1", label: "对话 1", icon: <span>💬</span> },
|
|
2120
|
+
{ key: "chat2", label: "对话 2", icon: <span>💬</span> },
|
|
2121
|
+
];
|
|
2122
|
+
|
|
2123
|
+
<Sidebar
|
|
2124
|
+
items={items}
|
|
2125
|
+
defaultActiveKey="chat1"
|
|
2126
|
+
header={<Text strong>AI 对话列表</Text>}
|
|
2127
|
+
onChange={(key) => console.log(key)}
|
|
2128
|
+
/>
|
|
2129
|
+
```
|
|
2130
|
+
|
|
2131
|
+
| 属性 | 类型 | 默认值 | 说明 |
|
|
2132
|
+
|---|---|---|---|
|
|
2133
|
+
| `items` | `SidebarItem[]` | — | 菜单项 |
|
|
2134
|
+
| `activeKey / defaultActiveKey` | `string` | — | 当前选中 |
|
|
2135
|
+
| `collapsed` | `boolean` | — | 折叠 |
|
|
2136
|
+
| `width / collapsedWidth` | `number` | — | 宽度/折叠宽度 |
|
|
2137
|
+
| `header / footer` | `React.ReactNode` | — | 头部/底部 |
|
|
2138
|
+
|
|
2139
|
+
---
|
|
2140
|
+
|
|
2141
|
+
## Other 其他
|
|
2142
|
+
|
|
2143
|
+
### ConfigProvider 全局配置
|
|
2144
|
+
|
|
2145
|
+
```tsx
|
|
2146
|
+
import { ConfigProvider } from "knight-ui";
|
|
2147
|
+
|
|
2148
|
+
<ConfigProvider componentSize="large" getPopupContainer={() => document.body}>
|
|
2149
|
+
<App />
|
|
2150
|
+
</ConfigProvider>
|
|
2151
|
+
```
|
|
2152
|
+
|
|
2153
|
+
| 属性 | 类型 | 默认值 | 说明 |
|
|
2154
|
+
|---|---|---|---|
|
|
2155
|
+
| `componentSize` | `"small" \| "middle" \| "large"` | — | 组件尺寸 |
|
|
2156
|
+
| `getPopupContainer` | `() => HTMLElement` | — | 弹出层容器 |
|
|
2157
|
+
| `direction` | `"ltr" \| "rtl"` | `"ltr"` | 文本方向 |
|
|
2158
|
+
|
|
2159
|
+
### LocaleProvider 国际化
|
|
2160
|
+
|
|
2161
|
+
```tsx
|
|
2162
|
+
import { LocaleProvider } from "knight-ui";
|
|
2163
|
+
|
|
2164
|
+
<LocaleProvider locale={{
|
|
2165
|
+
okText: "确认",
|
|
2166
|
+
cancelText: "取消",
|
|
2167
|
+
emptyText: "暂无数据",
|
|
2168
|
+
placeholder: "请选择",
|
|
2169
|
+
}}>
|
|
2170
|
+
<App />
|
|
2171
|
+
</LocaleProvider>
|
|
2172
|
+
```
|
|
2173
|
+
|
|
2174
|
+
| 属性 | 类型 | 默认值 | 说明 |
|
|
2175
|
+
|---|---|---|---|
|
|
2176
|
+
| `locale` | `Partial<Locale>` | — | 语言包 |
|
|
2177
|
+
|
|
2178
|
+
---
|
|
2179
|
+
|
|
2180
|
+
## Peer 依赖
|
|
2181
|
+
|
|
2182
|
+
| 包 | 版本 |
|
|
2183
|
+
|---|---|
|
|
2184
|
+
| `react` | >=18.0.0 |
|
|
2185
|
+
| `react-dom` | >=18.0.0 |
|
|
2186
|
+
|
|
2187
|
+
## License
|
|
2188
|
+
|
|
2189
|
+
MIT
|