glints-aries 4.0.354 → 4.0.355
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/Input/Select/Select.js +16 -2
- package/es/Input/Select/Select.numberChecking.test.d.ts +2 -0
- package/es/Input/Select/SelectList.d.ts +1 -1
- package/lib/Input/Select/Select.js +16 -2
- package/lib/Input/Select/Select.numberChecking.test.d.ts +2 -0
- package/lib/Input/Select/SelectList.d.ts +1 -1
- package/package.json +1 -1
|
@@ -102,7 +102,14 @@ var Select = function Select(props) {
|
|
|
102
102
|
}
|
|
103
103
|
}
|
|
104
104
|
var matchedChildrenOptions = childrenOptions.filter(function (data) {
|
|
105
|
-
|
|
105
|
+
var children = data.props.children;
|
|
106
|
+
if (typeof children === 'string') {
|
|
107
|
+
return filterFunction(children, inputValue);
|
|
108
|
+
}
|
|
109
|
+
if (typeof children === 'number') {
|
|
110
|
+
return filterFunction(String(children), inputValue);
|
|
111
|
+
}
|
|
112
|
+
return true;
|
|
106
113
|
});
|
|
107
114
|
return matchedChildrenOptions;
|
|
108
115
|
}, [children, inputValue, disableTyping, isInputChange, filterFunction]);
|
|
@@ -113,7 +120,14 @@ var Select = function Select(props) {
|
|
|
113
120
|
setOptions(availableOptions);
|
|
114
121
|
if (!isFocus) {
|
|
115
122
|
var selectedOptionIndex = availableOptions.findIndex(function (option) {
|
|
116
|
-
|
|
123
|
+
var children = option.props.children;
|
|
124
|
+
if (typeof children === 'string') {
|
|
125
|
+
return toLower(children).includes(toLower(inputValue));
|
|
126
|
+
}
|
|
127
|
+
if (typeof children === 'number') {
|
|
128
|
+
return toLower(String(children)).includes(toLower(inputValue));
|
|
129
|
+
}
|
|
130
|
+
return false;
|
|
117
131
|
});
|
|
118
132
|
if (activeOptionIndex !== selectedOptionIndex) {
|
|
119
133
|
setActiveOptionIndex(selectedOptionIndex);
|
|
@@ -11,7 +11,7 @@ interface Props {
|
|
|
11
11
|
handleMouseEnterOption(event: React.MouseEvent<HTMLLIElement, MouseEvent>): void;
|
|
12
12
|
}
|
|
13
13
|
export interface SelectItemProps {
|
|
14
|
-
children: string;
|
|
14
|
+
children: string | number | React.ReactNode;
|
|
15
15
|
value?: string;
|
|
16
16
|
onOptionClick?(e: React.ChangeEvent<HTMLInputElement>): void;
|
|
17
17
|
}
|
|
@@ -109,7 +109,14 @@ var Select = function Select(props) {
|
|
|
109
109
|
}
|
|
110
110
|
}
|
|
111
111
|
var matchedChildrenOptions = childrenOptions.filter(function (data) {
|
|
112
|
-
|
|
112
|
+
var children = data.props.children;
|
|
113
|
+
if (typeof children === 'string') {
|
|
114
|
+
return filterFunction(children, inputValue);
|
|
115
|
+
}
|
|
116
|
+
if (typeof children === 'number') {
|
|
117
|
+
return filterFunction(String(children), inputValue);
|
|
118
|
+
}
|
|
119
|
+
return true;
|
|
113
120
|
});
|
|
114
121
|
return matchedChildrenOptions;
|
|
115
122
|
}, [children, inputValue, disableTyping, isInputChange, filterFunction]);
|
|
@@ -120,7 +127,14 @@ var Select = function Select(props) {
|
|
|
120
127
|
setOptions(availableOptions);
|
|
121
128
|
if (!isFocus) {
|
|
122
129
|
var selectedOptionIndex = availableOptions.findIndex(function (option) {
|
|
123
|
-
|
|
130
|
+
var children = option.props.children;
|
|
131
|
+
if (typeof children === 'string') {
|
|
132
|
+
return (0, _lodash.toLower)(children).includes((0, _lodash.toLower)(inputValue));
|
|
133
|
+
}
|
|
134
|
+
if (typeof children === 'number') {
|
|
135
|
+
return (0, _lodash.toLower)(String(children)).includes((0, _lodash.toLower)(inputValue));
|
|
136
|
+
}
|
|
137
|
+
return false;
|
|
124
138
|
});
|
|
125
139
|
if (activeOptionIndex !== selectedOptionIndex) {
|
|
126
140
|
setActiveOptionIndex(selectedOptionIndex);
|
|
@@ -11,7 +11,7 @@ interface Props {
|
|
|
11
11
|
handleMouseEnterOption(event: React.MouseEvent<HTMLLIElement, MouseEvent>): void;
|
|
12
12
|
}
|
|
13
13
|
export interface SelectItemProps {
|
|
14
|
-
children: string;
|
|
14
|
+
children: string | number | React.ReactNode;
|
|
15
15
|
value?: string;
|
|
16
16
|
onOptionClick?(e: React.ChangeEvent<HTMLInputElement>): void;
|
|
17
17
|
}
|