@arco-design/mobile-react 2.29.5 → 2.30.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +25 -0
- package/README.en-US.md +2 -2
- package/README.md +2 -2
- package/cjs/_helpers/hooks.d.ts +242 -2
- package/cjs/_helpers/hooks.js +267 -10
- package/cjs/_helpers/index.d.ts +78 -1
- package/cjs/_helpers/index.js +87 -8
- package/cjs/action-sheet/demo/style/css/mobile.css +514 -1
- package/cjs/action-sheet/demo/style/mobile.less +32 -0
- package/cjs/action-sheet/style/css/index.css +597 -2
- package/cjs/action-sheet/style/index.less +62 -0
- package/cjs/avatar/demo/style/css/mobile.css +518 -1
- package/cjs/avatar/demo/style/mobile.less +41 -1
- package/cjs/avatar/style/css/index.css +529 -3
- package/cjs/avatar/style/index.less +54 -1
- package/cjs/badge/demo/style/css/mobile.css +520 -1
- package/cjs/badge/demo/style/mobile.less +40 -0
- package/cjs/badge/style/css/index.css +518 -1
- package/cjs/badge/style/index.less +36 -0
- package/cjs/button/demo/style/css/mobile.css +510 -0
- package/cjs/button/demo/style/mobile.less +25 -0
- package/cjs/button/style/css/index.css +616 -39
- package/cjs/button/style/index.less +135 -25
- package/cjs/carousel/demo/style/css/mobile.css +514 -0
- package/cjs/carousel/demo/style/mobile.less +33 -0
- package/cjs/carousel/style/css/index.css +525 -3
- package/cjs/carousel/style/index.less +55 -0
- package/cjs/cell/demo/style/css/mobile.css +521 -0
- package/cjs/cell/demo/style/mobile.less +46 -0
- package/cjs/cell/style/css/index.css +707 -2
- package/cjs/cell/style/index.less +96 -0
- package/cjs/checkbox/demo/style/css/mobile.css +510 -0
- package/cjs/checkbox/demo/style/mobile.less +25 -0
- package/cjs/checkbox/style/css/index.css +535 -4
- package/cjs/checkbox/style/index.less +61 -0
- package/cjs/circle-progress/demo/style/css/mobile.css +510 -0
- package/cjs/circle-progress/demo/style/mobile.less +25 -0
- package/cjs/circle-progress/style/css/index.css +527 -3
- package/cjs/circle-progress/style/index.less +49 -0
- package/cjs/collapse/demo/style/css/mobile.css +510 -0
- package/cjs/collapse/demo/style/mobile.less +25 -0
- package/cjs/collapse/style/css/index.css +557 -1
- package/cjs/collapse/style/index.less +53 -0
- package/cjs/context-provider/demo/style/css/mobile.css +510 -0
- package/cjs/context-provider/demo/style/mobile.less +25 -0
- package/cjs/context-provider/index.d.ts +10 -3
- package/cjs/context-provider/index.js +40 -7
- package/cjs/count-down/demo/style/css/mobile.css +518 -2
- package/cjs/count-down/demo/style/mobile.less +39 -0
- package/cjs/count-down/style/css/index.css +513 -0
- package/cjs/count-down/style/index.less +30 -0
- package/cjs/date-picker/demo/style/css/mobile.css +510 -0
- package/cjs/date-picker/demo/style/mobile.less +25 -0
- package/cjs/date-picker/style/css/index.css +510 -0
- package/cjs/date-picker/style/index.less +25 -0
- package/cjs/dialog/demo/style/css/mobile.css +520 -1
- package/cjs/dialog/demo/style/mobile.less +44 -0
- package/cjs/dialog/style/css/index.css +645 -4
- package/cjs/dialog/style/index.less +102 -0
- package/cjs/divider/demo/style/css/mobile.css +510 -1
- package/cjs/divider/demo/style/mobile.less +26 -2
- package/cjs/divider/style/css/index.css +516 -0
- package/cjs/divider/style/index.less +44 -9
- package/cjs/dropdown/demo/style/css/mobile.css +510 -0
- package/cjs/dropdown/demo/style/mobile.less +25 -0
- package/cjs/dropdown/style/css/index.css +542 -6
- package/cjs/dropdown/style/index.less +69 -0
- package/cjs/dropdown-menu/demo/style/css/mobile.css +510 -0
- package/cjs/dropdown-menu/demo/style/mobile.less +25 -0
- package/cjs/dropdown-menu/style/css/index.css +566 -3
- package/cjs/dropdown-menu/style/index.less +62 -0
- package/cjs/ellipsis/demo/style/css/mobile.css +519 -1
- package/cjs/ellipsis/demo/style/mobile.less +39 -0
- package/cjs/ellipsis/style/css/index.css +514 -0
- package/cjs/ellipsis/style/index.less +32 -0
- package/cjs/form/style/css/index.css +538 -5
- package/cjs/form/style/index.less +66 -3
- package/cjs/grid/demo/style/css/mobile.css +525 -3
- package/cjs/grid/demo/style/mobile.less +47 -0
- package/cjs/grid/style/css/index.css +519 -0
- package/cjs/grid/style/index.less +48 -0
- package/cjs/image/demo/style/css/mobile.css +510 -0
- package/cjs/image/demo/style/mobile.less +25 -0
- package/cjs/image/index.d.ts +7 -7
- package/cjs/image/index.js +81 -61
- package/cjs/image/style/css/index.css +551 -7
- package/cjs/image/style/index.less +54 -0
- package/cjs/image-picker/demo/style/css/mobile.css +510 -0
- package/cjs/image-picker/demo/style/mobile.less +25 -0
- package/cjs/image-picker/style/css/index.css +529 -4
- package/cjs/image-picker/style/index.less +54 -0
- package/cjs/image-preview/demo/style/css/mobile.css +510 -0
- package/cjs/image-preview/demo/style/mobile.less +25 -0
- package/cjs/image-preview/index.js +6 -2
- package/cjs/image-preview/methods.d.ts +1 -0
- package/cjs/image-preview/methods.js +7 -2
- package/cjs/image-preview/style/css/index.css +530 -5
- package/cjs/image-preview/style/index.less +37 -0
- package/cjs/index-bar/demo/style/css/mobile.css +510 -0
- package/cjs/index-bar/demo/style/mobile.less +25 -0
- package/cjs/index-bar/style/css/index.css +572 -8
- package/cjs/index-bar/style/index.less +67 -0
- package/cjs/input/demo/style/css/mobile.css +514 -1
- package/cjs/input/demo/style/mobile.less +32 -0
- package/cjs/input/style/css/index.css +589 -2
- package/cjs/input/style/index.less +87 -0
- package/cjs/keyboard/demo/style/css/mobile.css +516 -0
- package/cjs/keyboard/demo/style/mobile.less +35 -1
- package/cjs/keyboard/style/css/index.css +526 -2
- package/cjs/keyboard/style/index.less +51 -0
- package/cjs/load-more/demo/style/css/mobile.css +513 -0
- package/cjs/load-more/demo/style/mobile.less +30 -0
- package/cjs/load-more/style/css/index.css +513 -0
- package/cjs/load-more/style/index.less +30 -0
- package/cjs/loading/demo/style/css/mobile.css +510 -0
- package/cjs/loading/demo/style/mobile.less +25 -0
- package/cjs/loading/style/css/index.css +534 -5
- package/cjs/loading/style/index.less +45 -0
- package/cjs/masking/demo/style/css/mobile.css +514 -1
- package/cjs/masking/demo/style/mobile.less +30 -0
- package/cjs/masking/methods.js +7 -2
- package/cjs/masking/style/css/index.css +510 -0
- package/cjs/masking/style/index.less +25 -0
- package/cjs/nav-bar/demo/style/css/mobile.css +514 -1
- package/cjs/nav-bar/demo/style/mobile.less +33 -1
- package/cjs/nav-bar/style/css/index.css +550 -1
- package/cjs/nav-bar/style/index.less +38 -0
- package/cjs/notice-bar/style/css/index.css +520 -2
- package/cjs/notice-bar/style/index.less +36 -0
- package/cjs/notify/demo/style/css/mobile.css +510 -0
- package/cjs/notify/demo/style/mobile.less +25 -0
- package/cjs/notify/style/css/index.css +529 -4
- package/cjs/notify/style/index.less +50 -0
- package/cjs/pagination/demo/style/css/index.css +510 -0
- package/cjs/pagination/demo/style/index.less +25 -0
- package/cjs/pagination/style/css/index.css +543 -4
- package/cjs/pagination/style/index.less +72 -0
- package/cjs/picker/demo/style/css/mobile.css +510 -0
- package/cjs/picker/demo/style/mobile.less +25 -0
- package/cjs/picker/style/css/index.css +525 -3
- package/cjs/picker/style/index.less +49 -0
- package/cjs/picker-view/demo/style/css/mobile.css +510 -0
- package/cjs/picker-view/demo/style/mobile.less +25 -0
- package/cjs/picker-view/style/css/index.css +587 -0
- package/cjs/picker-view/style/index.less +50 -0
- package/cjs/popover/demo/style/css/mobile.css +510 -0
- package/cjs/popover/demo/style/mobile.less +25 -0
- package/cjs/popover/style/css/index.css +614 -4
- package/cjs/popover/style/css/menu.css +539 -1
- package/cjs/popover/style/index.less +126 -9
- package/cjs/popover/style/menu.less +69 -0
- package/cjs/popup/demo/style/css/mobile.css +517 -0
- package/cjs/popup/demo/style/mobile.less +38 -0
- package/cjs/popup/style/css/index.css +514 -1
- package/cjs/popup/style/index.less +32 -0
- package/cjs/popup-swiper/demo/style/css/mobile.css +517 -0
- package/cjs/popup-swiper/demo/style/mobile.less +38 -0
- package/cjs/popup-swiper/index.d.ts +2 -8
- package/cjs/popup-swiper/style/css/index.css +510 -0
- package/cjs/popup-swiper/style/index.less +25 -0
- package/cjs/portal/demo/style/css/mobile.css +515 -1
- package/cjs/portal/demo/style/mobile.less +31 -0
- package/cjs/progress/demo/style/css/mobile.css +510 -0
- package/cjs/progress/demo/style/mobile.less +25 -0
- package/cjs/progress/style/css/index.css +556 -8
- package/cjs/progress/style/index.less +91 -0
- package/cjs/pull-refresh/demo/style/css/mobile.css +514 -2
- package/cjs/pull-refresh/demo/style/mobile.less +35 -2
- package/cjs/pull-refresh/style/css/index.css +536 -3
- package/cjs/pull-refresh/style/index.less +45 -0
- package/cjs/radio/demo/style/css/mobile.css +513 -0
- package/cjs/radio/demo/style/mobile.less +32 -0
- package/cjs/radio/style/css/index.css +535 -4
- package/cjs/radio/style/index.less +61 -0
- package/cjs/rate/demo/style/css/mobile.css +510 -0
- package/cjs/rate/demo/style/mobile.less +25 -0
- package/cjs/rate/style/css/index.css +522 -2
- package/cjs/rate/style/index.less +43 -0
- package/cjs/search-bar/demo/style/css/mobile.css +516 -1
- package/cjs/search-bar/demo/style/mobile.less +39 -5
- package/cjs/search-bar/style/css/index.css +586 -6
- package/cjs/search-bar/style/index.less +84 -0
- package/cjs/show-monitor/demo/style/css/mobile.css +521 -2
- package/cjs/show-monitor/demo/style/mobile.less +43 -1
- package/cjs/skeleton/demo/style/css/mobile.css +510 -0
- package/cjs/skeleton/demo/style/mobile.less +25 -0
- package/cjs/skeleton/style/css/index.css +517 -1
- package/cjs/skeleton/style/index.less +35 -0
- package/cjs/slider/demo/style/css/mobile.css +514 -1
- package/cjs/slider/demo/style/mobile.less +34 -0
- package/cjs/slider/style/css/index.css +542 -5
- package/cjs/slider/style/index.less +74 -0
- package/cjs/stepper/demo/style/css/mobile.css +510 -0
- package/cjs/stepper/demo/style/mobile.less +25 -1
- package/cjs/stepper/style/css/index.css +551 -7
- package/cjs/stepper/style/index.less +84 -3
- package/cjs/steps/demo/style/css/mobile.css +544 -4
- package/cjs/steps/demo/style/mobile.less +41 -3
- package/cjs/steps/style/css/index.css +580 -9
- package/cjs/steps/style/index.less +138 -0
- package/cjs/steps/type.d.ts +1 -1
- package/cjs/sticky/demo/style/css/mobile.css +515 -2
- package/cjs/sticky/demo/style/mobile.less +34 -2
- package/cjs/sticky/style/css/index.css +510 -0
- package/cjs/sticky/style/index.less +25 -0
- package/cjs/swipe-action/demo/style/css/mobile.css +510 -0
- package/cjs/swipe-action/demo/style/mobile.less +25 -0
- package/cjs/swipe-action/style/css/index.css +518 -2
- package/cjs/swipe-action/style/index.less +43 -0
- package/cjs/swipe-load/demo/style/css/mobile.css +539 -5
- package/cjs/swipe-load/demo/style/mobile.less +64 -0
- package/cjs/swipe-load/style/css/index.css +517 -1
- package/cjs/swipe-load/style/index.less +37 -0
- package/cjs/switch/demo/style/css/mobile.css +515 -1
- package/cjs/switch/demo/style/mobile.less +35 -0
- package/cjs/switch/style/css/index.css +532 -4
- package/cjs/switch/style/index.less +59 -0
- package/cjs/tab-bar/demo/style/css/mobile.css +510 -0
- package/cjs/tab-bar/demo/style/mobile.less +25 -0
- package/cjs/tab-bar/style/css/index.css +517 -1
- package/cjs/tab-bar/style/index.less +37 -0
- package/cjs/tabs/demo/style/css/mobile.css +542 -5
- package/cjs/tabs/demo/style/mobile.less +75 -0
- package/cjs/tabs/index.js +4 -1
- package/cjs/tabs/style/css/index.css +618 -13
- package/cjs/tabs/style/index.less +123 -0
- package/cjs/tabs/tab-cell.js +1 -1
- package/cjs/tag/demo/style/css/mobile.css +510 -0
- package/cjs/tag/demo/style/mobile.less +25 -0
- package/cjs/tag/style/css/index.css +538 -10
- package/cjs/tag/style/index.less +55 -0
- package/cjs/textarea/demo/style/css/mobile.css +514 -1
- package/cjs/textarea/demo/style/mobile.less +32 -1
- package/cjs/textarea/style/css/index.css +527 -2
- package/cjs/textarea/style/index.less +47 -0
- package/cjs/toast/demo/style/css/mobile.css +510 -0
- package/cjs/toast/demo/style/mobile.less +25 -0
- package/cjs/toast/style/css/index.css +530 -5
- package/cjs/toast/style/index.less +37 -0
- package/cjs/transition/demo/style/css/mobile.css +510 -0
- package/cjs/transition/demo/style/mobile.less +25 -0
- package/cjs/transition/style/css/index.css +510 -0
- package/cjs/transition/style/index.less +25 -0
- package/dist/index.js +1196 -117
- package/dist/index.min.js +4 -4
- package/dist/style.css +28002 -211
- package/dist/style.min.css +1 -1
- package/esm/_helpers/hooks.d.ts +242 -2
- package/esm/_helpers/hooks.js +269 -10
- package/esm/_helpers/index.d.ts +78 -1
- package/esm/_helpers/index.js +80 -1
- package/esm/action-sheet/demo/style/css/mobile.css +514 -1
- package/esm/action-sheet/demo/style/mobile.less +32 -0
- package/esm/action-sheet/style/css/index.css +597 -2
- package/esm/action-sheet/style/index.less +62 -0
- package/esm/avatar/demo/style/css/mobile.css +518 -1
- package/esm/avatar/demo/style/mobile.less +41 -1
- package/esm/avatar/style/css/index.css +529 -3
- package/esm/avatar/style/index.less +54 -1
- package/esm/badge/demo/style/css/mobile.css +520 -1
- package/esm/badge/demo/style/mobile.less +40 -0
- package/esm/badge/style/css/index.css +518 -1
- package/esm/badge/style/index.less +36 -0
- package/esm/button/demo/style/css/mobile.css +510 -0
- package/esm/button/demo/style/mobile.less +25 -0
- package/esm/button/style/css/index.css +616 -39
- package/esm/button/style/index.less +135 -25
- package/esm/carousel/demo/style/css/mobile.css +514 -0
- package/esm/carousel/demo/style/mobile.less +33 -0
- package/esm/carousel/style/css/index.css +525 -3
- package/esm/carousel/style/index.less +55 -0
- package/esm/cell/demo/style/css/mobile.css +521 -0
- package/esm/cell/demo/style/mobile.less +46 -0
- package/esm/cell/style/css/index.css +707 -2
- package/esm/cell/style/index.less +96 -0
- package/esm/checkbox/demo/style/css/mobile.css +510 -0
- package/esm/checkbox/demo/style/mobile.less +25 -0
- package/esm/checkbox/style/css/index.css +535 -4
- package/esm/checkbox/style/index.less +61 -0
- package/esm/circle-progress/demo/style/css/mobile.css +510 -0
- package/esm/circle-progress/demo/style/mobile.less +25 -0
- package/esm/circle-progress/style/css/index.css +527 -3
- package/esm/circle-progress/style/index.less +49 -0
- package/esm/collapse/demo/style/css/mobile.css +510 -0
- package/esm/collapse/demo/style/mobile.less +25 -0
- package/esm/collapse/style/css/index.css +557 -1
- package/esm/collapse/style/index.less +53 -0
- package/esm/context-provider/demo/style/css/mobile.css +510 -0
- package/esm/context-provider/demo/style/mobile.less +25 -0
- package/esm/context-provider/index.d.ts +10 -3
- package/esm/context-provider/index.js +41 -8
- package/esm/count-down/demo/style/css/mobile.css +518 -2
- package/esm/count-down/demo/style/mobile.less +39 -0
- package/esm/count-down/style/css/index.css +513 -0
- package/esm/count-down/style/index.less +30 -0
- package/esm/date-picker/demo/style/css/mobile.css +510 -0
- package/esm/date-picker/demo/style/mobile.less +25 -0
- package/esm/date-picker/style/css/index.css +510 -0
- package/esm/date-picker/style/index.less +25 -0
- package/esm/dialog/demo/style/css/mobile.css +520 -1
- package/esm/dialog/demo/style/mobile.less +44 -0
- package/esm/dialog/style/css/index.css +645 -4
- package/esm/dialog/style/index.less +102 -0
- package/esm/divider/demo/style/css/mobile.css +510 -1
- package/esm/divider/demo/style/mobile.less +26 -2
- package/esm/divider/style/css/index.css +516 -0
- package/esm/divider/style/index.less +44 -9
- package/esm/dropdown/demo/style/css/mobile.css +510 -0
- package/esm/dropdown/demo/style/mobile.less +25 -0
- package/esm/dropdown/style/css/index.css +542 -6
- package/esm/dropdown/style/index.less +69 -0
- package/esm/dropdown-menu/demo/style/css/mobile.css +510 -0
- package/esm/dropdown-menu/demo/style/mobile.less +25 -0
- package/esm/dropdown-menu/style/css/index.css +566 -3
- package/esm/dropdown-menu/style/index.less +62 -0
- package/esm/ellipsis/demo/style/css/mobile.css +519 -1
- package/esm/ellipsis/demo/style/mobile.less +39 -0
- package/esm/ellipsis/style/css/index.css +514 -0
- package/esm/ellipsis/style/index.less +32 -0
- package/esm/form/style/css/index.css +538 -5
- package/esm/form/style/index.less +66 -3
- package/esm/grid/demo/style/css/mobile.css +525 -3
- package/esm/grid/demo/style/mobile.less +47 -0
- package/esm/grid/style/css/index.css +519 -0
- package/esm/grid/style/index.less +48 -0
- package/esm/image/demo/style/css/mobile.css +510 -0
- package/esm/image/demo/style/mobile.less +25 -0
- package/esm/image/index.d.ts +7 -7
- package/esm/image/index.js +81 -61
- package/esm/image/style/css/index.css +551 -7
- package/esm/image/style/index.less +54 -0
- package/esm/image-picker/demo/style/css/mobile.css +510 -0
- package/esm/image-picker/demo/style/mobile.less +25 -0
- package/esm/image-picker/style/css/index.css +529 -4
- package/esm/image-picker/style/index.less +54 -0
- package/esm/image-preview/demo/style/css/mobile.css +510 -0
- package/esm/image-preview/demo/style/mobile.less +25 -0
- package/esm/image-preview/index.js +6 -2
- package/esm/image-preview/methods.d.ts +1 -0
- package/esm/image-preview/methods.js +7 -3
- package/esm/image-preview/style/css/index.css +530 -5
- package/esm/image-preview/style/index.less +37 -0
- package/esm/index-bar/demo/style/css/mobile.css +510 -0
- package/esm/index-bar/demo/style/mobile.less +25 -0
- package/esm/index-bar/style/css/index.css +572 -8
- package/esm/index-bar/style/index.less +67 -0
- package/esm/input/demo/style/css/mobile.css +514 -1
- package/esm/input/demo/style/mobile.less +32 -0
- package/esm/input/style/css/index.css +589 -2
- package/esm/input/style/index.less +87 -0
- package/esm/keyboard/demo/style/css/mobile.css +516 -0
- package/esm/keyboard/demo/style/mobile.less +35 -1
- package/esm/keyboard/style/css/index.css +526 -2
- package/esm/keyboard/style/index.less +51 -0
- package/esm/load-more/demo/style/css/mobile.css +513 -0
- package/esm/load-more/demo/style/mobile.less +30 -0
- package/esm/load-more/style/css/index.css +513 -0
- package/esm/load-more/style/index.less +30 -0
- package/esm/loading/demo/style/css/mobile.css +510 -0
- package/esm/loading/demo/style/mobile.less +25 -0
- package/esm/loading/style/css/index.css +534 -5
- package/esm/loading/style/index.less +45 -0
- package/esm/masking/demo/style/css/mobile.css +514 -1
- package/esm/masking/demo/style/mobile.less +30 -0
- package/esm/masking/methods.js +7 -3
- package/esm/masking/style/css/index.css +510 -0
- package/esm/masking/style/index.less +25 -0
- package/esm/nav-bar/demo/style/css/mobile.css +514 -1
- package/esm/nav-bar/demo/style/mobile.less +33 -1
- package/esm/nav-bar/style/css/index.css +550 -1
- package/esm/nav-bar/style/index.less +38 -0
- package/esm/notice-bar/style/css/index.css +520 -2
- package/esm/notice-bar/style/index.less +36 -0
- package/esm/notify/demo/style/css/mobile.css +510 -0
- package/esm/notify/demo/style/mobile.less +25 -0
- package/esm/notify/style/css/index.css +529 -4
- package/esm/notify/style/index.less +50 -0
- package/esm/pagination/demo/style/css/index.css +510 -0
- package/esm/pagination/demo/style/index.less +25 -0
- package/esm/pagination/style/css/index.css +543 -4
- package/esm/pagination/style/index.less +72 -0
- package/esm/picker/demo/style/css/mobile.css +510 -0
- package/esm/picker/demo/style/mobile.less +25 -0
- package/esm/picker/style/css/index.css +525 -3
- package/esm/picker/style/index.less +49 -0
- package/esm/picker-view/demo/style/css/mobile.css +510 -0
- package/esm/picker-view/demo/style/mobile.less +25 -0
- package/esm/picker-view/style/css/index.css +587 -0
- package/esm/picker-view/style/index.less +50 -0
- package/esm/popover/demo/style/css/mobile.css +510 -0
- package/esm/popover/demo/style/mobile.less +25 -0
- package/esm/popover/style/css/index.css +614 -4
- package/esm/popover/style/css/menu.css +539 -1
- package/esm/popover/style/index.less +126 -9
- package/esm/popover/style/menu.less +69 -0
- package/esm/popup/demo/style/css/mobile.css +517 -0
- package/esm/popup/demo/style/mobile.less +38 -0
- package/esm/popup/style/css/index.css +514 -1
- package/esm/popup/style/index.less +32 -0
- package/esm/popup-swiper/demo/style/css/mobile.css +517 -0
- package/esm/popup-swiper/demo/style/mobile.less +38 -0
- package/esm/popup-swiper/index.d.ts +2 -8
- package/esm/popup-swiper/style/css/index.css +510 -0
- package/esm/popup-swiper/style/index.less +25 -0
- package/esm/portal/demo/style/css/mobile.css +515 -1
- package/esm/portal/demo/style/mobile.less +31 -0
- package/esm/progress/demo/style/css/mobile.css +510 -0
- package/esm/progress/demo/style/mobile.less +25 -0
- package/esm/progress/style/css/index.css +556 -8
- package/esm/progress/style/index.less +91 -0
- package/esm/pull-refresh/demo/style/css/mobile.css +514 -2
- package/esm/pull-refresh/demo/style/mobile.less +35 -2
- package/esm/pull-refresh/style/css/index.css +536 -3
- package/esm/pull-refresh/style/index.less +45 -0
- package/esm/radio/demo/style/css/mobile.css +513 -0
- package/esm/radio/demo/style/mobile.less +32 -0
- package/esm/radio/style/css/index.css +535 -4
- package/esm/radio/style/index.less +61 -0
- package/esm/rate/demo/style/css/mobile.css +510 -0
- package/esm/rate/demo/style/mobile.less +25 -0
- package/esm/rate/style/css/index.css +522 -2
- package/esm/rate/style/index.less +43 -0
- package/esm/search-bar/demo/style/css/mobile.css +516 -1
- package/esm/search-bar/demo/style/mobile.less +39 -5
- package/esm/search-bar/style/css/index.css +586 -6
- package/esm/search-bar/style/index.less +84 -0
- package/esm/show-monitor/demo/style/css/mobile.css +521 -2
- package/esm/show-monitor/demo/style/mobile.less +43 -1
- package/esm/skeleton/demo/style/css/mobile.css +510 -0
- package/esm/skeleton/demo/style/mobile.less +25 -0
- package/esm/skeleton/style/css/index.css +517 -1
- package/esm/skeleton/style/index.less +35 -0
- package/esm/slider/demo/style/css/mobile.css +514 -1
- package/esm/slider/demo/style/mobile.less +34 -0
- package/esm/slider/style/css/index.css +542 -5
- package/esm/slider/style/index.less +74 -0
- package/esm/stepper/demo/style/css/mobile.css +510 -0
- package/esm/stepper/demo/style/mobile.less +25 -1
- package/esm/stepper/style/css/index.css +551 -7
- package/esm/stepper/style/index.less +84 -3
- package/esm/steps/demo/style/css/mobile.css +544 -4
- package/esm/steps/demo/style/mobile.less +41 -3
- package/esm/steps/style/css/index.css +580 -9
- package/esm/steps/style/index.less +138 -0
- package/esm/steps/type.d.ts +1 -1
- package/esm/sticky/demo/style/css/mobile.css +515 -2
- package/esm/sticky/demo/style/mobile.less +34 -2
- package/esm/sticky/style/css/index.css +510 -0
- package/esm/sticky/style/index.less +25 -0
- package/esm/swipe-action/demo/style/css/mobile.css +510 -0
- package/esm/swipe-action/demo/style/mobile.less +25 -0
- package/esm/swipe-action/style/css/index.css +518 -2
- package/esm/swipe-action/style/index.less +43 -0
- package/esm/swipe-load/demo/style/css/mobile.css +539 -5
- package/esm/swipe-load/demo/style/mobile.less +64 -0
- package/esm/swipe-load/style/css/index.css +517 -1
- package/esm/swipe-load/style/index.less +37 -0
- package/esm/switch/demo/style/css/mobile.css +515 -1
- package/esm/switch/demo/style/mobile.less +35 -0
- package/esm/switch/style/css/index.css +532 -4
- package/esm/switch/style/index.less +59 -0
- package/esm/tab-bar/demo/style/css/mobile.css +510 -0
- package/esm/tab-bar/demo/style/mobile.less +25 -0
- package/esm/tab-bar/style/css/index.css +517 -1
- package/esm/tab-bar/style/index.less +37 -0
- package/esm/tabs/demo/style/css/mobile.css +542 -5
- package/esm/tabs/demo/style/mobile.less +75 -0
- package/esm/tabs/index.js +4 -1
- package/esm/tabs/style/css/index.css +618 -13
- package/esm/tabs/style/index.less +123 -0
- package/esm/tabs/tab-cell.js +1 -1
- package/esm/tag/demo/style/css/mobile.css +510 -0
- package/esm/tag/demo/style/mobile.less +25 -0
- package/esm/tag/style/css/index.css +538 -10
- package/esm/tag/style/index.less +55 -0
- package/esm/textarea/demo/style/css/mobile.css +514 -1
- package/esm/textarea/demo/style/mobile.less +32 -1
- package/esm/textarea/style/css/index.css +527 -2
- package/esm/textarea/style/index.less +47 -0
- package/esm/toast/demo/style/css/mobile.css +510 -0
- package/esm/toast/demo/style/mobile.less +25 -0
- package/esm/toast/style/css/index.css +530 -5
- package/esm/toast/style/index.less +37 -0
- package/esm/transition/demo/style/css/mobile.css +510 -0
- package/esm/transition/demo/style/mobile.less +25 -0
- package/esm/transition/style/css/index.css +510 -0
- package/esm/transition/style/index.less +25 -0
- package/less-loader.config.js +6 -0
- package/package.json +3 -3
- package/style/css/public.css +510 -0
- package/tokens/app/arcodesign/default/css-variables.less +357 -103
- package/tokens/app/arcodesign/default/index.d.ts +257 -3
- package/tokens/app/arcodesign/default/index.js +357 -103
- package/tokens/app/arcodesign/default/index.json +2574 -526
- package/tokens/app/arcodesign/default/index.less +357 -103
- package/tokens/mixin/index.less +255 -1
- package/umd/_helpers/hooks.d.ts +242 -2
- package/umd/_helpers/hooks.js +267 -10
- package/umd/_helpers/index.d.ts +78 -1
- package/umd/_helpers/index.js +89 -10
- package/umd/action-sheet/demo/style/css/mobile.css +514 -1
- package/umd/action-sheet/demo/style/mobile.less +32 -0
- package/umd/action-sheet/style/css/index.css +597 -2
- package/umd/action-sheet/style/index.less +62 -0
- package/umd/avatar/demo/style/css/mobile.css +518 -1
- package/umd/avatar/demo/style/mobile.less +41 -1
- package/umd/avatar/style/css/index.css +529 -3
- package/umd/avatar/style/index.less +54 -1
- package/umd/badge/demo/style/css/mobile.css +520 -1
- package/umd/badge/demo/style/mobile.less +40 -0
- package/umd/badge/style/css/index.css +518 -1
- package/umd/badge/style/index.less +36 -0
- package/umd/button/demo/style/css/mobile.css +510 -0
- package/umd/button/demo/style/mobile.less +25 -0
- package/umd/button/style/css/index.css +616 -39
- package/umd/button/style/index.less +135 -25
- package/umd/carousel/demo/style/css/mobile.css +514 -0
- package/umd/carousel/demo/style/mobile.less +33 -0
- package/umd/carousel/style/css/index.css +525 -3
- package/umd/carousel/style/index.less +55 -0
- package/umd/cell/demo/style/css/mobile.css +521 -0
- package/umd/cell/demo/style/mobile.less +46 -0
- package/umd/cell/style/css/index.css +707 -2
- package/umd/cell/style/index.less +96 -0
- package/umd/checkbox/demo/style/css/mobile.css +510 -0
- package/umd/checkbox/demo/style/mobile.less +25 -0
- package/umd/checkbox/style/css/index.css +535 -4
- package/umd/checkbox/style/index.less +61 -0
- package/umd/circle-progress/demo/style/css/mobile.css +510 -0
- package/umd/circle-progress/demo/style/mobile.less +25 -0
- package/umd/circle-progress/style/css/index.css +527 -3
- package/umd/circle-progress/style/index.less +49 -0
- package/umd/collapse/demo/style/css/mobile.css +510 -0
- package/umd/collapse/demo/style/mobile.less +25 -0
- package/umd/collapse/style/css/index.css +557 -1
- package/umd/collapse/style/index.less +53 -0
- package/umd/context-provider/demo/style/css/mobile.css +510 -0
- package/umd/context-provider/demo/style/mobile.less +25 -0
- package/umd/context-provider/index.d.ts +10 -3
- package/umd/context-provider/index.js +40 -7
- package/umd/count-down/demo/style/css/mobile.css +518 -2
- package/umd/count-down/demo/style/mobile.less +39 -0
- package/umd/count-down/style/css/index.css +513 -0
- package/umd/count-down/style/index.less +30 -0
- package/umd/date-picker/demo/style/css/mobile.css +510 -0
- package/umd/date-picker/demo/style/mobile.less +25 -0
- package/umd/date-picker/style/css/index.css +510 -0
- package/umd/date-picker/style/index.less +25 -0
- package/umd/dialog/demo/style/css/mobile.css +520 -1
- package/umd/dialog/demo/style/mobile.less +44 -0
- package/umd/dialog/style/css/index.css +645 -4
- package/umd/dialog/style/index.less +102 -0
- package/umd/divider/demo/style/css/mobile.css +510 -1
- package/umd/divider/demo/style/mobile.less +26 -2
- package/umd/divider/style/css/index.css +516 -0
- package/umd/divider/style/index.less +44 -9
- package/umd/dropdown/demo/style/css/mobile.css +510 -0
- package/umd/dropdown/demo/style/mobile.less +25 -0
- package/umd/dropdown/style/css/index.css +542 -6
- package/umd/dropdown/style/index.less +69 -0
- package/umd/dropdown-menu/demo/style/css/mobile.css +510 -0
- package/umd/dropdown-menu/demo/style/mobile.less +25 -0
- package/umd/dropdown-menu/style/css/index.css +566 -3
- package/umd/dropdown-menu/style/index.less +62 -0
- package/umd/ellipsis/demo/style/css/mobile.css +519 -1
- package/umd/ellipsis/demo/style/mobile.less +39 -0
- package/umd/ellipsis/style/css/index.css +514 -0
- package/umd/ellipsis/style/index.less +32 -0
- package/umd/form/style/css/index.css +538 -5
- package/umd/form/style/index.less +66 -3
- package/umd/grid/demo/style/css/mobile.css +525 -3
- package/umd/grid/demo/style/mobile.less +47 -0
- package/umd/grid/style/css/index.css +519 -0
- package/umd/grid/style/index.less +48 -0
- package/umd/image/demo/style/css/mobile.css +510 -0
- package/umd/image/demo/style/mobile.less +25 -0
- package/umd/image/index.d.ts +7 -7
- package/umd/image/index.js +81 -61
- package/umd/image/style/css/index.css +551 -7
- package/umd/image/style/index.less +54 -0
- package/umd/image-picker/demo/style/css/mobile.css +510 -0
- package/umd/image-picker/demo/style/mobile.less +25 -0
- package/umd/image-picker/style/css/index.css +529 -4
- package/umd/image-picker/style/index.less +54 -0
- package/umd/image-preview/demo/style/css/mobile.css +510 -0
- package/umd/image-preview/demo/style/mobile.less +25 -0
- package/umd/image-preview/index.js +6 -2
- package/umd/image-preview/methods.d.ts +1 -0
- package/umd/image-preview/methods.js +7 -2
- package/umd/image-preview/style/css/index.css +530 -5
- package/umd/image-preview/style/index.less +37 -0
- package/umd/index-bar/demo/style/css/mobile.css +510 -0
- package/umd/index-bar/demo/style/mobile.less +25 -0
- package/umd/index-bar/style/css/index.css +572 -8
- package/umd/index-bar/style/index.less +67 -0
- package/umd/input/demo/style/css/mobile.css +514 -1
- package/umd/input/demo/style/mobile.less +32 -0
- package/umd/input/style/css/index.css +589 -2
- package/umd/input/style/index.less +87 -0
- package/umd/keyboard/demo/style/css/mobile.css +516 -0
- package/umd/keyboard/demo/style/mobile.less +35 -1
- package/umd/keyboard/style/css/index.css +526 -2
- package/umd/keyboard/style/index.less +51 -0
- package/umd/load-more/demo/style/css/mobile.css +513 -0
- package/umd/load-more/demo/style/mobile.less +30 -0
- package/umd/load-more/style/css/index.css +513 -0
- package/umd/load-more/style/index.less +30 -0
- package/umd/loading/demo/style/css/mobile.css +510 -0
- package/umd/loading/demo/style/mobile.less +25 -0
- package/umd/loading/style/css/index.css +534 -5
- package/umd/loading/style/index.less +45 -0
- package/umd/masking/demo/style/css/mobile.css +514 -1
- package/umd/masking/demo/style/mobile.less +30 -0
- package/umd/masking/methods.js +7 -2
- package/umd/masking/style/css/index.css +510 -0
- package/umd/masking/style/index.less +25 -0
- package/umd/nav-bar/demo/style/css/mobile.css +514 -1
- package/umd/nav-bar/demo/style/mobile.less +33 -1
- package/umd/nav-bar/style/css/index.css +550 -1
- package/umd/nav-bar/style/index.less +38 -0
- package/umd/notice-bar/style/css/index.css +520 -2
- package/umd/notice-bar/style/index.less +36 -0
- package/umd/notify/demo/style/css/mobile.css +510 -0
- package/umd/notify/demo/style/mobile.less +25 -0
- package/umd/notify/style/css/index.css +529 -4
- package/umd/notify/style/index.less +50 -0
- package/umd/pagination/demo/style/css/index.css +510 -0
- package/umd/pagination/demo/style/index.less +25 -0
- package/umd/pagination/style/css/index.css +543 -4
- package/umd/pagination/style/index.less +72 -0
- package/umd/picker/demo/style/css/mobile.css +510 -0
- package/umd/picker/demo/style/mobile.less +25 -0
- package/umd/picker/style/css/index.css +525 -3
- package/umd/picker/style/index.less +49 -0
- package/umd/picker-view/demo/style/css/mobile.css +510 -0
- package/umd/picker-view/demo/style/mobile.less +25 -0
- package/umd/picker-view/style/css/index.css +587 -0
- package/umd/picker-view/style/index.less +50 -0
- package/umd/popover/demo/style/css/mobile.css +510 -0
- package/umd/popover/demo/style/mobile.less +25 -0
- package/umd/popover/style/css/index.css +614 -4
- package/umd/popover/style/css/menu.css +539 -1
- package/umd/popover/style/index.less +126 -9
- package/umd/popover/style/menu.less +69 -0
- package/umd/popup/demo/style/css/mobile.css +517 -0
- package/umd/popup/demo/style/mobile.less +38 -0
- package/umd/popup/style/css/index.css +514 -1
- package/umd/popup/style/index.less +32 -0
- package/umd/popup-swiper/demo/style/css/mobile.css +517 -0
- package/umd/popup-swiper/demo/style/mobile.less +38 -0
- package/umd/popup-swiper/index.d.ts +2 -8
- package/umd/popup-swiper/style/css/index.css +510 -0
- package/umd/popup-swiper/style/index.less +25 -0
- package/umd/portal/demo/style/css/mobile.css +515 -1
- package/umd/portal/demo/style/mobile.less +31 -0
- package/umd/progress/demo/style/css/mobile.css +510 -0
- package/umd/progress/demo/style/mobile.less +25 -0
- package/umd/progress/style/css/index.css +556 -8
- package/umd/progress/style/index.less +91 -0
- package/umd/pull-refresh/demo/style/css/mobile.css +514 -2
- package/umd/pull-refresh/demo/style/mobile.less +35 -2
- package/umd/pull-refresh/style/css/index.css +536 -3
- package/umd/pull-refresh/style/index.less +45 -0
- package/umd/radio/demo/style/css/mobile.css +513 -0
- package/umd/radio/demo/style/mobile.less +32 -0
- package/umd/radio/style/css/index.css +535 -4
- package/umd/radio/style/index.less +61 -0
- package/umd/rate/demo/style/css/mobile.css +510 -0
- package/umd/rate/demo/style/mobile.less +25 -0
- package/umd/rate/style/css/index.css +522 -2
- package/umd/rate/style/index.less +43 -0
- package/umd/search-bar/demo/style/css/mobile.css +516 -1
- package/umd/search-bar/demo/style/mobile.less +39 -5
- package/umd/search-bar/style/css/index.css +586 -6
- package/umd/search-bar/style/index.less +84 -0
- package/umd/show-monitor/demo/style/css/mobile.css +521 -2
- package/umd/show-monitor/demo/style/mobile.less +43 -1
- package/umd/skeleton/demo/style/css/mobile.css +510 -0
- package/umd/skeleton/demo/style/mobile.less +25 -0
- package/umd/skeleton/style/css/index.css +517 -1
- package/umd/skeleton/style/index.less +35 -0
- package/umd/slider/demo/style/css/mobile.css +514 -1
- package/umd/slider/demo/style/mobile.less +34 -0
- package/umd/slider/style/css/index.css +542 -5
- package/umd/slider/style/index.less +74 -0
- package/umd/stepper/demo/style/css/mobile.css +510 -0
- package/umd/stepper/demo/style/mobile.less +25 -1
- package/umd/stepper/style/css/index.css +551 -7
- package/umd/stepper/style/index.less +84 -3
- package/umd/steps/demo/style/css/mobile.css +544 -4
- package/umd/steps/demo/style/mobile.less +41 -3
- package/umd/steps/style/css/index.css +580 -9
- package/umd/steps/style/index.less +138 -0
- package/umd/steps/type.d.ts +1 -1
- package/umd/sticky/demo/style/css/mobile.css +515 -2
- package/umd/sticky/demo/style/mobile.less +34 -2
- package/umd/sticky/style/css/index.css +510 -0
- package/umd/sticky/style/index.less +25 -0
- package/umd/swipe-action/demo/style/css/mobile.css +510 -0
- package/umd/swipe-action/demo/style/mobile.less +25 -0
- package/umd/swipe-action/style/css/index.css +518 -2
- package/umd/swipe-action/style/index.less +43 -0
- package/umd/swipe-load/demo/style/css/mobile.css +539 -5
- package/umd/swipe-load/demo/style/mobile.less +64 -0
- package/umd/swipe-load/style/css/index.css +517 -1
- package/umd/swipe-load/style/index.less +37 -0
- package/umd/switch/demo/style/css/mobile.css +515 -1
- package/umd/switch/demo/style/mobile.less +35 -0
- package/umd/switch/style/css/index.css +532 -4
- package/umd/switch/style/index.less +59 -0
- package/umd/tab-bar/demo/style/css/mobile.css +510 -0
- package/umd/tab-bar/demo/style/mobile.less +25 -0
- package/umd/tab-bar/style/css/index.css +517 -1
- package/umd/tab-bar/style/index.less +37 -0
- package/umd/tabs/demo/style/css/mobile.css +542 -5
- package/umd/tabs/demo/style/mobile.less +75 -0
- package/umd/tabs/index.js +4 -1
- package/umd/tabs/style/css/index.css +618 -13
- package/umd/tabs/style/index.less +123 -0
- package/umd/tabs/tab-cell.js +1 -1
- package/umd/tag/demo/style/css/mobile.css +510 -0
- package/umd/tag/demo/style/mobile.less +25 -0
- package/umd/tag/style/css/index.css +538 -10
- package/umd/tag/style/index.less +55 -0
- package/umd/textarea/demo/style/css/mobile.css +514 -1
- package/umd/textarea/demo/style/mobile.less +32 -1
- package/umd/textarea/style/css/index.css +527 -2
- package/umd/textarea/style/index.less +47 -0
- package/umd/toast/demo/style/css/mobile.css +510 -0
- package/umd/toast/demo/style/mobile.less +25 -0
- package/umd/toast/style/css/index.css +530 -5
- package/umd/toast/style/index.less +37 -0
- package/umd/transition/demo/style/css/mobile.css +510 -0
- package/umd/transition/demo/style/mobile.less +25 -0
- package/umd/transition/style/css/index.css +510 -0
- package/umd/transition/style/index.less +25 -0
package/umd/_helpers/hooks.js
CHANGED
@@ -34,9 +34,26 @@
|
|
34
34
|
|
35
35
|
/**
|
36
36
|
* @type hooks
|
37
|
-
* @name
|
37
|
+
* @name GeneralHooks
|
38
38
|
* @name_en General Hooks
|
39
39
|
*/
|
40
|
+
|
41
|
+
/**
|
42
|
+
* 监听页面resize事件的统一封装
|
43
|
+
* @desc {en} Unified encapsulation for monitoring page resize events
|
44
|
+
* @param resizeHandler resize事件回调
|
45
|
+
* @param resizeHandler {en} Resize event callback
|
46
|
+
* @param deps 触发事件绑定更新的依赖
|
47
|
+
* @param deps {en} Dependencies that trigger event binding updates
|
48
|
+
* @param needListen 是否开启事件监听,默认开启
|
49
|
+
* @param needListen {en} Whether to enable event monitoring
|
50
|
+
* @example
|
51
|
+
* ```
|
52
|
+
* import { useListenResize } from '@arco-design/mobile-react/esm/_helpers/hooks';
|
53
|
+
*
|
54
|
+
* useListenResize(setSize, [], listenResize);
|
55
|
+
* ```
|
56
|
+
*/
|
40
57
|
function useListenResize(resizeHandler, deps, needListen) {
|
41
58
|
if (deps === void 0) {
|
42
59
|
deps = [];
|
@@ -47,15 +64,16 @@
|
|
47
64
|
}
|
48
65
|
|
49
66
|
(0, _react.useEffect)(function () {
|
50
|
-
if (
|
51
|
-
|
67
|
+
if (needListen) {
|
68
|
+
window.addEventListener('resize', resizeHandler);
|
69
|
+
window.addEventListener('orientationchange', resizeHandler);
|
52
70
|
}
|
53
71
|
|
54
|
-
window.addEventListener('resize', resizeHandler);
|
55
|
-
window.addEventListener('orientationchange', resizeHandler);
|
56
72
|
return function () {
|
57
|
-
|
58
|
-
|
73
|
+
if (needListen) {
|
74
|
+
window.removeEventListener('resize', resizeHandler);
|
75
|
+
window.removeEventListener('orientationchange', resizeHandler);
|
76
|
+
}
|
59
77
|
};
|
60
78
|
}, [].concat(deps, [needListen]));
|
61
79
|
}
|
@@ -66,6 +84,7 @@
|
|
66
84
|
* @desc {en} Tips: Use in scenarios where asynchronous processing is not completed after unmount. It is not recommended to replace useState without brains
|
67
85
|
* @param initialState 初始状态
|
68
86
|
* @param initialState {en} Initial State
|
87
|
+
* @returns [state, setState],同useState返回值
|
69
88
|
* @example
|
70
89
|
* ```
|
71
90
|
* import { useMountedState } from '@arco-design/mobile-react/esm/_helpers/hooks';
|
@@ -96,6 +115,20 @@
|
|
96
115
|
var result = [state, setValidState];
|
97
116
|
return result;
|
98
117
|
}
|
118
|
+
/**
|
119
|
+
* 用useState管理状态,且在状态更新之前同步至ref,并返回ref
|
120
|
+
* @desc {en} Use useState to manage the state, and synchronize to ref before the state is updated, and return ref
|
121
|
+
* @param initialValue 初始状态
|
122
|
+
* @param initialValue {en} Initial State
|
123
|
+
* @returns [state, stateRef, setState]
|
124
|
+
* @example
|
125
|
+
* ```
|
126
|
+
* import { useSameRefState } from '@arco-design/mobile-react/esm/_helpers/hooks';
|
127
|
+
*
|
128
|
+
* const [opened, openedRef, setOpened] = useSameRefState(false);
|
129
|
+
* ```
|
130
|
+
*/
|
131
|
+
|
99
132
|
|
100
133
|
function useSameRefState(initialValue) {
|
101
134
|
var _useState2 = (0, _react.useState)(initialValue),
|
@@ -111,6 +144,20 @@
|
|
111
144
|
|
112
145
|
return [state, stateRef, setStateProxy];
|
113
146
|
}
|
147
|
+
/**
|
148
|
+
* 用useState管理状态,且在状态更新后同步至ref,并返回ref
|
149
|
+
* @desc {en} Use useState to manage the state, and synchronize to ref after the state is updated, and return ref
|
150
|
+
* @param initialValue 初始状态
|
151
|
+
* @param initialValue {en} Initial State
|
152
|
+
* @returns [state, stateRef, setState]
|
153
|
+
* @example
|
154
|
+
* ```
|
155
|
+
* import { useRefState } from '@arco-design/mobile-react/esm/_helpers/hooks';
|
156
|
+
*
|
157
|
+
* const [index, indexRef, setIndex] = useRefState(currentIndex);
|
158
|
+
* ```
|
159
|
+
*/
|
160
|
+
|
114
161
|
|
115
162
|
function useRefState(initialValue) {
|
116
163
|
var _useState3 = (0, _react.useState)(initialValue),
|
@@ -123,6 +170,20 @@
|
|
123
170
|
}, [state]);
|
124
171
|
return [state, stateRef, setState];
|
125
172
|
}
|
173
|
+
/**
|
174
|
+
* 用useState管理状态,且在状态更新后同步至ref,并返回ref,统一处理在组件卸载后还使用setState的行为
|
175
|
+
* @desc {en} Use useState to manage the state, and synchronize to ref after the state is updated, and return ref, and uniformly handle the behavior of using setState after the component is uninstalled
|
176
|
+
* @param initialValue 初始状态
|
177
|
+
* @param initialValue {en} Initial State
|
178
|
+
* @returns [state, stateRef, setState]
|
179
|
+
* @example
|
180
|
+
* ```
|
181
|
+
* import { useRefMountedState } from '@arco-design/mobile-react/esm/_helpers/hooks';
|
182
|
+
*
|
183
|
+
* const [active, activeRef, setActive] = useRefMountedState(false);
|
184
|
+
* ```
|
185
|
+
*/
|
186
|
+
|
126
187
|
|
127
188
|
function useRefMountedState(initialValue) {
|
128
189
|
var _useMountedState = useMountedState(initialValue),
|
@@ -135,6 +196,23 @@
|
|
135
196
|
}, [state]);
|
136
197
|
return [state, stateRef, setState];
|
137
198
|
}
|
199
|
+
/**
|
200
|
+
* useEffect特殊封装,仅在非首次依赖更新时触发回调
|
201
|
+
* @desc {en} Special encapsulation of useEffect, which only triggers the callback when the dependency is not updated for the first time
|
202
|
+
* @param effect useEffect回调
|
203
|
+
* @param effect {en} useEffect callback
|
204
|
+
* @param dependencies useEffect依赖
|
205
|
+
* @param dependencies {en} useEffect dependencies
|
206
|
+
* @example
|
207
|
+
* ```
|
208
|
+
* import { useUpdateEffect } from '@arco-design/mobile-react/esm/_helpers/hooks';
|
209
|
+
*
|
210
|
+
* useUpdateEffect(() => {
|
211
|
+
* handleIndexChange(index);
|
212
|
+
* }, [index]);
|
213
|
+
* ```
|
214
|
+
*/
|
215
|
+
|
138
216
|
|
139
217
|
function useUpdateEffect(effect, dependencies) {
|
140
218
|
if (dependencies === void 0) {
|
@@ -150,6 +228,21 @@
|
|
150
228
|
}
|
151
229
|
}, dependencies);
|
152
230
|
}
|
231
|
+
/**
|
232
|
+
* 手动触发一次组件的rerender
|
233
|
+
* @desc {en} Manually trigger the rerender of the component once
|
234
|
+
* @example
|
235
|
+
* ```
|
236
|
+
* import { useForceUpdate } from '@arco-design/mobile-react/esm/_helpers/hooks';
|
237
|
+
*
|
238
|
+
* const update = useForceUpdate();
|
239
|
+
*
|
240
|
+
* function forceUpdate() {
|
241
|
+
* update();
|
242
|
+
* }
|
243
|
+
* ```
|
244
|
+
*/
|
245
|
+
|
153
246
|
|
154
247
|
function useForceUpdate() {
|
155
248
|
var _useState4 = (0, _react.useState)(0),
|
@@ -162,6 +255,21 @@
|
|
162
255
|
}, []);
|
163
256
|
return update;
|
164
257
|
}
|
258
|
+
/**
|
259
|
+
* 获取任意变量的最新ref值(用于监听属性、方法等非state变量)
|
260
|
+
* @desc {en} Get the latest ref value of any variable (used to monitor non-state variables such as properties and methods)
|
261
|
+
* @param variable 待获取最新值的变量
|
262
|
+
* @param variable {en} Variable to get latest value
|
263
|
+
* @returns variableRef,变量的最新ref值
|
264
|
+
* @example
|
265
|
+
* ```
|
266
|
+
* import { useLatestRef } from '@arco-design/mobile-react/esm/_helpers/hooks';
|
267
|
+
*
|
268
|
+
* const { wrapSize } = props;
|
269
|
+
* const wrapSizeRef = useLatestRef(wrapSize);
|
270
|
+
* ```
|
271
|
+
*/
|
272
|
+
|
165
273
|
|
166
274
|
function useLatestRef(variable) {
|
167
275
|
var variableRef = (0, _react.useRef)(variable);
|
@@ -170,6 +278,18 @@
|
|
170
278
|
}, [variable]);
|
171
279
|
return variableRef;
|
172
280
|
}
|
281
|
+
/**
|
282
|
+
* 从navigator.userAgent中获取当前操作系统,如果无法获取ua,则从ContextProvider传入的system中获取值
|
283
|
+
* @desc {en} Get the current operating system from navigator.userAgent, if ua cannot be obtained, get the value from the system passed in by ContextProvider
|
284
|
+
* @returns system 操作系统,"" | "pc" | "android" | "ios"
|
285
|
+
* @example
|
286
|
+
* ```
|
287
|
+
* import { useSystem } from '@arco-design/mobile-react/esm/_helpers/hooks';
|
288
|
+
*
|
289
|
+
* const system = useSystem();
|
290
|
+
* ```
|
291
|
+
*/
|
292
|
+
|
173
293
|
|
174
294
|
function useSystem() {
|
175
295
|
var _useContext = (0, _react.useContext)(_contextProvider.GlobalContext),
|
@@ -186,13 +306,27 @@
|
|
186
306
|
}, [currentSystem]);
|
187
307
|
return system;
|
188
308
|
}
|
309
|
+
/**
|
310
|
+
* 获取页面视口宽高大小,并在页面有resize时更新大小
|
311
|
+
* @desc {en} Get the width and height of the page viewport, and update the size when the page is resized
|
312
|
+
* @param needListen 是否开启resize事件监听
|
313
|
+
* @param needListen {en} Whether to enable resize event monitoring
|
314
|
+
* @returns 页面宽高,{ windowWidth, windowHeight }
|
315
|
+
* @example
|
316
|
+
* ```
|
317
|
+
* import { useWindowSize } from '@arco-design/mobile-react/esm/_helpers/hooks';
|
318
|
+
*
|
319
|
+
* const { windowHeight, windowWidth } = useWindowSize();
|
320
|
+
* ```
|
321
|
+
*/
|
322
|
+
|
189
323
|
|
190
324
|
function useWindowSize(listenResize) {
|
191
|
-
var _useState6 = (0, _react.useState)(0),
|
325
|
+
var _useState6 = (0, _react.useState)(typeof window !== 'undefined' ? window.innerWidth : 0),
|
192
326
|
windowWidth = _useState6[0],
|
193
327
|
setWindowWidth = _useState6[1];
|
194
328
|
|
195
|
-
var _useState7 = (0, _react.useState)(0),
|
329
|
+
var _useState7 = (0, _react.useState)(typeof window !== 'undefined' ? window.innerHeight : 0),
|
196
330
|
windowHeight = _useState7[0],
|
197
331
|
setWindowHeight = _useState7[1];
|
198
332
|
|
@@ -211,7 +345,30 @@
|
|
211
345
|
};
|
212
346
|
}
|
213
347
|
|
214
|
-
|
348
|
+
/**
|
349
|
+
* 弹窗中滚动统一处理,防止滚动穿透
|
350
|
+
* @desc {en} Unified processing of scrolling in pop-up windows to prevent scrolling penetration
|
351
|
+
* @param visible 弹窗是否被打开
|
352
|
+
* @param visible {en} Whether the popup is opened
|
353
|
+
* @param popupDom 弹窗的dom元素
|
354
|
+
* @param popupDom {en} DOM element of the popup
|
355
|
+
* @param getScrollContainer 弹窗中的滚动容器,可传入多个
|
356
|
+
* @param getScrollContainer {en} The scrolling container in the popup, which can pass in multiple
|
357
|
+
* @param orientationDirection 弹窗内容朝向,默认为top(从上到下),用于实现模拟横屏
|
358
|
+
* @param orientationDirection {en} The content orientation of the popup, the default is top (from top to bottom), which is used to simulate a horizontal screen
|
359
|
+
* @param preventCallback 在滚动穿透被阻止(preventDefault被触发)时的回调
|
360
|
+
* @param preventCallback {en} Callback when scrolling is blocked (preventDefault is triggered)
|
361
|
+
* @param onTouchMove touchmove 自定义事件
|
362
|
+
* @param onTouchMove {en} Touchmove custom event
|
363
|
+
* @param gestureOutOfControl 是否禁用滚动穿透处理
|
364
|
+
* @param gestureOutOfControl {en} Whether to disable scroll through processing
|
365
|
+
* @example
|
366
|
+
* ```
|
367
|
+
* import { usePopupScroll } from '@arco-design/mobile-react/esm/_helpers/hooks';
|
368
|
+
*
|
369
|
+
* usePopupScroll(visible, domRef.current, getScrollContainer, orientationDirection, onPreventTouchMove, onTouchMove, gestureOutOfControl);
|
370
|
+
* ```
|
371
|
+
*/
|
215
372
|
function usePopupScroll(visible, popupDom, getScrollContainer, orientationDirection, preventCallback, onTouchMove, gestureOutOfControl) {
|
216
373
|
if (orientationDirection === void 0) {
|
217
374
|
orientationDirection = 'top';
|
@@ -393,6 +550,19 @@
|
|
393
550
|
};
|
394
551
|
}, [visible, popupDom, handleTouchStart, handleTouchMove]);
|
395
552
|
}
|
553
|
+
/**
|
554
|
+
* 在滑动类组件中,如果有内部可滚动区域,则在内部滚动区域滚动时禁用滑动事件
|
555
|
+
* @desc {en} In the sliding class component, if there is an inner scrollable area, the sliding event is disabled when the inner scrolling area is scrolled
|
556
|
+
* @param getInnerScrollContainer 内部可滚动区域,可传入多个
|
557
|
+
* @param getInnerScrollContainer {en} Inner scrollable area, can pass in multiple
|
558
|
+
* @example
|
559
|
+
* ```
|
560
|
+
* import { useSwiperInnerScroll } from '@arco-design/mobile-react/esm/_helpers/hooks';
|
561
|
+
*
|
562
|
+
* useSwiperInnerScroll(getInnerScrollContainer);
|
563
|
+
* ```
|
564
|
+
*/
|
565
|
+
|
396
566
|
|
397
567
|
function useSwiperInnerScroll(getInnerScrollContainer) {
|
398
568
|
var stopFunc = (0, _react.useCallback)(function (e) {
|
@@ -421,6 +591,26 @@
|
|
421
591
|
};
|
422
592
|
}, [getInnerScrollContainer]);
|
423
593
|
}
|
594
|
+
/**
|
595
|
+
* 事件绑定统一封装
|
596
|
+
* @desc {en} Unified encapsulation of event binding
|
597
|
+
* @param dom 待绑定事件的dom元素
|
598
|
+
* @param dom {en} The dom element to be bound to the event
|
599
|
+
* @param event 待绑定事件名称
|
600
|
+
* @param event {en} The name of the event to be bound
|
601
|
+
* @param handler 待绑定事件回调
|
602
|
+
* @param handler {en} The callback of the event to be bound
|
603
|
+
* @param options 待绑定事件配置,默认为 { capture: true }
|
604
|
+
* @param options {en} Event configuration to be bound, the default is { capture: true }
|
605
|
+
* @example
|
606
|
+
* ```
|
607
|
+
* import { useAddListener } from '@arco-design/mobile-react/esm/_helpers/hooks';
|
608
|
+
*
|
609
|
+
* useAddListener(domRef.current, 'touchstart', onTouchStart);
|
610
|
+
* useAddListener(domRef.current, 'touchend', onTouchEnd);
|
611
|
+
* ```
|
612
|
+
*/
|
613
|
+
|
424
614
|
|
425
615
|
function useAddListener(dom, event, handler, options) {
|
426
616
|
if (options === void 0) {
|
@@ -451,8 +641,28 @@
|
|
451
641
|
|
452
642
|
var arcoFullScreenCount = 0;
|
453
643
|
var arcoFullScreenOriginOverflow = '';
|
644
|
+
/**
|
645
|
+
* 在全屏组件出现时,将body的overflow设置为hidden,防止滚动穿透
|
646
|
+
* @desc {en} When the full screen component appears, set the overflow of the body to hidden to prevent scrolling penetration
|
647
|
+
* @param visible 全屏组件是否被打开
|
648
|
+
* @param visible {en} Whether the full screen component is opened
|
649
|
+
* @param preventBodyScroll 是否启用防滚动穿透,默认启用
|
650
|
+
* @param preventBodyScroll {en} Whether to enable anti-scroll penetration, enabled by default
|
651
|
+
* @param initialBodyOverflow body在初始状态下的overflow值,在全屏组件全部关闭后会还原
|
652
|
+
* @param initialBodyOverflow {en} The overflow value of the body in the initial state, which will be restored after all full-screen components are closed
|
653
|
+
* @example
|
654
|
+
* ```
|
655
|
+
* import { usePreventBodyScroll } from '@arco-design/mobile-react/esm/_helpers/hooks';
|
656
|
+
*
|
657
|
+
* usePreventBodyScroll(visible, preventBodyScroll, initialBodyOverflow);
|
658
|
+
* ```
|
659
|
+
*/
|
454
660
|
|
455
661
|
function usePreventBodyScroll(visible, preventBodyScroll, initialBodyOverflow) {
|
662
|
+
if (preventBodyScroll === void 0) {
|
663
|
+
preventBodyScroll = true;
|
664
|
+
}
|
665
|
+
|
456
666
|
// 新出现一个全屏组件则计数+1,并设置body hidden样式
|
457
667
|
// @en When a new full-screen component appears, count + 1 and set the body hidden style
|
458
668
|
var addFullScreen = (0, _react.useCallback)(function () {
|
@@ -499,6 +709,18 @@
|
|
499
709
|
};
|
500
710
|
}, [visible]);
|
501
711
|
}
|
712
|
+
/**
|
713
|
+
* 进度条计算公共逻辑,根据传入的参数计算出当前百分比和过渡效果开关,进度类组件内部使用
|
714
|
+
* @desc {en} Progress bar calculation common logic, used internally by the progress class component
|
715
|
+
* @returns [当前计算的百分比, 当前是否应有过渡效果]
|
716
|
+
* @example
|
717
|
+
* ```
|
718
|
+
* import { usePreventBodyScroll } from '@arco-design/mobile-react/esm/_helpers/hooks';
|
719
|
+
*
|
720
|
+
* const [currentPercentage, transitionControl] = useProgress(mountedTransition, percentage, duration, mountedBezier, step);
|
721
|
+
* ```
|
722
|
+
*/
|
723
|
+
|
502
724
|
|
503
725
|
function useProgress(mountedTransition, percentage, duration, mountedBezier, step) {
|
504
726
|
var _useState8 = (0, _react.useState)(0),
|
@@ -535,6 +757,24 @@
|
|
535
757
|
}, [count, percentage, step]);
|
536
758
|
return [currentPercentage, transitionControl];
|
537
759
|
}
|
760
|
+
/**
|
761
|
+
* 单击和双击事件统一处理
|
762
|
+
* @desc {en} Unified processing of single and double click events
|
763
|
+
* @param onClick 单击事件回调
|
764
|
+
* @param onClick {en} Callback of single click event
|
765
|
+
* @param onDoubleClick 双击事件回调
|
766
|
+
* @param onDoubleClick {en} Callback of double click event
|
767
|
+
* @param delay 两次点击被判定为双击事件的最大间隔时间
|
768
|
+
* @param delay {en} The maximum interval between two clicks is judged as a double-click event
|
769
|
+
* @returns clickHandler,统一后的事件处理方法
|
770
|
+
* @example
|
771
|
+
* ```
|
772
|
+
* import { useSingleAndDoubleClick } from '@arco-design/mobile-react/esm/_helpers/hooks';
|
773
|
+
*
|
774
|
+
* const handleClick = useSingleAndDoubleClick(handleImageClick, handleImageDoubleClick);
|
775
|
+
* ```
|
776
|
+
*/
|
777
|
+
|
538
778
|
|
539
779
|
function useSingleAndDoubleClick(onClick, onDoubleClick, delay) {
|
540
780
|
if (delay === void 0) {
|
@@ -565,6 +805,23 @@
|
|
565
805
|
}
|
566
806
|
|
567
807
|
var arcoSvgKeyCount = 0;
|
808
|
+
/**
|
809
|
+
* 自动生成svg <def>标签的唯一标识,用于区分不同svg的<def>内容
|
810
|
+
* @desc {en} Automatically generate the unique identifier of the svg <def> tag, which is used to distinguish the <def> content of different svg
|
811
|
+
* @param userSetSvgKey 自定义唯一标识,传入则覆盖自动生成的值
|
812
|
+
* @param userSetSvgKey {en} Customize the unique identifier, if passed in, it will override the automatically generated value
|
813
|
+
* @returns 包含svgKey的对象 生成后的唯一标识
|
814
|
+
* @globalVariable
|
815
|
+
* ```
|
816
|
+
* let arcoSvgKeyCount = 0;
|
817
|
+
* ```
|
818
|
+
* @example
|
819
|
+
* ```
|
820
|
+
* import { useGenSvgKey } from '@arco-design/mobile-react/esm/_helpers/hooks';
|
821
|
+
*
|
822
|
+
* const { svgKey } = useGenSvgKey(userSetSvgKey);
|
823
|
+
* ```
|
824
|
+
*/
|
568
825
|
|
569
826
|
function useGenSvgKey(userSetSvgKey) {
|
570
827
|
var _useState12 = (0, _react.useState)(''),
|
package/umd/_helpers/index.d.ts
CHANGED
@@ -4,12 +4,89 @@
|
|
4
4
|
*/
|
5
5
|
import { CSSProperties } from 'react';
|
6
6
|
export * from './hooks';
|
7
|
-
export * from './type';
|
8
7
|
export * from './react-dom';
|
8
|
+
export * from './type';
|
9
|
+
/**
|
10
|
+
* 获取带浏览器前缀的样式
|
11
|
+
* @desc {en} Get style with browser vendor prefix
|
12
|
+
* @param {CSSProperties} style 原始样式
|
13
|
+
* @param {CSSProperties} style {en} Original style
|
14
|
+
* @returns {CSSProperties} newStyle 添加了浏览器前缀的新样式
|
15
|
+
* @returns {CSSProperties} newStyle {en} New style with browser vendor prefix
|
16
|
+
* @example
|
17
|
+
* ```
|
18
|
+
* import { getStyleWithVendor } from '@arco-design/mobile-react/esm/_helpers';
|
19
|
+
*
|
20
|
+
* // Example usage:
|
21
|
+
* const originalStyle = {
|
22
|
+
* transform: 'translateX(50px)',
|
23
|
+
* transition: 'all 0.3s ease',
|
24
|
+
* opacity: 0.8,
|
25
|
+
* };
|
26
|
+
*
|
27
|
+
* const styleWithPrefix = getStyleWithVendor(originalStyle);
|
28
|
+
*
|
29
|
+
* // Result:
|
30
|
+
* // styleWithPrefix will be:
|
31
|
+
* // {
|
32
|
+
* // transform: 'translateX(50px)',
|
33
|
+
* // WebkitTransform: 'translateX(50px)', // Browser-specific prefix added
|
34
|
+
* // transition: 'all 0.3s ease',
|
35
|
+
* // WebkitTransition: 'all 0.3s ease', // Browser-specific prefix added
|
36
|
+
* // opacity: 0.8,
|
37
|
+
* // }
|
38
|
+
* ```
|
39
|
+
*/
|
9
40
|
export declare function getStyleWithVendor(style: CSSProperties): CSSProperties;
|
41
|
+
/**
|
42
|
+
* 给元素设置带浏览器前缀的样式
|
43
|
+
* @desc {en} Set element style with browser vendor prefix
|
44
|
+
* @param {HTMLElement} dom 需要设置样式的元素
|
45
|
+
* @param {HTMLElement} dom {en} Element to set style
|
46
|
+
* @param {CSSProperties} style Original style
|
47
|
+
* @param {CSSProperties} style {en} Original style
|
48
|
+
* @returns {void}
|
49
|
+
* @example
|
50
|
+
* ```
|
51
|
+
* import { setStyleWithVendor } from '@arco-design/mobile-utils';
|
52
|
+
*
|
53
|
+
* // Example: Setting and displaying styles with the Webkit browser vendor prefix
|
54
|
+
* const element = document.getElementById('myElement');
|
55
|
+
* const originalStyle = {
|
56
|
+
* transform: 'translateX(100px)',
|
57
|
+
* transition: 'transform 0.5s ease',
|
58
|
+
* borderRadius: '5px',
|
59
|
+
* };
|
60
|
+
*
|
61
|
+
* // Set the styles with the Webkit browser vendor prefix
|
62
|
+
* setStyleWithVendor(element, originalStyle);
|
63
|
+
*
|
64
|
+
* // Display the styles with the Webkit browser vendor prefixes applied
|
65
|
+
* const computedStyle = getComputedStyle(element);
|
66
|
+
* console.log(computedStyle.getPropertyValue('-webkit-transform')); // Output: The transformed style with the Webkit browser vendor prefix
|
67
|
+
* console.log(computedStyle.getPropertyValue('-webkit-transition')); // Output: The transition style with the Webkit browser vendor prefix
|
68
|
+
* console.log(computedStyle.getPropertyValue('border-radius')); // Output: The borderRadius style without a vendor prefix
|
69
|
+
* ```
|
70
|
+
*/
|
10
71
|
export declare function setStyleWithVendor(dom: HTMLElement, style: CSSProperties): void;
|
11
72
|
/**
|
12
73
|
* 计算默认值,仅未定义时使用默认值
|
13
74
|
* @desc {en} Calculate the default value, use default value only if undefined
|
75
|
+
* @param {T | undefined} value 输入的值
|
76
|
+
* @param {T | undefined} value {en} The input value
|
77
|
+
* @param {T} defaultValue 默认值
|
78
|
+
* @param {T} defaultValue {en} The default value
|
79
|
+
* @returns {T} 如果输入的值是未定义的,那么返回默认值,否则返回输入的值
|
80
|
+
* @returns {T} {en} Returns the default value if the input is undefined, otherwise returns the input value
|
81
|
+
* @example
|
82
|
+
* ```
|
83
|
+
* import { getDefaultValue } from '@arco-design/mobile-react/esm/_helpers';
|
84
|
+
*
|
85
|
+
* const result = getDefaultValue(42, 0);
|
86
|
+
* console.log(result); // Output: 42
|
87
|
+
*
|
88
|
+
* const result2 = getDefaultValue(undefined, 100);
|
89
|
+
* console.log(result2); // Output: 100
|
90
|
+
* ```
|
14
91
|
*/
|
15
92
|
export declare const getDefaultValue: <T>(value: T | undefined, defaultValue: T) => T;
|
package/umd/_helpers/index.js
CHANGED
@@ -1,16 +1,16 @@
|
|
1
1
|
(function (global, factory) {
|
2
2
|
if (typeof define === "function" && define.amd) {
|
3
|
-
define(["exports", "@babel/runtime/helpers/extends", "./hooks", "./
|
3
|
+
define(["exports", "@babel/runtime/helpers/extends", "./hooks", "./react-dom", "./type"], factory);
|
4
4
|
} else if (typeof exports !== "undefined") {
|
5
|
-
factory(exports, require("@babel/runtime/helpers/extends"), require("./hooks"), require("./
|
5
|
+
factory(exports, require("@babel/runtime/helpers/extends"), require("./hooks"), require("./react-dom"), require("./type"));
|
6
6
|
} else {
|
7
7
|
var mod = {
|
8
8
|
exports: {}
|
9
9
|
};
|
10
|
-
factory(mod.exports, global._extends, global.hooks, global.
|
10
|
+
factory(mod.exports, global._extends, global.hooks, global.reactDom, global.type);
|
11
11
|
global.index = mod.exports;
|
12
12
|
}
|
13
|
-
})(typeof globalThis !== "undefined" ? globalThis : typeof self !== "undefined" ? self : this, function (_exports, _extends3, _hooks,
|
13
|
+
})(typeof globalThis !== "undefined" ? globalThis : typeof self !== "undefined" ? self : this, function (_exports, _extends3, _hooks, _reactDom, _type) {
|
14
14
|
"use strict";
|
15
15
|
|
16
16
|
var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault");
|
@@ -31,23 +31,55 @@
|
|
31
31
|
if (key in _exports && _exports[key] === _hooks[key]) return;
|
32
32
|
_exports[key] = _hooks[key];
|
33
33
|
});
|
34
|
-
Object.keys(_type).forEach(function (key) {
|
35
|
-
if (key === "default" || key === "__esModule") return;
|
36
|
-
if (Object.prototype.hasOwnProperty.call(_exportNames, key)) return;
|
37
|
-
if (key in _exports && _exports[key] === _type[key]) return;
|
38
|
-
_exports[key] = _type[key];
|
39
|
-
});
|
40
34
|
Object.keys(_reactDom).forEach(function (key) {
|
41
35
|
if (key === "default" || key === "__esModule") return;
|
42
36
|
if (Object.prototype.hasOwnProperty.call(_exportNames, key)) return;
|
43
37
|
if (key in _exports && _exports[key] === _reactDom[key]) return;
|
44
38
|
_exports[key] = _reactDom[key];
|
45
39
|
});
|
40
|
+
Object.keys(_type).forEach(function (key) {
|
41
|
+
if (key === "default" || key === "__esModule") return;
|
42
|
+
if (Object.prototype.hasOwnProperty.call(_exportNames, key)) return;
|
43
|
+
if (key in _exports && _exports[key] === _type[key]) return;
|
44
|
+
_exports[key] = _type[key];
|
45
|
+
});
|
46
46
|
|
47
47
|
/**
|
48
48
|
* @type utils
|
49
49
|
* @name componentUtils
|
50
50
|
*/
|
51
|
+
|
52
|
+
/**
|
53
|
+
* 获取带浏览器前缀的样式
|
54
|
+
* @desc {en} Get style with browser vendor prefix
|
55
|
+
* @param {CSSProperties} style 原始样式
|
56
|
+
* @param {CSSProperties} style {en} Original style
|
57
|
+
* @returns {CSSProperties} newStyle 添加了浏览器前缀的新样式
|
58
|
+
* @returns {CSSProperties} newStyle {en} New style with browser vendor prefix
|
59
|
+
* @example
|
60
|
+
* ```
|
61
|
+
* import { getStyleWithVendor } from '@arco-design/mobile-react/esm/_helpers';
|
62
|
+
*
|
63
|
+
* // Example usage:
|
64
|
+
* const originalStyle = {
|
65
|
+
* transform: 'translateX(50px)',
|
66
|
+
* transition: 'all 0.3s ease',
|
67
|
+
* opacity: 0.8,
|
68
|
+
* };
|
69
|
+
*
|
70
|
+
* const styleWithPrefix = getStyleWithVendor(originalStyle);
|
71
|
+
*
|
72
|
+
* // Result:
|
73
|
+
* // styleWithPrefix will be:
|
74
|
+
* // {
|
75
|
+
* // transform: 'translateX(50px)',
|
76
|
+
* // WebkitTransform: 'translateX(50px)', // Browser-specific prefix added
|
77
|
+
* // transition: 'all 0.3s ease',
|
78
|
+
* // WebkitTransition: 'all 0.3s ease', // Browser-specific prefix added
|
79
|
+
* // opacity: 0.8,
|
80
|
+
* // }
|
81
|
+
* ```
|
82
|
+
*/
|
51
83
|
function getStyleWithVendor(style) {
|
52
84
|
var allowReg = /(transform|transition|animation)/i;
|
53
85
|
var newStyle = Object.keys(style).reduce(function (acc, key) {
|
@@ -60,6 +92,37 @@
|
|
60
92
|
}, {});
|
61
93
|
return newStyle;
|
62
94
|
}
|
95
|
+
/**
|
96
|
+
* 给元素设置带浏览器前缀的样式
|
97
|
+
* @desc {en} Set element style with browser vendor prefix
|
98
|
+
* @param {HTMLElement} dom 需要设置样式的元素
|
99
|
+
* @param {HTMLElement} dom {en} Element to set style
|
100
|
+
* @param {CSSProperties} style Original style
|
101
|
+
* @param {CSSProperties} style {en} Original style
|
102
|
+
* @returns {void}
|
103
|
+
* @example
|
104
|
+
* ```
|
105
|
+
* import { setStyleWithVendor } from '@arco-design/mobile-utils';
|
106
|
+
*
|
107
|
+
* // Example: Setting and displaying styles with the Webkit browser vendor prefix
|
108
|
+
* const element = document.getElementById('myElement');
|
109
|
+
* const originalStyle = {
|
110
|
+
* transform: 'translateX(100px)',
|
111
|
+
* transition: 'transform 0.5s ease',
|
112
|
+
* borderRadius: '5px',
|
113
|
+
* };
|
114
|
+
*
|
115
|
+
* // Set the styles with the Webkit browser vendor prefix
|
116
|
+
* setStyleWithVendor(element, originalStyle);
|
117
|
+
*
|
118
|
+
* // Display the styles with the Webkit browser vendor prefixes applied
|
119
|
+
* const computedStyle = getComputedStyle(element);
|
120
|
+
* console.log(computedStyle.getPropertyValue('-webkit-transform')); // Output: The transformed style with the Webkit browser vendor prefix
|
121
|
+
* console.log(computedStyle.getPropertyValue('-webkit-transition')); // Output: The transition style with the Webkit browser vendor prefix
|
122
|
+
* console.log(computedStyle.getPropertyValue('border-radius')); // Output: The borderRadius style without a vendor prefix
|
123
|
+
* ```
|
124
|
+
*/
|
125
|
+
|
63
126
|
|
64
127
|
function setStyleWithVendor(dom, style) {
|
65
128
|
var vendorStyle = getStyleWithVendor(style);
|
@@ -71,6 +134,22 @@
|
|
71
134
|
/**
|
72
135
|
* 计算默认值,仅未定义时使用默认值
|
73
136
|
* @desc {en} Calculate the default value, use default value only if undefined
|
137
|
+
* @param {T | undefined} value 输入的值
|
138
|
+
* @param {T | undefined} value {en} The input value
|
139
|
+
* @param {T} defaultValue 默认值
|
140
|
+
* @param {T} defaultValue {en} The default value
|
141
|
+
* @returns {T} 如果输入的值是未定义的,那么返回默认值,否则返回输入的值
|
142
|
+
* @returns {T} {en} Returns the default value if the input is undefined, otherwise returns the input value
|
143
|
+
* @example
|
144
|
+
* ```
|
145
|
+
* import { getDefaultValue } from '@arco-design/mobile-react/esm/_helpers';
|
146
|
+
*
|
147
|
+
* const result = getDefaultValue(42, 0);
|
148
|
+
* console.log(result); // Output: 42
|
149
|
+
*
|
150
|
+
* const result2 = getDefaultValue(undefined, 100);
|
151
|
+
* console.log(result2); // Output: 100
|
152
|
+
* ```
|
74
153
|
*/
|
75
154
|
|
76
155
|
|