@memberjunction/ng-user-view-grid 0.9.35 → 0.9.37

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@memberjunction/ng-user-view-grid",
3
- "version": "0.9.35",
3
+ "version": "0.9.37",
4
4
  "description": "MemberJunction: Angular Grid to display dynamic and saved user views for any entity in MemberJunction.",
5
5
  "main": "./dist/public-api.js",
6
6
  "typings": "./dist/public-api.d.ts",
@@ -20,14 +20,14 @@
20
20
  "@angular/core": "^15.2.0",
21
21
  "@angular/forms": "^15.2.0",
22
22
  "@angular/router": "^15.2.0",
23
- "@memberjunction/core": "^0.9.48",
24
- "@memberjunction/ng-compare-records": "^0.9.39",
25
- "@memberjunction/ng-container-directives": "^0.9.32",
26
23
  "@progress/kendo-angular-grid": "^12.1.0"
27
24
  },
28
25
  "dependencies": {
29
- "@memberjunction/core-entities": "^0.9.22",
30
- "@memberjunction/global": "^0.9.50",
26
+ "@memberjunction/core-entities": "^0.9.31",
27
+ "@memberjunction/global": "^0.9.61",
28
+ "@memberjunction/core": "^0.9.58",
29
+ "@memberjunction/ng-compare-records": "^0.9.41",
30
+ "@memberjunction/ng-container-directives": "^0.9.40",
31
31
  "tslib": "^2.3.0"
32
32
  },
33
33
  "sideEffects": false
