@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
@@ -0,0 +1,80 @@
|
|
1
|
+
@import '../../../style/mixin.less';
|
2
|
+
|
3
|
+
.@{prefix}-keyboard {
|
4
|
+
.use-var(background, keyboard-background);
|
5
|
+
.use-var(padding, keyboard-content-padding);
|
6
|
+
.noselect();
|
7
|
+
|
8
|
+
&-wrapper {
|
9
|
+
display: flex;
|
10
|
+
}
|
11
|
+
|
12
|
+
&-key-wrapper {
|
13
|
+
flex: 2 0 auto;
|
14
|
+
}
|
15
|
+
|
16
|
+
&-row {
|
17
|
+
display: flex;
|
18
|
+
&:not(&:nth-last-child(1)) {
|
19
|
+
.use-var(margin-bottom, keyboard-unified-margin);
|
20
|
+
}
|
21
|
+
|
22
|
+
.@{prefix}-keyboard-key {
|
23
|
+
&:not(&:nth-child(1)) {
|
24
|
+
.use-var(margin-left, keyboard-unified-margin);
|
25
|
+
}
|
26
|
+
|
27
|
+
&-special {
|
28
|
+
flex: 2.1 0 auto;
|
29
|
+
}
|
30
|
+
}
|
31
|
+
}
|
32
|
+
|
33
|
+
&-col {
|
34
|
+
flex: 1;
|
35
|
+
display: flex;
|
36
|
+
flex-direction: column;
|
37
|
+
.use-var(margin-left, keyboard-unified-margin);
|
38
|
+
|
39
|
+
.@{prefix}-keyboard-key {
|
40
|
+
&:not(&:nth-child(1)) {
|
41
|
+
.use-var(margin-top, keyboard-unified-margin);
|
42
|
+
}
|
43
|
+
|
44
|
+
&-confirm {
|
45
|
+
flex: 2.5 0 auto;
|
46
|
+
.use-var(background, keyboard-confirm-key-background);
|
47
|
+
.use-var(color, keyboard-confirm-key-color);
|
48
|
+
.use-var(font-size, keyboard-confirm-key-font-size);
|
49
|
+
}
|
50
|
+
}
|
51
|
+
}
|
52
|
+
|
53
|
+
&-key {
|
54
|
+
display: flex;
|
55
|
+
align-items: center;
|
56
|
+
justify-content: center;
|
57
|
+
flex: 1;
|
58
|
+
|
59
|
+
.use-var(font-weight, keyboard-key-font-weight);
|
60
|
+
.use-var(font-size, keyboard-key-font-size);
|
61
|
+
.use-var(line-height, keyboard-key-line-height);
|
62
|
+
.use-var(background, keyboard-key-background);
|
63
|
+
.use-var(border-radius, keyboard-key-border-radius);
|
64
|
+
.use-var(height, keyboard-key-height);
|
65
|
+
.use-var(border-radius, keyboard-key-border-radius);
|
66
|
+
.use-var(color, keyboard-key-color);
|
67
|
+
|
68
|
+
&:active {
|
69
|
+
.use-var(background, keyboard-key-active-background);
|
70
|
+
}
|
71
|
+
|
72
|
+
.@{prefix}-icon {
|
73
|
+
.use-var(font-size, keyboard-key-icon-size);
|
74
|
+
}
|
75
|
+
}
|
76
|
+
|
77
|
+
&-popup {
|
78
|
+
display: none;
|
79
|
+
}
|
80
|
+
}
|
@@ -0,0 +1,102 @@
|
|
1
|
+
import { CSSProperties, ReactNode } from 'react';
|
2
|
+
import { PopupProps, PopupRef } from '../popup';
|
3
|
+
export declare type ColumnData = string | number | ColumnObjData;
|
4
|
+
export declare type ColumnObjData = {
|
5
|
+
type: 'keyboard' | 'delete';
|
6
|
+
} | {
|
7
|
+
type: 'content';
|
8
|
+
content: ReactNode;
|
9
|
+
value: string | number;
|
10
|
+
};
|
11
|
+
export interface KeyboardProps extends PopupProps {
|
12
|
+
/**
|
13
|
+
* 常规键位自定义类名
|
14
|
+
* @en Custom classname for normal keys
|
15
|
+
*/
|
16
|
+
normalKeyClass?: string;
|
17
|
+
/**
|
18
|
+
* 常规键位自定义样式
|
19
|
+
* @en Custom style for normal keys
|
20
|
+
*/
|
21
|
+
normalKeyStyle?: CSSProperties;
|
22
|
+
/**
|
23
|
+
* 自定义类名
|
24
|
+
* @en Custom classname
|
25
|
+
*/
|
26
|
+
className?: string;
|
27
|
+
/**
|
28
|
+
* 自定义样式
|
29
|
+
* @en Custom stylesheet
|
30
|
+
*/
|
31
|
+
style?: React.CSSProperties;
|
32
|
+
/**
|
33
|
+
* 键盘展示类型,不同类型有不同布局。number - 纯数字常规键盘,confirm - 带确认按钮的键盘,tool - 带运算符的键盘
|
34
|
+
* @en Keyboard display type, different types have different layouts. number - a regular keyboard with pure numbers, confirm - a keyboard with a confirm button, tool - a keyboard with operators
|
35
|
+
* @default "number"
|
36
|
+
*/
|
37
|
+
type?: 'number' | 'confirm' | 'tool';
|
38
|
+
/**
|
39
|
+
* 是否打乱键盘中的数字展示位置
|
40
|
+
* @en Whether to scramble number placements in the keyboard
|
41
|
+
* @default false
|
42
|
+
*/
|
43
|
+
randomOrder: boolean;
|
44
|
+
/**
|
45
|
+
* 键盘顶部展示标题内容,样式纯自定义
|
46
|
+
* @en The title content displayed on the top of the keyboard, the style is purely customized
|
47
|
+
*/
|
48
|
+
title?: ReactNode;
|
49
|
+
/**
|
50
|
+
* 自定义渲染数字右侧(第四列)的内容
|
51
|
+
* @en Custom rendering of the content to the right of the number (fourth column)
|
52
|
+
*/
|
53
|
+
rightColumns?: ReactNode;
|
54
|
+
/**
|
55
|
+
* 点击确认后是否自动关闭键盘
|
56
|
+
* @en Whether to automatically close the keyboard after clicking confirm button
|
57
|
+
* @default false
|
58
|
+
*/
|
59
|
+
confirmClosable?: boolean;
|
60
|
+
/**
|
61
|
+
* 自定义渲染确认按钮内部内容
|
62
|
+
* @en Customize the internal content of the confirm button
|
63
|
+
*/
|
64
|
+
confirmButton?: ReactNode;
|
65
|
+
/**
|
66
|
+
* 自定义渲染删除按钮内部内容
|
67
|
+
* @en Customize the internal content of the delete button
|
68
|
+
*/
|
69
|
+
deleteButton?: ReactNode;
|
70
|
+
/**
|
71
|
+
* 自定义渲染收起键盘按钮内部内容
|
72
|
+
* @en Customize the internal content of the keyboard button
|
73
|
+
*/
|
74
|
+
keyboardButton?: ReactNode;
|
75
|
+
/**
|
76
|
+
* 收起键盘回调
|
77
|
+
* @en Callback for closing the keyboard
|
78
|
+
*/
|
79
|
+
close: (e?: React.MouseEvent<HTMLElement, MouseEvent>) => {};
|
80
|
+
/**
|
81
|
+
* 点击确认按钮回调
|
82
|
+
* @en Callback for clicking the confirm button
|
83
|
+
*/
|
84
|
+
onConfirm?: () => {};
|
85
|
+
/**
|
86
|
+
* 点击删除按钮回调
|
87
|
+
* @en Callback for clicking the delete button
|
88
|
+
*/
|
89
|
+
onDelete?: () => {};
|
90
|
+
/**
|
91
|
+
* 点击常规按钮回调
|
92
|
+
* @en Callback for clicking the normal button
|
93
|
+
*/
|
94
|
+
onChange?: (data: string | number) => {};
|
95
|
+
}
|
96
|
+
export interface KeyboardRef extends PopupRef {
|
97
|
+
/**
|
98
|
+
* 最外层 DOM 元素
|
99
|
+
* @en The outer DOM element of the component
|
100
|
+
*/
|
101
|
+
keyboard: HTMLDivElement | null;
|
102
|
+
}
|
@@ -0,0 +1 @@
|
|
1
|
+
export {};
|
package/esm/picker/index.js
CHANGED
@@ -9,43 +9,6 @@ import PickerView from '../picker-view';
|
|
9
9
|
import { useListenResize } from '../_helpers';
|
10
10
|
export * from './type';
|
11
11
|
export { MultiPicker, PickerCell, Cascader } from '../picker-view';
|
12
|
-
|
13
|
-
var getInitialValue = function getInitialValue(value, data, cascade) {
|
14
|
-
if (value && value.length) {
|
15
|
-
return value;
|
16
|
-
}
|
17
|
-
|
18
|
-
var computedValue = [];
|
19
|
-
|
20
|
-
if (!cascade) {
|
21
|
-
if (!(data[0] instanceof Array)) {
|
22
|
-
var _data$;
|
23
|
-
|
24
|
-
return (_data$ = data[0]) != null && _data$.value ? [data[0].value] : [];
|
25
|
-
}
|
26
|
-
|
27
|
-
data.map(function (column) {
|
28
|
-
computedValue.push(typeof column[0] === 'object' ? column[0].value : column[0]);
|
29
|
-
});
|
30
|
-
} else {
|
31
|
-
var cascadePickerData = data;
|
32
|
-
|
33
|
-
if (!cascadePickerData || !cascadePickerData.length) {
|
34
|
-
return computedValue;
|
35
|
-
}
|
36
|
-
|
37
|
-
computedValue.push(cascadePickerData[0].value);
|
38
|
-
var traverse = cascadePickerData[0].children;
|
39
|
-
|
40
|
-
while (traverse) {
|
41
|
-
computedValue.push(traverse[0].value);
|
42
|
-
traverse = traverse[0].children;
|
43
|
-
}
|
44
|
-
}
|
45
|
-
|
46
|
-
return computedValue;
|
47
|
-
};
|
48
|
-
|
49
12
|
var Picker = /*#__PURE__*/forwardRef(function (props, ref) {
|
50
13
|
var className = props.className,
|
51
14
|
itemStyle = props.itemStyle,
|
@@ -83,7 +46,7 @@ var Picker = /*#__PURE__*/forwardRef(function (props, ref) {
|
|
83
46
|
gestureOutOfControl = _props$gestureOutOfCo === void 0 ? true : _props$gestureOutOfCo,
|
84
47
|
otherProps = _objectWithoutPropertiesLoose(props, _excluded);
|
85
48
|
|
86
|
-
var _useState = useState(
|
49
|
+
var _useState = useState(value),
|
87
50
|
scrollValue = _useState[0],
|
88
51
|
setScrollValue = _useState[1];
|
89
52
|
|
@@ -137,7 +100,7 @@ var Picker = /*#__PURE__*/forwardRef(function (props, ref) {
|
|
137
100
|
nextTick(function () {
|
138
101
|
var _pickerViewRef$curren7;
|
139
102
|
|
140
|
-
var val = ((_pickerViewRef$curren7 = pickerViewRef.current) == null ? void 0 : _pickerViewRef$curren7.getAllColumnValues()) || scrollValue;
|
103
|
+
var val = ((_pickerViewRef$curren7 = pickerViewRef.current) == null ? void 0 : _pickerViewRef$curren7.getAllColumnValues()) || scrollValue || [];
|
141
104
|
|
142
105
|
if (onOk) {
|
143
106
|
onOk(val);
|
@@ -200,7 +163,7 @@ var Picker = /*#__PURE__*/forwardRef(function (props, ref) {
|
|
200
163
|
cols: cols,
|
201
164
|
rows: rows,
|
202
165
|
disabled: disabled,
|
203
|
-
value:
|
166
|
+
value: value,
|
204
167
|
onPickerChange: onPickerChange,
|
205
168
|
itemStyle: itemStyle,
|
206
169
|
clickable: clickable,
|
package/esm/picker/type.d.ts
CHANGED
@@ -51,7 +51,7 @@ export interface PickerProps extends Omit<PopupProps, 'visible' | 'close' | 'chi
|
|
51
51
|
* 每列数据选择变化后的回调函数
|
52
52
|
* @en The callback after each column data selection changes
|
53
53
|
*/
|
54
|
-
onPickerChange?: (value: ValueType[], index: number) => void;
|
54
|
+
onPickerChange?: (value: ValueType[], index: number, data: PickerData[]) => void;
|
55
55
|
/**
|
56
56
|
* 每列样式
|
57
57
|
* @en Stylesheet per column
|
@@ -9,11 +9,10 @@ export interface CascaderProps {
|
|
9
9
|
disabled: boolean;
|
10
10
|
itemHeight: number;
|
11
11
|
wrapperHeight: number;
|
12
|
-
selectedValue
|
12
|
+
selectedValue?: ValueType[];
|
13
13
|
rows?: number;
|
14
14
|
hideEmptyCols?: boolean;
|
15
|
-
onValueChange?: (value: ValueType[], index: number) => void;
|
16
|
-
onPickerChange?: (value: ValueType[], index: number) => void;
|
15
|
+
onValueChange?: (value: ValueType[], index: number, data: PickerData[]) => void;
|
17
16
|
touchToStop?: boolean | number;
|
18
17
|
}
|
19
18
|
export interface CascaderRef {
|
@@ -13,7 +13,6 @@ var Cascader = /*#__PURE__*/forwardRef(function (props, ref) {
|
|
13
13
|
wrapperHeight = props.wrapperHeight,
|
14
14
|
rows = props.rows,
|
15
15
|
hideEmptyCols = props.hideEmptyCols,
|
16
|
-
onPickerChange = props.onPickerChange,
|
17
16
|
onValueChange = props.onValueChange,
|
18
17
|
_props$selectedValue = props.selectedValue,
|
19
18
|
selectedValue = _props$selectedValue === void 0 ? [] : _props$selectedValue,
|
@@ -38,7 +37,7 @@ var Cascader = /*#__PURE__*/forwardRef(function (props, ref) {
|
|
38
37
|
});
|
39
38
|
}
|
40
39
|
|
41
|
-
function _onValueChange(value, index) {
|
40
|
+
function _onValueChange(value, index, newData) {
|
42
41
|
var children = arrayTreeFilter(data, function (item, level) {
|
43
42
|
return level <= index && item.value === value[level];
|
44
43
|
});
|
@@ -48,15 +47,19 @@ var Cascader = /*#__PURE__*/forwardRef(function (props, ref) {
|
|
48
47
|
for (i = index + 1; i < cols && child && child.children; i++) {
|
49
48
|
child = child.children[0];
|
50
49
|
value[i] = child.value;
|
50
|
+
newData[i] = child;
|
51
51
|
}
|
52
52
|
|
53
53
|
value.length = i;
|
54
|
-
|
54
|
+
newData.length = i;
|
55
|
+
onValueChange == null ? void 0 : onValueChange(value, index, newData);
|
55
56
|
}
|
56
57
|
|
57
58
|
function _formatData() {
|
58
59
|
var childrenTree = arrayTreeFilter(data, function (item, level) {
|
59
|
-
return item.value === selectedValue[level];
|
60
|
+
return item.value === (selectedValue == null ? void 0 : selectedValue[level]);
|
61
|
+
}, {
|
62
|
+
fallbackChildIndex: 0
|
60
63
|
}).map(function (item) {
|
61
64
|
return item.children;
|
62
65
|
});
|
@@ -81,8 +84,7 @@ var Cascader = /*#__PURE__*/forwardRef(function (props, ref) {
|
|
81
84
|
data: formatData,
|
82
85
|
selectedValue: selectedValue,
|
83
86
|
itemHeight: itemHeight,
|
84
|
-
onValueChange: _onValueChange
|
85
|
-
onPickerChange: onPickerChange
|
87
|
+
onValueChange: _onValueChange
|
86
88
|
}, formatData.map(function (item, index) {
|
87
89
|
return /*#__PURE__*/React.createElement(PickerCell, {
|
88
90
|
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;
|
@@ -2,59 +2,56 @@ import React from 'react';
|
|
2
2
|
export default function MultiPicker(props) {
|
3
3
|
var prefixCls = props.prefixCls,
|
4
4
|
onValueChange = props.onValueChange,
|
5
|
-
onPickerChange = props.onPickerChange,
|
6
5
|
children = props.children,
|
7
6
|
itemHeight = props.itemHeight,
|
8
7
|
selectedValue = props.selectedValue,
|
9
8
|
data = props.data;
|
10
9
|
|
11
|
-
function
|
12
|
-
|
13
|
-
|
14
|
-
|
15
|
-
|
16
|
-
|
17
|
-
return
|
18
|
-
return item && item[0] && item[0].value;
|
19
|
-
});
|
20
|
-
}
|
21
|
-
|
22
|
-
if (!children) {
|
23
|
-
return [];
|
24
|
-
}
|
25
|
-
|
26
|
-
return React.Children.map(children, function (child) {
|
27
|
-
var childrenArray = React.Children.toArray(child.children || child.props.children);
|
28
|
-
return childrenArray && childrenArray[0] && childrenArray[0].props.value;
|
10
|
+
function getCurrentData() {
|
11
|
+
return (data || []).map(function (item, itemIndex) {
|
12
|
+
var curSelected = selectedValue == null ? void 0 : selectedValue[itemIndex];
|
13
|
+
var cur = curSelected ? (item || []).find(function (i) {
|
14
|
+
return i.value === curSelected;
|
15
|
+
}) : undefined;
|
16
|
+
return cur || (item == null ? void 0 : item[0]);
|
29
17
|
});
|
30
18
|
}
|
31
19
|
|
32
|
-
function onChange(
|
33
|
-
var
|
20
|
+
function onChange(_ref) {
|
21
|
+
var index = _ref.index,
|
22
|
+
value = _ref.value,
|
23
|
+
changedData = _ref.changedData,
|
24
|
+
callback = _ref.callback;
|
25
|
+
var newData = getCurrentData().concat();
|
26
|
+
newData[index] = changedData;
|
27
|
+
var newValue = newData.map(function (d) {
|
28
|
+
return d == null ? void 0 : d.value;
|
29
|
+
});
|
34
30
|
newValue[index] = value;
|
35
31
|
|
36
32
|
if (callback) {
|
37
|
-
callback(newValue, index);
|
33
|
+
callback(newValue, index, newData);
|
38
34
|
}
|
39
35
|
}
|
40
36
|
|
41
|
-
function _onValueChange(value, index) {
|
42
|
-
onChange(
|
43
|
-
|
44
|
-
|
45
|
-
|
46
|
-
|
37
|
+
function _onValueChange(value, index, changedData) {
|
38
|
+
onChange({
|
39
|
+
index: index,
|
40
|
+
value: value,
|
41
|
+
callback: onValueChange,
|
42
|
+
changedData: changedData
|
43
|
+
});
|
47
44
|
}
|
48
45
|
|
49
46
|
function renderChild() {
|
50
|
-
var
|
47
|
+
var curData = getCurrentData();
|
48
|
+
var value = curData.map(function (d) {
|
49
|
+
return d == null ? void 0 : d.value;
|
50
|
+
});
|
51
51
|
return React.Children.map(children, function (col, index) {
|
52
52
|
return /*#__PURE__*/React.cloneElement(col, {
|
53
|
-
|
54
|
-
return
|
55
|
-
},
|
56
|
-
onValueChange: function onValueChange(val) {
|
57
|
-
return _onValueChange(val, index);
|
53
|
+
onValueChange: function onValueChange(val, changedData) {
|
54
|
+
return _onValueChange(val, index, changedData);
|
58
55
|
},
|
59
56
|
selectedValue: value[index]
|
60
57
|
});
|
@@ -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
|
/**
|
@@ -70,17 +70,15 @@ var PickerCell = /*#__PURE__*/forwardRef(function (props, ref) {
|
|
70
70
|
// index有改变时再抛出
|
71
71
|
// @en Throws again when index changes
|
72
72
|
if (currentIndex !== nowItemIndex) {
|
73
|
-
setCurrentIndex(nowItemIndex);
|
74
|
-
var
|
73
|
+
setCurrentIndex(Math.max(nowItemIndex, 0));
|
74
|
+
var newData = data[nowItemIndex];
|
75
|
+
var newValue = newData == null ? void 0 : newData.value;
|
75
76
|
|
76
77
|
if (newValue !== currentValue) {
|
77
|
-
// if (!('selectedValue' in props)) {
|
78
|
-
// setCurrentValue(newValue);
|
79
|
-
// }
|
80
78
|
setCurrentValue(newValue);
|
81
79
|
|
82
80
|
if (onValueChange) {
|
83
|
-
onValueChange(newValue);
|
81
|
+
onValueChange(newValue, newData);
|
84
82
|
}
|
85
83
|
}
|
86
84
|
}
|
@@ -325,7 +323,7 @@ var PickerCell = /*#__PURE__*/forwardRef(function (props, ref) {
|
|
325
323
|
var curIndex = data.findIndex(function (item) {
|
326
324
|
return item.value === selectedValue;
|
327
325
|
});
|
328
|
-
setCurrentIndex(curIndex);
|
326
|
+
setCurrentIndex(Math.max(curIndex, 0));
|
329
327
|
|
330
328
|
if (curIndex >= 0) {
|
331
329
|
_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/esm/picker-view/index.js
CHANGED
@@ -5,7 +5,7 @@ import { ContextLayout } from '../context-provider';
|
|
5
5
|
import MultiPicker from '../picker-view/components/multi-picker';
|
6
6
|
import PickerCell from '../picker-view/components/picker-cell';
|
7
7
|
import Cascader from '../picker-view/components/cascader';
|
8
|
-
import { useMountedState } from '../_helpers';
|
8
|
+
import { useLatestRef, useMountedState } from '../_helpers';
|
9
9
|
export * from './type';
|
10
10
|
export { MultiPicker, PickerCell, Cascader };
|
11
11
|
var PickerView = /*#__PURE__*/forwardRef(function (props, ref) {
|
@@ -45,7 +45,7 @@ var PickerView = /*#__PURE__*/forwardRef(function (props, ref) {
|
|
45
45
|
var wrapperRef = useRef(null);
|
46
46
|
var domRef = useRef(null);
|
47
47
|
var barRef = useRef(null);
|
48
|
-
var scrollValueRef =
|
48
|
+
var scrollValueRef = useLatestRef(scrollValue);
|
49
49
|
var pickerCellsRef = useRef([]);
|
50
50
|
var cascaderRef = useRef(null);
|
51
51
|
var innerData = useMemo(function () {
|
@@ -78,20 +78,19 @@ var PickerView = /*#__PURE__*/forwardRef(function (props, ref) {
|
|
78
78
|
|
79
79
|
return newData;
|
80
80
|
}, [data]);
|
81
|
-
useEffect(function () {
|
82
|
-
scrollValueRef.current = scrollValue;
|
83
|
-
}, [scrollValue]);
|
84
81
|
|
85
82
|
var getAllColumnValues = function getAllColumnValues() {
|
86
|
-
return scrollValueRef.current;
|
83
|
+
return scrollValueRef.current || [];
|
87
84
|
};
|
88
85
|
|
89
86
|
function getColumnValue(index) {
|
87
|
+
var _scrollValueRef$curre;
|
88
|
+
|
90
89
|
if (index === void 0) {
|
91
90
|
index = 0;
|
92
91
|
}
|
93
92
|
|
94
|
-
return scrollValueRef.current[index];
|
93
|
+
return (_scrollValueRef$curre = scrollValueRef.current) == null ? void 0 : _scrollValueRef$curre[index];
|
95
94
|
}
|
96
95
|
|
97
96
|
function getCellMovingStatus() {
|
@@ -127,25 +126,17 @@ var PickerView = /*#__PURE__*/forwardRef(function (props, ref) {
|
|
127
126
|
};
|
128
127
|
});
|
129
128
|
|
130
|
-
function
|
129
|
+
function _onValueChange(val, index, newData) {
|
131
130
|
setScrollValue(val);
|
132
131
|
|
133
132
|
if (onPickerChange) {
|
134
|
-
onPickerChange(val, index);
|
135
|
-
}
|
136
|
-
}
|
137
|
-
|
138
|
-
function _onValueChange(val, index) {
|
139
|
-
setScrollValue(val);
|
140
|
-
|
141
|
-
if (onPickerChange) {
|
142
|
-
onPickerChange(val, index);
|
133
|
+
onPickerChange(val, index, newData);
|
143
134
|
}
|
144
135
|
}
|
145
136
|
|
146
137
|
useEffect(function () {
|
147
138
|
setScrollValue(value);
|
148
|
-
}, [value
|
139
|
+
}, [value]);
|
149
140
|
var updateWrapperHeight = useCallback(function () {
|
150
141
|
if (wrapperRef && wrapperRef.current) {
|
151
142
|
setWrapperHeight(wrapperRef.current.offsetHeight);
|
@@ -190,7 +181,6 @@ var PickerView = /*#__PURE__*/forwardRef(function (props, ref) {
|
|
190
181
|
data: data,
|
191
182
|
selectedValue: scrollValue,
|
192
183
|
onValueChange: _onValueChange,
|
193
|
-
onPickerChange: _onPickerChange,
|
194
184
|
clickable: clickable,
|
195
185
|
itemHeight: itemHeight,
|
196
186
|
wrapperHeight: wrapperHeight,
|
@@ -204,8 +194,7 @@ var PickerView = /*#__PURE__*/forwardRef(function (props, ref) {
|
|
204
194
|
data: innerData,
|
205
195
|
itemHeight: itemHeight,
|
206
196
|
selectedValue: scrollValue,
|
207
|
-
onValueChange: _onValueChange
|
208
|
-
onPickerChange: _onPickerChange
|
197
|
+
onValueChange: _onValueChange
|
209
198
|
}, innerData.map(function (item, index) {
|
210
199
|
return /*#__PURE__*/React.createElement(PickerCell, {
|
211
200
|
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
|
@@ -73,29 +73,29 @@ export var useSliderEvents = function useSliderEvents(_ref) {
|
|
73
73
|
return function (realTimeValue) {
|
74
74
|
setValueGroup(realTimeValue);
|
75
75
|
};
|
76
|
-
}
|
77
|
-
var index = Math.abs(valueGroup[0] - start) < Math.abs(valueGroup[1] - start) ? 0 : 1;
|
78
|
-
|
79
|
-
var handleValue = function handleValue(realTimeValue) {
|
80
|
-
setValueGroup(function (passValueGroup) {
|
81
|
-
if (typeof passValueGroup === 'number') {
|
82
|
-
return [passValueGroup, realTimeValue];
|
83
|
-
}
|
84
|
-
|
85
|
-
var newValueGroup = [].concat(passValueGroup);
|
86
|
-
newValueGroup[index] = realTimeValue;
|
87
|
-
return newValueGroup;
|
88
|
-
});
|
89
|
-
};
|
76
|
+
}
|
90
77
|
|
91
|
-
|
92
|
-
setCommonIsTouching(index);
|
93
|
-
handleValue(start);
|
94
|
-
setIsTouching(IsTouchingStatus.Moving);
|
95
|
-
}
|
78
|
+
var index = Math.abs(valueGroup[0] - start) < Math.abs(valueGroup[1] - start) ? 0 : 1;
|
96
79
|
|
97
|
-
|
80
|
+
var handleValue = function handleValue(realTimeValue) {
|
81
|
+
setValueGroup(function (passValueGroup) {
|
82
|
+
if (typeof passValueGroup === 'number') {
|
83
|
+
return [passValueGroup, realTimeValue];
|
84
|
+
}
|
85
|
+
|
86
|
+
var newValueGroup = [].concat(passValueGroup);
|
87
|
+
newValueGroup[index] = realTimeValue;
|
88
|
+
return newValueGroup;
|
89
|
+
});
|
90
|
+
};
|
91
|
+
|
92
|
+
if (isTouching) {
|
93
|
+
setCommonIsTouching(index);
|
94
|
+
handleValue(start);
|
95
|
+
setIsTouching(IsTouchingStatus.Moving);
|
98
96
|
}
|
97
|
+
|
98
|
+
return handleValue;
|
99
99
|
}, [touchStartPosition, getValueFromPosition]);
|
100
100
|
useEffect(function () {
|
101
101
|
var _lineRef$current;
|
package/esm/sticky/index.js
CHANGED
@@ -79,8 +79,8 @@ var Sticky = /*#__PURE__*/forwardRef(function (props, ref) {
|
|
79
79
|
var containerTop = containerRect.top,
|
80
80
|
containerBottom = containerRect.bottom,
|
81
81
|
containerHeight = containerRect.height;
|
82
|
-
var disFromTop = placeholderClientRect.top - containerTop;
|
83
|
-
var disFromBottom = placeholderClientRect.top + calculatedHeight - containerBottom;
|
82
|
+
var disFromTop = Math.round(placeholderClientRect.top - containerTop);
|
83
|
+
var disFromBottom = Math.round(placeholderClientRect.top + calculatedHeight - containerBottom);
|
84
84
|
var topFollowDifference = followBottom - followOffset - calculatedHeight - topOffset - containerTop;
|
85
85
|
var bottomFollowDifference = containerHeight - followTop - followOffset - calculatedHeight - bottomOffset;
|
86
86
|
setWasSticky(Boolean(isStickyRef.current));
|
package/esm/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';
|
package/esm/style.js
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';
|