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,178 @@
|
|
|
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 = ["checked", "children", "className", "disabled", "helper", "helperIcon", "helperProps", "ellipsis", "ellipsisPopoverProps", "indeterminate", "onChange", "onClick", "onMouseDown", "size", "value"];
|
|
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 _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; }
|
|
5
|
+
function _toPropertyKey(t) { var i = _toPrimitive(t, "string"); return "symbol" == _typeof(i) ? i : String(i); }
|
|
6
|
+
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); }
|
|
7
|
+
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; }
|
|
8
|
+
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; }
|
|
9
|
+
import clsx from 'clsx';
|
|
10
|
+
import React, { forwardRef, useContext, useMemo, useRef } from 'react';
|
|
11
|
+
import { useActive } from "../_util/useActive";
|
|
12
|
+
import { getComputedSize } from "../config-provider";
|
|
13
|
+
import EllipsisText from "../ellipsis-text";
|
|
14
|
+
import Icon from "../icon";
|
|
15
|
+
import Popover from "../popover";
|
|
16
|
+
import { GroupContext } from "./Context";
|
|
17
|
+
import Group from "./Group";
|
|
18
|
+
var prefix = 'odn-checkbox';
|
|
19
|
+
/**
|
|
20
|
+
* 勾选提供用户在多个选项中,对选项的内容进行单或多个选择。
|
|
21
|
+
*/
|
|
22
|
+
// @ts-ignore
|
|
23
|
+
var Checkbox = /*#__PURE__*/forwardRef(function (_ref, refProp) {
|
|
24
|
+
var _ref2;
|
|
25
|
+
var _ref$checked = _ref.checked,
|
|
26
|
+
checked = _ref$checked === void 0 ? null : _ref$checked,
|
|
27
|
+
_ref$children = _ref.children,
|
|
28
|
+
children = _ref$children === void 0 ? '' : _ref$children,
|
|
29
|
+
_ref$className = _ref.className,
|
|
30
|
+
className = _ref$className === void 0 ? undefined : _ref$className,
|
|
31
|
+
_ref$disabled = _ref.disabled,
|
|
32
|
+
disabled = _ref$disabled === void 0 ? false : _ref$disabled,
|
|
33
|
+
_ref$helper = _ref.helper,
|
|
34
|
+
helper = _ref$helper === void 0 ? null : _ref$helper,
|
|
35
|
+
helperIcon = _ref.helperIcon,
|
|
36
|
+
_ref$helperProps = _ref.helperProps,
|
|
37
|
+
helperProps = _ref$helperProps === void 0 ? {
|
|
38
|
+
popup: helper
|
|
39
|
+
} : _ref$helperProps,
|
|
40
|
+
ellipsisProp = _ref.ellipsis,
|
|
41
|
+
ellipsisPopoverPropsProp = _ref.ellipsisPopoverProps,
|
|
42
|
+
_ref$indeterminate = _ref.indeterminate,
|
|
43
|
+
indeterminate = _ref$indeterminate === void 0 ? false : _ref$indeterminate,
|
|
44
|
+
_ref$onChange = _ref.onChange,
|
|
45
|
+
onChange = _ref$onChange === void 0 ? null : _ref$onChange,
|
|
46
|
+
_ref$onClick = _ref.onClick,
|
|
47
|
+
onClick = _ref$onClick === void 0 ? null : _ref$onClick,
|
|
48
|
+
_ref$onMouseDown = _ref.onMouseDown,
|
|
49
|
+
onMouseDown = _ref$onMouseDown === void 0 ? undefined : _ref$onMouseDown,
|
|
50
|
+
sizeProp = _ref.size,
|
|
51
|
+
_ref$value = _ref.value,
|
|
52
|
+
value = _ref$value === void 0 ? null : _ref$value,
|
|
53
|
+
otherProps = _objectWithoutProperties(_ref, _excluded);
|
|
54
|
+
var _useContext = useContext(GroupContext),
|
|
55
|
+
disabledContext = _useContext.disabled,
|
|
56
|
+
handleGroupValueChange = _useContext.handleGroupValueChange,
|
|
57
|
+
sizeContext = _useContext.size,
|
|
58
|
+
valueContext = _useContext.value,
|
|
59
|
+
helperIconContext = _useContext.helperIcon,
|
|
60
|
+
ellipsisContext = _useContext.ellipsis,
|
|
61
|
+
ellipsisPopoverPropsContext = _useContext.ellipsisPopoverProps;
|
|
62
|
+
var labelRef = useRef(null);
|
|
63
|
+
var ref = refProp || labelRef;
|
|
64
|
+
var _useActive = useActive({
|
|
65
|
+
ref: ref
|
|
66
|
+
}),
|
|
67
|
+
handleMouseDown = _useActive.handleMouseDown;
|
|
68
|
+
var size = getComputedSize(sizeProp, sizeContext);
|
|
69
|
+
var valueComputed = value !== null ? value : children === null || children === void 0 ? void 0 : children.toString();
|
|
70
|
+
|
|
71
|
+
// 使用 Set 优化数组查找性能,特别是当有大量 checkbox 时
|
|
72
|
+
var valueSet = useMemo(function () {
|
|
73
|
+
if (!valueContext || !Array.isArray(valueContext)) {
|
|
74
|
+
return null;
|
|
75
|
+
}
|
|
76
|
+
return new Set(valueContext);
|
|
77
|
+
}, [valueContext]);
|
|
78
|
+
|
|
79
|
+
/**
|
|
80
|
+
* 当有 context context 时,使用 value:
|
|
81
|
+
* 如果存在 value prop,则直接使用 value;
|
|
82
|
+
* 如果不存在,就 string 化 children 作为 value。
|
|
83
|
+
*/
|
|
84
|
+
var isChecked = useMemo(function () {
|
|
85
|
+
if (indeterminate) return true;
|
|
86
|
+
if (valueContext && valueComputed !== null && valueComputed !== undefined) {
|
|
87
|
+
var _valueSet$has;
|
|
88
|
+
return (_valueSet$has = valueSet === null || valueSet === void 0 ? void 0 : valueSet.has(valueComputed)) !== null && _valueSet$has !== void 0 ? _valueSet$has : false;
|
|
89
|
+
}
|
|
90
|
+
return !!checked;
|
|
91
|
+
}, [indeterminate, valueContext, valueComputed, valueSet, checked]);
|
|
92
|
+
var classSet = clsx(className, "".concat(prefix, "-base"), "".concat(prefix, "-").concat(size), _defineProperty(_defineProperty(_defineProperty(_defineProperty({}, "".concat(prefix, "-checked"), isChecked), "".concat(prefix, "-noChildren"), !children), "".concat(prefix, "-disabled"), disabledContext || disabled), "".concat(prefix, "-indeterminate"), indeterminate));
|
|
93
|
+
var popover = helper && (helperIcon || helperIconContext) ? /*#__PURE__*/React.createElement("span", {
|
|
94
|
+
role: "none",
|
|
95
|
+
onClick: function onClick(e) {
|
|
96
|
+
e.stopPropagation();
|
|
97
|
+
}
|
|
98
|
+
}, /*#__PURE__*/React.createElement(Popover, helperProps, /*#__PURE__*/React.createElement(Icon, {
|
|
99
|
+
name: helperIcon || helperIconContext || 'help-circle',
|
|
100
|
+
color: "var(--gray-600)",
|
|
101
|
+
className: "".concat(prefix, "-helper")
|
|
102
|
+
}))) : null;
|
|
103
|
+
var handleClick = function handleClick(e) {
|
|
104
|
+
if (onClick) {
|
|
105
|
+
onClick(e);
|
|
106
|
+
}
|
|
107
|
+
if (disabled || disabledContext) {
|
|
108
|
+
return;
|
|
109
|
+
}
|
|
110
|
+
if (handleGroupValueChange && valueComputed !== null && valueComputed !== undefined) {
|
|
111
|
+
handleGroupValueChange(valueComputed);
|
|
112
|
+
} else {
|
|
113
|
+
if (onChange) {
|
|
114
|
+
onChange(!checked, {
|
|
115
|
+
e: e
|
|
116
|
+
});
|
|
117
|
+
}
|
|
118
|
+
}
|
|
119
|
+
};
|
|
120
|
+
var handleKeyDown = function handleKeyDown(e) {
|
|
121
|
+
if (e.key === 'Enter') {
|
|
122
|
+
handleClick(e);
|
|
123
|
+
}
|
|
124
|
+
};
|
|
125
|
+
var handleLabelMouseDown = function handleLabelMouseDown(e) {
|
|
126
|
+
if (onMouseDown) {
|
|
127
|
+
onMouseDown(e);
|
|
128
|
+
}
|
|
129
|
+
handleMouseDown();
|
|
130
|
+
};
|
|
131
|
+
var ellipsis = (_ref2 = ellipsisProp !== null && ellipsisProp !== void 0 ? ellipsisProp : ellipsisContext) !== null && _ref2 !== void 0 ? _ref2 : false;
|
|
132
|
+
var ellipsisPopoverProps = ellipsisPopoverPropsProp !== null && ellipsisPopoverPropsProp !== void 0 ? ellipsisPopoverPropsProp : ellipsisPopoverPropsContext;
|
|
133
|
+
|
|
134
|
+
// 优先级:helper > ellipsis > 直接显示
|
|
135
|
+
// 当有 helper 时,优先使用 helper,不使用 ellipsis
|
|
136
|
+
var childrenElement = !!children ? helper ?
|
|
137
|
+
/*#__PURE__*/
|
|
138
|
+
// helper 优先:当有 helper 时,children 直接显示(helper 会在下面单独处理)
|
|
139
|
+
React.createElement("span", {
|
|
140
|
+
"data-odn-checkbox-label": true
|
|
141
|
+
}, children) : ellipsis ?
|
|
142
|
+
/*#__PURE__*/
|
|
143
|
+
// ellipsis:使用 EllipsisText 包裹
|
|
144
|
+
React.createElement(EllipsisText, {
|
|
145
|
+
"data-odn-checkbox-label": true,
|
|
146
|
+
popoverProps: ellipsisPopoverProps,
|
|
147
|
+
style: {
|
|
148
|
+
display: 'inline-block'
|
|
149
|
+
}
|
|
150
|
+
}, children) :
|
|
151
|
+
/*#__PURE__*/
|
|
152
|
+
// 默认:直接显示
|
|
153
|
+
React.createElement("span", {
|
|
154
|
+
"data-odn-checkbox-label": true
|
|
155
|
+
}, children) : null;
|
|
156
|
+
return /*#__PURE__*/React.createElement("label", _extends({
|
|
157
|
+
"aria-checked": !!checked,
|
|
158
|
+
"data-odn-checkbox-size": size,
|
|
159
|
+
"data-odn-checkbox-helper-text": !!helper && !helperIcon && !helperIconContext,
|
|
160
|
+
className: classSet,
|
|
161
|
+
onClick: handleClick,
|
|
162
|
+
onKeyDown: handleKeyDown,
|
|
163
|
+
ref: ref,
|
|
164
|
+
role: "checkbox",
|
|
165
|
+
onMouseDown: handleLabelMouseDown
|
|
166
|
+
}, otherProps), /*#__PURE__*/React.createElement("span", {
|
|
167
|
+
className: "".concat(prefix, "-input"),
|
|
168
|
+
"data-odn-checkbox-input": true
|
|
169
|
+
}, /*#__PURE__*/React.createElement("i", {
|
|
170
|
+
className: "".concat(prefix, "-indicator"),
|
|
171
|
+
"data-odn-checkbox-indicator": true
|
|
172
|
+
})), helper && !helperIcon && !helperIconContext ? /*#__PURE__*/React.createElement(Popover, _extends({}, helperProps, {
|
|
173
|
+
popup: helper
|
|
174
|
+
}), childrenElement) : childrenElement, popover);
|
|
175
|
+
});
|
|
176
|
+
Checkbox.Group = Group;
|
|
177
|
+
Checkbox.displayName = 'Checkbox';
|
|
178
|
+
export default Checkbox;
|
|
@@ -0,0 +1,35 @@
|
|
|
1
|
+
import * as React from 'react';
|
|
2
|
+
import { adqIconNames } from '../icon';
|
|
3
|
+
import { PopoverProps } from '../pop-base';
|
|
4
|
+
type ContextProps = {
|
|
5
|
+
/**
|
|
6
|
+
* 是否禁用
|
|
7
|
+
*/
|
|
8
|
+
disabled?: boolean;
|
|
9
|
+
/**
|
|
10
|
+
* 值改变的 handler,传递下去由子组件触发
|
|
11
|
+
*/
|
|
12
|
+
handleGroupValueChange?: (checkboxValue: string | number) => void;
|
|
13
|
+
/**
|
|
14
|
+
* 设置尺寸
|
|
15
|
+
*/
|
|
16
|
+
size?: 'small' | 'medium' | 'large';
|
|
17
|
+
/**
|
|
18
|
+
* 已选中的值
|
|
19
|
+
*/
|
|
20
|
+
value?: null | Array<string | number>;
|
|
21
|
+
/**
|
|
22
|
+
* 自定义问号气泡的 Icon
|
|
23
|
+
*/
|
|
24
|
+
helperIcon?: (typeof adqIconNames)[number];
|
|
25
|
+
/**
|
|
26
|
+
* 是否启用文本省略
|
|
27
|
+
*/
|
|
28
|
+
ellipsis?: boolean;
|
|
29
|
+
/**
|
|
30
|
+
* 文本省略的弹出框属性
|
|
31
|
+
*/
|
|
32
|
+
ellipsisPopoverProps?: Omit<PopoverProps, 'popup' | 'children'>;
|
|
33
|
+
};
|
|
34
|
+
export declare const GroupContext: React.Context<ContextProps>;
|
|
35
|
+
export {};
|
|
@@ -0,0 +1,68 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
import { adqIconNames } from '../icon';
|
|
3
|
+
import { PopoverProps } from '../pop-base';
|
|
4
|
+
type ValueType = string | number;
|
|
5
|
+
export interface CheckboxGroupProps<T extends ValueType = ValueType> {
|
|
6
|
+
/**
|
|
7
|
+
* 子节点
|
|
8
|
+
*/
|
|
9
|
+
children?: React.ReactNode;
|
|
10
|
+
/**
|
|
11
|
+
* 附加类名
|
|
12
|
+
*/
|
|
13
|
+
className?: string;
|
|
14
|
+
/**
|
|
15
|
+
* 默认已选中的值
|
|
16
|
+
*/
|
|
17
|
+
defaultValue?: null | Array<T>;
|
|
18
|
+
/**
|
|
19
|
+
* 是否禁用
|
|
20
|
+
*/
|
|
21
|
+
disabled?: boolean;
|
|
22
|
+
/**
|
|
23
|
+
* 选中态变化时的 handler
|
|
24
|
+
*/
|
|
25
|
+
onChange?: null | ((value: Array<T>) => void);
|
|
26
|
+
/**
|
|
27
|
+
* 设置尺寸
|
|
28
|
+
*/
|
|
29
|
+
size?: 'small' | 'medium' | 'large';
|
|
30
|
+
/**
|
|
31
|
+
* 已选中的值
|
|
32
|
+
*/
|
|
33
|
+
value?: null | Array<T>;
|
|
34
|
+
/**
|
|
35
|
+
* 选项列表
|
|
36
|
+
*/
|
|
37
|
+
options?: Array<{
|
|
38
|
+
label: string;
|
|
39
|
+
value: T;
|
|
40
|
+
disabled?: boolean;
|
|
41
|
+
helper?: React.ReactNode;
|
|
42
|
+
}>;
|
|
43
|
+
/**
|
|
44
|
+
* 自定义问号气泡的 Icon
|
|
45
|
+
*/
|
|
46
|
+
helperIcon?: (typeof adqIconNames)[number];
|
|
47
|
+
/**
|
|
48
|
+
* 布局方式
|
|
49
|
+
*/
|
|
50
|
+
layout?: 'horizontal' | 'vertical' | 'grid';
|
|
51
|
+
/**
|
|
52
|
+
* 在 grid 布局方式下的列数
|
|
53
|
+
*/
|
|
54
|
+
columns?: number;
|
|
55
|
+
/**
|
|
56
|
+
* 是否启用文本省略
|
|
57
|
+
*/
|
|
58
|
+
ellipsis?: boolean;
|
|
59
|
+
/**
|
|
60
|
+
* 文本省略的弹出框属性,会将此对象都传递给 <EllipsisText />
|
|
61
|
+
*/
|
|
62
|
+
ellipsisPopoverProps?: Omit<PopoverProps, 'popup' | 'children'>;
|
|
63
|
+
}
|
|
64
|
+
/**
|
|
65
|
+
* 勾选组
|
|
66
|
+
*/
|
|
67
|
+
declare function Group<T extends ValueType = ValueType>({ children, className, defaultValue, disabled, onChange, size, value: valueProp, options, layout, columns, helperIcon, ellipsis, ellipsisPopoverProps, ...otherProps }: CheckboxGroupProps<T>): React.JSX.Element;
|
|
68
|
+
export default Group;
|
|
@@ -0,0 +1,151 @@
|
|
|
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 = ["children", "className", "defaultValue", "disabled", "onChange", "size", "value", "options", "layout", "columns", "helperIcon", "ellipsis", "ellipsisPopoverProps"],
|
|
3
|
+
_excluded2 = ["style"],
|
|
4
|
+
_excluded3 = ["value", "label"];
|
|
5
|
+
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); }
|
|
6
|
+
function ownKeys(e, r) { var t = Object.keys(e); if (Object.getOwnPropertySymbols) { var o = Object.getOwnPropertySymbols(e); r && (o = o.filter(function (r) { return Object.getOwnPropertyDescriptor(e, r).enumerable; })), t.push.apply(t, o); } return t; }
|
|
7
|
+
function _objectSpread(e) { for (var r = 1; r < arguments.length; r++) { var t = null != arguments[r] ? arguments[r] : {}; r % 2 ? ownKeys(Object(t), !0).forEach(function (r) { _defineProperty(e, r, t[r]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(e, Object.getOwnPropertyDescriptors(t)) : ownKeys(Object(t)).forEach(function (r) { Object.defineProperty(e, r, Object.getOwnPropertyDescriptor(t, r)); }); } return e; }
|
|
8
|
+
function _defineProperty(obj, key, value) { key = _toPropertyKey(key); if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; }
|
|
9
|
+
function _toPropertyKey(t) { var i = _toPrimitive(t, "string"); return "symbol" == _typeof(i) ? i : String(i); }
|
|
10
|
+
function _toPrimitive(t, r) { if ("object" != _typeof(t) || !t) return t; var e = t[Symbol.toPrimitive]; if (void 0 !== e) { var i = e.call(t, r || "default"); if ("object" != _typeof(i)) return i; throw new TypeError("@@toPrimitive must return a primitive value."); } return ("string" === r ? String : Number)(t); }
|
|
11
|
+
function _toConsumableArray(arr) { return _arrayWithoutHoles(arr) || _iterableToArray(arr) || _unsupportedIterableToArray(arr) || _nonIterableSpread(); }
|
|
12
|
+
function _nonIterableSpread() { throw new TypeError("Invalid attempt to spread non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method."); }
|
|
13
|
+
function _iterableToArray(iter) { if (typeof Symbol !== "undefined" && iter[Symbol.iterator] != null || iter["@@iterator"] != null) return Array.from(iter); }
|
|
14
|
+
function _arrayWithoutHoles(arr) { if (Array.isArray(arr)) return _arrayLikeToArray(arr); }
|
|
15
|
+
function _slicedToArray(arr, i) { return _arrayWithHoles(arr) || _iterableToArrayLimit(arr, i) || _unsupportedIterableToArray(arr, i) || _nonIterableRest(); }
|
|
16
|
+
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."); }
|
|
17
|
+
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); }
|
|
18
|
+
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; }
|
|
19
|
+
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; } }
|
|
20
|
+
function _arrayWithHoles(arr) { if (Array.isArray(arr)) return arr; }
|
|
21
|
+
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; }
|
|
22
|
+
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; }
|
|
23
|
+
import clsx from 'clsx';
|
|
24
|
+
import React, { useState } from 'react';
|
|
25
|
+
import Checkbox from "./Checkbox";
|
|
26
|
+
import { GroupContext } from "./Context";
|
|
27
|
+
var prefix = 'odn-checkbox';
|
|
28
|
+
/**
|
|
29
|
+
* 勾选组
|
|
30
|
+
*/
|
|
31
|
+
function Group(_ref) {
|
|
32
|
+
var _ref3;
|
|
33
|
+
var children = _ref.children,
|
|
34
|
+
_ref$className = _ref.className,
|
|
35
|
+
className = _ref$className === void 0 ? undefined : _ref$className,
|
|
36
|
+
_ref$defaultValue = _ref.defaultValue,
|
|
37
|
+
defaultValue = _ref$defaultValue === void 0 ? null : _ref$defaultValue,
|
|
38
|
+
_ref$disabled = _ref.disabled,
|
|
39
|
+
disabled = _ref$disabled === void 0 ? false : _ref$disabled,
|
|
40
|
+
_ref$onChange = _ref.onChange,
|
|
41
|
+
onChange = _ref$onChange === void 0 ? null : _ref$onChange,
|
|
42
|
+
_ref$size = _ref.size,
|
|
43
|
+
size = _ref$size === void 0 ? 'medium' : _ref$size,
|
|
44
|
+
_ref$value = _ref.value,
|
|
45
|
+
valueProp = _ref$value === void 0 ? null : _ref$value,
|
|
46
|
+
_ref$options = _ref.options,
|
|
47
|
+
options = _ref$options === void 0 ? [] : _ref$options,
|
|
48
|
+
_ref$layout = _ref.layout,
|
|
49
|
+
layout = _ref$layout === void 0 ? 'horizontal' : _ref$layout,
|
|
50
|
+
_ref$columns = _ref.columns,
|
|
51
|
+
columns = _ref$columns === void 0 ? 3 : _ref$columns,
|
|
52
|
+
helperIcon = _ref.helperIcon,
|
|
53
|
+
ellipsis = _ref.ellipsis,
|
|
54
|
+
ellipsisPopoverProps = _ref.ellipsisPopoverProps,
|
|
55
|
+
otherProps = _objectWithoutProperties(_ref, _excluded);
|
|
56
|
+
/**
|
|
57
|
+
* 初始化 value state
|
|
58
|
+
* 1. 优先判断 Prop value,如果存在 Prop value,则 Group 完全交由外部控制,内部状态无效;
|
|
59
|
+
* 2. 再判断 Prop defaultValue,如果存在默认值,则 Group 状态为此默认值;
|
|
60
|
+
* 3. 最后判断 Checkbox children 是否自身存在 Prop checked。
|
|
61
|
+
*
|
|
62
|
+
* 以上三个判断可能存在冲突,所以在此说明条件判断的优先级。
|
|
63
|
+
*/
|
|
64
|
+
var _useState = useState(function () {
|
|
65
|
+
var checkedValue;
|
|
66
|
+
if (valueProp !== null) {
|
|
67
|
+
checkedValue = valueProp;
|
|
68
|
+
} else if (defaultValue !== null) {
|
|
69
|
+
checkedValue = defaultValue;
|
|
70
|
+
}
|
|
71
|
+
return checkedValue;
|
|
72
|
+
}),
|
|
73
|
+
_useState2 = _slicedToArray(_useState, 2),
|
|
74
|
+
value = _useState2[0],
|
|
75
|
+
setValue = _useState2[1];
|
|
76
|
+
|
|
77
|
+
// 相当于生命周期 getDerivedStateFromProps
|
|
78
|
+
if (Array.isArray(valueProp) && value !== valueProp) {
|
|
79
|
+
setValue(valueProp);
|
|
80
|
+
}
|
|
81
|
+
var handleChange = function handleChange(val) {
|
|
82
|
+
if (onChange) {
|
|
83
|
+
onChange(val);
|
|
84
|
+
}
|
|
85
|
+
};
|
|
86
|
+
var handleGroupValueChange = function handleGroupValueChange(checkboxValue) {
|
|
87
|
+
if (value) {
|
|
88
|
+
/**
|
|
89
|
+
* 不要直接在 value 上进行数组操作,这样会在 setState 之前就改变了 value 的值。
|
|
90
|
+
* shouldComponentUpdate 将会 return false
|
|
91
|
+
*/
|
|
92
|
+
var valueDuplicate = _toConsumableArray(value);
|
|
93
|
+
var index = valueDuplicate.indexOf(checkboxValue);
|
|
94
|
+
if (index !== -1) {
|
|
95
|
+
valueDuplicate.splice(index, 1);
|
|
96
|
+
} else {
|
|
97
|
+
valueDuplicate.push(checkboxValue);
|
|
98
|
+
}
|
|
99
|
+
if (valueProp === null) {
|
|
100
|
+
setValue(valueDuplicate);
|
|
101
|
+
}
|
|
102
|
+
handleChange(valueDuplicate);
|
|
103
|
+
} else {
|
|
104
|
+
if (valueProp === null) {
|
|
105
|
+
setValue([checkboxValue]);
|
|
106
|
+
}
|
|
107
|
+
handleChange([checkboxValue]);
|
|
108
|
+
}
|
|
109
|
+
};
|
|
110
|
+
|
|
111
|
+
// 包装 handleGroupValueChange 以匹配 Context 类型
|
|
112
|
+
var handleGroupValueChangeForContext = function handleGroupValueChangeForContext(checkboxValue) {
|
|
113
|
+
handleGroupValueChange(checkboxValue);
|
|
114
|
+
};
|
|
115
|
+
var classSet = clsx(className, "".concat(prefix, "-group"), _defineProperty({}, "".concat(prefix, "-disabled"), disabled));
|
|
116
|
+
var gridStyle = layout === 'grid' ? {
|
|
117
|
+
'--odn-checkbox-group-columns': columns
|
|
118
|
+
} : undefined;
|
|
119
|
+
var otherStyle = otherProps.style;
|
|
120
|
+
var mergedStyle = gridStyle ? _objectSpread(_objectSpread({}, gridStyle), otherStyle) : otherStyle;
|
|
121
|
+
var _ref2 = otherProps,
|
|
122
|
+
_ = _ref2.style,
|
|
123
|
+
restProps = _objectWithoutProperties(_ref2, _excluded2);
|
|
124
|
+
return /*#__PURE__*/React.createElement(GroupContext.Provider, {
|
|
125
|
+
value: {
|
|
126
|
+
disabled: disabled,
|
|
127
|
+
handleGroupValueChange: handleGroupValueChangeForContext,
|
|
128
|
+
size: size,
|
|
129
|
+
value: (_ref3 = value) !== null && _ref3 !== void 0 ? _ref3 : null,
|
|
130
|
+
helperIcon: helperIcon,
|
|
131
|
+
ellipsis: ellipsis,
|
|
132
|
+
ellipsisPopoverProps: ellipsisPopoverProps
|
|
133
|
+
}
|
|
134
|
+
}, /*#__PURE__*/React.createElement("div", _extends({
|
|
135
|
+
className: classSet,
|
|
136
|
+
"data-odn-checkbox-group-size": size,
|
|
137
|
+
"data-value": value,
|
|
138
|
+
"data-odn-checkbox-group-layout": layout,
|
|
139
|
+
"data-odn-checkbox-group-columns": columns,
|
|
140
|
+
style: mergedStyle
|
|
141
|
+
}, restProps), (options === null || options === void 0 ? void 0 : options.length) > 0 ? options.map(function (_ref4) {
|
|
142
|
+
var value = _ref4.value,
|
|
143
|
+
label = _ref4.label,
|
|
144
|
+
otherProps = _objectWithoutProperties(_ref4, _excluded3);
|
|
145
|
+
return /*#__PURE__*/React.createElement(Checkbox, _extends({
|
|
146
|
+
key: value,
|
|
147
|
+
value: value
|
|
148
|
+
}, otherProps), label);
|
|
149
|
+
}) : children));
|
|
150
|
+
}
|
|
151
|
+
export default Group;
|