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,436 @@
|
|
|
1
|
+
var _excluded = ["size", "disabled", "placeholder", "allowClear", "showSearch", "className", "style", "light", "visible", "onVisibleChange", "onChange", "value", "defaultValue", "suffixIcon", "mode", "options", "optionPopoverProps", "showInnerSearch", "searchValue", "onSearch", "autoClearSearchValue", "searchFilter", "searchRender", "searchLimit", "notFoundContent", "showCheckedStrategy", "displayRender", "dropdownClassName", "dropdownMatchSelectWidth", "separator", "optionRender", "changeOnSelect"];
|
|
2
|
+
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); }
|
|
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
|
+
function _slicedToArray(arr, i) { return _arrayWithHoles(arr) || _iterableToArrayLimit(arr, i) || _unsupportedIterableToArray(arr, i) || _nonIterableRest(); }
|
|
5
|
+
function _nonIterableRest() { throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method."); }
|
|
6
|
+
function _iterableToArrayLimit(r, l) { var t = null == r ? null : "undefined" != typeof Symbol && r[Symbol.iterator] || r["@@iterator"]; if (null != t) { var e, n, i, u, a = [], f = !0, o = !1; try { if (i = (t = t.call(r)).next, 0 === l) { if (Object(t) !== t) return; f = !1; } else for (; !(f = (e = i.call(t)).done) && (a.push(e.value), a.length !== l); f = !0); } catch (r) { o = !0, n = r; } finally { try { if (!f && null != t.return && (u = t.return(), Object(u) !== u)) return; } finally { if (o) throw n; } } return a; } }
|
|
7
|
+
function _arrayWithHoles(arr) { if (Array.isArray(arr)) return arr; }
|
|
8
|
+
function _createForOfIteratorHelper(o, allowArrayLike) { var it = typeof Symbol !== "undefined" && o[Symbol.iterator] || o["@@iterator"]; if (!it) { if (Array.isArray(o) || (it = _unsupportedIterableToArray(o)) || allowArrayLike && o && typeof o.length === "number") { if (it) o = it; var i = 0; var F = function F() {}; return { s: F, n: function n() { if (i >= o.length) return { done: true }; return { done: false, value: o[i++] }; }, e: function (_e) { function e(_x) { return _e.apply(this, arguments); } e.toString = function () { return _e.toString(); }; return e; }(function (e) { throw e; }), f: F }; } throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method."); } var normalCompletion = true, didErr = false, err; return { s: function s() { it = it.call(o); }, n: function n() { var step = it.next(); normalCompletion = step.done; return step; }, e: function (_e2) { function e(_x2) { return _e2.apply(this, arguments); } e.toString = function () { return _e2.toString(); }; return e; }(function (e) { didErr = true; err = e; }), f: function f() { try { if (!normalCompletion && it.return != null) it.return(); } finally { if (didErr) throw err; } } }; }
|
|
9
|
+
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); }
|
|
10
|
+
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; }
|
|
11
|
+
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; }
|
|
12
|
+
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; }
|
|
13
|
+
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; }
|
|
14
|
+
function _toPropertyKey(t) { var i = _toPrimitive(t, "string"); return "symbol" == _typeof(i) ? i : String(i); }
|
|
15
|
+
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); }
|
|
16
|
+
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; }
|
|
17
|
+
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; }
|
|
18
|
+
import clsx from 'clsx';
|
|
19
|
+
import RcCascader from 'rc-cascader';
|
|
20
|
+
import React, { useEffect, useRef, useState } from 'react';
|
|
21
|
+
import Icon from "../icon";
|
|
22
|
+
import "../select/style";
|
|
23
|
+
import useIcons from "../select/useIcons";
|
|
24
|
+
import { highlightKeyword } from "../select/utils";
|
|
25
|
+
import CascaderPanel from "./Panel";
|
|
26
|
+
import "./style";
|
|
27
|
+
import { DEFAULT_FIELD_NAMES, processOptions } from "./utils";
|
|
28
|
+
var SHOW_PARENT = RcCascader.SHOW_PARENT,
|
|
29
|
+
SHOW_CHILD = RcCascader.SHOW_CHILD;
|
|
30
|
+
|
|
31
|
+
// 明确定义 Cascader 组件的类型,避免依赖 rc-cascader 的内部类型路径
|
|
32
|
+
|
|
33
|
+
function CascaderInner(_ref) {
|
|
34
|
+
var _ref$size = _ref.size,
|
|
35
|
+
size = _ref$size === void 0 ? 'medium' : _ref$size,
|
|
36
|
+
_ref$disabled = _ref.disabled,
|
|
37
|
+
disabled = _ref$disabled === void 0 ? false : _ref$disabled,
|
|
38
|
+
_ref$placeholder = _ref.placeholder,
|
|
39
|
+
placeholder = _ref$placeholder === void 0 ? '请选择' : _ref$placeholder,
|
|
40
|
+
_ref$allowClear = _ref.allowClear,
|
|
41
|
+
allowClear = _ref$allowClear === void 0 ? true : _ref$allowClear,
|
|
42
|
+
_ref$showSearch = _ref.showSearch,
|
|
43
|
+
showSearch = _ref$showSearch === void 0 ? false : _ref$showSearch,
|
|
44
|
+
className = _ref.className,
|
|
45
|
+
style = _ref.style,
|
|
46
|
+
_ref$light = _ref.light,
|
|
47
|
+
light = _ref$light === void 0 ? false : _ref$light,
|
|
48
|
+
visibleProp = _ref.visible,
|
|
49
|
+
onVisibleChange = _ref.onVisibleChange,
|
|
50
|
+
onChange = _ref.onChange,
|
|
51
|
+
value = _ref.value,
|
|
52
|
+
defaultValue = _ref.defaultValue,
|
|
53
|
+
_ref$suffixIcon = _ref.suffixIcon,
|
|
54
|
+
suffixIconProp = _ref$suffixIcon === void 0 ? /*#__PURE__*/React.createElement(Icon, {
|
|
55
|
+
name: "down"
|
|
56
|
+
}) : _ref$suffixIcon,
|
|
57
|
+
_ref$mode = _ref.mode,
|
|
58
|
+
mode = _ref$mode === void 0 ? 'single' : _ref$mode,
|
|
59
|
+
options = _ref.options,
|
|
60
|
+
optionPopoverProps = _ref.optionPopoverProps,
|
|
61
|
+
_ref$showInnerSearch = _ref.showInnerSearch,
|
|
62
|
+
showInnerSearch = _ref$showInnerSearch === void 0 ? false : _ref$showInnerSearch,
|
|
63
|
+
searchValueProp = _ref.searchValue,
|
|
64
|
+
_onSearch = _ref.onSearch,
|
|
65
|
+
_ref$autoClearSearchV = _ref.autoClearSearchValue,
|
|
66
|
+
autoClearSearchValue = _ref$autoClearSearchV === void 0 ? true : _ref$autoClearSearchV,
|
|
67
|
+
searchFilter = _ref.searchFilter,
|
|
68
|
+
searchRender = _ref.searchRender,
|
|
69
|
+
_ref$searchLimit = _ref.searchLimit,
|
|
70
|
+
searchLimit = _ref$searchLimit === void 0 ? 1000 : _ref$searchLimit,
|
|
71
|
+
_ref$notFoundContent = _ref.notFoundContent,
|
|
72
|
+
notFoundContent = _ref$notFoundContent === void 0 ? '无匹配结果' : _ref$notFoundContent,
|
|
73
|
+
_ref$showCheckedStrat = _ref.showCheckedStrategy,
|
|
74
|
+
showCheckedStrategy = _ref$showCheckedStrat === void 0 ? 'parent' : _ref$showCheckedStrat,
|
|
75
|
+
_displayRender = _ref.displayRender,
|
|
76
|
+
dropdownClassName = _ref.dropdownClassName,
|
|
77
|
+
_ref$dropdownMatchSel = _ref.dropdownMatchSelectWidth,
|
|
78
|
+
dropdownMatchSelectWidth = _ref$dropdownMatchSel === void 0 ? false : _ref$dropdownMatchSel,
|
|
79
|
+
_ref$separator = _ref.separator,
|
|
80
|
+
separator = _ref$separator === void 0 ? '/' : _ref$separator,
|
|
81
|
+
optionRenderProp = _ref.optionRender,
|
|
82
|
+
changeOnSelectProp = _ref.changeOnSelect,
|
|
83
|
+
restProps = _objectWithoutProperties(_ref, _excluded);
|
|
84
|
+
// 默认 fieldNames.label 为 labelWithPopover,下拉展示带 Popover 的节点,用户传入的 label 保留
|
|
85
|
+
var mergedFieldNames = React.useMemo(function () {
|
|
86
|
+
return _objectSpread(_objectSpread({}, DEFAULT_FIELD_NAMES), restProps.fieldNames);
|
|
87
|
+
}, [restProps.fieldNames]);
|
|
88
|
+
|
|
89
|
+
// 处理 options,确保每个 option 都有 title 字段
|
|
90
|
+
var processedOptions = React.useMemo(function () {
|
|
91
|
+
return processOptions(options, mergedFieldNames, optionPopoverProps);
|
|
92
|
+
}, [options, mergedFieldNames, optionPopoverProps]);
|
|
93
|
+
|
|
94
|
+
// 根据完整路径从 processedOptions 中查找对应的 option 对象
|
|
95
|
+
var resolvePathOptions = React.useCallback(function (fullPath) {
|
|
96
|
+
var result = [];
|
|
97
|
+
var currentOptions = processedOptions;
|
|
98
|
+
var vField = mergedFieldNames.value || 'value';
|
|
99
|
+
var cField = mergedFieldNames.children || 'children';
|
|
100
|
+
var _iterator = _createForOfIteratorHelper(fullPath),
|
|
101
|
+
_step;
|
|
102
|
+
try {
|
|
103
|
+
var _loop = function _loop() {
|
|
104
|
+
var val = _step.value;
|
|
105
|
+
if (!currentOptions) return 0; // break
|
|
106
|
+
var found = currentOptions.find(function (opt) {
|
|
107
|
+
return opt[vField] === val;
|
|
108
|
+
});
|
|
109
|
+
if (found) {
|
|
110
|
+
result.push(found);
|
|
111
|
+
currentOptions = found[cField];
|
|
112
|
+
} else {
|
|
113
|
+
return 0; // break
|
|
114
|
+
}
|
|
115
|
+
},
|
|
116
|
+
_ret;
|
|
117
|
+
for (_iterator.s(); !(_step = _iterator.n()).done;) {
|
|
118
|
+
_ret = _loop();
|
|
119
|
+
if (_ret === 0) break;
|
|
120
|
+
}
|
|
121
|
+
} catch (err) {
|
|
122
|
+
_iterator.e(err);
|
|
123
|
+
} finally {
|
|
124
|
+
_iterator.f();
|
|
125
|
+
}
|
|
126
|
+
return result;
|
|
127
|
+
}, [processedOptions, mergedFieldNames]);
|
|
128
|
+
var prefixCls = 'odn-select';
|
|
129
|
+
var _useIcons = useIcons(_objectSpread(_objectSpread({}, restProps), {}, {
|
|
130
|
+
hasFeedback: false,
|
|
131
|
+
feedbackIcon: undefined,
|
|
132
|
+
showSuffixIcon: !!suffixIconProp,
|
|
133
|
+
multiple: mode === 'multiple',
|
|
134
|
+
prefixCls: prefixCls
|
|
135
|
+
})),
|
|
136
|
+
suffixIcon = _useIcons.suffixIcon,
|
|
137
|
+
removeIcon = _useIcons.removeIcon,
|
|
138
|
+
clearIcon = _useIcons.clearIcon;
|
|
139
|
+
var cascaderClassName = [prefixCls, "".concat(prefixCls, "-").concat(size), disabled && "".concat(prefixCls, "-disabled"), !light && "".concat(prefixCls, "-outlined"), "".concat(prefixCls, "-show-arrow"), showInnerSearch && "".concat(prefixCls, "-show-inner-search"), 'odn-cascader', className].filter(Boolean).join(' ');
|
|
140
|
+
var _useState = useState(visibleProp),
|
|
141
|
+
_useState2 = _slicedToArray(_useState, 2),
|
|
142
|
+
visible = _useState2[0],
|
|
143
|
+
setVisible = _useState2[1];
|
|
144
|
+
var _useState3 = useState(searchValueProp || ''),
|
|
145
|
+
_useState4 = _slicedToArray(_useState3, 2),
|
|
146
|
+
searchValue = _useState4[0],
|
|
147
|
+
setSearchValue = _useState4[1];
|
|
148
|
+
var dropdownSearchInputRef = useRef(null);
|
|
149
|
+
var handleVisibleChange = function handleVisibleChange(bool) {
|
|
150
|
+
if (visibleProp === undefined) {
|
|
151
|
+
setVisible(bool);
|
|
152
|
+
}
|
|
153
|
+
onVisibleChange === null || onVisibleChange === void 0 || onVisibleChange(bool);
|
|
154
|
+
};
|
|
155
|
+
useEffect(function () {
|
|
156
|
+
if (visibleProp !== undefined) {
|
|
157
|
+
setVisible(visibleProp);
|
|
158
|
+
}
|
|
159
|
+
}, [visibleProp]);
|
|
160
|
+
useEffect(function () {
|
|
161
|
+
if (searchValueProp !== undefined) {
|
|
162
|
+
setSearchValue(searchValueProp);
|
|
163
|
+
}
|
|
164
|
+
}, [searchValueProp]);
|
|
165
|
+
useEffect(function () {
|
|
166
|
+
if (visible) {
|
|
167
|
+
setTimeout(function () {
|
|
168
|
+
var _dropdownSearchInputR;
|
|
169
|
+
(_dropdownSearchInputR = dropdownSearchInputRef.current) === null || _dropdownSearchInputR === void 0 || _dropdownSearchInputR.focus();
|
|
170
|
+
}, 150);
|
|
171
|
+
}
|
|
172
|
+
}, [visible]);
|
|
173
|
+
var handleChange = function handleChange(value, selectOptions, e) {
|
|
174
|
+
// 如果 value 是 undefined,传递 null
|
|
175
|
+
if (value === undefined) {
|
|
176
|
+
onChange === null || onChange === void 0 || onChange(null, selectOptions || [], e);
|
|
177
|
+
return;
|
|
178
|
+
}
|
|
179
|
+
if (mode === 'multiple') {
|
|
180
|
+
// 多选模式:处理二维数组
|
|
181
|
+
if (Array.isArray(value) && value.length > 0 && Array.isArray(value[0])) {
|
|
182
|
+
var filteredValue = value.map(function (item) {
|
|
183
|
+
return item.filter(function (v) {
|
|
184
|
+
return v !== null && (typeof v === 'string' || typeof v === 'number');
|
|
185
|
+
});
|
|
186
|
+
});
|
|
187
|
+
onChange === null || onChange === void 0 || onChange(filteredValue, selectOptions || [], e);
|
|
188
|
+
} else {
|
|
189
|
+
onChange === null || onChange === void 0 || onChange(null, selectOptions || [], e);
|
|
190
|
+
}
|
|
191
|
+
} else {
|
|
192
|
+
// 单选模式:处理一维数组
|
|
193
|
+
if (Array.isArray(value) && !Array.isArray(value[0])) {
|
|
194
|
+
var _filteredValue = value.filter(function (v) {
|
|
195
|
+
return v !== null && (typeof v === 'string' || typeof v === 'number');
|
|
196
|
+
});
|
|
197
|
+
onChange === null || onChange === void 0 || onChange(_filteredValue, selectOptions || [], e);
|
|
198
|
+
} else {
|
|
199
|
+
onChange === null || onChange === void 0 || onChange(null, selectOptions || [], e);
|
|
200
|
+
}
|
|
201
|
+
}
|
|
202
|
+
|
|
203
|
+
// 自动清空搜索值
|
|
204
|
+
if (autoClearSearchValue) {
|
|
205
|
+
if (searchValueProp === undefined) {
|
|
206
|
+
setSearchValue('');
|
|
207
|
+
}
|
|
208
|
+
if (_onSearch) {
|
|
209
|
+
_onSearch('');
|
|
210
|
+
}
|
|
211
|
+
}
|
|
212
|
+
};
|
|
213
|
+
|
|
214
|
+
// 单选模式下 pathKey → 带类型的 fullPath 映射,用于事件委托时还原路径
|
|
215
|
+
var pathKeyMap = React.useMemo(function () {
|
|
216
|
+
if (mode !== 'single') return null;
|
|
217
|
+
var SPLIT = '__RC_CASCADER_SPLIT__';
|
|
218
|
+
var map = new Map();
|
|
219
|
+
var traverse = function traverse(opts) {
|
|
220
|
+
if (!opts) return;
|
|
221
|
+
var _iterator2 = _createForOfIteratorHelper(opts),
|
|
222
|
+
_step2;
|
|
223
|
+
try {
|
|
224
|
+
for (_iterator2.s(); !(_step2 = _iterator2.n()).done;) {
|
|
225
|
+
var opt = _step2.value;
|
|
226
|
+
var fullPath = opt.__fullPath__;
|
|
227
|
+
if (fullPath) {
|
|
228
|
+
map.set(fullPath.join(SPLIT), fullPath);
|
|
229
|
+
}
|
|
230
|
+
var cField = mergedFieldNames.children || 'children';
|
|
231
|
+
var children = opt[cField];
|
|
232
|
+
if (children && Array.isArray(children)) traverse(children);
|
|
233
|
+
}
|
|
234
|
+
} catch (err) {
|
|
235
|
+
_iterator2.e(err);
|
|
236
|
+
} finally {
|
|
237
|
+
_iterator2.f();
|
|
238
|
+
}
|
|
239
|
+
};
|
|
240
|
+
traverse(processedOptions);
|
|
241
|
+
return map;
|
|
242
|
+
}, [mode, processedOptions, mergedFieldNames]);
|
|
243
|
+
|
|
244
|
+
// 单选模式下:通过 onClickCapture 在 dropdown 层面拦截点击
|
|
245
|
+
// 点击展开图标区域 → 放行,由 rc-cascader 处理展开
|
|
246
|
+
// 点击其他区域(内容 / padding) → 拦截,手动选中 + 关闭
|
|
247
|
+
var handleSingleSelectCapture = React.useCallback(function (e) {
|
|
248
|
+
if (!pathKeyMap) return;
|
|
249
|
+
var target = e.target;
|
|
250
|
+
var expandIcon = target.closest('.odn-cascader-menu-item-expand-icon');
|
|
251
|
+
var menuItem = target.closest('.odn-cascader-menu-item');
|
|
252
|
+
if (!menuItem || expandIcon) return;
|
|
253
|
+
if (menuItem.classList.contains('odn-cascader-menu-item-disabled')) return;
|
|
254
|
+
if (menuItem.getAttribute('title') === 'divider') return;
|
|
255
|
+
var pathKey = menuItem.getAttribute('data-path-key');
|
|
256
|
+
if (!pathKey) return;
|
|
257
|
+
var fullPath = pathKeyMap.get(pathKey);
|
|
258
|
+
if (!fullPath) return;
|
|
259
|
+
var pathOptions = resolvePathOptions(fullPath);
|
|
260
|
+
var lastOption = pathOptions[pathOptions.length - 1];
|
|
261
|
+
if (!lastOption) return;
|
|
262
|
+
var cField = mergedFieldNames.children || 'children';
|
|
263
|
+
var hasChildren = lastOption[cField] && Array.isArray(lastOption[cField]) && lastOption[cField].length > 0;
|
|
264
|
+
|
|
265
|
+
// 非叶节点仅在 changeOnSelect 时才可点击选中
|
|
266
|
+
if (hasChildren && !changeOnSelectProp) return;
|
|
267
|
+
e.stopPropagation();
|
|
268
|
+
handleChange(fullPath, pathOptions, e);
|
|
269
|
+
handleVisibleChange(false);
|
|
270
|
+
}, [pathKeyMap, mergedFieldNames, changeOnSelectProp, resolvePathOptions, handleChange, handleVisibleChange]);
|
|
271
|
+
|
|
272
|
+
// 转换 value 类型以兼容 rc-cascader
|
|
273
|
+
var rcValue = value === null ? undefined : value;
|
|
274
|
+
var rcDefaultValue = defaultValue === null ? undefined : defaultValue;
|
|
275
|
+
var defaultSearchRender = function defaultSearchRender(inputValue, path, prefixCls) {
|
|
276
|
+
var optionList = [];
|
|
277
|
+
|
|
278
|
+
// We do lower here to save perf
|
|
279
|
+
var lower = inputValue.toLowerCase();
|
|
280
|
+
path.forEach(function (node, index) {
|
|
281
|
+
if (index !== 0) {
|
|
282
|
+
optionList.push(" ".concat(separator, " "));
|
|
283
|
+
}
|
|
284
|
+
var label = node.labelForSearch;
|
|
285
|
+
var type = _typeof(label);
|
|
286
|
+
if (type === 'string' || type === 'number') {
|
|
287
|
+
label = highlightKeyword(String(label), lower, prefixCls);
|
|
288
|
+
}
|
|
289
|
+
optionList.push(label);
|
|
290
|
+
});
|
|
291
|
+
return optionList;
|
|
292
|
+
};
|
|
293
|
+
var mergedShowSearch = React.useMemo(function () {
|
|
294
|
+
if (!showInnerSearch) {
|
|
295
|
+
return showInnerSearch;
|
|
296
|
+
}
|
|
297
|
+
var searchConfig = {
|
|
298
|
+
filter: searchFilter || function (inputValue, path) {
|
|
299
|
+
return path.some(function (option) {
|
|
300
|
+
return option.labelForSearch.toLowerCase().indexOf(inputValue.toLowerCase()) > -1;
|
|
301
|
+
});
|
|
302
|
+
},
|
|
303
|
+
render: searchRender || defaultSearchRender,
|
|
304
|
+
limit: searchLimit
|
|
305
|
+
};
|
|
306
|
+
return searchConfig;
|
|
307
|
+
}, [showInnerSearch, searchFilter, searchRender, searchLimit]);
|
|
308
|
+
var commonProps = _objectSpread(_objectSpread({}, restProps), {}, {
|
|
309
|
+
fieldNames: mergedFieldNames,
|
|
310
|
+
prefixCls: prefixCls,
|
|
311
|
+
disabled: disabled,
|
|
312
|
+
placeholder: placeholder,
|
|
313
|
+
allowClear: allowClear,
|
|
314
|
+
showSearch: mergedShowSearch,
|
|
315
|
+
className: cascaderClassName,
|
|
316
|
+
dropdownClassName: clsx('odn-cascader-dropdown', dropdownMatchSelectWidth && 'odn-cascader-dropdown-match-width', !!searchValue && 'odn-cascader-dropdown-searching', dropdownClassName),
|
|
317
|
+
dropdownPrefixCls: 'odn-cascader',
|
|
318
|
+
style: style,
|
|
319
|
+
open: visible,
|
|
320
|
+
onOpenChange: handleVisibleChange,
|
|
321
|
+
onChange: handleChange,
|
|
322
|
+
suffixIcon: suffixIcon,
|
|
323
|
+
expandIcon: /*#__PURE__*/React.createElement(Icon, {
|
|
324
|
+
name: "right"
|
|
325
|
+
}),
|
|
326
|
+
removeIcon: removeIcon,
|
|
327
|
+
clearIcon: clearIcon,
|
|
328
|
+
transitionName: 'odn-slide-up',
|
|
329
|
+
options: processedOptions,
|
|
330
|
+
searchValue: searchValue,
|
|
331
|
+
notFoundContent: notFoundContent,
|
|
332
|
+
autoClearSearchValue: autoClearSearchValue,
|
|
333
|
+
onSearch: function onSearch(val) {
|
|
334
|
+
if (searchValueProp === undefined) {
|
|
335
|
+
setSearchValue(val);
|
|
336
|
+
}
|
|
337
|
+
if (_onSearch) {
|
|
338
|
+
_onSearch(val);
|
|
339
|
+
}
|
|
340
|
+
},
|
|
341
|
+
showCheckedStrategy: showCheckedStrategy === 'child' ? SHOW_CHILD : SHOW_PARENT,
|
|
342
|
+
displayRender: function displayRender(labelNodes, selectedOptions) {
|
|
343
|
+
var _selectedOptions$map;
|
|
344
|
+
// 将 rc-cascader 传入的 node 数组转为字符串数组,displayRender 第一个参数统一为 string[]
|
|
345
|
+
var labels = (_selectedOptions$map = selectedOptions === null || selectedOptions === void 0 ? void 0 : selectedOptions.map(function (o) {
|
|
346
|
+
var _o$label;
|
|
347
|
+
return (_o$label = o === null || o === void 0 ? void 0 : o.label) !== null && _o$label !== void 0 ? _o$label : o === null || o === void 0 ? void 0 : o.labelForSearch;
|
|
348
|
+
})) !== null && _selectedOptions$map !== void 0 ? _selectedOptions$map : [];
|
|
349
|
+
if (_displayRender) {
|
|
350
|
+
return _displayRender(labels, selectedOptions);
|
|
351
|
+
}
|
|
352
|
+
|
|
353
|
+
// 用户传入的 label 也可能是 ReactNode,需区分处理
|
|
354
|
+
var allPrimitive = labels.every(function (l) {
|
|
355
|
+
return typeof l === 'string' || typeof l === 'number';
|
|
356
|
+
});
|
|
357
|
+
if (allPrimitive) {
|
|
358
|
+
return labels.join(" ".concat(separator, " "));
|
|
359
|
+
}
|
|
360
|
+
return /*#__PURE__*/React.createElement(React.Fragment, null, labels.map(function (l, index) {
|
|
361
|
+
return /*#__PURE__*/React.createElement(React.Fragment, {
|
|
362
|
+
key: index
|
|
363
|
+
}, index > 0 && " ".concat(separator, " "), l);
|
|
364
|
+
}));
|
|
365
|
+
},
|
|
366
|
+
dropdownMatchSelectWidth: dropdownMatchSelectWidth,
|
|
367
|
+
optionRender: optionRenderProp,
|
|
368
|
+
// 单选模式不传 changeOnSelect 给 rc-cascader,
|
|
369
|
+
// 使展开图标点击时 isSelectable 对非叶节点返回 false,只触发展开
|
|
370
|
+
changeOnSelect: mode === 'single' ? false : changeOnSelectProp
|
|
371
|
+
});
|
|
372
|
+
var dropdownRender = React.useMemo(function () {
|
|
373
|
+
var searchRenderFn = showInnerSearch ? function (menu) {
|
|
374
|
+
var searchNode = /*#__PURE__*/React.createElement("div", null, /*#__PURE__*/React.createElement("div", {
|
|
375
|
+
className: "odn-select-dropdown-search"
|
|
376
|
+
}, /*#__PURE__*/React.createElement(Icon, {
|
|
377
|
+
name: "search",
|
|
378
|
+
className: "odn-select-dropdown-search-icon"
|
|
379
|
+
}), /*#__PURE__*/React.createElement("input", {
|
|
380
|
+
ref: dropdownSearchInputRef,
|
|
381
|
+
className: "odn-select-dropdown-search-input",
|
|
382
|
+
placeholder: "\u8BF7\u8F93\u5165",
|
|
383
|
+
value: searchValue,
|
|
384
|
+
onChange: function onChange(e) {
|
|
385
|
+
var value = e.target.value;
|
|
386
|
+
if (searchValueProp === undefined) {
|
|
387
|
+
setSearchValue(value);
|
|
388
|
+
}
|
|
389
|
+
if (_onSearch) {
|
|
390
|
+
_onSearch(value);
|
|
391
|
+
}
|
|
392
|
+
},
|
|
393
|
+
onKeyDown: function onKeyDown(e) {
|
|
394
|
+
e.stopPropagation();
|
|
395
|
+
}
|
|
396
|
+
})));
|
|
397
|
+
return /*#__PURE__*/React.createElement(React.Fragment, null, searchNode, menu);
|
|
398
|
+
} : undefined;
|
|
399
|
+
|
|
400
|
+
// 单选模式:在 dropdown 层面用 onClickCapture 拦截内容区域点击
|
|
401
|
+
if (mode === 'single') {
|
|
402
|
+
return function (menu) {
|
|
403
|
+
var rendered = searchRenderFn ? searchRenderFn(menu) : menu;
|
|
404
|
+
return /*#__PURE__*/React.createElement("div", {
|
|
405
|
+
onClickCapture: handleSingleSelectCapture
|
|
406
|
+
}, rendered);
|
|
407
|
+
};
|
|
408
|
+
}
|
|
409
|
+
return searchRenderFn;
|
|
410
|
+
}, [showInnerSearch, searchValue, searchValueProp, _onSearch, mode, handleSingleSelectCapture]);
|
|
411
|
+
if (mode === 'multiple') {
|
|
412
|
+
return /*#__PURE__*/React.createElement(RcCascader, _extends({}, commonProps, {
|
|
413
|
+
value: rcValue,
|
|
414
|
+
defaultValue: rcDefaultValue,
|
|
415
|
+
dropdownRender: dropdownRender
|
|
416
|
+
// @ts-ignore
|
|
417
|
+
,
|
|
418
|
+
checkable: /*#__PURE__*/React.createElement("span", {
|
|
419
|
+
className: "odn-cascader-checkbox-inner"
|
|
420
|
+
})
|
|
421
|
+
}));
|
|
422
|
+
}
|
|
423
|
+
return /*#__PURE__*/React.createElement(RcCascader, _extends({}, commonProps, {
|
|
424
|
+
value: rcValue,
|
|
425
|
+
defaultValue: rcDefaultValue,
|
|
426
|
+
dropdownRender: dropdownRender,
|
|
427
|
+
checkable: false
|
|
428
|
+
}));
|
|
429
|
+
}
|
|
430
|
+
|
|
431
|
+
// 创建具有泛型的组件
|
|
432
|
+
var Cascader = CascaderInner;
|
|
433
|
+
|
|
434
|
+
// 赋值 Panel 组件
|
|
435
|
+
Cascader.Panel = CascaderPanel;
|
|
436
|
+
export default Cascader;
|