@arco-design/mobile-react 2.26.0 → 2.27.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 +29 -0
- package/README.en-US.md +2 -2
- package/README.md +2 -2
- package/cjs/form/form-item.js +4 -2
- package/cjs/icon/IconHeart/index.js +1 -1
- package/cjs/icon/IconKeyboard/index.d.ts +7 -0
- package/cjs/icon/IconKeyboard/index.js +48 -0
- package/cjs/icon/IconKeyboardDelete/index.d.ts +7 -0
- package/cjs/icon/IconKeyboardDelete/index.js +44 -0
- package/cjs/icon/IconMinus/index.js +1 -1
- package/cjs/icon/IconMore/index.js +1 -1
- package/cjs/icon/IconNotice/index.js +1 -1
- package/cjs/icon/IconNoticeOff/index.js +1 -1
- package/cjs/icon/IconPlay/index.js +1 -1
- package/cjs/icon/IconSetting/index.js +2 -2
- package/cjs/icon/IconSound/index.js +1 -1
- package/cjs/icon/IconStar/index.js +1 -1
- package/cjs/icon/IconStarFill/index.js +1 -1
- package/cjs/icon/IconTriDown/index.js +1 -1
- package/cjs/icon/IconTriUp/index.js +1 -1
- package/cjs/icon/IconUpload/index.js +1 -1
- package/cjs/icon/IconWarnCircle/index.js +1 -1
- package/cjs/icon/IconWarnCircleFill/index.js +1 -1
- package/cjs/icon/index.d.ts +2 -0
- package/cjs/icon/index.js +12 -2
- package/cjs/image-picker/style/css/index.d.ts +1 -0
- package/cjs/image-picker/style/css/index.js +2 -0
- package/cjs/image-picker/style/index.d.ts +1 -0
- package/cjs/image-picker/style/index.js +2 -0
- package/cjs/index-bar/context.d.ts +3 -0
- package/cjs/index-bar/context.js +15 -0
- package/cjs/index-bar/demo/style/css/mobile.css +23 -0
- package/cjs/index-bar/demo/style/mobile.less +26 -0
- package/cjs/index-bar/group.d.ts +3 -0
- package/cjs/index-bar/group.js +101 -0
- package/cjs/index-bar/index.d.ts +15 -0
- package/cjs/index-bar/index.js +274 -0
- package/cjs/index-bar/side-bar.d.ts +3 -0
- package/cjs/index-bar/side-bar.js +102 -0
- package/cjs/index-bar/style/css/index.css +164 -0
- package/cjs/index-bar/style/css/index.d.ts +3 -0
- package/cjs/index-bar/style/css/index.js +7 -0
- package/cjs/index-bar/style/index.d.ts +3 -0
- package/cjs/index-bar/style/index.js +7 -0
- package/cjs/index-bar/style/index.less +122 -0
- package/cjs/index-bar/type.d.ts +195 -0
- package/cjs/index-bar/type.js +3 -0
- package/cjs/index-bar/utils.d.ts +6 -0
- package/cjs/index-bar/utils.js +68 -0
- package/cjs/index.d.ts +2 -0
- package/cjs/index.js +9 -1
- package/cjs/keyboard/demo/style/css/mobile.css +4 -0
- package/cjs/keyboard/demo/style/mobile.less +8 -0
- package/cjs/keyboard/index.d.ts +13 -0
- package/cjs/keyboard/index.js +270 -0
- package/cjs/keyboard/style/css/index.css +93 -0
- package/cjs/keyboard/style/css/index.d.ts +3 -0
- package/cjs/keyboard/style/css/index.js +7 -0
- package/cjs/keyboard/style/index.d.ts +3 -0
- package/cjs/keyboard/style/index.js +7 -0
- package/cjs/keyboard/style/index.less +80 -0
- package/cjs/keyboard/type.d.ts +102 -0
- package/cjs/keyboard/type.js +3 -0
- package/cjs/picker/index.js +3 -39
- package/cjs/picker/type.d.ts +1 -1
- package/cjs/picker-view/components/cascader.d.ts +2 -3
- package/cjs/picker-view/components/cascader.js +8 -6
- package/cjs/picker-view/components/multi-picker.d.ts +2 -3
- package/cjs/picker-view/components/multi-picker.js +31 -35
- package/cjs/picker-view/components/picker-cell.d.ts +1 -1
- package/cjs/picker-view/components/picker-cell.js +5 -7
- package/cjs/picker-view/index.d.ts +1 -1
- package/cjs/picker-view/index.js +9 -20
- package/cjs/picker-view/type.d.ts +2 -2
- package/cjs/slider/hooks/useSliderEvents.js +20 -20
- package/cjs/sticky/index.js +2 -2
- package/cjs/style.d.ts +2 -0
- package/cjs/style.js +4 -0
- package/dist/index.js +1172 -444
- package/dist/index.min.js +5 -5
- package/dist/style.css +215 -1
- package/dist/style.min.css +1 -1
- package/esm/form/form-item.js +4 -2
- package/esm/icon/IconHeart/index.js +1 -1
- package/esm/icon/IconKeyboard/index.d.ts +7 -0
- package/esm/icon/IconKeyboard/index.js +37 -0
- package/esm/icon/IconKeyboardDelete/index.d.ts +7 -0
- package/esm/icon/IconKeyboardDelete/index.js +33 -0
- package/esm/icon/IconMinus/index.js +1 -1
- package/esm/icon/IconMore/index.js +1 -1
- package/esm/icon/IconNotice/index.js +1 -1
- package/esm/icon/IconNoticeOff/index.js +1 -1
- package/esm/icon/IconPlay/index.js +1 -1
- package/esm/icon/IconSetting/index.js +2 -2
- package/esm/icon/IconSound/index.js +1 -1
- package/esm/icon/IconStar/index.js +1 -1
- package/esm/icon/IconStarFill/index.js +1 -1
- package/esm/icon/IconTriDown/index.js +1 -1
- package/esm/icon/IconTriUp/index.js +1 -1
- package/esm/icon/IconUpload/index.js +1 -1
- package/esm/icon/IconWarnCircle/index.js +1 -1
- package/esm/icon/IconWarnCircleFill/index.js +1 -1
- package/esm/icon/index.d.ts +2 -0
- package/esm/icon/index.js +2 -0
- package/esm/image-picker/style/css/index.d.ts +1 -0
- package/esm/image-picker/style/css/index.js +1 -0
- package/esm/image-picker/style/index.d.ts +1 -0
- package/esm/image-picker/style/index.js +1 -0
- package/esm/index-bar/context.d.ts +3 -0
- package/esm/index-bar/context.js +8 -0
- package/esm/index-bar/demo/style/css/mobile.css +23 -0
- package/esm/index-bar/demo/style/mobile.less +26 -0
- package/esm/index-bar/group.d.ts +3 -0
- package/esm/index-bar/group.js +83 -0
- package/esm/index-bar/index.d.ts +15 -0
- package/esm/index-bar/index.js +253 -0
- package/esm/index-bar/side-bar.d.ts +3 -0
- package/esm/index-bar/side-bar.js +90 -0
- package/esm/index-bar/style/css/index.css +164 -0
- package/esm/index-bar/style/css/index.d.ts +3 -0
- package/esm/index-bar/style/css/index.js +3 -0
- package/esm/index-bar/style/index.d.ts +3 -0
- package/esm/index-bar/style/index.js +3 -0
- package/esm/index-bar/style/index.less +122 -0
- package/esm/index-bar/type.d.ts +195 -0
- package/esm/index-bar/type.js +1 -0
- package/esm/index-bar/utils.d.ts +6 -0
- package/esm/index-bar/utils.js +53 -0
- package/esm/index.d.ts +2 -0
- package/esm/index.js +2 -0
- package/esm/keyboard/demo/style/css/mobile.css +4 -0
- package/esm/keyboard/demo/style/mobile.less +8 -0
- package/esm/keyboard/index.d.ts +13 -0
- package/esm/keyboard/index.js +243 -0
- package/esm/keyboard/style/css/index.css +93 -0
- package/esm/keyboard/style/css/index.d.ts +3 -0
- package/esm/keyboard/style/css/index.js +3 -0
- package/esm/keyboard/style/index.d.ts +3 -0
- package/esm/keyboard/style/index.js +3 -0
- package/esm/keyboard/style/index.less +80 -0
- package/esm/keyboard/type.d.ts +102 -0
- package/esm/keyboard/type.js +1 -0
- package/esm/picker/index.js +3 -40
- package/esm/picker/type.d.ts +1 -1
- package/esm/picker-view/components/cascader.d.ts +2 -3
- package/esm/picker-view/components/cascader.js +8 -6
- package/esm/picker-view/components/multi-picker.d.ts +2 -3
- package/esm/picker-view/components/multi-picker.js +31 -34
- package/esm/picker-view/components/picker-cell.d.ts +1 -1
- package/esm/picker-view/components/picker-cell.js +5 -7
- package/esm/picker-view/index.d.ts +1 -1
- package/esm/picker-view/index.js +10 -21
- package/esm/picker-view/type.d.ts +2 -2
- package/esm/slider/hooks/useSliderEvents.js +20 -20
- package/esm/sticky/index.js +2 -2
- package/esm/style.d.ts +2 -0
- package/esm/style.js +2 -0
- package/package.json +3 -3
- package/tokens/app/arcodesign/default/css-variables.less +43 -0
- package/tokens/app/arcodesign/default/index.d.ts +43 -0
- package/tokens/app/arcodesign/default/index.js +43 -0
- package/tokens/app/arcodesign/default/index.json +516 -0
- package/tokens/app/arcodesign/default/index.less +43 -0
- package/umd/form/form-item.js +4 -2
- package/umd/icon/IconHeart/index.js +1 -1
- package/umd/icon/IconKeyboard/index.d.ts +7 -0
- package/umd/icon/IconKeyboard/index.js +56 -0
- package/umd/icon/IconKeyboardDelete/index.d.ts +7 -0
- package/umd/icon/IconKeyboardDelete/index.js +52 -0
- package/umd/icon/IconMinus/index.js +1 -1
- package/umd/icon/IconMore/index.js +1 -1
- package/umd/icon/IconNotice/index.js +1 -1
- package/umd/icon/IconNoticeOff/index.js +1 -1
- package/umd/icon/IconPlay/index.js +1 -1
- package/umd/icon/IconSetting/index.js +2 -2
- package/umd/icon/IconSound/index.js +1 -1
- package/umd/icon/IconStar/index.js +1 -1
- package/umd/icon/IconStarFill/index.js +1 -1
- package/umd/icon/IconTriDown/index.js +1 -1
- package/umd/icon/IconTriUp/index.js +1 -1
- package/umd/icon/IconUpload/index.js +1 -1
- package/umd/icon/IconWarnCircle/index.js +1 -1
- package/umd/icon/IconWarnCircleFill/index.js +1 -1
- package/umd/icon/index.d.ts +2 -0
- package/umd/icon/index.js +12 -6
- package/umd/image-picker/style/css/index.d.ts +1 -0
- package/umd/image-picker/style/css/index.js +4 -4
- package/umd/image-picker/style/index.d.ts +1 -0
- package/umd/image-picker/style/index.js +4 -4
- package/umd/index-bar/context.d.ts +3 -0
- package/umd/index-bar/context.js +26 -0
- package/umd/index-bar/demo/style/css/mobile.css +23 -0
- package/umd/index-bar/demo/style/mobile.less +26 -0
- package/umd/index-bar/group.d.ts +3 -0
- package/umd/index-bar/group.js +107 -0
- package/umd/index-bar/index.d.ts +15 -0
- package/umd/index-bar/index.js +274 -0
- package/umd/index-bar/side-bar.d.ts +3 -0
- package/umd/index-bar/side-bar.js +113 -0
- package/umd/index-bar/style/css/index.css +164 -0
- package/umd/index-bar/style/css/index.d.ts +3 -0
- package/umd/index-bar/style/css/index.js +15 -0
- package/umd/index-bar/style/index.d.ts +3 -0
- package/umd/index-bar/style/index.js +15 -0
- package/umd/index-bar/style/index.less +122 -0
- package/umd/index-bar/type.d.ts +195 -0
- package/umd/index-bar/type.js +17 -0
- package/umd/index-bar/utils.d.ts +6 -0
- package/umd/index-bar/utils.js +78 -0
- package/umd/index.d.ts +2 -0
- package/umd/index.js +9 -5
- package/umd/keyboard/demo/style/css/mobile.css +4 -0
- package/umd/keyboard/demo/style/mobile.less +8 -0
- package/umd/keyboard/index.d.ts +13 -0
- package/umd/keyboard/index.js +271 -0
- package/umd/keyboard/style/css/index.css +93 -0
- package/umd/keyboard/style/css/index.d.ts +3 -0
- package/umd/keyboard/style/css/index.js +15 -0
- package/umd/keyboard/style/index.d.ts +3 -0
- package/umd/keyboard/style/index.js +15 -0
- package/umd/keyboard/style/index.less +80 -0
- package/umd/keyboard/type.d.ts +102 -0
- package/umd/keyboard/type.js +17 -0
- package/umd/picker/index.js +3 -39
- package/umd/picker/type.d.ts +1 -1
- package/umd/picker-view/components/cascader.d.ts +2 -3
- package/umd/picker-view/components/cascader.js +8 -6
- package/umd/picker-view/components/multi-picker.d.ts +2 -3
- package/umd/picker-view/components/multi-picker.js +31 -35
- package/umd/picker-view/components/picker-cell.d.ts +1 -1
- package/umd/picker-view/components/picker-cell.js +5 -7
- package/umd/picker-view/index.d.ts +1 -1
- package/umd/picker-view/index.js +9 -20
- package/umd/picker-view/type.d.ts +2 -2
- package/umd/slider/hooks/useSliderEvents.js +20 -20
- package/umd/sticky/index.js +2 -2
- package/umd/style.d.ts +2 -0
- package/umd/style.js +4 -4
@@ -28,7 +28,6 @@ var Cascader = /*#__PURE__*/(0, _react.forwardRef)(function (props, ref) {
|
|
28
28
|
wrapperHeight = props.wrapperHeight,
|
29
29
|
rows = props.rows,
|
30
30
|
hideEmptyCols = props.hideEmptyCols,
|
31
|
-
onPickerChange = props.onPickerChange,
|
32
31
|
onValueChange = props.onValueChange,
|
33
32
|
_props$selectedValue = props.selectedValue,
|
34
33
|
selectedValue = _props$selectedValue === void 0 ? [] : _props$selectedValue,
|
@@ -53,7 +52,7 @@ var Cascader = /*#__PURE__*/(0, _react.forwardRef)(function (props, ref) {
|
|
53
52
|
});
|
54
53
|
}
|
55
54
|
|
56
|
-
function _onValueChange(value, index) {
|
55
|
+
function _onValueChange(value, index, newData) {
|
57
56
|
var children = (0, _mobileUtils.arrayTreeFilter)(data, function (item, level) {
|
58
57
|
return level <= index && item.value === value[level];
|
59
58
|
});
|
@@ -63,15 +62,19 @@ var Cascader = /*#__PURE__*/(0, _react.forwardRef)(function (props, ref) {
|
|
63
62
|
for (i = index + 1; i < cols && child && child.children; i++) {
|
64
63
|
child = child.children[0];
|
65
64
|
value[i] = child.value;
|
65
|
+
newData[i] = child;
|
66
66
|
}
|
67
67
|
|
68
68
|
value.length = i;
|
69
|
-
|
69
|
+
newData.length = i;
|
70
|
+
onValueChange == null ? void 0 : onValueChange(value, index, newData);
|
70
71
|
}
|
71
72
|
|
72
73
|
function _formatData() {
|
73
74
|
var childrenTree = (0, _mobileUtils.arrayTreeFilter)(data, function (item, level) {
|
74
|
-
return item.value === selectedValue[level];
|
75
|
+
return item.value === (selectedValue == null ? void 0 : selectedValue[level]);
|
76
|
+
}, {
|
77
|
+
fallbackChildIndex: 0
|
75
78
|
}).map(function (item) {
|
76
79
|
return item.children;
|
77
80
|
});
|
@@ -96,8 +99,7 @@ var Cascader = /*#__PURE__*/(0, _react.forwardRef)(function (props, ref) {
|
|
96
99
|
data: formatData,
|
97
100
|
selectedValue: selectedValue,
|
98
101
|
itemHeight: itemHeight,
|
99
|
-
onValueChange: _onValueChange
|
100
|
-
onPickerChange: onPickerChange
|
102
|
+
onValueChange: _onValueChange
|
101
103
|
}, formatData.map(function (item, index) {
|
102
104
|
return /*#__PURE__*/_react.default.createElement(_pickerCell.default, {
|
103
105
|
key: index + "_picker_cell_cascader",
|
@@ -3,10 +3,9 @@ import { PickerData, ValueType } from '../type';
|
|
3
3
|
export interface MultiPickerProps {
|
4
4
|
prefixCls: string;
|
5
5
|
data: PickerData[][];
|
6
|
-
selectedValue
|
6
|
+
selectedValue?: ValueType[];
|
7
7
|
children: any;
|
8
8
|
itemHeight: number;
|
9
|
-
onValueChange: (value: ValueType[], index: number) => void;
|
10
|
-
onPickerChange?: (value: ValueType[], index: number) => void;
|
9
|
+
onValueChange: (value: ValueType[], index: number, data: PickerData[]) => void;
|
11
10
|
}
|
12
11
|
export default function MultiPicker(props: MultiPickerProps): JSX.Element;
|
@@ -10,60 +10,56 @@ var _react = _interopRequireDefault(require("react"));
|
|
10
10
|
function MultiPicker(props) {
|
11
11
|
var prefixCls = props.prefixCls,
|
12
12
|
onValueChange = props.onValueChange,
|
13
|
-
onPickerChange = props.onPickerChange,
|
14
13
|
children = props.children,
|
15
14
|
itemHeight = props.itemHeight,
|
16
15
|
selectedValue = props.selectedValue,
|
17
16
|
data = props.data;
|
18
17
|
|
19
|
-
function
|
20
|
-
|
21
|
-
|
22
|
-
|
23
|
-
|
24
|
-
|
25
|
-
return
|
26
|
-
return item && item[0] && item[0].value;
|
27
|
-
});
|
28
|
-
}
|
29
|
-
|
30
|
-
if (!children) {
|
31
|
-
return [];
|
32
|
-
}
|
33
|
-
|
34
|
-
return _react.default.Children.map(children, function (child) {
|
35
|
-
var childrenArray = _react.default.Children.toArray(child.children || child.props.children);
|
36
|
-
|
37
|
-
return childrenArray && childrenArray[0] && childrenArray[0].props.value;
|
18
|
+
function getCurrentData() {
|
19
|
+
return (data || []).map(function (item, itemIndex) {
|
20
|
+
var curSelected = selectedValue == null ? void 0 : selectedValue[itemIndex];
|
21
|
+
var cur = curSelected ? (item || []).find(function (i) {
|
22
|
+
return i.value === curSelected;
|
23
|
+
}) : undefined;
|
24
|
+
return cur || (item == null ? void 0 : item[0]);
|
38
25
|
});
|
39
26
|
}
|
40
27
|
|
41
|
-
function onChange(
|
42
|
-
var
|
28
|
+
function onChange(_ref) {
|
29
|
+
var index = _ref.index,
|
30
|
+
value = _ref.value,
|
31
|
+
changedData = _ref.changedData,
|
32
|
+
callback = _ref.callback;
|
33
|
+
var newData = getCurrentData().concat();
|
34
|
+
newData[index] = changedData;
|
35
|
+
var newValue = newData.map(function (d) {
|
36
|
+
return d == null ? void 0 : d.value;
|
37
|
+
});
|
43
38
|
newValue[index] = value;
|
44
39
|
|
45
40
|
if (callback) {
|
46
|
-
callback(newValue, index);
|
41
|
+
callback(newValue, index, newData);
|
47
42
|
}
|
48
43
|
}
|
49
44
|
|
50
|
-
function _onValueChange(value, index) {
|
51
|
-
onChange(
|
52
|
-
|
53
|
-
|
54
|
-
|
55
|
-
|
45
|
+
function _onValueChange(value, index, changedData) {
|
46
|
+
onChange({
|
47
|
+
index: index,
|
48
|
+
value: value,
|
49
|
+
callback: onValueChange,
|
50
|
+
changedData: changedData
|
51
|
+
});
|
56
52
|
}
|
57
53
|
|
58
54
|
function renderChild() {
|
59
|
-
var
|
55
|
+
var curData = getCurrentData();
|
56
|
+
var value = curData.map(function (d) {
|
57
|
+
return d == null ? void 0 : d.value;
|
58
|
+
});
|
60
59
|
return _react.default.Children.map(children, function (col, index) {
|
61
60
|
return /*#__PURE__*/_react.default.cloneElement(col, {
|
62
|
-
|
63
|
-
return
|
64
|
-
},
|
65
|
-
onValueChange: function onValueChange(val) {
|
66
|
-
return _onValueChange(val, index);
|
61
|
+
onValueChange: function onValueChange(val, changedData) {
|
62
|
+
return _onValueChange(val, index, changedData);
|
67
63
|
},
|
68
64
|
selectedValue: value[index]
|
69
65
|
});
|
@@ -8,7 +8,7 @@ export interface PickerCellProps {
|
|
8
8
|
itemHeight: number;
|
9
9
|
wrapperHeight: number;
|
10
10
|
selectedValue?: ValueType;
|
11
|
-
onValueChange?: (value: ValueType) => void;
|
11
|
+
onValueChange?: (value: ValueType, data: PickerData) => void;
|
12
12
|
disabled: boolean;
|
13
13
|
hideEmptyCols?: boolean;
|
14
14
|
/**
|
@@ -85,17 +85,15 @@ var PickerCell = /*#__PURE__*/(0, _react.forwardRef)(function (props, ref) {
|
|
85
85
|
// index有改变时再抛出
|
86
86
|
// @en Throws again when index changes
|
87
87
|
if (currentIndex !== nowItemIndex) {
|
88
|
-
setCurrentIndex(nowItemIndex);
|
89
|
-
var
|
88
|
+
setCurrentIndex(Math.max(nowItemIndex, 0));
|
89
|
+
var newData = data[nowItemIndex];
|
90
|
+
var newValue = newData == null ? void 0 : newData.value;
|
90
91
|
|
91
92
|
if (newValue !== currentValue) {
|
92
|
-
// if (!('selectedValue' in props)) {
|
93
|
-
// setCurrentValue(newValue);
|
94
|
-
// }
|
95
93
|
setCurrentValue(newValue);
|
96
94
|
|
97
95
|
if (onValueChange) {
|
98
|
-
onValueChange(newValue);
|
96
|
+
onValueChange(newValue, newData);
|
99
97
|
}
|
100
98
|
}
|
101
99
|
}
|
@@ -340,7 +338,7 @@ var PickerCell = /*#__PURE__*/(0, _react.forwardRef)(function (props, ref) {
|
|
340
338
|
var curIndex = data.findIndex(function (item) {
|
341
339
|
return item.value === selectedValue;
|
342
340
|
});
|
343
|
-
setCurrentIndex(curIndex);
|
341
|
+
setCurrentIndex(Math.max(curIndex, 0));
|
344
342
|
|
345
343
|
if (curIndex >= 0) {
|
346
344
|
_scrollToIndexWithChange(curIndex);
|
@@ -25,7 +25,7 @@ export interface PickerViewRef {
|
|
25
25
|
* 获取第 n 列的值
|
26
26
|
* @en Get the value of the nth column
|
27
27
|
*/
|
28
|
-
getColumnValue: (index: number) => ValueType;
|
28
|
+
getColumnValue: (index: number) => ValueType | undefined;
|
29
29
|
/**
|
30
30
|
* 手动更新元素布局
|
31
31
|
* @en Manually update the element layout
|
package/cjs/picker-view/index.js
CHANGED
@@ -82,7 +82,7 @@ var PickerView = /*#__PURE__*/(0, _react.forwardRef)(function (props, ref) {
|
|
82
82
|
var wrapperRef = (0, _react.useRef)(null);
|
83
83
|
var domRef = (0, _react.useRef)(null);
|
84
84
|
var barRef = (0, _react.useRef)(null);
|
85
|
-
var scrollValueRef = (0,
|
85
|
+
var scrollValueRef = (0, _helpers.useLatestRef)(scrollValue);
|
86
86
|
var pickerCellsRef = (0, _react.useRef)([]);
|
87
87
|
var cascaderRef = (0, _react.useRef)(null);
|
88
88
|
var innerData = (0, _react.useMemo)(function () {
|
@@ -115,20 +115,19 @@ var PickerView = /*#__PURE__*/(0, _react.forwardRef)(function (props, ref) {
|
|
115
115
|
|
116
116
|
return newData;
|
117
117
|
}, [data]);
|
118
|
-
(0, _react.useEffect)(function () {
|
119
|
-
scrollValueRef.current = scrollValue;
|
120
|
-
}, [scrollValue]);
|
121
118
|
|
122
119
|
var getAllColumnValues = function getAllColumnValues() {
|
123
|
-
return scrollValueRef.current;
|
120
|
+
return scrollValueRef.current || [];
|
124
121
|
};
|
125
122
|
|
126
123
|
function getColumnValue(index) {
|
124
|
+
var _scrollValueRef$curre;
|
125
|
+
|
127
126
|
if (index === void 0) {
|
128
127
|
index = 0;
|
129
128
|
}
|
130
129
|
|
131
|
-
return scrollValueRef.current[index];
|
130
|
+
return (_scrollValueRef$curre = scrollValueRef.current) == null ? void 0 : _scrollValueRef$curre[index];
|
132
131
|
}
|
133
132
|
|
134
133
|
function getCellMovingStatus() {
|
@@ -164,25 +163,17 @@ var PickerView = /*#__PURE__*/(0, _react.forwardRef)(function (props, ref) {
|
|
164
163
|
};
|
165
164
|
});
|
166
165
|
|
167
|
-
function
|
166
|
+
function _onValueChange(val, index, newData) {
|
168
167
|
setScrollValue(val);
|
169
168
|
|
170
169
|
if (onPickerChange) {
|
171
|
-
onPickerChange(val, index);
|
172
|
-
}
|
173
|
-
}
|
174
|
-
|
175
|
-
function _onValueChange(val, index) {
|
176
|
-
setScrollValue(val);
|
177
|
-
|
178
|
-
if (onPickerChange) {
|
179
|
-
onPickerChange(val, index);
|
170
|
+
onPickerChange(val, index, newData);
|
180
171
|
}
|
181
172
|
}
|
182
173
|
|
183
174
|
(0, _react.useEffect)(function () {
|
184
175
|
setScrollValue(value);
|
185
|
-
}, [value
|
176
|
+
}, [value]);
|
186
177
|
var updateWrapperHeight = (0, _react.useCallback)(function () {
|
187
178
|
if (wrapperRef && wrapperRef.current) {
|
188
179
|
setWrapperHeight(wrapperRef.current.offsetHeight);
|
@@ -226,7 +217,6 @@ var PickerView = /*#__PURE__*/(0, _react.forwardRef)(function (props, ref) {
|
|
226
217
|
data: data,
|
227
218
|
selectedValue: scrollValue,
|
228
219
|
onValueChange: _onValueChange,
|
229
|
-
onPickerChange: _onPickerChange,
|
230
220
|
clickable: clickable,
|
231
221
|
itemHeight: itemHeight,
|
232
222
|
wrapperHeight: wrapperHeight,
|
@@ -240,8 +230,7 @@ var PickerView = /*#__PURE__*/(0, _react.forwardRef)(function (props, ref) {
|
|
240
230
|
data: innerData,
|
241
231
|
itemHeight: itemHeight,
|
242
232
|
selectedValue: scrollValue,
|
243
|
-
onValueChange: _onValueChange
|
244
|
-
onPickerChange: _onPickerChange
|
233
|
+
onValueChange: _onValueChange
|
245
234
|
}, innerData.map(function (item, index) {
|
246
235
|
return /*#__PURE__*/_react.default.createElement(_pickerCell.default, {
|
247
236
|
key: index + "_picker_cell_normal",
|
@@ -52,12 +52,12 @@ export interface PickerViewProps {
|
|
52
52
|
* 值, 格式是[value1, value2, value3], 对应数据源的相应级层value
|
53
53
|
* @en Value, the format is [value1, value2, value3], corresponding to the corresponding level value of the data source
|
54
54
|
*/
|
55
|
-
value
|
55
|
+
value?: ValueType[];
|
56
56
|
/**
|
57
57
|
* 每列数据选择变化后的回调函数
|
58
58
|
* @en The callback function after each column data selection changes
|
59
59
|
*/
|
60
|
-
onPickerChange?: (value: ValueType[], index: number) => void;
|
60
|
+
onPickerChange?: (value: ValueType[], index: number, data: PickerData[]) => void;
|
61
61
|
/**
|
62
62
|
* 每列样式
|
63
63
|
* @en Stylesheet per column
|
@@ -80,29 +80,29 @@ var useSliderEvents = function useSliderEvents(_ref) {
|
|
80
80
|
return function (realTimeValue) {
|
81
81
|
setValueGroup(realTimeValue);
|
82
82
|
};
|
83
|
-
}
|
84
|
-
var index = Math.abs(valueGroup[0] - start) < Math.abs(valueGroup[1] - start) ? 0 : 1;
|
85
|
-
|
86
|
-
var handleValue = function handleValue(realTimeValue) {
|
87
|
-
setValueGroup(function (passValueGroup) {
|
88
|
-
if (typeof passValueGroup === 'number') {
|
89
|
-
return [passValueGroup, realTimeValue];
|
90
|
-
}
|
91
|
-
|
92
|
-
var newValueGroup = [].concat(passValueGroup);
|
93
|
-
newValueGroup[index] = realTimeValue;
|
94
|
-
return newValueGroup;
|
95
|
-
});
|
96
|
-
};
|
83
|
+
}
|
97
84
|
|
98
|
-
|
99
|
-
setCommonIsTouching(index);
|
100
|
-
handleValue(start);
|
101
|
-
setIsTouching(IsTouchingStatus.Moving);
|
102
|
-
}
|
85
|
+
var index = Math.abs(valueGroup[0] - start) < Math.abs(valueGroup[1] - start) ? 0 : 1;
|
103
86
|
|
104
|
-
|
87
|
+
var handleValue = function handleValue(realTimeValue) {
|
88
|
+
setValueGroup(function (passValueGroup) {
|
89
|
+
if (typeof passValueGroup === 'number') {
|
90
|
+
return [passValueGroup, realTimeValue];
|
91
|
+
}
|
92
|
+
|
93
|
+
var newValueGroup = [].concat(passValueGroup);
|
94
|
+
newValueGroup[index] = realTimeValue;
|
95
|
+
return newValueGroup;
|
96
|
+
});
|
97
|
+
};
|
98
|
+
|
99
|
+
if (isTouching) {
|
100
|
+
setCommonIsTouching(index);
|
101
|
+
handleValue(start);
|
102
|
+
setIsTouching(IsTouchingStatus.Moving);
|
105
103
|
}
|
104
|
+
|
105
|
+
return handleValue;
|
106
106
|
}, [touchStartPosition, getValueFromPosition]);
|
107
107
|
(0, _react.useEffect)(function () {
|
108
108
|
var _lineRef$current;
|
package/cjs/sticky/index.js
CHANGED
@@ -95,8 +95,8 @@ var Sticky = /*#__PURE__*/(0, _react.forwardRef)(function (props, ref) {
|
|
95
95
|
var containerTop = containerRect.top,
|
96
96
|
containerBottom = containerRect.bottom,
|
97
97
|
containerHeight = containerRect.height;
|
98
|
-
var disFromTop = placeholderClientRect.top - containerTop;
|
99
|
-
var disFromBottom = placeholderClientRect.top + calculatedHeight - containerBottom;
|
98
|
+
var disFromTop = Math.round(placeholderClientRect.top - containerTop);
|
99
|
+
var disFromBottom = Math.round(placeholderClientRect.top + calculatedHeight - containerBottom);
|
100
100
|
var topFollowDifference = followBottom - followOffset - calculatedHeight - topOffset - containerTop;
|
101
101
|
var bottomFollowDifference = containerHeight - followTop - followOffset - calculatedHeight - bottomOffset;
|
102
102
|
setWasSticky(Boolean(isStickyRef.current));
|
package/cjs/style.d.ts
CHANGED
@@ -27,6 +27,8 @@ import './grid/style';
|
|
27
27
|
import './image/style';
|
28
28
|
import './show-monitor/style';
|
29
29
|
import './image-preview/style';
|
30
|
+
import './index-bar/style';
|
31
|
+
import './keyboard/style';
|
30
32
|
import './load-more/style';
|
31
33
|
import './loading/style';
|
32
34
|
import './masking/style';
|