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.
Files changed (97) hide show
  1. package/2x/README.md +2 -0
  2. package/2x/cjs/components/collapse/collapse.d.ts +2 -2
  3. package/2x/cjs/components/collapse/collapse.js +1 -1
  4. package/2x/cjs/components/dialog/dialog.js +7 -4
  5. package/2x/cjs/components/list/list.css +5 -4
  6. package/2x/cjs/components/list/list.js +1 -3
  7. package/2x/cjs/components/number-keyboard/number-keyboard.css +2 -2
  8. package/2x/cjs/components/passcode-input/index.d.ts +4 -0
  9. package/2x/cjs/components/passcode-input/index.js +13 -0
  10. package/2x/cjs/components/passcode-input/passcode-input.css +166 -0
  11. package/2x/cjs/components/passcode-input/passcode-input.d.ts +35 -0
  12. package/2x/cjs/components/passcode-input/passcode-input.js +169 -0
  13. package/2x/cjs/components/picker/picker.js +1 -0
  14. package/2x/cjs/components/picker-view/column.js +47 -3
  15. package/2x/cjs/components/picker-view/picker-view.css +45 -5
  16. package/2x/cjs/components/picker-view/picker-view.js +7 -3
  17. package/2x/cjs/components/toast/index.d.ts +2 -1
  18. package/2x/cjs/components/toast/index.js +2 -1
  19. package/2x/cjs/components/toast/methods.d.ts +1 -0
  20. package/2x/cjs/components/toast/methods.js +18 -1
  21. package/2x/cjs/index.d.ts +1 -0
  22. package/2x/cjs/index.js +8 -0
  23. package/2x/cjs/utils/memo-with-event-marks.d.ts +2 -0
  24. package/2x/cjs/utils/memo-with-event-marks.js +23 -0
  25. package/2x/es/components/collapse/collapse.d.ts +2 -2
  26. package/2x/es/components/collapse/collapse.js +1 -1
  27. package/2x/es/components/dialog/dialog.js +6 -4
  28. package/2x/es/components/list/list.css +5 -4
  29. package/2x/es/components/list/list.js +1 -3
  30. package/2x/es/components/number-keyboard/number-keyboard.css +2 -2
  31. package/2x/es/components/passcode-input/index.d.ts +4 -0
  32. package/2x/es/components/passcode-input/index.js +3 -0
  33. package/2x/es/components/passcode-input/passcode-input.css +166 -0
  34. package/2x/es/components/passcode-input/passcode-input.d.ts +35 -0
  35. package/2x/es/components/passcode-input/passcode-input.js +149 -0
  36. package/2x/es/components/picker/picker.js +1 -0
  37. package/2x/es/components/picker-view/column.js +47 -3
  38. package/2x/es/components/picker-view/picker-view.css +45 -5
  39. package/2x/es/components/picker-view/picker-view.js +7 -3
  40. package/2x/es/components/toast/index.d.ts +2 -1
  41. package/2x/es/components/toast/index.js +3 -2
  42. package/2x/es/components/toast/methods.d.ts +1 -0
  43. package/2x/es/components/toast/methods.js +16 -1
  44. package/2x/es/index.d.ts +1 -0
  45. package/2x/es/index.js +2 -1
  46. package/2x/es/utils/memo-with-event-marks.d.ts +2 -0
  47. package/2x/es/utils/memo-with-event-marks.js +15 -0
  48. package/2x/package.json +1 -1
  49. package/README.md +2 -0
  50. package/cjs/components/collapse/collapse.d.ts +2 -2
  51. package/cjs/components/collapse/collapse.js +1 -1
  52. package/cjs/components/dialog/dialog.js +7 -4
  53. package/cjs/components/list/list.css +4 -3
  54. package/cjs/components/list/list.js +1 -3
  55. package/cjs/components/number-keyboard/number-keyboard.css +2 -2
  56. package/cjs/components/passcode-input/index.d.ts +4 -0
  57. package/cjs/components/passcode-input/index.js +13 -0
  58. package/cjs/components/passcode-input/passcode-input.css +136 -0
  59. package/cjs/components/passcode-input/passcode-input.d.ts +35 -0
  60. package/cjs/components/passcode-input/passcode-input.js +169 -0
  61. package/cjs/components/picker/picker.js +1 -0
  62. package/cjs/components/picker-view/column.js +47 -3
  63. package/cjs/components/picker-view/picker-view.css +39 -5
  64. package/cjs/components/picker-view/picker-view.js +7 -3
  65. package/cjs/components/toast/index.d.ts +2 -1
  66. package/cjs/components/toast/index.js +2 -1
  67. package/cjs/components/toast/methods.d.ts +1 -0
  68. package/cjs/components/toast/methods.js +18 -1
  69. package/cjs/index.d.ts +1 -0
  70. package/cjs/index.js +8 -0
  71. package/cjs/utils/memo-with-event-marks.d.ts +2 -0
  72. package/cjs/utils/memo-with-event-marks.js +23 -0
  73. package/es/components/collapse/collapse.d.ts +2 -2
  74. package/es/components/collapse/collapse.js +1 -1
  75. package/es/components/dialog/dialog.js +6 -4
  76. package/es/components/list/list.css +4 -3
  77. package/es/components/list/list.js +1 -3
  78. package/es/components/number-keyboard/number-keyboard.css +2 -2
  79. package/es/components/passcode-input/index.d.ts +4 -0
  80. package/es/components/passcode-input/index.js +3 -0
  81. package/es/components/passcode-input/passcode-input.css +136 -0
  82. package/es/components/passcode-input/passcode-input.d.ts +35 -0
  83. package/es/components/passcode-input/passcode-input.js +149 -0
  84. package/es/components/picker/picker.js +1 -0
  85. package/es/components/picker-view/column.js +47 -3
  86. package/es/components/picker-view/picker-view.css +39 -5
  87. package/es/components/picker-view/picker-view.js +7 -3
  88. package/es/components/toast/index.d.ts +2 -1
  89. package/es/components/toast/index.js +3 -2
  90. package/es/components/toast/methods.d.ts +1 -0
  91. package/es/components/toast/methods.js +16 -1
  92. package/es/index.d.ts +1 -0
  93. package/es/index.js +2 -1
  94. package/es/utils/memo-with-event-marks.d.ts +2 -0
  95. package/es/utils/memo-with-event-marks.js +15 -0
  96. package/package.json +1 -1
  97. package/umd/antd-mobile.js +1 -1
