antd-mobile 5.0.0-rc.23 → 5.0.0-rc.27
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 +6 -6
- package/2x/cjs/components/button/button.css +2 -2
- package/2x/cjs/components/calendar/calendar.js +3 -1
- package/2x/cjs/components/cascade-picker-view/cascade-picker-view.d.ts +1 -2
- package/2x/cjs/components/date-picker/date-picker.d.ts +1 -1
- package/2x/cjs/components/date-picker-view/date-picker-view.d.ts +3 -2
- package/2x/cjs/components/dialog/dialog.css +4 -0
- package/2x/cjs/components/dropdown/dropdown.css +0 -4
- package/2x/cjs/components/dropdown/item.js +3 -1
- package/2x/cjs/components/ellipsis/ellipsis.js +3 -1
- package/2x/cjs/components/empty/empty.css +1 -1
- package/2x/cjs/components/floating-bubble/floating-bubble.css +1 -0
- package/2x/cjs/components/floating-panel/floating-panel.d.ts +7 -5
- package/2x/cjs/components/floating-panel/floating-panel.js +11 -1
- package/2x/cjs/components/form/form-item.css +4 -6
- package/2x/cjs/components/form/form-item.d.ts +2 -2
- package/2x/cjs/components/form/form-item.js +9 -5
- package/2x/cjs/components/form/form.css +3 -3
- package/2x/cjs/components/form/form.d.ts +5 -4
- package/2x/cjs/components/form/index.css +7 -9
- package/2x/cjs/components/form/index.d.ts +5 -4
- package/2x/cjs/components/image-uploader/image-uploader.js +1 -1
- package/2x/cjs/components/image-viewer/image-viewer.css +2 -0
- package/2x/cjs/components/image-viewer/image-viewer.js +12 -2
- package/2x/cjs/components/image-viewer/slide.js +11 -7
- package/2x/cjs/components/image-viewer/slides.d.ts +1 -1
- package/2x/cjs/components/index-bar/index-bar.css +2 -1
- package/2x/cjs/components/input/input.d.ts +6 -2
- package/2x/cjs/components/input/input.js +23 -3
- package/2x/cjs/components/list/list.css +8 -10
- package/2x/cjs/components/picker/picker.css +10 -2
- package/2x/cjs/components/picker/picker.d.ts +2 -1
- package/2x/cjs/components/picker/picker.js +3 -1
- package/2x/cjs/components/picker-view/picker-view.css +2 -1
- package/2x/cjs/components/picker-view/picker-view.d.ts +1 -1
- package/2x/cjs/components/picker-view/wheel.js +4 -2
- package/2x/cjs/components/popover/arrow.d.ts +3 -0
- package/2x/cjs/components/popover/arrow.js +26 -0
- package/2x/cjs/components/popover/index.d.ts +10 -20
- package/2x/cjs/components/popover/index.js +4 -2
- package/2x/cjs/components/popover/popover-menu.css +63 -0
- package/2x/cjs/components/popover/popover-menu.d.ts +17 -0
- package/{cjs/components/popover/pop-menu.js → 2x/cjs/components/popover/popover-menu.js} +23 -26
- package/2x/cjs/components/popover/popover.css +90 -318
- package/2x/cjs/components/popover/popover.d.ts +9 -8
- package/2x/cjs/components/popover/popover.js +11 -17
- package/2x/cjs/components/radio/radio.js +2 -3
- package/2x/cjs/components/selector/selector.css +14 -6
- package/2x/cjs/components/selector/selector.d.ts +2 -1
- package/2x/cjs/components/selector/selector.js +3 -2
- package/2x/cjs/components/swiper/swiper.js +1 -1
- package/2x/cjs/components/tabs/tabs.js +2 -2
- package/2x/cjs/components/text-area/text-area.css +9 -9
- package/2x/cjs/components/text-area/text-area.d.ts +2 -2
- package/2x/cjs/components/text-area/text-area.js +41 -32
- package/2x/cjs/components/virtual-input/virtual-input.js +3 -1
- package/2x/cjs/utils/get-scroll-parent.js +1 -1
- package/2x/cjs/utils/use-ref-state.js +1 -1
- package/2x/cjs/utils/use-resize-effect.js +1 -3
- package/2x/cjs/utils/use-tab-list-scroll.js +1 -3
- package/2x/es/components/button/button.css +2 -2
- package/2x/es/components/calendar/calendar.js +3 -2
- package/2x/es/components/cascade-picker-view/cascade-picker-view.d.ts +1 -2
- package/2x/es/components/date-picker/date-picker.d.ts +1 -1
- package/2x/es/components/date-picker-view/date-picker-view.d.ts +3 -2
- package/2x/es/components/dialog/dialog.css +4 -0
- package/2x/es/components/dropdown/dropdown.css +0 -4
- package/2x/es/components/dropdown/item.js +3 -1
- package/2x/es/components/ellipsis/ellipsis.js +3 -2
- package/2x/es/components/empty/empty.css +1 -1
- package/2x/es/components/floating-bubble/floating-bubble.css +1 -0
- package/2x/es/components/floating-panel/floating-panel.d.ts +7 -5
- package/2x/es/components/floating-panel/floating-panel.js +9 -1
- package/2x/es/components/form/form-item.css +4 -6
- package/2x/es/components/form/form-item.d.ts +2 -2
- package/2x/es/components/form/form-item.js +9 -5
- package/2x/es/components/form/form.css +3 -3
- package/2x/es/components/form/form.d.ts +5 -4
- package/2x/es/components/form/index.css +7 -9
- package/2x/es/components/form/index.d.ts +5 -4
- package/2x/es/components/image-uploader/image-uploader.js +3 -3
- package/2x/es/components/image-viewer/image-viewer.css +2 -0
- package/2x/es/components/image-viewer/image-viewer.js +13 -3
- package/2x/es/components/image-viewer/slide.js +11 -7
- package/2x/es/components/image-viewer/slides.d.ts +1 -1
- package/2x/es/components/index-bar/index-bar.css +2 -1
- package/2x/es/components/input/input.d.ts +6 -2
- package/2x/es/components/input/input.js +22 -4
- package/2x/es/components/list/list.css +8 -10
- package/2x/es/components/picker/picker.css +10 -2
- package/2x/es/components/picker/picker.d.ts +2 -1
- package/2x/es/components/picker/picker.js +3 -1
- package/2x/es/components/picker-view/picker-view.css +2 -1
- package/2x/es/components/picker-view/picker-view.d.ts +1 -1
- package/2x/es/components/picker-view/wheel.js +4 -3
- package/2x/es/components/popover/arrow.d.ts +3 -0
- package/2x/es/components/popover/arrow.js +12 -0
- package/2x/es/components/popover/index.d.ts +10 -20
- package/2x/es/components/popover/index.js +3 -2
- package/2x/es/components/popover/popover-menu.css +63 -0
- package/2x/es/components/popover/popover-menu.d.ts +17 -0
- package/2x/es/components/popover/popover-menu.js +52 -0
- package/2x/es/components/popover/popover.css +90 -318
- package/2x/es/components/popover/popover.d.ts +9 -8
- package/2x/es/components/popover/popover.js +10 -17
- package/2x/es/components/radio/radio.js +2 -3
- package/2x/es/components/selector/selector.css +14 -6
- package/2x/es/components/selector/selector.d.ts +2 -1
- package/2x/es/components/selector/selector.js +3 -2
- package/2x/es/components/swiper/swiper.js +3 -3
- package/2x/es/components/tabs/tabs.js +4 -4
- package/2x/es/components/text-area/text-area.css +9 -9
- package/2x/es/components/text-area/text-area.d.ts +2 -2
- package/2x/es/components/text-area/text-area.js +41 -31
- package/2x/es/components/virtual-input/virtual-input.js +3 -2
- package/2x/es/utils/get-scroll-parent.js +1 -1
- package/2x/es/utils/use-ref-state.js +2 -2
- package/2x/es/utils/use-resize-effect.js +2 -3
- package/2x/es/utils/use-tab-list-scroll.js +2 -3
- package/2x/package.json +5 -5
- package/README.md +6 -6
- package/cjs/components/button/button.css +2 -2
- package/cjs/components/calendar/calendar.js +3 -1
- package/cjs/components/cascade-picker-view/cascade-picker-view.d.ts +1 -2
- package/cjs/components/date-picker/date-picker.d.ts +1 -1
- package/cjs/components/date-picker-view/date-picker-view.d.ts +3 -2
- package/cjs/components/dialog/dialog.css +3 -0
- package/cjs/components/dropdown/dropdown.css +0 -3
- package/cjs/components/dropdown/item.js +3 -1
- package/cjs/components/ellipsis/ellipsis.js +3 -1
- package/cjs/components/empty/empty.css +1 -1
- package/cjs/components/floating-bubble/floating-bubble.css +1 -0
- package/cjs/components/floating-panel/floating-panel.d.ts +7 -5
- package/cjs/components/floating-panel/floating-panel.js +11 -1
- package/cjs/components/form/form-item.css +4 -5
- package/cjs/components/form/form-item.d.ts +2 -2
- package/cjs/components/form/form-item.js +9 -5
- package/cjs/components/form/form.css +3 -3
- package/cjs/components/form/form.d.ts +5 -4
- package/cjs/components/form/index.css +7 -8
- package/cjs/components/form/index.d.ts +5 -4
- package/cjs/components/image-uploader/image-uploader.js +1 -1
- package/cjs/components/image-viewer/image-viewer.css +2 -0
- package/cjs/components/image-viewer/image-viewer.js +12 -2
- package/cjs/components/image-viewer/slide.js +11 -7
- package/cjs/components/image-viewer/slides.d.ts +1 -1
- package/cjs/components/index-bar/index-bar.css +2 -1
- package/cjs/components/input/input.d.ts +6 -2
- package/cjs/components/input/input.js +23 -3
- package/cjs/components/list/list.css +7 -9
- package/cjs/components/picker/picker.css +9 -2
- package/cjs/components/picker/picker.d.ts +2 -1
- package/cjs/components/picker/picker.js +3 -1
- package/cjs/components/picker-view/picker-view.css +2 -1
- package/cjs/components/picker-view/picker-view.d.ts +1 -1
- package/cjs/components/picker-view/wheel.js +4 -2
- package/cjs/components/popover/arrow.d.ts +3 -0
- package/cjs/components/popover/arrow.js +26 -0
- package/cjs/components/popover/index.d.ts +10 -20
- package/cjs/components/popover/index.js +4 -2
- package/cjs/components/popover/popover-menu.css +52 -0
- package/cjs/components/popover/popover-menu.d.ts +17 -0
- package/{2x/cjs/components/popover/pop-menu.js → cjs/components/popover/popover-menu.js} +23 -26
- package/cjs/components/popover/popover.css +83 -276
- package/cjs/components/popover/popover.d.ts +9 -8
- package/cjs/components/popover/popover.js +11 -17
- package/cjs/components/radio/radio.js +2 -3
- package/cjs/components/selector/selector.css +14 -6
- package/cjs/components/selector/selector.d.ts +2 -1
- package/cjs/components/selector/selector.js +3 -2
- package/cjs/components/swiper/swiper.js +1 -1
- package/cjs/components/tabs/tabs.js +2 -2
- package/cjs/components/text-area/text-area.css +9 -9
- package/cjs/components/text-area/text-area.d.ts +2 -2
- package/cjs/components/text-area/text-area.js +41 -32
- package/cjs/components/virtual-input/virtual-input.js +3 -1
- package/cjs/utils/get-scroll-parent.js +1 -1
- package/cjs/utils/use-ref-state.js +1 -1
- package/cjs/utils/use-resize-effect.js +1 -3
- package/cjs/utils/use-tab-list-scroll.js +1 -3
- package/es/components/button/button.css +2 -2
- package/es/components/calendar/calendar.js +3 -2
- package/es/components/cascade-picker-view/cascade-picker-view.d.ts +1 -2
- package/es/components/date-picker/date-picker.d.ts +1 -1
- package/es/components/date-picker-view/date-picker-view.d.ts +3 -2
- package/es/components/dialog/dialog.css +3 -0
- package/es/components/dropdown/dropdown.css +0 -3
- package/es/components/dropdown/item.js +3 -1
- package/es/components/ellipsis/ellipsis.js +3 -2
- package/es/components/empty/empty.css +1 -1
- package/es/components/floating-bubble/floating-bubble.css +1 -0
- package/es/components/floating-panel/floating-panel.d.ts +7 -5
- package/es/components/floating-panel/floating-panel.js +9 -1
- package/es/components/form/form-item.css +4 -5
- package/es/components/form/form-item.d.ts +2 -2
- package/es/components/form/form-item.js +9 -5
- package/es/components/form/form.css +3 -3
- package/es/components/form/form.d.ts +5 -4
- package/es/components/form/index.css +7 -8
- package/es/components/form/index.d.ts +5 -4
- package/es/components/image-uploader/image-uploader.js +3 -3
- package/es/components/image-viewer/image-viewer.css +2 -0
- package/es/components/image-viewer/image-viewer.js +13 -3
- package/es/components/image-viewer/slide.js +11 -7
- package/es/components/image-viewer/slides.d.ts +1 -1
- package/es/components/index-bar/index-bar.css +2 -1
- package/es/components/input/input.d.ts +6 -2
- package/es/components/input/input.js +22 -4
- package/es/components/list/list.css +7 -9
- package/es/components/picker/picker.css +9 -2
- package/es/components/picker/picker.d.ts +2 -1
- package/es/components/picker/picker.js +3 -1
- package/es/components/picker-view/picker-view.css +2 -1
- package/es/components/picker-view/picker-view.d.ts +1 -1
- package/es/components/picker-view/wheel.js +4 -3
- package/es/components/popover/arrow.d.ts +3 -0
- package/es/components/popover/arrow.js +12 -0
- package/es/components/popover/index.d.ts +10 -20
- package/es/components/popover/index.js +3 -2
- package/es/components/popover/popover-menu.css +52 -0
- package/es/components/popover/popover-menu.d.ts +17 -0
- package/es/components/popover/popover-menu.js +52 -0
- package/es/components/popover/popover.css +83 -276
- package/es/components/popover/popover.d.ts +9 -8
- package/es/components/popover/popover.js +10 -17
- package/es/components/radio/radio.js +2 -3
- package/es/components/selector/selector.css +14 -6
- package/es/components/selector/selector.d.ts +2 -1
- package/es/components/selector/selector.js +3 -2
- package/es/components/swiper/swiper.js +3 -3
- package/es/components/tabs/tabs.js +4 -4
- package/es/components/text-area/text-area.css +9 -9
- package/es/components/text-area/text-area.d.ts +2 -2
- package/es/components/text-area/text-area.js +41 -31
- package/es/components/virtual-input/virtual-input.js +3 -2
- package/es/utils/get-scroll-parent.js +1 -1
- package/es/utils/use-ref-state.js +2 -2
- package/es/utils/use-resize-effect.js +2 -3
- package/es/utils/use-tab-list-scroll.js +2 -3
- package/package.json +5 -5
- package/umd/antd-mobile.js +1 -1
- package/2x/cjs/components/popover/animation.css +0 -111
- package/2x/cjs/components/popover/pop-menu.d.ts +0 -28
- package/2x/es/components/popover/animation.css +0 -111
- package/2x/es/components/popover/pop-menu.d.ts +0 -28
- package/2x/es/components/popover/pop-menu.js +0 -54
- package/cjs/components/popover/animation.css +0 -96
- package/cjs/components/popover/pop-menu.d.ts +0 -28
- package/es/components/popover/animation.css +0 -96
- package/es/components/popover/pop-menu.d.ts +0 -28
- package/es/components/popover/pop-menu.js +0 -54
|
@@ -17,6 +17,10 @@ var _withDefaultProps = require("../../utils/with-default-props");
|
|
|
17
17
|
|
|
18
18
|
var _classnames = _interopRequireDefault(require("classnames"));
|
|
19
19
|
|
|
20
|
+
var _ahooks = require("ahooks");
|
|
21
|
+
|
|
22
|
+
var _bound = require("../../utils/bound");
|
|
23
|
+
|
|
20
24
|
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
|
21
25
|
|
|
22
26
|
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); }
|
|
@@ -58,7 +62,7 @@ const Input = (0, _react.forwardRef)((p, ref) => {
|
|
|
58
62
|
(_a = props.onKeyDown) === null || _a === void 0 ? void 0 : _a.call(props, e);
|
|
59
63
|
};
|
|
60
64
|
|
|
61
|
-
(0,
|
|
65
|
+
(0, _ahooks.useIsomorphicLayoutEffect)(() => {
|
|
62
66
|
var _a;
|
|
63
67
|
|
|
64
68
|
if (!props.enterKeyHint) return;
|
|
@@ -69,6 +73,19 @@ const Input = (0, _react.forwardRef)((p, ref) => {
|
|
|
69
73
|
(_a = nativeInputRef.current) === null || _a === void 0 ? void 0 : _a.removeAttribute('enterkeyhint');
|
|
70
74
|
};
|
|
71
75
|
}, [props.enterKeyHint]);
|
|
76
|
+
|
|
77
|
+
function checkValue() {
|
|
78
|
+
let nextValue = value;
|
|
79
|
+
|
|
80
|
+
if (props.type === 'number') {
|
|
81
|
+
nextValue = (0, _bound.bound)(parseFloat(nextValue), props.min, props.max).toString();
|
|
82
|
+
}
|
|
83
|
+
|
|
84
|
+
if (nextValue !== value) {
|
|
85
|
+
setValue(nextValue);
|
|
86
|
+
}
|
|
87
|
+
}
|
|
88
|
+
|
|
72
89
|
return (0, _nativeProps.withNativeProps)(props, _react.default.createElement("div", {
|
|
73
90
|
className: (0, _classnames.default)(`${classPrefix}`, props.disabled && `${classPrefix}-disabled`)
|
|
74
91
|
}, _react.default.createElement("input", {
|
|
@@ -88,6 +105,7 @@ const Input = (0, _react.forwardRef)((p, ref) => {
|
|
|
88
105
|
var _a;
|
|
89
106
|
|
|
90
107
|
setHasFocus(false);
|
|
108
|
+
checkValue();
|
|
91
109
|
(_a = props.onBlur) === null || _a === void 0 ? void 0 : _a.call(props, e);
|
|
92
110
|
},
|
|
93
111
|
id: props.id,
|
|
@@ -105,8 +123,10 @@ const Input = (0, _react.forwardRef)((p, ref) => {
|
|
|
105
123
|
autoCapitalize: props.autoCapitalize,
|
|
106
124
|
autoCorrect: props.autoCorrect,
|
|
107
125
|
onKeyDown: handleKeydown,
|
|
108
|
-
onKeyUp: props.onKeyUp
|
|
109
|
-
|
|
126
|
+
onKeyUp: props.onKeyUp,
|
|
127
|
+
onCompositionStart: props.onCompositionStart,
|
|
128
|
+
onCompositionEnd: props.onCompositionEnd
|
|
129
|
+
}), props.clearable && !!value && !props.readOnly && _react.default.createElement("div", {
|
|
110
130
|
className: `${classPrefix}-clear`,
|
|
111
131
|
onMouseDown: e => {
|
|
112
132
|
e.preventDefault();
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
.adm-list {
|
|
2
|
-
--header-font-size:
|
|
2
|
+
--header-font-size: 30px;
|
|
3
3
|
--prefix-width: 'auto';
|
|
4
4
|
--prefix-padding-right: 24px;
|
|
5
5
|
--align-items: center;
|
|
@@ -15,9 +15,7 @@
|
|
|
15
15
|
.adm-list-header {
|
|
16
16
|
color: var(--adm-color-weak);
|
|
17
17
|
font-size: var(--header-font-size);
|
|
18
|
-
padding
|
|
19
|
-
padding-right: var(--padding-right);
|
|
20
|
-
margin: 32px 0 8px;
|
|
18
|
+
padding: 16px var(--padding-right) 16px var(--padding-left);
|
|
21
19
|
}
|
|
22
20
|
|
|
23
21
|
.adm-list-body {
|
|
@@ -43,6 +41,10 @@
|
|
|
43
41
|
border-radius: 16px;
|
|
44
42
|
}
|
|
45
43
|
|
|
44
|
+
.adm-list-card .adm-list-header {
|
|
45
|
+
padding-left: 0;
|
|
46
|
+
}
|
|
47
|
+
|
|
46
48
|
.adm-list-item {
|
|
47
49
|
display: block;
|
|
48
50
|
padding-left: var(--padding-left);
|
|
@@ -99,11 +101,11 @@
|
|
|
99
101
|
pointer-events: none;
|
|
100
102
|
}
|
|
101
103
|
|
|
102
|
-
a.adm-list-item:active {
|
|
104
|
+
a.adm-list-item:active:not(.adm-list-item-disabled) {
|
|
103
105
|
background-color: var(--active-background-color);
|
|
104
106
|
}
|
|
105
107
|
|
|
106
|
-
a.adm-list-item:active::after {
|
|
108
|
+
a.adm-list-item:active:not(.adm-list-item-disabled)::after {
|
|
107
109
|
content: ' ';
|
|
108
110
|
display: block;
|
|
109
111
|
position: absolute;
|
|
@@ -111,8 +113,4 @@ a.adm-list-item:active::after {
|
|
|
111
113
|
bottom: -2px;
|
|
112
114
|
left: 0;
|
|
113
115
|
border-bottom: var(--border-inner);
|
|
114
|
-
}
|
|
115
|
-
|
|
116
|
-
a.adm-list-item.adm-list-item-disabled:active {
|
|
117
|
-
background-color: unset;
|
|
118
116
|
}
|
|
@@ -1,10 +1,18 @@
|
|
|
1
1
|
.adm-picker {
|
|
2
|
+
--header-button-font-size: 30px;
|
|
3
|
+
--title-font-size: 30px;
|
|
4
|
+
--item-font-size: 32px;
|
|
2
5
|
width: 100%;
|
|
3
6
|
height: 600px;
|
|
4
7
|
overflow: hidden;
|
|
5
8
|
position: relative;
|
|
6
9
|
display: flex;
|
|
7
10
|
flex-direction: column;
|
|
11
|
+
---item-font-size: var(--item-font-size);
|
|
12
|
+
}
|
|
13
|
+
|
|
14
|
+
.adm-picker .adm-picker-view.adm-picker-view {
|
|
15
|
+
--item-font-size: var(---item-font-size);
|
|
8
16
|
}
|
|
9
17
|
|
|
10
18
|
.adm-picker-header {
|
|
@@ -17,14 +25,14 @@
|
|
|
17
25
|
}
|
|
18
26
|
|
|
19
27
|
.adm-picker-header-button {
|
|
20
|
-
font-size:
|
|
28
|
+
font-size: var(--header-button-font-size);
|
|
21
29
|
display: inline-block;
|
|
22
30
|
padding: 16px 16px;
|
|
23
31
|
}
|
|
24
32
|
|
|
25
33
|
.adm-picker-header-title {
|
|
26
34
|
padding: 8px 8px;
|
|
27
|
-
font-size:
|
|
35
|
+
font-size: var(--title-font-size);
|
|
28
36
|
color: var(--adm-color-text);
|
|
29
37
|
text-align: center;
|
|
30
38
|
flex: 1;
|
|
@@ -10,10 +10,11 @@ export declare type PickerProps = {
|
|
|
10
10
|
onConfirm?: (value: PickerValue[], extend: PickerValueExtend) => void;
|
|
11
11
|
onCancel?: () => void;
|
|
12
12
|
onClose?: () => void;
|
|
13
|
+
closeOnMaskClick?: boolean;
|
|
13
14
|
visible?: boolean;
|
|
14
15
|
title?: ReactNode;
|
|
15
16
|
confirmText?: ReactNode;
|
|
16
17
|
cancelText?: ReactNode;
|
|
17
18
|
children?: (items: (PickerColumnItem | null)[]) => ReactNode;
|
|
18
|
-
} & Pick<PopupProps, 'getContainer' | 'afterShow' | 'afterClose' | 'onClick' | 'stopPropagation'> & NativeProps
|
|
19
|
+
} & Pick<PopupProps, 'getContainer' | 'afterShow' | 'afterClose' | 'onClick' | 'stopPropagation'> & NativeProps<'--header-button-font-size' | '--title-font-size' | '--item-font-size'>;
|
|
19
20
|
export declare const Picker: React.NamedExoticComponent<PickerProps>;
|
|
@@ -35,7 +35,8 @@ function _interopRequireWildcard(obj, nodeInterop) { if (!nodeInterop && obj &&
|
|
|
35
35
|
|
|
36
36
|
const classPrefix = `adm-picker`;
|
|
37
37
|
const defaultProps = {
|
|
38
|
-
defaultValue: []
|
|
38
|
+
defaultValue: [],
|
|
39
|
+
closeOnMaskClick: true
|
|
39
40
|
};
|
|
40
41
|
const Picker = (0, _react.memo)(p => {
|
|
41
42
|
var _a;
|
|
@@ -114,6 +115,7 @@ const Picker = (0, _react.memo)(p => {
|
|
|
114
115
|
onMaskClick: () => {
|
|
115
116
|
var _a, _b;
|
|
116
117
|
|
|
118
|
+
if (!props.closeOnMaskClick) return;
|
|
117
119
|
(_a = props.onCancel) === null || _a === void 0 ? void 0 : _a.call(props);
|
|
118
120
|
(_b = props.onClose) === null || _b === void 0 ? void 0 : _b.call(props);
|
|
119
121
|
},
|
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
.adm-picker-view {
|
|
2
2
|
--height: 480px;
|
|
3
|
+
--item-font-size: 32px;
|
|
3
4
|
height: var(--height);
|
|
4
5
|
width: 100%;
|
|
5
6
|
display: flex;
|
|
@@ -44,7 +45,7 @@
|
|
|
44
45
|
}
|
|
45
46
|
|
|
46
47
|
.adm-picker-view-column-item {
|
|
47
|
-
font-size:
|
|
48
|
+
font-size: var(--item-font-size);
|
|
48
49
|
padding: 0 12px;
|
|
49
50
|
height: 68px;
|
|
50
51
|
display: flex;
|
|
@@ -14,5 +14,5 @@ export declare type PickerViewProps = {
|
|
|
14
14
|
value?: PickerValue[];
|
|
15
15
|
defaultValue?: PickerValue[];
|
|
16
16
|
onChange?: (value: PickerValue[], extend: PickerValueExtend) => void;
|
|
17
|
-
} & NativeProps<'--height'>;
|
|
17
|
+
} & NativeProps<'--height' | '--item-font-size'>;
|
|
18
18
|
export declare const PickerView: React.NamedExoticComponent<PickerViewProps>;
|
|
@@ -19,6 +19,8 @@ var _bound = require("../../utils/bound");
|
|
|
19
19
|
|
|
20
20
|
var _isEqual = _interopRequireDefault(require("lodash/isEqual"));
|
|
21
21
|
|
|
22
|
+
var _ahooks = require("ahooks");
|
|
23
|
+
|
|
22
24
|
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
|
23
25
|
|
|
24
26
|
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); }
|
|
@@ -49,7 +51,7 @@ const Wheel = (0, _react.memo)(props => {
|
|
|
49
51
|
}
|
|
50
52
|
}));
|
|
51
53
|
const draggingRef = (0, _react.useRef)(false);
|
|
52
|
-
(0,
|
|
54
|
+
(0, _ahooks.useIsomorphicLayoutEffect)(() => {
|
|
53
55
|
if (draggingRef.current) return;
|
|
54
56
|
if (!value) return;
|
|
55
57
|
const targetIndex = column.findIndex(item => item.value === value);
|
|
@@ -60,7 +62,7 @@ const Wheel = (0, _react.memo)(props => {
|
|
|
60
62
|
immediate: y.goal !== finalPosition
|
|
61
63
|
});
|
|
62
64
|
}, [value, column]);
|
|
63
|
-
(0,
|
|
65
|
+
(0, _ahooks.useIsomorphicLayoutEffect)(() => {
|
|
64
66
|
if (column.length === 0) {
|
|
65
67
|
if (value !== null) {
|
|
66
68
|
onSelect(null);
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, "__esModule", {
|
|
4
|
+
value: true
|
|
5
|
+
});
|
|
6
|
+
exports.Arrow = void 0;
|
|
7
|
+
|
|
8
|
+
var _react = _interopRequireWildcard(require("react"));
|
|
9
|
+
|
|
10
|
+
var _nativeProps = require("../../utils/native-props");
|
|
11
|
+
|
|
12
|
+
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); }
|
|
13
|
+
|
|
14
|
+
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; }
|
|
15
|
+
|
|
16
|
+
const Arrow = (0, _react.memo)(props => {
|
|
17
|
+
return (0, _nativeProps.withNativeProps)(props, _react.default.createElement("svg", {
|
|
18
|
+
viewBox: '0 0 30 16'
|
|
19
|
+
}, _react.default.createElement("g", {
|
|
20
|
+
transform: 'translate(-1300.000000, -841.000000)',
|
|
21
|
+
fill: 'currentColor'
|
|
22
|
+
}, _react.default.createElement("path", {
|
|
23
|
+
d: 'M1300,841 L1330,841 L1318.07289,855.312538 C1316.65863,857.009645 1314.13637,857.238942 1312.43926,855.824685 C1312.25341,855.669808 1312.08199,855.49839 1311.92711,855.312538 L1300,841 L1300,841 Z'
|
|
24
|
+
}))));
|
|
25
|
+
});
|
|
26
|
+
exports.Arrow = Arrow;
|
|
@@ -1,31 +1,21 @@
|
|
|
1
1
|
/// <reference types="react" />
|
|
2
2
|
import './popover.less';
|
|
3
|
-
|
|
4
|
-
export type {
|
|
3
|
+
import './popover-menu.less';
|
|
4
|
+
export type { PopoverProps, PopoverRef } from './popover';
|
|
5
|
+
export type { PopoverMenuProps, Action } from './popover-menu';
|
|
5
6
|
declare const _default: import("react").ForwardRefExoticComponent<{
|
|
6
|
-
getContainer?: (() => HTMLElement) | undefined;
|
|
7
|
+
getContainer?: HTMLElement | (() => HTMLElement) | null | undefined;
|
|
7
8
|
destroyOnHide?: boolean | undefined;
|
|
8
9
|
children: import("react").ReactElement<any, string | ((props: any) => import("react").ReactElement<any, any> | null) | (new (props: any) => import("react").Component<any, any, any>)>;
|
|
9
10
|
mode?: "dark" | "light" | undefined;
|
|
10
11
|
trigger?: "click" | undefined;
|
|
11
|
-
placement
|
|
12
|
+
placement?: "left" | "right" | "bottom" | "top" | "topLeft" | "topRight" | "bottomLeft" | "bottomRight" | "leftTop" | "leftBottom" | "rightTop" | "rightBottom" | undefined;
|
|
12
13
|
stopPropagation?: "click"[] | undefined;
|
|
13
|
-
} & Pick<import("rc-tooltip/lib/Tooltip").TooltipProps, "visible" | "zIndex" | "align" | "defaultVisible" | "onVisibleChange" | "overlayStyle" | "overlayClassName"> & import("../../utils/native-props").NativeProps<"--z-index"> & {
|
|
14
14
|
content: import("react").ReactNode;
|
|
15
|
-
} & import("react").RefAttributes<import("./popover").PopoverRef>> & {
|
|
16
|
-
Menu:
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
mode?: "dark" | "light" | undefined;
|
|
21
|
-
trigger?: "click" | undefined;
|
|
22
|
-
placement: "left" | "right" | "bottom" | "top" | "topLeft" | "topRight" | "bottomLeft" | "bottomRight" | "leftTop" | "leftBottom" | "rightTop" | "rightBottom";
|
|
23
|
-
stopPropagation?: "click"[] | undefined;
|
|
24
|
-
} & Pick<import("rc-tooltip/lib/Tooltip").TooltipProps, "visible" | "zIndex" | "align" | "defaultVisible" | "onVisibleChange" | "overlayStyle" | "overlayClassName"> & import("../../utils/native-props").NativeProps<"--z-index"> & {
|
|
25
|
-
actions: T[];
|
|
26
|
-
onAction?: ((text: T) => void) | undefined;
|
|
27
|
-
} & {
|
|
28
|
-
ref?: ((instance: import("./popover").PopoverRef | null) => void) | import("react").RefObject<import("./popover").PopoverRef> | null | undefined;
|
|
29
|
-
}) => import("react").ReactElement<any, string | ((props: any) => import("react").ReactElement<any, any> | null) | (new (props: any) => import("react").Component<any, any, any>)>;
|
|
15
|
+
} & Pick<import("rc-tooltip/lib/Tooltip").TooltipProps, "visible" | "align" | "defaultVisible" | "onVisibleChange"> & import("../../utils/native-props").NativeProps<"--z-index"> & import("react").RefAttributes<import("./popover").PopoverRef>> & {
|
|
16
|
+
Menu: import("react").ForwardRefExoticComponent<Pick<import("./popover").PopoverProps, "children" | "style" | "visible" | "className" | "tabIndex" | "mode" | "align" | "getContainer" | "stopPropagation" | "trigger" | "defaultVisible" | "onVisibleChange" | "placement" | "destroyOnHide"> & {
|
|
17
|
+
actions: import("./popover-menu").Action[];
|
|
18
|
+
onAction?: ((item: import("./popover-menu").Action) => void) | undefined;
|
|
19
|
+
} & import("react").RefAttributes<import("./popover").PopoverRef>>;
|
|
30
20
|
};
|
|
31
21
|
export default _default;
|
|
@@ -7,14 +7,16 @@ exports.default = void 0;
|
|
|
7
7
|
|
|
8
8
|
require("./popover.css");
|
|
9
9
|
|
|
10
|
+
require("./popover-menu.css");
|
|
11
|
+
|
|
10
12
|
var _attachPropertiesToComponent = require("../../utils/attach-properties-to-component");
|
|
11
13
|
|
|
12
|
-
var
|
|
14
|
+
var _popoverMenu2 = require("./popover-menu");
|
|
13
15
|
|
|
14
16
|
var _popover2 = require("./popover");
|
|
15
17
|
|
|
16
18
|
var _default = (0, _attachPropertiesToComponent.attachPropertiesToComponent)(_popover2.Popover, {
|
|
17
|
-
Menu:
|
|
19
|
+
Menu: _popoverMenu2.PopoverMenu
|
|
18
20
|
});
|
|
19
21
|
|
|
20
22
|
exports.default = _default;
|
|
@@ -0,0 +1,63 @@
|
|
|
1
|
+
.adm-popover-menu {
|
|
2
|
+
--border-color: var(--adm-border-color);
|
|
3
|
+
}
|
|
4
|
+
|
|
5
|
+
.adm-popover-menu.adm-popover {
|
|
6
|
+
--content-padding: 0;
|
|
7
|
+
}
|
|
8
|
+
|
|
9
|
+
.adm-popover-menu-list {
|
|
10
|
+
overflow: hidden;
|
|
11
|
+
min-width: 240px;
|
|
12
|
+
}
|
|
13
|
+
|
|
14
|
+
.adm-popover-menu-list-inner {
|
|
15
|
+
margin-top: -2px;
|
|
16
|
+
}
|
|
17
|
+
|
|
18
|
+
.adm-popover-menu-item {
|
|
19
|
+
display: flex;
|
|
20
|
+
padding-left: 40px;
|
|
21
|
+
justify-content: flex-start;
|
|
22
|
+
align-items: center;
|
|
23
|
+
position: relative;
|
|
24
|
+
}
|
|
25
|
+
|
|
26
|
+
.adm-popover-menu-item-icon {
|
|
27
|
+
flex: none;
|
|
28
|
+
padding-right: 16px;
|
|
29
|
+
font-size: 40px;
|
|
30
|
+
}
|
|
31
|
+
|
|
32
|
+
.adm-popover-menu-item-text {
|
|
33
|
+
flex: auto;
|
|
34
|
+
padding: 28px 40px 28px 0;
|
|
35
|
+
border-top: solid 2px var(--border-color);
|
|
36
|
+
}
|
|
37
|
+
|
|
38
|
+
.adm-popover-menu-item-disabled {
|
|
39
|
+
cursor: not-allowed;
|
|
40
|
+
}
|
|
41
|
+
|
|
42
|
+
.adm-popover-menu-item-disabled > * {
|
|
43
|
+
opacity: 0.4;
|
|
44
|
+
}
|
|
45
|
+
|
|
46
|
+
.adm-popover-menu-item:active:not(.adm-popover-menu-item-disabled) {
|
|
47
|
+
background-color: var(--border-color);
|
|
48
|
+
}
|
|
49
|
+
|
|
50
|
+
.adm-popover-menu-item:active:not(.adm-popover-menu-item-disabled)::after {
|
|
51
|
+
content: ' ';
|
|
52
|
+
display: block;
|
|
53
|
+
position: absolute;
|
|
54
|
+
width: 100%;
|
|
55
|
+
bottom: -2px;
|
|
56
|
+
left: 0;
|
|
57
|
+
border-bottom: solid 2px var(--border-color);
|
|
58
|
+
}
|
|
59
|
+
|
|
60
|
+
.adm-popover.adm-popover-dark.adm-popover-menu {
|
|
61
|
+
--border-color: #333333;
|
|
62
|
+
--background: rgba(0, 0, 0, 0.9);
|
|
63
|
+
}
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
import { PopoverProps, PopoverRef } from './popover';
|
|
3
|
+
export declare type Action = {
|
|
4
|
+
text: React.ReactNode;
|
|
5
|
+
icon?: React.ReactNode;
|
|
6
|
+
disabled?: boolean;
|
|
7
|
+
key?: string | number;
|
|
8
|
+
onClick?: () => void;
|
|
9
|
+
};
|
|
10
|
+
export declare type PopoverMenuProps = Omit<PopoverProps, 'content'> & {
|
|
11
|
+
actions: Action[];
|
|
12
|
+
onAction?: (item: Action) => void;
|
|
13
|
+
};
|
|
14
|
+
export declare const PopoverMenu: React.ForwardRefExoticComponent<Pick<PopoverProps, "children" | "style" | "visible" | "className" | "tabIndex" | "mode" | "align" | "getContainer" | "stopPropagation" | "trigger" | "defaultVisible" | "onVisibleChange" | "placement" | "destroyOnHide"> & {
|
|
15
|
+
actions: Action[];
|
|
16
|
+
onAction?: ((item: Action) => void) | undefined;
|
|
17
|
+
} & React.RefAttributes<PopoverRef>>;
|
|
@@ -3,14 +3,12 @@
|
|
|
3
3
|
Object.defineProperty(exports, "__esModule", {
|
|
4
4
|
value: true
|
|
5
5
|
});
|
|
6
|
-
exports.
|
|
6
|
+
exports.PopoverMenu = void 0;
|
|
7
7
|
|
|
8
8
|
var _react = _interopRequireWildcard(require("react"));
|
|
9
9
|
|
|
10
10
|
var _classnames = _interopRequireDefault(require("classnames"));
|
|
11
11
|
|
|
12
|
-
var _button = _interopRequireDefault(require("../button"));
|
|
13
|
-
|
|
14
12
|
var _popover = require("./popover");
|
|
15
13
|
|
|
16
14
|
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
|
@@ -19,8 +17,8 @@ function _getRequireWildcardCache(nodeInterop) { if (typeof WeakMap !== "functio
|
|
|
19
17
|
|
|
20
18
|
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; }
|
|
21
19
|
|
|
22
|
-
const classPrefix = `adm-popover`;
|
|
23
|
-
const
|
|
20
|
+
const classPrefix = `adm-popover-menu`;
|
|
21
|
+
const PopoverMenu = (0, _react.forwardRef)((props, ref) => {
|
|
24
22
|
const innerRef = (0, _react.useRef)(null);
|
|
25
23
|
(0, _react.useImperativeHandle)(ref, () => innerRef.current, []);
|
|
26
24
|
const onClick = (0, _react.useCallback)(e => {
|
|
@@ -37,36 +35,35 @@ const PopMenu = (0, _react.forwardRef)((props, ref) => {
|
|
|
37
35
|
(_a = innerRef.current) === null || _a === void 0 ? void 0 : _a.hide();
|
|
38
36
|
}, [props.onAction]);
|
|
39
37
|
const overlay = (0, _react.useMemo)(() => {
|
|
40
|
-
return _react.default.createElement(
|
|
38
|
+
return _react.default.createElement("div", {
|
|
39
|
+
className: `${classPrefix}-list`
|
|
40
|
+
}, _react.default.createElement("div", {
|
|
41
|
+
className: `${classPrefix}-list-inner`
|
|
42
|
+
}, props.actions.map((action, index) => {
|
|
41
43
|
var _a;
|
|
42
44
|
|
|
43
|
-
return _react.default.createElement("
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
}),
|
|
47
|
-
key: (_a = ele.key) !== null && _a !== void 0 ? _a : index
|
|
48
|
-
}, _react.default.createElement(_button.default, {
|
|
49
|
-
disabled: ele.disabled,
|
|
45
|
+
return _react.default.createElement("a", {
|
|
46
|
+
key: (_a = action.key) !== null && _a !== void 0 ? _a : index,
|
|
47
|
+
className: (0, _classnames.default)(`${classPrefix}-item`, 'adm-plain-anchor', action.disabled && `${classPrefix}-item-disabled`),
|
|
50
48
|
onClick: () => {
|
|
51
49
|
var _a;
|
|
52
50
|
|
|
53
|
-
if (
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
}));
|
|
51
|
+
if (action.disabled) return;
|
|
52
|
+
onClick(action);
|
|
53
|
+
(_a = action.onClick) === null || _a === void 0 ? void 0 : _a.call(action);
|
|
54
|
+
}
|
|
55
|
+
}, action.icon && _react.default.createElement("div", {
|
|
56
|
+
className: `${classPrefix}-item-icon`
|
|
57
|
+
}, action.icon), _react.default.createElement("div", {
|
|
58
|
+
className: `${classPrefix}-item-text`
|
|
59
|
+
}, action.text));
|
|
60
|
+
})));
|
|
64
61
|
}, [props.actions, onClick]);
|
|
65
62
|
return _react.default.createElement(_popover.Popover, Object.assign({
|
|
66
63
|
ref: innerRef
|
|
67
64
|
}, props, {
|
|
68
|
-
|
|
65
|
+
className: (0, _classnames.default)(classPrefix, props.className),
|
|
69
66
|
content: overlay
|
|
70
67
|
}), props.children);
|
|
71
68
|
});
|
|
72
|
-
exports.
|
|
69
|
+
exports.PopoverMenu = PopoverMenu;
|