@arco-design/mobile-react 2.29.6 → 2.30.1
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 +24 -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/index.js +3 -1
- 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 +14 -3
- package/cjs/context-provider/index.js +47 -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 +522 -2
- package/cjs/dialog/demo/style/mobile.less +46 -1
- 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/form-item.js +15 -7
- package/cjs/form/style/css/index.css +538 -5
- package/cjs/form/style/index.less +66 -3
- package/cjs/form/type.d.ts +3 -2
- package/cjs/form/utils.d.ts +1 -0
- package/cjs/form/utils.js +6 -2
- 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/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/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 +538 -7
- package/cjs/input/demo/style/mobile.less +63 -6
- 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/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 +515 -1
- package/cjs/notify/demo/style/mobile.less +34 -1
- 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 +516 -2
- package/cjs/popover/demo/style/mobile.less +37 -2
- 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/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 +546 -5
- package/cjs/tabs/demo/style/mobile.less +81 -0
- 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 +1104 -39
- 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/index.js +3 -1
- 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 +14 -3
- package/esm/context-provider/index.js +48 -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 +522 -2
- package/esm/dialog/demo/style/mobile.less +46 -1
- 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/form-item.js +15 -7
- package/esm/form/style/css/index.css +538 -5
- package/esm/form/style/index.less +66 -3
- package/esm/form/type.d.ts +3 -2
- package/esm/form/utils.d.ts +1 -0
- package/esm/form/utils.js +6 -2
- 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/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/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 +538 -7
- package/esm/input/demo/style/mobile.less +63 -6
- 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/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 +515 -1
- package/esm/notify/demo/style/mobile.less +34 -1
- 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 +516 -2
- package/esm/popover/demo/style/mobile.less +37 -2
- 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/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 +546 -5
- package/esm/tabs/demo/style/mobile.less +81 -0
- 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 +355 -101
- package/tokens/app/arcodesign/default/index.d.ts +257 -3
- package/tokens/app/arcodesign/default/index.js +355 -101
- package/tokens/app/arcodesign/default/index.json +2418 -370
- package/tokens/app/arcodesign/default/index.less +355 -101
- 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/index.js +3 -1
- 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 +14 -3
- package/umd/context-provider/index.js +47 -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 +522 -2
- package/umd/dialog/demo/style/mobile.less +46 -1
- 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/form-item.js +15 -7
- package/umd/form/style/css/index.css +538 -5
- package/umd/form/style/index.less +66 -3
- package/umd/form/type.d.ts +3 -2
- package/umd/form/utils.d.ts +1 -0
- package/umd/form/utils.js +6 -2
- 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/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/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 +538 -7
- package/umd/input/demo/style/mobile.less +63 -6
- 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/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 +515 -1
- package/umd/notify/demo/style/mobile.less +34 -1
- 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 +516 -2
- package/umd/popover/demo/style/mobile.less +37 -2
- 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/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 +546 -5
- package/umd/tabs/demo/style/mobile.less +81 -0
- 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/dist/index.js
CHANGED
@@ -111,27 +111,151 @@
|
|
111
111
|
}
|
112
112
|
|
113
113
|
var opt = Object.prototype.toString;
|
114
|
+
/**
|
115
|
+
* 判断一个对象是否为数组类型
|
116
|
+
* @desc {en} Whether it is an array
|
117
|
+
* @param {any} obj 入参
|
118
|
+
* @param {any} obj {en} Entering
|
119
|
+
* @returns {boolean} 返回是否为数组类型
|
120
|
+
* @returns {boolean} {en} Returns whether it is an array type
|
121
|
+
* @example
|
122
|
+
* ```
|
123
|
+
* import { isArray } from '@arco-design/mobile-utils';
|
124
|
+
*
|
125
|
+
* const test = isArray([]);
|
126
|
+
* ```
|
127
|
+
*/
|
128
|
+
|
114
129
|
function isArray(obj) {
|
115
130
|
return opt.call(obj) === '[object Array]';
|
116
131
|
}
|
132
|
+
/**
|
133
|
+
* 判断一个对象是否为对象类型
|
134
|
+
* @desc {en} Whether it is an object
|
135
|
+
* @param {any} obj 入参
|
136
|
+
* @param {any} obj {en} Entering
|
137
|
+
* @returns {boolean} 返回是否为对象类型
|
138
|
+
* @returns {boolean} {en} Returns whether it is an object type
|
139
|
+
* @example
|
140
|
+
* ```
|
141
|
+
* import { isObject } from '@arco-design/mobile-utils';
|
142
|
+
*
|
143
|
+
* const test = isObject({});
|
144
|
+
* ```
|
145
|
+
*/
|
146
|
+
|
117
147
|
function isObject$2(obj) {
|
118
148
|
return opt.call(obj) === '[object Object]';
|
119
149
|
}
|
150
|
+
/**
|
151
|
+
* 判断一个对象是否为字符串类型
|
152
|
+
* @desc {en} Whether it is an string
|
153
|
+
* @param {any} obj 入参
|
154
|
+
* @param {any} obj {en} Entering
|
155
|
+
* @returns {boolean} 返回是否为字符串类型
|
156
|
+
* @returns {boolean} {en} Returns whether it is an string type
|
157
|
+
* @example
|
158
|
+
* ```
|
159
|
+
* import { isString } from '@arco-design/mobile-utils';
|
160
|
+
*
|
161
|
+
* const test = isString('');
|
162
|
+
* ```
|
163
|
+
*/
|
164
|
+
|
120
165
|
function isString(obj) {
|
121
166
|
return opt.call(obj) === '[object String]';
|
122
167
|
}
|
168
|
+
/**
|
169
|
+
* 检查一个值是否在给定的有效值列表中
|
170
|
+
* @desc {en} Checks whether a value is in the given list of valid values
|
171
|
+
* @param {T} value 检查的值
|
172
|
+
* @param {T} value {en} value to check
|
173
|
+
* @param {T[]} validList 有效值列表
|
174
|
+
* @param {T[]} validList {en} List of valid values
|
175
|
+
* @returns {boolean} 返回要检查的值是否在有效值列表中
|
176
|
+
* @returns {boolean} {en} Returns whether the value to be checked is in the list of valid values
|
177
|
+
* @example
|
178
|
+
* ```
|
179
|
+
* import { isOneOf } from '@arco-design/mobile-utils';
|
180
|
+
*
|
181
|
+
* const test = isOneOf(1, [1, 2, 3]);
|
182
|
+
* ```
|
183
|
+
*/
|
184
|
+
|
123
185
|
function isOneOf(value, validList) {
|
124
186
|
return validList.indexOf(value) !== -1;
|
125
187
|
}
|
188
|
+
/**
|
189
|
+
* 检查一个值是否为空值
|
190
|
+
* @desc {en} Check if a value is null
|
191
|
+
* @param {any} obj 入参
|
192
|
+
* @param {any} obj {en} Entering
|
193
|
+
* @returns {boolean} 返回该值是否为空值
|
194
|
+
* @returns {boolean} {en} Returns whether the value is null
|
195
|
+
* @example
|
196
|
+
* ```
|
197
|
+
* import { isEmptyValue } from '@arco-design/mobile-utils';
|
198
|
+
*
|
199
|
+
* const test = isEmptyValue(null);
|
200
|
+
* ```
|
201
|
+
*/
|
202
|
+
|
126
203
|
function isEmptyValue(obj) {
|
127
204
|
return obj === undefined || obj === null || obj === '';
|
128
205
|
}
|
206
|
+
/**
|
207
|
+
* 检查一个值是否为函数类型
|
208
|
+
* @desc {en} Check if a value is function
|
209
|
+
* @param {unknown} obj 入参
|
210
|
+
* @param {unknown} obj {en} Entering
|
211
|
+
* @returns {boolean} 返回该值是否为函数
|
212
|
+
* @returns {boolean} {en} Returns whether the value is function
|
213
|
+
* @example
|
214
|
+
* ```
|
215
|
+
* import { isFunction } from '@arco-design/mobile-utils';
|
216
|
+
*
|
217
|
+
* const test = isFunction(() => {});
|
218
|
+
* ```
|
219
|
+
*/
|
220
|
+
|
129
221
|
function isFunction(obj) {
|
130
222
|
return Object.prototype.toString.call(obj).toLowerCase() === '[object function]';
|
131
223
|
}
|
224
|
+
/**
|
225
|
+
* 检查一个值是否为空数组
|
226
|
+
* @desc {en} Check if a value is an empty array
|
227
|
+
* @param {Array<unknown>} obj 入参
|
228
|
+
* @param {Array<unknown>} obj {en} Entering
|
229
|
+
* @returns {boolean} 返回该值是否为空数组
|
230
|
+
* @returns {boolean} {en} Returns whether the value is an empty array
|
231
|
+
* @example
|
232
|
+
* ```
|
233
|
+
* import { isEmptyArray } from '@arco-design/mobile-utils';
|
234
|
+
*
|
235
|
+
* const test = isEmptyArray([]);
|
236
|
+
* ```
|
237
|
+
*/
|
238
|
+
|
132
239
|
function isEmptyArray(obj) {
|
133
240
|
return isArray(obj) && !(obj === null || obj === void 0 ? void 0 : obj.length);
|
134
241
|
}
|
242
|
+
/**
|
243
|
+
* 深比较两个对象是否相等
|
244
|
+
* @desc {en} Check if a value is an empty array
|
245
|
+
* @param {any} obj 要比较的第一个对象
|
246
|
+
* @param {any} obj {en} the first object to compare
|
247
|
+
* @param {any} obj 要比较的第二个对象
|
248
|
+
* @param {any} obj {en} the second object to be compared
|
249
|
+
* @returns {boolean} 返回两个对象是否相等
|
250
|
+
* @returns {boolean} {en} Returns whether two objects are equal
|
251
|
+
* @example
|
252
|
+
* ```
|
253
|
+
* import { isDeepEqual } from '@arco-design/mobile-utils';
|
254
|
+
*
|
255
|
+
* const test = isDeepEqual({a: 1}, {a: 1});
|
256
|
+
* ```
|
257
|
+
*/
|
258
|
+
|
135
259
|
function isDeepEqual(obj, sub) {
|
136
260
|
if (typeof obj !== 'object' || typeof sub !== 'object' || obj === null || sub === null) {
|
137
261
|
return obj === sub;
|
@@ -152,6 +276,23 @@
|
|
152
276
|
return true;
|
153
277
|
}
|
154
278
|
|
279
|
+
/**
|
280
|
+
* @type utils
|
281
|
+
* @name classnames
|
282
|
+
*/
|
283
|
+
/**
|
284
|
+
* 将传入的值转为class字符串
|
285
|
+
* @param args 字符串,字符串数组,对象,undefined,null,boolean
|
286
|
+
* @param args {en} string, string[], object, undefined, null, boolean
|
287
|
+
* @returns class字符串
|
288
|
+
* @returns {en} class string
|
289
|
+
* @example
|
290
|
+
* import { cls } from '@arco-design/mobile-utils';
|
291
|
+
*
|
292
|
+
* <div className={cls('a', 'b', { ok: true })} />
|
293
|
+
* // result: <div class="a b ok"></div>
|
294
|
+
*/
|
295
|
+
|
155
296
|
function cls () {
|
156
297
|
var args = [];
|
157
298
|
|
@@ -263,6 +404,33 @@
|
|
263
404
|
function LinearEasing(x) {
|
264
405
|
return x;
|
265
406
|
}
|
407
|
+
/**
|
408
|
+
* 获取一个用于计算贝塞尔曲线的函数
|
409
|
+
* @desc {en} Gets a function used to calculate Bezier curves
|
410
|
+
* @param mX1 第一个点的x坐标
|
411
|
+
* @param mX1 {en} The X coordinate of first point
|
412
|
+
* @param mY1 第一个点的y坐标
|
413
|
+
* @param mY1 {en} The Y coordinate of first point
|
414
|
+
* @param mX2 第二个点的x坐标
|
415
|
+
* @param mX2 {en} The X coordinate of second point
|
416
|
+
* @param mY2 第二个点的y坐标
|
417
|
+
* @param mY2 {en} The Y coordinate of second point
|
418
|
+
* @returns 计算贝塞尔曲线的函数
|
419
|
+
* @returns {function} {en} The function of calculating bezier curve
|
420
|
+
* @example
|
421
|
+
* ```
|
422
|
+
* import { bezierEasing } from '@arco-design/mobile-utils';
|
423
|
+
*
|
424
|
+
* const p = (Date.now() - start) / duration;
|
425
|
+
* if (p > 1) {
|
426
|
+
* scrollTo(targetTop);
|
427
|
+
* } else {
|
428
|
+
* const newTop = initTop + (targetTop - initTop) * bezierEasing(0.34, 0.69, 0.1, 1)(p);
|
429
|
+
* scrollTo(newTop);
|
430
|
+
* }
|
431
|
+
* ```
|
432
|
+
*/
|
433
|
+
|
266
434
|
|
267
435
|
function bezier(mX1, mY1, mX2, mY2) {
|
268
436
|
if (!(mX1 >= 0 && mX1 <= 1 && mX2 >= 0 && mX2 <= 1)) {
|
@@ -316,9 +484,63 @@
|
|
316
484
|
};
|
317
485
|
}
|
318
486
|
|
487
|
+
/**
|
488
|
+
* 阻止 TouchEvent 事件的默认行为
|
489
|
+
* @desc {en} Stops the default behavior of a TouchEvent
|
490
|
+
* @param {TouchEvent} e 要阻止的 TouchEvent 事件
|
491
|
+
* @param {TouchEvent} e {en} The TouchEvent to stop
|
492
|
+
* @returns {void}
|
493
|
+
* @example
|
494
|
+
* ```
|
495
|
+
* import { stopTouch } from '@arco-design/mobile-utils';
|
496
|
+
*
|
497
|
+
* // Before calling stopTouch
|
498
|
+
* const touchEvent = new TouchEvent("touchstart", { cancelable: true });
|
499
|
+
* console.log(touchEvent.defaultPrevented); // false
|
500
|
+
*
|
501
|
+
* // Call stopTouch to prevent the default behavior
|
502
|
+
* stopTouch(touchEvent);
|
503
|
+
*
|
504
|
+
* // After calling stopTouch
|
505
|
+
* console.log(touchEvent.defaultPrevented); // true
|
506
|
+
* ```
|
507
|
+
*/
|
508
|
+
|
319
509
|
function stopTouch(e) {
|
510
|
+
// If the TouchEvent is cancelable, prevent it's default behavior using preventDefault
|
320
511
|
e.cancelable && e.preventDefault();
|
321
512
|
}
|
513
|
+
/**
|
514
|
+
* 阻止元素滚动
|
515
|
+
* @desc {en} Prevents an element from scrolling
|
516
|
+
* @param scrollContainer 滚动容器的函数,默认为 document.body
|
517
|
+
* @param scrollContainer {en} A function that returns the scroll container, defaults to document.body
|
518
|
+
* @param preventWindow 是否阻止窗口滚动
|
519
|
+
* @param preventWindow {en} Whether to prevent window scrolling
|
520
|
+
* @param customStopTouch 自定义停止触摸事件的函数
|
521
|
+
* @param customStopTouch {en} A custom function to stop touch events
|
522
|
+
* @example
|
523
|
+
* ```
|
524
|
+
* import { preventEleScroll } from '@arco-design/mobile-utils';
|
525
|
+
*
|
526
|
+
* // Example 1: Prevent scrolling in the entire document body
|
527
|
+
* preventEleScroll();
|
528
|
+
*
|
529
|
+
* // Example 2: Prevent scrolling in a specific element
|
530
|
+
* preventEleScroll(() => document.getElementById('myScrollableElement'));
|
531
|
+
*
|
532
|
+
* // Example 3: Prevent scrolling in a specific element with custom touch event handling
|
533
|
+
* preventEleScroll(
|
534
|
+
* () => document.getElementById('myScrollableElement'),
|
535
|
+
* false,
|
536
|
+
* (e) => {
|
537
|
+
* // Custom touch event handling logic here
|
538
|
+
* e.preventDefault();
|
539
|
+
* }
|
540
|
+
* );
|
541
|
+
* ```
|
542
|
+
*/
|
543
|
+
|
322
544
|
function preventEleScroll(scrollContainer, preventWindow, customStopTouch) {
|
323
545
|
if (scrollContainer === void 0) {
|
324
546
|
scrollContainer = function scrollContainer() {
|
@@ -340,6 +562,37 @@
|
|
340
562
|
capture: true
|
341
563
|
});
|
342
564
|
}
|
565
|
+
/**
|
566
|
+
* 允许元素滚动
|
567
|
+
* @desc {en} Allows an element to scroll
|
568
|
+
* @param scrollContainer 滚动容器的函数,默认为 document.body
|
569
|
+
* @param scrollContainer {en} A function that returns the scroll container, defaults to document.body
|
570
|
+
* @param preventWindow 是否阻止窗口滚动
|
571
|
+
* @param preventWindow {en} Whether to prevent window scrolling
|
572
|
+
* @param customStopTouch 自定义停止触摸事件的函数
|
573
|
+
* @param customStopTouch {en} A custom function to stop touch events
|
574
|
+
* @example
|
575
|
+
* ```
|
576
|
+
* import { freeEleScroll } from '@arco-design/mobile-utils';
|
577
|
+
*
|
578
|
+
* // Example 1: Allow scrolling in the entire document body
|
579
|
+
* freeEleScroll();
|
580
|
+
*
|
581
|
+
* // Example 2: Allow scrolling in a specific element
|
582
|
+
* freeEleScroll(() => document.getElementById('myScrollableElement'));
|
583
|
+
*
|
584
|
+
* // Example 3: Allow scrolling in a specific element with custom touch event handling
|
585
|
+
* freeEleScroll(
|
586
|
+
* () => document.getElementById('myScrollableElement'),
|
587
|
+
* false,
|
588
|
+
* (e) => {
|
589
|
+
* // Custom touch event handling logic here
|
590
|
+
* // You can choose to call e.preventDefault() or not based on your needs
|
591
|
+
* }
|
592
|
+
* );
|
593
|
+
* ```
|
594
|
+
*/
|
595
|
+
|
343
596
|
function freeEleScroll(scrollContainer, preventWindow, customStopTouch) {
|
344
597
|
if (scrollContainer === void 0) {
|
345
598
|
scrollContainer = function scrollContainer() {
|
@@ -362,9 +615,38 @@
|
|
362
615
|
}
|
363
616
|
/**
|
364
617
|
* 判断父节点是否包含子节点
|
365
|
-
* @desc {en}
|
366
|
-
* @param parentEl 父节点
|
367
|
-
* @param
|
618
|
+
* @desc {en} confirm parentNode contains children nodes
|
619
|
+
* @param {HTMLElement | null} parentEl 父节点
|
620
|
+
* @param {HTMLElement | null} parentEl {en} The parent element
|
621
|
+
* @param {HTMLElement | null} childrenEl 子节点
|
622
|
+
* @param {HTMLElement | null} childrenEl {en} The child element
|
623
|
+
* @returns {boolean} 是否包含子节点
|
624
|
+
* @returns {boolean} {en} Whether the parent contains the child
|
625
|
+
* @example
|
626
|
+
* ```
|
627
|
+
* import { isContains } from '@arco-design/mobile-utils';
|
628
|
+
*
|
629
|
+
* // Example 1: When the parent contains the direct child
|
630
|
+
* const parentElement = document.getElementById('parent');
|
631
|
+
* const childElement = document.getElementById('directChild');
|
632
|
+
* const result1 = isContains(parentElement, childElement);
|
633
|
+
* console.log(result1); // Output: true
|
634
|
+
* // Explanation: In this example, the parent element (#parent) contains a direct child element (#directChild).
|
635
|
+
*
|
636
|
+
* // Example 2: When the parent contains an indirect child
|
637
|
+
* const grandparentElement = document.getElementById('grandparent');
|
638
|
+
* const indirectChildElement = document.getElementById('indirectChild');
|
639
|
+
* const result2 = isContains(grandparentElement, indirectChildElement);
|
640
|
+
* console.log(result2); // Output: true
|
641
|
+
* // Explanation: Here, the grandparent element (#grandparent) contains an indirect child element (#indirectChild) nested within other elements.
|
642
|
+
*
|
643
|
+
* // Example 3: When the parent does not contain the child
|
644
|
+
* const unrelatedParent = document.getElementById('unrelatedParent');
|
645
|
+
* const unrelatedChild = document.getElementById('unrelatedChild');
|
646
|
+
* const result3 = isContains(unrelatedParent, unrelatedChild);
|
647
|
+
* console.log(result3); // Output: false
|
648
|
+
* // Explanation: In this case, the unrelated parent element (#unrelatedParent) and unrelated child element (#unrelatedChild) are not related in the DOM structure.
|
649
|
+
* ```
|
368
650
|
*/
|
369
651
|
|
370
652
|
function isContains(parentEl, childrenEl) {
|
@@ -386,13 +668,79 @@
|
|
386
668
|
|
387
669
|
return false;
|
388
670
|
}
|
671
|
+
/**
|
672
|
+
* 使用 requestAnimationFrame 执行函数,如果不支持则使用 setTimeout 作为兜底
|
673
|
+
* @desc {en} Executes a function using requestAnimationFrame, if not supported, falls back to setTimeout
|
674
|
+
* @param {Function} fn 需要执行的函数
|
675
|
+
* @param {Function} fn {en} the function to be executed
|
676
|
+
* @returns {number} 返回 requestAnimationFrame 或 setTimeout 的 ID
|
677
|
+
* @returns {number} {en} returns the ID of requestAnimationFrame or setTimeout
|
678
|
+
* @example
|
679
|
+
* ```
|
680
|
+
* import { execRAF } from '@arco-design/mobile-utils';
|
681
|
+
*
|
682
|
+
* // Example 1: Using requestAnimationFrame
|
683
|
+
* const rafId = execRAF(() => {
|
684
|
+
* console.log("Using requestAnimationFrame");
|
685
|
+
* });
|
686
|
+
* console.log(rafId); // Output: A numerical ID representing the requestAnimationFrame callback
|
687
|
+
* // Explanation:
|
688
|
+
* // This example demonstrates using `execRAF` with `requestAnimationFrame` to execute a function.
|
689
|
+
* // `requestAnimationFrame` is typically used for animations and smooth updates.
|
690
|
+
* // The ID returned by `requestAnimationFrame` is logged, which can be useful for canceling the animation frame if needed.
|
691
|
+
*
|
692
|
+
* // Example 2: Using setTimeout as a fallback
|
693
|
+
* const setTimeoutId = execRAF(() => {
|
694
|
+
* console.log("Using setTimeout as a fallback");
|
695
|
+
* });
|
696
|
+
* console.log(setTimeoutId); // Output: A numerical ID representing the setTimeout callback
|
697
|
+
* // Explanation:
|
698
|
+
* // In situations where the browser does not support `requestAnimationFrame`,
|
699
|
+
* // `execRAF` falls back to using `setTimeout` with a delay of approximately 17 milliseconds (equivalent to a frame rate of 60 frames per second).
|
700
|
+
* // The ID returned by `setTimeout` is logged, allowing you to manage the execution of the function, even in browsers without `requestAnimationFrame` support.
|
701
|
+
* ```
|
702
|
+
*/
|
703
|
+
|
389
704
|
function execRAF(fn) {
|
390
705
|
try {
|
391
706
|
return requestAnimationFrame(fn);
|
392
707
|
} catch (e) {
|
708
|
+
// Note that the delay time for setTimeout is 17 milliseconds, which is approximately equivalent to a frame rate of 60 frames per second.
|
709
|
+
// This is a good fallback option because requestAnimationFrame also typically runs at a rate of about 60 frames per second.
|
393
710
|
return setTimeout(fn, 17);
|
394
711
|
}
|
395
712
|
}
|
713
|
+
/**
|
714
|
+
* 使用动画滚动页面
|
715
|
+
* @desc {en} Scroll the page with animation
|
716
|
+
* @param {number} initTop 初始滚动位置(像素)
|
717
|
+
* @param {number} initTop {en} Initial scroll position (in pixels)
|
718
|
+
* @param {number} target 目标滚动位置(像素)
|
719
|
+
* @param {number} target {en} Target scroll position (in pixels)
|
720
|
+
* @param {function} scrollTo 滚动函数
|
721
|
+
* @param {function} scrollTo {en} Scroll function
|
722
|
+
* @param {number} duration 动画持续时间(毫秒)
|
723
|
+
* @param {number} duration {en} Animation duration (in milliseconds)
|
724
|
+
* @param {Array<number>} bezier 贝塞尔曲线参数
|
725
|
+
* @param {Array<number>} bezier {en} Bezier curve parameters
|
726
|
+
* @param {'by'|'to'} type 滚动类型:'by'表示相对滚动,'to'表示绝对滚动
|
727
|
+
* @param {'by'|'to'} type {en} Scroll type: 'by' for relative scrolling, 'to' for absolute scrolling
|
728
|
+
* @example
|
729
|
+
* ```
|
730
|
+
* import { scrollWithAnimation } from '@arco-design/mobile-utils';
|
731
|
+
*
|
732
|
+
* // Scroll to 500px from the current position over 1 second
|
733
|
+
* scrollWithAnimation(
|
734
|
+
* window.pageYOffset,
|
735
|
+
* 500,
|
736
|
+
* (top) => window.scrollTo({ top }),
|
737
|
+
* 1000,
|
738
|
+
* [0.34, 0.69, 0.1, 1],
|
739
|
+
* 'to'
|
740
|
+
* );
|
741
|
+
* ```
|
742
|
+
*/
|
743
|
+
|
396
744
|
function scrollWithAnimation(initTop, target, scrollTo, duration, bezier$1, type) {
|
397
745
|
if (duration === void 0) {
|
398
746
|
duration = 300;
|
@@ -428,6 +776,26 @@
|
|
428
776
|
* @desc {en} Returns the node's document properties
|
429
777
|
* @param {HTMLElement} node dom 节点
|
430
778
|
* @param {HTMLElement} node {en} dom Node
|
779
|
+
* @returns {HTMLElement | Document | null} 返回节点的最近可滚动父节点或 document 对象
|
780
|
+
* @returns {HTMLElement | Document | null} {en} Returns the nearest scrollable parent node of the node or the document object
|
781
|
+
* @example
|
782
|
+
* ```
|
783
|
+
* import { scrollParent } from '@arco-design/mobile-utils';
|
784
|
+
*
|
785
|
+
* // Example 1: Finding the scroll parent of a DOM node
|
786
|
+
* const targetNode = document.getElementById('targetElement');
|
787
|
+
* const scrollParentNode = scrollParent(targetNode);
|
788
|
+
* console.log(scrollParentNode); // Output: The nearest scrollable parent element or the document
|
789
|
+
* // Explanation:
|
790
|
+
* // This example demonstrates how to use the `scrollParent` function to find the nearest scrollable parent element of a given DOM node.
|
791
|
+
* // It returns the nearest scrollable parent element, or if none is found, it returns the document.
|
792
|
+
*
|
793
|
+
* // Example 2: Finding the scroll parent of the document body
|
794
|
+
* const bodyNode = document.body;
|
795
|
+
* const scrollParentBody = scrollParent(bodyNode);
|
796
|
+
* console.log(scrollParentBody); // Output: The document's HTML element (document.documentElement)
|
797
|
+
* // Explanation: In this scenario, we use the `scrollParent` function to find the scrollable parent of the document body.
|
798
|
+
* ```
|
431
799
|
*/
|
432
800
|
|
433
801
|
function scrollParent(node) {
|
@@ -464,6 +832,17 @@
|
|
464
832
|
* @desc {en} Get element offset
|
465
833
|
* @param {HTMLElement} node dom 节点
|
466
834
|
* @param {HTMLElement} node {en} Dom node
|
835
|
+
* @example
|
836
|
+
* ```
|
837
|
+
* import { getOffset } from '@arco-design/mobile-utils';
|
838
|
+
*
|
839
|
+
* const element = document.getElementById('exampleElement');
|
840
|
+
* const offset = getOffset(element);
|
841
|
+
* console.log('Element Width:', offset.width);
|
842
|
+
* console.log('Element Height:', offset.height);
|
843
|
+
* console.log('Element Top Offset:', offset.top);
|
844
|
+
* console.log('Element Left Offset:', offset.left);
|
845
|
+
* ```
|
467
846
|
*/
|
468
847
|
|
469
848
|
function getOffset(node) {
|
@@ -492,6 +871,22 @@
|
|
492
871
|
left: left
|
493
872
|
};
|
494
873
|
}
|
874
|
+
/**
|
875
|
+
* 格式化偏移量
|
876
|
+
* Format the offset
|
877
|
+
* @param {Array|number} offset 输入的偏移量,可以是一个数字或者一个长度为2或4的数组
|
878
|
+
* @param {Array|number} offset {en} The input offset, which can be a number or an array of length 2 or 4
|
879
|
+
* @returns {Array} 返回一个长度为4的数组,表示上、右、下、左四个方向的偏移量
|
880
|
+
* @returns {Array} {en} Returns an array of length 4, representing the offsets in the top, right, bottom, and left directions
|
881
|
+
* @example
|
882
|
+
* ```
|
883
|
+
* import { formatOffset } from '@arco-design/mobile-utils';
|
884
|
+
*
|
885
|
+
* console.log(formatOffset(10)) // output: [10, 10, 10, 10]
|
886
|
+
* console.log(formatOffset([10, 20])) // output: [10, 0, 20, 0]
|
887
|
+
* console.log(formatOffset([10, 20, 30, 40])) // output: [10, 20, 30, 40]
|
888
|
+
* ```
|
889
|
+
*/
|
495
890
|
|
496
891
|
function formatOffset(offset) {
|
497
892
|
var offsets;
|
@@ -515,6 +910,18 @@
|
|
515
910
|
* @param component {en} Current element node
|
516
911
|
* @param parent 当前元素所在容器 dom 节点
|
517
912
|
* @param parent {en} The dom node of the container where the current element is located
|
913
|
+
* @example
|
914
|
+
* ```
|
915
|
+
* import { checkOverflowVisible } from '@arco-design/mobile-utils';
|
916
|
+
*
|
917
|
+
* const component = {
|
918
|
+
* node: document.getElementById('myComponent'),
|
919
|
+
* offset: 20, // Set the offset value
|
920
|
+
* threshold: 0.5, // Set the threshold value
|
921
|
+
* }
|
922
|
+
* const myParent = document.getElementById('myParent');
|
923
|
+
* const isVisible = checkOverflowVisible(component, myParent);
|
924
|
+
* ```
|
518
925
|
*/
|
519
926
|
|
520
927
|
|
@@ -552,8 +959,30 @@
|
|
552
959
|
/**
|
553
960
|
* 检查非局部滚动容器元素是否在视口区域内
|
554
961
|
* @desc {en} Check if a non-local scroll container element is inside the viewport area
|
555
|
-
* @param component
|
962
|
+
* @param component 当前元素节点
|
556
963
|
* @param component {en} Current element node
|
964
|
+
* @returns {boolean} 如果元素可见,则返回 true,否则返回 false。
|
965
|
+
* @returns {boolean} {en} Returns true if the element is visible, otherwise returns false.
|
966
|
+
* @example
|
967
|
+
* ```
|
968
|
+
* import { checkNormalVisible } from '@arco-design/mobile-utils';
|
969
|
+
*
|
970
|
+
* // Example usage:
|
971
|
+
* const element = document.getElementById('myElement');
|
972
|
+
*
|
973
|
+
* // Make sure to set the offset and threshold values to actual values that suit your use case.
|
974
|
+
* const isVisible = checkNormalVisible({
|
975
|
+
* node: element,
|
976
|
+
* offset: 20, // Set the offset value
|
977
|
+
* threshold: 0.5, // Set the threshold value
|
978
|
+
* });
|
979
|
+
*
|
980
|
+
* if (isVisible) {
|
981
|
+
* console.log('The element is in the viewport area');
|
982
|
+
* } else {
|
983
|
+
* console.log('The element is not in the viewport area');
|
984
|
+
* }
|
985
|
+
* ```
|
557
986
|
*/
|
558
987
|
|
559
988
|
function checkNormalVisible(component) {
|
@@ -589,6 +1018,17 @@
|
|
589
1018
|
* @param id {en} added dom id
|
590
1019
|
* @param getContainer 被添加元素的父级
|
591
1020
|
* @param getContainer {en} The parent of the added element
|
1021
|
+
* @example
|
1022
|
+
* ```
|
1023
|
+
* import { appendElementById } from '@arco-design/mobile-utils';
|
1024
|
+
*
|
1025
|
+
* // Example 1: Add a div element with the id "myDiv" to the body.
|
1026
|
+
* const { child, container } = appendElementById("myDiv");
|
1027
|
+
*
|
1028
|
+
* // Example 2: Add a div element with the id "customDiv" to a specific container.
|
1029
|
+
* const customContainer = document.getElementById("customContainer");
|
1030
|
+
* const { child, container } = appendElementById("customDiv", () => customContainer);
|
1031
|
+
* ```
|
592
1032
|
*/
|
593
1033
|
|
594
1034
|
function appendElementById(id, getContainer) {
|
@@ -602,10 +1042,19 @@
|
|
602
1042
|
};
|
603
1043
|
}
|
604
1044
|
/**
|
605
|
-
*
|
1045
|
+
* 从父级节点移除该元素
|
606
1046
|
* @desc {en} Remove element from parent node
|
607
1047
|
* @param ele 待移除元素
|
608
1048
|
* @param ele {en} Element to be removed
|
1049
|
+
* @example
|
1050
|
+
* ```
|
1051
|
+
* import { removeElement } from '@arco-design/mobile-utils';
|
1052
|
+
*
|
1053
|
+
* // HTML: <div id="myElement">This is a div</div>
|
1054
|
+
* const elementToRemove = document.getElementById('myElement');
|
1055
|
+
* // The element with ID 'myElement' will be removed from the DOM
|
1056
|
+
* removeElement(elementToRemove);
|
1057
|
+
* ```
|
609
1058
|
*/
|
610
1059
|
|
611
1060
|
function removeElement(ele) {
|
@@ -613,10 +1062,37 @@
|
|
613
1062
|
ele.parentNode.removeChild(ele);
|
614
1063
|
}
|
615
1064
|
}
|
1065
|
+
/**
|
1066
|
+
* 获取滚动容器,如果传入 string 则使用 querySelector 选取容器
|
1067
|
+
* @desc {en} Get the scrolling container. If a string is passed in, use querySelector to select the container
|
1068
|
+
* @param getContainer 指定滚动容器
|
1069
|
+
* @param getContainer {en} Specifies the scrolling container.
|
1070
|
+
* @example
|
1071
|
+
* ```
|
1072
|
+
* import { getActualContainer } from '@arco-design/mobile-utils';
|
1073
|
+
*
|
1074
|
+
* const customContainer = document.getElementById("customContainer");
|
1075
|
+
* const actualContainer = getActualContainer(() => customContainer);
|
1076
|
+
* ```
|
1077
|
+
*/
|
1078
|
+
|
616
1079
|
function getActualContainer(getContainer) {
|
617
1080
|
var container = getContainer ? getContainer() : void 0;
|
618
1081
|
return typeof container === 'string' ? document.querySelector(container) : container;
|
619
1082
|
}
|
1083
|
+
/**
|
1084
|
+
* 获取有效滚动监听容器,默认情况或者监听 body 的滚动时均指定为 window
|
1085
|
+
* @desc {en} Get the effective scrolling container, which is specified as window by default or for listening to the scrolling of the body
|
1086
|
+
* @param getContainer 指定滚动容器
|
1087
|
+
* @param getContainer {en} Specifies the scrolling container.
|
1088
|
+
* @example
|
1089
|
+
* ```
|
1090
|
+
* import { getValidScrollContainer } from '@arco-design/mobile-utils';
|
1091
|
+
*
|
1092
|
+
* const customContainer = document.getElementById("customContainer");
|
1093
|
+
* const validScrollContainer = getValidScrollContainer(() => customContainer);
|
1094
|
+
*/
|
1095
|
+
|
620
1096
|
function getValidScrollContainer(getContainer) {
|
621
1097
|
// 默认为window
|
622
1098
|
// @en Default is window
|
@@ -625,6 +1101,22 @@
|
|
625
1101
|
|
626
1102
|
return originContainer === document.body ? window : originContainer;
|
627
1103
|
}
|
1104
|
+
/**
|
1105
|
+
* 获取滚动容器的属性。针对 window 和 document 额外进行一些属性兼容处理。
|
1106
|
+
* @desc {en} Get properties of the scrolling container. Perform additional attribute compatibility processing for window and document.
|
1107
|
+
* @param property 所需属性
|
1108
|
+
* @param property {en} Required attributes
|
1109
|
+
* @param {() => HTMLElement | Window | Document | null} getContainer 待计算滚动容器
|
1110
|
+
* @param getContainer {en} Scrolling container to be calculated.
|
1111
|
+
* @example
|
1112
|
+
* ```
|
1113
|
+
* import { getScrollContainerAttribute } from '@arco-design/mobile-utils';
|
1114
|
+
*
|
1115
|
+
* const contentRef = useRef<HTMLDivElement>(null);
|
1116
|
+
* const scrollTop = getScrollContainerAttribute('scrollTop', () => contentRef.current);
|
1117
|
+
* ```
|
1118
|
+
*/
|
1119
|
+
|
628
1120
|
function getScrollContainerAttribute(property, getContainer) {
|
629
1121
|
var container = getContainer ? getContainer() : window;
|
630
1122
|
if (!container) return 0;
|
@@ -652,6 +1144,20 @@
|
|
652
1144
|
|
653
1145
|
return container[property];
|
654
1146
|
}
|
1147
|
+
/**
|
1148
|
+
* 提供了元素的大小及其相对于视口的位置。
|
1149
|
+
* @desc {en} Provide information about the size of an element and its position relative to the viewport.
|
1150
|
+
* @param {HTMLElement | Window | null} container 滚动容器
|
1151
|
+
* @param container {en} Scroll Container
|
1152
|
+
* @example
|
1153
|
+
* ```
|
1154
|
+
* import { getScrollContainerAttribute } from '@arco-design/mobile-utils';
|
1155
|
+
*
|
1156
|
+
* const contentRef = useRef<HTMLDivElement>(null);
|
1157
|
+
* const scrollTop = getScrollContainerAttribute('scrollTop', () => contentRef.current);
|
1158
|
+
* ```
|
1159
|
+
*/
|
1160
|
+
|
655
1161
|
function getScrollContainerRect(container) {
|
656
1162
|
var containerRect = {
|
657
1163
|
top: 0,
|
@@ -689,6 +1195,19 @@
|
|
689
1195
|
};
|
690
1196
|
}
|
691
1197
|
var styleDoms = {};
|
1198
|
+
/**
|
1199
|
+
* 删除自定义 style 标签,配合 addCssStyleDom 函数一起使用
|
1200
|
+
* @desc {en} Remove custom style tags and use it in conjunction with the addCssStyleDom function
|
1201
|
+
* @param key 标签对应的key
|
1202
|
+
* @param key {en} Key corresponding to the tag
|
1203
|
+
* @example
|
1204
|
+
* ```
|
1205
|
+
* import { removeCssStyleDom } from '@arco-design/mobile-utils';
|
1206
|
+
*
|
1207
|
+
* removeCssStyleDom('arcoTheme');
|
1208
|
+
* ```
|
1209
|
+
*/
|
1210
|
+
|
692
1211
|
function removeCssStyleDom(key) {
|
693
1212
|
var styleDom = styleDoms[key];
|
694
1213
|
|
@@ -697,6 +1216,21 @@
|
|
697
1216
|
delete styleDoms[key];
|
698
1217
|
}
|
699
1218
|
}
|
1219
|
+
/**
|
1220
|
+
* 添加自定义 style 标签,addCssKeyframes 和 addCssRules 的底层方法
|
1221
|
+
* @desc {en} Add custom style tags, underlying methods for addCssKeyframes and addCssRules
|
1222
|
+
* @param key 标签对应的key
|
1223
|
+
* @param key {en} Key corresponding to the tag
|
1224
|
+
* @param html 样式内容
|
1225
|
+
* @param html {en} style information (CSS)
|
1226
|
+
* @example
|
1227
|
+
* ```
|
1228
|
+
* import { addCssStyleDom } from '@arco-design/mobile-utils';
|
1229
|
+
*
|
1230
|
+
* addCssStyleDom('arcoTheme', ':root {--base-font-size: 50;}');
|
1231
|
+
* ```
|
1232
|
+
*/
|
1233
|
+
|
700
1234
|
function addCssStyleDom(key, html) {
|
701
1235
|
removeCssStyleDom(key);
|
702
1236
|
var style = document.createElement('style');
|
@@ -704,9 +1238,53 @@
|
|
704
1238
|
document.documentElement.appendChild(style);
|
705
1239
|
styleDoms[key] = style;
|
706
1240
|
}
|
1241
|
+
/**
|
1242
|
+
* 增加自定义关键帧动画变量,实现动画函数复用。
|
1243
|
+
* @desc {en} Add custom keyframe animation variables to achieve reuse of animation functions
|
1244
|
+
* @param key 规则名称
|
1245
|
+
* @param key {en} Rule Name
|
1246
|
+
* @param rules 动画关键帧
|
1247
|
+
* @param rules {en} Animation keyframes
|
1248
|
+
* @example
|
1249
|
+
* ```
|
1250
|
+
* import { addCssKeyframes } from '@arco-design/mobile-utils';
|
1251
|
+
*
|
1252
|
+
* const maxScaleWithDefault = 2;
|
1253
|
+
addCssKeyframes(
|
1254
|
+
'animationKey',
|
1255
|
+
`{
|
1256
|
+
0% {
|
1257
|
+
width: 100%;
|
1258
|
+
}
|
1259
|
+
50% {
|
1260
|
+
width: ${100 * maxScaleWithDefault}%;
|
1261
|
+
}
|
1262
|
+
100% {
|
1263
|
+
width: 100%;
|
1264
|
+
}
|
1265
|
+
}`,
|
1266
|
+
);
|
1267
|
+
* ```
|
1268
|
+
*/
|
1269
|
+
|
707
1270
|
function addCssKeyframes(key, rules) {
|
708
1271
|
addCssStyleDom(key, "@keyframes " + key + " " + rules + "\n@-webkit-keyframes " + key + " " + rules);
|
709
1272
|
}
|
1273
|
+
/**
|
1274
|
+
* 增加自定义 CSS 变量规则,使用后将在线替换css变量。需设置less变量 @use-css-vars: 1
|
1275
|
+
* @desc {en} Add custom CSS variable rules, which will replace CSS variables online after use.The less variable needs to be set @use-css-vars: 1.
|
1276
|
+
* @param key 规则名称
|
1277
|
+
* @param key {en} Rule Name
|
1278
|
+
* @param rules 规则对象
|
1279
|
+
* @param rules {en} Rule Object
|
1280
|
+
* @example
|
1281
|
+
* ```
|
1282
|
+
* import { addCssRules } from '@arco-design/mobile-utils';
|
1283
|
+
*
|
1284
|
+
* addCssRules('arcoTheme', { 'base-font-size': '50' });
|
1285
|
+
* ```
|
1286
|
+
*/
|
1287
|
+
|
710
1288
|
function addCssRules(key, rules) {
|
711
1289
|
if (!rules || !Object.keys(rules).length) {
|
712
1290
|
return;
|
@@ -716,6 +1294,22 @@
|
|
716
1294
|
return "--" + rule + ": " + rules[rule] + ";";
|
717
1295
|
}).join('\n') + "}");
|
718
1296
|
}
|
1297
|
+
/**
|
1298
|
+
* 获取元素的时间属性值,结果统一成毫秒级别
|
1299
|
+
* @desc {en} Get the time attribute value of the element, and the results are unified into milliseconds
|
1300
|
+
* @param ele 要获取样式的元素
|
1301
|
+
* @param ele {en} Element to get the computed style
|
1302
|
+
* @param property 与时间相关属性
|
1303
|
+
* @param property {en} Property related to time
|
1304
|
+
* @example
|
1305
|
+
* ```
|
1306
|
+
* import { convertCssDuration } from '@arco-design/mobile-utils';
|
1307
|
+
*
|
1308
|
+
* const contentRef = useRef<HTMLDivElement>(null);
|
1309
|
+
* const transTimeout = convertCssDuration(contentRef.current, 'transitionDuration');
|
1310
|
+
* ```
|
1311
|
+
*/
|
1312
|
+
|
719
1313
|
function convertCssDuration(ele, property) {
|
720
1314
|
var timeout = window.getComputedStyle(ele)[property];
|
721
1315
|
|
@@ -729,6 +1323,20 @@
|
|
729
1323
|
|
730
1324
|
return 0;
|
731
1325
|
}
|
1326
|
+
/**
|
1327
|
+
* 获取指定元素的 CSS 样式,当抛出异常时返回空对象
|
1328
|
+
* @desc {en} Get the CSS style of the specified element and return an empty object when an exception is thrown
|
1329
|
+
* @param element 要获取样式的元素
|
1330
|
+
* @param element {en} Element to get the computed style
|
1331
|
+
* @example
|
1332
|
+
* ```
|
1333
|
+
* import { safeGetComputedStyle } from '@arco-design/mobile-utils';
|
1334
|
+
*
|
1335
|
+
* const element = document.querySelector("p");
|
1336
|
+
* const compStyle =safeGetComputedStyle(element);
|
1337
|
+
* ```
|
1338
|
+
*/
|
1339
|
+
|
732
1340
|
function safeGetComputedStyle(element) {
|
733
1341
|
try {
|
734
1342
|
return window.getComputedStyle(element);
|
@@ -760,6 +1368,10 @@
|
|
760
1368
|
return Comp;
|
761
1369
|
}
|
762
1370
|
|
1371
|
+
/**
|
1372
|
+
* @type utils
|
1373
|
+
* @name color
|
1374
|
+
*/
|
763
1375
|
var w3cx11 = {
|
764
1376
|
aliceblue: '#f0f8ff',
|
765
1377
|
antiquewhite: '#faebd7',
|
@@ -917,6 +1529,21 @@
|
|
917
1529
|
yellow: '#ffff00',
|
918
1530
|
yellowgreen: '#9acd32'
|
919
1531
|
};
|
1532
|
+
/**
|
1533
|
+
* 获取任意颜色的透明色
|
1534
|
+
* @desc {en} Get any transparent color
|
1535
|
+
* @param color 颜色
|
1536
|
+
* @param color {en} color
|
1537
|
+
* @returns transparent color
|
1538
|
+
* @example
|
1539
|
+
* ```
|
1540
|
+
* import { fadeColor } from '@arco-design/mobile-utils';
|
1541
|
+
*
|
1542
|
+
* const transparentColor = fadeColor('#ffffff');
|
1543
|
+
* // transparentColor is '#ffffff00'
|
1544
|
+
* ```
|
1545
|
+
*/
|
1546
|
+
|
920
1547
|
function fadeColor(color) {
|
921
1548
|
if (!color) {
|
922
1549
|
return '';
|
@@ -937,6 +1564,27 @@
|
|
937
1564
|
return '';
|
938
1565
|
}
|
939
1566
|
|
1567
|
+
/**
|
1568
|
+
* 获取当前设备的操作系统
|
1569
|
+
* @desc {en} Get the operating system of the current device
|
1570
|
+
* @returns {string} 返回当前设备的操作系统,可能的值包括 'android'、'ios' 或 'pc',如果无法获取,则返回空字符串
|
1571
|
+
* @returns {string} {en} Returns the operating system of the current device, possible values are 'android', 'ios', or 'pc'. Returns an empty string if it cannot be obtained
|
1572
|
+
* @example
|
1573
|
+
* ```
|
1574
|
+
* import { getSystem } from '@arco-design/mobile-utils';
|
1575
|
+
*
|
1576
|
+
* const systemInfo = getSystem();
|
1577
|
+
* if (systemInfo === 'android') {
|
1578
|
+
* console.log('You are using the Android operating system');
|
1579
|
+
* } else if (systemInfo === 'ios') {
|
1580
|
+
* console.log('You are using the iOS operating system');
|
1581
|
+
* } else if (systemInfo === 'pc') {
|
1582
|
+
* console.log('You are using a desktop PC operating system');
|
1583
|
+
* } else {
|
1584
|
+
* console.log('Unable to detect your operating system');
|
1585
|
+
* }
|
1586
|
+
* ```
|
1587
|
+
*/
|
940
1588
|
function getSystem() {
|
941
1589
|
try {
|
942
1590
|
var u = navigator.userAgent;
|
@@ -949,6 +1597,21 @@
|
|
949
1597
|
return '';
|
950
1598
|
}
|
951
1599
|
}
|
1600
|
+
/**
|
1601
|
+
* 检查是否在 SSR 环境
|
1602
|
+
* @desc {en} Check if in ssr environment
|
1603
|
+
* @example
|
1604
|
+
* ```
|
1605
|
+
* import { isSSR } from '@arco-design/mobile-utils';
|
1606
|
+
*
|
1607
|
+
* if (isSSR()) {
|
1608
|
+
* console.log("It is currently in the ssr stage");
|
1609
|
+
* } else {
|
1610
|
+
* console.log("It is currently in the csr stage");
|
1611
|
+
* }
|
1612
|
+
* ```
|
1613
|
+
*/
|
1614
|
+
|
952
1615
|
function isSSR() {
|
953
1616
|
return typeof window === 'undefined';
|
954
1617
|
}
|
@@ -2974,6 +3637,25 @@
|
|
2974
3637
|
* @type utils
|
2975
3638
|
* @name utils
|
2976
3639
|
*/
|
3640
|
+
/**
|
3641
|
+
* 基于给定的过滤函数返回一个过滤后的数组
|
3642
|
+
* @desc {en} Returns a filtered array based on the given filter function
|
3643
|
+
* @param {T[]} data 数据数组
|
3644
|
+
* @param {T[]} data {en} data array
|
3645
|
+
* @param {Function} filterFn 过滤函数
|
3646
|
+
* @param {Function} filterFn {en} filter function
|
3647
|
+
* @param {Object} options 可选对象
|
3648
|
+
* @param {Object} options {en} Optional object
|
3649
|
+
* @return {string} 过滤后的数组
|
3650
|
+
* @return {string} filtered array
|
3651
|
+
* @example
|
3652
|
+
* ```
|
3653
|
+
* import { arrayTreeFilter } from '@arco-design/mobile-utils';
|
3654
|
+
*
|
3655
|
+
* const test = arrayTreeFilter(data, (item: any, level: number) => level <= index && item.value === value[level]);
|
3656
|
+
* ```
|
3657
|
+
*/
|
3658
|
+
|
2977
3659
|
function arrayTreeFilter(data, filterFn, options) {
|
2978
3660
|
options = options || {};
|
2979
3661
|
options.childrenKeyName = options.childrenKeyName || 'children';
|
@@ -3002,8 +3684,16 @@
|
|
3002
3684
|
return result;
|
3003
3685
|
}
|
3004
3686
|
/**
|
3005
|
-
*
|
3006
|
-
* @desc {en}
|
3687
|
+
* 在下一个事件循环周期执行给定的函数
|
3688
|
+
* @desc {en} Execute the given function on the next event loop cycle
|
3689
|
+
* @param {Function} func 执行的函数
|
3690
|
+
* @param {Function} func {en} function executed
|
3691
|
+
* @example
|
3692
|
+
* ```
|
3693
|
+
* import { nextTick } from '@arco-design/mobile-utils';
|
3694
|
+
*
|
3695
|
+
* nextTick(() => { updateLayoutData(); });
|
3696
|
+
* ```
|
3007
3697
|
*/
|
3008
3698
|
|
3009
3699
|
function nextTick(func) {
|
@@ -3014,6 +3704,18 @@
|
|
3014
3704
|
* @desc {en} To simulate the sliding damping effect, use the function x = X/(aX+b), where x is the element displacement, X is the sliding distance, and a and b are custom parameters obtained by setting the corresponding relationship between the two targets
|
3015
3705
|
* 例如目标X=500时x=100, X=200时x=60,可得a,b
|
3016
3706
|
* @desc {en} For example, when the target X=500, x=100, when X=200, x=60, you can get a,b
|
3707
|
+
* @param {number} x 元素位移
|
3708
|
+
* @param {number} x {en} element displacement
|
3709
|
+
* @param {[number, number] | number} damping 阻尼参数
|
3710
|
+
* @param {[number, number] | number} damping {en} Damping parameters
|
3711
|
+
* @return {number} 返回需要滑动的距离
|
3712
|
+
* @return {number} {en} Return the distance required to slide
|
3713
|
+
* @example
|
3714
|
+
* ```
|
3715
|
+
* import { fingerDisToLabelDis } from '@arco-design/mobile-utils';
|
3716
|
+
*
|
3717
|
+
* const test = fingerDisToLabelDis(1000, 0.01);
|
3718
|
+
* ```
|
3017
3719
|
*/
|
3018
3720
|
|
3019
3721
|
function fingerDisToLabelDis(x, damping) {
|
@@ -3028,11 +3730,12 @@
|
|
3028
3730
|
return x / (a * x + b);
|
3029
3731
|
}
|
3030
3732
|
|
3733
|
+
var DEFAULT_DARK_MODE_SELECTOR = 'arco-theme-dark';
|
3031
3734
|
var defaultContext = {
|
3032
3735
|
prefixCls: 'arco',
|
3033
3736
|
system: '',
|
3034
3737
|
useDarkMode: false,
|
3035
|
-
|
3738
|
+
darkModeSelector: DEFAULT_DARK_MODE_SELECTOR,
|
3036
3739
|
locale: defaultLocale,
|
3037
3740
|
useRtl: false
|
3038
3741
|
};
|
@@ -3049,25 +3752,63 @@
|
|
3049
3752
|
function ContextProvider(props) {
|
3050
3753
|
var children = props.children,
|
3051
3754
|
useDarkMode = props.useDarkMode,
|
3052
|
-
|
3755
|
+
userSetIsDarkMode = props.isDarkMode,
|
3756
|
+
_a = props.darkModeSelector,
|
3757
|
+
darkModeSelector = _a === void 0 ? DEFAULT_DARK_MODE_SELECTOR : _a,
|
3053
3758
|
theme = props.theme,
|
3054
|
-
|
3055
|
-
locale =
|
3056
|
-
|
3759
|
+
_b = props.locale,
|
3760
|
+
locale = _b === void 0 ? defaultLocale : _b,
|
3761
|
+
onDarkModeChange = props.onDarkModeChange,
|
3762
|
+
restProps = __rest$1(props, ["children", "useDarkMode", "isDarkMode", "darkModeSelector", "theme", "locale", "onDarkModeChange"]);
|
3057
3763
|
|
3058
|
-
var
|
3059
|
-
|
3060
|
-
|
3764
|
+
var _c = React.useState(function () {
|
3765
|
+
if (typeof window !== 'undefined' && useDarkMode) {
|
3766
|
+
return window.matchMedia('(prefers-color-scheme: dark)').matches;
|
3767
|
+
}
|
3061
3768
|
|
3769
|
+
return false;
|
3770
|
+
}),
|
3771
|
+
isDarkModeState = _c[0],
|
3772
|
+
setIsDarkModeState = _c[1];
|
3773
|
+
|
3774
|
+
var mountedRef = React.useRef(false);
|
3775
|
+
|
3776
|
+
var setDarkModeState = function setDarkModeState(isDark, needChange) {
|
3777
|
+
if (needChange === void 0) {
|
3778
|
+
needChange = true;
|
3779
|
+
}
|
3780
|
+
|
3781
|
+
setIsDarkModeState(isDark);
|
3782
|
+
needChange && onDarkModeChange && onDarkModeChange(isDark);
|
3783
|
+
};
|
3784
|
+
|
3785
|
+
var isDarkMode = React.useMemo(function () {
|
3786
|
+
// 如果未开启暗黑模式则不对body做操作
|
3787
|
+
// @en If dark mode is not turned on, no operation will be performed on the body
|
3788
|
+
if (userSetIsDarkMode === void 0 && !useDarkMode) {
|
3789
|
+
return false;
|
3790
|
+
}
|
3791
|
+
|
3792
|
+
var value = Boolean(userSetIsDarkMode !== void 0 ? userSetIsDarkMode : isDarkModeState);
|
3793
|
+
var needUpdateBody = darkModeSelector && typeof document !== 'undefined';
|
3794
|
+
|
3795
|
+
if (value) {
|
3796
|
+
needUpdateBody && document.body.classList.add(darkModeSelector);
|
3797
|
+
} else {
|
3798
|
+
needUpdateBody && document.body.classList.remove(darkModeSelector);
|
3799
|
+
}
|
3800
|
+
|
3801
|
+
return value;
|
3802
|
+
}, [userSetIsDarkMode, isDarkModeState, darkModeSelector, useDarkMode]);
|
3062
3803
|
var changeDarkMode = React.useCallback(function (res) {
|
3063
|
-
return
|
3804
|
+
return setDarkModeState(res.matches);
|
3064
3805
|
}, []);
|
3065
3806
|
React.useEffect(function () {
|
3066
3807
|
var matchMedia = window.matchMedia('(prefers-color-scheme: dark)');
|
3067
3808
|
|
3068
3809
|
if (useDarkMode) {
|
3069
3810
|
var dark = matchMedia.matches;
|
3070
|
-
|
3811
|
+
setDarkModeState(dark, mountedRef.current);
|
3071
3812
|
|
3072
3813
|
if (typeof matchMedia.addEventListener === 'function') {
|
3073
3814
|
matchMedia.addEventListener('change', changeDarkMode);
|
@@ -3076,6 +3817,7 @@
|
|
3076
3817
|
}
|
3077
3818
|
}
|
3078
3819
|
|
3820
|
+
mountedRef.current = true;
|
3079
3821
|
return function () {
|
3080
3822
|
if (useDarkMode) {
|
3081
3823
|
if (typeof matchMedia.removeEventListener === 'function') {
|
@@ -3098,7 +3840,7 @@
|
|
3098
3840
|
}, [theme]);
|
3099
3841
|
return /*#__PURE__*/React__default["default"].createElement(GlobalContext.Provider, {
|
3100
3842
|
value: __assign$2(__assign$2(__assign$2({}, defaultContext), restProps), {
|
3101
|
-
isDarkMode: isDarkMode
|
3843
|
+
isDarkMode: isDarkMode,
|
3102
3844
|
useDarkMode: useDarkMode,
|
3103
3845
|
locale: locale || defaultLocale
|
3104
3846
|
})
|
@@ -3116,6 +3858,23 @@
|
|
3116
3858
|
};
|
3117
3859
|
}
|
3118
3860
|
|
3861
|
+
/**
|
3862
|
+
* 监听页面resize事件的统一封装
|
3863
|
+
* @desc {en} Unified encapsulation for monitoring page resize events
|
3864
|
+
* @param resizeHandler resize事件回调
|
3865
|
+
* @param resizeHandler {en} Resize event callback
|
3866
|
+
* @param deps 触发事件绑定更新的依赖
|
3867
|
+
* @param deps {en} Dependencies that trigger event binding updates
|
3868
|
+
* @param needListen 是否开启事件监听,默认开启
|
3869
|
+
* @param needListen {en} Whether to enable event monitoring
|
3870
|
+
* @example
|
3871
|
+
* ```
|
3872
|
+
* import { useListenResize } from '@arco-design/mobile-react/esm/_helpers/hooks';
|
3873
|
+
*
|
3874
|
+
* useListenResize(setSize, [], listenResize);
|
3875
|
+
* ```
|
3876
|
+
*/
|
3877
|
+
|
3119
3878
|
function useListenResize(resizeHandler, deps, needListen) {
|
3120
3879
|
if (deps === void 0) {
|
3121
3880
|
deps = [];
|
@@ -3126,15 +3885,16 @@
|
|
3126
3885
|
}
|
3127
3886
|
|
3128
3887
|
React.useEffect(function () {
|
3129
|
-
if (
|
3130
|
-
|
3888
|
+
if (needListen) {
|
3889
|
+
window.addEventListener('resize', resizeHandler);
|
3890
|
+
window.addEventListener('orientationchange', resizeHandler);
|
3131
3891
|
}
|
3132
3892
|
|
3133
|
-
window.addEventListener('resize', resizeHandler);
|
3134
|
-
window.addEventListener('orientationchange', resizeHandler);
|
3135
3893
|
return function () {
|
3136
|
-
|
3137
|
-
|
3894
|
+
if (needListen) {
|
3895
|
+
window.removeEventListener('resize', resizeHandler);
|
3896
|
+
window.removeEventListener('orientationchange', resizeHandler);
|
3897
|
+
}
|
3138
3898
|
};
|
3139
3899
|
}, __spreadArrays$1(deps, [needListen]));
|
3140
3900
|
}
|
@@ -3145,6 +3905,7 @@
|
|
3145
3905
|
* @desc {en} Tips: Use in scenarios where asynchronous processing is not completed after unmount. It is not recommended to replace useState without brains
|
3146
3906
|
* @param initialState 初始状态
|
3147
3907
|
* @param initialState {en} Initial State
|
3908
|
+
* @returns [state, setState],同useState返回值
|
3148
3909
|
* @example
|
3149
3910
|
* ```
|
3150
3911
|
* import { useMountedState } from '@arco-design/mobile-react/esm/_helpers/hooks';
|
@@ -3174,6 +3935,20 @@
|
|
3174
3935
|
var result = [state, setValidState];
|
3175
3936
|
return result;
|
3176
3937
|
}
|
3938
|
+
/**
|
3939
|
+
* 用useState管理状态,且在状态更新之前同步至ref,并返回ref
|
3940
|
+
* @desc {en} Use useState to manage the state, and synchronize to ref before the state is updated, and return ref
|
3941
|
+
* @param initialValue 初始状态
|
3942
|
+
* @param initialValue {en} Initial State
|
3943
|
+
* @returns [state, stateRef, setState]
|
3944
|
+
* @example
|
3945
|
+
* ```
|
3946
|
+
* import { useSameRefState } from '@arco-design/mobile-react/esm/_helpers/hooks';
|
3947
|
+
*
|
3948
|
+
* const [opened, openedRef, setOpened] = useSameRefState(false);
|
3949
|
+
* ```
|
3950
|
+
*/
|
3951
|
+
|
3177
3952
|
function useSameRefState(initialValue) {
|
3178
3953
|
var _a = React.useState(initialValue),
|
3179
3954
|
state = _a[0],
|
@@ -3188,6 +3963,20 @@
|
|
3188
3963
|
|
3189
3964
|
return [state, stateRef, setStateProxy];
|
3190
3965
|
}
|
3966
|
+
/**
|
3967
|
+
* 用useState管理状态,且在状态更新后同步至ref,并返回ref
|
3968
|
+
* @desc {en} Use useState to manage the state, and synchronize to ref after the state is updated, and return ref
|
3969
|
+
* @param initialValue 初始状态
|
3970
|
+
* @param initialValue {en} Initial State
|
3971
|
+
* @returns [state, stateRef, setState]
|
3972
|
+
* @example
|
3973
|
+
* ```
|
3974
|
+
* import { useRefState } from '@arco-design/mobile-react/esm/_helpers/hooks';
|
3975
|
+
*
|
3976
|
+
* const [index, indexRef, setIndex] = useRefState(currentIndex);
|
3977
|
+
* ```
|
3978
|
+
*/
|
3979
|
+
|
3191
3980
|
function useRefState(initialValue) {
|
3192
3981
|
var _a = React.useState(initialValue),
|
3193
3982
|
state = _a[0],
|
@@ -3199,6 +3988,23 @@
|
|
3199
3988
|
}, [state]);
|
3200
3989
|
return [state, stateRef, setState];
|
3201
3990
|
}
|
3991
|
+
/**
|
3992
|
+
* useEffect特殊封装,仅在非首次依赖更新时触发回调
|
3993
|
+
* @desc {en} Special encapsulation of useEffect, which only triggers the callback when the dependency is not updated for the first time
|
3994
|
+
* @param effect useEffect回调
|
3995
|
+
* @param effect {en} useEffect callback
|
3996
|
+
* @param dependencies useEffect依赖
|
3997
|
+
* @param dependencies {en} useEffect dependencies
|
3998
|
+
* @example
|
3999
|
+
* ```
|
4000
|
+
* import { useUpdateEffect } from '@arco-design/mobile-react/esm/_helpers/hooks';
|
4001
|
+
*
|
4002
|
+
* useUpdateEffect(() => {
|
4003
|
+
* handleIndexChange(index);
|
4004
|
+
* }, [index]);
|
4005
|
+
* ```
|
4006
|
+
*/
|
4007
|
+
|
3202
4008
|
function useUpdateEffect(effect, dependencies) {
|
3203
4009
|
if (dependencies === void 0) {
|
3204
4010
|
dependencies = [];
|
@@ -3213,6 +4019,21 @@
|
|
3213
4019
|
}
|
3214
4020
|
}, dependencies);
|
3215
4021
|
}
|
4022
|
+
/**
|
4023
|
+
* 获取任意变量的最新ref值(用于监听属性、方法等非state变量)
|
4024
|
+
* @desc {en} Get the latest ref value of any variable (used to monitor non-state variables such as properties and methods)
|
4025
|
+
* @param variable 待获取最新值的变量
|
4026
|
+
* @param variable {en} Variable to get latest value
|
4027
|
+
* @returns variableRef,变量的最新ref值
|
4028
|
+
* @example
|
4029
|
+
* ```
|
4030
|
+
* import { useLatestRef } from '@arco-design/mobile-react/esm/_helpers/hooks';
|
4031
|
+
*
|
4032
|
+
* const { wrapSize } = props;
|
4033
|
+
* const wrapSizeRef = useLatestRef(wrapSize);
|
4034
|
+
* ```
|
4035
|
+
*/
|
4036
|
+
|
3216
4037
|
function useLatestRef(variable) {
|
3217
4038
|
var variableRef = React.useRef(variable);
|
3218
4039
|
React.useEffect(function () {
|
@@ -3220,6 +4041,18 @@
|
|
3220
4041
|
}, [variable]);
|
3221
4042
|
return variableRef;
|
3222
4043
|
}
|
4044
|
+
/**
|
4045
|
+
* 从navigator.userAgent中获取当前操作系统,如果无法获取ua,则从ContextProvider传入的system中获取值
|
4046
|
+
* @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
|
4047
|
+
* @returns system 操作系统,"" | "pc" | "android" | "ios"
|
4048
|
+
* @example
|
4049
|
+
* ```
|
4050
|
+
* import { useSystem } from '@arco-design/mobile-react/esm/_helpers/hooks';
|
4051
|
+
*
|
4052
|
+
* const system = useSystem();
|
4053
|
+
* ```
|
4054
|
+
*/
|
4055
|
+
|
3223
4056
|
function useSystem() {
|
3224
4057
|
var currentSystem = React.useContext(GlobalContext).system;
|
3225
4058
|
|
@@ -3234,12 +4067,26 @@
|
|
3234
4067
|
}, [currentSystem]);
|
3235
4068
|
return system;
|
3236
4069
|
}
|
4070
|
+
/**
|
4071
|
+
* 获取页面视口宽高大小,并在页面有resize时更新大小
|
4072
|
+
* @desc {en} Get the width and height of the page viewport, and update the size when the page is resized
|
4073
|
+
* @param needListen 是否开启resize事件监听
|
4074
|
+
* @param needListen {en} Whether to enable resize event monitoring
|
4075
|
+
* @returns 页面宽高,{ windowWidth, windowHeight }
|
4076
|
+
* @example
|
4077
|
+
* ```
|
4078
|
+
* import { useWindowSize } from '@arco-design/mobile-react/esm/_helpers/hooks';
|
4079
|
+
*
|
4080
|
+
* const { windowHeight, windowWidth } = useWindowSize();
|
4081
|
+
* ```
|
4082
|
+
*/
|
4083
|
+
|
3237
4084
|
function useWindowSize(listenResize) {
|
3238
|
-
var _a = React.useState(0),
|
4085
|
+
var _a = React.useState(typeof window !== 'undefined' ? window.innerWidth : 0),
|
3239
4086
|
windowWidth = _a[0],
|
3240
4087
|
setWindowWidth = _a[1];
|
3241
4088
|
|
3242
|
-
var _b = React.useState(0),
|
4089
|
+
var _b = React.useState(typeof window !== 'undefined' ? window.innerHeight : 0),
|
3243
4090
|
windowHeight = _b[0],
|
3244
4091
|
setWindowHeight = _b[1];
|
3245
4092
|
|
@@ -3257,7 +4104,30 @@
|
|
3257
4104
|
windowHeight: windowHeight
|
3258
4105
|
};
|
3259
4106
|
}
|
3260
|
-
|
4107
|
+
/**
|
4108
|
+
* 弹窗中滚动统一处理,防止滚动穿透
|
4109
|
+
* @desc {en} Unified processing of scrolling in pop-up windows to prevent scrolling penetration
|
4110
|
+
* @param visible 弹窗是否被打开
|
4111
|
+
* @param visible {en} Whether the popup is opened
|
4112
|
+
* @param popupDom 弹窗的dom元素
|
4113
|
+
* @param popupDom {en} DOM element of the popup
|
4114
|
+
* @param getScrollContainer 弹窗中的滚动容器,可传入多个
|
4115
|
+
* @param getScrollContainer {en} The scrolling container in the popup, which can pass in multiple
|
4116
|
+
* @param orientationDirection 弹窗内容朝向,默认为top(从上到下),用于实现模拟横屏
|
4117
|
+
* @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
|
4118
|
+
* @param preventCallback 在滚动穿透被阻止(preventDefault被触发)时的回调
|
4119
|
+
* @param preventCallback {en} Callback when scrolling is blocked (preventDefault is triggered)
|
4120
|
+
* @param onTouchMove touchmove 自定义事件
|
4121
|
+
* @param onTouchMove {en} Touchmove custom event
|
4122
|
+
* @param gestureOutOfControl 是否禁用滚动穿透处理
|
4123
|
+
* @param gestureOutOfControl {en} Whether to disable scroll through processing
|
4124
|
+
* @example
|
4125
|
+
* ```
|
4126
|
+
* import { usePopupScroll } from '@arco-design/mobile-react/esm/_helpers/hooks';
|
4127
|
+
*
|
4128
|
+
* usePopupScroll(visible, domRef.current, getScrollContainer, orientationDirection, onPreventTouchMove, onTouchMove, gestureOutOfControl);
|
4129
|
+
* ```
|
4130
|
+
*/
|
3261
4131
|
|
3262
4132
|
function usePopupScroll(visible, popupDom, getScrollContainer, orientationDirection, preventCallback, onTouchMove, gestureOutOfControl) {
|
3263
4133
|
if (orientationDirection === void 0) {
|
@@ -3442,6 +4312,19 @@
|
|
3442
4312
|
};
|
3443
4313
|
}, [visible, popupDom, handleTouchStart, handleTouchMove]);
|
3444
4314
|
}
|
4315
|
+
/**
|
4316
|
+
* 在滑动类组件中,如果有内部可滚动区域,则在内部滚动区域滚动时禁用滑动事件
|
4317
|
+
* @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
|
4318
|
+
* @param getInnerScrollContainer 内部可滚动区域,可传入多个
|
4319
|
+
* @param getInnerScrollContainer {en} Inner scrollable area, can pass in multiple
|
4320
|
+
* @example
|
4321
|
+
* ```
|
4322
|
+
* import { useSwiperInnerScroll } from '@arco-design/mobile-react/esm/_helpers/hooks';
|
4323
|
+
*
|
4324
|
+
* useSwiperInnerScroll(getInnerScrollContainer);
|
4325
|
+
* ```
|
4326
|
+
*/
|
4327
|
+
|
3445
4328
|
function useSwiperInnerScroll(getInnerScrollContainer) {
|
3446
4329
|
var stopFunc = React.useCallback(function (e) {
|
3447
4330
|
return e.stopPropagation();
|
@@ -3469,6 +4352,26 @@
|
|
3469
4352
|
};
|
3470
4353
|
}, [getInnerScrollContainer]);
|
3471
4354
|
}
|
4355
|
+
/**
|
4356
|
+
* 事件绑定统一封装
|
4357
|
+
* @desc {en} Unified encapsulation of event binding
|
4358
|
+
* @param dom 待绑定事件的dom元素
|
4359
|
+
* @param dom {en} The dom element to be bound to the event
|
4360
|
+
* @param event 待绑定事件名称
|
4361
|
+
* @param event {en} The name of the event to be bound
|
4362
|
+
* @param handler 待绑定事件回调
|
4363
|
+
* @param handler {en} The callback of the event to be bound
|
4364
|
+
* @param options 待绑定事件配置,默认为 { capture: true }
|
4365
|
+
* @param options {en} Event configuration to be bound, the default is { capture: true }
|
4366
|
+
* @example
|
4367
|
+
* ```
|
4368
|
+
* import { useAddListener } from '@arco-design/mobile-react/esm/_helpers/hooks';
|
4369
|
+
*
|
4370
|
+
* useAddListener(domRef.current, 'touchstart', onTouchStart);
|
4371
|
+
* useAddListener(domRef.current, 'touchend', onTouchEnd);
|
4372
|
+
* ```
|
4373
|
+
*/
|
4374
|
+
|
3472
4375
|
function useAddListener(dom, event, handler, options) {
|
3473
4376
|
if (options === void 0) {
|
3474
4377
|
options = {
|
@@ -3497,9 +4400,30 @@
|
|
3497
4400
|
|
3498
4401
|
var arcoFullScreenCount = 0;
|
3499
4402
|
var arcoFullScreenOriginOverflow = '';
|
4403
|
+
/**
|
4404
|
+
* 在全屏组件出现时,将body的overflow设置为hidden,防止滚动穿透
|
4405
|
+
* @desc {en} When the full screen component appears, set the overflow of the body to hidden to prevent scrolling penetration
|
4406
|
+
* @param visible 全屏组件是否被打开
|
4407
|
+
* @param visible {en} Whether the full screen component is opened
|
4408
|
+
* @param preventBodyScroll 是否启用防滚动穿透,默认启用
|
4409
|
+
* @param preventBodyScroll {en} Whether to enable anti-scroll penetration, enabled by default
|
4410
|
+
* @param initialBodyOverflow body在初始状态下的overflow值,在全屏组件全部关闭后会还原
|
4411
|
+
* @param initialBodyOverflow {en} The overflow value of the body in the initial state, which will be restored after all full-screen components are closed
|
4412
|
+
* @example
|
4413
|
+
* ```
|
4414
|
+
* import { usePreventBodyScroll } from '@arco-design/mobile-react/esm/_helpers/hooks';
|
4415
|
+
*
|
4416
|
+
* usePreventBodyScroll(visible, preventBodyScroll, initialBodyOverflow);
|
4417
|
+
* ```
|
4418
|
+
*/
|
4419
|
+
|
3500
4420
|
function usePreventBodyScroll(visible, preventBodyScroll, initialBodyOverflow) {
|
3501
|
-
|
4421
|
+
if (preventBodyScroll === void 0) {
|
4422
|
+
preventBodyScroll = true;
|
4423
|
+
} // 新出现一个全屏组件则计数+1,并设置body hidden样式
|
3502
4424
|
// @en When a new full-screen component appears, count + 1 and set the body hidden style
|
4425
|
+
|
4426
|
+
|
3503
4427
|
var addFullScreen = React.useCallback(function () {
|
3504
4428
|
var count = arcoFullScreenCount; // 在当前没有全屏组件出现时,记下body overflow的初始值
|
3505
4429
|
// @en Note the initial value of body overflow when no full-screen components are currently present
|
@@ -3544,6 +4468,18 @@
|
|
3544
4468
|
};
|
3545
4469
|
}, [visible]);
|
3546
4470
|
}
|
4471
|
+
/**
|
4472
|
+
* 进度条计算公共逻辑,根据传入的参数计算出当前百分比和过渡效果开关,进度类组件内部使用
|
4473
|
+
* @desc {en} Progress bar calculation common logic, used internally by the progress class component
|
4474
|
+
* @returns [当前计算的百分比, 当前是否应有过渡效果]
|
4475
|
+
* @example
|
4476
|
+
* ```
|
4477
|
+
* import { usePreventBodyScroll } from '@arco-design/mobile-react/esm/_helpers/hooks';
|
4478
|
+
*
|
4479
|
+
* const [currentPercentage, transitionControl] = useProgress(mountedTransition, percentage, duration, mountedBezier, step);
|
4480
|
+
* ```
|
4481
|
+
*/
|
4482
|
+
|
3547
4483
|
function useProgress(mountedTransition, percentage, duration, mountedBezier, step) {
|
3548
4484
|
var _a = React.useState(0),
|
3549
4485
|
currentPercentage = _a[0],
|
@@ -3579,6 +4515,24 @@
|
|
3579
4515
|
}, [count, percentage, step]);
|
3580
4516
|
return [currentPercentage, transitionControl];
|
3581
4517
|
}
|
4518
|
+
/**
|
4519
|
+
* 单击和双击事件统一处理
|
4520
|
+
* @desc {en} Unified processing of single and double click events
|
4521
|
+
* @param onClick 单击事件回调
|
4522
|
+
* @param onClick {en} Callback of single click event
|
4523
|
+
* @param onDoubleClick 双击事件回调
|
4524
|
+
* @param onDoubleClick {en} Callback of double click event
|
4525
|
+
* @param delay 两次点击被判定为双击事件的最大间隔时间
|
4526
|
+
* @param delay {en} The maximum interval between two clicks is judged as a double-click event
|
4527
|
+
* @returns clickHandler,统一后的事件处理方法
|
4528
|
+
* @example
|
4529
|
+
* ```
|
4530
|
+
* import { useSingleAndDoubleClick } from '@arco-design/mobile-react/esm/_helpers/hooks';
|
4531
|
+
*
|
4532
|
+
* const handleClick = useSingleAndDoubleClick(handleImageClick, handleImageDoubleClick);
|
4533
|
+
* ```
|
4534
|
+
*/
|
4535
|
+
|
3582
4536
|
function useSingleAndDoubleClick(onClick, onDoubleClick, delay) {
|
3583
4537
|
if (delay === void 0) {
|
3584
4538
|
delay = 200;
|
@@ -3607,6 +4561,24 @@
|
|
3607
4561
|
};
|
3608
4562
|
}
|
3609
4563
|
var arcoSvgKeyCount = 0;
|
4564
|
+
/**
|
4565
|
+
* 自动生成svg <def>标签的唯一标识,用于区分不同svg的<def>内容
|
4566
|
+
* @desc {en} Automatically generate the unique identifier of the svg <def> tag, which is used to distinguish the <def> content of different svg
|
4567
|
+
* @param userSetSvgKey 自定义唯一标识,传入则覆盖自动生成的值
|
4568
|
+
* @param userSetSvgKey {en} Customize the unique identifier, if passed in, it will override the automatically generated value
|
4569
|
+
* @returns 包含svgKey的对象 生成后的唯一标识
|
4570
|
+
* @globalVariable
|
4571
|
+
* ```
|
4572
|
+
* let arcoSvgKeyCount = 0;
|
4573
|
+
* ```
|
4574
|
+
* @example
|
4575
|
+
* ```
|
4576
|
+
* import { useGenSvgKey } from '@arco-design/mobile-react/esm/_helpers/hooks';
|
4577
|
+
*
|
4578
|
+
* const { svgKey } = useGenSvgKey(userSetSvgKey);
|
4579
|
+
* ```
|
4580
|
+
*/
|
4581
|
+
|
3610
4582
|
function useGenSvgKey(userSetSvgKey) {
|
3611
4583
|
var _a = React.useState(''),
|
3612
4584
|
innerSvgKey = _a[0],
|
@@ -3680,6 +4652,38 @@
|
|
3680
4652
|
|
3681
4653
|
var render = copyRender;
|
3682
4654
|
|
4655
|
+
/**
|
4656
|
+
* 获取带浏览器前缀的样式
|
4657
|
+
* @desc {en} Get style with browser vendor prefix
|
4658
|
+
* @param {CSSProperties} style 原始样式
|
4659
|
+
* @param {CSSProperties} style {en} Original style
|
4660
|
+
* @returns {CSSProperties} newStyle 添加了浏览器前缀的新样式
|
4661
|
+
* @returns {CSSProperties} newStyle {en} New style with browser vendor prefix
|
4662
|
+
* @example
|
4663
|
+
* ```
|
4664
|
+
* import { getStyleWithVendor } from '@arco-design/mobile-react/esm/_helpers';
|
4665
|
+
*
|
4666
|
+
* // Example usage:
|
4667
|
+
* const originalStyle = {
|
4668
|
+
* transform: 'translateX(50px)',
|
4669
|
+
* transition: 'all 0.3s ease',
|
4670
|
+
* opacity: 0.8,
|
4671
|
+
* };
|
4672
|
+
*
|
4673
|
+
* const styleWithPrefix = getStyleWithVendor(originalStyle);
|
4674
|
+
*
|
4675
|
+
* // Result:
|
4676
|
+
* // styleWithPrefix will be:
|
4677
|
+
* // {
|
4678
|
+
* // transform: 'translateX(50px)',
|
4679
|
+
* // WebkitTransform: 'translateX(50px)', // Browser-specific prefix added
|
4680
|
+
* // transition: 'all 0.3s ease',
|
4681
|
+
* // WebkitTransition: 'all 0.3s ease', // Browser-specific prefix added
|
4682
|
+
* // opacity: 0.8,
|
4683
|
+
* // }
|
4684
|
+
* ```
|
4685
|
+
*/
|
4686
|
+
|
3683
4687
|
function getStyleWithVendor(style) {
|
3684
4688
|
var allowReg = /(transform|transition|animation)/i;
|
3685
4689
|
var newStyle = Object.keys(style).reduce(function (acc, key) {
|
@@ -3692,6 +4696,37 @@
|
|
3692
4696
|
}, {});
|
3693
4697
|
return newStyle;
|
3694
4698
|
}
|
4699
|
+
/**
|
4700
|
+
* 给元素设置带浏览器前缀的样式
|
4701
|
+
* @desc {en} Set element style with browser vendor prefix
|
4702
|
+
* @param {HTMLElement} dom 需要设置样式的元素
|
4703
|
+
* @param {HTMLElement} dom {en} Element to set style
|
4704
|
+
* @param {CSSProperties} style Original style
|
4705
|
+
* @param {CSSProperties} style {en} Original style
|
4706
|
+
* @returns {void}
|
4707
|
+
* @example
|
4708
|
+
* ```
|
4709
|
+
* import { setStyleWithVendor } from '@arco-design/mobile-utils';
|
4710
|
+
*
|
4711
|
+
* // Example: Setting and displaying styles with the Webkit browser vendor prefix
|
4712
|
+
* const element = document.getElementById('myElement');
|
4713
|
+
* const originalStyle = {
|
4714
|
+
* transform: 'translateX(100px)',
|
4715
|
+
* transition: 'transform 0.5s ease',
|
4716
|
+
* borderRadius: '5px',
|
4717
|
+
* };
|
4718
|
+
*
|
4719
|
+
* // Set the styles with the Webkit browser vendor prefix
|
4720
|
+
* setStyleWithVendor(element, originalStyle);
|
4721
|
+
*
|
4722
|
+
* // Display the styles with the Webkit browser vendor prefixes applied
|
4723
|
+
* const computedStyle = getComputedStyle(element);
|
4724
|
+
* console.log(computedStyle.getPropertyValue('-webkit-transform')); // Output: The transformed style with the Webkit browser vendor prefix
|
4725
|
+
* console.log(computedStyle.getPropertyValue('-webkit-transition')); // Output: The transition style with the Webkit browser vendor prefix
|
4726
|
+
* console.log(computedStyle.getPropertyValue('border-radius')); // Output: The borderRadius style without a vendor prefix
|
4727
|
+
* ```
|
4728
|
+
*/
|
4729
|
+
|
3695
4730
|
function setStyleWithVendor(dom, style) {
|
3696
4731
|
var vendorStyle = getStyleWithVendor(style);
|
3697
4732
|
|
@@ -3702,6 +4737,22 @@
|
|
3702
4737
|
/**
|
3703
4738
|
* 计算默认值,仅未定义时使用默认值
|
3704
4739
|
* @desc {en} Calculate the default value, use default value only if undefined
|
4740
|
+
* @param {T | undefined} value 输入的值
|
4741
|
+
* @param {T | undefined} value {en} The input value
|
4742
|
+
* @param {T} defaultValue 默认值
|
4743
|
+
* @param {T} defaultValue {en} The default value
|
4744
|
+
* @returns {T} 如果输入的值是未定义的,那么返回默认值,否则返回输入的值
|
4745
|
+
* @returns {T} {en} Returns the default value if the input is undefined, otherwise returns the input value
|
4746
|
+
* @example
|
4747
|
+
* ```
|
4748
|
+
* import { getDefaultValue } from '@arco-design/mobile-react/esm/_helpers';
|
4749
|
+
*
|
4750
|
+
* const result = getDefaultValue(42, 0);
|
4751
|
+
* console.log(result); // Output: 42
|
4752
|
+
*
|
4753
|
+
* const result2 = getDefaultValue(undefined, 100);
|
4754
|
+
* console.log(result2); // Output: 100
|
4755
|
+
* ```
|
3705
4756
|
*/
|
3706
4757
|
|
3707
4758
|
var getDefaultValue = function getDefaultValue(value, defaultValue) {
|
@@ -4310,7 +5361,7 @@
|
|
4310
5361
|
fixed: tabBarFixed
|
4311
5362
|
}, {
|
4312
5363
|
'has-divider': hasDivider
|
4313
|
-
}),
|
5364
|
+
}, system),
|
4314
5365
|
style: typeof tabBarFixed === 'object' ? tabBarFixed : {}
|
4315
5366
|
}, /*#__PURE__*/React__default["default"].createElement("div", {
|
4316
5367
|
className: cls(prefix + "-container", tabDirection, "pos-" + tabBarPosition, "arrange-" + (originArrange || tabBarArrange), "type-" + type, {
|
@@ -9239,7 +10290,9 @@
|
|
9239
10290
|
// @en When noLoop is used, the blank space of spaceBetween needs to be exposed at the end, so when sliding to the last one, the transform value moves to the left by the corresponding width
|
9240
10291
|
|
9241
10292
|
var translateDis = noLoop ? noLoopDis - (total > 1 && index === total - 1 ? spaceBetween : 0) * rtlRatio : dis;
|
9242
|
-
var
|
10293
|
+
var initTranslateDis = -1 * index * 100; // bugfix: prop `style` did not match in ssr
|
10294
|
+
|
10295
|
+
var transStr = childSize > 0 ? "" + translateDis + (translateDis ? 'px' : '') : "" + initTranslateDis + (initTranslateDis ? '%' : '');
|
9243
10296
|
|
9244
10297
|
if (vertical) {
|
9245
10298
|
var translateStyle_1 = getStyleWithVendor({
|
@@ -15101,11 +16154,13 @@
|
|
15101
16154
|
var getErrorAndWarnings = function getErrorAndWarnings(result) {
|
15102
16155
|
var errors = [];
|
15103
16156
|
var warnings = [];
|
16157
|
+
var errorTypes = [];
|
15104
16158
|
result.map(function (_a) {
|
15105
16159
|
var _b = _a.message,
|
15106
16160
|
message = _b === void 0 ? [] : _b,
|
15107
16161
|
_c = _a.validateLevel,
|
15108
|
-
validateLevel = _c === void 0 ? 'error' : _c
|
16162
|
+
validateLevel = _c === void 0 ? 'error' : _c,
|
16163
|
+
resultErrorTypes = _a.errorTypes;
|
15109
16164
|
|
15110
16165
|
if (!(message === null || message === void 0 ? void 0 : message.length)) {
|
15111
16166
|
return;
|
@@ -15115,11 +16170,13 @@
|
|
15115
16170
|
warnings = __spreadArrays$1(warnings, message);
|
15116
16171
|
} else {
|
15117
16172
|
errors = __spreadArrays$1(errors, message);
|
16173
|
+
errorTypes = __spreadArrays$1(errorTypes, resultErrorTypes);
|
15118
16174
|
}
|
15119
16175
|
});
|
15120
16176
|
return {
|
15121
16177
|
warnings: warnings,
|
15122
|
-
errors: errors
|
16178
|
+
errors: errors,
|
16179
|
+
errorTypes: errorTypes
|
15123
16180
|
};
|
15124
16181
|
};
|
15125
16182
|
|
@@ -15182,12 +16239,14 @@
|
|
15182
16239
|
fieldValidator_1.validate((_a = {}, _a[field] = value, _a), function (errorsMap) {
|
15183
16240
|
var _a = getErrorAndWarnings((errorsMap === null || errorsMap === void 0 ? void 0 : errorsMap[field]) || []),
|
15184
16241
|
errors = _a.errors,
|
15185
|
-
warnings = _a.warnings
|
16242
|
+
warnings = _a.warnings,
|
16243
|
+
errorTypes = _a.errorTypes;
|
15186
16244
|
|
15187
16245
|
_this._errors = errors;
|
15188
16246
|
onValidateStatusChange({
|
15189
16247
|
errors: _this._errors,
|
15190
|
-
warnings: warnings
|
16248
|
+
warnings: warnings,
|
16249
|
+
errorTypes: errorTypes
|
15191
16250
|
});
|
15192
16251
|
return resolve({
|
15193
16252
|
errors: _this._errors,
|
@@ -15426,16 +16485,22 @@
|
|
15426
16485
|
errors = _e[0],
|
15427
16486
|
setErrors = _e[1];
|
15428
16487
|
|
15429
|
-
var _f = React.useState(
|
15430
|
-
|
15431
|
-
|
16488
|
+
var _f = React.useState(null),
|
16489
|
+
errorTypes = _f[0],
|
16490
|
+
setErrorTypes = _f[1];
|
16491
|
+
|
16492
|
+
var _g = React.useState([]),
|
16493
|
+
warnings = _g[0],
|
16494
|
+
setWarnings = _g[1];
|
15432
16495
|
|
15433
16496
|
var formItemRef = React.useRef(null);
|
15434
16497
|
|
15435
16498
|
var onValidateStatusChange = function onValidateStatusChange(validateResult) {
|
15436
16499
|
var _errors = validateResult.errors,
|
15437
|
-
_warnings = validateResult.warnings
|
16500
|
+
_warnings = validateResult.warnings,
|
16501
|
+
_errorTypes = validateResult.errorTypes;
|
15438
16502
|
setErrors(_errors.length ? _errors[0] : null);
|
16503
|
+
setErrorTypes(_errorTypes.length ? _errorTypes[0] : null);
|
15439
16504
|
setWarnings(_warnings);
|
15440
16505
|
};
|
15441
16506
|
|
@@ -15457,7 +16522,7 @@
|
|
15457
16522
|
return /*#__PURE__*/React__default["default"].createElement("div", {
|
15458
16523
|
className: cls(prefixCls + "-form-item", prefixCls + "-form-item-" + (itemLayout || layout), className, (_a = {
|
15459
16524
|
disabled: fieldDisabled
|
15460
|
-
}, _a[prefixCls + "-form-item-error"] = !!errors, _a[prefixCls + "-form-item-warning"] = Boolean(!errors && warnings), _a)),
|
16525
|
+
}, _a[prefixCls + "-form-item-error"] = !!errors, _a[prefixCls + "-form-item-warning"] = Boolean(!errors && warnings), _a[prefixCls + "-form-item-error-" + errorTypes] = errorTypes, _a)),
|
15461
16526
|
style: style,
|
15462
16527
|
ref: formItemRef
|
15463
16528
|
}, /*#__PURE__*/React__default["default"].createElement("div", {
|