@nutui/nutui-react-taro 1.3.4 → 1.3.5-beta.1
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 +12 -0
- package/dist/esm/Address.js +3 -4
- package/dist/esm/AnimatingNumbers.js +2 -2
- package/dist/esm/Audio.js +4 -4
- package/dist/esm/Cascader/style/index.js +2 -1
- package/dist/esm/Cascader.js +2 -2
- package/dist/esm/Dialog.js +2 -4
- package/dist/esm/ImagePreview/style/index.js +3 -1
- package/dist/esm/ImagePreview.js +3 -4
- package/dist/esm/Infiniteloading.js +2 -2
- package/dist/esm/Notify.js +2 -3
- package/dist/esm/Range.js +3 -3
- package/dist/esm/Rate.js +2 -2
- package/dist/esm/Swiper/style/index.js +1 -1
- package/dist/esm/Swiper.js +2 -2
- package/dist/esm/Toast.js +2 -2
- package/dist/esm/{address.taro-7540c626.js → address.taro-f16cef31.js} +76 -373
- package/dist/esm/{animatingnumbers.taro-877baa98.js → animatingnumbers.taro-6f40a2e9.js} +41 -25
- package/dist/esm/{audio.taro-ab2528b2.js → audio.taro-29f5568f.js} +1 -1
- package/dist/esm/{cascader.taro-35387092.js → cascader.taro-77100fb4.js} +54 -48
- package/dist/esm/dialog.taro-492e2b9a.js +218 -0
- package/dist/esm/{imagepreview.taro-3f1c7638.js → imagepreview.taro-1199e977.js} +3 -11
- package/dist/esm/{infiniteloading.taro-9701755f.js → infiniteloading.taro-b95e62bf.js} +1 -3
- package/dist/esm/notify.taro-d9c48fae.js +122 -0
- package/dist/esm/nutui-react.es.js +12 -12
- package/dist/esm/{range.taro-141a0163.js → range.taro-515d37a4.js} +1 -1
- package/dist/esm/{rate.taro-5077b962.js → rate.taro-69c85081.js} +4 -2
- package/dist/esm/{swiper.taro-58ed323b.js → swiper.taro-f314d67a.js} +4 -2
- package/dist/esm/{toast.taro-cd22a0d7.js → toast.taro-86862dff.js} +1 -1
- package/dist/esm/types/src/packages/address/customRender.taro.d.ts +15 -0
- package/dist/esm/types/src/packages/cascader/cascader.d.ts +1 -0
- package/dist/esm/types/src/packages/cascader/cascader.taro.d.ts +1 -0
- package/dist/esm/types/src/packages/notify/index.taro.d.ts +1 -1
- package/dist/esm/types/src/packages/notify/notify.taro.d.ts +9 -15
- 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 +582 -1232
- package/dist/nutui.react.umd.js +577 -1227
- package/dist/style.css +1 -1
- package/dist/style.es.js +1 -1
- package/dist/types/index.d.ts +169 -174
- package/package.json +1 -1
- package/dist/esm/dialog.taro-54c67e08.js +0 -554
- package/dist/esm/notify.taro-0d9cfb07.js +0 -300
|
@@ -3,25 +3,23 @@ import _slicedToArray from "@babel/runtime/helpers/slicedToArray";
|
|
|
3
3
|
import _defineProperty from "@babel/runtime/helpers/defineProperty";
|
|
4
4
|
import _objectWithoutProperties from "@babel/runtime/helpers/objectWithoutProperties";
|
|
5
5
|
var _excluded = ["children", "type", "existAddress", "selectedIcon", "defaultIcon", "isShowCustomAddress", "customAndExistTitle", "onSelected", "onClose", "onSwitchModule"],
|
|
6
|
-
_excluded2 = ["
|
|
7
|
-
_excluded3 = ["children", "type", "
|
|
8
|
-
_excluded4 = ["modelValue", "modelSelect", "children", "type", "height", "customAddressTitle", "existAddress", "existAddressTitle", "province", "city", "country", "town", "isShowCustomAddress", "customAndExistTitle", "selectedIcon", "defaultIcon", "closeBtnIcon", "backBtnIcon", "onChange", "onSelected", "onClose", "closeMask", "switchModule", "onTabChecked", "style", "className", "iconClassPrefix", "iconFontClassName"];
|
|
6
|
+
_excluded2 = ["children", "type", "modelValue", "height", "province", "city", "country", "town", "onNextArea", "onTabClick", "onClose"],
|
|
7
|
+
_excluded3 = ["modelValue", "modelSelect", "children", "type", "height", "customAddressTitle", "existAddress", "existAddressTitle", "province", "city", "country", "town", "isShowCustomAddress", "customAndExistTitle", "selectedIcon", "defaultIcon", "closeBtnIcon", "backBtnIcon", "onChange", "onSelected", "onClose", "closeMask", "switchModule", "onTabChecked", "style", "className", "iconClassPrefix", "iconFontClassName"];
|
|
9
8
|
|
|
10
9
|
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; }
|
|
11
10
|
|
|
12
11
|
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; }
|
|
13
12
|
|
|
14
|
-
import React__default, { useEffect,
|
|
13
|
+
import React__default, { useEffect, useState, useRef } from 'react';
|
|
15
14
|
import { I as Icon$1 } from './icon.taro-1d0d4fb7.js';
|
|
16
15
|
import { P as Popup } from './popup.taro-33d0bbc8.js';
|
|
17
16
|
import { c as cn } from './bem-893ad28d.js';
|
|
18
17
|
import { I as Icon } from './icon-8dc4de10.js';
|
|
19
18
|
import { u as useConfig } from './configprovider-3e87d67a.js';
|
|
20
|
-
import
|
|
21
|
-
import { animated } from '@react-spring/web';
|
|
19
|
+
import Taro from '@tarojs/taro';
|
|
22
20
|
import { u as useConfig$1 } from './configprovider.taro-6c7b3056.js';
|
|
23
21
|
import { C as ComponentDefaults } from './typings-1c5f2628.js';
|
|
24
|
-
var defaultProps$
|
|
22
|
+
var defaultProps$2 = {
|
|
25
23
|
type: 'custom',
|
|
26
24
|
existAddress: [],
|
|
27
25
|
defaultIcon: 'location2',
|
|
@@ -34,18 +32,18 @@ var ExistRender = function ExistRender(props) {
|
|
|
34
32
|
var _useConfig = useConfig(),
|
|
35
33
|
locale = _useConfig.locale;
|
|
36
34
|
|
|
37
|
-
var _defaultProps$
|
|
38
|
-
children = _defaultProps$
|
|
39
|
-
type = _defaultProps$
|
|
40
|
-
existAddress = _defaultProps$
|
|
41
|
-
selectedIcon = _defaultProps$
|
|
42
|
-
defaultIcon = _defaultProps$
|
|
43
|
-
isShowCustomAddress = _defaultProps$
|
|
44
|
-
customAndExistTitle = _defaultProps$
|
|
45
|
-
onSelected = _defaultProps$
|
|
46
|
-
onClose = _defaultProps$
|
|
47
|
-
onSwitchModule = _defaultProps$
|
|
48
|
-
rest = _objectWithoutProperties(_defaultProps$
|
|
35
|
+
var _defaultProps$2$props = _objectSpread(_objectSpread({}, defaultProps$2), props),
|
|
36
|
+
children = _defaultProps$2$props.children,
|
|
37
|
+
type = _defaultProps$2$props.type,
|
|
38
|
+
existAddress = _defaultProps$2$props.existAddress,
|
|
39
|
+
selectedIcon = _defaultProps$2$props.selectedIcon,
|
|
40
|
+
defaultIcon = _defaultProps$2$props.defaultIcon,
|
|
41
|
+
isShowCustomAddress = _defaultProps$2$props.isShowCustomAddress,
|
|
42
|
+
customAndExistTitle = _defaultProps$2$props.customAndExistTitle,
|
|
43
|
+
onSelected = _defaultProps$2$props.onSelected,
|
|
44
|
+
onClose = _defaultProps$2$props.onClose,
|
|
45
|
+
onSwitchModule = _defaultProps$2$props.onSwitchModule,
|
|
46
|
+
rest = _objectWithoutProperties(_defaultProps$2$props, _excluded);
|
|
49
47
|
|
|
50
48
|
var b = cn('address'); // 选择现有地址
|
|
51
49
|
|
|
@@ -116,283 +114,6 @@ var ExistRender = function ExistRender(props) {
|
|
|
116
114
|
}, locale.address.chooseAnotherAddress || customAndExistTitle)));
|
|
117
115
|
};
|
|
118
116
|
|
|
119
|
-
var elevatorContext = createContext({});
|
|
120
|
-
var defaultProps$2 = {
|
|
121
|
-
height: '200px',
|
|
122
|
-
acceptKey: 'title',
|
|
123
|
-
indexList: [],
|
|
124
|
-
isSticky: false,
|
|
125
|
-
spaceHeight: 23,
|
|
126
|
-
titleHeight: 35,
|
|
127
|
-
className: ''
|
|
128
|
-
};
|
|
129
|
-
|
|
130
|
-
var Elevator = function Elevator(props) {
|
|
131
|
-
var _defaultProps$2$props = _objectSpread(_objectSpread({}, defaultProps$2), props),
|
|
132
|
-
height = _defaultProps$2$props.height,
|
|
133
|
-
acceptKey = _defaultProps$2$props.acceptKey,
|
|
134
|
-
indexList = _defaultProps$2$props.indexList,
|
|
135
|
-
isSticky = _defaultProps$2$props.isSticky,
|
|
136
|
-
spaceHeight = _defaultProps$2$props.spaceHeight,
|
|
137
|
-
titleHeight = _defaultProps$2$props.titleHeight,
|
|
138
|
-
className = _defaultProps$2$props.className,
|
|
139
|
-
onClickItem = _defaultProps$2$props.onClickItem,
|
|
140
|
-
onClickIndex = _defaultProps$2$props.onClickIndex,
|
|
141
|
-
children = _defaultProps$2$props.children,
|
|
142
|
-
rest = _objectWithoutProperties(_defaultProps$2$props, _excluded2);
|
|
143
|
-
|
|
144
|
-
var b = cn('elevator');
|
|
145
|
-
var listview = useRef(null);
|
|
146
|
-
var initData = {
|
|
147
|
-
anchorIndex: 0,
|
|
148
|
-
listHeight: [],
|
|
149
|
-
listGroup: [],
|
|
150
|
-
scrollY: 0,
|
|
151
|
-
diff: -1,
|
|
152
|
-
fixedTop: 0
|
|
153
|
-
};
|
|
154
|
-
var touchState = useRef({
|
|
155
|
-
y1: 0,
|
|
156
|
-
y2: 0
|
|
157
|
-
});
|
|
158
|
-
|
|
159
|
-
var _useState = useState(0),
|
|
160
|
-
_useState2 = _slicedToArray(_useState, 2),
|
|
161
|
-
scrollY = _useState2[0],
|
|
162
|
-
setScrollY = _useState2[1];
|
|
163
|
-
|
|
164
|
-
var _useState3 = useState({}),
|
|
165
|
-
_useState4 = _slicedToArray(_useState3, 2),
|
|
166
|
-
currentData = _useState4[0],
|
|
167
|
-
setCurrentData = _useState4[1];
|
|
168
|
-
|
|
169
|
-
var _useState5 = useState(''),
|
|
170
|
-
_useState6 = _slicedToArray(_useState5, 2),
|
|
171
|
-
currentKey = _useState6[0],
|
|
172
|
-
setCurrentKey = _useState6[1];
|
|
173
|
-
|
|
174
|
-
var _useState7 = useState(0),
|
|
175
|
-
_useState8 = _slicedToArray(_useState7, 2),
|
|
176
|
-
currentIndex = _useState8[0],
|
|
177
|
-
setCurrentIndex = _useState8[1];
|
|
178
|
-
|
|
179
|
-
var _useState9 = useState(0),
|
|
180
|
-
_useState10 = _slicedToArray(_useState9, 2),
|
|
181
|
-
codeIndex = _useState10[0],
|
|
182
|
-
setCodeIndex = _useState10[1];
|
|
183
|
-
|
|
184
|
-
var _useState11 = useState(false),
|
|
185
|
-
_useState12 = _slicedToArray(_useState11, 2),
|
|
186
|
-
scrollStart = _useState12[0],
|
|
187
|
-
setScrollStart = _useState12[1];
|
|
188
|
-
|
|
189
|
-
var state = useRef(initData); // 重置滚动参数
|
|
190
|
-
|
|
191
|
-
var resetScrollState = function resetScrollState() {
|
|
192
|
-
setScrollStart(false);
|
|
193
|
-
};
|
|
194
|
-
|
|
195
|
-
var clientHeight = function clientHeight() {
|
|
196
|
-
return listview.current ? listview.current.clientHeight : 0;
|
|
197
|
-
};
|
|
198
|
-
|
|
199
|
-
var getData = function getData(el, name) {
|
|
200
|
-
var prefix = 'data-';
|
|
201
|
-
return el.getAttribute(prefix + name);
|
|
202
|
-
};
|
|
203
|
-
|
|
204
|
-
var calculateHeight = function calculateHeight() {
|
|
205
|
-
var height = 0;
|
|
206
|
-
state.current.listHeight.push(height);
|
|
207
|
-
|
|
208
|
-
for (var i = 0; i < state.current.listGroup.length; i++) {
|
|
209
|
-
var item = state.current.listGroup[i];
|
|
210
|
-
height += item.clientHeight;
|
|
211
|
-
state.current.listHeight.push(height);
|
|
212
|
-
}
|
|
213
|
-
};
|
|
214
|
-
|
|
215
|
-
var scrollTo = function scrollTo(index) {
|
|
216
|
-
if (!index && index !== 0) {
|
|
217
|
-
return;
|
|
218
|
-
}
|
|
219
|
-
|
|
220
|
-
if (!state.current.listHeight.length) {
|
|
221
|
-
calculateHeight();
|
|
222
|
-
}
|
|
223
|
-
|
|
224
|
-
var cacheIndex = index;
|
|
225
|
-
|
|
226
|
-
if (index < 0) {
|
|
227
|
-
cacheIndex = 0;
|
|
228
|
-
}
|
|
229
|
-
|
|
230
|
-
if (index > state.current.listHeight.length - 2) {
|
|
231
|
-
cacheIndex = state.current.listHeight.length - 2;
|
|
232
|
-
}
|
|
233
|
-
|
|
234
|
-
setCodeIndex(cacheIndex);
|
|
235
|
-
|
|
236
|
-
if (listview.current) {
|
|
237
|
-
listview.current.scrollTo(0, state.current.listHeight[cacheIndex]);
|
|
238
|
-
}
|
|
239
|
-
};
|
|
240
|
-
|
|
241
|
-
var bind = useGesture({
|
|
242
|
-
onDragStart: function onDragStart(_ref) {
|
|
243
|
-
var target = _ref.target,
|
|
244
|
-
offset = _ref.offset;
|
|
245
|
-
setScrollStart(true);
|
|
246
|
-
var index = Number(getData(target, 'index'));
|
|
247
|
-
touchState.current.y1 = offset[1];
|
|
248
|
-
state.current.anchorIndex = +index;
|
|
249
|
-
setCodeIndex(function (codeIndex) {
|
|
250
|
-
return codeIndex + index;
|
|
251
|
-
});
|
|
252
|
-
scrollTo(index);
|
|
253
|
-
},
|
|
254
|
-
onDragEnd: function onDragEnd(_ref2) {
|
|
255
|
-
var offset = _ref2.offset;
|
|
256
|
-
touchState.current.y2 = offset[1];
|
|
257
|
-
var delta = (touchState.current.y2 - touchState.current.y1) / spaceHeight || 0; // delta 是一个浮点数, 需要四舍五入一下, 否则页面会找不到最终计算后的index
|
|
258
|
-
|
|
259
|
-
var cacheIndex = state.current.anchorIndex + Math.ceil(delta);
|
|
260
|
-
setCodeIndex(cacheIndex);
|
|
261
|
-
scrollTo(cacheIndex);
|
|
262
|
-
resetScrollState();
|
|
263
|
-
}
|
|
264
|
-
});
|
|
265
|
-
|
|
266
|
-
var handleClickItem = function handleClickItem(key, item) {
|
|
267
|
-
onClickItem && onClickItem(key, item);
|
|
268
|
-
setCurrentData(item);
|
|
269
|
-
setCurrentKey(key);
|
|
270
|
-
};
|
|
271
|
-
|
|
272
|
-
var handleClickIndex = function handleClickIndex(key) {
|
|
273
|
-
onClickIndex && onClickIndex(key);
|
|
274
|
-
};
|
|
275
|
-
|
|
276
|
-
var setListGroup = function setListGroup() {
|
|
277
|
-
if (listview.current) {
|
|
278
|
-
var els = listview.current.querySelectorAll('.nut-elevator__list__item');
|
|
279
|
-
els.forEach(function (el) {
|
|
280
|
-
if (el != null && !state.current.listGroup.includes(el)) {
|
|
281
|
-
state.current.listGroup.push(el);
|
|
282
|
-
}
|
|
283
|
-
});
|
|
284
|
-
}
|
|
285
|
-
};
|
|
286
|
-
|
|
287
|
-
var listViewScroll = function listViewScroll(e) {
|
|
288
|
-
var listHeight = state.current.listHeight;
|
|
289
|
-
|
|
290
|
-
if (!listHeight.length) {
|
|
291
|
-
calculateHeight();
|
|
292
|
-
}
|
|
293
|
-
|
|
294
|
-
var target = e.target;
|
|
295
|
-
var scrollTop = target.scrollTop;
|
|
296
|
-
state.current.scrollY = scrollTop;
|
|
297
|
-
setScrollY(scrollTop);
|
|
298
|
-
|
|
299
|
-
for (var i = 0; i < listHeight.length - 1; i++) {
|
|
300
|
-
var height1 = listHeight[i];
|
|
301
|
-
var height2 = listHeight[i + 1];
|
|
302
|
-
|
|
303
|
-
if (state.current.scrollY >= height1 && state.current.scrollY < height2) {
|
|
304
|
-
setCurrentIndex(i);
|
|
305
|
-
state.current.diff = height2 - state.current.scrollY;
|
|
306
|
-
return;
|
|
307
|
-
}
|
|
308
|
-
}
|
|
309
|
-
|
|
310
|
-
setCurrentIndex(listHeight.length - 2);
|
|
311
|
-
};
|
|
312
|
-
|
|
313
|
-
useEffect(function () {
|
|
314
|
-
if (listview.current) {
|
|
315
|
-
setListGroup();
|
|
316
|
-
listview.current.addEventListener('scroll', listViewScroll);
|
|
317
|
-
}
|
|
318
|
-
}, [listview]);
|
|
319
|
-
useEffect(function () {
|
|
320
|
-
var _state$current = state.current,
|
|
321
|
-
listHeight = _state$current.listHeight,
|
|
322
|
-
diff = _state$current.diff,
|
|
323
|
-
scrollY = _state$current.scrollY;
|
|
324
|
-
var fixedTop = diff > 0 && diff < titleHeight ? diff - titleHeight : 0;
|
|
325
|
-
|
|
326
|
-
if (scrollY + clientHeight() === listHeight[listHeight.length - 1]) {
|
|
327
|
-
if (fixedTop !== 0) {
|
|
328
|
-
fixedTop = 0;
|
|
329
|
-
}
|
|
330
|
-
}
|
|
331
|
-
|
|
332
|
-
if (state.current.fixedTop === fixedTop) return;
|
|
333
|
-
state.current.fixedTop = fixedTop;
|
|
334
|
-
}, [state.current.diff, titleHeight]);
|
|
335
|
-
return React__default.createElement("div", _objectSpread({
|
|
336
|
-
className: "".concat(b(), " ").concat(className)
|
|
337
|
-
}, rest), isSticky && scrollY > 0 ? React__default.createElement("div", {
|
|
338
|
-
className: b('list__fixed')
|
|
339
|
-
}, React__default.createElement("span", {
|
|
340
|
-
className: "fixed-title"
|
|
341
|
-
}, indexList[currentIndex][acceptKey])) : null, React__default.createElement("div", {
|
|
342
|
-
className: b('list'),
|
|
343
|
-
style: {
|
|
344
|
-
height: Number.isNaN(+height) ? height : "".concat(height, "px")
|
|
345
|
-
}
|
|
346
|
-
}, React__default.createElement("div", {
|
|
347
|
-
className: b('list__inner'),
|
|
348
|
-
ref: listview
|
|
349
|
-
}, indexList.map(function (item, idx) {
|
|
350
|
-
return React__default.createElement("div", {
|
|
351
|
-
className: b('list__item'),
|
|
352
|
-
key: idx
|
|
353
|
-
}, React__default.createElement("div", {
|
|
354
|
-
className: b('list__item__code')
|
|
355
|
-
}, item[acceptKey]), React__default.createElement(React__default.Fragment, null, item.list.map(function (subitem) {
|
|
356
|
-
return React__default.createElement("div", {
|
|
357
|
-
className: b('list__item__name', {
|
|
358
|
-
highcolor: currentData.id === subitem.id && currentKey === item[acceptKey]
|
|
359
|
-
}),
|
|
360
|
-
key: subitem.id,
|
|
361
|
-
onClick: function onClick() {
|
|
362
|
-
return handleClickItem(item[acceptKey], subitem);
|
|
363
|
-
}
|
|
364
|
-
}, children ? React__default.createElement(React__default.Fragment, null, React__default.createElement(elevatorContext.Provider, {
|
|
365
|
-
value: subitem
|
|
366
|
-
}, children)) : subitem.name);
|
|
367
|
-
})));
|
|
368
|
-
}))), indexList.length && scrollStart ? React__default.createElement("div", {
|
|
369
|
-
className: b('code--current', {
|
|
370
|
-
current: true
|
|
371
|
-
})
|
|
372
|
-
}, indexList[codeIndex][acceptKey]) : null, React__default.createElement("div", {
|
|
373
|
-
className: b('bars')
|
|
374
|
-
}, React__default.createElement(animated.div, _objectSpread(_objectSpread({
|
|
375
|
-
className: b('bars__inner')
|
|
376
|
-
}, bind()), {}, {
|
|
377
|
-
style: {
|
|
378
|
-
touchAction: 'pan-y'
|
|
379
|
-
}
|
|
380
|
-
}), indexList.map(function (item, index) {
|
|
381
|
-
return React__default.createElement("div", {
|
|
382
|
-
className: b('bars__inner__item', {
|
|
383
|
-
active: item[acceptKey] === indexList[currentIndex][acceptKey]
|
|
384
|
-
}),
|
|
385
|
-
"data-index": index,
|
|
386
|
-
key: index,
|
|
387
|
-
onClick: function onClick() {
|
|
388
|
-
return handleClickIndex(item[acceptKey]);
|
|
389
|
-
}
|
|
390
|
-
}, item[acceptKey]);
|
|
391
|
-
}))));
|
|
392
|
-
};
|
|
393
|
-
|
|
394
|
-
Elevator.defaultProps = defaultProps$2;
|
|
395
|
-
Elevator.displayName = 'NutElevator';
|
|
396
117
|
var defaultProps$1 = {
|
|
397
118
|
modelValue: [],
|
|
398
119
|
type: 'custom',
|
|
@@ -419,27 +140,27 @@ var CustomRender = function CustomRender(props) {
|
|
|
419
140
|
onNextArea = _defaultProps$1$props.onNextArea,
|
|
420
141
|
onTabClick = _defaultProps$1$props.onTabClick,
|
|
421
142
|
onClose = _defaultProps$1$props.onClose,
|
|
422
|
-
rest = _objectWithoutProperties(_defaultProps$1$props,
|
|
143
|
+
rest = _objectWithoutProperties(_defaultProps$1$props, _excluded2);
|
|
423
144
|
|
|
424
145
|
var b = cn('address');
|
|
425
146
|
|
|
426
|
-
var
|
|
427
|
-
|
|
428
|
-
privateType =
|
|
429
|
-
|
|
430
|
-
var
|
|
431
|
-
|
|
432
|
-
tabIndex =
|
|
433
|
-
setTabIndex =
|
|
434
|
-
|
|
435
|
-
var
|
|
436
|
-
|
|
437
|
-
tabName =
|
|
438
|
-
|
|
439
|
-
|
|
440
|
-
|
|
441
|
-
|
|
442
|
-
|
|
147
|
+
var _useState = useState(type),
|
|
148
|
+
_useState2 = _slicedToArray(_useState, 1),
|
|
149
|
+
privateType = _useState2[0];
|
|
150
|
+
|
|
151
|
+
var _useState3 = useState(0),
|
|
152
|
+
_useState4 = _slicedToArray(_useState3, 2),
|
|
153
|
+
tabIndex = _useState4[0],
|
|
154
|
+
setTabIndex = _useState4[1];
|
|
155
|
+
|
|
156
|
+
var _useState5 = useState(['province', 'city', 'country', 'town']),
|
|
157
|
+
_useState6 = _slicedToArray(_useState5, 1),
|
|
158
|
+
tabName = _useState6[0];
|
|
159
|
+
|
|
160
|
+
useRef(null);
|
|
161
|
+
useRef(null);
|
|
162
|
+
useRef(null);
|
|
163
|
+
useRef(null);
|
|
443
164
|
var regionLine = useRef(null);
|
|
444
165
|
|
|
445
166
|
var isCustom2 = function isCustom2() {
|
|
@@ -478,18 +199,18 @@ var CustomRender = function CustomRender(props) {
|
|
|
478
199
|
return newData;
|
|
479
200
|
};
|
|
480
201
|
|
|
481
|
-
var
|
|
202
|
+
var _useState7 = useState({
|
|
482
203
|
province: isCustom2() ? transformData(province) : province,
|
|
483
204
|
city: isCustom2() ? transformData(city) : city,
|
|
484
205
|
country: isCustom2() ? transformData(country) : country,
|
|
485
206
|
town: isCustom2() ? transformData(town) : town
|
|
486
207
|
}),
|
|
487
|
-
|
|
488
|
-
regionList =
|
|
489
|
-
setRegionList =
|
|
208
|
+
_useState8 = _slicedToArray(_useState7, 2),
|
|
209
|
+
regionList = _useState8[0],
|
|
210
|
+
setRegionList = _useState8[1]; // 已选择的 省、市、县、镇
|
|
490
211
|
|
|
491
212
|
|
|
492
|
-
var
|
|
213
|
+
var _useState9 = useState({
|
|
493
214
|
province: {
|
|
494
215
|
name: ''
|
|
495
216
|
},
|
|
@@ -503,14 +224,14 @@ var CustomRender = function CustomRender(props) {
|
|
|
503
224
|
name: ''
|
|
504
225
|
}
|
|
505
226
|
}),
|
|
506
|
-
|
|
507
|
-
selectedRegion =
|
|
508
|
-
setSelectedRegion =
|
|
227
|
+
_useState10 = _slicedToArray(_useState9, 2),
|
|
228
|
+
selectedRegion = _useState10[0],
|
|
229
|
+
setSelectedRegion = _useState10[1];
|
|
509
230
|
|
|
510
|
-
var
|
|
511
|
-
|
|
512
|
-
lineDistance =
|
|
513
|
-
setLineDistance =
|
|
231
|
+
var _useState11 = useState(20),
|
|
232
|
+
_useState12 = _slicedToArray(_useState11, 2),
|
|
233
|
+
lineDistance = _useState12[0],
|
|
234
|
+
setLineDistance = _useState12[1]; // 获取已选地区列表名称
|
|
514
235
|
|
|
515
236
|
|
|
516
237
|
var getTabName = function getTabName(item, index) {
|
|
@@ -519,25 +240,18 @@ var CustomRender = function CustomRender(props) {
|
|
|
519
240
|
}
|
|
520
241
|
|
|
521
242
|
return locale.select;
|
|
522
|
-
};
|
|
523
|
-
|
|
524
|
-
var mapRef = {
|
|
525
|
-
province: provinceRef,
|
|
526
|
-
city: cityRef,
|
|
527
|
-
country: countryRef,
|
|
528
|
-
town: townRef
|
|
529
243
|
}; // 移动下面的红线
|
|
530
244
|
|
|
245
|
+
|
|
531
246
|
var lineAnimation = function lineAnimation(index) {
|
|
532
247
|
setTimeout(function () {
|
|
533
248
|
var name = tabName[index];
|
|
534
|
-
|
|
535
|
-
|
|
536
|
-
|
|
537
|
-
|
|
538
|
-
|
|
539
|
-
|
|
540
|
-
}, 0);
|
|
249
|
+
Taro.createSelectorQuery().selectAll(".".concat(name)).boundingClientRect(function (rects) {
|
|
250
|
+
rects && rects.length > 0 && rects.forEach(function (rect) {
|
|
251
|
+
if (rect.width > 0) setLineDistance(rect.left || 20);
|
|
252
|
+
});
|
|
253
|
+
}).exec();
|
|
254
|
+
}, 100);
|
|
541
255
|
}; // 切换下一级列表
|
|
542
256
|
|
|
543
257
|
|
|
@@ -630,10 +344,6 @@ var CustomRender = function CustomRender(props) {
|
|
|
630
344
|
}
|
|
631
345
|
};
|
|
632
346
|
|
|
633
|
-
var handleElevatorItem = function handleElevatorItem(key, item) {
|
|
634
|
-
nextAreaList(item);
|
|
635
|
-
};
|
|
636
|
-
|
|
637
347
|
useEffect(function () {
|
|
638
348
|
var _defaultProps$1$props2 = _objectSpread(_objectSpread({}, defaultProps$1), props),
|
|
639
349
|
province = _defaultProps$1$props2.province;
|
|
@@ -675,9 +385,8 @@ var CustomRender = function CustomRender(props) {
|
|
|
675
385
|
className: b('region-tab')
|
|
676
386
|
}, selectedRegion && Object.keys(selectedRegion).map(function (key, index) {
|
|
677
387
|
return React__default.createElement("div", {
|
|
678
|
-
className: "".concat(b('tab-item'), " ").concat(index === tabIndex ? 'active' : ''),
|
|
388
|
+
className: "".concat(b('tab-item'), " ").concat(index === tabIndex ? 'active' : '', " ").concat(tabName[index]),
|
|
679
389
|
key: index,
|
|
680
|
-
ref: mapRef[key],
|
|
681
390
|
onClick: function onClick() {
|
|
682
391
|
return changeRegionTab(selectedRegion[key], index, key);
|
|
683
392
|
}
|
|
@@ -706,13 +415,7 @@ var CustomRender = function CustomRender(props) {
|
|
|
706
415
|
color: "#FA2C19",
|
|
707
416
|
size: "13px"
|
|
708
417
|
}), item.name));
|
|
709
|
-
})))
|
|
710
|
-
className: b('elevator-group')
|
|
711
|
-
}, React__default.createElement(Elevator, {
|
|
712
|
-
height: height,
|
|
713
|
-
indexList: regionList[tabName[tabIndex]],
|
|
714
|
-
onClickItem: handleElevatorItem
|
|
715
|
-
})));
|
|
418
|
+
}))));
|
|
716
419
|
};
|
|
717
420
|
|
|
718
421
|
var defaultProps = _objectSpread(_objectSpread({}, ComponentDefaults), {}, {
|
|
@@ -768,25 +471,25 @@ var Address = function Address(props) {
|
|
|
768
471
|
className = _defaultProps$props.className,
|
|
769
472
|
iconClassPrefix = _defaultProps$props.iconClassPrefix,
|
|
770
473
|
iconFontClassName = _defaultProps$props.iconFontClassName,
|
|
771
|
-
rest = _objectWithoutProperties(_defaultProps$props,
|
|
474
|
+
rest = _objectWithoutProperties(_defaultProps$props, _excluded3);
|
|
772
475
|
|
|
773
476
|
var b = cn('address');
|
|
774
477
|
|
|
775
|
-
var
|
|
776
|
-
|
|
777
|
-
privateType =
|
|
778
|
-
setPrivateType =
|
|
478
|
+
var _useState13 = useState(type),
|
|
479
|
+
_useState14 = _slicedToArray(_useState13, 2),
|
|
480
|
+
privateType = _useState14[0],
|
|
481
|
+
setPrivateType = _useState14[1];
|
|
779
482
|
|
|
780
|
-
var
|
|
781
|
-
|
|
782
|
-
tabName =
|
|
483
|
+
var _useState15 = useState(['province', 'city', 'country', 'town']),
|
|
484
|
+
_useState16 = _slicedToArray(_useState15, 1),
|
|
485
|
+
tabName = _useState16[0];
|
|
783
486
|
|
|
784
|
-
var
|
|
785
|
-
|
|
786
|
-
showPopup =
|
|
787
|
-
setShowPopup =
|
|
487
|
+
var _useState17 = useState(modelValue),
|
|
488
|
+
_useState18 = _slicedToArray(_useState17, 2),
|
|
489
|
+
showPopup = _useState18[0],
|
|
490
|
+
setShowPopup = _useState18[1];
|
|
788
491
|
|
|
789
|
-
var
|
|
492
|
+
var _useState19 = useState({
|
|
790
493
|
province: {
|
|
791
494
|
name: ''
|
|
792
495
|
},
|
|
@@ -800,15 +503,15 @@ var Address = function Address(props) {
|
|
|
800
503
|
name: ''
|
|
801
504
|
}
|
|
802
505
|
}),
|
|
803
|
-
|
|
804
|
-
selectedRegion =
|
|
805
|
-
setSelectedRegion =
|
|
506
|
+
_useState20 = _slicedToArray(_useState19, 2),
|
|
507
|
+
selectedRegion = _useState20[0],
|
|
508
|
+
setSelectedRegion = _useState20[1]; // 已选择的 省、市、县、镇
|
|
806
509
|
|
|
807
510
|
|
|
808
|
-
var
|
|
809
|
-
|
|
810
|
-
selectedExistAddress =
|
|
811
|
-
setSelectedExistAddress =
|
|
511
|
+
var _useState21 = useState({}),
|
|
512
|
+
_useState22 = _slicedToArray(_useState21, 2),
|
|
513
|
+
selectedExistAddress = _useState22[0],
|
|
514
|
+
setSelectedExistAddress = _useState22[1]; // 当前选择的地址
|
|
812
515
|
// 手动关闭 点击叉号(cross),或者蒙层(mask)
|
|
813
516
|
|
|
814
517
|
|
|
@@ -3,6 +3,7 @@ import _createClass from "@babel/runtime/helpers/createClass";
|
|
|
3
3
|
import _inherits from "@babel/runtime/helpers/inherits";
|
|
4
4
|
import _possibleConstructorReturn from "@babel/runtime/helpers/possibleConstructorReturn";
|
|
5
5
|
import _getPrototypeOf from "@babel/runtime/helpers/getPrototypeOf";
|
|
6
|
+
import _slicedToArray from "@babel/runtime/helpers/slicedToArray";
|
|
6
7
|
import _defineProperty from "@babel/runtime/helpers/defineProperty";
|
|
7
8
|
import _objectWithoutProperties from "@babel/runtime/helpers/objectWithoutProperties";
|
|
8
9
|
var _excluded = ["maxLen", "endNumber", "delaySpeed", "easeSpeed", "className", "thousands"];
|
|
@@ -15,7 +16,7 @@ function ownKeys(object, enumerableOnly) { var keys = Object.keys(object); if (O
|
|
|
15
16
|
|
|
16
17
|
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; }
|
|
17
18
|
|
|
18
|
-
import React__default, { useRef, useEffect, Component } from 'react';
|
|
19
|
+
import React__default, { useRef, useState, useEffect, Component } from 'react';
|
|
19
20
|
import Taro from '@tarojs/taro';
|
|
20
21
|
import { c as cn } from './bem-893ad28d.js';
|
|
21
22
|
var defaultProps$1 = {
|
|
@@ -53,46 +54,61 @@ var CountUp = function CountUp(props) {
|
|
|
53
54
|
return currNumber.split('');
|
|
54
55
|
};
|
|
55
56
|
|
|
56
|
-
var
|
|
57
|
+
var _useState = useState([]),
|
|
58
|
+
_useState2 = _slicedToArray(_useState, 2),
|
|
59
|
+
numerArr = _useState2[0],
|
|
60
|
+
setNumerArr = _useState2[1];
|
|
61
|
+
|
|
62
|
+
var _useState3 = useState([]),
|
|
63
|
+
_useState4 = _slicedToArray(_useState3, 2),
|
|
64
|
+
transformArr = _useState4[0],
|
|
65
|
+
setTransformArr = _useState4[1];
|
|
66
|
+
|
|
67
|
+
var isLoaded = useRef(false);
|
|
57
68
|
|
|
58
69
|
var setNumberTransform = function setNumberTransform() {
|
|
59
|
-
if (countupRef.current) {
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
// )
|
|
63
|
-
Taro.createSelectorQuery().selectAll('.nut-countup__number').node(function (numberItems) {
|
|
64
|
-
var numberFilterArr = numerArr.filter(function (item) {
|
|
65
|
-
return !Number.isNaN(Number(item));
|
|
66
|
-
});
|
|
70
|
+
if (countupRef.current && numerArr.length) {
|
|
71
|
+
Taro.createSelectorQuery().selectAll('.nut-countup__listitem').node(function (numberItems) {
|
|
72
|
+
var transformArrCache = [];
|
|
67
73
|
Object.keys(numberItems).forEach(function (key) {
|
|
68
74
|
var elem = numberItems[Number(key)];
|
|
69
|
-
var idx = Number(
|
|
75
|
+
var idx = Number(numerArr[Number(key)]);
|
|
70
76
|
|
|
71
|
-
if (
|
|
77
|
+
if (elem) {
|
|
72
78
|
// 计算规则:父元素和实际列表高度的百分比,分割成20等份
|
|
73
|
-
var transform = "translate(0, -".concat((idx === 0 ? 10 : idx) * 5, "%)");
|
|
74
|
-
|
|
75
|
-
elem.style.webkitTransform = transform;
|
|
79
|
+
var transform = idx || idx === 0 ? "translate(0, -".concat((idx === 0 ? 10 : idx) * 5, "%)") : '';
|
|
80
|
+
transformArrCache.push(transform);
|
|
76
81
|
}
|
|
77
82
|
});
|
|
83
|
+
setTransformArr([].concat(transformArrCache));
|
|
78
84
|
}).exec();
|
|
79
85
|
}
|
|
80
86
|
};
|
|
81
87
|
|
|
82
|
-
var numberEaseStyle = {
|
|
83
|
-
|
|
88
|
+
var numberEaseStyle = function numberEaseStyle(idx) {
|
|
89
|
+
return {
|
|
90
|
+
transition: "transform ".concat(easeSpeed, "s ease-in-out"),
|
|
91
|
+
transform: transformArr[idx] ? transformArr[idx] : null
|
|
92
|
+
};
|
|
84
93
|
};
|
|
94
|
+
|
|
85
95
|
useEffect(function () {
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
96
|
+
setNumberTransform();
|
|
97
|
+
}, [numerArr]);
|
|
98
|
+
useEffect(function () {
|
|
99
|
+
if (!isLoaded.current) {
|
|
100
|
+
isLoaded.current = true;
|
|
101
|
+
timerRef.current = window.setTimeout(function () {
|
|
102
|
+
setNumerArr(getShowNumber());
|
|
103
|
+
}, delaySpeed);
|
|
104
|
+
} else {
|
|
105
|
+
setNumerArr(getShowNumber());
|
|
106
|
+
}
|
|
107
|
+
|
|
89
108
|
return function () {
|
|
90
109
|
window.clearTimeout(timerRef.current);
|
|
91
110
|
};
|
|
92
|
-
}, []);
|
|
93
|
-
useEffect(function () {
|
|
94
|
-
setNumberTransform();
|
|
95
|
-
}, [numerArr]);
|
|
111
|
+
}, [endNumber]);
|
|
96
112
|
return React__default.createElement("div", {
|
|
97
113
|
className: "".concat(b(), " ").concat(className),
|
|
98
114
|
ref: countupRef
|
|
@@ -106,7 +122,7 @@ var CountUp = function CountUp(props) {
|
|
|
106
122
|
key: idx
|
|
107
123
|
}, !Number.isNaN(Number(item)) ? React__default.createElement("span", {
|
|
108
124
|
className: b('number'),
|
|
109
|
-
style: numberEaseStyle
|
|
125
|
+
style: numberEaseStyle(idx)
|
|
110
126
|
}, [].concat(numbers, numbers).map(function (number, subidx) {
|
|
111
127
|
return React__default.createElement("span", {
|
|
112
128
|
key: subidx
|