package/2x/README.md CHANGED
@@ -4,6 +4,8 @@
4
4
  ![GitHub (Pre-)Release Date](https://img.shields.io/github/release-date-pre/ant-design/ant-design-mobile)
5
5
  ![npm](https://img.shields.io/npm/dw/antd-mobile-v5-count)
6
6
  ![gzip size](https://img.badgesize.io/https:/unpkg.com/antd-mobile@next/umd/antd-mobile.js?label=gzip%20size&compression=gzip)
7
+ [![Average time to resolve an issue](http://isitmaintained.com/badge/resolution/ant-design/ant-design-mobile.svg)](http://isitmaintained.com/project/ant-design/ant-design-mobile 'Average time to resolve an issue')
8
+ [![Percentage of issues still open](http://isitmaintained.com/badge/open/ant-design/ant-design-mobile.svg)](http://isitmaintained.com/project/ant-design/ant-design-mobile 'Percentage of issues still open')
7
9
  ![GitHub Workflow Status (branch)](https://img.shields.io/github/workflow/status/ant-design/ant-design-mobile/Check/v5)
8
10
  ![GitHub](https://img.shields.io/github/license/ant-design/ant-design-mobile)
9
11
 
@@ -7,14 +7,14 @@ export declare type CollapsePanelProps = {
7
7
  forceRender?: boolean;
8
8
  destroyOnClose?: boolean;
9
9
  onClick?: (event: React.MouseEvent<Element, MouseEvent>) => void;
10
- arrow?: React.ReactNode;
10
+ arrow?: React.ReactNode | ((active: boolean) => React.ReactNode);
11
11
  } & NativeProps;
12
12
  export declare const CollapsePanel: FC<CollapsePanelProps>;
13
13
  declare type ValueProps<T> = {
14
14
  activeKey?: T;
15
15
  defaultActiveKey?: T;
16
16
  onChange?: (activeKey: T) => void;
17
- arrow?: React.ReactNode;
17
+ arrow?: React.ReactNode | ((active: boolean) => React.ReactNode);
18
18
  };
19
19
  export declare type CollapseProps = (({
20
20
  accordion?: false;
@@ -168,7 +168,7 @@ var Collapse = function Collapse(props) {
168
168
  arrow = panel.props.arrow;
169
169
  }
170
170
 
171
- return /*#__PURE__*/_react["default"].createElement("div", {
171
+ return typeof arrow === 'function' ? arrow(active) : /*#__PURE__*/_react["default"].createElement("div", {
172
172
  className: (0, _classnames["default"])(classPrefix + "-arrow", (_classNames = {}, _classNames[classPrefix + "-arrow-active"] = active, _classNames))
173
173
  }, arrow);
174
174
  };
@@ -21,6 +21,8 @@ var _image = _interopRequireDefault(require("../image"));
21
21
 
22
22
  var _space = _interopRequireDefault(require("../space"));
23
23
 
24
+ var _renderToContainer = require("../../utils/render-to-container");
25
+
24
26
  var _withStopPropagation = require("../../utils/with-stop-propagation");
25
27
 
26
28
  var _autoCenter = _interopRequireDefault(require("../auto-center"));
@@ -73,7 +75,8 @@ var defaultProps = {
73
75
  actions: [],
74
76
  closeOnAction: false,
75
77
  closeOnMaskClick: false,
76
- stopPropagation: ['click']
78
+ stopPropagation: ['click'],
79
+ getContainer: null
77
80
  };
78
81
 
79
82
  var Dialog = function Dialog(p) {
@@ -107,14 +110,13 @@ var Dialog = function Dialog(p) {
107
110
  active = _useState[0],
108
111
  setActive = _useState[1];
109
112
 
110
- return (0, _withStopPropagation.withStopPropagation)(props.stopPropagation, (0, _nativeProps.withNativeProps)(props, /*#__PURE__*/_react["default"].createElement("div", {
113
+ var node = (0, _nativeProps.withNativeProps)(props, /*#__PURE__*/_react["default"].createElement("div", {
111
114
  className: classPrefix,
112
115
  style: {
113
116
  display: active ? 'unset' : 'none'
114
117
  }
115
118
  }, /*#__PURE__*/_react["default"].createElement(_mask["default"], {
116
119
  visible: props.visible,
117
- getContainer: props.getContainer,
118
120
  onMaskClick: props.closeOnMaskClick ? props.onClose : undefined,
119
121
  style: props.maskStyle,
120
122
  className: (0, _classnames["default"])(classPrefix + "-mask", props.maskClassName)
@@ -184,7 +186,8 @@ var Dialog = function Dialog(p) {
184
186
  }
185
187
  });
186
188
  }));
187
- })))))));
189
+ }))))));
190
+ return (0, _renderToContainer.renderToContainer)(props.getContainer, (0, _withStopPropagation.withStopPropagation)(props.stopPropagation, node));
188
191
  };
189
192
 
190
193
  exports.Dialog = Dialog;
@@ -11,10 +11,6 @@
11
11
  font-size: 34px;
12
12
  }
13
13
 
14
- .adm-list-inner {
15
- margin-bottom: -2px;
16
- }
17
-
18
14
  .adm-list-default {
19
15
  border-top: var(--border-top);
20
16
  border-bottom: var(--border-bottom);
@@ -26,10 +22,15 @@
26
22
  }
27
23
 
28
24
  .adm-list-item {
25
+ margin-bottom: -2px;
29
26
  display: block;
30
27
  padding-left: var(--padding-left);
31
28
  }
32
29
 
30
+ .adm-list-item:not(:first-child) {
31
+ padding-top: 2px;
32
+ }
33
+
33
34
  .adm-list-item-title,
34
35
  .adm-list-item-description {
35
36
  color: var(--adm-color-weak);
@@ -24,9 +24,7 @@ var List = function List(p) {
24
24
  var props = (0, _withDefaultProps.mergeProps)(defaultProps, p);
25
25
  return (0, _nativeProps.withNativeProps)(props, /*#__PURE__*/_react["default"].createElement("div", {
26
26
  className: (0, _classnames["default"])(classPrefix, classPrefix + "-" + props.mode)
27
- }, /*#__PURE__*/_react["default"].createElement("div", {
28
- className: classPrefix + "-inner"
29
- }, props.children)));
27
+ }, props.children));
30
28
  };
