vc-create-dashboard 3.0.81 → 3.0.83

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.
Files changed (20) hide show
  1. package/esm2022/lib/create-dashboard-container/configure-widgets/configure-widgets/configure-widgets.component.mjs +76 -80
  2. package/esm2022/lib/create-dashboard-container/create-dashboard.component.mjs +652 -105
  3. package/esm2022/lib/create-dashboard-container/pipes/search-program.pipe.mjs +37 -0
  4. package/esm2022/lib/create-dashboard-container/program-list/pipes/check-selected-items.pipes.mjs +2 -2
  5. package/esm2022/lib/create-dashboard-container/program-list/program-list/program-list.component.mjs +17 -3
  6. package/esm2022/lib/create-dashboard-container/program-list/program-list.module.mjs +2 -2
  7. package/esm2022/lib/create-dashboard-container/services/create-dashboard.service.mjs +62 -4
  8. package/esm2022/lib/create-dashboard-container/utils/dashboard-edit.utils.mjs +181 -0
  9. package/esm2022/lib/ui-kit/dialog/dialog.component.mjs +8 -11
  10. package/fesm2022/vc-create-dashboard.mjs +1187 -396
  11. package/fesm2022/vc-create-dashboard.mjs.map +1 -1
  12. package/lib/create-dashboard-container/configure-widgets/configure-widgets/configure-widgets.component.d.ts +5 -0
  13. package/lib/create-dashboard-container/create-dashboard.component.d.ts +40 -17
  14. package/lib/create-dashboard-container/program-list/program-list/program-list.component.d.ts +1 -0
  15. package/lib/create-dashboard-container/program-list/program-list.module.d.ts +1 -1
  16. package/lib/create-dashboard-container/services/create-dashboard.service.d.ts +20 -1
  17. package/lib/create-dashboard-container/utils/dashboard-edit.utils.d.ts +16 -0
  18. package/package.json +1 -1
  19. package/esm2022/lib/create-dashboard-container/pipes/search-progra.pipe.mjs +0 -37
  20. /package/lib/create-dashboard-container/pipes/{search-progra.pipe.d.ts → search-program.pipe.d.ts} +0 -0
