@rc-component/select 1.0.1 → 1.0.2
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/BaseSelect/index.d.ts +6 -5
- package/es/BaseSelect/index.js +13 -15
- package/es/Select.d.ts +1 -1
- package/es/Select.js +9 -4
- package/es/SelectContext.d.ts +3 -0
- package/es/SelectContext.js +3 -0
- package/es/Selector/Input.js +2 -2
- package/lib/BaseSelect/index.d.ts +6 -5
- package/lib/BaseSelect/index.js +11 -13
- package/lib/Select.d.ts +1 -1
- package/lib/Select.js +9 -4
- package/lib/SelectContext.d.ts +3 -0
- package/lib/SelectContext.js +3 -0
- package/lib/Selector/Input.js +2 -2
- package/package.json +1 -1
package/es/BaseSelect/index.d.ts
CHANGED
|
@@ -56,17 +56,18 @@ export interface BaseSelectProps extends BaseSelectPrivateProps, React.AriaAttri
|
|
|
56
56
|
style?: React.CSSProperties;
|
|
57
57
|
classNames?: Partial<Record<BaseSelectSemanticName, string>>;
|
|
58
58
|
styles?: Partial<Record<BaseSelectSemanticName, React.CSSProperties>>;
|
|
59
|
-
title?: string;
|
|
60
59
|
showSearch?: boolean;
|
|
61
60
|
tagRender?: (props: CustomTagProps) => React.ReactElement;
|
|
62
61
|
direction?: 'ltr' | 'rtl';
|
|
63
|
-
maxLength?: number;
|
|
64
|
-
showScrollBar?: boolean | 'optional';
|
|
65
|
-
tabIndex?: number;
|
|
66
62
|
autoFocus?: boolean;
|
|
67
|
-
notFoundContent?: React.ReactNode;
|
|
68
63
|
placeholder?: React.ReactNode;
|
|
64
|
+
maxCount?: number;
|
|
65
|
+
title?: string;
|
|
66
|
+
tabIndex?: number;
|
|
67
|
+
notFoundContent?: React.ReactNode;
|
|
69
68
|
onClear?: () => void;
|
|
69
|
+
maxLength?: number;
|
|
70
|
+
showScrollBar?: boolean | 'optional';
|
|
70
71
|
choiceTransitionName?: string;
|
|
71
72
|
mode?: Mode;
|
|
72
73
|
disabled?: boolean;
|
package/es/BaseSelect/index.js
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
function _extends() { _extends = Object.assign ? Object.assign.bind() : function (target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { target[key] = source[key]; } } } return target; }; return _extends.apply(this, arguments); }
|
|
2
|
-
import
|
|
2
|
+
import cls from 'classnames';
|
|
3
3
|
import useLayoutEffect from "@rc-component/util/es/hooks/useLayoutEffect";
|
|
4
4
|
import useMergedState from "@rc-component/util/es/hooks/useMergedState";
|
|
5
5
|
import isMobile from "@rc-component/util/es/isMobile";
|
|
@@ -14,7 +14,6 @@ import Selector from "../Selector";
|
|
|
14
14
|
import SelectTrigger from "../SelectTrigger";
|
|
15
15
|
import TransBtn from "../TransBtn";
|
|
16
16
|
import { getSeparatedContent, isValidCount } from "../utils/valueUtil";
|
|
17
|
-
import SelectContext from "../SelectContext";
|
|
18
17
|
import Polite from "./Polite";
|
|
19
18
|
const DEFAULT_OMIT_PROPS = ['value', 'onChange', 'removeIcon', 'placeholder', 'autoFocus', 'maxTagCount', 'maxTagTextLength', 'maxTagPlaceholder', 'choiceTransitionName', 'onInputKeyDown', 'onPopupScroll', 'tabIndex'];
|
|
20
19
|
export const isMultiple = mode => mode === 'tags' || mode === 'multiple';
|
|
@@ -23,6 +22,8 @@ const BaseSelect = /*#__PURE__*/React.forwardRef((props, ref) => {
|
|
|
23
22
|
id,
|
|
24
23
|
prefixCls,
|
|
25
24
|
className,
|
|
25
|
+
styles,
|
|
26
|
+
classNames,
|
|
26
27
|
showSearch,
|
|
27
28
|
tagRender,
|
|
28
29
|
showScrollBar = 'optional',
|
|
@@ -34,6 +35,7 @@ const BaseSelect = /*#__PURE__*/React.forwardRef((props, ref) => {
|
|
|
34
35
|
emptyOptions,
|
|
35
36
|
notFoundContent = 'Not Found',
|
|
36
37
|
onClear,
|
|
38
|
+
maxCount,
|
|
37
39
|
// Mode
|
|
38
40
|
mode,
|
|
39
41
|
// Status
|
|
@@ -171,20 +173,14 @@ const BaseSelect = /*#__PURE__*/React.forwardRef((props, ref) => {
|
|
|
171
173
|
|
|
172
174
|
// ============================= Search =============================
|
|
173
175
|
const tokenWithEnter = React.useMemo(() => (tokenSeparators || []).some(tokenSeparator => ['\n', '\r\n'].includes(tokenSeparator)), [tokenSeparators]);
|
|
174
|
-
const {
|
|
175
|
-
maxCount,
|
|
176
|
-
rawValues,
|
|
177
|
-
classNames: selectClassNames,
|
|
178
|
-
styles
|
|
179
|
-
} = React.useContext(SelectContext) || {};
|
|
180
176
|
const onInternalSearch = (searchText, fromTyping, isCompositing) => {
|
|
181
|
-
if (multiple && isValidCount(maxCount) &&
|
|
177
|
+
if (multiple && isValidCount(maxCount) && displayValues.length >= maxCount) {
|
|
182
178
|
return;
|
|
183
179
|
}
|
|
184
180
|
let ret = true;
|
|
185
181
|
let newSearchText = searchText;
|
|
186
182
|
onActiveValueChange?.(null);
|
|
187
|
-
const separatedList = getSeparatedContent(searchText, tokenSeparators, isValidCount(maxCount) ? maxCount -
|
|
183
|
+
const separatedList = getSeparatedContent(searchText, tokenSeparators, isValidCount(maxCount) ? maxCount - displayValues.length : undefined);
|
|
188
184
|
|
|
189
185
|
// Check if match the `tokenSeparators`
|
|
190
186
|
const patchLabels = isCompositing ? null : separatedList;
|
|
@@ -426,8 +422,10 @@ const BaseSelect = /*#__PURE__*/React.forwardRef((props, ref) => {
|
|
|
426
422
|
showSearch: mergedShowSearch,
|
|
427
423
|
multiple,
|
|
428
424
|
toggleOpen: onToggleOpen,
|
|
429
|
-
showScrollBar
|
|
430
|
-
|
|
425
|
+
showScrollBar,
|
|
426
|
+
styles,
|
|
427
|
+
classNames
|
|
428
|
+
}), [props, notFoundContent, triggerOpen, mergedOpen, id, mergedShowSearch, multiple, onToggleOpen, showScrollBar, styles, classNames]);
|
|
431
429
|
|
|
432
430
|
// ==================================================================
|
|
433
431
|
// == Render ==
|
|
@@ -438,7 +436,7 @@ const BaseSelect = /*#__PURE__*/React.forwardRef((props, ref) => {
|
|
|
438
436
|
let arrowNode;
|
|
439
437
|
if (showSuffixIcon) {
|
|
440
438
|
arrowNode = /*#__PURE__*/React.createElement(TransBtn, {
|
|
441
|
-
className:
|
|
439
|
+
className: cls(`${prefixCls}-arrow`, classNames?.suffix, {
|
|
442
440
|
[`${prefixCls}-arrow-loading`]: loading
|
|
443
441
|
}),
|
|
444
442
|
style: styles?.suffix,
|
|
@@ -474,7 +472,7 @@ const BaseSelect = /*#__PURE__*/React.forwardRef((props, ref) => {
|
|
|
474
472
|
});
|
|
475
473
|
|
|
476
474
|
// ============================= Select =============================
|
|
477
|
-
const mergedClassName =
|
|
475
|
+
const mergedClassName = cls(prefixCls, className, {
|
|
478
476
|
[`${prefixCls}-focused`]: mockFocused,
|
|
479
477
|
[`${prefixCls}-multiple`]: multiple,
|
|
480
478
|
[`${prefixCls}-single`]: !multiple,
|
|
@@ -516,7 +514,7 @@ const BaseSelect = /*#__PURE__*/React.forwardRef((props, ref) => {
|
|
|
516
514
|
}, customizeRawInputElement ? ( /*#__PURE__*/React.cloneElement(customizeRawInputElement, {
|
|
517
515
|
ref: customizeRawInputRef
|
|
518
516
|
})) : /*#__PURE__*/React.createElement(Selector, _extends({}, props, {
|
|
519
|
-
prefixClassName:
|
|
517
|
+
prefixClassName: classNames?.prefix,
|
|
520
518
|
prefixStyle: styles?.prefix,
|
|
521
519
|
domRef: selectorDomRef,
|
|
522
520
|
prefixCls: prefixCls,
|
package/es/Select.d.ts
CHANGED
|
@@ -108,7 +108,7 @@ export interface SelectProps<ValueType = any, OptionType extends BaseOptionType
|
|
|
108
108
|
classNames?: Partial<Record<SemanticName, string>>;
|
|
109
109
|
styles?: Partial<Record<SemanticName, React.CSSProperties>>;
|
|
110
110
|
}
|
|
111
|
-
declare const TypedSelect: (<ValueType = any, OptionType extends
|
|
111
|
+
declare const TypedSelect: (<ValueType = any, OptionType extends DefaultOptionType | BaseOptionType = DefaultOptionType>(props: SelectProps<ValueType, OptionType> & {
|
|
112
112
|
children?: React.ReactNode;
|
|
113
113
|
} & React.RefAttributes<BaseSelectRef>) => React.ReactElement) & {
|
|
114
114
|
Option: typeof Option;
|
package/es/Select.js
CHANGED
|
@@ -86,7 +86,7 @@ const Select = /*#__PURE__*/React.forwardRef((props, ref) => {
|
|
|
86
86
|
labelInValue,
|
|
87
87
|
onChange,
|
|
88
88
|
maxCount,
|
|
89
|
-
classNames
|
|
89
|
+
classNames,
|
|
90
90
|
styles,
|
|
91
91
|
...restProps
|
|
92
92
|
} = props;
|
|
@@ -428,10 +428,10 @@ const Select = /*#__PURE__*/React.forwardRef((props, ref) => {
|
|
|
428
428
|
childrenAsData,
|
|
429
429
|
maxCount,
|
|
430
430
|
optionRender,
|
|
431
|
-
classNames
|
|
431
|
+
classNames,
|
|
432
432
|
styles
|
|
433
433
|
};
|
|
434
|
-
}, [
|
|
434
|
+
}, [maxCount, parsedOptions, displayOptions, onActiveValue, mergedDefaultActiveFirstOption, onInternalSelect, menuItemSelectedIcon, rawValues, mergedFieldNames, virtual, popupMatchSelectWidth, direction, listHeight, listItemHeight, childrenAsData, optionRender, classNames, styles]);
|
|
435
435
|
|
|
436
436
|
// ========================== Warning ===========================
|
|
437
437
|
if (process.env.NODE_ENV !== 'production') {
|
|
@@ -451,10 +451,15 @@ const Select = /*#__PURE__*/React.forwardRef((props, ref) => {
|
|
|
451
451
|
ref: ref,
|
|
452
452
|
omitDomProps: OMIT_DOM_PROPS,
|
|
453
453
|
mode: mode
|
|
454
|
+
// >>> Style
|
|
455
|
+
,
|
|
456
|
+
classNames: classNames,
|
|
457
|
+
styles: styles
|
|
454
458
|
// >>> Values
|
|
455
459
|
,
|
|
456
460
|
displayValues: displayValues,
|
|
457
|
-
onDisplayValuesChange: onDisplayValuesChange
|
|
461
|
+
onDisplayValuesChange: onDisplayValuesChange,
|
|
462
|
+
maxCount: maxCount
|
|
458
463
|
// >>> Trigger
|
|
459
464
|
,
|
|
460
465
|
direction: direction
|
package/es/SelectContext.d.ts
CHANGED
|
@@ -2,6 +2,9 @@ import * as React from 'react';
|
|
|
2
2
|
import type { RawValueType, RenderNode } from './BaseSelect';
|
|
3
3
|
import type { BaseOptionType, FieldNames, OnActiveValue, OnInternalSelect, SelectProps, SemanticName } from './Select';
|
|
4
4
|
import type { FlattenOptionData } from './interface';
|
|
5
|
+
/**
|
|
6
|
+
* SelectContext is only used for Select. BaseSelect should not consume this context.
|
|
7
|
+
*/
|
|
5
8
|
export interface SelectContextProps {
|
|
6
9
|
classNames?: Partial<Record<SemanticName, string>>;
|
|
7
10
|
styles?: Partial<Record<SemanticName, React.CSSProperties>>;
|
package/es/SelectContext.js
CHANGED
|
@@ -1,6 +1,9 @@
|
|
|
1
1
|
import * as React from 'react';
|
|
2
2
|
|
|
3
3
|
// Use any here since we do not get the type during compilation
|
|
4
|
+
/**
|
|
5
|
+
* SelectContext is only used for Select. BaseSelect should not consume this context.
|
|
6
|
+
*/
|
|
4
7
|
|
|
5
8
|
const SelectContext = /*#__PURE__*/React.createContext(null);
|
|
6
9
|
export default SelectContext;
|
package/es/Selector/Input.js
CHANGED
|
@@ -2,7 +2,7 @@ import * as React from 'react';
|
|
|
2
2
|
import classNames from 'classnames';
|
|
3
3
|
import { composeRef } from "@rc-component/util/es/ref";
|
|
4
4
|
import { warning } from "@rc-component/util/es/warning";
|
|
5
|
-
import
|
|
5
|
+
import useBaseProps from "../hooks/useBaseProps";
|
|
6
6
|
const Input = (props, ref) => {
|
|
7
7
|
const {
|
|
8
8
|
prefixCls,
|
|
@@ -29,7 +29,7 @@ const Input = (props, ref) => {
|
|
|
29
29
|
const {
|
|
30
30
|
classNames: contextClassNames,
|
|
31
31
|
styles: contextStyles
|
|
32
|
-
} =
|
|
32
|
+
} = useBaseProps() || {};
|
|
33
33
|
let inputNode = inputElement || /*#__PURE__*/React.createElement("input", null);
|
|
34
34
|
const {
|
|
35
35
|
ref: originRef,
|
|
@@ -56,17 +56,18 @@ export interface BaseSelectProps extends BaseSelectPrivateProps, React.AriaAttri
|
|
|
56
56
|
style?: React.CSSProperties;
|
|
57
57
|
classNames?: Partial<Record<BaseSelectSemanticName, string>>;
|
|
58
58
|
styles?: Partial<Record<BaseSelectSemanticName, React.CSSProperties>>;
|
|
59
|
-
title?: string;
|
|
60
59
|
showSearch?: boolean;
|
|
61
60
|
tagRender?: (props: CustomTagProps) => React.ReactElement;
|
|
62
61
|
direction?: 'ltr' | 'rtl';
|
|
63
|
-
maxLength?: number;
|
|
64
|
-
showScrollBar?: boolean | 'optional';
|
|
65
|
-
tabIndex?: number;
|
|
66
62
|
autoFocus?: boolean;
|
|
67
|
-
notFoundContent?: React.ReactNode;
|
|
68
63
|
placeholder?: React.ReactNode;
|
|
64
|
+
maxCount?: number;
|
|
65
|
+
title?: string;
|
|
66
|
+
tabIndex?: number;
|
|
67
|
+
notFoundContent?: React.ReactNode;
|
|
69
68
|
onClear?: () => void;
|
|
69
|
+
maxLength?: number;
|
|
70
|
+
showScrollBar?: boolean | 'optional';
|
|
70
71
|
choiceTransitionName?: string;
|
|
71
72
|
mode?: Mode;
|
|
72
73
|
disabled?: boolean;
|
package/lib/BaseSelect/index.js
CHANGED
|
@@ -19,7 +19,6 @@ var _Selector = _interopRequireDefault(require("../Selector"));
|
|
|
19
19
|
var _SelectTrigger = _interopRequireDefault(require("../SelectTrigger"));
|
|
20
20
|
var _TransBtn = _interopRequireDefault(require("../TransBtn"));
|
|
21
21
|
var _valueUtil = require("../utils/valueUtil");
|
|
22
|
-
var _SelectContext = _interopRequireDefault(require("../SelectContext"));
|
|
23
22
|
var _Polite = _interopRequireDefault(require("./Polite"));
|
|
24
23
|
function _getRequireWildcardCache(e) { if ("function" != typeof WeakMap) return null; var r = new WeakMap(), t = new WeakMap(); return (_getRequireWildcardCache = function (e) { return e ? t : r; })(e); }
|
|
25
24
|
function _interopRequireWildcard(e, r) { if (!r && e && e.__esModule) return e; if (null === e || "object" != typeof e && "function" != typeof e) return { default: e }; var t = _getRequireWildcardCache(r); if (t && t.has(e)) return t.get(e); var n = { __proto__: null }, a = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var u in e) if ("default" !== u && Object.prototype.hasOwnProperty.call(e, u)) { var i = a ? Object.getOwnPropertyDescriptor(e, u) : null; i && (i.get || i.set) ? Object.defineProperty(n, u, i) : n[u] = e[u]; } return n.default = e, t && t.set(e, n), n; }
|
|
@@ -33,6 +32,8 @@ const BaseSelect = /*#__PURE__*/React.forwardRef((props, ref) => {
|
|
|
33
32
|
id,
|
|
34
33
|
prefixCls,
|
|
35
34
|
className,
|
|
35
|
+
styles,
|
|
36
|
+
classNames,
|
|
36
37
|
showSearch,
|
|
37
38
|
tagRender,
|
|
38
39
|
showScrollBar = 'optional',
|
|
@@ -44,6 +45,7 @@ const BaseSelect = /*#__PURE__*/React.forwardRef((props, ref) => {
|
|
|
44
45
|
emptyOptions,
|
|
45
46
|
notFoundContent = 'Not Found',
|
|
46
47
|
onClear,
|
|
48
|
+
maxCount,
|
|
47
49
|
// Mode
|
|
48
50
|
mode,
|
|
49
51
|
// Status
|
|
@@ -181,20 +183,14 @@ const BaseSelect = /*#__PURE__*/React.forwardRef((props, ref) => {
|
|
|
181
183
|
|
|
182
184
|
// ============================= Search =============================
|
|
183
185
|
const tokenWithEnter = React.useMemo(() => (tokenSeparators || []).some(tokenSeparator => ['\n', '\r\n'].includes(tokenSeparator)), [tokenSeparators]);
|
|
184
|
-
const {
|
|
185
|
-
maxCount,
|
|
186
|
-
rawValues,
|
|
187
|
-
classNames: selectClassNames,
|
|
188
|
-
styles
|
|
189
|
-
} = React.useContext(_SelectContext.default) || {};
|
|
190
186
|
const onInternalSearch = (searchText, fromTyping, isCompositing) => {
|
|
191
|
-
if (multiple && (0, _valueUtil.isValidCount)(maxCount) &&
|
|
187
|
+
if (multiple && (0, _valueUtil.isValidCount)(maxCount) && displayValues.length >= maxCount) {
|
|
192
188
|
return;
|
|
193
189
|
}
|
|
194
190
|
let ret = true;
|
|
195
191
|
let newSearchText = searchText;
|
|
196
192
|
onActiveValueChange?.(null);
|
|
197
|
-
const separatedList = (0, _valueUtil.getSeparatedContent)(searchText, tokenSeparators, (0, _valueUtil.isValidCount)(maxCount) ? maxCount -
|
|
193
|
+
const separatedList = (0, _valueUtil.getSeparatedContent)(searchText, tokenSeparators, (0, _valueUtil.isValidCount)(maxCount) ? maxCount - displayValues.length : undefined);
|
|
198
194
|
|
|
199
195
|
// Check if match the `tokenSeparators`
|
|
200
196
|
const patchLabels = isCompositing ? null : separatedList;
|
|
@@ -436,8 +432,10 @@ const BaseSelect = /*#__PURE__*/React.forwardRef((props, ref) => {
|
|
|
436
432
|
showSearch: mergedShowSearch,
|
|
437
433
|
multiple,
|
|
438
434
|
toggleOpen: onToggleOpen,
|
|
439
|
-
showScrollBar
|
|
440
|
-
|
|
435
|
+
showScrollBar,
|
|
436
|
+
styles,
|
|
437
|
+
classNames
|
|
438
|
+
}), [props, notFoundContent, triggerOpen, mergedOpen, id, mergedShowSearch, multiple, onToggleOpen, showScrollBar, styles, classNames]);
|
|
441
439
|
|
|
442
440
|
// ==================================================================
|
|
443
441
|
// == Render ==
|
|
@@ -448,7 +446,7 @@ const BaseSelect = /*#__PURE__*/React.forwardRef((props, ref) => {
|
|
|
448
446
|
let arrowNode;
|
|
449
447
|
if (showSuffixIcon) {
|
|
450
448
|
arrowNode = /*#__PURE__*/React.createElement(_TransBtn.default, {
|
|
451
|
-
className: (0, _classnames.default)(`${prefixCls}-arrow`,
|
|
449
|
+
className: (0, _classnames.default)(`${prefixCls}-arrow`, classNames?.suffix, {
|
|
452
450
|
[`${prefixCls}-arrow-loading`]: loading
|
|
453
451
|
}),
|
|
454
452
|
style: styles?.suffix,
|
|
@@ -526,7 +524,7 @@ const BaseSelect = /*#__PURE__*/React.forwardRef((props, ref) => {
|
|
|
526
524
|
}, customizeRawInputElement ? ( /*#__PURE__*/React.cloneElement(customizeRawInputElement, {
|
|
527
525
|
ref: customizeRawInputRef
|
|
528
526
|
})) : /*#__PURE__*/React.createElement(_Selector.default, _extends({}, props, {
|
|
529
|
-
prefixClassName:
|
|
527
|
+
prefixClassName: classNames?.prefix,
|
|
530
528
|
prefixStyle: styles?.prefix,
|
|
531
529
|
domRef: selectorDomRef,
|
|
532
530
|
prefixCls: prefixCls,
|
package/lib/Select.d.ts
CHANGED
|
@@ -108,7 +108,7 @@ export interface SelectProps<ValueType = any, OptionType extends BaseOptionType
|
|
|
108
108
|
classNames?: Partial<Record<SemanticName, string>>;
|
|
109
109
|
styles?: Partial<Record<SemanticName, React.CSSProperties>>;
|
|
110
110
|
}
|
|
111
|
-
declare const TypedSelect: (<ValueType = any, OptionType extends
|
|
111
|
+
declare const TypedSelect: (<ValueType = any, OptionType extends DefaultOptionType | BaseOptionType = DefaultOptionType>(props: SelectProps<ValueType, OptionType> & {
|
|
112
112
|
children?: React.ReactNode;
|
|
113
113
|
} & React.RefAttributes<BaseSelectRef>) => React.ReactElement) & {
|
|
114
114
|
Option: typeof Option;
|
package/lib/Select.js
CHANGED
|
@@ -93,7 +93,7 @@ const Select = /*#__PURE__*/React.forwardRef((props, ref) => {
|
|
|
93
93
|
labelInValue,
|
|
94
94
|
onChange,
|
|
95
95
|
maxCount,
|
|
96
|
-
classNames
|
|
96
|
+
classNames,
|
|
97
97
|
styles,
|
|
98
98
|
...restProps
|
|
99
99
|
} = props;
|
|
@@ -435,10 +435,10 @@ const Select = /*#__PURE__*/React.forwardRef((props, ref) => {
|
|
|
435
435
|
childrenAsData,
|
|
436
436
|
maxCount,
|
|
437
437
|
optionRender,
|
|
438
|
-
classNames
|
|
438
|
+
classNames,
|
|
439
439
|
styles
|
|
440
440
|
};
|
|
441
|
-
}, [
|
|
441
|
+
}, [maxCount, parsedOptions, displayOptions, onActiveValue, mergedDefaultActiveFirstOption, onInternalSelect, menuItemSelectedIcon, rawValues, mergedFieldNames, virtual, popupMatchSelectWidth, direction, listHeight, listItemHeight, childrenAsData, optionRender, classNames, styles]);
|
|
442
442
|
|
|
443
443
|
// ========================== Warning ===========================
|
|
444
444
|
if (process.env.NODE_ENV !== 'production') {
|
|
@@ -458,10 +458,15 @@ const Select = /*#__PURE__*/React.forwardRef((props, ref) => {
|
|
|
458
458
|
ref: ref,
|
|
459
459
|
omitDomProps: OMIT_DOM_PROPS,
|
|
460
460
|
mode: mode
|
|
461
|
+
// >>> Style
|
|
462
|
+
,
|
|
463
|
+
classNames: classNames,
|
|
464
|
+
styles: styles
|
|
461
465
|
// >>> Values
|
|
462
466
|
,
|
|
463
467
|
displayValues: displayValues,
|
|
464
|
-
onDisplayValuesChange: onDisplayValuesChange
|
|
468
|
+
onDisplayValuesChange: onDisplayValuesChange,
|
|
469
|
+
maxCount: maxCount
|
|
465
470
|
// >>> Trigger
|
|
466
471
|
,
|
|
467
472
|
direction: direction
|
package/lib/SelectContext.d.ts
CHANGED
|
@@ -2,6 +2,9 @@ import * as React from 'react';
|
|
|
2
2
|
import type { RawValueType, RenderNode } from './BaseSelect';
|
|
3
3
|
import type { BaseOptionType, FieldNames, OnActiveValue, OnInternalSelect, SelectProps, SemanticName } from './Select';
|
|
4
4
|
import type { FlattenOptionData } from './interface';
|
|
5
|
+
/**
|
|
6
|
+
* SelectContext is only used for Select. BaseSelect should not consume this context.
|
|
7
|
+
*/
|
|
5
8
|
export interface SelectContextProps {
|
|
6
9
|
classNames?: Partial<Record<SemanticName, string>>;
|
|
7
10
|
styles?: Partial<Record<SemanticName, React.CSSProperties>>;
|
package/lib/SelectContext.js
CHANGED
|
@@ -8,6 +8,9 @@ var React = _interopRequireWildcard(require("react"));
|
|
|
8
8
|
function _getRequireWildcardCache(e) { if ("function" != typeof WeakMap) return null; var r = new WeakMap(), t = new WeakMap(); return (_getRequireWildcardCache = function (e) { return e ? t : r; })(e); }
|
|
9
9
|
function _interopRequireWildcard(e, r) { if (!r && e && e.__esModule) return e; if (null === e || "object" != typeof e && "function" != typeof e) return { default: e }; var t = _getRequireWildcardCache(r); if (t && t.has(e)) return t.get(e); var n = { __proto__: null }, a = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var u in e) if ("default" !== u && Object.prototype.hasOwnProperty.call(e, u)) { var i = a ? Object.getOwnPropertyDescriptor(e, u) : null; i && (i.get || i.set) ? Object.defineProperty(n, u, i) : n[u] = e[u]; } return n.default = e, t && t.set(e, n), n; }
|
|
10
10
|
// Use any here since we do not get the type during compilation
|
|
11
|
+
/**
|
|
12
|
+
* SelectContext is only used for Select. BaseSelect should not consume this context.
|
|
13
|
+
*/
|
|
11
14
|
|
|
12
15
|
const SelectContext = /*#__PURE__*/React.createContext(null);
|
|
13
16
|
var _default = exports.default = SelectContext;
|
package/lib/Selector/Input.js
CHANGED
|
@@ -8,7 +8,7 @@ var React = _interopRequireWildcard(require("react"));
|
|
|
8
8
|
var _classnames = _interopRequireDefault(require("classnames"));
|
|
9
9
|
var _ref = require("@rc-component/util/lib/ref");
|
|
10
10
|
var _warning = require("@rc-component/util/lib/warning");
|
|
11
|
-
var
|
|
11
|
+
var _useBaseProps = _interopRequireDefault(require("../hooks/useBaseProps"));
|
|
12
12
|
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
|
13
13
|
function _getRequireWildcardCache(e) { if ("function" != typeof WeakMap) return null; var r = new WeakMap(), t = new WeakMap(); return (_getRequireWildcardCache = function (e) { return e ? t : r; })(e); }
|
|
14
14
|
function _interopRequireWildcard(e, r) { if (!r && e && e.__esModule) return e; if (null === e || "object" != typeof e && "function" != typeof e) return { default: e }; var t = _getRequireWildcardCache(r); if (t && t.has(e)) return t.get(e); var n = { __proto__: null }, a = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var u in e) if ("default" !== u && Object.prototype.hasOwnProperty.call(e, u)) { var i = a ? Object.getOwnPropertyDescriptor(e, u) : null; i && (i.get || i.set) ? Object.defineProperty(n, u, i) : n[u] = e[u]; } return n.default = e, t && t.set(e, n), n; }
|
|
@@ -38,7 +38,7 @@ const Input = (props, ref) => {
|
|
|
38
38
|
const {
|
|
39
39
|
classNames: contextClassNames,
|
|
40
40
|
styles: contextStyles
|
|
41
|
-
} =
|
|
41
|
+
} = (0, _useBaseProps.default)() || {};
|
|
42
42
|
let inputNode = inputElement || /*#__PURE__*/React.createElement("input", null);
|
|
43
43
|
const {
|
|
44
44
|
ref: originRef,
|