@memberjunction/ng-user-view-grid 0.9.111 → 0.9.131

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.
@@ -1,1000 +1,1071 @@
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.enableMergeOrCompare(false, "compare")); });
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.recordsToCompare.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.enableMergeOrCompare(false, "compare")); });
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.recordsToCompare.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.enableMergeOrCompare(true, "compare")); });
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.enableMergeOrCompare(false, "merge")); });
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.recordsToCompare.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.enableMergeOrCompare(false, "merge")); });
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.enableMergeOrCompare(true, "merge")); });
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 _r42 = i0.ɵɵgetCurrentView();
171
- i0.ɵɵelementStart(0, "button", 33);
172
- i0.ɵɵlistener("click", function UserViewGridComponent_div_9_kendo_window_2_button_6_Template_button_click_0_listener() { i0.ɵɵrestoreView(_r42); const ctx_r41 = i0.ɵɵnextContext(3); return i0.ɵɵresetView(ctx_r41.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 _r44 = i0.ɵɵgetCurrentView();
178
- i0.ɵɵelementStart(0, "button", 33);
179
- i0.ɵɵlistener("click", function UserViewGridComponent_div_9_kendo_window_2_button_7_Template_button_click_0_listener() { i0.ɵɵrestoreView(_r44); const ctx_r43 = i0.ɵɵnextContext(3); return i0.ɵɵresetView(ctx_r43.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 _r46 = i0.ɵɵgetCurrentView();
185
- i0.ɵɵelementStart(0, "button", 34);
186
- i0.ɵɵlistener("click", function UserViewGridComponent_div_9_kendo_window_2_button_8_Template_button_click_0_listener() { i0.ɵɵrestoreView(_r46); const ctx_r45 = i0.ɵɵnextContext(3); return i0.ɵɵresetView(ctx_r45.closeCompareDialog("merge")); });
187
- i0.ɵɵtext(1, " Merge Records ");
188
- i0.ɵɵelementEnd();
189
- } }
190
- function UserViewGridComponent_div_9_kendo_window_2_kendo_dialog_9_Template(rf, ctx) { if (rf & 1) {
191
- const _r48 = i0.ɵɵgetCurrentView();
192
- i0.ɵɵelementStart(0, "kendo-dialog", 35);
193
- i0.ɵɵlistener("close", function UserViewGridComponent_div_9_kendo_window_2_kendo_dialog_9_Template_kendo_dialog_close_0_listener() { i0.ɵɵrestoreView(_r48); const ctx_r47 = i0.ɵɵnextContext(3); return i0.ɵɵresetView(ctx_r47.closeConfirmMergeDialog("cancel")); });
194
- i0.ɵɵelementStart(1, "p", 36);
195
- i0.ɵɵtext(2, " Are you sure you want to merge the records? This action cannot be undone. If you select \"Yes\", the records will be merged and the duplicate records will be deleted. ");
196
- i0.ɵɵelementEnd();
197
- i0.ɵɵelementStart(3, "kendo-dialog-actions")(4, "button", 37);
198
- i0.ɵɵlistener("click", function UserViewGridComponent_div_9_kendo_window_2_kendo_dialog_9_Template_button_click_4_listener() { i0.ɵɵrestoreView(_r48); const ctx_r49 = i0.ɵɵnextContext(3); return i0.ɵɵresetView(ctx_r49.closeConfirmMergeDialog("no")); });
199
- i0.ɵɵtext(5, "No");
200
- i0.ɵɵelementEnd();
201
- i0.ɵɵelementStart(6, "button", 38);
202
- i0.ɵɵlistener("click", function UserViewGridComponent_div_9_kendo_window_2_kendo_dialog_9_Template_button_click_6_listener() { i0.ɵɵrestoreView(_r48); const ctx_r50 = i0.ɵɵnextContext(3); return i0.ɵɵresetView(ctx_r50.closeConfirmMergeDialog("yes")); });
203
- i0.ɵɵtext(7, " Yes ");
204
- i0.ɵɵelementEnd()()();
205
- } if (rf & 2) {
206
- i0.ɵɵproperty("minWidth", 250)("width", 450);
207
- } }
208
- function UserViewGridComponent_div_9_kendo_window_2_Template(rf, ctx) { if (rf & 1) {
209
- const _r52 = i0.ɵɵgetCurrentView();
210
- i0.ɵɵelementStart(0, "kendo-window", 25);
211
- i0.ɵɵlistener("close", function UserViewGridComponent_div_9_kendo_window_2_Template_kendo_window_close_0_listener($event) { i0.ɵɵrestoreView(_r52); const ctx_r51 = i0.ɵɵnextContext(2); return i0.ɵɵresetView(ctx_r51.closeCompareDialog($event)); });
212
- i0.ɵɵelementStart(1, "div", 26)(2, "div");
213
- i0.ɵɵelement(3, "mj-compare-records", 27, 28);
214
- i0.ɵɵelementEnd()();
215
- i0.ɵɵelementStart(5, "div", 29);
216
- i0.ɵɵtemplate(6, UserViewGridComponent_div_9_kendo_window_2_button_6_Template, 2, 0, "button", 30);
217
- i0.ɵɵtemplate(7, UserViewGridComponent_div_9_kendo_window_2_button_7_Template, 2, 0, "button", 30);
218
- i0.ɵɵtemplate(8, UserViewGridComponent_div_9_kendo_window_2_button_8_Template, 2, 0, "button", 31);
219
- i0.ɵɵelementEnd();
220
- i0.ɵɵtemplate(9, UserViewGridComponent_div_9_kendo_window_2_kendo_dialog_9_Template, 8, 2, "kendo-dialog", 32);
221
- i0.ɵɵelementEnd();
222
- } if (rf & 2) {
223
- const ctx_r35 = i0.ɵɵnextContext(2);
224
- i0.ɵɵproperty("minHeight", 300)("minWidth", 400)("resizable", true);
225
- i0.ɵɵadvance(3);
226
- i0.ɵɵproperty("entityName", ctx_r35._entityInfo ? ctx_r35._entityInfo.Name : "")("recordsToCompare", ctx_r35.recordsToCompare)("visibleColumns", ctx_r35.visibleColumns)("selectionMode", ctx_r35.mergeMode ? true : false);
227
- i0.ɵɵadvance(3);
228
- i0.ɵɵproperty("ngIf", ctx_r35.compareMode);
229
- i0.ɵɵadvance(1);
230
- i0.ɵɵproperty("ngIf", ctx_r35.mergeMode);
231
- i0.ɵɵadvance(1);
232
- i0.ɵɵproperty("ngIf", ctx_r35.mergeMode);
233
- i0.ɵɵadvance(1);
234
- i0.ɵɵproperty("ngIf", ctx_r35.isConfirmDialogOpen);
235
- } }
236
- function UserViewGridComponent_div_9_Template(rf, ctx) { if (rf & 1) {
237
- i0.ɵɵelementStart(0, "div");
238
- i0.ɵɵelement(1, "div", 23);
239
- i0.ɵɵtemplate(2, UserViewGridComponent_div_9_kendo_window_2_Template, 10, 11, "kendo-window", 24);
240
- i0.ɵɵelementEnd();
241
- } if (rf & 2) {
242
- const ctx_r6 = i0.ɵɵnextContext();
243
- i0.ɵɵadvance(2);
244
- i0.ɵɵproperty("ngIf", ctx_r6.isCompareDialogOpened);
245
- } }
246
- export class UserViewGridComponent {
247
- get PendingRecords() {
248
- return this._pendingRecords;
249
- }
250
- StartEditMode() {
251
- this.InEditMode = true;
252
- }
253
- EndEditMode() {
254
- this.InEditMode = false;
255
- this.editModeEnded.next();
256
- }
257
- EditingComplete() {
258
- if (this.InEditMode) {
259
- // we need to wait for edit mode to end before we can return true
260
- return new Promise((resolve, reject) => {
261
- const subscription = this.editModeEnded.subscribe(() => {
262
- resolve(true);
263
- subscription.unsubscribe();
264
- });
265
- });
266
- }
267
- else
268
- return Promise.resolve(true); // not in edit mode, so editing is complete!
269
- }
270
- IsDynamicView() {
271
- return !this._viewEntity; // if we have a viewEntity it is a stored view
272
- }
273
- pageChange(event) {
274
- this.skip = event.skip;
275
- this.virtualLoadData();
276
- }
277
- virtualLoadData() {
278
- // check to see if we have already formatted the slice of the data we need right now
279
- // we are storing the formattted data in the formattedData array and it has same set
280
- // of indexes as the viewData array (raw unformatted data). When we first get viewData
281
- // from the server we create an array of the same length as viewData, but have nulls in all of the
282
- // indexes. As we format each row of viewData we store the formatted row in the same index
283
- // in the formattedData array. So if we have already formatted the data we need for the current
284
- // page, we just use that data, otherwise we format the data we need for the current page
285
- try {
286
- // check to see if we have already formatted the data we need for the current page
287
- for (let i = this.skip; (i < (this.skip + this.pageSize)) && (i < this.viewData.length); i++) {
288
- if (!this.formattedData[i]) {
289
- // we have not formatted this row yet, so format it
290
- const r = this.viewColumns.map((c) => {
291
- if (c && c.EntityField && this.viewData[i] && this.viewData[i][c.EntityField.Name]) {
292
- if (!c.hidden && c.EntityField.Name !== 'ID') {
293
- const ef = c.EntityField;
294
- return { field: c.EntityField.Name, value: ef.FormatValue(this.viewData[i][c.EntityField.Name], 0, undefined, 300) };
295
- }
296
- else
297
- return { field: c.EntityField.Name, value: this.viewData[i][c.EntityField.Name] }; // hidden column, so just return the value, don't bother formatting
298
- }
299
- else
300
- return { field: c.Name, value: null };
301
- });
302
- // now r is an array of {field: string, value: any} objects, so we need to convert it to an object
303
- // with the field names as the keys and the values as the values
304
- const row = {};
305
- for (let j = 0; j < r.length; j++) {
306
- if (r[j] && r[j].field && r[j].field.length > 0)
307
- row[r[j].field] = r[j].value;
308
- }
309
- this.formattedData[i] = row;
310
- }
311
- }
312
- // now that we have made sure current page of data is formatted, we can return it
313
- this.gridView = {
314
- data: this.formattedData.slice(this.skip, this.skip + this.pageSize),
315
- total: this.viewData.length,
316
- };
317
- }
318
- catch (e) {
319
- LogError(e);
320
- }
321
- }
322
- constructor(formBuilder, router) {
323
- this.formBuilder = formBuilder;
324
- this.router = router;
325
- this.title = 'UserViewGrid';
326
- this.BottomMargin = 0;
327
- this.InEditMode = false;
328
- this.EditMode = "None";
329
- this.AutoNavigate = true;
330
- this.rowClicked = new EventEmitter();
331
- this.rowEdited = new EventEmitter();
332
- this.kendoGridElement = null;
333
- this.kendoGridElementRef = null;
334
- this.kendoExcelExport = null;
335
- this.recordCompareComponent = null;
336
- this._pendingRecords = [];
337
- this.viewData = [];
338
- this.totalRowCount = 0;
339
- this.formattedData = [];
340
- this.viewColumns = [];
341
- this.visibleColumns = [];
342
- this.sortSettings = [];
343
- this.entityRecord = null;
344
- this.skip = 0;
345
- this.pageSize = 40;
346
- this.isLoading = false;
347
- this.gridView = { data: [], total: 0 };
348
- this.gridHeight = 750;
349
- this._newGridState = {};
350
- this.editModeEnded = new Subject();
351
- this.recordsToCompare = [];
352
- this.compareMode = false;
353
- // public compareRecords: BaseEntity[] = [];
354
- this.mergeMode = false;
355
- // public mergeRecords: BaseEntity[] = [];
356
- this.selectableSettings = {
357
- enabled: false
358
- };
359
- this.selectedKeys = [];
360
- this.isCompareDialogOpened = false;
361
- this.isConfirmDialogOpen = false;
362
- this.showRefreshButton = true;
363
- this.viewExecutionTime = 0;
364
- this._viewDirty = false;
365
- this._deferLoadCount = 0;
366
- this._allowLoad = true;
367
- // Export Functionality
368
- this.exportColumns = [];
369
- this.exportData = [];
370
- }
371
- SaveView() {
372
- // debounced outer function...
373
- clearTimeout(this._saveTimeout);
374
- this._saveTimeout = setTimeout(() => __awaiter(this, void 0, void 0, function* () {
375
- // when we actually call inner save view we do await
376
- yield this.innerSaveView();
377
- }), 5000); // 5 seconds delay
378
- }
379
- ;
380
- innerSaveView() {
381
- return __awaiter(this, void 0, void 0, function* () {
382
- if (this._viewDirty) {
383
- const md = new Metadata();
384
- if (this._viewEntity &&
385
- this._viewEntity.Get('UserID') === md.CurrentUser.ID) {
386
- // this view is a saved view, AND it belongs to the current user
387
- // update the grid state if we have settings updates for columns and/or sorts
388
- const tempGridState = JSON.parse(this._viewEntity.Get('GridState'));
389
- const tempColSettings = this._newGridState.columnSettings ? this._newGridState.columnSettings : tempGridState.columnSettings;
390
- tempColSettings.forEach((col) => { col.DisplayName, col.ID, col.Name, col.hidden, col.orderIndex, col.width; }); // remove EntityFieldInfo from the column settings
391
- tempGridState.columnSettings = tempColSettings;
392
- tempGridState.sortSettings = this._newGridState.sortSettings ? this._newGridState.sortSettings : tempGridState.sortSettings;
393
- // now stringify the grid state and save it
394
- this._viewEntity.Set('GridState', JSON.stringify(tempGridState));
395
- const newSortState = tempGridState.sortSettings.map((s) => { return { field: s.field, direction: s.dir }; });
396
- const oldSortState = JSON.parse(this._viewEntity.Get('SortState'));
397
- this._viewEntity.Set('SortState', JSON.stringify(newSortState));
398
- if (yield this._viewEntity.Save()) {
399
- // check to see if sort state changed and if so, refresh the grid
400
- if (JSON.stringify(newSortState) !== JSON.stringify(oldSortState)) {
401
- if (this.Params) // makes sure we have params before we refresh
402
- this.Refresh(this.Params);
403
- }
404
- this._viewDirty = false;
405
- }
406
- else {
407
- this.CreateSimpleNotification('Unable to save view settings', 'error', 5000);
408
- }
409
- }
410
- }
411
- });
412
- }
413
- CreateSimpleNotification(message, style, duration) {
414
- const data = {
415
- message: message,
416
- style: style,
417
- DisplayDuration: duration
418
- };
419
- MJGlobal.Instance.RaiseEvent({
420
- component: this,
421
- event: MJEventType.DisplaySimpleNotificationRequest,
422
- eventCode: "",
423
- args: data
424
- });
425
- }
426
- columnReorder(args) {
427
- return __awaiter(this, void 0, void 0, function* () {
428
- // Remove the column from the original position
429
- // need to find the column in the viewColumns array because args.old/new Indexes are from the visibleColumns array
430
- const fieldName = args.column.field;
431
- if (fieldName) {
432
- const vcOldIndex = this.viewColumns.findIndex((vc) => vc.Name === fieldName);
433
- const vcNewIndex = this.viewColumns.findIndex((vc) => vc.orderIndex === args.newIndex);
434
- if (vcOldIndex >= 0) {
435
- // got the index, now remove the element
436
- const element = this.viewColumns.splice(vcOldIndex, 1)[0];
437
- // Insert it at the new position
438
- this.viewColumns.splice(vcNewIndex, 0, element);
439
- // go through all of the columns and set orderIndex as that isn't done automatically
440
- let visColIndex = 0;
441
- for (let i = 0; i < this.viewColumns.length; i++) {
442
- if (!this.viewColumns[i].hidden) {
443
- this.viewColumns[i].orderIndex = visColIndex;
444
- visColIndex++;
445
- }
446
- }
447
- // 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
448
- for (let i = 0; i < this.viewColumns.length; i++) {
449
- if (this.viewColumns[i].hidden) {
450
- this.viewColumns[i].orderIndex = visColIndex;
451
- visColIndex++;
452
- }
453
- }
454
- // make sure that _newGridState.columnSettings is set
455
- this._newGridState.columnSettings = this.viewColumns;
456
- this._viewDirty = true;
457
- this.SaveView();
458
- }
459
- }
460
- });
461
- }
462
- columnResize(args) {
463
- return __awaiter(this, void 0, void 0, function* () {
464
- for (const col of args) {
465
- const c = col.column;
466
- const viewCol = this.viewColumns.find(vc => vc.Name === c.field);
467
- const visCol = this.visibleColumns.find(vc => vc.Name === c.field);
468
- const visCols = this.visibleColumns;
469
- if (viewCol)
470
- viewCol.width = col.newWidth;
471
- }
472
- this._newGridState.columnSettings = this.viewColumns.map(vc => {
473
- return {
474
- Name: vc.Name,
475
- DisplayName: vc.DisplayName,
476
- width: vc.width,
477
- orderIndex: vc.orderIndex,
478
- hidden: vc.hidden
479
- };
480
- });
481
- this._viewDirty = true;
482
- this.SaveView();
483
- });
484
- }
485
- sortChanged(sort) {
486
- return __awaiter(this, void 0, void 0, function* () {
487
- if (sort && sort.length > 0) {
488
- // remove any sort settings that don't have a direction
489
- const filterSort = sort.filter((s) => s.dir !== undefined && s.dir !== null && s.dir !== "");
490
- this._newGridState.sortSettings = filterSort;
491
- }
492
- else
493
- this._newGridState.sortSettings = sort;
494
- this.sortSettings = this._newGridState.sortSettings; // for the UI display - grid binding to this shows that the sort is applied via arrows in the column headers
495
- if (this.IsDynamicView()) {
496
- // Dynamic View, we have this.Params and can add an OrderBy and then just Refresh() the entire component
497
- // that will result in going to the server for a refreshed set of data
498
- if (this.Params) {
499
- this.Params.OrderBy = sort[0].field + ' ' + (sort[0].dir);
500
- this.Refresh(this.Params);
501
- }
502
- else {
503
- LogError("sortChanged() called but this.Params is null or undefined"); // should never get here
504
- }
505
- }
506
- else {
507
- // Saved view - we do this on the server side only
508
- this._viewDirty = true;
509
- this.innerSaveView(); // for sort changes we call innerSaveView() directly, not through SaveView() which is debounced
510
- }
511
- });
512
- }
513
- cellClickHandler(args) {
514
- return __awaiter(this, void 0, void 0, function* () {
515
- if (this.compareMode || this.mergeMode)
516
- return;
517
- if (this._entityInfo) {
518
- const pkeyVals = [];
519
- this._entityInfo.PrimaryKeys.forEach((pkey) => {
520
- pkeyVals.push({ FieldName: pkey.Name, Value: this.viewData[args.rowIndex][pkey.Name] });
521
- });
522
- this.rowClicked.emit({
523
- entityId: this._entityInfo.ID,
524
- entityName: this._entityInfo.Name,
525
- primaryKeyValues: pkeyVals
526
- });
527
- if (this._entityInfo.AllowUpdateAPI &&
528
- this.EditMode !== "None") {
529
- const perm = this._entityInfo.GetUserPermisions(new Metadata().CurrentUser);
530
- if (perm.CanUpdate) {
531
- this.StartEditMode();
532
- args.sender.editCell(args.rowIndex, args.columnIndex, this.createFormGroup(args.dataItem));
533
- }
534
- }
535
- if (!this.InEditMode && this.AutoNavigate) {
536
- // tell app router to go to this record
537
- const pkVals = this.GeneratePrimaryKeyValueString(pkeyVals);
538
- this.router.navigate(['resource', 'record', pkVals], { queryParams: { Entity: this._entityInfo.Name } });
539
- }
540
- }
541
- });
542
- }
543
- GeneratePrimaryKeyValueString(pkVals) {
544
- return pkVals.length > 1 ? pkVals.map(pk => pk.FieldName + '|' + pk.Value).join('||') : pkVals[0].Value;
545
- }
546
- createFormGroup(dataItem) {
547
- const groupFields = {};
548
- this.viewColumns.forEach((vc) => {
549
- if (vc.EntityField.AllowUpdateAPI &&
550
- vc.EntityField.IsVirtual === false &&
551
- vc.EntityField.AllowUpdateInView)
552
- groupFields[vc.Name] = dataItem[vc.Name];
553
- });
554
- return this.formBuilder.group(groupFields);
555
- }
556
- getEditor(ef) {
557
- switch (ef.TSType) {
558
- case EntityFieldTSType.Boolean:
559
- return "boolean";
560
- case EntityFieldTSType.Date:
561
- return "date";
562
- case EntityFieldTSType.Number:
563
- return "numeric";
564
- default:
565
- return "text";
566
- }
567
- }
568
- cellCloseHandler(args) {
569
- var _a;
570
- return __awaiter(this, void 0, void 0, function* () {
571
- try {
572
- if (this._entityInfo && this.EditMode !== "None") {
573
- const { formGroup, dataItem } = args;
574
- if (!formGroup.valid) {
575
- // prevent closing the edited cell if there are invalid values.
576
- args.preventDefault();
577
- }
578
- else if (formGroup.dirty) {
579
- if (args.originalEvent && args.originalEvent.keyCode === Keys.Escape)
580
- return; // user hit escape, so don't save their changes
581
- // update the data item with the new values - this drives UI refresh while we save the record...
582
- Object.assign(dataItem, formGroup.value);
583
- const md = new Metadata();
584
- const pkey = this._entityInfo.PrimaryKey.Name;
585
- let record;
586
- let bSaved = false;
587
- if (this.EditMode === "Save") {
588
- record = yield md.GetEntityObject(this._entityInfo.Name);
589
- yield record.InnerLoad(this._entityInfo.PrimaryKeys.map(pk => {
590
- return {
591
- FieldName: pk.Name,
592
- Value: dataItem[pk.Name]
593
- };
594
- }));
595
- record.SetMany(formGroup.value);
596
- bSaved = yield record.Save();
597
- if (!bSaved)
598
- this.CreateSimpleNotification("Error saving record: " + record.Get(pkey), 'error', 5000);
599
- }
600
- else {
601
- record = (_a = this._pendingRecords.find((r) => r.record.Get(pkey) === dataItem[pkey])) === null || _a === void 0 ? void 0 : _a.record;
602
- if (!record) { // haven't edited this one before
603
- record = yield md.GetEntityObject(this._viewEntity.Get('Entity'));
604
- yield record.InnerLoad(this._entityInfo.PrimaryKeys.map(pk => {
605
- return {
606
- FieldName: pk.Name,
607
- Value: dataItem[pk.Name]
608
- };
609
- }));
610
- this._pendingRecords.push({ record,
611
- row: args.rowIndex,
612
- dataItem }); // don't save - put the changed record on a queue for saving later by our container
613
- }
614
- // go through the formGroup and only set the values that exist as columns in the grid
615
- const keys = Object.keys(formGroup.value);
616
- keys.forEach((k) => {
617
- const vc = this.viewColumns.find((vc) => vc.Name === k && vc.hidden === false);
618
- if (vc) {
619
- record.Set(k, formGroup.value[k]);
620
- }
621
- });
622
- //record.SetMany(formGroup.value);
623
- }
624
- this.rowEdited.emit({
625
- record: record,
626
- row: args.rowIndex,
627
- saved: bSaved
628
- });
629
- }
630
- }
631
- }
632
- catch (e) {
633
- console.error(e);
634
- }
635
- finally {
636
- this.EndEditMode();
637
- }
638
- });
639
- }
640
- // this handles reverting pending cahnges to records WITHIN the grid, not the user view settings, unrelated to that.
641
- RevertPendingChanges() {
642
- if (this._pendingRecords && this._pendingRecords.length > 0) {
643
- this._pendingRecords.forEach((r) => {
644
- r.record.Revert();
645
- 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...
646
- });
647
- this._pendingRecords = [];
648
- if (this.Params)
649
- this.Refresh(this.Params);
650
- }
651
- }
652
- ngOnInit() {
653
- }
654
- ngAfterViewInit() {
655
- //this.setGridHeight();
656
- if (this.Params)
657
- this.Refresh(this.Params);
658
- }
659
- get AllowLoad() {
660
- return this._allowLoad;
661
- }
662
- set AllowLoad(value) {
663
- this._allowLoad = value;
664
- if (value === true && this._deferLoadCount === 0) {
665
- this._deferLoadCount++; // only do this one time
666
- if (this.Params)
667
- this.Refresh(this.Params);
668
- return;
669
- }
670
- }
671
- RefreshFromSavedParams() {
672
- return __awaiter(this, void 0, void 0, function* () {
673
- if (this.Params)
674
- this.Refresh(this.Params);
675
- });
676
- }
677
- Refresh(params) {
678
- var _a, _b, _c;
679
- return __awaiter(this, void 0, void 0, function* () {
680
- this.Params = params;
681
- if (this.AllowLoad === false) {
682
- return;
683
- }
684
- if (params && (params.ViewEntity || params.ViewID || params.ViewName || (params.EntityName && params.ExtraFilter))) {
685
- const startTime = new Date().getTime();
686
- this.isLoading = true;
687
- const md = new Metadata();
688
- const rv = new RunView();
689
- // 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
690
- // this is done for performance purposes
691
- if (params.ViewEntity) {
692
- // 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
693
- this._viewEntity = params.ViewEntity;
694
- const e = md.Entities.find(x => { var _a; return x.ID === ((_a = this._viewEntity) === null || _a === void 0 ? void 0 : _a.EntityID); });
695
- if (e)
696
- this._entityInfo = e;
697
- else
698
- throw new Error("Unable to get entity info for view: " + ((_a = this._viewEntity) === null || _a === void 0 ? void 0 : _a.Name));
699
- }
700
- else if (!params.ViewEntity && (params.ViewID || params.ViewName)) {
701
- // this is NOT a dyamic view as we got either the ViewID or ViewName, so we can get the ViewEntity
702
- if (params.ViewID && params.ViewID > 0) {
703
- this._viewEntity = (yield ViewInfo.GetViewEntity(params.ViewID));
704
- }
705
- else if (params.ViewName) {
706
- this._viewEntity = (yield ViewInfo.GetViewEntityByName(params.ViewName));
707
- }
708
- params.ViewEntity = this._viewEntity;
709
- const e = md.Entities.find(x => { var _a; return x.ID === ((_a = this._viewEntity) === null || _a === void 0 ? void 0 : _a.EntityID); });
710
- if (e)
711
- this._entityInfo = e;
712
- else
713
- throw new Error("Unable to get entity info for view: " + ((_b = this._viewEntity) === null || _b === void 0 ? void 0 : _b.Name));
714
- }
715
- else if (params.EntityName) {
716
- // 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
717
- const e = md.Entities.find(x => x.Name === params.EntityName);
718
- if (e)
719
- this._entityInfo = e;
720
- }
721
- else
722
- throw new Error("Invalid configuration, we need to receive either a ViewEntity, ViewID, ViewName, or EntityName and ExtraFilter in order to run a view");
723
- const rvResult = yield rv.RunView(params);
724
- if (!rvResult.Success) {
725
- // it failed
726
- this.CreateSimpleNotification("Error running view:\n\n" + rvResult.ErrorMessage, 'error', 5000);
727
- }
728
- else {
729
- // it worked
730
- this.viewData = rvResult.Results;
731
- this.totalRowCount = rvResult.TotalRowCount;
732
- this.formattedData = new Array(this.viewData.length);
733
- let cols;
734
- if (this._viewEntity)
735
- cols = this._viewEntity.Columns;
736
- else
737
- cols = (_c = this._entityInfo) === null || _c === void 0 ? void 0 : _c.Fields.filter((f) => f.DefaultInView).map((f) => {
738
- return {
739
- ID: f.ID,
740
- Name: f.Name,
741
- DisplayName: f.DisplayName,
742
- EntityField: f,
743
- hidden: false,
744
- orderIndex: f.Sequence,
745
- width: f.DefaultColumnWidth ? f.DefaultColumnWidth : 100,
746
- };
747
- });
748
- if (cols) {
749
- this.viewColumns = cols;
750
- const tempCols = cols.filter(x => x.hidden === false).sort((a, b) => {
751
- const aOrder = a.orderIndex != null ? a.orderIndex : 9999;
752
- const bOrder = b.orderIndex != null ? b.orderIndex : 9999;
753
- return aOrder - bOrder;
754
- });
755
- this.visibleColumns = tempCols;
756
- }
757
- // sorting setup
758
- if (this._viewEntity) {
759
- const temp = this._viewEntity.ViewSortInfo;
760
- const kendoSortSettings = temp.map((s) => {
761
- let dir;
762
- if (typeof s.direction === 'string')
763
- dir = s.direction.trim().toLowerCase();
764
- else if (typeof s.direction === 'number' && s.direction === 1)
765
- dir = 'asc';
766
- else if (typeof s.direction === 'number' && s.direction === 2)
767
- dir = 'desc';
768
- else
769
- dir = '';
770
- return { field: s.field, dir: dir };
771
- });
772
- this.sortSettings = kendoSortSettings;
773
- }
774
- this.skip = 0;
775
- this.virtualLoadData();
776
- }
777
- this.viewExecutionTime = (new Date().getTime() - startTime) / 1000; // in seconds
778
- this.isLoading = false;
779
- }
780
- else {
781
- LogError("Refresh(params) must have ViewID or ViewName or (EntityName and ExtraFilter)");
782
- }
783
- });
784
- }
785
- GetColumnTitle(col) {
786
- if (col.DisplayName)
787
- return col.DisplayName; // use view's display name first if it exists
788
- else if (col.EntityField.DisplayName)
789
- return col.EntityField.DisplayName; // then use entity display name, if that exist
790
- else
791
- return col.Name; // otherwise just use the column name
792
- }
793
- GetColumnCellStyle(col) {
794
- switch (col.EntityField.Type.trim().toLowerCase()) {
795
- case "money":
796
- case 'decimal':
797
- case 'real':
798
- case 'float':
799
- case 'int':
800
- return { 'text-align': 'right', 'vertical-align': 'top' }; // right align numbers,
801
- default:
802
- return { 'text-align': 'left', 'vertical-align': 'top' }; // left align everything else
803
- }
804
- }
805
- selectionChange(args) {
806
- // update recordsToCompare based on the this.selectedKeys property that is bound
807
- // selectedKeys is an array of indexes in the this.viewData, and we need to make our
808
- // this.recordsToCompare an array of records from this.viewData so just map() the selectedKeys for this
809
- this.recordsToCompare = this.selectedKeys.map((i) => this.viewData[i]);
810
- }
811
- enableMergeOrCompare(cancel = false, type) {
812
- if (!cancel && this.recordsToCompare.length >= 2) {
813
- // this scenario occurs when we've already started the merge/compare and the user has selected records, then clicked the merge/compare button again
814
- this.isCompareDialogOpened = true;
815
- }
816
- else if (cancel) {
817
- // the user clicked cancel in our toolbar
818
- if (type === 'merge')
819
- this.mergeMode = false;
820
- else
821
- this.compareMode = false;
822
- this.selectedKeys = [];
823
- this.recordsToCompare = [];
824
- }
825
- else {
826
- // just turning on merge mode from the merge/compare button, so just turn it on and let the user select records
827
- if (type === 'merge')
828
- this.mergeMode = true;
829
- else
830
- this.compareMode = true;
831
- }
832
- }
833
- closeConfirmMergeDialog(event) {
834
- return __awaiter(this, void 0, void 0, function* () {
835
- if (event === 'yes') {
836
- if (this._entityInfo && this.recordCompareComponent) {
837
- const md = new Metadata();
838
- const pkey = this._entityInfo.PrimaryKey.Name;
839
- const result = yield md.MergeRecords({
840
- EntityName: this._entityInfo.Name,
841
- RecordsToMerge: this.recordsToCompare.map((r) => r.Get(pkey)).filter((pkeyVal) => { var _a; return pkeyVal !== ((_a = this.recordCompareComponent) === null || _a === void 0 ? void 0 : _a.selectedRecordPKeyVal); }),
842
- SurvivingRecordPrimaryKeyValues: [{ FieldName: pkey, Value: this.recordCompareComponent.selectedRecordPKeyVal }],
843
- FieldMap: this.recordCompareComponent.fieldMap.map((fm) => {
844
- return {
845
- FieldName: fm.fieldName,
846
- Value: fm.value
847
- };
848
- })
849
- });
850
- if (result.Success) {
851
- // merge was successful, so refresh the grid
852
- this.selectedKeys = [];
853
- this.recordsToCompare = [];
854
- this.mergeMode = false;
855
- this.compareMode = false;
856
- // close the dialogs
857
- this.isCompareDialogOpened = false;
858
- this.isConfirmDialogOpen = false;
859
- // refresh the grid
860
- this.Refresh(this.Params);
861
- }
862
- else {
863
- // the merge failed, so show an error message
864
- this.isConfirmDialogOpen = false;
865
- this.CreateSimpleNotification("Error merging records: " + result.OverallStatus, 'error', 5000);
866
- }
867
- }
868
- }
869
- else {
870
- this.isConfirmDialogOpen = false;
871
- // close the dialog and let the user continue to work on the merge, so don't close the compare dialog
872
- }
873
- });
874
- }
875
- closeCompareDialog(event) {
876
- return __awaiter(this, void 0, void 0, function* () {
877
- console.log(event);
878
- switch (event) {
879
- case 'merge':
880
- // user has requested to merge the records and retain the selected record from the compare records component, so run the merge
881
- // first, confirm with the user to make 100% sure they want to do this as it is irreversible
882
- this.isConfirmDialogOpen = true;
883
- break;
884
- default: // close and cancel
885
- this.selectedKeys = [];
886
- this.recordsToCompare = [];
887
- this.mergeMode = false;
888
- this.compareMode = false;
889
- this.isCompareDialogOpened = false;
890
- break;
891
- }
892
- });
893
- }
894
- doExcelExport() {
895
- return __awaiter(this, void 0, void 0, function* () {
896
- if (this.kendoExcelExport === null)
897
- throw new Error("kendoExcelExport is null, cannot export data");
898
- try {
899
- this.CreateSimpleNotification("Working on the export, will notify you when it is complete...", 'info', 2000);
900
- const data = yield this.getExportData();
901
- // we have the data.
902
- const cols = this.viewColumns.filter((vc) => vc.hidden === false);
903
- this.exportColumns = cols;
904
- this.exportData = data;
905
- // before we call the save, we need to let Angular do its thing that will result in the kendoExcelExport component binding properly to
906
- // the exportColumns and exportData arrays. So we wait for the next tick before we call save()
907
- setTimeout(() => {
908
- this.kendoExcelExport.save();
909
- this.CreateSimpleNotification("Excel Export Complete", 'success', 2000);
910
- }, 100);
911
- }
912
- catch (e) {
913
- this.CreateSimpleNotification("Error exporting data", 'error', 5000);
914
- LogError(e);
915
- }
916
- });
917
- }
918
- getExportData() {
919
- return __awaiter(this, void 0, void 0, function* () {
920
- // Get the data for the ENTIRE view, not just the current page
921
- const md = new Metadata();
922
- const rv = new RunView();
923
- 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}` });
924
- const result = yield rv.RunView(p);
925
- if (result && result.Success) {
926
- return result.Results;
927
- }
928
- else
929
- throw new Error("Unable to get export data");
930
- });
931
- }
932
- }
933
- UserViewGridComponent.ɵfac = function UserViewGridComponent_Factory(t) { return new (t || UserViewGridComponent)(i0.ɵɵdirectiveInject(i1.FormBuilder), i0.ɵɵdirectiveInject(i2.Router)); };
934
- UserViewGridComponent.ɵcmp = /*@__PURE__*/ i0.ɵɵdefineComponent({ type: UserViewGridComponent, selectors: [["mj-user-view-grid"]], viewQuery: function UserViewGridComponent_Query(rf, ctx) { if (rf & 1) {
935
- i0.ɵɵviewQuery(_c0, 5, GridComponent);
936
- i0.ɵɵviewQuery(_c0, 5, ElementRef);
937
- i0.ɵɵviewQuery(_c1, 5, ExcelExportComponent);
938
- i0.ɵɵviewQuery(_c2, 5);
939
- } if (rf & 2) {
940
- let _t;
941
- i0.ɵɵqueryRefresh(_t = i0.ɵɵloadQuery()) && (ctx.kendoGridElement = _t.first);
942
- i0.ɵɵqueryRefresh(_t = i0.ɵɵloadQuery()) && (ctx.kendoGridElementRef = _t.first);
943
- i0.ɵɵqueryRefresh(_t = i0.ɵɵloadQuery()) && (ctx.kendoExcelExport = _t.first);
944
- i0.ɵɵqueryRefresh(_t = i0.ɵɵloadQuery()) && (ctx.recordCompareComponent = _t.first);
945
- } }, 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"], ["title", "Confirm Choice", 3, "minWidth", "width", "close", 4, "ngIf"], ["kendoButton", "", "type", "button", 3, "click"], ["kendoButton", "", "themeColor", "primary", "type", "button", 3, "click"], ["title", "Confirm Choice", 3, "minWidth", "width", "close"], [2, "margin", "30px", "text-align", "center"], ["kendoButton", "", 3, "click"], ["kendoButton", "", "themeColor", "primary", 3, "click"]], template: function UserViewGridComponent_Template(rf, ctx) { if (rf & 1) {
946
- i0.ɵɵelementStart(0, "div", 0)(1, "kendo-grid", 1, 2);
947
- 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); });
948
- i0.ɵɵtemplate(3, UserViewGridComponent_ng_template_3_Template, 8, 8, "ng-template", 3);
949
- i0.ɵɵtemplate(4, UserViewGridComponent_kendo_grid_checkbox_column_4_Template, 1, 6, "kendo-grid-checkbox-column", 4);
950
- i0.ɵɵtemplate(5, UserViewGridComponent_kendo_grid_column_5_Template, 2, 10, "kendo-grid-column", 5);
951
- i0.ɵɵelementStart(6, "kendo-excelexport", 6, 7);
952
- i0.ɵɵtemplate(8, UserViewGridComponent_kendo_excelexport_column_8_Template, 1, 2, "kendo-excelexport-column", 8);
953
- i0.ɵɵelementEnd()()();
954
- i0.ɵɵtemplate(9, UserViewGridComponent_div_9_Template, 3, 1, "div", 9);
955
- } if (rf & 2) {
956
- i0.ɵɵadvance(1);
957
- 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);
958
- i0.ɵɵadvance(3);
959
- i0.ɵɵproperty("ngIf", ctx.compareMode || ctx.mergeMode);
960
- i0.ɵɵadvance(1);
961
- i0.ɵɵproperty("ngForOf", ctx.visibleColumns);
962
- i0.ɵɵadvance(1);
963
- i0.ɵɵproperty("data", ctx.exportData)("fileName", (ctx._viewEntity ? ctx._viewEntity.Get("Name") : ctx._entityInfo == null ? null : ctx._entityInfo.Name) + ".xlsx");
964
- i0.ɵɵadvance(2);
965
- i0.ɵɵproperty("ngForOf", ctx.exportColumns);
966
- i0.ɵɵadvance(1);
967
- i0.ɵɵproperty("ngIf", ctx.isCompareDialogOpened);
968
- } }, dependencies: [i3.NgForOf, i3.NgIf, i4.GridComponent, i4.ToolbarTemplateDirective, i4.SelectionDirective, i4.ColumnComponent, i4.FooterTemplateDirective, i4.CheckboxColumnComponent, i5.DialogComponent, i5.DialogActionsComponent, 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}"] });
969
- (function () { (typeof ngDevMode === "undefined" || ngDevMode) && i0.ɵsetClassMetadata(UserViewGridComponent, [{
970
- type: Component,
971
- 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)=\"enableMergeOrCompare(false, 'compare')\" *ngIf=\"!compareMode && !mergeMode\" [disabled]=\"compareMode && recordsToCompare.length < 2\" class=\"k-button k-button-md k-rounded-md k-button-solid-base k-button-solid\">Compare</button>\r\n <button (click)=\"enableMergeOrCompare(false, 'compare')\" *ngIf=\"compareMode\" [disabled]=\"compareMode && recordsToCompare.length < 2\" class=\"k-button k-button-md k-rounded-md k-button-solid-base k-button-solid\">Compare</button>\r\n <button (click)=\"enableMergeOrCompare(true, 'compare')\" *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)=\"enableMergeOrCompare(false, 'merge')\" *ngIf=\"mergeMode\" [disabled]=\"mergeMode && recordsToCompare.length < 2\" class=\"k-button k-button-md k-rounded-md k-button-solid-base k-button-solid\">Merge</button>\r\n <button (click)=\"enableMergeOrCompare(false, 'merge')\" *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)=\"enableMergeOrCompare(true, 'merge')\" *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]=\"recordsToCompare\" \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-dialog\r\n title=\"Confirm Choice\"\r\n *ngIf=\"isConfirmDialogOpen\"\r\n (close)=\"closeConfirmMergeDialog('cancel')\"\r\n [minWidth]=\"250\"\r\n [width]=\"450\"\r\n >\r\n <p style=\"margin: 30px; text-align: center;\">\r\n Are you sure you want to merge the records? This action cannot be undone. If you select \"Yes\", the records will be merged and the duplicate records will be deleted.\r\n </p>\r\n <kendo-dialog-actions>\r\n <button kendoButton (click)=\"closeConfirmMergeDialog('no')\">No</button>\r\n <button kendoButton (click)=\"closeConfirmMergeDialog('yes')\" themeColor=\"primary\">\r\n Yes\r\n </button>\r\n </kendo-dialog-actions>\r\n </kendo-dialog>\r\n </kendo-window>\r\n</div>", 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}"] }]
972
- }], function () { return [{ type: i1.FormBuilder }, { type: i2.Router }]; }, { Params: [{
973
- type: Input
974
- }], BottomMargin: [{
975
- type: Input
976
- }], InEditMode: [{
977
- type: Input
978
- }], EditMode: [{
979
- type: Input
980
- }], AutoNavigate: [{
981
- type: Input
982
- }], rowClicked: [{
983
- type: Output
984
- }], rowEdited: [{
985
- type: Output
986
- }], kendoGridElement: [{
987
- type: ViewChild,
988
- args: ['kendoGrid', { read: GridComponent }]
989
- }], kendoGridElementRef: [{
990
- type: ViewChild,
991
- args: ['kendoGrid', { read: ElementRef }]
992
- }], kendoExcelExport: [{
993
- type: ViewChild,
994
- args: ['excelExport', { read: ExcelExportComponent }]
995
- }], recordCompareComponent: [{
996
- type: ViewChild,
997
- args: ['recordCompareRef', { static: false }]
998
- }], AllowLoad: [{
999
- type: Input
1000
- }] }); })();
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, ViewContainerRef } 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 { SharedService, kendoSVGIcon } from '@memberjunction/ng-shared';
19
+ import { TextAreaComponent } from '@progress/kendo-angular-inputs';
20
+ import * as i0 from "@angular/core";
21
+ import * as i1 from "@angular/forms";
22
+ import * as i2 from "@angular/router";
23
+ import * as i3 from "@angular/common";
24
+ import * as i4 from "@progress/kendo-angular-grid";
25
+ import * as i5 from "@progress/kendo-angular-dialog";
26
+ import * as i6 from "@progress/kendo-angular-excel-export";
27
+ import * as i7 from "@progress/kendo-angular-buttons";
28
+ import * as i8 from "@memberjunction/ng-compare-records";
29
+ import * as i9 from "@memberjunction/ng-container-directives";
30
+ import * as i10 from "@progress/kendo-angular-icons";
31
+ import * as i11 from "@progress/kendo-angular-layout";
32
+ import * as i12 from "@memberjunction/ng-ask-skip";
33
+ const _c0 = ["kendoGrid"];
34
+ const _c1 = ["excelExport"];
35
+ const _c2 = ["recordCompareRef"];
36
+ const _c3 = ["analysisQuestion"];
37
+ const _c4 = ["analysisResults"];
38
+ const _c5 = ["plotContainer"];
39
+ function UserViewGridComponent_ng_template_3_Template(rf, ctx) { if (rf & 1) {
40
+ i0.ɵɵtext(0, "Data");
41
+ } }
42
+ function UserViewGridComponent_ng_template_4_ng_template_2_button_0_Template(rf, ctx) { if (rf & 1) {
43
+ const _r19 = i0.ɵɵgetCurrentView();
44
+ i0.ɵɵelementStart(0, "button", 18);
45
+ i0.ɵɵlistener("click", function UserViewGridComponent_ng_template_4_ng_template_2_button_0_Template_button_click_0_listener() { i0.ɵɵrestoreView(_r19); const ctx_r18 = i0.ɵɵnextContext(3); return i0.ɵɵresetView(ctx_r18.doExcelExport()); });
46
+ i0.ɵɵelement(1, "kendo-svgicon", 19);
47
+ i0.ɵɵtext(2, " Export to Excel ");
48
+ i0.ɵɵelementEnd();
49
+ } if (rf & 2) {
50
+ const ctx_r10 = i0.ɵɵnextContext(3);
51
+ i0.ɵɵadvance();
52
+ i0.ɵɵproperty("icon", ctx_r10.kendoSVGIcon("fileExcel"));
53
+ } }
54
+ function UserViewGridComponent_ng_template_4_ng_template_2_button_1_Template(rf, ctx) { if (rf & 1) {
55
+ const _r21 = i0.ɵɵgetCurrentView();
56
+ i0.ɵɵelementStart(0, "button", 20);
57
+ i0.ɵɵlistener("click", function UserViewGridComponent_ng_template_4_ng_template_2_button_1_Template_button_click_0_listener() { i0.ɵɵrestoreView(_r21); const ctx_r20 = i0.ɵɵnextContext(3); return i0.ɵɵresetView(ctx_r20.enableMergeOrCompare(false, "compare")); });
58
+ i0.ɵɵtext(1, "Compare");
59
+ i0.ɵɵelementEnd();
60
+ } if (rf & 2) {
61
+ const ctx_r11 = i0.ɵɵnextContext(3);
62
+ i0.ɵɵproperty("disabled", ctx_r11.compareMode && ctx_r11.recordsToCompare.length < 2);
63
+ } }
64
+ function UserViewGridComponent_ng_template_4_ng_template_2_button_2_Template(rf, ctx) { if (rf & 1) {
65
+ const _r23 = i0.ɵɵgetCurrentView();
66
+ i0.ɵɵelementStart(0, "button", 20);
67
+ i0.ɵɵlistener("click", function UserViewGridComponent_ng_template_4_ng_template_2_button_2_Template_button_click_0_listener() { i0.ɵɵrestoreView(_r23); const ctx_r22 = i0.ɵɵnextContext(3); return i0.ɵɵresetView(ctx_r22.enableMergeOrCompare(false, "compare")); });
68
+ i0.ɵɵtext(1, "Compare");
69
+ i0.ɵɵelementEnd();
70
+ } if (rf & 2) {
71
+ const ctx_r12 = i0.ɵɵnextContext(3);
72
+ i0.ɵɵproperty("disabled", ctx_r12.compareMode && ctx_r12.recordsToCompare.length < 2);
73
+ } }
74
+ function UserViewGridComponent_ng_template_4_ng_template_2_button_3_Template(rf, ctx) { if (rf & 1) {
75
+ const _r25 = i0.ɵɵgetCurrentView();
76
+ i0.ɵɵelementStart(0, "button", 21);
77
+ i0.ɵɵlistener("click", function UserViewGridComponent_ng_template_4_ng_template_2_button_3_Template_button_click_0_listener() { i0.ɵɵrestoreView(_r25); const ctx_r24 = i0.ɵɵnextContext(3); return i0.ɵɵresetView(ctx_r24.enableMergeOrCompare(true, "compare")); });
78
+ i0.ɵɵtext(1, "Cancel");
79
+ i0.ɵɵelementEnd();
80
+ } }
81
+ function UserViewGridComponent_ng_template_4_ng_template_2_button_4_Template(rf, ctx) { if (rf & 1) {
82
+ const _r27 = i0.ɵɵgetCurrentView();
83
+ i0.ɵɵelementStart(0, "button", 20);
84
+ i0.ɵɵlistener("click", function UserViewGridComponent_ng_template_4_ng_template_2_button_4_Template_button_click_0_listener() { i0.ɵɵrestoreView(_r27); const ctx_r26 = i0.ɵɵnextContext(3); return i0.ɵɵresetView(ctx_r26.enableMergeOrCompare(false, "merge")); });
85
+ i0.ɵɵtext(1, "Merge");
86
+ i0.ɵɵelementEnd();
87
+ } if (rf & 2) {
88
+ const ctx_r14 = i0.ɵɵnextContext(3);
89
+ i0.ɵɵproperty("disabled", ctx_r14.mergeMode && ctx_r14.recordsToCompare.length < 2);
90
+ } }
91
+ function UserViewGridComponent_ng_template_4_ng_template_2_button_5_Template(rf, ctx) { if (rf & 1) {
92
+ const _r29 = i0.ɵɵgetCurrentView();
93
+ i0.ɵɵelementStart(0, "button", 21);
94
+ i0.ɵɵlistener("click", function UserViewGridComponent_ng_template_4_ng_template_2_button_5_Template_button_click_0_listener() { i0.ɵɵrestoreView(_r29); const ctx_r28 = i0.ɵɵnextContext(3); return i0.ɵɵresetView(ctx_r28.enableMergeOrCompare(false, "merge")); });
95
+ i0.ɵɵtext(1, "Merge");
96
+ i0.ɵɵelementEnd();
97
+ } }
98
+ function UserViewGridComponent_ng_template_4_ng_template_2_button_6_Template(rf, ctx) { if (rf & 1) {
99
+ const _r31 = i0.ɵɵgetCurrentView();
100
+ i0.ɵɵelementStart(0, "button", 21);
101
+ i0.ɵɵlistener("click", function UserViewGridComponent_ng_template_4_ng_template_2_button_6_Template_button_click_0_listener() { i0.ɵɵrestoreView(_r31); const ctx_r30 = i0.ɵɵnextContext(3); return i0.ɵɵresetView(ctx_r30.enableMergeOrCompare(true, "merge")); });
102
+ i0.ɵɵtext(1, "Cancel");
103
+ i0.ɵɵelementEnd();
104
+ } }
105
+ function UserViewGridComponent_ng_template_4_ng_template_2_button_7_Template(rf, ctx) { if (rf & 1) {
106
+ const _r33 = i0.ɵɵgetCurrentView();
107
+ i0.ɵɵelementStart(0, "button", 22);
108
+ i0.ɵɵlistener("click", function UserViewGridComponent_ng_template_4_ng_template_2_button_7_Template_button_click_0_listener() { i0.ɵɵrestoreView(_r33); const ctx_r32 = i0.ɵɵnextContext(3); return i0.ɵɵresetView(ctx_r32.RefreshFromSavedParams()); });
109
+ i0.ɵɵelement(1, "kendo-svgicon", 19);
110
+ i0.ɵɵtext(2, " Refresh ");
111
+ i0.ɵɵelementEnd();
112
+ } if (rf & 2) {
113
+ const ctx_r17 = i0.ɵɵnextContext(3);
114
+ i0.ɵɵproperty("primary", true);
115
+ i0.ɵɵadvance();
116
+ i0.ɵɵproperty("icon", ctx_r17.kendoSVGIcon("arrowRotateCcwSmall"));
117
+ } }
118
+ function UserViewGridComponent_ng_template_4_ng_template_2_Template(rf, ctx) { if (rf & 1) {
119
+ i0.ɵɵtemplate(0, UserViewGridComponent_ng_template_4_ng_template_2_button_0_Template, 3, 1, "button", 14)(1, UserViewGridComponent_ng_template_4_ng_template_2_button_1_Template, 2, 1, "button", 15)(2, UserViewGridComponent_ng_template_4_ng_template_2_button_2_Template, 2, 1, "button", 15)(3, UserViewGridComponent_ng_template_4_ng_template_2_button_3_Template, 2, 0, "button", 16)(4, UserViewGridComponent_ng_template_4_ng_template_2_button_4_Template, 2, 1, "button", 15)(5, UserViewGridComponent_ng_template_4_ng_template_2_button_5_Template, 2, 0, "button", 16)(6, UserViewGridComponent_ng_template_4_ng_template_2_button_6_Template, 2, 0, "button", 16)(7, UserViewGridComponent_ng_template_4_ng_template_2_button_7_Template, 3, 2, "button", 17);
120
+ } if (rf & 2) {
121
+ const ctx_r5 = i0.ɵɵnextContext(2);
122
+ i0.ɵɵproperty("ngIf", !ctx_r5.compareMode && !ctx_r5.mergeMode);
123
+ i0.ɵɵadvance();
124
+ i0.ɵɵproperty("ngIf", !ctx_r5.compareMode && !ctx_r5.mergeMode);
125
+ i0.ɵɵadvance();
126
+ i0.ɵɵproperty("ngIf", ctx_r5.compareMode);
127
+ i0.ɵɵadvance();
128
+ i0.ɵɵproperty("ngIf", ctx_r5.compareMode);
129
+ i0.ɵɵadvance();
130
+ i0.ɵɵproperty("ngIf", ctx_r5.mergeMode);
131
+ i0.ɵɵadvance();
132
+ i0.ɵɵproperty("ngIf", !ctx_r5.mergeMode && !ctx_r5.compareMode);
133
+ i0.ɵɵadvance();
134
+ i0.ɵɵproperty("ngIf", ctx_r5.mergeMode);
135
+ i0.ɵɵadvance();
136
+ i0.ɵɵproperty("ngIf", ctx_r5.showRefreshButton && !ctx_r5.compareMode && !ctx_r5.mergeMode);
137
+ } }
138
+ const _c6 = () => ({ "text-align": "center", "vertical-align": "center" });
139
+ const _c7 = () => ({ "font-weight": "bold", "background-color": "#a9c2af" });
140
+ function UserViewGridComponent_ng_template_4_kendo_grid_checkbox_column_3_Template(rf, ctx) { if (rf & 1) {
141
+ i0.ɵɵelement(0, "kendo-grid-checkbox-column", 23);
142
+ } if (rf & 2) {
143
+ i0.ɵɵstyleMap(i0.ɵɵpureFunction0(4, _c6));
144
+ i0.ɵɵproperty("width", 50)("headerStyle", i0.ɵɵpureFunction0(5, _c7));
145
+ } }
146
+ function UserViewGridComponent_ng_template_4_kendo_grid_column_4_1_ng_template_0_Template(rf, ctx) { if (rf & 1) {
147
+ i0.ɵɵtext(0);
148
+ i0.ɵɵpipe(1, "number");
149
+ i0.ɵɵpipe(2, "number");
150
+ i0.ɵɵelement(3, "br");
151
+ i0.ɵɵelementStart(4, "span", 26);
152
+ i0.ɵɵtext(5);
153
+ i0.ɵɵpipe(6, "number");
154
+ i0.ɵɵelementEnd();
155
+ } if (rf & 2) {
156
+ const ctx_r36 = i0.ɵɵnextContext(4);
157
+ i0.ɵɵtextInterpolate2(" ", i0.ɵɵpipeBind1(1, 3, ctx_r36.viewData.length), "", ctx_r36.totalRowCount > ctx_r36.viewData.length ? " of " + i0.ɵɵpipeBind1(2, 5, ctx_r36.totalRowCount) : " rows", "");
158
+ i0.ɵɵadvance(5);
159
+ i0.ɵɵtextInterpolate1("", i0.ɵɵpipeBind2(6, 7, ctx_r36.viewExecutionTime, "1.2-2"), " seconds");
160
+ } }
161
+ function UserViewGridComponent_ng_template_4_kendo_grid_column_4_1_Template(rf, ctx) { if (rf & 1) {
162
+ i0.ɵɵtemplate(0, UserViewGridComponent_ng_template_4_kendo_grid_column_4_1_ng_template_0_Template, 7, 10, "ng-template", 25);
163
+ } }
164
+ function UserViewGridComponent_ng_template_4_kendo_grid_column_4_Template(rf, ctx) { if (rf & 1) {
165
+ i0.ɵɵelementStart(0, "kendo-grid-column", 24);
166
+ i0.ɵɵtemplate(1, UserViewGridComponent_ng_template_4_kendo_grid_column_4_1_Template, 1, 0, null, 5);
167
+ i0.ɵɵelementEnd();
168
+ } if (rf & 2) {
169
+ const item_r34 = ctx.$implicit;
170
+ const ctx_r7 = i0.ɵɵnextContext(2);
171
+ i0.ɵɵstyleMap(ctx_r7.GetColumnCellStyle(item_r34));
172
+ i0.ɵɵproperty("field", item_r34.Name)("title", ctx_r7.GetColumnTitle(item_r34))("width", item_r34.width ? item_r34.width : 100)("editable", item_r34.EntityField.AllowUpdateAPI)("editor", ctx_r7.getEditor(item_r34.EntityField))("headerStyle", i0.ɵɵpureFunction0(9, _c7));
173
+ i0.ɵɵadvance();
174
+ i0.ɵɵproperty("ngIf", item_r34 === ctx_r7.visibleColumns[0]);
175
+ } }
176
+ function UserViewGridComponent_ng_template_4_kendo_excelexport_column_7_Template(rf, ctx) { if (rf & 1) {
177
+ i0.ɵɵelement(0, "kendo-excelexport-column", 27);
178
+ } if (rf & 2) {
179
+ const exportCol_r37 = ctx.$implicit;
180
+ i0.ɵɵproperty("field", exportCol_r37.Name)("title", exportCol_r37.Name);
181
+ } }
182
+ function UserViewGridComponent_ng_template_4_Template(rf, ctx) { if (rf & 1) {
183
+ const _r39 = i0.ɵɵgetCurrentView();
184
+ i0.ɵɵelementStart(0, "kendo-grid", 6, 7);
185
+ i0.ɵɵlistener("pageChange", function UserViewGridComponent_ng_template_4_Template_kendo_grid_pageChange_0_listener($event) { i0.ɵɵrestoreView(_r39); const ctx_r38 = i0.ɵɵnextContext(); return i0.ɵɵresetView(ctx_r38.pageChange($event)); })("selectedKeysChange", function UserViewGridComponent_ng_template_4_Template_kendo_grid_selectedKeysChange_0_listener($event) { i0.ɵɵrestoreView(_r39); const ctx_r40 = i0.ɵɵnextContext(); return i0.ɵɵresetView(ctx_r40.selectedKeys = $event); })("cellClick", function UserViewGridComponent_ng_template_4_Template_kendo_grid_cellClick_0_listener($event) { i0.ɵɵrestoreView(_r39); const ctx_r41 = i0.ɵɵnextContext(); return i0.ɵɵresetView(ctx_r41.cellClickHandler($event)); })("cellClose", function UserViewGridComponent_ng_template_4_Template_kendo_grid_cellClose_0_listener($event) { i0.ɵɵrestoreView(_r39); const ctx_r42 = i0.ɵɵnextContext(); return i0.ɵɵresetView(ctx_r42.cellCloseHandler($event)); })("columnReorder", function UserViewGridComponent_ng_template_4_Template_kendo_grid_columnReorder_0_listener($event) { i0.ɵɵrestoreView(_r39); const ctx_r43 = i0.ɵɵnextContext(); return i0.ɵɵresetView(ctx_r43.columnReorder($event)); })("columnResize", function UserViewGridComponent_ng_template_4_Template_kendo_grid_columnResize_0_listener($event) { i0.ɵɵrestoreView(_r39); const ctx_r44 = i0.ɵɵnextContext(); return i0.ɵɵresetView(ctx_r44.columnResize($event)); })("selectionChange", function UserViewGridComponent_ng_template_4_Template_kendo_grid_selectionChange_0_listener($event) { i0.ɵɵrestoreView(_r39); const ctx_r45 = i0.ɵɵnextContext(); return i0.ɵɵresetView(ctx_r45.selectionChange($event)); })("sortChange", function UserViewGridComponent_ng_template_4_Template_kendo_grid_sortChange_0_listener($event) { i0.ɵɵrestoreView(_r39); const ctx_r46 = i0.ɵɵnextContext(); return i0.ɵɵresetView(ctx_r46.sortChanged($event)); });
186
+ i0.ɵɵtemplate(2, UserViewGridComponent_ng_template_4_ng_template_2_Template, 8, 8, "ng-template", 8)(3, UserViewGridComponent_ng_template_4_kendo_grid_checkbox_column_3_Template, 1, 6, "kendo-grid-checkbox-column", 9)(4, UserViewGridComponent_ng_template_4_kendo_grid_column_4_Template, 2, 10, "kendo-grid-column", 10);
187
+ i0.ɵɵelementStart(5, "kendo-excelexport", 11, 12);
188
+ i0.ɵɵtemplate(7, UserViewGridComponent_ng_template_4_kendo_excelexport_column_7_Template, 1, 2, "kendo-excelexport-column", 13);
189
+ i0.ɵɵelementEnd()();
190
+ } if (rf & 2) {
191
+ const ctx_r1 = i0.ɵɵnextContext();
192
+ i0.ɵɵproperty("resizable", true)("data", ctx_r1.gridView)("skip", ctx_r1.skip)("pageSize", ctx_r1.pageSize)("rowHeight", 36)("loading", ctx_r1.isLoading)("height", ctx_r1.gridHeight)("sortable", true)("sort", ctx_r1.sortSettings)("resizable", true)("reorderable", true)("selectable", true)("selectedKeys", ctx_r1.selectedKeys);
193
+ i0.ɵɵadvance(3);
194
+ i0.ɵɵproperty("ngIf", ctx_r1.compareMode || ctx_r1.mergeMode);
195
+ i0.ɵɵadvance();
196
+ i0.ɵɵproperty("ngForOf", ctx_r1.visibleColumns);
197
+ i0.ɵɵadvance();
198
+ i0.ɵɵproperty("data", ctx_r1.exportData)("fileName", (ctx_r1._viewEntity ? ctx_r1._viewEntity.Get("Name") : ctx_r1._entityInfo == null ? null : ctx_r1._entityInfo.Name) + ".xlsx");
199
+ i0.ɵɵadvance(2);
200
+ i0.ɵɵproperty("ngForOf", ctx_r1.exportColumns);
201
+ } }
202
+ function UserViewGridComponent_kendo_tabstrip_tab_5_ng_template_1_Template(rf, ctx) { if (rf & 1) {
203
+ i0.ɵɵtext(0, "Analysis");
204
+ } }
205
+ function UserViewGridComponent_kendo_tabstrip_tab_5_ng_template_2_Template(rf, ctx) { if (rf & 1) {
206
+ i0.ɵɵelement(0, "mj-ask-skip", 28);
207
+ } if (rf & 2) {
208
+ const ctx_r48 = i0.ɵɵnextContext(2);
209
+ i0.ɵɵproperty("AllowNewConversations", false)("ShowConversationList", false)("UpdateAppRoute", false)("ViewID", ctx_r48.ViewID)("LinkedEntity", "User Views")("LinkedEntityRecordID", ctx_r48.ViewID);
210
+ } }
211
+ function UserViewGridComponent_kendo_tabstrip_tab_5_Template(rf, ctx) { if (rf & 1) {
212
+ i0.ɵɵelementStart(0, "kendo-tabstrip-tab");
213
+ i0.ɵɵtemplate(1, UserViewGridComponent_kendo_tabstrip_tab_5_ng_template_1_Template, 1, 0, "ng-template", 3)(2, UserViewGridComponent_kendo_tabstrip_tab_5_ng_template_2_Template, 1, 6, "ng-template", 4);
214
+ i0.ɵɵelementEnd();
215
+ } }
216
+ function UserViewGridComponent_div_6_kendo_window_2_button_6_Template(rf, ctx) { if (rf & 1) {
217
+ const _r56 = i0.ɵɵgetCurrentView();
218
+ i0.ɵɵelementStart(0, "button", 39);
219
+ i0.ɵɵlistener("click", function UserViewGridComponent_div_6_kendo_window_2_button_6_Template_button_click_0_listener() { i0.ɵɵrestoreView(_r56); const ctx_r55 = i0.ɵɵnextContext(3); return i0.ɵɵresetView(ctx_r55.closeCompareDialog("close")); });
220
+ i0.ɵɵtext(1, "Close");
221
+ i0.ɵɵelementEnd();
222
+ } }
223
+ function UserViewGridComponent_div_6_kendo_window_2_button_7_Template(rf, ctx) { if (rf & 1) {
224
+ const _r58 = i0.ɵɵgetCurrentView();
225
+ i0.ɵɵelementStart(0, "button", 39);
226
+ i0.ɵɵlistener("click", function UserViewGridComponent_div_6_kendo_window_2_button_7_Template_button_click_0_listener() { i0.ɵɵrestoreView(_r58); const ctx_r57 = i0.ɵɵnextContext(3); return i0.ɵɵresetView(ctx_r57.closeCompareDialog("cancel")); });
227
+ i0.ɵɵtext(1, "Cancel");
228
+ i0.ɵɵelementEnd();
229
+ } }
230
+ function UserViewGridComponent_div_6_kendo_window_2_button_8_Template(rf, ctx) { if (rf & 1) {
231
+ const _r60 = i0.ɵɵgetCurrentView();
232
+ i0.ɵɵelementStart(0, "button", 40);
233
+ i0.ɵɵlistener("click", function UserViewGridComponent_div_6_kendo_window_2_button_8_Template_button_click_0_listener() { i0.ɵɵrestoreView(_r60); const ctx_r59 = i0.ɵɵnextContext(3); return i0.ɵɵresetView(ctx_r59.closeCompareDialog("merge")); });
234
+ i0.ɵɵtext(1, " Merge Records ");
235
+ i0.ɵɵelementEnd();
236
+ } }
237
+ function UserViewGridComponent_div_6_kendo_window_2_kendo_dialog_9_Template(rf, ctx) { if (rf & 1) {
238
+ const _r62 = i0.ɵɵgetCurrentView();
239
+ i0.ɵɵelementStart(0, "kendo-dialog", 41);
240
+ i0.ɵɵlistener("close", function UserViewGridComponent_div_6_kendo_window_2_kendo_dialog_9_Template_kendo_dialog_close_0_listener() { i0.ɵɵrestoreView(_r62); const ctx_r61 = i0.ɵɵnextContext(3); return i0.ɵɵresetView(ctx_r61.closeConfirmMergeDialog("cancel")); });
241
+ i0.ɵɵelementStart(1, "p", 42);
242
+ i0.ɵɵtext(2, " Are you sure you want to merge the records? This action cannot be undone. If you select \"Yes\", the records will be merged and the duplicate records will be deleted. ");
243
+ i0.ɵɵelementEnd();
244
+ i0.ɵɵelementStart(3, "kendo-dialog-actions")(4, "button", 18);
245
+ i0.ɵɵlistener("click", function UserViewGridComponent_div_6_kendo_window_2_kendo_dialog_9_Template_button_click_4_listener() { i0.ɵɵrestoreView(_r62); const ctx_r63 = i0.ɵɵnextContext(3); return i0.ɵɵresetView(ctx_r63.closeConfirmMergeDialog("no")); });
246
+ i0.ɵɵtext(5, "No");
247
+ i0.ɵɵelementEnd();
248
+ i0.ɵɵelementStart(6, "button", 43);
249
+ i0.ɵɵlistener("click", function UserViewGridComponent_div_6_kendo_window_2_kendo_dialog_9_Template_button_click_6_listener() { i0.ɵɵrestoreView(_r62); const ctx_r64 = i0.ɵɵnextContext(3); return i0.ɵɵresetView(ctx_r64.closeConfirmMergeDialog("yes")); });
250
+ i0.ɵɵtext(7, " Yes ");
251
+ i0.ɵɵelementEnd()()();
252
+ } if (rf & 2) {
253
+ i0.ɵɵproperty("minWidth", 250)("width", 450);
254
+ } }
255
+ function UserViewGridComponent_div_6_kendo_window_2_Template(rf, ctx) { if (rf & 1) {
256
+ const _r66 = i0.ɵɵgetCurrentView();
257
+ i0.ɵɵelementStart(0, "kendo-window", 31);
258
+ i0.ɵɵlistener("close", function UserViewGridComponent_div_6_kendo_window_2_Template_kendo_window_close_0_listener($event) { i0.ɵɵrestoreView(_r66); const ctx_r65 = i0.ɵɵnextContext(2); return i0.ɵɵresetView(ctx_r65.closeCompareDialog($event)); });
259
+ i0.ɵɵelementStart(1, "div", 32)(2, "div");
260
+ i0.ɵɵelement(3, "mj-compare-records", 33, 34);
261
+ i0.ɵɵelementEnd()();
262
+ i0.ɵɵelementStart(5, "div", 35);
263
+ i0.ɵɵtemplate(6, UserViewGridComponent_div_6_kendo_window_2_button_6_Template, 2, 0, "button", 36)(7, UserViewGridComponent_div_6_kendo_window_2_button_7_Template, 2, 0, "button", 36)(8, UserViewGridComponent_div_6_kendo_window_2_button_8_Template, 2, 0, "button", 37);
264
+ i0.ɵɵelementEnd();
265
+ i0.ɵɵtemplate(9, UserViewGridComponent_div_6_kendo_window_2_kendo_dialog_9_Template, 8, 2, "kendo-dialog", 38);
266
+ i0.ɵɵelementEnd();
267
+ } if (rf & 2) {
268
+ const ctx_r49 = i0.ɵɵnextContext(2);
269
+ i0.ɵɵproperty("minHeight", 300)("minWidth", 400)("resizable", true);
270
+ i0.ɵɵadvance(3);
271
+ i0.ɵɵproperty("entityName", ctx_r49._entityInfo ? ctx_r49._entityInfo.Name : "")("recordsToCompare", ctx_r49.recordsToCompare)("visibleColumns", ctx_r49.visibleColumns)("selectionMode", ctx_r49.mergeMode ? true : false);
272
+ i0.ɵɵadvance(3);
273
+ i0.ɵɵproperty("ngIf", ctx_r49.compareMode);
274
+ i0.ɵɵadvance();
275
+ i0.ɵɵproperty("ngIf", ctx_r49.mergeMode);
276
+ i0.ɵɵadvance();
277
+ i0.ɵɵproperty("ngIf", ctx_r49.mergeMode);
278
+ i0.ɵɵadvance();
279
+ i0.ɵɵproperty("ngIf", ctx_r49.isConfirmDialogOpen);
280
+ } }
281
+ function UserViewGridComponent_div_6_Template(rf, ctx) { if (rf & 1) {
282
+ i0.ɵɵelementStart(0, "div");
283
+ i0.ɵɵelement(1, "div", 29);
284
+ i0.ɵɵtemplate(2, UserViewGridComponent_div_6_kendo_window_2_Template, 10, 11, "kendo-window", 30);
285
+ i0.ɵɵelementEnd();
286
+ } if (rf & 2) {
287
+ const ctx_r3 = i0.ɵɵnextContext();
288
+ i0.ɵɵadvance(2);
289
+ i0.ɵɵproperty("ngIf", ctx_r3.isCompareDialogOpened);
290
+ } }
291
+ export class UserViewGridComponent {
292
+ get PendingRecords() {
293
+ return this._pendingRecords;
294
+ }
295
+ get ViewID() {
296
+ if (this.Params && this.Params.ViewID)
297
+ return this.Params.ViewID;
298
+ else
299
+ return 0;
300
+ }
301
+ StartEditMode() {
302
+ this.InEditMode = true;
303
+ }
304
+ EndEditMode() {
305
+ this.InEditMode = false;
306
+ this.editModeEnded.next();
307
+ }
308
+ EditingComplete() {
309
+ if (this.InEditMode) {
310
+ // we need to wait for edit mode to end before we can return true
311
+ return new Promise((resolve, reject) => {
312
+ const subscription = this.editModeEnded.subscribe(() => {
313
+ resolve(true);
314
+ subscription.unsubscribe();
315
+ });
316
+ });
317
+ }
318
+ else
319
+ return Promise.resolve(true); // not in edit mode, so editing is complete!
320
+ }
321
+ IsDynamicView() {
322
+ return !this._viewEntity; // if we have a viewEntity it is a stored view
323
+ }
324
+ pageChange(event) {
325
+ this.skip = event.skip;
326
+ this.virtualLoadData();
327
+ }
328
+ virtualLoadData() {
329
+ // check to see if we have already formatted the slice of the data we need right now
330
+ // we are storing the formattted data in the formattedData array and it has same set
331
+ // of indexes as the viewData array (raw unformatted data). When we first get viewData
332
+ // from the server we create an array of the same length as viewData, but have nulls in all of the
333
+ // indexes. As we format each row of viewData we store the formatted row in the same index
334
+ // in the formattedData array. So if we have already formatted the data we need for the current
335
+ // page, we just use that data, otherwise we format the data we need for the current page
336
+ try {
337
+ // check to see if we have already formatted the data we need for the current page
338
+ for (let i = this.skip; (i < (this.skip + this.pageSize)) && (i < this.viewData.length); i++) {
339
+ if (!this.formattedData[i]) {
340
+ // we have not formatted this row yet, so format it
341
+ const r = this.viewColumns.map((c) => {
342
+ if (c && c.EntityField && this.viewData[i] && this.viewData[i][c.EntityField.Name]) {
343
+ if (!c.hidden && c.EntityField.Name !== 'ID') {
344
+ const ef = c.EntityField;
345
+ return { field: c.EntityField.Name, value: ef.FormatValue(this.viewData[i][c.EntityField.Name], 0, undefined, 300) };
346
+ }
347
+ else
348
+ return { field: c.EntityField.Name, value: this.viewData[i][c.EntityField.Name] }; // hidden column, so just return the value, don't bother formatting
349
+ }
350
+ else
351
+ return { field: c.Name, value: null };
352
+ });
353
+ // now r is an array of {field: string, value: any} objects, so we need to convert it to an object
354
+ // with the field names as the keys and the values as the values
355
+ const row = {};
356
+ for (let j = 0; j < r.length; j++) {
357
+ if (r[j] && r[j].field && r[j].field.length > 0)
358
+ row[r[j].field] = r[j].value;
359
+ }
360
+ this.formattedData[i] = row;
361
+ }
362
+ }
363
+ // now that we have made sure current page of data is formatted, we can return it
364
+ this.gridView = {
365
+ data: this.formattedData.slice(this.skip, this.skip + this.pageSize),
366
+ total: this.viewData.length,
367
+ };
368
+ }
369
+ catch (e) {
370
+ LogError(e);
371
+ }
372
+ }
373
+ constructor(formBuilder, router) {
374
+ this.formBuilder = formBuilder;
375
+ this.router = router;
376
+ this.title = 'UserViewGrid';
377
+ this.BottomMargin = 0;
378
+ this.InEditMode = false;
379
+ this.EditMode = "None";
380
+ this.AutoNavigate = true;
381
+ this.rowClicked = new EventEmitter();
382
+ this.rowEdited = new EventEmitter();
383
+ this.kendoGridElement = null;
384
+ this.kendoGridElementRef = null;
385
+ this.kendoExcelExport = null;
386
+ this.recordCompareComponent = null;
387
+ this.analysisQuestion = null;
388
+ this.analysisResults = null;
389
+ this._pendingRecords = [];
390
+ this.viewData = [];
391
+ this.totalRowCount = 0;
392
+ this.formattedData = [];
393
+ this.viewColumns = [];
394
+ this.visibleColumns = [];
395
+ this.sortSettings = [];
396
+ this.entityRecord = null;
397
+ this.skip = 0;
398
+ this.pageSize = 40;
399
+ this.isLoading = false;
400
+ this.gridView = { data: [], total: 0 };
401
+ this.gridHeight = 750;
402
+ this._newGridState = {};
403
+ // public plotData = [];
404
+ // public plotLayout: any = {};
405
+ this.editModeEnded = new Subject();
406
+ this.recordsToCompare = [];
407
+ this.compareMode = false;
408
+ // public compareRecords: BaseEntity[] = [];
409
+ this.mergeMode = false;
410
+ // public mergeRecords: BaseEntity[] = [];
411
+ this.selectableSettings = {
412
+ enabled: false
413
+ };
414
+ this.selectedKeys = [];
415
+ this.isCompareDialogOpened = false;
416
+ this.isConfirmDialogOpen = false;
417
+ this.showRefreshButton = true;
418
+ this.viewExecutionTime = 0;
419
+ this._viewDirty = false;
420
+ this._deferLoadCount = 0;
421
+ this._allowLoad = true;
422
+ // Export Functionality
423
+ this.exportColumns = [];
424
+ this.exportData = [];
425
+ this.kendoSVGIcon = kendoSVGIcon;
426
+ }
427
+ SaveView() {
428
+ // debounced outer function...
429
+ clearTimeout(this._saveTimeout);
430
+ this._saveTimeout = setTimeout(() => __awaiter(this, void 0, void 0, function* () {
431
+ // when we actually call inner save view we do await
432
+ yield this.innerSaveView();
433
+ }), 5000); // 5 seconds delay
434
+ }
435
+ ;
436
+ innerSaveView() {
437
+ return __awaiter(this, void 0, void 0, function* () {
438
+ if (this._viewDirty) {
439
+ const md = new Metadata();
440
+ if (this._viewEntity &&
441
+ this._viewEntity.Get('UserID') === md.CurrentUser.ID) {
442
+ // this view is a saved view, AND it belongs to the current user
443
+ // update the grid state if we have settings updates for columns and/or sorts
444
+ const tempGridState = JSON.parse(this._viewEntity.Get('GridState'));
445
+ const tempColSettings = this._newGridState.columnSettings ? this._newGridState.columnSettings : tempGridState.columnSettings;
446
+ tempColSettings.forEach((col) => { col.DisplayName, col.ID, col.Name, col.hidden, col.orderIndex, col.width; }); // remove EntityFieldInfo from the column settings
447
+ tempGridState.columnSettings = tempColSettings;
448
+ tempGridState.sortSettings = this._newGridState.sortSettings ? this._newGridState.sortSettings : tempGridState.sortSettings;
449
+ // now stringify the grid state and save it
450
+ this._viewEntity.Set('GridState', JSON.stringify(tempGridState));
451
+ const newSortState = tempGridState.sortSettings.map((s) => { return { field: s.field, direction: s.dir }; });
452
+ const oldSortState = JSON.parse(this._viewEntity.Get('SortState'));
453
+ this._viewEntity.Set('SortState', JSON.stringify(newSortState));
454
+ if (yield this._viewEntity.Save()) {
455
+ // check to see if sort state changed and if so, refresh the grid
456
+ if (JSON.stringify(newSortState) !== JSON.stringify(oldSortState)) {
457
+ if (this.Params) // makes sure we have params before we refresh
458
+ this.Refresh(this.Params);
459
+ }
460
+ this._viewDirty = false;
461
+ }
462
+ else {
463
+ this.CreateSimpleNotification('Unable to save view settings', 'error', 5000);
464
+ }
465
+ }
466
+ }
467
+ });
468
+ }
469
+ CreateSimpleNotification(message, style, duration) {
470
+ const data = {
471
+ message: message,
472
+ style: style,
473
+ DisplayDuration: duration
474
+ };
475
+ MJGlobal.Instance.RaiseEvent({
476
+ component: this,
477
+ event: MJEventType.DisplaySimpleNotificationRequest,
478
+ eventCode: "",
479
+ args: data
480
+ });
481
+ }
482
+ columnReorder(args) {
483
+ return __awaiter(this, void 0, void 0, function* () {
484
+ // Remove the column from the original position
485
+ // need to find the column in the viewColumns array because args.old/new Indexes are from the visibleColumns array
486
+ const fieldName = args.column.field;
487
+ if (fieldName) {
488
+ const vcOldIndex = this.viewColumns.findIndex((vc) => vc.Name === fieldName);
489
+ const vcNewIndex = this.viewColumns.findIndex((vc) => vc.orderIndex === args.newIndex);
490
+ if (vcOldIndex >= 0) {
491
+ // got the index, now remove the element
492
+ const element = this.viewColumns.splice(vcOldIndex, 1)[0];
493
+ // Insert it at the new position
494
+ this.viewColumns.splice(vcNewIndex, 0, element);
495
+ // go through all of the columns and set orderIndex as that isn't done automatically
496
+ let visColIndex = 0;
497
+ for (let i = 0; i < this.viewColumns.length; i++) {
498
+ if (!this.viewColumns[i].hidden) {
499
+ this.viewColumns[i].orderIndex = visColIndex;
500
+ visColIndex++;
501
+ }
502
+ }
503
+ // 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
504
+ for (let i = 0; i < this.viewColumns.length; i++) {
505
+ if (this.viewColumns[i].hidden) {
506
+ this.viewColumns[i].orderIndex = visColIndex;
507
+ visColIndex++;
508
+ }
509
+ }
510
+ // make sure that _newGridState.columnSettings is set
511
+ this._newGridState.columnSettings = this.viewColumns;
512
+ this._viewDirty = true;
513
+ this.SaveView();
514
+ }
515
+ }
516
+ });
517
+ }
518
+ columnResize(args) {
519
+ return __awaiter(this, void 0, void 0, function* () {
520
+ for (const col of args) {
521
+ const c = col.column;
522
+ const viewCol = this.viewColumns.find(vc => vc.Name === c.field);
523
+ const visCol = this.visibleColumns.find(vc => vc.Name === c.field);
524
+ const visCols = this.visibleColumns;
525
+ if (viewCol)
526
+ viewCol.width = col.newWidth;
527
+ }
528
+ this._newGridState.columnSettings = this.viewColumns.map(vc => {
529
+ return {
530
+ Name: vc.Name,
531
+ DisplayName: vc.DisplayName,
532
+ width: vc.width,
533
+ orderIndex: vc.orderIndex,
534
+ hidden: vc.hidden
535
+ };
536
+ });
537
+ this._viewDirty = true;
538
+ this.SaveView();
539
+ });
540
+ }
541
+ sortChanged(sort) {
542
+ return __awaiter(this, void 0, void 0, function* () {
543
+ if (sort && sort.length > 0) {
544
+ // remove any sort settings that don't have a direction
545
+ const filterSort = sort.filter((s) => s.dir !== undefined && s.dir !== null && s.dir !== "");
546
+ this._newGridState.sortSettings = filterSort;
547
+ }
548
+ else
549
+ this._newGridState.sortSettings = sort;
550
+ this.sortSettings = this._newGridState.sortSettings; // for the UI display - grid binding to this shows that the sort is applied via arrows in the column headers
551
+ if (this.IsDynamicView()) {
552
+ // Dynamic View, we have this.Params and can add an OrderBy and then just Refresh() the entire component
553
+ // that will result in going to the server for a refreshed set of data
554
+ if (this.Params) {
555
+ this.Params.OrderBy = sort[0].field + ' ' + (sort[0].dir);
556
+ this.Refresh(this.Params);
557
+ }
558
+ else {
559
+ LogError("sortChanged() called but this.Params is null or undefined"); // should never get here
560
+ }
561
+ }
562
+ else {
563
+ // Saved view - we do this on the server side only
564
+ this._viewDirty = true;
565
+ this.innerSaveView(); // for sort changes we call innerSaveView() directly, not through SaveView() which is debounced
566
+ }
567
+ });
568
+ }
569
+ cellClickHandler(args) {
570
+ return __awaiter(this, void 0, void 0, function* () {
571
+ if (this.compareMode || this.mergeMode)
572
+ return;
573
+ if (this._entityInfo) {
574
+ const pkeyVals = [];
575
+ this._entityInfo.PrimaryKeys.forEach((pkey) => {
576
+ pkeyVals.push({ FieldName: pkey.Name, Value: this.viewData[args.rowIndex][pkey.Name] });
577
+ });
578
+ this.rowClicked.emit({
579
+ entityId: this._entityInfo.ID,
580
+ entityName: this._entityInfo.Name,
581
+ primaryKeyValues: pkeyVals
582
+ });
583
+ if (this._entityInfo.AllowUpdateAPI &&
584
+ this.EditMode !== "None") {
585
+ const perm = this._entityInfo.GetUserPermisions(new Metadata().CurrentUser);
586
+ if (perm.CanUpdate) {
587
+ this.StartEditMode();
588
+ args.sender.editCell(args.rowIndex, args.columnIndex, this.createFormGroup(args.dataItem));
589
+ }
590
+ }
591
+ if (!this.InEditMode && this.AutoNavigate) {
592
+ // tell app router to go to this record
593
+ const pkVals = this.GeneratePrimaryKeyValueString(pkeyVals);
594
+ this.router.navigate(['resource', 'record', pkVals], { queryParams: { Entity: this._entityInfo.Name } });
595
+ }
596
+ }
597
+ });
598
+ }
599
+ GeneratePrimaryKeyValueString(pkVals) {
600
+ return pkVals.length > 1 ? pkVals.map(pk => pk.FieldName + '|' + pk.Value).join('||') : pkVals[0].Value;
601
+ }
602
+ createFormGroup(dataItem) {
603
+ const groupFields = {};
604
+ this.viewColumns.forEach((vc) => {
605
+ if (vc.EntityField.AllowUpdateAPI &&
606
+ vc.EntityField.IsVirtual === false &&
607
+ vc.EntityField.AllowUpdateInView)
608
+ groupFields[vc.Name] = dataItem[vc.Name];
609
+ });
610
+ return this.formBuilder.group(groupFields);
611
+ }
612
+ getEditor(ef) {
613
+ switch (ef.TSType) {
614
+ case EntityFieldTSType.Boolean:
615
+ return "boolean";
616
+ case EntityFieldTSType.Date:
617
+ return "date";
618
+ case EntityFieldTSType.Number:
619
+ return "numeric";
620
+ default:
621
+ return "text";
622
+ }
623
+ }
624
+ cellCloseHandler(args) {
625
+ var _a;
626
+ return __awaiter(this, void 0, void 0, function* () {
627
+ try {
628
+ if (this._entityInfo && this.EditMode !== "None") {
629
+ const { formGroup, dataItem } = args;
630
+ if (!formGroup.valid) {
631
+ // prevent closing the edited cell if there are invalid values.
632
+ args.preventDefault();
633
+ }
634
+ else if (formGroup.dirty) {
635
+ if (args.originalEvent && args.originalEvent.keyCode === Keys.Escape)
636
+ return; // user hit escape, so don't save their changes
637
+ // update the data item with the new values - this drives UI refresh while we save the record...
638
+ Object.assign(dataItem, formGroup.value);
639
+ const md = new Metadata();
640
+ const pkey = this._entityInfo.PrimaryKey.Name;
641
+ let record;
642
+ let bSaved = false;
643
+ if (this.EditMode === "Save") {
644
+ record = yield md.GetEntityObject(this._entityInfo.Name);
645
+ yield record.InnerLoad(this._entityInfo.PrimaryKeys.map(pk => {
646
+ return {
647
+ FieldName: pk.Name,
648
+ Value: dataItem[pk.Name]
649
+ };
650
+ }));
651
+ record.SetMany(formGroup.value);
652
+ bSaved = yield record.Save();
653
+ if (!bSaved)
654
+ this.CreateSimpleNotification("Error saving record: " + record.Get(pkey), 'error', 5000);
655
+ }
656
+ else {
657
+ record = (_a = this._pendingRecords.find((r) => r.record.Get(pkey) === dataItem[pkey])) === null || _a === void 0 ? void 0 : _a.record;
658
+ if (!record) { // haven't edited this one before
659
+ record = yield md.GetEntityObject(this._viewEntity.Get('Entity'));
660
+ yield record.InnerLoad(this._entityInfo.PrimaryKeys.map(pk => {
661
+ return {
662
+ FieldName: pk.Name,
663
+ Value: dataItem[pk.Name]
664
+ };
665
+ }));
666
+ this._pendingRecords.push({ record,
667
+ row: args.rowIndex,
668
+ dataItem }); // don't save - put the changed record on a queue for saving later by our container
669
+ }
670
+ // go through the formGroup and only set the values that exist as columns in the grid
671
+ const keys = Object.keys(formGroup.value);
672
+ keys.forEach((k) => {
673
+ const vc = this.viewColumns.find((vc) => vc.Name === k && vc.hidden === false);
674
+ if (vc) {
675
+ record.Set(k, formGroup.value[k]);
676
+ }
677
+ });
678
+ //record.SetMany(formGroup.value);
679
+ }
680
+ this.rowEdited.emit({
681
+ record: record,
682
+ row: args.rowIndex,
683
+ saved: bSaved
684
+ });
685
+ }
686
+ }
687
+ }
688
+ catch (e) {
689
+ console.error(e);
690
+ }
691
+ finally {
692
+ this.EndEditMode();
693
+ }
694
+ });
695
+ }
696
+ // this handles reverting pending cahnges to records WITHIN the grid, not the user view settings, unrelated to that.
697
+ RevertPendingChanges() {
698
+ if (this._pendingRecords && this._pendingRecords.length > 0) {
699
+ this._pendingRecords.forEach((r) => {
700
+ r.record.Revert();
701
+ 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...
702
+ });
703
+ this._pendingRecords = [];
704
+ if (this.Params)
705
+ this.Refresh(this.Params);
706
+ }
707
+ }
708
+ ngOnInit() {
709
+ }
710
+ ngAfterViewInit() {
711
+ //this.setGridHeight();
712
+ if (this.Params)
713
+ this.Refresh(this.Params);
714
+ }
715
+ get AllowLoad() {
716
+ return this._allowLoad;
717
+ }
718
+ set AllowLoad(value) {
719
+ this._allowLoad = value;
720
+ if (value === true && this._deferLoadCount === 0) {
721
+ this._deferLoadCount++; // only do this one time
722
+ if (this.Params)
723
+ this.Refresh(this.Params);
724
+ return;
725
+ }
726
+ }
727
+ RefreshFromSavedParams() {
728
+ return __awaiter(this, void 0, void 0, function* () {
729
+ if (this.Params)
730
+ this.Refresh(this.Params);
731
+ });
732
+ }
733
+ Refresh(params) {
734
+ var _a, _b, _c;
735
+ return __awaiter(this, void 0, void 0, function* () {
736
+ this.Params = params;
737
+ if (this.AllowLoad === false) {
738
+ return;
739
+ }
740
+ if (params && (params.ViewEntity || params.ViewID || params.ViewName || (params.EntityName && params.ExtraFilter))) {
741
+ const startTime = new Date().getTime();
742
+ this.isLoading = true;
743
+ const md = new Metadata();
744
+ const rv = new RunView();
745
+ // 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
746
+ // this is done for performance purposes
747
+ if (params.ViewEntity) {
748
+ // 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
749
+ this._viewEntity = params.ViewEntity;
750
+ const e = md.Entities.find(x => { var _a; return x.ID === ((_a = this._viewEntity) === null || _a === void 0 ? void 0 : _a.EntityID); });
751
+ if (e)
752
+ this._entityInfo = e;
753
+ else
754
+ throw new Error("Unable to get entity info for view: " + ((_a = this._viewEntity) === null || _a === void 0 ? void 0 : _a.Name));
755
+ }
756
+ else if (!params.ViewEntity && (params.ViewID || params.ViewName)) {
757
+ // this is NOT a dyamic view as we got either the ViewID or ViewName, so we can get the ViewEntity
758
+ if (params.ViewID && params.ViewID > 0) {
759
+ this._viewEntity = (yield ViewInfo.GetViewEntity(params.ViewID));
760
+ }
761
+ else if (params.ViewName) {
762
+ this._viewEntity = (yield ViewInfo.GetViewEntityByName(params.ViewName));
763
+ }
764
+ params.ViewEntity = this._viewEntity;
765
+ const e = md.Entities.find(x => { var _a; return x.ID === ((_a = this._viewEntity) === null || _a === void 0 ? void 0 : _a.EntityID); });
766
+ if (e)
767
+ this._entityInfo = e;
768
+ else
769
+ throw new Error("Unable to get entity info for view: " + ((_b = this._viewEntity) === null || _b === void 0 ? void 0 : _b.Name));
770
+ }
771
+ else if (params.EntityName) {
772
+ // 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
773
+ const e = md.Entities.find(x => x.Name === params.EntityName);
774
+ if (e)
775
+ this._entityInfo = e;
776
+ }
777
+ else
778
+ throw new Error("Invalid configuration, we need to receive either a ViewEntity, ViewID, ViewName, or EntityName and ExtraFilter in order to run a view");
779
+ const rvResult = yield rv.RunView(params);
780
+ if (!rvResult.Success) {
781
+ // it failed
782
+ this.CreateSimpleNotification("Error running view:\n\n" + rvResult.ErrorMessage, 'error', 5000);
783
+ }
784
+ else {
785
+ // it worked
786
+ this.viewData = rvResult.Results;
787
+ this.totalRowCount = rvResult.TotalRowCount;
788
+ this.formattedData = new Array(this.viewData.length);
789
+ let cols;
790
+ if (this._viewEntity)
791
+ cols = this._viewEntity.Columns;
792
+ else
793
+ cols = (_c = this._entityInfo) === null || _c === void 0 ? void 0 : _c.Fields.filter((f) => f.DefaultInView).map((f) => {
794
+ return {
795
+ ID: f.ID,
796
+ Name: f.Name,
797
+ DisplayName: f.DisplayName,
798
+ EntityField: f,
799
+ hidden: false,
800
+ orderIndex: f.Sequence,
801
+ width: f.DefaultColumnWidth ? f.DefaultColumnWidth : 100,
802
+ };
803
+ });
804
+ if (cols) {
805
+ this.viewColumns = cols;
806
+ const tempCols = cols.filter(x => x.hidden === false).sort((a, b) => {
807
+ const aOrder = a.orderIndex != null ? a.orderIndex : 9999;
808
+ const bOrder = b.orderIndex != null ? b.orderIndex : 9999;
809
+ return aOrder - bOrder;
810
+ });
811
+ this.visibleColumns = tempCols;
812
+ }
813
+ // sorting setup
814
+ if (this._viewEntity) {
815
+ const temp = this._viewEntity.ViewSortInfo;
816
+ const kendoSortSettings = temp.map((s) => {
817
+ let dir;
818
+ if (typeof s.direction === 'string')
819
+ dir = s.direction.trim().toLowerCase();
820
+ else if (typeof s.direction === 'number' && s.direction === 1)
821
+ dir = 'asc';
822
+ else if (typeof s.direction === 'number' && s.direction === 2)
823
+ dir = 'desc';
824
+ else
825
+ dir = '';
826
+ return { field: s.field, dir: dir };
827
+ });
828
+ this.sortSettings = kendoSortSettings;
829
+ }
830
+ this.skip = 0;
831
+ this.virtualLoadData();
832
+ }
833
+ this.viewExecutionTime = (new Date().getTime() - startTime) / 1000; // in seconds
834
+ this.isLoading = false;
835
+ }
836
+ else {
837
+ LogError("Refresh(params) must have ViewID or ViewName or (EntityName and ExtraFilter)");
838
+ }
839
+ });
840
+ }
841
+ GetColumnTitle(col) {
842
+ if (col.DisplayName)
843
+ return col.DisplayName; // use view's display name first if it exists
844
+ else if (col.EntityField.DisplayName)
845
+ return col.EntityField.DisplayName; // then use entity display name, if that exist
846
+ else
847
+ return col.Name; // otherwise just use the column name
848
+ }
849
+ GetColumnCellStyle(col) {
850
+ switch (col.EntityField.Type.trim().toLowerCase()) {
851
+ case "money":
852
+ case 'decimal':
853
+ case 'real':
854
+ case 'float':
855
+ case 'int':
856
+ return { 'text-align': 'right', 'vertical-align': 'top' }; // right align numbers,
857
+ default:
858
+ return { 'text-align': 'left', 'vertical-align': 'top' }; // left align everything else
859
+ }
860
+ }
861
+ selectionChange(args) {
862
+ // update recordsToCompare based on the this.selectedKeys property that is bound
863
+ // selectedKeys is an array of indexes in the this.viewData, and we need to make our
864
+ // this.recordsToCompare an array of records from this.viewData so just map() the selectedKeys for this
865
+ this.recordsToCompare = this.selectedKeys.map((i) => this.viewData[i]);
866
+ }
867
+ enableMergeOrCompare(cancel = false, type) {
868
+ if (!cancel && this.recordsToCompare.length >= 2) {
869
+ // this scenario occurs when we've already started the merge/compare and the user has selected records, then clicked the merge/compare button again
870
+ this.isCompareDialogOpened = true;
871
+ }
872
+ else if (cancel) {
873
+ // the user clicked cancel in our toolbar
874
+ if (type === 'merge')
875
+ this.mergeMode = false;
876
+ else
877
+ this.compareMode = false;
878
+ this.selectedKeys = [];
879
+ this.recordsToCompare = [];
880
+ }
881
+ else {
882
+ // just turning on merge mode from the merge/compare button, so just turn it on and let the user select records
883
+ if (type === 'merge')
884
+ this.mergeMode = true;
885
+ else
886
+ this.compareMode = true;
887
+ }
888
+ }
889
+ closeConfirmMergeDialog(event) {
890
+ return __awaiter(this, void 0, void 0, function* () {
891
+ if (event === 'yes') {
892
+ if (this._entityInfo && this.recordCompareComponent) {
893
+ const md = new Metadata();
894
+ const pkey = this._entityInfo.PrimaryKey.Name;
895
+ const result = yield md.MergeRecords({
896
+ EntityName: this._entityInfo.Name,
897
+ RecordsToMerge: this.recordsToCompare.map((r) => r.Get(pkey)).filter((pkeyVal) => { var _a; return pkeyVal !== ((_a = this.recordCompareComponent) === null || _a === void 0 ? void 0 : _a.selectedRecordPKeyVal); }),
898
+ SurvivingRecordPrimaryKeyValues: [{ FieldName: pkey, Value: this.recordCompareComponent.selectedRecordPKeyVal }],
899
+ FieldMap: this.recordCompareComponent.fieldMap.map((fm) => {
900
+ return {
901
+ FieldName: fm.fieldName,
902
+ Value: fm.value
903
+ };
904
+ })
905
+ });
906
+ if (result.Success) {
907
+ // merge was successful, so refresh the grid
908
+ this.selectedKeys = [];
909
+ this.recordsToCompare = [];
910
+ this.mergeMode = false;
911
+ this.compareMode = false;
912
+ // close the dialogs
913
+ this.isCompareDialogOpened = false;
914
+ this.isConfirmDialogOpen = false;
915
+ // refresh the grid
916
+ this.Refresh(this.Params);
917
+ }
918
+ else {
919
+ // the merge failed, so show an error message
920
+ this.isConfirmDialogOpen = false;
921
+ this.CreateSimpleNotification("Error merging records: " + result.OverallStatus, 'error', 5000);
922
+ }
923
+ }
924
+ }
925
+ else {
926
+ this.isConfirmDialogOpen = false;
927
+ // close the dialog and let the user continue to work on the merge, so don't close the compare dialog
928
+ }
929
+ });
930
+ }
931
+ closeCompareDialog(event) {
932
+ return __awaiter(this, void 0, void 0, function* () {
933
+ console.log(event);
934
+ switch (event) {
935
+ case 'merge':
936
+ // user has requested to merge the records and retain the selected record from the compare records component, so run the merge
937
+ // first, confirm with the user to make 100% sure they want to do this as it is irreversible
938
+ this.isConfirmDialogOpen = true;
939
+ break;
940
+ default: // close and cancel
941
+ this.selectedKeys = [];
942
+ this.recordsToCompare = [];
943
+ this.mergeMode = false;
944
+ this.compareMode = false;
945
+ this.isCompareDialogOpened = false;
946
+ break;
947
+ }
948
+ });
949
+ }
950
+ doExcelExport() {
951
+ return __awaiter(this, void 0, void 0, function* () {
952
+ if (this.kendoExcelExport === null)
953
+ throw new Error("kendoExcelExport is null, cannot export data");
954
+ try {
955
+ this.CreateSimpleNotification("Working on the export, will notify you when it is complete...", 'info', 2000);
956
+ const data = yield this.getExportData();
957
+ // we have the data.
958
+ const cols = this.viewColumns.filter((vc) => vc.hidden === false);
959
+ this.exportColumns = cols;
960
+ this.exportData = data;
961
+ // before we call the save, we need to let Angular do its thing that will result in the kendoExcelExport component binding properly to
962
+ // the exportColumns and exportData arrays. So we wait for the next tick before we call save()
963
+ setTimeout(() => {
964
+ this.kendoExcelExport.save();
965
+ this.CreateSimpleNotification("Excel Export Complete", 'success', 2000);
966
+ }, 100);
967
+ }
968
+ catch (e) {
969
+ this.CreateSimpleNotification("Error exporting data", 'error', 5000);
970
+ LogError(e);
971
+ }
972
+ });
973
+ }
974
+ getExportData() {
975
+ return __awaiter(this, void 0, void 0, function* () {
976
+ // Get the data for the ENTIRE view, not just the current page
977
+ const md = new Metadata();
978
+ const rv = new RunView();
979
+ 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}` });
980
+ const result = yield rv.RunView(p);
981
+ if (result && result.Success) {
982
+ return result.Results;
983
+ }
984
+ else
985
+ throw new Error("Unable to get export data");
986
+ });
987
+ }
988
+ selectTabHandler() {
989
+ SharedService.Instance.InvokeManualResize(100); // resize when the tab is clicked
990
+ }
991
+ }
992
+ UserViewGridComponent.ɵfac = function UserViewGridComponent_Factory(t) { return new (t || UserViewGridComponent)(i0.ɵɵdirectiveInject(i1.FormBuilder), i0.ɵɵdirectiveInject(i2.Router)); };
993
+ UserViewGridComponent.ɵcmp = /*@__PURE__*/ i0.ɵɵdefineComponent({ type: UserViewGridComponent, selectors: [["mj-user-view-grid"]], viewQuery: function UserViewGridComponent_Query(rf, ctx) { if (rf & 1) {
994
+ i0.ɵɵviewQuery(_c0, 5, GridComponent);
995
+ i0.ɵɵviewQuery(_c0, 5, ElementRef);
996
+ i0.ɵɵviewQuery(_c1, 5, ExcelExportComponent);
997
+ i0.ɵɵviewQuery(_c2, 5);
998
+ i0.ɵɵviewQuery(_c3, 5, TextAreaComponent);
999
+ i0.ɵɵviewQuery(_c4, 5, ElementRef);
1000
+ i0.ɵɵviewQuery(_c5, 5, ViewContainerRef);
1001
+ } if (rf & 2) {
1002
+ let _t;
1003
+ i0.ɵɵqueryRefresh(_t = i0.ɵɵloadQuery()) && (ctx.kendoGridElement = _t.first);
1004
+ i0.ɵɵqueryRefresh(_t = i0.ɵɵloadQuery()) && (ctx.kendoGridElementRef = _t.first);
1005
+ i0.ɵɵqueryRefresh(_t = i0.ɵɵloadQuery()) && (ctx.kendoExcelExport = _t.first);
1006
+ i0.ɵɵqueryRefresh(_t = i0.ɵɵloadQuery()) && (ctx.recordCompareComponent = _t.first);
1007
+ i0.ɵɵqueryRefresh(_t = i0.ɵɵloadQuery()) && (ctx.analysisQuestion = _t.first);
1008
+ i0.ɵɵqueryRefresh(_t = i0.ɵɵloadQuery()) && (ctx.analysisResults = _t.first);
1009
+ i0.ɵɵqueryRefresh(_t = i0.ɵɵloadQuery()) && (ctx.container = _t.first);
1010
+ } }, inputs: { Params: "Params", BottomMargin: "BottomMargin", InEditMode: "InEditMode", EditMode: "EditMode", AutoNavigate: "AutoNavigate", AllowLoad: "AllowLoad" }, outputs: { rowClicked: "rowClicked", rowEdited: "rowEdited" }, decls: 7, vars: 5, consts: [["mjFillContainer", "", 1, "user-view-grid-wrap"], ["mjFillContainer", "", 3, "keepTabContent", "animate", "tabSelect"], [3, "selected"], ["kendoTabTitle", ""], ["kendoTabContent", ""], [4, "ngIf"], ["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"], ["kendoButton", "", 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", "", 3, "primary", "click", 4, "ngIf"], ["kendoButton", "", 3, "click"], [3, "icon"], [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", "", 3, "primary", "click"], [3, "width", "headerStyle"], [3, "field", "title", "width", "editable", "editor", "headerStyle"], ["kendoGridFooterTemplate", ""], [2, "font-size", "smaller", "font-weight", "normal"], [3, "field", "title"], ["mjFillContainer", "", 3, "AllowNewConversations", "ShowConversationList", "UpdateAppRoute", "ViewID", "LinkedEntity", "LinkedEntityRecordID"], [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"], ["title", "Confirm Choice", 3, "minWidth", "width", "close", 4, "ngIf"], ["kendoButton", "", "type", "button", 3, "click"], ["kendoButton", "", "themeColor", "primary", "type", "button", 3, "click"], ["title", "Confirm Choice", 3, "minWidth", "width", "close"], [2, "margin", "30px", "text-align", "center"], ["kendoButton", "", "themeColor", "primary", 3, "click"]], template: function UserViewGridComponent_Template(rf, ctx) { if (rf & 1) {
1011
+ i0.ɵɵelementStart(0, "div", 0)(1, "kendo-tabstrip", 1);
1012
+ i0.ɵɵlistener("tabSelect", function UserViewGridComponent_Template_kendo_tabstrip_tabSelect_1_listener() { return ctx.selectTabHandler(); });
1013
+ i0.ɵɵelementStart(2, "kendo-tabstrip-tab", 2);
1014
+ i0.ɵɵtemplate(3, UserViewGridComponent_ng_template_3_Template, 1, 0, "ng-template", 3)(4, UserViewGridComponent_ng_template_4_Template, 8, 18, "ng-template", 4);
1015
+ i0.ɵɵelementEnd();
1016
+ i0.ɵɵtemplate(5, UserViewGridComponent_kendo_tabstrip_tab_5_Template, 3, 0, "kendo-tabstrip-tab", 5);
1017
+ i0.ɵɵelementEnd();
1018
+ i0.ɵɵtemplate(6, UserViewGridComponent_div_6_Template, 3, 1, "div", 5);
1019
+ i0.ɵɵelementEnd();
1020
+ } if (rf & 2) {
1021
+ i0.ɵɵadvance();
1022
+ i0.ɵɵproperty("keepTabContent", true)("animate", false);
1023
+ i0.ɵɵadvance();
1024
+ i0.ɵɵproperty("selected", true);
1025
+ i0.ɵɵadvance(3);
1026
+ i0.ɵɵproperty("ngIf", ctx.Params == null ? null : ctx.Params.ViewID);
1027
+ i0.ɵɵadvance();
1028
+ i0.ɵɵproperty("ngIf", ctx.isCompareDialogOpened);
1029
+ } }, dependencies: [i3.NgForOf, i3.NgIf, i4.GridComponent, i4.ToolbarTemplateDirective, i4.SelectionDirective, i4.ColumnComponent, i4.FooterTemplateDirective, i4.CheckboxColumnComponent, i5.DialogComponent, i5.DialogActionsComponent, i5.WindowComponent, i6.ExcelExportComponent, i6.ColumnComponent, i7.ButtonComponent, i8.CompareRecordsComponent, i9.FillContainer, i10.SVGIconComponent, i11.TabStripComponent, i11.TabStripTabComponent, i11.TabContentDirective, i11.TabTitleDirective, i12.AskSkipComponent, 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}"] });
1030
+ (() => { (typeof ngDevMode === "undefined" || ngDevMode) && i0.ɵsetClassMetadata(UserViewGridComponent, [{
1031
+ type: Component,
1032
+ args: [{ selector: 'mj-user-view-grid', template: "<div class=\"user-view-grid-wrap\" mjFillContainer>\r\n <kendo-tabstrip [keepTabContent]=\"true\" [animate] = \"false\" mjFillContainer (tabSelect)=\"selectTabHandler()\"> \r\n <kendo-tabstrip-tab [selected]=\"true\">\r\n <ng-template kendoTabTitle>Data</ng-template>\r\n <ng-template kendoTabContent>\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 *ngIf=\"!compareMode && !mergeMode\" (click)=\"doExcelExport()\" >\r\n <kendo-svgicon [icon]=\"kendoSVGIcon('fileExcel')\"></kendo-svgicon>\r\n Export to Excel\r\n </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)=\"enableMergeOrCompare(false, 'compare')\" *ngIf=\"!compareMode && !mergeMode\" [disabled]=\"compareMode && recordsToCompare.length < 2\" class=\"k-button k-button-md k-rounded-md k-button-solid-base k-button-solid\">Compare</button>\r\n <button (click)=\"enableMergeOrCompare(false, 'compare')\" *ngIf=\"compareMode\" [disabled]=\"compareMode && recordsToCompare.length < 2\" class=\"k-button k-button-md k-rounded-md k-button-solid-base k-button-solid\">Compare</button>\r\n <button (click)=\"enableMergeOrCompare(true, 'compare')\" *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)=\"enableMergeOrCompare(false, 'merge')\" *ngIf=\"mergeMode\" [disabled]=\"mergeMode && recordsToCompare.length < 2\" class=\"k-button k-button-md k-rounded-md k-button-solid-base k-button-solid\">Merge</button>\r\n <button (click)=\"enableMergeOrCompare(false, 'merge')\" *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)=\"enableMergeOrCompare(true, 'merge')\" *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 *ngIf=\"showRefreshButton && !compareMode && !mergeMode\"\r\n (click)=\"RefreshFromSavedParams()\">\r\n <kendo-svgicon [icon]=\"kendoSVGIcon('arrowRotateCcwSmall')\"></kendo-svgicon>\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 </ng-template> \r\n </kendo-tabstrip-tab>\r\n <kendo-tabstrip-tab *ngIf=\"Params?.ViewID\">\r\n <ng-template kendoTabTitle>Analysis</ng-template>\r\n <ng-template kendoTabContent>\r\n <mj-ask-skip mjFillContainer [AllowNewConversations]=\"false\" [ShowConversationList]=\"false\" [UpdateAppRoute]=\"false\" [ViewID]=\"ViewID\" [LinkedEntity]=\"'User Views'\" [LinkedEntityRecordID]=\"ViewID\">\r\n </mj-ask-skip>\r\n </ng-template>\r\n </kendo-tabstrip-tab>\r\n </kendo-tabstrip>\r\n \r\n\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]=\"recordsToCompare\" \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-dialog\r\n title=\"Confirm Choice\"\r\n *ngIf=\"isConfirmDialogOpen\"\r\n (close)=\"closeConfirmMergeDialog('cancel')\"\r\n [minWidth]=\"250\"\r\n [width]=\"450\"\r\n >\r\n <p style=\"margin: 30px; text-align: center;\">\r\n Are you sure you want to merge the records? This action cannot be undone. If you select \"Yes\", the records will be merged and the duplicate records will be deleted.\r\n </p>\r\n <kendo-dialog-actions>\r\n <button kendoButton (click)=\"closeConfirmMergeDialog('no')\">No</button>\r\n <button kendoButton (click)=\"closeConfirmMergeDialog('yes')\" themeColor=\"primary\">\r\n Yes\r\n </button>\r\n </kendo-dialog-actions>\r\n </kendo-dialog>\r\n </kendo-window>\r\n </div> \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}"] }]
1033
+ }], () => [{ type: i1.FormBuilder }, { type: i2.Router }], { Params: [{
1034
+ type: Input
1035
+ }], BottomMargin: [{
1036
+ type: Input
1037
+ }], InEditMode: [{
1038
+ type: Input
1039
+ }], EditMode: [{
1040
+ type: Input
1041
+ }], AutoNavigate: [{
1042
+ type: Input
1043
+ }], rowClicked: [{
1044
+ type: Output
1045
+ }], rowEdited: [{
1046
+ type: Output
1047
+ }], kendoGridElement: [{
1048
+ type: ViewChild,
1049
+ args: ['kendoGrid', { read: GridComponent }]
1050
+ }], kendoGridElementRef: [{
1051
+ type: ViewChild,
1052
+ args: ['kendoGrid', { read: ElementRef }]
1053
+ }], kendoExcelExport: [{
1054
+ type: ViewChild,
1055
+ args: ['excelExport', { read: ExcelExportComponent }]
1056
+ }], recordCompareComponent: [{
1057
+ type: ViewChild,
1058
+ args: ['recordCompareRef', { static: false }]
1059
+ }], analysisQuestion: [{
1060
+ type: ViewChild,
1061
+ args: ['analysisQuestion', { read: TextAreaComponent }]
1062
+ }], analysisResults: [{
1063
+ type: ViewChild,
1064
+ args: ['analysisResults', { read: ElementRef }]
1065
+ }], container: [{
1066
+ type: ViewChild,
1067
+ args: ['plotContainer', { read: ViewContainerRef }]
1068
+ }], AllowLoad: [{
1069
+ type: Input
1070
+ }] }); })();
1071
+ (() => { (typeof ngDevMode === "undefined" || ngDevMode) && i0.ɵsetClassDebugInfo(UserViewGridComponent, { className: "UserViewGridComponent", filePath: "src\\lib\\ng-user-view-grid.component.ts", lineNumber: 47 }); })();