antd-mobile 5.0.0-rc.4 → 5.0.0-rc.5
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/2x/README.md +2 -0
- package/2x/cjs/components/collapse/collapse.d.ts +2 -2
- package/2x/cjs/components/collapse/collapse.js +1 -1
- package/2x/cjs/components/dialog/dialog.js +7 -4
- package/2x/cjs/components/list/list.css +5 -4
- package/2x/cjs/components/list/list.js +1 -3
- package/2x/cjs/components/number-keyboard/number-keyboard.css +2 -2
- package/2x/cjs/components/passcode-input/index.d.ts +4 -0
- package/2x/cjs/components/passcode-input/index.js +13 -0
- package/2x/cjs/components/passcode-input/passcode-input.css +166 -0
- package/2x/cjs/components/passcode-input/passcode-input.d.ts +35 -0
- package/2x/cjs/components/passcode-input/passcode-input.js +169 -0
- package/2x/cjs/components/picker/picker.js +1 -0
- package/2x/cjs/components/picker-view/column.js +47 -3
- package/2x/cjs/components/picker-view/picker-view.css +45 -5
- package/2x/cjs/components/picker-view/picker-view.js +7 -3
- package/2x/cjs/components/toast/index.d.ts +2 -1
- package/2x/cjs/components/toast/index.js +2 -1
- package/2x/cjs/components/toast/methods.d.ts +1 -0
- package/2x/cjs/components/toast/methods.js +18 -1
- package/2x/cjs/index.d.ts +1 -0
- package/2x/cjs/index.js +8 -0
- package/2x/cjs/utils/memo-with-event-marks.d.ts +2 -0
- package/2x/cjs/utils/memo-with-event-marks.js +23 -0
- package/2x/es/components/collapse/collapse.d.ts +2 -2
- package/2x/es/components/collapse/collapse.js +1 -1
- package/2x/es/components/dialog/dialog.js +6 -4
- package/2x/es/components/list/list.css +5 -4
- package/2x/es/components/list/list.js +1 -3
- package/2x/es/components/number-keyboard/number-keyboard.css +2 -2
- package/2x/es/components/passcode-input/index.d.ts +4 -0
- package/2x/es/components/passcode-input/index.js +3 -0
- package/2x/es/components/passcode-input/passcode-input.css +166 -0
- package/2x/es/components/passcode-input/passcode-input.d.ts +35 -0
- package/2x/es/components/passcode-input/passcode-input.js +149 -0
- package/2x/es/components/picker/picker.js +1 -0
- package/2x/es/components/picker-view/column.js +47 -3
- package/2x/es/components/picker-view/picker-view.css +45 -5
- package/2x/es/components/picker-view/picker-view.js +7 -3
- package/2x/es/components/toast/index.d.ts +2 -1
- package/2x/es/components/toast/index.js +3 -2
- package/2x/es/components/toast/methods.d.ts +1 -0
- package/2x/es/components/toast/methods.js +16 -1
- package/2x/es/index.d.ts +1 -0
- package/2x/es/index.js +2 -1
- package/2x/es/utils/memo-with-event-marks.d.ts +2 -0
- package/2x/es/utils/memo-with-event-marks.js +15 -0
- package/2x/package.json +1 -1
- package/README.md +2 -0
- package/cjs/components/collapse/collapse.d.ts +2 -2
- package/cjs/components/collapse/collapse.js +1 -1
- package/cjs/components/dialog/dialog.js +7 -4
- package/cjs/components/list/list.css +4 -3
- package/cjs/components/list/list.js +1 -3
- package/cjs/components/number-keyboard/number-keyboard.css +2 -2
- package/cjs/components/passcode-input/index.d.ts +4 -0
- package/cjs/components/passcode-input/index.js +13 -0
- package/cjs/components/passcode-input/passcode-input.css +136 -0
- package/cjs/components/passcode-input/passcode-input.d.ts +35 -0
- package/cjs/components/passcode-input/passcode-input.js +169 -0
- package/cjs/components/picker/picker.js +1 -0
- package/cjs/components/picker-view/column.js +47 -3
- package/cjs/components/picker-view/picker-view.css +39 -5
- package/cjs/components/picker-view/picker-view.js +7 -3
- package/cjs/components/toast/index.d.ts +2 -1
- package/cjs/components/toast/index.js +2 -1
- package/cjs/components/toast/methods.d.ts +1 -0
- package/cjs/components/toast/methods.js +18 -1
- package/cjs/index.d.ts +1 -0
- package/cjs/index.js +8 -0
- package/cjs/utils/memo-with-event-marks.d.ts +2 -0
- package/cjs/utils/memo-with-event-marks.js +23 -0
- package/es/components/collapse/collapse.d.ts +2 -2
- package/es/components/collapse/collapse.js +1 -1
- package/es/components/dialog/dialog.js +6 -4
- package/es/components/list/list.css +4 -3
- package/es/components/list/list.js +1 -3
- package/es/components/number-keyboard/number-keyboard.css +2 -2
- package/es/components/passcode-input/index.d.ts +4 -0
- package/es/components/passcode-input/index.js +3 -0
- package/es/components/passcode-input/passcode-input.css +136 -0
- package/es/components/passcode-input/passcode-input.d.ts +35 -0
- package/es/components/passcode-input/passcode-input.js +149 -0
- package/es/components/picker/picker.js +1 -0
- package/es/components/picker-view/column.js +47 -3
- package/es/components/picker-view/picker-view.css +39 -5
- package/es/components/picker-view/picker-view.js +7 -3
- package/es/components/toast/index.d.ts +2 -1
- package/es/components/toast/index.js +3 -2
- package/es/components/toast/methods.d.ts +1 -0
- package/es/components/toast/methods.js +16 -1
- package/es/index.d.ts +1 -0
- package/es/index.js +2 -1
- package/es/utils/memo-with-event-marks.d.ts +2 -0
- package/es/utils/memo-with-event-marks.js +15 -0
- package/package.json +1 -1
- package/umd/antd-mobile.js +1 -1
|
@@ -0,0 +1,136 @@
|
|
|
1
|
+
.adm-passcode-input {
|
|
2
|
+
position: relative;
|
|
3
|
+
display: inline-block;
|
|
4
|
+
--cell-size: 40px;
|
|
5
|
+
--cell-gap: 6px;
|
|
6
|
+
--dot-size: 10px;
|
|
7
|
+
--border-color: #e5e5e5;
|
|
8
|
+
--border-radius: 8px;
|
|
9
|
+
}
|
|
10
|
+
.adm-passcode-input-cell-container {
|
|
11
|
+
display: inline-flex;
|
|
12
|
+
vertical-align: top;
|
|
13
|
+
}
|
|
14
|
+
.adm-passcode-input-cell {
|
|
15
|
+
flex: none;
|
|
16
|
+
display: flex;
|
|
17
|
+
align-items: center;
|
|
18
|
+
justify-content: center;
|
|
19
|
+
box-sizing: border-box;
|
|
20
|
+
font-size: 18px;
|
|
21
|
+
width: var(--cell-size);
|
|
22
|
+
height: var(--cell-size);
|
|
23
|
+
background: var(--adm-color-white);
|
|
24
|
+
}
|
|
25
|
+
.adm-passcode-input:not(.seperated) {
|
|
26
|
+
border-radius: var(--border-radius);
|
|
27
|
+
overflow: hidden;
|
|
28
|
+
border: 1px solid var(--border-color);
|
|
29
|
+
}
|
|
30
|
+
.adm-passcode-input:not(.seperated) .adm-passcode-input-cell:not(:last-child) {
|
|
31
|
+
border-right: 1px solid var(--border-color);
|
|
32
|
+
}
|
|
33
|
+
.adm-passcode-input:not(.seperated).focused {
|
|
34
|
+
border-color: var(--adm-color-primary);
|
|
35
|
+
box-shadow: 0 0 2px 0 var(--adm-color-primary);
|
|
36
|
+
outline: none;
|
|
37
|
+
}
|
|
38
|
+
.adm-passcode-input:not(.seperated).error {
|
|
39
|
+
border-color: var(--adm-color-danger);
|
|
40
|
+
box-shadow: 0 0 2px 0 var(--adm-color-danger);
|
|
41
|
+
animation: 100ms ease-in-out 0s 3 normal none running adm-shake-horizontal;
|
|
42
|
+
}
|
|
43
|
+
.adm-passcode-input.seperated .adm-passcode-input-cell {
|
|
44
|
+
border-radius: var(--border-radius);
|
|
45
|
+
border: 1px solid var(--border-color);
|
|
46
|
+
}
|
|
47
|
+
.adm-passcode-input.seperated .adm-passcode-input-cell:not(:last-child) {
|
|
48
|
+
margin-right: var(--cell-gap);
|
|
49
|
+
}
|
|
50
|
+
.adm-passcode-input.seperated .adm-passcode-input-cell.focused {
|
|
51
|
+
border-color: var(--adm-color-primary);
|
|
52
|
+
box-shadow: 0 0 2px 0 var(--adm-color-primary);
|
|
53
|
+
}
|
|
54
|
+
.adm-passcode-input.seperated.focused {
|
|
55
|
+
outline: none;
|
|
56
|
+
}
|
|
57
|
+
.adm-passcode-input.seperated.error {
|
|
58
|
+
animation: 100ms ease-in-out 0s 3 normal none running adm-shake-horizontal;
|
|
59
|
+
}
|
|
60
|
+
.adm-passcode-input.seperated.error .adm-passcode-input-cell {
|
|
61
|
+
border-color: var(--adm-color-danger);
|
|
62
|
+
box-shadow: 0 0 2px 0 var(--adm-color-danger);
|
|
63
|
+
}
|
|
64
|
+
.adm-passcode-input-cell.dot::before {
|
|
65
|
+
content: '';
|
|
66
|
+
width: var(--dot-size);
|
|
67
|
+
height: var(--dot-size);
|
|
68
|
+
border-radius: 50%;
|
|
69
|
+
background: var(--adm-color-text);
|
|
70
|
+
}
|
|
71
|
+
.adm-passcode-input-cell.caret::after {
|
|
72
|
+
content: '';
|
|
73
|
+
width: 2px;
|
|
74
|
+
height: 1.1em;
|
|
75
|
+
margin-left: 1px;
|
|
76
|
+
background: var(--adm-color-primary);
|
|
77
|
+
animation: 1s linear infinite adm-caret-blink;
|
|
78
|
+
}
|
|
79
|
+
.adm-passcode-input > .adm-passcode-input-native-input {
|
|
80
|
+
position: absolute;
|
|
81
|
+
left: -200vw;
|
|
82
|
+
top: 0;
|
|
83
|
+
display: block;
|
|
84
|
+
width: 50px;
|
|
85
|
+
height: 20px;
|
|
86
|
+
opacity: 0.5;
|
|
87
|
+
}
|
|
88
|
+
@keyframes adm-shake-horizontal {
|
|
89
|
+
0% {
|
|
90
|
+
transform: translateX(0);
|
|
91
|
+
}
|
|
92
|
+
10% {
|
|
93
|
+
transform: translateX(-4px);
|
|
94
|
+
}
|
|
95
|
+
20% {
|
|
96
|
+
transform: translateX(5px);
|
|
97
|
+
}
|
|
98
|
+
30% {
|
|
99
|
+
transform: translateX(-1px);
|
|
100
|
+
}
|
|
101
|
+
40% {
|
|
102
|
+
transform: translateX(8px);
|
|
103
|
+
}
|
|
104
|
+
50% {
|
|
105
|
+
transform: translateX(0);
|
|
106
|
+
}
|
|
107
|
+
60% {
|
|
108
|
+
transform: translateX(-8px);
|
|
109
|
+
}
|
|
110
|
+
70% {
|
|
111
|
+
transform: translateX(1px);
|
|
112
|
+
}
|
|
113
|
+
80% {
|
|
114
|
+
transform: translateX(-5px);
|
|
115
|
+
}
|
|
116
|
+
90% {
|
|
117
|
+
transform: translateX(4px);
|
|
118
|
+
}
|
|
119
|
+
100% {
|
|
120
|
+
transform: translateX(0);
|
|
121
|
+
}
|
|
122
|
+
}
|
|
123
|
+
@keyframes adm-caret-blink {
|
|
124
|
+
from {
|
|
125
|
+
opacity: 1;
|
|
126
|
+
}
|
|
127
|
+
60% {
|
|
128
|
+
opacity: 1;
|
|
129
|
+
}
|
|
130
|
+
80% {
|
|
131
|
+
opacity: 0;
|
|
132
|
+
}
|
|
133
|
+
to {
|
|
134
|
+
opacity: 0;
|
|
135
|
+
}
|
|
136
|
+
}
|
|
@@ -0,0 +1,35 @@
|
|
|
1
|
+
import React, { ReactElement } from 'react';
|
|
2
|
+
import { NativeProps } from '../../utils/native-props';
|
|
3
|
+
import type { NumberKeyboardProps } from '../number-keyboard';
|
|
4
|
+
export declare type PasscodeInputProps = {
|
|
5
|
+
value?: string;
|
|
6
|
+
defaultValue?: string;
|
|
7
|
+
onChange?: (val: string) => void;
|
|
8
|
+
length?: number;
|
|
9
|
+
plain?: boolean;
|
|
10
|
+
error?: boolean;
|
|
11
|
+
caret?: boolean;
|
|
12
|
+
seperated?: boolean;
|
|
13
|
+
onBlur?: () => void;
|
|
14
|
+
onFocus?: () => void;
|
|
15
|
+
keyboard?: ReactElement<NumberKeyboardProps>;
|
|
16
|
+
onFill?: (val: string) => void;
|
|
17
|
+
} & NativeProps<'--cell-gap' | '--cell-size'>;
|
|
18
|
+
export declare type PasscodeInputRef = {
|
|
19
|
+
focus: () => void;
|
|
20
|
+
blur: () => void;
|
|
21
|
+
};
|
|
22
|
+
export declare const PasscodeInput: React.ForwardRefExoticComponent<{
|
|
23
|
+
value?: string | undefined;
|
|
24
|
+
defaultValue?: string | undefined;
|
|
25
|
+
onChange?: ((val: string) => void) | undefined;
|
|
26
|
+
length?: number | undefined;
|
|
27
|
+
plain?: boolean | undefined;
|
|
28
|
+
error?: boolean | undefined;
|
|
29
|
+
caret?: boolean | undefined;
|
|
30
|
+
seperated?: boolean | undefined;
|
|
31
|
+
onBlur?: (() => void) | undefined;
|
|
32
|
+
onFocus?: (() => void) | undefined;
|
|
33
|
+
keyboard?: React.ReactElement<NumberKeyboardProps, string | ((props: any) => React.ReactElement<any, any> | null) | (new (props: any) => React.Component<any, any, any>)> | undefined;
|
|
34
|
+
onFill?: ((val: string) => void) | undefined;
|
|
35
|
+
} & NativeProps<"--cell-size" | "--cell-gap"> & React.RefAttributes<PasscodeInputRef>>;
|
|
@@ -0,0 +1,149 @@
|
|
|
1
|
+
import React, { useState, useEffect, useRef, forwardRef, useImperativeHandle } from 'react';
|
|
2
|
+
import { mergeProps } from '../../utils/with-default-props';
|
|
3
|
+
import { withNativeProps } from '../../utils/native-props';
|
|
4
|
+
import classNames from 'classnames';
|
|
5
|
+
import { bound } from '../../utils/bound';
|
|
6
|
+
import { usePropsValue } from '../../utils/use-props-value';
|
|
7
|
+
var classPrefix = 'adm-passcode-input';
|
|
8
|
+
var defaultProps = {
|
|
9
|
+
defaultValue: '',
|
|
10
|
+
length: 6,
|
|
11
|
+
plain: false,
|
|
12
|
+
error: false,
|
|
13
|
+
seperated: false,
|
|
14
|
+
caret: true
|
|
15
|
+
};
|
|
16
|
+
export var PasscodeInput = /*#__PURE__*/forwardRef(function (p, ref) {
|
|
17
|
+
var props = mergeProps(defaultProps, p); // 防止 length 值不合法
|
|
18
|
+
|
|
19
|
+
var cellLength = props.length > 0 && props.length < Infinity ? Math.floor(props.length) : defaultProps.length;
|
|
20
|
+
|
|
21
|
+
var _useState = useState(false),
|
|
22
|
+
focused = _useState[0],
|
|
23
|
+
setFocused = _useState[1];
|
|
24
|
+
|
|
25
|
+
var _usePropsValue = usePropsValue(props),
|
|
26
|
+
value = _usePropsValue[0],
|
|
27
|
+
setValue = _usePropsValue[1];
|
|
28
|
+
|
|
29
|
+
var rootRef = useRef(null);
|
|
30
|
+
var nativeInputRef = useRef(null);
|
|
31
|
+
useEffect(function () {
|
|
32
|
+
var _a;
|
|
33
|
+
|
|
34
|
+
if (value.length >= cellLength) {
|
|
35
|
+
(_a = props.onFill) === null || _a === void 0 ? void 0 : _a.call(props, value);
|
|
36
|
+
}
|
|
37
|
+
}, [props.onFill, value, cellLength]);
|
|
38
|
+
|
|
39
|
+
var onFocus = function onFocus() {
|
|
40
|
+
var _a, _b;
|
|
41
|
+
|
|
42
|
+
if (!props.keyboard) {
|
|
43
|
+
(_a = nativeInputRef.current) === null || _a === void 0 ? void 0 : _a.focus();
|
|
44
|
+
}
|
|
45
|
+
|
|
46
|
+
setFocused(true);
|
|
47
|
+
(_b = props.onFocus) === null || _b === void 0 ? void 0 : _b.call(props);
|
|
48
|
+
};
|
|
49
|
+
|
|
50
|
+
useEffect(function () {
|
|
51
|
+
if (!focused) return;
|
|
52
|
+
var timeout = window.setTimeout(function () {
|
|
53
|
+
var _a;
|
|
54
|
+
|
|
55
|
+
(_a = rootRef.current) === null || _a === void 0 ? void 0 : _a.scrollIntoView({
|
|
56
|
+
block: 'center',
|
|
57
|
+
inline: 'center',
|
|
58
|
+
behavior: 'smooth'
|
|
59
|
+
});
|
|
60
|
+
}, 100);
|
|
61
|
+
return function () {
|
|
62
|
+
window.clearTimeout(timeout);
|
|
63
|
+
};
|
|
64
|
+
}, [focused]);
|
|
65
|
+
|
|
66
|
+
var onBlur = function onBlur() {
|
|
67
|
+
var _a;
|
|
68
|
+
|
|
69
|
+
setFocused(false);
|
|
70
|
+
(_a = props.onBlur) === null || _a === void 0 ? void 0 : _a.call(props);
|
|
71
|
+
};
|
|
72
|
+
|
|
73
|
+
useImperativeHandle(ref, function () {
|
|
74
|
+
return {
|
|
75
|
+
focus: function focus() {
|
|
76
|
+
var _a;
|
|
77
|
+
|
|
78
|
+
return (_a = rootRef.current) === null || _a === void 0 ? void 0 : _a.focus();
|
|
79
|
+
},
|
|
80
|
+
blur: function blur() {
|
|
81
|
+
var _a, _b;
|
|
82
|
+
|
|
83
|
+
(_a = rootRef.current) === null || _a === void 0 ? void 0 : _a.blur();
|
|
84
|
+
(_b = nativeInputRef.current) === null || _b === void 0 ? void 0 : _b.blur();
|
|
85
|
+
}
|
|
86
|
+
};
|
|
87
|
+
});
|
|
88
|
+
|
|
89
|
+
var renderCells = function renderCells() {
|
|
90
|
+
var cells = [];
|
|
91
|
+
var chars = value.split('');
|
|
92
|
+
var caretIndex = chars.length; // 光标位置index等于当前文字长度
|
|
93
|
+
|
|
94
|
+
var focusedIndex = bound(chars.length, 0, cellLength - 1);
|
|
95
|
+
|
|
96
|
+
for (var i = 0; i < cellLength; i++) {
|
|
97
|
+
cells.push( /*#__PURE__*/React.createElement("div", {
|
|
98
|
+
className: classNames(classPrefix + "-cell", {
|
|
99
|
+
caret: props.caret && caretIndex === i && focused,
|
|
100
|
+
focused: focusedIndex === i && focused,
|
|
101
|
+
dot: !props.plain && chars[i]
|
|
102
|
+
}),
|
|
103
|
+
key: i
|
|
104
|
+
}, chars[i] && props.plain ? chars[i] : ''));
|
|
105
|
+
}
|
|
106
|
+
|
|
107
|
+
return cells;
|
|
108
|
+
};
|
|
109
|
+
|
|
110
|
+
var cls = classNames(classPrefix, {
|
|
111
|
+
focused: focused,
|
|
112
|
+
error: props.error,
|
|
113
|
+
seperated: props.seperated
|
|
114
|
+
});
|
|
115
|
+
return /*#__PURE__*/React.createElement(React.Fragment, null, withNativeProps(props, /*#__PURE__*/React.createElement("div", {
|
|
116
|
+
ref: rootRef,
|
|
117
|
+
tabIndex: 0,
|
|
118
|
+
className: cls,
|
|
119
|
+
onFocus: onFocus,
|
|
120
|
+
onBlur: onBlur
|
|
121
|
+
}, /*#__PURE__*/React.createElement("div", {
|
|
122
|
+
className: classPrefix + "-cell-container"
|
|
123
|
+
}, renderCells()), /*#__PURE__*/React.createElement("input", {
|
|
124
|
+
ref: nativeInputRef,
|
|
125
|
+
className: classPrefix + "-native-input",
|
|
126
|
+
value: value,
|
|
127
|
+
type: 'text',
|
|
128
|
+
pattern: '[0-9]*',
|
|
129
|
+
inputMode: 'numeric',
|
|
130
|
+
onChange: function onChange(e) {
|
|
131
|
+
setValue(e.target.value.slice(0, props.length));
|
|
132
|
+
}
|
|
133
|
+
}))), props.keyboard && /*#__PURE__*/React.cloneElement(props.keyboard, {
|
|
134
|
+
visible: focused,
|
|
135
|
+
onInput: function onInput(v) {
|
|
136
|
+
if (value.length < cellLength) {
|
|
137
|
+
setValue((value + v).slice(0, props.length));
|
|
138
|
+
}
|
|
139
|
+
},
|
|
140
|
+
onDelete: function onDelete() {
|
|
141
|
+
setValue(value.slice(0, -1));
|
|
142
|
+
},
|
|
143
|
+
onClose: function onClose() {
|
|
144
|
+
var _a;
|
|
145
|
+
|
|
146
|
+
(_a = rootRef.current) === null || _a === void 0 ? void 0 : _a.blur();
|
|
147
|
+
}
|
|
148
|
+
}));
|
|
149
|
+
});
|
|
@@ -103,6 +103,7 @@ export var Picker = /*#__PURE__*/memo(function (p) {
|
|
|
103
103
|
afterShow: props.afterShow,
|
|
104
104
|
afterClose: props.afterClose,
|
|
105
105
|
onClick: props.onClick,
|
|
106
|
+
forceRender: true,
|
|
106
107
|
stopPropagation: props.stopPropagation
|
|
107
108
|
}, pickerElement);
|
|
108
109
|
return /*#__PURE__*/React.createElement(React.Fragment, null, popupElement, (_a = props.children) === null || _a === void 0 ? void 0 : _a.call(props, generateValueExtend(value).items));
|
|
@@ -88,14 +88,55 @@ export var Column = function Column(props) {
|
|
|
88
88
|
touch: true
|
|
89
89
|
}
|
|
90
90
|
});
|
|
91
|
+
var selectedIndex = null;
|
|
92
|
+
|
|
93
|
+
function renderAccessible() {
|
|
94
|
+
console.log('selectedIndex', selectedIndex);
|
|
95
|
+
|
|
96
|
+
if (selectedIndex === null) {
|
|
97
|
+
return null;
|
|
98
|
+
}
|
|
99
|
+
|
|
100
|
+
var current = column[selectedIndex];
|
|
101
|
+
var previousIndex = selectedIndex - 1;
|
|
102
|
+
var nextIndex = selectedIndex + 1;
|
|
103
|
+
var previous = column[previousIndex];
|
|
104
|
+
var next = column[nextIndex];
|
|
105
|
+
return /*#__PURE__*/React.createElement("div", {
|
|
106
|
+
className: 'adm-picker-view-column-accessible'
|
|
107
|
+
}, /*#__PURE__*/React.createElement("div", {
|
|
108
|
+
className: 'adm-picker-view-column-accessible-current',
|
|
109
|
+
role: 'button',
|
|
110
|
+
"aria-label": current ? "\u5F53\u524D\u9009\u62E9\u7684\u662F\uFF1A" + current.label : '当前未选择'
|
|
111
|
+
}, "-"), /*#__PURE__*/React.createElement("div", null, previous && /*#__PURE__*/React.createElement("div", {
|
|
112
|
+
className: 'adm-picker-view-column-accessible-button',
|
|
113
|
+
onClick: function onClick() {
|
|
114
|
+
scrollSelect(previousIndex);
|
|
115
|
+
},
|
|
116
|
+
role: 'button',
|
|
117
|
+
"aria-label": "\u9009\u62E9\u4E0A\u4E00\u9879\uFF1A" + previous.label
|
|
118
|
+
}, "-")), /*#__PURE__*/React.createElement("div", null, next && /*#__PURE__*/React.createElement("div", {
|
|
119
|
+
className: 'adm-picker-view-column-accessible-button',
|
|
120
|
+
onClick: function onClick() {
|
|
121
|
+
scrollSelect(nextIndex);
|
|
122
|
+
},
|
|
123
|
+
role: 'button',
|
|
124
|
+
"aria-label": "\u9009\u62E9\u4E0B\u4E00\u9879\uFF1A" + next.label
|
|
125
|
+
}, "-")));
|
|
126
|
+
}
|
|
127
|
+
|
|
91
128
|
return /*#__PURE__*/React.createElement("div", Object.assign({
|
|
92
129
|
className: classPrefix + "-column"
|
|
93
130
|
}, bind()), /*#__PURE__*/React.createElement(animated.div, {
|
|
94
131
|
style: {
|
|
95
132
|
y: y
|
|
96
133
|
},
|
|
97
|
-
className: classPrefix + "-column-wheel"
|
|
134
|
+
className: classPrefix + "-column-wheel",
|
|
135
|
+
"aria-hidden": true
|
|
98
136
|
}, column.map(function (item, index) {
|
|
137
|
+
var selected = props.value === item.value;
|
|
138
|
+
if (selected) selectedIndex = index;
|
|
139
|
+
|
|
99
140
|
function handleClick() {
|
|
100
141
|
draggingRef.current = false;
|
|
101
142
|
scrollSelect(index);
|
|
@@ -103,10 +144,13 @@ export var Column = function Column(props) {
|
|
|
103
144
|
|
|
104
145
|
return /*#__PURE__*/React.createElement("div", {
|
|
105
146
|
key: item.value,
|
|
147
|
+
"data-selected": item.value === value,
|
|
106
148
|
className: classPrefix + "-column-item",
|
|
107
|
-
onClick: handleClick
|
|
149
|
+
onClick: handleClick,
|
|
150
|
+
"aria-hidden": !selected,
|
|
151
|
+
"aria-label": selected ? 'active' : ''
|
|
108
152
|
}, /*#__PURE__*/React.createElement("div", {
|
|
109
153
|
className: classPrefix + "-column-item-label"
|
|
110
154
|
}, item.label));
|
|
111
|
-
})));
|
|
155
|
+
})), renderAccessible());
|
|
112
156
|
};
|
|
@@ -12,6 +12,7 @@
|
|
|
12
12
|
user-select: none;
|
|
13
13
|
touch-action: none;
|
|
14
14
|
position: relative;
|
|
15
|
+
z-index: 0;
|
|
15
16
|
}
|
|
16
17
|
.adm-picker-view-column-wheel {
|
|
17
18
|
width: 100%;
|
|
@@ -49,20 +50,53 @@
|
|
|
49
50
|
text-overflow: ellipsis;
|
|
50
51
|
white-space: nowrap;
|
|
51
52
|
}
|
|
53
|
+
.adm-picker-view-column-accessible {
|
|
54
|
+
width: 100%;
|
|
55
|
+
height: 100%;
|
|
56
|
+
pointer-events: none;
|
|
57
|
+
opacity: 0;
|
|
58
|
+
display: flex;
|
|
59
|
+
flex-direction: column;
|
|
60
|
+
position: relative;
|
|
61
|
+
}
|
|
62
|
+
.adm-picker-view-column-accessible > * {
|
|
63
|
+
flex: 1;
|
|
64
|
+
text-overflow: ellipsis;
|
|
65
|
+
}
|
|
66
|
+
.adm-picker-view-column-accessible-current {
|
|
67
|
+
position: absolute;
|
|
68
|
+
width: 100%;
|
|
69
|
+
height: 100%;
|
|
70
|
+
}
|
|
71
|
+
.adm-picker-view-column-accessible-button {
|
|
72
|
+
width: 100%;
|
|
73
|
+
height: 100%;
|
|
74
|
+
}
|
|
52
75
|
.adm-picker-view-mask {
|
|
53
76
|
position: absolute;
|
|
77
|
+
z-index: 100;
|
|
54
78
|
left: 0;
|
|
79
|
+
top: 0;
|
|
55
80
|
width: 100%;
|
|
56
|
-
height:
|
|
81
|
+
height: 100%;
|
|
82
|
+
display: flex;
|
|
83
|
+
flex-direction: column;
|
|
57
84
|
pointer-events: none;
|
|
58
85
|
}
|
|
59
|
-
.adm-picker-view-mask-top
|
|
60
|
-
|
|
86
|
+
.adm-picker-view-mask-top,
|
|
87
|
+
.adm-picker-view-mask-bottom {
|
|
88
|
+
flex: auto;
|
|
89
|
+
}
|
|
90
|
+
.adm-picker-view-mask-middle {
|
|
91
|
+
height: 34px;
|
|
92
|
+
box-sizing: border-box;
|
|
93
|
+
flex: none;
|
|
94
|
+
border-top: solid 1px var(--adm-border-color);
|
|
61
95
|
border-bottom: solid 1px var(--adm-border-color);
|
|
96
|
+
}
|
|
97
|
+
.adm-picker-view-mask-top {
|
|
62
98
|
background: linear-gradient(0deg, rgba(255, 255, 255, 0.7) 50%, #ffffff);
|
|
63
99
|
}
|
|
64
100
|
.adm-picker-view-mask-bottom {
|
|
65
|
-
bottom: -5px;
|
|
66
|
-
border-top: solid 1px var(--adm-border-color);
|
|
67
101
|
background: linear-gradient(180deg, rgba(255, 255, 255, 0.7) 50%, #ffffff);
|
|
68
102
|
}
|
|
@@ -59,8 +59,12 @@ export var PickerView = /*#__PURE__*/memo(function (p) {
|
|
|
59
59
|
}
|
|
60
60
|
});
|
|
61
61
|
}), /*#__PURE__*/React.createElement("div", {
|
|
62
|
-
className: classPrefix + "-mask
|
|
62
|
+
className: classPrefix + "-mask"
|
|
63
|
+
}, /*#__PURE__*/React.createElement("div", {
|
|
64
|
+
className: classPrefix + "-mask-top"
|
|
63
65
|
}), /*#__PURE__*/React.createElement("div", {
|
|
64
|
-
className: classPrefix + "-mask
|
|
65
|
-
})
|
|
66
|
+
className: classPrefix + "-mask-middle"
|
|
67
|
+
}), /*#__PURE__*/React.createElement("div", {
|
|
68
|
+
className: classPrefix + "-mask-bottom"
|
|
69
|
+
}))));
|
|
66
70
|
});
|
|
@@ -1,8 +1,9 @@
|
|
|
1
1
|
import './toast.less';
|
|
2
|
-
import { clear, show } from './methods';
|
|
2
|
+
import { clear, show, config } from './methods';
|
|
3
3
|
export type { ToastShowProps } from './methods';
|
|
4
4
|
declare const Toast: {
|
|
5
5
|
show: typeof show;
|
|
6
6
|
clear: typeof clear;
|
|
7
|
+
config: typeof config;
|
|
7
8
|
};
|
|
8
9
|
export default Toast;
|
|
@@ -2,3 +2,4 @@ import { ToastProps } from './toast';
|
|
|
2
2
|
export declare type ToastShowProps = Omit<ToastProps, 'visible'>;
|
|
3
3
|
export declare function show(p: ToastShowProps | string): void;
|
|
4
4
|
export declare function clear(): void;
|
|
5
|
+
export declare function config(val: Pick<ToastProps, 'duration' | 'position' | 'maskClickable'>): void;
|
|
@@ -14,7 +14,9 @@ function unmount(container) {
|
|
|
14
14
|
}
|
|
15
15
|
|
|
16
16
|
var defaultProps = {
|
|
17
|
-
duration: 2000
|
|
17
|
+
duration: 2000,
|
|
18
|
+
position: 'center',
|
|
19
|
+
maskClickable: true
|
|
18
20
|
};
|
|
19
21
|
export function show(p) {
|
|
20
22
|
var props = mergeProps(defaultProps, typeof p === 'string' ? {
|
|
@@ -74,4 +76,17 @@ export function clear() {
|
|
|
74
76
|
if (!container) break;
|
|
75
77
|
unmount(container);
|
|
76
78
|
}
|
|
79
|
+
}
|
|
80
|
+
export function config(val) {
|
|
81
|
+
if (val.duration !== undefined) {
|
|
82
|
+
defaultProps.duration = val.duration;
|
|
83
|
+
}
|
|
84
|
+
|
|
85
|
+
if (val.position !== undefined) {
|
|
86
|
+
defaultProps.position = val.position;
|
|
87
|
+
}
|
|
88
|
+
|
|
89
|
+
if (val.maskClickable !== undefined) {
|
|
90
|
+
defaultProps.maskClickable = val.maskClickable;
|
|
91
|
+
}
|
|
77
92
|
}
|
package/es/index.d.ts
CHANGED
|
@@ -72,3 +72,4 @@ export { default as Toast } from './components/toast';
|
|
|
72
72
|
export { default as TreeSelect } from './components/tree-select';
|
|
73
73
|
export { default as VirtualInput } from './components/virtual-input';
|
|
74
74
|
export { default as WaterMark } from './components/water-mark';
|
|
75
|
+
export { default as PasscodeInput } from './components/passcode-input';
|
package/es/index.js
CHANGED
|
@@ -72,4 +72,5 @@ export { default as TextArea } from './components/text-area';
|
|
|
72
72
|
export { default as Toast } from './components/toast';
|
|
73
73
|
export { default as TreeSelect } from './components/tree-select';
|
|
74
74
|
export { default as VirtualInput } from './components/virtual-input';
|
|
75
|
-
export { default as WaterMark } from './components/water-mark';
|
|
75
|
+
export { default as WaterMark } from './components/water-mark';
|
|
76
|
+
export { default as PasscodeInput } from './components/passcode-input';
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
import { memo } from 'react';
|
|
2
|
+
export function memoWithEventMarks(Component, eventProps) {
|
|
3
|
+
return /*#__PURE__*/memo(Component, function (prevProps, nextProps) {
|
|
4
|
+
for (var k in nextProps) {
|
|
5
|
+
var key = k;
|
|
6
|
+
if (eventProps.includes(key)) continue;
|
|
7
|
+
|
|
8
|
+
if (prevProps[key] !== nextProps[key]) {
|
|
9
|
+
return false;
|
|
10
|
+
}
|
|
11
|
+
}
|
|
12
|
+
|
|
13
|
+
return true;
|
|
14
|
+
});
|
|
15
|
+
}
|