one-design-next 0.0.4-alpha.100
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/LICENSE +21 -0
- package/README.md +134 -0
- package/dist/_util/canUseDom.d.ts +1 -0
- package/dist/_util/canUseDom.js +3 -0
- package/dist/_util/color.d.ts +103 -0
- package/dist/_util/color.js +250 -0
- package/dist/_util/date.d.ts +53 -0
- package/dist/_util/date.js +657 -0
- package/dist/_util/focusManager.d.ts +12 -0
- package/dist/_util/focusManager.js +56 -0
- package/dist/_util/queueMtPolyfill.d.ts +5 -0
- package/dist/_util/queueMtPolyfill.js +19 -0
- package/dist/_util/time.d.ts +44 -0
- package/dist/_util/time.js +150 -0
- package/dist/_util/useActive.d.ts +6 -0
- package/dist/_util/useActive.js +25 -0
- package/dist/_util/useControlledState.d.ts +8 -0
- package/dist/_util/useControlledState.js +30 -0
- package/dist/_util/useLayoutEffect.d.ts +4 -0
- package/dist/_util/useLayoutEffect.js +30 -0
- package/dist/alert/index.d.ts +63 -0
- package/dist/alert/index.js +137 -0
- package/dist/alert/style/index.css +184 -0
- package/dist/alert/style/index.d.ts +2 -0
- package/dist/alert/style/index.js +2 -0
- package/dist/auto-complete/index.d.ts +64 -0
- package/dist/auto-complete/index.js +149 -0
- package/dist/avatar/index.d.ts +68 -0
- package/dist/avatar/index.js +177 -0
- package/dist/avatar/primitive.d.ts +6 -0
- package/dist/avatar/primitive.js +23 -0
- package/dist/avatar/style/index.css +74 -0
- package/dist/avatar/style/index.d.ts +2 -0
- package/dist/avatar/style/index.js +2 -0
- package/dist/button/index.d.ts +15 -0
- package/dist/button/index.js +64 -0
- package/dist/button/style/index.css +338 -0
- package/dist/button/style/index.d.ts +2 -0
- package/dist/button/style/index.js +2 -0
- package/dist/calendar/index.d.ts +25 -0
- package/dist/calendar/index.js +379 -0
- package/dist/calendar/style/index.css +5 -0
- package/dist/calendar/style/index.d.ts +2 -0
- package/dist/calendar/style/index.js +2 -0
- package/dist/card/header.d.ts +26 -0
- package/dist/card/header.js +37 -0
- package/dist/card/index.d.ts +24 -0
- package/dist/card/index.js +31 -0
- package/dist/card/style/index.css +141 -0
- package/dist/card/style/index.d.ts +1 -0
- package/dist/card/style/index.js +1 -0
- package/dist/cascader/CascaderOptionContent.d.ts +20 -0
- package/dist/cascader/CascaderOptionContent.js +85 -0
- package/dist/cascader/Panel.d.ts +53 -0
- package/dist/cascader/Panel.js +131 -0
- package/dist/cascader/index.d.ts +59 -0
- package/dist/cascader/index.js +436 -0
- package/dist/cascader/style/index.css +414 -0
- package/dist/cascader/style/index.d.ts +2 -0
- package/dist/cascader/style/index.js +2 -0
- package/dist/cascader/utils.d.ts +14 -0
- package/dist/cascader/utils.js +109 -0
- package/dist/chart/index.d.ts +14 -0
- package/dist/chart/index.js +11 -0
- package/dist/chart/style/index.css +1 -0
- package/dist/chart/style/index.d.ts +2 -0
- package/dist/chart/style/index.js +2 -0
- package/dist/checkbox/Checkbox.d.ts +77 -0
- package/dist/checkbox/Checkbox.js +178 -0
- package/dist/checkbox/Context.d.ts +35 -0
- package/dist/checkbox/Context.js +2 -0
- package/dist/checkbox/Group.d.ts +68 -0
- package/dist/checkbox/Group.js +151 -0
- package/dist/checkbox/index.d.ts +5 -0
- package/dist/checkbox/index.js +3 -0
- package/dist/checkbox/style/index.css +330 -0
- package/dist/checkbox/style/index.d.ts +2 -0
- package/dist/checkbox/style/index.js +2 -0
- package/dist/collapse/index.d.ts +43 -0
- package/dist/collapse/index.js +111 -0
- package/dist/collapse/primitive.d.ts +21 -0
- package/dist/collapse/primitive.js +103 -0
- package/dist/collapse/style/index.css +59 -0
- package/dist/collapse/style/index.d.ts +2 -0
- package/dist/collapse/style/index.js +2 -0
- package/dist/color-picker/index.d.ts +55 -0
- package/dist/color-picker/index.js +588 -0
- package/dist/color-picker/style/index.css +135 -0
- package/dist/color-picker/style/index.d.ts +2 -0
- package/dist/color-picker/style/index.js +2 -0
- package/dist/config-provider/index.d.ts +46 -0
- package/dist/config-provider/index.js +37 -0
- package/dist/date-picker/MonthPicker.d.ts +31 -0
- package/dist/date-picker/MonthPicker.js +161 -0
- package/dist/date-picker/QuarterPicker.d.ts +36 -0
- package/dist/date-picker/QuarterPicker.js +168 -0
- package/dist/date-picker/YearPicker.d.ts +13 -0
- package/dist/date-picker/YearPicker.js +84 -0
- package/dist/date-picker/index.d.ts +240 -0
- package/dist/date-picker/index.js +1249 -0
- package/dist/date-picker/style/index.css +511 -0
- package/dist/date-picker/style/index.d.ts +2 -0
- package/dist/date-picker/style/index.js +2 -0
- package/dist/date-range-picker/index.d.ts +58 -0
- package/dist/date-range-picker/index.js +1043 -0
- package/dist/dialog/index.d.ts +139 -0
- package/dist/dialog/index.js +300 -0
- package/dist/dialog/style/index.css +228 -0
- package/dist/dialog/style/index.d.ts +2 -0
- package/dist/dialog/style/index.js +2 -0
- package/dist/dialog/useModalPosition.d.ts +6 -0
- package/dist/dialog/useModalPosition.js +34 -0
- package/dist/drawer/index.d.ts +92 -0
- package/dist/drawer/index.js +214 -0
- package/dist/drawer/style/index.css +244 -0
- package/dist/drawer/style/index.d.ts +2 -0
- package/dist/drawer/style/index.js +2 -0
- package/dist/dropdown/index.d.ts +91 -0
- package/dist/dropdown/index.js +846 -0
- package/dist/dropdown/style/index.css +206 -0
- package/dist/dropdown/style/index.d.ts +2 -0
- package/dist/dropdown/style/index.js +2 -0
- package/dist/ellipsis-text/index.d.ts +19 -0
- package/dist/ellipsis-text/index.js +97 -0
- package/dist/ellipsis-text/style/index.css +1 -0
- package/dist/ellipsis-text/style/index.d.ts +2 -0
- package/dist/ellipsis-text/style/index.js +2 -0
- package/dist/empty/index.d.ts +20 -0
- package/dist/empty/index.js +2398 -0
- package/dist/empty/style/index.css +80 -0
- package/dist/empty/style/index.d.ts +2 -0
- package/dist/empty/style/index.js +2 -0
- package/dist/form/index.d.ts +106 -0
- package/dist/form/index.js +272 -0
- package/dist/form/style/index.css +84 -0
- package/dist/form/style/index.d.ts +2 -0
- package/dist/form/style/index.js +2 -0
- package/dist/hover-fill/index.d.ts +50 -0
- package/dist/hover-fill/index.js +258 -0
- package/dist/hover-fill/style/index.css +35 -0
- package/dist/hover-fill/style/index.d.ts +2 -0
- package/dist/hover-fill/style/index.js +2 -0
- package/dist/icon/index.d.ts +11 -0
- package/dist/icon/index.js +102 -0
- package/dist/icon/style/index.css +15 -0
- package/dist/icon/style/index.d.ts +2 -0
- package/dist/icon/style/index.js +2 -0
- package/dist/icon/svg/alert/alert-circle-filled.svg +1 -0
- package/dist/icon/svg/alert/alert-circle.svg +1 -0
- package/dist/icon/svg/alert/help-circle-filled.svg +1 -0
- package/dist/icon/svg/alert/help-circle.svg +1 -0
- package/dist/icon/svg/alert/info-circle-filled.svg +1 -0
- package/dist/icon/svg/alert/info-circle.svg +1 -0
- package/dist/icon/svg/alert/stop.svg +1 -0
- package/dist/icon/svg/alert/warning-filled.svg +1 -0
- package/dist/icon/svg/alert/warning.svg +1 -0
- package/dist/icon/svg/content/QRcode.svg +1 -0
- package/dist/icon/svg/content/bell-filled.svg +1 -0
- package/dist/icon/svg/content/bell.svg +1 -0
- package/dist/icon/svg/content/bidding.svg +1 -0
- package/dist/icon/svg/content/calendar.svg +1 -0
- package/dist/icon/svg/content/code.svg +1 -0
- package/dist/icon/svg/content/customColumn.svg +1 -0
- package/dist/icon/svg/content/data.svg +1 -0
- package/dist/icon/svg/content/dataReport-filled.svg +1 -0
- package/dist/icon/svg/content/dataReport.svg +1 -0
- package/dist/icon/svg/content/download-1.svg +1 -0
- package/dist/icon/svg/content/download-filled.svg +1 -0
- package/dist/icon/svg/content/download.svg +1 -0
- package/dist/icon/svg/content/exchange.svg +1 -0
- package/dist/icon/svg/content/filter-filled.svg +1 -0
- package/dist/icon/svg/content/filter.svg +1 -0
- package/dist/icon/svg/content/hot-filled.svg +1 -0
- package/dist/icon/svg/content/hot.svg +1 -0
- package/dist/icon/svg/content/link.svg +1 -0
- package/dist/icon/svg/content/location.svg +1 -0
- package/dist/icon/svg/content/maxSize.svg +1 -0
- package/dist/icon/svg/content/mobile-filled.svg +1 -0
- package/dist/icon/svg/content/mobile.svg +1 -0
- package/dist/icon/svg/content/mute.svg +1 -0
- package/dist/icon/svg/content/mutiImage-filled.svg +1 -0
- package/dist/icon/svg/content/mutiImage.svg +1 -0
- package/dist/icon/svg/content/refresh.svg +1 -0
- package/dist/icon/svg/content/report.svg +1 -0
- package/dist/icon/svg/content/save.svg +1 -0
- package/dist/icon/svg/content/search-bold.svg +1 -0
- package/dist/icon/svg/content/search-filled.svg +1 -0
- package/dist/icon/svg/content/search.svg +1 -0
- package/dist/icon/svg/content/setting.svg +1 -0
- package/dist/icon/svg/content/share.svg +1 -0
- package/dist/icon/svg/content/sort.svg +1 -0
- package/dist/icon/svg/content/sound.svg +1 -0
- package/dist/icon/svg/content/sticker-filled.svg +1 -0
- package/dist/icon/svg/content/sticker.svg +1 -0
- package/dist/icon/svg/content/tag-filled.svg +1 -0
- package/dist/icon/svg/content/tag.svg +1 -0
- package/dist/icon/svg/content/thumbDown-filled.svg +1 -0
- package/dist/icon/svg/content/thumbDown.svg +1 -0
- package/dist/icon/svg/content/thumbUp-filled.svg +1 -0
- package/dist/icon/svg/content/thumbUp.svg +1 -0
- package/dist/icon/svg/content/time-bold.svg +1 -0
- package/dist/icon/svg/content/time.svg +1 -0
- package/dist/icon/svg/content/verify.svg +1 -0
- package/dist/icon/svg/content/video.svg +1 -0
- package/dist/icon/svg/content/videoScreenshot.svg +1 -0
- package/dist/icon/svg/content/zoomIn.svg +1 -0
- package/dist/icon/svg/content/zoomOut.svg +1 -0
- package/dist/icon/svg/data/compare.svg +1 -0
- package/dist/icon/svg/data/histogram.svg +1 -0
- package/dist/icon/svg/editor/cancel-circle-filled.svg +1 -0
- package/dist/icon/svg/editor/cancel-circle.svg +1 -0
- package/dist/icon/svg/editor/cancel.svg +1 -0
- package/dist/icon/svg/editor/check-circle-filled.svg +1 -0
- package/dist/icon/svg/editor/check-circle.svg +1 -0
- package/dist/icon/svg/editor/check.svg +1 -0
- package/dist/icon/svg/editor/copy.svg +1 -0
- package/dist/icon/svg/editor/custom-filled.svg +1 -0
- package/dist/icon/svg/editor/custom.svg +1 -0
- package/dist/icon/svg/editor/delete.svg +1 -0
- package/dist/icon/svg/editor/deleteAD-filled.svg +1 -0
- package/dist/icon/svg/editor/draggable.svg +1 -0
- package/dist/icon/svg/editor/edit.svg +1 -0
- package/dist/icon/svg/editor/import.svg +1 -0
- package/dist/icon/svg/editor/minus-circle-filled.svg +1 -0
- package/dist/icon/svg/editor/minus-circle.svg +1 -0
- package/dist/icon/svg/editor/minus.svg +1 -0
- package/dist/icon/svg/editor/modify-bold.svg +1 -0
- package/dist/icon/svg/editor/modify.svg +1 -0
- package/dist/icon/svg/editor/multiCreate.svg +1 -0
- package/dist/icon/svg/editor/mutiSelect-filled.svg +1 -0
- package/dist/icon/svg/editor/mutiSelect.svg +1 -0
- package/dist/icon/svg/editor/pause-filled.svg +1 -0
- package/dist/icon/svg/editor/play-filled.svg +1 -0
- package/dist/icon/svg/editor/plus-circle-filled.svg +1 -0
- package/dist/icon/svg/editor/plus-circle.svg +1 -0
- package/dist/icon/svg/editor/plus.svg +1 -0
- package/dist/icon/svg/editor/send.svg +1 -0
- package/dist/icon/svg/editor/subdivide.svg +1 -0
- package/dist/icon/svg/navigation/arrowDown-filled.svg +1 -0
- package/dist/icon/svg/navigation/arrowDown.svg +1 -0
- package/dist/icon/svg/navigation/arrowLeft-filled.svg +1 -0
- package/dist/icon/svg/navigation/arrowLeft.svg +1 -0
- package/dist/icon/svg/navigation/arrowRight-filled.svg +1 -0
- package/dist/icon/svg/navigation/arrowRight.svg +1 -0
- package/dist/icon/svg/navigation/arrowUp-filled.svg +1 -0
- package/dist/icon/svg/navigation/arrowUp.svg +1 -0
- package/dist/icon/svg/navigation/bottom-filled.svg +1 -0
- package/dist/icon/svg/navigation/bottom.svg +1 -0
- package/dist/icon/svg/navigation/doubleLeft-filled.svg +1 -0
- package/dist/icon/svg/navigation/doubleLeft.svg +1 -0
- package/dist/icon/svg/navigation/doubleRight-filled.svg +1 -0
- package/dist/icon/svg/navigation/doubleRight.svg +1 -0
- package/dist/icon/svg/navigation/down-bold.svg +1 -0
- package/dist/icon/svg/navigation/down-filled.svg +1 -0
- package/dist/icon/svg/navigation/down.svg +1 -0
- package/dist/icon/svg/navigation/fall-filled.svg +1 -0
- package/dist/icon/svg/navigation/fold.svg +1 -0
- package/dist/icon/svg/navigation/fullScreen.svg +1 -0
- package/dist/icon/svg/navigation/left-bold.svg +1 -0
- package/dist/icon/svg/navigation/left-filled.svg +1 -0
- package/dist/icon/svg/navigation/left.svg +1 -0
- package/dist/icon/svg/navigation/leftFirst-filled.svg +1 -0
- package/dist/icon/svg/navigation/leftFirst.svg +1 -0
- package/dist/icon/svg/navigation/logout.svg +1 -0
- package/dist/icon/svg/navigation/menu.svg +1 -0
- package/dist/icon/svg/navigation/menuLeft-bold.svg +1 -0
- package/dist/icon/svg/navigation/menuLeft.svg +1 -0
- package/dist/icon/svg/navigation/menuRight-bold.svg +1 -0
- package/dist/icon/svg/navigation/menuRight.svg +1 -0
- package/dist/icon/svg/navigation/more-vertical.svg +1 -0
- package/dist/icon/svg/navigation/more.svg +1 -0
- package/dist/icon/svg/navigation/pointerLeft-filled.svg +1 -0
- package/dist/icon/svg/navigation/pointerRight-filled.svg +1 -0
- package/dist/icon/svg/navigation/right-bold.svg +1 -0
- package/dist/icon/svg/navigation/right-filled.svg +1 -0
- package/dist/icon/svg/navigation/right.svg +1 -0
- package/dist/icon/svg/navigation/rightLast-filled.svg +1 -0
- package/dist/icon/svg/navigation/rightLast.svg +1 -0
- package/dist/icon/svg/navigation/rise-filled.svg +1 -0
- package/dist/icon/svg/navigation/top-filled.svg +1 -0
- package/dist/icon/svg/navigation/top.svg +1 -0
- package/dist/icon/svg/navigation/unfold-filled.svg +1 -0
- package/dist/icon/svg/navigation/unfold.svg +1 -0
- package/dist/icon/svg/navigation/up-bold.svg +1 -0
- package/dist/icon/svg/navigation/up-filled.svg +1 -0
- package/dist/icon/svg/navigation/up.svg +1 -0
- package/dist/icon/svg/product/AIFile.svg +1 -0
- package/dist/icon/svg/product/LandingPage.svg +1 -0
- package/dist/icon/svg/product/addressBook.svg +1 -0
- package/dist/icon/svg/product/alarmClock.svg +1 -0
- package/dist/icon/svg/product/asset-square.svg +1 -0
- package/dist/icon/svg/product/assetProtecting.svg +1 -0
- package/dist/icon/svg/product/autoAD-square-filled.svg +1 -0
- package/dist/icon/svg/product/card-distribute.svg +1 -0
- package/dist/icon/svg/product/channels-square-filled.svg +1 -0
- package/dist/icon/svg/product/channels.svg +1 -0
- package/dist/icon/svg/product/chart.svg +3 -0
- package/dist/icon/svg/product/chatBubble-filled.svg +1 -0
- package/dist/icon/svg/product/checkBadge.svg +1 -0
- package/dist/icon/svg/product/comments.svg +1 -0
- package/dist/icon/svg/product/container.svg +1 -0
- package/dist/icon/svg/product/dataAuth.svg +1 -0
- package/dist/icon/svg/product/dataBoard.svg +1 -0
- package/dist/icon/svg/product/dataBox.svg +1 -0
- package/dist/icon/svg/product/dataFolder.svg +1 -0
- package/dist/icon/svg/product/dataRising.svg +1 -0
- package/dist/icon/svg/product/detect.svg +1 -0
- package/dist/icon/svg/product/exposure-filled.svg +1 -0
- package/dist/icon/svg/product/extendedConfig.svg +1 -0
- package/dist/icon/svg/product/file-filled.svg +1 -0
- package/dist/icon/svg/product/flag.svg +1 -0
- package/dist/icon/svg/product/flame.svg +1 -0
- package/dist/icon/svg/product/folderZip.svg +1 -0
- package/dist/icon/svg/product/folderzip-bold.svg +1 -0
- package/dist/icon/svg/product/guideBook.svg +1 -0
- package/dist/icon/svg/product/hosting.svg +1 -0
- package/dist/icon/svg/product/icon-outlined.svg +1 -0
- package/dist/icon/svg/product/idea-bold.svg +1 -0
- package/dist/icon/svg/product/idea.svg +1 -0
- package/dist/icon/svg/product/image-bold.svg +1 -0
- package/dist/icon/svg/product/image-filled.svg +1 -0
- package/dist/icon/svg/product/image.svg +1 -0
- package/dist/icon/svg/product/images.svg +1 -0
- package/dist/icon/svg/product/keyword.svg +1 -0
- package/dist/icon/svg/product/linkSquare.svg +1 -0
- package/dist/icon/svg/product/lock.svg +1 -0
- package/dist/icon/svg/product/magic-filled.svg +1 -0
- package/dist/icon/svg/product/magic.svg +1 -0
- package/dist/icon/svg/product/miniProgram.svg +1 -0
- package/dist/icon/svg/product/minigame-filled.svg +1 -0
- package/dist/icon/svg/product/mobilePage.svg +1 -0
- package/dist/icon/svg/product/moments-filled.svg +1 -0
- package/dist/icon/svg/product/notepad-bold.svg +1 -0
- package/dist/icon/svg/product/notepad.svg +1 -0
- package/dist/icon/svg/product/offiaccount-filled.svg +1 -0
- package/dist/icon/svg/product/playing.svg +1 -0
- package/dist/icon/svg/product/qualification.svg +1 -0
- package/dist/icon/svg/product/quickFile.svg +1 -0
- package/dist/icon/svg/product/ringStruckture.svg +1 -0
- package/dist/icon/svg/product/searchAD-filled.svg +1 -0
- package/dist/icon/svg/product/searchAD.svg +1 -0
- package/dist/icon/svg/product/shield-filled.svg +1 -0
- package/dist/icon/svg/product/shield.svg +1 -0
- package/dist/icon/svg/product/shop.svg +1 -0
- package/dist/icon/svg/product/shopping.svg +1 -0
- package/dist/icon/svg/product/star-filled.svg +1 -0
- package/dist/icon/svg/product/star.svg +1 -0
- package/dist/icon/svg/product/support-bold.svg +1 -0
- package/dist/icon/svg/product/target.svg +1 -0
- package/dist/icon/svg/product/targeting.svg +1 -0
- package/dist/icon/svg/product/task-filled.svg +1 -0
- package/dist/icon/svg/product/task.svg +1 -0
- package/dist/icon/svg/product/template.svg +1 -0
- package/dist/icon/svg/product/templateBag.svg +1 -0
- package/dist/icon/svg/product/text.svg +1 -0
- package/dist/icon/svg/product/treeStructure.svg +1 -0
- package/dist/icon/svg/product/user-add.svg +3 -0
- package/dist/icon/svg/product/user-circle.svg +1 -0
- package/dist/icon/svg/product/user-edit.svg +1 -0
- package/dist/icon/svg/product/user-pack.svg +1 -0
- package/dist/icon/svg/product/userList.svg +1 -0
- package/dist/icon/svg/product/userPack.svg +1 -0
- package/dist/icon/svg/product/users-bold.svg +1 -0
- package/dist/icon/svg/product/users.svg +1 -0
- package/dist/icon/svg/product/videoBag-filled.svg +1 -0
- package/dist/icon/svg/product/viewMask.svg +1 -0
- package/dist/icon/svg/product/wallet.svg +1 -0
- package/dist/icon/svg/product/wechatBubble-filled.svg +1 -0
- package/dist/icon/svg/product/wechatBubble.svg +1 -0
- package/dist/icon/svg/product/wechatSearch.svg +1 -0
- package/dist/icon/svg/product/writing.svg +1 -0
- package/dist/icon/svg-data.d.ts +479 -0
- package/dist/icon/svg-data.js +481 -0
- package/dist/icon/test-icons.html +122 -0
- package/dist/icon/types.d.ts +3 -0
- package/dist/icon/types.js +5 -0
- package/dist/index.d.ts +52 -0
- package/dist/index.js +57 -0
- package/dist/input/index.d.ts +82 -0
- package/dist/input/index.js +451 -0
- package/dist/input/style/index.css +244 -0
- package/dist/input/style/index.d.ts +2 -0
- package/dist/input/style/index.js +2 -0
- package/dist/input-number/index.d.ts +41 -0
- package/dist/input-number/index.js +431 -0
- package/dist/input-number/style/index.css +65 -0
- package/dist/input-number/style/index.d.ts +2 -0
- package/dist/input-number/style/index.js +2 -0
- package/dist/input-otp/index.d.ts +71 -0
- package/dist/input-otp/index.js +87 -0
- package/dist/input-otp/style/index.css +110 -0
- package/dist/input-otp/style/index.d.ts +2 -0
- package/dist/input-otp/style/index.js +2 -0
- package/dist/layout/index.d.ts +3 -0
- package/dist/layout/index.js +3 -0
- package/dist/layout/layout.d.ts +32 -0
- package/dist/layout/layout.js +203 -0
- package/dist/layout/mp-layout.d.ts +68 -0
- package/dist/layout/mp-layout.js +204 -0
- package/dist/layout/style/index.css +464 -0
- package/dist/layout/style/index.d.ts +2 -0
- package/dist/layout/style/index.js +2 -0
- package/dist/link/index.d.ts +37 -0
- package/dist/link/index.js +46 -0
- package/dist/link/style/index.css +39 -0
- package/dist/link/style/index.d.ts +2 -0
- package/dist/link/style/index.js +2 -0
- package/dist/loading/index.d.ts +11 -0
- package/dist/loading/index.js +46 -0
- package/dist/loading/style/index.css +84 -0
- package/dist/loading/style/index.d.ts +2 -0
- package/dist/loading/style/index.js +2 -0
- package/dist/message/MessageBase.d.ts +86 -0
- package/dist/message/MessageBase.js +395 -0
- package/dist/message/MessageReact16.d.ts +2 -0
- package/dist/message/MessageReact16.js +86 -0
- package/dist/message/MessageReact18.d.ts +2 -0
- package/dist/message/MessageReact18.js +98 -0
- package/dist/message/index.d.ts +3 -0
- package/dist/message/index.js +7 -0
- package/dist/message/style/index.css +121 -0
- package/dist/message/style/index.d.ts +2 -0
- package/dist/message/style/index.js +2 -0
- package/dist/modal-base/gap.d.ts +14 -0
- package/dist/modal-base/gap.js +31 -0
- package/dist/modal-base/index.d.ts +26 -0
- package/dist/modal-base/index.js +114 -0
- package/dist/number-flow/index.d.ts +13 -0
- package/dist/number-flow/index.js +25 -0
- package/dist/number-flow/style/index.css +1 -0
- package/dist/number-flow/style/index.d.ts +2 -0
- package/dist/number-flow/style/index.js +2 -0
- package/dist/pagination/index.d.ts +63 -0
- package/dist/pagination/index.js +424 -0
- package/dist/pagination/style/index.css +135 -0
- package/dist/pagination/style/index.d.ts +2 -0
- package/dist/pagination/style/index.js +2 -0
- package/dist/pop-base/index.d.ts +143 -0
- package/dist/pop-base/index.js +381 -0
- package/dist/pop-base/mergeProps.d.ts +37 -0
- package/dist/pop-base/mergeProps.js +144 -0
- package/dist/pop-base/style/index.css +123 -0
- package/dist/pop-base/style/index.d.ts +2 -0
- package/dist/pop-base/style/index.js +2 -0
- package/dist/pop-base/useForkRef.d.ts +5 -0
- package/dist/pop-base/useForkRef.js +52 -0
- package/dist/popover/index.d.ts +4 -0
- package/dist/popover/index.js +9 -0
- package/dist/radio/index.d.ts +35 -0
- package/dist/radio/index.js +77 -0
- package/dist/radio/primitive.d.ts +5 -0
- package/dist/radio/primitive.js +28 -0
- package/dist/radio/style/index.css +224 -0
- package/dist/radio/style/index.d.ts +2 -0
- package/dist/radio/style/index.js +2 -0
- package/dist/scroll-area/index.d.ts +29 -0
- package/dist/scroll-area/index.js +118 -0
- package/dist/scroll-area/style/index.css +107 -0
- package/dist/scroll-area/style/index.d.ts +2 -0
- package/dist/scroll-area/style/index.js +2 -0
- package/dist/select/index.d.ts +86 -0
- package/dist/select/index.js +275 -0
- package/dist/select/style/index.css +1473 -0
- package/dist/select/style/index.d.ts +2 -0
- package/dist/select/style/index.js +2 -0
- package/dist/select/useIcons.d.ts +25 -0
- package/dist/select/useIcons.js +80 -0
- package/dist/select/utils.d.ts +9 -0
- package/dist/select/utils.js +40 -0
- package/dist/slider/index.d.ts +69 -0
- package/dist/slider/index.js +264 -0
- package/dist/slider/style/index.css +210 -0
- package/dist/slider/style/index.d.ts +2 -0
- package/dist/slider/style/index.js +2 -0
- package/dist/style/base.css +296 -0
- package/dist/style/index.d.ts +7 -0
- package/dist/style/index.js +18 -0
- package/dist/style/theme-adui.css +352 -0
- package/dist/switch/index.d.ts +12 -0
- package/dist/switch/index.js +55 -0
- package/dist/switch/style/index.css +149 -0
- package/dist/switch/style/index.d.ts +2 -0
- package/dist/switch/style/index.js +2 -0
- package/dist/table/TableCellContent.d.ts +20 -0
- package/dist/table/TableCellContent.js +82 -0
- package/dist/table/index.d.ts +97 -0
- package/dist/table/index.js +796 -0
- package/dist/table/style/index.css +301 -0
- package/dist/table/style/index.d.ts +2 -0
- package/dist/table/style/index.js +2 -0
- package/dist/table/useSelection.d.ts +13 -0
- package/dist/table/useSelection.js +268 -0
- package/dist/tabs/index.d.ts +51 -0
- package/dist/tabs/index.js +697 -0
- package/dist/tabs/style/index.css +305 -0
- package/dist/tabs/style/index.d.ts +2 -0
- package/dist/tabs/style/index.js +2 -0
- package/dist/text-swap/index.d.ts +58 -0
- package/dist/text-swap/index.js +280 -0
- package/dist/text-swap/style/index.css +29 -0
- package/dist/text-swap/style/index.d.ts +2 -0
- package/dist/text-swap/style/index.js +2 -0
- package/dist/time-picker/index.d.ts +67 -0
- package/dist/time-picker/index.js +945 -0
- package/dist/time-picker/style/index.css +153 -0
- package/dist/time-picker/style/index.d.ts +2 -0
- package/dist/time-picker/style/index.js +2 -0
- package/dist/tooltip/index.d.ts +10 -0
- package/dist/tooltip/index.js +178 -0
- package/dist/tree-select/index.d.ts +25 -0
- package/dist/tree-select/index.js +140 -0
- package/dist/tree-select/style/index.css +180 -0
- package/dist/tree-select/style/index.d.ts +1 -0
- package/dist/tree-select/style/index.js +1 -0
- package/dist/virtual-list/index.d.ts +98 -0
- package/dist/virtual-list/index.js +56 -0
- package/dist/virtual-list/style/index.css +9 -0
- package/dist/virtual-list/style/index.d.ts +2 -0
- package/dist/virtual-list/style/index.js +2 -0
- package/package.json +132 -0
|
@@ -0,0 +1,84 @@
|
|
|
1
|
+
html {
|
|
2
|
+
--odn-loading-small-linear-width: 80px;
|
|
3
|
+
--odn-loading-small-linear-height: 2px;
|
|
4
|
+
--odn-loading-medium-linear-width: 120px;
|
|
5
|
+
--odn-loading-medium-linear-height: 3px;
|
|
6
|
+
--odn-loading-large-linear-width: 160px;
|
|
7
|
+
--odn-loading-large-linear-height: 4px;
|
|
8
|
+
--odn-loading-light-icon-color: var(--odn-color-blue-6);
|
|
9
|
+
--odn-loading-light-tip-color: var(--odn-color-black-9);
|
|
10
|
+
--odn-loading-light-linear-color: var(--odn-color-blue-6);
|
|
11
|
+
--odn-loading-dark-bg: rgba(0, 0, 0, 65%);
|
|
12
|
+
--odn-loading-dark-padding: 12px 16px;
|
|
13
|
+
--odn-loading-dark-border-radius: 8px;
|
|
14
|
+
--odn-loading-dark-icon-color: var(--odn-color-white);
|
|
15
|
+
--odn-loading-dark-tip-color: var(--odn-color-white);
|
|
16
|
+
--odn-loading-dark-linear-color: var(--odn-color-white);
|
|
17
|
+
--odn-loading-tip-font-size: 12px;
|
|
18
|
+
--odn-loading-tip-gap: 6px;
|
|
19
|
+
}
|
|
20
|
+
|
|
21
|
+
@layer components {
|
|
22
|
+
[data-odn-loading] {
|
|
23
|
+
display: inline-flex;
|
|
24
|
+
flex-direction: column;
|
|
25
|
+
align-items: center;
|
|
26
|
+
gap: var(--odn-loading-tip-gap);
|
|
27
|
+
}
|
|
28
|
+
[data-odn-loading][data-odn-loading-tip-position=right] {
|
|
29
|
+
flex-direction: row;
|
|
30
|
+
}
|
|
31
|
+
[data-odn-loading][data-odn-loading-theme=light] [data-odn-loading-icon] {
|
|
32
|
+
color: var(--odn-loading-light-icon-color);
|
|
33
|
+
}
|
|
34
|
+
[data-odn-loading][data-odn-loading-theme=light] [data-odn-loading-linear] {
|
|
35
|
+
background-image: linear-gradient(90deg, color-mix(in srgb, var(--odn-loading-light-linear-color) 5%, transparent) 0%, var(--odn-loading-light-linear-color) 50%, color-mix(in srgb, var(--odn-loading-light-linear-color) 5%, transparent) 100%);
|
|
36
|
+
}
|
|
37
|
+
[data-odn-loading][data-odn-loading-theme=light] [data-odn-loading-tip] {
|
|
38
|
+
color: var(--odn-loading-light-tip-color);
|
|
39
|
+
}
|
|
40
|
+
[data-odn-loading][data-odn-loading-theme=dark] {
|
|
41
|
+
background: var(--odn-loading-dark-bg);
|
|
42
|
+
padding: var(--odn-loading-dark-padding);
|
|
43
|
+
border-radius: var(--odn-loading-dark-border-radius);
|
|
44
|
+
}
|
|
45
|
+
[data-odn-loading][data-odn-loading-theme=dark] [data-odn-loading-icon] {
|
|
46
|
+
color: var(--odn-loading-dark-icon-color);
|
|
47
|
+
}
|
|
48
|
+
[data-odn-loading][data-odn-loading-theme=dark] [data-odn-loading-linear] {
|
|
49
|
+
background-image: linear-gradient(90deg, color-mix(in srgb, var(--odn-loading-dark-linear-color) 5%, transparent) 0%, var(--odn-loading-dark-linear-color) 50%, color-mix(in srgb, var(--odn-loading-dark-linear-color) 5%, transparent) 100%);
|
|
50
|
+
}
|
|
51
|
+
[data-odn-loading][data-odn-loading-theme=dark] [data-odn-loading-tip] {
|
|
52
|
+
color: var(--odn-loading-dark-tip-color);
|
|
53
|
+
}
|
|
54
|
+
[data-odn-loading-size=small][data-odn-loading-type=linear] [data-odn-loading-linear] {
|
|
55
|
+
width: var(--odn-loading-small-linear-width);
|
|
56
|
+
height: var(--odn-loading-small-linear-height);
|
|
57
|
+
}
|
|
58
|
+
[data-odn-loading-size=medium][data-odn-loading-type=linear] [data-odn-loading-linear] {
|
|
59
|
+
width: var(--odn-loading-medium-linear-width);
|
|
60
|
+
height: var(--odn-loading-medium-linear-height);
|
|
61
|
+
}
|
|
62
|
+
[data-odn-loading-size=large][data-odn-loading-type=linear] [data-odn-loading-linear] {
|
|
63
|
+
width: var(--odn-loading-large-linear-width);
|
|
64
|
+
height: var(--odn-loading-large-linear-height);
|
|
65
|
+
}
|
|
66
|
+
[data-odn-loading-tip] {
|
|
67
|
+
font-size: var(--odn-loading-tip-font-size);
|
|
68
|
+
line-height: 1.5;
|
|
69
|
+
white-space: nowrap;
|
|
70
|
+
}
|
|
71
|
+
[data-odn-loading-linear] {
|
|
72
|
+
border-radius: 999px;
|
|
73
|
+
background-size: 200% 100%;
|
|
74
|
+
animation: odn-loading-linear 2s ease-in-out infinite;
|
|
75
|
+
}
|
|
76
|
+
@keyframes odn-loading-linear {
|
|
77
|
+
0% {
|
|
78
|
+
background-position: 200% 0;
|
|
79
|
+
}
|
|
80
|
+
100% {
|
|
81
|
+
background-position: -200% 0;
|
|
82
|
+
}
|
|
83
|
+
}
|
|
84
|
+
}
|
|
@@ -0,0 +1,86 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
import './style';
|
|
3
|
+
export interface MessageProps {
|
|
4
|
+
/**
|
|
5
|
+
* @description 类名
|
|
6
|
+
*/
|
|
7
|
+
className?: string;
|
|
8
|
+
/**
|
|
9
|
+
* @description 样式
|
|
10
|
+
*/
|
|
11
|
+
style?: React.CSSProperties;
|
|
12
|
+
/**
|
|
13
|
+
* @description 是否显示关闭按钮,可以结合 duration 0 来只点击关闭
|
|
14
|
+
*/
|
|
15
|
+
closable?: boolean;
|
|
16
|
+
/**
|
|
17
|
+
* @description 内容
|
|
18
|
+
*/
|
|
19
|
+
content: React.ReactNode;
|
|
20
|
+
/**
|
|
21
|
+
* @description 持续时间
|
|
22
|
+
*/
|
|
23
|
+
duration?: number;
|
|
24
|
+
/**
|
|
25
|
+
* @description 获取容器,默认到 document.body
|
|
26
|
+
*/
|
|
27
|
+
getContainer?: () => HTMLElement;
|
|
28
|
+
/**
|
|
29
|
+
* @description 类型
|
|
30
|
+
*/
|
|
31
|
+
intent?: MessageIntent;
|
|
32
|
+
/**
|
|
33
|
+
* @description 关闭回调
|
|
34
|
+
*/
|
|
35
|
+
onClose?: () => void;
|
|
36
|
+
/**
|
|
37
|
+
* @description 鼠标进入回调
|
|
38
|
+
*/
|
|
39
|
+
onMouseEnter?: () => void;
|
|
40
|
+
/**
|
|
41
|
+
* @description 鼠标离开回调
|
|
42
|
+
*/
|
|
43
|
+
onMouseLeave?: () => void;
|
|
44
|
+
/**
|
|
45
|
+
* @description 是否可折叠
|
|
46
|
+
*/
|
|
47
|
+
collapsible?: boolean;
|
|
48
|
+
/**
|
|
49
|
+
* @description 是否可折叠
|
|
50
|
+
*/
|
|
51
|
+
sameCollapsible?: boolean;
|
|
52
|
+
}
|
|
53
|
+
type MessageFunc = (config: MessageProps | string) => void;
|
|
54
|
+
export type MessageIntent = 'info' | 'success' | 'warning' | 'danger' | 'error';
|
|
55
|
+
export interface Message extends React.ForwardRefExoticComponent<MessageProps & React.RefAttributes<HTMLDivElement>> {
|
|
56
|
+
info: MessageFunc;
|
|
57
|
+
success: MessageFunc;
|
|
58
|
+
warning: MessageFunc;
|
|
59
|
+
danger: MessageFunc;
|
|
60
|
+
error: MessageFunc;
|
|
61
|
+
}
|
|
62
|
+
export interface odnMessageState {
|
|
63
|
+
collapsed: boolean;
|
|
64
|
+
collapsible: boolean;
|
|
65
|
+
sameCollapsible: boolean;
|
|
66
|
+
sameCollapsed: boolean;
|
|
67
|
+
messages: {
|
|
68
|
+
id: string;
|
|
69
|
+
intent: MessageIntent;
|
|
70
|
+
}[];
|
|
71
|
+
}
|
|
72
|
+
declare global {
|
|
73
|
+
interface Window {
|
|
74
|
+
odnMessageState: odnMessageState;
|
|
75
|
+
}
|
|
76
|
+
}
|
|
77
|
+
export declare const updateStyles: () => void;
|
|
78
|
+
export declare const Message: Message;
|
|
79
|
+
export declare const createNewInstance: (renderer: {
|
|
80
|
+
render: (element: React.ReactElement, container: HTMLElement) => void;
|
|
81
|
+
unmount: (container: HTMLElement) => void;
|
|
82
|
+
}) => (props: MessageProps) => {
|
|
83
|
+
destroy: () => void;
|
|
84
|
+
};
|
|
85
|
+
export declare const addStaticMethods: (MessageComponent: any) => void;
|
|
86
|
+
export {};
|
|
@@ -0,0 +1,395 @@
|
|
|
1
|
+
'use client';
|
|
2
|
+
|
|
3
|
+
function _typeof(o) { "@babel/helpers - typeof"; return _typeof = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function (o) { return typeof o; } : function (o) { return o && "function" == typeof Symbol && o.constructor === Symbol && o !== Symbol.prototype ? "symbol" : typeof o; }, _typeof(o); }
|
|
4
|
+
var _excluded = ["className", "style", "closable", "content", "duration", "getContainer", "intent", "onClose", "onMouseEnter", "onMouseLeave"],
|
|
5
|
+
_excluded2 = ["onClose", "getContainer", "intent", "collapsible", "sameCollapsible"];
|
|
6
|
+
function ownKeys(e, r) { var t = Object.keys(e); if (Object.getOwnPropertySymbols) { var o = Object.getOwnPropertySymbols(e); r && (o = o.filter(function (r) { return Object.getOwnPropertyDescriptor(e, r).enumerable; })), t.push.apply(t, o); } return t; }
|
|
7
|
+
function _objectSpread(e) { for (var r = 1; r < arguments.length; r++) { var t = null != arguments[r] ? arguments[r] : {}; r % 2 ? ownKeys(Object(t), !0).forEach(function (r) { _defineProperty(e, r, t[r]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(e, Object.getOwnPropertyDescriptors(t)) : ownKeys(Object(t)).forEach(function (r) { Object.defineProperty(e, r, Object.getOwnPropertyDescriptor(t, r)); }); } return e; }
|
|
8
|
+
function _defineProperty(obj, key, value) { key = _toPropertyKey(key); if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; }
|
|
9
|
+
function _toPropertyKey(t) { var i = _toPrimitive(t, "string"); return "symbol" == _typeof(i) ? i : String(i); }
|
|
10
|
+
function _toPrimitive(t, r) { if ("object" != _typeof(t) || !t) return t; var e = t[Symbol.toPrimitive]; if (void 0 !== e) { var i = e.call(t, r || "default"); if ("object" != _typeof(i)) return i; throw new TypeError("@@toPrimitive must return a primitive value."); } return ("string" === r ? String : Number)(t); }
|
|
11
|
+
function _toConsumableArray(arr) { return _arrayWithoutHoles(arr) || _iterableToArray(arr) || _unsupportedIterableToArray(arr) || _nonIterableSpread(); }
|
|
12
|
+
function _nonIterableSpread() { throw new TypeError("Invalid attempt to spread non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method."); }
|
|
13
|
+
function _unsupportedIterableToArray(o, minLen) { if (!o) return; if (typeof o === "string") return _arrayLikeToArray(o, minLen); var n = Object.prototype.toString.call(o).slice(8, -1); if (n === "Object" && o.constructor) n = o.constructor.name; if (n === "Map" || n === "Set") return Array.from(o); if (n === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)) return _arrayLikeToArray(o, minLen); }
|
|
14
|
+
function _iterableToArray(iter) { if (typeof Symbol !== "undefined" && iter[Symbol.iterator] != null || iter["@@iterator"] != null) return Array.from(iter); }
|
|
15
|
+
function _arrayWithoutHoles(arr) { if (Array.isArray(arr)) return _arrayLikeToArray(arr); }
|
|
16
|
+
function _arrayLikeToArray(arr, len) { if (len == null || len > arr.length) len = arr.length; for (var i = 0, arr2 = new Array(len); i < len; i++) arr2[i] = arr[i]; return arr2; }
|
|
17
|
+
function _extends() { _extends = Object.assign ? Object.assign.bind() : function (target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { target[key] = source[key]; } } } return target; }; return _extends.apply(this, arguments); }
|
|
18
|
+
function _objectWithoutProperties(source, excluded) { if (source == null) return {}; var target = _objectWithoutPropertiesLoose(source, excluded); var key, i; if (Object.getOwnPropertySymbols) { var sourceSymbolKeys = Object.getOwnPropertySymbols(source); for (i = 0; i < sourceSymbolKeys.length; i++) { key = sourceSymbolKeys[i]; if (excluded.indexOf(key) >= 0) continue; if (!Object.prototype.propertyIsEnumerable.call(source, key)) continue; target[key] = source[key]; } } return target; }
|
|
19
|
+
function _objectWithoutPropertiesLoose(source, excluded) { if (source == null) return {}; var target = {}; var sourceKeys = Object.keys(source); var key, i; for (i = 0; i < sourceKeys.length; i++) { key = sourceKeys[i]; if (excluded.indexOf(key) >= 0) continue; target[key] = source[key]; } return target; }
|
|
20
|
+
import React, { forwardRef, useEffect, useImperativeHandle, useRef } from 'react';
|
|
21
|
+
import Icon from "../icon";
|
|
22
|
+
import "./style";
|
|
23
|
+
var INTENTS = ['info', 'success', 'warning', 'danger', 'error'];
|
|
24
|
+
var defaultProps = {
|
|
25
|
+
className: undefined,
|
|
26
|
+
style: {},
|
|
27
|
+
closable: false,
|
|
28
|
+
content: undefined,
|
|
29
|
+
duration: 3,
|
|
30
|
+
getContainer: function getContainer() {
|
|
31
|
+
return document.body;
|
|
32
|
+
},
|
|
33
|
+
intent: 'info',
|
|
34
|
+
onClose: undefined
|
|
35
|
+
};
|
|
36
|
+
|
|
37
|
+
// 更新样式的核心函数
|
|
38
|
+
export var updateStyles = function updateStyles() {
|
|
39
|
+
// 拿到 html 上的 --odn-message-gap 的值
|
|
40
|
+
var messageGapStr = getComputedStyle(document.documentElement).getPropertyValue('--odn-message-gap');
|
|
41
|
+
var messageGap = parseInt(messageGapStr, 10) || 14;
|
|
42
|
+
var messageHeightStr = getComputedStyle(document.documentElement).getPropertyValue('--odn-message-height');
|
|
43
|
+
var messageHeight = parseInt(messageHeightStr, 10) || 54;
|
|
44
|
+
setTimeout(function () {
|
|
45
|
+
var _window$odnMessageSta = window.odnMessageState,
|
|
46
|
+
messages = _window$odnMessageSta.messages,
|
|
47
|
+
collapsed = _window$odnMessageSta.collapsed,
|
|
48
|
+
sameCollapsed = _window$odnMessageSta.sameCollapsed;
|
|
49
|
+
if (sameCollapsed) {
|
|
50
|
+
// 倒着遍历,将相同 intent 的 message 放在一起,构成一个二级数组
|
|
51
|
+
var messagesIntented = [];
|
|
52
|
+
var intentGroups = new Map();
|
|
53
|
+
|
|
54
|
+
// 先按 intent 分组
|
|
55
|
+
messages.forEach(function (message) {
|
|
56
|
+
var _intentGroups$get;
|
|
57
|
+
if (!intentGroups.has(message.intent)) {
|
|
58
|
+
intentGroups.set(message.intent, []);
|
|
59
|
+
}
|
|
60
|
+
(_intentGroups$get = intentGroups.get(message.intent)) === null || _intentGroups$get === void 0 || _intentGroups$get.push(message);
|
|
61
|
+
});
|
|
62
|
+
|
|
63
|
+
// 按照原始顺序将分组后的消息放入数组
|
|
64
|
+
var seenIntents = new Set();
|
|
65
|
+
messages.forEach(function (message) {
|
|
66
|
+
if (!seenIntents.has(message.intent)) {
|
|
67
|
+
seenIntents.add(message.intent);
|
|
68
|
+
var group = intentGroups.get(message.intent);
|
|
69
|
+
if (group) {
|
|
70
|
+
messagesIntented.push(group);
|
|
71
|
+
}
|
|
72
|
+
}
|
|
73
|
+
});
|
|
74
|
+
|
|
75
|
+
// 计算每个组的累计偏移值
|
|
76
|
+
var groupOffsets = messagesIntented.map(function (group, index) {
|
|
77
|
+
var offset = 0;
|
|
78
|
+
// 从当前组往后计算所有组的偏移值,只考虑每组最后三个消息
|
|
79
|
+
for (var i = index + 1; i < messagesIntented.length; i++) {
|
|
80
|
+
var nextGroup = messagesIntented[i];
|
|
81
|
+
var visibleCount = Math.min(3, nextGroup.length); // 最多只考虑三个消息
|
|
82
|
+
if (visibleCount === 1) {
|
|
83
|
+
offset += messageGap + messageHeight;
|
|
84
|
+
} else {
|
|
85
|
+
offset += messageGap + messageHeight + 7 * (visibleCount - 1);
|
|
86
|
+
}
|
|
87
|
+
}
|
|
88
|
+
return offset;
|
|
89
|
+
});
|
|
90
|
+
messagesIntented.forEach(function (messages, groupIndex) {
|
|
91
|
+
messages.forEach(function (_ref, index) {
|
|
92
|
+
var id = _ref.id;
|
|
93
|
+
var message = document.querySelector("[data-odn-message-container][data-id=\"".concat(id, "\"]"));
|
|
94
|
+
if (sameCollapsed) {
|
|
95
|
+
// 每组中最后三个消息显示,其他的隐藏
|
|
96
|
+
var visible = index >= messages.length - 3;
|
|
97
|
+
message.style.opacity = visible ? '1' : '0';
|
|
98
|
+
message.style.visibility = visible ? 'visible' : 'hidden';
|
|
99
|
+
|
|
100
|
+
// 计算当前消息的偏移值
|
|
101
|
+
var groupOffset = groupOffsets[groupIndex];
|
|
102
|
+
var messageOffset = messageGap * Math.min(2, messages.length - 1 - index); // 最多只考虑三个消息的偏移
|
|
103
|
+
var scale = 1 - 0.05 * Math.min(2, messages.length - 1 - index); // 最多只考虑三个消息的缩放
|
|
104
|
+
|
|
105
|
+
message.style.transform = "translate3d(0, ".concat(groupOffset + messageOffset, "px, 0) scale(").concat(scale, ")");
|
|
106
|
+
}
|
|
107
|
+
});
|
|
108
|
+
});
|
|
109
|
+
} else {
|
|
110
|
+
messages.forEach(function (_ref2, index) {
|
|
111
|
+
var id = _ref2.id;
|
|
112
|
+
var message = document.querySelector("[data-odn-message-container][data-id=\"".concat(id, "\"]"));
|
|
113
|
+
var visible = index >= messages.length - 3;
|
|
114
|
+
message.style.opacity = visible ? '1' : '0';
|
|
115
|
+
message.style.visibility = visible ? 'visible' : 'hidden';
|
|
116
|
+
if (collapsed) {
|
|
117
|
+
message.style.transform = "translate3d(0, ".concat(messageGap * (messages.length - 1 - index), "px, 0) scale(").concat(1 - 0.05 * (messages.length - 1 - index), ")");
|
|
118
|
+
} else {
|
|
119
|
+
message.style.transform = "translate3d(0, ".concat((messageGap + messageHeight) * (messages.length - 1 - index), "px, 0)");
|
|
120
|
+
}
|
|
121
|
+
});
|
|
122
|
+
}
|
|
123
|
+
}, 50);
|
|
124
|
+
};
|
|
125
|
+
export var Message = /*#__PURE__*/forwardRef(function (_ref3, ref) {
|
|
126
|
+
var _ref3$className = _ref3.className,
|
|
127
|
+
className = _ref3$className === void 0 ? defaultProps.className : _ref3$className,
|
|
128
|
+
_ref3$style = _ref3.style,
|
|
129
|
+
style = _ref3$style === void 0 ? defaultProps.style : _ref3$style,
|
|
130
|
+
_ref3$closable = _ref3.closable,
|
|
131
|
+
closable = _ref3$closable === void 0 ? defaultProps.closable : _ref3$closable,
|
|
132
|
+
_ref3$content = _ref3.content,
|
|
133
|
+
content = _ref3$content === void 0 ? defaultProps.content : _ref3$content,
|
|
134
|
+
_ref3$duration = _ref3.duration,
|
|
135
|
+
duration = _ref3$duration === void 0 ? defaultProps.duration : _ref3$duration,
|
|
136
|
+
_ref3$getContainer = _ref3.getContainer,
|
|
137
|
+
getContainer = _ref3$getContainer === void 0 ? defaultProps.getContainer : _ref3$getContainer,
|
|
138
|
+
_ref3$intent = _ref3.intent,
|
|
139
|
+
intentProp = _ref3$intent === void 0 ? defaultProps.intent : _ref3$intent,
|
|
140
|
+
_ref3$onClose = _ref3.onClose,
|
|
141
|
+
onClose = _ref3$onClose === void 0 ? defaultProps.onClose : _ref3$onClose,
|
|
142
|
+
_ref3$onMouseEnter = _ref3.onMouseEnter,
|
|
143
|
+
onMouseEnter = _ref3$onMouseEnter === void 0 ? defaultProps.onMouseEnter : _ref3$onMouseEnter,
|
|
144
|
+
_ref3$onMouseLeave = _ref3.onMouseLeave,
|
|
145
|
+
onMouseLeave = _ref3$onMouseLeave === void 0 ? defaultProps.onMouseLeave : _ref3$onMouseLeave,
|
|
146
|
+
otherProps = _objectWithoutProperties(_ref3, _excluded);
|
|
147
|
+
var intent = INTENTS.includes(intentProp) ? intentProp : defaultProps.intent;
|
|
148
|
+
var domRef = useRef(null);
|
|
149
|
+
var timer;
|
|
150
|
+
var clearCloseTimer = function clearCloseTimer() {
|
|
151
|
+
if (timer) {
|
|
152
|
+
clearTimeout(timer);
|
|
153
|
+
timer = null;
|
|
154
|
+
}
|
|
155
|
+
};
|
|
156
|
+
var setCloseTimer = function setCloseTimer() {
|
|
157
|
+
if (duration) {
|
|
158
|
+
timer = setTimeout(function () {
|
|
159
|
+
if (onClose) {
|
|
160
|
+
onClose();
|
|
161
|
+
}
|
|
162
|
+
}, duration * 1000);
|
|
163
|
+
}
|
|
164
|
+
};
|
|
165
|
+
var handleMouseEnter = function handleMouseEnter() {
|
|
166
|
+
clearCloseTimer();
|
|
167
|
+
if (window.odnMessageState.collapsible) {
|
|
168
|
+
window.odnMessageState.collapsed = false;
|
|
169
|
+
updateStyles();
|
|
170
|
+
}
|
|
171
|
+
if (window.odnMessageState.sameCollapsible) {
|
|
172
|
+
window.odnMessageState.sameCollapsed = false;
|
|
173
|
+
updateStyles();
|
|
174
|
+
}
|
|
175
|
+
if (onMouseEnter) {
|
|
176
|
+
onMouseEnter();
|
|
177
|
+
}
|
|
178
|
+
};
|
|
179
|
+
var handleMouseLeave = function handleMouseLeave() {
|
|
180
|
+
setCloseTimer();
|
|
181
|
+
if (window.odnMessageState.collapsible) {
|
|
182
|
+
window.odnMessageState.collapsed = true;
|
|
183
|
+
updateStyles();
|
|
184
|
+
}
|
|
185
|
+
if (window.odnMessageState.sameCollapsible) {
|
|
186
|
+
window.odnMessageState.sameCollapsed = true;
|
|
187
|
+
updateStyles();
|
|
188
|
+
}
|
|
189
|
+
if (onMouseLeave) {
|
|
190
|
+
onMouseLeave();
|
|
191
|
+
}
|
|
192
|
+
};
|
|
193
|
+
useEffect(function () {
|
|
194
|
+
setCloseTimer();
|
|
195
|
+
return function () {
|
|
196
|
+
clearCloseTimer();
|
|
197
|
+
if (window.odnMessageState.messages) {
|
|
198
|
+
window.odnMessageState.messages = window.odnMessageState.messages.filter(function (message) {
|
|
199
|
+
var _domRef$current;
|
|
200
|
+
return message.id !== ((_domRef$current = domRef.current) === null || _domRef$current === void 0 ? void 0 : _domRef$current.dataset.id);
|
|
201
|
+
});
|
|
202
|
+
}
|
|
203
|
+
};
|
|
204
|
+
}, []);
|
|
205
|
+
useImperativeHandle(ref, function () {
|
|
206
|
+
return {
|
|
207
|
+
close: function close() {
|
|
208
|
+
if (onClose) {
|
|
209
|
+
onClose();
|
|
210
|
+
}
|
|
211
|
+
},
|
|
212
|
+
getDomNode: function getDomNode() {
|
|
213
|
+
return domRef.current;
|
|
214
|
+
}
|
|
215
|
+
};
|
|
216
|
+
});
|
|
217
|
+
var iconMap = {
|
|
218
|
+
info: 'info-circle-filled',
|
|
219
|
+
danger: 'cancel-circle-filled',
|
|
220
|
+
warning: 'alert-circle-filled',
|
|
221
|
+
success: 'check-circle-filled',
|
|
222
|
+
error: 'cancel-circle-filled'
|
|
223
|
+
};
|
|
224
|
+
return /*#__PURE__*/React.createElement("div", _extends({
|
|
225
|
+
"data-odn-message": true,
|
|
226
|
+
"data-odn-message-intent": intent,
|
|
227
|
+
onMouseEnter: handleMouseEnter,
|
|
228
|
+
onMouseLeave: handleMouseLeave,
|
|
229
|
+
ref: domRef,
|
|
230
|
+
className: className,
|
|
231
|
+
style: style
|
|
232
|
+
}, otherProps), /*#__PURE__*/React.createElement(Icon, {
|
|
233
|
+
"data-odn-message-prefix-icon": true,
|
|
234
|
+
name: iconMap[intent]
|
|
235
|
+
}), /*#__PURE__*/React.createElement("div", {
|
|
236
|
+
"data-odn-message-content": true
|
|
237
|
+
}, content), closable && /*#__PURE__*/React.createElement("svg", {
|
|
238
|
+
"data-odn-message-close-icon": true,
|
|
239
|
+
viewBox: "0 0 18 18",
|
|
240
|
+
onClick: function onClick() {
|
|
241
|
+
if (onClose) {
|
|
242
|
+
onClose();
|
|
243
|
+
}
|
|
244
|
+
}
|
|
245
|
+
}, /*#__PURE__*/React.createElement("path", {
|
|
246
|
+
d: "M14.1265 4.93709C14.3218 4.74183 14.3218 4.42524 14.1265 4.22998L13.773 3.87643C13.5777 3.68117 13.2611 3.68116 13.0659 3.87643L9.00002 7.94229L4.93416 3.87643C4.7389 3.68117 4.42231 3.68117 4.22705 3.87643L3.8735 4.22998C3.67824 4.42524 3.67824 4.74183 3.8735 4.93709L7.93936 9.00295L3.8735 13.0688C3.67824 13.2641 3.67824 13.5807 3.8735 13.7759L4.22705 14.1295C4.42231 14.3247 4.7389 14.3247 4.93416 14.1295L9.00002 10.0636L13.0659 14.1295C13.2611 14.3247 13.5777 14.3247 13.773 14.1295L14.1265 13.7759C14.3218 13.5807 14.3218 13.2641 14.1265 13.0688L10.0607 9.00295L14.1265 4.93709Z",
|
|
247
|
+
fillRule: "evenodd"
|
|
248
|
+
})));
|
|
249
|
+
});
|
|
250
|
+
|
|
251
|
+
// 通用的 newInstance 逻辑
|
|
252
|
+
export var createNewInstance = function createNewInstance(renderer) {
|
|
253
|
+
return function (props) {
|
|
254
|
+
var onClose = props.onClose,
|
|
255
|
+
getContainer = props.getContainer,
|
|
256
|
+
_props$intent = props.intent,
|
|
257
|
+
intent = _props$intent === void 0 ? 'info' : _props$intent,
|
|
258
|
+
_props$collapsible = props.collapsible,
|
|
259
|
+
collapsible = _props$collapsible === void 0 ? false : _props$collapsible,
|
|
260
|
+
_props$sameCollapsibl = props.sameCollapsible,
|
|
261
|
+
sameCollapsible = _props$sameCollapsibl === void 0 ? false : _props$sameCollapsibl,
|
|
262
|
+
otherProps = _objectWithoutProperties(props, _excluded2);
|
|
263
|
+
var id = Math.random().toString(36).substring(2, 15);
|
|
264
|
+
var container = document.createElement('div');
|
|
265
|
+
container.dataset.odnMessageContainer = 'true';
|
|
266
|
+
container.dataset.odnMessageIntent = intent;
|
|
267
|
+
container.dataset.id = id;
|
|
268
|
+
var dest = getContainer ? getContainer() : document.body;
|
|
269
|
+
var newObj = {
|
|
270
|
+
id: id,
|
|
271
|
+
intent: intent
|
|
272
|
+
};
|
|
273
|
+
if (!window.odnMessageState) {
|
|
274
|
+
window.odnMessageState = {
|
|
275
|
+
collapsible: collapsible,
|
|
276
|
+
sameCollapsible: sameCollapsible,
|
|
277
|
+
collapsed: collapsible,
|
|
278
|
+
sameCollapsed: sameCollapsible,
|
|
279
|
+
messages: [newObj]
|
|
280
|
+
};
|
|
281
|
+
} else {
|
|
282
|
+
var newMessages = _toConsumableArray(window.odnMessageState.messages);
|
|
283
|
+
if (collapsible !== undefined) {
|
|
284
|
+
window.odnMessageState.collapsible = collapsible;
|
|
285
|
+
window.odnMessageState.collapsed = collapsible;
|
|
286
|
+
}
|
|
287
|
+
if (sameCollapsible !== undefined) {
|
|
288
|
+
window.odnMessageState.sameCollapsible = sameCollapsible;
|
|
289
|
+
window.odnMessageState.sameCollapsed = sameCollapsible;
|
|
290
|
+
}
|
|
291
|
+
newMessages.push(newObj);
|
|
292
|
+
if (sameCollapsible) {
|
|
293
|
+
// 如果 sameCollapsible 为 true,则从最后一个往前找,如果碰到相同的 intent,则放在该项之后,如果碰到不同的 intent,则排在刚才所有相同 intent 的后面
|
|
294
|
+
var insertIndex = newMessages.length - 1;
|
|
295
|
+
var foundSameIntent = false;
|
|
296
|
+
var lastSameIntentIndex = -1;
|
|
297
|
+
|
|
298
|
+
// 先找到最后一个相同类型的消息的位置
|
|
299
|
+
for (var i = newMessages.length - 1; i >= 0; i--) {
|
|
300
|
+
if (newMessages[i].intent === intent) {
|
|
301
|
+
lastSameIntentIndex = i;
|
|
302
|
+
foundSameIntent = true;
|
|
303
|
+
} else if (foundSameIntent) {
|
|
304
|
+
// 如果已经找到相同类型的消息,且遇到了不同类型的消息,就停止搜索
|
|
305
|
+
break;
|
|
306
|
+
}
|
|
307
|
+
}
|
|
308
|
+
if (lastSameIntentIndex !== -1) {
|
|
309
|
+
// 如果找到了相同类型的消息,就放在它的后面
|
|
310
|
+
insertIndex = lastSameIntentIndex + 1;
|
|
311
|
+
} else {
|
|
312
|
+
// 如果没有找到相同类型的消息,就放在最后一个位置
|
|
313
|
+
insertIndex = newMessages.length;
|
|
314
|
+
}
|
|
315
|
+
|
|
316
|
+
// 将新消息插入到正确的位置
|
|
317
|
+
newMessages.splice(insertIndex, 0, newObj);
|
|
318
|
+
// 移除之前添加的最后一个元素(因为我们已经把它插入到正确的位置了)
|
|
319
|
+
newMessages.pop();
|
|
320
|
+
|
|
321
|
+
// 重新排序,确保相同类型的消息相邻,且新消息在最后
|
|
322
|
+
var sameIntentMessages = newMessages.filter(function (msg) {
|
|
323
|
+
return msg.intent === intent && msg.id !== newObj.id;
|
|
324
|
+
});
|
|
325
|
+
var otherMessages = newMessages.filter(function (msg) {
|
|
326
|
+
return msg.intent !== intent;
|
|
327
|
+
});
|
|
328
|
+
|
|
329
|
+
// 将相同类型的消息放在一起,新消息在最后
|
|
330
|
+
newMessages.length = 0;
|
|
331
|
+
newMessages.push.apply(newMessages, _toConsumableArray(otherMessages).concat(_toConsumableArray(sameIntentMessages), [newObj]));
|
|
332
|
+
}
|
|
333
|
+
window.odnMessageState.messages = newMessages;
|
|
334
|
+
}
|
|
335
|
+
var instance;
|
|
336
|
+
updateStyles();
|
|
337
|
+
var close = function close() {
|
|
338
|
+
if (onClose) {
|
|
339
|
+
onClose();
|
|
340
|
+
}
|
|
341
|
+
window.odnMessageState.messages = window.odnMessageState.messages.filter(function (message) {
|
|
342
|
+
return message.id !== id;
|
|
343
|
+
});
|
|
344
|
+
container.style.opacity = '0';
|
|
345
|
+
container.style.visibility = 'hidden';
|
|
346
|
+
container.style.transition = '0.15s cubic-bezier(0, 0, 0.2, 1) all';
|
|
347
|
+
updateStyles();
|
|
348
|
+
setTimeout(function () {
|
|
349
|
+
var _container$parentNode;
|
|
350
|
+
renderer.unmount(container);
|
|
351
|
+
(_container$parentNode = container.parentNode) === null || _container$parentNode === void 0 || _container$parentNode.removeChild(container);
|
|
352
|
+
}, 300);
|
|
353
|
+
};
|
|
354
|
+
renderer.render( /*#__PURE__*/React.createElement(Message, _extends({
|
|
355
|
+
ref: function ref(message) {
|
|
356
|
+
instance = message;
|
|
357
|
+
},
|
|
358
|
+
onClose: close,
|
|
359
|
+
intent: intent
|
|
360
|
+
}, otherProps)), container);
|
|
361
|
+
|
|
362
|
+
// 将容器添加到目标元素
|
|
363
|
+
dest.appendChild(container);
|
|
364
|
+
return {
|
|
365
|
+
destroy: function destroy() {
|
|
366
|
+
if (instance) {
|
|
367
|
+
instance.close();
|
|
368
|
+
}
|
|
369
|
+
dest.removeChild(container);
|
|
370
|
+
}
|
|
371
|
+
};
|
|
372
|
+
};
|
|
373
|
+
};
|
|
374
|
+
|
|
375
|
+
// 添加静态方法
|
|
376
|
+
export var addStaticMethods = function addStaticMethods(MessageComponent) {
|
|
377
|
+
INTENTS.forEach(function (intent) {
|
|
378
|
+
MessageComponent[intent] = function (config) {
|
|
379
|
+
var cnfg = {
|
|
380
|
+
intent: intent
|
|
381
|
+
};
|
|
382
|
+
if (typeof config === 'string') {
|
|
383
|
+
cnfg = {
|
|
384
|
+
content: config,
|
|
385
|
+
intent: intent
|
|
386
|
+
};
|
|
387
|
+
} else {
|
|
388
|
+
cnfg = config;
|
|
389
|
+
}
|
|
390
|
+
return MessageComponent.newInstance(_objectSpread(_objectSpread({}, cnfg), {}, {
|
|
391
|
+
intent: intent
|
|
392
|
+
}));
|
|
393
|
+
};
|
|
394
|
+
});
|
|
395
|
+
};
|