@luomus/laji-form 15.1.98 → 15.1.99
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.
|
@@ -66,7 +66,7 @@ export class Autosuggest extends React.Component<any, any, any> {
|
|
|
66
66
|
promiseTimestamp: number | undefined;
|
|
67
67
|
timeout: any;
|
|
68
68
|
onFocus: (e: any) => void;
|
|
69
|
-
onBlur: (e: any) => void;
|
|
69
|
+
onBlur: (e: any, blurSelected?: boolean) => void;
|
|
70
70
|
_valueForBlurAndFetch: any;
|
|
71
71
|
afterBlurAndFetch: (suggestions: any, callback: any) => void;
|
|
72
72
|
render(): JSX.Element;
|
|
@@ -626,10 +626,12 @@ class Autosuggest extends React.Component {
|
|
|
626
626
|
this.setState({ focused: true });
|
|
627
627
|
(0, utils_1.triggerParentComponent)("onFocus", e, this.props.inputProps);
|
|
628
628
|
};
|
|
629
|
-
this.onBlur = (e) => {
|
|
629
|
+
this.onBlur = (e, blurSelected = false) => {
|
|
630
630
|
this.setState({ focused: false }, () => {
|
|
631
|
-
|
|
632
|
-
|
|
631
|
+
if (!blurSelected) {
|
|
632
|
+
this._valueForBlurAndFetch = this.state.inputValue;
|
|
633
|
+
this.afterBlurAndFetch(this.state.suggestions);
|
|
634
|
+
}
|
|
633
635
|
(0, utils_1.triggerParentComponent)("onBlur", e, this.props.inputProps);
|
|
634
636
|
const overlay = this.wrapperRef.current;
|
|
635
637
|
if (overlay && overlay.overlayTriggerRef && overlay.overlayTriggerRef.hide) {
|
|
@@ -1208,7 +1210,7 @@ class ReactAutosuggest extends React.Component {
|
|
|
1208
1210
|
const suggestion = (this.props.suggestions || [])[this.state.focusedIdx];
|
|
1209
1211
|
suggestion && this.onSuggestionSelected(this.props.suggestions[this.state.focusedIdx]);
|
|
1210
1212
|
this.setState({ focused: false, focusedIdx: undefined, touched: false });
|
|
1211
|
-
(_b = (_a = this.props.inputProps) === null || _a === void 0 ? void 0 : _a.onBlur) === null || _b === void 0 ? void 0 : _b.call(_a, e);
|
|
1213
|
+
(_b = (_a = this.props.inputProps) === null || _a === void 0 ? void 0 : _a.onBlur) === null || _b === void 0 ? void 0 : _b.call(_a, e, !!suggestion);
|
|
1212
1214
|
}
|
|
1213
1215
|
renderInput() {
|
|
1214
1216
|
const { inputProps, renderInputComponent = this.renderDefaultInputComponent } = this.props;
|