@nutui/nutui-react-taro 1.4.4 → 1.4.5
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +15 -0
- package/dist/esm/Address.js +5 -5
- package/dist/esm/Audio.js +5 -5
- package/dist/esm/AvatarContext-7153ad2b.js +3 -1
- package/dist/esm/AvatarGroup.js +4 -4
- package/dist/esm/Calendar.js +5 -5
- package/dist/esm/CalendarItem.js +4 -4
- package/dist/esm/Card.js +4 -3
- package/dist/esm/Cell.js +2 -2
- package/dist/esm/ConfigProvider.js +3 -3
- package/dist/esm/CountDown.js +4 -4
- package/dist/esm/DatePicker.js +5 -5
- package/dist/esm/Dialog.js +4 -4
- package/dist/esm/Ellipsis.js +4 -4
- package/dist/esm/Empty.js +4 -4
- package/dist/esm/FixedNav.js +4 -4
- package/dist/esm/Form.js +4 -4
- package/dist/esm/FormItem.js +3 -3
- package/dist/esm/Grid.js +4 -4
- package/dist/esm/GridItem.js +4 -4
- package/dist/esm/Image.js +4 -4
- package/dist/esm/Infiniteloading.js +4 -4
- package/dist/esm/Input.js +4 -4
- package/dist/esm/MenuItem.js +4 -4
- package/dist/esm/NoticeBar.js +2 -2
- package/dist/esm/NumberKeyboard.js +4 -4
- package/dist/esm/Pagination.js +4 -4
- package/dist/esm/Picker.js +4 -4
- package/dist/esm/PullToRefresh.js +4 -4
- package/dist/esm/Range.js +4 -4
- package/dist/esm/SearchBar.js +4 -4
- package/dist/esm/ShortPassword.js +4 -4
- package/dist/esm/SideNavBar.js +4 -4
- package/dist/esm/Signature.js +4 -4
- package/dist/esm/Sticky.js +4 -4
- package/dist/esm/Table.js +4 -4
- package/dist/esm/Tag.js +3 -2
- package/dist/esm/TextArea.js +4 -4
- package/dist/esm/TimeDetail.js +4 -4
- package/dist/esm/TimePannel.js +4 -4
- package/dist/esm/TimeSelect.js +6 -6
- package/dist/esm/Uploader.js +4 -4
- package/dist/esm/UserContext-68f62e66.js +3 -1
- package/dist/esm/UserContext-b4181162.js +3 -1
- package/dist/esm/UserContext-be8097d2.js +3 -1
- package/dist/esm/VirtualList.js +6 -4
- package/dist/esm/WaterMark.js +4 -4
- package/dist/esm/actionsheet.taro-a58d3d12.js +45 -83
- package/dist/esm/address.taro-79cc7c96.js +461 -0
- package/dist/esm/animate.taro-b0e83dd5.js +32 -46
- package/dist/esm/animatingnumbers.taro-6f40a2e9.js +93 -134
- package/dist/esm/audio.taro-4fadc583.js +161 -0
- package/dist/esm/avatar.taro-85ced995.js +93 -119
- package/dist/esm/avatargroup-1d900174.js +34 -0
- package/dist/esm/backtop.taro-99107c30.js +39 -62
- package/dist/esm/badge.taro-fe9171ec.js +40 -58
- package/dist/esm/barrage.taro-0e157b5e.js +61 -91
- package/dist/esm/bem-893ad28d.js +3 -6
- package/dist/esm/button.taro-4ce133b9.js +87 -98
- package/dist/esm/calendar.taro-4ed72058.js +38 -0
- package/dist/esm/calendaritem.taro-1ebe428d.js +571 -0
- package/dist/esm/card.taro-39055e82.js +32 -0
- package/dist/esm/cascader.taro-d8cb1c3e.js +397 -636
- package/dist/esm/cell.taro-9a04a92e.js +64 -0
- package/dist/esm/cellgroup.taro-e094471c.js +18 -27
- package/dist/esm/checkbox.taro-0bda9796.js +160 -232
- package/dist/esm/circleprogress.taro-47db537c.js +99 -120
- package/dist/esm/col.taro-b61c7cba.js +33 -50
- package/dist/esm/collapse.taro-af58206c.js +73 -86
- package/dist/esm/collapseitem-ce1849d2.js +75 -139
- package/dist/esm/configprovider-5eea4f5d.js +19 -0
- package/dist/esm/configprovider.taro-26882dd2.js +42 -0
- package/dist/esm/countdown.taro-9e40de9c.js +225 -0
- package/dist/esm/datepicker.taro-7220e495.js +270 -0
- package/dist/esm/dialog.taro-1c03960e.js +123 -0
- package/dist/esm/divider.taro-5236fe6a.js +27 -27
- package/dist/esm/drag.taro-82b6b27a.js +99 -138
- package/dist/esm/elevator.taro-d7d65470.js +185 -259
- package/dist/esm/ellipsis.taro-49b6db0c.js +232 -0
- package/dist/esm/empty.taro-7bd813f9.js +62 -0
- package/dist/esm/fixednav.taro-5ad15202.js +53 -0
- package/dist/esm/form.taro-71d32671.js +179 -0
- package/dist/esm/formitem.taro-3089489b.js +89 -0
- package/dist/esm/grid.taro-e6decfce.js +58 -0
- package/dist/esm/grid.taro.context-39636af9.js +4 -2
- package/dist/esm/griditem.taro-4cade72e.js +90 -0
- package/dist/esm/icon-8dc4de10.js +43 -51
- package/dist/esm/icon.taro-1d0d4fb7.js +43 -51
- package/dist/esm/image.taro-e6dc5867.js +64 -0
- package/dist/esm/imagepreview.taro-3400ea03.js +158 -205
- package/dist/esm/index.taro-a36f96fb.js +149 -210
- package/dist/esm/indicator.taro-183ea169.js +29 -43
- package/dist/esm/infiniteloading.taro-6c2a2e95.js +142 -0
- package/dist/esm/input.taro-fd566407.js +243 -0
- package/dist/esm/inputnumber.taro-dc39b853.js +129 -177
- package/dist/esm/layout.taro-358f014f.js +6 -9
- package/dist/esm/menu.taro-4abed328.js +89 -132
- package/dist/esm/menuitem.taro-6e8b27c3.js +130 -0
- package/dist/esm/navbar.taro-c931c078.js +69 -105
- package/dist/esm/noticebar.taro-69ea7673.js +450 -0
- package/dist/esm/notify.taro-308e5892.js +66 -97
- package/dist/esm/numberkeyboard.taro-194519e4.js +158 -0
- package/dist/esm/nutui-react.es.js +44 -44
- package/dist/esm/offsetContext-bfb02c25.js +3 -1
- package/dist/esm/overlay.taro-98367bc1.js +59 -74
- package/dist/esm/pagination.taro-bb490de9.js +124 -0
- package/dist/esm/picker.taro-2a8ded7c.js +420 -0
- package/dist/esm/popover.taro-46d813e8.js +132 -222
- package/dist/esm/popup.taro-cb777e09.js +125 -178
- package/dist/esm/price.taro-8801462e.js +75 -86
- package/dist/esm/progress.taro-623bc807.js +84 -118
- package/dist/esm/pulltorefresh.taro-cab7b51c.js +221 -0
- package/dist/esm/range.taro-5d6ff217.js +332 -0
- package/dist/esm/rate.taro-10197384.js +64 -111
- package/dist/esm/row.taro-37a895de.js +38 -42
- package/dist/esm/searchbar.taro-839dd622.js +148 -0
- package/dist/esm/shortpassword.taro-182d46f7.js +111 -0
- package/dist/esm/sidenavbar.taro-006cf38b.js +35 -0
- package/dist/esm/sidenavbaritem.taro-fee11d26.js +9 -22
- package/dist/esm/signature.taro-33632585.js +143 -0
- package/dist/esm/skeleton.taro-853ce460.js +51 -88
- package/dist/esm/step.taro-1c94e067.js +49 -78
- package/dist/esm/steps.taro-acf205a0.js +21 -30
- package/dist/esm/sticky.taro-d0553f48.js +13 -0
- package/dist/esm/subsidenavbar.taro-f46b4c73.js +58 -75
- package/dist/esm/swipe.taro-83bc248f.js +164 -254
- package/dist/esm/swiper.taro-852f6615.js +424 -505
- package/dist/esm/swiperitem-86a3578a.js +20 -28
- package/dist/esm/switch.taro-bae2dca0.js +43 -64
- package/dist/esm/tabbar.taro-86cece39.js +47 -57
- package/dist/esm/tabbaritem.taro-8dfb8055.js +51 -79
- package/dist/esm/table.taro-cb4dd2c3.js +92 -0
- package/dist/esm/tabpane.taro-91cd6cf4.js +17 -22
- package/dist/esm/tabs.taro-e71875fa.js +121 -165
- package/dist/esm/tag.taro-00fe554d.js +89 -0
- package/dist/esm/textarea.taro-42600f8c.js +74 -0
- package/dist/esm/timedetail.taro-c5f564fd.js +44 -0
- package/dist/esm/timepannel.taro-29f9dd86.js +22 -0
- package/dist/esm/timeselect.taro-3ecce65d.js +133 -0
- package/dist/esm/toast.taro-0804b6b4.js +99 -137
- package/dist/esm/trendarrow.taro-5a7153e4.js +63 -90
- package/dist/esm/types/src/packages/cell/cell.taro.d.ts +0 -1
- package/dist/esm/types/src/packages/noticebar/noticebar.d.ts +5 -4
- package/dist/esm/types/src/packages/noticebar/noticebar.taro.d.ts +5 -4
- package/dist/esm/types/src/packages/uploader/uploader.d.ts +1 -1
- package/dist/esm/types/src/packages/virtuallist/virtuallist.taro.d.ts +13 -2
- package/dist/esm/typings-1c5f2628.js +7 -6
- package/dist/esm/uploader.taro-f80d76d9.js +392 -0
- package/dist/esm/useClientRect-bf69d7b3.js +5 -25
- package/dist/esm/useTouch-a2ea68c6.js +63 -93
- package/dist/esm/video-8a3518c5.js +59 -83
- package/dist/esm/virtuallist.taro-e3345ced.js +215 -0
- package/dist/esm/watermark.taro-cd9db98a.js +114 -0
- package/dist/esm/zh-CN-dfc384d0.js +128 -133
- 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.es.js +634 -5664
- package/dist/nutui.react.umd.js +634 -5664
- package/dist/packages/noticebar/noticebar.scss +17 -0
- package/dist/packages/radio/radio.scss +3 -1
- package/dist/packages/row/row.scss +2 -0
- package/dist/packages/searchbar/searchbar.scss +1 -1
- package/dist/packages/tag/tag.scss +13 -5
- package/dist/packages/virtuallist/virtuallist.scss +24 -0
- package/dist/style.css +1 -1
- package/dist/style.es.js +1 -1
- package/dist/styles/temp.scss +2340 -0
- package/dist/styles/theme-dark.scss +7 -0
- package/dist/styles/theme-default.scss +11 -0
- package/dist/styles/variables.scss +1945 -710
- package/dist/types/index.d.ts +16 -23
- package/package.json +9 -4
- package/dist/esm/address.taro-1e2aea24.js +0 -615
- package/dist/esm/audio.taro-fddcdfc0.js +0 -228
- package/dist/esm/avatargroup-f7f600ff.js +0 -42
- package/dist/esm/calendar.taro-72974415.js +0 -83
- package/dist/esm/calendaritem.taro-84e889eb.js +0 -580
- package/dist/esm/card.taro-a530dfb3.js +0 -61
- package/dist/esm/cell.taro-cf50c4f2.js +0 -109
- package/dist/esm/configprovider-c7d60e20.js +0 -18
- package/dist/esm/configprovider.taro-8bdb3a28.js +0 -50
- package/dist/esm/countdown.taro-d7dc8681.js +0 -246
- package/dist/esm/datepicker.taro-7199f521.js +0 -304
- package/dist/esm/dialog.taro-f54cfbf0.js +0 -187
- package/dist/esm/ellipsis.taro-c0de6ff4.js +0 -309
- package/dist/esm/empty.taro-dbc66496.js +0 -81
- package/dist/esm/fixednav.taro-9e759320.js +0 -97
- package/dist/esm/form.taro-880014b1.js +0 -181
- package/dist/esm/formitem.taro-3695f4a7.js +0 -136
- package/dist/esm/grid.taro-c2cc12d6.js +0 -81
- package/dist/esm/griditem.taro-892153cd.js +0 -122
- package/dist/esm/image.taro-c30973d5.js +0 -105
- package/dist/esm/infiniteloading.taro-b5ddf3cc.js +0 -188
- package/dist/esm/input.taro-104130c1.js +0 -361
- package/dist/esm/menuitem.taro-216e9f7d.js +0 -193
- package/dist/esm/noticebar.taro-94002898.js +0 -368
- package/dist/esm/numberkeyboard.taro-5e8f0ddf.js +0 -245
- package/dist/esm/pagination.taro-9925ffab.js +0 -169
- package/dist/esm/picker.taro-3b5cc054.js +0 -540
- package/dist/esm/pulltorefresh.taro-f26a20dd.js +0 -302
- package/dist/esm/range.taro-c41e9b90.js +0 -469
- package/dist/esm/searchbar.taro-01ed4ea4.js +0 -236
- package/dist/esm/shortpassword.taro-3a3bf412.js +0 -190
- package/dist/esm/sidenavbar.taro-06026f31.js +0 -66
- package/dist/esm/signature.taro-17648cac.js +0 -192
- package/dist/esm/sticky.taro-36013e97.js +0 -16
- package/dist/esm/table.taro-adda6622.js +0 -139
- package/dist/esm/tag.taro-bd900990.js +0 -104
- package/dist/esm/textarea.taro-83d5fe73.js +0 -102
- package/dist/esm/timedetail.taro-105f5380.js +0 -68
- package/dist/esm/timepannel.taro-c66c63dd.js +0 -30
- package/dist/esm/timeselect.taro-fc7ec6ee.js +0 -172
- package/dist/esm/uploader.taro-a1edf38f.js +0 -529
- package/dist/esm/virtuallist.taro-4add61c3.js +0 -315
- package/dist/esm/watermark.taro-323d1cf3.js +0 -132
|
@@ -0,0 +1,34 @@
|
|
|
1
|
+
import React__default, { useRef } from 'react';
|
|
2
|
+
import classNames from 'classnames';
|
|
3
|
+
import { A as AvatarContext } from './AvatarContext-7153ad2b.js';
|
|
4
|
+
import { c as cn } from './bem-893ad28d.js';
|
|
5
|
+
import { u as useConfig } from './configprovider-5eea4f5d.js';
|
|
6
|
+
|
|
7
|
+
const defaultProps = {
|
|
8
|
+
maxContent: '',
|
|
9
|
+
maxCount: '',
|
|
10
|
+
maxBgColor: '#eee',
|
|
11
|
+
maxColor: '#666',
|
|
12
|
+
size: '',
|
|
13
|
+
shape: '',
|
|
14
|
+
span: '-8',
|
|
15
|
+
zIndex: 'left',
|
|
16
|
+
};
|
|
17
|
+
const AvatarGroup = (props) => {
|
|
18
|
+
useConfig();
|
|
19
|
+
const propAvatarGroup = { ...defaultProps, ...props };
|
|
20
|
+
const { className, style, children } = propAvatarGroup;
|
|
21
|
+
const avatarGroupRef = useRef(null);
|
|
22
|
+
const b = cn('avatar-group');
|
|
23
|
+
const cls = classNames(b(''), className);
|
|
24
|
+
const parentAvatar = {
|
|
25
|
+
propAvatarGroup,
|
|
26
|
+
avatarGroupRef,
|
|
27
|
+
};
|
|
28
|
+
return (React__default.createElement(AvatarContext.Provider, { value: parentAvatar },
|
|
29
|
+
React__default.createElement("div", { className: cls, style: style, ref: avatarGroupRef }, children)));
|
|
30
|
+
};
|
|
31
|
+
AvatarGroup.defaultProps = defaultProps;
|
|
32
|
+
AvatarGroup.displayName = 'NutAvatarGroup';
|
|
33
|
+
|
|
34
|
+
export { AvatarGroup as A };
|
|
@@ -1,71 +1,48 @@
|
|
|
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
1
|
import React__default, { useState } from 'react';
|
|
6
2
|
import Taro, { usePageScroll } from '@tarojs/taro';
|
|
7
3
|
import { I as Icon } from './icon.taro-1d0d4fb7.js';
|
|
8
4
|
import { C as ComponentDefaults } from './typings-1c5f2628.js';
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
bottom =
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
onClick = _defaultProps$props.onClick,
|
|
31
|
-
iconClassPrefix = _defaultProps$props.iconClassPrefix,
|
|
32
|
-
iconFontClassName = _defaultProps$props.iconFontClassName;
|
|
33
|
-
var _useState = useState(false),
|
|
34
|
-
_useState2 = _slicedToArray(_useState, 2),
|
|
35
|
-
backTop = _useState2[0],
|
|
36
|
-
SetBackTop = _useState2[1];
|
|
37
|
-
// 监听用户滑动页面事件
|
|
38
|
-
usePageScroll(function (res) {
|
|
39
|
-
var scrollTop = res.scrollTop;
|
|
40
|
-
scrollTop >= distance ? SetBackTop(true) : SetBackTop(false);
|
|
41
|
-
});
|
|
42
|
-
// 返回顶部点击事件
|
|
43
|
-
var goTop = function goTop(e) {
|
|
44
|
-
onClick && onClick(e);
|
|
45
|
-
Taro.pageScrollTo({
|
|
46
|
-
scrollTop: 0,
|
|
47
|
-
duration: isAnimation && duration > 0 ? duration : 0
|
|
5
|
+
|
|
6
|
+
const defaultProps = {
|
|
7
|
+
...ComponentDefaults,
|
|
8
|
+
bottom: 20,
|
|
9
|
+
right: 10,
|
|
10
|
+
elId: 'body',
|
|
11
|
+
distance: 200,
|
|
12
|
+
zIndex: 10,
|
|
13
|
+
isAnimation: true,
|
|
14
|
+
duration: 1000,
|
|
15
|
+
};
|
|
16
|
+
const BackTop = (props) => {
|
|
17
|
+
const { children, bottom, right, elId, distance, zIndex, isAnimation, className, duration, style, onClick, iconClassPrefix, iconFontClassName, } = {
|
|
18
|
+
...defaultProps,
|
|
19
|
+
...props,
|
|
20
|
+
};
|
|
21
|
+
const [backTop, SetBackTop] = useState(false);
|
|
22
|
+
// 监听用户滑动页面事件
|
|
23
|
+
usePageScroll((res) => {
|
|
24
|
+
const { scrollTop } = res;
|
|
25
|
+
scrollTop >= distance ? SetBackTop(true) : SetBackTop(false);
|
|
48
26
|
});
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
name: "top"
|
|
67
|
-
})));
|
|
27
|
+
// 返回顶部点击事件
|
|
28
|
+
const goTop = (e) => {
|
|
29
|
+
onClick && onClick(e);
|
|
30
|
+
Taro.pageScrollTo({
|
|
31
|
+
scrollTop: 0,
|
|
32
|
+
duration: isAnimation && duration > 0 ? duration : 0,
|
|
33
|
+
});
|
|
34
|
+
};
|
|
35
|
+
const backTopClass = {
|
|
36
|
+
right: `${right}px`,
|
|
37
|
+
bottom: `${bottom}px`,
|
|
38
|
+
zIndex,
|
|
39
|
+
};
|
|
40
|
+
return (React__default.createElement(React__default.Fragment, null,
|
|
41
|
+
React__default.createElement("div", { className: `nut-backtop ${backTop ? 'show' : ''} ${className || ''}`, style: { ...backTopClass, ...style }, onClick: (e) => {
|
|
42
|
+
goTop(e);
|
|
43
|
+
} }, children || (React__default.createElement(Icon, { classPrefix: iconClassPrefix, fontClassName: iconFontClassName, size: "19px", className: "nut-backtop-main", name: "top" })))));
|
|
68
44
|
};
|
|
69
45
|
BackTop.defaultProps = defaultProps;
|
|
70
46
|
BackTop.displayName = 'NutBackTop';
|
|
47
|
+
|
|
71
48
|
export { BackTop as B };
|
|
@@ -1,66 +1,48 @@
|
|
|
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
1
|
import React__default from 'react';
|
|
5
2
|
import { I as Icon } from './icon.taro-1d0d4fb7.js';
|
|
6
3
|
import { C as ComponentDefaults } from './typings-1c5f2628.js';
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
style =
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
var max = props.max;
|
|
34
|
-
if (typeof value === 'number' && typeof max === 'number') {
|
|
35
|
-
return max < value ? "".concat(max, "+") : value;
|
|
4
|
+
|
|
5
|
+
const defaultProps = {
|
|
6
|
+
...ComponentDefaults,
|
|
7
|
+
value: '',
|
|
8
|
+
dot: false,
|
|
9
|
+
max: 10000,
|
|
10
|
+
top: '0',
|
|
11
|
+
right: '0',
|
|
12
|
+
zIndex: '0',
|
|
13
|
+
color: '',
|
|
14
|
+
icons: '',
|
|
15
|
+
};
|
|
16
|
+
const Badge = (props) => {
|
|
17
|
+
const { className, style, children, dot, top, right, zIndex, color, icons, iconClassPrefix, iconFontClassName, } = {
|
|
18
|
+
...defaultProps,
|
|
19
|
+
...props,
|
|
20
|
+
};
|
|
21
|
+
function content() {
|
|
22
|
+
if (dot)
|
|
23
|
+
return undefined;
|
|
24
|
+
const { value } = props;
|
|
25
|
+
const { max } = props;
|
|
26
|
+
if (typeof value === 'number' && typeof max === 'number') {
|
|
27
|
+
return max < value ? `${max}+` : value;
|
|
28
|
+
}
|
|
29
|
+
return value;
|
|
36
30
|
}
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
return style
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
}, icons !== '' && React__default.createElement("div", {
|
|
51
|
-
className: "slot-icons"
|
|
52
|
-
}, React__default.createElement(Icon, {
|
|
53
|
-
classPrefix: iconClassPrefix,
|
|
54
|
-
fontClassName: iconFontClassName,
|
|
55
|
-
className: "_icon",
|
|
56
|
-
name: icons,
|
|
57
|
-
color: "#ffffff",
|
|
58
|
-
size: "12"
|
|
59
|
-
})), React__default.createElement("div", null, children), React__default.createElement("div", {
|
|
60
|
-
className: "".concat(dot ? 'is-dot' : '', " nut-badge__content sup"),
|
|
61
|
-
style: getStyle()
|
|
62
|
-
}, content()));
|
|
31
|
+
const getStyle = () => {
|
|
32
|
+
const style = {};
|
|
33
|
+
style.top = `${Number(top) || parseFloat(top) || 0}px`;
|
|
34
|
+
style.right = `${Number(right) || parseFloat(right) || 0}px`;
|
|
35
|
+
style.zIndex = zIndex;
|
|
36
|
+
style.background = color;
|
|
37
|
+
return style;
|
|
38
|
+
};
|
|
39
|
+
return (React__default.createElement("div", { className: `nut-badge ${className}`, style: style },
|
|
40
|
+
icons !== '' && (React__default.createElement("div", { className: "slot-icons" },
|
|
41
|
+
React__default.createElement(Icon, { classPrefix: iconClassPrefix, fontClassName: iconFontClassName, className: "_icon", name: icons, color: "#ffffff", size: "12" }))),
|
|
42
|
+
React__default.createElement("div", null, children),
|
|
43
|
+
React__default.createElement("div", { className: `${dot ? 'is-dot' : ''} nut-badge__content sup`, style: getStyle() }, content())));
|
|
63
44
|
};
|
|
64
45
|
Badge.defaultProps = defaultProps;
|
|
65
46
|
Badge.displayName = 'NutBadge';
|
|
47
|
+
|
|
66
48
|
export { Badge as B };
|
|
@@ -1,103 +1,73 @@
|
|
|
1
|
-
import _asyncToGenerator from "@babel/runtime/helpers/asyncToGenerator";
|
|
2
|
-
import _defineProperty from "@babel/runtime/helpers/defineProperty";
|
|
3
|
-
import _objectWithoutProperties from "@babel/runtime/helpers/objectWithoutProperties";
|
|
4
|
-
var _excluded = ["className", "frequency", "loop", "barrageList", "speeds", "rows", "top"];
|
|
5
|
-
import _regeneratorRuntime from "@babel/runtime/regenerator";
|
|
6
|
-
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; }
|
|
7
|
-
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; }
|
|
8
1
|
import React__default, { useRef, useImperativeHandle, useEffect } from 'react';
|
|
9
2
|
import Taro from '@tarojs/taro';
|
|
10
3
|
import classNames from 'classnames';
|
|
11
4
|
import { c as cn } from './bem-893ad28d.js';
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
5
|
+
|
|
6
|
+
const defaultProps = {
|
|
7
|
+
barrageList: [],
|
|
8
|
+
frequency: 500,
|
|
9
|
+
loop: true,
|
|
10
|
+
speeds: 2000,
|
|
11
|
+
rows: 3,
|
|
12
|
+
top: 10,
|
|
19
13
|
};
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
loop = _defaultProps$props.loop,
|
|
25
|
-
barrageList = _defaultProps$props.barrageList,
|
|
26
|
-
speeds = _defaultProps$props.speeds,
|
|
27
|
-
rows = _defaultProps$props.rows,
|
|
28
|
-
top = _defaultProps$props.top,
|
|
29
|
-
restProps = _objectWithoutProperties(_defaultProps$props, _excluded);
|
|
30
|
-
var barrageBody = useRef(null);
|
|
31
|
-
var barrageContainer = useRef(null);
|
|
32
|
-
var timer = useRef(0);
|
|
33
|
-
var index = useRef(0);
|
|
34
|
-
var b = cn('barrage');
|
|
35
|
-
var classes = classNames(className, b(''));
|
|
36
|
-
useImperativeHandle(ref, function () {
|
|
37
|
-
return {
|
|
38
|
-
add: function add(word) {
|
|
39
|
-
var _index = index.current % barrageList.length;
|
|
40
|
-
barrageList.splice(_index, 0, word);
|
|
41
|
-
}
|
|
14
|
+
const InternalBarrage = (props, ref) => {
|
|
15
|
+
const { className, frequency, loop, barrageList, speeds, rows, top, ...restProps } = {
|
|
16
|
+
...defaultProps,
|
|
17
|
+
...props,
|
|
42
18
|
};
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
run();
|
|
55
|
-
}, frequency);
|
|
56
|
-
};
|
|
57
|
-
var play = /*#__PURE__*/function () {
|
|
58
|
-
var _ref = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee() {
|
|
59
|
-
var _index, el;
|
|
60
|
-
return _regeneratorRuntime.wrap(function _callee$(_context) {
|
|
61
|
-
while (1) {
|
|
62
|
-
switch (_context.prev = _context.next) {
|
|
63
|
-
case 0:
|
|
64
|
-
_index = loop ? index.current % barrageList.length : index.current;
|
|
65
|
-
el = document.createElement("div");
|
|
66
|
-
el.innerHTML = barrageList[_index];
|
|
67
|
-
el.classList.add('barrage-item');
|
|
68
|
-
barrageContainer.current.appendChild(el);
|
|
69
|
-
Taro.createSelectorQuery().select('.barrage-item').boundingClientRect(function (res) {
|
|
70
|
-
console.log('res', res);
|
|
71
|
-
var height = res === null || res === void 0 ? void 0 : res.height;
|
|
72
|
-
el.classList.add('move');
|
|
73
|
-
el.style.animationDuration = "".concat(speeds, "ms");
|
|
74
|
-
el.style.top = "".concat(_index % rows * (height + top) + 20, "px");
|
|
75
|
-
el.dataset.index = "".concat(_index);
|
|
76
|
-
el.addEventListener('animationend', function () {
|
|
77
|
-
barrageContainer.current.removeChild(el);
|
|
78
|
-
});
|
|
79
|
-
index.current++;
|
|
80
|
-
}).exec();
|
|
81
|
-
case 6:
|
|
82
|
-
case "end":
|
|
83
|
-
return _context.stop();
|
|
84
|
-
}
|
|
85
|
-
}
|
|
86
|
-
}, _callee);
|
|
19
|
+
const barrageBody = useRef(null);
|
|
20
|
+
const barrageContainer = useRef(null);
|
|
21
|
+
const timer = useRef(0);
|
|
22
|
+
const index = useRef(0);
|
|
23
|
+
const b = cn('barrage');
|
|
24
|
+
const classes = classNames(className, b(''));
|
|
25
|
+
useImperativeHandle(ref, () => ({
|
|
26
|
+
add: (word) => {
|
|
27
|
+
const _index = index.current % barrageList.length;
|
|
28
|
+
barrageList.splice(_index, 0, word);
|
|
29
|
+
},
|
|
87
30
|
}));
|
|
88
|
-
|
|
89
|
-
|
|
31
|
+
useEffect(() => {
|
|
32
|
+
run();
|
|
33
|
+
return () => {
|
|
34
|
+
clearInterval(timer.current);
|
|
35
|
+
};
|
|
36
|
+
}, [barrageList]);
|
|
37
|
+
const run = () => {
|
|
38
|
+
clearInterval(timer.current);
|
|
39
|
+
timer.current = window.setInterval(() => {
|
|
40
|
+
play();
|
|
41
|
+
run();
|
|
42
|
+
}, frequency);
|
|
43
|
+
};
|
|
44
|
+
const play = async () => {
|
|
45
|
+
const _index = loop ? index.current % barrageList.length : index.current;
|
|
46
|
+
const el = document.createElement(`div`);
|
|
47
|
+
el.innerHTML = barrageList[_index];
|
|
48
|
+
el.classList.add('barrage-item');
|
|
49
|
+
barrageContainer.current.appendChild(el);
|
|
50
|
+
Taro.createSelectorQuery()
|
|
51
|
+
.select('.barrage-item')
|
|
52
|
+
.boundingClientRect((res) => {
|
|
53
|
+
console.log('res', res);
|
|
54
|
+
const height = res?.height;
|
|
55
|
+
el.classList.add('move');
|
|
56
|
+
el.style.animationDuration = `${speeds}ms`;
|
|
57
|
+
el.style.top = `${(_index % rows) * (height + top) + 20}px`;
|
|
58
|
+
el.dataset.index = `${_index}`;
|
|
59
|
+
el.addEventListener('animationend', () => {
|
|
60
|
+
barrageContainer.current.removeChild(el);
|
|
61
|
+
});
|
|
62
|
+
index.current++;
|
|
63
|
+
})
|
|
64
|
+
.exec();
|
|
90
65
|
};
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
className: classes,
|
|
94
|
-
ref: barrageBody
|
|
95
|
-
}, restProps), React__default.createElement("div", {
|
|
96
|
-
ref: barrageContainer,
|
|
97
|
-
className: "bContainer"
|
|
98
|
-
}));
|
|
66
|
+
return (React__default.createElement("div", { className: classes, ref: barrageBody, ...restProps },
|
|
67
|
+
React__default.createElement("div", { ref: barrageContainer, className: "bContainer" })));
|
|
99
68
|
};
|
|
100
|
-
|
|
69
|
+
const Barrage = React__default.forwardRef(InternalBarrage);
|
|
101
70
|
Barrage.defaultProps = defaultProps;
|
|
102
71
|
Barrage.displayName = 'NutBarrage';
|
|
72
|
+
|
|
103
73
|
export { Barrage as B };
|
package/dist/esm/bem-893ad28d.js
CHANGED
|
@@ -1,109 +1,98 @@
|
|
|
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", "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
1
|
import React__default, { useCallback, useState, useEffect } from 'react';
|
|
8
2
|
import { I as Icon } from './icon.taro-1d0d4fb7.js';
|
|
9
3
|
import { C as ComponentDefaults } from './typings-1c5f2628.js';
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
shape =
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
style
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
4
|
+
|
|
5
|
+
const defaultProps = {
|
|
6
|
+
...ComponentDefaults,
|
|
7
|
+
className: '',
|
|
8
|
+
color: '',
|
|
9
|
+
shape: 'round',
|
|
10
|
+
plain: false,
|
|
11
|
+
loading: false,
|
|
12
|
+
disabled: false,
|
|
13
|
+
type: 'default',
|
|
14
|
+
size: 'normal',
|
|
15
|
+
block: false,
|
|
16
|
+
icon: '',
|
|
17
|
+
style: {},
|
|
18
|
+
children: undefined,
|
|
19
|
+
onClick: (e) => { },
|
|
20
|
+
};
|
|
21
|
+
const Button = (props) => {
|
|
22
|
+
const { color, shape, plain, loading, disabled, type, size, block, icon, children, onClick, className, style, iconClassPrefix, iconFontClassName, ...rest } = {
|
|
23
|
+
...defaultProps,
|
|
24
|
+
...props,
|
|
25
|
+
};
|
|
26
|
+
const getStyle = useCallback(() => {
|
|
27
|
+
const style = {};
|
|
28
|
+
if (color) {
|
|
29
|
+
if (plain) {
|
|
30
|
+
style.color = color;
|
|
31
|
+
style.background = '#fff';
|
|
32
|
+
if (!color?.includes('gradient')) {
|
|
33
|
+
style.borderColor = color;
|
|
34
|
+
}
|
|
35
|
+
}
|
|
36
|
+
else {
|
|
37
|
+
style.color = '#fff';
|
|
38
|
+
style.background = color;
|
|
39
|
+
}
|
|
40
|
+
}
|
|
41
|
+
return style;
|
|
42
|
+
}, [color, plain]);
|
|
43
|
+
const classes = useCallback(() => {
|
|
44
|
+
const prefixCls = 'nut-button';
|
|
45
|
+
return [
|
|
46
|
+
prefixCls,
|
|
47
|
+
`${type ? `${prefixCls}--${type}` : ''}`,
|
|
48
|
+
`${size ? `${prefixCls}--${size}` : ''}`,
|
|
49
|
+
`${shape ? `${prefixCls}--${shape}` : ''}`,
|
|
50
|
+
`${plain ? `${prefixCls}--plain` : ''}`,
|
|
51
|
+
`${block ? `${prefixCls}--block` : ''}`,
|
|
52
|
+
`${disabled ? `${prefixCls}--disabled` : ''}`,
|
|
53
|
+
`${loading ? `${prefixCls}--loading` : ''}`,
|
|
54
|
+
]
|
|
55
|
+
.filter(Boolean)
|
|
56
|
+
.join(' ');
|
|
57
|
+
}, [block, disabled, loading, plain, shape, size, type]);
|
|
58
|
+
const [btnName, setBtnName] = useState(classes());
|
|
59
|
+
const [btnStyle, setBtnStyle] = useState(getStyle());
|
|
60
|
+
useEffect(() => {
|
|
61
|
+
setBtnName(classes());
|
|
62
|
+
setBtnStyle(getStyle());
|
|
63
|
+
}, [
|
|
64
|
+
className,
|
|
65
|
+
color,
|
|
66
|
+
shape,
|
|
67
|
+
plain,
|
|
68
|
+
loading,
|
|
69
|
+
disabled,
|
|
70
|
+
style,
|
|
71
|
+
type,
|
|
72
|
+
size,
|
|
73
|
+
block,
|
|
74
|
+
icon,
|
|
75
|
+
children,
|
|
76
|
+
onClick,
|
|
77
|
+
classes,
|
|
78
|
+
getStyle,
|
|
79
|
+
]);
|
|
80
|
+
const handleClick = (e) => {
|
|
81
|
+
if (!loading && !disabled && onClick) {
|
|
82
|
+
onClick(e);
|
|
51
83
|
}
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
style.background = color;
|
|
55
|
-
}
|
|
56
|
-
}
|
|
57
|
-
return style;
|
|
58
|
-
}, [color, plain]);
|
|
59
|
-
var classes = useCallback(function () {
|
|
60
|
-
var prefixCls = 'nut-button';
|
|
61
|
-
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(' ');
|
|
62
|
-
}, [block, disabled, loading, plain, shape, size, type]);
|
|
63
|
-
var _useState = useState(classes()),
|
|
64
|
-
_useState2 = _slicedToArray(_useState, 2),
|
|
65
|
-
btnName = _useState2[0],
|
|
66
|
-
setBtnName = _useState2[1];
|
|
67
|
-
var _useState3 = useState(getStyle()),
|
|
68
|
-
_useState4 = _slicedToArray(_useState3, 2),
|
|
69
|
-
btnStyle = _useState4[0],
|
|
70
|
-
setBtnStyle = _useState4[1];
|
|
71
|
-
useEffect(function () {
|
|
72
|
-
setBtnName(classes());
|
|
73
|
-
setBtnStyle(getStyle());
|
|
74
|
-
}, [className, color, shape, plain, loading, disabled, style, type, size, block, icon, children, onClick, classes, getStyle]);
|
|
75
|
-
var handleClick = function handleClick(e) {
|
|
76
|
-
if (!loading && !disabled && onClick) {
|
|
77
|
-
onClick(e);
|
|
78
|
-
}
|
|
79
|
-
};
|
|
80
|
-
return (
|
|
84
|
+
};
|
|
85
|
+
return (
|
|
81
86
|
// eslint-disable-next-line @typescript-eslint/ban-ts-comment
|
|
82
87
|
// @ts-ignore
|
|
83
88
|
// eslint-disable-next-line react/button-has-type
|
|
84
|
-
React__default.createElement("button",
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
return handleClick(e);
|
|
90
|
-
}
|
|
91
|
-
}), React__default.createElement("div", {
|
|
92
|
-
className: "nut-button__warp",
|
|
93
|
-
style: getStyle()
|
|
94
|
-
}, loading && React__default.createElement(Icon, {
|
|
95
|
-
classPrefix: iconClassPrefix,
|
|
96
|
-
fontClassName: iconFontClassName,
|
|
97
|
-
name: "loading"
|
|
98
|
-
}), !loading && icon ? React__default.createElement(Icon, {
|
|
99
|
-
classPrefix: iconClassPrefix,
|
|
100
|
-
fontClassName: iconFontClassName,
|
|
101
|
-
name: icon
|
|
102
|
-
}) : '', children && React__default.createElement("div", {
|
|
103
|
-
className: icon || loading ? 'text' : ''
|
|
104
|
-
}, children)))
|
|
105
|
-
);
|
|
89
|
+
React__default.createElement("button", { className: `${btnName} ${className}`, style: { ...btnStyle, ...style }, ...rest, onClick: (e) => handleClick(e) },
|
|
90
|
+
React__default.createElement("div", { className: "nut-button__warp", style: getStyle() },
|
|
91
|
+
loading && (React__default.createElement(Icon, { classPrefix: iconClassPrefix, fontClassName: iconFontClassName, name: "loading" })),
|
|
92
|
+
!loading && icon ? (React__default.createElement(Icon, { classPrefix: iconClassPrefix, fontClassName: iconFontClassName, name: icon })) : (''),
|
|
93
|
+
children && (React__default.createElement("div", { className: icon || loading ? 'text' : '' }, children)))));
|
|
106
94
|
};
|
|
107
95
|
Button.defaultProps = defaultProps;
|
|
108
96
|
Button.displayName = 'NutButton';
|
|
97
|
+
|
|
109
98
|
export { Button as B };
|