@cuby-ui/core 0.0.114 → 0.0.116

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.
@@ -728,6 +728,7 @@ class CuiDialogsComponent {
728
728
  constructor() {
729
729
  this.destroy$ = inject(CuiDestroyService, { self: true });
730
730
  this.dialogs$ = inject(CUI_DIALOGS);
731
+ this.dialogInjectorCache = new Map();
731
732
  }
732
733
  ngOnInit() {
733
734
  this.initDialogInjectorsSubscription();
@@ -738,9 +739,22 @@ class CuiDialogsComponent {
738
739
  initDialogInjectorsSubscription() {
739
740
  this.dialogs$
740
741
  .pipe(takeUntil(this.destroy$))
741
- .subscribe(dialogs => this.dialogInjectors = dialogs.map(useValue => Injector.create({
742
- providers: [{ provide: CUI_DIALOG_CONTEXT, useValue }]
743
- })));
742
+ .subscribe(dialogs => {
743
+ this.dialogInjectors = dialogs.map(dialog => {
744
+ if (!this.dialogInjectorCache.has(dialog.id)) {
745
+ this.dialogInjectorCache.set(dialog.id, Injector.create({
746
+ providers: [{ provide: CUI_DIALOG_CONTEXT, useValue: dialog }]
747
+ }));
748
+ }
749
+ return this.dialogInjectorCache.get(dialog.id);
750
+ });
751
+ this.dialogInjectorCache.forEach((_, dialogId) => {
752
+ if (dialogs.find(dialog => dialog.id === dialogId)) {
753
+ return;
754
+ }
755
+ this.dialogInjectorCache.delete(dialogId);
756
+ });
757
+ });
744
758
  }
745
759
  }
746
760
  CuiDialogsComponent.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "15.2.10", ngImport: i0, type: CuiDialogsComponent, deps: [], target: i0.ɵɵFactoryTarget.Component });
@@ -1924,7 +1938,8 @@ class CuiSelectComponent {
1924
1938
  }
1925
1939
  writeValue(value) {
1926
1940
  this.value = value;
1927
- this.selectedOption = value;
1941
+ // TODO: Непонятно, зачем нужно в construction вторая часть выражения
1942
+ this.selectedOption = this.options.find(option => option.value === value) ?? value;
1928
1943
  this.changeDetectorRef.markForCheck();
1929
1944
  }
1930
1945
  registerOnChange(fn) {