@masterteam/delegations 0.0.19 → 0.0.21

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.19",
3
+ "version": "0.0.21",
4
4
  "publishConfig": {
5
5
  "directory": "../../../dist/masterteam/delegations",
6
6
  "linkDirectory": false,
@@ -21,8 +21,8 @@
21
21
  "tailwindcss-primeui": "^0.6.1",
22
22
  "@ngxs/store": "^20.1.0",
23
23
  "@masterteam/components": "^0.0.175",
24
- "@masterteam/icons": "^0.0.15",
25
- "@masterteam/forms": "^0.0.80"
24
+ "@masterteam/forms": "^0.0.80",
25
+ "@masterteam/icons": "^0.0.15"
26
26
  },
27
27
  "sideEffects": false,
28
28
  "exports": {
@@ -2,6 +2,7 @@ import * as _masterteam_delegations from '@masterteam/delegations';
2
2
  import * as _angular_core from '@angular/core';
3
3
  import { OnInit, TemplateRef } from '@angular/core';
4
4
  import { Popover } from 'primeng/popover';
5
+ import { PageHeaderTab } from '@masterteam/components/page-header';
5
6
  import { TableAction, ColumnDef } from '@masterteam/components/table';
6
7
  import { FormControl } from '@angular/forms';
7
8
  import { HttpContext, HttpInterceptorFn } from '@angular/common/http';
@@ -70,6 +71,10 @@ interface DelegationScopeTarget {
70
71
  applicationKey: string;
71
72
  targetType: string;
72
73
  targetKey: string;
74
+ parentTargetType?: string | null;
75
+ parentTargetKey?: string | null;
76
+ parentDisplayName?: DelegationDisplayValue;
77
+ parentLevelId?: number | null;
73
78
  legacyModuleId?: number | null;
74
79
  targetId?: number | null;
75
80
  levelId?: number | null;
@@ -78,6 +83,7 @@ interface DelegationScopeTarget {
78
83
  moduleKey?: string | null;
79
84
  permissionModuleType?: string | null;
80
85
  permissionTargetId?: number | null;
86
+ isDelegable?: boolean;
81
87
  displayName?: DelegationDisplayValue;
82
88
  displayLabel?: DelegationDisplayValue;
83
89
  label?: DelegationDisplayValue;
@@ -94,7 +100,9 @@ interface DelegationScopeAction {
94
100
  permissionCommand?: string | null;
95
101
  businessActionCode?: string | null;
96
102
  isHighRisk?: boolean;
103
+ isDelegable?: boolean;
97
104
  isDelegableSnapshot?: boolean;
105
+ sortOrder?: number | null;
98
106
  }
99
107
  interface DelegationScopeFact {
100
108
  key?: string | null;
@@ -130,10 +138,25 @@ interface DelegationScopeCombinationRule {
130
138
  [extra: string]: unknown;
131
139
  }
132
140
  /**
133
- * `scope/options` may come back either as legacy `grants[]` or as the newer
134
- * catalog facts (`targets + operations + combinationRules`).
141
+ * `scope/options` now prefers backend-owned `hierarchy` for FE rendering.
142
+ * Flat `grants[]` / `targets + operations + combinationRules` remain for
143
+ * compatibility and diagnostics while older environments catch up.
135
144
  */
145
+ interface DelegationScopeHierarchyTarget {
146
+ target: DelegationScopeTarget;
147
+ operations: DelegationScopeAction[];
148
+ sortOrder?: number | null;
149
+ }
150
+ interface DelegationScopeHierarchyGroup {
151
+ groupType: string;
152
+ groupKey: string;
153
+ displayName?: DelegationDisplayValue;
154
+ levelId?: number | null;
155
+ sortOrder?: number | null;
156
+ targets: DelegationScopeHierarchyTarget[];
157
+ }
136
158
  interface DelegationScopeOptions {
159
+ hierarchy?: DelegationScopeHierarchyGroup[] | null;
137
160
  grants?: DelegationGrant[] | null;
138
161
  metadata?: Record<string, unknown>;
139
162
  targets?: DelegationScopeTarget[] | null;
@@ -350,9 +373,18 @@ declare class RejectDelegationDialog {
350
373
  static ɵcmp: _angular_core.ɵɵComponentDeclaration<RejectDelegationDialog, "mt-reject-delegation-dialog", never, { "delegation": { "alias": "delegation"; "required": true; "isSignal": true; }; }, {}, never, never, true, never>;
351
374
  }
352
375
 
353
- declare class Delegations {
376
+ declare class Delegations implements OnInit {
377
+ private readonly route;
354
378
  private readonly router;
379
+ private readonly transloco;
380
+ protected readonly tabs: _angular_core.WritableSignal<PageHeaderTab[]>;
381
+ protected readonly activeTab: _angular_core.WritableSignal<string>;
382
+ constructor();
383
+ ngOnInit(): void;
355
384
  goBack(): void;
385
+ protected onTabChange(value: string | number): void;
386
+ private syncSelectedTabFromRoute;
387
+ private getRouteTabs;
356
388
  static ɵfac: _angular_core.ɵɵFactoryDeclaration<Delegations, never>;
357
389
  static ɵcmp: _angular_core.ɵɵComponentDeclaration<Delegations, "mt-delegations", never, {}, {}, never, never, true, never>;
358
390
  }
@@ -506,19 +538,29 @@ declare class DelegationDetailDrawer implements OnInit {
506
538
  static ɵcmp: _angular_core.ɵɵComponentDeclaration<DelegationDetailDrawer, "mt-delegation-detail-drawer", never, { "delegationId": { "alias": "delegationId"; "required": true; "isSignal": true; }; }, {}, never, never, true, never>;
507
539
  }
508
540
 
509
- interface TargetGroup {
541
+ interface DelegationGrantableTargetGroup {
510
542
  key: string;
511
543
  target: DelegationScopeTarget;
512
544
  grants: DelegationGrant[];
545
+ sortOrder: number;
546
+ }
547
+ interface DelegationGrantableHierarchyGroup {
548
+ key: string;
549
+ groupType: string;
550
+ displayName?: DelegationDisplayValue;
551
+ sortOrder: number;
552
+ targets: DelegationGrantableTargetGroup[];
513
553
  }
554
+
514
555
  /**
515
- * Grants-based scope picker (doc 03). Driven entirely by `scope/options`:
516
- * - lists grantable target/action pairs returned by the backend,
517
- * - lets the user toggle each grant,
556
+ * Hierarchy-based scope picker (doc 03). Driven entirely by `scope/options`:
557
+ * - renders backend-owned Level -> Level Module -> operations hierarchy,
558
+ * - lets the user toggle each explicit grant,
518
559
  * - calls `scope/preview` (debounced) and surfaces summary / warnings / denied.
519
560
  *
520
561
  * `[(scope)]` two-way binds a `DelegationScopeSelection`. The component never
521
- * invents permission metadata — it only echoes grants returned by options.
562
+ * invents permission metadata — it only echoes targets/actions returned by
563
+ * options.
522
564
  */
523
565
  declare class ScopePicker {
524
566
  readonly scope: _angular_core.ModelSignal<DelegationScopeSelection>;
@@ -536,22 +578,24 @@ declare class ScopePicker {
536
578
  protected readonly isLoadingOptions: _angular_core.Signal<boolean>;
537
579
  protected readonly isPreviewing: _angular_core.Signal<boolean>;
538
580
  protected readonly errorOptions: _angular_core.Signal<string | null>;
539
- /** Grantable options grouped by target. */
540
- protected readonly groups: _angular_core.Signal<TargetGroup[]>;
581
+ protected readonly groups: _angular_core.Signal<DelegationGrantableHierarchyGroup[]>;
541
582
  /** Selected grant keys for O(1) checkbox state. */
542
583
  protected readonly selectedKeys: _angular_core.Signal<Set<string>>;
543
584
  private readonly expanded;
544
585
  constructor();
545
- protected isExpanded(group: TargetGroup): boolean;
546
- protected toggleAccordion(group: TargetGroup): void;
586
+ protected isExpanded(group: DelegationGrantableHierarchyGroup): boolean;
587
+ protected toggleAccordion(group: DelegationGrantableHierarchyGroup): void;
547
588
  protected isSelected(grant: DelegationGrant): boolean;
589
+ protected getGroupLabel(group: DelegationGrantableHierarchyGroup): string;
548
590
  protected getTargetLabel(target: DelegationScopeTarget): string;
549
591
  protected getActionLabel(grant: DelegationGrant): string;
592
+ protected getTargetActions(targetGroup: DelegationGrantableTargetGroup): DelegationGrant[];
550
593
  protected getPreviewSummary(summary: DelegationDisplayValue | undefined): string;
551
594
  protected formatDeniedOperation(value?: string | null): string;
552
595
  protected formatDeniedTarget(value?: string | null): string;
553
596
  protected toggleGrant(grant: DelegationGrant): void;
554
- protected selectedCount(group: TargetGroup): number;
597
+ protected selectedCount(group: DelegationGrantableHierarchyGroup): number;
598
+ protected selectedTargetCount(targetGroup: DelegationGrantableTargetGroup): number;
555
599
  private currentLanguage;
556
600
  static ɵfac: _angular_core.ɵɵFactoryDeclaration<ScopePicker, never>;
557
601
  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>;
@@ -822,4 +866,4 @@ declare class DelegationSessionFacade {
822
866
  }
823
867
 
824
868
  export { ApproveDelegation, CancelDelegation, ClearDelegationDetail, ClearScopePreview, CreateDelegationLegacy, CreateDelegationV2, DelegationDetailDrawer, DelegationForm, DelegationSessionActionKey, DelegationSessionFacade, DelegationSessionState, DelegationStatusChip, Delegations, DelegationsActionKey, DelegationsFacade, DelegationsList, DelegationsState, EndDelegationSession, GetActiveAssignedDelegations, GetAssignedDelegations, GetDelegationDetail, GetMyDelegations, GetScopeOptions, LoadDelegationCandidates, PreviewScope, RejectDelegation, RejectDelegationDialog, ScopePicker, StartDelegationSession, StartSessionDialog, SwitchDelegationSession, TopbarDelegationMenu, UpdateDelegationLegacy, UpdateDelegationV2, appDelegationInterceptor };
825
- export type { ActiveDelegationSession, ApproveDelegationRequest, CreateDelegationLegacyRequest, CreateDelegationV2Request, DelegationAllowedAction, DelegationApprovalInfo, DelegationApprovalStatus, DelegationCancellationInfo, DelegationDayRuleMode, DelegationDetail, DelegationDisplayValue, DelegationDto, DelegationEffectiveStatus, DelegationGrant, DelegationListQuery, DelegationPage, DelegationParty, DelegationRow, DelegationScopeAction, DelegationScopeCombinationRule, DelegationScopeDeniedItem, DelegationScopeFact, DelegationScopeOptions, DelegationScopePreview, DelegationScopeSelection, DelegationScopeTarget, DelegationScopeWarning, DelegationSessionInvalidationReason, DelegationSessionStateModel, DelegationSortDirection, DelegationStatusInfo, DelegationsStateModel, RejectDelegationRequest, UpdateDelegationLegacyRequest, UpdateDelegationV2Request };
869
+ 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 };