antd-mobile 5.36.1 → 5.37.0
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/bundle/antd-mobile.cjs.development.js +355 -283
- package/2x/bundle/antd-mobile.cjs.js +7 -7
- package/2x/bundle/antd-mobile.es.development.js +355 -283
- package/2x/bundle/antd-mobile.es.js +5428 -5379
- package/2x/bundle/antd-mobile.umd.development.js +355 -283
- package/2x/bundle/antd-mobile.umd.js +7 -7
- package/2x/bundle/style.css +5 -8
- package/2x/cjs/components/card/card.css +5 -5
- package/2x/cjs/components/card/card.patch.css +21 -0
- package/2x/cjs/components/center-popup/center-popup.js +46 -43
- package/2x/cjs/components/check-list/check-list.js +15 -11
- package/2x/cjs/components/collapse/collapse.d.ts +9 -1
- package/2x/cjs/components/collapse/collapse.js +26 -28
- package/2x/cjs/components/config-provider/config-provider.d.ts +40 -2
- package/2x/cjs/components/dropdown/context.d.ts +2 -0
- package/2x/cjs/components/dropdown/context.js +10 -0
- package/2x/cjs/components/dropdown/dropdown.d.ts +11 -3
- package/2x/cjs/components/dropdown/dropdown.js +23 -16
- package/2x/cjs/components/dropdown/index.d.ts +1 -0
- package/2x/cjs/components/dropdown/item.d.ts +5 -1
- package/2x/cjs/components/dropdown/item.js +22 -8
- package/2x/cjs/components/form/form-item.d.ts +6 -5
- package/2x/cjs/components/form/form-item.js +25 -17
- package/2x/cjs/components/form/form.d.ts +1 -1
- package/2x/cjs/components/form/index.d.ts +1 -1
- package/2x/cjs/components/input/input.d.ts +3 -1
- package/2x/cjs/components/input/input.js +53 -51
- package/2x/cjs/components/list/list-item.d.ts +6 -2
- package/2x/cjs/components/list/list-item.js +16 -6
- package/2x/cjs/components/nav-bar/nav-bar.d.ts +4 -0
- package/2x/cjs/components/nav-bar/nav-bar.js +18 -13
- package/2x/cjs/components/notice-bar/notice-bar.css +0 -3
- package/2x/cjs/components/notice-bar/notice-bar.d.ts +3 -1
- package/2x/cjs/components/notice-bar/notice-bar.js +30 -25
- package/2x/cjs/components/number-keyboard/number-keyboard.d.ts +1 -1
- package/2x/cjs/components/number-keyboard/number-keyboard.js +14 -13
- package/2x/cjs/components/popup/popup-base-props.d.ts +3 -2
- package/2x/cjs/components/popup/popup-base-props.js +4 -0
- package/2x/cjs/components/popup/popup.js +5 -5
- package/2x/cjs/components/result/result.js +3 -10
- package/2x/cjs/components/result/use-result-icon.d.ts +3 -0
- package/2x/cjs/components/result/use-result-icon.js +37 -0
- package/2x/cjs/components/result-page/result-page.js +3 -10
- package/2x/cjs/components/search-bar/search-bar.d.ts +10 -2
- package/2x/cjs/components/search-bar/search-bar.js +34 -33
- package/2x/cjs/components/toast/toast.d.ts +2 -2
- package/2x/cjs/components/toast/toast.js +4 -4
- package/2x/cjs/components/virtual-input/virtual-input.d.ts +5 -5
- package/2x/cjs/components/virtual-input/virtual-input.js +26 -24
- package/2x/cjs/utils/is-node-with-content.d.ts +3 -0
- package/2x/cjs/utils/is-node-with-content.js +3 -0
- package/2x/cjs/utils/with-default-props.d.ts +7 -0
- package/2x/cjs/utils/with-default-props.js +21 -5
- package/2x/es/components/card/card.css +5 -5
- package/2x/es/components/card/card.patch.css +21 -0
- package/2x/es/components/center-popup/center-popup.js +45 -42
- package/2x/es/components/check-list/check-list.js +15 -11
- package/2x/es/components/collapse/collapse.d.ts +9 -1
- package/2x/es/components/collapse/collapse.js +26 -28
- package/2x/es/components/config-provider/config-provider.d.ts +40 -2
- package/2x/es/components/dropdown/context.d.ts +2 -0
- package/2x/es/components/dropdown/context.js +2 -0
- package/2x/es/components/dropdown/dropdown.d.ts +11 -3
- package/2x/es/components/dropdown/dropdown.js +24 -17
- package/2x/es/components/dropdown/index.d.ts +1 -0
- package/2x/es/components/dropdown/item.d.ts +5 -1
- package/2x/es/components/dropdown/item.js +22 -8
- package/2x/es/components/form/form-item.d.ts +6 -5
- package/2x/es/components/form/form-item.js +24 -16
- package/2x/es/components/form/form.d.ts +1 -1
- package/2x/es/components/form/index.d.ts +1 -1
- package/2x/es/components/input/input.d.ts +3 -1
- package/2x/es/components/input/input.js +52 -50
- package/2x/es/components/list/list-item.d.ts +6 -2
- package/2x/es/components/list/list-item.js +16 -6
- package/2x/es/components/nav-bar/nav-bar.d.ts +4 -0
- package/2x/es/components/nav-bar/nav-bar.js +18 -13
- package/2x/es/components/notice-bar/notice-bar.css +0 -3
- package/2x/es/components/notice-bar/notice-bar.d.ts +3 -1
- package/2x/es/components/notice-bar/notice-bar.js +29 -24
- package/2x/es/components/number-keyboard/number-keyboard.d.ts +1 -1
- package/2x/es/components/number-keyboard/number-keyboard.js +13 -12
- package/2x/es/components/popup/popup-base-props.d.ts +3 -2
- package/2x/es/components/popup/popup-base-props.js +3 -0
- package/2x/es/components/popup/popup.js +5 -5
- package/2x/es/components/result/result.js +3 -10
- package/2x/es/components/result/use-result-icon.d.ts +3 -0
- package/2x/es/components/result/use-result-icon.js +29 -0
- package/2x/es/components/result-page/result-page.js +3 -10
- package/2x/es/components/search-bar/search-bar.d.ts +10 -2
- package/2x/es/components/search-bar/search-bar.js +33 -32
- package/2x/es/components/toast/toast.d.ts +2 -2
- package/2x/es/components/toast/toast.js +3 -3
- package/2x/es/components/virtual-input/virtual-input.d.ts +5 -5
- package/2x/es/components/virtual-input/virtual-input.js +25 -23
- package/2x/es/utils/is-node-with-content.d.ts +3 -0
- package/2x/es/utils/is-node-with-content.js +3 -0
- package/2x/es/utils/with-default-props.d.ts +7 -0
- package/2x/es/utils/with-default-props.js +20 -5
- package/2x/package.json +1 -1
- package/bundle/antd-mobile.cjs.development.js +355 -283
- package/bundle/antd-mobile.cjs.js +7 -7
- package/bundle/antd-mobile.compatible.umd.js +1 -1
- package/bundle/antd-mobile.es.development.js +355 -283
- package/bundle/antd-mobile.es.js +5428 -5379
- package/bundle/antd-mobile.umd.development.js +355 -283
- package/bundle/antd-mobile.umd.js +7 -7
- package/bundle/style.css +1 -1
- package/cjs/components/card/card.css +5 -5
- package/cjs/components/card/card.patch.css +17 -0
- package/cjs/components/center-popup/center-popup.js +46 -43
- package/cjs/components/check-list/check-list.js +15 -11
- package/cjs/components/collapse/collapse.d.ts +9 -1
- package/cjs/components/collapse/collapse.js +26 -28
- package/cjs/components/config-provider/config-provider.d.ts +40 -2
- package/cjs/components/dropdown/context.d.ts +2 -0
- package/cjs/components/dropdown/context.js +10 -0
- package/cjs/components/dropdown/dropdown.d.ts +11 -3
- package/cjs/components/dropdown/dropdown.js +23 -16
- package/cjs/components/dropdown/index.d.ts +1 -0
- package/cjs/components/dropdown/item.d.ts +5 -1
- package/cjs/components/dropdown/item.js +22 -8
- package/cjs/components/form/form-item.d.ts +6 -5
- package/cjs/components/form/form-item.js +25 -17
- package/cjs/components/form/form.d.ts +1 -1
- package/cjs/components/form/index.d.ts +1 -1
- package/cjs/components/input/input.d.ts +3 -1
- package/cjs/components/input/input.js +53 -51
- package/cjs/components/list/list-item.d.ts +6 -2
- package/cjs/components/list/list-item.js +16 -6
- package/cjs/components/nav-bar/nav-bar.d.ts +4 -0
- package/cjs/components/nav-bar/nav-bar.js +18 -13
- package/cjs/components/notice-bar/notice-bar.css +0 -2
- package/cjs/components/notice-bar/notice-bar.d.ts +3 -1
- package/cjs/components/notice-bar/notice-bar.js +30 -25
- package/cjs/components/number-keyboard/number-keyboard.d.ts +1 -1
- package/cjs/components/number-keyboard/number-keyboard.js +14 -13
- package/cjs/components/popup/popup-base-props.d.ts +3 -2
- package/cjs/components/popup/popup-base-props.js +4 -0
- package/cjs/components/popup/popup.js +5 -5
- package/cjs/components/result/result.js +3 -10
- package/cjs/components/result/use-result-icon.d.ts +3 -0
- package/cjs/components/result/use-result-icon.js +37 -0
- package/cjs/components/result-page/result-page.js +3 -10
- package/cjs/components/search-bar/search-bar.d.ts +10 -2
- package/cjs/components/search-bar/search-bar.js +34 -33
- package/cjs/components/toast/toast.css +1 -1
- package/cjs/components/toast/toast.d.ts +2 -2
- package/cjs/components/toast/toast.js +4 -4
- package/cjs/components/virtual-input/virtual-input.d.ts +5 -5
- package/cjs/components/virtual-input/virtual-input.js +26 -24
- package/cjs/utils/is-node-with-content.d.ts +3 -0
- package/cjs/utils/is-node-with-content.js +3 -0
- package/cjs/utils/with-default-props.d.ts +7 -0
- package/cjs/utils/with-default-props.js +21 -5
- package/es/components/card/card.css +5 -5
- package/es/components/card/card.patch.css +17 -0
- package/es/components/center-popup/center-popup.js +45 -42
- package/es/components/check-list/check-list.js +15 -11
- package/es/components/collapse/collapse.d.ts +9 -1
- package/es/components/collapse/collapse.js +26 -28
- package/es/components/config-provider/config-provider.d.ts +40 -2
- package/es/components/dropdown/context.d.ts +2 -0
- package/es/components/dropdown/context.js +2 -0
- package/es/components/dropdown/dropdown.d.ts +11 -3
- package/es/components/dropdown/dropdown.js +24 -17
- package/es/components/dropdown/index.d.ts +1 -0
- package/es/components/dropdown/item.d.ts +5 -1
- package/es/components/dropdown/item.js +22 -8
- package/es/components/form/form-item.d.ts +6 -5
- package/es/components/form/form-item.js +24 -16
- package/es/components/form/form.d.ts +1 -1
- package/es/components/form/index.d.ts +1 -1
- package/es/components/input/input.d.ts +3 -1
- package/es/components/input/input.js +52 -50
- package/es/components/list/list-item.d.ts +6 -2
- package/es/components/list/list-item.js +16 -6
- package/es/components/nav-bar/nav-bar.d.ts +4 -0
- package/es/components/nav-bar/nav-bar.js +18 -13
- package/es/components/notice-bar/notice-bar.css +0 -2
- package/es/components/notice-bar/notice-bar.d.ts +3 -1
- package/es/components/notice-bar/notice-bar.js +29 -24
- package/es/components/number-keyboard/number-keyboard.d.ts +1 -1
- package/es/components/number-keyboard/number-keyboard.js +13 -12
- package/es/components/popup/popup-base-props.d.ts +3 -2
- package/es/components/popup/popup-base-props.js +3 -0
- package/es/components/popup/popup.js +5 -5
- package/es/components/result/result.js +3 -10
- package/es/components/result/use-result-icon.d.ts +3 -0
- package/es/components/result/use-result-icon.js +29 -0
- package/es/components/result-page/result-page.js +3 -10
- package/es/components/search-bar/search-bar.d.ts +10 -2
- package/es/components/search-bar/search-bar.js +33 -32
- package/es/components/toast/toast.css +1 -1
- package/es/components/toast/toast.d.ts +2 -2
- package/es/components/toast/toast.js +3 -3
- package/es/components/virtual-input/virtual-input.d.ts +5 -5
- package/es/components/virtual-input/virtual-input.js +25 -23
- package/es/utils/is-node-with-content.d.ts +3 -0
- package/es/utils/is-node-with-content.js +3 -0
- package/es/utils/with-default-props.d.ts +7 -0
- package/es/utils/with-default-props.js +20 -5
- package/package.json +1 -1
- package/umd/antd-mobile.js +1 -1
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
.adm-card {
|
|
2
2
|
background: var(--adm-color-background);
|
|
3
|
-
border-radius: 8px;
|
|
4
|
-
padding: 0 12px;
|
|
3
|
+
border-radius: var(--adm-card-border-radius, 8px);
|
|
4
|
+
padding: 0 var(--adm-card-padding-inline, 12px);
|
|
5
5
|
}
|
|
6
6
|
.adm-card-header {
|
|
7
7
|
position: relative;
|
|
@@ -9,10 +9,10 @@
|
|
|
9
9
|
justify-content: space-between;
|
|
10
10
|
align-items: center;
|
|
11
11
|
box-sizing: border-box;
|
|
12
|
-
padding: 12px 0;
|
|
12
|
+
padding: var(--adm-card-header-padding-block, 12px) 0;
|
|
13
13
|
}
|
|
14
14
|
.adm-card-header:not(:last-child) {
|
|
15
|
-
border-bottom: solid 0.5px var(--adm-color-border);
|
|
15
|
+
border-bottom: solid var(--adm-card-header-border-width, 0.5px) var(--adm-card-header-border-color, var(--adm-color-border));
|
|
16
16
|
}
|
|
17
17
|
.adm-card-header-title {
|
|
18
18
|
font-size: var(--adm-font-size-7);
|
|
@@ -20,5 +20,5 @@
|
|
|
20
20
|
font-weight: bold;
|
|
21
21
|
}
|
|
22
22
|
.adm-card-body {
|
|
23
|
-
padding: 12px 0;
|
|
23
|
+
padding: var(--adm-card-body-padding-block, 12px) 0;
|
|
24
24
|
}
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
.adm-card {
|
|
2
|
+
background: #fff;
|
|
3
|
+
border-radius: 8px;
|
|
4
|
+
padding: 0 12px;
|
|
5
|
+
}
|
|
6
|
+
.adm-card-header {
|
|
7
|
+
padding: 12px 0;
|
|
8
|
+
}
|
|
9
|
+
.adm-card-header:not(:last-child) {
|
|
10
|
+
border-bottom: solid 0.5px #eee;
|
|
11
|
+
}
|
|
12
|
+
.adm-card-header-title {
|
|
13
|
+
font-size: 15px;
|
|
14
|
+
}
|
|
15
|
+
.adm-card-body {
|
|
16
|
+
padding: 12px 0;
|
|
17
|
+
}
|
|
@@ -4,33 +4,36 @@ Object.defineProperty(exports, "__esModule", {
|
|
|
4
4
|
value: true
|
|
5
5
|
});
|
|
6
6
|
exports.CenterPopup = void 0;
|
|
7
|
-
var _react = _interopRequireWildcard(require("react"));
|
|
8
|
-
var _renderToContainer = require("../../utils/render-to-container");
|
|
9
|
-
var _mask = _interopRequireDefault(require("../mask"));
|
|
10
|
-
var _withStopPropagation = require("../../utils/with-stop-propagation");
|
|
11
|
-
var _withDefaultProps = require("../../utils/with-default-props");
|
|
12
|
-
var _ahooks = require("ahooks");
|
|
13
7
|
var _web = require("@react-spring/web");
|
|
14
|
-
var
|
|
8
|
+
var _ahooks = require("ahooks");
|
|
15
9
|
var _classnames = _interopRequireDefault(require("classnames"));
|
|
10
|
+
var _react = _interopRequireWildcard(require("react"));
|
|
16
11
|
var _nativeProps = require("../../utils/native-props");
|
|
12
|
+
var _renderToContainer = require("../../utils/render-to-container");
|
|
17
13
|
var _shouldRender = require("../../utils/should-render");
|
|
14
|
+
var _useInnerVisible = require("../../utils/use-inner-visible");
|
|
18
15
|
var _useLockScroll = require("../../utils/use-lock-scroll");
|
|
19
|
-
var
|
|
16
|
+
var _withDefaultProps = require("../../utils/with-default-props");
|
|
17
|
+
var _withStopPropagation = require("../../utils/with-stop-propagation");
|
|
18
|
+
var _configProvider = require("../config-provider");
|
|
19
|
+
var _mask = _interopRequireDefault(require("../mask"));
|
|
20
20
|
var _popupBaseProps = require("../popup/popup-base-props");
|
|
21
|
-
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
|
22
21
|
function _getRequireWildcardCache(nodeInterop) { if (typeof WeakMap !== "function") return null; var cacheBabelInterop = new WeakMap(); var cacheNodeInterop = new WeakMap(); return (_getRequireWildcardCache = function (nodeInterop) { return nodeInterop ? cacheNodeInterop : cacheBabelInterop; })(nodeInterop); }
|
|
23
22
|
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; }
|
|
23
|
+
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
|
24
24
|
const classPrefix = 'adm-center-popup';
|
|
25
25
|
const defaultProps = Object.assign(Object.assign({}, _popupBaseProps.defaultPopupBaseProps), {
|
|
26
26
|
getContainer: null
|
|
27
27
|
});
|
|
28
|
-
const CenterPopup =
|
|
29
|
-
const
|
|
28
|
+
const CenterPopup = props => {
|
|
29
|
+
const {
|
|
30
|
+
popup: componentConfig = {}
|
|
31
|
+
} = (0, _configProvider.useConfig)();
|
|
32
|
+
const mergedProps = (0, _withDefaultProps.mergeProps)(defaultProps, componentConfig, props);
|
|
30
33
|
const unmountedRef = (0, _ahooks.useUnmountedRef)();
|
|
31
34
|
const style = (0, _web.useSpring)({
|
|
32
|
-
scale:
|
|
33
|
-
opacity:
|
|
35
|
+
scale: mergedProps.visible ? 1 : 0.8,
|
|
36
|
+
opacity: mergedProps.visible ? 1 : 0,
|
|
34
37
|
config: {
|
|
35
38
|
mass: 1.2,
|
|
36
39
|
tension: 200,
|
|
@@ -40,68 +43,68 @@ const CenterPopup = p => {
|
|
|
40
43
|
onRest: () => {
|
|
41
44
|
var _a, _b;
|
|
42
45
|
if (unmountedRef.current) return;
|
|
43
|
-
setActive(
|
|
44
|
-
if (
|
|
45
|
-
(_a =
|
|
46
|
+
setActive(mergedProps.visible);
|
|
47
|
+
if (mergedProps.visible) {
|
|
48
|
+
(_a = mergedProps.afterShow) === null || _a === void 0 ? void 0 : _a.call(mergedProps);
|
|
46
49
|
} else {
|
|
47
|
-
(_b =
|
|
50
|
+
(_b = mergedProps.afterClose) === null || _b === void 0 ? void 0 : _b.call(mergedProps);
|
|
48
51
|
}
|
|
49
52
|
}
|
|
50
53
|
});
|
|
51
|
-
const [active, setActive] = (0, _react.useState)(
|
|
54
|
+
const [active, setActive] = (0, _react.useState)(mergedProps.visible);
|
|
52
55
|
(0, _ahooks.useIsomorphicLayoutEffect)(() => {
|
|
53
|
-
if (
|
|
56
|
+
if (mergedProps.visible) {
|
|
54
57
|
setActive(true);
|
|
55
58
|
}
|
|
56
|
-
}, [
|
|
59
|
+
}, [mergedProps.visible]);
|
|
57
60
|
const ref = (0, _react.useRef)(null);
|
|
58
|
-
(0, _useLockScroll.useLockScroll)(ref,
|
|
59
|
-
const maskVisible = (0, _useInnerVisible.useInnerVisible)(active &&
|
|
61
|
+
(0, _useLockScroll.useLockScroll)(ref, mergedProps.disableBodyScroll && active);
|
|
62
|
+
const maskVisible = (0, _useInnerVisible.useInnerVisible)(active && mergedProps.visible);
|
|
60
63
|
const body = _react.default.createElement("div", {
|
|
61
|
-
className: (0, _classnames.default)(`${classPrefix}-body`,
|
|
62
|
-
style:
|
|
63
|
-
},
|
|
64
|
-
const node = (0, _withStopPropagation.withStopPropagation)(
|
|
64
|
+
className: (0, _classnames.default)(`${classPrefix}-body`, mergedProps.bodyClassName),
|
|
65
|
+
style: mergedProps.bodyStyle
|
|
66
|
+
}, mergedProps.children);
|
|
67
|
+
const node = (0, _withStopPropagation.withStopPropagation)(mergedProps.stopPropagation, (0, _nativeProps.withNativeProps)(mergedProps, _react.default.createElement("div", {
|
|
65
68
|
className: classPrefix,
|
|
66
69
|
style: {
|
|
67
70
|
display: active ? undefined : 'none',
|
|
68
71
|
pointerEvents: active ? undefined : 'none'
|
|
69
72
|
}
|
|
70
|
-
},
|
|
73
|
+
}, mergedProps.mask && _react.default.createElement(_mask.default, {
|
|
71
74
|
visible: maskVisible,
|
|
72
|
-
forceRender:
|
|
73
|
-
destroyOnClose:
|
|
75
|
+
forceRender: mergedProps.forceRender,
|
|
76
|
+
destroyOnClose: mergedProps.destroyOnClose,
|
|
74
77
|
onMaskClick: e => {
|
|
75
78
|
var _a, _b;
|
|
76
|
-
(_a =
|
|
77
|
-
if (
|
|
78
|
-
(_b =
|
|
79
|
+
(_a = mergedProps.onMaskClick) === null || _a === void 0 ? void 0 : _a.call(mergedProps, e);
|
|
80
|
+
if (mergedProps.closeOnMaskClick) {
|
|
81
|
+
(_b = mergedProps.onClose) === null || _b === void 0 ? void 0 : _b.call(mergedProps);
|
|
79
82
|
}
|
|
80
83
|
},
|
|
81
|
-
style:
|
|
82
|
-
className: (0, _classnames.default)(`${classPrefix}-mask`,
|
|
84
|
+
style: mergedProps.maskStyle,
|
|
85
|
+
className: (0, _classnames.default)(`${classPrefix}-mask`, mergedProps.maskClassName),
|
|
83
86
|
disableBodyScroll: false,
|
|
84
|
-
stopPropagation:
|
|
87
|
+
stopPropagation: mergedProps.stopPropagation
|
|
85
88
|
}), _react.default.createElement("div", {
|
|
86
89
|
className: `${classPrefix}-wrap`,
|
|
87
|
-
role:
|
|
88
|
-
"aria-label":
|
|
90
|
+
role: mergedProps.role,
|
|
91
|
+
"aria-label": mergedProps['aria-label']
|
|
89
92
|
}, _react.default.createElement(_web.animated.div, {
|
|
90
93
|
style: Object.assign(Object.assign({}, style), {
|
|
91
94
|
pointerEvents: style.opacity.to(v => v === 1 ? 'unset' : 'none')
|
|
92
95
|
}),
|
|
93
96
|
ref: ref
|
|
94
|
-
},
|
|
97
|
+
}, mergedProps.showCloseButton && _react.default.createElement("a", {
|
|
95
98
|
className: (0, _classnames.default)(`${classPrefix}-close`, 'adm-plain-anchor'),
|
|
96
99
|
onClick: () => {
|
|
97
100
|
var _a;
|
|
98
|
-
(_a =
|
|
101
|
+
(_a = mergedProps.onClose) === null || _a === void 0 ? void 0 : _a.call(mergedProps);
|
|
99
102
|
}
|
|
100
|
-
},
|
|
103
|
+
}, mergedProps.closeIcon), body)))));
|
|
101
104
|
return _react.default.createElement(_shouldRender.ShouldRender, {
|
|
102
105
|
active: active,
|
|
103
|
-
forceRender:
|
|
104
|
-
destroyOnClose:
|
|
105
|
-
}, (0, _renderToContainer.renderToContainer)(
|
|
106
|
+
forceRender: mergedProps.forceRender,
|
|
107
|
+
destroyOnClose: mergedProps.destroyOnClose
|
|
108
|
+
}, (0, _renderToContainer.renderToContainer)(mergedProps.getContainer, node));
|
|
106
109
|
};
|
|
107
110
|
exports.CenterPopup = CenterPopup;
|
|
@@ -4,13 +4,14 @@ Object.defineProperty(exports, "__esModule", {
|
|
|
4
4
|
value: true
|
|
5
5
|
});
|
|
6
6
|
exports.CheckList = void 0;
|
|
7
|
+
var _antdMobileIcons = require("antd-mobile-icons");
|
|
7
8
|
var _react = _interopRequireDefault(require("react"));
|
|
8
9
|
var _nativeProps = require("../../utils/native-props");
|
|
9
|
-
var
|
|
10
|
+
var _usePropsValue = require("../../utils/use-props-value");
|
|
10
11
|
var _withDefaultProps = require("../../utils/with-default-props");
|
|
12
|
+
var _configProvider = require("../config-provider");
|
|
13
|
+
var _list = _interopRequireDefault(require("../list"));
|
|
11
14
|
var _context = require("./context");
|
|
12
|
-
var _usePropsValue = require("../../utils/use-props-value");
|
|
13
|
-
var _antdMobileIcons = require("antd-mobile-icons");
|
|
14
15
|
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
|
15
16
|
const classPrefix = 'adm-check-list';
|
|
16
17
|
const defaultProps = {
|
|
@@ -18,11 +19,14 @@ const defaultProps = {
|
|
|
18
19
|
defaultValue: [],
|
|
19
20
|
activeIcon: _react.default.createElement(_antdMobileIcons.CheckOutline, null)
|
|
20
21
|
};
|
|
21
|
-
const CheckList =
|
|
22
|
-
const
|
|
23
|
-
|
|
22
|
+
const CheckList = props => {
|
|
23
|
+
const {
|
|
24
|
+
checkList: componentConfig = {}
|
|
25
|
+
} = (0, _configProvider.useConfig)();
|
|
26
|
+
const mergedProps = (0, _withDefaultProps.mergeProps)(defaultProps, componentConfig, props);
|
|
27
|
+
const [value, setValue] = (0, _usePropsValue.usePropsValue)(mergedProps);
|
|
24
28
|
function check(val) {
|
|
25
|
-
if (
|
|
29
|
+
if (mergedProps.multiple) {
|
|
26
30
|
setValue([...value, val]);
|
|
27
31
|
} else {
|
|
28
32
|
setValue([val]);
|
|
@@ -36,7 +40,7 @@ const CheckList = p => {
|
|
|
36
40
|
extra,
|
|
37
41
|
disabled,
|
|
38
42
|
readOnly
|
|
39
|
-
} =
|
|
43
|
+
} = mergedProps;
|
|
40
44
|
return _react.default.createElement(_context.CheckListContext.Provider, {
|
|
41
45
|
value: {
|
|
42
46
|
value,
|
|
@@ -47,9 +51,9 @@ const CheckList = p => {
|
|
|
47
51
|
disabled,
|
|
48
52
|
readOnly
|
|
49
53
|
}
|
|
50
|
-
}, (0, _nativeProps.withNativeProps)(
|
|
51
|
-
mode:
|
|
54
|
+
}, (0, _nativeProps.withNativeProps)(mergedProps, _react.default.createElement(_list.default, {
|
|
55
|
+
mode: mergedProps.mode,
|
|
52
56
|
className: classPrefix
|
|
53
|
-
},
|
|
57
|
+
}, mergedProps.children)));
|
|
54
58
|
};
|
|
55
59
|
exports.CheckList = CheckList;
|
|
@@ -8,14 +8,22 @@ export declare type CollapsePanelProps = {
|
|
|
8
8
|
forceRender?: boolean;
|
|
9
9
|
destroyOnClose?: boolean;
|
|
10
10
|
onClick?: (event: React.MouseEvent<Element, MouseEvent>) => void;
|
|
11
|
-
|
|
11
|
+
arrowIcon?: ReactNode | ((active: boolean) => ReactNode);
|
|
12
12
|
children?: ReactNode;
|
|
13
|
+
/**
|
|
14
|
+
* @deprecated use `arrowIcon` instead
|
|
15
|
+
*/
|
|
16
|
+
arrow?: ReactNode | ((active: boolean) => ReactNode);
|
|
13
17
|
} & NativeProps;
|
|
14
18
|
export declare const CollapsePanel: FC<CollapsePanelProps>;
|
|
15
19
|
declare type ValueProps<T> = {
|
|
16
20
|
activeKey?: T;
|
|
17
21
|
defaultActiveKey?: T;
|
|
18
22
|
onChange?: (activeKey: T) => void;
|
|
23
|
+
arrowIcon?: ReactNode | ((active: boolean) => ReactNode);
|
|
24
|
+
/**
|
|
25
|
+
* @deprecated use `arrowIcon` instead
|
|
26
|
+
*/
|
|
19
27
|
arrow?: ReactNode | ((active: boolean) => ReactNode);
|
|
20
28
|
};
|
|
21
29
|
export declare type CollapseProps = (({
|
|
@@ -15,6 +15,8 @@ var _traverseReactNode = require("../../utils/traverse-react-node");
|
|
|
15
15
|
var _useIsomorphicUpdateLayoutEffect = require("../../utils/use-isomorphic-update-layout-effect");
|
|
16
16
|
var _useMutationEffect = require("../../utils/use-mutation-effect");
|
|
17
17
|
var _usePropsValue = require("../../utils/use-props-value");
|
|
18
|
+
var _withDefaultProps = require("../../utils/with-default-props");
|
|
19
|
+
var _configProvider = require("../config-provider");
|
|
18
20
|
var _list = _interopRequireDefault(require("../list"));
|
|
19
21
|
function _getRequireWildcardCache(nodeInterop) { if (typeof WeakMap !== "function") return null; var cacheBabelInterop = new WeakMap(); var cacheNodeInterop = new WeakMap(); return (_getRequireWildcardCache = function (nodeInterop) { return nodeInterop ? cacheNodeInterop : cacheBabelInterop; })(nodeInterop); }
|
|
20
22
|
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; }
|
|
@@ -105,8 +107,12 @@ const CollapsePanelContent = props => {
|
|
|
105
107
|
}, _react.default.createElement(_list.default.Item, null, shouldRender && props.children)));
|
|
106
108
|
};
|
|
107
109
|
const Collapse = props => {
|
|
110
|
+
const {
|
|
111
|
+
collapse: componentConfig = {}
|
|
112
|
+
} = (0, _configProvider.useConfig)();
|
|
113
|
+
const mergedProps = (0, _withDefaultProps.mergeProps)(componentConfig, props);
|
|
108
114
|
const panels = [];
|
|
109
|
-
(0, _traverseReactNode.traverseReactNode)(
|
|
115
|
+
(0, _traverseReactNode.traverseReactNode)(mergedProps.children, child => {
|
|
110
116
|
if (!(0, _react.isValidElement)(child)) return;
|
|
111
117
|
const key = child.key;
|
|
112
118
|
if (typeof key !== 'string') return;
|
|
@@ -114,11 +120,11 @@ const Collapse = props => {
|
|
|
114
120
|
});
|
|
115
121
|
const handlePropsValue = () => {
|
|
116
122
|
var _a;
|
|
117
|
-
if (!
|
|
123
|
+
if (!mergedProps.accordion) {
|
|
118
124
|
return {
|
|
119
|
-
value:
|
|
120
|
-
defaultValue: (_a =
|
|
121
|
-
onChange:
|
|
125
|
+
value: mergedProps.activeKey,
|
|
126
|
+
defaultValue: (_a = mergedProps.defaultActiveKey) !== null && _a !== void 0 ? _a : [],
|
|
127
|
+
onChange: mergedProps.onChange
|
|
122
128
|
};
|
|
123
129
|
}
|
|
124
130
|
const initValue = {
|
|
@@ -126,29 +132,29 @@ const Collapse = props => {
|
|
|
126
132
|
defaultValue: [],
|
|
127
133
|
onChange: v => {
|
|
128
134
|
var _a, _b;
|
|
129
|
-
(_a =
|
|
135
|
+
(_a = mergedProps.onChange) === null || _a === void 0 ? void 0 : _a.call(mergedProps, (_b = v[0]) !== null && _b !== void 0 ? _b : null);
|
|
130
136
|
}
|
|
131
137
|
};
|
|
132
|
-
if (
|
|
138
|
+
if (mergedProps.activeKey === undefined) {
|
|
133
139
|
initValue.value = undefined;
|
|
134
|
-
} else if (
|
|
135
|
-
initValue.value = [
|
|
140
|
+
} else if (mergedProps.activeKey !== null) {
|
|
141
|
+
initValue.value = [mergedProps.activeKey];
|
|
136
142
|
}
|
|
137
|
-
if (![null, undefined].includes(
|
|
138
|
-
initValue.defaultValue = [
|
|
143
|
+
if (![null, undefined].includes(mergedProps.defaultActiveKey)) {
|
|
144
|
+
initValue.defaultValue = [mergedProps.defaultActiveKey];
|
|
139
145
|
}
|
|
140
146
|
return initValue;
|
|
141
147
|
};
|
|
142
148
|
const [activeKey, setActiveKey] = (0, _usePropsValue.usePropsValue)(handlePropsValue());
|
|
143
149
|
const activeKeyList = activeKey === null ? [] : Array.isArray(activeKey) ? activeKey : [activeKey];
|
|
144
|
-
return (0, _nativeProps.withNativeProps)(
|
|
150
|
+
return (0, _nativeProps.withNativeProps)(mergedProps, _react.default.createElement("div", {
|
|
145
151
|
className: classPrefix
|
|
146
152
|
}, _react.default.createElement(_list.default, null, panels.map(panel => {
|
|
147
153
|
const key = panel.key;
|
|
148
154
|
const active = activeKeyList.includes(key);
|
|
149
155
|
function handleClick(event) {
|
|
150
156
|
var _a, _b;
|
|
151
|
-
if (
|
|
157
|
+
if (mergedProps.accordion) {
|
|
152
158
|
if (active) {
|
|
153
159
|
setActiveKey([]);
|
|
154
160
|
} else {
|
|
@@ -163,27 +169,19 @@ const Collapse = props => {
|
|
|
163
169
|
}
|
|
164
170
|
(_b = (_a = panel.props).onClick) === null || _b === void 0 ? void 0 : _b.call(_a, event);
|
|
165
171
|
}
|
|
166
|
-
const
|
|
167
|
-
|
|
168
|
-
|
|
169
|
-
arrow
|
|
170
|
-
}
|
|
171
|
-
|
|
172
|
-
arrow = panel.props.arrow;
|
|
173
|
-
}
|
|
174
|
-
return typeof arrow === 'function' ? arrow(active) : _react.default.createElement("div", {
|
|
175
|
-
className: (0, _classnames.default)(`${classPrefix}-arrow`, {
|
|
176
|
-
[`${classPrefix}-arrow-active`]: active
|
|
177
|
-
})
|
|
178
|
-
}, arrow);
|
|
179
|
-
};
|
|
172
|
+
const arrow = (0, _withDefaultProps.mergeProp)(_react.default.createElement(_antdMobileIcons.DownOutline, null), mergedProps.arrow, mergedProps.arrowIcon, panel.props.arrow, panel.props.arrowIcon);
|
|
173
|
+
const arrowIcon = typeof arrow === 'function' ? arrow(active) : _react.default.createElement("div", {
|
|
174
|
+
className: (0, _classnames.default)(`${classPrefix}-arrow`, {
|
|
175
|
+
[`${classPrefix}-arrow-active`]: active
|
|
176
|
+
})
|
|
177
|
+
}, arrow);
|
|
180
178
|
return _react.default.createElement(_react.default.Fragment, {
|
|
181
179
|
key: key
|
|
182
180
|
}, (0, _nativeProps.withNativeProps)(panel.props, _react.default.createElement(_list.default.Item, {
|
|
183
181
|
className: `${classPrefix}-panel-header`,
|
|
184
182
|
onClick: handleClick,
|
|
185
183
|
disabled: panel.props.disabled,
|
|
186
|
-
|
|
184
|
+
arrowIcon: arrowIcon
|
|
187
185
|
}, panel.props.title)), _react.default.createElement(CollapsePanelContent, {
|
|
188
186
|
visible: active,
|
|
189
187
|
forceRender: !!panel.props.forceRender,
|
|
@@ -1,14 +1,52 @@
|
|
|
1
|
-
import
|
|
1
|
+
import { FC, ReactNode } from 'react';
|
|
2
2
|
import { Locale } from '../../locales/base';
|
|
3
3
|
declare type Config = {
|
|
4
4
|
locale: Locale;
|
|
5
|
+
checkList?: {
|
|
6
|
+
activeIcon?: ReactNode;
|
|
7
|
+
};
|
|
8
|
+
collapse?: {
|
|
9
|
+
arrowIcon?: ReactNode | ((active: boolean) => ReactNode);
|
|
10
|
+
};
|
|
11
|
+
dropdown?: {
|
|
12
|
+
arrowIcon?: ReactNode;
|
|
13
|
+
};
|
|
14
|
+
form?: {
|
|
15
|
+
helpIcon?: ReactNode;
|
|
16
|
+
};
|
|
17
|
+
input?: {
|
|
18
|
+
clearIcon?: ReactNode;
|
|
19
|
+
};
|
|
20
|
+
list?: {
|
|
21
|
+
arrowIcon?: ReactNode;
|
|
22
|
+
};
|
|
23
|
+
navBar?: {
|
|
24
|
+
backIcon?: ReactNode;
|
|
25
|
+
};
|
|
26
|
+
noticeBar?: {
|
|
27
|
+
icon?: ReactNode;
|
|
28
|
+
closeIcon?: ReactNode;
|
|
29
|
+
};
|
|
30
|
+
popup?: {
|
|
31
|
+
closeIcon?: ReactNode;
|
|
32
|
+
};
|
|
33
|
+
result?: {
|
|
34
|
+
successIcon?: ReactNode;
|
|
35
|
+
errorIcon?: ReactNode;
|
|
36
|
+
infoIcon?: ReactNode;
|
|
37
|
+
waitingIcon?: ReactNode;
|
|
38
|
+
warningIcon?: ReactNode;
|
|
39
|
+
};
|
|
40
|
+
searchBar?: {
|
|
41
|
+
searchIcon?: ReactNode;
|
|
42
|
+
};
|
|
5
43
|
};
|
|
6
44
|
export declare const defaultConfigRef: {
|
|
7
45
|
current: Config;
|
|
8
46
|
};
|
|
9
47
|
export declare function setDefaultConfig(config: Config): void;
|
|
10
48
|
export declare function getDefaultConfig(): Config;
|
|
11
|
-
export declare type ConfigProviderProps = Config & {
|
|
49
|
+
export declare type ConfigProviderProps = Partial<Config> & {
|
|
12
50
|
children?: ReactNode;
|
|
13
51
|
};
|
|
14
52
|
export declare const ConfigProvider: FC<ConfigProviderProps>;
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, "__esModule", {
|
|
4
|
+
value: true
|
|
5
|
+
});
|
|
6
|
+
exports.IconContext = void 0;
|
|
7
|
+
var _react = _interopRequireDefault(require("react"));
|
|
8
|
+
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
|
9
|
+
const IconContext = _react.default.createContext(null);
|
|
10
|
+
exports.IconContext = IconContext;
|
|
@@ -1,13 +1,17 @@
|
|
|
1
|
-
import React from 'react';
|
|
2
1
|
import type { ReactNode } from 'react';
|
|
3
|
-
import
|
|
2
|
+
import React from 'react';
|
|
4
3
|
import { NativeProps } from '../../utils/native-props';
|
|
4
|
+
import { PopupProps } from '../popup';
|
|
5
5
|
export declare type DropdownProps = {
|
|
6
6
|
activeKey?: string | null;
|
|
7
7
|
defaultActiveKey?: string | null;
|
|
8
8
|
closeOnMaskClick?: boolean;
|
|
9
9
|
closeOnClickAway?: boolean;
|
|
10
10
|
onChange?: (key: string | null) => void;
|
|
11
|
+
arrowIcon?: ReactNode;
|
|
12
|
+
/**
|
|
13
|
+
* @deprecated use `arrowIcon` instead
|
|
14
|
+
*/
|
|
11
15
|
arrow?: ReactNode;
|
|
12
16
|
getContainer?: PopupProps['getContainer'];
|
|
13
17
|
} & NativeProps;
|
|
@@ -20,6 +24,10 @@ declare const Dropdown: React.ForwardRefExoticComponent<{
|
|
|
20
24
|
closeOnMaskClick?: boolean | undefined;
|
|
21
25
|
closeOnClickAway?: boolean | undefined;
|
|
22
26
|
onChange?: ((key: string | null) => void) | undefined;
|
|
27
|
+
arrowIcon?: ReactNode;
|
|
28
|
+
/**
|
|
29
|
+
* @deprecated use `arrowIcon` instead
|
|
30
|
+
*/
|
|
23
31
|
arrow?: ReactNode;
|
|
24
32
|
getContainer?: PopupProps['getContainer'];
|
|
25
33
|
} & {
|
|
@@ -27,6 +35,6 @@ declare const Dropdown: React.ForwardRefExoticComponent<{
|
|
|
27
35
|
style?: (React.CSSProperties & Partial<Record<never, string>>) | undefined;
|
|
28
36
|
tabIndex?: number | undefined;
|
|
29
37
|
} & React.AriaAttributes & {
|
|
30
|
-
children?:
|
|
38
|
+
children?: ReactNode;
|
|
31
39
|
} & React.RefAttributes<DropdownRef>>;
|
|
32
40
|
export default Dropdown;
|
|
@@ -7,12 +7,14 @@ exports.default = void 0;
|
|
|
7
7
|
var _ahooks = require("ahooks");
|
|
8
8
|
var _classnames = _interopRequireDefault(require("classnames"));
|
|
9
9
|
var _react = _interopRequireWildcard(require("react"));
|
|
10
|
-
var _popup = _interopRequireDefault(require("../popup"));
|
|
11
|
-
var _item = require("./item");
|
|
12
10
|
var _nativeProps = require("../../utils/native-props");
|
|
13
|
-
var _withDefaultProps = require("../../utils/with-default-props");
|
|
14
11
|
var _usePropsValue = require("../../utils/use-props-value");
|
|
12
|
+
var _withDefaultProps = require("../../utils/with-default-props");
|
|
13
|
+
var _configProvider = require("../config-provider");
|
|
14
|
+
var _popup = _interopRequireDefault(require("../popup"));
|
|
15
15
|
var _popupBaseProps = require("../popup/popup-base-props");
|
|
16
|
+
var _context = require("./context");
|
|
17
|
+
var _item = require("./item");
|
|
16
18
|
function _getRequireWildcardCache(nodeInterop) { if (typeof WeakMap !== "function") return null; var cacheBabelInterop = new WeakMap(); var cacheNodeInterop = new WeakMap(); return (_getRequireWildcardCache = function (nodeInterop) { return nodeInterop ? cacheNodeInterop : cacheBabelInterop; })(nodeInterop); }
|
|
17
19
|
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; }
|
|
18
20
|
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
|
@@ -23,18 +25,22 @@ const defaultProps = {
|
|
|
23
25
|
closeOnClickAway: false,
|
|
24
26
|
getContainer: _popupBaseProps.defaultPopupBaseProps['getContainer']
|
|
25
27
|
};
|
|
26
|
-
const Dropdown = (0, _react.forwardRef)((
|
|
27
|
-
const
|
|
28
|
+
const Dropdown = (0, _react.forwardRef)((props, ref) => {
|
|
29
|
+
const {
|
|
30
|
+
dropdown: componentConfig = {}
|
|
31
|
+
} = (0, _configProvider.useConfig)();
|
|
32
|
+
const mergedProps = (0, _withDefaultProps.mergeProps)(defaultProps, componentConfig, props);
|
|
33
|
+
const arrowIcon = (0, _withDefaultProps.mergeProp)(componentConfig.arrowIcon, props.arrow, props.arrowIcon);
|
|
28
34
|
const [value, setValue] = (0, _usePropsValue.usePropsValue)({
|
|
29
|
-
value:
|
|
30
|
-
defaultValue:
|
|
31
|
-
onChange:
|
|
35
|
+
value: mergedProps.activeKey,
|
|
36
|
+
defaultValue: mergedProps.defaultActiveKey,
|
|
37
|
+
onChange: mergedProps.onChange
|
|
32
38
|
});
|
|
33
39
|
const navRef = (0, _react.useRef)(null);
|
|
34
40
|
const contentRef = (0, _react.useRef)(null);
|
|
35
41
|
// 点击外部区域,关闭
|
|
36
42
|
(0, _ahooks.useClickAway)(() => {
|
|
37
|
-
if (!
|
|
43
|
+
if (!mergedProps.closeOnClickAway) return;
|
|
38
44
|
setValue(null);
|
|
39
45
|
}, [navRef, contentRef]);
|
|
40
46
|
// 计算 navs 的 top 值
|
|
@@ -57,7 +63,7 @@ const Dropdown = (0, _react.forwardRef)((p, ref) => {
|
|
|
57
63
|
};
|
|
58
64
|
let popupForceRender = false;
|
|
59
65
|
const items = [];
|
|
60
|
-
const navs = _react.default.Children.map(
|
|
66
|
+
const navs = _react.default.Children.map(mergedProps.children, child => {
|
|
61
67
|
if ((0, _react.isValidElement)(child)) {
|
|
62
68
|
const childProps = Object.assign(Object.assign({}, child.props), {
|
|
63
69
|
onClick: event => {
|
|
@@ -65,8 +71,7 @@ const Dropdown = (0, _react.forwardRef)((p, ref) => {
|
|
|
65
71
|
changeActive(child.key);
|
|
66
72
|
(_b = (_a = child.props).onClick) === null || _b === void 0 ? void 0 : _b.call(_a, event);
|
|
67
73
|
},
|
|
68
|
-
active: child.key === value
|
|
69
|
-
arrow: child.props.arrow === undefined ? props.arrow : child.props.arrow
|
|
74
|
+
active: child.key === value
|
|
70
75
|
});
|
|
71
76
|
items.push(child);
|
|
72
77
|
if (child.props.forceRender) popupForceRender = true;
|
|
@@ -80,18 +85,20 @@ const Dropdown = (0, _react.forwardRef)((p, ref) => {
|
|
|
80
85
|
setValue(null);
|
|
81
86
|
}
|
|
82
87
|
}), [setValue]);
|
|
83
|
-
return (0, _nativeProps.withNativeProps)(
|
|
88
|
+
return (0, _nativeProps.withNativeProps)(mergedProps, _react.default.createElement("div", {
|
|
84
89
|
className: (0, _classnames.default)(classPrefix, {
|
|
85
90
|
[`${classPrefix}-open`]: !!value
|
|
86
91
|
}),
|
|
87
92
|
ref: containerRef
|
|
93
|
+
}, _react.default.createElement(_context.IconContext.Provider, {
|
|
94
|
+
value: arrowIcon
|
|
88
95
|
}, _react.default.createElement("div", {
|
|
89
96
|
className: `${classPrefix}-nav`,
|
|
90
97
|
ref: navRef
|
|
91
|
-
}, navs), _react.default.createElement(_popup.default, {
|
|
98
|
+
}, navs)), _react.default.createElement(_popup.default, {
|
|
92
99
|
visible: !!value,
|
|
93
100
|
position: 'top',
|
|
94
|
-
getContainer:
|
|
101
|
+
getContainer: mergedProps.getContainer,
|
|
95
102
|
className: `${classPrefix}-popup`,
|
|
96
103
|
maskClassName: `${classPrefix}-popup-mask`,
|
|
97
104
|
bodyClassName: `${classPrefix}-popup-body`,
|
|
@@ -99,7 +106,7 @@ const Dropdown = (0, _react.forwardRef)((p, ref) => {
|
|
|
99
106
|
top
|
|
100
107
|
},
|
|
101
108
|
forceRender: popupForceRender,
|
|
102
|
-
onMaskClick:
|
|
109
|
+
onMaskClick: mergedProps.closeOnMaskClick ? () => {
|
|
103
110
|
changeActive(null);
|
|
104
111
|
} : undefined
|
|
105
112
|
}, _react.default.createElement("div", {
|
|
@@ -7,6 +7,7 @@ declare const _default: import("react").ForwardRefExoticComponent<{
|
|
|
7
7
|
closeOnMaskClick?: boolean | undefined;
|
|
8
8
|
closeOnClickAway?: boolean | undefined;
|
|
9
9
|
onChange?: ((key: string | null) => void) | undefined;
|
|
10
|
+
arrowIcon?: import("react").ReactNode;
|
|
10
11
|
arrow?: import("react").ReactNode;
|
|
11
12
|
getContainer?: import("../../utils/render-to-container").GetContainer | undefined;
|
|
12
13
|
} & {
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import React from 'react';
|
|
2
1
|
import type { FC, ReactNode } from 'react';
|
|
2
|
+
import React from 'react';
|
|
3
3
|
import { NativeProps } from '../../utils/native-props';
|
|
4
4
|
export declare type DropdownItemProps = {
|
|
5
5
|
key: string;
|
|
@@ -9,6 +9,10 @@ export declare type DropdownItemProps = {
|
|
|
9
9
|
forceRender?: boolean;
|
|
10
10
|
destroyOnClose?: boolean;
|
|
11
11
|
onClick?: (event: React.MouseEvent<HTMLDivElement, MouseEvent>) => void;
|
|
12
|
+
arrowIcon?: ReactNode;
|
|
13
|
+
/**
|
|
14
|
+
* @deprecated use `arrowIcon` instead
|
|
15
|
+
*/
|
|
12
16
|
arrow?: ReactNode;
|
|
13
17
|
children?: ReactNode;
|
|
14
18
|
} & NativeProps;
|