@memberjunction/ng-user-view-grid 0.9.39 → 0.9.41
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/dist/lib/ng-user-view-grid.component.d.ts +112 -0
- package/dist/lib/ng-user-view-grid.component.js +945 -0
- package/dist/lib/ng-user-view-grid.module.d.ts +16 -0
- package/dist/lib/ng-user-view-grid.module.js +60 -0
- package/dist/public-api.d.ts +2 -0
- package/dist/public-api.js +5 -0
- package/package.json +9 -6
|
@@ -0,0 +1,112 @@
|
|
|
1
|
+
import { ElementRef, EventEmitter, OnInit, AfterViewInit } from '@angular/core';
|
|
2
|
+
import { FormBuilder, FormGroup } from '@angular/forms';
|
|
3
|
+
import { Router } from '@angular/router';
|
|
4
|
+
import { BaseEntity, RunViewParams, EntityFieldInfo, EntityInfo } from '@memberjunction/core';
|
|
5
|
+
import { ViewColumnInfo, UserViewEntityExtended } from '@memberjunction/core-entities';
|
|
6
|
+
import { CellClickEvent, GridDataResult, PageChangeEvent, GridComponent, CellCloseEvent, ColumnReorderEvent, ColumnResizeArgs, SelectionEvent, SelectableSettings } from "@progress/kendo-angular-grid";
|
|
7
|
+
import { ExcelExportComponent } from '@progress/kendo-angular-excel-export';
|
|
8
|
+
import { CompareRecordsComponent } from '@memberjunction/ng-compare-records';
|
|
9
|
+
import * as i0 from "@angular/core";
|
|
10
|
+
export type GridRowClickedEvent = {
|
|
11
|
+
entityId: number;
|
|
12
|
+
entityName: string;
|
|
13
|
+
recordId: number;
|
|
14
|
+
};
|
|
15
|
+
export type GridRowEditedEvent = {
|
|
16
|
+
record: BaseEntity;
|
|
17
|
+
row: number;
|
|
18
|
+
saved: boolean;
|
|
19
|
+
};
|
|
20
|
+
export type GridPendingRecordItem = {
|
|
21
|
+
record: BaseEntity;
|
|
22
|
+
row: number;
|
|
23
|
+
dataItem: any;
|
|
24
|
+
};
|
|
25
|
+
export declare class UserViewGridComponent implements OnInit, AfterViewInit {
|
|
26
|
+
private formBuilder;
|
|
27
|
+
private router;
|
|
28
|
+
title: string;
|
|
29
|
+
Params: RunViewParams | undefined;
|
|
30
|
+
BottomMargin: number;
|
|
31
|
+
InEditMode: boolean;
|
|
32
|
+
EditMode: "None" | "Save" | "Queue";
|
|
33
|
+
AutoNavigate: boolean;
|
|
34
|
+
rowClicked: EventEmitter<GridRowClickedEvent>;
|
|
35
|
+
rowEdited: EventEmitter<GridRowEditedEvent>;
|
|
36
|
+
kendoGridElement: GridComponent | null;
|
|
37
|
+
kendoGridElementRef: ElementRef | null;
|
|
38
|
+
kendoExcelExport: ExcelExportComponent | null;
|
|
39
|
+
recordCompareComponent: CompareRecordsComponent | null;
|
|
40
|
+
private _pendingRecords;
|
|
41
|
+
viewData: [];
|
|
42
|
+
totalRowCount: number;
|
|
43
|
+
formattedData: {
|
|
44
|
+
[key: string]: any;
|
|
45
|
+
}[];
|
|
46
|
+
viewColumns: ViewColumnInfo[];
|
|
47
|
+
visibleColumns: ViewColumnInfo[];
|
|
48
|
+
sortSettings: any[];
|
|
49
|
+
entityRecord: BaseEntity | null;
|
|
50
|
+
skip: number;
|
|
51
|
+
pageSize: number;
|
|
52
|
+
isLoading: boolean;
|
|
53
|
+
gridView: GridDataResult;
|
|
54
|
+
gridHeight: number;
|
|
55
|
+
_viewEntity: UserViewEntityExtended | undefined;
|
|
56
|
+
_entityInfo: EntityInfo | undefined;
|
|
57
|
+
private _newGridState;
|
|
58
|
+
private editModeEnded;
|
|
59
|
+
compareMode: boolean;
|
|
60
|
+
compareRecords: BaseEntity[];
|
|
61
|
+
mergeMode: boolean;
|
|
62
|
+
mergeRecords: BaseEntity[];
|
|
63
|
+
selectableSettings: SelectableSettings;
|
|
64
|
+
selectedKeys: any[];
|
|
65
|
+
isCompareDialogOpened: boolean;
|
|
66
|
+
showRefreshButton: boolean;
|
|
67
|
+
viewExecutionTime: number;
|
|
68
|
+
get PendingRecords(): GridPendingRecordItem[];
|
|
69
|
+
protected StartEditMode(): void;
|
|
70
|
+
protected EndEditMode(): void;
|
|
71
|
+
EditingComplete(): Promise<boolean>;
|
|
72
|
+
IsDynamicView(): boolean;
|
|
73
|
+
pageChange(event: PageChangeEvent): void;
|
|
74
|
+
private virtualLoadData;
|
|
75
|
+
constructor(formBuilder: FormBuilder, router: Router);
|
|
76
|
+
private _saveTimeout;
|
|
77
|
+
private SaveView;
|
|
78
|
+
private _viewDirty;
|
|
79
|
+
innerSaveView(): Promise<void>;
|
|
80
|
+
protected CreateSimpleNotification(message: string, style: "none" | "success" | "error" | "warning" | "info", duration: number): void;
|
|
81
|
+
columnReorder(args: ColumnReorderEvent): Promise<void>;
|
|
82
|
+
columnResize(args: ColumnResizeArgs[]): Promise<void>;
|
|
83
|
+
sortChanged(sort: any): Promise<void>;
|
|
84
|
+
cellClickHandler(args: CellClickEvent): Promise<void>;
|
|
85
|
+
createFormGroup(dataItem: any): FormGroup;
|
|
86
|
+
getEditor(ef: EntityFieldInfo): "boolean" | "text" | "numeric" | "date";
|
|
87
|
+
cellCloseHandler(args: CellCloseEvent): Promise<void>;
|
|
88
|
+
RevertPendingChanges(): void;
|
|
89
|
+
ngOnInit(): void;
|
|
90
|
+
ngAfterViewInit(): void;
|
|
91
|
+
private _deferLoadCount;
|
|
92
|
+
private _allowLoad;
|
|
93
|
+
get AllowLoad(): boolean;
|
|
94
|
+
set AllowLoad(value: boolean);
|
|
95
|
+
RefreshFromSavedParams(): Promise<void>;
|
|
96
|
+
Refresh(params: RunViewParams): Promise<void>;
|
|
97
|
+
GetColumnTitle(col: ViewColumnInfo): string;
|
|
98
|
+
GetColumnCellStyle(col: ViewColumnInfo): {
|
|
99
|
+
'text-align': string;
|
|
100
|
+
'vertical-align': string;
|
|
101
|
+
};
|
|
102
|
+
selectionChange(args: SelectionEvent): void;
|
|
103
|
+
enableCompare(cancel?: boolean): void;
|
|
104
|
+
enableMerge(cancel?: boolean): void;
|
|
105
|
+
closeCompareDialog(event: 'close' | 'cancel' | 'merge'): Promise<void>;
|
|
106
|
+
exportColumns: ViewColumnInfo[];
|
|
107
|
+
exportData: any[];
|
|
108
|
+
doExcelExport(): Promise<void>;
|
|
109
|
+
protected getExportData(): Promise<any[]>;
|
|
110
|
+
static ɵfac: i0.ɵɵFactoryDeclaration<UserViewGridComponent, never>;
|
|
111
|
+
static ɵcmp: i0.ɵɵComponentDeclaration<UserViewGridComponent, "mj-user-view-grid", never, { "Params": "Params"; "BottomMargin": "BottomMargin"; "InEditMode": "InEditMode"; "EditMode": "EditMode"; "AutoNavigate": "AutoNavigate"; "AllowLoad": "AllowLoad"; }, { "rowClicked": "rowClicked"; "rowEdited": "rowEdited"; }, never, never, false, never>;
|
|
112
|
+
}
|
|
@@ -0,0 +1,945 @@
|
|
|
1
|
+
var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
|
|
2
|
+
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
|
|
3
|
+
return new (P || (P = Promise))(function (resolve, reject) {
|
|
4
|
+
function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
|
|
5
|
+
function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
|
|
6
|
+
function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
|
|
7
|
+
step((generator = generator.apply(thisArg, _arguments || [])).next());
|
|
8
|
+
});
|
|
9
|
+
};
|
|
10
|
+
import { Component, ViewChild, ElementRef, Output, EventEmitter, Input } from '@angular/core';
|
|
11
|
+
import { Metadata, RunView, EntityFieldTSType, LogError } from '@memberjunction/core';
|
|
12
|
+
import { ViewInfo } from '@memberjunction/core-entities';
|
|
13
|
+
import { GridComponent } from "@progress/kendo-angular-grid";
|
|
14
|
+
import { Keys } from '@progress/kendo-angular-common';
|
|
15
|
+
import { Subject } from 'rxjs';
|
|
16
|
+
import { ExcelExportComponent } from '@progress/kendo-angular-excel-export';
|
|
17
|
+
import { MJEventType, MJGlobal } from '@memberjunction/global';
|
|
18
|
+
import * as i0 from "@angular/core";
|
|
19
|
+
import * as i1 from "@angular/forms";
|
|
20
|
+
import * as i2 from "@angular/router";
|
|
21
|
+
import * as i3 from "@angular/common";
|
|
22
|
+
import * as i4 from "@progress/kendo-angular-grid";
|
|
23
|
+
import * as i5 from "@progress/kendo-angular-dialog";
|
|
24
|
+
import * as i6 from "@progress/kendo-angular-excel-export";
|
|
25
|
+
import * as i7 from "@progress/kendo-angular-buttons";
|
|
26
|
+
import * as i8 from "@memberjunction/ng-compare-records";
|
|
27
|
+
import * as i9 from "@memberjunction/ng-container-directives";
|
|
28
|
+
const _c0 = ["kendoGrid"];
|
|
29
|
+
const _c1 = ["excelExport"];
|
|
30
|
+
const _c2 = ["recordCompareRef"];
|
|
31
|
+
function UserViewGridComponent_ng_template_3_button_0_Template(rf, ctx) { if (rf & 1) {
|
|
32
|
+
const _r16 = i0.ɵɵgetCurrentView();
|
|
33
|
+
i0.ɵɵelementStart(0, "button", 14);
|
|
34
|
+
i0.ɵɵlistener("click", function UserViewGridComponent_ng_template_3_button_0_Template_button_click_0_listener() { i0.ɵɵrestoreView(_r16); const ctx_r15 = i0.ɵɵnextContext(2); return i0.ɵɵresetView(ctx_r15.doExcelExport()); });
|
|
35
|
+
i0.ɵɵtext(1, "Export to Excel");
|
|
36
|
+
i0.ɵɵelementEnd();
|
|
37
|
+
} }
|
|
38
|
+
function UserViewGridComponent_ng_template_3_button_1_Template(rf, ctx) { if (rf & 1) {
|
|
39
|
+
const _r18 = i0.ɵɵgetCurrentView();
|
|
40
|
+
i0.ɵɵelementStart(0, "button", 15);
|
|
41
|
+
i0.ɵɵlistener("click", function UserViewGridComponent_ng_template_3_button_1_Template_button_click_0_listener() { i0.ɵɵrestoreView(_r18); const ctx_r17 = i0.ɵɵnextContext(2); return i0.ɵɵresetView(ctx_r17.enableCompare()); });
|
|
42
|
+
i0.ɵɵtext(1, "Compare");
|
|
43
|
+
i0.ɵɵelementEnd();
|
|
44
|
+
} if (rf & 2) {
|
|
45
|
+
const ctx_r8 = i0.ɵɵnextContext(2);
|
|
46
|
+
i0.ɵɵproperty("disabled", ctx_r8.compareMode && ctx_r8.compareRecords.length < 2);
|
|
47
|
+
} }
|
|
48
|
+
function UserViewGridComponent_ng_template_3_button_2_Template(rf, ctx) { if (rf & 1) {
|
|
49
|
+
const _r20 = i0.ɵɵgetCurrentView();
|
|
50
|
+
i0.ɵɵelementStart(0, "button", 15);
|
|
51
|
+
i0.ɵɵlistener("click", function UserViewGridComponent_ng_template_3_button_2_Template_button_click_0_listener() { i0.ɵɵrestoreView(_r20); const ctx_r19 = i0.ɵɵnextContext(2); return i0.ɵɵresetView(ctx_r19.enableCompare()); });
|
|
52
|
+
i0.ɵɵtext(1, "Compare");
|
|
53
|
+
i0.ɵɵelementEnd();
|
|
54
|
+
} if (rf & 2) {
|
|
55
|
+
const ctx_r9 = i0.ɵɵnextContext(2);
|
|
56
|
+
i0.ɵɵproperty("disabled", ctx_r9.compareMode && ctx_r9.compareRecords.length < 2);
|
|
57
|
+
} }
|
|
58
|
+
function UserViewGridComponent_ng_template_3_button_3_Template(rf, ctx) { if (rf & 1) {
|
|
59
|
+
const _r22 = i0.ɵɵgetCurrentView();
|
|
60
|
+
i0.ɵɵelementStart(0, "button", 16);
|
|
61
|
+
i0.ɵɵlistener("click", function UserViewGridComponent_ng_template_3_button_3_Template_button_click_0_listener() { i0.ɵɵrestoreView(_r22); const ctx_r21 = i0.ɵɵnextContext(2); return i0.ɵɵresetView(ctx_r21.enableCompare(true)); });
|
|
62
|
+
i0.ɵɵtext(1, "Cancel");
|
|
63
|
+
i0.ɵɵelementEnd();
|
|
64
|
+
} }
|
|
65
|
+
function UserViewGridComponent_ng_template_3_button_4_Template(rf, ctx) { if (rf & 1) {
|
|
66
|
+
const _r24 = i0.ɵɵgetCurrentView();
|
|
67
|
+
i0.ɵɵelementStart(0, "button", 15);
|
|
68
|
+
i0.ɵɵlistener("click", function UserViewGridComponent_ng_template_3_button_4_Template_button_click_0_listener() { i0.ɵɵrestoreView(_r24); const ctx_r23 = i0.ɵɵnextContext(2); return i0.ɵɵresetView(ctx_r23.enableMerge()); });
|
|
69
|
+
i0.ɵɵtext(1, "Merge");
|
|
70
|
+
i0.ɵɵelementEnd();
|
|
71
|
+
} if (rf & 2) {
|
|
72
|
+
const ctx_r11 = i0.ɵɵnextContext(2);
|
|
73
|
+
i0.ɵɵproperty("disabled", ctx_r11.mergeMode && ctx_r11.mergeRecords.length < 2);
|
|
74
|
+
} }
|
|
75
|
+
function UserViewGridComponent_ng_template_3_button_5_Template(rf, ctx) { if (rf & 1) {
|
|
76
|
+
const _r26 = i0.ɵɵgetCurrentView();
|
|
77
|
+
i0.ɵɵelementStart(0, "button", 16);
|
|
78
|
+
i0.ɵɵlistener("click", function UserViewGridComponent_ng_template_3_button_5_Template_button_click_0_listener() { i0.ɵɵrestoreView(_r26); const ctx_r25 = i0.ɵɵnextContext(2); return i0.ɵɵresetView(ctx_r25.enableMerge()); });
|
|
79
|
+
i0.ɵɵtext(1, "Merge");
|
|
80
|
+
i0.ɵɵelementEnd();
|
|
81
|
+
} }
|
|
82
|
+
function UserViewGridComponent_ng_template_3_button_6_Template(rf, ctx) { if (rf & 1) {
|
|
83
|
+
const _r28 = i0.ɵɵgetCurrentView();
|
|
84
|
+
i0.ɵɵelementStart(0, "button", 16);
|
|
85
|
+
i0.ɵɵlistener("click", function UserViewGridComponent_ng_template_3_button_6_Template_button_click_0_listener() { i0.ɵɵrestoreView(_r28); const ctx_r27 = i0.ɵɵnextContext(2); return i0.ɵɵresetView(ctx_r27.enableMerge(true)); });
|
|
86
|
+
i0.ɵɵtext(1, "Cancel");
|
|
87
|
+
i0.ɵɵelementEnd();
|
|
88
|
+
} }
|
|
89
|
+
function UserViewGridComponent_ng_template_3_button_7_Template(rf, ctx) { if (rf & 1) {
|
|
90
|
+
const _r30 = i0.ɵɵgetCurrentView();
|
|
91
|
+
i0.ɵɵelementStart(0, "button", 17);
|
|
92
|
+
i0.ɵɵlistener("click", function UserViewGridComponent_ng_template_3_button_7_Template_button_click_0_listener() { i0.ɵɵrestoreView(_r30); const ctx_r29 = i0.ɵɵnextContext(2); return i0.ɵɵresetView(ctx_r29.RefreshFromSavedParams()); });
|
|
93
|
+
i0.ɵɵtext(1, " Refresh ");
|
|
94
|
+
i0.ɵɵelementEnd();
|
|
95
|
+
} if (rf & 2) {
|
|
96
|
+
i0.ɵɵproperty("primary", true);
|
|
97
|
+
} }
|
|
98
|
+
function UserViewGridComponent_ng_template_3_Template(rf, ctx) { if (rf & 1) {
|
|
99
|
+
i0.ɵɵtemplate(0, UserViewGridComponent_ng_template_3_button_0_Template, 2, 0, "button", 10);
|
|
100
|
+
i0.ɵɵtemplate(1, UserViewGridComponent_ng_template_3_button_1_Template, 2, 1, "button", 11);
|
|
101
|
+
i0.ɵɵtemplate(2, UserViewGridComponent_ng_template_3_button_2_Template, 2, 1, "button", 11);
|
|
102
|
+
i0.ɵɵtemplate(3, UserViewGridComponent_ng_template_3_button_3_Template, 2, 0, "button", 12);
|
|
103
|
+
i0.ɵɵtemplate(4, UserViewGridComponent_ng_template_3_button_4_Template, 2, 1, "button", 11);
|
|
104
|
+
i0.ɵɵtemplate(5, UserViewGridComponent_ng_template_3_button_5_Template, 2, 0, "button", 12);
|
|
105
|
+
i0.ɵɵtemplate(6, UserViewGridComponent_ng_template_3_button_6_Template, 2, 0, "button", 12);
|
|
106
|
+
i0.ɵɵtemplate(7, UserViewGridComponent_ng_template_3_button_7_Template, 2, 1, "button", 13);
|
|
107
|
+
} if (rf & 2) {
|
|
108
|
+
const ctx_r1 = i0.ɵɵnextContext();
|
|
109
|
+
i0.ɵɵproperty("ngIf", !ctx_r1.compareMode && !ctx_r1.mergeMode);
|
|
110
|
+
i0.ɵɵadvance(1);
|
|
111
|
+
i0.ɵɵproperty("ngIf", !ctx_r1.compareMode && !ctx_r1.mergeMode);
|
|
112
|
+
i0.ɵɵadvance(1);
|
|
113
|
+
i0.ɵɵproperty("ngIf", ctx_r1.compareMode);
|
|
114
|
+
i0.ɵɵadvance(1);
|
|
115
|
+
i0.ɵɵproperty("ngIf", ctx_r1.compareMode);
|
|
116
|
+
i0.ɵɵadvance(1);
|
|
117
|
+
i0.ɵɵproperty("ngIf", ctx_r1.mergeMode);
|
|
118
|
+
i0.ɵɵadvance(1);
|
|
119
|
+
i0.ɵɵproperty("ngIf", !ctx_r1.mergeMode && !ctx_r1.compareMode);
|
|
120
|
+
i0.ɵɵadvance(1);
|
|
121
|
+
i0.ɵɵproperty("ngIf", ctx_r1.mergeMode);
|
|
122
|
+
i0.ɵɵadvance(1);
|
|
123
|
+
i0.ɵɵproperty("ngIf", ctx_r1.showRefreshButton && !ctx_r1.compareMode && !ctx_r1.mergeMode);
|
|
124
|
+
} }
|
|
125
|
+
const _c3 = function () { return { "text-align": "center", "vertical-align": "center" }; };
|
|
126
|
+
const _c4 = function () { return { "font-weight": "bold", "background-color": "#a9c2af" }; };
|
|
127
|
+
function UserViewGridComponent_kendo_grid_checkbox_column_4_Template(rf, ctx) { if (rf & 1) {
|
|
128
|
+
i0.ɵɵelement(0, "kendo-grid-checkbox-column", 18);
|
|
129
|
+
} if (rf & 2) {
|
|
130
|
+
i0.ɵɵstyleMap(i0.ɵɵpureFunction0(4, _c3));
|
|
131
|
+
i0.ɵɵproperty("width", 50)("headerStyle", i0.ɵɵpureFunction0(5, _c4));
|
|
132
|
+
} }
|
|
133
|
+
function UserViewGridComponent_kendo_grid_column_5_1_ng_template_0_Template(rf, ctx) { if (rf & 1) {
|
|
134
|
+
i0.ɵɵtext(0);
|
|
135
|
+
i0.ɵɵpipe(1, "number");
|
|
136
|
+
i0.ɵɵpipe(2, "number");
|
|
137
|
+
i0.ɵɵelement(3, "br");
|
|
138
|
+
i0.ɵɵelementStart(4, "span", 21);
|
|
139
|
+
i0.ɵɵtext(5);
|
|
140
|
+
i0.ɵɵpipe(6, "number");
|
|
141
|
+
i0.ɵɵelementEnd();
|
|
142
|
+
} if (rf & 2) {
|
|
143
|
+
const ctx_r33 = i0.ɵɵnextContext(3);
|
|
144
|
+
i0.ɵɵtextInterpolate2(" ", i0.ɵɵpipeBind1(1, 3, ctx_r33.viewData.length), "", ctx_r33.totalRowCount > ctx_r33.viewData.length ? " of " + i0.ɵɵpipeBind1(2, 5, ctx_r33.totalRowCount) : " rows", "");
|
|
145
|
+
i0.ɵɵadvance(5);
|
|
146
|
+
i0.ɵɵtextInterpolate1("", i0.ɵɵpipeBind2(6, 7, ctx_r33.viewExecutionTime, "1.2-2"), " seconds");
|
|
147
|
+
} }
|
|
148
|
+
function UserViewGridComponent_kendo_grid_column_5_1_Template(rf, ctx) { if (rf & 1) {
|
|
149
|
+
i0.ɵɵtemplate(0, UserViewGridComponent_kendo_grid_column_5_1_ng_template_0_Template, 7, 10, "ng-template", 20);
|
|
150
|
+
} }
|
|
151
|
+
function UserViewGridComponent_kendo_grid_column_5_Template(rf, ctx) { if (rf & 1) {
|
|
152
|
+
i0.ɵɵelementStart(0, "kendo-grid-column", 19);
|
|
153
|
+
i0.ɵɵtemplate(1, UserViewGridComponent_kendo_grid_column_5_1_Template, 1, 0, null, 9);
|
|
154
|
+
i0.ɵɵelementEnd();
|
|
155
|
+
} if (rf & 2) {
|
|
156
|
+
const item_r31 = ctx.$implicit;
|
|
157
|
+
const ctx_r3 = i0.ɵɵnextContext();
|
|
158
|
+
i0.ɵɵstyleMap(ctx_r3.GetColumnCellStyle(item_r31));
|
|
159
|
+
i0.ɵɵproperty("field", item_r31.Name)("title", ctx_r3.GetColumnTitle(item_r31))("width", item_r31.width ? item_r31.width : 100)("editable", item_r31.EntityField.AllowUpdateAPI)("editor", ctx_r3.getEditor(item_r31.EntityField))("headerStyle", i0.ɵɵpureFunction0(9, _c4));
|
|
160
|
+
i0.ɵɵadvance(1);
|
|
161
|
+
i0.ɵɵproperty("ngIf", item_r31 === ctx_r3.visibleColumns[0]);
|
|
162
|
+
} }
|
|
163
|
+
function UserViewGridComponent_kendo_excelexport_column_8_Template(rf, ctx) { if (rf & 1) {
|
|
164
|
+
i0.ɵɵelement(0, "kendo-excelexport-column", 22);
|
|
165
|
+
} if (rf & 2) {
|
|
166
|
+
const exportCol_r34 = ctx.$implicit;
|
|
167
|
+
i0.ɵɵproperty("field", exportCol_r34.Name)("title", exportCol_r34.Name);
|
|
168
|
+
} }
|
|
169
|
+
function UserViewGridComponent_div_9_kendo_window_2_button_6_Template(rf, ctx) { if (rf & 1) {
|
|
170
|
+
const _r41 = i0.ɵɵgetCurrentView();
|
|
171
|
+
i0.ɵɵelementStart(0, "button", 32);
|
|
172
|
+
i0.ɵɵlistener("click", function UserViewGridComponent_div_9_kendo_window_2_button_6_Template_button_click_0_listener() { i0.ɵɵrestoreView(_r41); const ctx_r40 = i0.ɵɵnextContext(3); return i0.ɵɵresetView(ctx_r40.closeCompareDialog("close")); });
|
|
173
|
+
i0.ɵɵtext(1, "Close");
|
|
174
|
+
i0.ɵɵelementEnd();
|
|
175
|
+
} }
|
|
176
|
+
function UserViewGridComponent_div_9_kendo_window_2_button_7_Template(rf, ctx) { if (rf & 1) {
|
|
177
|
+
const _r43 = i0.ɵɵgetCurrentView();
|
|
178
|
+
i0.ɵɵelementStart(0, "button", 32);
|
|
179
|
+
i0.ɵɵlistener("click", function UserViewGridComponent_div_9_kendo_window_2_button_7_Template_button_click_0_listener() { i0.ɵɵrestoreView(_r43); const ctx_r42 = i0.ɵɵnextContext(3); return i0.ɵɵresetView(ctx_r42.closeCompareDialog("cancel")); });
|
|
180
|
+
i0.ɵɵtext(1, "Cancel");
|
|
181
|
+
i0.ɵɵelementEnd();
|
|
182
|
+
} }
|
|
183
|
+
function UserViewGridComponent_div_9_kendo_window_2_button_8_Template(rf, ctx) { if (rf & 1) {
|
|
184
|
+
const _r45 = i0.ɵɵgetCurrentView();
|
|
185
|
+
i0.ɵɵelementStart(0, "button", 33);
|
|
186
|
+
i0.ɵɵlistener("click", function UserViewGridComponent_div_9_kendo_window_2_button_8_Template_button_click_0_listener() { i0.ɵɵrestoreView(_r45); const ctx_r44 = i0.ɵɵnextContext(3); return i0.ɵɵresetView(ctx_r44.closeCompareDialog("merge")); });
|
|
187
|
+
i0.ɵɵtext(1, " Merge Records ");
|
|
188
|
+
i0.ɵɵelementEnd();
|
|
189
|
+
} }
|
|
190
|
+
function UserViewGridComponent_div_9_kendo_window_2_Template(rf, ctx) { if (rf & 1) {
|
|
191
|
+
const _r47 = i0.ɵɵgetCurrentView();
|
|
192
|
+
i0.ɵɵelementStart(0, "kendo-window", 25);
|
|
193
|
+
i0.ɵɵlistener("close", function UserViewGridComponent_div_9_kendo_window_2_Template_kendo_window_close_0_listener($event) { i0.ɵɵrestoreView(_r47); const ctx_r46 = i0.ɵɵnextContext(2); return i0.ɵɵresetView(ctx_r46.closeCompareDialog($event)); });
|
|
194
|
+
i0.ɵɵelementStart(1, "div", 26)(2, "div");
|
|
195
|
+
i0.ɵɵelement(3, "mj-compare-records", 27, 28);
|
|
196
|
+
i0.ɵɵelementEnd()();
|
|
197
|
+
i0.ɵɵelementStart(5, "div", 29);
|
|
198
|
+
i0.ɵɵtemplate(6, UserViewGridComponent_div_9_kendo_window_2_button_6_Template, 2, 0, "button", 30);
|
|
199
|
+
i0.ɵɵtemplate(7, UserViewGridComponent_div_9_kendo_window_2_button_7_Template, 2, 0, "button", 30);
|
|
200
|
+
i0.ɵɵtemplate(8, UserViewGridComponent_div_9_kendo_window_2_button_8_Template, 2, 0, "button", 31);
|
|
201
|
+
i0.ɵɵelementEnd()();
|
|
202
|
+
} if (rf & 2) {
|
|
203
|
+
const ctx_r35 = i0.ɵɵnextContext(2);
|
|
204
|
+
i0.ɵɵproperty("minHeight", 300)("minWidth", 400)("resizable", true);
|
|
205
|
+
i0.ɵɵadvance(3);
|
|
206
|
+
i0.ɵɵproperty("entityName", ctx_r35._entityInfo ? ctx_r35._entityInfo.Name : "")("recordsToCompare", ctx_r35.compareMode ? ctx_r35.compareRecords : ctx_r35.mergeRecords)("visibleColumns", ctx_r35.visibleColumns)("selectionMode", ctx_r35.mergeMode ? true : false);
|
|
207
|
+
i0.ɵɵadvance(3);
|
|
208
|
+
i0.ɵɵproperty("ngIf", ctx_r35.compareMode);
|
|
209
|
+
i0.ɵɵadvance(1);
|
|
210
|
+
i0.ɵɵproperty("ngIf", ctx_r35.mergeMode);
|
|
211
|
+
i0.ɵɵadvance(1);
|
|
212
|
+
i0.ɵɵproperty("ngIf", ctx_r35.mergeMode);
|
|
213
|
+
} }
|
|
214
|
+
function UserViewGridComponent_div_9_Template(rf, ctx) { if (rf & 1) {
|
|
215
|
+
i0.ɵɵelementStart(0, "div");
|
|
216
|
+
i0.ɵɵelement(1, "div", 23);
|
|
217
|
+
i0.ɵɵtemplate(2, UserViewGridComponent_div_9_kendo_window_2_Template, 9, 10, "kendo-window", 24);
|
|
218
|
+
i0.ɵɵelementEnd();
|
|
219
|
+
} if (rf & 2) {
|
|
220
|
+
const ctx_r6 = i0.ɵɵnextContext();
|
|
221
|
+
i0.ɵɵadvance(2);
|
|
222
|
+
i0.ɵɵproperty("ngIf", ctx_r6.isCompareDialogOpened);
|
|
223
|
+
} }
|
|
224
|
+
export class UserViewGridComponent {
|
|
225
|
+
get PendingRecords() {
|
|
226
|
+
return this._pendingRecords;
|
|
227
|
+
}
|
|
228
|
+
StartEditMode() {
|
|
229
|
+
this.InEditMode = true;
|
|
230
|
+
}
|
|
231
|
+
EndEditMode() {
|
|
232
|
+
this.InEditMode = false;
|
|
233
|
+
this.editModeEnded.next();
|
|
234
|
+
}
|
|
235
|
+
EditingComplete() {
|
|
236
|
+
if (this.InEditMode) {
|
|
237
|
+
// we need to wait for edit mode to end before we can return true
|
|
238
|
+
return new Promise((resolve, reject) => {
|
|
239
|
+
const subscription = this.editModeEnded.subscribe(() => {
|
|
240
|
+
resolve(true);
|
|
241
|
+
subscription.unsubscribe();
|
|
242
|
+
});
|
|
243
|
+
});
|
|
244
|
+
}
|
|
245
|
+
else
|
|
246
|
+
return Promise.resolve(true); // not in edit mode, so editing is complete!
|
|
247
|
+
}
|
|
248
|
+
IsDynamicView() {
|
|
249
|
+
return !this._viewEntity; // if we have a viewEntity it is a stored view
|
|
250
|
+
}
|
|
251
|
+
pageChange(event) {
|
|
252
|
+
this.skip = event.skip;
|
|
253
|
+
this.virtualLoadData();
|
|
254
|
+
}
|
|
255
|
+
virtualLoadData() {
|
|
256
|
+
// check to see if we have already formatted the slice of the data we need right now
|
|
257
|
+
// we are storing the formattted data in the formattedData array and it has same set
|
|
258
|
+
// of indexes as the viewData array (raw unformatted data). When we first get viewData
|
|
259
|
+
// from the server we create an array of the same length as viewData, but have nulls in all of the
|
|
260
|
+
// indexes. As we format each row of viewData we store the formatted row in the same index
|
|
261
|
+
// in the formattedData array. So if we have already formatted the data we need for the current
|
|
262
|
+
// page, we just use that data, otherwise we format the data we need for the current page
|
|
263
|
+
try {
|
|
264
|
+
// check to see if we have already formatted the data we need for the current page
|
|
265
|
+
for (let i = this.skip; (i < (this.skip + this.pageSize)) && (i < this.viewData.length); i++) {
|
|
266
|
+
if (!this.formattedData[i]) {
|
|
267
|
+
// we have not formatted this row yet, so format it
|
|
268
|
+
const r = this.viewColumns.map((c) => {
|
|
269
|
+
if (c && c.EntityField && this.viewData[i] && this.viewData[i][c.EntityField.Name]) {
|
|
270
|
+
if (!c.hidden && c.EntityField.Name !== 'ID') {
|
|
271
|
+
const ef = c.EntityField;
|
|
272
|
+
return { field: c.EntityField.Name, value: ef.FormatValue(this.viewData[i][c.EntityField.Name], 0, undefined, 300) };
|
|
273
|
+
}
|
|
274
|
+
else
|
|
275
|
+
return { field: c.EntityField.Name, value: this.viewData[i][c.EntityField.Name] }; // hidden column, so just return the value, don't bother formatting
|
|
276
|
+
}
|
|
277
|
+
else
|
|
278
|
+
return { field: c.Name, value: null };
|
|
279
|
+
});
|
|
280
|
+
// now r is an array of {field: string, value: any} objects, so we need to convert it to an object
|
|
281
|
+
// with the field names as the keys and the values as the values
|
|
282
|
+
const row = {};
|
|
283
|
+
for (let j = 0; j < r.length; j++) {
|
|
284
|
+
if (r[j] && r[j].field && r[j].field.length > 0)
|
|
285
|
+
row[r[j].field] = r[j].value;
|
|
286
|
+
}
|
|
287
|
+
this.formattedData[i] = row;
|
|
288
|
+
}
|
|
289
|
+
}
|
|
290
|
+
// now that we have made sure current page of data is formatted, we can return it
|
|
291
|
+
this.gridView = {
|
|
292
|
+
data: this.formattedData.slice(this.skip, this.skip + this.pageSize),
|
|
293
|
+
total: this.viewData.length,
|
|
294
|
+
};
|
|
295
|
+
}
|
|
296
|
+
catch (e) {
|
|
297
|
+
LogError(e);
|
|
298
|
+
}
|
|
299
|
+
}
|
|
300
|
+
constructor(formBuilder, router) {
|
|
301
|
+
this.formBuilder = formBuilder;
|
|
302
|
+
this.router = router;
|
|
303
|
+
this.title = 'UserViewGrid';
|
|
304
|
+
this.BottomMargin = 0;
|
|
305
|
+
this.InEditMode = false;
|
|
306
|
+
this.EditMode = "None";
|
|
307
|
+
this.AutoNavigate = true;
|
|
308
|
+
this.rowClicked = new EventEmitter();
|
|
309
|
+
this.rowEdited = new EventEmitter();
|
|
310
|
+
this.kendoGridElement = null;
|
|
311
|
+
this.kendoGridElementRef = null;
|
|
312
|
+
this.kendoExcelExport = null;
|
|
313
|
+
this.recordCompareComponent = null;
|
|
314
|
+
this._pendingRecords = [];
|
|
315
|
+
this.viewData = [];
|
|
316
|
+
this.totalRowCount = 0;
|
|
317
|
+
this.formattedData = [];
|
|
318
|
+
this.viewColumns = [];
|
|
319
|
+
this.visibleColumns = [];
|
|
320
|
+
this.sortSettings = [];
|
|
321
|
+
this.entityRecord = null;
|
|
322
|
+
this.skip = 0;
|
|
323
|
+
this.pageSize = 40;
|
|
324
|
+
this.isLoading = false;
|
|
325
|
+
this.gridView = { data: [], total: 0 };
|
|
326
|
+
this.gridHeight = 750;
|
|
327
|
+
this._newGridState = {};
|
|
328
|
+
this.editModeEnded = new Subject();
|
|
329
|
+
this.compareMode = false;
|
|
330
|
+
this.compareRecords = [];
|
|
331
|
+
this.mergeMode = false;
|
|
332
|
+
this.mergeRecords = [];
|
|
333
|
+
this.selectableSettings = {
|
|
334
|
+
enabled: false
|
|
335
|
+
};
|
|
336
|
+
this.selectedKeys = [];
|
|
337
|
+
this.isCompareDialogOpened = false;
|
|
338
|
+
this.showRefreshButton = true;
|
|
339
|
+
this.viewExecutionTime = 0;
|
|
340
|
+
this._viewDirty = false;
|
|
341
|
+
this._deferLoadCount = 0;
|
|
342
|
+
this._allowLoad = true;
|
|
343
|
+
// Export Functionality
|
|
344
|
+
this.exportColumns = [];
|
|
345
|
+
this.exportData = [];
|
|
346
|
+
}
|
|
347
|
+
SaveView() {
|
|
348
|
+
// debounced outer function...
|
|
349
|
+
clearTimeout(this._saveTimeout);
|
|
350
|
+
this._saveTimeout = setTimeout(() => __awaiter(this, void 0, void 0, function* () {
|
|
351
|
+
// when we actually call inner save view we do await
|
|
352
|
+
yield this.innerSaveView();
|
|
353
|
+
}), 5000); // 5 seconds delay
|
|
354
|
+
}
|
|
355
|
+
;
|
|
356
|
+
innerSaveView() {
|
|
357
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
358
|
+
if (this._viewDirty) {
|
|
359
|
+
const md = new Metadata();
|
|
360
|
+
if (this._viewEntity &&
|
|
361
|
+
this._viewEntity.Get('UserID') === md.CurrentUser.ID) {
|
|
362
|
+
// this view is a saved view, AND it belongs to the current user
|
|
363
|
+
// update the grid state if we have settings updates for columns and/or sorts
|
|
364
|
+
const tempGridState = JSON.parse(this._viewEntity.Get('GridState'));
|
|
365
|
+
const tempColSettings = this._newGridState.columnSettings ? this._newGridState.columnSettings : tempGridState.columnSettings;
|
|
366
|
+
tempColSettings.forEach((col) => { col.DisplayName, col.ID, col.Name, col.hidden, col.orderIndex, col.width; }); // remove EntityFieldInfo from the column settings
|
|
367
|
+
tempGridState.columnSettings = tempColSettings;
|
|
368
|
+
tempGridState.sortSettings = this._newGridState.sortSettings ? this._newGridState.sortSettings : tempGridState.sortSettings;
|
|
369
|
+
// now stringify the grid state and save it
|
|
370
|
+
this._viewEntity.Set('GridState', JSON.stringify(tempGridState));
|
|
371
|
+
const newSortState = tempGridState.sortSettings.map((s) => { return { field: s.field, direction: s.dir === 'asc' ? 1 : 2 }; });
|
|
372
|
+
const oldSortState = JSON.parse(this._viewEntity.Get('SortState'));
|
|
373
|
+
this._viewEntity.Set('SortState', JSON.stringify(newSortState));
|
|
374
|
+
if (yield this._viewEntity.Save()) {
|
|
375
|
+
// check to see if sort state changed and if so, refresh the grid
|
|
376
|
+
if (JSON.stringify(newSortState) !== JSON.stringify(oldSortState)) {
|
|
377
|
+
if (this.Params) // makes sure we have params before we refresh
|
|
378
|
+
this.Refresh(this.Params);
|
|
379
|
+
}
|
|
380
|
+
this._viewDirty = false;
|
|
381
|
+
}
|
|
382
|
+
else {
|
|
383
|
+
this.CreateSimpleNotification('Unable to save view settings', 'error', 5000);
|
|
384
|
+
}
|
|
385
|
+
}
|
|
386
|
+
}
|
|
387
|
+
});
|
|
388
|
+
}
|
|
389
|
+
CreateSimpleNotification(message, style, duration) {
|
|
390
|
+
const data = {
|
|
391
|
+
message: message,
|
|
392
|
+
style: style,
|
|
393
|
+
DisplayDuration: duration
|
|
394
|
+
};
|
|
395
|
+
MJGlobal.Instance.RaiseEvent({
|
|
396
|
+
component: this,
|
|
397
|
+
event: MJEventType.DisplaySimpleNotificationRequest,
|
|
398
|
+
eventCode: "",
|
|
399
|
+
args: data
|
|
400
|
+
});
|
|
401
|
+
}
|
|
402
|
+
columnReorder(args) {
|
|
403
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
404
|
+
// Remove the column from the original position
|
|
405
|
+
// need to find the column in the viewColumns array because args.old/new Indexes are from the visibleColumns array
|
|
406
|
+
const fieldName = args.column.field;
|
|
407
|
+
if (fieldName) {
|
|
408
|
+
const vcOldIndex = this.viewColumns.findIndex((vc) => vc.Name === fieldName);
|
|
409
|
+
const vcNewIndex = this.viewColumns.findIndex((vc) => vc.orderIndex === args.newIndex);
|
|
410
|
+
if (vcOldIndex >= 0) {
|
|
411
|
+
// got the index, now remove the element
|
|
412
|
+
const element = this.viewColumns.splice(vcOldIndex, 1)[0];
|
|
413
|
+
// Insert it at the new position
|
|
414
|
+
this.viewColumns.splice(vcNewIndex, 0, element);
|
|
415
|
+
// go through all of the columns and set orderIndex as that isn't done automatically
|
|
416
|
+
let visColIndex = 0;
|
|
417
|
+
for (let i = 0; i < this.viewColumns.length; i++) {
|
|
418
|
+
if (!this.viewColumns[i].hidden) {
|
|
419
|
+
this.viewColumns[i].orderIndex = visColIndex;
|
|
420
|
+
visColIndex++;
|
|
421
|
+
}
|
|
422
|
+
}
|
|
423
|
+
// now loop through all of the HIDDEN columns and set their orderIndex, done in second loop because we want first loop to give us total number of visible columns
|
|
424
|
+
for (let i = 0; i < this.viewColumns.length; i++) {
|
|
425
|
+
if (this.viewColumns[i].hidden) {
|
|
426
|
+
this.viewColumns[i].orderIndex = visColIndex;
|
|
427
|
+
visColIndex++;
|
|
428
|
+
}
|
|
429
|
+
}
|
|
430
|
+
// make sure that _newGridState.columnSettings is set
|
|
431
|
+
this._newGridState.columnSettings = this.viewColumns;
|
|
432
|
+
this._viewDirty = true;
|
|
433
|
+
this.SaveView();
|
|
434
|
+
}
|
|
435
|
+
}
|
|
436
|
+
});
|
|
437
|
+
}
|
|
438
|
+
columnResize(args) {
|
|
439
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
440
|
+
for (const col of args) {
|
|
441
|
+
const c = col.column;
|
|
442
|
+
const viewCol = this.viewColumns.find(vc => vc.Name === c.field);
|
|
443
|
+
const visCol = this.visibleColumns.find(vc => vc.Name === c.field);
|
|
444
|
+
const visCols = this.visibleColumns;
|
|
445
|
+
if (viewCol)
|
|
446
|
+
viewCol.width = col.newWidth;
|
|
447
|
+
}
|
|
448
|
+
this._newGridState.columnSettings = this.viewColumns.map(vc => {
|
|
449
|
+
return {
|
|
450
|
+
Name: vc.Name,
|
|
451
|
+
DisplayName: vc.DisplayName,
|
|
452
|
+
width: vc.width,
|
|
453
|
+
orderIndex: vc.orderIndex,
|
|
454
|
+
hidden: vc.hidden
|
|
455
|
+
};
|
|
456
|
+
});
|
|
457
|
+
this._viewDirty = true;
|
|
458
|
+
this.SaveView();
|
|
459
|
+
});
|
|
460
|
+
}
|
|
461
|
+
sortChanged(sort) {
|
|
462
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
463
|
+
this._newGridState.sortSettings = sort;
|
|
464
|
+
this.sortSettings = sort; // for the UI display - grid binding to this shows that the sort is applied via arrows in the column headers
|
|
465
|
+
if (this.IsDynamicView()) {
|
|
466
|
+
// Dynamic View, we have this.Params and can add an OrderBy and then just Refresh() the entire component
|
|
467
|
+
// that will result in going to the server for a refreshed set of data
|
|
468
|
+
if (this.Params) {
|
|
469
|
+
this.Params.OrderBy = sort[0].field + ' ' + (sort[0].dir === 'asc' ? 'ASC' : 'DESC');
|
|
470
|
+
this.Refresh(this.Params);
|
|
471
|
+
}
|
|
472
|
+
else {
|
|
473
|
+
LogError("sortChanged() called but this.Params is null or undefined"); // should never get here
|
|
474
|
+
}
|
|
475
|
+
}
|
|
476
|
+
else {
|
|
477
|
+
// Saved view - we do this on the server side only
|
|
478
|
+
this._viewDirty = true;
|
|
479
|
+
this.innerSaveView(); // for sort changes we call innerSaveView() directly, not through SaveView() which is debounced
|
|
480
|
+
}
|
|
481
|
+
});
|
|
482
|
+
}
|
|
483
|
+
cellClickHandler(args) {
|
|
484
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
485
|
+
if (this.compareMode || this.mergeMode)
|
|
486
|
+
return;
|
|
487
|
+
if (this._entityInfo) {
|
|
488
|
+
this.rowClicked.emit({
|
|
489
|
+
entityId: this._entityInfo.ID,
|
|
490
|
+
entityName: this._entityInfo.Name,
|
|
491
|
+
recordId: args.dataItem.ID
|
|
492
|
+
});
|
|
493
|
+
if (this._entityInfo.AllowUpdateAPI &&
|
|
494
|
+
this.EditMode !== "None") {
|
|
495
|
+
const perm = this._entityInfo.GetUserPermisions(new Metadata().CurrentUser);
|
|
496
|
+
if (perm.CanUpdate) {
|
|
497
|
+
this.StartEditMode();
|
|
498
|
+
args.sender.editCell(args.rowIndex, args.columnIndex, this.createFormGroup(args.dataItem));
|
|
499
|
+
}
|
|
500
|
+
}
|
|
501
|
+
if (!this.InEditMode && this.AutoNavigate) {
|
|
502
|
+
// tell app router to go to this record
|
|
503
|
+
this.router.navigate(['resource', 'record', args.dataItem.ID], { queryParams: { Entity: this._entityInfo.Name } });
|
|
504
|
+
}
|
|
505
|
+
}
|
|
506
|
+
});
|
|
507
|
+
}
|
|
508
|
+
createFormGroup(dataItem) {
|
|
509
|
+
const groupFields = {};
|
|
510
|
+
this.viewColumns.forEach((vc) => {
|
|
511
|
+
if (vc.EntityField.AllowUpdateAPI &&
|
|
512
|
+
vc.EntityField.IsVirtual === false &&
|
|
513
|
+
vc.EntityField.AllowUpdateInView)
|
|
514
|
+
groupFields[vc.Name] = dataItem[vc.Name];
|
|
515
|
+
});
|
|
516
|
+
return this.formBuilder.group(groupFields);
|
|
517
|
+
}
|
|
518
|
+
getEditor(ef) {
|
|
519
|
+
switch (ef.TSType) {
|
|
520
|
+
case EntityFieldTSType.Boolean:
|
|
521
|
+
return "boolean";
|
|
522
|
+
case EntityFieldTSType.Date:
|
|
523
|
+
return "date";
|
|
524
|
+
case EntityFieldTSType.Number:
|
|
525
|
+
return "numeric";
|
|
526
|
+
default:
|
|
527
|
+
return "text";
|
|
528
|
+
}
|
|
529
|
+
}
|
|
530
|
+
cellCloseHandler(args) {
|
|
531
|
+
var _a;
|
|
532
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
533
|
+
try {
|
|
534
|
+
if (this._entityInfo && this.EditMode !== "None") {
|
|
535
|
+
const { formGroup, dataItem } = args;
|
|
536
|
+
if (!formGroup.valid) {
|
|
537
|
+
// prevent closing the edited cell if there are invalid values.
|
|
538
|
+
args.preventDefault();
|
|
539
|
+
}
|
|
540
|
+
else if (formGroup.dirty) {
|
|
541
|
+
if (args.originalEvent && args.originalEvent.keyCode === Keys.Escape)
|
|
542
|
+
return; // user hit escape, so don't save their changes
|
|
543
|
+
// update the data item with the new values - this drives UI refresh while we save the record...
|
|
544
|
+
Object.assign(dataItem, formGroup.value);
|
|
545
|
+
const md = new Metadata();
|
|
546
|
+
let record;
|
|
547
|
+
let bSaved = false;
|
|
548
|
+
if (this.EditMode === "Save") {
|
|
549
|
+
record = yield md.GetEntityObject(this._entityInfo.Name);
|
|
550
|
+
yield record.Load(dataItem.ID);
|
|
551
|
+
record.SetMany(formGroup.value);
|
|
552
|
+
bSaved = yield record.Save();
|
|
553
|
+
if (!bSaved)
|
|
554
|
+
this.CreateSimpleNotification("Error saving record: " + record.ID, 'error', 5000);
|
|
555
|
+
}
|
|
556
|
+
else {
|
|
557
|
+
record = (_a = this._pendingRecords.find((r) => r.record.ID === dataItem.ID)) === null || _a === void 0 ? void 0 : _a.record;
|
|
558
|
+
if (!record) { // haven't edited this one before
|
|
559
|
+
record = yield md.GetEntityObject(this._viewEntity.Get('Entity'));
|
|
560
|
+
yield record.Load(dataItem.ID);
|
|
561
|
+
this._pendingRecords.push({ record,
|
|
562
|
+
row: args.rowIndex,
|
|
563
|
+
dataItem }); // don't save - put the changed record on a queue for saving later by our container
|
|
564
|
+
}
|
|
565
|
+
// go through the formGroup and only set the values that exist as columns in the grid
|
|
566
|
+
const keys = Object.keys(formGroup.value);
|
|
567
|
+
keys.forEach((k) => {
|
|
568
|
+
const vc = this.viewColumns.find((vc) => vc.Name === k && vc.hidden === false);
|
|
569
|
+
if (vc) {
|
|
570
|
+
record.Set(k, formGroup.value[k]);
|
|
571
|
+
}
|
|
572
|
+
});
|
|
573
|
+
//record.SetMany(formGroup.value);
|
|
574
|
+
}
|
|
575
|
+
this.rowEdited.emit({
|
|
576
|
+
record: record,
|
|
577
|
+
row: args.rowIndex,
|
|
578
|
+
saved: bSaved
|
|
579
|
+
});
|
|
580
|
+
}
|
|
581
|
+
}
|
|
582
|
+
}
|
|
583
|
+
catch (e) {
|
|
584
|
+
console.error(e);
|
|
585
|
+
}
|
|
586
|
+
finally {
|
|
587
|
+
this.EndEditMode();
|
|
588
|
+
}
|
|
589
|
+
});
|
|
590
|
+
}
|
|
591
|
+
// this handles reverting pending cahnges to records WITHIN the grid, not the user view settings, unrelated to that.
|
|
592
|
+
RevertPendingChanges() {
|
|
593
|
+
if (this._pendingRecords && this._pendingRecords.length > 0) {
|
|
594
|
+
this._pendingRecords.forEach((r) => {
|
|
595
|
+
r.record.Revert();
|
|
596
|
+
Object.assign(r.dataItem, r.record.GetAll()); // copy the original values back to the data Item which gets the grid to display the old values again...
|
|
597
|
+
});
|
|
598
|
+
this._pendingRecords = [];
|
|
599
|
+
if (this.Params)
|
|
600
|
+
this.Refresh(this.Params);
|
|
601
|
+
}
|
|
602
|
+
}
|
|
603
|
+
ngOnInit() {
|
|
604
|
+
}
|
|
605
|
+
ngAfterViewInit() {
|
|
606
|
+
//this.setGridHeight();
|
|
607
|
+
if (this.Params)
|
|
608
|
+
this.Refresh(this.Params);
|
|
609
|
+
}
|
|
610
|
+
get AllowLoad() {
|
|
611
|
+
return this._allowLoad;
|
|
612
|
+
}
|
|
613
|
+
set AllowLoad(value) {
|
|
614
|
+
this._allowLoad = value;
|
|
615
|
+
if (value === true && this._deferLoadCount === 0) {
|
|
616
|
+
this._deferLoadCount++; // only do this one time
|
|
617
|
+
if (this.Params)
|
|
618
|
+
this.Refresh(this.Params);
|
|
619
|
+
return;
|
|
620
|
+
}
|
|
621
|
+
}
|
|
622
|
+
RefreshFromSavedParams() {
|
|
623
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
624
|
+
if (this.Params)
|
|
625
|
+
this.Refresh(this.Params);
|
|
626
|
+
});
|
|
627
|
+
}
|
|
628
|
+
Refresh(params) {
|
|
629
|
+
var _a, _b, _c;
|
|
630
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
631
|
+
this.Params = params;
|
|
632
|
+
if (this.AllowLoad === false) {
|
|
633
|
+
return;
|
|
634
|
+
}
|
|
635
|
+
if (params && (params.ViewEntity || params.ViewID || params.ViewName || (params.EntityName && params.ExtraFilter))) {
|
|
636
|
+
const startTime = new Date().getTime();
|
|
637
|
+
this.isLoading = true;
|
|
638
|
+
const md = new Metadata();
|
|
639
|
+
const rv = new RunView();
|
|
640
|
+
// get the view entity first so we can pass it in, otherwise it will end up getting loaded inside of RunView() which is inefficient as we need it too
|
|
641
|
+
// this is done for performance purposes
|
|
642
|
+
if (params.ViewEntity) {
|
|
643
|
+
// When we receive the .ViewEntity via our params that is a time saver as we don't need to load it again, so ALWAYS use that instance of the entity object for the view entity
|
|
644
|
+
this._viewEntity = params.ViewEntity;
|
|
645
|
+
const e = md.Entities.find(x => { var _a; return x.ID === ((_a = this._viewEntity) === null || _a === void 0 ? void 0 : _a.EntityID); });
|
|
646
|
+
if (e)
|
|
647
|
+
this._entityInfo = e;
|
|
648
|
+
else
|
|
649
|
+
throw new Error("Unable to get entity info for view: " + ((_a = this._viewEntity) === null || _a === void 0 ? void 0 : _a.Name));
|
|
650
|
+
}
|
|
651
|
+
else if (!params.ViewEntity && (params.ViewID || params.ViewName)) {
|
|
652
|
+
// this is NOT a dyamic view as we got either the ViewID or ViewName, so we can get the ViewEntity
|
|
653
|
+
if (params.ViewID && params.ViewID > 0) {
|
|
654
|
+
this._viewEntity = (yield ViewInfo.GetViewEntity(params.ViewID));
|
|
655
|
+
}
|
|
656
|
+
else if (params.ViewName) {
|
|
657
|
+
this._viewEntity = (yield ViewInfo.GetViewEntityByName(params.ViewName));
|
|
658
|
+
}
|
|
659
|
+
params.ViewEntity = this._viewEntity;
|
|
660
|
+
const e = md.Entities.find(x => { var _a; return x.ID === ((_a = this._viewEntity) === null || _a === void 0 ? void 0 : _a.EntityID); });
|
|
661
|
+
if (e)
|
|
662
|
+
this._entityInfo = e;
|
|
663
|
+
else
|
|
664
|
+
throw new Error("Unable to get entity info for view: " + ((_b = this._viewEntity) === null || _b === void 0 ? void 0 : _b.Name));
|
|
665
|
+
}
|
|
666
|
+
else if (params.EntityName) {
|
|
667
|
+
// we don't have a ViewEntity because we're doing a dynamic view, so we need to get the entity info from the Entity Name
|
|
668
|
+
const e = md.Entities.find(x => x.Name === params.EntityName);
|
|
669
|
+
if (e)
|
|
670
|
+
this._entityInfo = e;
|
|
671
|
+
}
|
|
672
|
+
else
|
|
673
|
+
throw new Error("Invalid configuration, we need to receive either a ViewEntity, ViewID, ViewName, or EntityName and ExtraFilter in order to run a view");
|
|
674
|
+
const rvResult = yield rv.RunView(params);
|
|
675
|
+
if (!rvResult.Success) {
|
|
676
|
+
// it failed
|
|
677
|
+
this.CreateSimpleNotification("Error running view:\n\n" + rvResult.ErrorMessage, 'error', 5000);
|
|
678
|
+
}
|
|
679
|
+
else {
|
|
680
|
+
// it worked
|
|
681
|
+
this.viewData = rvResult.Results;
|
|
682
|
+
this.totalRowCount = rvResult.TotalRowCount;
|
|
683
|
+
this.formattedData = new Array(this.viewData.length);
|
|
684
|
+
let cols;
|
|
685
|
+
if (this._viewEntity)
|
|
686
|
+
cols = this._viewEntity.Columns;
|
|
687
|
+
else
|
|
688
|
+
cols = (_c = this._entityInfo) === null || _c === void 0 ? void 0 : _c.Fields.filter((f) => f.DefaultInView).map((f) => {
|
|
689
|
+
return {
|
|
690
|
+
ID: f.ID,
|
|
691
|
+
Name: f.Name,
|
|
692
|
+
DisplayName: f.DisplayName,
|
|
693
|
+
EntityField: f,
|
|
694
|
+
hidden: false,
|
|
695
|
+
orderIndex: f.Sequence,
|
|
696
|
+
width: f.DefaultColumnWidth ? f.DefaultColumnWidth : 100,
|
|
697
|
+
};
|
|
698
|
+
});
|
|
699
|
+
if (cols) {
|
|
700
|
+
this.viewColumns = cols;
|
|
701
|
+
const tempCols = cols.filter(x => x.hidden === false).sort((a, b) => {
|
|
702
|
+
const aOrder = a.orderIndex != null ? a.orderIndex : 9999;
|
|
703
|
+
const bOrder = b.orderIndex != null ? b.orderIndex : 9999;
|
|
704
|
+
return aOrder - bOrder;
|
|
705
|
+
});
|
|
706
|
+
this.visibleColumns = tempCols;
|
|
707
|
+
}
|
|
708
|
+
// sorting setup
|
|
709
|
+
if (this._viewEntity) {
|
|
710
|
+
const temp = this._viewEntity.ViewSortInfo;
|
|
711
|
+
const kendoSortSettings = temp.map((s) => { return { field: s.field, dir: s.direction === 1 ? 'asc' : 'desc' }; });
|
|
712
|
+
this.sortSettings = kendoSortSettings;
|
|
713
|
+
}
|
|
714
|
+
this.skip = 0;
|
|
715
|
+
this.virtualLoadData();
|
|
716
|
+
}
|
|
717
|
+
this.viewExecutionTime = (new Date().getTime() - startTime) / 1000; // in seconds
|
|
718
|
+
this.isLoading = false;
|
|
719
|
+
}
|
|
720
|
+
else {
|
|
721
|
+
LogError("Refresh(params) must have ViewID or ViewName or (EntityName and ExtraFilter)");
|
|
722
|
+
}
|
|
723
|
+
});
|
|
724
|
+
}
|
|
725
|
+
GetColumnTitle(col) {
|
|
726
|
+
if (col.DisplayName)
|
|
727
|
+
return col.DisplayName; // use view's display name first if it exists
|
|
728
|
+
else if (col.EntityField.DisplayName)
|
|
729
|
+
return col.EntityField.DisplayName; // then use entity display name, if that exist
|
|
730
|
+
else
|
|
731
|
+
return col.Name; // otherwise just use the column name
|
|
732
|
+
}
|
|
733
|
+
GetColumnCellStyle(col) {
|
|
734
|
+
switch (col.EntityField.Type.trim().toLowerCase()) {
|
|
735
|
+
case "money":
|
|
736
|
+
case 'decimal':
|
|
737
|
+
case 'real':
|
|
738
|
+
case 'float':
|
|
739
|
+
case 'int':
|
|
740
|
+
return { 'text-align': 'right', 'vertical-align': 'top' }; // right align numbers,
|
|
741
|
+
default:
|
|
742
|
+
return { 'text-align': 'left', 'vertical-align': 'top' }; // left align everything else
|
|
743
|
+
}
|
|
744
|
+
}
|
|
745
|
+
selectionChange(args) {
|
|
746
|
+
var _a, _b, _c, _d, _e, _f, _g, _h;
|
|
747
|
+
if (this.compareMode) {
|
|
748
|
+
if (this.compareRecords.length && ((_a = args === null || args === void 0 ? void 0 : args.deselectedRows) === null || _a === void 0 ? void 0 : _a.length)) {
|
|
749
|
+
const tempRow = (_b = args === null || args === void 0 ? void 0 : args.deselectedRows[0]) === null || _b === void 0 ? void 0 : _b.dataItem;
|
|
750
|
+
this.compareRecords = this.compareRecords.filter(record => record.ID !== (tempRow === null || tempRow === void 0 ? void 0 : tempRow.ID));
|
|
751
|
+
}
|
|
752
|
+
else if ((_c = args === null || args === void 0 ? void 0 : args.selectedRows) === null || _c === void 0 ? void 0 : _c.length) {
|
|
753
|
+
const tempRow = (_d = args === null || args === void 0 ? void 0 : args.selectedRows[0]) === null || _d === void 0 ? void 0 : _d.dataItem;
|
|
754
|
+
this.compareRecords.push(tempRow);
|
|
755
|
+
}
|
|
756
|
+
}
|
|
757
|
+
else if (this.mergeMode) {
|
|
758
|
+
if (this.mergeRecords.length && ((_e = args === null || args === void 0 ? void 0 : args.deselectedRows) === null || _e === void 0 ? void 0 : _e.length)) {
|
|
759
|
+
const tempRow = (_f = args === null || args === void 0 ? void 0 : args.deselectedRows[0]) === null || _f === void 0 ? void 0 : _f.dataItem;
|
|
760
|
+
this.mergeRecords = this.mergeRecords.filter(record => record.ID !== (tempRow === null || tempRow === void 0 ? void 0 : tempRow.ID));
|
|
761
|
+
}
|
|
762
|
+
else if ((_g = args === null || args === void 0 ? void 0 : args.selectedRows) === null || _g === void 0 ? void 0 : _g.length) {
|
|
763
|
+
const tempRow = (_h = args === null || args === void 0 ? void 0 : args.selectedRows[0]) === null || _h === void 0 ? void 0 : _h.dataItem;
|
|
764
|
+
this.mergeRecords.push(tempRow);
|
|
765
|
+
}
|
|
766
|
+
}
|
|
767
|
+
}
|
|
768
|
+
enableCompare(cancel = false) {
|
|
769
|
+
if (!cancel && this.compareRecords.length >= 2) {
|
|
770
|
+
// this scenario occurs when we've already started the compare and the user has selected records, then clicked the compare button again
|
|
771
|
+
this.isCompareDialogOpened = true;
|
|
772
|
+
}
|
|
773
|
+
else if (cancel) {
|
|
774
|
+
// the user clicked cancel in our toolbar
|
|
775
|
+
this.compareMode = false;
|
|
776
|
+
this.compareRecords = [];
|
|
777
|
+
this.selectedKeys = [];
|
|
778
|
+
}
|
|
779
|
+
else {
|
|
780
|
+
// just turning on compare mode from the compare button, so just turn it on and let the user select records
|
|
781
|
+
this.compareMode = true;
|
|
782
|
+
}
|
|
783
|
+
}
|
|
784
|
+
enableMerge(cancel = false) {
|
|
785
|
+
if (!cancel && this.mergeRecords.length >= 2) {
|
|
786
|
+
// this scenario occurs when we've already started the merge and the user has selected records, then clicked the merge button again
|
|
787
|
+
this.isCompareDialogOpened = true;
|
|
788
|
+
}
|
|
789
|
+
else if (cancel) {
|
|
790
|
+
// the user clicked cancel in our toolbar
|
|
791
|
+
this.mergeMode = false;
|
|
792
|
+
this.mergeRecords = [];
|
|
793
|
+
this.selectedKeys = [];
|
|
794
|
+
}
|
|
795
|
+
else {
|
|
796
|
+
// just turning on merge mode from the merge button, so just turn it on and let the user select records
|
|
797
|
+
this.mergeMode = true;
|
|
798
|
+
}
|
|
799
|
+
}
|
|
800
|
+
closeCompareDialog(event) {
|
|
801
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
802
|
+
console.log(event);
|
|
803
|
+
switch (event) {
|
|
804
|
+
case 'merge':
|
|
805
|
+
// user has requested to merge the records and retain the selected record from the compare records component, so run the merge
|
|
806
|
+
if (this._entityInfo && this.recordCompareComponent) {
|
|
807
|
+
const md = new Metadata();
|
|
808
|
+
const result = yield md.MergeRecords({
|
|
809
|
+
EntityName: this._entityInfo.Name,
|
|
810
|
+
RecordsToMerge: this.mergeRecords.map((r) => r.ID).filter((id) => { var _a; return id !== ((_a = this.recordCompareComponent) === null || _a === void 0 ? void 0 : _a.selectedRecordId); }),
|
|
811
|
+
SurvivingRecordID: this.recordCompareComponent.selectedRecordId
|
|
812
|
+
});
|
|
813
|
+
if (result.Success) {
|
|
814
|
+
// merge was successful, so refresh the grid
|
|
815
|
+
this.selectedKeys = [];
|
|
816
|
+
this.compareRecords = [];
|
|
817
|
+
this.mergeRecords = [];
|
|
818
|
+
this.mergeMode = false;
|
|
819
|
+
this.compareMode = false;
|
|
820
|
+
this.Refresh(this.Params);
|
|
821
|
+
}
|
|
822
|
+
else {
|
|
823
|
+
// the merge failed, so show an error message
|
|
824
|
+
this.CreateSimpleNotification("Error merging records: " + result.OverallStatus, 'error', 5000);
|
|
825
|
+
}
|
|
826
|
+
}
|
|
827
|
+
break;
|
|
828
|
+
default: // close and cancel
|
|
829
|
+
this.selectedKeys = [];
|
|
830
|
+
this.compareRecords = [];
|
|
831
|
+
this.mergeRecords = [];
|
|
832
|
+
this.mergeMode = false;
|
|
833
|
+
this.compareMode = false;
|
|
834
|
+
break;
|
|
835
|
+
}
|
|
836
|
+
this.isCompareDialogOpened = false;
|
|
837
|
+
});
|
|
838
|
+
}
|
|
839
|
+
doExcelExport() {
|
|
840
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
841
|
+
if (this.kendoExcelExport === null)
|
|
842
|
+
throw new Error("kendoExcelExport is null, cannot export data");
|
|
843
|
+
try {
|
|
844
|
+
this.CreateSimpleNotification("Working on the export, will notify you when it is complete...", 'info', 2000);
|
|
845
|
+
const data = yield this.getExportData();
|
|
846
|
+
// we have the data.
|
|
847
|
+
const cols = this.viewColumns.filter((vc) => vc.hidden === false);
|
|
848
|
+
this.exportColumns = cols;
|
|
849
|
+
this.exportData = data;
|
|
850
|
+
// before we call the save, we need to let Angular do its thing that will result in the kendoExcelExport component binding properly to
|
|
851
|
+
// the exportColumns and exportData arrays. So we wait for the next tick before we call save()
|
|
852
|
+
setTimeout(() => {
|
|
853
|
+
this.kendoExcelExport.save();
|
|
854
|
+
this.CreateSimpleNotification("Excel Export Complete", 'success', 2000);
|
|
855
|
+
}, 100);
|
|
856
|
+
}
|
|
857
|
+
catch (e) {
|
|
858
|
+
this.CreateSimpleNotification("Error exporting data", 'error', 5000);
|
|
859
|
+
LogError(e);
|
|
860
|
+
}
|
|
861
|
+
});
|
|
862
|
+
}
|
|
863
|
+
getExportData() {
|
|
864
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
865
|
+
// Get the data for the ENTIRE view, not just the current page
|
|
866
|
+
const md = new Metadata();
|
|
867
|
+
const rv = new RunView();
|
|
868
|
+
const p = Object.assign(Object.assign({}, this.Params), { IgnoreMaxRows: true, ForceAuditLog: true, AuditLogDescription: `Export of Data From ${this._viewEntity ? '"' + this._viewEntity.Get('Name') + '"' : ''} View for User ${md.CurrentUser.Email}` });
|
|
869
|
+
const result = yield rv.RunView(p);
|
|
870
|
+
if (result && result.Success) {
|
|
871
|
+
return result.Results;
|
|
872
|
+
}
|
|
873
|
+
else
|
|
874
|
+
throw new Error("Unable to get export data");
|
|
875
|
+
});
|
|
876
|
+
}
|
|
877
|
+
}
|
|
878
|
+
UserViewGridComponent.ɵfac = function UserViewGridComponent_Factory(t) { return new (t || UserViewGridComponent)(i0.ɵɵdirectiveInject(i1.FormBuilder), i0.ɵɵdirectiveInject(i2.Router)); };
|
|
879
|
+
UserViewGridComponent.ɵcmp = /*@__PURE__*/ i0.ɵɵdefineComponent({ type: UserViewGridComponent, selectors: [["mj-user-view-grid"]], viewQuery: function UserViewGridComponent_Query(rf, ctx) { if (rf & 1) {
|
|
880
|
+
i0.ɵɵviewQuery(_c0, 5, GridComponent);
|
|
881
|
+
i0.ɵɵviewQuery(_c0, 5, ElementRef);
|
|
882
|
+
i0.ɵɵviewQuery(_c1, 5, ExcelExportComponent);
|
|
883
|
+
i0.ɵɵviewQuery(_c2, 5);
|
|
884
|
+
} if (rf & 2) {
|
|
885
|
+
let _t;
|
|
886
|
+
i0.ɵɵqueryRefresh(_t = i0.ɵɵloadQuery()) && (ctx.kendoGridElement = _t.first);
|
|
887
|
+
i0.ɵɵqueryRefresh(_t = i0.ɵɵloadQuery()) && (ctx.kendoGridElementRef = _t.first);
|
|
888
|
+
i0.ɵɵqueryRefresh(_t = i0.ɵɵloadQuery()) && (ctx.kendoExcelExport = _t.first);
|
|
889
|
+
i0.ɵɵqueryRefresh(_t = i0.ɵɵloadQuery()) && (ctx.recordCompareComponent = _t.first);
|
|
890
|
+
} }, inputs: { Params: "Params", BottomMargin: "BottomMargin", InEditMode: "InEditMode", EditMode: "EditMode", AutoNavigate: "AutoNavigate", AllowLoad: "AllowLoad" }, outputs: { rowClicked: "rowClicked", rowEdited: "rowEdited" }, decls: 10, vars: 19, consts: [["mjFillContainer", "", 1, "user-view-grid-wrap"], ["mjFillContainer", "", "scrollable", "virtual", "kendoGridSelectBy", "", 3, "resizable", "data", "skip", "pageSize", "rowHeight", "loading", "height", "sortable", "sort", "reorderable", "selectable", "selectedKeys", "pageChange", "selectedKeysChange", "cellClick", "cellClose", "columnReorder", "columnResize", "selectionChange", "sortChange"], ["kendoGrid", ""], ["kendoGridToolbarTemplate", ""], [3, "width", "headerStyle", "style", 4, "ngIf"], [3, "field", "title", "width", "editable", "editor", "headerStyle", "style", 4, "ngFor", "ngForOf"], [3, "data", "fileName"], ["excelExport", ""], [3, "field", "title", 4, "ngFor", "ngForOf"], [4, "ngIf"], ["kendoButton", "", "icon", "file-excel", 3, "click", 4, "ngIf"], ["class", "k-button k-button-md k-rounded-md k-button-solid-base k-button-solid", 3, "disabled", "click", 4, "ngIf"], ["class", "k-button k-button-md k-rounded-md k-button-solid-base k-button-solid", 3, "click", 4, "ngIf"], ["kendoButton", "", "icon", "refresh", 3, "primary", "click", 4, "ngIf"], ["kendoButton", "", "icon", "file-excel", 3, "click"], [1, "k-button", "k-button-md", "k-rounded-md", "k-button-solid-base", "k-button-solid", 3, "disabled", "click"], [1, "k-button", "k-button-md", "k-rounded-md", "k-button-solid-base", "k-button-solid", 3, "click"], ["kendoButton", "", "icon", "refresh", 3, "primary", "click"], [3, "width", "headerStyle"], [3, "field", "title", "width", "editable", "editor", "headerStyle"], ["kendoGridFooterTemplate", ""], [2, "font-size", "smaller", "font-weight", "normal"], [3, "field", "title"], [1, "k-overlay"], ["title", "Compare Records", 3, "minHeight", "minWidth", "resizable", "close", 4, "ngIf"], ["title", "Compare Records", 3, "minHeight", "minWidth", "resizable", "close"], [1, "k-d-flex", "k-flex-col", "k-justify-content-between", "k-h-full"], [3, "entityName", "recordsToCompare", "visibleColumns", "selectionMode"], ["recordCompareRef", ""], [1, "k-actions", "k-actions-end"], ["kendoButton", "", "type", "button", 3, "click", 4, "ngIf"], ["kendoButton", "", "themeColor", "primary", "type", "button", 3, "click", 4, "ngIf"], ["kendoButton", "", "type", "button", 3, "click"], ["kendoButton", "", "themeColor", "primary", "type", "button", 3, "click"]], template: function UserViewGridComponent_Template(rf, ctx) { if (rf & 1) {
|
|
891
|
+
i0.ɵɵelementStart(0, "div", 0)(1, "kendo-grid", 1, 2);
|
|
892
|
+
i0.ɵɵlistener("pageChange", function UserViewGridComponent_Template_kendo_grid_pageChange_1_listener($event) { return ctx.pageChange($event); })("selectedKeysChange", function UserViewGridComponent_Template_kendo_grid_selectedKeysChange_1_listener($event) { return ctx.selectedKeys = $event; })("cellClick", function UserViewGridComponent_Template_kendo_grid_cellClick_1_listener($event) { return ctx.cellClickHandler($event); })("cellClose", function UserViewGridComponent_Template_kendo_grid_cellClose_1_listener($event) { return ctx.cellCloseHandler($event); })("columnReorder", function UserViewGridComponent_Template_kendo_grid_columnReorder_1_listener($event) { return ctx.columnReorder($event); })("columnResize", function UserViewGridComponent_Template_kendo_grid_columnResize_1_listener($event) { return ctx.columnResize($event); })("selectionChange", function UserViewGridComponent_Template_kendo_grid_selectionChange_1_listener($event) { return ctx.selectionChange($event); })("sortChange", function UserViewGridComponent_Template_kendo_grid_sortChange_1_listener($event) { return ctx.sortChanged($event); });
|
|
893
|
+
i0.ɵɵtemplate(3, UserViewGridComponent_ng_template_3_Template, 8, 8, "ng-template", 3);
|
|
894
|
+
i0.ɵɵtemplate(4, UserViewGridComponent_kendo_grid_checkbox_column_4_Template, 1, 6, "kendo-grid-checkbox-column", 4);
|
|
895
|
+
i0.ɵɵtemplate(5, UserViewGridComponent_kendo_grid_column_5_Template, 2, 10, "kendo-grid-column", 5);
|
|
896
|
+
i0.ɵɵelementStart(6, "kendo-excelexport", 6, 7);
|
|
897
|
+
i0.ɵɵtemplate(8, UserViewGridComponent_kendo_excelexport_column_8_Template, 1, 2, "kendo-excelexport-column", 8);
|
|
898
|
+
i0.ɵɵelementEnd()()();
|
|
899
|
+
i0.ɵɵtemplate(9, UserViewGridComponent_div_9_Template, 3, 1, "div", 9);
|
|
900
|
+
} if (rf & 2) {
|
|
901
|
+
i0.ɵɵadvance(1);
|
|
902
|
+
i0.ɵɵproperty("resizable", true)("data", ctx.gridView)("skip", ctx.skip)("pageSize", ctx.pageSize)("rowHeight", 36)("loading", ctx.isLoading)("height", ctx.gridHeight)("sortable", true)("sort", ctx.sortSettings)("resizable", true)("reorderable", true)("selectable", true)("selectedKeys", ctx.selectedKeys);
|
|
903
|
+
i0.ɵɵadvance(3);
|
|
904
|
+
i0.ɵɵproperty("ngIf", ctx.compareMode || ctx.mergeMode);
|
|
905
|
+
i0.ɵɵadvance(1);
|
|
906
|
+
i0.ɵɵproperty("ngForOf", ctx.visibleColumns);
|
|
907
|
+
i0.ɵɵadvance(1);
|
|
908
|
+
i0.ɵɵproperty("data", ctx.exportData)("fileName", (ctx._viewEntity ? ctx._viewEntity.Get("Name") : ctx._entityInfo == null ? null : ctx._entityInfo.Name) + ".xlsx");
|
|
909
|
+
i0.ɵɵadvance(2);
|
|
910
|
+
i0.ɵɵproperty("ngForOf", ctx.exportColumns);
|
|
911
|
+
i0.ɵɵadvance(1);
|
|
912
|
+
i0.ɵɵproperty("ngIf", ctx.isCompareDialogOpened);
|
|
913
|
+
} }, dependencies: [i3.NgForOf, i3.NgIf, i4.GridComponent, i4.ToolbarTemplateDirective, i4.SelectionDirective, i4.ColumnComponent, i4.FooterTemplateDirective, i4.CheckboxColumnComponent, i5.WindowComponent, i6.ExcelExportComponent, i6.ColumnComponent, i7.Button, i8.CompareRecordsComponent, i9.FillContainer, i3.DecimalPipe], styles: [".user-view-grid-wrap[_ngcontent-%COMP%] {\r\n height: calc(100vh-20px);\r\n}\r\n\r\n.user-view-grid-column-header[_ngcontent-%COMP%] {\r\n background-color: #a9c2af;\r\n font-size: 20pt;\r\n font-weight: bold;\r\n}"] });
|
|
914
|
+
(function () { (typeof ngDevMode === "undefined" || ngDevMode) && i0.ɵsetClassMetadata(UserViewGridComponent, [{
|
|
915
|
+
type: Component,
|
|
916
|
+
args: [{ selector: 'mj-user-view-grid', template: "<div class=\"user-view-grid-wrap\" mjFillContainer>\r\n <kendo-grid #kendoGrid\r\n mjFillContainer\r\n [resizable]=\"true\"\r\n [data]=\"gridView\" \r\n [skip]=\"skip\"\r\n [pageSize]=\"pageSize\"\r\n scrollable=\"virtual\"\r\n [rowHeight]=\"36\"\r\n (pageChange)=\"pageChange($event)\"\r\n [loading]=\"isLoading\"\r\n [height]=\"gridHeight\"\r\n [sortable]=\"true\"\r\n [sort]=\"sortSettings\" \r\n [resizable]=\"true\"\r\n [reorderable]=\"true\"\r\n [selectable]=\"true\"\r\n kendoGridSelectBy\r\n [(selectedKeys)]=\"selectedKeys\"\r\n (cellClick)=\"cellClickHandler($event)\"\r\n (cellClose)=\"cellCloseHandler($event)\"\r\n (columnReorder)=\"columnReorder($event)\"\r\n (columnResize)=\"columnResize($event)\"\r\n (selectionChange)=\"selectionChange($event)\"\r\n (sortChange)=\"sortChanged($event)\"\r\n >\r\n <ng-template kendoGridToolbarTemplate>\r\n <button kendoButton icon=\"file-excel\" *ngIf=\"!compareMode && !mergeMode\" (click)=\"doExcelExport()\" >Export to Excel</button>\r\n <!-- 3 buttons for compare. First one only shows when comparison is going on in the grid, the next one is the one the user starts the process with before records are selected, last one is to cancel the pending compare. -->\r\n <button (click)=\"enableCompare()\" *ngIf=\"!compareMode && !mergeMode\" [disabled]=\"compareMode && compareRecords.length < 2\" class=\"k-button k-button-md k-rounded-md k-button-solid-base k-button-solid\">Compare</button>\r\n <button (click)=\"enableCompare()\" *ngIf=\"compareMode\" [disabled]=\"compareMode && compareRecords.length < 2\" class=\"k-button k-button-md k-rounded-md k-button-solid-base k-button-solid\">Compare</button>\r\n <button (click)=\"enableCompare(true)\" *ngIf=\"compareMode\" class=\"k-button k-button-md k-rounded-md k-button-solid-base k-button-solid\">Cancel</button>\r\n\r\n <!-- 3 buttons for merge. First one only shows when merge is getting goin in the grid, the next one is the one the user starts the process with before records are selected, last one is to cancel the pending merge. -->\r\n <button (click)=\"enableMerge()\" *ngIf=\"mergeMode\" [disabled]=\"mergeMode && mergeRecords.length < 2\" class=\"k-button k-button-md k-rounded-md k-button-solid-base k-button-solid\">Merge</button>\r\n <button (click)=\"enableMerge()\" *ngIf=\"!mergeMode && !compareMode\" class=\"k-button k-button-md k-rounded-md k-button-solid-base k-button-solid\">Merge</button>\r\n <button (click)=\"enableMerge(true)\" *ngIf=\"mergeMode\" class=\"k-button k-button-md k-rounded-md k-button-solid-base k-button-solid\">Cancel</button>\r\n <button\r\n kendoButton\r\n [primary]=\"true\"\r\n icon=\"refresh\"\r\n *ngIf=\"showRefreshButton && !compareMode && !mergeMode\"\r\n (click)=\"RefreshFromSavedParams()\">\r\n Refresh\r\n </button>\r\n </ng-template>\r\n\r\n <kendo-grid-checkbox-column \r\n *ngIf=\"compareMode || mergeMode\" \r\n [width]=\"50\" \r\n [headerStyle]=\"{ 'font-weight' : 'bold', 'background-color': '#a9c2af' }\" \r\n [style]=\"{'text-align': 'center', 'vertical-align': 'center'}\">\r\n </kendo-grid-checkbox-column>\r\n \r\n <kendo-grid-column \r\n *ngFor=\"let item of visibleColumns\" \r\n [field]=\"item.Name\" \r\n [title]=\"GetColumnTitle(item)\"\r\n [width]=\"item.width ? item.width : 100\"\r\n [editable]=\"item.EntityField.AllowUpdateAPI\"\r\n [editor]=\"getEditor(item.EntityField)\"\r\n [headerStyle]=\"{ 'font-weight' : 'bold', 'background-color': '#a9c2af' }\"\r\n [style]=\"this.GetColumnCellStyle(item)\"\r\n >\r\n <ng-template *ngIf=\"item===visibleColumns[0]\" kendoGridFooterTemplate >\r\n {{this.viewData.length | number}}{{this.totalRowCount > this.viewData.length ? ' of ' + (this.totalRowCount | number) : ' rows'}}<br/><span style=\"font-size: smaller; font-weight: normal;\">{{viewExecutionTime | number:'1.2-2'}} seconds</span>\r\n </ng-template>\r\n </kendo-grid-column>\r\n\r\n <kendo-excelexport #excelExport [data]=\"exportData\" [fileName]=\"(_viewEntity ? _viewEntity.Get('Name') : _entityInfo?.Name) + '.xlsx'\">\r\n <kendo-excelexport-column *ngFor=\"let exportCol of exportColumns\" [field]=\"exportCol.Name\" [title]=\"exportCol.Name\">\r\n </kendo-excelexport-column>\r\n </kendo-excelexport>\r\n </kendo-grid>\r\n</div>\r\n\r\n<div *ngIf=\"isCompareDialogOpened\">\r\n <div class=\"k-overlay\"></div>\r\n <kendo-window\r\n [minHeight]=\"300\"\r\n [minWidth]=\"400\"\r\n [resizable]=\"true\"\r\n (close)=\"closeCompareDialog($event)\"\r\n title=\"Compare Records\"\r\n *ngIf=\"isCompareDialogOpened\"\r\n >\r\n <div class=\"k-d-flex k-flex-col k-justify-content-between k-h-full\">\r\n <div>\r\n <mj-compare-records\r\n #recordCompareRef\r\n [entityName]=\"_entityInfo ? _entityInfo.Name : ''\"\r\n [recordsToCompare]=\"compareMode ? compareRecords : mergeRecords\" \r\n [visibleColumns]=\"visibleColumns\" \r\n [selectionMode]=\"mergeMode ? true : false\"\r\n >\r\n </mj-compare-records>\r\n </div>\r\n </div>\r\n <div class=\"k-actions k-actions-end\">\r\n <button *ngIf=\"compareMode\" kendoButton type=\"button\" (click)=\"closeCompareDialog('close')\">Close</button>\r\n <button *ngIf=\"mergeMode\"kendoButton type=\"button\" (click)=\"closeCompareDialog('cancel')\">Cancel</button>\r\n <button *ngIf=\"mergeMode\"\r\n kendoButton\r\n themeColor=\"primary\"\r\n type=\"button\"\r\n (click)=\"closeCompareDialog('merge')\"\r\n >\r\n Merge Records\r\n </button>\r\n </div> \r\n </kendo-window>\r\n</div>\r\n ", styles: [".user-view-grid-wrap {\r\n height: calc(100vh-20px);\r\n}\r\n\r\n.user-view-grid-column-header {\r\n background-color: #a9c2af;\r\n font-size: 20pt;\r\n font-weight: bold;\r\n}"] }]
|
|
917
|
+
}], function () { return [{ type: i1.FormBuilder }, { type: i2.Router }]; }, { Params: [{
|
|
918
|
+
type: Input
|
|
919
|
+
}], BottomMargin: [{
|
|
920
|
+
type: Input
|
|
921
|
+
}], InEditMode: [{
|
|
922
|
+
type: Input
|
|
923
|
+
}], EditMode: [{
|
|
924
|
+
type: Input
|
|
925
|
+
}], AutoNavigate: [{
|
|
926
|
+
type: Input
|
|
927
|
+
}], rowClicked: [{
|
|
928
|
+
type: Output
|
|
929
|
+
}], rowEdited: [{
|
|
930
|
+
type: Output
|
|
931
|
+
}], kendoGridElement: [{
|
|
932
|
+
type: ViewChild,
|
|
933
|
+
args: ['kendoGrid', { read: GridComponent }]
|
|
934
|
+
}], kendoGridElementRef: [{
|
|
935
|
+
type: ViewChild,
|
|
936
|
+
args: ['kendoGrid', { read: ElementRef }]
|
|
937
|
+
}], kendoExcelExport: [{
|
|
938
|
+
type: ViewChild,
|
|
939
|
+
args: ['excelExport', { read: ExcelExportComponent }]
|
|
940
|
+
}], recordCompareComponent: [{
|
|
941
|
+
type: ViewChild,
|
|
942
|
+
args: ['recordCompareRef', { static: false }]
|
|
943
|
+
}], AllowLoad: [{
|
|
944
|
+
type: Input
|
|
945
|
+
}] }); })();
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
import * as i0 from "@angular/core";
|
|
2
|
+
import * as i1 from "./ng-user-view-grid.component";
|
|
3
|
+
import * as i2 from "@angular/common";
|
|
4
|
+
import * as i3 from "@angular/forms";
|
|
5
|
+
import * as i4 from "@angular/router";
|
|
6
|
+
import * as i5 from "@progress/kendo-angular-grid";
|
|
7
|
+
import * as i6 from "@progress/kendo-angular-dialog";
|
|
8
|
+
import * as i7 from "@progress/kendo-angular-excel-export";
|
|
9
|
+
import * as i8 from "@progress/kendo-angular-buttons";
|
|
10
|
+
import * as i9 from "@memberjunction/ng-compare-records";
|
|
11
|
+
import * as i10 from "@memberjunction/ng-container-directives";
|
|
12
|
+
export declare class UserViewGridModule {
|
|
13
|
+
static ɵfac: i0.ɵɵFactoryDeclaration<UserViewGridModule, never>;
|
|
14
|
+
static ɵmod: i0.ɵɵNgModuleDeclaration<UserViewGridModule, [typeof i1.UserViewGridComponent], [typeof i2.CommonModule, typeof i3.FormsModule, typeof i3.ReactiveFormsModule, typeof i4.RouterModule, typeof i5.GridModule, typeof i6.DialogsModule, typeof i7.ExcelExportModule, typeof i8.ButtonsModule, typeof i9.CompareRecordsModule, typeof i10.ContainerDirectivesModule], [typeof i1.UserViewGridComponent]>;
|
|
15
|
+
static ɵinj: i0.ɵɵInjectorDeclaration<UserViewGridModule>;
|
|
16
|
+
}
|
|
@@ -0,0 +1,60 @@
|
|
|
1
|
+
import { NgModule } from '@angular/core';
|
|
2
|
+
import { UserViewGridComponent } from './ng-user-view-grid.component';
|
|
3
|
+
import { CommonModule } from '@angular/common';
|
|
4
|
+
import { FormsModule, ReactiveFormsModule } from '@angular/forms';
|
|
5
|
+
import { RouterModule } from '@angular/router';
|
|
6
|
+
// Kendo UI Angular imports
|
|
7
|
+
import { GridModule } from '@progress/kendo-angular-grid';
|
|
8
|
+
import { ExcelExportModule } from '@progress/kendo-angular-excel-export';
|
|
9
|
+
import { DialogsModule } from "@progress/kendo-angular-dialog";
|
|
10
|
+
import { ButtonsModule } from '@progress/kendo-angular-buttons';
|
|
11
|
+
import { CompareRecordsModule } from '@memberjunction/ng-compare-records';
|
|
12
|
+
import { ContainerDirectivesModule } from '@memberjunction/ng-container-directives';
|
|
13
|
+
import * as i0 from "@angular/core";
|
|
14
|
+
export class UserViewGridModule {
|
|
15
|
+
}
|
|
16
|
+
UserViewGridModule.ɵfac = function UserViewGridModule_Factory(t) { return new (t || UserViewGridModule)(); };
|
|
17
|
+
UserViewGridModule.ɵmod = /*@__PURE__*/ i0.ɵɵdefineNgModule({ type: UserViewGridModule });
|
|
18
|
+
UserViewGridModule.ɵinj = /*@__PURE__*/ i0.ɵɵdefineInjector({ imports: [CommonModule,
|
|
19
|
+
FormsModule,
|
|
20
|
+
ReactiveFormsModule,
|
|
21
|
+
RouterModule,
|
|
22
|
+
GridModule,
|
|
23
|
+
DialogsModule,
|
|
24
|
+
ExcelExportModule,
|
|
25
|
+
ButtonsModule,
|
|
26
|
+
CompareRecordsModule,
|
|
27
|
+
ContainerDirectivesModule] });
|
|
28
|
+
(function () { (typeof ngDevMode === "undefined" || ngDevMode) && i0.ɵsetClassMetadata(UserViewGridModule, [{
|
|
29
|
+
type: NgModule,
|
|
30
|
+
args: [{
|
|
31
|
+
declarations: [
|
|
32
|
+
UserViewGridComponent
|
|
33
|
+
],
|
|
34
|
+
imports: [
|
|
35
|
+
CommonModule,
|
|
36
|
+
FormsModule,
|
|
37
|
+
ReactiveFormsModule,
|
|
38
|
+
RouterModule,
|
|
39
|
+
GridModule,
|
|
40
|
+
DialogsModule,
|
|
41
|
+
ExcelExportModule,
|
|
42
|
+
ButtonsModule,
|
|
43
|
+
CompareRecordsModule,
|
|
44
|
+
ContainerDirectivesModule
|
|
45
|
+
],
|
|
46
|
+
exports: [
|
|
47
|
+
UserViewGridComponent
|
|
48
|
+
]
|
|
49
|
+
}]
|
|
50
|
+
}], null, null); })();
|
|
51
|
+
(function () { (typeof ngJitMode === "undefined" || ngJitMode) && i0.ɵɵsetNgModuleScope(UserViewGridModule, { declarations: [UserViewGridComponent], imports: [CommonModule,
|
|
52
|
+
FormsModule,
|
|
53
|
+
ReactiveFormsModule,
|
|
54
|
+
RouterModule,
|
|
55
|
+
GridModule,
|
|
56
|
+
DialogsModule,
|
|
57
|
+
ExcelExportModule,
|
|
58
|
+
ButtonsModule,
|
|
59
|
+
CompareRecordsModule,
|
|
60
|
+
ContainerDirectivesModule], exports: [UserViewGridComponent] }); })();
|
package/package.json
CHANGED
|
@@ -1,9 +1,12 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@memberjunction/ng-user-view-grid",
|
|
3
|
-
"version": "0.9.
|
|
3
|
+
"version": "0.9.41",
|
|
4
4
|
"description": "MemberJunction: Angular Grid to display dynamic and saved user views for any entity in MemberJunction.",
|
|
5
5
|
"main": "./dist/public-api.js",
|
|
6
6
|
"typings": "./dist/public-api.d.ts",
|
|
7
|
+
"files": [
|
|
8
|
+
"/dist"
|
|
9
|
+
],
|
|
7
10
|
"scripts": {
|
|
8
11
|
"test": "echo \"Error: no test specified\" && exit 1",
|
|
9
12
|
"build": "ngc"
|
|
@@ -23,11 +26,11 @@
|
|
|
23
26
|
"@progress/kendo-angular-grid": "^12.1.0"
|
|
24
27
|
},
|
|
25
28
|
"dependencies": {
|
|
26
|
-
"@memberjunction/core-entities": "^0.9.
|
|
27
|
-
"@memberjunction/global": "^0.9.
|
|
28
|
-
"@memberjunction/core": "^0.9.
|
|
29
|
-
"@memberjunction/ng-compare-records": "^0.9.
|
|
30
|
-
"@memberjunction/ng-container-directives": "^0.9.
|
|
29
|
+
"@memberjunction/core-entities": "^0.9.32",
|
|
30
|
+
"@memberjunction/global": "^0.9.62",
|
|
31
|
+
"@memberjunction/core": "^0.9.59",
|
|
32
|
+
"@memberjunction/ng-compare-records": "^0.9.42",
|
|
33
|
+
"@memberjunction/ng-container-directives": "^0.9.41",
|
|
31
34
|
"tslib": "^2.3.0"
|
|
32
35
|
},
|
|
33
36
|
"sideEffects": false
|