@nutui/nutui-react-taro 1.4.13 → 1.4.14-beta.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/esm/Cascader.js +2 -2
- package/dist/esm/DatePicker.js +3 -2
- package/dist/esm/GridItem.js +1 -1
- package/dist/esm/Input.js +1 -1
- package/dist/esm/Picker.js +2 -1
- package/dist/esm/Tabs.js +1 -1
- package/dist/esm/TextArea.js +1 -1
- package/dist/esm/{cascader.taro-a824b371.js → cascader.taro-eb1fb011.js} +1 -1
- package/dist/esm/{datepicker.taro-a86c6052.js → datepicker.taro-6e9b4b8f.js} +3 -2
- package/dist/esm/{griditem.taro-da155df6.js → griditem.taro-cdb3f119.js} +3 -2
- package/dist/esm/{input.taro-851446b6.js → input.taro-0b72dce2.js} +1 -1
- package/dist/esm/nutui-react.es.js +7 -7
- package/dist/esm/{picker.taro-f32ec88a.js → picker.taro-9ad1b7c5.js} +153 -103
- package/dist/esm/{tabs.taro-07e4adce.js → tabs.taro-6a7524a4.js} +5 -2
- package/dist/esm/{textarea.taro-92a1651c.js → textarea.taro-442e7350.js} +1 -3
- package/dist/locales/base.js +1 -1
- package/dist/locales/en-US.js +1 -1
- package/dist/locales/id-ID.js +1 -1
- package/dist/locales/zh-CN.js +1 -1
- package/dist/locales/zh-TW.js +1 -1
- package/dist/locales/zh-UG.js +1 -1
- package/dist/nutui.react.mjs +193 -119
- package/dist/nutui.react.umd.js +192 -118
- package/dist/packages/picker/picker.scss +103 -97
- package/dist/packages/swiper/swiper1.scss +65 -0
- package/dist/style.css +1 -1
- package/dist/style.mjs +1 -1
- package/package.json +23 -16
package/dist/esm/Cascader.js
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { C as Cascader } from './cascader.taro-
|
|
1
|
+
import { C as Cascader } from './cascader.taro-eb1fb011.js';
|
|
2
2
|
import 'react';
|
|
3
3
|
import 'classnames';
|
|
4
4
|
import './popup.taro-01676bff.js';
|
|
@@ -10,7 +10,7 @@ import '@bem-react/classname';
|
|
|
10
10
|
import '@tarojs/components';
|
|
11
11
|
import './icon.taro-296a1bec.js';
|
|
12
12
|
import './typings-b9828dba.js';
|
|
13
|
-
import './tabs.taro-
|
|
13
|
+
import './tabs.taro-6a7524a4.js';
|
|
14
14
|
import './tabpane.taro-4ca340ef.js';
|
|
15
15
|
|
|
16
16
|
|
package/dist/esm/DatePicker.js
CHANGED
|
@@ -1,6 +1,7 @@
|
|
|
1
|
-
import { D as DatePicker } from './datepicker.taro-
|
|
1
|
+
import { D as DatePicker } from './datepicker.taro-6e9b4b8f.js';
|
|
2
2
|
import 'react';
|
|
3
|
-
import './picker.taro-
|
|
3
|
+
import './picker.taro-9ad1b7c5.js';
|
|
4
|
+
import '@tarojs/taro';
|
|
4
5
|
import '@tarojs/components';
|
|
5
6
|
import './popup.taro-01676bff.js';
|
|
6
7
|
import 'react-dom';
|
package/dist/esm/GridItem.js
CHANGED
package/dist/esm/Input.js
CHANGED
package/dist/esm/Picker.js
CHANGED
package/dist/esm/Tabs.js
CHANGED
package/dist/esm/TextArea.js
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import React__default, { useState, useEffect } from 'react';
|
|
2
2
|
import classNames from 'classnames';
|
|
3
3
|
import { P as Popup } from './popup.taro-01676bff.js';
|
|
4
|
-
import { T as Tabs } from './tabs.taro-
|
|
4
|
+
import { T as Tabs } from './tabs.taro-6a7524a4.js';
|
|
5
5
|
import { T as TabPane } from './tabpane.taro-4ca340ef.js';
|
|
6
6
|
import { I as Icon } from './icon.taro-296a1bec.js';
|
|
7
7
|
import { c as cn } from './bem-350c1702.js';
|
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
import React__default, { useState, useRef, useEffect } from 'react';
|
|
2
|
-
import { P as Picker } from './picker.taro-
|
|
2
|
+
import { P as Picker } from './picker.taro-9ad1b7c5.js';
|
|
3
3
|
import { u as useConfig } from './configprovider-67d19d3a.js';
|
|
4
|
+
import { View } from '@tarojs/components';
|
|
4
5
|
|
|
5
6
|
const currentYear = new Date().getFullYear();
|
|
6
7
|
const defaultProps = {
|
|
@@ -266,7 +267,7 @@ const DatePicker = (props) => {
|
|
|
266
267
|
setListData(columns());
|
|
267
268
|
}
|
|
268
269
|
}, [currentDate]);
|
|
269
|
-
return (React__default.createElement(
|
|
270
|
+
return (React__default.createElement(View, { className: `nut-datepicker ${className || ''}`, style: style, ...rest, catchMove: true }, listData.length > 0 && (React__default.createElement(Picker, { title: title, isVisible: show, listData: listData, onClose: onCloseDatePicker, defaultValueData: defaultValue, onConfirm: (values, options) => onConfirmDatePicker && onConfirmDatePicker(values, options), onChange: (index, value, list) => updateChooseValueCustmer(index, value, list), threeDimensional: threeDimensional, ref: pickerRef }))));
|
|
270
271
|
};
|
|
271
272
|
DatePicker.defaultProps = defaultProps;
|
|
272
273
|
DatePicker.displayName = 'NutDatePicker';
|
|
@@ -26,11 +26,12 @@ const defaultProps = {
|
|
|
26
26
|
};
|
|
27
27
|
const GridItem = (props) => {
|
|
28
28
|
useConfig();
|
|
29
|
-
const { children, columnNum, index, gutter, square, text, fontSize, color, icon, iconColor, iconSize, parentIconSize, parentIconColor, border, center, reverse, direction, iconClassPrefix, iconFontClassName, onClick, ...rest } = {
|
|
29
|
+
const { children, columnNum, index, gutter, square, text, fontSize, color, icon, iconColor, iconSize, parentIconSize, parentIconColor, border, center, reverse, direction, iconClassPrefix, iconFontClassName, className, onClick, ...rest } = {
|
|
30
30
|
...defaultProps,
|
|
31
31
|
...props,
|
|
32
32
|
};
|
|
33
33
|
const b = cn('grid-item');
|
|
34
|
+
const classes = classNames(b(), className);
|
|
34
35
|
const context = useContext(GridContext);
|
|
35
36
|
const pxCheck = (value) => {
|
|
36
37
|
return Number.isNaN(Number(value)) ? String(value) : `${value}px`;
|
|
@@ -85,7 +86,7 @@ const GridItem = (props) => {
|
|
|
85
86
|
color,
|
|
86
87
|
}, index);
|
|
87
88
|
};
|
|
88
|
-
return (React__default.createElement("div", { className:
|
|
89
|
+
return (React__default.createElement("div", { className: classes, style: rootStyle(), ...rest, onClick: handleClick },
|
|
89
90
|
React__default.createElement("div", { className: contentClass() },
|
|
90
91
|
icon && isIconName() ? (React__default.createElement(Icon, { classPrefix: iconClassPrefix, fontClassName: iconFontClassName, name: icon, size: iconSize || parentIconSize, color: iconColor || parentIconColor })) : (React__default.createElement(React__default.Fragment, null, icon)),
|
|
91
92
|
text && (React__default.createElement("div", { className: "nut-grid-item__text", style: { fontSize, color } }, text)),
|
|
@@ -154,7 +154,7 @@ const Input = forwardRef((props, ref) => {
|
|
|
154
154
|
if (maxlength && val.length > Number(maxlength)) {
|
|
155
155
|
val = val.slice(0, Number(maxlength));
|
|
156
156
|
}
|
|
157
|
-
updateValue(
|
|
157
|
+
updateValue(val, 'onBlur');
|
|
158
158
|
onBlur && onBlur(val, event);
|
|
159
159
|
};
|
|
160
160
|
const handleClickInput = (event) => {
|
|
@@ -9,7 +9,7 @@ export { P as Popup } from './popup.taro-01676bff.js';
|
|
|
9
9
|
export { C as Col } from './col.taro-53eed3cc.js';
|
|
10
10
|
export { D as Divider } from './divider.taro-26d1d8b4.js';
|
|
11
11
|
export { G as Grid } from './grid.taro-3503b82c.js';
|
|
12
|
-
export { G as GridItem } from './griditem.taro-
|
|
12
|
+
export { G as GridItem } from './griditem.taro-cdb3f119.js';
|
|
13
13
|
export { L as Layout } from './layout.taro-9046d093.js';
|
|
14
14
|
export { R as Row } from './row.taro-f64d4a13.js';
|
|
15
15
|
export { S as Sticky } from './sticky.taro-218bda37.js';
|
|
@@ -26,24 +26,24 @@ export { S as SubSideNavBar } from './subsidenavbar.taro-69cb9752.js';
|
|
|
26
26
|
export { T as Tabbar } from './tabbar.taro-9acfc2fa.js';
|
|
27
27
|
export { T as TabbarItem } from './tabbaritem.taro-bf517487.js';
|
|
28
28
|
export { T as TabPane } from './tabpane.taro-4ca340ef.js';
|
|
29
|
-
export { T as Tabs } from './tabs.taro-
|
|
29
|
+
export { T as Tabs } from './tabs.taro-6a7524a4.js';
|
|
30
30
|
export { C as Calendar } from './calendar.taro-670842ea.js';
|
|
31
31
|
export { C as CalendarItem } from './calendaritem.taro-2a603571.js';
|
|
32
|
-
export { C as Cascader } from './cascader.taro-
|
|
32
|
+
export { C as Cascader } from './cascader.taro-eb1fb011.js';
|
|
33
33
|
export { C as Checkbox, a as CheckboxGroup } from './checkbox.taro-6120e3e3.js';
|
|
34
|
-
export { D as DatePicker } from './datepicker.taro-
|
|
34
|
+
export { D as DatePicker } from './datepicker.taro-6e9b4b8f.js';
|
|
35
35
|
export { F as Form } from './form.taro-0c8e7a39.js';
|
|
36
36
|
export { F as FormItem } from './formitem.taro-190a3326.js';
|
|
37
|
-
export { I as Input } from './input.taro-
|
|
37
|
+
export { I as Input } from './input.taro-0b72dce2.js';
|
|
38
38
|
export { I as InputNumber } from './inputnumber.taro-7c2d7e85.js';
|
|
39
39
|
export { N as NumberKeyboard } from './numberkeyboard.taro-1bc24744.js';
|
|
40
|
-
export { P as Picker } from './picker.taro-
|
|
40
|
+
export { P as Picker } from './picker.taro-9ad1b7c5.js';
|
|
41
41
|
export { R as Radio, a as RadioGroup } from './radio.taro-a6eff96c.js';
|
|
42
42
|
export { R as Range } from './range.taro-d8fc7656.js';
|
|
43
43
|
export { R as Rate } from './rate.taro-6cdf03bd.js';
|
|
44
44
|
export { S as SearchBar } from './searchbar.taro-0c25927b.js';
|
|
45
45
|
export { S as ShortPassword } from './shortpassword.taro-9ee034f7.js';
|
|
46
|
-
export { T as TextArea } from './textarea.taro-
|
|
46
|
+
export { T as TextArea } from './textarea.taro-442e7350.js';
|
|
47
47
|
export { U as Uploader } from './uploader.taro-c615fd4c.js';
|
|
48
48
|
export { A as ActionSheet } from './actionsheet.taro-e6a51446.js';
|
|
49
49
|
export { B as BackTop } from './backtop.taro-66394a36.js';
|
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import React__default, { useState, useRef, useEffect, useImperativeHandle } from 'react';
|
|
2
|
-
import
|
|
2
|
+
import Taro from '@tarojs/taro';
|
|
3
|
+
import { View, PickerView, PickerViewColumn } from '@tarojs/components';
|
|
3
4
|
import { P as Popup } from './popup.taro-01676bff.js';
|
|
4
5
|
import { u as useTouch } from './useTouch-db24bb5c.js';
|
|
5
6
|
import { g as getRectByTaro } from './useClientRect-1f8ed1fe.js';
|
|
@@ -17,14 +18,13 @@ const InternalPickerSlot = (props, ref) => {
|
|
|
17
18
|
const INERTIA_TIME = 300;
|
|
18
19
|
const INERTIA_DISTANCE = 15;
|
|
19
20
|
const [currIndex, setCurrIndex] = useState(1);
|
|
20
|
-
// let lineSpacing = 36
|
|
21
21
|
const lineSpacing = useRef(36);
|
|
22
22
|
const [touchTime, setTouchTime] = useState(0);
|
|
23
23
|
const [touchDeg, setTouchDeg] = useState('0deg');
|
|
24
24
|
const rotation = 20;
|
|
25
25
|
const moving = useRef(false);
|
|
26
26
|
let timer;
|
|
27
|
-
const
|
|
27
|
+
const listRef = useRef(null);
|
|
28
28
|
const rollerRef = useRef(null);
|
|
29
29
|
const pickerSlotRef = useRef(null);
|
|
30
30
|
const [startTime, setStartTime] = useState(0);
|
|
@@ -164,7 +164,7 @@ const InternalPickerSlot = (props, ref) => {
|
|
|
164
164
|
}
|
|
165
165
|
};
|
|
166
166
|
const getReference = async () => {
|
|
167
|
-
const refe = await getRectByTaro(
|
|
167
|
+
const refe = await getRectByTaro(listRef?.current);
|
|
168
168
|
lineSpacing.current = refe.height ? refe.height : 36;
|
|
169
169
|
modifyStatus(true);
|
|
170
170
|
};
|
|
@@ -219,7 +219,7 @@ const InternalPickerSlot = (props, ref) => {
|
|
|
219
219
|
React__default.createElement(React__default.Fragment, null, item.text ? item.text : item)));
|
|
220
220
|
})),
|
|
221
221
|
React__default.createElement("div", { className: "nut-picker-mask" }),
|
|
222
|
-
React__default.createElement("div", { className: "nut-picker-indicator", ref:
|
|
222
|
+
React__default.createElement("div", { className: "nut-picker-indicator", ref: listRef })));
|
|
223
223
|
};
|
|
224
224
|
const PickerSlot = React__default.forwardRef(InternalPickerSlot);
|
|
225
225
|
|
|
@@ -245,52 +245,82 @@ const InternalPicker = (props, ref) => {
|
|
|
245
245
|
const [columnsList, setColumnsList] = useState([]); // 格式化后每一列的数据
|
|
246
246
|
const b = cn('picker');
|
|
247
247
|
const isConfirmEvent = useRef(false);
|
|
248
|
+
// 级联数据格式化
|
|
249
|
+
const formatCascade = (columns, values) => {
|
|
250
|
+
const formatted = [];
|
|
251
|
+
let cursor = {
|
|
252
|
+
text: '',
|
|
253
|
+
value: '',
|
|
254
|
+
children: columns,
|
|
255
|
+
};
|
|
256
|
+
let columnIndex = 0;
|
|
257
|
+
while (cursor && cursor.children) {
|
|
258
|
+
const options = cursor.children;
|
|
259
|
+
const value = values[columnIndex];
|
|
260
|
+
let index = options.findIndex((columnItem) => columnItem.value === value);
|
|
261
|
+
if (index === -1)
|
|
262
|
+
index = 0;
|
|
263
|
+
cursor = cursor.children[index];
|
|
264
|
+
columnIndex++;
|
|
265
|
+
formatted.push(options);
|
|
266
|
+
}
|
|
267
|
+
return formatted;
|
|
268
|
+
};
|
|
269
|
+
// 每一列的类型
|
|
270
|
+
const columnsType = () => {
|
|
271
|
+
const firstColumn = listData[0];
|
|
272
|
+
if (firstColumn) {
|
|
273
|
+
if (Array.isArray(firstColumn)) {
|
|
274
|
+
return 'multiple';
|
|
275
|
+
}
|
|
276
|
+
if ('children' in firstColumn) {
|
|
277
|
+
return 'cascade';
|
|
278
|
+
}
|
|
279
|
+
}
|
|
280
|
+
return 'single';
|
|
281
|
+
};
|
|
282
|
+
// 传入的数据格式化
|
|
283
|
+
const normalListData = () => {
|
|
284
|
+
const type = columnsType();
|
|
285
|
+
switch (type) {
|
|
286
|
+
case 'multiple':
|
|
287
|
+
return listData;
|
|
288
|
+
case 'cascade':
|
|
289
|
+
// 级联数据处理
|
|
290
|
+
return formatCascade(listData, chooseValueData);
|
|
291
|
+
default:
|
|
292
|
+
return [listData];
|
|
293
|
+
}
|
|
294
|
+
};
|
|
295
|
+
const init = () => {
|
|
296
|
+
// const data: (string | number)[] = []
|
|
297
|
+
const normalData = normalListData();
|
|
298
|
+
setColumnsList(normalData);
|
|
299
|
+
// normalData.length > 0 &&
|
|
300
|
+
// normalData.map((item) => {
|
|
301
|
+
// item[0] && data.push(item[0].value)
|
|
302
|
+
// return item
|
|
303
|
+
// })
|
|
304
|
+
// 为何要重置呢?
|
|
305
|
+
// if (!defaultValueData && chooseValueData.length === 0) {
|
|
306
|
+
// setchooseValueData([...data])
|
|
307
|
+
// }
|
|
308
|
+
};
|
|
309
|
+
// 列表格式修改
|
|
310
|
+
useEffect(() => {
|
|
311
|
+
init();
|
|
312
|
+
}, [listData]);
|
|
248
313
|
// 默认值修改
|
|
249
314
|
useEffect(() => {
|
|
250
315
|
if (defaultValueData &&
|
|
251
316
|
defaultValueData.length !== 0 &&
|
|
252
|
-
defaultValueData.toString() !== chooseValueData.toString()
|
|
317
|
+
defaultValueData.toString() !== chooseValueData.toString() &&
|
|
318
|
+
!currentValue.length) {
|
|
253
319
|
const data = [...defaultValueData];
|
|
254
320
|
setchooseValueData(data);
|
|
255
321
|
setColumnsList(normalListData());
|
|
256
322
|
}
|
|
257
323
|
}, [defaultValueData]);
|
|
258
|
-
// 选中值进行修改
|
|
259
|
-
useEffect(() => {
|
|
260
|
-
onChange && onChange(columnIndex, chooseValueData, selectedOptions());
|
|
261
|
-
if (isConfirmEvent.current) {
|
|
262
|
-
isConfirmEvent.current = false;
|
|
263
|
-
onConfirm && onConfirm(chooseValueData, selectedOptions());
|
|
264
|
-
}
|
|
265
|
-
}, [chooseValueData]);
|
|
266
|
-
// 列表格式修改
|
|
267
|
-
useEffect(() => {
|
|
268
|
-
init();
|
|
269
|
-
}, [listData]);
|
|
270
|
-
const closeActionSheet = () => {
|
|
271
|
-
onClose && onClose(chooseValueData, selectedOptions());
|
|
272
|
-
onCloseUpdate &&
|
|
273
|
-
onCloseUpdate(chooseValueData, selectedOptions(), pickerRef);
|
|
274
|
-
};
|
|
275
|
-
// 点击确定
|
|
276
|
-
const confirm = () => {
|
|
277
|
-
let movings = false;
|
|
278
|
-
refs.forEach((_ref) => {
|
|
279
|
-
if (_ref.moving)
|
|
280
|
-
movings = true;
|
|
281
|
-
_ref.stopMomentum();
|
|
282
|
-
});
|
|
283
|
-
if (movings) {
|
|
284
|
-
isConfirmEvent.current = true;
|
|
285
|
-
}
|
|
286
|
-
else {
|
|
287
|
-
onConfirm && onConfirm(chooseValueData, selectedOptions());
|
|
288
|
-
}
|
|
289
|
-
onClose && onClose(chooseValueData, selectedOptions());
|
|
290
|
-
setTimeout(() => {
|
|
291
|
-
isConfirmEvent.current = false;
|
|
292
|
-
}, 0);
|
|
293
|
-
};
|
|
294
324
|
const selectedOptions = () => {
|
|
295
325
|
const optins = [];
|
|
296
326
|
columnsList.map((column, index) => {
|
|
@@ -306,6 +336,20 @@ const InternalPicker = (props, ref) => {
|
|
|
306
336
|
});
|
|
307
337
|
return optins;
|
|
308
338
|
};
|
|
339
|
+
// 选中值进行修改
|
|
340
|
+
useEffect(() => {
|
|
341
|
+
Taro.getEnv() !== 'WEB' && setCurrentValue(defaultValuesConvert());
|
|
342
|
+
onChange && onChange(columnIndex, chooseValueData, selectedOptions());
|
|
343
|
+
if (isConfirmEvent.current) {
|
|
344
|
+
isConfirmEvent.current = false;
|
|
345
|
+
onConfirm && onConfirm(chooseValueData, selectedOptions());
|
|
346
|
+
}
|
|
347
|
+
}, [chooseValueData]);
|
|
348
|
+
const closeActionSheet = () => {
|
|
349
|
+
onClose && onClose(chooseValueData, selectedOptions());
|
|
350
|
+
onCloseUpdate &&
|
|
351
|
+
onCloseUpdate(chooseValueData, selectedOptions(), pickerRef);
|
|
352
|
+
};
|
|
309
353
|
// 选择每一列的数据
|
|
310
354
|
const chooseItem = (option, columnIndex) => {
|
|
311
355
|
if (option && Object.keys(option).length) {
|
|
@@ -320,8 +364,7 @@ const InternalPicker = (props, ref) => {
|
|
|
320
364
|
chooseValueData[index + 1] = cursor.children[0].value;
|
|
321
365
|
setchooseValueData([...chooseValueData]);
|
|
322
366
|
index++;
|
|
323
|
-
|
|
324
|
-
cursor = cc;
|
|
367
|
+
cursor = cursor.children[0];
|
|
325
368
|
}
|
|
326
369
|
// 当前改变列的下一列 children 值为空
|
|
327
370
|
if (cursor && cursor.children) {
|
|
@@ -343,65 +386,24 @@ const InternalPicker = (props, ref) => {
|
|
|
343
386
|
}
|
|
344
387
|
}
|
|
345
388
|
};
|
|
346
|
-
//
|
|
347
|
-
const
|
|
348
|
-
|
|
349
|
-
|
|
350
|
-
|
|
351
|
-
|
|
352
|
-
|
|
353
|
-
|
|
354
|
-
|
|
355
|
-
|
|
356
|
-
return [listData];
|
|
357
|
-
}
|
|
358
|
-
};
|
|
359
|
-
// 每一列的类型
|
|
360
|
-
const columnsType = () => {
|
|
361
|
-
const firstColumn = listData[0];
|
|
362
|
-
if (firstColumn) {
|
|
363
|
-
if (Array.isArray(firstColumn)) {
|
|
364
|
-
return 'multiple';
|
|
365
|
-
}
|
|
366
|
-
if ('children' in firstColumn) {
|
|
367
|
-
return 'cascade';
|
|
368
|
-
}
|
|
369
|
-
}
|
|
370
|
-
return 'single';
|
|
371
|
-
};
|
|
372
|
-
// 级联数据格式化
|
|
373
|
-
const formatCascade = (columns, defaultValues) => {
|
|
374
|
-
const formatted = [];
|
|
375
|
-
let cursor = {
|
|
376
|
-
text: '',
|
|
377
|
-
value: '',
|
|
378
|
-
children: columns,
|
|
379
|
-
};
|
|
380
|
-
let columnIndex = 0;
|
|
381
|
-
while (cursor && cursor.children) {
|
|
382
|
-
const options = cursor.children;
|
|
383
|
-
const value = defaultValues[columnIndex];
|
|
384
|
-
let index = options.findIndex((columnItem) => columnItem.value === value);
|
|
385
|
-
if (index === -1)
|
|
386
|
-
index = 0;
|
|
387
|
-
cursor = cursor.children[index];
|
|
388
|
-
columnIndex++;
|
|
389
|
-
formatted.push(options);
|
|
389
|
+
// 点击确定
|
|
390
|
+
const confirm = () => {
|
|
391
|
+
let movings = false;
|
|
392
|
+
refs.forEach((_ref) => {
|
|
393
|
+
if (_ref.moving)
|
|
394
|
+
movings = true;
|
|
395
|
+
_ref.stopMomentum();
|
|
396
|
+
});
|
|
397
|
+
if (movings) {
|
|
398
|
+
isConfirmEvent.current = true;
|
|
390
399
|
}
|
|
391
|
-
|
|
392
|
-
|
|
393
|
-
const init = () => {
|
|
394
|
-
const data = [];
|
|
395
|
-
const normalData = normalListData();
|
|
396
|
-
setColumnsList(normalData);
|
|
397
|
-
normalData.length > 0 &&
|
|
398
|
-
normalData.map((item) => {
|
|
399
|
-
item[0] && data.push(item[0].value);
|
|
400
|
-
return item;
|
|
401
|
-
});
|
|
402
|
-
if (!defaultValueData && chooseValueData.length === 0) {
|
|
403
|
-
setchooseValueData([...data]);
|
|
400
|
+
else {
|
|
401
|
+
onConfirm && onConfirm(chooseValueData, selectedOptions());
|
|
404
402
|
}
|
|
403
|
+
onClose && onClose(chooseValueData, selectedOptions());
|
|
404
|
+
setTimeout(() => {
|
|
405
|
+
isConfirmEvent.current = false;
|
|
406
|
+
}, 0);
|
|
405
407
|
};
|
|
406
408
|
const renderToolbar = () => {
|
|
407
409
|
return (React__default.createElement("div", { className: b('control') },
|
|
@@ -409,14 +411,62 @@ const InternalPicker = (props, ref) => {
|
|
|
409
411
|
React__default.createElement("div", { className: b('title') }, title || ''),
|
|
410
412
|
React__default.createElement("span", { className: b('confirm-btn'), onClick: confirm }, locale.confirm)));
|
|
411
413
|
};
|
|
414
|
+
const [currentValue, setCurrentValue] = useState([]);
|
|
415
|
+
const [pickingStatus, setPickingStatus] = useState(false);
|
|
416
|
+
const defaultValuesConvert = () => {
|
|
417
|
+
const defaultIndexs = [];
|
|
418
|
+
if (chooseValueData.length > 0) {
|
|
419
|
+
chooseValueData.forEach((value, index) => {
|
|
420
|
+
for (let i = 0; i < columnsList[index].length; i++) {
|
|
421
|
+
if (columnsList[index][i].value === value) {
|
|
422
|
+
defaultIndexs.push(i);
|
|
423
|
+
break;
|
|
424
|
+
}
|
|
425
|
+
}
|
|
426
|
+
});
|
|
427
|
+
}
|
|
428
|
+
else if (columnsList && columnsList.length > 0) {
|
|
429
|
+
columnsList.forEach((item) => {
|
|
430
|
+
defaultIndexs.push(0);
|
|
431
|
+
item.length > 0 && chooseValueData.push(item[0].value);
|
|
432
|
+
});
|
|
433
|
+
}
|
|
434
|
+
return defaultIndexs;
|
|
435
|
+
};
|
|
436
|
+
const pickerStart = () => {
|
|
437
|
+
setPickingStatus(true);
|
|
438
|
+
};
|
|
439
|
+
const pickerEnd = () => {
|
|
440
|
+
setPickingStatus(false);
|
|
441
|
+
};
|
|
442
|
+
const pickerChange = (data) => {
|
|
443
|
+
const prevDefaultValue = currentValue;
|
|
444
|
+
let changeIndex = 0;
|
|
445
|
+
console.log('chage', data);
|
|
446
|
+
// 判断变化的是第几个
|
|
447
|
+
const list = data.detail.value;
|
|
448
|
+
for (let i = 0, len = list.length; i < len; i++) {
|
|
449
|
+
if (prevDefaultValue[i] !== list[i]) {
|
|
450
|
+
changeIndex = i;
|
|
451
|
+
break;
|
|
452
|
+
}
|
|
453
|
+
}
|
|
454
|
+
// 选择的是哪个 option
|
|
455
|
+
chooseItem(columnsList[changeIndex][data.detail.value[changeIndex]], changeIndex);
|
|
456
|
+
};
|
|
412
457
|
return (React__default.createElement(Popup, { visible: isVisible, position: "bottom", onClose: () => {
|
|
413
458
|
closeActionSheet();
|
|
414
459
|
} },
|
|
415
460
|
React__default.createElement(View, { className: `${b()} ${className || ''}`, style: style, ...rest, catchMove: true },
|
|
416
461
|
renderToolbar(),
|
|
417
|
-
React__default.createElement("div", { className: b('panel'), ref: pickerRef }, columnsList?.map((item, index) => {
|
|
462
|
+
React__default.createElement("div", { className: b('panel'), ref: pickerRef }, Taro.getEnv() === 'WEB' ? (columnsList?.map((item, index) => {
|
|
418
463
|
return (React__default.createElement(PickerSlot, { ref: setRefs(index), defaultValue: chooseValueData?.[index], listData: item, threeDimensional: threeDimensional, chooseItem: (value, index) => chooseItem(value, index), swipeDuration: swipeDuration, key: index, keyIndex: index, itemShow: isVisible }));
|
|
419
|
-
})))
|
|
464
|
+
})) : (React__default.createElement(PickerView, { ref: pickerRef, value: currentValue, immediateChange: true, onPickStart: pickerStart, onChange: pickerChange, onPickEnd: pickerEnd, className: "picker-view-panel" }, columnsList?.map((column, index) => {
|
|
465
|
+
return (React__default.createElement(PickerViewColumn, { key: `col${index}` }, column.map((item, index) => {
|
|
466
|
+
return (React__default.createElement(View, { key: item.value || index, className: "nut-picker-roller-item-title" },
|
|
467
|
+
React__default.createElement(React__default.Fragment, null, item.text || item)));
|
|
468
|
+
})));
|
|
469
|
+
})))))));
|
|
420
470
|
};
|
|
421
471
|
const Picker = React__default.forwardRef(InternalPicker);
|
|
422
472
|
|
|
@@ -51,7 +51,7 @@ const Tabs = (props) => {
|
|
|
51
51
|
const childProps = child?.props;
|
|
52
52
|
if (childProps?.title || childProps?.paneKey) {
|
|
53
53
|
title.title = childProps?.title;
|
|
54
|
-
title.paneKey = childProps?.paneKey
|
|
54
|
+
title.paneKey = getPaneKey(childProps?.paneKey, idx);
|
|
55
55
|
title.disabled = childProps?.disabled;
|
|
56
56
|
title.index = idx;
|
|
57
57
|
if (title.paneKey === value) {
|
|
@@ -84,6 +84,9 @@ const Tabs = (props) => {
|
|
|
84
84
|
: `translate3d( 0,-${index * 100}%, 0)`,
|
|
85
85
|
transitionDuration: `${animatedTime}ms`,
|
|
86
86
|
};
|
|
87
|
+
const getPaneKey = (paneKey, index) => {
|
|
88
|
+
return typeof paneKey === 'string' ? paneKey : String(paneKey || index);
|
|
89
|
+
};
|
|
87
90
|
const tabChange = (item, index) => {
|
|
88
91
|
onClick && onClick(item);
|
|
89
92
|
if (item.disabled) {
|
|
@@ -120,7 +123,7 @@ const Tabs = (props) => {
|
|
|
120
123
|
...child.props,
|
|
121
124
|
activeKey: value,
|
|
122
125
|
};
|
|
123
|
-
if (String(value) !==
|
|
126
|
+
if (String(value) !== getPaneKey(child.props?.paneKey, idx) &&
|
|
124
127
|
autoHeight) {
|
|
125
128
|
childProps = {
|
|
126
129
|
...childProps,
|
|
@@ -82,9 +82,7 @@ const TextArea = (props) => {
|
|
|
82
82
|
textBlur(e);
|
|
83
83
|
}, onFocus: (e) => {
|
|
84
84
|
textFocus(e);
|
|
85
|
-
}, onCompositionEnd: (e) => endComposing(), onCompositionStart: (e) => startComposing(), rows: rows,
|
|
86
|
-
// maxLength={maxlength < 0 ? 0 : maxlength}
|
|
87
|
-
placeholder: placeholder || locale.placeholder }),
|
|
85
|
+
}, onCompositionEnd: (e) => endComposing(), onCompositionStart: (e) => startComposing(), rows: rows, maxLength: maxlength < 0 ? 0 : maxlength, placeholder: placeholder || locale.placeholder }),
|
|
88
86
|
limitshow ? (React__default.createElement("div", { className: textareaBem('limit') },
|
|
89
87
|
[...inputValue].length,
|
|
90
88
|
"/",
|
package/dist/locales/base.js
CHANGED
package/dist/locales/en-US.js
CHANGED
package/dist/locales/id-ID.js
CHANGED
package/dist/locales/zh-CN.js
CHANGED
package/dist/locales/zh-TW.js
CHANGED
package/dist/locales/zh-UG.js
CHANGED