@rc-component/select 1.2.3 → 1.2.4
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/es/Select.d.ts
CHANGED
|
@@ -125,7 +125,7 @@ export interface SelectProps<ValueType = any, OptionType extends BaseOptionType
|
|
|
125
125
|
classNames?: Partial<Record<SemanticName, string>>;
|
|
126
126
|
styles?: Partial<Record<SemanticName, React.CSSProperties>>;
|
|
127
127
|
}
|
|
128
|
-
declare const TypedSelect: (<ValueType = any, OptionType extends
|
|
128
|
+
declare const TypedSelect: (<ValueType = any, OptionType extends DefaultOptionType | BaseOptionType = DefaultOptionType>(props: React.PropsWithChildren<SelectProps<ValueType, OptionType>> & React.RefAttributes<BaseSelectRef>) => React.ReactElement) & {
|
|
129
129
|
Option: typeof Option;
|
|
130
130
|
OptGroup: typeof OptGroup;
|
|
131
131
|
};
|
package/es/SelectInput/index.js
CHANGED
|
@@ -107,6 +107,11 @@ export default /*#__PURE__*/React.forwardRef(function SelectInput(props, ref) {
|
|
|
107
107
|
// ====================== Open ======================
|
|
108
108
|
const onInternalMouseDown = useEvent(event => {
|
|
109
109
|
if (!disabled) {
|
|
110
|
+
// https://github.com/ant-design/ant-design/issues/56002
|
|
111
|
+
// Tell `useSelectTriggerControl` to ignore this event
|
|
112
|
+
// When icon is dynamic render, the parentNode will miss
|
|
113
|
+
// so we need to mark the event directly
|
|
114
|
+
event.nativeEvent._ignore_global_close = true;
|
|
110
115
|
const inputDOM = getDOM(inputRef.current);
|
|
111
116
|
if (inputDOM && event.target !== inputDOM && !inputDOM.contains(event.target)) {
|
|
112
117
|
event.preventDefault();
|
|
@@ -10,7 +10,9 @@ export default function useSelectTriggerControl(elements, open, triggerOpen, cus
|
|
|
10
10
|
if (target.shadowRoot && event.composed) {
|
|
11
11
|
target = event.composedPath()[0] || target;
|
|
12
12
|
}
|
|
13
|
-
if (open &&
|
|
13
|
+
if (open &&
|
|
14
|
+
// Marked by SelectInput mouseDown event
|
|
15
|
+
!event._ignore_global_close && elements().filter(element => element).every(element => !element.contains(target) && element !== target)) {
|
|
14
16
|
// Should trigger close
|
|
15
17
|
triggerOpen(false);
|
|
16
18
|
}
|
package/lib/Select.d.ts
CHANGED
|
@@ -125,7 +125,7 @@ export interface SelectProps<ValueType = any, OptionType extends BaseOptionType
|
|
|
125
125
|
classNames?: Partial<Record<SemanticName, string>>;
|
|
126
126
|
styles?: Partial<Record<SemanticName, React.CSSProperties>>;
|
|
127
127
|
}
|
|
128
|
-
declare const TypedSelect: (<ValueType = any, OptionType extends
|
|
128
|
+
declare const TypedSelect: (<ValueType = any, OptionType extends DefaultOptionType | BaseOptionType = DefaultOptionType>(props: React.PropsWithChildren<SelectProps<ValueType, OptionType>> & React.RefAttributes<BaseSelectRef>) => React.ReactElement) & {
|
|
129
129
|
Option: typeof Option;
|
|
130
130
|
OptGroup: typeof OptGroup;
|
|
131
131
|
};
|
package/lib/SelectInput/index.js
CHANGED
|
@@ -116,6 +116,11 @@ var _default = exports.default = /*#__PURE__*/React.forwardRef(function SelectIn
|
|
|
116
116
|
// ====================== Open ======================
|
|
117
117
|
const onInternalMouseDown = (0, _util.useEvent)(event => {
|
|
118
118
|
if (!disabled) {
|
|
119
|
+
// https://github.com/ant-design/ant-design/issues/56002
|
|
120
|
+
// Tell `useSelectTriggerControl` to ignore this event
|
|
121
|
+
// When icon is dynamic render, the parentNode will miss
|
|
122
|
+
// so we need to mark the event directly
|
|
123
|
+
event.nativeEvent._ignore_global_close = true;
|
|
119
124
|
const inputDOM = (0, _findDOMNode.getDOM)(inputRef.current);
|
|
120
125
|
if (inputDOM && event.target !== inputDOM && !inputDOM.contains(event.target)) {
|
|
121
126
|
event.preventDefault();
|
|
@@ -18,7 +18,9 @@ function useSelectTriggerControl(elements, open, triggerOpen, customizedTrigger)
|
|
|
18
18
|
if (target.shadowRoot && event.composed) {
|
|
19
19
|
target = event.composedPath()[0] || target;
|
|
20
20
|
}
|
|
21
|
-
if (open &&
|
|
21
|
+
if (open &&
|
|
22
|
+
// Marked by SelectInput mouseDown event
|
|
23
|
+
!event._ignore_global_close && elements().filter(element => element).every(element => !element.contains(target) && element !== target)) {
|
|
22
24
|
// Should trigger close
|
|
23
25
|
triggerOpen(false);
|
|
24
26
|
}
|