@trionesdev/antd-mobile-react 0.0.2-beta.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/LICENSE +21 -0
- package/dist/ActionSheet/demo/base.d.ts +3 -0
- package/dist/ActionSheet/demo/base.js +39 -0
- package/dist/ActionSheet/index.d.ts +3 -0
- package/dist/ActionSheet/index.js +2 -0
- package/dist/Alert/demo/base.d.ts +3 -0
- package/dist/Alert/demo/base.js +56 -0
- package/dist/Alert/index.d.ts +3 -0
- package/dist/Alert/index.js +2 -0
- package/dist/Avatar/demo/base.d.ts +7 -0
- package/dist/Avatar/demo/base.js +109 -0
- package/dist/Avatar/demo/style.scss +6 -0
- package/dist/Avatar/index.d.ts +3 -0
- package/dist/Avatar/index.js +2 -0
- package/dist/Badge/demo/base.d.ts +7 -0
- package/dist/Badge/demo/base.js +167 -0
- package/dist/Badge/demo/base.scss +6 -0
- package/dist/Badge/index.d.ts +3 -0
- package/dist/Badge/index.js +2 -0
- package/dist/Button/button.d.ts +53 -0
- package/dist/Button/button.js +66 -0
- package/dist/Button/demo/base.d.ts +3 -0
- package/dist/Button/demo/base.js +163 -0
- package/dist/Button/index.d.ts +3 -0
- package/dist/Button/index.js +2 -0
- package/dist/Button/style.scss +231 -0
- package/dist/Calendar/calendar-grid.d.ts +27 -0
- package/dist/Calendar/calendar-grid.js +164 -0
- package/dist/Calendar/calendar-header.d.ts +7 -0
- package/dist/Calendar/calendar-header.js +42 -0
- package/dist/Calendar/calendar-range.d.ts +10 -0
- package/dist/Calendar/calendar-range.js +57 -0
- package/dist/Calendar/calendar.d.ts +10 -0
- package/dist/Calendar/calendar.js +49 -0
- package/dist/Calendar/demo/calendar.d.ts +3 -0
- package/dist/Calendar/demo/calendar.js +10 -0
- package/dist/Calendar/demo/grid.d.ts +3 -0
- package/dist/Calendar/demo/grid.js +12 -0
- package/dist/Calendar/demo/touch-grid.d.ts +3 -0
- package/dist/Calendar/demo/touch-grid.js +8 -0
- package/dist/Calendar/index.d.ts +11 -0
- package/dist/Calendar/index.js +8 -0
- package/dist/Calendar/style.scss +85 -0
- package/dist/Calendar/touchable-calendar-grid.d.ts +14 -0
- package/dist/Calendar/touchable-calendar-grid.js +395 -0
- package/dist/CalendarDatetimePicker/CalendarDatetimePicker.d.ts +10 -0
- package/dist/CalendarDatetimePicker/CalendarDatetimePicker.js +156 -0
- package/dist/CalendarDatetimePicker/DateTimeSwitch.d.ts +14 -0
- package/dist/CalendarDatetimePicker/DateTimeSwitch.js +39 -0
- package/dist/CalendarDatetimePicker/demo/base.d.ts +3 -0
- package/dist/CalendarDatetimePicker/demo/base.js +41 -0
- package/dist/CalendarDatetimePicker/index.d.ts +3 -0
- package/dist/CalendarDatetimePicker/index.js +2 -0
- package/dist/CalendarDatetimePicker/style.scss +54 -0
- package/dist/CalendarDatetimePicker/types.d.ts +5 -0
- package/dist/CalendarDatetimePicker/types.js +6 -0
- package/dist/CalendarPicker/calendar-picker.d.ts +4 -0
- package/dist/CalendarPicker/calendar-picker.js +87 -0
- package/dist/CalendarPicker/calendar-range-picker.d.ts +4 -0
- package/dist/CalendarPicker/calendar-range-picker.js +87 -0
- package/dist/CalendarPicker/demo/base.d.ts +3 -0
- package/dist/CalendarPicker/demo/base.js +66 -0
- package/dist/CalendarPicker/index.d.ts +9 -0
- package/dist/CalendarPicker/index.js +5 -0
- package/dist/CalendarPicker/style.scss +31 -0
- package/dist/CalendarPicker/types.d.ts +21 -0
- package/dist/CalendarPicker/types.js +1 -0
- package/dist/Card/demo/base.d.ts +4 -0
- package/dist/Card/demo/base.js +65 -0
- package/dist/Card/demo/base.scss +18 -0
- package/dist/Card/index.d.ts +3 -0
- package/dist/Card/index.js +2 -0
- package/dist/CascaderPicker/demo/base.d.ts +3 -0
- package/dist/CascaderPicker/demo/base.js +85 -0
- package/dist/CascaderPicker/index.d.ts +3 -0
- package/dist/CascaderPicker/index.js +2 -0
- package/dist/CascaderView/demo/async.d.ts +3 -0
- package/dist/CascaderView/demo/async.js +41 -0
- package/dist/CascaderView/demo/base.d.ts +3 -0
- package/dist/CascaderView/demo/base.js +62 -0
- package/dist/CascaderView/demo/value.d.ts +3 -0
- package/dist/CascaderView/demo/value.js +63 -0
- package/dist/CascaderView/index.d.ts +3 -0
- package/dist/CascaderView/index.js +2 -0
- package/dist/Cell/demo/base.d.ts +3 -0
- package/dist/Cell/demo/base.js +13 -0
- package/dist/Cell/index.d.ts +3 -0
- package/dist/Cell/index.js +2 -0
- package/dist/Checkbox/demo/base.d.ts +6 -0
- package/dist/Checkbox/demo/base.js +43 -0
- package/dist/Checkbox/demo/disabled.d.ts +3 -0
- package/dist/Checkbox/demo/disabled.js +19 -0
- package/dist/Checkbox/index.d.ts +3 -0
- package/dist/Checkbox/index.js +2 -0
- package/dist/ConfigProvider/demo/base.d.ts +6 -0
- package/dist/ConfigProvider/demo/base.js +24 -0
- package/dist/ConfigProvider/index.d.ts +3 -0
- package/dist/ConfigProvider/index.js +2 -0
- package/dist/DemoBlock/index.d.ts +10 -0
- package/dist/DemoBlock/index.js +15 -0
- package/dist/DemoBlock/index.scss +20 -0
- package/dist/DemoDescription/index.d.ts +6 -0
- package/dist/DemoDescription/index.js +7 -0
- package/dist/DemoDescription/index.scss +3 -0
- package/dist/Descriptions/demo/base.d.ts +3 -0
- package/dist/Descriptions/demo/base.js +102 -0
- package/dist/Descriptions/demo/vertical.d.ts +3 -0
- package/dist/Descriptions/demo/vertical.js +70 -0
- package/dist/Descriptions/index.d.ts +3 -0
- package/dist/Descriptions/index.js +2 -0
- package/dist/Divider/demo/base.d.ts +3 -0
- package/dist/Divider/demo/base.js +35 -0
- package/dist/Divider/index.d.ts +3 -0
- package/dist/Divider/index.js +2 -0
- package/dist/Ellipsis/demo/base.d.ts +3 -0
- package/dist/Ellipsis/demo/base.js +81 -0
- package/dist/Ellipsis/index.d.ts +3 -0
- package/dist/Ellipsis/index.js +2 -0
- package/dist/Empty/demo/base.d.ts +3 -0
- package/dist/Empty/demo/base.js +38 -0
- package/dist/Empty/index.d.ts +3 -0
- package/dist/Empty/index.js +2 -0
- package/dist/ErrorBlock/demo/base.d.ts +3 -0
- package/dist/ErrorBlock/demo/base.js +23 -0
- package/dist/ErrorBlock/index.d.ts +4 -0
- package/dist/ErrorBlock/index.js +3 -0
- package/dist/Footer/demo/base.d.ts +6 -0
- package/dist/Footer/demo/base.js +81 -0
- package/dist/Footer/index.d.ts +3 -0
- package/dist/Footer/index.js +2 -0
- package/dist/Form/demo/base.d.ts +3 -0
- package/dist/Form/demo/base.js +99 -0
- package/dist/Form/demo/input.d.ts +3 -0
- package/dist/Form/demo/input.js +39 -0
- package/dist/Form/index.d.ts +3 -0
- package/dist/Form/index.js +2 -0
- package/dist/Grid/demo/base.d.ts +7 -0
- package/dist/Grid/demo/base.js +46 -0
- package/dist/Grid/demo/base.scss +7 -0
- package/dist/Grid/index.d.ts +3 -0
- package/dist/Grid/index.js +2 -0
- package/dist/Icon/check-icon.d.ts +3 -0
- package/dist/Icon/check-icon.js +10 -0
- package/dist/Icon/demo/base.d.ts +6 -0
- package/dist/Icon/demo/base.js +41 -0
- package/dist/Image/broken-image-icon.d.ts +2 -0
- package/dist/Image/broken-image-icon.js +11 -0
- package/dist/Image/demo/base.d.ts +4 -0
- package/dist/Image/demo/base.js +101 -0
- package/dist/Image/demo/base.scss +4 -0
- package/dist/Image/image-icon.d.ts +2 -0
- package/dist/Image/image-icon.js +11 -0
- package/dist/Image/image.d.ts +19 -0
- package/dist/Image/image.js +113 -0
- package/dist/Image/index.d.ts +4 -0
- package/dist/Image/index.js +3 -0
- package/dist/Image/lazy-detector.d.ts +6 -0
- package/dist/Image/lazy-detector.js +22 -0
- package/dist/Image/style.scss +30 -0
- package/dist/ImagesPreview/ImagesPreview.d.ts +12 -0
- package/dist/ImagesPreview/ImagesPreview.js +83 -0
- package/dist/ImagesPreview/demo/base.d.ts +3 -0
- package/dist/ImagesPreview/demo/base.js +30 -0
- package/dist/ImagesPreview/index.d.ts +3 -0
- package/dist/ImagesPreview/index.js +2 -0
- package/dist/ImagesPreview/style.scss +34 -0
- package/dist/ImagesWall/CameraModal.d.ts +6 -0
- package/dist/ImagesWall/CameraModal.js +23 -0
- package/dist/ImagesWall/ImagesWall.d.ts +29 -0
- package/dist/ImagesWall/ImagesWall.js +225 -0
- package/dist/ImagesWall/demo/base.d.ts +3 -0
- package/dist/ImagesWall/demo/base.js +29 -0
- package/dist/ImagesWall/index.d.ts +3 -0
- package/dist/ImagesWall/index.js +2 -0
- package/dist/ImagesWall/style.scss +70 -0
- package/dist/Input/demo/base.d.ts +3 -0
- package/dist/Input/demo/base.js +29 -0
- package/dist/Input/index.d.ts +3 -0
- package/dist/Input/index.js +2 -0
- package/dist/InputNumber/demo/base.d.ts +3 -0
- package/dist/InputNumber/demo/base.js +13 -0
- package/dist/InputNumber/index.d.ts +3 -0
- package/dist/InputNumber/index.js +2 -0
- package/dist/Mask/demo/base.d.ts +3 -0
- package/dist/Mask/demo/base.js +29 -0
- package/dist/Mask/index.d.ts +3 -0
- package/dist/Mask/index.js +2 -0
- package/dist/NavBar/demo/base.d.ts +4 -0
- package/dist/NavBar/demo/base.js +70 -0
- package/dist/NavBar/demo/base.scss +5 -0
- package/dist/NavBar/index.d.ts +3 -0
- package/dist/NavBar/index.js +2 -0
- package/dist/NoticeBar/demo/base.d.ts +3 -0
- package/dist/NoticeBar/demo/base.js +90 -0
- package/dist/NoticeBar/index.d.ts +3 -0
- package/dist/NoticeBar/index.js +2 -0
- package/dist/PageIndicator/demo/base.d.ts +3 -0
- package/dist/PageIndicator/demo/base.js +41 -0
- package/dist/PageIndicator/index.d.ts +3 -0
- package/dist/PageIndicator/index.js +2 -0
- package/dist/Picker/demo/base.d.ts +3 -0
- package/dist/Picker/demo/base.js +56 -0
- package/dist/Picker/index.d.ts +3 -0
- package/dist/Picker/index.js +2 -0
- package/dist/PickerView/demo/base.d.ts +3 -0
- package/dist/PickerView/demo/base.js +36 -0
- package/dist/PickerView/index.d.ts +3 -0
- package/dist/PickerView/index.js +2 -0
- package/dist/Popup/demo/base.d.ts +3 -0
- package/dist/Popup/demo/base.js +99 -0
- package/dist/Popup/index.d.ts +3 -0
- package/dist/Popup/index.js +2 -0
- package/dist/Progress/Progress.d.ts +37 -0
- package/dist/Progress/Progress.js +52 -0
- package/dist/Progress/ProgressCircle.d.ts +17 -0
- package/dist/Progress/ProgressCircle.js +148 -0
- package/dist/Progress/ProgressLine.d.ts +15 -0
- package/dist/Progress/ProgressLine.js +87 -0
- package/dist/Progress/demo/base.d.ts +3 -0
- package/dist/Progress/demo/base.js +73 -0
- package/dist/Progress/index.d.ts +3 -0
- package/dist/Progress/index.js +2 -0
- package/dist/Progress/style.scss +33 -0
- package/dist/Progress/types.d.ts +4 -0
- package/dist/Progress/types.js +2 -0
- package/dist/Radio/demo/base.d.ts +4 -0
- package/dist/Radio/demo/base.js +85 -0
- package/dist/Radio/demo/base.scss +4 -0
- package/dist/Radio/index.d.ts +3 -0
- package/dist/Radio/index.js +2 -0
- package/dist/Rate/demo/base.d.ts +3 -0
- package/dist/Rate/demo/base.js +59 -0
- package/dist/Rate/index.d.ts +3 -0
- package/dist/Rate/index.js +2 -0
- package/dist/Result/demo/base.d.ts +3 -0
- package/dist/Result/demo/base.js +57 -0
- package/dist/Result/index.d.ts +3 -0
- package/dist/Result/index.js +2 -0
- package/dist/SafeArea/demo/base.d.ts +3 -0
- package/dist/SafeArea/demo/base.js +17 -0
- package/dist/SafeArea/demo/base.scss +18 -0
- package/dist/SafeArea/index.d.ts +3 -0
- package/dist/SafeArea/index.js +2 -0
- package/dist/Scaffold/demo/base.d.ts +3 -0
- package/dist/Scaffold/demo/base.js +30 -0
- package/dist/Scaffold/index.d.ts +3 -0
- package/dist/Scaffold/index.js +2 -0
- package/dist/ScrollView/demo/base.d.ts +3 -0
- package/dist/ScrollView/demo/base.js +43 -0
- package/dist/ScrollView/index.d.ts +3 -0
- package/dist/ScrollView/index.js +2 -0
- package/dist/SideBar/SideBarContext.d.ts +18 -0
- package/dist/SideBar/SideBarContext.js +2 -0
- package/dist/SideBar/demo/base.d.ts +3 -0
- package/dist/SideBar/demo/base.js +54 -0
- package/dist/SideBar/demo/default-active.d.ts +3 -0
- package/dist/SideBar/demo/default-active.js +34 -0
- package/dist/SideBar/demo/scroll-mode.d.ts +3 -0
- package/dist/SideBar/demo/scroll-mode.js +55 -0
- package/dist/SideBar/index.d.ts +3 -0
- package/dist/SideBar/index.js +2 -0
- package/dist/SideBar/side-bar.d.ts +25 -0
- package/dist/SideBar/side-bar.js +351 -0
- package/dist/SideBar/style.scss +85 -0
- package/dist/SideBar/types.d.ts +7 -0
- package/dist/SideBar/types.js +1 -0
- package/dist/Space/demo/base.d.ts +3 -0
- package/dist/Space/demo/base.js +120 -0
- package/dist/Space/index.d.ts +3 -0
- package/dist/Space/index.js +2 -0
- package/dist/SpinLoading/demo/base.d.ts +3 -0
- package/dist/SpinLoading/demo/base.js +21 -0
- package/dist/SpinLoading/index.d.ts +3 -0
- package/dist/SpinLoading/index.js +2 -0
- package/dist/Steps/demo/base.d.ts +3 -0
- package/dist/Steps/demo/base.js +71 -0
- package/dist/Steps/index.d.ts +3 -0
- package/dist/Steps/index.js +2 -0
- package/dist/Swiper/Swiper.d.ts +10 -0
- package/dist/Swiper/Swiper.js +22 -0
- package/dist/Swiper/SwiperCore.d.ts +23 -0
- package/dist/Swiper/SwiperCore.js +272 -0
- package/dist/Swiper/demo/base.d.ts +3 -0
- package/dist/Swiper/demo/base.js +122 -0
- package/dist/Swiper/index.d.ts +8 -0
- package/dist/Swiper/index.js +5 -0
- package/dist/Swiper/style.scss +54 -0
- package/dist/Switch/demo/base.d.ts +3 -0
- package/dist/Switch/demo/base.js +108 -0
- package/dist/Switch/index.d.ts +3 -0
- package/dist/Switch/index.js +2 -0
- package/dist/TabBar/demo/base.d.ts +6 -0
- package/dist/TabBar/demo/base.js +26 -0
- package/dist/TabBar/index.d.ts +3 -0
- package/dist/TabBar/index.js +2 -0
- package/dist/Tabs/demo/base.d.ts +3 -0
- package/dist/Tabs/demo/base.js +59 -0
- package/dist/Tabs/index.d.ts +3 -0
- package/dist/Tabs/index.js +2 -0
- package/dist/Tag/demo/base.d.ts +7 -0
- package/dist/Tag/demo/base.js +67 -0
- package/dist/Tag/demo/style.scss +8 -0
- package/dist/Tag/index.d.ts +3 -0
- package/dist/Tag/index.js +2 -0
- package/dist/Toast/demo/base.d.ts +3 -0
- package/dist/Toast/demo/base.js +121 -0
- package/dist/Toast/demo/component-mode.d.ts +3 -0
- package/dist/Toast/demo/component-mode.js +32 -0
- package/dist/Toast/index.d.ts +8 -0
- package/dist/Toast/index.js +4 -0
- package/dist/Toast/style.scss +63 -0
- package/dist/Toast/toast-modal.d.ts +18 -0
- package/dist/Toast/toast-modal.js +112 -0
- package/dist/Toast/toast.d.ts +20 -0
- package/dist/Toast/toast.js +112 -0
- package/dist/VerificationCodeInput/demo/base.d.ts +3 -0
- package/dist/VerificationCodeInput/demo/base.js +11 -0
- package/dist/VerificationCodeInput/index.d.ts +3 -0
- package/dist/VerificationCodeInput/index.js +2 -0
- package/dist/WaterMark/demo/demo1.d.ts +7 -0
- package/dist/WaterMark/demo/demo1.js +47 -0
- package/dist/WaterMark/demo/demo1.scss +6 -0
- package/dist/WaterMark/demo/demo2.d.ts +3 -0
- package/dist/WaterMark/demo/demo2.js +31 -0
- package/dist/WaterMark/index.d.ts +3 -0
- package/dist/WaterMark/index.js +2 -0
- package/dist/index.d.ts +106 -0
- package/dist/index.js +53 -0
- package/dist/locales/base.d.ts +139 -0
- package/dist/locales/base.js +139 -0
- package/dist/locales/en-US.d.ts +139 -0
- package/dist/locales/en-US.js +4 -0
- package/dist/locales/zh-CN.d.ts +3 -0
- package/dist/locales/zh-CN.js +140 -0
- package/dist/types.d.ts +8 -0
- package/dist/types.js +1 -0
- package/dist/utils/attach-properties-to-component.d.ts +1 -0
- package/dist/utils/attach-properties-to-component.js +9 -0
- package/dist/utils/bound.d.ts +1 -0
- package/dist/utils/bound.js +10 -0
- package/dist/utils/can-use-dom.d.ts +1 -0
- package/dist/utils/can-use-dom.js +1 -0
- package/dist/utils/convert-px.d.ts +1 -0
- package/dist/utils/convert-px.js +27 -0
- package/dist/utils/datetime-utils.d.ts +3 -0
- package/dist/utils/datetime-utils.js +18 -0
- package/dist/utils/dev-log.d.ts +3 -0
- package/dist/utils/dev-log.js +36 -0
- package/dist/utils/get-container.d.ts +2 -0
- package/dist/utils/get-container.js +4 -0
- package/dist/utils/get-scroll-parent.d.ts +3 -0
- package/dist/utils/get-scroll-parent.js +23 -0
- package/dist/utils/is-dev.d.ts +1 -0
- package/dist/utils/is-dev.js +1 -0
- package/dist/utils/lang.d.ts +1 -0
- package/dist/utils/lang.js +1 -0
- package/dist/utils/matrix.d.ts +10 -0
- package/dist/utils/matrix.js +37 -0
- package/dist/utils/merge-locale.d.ts +1 -0
- package/dist/utils/merge-locale.js +16 -0
- package/dist/utils/native-props.d.ts +10 -0
- package/dist/utils/native-props.js +39 -0
- package/dist/utils/random-utils.d.ts +3 -0
- package/dist/utils/random-utils.js +13 -0
- package/dist/utils/reactNode.d.ts +7 -0
- package/dist/utils/reactNode.js +13 -0
- package/dist/utils/render-imperatively.d.ts +14 -0
- package/dist/utils/render-imperatively.js +105 -0
- package/dist/utils/render-to-body.d.ts +2 -0
- package/dist/utils/render-to-body.js +13 -0
- package/dist/utils/render-to-container.d.ts +3 -0
- package/dist/utils/render-to-container.js +10 -0
- package/dist/utils/render.d.ts +9 -0
- package/dist/utils/render.js +87 -0
- package/dist/utils/rubberband.d.ts +2 -0
- package/dist/utils/rubberband.js +11 -0
- package/dist/utils/should-render.d.ts +10 -0
- package/dist/utils/should-render.js +12 -0
- package/dist/utils/supports-passive.d.ts +1 -0
- package/dist/utils/supports-passive.js +13 -0
- package/dist/utils/to-css-length.d.ts +1 -0
- package/dist/utils/to-css-length.js +3 -0
- package/dist/utils/type.d.ts +65 -0
- package/dist/utils/type.js +48 -0
- package/dist/utils/use-initialized.d.ts +1 -0
- package/dist/utils/use-initialized.js +8 -0
- package/dist/utils/use-isomorphic-update-layout-effect.d.ts +2 -0
- package/dist/utils/use-isomorphic-update-layout-effect.js +2 -0
- package/dist/utils/use-lock-scroll.d.ts +2 -0
- package/dist/utils/use-lock-scroll.js +81 -0
- package/dist/utils/use-mutation-effect.d.ts +3 -0
- package/dist/utils/use-mutation-effect.js +26 -0
- package/dist/utils/use-props-value.d.ts +8 -0
- package/dist/utils/use-props-value.js +22 -0
- package/dist/utils/use-resize-effect.d.ts +2 -0
- package/dist/utils/use-resize-effect.js +23 -0
- package/dist/utils/use-touch.d.ts +17 -0
- package/dist/utils/use-touch.js +63 -0
- package/dist/utils/validate.d.ts +1 -0
- package/dist/utils/validate.js +4 -0
- package/dist/utils/with-default-props.d.ts +9 -0
- package/dist/utils/with-default-props.js +33 -0
- package/dist/utils/with-stop-propagation.d.ts +4 -0
- package/dist/utils/with-stop-propagation.js +38 -0
- package/dist/utils/zIndex.d.ts +1 -0
- package/dist/utils/zIndex.js +4 -0
- package/dist/utils/zindexContext.d.ts +3 -0
- package/dist/utils/zindexContext.js +6 -0
- package/package.json +104 -0
- package/readme.md +43 -0
|
@@ -0,0 +1,121 @@
|
|
|
1
|
+
function _slicedToArray(arr, i) { return _arrayWithHoles(arr) || _iterableToArrayLimit(arr, i) || _unsupportedIterableToArray(arr, i) || _nonIterableRest(); }
|
|
2
|
+
function _nonIterableRest() { throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method."); }
|
|
3
|
+
function _unsupportedIterableToArray(o, minLen) { if (!o) return; if (typeof o === "string") return _arrayLikeToArray(o, minLen); var n = Object.prototype.toString.call(o).slice(8, -1); if (n === "Object" && o.constructor) n = o.constructor.name; if (n === "Map" || n === "Set") return Array.from(o); if (n === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)) return _arrayLikeToArray(o, minLen); }
|
|
4
|
+
function _arrayLikeToArray(arr, len) { if (len == null || len > arr.length) len = arr.length; for (var i = 0, arr2 = new Array(len); i < len; i++) arr2[i] = arr[i]; return arr2; }
|
|
5
|
+
function _iterableToArrayLimit(r, l) { var t = null == r ? null : "undefined" != typeof Symbol && r[Symbol.iterator] || r["@@iterator"]; if (null != t) { var e, n, i, u, a = [], f = !0, o = !1; try { if (i = (t = t.call(r)).next, 0 === l) { if (Object(t) !== t) return; f = !1; } else for (; !(f = (e = i.call(t)).done) && (a.push(e.value), a.length !== l); f = !0); } catch (r) { o = !0, n = r; } finally { try { if (!f && null != t.return && (u = t.return(), Object(u) !== u)) return; } finally { if (o) throw n; } } return a; } }
|
|
6
|
+
function _arrayWithHoles(arr) { if (Array.isArray(arr)) return arr; }
|
|
7
|
+
import React, { useEffect, useState } from "react";
|
|
8
|
+
import { DemoBlock } from "../../DemoBlock";
|
|
9
|
+
import Button from "../../Button";
|
|
10
|
+
import Toast from "../index";
|
|
11
|
+
import Space from "../../Space";
|
|
12
|
+
var CountDownText = function CountDownText() {
|
|
13
|
+
var _useState = useState(5),
|
|
14
|
+
_useState2 = _slicedToArray(_useState, 2),
|
|
15
|
+
count = _useState2[0],
|
|
16
|
+
setCount = _useState2[1];
|
|
17
|
+
useEffect(function () {
|
|
18
|
+
var interval = window.setInterval(function () {
|
|
19
|
+
setCount(function (x) {
|
|
20
|
+
if (x > 1) {
|
|
21
|
+
return x - 1;
|
|
22
|
+
} else {
|
|
23
|
+
return x;
|
|
24
|
+
}
|
|
25
|
+
});
|
|
26
|
+
}, 1000);
|
|
27
|
+
return function () {
|
|
28
|
+
window.clearInterval(interval);
|
|
29
|
+
};
|
|
30
|
+
}, []);
|
|
31
|
+
return /*#__PURE__*/React.createElement("span", null, "\u8FD8\u5269 ", count, " \u79D2");
|
|
32
|
+
};
|
|
33
|
+
export default (function () {
|
|
34
|
+
var toastContainer = React.useRef();
|
|
35
|
+
var toastContainer2 = React.useRef();
|
|
36
|
+
var toastContainer3 = React.useRef();
|
|
37
|
+
return /*#__PURE__*/React.createElement(React.Fragment, null, /*#__PURE__*/React.createElement(DemoBlock, {
|
|
38
|
+
title: "\u57FA\u7840\u7528\u6CD5"
|
|
39
|
+
}, /*#__PURE__*/React.createElement("div", {
|
|
40
|
+
ref: toastContainer
|
|
41
|
+
}), /*#__PURE__*/React.createElement(Button, {
|
|
42
|
+
onClick: function onClick() {
|
|
43
|
+
Toast.show({
|
|
44
|
+
getContainer: function getContainer() {
|
|
45
|
+
return toastContainer.current;
|
|
46
|
+
},
|
|
47
|
+
content: 'Hello World, This is a long text'
|
|
48
|
+
});
|
|
49
|
+
}
|
|
50
|
+
}, "\u8F7B\u63D0\u793A")), /*#__PURE__*/React.createElement(DemoBlock, {
|
|
51
|
+
title: "\u56FE\u6807"
|
|
52
|
+
}, /*#__PURE__*/React.createElement("div", {
|
|
53
|
+
ref: toastContainer2
|
|
54
|
+
}), /*#__PURE__*/React.createElement(Space, null, /*#__PURE__*/React.createElement(Button, {
|
|
55
|
+
onClick: function onClick() {
|
|
56
|
+
Toast.show({
|
|
57
|
+
getContainer: function getContainer() {
|
|
58
|
+
return toastContainer2.current;
|
|
59
|
+
},
|
|
60
|
+
icon: 'success',
|
|
61
|
+
content: '保存成功'
|
|
62
|
+
});
|
|
63
|
+
}
|
|
64
|
+
}, "\u6210\u529F"), /*#__PURE__*/React.createElement(Button, {
|
|
65
|
+
onClick: function onClick() {
|
|
66
|
+
Toast.show({
|
|
67
|
+
getContainer: function getContainer() {
|
|
68
|
+
return toastContainer2.current;
|
|
69
|
+
},
|
|
70
|
+
icon: 'fail',
|
|
71
|
+
content: '保存失败'
|
|
72
|
+
});
|
|
73
|
+
}
|
|
74
|
+
}, "\u5931\u8D25"), /*#__PURE__*/React.createElement(Button, {
|
|
75
|
+
onClick: function onClick() {
|
|
76
|
+
Toast.show({
|
|
77
|
+
getContainer: function getContainer() {
|
|
78
|
+
return toastContainer2.current;
|
|
79
|
+
},
|
|
80
|
+
icon: 'loading',
|
|
81
|
+
content: '加载中...'
|
|
82
|
+
});
|
|
83
|
+
}
|
|
84
|
+
}, "\u52A0\u8F7D"))), /*#__PURE__*/React.createElement(DemoBlock, {
|
|
85
|
+
title: "\u66F4\u591A\u529F\u80FD"
|
|
86
|
+
}, /*#__PURE__*/React.createElement("div", {
|
|
87
|
+
ref: toastContainer3
|
|
88
|
+
}), /*#__PURE__*/React.createElement(Space, null, /*#__PURE__*/React.createElement(Button, {
|
|
89
|
+
onClick: function onClick() {
|
|
90
|
+
Toast.show({
|
|
91
|
+
getContainer: function getContainer() {
|
|
92
|
+
return toastContainer3.current;
|
|
93
|
+
},
|
|
94
|
+
content: 'Hello Word',
|
|
95
|
+
position: 'top'
|
|
96
|
+
});
|
|
97
|
+
}
|
|
98
|
+
}, "\u9876\u90E8\u63D0\u793A"), /*#__PURE__*/React.createElement(Button, {
|
|
99
|
+
onClick: function onClick() {
|
|
100
|
+
Toast.show({
|
|
101
|
+
getContainer: function getContainer() {
|
|
102
|
+
return toastContainer3.current;
|
|
103
|
+
},
|
|
104
|
+
content: 'Hello Word',
|
|
105
|
+
position: 'bottom',
|
|
106
|
+
duration: 3333330
|
|
107
|
+
});
|
|
108
|
+
}
|
|
109
|
+
}, "\u5E95\u90E8\u63D0\u793A"), /*#__PURE__*/React.createElement(Button, {
|
|
110
|
+
onClick: function onClick() {
|
|
111
|
+
Toast.show({
|
|
112
|
+
getContainer: function getContainer() {
|
|
113
|
+
return toastContainer3.current;
|
|
114
|
+
},
|
|
115
|
+
icon: 'loading',
|
|
116
|
+
content: /*#__PURE__*/React.createElement(CountDownText, null),
|
|
117
|
+
duration: 5000
|
|
118
|
+
});
|
|
119
|
+
}
|
|
120
|
+
}, "\u52A8\u6001\u5185\u5BB9"))));
|
|
121
|
+
});
|
|
@@ -0,0 +1,32 @@
|
|
|
1
|
+
function _slicedToArray(arr, i) { return _arrayWithHoles(arr) || _iterableToArrayLimit(arr, i) || _unsupportedIterableToArray(arr, i) || _nonIterableRest(); }
|
|
2
|
+
function _nonIterableRest() { throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method."); }
|
|
3
|
+
function _unsupportedIterableToArray(o, minLen) { if (!o) return; if (typeof o === "string") return _arrayLikeToArray(o, minLen); var n = Object.prototype.toString.call(o).slice(8, -1); if (n === "Object" && o.constructor) n = o.constructor.name; if (n === "Map" || n === "Set") return Array.from(o); if (n === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)) return _arrayLikeToArray(o, minLen); }
|
|
4
|
+
function _arrayLikeToArray(arr, len) { if (len == null || len > arr.length) len = arr.length; for (var i = 0, arr2 = new Array(len); i < len; i++) arr2[i] = arr[i]; return arr2; }
|
|
5
|
+
function _iterableToArrayLimit(r, l) { var t = null == r ? null : "undefined" != typeof Symbol && r[Symbol.iterator] || r["@@iterator"]; if (null != t) { var e, n, i, u, a = [], f = !0, o = !1; try { if (i = (t = t.call(r)).next, 0 === l) { if (Object(t) !== t) return; f = !1; } else for (; !(f = (e = i.call(t)).done) && (a.push(e.value), a.length !== l); f = !0); } catch (r) { o = !0, n = r; } finally { try { if (!f && null != t.return && (u = t.return(), Object(u) !== u)) return; } finally { if (o) throw n; } } return a; } }
|
|
6
|
+
function _arrayWithHoles(arr) { if (Array.isArray(arr)) return arr; }
|
|
7
|
+
import React, { useEffect, useState } from "react";
|
|
8
|
+
import { DemoBlock } from "../../DemoBlock";
|
|
9
|
+
import Toast from "../index";
|
|
10
|
+
import { Button } from "../../index";
|
|
11
|
+
export default (function () {
|
|
12
|
+
var _useState = useState(false),
|
|
13
|
+
_useState2 = _slicedToArray(_useState, 2),
|
|
14
|
+
open = _useState2[0],
|
|
15
|
+
setOpen = _useState2[1];
|
|
16
|
+
useEffect(function () {
|
|
17
|
+
console.log('open', open);
|
|
18
|
+
}, [open]);
|
|
19
|
+
return /*#__PURE__*/React.createElement("div", null, /*#__PURE__*/React.createElement(DemoBlock, {
|
|
20
|
+
title: "\u7EC4\u4EF6\u6A21\u5F0F"
|
|
21
|
+
}, /*#__PURE__*/React.createElement(Toast, {
|
|
22
|
+
open: open,
|
|
23
|
+
afterOpenChange: function afterOpenChange(open) {
|
|
24
|
+
return setOpen(open);
|
|
25
|
+
},
|
|
26
|
+
content: '轻提示'
|
|
27
|
+
}), /*#__PURE__*/React.createElement(Button, {
|
|
28
|
+
onClick: function onClick() {
|
|
29
|
+
return setOpen(true);
|
|
30
|
+
}
|
|
31
|
+
}, "\u8F7B\u63D0\u793A")));
|
|
32
|
+
});
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
import { Toast as ToastInst, InternalToast, ToastProps } from "./toast";
|
|
2
|
+
type InternalToastType = typeof InternalToast;
|
|
3
|
+
type CompoundedComponent = InternalToastType & {
|
|
4
|
+
show: typeof ToastInst.show;
|
|
5
|
+
};
|
|
6
|
+
declare const Toast: CompoundedComponent;
|
|
7
|
+
export type { ToastProps };
|
|
8
|
+
export default Toast;
|
|
@@ -0,0 +1,63 @@
|
|
|
1
|
+
$toastCls: 'triones-antm-toast';
|
|
2
|
+
|
|
3
|
+
.#{$toastCls} {
|
|
4
|
+
position: fixed;
|
|
5
|
+
top: 0;
|
|
6
|
+
left: 0;
|
|
7
|
+
width: 100%;
|
|
8
|
+
height: 100%;
|
|
9
|
+
text-align: center;
|
|
10
|
+
pointer-events: none;
|
|
11
|
+
|
|
12
|
+
&-main {
|
|
13
|
+
|
|
14
|
+
padding: 12Px;
|
|
15
|
+
display: inline-block;
|
|
16
|
+
position: relative;
|
|
17
|
+
top: 50%;
|
|
18
|
+
transform: translateY(-50%);
|
|
19
|
+
width: auto;
|
|
20
|
+
max-width: 204px;
|
|
21
|
+
max-height: 70%;
|
|
22
|
+
overflow: auto;
|
|
23
|
+
color: #fff;
|
|
24
|
+
word-break: break-all;
|
|
25
|
+
background-color: rgba(0, 0, 0, .7);
|
|
26
|
+
border-radius: 8px;
|
|
27
|
+
pointer-events: all;
|
|
28
|
+
font-size: var(--adm-font-size-7);
|
|
29
|
+
line-height: 1.5;
|
|
30
|
+
box-sizing: border-box;
|
|
31
|
+
&-icon{
|
|
32
|
+
padding: 35Px 12Px;
|
|
33
|
+
min-width: 150Px;
|
|
34
|
+
.#{$toastCls}{
|
|
35
|
+
&-center{
|
|
36
|
+
&-center{
|
|
37
|
+
text-align: initial;
|
|
38
|
+
}
|
|
39
|
+
}
|
|
40
|
+
}
|
|
41
|
+
}
|
|
42
|
+
}
|
|
43
|
+
|
|
44
|
+
&-center{
|
|
45
|
+
display: flex;
|
|
46
|
+
flex-direction: column;
|
|
47
|
+
justify-content: center;
|
|
48
|
+
align-items: center;
|
|
49
|
+
gap: 8Px;
|
|
50
|
+
&-icon{
|
|
51
|
+
.triones-antm-icon{
|
|
52
|
+
font-size: 36Px;
|
|
53
|
+
}
|
|
54
|
+
}
|
|
55
|
+
&-content{
|
|
56
|
+
display: inline-block;
|
|
57
|
+
color: #fff;
|
|
58
|
+
word-break: break-all;
|
|
59
|
+
pointer-events: all;
|
|
60
|
+
text-align: initial;
|
|
61
|
+
}
|
|
62
|
+
}
|
|
63
|
+
}
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
import { FC } from "react";
|
|
2
|
+
import React from "react";
|
|
3
|
+
import "./style.scss";
|
|
4
|
+
export type ToastModalProps = {
|
|
5
|
+
open?: boolean;
|
|
6
|
+
maskClosable?: boolean;
|
|
7
|
+
content?: React.ReactNode;
|
|
8
|
+
duration?: number;
|
|
9
|
+
durationAble?: boolean;
|
|
10
|
+
icon?: 'success' | 'fail' | 'loading' | React.ReactNode;
|
|
11
|
+
maskClassName?: string;
|
|
12
|
+
position?: 'top' | 'bottom' | 'center';
|
|
13
|
+
destroyOnClose?: boolean;
|
|
14
|
+
afterClose?: () => void;
|
|
15
|
+
afterOpenChange?: (open: boolean) => void;
|
|
16
|
+
onDestroy?: () => void;
|
|
17
|
+
};
|
|
18
|
+
export declare const ToastModal: FC<ToastModalProps>;
|
|
@@ -0,0 +1,112 @@
|
|
|
1
|
+
function _typeof(o) { "@babel/helpers - typeof"; return _typeof = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function (o) { return typeof o; } : function (o) { return o && "function" == typeof Symbol && o.constructor === Symbol && o !== Symbol.prototype ? "symbol" : typeof o; }, _typeof(o); }
|
|
2
|
+
function _defineProperty(obj, key, value) { key = _toPropertyKey(key); if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; }
|
|
3
|
+
function _toPropertyKey(t) { var i = _toPrimitive(t, "string"); return "symbol" == _typeof(i) ? i : String(i); }
|
|
4
|
+
function _toPrimitive(t, r) { if ("object" != _typeof(t) || !t) return t; var e = t[Symbol.toPrimitive]; if (void 0 !== e) { var i = e.call(t, r || "default"); if ("object" != _typeof(i)) return i; throw new TypeError("@@toPrimitive must return a primitive value."); } return ("string" === r ? String : Number)(t); }
|
|
5
|
+
function _slicedToArray(arr, i) { return _arrayWithHoles(arr) || _iterableToArrayLimit(arr, i) || _unsupportedIterableToArray(arr, i) || _nonIterableRest(); }
|
|
6
|
+
function _nonIterableRest() { throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method."); }
|
|
7
|
+
function _unsupportedIterableToArray(o, minLen) { if (!o) return; if (typeof o === "string") return _arrayLikeToArray(o, minLen); var n = Object.prototype.toString.call(o).slice(8, -1); if (n === "Object" && o.constructor) n = o.constructor.name; if (n === "Map" || n === "Set") return Array.from(o); if (n === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)) return _arrayLikeToArray(o, minLen); }
|
|
8
|
+
function _arrayLikeToArray(arr, len) { if (len == null || len > arr.length) len = arr.length; for (var i = 0, arr2 = new Array(len); i < len; i++) arr2[i] = arr[i]; return arr2; }
|
|
9
|
+
function _iterableToArrayLimit(r, l) { var t = null == r ? null : "undefined" != typeof Symbol && r[Symbol.iterator] || r["@@iterator"]; if (null != t) { var e, n, i, u, a = [], f = !0, o = !1; try { if (i = (t = t.call(r)).next, 0 === l) { if (Object(t) !== t) return; f = !1; } else for (; !(f = (e = i.call(t)).done) && (a.push(e.value), a.length !== l); f = !0); } catch (r) { o = !0, n = r; } finally { try { if (!f && null != t.return && (u = t.return(), Object(u) !== u)) return; } finally { if (o) throw n; } } return a; } }
|
|
10
|
+
function _arrayWithHoles(arr) { if (Array.isArray(arr)) return arr; }
|
|
11
|
+
import { memo, useEffect, useMemo, useRef, useState } from "react";
|
|
12
|
+
import classNames from "classnames";
|
|
13
|
+
import React from "react";
|
|
14
|
+
import "./style.scss";
|
|
15
|
+
import Mask from "../Mask";
|
|
16
|
+
import { CheckOutline, CloseOutline } from "../../../antd-mobile-icons-react";
|
|
17
|
+
import { SpinLoading } from "../index";
|
|
18
|
+
var toastCls = "triones-antm-toast";
|
|
19
|
+
export var ToastModal = /*#__PURE__*/memo(function (_ref) {
|
|
20
|
+
var open = _ref.open,
|
|
21
|
+
_ref$maskClosable = _ref.maskClosable,
|
|
22
|
+
maskClosable = _ref$maskClosable === void 0 ? true : _ref$maskClosable,
|
|
23
|
+
content = _ref.content,
|
|
24
|
+
_ref$duration = _ref.duration,
|
|
25
|
+
duration = _ref$duration === void 0 ? 2000 : _ref$duration,
|
|
26
|
+
_ref$durationAble = _ref.durationAble,
|
|
27
|
+
durationAble = _ref$durationAble === void 0 ? true : _ref$durationAble,
|
|
28
|
+
icon = _ref.icon,
|
|
29
|
+
maskClassName = _ref.maskClassName,
|
|
30
|
+
_ref$position = _ref.position,
|
|
31
|
+
position = _ref$position === void 0 ? 'center' : _ref$position,
|
|
32
|
+
destroyOnClose = _ref.destroyOnClose,
|
|
33
|
+
afterClose = _ref.afterClose,
|
|
34
|
+
afterOpenChange = _ref.afterOpenChange,
|
|
35
|
+
onDestroy = _ref.onDestroy;
|
|
36
|
+
var _useState = useState(open || false),
|
|
37
|
+
_useState2 = _slicedToArray(_useState, 2),
|
|
38
|
+
internalOpen = _useState2[0],
|
|
39
|
+
setInternalOpen = _useState2[1];
|
|
40
|
+
var time = useRef();
|
|
41
|
+
var handleIcon = function handleIcon() {
|
|
42
|
+
if (icon === 'success') {
|
|
43
|
+
return /*#__PURE__*/React.createElement(CheckOutline, null);
|
|
44
|
+
} else if (icon === 'fail') {
|
|
45
|
+
return /*#__PURE__*/React.createElement(CloseOutline, null);
|
|
46
|
+
} else if (icon === 'loading') {
|
|
47
|
+
return /*#__PURE__*/React.createElement(SpinLoading, {
|
|
48
|
+
color: "white"
|
|
49
|
+
});
|
|
50
|
+
} else {
|
|
51
|
+
return icon;
|
|
52
|
+
}
|
|
53
|
+
};
|
|
54
|
+
useEffect(function () {
|
|
55
|
+
if (open === undefined) {
|
|
56
|
+
return;
|
|
57
|
+
}
|
|
58
|
+
if (open !== internalOpen) {
|
|
59
|
+
setInternalOpen(open);
|
|
60
|
+
}
|
|
61
|
+
}, [open]);
|
|
62
|
+
useEffect(function () {
|
|
63
|
+
afterOpenChange === null || afterOpenChange === void 0 || afterOpenChange(internalOpen);
|
|
64
|
+
if (!internalOpen) {
|
|
65
|
+
afterClose === null || afterClose === void 0 || afterClose();
|
|
66
|
+
if (destroyOnClose) {
|
|
67
|
+
onDestroy === null || onDestroy === void 0 || onDestroy();
|
|
68
|
+
}
|
|
69
|
+
clearTimeout(time.current);
|
|
70
|
+
}
|
|
71
|
+
if (durationAble && internalOpen && duration) {
|
|
72
|
+
time.current = setTimeout(function () {
|
|
73
|
+
setInternalOpen(false);
|
|
74
|
+
}, duration);
|
|
75
|
+
}
|
|
76
|
+
}, [internalOpen]);
|
|
77
|
+
var top = useMemo(function () {
|
|
78
|
+
switch (position) {
|
|
79
|
+
case 'top':
|
|
80
|
+
return '20%';
|
|
81
|
+
case 'bottom':
|
|
82
|
+
return '80%';
|
|
83
|
+
default:
|
|
84
|
+
return '50%';
|
|
85
|
+
}
|
|
86
|
+
}, [position]);
|
|
87
|
+
return /*#__PURE__*/React.createElement(Mask, {
|
|
88
|
+
className: maskClassName,
|
|
89
|
+
open: internalOpen,
|
|
90
|
+
onMaskClick: function onMaskClick() {
|
|
91
|
+
if (maskClosable) {
|
|
92
|
+
setInternalOpen(false);
|
|
93
|
+
}
|
|
94
|
+
}
|
|
95
|
+
}, /*#__PURE__*/React.createElement("div", {
|
|
96
|
+
className: classNames(toastCls)
|
|
97
|
+
}, /*#__PURE__*/React.createElement("div", {
|
|
98
|
+
className: classNames("".concat(toastCls, "-main"), _defineProperty({}, "".concat(toastCls, "-main-icon"), icon)),
|
|
99
|
+
style: {
|
|
100
|
+
top: top
|
|
101
|
+
},
|
|
102
|
+
onClick: function onClick(e) {
|
|
103
|
+
e.stopPropagation();
|
|
104
|
+
}
|
|
105
|
+
}, /*#__PURE__*/React.createElement("div", {
|
|
106
|
+
className: classNames("".concat(toastCls, "-center"))
|
|
107
|
+
}, icon && /*#__PURE__*/React.createElement("div", {
|
|
108
|
+
className: classNames("".concat(toastCls, "-center-icon"))
|
|
109
|
+
}, handleIcon()), content && /*#__PURE__*/React.createElement("div", {
|
|
110
|
+
className: classNames("".concat(toastCls, "-center-content"))
|
|
111
|
+
}, content)))));
|
|
112
|
+
});
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
import { FC } from "react";
|
|
2
|
+
import { ToastModalProps } from "./toast-modal";
|
|
3
|
+
export type ToastProps = Omit<ToastModalProps, 'onDestroy'> & {
|
|
4
|
+
getContainer?: () => HTMLElement;
|
|
5
|
+
};
|
|
6
|
+
export interface ToastHandle {
|
|
7
|
+
clear(): void;
|
|
8
|
+
}
|
|
9
|
+
export declare const InternalToast: FC<ToastProps>;
|
|
10
|
+
export type ToastShowProps = Omit<ToastModalProps, 'onDestroy' | 'open'> & {
|
|
11
|
+
getContainer: () => HTMLElement;
|
|
12
|
+
};
|
|
13
|
+
export declare class Toast {
|
|
14
|
+
private containerEl;
|
|
15
|
+
private mountEl;
|
|
16
|
+
private timer;
|
|
17
|
+
static show(config: ToastShowProps): Toast;
|
|
18
|
+
destroy: () => void;
|
|
19
|
+
create: (props: ToastShowProps) => void;
|
|
20
|
+
}
|
|
@@ -0,0 +1,112 @@
|
|
|
1
|
+
function _typeof(o) { "@babel/helpers - typeof"; return _typeof = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function (o) { return typeof o; } : function (o) { return o && "function" == typeof Symbol && o.constructor === Symbol && o !== Symbol.prototype ? "symbol" : typeof o; }, _typeof(o); }
|
|
2
|
+
var _excluded = ["getContainer", "open"],
|
|
3
|
+
_excluded2 = ["getContainer", "duration"];
|
|
4
|
+
function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
|
|
5
|
+
function _defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, _toPropertyKey(descriptor.key), descriptor); } }
|
|
6
|
+
function _createClass(Constructor, protoProps, staticProps) { if (protoProps) _defineProperties(Constructor.prototype, protoProps); if (staticProps) _defineProperties(Constructor, staticProps); Object.defineProperty(Constructor, "prototype", { writable: false }); return Constructor; }
|
|
7
|
+
function _defineProperty(obj, key, value) { key = _toPropertyKey(key); if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; }
|
|
8
|
+
function _toPropertyKey(t) { var i = _toPrimitive(t, "string"); return "symbol" == _typeof(i) ? i : String(i); }
|
|
9
|
+
function _toPrimitive(t, r) { if ("object" != _typeof(t) || !t) return t; var e = t[Symbol.toPrimitive]; if (void 0 !== e) { var i = e.call(t, r || "default"); if ("object" != _typeof(i)) return i; throw new TypeError("@@toPrimitive must return a primitive value."); } return ("string" === r ? String : Number)(t); }
|
|
10
|
+
function _extends() { _extends = Object.assign ? Object.assign.bind() : function (target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { target[key] = source[key]; } } } return target; }; return _extends.apply(this, arguments); }
|
|
11
|
+
function _slicedToArray(arr, i) { return _arrayWithHoles(arr) || _iterableToArrayLimit(arr, i) || _unsupportedIterableToArray(arr, i) || _nonIterableRest(); }
|
|
12
|
+
function _nonIterableRest() { throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method."); }
|
|
13
|
+
function _unsupportedIterableToArray(o, minLen) { if (!o) return; if (typeof o === "string") return _arrayLikeToArray(o, minLen); var n = Object.prototype.toString.call(o).slice(8, -1); if (n === "Object" && o.constructor) n = o.constructor.name; if (n === "Map" || n === "Set") return Array.from(o); if (n === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)) return _arrayLikeToArray(o, minLen); }
|
|
14
|
+
function _arrayLikeToArray(arr, len) { if (len == null || len > arr.length) len = arr.length; for (var i = 0, arr2 = new Array(len); i < len; i++) arr2[i] = arr[i]; return arr2; }
|
|
15
|
+
function _iterableToArrayLimit(r, l) { var t = null == r ? null : "undefined" != typeof Symbol && r[Symbol.iterator] || r["@@iterator"]; if (null != t) { var e, n, i, u, a = [], f = !0, o = !1; try { if (i = (t = t.call(r)).next, 0 === l) { if (Object(t) !== t) return; f = !1; } else for (; !(f = (e = i.call(t)).done) && (a.push(e.value), a.length !== l); f = !0); } catch (r) { o = !0, n = r; } finally { try { if (!f && null != t.return && (u = t.return(), Object(u) !== u)) return; } finally { if (o) throw n; } } return a; } }
|
|
16
|
+
function _arrayWithHoles(arr) { if (Array.isArray(arr)) return arr; }
|
|
17
|
+
function _objectWithoutProperties(source, excluded) { if (source == null) return {}; var target = _objectWithoutPropertiesLoose(source, excluded); var key, i; if (Object.getOwnPropertySymbols) { var sourceSymbolKeys = Object.getOwnPropertySymbols(source); for (i = 0; i < sourceSymbolKeys.length; i++) { key = sourceSymbolKeys[i]; if (excluded.indexOf(key) >= 0) continue; if (!Object.prototype.propertyIsEnumerable.call(source, key)) continue; target[key] = source[key]; } } return target; }
|
|
18
|
+
function _objectWithoutPropertiesLoose(source, excluded) { if (source == null) return {}; var target = {}; var sourceKeys = Object.keys(source); var key, i; for (i = 0; i < sourceKeys.length; i++) { key = sourceKeys[i]; if (excluded.indexOf(key) >= 0) continue; target[key] = source[key]; } return target; }
|
|
19
|
+
import React, { forwardRef, useEffect, useImperativeHandle } from "react";
|
|
20
|
+
import { ToastModal } from "./toast-modal";
|
|
21
|
+
import { createPortal } from "react-dom";
|
|
22
|
+
import { createRoot } from "react-dom/client";
|
|
23
|
+
export var InternalToast = /*#__PURE__*/forwardRef(function (_ref, ref) {
|
|
24
|
+
var getContainer = _ref.getContainer,
|
|
25
|
+
_ref$open = _ref.open,
|
|
26
|
+
open = _ref$open === void 0 ? false : _ref$open,
|
|
27
|
+
rest = _objectWithoutProperties(_ref, _excluded);
|
|
28
|
+
var _React$useState = React.useState(false),
|
|
29
|
+
_React$useState2 = _slicedToArray(_React$useState, 2),
|
|
30
|
+
renderEnable = _React$useState2[0],
|
|
31
|
+
setRenderEnable = _React$useState2[1];
|
|
32
|
+
var containerRef = React.useRef(null);
|
|
33
|
+
var mountRef = React.useRef(null);
|
|
34
|
+
var rootContainer = (getContainer === null || getContainer === void 0 ? void 0 : getContainer()) || containerRef.current;
|
|
35
|
+
useImperativeHandle(ref, function () {
|
|
36
|
+
return {
|
|
37
|
+
clear: function clear() {}
|
|
38
|
+
};
|
|
39
|
+
});
|
|
40
|
+
var ToastPortal = function ToastPortal() {
|
|
41
|
+
if (!mountRef.current) {
|
|
42
|
+
mountRef.current = document.createElement("div");
|
|
43
|
+
rootContainer.appendChild(mountRef.current);
|
|
44
|
+
}
|
|
45
|
+
var destroy = function destroy() {
|
|
46
|
+
if (rootContainer && mountRef.current) {
|
|
47
|
+
rootContainer.removeChild(mountRef.current);
|
|
48
|
+
}
|
|
49
|
+
mountRef.current = null;
|
|
50
|
+
setRenderEnable(false);
|
|
51
|
+
};
|
|
52
|
+
return /*#__PURE__*/React.createElement(React.Fragment, null, /*#__PURE__*/createPortal( /*#__PURE__*/React.createElement(ToastModal, _extends({}, rest, {
|
|
53
|
+
onDestroy: destroy,
|
|
54
|
+
open: open
|
|
55
|
+
})), containerRef.current));
|
|
56
|
+
};
|
|
57
|
+
useEffect(function () {
|
|
58
|
+
if (open && !renderEnable) {
|
|
59
|
+
setRenderEnable(true);
|
|
60
|
+
}
|
|
61
|
+
}, [open]);
|
|
62
|
+
return /*#__PURE__*/React.createElement(React.Fragment, null, !(getContainer !== null && getContainer !== void 0 && getContainer()) && /*#__PURE__*/React.createElement("div", {
|
|
63
|
+
ref: containerRef
|
|
64
|
+
}), renderEnable && /*#__PURE__*/React.createElement(ToastPortal, null));
|
|
65
|
+
});
|
|
66
|
+
export var Toast = /*#__PURE__*/function () {
|
|
67
|
+
function Toast() {
|
|
68
|
+
var _this = this;
|
|
69
|
+
_classCallCheck(this, Toast);
|
|
70
|
+
_defineProperty(this, "containerEl", void 0);
|
|
71
|
+
_defineProperty(this, "mountEl", null);
|
|
72
|
+
_defineProperty(this, "timer", void 0);
|
|
73
|
+
_defineProperty(this, "destroy", function () {
|
|
74
|
+
if (_this.mountEl) {
|
|
75
|
+
var _this$mountEl$parentN;
|
|
76
|
+
(_this$mountEl$parentN = _this.mountEl.parentNode) === null || _this$mountEl$parentN === void 0 || _this$mountEl$parentN.removeChild(_this.mountEl);
|
|
77
|
+
}
|
|
78
|
+
if (_this.timer) {
|
|
79
|
+
clearTimeout(_this.timer);
|
|
80
|
+
_this.timer = null;
|
|
81
|
+
}
|
|
82
|
+
});
|
|
83
|
+
_defineProperty(this, "create", function (props) {
|
|
84
|
+
var getContainer = props.getContainer,
|
|
85
|
+
_props$duration = props.duration,
|
|
86
|
+
duration = _props$duration === void 0 ? 2000 : _props$duration,
|
|
87
|
+
config = _objectWithoutProperties(props, _excluded2);
|
|
88
|
+
_this.containerEl = getContainer();
|
|
89
|
+
_this.mountEl = document.createElement("div");
|
|
90
|
+
_this.containerEl.appendChild(_this.mountEl);
|
|
91
|
+
createRoot(_this.mountEl).render( /*#__PURE__*/React.createElement(ToastModal, _extends({}, config, {
|
|
92
|
+
onDestroy: _this.destroy,
|
|
93
|
+
open: true,
|
|
94
|
+
durationAble: false
|
|
95
|
+
})));
|
|
96
|
+
if (duration) {
|
|
97
|
+
_this.timer = setTimeout(function () {
|
|
98
|
+
_this.destroy();
|
|
99
|
+
}, duration);
|
|
100
|
+
}
|
|
101
|
+
});
|
|
102
|
+
}
|
|
103
|
+
_createClass(Toast, null, [{
|
|
104
|
+
key: "show",
|
|
105
|
+
value: function show(config) {
|
|
106
|
+
var toast = new Toast();
|
|
107
|
+
toast.create(config);
|
|
108
|
+
return toast;
|
|
109
|
+
}
|
|
110
|
+
}]);
|
|
111
|
+
return Toast;
|
|
112
|
+
}();
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import React from "react";
|
|
2
|
+
import ValidationCodeInput from "../index";
|
|
3
|
+
export default (function () {
|
|
4
|
+
return /*#__PURE__*/React.createElement("div", {
|
|
5
|
+
style: {
|
|
6
|
+
backgroundColor: 'rgb(244 244 244)'
|
|
7
|
+
}
|
|
8
|
+
}, /*#__PURE__*/React.createElement(ValidationCodeInput, {
|
|
9
|
+
placeholder: "\u8BF7\u8F93\u5165\u9A8C\u8BC1\u7801"
|
|
10
|
+
}));
|
|
11
|
+
});
|
|
@@ -0,0 +1,47 @@
|
|
|
1
|
+
function _slicedToArray(arr, i) { return _arrayWithHoles(arr) || _iterableToArrayLimit(arr, i) || _unsupportedIterableToArray(arr, i) || _nonIterableRest(); }
|
|
2
|
+
function _nonIterableRest() { throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method."); }
|
|
3
|
+
function _unsupportedIterableToArray(o, minLen) { if (!o) return; if (typeof o === "string") return _arrayLikeToArray(o, minLen); var n = Object.prototype.toString.call(o).slice(8, -1); if (n === "Object" && o.constructor) n = o.constructor.name; if (n === "Map" || n === "Set") return Array.from(o); if (n === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)) return _arrayLikeToArray(o, minLen); }
|
|
4
|
+
function _arrayLikeToArray(arr, len) { if (len == null || len > arr.length) len = arr.length; for (var i = 0, arr2 = new Array(len); i < len; i++) arr2[i] = arr[i]; return arr2; }
|
|
5
|
+
function _iterableToArrayLimit(r, l) { var t = null == r ? null : "undefined" != typeof Symbol && r[Symbol.iterator] || r["@@iterator"]; if (null != t) { var e, n, i, u, a = [], f = !0, o = !1; try { if (i = (t = t.call(r)).next, 0 === l) { if (Object(t) !== t) return; f = !1; } else for (; !(f = (e = i.call(t)).done) && (a.push(e.value), a.length !== l); f = !0); } catch (r) { o = !0, n = r; } finally { try { if (!f && null != t.return && (u = t.return(), Object(u) !== u)) return; } finally { if (o) throw n; } } return a; } }
|
|
6
|
+
function _arrayWithHoles(arr) { if (Array.isArray(arr)) return arr; }
|
|
7
|
+
/**
|
|
8
|
+
* compact: true
|
|
9
|
+
*/
|
|
10
|
+
import React, { useState } from 'react';
|
|
11
|
+
import "./demo1.scss";
|
|
12
|
+
import Button from "../../Button";
|
|
13
|
+
import WaterMark from "../index";
|
|
14
|
+
var textProps = {
|
|
15
|
+
content: 'Ant Taro Mobile'
|
|
16
|
+
};
|
|
17
|
+
var rowsTextProps = {
|
|
18
|
+
content: ['Ant Taro Mobile', 'Ant Taro Mobile Pro']
|
|
19
|
+
};
|
|
20
|
+
var imageProps = {
|
|
21
|
+
image: 'https://gw.alipayobjects.com/zos/bmw-prod/59a18171-ae17-4fc5-93a0-2645f64a3aca.svg',
|
|
22
|
+
imageWidth: 115,
|
|
23
|
+
imageHeight: 36,
|
|
24
|
+
width: 140,
|
|
25
|
+
height: 80
|
|
26
|
+
};
|
|
27
|
+
export default (function () {
|
|
28
|
+
var _useState = useState(textProps),
|
|
29
|
+
_useState2 = _slicedToArray(_useState, 2),
|
|
30
|
+
props = _useState2[0],
|
|
31
|
+
setProps = _useState2[1];
|
|
32
|
+
return /*#__PURE__*/React.createElement("div", {
|
|
33
|
+
className: "water-mark-overlay"
|
|
34
|
+
}, /*#__PURE__*/React.createElement(Button, {
|
|
35
|
+
onClick: function onClick() {
|
|
36
|
+
return setProps(textProps);
|
|
37
|
+
}
|
|
38
|
+
}, "\u666E\u901A\u6C34\u5370"), /*#__PURE__*/React.createElement("br", null), /*#__PURE__*/React.createElement(Button, {
|
|
39
|
+
onClick: function onClick() {
|
|
40
|
+
return setProps(rowsTextProps);
|
|
41
|
+
}
|
|
42
|
+
}, "\u591A\u884C\u6587\u5B57\u6C34\u5370"), /*#__PURE__*/React.createElement("br", null), /*#__PURE__*/React.createElement(Button, {
|
|
43
|
+
onClick: function onClick() {
|
|
44
|
+
return setProps(imageProps);
|
|
45
|
+
}
|
|
46
|
+
}, "\u56FE\u7247\u6C34\u5370"), /*#__PURE__*/React.createElement(WaterMark, props));
|
|
47
|
+
});
|
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* compact: true
|
|
3
|
+
*/
|
|
4
|
+
import { DemoBlock } from "../../DemoBlock";
|
|
5
|
+
import React from 'react';
|
|
6
|
+
import WaterMark from "../index";
|
|
7
|
+
export default (function () {
|
|
8
|
+
return /*#__PURE__*/React.createElement(DemoBlock, {
|
|
9
|
+
title: "\u5C40\u90E8\u6C34\u5370"
|
|
10
|
+
}, /*#__PURE__*/React.createElement("div", {
|
|
11
|
+
style: {
|
|
12
|
+
display: 'inline-flex',
|
|
13
|
+
position: 'relative'
|
|
14
|
+
}
|
|
15
|
+
}, /*#__PURE__*/React.createElement("img", {
|
|
16
|
+
style: {
|
|
17
|
+
width: '100%'
|
|
18
|
+
},
|
|
19
|
+
src: "https://images.unsplash.com/photo-1529919864908-4c7b46026144?ixid=MnwxMjA3fDB8MHxwcm9maWxlLXBhZ2V8NTN8fHxlbnwwfHx8fA%3D%3D&ixlib=rb-1.2.1&auto=format&fit=crop&w=900&q=60"
|
|
20
|
+
}), /*#__PURE__*/React.createElement(WaterMark, {
|
|
21
|
+
content: 'Ant Design Mobile',
|
|
22
|
+
gapX: 12,
|
|
23
|
+
gapY: 24,
|
|
24
|
+
fullPage: false
|
|
25
|
+
})), /*#__PURE__*/React.createElement("div", {
|
|
26
|
+
style: {
|
|
27
|
+
color: '#ccc',
|
|
28
|
+
marginTop: 10
|
|
29
|
+
}
|
|
30
|
+
}, "\u628A WaterMark \u653E\u5230\u4E00\u4E2A relative \u5B9A\u4F4D\u7684\u7236\u5143\u7D20\uFF0C\u5B83\u4F1A\u81EA\u52A8\u6491\u6EE1\u8FD9\u4E2A\u7236\u5143\u7D20\u7684\u8303\u56F4\u3002"));
|
|
31
|
+
});
|