@aloudata/aloudata-design 2.17.4 → 2.17.5
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/AldSelect/BaseSelect.js +19 -9
- package/dist/AldSelect/components/SearchBox.js +1 -0
- package/dist/AldSelect/index.js +13 -4
- package/dist/AldSelect/interface.d.ts +1 -0
- package/dist/AldSelect/utils/commonUtil.d.ts +1 -0
- package/dist/AldSelect/utils/commonUtil.js +3 -0
- package/dist/Modal/style/polyfill/index.less +6 -9
- package/dist/ald.min.css +1 -1
- package/package.json +1 -1
|
@@ -136,14 +136,13 @@ var BaseSelect = /*#__PURE__*/React.forwardRef(function (props, ref) {
|
|
|
136
136
|
var nextOpen = newOpen !== undefined ? newOpen : !mergedOpen;
|
|
137
137
|
if (!nextOpen) {
|
|
138
138
|
setShowResponsiveSelectedSection(false);
|
|
139
|
-
setInnerSearchValue === null || setInnerSearchValue === void 0 ? void 0 : setInnerSearchValue('');
|
|
140
139
|
setFocus(false);
|
|
141
140
|
}
|
|
142
141
|
if (mergedOpen !== nextOpen && !disabled) {
|
|
143
142
|
setInnerOpen(nextOpen);
|
|
144
143
|
onOpenChange === null || onOpenChange === void 0 ? void 0 : onOpenChange(nextOpen);
|
|
145
144
|
}
|
|
146
|
-
}, [mergedOpen, disabled,
|
|
145
|
+
}, [mergedOpen, disabled, setInnerOpen, onOpenChange]);
|
|
147
146
|
var _useState5 = useState(false),
|
|
148
147
|
_useState6 = _slicedToArray(_useState5, 2),
|
|
149
148
|
showResponsiveSelectedSection = _useState6[0],
|
|
@@ -190,18 +189,29 @@ var BaseSelect = /*#__PURE__*/React.forwardRef(function (props, ref) {
|
|
|
190
189
|
}
|
|
191
190
|
onClick === null || onClick === void 0 ? void 0 : onClick(e);
|
|
192
191
|
}, [disabled, onClick]);
|
|
192
|
+
React.useEffect(function () {
|
|
193
|
+
var element = selectRef.current;
|
|
194
|
+
if (element) {
|
|
195
|
+
var handleMouseOver = function handleMouseOver() {
|
|
196
|
+
return setIsHover(true);
|
|
197
|
+
};
|
|
198
|
+
var handleMouseOut = function handleMouseOut() {
|
|
199
|
+
return setIsHover(false);
|
|
200
|
+
};
|
|
201
|
+
element.addEventListener('mouseover', handleMouseOver);
|
|
202
|
+
element.addEventListener('mouseout', handleMouseOut);
|
|
203
|
+
return function () {
|
|
204
|
+
element.removeEventListener('mouseover', handleMouseOver);
|
|
205
|
+
element.removeEventListener('mouseout', handleMouseOut);
|
|
206
|
+
};
|
|
207
|
+
}
|
|
208
|
+
}, []);
|
|
193
209
|
return /*#__PURE__*/React.createElement("div", {
|
|
194
210
|
className: mergedClassName,
|
|
195
211
|
style: _objectSpread(_objectSpread({}, widthStyle), style),
|
|
196
212
|
ref: selectRef,
|
|
197
213
|
id: id,
|
|
198
|
-
onClick: onSelectClick
|
|
199
|
-
onMouseEnter: function onMouseEnter() {
|
|
200
|
-
setIsHover(true);
|
|
201
|
-
},
|
|
202
|
-
onMouseLeave: function onMouseLeave() {
|
|
203
|
-
setIsHover(false);
|
|
204
|
-
}
|
|
214
|
+
onClick: onSelectClick
|
|
205
215
|
}, /*#__PURE__*/React.createElement(SelectTrigger, {
|
|
206
216
|
open: !!mergedOpen,
|
|
207
217
|
notFoundContent: notFoundContent,
|
package/dist/AldSelect/index.js
CHANGED
|
@@ -18,7 +18,7 @@ function _arrayWithHoles(arr) { if (Array.isArray(arr)) return arr; }
|
|
|
18
18
|
import React, { forwardRef, useCallback, useContext, useMemo } from 'react';
|
|
19
19
|
import useOptions, { isRawValue } from "./hooks/useOptions";
|
|
20
20
|
import useMergedState from 'rc-util/lib/hooks/useMergedState';
|
|
21
|
-
import { toArray } from "./utils/commonUtil";
|
|
21
|
+
import { noOpFilter, toArray } from "./utils/commonUtil";
|
|
22
22
|
import useCache from "./hooks/useCache";
|
|
23
23
|
import BaseSelect, { isMultiple } from "./BaseSelect";
|
|
24
24
|
import { injectPropsWithOption } from "./utils/valueUtil";
|
|
@@ -33,6 +33,7 @@ export default /*#__PURE__*/forwardRef(function AldSelect(props, ref) {
|
|
|
33
33
|
options = props.options,
|
|
34
34
|
onChange = props.onChange,
|
|
35
35
|
onSelect = props.onSelect,
|
|
36
|
+
onSearch = props.onSearch,
|
|
36
37
|
onDeselect = props.onDeselect,
|
|
37
38
|
labelInValue = props.labelInValue,
|
|
38
39
|
filterOption = props.filterOption,
|
|
@@ -205,6 +206,12 @@ export default /*#__PURE__*/forwardRef(function AldSelect(props, ref) {
|
|
|
205
206
|
});
|
|
206
207
|
}
|
|
207
208
|
};
|
|
209
|
+
var handleSearch = function handleSearch(value) {
|
|
210
|
+
setInnerSearchValue(value);
|
|
211
|
+
if (onSearch) {
|
|
212
|
+
onSearch(value);
|
|
213
|
+
}
|
|
214
|
+
};
|
|
208
215
|
var selectMenu = useMemo(function () {
|
|
209
216
|
return _objectSpread(_objectSpread({}, mergedMenu), {}, {
|
|
210
217
|
items: (mergedMenu === null || mergedMenu === void 0 ? void 0 : mergedMenu.items) || [],
|
|
@@ -229,14 +236,16 @@ export default /*#__PURE__*/forwardRef(function AldSelect(props, ref) {
|
|
|
229
236
|
}
|
|
230
237
|
});
|
|
231
238
|
}, [mergedMenu, mode, displayValues, triggerChange]);
|
|
232
|
-
var displayMenu = useDisplayMenu(selectMenu,
|
|
239
|
+
var displayMenu = useDisplayMenu(selectMenu,
|
|
240
|
+
// 如果用户接管了搜索,则默认不做搜索过滤
|
|
241
|
+
onSearch ? filterOption || noOpFilter : filterOption, innerSearchValue);
|
|
233
242
|
return /*#__PURE__*/React.createElement(BaseSelect, _extends({}, props, {
|
|
234
243
|
ref: ref,
|
|
235
244
|
disabled: mergedDisabled,
|
|
236
245
|
displayValues: displayValues,
|
|
237
246
|
onDisplayValuesChange: onDisplayValuesChange,
|
|
238
|
-
setInnerSearchValue:
|
|
239
|
-
innerSearchValue: innerSearchValue,
|
|
247
|
+
setInnerSearchValue: handleSearch,
|
|
248
|
+
innerSearchValue: searchValue === undefined ? innerSearchValue : searchValue,
|
|
240
249
|
onOptionSelect: onOptionSelect,
|
|
241
250
|
menu: selectMenu,
|
|
242
251
|
displayMenu: displayMenu
|
|
@@ -42,6 +42,7 @@ export interface ISelectProps<ValueType = any, OptionType extends BaseOptionType
|
|
|
42
42
|
onSelect?: SelectHandler<ArrayElementType<ValueType>, OptionType>;
|
|
43
43
|
onDeselect?: SelectHandler<ArrayElementType<ValueType>, OptionType>;
|
|
44
44
|
notFoundContent?: React.ReactNode;
|
|
45
|
+
onSearch?: (value: string) => void;
|
|
45
46
|
filterOption?: (inputValue: string, option: OptionType) => boolean;
|
|
46
47
|
tagRender?: (props: CustomTagProps, isPreview?: boolean) => React.ReactNode;
|
|
47
48
|
maxTagPlaceholder?: React.ReactNode | ((omittedValues: DisplayValueType[]) => React.ReactNode);
|
|
@@ -6,3 +6,4 @@ export declare const toString: (value: any) => string;
|
|
|
6
6
|
/** Is client side and not jsdom */
|
|
7
7
|
export declare const isBrowserClient: false | HTMLElement;
|
|
8
8
|
export declare function convertOptionsToMenu(options: DefaultOptionType[], selectedKeys: React.Key[]): SelectMenuProps;
|
|
9
|
+
export declare function noOpFilter(): boolean;
|
|
@@ -13,15 +13,12 @@
|
|
|
13
13
|
}
|
|
14
14
|
|
|
15
15
|
.ant-modal-wrap {
|
|
16
|
-
position: fixed;
|
|
17
|
-
inset: 0;
|
|
18
|
-
top: 0;
|
|
19
|
-
inset-inline-end: 0;
|
|
20
|
-
bottom: 0;
|
|
21
|
-
inset-inline-start: 0;
|
|
22
|
-
overflow: auto;
|
|
23
16
|
outline: 0;
|
|
24
17
|
z-index: 1000;
|
|
18
|
+
display: grid;
|
|
19
|
+
grid-template-rows: minmax(0, 100px) auto 1fr;
|
|
20
|
+
place-items: center;
|
|
21
|
+
height: 100vh;
|
|
25
22
|
}
|
|
26
23
|
|
|
27
24
|
.ant-modal.ald-modal {
|
|
@@ -34,10 +31,10 @@
|
|
|
34
31
|
list-style: none;
|
|
35
32
|
pointer-events: none;
|
|
36
33
|
position: relative;
|
|
37
|
-
|
|
34
|
+
grid-row: 2;
|
|
35
|
+
top: 0;
|
|
38
36
|
width: auto;
|
|
39
37
|
max-width: calc(100vw - 32px);
|
|
40
|
-
padding-bottom: 24px;
|
|
41
38
|
}
|
|
42
39
|
|
|
43
40
|
.ant-modal-content {
|