@nutui/nutui-react 1.5.2-beta.0 → 1.5.2
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/dist/esm/ActionSheet/style/index.js +2 -0
- package/dist/esm/ActionSheet.js +92 -0
- package/dist/esm/Address/style/index.js +4 -0
- package/dist/esm/Address.js +622 -0
- package/dist/esm/Animate/style/index.js +2 -0
- package/dist/esm/Animate.js +55 -0
- package/dist/esm/AnimatingNumbers/style/index.js +3 -0
- package/dist/esm/AnimatingNumbers.js +127 -0
- package/dist/esm/Audio/style/index.js +4 -0
- package/dist/esm/Audio.js +266 -0
- package/dist/esm/Avatar/style/index.js +2 -0
- package/dist/esm/Avatar.js +132 -0
- package/dist/esm/AvatarContext-15733596.js +3 -0
- package/dist/esm/AvatarGroup/style/index.js +2 -0
- package/dist/esm/AvatarGroup.js +43 -0
- package/dist/esm/BackTop/style/index.js +2 -0
- package/dist/esm/BackTop.js +139 -0
- package/dist/esm/Badge/style/index.js +2 -0
- package/dist/esm/Badge.js +73 -0
- package/dist/esm/Barrage/style/index.js +2 -0
- package/dist/esm/Barrage.js +99 -0
- package/dist/esm/Button/style/index.js +2 -0
- package/dist/esm/Button.js +109 -0
- package/dist/esm/Calendar/style/index.js +2 -0
- package/dist/esm/Calendar.js +129 -0
- package/dist/esm/CalendarItem/style/index.js +2 -0
- package/dist/esm/CalendarItem.js +676 -0
- package/dist/esm/Card/style/index.js +4 -0
- package/dist/esm/Card.js +63 -0
- package/dist/esm/Cascader/style/index.js +3 -0
- package/dist/esm/Cascader.js +673 -0
- package/dist/esm/Cell/style/index.js +2 -0
- package/dist/esm/Cell.js +103 -0
- package/dist/esm/CellGroup/style/index.js +2 -0
- package/dist/esm/CellGroup.js +5 -0
- package/dist/esm/Checkbox/style/index.js +3 -0
- package/dist/esm/Checkbox.js +8 -0
- package/dist/esm/CheckboxGroup/style/index.js +2 -0
- package/dist/esm/CheckboxGroup.js +113 -0
- package/dist/esm/CircleProgress/style/index.js +2 -0
- package/dist/esm/CircleProgress.js +116 -0
- package/dist/esm/Col/style/index.js +2 -0
- package/dist/esm/Col.js +58 -0
- package/dist/esm/Collapse/style/index.js +2 -0
- package/dist/esm/Collapse.js +99 -0
- package/dist/esm/CollapseItem/style/index.js +2 -0
- package/dist/esm/CollapseItem.js +148 -0
- package/dist/esm/ConfigProvider/style/index.js +2 -0
- package/dist/esm/ConfigProvider.js +187 -0
- package/dist/esm/CountDown/style/index.js +2 -0
- package/dist/esm/CountDown.js +249 -0
- package/dist/esm/DatePicker/style/index.js +2 -0
- package/dist/esm/DatePicker.js +310 -0
- package/dist/esm/Dialog/style/index.js +3 -0
- package/dist/esm/Dialog.js +296 -0
- package/dist/esm/Divider/style/index.js +2 -0
- package/dist/esm/Divider.js +36 -0
- package/dist/esm/Drag/style/index.js +2 -0
- package/dist/esm/Drag.js +120 -0
- package/dist/esm/Elevator/style/index.js +2 -0
- package/dist/esm/Elevator.js +236 -0
- package/dist/esm/Ellipsis/style/index.js +2 -0
- package/dist/esm/Ellipsis.js +177 -0
- package/dist/esm/Empty/style/index.js +2 -0
- package/dist/esm/Empty.js +82 -0
- package/dist/esm/FixedNav/style/index.js +3 -0
- package/dist/esm/FixedNav.js +105 -0
- package/dist/esm/Form/style/index.js +2 -0
- package/dist/esm/Form.js +219 -0
- package/dist/esm/FormItem/style/index.js +2 -0
- package/dist/esm/FormItem.js +5 -0
- package/dist/esm/Grid/style/index.js +2 -0
- package/dist/esm/Grid.js +83 -0
- package/dist/esm/GridItem/style/index.js +2 -0
- package/dist/esm/GridItem.js +125 -0
- package/dist/esm/Icon/style/index.js +4 -0
- package/dist/esm/Icon.js +5 -0
- package/dist/esm/Image/style/index.js +2 -0
- package/dist/esm/Image.js +170 -0
- package/dist/esm/ImagePreview/style/index.js +4 -0
- package/dist/esm/ImagePreview.js +226 -0
- package/dist/esm/Indicator/style/index.js +2 -0
- package/dist/esm/Indicator.js +52 -0
- package/dist/esm/Infiniteloading/style/index.js +2 -0
- package/dist/esm/Infiniteloading.js +217 -0
- package/dist/esm/Input/style/index.js +2 -0
- package/dist/esm/Input.js +363 -0
- package/dist/esm/InputNumber/style/index.js +2 -0
- package/dist/esm/InputNumber.js +277 -0
- package/dist/esm/Layout/style/index.js +2 -0
- package/dist/esm/Layout.js +14 -0
- package/dist/esm/Menu/style/index.js +3 -0
- package/dist/esm/Menu.js +154 -0
- package/dist/esm/MenuItem/style/index.js +3 -0
- package/dist/esm/MenuItem.js +177 -0
- package/dist/esm/NavBar/style/index.js +2 -0
- package/dist/esm/NavBar.js +116 -0
- package/dist/esm/NoticeBar/style/index.js +2 -0
- package/dist/esm/NoticeBar.js +570 -0
- package/dist/esm/Notify/style/index.js +2 -0
- package/dist/esm/Notify.js +236 -0
- package/dist/esm/NumberKeyboard/style/index.js +2 -0
- package/dist/esm/NumberKeyboard.js +249 -0
- package/dist/esm/Overlay/style/index.js +2 -0
- package/dist/esm/Overlay.js +6 -0
- package/dist/esm/Pagination/style/index.js +2 -0
- package/dist/esm/Pagination.js +170 -0
- package/dist/esm/Picker/style/index.js +2 -0
- package/dist/esm/Picker.js +496 -0
- package/dist/esm/Popover/style/index.js +3 -0
- package/dist/esm/Popover.js +225 -0
- package/dist/esm/Popup/style/index.js +3 -0
- package/dist/esm/Popup.js +195 -0
- package/dist/esm/Price/style/index.js +2 -0
- package/dist/esm/Price.js +86 -0
- package/dist/esm/Progress/style/index.js +2 -0
- package/dist/esm/Progress.js +124 -0
- package/dist/esm/PullToRefresh/style/index.js +2 -0
- package/dist/esm/PullToRefresh.js +277 -0
- package/dist/esm/Radio/style/index.js +3 -0
- package/dist/esm/Radio.js +6 -0
- package/dist/esm/RadioGroup/style/index.js +2 -0
- package/dist/esm/RadioGroup.js +123 -0
- package/dist/esm/Range/style/index.js +2 -0
- package/dist/esm/Range.js +407 -0
- package/dist/esm/Rate/style/index.js +2 -0
- package/dist/esm/Rate.js +123 -0
- package/dist/esm/Row/style/index.js +2 -0
- package/dist/esm/Row.js +50 -0
- package/dist/esm/SearchBar/style/index.js +2 -0
- package/dist/esm/SearchBar.js +237 -0
- package/dist/esm/ShortPassword/style/index.js +3 -0
- package/dist/esm/ShortPassword.js +193 -0
- package/dist/esm/SideNavBar/style/index.js +2 -0
- package/dist/esm/SideNavBar.js +58 -0
- package/dist/esm/SideNavBarItem/style/index.js +2 -0
- package/dist/esm/SideNavBarItem.js +25 -0
- package/dist/esm/Signature/style/index.js +2 -0
- package/dist/esm/Signature.js +155 -0
- package/dist/esm/Skeleton/style/index.js +2 -0
- package/dist/esm/Skeleton.js +100 -0
- package/dist/esm/Step/style/index.js +2 -0
- package/dist/esm/Step.js +89 -0
- package/dist/esm/Steps/style/index.js +2 -0
- package/dist/esm/Steps.js +40 -0
- package/dist/esm/Sticky/style/index.js +2 -0
- package/dist/esm/Sticky.js +192 -0
- package/dist/esm/SubSideNavBar/style/index.js +2 -0
- package/dist/esm/SubSideNavBar.js +79 -0
- package/dist/esm/Swipe/style/index.js +2 -0
- package/dist/esm/Swipe.js +232 -0
- package/dist/esm/Swiper/style/index.js +2 -0
- package/dist/esm/Swiper.js +492 -0
- package/dist/esm/SwiperItem/style/index.js +2 -0
- package/dist/esm/SwiperItem.js +38 -0
- package/dist/esm/Switch/style/index.js +2 -0
- package/dist/esm/Switch.js +73 -0
- package/dist/esm/TabPane/style/index.js +2 -0
- package/dist/esm/TabPane.js +6 -0
- package/dist/esm/Tabbar/style/index.js +2 -0
- package/dist/esm/Tabbar.js +70 -0
- package/dist/esm/TabbarItem/style/index.js +2 -0
- package/dist/esm/TabbarItem.js +80 -0
- package/dist/esm/Table/style/index.js +2 -0
- package/dist/esm/Table.js +142 -0
- package/dist/esm/Tabs/style/index.js +4 -0
- package/dist/esm/Tabs.js +9 -0
- package/dist/esm/Tag/style/index.js +2 -0
- package/dist/esm/Tag.js +111 -0
- package/dist/esm/TextArea/style/index.js +2 -0
- package/dist/esm/TextArea.js +150 -0
- package/dist/esm/TimeDetail/style/index.js +2 -0
- package/dist/esm/TimeDetail.js +69 -0
- package/dist/esm/TimePannel/style/index.js +2 -0
- package/dist/esm/TimePannel.js +31 -0
- package/dist/esm/TimeSelect/style/index.js +4 -0
- package/dist/esm/TimeSelect.js +173 -0
- package/dist/esm/Toast/style/index.js +2 -0
- package/dist/esm/Toast.js +271 -0
- package/dist/esm/TrendArrow/style/index.js +2 -0
- package/dist/esm/TrendArrow.js +101 -0
- package/dist/esm/Uploader/style/index.js +4 -0
- package/dist/esm/Uploader.js +568 -0
- package/dist/esm/UserContext-101ad4a4.js +3 -0
- package/dist/esm/UserContext-2629d479.js +3 -0
- package/dist/esm/UserContext-b33bcf21.js +3 -0
- package/dist/esm/Video/style/index.js +2 -0
- package/dist/esm/Video.js +92 -0
- package/dist/esm/VirtualList/style/index.js +2 -0
- package/dist/esm/VirtualList.js +315 -0
- package/dist/esm/WaterMark/style/index.js +2 -0
- package/dist/esm/WaterMark.js +113 -0
- package/dist/esm/bem-3b438e61.js +8 -0
- package/dist/esm/cellgroup-fcc72767.js +34 -0
- package/dist/esm/checkbox-44e13cd0.js +137 -0
- package/dist/esm/date-c7aad4c0.js +97 -0
- package/dist/esm/formitem-8a73a5fb.js +157 -0
- package/dist/esm/get-scroll-parent-5f85dee8.js +24 -0
- package/dist/esm/grid.context-2ee27d95.js +6 -0
- package/dist/esm/icon-4ef1581c.js +70 -0
- package/dist/esm/index-030b7245.js +11 -0
- package/dist/esm/nutui-react.es.js +94 -0
- package/dist/esm/offsetContext-3ab00d40.js +16 -0
- package/dist/esm/overlay-de6c79d5.js +83 -0
- package/dist/esm/radio-9f141e6b.js +118 -0
- package/dist/esm/render-bbebb760.js +79 -0
- package/dist/esm/tabpane-01075e6c.js +29 -0
- package/dist/esm/tabs-e1b4e4b1.js +181 -0
- package/dist/esm/typings-f27b58f4.js +8 -0
- package/dist/esm/useClientRect-56bb675b.js +39 -0
- package/dist/esm/useTouch-cf73a407.js +99 -0
- package/dist/locales/base.d.ts +129 -0
- package/dist/locales/base.js +5 -0
- package/dist/locales/en-US.d.ts +3 -0
- package/dist/locales/en-US.js +135 -0
- package/dist/locales/id-ID.d.ts +3 -0
- package/dist/locales/id-ID.js +135 -0
- package/dist/locales/zh-CN.d.ts +3 -0
- package/dist/locales/zh-CN.js +137 -0
- package/dist/locales/zh-TW.d.ts +3 -0
- package/dist/locales/zh-TW.js +135 -0
- package/dist/locales/zh-UG.d.ts +3 -0
- package/dist/locales/zh-UG.js +135 -0
- package/dist/nutui.react.mjs +1 -1
- package/dist/nutui.react.umd.js +1 -1
- package/dist/packages/actionsheet/actionsheet.scss +103 -0
- package/dist/packages/address/address.scss +243 -0
- package/dist/packages/animate/animate.scss +284 -0
- package/dist/packages/animatingnumbers/animatingnumbers.scss +0 -0
- package/dist/packages/animatingnumbers/countup.scss +45 -0
- package/dist/packages/audio/audio.scss +93 -0
- package/dist/packages/avatar/avatar.scss +58 -0
- package/dist/packages/avatargroup/avatargroup.scss +14 -0
- package/dist/packages/backtop/backtop.scss +29 -0
- package/dist/packages/badge/badge.scss +53 -0
- package/dist/packages/barrage/barrage.scss +60 -0
- package/dist/packages/button/button.scss +245 -0
- package/dist/packages/calendar/calendar.scss +265 -0
- package/dist/packages/calendaritem/calendaritem.scss +0 -0
- package/dist/packages/card/card.scss +83 -0
- package/dist/packages/cascader/cascader.scss +108 -0
- package/dist/packages/cell/cell.scss +107 -0
- package/dist/packages/cellgroup/cellgroup.scss +46 -0
- package/dist/packages/checkbox/checkbox.scss +49 -0
- package/dist/packages/checkboxgroup/checkboxgroup.scss +33 -0
- package/dist/packages/circleprogress/circleprogress.scss +33 -0
- package/dist/packages/col/col.scss +24 -0
- package/dist/packages/collapse/collapse.scss +0 -0
- package/dist/packages/collapseitem/collapseitem.scss +161 -0
- package/dist/packages/configprovider/configprovider.scss +0 -0
- package/dist/packages/countdown/countdown.scss +3 -0
- package/dist/packages/datepicker/datepicker.scss +0 -0
- package/dist/packages/dialog/dialog.scss +135 -0
- package/dist/packages/divider/divider.scss +73 -0
- package/dist/packages/drag/drag.scss +10 -0
- package/dist/packages/elevator/elevator.scss +124 -0
- package/dist/packages/ellipsis/ellipsis.scss +17 -0
- package/dist/packages/empty/empty.scss +42 -0
- package/dist/packages/fixednav/fixednav.scss +141 -0
- package/dist/packages/form/form.scss +31 -0
- package/dist/packages/formitem/formitem.scss +100 -0
- package/dist/packages/grid/grid.scss +10 -0
- package/dist/packages/griditem/griditem.scss +108 -0
- package/dist/packages/icon/icon.scss +132 -0
- package/dist/packages/image/image.scss +53 -0
- package/dist/packages/imagepreview/imagepreview.scss +51 -0
- package/dist/packages/indicator/indicator.scss +70 -0
- package/dist/packages/infiniteloading/infiniteloading.scss +69 -0
- package/dist/packages/input/input.scss +203 -0
- package/dist/packages/inputnumber/inputnumber.scss +79 -0
- package/dist/packages/layout/layout.scss +2 -0
- package/dist/packages/menu/menu.scss +75 -0
- package/dist/packages/menuitem/menuitem.scss +120 -0
- package/dist/packages/navbar/navbar.scss +185 -0
- package/dist/packages/noticebar/noticebar.scss +156 -0
- package/dist/packages/notify/notify.scss +93 -0
- package/dist/packages/numberkeyboard/numberkeyboard.scss +147 -0
- package/dist/packages/overlay/overlay.scss +75 -0
- package/dist/packages/pagination/pagination.scss +81 -0
- package/dist/packages/picker/picker.scss +225 -0
- package/dist/packages/popover/popover.scss +288 -0
- package/dist/packages/popup/popup.scss +201 -0
- package/dist/packages/price/price.scss +37 -0
- package/dist/packages/progress/progress.scss +114 -0
- package/dist/packages/pulltorefresh/pulltorefresh.scss +26 -0
- package/dist/packages/radio/radio.scss +84 -0
- package/dist/packages/radiogroup/radiogroup.scss +86 -0
- package/dist/packages/range/range.scss +224 -0
- package/dist/packages/rate/rate.scss +36 -0
- package/dist/packages/row/row.scss +83 -0
- package/dist/packages/searchbar/searchbar.scss +146 -0
- package/dist/packages/shortpassword/shortpassword.scss +203 -0
- package/dist/packages/sidenavbar/sidenavbar.scss +100 -0
- package/dist/packages/sidenavbaritem/sidenavbaritem.scss +25 -0
- package/dist/packages/signature/signature.scss +39 -0
- package/dist/packages/skeleton/skeleton.scss +70 -0
- package/dist/packages/step/step.scss +274 -0
- package/dist/packages/steps/steps.scss +7 -0
- package/dist/packages/sticky/sticky.scss +3 -0
- package/dist/packages/subsidenavbar/subsidenavbar.scss +35 -0
- package/dist/packages/swipe/swipe.scss +33 -0
- package/dist/packages/swiper/swiper.scss +45 -0
- package/dist/packages/swiperitem/swiperitem.scss +3 -0
- package/dist/packages/switch/switch.scss +87 -0
- package/dist/packages/tabbar/tabbar.scss +46 -0
- package/dist/packages/tabbaritem/tabbaritem.scss +97 -0
- package/dist/packages/table/table.scss +152 -0
- package/dist/packages/tabpane/tabpane.scss +23 -0
- package/dist/packages/tabs/tabs.scss +284 -0
- package/dist/packages/tag/tag.scss +67 -0
- package/dist/packages/textarea/textarea.scss +60 -0
- package/dist/packages/timedetail/timedetail.scss +45 -0
- package/dist/packages/timepannel/timepannel.scss +17 -0
- package/dist/packages/timeselect/timeselect.scss +73 -0
- package/dist/packages/toast/toast.scss +98 -0
- package/dist/packages/trendarrow/trendarrow.scss +17 -0
- package/dist/packages/uploader/uploader.scss +237 -0
- package/dist/packages/video/video.scss +18 -0
- package/dist/packages/virtuallist/virtuallist.scss +87 -0
- package/dist/packages/watermark/watermark.scss +13 -0
- package/dist/style.css +1 -0
- package/dist/style.mjs +9 -0
- package/dist/styles/animation/drop.scss +24 -0
- package/dist/styles/animation/ease.scss +23 -0
- package/dist/styles/animation/fade.scss +20 -0
- package/dist/styles/animation/icon.scss +245 -0
- package/dist/styles/animation/index.scss +7 -0
- package/dist/styles/animation/rotate.scss +10 -0
- package/dist/styles/animation/zoom.scss +26 -0
- package/dist/styles/font/config.json +175 -0
- package/dist/styles/font/demo.css +539 -0
- package/dist/styles/font/demo_index.html +3063 -0
- package/dist/styles/font/iconfont.css +515 -0
- package/dist/styles/font/iconfont.eot +0 -0
- package/dist/styles/font/iconfont.js +68 -0
- package/dist/styles/font/iconfont.json +884 -0
- package/dist/styles/font/iconfont.svg +356 -0
- package/dist/styles/font/iconfont.ttf +0 -0
- package/dist/styles/font/iconfont.woff +0 -0
- package/dist/styles/font/iconfont.woff2 +0 -0
- package/dist/styles/mixins/index.scss +2 -0
- package/dist/styles/mixins/make-animation.scss +24 -0
- package/dist/styles/mixins/text-ellipsis.scss +20 -0
- package/dist/styles/theme-dark.scss +26 -0
- package/dist/styles/theme-default.scss +40 -0
- package/dist/styles/themes/default.scss +97 -0
- package/dist/styles/variables.scss +2610 -0
- package/dist/types/index.d.ts +2201 -0
- package/package.json +1 -1
|
@@ -0,0 +1,118 @@
|
|
|
1
|
+
import _slicedToArray from "@babel/runtime/helpers/slicedToArray";
|
|
2
|
+
import _objectWithoutProperties from "@babel/runtime/helpers/objectWithoutProperties";
|
|
3
|
+
import _defineProperty from "@babel/runtime/helpers/defineProperty";
|
|
4
|
+
var _excluded = ["className", "disabled", "checked", "shape", "textPosition", "value", "iconName", "iconActiveName", "iconSize", "onChange", "iconClassPrefix", "iconFontClassName"];
|
|
5
|
+
function ownKeys(object, enumerableOnly) { var keys = Object.keys(object); if (Object.getOwnPropertySymbols) { var symbols = Object.getOwnPropertySymbols(object); enumerableOnly && (symbols = symbols.filter(function (sym) { return Object.getOwnPropertyDescriptor(object, sym).enumerable; })), keys.push.apply(keys, symbols); } return keys; }
|
|
6
|
+
function _objectSpread(target) { for (var i = 1; i < arguments.length; i++) { var source = null != arguments[i] ? arguments[i] : {}; i % 2 ? ownKeys(Object(source), !0).forEach(function (key) { _defineProperty(target, key, source[key]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)) : ownKeys(Object(source)).forEach(function (key) { Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key)); }); } return target; }
|
|
7
|
+
import React__default, { useState, useContext, useEffect } from 'react';
|
|
8
|
+
import Icon from './Icon.js';
|
|
9
|
+
import RadioGroup from './RadioGroup.js';
|
|
10
|
+
import { C as ComponentDefaults } from './typings-f27b58f4.js';
|
|
11
|
+
var radioContext = {
|
|
12
|
+
onChange: function onChange(val) {}
|
|
13
|
+
};
|
|
14
|
+
var RadioContext = React__default.createContext(radioContext);
|
|
15
|
+
var defaultProps = _objectSpread(_objectSpread({}, ComponentDefaults), {}, {
|
|
16
|
+
className: '',
|
|
17
|
+
style: {},
|
|
18
|
+
disabled: false,
|
|
19
|
+
checked: false,
|
|
20
|
+
shape: 'round',
|
|
21
|
+
value: '',
|
|
22
|
+
textPosition: 'right',
|
|
23
|
+
iconName: 'check-normal',
|
|
24
|
+
iconActiveName: 'check-checked',
|
|
25
|
+
iconSize: 18,
|
|
26
|
+
onChange: function onChange(e) {}
|
|
27
|
+
});
|
|
28
|
+
var Radio = function Radio(props) {
|
|
29
|
+
var _defaultProps$props = _objectSpread(_objectSpread({}, defaultProps), props),
|
|
30
|
+
children = _defaultProps$props.children;
|
|
31
|
+
var className = props.className,
|
|
32
|
+
disabled = props.disabled,
|
|
33
|
+
checked = props.checked,
|
|
34
|
+
shape = props.shape,
|
|
35
|
+
textPosition = props.textPosition,
|
|
36
|
+
value = props.value,
|
|
37
|
+
iconName = props.iconName,
|
|
38
|
+
iconActiveName = props.iconActiveName,
|
|
39
|
+
iconSize = props.iconSize,
|
|
40
|
+
onChange = props.onChange,
|
|
41
|
+
iconClassPrefix = props.iconClassPrefix,
|
|
42
|
+
iconFontClassName = props.iconFontClassName,
|
|
43
|
+
rest = _objectWithoutProperties(props, _excluded);
|
|
44
|
+
var componentName = 'nut-radio';
|
|
45
|
+
var _useState = useState(checked),
|
|
46
|
+
_useState2 = _slicedToArray(_useState, 2),
|
|
47
|
+
checkedStatement = _useState2[0],
|
|
48
|
+
setCheckedStatement = _useState2[1];
|
|
49
|
+
var _useState3 = useState(value),
|
|
50
|
+
_useState4 = _slicedToArray(_useState3, 2),
|
|
51
|
+
valueStatement = _useState4[0],
|
|
52
|
+
setValueStatement = _useState4[1];
|
|
53
|
+
var _useState5 = useState(disabled),
|
|
54
|
+
_useState6 = _slicedToArray(_useState5, 2),
|
|
55
|
+
disabledStatement = _useState6[0],
|
|
56
|
+
setDisabledStatement = _useState6[1];
|
|
57
|
+
var context = useContext(RadioContext);
|
|
58
|
+
useEffect(function () {
|
|
59
|
+
setDisabledStatement(disabled);
|
|
60
|
+
setValueStatement(value);
|
|
61
|
+
setCheckedStatement(checked);
|
|
62
|
+
}, [disabled, value, checked]);
|
|
63
|
+
var renderLabel = function renderLabel() {
|
|
64
|
+
return React__default.createElement("div", {
|
|
65
|
+
className: "".concat(componentName, "__label ").concat(disabledStatement ? "".concat(componentName, "__label--disabled") : '')
|
|
66
|
+
}, children);
|
|
67
|
+
};
|
|
68
|
+
var renderButton = function renderButton() {
|
|
69
|
+
return React__default.createElement("div", {
|
|
70
|
+
className: "".concat(componentName, "__button ").concat(!disabledStatement && checkedStatement && "".concat(componentName, "__button--active"), " ").concat(disabledStatement ? "".concat(componentName, "__button--disabled") : '')
|
|
71
|
+
}, children);
|
|
72
|
+
};
|
|
73
|
+
var color = function color() {
|
|
74
|
+
if (disabledStatement) {
|
|
75
|
+
return 'nut-radio__icon--disable';
|
|
76
|
+
}
|
|
77
|
+
if (checkedStatement) {
|
|
78
|
+
return 'nut-radio__icon';
|
|
79
|
+
}
|
|
80
|
+
return 'nut-radio__icon--unchecked';
|
|
81
|
+
};
|
|
82
|
+
var renderIcon = function renderIcon() {
|
|
83
|
+
var iconName = props.iconName,
|
|
84
|
+
iconSize = props.iconSize,
|
|
85
|
+
iconActiveName = props.iconActiveName;
|
|
86
|
+
return React__default.createElement(Icon, {
|
|
87
|
+
classPrefix: iconClassPrefix,
|
|
88
|
+
fontClassName: iconFontClassName,
|
|
89
|
+
name: !disabledStatement && checkedStatement ? iconActiveName : iconName,
|
|
90
|
+
size: iconSize,
|
|
91
|
+
className: color()
|
|
92
|
+
});
|
|
93
|
+
};
|
|
94
|
+
var reverseState = textPosition === 'left';
|
|
95
|
+
var renderRadioItem = function renderRadioItem() {
|
|
96
|
+
if (shape === 'button') {
|
|
97
|
+
return renderButton();
|
|
98
|
+
}
|
|
99
|
+
if (reverseState) {
|
|
100
|
+
return React__default.createElement(React__default.Fragment, null, renderLabel(), renderIcon());
|
|
101
|
+
}
|
|
102
|
+
return React__default.createElement(React__default.Fragment, null, renderIcon(), renderLabel());
|
|
103
|
+
};
|
|
104
|
+
var handleClick = function handleClick(e) {
|
|
105
|
+
if (disabledStatement || checkedStatement) return;
|
|
106
|
+
setCheckedStatement(!checkedStatement);
|
|
107
|
+
onChange && onChange(e);
|
|
108
|
+
context && context.onChange(valueStatement);
|
|
109
|
+
};
|
|
110
|
+
return React__default.createElement("div", _objectSpread({
|
|
111
|
+
className: "nut-radio ".concat(className, " ").concat(reverseState ? "".concat(componentName, "--reverse") : ''),
|
|
112
|
+
onClick: handleClick
|
|
113
|
+
}, rest), renderRadioItem());
|
|
114
|
+
};
|
|
115
|
+
Radio.defaultProps = defaultProps;
|
|
116
|
+
Radio.displayName = 'NutRadio';
|
|
117
|
+
Radio.RadioGroup = RadioGroup;
|
|
118
|
+
export { Radio as R, RadioContext as a };
|
|
@@ -0,0 +1,79 @@
|
|
|
1
|
+
import _asyncToGenerator from "@babel/runtime/helpers/asyncToGenerator";
|
|
2
|
+
import _typeof from "@babel/runtime/helpers/typeof";
|
|
3
|
+
import _defineProperty from "@babel/runtime/helpers/defineProperty";
|
|
4
|
+
import _regeneratorRuntime from "@babel/runtime/regenerator";
|
|
5
|
+
function ownKeys(object, enumerableOnly) { var keys = Object.keys(object); if (Object.getOwnPropertySymbols) { var symbols = Object.getOwnPropertySymbols(object); enumerableOnly && (symbols = symbols.filter(function (sym) { return Object.getOwnPropertyDescriptor(object, sym).enumerable; })), keys.push.apply(keys, symbols); } return keys; }
|
|
6
|
+
function _objectSpread(target) { for (var i = 1; i < arguments.length; i++) { var source = null != arguments[i] ? arguments[i] : {}; i % 2 ? ownKeys(Object(source), !0).forEach(function (key) { _defineProperty(target, key, source[key]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)) : ownKeys(Object(source)).forEach(function (key) { Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key)); }); } return target; }
|
|
7
|
+
import * as ReactDOM from 'react-dom';
|
|
8
|
+
|
|
9
|
+
// Let compiler not to search module usage
|
|
10
|
+
var fullClone = _objectSpread({}, ReactDOM);
|
|
11
|
+
var version = fullClone.version,
|
|
12
|
+
reactRender = fullClone.render,
|
|
13
|
+
unmountComponentAtNode = fullClone.unmountComponentAtNode;
|
|
14
|
+
var createRoot;
|
|
15
|
+
try {
|
|
16
|
+
var mainVersion = Number((version || '').split('.')[0]);
|
|
17
|
+
if (mainVersion >= 18 && fullClone.createRoot) {
|
|
18
|
+
// eslint-disable-next-line @typescript-eslint/no-var-requires
|
|
19
|
+
createRoot = fullClone.createRoot;
|
|
20
|
+
}
|
|
21
|
+
} catch (e) {
|
|
22
|
+
// Do nothing;
|
|
23
|
+
}
|
|
24
|
+
function toggleWarning(skip) {
|
|
25
|
+
var __SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED = fullClone.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED;
|
|
26
|
+
if (__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED && _typeof(__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED) === 'object') {
|
|
27
|
+
__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED.usingClientEntryPoint = skip;
|
|
28
|
+
}
|
|
29
|
+
}
|
|
30
|
+
var MARK = '__nutui_react_root__';
|
|
31
|
+
function legacyRender(node, container) {
|
|
32
|
+
reactRender(node, container);
|
|
33
|
+
}
|
|
34
|
+
function concurrentRender(node, container) {
|
|
35
|
+
toggleWarning(true);
|
|
36
|
+
var root = container[MARK] || createRoot(container);
|
|
37
|
+
toggleWarning(false);
|
|
38
|
+
root.render(node);
|
|
39
|
+
container[MARK] = root;
|
|
40
|
+
}
|
|
41
|
+
function render(node, container) {
|
|
42
|
+
if (createRoot) {
|
|
43
|
+
concurrentRender(node, container);
|
|
44
|
+
return;
|
|
45
|
+
}
|
|
46
|
+
legacyRender(node, container);
|
|
47
|
+
}
|
|
48
|
+
// ========================== Unmount =========================
|
|
49
|
+
function legacyUnmount(container) {
|
|
50
|
+
return unmountComponentAtNode(container);
|
|
51
|
+
}
|
|
52
|
+
function concurrentUnmount(_x) {
|
|
53
|
+
return _concurrentUnmount.apply(this, arguments);
|
|
54
|
+
}
|
|
55
|
+
function _concurrentUnmount() {
|
|
56
|
+
_concurrentUnmount = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee(container) {
|
|
57
|
+
return _regeneratorRuntime.wrap(function _callee$(_context) {
|
|
58
|
+
while (1) switch (_context.prev = _context.next) {
|
|
59
|
+
case 0:
|
|
60
|
+
return _context.abrupt("return", Promise.resolve().then(function () {
|
|
61
|
+
var _container$MARK;
|
|
62
|
+
(_container$MARK = container[MARK]) === null || _container$MARK === void 0 ? void 0 : _container$MARK.unmount();
|
|
63
|
+
delete container[MARK];
|
|
64
|
+
}));
|
|
65
|
+
case 1:
|
|
66
|
+
case "end":
|
|
67
|
+
return _context.stop();
|
|
68
|
+
}
|
|
69
|
+
}, _callee);
|
|
70
|
+
}));
|
|
71
|
+
return _concurrentUnmount.apply(this, arguments);
|
|
72
|
+
}
|
|
73
|
+
function unmount(container) {
|
|
74
|
+
if (createRoot) {
|
|
75
|
+
return concurrentUnmount(container);
|
|
76
|
+
}
|
|
77
|
+
return legacyUnmount(container);
|
|
78
|
+
}
|
|
79
|
+
export { render as r, unmount as u };
|
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
import _defineProperty from "@babel/runtime/helpers/defineProperty";
|
|
2
|
+
function ownKeys(object, enumerableOnly) { var keys = Object.keys(object); if (Object.getOwnPropertySymbols) { var symbols = Object.getOwnPropertySymbols(object); enumerableOnly && (symbols = symbols.filter(function (sym) { return Object.getOwnPropertyDescriptor(object, sym).enumerable; })), keys.push.apply(keys, symbols); } return keys; }
|
|
3
|
+
function _objectSpread(target) { for (var i = 1; i < arguments.length; i++) { var source = null != arguments[i] ? arguments[i] : {}; i % 2 ? ownKeys(Object(source), !0).forEach(function (key) { _defineProperty(target, key, source[key]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)) : ownKeys(Object(source)).forEach(function (key) { Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key)); }); } return target; }
|
|
4
|
+
import React__default from 'react';
|
|
5
|
+
import classNames from 'classnames';
|
|
6
|
+
import { c as cn } from './bem-3b438e61.js';
|
|
7
|
+
var defaultProps = {
|
|
8
|
+
title: '',
|
|
9
|
+
paneKey: '',
|
|
10
|
+
activeKey: '',
|
|
11
|
+
disabled: false
|
|
12
|
+
};
|
|
13
|
+
var TabPane = function TabPane(props) {
|
|
14
|
+
var _defaultProps$props = _objectSpread(_objectSpread({}, defaultProps), props),
|
|
15
|
+
children = _defaultProps$props.children,
|
|
16
|
+
paneKey = _defaultProps$props.paneKey,
|
|
17
|
+
activeKey = _defaultProps$props.activeKey,
|
|
18
|
+
autoHeightClassName = _defaultProps$props.autoHeightClassName,
|
|
19
|
+
className = _defaultProps$props.className,
|
|
20
|
+
disabled = _defaultProps$props.disabled;
|
|
21
|
+
var b = cn('tabpane');
|
|
22
|
+
var classes = classNames({
|
|
23
|
+
active: !disabled && paneKey === activeKey
|
|
24
|
+
}, b(''), autoHeightClassName, className);
|
|
25
|
+
return React__default.createElement("div", {
|
|
26
|
+
className: classes
|
|
27
|
+
}, !disabled && children);
|
|
28
|
+
};
|
|
29
|
+
export { TabPane as T };
|
|
@@ -0,0 +1,181 @@
|
|
|
1
|
+
import _slicedToArray from "@babel/runtime/helpers/slicedToArray";
|
|
2
|
+
import _objectWithoutProperties from "@babel/runtime/helpers/objectWithoutProperties";
|
|
3
|
+
import _createClass from "@babel/runtime/helpers/createClass";
|
|
4
|
+
import _classCallCheck from "@babel/runtime/helpers/classCallCheck";
|
|
5
|
+
import _defineProperty from "@babel/runtime/helpers/defineProperty";
|
|
6
|
+
var _excluded = ["value", "color", "tabStyle", "background", "direction", "type", "titleScroll", "ellipsis", "animatedTime", "titleGutter", "size", "leftAlign", "titleNode", "children", "onClick", "onChange", "className", "autoHeight", "iconClassPrefix", "iconFontClassName"];
|
|
7
|
+
function ownKeys(object, enumerableOnly) { var keys = Object.keys(object); if (Object.getOwnPropertySymbols) { var symbols = Object.getOwnPropertySymbols(object); enumerableOnly && (symbols = symbols.filter(function (sym) { return Object.getOwnPropertyDescriptor(object, sym).enumerable; })), keys.push.apply(keys, symbols); } return keys; }
|
|
8
|
+
function _objectSpread(target) { for (var i = 1; i < arguments.length; i++) { var source = null != arguments[i] ? arguments[i] : {}; i % 2 ? ownKeys(Object(source), !0).forEach(function (key) { _defineProperty(target, key, source[key]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)) : ownKeys(Object(source)).forEach(function (key) { Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key)); }); } return target; }
|
|
9
|
+
import React__default, { useState, useRef, useEffect } from 'react';
|
|
10
|
+
import classNames from 'classnames';
|
|
11
|
+
import { c as cn } from './bem-3b438e61.js';
|
|
12
|
+
import Icon from './Icon.js';
|
|
13
|
+
import { C as ComponentDefaults } from './typings-f27b58f4.js';
|
|
14
|
+
import TabPane from './TabPane.js';
|
|
15
|
+
var Title = /*#__PURE__*/_createClass(
|
|
16
|
+
// eslint-disable-next-line no-useless-constructor
|
|
17
|
+
function Title() {
|
|
18
|
+
_classCallCheck(this, Title);
|
|
19
|
+
_defineProperty(this, "title", '');
|
|
20
|
+
_defineProperty(this, "paneKey", '');
|
|
21
|
+
_defineProperty(this, "disabled", false);
|
|
22
|
+
_defineProperty(this, "index", 0);
|
|
23
|
+
});
|
|
24
|
+
var defaultProps = _objectSpread(_objectSpread({}, ComponentDefaults), {}, {
|
|
25
|
+
tabStyle: {},
|
|
26
|
+
value: 0,
|
|
27
|
+
color: '',
|
|
28
|
+
background: '',
|
|
29
|
+
direction: 'horizontal',
|
|
30
|
+
type: 'line',
|
|
31
|
+
titleScroll: false,
|
|
32
|
+
ellipsis: true,
|
|
33
|
+
animatedTime: 300,
|
|
34
|
+
titleGutter: 0,
|
|
35
|
+
size: 'normal',
|
|
36
|
+
leftAlign: false,
|
|
37
|
+
autoHeight: false
|
|
38
|
+
});
|
|
39
|
+
var pxCheck = function pxCheck(value) {
|
|
40
|
+
return Number.isNaN(Number(value)) ? String(value) : "".concat(value, "px");
|
|
41
|
+
};
|
|
42
|
+
var Tabs = function Tabs(props) {
|
|
43
|
+
var _classNames;
|
|
44
|
+
var _defaultProps$props = _objectSpread(_objectSpread({}, defaultProps), props),
|
|
45
|
+
value = _defaultProps$props.value,
|
|
46
|
+
color = _defaultProps$props.color,
|
|
47
|
+
tabStyle = _defaultProps$props.tabStyle,
|
|
48
|
+
background = _defaultProps$props.background,
|
|
49
|
+
direction = _defaultProps$props.direction,
|
|
50
|
+
type = _defaultProps$props.type,
|
|
51
|
+
titleScroll = _defaultProps$props.titleScroll,
|
|
52
|
+
ellipsis = _defaultProps$props.ellipsis,
|
|
53
|
+
animatedTime = _defaultProps$props.animatedTime,
|
|
54
|
+
titleGutter = _defaultProps$props.titleGutter,
|
|
55
|
+
size = _defaultProps$props.size,
|
|
56
|
+
leftAlign = _defaultProps$props.leftAlign,
|
|
57
|
+
titleNode = _defaultProps$props.titleNode,
|
|
58
|
+
children = _defaultProps$props.children,
|
|
59
|
+
onClick = _defaultProps$props.onClick,
|
|
60
|
+
onChange = _defaultProps$props.onChange,
|
|
61
|
+
className = _defaultProps$props.className,
|
|
62
|
+
autoHeight = _defaultProps$props.autoHeight,
|
|
63
|
+
iconClassPrefix = _defaultProps$props.iconClassPrefix,
|
|
64
|
+
iconFontClassName = _defaultProps$props.iconFontClassName,
|
|
65
|
+
rest = _objectWithoutProperties(_defaultProps$props, _excluded);
|
|
66
|
+
var _useState = useState({
|
|
67
|
+
index: 0
|
|
68
|
+
}),
|
|
69
|
+
_useState2 = _slicedToArray(_useState, 2),
|
|
70
|
+
currentItem = _useState2[0],
|
|
71
|
+
setCurrentItem = _useState2[1];
|
|
72
|
+
var titles = useRef([]);
|
|
73
|
+
useEffect(function () {
|
|
74
|
+
var currentIndex = 0;
|
|
75
|
+
titles.current = [];
|
|
76
|
+
// eslint-disable-next-line consistent-return
|
|
77
|
+
React__default.Children.forEach(children, function (child, idx) {
|
|
78
|
+
if (!React__default.isValidElement(child)) {
|
|
79
|
+
return null;
|
|
80
|
+
}
|
|
81
|
+
var title = new Title();
|
|
82
|
+
var childProps = child === null || child === void 0 ? void 0 : child.props;
|
|
83
|
+
if (childProps !== null && childProps !== void 0 && childProps.title || childProps !== null && childProps !== void 0 && childProps.paneKey) {
|
|
84
|
+
title.title = childProps === null || childProps === void 0 ? void 0 : childProps.title;
|
|
85
|
+
title.paneKey = (childProps === null || childProps === void 0 ? void 0 : childProps.paneKey) || idx;
|
|
86
|
+
title.disabled = childProps === null || childProps === void 0 ? void 0 : childProps.disabled;
|
|
87
|
+
title.index = idx;
|
|
88
|
+
if (title.paneKey === value) {
|
|
89
|
+
currentIndex = idx;
|
|
90
|
+
}
|
|
91
|
+
}
|
|
92
|
+
titles.current.push(title);
|
|
93
|
+
});
|
|
94
|
+
setCurrentItem(titles.current[currentIndex]);
|
|
95
|
+
}, [children]);
|
|
96
|
+
var b = cn('tabs');
|
|
97
|
+
var classes = classNames(direction, b(''), className);
|
|
98
|
+
var classesTitle = classNames((_classNames = {}, _defineProperty(_classNames, type, type), _defineProperty(_classNames, "scrollable", titleScroll), _defineProperty(_classNames, size, size), _classNames), "".concat(b(''), "__titles"));
|
|
99
|
+
var titleStyle = {
|
|
100
|
+
marginLeft: pxCheck(titleGutter),
|
|
101
|
+
marginRight: pxCheck(titleGutter)
|
|
102
|
+
};
|
|
103
|
+
var tabsActiveStyle = {
|
|
104
|
+
color: type === 'smile' ? color : '',
|
|
105
|
+
background: type === 'line' ? color : ''
|
|
106
|
+
};
|
|
107
|
+
var index = titles.current.findIndex(function (t) {
|
|
108
|
+
return t.paneKey === value;
|
|
109
|
+
});
|
|
110
|
+
var contentStyle = {
|
|
111
|
+
transform: direction === 'horizontal' ? "translate3d(-".concat(index * 100, "%, 0, 0)") : "translate3d( 0,-".concat(index * 100, "%, 0)"),
|
|
112
|
+
transitionDuration: "".concat(animatedTime, "ms")
|
|
113
|
+
};
|
|
114
|
+
var tabChange = function tabChange(item, index) {
|
|
115
|
+
onClick && onClick(item);
|
|
116
|
+
if (item.disabled) {
|
|
117
|
+
return;
|
|
118
|
+
}
|
|
119
|
+
setCurrentItem(item);
|
|
120
|
+
onChange && onChange(item);
|
|
121
|
+
};
|
|
122
|
+
return React__default.createElement("div", _objectSpread({
|
|
123
|
+
className: classes
|
|
124
|
+
}, rest), React__default.createElement("div", {
|
|
125
|
+
className: classesTitle,
|
|
126
|
+
style: _objectSpread(_objectSpread({}, tabStyle), {}, {
|
|
127
|
+
background: background
|
|
128
|
+
})
|
|
129
|
+
}, !!titleNode && typeof titleNode === 'function' ? titleNode() : titles.current.map(function (item, index) {
|
|
130
|
+
return React__default.createElement("div", {
|
|
131
|
+
style: titleStyle,
|
|
132
|
+
onClick: function onClick(e) {
|
|
133
|
+
return tabChange(item);
|
|
134
|
+
},
|
|
135
|
+
className: classNames({
|
|
136
|
+
active: !item.disabled && String(item.paneKey) === String(value),
|
|
137
|
+
disabled: item.disabled,
|
|
138
|
+
'nut-tabs__titles-item-left-align': leftAlign
|
|
139
|
+
}, "".concat(b(''), "__titles-item")),
|
|
140
|
+
key: item.paneKey
|
|
141
|
+
}, type === 'line' && React__default.createElement("div", {
|
|
142
|
+
className: "".concat(b(''), "__titles-item__line"),
|
|
143
|
+
style: tabsActiveStyle
|
|
144
|
+
}), type === 'smile' && React__default.createElement("div", {
|
|
145
|
+
className: "".concat(b(''), "__titles-item__smile"),
|
|
146
|
+
style: tabsActiveStyle
|
|
147
|
+
}, React__default.createElement(Icon, {
|
|
148
|
+
classPrefix: iconClassPrefix,
|
|
149
|
+
fontClassName: iconFontClassName,
|
|
150
|
+
color: color,
|
|
151
|
+
name: "joy-smile"
|
|
152
|
+
})), React__default.createElement("div", {
|
|
153
|
+
className: classNames({
|
|
154
|
+
ellipsis: ellipsis && !titleScroll && direction === 'horizontal'
|
|
155
|
+
}, "".concat(b(''), "__titles-item__text"))
|
|
156
|
+
}, item.title));
|
|
157
|
+
})), React__default.createElement("div", {
|
|
158
|
+
className: "".concat(b(''), "__content__wrap")
|
|
159
|
+
}, React__default.createElement("div", {
|
|
160
|
+
className: "".concat(b(''), "__content"),
|
|
161
|
+
style: contentStyle
|
|
162
|
+
}, React__default.Children.map(children, function (child, idx) {
|
|
163
|
+
var _child$props;
|
|
164
|
+
if (!React__default.isValidElement(child)) {
|
|
165
|
+
return null;
|
|
166
|
+
}
|
|
167
|
+
var childProps = _objectSpread(_objectSpread({}, child.props), {}, {
|
|
168
|
+
activeKey: value
|
|
169
|
+
});
|
|
170
|
+
if (String(value) !== String(((_child$props = child.props) === null || _child$props === void 0 ? void 0 : _child$props.paneKey) || idx) && autoHeight) {
|
|
171
|
+
childProps = _objectSpread(_objectSpread({}, childProps), {}, {
|
|
172
|
+
autoHeightClassName: 'inactive'
|
|
173
|
+
});
|
|
174
|
+
}
|
|
175
|
+
return React__default.cloneElement(child, childProps);
|
|
176
|
+
}))));
|
|
177
|
+
};
|
|
178
|
+
Tabs.defaultProps = defaultProps;
|
|
179
|
+
Tabs.displayName = 'NutTabs';
|
|
180
|
+
Tabs.TabPane = TabPane;
|
|
181
|
+
export { Tabs as T };
|
|
@@ -0,0 +1,39 @@
|
|
|
1
|
+
/**
|
|
2
|
+
获取元素的大小及其相对于视口的位置,等价于 Element.getBoundingClientRect。
|
|
3
|
+
width 宽度 number
|
|
4
|
+
height 高度 number
|
|
5
|
+
top 顶部与视图窗口左上角的距离 number
|
|
6
|
+
left 左侧与视图窗口左上角的距离 number
|
|
7
|
+
right 右侧与视图窗口左上角的距离 number
|
|
8
|
+
bottom 底部与视图窗口左上角的距离 number
|
|
9
|
+
*/
|
|
10
|
+
function isWindow(val) {
|
|
11
|
+
return val === window;
|
|
12
|
+
}
|
|
13
|
+
var getRect = function getRect(elementRef) {
|
|
14
|
+
var element = elementRef;
|
|
15
|
+
if (isWindow(element)) {
|
|
16
|
+
var width = element.innerWidth;
|
|
17
|
+
var height = element.innerHeight;
|
|
18
|
+
return {
|
|
19
|
+
top: 0,
|
|
20
|
+
left: 0,
|
|
21
|
+
right: width,
|
|
22
|
+
bottom: height,
|
|
23
|
+
width: width,
|
|
24
|
+
height: height
|
|
25
|
+
};
|
|
26
|
+
}
|
|
27
|
+
if (element && element.getBoundingClientRect) {
|
|
28
|
+
return element.getBoundingClientRect();
|
|
29
|
+
}
|
|
30
|
+
return {
|
|
31
|
+
top: 0,
|
|
32
|
+
left: 0,
|
|
33
|
+
right: 0,
|
|
34
|
+
bottom: 0,
|
|
35
|
+
width: 0,
|
|
36
|
+
height: 0
|
|
37
|
+
};
|
|
38
|
+
};
|
|
39
|
+
export { getRect as g };
|
|
@@ -0,0 +1,99 @@
|
|
|
1
|
+
import _slicedToArray from "@babel/runtime/helpers/slicedToArray";
|
|
2
|
+
import { useState } from 'react';
|
|
3
|
+
var MIN_DISTANCE = 10;
|
|
4
|
+
function getDirection(x, y) {
|
|
5
|
+
if (x > y && x > MIN_DISTANCE) {
|
|
6
|
+
return 'horizontal';
|
|
7
|
+
}
|
|
8
|
+
if (y > x && y > MIN_DISTANCE) {
|
|
9
|
+
return 'vertical';
|
|
10
|
+
}
|
|
11
|
+
return '';
|
|
12
|
+
}
|
|
13
|
+
function useTouch() {
|
|
14
|
+
var _useState = useState(0),
|
|
15
|
+
_useState2 = _slicedToArray(_useState, 2),
|
|
16
|
+
startX = _useState2[0],
|
|
17
|
+
SetStartX = _useState2[1];
|
|
18
|
+
var _useState3 = useState(0),
|
|
19
|
+
_useState4 = _slicedToArray(_useState3, 2),
|
|
20
|
+
startY = _useState4[0],
|
|
21
|
+
SetStartY = _useState4[1];
|
|
22
|
+
var _useState5 = useState(0),
|
|
23
|
+
_useState6 = _slicedToArray(_useState5, 2),
|
|
24
|
+
moveX = _useState6[0],
|
|
25
|
+
SetMoveX = _useState6[1];
|
|
26
|
+
var _useState7 = useState(0),
|
|
27
|
+
_useState8 = _slicedToArray(_useState7, 2),
|
|
28
|
+
moveY = _useState8[0],
|
|
29
|
+
SetMoveY = _useState8[1];
|
|
30
|
+
var _useState9 = useState(0),
|
|
31
|
+
_useState10 = _slicedToArray(_useState9, 2),
|
|
32
|
+
deltaX = _useState10[0],
|
|
33
|
+
SetDeltaX = _useState10[1];
|
|
34
|
+
var _useState11 = useState(0),
|
|
35
|
+
_useState12 = _slicedToArray(_useState11, 2),
|
|
36
|
+
deltaY = _useState12[0],
|
|
37
|
+
SetDeltaY = _useState12[1];
|
|
38
|
+
var _useState13 = useState(0),
|
|
39
|
+
_useState14 = _slicedToArray(_useState13, 2),
|
|
40
|
+
offsetX = _useState14[0],
|
|
41
|
+
SetOffsetX = _useState14[1];
|
|
42
|
+
var _useState15 = useState(0),
|
|
43
|
+
_useState16 = _slicedToArray(_useState15, 2),
|
|
44
|
+
offsetY = _useState16[0],
|
|
45
|
+
SetOffsetY = _useState16[1];
|
|
46
|
+
var _useState17 = useState(''),
|
|
47
|
+
_useState18 = _slicedToArray(_useState17, 2),
|
|
48
|
+
direction = _useState18[0],
|
|
49
|
+
SetDirection = _useState18[1];
|
|
50
|
+
var isVertical = function isVertical() {
|
|
51
|
+
return direction === 'vertical';
|
|
52
|
+
};
|
|
53
|
+
var isHorizontal = function isHorizontal() {
|
|
54
|
+
return direction === 'horizontal';
|
|
55
|
+
};
|
|
56
|
+
var reset = function reset() {
|
|
57
|
+
SetDeltaX(0);
|
|
58
|
+
SetDeltaY(0);
|
|
59
|
+
SetOffsetX(0);
|
|
60
|
+
SetOffsetY(0);
|
|
61
|
+
SetDirection('');
|
|
62
|
+
};
|
|
63
|
+
var start = function start(event) {
|
|
64
|
+
reset();
|
|
65
|
+
SetStartX(event.touches[0].clientX);
|
|
66
|
+
SetStartY(event.touches[0].clientY);
|
|
67
|
+
};
|
|
68
|
+
var move = function move(event) {
|
|
69
|
+
var touch = event.touches[0];
|
|
70
|
+
var dX = touch.clientX - startX;
|
|
71
|
+
var dY = touch.clientY - startY;
|
|
72
|
+
SetDeltaX(dX);
|
|
73
|
+
SetDeltaY(dY);
|
|
74
|
+
SetMoveX(touch.clientX);
|
|
75
|
+
SetMoveY(touch.clientY);
|
|
76
|
+
SetOffsetX(Math.abs(dX));
|
|
77
|
+
SetOffsetY(Math.abs(dY));
|
|
78
|
+
if (!direction) {
|
|
79
|
+
SetDirection(getDirection(offsetX, offsetY));
|
|
80
|
+
}
|
|
81
|
+
};
|
|
82
|
+
return {
|
|
83
|
+
move: move,
|
|
84
|
+
start: start,
|
|
85
|
+
reset: reset,
|
|
86
|
+
startX: startX,
|
|
87
|
+
startY: startY,
|
|
88
|
+
moveX: moveX,
|
|
89
|
+
moveY: moveY,
|
|
90
|
+
deltaX: deltaX,
|
|
91
|
+
deltaY: deltaY,
|
|
92
|
+
offsetX: offsetX,
|
|
93
|
+
offsetY: offsetY,
|
|
94
|
+
direction: direction,
|
|
95
|
+
isVertical: isVertical,
|
|
96
|
+
isHorizontal: isHorizontal
|
|
97
|
+
};
|
|
98
|
+
}
|
|
99
|
+
export { useTouch as u };
|
|
@@ -0,0 +1,129 @@
|
|
|
1
|
+
export interface BaseLang {
|
|
2
|
+
save: string;
|
|
3
|
+
confirm: string;
|
|
4
|
+
cancel: string;
|
|
5
|
+
done: string;
|
|
6
|
+
noData: string;
|
|
7
|
+
placeholder: string;
|
|
8
|
+
select: string;
|
|
9
|
+
video: {
|
|
10
|
+
errorTip: string;
|
|
11
|
+
clickRetry: string;
|
|
12
|
+
};
|
|
13
|
+
fixednav: {
|
|
14
|
+
activeText: string;
|
|
15
|
+
unActiveText: string;
|
|
16
|
+
};
|
|
17
|
+
infiniteloading: {
|
|
18
|
+
pullRefreshText: string;
|
|
19
|
+
loadText: string;
|
|
20
|
+
loadMoreText: string;
|
|
21
|
+
};
|
|
22
|
+
pagination: {
|
|
23
|
+
prev: string;
|
|
24
|
+
next: string;
|
|
25
|
+
};
|
|
26
|
+
range: {
|
|
27
|
+
rangeText: string;
|
|
28
|
+
};
|
|
29
|
+
calendaritem: {
|
|
30
|
+
weekdays: Array<string>;
|
|
31
|
+
end: string;
|
|
32
|
+
start: string;
|
|
33
|
+
confirm: string;
|
|
34
|
+
title: string;
|
|
35
|
+
monthTitle: Function;
|
|
36
|
+
today: string;
|
|
37
|
+
loadPreviousMonth: string;
|
|
38
|
+
noEarlierMonth: string;
|
|
39
|
+
};
|
|
40
|
+
shortpassword: {
|
|
41
|
+
title: string;
|
|
42
|
+
desc: string;
|
|
43
|
+
tips: string;
|
|
44
|
+
};
|
|
45
|
+
uploader: {
|
|
46
|
+
ready: string;
|
|
47
|
+
readyUpload: string;
|
|
48
|
+
waitingUpload: string;
|
|
49
|
+
uploading: string;
|
|
50
|
+
success: string;
|
|
51
|
+
error: string;
|
|
52
|
+
deleteWord: string;
|
|
53
|
+
};
|
|
54
|
+
countdown: {
|
|
55
|
+
day: string;
|
|
56
|
+
hour: string;
|
|
57
|
+
minute: string;
|
|
58
|
+
second: string;
|
|
59
|
+
};
|
|
60
|
+
address: {
|
|
61
|
+
selectRegion: string;
|
|
62
|
+
deliveryTo: string;
|
|
63
|
+
chooseAnotherAddress: string;
|
|
64
|
+
};
|
|
65
|
+
signature: {
|
|
66
|
+
reSign: string;
|
|
67
|
+
unSupportTpl: string;
|
|
68
|
+
};
|
|
69
|
+
ecard: {
|
|
70
|
+
chooseText: string;
|
|
71
|
+
otherValueText: string;
|
|
72
|
+
placeholder: string;
|
|
73
|
+
};
|
|
74
|
+
timeselect: {
|
|
75
|
+
pickupTime: string;
|
|
76
|
+
};
|
|
77
|
+
sku: {
|
|
78
|
+
buyNow: string;
|
|
79
|
+
buyNumber: string;
|
|
80
|
+
addToCard: string;
|
|
81
|
+
};
|
|
82
|
+
skuheader: {
|
|
83
|
+
skuId: string;
|
|
84
|
+
};
|
|
85
|
+
addresslist: {
|
|
86
|
+
addAddress: string;
|
|
87
|
+
};
|
|
88
|
+
comment: {
|
|
89
|
+
complaintsText: string;
|
|
90
|
+
additionalReview: Function;
|
|
91
|
+
additionalImages: Function;
|
|
92
|
+
};
|
|
93
|
+
searchbar: {
|
|
94
|
+
basePlaceholder: string;
|
|
95
|
+
text: string;
|
|
96
|
+
test: string;
|
|
97
|
+
title1: string;
|
|
98
|
+
title2: string;
|
|
99
|
+
title3: string;
|
|
100
|
+
title4: string;
|
|
101
|
+
title5: string;
|
|
102
|
+
title6: string;
|
|
103
|
+
};
|
|
104
|
+
audio: {
|
|
105
|
+
back: string;
|
|
106
|
+
forward: string;
|
|
107
|
+
pause: string;
|
|
108
|
+
start: string;
|
|
109
|
+
mute: string;
|
|
110
|
+
tips: string;
|
|
111
|
+
};
|
|
112
|
+
datepicker: {
|
|
113
|
+
year: string;
|
|
114
|
+
month: string;
|
|
115
|
+
day: string;
|
|
116
|
+
hour: string;
|
|
117
|
+
min: string;
|
|
118
|
+
seconds: string;
|
|
119
|
+
};
|
|
120
|
+
pullToRefresh: {
|
|
121
|
+
pullingText: string;
|
|
122
|
+
canReleaseText: string;
|
|
123
|
+
refreshingText: string;
|
|
124
|
+
completeText: string;
|
|
125
|
+
};
|
|
126
|
+
watermark: {
|
|
127
|
+
errorCanvasTips: string;
|
|
128
|
+
};
|
|
129
|
+
}
|