@meshmakers/shared-ui 3.5.520 → 3.5.550
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.
|
@@ -5393,11 +5393,30 @@ class EntitySelectInputComponent {
|
|
|
5393
5393
|
maxResults = 50;
|
|
5394
5394
|
debounceMs = 300;
|
|
5395
5395
|
prefix = '';
|
|
5396
|
-
|
|
5396
|
+
/**
|
|
5397
|
+
* Display name of the entity the host holds as the current pick (e.g. a pick restored from
|
|
5398
|
+
* the URL, or set by the host). The input follows every change (AB#7916):
|
|
5399
|
+
* - a new name replaces the text; when it differs from the text of the entity picked in
|
|
5400
|
+
* this input, that selection is dropped (the host replaced the pick);
|
|
5401
|
+
* - `undefined` / empty clears the text and the selection (the host cleared the pick).
|
|
5402
|
+
* Host changes emit no `entitySelected` / `entityCleared` and do not call the form
|
|
5403
|
+
* `onChange`: the host made the change itself. Before AB#7916 empty values and any value
|
|
5404
|
+
* after a pick in this input were ignored, so the input kept showing a stale pick.
|
|
5405
|
+
*/
|
|
5397
5406
|
set initialDisplayValue(value) {
|
|
5398
|
-
|
|
5399
|
-
|
|
5407
|
+
const next = value ?? '';
|
|
5408
|
+
const previous = this.hostDisplayValue;
|
|
5409
|
+
this.hostDisplayValue = next;
|
|
5410
|
+
if (next === previous) {
|
|
5411
|
+
return;
|
|
5400
5412
|
}
|
|
5413
|
+
if (next === (this.searchFormControl.value ?? '')) {
|
|
5414
|
+
// The host confirms what the input already shows (e.g. the entity just picked here).
|
|
5415
|
+
return;
|
|
5416
|
+
}
|
|
5417
|
+
this.selectedEntity = null;
|
|
5418
|
+
this.filteredEntities = [];
|
|
5419
|
+
this.searchFormControl.setValue(next, { emitEvent: false });
|
|
5401
5420
|
}
|
|
5402
5421
|
// Dialog inputs
|
|
5403
5422
|
// eslint-disable-next-line @typescript-eslint/no-explicit-any -- generic component accepts any entity type
|
|
@@ -5445,6 +5464,8 @@ class EntitySelectInputComponent {
|
|
|
5445
5464
|
isLoading = false;
|
|
5446
5465
|
entityMap = new Map();
|
|
5447
5466
|
// Private members
|
|
5467
|
+
/** Last value of {@link initialDisplayValue}; a host pick is shown while it is non-empty. */
|
|
5468
|
+
hostDisplayValue = '';
|
|
5448
5469
|
searchSubject = new Subject();
|
|
5449
5470
|
typedText = '';
|
|
5450
5471
|
destroy$ = new Subject();
|
|
@@ -5512,7 +5533,10 @@ class EntitySelectInputComponent {
|
|
|
5512
5533
|
}
|
|
5513
5534
|
onSelectionChange(value) {
|
|
5514
5535
|
if (!value) {
|
|
5515
|
-
|
|
5536
|
+
// Clearing the input clears the pick — also a pick the host showed by name only
|
|
5537
|
+
// (restored from the URL or set by the host, AB#7916), which has no entity object here.
|
|
5538
|
+
if (this.selectedEntity || this.hostDisplayValue) {
|
|
5539
|
+
this.hostDisplayValue = '';
|
|
5516
5540
|
this.clearSelection();
|
|
5517
5541
|
}
|
|
5518
5542
|
return;
|