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