@xsmusices/ui 1.44.4 → 1.44.6
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.
|
@@ -9412,17 +9412,23 @@ class XSFormlyEntityPickerComponent extends XSFormlyBaseComponent {
|
|
|
9412
9412
|
ngOnDestroy() {
|
|
9413
9413
|
super.ngOnDestroy();
|
|
9414
9414
|
this.valueChangesSub.unsubscribe();
|
|
9415
|
+
this.searchSubject.complete();
|
|
9415
9416
|
}
|
|
9416
9417
|
syncSelectedItems() {
|
|
9417
9418
|
const value = this.control.value;
|
|
9418
9419
|
const items = Array.isArray(value)
|
|
9419
|
-
? [...value].sort((a, b) => a['position']
|
|
9420
|
-
|
|
9420
|
+
? [...value].sort((a, b) => (typeof a['position'] === 'number'
|
|
9421
|
+
? a['position']
|
|
9422
|
+
: 0) -
|
|
9423
|
+
(typeof b['position'] === 'number'
|
|
9424
|
+
? b['position']
|
|
9425
|
+
: 0))
|
|
9421
9426
|
: [];
|
|
9422
9427
|
this.selectedItems.set(items);
|
|
9423
9428
|
}
|
|
9424
9429
|
updateControl(items) {
|
|
9425
|
-
const sorted = [...items].sort((a, b) => a['position']
|
|
9430
|
+
const sorted = [...items].sort((a, b) => (typeof a['position'] === 'number' ? a['position'] : 0) -
|
|
9431
|
+
(typeof b['position'] === 'number' ? b['position'] : 0));
|
|
9426
9432
|
this.selectedItems.set(sorted);
|
|
9427
9433
|
this.control.setValue(sorted);
|
|
9428
9434
|
this.control.markAsDirty();
|
|
@@ -9489,7 +9495,13 @@ class XSFormlyEntityPickerComponent extends XSFormlyBaseComponent {
|
|
|
9489
9495
|
return;
|
|
9490
9496
|
const onConfirm = this.pickerProps.onConfirmRemove;
|
|
9491
9497
|
if (onConfirm) {
|
|
9492
|
-
|
|
9498
|
+
let allow = false;
|
|
9499
|
+
try {
|
|
9500
|
+
allow = await onConfirm(item);
|
|
9501
|
+
}
|
|
9502
|
+
catch {
|
|
9503
|
+
allow = false;
|
|
9504
|
+
}
|
|
9493
9505
|
if (!allow)
|
|
9494
9506
|
return;
|
|
9495
9507
|
}
|