@sumaris-net/ngx-components 18.6.19-alpha2 → 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.
|
@@ -8185,7 +8185,9 @@ class MatAutocompleteField {
|
|
|
8185
8185
|
}));
|
|
8186
8186
|
// Select input content, on focus or press enter
|
|
8187
8187
|
if (this.selectInputContentOnFocus && !this.mobile && !this.multiple) {
|
|
8188
|
-
this._subscription.add(merge(this.focused.pipe(filter((event) => !event.defaultPrevented)
|
|
8188
|
+
this._subscription.add(merge(this.focused.pipe(filter((event) => !event.defaultPrevented)
|
|
8189
|
+
//tap((event) => event.preventDefault())
|
|
8190
|
+
), this.keyupEnter.pipe(filter(() => isNotNilObject(this.formControl.value))))
|
|
8189
8191
|
.pipe(debounceTime(this.selectInputContentOnFocusDelay))
|
|
8190
8192
|
.subscribe(() => {
|
|
8191
8193
|
if (this.debug)
|
|
@@ -8299,6 +8301,7 @@ class MatAutocompleteField {
|
|
|
8299
8301
|
//if (this.debug) console.debug(this.logPrefix + ' Cancelling focus event');
|
|
8300
8302
|
return false;
|
|
8301
8303
|
}
|
|
8304
|
+
this._focused = true;
|
|
8302
8305
|
// DEBUG
|
|
8303
8306
|
//if (this.debug) console.debug(this.logPrefix + ' Select input content');
|
|
8304
8307
|
const hasContent = isNotNilOrBlank(event.target?.value);
|
|
@@ -8306,7 +8309,7 @@ class MatAutocompleteField {
|
|
|
8306
8309
|
if (!hasContent || this.showPanelOnFocus || this.showAllOnFocus) {
|
|
8307
8310
|
// DEBUG
|
|
8308
8311
|
//if (this.debug) console.debug(this.logPrefix + ' Emit focus event');
|
|
8309
|
-
|
|
8312
|
+
// Need a delay to prevent early focus event, just after a blur event (see sumaris issue - 2 panels opened)
|
|
8310
8313
|
setTimeout(() => {
|
|
8311
8314
|
if (!this._focused)
|
|
8312
8315
|
return; // Skip if blur event received
|
|
@@ -8321,21 +8324,23 @@ class MatAutocompleteField {
|
|
|
8321
8324
|
return;
|
|
8322
8325
|
// DEBUG
|
|
8323
8326
|
//if (this.debug) console.debug(this.logPrefix + ' filterInputTextBlurEvent', event);
|
|
8324
|
-
//
|
|
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
|
|
8325
8341
|
setTimeout(() => {
|
|
8326
|
-
|
|
8327
|
-
|
|
8328
|
-
// Or autocomplete panel is open because event.relatedTarget is null (cf. https://github.com/angular/components/issues/24182)
|
|
8329
|
-
this.autocomplete?.isOpen) {
|
|
8330
|
-
event.preventDefault();
|
|
8331
|
-
if (event.stopPropagation)
|
|
8332
|
-
event.stopPropagation();
|
|
8333
|
-
event.returnValue = false;
|
|
8334
|
-
// DEBUG
|
|
8335
|
-
//if (this.debug) console.debug(this.logPrefix + " Cancelling blur event");
|
|
8336
|
-
return;
|
|
8337
|
-
}
|
|
8338
|
-
this._focused = false;
|
|
8342
|
+
if (this._focused)
|
|
8343
|
+
return; // Skip if focus again
|
|
8339
8344
|
this.blurred.emit(event);
|
|
8340
8345
|
}, 100);
|
|
8341
8346
|
}
|