@nutui/nutui-react-taro 1.5.2-beta.1 → 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.js +90 -14
- package/dist/esm/Address.js +620 -21
- package/dist/esm/Animate.js +53 -7
- package/dist/esm/AnimatingNumbers.js +125 -7
- package/dist/esm/Audio.js +264 -19
- package/dist/esm/Avatar.js +130 -11
- package/dist/esm/{AvatarContext-c96afdcc.js → AvatarContext-15733596.js} +1 -3
- package/dist/esm/AvatarGroup.js +41 -11
- package/dist/esm/BackTop.js +138 -10
- package/dist/esm/Badge.js +71 -9
- package/dist/esm/Barrage.js +97 -8
- package/dist/esm/Button.js +108 -9
- package/dist/esm/Calendar.js +128 -20
- package/dist/esm/CalendarItem.js +674 -12
- package/dist/esm/Card.js +61 -11
- package/dist/esm/Cascader.js +671 -16
- package/dist/esm/Cell.js +101 -9
- package/dist/esm/CellGroup.js +2 -5
- package/dist/esm/Checkbox.js +5 -7
- package/dist/esm/CheckboxGroup.js +111 -8
- package/dist/esm/CircleProgress.js +114 -8
- package/dist/esm/Col.js +57 -7
- package/dist/esm/Collapse.js +97 -7
- package/dist/esm/CollapseItem.js +146 -8
- package/dist/esm/ConfigProvider.js +187 -8
- package/dist/esm/CountDown.js +247 -9
- package/dist/esm/DatePicker.js +309 -25
- package/dist/esm/Dialog.js +296 -17
- package/dist/esm/Divider.js +34 -7
- package/dist/esm/Drag.js +118 -7
- package/dist/esm/Elevator.js +234 -8
- package/dist/esm/Ellipsis.js +176 -10
- package/dist/esm/Empty.js +79 -8
- package/dist/esm/FixedNav.js +103 -14
- package/dist/esm/Form.js +215 -10
- package/dist/esm/FormItem.js +3 -10
- package/dist/esm/Grid.js +81 -11
- package/dist/esm/GridItem.js +123 -13
- package/dist/esm/Icon.js +2 -5
- package/dist/esm/Image.js +169 -11
- package/dist/esm/ImagePreview.js +225 -19
- package/dist/esm/Indicator.js +50 -7
- package/dist/esm/Infiniteloading.js +215 -14
- package/dist/esm/Input.js +362 -12
- package/dist/esm/InputNumber.js +275 -9
- package/dist/esm/Layout.js +13 -5
- package/dist/esm/Menu.js +153 -10
- package/dist/esm/MenuItem.js +175 -15
- package/dist/esm/NavBar.js +114 -9
- package/dist/esm/NoticeBar.js +568 -10
- package/dist/esm/Notify.js +234 -8
- package/dist/esm/NumberKeyboard.js +247 -17
- package/dist/esm/Overlay.js +2 -6
- package/dist/esm/Pagination.js +168 -9
- package/dist/esm/Picker.js +494 -22
- package/dist/esm/Popover.js +223 -12
- package/dist/esm/Popup.js +193 -13
- package/dist/esm/Price.js +84 -6
- package/dist/esm/Progress.js +122 -9
- package/dist/esm/PullToRefresh.js +276 -13
- package/dist/esm/Radio.js +4 -8
- package/dist/esm/RadioGroup.js +120 -7
- package/dist/esm/Range.js +406 -15
- package/dist/esm/Rate.js +121 -9
- package/dist/esm/Row.js +49 -7
- package/dist/esm/SearchBar.js +235 -12
- package/dist/esm/ShortPassword.js +191 -17
- package/dist/esm/SideNavBar.js +57 -19
- package/dist/esm/SideNavBarItem.js +24 -5
- package/dist/esm/Signature.js +153 -13
- package/dist/esm/Skeleton.js +98 -12
- package/dist/esm/Step.js +87 -10
- package/dist/esm/Steps.js +38 -8
- package/dist/esm/Sticky.js +190 -11
- package/dist/esm/SubSideNavBar.js +78 -6
- package/dist/esm/Swipe.js +230 -10
- package/dist/esm/Swiper.js +490 -9
- package/dist/esm/SwiperItem.js +36 -8
- package/dist/esm/Switch.js +71 -6
- package/dist/esm/TabPane.js +2 -5
- package/dist/esm/Tabbar.js +68 -6
- package/dist/esm/TabbarItem.js +78 -9
- package/dist/esm/Table.js +140 -12
- package/dist/esm/Tabs.js +5 -8
- package/dist/esm/Tag.js +110 -10
- package/dist/esm/TextArea.js +148 -9
- package/dist/esm/TimeDetail.js +67 -9
- package/dist/esm/TimePannel.js +29 -9
- package/dist/esm/TimeSelect.js +171 -19
- package/dist/esm/Toast.js +268 -7
- package/dist/esm/TrendArrow.js +99 -7
- package/dist/esm/Uploader.js +566 -17
- package/dist/esm/{UserContext-0aac9a82.js → UserContext-101ad4a4.js} +1 -3
- package/dist/esm/{UserContext-e402e1a6.js → UserContext-2629d479.js} +1 -3
- package/dist/esm/{UserContext-e8176108.js → UserContext-b33bcf21.js} +1 -3
- package/dist/esm/Video.js +90 -7
- package/dist/esm/VirtualList.js +313 -9
- package/dist/esm/WaterMark.js +111 -11
- package/dist/esm/{bem-350c1702.js → bem-3b438e61.js} +6 -3
- 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.taro.context-c2bbfb4f.js → grid.context-2ee27d95.js} +2 -4
- package/dist/esm/icon-4ef1581c.js +70 -0
- package/dist/esm/index-030b7245.js +11 -0
- package/dist/esm/nutui-react.es.js +94 -119
- 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.js +1 -1
- package/dist/locales/en-US.js +1 -1
- package/dist/locales/id-ID.js +1 -1
- package/dist/locales/zh-CN.js +1 -1
- package/dist/locales/zh-TW.js +1 -1
- package/dist/locales/zh-UG.js +1 -1
- package/dist/nutui.react.mjs +15025 -13192
- package/dist/nutui.react.umd.js +15004 -13169
- package/dist/style.mjs +1 -1
- package/dist/types/index.d.ts +183 -176
- package/package.json +1 -1
- package/dist/esm/actionsheet.taro-e6a51446.js +0 -53
- package/dist/esm/address.taro-3a9b6396.js +0 -461
- package/dist/esm/animate.taro-fb7986d6.js +0 -40
- package/dist/esm/animatingnumbers.taro-03e5d61d.js +0 -104
- package/dist/esm/audio.taro-87ec8bf2.js +0 -161
- package/dist/esm/avatar.taro-3676f38f.js +0 -103
- package/dist/esm/avatargroup-f3574510.js +0 -34
- package/dist/esm/backtop.taro-66394a36.js +0 -48
- package/dist/esm/badge.taro-a4e59c11.js +0 -52
- package/dist/esm/barrage.taro-0495a1b2.js +0 -94
- package/dist/esm/button.taro-9244d065.js +0 -100
- package/dist/esm/calendar.taro-670842ea.js +0 -65
- package/dist/esm/calendaritem.taro-2a603571.js +0 -787
- package/dist/esm/can-use-dom-3eeb5af4.js +0 -6
- package/dist/esm/card.taro-e4c76dad.js +0 -33
- package/dist/esm/cascader.taro-eb1fb011.js +0 -438
- package/dist/esm/cell.taro-a10a74d3.js +0 -64
- package/dist/esm/cellgroup.taro-abe501bc.js +0 -25
- package/dist/esm/checkbox.taro-6120e3e3.js +0 -171
- package/dist/esm/circleprogress.taro-79854448.js +0 -109
- package/dist/esm/col.taro-53eed3cc.js +0 -41
- package/dist/esm/collapse.taro-1a9e4ba2.js +0 -83
- package/dist/esm/collapseitem-4d0bc55d.js +0 -83
- package/dist/esm/configprovider-67d19d3a.js +0 -19
- package/dist/esm/configprovider.taro-8d71eb49.js +0 -42
- package/dist/esm/countdown.taro-5b17c607.js +0 -226
- package/dist/esm/datepicker.taro-6e9b4b8f.js +0 -275
- package/dist/esm/dialog.taro-a3267d29.js +0 -118
- package/dist/esm/divider.taro-26d1d8b4.js +0 -35
- package/dist/esm/drag.taro-79bb8744.js +0 -110
- package/dist/esm/elevator.taro-6019669e.js +0 -178
- package/dist/esm/ellipsis.taro-f15f26da.js +0 -241
- package/dist/esm/empty.taro-04ae4389.js +0 -62
- package/dist/esm/fixednav.taro-1f05acaf.js +0 -53
- package/dist/esm/form.taro-0c8e7a39.js +0 -179
- package/dist/esm/formitem.taro-190a3326.js +0 -89
- package/dist/esm/get-scroll-parent-b4a07e65.js +0 -25
- package/dist/esm/grid.taro-3503b82c.js +0 -61
- package/dist/esm/griditem.taro-cdb3f119.js +0 -98
- package/dist/esm/icon-296a1bec.js +0 -63
- package/dist/esm/icon.taro-296a1bec.js +0 -63
- package/dist/esm/image.taro-142cf512.js +0 -64
- package/dist/esm/imagepreview.taro-c50bb0a3.js +0 -167
- package/dist/esm/index-5bcb0ff8.js +0 -7
- package/dist/esm/indicator.taro-cba8b010.js +0 -37
- package/dist/esm/infiniteloading.taro-183bccbf.js +0 -144
- package/dist/esm/input.taro-97af6c96.js +0 -240
- package/dist/esm/inputnumber.taro-91f65d17.js +0 -130
- package/dist/esm/layout.taro-9046d093.js +0 -11
- package/dist/esm/menu.taro-7e4038a1.js +0 -99
- package/dist/esm/menuitem.taro-96cc4f15.js +0 -130
- package/dist/esm/navbar.taro-777c4705.js +0 -79
- package/dist/esm/noticebar.taro-4a23cdee.js +0 -448
- package/dist/esm/notify.taro-e17c6f82.js +0 -75
- package/dist/esm/numberkeyboard.taro-1bc24744.js +0 -159
- package/dist/esm/offsetContext-c2a746fa.js +0 -5
- package/dist/esm/overlay.taro-21e87fb1.js +0 -69
- package/dist/esm/pagination.taro-715a173b.js +0 -124
- package/dist/esm/picker.taro-9ad1b7c5.js +0 -473
- package/dist/esm/popover.taro-ad5e76ea.js +0 -156
- package/dist/esm/popup.taro-01676bff.js +0 -137
- package/dist/esm/price.taro-776ed16e.js +0 -83
- package/dist/esm/progress.taro-f0ce38e9.js +0 -90
- package/dist/esm/pulltorefresh.taro-a294f656.js +0 -181
- package/dist/esm/radio.taro-a6eff96c.js +0 -168
- package/dist/esm/range.taro-d8fc7656.js +0 -332
- package/dist/esm/rate.taro-6cdf03bd.js +0 -75
- package/dist/esm/row.taro-f64d4a13.js +0 -46
- package/dist/esm/searchbar.taro-0c25927b.js +0 -152
- package/dist/esm/shortpassword.taro-9ee034f7.js +0 -111
- package/dist/esm/sidenavbar.taro-c307b35e.js +0 -35
- package/dist/esm/sidenavbaritem.taro-5a7965d0.js +0 -12
- package/dist/esm/signature.taro-ec4e713b.js +0 -143
- package/dist/esm/skeleton.taro-76faf63f.js +0 -62
- package/dist/esm/step.taro-b7903e8c.js +0 -59
- package/dist/esm/steps.taro-c82d2252.js +0 -30
- package/dist/esm/sticky.taro-218bda37.js +0 -138
- package/dist/esm/subsidenavbar.taro-69cb9752.js +0 -63
- package/dist/esm/supports-passive-c85ef996.js +0 -18
- package/dist/esm/swipe.taro-ea35f07f.js +0 -177
- package/dist/esm/swiper.taro-7a94e211.js +0 -451
- package/dist/esm/swiperitem-c9e3d0d5.js +0 -29
- package/dist/esm/switch.taro-34ca8228.js +0 -50
- package/dist/esm/tabbar.taro-9acfc2fa.js +0 -59
- package/dist/esm/tabbaritem.taro-bf517487.js +0 -58
- package/dist/esm/table.taro-91fc0c01.js +0 -93
- package/dist/esm/tabpane.taro-4ca340ef.js +0 -23
- package/dist/esm/tabs.taro-6a7524a4.js +0 -140
- package/dist/esm/tag.taro-23ba0834.js +0 -92
- package/dist/esm/textarea.taro-442e7350.js +0 -94
- package/dist/esm/timedetail.taro-5b2f2269.js +0 -44
- package/dist/esm/timepannel.taro-d6e40180.js +0 -22
- package/dist/esm/timeselect.taro-a07036f4.js +0 -133
- package/dist/esm/toast.taro-d6c14811.js +0 -109
- package/dist/esm/trendarrow.taro-b8c5ccd9.js +0 -73
- package/dist/esm/typings-b9828dba.js +0 -9
- package/dist/esm/uploader.taro-587e6bf3.js +0 -492
- package/dist/esm/useClientRect-1f8ed1fe.js +0 -18
- package/dist/esm/useTouch-db24bb5c.js +0 -69
- package/dist/esm/video-f1be8a91.js +0 -67
- package/dist/esm/virtuallist.taro-f0b0270d.js +0 -214
- package/dist/esm/watermark.taro-9ce2ae37.js +0 -114
- package/dist/esm/zh-CN-c779e6c1.js +0 -131
package/dist/esm/AvatarGroup.js
CHANGED
|
@@ -1,13 +1,43 @@
|
|
|
1
|
-
import
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
import '
|
|
5
|
-
import '
|
|
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, { useRef } from 'react';
|
|
5
|
+
import classNames from 'classnames';
|
|
6
|
+
import { A as AvatarContext } from './AvatarContext-15733596.js';
|
|
7
|
+
import { c as cn } from './bem-3b438e61.js';
|
|
8
|
+
import { useConfig } from './ConfigProvider.js';
|
|
6
9
|
import '@bem-react/classname';
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
10
|
+
var defaultProps = {
|
|
11
|
+
maxContent: '',
|
|
12
|
+
maxCount: '',
|
|
13
|
+
maxBgColor: '#eee',
|
|
14
|
+
maxColor: '#666',
|
|
15
|
+
size: '',
|
|
16
|
+
shape: '',
|
|
17
|
+
span: '-8',
|
|
18
|
+
zIndex: 'left'
|
|
19
|
+
};
|
|
20
|
+
var AvatarGroup = function AvatarGroup(props) {
|
|
21
|
+
useConfig();
|
|
22
|
+
var propAvatarGroup = _objectSpread(_objectSpread({}, defaultProps), props);
|
|
23
|
+
var className = propAvatarGroup.className,
|
|
24
|
+
style = propAvatarGroup.style,
|
|
25
|
+
children = propAvatarGroup.children;
|
|
26
|
+
var avatarGroupRef = useRef(null);
|
|
27
|
+
var b = cn('avatar-group');
|
|
28
|
+
var cls = classNames(b(''), className);
|
|
29
|
+
var parentAvatar = {
|
|
30
|
+
propAvatarGroup: propAvatarGroup,
|
|
31
|
+
avatarGroupRef: avatarGroupRef
|
|
32
|
+
};
|
|
33
|
+
return React__default.createElement(AvatarContext.Provider, {
|
|
34
|
+
value: parentAvatar
|
|
35
|
+
}, React__default.createElement("div", {
|
|
36
|
+
className: cls,
|
|
37
|
+
style: style,
|
|
38
|
+
ref: avatarGroupRef
|
|
39
|
+
}, children));
|
|
40
|
+
};
|
|
41
|
+
AvatarGroup.defaultProps = defaultProps;
|
|
42
|
+
AvatarGroup.displayName = 'NutAvatarGroup';
|
|
13
43
|
export { AvatarGroup as default };
|
package/dist/esm/BackTop.js
CHANGED
|
@@ -1,11 +1,139 @@
|
|
|
1
|
-
import
|
|
2
|
-
import
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
import '
|
|
6
|
-
import '
|
|
7
|
-
import './typings-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
1
|
+
import _slicedToArray from "@babel/runtime/helpers/slicedToArray";
|
|
2
|
+
import _defineProperty from "@babel/runtime/helpers/defineProperty";
|
|
3
|
+
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; }
|
|
4
|
+
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; }
|
|
5
|
+
import React__default, { useState, useRef, useEffect } from 'react';
|
|
6
|
+
import Icon from './Icon.js';
|
|
7
|
+
import { C as ComponentDefaults } from './typings-f27b58f4.js';
|
|
8
|
+
var defaultProps = _objectSpread(_objectSpread({}, ComponentDefaults), {}, {
|
|
9
|
+
bottom: 20,
|
|
10
|
+
right: 10,
|
|
11
|
+
elId: 'body',
|
|
12
|
+
distance: 200,
|
|
13
|
+
zIndex: 10,
|
|
14
|
+
isAnimation: true,
|
|
15
|
+
duration: 1000
|
|
16
|
+
});
|
|
17
|
+
var BackTop = function BackTop(props) {
|
|
18
|
+
var _defaultProps$props = _objectSpread(_objectSpread({}, defaultProps), props),
|
|
19
|
+
children = _defaultProps$props.children,
|
|
20
|
+
bottom = _defaultProps$props.bottom,
|
|
21
|
+
right = _defaultProps$props.right,
|
|
22
|
+
elId = _defaultProps$props.elId,
|
|
23
|
+
distance = _defaultProps$props.distance,
|
|
24
|
+
zIndex = _defaultProps$props.zIndex,
|
|
25
|
+
isAnimation = _defaultProps$props.isAnimation,
|
|
26
|
+
className = _defaultProps$props.className,
|
|
27
|
+
duration = _defaultProps$props.duration,
|
|
28
|
+
style = _defaultProps$props.style,
|
|
29
|
+
onClick = _defaultProps$props.onClick,
|
|
30
|
+
iconClassPrefix = _defaultProps$props.iconClassPrefix,
|
|
31
|
+
iconFontClassName = _defaultProps$props.iconFontClassName;
|
|
32
|
+
var _useState = useState(false),
|
|
33
|
+
_useState2 = _slicedToArray(_useState, 2),
|
|
34
|
+
backTop = _useState2[0],
|
|
35
|
+
SetBackTop = _useState2[1];
|
|
36
|
+
var _useState3 = useState(0),
|
|
37
|
+
_useState4 = _slicedToArray(_useState3, 2),
|
|
38
|
+
scrollTop = _useState4[0],
|
|
39
|
+
SetScrollTop = _useState4[1];
|
|
40
|
+
var startTime = 0;
|
|
41
|
+
var scrollEl = useRef(null);
|
|
42
|
+
// 初始化
|
|
43
|
+
useEffect(function () {
|
|
44
|
+
init();
|
|
45
|
+
return function () {
|
|
46
|
+
return removeEventListener();
|
|
47
|
+
};
|
|
48
|
+
}, []);
|
|
49
|
+
var init = function init() {
|
|
50
|
+
if (elId && document.getElementById(elId)) {
|
|
51
|
+
scrollEl.current = document.getElementById(elId);
|
|
52
|
+
} else {
|
|
53
|
+
scrollEl.current = window;
|
|
54
|
+
}
|
|
55
|
+
addEventListener();
|
|
56
|
+
initCancelAniFrame();
|
|
57
|
+
};
|
|
58
|
+
var scrollListener = function scrollListener() {
|
|
59
|
+
var top = null;
|
|
60
|
+
if (scrollEl.current instanceof Window) {
|
|
61
|
+
top = scrollEl.current.pageYOffset;
|
|
62
|
+
SetScrollTop(top);
|
|
63
|
+
} else {
|
|
64
|
+
top = scrollEl.current.scrollTop;
|
|
65
|
+
SetScrollTop(top);
|
|
66
|
+
}
|
|
67
|
+
var showBtn = top >= distance;
|
|
68
|
+
SetBackTop(showBtn);
|
|
69
|
+
};
|
|
70
|
+
var scroll = function scroll() {
|
|
71
|
+
var y = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : 0;
|
|
72
|
+
if (scrollEl.current instanceof Window) {
|
|
73
|
+
window.scrollTo(0, y);
|
|
74
|
+
} else {
|
|
75
|
+
scrollEl.current.scrollTop = y;
|
|
76
|
+
window.scrollTo(0, y);
|
|
77
|
+
}
|
|
78
|
+
};
|
|
79
|
+
var scrollAnimation = function scrollAnimation() {
|
|
80
|
+
var cid = requestAniFrame()(function fn() {
|
|
81
|
+
var t = duration - Math.max(0, startTime - +new Date() + duration / 2);
|
|
82
|
+
var y = t * -scrollTop / duration + scrollTop;
|
|
83
|
+
scroll(y);
|
|
84
|
+
cid = requestAniFrame()(fn);
|
|
85
|
+
if (t === duration || y === 0) {
|
|
86
|
+
window.cancelAnimationFrame(cid);
|
|
87
|
+
}
|
|
88
|
+
});
|
|
89
|
+
};
|
|
90
|
+
var initCancelAniFrame = function initCancelAniFrame() {
|
|
91
|
+
window.cancelAnimationFrame = window.webkitCancelAnimationFrame;
|
|
92
|
+
};
|
|
93
|
+
// 防频
|
|
94
|
+
var requestAniFrame = function requestAniFrame() {
|
|
95
|
+
return window.requestAnimationFrame || window.webkitRequestAnimationFrame || window.mozRequestAnimationFrame || function (callback) {
|
|
96
|
+
window.setTimeout(callback, 1000 / 60);
|
|
97
|
+
};
|
|
98
|
+
};
|
|
99
|
+
// 监听事件
|
|
100
|
+
function addEventListener() {
|
|
101
|
+
var _scrollEl$current, _scrollEl$current2;
|
|
102
|
+
(_scrollEl$current = scrollEl.current) === null || _scrollEl$current === void 0 ? void 0 : _scrollEl$current.addEventListener('scroll', scrollListener, false);
|
|
103
|
+
(_scrollEl$current2 = scrollEl.current) === null || _scrollEl$current2 === void 0 ? void 0 : _scrollEl$current2.addEventListener('resize', scrollListener, false);
|
|
104
|
+
}
|
|
105
|
+
// 移除监听事件
|
|
106
|
+
function removeEventListener() {
|
|
107
|
+
var _scrollEl$current3, _scrollEl$current4;
|
|
108
|
+
(_scrollEl$current3 = scrollEl.current) === null || _scrollEl$current3 === void 0 ? void 0 : _scrollEl$current3.removeEventListener('scroll', scrollListener, false);
|
|
109
|
+
(_scrollEl$current4 = scrollEl.current) === null || _scrollEl$current4 === void 0 ? void 0 : _scrollEl$current4.removeEventListener('resize', scrollListener, false);
|
|
110
|
+
}
|
|
111
|
+
// 返回顶部点击事件
|
|
112
|
+
var goTop = function goTop(e) {
|
|
113
|
+
onClick && onClick(e);
|
|
114
|
+
var otime = +new Date();
|
|
115
|
+
startTime = otime;
|
|
116
|
+
isAnimation && duration > 0 ? scrollAnimation() : scroll();
|
|
117
|
+
};
|
|
118
|
+
var backTopClass = {
|
|
119
|
+
right: "".concat(right, "px"),
|
|
120
|
+
bottom: "".concat(bottom, "px"),
|
|
121
|
+
zIndex: zIndex
|
|
122
|
+
};
|
|
123
|
+
return React__default.createElement("div", {
|
|
124
|
+
className: "nut-backtop ".concat(backTop ? 'show' : '', " ").concat(className || ''),
|
|
125
|
+
style: _objectSpread(_objectSpread({}, backTopClass), style),
|
|
126
|
+
onClick: function onClick(e) {
|
|
127
|
+
goTop(e);
|
|
128
|
+
}
|
|
129
|
+
}, children || React__default.createElement(Icon, {
|
|
130
|
+
classPrefix: iconClassPrefix,
|
|
131
|
+
fontClassName: iconFontClassName,
|
|
132
|
+
size: "19px",
|
|
133
|
+
className: "nut-backtop-main",
|
|
134
|
+
name: "top"
|
|
135
|
+
}));
|
|
136
|
+
};
|
|
137
|
+
BackTop.defaultProps = defaultProps;
|
|
138
|
+
BackTop.displayName = 'NutBackTop';
|
|
11
139
|
export { BackTop as default };
|
package/dist/esm/Badge.js
CHANGED
|
@@ -1,11 +1,73 @@
|
|
|
1
|
-
import
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
import '
|
|
5
|
-
import '
|
|
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 Icon from './Icon.js';
|
|
7
|
+
import { c as cn } from './bem-3b438e61.js';
|
|
8
|
+
import { C as ComponentDefaults } from './typings-f27b58f4.js';
|
|
6
9
|
import '@bem-react/classname';
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
10
|
+
var defaultProps = _objectSpread(_objectSpread({}, ComponentDefaults), {}, {
|
|
11
|
+
className: '',
|
|
12
|
+
value: '',
|
|
13
|
+
dot: false,
|
|
14
|
+
max: 10000,
|
|
15
|
+
top: '0',
|
|
16
|
+
right: '0',
|
|
17
|
+
zIndex: '0',
|
|
18
|
+
color: '',
|
|
19
|
+
icons: ''
|
|
20
|
+
});
|
|
21
|
+
var b = cn('badge');
|
|
22
|
+
var Badge = function Badge(props) {
|
|
23
|
+
var _defaultProps$props = _objectSpread(_objectSpread({}, defaultProps), props),
|
|
24
|
+
className = _defaultProps$props.className,
|
|
25
|
+
style = _defaultProps$props.style,
|
|
26
|
+
children = _defaultProps$props.children,
|
|
27
|
+
dot = _defaultProps$props.dot,
|
|
28
|
+
top = _defaultProps$props.top,
|
|
29
|
+
right = _defaultProps$props.right,
|
|
30
|
+
zIndex = _defaultProps$props.zIndex,
|
|
31
|
+
color = _defaultProps$props.color,
|
|
32
|
+
icons = _defaultProps$props.icons,
|
|
33
|
+
iconClassPrefix = _defaultProps$props.iconClassPrefix,
|
|
34
|
+
iconFontClassName = _defaultProps$props.iconFontClassName;
|
|
35
|
+
function content() {
|
|
36
|
+
if (dot) return undefined;
|
|
37
|
+
var value = props.value;
|
|
38
|
+
var max = props.max;
|
|
39
|
+
if (typeof value === 'number' && typeof max === 'number') {
|
|
40
|
+
return max < value ? "".concat(max, "+") : value;
|
|
41
|
+
}
|
|
42
|
+
return value;
|
|
43
|
+
}
|
|
44
|
+
var getStyle = function getStyle() {
|
|
45
|
+
var style = {};
|
|
46
|
+
style.top = "".concat(Number(top) || parseFloat(top) || 0, "px");
|
|
47
|
+
style.right = "".concat(Number(right) || parseFloat(right) || 0, "px");
|
|
48
|
+
style.zIndex = zIndex;
|
|
49
|
+
style.background = color;
|
|
50
|
+
return style;
|
|
51
|
+
};
|
|
52
|
+
return React__default.createElement("div", {
|
|
53
|
+
className: classNames(b(), className),
|
|
54
|
+
style: style
|
|
55
|
+
}, icons !== '' && React__default.createElement("div", {
|
|
56
|
+
className: "slot-icons"
|
|
57
|
+
}, React__default.createElement(Icon, {
|
|
58
|
+
classPrefix: iconClassPrefix,
|
|
59
|
+
fontClassName: iconFontClassName,
|
|
60
|
+
className: "_icon",
|
|
61
|
+
name: icons,
|
|
62
|
+
color: "#ffffff",
|
|
63
|
+
size: "12"
|
|
64
|
+
})), React__default.createElement("div", null, children), React__default.createElement("div", {
|
|
65
|
+
className: classNames({
|
|
66
|
+
'is-dot': dot
|
|
67
|
+
}, b('content'), 'sup'),
|
|
68
|
+
style: getStyle()
|
|
69
|
+
}, content()));
|
|
70
|
+
};
|
|
71
|
+
Badge.defaultProps = defaultProps;
|
|
72
|
+
Badge.displayName = 'NutBadge';
|
|
11
73
|
export { Badge as default };
|
package/dist/esm/Barrage.js
CHANGED
|
@@ -1,10 +1,99 @@
|
|
|
1
|
-
import
|
|
2
|
-
import
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
1
|
+
import _defineProperty from "@babel/runtime/helpers/defineProperty";
|
|
2
|
+
import _objectWithoutProperties from "@babel/runtime/helpers/objectWithoutProperties";
|
|
3
|
+
var _excluded = ["className", "frequency", "loop", "barrageList", "speeds", "rows", "top"];
|
|
4
|
+
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; }
|
|
5
|
+
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; }
|
|
6
|
+
import React__default, { useRef, useImperativeHandle, useEffect } from 'react';
|
|
7
|
+
import classNames from 'classnames';
|
|
8
|
+
import { c as cn } from './bem-3b438e61.js';
|
|
6
9
|
import '@bem-react/classname';
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
+
var defaultProps = {
|
|
11
|
+
barrageList: [],
|
|
12
|
+
frequency: 500,
|
|
13
|
+
loop: true,
|
|
14
|
+
speeds: 3000,
|
|
15
|
+
rows: 3,
|
|
16
|
+
top: 10
|
|
17
|
+
};
|
|
18
|
+
var InternalBarrage = function InternalBarrage(props, ref) {
|
|
19
|
+
var _defaultProps$props = _objectSpread(_objectSpread({}, defaultProps), props),
|
|
20
|
+
className = _defaultProps$props.className,
|
|
21
|
+
frequency = _defaultProps$props.frequency,
|
|
22
|
+
loop = _defaultProps$props.loop,
|
|
23
|
+
barrageList = _defaultProps$props.barrageList,
|
|
24
|
+
speeds = _defaultProps$props.speeds,
|
|
25
|
+
rows = _defaultProps$props.rows,
|
|
26
|
+
top = _defaultProps$props.top,
|
|
27
|
+
restProps = _objectWithoutProperties(_defaultProps$props, _excluded);
|
|
28
|
+
var barrageBody = useRef(null);
|
|
29
|
+
var barrageContainer = useRef(null);
|
|
30
|
+
var barrageCWidth = useRef(0);
|
|
31
|
+
var timer = useRef(0);
|
|
32
|
+
var index = useRef(0);
|
|
33
|
+
var b = cn('barrage');
|
|
34
|
+
var classes = classNames(className, b(''));
|
|
35
|
+
useImperativeHandle(ref, function () {
|
|
36
|
+
return {
|
|
37
|
+
add: function add(word) {
|
|
38
|
+
var _index = index.current % barrageList.length;
|
|
39
|
+
if (!loop && index.current === barrageList.length) {
|
|
40
|
+
barrageList.splice(barrageList.length, 0, word);
|
|
41
|
+
} else {
|
|
42
|
+
barrageList.splice(_index, 0, word);
|
|
43
|
+
}
|
|
44
|
+
}
|
|
45
|
+
};
|
|
46
|
+
});
|
|
47
|
+
useEffect(function () {
|
|
48
|
+
if (barrageBody.current) {
|
|
49
|
+
barrageCWidth.current = barrageBody.current.offsetWidth;
|
|
50
|
+
}
|
|
51
|
+
setTimeout(function () {
|
|
52
|
+
var _barrageBody$current;
|
|
53
|
+
(_barrageBody$current = barrageBody.current) === null || _barrageBody$current === void 0 ? void 0 : _barrageBody$current.style.setProperty('--move-distance', "-".concat(barrageCWidth.current, "px"));
|
|
54
|
+
index.current = 0;
|
|
55
|
+
run();
|
|
56
|
+
}, 300);
|
|
57
|
+
return function () {
|
|
58
|
+
clearInterval(timer.current);
|
|
59
|
+
};
|
|
60
|
+
}, [barrageList]);
|
|
61
|
+
var run = function run() {
|
|
62
|
+
clearInterval(timer.current);
|
|
63
|
+
timer.current = window.setTimeout(function () {
|
|
64
|
+
play();
|
|
65
|
+
}, frequency);
|
|
66
|
+
};
|
|
67
|
+
var play = function play() {
|
|
68
|
+
if (!loop && index.current >= barrageList.length) {
|
|
69
|
+
return;
|
|
70
|
+
}
|
|
71
|
+
var _index = loop ? index.current % barrageList.length : index.current;
|
|
72
|
+
var el = document.createElement("div");
|
|
73
|
+
el.innerHTML = barrageList[_index];
|
|
74
|
+
el.classList.add('barrage-item');
|
|
75
|
+
barrageContainer.current.appendChild(el);
|
|
76
|
+
var width = el.offsetWidth;
|
|
77
|
+
var height = el.offsetHeight;
|
|
78
|
+
el.classList.add('move');
|
|
79
|
+
el.style.animationDuration = "".concat(speeds, "ms");
|
|
80
|
+
el.style.top = "".concat(_index % rows * (height + top) + 20, "px");
|
|
81
|
+
el.style.width = "".concat(width, "px");
|
|
82
|
+
el.addEventListener('animationend', function () {
|
|
83
|
+
barrageContainer.current.removeChild(el);
|
|
84
|
+
});
|
|
85
|
+
index.current++;
|
|
86
|
+
run();
|
|
87
|
+
};
|
|
88
|
+
return React__default.createElement("div", _objectSpread({
|
|
89
|
+
className: classes,
|
|
90
|
+
ref: barrageBody
|
|
91
|
+
}, restProps), React__default.createElement("div", {
|
|
92
|
+
ref: barrageContainer,
|
|
93
|
+
className: "bContainer"
|
|
94
|
+
}));
|
|
95
|
+
};
|
|
96
|
+
var Barrage = React__default.forwardRef(InternalBarrage);
|
|
97
|
+
Barrage.defaultProps = defaultProps;
|
|
98
|
+
Barrage.displayName = 'NutBarrage';
|
|
10
99
|
export { Barrage as default };
|
package/dist/esm/Button.js
CHANGED
|
@@ -1,10 +1,109 @@
|
|
|
1
|
-
import
|
|
2
|
-
import
|
|
3
|
-
import
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
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 = ["color", "shape", "plain", "loading", "disabled", "type", "size", "block", "icon", "iconSize", "children", "onClick", "className", "style", "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, { useCallback, useState, useEffect } from 'react';
|
|
8
|
+
import Icon from './Icon.js';
|
|
9
|
+
import { C as ComponentDefaults } from './typings-f27b58f4.js';
|
|
10
|
+
var defaultProps = _objectSpread(_objectSpread({}, ComponentDefaults), {}, {
|
|
11
|
+
className: '',
|
|
12
|
+
color: '',
|
|
13
|
+
shape: 'round',
|
|
14
|
+
plain: false,
|
|
15
|
+
loading: false,
|
|
16
|
+
disabled: false,
|
|
17
|
+
type: 'default',
|
|
18
|
+
size: 'normal',
|
|
19
|
+
block: false,
|
|
20
|
+
icon: '',
|
|
21
|
+
iconSize: '16',
|
|
22
|
+
style: {},
|
|
23
|
+
children: undefined,
|
|
24
|
+
onClick: function onClick(e) {}
|
|
25
|
+
});
|
|
26
|
+
var Button = function Button(props) {
|
|
27
|
+
var _defaultProps$props = _objectSpread(_objectSpread({}, defaultProps), props),
|
|
28
|
+
color = _defaultProps$props.color,
|
|
29
|
+
shape = _defaultProps$props.shape,
|
|
30
|
+
plain = _defaultProps$props.plain,
|
|
31
|
+
loading = _defaultProps$props.loading,
|
|
32
|
+
disabled = _defaultProps$props.disabled,
|
|
33
|
+
type = _defaultProps$props.type,
|
|
34
|
+
size = _defaultProps$props.size,
|
|
35
|
+
block = _defaultProps$props.block,
|
|
36
|
+
icon = _defaultProps$props.icon,
|
|
37
|
+
iconSize = _defaultProps$props.iconSize,
|
|
38
|
+
children = _defaultProps$props.children,
|
|
39
|
+
onClick = _defaultProps$props.onClick,
|
|
40
|
+
className = _defaultProps$props.className,
|
|
41
|
+
style = _defaultProps$props.style,
|
|
42
|
+
iconClassPrefix = _defaultProps$props.iconClassPrefix,
|
|
43
|
+
iconFontClassName = _defaultProps$props.iconFontClassName,
|
|
44
|
+
rest = _objectWithoutProperties(_defaultProps$props, _excluded);
|
|
45
|
+
var getStyle = useCallback(function () {
|
|
46
|
+
var style = {};
|
|
47
|
+
if (color) {
|
|
48
|
+
if (plain) {
|
|
49
|
+
style.color = color;
|
|
50
|
+
style.background = '#fff';
|
|
51
|
+
if (!(color !== null && color !== void 0 && color.includes('gradient'))) {
|
|
52
|
+
style.borderColor = color;
|
|
53
|
+
}
|
|
54
|
+
} else {
|
|
55
|
+
style.color = '#fff';
|
|
56
|
+
style.background = color;
|
|
57
|
+
}
|
|
58
|
+
}
|
|
59
|
+
return style;
|
|
60
|
+
}, [color, plain]);
|
|
61
|
+
var classes = useCallback(function () {
|
|
62
|
+
var prefixCls = 'nut-button';
|
|
63
|
+
return [prefixCls, "".concat(type ? "".concat(prefixCls, "--").concat(type) : ''), "".concat(size ? "".concat(prefixCls, "--").concat(size) : ''), "".concat(shape ? "".concat(prefixCls, "--").concat(shape) : ''), "".concat(plain ? "".concat(prefixCls, "--plain") : ''), "".concat(block ? "".concat(prefixCls, "--block") : ''), "".concat(disabled ? "".concat(prefixCls, "--disabled") : ''), "".concat(loading ? "".concat(prefixCls, "--loading") : '')].filter(Boolean).join(' ');
|
|
64
|
+
}, [block, disabled, loading, plain, shape, size, type]);
|
|
65
|
+
var _useState = useState(classes()),
|
|
66
|
+
_useState2 = _slicedToArray(_useState, 2),
|
|
67
|
+
btnName = _useState2[0],
|
|
68
|
+
setBtnName = _useState2[1];
|
|
69
|
+
var _useState3 = useState(getStyle()),
|
|
70
|
+
_useState4 = _slicedToArray(_useState3, 2),
|
|
71
|
+
btnStyle = _useState4[0],
|
|
72
|
+
setBtnStyle = _useState4[1];
|
|
73
|
+
useEffect(function () {
|
|
74
|
+
setBtnName(classes());
|
|
75
|
+
setBtnStyle(getStyle());
|
|
76
|
+
}, [className, color, shape, plain, loading, disabled, style, type, size, block, icon, iconSize, children, onClick, classes, getStyle]);
|
|
77
|
+
var handleClick = function handleClick(e) {
|
|
78
|
+
if (!loading && !disabled && onClick) {
|
|
79
|
+
onClick(e);
|
|
80
|
+
}
|
|
81
|
+
};
|
|
82
|
+
return (
|
|
83
|
+
// eslint-disable-next-line react/button-has-type
|
|
84
|
+
React__default.createElement("button", _objectSpread(_objectSpread({
|
|
85
|
+
className: "".concat(btnName, " ").concat(className),
|
|
86
|
+
style: _objectSpread(_objectSpread({}, btnStyle), style)
|
|
87
|
+
}, rest), {}, {
|
|
88
|
+
onClick: function onClick(e) {
|
|
89
|
+
return handleClick(e);
|
|
90
|
+
}
|
|
91
|
+
}), React__default.createElement("div", {
|
|
92
|
+
className: "nut-button__warp"
|
|
93
|
+
}, loading && React__default.createElement(Icon, {
|
|
94
|
+
classPrefix: iconClassPrefix,
|
|
95
|
+
fontClassName: iconFontClassName,
|
|
96
|
+
name: "loading"
|
|
97
|
+
}), !loading && icon ? React__default.createElement(Icon, {
|
|
98
|
+
classPrefix: iconClassPrefix,
|
|
99
|
+
fontClassName: iconFontClassName,
|
|
100
|
+
name: icon,
|
|
101
|
+
size: iconSize
|
|
102
|
+
}) : '', children && React__default.createElement("div", {
|
|
103
|
+
className: icon || loading ? 'text' : ''
|
|
104
|
+
}, children)))
|
|
105
|
+
);
|
|
106
|
+
};
|
|
107
|
+
Button.defaultProps = defaultProps;
|
|
108
|
+
Button.displayName = 'NutButton';
|
|
10
109
|
export { Button as default };
|
package/dist/esm/Calendar.js
CHANGED
|
@@ -1,21 +1,129 @@
|
|
|
1
|
-
import
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
import 'react
|
|
5
|
-
import '
|
|
6
|
-
import '
|
|
7
|
-
import './
|
|
8
|
-
import './
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
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, { useRef } from 'react';
|
|
5
|
+
import Popup from './Popup.js';
|
|
6
|
+
import CalendarItem from './CalendarItem.js';
|
|
7
|
+
import { U as Utils } from './date-c7aad4c0.js';
|
|
8
|
+
import { useConfig } from './ConfigProvider.js';
|
|
9
|
+
var defaultProps = {
|
|
10
|
+
type: 'one',
|
|
11
|
+
isAutoBackFill: false,
|
|
12
|
+
poppable: true,
|
|
13
|
+
visible: false,
|
|
14
|
+
title: '',
|
|
15
|
+
defaultValue: '',
|
|
16
|
+
startDate: Utils.getDay(0),
|
|
17
|
+
endDate: Utils.getDay(365),
|
|
18
|
+
showToday: true,
|
|
19
|
+
startText: '',
|
|
20
|
+
endText: '',
|
|
21
|
+
confirmText: '',
|
|
22
|
+
showTitle: true,
|
|
23
|
+
showSubTitle: true,
|
|
24
|
+
toDateAnimation: true,
|
|
25
|
+
onBtn: undefined,
|
|
26
|
+
onDay: undefined,
|
|
27
|
+
onTopInfo: undefined,
|
|
28
|
+
onBottomInfo: undefined,
|
|
29
|
+
onClose: function onClose() {},
|
|
30
|
+
onChoose: function onChoose(param) {},
|
|
31
|
+
onSelected: function onSelected(data) {},
|
|
32
|
+
onYearMonthChange: function onYearMonthChange(param) {}
|
|
33
|
+
};
|
|
34
|
+
var Calendar = React__default.forwardRef(function (props, ref) {
|
|
35
|
+
var _useConfig = useConfig(),
|
|
36
|
+
locale = _useConfig.locale;
|
|
37
|
+
var _defaultProps$props = _objectSpread(_objectSpread({}, defaultProps), props),
|
|
38
|
+
poppable = _defaultProps$props.poppable,
|
|
39
|
+
visible = _defaultProps$props.visible,
|
|
40
|
+
type = _defaultProps$props.type,
|
|
41
|
+
isAutoBackFill = _defaultProps$props.isAutoBackFill,
|
|
42
|
+
title = _defaultProps$props.title,
|
|
43
|
+
defaultValue = _defaultProps$props.defaultValue,
|
|
44
|
+
startDate = _defaultProps$props.startDate,
|
|
45
|
+
endDate = _defaultProps$props.endDate,
|
|
46
|
+
showToday = _defaultProps$props.showToday,
|
|
47
|
+
startText = _defaultProps$props.startText,
|
|
48
|
+
endText = _defaultProps$props.endText,
|
|
49
|
+
confirmText = _defaultProps$props.confirmText,
|
|
50
|
+
showTitle = _defaultProps$props.showTitle,
|
|
51
|
+
showSubTitle = _defaultProps$props.showSubTitle,
|
|
52
|
+
toDateAnimation = _defaultProps$props.toDateAnimation,
|
|
53
|
+
onBtn = _defaultProps$props.onBtn,
|
|
54
|
+
onDay = _defaultProps$props.onDay,
|
|
55
|
+
onTopInfo = _defaultProps$props.onTopInfo,
|
|
56
|
+
onBottomInfo = _defaultProps$props.onBottomInfo,
|
|
57
|
+
onClose = _defaultProps$props.onClose,
|
|
58
|
+
onChoose = _defaultProps$props.onChoose,
|
|
59
|
+
onSelected = _defaultProps$props.onSelected,
|
|
60
|
+
onYearMonthChange = _defaultProps$props.onYearMonthChange;
|
|
61
|
+
var calendarRef = useRef(null);
|
|
62
|
+
var close = function close() {
|
|
63
|
+
onClose && onClose();
|
|
64
|
+
};
|
|
65
|
+
var choose = function choose(param) {
|
|
66
|
+
close();
|
|
67
|
+
onChoose && onChoose(param);
|
|
68
|
+
};
|
|
69
|
+
var closePopup = function closePopup() {
|
|
70
|
+
close();
|
|
71
|
+
};
|
|
72
|
+
var select = function select(param) {
|
|
73
|
+
onSelected && onSelected(param);
|
|
74
|
+
};
|
|
75
|
+
var scrollToDate = function scrollToDate(date) {
|
|
76
|
+
var _calendarRef$current;
|
|
77
|
+
(_calendarRef$current = calendarRef.current) === null || _calendarRef$current === void 0 ? void 0 : _calendarRef$current.scrollToDate(date);
|
|
78
|
+
};
|
|
79
|
+
var yearMonthChange = function yearMonthChange(param) {
|
|
80
|
+
onYearMonthChange && onYearMonthChange(param);
|
|
81
|
+
};
|
|
82
|
+
React__default.useImperativeHandle(ref, function () {
|
|
83
|
+
return {
|
|
84
|
+
scrollToDate: scrollToDate
|
|
85
|
+
};
|
|
86
|
+
});
|
|
87
|
+
var renderItem = function renderItem() {
|
|
88
|
+
return React__default.createElement(CalendarItem, {
|
|
89
|
+
ref: calendarRef,
|
|
90
|
+
type: type,
|
|
91
|
+
isAutoBackFill: isAutoBackFill,
|
|
92
|
+
poppable: poppable,
|
|
93
|
+
title: title || locale.calendaritem.title,
|
|
94
|
+
defaultValue: defaultValue,
|
|
95
|
+
startDate: startDate,
|
|
96
|
+
endDate: endDate,
|
|
97
|
+
showToday: showToday,
|
|
98
|
+
startText: startText || locale.calendaritem.start,
|
|
99
|
+
endText: endText || locale.calendaritem.end,
|
|
100
|
+
confirmText: confirmText || locale.calendaritem.confirm,
|
|
101
|
+
showTitle: showTitle,
|
|
102
|
+
showSubTitle: showSubTitle,
|
|
103
|
+
toDateAnimation: toDateAnimation,
|
|
104
|
+
onBtn: onBtn,
|
|
105
|
+
onDay: onDay,
|
|
106
|
+
onTopInfo: onTopInfo,
|
|
107
|
+
onBottomInfo: onBottomInfo,
|
|
108
|
+
onChoose: choose,
|
|
109
|
+
onSelected: select,
|
|
110
|
+
onYearMonthChange: yearMonthChange
|
|
111
|
+
});
|
|
112
|
+
};
|
|
113
|
+
return React__default.createElement(React__default.Fragment, null, poppable ? React__default.createElement(Popup, {
|
|
114
|
+
visible: visible,
|
|
115
|
+
position: "bottom",
|
|
116
|
+
round: true,
|
|
117
|
+
duration: 0.5,
|
|
118
|
+
closeable: true,
|
|
119
|
+
destroyOnClose: true,
|
|
120
|
+
onClickOverlay: closePopup,
|
|
121
|
+
onClickCloseIcon: closePopup,
|
|
122
|
+
style: {
|
|
123
|
+
height: '85vh'
|
|
124
|
+
}
|
|
125
|
+
}, renderItem()) : renderItem());
|
|
126
|
+
});
|
|
127
|
+
Calendar.defaultProps = defaultProps;
|
|
128
|
+
Calendar.displayName = 'NutCalendar';
|
|
21
129
|
export { Calendar as default };
|