@valtimo/zgw 13.48.0 → 13.49.1

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.
@@ -9,7 +9,7 @@ import * as i2 from '@valtimo/shared';
9
9
  import { BaseApiService, InterceptorSkipHeader, getCaseManagementRouteParams, UploadProvider, ROLE_ADMIN, zgwFeaturesGuard, ConfigService, CASE_MANAGEMENT_TAB_TOKEN, ZGW_OBJECT_TYPE_COMPONENT_TOKEN, ZGW_DOCUMENTEN_API_DOCUMENTS_COMPONENT_TOKEN, CASE_CONFIGURATION_EXTENSIONS_TOKEN } from '@valtimo/shared';
10
10
  import * as i6 from 'carbon-components-angular';
11
11
  import { ModalModule, InputModule, ButtonModule, DropdownModule, RadioModule, NotificationModule, LayerModule, TagModule, IconModule, DatePickerInputModule, DatePickerModule, ComboBoxModule, TooltipModule, ToggleModule, LoadingModule, ToggletipModule, CheckboxModule, TilesModule, SelectModule as SelectModule$1, TabsModule, AccordionModule, StructuredListModule } from 'carbon-components-angular';
12
- import { catchError, of, BehaviorSubject, combineLatest, map, Subscription, switchMap, filter, tap, startWith, debounceTime, Subject, take as take$1, from, ReplaySubject, EMPTY, finalize, distinctUntilChanged, forkJoin } from 'rxjs';
12
+ import { catchError, of, BehaviorSubject, combineLatest, map, Subscription, switchMap, filter, tap, startWith, debounceTime, Subject, take as take$1, from, ReplaySubject, finalize, EMPTY, distinctUntilChanged, forkJoin } from 'rxjs';
13
13
  import * as i1$1 from '@angular/forms';
14
14
  import { Validators, ReactiveFormsModule, FormGroup, FormControl, FormsModule } from '@angular/forms';
15
15
  import * as i3 from '@valtimo/components';
@@ -2198,29 +2198,36 @@ class CaseManagementLinkProcessComponent {
2198
2198
  this._subscriptions.unsubscribe();
2199
2199
  }
2200
2200
  selectProcess(item) {
2201
- const processDefinitionKey = item?.id;
2202
- this.disabled$.next(true);
2201
+ // Carbon emits the picked item, but an empty array on clear. "No selection" is stored as '',
2202
+ // so normalise all three — otherwise clearing slips past the guard below.
2203
+ const processDefinitionKey = (Array.isArray(item) ? '' : item?.id) ?? '';
2203
2204
  const currentSelectionId = this.selectedProcessKey$.getValue();
2204
- if (processDefinitionKey && processDefinitionKey !== currentSelectionId)
2205
+ // Picking what is already linked saves nothing. Disabling for a round-trip that never
2206
+ // follows used to leave the combo box switched off for good.
2207
+ if (processDefinitionKey === currentSelectionId)
2208
+ return;
2209
+ this.disabled$.next(true);
2210
+ if (processDefinitionKey)
2205
2211
  this.updateProcess(processDefinitionKey);
2206
- else if (!processDefinitionKey)
2212
+ else
2207
2213
  this.deleteProcess();
2208
2214
  }
2209
2215
  deleteProcess() {
2210
- this._caseParams$
2211
- .pipe(take$1(1), switchMap((params) => this.documentenApiLinkProcessService.deleteLinkedUploadProcess(params?.caseDefinitionKey ?? '', params?.caseDefinitionVersionTag ?? '')))
2216
+ this._subscriptions.add(this._caseParams$
2217
+ .pipe(take$1(1), switchMap((params) => this.documentenApiLinkProcessService.deleteLinkedUploadProcess(params?.caseDefinitionKey ?? '', params?.caseDefinitionVersionTag ?? '')),
2218
+ // Re-enable even when the save fails — otherwise one failed request costs the user
2219
+ // the control until they reload
2220
+ finalize(() => this.disabled$.next(false)))
2212
2221
  .subscribe(() => {
2213
2222
  this.selectedProcessKey$.next('');
2214
- this.disabled$.next(false);
2215
- });
2223
+ }));
2216
2224
  }
2217
2225
  updateProcess(processDefinitionKey) {
2218
- this._caseParams$
2219
- .pipe(take$1(1), switchMap((params) => this.documentenApiLinkProcessService.updateLinkedUploadProcess(params?.caseDefinitionKey ?? '', params?.caseDefinitionVersionTag ?? '', processDefinitionKey)))
2226
+ this._subscriptions.add(this._caseParams$
2227
+ .pipe(take$1(1), switchMap((params) => this.documentenApiLinkProcessService.updateLinkedUploadProcess(params?.caseDefinitionKey ?? '', params?.caseDefinitionVersionTag ?? '', processDefinitionKey)), finalize(() => this.disabled$.next(false)))
2220
2228
  .subscribe(processLink => {
2221
2229
  this.selectedProcessKey$.next(processLink.processDefinitionKey);
2222
- this.disabled$.next(false);
2223
- });
2230
+ }));
2224
2231
  }
2225
2232
  setDocumentenApiUploaderProvider(config) {
2226
2233
  const supportsUploadProcessLink = config.uploadProvider === UploadProvider.DOCUMENTEN_API ||