antd-mobile 5.0.0-rc.2 → 5.0.0-rc.3
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/cjs/components/cascader-view/cascader-view.css +7 -4
- package/2x/cjs/components/cascader-view/index.d.ts +1 -1
- package/2x/cjs/components/cascader-view/index.js +3 -3
- package/2x/cjs/components/dropdown/dropdown.d.ts +11 -4
- package/2x/cjs/components/dropdown/dropdown.js +11 -10
- package/2x/cjs/components/dropdown/index.d.ts +13 -3
- package/2x/cjs/components/dropdown/index.js +8 -1
- package/2x/cjs/components/dropdown/item.d.ts +0 -1
- package/2x/cjs/components/form/form.d.ts +3 -0
- package/2x/cjs/components/form/form.js +3 -1
- package/2x/cjs/components/form/index.d.ts +1 -0
- package/2x/cjs/components/number-keyboard/number-keyboard.js +49 -29
- package/2x/cjs/components/toast/toast.css +1 -0
- package/2x/cjs/components/virtual-input/virtual-input.css +1 -1
- package/2x/cjs/components/virtual-input/virtual-input.js +29 -14
- package/2x/es/components/cascader-view/cascader-view.css +7 -4
- package/2x/es/components/cascader-view/index.d.ts +1 -1
- package/2x/es/components/cascader-view/index.js +1 -1
- package/2x/es/components/dropdown/dropdown.d.ts +11 -4
- package/2x/es/components/dropdown/dropdown.js +12 -11
- package/2x/es/components/dropdown/index.d.ts +13 -3
- package/2x/es/components/dropdown/index.js +5 -1
- package/2x/es/components/dropdown/item.d.ts +0 -1
- package/2x/es/components/form/form.d.ts +3 -0
- package/2x/es/components/form/form.js +3 -1
- package/2x/es/components/form/index.d.ts +1 -0
- package/2x/es/components/number-keyboard/number-keyboard.js +48 -29
- package/2x/es/components/toast/toast.css +1 -0
- package/2x/es/components/virtual-input/virtual-input.css +1 -1
- package/2x/es/components/virtual-input/virtual-input.js +30 -15
- package/2x/package.json +3 -3
- package/cjs/components/cascader-view/cascader-view.css +6 -4
- package/cjs/components/cascader-view/index.d.ts +1 -1
- package/cjs/components/cascader-view/index.js +3 -3
- package/cjs/components/dropdown/dropdown.d.ts +11 -4
- package/cjs/components/dropdown/dropdown.js +11 -10
- package/cjs/components/dropdown/index.d.ts +13 -3
- package/cjs/components/dropdown/index.js +8 -1
- package/cjs/components/dropdown/item.d.ts +0 -1
- package/cjs/components/form/form.d.ts +3 -0
- package/cjs/components/form/form.js +3 -1
- package/cjs/components/form/index.d.ts +1 -0
- package/cjs/components/number-keyboard/number-keyboard.js +49 -29
- package/cjs/components/toast/toast.css +1 -0
- package/cjs/components/virtual-input/virtual-input.css +1 -1
- package/cjs/components/virtual-input/virtual-input.js +29 -14
- package/es/components/cascader-view/cascader-view.css +6 -4
- package/es/components/cascader-view/index.d.ts +1 -1
- package/es/components/cascader-view/index.js +1 -1
- package/es/components/dropdown/dropdown.d.ts +11 -4
- package/es/components/dropdown/dropdown.js +12 -11
- package/es/components/dropdown/index.d.ts +13 -3
- package/es/components/dropdown/index.js +5 -1
- package/es/components/dropdown/item.d.ts +0 -1
- package/es/components/form/form.d.ts +3 -0
- package/es/components/form/form.js +3 -1
- package/es/components/form/index.d.ts +1 -0
- package/es/components/number-keyboard/number-keyboard.js +48 -29
- package/es/components/toast/toast.css +1 -0
- package/es/components/virtual-input/virtual-input.css +1 -1
- package/es/components/virtual-input/virtual-input.js +30 -15
- package/package.json +3 -3
- package/umd/antd-mobile.js +1 -1
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
--height: fit-content;
|
|
3
3
|
}
|
|
4
4
|
|
|
5
|
-
.adm-cascader-view-tabs {
|
|
5
|
+
.adm-cascader-view-tabs.adm-tabs {
|
|
6
6
|
--title-font-size: 28px;
|
|
7
7
|
--content-padding: none;
|
|
8
8
|
}
|
|
@@ -15,15 +15,18 @@
|
|
|
15
15
|
}
|
|
16
16
|
|
|
17
17
|
.adm-cascader-view-content {
|
|
18
|
-
--border-inner: none;
|
|
19
|
-
--border-bottom: none;
|
|
20
|
-
--border-top: none;
|
|
21
18
|
height: var(--height);
|
|
22
19
|
overflow-y: auto;
|
|
23
20
|
padding-top: 8px;
|
|
24
21
|
box-sizing: border-box;
|
|
25
22
|
}
|
|
26
23
|
|
|
24
|
+
.adm-cascader-view-content.adm-list {
|
|
25
|
+
--border-inner: none;
|
|
26
|
+
--border-bottom: none;
|
|
27
|
+
--border-top: none;
|
|
28
|
+
}
|
|
29
|
+
|
|
27
30
|
.adm-cascader-view-item {
|
|
28
31
|
font-size: 28px;
|
|
29
32
|
}
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { CascaderView } from './cascader-view';
|
|
2
1
|
import './cascader-view.less';
|
|
2
|
+
import { CascaderView } from './cascader-view';
|
|
3
3
|
export type { CascaderViewProps, CascaderValue, CascaderValueExtend, CascaderOption, } from './cascader-view';
|
|
4
4
|
export default CascaderView;
|
|
@@ -5,9 +5,9 @@ Object.defineProperty(exports, "__esModule", {
|
|
|
5
5
|
});
|
|
6
6
|
exports["default"] = void 0;
|
|
7
7
|
|
|
8
|
-
var _cascaderView = require("./cascader-view");
|
|
9
|
-
|
|
10
8
|
require("./cascader-view.css");
|
|
11
9
|
|
|
12
|
-
var
|
|
10
|
+
var _cascaderView2 = require("./cascader-view");
|
|
11
|
+
|
|
12
|
+
var _default = _cascaderView2.CascaderView;
|
|
13
13
|
exports["default"] = _default;
|
|
@@ -1,5 +1,4 @@
|
|
|
1
|
-
import React
|
|
2
|
-
import { DropdownItemProps } from './item';
|
|
1
|
+
import React from 'react';
|
|
3
2
|
import { NativeProps } from '../../utils/native-props';
|
|
4
3
|
export declare type DropdownProps = {
|
|
5
4
|
activeKey?: string | null;
|
|
@@ -7,7 +6,15 @@ export declare type DropdownProps = {
|
|
|
7
6
|
closeOnMaskClick?: boolean;
|
|
8
7
|
onChange?: (key: string | null) => void;
|
|
9
8
|
} & NativeProps;
|
|
10
|
-
declare
|
|
11
|
-
|
|
9
|
+
export declare type DropdownRef = {
|
|
10
|
+
close: () => void;
|
|
12
11
|
};
|
|
12
|
+
declare const Dropdown: React.ForwardRefExoticComponent<{
|
|
13
|
+
activeKey?: string | null | undefined;
|
|
14
|
+
defaultActiveKey?: string | null | undefined;
|
|
15
|
+
closeOnMaskClick?: boolean | undefined;
|
|
16
|
+
onChange?: ((key: string | null) => void) | undefined;
|
|
17
|
+
} & NativeProps<never> & {
|
|
18
|
+
children?: React.ReactNode;
|
|
19
|
+
} & React.RefAttributes<DropdownRef>>;
|
|
13
20
|
export default Dropdown;
|
|
@@ -13,7 +13,7 @@ var _react = _interopRequireWildcard(require("react"));
|
|
|
13
13
|
|
|
14
14
|
var _popup = _interopRequireDefault(require("../popup"));
|
|
15
15
|
|
|
16
|
-
var _item =
|
|
16
|
+
var _item = require("./item");
|
|
17
17
|
|
|
18
18
|
var _nativeProps = require("../../utils/native-props");
|
|
19
19
|
|
|
@@ -32,8 +32,7 @@ var defaultProps = {
|
|
|
32
32
|
defaultActiveKey: null,
|
|
33
33
|
closeOnMaskClick: true
|
|
34
34
|
};
|
|
35
|
-
|
|
36
|
-
var Dropdown = function Dropdown(p) {
|
|
35
|
+
var Dropdown = /*#__PURE__*/(0, _react.forwardRef)(function (p, ref) {
|
|
37
36
|
var _classNames;
|
|
38
37
|
|
|
39
38
|
var props = (0, _withDefaultProps.mergeProps)(defaultProps, p);
|
|
@@ -95,6 +94,13 @@ var Dropdown = function Dropdown(p) {
|
|
|
95
94
|
}
|
|
96
95
|
});
|
|
97
96
|
|
|
97
|
+
(0, _react.useImperativeHandle)(ref, function () {
|
|
98
|
+
return {
|
|
99
|
+
close: function close() {
|
|
100
|
+
setValue(null);
|
|
101
|
+
}
|
|
102
|
+
};
|
|
103
|
+
}, [setValue]);
|
|
98
104
|
return (0, _nativeProps.withNativeProps)(props, /*#__PURE__*/_react["default"].createElement("div", {
|
|
99
105
|
className: (0, _classnames["default"])(classPrefix, (_classNames = {}, _classNames[classPrefix + "-open"] = !!value, _classNames)),
|
|
100
106
|
ref: containerRef
|
|
@@ -122,14 +128,9 @@ var Dropdown = function Dropdown(p) {
|
|
|
122
128
|
key: item.key,
|
|
123
129
|
active: isActive,
|
|
124
130
|
forceRender: item.props.forceRender,
|
|
125
|
-
destroyOnClose: item.props.destroyOnClose
|
|
126
|
-
onClick: item.props.closeOnContentClick ? function () {
|
|
127
|
-
changeActive(null);
|
|
128
|
-
} : undefined
|
|
131
|
+
destroyOnClose: item.props.destroyOnClose
|
|
129
132
|
}, item.props.children);
|
|
130
133
|
})))));
|
|
131
|
-
};
|
|
132
|
-
|
|
133
|
-
Dropdown.Item = _item["default"];
|
|
134
|
+
});
|
|
134
135
|
var _default = Dropdown;
|
|
135
136
|
exports["default"] = _default;
|
|
@@ -1,5 +1,15 @@
|
|
|
1
|
+
/// <reference types="react" />
|
|
1
2
|
import './dropdown.less';
|
|
2
|
-
|
|
3
|
-
export type { DropdownProps } from './dropdown';
|
|
3
|
+
export type { DropdownProps, DropdownRef } from './dropdown';
|
|
4
4
|
export type { DropdownItemProps } from './item';
|
|
5
|
-
|
|
5
|
+
declare const _default: import("react").ForwardRefExoticComponent<{
|
|
6
|
+
activeKey?: string | null | undefined;
|
|
7
|
+
defaultActiveKey?: string | null | undefined;
|
|
8
|
+
closeOnMaskClick?: boolean | undefined;
|
|
9
|
+
onChange?: ((key: string | null) => void) | undefined;
|
|
10
|
+
} & import("../../utils/native-props").NativeProps<never> & {
|
|
11
|
+
children?: import("react").ReactNode;
|
|
12
|
+
} & import("react").RefAttributes<import("./dropdown").DropdownRef>> & {
|
|
13
|
+
Item: import("react").FC<import("./item").DropdownItemProps>;
|
|
14
|
+
};
|
|
15
|
+
export default _default;
|
|
@@ -9,7 +9,14 @@ require("./dropdown.css");
|
|
|
9
9
|
|
|
10
10
|
var _dropdown2 = _interopRequireDefault(require("./dropdown"));
|
|
11
11
|
|
|
12
|
+
var _attachPropertiesToComponent = require("../../utils/attach-properties-to-component");
|
|
13
|
+
|
|
14
|
+
var _item = _interopRequireDefault(require("./item"));
|
|
15
|
+
|
|
12
16
|
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { "default": obj }; }
|
|
13
17
|
|
|
14
|
-
var _default = _dropdown2["default"]
|
|
18
|
+
var _default = (0, _attachPropertiesToComponent.attachPropertiesToComponent)(_dropdown2["default"], {
|
|
19
|
+
Item: _item["default"]
|
|
20
|
+
});
|
|
21
|
+
|
|
15
22
|
exports["default"] = _default;
|
|
@@ -7,7 +7,6 @@ export declare type DropdownItemProps = {
|
|
|
7
7
|
highlight?: boolean;
|
|
8
8
|
forceRender?: boolean;
|
|
9
9
|
destroyOnClose?: boolean;
|
|
10
|
-
closeOnContentClick?: boolean;
|
|
11
10
|
onClick?: (event: React.MouseEvent<HTMLDivElement, MouseEvent>) => void;
|
|
12
11
|
} & NativeProps;
|
|
13
12
|
declare const Item: FC<DropdownItemProps>;
|
|
@@ -1,13 +1,16 @@
|
|
|
1
1
|
import React, { ReactNode } from 'react';
|
|
2
2
|
import { NativeProps } from '../../utils/native-props';
|
|
3
|
+
import { ListProps } from '../list';
|
|
3
4
|
import type { FormProps as RcFormProps, FormInstance } from 'rc-field-form';
|
|
4
5
|
import { FormContextType } from './context';
|
|
5
6
|
import type { FormLayout } from '.';
|
|
6
7
|
export declare type FormProps = RcFormProps & NativeProps & Partial<FormContextType> & {
|
|
7
8
|
footer?: ReactNode;
|
|
8
9
|
layout?: FormLayout;
|
|
10
|
+
mode?: ListProps['mode'];
|
|
9
11
|
};
|
|
10
12
|
export declare const Form: React.ForwardRefExoticComponent<RcFormProps<any> & NativeProps<never> & Partial<FormContextType> & {
|
|
11
13
|
footer?: ReactNode;
|
|
12
14
|
layout?: "horizontal" | "vertical" | undefined;
|
|
15
|
+
mode?: ListProps['mode'];
|
|
13
16
|
} & React.RefAttributes<FormInstance<any>>>;
|
|
@@ -50,13 +50,15 @@ var Form = /*#__PURE__*/(0, _react.forwardRef)(function (p, ref) {
|
|
|
50
50
|
children = props.children,
|
|
51
51
|
layout = props.layout,
|
|
52
52
|
footer = props.footer,
|
|
53
|
-
|
|
53
|
+
mode = props.mode,
|
|
54
|
+
formProps = __rest(props, ["className", "style", "hasFeedback", "children", "layout", "footer", "mode"]);
|
|
54
55
|
|
|
55
56
|
return /*#__PURE__*/_react["default"].createElement(_rcFieldForm["default"], Object.assign({
|
|
56
57
|
className: (0, _classnames["default"])(classPrefix, classPrefix + "-" + layout, className),
|
|
57
58
|
style: style,
|
|
58
59
|
ref: ref
|
|
59
60
|
}, formProps), /*#__PURE__*/_react["default"].createElement(_list["default"], {
|
|
61
|
+
mode: mode,
|
|
60
62
|
style: {
|
|
61
63
|
'--prefix-width': '6em',
|
|
62
64
|
'--align-items': 'stretch'
|
|
@@ -7,6 +7,7 @@ export type { FormInstance } from 'rc-field-form';
|
|
|
7
7
|
declare const _default: import("react").ForwardRefExoticComponent<import("rc-field-form").FormProps<any> & import("../../utils/native-props").NativeProps<never> & Partial<import("./context").FormContextType> & {
|
|
8
8
|
footer?: import("react").ReactNode;
|
|
9
9
|
layout?: "horizontal" | "vertical" | undefined;
|
|
10
|
+
mode?: "default" | "card" | undefined;
|
|
10
11
|
} & import("react").RefAttributes<import("rc-field-form").FormInstance<any>>> & {
|
|
11
12
|
Item: import("react").FC<import("./form-item").FormItemProps>;
|
|
12
13
|
useForm: typeof useForm;
|
|
@@ -21,6 +21,8 @@ var _nativeProps = require("../../utils/native-props");
|
|
|
21
21
|
|
|
22
22
|
var _safeArea = _interopRequireDefault(require("../safe-area"));
|
|
23
23
|
|
|
24
|
+
var _ahooks = require("ahooks");
|
|
25
|
+
|
|
24
26
|
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { "default": obj }; }
|
|
25
27
|
|
|
26
28
|
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); }
|
|
@@ -46,8 +48,7 @@ var NumberKeyboard = function NumberKeyboard(p) {
|
|
|
46
48
|
customKey = props.customKey,
|
|
47
49
|
randomOrder = props.randomOrder,
|
|
48
50
|
showCloseButton = props.showCloseButton,
|
|
49
|
-
onInput = props.onInput
|
|
50
|
-
onDelete = props.onDelete;
|
|
51
|
+
onInput = props.onInput;
|
|
51
52
|
var keyboardRef = (0, _react.useRef)(null);
|
|
52
53
|
var keys = (0, _react.useMemo)(function () {
|
|
53
54
|
var defaultKeys = ['1', '2', '3', '4', '5', '6', '7', '8', '9'];
|
|
@@ -65,31 +66,30 @@ var NumberKeyboard = function NumberKeyboard(p) {
|
|
|
65
66
|
}, [customKey, confirmText, randomOrder, randomOrder && visible]);
|
|
66
67
|
var timeoutRef = (0, _react.useRef)(-1);
|
|
67
68
|
var intervalRef = (0, _react.useRef)(-1);
|
|
69
|
+
var onDelete = (0, _ahooks.usePersistFn)(function () {
|
|
70
|
+
var _a;
|
|
71
|
+
|
|
72
|
+
(_a = props.onDelete) === null || _a === void 0 ? void 0 : _a.call(props);
|
|
73
|
+
});
|
|
68
74
|
|
|
69
|
-
var
|
|
70
|
-
if (!onDelete) return;
|
|
75
|
+
var onBackspacePressStart = function onBackspacePressStart() {
|
|
71
76
|
timeoutRef.current = window.setTimeout(function () {
|
|
72
77
|
onDelete();
|
|
73
78
|
intervalRef.current = window.setInterval(onDelete, 150);
|
|
74
|
-
},
|
|
79
|
+
}, 700);
|
|
75
80
|
};
|
|
76
81
|
|
|
77
|
-
var
|
|
82
|
+
var onBackspacePressEnd = function onBackspacePressEnd() {
|
|
78
83
|
clearTimeout(timeoutRef.current);
|
|
79
84
|
clearInterval(intervalRef.current);
|
|
80
|
-
};
|
|
81
|
-
|
|
82
|
-
var backSpaceEvents = {
|
|
83
|
-
onMouseDown: onStart,
|
|
84
|
-
onTouchStart: onStart,
|
|
85
|
-
onMouseUp: onEnd,
|
|
86
|
-
onMouseLeave: onEnd,
|
|
87
|
-
onTouchEnd: onEnd
|
|
88
85
|
}; // 点击键盘按键
|
|
89
86
|
|
|
90
|
-
|
|
87
|
+
|
|
88
|
+
var onKeyPress = function onKeyPress(e, key) {
|
|
91
89
|
var _a, _b;
|
|
92
90
|
|
|
91
|
+
e.preventDefault();
|
|
92
|
+
|
|
93
93
|
switch (key) {
|
|
94
94
|
case 'BACKSPACE':
|
|
95
95
|
onDelete === null || onDelete === void 0 ? void 0 : onDelete();
|
|
@@ -139,16 +139,27 @@ var NumberKeyboard = function NumberKeyboard(p) {
|
|
|
139
139
|
'sign-key': !isNumberKey && key,
|
|
140
140
|
'mid-key': index === 9 && !!confirmText
|
|
141
141
|
});
|
|
142
|
-
return /*#__PURE__*/_react["default"].createElement("div",
|
|
142
|
+
return /*#__PURE__*/_react["default"].createElement("div", {
|
|
143
143
|
key: key,
|
|
144
144
|
className: className,
|
|
145
|
-
|
|
146
|
-
|
|
147
|
-
|
|
148
|
-
|
|
145
|
+
onTouchStart: function onTouchStart() {
|
|
146
|
+
if (key === 'BACKSPACE') {
|
|
147
|
+
onBackspacePressStart();
|
|
148
|
+
}
|
|
149
|
+
},
|
|
150
|
+
onTouchEnd: function onTouchEnd(e) {
|
|
151
|
+
onKeyPress(e, key);
|
|
152
|
+
|
|
153
|
+
if (key === 'BACKSPACE') {
|
|
154
|
+
onBackspacePressEnd();
|
|
155
|
+
}
|
|
156
|
+
},
|
|
157
|
+
onMouseUp: function onMouseUp(e) {
|
|
158
|
+
onKeyPress(e, key);
|
|
159
|
+
},
|
|
149
160
|
title: key,
|
|
150
161
|
role: 'button'
|
|
151
|
-
}
|
|
162
|
+
}, key === 'BACKSPACE' ? /*#__PURE__*/_react["default"].createElement(_antdMobileIcons.TextDeletionOutline, null) : key);
|
|
152
163
|
};
|
|
153
164
|
|
|
154
165
|
return /*#__PURE__*/_react["default"].createElement(_popup["default"], {
|
|
@@ -173,18 +184,27 @@ var NumberKeyboard = function NumberKeyboard(p) {
|
|
|
173
184
|
})
|
|
174
185
|
}, keys.map(renderKey)), !!confirmText && /*#__PURE__*/_react["default"].createElement("div", {
|
|
175
186
|
className: classPrefix + "-confirm"
|
|
176
|
-
}, /*#__PURE__*/_react["default"].createElement("div",
|
|
187
|
+
}, /*#__PURE__*/_react["default"].createElement("div", {
|
|
177
188
|
className: classPrefix + "-key extra-key bs-key",
|
|
178
|
-
|
|
179
|
-
|
|
180
|
-
}
|
|
181
|
-
|
|
189
|
+
onTouchStart: function onTouchStart() {
|
|
190
|
+
onBackspacePressStart();
|
|
191
|
+
},
|
|
192
|
+
onTouchEnd: function onTouchEnd(e) {
|
|
193
|
+
onKeyPress(e, 'BACKSPACE');
|
|
194
|
+
onBackspacePressEnd();
|
|
195
|
+
},
|
|
196
|
+
onMouseUp: function onMouseUp(e) {
|
|
197
|
+
return onKeyPress(e, 'BACKSPACE');
|
|
198
|
+
},
|
|
182
199
|
title: 'BACKSPACE',
|
|
183
200
|
role: 'button'
|
|
184
|
-
}
|
|
201
|
+
}, /*#__PURE__*/_react["default"].createElement(_antdMobileIcons.TextDeletionOutline, null)), /*#__PURE__*/_react["default"].createElement("div", {
|
|
185
202
|
className: classPrefix + "-key extra-key ok-key",
|
|
186
|
-
|
|
187
|
-
return onKeyPress('OK');
|
|
203
|
+
onTouchEnd: function onTouchEnd(e) {
|
|
204
|
+
return onKeyPress(e, 'OK');
|
|
205
|
+
},
|
|
206
|
+
onMouseUp: function onMouseUp(e) {
|
|
207
|
+
return onKeyPress(e, 'OK');
|
|
188
208
|
},
|
|
189
209
|
role: 'button'
|
|
190
210
|
}, confirmText))), props.safeArea && /*#__PURE__*/_react["default"].createElement("div", {
|
|
@@ -40,10 +40,10 @@ var VirtualInput = /*#__PURE__*/(0, _react.forwardRef)(function (p, ref) {
|
|
|
40
40
|
var contentRef = (0, _react.useRef)(null);
|
|
41
41
|
|
|
42
42
|
var _useState = (0, _react.useState)(false),
|
|
43
|
-
|
|
44
|
-
|
|
43
|
+
hasFocus = _useState[0],
|
|
44
|
+
setHasFocus = _useState[1];
|
|
45
45
|
|
|
46
|
-
|
|
46
|
+
function scrollToEnd() {
|
|
47
47
|
var root = rootRef.current;
|
|
48
48
|
if (!root) return;
|
|
49
49
|
|
|
@@ -56,7 +56,16 @@ var VirtualInput = /*#__PURE__*/(0, _react.forwardRef)(function (p, ref) {
|
|
|
56
56
|
content.scrollTo({
|
|
57
57
|
left: content.clientWidth
|
|
58
58
|
});
|
|
59
|
+
}
|
|
60
|
+
|
|
61
|
+
(0, _react.useLayoutEffect)(function () {
|
|
62
|
+
scrollToEnd();
|
|
59
63
|
}, [value]);
|
|
64
|
+
(0, _react.useEffect)(function () {
|
|
65
|
+
if (hasFocus) {
|
|
66
|
+
scrollToEnd();
|
|
67
|
+
}
|
|
68
|
+
}, [hasFocus]);
|
|
60
69
|
(0, _react.useImperativeHandle)(ref, function () {
|
|
61
70
|
return {
|
|
62
71
|
focus: function focus() {
|
|
@@ -72,10 +81,17 @@ var VirtualInput = /*#__PURE__*/(0, _react.forwardRef)(function (p, ref) {
|
|
|
72
81
|
};
|
|
73
82
|
});
|
|
74
83
|
|
|
84
|
+
function onFocus() {
|
|
85
|
+
var _a;
|
|
86
|
+
|
|
87
|
+
setHasFocus(true);
|
|
88
|
+
(_a = props.onFocus) === null || _a === void 0 ? void 0 : _a.call(props);
|
|
89
|
+
}
|
|
90
|
+
|
|
75
91
|
function onBlur() {
|
|
76
92
|
var _a;
|
|
77
93
|
|
|
78
|
-
|
|
94
|
+
setHasFocus(false);
|
|
79
95
|
(_a = props.onBlur) === null || _a === void 0 ? void 0 : _a.call(props);
|
|
80
96
|
}
|
|
81
97
|
|
|
@@ -83,12 +99,7 @@ var VirtualInput = /*#__PURE__*/(0, _react.forwardRef)(function (p, ref) {
|
|
|
83
99
|
ref: rootRef,
|
|
84
100
|
className: (0, _classnames["default"])(classPrefix, (_classNames = {}, _classNames[classPrefix + "-disabled"] = props.disabled, _classNames)),
|
|
85
101
|
tabIndex: props.disabled ? undefined : 0,
|
|
86
|
-
onFocus:
|
|
87
|
-
var _a;
|
|
88
|
-
|
|
89
|
-
setKeyboardVisible(true);
|
|
90
|
-
(_a = props.onFocus) === null || _a === void 0 ? void 0 : _a.call(props);
|
|
91
|
-
},
|
|
102
|
+
onFocus: onFocus,
|
|
92
103
|
onBlur: onBlur,
|
|
93
104
|
onClick: props.onClick
|
|
94
105
|
}, /*#__PURE__*/_react["default"].createElement("div", {
|
|
@@ -96,9 +107,9 @@ var VirtualInput = /*#__PURE__*/(0, _react.forwardRef)(function (p, ref) {
|
|
|
96
107
|
ref: contentRef
|
|
97
108
|
}, value, /*#__PURE__*/_react["default"].createElement("div", {
|
|
98
109
|
className: classPrefix + "-caret-container"
|
|
99
|
-
}, /*#__PURE__*/_react["default"].createElement("div", {
|
|
110
|
+
}, hasFocus && /*#__PURE__*/_react["default"].createElement("div", {
|
|
100
111
|
className: classPrefix + "-caret"
|
|
101
|
-
}))), props.clearable && !!value && /*#__PURE__*/_react["default"].createElement("div", {
|
|
112
|
+
}))), props.clearable && !!value && hasFocus && /*#__PURE__*/_react["default"].createElement("div", {
|
|
102
113
|
className: classPrefix + "-clear",
|
|
103
114
|
onClick: function onClick() {
|
|
104
115
|
var _a;
|
|
@@ -115,8 +126,12 @@ var VirtualInput = /*#__PURE__*/(0, _react.forwardRef)(function (p, ref) {
|
|
|
115
126
|
onDelete: function onDelete() {
|
|
116
127
|
setValue(value.slice(0, -1));
|
|
117
128
|
},
|
|
118
|
-
visible:
|
|
119
|
-
onClose:
|
|
129
|
+
visible: hasFocus,
|
|
130
|
+
onClose: function onClose() {
|
|
131
|
+
var _a;
|
|
132
|
+
|
|
133
|
+
(_a = rootRef.current) === null || _a === void 0 ? void 0 : _a.blur();
|
|
134
|
+
}
|
|
120
135
|
})));
|
|
121
136
|
});
|
|
122
137
|
exports.VirtualInput = VirtualInput;
|
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
--height: fit-content;
|
|
3
3
|
}
|
|
4
4
|
|
|
5
|
-
.adm-cascader-view-tabs {
|
|
5
|
+
.adm-cascader-view-tabs.adm-tabs {
|
|
6
6
|
--title-font-size: 28px;
|
|
7
7
|
--content-padding: none;
|
|
8
8
|
}
|
|
@@ -15,15 +15,18 @@
|
|
|
15
15
|
}
|
|
16
16
|
|
|
17
17
|
.adm-cascader-view-content {
|
|
18
|
-
--border-inner: none;
|
|
19
|
-
--border-bottom: none;
|
|
20
|
-
--border-top: none;
|
|
21
18
|
height: var(--height);
|
|
22
19
|
overflow-y: auto;
|
|
23
20
|
padding-top: 8px;
|
|
24
21
|
box-sizing: border-box;
|
|
25
22
|
}
|
|
26
23
|
|
|
24
|
+
.adm-cascader-view-content.adm-list {
|
|
25
|
+
--border-inner: none;
|
|
26
|
+
--border-bottom: none;
|
|
27
|
+
--border-top: none;
|
|
28
|
+
}
|
|
29
|
+
|
|
27
30
|
.adm-cascader-view-item {
|
|
28
31
|
font-size: 28px;
|
|
29
32
|
}
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { CascaderView } from './cascader-view';
|
|
2
1
|
import './cascader-view.less';
|
|
2
|
+
import { CascaderView } from './cascader-view';
|
|
3
3
|
export type { CascaderViewProps, CascaderValue, CascaderValueExtend, CascaderOption, } from './cascader-view';
|
|
4
4
|
export default CascaderView;
|
|
@@ -1,5 +1,4 @@
|
|
|
1
|
-
import React
|
|
2
|
-
import { DropdownItemProps } from './item';
|
|
1
|
+
import React from 'react';
|
|
3
2
|
import { NativeProps } from '../../utils/native-props';
|
|
4
3
|
export declare type DropdownProps = {
|
|
5
4
|
activeKey?: string | null;
|
|
@@ -7,7 +6,15 @@ export declare type DropdownProps = {
|
|
|
7
6
|
closeOnMaskClick?: boolean;
|
|
8
7
|
onChange?: (key: string | null) => void;
|
|
9
8
|
} & NativeProps;
|
|
10
|
-
declare
|
|
11
|
-
|
|
9
|
+
export declare type DropdownRef = {
|
|
10
|
+
close: () => void;
|
|
12
11
|
};
|
|
12
|
+
declare const Dropdown: React.ForwardRefExoticComponent<{
|
|
13
|
+
activeKey?: string | null | undefined;
|
|
14
|
+
defaultActiveKey?: string | null | undefined;
|
|
15
|
+
closeOnMaskClick?: boolean | undefined;
|
|
16
|
+
onChange?: ((key: string | null) => void) | undefined;
|
|
17
|
+
} & NativeProps<never> & {
|
|
18
|
+
children?: React.ReactNode;
|
|
19
|
+
} & React.RefAttributes<DropdownRef>>;
|
|
13
20
|
export default Dropdown;
|
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
import { useClickAway } from 'ahooks';
|
|
2
2
|
import classNames from 'classnames';
|
|
3
|
-
import React, { cloneElement, useEffect, useRef, useState } from 'react';
|
|
3
|
+
import React, { cloneElement, useEffect, useRef, useState, forwardRef, useImperativeHandle } from 'react';
|
|
4
4
|
import Popup from '../popup';
|
|
5
|
-
import
|
|
5
|
+
import { ItemChildrenWrap } from './item';
|
|
6
6
|
import { withNativeProps } from '../../utils/native-props';
|
|
7
7
|
import { mergeProps } from '../../utils/with-default-props';
|
|
8
8
|
import { usePropsValue } from '../../utils/use-props-value';
|
|
@@ -11,8 +11,7 @@ var defaultProps = {
|
|
|
11
11
|
defaultActiveKey: null,
|
|
12
12
|
closeOnMaskClick: true
|
|
13
13
|
};
|
|
14
|
-
|
|
15
|
-
var Dropdown = function Dropdown(p) {
|
|
14
|
+
var Dropdown = /*#__PURE__*/forwardRef(function (p, ref) {
|
|
16
15
|
var _classNames;
|
|
17
16
|
|
|
18
17
|
var props = mergeProps(defaultProps, p);
|
|
@@ -72,6 +71,13 @@ var Dropdown = function Dropdown(p) {
|
|
|
72
71
|
return child;
|
|
73
72
|
}
|
|
74
73
|
});
|
|
74
|
+
useImperativeHandle(ref, function () {
|
|
75
|
+
return {
|
|
76
|
+
close: function close() {
|
|
77
|
+
setValue(null);
|
|
78
|
+
}
|
|
79
|
+
};
|
|
80
|
+
}, [setValue]);
|
|
75
81
|
return withNativeProps(props, /*#__PURE__*/React.createElement("div", {
|
|
76
82
|
className: classNames(classPrefix, (_classNames = {}, _classNames[classPrefix + "-open"] = !!value, _classNames)),
|
|
77
83
|
ref: containerRef
|
|
@@ -99,13 +105,8 @@ var Dropdown = function Dropdown(p) {
|
|
|
99
105
|
key: item.key,
|
|
100
106
|
active: isActive,
|
|
101
107
|
forceRender: item.props.forceRender,
|
|
102
|
-
destroyOnClose: item.props.destroyOnClose
|
|
103
|
-
onClick: item.props.closeOnContentClick ? function () {
|
|
104
|
-
changeActive(null);
|
|
105
|
-
} : undefined
|
|
108
|
+
destroyOnClose: item.props.destroyOnClose
|
|
106
109
|
}, item.props.children);
|
|
107
110
|
})))));
|
|
108
|
-
};
|
|
109
|
-
|
|
110
|
-
Dropdown.Item = Item;
|
|
111
|
+
});
|
|
111
112
|
export default Dropdown;
|
|
@@ -1,5 +1,15 @@
|
|
|
1
|
+
/// <reference types="react" />
|
|
1
2
|
import './dropdown.less';
|
|
2
|
-
|
|
3
|
-
export type { DropdownProps } from './dropdown';
|
|
3
|
+
export type { DropdownProps, DropdownRef } from './dropdown';
|
|
4
4
|
export type { DropdownItemProps } from './item';
|
|
5
|
-
|
|
5
|
+
declare const _default: import("react").ForwardRefExoticComponent<{
|
|
6
|
+
activeKey?: string | null | undefined;
|
|
7
|
+
defaultActiveKey?: string | null | undefined;
|
|
8
|
+
closeOnMaskClick?: boolean | undefined;
|
|
9
|
+
onChange?: ((key: string | null) => void) | undefined;
|
|
10
|
+
} & import("../../utils/native-props").NativeProps<never> & {
|
|
11
|
+
children?: import("react").ReactNode;
|
|
12
|
+
} & import("react").RefAttributes<import("./dropdown").DropdownRef>> & {
|
|
13
|
+
Item: import("react").FC<import("./item").DropdownItemProps>;
|
|
14
|
+
};
|
|
15
|
+
export default _default;
|
|
@@ -1,3 +1,7 @@
|
|
|
1
1
|
import "./dropdown.css";
|
|
2
2
|
import Dropdown from './dropdown';
|
|
3
|
-
|
|
3
|
+
import { attachPropertiesToComponent } from '../../utils/attach-properties-to-component';
|
|
4
|
+
import Item from './item';
|
|
5
|
+
export default attachPropertiesToComponent(Dropdown, {
|
|
6
|
+
Item: Item
|
|
7
|
+
});
|
|
@@ -7,7 +7,6 @@ export declare type DropdownItemProps = {
|
|
|
7
7
|
highlight?: boolean;
|
|
8
8
|
forceRender?: boolean;
|
|
9
9
|
destroyOnClose?: boolean;
|
|
10
|
-
closeOnContentClick?: boolean;
|
|
11
10
|
onClick?: (event: React.MouseEvent<HTMLDivElement, MouseEvent>) => void;
|
|
12
11
|
} & NativeProps;
|
|
13
12
|
declare const Item: FC<DropdownItemProps>;
|
|
@@ -1,13 +1,16 @@
|
|
|
1
1
|
import React, { ReactNode } from 'react';
|
|
2
2
|
import { NativeProps } from '../../utils/native-props';
|
|
3
|
+
import { ListProps } from '../list';
|
|
3
4
|
import type { FormProps as RcFormProps, FormInstance } from 'rc-field-form';
|
|
4
5
|
import { FormContextType } from './context';
|
|
5
6
|
import type { FormLayout } from '.';
|
|
6
7
|
export declare type FormProps = RcFormProps & NativeProps & Partial<FormContextType> & {
|
|
7
8
|
footer?: ReactNode;
|
|
8
9
|
layout?: FormLayout;
|
|
10
|
+
mode?: ListProps['mode'];
|
|
9
11
|
};
|
|
10
12
|
export declare const Form: React.ForwardRefExoticComponent<RcFormProps<any> & NativeProps<never> & Partial<FormContextType> & {
|
|
11
13
|
footer?: ReactNode;
|
|
12
14
|
layout?: "horizontal" | "vertical" | undefined;
|
|
15
|
+
mode?: ListProps['mode'];
|
|
13
16
|
} & React.RefAttributes<FormInstance<any>>>;
|
|
@@ -31,13 +31,15 @@ export var Form = /*#__PURE__*/forwardRef(function (p, ref) {
|
|
|
31
31
|
children = props.children,
|
|
32
32
|
layout = props.layout,
|
|
33
33
|
footer = props.footer,
|
|
34
|
-
|
|
34
|
+
mode = props.mode,
|
|
35
|
+
formProps = __rest(props, ["className", "style", "hasFeedback", "children", "layout", "footer", "mode"]);
|
|
35
36
|
|
|
36
37
|
return /*#__PURE__*/React.createElement(RcForm, Object.assign({
|
|
37
38
|
className: classNames(classPrefix, classPrefix + "-" + layout, className),
|
|
38
39
|
style: style,
|
|
39
40
|
ref: ref
|
|
40
41
|
}, formProps), /*#__PURE__*/React.createElement(List, {
|
|
42
|
+
mode: mode,
|
|
41
43
|
style: {
|
|
42
44
|
'--prefix-width': '6em',
|
|
43
45
|
'--align-items': 'stretch'
|