31
29
 
32
30
  exports.List = List;
@@ -4,8 +4,7 @@
4
4
  flex: 1;
5
5
  }
6
6
 
7
- .adm-number-keyboard.confirmed-style {
8
- width: 75%;
7
+ .adm-number-keyboard-main.confirmed-style .sign-key {
9
8
  background-color: var(--adm-color-white);
10
9
  }
11
10
 
@@ -125,6 +124,7 @@
125
124
  color: var(--adm-color-white);
126
125
  height: 288px;
127
126
  font-size: 32px;
127
+ border: none;
128
128
  }
129
129
 
130
130
  .adm-number-keyboard-bs-key {
@@ -0,0 +1,4 @@
1
+ import './passcode-input.less';
2
+ import { PasscodeInput } from './passcode-input';
3
+ export type { PasscodeInputProps } from './passcode-input';
4
+ export default PasscodeInput;
@@ -0,0 +1,13 @@
1
+ "use strict";
2
+
3
+ Object.defineProperty(exports, "__esModule", {
4
+ value: true
5
+ });
6
+ exports["default"] = void 0;
7
+
8
+ require("./passcode-input.css");
9
+
10
+ var _passcodeInput2 = require("./passcode-input");
11
+
12
+ var _default = _passcodeInput2.PasscodeInput;
13
+ exports["default"] = _default;
@@ -0,0 +1,166 @@
1
+ .adm-passcode-input {
2
+ position: relative;
3
+ display: inline-block;
4
+ --cell-size: 80px;
5
+ --cell-gap: 12px;
6
+ --dot-size: 20px;
7
+ --border-color: #e5e5e5;
8
+ --border-radius: 16px;
9
+ }
10
+
11
+ .adm-passcode-input-cell-container {
12
+ display: inline-flex;
13
+ vertical-align: top;
14
+ }
15
+
16
+ .adm-passcode-input-cell {
17
+ flex: none;
18
+ display: flex;
19
+ align-items: center;
20
+ justify-content: center;
21
+ box-sizing: border-box;
22
+ font-size: 36px;
23
+ width: var(--cell-size);
24
+ height: var(--cell-size);
25
+ background: var(--adm-color-white);
26
+ }
27
+
28
+ .adm-passcode-input:not(.seperated) {
29
+ border-radius: var(--border-radius);
30
+ overflow: hidden;
31
+ border: 2px solid var(--border-color);
32
+ }
33
+
34
+ .adm-passcode-input:not(.seperated) .adm-passcode-input-cell:not(:last-child) {
35
+ border-right: 2px solid var(--border-color);
36
+ }
37
+
38
+ .adm-passcode-input:not(.seperated).focused {
39
+ border-color: var(--adm-color-primary);
40
+ box-shadow: 0 0 4px 0 var(--adm-color-primary);
41
+ outline: none;
42
+ }
43
+
44
+ .adm-passcode-input:not(.seperated).error {
45
+ border-color: var(--adm-color-danger);
46
+ box-shadow: 0 0 4px 0 var(--adm-color-danger);
47
+ animation: 100ms ease-in-out 0s 3 normal none running adm-shake-horizontal;
48
+ }
49
+
50
+ .adm-passcode-input.seperated .adm-passcode-input-cell {
51
+ border-radius: var(--border-radius);
52
+ border: 2px solid var(--border-color);
53
+ }
54
+
55
+ .adm-passcode-input.seperated .adm-passcode-input-cell:not(:last-child) {
56
+ margin-right: var(--cell-gap);
57
+ }
58
+
59
+ .adm-passcode-input.seperated .adm-passcode-input-cell.focused {
60
+ border-color: var(--adm-color-primary);
61
+ box-shadow: 0 0 4px 0 var(--adm-color-primary);
62
+ }
63
+
64
+ .adm-passcode-input.seperated.focused {
65
+ outline: none;
66
+ }
67
+
68
+ .adm-passcode-input.seperated.error {
69
+ animation: 100ms ease-in-out 0s 3 normal none running adm-shake-horizontal;
70
+ }
71
+
72
+ .adm-passcode-input.seperated.error .adm-passcode-input-cell {
73
+ border-color: var(--adm-color-danger);
74
+ box-shadow: 0 0 4px 0 var(--adm-color-danger);
75
+ }
76
+
77
+ .adm-passcode-input-cell.dot::before {
78
+ content: '';
79
+ width: var(--dot-size);
80
+ height: var(--dot-size);
81
+ border-radius: 50%;
82
+ background: var(--adm-color-text);
83
+ }
84
+
85
+ .adm-passcode-input-cell.caret::after {
86
+ content: '';
87
+ width: 4px;
88
+ height: 1.1em;
89
+ margin-left: 2px;
90
+ background: var(--adm-color-primary);
91
+ animation: 1s linear infinite adm-caret-blink;
92
+ }
93
+
94
+ .adm-passcode-input > .adm-passcode-input-native-input {
95
+ position: absolute;
96
+ left: -200vw;
97
+ top: 0;
98
+ display: block;
99
+ width: 100px;
100
+ height: 40px;
101
+ opacity: 0.5;
102
+ }
103
+
104
+ @keyframes adm-shake-horizontal {
105
+ 0% {
106
+ transform: translateX(0);
107
+ }
108
+
109
+ 10% {
110
+ transform: translateX(-8px);
111
+ }
112
+
113
+ 20% {
114
+ transform: translateX(10px);
115
+ }
116
+
117
+ 30% {
118
+ transform: translateX(-2px);
119
+ }
120
+
121
+ 40% {
122
+ transform: translateX(16px);
123
+ }
124
+
125
+ 50% {
126
+ transform: translateX(0);
127
+ }
128
+
129
+ 60% {
130
+ transform: translateX(-16px);
131
+ }
132
+
133
+ 70% {
134
+ transform: translateX(2px);
135
+ }
136
+
137
+ 80% {
138
+ transform: translateX(-10px);
139
+ }
140
+
141
+ 90% {
142
+ transform: translateX(8px);
143
+ }
144
+
145
+ 100% {
146
+ transform: translateX(0);
147
+ }
148
+ }
149
+
150
+ @keyframes adm-caret-blink {
151
+ from {
152
+ opacity: 1;
153
+ }
154
+
155
+ 60% {
156
+ opacity: 1;
157
+ }
158
+
159
+ 80% {
160
+ opacity: 0;
161
+ }
162
+
163
+ to {
164
+ opacity: 0;
165
+ }
166
+ }
@@ -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,169 @@
1
+ "use strict";
2
+
3
+ Object.defineProperty(exports, "__esModule", {
4
+ value: true
5
+ });
6
+ exports.PasscodeInput = void 0;
7
+
8
+ var _react = _interopRequireWildcard(require("react"));
9
+
10
+ var _withDefaultProps = require("../../utils/with-default-props");
11
+
12
+ var _nativeProps = require("../../utils/native-props");
13
+
14
+ var _classnames = _interopRequireDefault(require("classnames"));
15
+
16
+ var _bound = require("../../utils/bound");
17
+
18
+ var _usePropsValue2 = require("../../utils/use-props-value");
19
+
20
+ function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { "default": obj }; }
21
+
22
+ function _getRequireWildcardCache(nodeInterop) { if (typeof WeakMap !== "function") return null; var cacheBabelInterop = new WeakMap(); var cacheNodeInterop = new WeakMap(); return (_getRequireWildcardCache = function _getRequireWildcardCache(nodeInterop) { return nodeInterop ? cacheNodeInterop : cacheBabelInterop; })(nodeInterop); }
23
+
24
+ function _interopRequireWildcard(obj, nodeInterop) { if (!nodeInterop && obj && obj.__esModule) { return obj; } if (obj === null || typeof obj !== "object" && typeof obj !== "function") { return { "default": obj }; } var cache = _getRequireWildcardCache(nodeInterop); if (cache && cache.has(obj)) { return cache.get(obj); } var newObj = {}; var hasPropertyDescriptor = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var key in obj) { if (key !== "default" && Object.prototype.hasOwnProperty.call(obj, key)) { var desc = hasPropertyDescriptor ? Object.getOwnPropertyDescriptor(obj, key) : null; if (desc && (desc.get || desc.set)) { Object.defineProperty(newObj, key, desc); } else { newObj[key] = obj[key]; } } } newObj["default"] = obj; if (cache) { cache.set(obj, newObj); } return newObj; }
25
+
26
+ var classPrefix = 'adm-passcode-input';
27
+ var defaultProps = {
28
+ defaultValue: '',
29
+ length: 6,
30
+ plain: false,
31
+ error: false,
32
+ seperated: false,
33
+ caret: true
34
+ };
35
+ var PasscodeInput = /*#__PURE__*/(0, _react.forwardRef)(function (p, ref) {
36
+ var props = (0, _withDefaultProps.mergeProps)(defaultProps, p); // 防止 length 值不合法
37
+
38
+ var cellLength = props.length > 0 && props.length < Infinity ? Math.floor(props.length) : defaultProps.length;
39
+
40
+ var _useState = (0, _react.useState)(false),
41
+ focused = _useState[0],
42
+ setFocused = _useState[1];
43
+
44
+ var _usePropsValue = (0, _usePropsValue2.usePropsValue)(props),
45
+ value = _usePropsValue[0],
46
+ setValue = _usePropsValue[1];
47
+
48
+ var rootRef = (0, _react.useRef)(null);
49
+ var nativeInputRef = (0, _react.useRef)(null);
50
+ (0, _react.useEffect)(function () {
51
+ var _a;
52
+
53
+ if (value.length >= cellLength) {
54
+ (_a = props.onFill) === null || _a === void 0 ? void 0 : _a.call(props, value);
55
+ }
56
+ }, [props.onFill, value, cellLength]);
57
+
58
+ var onFocus = function onFocus() {
59
+ var _a, _b;
60
+
61
+ if (!props.keyboard) {
62
+ (_a = nativeInputRef.current) === null || _a === void 0 ? void 0 : _a.focus();
63
+ }
64
+
65
+ setFocused(true);
66
+ (_b = props.onFocus) === null || _b === void 0 ? void 0 : _b.call(props);
67
+ };
68
+
69
+ (0, _react.useEffect)(function () {
70
+ if (!focused) return;
71
+ var timeout = window.setTimeout(function () {
72
+ var _a;
73
+
74
+ (_a = rootRef.current) === null || _a === void 0 ? void 0 : _a.scrollIntoView({
75
+ block: 'center',
76
+ inline: 'center',
77
+ behavior: 'smooth'
78
+ });
79
+ }, 100);
80
+ return function () {
81
+ window.clearTimeout(timeout);
82
+ };
83
+ }, [focused]);
84
+
85
+ var onBlur = function onBlur() {
86
+ var _a;
87
+
88
+ setFocused(false);
89
+ (_a = props.onBlur) === null || _a === void 0 ? void 0 : _a.call(props);
90
+ };
91
+
92
+ (0, _react.useImperativeHandle)(ref, function () {
93
+ return {
94
+ focus: function focus() {
95
+ var _a;
96
+
97
+ return (_a = rootRef.current) === null || _a === void 0 ? void 0 : _a.focus();
98
+ },
99
+ blur: function blur() {
100
+ var _a, _b;
101
+
102
+ (_a = rootRef.current) === null || _a === void 0 ? void 0 : _a.blur();
103
+ (_b = nativeInputRef.current) === null || _b === void 0 ? void 0 : _b.blur();
104
+ }
105
+ };
106
+ });
107
+
108
+ var renderCells = function renderCells() {
109
+ var cells = [];
110
+ var chars = value.split('');
111
+ var caretIndex = chars.length; // 光标位置index等于当前文字长度
112
+
113
+ var focusedIndex = (0, _bound.bound)(chars.length, 0, cellLength - 1);
114
+
115
+ for (var i = 0; i < cellLength; i++) {
116
+ cells.push( /*#__PURE__*/_react["default"].createElement("div", {
117
+ className: (0, _classnames["default"])(classPrefix + "-cell", {
118
+ caret: props.caret && caretIndex === i && focused,
119
+ focused: focusedIndex === i && focused,
120
+ dot: !props.plain && chars[i]
121
+ }),
122
+ key: i
123
+ }, chars[i] && props.plain ? chars[i] : ''));
124
+ }
125
+
126
+ return cells;
127
+ };
128
+
129
+ var cls = (0, _classnames["default"])(classPrefix, {
130
+ focused: focused,
131
+ error: props.error,
132
+ seperated: props.seperated
133
+ });
134
+ return /*#__PURE__*/_react["default"].createElement(_react["default"].Fragment, null, (0, _nativeProps.withNativeProps)(props, /*#__PURE__*/_react["default"].createElement("div", {
135
+ ref: rootRef,
136
+ tabIndex: 0,
137
+ className: cls,
138
+ onFocus: onFocus,
139
+ onBlur: onBlur
140
+ }, /*#__PURE__*/_react["default"].createElement("div", {
141
+ className: classPrefix + "-cell-container"
142
+ }, renderCells()), /*#__PURE__*/_react["default"].createElement("input", {
143
+ ref: nativeInputRef,
144
+ className: classPrefix + "-native-input",
145
+ value: value,
146
+ type: 'text',
147
+ pattern: '[0-9]*',
148
+ inputMode: 'numeric',
149
+ onChange: function onChange(e) {
150
+ setValue(e.target.value.slice(0, props.length));
151
+ }
152
+ }))), props.keyboard && /*#__PURE__*/_react["default"].cloneElement(props.keyboard, {
153
+ visible: focused,
154
+ onInput: function onInput(v) {
155
+ if (value.length < cellLength) {
156
+ setValue((value + v).slice(0, props.length));
157
+ }
158
+ },
159
+ onDelete: function onDelete() {
160
+ setValue(value.slice(0, -1));
161
+ },
162
+ onClose: function onClose() {
163
+ var _a;
164
+
165
+ (_a = rootRef.current) === null || _a === void 0 ? void 0 : _a.blur();
166
+ }
167
+ }));
168
+ });
169
+ exports.PasscodeInput = PasscodeInput;
@@ -127,6 +127,7 @@ var Picker = /*#__PURE__*/(0, _react.memo)(function (p) {
127
127
  afterShow: props.afterShow,
128
128
  afterClose: props.afterClose,
129
129
  onClick: props.onClick,
130
+ forceRender: true,
130
131
  stopPropagation: props.stopPropagation
131
132
  }, pickerElement);