@@ -68,6 +68,11 @@ export declare class ConfigureWidgetsComponent implements OnInit, OnChanges {
68
68
  riskWidgetsDisplayCount: number;
69
69
  constructor(dialog: DialogRef, configureWidgetsService: ConfigureWidgetsService, snackBar: SnackBarService);
70
70
  ngOnChanges(): void;
71
+ /** EDIT: show full widget catalog; check items present in getWidgets widgetArr. */
72
+ private applyEditModeWidgetCatalog;
73
+ /** CREATE: limit visible tiles to displayedWidgets when provided. */
74
+ private applyCreateModeWidgetVisibility;
75
+ private applySavedWidgetSelection;
71
76
  ngOnInit(): void;
72
77
  widgetsList: {
73
78
  COMPLIANCE: ({
@@ -1,4 +1,4 @@
1
- import { ChangeDetectorRef, ElementRef, EventEmitter, OnChanges, OnInit } from '@angular/core';
1
+ import { ChangeDetectorRef, ElementRef, EventEmitter, OnChanges, OnInit, SimpleChanges } from '@angular/core';
2
2
  import { EditorConfig } from '@vcomply/editor';
3
3
  import { DatePickerComponent, IDatePickerConfig } from 'ng2-date-picker';
4
4
  import { CreateDashboardService } from './services/create-dashboard.service';
@@ -6,7 +6,6 @@ import { PaginationService } from './services/pagination.service';
6
6
  import { UserListConfiguration } from './user-list/user-list.config';
7
7
  import { CreateDashboardForm } from './create-dashboard-config';
8
8
  import { SnackBarService } from '../ui-kit/snack-bar/snack-bar.service';
9
- import { ConfigureWidgetsService } from './services/configure-widgets.service';
10
9
  import { PopoverService } from '../ui-kit/popover/popover.service';
11
10
  import { TextCountPipe } from './pipes/text-count.pipe';
12
11
  import { ListItem } from './program-list/interfaces/list-item.interface';
@@ -17,13 +16,13 @@ export declare class CreateDashboardComponent implements OnInit, OnChanges {
17
16
  private cdr;
18
17
  private snackBar;
19
18
  popoverService: PopoverService;
20
- private configureWidgetsService;
21
19
  private textCount;
22
20
  feature: any;
23
21
  activeSelector: string;
24
22
  disabled: boolean;
25
23
  mode: string;
26
24
  dashboardId: string;
25
+ dashboardDetails: any;
27
26
  /** API dashboard object from createDashboard response (used when navigating after create). */
28
27
  private createdDashboard;
29
28
  close: EventEmitter<any>;
@@ -38,9 +37,8 @@ export declare class CreateDashboardComponent implements OnInit, OnChanges {
38
37
  usersList: any[];
39
38
  vLoader: boolean;
40
39
  userListLoaded: boolean;
40
+ groupListLoaded: boolean;
41
41
  rcListLoaded: boolean;
42
- complianceCategoriesListLoaded: boolean;
43
- riskCategoryListLoaded: boolean;
44
42
  hideToDate: boolean;
45
43
  listDetails: UserListConfiguration;
46
44
  dashboardDescription: EditorConfig;
@@ -53,12 +51,11 @@ export declare class CreateDashboardComponent implements OnInit, OnChanges {
53
51
  openConfigureWidgets: boolean;
54
52
  selectedWidgets: any;
55
53
  displayedWidgets: any;
56
- responsibilityCentersList: never[];
54
+ responsibilityCentersList: any[];
57
55
  datePickerOverlay: boolean;
58
56
  dayNames: string[];
59
57
  monthNames: string[];
60
58
  quarters: string[];
61
- categoryListLoaded: boolean;
62
59
  showRiskWidgets: boolean;
63
60
  showComplianceWidgets: boolean;
64
61
  isManageRisk: boolean;
@@ -81,7 +78,6 @@ export declare class CreateDashboardComponent implements OnInit, OnChanges {
81
78
  };
82
79
  };
83
80
  programListUrl: any;
84
- programSelections: Record<string, any[]>;
85
81
  fromDatePickerConfig: IDatePickerConfig;
86
82
  toDatePickerConfig: IDatePickerConfig;
87
83
  isSmiley: boolean;
@@ -94,8 +90,13 @@ export declare class CreateDashboardComponent implements OnInit, OnChanges {
94
90
  openedDatePicker: string;
95
91
  selectedPrograms: any;
96
92
  allProgamSelected: any[];
97
- constructor(createDashboardService: CreateDashboardService, paginationService: PaginationService, cdr: ChangeDetectorRef, snackBar: SnackBarService, popoverService: PopoverService, configureWidgetsService: ConfigureWidgetsService, textCount: TextCountPipe);
98
- ngOnChanges(): void;
93
+ private pendingEditRcIds;
94
+ private pendingEditRcEntries;
95
+ private editFormHydrated;
96
+ /** Tracks in-flight EDIT hydration HTTP calls; loader stays on until zero. */
97
+ private editHydrationCount;
98
+ constructor(createDashboardService: CreateDashboardService, paginationService: PaginationService, cdr: ChangeDetectorRef, snackBar: SnackBarService, popoverService: PopoverService, textCount: TextCountPipe);
99
+ ngOnChanges(changes: SimpleChanges): void;
99
100
  onKeydownHandler(event: KeyboardEvent): void;
100
101
  ngOnInit(): void;
101
102
  animateContainer(): void;
@@ -107,13 +108,12 @@ export declare class CreateDashboardComponent implements OnInit, OnChanges {
107
108
  */
108
109
  activateSelector(type: any, event: boolean): void;
109
110
  onProgramSelectionChange(items: ListItem[]): void;
110
- activeDeselector(): void;
111
111
  selectCategory(): void;
112
112
  checkDefaultProgramOnRemove(event: any): void;
113
113
  removeProgram(program: any): void;
114
- private getProgramSelectionMap;
115
- private flattenProgramSelectionMap;
116
- private normalizeProgramCategories;
114
+ private syncProgramSelectionMapFromForm;
115
+ private hydrateProgramsFromDashboardData;
116
+ private applyFlatProgramCategories;
117
117
  private applyResponsibilityCategoryWidgetFilters;
118
118
  openFromDatePicker(): void;
119
119
  openToDatePicker(): void;
@@ -160,7 +160,26 @@ export declare class CreateDashboardComponent implements OnInit, OnChanges {
160
160
  uniqueByProp(array: any, key: string): unknown[];
161
161
  saveSelectedList(type: string, selectedItems: any): void;
162
162
  remove(type: any, event: any, removeIndex?: any): void;
163
- setList(list: any[], ids: any[], key: string): any;
163
+ setList(list: any[], ids: any[], key: string): any[];
164
+ private setListByIds;
165
+ private flattenRcTree;
166
+ private normalizeRcList;
167
+ private resolveRcFromTree;
168
+ private applyPreresolvedRcEntries;
169
+ private applyPendingResponsibilityCenters;
170
+ private beginEditHydration;
171
+ private finishEditHydration;
172
+ private tryCompleteEditHydration;
173
+ private wrapEditRequest;
174
+ private syncProgramsForEdit;
175
+ private applyProgramsFromDashboardIds;
176
+ private ensureProgramSelectionMapForList;
177
+ private applyProgramSelectionMap;
178
+ private categoryMatchesId;
179
+ private loadProgramsForEdit;
180
+ /** Custom dashboards often store program ids only — resolve names for form chips. */
181
+ private resolveProgramIdsForEdit;
182
+ private buildEditDashboardData;
164
183
  submitted: boolean;
165
184
  /**
166
185
  * Returns id's from a particular list elements
@@ -173,7 +192,7 @@ export declare class CreateDashboardComponent implements OnInit, OnChanges {
173
192
  */
174
193
  validateDashboard(): boolean;
175
194
  /**
176
- * Makes an api call to create a policy
195
+ * Makes an api call to create a dashboad
177
196
  * @param dashboard contains dashboardForm data
178
197
  */
179
198
  submitDashboard(): false | undefined;
@@ -181,6 +200,10 @@ export declare class CreateDashboardComponent implements OnInit, OnChanges {
181
200
  onSubmitDashboard(): void;
182
201
  saveDashboard(payload: any): void;
183
202
  private getCreatedDashboardCdid;
203
+ private hydrateEditForm;
204
+ private applyWidgetsFromGetWidgetsResponse;
205
+ /** EDIT mode only: GET getWidgets?dashboardId={cdid} */
206
+ private loadEditModeWidgets;
184
207
  editDashboard(): void;
185
208
  populateDashboardForm(data: any): void;
186
209
  ngAfterViewChecked(): void;
@@ -189,5 +212,5 @@ export declare class CreateDashboardComponent implements OnInit, OnChanges {
189
212
  documentClick(event: any): void;
190
213
  documentClickListener(target: any, openedElements: ElementRef, selectedDatePicker: any): void;
191
214
  static ɵfac: i0.ɵɵFactoryDeclaration<CreateDashboardComponent, never>;
192
- static ɵcmp: i0.ɵɵComponentDeclaration<CreateDashboardComponent, "app-create-dashboard", never, { "feature": { "alias": "feature"; "required": false; }; "mode": { "alias": "mode"; "required": false; }; "dashboardId": { "alias": "dashboardId"; "required": false; }; "createdBy": { "alias": "createdBy"; "required": false; }; "configureWidget": { "alias": "configureWidget"; "required": false; }; }, { "close": "close"; }, never, never, false, never>;
215
+ static ɵcmp: i0.ɵɵComponentDeclaration<CreateDashboardComponent, "app-create-dashboard", never, { "feature": { "alias": "feature"; "required": false; }; "mode": { "alias": "mode"; "required": false; }; "dashboardId": { "alias": "dashboardId"; "required": false; }; "dashboardDetails": { "alias": "dashboardDetails"; "required": false; }; "createdBy": { "alias": "createdBy"; "required": false; }; "configureWidget": { "alias": "configureWidget"; "required": false; }; }, { "close": "close"; }, never, never, false, never>;
193
216
  }
@@ -42,6 +42,7 @@ export declare class ProgramListComponent<T extends ListItem> implements OnInit,
42
42
  ngOnInit(): void;
43
43
  /** Handle changes to inputs */
44
44
  ngOnChanges(changes: SimpleChanges): void;
45
+ private focusFirstProgramWithSelections;
45
46
  /** Fetch program list from API */
46
47
  getProgramList(): void;
47
48
  /**
@@ -2,7 +2,7 @@ import * as i0 from "@angular/core";
2
2
  import * as i1 from "./program-list/program-list.component";
3
3
  import * as i2 from "./pipes/check-selected-items.pipes";
4
4
  import * as i3 from "./list-container/list-container.component";
5
- import * as i4 from "../pipes/search-progra.pipe";
5
+ import * as i4 from "../pipes/search-program.pipe";
6
6
  import * as i5 from "./information-block/information-block.component";
7
7
  import * as i6 from "@angular/common";
8
8
  import * as i7 from "@angular/forms";
@@ -35,12 +35,31 @@ export declare class CreateDashboardService {
35
35
  * Fetches the Dashboard details for data population to Edit the dashboard
36
36
  * @param id
37
37
  */
38
+ /** @deprecated Legacy Global-Dashboard edit fetch; custom dashboards use fetchCustomDashboardById + getWidgets. */
38
39
  fetchDashboard(id: any): import("rxjs").Observable<ArrayBuffer>;
39
- updateDashboard(id: any, payload: any): import("rxjs").Observable<ArrayBuffer>;
40
+ /**
41
+ * Edit mode only — GET Global-Dashboard/getWidgets?dashboardId={cdid}
42
+ * @param cdid Custom dashboard id (e.g. 438F8KSK22), not numeric record id
43
+ */
44
+ fetchCustomDashboardWidgetDetails(cdid: string): import("rxjs").Observable<{
45
+ widgetArr: any[];
46
+ allWidgetsArray: any[];
47
+ activeWidgetArr: any[];
48
+ }>;
49
+ normalizeWidgetDetailsResponse(res: any): {
50
+ widgetArr: any[];
51
+ allWidgetsArray: any[];
52
+ activeWidgetArr: any[];
53
+ };
54
+ getSailsProgramList(): import("rxjs").Observable<ArrayBuffer>;
55
+ getProgramCategories(programId: string | number): import("rxjs").Observable<ArrayBuffer>;
56
+ /** Full custom dashboard payload (includes responsibilityCenterId, programId, etc.). */
57
+ fetchCustomDashboardById(id: string | number): import("rxjs").Observable<ArrayBuffer>;
40
58
  getUserInformation(): import("rxjs").Observable<ArrayBuffer>;
41
59
  _ID(): any;
42
60
  checkDuplicateDashboardName(payload: any): import("rxjs").Observable<ArrayBuffer>;
43
61
  createDashboard(payload: any): import("rxjs").Observable<ArrayBuffer>;
62
+ updateDashboard(payload: any, id: any): import("rxjs").Observable<ArrayBuffer>;
44
63
  saveWidgetDetails(payload: any): import("rxjs").Observable<ArrayBuffer>;
45
64
  buildPayload(payload: any): {
46
65
  dashboard: {
@@ -0,0 +1,16 @@
1
+ /** Shared helpers for custom dashboard create/edit form hydration. */
2
+ export type ProgramSelectionMap = Record<string, any[]>;
3
+ export declare function normalizeIdArray(value: unknown): number[];
4
+ export declare function extractProgramIdsFromDashboard(data: any): number[];
5
+ export declare function extractCategoryIdsFromDashboard(data: any): number[];
6
+ export declare function extractRcIdsFromDashboard(data: any): number[];
7
+ export declare function hasProgramSelectionInMap(map: ProgramSelectionMap | null | undefined): boolean;
8
+ export declare function normalizeProgramCategories(categories: any[]): any[];
9
+ export declare function flattenProgramSelectionMap(selections: ProgramSelectionMap): any[];
10
+ export declare function normalizeProgramSelectionMap(map: ProgramSelectionMap): ProgramSelectionMap | null;
11
+ export declare function resolveCategoryProgramId(cat: any, complianceCatalog?: any[]): string;
12
+ export declare function buildProgramSelectionMapFromCategories(categories: any[], complianceCatalog?: any[]): ProgramSelectionMap;
13
+ export declare function parseSailsProgramList(res: any): any[];
14
+ export declare function getEditDashboardCdid(data: any, dashboardDetails: any, dashboardId: string): string;
15
+ export declare function getSelectedProgramsMap(data: any): ProgramSelectionMap | undefined;
16
+ export declare function filterActiveWidgets(widgets: any[]): any[];
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "vc-create-dashboard",
3
- "version": "3.0.81",
3
+ "version": "3.0.83",
4
4
  "peerDependencies": {
5
5
  "@angular/common": " 12.x || 13.x || 14.x || 15.x || 16.x || 17.x || 18.x || 19.x ",
6
6
  "@angular/core": " 12.x || 13.x || 14.x || 15.x || 16.x || 17.x || 18.x || 19.x "
@@ -1,37 +0,0 @@
1
- import { Pipe } from '@angular/core';
2
- import * as i0 from "@angular/core";
3
- export class SearchProgramPipe {
4
- transform(items, ...args) {
5
- let searchText = args[0];
6
- const searchKey = args[1];
7
- if (!items) {
8
- return [];
9
- }
10
- if (!searchText) {
11
- return items;
12
- }
13
- searchText = searchText?.toLowerCase();
14
- if (items?.length) {
15
- return items.filter((it) => {
16
- if (!searchKey) {
17
- return JSON.stringify(it)?.toLowerCase()?.includes(searchText);
18
- }
19
- else if (searchKey) {
20
- return (it[searchKey]?.toString()?.toLowerCase()?.indexOf(searchText) > -1);
21
- }
22
- });
23
- }
24
- else {
25
- return [];
26
- }
27
- }
28
- static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "16.2.12", ngImport: i0, type: SearchProgramPipe, deps: [], target: i0.ɵɵFactoryTarget.Pipe });
29
- static ɵpipe = i0.ɵɵngDeclarePipe({ minVersion: "14.0.0", version: "16.2.12", ngImport: i0, type: SearchProgramPipe, name: "searchProgram" });
30
- }
31
- i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "16.2.12", ngImport: i0, type: SearchProgramPipe, decorators: [{
32
- type: Pipe,
33
- args: [{
34
- name: 'searchProgram',
35
- }]
36
- }] });
37
- //# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoic2VhcmNoLXByb2dyYS5waXBlLmpzIiwic291cmNlUm9vdCI6IiIsInNvdXJjZXMiOlsiLi4vLi4vLi4vLi4vLi4vLi4vcHJvamVjdHMvY3JlYXRlLWRhc2hib2FyZC9zcmMvbGliL2NyZWF0ZS1kYXNoYm9hcmQtY29udGFpbmVyL3BpcGVzL3NlYXJjaC1wcm9ncmEucGlwZS50cyJdLCJuYW1lcyI6W10sIm1hcHBpbmdzIjoiQUFBQSxPQUFPLEVBQUUsSUFBSSxFQUFpQixNQUFNLGVBQWUsQ0FBQzs7QUFLcEQsTUFBTSxPQUFPLGlCQUFpQjtJQUM1QixTQUFTLENBQUMsS0FBWSxFQUFFLEdBQUcsSUFBVztRQUNwQyxJQUFJLFVBQVUsR0FBRyxJQUFJLENBQUMsQ0FBQyxDQUFDLENBQUM7UUFDekI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