@masterteam/delegations 0.0.22 → 0.0.24

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.
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@masterteam/delegations",
3
- "version": "0.0.22",
3
+ "version": "0.0.24",
4
4
  "publishConfig": {
5
5
  "directory": "../../../dist/masterteam/delegations",
6
6
  "linkDirectory": false,
@@ -20,8 +20,8 @@
20
20
  "tailwindcss": "^4.2.2",
21
21
  "tailwindcss-primeui": "^0.6.1",
22
22
  "@ngxs/store": "^20.1.0",
23
- "@masterteam/components": "^0.0.175",
24
23
  "@masterteam/forms": "^0.0.80",
24
+ "@masterteam/components": "^0.0.175",
25
25
  "@masterteam/icons": "^0.0.15"
26
26
  },
27
27
  "sideEffects": false,
@@ -9,6 +9,7 @@ import { HttpContext, HttpInterceptorFn } from '@angular/common/http';
9
9
  import { DynamicFormConfig } from '@masterteam/components';
10
10
  import { ModalRef } from '@masterteam/components/dialog';
11
11
  import { ModalService } from '@masterteam/components/modal';
12
+ import { TreeNode, TreeActionEvent } from '@masterteam/components/tree';
12
13
  import * as rxjs from 'rxjs';
13
14
  import { StateContext } from '@ngxs/store';
14
15
 
@@ -252,12 +253,30 @@ interface CreateDelegationV2Request {
252
253
  requiresApproval: boolean;
253
254
  scope: DelegationScopeSelection;
254
255
  }
256
+ interface AdminCreateDelegationV2Request {
257
+ delegatorUserId: string;
258
+ delegatedUserId: string;
259
+ description?: string;
260
+ delegateFromDateTime: string;
261
+ delegateToDateTime: string;
262
+ delegationDaysType: DelegationDayRuleMode;
263
+ specificDays?: number[];
264
+ requiresApproval: boolean;
265
+ scope: DelegationScopeSelection;
266
+ }
255
267
  type UpdateDelegationLegacyRequest = CreateDelegationLegacyRequest & {
256
268
  rowVersion: string;
257
269
  };
258
270
  type UpdateDelegationV2Request = CreateDelegationV2Request & {
259
271
  rowVersion: string;
260
272
  };