132
133
 
@@ -106,14 +106,55 @@ var Column = function Column(props) {
106
106
  touch: true
107
107
  }
108
108
  });
109
+ var selectedIndex = null;
110
+
111
+ function renderAccessible() {
112
+ console.log('selectedIndex', selectedIndex);
113
+
114
+ if (selectedIndex === null) {
115
+ return null;
116
+ }
117
+
118
+ var current = column[selectedIndex];
119
+ var previousIndex = selectedIndex - 1;
120
+ var nextIndex = selectedIndex + 1;
121
+ var previous = column[previousIndex];
122
+ var next = column[nextIndex];
123
+ return /*#__PURE__*/_react["default"].createElement("div", {
124
+ className: 'adm-picker-view-column-accessible'
125
+ }, /*#__PURE__*/_react["default"].createElement("div", {
126
+ className: 'adm-picker-view-column-accessible-current',
127
+ role: 'button',
128
+ "aria-label": current ? "\u5F53\u524D\u9009\u62E9\u7684\u662F\uFF1A" + current.label : '当前未选择'
129
+ }, "-"), /*#__PURE__*/_react["default"].createElement("div", null, previous && /*#__PURE__*/_react["default"].createElement("div", {
130
+ className: 'adm-picker-view-column-accessible-button',
131
+ onClick: function onClick() {
132
+ scrollSelect(previousIndex);
133
+ },
134
+ role: 'button',
135
+ "aria-label": "\u9009\u62E9\u4E0A\u4E00\u9879\uFF1A" + previous.label
136
+ }, "-")), /*#__PURE__*/_react["default"].createElement("div", null, next && /*#__PURE__*/_react["default"].createElement("div", {
137
+ className: 'adm-picker-view-column-accessible-button',
138
+ onClick: function onClick() {
139
+ scrollSelect(nextIndex);
140
+ },
141
+ role: 'button',
142
+ "aria-label": "\u9009\u62E9\u4E0B\u4E00\u9879\uFF1A" + next.label
143
+ }, "-")));
144
+ }
145
+
109
146
  return /*#__PURE__*/_react["default"].createElement("div", Object.assign({
110
147
  className: classPrefix + "-column"
111
148
  }, bind()), /*#__PURE__*/_react["default"].createElement(_web.animated.div, {
112
149
  style: {
113
150
  y: y
114
151
  },
115
- className: classPrefix + "-column-wheel"
152
+ className: classPrefix + "-column-wheel",
153
+ "aria-hidden": true
116
154
  }, column.map(function (item, index) {
155
+ var selected = props.value === item.value;
156
+ if (selected) selectedIndex = index;
157
+
117
158
  function handleClick() {
118
159
  draggingRef.current = false;
119
160
  scrollSelect(index);
@@ -121,12 +162,15 @@ var Column = function Column(props) {
121
162
 
122
163
  return /*#__PURE__*/_react["default"].createElement("div", {
123
164
  key: item.value,
165
+ "data-selected": item.value === value,
124
166
  className: classPrefix + "-column-item",
125
- onClick: handleClick
167
+ onClick: handleClick,
168
+ "aria-hidden": !selected,
169
+ "aria-label": selected ? 'active' : ''
126
170
  }, /*#__PURE__*/_react["default"].createElement("div", {
127
171
  className: classPrefix + "-column-item-label"
128
172
  }, item.label));
129
- })));
173
+ })), renderAccessible());
130
174
  };
