one-design-next 0.0.4-alpha.57
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 +32 -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 +656 -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/alert/index.d.ts +63 -0
- package/dist/alert/index.js +137 -0
- package/dist/alert/style/index.css +199 -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 +51 -0
- package/dist/auto-complete/index.js +104 -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 +79 -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 +347 -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 +3 -0
- package/dist/calendar/style/index.d.ts +2 -0
- package/dist/calendar/style/index.js +2 -0
- package/dist/cascader/CascaderOptionContent.d.ts +20 -0
- package/dist/cascader/CascaderOptionContent.js +75 -0
- package/dist/cascader/Panel.d.ts +53 -0
- package/dist/cascader/Panel.js +116 -0
- package/dist/cascader/index.d.ts +54 -0
- package/dist/cascader/index.js +314 -0
- package/dist/cascader/style/index.css +458 -0
- package/dist/cascader/style/index.d.ts +2 -0
- package/dist/cascader/style/index.js +2 -0
- package/dist/cascader/utils.d.ts +12 -0
- package/dist/cascader/utils.js +85 -0
- package/dist/chart/index.d.ts +14 -0
- package/dist/chart/index.js +11 -0
- package/dist/chart/style/index.css +0 -0
- package/dist/chart/style/index.d.ts +2 -0
- package/dist/chart/style/index.js +2 -0
- package/dist/checkbox/Checkbox.d.ts +69 -0
- package/dist/checkbox/Checkbox.js +148 -0
- package/dist/checkbox/Context.d.ts +21 -0
- package/dist/checkbox/Context.js +2 -0
- package/dist/checkbox/Group.d.ts +49 -0
- package/dist/checkbox/Group.js +125 -0
- package/dist/checkbox/index.d.ts +5 -0
- package/dist/checkbox/index.js +3 -0
- package/dist/checkbox/style/index.css +306 -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 +107 -0
- package/dist/collapse/style/index.css +63 -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 +153 -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 +15 -0
- package/dist/date-picker/MonthPicker.js +134 -0
- package/dist/date-picker/QuarterPicker.d.ts +15 -0
- package/dist/date-picker/QuarterPicker.js +135 -0
- package/dist/date-picker/YearPicker.d.ts +13 -0
- package/dist/date-picker/YearPicker.js +81 -0
- package/dist/date-picker/index.d.ts +172 -0
- package/dist/date-picker/index.js +1138 -0
- package/dist/date-picker/style/index.css +548 -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 +46 -0
- package/dist/date-range-picker/index.js +1034 -0
- package/dist/dialog/index.d.ts +132 -0
- package/dist/dialog/index.js +282 -0
- package/dist/dialog/style/index.css +252 -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 +76 -0
- package/dist/drawer/index.js +186 -0
- package/dist/drawer/style/index.css +235 -0
- package/dist/drawer/style/index.d.ts +2 -0
- package/dist/drawer/style/index.js +2 -0
- package/dist/dropdown/index.d.ts +86 -0
- package/dist/dropdown/index.js +836 -0
- package/dist/dropdown/style/index.css +236 -0
- package/dist/dropdown/style/index.d.ts +2 -0
- package/dist/dropdown/style/index.js +2 -0
- package/dist/hover-fill/index.d.ts +43 -0
- package/dist/hover-fill/index.js +222 -0
- package/dist/hover-fill/style/index.css +38 -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 +95 -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/channels-square-filled.svg +1 -0
- package/dist/icon/svg/product/channels.svg +1 -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/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-circle.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 +221 -0
- package/dist/icon/svg-data.js +224 -0
- package/dist/icon/test-icons.html +122 -0
- package/dist/icon/types.d.ts +3 -0
- package/dist/icon/types.js +10 -0
- package/dist/index.d.ts +43 -0
- package/dist/index.js +46 -0
- package/dist/input/index.d.ts +80 -0
- package/dist/input/index.js +437 -0
- package/dist/input/style/index.css +256 -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 +36 -0
- package/dist/input-number/index.js +429 -0
- package/dist/input-number/style/index.css +70 -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 +114 -0
- package/dist/input-otp/style/index.d.ts +2 -0
- package/dist/input-otp/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 +133 -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 +110 -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 +0 -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 +38 -0
- package/dist/pagination/index.js +349 -0
- package/dist/pagination/style/index.css +128 -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 +123 -0
- package/dist/pop-base/index.js +349 -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 +150 -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 +21 -0
- package/dist/radio/index.js +45 -0
- package/dist/radio/primitive.d.ts +5 -0
- package/dist/radio/primitive.js +28 -0
- package/dist/radio/style/index.css +219 -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 +24 -0
- package/dist/scroll-area/index.js +96 -0
- package/dist/scroll-area/style/index.css +77 -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 +85 -0
- package/dist/select/index.js +262 -0
- package/dist/select/style/index.css +1736 -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/slider/index.d.ts +69 -0
- package/dist/slider/index.js +264 -0
- package/dist/slider/style/index.css +237 -0
- package/dist/slider/style/index.d.ts +2 -0
- package/dist/slider/style/index.js +2 -0
- package/dist/style/base.css +298 -0
- package/dist/style/index.d.ts +6 -0
- package/dist/style/index.js +17 -0
- package/dist/switch/index.d.ts +12 -0
- package/dist/switch/index.js +55 -0
- package/dist/switch/style/index.css +152 -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 +77 -0
- package/dist/table/index.d.ts +97 -0
- package/dist/table/index.js +791 -0
- package/dist/table/style/index.css +320 -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 +259 -0
- package/dist/tabs/index.d.ts +51 -0
- package/dist/tabs/index.js +617 -0
- package/dist/tabs/style/index.css +369 -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 +32 -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 +166 -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 +204 -0
- package/dist/tree-select/style/index.d.ts +1 -0
- package/dist/tree-select/style/index.js +1 -0
- package/package.json +124 -0
|
@@ -0,0 +1,379 @@
|
|
|
1
|
+
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); }
|
|
2
|
+
var _excluded = ["lang", "disabledDays", "month", "onMonthChange", "minDate", "maxDate", "className", "components"],
|
|
3
|
+
_excluded2 = ["day", "modifiers", "onMouseEnter", "onMouseLeave"];
|
|
4
|
+
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); }
|
|
5
|
+
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; }
|
|
6
|
+
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; }
|
|
7
|
+
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; }
|
|
8
|
+
function _toPropertyKey(t) { var i = _toPrimitive(t, "string"); return "symbol" == _typeof(i) ? i : String(i); }
|
|
9
|
+
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); }
|
|
10
|
+
function _slicedToArray(arr, i) { return _arrayWithHoles(arr) || _iterableToArrayLimit(arr, i) || _unsupportedIterableToArray(arr, i) || _nonIterableRest(); }
|
|
11
|
+
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."); }
|
|
12
|
+
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); }
|
|
13
|
+
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; }
|
|
14
|
+
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; } }
|
|
15
|
+
function _arrayWithHoles(arr) { if (Array.isArray(arr)) return arr; }
|
|
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 React, { useRef, useState } from 'react';
|
|
19
|
+
import { DayPicker } from 'react-day-picker-for-od';
|
|
20
|
+
import { enUS, zhCN } from 'react-day-picker-for-od/locale';
|
|
21
|
+
import "../date-picker/style";
|
|
22
|
+
import "./style";
|
|
23
|
+
var DEFAULT_HOVER_COLOR = 'rgba(33, 34, 38, 0.05)';
|
|
24
|
+
import { MONTHS, getDefaultMaxDate, getDefaultMinDate, isDayAfter, isDayBefore, today } from "../_util/date";
|
|
25
|
+
import Icon from "../icon";
|
|
26
|
+
var Calendar = function Calendar(_ref) {
|
|
27
|
+
var _ref$lang = _ref.lang,
|
|
28
|
+
lang = _ref$lang === void 0 ? 'zhCN' : _ref$lang,
|
|
29
|
+
disabledDays = _ref.disabledDays,
|
|
30
|
+
monthProp = _ref.month,
|
|
31
|
+
onMonthChange = _ref.onMonthChange,
|
|
32
|
+
_ref$minDate = _ref.minDate,
|
|
33
|
+
minDate = _ref$minDate === void 0 ? getDefaultMinDate() : _ref$minDate,
|
|
34
|
+
_ref$maxDate = _ref.maxDate,
|
|
35
|
+
maxDate = _ref$maxDate === void 0 ? getDefaultMaxDate() : _ref$maxDate,
|
|
36
|
+
className = _ref.className,
|
|
37
|
+
components = _ref.components,
|
|
38
|
+
otherProps = _objectWithoutProperties(_ref, _excluded);
|
|
39
|
+
var popupRef = useRef(null);
|
|
40
|
+
var navHoverFillRef = useRef(null);
|
|
41
|
+
var navHoverFillInnerRef = useRef(null);
|
|
42
|
+
var navHoverFillTimer = useRef(0);
|
|
43
|
+
var navHoverFillVisible = useRef(false);
|
|
44
|
+
var tdHoverFillRef = useRef(null);
|
|
45
|
+
var tdHoverFillInnerRef = useRef(null);
|
|
46
|
+
var tdHoverFillTimer = useRef(0);
|
|
47
|
+
var tdHoverFillVisible = useRef(false);
|
|
48
|
+
var _useState = useState(monthProp),
|
|
49
|
+
_useState2 = _slicedToArray(_useState, 2),
|
|
50
|
+
month = _useState2[0],
|
|
51
|
+
setMonth = _useState2[1];
|
|
52
|
+
var handleMonthChange = function handleMonthChange(date) {
|
|
53
|
+
if (monthProp === undefined) {
|
|
54
|
+
setMonth(date);
|
|
55
|
+
}
|
|
56
|
+
if (onMonthChange) {
|
|
57
|
+
onMonthChange(date);
|
|
58
|
+
}
|
|
59
|
+
};
|
|
60
|
+
var handleCaptionChange = function handleCaptionChange(date) {
|
|
61
|
+
var newDate = date;
|
|
62
|
+
if (minDate && isDayBefore(date, minDate)) {
|
|
63
|
+
newDate.setMonth(minDate.getMonth());
|
|
64
|
+
} else if (maxDate && isDayAfter(date, maxDate)) {
|
|
65
|
+
newDate.setMonth(maxDate.getMonth());
|
|
66
|
+
}
|
|
67
|
+
setMonth(newDate);
|
|
68
|
+
};
|
|
69
|
+
var handleSelectYearChange = function handleSelectYearChange(e) {
|
|
70
|
+
var newYear = parseInt(e.currentTarget.value, 10);
|
|
71
|
+
var baseDate = month || today;
|
|
72
|
+
var newDate = new Date(baseDate.getTime());
|
|
73
|
+
newDate.setFullYear(newYear);
|
|
74
|
+
handleCaptionChange(newDate);
|
|
75
|
+
};
|
|
76
|
+
var handleSelectMonthChange = function handleSelectMonthChange(e) {
|
|
77
|
+
var newMonth = parseInt(e.currentTarget.value, 10);
|
|
78
|
+
var baseDate = month || today;
|
|
79
|
+
var newDate = new Date(baseDate.getTime());
|
|
80
|
+
newDate.setMonth(newMonth);
|
|
81
|
+
handleCaptionChange(newDate);
|
|
82
|
+
};
|
|
83
|
+
var handleCaptionHoverEnter = function handleCaptionHoverEnter(e) {
|
|
84
|
+
var _popupRef$current, _popupRef$current2;
|
|
85
|
+
e.persist();
|
|
86
|
+
clearTimeout(navHoverFillTimer.current);
|
|
87
|
+
if (!navHoverFillInnerRef.current || !navHoverFillRef.current) {
|
|
88
|
+
return;
|
|
89
|
+
}
|
|
90
|
+
var offsetWidth = e.currentTarget.offsetWidth;
|
|
91
|
+
var popupTop = ((_popupRef$current = popupRef.current) === null || _popupRef$current === void 0 ? void 0 : _popupRef$current.getBoundingClientRect().top) || 0;
|
|
92
|
+
var popupLeft = ((_popupRef$current2 = popupRef.current) === null || _popupRef$current2 === void 0 ? void 0 : _popupRef$current2.getBoundingClientRect().left) || 0;
|
|
93
|
+
var targetTop = e.currentTarget.getBoundingClientRect().top || 0;
|
|
94
|
+
var targetLeft = e.currentTarget.getBoundingClientRect().left || 0;
|
|
95
|
+
var finalLeft = targetLeft - popupLeft;
|
|
96
|
+
var finalTop = targetTop - popupTop;
|
|
97
|
+
setTimeout(function () {
|
|
98
|
+
if (!navHoverFillRef.current || !navHoverFillInnerRef.current) {
|
|
99
|
+
return;
|
|
100
|
+
}
|
|
101
|
+
navHoverFillRef.current.style.width = "".concat(offsetWidth, "px");
|
|
102
|
+
navHoverFillRef.current.style.left = "".concat(finalLeft, "px");
|
|
103
|
+
navHoverFillRef.current.style.top = "".concat(finalTop, "px");
|
|
104
|
+
navHoverFillInnerRef.current.style.background = 'var(--odn-dp-hover-fill-color)';
|
|
105
|
+
}, 0);
|
|
106
|
+
if (!navHoverFillVisible.current) {
|
|
107
|
+
navHoverFillVisible.current = true;
|
|
108
|
+
navHoverFillRef.current.style.transitionDuration = '0s';
|
|
109
|
+
var clientX = e.clientX,
|
|
110
|
+
clientY = e.clientY;
|
|
111
|
+
var _e$currentTarget$getB = e.currentTarget.getBoundingClientRect(),
|
|
112
|
+
x = _e$currentTarget$getB.x,
|
|
113
|
+
y = _e$currentTarget$getB.y;
|
|
114
|
+
navHoverFillInnerRef.current.style.transformOrigin = "".concat(clientX - x, "px ").concat(clientY - y, "px");
|
|
115
|
+
} else {
|
|
116
|
+
navHoverFillRef.current.style.transitionDuration = 'var(--odn-hoverfill-duration)';
|
|
117
|
+
}
|
|
118
|
+
};
|
|
119
|
+
var handleCaptionHoverLeave = function handleCaptionHoverLeave(e) {
|
|
120
|
+
e.persist();
|
|
121
|
+
clearTimeout(navHoverFillTimer.current);
|
|
122
|
+
if (!navHoverFillInnerRef.current || !navHoverFillRef.current) {
|
|
123
|
+
return;
|
|
124
|
+
}
|
|
125
|
+
var clientX = e.clientX,
|
|
126
|
+
clientY = e.clientY;
|
|
127
|
+
var _e$currentTarget$getB2 = e.currentTarget.getBoundingClientRect(),
|
|
128
|
+
x = _e$currentTarget$getB2.x,
|
|
129
|
+
y = _e$currentTarget$getB2.y;
|
|
130
|
+
navHoverFillTimer.current = window.setTimeout(function () {
|
|
131
|
+
navHoverFillVisible.current = false;
|
|
132
|
+
if (navHoverFillInnerRef.current) {
|
|
133
|
+
navHoverFillInnerRef.current.style.transformOrigin = "".concat(clientX - x, "px ").concat(clientY - y, "px");
|
|
134
|
+
navHoverFillInnerRef.current.style.background = 'transparent';
|
|
135
|
+
}
|
|
136
|
+
}, 100);
|
|
137
|
+
};
|
|
138
|
+
var resetNavHoverFill = function resetNavHoverFill() {
|
|
139
|
+
navHoverFillVisible.current = false;
|
|
140
|
+
if (navHoverFillRef.current && navHoverFillInnerRef.current) {
|
|
141
|
+
navHoverFillInnerRef.current.style.transformOrigin = '';
|
|
142
|
+
navHoverFillInnerRef.current.style.background = 'transparent';
|
|
143
|
+
}
|
|
144
|
+
};
|
|
145
|
+
var handleTdHoverEnter = function handleTdHoverEnter(e) {
|
|
146
|
+
var _popupRef$current3, _popupRef$current4;
|
|
147
|
+
e.persist();
|
|
148
|
+
clearTimeout(tdHoverFillTimer.current);
|
|
149
|
+
if (!tdHoverFillInnerRef.current || !tdHoverFillRef.current) {
|
|
150
|
+
return;
|
|
151
|
+
}
|
|
152
|
+
var target = e.currentTarget;
|
|
153
|
+
var targetTop = target.getBoundingClientRect().top || 0;
|
|
154
|
+
var targetLeft = target.getBoundingClientRect().left || 0;
|
|
155
|
+
var popupTop = ((_popupRef$current3 = popupRef.current) === null || _popupRef$current3 === void 0 ? void 0 : _popupRef$current3.getBoundingClientRect().top) || 0;
|
|
156
|
+
var popupLeft = ((_popupRef$current4 = popupRef.current) === null || _popupRef$current4 === void 0 ? void 0 : _popupRef$current4.getBoundingClientRect().left) || 0;
|
|
157
|
+
var finalTop = targetTop - popupTop;
|
|
158
|
+
var finalTdLeft = targetLeft - popupLeft;
|
|
159
|
+
setTimeout(function () {
|
|
160
|
+
if (!tdHoverFillRef.current || !tdHoverFillInnerRef.current) {
|
|
161
|
+
return;
|
|
162
|
+
}
|
|
163
|
+
tdHoverFillRef.current.style.left = "".concat(finalTdLeft, "px");
|
|
164
|
+
tdHoverFillRef.current.style.top = "".concat(finalTop, "px");
|
|
165
|
+
tdHoverFillInnerRef.current.style.background = 'var(--odn-dp-hover-fill-color)';
|
|
166
|
+
}, 0);
|
|
167
|
+
if (!tdHoverFillVisible.current) {
|
|
168
|
+
tdHoverFillVisible.current = true;
|
|
169
|
+
tdHoverFillRef.current.style.transitionDuration = '0s';
|
|
170
|
+
var clientX = e.clientX,
|
|
171
|
+
clientY = e.clientY;
|
|
172
|
+
var _target$getBoundingCl = target.getBoundingClientRect(),
|
|
173
|
+
x = _target$getBoundingCl.x,
|
|
174
|
+
y = _target$getBoundingCl.y;
|
|
175
|
+
tdHoverFillInnerRef.current.style.transformOrigin = "".concat(clientX - x, "px ").concat(clientY - y, "px");
|
|
176
|
+
} else {
|
|
177
|
+
tdHoverFillRef.current.style.transitionDuration = 'var(--odn-hoverfill-duration)';
|
|
178
|
+
}
|
|
179
|
+
};
|
|
180
|
+
var handleTdHoverLeave = function handleTdHoverLeave(e) {
|
|
181
|
+
e.persist();
|
|
182
|
+
clearTimeout(tdHoverFillTimer.current);
|
|
183
|
+
if (!tdHoverFillInnerRef.current || !tdHoverFillRef.current) {
|
|
184
|
+
return;
|
|
185
|
+
}
|
|
186
|
+
var target = e.currentTarget;
|
|
187
|
+
var clientX = e.clientX,
|
|
188
|
+
clientY = e.clientY;
|
|
189
|
+
var _target$getBoundingCl2 = target.getBoundingClientRect(),
|
|
190
|
+
x = _target$getBoundingCl2.x,
|
|
191
|
+
y = _target$getBoundingCl2.y;
|
|
192
|
+
tdHoverFillTimer.current = window.setTimeout(function () {
|
|
193
|
+
tdHoverFillVisible.current = false;
|
|
194
|
+
if (tdHoverFillInnerRef.current) {
|
|
195
|
+
tdHoverFillInnerRef.current.style.transformOrigin = "".concat(clientX - x, "px ").concat(clientY - y, "px");
|
|
196
|
+
tdHoverFillInnerRef.current.style.background = 'rgba(33, 34, 38, 0)';
|
|
197
|
+
}
|
|
198
|
+
}, 100);
|
|
199
|
+
};
|
|
200
|
+
return /*#__PURE__*/React.createElement("div", {
|
|
201
|
+
"data-odn-calendar-wrapper": true,
|
|
202
|
+
className: className,
|
|
203
|
+
ref: popupRef
|
|
204
|
+
}, /*#__PURE__*/React.createElement("div", {
|
|
205
|
+
"data-odn-date-picker-caption-nav-hover-fill": true,
|
|
206
|
+
ref: navHoverFillRef
|
|
207
|
+
}, /*#__PURE__*/React.createElement("div", {
|
|
208
|
+
"data-odn-date-picker-caption-nav-hover-fill-inner": true,
|
|
209
|
+
ref: navHoverFillInnerRef
|
|
210
|
+
})), /*#__PURE__*/React.createElement("div", {
|
|
211
|
+
"data-odn-date-picker-td-hover-fill": true,
|
|
212
|
+
ref: tdHoverFillRef
|
|
213
|
+
}, /*#__PURE__*/React.createElement("div", {
|
|
214
|
+
"data-odn-date-picker-td-hover-fill-inner": true,
|
|
215
|
+
ref: tdHoverFillInnerRef
|
|
216
|
+
})), /*#__PURE__*/React.createElement(DayPicker, _extends({
|
|
217
|
+
locale: lang === 'zhCN' ? zhCN : enUS,
|
|
218
|
+
weekStartsOn: lang === 'zhCN' ? 1 : 0,
|
|
219
|
+
month: month,
|
|
220
|
+
onMonthChange: handleMonthChange,
|
|
221
|
+
captionLayout: "dropdown",
|
|
222
|
+
"data-odn-date-picker": true,
|
|
223
|
+
"data-odn-date-picker-locale": lang,
|
|
224
|
+
disabled: [{
|
|
225
|
+
before: minDate,
|
|
226
|
+
after: maxDate
|
|
227
|
+
}, disabledDays || []],
|
|
228
|
+
startMonth: minDate,
|
|
229
|
+
endMonth: maxDate,
|
|
230
|
+
components: _objectSpread({
|
|
231
|
+
YearsDropdown: function YearsDropdown(_ref2) {
|
|
232
|
+
var value = _ref2.value,
|
|
233
|
+
_ref2$options = _ref2.options,
|
|
234
|
+
options = _ref2$options === void 0 ? [] : _ref2$options;
|
|
235
|
+
var optionsFiltered = options.filter(function (o) {
|
|
236
|
+
return !o.disabled;
|
|
237
|
+
}).map(function (o) {
|
|
238
|
+
return _objectSpread(_objectSpread({}, o), {}, {
|
|
239
|
+
label: o.value
|
|
240
|
+
});
|
|
241
|
+
});
|
|
242
|
+
return /*#__PURE__*/React.createElement("div", {
|
|
243
|
+
"data-hover-fill-target": "year",
|
|
244
|
+
"data-odn-date-picker-caption-select": true,
|
|
245
|
+
"data-odn-date-picker-caption-select-year": true,
|
|
246
|
+
onMouseEnter: handleCaptionHoverEnter,
|
|
247
|
+
onMouseLeave: handleCaptionHoverLeave
|
|
248
|
+
}, /*#__PURE__*/React.createElement("select", {
|
|
249
|
+
"data-odn-date-picker-caption-select-input": true,
|
|
250
|
+
name: "year",
|
|
251
|
+
onChange: handleSelectYearChange,
|
|
252
|
+
onClick: resetNavHoverFill,
|
|
253
|
+
"data-value": value,
|
|
254
|
+
value: value
|
|
255
|
+
}, optionsFiltered.map(function (o) {
|
|
256
|
+
return /*#__PURE__*/React.createElement("option", {
|
|
257
|
+
key: o.value,
|
|
258
|
+
value: o.value
|
|
259
|
+
}, o.label, lang === 'zhCN' ? '年' : '');
|
|
260
|
+
})), /*#__PURE__*/React.createElement("svg", {
|
|
261
|
+
"data-odn-date-picker-caption-icon": true,
|
|
262
|
+
width: "18",
|
|
263
|
+
height: "18",
|
|
264
|
+
viewBox: "0 0 18 18"
|
|
265
|
+
}, /*#__PURE__*/React.createElement("path", {
|
|
266
|
+
d: "M12.3501 7.81235C12.6121 7.48497 12.379 7 11.9597 7H6.04034C5.62109 7 5.388 7.48497 5.6499 7.81235L8.60959 11.512C8.80975 11.7622 9.1903 11.7622 9.39046 11.512L12.3501 7.81235Z",
|
|
267
|
+
fillRule: "evenodd"
|
|
268
|
+
})));
|
|
269
|
+
},
|
|
270
|
+
MonthsDropdown: function MonthsDropdown(_ref3) {
|
|
271
|
+
var value = _ref3.value,
|
|
272
|
+
_ref3$options = _ref3.options,
|
|
273
|
+
options = _ref3$options === void 0 ? [] : _ref3$options;
|
|
274
|
+
var optionsFiltered = options.filter(function (o) {
|
|
275
|
+
return !o.disabled;
|
|
276
|
+
}).map(function (o) {
|
|
277
|
+
return _objectSpread(_objectSpread({}, o), {}, {
|
|
278
|
+
label: lang === 'zhCN' ? MONTHS[o.value].zhCN : MONTHS[o.value].enUS
|
|
279
|
+
});
|
|
280
|
+
});
|
|
281
|
+
return /*#__PURE__*/React.createElement("div", {
|
|
282
|
+
"data-hover-fill-target": "month",
|
|
283
|
+
"data-odn-date-picker-caption-select": true,
|
|
284
|
+
"data-odn-date-picker-caption-select-month": true,
|
|
285
|
+
onMouseEnter: handleCaptionHoverEnter,
|
|
286
|
+
onMouseLeave: handleCaptionHoverLeave
|
|
287
|
+
}, /*#__PURE__*/React.createElement("select", {
|
|
288
|
+
"data-odn-date-picker-caption-select-input": true,
|
|
289
|
+
name: "month",
|
|
290
|
+
onChange: handleSelectMonthChange,
|
|
291
|
+
value: value,
|
|
292
|
+
"data-value": value,
|
|
293
|
+
onClick: resetNavHoverFill
|
|
294
|
+
}, optionsFiltered.map(function (o) {
|
|
295
|
+
return /*#__PURE__*/React.createElement("option", {
|
|
296
|
+
key: o.value,
|
|
297
|
+
value: o.value
|
|
298
|
+
}, o.label);
|
|
299
|
+
})), /*#__PURE__*/React.createElement("svg", {
|
|
300
|
+
"data-odn-date-picker-caption-icon": true,
|
|
301
|
+
width: "18",
|
|
302
|
+
height: "18",
|
|
303
|
+
viewBox: "0 0 18 18"
|
|
304
|
+
}, /*#__PURE__*/React.createElement("path", {
|
|
305
|
+
d: "M12.3501 7.81235C12.6121 7.48497 12.379 7 11.9597 7H6.04034C5.62109 7 5.388 7.48497 5.6499 7.81235L8.60959 11.512C8.80975 11.7622 9.1903 11.7622 9.39046 11.512L12.3501 7.81235Z",
|
|
306
|
+
fillRule: "evenodd"
|
|
307
|
+
})));
|
|
308
|
+
},
|
|
309
|
+
Nav: function Nav(_ref4) {
|
|
310
|
+
var onPreviousClick = _ref4.onPreviousClick,
|
|
311
|
+
onNextClick = _ref4.onNextClick,
|
|
312
|
+
previousMonth = _ref4.previousMonth,
|
|
313
|
+
nextMonth = _ref4.nextMonth;
|
|
314
|
+
return /*#__PURE__*/React.createElement("div", {
|
|
315
|
+
"data-odn-date-picker-caption-nav": true
|
|
316
|
+
}, /*#__PURE__*/React.createElement("button", {
|
|
317
|
+
"data-odn-date-picker-caption-nav-button": true,
|
|
318
|
+
"data-odn-date-picker-caption-nav-button-prev": true,
|
|
319
|
+
"data-odn-date-picker-caption-nav-button-disabled": !previousMonth,
|
|
320
|
+
"data-hover-fill-target": "prev",
|
|
321
|
+
onClick: function onClick(e) {
|
|
322
|
+
e.stopPropagation();
|
|
323
|
+
onPreviousClick === null || onPreviousClick === void 0 || onPreviousClick(e);
|
|
324
|
+
},
|
|
325
|
+
disabled: !previousMonth,
|
|
326
|
+
onMouseEnter: handleCaptionHoverEnter,
|
|
327
|
+
onMouseLeave: handleCaptionHoverLeave
|
|
328
|
+
}, /*#__PURE__*/React.createElement(Icon, {
|
|
329
|
+
name: "left",
|
|
330
|
+
"data-odn-date-picker-caption-nav-icon": true
|
|
331
|
+
})), /*#__PURE__*/React.createElement("button", {
|
|
332
|
+
"data-odn-date-picker-caption-nav-button": true,
|
|
333
|
+
"data-odn-date-picker-caption-nav-button-next": true,
|
|
334
|
+
"data-odn-date-picker-caption-nav-button-disabled": !nextMonth,
|
|
335
|
+
"data-hover-fill-target": "next",
|
|
336
|
+
onClick: function onClick(e) {
|
|
337
|
+
e.stopPropagation();
|
|
338
|
+
onNextClick === null || onNextClick === void 0 || onNextClick(e);
|
|
339
|
+
},
|
|
340
|
+
disabled: !nextMonth,
|
|
341
|
+
onMouseEnter: handleCaptionHoverEnter,
|
|
342
|
+
onMouseLeave: handleCaptionHoverLeave
|
|
343
|
+
}, /*#__PURE__*/React.createElement(Icon, {
|
|
344
|
+
name: "right",
|
|
345
|
+
"data-odn-date-picker-caption-nav-icon": true
|
|
346
|
+
})));
|
|
347
|
+
},
|
|
348
|
+
DayButton: function DayButton(_ref5) {
|
|
349
|
+
var day = _ref5.day,
|
|
350
|
+
modifiers = _ref5.modifiers,
|
|
351
|
+
_onMouseEnter = _ref5.onMouseEnter,
|
|
352
|
+
_onMouseLeave = _ref5.onMouseLeave,
|
|
353
|
+
props = _objectWithoutProperties(_ref5, _excluded2);
|
|
354
|
+
var focus = modifiers.focus,
|
|
355
|
+
today = modifiers.today,
|
|
356
|
+
disabled = modifiers.disabled,
|
|
357
|
+
outside = modifiers.outside,
|
|
358
|
+
selected = modifiers.selected;
|
|
359
|
+
return /*#__PURE__*/React.createElement("button", _extends({
|
|
360
|
+
"data-odn-date-picker-day": true,
|
|
361
|
+
"data-odn-date-picker-day-disabled": disabled,
|
|
362
|
+
"data-odn-date-picker-day-today": today,
|
|
363
|
+
"data-odn-date-picker-day-selected": selected,
|
|
364
|
+
"data-odn-date-picker-day-focus": focus,
|
|
365
|
+
"data-odn-date-picker-day-outside": outside,
|
|
366
|
+
onMouseEnter: function onMouseEnter(e) {
|
|
367
|
+
_onMouseEnter === null || _onMouseEnter === void 0 || _onMouseEnter(e);
|
|
368
|
+
handleTdHoverEnter(e);
|
|
369
|
+
},
|
|
370
|
+
onMouseLeave: function onMouseLeave(e) {
|
|
371
|
+
_onMouseLeave === null || _onMouseLeave === void 0 || _onMouseLeave(e);
|
|
372
|
+
handleTdHoverLeave(e);
|
|
373
|
+
}
|
|
374
|
+
}, props), day.date.getDate());
|
|
375
|
+
}
|
|
376
|
+
}, components)
|
|
377
|
+
}, otherProps)));
|
|
378
|
+
};
|
|
379
|
+
export default Calendar;
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
interface CascaderOptionContentProps {
|
|
3
|
+
/** 显示的内容 */
|
|
4
|
+
content: React.ReactNode;
|
|
5
|
+
/** 用户自定义的 popover 内容 */
|
|
6
|
+
customPopover?: React.ReactNode;
|
|
7
|
+
/** Popover 的额外属性 */
|
|
8
|
+
optionPopoverProps?: Record<string, unknown>;
|
|
9
|
+
/** 是否强制显示 Popover(用于调试) */
|
|
10
|
+
forceShow?: boolean;
|
|
11
|
+
}
|
|
12
|
+
/**
|
|
13
|
+
* Cascader 选项内容组件
|
|
14
|
+
* 智能判断是否需要显示 Popover:
|
|
15
|
+
* 1. 当用户传入了自定义 popover 内容时,始终显示
|
|
16
|
+
* 2. 当用户没有传入时,检测文本是否被截断,只有被截断时才显示 Popover
|
|
17
|
+
* 优化:hover 时计算截断状态,避免初始渲染时的性能问题
|
|
18
|
+
*/
|
|
19
|
+
declare const CascaderOptionContent: React.FC<CascaderOptionContentProps>;
|
|
20
|
+
export default CascaderOptionContent;
|
|
@@ -0,0 +1,75 @@
|
|
|
1
|
+
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); }
|
|
2
|
+
function _slicedToArray(arr, i) { return _arrayWithHoles(arr) || _iterableToArrayLimit(arr, i) || _unsupportedIterableToArray(arr, i) || _nonIterableRest(); }
|
|
3
|
+
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."); }
|
|
4
|
+
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); }
|
|
5
|
+
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; }
|
|
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
|
+
import React, { useCallback, useRef, useState } from 'react';
|
|
9
|
+
import Popover from "../popover";
|
|
10
|
+
/**
|
|
11
|
+
* Cascader 选项内容组件
|
|
12
|
+
* 智能判断是否需要显示 Popover:
|
|
13
|
+
* 1. 当用户传入了自定义 popover 内容时,始终显示
|
|
14
|
+
* 2. 当用户没有传入时,检测文本是否被截断,只有被截断时才显示 Popover
|
|
15
|
+
* 优化:hover 时计算截断状态,避免初始渲染时的性能问题
|
|
16
|
+
*/
|
|
17
|
+
var CascaderOptionContent = function CascaderOptionContent(_ref) {
|
|
18
|
+
var content = _ref.content,
|
|
19
|
+
customPopover = _ref.customPopover,
|
|
20
|
+
optionPopoverProps = _ref.optionPopoverProps,
|
|
21
|
+
_ref$forceShow = _ref.forceShow,
|
|
22
|
+
forceShow = _ref$forceShow === void 0 ? false : _ref$forceShow;
|
|
23
|
+
var contentRef = useRef(null);
|
|
24
|
+
var _useState = useState(false),
|
|
25
|
+
_useState2 = _slicedToArray(_useState, 2),
|
|
26
|
+
shouldShowPopover = _useState2[0],
|
|
27
|
+
setShouldShowPopover = _useState2[1];
|
|
28
|
+
|
|
29
|
+
// hover 事件处理:每次 hover 时都计算截断状态
|
|
30
|
+
var handleMouseEnter = useCallback(function () {
|
|
31
|
+
if (contentRef.current) {
|
|
32
|
+
var element = contentRef.current;
|
|
33
|
+
// 检查是否有省略号(文本被截断)
|
|
34
|
+
var isTextTruncated = element.scrollWidth > element.clientWidth;
|
|
35
|
+
|
|
36
|
+
// 决定是否显示 Popover:
|
|
37
|
+
// 1. 用户传入了自定义 popover 内容
|
|
38
|
+
// 2. 或者文本被截断且没有自定义内容
|
|
39
|
+
var shouldShow = !!customPopover || isTextTruncated && !customPopover;
|
|
40
|
+
|
|
41
|
+
// 只有状态真正改变时才更新,避免不必要的重新渲染
|
|
42
|
+
setShouldShowPopover(function (prev) {
|
|
43
|
+
return prev !== shouldShow ? shouldShow : prev;
|
|
44
|
+
});
|
|
45
|
+
}
|
|
46
|
+
}, [customPopover]);
|
|
47
|
+
|
|
48
|
+
// 内容容器元素
|
|
49
|
+
var contentElement = /*#__PURE__*/React.createElement("div", {
|
|
50
|
+
ref: contentRef,
|
|
51
|
+
style: {
|
|
52
|
+
display: 'inline-block'
|
|
53
|
+
},
|
|
54
|
+
onMouseEnter: handleMouseEnter
|
|
55
|
+
}, content);
|
|
56
|
+
|
|
57
|
+
// 如果有自定义 popover 或强制显示,始终显示 Popover
|
|
58
|
+
if (customPopover || forceShow) {
|
|
59
|
+
var popoverContent = customPopover || content;
|
|
60
|
+
return /*#__PURE__*/React.createElement(Popover, _extends({
|
|
61
|
+
popup: popoverContent,
|
|
62
|
+
placement: "right",
|
|
63
|
+
mouseEnterDelay: 0.3
|
|
64
|
+
}, optionPopoverProps), contentElement);
|
|
65
|
+
}
|
|
66
|
+
|
|
67
|
+
// 统一使用 Popover,通过 visible 属性控制显示
|
|
68
|
+
return /*#__PURE__*/React.createElement(Popover, _extends({
|
|
69
|
+
popup: content,
|
|
70
|
+
placement: "right",
|
|
71
|
+
mouseEnterDelay: 0.3,
|
|
72
|
+
visible: shouldShowPopover ? undefined : false
|
|
73
|
+
}, optionPopoverProps), contentElement);
|
|
74
|
+
};
|
|
75
|
+
export default CascaderOptionContent;
|
|
@@ -0,0 +1,53 @@
|
|
|
1
|
+
import type { DefaultOptionType } from 'rc-cascader';
|
|
2
|
+
import React from 'react';
|
|
3
|
+
import { type FieldNames } from './utils';
|
|
4
|
+
declare const SHOW_PARENT: "SHOW_PARENT", SHOW_CHILD: "SHOW_CHILD";
|
|
5
|
+
export interface BaseCascaderPanelProps {
|
|
6
|
+
/** 选项数据 */
|
|
7
|
+
options?: DefaultOptionType[];
|
|
8
|
+
/** 是否支持多选 */
|
|
9
|
+
checkable?: boolean;
|
|
10
|
+
/** 样式前缀 */
|
|
11
|
+
prefixCls?: string;
|
|
12
|
+
/** 展开图标 */
|
|
13
|
+
expandIcon?: React.ReactNode;
|
|
14
|
+
/** 加载图标 */
|
|
15
|
+
loadingIcon?: React.ReactNode;
|
|
16
|
+
/** 占位符文本 */
|
|
17
|
+
placeholder?: string;
|
|
18
|
+
/** 是否禁用 */
|
|
19
|
+
disabled?: boolean;
|
|
20
|
+
/** 自定义类名 */
|
|
21
|
+
className?: string;
|
|
22
|
+
/** 自定义样式 */
|
|
23
|
+
style?: React.CSSProperties;
|
|
24
|
+
/** 展开触发方式 */
|
|
25
|
+
expandTrigger?: 'click' | 'hover';
|
|
26
|
+
/** 是否在选择后改变选项 */
|
|
27
|
+
changeOnSelect?: boolean;
|
|
28
|
+
/** 字段名映射 */
|
|
29
|
+
fieldNames?: FieldNames;
|
|
30
|
+
/** 显示选中策略 */
|
|
31
|
+
showCheckedStrategy?: typeof SHOW_PARENT | typeof SHOW_CHILD;
|
|
32
|
+
/** 异步加载数据 */
|
|
33
|
+
loadData?: (selectedOptions: DefaultOptionType[]) => void;
|
|
34
|
+
/** 布局方向 */
|
|
35
|
+
direction?: 'ltr' | 'rtl';
|
|
36
|
+
/** 无数据时显示的内容 */
|
|
37
|
+
notFoundContent?: React.ReactNode;
|
|
38
|
+
/** 是否自动设置列的最大宽度,基于 options 的深度 */
|
|
39
|
+
autoMaxWidth?: boolean;
|
|
40
|
+
/** 选项 popover 的额外属性 */
|
|
41
|
+
optionPopoverProps?: Record<string, unknown>;
|
|
42
|
+
}
|
|
43
|
+
export type CascaderPanelProps<V = (string | number)[] | null> = BaseCascaderPanelProps & {
|
|
44
|
+
mode?: 'single' | 'multiple';
|
|
45
|
+
value?: V;
|
|
46
|
+
defaultValue?: V;
|
|
47
|
+
onChange?: (value: V, selectOptions: DefaultOptionType[]) => void;
|
|
48
|
+
};
|
|
49
|
+
export interface CascaderPanelComponent {
|
|
50
|
+
<V = (string | number)[] | null>(props: CascaderPanelProps<V>): React.ReactElement | null;
|
|
51
|
+
}
|
|
52
|
+
declare const PanelComponent: CascaderPanelComponent;
|
|
53
|
+
export default PanelComponent;
|
|
@@ -0,0 +1,116 @@
|
|
|
1
|
+
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); }
|
|
2
|
+
var _excluded = ["value", "defaultValue", "onChange", "mode", "checkable", "prefixCls", "expandIcon", "loadingIcon", "options", "style", "autoMaxWidth", "fieldNames", "optionPopoverProps"];
|
|
3
|
+
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); }
|
|
4
|
+
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; }
|
|
5
|
+
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; }
|
|
6
|
+
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; }
|
|
7
|
+
function _toPropertyKey(t) { var i = _toPrimitive(t, "string"); return "symbol" == _typeof(i) ? i : String(i); }
|
|
8
|
+
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); }
|
|
9
|
+
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; }
|
|
10
|
+
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; }
|
|
11
|
+
import RcCascader from 'rc-cascader';
|
|
12
|
+
import React from 'react';
|
|
13
|
+
import Icon from "../icon";
|
|
14
|
+
import { calculateOptionsDepth, generateCommonStyle, processOptions } from "./utils";
|
|
15
|
+
var SHOW_PARENT = RcCascader.SHOW_PARENT,
|
|
16
|
+
SHOW_CHILD = RcCascader.SHOW_CHILD;
|
|
17
|
+
function CascaderPanel(_ref) {
|
|
18
|
+
var value = _ref.value,
|
|
19
|
+
defaultValue = _ref.defaultValue,
|
|
20
|
+
onChange = _ref.onChange,
|
|
21
|
+
_ref$mode = _ref.mode,
|
|
22
|
+
mode = _ref$mode === void 0 ? 'single' : _ref$mode,
|
|
23
|
+
checkable = _ref.checkable,
|
|
24
|
+
_ref$prefixCls = _ref.prefixCls,
|
|
25
|
+
prefixCls = _ref$prefixCls === void 0 ? 'odn-cascader' : _ref$prefixCls,
|
|
26
|
+
_ref$expandIcon = _ref.expandIcon,
|
|
27
|
+
expandIcon = _ref$expandIcon === void 0 ? /*#__PURE__*/React.createElement(Icon, {
|
|
28
|
+
name: "right"
|
|
29
|
+
}) : _ref$expandIcon,
|
|
30
|
+
loadingIcon = _ref.loadingIcon,
|
|
31
|
+
options = _ref.options,
|
|
32
|
+
style = _ref.style,
|
|
33
|
+
_ref$autoMaxWidth = _ref.autoMaxWidth,
|
|
34
|
+
autoMaxWidth = _ref$autoMaxWidth === void 0 ? false : _ref$autoMaxWidth,
|
|
35
|
+
fieldNames = _ref.fieldNames,
|
|
36
|
+
optionPopoverProps = _ref.optionPopoverProps,
|
|
37
|
+
restProps = _objectWithoutProperties(_ref, _excluded);
|
|
38
|
+
// 处理 options,确保每个 option 都有 title 字段
|
|
39
|
+
var processedOptions = React.useMemo(function () {
|
|
40
|
+
return processOptions(options, fieldNames, optionPopoverProps);
|
|
41
|
+
}, [options, fieldNames, optionPopoverProps]);
|
|
42
|
+
|
|
43
|
+
// 计算 options 的最大深度,用于列宽设置
|
|
44
|
+
var depth = React.useMemo(function () {
|
|
45
|
+
return calculateOptionsDepth(processedOptions, fieldNames);
|
|
46
|
+
}, [processedOptions, fieldNames]);
|
|
47
|
+
|
|
48
|
+
// 根据 mode 自动设置 checkable
|
|
49
|
+
var isCheckable = checkable !== undefined ? checkable : mode === 'multiple';
|
|
50
|
+
var handleChange = function handleChange(rcValue, selectOptions) {
|
|
51
|
+
// 如果 value 是 undefined,传递 null
|
|
52
|
+
if (rcValue === undefined) {
|
|
53
|
+
onChange === null || onChange === void 0 || onChange(null, selectOptions || []);
|
|
54
|
+
return;
|
|
55
|
+
}
|
|
56
|
+
if (mode === 'multiple') {
|
|
57
|
+
// 多选模式:处理二维数组
|
|
58
|
+
if (Array.isArray(rcValue) && rcValue.length > 0 && Array.isArray(rcValue[0])) {
|
|
59
|
+
var filteredValue = rcValue.map(function (item) {
|
|
60
|
+
return item.filter(function (v) {
|
|
61
|
+
return v !== null && (typeof v === 'string' || typeof v === 'number');
|
|
62
|
+
});
|
|
63
|
+
});
|
|
64
|
+
onChange === null || onChange === void 0 || onChange(filteredValue, selectOptions || []);
|
|
65
|
+
} else {
|
|
66
|
+
onChange === null || onChange === void 0 || onChange(null, selectOptions || []);
|
|
67
|
+
}
|
|
68
|
+
} else {
|
|
69
|
+
// 单选模式:处理一维数组
|
|
70
|
+
if (Array.isArray(rcValue) && !Array.isArray(rcValue[0])) {
|
|
71
|
+
var _filteredValue = rcValue.filter(function (v) {
|
|
72
|
+
return v !== null && (typeof v === 'string' || typeof v === 'number');
|
|
73
|
+
});
|
|
74
|
+
onChange === null || onChange === void 0 || onChange(_filteredValue, selectOptions || []);
|
|
75
|
+
} else {
|
|
76
|
+
onChange === null || onChange === void 0 || onChange(null, selectOptions || []);
|
|
77
|
+
}
|
|
78
|
+
}
|
|
79
|
+
};
|
|
80
|
+
|
|
81
|
+
// 转换 value 类型以兼容 rc-cascader
|
|
82
|
+
var rcValue = value === null ? undefined : value;
|
|
83
|
+
var rcDefaultValue = defaultValue === null ? undefined : value;
|
|
84
|
+
|
|
85
|
+
// 生成公共样式
|
|
86
|
+
var commonStyle = generateCommonStyle(depth, autoMaxWidth, style);
|
|
87
|
+
|
|
88
|
+
// 提取共同的 props
|
|
89
|
+
var commonProps = _objectSpread({
|
|
90
|
+
prefixCls: prefixCls,
|
|
91
|
+
expandIcon: expandIcon,
|
|
92
|
+
loadingIcon: loadingIcon,
|
|
93
|
+
onChange: handleChange,
|
|
94
|
+
options: processedOptions,
|
|
95
|
+
style: commonStyle,
|
|
96
|
+
fieldNames: fieldNames
|
|
97
|
+
}, restProps);
|
|
98
|
+
if (mode === 'multiple') {
|
|
99
|
+
return /*#__PURE__*/React.createElement(RcCascader.Panel, _extends({}, commonProps, {
|
|
100
|
+
value: rcValue,
|
|
101
|
+
defaultValue: rcDefaultValue
|
|
102
|
+
// @ts-ignore
|
|
103
|
+
,
|
|
104
|
+
checkable: /*#__PURE__*/React.createElement("span", {
|
|
105
|
+
className: "odn-cascader-checkbox-inner"
|
|
106
|
+
})
|
|
107
|
+
}));
|
|
108
|
+
}
|
|
109
|
+
return /*#__PURE__*/React.createElement(RcCascader.Panel, _extends({}, commonProps, {
|
|
110
|
+
value: rcValue,
|
|
111
|
+
defaultValue: rcDefaultValue,
|
|
112
|
+
checkable: false
|
|
113
|
+
}));
|
|
114
|
+
}
|
|
115
|
+
var PanelComponent = CascaderPanel;
|
|
116
|
+
export default PanelComponent;
|