@sumaris-net/ngx-components 18.6.19-alpha3 → 18.6.19-alpha4
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.
|
@@ -8301,6 +8301,7 @@ class MatAutocompleteField {
|
|
|
8301
8301
|
//if (this.debug) console.debug(this.logPrefix + ' Cancelling focus event');
|
|
8302
8302
|
return false;
|
|
8303
8303
|
}
|
|
8304
|
+
this._focused = true;
|
|
8304
8305
|
// DEBUG
|
|
8305
8306
|
//if (this.debug) console.debug(this.logPrefix + ' Select input content');
|
|
8306
8307
|
const hasContent = isNotNilOrBlank(event.target?.value);
|
|
@@ -8308,7 +8309,7 @@ class MatAutocompleteField {
|
|
|
8308
8309
|
if (!hasContent || this.showPanelOnFocus || this.showAllOnFocus) {
|
|
8309
8310
|
// DEBUG
|
|
8310
8311
|
//if (this.debug) console.debug(this.logPrefix + ' Emit focus event');
|
|
8311
|
-
|
|
8312
|
+
// Need a delay to prevent early focus event, just after a blur event (see sumaris issue - 2 panels opened)
|
|
8312
8313
|
setTimeout(() => {
|
|
8313
8314
|
if (!this._focused)
|
|
8314
8315
|
return; // Skip if blur event received
|
|
@@ -8323,21 +8324,23 @@ class MatAutocompleteField {
|
|
|
8323
8324
|
return;
|
|
8324
8325
|
// DEBUG
|
|
8325
8326
|
//if (this.debug) console.debug(this.logPrefix + ' filterInputTextBlurEvent', event);
|
|
8326
|
-
//
|
|
8327
|
+
// Ignore event from mat-option
|
|
8328
|
+
if ((event.relatedTarget instanceof HTMLElement && event.relatedTarget.tagName === 'MAT-OPTION') ||
|
|
8329
|
+
// Or autocomplete panel is open because event.relatedTarget is null (cf. https://github.com/angular/components/issues/24182)
|
|
8330
|
+
this.autocomplete?.isOpen) {
|
|
8331
|
+
event.preventDefault();
|
|
8332
|
+
if (event.stopPropagation)
|
|
8333
|
+
event.stopPropagation();
|
|
8334
|
+
event.returnValue = false;
|
|
8335
|
+
// DEBUG
|
|
8336
|
+
//if (this.debug) console.debug(this.logPrefix + " Cancelling blur event");
|
|
8337
|
+
return;
|
|
8338
|
+
}
|
|
8339
|
+
this._focused = false;
|
|
8340
|
+
// Need a delay to prevent early blur event without triggering formChange event
|
|
8327
8341
|
setTimeout(() => {
|
|
8328
|
-
|
|
8329
|
-
|
|
8330
|
-
// Or autocomplete panel is open because event.relatedTarget is null (cf. https://github.com/angular/components/issues/24182)
|
|
8331
|
-
this.autocomplete?.isOpen) {
|
|
8332
|
-
event.preventDefault();
|
|
8333
|
-
if (event.stopPropagation)
|
|
8334
|
-
event.stopPropagation();
|
|
8335
|
-
event.returnValue = false;
|
|
8336
|
-
// DEBUG
|
|
8337
|
-
//if (this.debug) console.debug(this.logPrefix + " Cancelling blur event");
|
|
8338
|
-
return;
|
|
8339
|
-
}
|
|
8340
|
-
this._focused = false;
|
|
8342
|
+
if (this._focused)
|
|
8343
|
+
return; // Skip if focus again
|
|
8341
8344
|
this.blurred.emit(event);
|
|
8342
8345
|
}, 100);
|
|
8343
8346
|
}
|