131
175
 
132
176
  exports.Column = Column;
@@ -13,6 +13,7 @@
13
13
  user-select: none;
14
14
  touch-action: none;
15
15
  position: relative;
16
+ z-index: 0;
16
17
  }
17
18
 
18
19
  .adm-picker-view-column-wheel {
@@ -56,22 +57,61 @@
56
57
  white-space: nowrap;
57
58
  }
58
59
 
60
+ .adm-picker-view-column-accessible {
61
+ width: 100%;
62
+ height: 100%;
63
+ pointer-events: none;
64
+ opacity: 0;
65
+ display: flex;
66
+ flex-direction: column;
67
+ position: relative;
68
+ }
69
+
70
+ .adm-picker-view-column-accessible > * {
71
+ flex: 1;
72
+ text-overflow: ellipsis;
73
+ }
74
+
75
+ .adm-picker-view-column-accessible-current {
76
+ position: absolute;
77
+ width: 100%;
78
+ height: 100%;
79
+ }
80
+
81
+ .adm-picker-view-column-accessible-button {
82
+ width: 100%;
83
+ height: 100%;
84
+ }
85
+
59
86
  .adm-picker-view-mask {
60
87
  position: absolute;
88
+ z-index: 100;
61
89
  left: 0;
90
+ top: 0;
62
91
  width: 100%;
63
- height: calc(50% - 24px);
92
+ height: 100%;
93
+ display: flex;
94
+ flex-direction: column;
64
95
  pointer-events: none;
65
96
  }
66
97
 
67
- .adm-picker-view-mask-top {
68
- top: -10px;
98
+ .adm-picker-view-mask-top,
99
+ .adm-picker-view-mask-bottom {
100
+ flex: auto;
101
+ }
102
+
103
+ .adm-picker-view-mask-middle {
104
+ height: 68px;
105
+ box-sizing: border-box;
106
+ flex: none;
107
+ border-top: solid 2px var(--adm-border-color);
69
108
  border-bottom: solid 2px var(--adm-border-color);
109
+ }
110
+
111
+ .adm-picker-view-mask-top {
70
112
  background: linear-gradient(0deg, rgba(255, 255, 255, 0.7) 50%, #ffffff);
71
113
  }
72
114
 
73
115
  .adm-picker-view-mask-bottom {
74
- bottom: -10px;
75
- border-top: solid 2px var(--adm-border-color);
76
116
  background: linear-gradient(180deg, rgba(255, 255, 255, 0.7) 50%, #ffffff);
77
117
  }