@@ -1,107 +0,0 @@
1
- import { ElementRef, EventEmitter, OnInit, AfterViewInit } from '@angular/core';
2
- import { FormBuilder, FormGroup } from '@angular/forms';
3
- import { Router } from '@angular/router';
4
- import { BaseEntity, RunViewParams, EntityFieldInfo, EntityInfo } from '@memberjunction/core';
5
- import { ViewColumnInfo, UserViewEntityExtended } from '@memberjunction/core-entities';
6
- import { CellClickEvent, GridDataResult, PageChangeEvent, GridComponent, CellCloseEvent, ColumnReorderEvent, ColumnResizeArgs, SelectionEvent, SelectableSettings } from "@progress/kendo-angular-grid";
7
- import { ExcelExportComponent } from '@progress/kendo-angular-excel-export';
8
- import * as i0 from "@angular/core";
9
- export type GridRowClickedEvent = {
10
- entityId: number;
11
- entityName: string;
12
- recordId: number;
13
- };
14
- export type GridRowEditedEvent = {
15
- record: BaseEntity;
16
- row: number;
17
- saved: boolean;
18
- };
19
- export type GridPendingRecordItem = {
20
- record: BaseEntity;
21
- row: number;
22
- dataItem: any;
23
- };
24
- export declare class UserViewGridComponent implements OnInit, AfterViewInit {
25
- private formBuilder;
26
- private router;
27
- title: string;
28
- Params: RunViewParams | undefined;
29
- BottomMargin: number;
30
- InEditMode: boolean;
31
- EditMode: "None" | "Save" | "Queue";
32
- AutoNavigate: boolean;
33
- rowClicked: EventEmitter<GridRowClickedEvent>;
34
- rowEdited: EventEmitter<GridRowEditedEvent>;
35
- kendoGridElement: GridComponent | null;
36
- kendoGridElementRef: ElementRef | null;
37
- kendoExcelExport: ExcelExportComponent | null;
38
- private _pendingRecords;
39
- viewData: [];
40
- totalRowCount: number;
41
- formattedData: {
42
- [key: string]: any;
43
- }[];
44
- viewColumns: ViewColumnInfo[];
45
- visibleColumns: ViewColumnInfo[];
46
- sortSettings: any[];
47
- entityRecord: BaseEntity | null;
48
- skip: number;
49
- pageSize: number;
50
- isLoading: boolean;
51
- gridView: GridDataResult;
52
- gridHeight: number;
53
- _viewEntity: UserViewEntityExtended | undefined;
54
- _entityInfo: EntityInfo | undefined;
55
- private _newGridState;
56
- private editModeEnded;
57
- compareMode: boolean;
58
- compareRecords: BaseEntity[];
59
- selectableSettings: SelectableSettings;
60
- selectedKeys: any[];
61
- isDialogOpened: boolean;
62
- showRefreshButton: boolean;
63
- viewExecutionTime: number;
64
- get PendingRecords(): GridPendingRecordItem[];
65
- protected StartEditMode(): void;
66
- protected EndEditMode(): void;
67
- EditingComplete(): Promise<boolean>;
68
- IsDynamicView(): boolean;
69
- pageChange(event: PageChangeEvent): void;
70
- private virtualLoadData;
71
- constructor(formBuilder: FormBuilder, router: Router);
72
- private _saveTimeout;
73
- private SaveView;
74
- private _viewDirty;
75
- innerSaveView(): Promise<void>;
76
- protected CreateSimpleNotification(message: string, style: "none" | "success" | "error" | "warning" | "info", duration: number): void;
77
- columnReorder(args: ColumnReorderEvent): Promise<void>;
78
- columnResize(args: ColumnResizeArgs[]): Promise<void>;
79
- sortChanged(sort: any): Promise<void>;
80
- cellClickHandler(args: CellClickEvent): Promise<void>;
81
- createFormGroup(dataItem: any): FormGroup;
82
- getEditor(ef: EntityFieldInfo): "boolean" | "text" | "numeric" | "date";
83
- cellCloseHandler(args: CellCloseEvent): Promise<void>;
84
- RevertPendingChanges(): void;
85
- ngOnInit(): void;
86
- ngAfterViewInit(): void;
87
- private _deferLoadCount;
88
- private _allowLoad;
89
- get AllowLoad(): boolean;
90
- set AllowLoad(value: boolean);
91
- RefreshFromSavedParams(): Promise<void>;
92
- Refresh(params: RunViewParams): Promise<void>;
93
- GetColumnTitle(col: ViewColumnInfo): string;
94
- GetColumnCellStyle(col: ViewColumnInfo): {
95
- 'text-align': string;
96
- 'vertical-align': string;
97
- };
98
- selectionChange(args: SelectionEvent): void;
99
- enableCompare(cancel?: boolean): void;
100
- closeDialog(): void;
101
- exportColumns: ViewColumnInfo[];
102
- exportData: any[];
103
- doExcelExport(): Promise<void>;
104
- protected getExportData(): Promise<any[]>;
105
- static ɵfac: i0.ɵɵFactoryDeclaration<UserViewGridComponent, never>;
106
- static ɵcmp: i0.ɵɵComponentDeclaration<UserViewGridComponent, "mj-user-view-grid", never, { "Params": "Params"; "BottomMargin": "BottomMargin"; "InEditMode": "InEditMode"; "EditMode": "EditMode"; "AutoNavigate": "AutoNavigate"; "AllowLoad": "AllowLoad"; }, { "rowClicked": "rowClicked"; "rowEdited": "rowEdited"; }, never, never, false, never>;
107
- }
@@ -1,762 +0,0 @@
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-container-directives";
27
- const _c0 = ["kendoGrid"];
28
- const _c1 = ["excelExport"];
29
- function UserViewGridComponent_ng_template_3_button_2_Template(rf, ctx) { if (rf & 1) {
30
- const _r10 = i0.ɵɵgetCurrentView();
31
- i0.ɵɵelementStart(0, "button", 14);
32
- i0.ɵɵlistener("click", function UserViewGridComponent_ng_template_3_button_2_Template_button_click_0_listener() { i0.ɵɵrestoreView(_r10); const ctx_r9 = i0.ɵɵnextContext(2); return i0.ɵɵresetView(ctx_r9.enableCompare(true)); });
33
- i0.ɵɵtext(1, "Cancel");
34
- i0.ɵɵelementEnd();
35
- } }
36
- function UserViewGridComponent_ng_template_3_button_5_Template(rf, ctx) { if (rf & 1) {
37
- const _r12 = i0.ɵɵgetCurrentView();
38
- i0.ɵɵelementStart(0, "button", 15);
39
- i0.ɵɵlistener("click", function UserViewGridComponent_ng_template_3_button_5_Template_button_click_0_listener() { i0.ɵɵrestoreView(_r12); const ctx_r11 = i0.ɵɵnextContext(2); return i0.ɵɵresetView(ctx_r11.RefreshFromSavedParams()); });
40
- i0.ɵɵtext(1, " Refresh ");
41
- i0.ɵɵelementEnd();
42
- } if (rf & 2) {
43
- i0.ɵɵproperty("primary", true);
44
- } }
45
- function UserViewGridComponent_ng_template_3_Template(rf, ctx) { if (rf & 1) {
46
- const _r14 = i0.ɵɵgetCurrentView();
47
- i0.ɵɵelementStart(0, "button", 10);
48
- i0.ɵɵlistener("click", function UserViewGridComponent_ng_template_3_Template_button_click_0_listener() { i0.ɵɵrestoreView(_r14); const ctx_r13 = i0.ɵɵnextContext(); return i0.ɵɵresetView(ctx_r13.doExcelExport()); });
49
- i0.ɵɵtext(1, "Export to Excel");
50
- i0.ɵɵelementEnd();
51
- i0.ɵɵtemplate(2, UserViewGridComponent_ng_template_3_button_2_Template, 2, 0, "button", 11);
52
- i0.ɵɵelementStart(3, "button", 12);
53
- i0.ɵɵlistener("click", function UserViewGridComponent_ng_template_3_Template_button_click_3_listener() { i0.ɵɵrestoreView(_r14); const ctx_r15 = i0.ɵɵnextContext(); return i0.ɵɵresetView(ctx_r15.enableCompare()); });
54
- i0.ɵɵtext(4, "Compare");
55
- i0.ɵɵelementEnd();
56
- i0.ɵɵtemplate(5, UserViewGridComponent_ng_template_3_button_5_Template, 2, 1, "button", 13);
57
- } if (rf & 2) {
58
- const ctx_r1 = i0.ɵɵnextContext();
59
- i0.ɵɵproperty("disabled", ctx_r1.compareMode);
60
- i0.ɵɵadvance(2);
61
- i0.ɵɵproperty("ngIf", ctx_r1.compareMode);
62
- i0.ɵɵadvance(1);
63
- i0.ɵɵproperty("disabled", ctx_r1.compareMode && ctx_r1.compareRecords.length < 2);
64
- i0.ɵɵadvance(2);
65
- i0.ɵɵproperty("ngIf", ctx_r1.showRefreshButton);
66
- } }
67
- const _c2 = function () { return { "text-align": "center", "vertical-align": "center" }; };
68
- const _c3 = function () { return { "font-weight": "bold", "background-color": "#a9c2af" }; };
69
- function UserViewGridComponent_kendo_grid_checkbox_column_4_Template(rf, ctx) { if (rf & 1) {
70
- i0.ɵɵelement(0, "kendo-grid-checkbox-column", 16);
71
- } if (rf & 2) {
72
- i0.ɵɵstyleMap(i0.ɵɵpureFunction0(4, _c2));
73
- i0.ɵɵproperty("width", 50)("headerStyle", i0.ɵɵpureFunction0(5, _c3));
74
- } }
75
- function UserViewGridComponent_kendo_grid_column_5_1_ng_template_0_Template(rf, ctx) { if (rf & 1) {
76
- i0.ɵɵtext(0);
77
- i0.ɵɵpipe(1, "number");
78
- i0.ɵɵpipe(2, "number");
79
- i0.ɵɵelement(3, "br");
80
- i0.ɵɵelementStart(4, "span", 19);
81
- i0.ɵɵtext(5);
82
- i0.ɵɵpipe(6, "number");
83
- i0.ɵɵelementEnd();
84
- } if (rf & 2) {
85
- const ctx_r18 = i0.ɵɵnextContext(3);
86
- i0.ɵɵtextInterpolate2(" ", i0.ɵɵpipeBind1(1, 3, ctx_r18.viewData.length), "", ctx_r18.totalRowCount > ctx_r18.viewData.length ? " of " + i0.ɵɵpipeBind1(2, 5, ctx_r18.totalRowCount) : " rows", "");
87
- i0.ɵɵadvance(5);
88
- i0.ɵɵtextInterpolate1("", i0.ɵɵpipeBind2(6, 7, ctx_r18.viewExecutionTime, "1.2-2"), " seconds");
89
- } }
90
- function UserViewGridComponent_kendo_grid_column_5_1_Template(rf, ctx) { if (rf & 1) {
91
- i0.ɵɵtemplate(0, UserViewGridComponent_kendo_grid_column_5_1_ng_template_0_Template, 7, 10, "ng-template", 18);
92
- } }
93
- function UserViewGridComponent_kendo_grid_column_5_Template(rf, ctx) { if (rf & 1) {
94
- i0.ɵɵelementStart(0, "kendo-grid-column", 17);
95
- i0.ɵɵtemplate(1, UserViewGridComponent_kendo_grid_column_5_1_Template, 1, 0, null, 9);
96
- i0.ɵɵelementEnd();
97
- } if (rf & 2) {
98
- const item_r16 = ctx.$implicit;
99
- const ctx_r3 = i0.ɵɵnextContext();
100
- i0.ɵɵstyleMap(ctx_r3.GetColumnCellStyle(item_r16));
101
- i0.ɵɵproperty("field", item_r16.Name)("title", ctx_r3.GetColumnTitle(item_r16))("width", item_r16.width ? item_r16.width : 100)("editable", item_r16.EntityField.AllowUpdateAPI)("editor", ctx_r3.getEditor(item_r16.EntityField))("headerStyle", i0.ɵɵpureFunction0(9, _c3));
102
- i0.ɵɵadvance(1);
103
- i0.ɵɵproperty("ngIf", item_r16 === ctx_r3.visibleColumns[0]);
104
- } }
105
- function UserViewGridComponent_kendo_excelexport_column_8_Template(rf, ctx) { if (rf & 1) {
106
- i0.ɵɵelement(0, "kendo-excelexport-column", 20);
107
- } if (rf & 2) {
108
- const exportCol_r19 = ctx.$implicit;
109
- i0.ɵɵproperty("field", exportCol_r19.Name)("title", exportCol_r19.Name);
110
- } }
111
- function UserViewGridComponent_div_9_kendo_window_2_Template(rf, ctx) { if (rf & 1) {
112
- const _r22 = i0.ɵɵgetCurrentView();
113
- i0.ɵɵelementStart(0, "kendo-window", 23);
114
- i0.ɵɵlistener("close", function UserViewGridComponent_div_9_kendo_window_2_Template_kendo_window_close_0_listener() { i0.ɵɵrestoreView(_r22); const ctx_r21 = i0.ɵɵnextContext(2); return i0.ɵɵresetView(ctx_r21.closeDialog()); });
115
- i0.ɵɵelementStart(1, "div", 24)(2, "div");
116
- i0.ɵɵelement(3, "mj-record-compare", 25);
117
- i0.ɵɵelementEnd()()();
118
- } if (rf & 2) {
119
- const ctx_r20 = i0.ɵɵnextContext(2);
120
- i0.ɵɵproperty("width", 900)("minHeight", 300)("minWidth", 400)("resizable", true);
121
- i0.ɵɵadvance(3);
122
- i0.ɵɵproperty("recordsToCompare", ctx_r20.compareRecords)("visibleColumns", ctx_r20.visibleColumns);
123
- } }
124
- function UserViewGridComponent_div_9_Template(rf, ctx) { if (rf & 1) {
125
- i0.ɵɵelementStart(0, "div");
126
- i0.ɵɵelement(1, "div", 21);
127
- i0.ɵɵtemplate(2, UserViewGridComponent_div_9_kendo_window_2_Template, 4, 6, "kendo-window", 22);
128
- i0.ɵɵelementEnd();
129
- } if (rf & 2) {
130
- const ctx_r6 = i0.ɵɵnextContext();
131
- i0.ɵɵadvance(2);
132
- i0.ɵɵproperty("ngIf", ctx_r6.isDialogOpened);
133
- } }
134
- export class UserViewGridComponent {
135
- get PendingRecords() {
136
- return this._pendingRecords;
137
- }
138
- StartEditMode() {
139
- this.InEditMode = true;
140
- }
141
- EndEditMode() {
142
- this.InEditMode = false;
143
- this.editModeEnded.next();
144
- }
145
- EditingComplete() {
146
- if (this.InEditMode) {
147
- // we need to wait for edit mode to end before we can return true
148
- return new Promise((resolve, reject) => {
149
- const subscription = this.editModeEnded.subscribe(() => {
150
- resolve(true);
151
- subscription.unsubscribe();
152
- });
153
- });
154
- }
155
- else
156
- return Promise.resolve(true); // not in edit mode, so editing is complete!
157
- }
158
- IsDynamicView() {
159
- return !this._viewEntity; // if we have a viewEntity it is a stored view
160
- }
161
- pageChange(event) {
162
- this.skip = event.skip;
163
- this.virtualLoadData();
164
- }
165
- virtualLoadData() {
166
- // check to see if we have already formatted the slice of the data we need right now
167
- // we are storing the formattted data in the formattedData array and it has same set
168
- // of indexes as the viewData array (raw unformatted data). When we first get viewData
169
- // from the server we create an array of the same length as viewData, but have nulls in all of the
170
- // indexes. As we format each row of viewData we store the formatted row in the same index
171
- // in the formattedData array. So if we have already formatted the data we need for the current
172
- // page, we just use that data, otherwise we format the data we need for the current page
173
- try {
174
- // check to see if we have already formatted the data we need for the current page
175
- for (let i = this.skip; (i < (this.skip + this.pageSize)) && (i < this.viewData.length); i++) {
176
- if (!this.formattedData[i]) {
177
- // we have not formatted this row yet, so format it
178
- const r = this.viewColumns.map((c) => {
179
- if (c && c.EntityField && this.viewData[i] && this.viewData[i][c.EntityField.Name]) {
180
- if (!c.hidden && c.EntityField.Name !== 'ID') {
181
- const ef = c.EntityField;
182
- return { field: c.EntityField.Name, value: ef.FormatValue(this.viewData[i][c.EntityField.Name], 0, undefined, 300) };
183
- }
184
- else
185
- return { field: c.EntityField.Name, value: this.viewData[i][c.EntityField.Name] }; // hidden column, so just return the value, don't bother formatting
186
- }
187
- else
188
- return { field: c.Name, value: null };
189
- });
190
- // now r is an array of {field: string, value: any} objects, so we need to convert it to an object
191
- // with the field names as the keys and the values as the values
192
- const row = {};
193
- for (let j = 0; j < r.length; j++) {
194
- if (r[j] && r[j].field && r[j].field.length > 0)
195
- row[r[j].field] = r[j].value;
196
- }
197
- this.formattedData[i] = row;
198
- }
199
- }
200
- // now that we have made sure current page of data is formatted, we can return it
201
- this.gridView = {
202
- data: this.formattedData.slice(this.skip, this.skip + this.pageSize),
203
- total: this.viewData.length,
204
- };
205
- }
206
- catch (e) {
207
- LogError(e);
208
- }
209
- }
210
- constructor(formBuilder, router) {
211
- this.formBuilder = formBuilder;
212
- this.router = router;
213
- this.title = 'UserViewGrid';
214
- this.BottomMargin = 0;
215
- this.InEditMode = false;
216
- this.EditMode = "None";
217
- this.AutoNavigate = true;
218
- this.rowClicked = new EventEmitter();
219
- this.rowEdited = new EventEmitter();
220
- this.kendoGridElement = null;
221
- this.kendoGridElementRef = null;
222
- this.kendoExcelExport = null;
223
- this._pendingRecords = [];
224
- this.viewData = [];
225
- this.totalRowCount = 0;
226
- this.formattedData = [];
227
- this.viewColumns = [];
228
- this.visibleColumns = [];
229
- this.sortSettings = [];
230
- this.entityRecord = null;
231
- this.skip = 0;
232
- this.pageSize = 40;
233
- this.isLoading = false;
234
- this.gridView = { data: [], total: 0 };
235
- this.gridHeight = 750;
236
- this._newGridState = {};
237
- this.editModeEnded = new Subject();
238
- this.compareMode = false;
239
- this.compareRecords = [];
240
- this.selectableSettings = {
241
- enabled: false
242
- };
243
- this.selectedKeys = [];
244
- this.isDialogOpened = false;
245
- this.showRefreshButton = true;
246
- this.viewExecutionTime = 0;
247
- this._viewDirty = false;
248
- this._deferLoadCount = 0;
249
- this._allowLoad = true;
250
- // Export Functionality
251
- this.exportColumns = [];
252
- this.exportData = [];
253
- }
254
- SaveView() {
255
- // debounced outer function...
256
- clearTimeout(this._saveTimeout);
257
- this._saveTimeout = setTimeout(() => __awaiter(this, void 0, void 0, function* () {
258
- // when we actually call inner save view we do await
259
- yield this.innerSaveView();
260
- }), 5000); // 5 seconds delay
261
- }
262
- ;
263
- innerSaveView() {
264
- return __awaiter(this, void 0, void 0, function* () {
265
- if (this._viewDirty) {
266
- const md = new Metadata();
267
- if (this._viewEntity &&
268
- this._viewEntity.Get('UserID') === md.CurrentUser.ID) {
269
- // this view is a saved view, AND it belongs to the current user
270
- // update the grid state if we have settings updates for columns and/or sorts
271
- const tempGridState = JSON.parse(this._viewEntity.Get('GridState'));
272
- const tempColSettings = this._newGridState.columnSettings ? this._newGridState.columnSettings : tempGridState.columnSettings;
273
- tempColSettings.forEach((col) => { col.DisplayName, col.ID, col.Name, col.hidden, col.orderIndex, col.width; }); // remove EntityFieldInfo from the column settings
274
- tempGridState.columnSettings = tempColSettings;
275
- tempGridState.sortSettings = this._newGridState.sortSettings ? this._newGridState.sortSettings : tempGridState.sortSettings;
276
- // now stringify the grid state and save it
277
- this._viewEntity.Set('GridState', JSON.stringify(tempGridState));
278
- const newSortState = tempGridState.sortSettings.map((s) => { return { field: s.field, direction: s.dir === 'asc' ? 1 : 2 }; });
279
- const oldSortState = JSON.parse(this._viewEntity.Get('SortState'));
280
- this._viewEntity.Set('SortState', JSON.stringify(newSortState));
281
- if (yield this._viewEntity.Save()) {
282
- // check to see if sort state changed and if so, refresh the grid
283
- if (JSON.stringify(newSortState) !== JSON.stringify(oldSortState)) {
284
- if (this.Params) // makes sure we have params before we refresh
285
- this.Refresh(this.Params);
286
- }
287
- this._viewDirty = false;
288
- }
289
- else {
290
- this.CreateSimpleNotification('Unable to save view settings', 'error', 5000);
291
- }
292
- }
293
- }
294
- });
295
- }
296
- CreateSimpleNotification(message, style, duration) {
297
- const data = {
298
- message: message,
299
- style: style,
300
- DisplayDuration: duration
301
- };
302
- MJGlobal.Instance.RaiseEvent({
303
- component: this,
304
- event: MJEventType.DisplaySimpleNotificationRequest,
305
- eventCode: "",
306
- args: data
307
- });
308
- }
309
- columnReorder(args) {
310
- return __awaiter(this, void 0, void 0, function* () {
311
- // Remove the column from the original position
312
- // need to find the column in the viewColumns array because args.old/new Indexes are from the visibleColumns array
313
- const fieldName = args.column.field;
314
- if (fieldName) {
315
- const vcOldIndex = this.viewColumns.findIndex((vc) => vc.Name === fieldName);
316
- const vcNewIndex = this.viewColumns.findIndex((vc) => vc.orderIndex === args.newIndex);
317
- if (vcOldIndex >= 0) {
318
- // got the index, now remove the element
319
- const element = this.viewColumns.splice(vcOldIndex, 1)[0];
320
- // Insert it at the new position
321
- this.viewColumns.splice(vcNewIndex, 0, element);
322
- // go through all of the columns and set orderIndex as that isn't done automatically
323
- let visColIndex = 0;
324
- for (let i = 0; i < this.viewColumns.length; i++) {
325
- if (!this.viewColumns[i].hidden) {
326
- this.viewColumns[i].orderIndex = visColIndex;
327
- visColIndex++;
328
- }
329
- }
330
- // 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
331
- for (let i = 0; i < this.viewColumns.length; i++) {
332
- if (this.viewColumns[i].hidden) {
333
- this.viewColumns[i].orderIndex = visColIndex;
334
- visColIndex++;
335
- }
336
- }
337
- // make sure that _newGridState.columnSettings is set
338
- this._newGridState.columnSettings = this.viewColumns;
339
- this._viewDirty = true;
340
- this.SaveView();
341
- }
342
- }
343
- });
344
- }
345
- columnResize(args) {
346
- return __awaiter(this, void 0, void 0, function* () {
347
- for (const col of args) {
348
- const c = col.column;
349
- const viewCol = this.viewColumns.find(vc => vc.Name === c.field);
350
- const visCol = this.visibleColumns.find(vc => vc.Name === c.field);
351
- const visCols = this.visibleColumns;
352
- if (viewCol)
353
- viewCol.width = col.newWidth;
354
- }
355
- this._newGridState.columnSettings = this.viewColumns.map(vc => {
356
- return {
357
- Name: vc.Name,
358
- DisplayName: vc.DisplayName,
359
- width: vc.width,
360
- orderIndex: vc.orderIndex,
361
- hidden: vc.hidden
362
- };
363
- });
364
- this._viewDirty = true;
365
- this.SaveView();
366
- });
367
- }
368
- sortChanged(sort) {
369
- return __awaiter(this, void 0, void 0, function* () {
370
- this._newGridState.sortSettings = sort;
371
- this.sortSettings = sort; // for the UI display - grid binding to this shows that the sort is applied via arrows in the column headers
372
- if (this.IsDynamicView()) {
373
- // Dynamic View, we have this.Params and can add an OrderBy and then just Refresh() the entire component
374
- // that will result in going to the server for a refreshed set of data
375
- if (this.Params) {
376
- this.Params.OrderBy = sort[0].field + ' ' + (sort[0].dir === 'asc' ? 'ASC' : 'DESC');
377
- this.Refresh(this.Params);
378
- }
379
- else {
380
- LogError("sortChanged() called but this.Params is null or undefined"); // should never get here
381
- }
382
- }
383
- else {
384
- // Saved view - we do this on the server side only
385
- this._viewDirty = true;
386
- this.innerSaveView(); // for sort changes we call innerSaveView() directly, not through SaveView() which is debounced
387
- }
388
- });
389
- }
390
- cellClickHandler(args) {
391
- return __awaiter(this, void 0, void 0, function* () {
392
- if (this.compareMode)
393
- return;
394
- if (this._entityInfo) {
395
- this.rowClicked.emit({
396
- entityId: this._entityInfo.ID,
397
- entityName: this._entityInfo.Name,
398
- recordId: args.dataItem.ID
399
- });
400
- if (this._entityInfo.AllowUpdateAPI &&
401
- this.EditMode !== "None") {
402
- const perm = this._entityInfo.GetUserPermisions(new Metadata().CurrentUser);
403
- if (perm.CanUpdate) {
404
- this.StartEditMode();
405
- args.sender.editCell(args.rowIndex, args.columnIndex, this.createFormGroup(args.dataItem));
406
- }
407
- }
408
- if (!this.InEditMode && this.AutoNavigate) {
409
- // tell app router to go to this record
410
- this.router.navigate(['resource', 'record', args.dataItem.ID], { queryParams: { Entity: this._entityInfo.Name } });
411
- }
412
- }
413
- });
414
- }
415
- createFormGroup(dataItem) {
416
- const groupFields = {};
417
- this.viewColumns.forEach((vc) => {
418
- if (vc.EntityField.AllowUpdateAPI &&
419
- vc.EntityField.IsVirtual === false &&
420
- vc.EntityField.AllowUpdateInView)
421
- groupFields[vc.Name] = dataItem[vc.Name];
422
- });
423
- return this.formBuilder.group(groupFields);
424
- }
425
- getEditor(ef) {
426
- switch (ef.TSType) {
427
- case EntityFieldTSType.Boolean:
428
- return "boolean";
429
- case EntityFieldTSType.Date:
430
- return "date";
431
- case EntityFieldTSType.Number:
432
- return "numeric";
433
- default:
434
- return "text";
435
- }
436
- }
437
- cellCloseHandler(args) {
438
- var _a;
439
- return __awaiter(this, void 0, void 0, function* () {
440
- try {
441
- if (this._entityInfo && this.EditMode !== "None") {
442
- const { formGroup, dataItem } = args;
443
- if (!formGroup.valid) {
444
- // prevent closing the edited cell if there are invalid values.
445
- args.preventDefault();
446
- }
447
- else if (formGroup.dirty) {
448
- if (args.originalEvent && args.originalEvent.keyCode === Keys.Escape)
449
- return; // user hit escape, so don't save their changes
450
- // update the data item with the new values - this drives UI refresh while we save the record...
451
- Object.assign(dataItem, formGroup.value);
452
- const md = new Metadata();
453
- let record;
454
- let bSaved = false;
455
- if (this.EditMode === "Save") {
456
- record = yield md.GetEntityObject(this._entityInfo.Name);
457
- yield record.Load(dataItem.ID);
458
- record.SetMany(formGroup.value);
459
- bSaved = yield record.Save();
460
- if (!bSaved)
461
- this.CreateSimpleNotification("Error saving record: " + record.ID, 'error', 5000);
462
- }
463
- else {
464
- record = (_a = this._pendingRecords.find((r) => r.record.ID === dataItem.ID)) === null || _a === void 0 ? void 0 : _a.record;
465
- if (!record) { // haven't edited this one before
466
- record = yield md.GetEntityObject(this._viewEntity.Get('Entity'));
467
- yield record.Load(dataItem.ID);
468
- this._pendingRecords.push({ record,
469
- row: args.rowIndex,
470
- dataItem }); // don't save - put the changed record on a queue for saving later by our container
471
- }
472
- // go through the formGroup and only set the values that exist as columns in the grid
473
- const keys = Object.keys(formGroup.value);
474
- keys.forEach((k) => {
475
- const vc = this.viewColumns.find((vc) => vc.Name === k && vc.hidden === false);
476
- if (vc) {
477
- record.Set(k, formGroup.value[k]);
478
- }
479
- });
480
- //record.SetMany(formGroup.value);
481
- }
482
- this.rowEdited.emit({
483
- record: record,
484
- row: args.rowIndex,
485
- saved: bSaved
486
- });
487
- }
488
- }
489
- }
490
- catch (e) {
491
- console.error(e);
492
- }
493
- finally {
494
- this.EndEditMode();
495
- }
496
- });
497
- }
498
- // this handles reverting pending cahnges to records WITHIN the grid, not the user view settings, unrelated to that.
499
- RevertPendingChanges() {
500
- if (this._pendingRecords && this._pendingRecords.length > 0) {
501
- this._pendingRecords.forEach((r) => {
502
- r.record.Revert();
503
- 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...
504
- });
505
- this._pendingRecords = [];
506
- if (this.Params)
507
- this.Refresh(this.Params);
508
- }
509
- }
510
- ngOnInit() {
511
- }
512
- ngAfterViewInit() {
513
- //this.setGridHeight();
514
- if (this.Params)
515
- this.Refresh(this.Params);
516
- }
517
- get AllowLoad() {
518
- return this._allowLoad;
519
- }
520
- set AllowLoad(value) {
521
- this._allowLoad = value;
522
- if (value === true && this._deferLoadCount === 0) {
523
- this._deferLoadCount++; // only do this one time
524
- if (this.Params)
525
- this.Refresh(this.Params);
526
- return;
527
- }
528
- }
529
- RefreshFromSavedParams() {
530
- return __awaiter(this, void 0, void 0, function* () {
531
- if (this.Params)
532
- this.Refresh(this.Params);
533
- });
534
- }
535
- Refresh(params) {
536
- var _a;
537
- return __awaiter(this, void 0, void 0, function* () {
538
- this.Params = params;
539
- if (this.AllowLoad === false) {
540
- return;
541
- }
542
- if (params && (params.ViewEntity || params.ViewID || params.ViewName || (params.EntityName && params.ExtraFilter))) {
543
- const startTime = new Date().getTime();
544
- this.isLoading = true;
545
- const md = new Metadata();
546
- const rv = new RunView();
547
- // 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
548
- // this is done for performance purposes
549
- if (!params.ViewEntity && (params.ViewID || params.ViewName)) {
550
- if (params.ViewID && params.ViewID > 0) {
551
- this._viewEntity = (yield ViewInfo.GetViewEntity(params.ViewID));
552
- this._entityInfo = md.Entities.find(x => { var _a; return x.ID === ((_a = this._viewEntity) === null || _a === void 0 ? void 0 : _a.Get('EntityID')); });
553
- }
554
- else if (params.ViewName) {
555
- this._viewEntity = (yield ViewInfo.GetViewEntityByName(params.ViewName));
556
- this._entityInfo = md.Entities.find(x => { var _a; return x.ID === ((_a = this._viewEntity) === null || _a === void 0 ? void 0 : _a.Get('EntityID')); });
557
- }
558
- params.ViewEntity = this._viewEntity;
559
- }
560
- else
561
- this._viewEntity = params.ViewEntity; //passed in via params in the Refresh() function
562
- const rvResult = yield rv.RunView(params);
563
- if (!rvResult.Success) {
564
- // it failed
565
- this.CreateSimpleNotification("Error running view:\n\n" + rvResult.ErrorMessage, 'error', 5000);
566
- }
567
- else {
568
- // it worked
569
- this.viewData = rvResult.Results;
570
- this.totalRowCount = rvResult.TotalRowCount;
571
- this.formattedData = new Array(this.viewData.length);
572
- if (this._viewEntity) {
573
- // we were passed the view entity for efficiency, no need to load it again!
574
- this._entityInfo = md.Entities.find(x => { var _a; return x.ID === ((_a = this._viewEntity) === null || _a === void 0 ? void 0 : _a.Get('EntityID')); });
575
- }
576
- else
577
- this._entityInfo = md.Entities.find(x => x.Name === params.EntityName);
578
- let cols;
579
- if (this._viewEntity)
580
- cols = this._viewEntity.Columns;
581
- else
582
- cols = (_a = this._entityInfo) === null || _a === void 0 ? void 0 : _a.Fields.filter((f) => f.DefaultInView).map((f) => {
583
- return {
584
- ID: f.ID,
585
- Name: f.Name,
586
- DisplayName: f.DisplayName,
587
- EntityField: f,
588
- hidden: false,
589
- orderIndex: f.Sequence,
590
- width: f.DefaultColumnWidth ? f.DefaultColumnWidth : 100,
591
- };
592
- });
593
- if (cols) {
594
- this.viewColumns = cols;
595
- const tempCols = cols.filter(x => x.hidden === false).sort((a, b) => {
596
- const aOrder = a.orderIndex != null ? a.orderIndex : 9999;
597
- const bOrder = b.orderIndex != null ? b.orderIndex : 9999;
598
- return aOrder - bOrder;
599
- });
600
- this.visibleColumns = tempCols;
601
- }
602
- // sorting setup
603
- if (this._viewEntity) {
604
- const temp = this._viewEntity.ViewSortInfo;
605
- const kendoSortSettings = temp.map((s) => { return { field: s.field, dir: s.direction === 1 ? 'asc' : 'desc' }; });
606
- this.sortSettings = kendoSortSettings;
607
- }
608
- this.skip = 0;
609
- this.virtualLoadData();
610
- }
611
- this.viewExecutionTime = (new Date().getTime() - startTime) / 1000; // in seconds
612
- this.isLoading = false;
613
- }
614
- else {
615
- LogError("Refresh(params) must have ViewID or ViewName or (EntityName and ExtraFilter)");
616
- }
617
- });
618
- }
619
- GetColumnTitle(col) {
620
- if (col.DisplayName)
621
- return col.DisplayName; // use view's display name first if it exists
622
- else if (col.EntityField.DisplayName)
623
- return col.EntityField.DisplayName; // then use entity display name, if that exist
624
- else
625
- return col.Name; // otherwise just use the column name
626
- }
627
- GetColumnCellStyle(col) {
628
- switch (col.EntityField.Type.trim().toLowerCase()) {
629
- case "money":
630
- case 'decimal':
631
- case 'real':
632
- case 'float':
633
- case 'int':
634
- return { 'text-align': 'right', 'vertical-align': 'top' }; // right align numbers,
635
- default:
636
- return { 'text-align': 'left', 'vertical-align': 'top' }; // left align everything else
637
- }
638
- }
639
- selectionChange(args) {
640
- var _a, _b, _c, _d;
641
- if (this.compareRecords.length && ((_a = args === null || args === void 0 ? void 0 : args.deselectedRows) === null || _a === void 0 ? void 0 : _a.length)) {
642
- const tempRow = (_b = args === null || args === void 0 ? void 0 : args.deselectedRows[0]) === null || _b === void 0 ? void 0 : _b.dataItem;
643
- this.compareRecords = this.compareRecords.filter(record => record.ID !== (tempRow === null || tempRow === void 0 ? void 0 : tempRow.ID));
644
- }
645
- else if ((_c = args === null || args === void 0 ? void 0 : args.selectedRows) === null || _c === void 0 ? void 0 : _c.length) {
646
- const tempRow = (_d = args === null || args === void 0 ? void 0 : args.selectedRows[0]) === null || _d === void 0 ? void 0 : _d.dataItem;
647
- this.compareRecords.push(tempRow);
648
- }
649
- }
650
- enableCompare(cancel = false) {
651
- if (!cancel && this.selectedKeys.length) {
652
- this.isDialogOpened = true;
653
- }
654
- this.compareMode = !this.compareMode;
655
- this.selectedKeys = [];
656
- }
657
- closeDialog() {
658
- this.isDialogOpened = false;
659
- this.compareRecords = [];
660
- }
661
- doExcelExport() {
662
- return __awaiter(this, void 0, void 0, function* () {
663
- if (this.kendoExcelExport === null)
664
- throw new Error("kendoExcelExport is null, cannot export data");
665
- try {
666
- this.CreateSimpleNotification("Working on the export, will notify you when it is complete...", 'info', 2000);
667
- const data = yield this.getExportData();
668
- // we have the data.
669
- const cols = this.viewColumns.filter((vc) => vc.hidden === false);
670
- this.exportColumns = cols;
671
- this.exportData = data;
672
- // before we call the save, we need to let Angular do its thing that will result in the kendoExcelExport component binding properly to
673
- // the exportColumns and exportData arrays. So we wait for the next tick before we call save()
674
- setTimeout(() => {
675
- this.kendoExcelExport.save();
676
- this.CreateSimpleNotification("Excel Export Complete", 'success', 2000);
677
- }, 100);
678
- }
679
- catch (e) {
680
- this.CreateSimpleNotification("Error exporting data", 'error', 5000);
681
- LogError(e);
682
- }
683
- });
684
- }
685
- getExportData() {
686
- return __awaiter(this, void 0, void 0, function* () {
687
- // Get the data for the ENTIRE view, not just the current page
688
- const md = new Metadata();
689
- const rv = new RunView();
690
- 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}` });
691
- const result = yield rv.RunView(p);
692
- if (result && result.Success) {
693
- return result.Results;
694
- }
695
- else
696
- throw new Error("Unable to get export data");
697
- });
698
- }
699
- }
700
- UserViewGridComponent.ɵfac = function UserViewGridComponent_Factory(t) { return new (t || UserViewGridComponent)(i0.ɵɵdirectiveInject(i1.FormBuilder), i0.ɵɵdirectiveInject(i2.Router)); };
701
- UserViewGridComponent.ɵcmp = /*@__PURE__*/ i0.ɵɵdefineComponent({ type: UserViewGridComponent, selectors: [["mj-user-view-grid"]], viewQuery: function UserViewGridComponent_Query(rf, ctx) { if (rf & 1) {
702
- i0.ɵɵviewQuery(_c0, 5, GridComponent);
703
- i0.ɵɵviewQuery(_c0, 5, ElementRef);
704
- i0.ɵɵviewQuery(_c1, 5, ExcelExportComponent);
705
- } if (rf & 2) {
706
- let _t;
707
- i0.ɵɵqueryRefresh(_t = i0.ɵɵloadQuery()) && (ctx.kendoGridElement = _t.first);
708
- i0.ɵɵqueryRefresh(_t = i0.ɵɵloadQuery()) && (ctx.kendoGridElementRef = _t.first);
709
- i0.ɵɵqueryRefresh(_t = i0.ɵɵloadQuery()) && (ctx.kendoExcelExport = _t.first);
710
- } }, 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, "disabled", "click"], ["class", "k-button k-button-md k-rounded-md k-button-solid-base k-button-solid", 3, "click", 4, "ngIf"], [1, "k-button", "k-button-md", "k-rounded-md", "k-button-solid-base", "k-button-solid", 3, "disabled", "click"], ["kendoButton", "", "icon", "refresh", 3, "primary", "click", 4, "ngIf"], [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, "width", "minHeight", "minWidth", "resizable", "close", 4, "ngIf"], ["title", "Compare Records", 3, "width", "minHeight", "minWidth", "resizable", "close"], [1, "k-d-flex", "k-flex-col", "k-justify-content-between", "k-h-full"], [3, "recordsToCompare", "visibleColumns"]], template: function UserViewGridComponent_Template(rf, ctx) { if (rf & 1) {
711
- i0.ɵɵelementStart(0, "div", 0)(1, "kendo-grid", 1, 2);
712
- 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); });
713
- i0.ɵɵtemplate(3, UserViewGridComponent_ng_template_3_Template, 6, 4, "ng-template", 3);
714
- i0.ɵɵtemplate(4, UserViewGridComponent_kendo_grid_checkbox_column_4_Template, 1, 6, "kendo-grid-checkbox-column", 4);
715
- i0.ɵɵtemplate(5, UserViewGridComponent_kendo_grid_column_5_Template, 2, 10, "kendo-grid-column", 5);
716
- i0.ɵɵelementStart(6, "kendo-excelexport", 6, 7);
717
- i0.ɵɵtemplate(8, UserViewGridComponent_kendo_excelexport_column_8_Template, 1, 2, "kendo-excelexport-column", 8);
718
- i0.ɵɵelementEnd()()();
719
- i0.ɵɵtemplate(9, UserViewGridComponent_div_9_Template, 3, 1, "div", 9);
720
- } if (rf & 2) {
721
- i0.ɵɵadvance(1);
722
- 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);
723
- i0.ɵɵadvance(3);
724
- i0.ɵɵproperty("ngIf", ctx.compareMode);
725
- i0.ɵɵadvance(1);
726
- i0.ɵɵproperty("ngForOf", ctx.visibleColumns);
727
- i0.ɵɵadvance(1);
728
- i0.ɵɵproperty("data", ctx.exportData)("fileName", (ctx._viewEntity ? ctx._viewEntity.Get("Name") : ctx._entityInfo == null ? null : ctx._entityInfo.Name) + ".xlsx");
729
- i0.ɵɵadvance(2);
730
- i0.ɵɵproperty("ngForOf", ctx.exportColumns);
731
- i0.ɵɵadvance(1);
732
- i0.ɵɵproperty("ngIf", ctx.isDialogOpened);
733
- } }, dependencies: [i3.NgForOf, i3.NgIf, i4.GridComponent, i4.ToolbarTemplateDirective, i4.SelectionDirective, i4.ColumnComponent, i4.FooterTemplateDirective, i4.CheckboxColumnComponent, i5.WindowComponent, i6.ExcelExportComponent, i6.ColumnComponent, i7.Button, i8.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}"] });
734
- (function () { (typeof ngDevMode === "undefined" || ngDevMode) && i0.ɵsetClassMetadata(UserViewGridComponent, [{
735
- type: Component,
736
- 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\" [disabled]=\"compareMode\" (click)=\"doExcelExport()\" >Export to Excel</button>\r\n <button (click)=\"enableCompare(true)\" *ngIf=\"compareMode\" class=\"k-button k-button-md k-rounded-md k-button-solid-base k-button-solid\">Cancel</button>\r\n <button (click)=\"enableCompare()\" [disabled]=\"compareMode && compareRecords.length < 2\" class=\"k-button k-button-md k-rounded-md k-button-solid-base k-button-solid\">Compare</button>\r\n <button\r\n kendoButton\r\n [primary]=\"true\"\r\n icon=\"refresh\"\r\n *ngIf=\"showRefreshButton\"\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\" \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=\"isDialogOpened\">\r\n <div class=\"k-overlay\"></div>\r\n <kendo-window\r\n [width]=\"900\"\r\n [minHeight]=\"300\"\r\n [minWidth]=\"400\"\r\n [resizable]=\"true\"\r\n (close)=\"closeDialog()\"\r\n title=\"Compare Records\"\r\n *ngIf=\"isDialogOpened\"\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-record-compare [recordsToCompare]=\"compareRecords\" [visibleColumns]=\"visibleColumns\" ></mj-record-compare>\r\n </div>\r\n </div>\r\n </kendo-window>\r\n</div>\r\n ", styles: [".user-view-grid-wrap {\r\n height: calc(100vh-20px);\r\n}\r\n\r\n.user-view-grid-column-header {\r\n background-color: #a9c2af;\r\n font-size: 20pt;\r\n font-weight: bold;\r\n}"] }]
737
- }], function () { return [{ type: i1.FormBuilder }, { type: i2.Router }]; }, { Params: [{
738
- type: Input
739
- }], BottomMargin: [{
740
- type: Input
741
- }], InEditMode: [{
742
- type: Input
743
- }], EditMode: [{
744
- type: Input
745
- }], AutoNavigate: [{
746
- type: Input
747
- }], rowClicked: [{
748
- type: Output
749
- }], rowEdited: [{
750
- type: Output
751
- }], kendoGridElement: [{
752
- type: ViewChild,
753
- args: ['kendoGrid', { read: GridComponent }]
754
- }], kendoGridElementRef: [{
755
- type: ViewChild,
756
- args: ['kendoGrid', { read: ElementRef }]
757
- }], kendoExcelExport: [{
758
- type: ViewChild,
759
- args: ['excelExport', { read: ExcelExportComponent }]
760
- }], AllowLoad: [{
761
- type: Input
762
- }] }); })();
@@ -1,16 +0,0 @@
1
- import * as i0 from "@angular/core";
2
- import * as i1 from "./ng-user-view-grid.component";
3
- import * as i2 from "@angular/common";
4
- import * as i3 from "@angular/forms";
5
- import * as i4 from "@angular/router";
6
- import * as i5 from "@progress/kendo-angular-grid";
7
- import * as i6 from "@progress/kendo-angular-dialog";
8
- import * as i7 from "@progress/kendo-angular-excel-export";
9
- import * as i8 from "@progress/kendo-angular-buttons";
10
- import * as i9 from "@memberjunction/ng-compare-records";
11
- import * as i10 from "@memberjunction/ng-container-directives";
12
- export declare class UserViewGridModule {
13
- static ɵfac: i0.ɵɵFactoryDeclaration<UserViewGridModule, never>;
14
- static ɵmod: i0.ɵɵNgModuleDeclaration<UserViewGridModule, [typeof i1.UserViewGridComponent], [typeof i2.CommonModule, typeof i3.FormsModule, typeof i3.ReactiveFormsModule, typeof i4.RouterModule, typeof i5.GridModule, typeof i6.DialogsModule, typeof i7.ExcelExportModule, typeof i8.ButtonsModule, typeof i9.CompareRecordsModule, typeof i10.ContainerDirectivesModule], [typeof i1.UserViewGridComponent]>;
15
- static ɵinj: i0.ɵɵInjectorDeclaration<UserViewGridModule>;
16
- }
@@ -1,60 +0,0 @@
1
- import { NgModule } from '@angular/core';
2
- import { UserViewGridComponent } from './ng-user-view-grid.component';
3
- import { CommonModule } from '@angular/common';
4
- import { FormsModule, ReactiveFormsModule } from '@angular/forms';
5
- import { RouterModule } from '@angular/router';
6
- // Kendo UI Angular imports
7
- import { GridModule } from '@progress/kendo-angular-grid';
8
- import { ExcelExportModule } from '@progress/kendo-angular-excel-export';
9
- import { DialogsModule } from "@progress/kendo-angular-dialog";
10
- import { ButtonsModule } from '@progress/kendo-angular-buttons';
11
- import { CompareRecordsModule } from '@memberjunction/ng-compare-records';
12
- import { ContainerDirectivesModule } from '@memberjunction/ng-container-directives';
13
- import * as i0 from "@angular/core";
14
- export class UserViewGridModule {
15
- }
16
- UserViewGridModule.ɵfac = function UserViewGridModule_Factory(t) { return new (t || UserViewGridModule)(); };
17
- UserViewGridModule.ɵmod = /*@__PURE__*/ i0.ɵɵdefineNgModule({ type: UserViewGridModule });
18
- UserViewGridModule.ɵinj = /*@__PURE__*/ i0.ɵɵdefineInjector({ imports: [CommonModule,
19
- FormsModule,
20
- ReactiveFormsModule,
21
- RouterModule,
22
- GridModule,
23
- DialogsModule,
24
- ExcelExportModule,
25
- ButtonsModule,
26
- CompareRecordsModule,
27
- ContainerDirectivesModule] });
28
- (function () { (typeof ngDevMode === "undefined" || ngDevMode) && i0.ɵsetClassMetadata(UserViewGridModule, [{
29
- type: NgModule,
30
- args: [{
31
- declarations: [
32
- UserViewGridComponent
33
- ],
34
- imports: [
35
- CommonModule,
36
- FormsModule,
37
- ReactiveFormsModule,
38
- RouterModule,
39
- GridModule,
40
- DialogsModule,
41
- ExcelExportModule,
42
- ButtonsModule,
43
- CompareRecordsModule,
44
- ContainerDirectivesModule
45
- ],
46
- exports: [
47
- UserViewGridComponent
48
- ]
49
- }]
50
- }], null, null); })();
51
- (function () { (typeof ngJitMode === "undefined" || ngJitMode) && i0.ɵɵsetNgModuleScope(UserViewGridModule, { declarations: [UserViewGridComponent], imports: [CommonModule,
52
- FormsModule,
53
- ReactiveFormsModule,
54
- RouterModule,
55
- GridModule,
56
- DialogsModule,
57
- ExcelExportModule,
58
- ButtonsModule,
59
- CompareRecordsModule,
60
- ContainerDirectivesModule], exports: [UserViewGridComponent] }); })();
@@ -1,2 +0,0 @@
1
- export * from './lib/ng-user-view-grid.component';
2
- export * from './lib/ng-user-view-grid.module';
@@ -1,5 +0,0 @@
1
- /*
2
- * Public API Surface of ng-user-view-grid
3
- */
4
- export * from './lib/ng-user-view-grid.component';
5
- export * from './lib/ng-user-view-grid.module';