@nutui/nutui-react 1.3.5 → 1.3.6
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 +7 -0
- package/dist/esm/ActionSheet.js +15 -25
- package/dist/esm/Address.js +151 -221
- package/dist/esm/AnimatingNumbers.js +7 -31
- package/dist/esm/Audio.js +31 -66
- package/dist/esm/Avatar.js +25 -51
- package/dist/esm/AvatarGroup.js +2 -9
- package/dist/esm/BackTop.js +29 -55
- package/dist/esm/Badge.js +9 -20
- package/dist/esm/Barrage.js +8 -20
- package/dist/esm/Button.js +22 -37
- package/dist/esm/Calendar.js +23 -37
- package/dist/esm/CalendarItem.js +86 -186
- package/dist/esm/Card.js +14 -20
- package/dist/esm/Cascader.js +77 -197
- package/dist/esm/Cell.js +20 -30
- package/dist/esm/CellGroup.js +6 -12
- package/dist/esm/Checkbox.js +27 -48
- package/dist/esm/CheckboxGroup.js +12 -30
- package/dist/esm/CircleProgress.js +11 -28
- package/dist/esm/Col.js +11 -22
- package/dist/esm/Collapse.js +11 -27
- package/dist/esm/CollapseItem.js +33 -47
- package/dist/esm/ConfigProvider.js +4 -15
- package/dist/esm/CountDown.js +37 -74
- package/dist/esm/DatePicker.js +44 -106
- package/dist/esm/Dialog.js +31 -89
- package/dist/esm/Divider.js +8 -15
- package/dist/esm/Drag.js +30 -45
- package/dist/esm/Elevator.js +37 -74
- package/dist/esm/Empty.js +11 -24
- package/dist/esm/FixedNav.js +18 -29
- package/dist/esm/Grid.js +13 -28
- package/dist/esm/GridItem.js +18 -34
- package/dist/esm/ImagePreview.js +36 -71
- package/dist/esm/Indicator.js +9 -20
- package/dist/esm/Infiniteloading.js +26 -55
- package/dist/esm/Input.js +62 -106
- package/dist/esm/InputNumber.js +25 -52
- package/dist/esm/Layout.js +0 -6
- package/dist/esm/Menu.js +24 -46
- package/dist/esm/MenuItem.js +29 -52
- package/dist/esm/NavBar.js +18 -34
- package/dist/esm/NoticeBar.js +54 -102
- package/dist/esm/Notify.js +9 -38
- package/dist/esm/NumberKeyboard.js +21 -52
- package/dist/esm/Pagination.js +38 -71
- package/dist/esm/Picker.js +91 -178
- package/dist/esm/Popover.js +32 -72
- package/dist/esm/Popup.js +40 -72
- package/dist/esm/Price.js +7 -24
- package/dist/esm/Progress.js +35 -50
- package/dist/esm/PullToRefresh.js +28 -83
- package/dist/esm/Radio.js +24 -47
- package/dist/esm/RadioGroup.js +14 -24
- package/dist/esm/Range.js +44 -116
- package/dist/esm/Rate.js +21 -39
- package/dist/esm/Row.js +7 -16
- package/dist/esm/SearchBar.js +47 -68
- package/dist/esm/ShortPassword.js +29 -56
- package/dist/esm/SideNavBar.js +9 -16
- package/dist/esm/SideNavBarItem.js +4 -11
- package/dist/esm/Signature.js +13 -43
- package/dist/esm/Skeleton.js +13 -23
- package/dist/esm/Step.js +12 -28
- package/dist/esm/Steps.js +6 -14
- package/dist/esm/Sticky.js +24 -52
- package/dist/esm/SubSideNavBar.js +7 -22
- package/dist/esm/Swipe.js +15 -54
- package/dist/esm/Swiper.js +102 -186
- package/dist/esm/SwiperItem.js +2 -12
- package/dist/esm/Switch.js +13 -27
- package/dist/esm/Tabbar.js +13 -25
- package/dist/esm/TabbarItem.js +15 -23
- package/dist/esm/Table.js +19 -39
- package/dist/esm/Tag.js +19 -36
- package/dist/esm/TextArea.js +19 -43
- package/dist/esm/TimeDetail.js +15 -28
- package/dist/esm/TimePannel.js +5 -12
- package/dist/esm/TimeSelect.js +35 -59
- package/dist/esm/Toast.js +16 -49
- package/dist/esm/Uploader.js +57 -152
- package/dist/esm/Video.js +8 -19
- package/dist/esm/VirtualList.js +84 -118
- package/dist/esm/date-710f8c7c.js +9 -33
- package/dist/esm/get-scroll-parent-3dcd3f53.js +1 -9
- package/dist/esm/icon-8dc4de10.js +11 -21
- package/dist/esm/offsetContext-0e3d04b3.js +0 -3
- package/dist/esm/overlay-ed3eb37d.js +12 -23
- package/dist/esm/render-18227751.js +0 -11
- package/dist/esm/tabpane-c957ab14.js +4 -10
- package/dist/esm/tabs-0896a61b.js +28 -56
- package/dist/esm/types/src/packages/elevator/demo.d.ts +1 -0
- package/dist/esm/types/src/packages/searchbar/searchbar.d.ts +2 -0
- package/dist/esm/useClientRect-839d18c5.js +0 -5
- package/dist/esm/useTouch-a2ea68c6.js +27 -47
- 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/nutui.react.es.js +424 -406
- package/dist/nutui.react.umd.js +416 -398
- package/dist/packages/searchbar/searchbar.scss +20 -3
- package/dist/style.css +1 -1
- package/dist/style.es.js +1 -1
- package/dist/types/index.d.ts +2 -0
- package/package.json +1 -1
package/dist/esm/Divider.js
CHANGED
|
@@ -1,11 +1,8 @@
|
|
|
1
1
|
import _defineProperty from "@babel/runtime/helpers/defineProperty";
|
|
2
2
|
import _objectWithoutProperties from "@babel/runtime/helpers/objectWithoutProperties";
|
|
3
3
|
var _excluded = ["children", "contentPosition", "dashed", "hairline", "styles", "className", "direction"];
|
|
4
|
-
|
|
5
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; }
|
|
6
|
-
|
|
7
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; }
|
|
8
|
-
|
|
9
6
|
import React__default from 'react';
|
|
10
7
|
import classNames from 'classnames';
|
|
11
8
|
import { c as cn } from './bem-893ad28d.js';
|
|
@@ -16,20 +13,17 @@ var defaultProps = {
|
|
|
16
13
|
hairline: true,
|
|
17
14
|
direction: 'horizontal'
|
|
18
15
|
};
|
|
19
|
-
|
|
20
16
|
var Divider = function Divider(props) {
|
|
21
17
|
var _classNames, _classNames2;
|
|
22
|
-
|
|
23
18
|
var _defaultProps$props = _objectSpread(_objectSpread({}, defaultProps), props),
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
19
|
+
children = _defaultProps$props.children,
|
|
20
|
+
contentPosition = _defaultProps$props.contentPosition,
|
|
21
|
+
dashed = _defaultProps$props.dashed,
|
|
22
|
+
hairline = _defaultProps$props.hairline,
|
|
23
|
+
styles = _defaultProps$props.styles,
|
|
24
|
+
className = _defaultProps$props.className,
|
|
25
|
+
direction = _defaultProps$props.direction,
|
|
26
|
+
rest = _objectWithoutProperties(_defaultProps$props, _excluded);
|
|
33
27
|
var dividerBem = cn('divider');
|
|
34
28
|
var classes = direction === 'horizontal' ? classNames((_classNames = {}, _defineProperty(_classNames, dividerBem(), true), _defineProperty(_classNames, dividerBem('center'), children), _defineProperty(_classNames, dividerBem('left'), contentPosition === 'left'), _defineProperty(_classNames, dividerBem('right'), contentPosition === 'right'), _defineProperty(_classNames, dividerBem('dashed'), dashed), _defineProperty(_classNames, dividerBem('hairline'), hairline), _classNames)) : classNames((_classNames2 = {}, _defineProperty(_classNames2, dividerBem(), true), _defineProperty(_classNames2, dividerBem('vertical'), direction === 'vertical'), _classNames2));
|
|
35
29
|
return React__default.createElement("div", _objectSpread({
|
|
@@ -37,7 +31,6 @@ var Divider = function Divider(props) {
|
|
|
37
31
|
style: styles
|
|
38
32
|
}, rest), children);
|
|
39
33
|
};
|
|
40
|
-
|
|
41
34
|
Divider.defaultProps = defaultProps;
|
|
42
35
|
Divider.displayName = 'NutDivider';
|
|
43
36
|
export { Divider as default };
|
package/dist/esm/Drag.js
CHANGED
|
@@ -2,11 +2,8 @@ import _slicedToArray from "@babel/runtime/helpers/slicedToArray";
|
|
|
2
2
|
import _defineProperty from "@babel/runtime/helpers/defineProperty";
|
|
3
3
|
import _objectWithoutProperties from "@babel/runtime/helpers/objectWithoutProperties";
|
|
4
4
|
var _excluded = ["attract", "direction", "boundary", "children", "className", "style"];
|
|
5
|
-
|
|
6
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; }
|
|
7
|
-
|
|
8
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; }
|
|
9
|
-
|
|
10
7
|
import React__default, { useState, useRef, useEffect } from 'react';
|
|
11
8
|
import { useDrag } from '@use-gesture/react';
|
|
12
9
|
import { useSpring, animated } from '@react-spring/web';
|
|
@@ -23,53 +20,45 @@ var defaultProps = {
|
|
|
23
20
|
},
|
|
24
21
|
className: ''
|
|
25
22
|
};
|
|
26
|
-
|
|
27
23
|
var Drag = function Drag(props) {
|
|
28
24
|
var _defaultProps$props = _objectSpread(_objectSpread({}, defaultProps), props),
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
25
|
+
attract = _defaultProps$props.attract,
|
|
26
|
+
direction = _defaultProps$props.direction,
|
|
27
|
+
boundary = _defaultProps$props.boundary,
|
|
28
|
+
children = _defaultProps$props.children,
|
|
29
|
+
className = _defaultProps$props.className,
|
|
30
|
+
style = _defaultProps$props.style,
|
|
31
|
+
reset = _objectWithoutProperties(_defaultProps$props, _excluded);
|
|
37
32
|
var b = cn('drag');
|
|
38
|
-
|
|
39
33
|
var _useState = useState(boundary),
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
34
|
+
_useState2 = _slicedToArray(_useState, 2),
|
|
35
|
+
boundaryState = _useState2[0],
|
|
36
|
+
setBoundaryState = _useState2[1];
|
|
44
37
|
var myDrag = useRef(null);
|
|
45
|
-
|
|
46
38
|
var _useSpring = useSpring(function () {
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
39
|
+
return {
|
|
40
|
+
x: 0,
|
|
41
|
+
y: 0
|
|
42
|
+
};
|
|
43
|
+
}),
|
|
44
|
+
_useSpring2 = _slicedToArray(_useSpring, 2),
|
|
45
|
+
currstyle = _useSpring2[0],
|
|
46
|
+
api = _useSpring2[1];
|
|
56
47
|
var middleLine = useRef(0);
|
|
57
|
-
|
|
58
48
|
var getInfo = function getInfo() {
|
|
59
49
|
var el = myDrag.current;
|
|
60
|
-
|
|
61
50
|
if (el) {
|
|
62
51
|
var offsetWidth = el.offsetWidth,
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
52
|
+
offsetHeight = el.offsetHeight,
|
|
53
|
+
offsetTop = el.offsetTop,
|
|
54
|
+
offsetLeft = el.offsetLeft;
|
|
66
55
|
var _document$documentEle = document.documentElement,
|
|
67
|
-
|
|
68
|
-
|
|
56
|
+
clientWidth = _document$documentEle.clientWidth,
|
|
57
|
+
clientHeight = _document$documentEle.clientHeight;
|
|
69
58
|
var top = boundary.top,
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
59
|
+
left = boundary.left,
|
|
60
|
+
bottom = boundary.bottom,
|
|
61
|
+
right = boundary.right;
|
|
73
62
|
setBoundaryState({
|
|
74
63
|
top: -offsetTop + top,
|
|
75
64
|
left: -offsetLeft + left,
|
|
@@ -79,20 +68,17 @@ var Drag = function Drag(props) {
|
|
|
79
68
|
middleLine.current = clientWidth - offsetWidth - offsetLeft - (clientWidth - offsetWidth) / 2;
|
|
80
69
|
}
|
|
81
70
|
};
|
|
82
|
-
|
|
83
71
|
var bind = useDrag(function (_ref) {
|
|
84
72
|
var down = _ref.down,
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
73
|
+
last = _ref.last,
|
|
74
|
+
_ref$offset = _slicedToArray(_ref.offset, 2),
|
|
75
|
+
x = _ref$offset[0],
|
|
76
|
+
y = _ref$offset[1];
|
|
90
77
|
api.start({
|
|
91
78
|
x: x,
|
|
92
79
|
y: y,
|
|
93
80
|
immediate: down
|
|
94
81
|
});
|
|
95
|
-
|
|
96
82
|
if (last) {
|
|
97
83
|
if (props.direction !== 'y' && props.attract) {
|
|
98
84
|
if (x < middleLine.current) {
|
|
@@ -129,7 +115,6 @@ var Drag = function Drag(props) {
|
|
|
129
115
|
style: currstyle
|
|
130
116
|
}, bind()), children));
|
|
131
117
|
};
|
|
132
|
-
|
|
133
118
|
Drag.defaultProps = defaultProps;
|
|
134
119
|
Drag.displayName = 'NutDrag';
|
|
135
120
|
export { Drag as default };
|
package/dist/esm/Elevator.js
CHANGED
|
@@ -2,11 +2,8 @@ import _slicedToArray from "@babel/runtime/helpers/slicedToArray";
|
|
|
2
2
|
import _defineProperty from "@babel/runtime/helpers/defineProperty";
|
|
3
3
|
import _objectWithoutProperties from "@babel/runtime/helpers/objectWithoutProperties";
|
|
4
4
|
var _excluded = ["height", "acceptKey", "indexList", "isSticky", "spaceHeight", "titleHeight", "className", "onClickItem", "onClickIndex", "children"];
|
|
5
|
-
|
|
6
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; }
|
|
7
|
-
|
|
8
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; }
|
|
9
|
-
|
|
10
7
|
import React__default, { createContext, useRef, useState, useEffect } from 'react';
|
|
11
8
|
import { useGesture } from '@use-gesture/react';
|
|
12
9
|
import { animated } from '@react-spring/web';
|
|
@@ -22,21 +19,19 @@ var defaultProps = {
|
|
|
22
19
|
titleHeight: 35,
|
|
23
20
|
className: ''
|
|
24
21
|
};
|
|
25
|
-
|
|
26
22
|
var Elevator = function Elevator(props) {
|
|
27
23
|
var _defaultProps$props = _objectSpread(_objectSpread({}, defaultProps), props),
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
24
|
+
height = _defaultProps$props.height,
|
|
25
|
+
acceptKey = _defaultProps$props.acceptKey,
|
|
26
|
+
indexList = _defaultProps$props.indexList,
|
|
27
|
+
isSticky = _defaultProps$props.isSticky,
|
|
28
|
+
spaceHeight = _defaultProps$props.spaceHeight,
|
|
29
|
+
titleHeight = _defaultProps$props.titleHeight,
|
|
30
|
+
className = _defaultProps$props.className,
|
|
31
|
+
onClickItem = _defaultProps$props.onClickItem,
|
|
32
|
+
onClickIndex = _defaultProps$props.onClickIndex,
|
|
33
|
+
children = _defaultProps$props.children,
|
|
34
|
+
rest = _objectWithoutProperties(_defaultProps$props, _excluded);
|
|
40
35
|
var b = cn('elevator');
|
|
41
36
|
var listview = useRef(null);
|
|
42
37
|
var initData = {
|
|
@@ -51,93 +46,74 @@ var Elevator = function Elevator(props) {
|
|
|
51
46
|
y1: 0,
|
|
52
47
|
y2: 0
|
|
53
48
|
});
|
|
54
|
-
|
|
55
49
|
var _useState = useState(0),
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
50
|
+
_useState2 = _slicedToArray(_useState, 2),
|
|
51
|
+
scrollY = _useState2[0],
|
|
52
|
+
setScrollY = _useState2[1];
|
|
60
53
|
var _useState3 = useState({}),
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
54
|
+
_useState4 = _slicedToArray(_useState3, 2),
|
|
55
|
+
currentData = _useState4[0],
|
|
56
|
+
setCurrentData = _useState4[1];
|
|
65
57
|
var _useState5 = useState(''),
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
58
|
+
_useState6 = _slicedToArray(_useState5, 2),
|
|
59
|
+
currentKey = _useState6[0],
|
|
60
|
+
setCurrentKey = _useState6[1];
|
|
70
61
|
var _useState7 = useState(0),
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
62
|
+
_useState8 = _slicedToArray(_useState7, 2),
|
|
63
|
+
currentIndex = _useState8[0],
|
|
64
|
+
setCurrentIndex = _useState8[1];
|
|
75
65
|
var _useState9 = useState(0),
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
66
|
+
_useState10 = _slicedToArray(_useState9, 2),
|
|
67
|
+
codeIndex = _useState10[0],
|
|
68
|
+
setCodeIndex = _useState10[1];
|
|
80
69
|
var _useState11 = useState(false),
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
70
|
+
_useState12 = _slicedToArray(_useState11, 2),
|
|
71
|
+
scrollStart = _useState12[0],
|
|
72
|
+
setScrollStart = _useState12[1];
|
|
73
|
+
var state = useRef(initData);
|
|
74
|
+
// 重置滚动参数
|
|
87
75
|
var resetScrollState = function resetScrollState() {
|
|
88
76
|
setScrollStart(false);
|
|
89
77
|
};
|
|
90
|
-
|
|
91
78
|
var clientHeight = function clientHeight() {
|
|
92
79
|
return listview.current ? listview.current.clientHeight : 0;
|
|
93
80
|
};
|
|
94
|
-
|
|
95
81
|
var getData = function getData(el, name) {
|
|
96
82
|
var prefix = 'data-';
|
|
97
83
|
return el.getAttribute(prefix + name);
|
|
98
84
|
};
|
|
99
|
-
|
|
100
85
|
var calculateHeight = function calculateHeight() {
|
|
101
86
|
var height = 0;
|
|
102
87
|
state.current.listHeight.push(height);
|
|
103
|
-
|
|
104
88
|
for (var i = 0; i < state.current.listGroup.length; i++) {
|
|
105
89
|
var item = state.current.listGroup[i];
|
|
106
90
|
height += item.clientHeight;
|
|
107
91
|
state.current.listHeight.push(height);
|
|
108
92
|
}
|
|
109
93
|
};
|
|
110
|
-
|
|
111
94
|
var scrollTo = function scrollTo(index) {
|
|
112
95
|
if (!index && index !== 0) {
|
|
113
96
|
return;
|
|
114
97
|
}
|
|
115
|
-
|
|
116
98
|
if (!state.current.listHeight.length) {
|
|
117
99
|
calculateHeight();
|
|
118
100
|
}
|
|
119
|
-
|
|
120
101
|
var cacheIndex = index;
|
|
121
|
-
|
|
122
102
|
if (index < 0) {
|
|
123
103
|
cacheIndex = 0;
|
|
124
104
|
}
|
|
125
|
-
|
|
126
105
|
if (index > state.current.listHeight.length - 2) {
|
|
127
106
|
cacheIndex = state.current.listHeight.length - 2;
|
|
128
107
|
}
|
|
129
|
-
|
|
130
108
|
setCodeIndex(cacheIndex);
|
|
131
|
-
|
|
132
109
|
if (listview.current) {
|
|
133
110
|
listview.current.scrollTo(0, state.current.listHeight[cacheIndex]);
|
|
134
111
|
}
|
|
135
112
|
};
|
|
136
|
-
|
|
137
113
|
var bind = useGesture({
|
|
138
114
|
onDragStart: function onDragStart(_ref) {
|
|
139
115
|
var target = _ref.target,
|
|
140
|
-
|
|
116
|
+
offset = _ref.offset;
|
|
141
117
|
setScrollStart(true);
|
|
142
118
|
var index = Number(getData(target, 'index'));
|
|
143
119
|
touchState.current.y1 = offset[1];
|
|
@@ -150,25 +126,22 @@ var Elevator = function Elevator(props) {
|
|
|
150
126
|
onDragEnd: function onDragEnd(_ref2) {
|
|
151
127
|
var offset = _ref2.offset;
|
|
152
128
|
touchState.current.y2 = offset[1];
|
|
153
|
-
var delta = (touchState.current.y2 - touchState.current.y1) / spaceHeight || 0;
|
|
154
|
-
|
|
129
|
+
var delta = (touchState.current.y2 - touchState.current.y1) / spaceHeight || 0;
|
|
130
|
+
// delta 是一个浮点数, 需要四舍五入一下, 否则页面会找不到最终计算后的index
|
|
155
131
|
var cacheIndex = state.current.anchorIndex + Math.ceil(delta);
|
|
156
132
|
setCodeIndex(cacheIndex);
|
|
157
133
|
scrollTo(cacheIndex);
|
|
158
134
|
resetScrollState();
|
|
159
135
|
}
|
|
160
136
|
});
|
|
161
|
-
|
|
162
137
|
var handleClickItem = function handleClickItem(key, item) {
|
|
163
138
|
onClickItem && onClickItem(key, item);
|
|
164
139
|
setCurrentData(item);
|
|
165
140
|
setCurrentKey(key);
|
|
166
141
|
};
|
|
167
|
-
|
|
168
142
|
var handleClickIndex = function handleClickIndex(key) {
|
|
169
143
|
onClickIndex && onClickIndex(key);
|
|
170
144
|
};
|
|
171
|
-
|
|
172
145
|
var setListGroup = function setListGroup() {
|
|
173
146
|
if (listview.current) {
|
|
174
147
|
var els = listview.current.querySelectorAll('.nut-elevator__list__item');
|
|
@@ -179,33 +152,26 @@ var Elevator = function Elevator(props) {
|
|
|
179
152
|
});
|
|
180
153
|
}
|
|
181
154
|
};
|
|
182
|
-
|
|
183
155
|
var listViewScroll = function listViewScroll(e) {
|
|
184
156
|
var listHeight = state.current.listHeight;
|
|
185
|
-
|
|
186
157
|
if (!listHeight.length) {
|
|
187
158
|
calculateHeight();
|
|
188
159
|
}
|
|
189
|
-
|
|
190
160
|
var target = e.target;
|
|
191
161
|
var scrollTop = target.scrollTop;
|
|
192
162
|
state.current.scrollY = scrollTop;
|
|
193
163
|
setScrollY(scrollTop);
|
|
194
|
-
|
|
195
164
|
for (var i = 0; i < listHeight.length - 1; i++) {
|
|
196
165
|
var height1 = listHeight[i];
|
|
197
166
|
var height2 = listHeight[i + 1];
|
|
198
|
-
|
|
199
167
|
if (state.current.scrollY >= height1 && state.current.scrollY < height2) {
|
|
200
168
|
setCurrentIndex(i);
|
|
201
169
|
state.current.diff = height2 - state.current.scrollY;
|
|
202
170
|
return;
|
|
203
171
|
}
|
|
204
172
|
}
|
|
205
|
-
|
|
206
173
|
setCurrentIndex(listHeight.length - 2);
|
|
207
174
|
};
|
|
208
|
-
|
|
209
175
|
useEffect(function () {
|
|
210
176
|
if (listview.current) {
|
|
211
177
|
setListGroup();
|
|
@@ -214,17 +180,15 @@ var Elevator = function Elevator(props) {
|
|
|
214
180
|
}, [listview]);
|
|
215
181
|
useEffect(function () {
|
|
216
182
|
var _state$current = state.current,
|
|
217
|
-
|
|
218
|
-
|
|
219
|
-
|
|
183
|
+
listHeight = _state$current.listHeight,
|
|
184
|
+
diff = _state$current.diff,
|
|
185
|
+
scrollY = _state$current.scrollY;
|
|
220
186
|
var fixedTop = diff > 0 && diff < titleHeight ? diff - titleHeight : 0;
|
|
221
|
-
|
|
222
187
|
if (scrollY + clientHeight() === listHeight[listHeight.length - 1]) {
|
|
223
188
|
if (fixedTop !== 0) {
|
|
224
189
|
fixedTop = 0;
|
|
225
190
|
}
|
|
226
191
|
}
|
|
227
|
-
|
|
228
192
|
if (state.current.fixedTop === fixedTop) return;
|
|
229
193
|
state.current.fixedTop = fixedTop;
|
|
230
194
|
}, [state.current.diff, titleHeight]);
|
|
@@ -286,7 +250,6 @@ var Elevator = function Elevator(props) {
|
|
|
286
250
|
}, item[acceptKey]);
|
|
287
251
|
}))));
|
|
288
252
|
};
|
|
289
|
-
|
|
290
253
|
Elevator.defaultProps = defaultProps;
|
|
291
254
|
Elevator.displayName = 'NutElevator';
|
|
292
255
|
export { Elevator as default };
|
package/dist/esm/Empty.js
CHANGED
|
@@ -2,19 +2,16 @@ import _slicedToArray from "@babel/runtime/helpers/slicedToArray";
|
|
|
2
2
|
import _defineProperty from "@babel/runtime/helpers/defineProperty";
|
|
3
3
|
import _objectWithoutProperties from "@babel/runtime/helpers/objectWithoutProperties";
|
|
4
4
|
var _excluded = ["image", "imageSize", "description", "children", "className"];
|
|
5
|
-
|
|
6
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; }
|
|
7
|
-
|
|
8
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; }
|
|
9
|
-
|
|
10
7
|
import React__default, { useState, useEffect } from 'react';
|
|
11
8
|
import { c as cn } from './bem-893ad28d.js';
|
|
12
9
|
import { useConfig } from './ConfigProvider.js';
|
|
13
10
|
import '@bem-react/classname';
|
|
11
|
+
|
|
14
12
|
/**
|
|
15
13
|
* 内置图片地址
|
|
16
14
|
*/
|
|
17
|
-
|
|
18
15
|
var defaultStatus = {
|
|
19
16
|
empty: 'https://static-ftcms.jd.com/p/files/61a9e3183985005b3958672b.png',
|
|
20
17
|
error: 'https://ftcms.jd.com/p/files/61a9e33ee7dcdbcc0ce62736.png',
|
|
@@ -26,29 +23,23 @@ var defaultProps = {
|
|
|
26
23
|
imageSize: '',
|
|
27
24
|
className: ''
|
|
28
25
|
};
|
|
29
|
-
|
|
30
26
|
var Empty = function Empty(props) {
|
|
31
27
|
var _useConfig = useConfig(),
|
|
32
|
-
|
|
33
|
-
|
|
28
|
+
locale = _useConfig.locale;
|
|
34
29
|
defaultProps.description = locale.noData || defaultProps.description;
|
|
35
|
-
|
|
36
30
|
var _defaultProps$props = _objectSpread(_objectSpread({}, defaultProps), props),
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
31
|
+
image = _defaultProps$props.image,
|
|
32
|
+
imageSize = _defaultProps$props.imageSize,
|
|
33
|
+
description = _defaultProps$props.description,
|
|
34
|
+
children = _defaultProps$props.children,
|
|
35
|
+
className = _defaultProps$props.className,
|
|
36
|
+
rest = _objectWithoutProperties(_defaultProps$props, _excluded);
|
|
44
37
|
var _useState = useState({}),
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
38
|
+
_useState2 = _slicedToArray(_useState, 2),
|
|
39
|
+
imgStyle = _useState2[0],
|
|
40
|
+
setImgStyle = _useState2[1];
|
|
49
41
|
var b = cn('empty');
|
|
50
42
|
var imageNode = image;
|
|
51
|
-
|
|
52
43
|
if (typeof image === 'string') {
|
|
53
44
|
var isHttpUrl = image.startsWith('https://') || image.startsWith('http://') || image.startsWith('//');
|
|
54
45
|
var imageUrl = isHttpUrl ? image : defaultStatus[image];
|
|
@@ -58,20 +49,17 @@ var Empty = function Empty(props) {
|
|
|
58
49
|
alt: "empty"
|
|
59
50
|
});
|
|
60
51
|
}
|
|
61
|
-
|
|
62
52
|
useEffect(function () {
|
|
63
53
|
setImgStyle(function () {
|
|
64
54
|
if (!imageSize) {
|
|
65
55
|
return {};
|
|
66
56
|
}
|
|
67
|
-
|
|
68
57
|
if (typeof imageSize === 'number') {
|
|
69
58
|
return {
|
|
70
59
|
width: "".concat(imageSize, "px"),
|
|
71
60
|
height: "".concat(imageSize, "px")
|
|
72
61
|
};
|
|
73
62
|
}
|
|
74
|
-
|
|
75
63
|
return {
|
|
76
64
|
width: imageSize,
|
|
77
65
|
height: imageSize
|
|
@@ -89,7 +77,6 @@ var Empty = function Empty(props) {
|
|
|
89
77
|
description: description
|
|
90
78
|
}, children));
|
|
91
79
|
};
|
|
92
|
-
|
|
93
80
|
Empty.defaultProps = defaultProps;
|
|
94
81
|
Empty.displayName = 'NutEmpty';
|
|
95
82
|
export { Empty as default };
|
package/dist/esm/FixedNav.js
CHANGED
|
@@ -1,11 +1,8 @@
|
|
|
1
1
|
import _objectWithoutProperties from "@babel/runtime/helpers/objectWithoutProperties";
|
|
2
2
|
import _defineProperty from "@babel/runtime/helpers/defineProperty";
|
|
3
3
|
var _excluded = ["fixednavClass", "overlay", "visible", "navList", "activeText", "unActiveText", "position", "onChange", "onSelected", "type", "slotList", "slotBtn", "iconClassPrefix", "iconFontClassName"];
|
|
4
|
-
|
|
5
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; }
|
|
6
|
-
|
|
7
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; }
|
|
8
|
-
|
|
9
6
|
import React__default from 'react';
|
|
10
7
|
import classNames from 'classnames';
|
|
11
8
|
import Icon from './Icon.js';
|
|
@@ -14,7 +11,6 @@ import { c as cn } from './bem-893ad28d.js';
|
|
|
14
11
|
import { useConfig } from './ConfigProvider.js';
|
|
15
12
|
import { C as ComponentDefaults } from './typings-1c5f2628.js';
|
|
16
13
|
import '@bem-react/classname';
|
|
17
|
-
|
|
18
14
|
var defaultProps = _objectSpread(_objectSpread({}, ComponentDefaults), {}, {
|
|
19
15
|
fixednavClass: 'nut-fixednav',
|
|
20
16
|
activeText: '',
|
|
@@ -25,49 +21,43 @@ var defaultProps = _objectSpread(_objectSpread({}, ComponentDefaults), {}, {
|
|
|
25
21
|
bottom: 'auto'
|
|
26
22
|
}
|
|
27
23
|
});
|
|
28
|
-
|
|
29
24
|
var FixedNav = function FixedNav(props) {
|
|
30
25
|
var _useConfig = useConfig(),
|
|
31
|
-
|
|
32
|
-
|
|
26
|
+
locale = _useConfig.locale;
|
|
33
27
|
var _defaultProps$props = _objectSpread(_objectSpread({}, defaultProps), props),
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
28
|
+
fixednavClass = _defaultProps$props.fixednavClass,
|
|
29
|
+
overlay = _defaultProps$props.overlay,
|
|
30
|
+
visible = _defaultProps$props.visible,
|
|
31
|
+
navList = _defaultProps$props.navList,
|
|
32
|
+
activeText = _defaultProps$props.activeText,
|
|
33
|
+
unActiveText = _defaultProps$props.unActiveText,
|
|
34
|
+
position = _defaultProps$props.position,
|
|
35
|
+
onChange = _defaultProps$props.onChange,
|
|
36
|
+
onSelected = _defaultProps$props.onSelected,
|
|
37
|
+
type = _defaultProps$props.type,
|
|
38
|
+
slotList = _defaultProps$props.slotList,
|
|
39
|
+
slotBtn = _defaultProps$props.slotBtn,
|
|
40
|
+
iconClassPrefix = _defaultProps$props.iconClassPrefix,
|
|
41
|
+
iconFontClassName = _defaultProps$props.iconFontClassName,
|
|
42
|
+
rest = _objectWithoutProperties(_defaultProps$props, _excluded);
|
|
50
43
|
var b = cn('fixednav');
|
|
51
44
|
var classes = classNames({
|
|
52
45
|
active: visible
|
|
53
46
|
}, type, fixednavClass, b(''));
|
|
54
|
-
|
|
55
47
|
var onSelectCb = function onSelectCb(event, item) {
|
|
56
48
|
onSelected(item, event);
|
|
57
49
|
};
|
|
58
|
-
|
|
59
50
|
var onUpdateValue = function onUpdateValue() {
|
|
60
51
|
var value = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : !visible;
|
|
61
52
|
onChange(value);
|
|
62
|
-
};
|
|
53
|
+
};
|
|
54
|
+
// const [classNames, setClassNames] = useState('')
|
|
63
55
|
// const classes = () => {
|
|
64
56
|
// return `${fixednavClass} ${type} ${visible ? 'active' : ''}`
|
|
65
57
|
// }
|
|
66
58
|
// useEffect(() => {
|
|
67
59
|
// setClassNames(classes())
|
|
68
60
|
// }, [visible])
|
|
69
|
-
|
|
70
|
-
|
|
71
61
|
return React__default.createElement("div", _objectSpread({
|
|
72
62
|
className: classes,
|
|
73
63
|
style: position
|
|
@@ -110,7 +100,6 @@ var FixedNav = function FixedNav(props) {
|
|
|
110
100
|
className: "text"
|
|
111
101
|
}, visible ? activeText || locale.fixednav.activeText : unActiveText || locale.fixednav.unActiveText))));
|
|
112
102
|
};
|
|
113
|
-
|
|
114
103
|
FixedNav.defaultProps = defaultProps;
|
|
115
104
|
FixedNav.displayName = 'NutFixedNav';
|
|
116
105
|
export { FixedNav as default };
|