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,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;
|
|
@@ -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;
|
|
@@ -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
|
}
|
|
@@ -77,9 +77,13 @@ var PickerView = /*#__PURE__*/(0, _react.memo)(function (p) {
|
|
|
77
77
|
}
|
|
78
78
|
});
|
|
79
79
|
}), /*#__PURE__*/_react["default"].createElement("div", {
|
|
80
|
-
className: classPrefix + "-mask
|
|
80
|
+
className: classPrefix + "-mask"
|
|
81
|
+
}, /*#__PURE__*/_react["default"].createElement("div", {
|
|
82
|
+
className: classPrefix + "-mask-top"
|
|
81
83
|
}), /*#__PURE__*/_react["default"].createElement("div", {
|
|
82
|
-
className: classPrefix + "-mask
|
|
83
|
-
})
|
|
84
|
+
className: classPrefix + "-mask-middle"
|
|
85
|
+
}), /*#__PURE__*/_react["default"].createElement("div", {
|
|
86
|
+
className: classPrefix + "-mask-bottom"
|
|
87
|
+
}))));
|
|
84
88
|
});
|
|
85
89
|
exports.PickerView = PickerView;
|
|
@@ -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;
|
|
@@ -4,6 +4,7 @@ Object.defineProperty(exports, "__esModule", {
|
|
|
4
4
|
value: true
|
|
5
5
|
});
|
|
6
6
|
exports.clear = clear;
|
|
7
|
+
exports.config = config;
|
|
7
8
|
exports.show = show;
|
|
8
9
|
|
|
9
10
|
var _react = _interopRequireWildcard(require("react"));
|
|
@@ -33,7 +34,9 @@ function unmount(container) {
|
|
|
33
34
|
}
|
|
34
35
|
|
|
35
36
|
var defaultProps = {
|
|
36
|
-
duration: 2000
|
|
37
|
+
duration: 2000,
|
|
38
|
+
position: 'center',
|
|
39
|
+
maskClickable: true
|
|
37
40
|
};
|
|
38
41
|
|
|
39
42
|
function show(p) {
|
|
@@ -95,4 +98,18 @@ function clear() {
|
|
|
95
98
|
if (!container) break;
|
|
96
99
|
unmount(container);
|
|
97
100
|
}
|
|
101
|
+
}
|
|
102
|
+
|
|
103
|
+
function config(val) {
|
|
104
|
+
if (val.duration !== undefined) {
|
|
105
|
+
defaultProps.duration = val.duration;
|
|
106
|
+
}
|
|
107
|
+
|
|
108
|
+
if (val.position !== undefined) {
|
|
109
|
+
defaultProps.position = val.position;
|
|
110
|
+
}
|
|
111
|
+
|
|
112
|
+
if (val.maskClickable !== undefined) {
|
|
113
|
+
defaultProps.maskClickable = val.maskClickable;
|
|
114
|
+
}
|
|
98
115
|
}
|
package/cjs/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/cjs/index.js
CHANGED
|
@@ -249,6 +249,12 @@ Object.defineProperty(exports, "PageIndicator", {
|
|
|
249
249
|
return _pageIndicator["default"];
|
|
250
250
|
}
|
|
251
251
|
});
|
|
252
|
+
Object.defineProperty(exports, "PasscodeInput", {
|
|
253
|
+
enumerable: true,
|
|
254
|
+
get: function get() {
|
|
255
|
+
return _passcodeInput["default"];
|
|
256
|
+
}
|
|
257
|
+
});
|
|
252
258
|
Object.defineProperty(exports, "Picker", {
|
|
253
259
|
enumerable: true,
|
|
254
260
|
get: function get() {
|
|
@@ -586,6 +592,8 @@ var _virtualInput = _interopRequireDefault(require("./components/virtual-input")
|
|
|
586
592
|
|
|
587
593
|
var _waterMark = _interopRequireDefault(require("./components/water-mark"));
|
|
588
594
|
|
|
595
|
+
var _passcodeInput = _interopRequireDefault(require("./components/passcode-input"));
|
|
596
|
+
|
|
589
597
|
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { "default": obj }; }
|
|
590
598
|
|
|
591
599
|
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); }
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, "__esModule", {
|
|
4
|
+
value: true
|
|
5
|
+
});
|
|
6
|
+
exports.memoWithEventMarks = memoWithEventMarks;
|
|
7
|
+
|
|
8
|
+
var _react = require("react");
|
|
9
|
+
|
|
10
|
+
function memoWithEventMarks(Component, eventProps) {
|
|
11
|
+
return /*#__PURE__*/(0, _react.memo)(Component, function (prevProps, nextProps) {
|
|
12
|
+
for (var k in nextProps) {
|
|
13
|
+
var key = k;
|
|
14
|
+
if (eventProps.includes(key)) continue;
|
|
15
|
+
|
|
16
|
+
if (prevProps[key] !== nextProps[key]) {
|
|
17
|
+
return false;
|
|
18
|
+
}
|
|
19
|
+
}
|
|
20
|
+
|
|
21
|
+
return true;
|
|
22
|
+
});
|
|
23
|
+
}
|
|
@@ -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;
|
|
@@ -142,7 +142,7 @@ export var Collapse = function Collapse(props) {
|
|
|
142
142
|
arrow = panel.props.arrow;
|
|
143
143
|
}
|
|
144
144
|
|
|
145
|
-
return /*#__PURE__*/React.createElement("div", {
|
|
145
|
+
return typeof arrow === 'function' ? arrow(active) : /*#__PURE__*/React.createElement("div", {
|
|
146
146
|
className: classNames(classPrefix + "-arrow", (_classNames = {}, _classNames[classPrefix + "-arrow-active"] = active, _classNames))
|
|
147
147
|
}, arrow);
|
|
148
148
|
};
|
|
@@ -38,6 +38,7 @@ import Mask from '../mask';
|
|
|
38
38
|
import { DialogActionButton } from './dialog-action-button';
|
|
39
39
|
import Image from '../image';
|
|
40
40
|
import Space from '../space';
|
|
41
|
+
import { renderToContainer } from '../../utils/render-to-container';
|
|
41
42
|
import { withStopPropagation } from '../../utils/with-stop-propagation';
|
|
42
43
|
import AutoCenter from '../auto-center';
|
|
43
44
|
import { useSpring, animated } from '@react-spring/web';
|
|
@@ -48,7 +49,8 @@ var defaultProps = {
|
|
|
48
49
|
actions: [],
|
|
49
50
|
closeOnAction: false,
|
|
50
51
|
closeOnMaskClick: false,
|
|
51
|
-
stopPropagation: ['click']
|
|
52
|
+
stopPropagation: ['click'],
|
|
53
|
+
getContainer: null
|
|
52
54
|
};
|
|
53
55
|
export var Dialog = function Dialog(p) {
|
|
54
56
|
var props = mergeProps(defaultProps, p);
|
|
@@ -81,14 +83,13 @@ export var Dialog = function Dialog(p) {
|
|
|
81
83
|
active = _useState[0],
|
|
82
84
|
setActive = _useState[1];
|
|
83
85
|
|
|
84
|
-
|
|
86
|
+
var node = withNativeProps(props, /*#__PURE__*/React.createElement("div", {
|
|
85
87
|
className: classPrefix,
|
|
86
88
|
style: {
|
|
87
89
|
display: active ? 'unset' : 'none'
|
|
88
90
|
}
|
|
89
91
|
}, /*#__PURE__*/React.createElement(Mask, {
|
|
90
92
|
visible: props.visible,
|
|
91
|
-
getContainer: props.getContainer,
|
|
92
93
|
onMaskClick: props.closeOnMaskClick ? props.onClose : undefined,
|
|
93
94
|
style: props.maskStyle,
|
|
94
95
|
className: classNames(classPrefix + "-mask", props.maskClassName)
|
|
@@ -158,5 +159,6 @@ export var Dialog = function Dialog(p) {
|
|
|
158
159
|
}
|
|
159
160
|
});
|
|
160
161
|
}));
|
|
161
|
-
}))))))
|
|
162
|
+
}))))));
|
|
163
|
+
return renderToContainer(props.getContainer, withStopPropagation(props.stopPropagation, node));
|
|
162
164
|
};
|
|
@@ -10,9 +10,6 @@
|
|
|
10
10
|
overflow: hidden;
|
|
11
11
|
font-size: 17px;
|
|
12
12
|
}
|
|
13
|
-
.adm-list-inner {
|
|
14
|
-
margin-bottom: -1px;
|
|
15
|
-
}
|
|
16
13
|
.adm-list-default {
|
|
17
14
|
border-top: var(--border-top);
|
|
18
15
|
border-bottom: var(--border-bottom);
|
|
@@ -22,9 +19,13 @@
|
|
|
22
19
|
border-radius: 8px;
|
|
23
20
|
}
|
|
24
21
|
.adm-list-item {
|
|
22
|
+
margin-bottom: -1px;
|
|
25
23
|
display: block;
|
|
26
24
|
padding-left: var(--padding-left);
|
|
27
25
|
}
|
|
26
|
+
.adm-list-item:not(:first-child) {
|
|
27
|
+
padding-top: 1px;
|
|
28
|
+
}
|
|
28
29
|
.adm-list-item-title,
|
|
29
30
|
.adm-list-item-description {
|
|
30
31
|
color: var(--adm-color-weak);
|
|
@@ -10,7 +10,5 @@ export var List = function List(p) {
|
|
|
10
10
|
var props = mergeProps(defaultProps, p);
|
|
11
11
|
return withNativeProps(props, /*#__PURE__*/React.createElement("div", {
|
|
12
12
|
className: classNames(classPrefix, classPrefix + "-" + props.mode)
|
|
13
|
-
},
|
|
14
|
-
className: classPrefix + "-inner"
|
|
15
|
-
}, props.children)));
|
|
13
|
+
}, props.children));
|
|
16
14
|
};
|
|
@@ -3,8 +3,7 @@
|
|
|
3
3
|
flex-wrap: wrap;
|
|
4
4
|
flex: 1;
|
|
5
5
|
}
|
|
6
|
-
.adm-number-keyboard.confirmed-style {
|
|
7
|
-
width: 75%;
|
|
6
|
+
.adm-number-keyboard-main.confirmed-style .sign-key {
|
|
8
7
|
background-color: var(--adm-color-white);
|
|
9
8
|
}
|
|
10
9
|
.adm-number-keyboard-popup.adm-popup {
|
|
@@ -105,6 +104,7 @@
|
|
|
105
104
|
color: var(--adm-color-white);
|
|
106
105
|
height: 144px;
|
|
107
106
|
font-size: 16px;
|
|
107
|
+
border: none;
|
|
108
108
|
}
|
|
109
109
|
.adm-number-keyboard-bs-key {
|
|
110
110
|
height: 20px;
|