@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,158 @@
|
|
|
1
|
+
import React__default, { useState, useEffect } from 'react';
|
|
2
|
+
import classNames from 'classnames';
|
|
3
|
+
import { c as cn } from './bem-893ad28d.js';
|
|
4
|
+
import { P as Popup } from './popup.taro-cb777e09.js';
|
|
5
|
+
import { u as useConfig } from './configprovider.taro-26882dd2.js';
|
|
6
|
+
|
|
7
|
+
const defaultProps = {
|
|
8
|
+
confirmText: '',
|
|
9
|
+
title: '',
|
|
10
|
+
visible: false,
|
|
11
|
+
type: 'default',
|
|
12
|
+
customKey: [],
|
|
13
|
+
className: '',
|
|
14
|
+
randomKeys: false,
|
|
15
|
+
popClass: '',
|
|
16
|
+
onClose: () => { },
|
|
17
|
+
};
|
|
18
|
+
const NumberKeyboard = (props) => {
|
|
19
|
+
const { locale } = useConfig();
|
|
20
|
+
const { title, confirmText, visible, type, customKey, randomKeys, popClass, style, className, onChange, onDelete, onClose, } = props;
|
|
21
|
+
const b = cn('numberkeyboard');
|
|
22
|
+
const [show, setShow] = useState(visible);
|
|
23
|
+
const [clickKeyIndex, setClickKeyIndex] = useState(undefined);
|
|
24
|
+
const [keysList, setKeysList] = useState([]);
|
|
25
|
+
useEffect(() => {
|
|
26
|
+
setShow(visible);
|
|
27
|
+
}, [visible]);
|
|
28
|
+
const defaultKey = () => {
|
|
29
|
+
let leftBottomKey = {
|
|
30
|
+
id: 'lock',
|
|
31
|
+
type: 'lock',
|
|
32
|
+
};
|
|
33
|
+
if (customKey) {
|
|
34
|
+
const customKeys = Array.isArray(customKey)
|
|
35
|
+
? customKey
|
|
36
|
+
: [customKey];
|
|
37
|
+
if (customKeys.length > 0) {
|
|
38
|
+
const newCustomKey = customKeys[0];
|
|
39
|
+
leftBottomKey = {
|
|
40
|
+
id: newCustomKey,
|
|
41
|
+
type: 'custom',
|
|
42
|
+
};
|
|
43
|
+
}
|
|
44
|
+
}
|
|
45
|
+
return [
|
|
46
|
+
...getBasicKeys(),
|
|
47
|
+
leftBottomKey,
|
|
48
|
+
{ id: 0, type: 'number' },
|
|
49
|
+
{ id: 'delete', type: 'delete' },
|
|
50
|
+
];
|
|
51
|
+
};
|
|
52
|
+
const getBasicKeys = () => {
|
|
53
|
+
const keys = [];
|
|
54
|
+
for (let i = 1; i <= 9; i++) {
|
|
55
|
+
keys.push({ id: i, type: 'number' });
|
|
56
|
+
}
|
|
57
|
+
if (randomKeys) {
|
|
58
|
+
return keys.sort(() => (Math.random() > 0.5 ? 1 : -1));
|
|
59
|
+
}
|
|
60
|
+
return keys;
|
|
61
|
+
};
|
|
62
|
+
const genCustomKeys = () => {
|
|
63
|
+
const keys = getBasicKeys();
|
|
64
|
+
if (!customKey)
|
|
65
|
+
return [];
|
|
66
|
+
let customKeys = Array.isArray(customKey) ? customKey : [customKey];
|
|
67
|
+
if (customKeys.length > 2) {
|
|
68
|
+
customKeys = [customKeys[0], customKeys[1]];
|
|
69
|
+
}
|
|
70
|
+
if (customKeys.length === 2 &&
|
|
71
|
+
props.title &&
|
|
72
|
+
props.type !== 'rightColumn') {
|
|
73
|
+
customKeys = [customKeys[0]];
|
|
74
|
+
}
|
|
75
|
+
if (customKeys.length === 1) {
|
|
76
|
+
if (props.title && props.type !== 'rightColumn') {
|
|
77
|
+
keys.push({ id: customKeys[0], type: 'custom' }, { id: 0, type: 'number' }, { id: 'delete', type: 'delete' });
|
|
78
|
+
}
|
|
79
|
+
else {
|
|
80
|
+
keys.push({ id: 0, type: 'number' }, { id: customKeys[0], type: 'custom' });
|
|
81
|
+
}
|
|
82
|
+
}
|
|
83
|
+
else if (customKeys.length === 2) {
|
|
84
|
+
keys.push({ id: customKeys[0], type: 'custom' }, { id: 0, type: 'number' }, { id: customKeys[1], type: 'custom' });
|
|
85
|
+
}
|
|
86
|
+
return keys;
|
|
87
|
+
};
|
|
88
|
+
useEffect(() => {
|
|
89
|
+
if (props.type === 'rightColumn' || props.title !== '') {
|
|
90
|
+
setKeysList(genCustomKeys());
|
|
91
|
+
}
|
|
92
|
+
else {
|
|
93
|
+
setKeysList(defaultKey());
|
|
94
|
+
}
|
|
95
|
+
}, []);
|
|
96
|
+
const onTouchstart = (item, event) => {
|
|
97
|
+
event.stopPropagation();
|
|
98
|
+
setClickKeyIndex(item.id);
|
|
99
|
+
if (item.type === 'number' || item.type === 'custom') {
|
|
100
|
+
onChange && onChange(item.id);
|
|
101
|
+
}
|
|
102
|
+
if (item.type === 'lock') {
|
|
103
|
+
onClose && onClose();
|
|
104
|
+
}
|
|
105
|
+
if (item.type === 'delete') {
|
|
106
|
+
onDelete && onDelete();
|
|
107
|
+
}
|
|
108
|
+
};
|
|
109
|
+
const onTouchMove = (event) => {
|
|
110
|
+
event.stopPropagation();
|
|
111
|
+
};
|
|
112
|
+
const onTouchEnd = (event) => {
|
|
113
|
+
event.preventDefault();
|
|
114
|
+
setClickKeyIndex(undefined);
|
|
115
|
+
};
|
|
116
|
+
return (React__default.createElement("div", null,
|
|
117
|
+
React__default.createElement(Popup, { visible: show, position: "bottom", popClass: popClass, onClickOverlay: onClose, onClickCloseIcon: onClose, overlayStyle: { backgroundColor: 'rgba(0, 0, 0, 0)' } },
|
|
118
|
+
React__default.createElement("div", { className: `${b()} ${className}`, style: { ...style } },
|
|
119
|
+
title ? (React__default.createElement("div", { className: b('header') },
|
|
120
|
+
React__default.createElement("h3", { className: b('header__tit') }, title),
|
|
121
|
+
type === 'default' ? (React__default.createElement("span", { className: b('header__close'), onClick: onClose }, locale.done)) : null)) : null,
|
|
122
|
+
React__default.createElement("div", { className: b('body') },
|
|
123
|
+
React__default.createElement("div", { className: b('body__keys') }, keysList?.map((item, index) => {
|
|
124
|
+
return (React__default.createElement("div", { key: index, className: classNames({
|
|
125
|
+
'key-board-wrapper': true,
|
|
126
|
+
'key-board-wrapper-large': item.id === 0 &&
|
|
127
|
+
type === 'rightColumn' &&
|
|
128
|
+
Array.isArray(customKey) &&
|
|
129
|
+
customKey.length === 1,
|
|
130
|
+
}) },
|
|
131
|
+
React__default.createElement("div", { className: classNames({
|
|
132
|
+
key: true,
|
|
133
|
+
active: item.id === clickKeyIndex,
|
|
134
|
+
lock: item.type === 'lock',
|
|
135
|
+
delete: item.type === 'delete',
|
|
136
|
+
}), onTouchStart: (event) => onTouchstart(item, event), onTouchMove: onTouchMove, onTouchEnd: onTouchEnd },
|
|
137
|
+
item.type === 'number' || item.type === 'custom' ? (React__default.createElement("div", null, item.id)) : null,
|
|
138
|
+
item.type === 'lock' ? (React__default.createElement("img", { src: "https://img11.360buyimg.com/imagetools/jfs/t1/146371/38/8485/738/5f606425Eca239740/14f4b4f5f20d8a68.png", alt: "" })) : null,
|
|
139
|
+
item.type === 'delete' ? (React__default.createElement("img", { src: "https://img11.360buyimg.com/imagetools/jfs/t1/129395/8/12735/2030/5f61ac37E70cab338/fb477dc11f46056c.png", alt: "" })) : null)));
|
|
140
|
+
})),
|
|
141
|
+
type === 'rightColumn' ? (React__default.createElement("div", { className: b('sidebar') },
|
|
142
|
+
React__default.createElement("div", { className: "key-board-wrapper" },
|
|
143
|
+
React__default.createElement("div", { className: classNames({
|
|
144
|
+
key: true,
|
|
145
|
+
active: clickKeyIndex === 'delete',
|
|
146
|
+
}), onTouchStart: (event) => onTouchstart({ id: 'delete', type: 'delete' }, event), onTouchMove: onTouchMove, onTouchEnd: onTouchEnd },
|
|
147
|
+
React__default.createElement("img", { src: "https://img11.360buyimg.com/imagetools/jfs/t1/129395/8/12735/2030/5f61ac37E70cab338/fb477dc11f46056c.png", alt: "" }))),
|
|
148
|
+
React__default.createElement("div", { className: "key-board-wrapper key-board-finish", onClick: onClose },
|
|
149
|
+
React__default.createElement("div", { className: classNames({
|
|
150
|
+
key: true,
|
|
151
|
+
finish: true,
|
|
152
|
+
activeFinsh: clickKeyIndex === 'finish',
|
|
153
|
+
}) }, confirmText || locale.done)))) : null)))));
|
|
154
|
+
};
|
|
155
|
+
NumberKeyboard.defaultProps = defaultProps;
|
|
156
|
+
NumberKeyboard.displayName = 'NutNumberKeyboard';
|
|
157
|
+
|
|
158
|
+
export { NumberKeyboard as N };
|
|
@@ -1,74 +1,74 @@
|
|
|
1
1
|
export { B as Button } from './button.taro-4ce133b9.js';
|
|
2
|
-
export { C as Cell } from './cell.taro-
|
|
2
|
+
export { C as Cell } from './cell.taro-9a04a92e.js';
|
|
3
3
|
export { C as CellGroup } from './cellgroup.taro-e094471c.js';
|
|
4
|
-
export { C as ConfigProvider } from './configprovider.taro-
|
|
4
|
+
export { C as ConfigProvider } from './configprovider.taro-26882dd2.js';
|
|
5
5
|
export { I as Icon } from './icon.taro-1d0d4fb7.js';
|
|
6
|
-
export { I as Image } from './image.taro-
|
|
6
|
+
export { I as Image } from './image.taro-e6dc5867.js';
|
|
7
7
|
export { O as Overlay } from './overlay.taro-98367bc1.js';
|
|
8
8
|
export { P as Popup } from './popup.taro-cb777e09.js';
|
|
9
9
|
export { C as Col } from './col.taro-b61c7cba.js';
|
|
10
10
|
export { D as Divider } from './divider.taro-5236fe6a.js';
|
|
11
|
-
export { G as Grid } from './grid.taro-
|
|
12
|
-
export { G as GridItem } from './griditem.taro-
|
|
11
|
+
export { G as Grid } from './grid.taro-e6decfce.js';
|
|
12
|
+
export { G as GridItem } from './griditem.taro-4cade72e.js';
|
|
13
13
|
export { L as Layout } from './layout.taro-358f014f.js';
|
|
14
14
|
export { R as Row } from './row.taro-37a895de.js';
|
|
15
|
-
export { S as Sticky } from './sticky.taro-
|
|
15
|
+
export { S as Sticky } from './sticky.taro-d0553f48.js';
|
|
16
16
|
export { E as Elevator } from './elevator.taro-d7d65470.js';
|
|
17
|
-
export { F as FixedNav } from './fixednav.taro-
|
|
17
|
+
export { F as FixedNav } from './fixednav.taro-5ad15202.js';
|
|
18
18
|
export { I as Indicator } from './indicator.taro-183ea169.js';
|
|
19
19
|
export { M as Menu } from './menu.taro-4abed328.js';
|
|
20
|
-
export { M as MenuItem } from './menuitem.taro-
|
|
20
|
+
export { M as MenuItem } from './menuitem.taro-6e8b27c3.js';
|
|
21
21
|
export { N as NavBar } from './navbar.taro-c931c078.js';
|
|
22
|
-
export { P as Pagination } from './pagination.taro-
|
|
23
|
-
export { S as SideNavBar } from './sidenavbar.taro-
|
|
22
|
+
export { P as Pagination } from './pagination.taro-bb490de9.js';
|
|
23
|
+
export { S as SideNavBar } from './sidenavbar.taro-006cf38b.js';
|
|
24
24
|
export { S as SideNavBarItem } from './sidenavbaritem.taro-fee11d26.js';
|
|
25
25
|
export { S as SubSideNavBar } from './subsidenavbar.taro-f46b4c73.js';
|
|
26
26
|
export { T as Tabbar } from './tabbar.taro-86cece39.js';
|
|
27
27
|
export { T as TabbarItem } from './tabbaritem.taro-8dfb8055.js';
|
|
28
28
|
export { T as TabPane } from './tabpane.taro-91cd6cf4.js';
|
|
29
29
|
export { T as Tabs } from './tabs.taro-e71875fa.js';
|
|
30
|
-
export { C as Calendar } from './calendar.taro-
|
|
31
|
-
export { C as CalendarItem } from './calendaritem.taro-
|
|
30
|
+
export { C as Calendar } from './calendar.taro-4ed72058.js';
|
|
31
|
+
export { C as CalendarItem } from './calendaritem.taro-1ebe428d.js';
|
|
32
32
|
export { C as Cascader } from './cascader.taro-d8cb1c3e.js';
|
|
33
33
|
export { C as Checkbox, a as CheckboxGroup } from './checkbox.taro-0bda9796.js';
|
|
34
|
-
export { D as DatePicker } from './datepicker.taro-
|
|
35
|
-
export { F as Form } from './form.taro-
|
|
36
|
-
export { F as FormItem } from './formitem.taro-
|
|
37
|
-
export { I as Input } from './input.taro-
|
|
34
|
+
export { D as DatePicker } from './datepicker.taro-7220e495.js';
|
|
35
|
+
export { F as Form } from './form.taro-71d32671.js';
|
|
36
|
+
export { F as FormItem } from './formitem.taro-3089489b.js';
|
|
37
|
+
export { I as Input } from './input.taro-fd566407.js';
|
|
38
38
|
export { I as InputNumber } from './inputnumber.taro-dc39b853.js';
|
|
39
|
-
export { N as NumberKeyboard } from './numberkeyboard.taro-
|
|
40
|
-
export { P as Picker } from './picker.taro-
|
|
39
|
+
export { N as NumberKeyboard } from './numberkeyboard.taro-194519e4.js';
|
|
40
|
+
export { P as Picker } from './picker.taro-2a8ded7c.js';
|
|
41
41
|
export { R as Radio, a as RadioGroup } from './index.taro-a36f96fb.js';
|
|
42
|
-
export { R as Range } from './range.taro-
|
|
42
|
+
export { R as Range } from './range.taro-5d6ff217.js';
|
|
43
43
|
export { R as Rate } from './rate.taro-10197384.js';
|
|
44
|
-
export { S as SearchBar } from './searchbar.taro-
|
|
45
|
-
export { S as ShortPassword } from './shortpassword.taro-
|
|
46
|
-
export { T as TextArea } from './textarea.taro-
|
|
47
|
-
export { U as Uploader } from './uploader.taro-
|
|
44
|
+
export { S as SearchBar } from './searchbar.taro-839dd622.js';
|
|
45
|
+
export { S as ShortPassword } from './shortpassword.taro-182d46f7.js';
|
|
46
|
+
export { T as TextArea } from './textarea.taro-42600f8c.js';
|
|
47
|
+
export { U as Uploader } from './uploader.taro-f80d76d9.js';
|
|
48
48
|
export { A as ActionSheet } from './actionsheet.taro-a58d3d12.js';
|
|
49
49
|
export { B as BackTop } from './backtop.taro-99107c30.js';
|
|
50
|
-
export { D as Dialog } from './dialog.taro-
|
|
50
|
+
export { D as Dialog } from './dialog.taro-1c03960e.js';
|
|
51
51
|
export { D as Drag } from './drag.taro-82b6b27a.js';
|
|
52
|
-
export { I as Infiniteloading } from './infiniteloading.taro-
|
|
52
|
+
export { I as Infiniteloading } from './infiniteloading.taro-6c2a2e95.js';
|
|
53
53
|
export { N as Notify } from './notify.taro-308e5892.js';
|
|
54
|
-
export { P as PullToRefresh } from './pulltorefresh.taro-
|
|
54
|
+
export { P as PullToRefresh } from './pulltorefresh.taro-cab7b51c.js';
|
|
55
55
|
export { S as Swipe } from './swipe.taro-83bc248f.js';
|
|
56
56
|
export { S as Switch } from './switch.taro-bae2dca0.js';
|
|
57
57
|
export { T as Toast } from './toast.taro-0804b6b4.js';
|
|
58
58
|
export { A as Animate } from './animate.taro-b0e83dd5.js';
|
|
59
59
|
export { A as AnimatingNumbers } from './animatingnumbers.taro-6f40a2e9.js';
|
|
60
|
-
export { A as Audio } from './audio.taro-
|
|
60
|
+
export { A as Audio } from './audio.taro-4fadc583.js';
|
|
61
61
|
export { A as Avatar } from './avatar.taro-85ced995.js';
|
|
62
|
-
export { A as AvatarGroup } from './avatargroup-
|
|
62
|
+
export { A as AvatarGroup } from './avatargroup-1d900174.js';
|
|
63
63
|
export { B as Badge } from './badge.taro-fe9171ec.js';
|
|
64
64
|
export { C as CircleProgress } from './circleprogress.taro-47db537c.js';
|
|
65
65
|
export { C as Collapse } from './collapse.taro-af58206c.js';
|
|
66
66
|
export { C as CollapseItem } from './collapseitem-ce1849d2.js';
|
|
67
|
-
export { C as CountDown } from './countdown.taro-
|
|
68
|
-
export { E as Ellipsis } from './ellipsis.taro-
|
|
69
|
-
export { E as Empty } from './empty.taro-
|
|
67
|
+
export { C as CountDown } from './countdown.taro-9e40de9c.js';
|
|
68
|
+
export { E as Ellipsis } from './ellipsis.taro-49b6db0c.js';
|
|
69
|
+
export { E as Empty } from './empty.taro-7bd813f9.js';
|
|
70
70
|
export { I as ImagePreview } from './imagepreview.taro-3400ea03.js';
|
|
71
|
-
export { N as NoticeBar } from './noticebar.taro-
|
|
71
|
+
export { N as NoticeBar } from './noticebar.taro-69ea7673.js';
|
|
72
72
|
export { P as Popover } from './popover.taro-46d813e8.js';
|
|
73
73
|
export { P as Price } from './price.taro-8801462e.js';
|
|
74
74
|
export { P as Progress } from './progress.taro-623bc807.js';
|
|
@@ -77,32 +77,32 @@ export { S as Step } from './step.taro-1c94e067.js';
|
|
|
77
77
|
export { S as Steps } from './steps.taro-acf205a0.js';
|
|
78
78
|
export { S as Swiper } from './swiper.taro-852f6615.js';
|
|
79
79
|
export { S as SwiperItem } from './swiperitem-86a3578a.js';
|
|
80
|
-
export { T as Table } from './table.taro-
|
|
81
|
-
export { T as Tag } from './tag.taro-
|
|
80
|
+
export { T as Table } from './table.taro-cb4dd2c3.js';
|
|
81
|
+
export { T as Tag } from './tag.taro-00fe554d.js';
|
|
82
82
|
export { T as TrendArrow } from './trendarrow.taro-5a7153e4.js';
|
|
83
83
|
export { V as Video } from './video-8a3518c5.js';
|
|
84
|
-
export { V as VirtualList } from './virtuallist.taro-
|
|
85
|
-
export { W as WaterMark } from './watermark.taro-
|
|
86
|
-
export { A as Address } from './address.taro-
|
|
84
|
+
export { V as VirtualList } from './virtuallist.taro-e3345ced.js';
|
|
85
|
+
export { W as WaterMark } from './watermark.taro-cd9db98a.js';
|
|
86
|
+
export { A as Address } from './address.taro-79cc7c96.js';
|
|
87
87
|
export { B as Barrage } from './barrage.taro-0e157b5e.js';
|
|
88
|
-
export { C as Card } from './card.taro-
|
|
89
|
-
export { S as Signature } from './signature.taro-
|
|
90
|
-
export { T as TimeDetail } from './timedetail.taro-
|
|
91
|
-
export { T as TimePannel } from './timepannel.taro-
|
|
92
|
-
export { T as TimeSelect } from './timeselect.taro-
|
|
88
|
+
export { C as Card } from './card.taro-39055e82.js';
|
|
89
|
+
export { S as Signature } from './signature.taro-33632585.js';
|
|
90
|
+
export { T as TimeDetail } from './timedetail.taro-c5f564fd.js';
|
|
91
|
+
export { T as TimePannel } from './timepannel.taro-29f9dd86.js';
|
|
92
|
+
export { T as TimeSelect } from './timeselect.taro-3ecce65d.js';
|
|
93
93
|
import 'react';
|
|
94
94
|
import './typings-1c5f2628.js';
|
|
95
95
|
import '@tarojs/taro';
|
|
96
96
|
import './bem-893ad28d.js';
|
|
97
97
|
import '@bem-react/classname';
|
|
98
|
-
import 'lodash';
|
|
98
|
+
import 'lodash.kebabcase';
|
|
99
99
|
import './zh-CN-dfc384d0.js';
|
|
100
100
|
import 'classnames';
|
|
101
101
|
import 'react-dom';
|
|
102
102
|
import 'react-transition-group';
|
|
103
103
|
import './UserContext-be8097d2.js';
|
|
104
104
|
import './grid.taro.context-39636af9.js';
|
|
105
|
-
import './configprovider-
|
|
105
|
+
import './configprovider-5eea4f5d.js';
|
|
106
106
|
import '@tarojs/components';
|
|
107
107
|
import './offsetContext-bfb02c25.js';
|
|
108
108
|
import './useClientRect-bf69d7b3.js';
|
|
@@ -1,83 +1,68 @@
|
|
|
1
|
-
import _slicedToArray from "@babel/runtime/helpers/slicedToArray";
|
|
2
|
-
import _defineProperty from "@babel/runtime/helpers/defineProperty";
|
|
3
|
-
import _objectWithoutProperties from "@babel/runtime/helpers/objectWithoutProperties";
|
|
4
|
-
var _excluded = ["children", "zIndex", "duration", "overlayClass", "closeOnClickOverlay", "visible", "lockScroll", "overlayStyle"];
|
|
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, { useState, useRef, useEffect } from 'react';
|
|
8
2
|
import classNames from 'classnames';
|
|
9
3
|
import { c as cn } from './bem-893ad28d.js';
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
4
|
+
|
|
5
|
+
const defaultOverlayProps = {
|
|
6
|
+
zIndex: 2000,
|
|
7
|
+
duration: 0.3,
|
|
8
|
+
overlayClass: '',
|
|
9
|
+
closeOnClickOverlay: true,
|
|
10
|
+
visible: false,
|
|
11
|
+
lockScroll: true,
|
|
12
|
+
overlayStyle: {},
|
|
18
13
|
};
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
duration = _defaultOverlayProps$.duration,
|
|
24
|
-
overlayClass = _defaultOverlayProps$.overlayClass,
|
|
25
|
-
closeOnClickOverlay = _defaultOverlayProps$.closeOnClickOverlay,
|
|
26
|
-
visible = _defaultOverlayProps$.visible,
|
|
27
|
-
lockScroll = _defaultOverlayProps$.lockScroll,
|
|
28
|
-
overlayStyle = _defaultOverlayProps$.overlayStyle,
|
|
29
|
-
rest = _objectWithoutProperties(_defaultOverlayProps$, _excluded);
|
|
30
|
-
var _useState = useState(visible),
|
|
31
|
-
_useState2 = _slicedToArray(_useState, 2),
|
|
32
|
-
show = _useState2[0],
|
|
33
|
-
setShow = _useState2[1];
|
|
34
|
-
var renderRef = useRef(true);
|
|
35
|
-
var intervalRef = useRef(0);
|
|
36
|
-
useEffect(function () {
|
|
37
|
-
visible && setShow(visible);
|
|
38
|
-
lock();
|
|
39
|
-
}, [visible]);
|
|
40
|
-
useEffect(function () {
|
|
41
|
-
return function () {
|
|
42
|
-
clearTimeout(intervalRef.current);
|
|
43
|
-
document.body.classList.remove('nut-overflow-hidden');
|
|
14
|
+
const Overlay = (props) => {
|
|
15
|
+
const { children, zIndex, duration, overlayClass, closeOnClickOverlay, visible, lockScroll, overlayStyle, ...rest } = {
|
|
16
|
+
...defaultOverlayProps,
|
|
17
|
+
...props,
|
|
44
18
|
};
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
19
|
+
const [show, setShow] = useState(visible);
|
|
20
|
+
const renderRef = useRef(true);
|
|
21
|
+
const intervalRef = useRef(0);
|
|
22
|
+
useEffect(() => {
|
|
23
|
+
visible && setShow(visible);
|
|
24
|
+
lock();
|
|
25
|
+
}, [visible]);
|
|
26
|
+
useEffect(() => {
|
|
27
|
+
return () => {
|
|
28
|
+
clearTimeout(intervalRef.current);
|
|
29
|
+
document.body.classList.remove('nut-overflow-hidden');
|
|
30
|
+
};
|
|
31
|
+
}, []);
|
|
32
|
+
const b = cn('overlay');
|
|
33
|
+
const classes = classNames({
|
|
34
|
+
'overlay-fade-leave-active': !renderRef.current && !visible,
|
|
35
|
+
'overlay-fade-enter-active': visible,
|
|
36
|
+
'first-render': renderRef.current && !visible,
|
|
37
|
+
'hidden-render': !visible,
|
|
38
|
+
}, overlayClass, b(''));
|
|
39
|
+
const styles = {
|
|
40
|
+
zIndex,
|
|
41
|
+
animationDuration: `${props.duration}s`,
|
|
42
|
+
...overlayStyle,
|
|
43
|
+
};
|
|
44
|
+
const lock = () => {
|
|
45
|
+
if (lockScroll && visible) {
|
|
46
|
+
document.body.classList.add('nut-overflow-hidden');
|
|
47
|
+
}
|
|
48
|
+
else {
|
|
49
|
+
document.body.classList.remove('nut-overflow-hidden');
|
|
50
|
+
}
|
|
51
|
+
};
|
|
52
|
+
const handleClick = (e) => {
|
|
53
|
+
if (closeOnClickOverlay) {
|
|
54
|
+
props.onClick && props.onClick(e);
|
|
55
|
+
renderRef.current = false;
|
|
56
|
+
const id = window.setTimeout(() => {
|
|
57
|
+
setShow(!visible);
|
|
58
|
+
}, duration * 1000 * 0.8);
|
|
59
|
+
intervalRef.current = id;
|
|
60
|
+
}
|
|
61
|
+
};
|
|
62
|
+
return (React__default.createElement(React__default.Fragment, null,
|
|
63
|
+
React__default.createElement("div", { className: classes, style: styles, ...rest, onClick: handleClick }, children)));
|
|
80
64
|
};
|
|
81
65
|
Overlay.defaultProps = defaultOverlayProps;
|
|
82
66
|
Overlay.displayName = 'NutOverlay';
|
|
67
|
+
|
|
83
68
|
export { Overlay as O, defaultOverlayProps as d };
|
|
@@ -0,0 +1,124 @@
|
|
|
1
|
+
import React__default, { useState, useEffect } from 'react';
|
|
2
|
+
import { u as useConfig } from './configprovider.taro-26882dd2.js';
|
|
3
|
+
import { c as cn } from './bem-893ad28d.js';
|
|
4
|
+
|
|
5
|
+
const defaultProps = {
|
|
6
|
+
defaultValue: 1,
|
|
7
|
+
mode: 'multi',
|
|
8
|
+
prevText: '',
|
|
9
|
+
nextText: '',
|
|
10
|
+
pageCount: '',
|
|
11
|
+
totalItems: '0',
|
|
12
|
+
itemsPerPage: '10',
|
|
13
|
+
showPageSize: '5',
|
|
14
|
+
forceEllipses: false,
|
|
15
|
+
className: '',
|
|
16
|
+
pageNodeRender: (item) => {
|
|
17
|
+
return item.text;
|
|
18
|
+
},
|
|
19
|
+
};
|
|
20
|
+
const Pagination = (props) => {
|
|
21
|
+
const { locale } = useConfig();
|
|
22
|
+
({ ...defaultProps, ...props });
|
|
23
|
+
const { modelValue, mode, prevText, nextText, pageCount, totalItems, itemsPerPage, showPageSize, onChange, updatecurrent, forceEllipses, pageNodeRender, defaultValue, className, ...rest } = props;
|
|
24
|
+
const [currentPage, setCurrent] = useState(1);
|
|
25
|
+
const [pages, setPages] = useState([]);
|
|
26
|
+
const [countRef, setCountRef] = useState(Number(pageCount));
|
|
27
|
+
const paginationBem = cn('pagination');
|
|
28
|
+
// 计算页面的数量
|
|
29
|
+
const computedCountRef = () => {
|
|
30
|
+
const num = Number(pageCount) || Math.ceil(Number(totalItems) / Number(itemsPerPage));
|
|
31
|
+
return Number.isNaN(num) ? 1 : Math.max(1, num);
|
|
32
|
+
};
|
|
33
|
+
// 生成pages数组,用来遍历
|
|
34
|
+
const computedPages = (_currentPage, _countRef) => {
|
|
35
|
+
if (mode === 'simple')
|
|
36
|
+
return [];
|
|
37
|
+
const items = [];
|
|
38
|
+
const pageCount = _countRef || countRef; // 总的页面数量
|
|
39
|
+
const pageSize = Number(showPageSize); // 展示的页面个数
|
|
40
|
+
const _current = _currentPage || Number(currentPage); // 当前页
|
|
41
|
+
let startPage = 1;
|
|
42
|
+
let endPage = pageCount;
|
|
43
|
+
const partialShow = pageCount > pageSize;
|
|
44
|
+
if (partialShow) {
|
|
45
|
+
// 选中的page在展示的page中间
|
|
46
|
+
startPage = Math.max(_current - Math.floor(pageSize / 2), 1);
|
|
47
|
+
endPage = startPage + pageSize - 1;
|
|
48
|
+
if (endPage > pageCount) {
|
|
49
|
+
endPage = pageCount;
|
|
50
|
+
startPage = endPage - pageSize + 1;
|
|
51
|
+
}
|
|
52
|
+
}
|
|
53
|
+
// 遍历生成数组
|
|
54
|
+
for (let i = startPage; i <= endPage; i++) {
|
|
55
|
+
const page = setPage(i, i, _current === i);
|
|
56
|
+
items.push(page);
|
|
57
|
+
}
|
|
58
|
+
// 判断是否有折叠
|
|
59
|
+
if (partialShow && pageSize > 0 && forceEllipses) {
|
|
60
|
+
if (startPage > 1) {
|
|
61
|
+
const prevPage = setPage(startPage - 1, '...');
|
|
62
|
+
items.unshift(prevPage);
|
|
63
|
+
}
|
|
64
|
+
if (endPage < pageCount) {
|
|
65
|
+
const nextPage = setPage(endPage + 1, '...');
|
|
66
|
+
items.push(nextPage);
|
|
67
|
+
}
|
|
68
|
+
}
|
|
69
|
+
return items;
|
|
70
|
+
};
|
|
71
|
+
// 点击选择page
|
|
72
|
+
const selectPage = (curPage, isSelect) => {
|
|
73
|
+
if (curPage > countRef || curPage < 1)
|
|
74
|
+
return;
|
|
75
|
+
// 是否传入modelValue
|
|
76
|
+
if (!('modelValue' in props)) {
|
|
77
|
+
setCurrent(Number(curPage));
|
|
78
|
+
if (curPage !== currentPage) {
|
|
79
|
+
setPages(computedPages(curPage));
|
|
80
|
+
}
|
|
81
|
+
}
|
|
82
|
+
if (curPage !== currentPage) {
|
|
83
|
+
updatecurrent && updatecurrent(curPage);
|
|
84
|
+
}
|
|
85
|
+
if (isSelect)
|
|
86
|
+
onChange && onChange(curPage);
|
|
87
|
+
};
|
|
88
|
+
// set page 对象
|
|
89
|
+
const setPage = (number, text, active) => {
|
|
90
|
+
return { number, text, active };
|
|
91
|
+
};
|
|
92
|
+
useEffect(() => {
|
|
93
|
+
// 初始化 判断是否传入值 计算 当前页,总页数,生成子节点
|
|
94
|
+
let currentValue = props.defaultValue || 1;
|
|
95
|
+
if ('modelValue' in props) {
|
|
96
|
+
currentValue = Number(props.modelValue);
|
|
97
|
+
}
|
|
98
|
+
const pageCount = computedCountRef();
|
|
99
|
+
setCountRef(pageCount);
|
|
100
|
+
setPages(computedPages(currentValue, pageCount));
|
|
101
|
+
}, []);
|
|
102
|
+
if ('modelValue' in props) {
|
|
103
|
+
const current = props.modelValue ? Number(props.modelValue) : 1;
|
|
104
|
+
if (current !== currentPage) {
|
|
105
|
+
setCurrent(current);
|
|
106
|
+
setPages(computedPages(Number(current)));
|
|
107
|
+
}
|
|
108
|
+
}
|
|
109
|
+
return (React__default.createElement("div", { className: `${paginationBem('')} ${className}`, ...rest },
|
|
110
|
+
React__default.createElement("div", { className: `${paginationBem('prev')} ${mode === 'multi' ? '' : 'simple-border'} ${currentPage === 1 ? 'disabled' : ''}`, onClick: (e) => selectPage(Number(currentPage) - 1, true) }, prevText || locale.pagination.prev),
|
|
111
|
+
mode === 'multi' ? (React__default.createElement("div", { className: `${paginationBem('contain')}` }, pages.map((item, index) => {
|
|
112
|
+
return (React__default.createElement("div", { key: `${index}pagination`, className: `${paginationBem('item')} ${item.active ? 'active' : ''}`, onClick: (e) => !item.active ? selectPage(item.number, true) : '' }, pageNodeRender ? pageNodeRender(item) : item.text));
|
|
113
|
+
}))) : (''),
|
|
114
|
+
mode === 'simple' ? (React__default.createElement("div", { className: `${paginationBem('contain')}` },
|
|
115
|
+
React__default.createElement("div", { className: `${paginationBem('simple')}` },
|
|
116
|
+
currentPage,
|
|
117
|
+
"/",
|
|
118
|
+
countRef))) : (''),
|
|
119
|
+
React__default.createElement("div", { className: `${paginationBem('next')} ${Number(currentPage) >= countRef ? 'disabled' : ''}`, onClick: (e) => selectPage(Number(currentPage) + 1, true) }, nextText || locale.pagination.next)));
|
|
120
|
+
};
|
|
121
|
+
Pagination.defaultProps = defaultProps;
|
|
122
|
+
Pagination.displayName = 'NutPagination';
|
|
123
|
+
|
|
124
|
+
export { Pagination as P };
|