273
+ type AdminUpdateDelegationV2Request = AdminCreateDelegationV2Request & {
274
+ rowVersion: string;
275
+ };
276
+ interface DelegationScopePreviewRequest {
277
+ scope: DelegationScopeSelection;
278
+ delegatorUserId?: string | null;
279
+ }
261
280
  interface ApproveDelegationRequest {
262
281
  rowVersion: string;
263
282
  reason?: string;
@@ -312,7 +331,7 @@ declare class TopbarDelegationMenu {
312
331
  protected readonly hasCandidates: _angular_core.Signal<boolean>;
313
332
  protected readonly onBehalfOf: _angular_core.Signal<_masterteam_delegations.DelegationParty | null>;
314
333
  protected readonly executedBy: _angular_core.Signal<_masterteam_delegations.DelegationParty | null>;
315
- protected readonly mode: _angular_core.Signal<"hidden" | "active" | "candidates">;
334
+ protected readonly mode: _angular_core.Signal<"active" | "candidates" | "hidden">;
316
335
  protected formatScopeSummary(summary: DelegationRow['scopeSummary']): string;
317
336
  togglePopover(event: Event): void;
318
337
  start(row: DelegationRow, event: MouseEvent): void;
@@ -419,6 +438,7 @@ declare class DelegationsList implements OnInit {
419
438
  readonly assignedEmptyStateKey: _angular_core.InputSignal<string>;
420
439
  readonly assignedStatus: _angular_core.InputSignal<DelegationEffectiveStatus | null>;
421
440
  private readonly facade;
441
+ private readonly location;
422
442
  private readonly modal;
423
443
  private readonly transloco;
424
444
  protected readonly breadcrumbItems: _angular_core.WritableSignal<({
@@ -441,6 +461,7 @@ declare class DelegationsList implements OnInit {
441
461
  label: string;
442
462
  }[]>;
443
463
  protected readonly isLoading: _angular_core.Signal<boolean>;
464
+ protected readonly isLoadingScopeOptions: _angular_core.Signal<boolean>;
444
465
  protected readonly scopeOptions: _angular_core.Signal<_masterteam_delegations.DelegationScopeOptions | null>;
445
466
  protected readonly rows: _angular_core.Signal<DelegationRow[]>;
446
467
  protected readonly emptyStateKey: _angular_core.Signal<string>;
@@ -458,6 +479,7 @@ declare class DelegationsList implements OnInit {
458
479
  private readonly weekdayKeys;
459
480
  ngOnInit(): void;
460
481
  protected switchTab(tab: DelegationTab): void;
482
+ protected goBack(): void;
461
483
  private loadCurrentTab;
462
484
  private reloadCurrentTab;
463
485
  protected has(row: DelegationRow, action: DelegationAllowedAction): boolean;
@@ -541,6 +563,7 @@ type DetailTab = 'overview' | 'scope';
541
563
  */
542
564
  declare class DelegationDetailDrawer implements OnInit {
543
565
  readonly delegationId: _angular_core.InputSignal<number>;
566
+ readonly adminMode: _angular_core.InputSignal<boolean>;
544
567
  private readonly facade;
545
568
  private readonly transloco;
546
569
  protected readonly ref: ModalRef;
@@ -559,7 +582,7 @@ declare class DelegationDetailDrawer implements OnInit {
559
582
  protected getScopeActionLabel(action: DelegationScopeAction): string;
560
583
  protected formatScopeSummary(summary: DelegationDisplayValue | undefined): string;
561
584
  static ɵfac: _angular_core.ɵɵFactoryDeclaration<DelegationDetailDrawer, never>;
562
- static ɵcmp: _angular_core.ɵɵComponentDeclaration<DelegationDetailDrawer, "mt-delegation-detail-drawer", never, { "delegationId": { "alias": "delegationId"; "required": true; "isSignal": true; }; }, {}, never, never, true, never>;
585
+ static ɵcmp: _angular_core.ɵɵComponentDeclaration<DelegationDetailDrawer, "mt-delegation-detail-drawer", never, { "delegationId": { "alias": "delegationId"; "required": true; "isSignal": true; }; "adminMode": { "alias": "adminMode"; "required": false; "isSignal": true; }; }, {}, never, never, true, never>;
563
586
  }
564
587
 
565
588
  interface DelegationGrantableTargetGroup {
@@ -589,6 +612,7 @@ interface DelegationGrantableHierarchyGroup {
589
612
  declare class ScopePicker {
590
613
  readonly scope: _angular_core.ModelSignal<DelegationScopeSelection>;
591
614
  readonly readonly: _angular_core.InputSignal<boolean>;
615
+ readonly adminMode: _angular_core.InputSignal<boolean>;
592
616
  /**
593
617
  * Delegator whose grantable scope is loaded. Undefined = current user
594
618
  * (self-service). In admin mode the host rebinds this as the selected
@@ -603,26 +627,25 @@ declare class ScopePicker {
603
627
  protected readonly isPreviewing: _angular_core.Signal<boolean>;
604
628
  protected readonly errorOptions: _angular_core.Signal<string | null>;
605
629
  protected readonly groups: _angular_core.Signal<DelegationGrantableHierarchyGroup[]>;
630
+ protected readonly activeLang: _angular_core.Signal<string>;
606
631
  /** Selected grant keys for O(1) checkbox state. */
607
632
  protected readonly selectedKeys: _angular_core.Signal<Set<string>>;
608
- private readonly expanded;
633
+ protected readonly treeSelection: _angular_core.WritableSignal<TreeNode<any>[] | null>;
634
+ protected readonly treeNodes: _angular_core.Signal<TreeNode<any>[]>;
635
+ protected readonly grantIndex: _angular_core.Signal<Map<string, DelegationGrant>>;
609
636
  constructor();
610
- protected isExpanded(group: DelegationGrantableHierarchyGroup): boolean;
611
- protected toggleAccordion(group: DelegationGrantableHierarchyGroup): void;
612
- protected isSelected(grant: DelegationGrant): boolean;
613
- protected getGroupLabel(group: DelegationGrantableHierarchyGroup): string;
614
- protected getTargetLabel(target: DelegationScopeTarget): string;
615
- protected getActionLabel(grant: DelegationGrant): string;
616
- protected getTargetActions(targetGroup: DelegationGrantableTargetGroup): DelegationGrant[];
637
+ protected onTreeAction(event: TreeActionEvent): void;
617
638
  protected getPreviewSummary(summary: DelegationDisplayValue | undefined): string;
618
639
  protected formatDeniedOperation(value?: string | null): string;
619
640
  protected formatDeniedTarget(value?: string | null): string;
620
- protected toggleGrant(grant: DelegationGrant): void;
621
- protected selectedCount(group: DelegationGrantableHierarchyGroup): number;
622
- protected selectedTargetCount(targetGroup: DelegationGrantableTargetGroup): number;
641
+ private buildTreeNodes;
642
+ private buildTargetNode;
643
+ private getGroupLabel;
644
+ private getTargetLabel;
645
+ private getActionLabel;
623
646
  private currentLanguage;
624
647
  static ɵfac: _angular_core.ɵɵFactoryDeclaration<ScopePicker, never>;
625
- static ɵcmp: _angular_core.ɵɵComponentDeclaration<ScopePicker, "mt-scope-picker", never, { "scope": { "alias": "scope"; "required": false; "isSignal": true; }; "readonly": { "alias": "readonly"; "required": false; "isSignal": true; }; "delegatorUserId": { "alias": "delegatorUserId"; "required": false; "isSignal": true; }; }, { "scope": "scopeChange"; }, never, never, true, never>;
648
+ static ɵcmp: _angular_core.ɵɵComponentDeclaration<ScopePicker, "mt-scope-picker", never, { "scope": { "alias": "scope"; "required": false; "isSignal": true; }; "readonly": { "alias": "readonly"; "required": false; "isSignal": true; }; "adminMode": { "alias": "adminMode"; "required": false; "isSignal": true; }; "delegatorUserId": { "alias": "delegatorUserId"; "required": false; "isSignal": true; }; }, { "scope": "scopeChange"; }, never, never, true, never>;
626
649
  }
627
650
 
628
651
  /**
@@ -654,21 +677,24 @@ declare class GetActiveAssignedDelegations {
654
677
  }
655
678
  declare class GetDelegationDetail {
656
679
  id: number;
680
+ asAdmin: boolean;
657
681
  static readonly type = "[Delegations] Get Delegation Detail";
658
- constructor(id: number);
682
+ constructor(id: number, asAdmin?: boolean);
659
683
  }
660
684
  declare class ClearDelegationDetail {
661
685
  static readonly type = "[Delegations] Clear Delegation Detail";
662
686
  }
663
687
  declare class GetScopeOptions {
664
688
  delegatorUserId?: string | undefined;
689
+ asAdmin: boolean;
665
690
  static readonly type = "[Delegations] Get Scope Options";
666
- constructor(delegatorUserId?: string | undefined);
691
+ constructor(delegatorUserId?: string | undefined, asAdmin?: boolean);
667
692
  }
668
693
  declare class PreviewScope {
669
- scope: DelegationScopeSelection;
694
+ request: DelegationScopePreviewRequest;
695
+ asAdmin: boolean;
670
696
  static readonly type = "[Delegations] Preview Scope";
671
- constructor(scope: DelegationScopeSelection);
697
+ constructor(request: DelegationScopePreviewRequest, asAdmin?: boolean);
672
698
  }
673
699
  declare class ClearScopePreview {
674
700
  static readonly type = "[Delegations] Clear Scope Preview";
@@ -679,9 +705,10 @@ declare class CreateDelegationLegacy {
679
705
  constructor(request: CreateDelegationLegacyRequest);
680
706
  }
681
707
  declare class CreateDelegationV2 {
682
- request: CreateDelegationV2Request;
708
+ request: CreateDelegationV2Request | AdminCreateDelegationV2Request;
709
+ asAdmin: boolean;
683
710
  static readonly type = "[Delegations] Create Delegation (v2)";
684
- constructor(request: CreateDelegationV2Request);
711
+ constructor(request: CreateDelegationV2Request | AdminCreateDelegationV2Request, asAdmin?: boolean);
685
712
  }
686
713
  declare class UpdateDelegationLegacy {
687
714
  id: number;
@@ -691,9 +718,10 @@ declare class UpdateDelegationLegacy {
691
718
  }
692
719
  declare class UpdateDelegationV2 {
693
720
  id: number;
694
- request: UpdateDelegationV2Request;
721
+ request: UpdateDelegationV2Request | AdminUpdateDelegationV2Request;
722
+ asAdmin: boolean;
695
723
  static readonly type = "[Delegations] Update Delegation (v2)";
696
- constructor(id: number, request: UpdateDelegationV2Request);
724
+ constructor(id: number, request: UpdateDelegationV2Request | AdminUpdateDelegationV2Request, asAdmin?: boolean);
697
725
  }
698
726
  declare class ApproveDelegation {
699
727
  id: number;
@@ -747,18 +775,20 @@ declare class DelegationsState {
747
775
  getAssigned(ctx: StateContext<DelegationsStateModel>, { query }: GetAssignedDelegations): rxjs.Observable<Response<DelegationPage<DelegationRow>>>;
748
776
  getAdmin(ctx: StateContext<DelegationsStateModel>, { query }: GetAdminDelegations): rxjs.Observable<Response<DelegationPage<DelegationRow>>>;
749
777
  getActive(ctx: StateContext<DelegationsStateModel>, { query }: GetActiveAssignedDelegations): rxjs.Observable<Response<DelegationPage<DelegationRow>>>;
750
- getDetail(ctx: StateContext<DelegationsStateModel>, { id }: GetDelegationDetail): rxjs.Observable<Response<DelegationDetail>>;
778
+ getDetail(ctx: StateContext<DelegationsStateModel>, { id, asAdmin }: GetDelegationDetail): rxjs.Observable<Response<DelegationDetail>>;
751
779
  clearDetail(ctx: StateContext<DelegationsStateModel>): void;
752
- getScopeOptions(ctx: StateContext<DelegationsStateModel>, { delegatorUserId }: GetScopeOptions): rxjs.Observable<Response<DelegationScopeOptions>>;
753
- previewScope(ctx: StateContext<DelegationsStateModel>, { scope }: PreviewScope): rxjs.Observable<Response<DelegationScopePreview>>;
780
+ getScopeOptions(ctx: StateContext<DelegationsStateModel>, { delegatorUserId, asAdmin }: GetScopeOptions): rxjs.Observable<Response<DelegationScopeOptions>>;
781
+ previewScope(ctx: StateContext<DelegationsStateModel>, { request, asAdmin }: PreviewScope): rxjs.Observable<Response<DelegationScopePreview>>;
754
782
  clearScopePreview(ctx: StateContext<DelegationsStateModel>): void;
755
783
  createLegacy(ctx: StateContext<DelegationsStateModel>, { request }: CreateDelegationLegacy): rxjs.Observable<Response<DelegationDto>>;
756
- createV2(ctx: StateContext<DelegationsStateModel>, { request }: CreateDelegationV2): rxjs.Observable<Response<DelegationDto>>;
784
+ createV2(ctx: StateContext<DelegationsStateModel>, { request, asAdmin }: CreateDelegationV2): rxjs.Observable<Response<DelegationDto>>;
757
785
  updateLegacy(ctx: StateContext<DelegationsStateModel>, { id, request }: UpdateDelegationLegacy): rxjs.Observable<Response<DelegationDto>>;
758
- updateV2(ctx: StateContext<DelegationsStateModel>, { id, request }: UpdateDelegationV2): rxjs.Observable<Response<DelegationDto>>;
786
+ updateV2(ctx: StateContext<DelegationsStateModel>, { id, request, asAdmin }: UpdateDelegationV2): rxjs.Observable<Response<DelegationDto>>;
759
787
  approve(ctx: StateContext<DelegationsStateModel>, { id, request }: ApproveDelegation): rxjs.Observable<Response<DelegationDto>>;
760
788
  reject(ctx: StateContext<DelegationsStateModel>, { id, request }: RejectDelegation): rxjs.Observable<Response<DelegationDto>>;
761
789
  cancel(ctx: StateContext<DelegationsStateModel>, { id, rowVersion, asAdmin }: CancelDelegation): rxjs.Observable<Response<boolean>>;
790
+ private buildScopePreviewRequest;
791
+ private buildAdminSaveRequest;
762
792
  static ɵfac: _angular_core.ɵɵFactoryDeclaration<DelegationsState, never>;
763
793
  static ɵprov: _angular_core.ɵɵInjectableDeclaration<DelegationsState>;
764
794
  }
@@ -799,15 +829,18 @@ declare class DelegationsFacade {
799
829
  getAssigned(query?: DelegationListQuery): rxjs.Observable<void>;
800
830
  getAdmin(query?: DelegationListQuery): rxjs.Observable<void>;
801
831
  getActive(query?: DelegationListQuery): rxjs.Observable<void>;
802
- getDetail(id: number): rxjs.Observable<void>;
832
+ getDetail(id: number, asAdmin?: boolean): rxjs.Observable<void>;
803
833
  clearDetail(): rxjs.Observable<void>;
804
- loadScopeOptions(delegatorUserId?: string): rxjs.Observable<void>;
805
- previewScope(scope: DelegationScopeSelection): rxjs.Observable<void>;
834
+ loadScopeOptions(delegatorUserId?: string, asAdmin?: boolean): rxjs.Observable<void>;
835
+ previewScope(scope: DelegationScopeSelection, options?: {
836
+ delegatorUserId?: string;
837
+ asAdmin?: boolean;
838
+ }): rxjs.Observable<void>;
806
839
  clearScopePreview(): rxjs.Observable<void>;
807
840
  createLegacy(request: CreateDelegationLegacyRequest): rxjs.Observable<void>;
808
- createV2(request: CreateDelegationV2Request): rxjs.Observable<void>;
841
+ createV2(request: CreateDelegationV2Request | AdminCreateDelegationV2Request, asAdmin?: boolean): rxjs.Observable<void>;
809
842
  updateLegacy(id: number, request: UpdateDelegationLegacyRequest): rxjs.Observable<void>;
810
- updateV2(id: number, request: UpdateDelegationV2Request): rxjs.Observable<void>;
843
+ updateV2(id: number, request: UpdateDelegationV2Request | AdminUpdateDelegationV2Request, asAdmin?: boolean): rxjs.Observable<void>;
811
844
  approve(id: number, request: ApproveDelegationRequest): rxjs.Observable<void>;
812
845
  reject(id: number, request: RejectDelegationRequest): rxjs.Observable<void>;
813
846
  cancel(id: number, rowVersion: string, asAdmin?: boolean): rxjs.Observable<void>;
@@ -902,4 +935,4 @@ declare class DelegationSessionFacade {
902
935
  }
903
936
 
904
937
  export { ApproveDelegation, CancelDelegation, ClearDelegationDetail, ClearScopePreview, CreateDelegationLegacy, CreateDelegationV2, DelegationDetailDrawer, DelegationForm, DelegationSessionActionKey, DelegationSessionFacade, DelegationSessionState, DelegationStatusChip, Delegations, DelegationsActionKey, DelegationsFacade, DelegationsList, DelegationsState, EndDelegationSession, GetActiveAssignedDelegations, GetAdminDelegations, GetAssignedDelegations, GetDelegationDetail, GetMyDelegations, GetScopeOptions, LoadDelegationCandidates, PreviewScope, RejectDelegation, RejectDelegationDialog, ScopePicker, StartDelegationSession, StartSessionDialog, SwitchDelegationSession, TopbarDelegationMenu, UpdateDelegationLegacy, UpdateDelegationV2, appDelegationInterceptor };
905
- export type { ActiveDelegationSession, ApproveDelegationRequest, CreateDelegationLegacyRequest, CreateDelegationV2Request, DelegationAllowedAction, DelegationApprovalInfo, DelegationApprovalStatus, DelegationCancellationInfo, DelegationDayRuleMode, DelegationDetail, DelegationDisplayValue, DelegationDto, DelegationEffectiveStatus, DelegationGrant, DelegationListQuery, DelegationPage, DelegationParty, DelegationRow, DelegationScopeAction, DelegationScopeCombinationRule, DelegationScopeDeniedItem, DelegationScopeFact, DelegationScopeHierarchyGroup, DelegationScopeHierarchyTarget, DelegationScopeOptions, DelegationScopePreview, DelegationScopeSelection, DelegationScopeTarget, DelegationScopeWarning, DelegationSessionInvalidationReason, DelegationSessionStateModel, DelegationSortDirection, DelegationStatusInfo, DelegationsStateModel, RejectDelegationRequest, UpdateDelegationLegacyRequest, UpdateDelegationV2Request };
938
+ export type { ActiveDelegationSession, AdminCreateDelegationV2Request, AdminUpdateDelegationV2Request, ApproveDelegationRequest, CreateDelegationLegacyRequest, CreateDelegationV2Request, DelegationAllowedAction, DelegationApprovalInfo, DelegationApprovalStatus, DelegationCancellationInfo, DelegationDayRuleMode, DelegationDetail, DelegationDisplayValue, DelegationDto, DelegationEffectiveStatus, DelegationGrant, DelegationListQuery, DelegationPage, DelegationParty, DelegationRow, DelegationScopeAction, DelegationScopeCombinationRule, DelegationScopeDeniedItem, DelegationScopeFact, DelegationScopeHierarchyGroup, DelegationScopeHierarchyTarget, DelegationScopeOptions, DelegationScopePreview, DelegationScopePreviewRequest, DelegationScopeSelection, DelegationScopeTarget, DelegationScopeWarning, DelegationSessionInvalidationReason, DelegationSessionStateModel, DelegationSortDirection, DelegationStatusInfo, DelegationsStateModel, RejectDelegationRequest, UpdateDelegationLegacyRequest, UpdateDelegationV2Request };