@memberjunction/ng-explorer-core 0.9.79 → 0.9.116

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (105) hide show
  1. package/dist/lib/ask-skip/ask-skip.component.d.ts +87 -86
  2. package/dist/lib/ask-skip/ask-skip.component.js +615 -580
  3. package/dist/lib/ask-skip/skip-dynamic-report-wrapper.d.ts +12 -12
  4. package/dist/lib/ask-skip/skip-dynamic-report-wrapper.js +40 -39
  5. package/dist/lib/auth-button/auth-button.component.d.ts +12 -12
  6. package/dist/lib/auth-button/auth-button.component.js +44 -43
  7. package/dist/lib/dashboard-browser-component/dashboard-browser.component.d.ts +18 -18
  8. package/dist/lib/dashboard-browser-component/dashboard-browser.component.js +118 -117
  9. package/dist/lib/data-browser-component/data-browser.component.d.ts +16 -14
  10. package/dist/lib/data-browser-component/data-browser.component.js +96 -91
  11. package/dist/lib/favorites/favorites.component.d.ts +14 -14
  12. package/dist/lib/favorites/favorites.component.js +114 -114
  13. package/dist/lib/generic/base-form-component.d.ts +76 -76
  14. package/dist/lib/generic/base-form-component.js +436 -436
  15. package/dist/lib/generic/base-form-section-component.d.ts +6 -6
  16. package/dist/lib/generic/base-form-section-component.js +9 -9
  17. package/dist/lib/generic/base-record-component.d.ts +6 -6
  18. package/dist/lib/generic/base-record-component.js +15 -15
  19. package/dist/lib/generic/base-resource-component.d.ts +34 -34
  20. package/dist/lib/generic/base-resource-component.js +75 -75
  21. package/dist/lib/generic/dynamic-chart.d.ts +33 -33
  22. package/dist/lib/generic/dynamic-chart.js +236 -235
  23. package/dist/lib/generic/dynamic-grid.d.ts +25 -25
  24. package/dist/lib/generic/dynamic-grid.js +120 -119
  25. package/dist/lib/generic/dynamic-report.d.ts +38 -38
  26. package/dist/lib/generic/dynamic-report.js +353 -347
  27. package/dist/lib/generic/form-toolbar.d.ts +7 -7
  28. package/dist/lib/generic/form-toolbar.js +85 -89
  29. package/dist/lib/generic/resource-container-component.d.ts +25 -25
  30. package/dist/lib/generic/resource-container-component.js +104 -103
  31. package/dist/lib/generic/section-loader-component.d.ts +17 -17
  32. package/dist/lib/generic/section-loader-component.js +66 -65
  33. package/dist/lib/generic-browse-list/generic-browse-list.component.d.ts +26 -24
  34. package/dist/lib/generic-browse-list/generic-browse-list.component.js +145 -143
  35. package/dist/lib/guards/auth-guard.service.d.ts +11 -11
  36. package/dist/lib/guards/auth-guard.service.js +24 -24
  37. package/dist/lib/guards/entities.guard.d.ts +3 -3
  38. package/dist/lib/guards/entities.guard.js +38 -38
  39. package/dist/lib/header/MSFT_UserImageService.d.ts +11 -11
  40. package/dist/lib/header/MSFT_UserImageService.js +23 -23
  41. package/dist/lib/header/header.component.d.ts +51 -51
  42. package/dist/lib/header/header.component.js +220 -208
  43. package/dist/lib/home-component/home.component.d.ts +11 -9
  44. package/dist/lib/home-component/home.component.js +77 -54
  45. package/dist/lib/join-grid/join-grid.component.d.ts +30 -30
  46. package/dist/lib/join-grid/join-grid.component.js +222 -225
  47. package/dist/lib/navigation/navigation.component.d.ts +104 -103
  48. package/dist/lib/navigation/navigation.component.js +1026 -1004
  49. package/dist/lib/query-browser-component/query-browser.component.d.ts +14 -0
  50. package/dist/lib/query-browser-component/query-browser.component.js +56 -0
  51. package/dist/lib/report-browser-component/report-browser.component.d.ts +14 -14
  52. package/dist/lib/report-browser-component/report-browser.component.js +56 -55
  53. package/dist/lib/resource-wrappers/dashboard-resource.component.d.ts +8 -8
  54. package/dist/lib/resource-wrappers/dashboard-resource.component.js +51 -50
  55. package/dist/lib/resource-wrappers/query-resource.component.d.ts +10 -0
  56. package/dist/lib/resource-wrappers/query-resource.component.js +55 -0
  57. package/dist/lib/resource-wrappers/record-resource.component.d.ts +10 -10
  58. package/dist/lib/resource-wrappers/record-resource.component.js +71 -70
  59. package/dist/lib/resource-wrappers/report-resource.component.d.ts +10 -10
  60. package/dist/lib/resource-wrappers/report-resource.component.js +55 -54
  61. package/dist/lib/resource-wrappers/resource-wrappers-loader.d.ts +1 -1
  62. package/dist/lib/resource-wrappers/resource-wrappers-loader.js +14 -12
  63. package/dist/lib/resource-wrappers/search-results-resource.component.d.ts +10 -10
  64. package/dist/lib/resource-wrappers/search-results-resource.component.js +52 -51
  65. package/dist/lib/resource-wrappers/view-resource.component.d.ts +8 -8
  66. package/dist/lib/resource-wrappers/view-resource.component.js +61 -60
  67. package/dist/lib/settings/settings.component.d.ts +5 -5
  68. package/dist/lib/settings/settings.component.js +15 -14
  69. package/dist/lib/single-application/single-application.component.d.ts +20 -20
  70. package/dist/lib/single-application/single-application.component.js +113 -113
  71. package/dist/lib/single-dashboard/Components/add-item/add-item.component.d.ts +28 -28
  72. package/dist/lib/single-dashboard/Components/add-item/add-item.component.js +210 -212
  73. package/dist/lib/single-dashboard/Components/delete-item/delete-item.component.d.ts +13 -13
  74. package/dist/lib/single-dashboard/Components/delete-item/delete-item.component.js +60 -59
  75. package/dist/lib/single-dashboard/Components/edit-dashboard/edit-dashboard.component.d.ts +26 -26
  76. package/dist/lib/single-dashboard/Components/edit-dashboard/edit-dashboard.component.js +170 -169
  77. package/dist/lib/single-dashboard/single-dashboard.component.d.ts +75 -75
  78. package/dist/lib/single-dashboard/single-dashboard.component.js +464 -456
  79. package/dist/lib/single-entity/single-entity.component.d.ts +33 -33
  80. package/dist/lib/single-entity/single-entity.component.js +258 -252
  81. package/dist/lib/single-query/single-query.component.d.ts +16 -0
  82. package/dist/lib/single-query/single-query.component.js +70 -0
  83. package/dist/lib/single-record/single-record.component.d.ts +21 -21
  84. package/dist/lib/single-record/single-record.component.js +95 -95
  85. package/dist/lib/single-report/single-report.component.d.ts +21 -22
  86. package/dist/lib/single-report/single-report.component.js +89 -87
  87. package/dist/lib/single-search-result/single-search-result.component.d.ts +15 -15
  88. package/dist/lib/single-search-result/single-search-result.component.js +61 -60
  89. package/dist/lib/single-view/single-view.component.d.ts +38 -38
  90. package/dist/lib/single-view/single-view.component.js +201 -201
  91. package/dist/lib/user-notifications/user-notifications.component.d.ts +32 -32
  92. package/dist/lib/user-notifications/user-notifications.component.js +282 -282
  93. package/dist/lib/user-profile/user-profile.component.d.ts +10 -10
  94. package/dist/lib/user-profile/user-profile.component.js +42 -41
  95. package/dist/lib/user-view-properties/view-properties-dialog.component.d.ts +71 -71
  96. package/dist/lib/user-view-properties/view-properties-dialog.component.js +594 -581
  97. package/dist/module.d.ts +65 -65
  98. package/dist/module.js +328 -338
  99. package/dist/public-api.d.ts +42 -47
  100. package/dist/public-api.js +45 -50
  101. package/dist/shared/shared.service.d.ts +94 -92
  102. package/dist/shared/shared.service.js +324 -318
  103. package/dist/shared/urlPipe.d.ts +7 -7
  104. package/dist/shared/urlPipe.js +16 -16
  105. package/package.json +24 -15
@@ -1,581 +1,594 @@
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, EventEmitter, Input, Output, ViewChild } from '@angular/core';
11
- import { Metadata } from "@memberjunction/core";
12
- import { BaseFormComponent } from '../generic/base-form-component';
13
- import { ResourceData } from '../generic/base-resource-component';
14
- import { WindowComponent } from '@progress/kendo-angular-dialog';
15
- import { TabComponent } from '@progress/kendo-angular-layout';
16
- import { MJEventType, MJGlobal } from '@memberjunction/global';
17
- import { EventCodes } from '../../shared/shared.service';
18
- import * as i0 from "@angular/core";
19
- import * as i1 from "@angular/router";
20
- import * as i2 from "../../shared/shared.service";
21
- import * as i3 from "@angular/forms";
22
- import * as i4 from "@angular/common";
23
- import * as i5 from "@progress/kendo-angular-dialog";
24
- import * as i6 from "@progress/kendo-angular-buttons";
25
- import * as i7 from "@progress/kendo-angular-indicators";
26
- import * as i8 from "@progress/kendo-angular-layout";
27
- import * as i9 from "@progress/kendo-angular-inputs";
28
- import * as i10 from "@progress/kendo-angular-label";
29
- import * as i11 from "@progress/kendo-angular-icons";
30
- import * as i12 from "@memberjunction/ng-container-directives";
31
- import * as i13 from "@progress/kendo-angular-sortable";
32
- import * as i14 from "@progress/kendo-angular-filter";
33
- import * as i15 from "@progress/kendo-angular-dropdowns";
34
- const _c0 = ["nameField"];
35
- const _c1 = ["dialogContainer"];
36
- function ViewPropertiesDialogComponent_button_1_Template(rf, ctx) { if (rf & 1) {
37
- const _r4 = i0.ɵɵgetCurrentView();
38
- i0.ɵɵelementStart(0, "button", 3);
39
- i0.ɵɵlistener("click", function ViewPropertiesDialogComponent_button_1_Template_button_click_0_listener() { i0.ɵɵrestoreView(_r4); const ctx_r3 = i0.ɵɵnextContext(); return i0.ɵɵresetView(ctx_r3.Open()); });
40
- i0.ɵɵtext(1, "Properties");
41
- i0.ɵɵelementEnd();
42
- } if (rf & 2) {
43
- i0.ɵɵproperty("primary", true);
44
- } }
45
- function ViewPropertiesDialogComponent_div_2_Template(rf, ctx) { if (rf & 1) {
46
- i0.ɵɵelement(0, "div", 4);
47
- } }
48
- function ViewPropertiesDialogComponent_kendo_window_3_kendo_loader_1_Template(rf, ctx) { if (rf & 1) {
49
- i0.ɵɵelement(0, "kendo-loader", 19);
50
- } }
51
- function ViewPropertiesDialogComponent_kendo_window_3_ng_template_7_Template(rf, ctx) { if (rf & 1) {
52
- const _r14 = i0.ɵɵgetCurrentView();
53
- i0.ɵɵelementStart(0, "div", 20)(1, "div", 21);
54
- i0.ɵɵelement(2, "kendo-label", 22);
55
- i0.ɵɵelementStart(3, "kendo-textbox", 23, 24);
56
- i0.ɵɵlistener("ngModelChange", function ViewPropertiesDialogComponent_kendo_window_3_ng_template_7_Template_kendo_textbox_ngModelChange_3_listener($event) { i0.ɵɵrestoreView(_r14); const ctx_r13 = i0.ɵɵnextContext(2); return i0.ɵɵresetView(ctx_r13.record.Name = $event); });
57
- i0.ɵɵelementEnd()();
58
- i0.ɵɵelementStart(5, "div", 25);
59
- i0.ɵɵelement(6, "kendo-label", 26);
60
- i0.ɵɵelementStart(7, "textarea", 27);
61
- i0.ɵɵlistener("ngModelChange", function ViewPropertiesDialogComponent_kendo_window_3_ng_template_7_Template_textarea_ngModelChange_7_listener($event) { i0.ɵɵrestoreView(_r14); const ctx_r15 = i0.ɵɵnextContext(2); return i0.ɵɵresetView(ctx_r15.record.Description = $event); });
62
- i0.ɵɵelementEnd()()();
63
- } if (rf & 2) {
64
- const ctx_r7 = i0.ɵɵnextContext(2);
65
- i0.ɵɵadvance(3);
66
- i0.ɵɵproperty("ngModel", ctx_r7.record.Name);
67
- i0.ɵɵadvance(4);
68
- i0.ɵɵproperty("ngModel", ctx_r7.record.Description);
69
- } }
70
- function ViewPropertiesDialogComponent_kendo_window_3_ng_template_9_ng_template_1_Template(rf, ctx) { if (rf & 1) {
71
- const _r19 = i0.ɵɵgetCurrentView();
72
- i0.ɵɵelementStart(0, "div", 29)(1, "div")(2, "input", 30);
73
- i0.ɵɵlistener("ngModelChange", function ViewPropertiesDialogComponent_kendo_window_3_ng_template_9_ng_template_1_Template_input_ngModelChange_2_listener($event) { const restoredCtx = i0.ɵɵrestoreView(_r19); const col_r17 = restoredCtx.item; return i0.ɵɵresetView(!(col_r17.hidden = $event)); })("change", function ViewPropertiesDialogComponent_kendo_window_3_ng_template_9_ng_template_1_Template_input_change_2_listener() { const restoredCtx = i0.ɵɵrestoreView(_r19); const col_r17 = restoredCtx.item; const ctx_r20 = i0.ɵɵnextContext(3); return i0.ɵɵresetView(ctx_r20.toggleColumn(col_r17)); });
74
- i0.ɵɵelementEnd();
75
- i0.ɵɵelement(3, "kendo-label", 31);
76
- i0.ɵɵelementEnd();
77
- i0.ɵɵelement(4, "kendo-icon", 32);
78
- i0.ɵɵelementEnd();
79
- } if (rf & 2) {
80
- const col_r17 = ctx.item;
81
- i0.ɵɵadvance(2);
82
- i0.ɵɵpropertyInterpolate1("id", "column_", col_r17.ID, "");
83
- i0.ɵɵproperty("ngModel", !col_r17.hidden);
84
- i0.ɵɵadvance(1);
85
- i0.ɵɵproperty("for", "column_" + col_r17.ID)("text", col_r17.DisplayName ? col_r17.DisplayName : col_r17.Name);
86
- } }
87
- function ViewPropertiesDialogComponent_kendo_window_3_ng_template_9_Template(rf, ctx) { if (rf & 1) {
88
- const _r22 = i0.ɵɵgetCurrentView();
89
- i0.ɵɵelementStart(0, "kendo-sortable", 28);
90
- i0.ɵɵlistener("dragEnd", function ViewPropertiesDialogComponent_kendo_window_3_ng_template_9_Template_kendo_sortable_dragEnd_0_listener($event) { i0.ɵɵrestoreView(_r22); const ctx_r21 = i0.ɵɵnextContext(2); return i0.ɵɵresetView(ctx_r21.onDragEnd($event)); });
91
- i0.ɵɵtemplate(1, ViewPropertiesDialogComponent_kendo_window_3_ng_template_9_ng_template_1_Template, 5, 4, "ng-template");
92
- i0.ɵɵelementEnd();
93
- } if (rf & 2) {
94
- const ctx_r8 = i0.ɵɵnextContext(2);
95
- i0.ɵɵproperty("kendoSortableBinding", ctx_r8.localGridState.columnSettings)("animation", true);
96
- } }
97
- function ViewPropertiesDialogComponent_kendo_window_3_ng_template_11_div_3_Template(rf, ctx) { if (rf & 1) {
98
- const _r26 = i0.ɵɵgetCurrentView();
99
- i0.ɵɵelementStart(0, "div", 38)(1, "kendo-textarea", 39);
100
- i0.ɵɵlistener("ngModelChange", function ViewPropertiesDialogComponent_kendo_window_3_ng_template_11_div_3_Template_kendo_textarea_ngModelChange_1_listener($event) { i0.ɵɵrestoreView(_r26); const ctx_r25 = i0.ɵɵnextContext(3); return i0.ɵɵresetView(ctx_r25.record.SmartFilterPrompt = $event); });
101
- i0.ɵɵelementEnd()();
102
- } if (rf & 2) {
103
- const ctx_r23 = i0.ɵɵnextContext(3);
104
- i0.ɵɵproperty("fillHeight", true);
105
- i0.ɵɵadvance(1);
106
- i0.ɵɵproperty("rows", 10)("ngModel", ctx_r23.record.SmartFilterPrompt);
107
- } }
108
- function ViewPropertiesDialogComponent_kendo_window_3_ng_template_11_div_4_Template(rf, ctx) { if (rf & 1) {
109
- const _r28 = i0.ɵɵgetCurrentView();
110
- i0.ɵɵelementStart(0, "div")(1, "kendo-filter", 40);
111
- i0.ɵɵlistener("valueChange", function ViewPropertiesDialogComponent_kendo_window_3_ng_template_11_div_4_Template_kendo_filter_valueChange_1_listener($event) { i0.ɵɵrestoreView(_r28); const ctx_r27 = i0.ɵɵnextContext(3); return i0.ɵɵresetView(ctx_r27.onFilterChange($event)); });
112
- i0.ɵɵelementEnd()();
113
- } if (rf & 2) {
114
- const ctx_r24 = i0.ɵɵnextContext(3);
115
- i0.ɵɵadvance(1);
116
- i0.ɵɵproperty("filters", ctx_r24.ViewEntityInfo.Fields.map(ctx_r24.toKendoFilterField))("value", ctx_r24.defaultFilterState);
117
- } }
118
- function ViewPropertiesDialogComponent_kendo_window_3_ng_template_11_Template(rf, ctx) { if (rf & 1) {
119
- const _r30 = i0.ɵɵgetCurrentView();
120
- i0.ɵɵelementStart(0, "div", 33);
121
- i0.ɵɵelement(1, "kendo-label", 34);
122
- i0.ɵɵelementStart(2, "kendo-switch", 35);
123
- i0.ɵɵlistener("ngModelChange", function ViewPropertiesDialogComponent_kendo_window_3_ng_template_11_Template_kendo_switch_ngModelChange_2_listener($event) { i0.ɵɵrestoreView(_r30); const ctx_r29 = i0.ɵɵnextContext(2); return i0.ɵɵresetView(ctx_r29.record.SmartFilterEnabled = $event); });
124
- i0.ɵɵelementEnd()();
125
- i0.ɵɵtemplate(3, ViewPropertiesDialogComponent_kendo_window_3_ng_template_11_div_3_Template, 2, 3, "div", 36);
126
- i0.ɵɵtemplate(4, ViewPropertiesDialogComponent_kendo_window_3_ng_template_11_div_4_Template, 2, 2, "div", 37);
127
- } if (rf & 2) {
128
- const ctx_r9 = i0.ɵɵnextContext(2);
129
- i0.ɵɵadvance(2);
130
- i0.ɵɵproperty("ngModel", ctx_r9.record.SmartFilterEnabled);
131
- i0.ɵɵadvance(1);
132
- i0.ɵɵproperty("ngIf", ctx_r9.record.SmartFilterEnabled);
133
- i0.ɵɵadvance(1);
134
- i0.ɵɵproperty("ngIf", !ctx_r9.record.SmartFilterEnabled);
135
- } }
136
- function ViewPropertiesDialogComponent_kendo_window_3_ng_template_13_div_2_Template(rf, ctx) { if (rf & 1) {
137
- const _r34 = i0.ɵɵgetCurrentView();
138
- i0.ɵɵelementStart(0, "div")(1, "kendo-dropdownlist", 44);
139
- i0.ɵɵlistener("valueChange", function ViewPropertiesDialogComponent_kendo_window_3_ng_template_13_div_2_Template_kendo_dropdownlist_valueChange_1_listener($event) { const restoredCtx = i0.ɵɵrestoreView(_r34); const s_r32 = restoredCtx.$implicit; const ctx_r33 = i0.ɵɵnextContext(3); return i0.ɵɵresetView(ctx_r33.sortColumnValueChange(s_r32, $event)); })("ngModelChange", function ViewPropertiesDialogComponent_kendo_window_3_ng_template_13_div_2_Template_kendo_dropdownlist_ngModelChange_1_listener($event) { const restoredCtx = i0.ɵɵrestoreView(_r34); const s_r32 = restoredCtx.$implicit; return i0.ɵɵresetView(s_r32.field = $event); });
140
- i0.ɵɵelementEnd();
141
- i0.ɵɵelementStart(2, "kendo-dropdownlist", 45);
142
- i0.ɵɵlistener("valueChange", function ViewPropertiesDialogComponent_kendo_window_3_ng_template_13_div_2_Template_kendo_dropdownlist_valueChange_2_listener($event) { const restoredCtx = i0.ɵɵrestoreView(_r34); const s_r32 = restoredCtx.$implicit; const ctx_r36 = i0.ɵɵnextContext(3); return i0.ɵɵresetView(ctx_r36.sortDirectionValueChange(s_r32, $event)); })("ngModelChange", function ViewPropertiesDialogComponent_kendo_window_3_ng_template_13_div_2_Template_kendo_dropdownlist_ngModelChange_2_listener($event) { const restoredCtx = i0.ɵɵrestoreView(_r34); const s_r32 = restoredCtx.$implicit; return i0.ɵɵresetView(s_r32.direction = $event); });
143
- i0.ɵɵelementEnd();
144
- i0.ɵɵelementStart(3, "button", 46);
145
- i0.ɵɵlistener("click", function ViewPropertiesDialogComponent_kendo_window_3_ng_template_13_div_2_Template_button_click_3_listener() { const restoredCtx = i0.ɵɵrestoreView(_r34); const s_r32 = restoredCtx.$implicit; const ctx_r38 = i0.ɵɵnextContext(3); return i0.ɵɵresetView(ctx_r38.removeSort(s_r32)); });
146
- i0.ɵɵelementEnd()();
147
- } if (rf & 2) {
148
- const s_r32 = ctx.$implicit;
149
- const ctx_r31 = i0.ɵɵnextContext(3);
150
- i0.ɵɵadvance(1);
151
- i0.ɵɵproperty("data", ctx_r31.sortFields)("ngModel", s_r32.field);
152
- i0.ɵɵadvance(1);
153
- i0.ɵɵproperty("data", ctx_r31.sortDirections)("ngModel", s_r32.direction);
154
- } }
155
- function ViewPropertiesDialogComponent_kendo_window_3_ng_template_13_Template(rf, ctx) { if (rf & 1) {
156
- const _r40 = i0.ɵɵgetCurrentView();
157
- i0.ɵɵelementStart(0, "div", 41)(1, "button", 42);
158
- i0.ɵɵlistener("click", function ViewPropertiesDialogComponent_kendo_window_3_ng_template_13_Template_button_click_1_listener() { i0.ɵɵrestoreView(_r40); const ctx_r39 = i0.ɵɵnextContext(2); return i0.ɵɵresetView(ctx_r39.addSort()); });
159
- i0.ɵɵelementEnd()();
160
- i0.ɵɵtemplate(2, ViewPropertiesDialogComponent_kendo_window_3_ng_template_13_div_2_Template, 4, 4, "div", 43);
161
- } if (rf & 2) {
162
- const ctx_r10 = i0.ɵɵnextContext(2);
163
- i0.ɵɵadvance(2);
164
- i0.ɵɵproperty("ngForOf", ctx_r10.sortState);
165
- } }
166
- function ViewPropertiesDialogComponent_kendo_window_3_ng_template_15_div_0_Template(rf, ctx) { if (rf & 1) {
167
- const _r44 = i0.ɵɵgetCurrentView();
168
- i0.ɵɵelementStart(0, "div")(1, "kendo-textarea", 48);
169
- i0.ɵɵlistener("ngModelChange", function ViewPropertiesDialogComponent_kendo_window_3_ng_template_15_div_0_Template_kendo_textarea_ngModelChange_1_listener($event) { i0.ɵɵrestoreView(_r44); const ctx_r43 = i0.ɵɵnextContext(3); return i0.ɵɵresetView(ctx_r43.record.SmartFilterExplanation = $event); });
170
- i0.ɵɵelementEnd();
171
- i0.ɵɵelementStart(2, "kendo-textarea", 48);
172
- i0.ɵɵlistener("ngModelChange", function ViewPropertiesDialogComponent_kendo_window_3_ng_template_15_div_0_Template_kendo_textarea_ngModelChange_2_listener($event) { i0.ɵɵrestoreView(_r44); const ctx_r45 = i0.ɵɵnextContext(3); return i0.ɵɵresetView(ctx_r45.record.SmartFilterWhereClause = $event); });
173
- i0.ɵɵelementEnd()();
174
- } if (rf & 2) {
175
- const ctx_r41 = i0.ɵɵnextContext(3);
176
- i0.ɵɵadvance(1);
177
- i0.ɵɵproperty("readonly", true)("rows", 5)("ngModel", ctx_r41.record.SmartFilterExplanation);
178
- i0.ɵɵadvance(1);
179
- i0.ɵɵproperty("readonly", true)("rows", 5)("ngModel", ctx_r41.record.SmartFilterWhereClause);
180
- } }
181
- function ViewPropertiesDialogComponent_kendo_window_3_ng_template_15_div_1_Template(rf, ctx) { if (rf & 1) {
182
- const _r47 = i0.ɵɵgetCurrentView();
183
- i0.ɵɵelementStart(0, "div")(1, "kendo-textarea", 48);
184
- i0.ɵɵlistener("ngModelChange", function ViewPropertiesDialogComponent_kendo_window_3_ng_template_15_div_1_Template_kendo_textarea_ngModelChange_1_listener($event) { i0.ɵɵrestoreView(_r47); const ctx_r46 = i0.ɵɵnextContext(3); return i0.ɵɵresetView(ctx_r46.record.WhereClause = $event); });
185
- i0.ɵɵelementEnd()();
186
- } if (rf & 2) {
187
- const ctx_r42 = i0.ɵɵnextContext(3);
188
- i0.ɵɵadvance(1);
189
- i0.ɵɵproperty("readonly", true)("rows", 7)("ngModel", ctx_r42.record.WhereClause);
190
- } }
191
- function ViewPropertiesDialogComponent_kendo_window_3_ng_template_15_Template(rf, ctx) { if (rf & 1) {
192
- i0.ɵɵtemplate(0, ViewPropertiesDialogComponent_kendo_window_3_ng_template_15_div_0_Template, 3, 6, "div", 37);
193
- i0.ɵɵtemplate(1, ViewPropertiesDialogComponent_kendo_window_3_ng_template_15_div_1_Template, 2, 3, "div", 47);
194
- } if (rf & 2) {
195
- const ctx_r11 = i0.ɵɵnextContext(2);
196
- i0.ɵɵproperty("ngIf", ctx_r11.record.SmartFilterEnabled);
197
- } }
198
- function ViewPropertiesDialogComponent_kendo_window_3_Template(rf, ctx) { if (rf & 1) {
199
- const _r49 = i0.ɵɵgetCurrentView();
200
- i0.ɵɵelementStart(0, "kendo-window", 5);
201
- i0.ɵɵlistener("close", function ViewPropertiesDialogComponent_kendo_window_3_Template_kendo_window_close_0_listener() { i0.ɵɵrestoreView(_r49); const ctx_r48 = i0.ɵɵnextContext(); return i0.ɵɵresetView(ctx_r48.closePropertiesDialog()); })("resizeEnd", function ViewPropertiesDialogComponent_kendo_window_3_Template_kendo_window_resizeEnd_0_listener() { i0.ɵɵrestoreView(_r49); const ctx_r50 = i0.ɵɵnextContext(); return i0.ɵɵresetView(ctx_r50.ResizeTab()); })("heightChange", function ViewPropertiesDialogComponent_kendo_window_3_Template_kendo_window_heightChange_0_listener() { i0.ɵɵrestoreView(_r49); const ctx_r51 = i0.ɵɵnextContext(); return i0.ɵɵresetView(ctx_r51.ResizeTab()); })("widthChange", function ViewPropertiesDialogComponent_kendo_window_3_Template_kendo_window_widthChange_0_listener() { i0.ɵɵrestoreView(_r49); const ctx_r52 = i0.ɵɵnextContext(); return i0.ɵɵresetView(ctx_r52.ResizeTab()); });
202
- i0.ɵɵtemplate(1, ViewPropertiesDialogComponent_kendo_window_3_kendo_loader_1_Template, 1, 0, "kendo-loader", 6);
203
- i0.ɵɵelementStart(2, "div", 7, 8)(4, "div")(5, "kendo-tabstrip", 9)(6, "kendo-tabstrip-tab", 10);
204
- i0.ɵɵtemplate(7, ViewPropertiesDialogComponent_kendo_window_3_ng_template_7_Template, 8, 2, "ng-template", 11);
205
- i0.ɵɵelementEnd();
206
- i0.ɵɵelementStart(8, "kendo-tabstrip-tab", 12);
207
- i0.ɵɵtemplate(9, ViewPropertiesDialogComponent_kendo_window_3_ng_template_9_Template, 2, 2, "ng-template", 11);
208
- i0.ɵɵelementEnd();
209
- i0.ɵɵelementStart(10, "kendo-tabstrip-tab", 13);
210
- i0.ɵɵtemplate(11, ViewPropertiesDialogComponent_kendo_window_3_ng_template_11_Template, 5, 3, "ng-template", 11);
211
- i0.ɵɵelementEnd();
212
- i0.ɵɵelementStart(12, "kendo-tabstrip-tab", 14);
213
- i0.ɵɵtemplate(13, ViewPropertiesDialogComponent_kendo_window_3_ng_template_13_Template, 3, 1, "ng-template", 11);
214
- i0.ɵɵelementEnd();
215
- i0.ɵɵelementStart(14, "kendo-tabstrip-tab", 15);
216
- i0.ɵɵtemplate(15, ViewPropertiesDialogComponent_kendo_window_3_ng_template_15_Template, 2, 1, "ng-template", 11);
217
- i0.ɵɵelementEnd()();
218
- i0.ɵɵelementStart(16, "div", 16)(17, "button", 17);
219
- i0.ɵɵlistener("click", function ViewPropertiesDialogComponent_kendo_window_3_Template_button_click_17_listener() { i0.ɵɵrestoreView(_r49); const ctx_r53 = i0.ɵɵnextContext(); return i0.ɵɵresetView(ctx_r53.saveProperties()); });
220
- i0.ɵɵtext(18, " Save ");
221
- i0.ɵɵelementEnd();
222
- i0.ɵɵelementStart(19, "button", 18);
223
- i0.ɵɵlistener("click", function ViewPropertiesDialogComponent_kendo_window_3_Template_button_click_19_listener() { i0.ɵɵrestoreView(_r49); const ctx_r54 = i0.ɵɵnextContext(); return i0.ɵɵresetView(ctx_r54.closePropertiesDialog()); });
224
- i0.ɵɵtext(20, "Cancel");
225
- i0.ɵɵelementEnd()()()()();
226
- } if (rf & 2) {
227
- const ctx_r2 = i0.ɵɵnextContext();
228
- i0.ɵɵproperty("width", 700)("height", 525)("minHeight", 300)("minWidth", 400)("resizable", true);
229
- i0.ɵɵadvance(1);
230
- i0.ɵɵproperty("ngIf", ctx_r2.showloader);
231
- i0.ɵɵadvance(3);
232
- i0.ɵɵclassMap(ctx_r2.showloader ? "disabled-div" : "");
233
- i0.ɵɵadvance(1);
234
- i0.ɵɵproperty("keepTabContent", true)("animate", false)("height", ctx_r2.TabHeight);
235
- i0.ɵɵadvance(1);
236
- i0.ɵɵproperty("selected", true);
237
- } }
238
- export class ViewPropertiesDialogComponent extends BaseFormComponent {
239
- constructor(route, elRef, ss, formBuilder, router) {
240
- super(elRef, ss, router, route);
241
- this.route = route;
242
- this.elRef = elRef;
243
- this.ss = ss;
244
- this.formBuilder = formBuilder;
245
- this.router = router;
246
- this.ShowPropertiesButton = true;
247
- this.dialogClosed = new EventEmitter();
248
- this.isDialogOpened = false;
249
- this.showloader = true;
250
- // public localViewColumns: ViewColumnInfo[] = [];
251
- this.localGridState = {};
252
- this.localFilterState = {};
253
- this.defaultFilterState = {};
254
- this.usedFields = new Set(); // Track used fields
255
- this.sortFields = [];
256
- this.sortState = [];
257
- this.sortDirections = [
258
- { Name: 'Up', Value: 'asc' },
259
- { Name: 'Down', Value: 'desc' }
260
- ];
261
- this.defaultOperators = {
262
- string: ["contains", "doesnotcontain", "eq", "neq", "startswith", "endswith", "isnull", "isnotnull", "isempty", "isnotempty"],
263
- number: ["neq", "eq", "gte", "gt", "lte", "lt", "isnull", "isnotnull"],
264
- date: ["neq", "eq", "gte", "gt", "lte", "lt", "isnull", "isnotnull"],
265
- boolean: ["eq", "neq"]
266
- };
267
- this.toKendoFilterField = ({ DisplayName, Name, Type, }) => {
268
- return Object.assign({ field: Name, title: DisplayName !== null && DisplayName !== void 0 ? DisplayName : Name }, this.getFilterTypeAndOperators(this.toKendoFieldType(Type)));
269
- };
270
- this.toKendoFieldType = (entityFieldType) => {
271
- if (entityFieldType) {
272
- return ['int', 'money', 'decimal', 'smallint', 'bigint'].includes(entityFieldType)
273
- ? 'numeric'
274
- : ['nchar', 'char', 'nvarchar'].includes(entityFieldType)
275
- ? 'text'
276
- : ['tinyint', 'bit'].includes(entityFieldType)
277
- ? 'boolean'
278
- : ['datetimeoffset', 'datetime'].includes(entityFieldType)
279
- ? 'date'
280
- : 'string';
281
- }
282
- else {
283
- return 'string';
284
- }
285
- };
286
- this.getFilterTypeAndOperators = (kendoFieldType = '') => {
287
- switch (kendoFieldType) {
288
- case 'numeric':
289
- return { editor: 'number', operators: this.defaultOperators.number };
290
- case 'text':
291
- return { editor: 'string', operators: this.defaultOperators.string };
292
- case 'boolean':
293
- return { editor: 'boolean', operators: this.defaultOperators.boolean };
294
- case 'date':
295
- return { editor: 'date', operators: this.defaultOperators.date };
296
- default:
297
- return { editor: 'string', operators: this.defaultOperators.string };
298
- }
299
- };
300
- this.BottomMargin = 75;
301
- }
302
- onKeyPress(event) {
303
- if (event.key === 'Enter') {
304
- this.saveProperties();
305
- }
306
- }
307
- GetTabTopPosition() {
308
- return 50; // for this dialog, we don't want to offset the tab position related to where it is on the page, this is relative to top of dialog
309
- }
310
- CreateView(entityName) {
311
- this.EntityName = entityName;
312
- this.ViewID = undefined;
313
- this.Open();
314
- }
315
- Open(ViewID = this.ViewID) {
316
- return __awaiter(this, void 0, void 0, function* () {
317
- this.ViewID = ViewID;
318
- yield this.Load();
319
- this.isDialogOpened = true; // binding causes the kendo window to open from this method call
320
- });
321
- }
322
- Load() {
323
- return __awaiter(this, void 0, void 0, function* () {
324
- const md = new Metadata();
325
- this.record = (yield md.GetEntityObject('User Views'));
326
- if (this.ViewID) {
327
- // load the view
328
- yield this.record.Load(this.ViewID);
329
- }
330
- else if (this.EntityName) {
331
- // We don't have a View ID, we are creating a NEW view, so do NewRecord()
332
- this.record.NewRecord();
333
- const e = md.Entities.find(e => e.Name == this.EntityName);
334
- if (e)
335
- this.record.SetDefaultsFromEntity(e);
336
- else
337
- throw new Error(`Entity ${this.EntityName} not found in metadata`);
338
- }
339
- // now we load up the columns
340
- this.FinishLoad(md);
341
- this.showloader = false;
342
- setTimeout(() => {
343
- this.ResizeTab();
344
- }, 200);
345
- });
346
- }
347
- closePropertiesDialog() {
348
- this.dialogClosed.emit({});
349
- this.isDialogOpened = false; // binding causes the kendo window to close from this method call
350
- if (this.keyPressListener) { // removing the keypress listener when the dialog closes
351
- this.dialogContainer.nativeElement.removeEventListener('keypress', this.keyPressListener);
352
- }
353
- }
354
- FinishLoad(md) {
355
- return __awaiter(this, void 0, void 0, function* () {
356
- this.ViewEntityInfo = md.Entities.find(e => e.ID == this.record.EntityID);
357
- // using all these local variables because the VSCode debugger doesn't know what "this" is all of a sudden
358
- if (!this.ViewEntityInfo)
359
- throw new Error(`Entity ${this.record.EntityID} not found in metadata`);
360
- // prepare the sorting state
361
- this.sortFields = this.ViewEntityInfo.Fields;
362
- if (this.record.SortState === null || this.record.SortState === undefined || this.record.SortState.trim().length === 0)
363
- this.sortState = [];
364
- else
365
- this.sortState = JSON.parse(this.record.SortState);
366
- // now translate the sortState into the UI format by swapping out the primitve field names and sort direction with the data objects that the kendo ui will bind to
367
- this.sortState = this.sortState.map((s) => {
368
- var _a;
369
- let dir;
370
- if (typeof s.direction === 'string') {
371
- dir = s.direction;
372
- }
373
- else if (typeof s.direction === 'number' && s.direction === 1) { // some legacy views have 1 and 2 for asc and desc
374
- dir = 'asc';
375
- }
376
- else if (typeof s.direction === 'number' && s.direction === 2) {
377
- dir = 'desc';
378
- }
379
- else {
380
- dir = '';
381
- }
382
- return {
383
- field: (_a = this.ViewEntityInfo) === null || _a === void 0 ? void 0 : _a.Fields.find((f) => f.Name === s.field),
384
- direction: this.sortDirections.find((d) => d.Value.trim().toLowerCase() === dir)
385
- };
386
- });
387
- this.localGridState = JSON.parse(this.record.GridState);
388
- const temp = this.localGridState;
389
- this.localFilterState = JSON.parse(this.record.FilterState);
390
- this.defaultFilterState = this.localFilterState; // adding a duplicate filter state for populating the default filter state
391
- this.appendUnusedColumnsToColumnSettings(this.localGridState);
392
- this.localGridState.columnSettings.sort((a, b) => {
393
- if (a.hidden && !b.hidden)
394
- return 1;
395
- if (!a.hidden && b.hidden)
396
- return -1;
397
- // if we get here, they're both hidden, or both not hidden, so sort by orderIndex
398
- return a.orderIndex - b.orderIndex;
399
- });
400
- setTimeout(() => {
401
- this.keyPressListener = this.onKeyPress.bind(this);
402
- this.dialogContainer.nativeElement.addEventListener('keypress', this.onKeyPress.bind(this));
403
- this.nameField.focus();
404
- }, 200);
405
- });
406
- }
407
- appendUnusedColumnsToColumnSettings(gridState) {
408
- var _a;
409
- // we go through our EntityFields and add any that aren't already in the columnSettings
410
- // this is so that we can add new columns to the view that were not previously used in this view
411
- const unusedFields = (_a = this.ViewEntityInfo) === null || _a === void 0 ? void 0 : _a.Fields.filter(f => {
412
- if (gridState.columnSettings.find((col) => col.Name.trim().toLowerCase() === f.Name.trim().toLowerCase()))
413
- return false; // this entity field is already in the columnSettings
414
- else
415
- return true; // this entity field is not in the columnSettings
416
- });
417
- // now we add the unused fields to the columnSettings
418
- unusedFields === null || unusedFields === void 0 ? void 0 : unusedFields.forEach((f) => {
419
- gridState.columnSettings.push({
420
- ID: f.ID,
421
- DisplayName: f.DisplayName,
422
- Name: f.Name,
423
- orderIndex: gridState.columnSettings.length,
424
- width: f.DefaultColumnWidth ? f.DefaultColumnWidth : 100,
425
- EntityField: f,
426
- hidden: true
427
- });
428
- });
429
- }
430
- onDragEnd(e) {
431
- if (e.index >= 0) {
432
- // const column = this.localViewColumns[e.index];
433
- if (this.localGridState) {
434
- const lvc = this.localGridState.columnSettings;
435
- for (let i = 0; i < lvc.length; i++) {
436
- const col = lvc[i];
437
- col.orderIndex = i; // the orderIndex inside the column is what is actually used to drive this, the order in the ARRAY gets updated by KendoSortable but orderIndex isn't automatically updated
438
- }
439
- this.updateRecordGridState();
440
- }
441
- }
442
- }
443
- updateRecordGridState() {
444
- const temp = JSON.stringify(this.localGridState);
445
- const tempO = JSON.parse(temp); // make sure we have a clean object that is NOT linked in memory to the localGridState
446
- // now strip the EntityField from the columnSettings in the tempO object
447
- tempO.columnSettings.forEach((col) => {
448
- delete col.EntityField;
449
- });
450
- this.record.GridState = JSON.stringify(tempO); // stringify the state into the record
451
- }
452
- onFilterChange(value) {
453
- this.localFilterState = value;
454
- }
455
- toggleColumn(column) {
456
- return __awaiter(this, void 0, void 0, function* () {
457
- column.hidden = !column.hidden; // do the toggle
458
- if (this.localGridState)
459
- this.updateRecordGridState();
460
- });
461
- }
462
- saveProperties() {
463
- return __awaiter(this, void 0, void 0, function* () {
464
- const bNewRecord = !(this.record.PrimaryKey.Value);
465
- this.showloader = true;
466
- const lfs = JSON.stringify(this.localFilterState);
467
- this.record.FilterState = JSON.stringify(this.localFilterState); // pass this along as as string, not directly bound since Kendo Filter is bound to a local object we need to translate to a string
468
- // need to convert the UI format to the data format.
469
- const sortMap = this.sortState.map((s) => {
470
- return {
471
- field: s.field.Name,
472
- direction: s.direction.Value
473
- };
474
- });
475
- this.record.SortState = JSON.stringify(sortMap);
476
- // validate the record first
477
- const rec = this.record;
478
- const valResults = this.record.Validate();
479
- if (valResults.Success === false) {
480
- this.showloader = false;
481
- this.sharedService.CreateSimpleNotification('Validation Errors: ' + valResults.Errors.map((e) => e.Message).join('\n'), 'warning', 7500);
482
- }
483
- else if (yield this.record.Save()) {
484
- this.dialogClosed.emit({ Saved: true, ViewEntity: this.record });
485
- this.isDialogOpened = false; // close the kendo window - this works through ngIf binding
486
- this.showloader = false;
487
- if (!bNewRecord) // view already exists so we're not changing the route as it is alreayd on the view, but we fire an event to let people know that it's changed
488
- MJGlobal.Instance.RaiseEvent({
489
- event: MJEventType.ComponentEvent,
490
- eventCode: EventCodes.ViewUpdated,
491
- args: new ResourceData({
492
- ResourceTypeID: this.sharedService.ViewResourceType.ID,
493
- ResourceRecordID: this.record.PrimaryKey.Value,
494
- Configuration: {
495
- ViewEntity: this.record
496
- }
497
- }),
498
- component: this
499
- });
500
- else
501
- // we route to the new view using the router
502
- this.router.navigate(['resource', 'view', this.record.PrimaryKey.Value]);
503
- }
504
- else {
505
- // it failed, so don't close the dialog
506
- this.showloader = false;
507
- this.sharedService.CreateSimpleNotification('Saving the view failed, please try again and if this persists contact your administrator.', 'error', 5000);
508
- }
509
- });
510
- }
511
- get ContainerObjectHeight() {
512
- if (this.kendoWindow)
513
- return this.kendoWindow.height;
514
- else
515
- return 0;
516
- }
517
- addSort() {
518
- var _a;
519
- this.sortState = this.sortState.concat({ field: (_a = this.ViewEntityInfo) === null || _a === void 0 ? void 0 : _a.Fields[0], direction: this.sortDirections[0] }); // add a new sort item
520
- }
521
- removeSort(item) {
522
- this.sortState = this.sortState.filter((i) => i !== item);
523
- }
524
- sortColumnValueChange(sortItem, newValue) {
525
- const idx = this.sortState.findIndex((i) => i === sortItem);
526
- console.log(this.sortState);
527
- console.log(newValue);
528
- }
529
- sortDirectionValueChange(sortItem, newValue) {
530
- }
531
- }
532
- ViewPropertiesDialogComponent.ɵfac = function ViewPropertiesDialogComponent_Factory(t) { return new (t || ViewPropertiesDialogComponent)(i0.ɵɵdirectiveInject(i1.ActivatedRoute), i0.ɵɵdirectiveInject(i0.ElementRef), i0.ɵɵdirectiveInject(i2.SharedService), i0.ɵɵdirectiveInject(i3.FormBuilder), i0.ɵɵdirectiveInject(i1.Router)); };
533
- ViewPropertiesDialogComponent.ɵcmp = /*@__PURE__*/ i0.ɵɵdefineComponent({ type: ViewPropertiesDialogComponent, selectors: [["app-view-properties-dialog"]], viewQuery: function ViewPropertiesDialogComponent_Query(rf, ctx) { if (rf & 1) {
534
- i0.ɵɵviewQuery(WindowComponent, 5);
535
- i0.ɵɵviewQuery(TabComponent, 5);
536
- i0.ɵɵviewQuery(_c0, 5);
537
- i0.ɵɵviewQuery(_c1, 5);
538
- } if (rf & 2) {
539
- let _t;
540
- i0.ɵɵqueryRefresh(_t = i0.ɵɵloadQuery()) && (ctx.kendoWindow = _t.first);
541
- i0.ɵɵqueryRefresh(_t = i0.ɵɵloadQuery()) && (ctx.kendoTab = _t.first);
542
- i0.ɵɵqueryRefresh(_t = i0.ɵɵloadQuery()) && (ctx.nameField = _t.first);
543
- i0.ɵɵqueryRefresh(_t = i0.ɵɵloadQuery()) && (ctx.dialogContainer = _t.first);
544
- } }, inputs: { ViewID: "ViewID", EntityName: "EntityName", ShowPropertiesButton: "ShowPropertiesButton" }, outputs: { dialogClosed: "dialogClosed" }, features: [i0.ɵɵInheritDefinitionFeature], decls: 4, vars: 3, consts: [["kendoButton", "", "icon", "gear", 3, "primary", "click", 4, "ngIf"], ["class", "k-overlay", 4, "ngIf"], ["title", "View Properties", 3, "width", "height", "minHeight", "minWidth", "resizable", "close", "resizeEnd", "heightChange", "widthChange", 4, "ngIf"], ["kendoButton", "", "icon", "gear", 3, "primary", "click"], [1, "k-overlay"], ["title", "View Properties", 3, "width", "height", "minHeight", "minWidth", "resizable", "close", "resizeEnd", "heightChange", "widthChange"], ["type", "converging-spinner", 4, "ngIf"], [1, "k-d-flex", "k-flex-col", "k-justify-content-between", "k-h-full"], ["dialogContainer", ""], [1, "popup-content", 3, "keepTabContent", "animate", "height"], ["title", "General", 3, "selected"], ["kendoTabContent", ""], ["title", "Fields"], ["title", "Filters"], ["title", "Sorting"], ["title", "Advanced"], [1, "k-actions", "k-actions-end", "popup-actions"], ["kendoButton", "", "icon", "save", "themeColor", "primary", 3, "click"], ["kendoButton", "", 3, "click"], ["type", "converging-spinner"], [1, "view-prop-tab-contents"], [1, "form-group"], ["text", "Name", 1, "k-form-label"], [1, "view-name", 3, "ngModel", "ngModelChange"], ["nameField", ""], [1, "form-group", "form-group-description"], ["text", "Description", 1, "k-form-label"], [1, "k-input", "k-input-solid", "view-description", 3, "ngModel", "ngModelChange"], ["itemClass", "item", "activeItemClass", "item active", 3, "kendoSortableBinding", "animation", "dragEnd"], [1, "item-content"], ["type", "checkbox", "kendoCheckBox", "", 3, "ngModel", "id", "ngModelChange", "change"], [1, "k-checkbox-label", 3, "for", "text"], ["name", "reorder"], [1, "smart-filter-container"], ["text", "Smart Filter", 1, "smart-filter-label"], [3, "ngModel", "ngModelChange"], ["class", "smart-filter-prompt", "mjFillContainer", "", 3, "fillHeight", 4, "ngIf"], [4, "ngIf"], ["mjFillContainer", "", 1, "smart-filter-prompt", 3, "fillHeight"], ["placeholder", "Describe how you would like the data filtered", "resizable", "vertical", 3, "rows", "ngModel", "ngModelChange"], [3, "filters", "value", "valueChange"], [1, "sort-header"], ["kendoButton", "", "icon", "add", 3, "click"], [4, "ngFor", "ngForOf"], ["textField", "Name", "valueField", "Name", 1, "sort-column", 3, "data", "ngModel", "valueChange", "ngModelChange"], ["textField", "Name", "valueField", "Value", 1, "sort-direction", 3, "data", "ngModel", "valueChange", "ngModelChange"], ["kendoButton", "", "icon", "delete", 3, "click"], [4, "ngElse"], ["resizable", "vertical", 1, "advanced-tab-details", 3, "readonly", "rows", "ngModel", "ngModelChange"]], template: function ViewPropertiesDialogComponent_Template(rf, ctx) { if (rf & 1) {
545
- i0.ɵɵelementStart(0, "div");
546
- i0.ɵɵtemplate(1, ViewPropertiesDialogComponent_button_1_Template, 2, 1, "button", 0);
547
- i0.ɵɵtemplate(2, ViewPropertiesDialogComponent_div_2_Template, 1, 0, "div", 1);
548
- i0.ɵɵtemplate(3, ViewPropertiesDialogComponent_kendo_window_3_Template, 21, 12, "kendo-window", 2);
549
- i0.ɵɵelementEnd();
550
- } if (rf & 2) {
551
- i0.ɵɵadvance(1);
552
- i0.ɵɵproperty("ngIf", ctx.ShowPropertiesButton);
553
- i0.ɵɵadvance(1);
554
- i0.ɵɵproperty("ngIf", ctx.isDialogOpened);
555
- i0.ɵɵadvance(1);
556
- i0.ɵɵproperty("ngIf", ctx.isDialogOpened);
557
- } }, dependencies: [i4.NgForOf, i4.NgIf, i3.DefaultValueAccessor, i3.CheckboxControlValueAccessor, i3.NgControlStatus, i3.NgModel, i5.WindowComponent, i6.Button, i7.LoaderComponent, i8.TabStripComponent, i8.TabStripTabComponent, i8.TabContentDirective, i9.TextAreaComponent, i9.TextBoxComponent, i9.SwitchComponent, i9.CheckBoxDirective, i10.LabelComponent, i11.IconComponent, i12.FillContainer, i13.SortableComponent, i13.SortableBindingDirective, i14.FilterComponent, i15.DropDownListComponent], styles: [".view-prop-tab-contents[_ngcontent-%COMP%] {\r\n display: flex;\r\n flex-direction: column;\r\n height: 100%; \r\n}\r\n\r\n.form-group[_ngcontent-%COMP%] {\r\n display: flex;\r\n flex-direction: row;\r\n align-items: flex-start;\r\n margin-bottom: 10px;\r\n}\r\n\r\n.form-group-description[_ngcontent-%COMP%] {\r\n flex-grow: 1;\r\n}\r\n\r\n.k-form-label[_ngcontent-%COMP%] {\r\n width: 150px; \r\n margin-right: 10px;\r\n}\r\n\r\n.view-description[_ngcontent-%COMP%] {\r\n flex-grow: 1;\r\n height: 100%;\r\n padding: 5px;\r\n resize: none;\r\n}\r\n\r\n\r\n\r\n.item-content[_ngcontent-%COMP%] {\r\n display: flex;\r\n justify-content: space-between;\r\n align-items: center;\r\n}\r\n\r\n.popup-content[_ngcontent-%COMP%] {\r\n height: calc(100% - 46px);\r\n}\r\n\r\n.popup-actions[_ngcontent-%COMP%] {\r\n padding: 16px 0 0;\r\n}\r\n\r\n.view-prop-tab-contents[_ngcontent-%COMP%] {\r\n overflow: hidden;\r\n}\r\n\r\n.sort-column[_ngcontent-%COMP%] {\r\n width: 300px;\r\n}\r\n\r\n.sort-direction[_ngcontent-%COMP%] {\r\n width: 125px;\r\n}\r\n\r\n.sort-header[_ngcontent-%COMP%] > button[_ngcontent-%COMP%] {\r\n margin-left: 5px;\r\n margin-bottom: 5px;\r\n width: 75px;\r\n}\r\n\r\n.smart-filter-label[_ngcontent-%COMP%] {\r\n margin-right: 10px;\r\n}\r\n\r\n.smart-filter-prompt[_ngcontent-%COMP%] {\r\n margin-top: 15px;\r\n}\r\n\r\n.advanced-tab-details[_ngcontent-%COMP%]\r\n{\r\n margin-bottom: 10px;\r\n}"] });
558
- (function () { (typeof ngDevMode === "undefined" || ngDevMode) && i0.ɵsetClassMetadata(ViewPropertiesDialogComponent, [{
559
- type: Component,
560
- args: [{ selector: 'app-view-properties-dialog', template: "<div>\r\n <button *ngIf=\"ShowPropertiesButton\"\r\n kendoButton\r\n [primary]=\"true\"\r\n icon=\"gear\"\r\n (click)=\"this.Open()\"\r\n >Properties</button>\r\n <div class=\"k-overlay\" *ngIf=\"isDialogOpened\"></div>\r\n <kendo-window\r\n [width]=\"700\"\r\n [height]=\"525\"\r\n [minHeight]=\"300\"\r\n [minWidth]=\"400\"\r\n [resizable]=\"true\"\r\n title=\"View Properties\"\r\n *ngIf=\"isDialogOpened\"\r\n (close)=\"closePropertiesDialog()\"\r\n (resizeEnd)=\"this.ResizeTab()\"\r\n (heightChange)=\"this.ResizeTab()\"\r\n (widthChange)=\"this.ResizeTab()\"\r\n >\r\n <kendo-loader *ngIf=\"showloader\" type=\"converging-spinner\" ></kendo-loader>\r\n <div class=\"k-d-flex k-flex-col k-justify-content-between k-h-full\" #dialogContainer>\r\n <div [class]=\"showloader ? 'disabled-div' : ''\">\r\n <kendo-tabstrip class=\"popup-content\" [keepTabContent]=\"true\" [animate] = \"false\" [height]=\"TabHeight\" >\r\n\r\n <kendo-tabstrip-tab title=\"General\" [selected]=\"true\">\r\n <ng-template kendoTabContent>\r\n <div class=\"view-prop-tab-contents\">\r\n <div class=\"form-group\">\r\n <kendo-label class=\"k-form-label\" text=\"Name\"></kendo-label>\r\n <kendo-textbox #nameField class=\"view-name\" [(ngModel)]=\"record.Name\"></kendo-textbox>\r\n </div>\r\n <div class=\"form-group form-group-description\">\r\n <kendo-label class=\"k-form-label\" text=\"Description\"></kendo-label>\r\n <textarea class=\"k-input k-input-solid view-description\" [(ngModel)]=\"record.Description\"></textarea>\r\n </div>\r\n </div>\r\n </ng-template>\r\n </kendo-tabstrip-tab>\r\n \r\n <kendo-tabstrip-tab title=\"Fields\">\r\n <ng-template kendoTabContent>\r\n \r\n <kendo-sortable\r\n [kendoSortableBinding]=\"this.localGridState.columnSettings\"\r\n [animation]=\"true\"\r\n itemClass=\"item\"\r\n activeItemClass=\"item active\"\r\n (dragEnd)=\"onDragEnd($event)\"\r\n >\r\n <ng-template let-col=\"item\">\r\n <div class=\"item-content\">\r\n <div>\r\n <input\r\n type=\"checkbox\"\r\n [(ngModel)]=\"!col.hidden\"\r\n id=\"column_{{col.ID}}\"\r\n kendoCheckBox\r\n (change)=\"toggleColumn(col)\"\r\n />\r\n <kendo-label\r\n [for]=\"'column_'+col.ID\"\r\n [text]=\"col.DisplayName ? col.DisplayName : col.Name\"\r\n class=\"k-checkbox-label\"\r\n ></kendo-label>\r\n </div>\r\n <kendo-icon name=\"reorder\"></kendo-icon>\r\n </div>\r\n </ng-template>\r\n </kendo-sortable>\r\n </ng-template>\r\n </kendo-tabstrip-tab>\r\n \r\n <kendo-tabstrip-tab title=\"Filters\">\r\n <ng-template kendoTabContent>\r\n <div class=\"smart-filter-container\">\r\n <kendo-label text=\"Smart Filter\" class=\"smart-filter-label\"></kendo-label>\r\n <kendo-switch [(ngModel)]=\"record.SmartFilterEnabled\"></kendo-switch>\r\n </div>\r\n <div *ngIf=\"record.SmartFilterEnabled\" class=\"smart-filter-prompt\" mjFillContainer [fillHeight]=\"true\">\r\n <kendo-textarea\r\n placeholder=\"Describe how you would like the data filtered\"\r\n [rows]=\"10\"\r\n [(ngModel)]=\"record.SmartFilterPrompt\"\r\n resizable=\"vertical\"\r\n ></kendo-textarea>\r\n </div>\r\n <div *ngIf=\"!record.SmartFilterEnabled\">\r\n <kendo-filter\r\n [filters]=\"ViewEntityInfo!.Fields.map(toKendoFilterField)\"\r\n [value]=\"defaultFilterState\"\r\n (valueChange)=\"onFilterChange($event)\"\r\n >\r\n </kendo-filter>\r\n </div>\r\n </ng-template>\r\n </kendo-tabstrip-tab>\r\n\r\n <kendo-tabstrip-tab title=\"Sorting\">\r\n <ng-template kendoTabContent>\r\n <div class=\"sort-header\">\r\n <button kendoButton (click)=\"addSort()\" icon=\"add\"></button>\r\n \r\n </div>\r\n <div *ngFor=\"let s of this.sortState\"> \r\n <kendo-dropdownlist \r\n class=\"sort-column\"\r\n [data]=\"sortFields\"\r\n textField=\"Name\"\r\n valueField=\"Name\"\r\n (valueChange)=\"sortColumnValueChange(s, $event)\"\r\n [(ngModel)]=\"s.field\"\r\n >\r\n </kendo-dropdownlist>\r\n <kendo-dropdownlist\r\n class=\"sort-direction\"\r\n [data]=\"sortDirections\"\r\n textField=\"Name\"\r\n valueField=\"Value\"\r\n (valueChange)=\"sortDirectionValueChange(s, $event)\"\r\n [(ngModel)]=\"s.direction\"\r\n >\r\n </kendo-dropdownlist>\r\n <button kendoButton (click)=\"removeSort(s)\" icon=\"delete\"></button>\r\n </div> \r\n </ng-template>\r\n </kendo-tabstrip-tab>\r\n\r\n <kendo-tabstrip-tab title=\"Advanced\">\r\n <ng-template kendoTabContent>\r\n <div *ngIf=\"record.SmartFilterEnabled\">\r\n <kendo-textarea\r\n [readonly]=\"true\"\r\n [rows]=\"5\"\r\n [(ngModel)]=\"record.SmartFilterExplanation\"\r\n resizable=\"vertical\"\r\n class=\"advanced-tab-details\"\r\n ></kendo-textarea>\r\n <kendo-textarea\r\n [readonly]=\"true\"\r\n [rows]=\"5\"\r\n [(ngModel)]=\"record.SmartFilterWhereClause\"\r\n resizable=\"vertical\"\r\n class=\"advanced-tab-details\"\r\n ></kendo-textarea> \r\n </div>\r\n <div *ngElse>\r\n <kendo-textarea\r\n [readonly]=\"true\"\r\n [rows]=\"7\"\r\n [(ngModel)]=\"record.WhereClause\"\r\n resizable=\"vertical\"\r\n class=\"advanced-tab-details\"\r\n ></kendo-textarea>\r\n </div>\r\n\r\n </ng-template>\r\n </kendo-tabstrip-tab>\r\n\r\n </kendo-tabstrip>\r\n \r\n <div class=\"k-actions k-actions-end popup-actions\">\r\n <button kendoButton icon=\"save\" (click)=\"saveProperties()\" themeColor=\"primary\">\r\n Save\r\n </button>\r\n <button kendoButton (click)=\"closePropertiesDialog()\">Cancel</button>\r\n </div>\r\n </div>\r\n </div>\r\n </kendo-window>\r\n</div>\r\n", styles: [".view-prop-tab-contents {\r\n display: flex;\r\n flex-direction: column;\r\n height: 100%; /* Set to the height you want */\r\n}\r\n\r\n.form-group {\r\n display: flex;\r\n flex-direction: row;\r\n align-items: flex-start;\r\n margin-bottom: 10px;\r\n}\r\n\r\n.form-group-description {\r\n flex-grow: 1;\r\n}\r\n\r\n.k-form-label {\r\n width: 150px; /* Adjust as needed */\r\n margin-right: 10px;\r\n}\r\n\r\n.view-description {\r\n flex-grow: 1;\r\n height: 100%;\r\n padding: 5px;\r\n resize: none;\r\n}\r\n\r\n\r\n\r\n.item-content {\r\n display: flex;\r\n justify-content: space-between;\r\n align-items: center;\r\n}\r\n\r\n.popup-content {\r\n height: calc(100% - 46px);\r\n}\r\n\r\n.popup-actions {\r\n padding: 16px 0 0;\r\n}\r\n\r\n.view-prop-tab-contents {\r\n overflow: hidden;\r\n}\r\n\r\n.sort-column {\r\n width: 300px;\r\n}\r\n\r\n.sort-direction {\r\n width: 125px;\r\n}\r\n\r\n.sort-header > button {\r\n margin-left: 5px;\r\n margin-bottom: 5px;\r\n width: 75px;\r\n}\r\n\r\n.smart-filter-label {\r\n margin-right: 10px;\r\n}\r\n\r\n.smart-filter-prompt {\r\n margin-top: 15px;\r\n}\r\n\r\n.advanced-tab-details\r\n{\r\n margin-bottom: 10px;\r\n}"] }]
561
- }], function () { return [{ type: i1.ActivatedRoute }, { type: i0.ElementRef }, { type: i2.SharedService }, { type: i3.FormBuilder }, { type: i1.Router }]; }, { ViewID: [{
562
- type: Input
563
- }], EntityName: [{
564
- type: Input
565
- }], ShowPropertiesButton: [{
566
- type: Input
567
- }], dialogClosed: [{
568
- type: Output
569
- }], kendoWindow: [{
570
- type: ViewChild,
571
- args: [WindowComponent]
572
- }], kendoTab: [{
573
- type: ViewChild,
574
- args: [TabComponent]
575
- }], nameField: [{
576
- type: ViewChild,
577
- args: ['nameField']
578
- }], dialogContainer: [{
579
- type: ViewChild,
580
- args: ['dialogContainer']
581
- }] }); })();
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, EventEmitter, Input, Output, ViewChild } from '@angular/core';
11
+ import { Metadata } from "@memberjunction/core";
12
+ import { BaseFormComponent } from '../generic/base-form-component';
13
+ import { ResourceData } from '@memberjunction/ng-shared';
14
+ import { WindowComponent } from '@progress/kendo-angular-dialog';
15
+ import { TabComponent } from '@progress/kendo-angular-layout';
16
+ import { MJEventType, MJGlobal } from '@memberjunction/global';
17
+ import { EventCodes } from '@memberjunction/ng-shared';
18
+ import * as i0 from "@angular/core";
19
+ import * as i1 from "@angular/router";
20
+ import * as i2 from "@memberjunction/ng-shared";
21
+ import * as i3 from "@angular/forms";
22
+ import * as i4 from "@angular/common";
23
+ import * as i5 from "@progress/kendo-angular-dialog";
24
+ import * as i6 from "@progress/kendo-angular-buttons";
25
+ import * as i7 from "@progress/kendo-angular-indicators";
26
+ import * as i8 from "@progress/kendo-angular-layout";
27
+ import * as i9 from "@progress/kendo-angular-inputs";
28
+ import * as i10 from "@progress/kendo-angular-label";
29
+ import * as i11 from "@progress/kendo-angular-icons";
30
+ import * as i12 from "@memberjunction/ng-container-directives";
31
+ import * as i13 from "@progress/kendo-angular-sortable";
32
+ import * as i14 from "@progress/kendo-angular-filter";
33
+ import * as i15 from "@progress/kendo-angular-dropdowns";
34
+ const _c0 = ["nameField"];
35
+ const _c1 = ["dialogContainer"];
36
+ function ViewPropertiesDialogComponent_button_1_Template(rf, ctx) { if (rf & 1) {
37
+ const _r4 = i0.ɵɵgetCurrentView();
38
+ i0.ɵɵelementStart(0, "button", 3);
39
+ i0.ɵɵlistener("click", function ViewPropertiesDialogComponent_button_1_Template_button_click_0_listener() { i0.ɵɵrestoreView(_r4); const ctx_r3 = i0.ɵɵnextContext(); return i0.ɵɵresetView(ctx_r3.Open()); });
40
+ i0.ɵɵelement(1, "kendo-svgicon", 4);
41
+ i0.ɵɵtext(2, " Properties");
42
+ i0.ɵɵelementEnd();
43
+ } if (rf & 2) {
44
+ const ctx_r0 = i0.ɵɵnextContext();
45
+ i0.ɵɵproperty("primary", true);
46
+ i0.ɵɵadvance();
47
+ i0.ɵɵproperty("icon", ctx_r0.sharedService.kendoSVGIcon("gear"));
48
+ } }
49
+ function ViewPropertiesDialogComponent_div_2_Template(rf, ctx) { if (rf & 1) {
50
+ i0.ɵɵelement(0, "div", 5);
51
+ } }
52
+ function ViewPropertiesDialogComponent_kendo_window_3_kendo_loader_1_Template(rf, ctx) { if (rf & 1) {
53
+ i0.ɵɵelement(0, "kendo-loader", 20);
54
+ } }
55
+ function ViewPropertiesDialogComponent_kendo_window_3_ng_template_7_Template(rf, ctx) { if (rf & 1) {
56
+ const _r14 = i0.ɵɵgetCurrentView();
57
+ i0.ɵɵelementStart(0, "div", 21)(1, "div", 22);
58
+ i0.ɵɵelement(2, "kendo-label", 23);
59
+ i0.ɵɵelementStart(3, "kendo-textbox", 24, 25);
60
+ i0.ɵɵlistener("ngModelChange", function ViewPropertiesDialogComponent_kendo_window_3_ng_template_7_Template_kendo_textbox_ngModelChange_3_listener($event) { i0.ɵɵrestoreView(_r14); const ctx_r13 = i0.ɵɵnextContext(2); return i0.ɵɵresetView(ctx_r13.record.Name = $event); });
61
+ i0.ɵɵelementEnd()();
62
+ i0.ɵɵelementStart(5, "div", 26);
63
+ i0.ɵɵelement(6, "kendo-label", 27);
64
+ i0.ɵɵelementStart(7, "textarea", 28);
65
+ i0.ɵɵlistener("ngModelChange", function ViewPropertiesDialogComponent_kendo_window_3_ng_template_7_Template_textarea_ngModelChange_7_listener($event) { i0.ɵɵrestoreView(_r14); const ctx_r15 = i0.ɵɵnextContext(2); return i0.ɵɵresetView(ctx_r15.record.Description = $event); });
66
+ i0.ɵɵelementEnd()()();
67
+ } if (rf & 2) {
68
+ const ctx_r7 = i0.ɵɵnextContext(2);
69
+ i0.ɵɵadvance(3);
70
+ i0.ɵɵproperty("ngModel", ctx_r7.record.Name);
71
+ i0.ɵɵadvance(4);
72
+ i0.ɵɵproperty("ngModel", ctx_r7.record.Description);
73
+ } }
74
+ function ViewPropertiesDialogComponent_kendo_window_3_ng_template_9_ng_template_1_Template(rf, ctx) { if (rf & 1) {
75
+ const _r19 = i0.ɵɵgetCurrentView();
76
+ i0.ɵɵelementStart(0, "div", 30)(1, "div")(2, "input", 31);
77
+ i0.ɵɵlistener("ngModelChange", function ViewPropertiesDialogComponent_kendo_window_3_ng_template_9_ng_template_1_Template_input_ngModelChange_2_listener($event) { const restoredCtx = i0.ɵɵrestoreView(_r19); const col_r17 = restoredCtx.item; return i0.ɵɵresetView(!(col_r17.hidden = $event)); })("change", function ViewPropertiesDialogComponent_kendo_window_3_ng_template_9_ng_template_1_Template_input_change_2_listener() { const restoredCtx = i0.ɵɵrestoreView(_r19); const col_r17 = restoredCtx.item; const ctx_r20 = i0.ɵɵnextContext(3); return i0.ɵɵresetView(ctx_r20.toggleColumn(col_r17)); });
78
+ i0.ɵɵelementEnd();
79
+ i0.ɵɵelement(3, "kendo-label", 32);
80
+ i0.ɵɵelementEnd();
81
+ i0.ɵɵelement(4, "kendo-svgicon", 4);
82
+ i0.ɵɵelementEnd();
83
+ } if (rf & 2) {
84
+ const col_r17 = ctx.item;
85
+ const ctx_r16 = i0.ɵɵnextContext(3);
86
+ i0.ɵɵadvance(2);
87
+ i0.ɵɵpropertyInterpolate1("id", "column_", col_r17.ID, "");
88
+ i0.ɵɵproperty("ngModel", !col_r17.hidden);
89
+ i0.ɵɵadvance();
90
+ i0.ɵɵproperty("for", "column_" + col_r17.ID)("text", col_r17.DisplayName ? col_r17.DisplayName : col_r17.Name);
91
+ i0.ɵɵadvance();
92
+ i0.ɵɵproperty("icon", ctx_r16.sharedService.kendoSVGIcon("reorder"));
93
+ } }
94
+ function ViewPropertiesDialogComponent_kendo_window_3_ng_template_9_Template(rf, ctx) { if (rf & 1) {
95
+ const _r22 = i0.ɵɵgetCurrentView();
96
+ i0.ɵɵelementStart(0, "kendo-sortable", 29);
97
+ i0.ɵɵlistener("dragEnd", function ViewPropertiesDialogComponent_kendo_window_3_ng_template_9_Template_kendo_sortable_dragEnd_0_listener($event) { i0.ɵɵrestoreView(_r22); const ctx_r21 = i0.ɵɵnextContext(2); return i0.ɵɵresetView(ctx_r21.onDragEnd($event)); });
98
+ i0.ɵɵtemplate(1, ViewPropertiesDialogComponent_kendo_window_3_ng_template_9_ng_template_1_Template, 5, 5, "ng-template");
99
+ i0.ɵɵelementEnd();
100
+ } if (rf & 2) {
101
+ const ctx_r8 = i0.ɵɵnextContext(2);
102
+ i0.ɵɵproperty("kendoSortableBinding", ctx_r8.localGridState.columnSettings)("animation", true);
103
+ } }
104
+ function ViewPropertiesDialogComponent_kendo_window_3_ng_template_11_div_3_Template(rf, ctx) { if (rf & 1) {
105
+ const _r26 = i0.ɵɵgetCurrentView();
106
+ i0.ɵɵelementStart(0, "div", 38)(1, "kendo-textarea", 39);
107
+ i0.ɵɵlistener("ngModelChange", function ViewPropertiesDialogComponent_kendo_window_3_ng_template_11_div_3_Template_kendo_textarea_ngModelChange_1_listener($event) { i0.ɵɵrestoreView(_r26); const ctx_r25 = i0.ɵɵnextContext(3); return i0.ɵɵresetView(ctx_r25.record.SmartFilterPrompt = $event); });
108
+ i0.ɵɵelementEnd()();
109
+ } if (rf & 2) {
110
+ const ctx_r23 = i0.ɵɵnextContext(3);
111
+ i0.ɵɵproperty("fillHeight", true);
112
+ i0.ɵɵadvance();
113
+ i0.ɵɵproperty("rows", 10)("ngModel", ctx_r23.record.SmartFilterPrompt);
114
+ } }
115
+ function ViewPropertiesDialogComponent_kendo_window_3_ng_template_11_div_4_Template(rf, ctx) { if (rf & 1) {
116
+ const _r28 = i0.ɵɵgetCurrentView();
117
+ i0.ɵɵelementStart(0, "div")(1, "kendo-filter", 40);
118
+ i0.ɵɵlistener("valueChange", function ViewPropertiesDialogComponent_kendo_window_3_ng_template_11_div_4_Template_kendo_filter_valueChange_1_listener($event) { i0.ɵɵrestoreView(_r28); const ctx_r27 = i0.ɵɵnextContext(3); return i0.ɵɵresetView(ctx_r27.onFilterChange($event)); });
119
+ i0.ɵɵelementEnd()();
120
+ } if (rf & 2) {
121
+ const ctx_r24 = i0.ɵɵnextContext(3);
122
+ i0.ɵɵadvance();
123
+ i0.ɵɵproperty("filters", ctx_r24.ViewEntityInfo.Fields.map(ctx_r24.toKendoFilterField))("value", ctx_r24.defaultFilterState);
124
+ } }
125
+ function ViewPropertiesDialogComponent_kendo_window_3_ng_template_11_Template(rf, ctx) { if (rf & 1) {
126
+ const _r30 = i0.ɵɵgetCurrentView();
127
+ i0.ɵɵelementStart(0, "div", 33);
128
+ i0.ɵɵelement(1, "kendo-label", 34);
129
+ i0.ɵɵelementStart(2, "kendo-switch", 35);
130
+ i0.ɵɵlistener("ngModelChange", function ViewPropertiesDialogComponent_kendo_window_3_ng_template_11_Template_kendo_switch_ngModelChange_2_listener($event) { i0.ɵɵrestoreView(_r30); const ctx_r29 = i0.ɵɵnextContext(2); return i0.ɵɵresetView(ctx_r29.record.SmartFilterEnabled = $event); });
131
+ i0.ɵɵelementEnd()();
132
+ i0.ɵɵtemplate(3, ViewPropertiesDialogComponent_kendo_window_3_ng_template_11_div_3_Template, 2, 3, "div", 36)(4, ViewPropertiesDialogComponent_kendo_window_3_ng_template_11_div_4_Template, 2, 2, "div", 37);
133
+ } if (rf & 2) {
134
+ const ctx_r9 = i0.ɵɵnextContext(2);
135
+ i0.ɵɵadvance(2);
136
+ i0.ɵɵproperty("ngModel", ctx_r9.record.SmartFilterEnabled);
137
+ i0.ɵɵadvance();
138
+ i0.ɵɵproperty("ngIf", ctx_r9.record.SmartFilterEnabled);
139
+ i0.ɵɵadvance();
140
+ i0.ɵɵproperty("ngIf", !ctx_r9.record.SmartFilterEnabled);
141
+ } }
142
+ function ViewPropertiesDialogComponent_kendo_window_3_ng_template_13_div_3_Template(rf, ctx) { if (rf & 1) {
143
+ const _r34 = i0.ɵɵgetCurrentView();
144
+ i0.ɵɵelementStart(0, "div")(1, "kendo-dropdownlist", 43);
145
+ i0.ɵɵlistener("valueChange", function ViewPropertiesDialogComponent_kendo_window_3_ng_template_13_div_3_Template_kendo_dropdownlist_valueChange_1_listener($event) { const restoredCtx = i0.ɵɵrestoreView(_r34); const s_r32 = restoredCtx.$implicit; const ctx_r33 = i0.ɵɵnextContext(3); return i0.ɵɵresetView(ctx_r33.sortColumnValueChange(s_r32, $event)); })("ngModelChange", function ViewPropertiesDialogComponent_kendo_window_3_ng_template_13_div_3_Template_kendo_dropdownlist_ngModelChange_1_listener($event) { const restoredCtx = i0.ɵɵrestoreView(_r34); const s_r32 = restoredCtx.$implicit; return i0.ɵɵresetView(s_r32.field = $event); });
146
+ i0.ɵɵelementEnd();
147
+ i0.ɵɵelementStart(2, "kendo-dropdownlist", 44);
148
+ i0.ɵɵlistener("valueChange", function ViewPropertiesDialogComponent_kendo_window_3_ng_template_13_div_3_Template_kendo_dropdownlist_valueChange_2_listener($event) { const restoredCtx = i0.ɵɵrestoreView(_r34); const s_r32 = restoredCtx.$implicit; const ctx_r36 = i0.ɵɵnextContext(3); return i0.ɵɵresetView(ctx_r36.sortDirectionValueChange(s_r32, $event)); })("ngModelChange", function ViewPropertiesDialogComponent_kendo_window_3_ng_template_13_div_3_Template_kendo_dropdownlist_ngModelChange_2_listener($event) { const restoredCtx = i0.ɵɵrestoreView(_r34); const s_r32 = restoredCtx.$implicit; return i0.ɵɵresetView(s_r32.direction = $event); });
149
+ i0.ɵɵelementEnd();
150
+ i0.ɵɵelementStart(3, "button", 19);
151
+ i0.ɵɵlistener("click", function ViewPropertiesDialogComponent_kendo_window_3_ng_template_13_div_3_Template_button_click_3_listener() { const restoredCtx = i0.ɵɵrestoreView(_r34); const s_r32 = restoredCtx.$implicit; const ctx_r38 = i0.ɵɵnextContext(3); return i0.ɵɵresetView(ctx_r38.removeSort(s_r32)); });
152
+ i0.ɵɵelement(4, "kendo-svgicon", 4);
153
+ i0.ɵɵelementEnd()();
154
+ } if (rf & 2) {
155
+ const s_r32 = ctx.$implicit;
156
+ const ctx_r31 = i0.ɵɵnextContext(3);
157
+ i0.ɵɵadvance();
158
+ i0.ɵɵproperty("data", ctx_r31.sortFields)("ngModel", s_r32.field);
159
+ i0.ɵɵadvance();
160
+ i0.ɵɵproperty("data", ctx_r31.sortDirections)("ngModel", s_r32.direction);
161
+ i0.ɵɵadvance(2);
162
+ i0.ɵɵproperty("icon", ctx_r31.sharedService.kendoSVGIcon("sortClear"));
163
+ } }
164
+ function ViewPropertiesDialogComponent_kendo_window_3_ng_template_13_Template(rf, ctx) { if (rf & 1) {
165
+ const _r40 = i0.ɵɵgetCurrentView();
166
+ i0.ɵɵelementStart(0, "div", 41)(1, "button", 19);
167
+ i0.ɵɵlistener("click", function ViewPropertiesDialogComponent_kendo_window_3_ng_template_13_Template_button_click_1_listener() { i0.ɵɵrestoreView(_r40); const ctx_r39 = i0.ɵɵnextContext(2); return i0.ɵɵresetView(ctx_r39.addSort()); });
168
+ i0.ɵɵelement(2, "kendo-svgicon", 4);
169
+ i0.ɵɵelementEnd()();
170
+ i0.ɵɵtemplate(3, ViewPropertiesDialogComponent_kendo_window_3_ng_template_13_div_3_Template, 5, 5, "div", 42);
171
+ } if (rf & 2) {
172
+ const ctx_r10 = i0.ɵɵnextContext(2);
173
+ i0.ɵɵadvance(2);
174
+ i0.ɵɵproperty("icon", ctx_r10.sharedService.kendoSVGIcon("filterAddExpression"));
175
+ i0.ɵɵadvance();
176
+ i0.ɵɵproperty("ngForOf", ctx_r10.sortState);
177
+ } }
178
+ function ViewPropertiesDialogComponent_kendo_window_3_ng_template_15_div_0_Template(rf, ctx) { if (rf & 1) {
179
+ const _r44 = i0.ɵɵgetCurrentView();
180
+ i0.ɵɵelementStart(0, "div")(1, "kendo-textarea", 46);
181
+ i0.ɵɵlistener("ngModelChange", function ViewPropertiesDialogComponent_kendo_window_3_ng_template_15_div_0_Template_kendo_textarea_ngModelChange_1_listener($event) { i0.ɵɵrestoreView(_r44); const ctx_r43 = i0.ɵɵnextContext(3); return i0.ɵɵresetView(ctx_r43.record.SmartFilterExplanation = $event); });
182
+ i0.ɵɵelementEnd();
183
+ i0.ɵɵelementStart(2, "kendo-textarea", 46);
184
+ i0.ɵɵlistener("ngModelChange", function ViewPropertiesDialogComponent_kendo_window_3_ng_template_15_div_0_Template_kendo_textarea_ngModelChange_2_listener($event) { i0.ɵɵrestoreView(_r44); const ctx_r45 = i0.ɵɵnextContext(3); return i0.ɵɵresetView(ctx_r45.record.SmartFilterWhereClause = $event); });
185
+ i0.ɵɵelementEnd()();
186
+ } if (rf & 2) {
187
+ const ctx_r41 = i0.ɵɵnextContext(3);
188
+ i0.ɵɵadvance();
189
+ i0.ɵɵproperty("readonly", true)("rows", 5)("ngModel", ctx_r41.record.SmartFilterExplanation);
190
+ i0.ɵɵadvance();
191
+ i0.ɵɵproperty("readonly", true)("rows", 5)("ngModel", ctx_r41.record.SmartFilterWhereClause);
192
+ } }
193
+ function ViewPropertiesDialogComponent_kendo_window_3_ng_template_15_div_1_Template(rf, ctx) { if (rf & 1) {
194
+ const _r47 = i0.ɵɵgetCurrentView();
195
+ i0.ɵɵelementStart(0, "div")(1, "kendo-textarea", 46);
196
+ i0.ɵɵlistener("ngModelChange", function ViewPropertiesDialogComponent_kendo_window_3_ng_template_15_div_1_Template_kendo_textarea_ngModelChange_1_listener($event) { i0.ɵɵrestoreView(_r47); const ctx_r46 = i0.ɵɵnextContext(3); return i0.ɵɵresetView(ctx_r46.record.WhereClause = $event); });
197
+ i0.ɵɵelementEnd()();
198
+ } if (rf & 2) {
199
+ const ctx_r42 = i0.ɵɵnextContext(3);
200
+ i0.ɵɵadvance();
201
+ i0.ɵɵproperty("readonly", true)("rows", 7)("ngModel", ctx_r42.record.WhereClause);
202
+ } }
203
+ function ViewPropertiesDialogComponent_kendo_window_3_ng_template_15_Template(rf, ctx) { if (rf & 1) {
204
+ i0.ɵɵtemplate(0, ViewPropertiesDialogComponent_kendo_window_3_ng_template_15_div_0_Template, 3, 6, "div", 37)(1, ViewPropertiesDialogComponent_kendo_window_3_ng_template_15_div_1_Template, 2, 3, "div", 45);
205
+ } if (rf & 2) {
206
+ const ctx_r11 = i0.ɵɵnextContext(2);
207
+ i0.ɵɵproperty("ngIf", ctx_r11.record.SmartFilterEnabled);
208
+ } }
209
+ function ViewPropertiesDialogComponent_kendo_window_3_Template(rf, ctx) { if (rf & 1) {
210
+ const _r49 = i0.ɵɵgetCurrentView();
211
+ i0.ɵɵelementStart(0, "kendo-window", 6);
212
+ i0.ɵɵlistener("close", function ViewPropertiesDialogComponent_kendo_window_3_Template_kendo_window_close_0_listener() { i0.ɵɵrestoreView(_r49); const ctx_r48 = i0.ɵɵnextContext(); return i0.ɵɵresetView(ctx_r48.closePropertiesDialog()); })("resizeEnd", function ViewPropertiesDialogComponent_kendo_window_3_Template_kendo_window_resizeEnd_0_listener() { i0.ɵɵrestoreView(_r49); const ctx_r50 = i0.ɵɵnextContext(); return i0.ɵɵresetView(ctx_r50.ResizeTab()); })("heightChange", function ViewPropertiesDialogComponent_kendo_window_3_Template_kendo_window_heightChange_0_listener() { i0.ɵɵrestoreView(_r49); const ctx_r51 = i0.ɵɵnextContext(); return i0.ɵɵresetView(ctx_r51.ResizeTab()); })("widthChange", function ViewPropertiesDialogComponent_kendo_window_3_Template_kendo_window_widthChange_0_listener() { i0.ɵɵrestoreView(_r49); const ctx_r52 = i0.ɵɵnextContext(); return i0.ɵɵresetView(ctx_r52.ResizeTab()); });
213
+ i0.ɵɵtemplate(1, ViewPropertiesDialogComponent_kendo_window_3_kendo_loader_1_Template, 1, 0, "kendo-loader", 7);
214
+ i0.ɵɵelementStart(2, "div", 8, 9)(4, "div")(5, "kendo-tabstrip", 10)(6, "kendo-tabstrip-tab", 11);
215
+ i0.ɵɵtemplate(7, ViewPropertiesDialogComponent_kendo_window_3_ng_template_7_Template, 8, 2, "ng-template", 12);
216
+ i0.ɵɵelementEnd();
217
+ i0.ɵɵelementStart(8, "kendo-tabstrip-tab", 13);
218
+ i0.ɵɵtemplate(9, ViewPropertiesDialogComponent_kendo_window_3_ng_template_9_Template, 2, 2, "ng-template", 12);
219
+ i0.ɵɵelementEnd();
220
+ i0.ɵɵelementStart(10, "kendo-tabstrip-tab", 14);
221
+ i0.ɵɵtemplate(11, ViewPropertiesDialogComponent_kendo_window_3_ng_template_11_Template, 5, 3, "ng-template", 12);
222
+ i0.ɵɵelementEnd();
223
+ i0.ɵɵelementStart(12, "kendo-tabstrip-tab", 15);
224
+ i0.ɵɵtemplate(13, ViewPropertiesDialogComponent_kendo_window_3_ng_template_13_Template, 4, 2, "ng-template", 12);
225
+ i0.ɵɵelementEnd();
226
+ i0.ɵɵelementStart(14, "kendo-tabstrip-tab", 16);
227
+ i0.ɵɵtemplate(15, ViewPropertiesDialogComponent_kendo_window_3_ng_template_15_Template, 2, 1, "ng-template", 12);
228
+ i0.ɵɵelementEnd()();
229
+ i0.ɵɵelementStart(16, "div", 17)(17, "button", 18);
230
+ i0.ɵɵlistener("click", function ViewPropertiesDialogComponent_kendo_window_3_Template_button_click_17_listener() { i0.ɵɵrestoreView(_r49); const ctx_r53 = i0.ɵɵnextContext(); return i0.ɵɵresetView(ctx_r53.saveProperties()); });
231
+ i0.ɵɵelement(18, "kendo-svgicon", 4);
232
+ i0.ɵɵtext(19, " Save ");
233
+ i0.ɵɵelementEnd();
234
+ i0.ɵɵelementStart(20, "button", 19);
235
+ i0.ɵɵlistener("click", function ViewPropertiesDialogComponent_kendo_window_3_Template_button_click_20_listener() { i0.ɵɵrestoreView(_r49); const ctx_r54 = i0.ɵɵnextContext(); return i0.ɵɵresetView(ctx_r54.closePropertiesDialog()); });
236
+ i0.ɵɵtext(21, "Cancel");
237
+ i0.ɵɵelementEnd()()()()();
238
+ } if (rf & 2) {
239
+ const ctx_r2 = i0.ɵɵnextContext();
240
+ i0.ɵɵproperty("width", 700)("height", 525)("minHeight", 300)("minWidth", 400)("resizable", true);
241
+ i0.ɵɵadvance();
242
+ i0.ɵɵproperty("ngIf", ctx_r2.showloader);
243
+ i0.ɵɵadvance(3);
244
+ i0.ɵɵclassMap(ctx_r2.showloader ? "disabled-div" : "");
245
+ i0.ɵɵadvance();
246
+ i0.ɵɵproperty("keepTabContent", true)("animate", false)("height", ctx_r2.TabHeight);
247
+ i0.ɵɵadvance();
248
+ i0.ɵɵproperty("selected", true);
249
+ i0.ɵɵadvance(12);
250
+ i0.ɵɵproperty("icon", ctx_r2.sharedService.kendoSVGIcon("save"));
251
+ } }
252
+ export class ViewPropertiesDialogComponent extends BaseFormComponent {
253
+ constructor(route, elRef, ss, formBuilder, router) {
254
+ super(elRef, ss, router, route);
255
+ this.route = route;
256
+ this.elRef = elRef;
257
+ this.ss = ss;
258
+ this.formBuilder = formBuilder;
259
+ this.router = router;
260
+ this.ShowPropertiesButton = true;
261
+ this.dialogClosed = new EventEmitter();
262
+ this.isDialogOpened = false;
263
+ this.showloader = true;
264
+ // public localViewColumns: ViewColumnInfo[] = [];
265
+ this.localGridState = {};
266
+ this.localFilterState = {};
267
+ this.defaultFilterState = {};
268
+ this.usedFields = new Set(); // Track used fields
269
+ this.sortFields = [];
270
+ this.sortState = [];
271
+ this.sortDirections = [
272
+ { Name: 'Up', Value: 'asc' },
273
+ { Name: 'Down', Value: 'desc' }
274
+ ];
275
+ this.defaultOperators = {
276
+ string: ["contains", "doesnotcontain", "eq", "neq", "startswith", "endswith", "isnull", "isnotnull", "isempty", "isnotempty"],
277
+ number: ["neq", "eq", "gte", "gt", "lte", "lt", "isnull", "isnotnull"],
278
+ date: ["neq", "eq", "gte", "gt", "lte", "lt", "isnull", "isnotnull"],
279
+ boolean: ["eq", "neq"]
280
+ };
281
+ this.toKendoFilterField = ({ DisplayName, Name, Type, }) => {
282
+ return Object.assign({ field: Name, title: DisplayName !== null && DisplayName !== void 0 ? DisplayName : Name }, this.getFilterTypeAndOperators(this.toKendoFieldType(Type)));
283
+ };
284
+ this.toKendoFieldType = (entityFieldType) => {
285
+ if (entityFieldType) {
286
+ return ['int', 'money', 'decimal', 'smallint', 'bigint'].includes(entityFieldType)
287
+ ? 'numeric'
288
+ : ['nchar', 'char', 'nvarchar'].includes(entityFieldType)
289
+ ? 'text'
290
+ : ['tinyint', 'bit'].includes(entityFieldType)
291
+ ? 'boolean'
292
+ : ['datetimeoffset', 'datetime'].includes(entityFieldType)
293
+ ? 'date'
294
+ : 'string';
295
+ }
296
+ else {
297
+ return 'string';
298
+ }
299
+ };
300
+ this.getFilterTypeAndOperators = (kendoFieldType = '') => {
301
+ switch (kendoFieldType) {
302
+ case 'numeric':
303
+ return { editor: 'number', operators: this.defaultOperators.number };
304
+ case 'text':
305
+ return { editor: 'string', operators: this.defaultOperators.string };
306
+ case 'boolean':
307
+ return { editor: 'boolean', operators: this.defaultOperators.boolean };
308
+ case 'date':
309
+ return { editor: 'date', operators: this.defaultOperators.date };
310
+ default:
311
+ return { editor: 'string', operators: this.defaultOperators.string };
312
+ }
313
+ };
314
+ this.BottomMargin = 75;
315
+ }
316
+ onKeyPress(event) {
317
+ if (event.key === 'Enter') {
318
+ this.saveProperties();
319
+ }
320
+ }
321
+ GetTabTopPosition() {
322
+ return 50; // for this dialog, we don't want to offset the tab position related to where it is on the page, this is relative to top of dialog
323
+ }
324
+ CreateView(entityName) {
325
+ this.EntityName = entityName;
326
+ this.ViewID = undefined;
327
+ this.Open();
328
+ }
329
+ Open(ViewID = this.ViewID) {
330
+ return __awaiter(this, void 0, void 0, function* () {
331
+ this.ViewID = ViewID;
332
+ yield this.Load();
333
+ this.isDialogOpened = true; // binding causes the kendo window to open from this method call
334
+ });
335
+ }
336
+ Load() {
337
+ return __awaiter(this, void 0, void 0, function* () {
338
+ const md = new Metadata();
339
+ this.record = (yield md.GetEntityObject('User Views'));
340
+ if (this.ViewID) {
341
+ // load the view
342
+ yield this.record.Load(this.ViewID);
343
+ }
344
+ else if (this.EntityName) {
345
+ // We don't have a View ID, we are creating a NEW view, so do NewRecord()
346
+ this.record.NewRecord();
347
+ const e = md.Entities.find(e => e.Name == this.EntityName);
348
+ if (e)
349
+ this.record.SetDefaultsFromEntity(e);
350
+ else
351
+ throw new Error(`Entity ${this.EntityName} not found in metadata`);
352
+ }
353
+ // now we load up the columns
354
+ this.FinishLoad(md);
355
+ this.showloader = false;
356
+ setTimeout(() => {
357
+ this.ResizeTab();
358
+ }, 200);
359
+ });
360
+ }
361
+ closePropertiesDialog() {
362
+ this.dialogClosed.emit({});
363
+ this.isDialogOpened = false; // binding causes the kendo window to close from this method call
364
+ if (this.keyPressListener) { // removing the keypress listener when the dialog closes
365
+ this.dialogContainer.nativeElement.removeEventListener('keypress', this.keyPressListener);
366
+ }
367
+ }
368
+ FinishLoad(md) {
369
+ return __awaiter(this, void 0, void 0, function* () {
370
+ this.ViewEntityInfo = md.Entities.find(e => e.ID == this.record.EntityID);
371
+ // using all these local variables because the VSCode debugger doesn't know what "this" is all of a sudden
372
+ if (!this.ViewEntityInfo)
373
+ throw new Error(`Entity ${this.record.EntityID} not found in metadata`);
374
+ // prepare the sorting state
375
+ this.sortFields = this.ViewEntityInfo.Fields;
376
+ if (this.record.SortState === null || this.record.SortState === undefined || this.record.SortState.trim().length === 0)
377
+ this.sortState = [];
378
+ else
379
+ this.sortState = JSON.parse(this.record.SortState);
380
+ // now translate the sortState into the UI format by swapping out the primitve field names and sort direction with the data objects that the kendo ui will bind to
381
+ this.sortState = this.sortState.map((s) => {
382
+ var _a;
383
+ let dir;
384
+ if (typeof s.direction === 'string') {
385
+ dir = s.direction;
386
+ }
387
+ else if (typeof s.direction === 'number' && s.direction === 1) { // some legacy views have 1 and 2 for asc and desc
388
+ dir = 'asc';
389
+ }
390
+ else if (typeof s.direction === 'number' && s.direction === 2) {
391
+ dir = 'desc';
392
+ }
393
+ else {
394
+ dir = '';
395
+ }
396
+ return {
397
+ field: (_a = this.ViewEntityInfo) === null || _a === void 0 ? void 0 : _a.Fields.find((f) => f.Name === s.field),
398
+ direction: this.sortDirections.find((d) => d.Value.trim().toLowerCase() === dir)
399
+ };
400
+ });
401
+ this.localGridState = JSON.parse(this.record.GridState);
402
+ const temp = this.localGridState;
403
+ this.localFilterState = JSON.parse(this.record.FilterState);
404
+ this.defaultFilterState = this.localFilterState; // adding a duplicate filter state for populating the default filter state
405
+ this.appendUnusedColumnsToColumnSettings(this.localGridState);
406
+ this.localGridState.columnSettings.sort((a, b) => {
407
+ if (a.hidden && !b.hidden)
408
+ return 1;
409
+ if (!a.hidden && b.hidden)
410
+ return -1;
411
+ // if we get here, they're both hidden, or both not hidden, so sort by orderIndex
412
+ return a.orderIndex - b.orderIndex;
413
+ });
414
+ setTimeout(() => {
415
+ this.keyPressListener = this.onKeyPress.bind(this);
416
+ this.dialogContainer.nativeElement.addEventListener('keypress', this.onKeyPress.bind(this));
417
+ this.nameField.focus();
418
+ }, 200);
419
+ });
420
+ }
421
+ appendUnusedColumnsToColumnSettings(gridState) {
422
+ var _a;
423
+ // we go through our EntityFields and add any that aren't already in the columnSettings
424
+ // this is so that we can add new columns to the view that were not previously used in this view
425
+ const unusedFields = (_a = this.ViewEntityInfo) === null || _a === void 0 ? void 0 : _a.Fields.filter(f => {
426
+ if (gridState.columnSettings.find((col) => col.Name.trim().toLowerCase() === f.Name.trim().toLowerCase()))
427
+ return false; // this entity field is already in the columnSettings
428
+ else
429
+ return true; // this entity field is not in the columnSettings
430
+ });
431
+ // now we add the unused fields to the columnSettings
432
+ unusedFields === null || unusedFields === void 0 ? void 0 : unusedFields.forEach((f) => {
433
+ gridState.columnSettings.push({
434
+ ID: f.ID,
435
+ DisplayName: f.DisplayName,
436
+ Name: f.Name,
437
+ orderIndex: gridState.columnSettings.length,
438
+ width: f.DefaultColumnWidth ? f.DefaultColumnWidth : 100,
439
+ EntityField: f,
440
+ hidden: true
441
+ });
442
+ });
443
+ }
444
+ onDragEnd(e) {
445
+ if (e.index >= 0) {
446
+ // const column = this.localViewColumns[e.index];
447
+ if (this.localGridState) {
448
+ const lvc = this.localGridState.columnSettings;
449
+ for (let i = 0; i < lvc.length; i++) {
450
+ const col = lvc[i];
451
+ col.orderIndex = i; // the orderIndex inside the column is what is actually used to drive this, the order in the ARRAY gets updated by KendoSortable but orderIndex isn't automatically updated
452
+ }
453
+ this.updateRecordGridState();
454
+ }
455
+ }
456
+ }
457
+ updateRecordGridState() {
458
+ const temp = JSON.stringify(this.localGridState);
459
+ const tempO = JSON.parse(temp); // make sure we have a clean object that is NOT linked in memory to the localGridState
460
+ // now strip the EntityField from the columnSettings in the tempO object
461
+ tempO.columnSettings.forEach((col) => {
462
+ delete col.EntityField;
463
+ });
464
+ this.record.GridState = JSON.stringify(tempO); // stringify the state into the record
465
+ }
466
+ onFilterChange(value) {
467
+ this.localFilterState = value;
468
+ }
469
+ toggleColumn(column) {
470
+ return __awaiter(this, void 0, void 0, function* () {
471
+ column.hidden = !column.hidden; // do the toggle
472
+ if (this.localGridState)
473
+ this.updateRecordGridState();
474
+ });
475
+ }
476
+ saveProperties() {
477
+ return __awaiter(this, void 0, void 0, function* () {
478
+ const bNewRecord = !(this.record.PrimaryKey.Value);
479
+ this.showloader = true;
480
+ const lfs = JSON.stringify(this.localFilterState);
481
+ this.record.FilterState = JSON.stringify(this.localFilterState); // pass this along as as string, not directly bound since Kendo Filter is bound to a local object we need to translate to a string
482
+ // need to convert the UI format to the data format.
483
+ const sortMap = this.sortState.map((s) => {
484
+ return {
485
+ field: s.field.Name,
486
+ direction: s.direction.Value
487
+ };
488
+ });
489
+ this.record.SortState = JSON.stringify(sortMap);
490
+ // validate the record first
491
+ const rec = this.record;
492
+ const valResults = this.record.Validate();
493
+ if (valResults.Success === false) {
494
+ this.showloader = false;
495
+ this.sharedService.CreateSimpleNotification('Validation Errors: ' + valResults.Errors.map((e) => e.Message).join('\n'), 'warning', 7500);
496
+ }
497
+ else if (yield this.record.Save()) {
498
+ this.dialogClosed.emit({ Saved: true, ViewEntity: this.record });
499
+ this.isDialogOpened = false; // close the kendo window - this works through ngIf binding
500
+ this.showloader = false;
501
+ if (!bNewRecord) // view already exists so we're not changing the route as it is alreayd on the view, but we fire an event to let people know that it's changed
502
+ MJGlobal.Instance.RaiseEvent({
503
+ event: MJEventType.ComponentEvent,
504
+ eventCode: EventCodes.ViewUpdated,
505
+ args: new ResourceData({
506
+ ResourceTypeID: this.sharedService.ViewResourceType.ID,
507
+ ResourceRecordID: this.record.PrimaryKey.Value,
508
+ Configuration: {
509
+ ViewEntity: this.record
510
+ }
511
+ }),
512
+ component: this
513
+ });
514
+ else
515
+ // we route to the new view using the router
516
+ this.router.navigate(['resource', 'view', this.record.PrimaryKey.Value]);
517
+ }
518
+ else {
519
+ // it failed, so don't close the dialog
520
+ this.showloader = false;
521
+ this.sharedService.CreateSimpleNotification('Saving the view failed, please try again and if this persists contact your administrator.', 'error', 5000);
522
+ }
523
+ });
524
+ }
525
+ get ContainerObjectHeight() {
526
+ if (this.kendoWindow)
527
+ return this.kendoWindow.height;
528
+ else
529
+ return 0;
530
+ }
531
+ addSort() {
532
+ var _a;
533
+ this.sortState = this.sortState.concat({ field: (_a = this.ViewEntityInfo) === null || _a === void 0 ? void 0 : _a.Fields[0], direction: this.sortDirections[0] }); // add a new sort item
534
+ }
535
+ removeSort(item) {
536
+ this.sortState = this.sortState.filter((i) => i !== item);
537
+ }
538
+ sortColumnValueChange(sortItem, newValue) {
539
+ const idx = this.sortState.findIndex((i) => i === sortItem);
540
+ console.log(this.sortState);
541
+ console.log(newValue);
542
+ }
543
+ sortDirectionValueChange(sortItem, newValue) {
544
+ }
545
+ }
546
+ ViewPropertiesDialogComponent.ɵfac = function ViewPropertiesDialogComponent_Factory(t) { return new (t || ViewPropertiesDialogComponent)(i0.ɵɵdirectiveInject(i1.ActivatedRoute), i0.ɵɵdirectiveInject(i0.ElementRef), i0.ɵɵdirectiveInject(i2.SharedService), i0.ɵɵdirectiveInject(i3.FormBuilder), i0.ɵɵdirectiveInject(i1.Router)); };
547
+ ViewPropertiesDialogComponent.ɵcmp = /*@__PURE__*/ i0.ɵɵdefineComponent({ type: ViewPropertiesDialogComponent, selectors: [["app-view-properties-dialog"]], viewQuery: function ViewPropertiesDialogComponent_Query(rf, ctx) { if (rf & 1) {
548
+ i0.ɵɵviewQuery(WindowComponent, 5);
549
+ i0.ɵɵviewQuery(TabComponent, 5);
550
+ i0.ɵɵviewQuery(_c0, 5);
551
+ i0.ɵɵviewQuery(_c1, 5);
552
+ } if (rf & 2) {
553
+ let _t;
554
+ i0.ɵɵqueryRefresh(_t = i0.ɵɵloadQuery()) && (ctx.kendoWindow = _t.first);
555
+ i0.ɵɵqueryRefresh(_t = i0.ɵɵloadQuery()) && (ctx.kendoTab = _t.first);
556
+ i0.ɵɵqueryRefresh(_t = i0.ɵɵloadQuery()) && (ctx.nameField = _t.first);
557
+ i0.ɵɵqueryRefresh(_t = i0.ɵɵloadQuery()) && (ctx.dialogContainer = _t.first);
558
+ } }, inputs: { ViewID: "ViewID", EntityName: "EntityName", ShowPropertiesButton: "ShowPropertiesButton" }, outputs: { dialogClosed: "dialogClosed" }, features: [i0.ɵɵInheritDefinitionFeature], decls: 4, vars: 3, consts: [["kendoButton", "", "class", "view-properties-button", 3, "primary", "click", 4, "ngIf"], ["class", "k-overlay", 4, "ngIf"], ["title", "View Properties", 3, "width", "height", "minHeight", "minWidth", "resizable", "close", "resizeEnd", "heightChange", "widthChange", 4, "ngIf"], ["kendoButton", "", 1, "view-properties-button", 3, "primary", "click"], [3, "icon"], [1, "k-overlay"], ["title", "View Properties", 3, "width", "height", "minHeight", "minWidth", "resizable", "close", "resizeEnd", "heightChange", "widthChange"], ["type", "converging-spinner", 4, "ngIf"], [1, "k-d-flex", "k-flex-col", "k-justify-content-between", "k-h-full"], ["dialogContainer", ""], [1, "popup-content", 3, "keepTabContent", "animate", "height"], ["title", "General", 3, "selected"], ["kendoTabContent", ""], ["title", "Fields"], ["title", "Filters"], ["title", "Sorting"], ["title", "Advanced"], [1, "k-actions", "k-actions-end", "popup-actions"], ["kendoButton", "", "themeColor", "primary", 3, "click"], ["kendoButton", "", 3, "click"], ["type", "converging-spinner"], [1, "view-prop-tab-contents"], [1, "form-group"], ["text", "Name", 1, "k-form-label"], [1, "view-name", 3, "ngModel", "ngModelChange"], ["nameField", ""], [1, "form-group", "form-group-description"], ["text", "Description", 1, "k-form-label"], [1, "k-input", "k-input-solid", "view-description", 3, "ngModel", "ngModelChange"], ["itemClass", "item", "activeItemClass", "item active", 3, "kendoSortableBinding", "animation", "dragEnd"], [1, "item-content"], ["type", "checkbox", "kendoCheckBox", "", 3, "ngModel", "id", "ngModelChange", "change"], [1, "k-checkbox-label", 3, "for", "text"], [1, "smart-filter-container"], ["text", "Smart Filter", 1, "smart-filter-label"], [3, "ngModel", "ngModelChange"], ["class", "smart-filter-prompt", "mjFillContainer", "", 3, "fillHeight", 4, "ngIf"], [4, "ngIf"], ["mjFillContainer", "", 1, "smart-filter-prompt", 3, "fillHeight"], ["placeholder", "Describe how you would like the data filtered", "resizable", "vertical", 3, "rows", "ngModel", "ngModelChange"], [3, "filters", "value", "valueChange"], [1, "sort-header"], [4, "ngFor", "ngForOf"], ["textField", "Name", "valueField", "Name", 1, "sort-column", 3, "data", "ngModel", "valueChange", "ngModelChange"], ["textField", "Name", "valueField", "Value", 1, "sort-direction", 3, "data", "ngModel", "valueChange", "ngModelChange"], [4, "ngElse"], ["resizable", "vertical", 1, "advanced-tab-details", 3, "readonly", "rows", "ngModel", "ngModelChange"]], template: function ViewPropertiesDialogComponent_Template(rf, ctx) { if (rf & 1) {
559
+ i0.ɵɵelementStart(0, "div");
560
+ i0.ɵɵtemplate(1, ViewPropertiesDialogComponent_button_1_Template, 3, 2, "button", 0)(2, ViewPropertiesDialogComponent_div_2_Template, 1, 0, "div", 1)(3, ViewPropertiesDialogComponent_kendo_window_3_Template, 22, 13, "kendo-window", 2);
561
+ i0.ɵɵelementEnd();
562
+ } if (rf & 2) {
563
+ i0.ɵɵadvance();
564
+ i0.ɵɵproperty("ngIf", ctx.ShowPropertiesButton);
565
+ i0.ɵɵadvance();
566
+ i0.ɵɵproperty("ngIf", ctx.isDialogOpened);
567
+ i0.ɵɵadvance();
568
+ i0.ɵɵproperty("ngIf", ctx.isDialogOpened);
569
+ } }, dependencies: [i4.NgForOf, i4.NgIf, i3.DefaultValueAccessor, i3.CheckboxControlValueAccessor, i3.NgControlStatus, i3.NgModel, i5.WindowComponent, i6.ButtonComponent, i7.LoaderComponent, i8.TabStripComponent, i8.TabStripTabComponent, i8.TabContentDirective, i9.TextAreaComponent, i9.TextBoxComponent, i9.SwitchComponent, i9.CheckBoxDirective, i10.LabelComponent, i11.SVGIconComponent, i12.FillContainer, i13.SortableComponent, i13.SortableBindingDirective, i14.FilterComponent, i15.DropDownListComponent], styles: [".view-properties-button[_ngcontent-%COMP%] {\r\n margin-left: 0px;\r\n}\r\n.view-prop-tab-contents[_ngcontent-%COMP%] {\r\n display: flex;\r\n flex-direction: column;\r\n height: 100%; \n\r\n}\r\n\r\n.form-group[_ngcontent-%COMP%] {\r\n display: flex;\r\n flex-direction: row;\r\n align-items: flex-start;\r\n margin-bottom: 10px;\r\n}\r\n\r\n.form-group-description[_ngcontent-%COMP%] {\r\n flex-grow: 1;\r\n}\r\n\r\n.k-form-label[_ngcontent-%COMP%] {\r\n width: 150px; \n\r\n margin-right: 10px;\r\n}\r\n\r\n.view-description[_ngcontent-%COMP%] {\r\n flex-grow: 1;\r\n height: 100%;\r\n padding: 5px;\r\n resize: none;\r\n}\r\n\r\n\r\n\r\n.item-content[_ngcontent-%COMP%] {\r\n display: flex;\r\n justify-content: space-between;\r\n align-items: center;\r\n}\r\n\r\n.popup-content[_ngcontent-%COMP%] {\r\n height: calc(100% - 46px);\r\n}\r\n\r\n.popup-actions[_ngcontent-%COMP%] {\r\n padding: 16px 0 0;\r\n}\r\n\r\n.view-prop-tab-contents[_ngcontent-%COMP%] {\r\n overflow: hidden;\r\n}\r\n\r\n.sort-column[_ngcontent-%COMP%] {\r\n width: 300px;\r\n}\r\n\r\n.sort-direction[_ngcontent-%COMP%] {\r\n width: 125px;\r\n}\r\n\r\n.sort-header[_ngcontent-%COMP%] > button[_ngcontent-%COMP%] {\r\n margin-left: 5px;\r\n margin-bottom: 5px;\r\n width: 75px;\r\n}\r\n\r\n.smart-filter-label[_ngcontent-%COMP%] {\r\n margin-right: 10px;\r\n}\r\n\r\n.smart-filter-prompt[_ngcontent-%COMP%] {\r\n margin-top: 15px;\r\n}\r\n\r\n.advanced-tab-details[_ngcontent-%COMP%]\r\n{\r\n margin-bottom: 10px;\r\n}"] });
570
+ (() => { (typeof ngDevMode === "undefined" || ngDevMode) && i0.ɵsetClassMetadata(ViewPropertiesDialogComponent, [{
571
+ type: Component,
572
+ args: [{ selector: 'app-view-properties-dialog', template: "<div>\r\n <button *ngIf=\"ShowPropertiesButton\"\r\n kendoButton\r\n [primary]=\"true\"\r\n (click)=\"this.Open()\"\r\n class=\"view-properties-button\"\r\n >\r\n <kendo-svgicon [icon]=\"sharedService.kendoSVGIcon('gear')\"></kendo-svgicon>\r\n Properties</button>\r\n <div class=\"k-overlay\" *ngIf=\"isDialogOpened\"></div>\r\n <kendo-window\r\n [width]=\"700\"\r\n [height]=\"525\"\r\n [minHeight]=\"300\"\r\n [minWidth]=\"400\"\r\n [resizable]=\"true\"\r\n title=\"View Properties\"\r\n *ngIf=\"isDialogOpened\"\r\n (close)=\"closePropertiesDialog()\"\r\n (resizeEnd)=\"this.ResizeTab()\"\r\n (heightChange)=\"this.ResizeTab()\"\r\n (widthChange)=\"this.ResizeTab()\"\r\n >\r\n <kendo-loader *ngIf=\"showloader\" type=\"converging-spinner\" ></kendo-loader>\r\n <div class=\"k-d-flex k-flex-col k-justify-content-between k-h-full\" #dialogContainer>\r\n <div [class]=\"showloader ? 'disabled-div' : ''\">\r\n <kendo-tabstrip class=\"popup-content\" [keepTabContent]=\"true\" [animate] = \"false\" [height]=\"TabHeight\" >\r\n\r\n <kendo-tabstrip-tab title=\"General\" [selected]=\"true\">\r\n <ng-template kendoTabContent>\r\n <div class=\"view-prop-tab-contents\">\r\n <div class=\"form-group\">\r\n <kendo-label class=\"k-form-label\" text=\"Name\"></kendo-label>\r\n <kendo-textbox #nameField class=\"view-name\" [(ngModel)]=\"record.Name\"></kendo-textbox>\r\n </div>\r\n <div class=\"form-group form-group-description\">\r\n <kendo-label class=\"k-form-label\" text=\"Description\"></kendo-label>\r\n <textarea class=\"k-input k-input-solid view-description\" [(ngModel)]=\"record.Description\"></textarea>\r\n </div>\r\n </div>\r\n </ng-template>\r\n </kendo-tabstrip-tab>\r\n \r\n <kendo-tabstrip-tab title=\"Fields\">\r\n <ng-template kendoTabContent>\r\n \r\n <kendo-sortable\r\n [kendoSortableBinding]=\"this.localGridState.columnSettings\"\r\n [animation]=\"true\"\r\n itemClass=\"item\"\r\n activeItemClass=\"item active\"\r\n (dragEnd)=\"onDragEnd($event)\"\r\n >\r\n <ng-template let-col=\"item\">\r\n <div class=\"item-content\">\r\n <div>\r\n <input\r\n type=\"checkbox\"\r\n [(ngModel)]=\"!col.hidden\"\r\n id=\"column_{{col.ID}}\"\r\n kendoCheckBox\r\n (change)=\"toggleColumn(col)\"\r\n />\r\n <kendo-label\r\n [for]=\"'column_'+col.ID\"\r\n [text]=\"col.DisplayName ? col.DisplayName : col.Name\"\r\n class=\"k-checkbox-label\"\r\n ></kendo-label>\r\n </div>\r\n <kendo-svgicon [icon]=\"sharedService.kendoSVGIcon('reorder')\"></kendo-svgicon>\r\n </div>\r\n </ng-template>\r\n </kendo-sortable>\r\n </ng-template>\r\n </kendo-tabstrip-tab>\r\n \r\n <kendo-tabstrip-tab title=\"Filters\">\r\n <ng-template kendoTabContent>\r\n <div class=\"smart-filter-container\">\r\n <kendo-label text=\"Smart Filter\" class=\"smart-filter-label\"></kendo-label>\r\n <kendo-switch [(ngModel)]=\"record.SmartFilterEnabled\"></kendo-switch>\r\n </div>\r\n <div *ngIf=\"record.SmartFilterEnabled\" class=\"smart-filter-prompt\" mjFillContainer [fillHeight]=\"true\">\r\n <kendo-textarea\r\n placeholder=\"Describe how you would like the data filtered\"\r\n [rows]=\"10\"\r\n [(ngModel)]=\"record.SmartFilterPrompt\"\r\n resizable=\"vertical\"\r\n ></kendo-textarea>\r\n </div>\r\n <div *ngIf=\"!record.SmartFilterEnabled\">\r\n <kendo-filter\r\n [filters]=\"ViewEntityInfo!.Fields.map(toKendoFilterField)\"\r\n [value]=\"defaultFilterState\"\r\n (valueChange)=\"onFilterChange($event)\"\r\n >\r\n </kendo-filter>\r\n </div>\r\n </ng-template>\r\n </kendo-tabstrip-tab>\r\n\r\n <kendo-tabstrip-tab title=\"Sorting\">\r\n <ng-template kendoTabContent>\r\n <div class=\"sort-header\">\r\n <button kendoButton (click)=\"addSort()\">\r\n <kendo-svgicon [icon]=\"sharedService.kendoSVGIcon('filterAddExpression')\"></kendo-svgicon>\r\n </button>\r\n \r\n </div>\r\n <div *ngFor=\"let s of this.sortState\"> \r\n <kendo-dropdownlist \r\n class=\"sort-column\"\r\n [data]=\"sortFields\"\r\n textField=\"Name\"\r\n valueField=\"Name\"\r\n (valueChange)=\"sortColumnValueChange(s, $event)\"\r\n [(ngModel)]=\"s.field\"\r\n >\r\n </kendo-dropdownlist>\r\n <kendo-dropdownlist\r\n class=\"sort-direction\"\r\n [data]=\"sortDirections\"\r\n textField=\"Name\"\r\n valueField=\"Value\"\r\n (valueChange)=\"sortDirectionValueChange(s, $event)\"\r\n [(ngModel)]=\"s.direction\"\r\n >\r\n </kendo-dropdownlist>\r\n <button kendoButton (click)=\"removeSort(s)\"><kendo-svgicon [icon]=\"sharedService.kendoSVGIcon('sortClear')\"></kendo-svgicon></button>\r\n </div> \r\n </ng-template>\r\n </kendo-tabstrip-tab>\r\n\r\n <kendo-tabstrip-tab title=\"Advanced\">\r\n <ng-template kendoTabContent>\r\n <div *ngIf=\"record.SmartFilterEnabled\">\r\n <kendo-textarea\r\n [readonly]=\"true\"\r\n [rows]=\"5\"\r\n [(ngModel)]=\"record.SmartFilterExplanation\"\r\n resizable=\"vertical\"\r\n class=\"advanced-tab-details\"\r\n ></kendo-textarea>\r\n <kendo-textarea\r\n [readonly]=\"true\"\r\n [rows]=\"5\"\r\n [(ngModel)]=\"record.SmartFilterWhereClause\"\r\n resizable=\"vertical\"\r\n class=\"advanced-tab-details\"\r\n ></kendo-textarea> \r\n </div>\r\n <div *ngElse>\r\n <kendo-textarea\r\n [readonly]=\"true\"\r\n [rows]=\"7\"\r\n [(ngModel)]=\"record.WhereClause\"\r\n resizable=\"vertical\"\r\n class=\"advanced-tab-details\"\r\n ></kendo-textarea>\r\n </div>\r\n\r\n </ng-template>\r\n </kendo-tabstrip-tab>\r\n\r\n </kendo-tabstrip>\r\n \r\n <div class=\"k-actions k-actions-end popup-actions\">\r\n <button kendoButton (click)=\"saveProperties()\" themeColor=\"primary\">\r\n <kendo-svgicon [icon]=\"sharedService.kendoSVGIcon('save')\"></kendo-svgicon>\r\n Save\r\n </button>\r\n <button kendoButton (click)=\"closePropertiesDialog()\">Cancel</button>\r\n </div>\r\n </div>\r\n </div>\r\n </kendo-window>\r\n</div>\r\n", styles: [".view-properties-button {\r\n margin-left: 0px;\r\n}\r\n.view-prop-tab-contents {\r\n display: flex;\r\n flex-direction: column;\r\n height: 100%; /* Set to the height you want */\r\n}\r\n\r\n.form-group {\r\n display: flex;\r\n flex-direction: row;\r\n align-items: flex-start;\r\n margin-bottom: 10px;\r\n}\r\n\r\n.form-group-description {\r\n flex-grow: 1;\r\n}\r\n\r\n.k-form-label {\r\n width: 150px; /* Adjust as needed */\r\n margin-right: 10px;\r\n}\r\n\r\n.view-description {\r\n flex-grow: 1;\r\n height: 100%;\r\n padding: 5px;\r\n resize: none;\r\n}\r\n\r\n\r\n\r\n.item-content {\r\n display: flex;\r\n justify-content: space-between;\r\n align-items: center;\r\n}\r\n\r\n.popup-content {\r\n height: calc(100% - 46px);\r\n}\r\n\r\n.popup-actions {\r\n padding: 16px 0 0;\r\n}\r\n\r\n.view-prop-tab-contents {\r\n overflow: hidden;\r\n}\r\n\r\n.sort-column {\r\n width: 300px;\r\n}\r\n\r\n.sort-direction {\r\n width: 125px;\r\n}\r\n\r\n.sort-header > button {\r\n margin-left: 5px;\r\n margin-bottom: 5px;\r\n width: 75px;\r\n}\r\n\r\n.smart-filter-label {\r\n margin-right: 10px;\r\n}\r\n\r\n.smart-filter-prompt {\r\n margin-top: 15px;\r\n}\r\n\r\n.advanced-tab-details\r\n{\r\n margin-bottom: 10px;\r\n}"] }]
573
+ }], () => [{ type: i1.ActivatedRoute }, { type: i0.ElementRef }, { type: i2.SharedService }, { type: i3.FormBuilder }, { type: i1.Router }], { ViewID: [{
574
+ type: Input
575
+ }], EntityName: [{
576
+ type: Input
577
+ }], ShowPropertiesButton: [{
578
+ type: Input
579
+ }], dialogClosed: [{
580
+ type: Output
581
+ }], kendoWindow: [{
582
+ type: ViewChild,
583
+ args: [WindowComponent]
584
+ }], kendoTab: [{
585
+ type: ViewChild,
586
+ args: [TabComponent]
587
+ }], nameField: [{
588
+ type: ViewChild,
589
+ args: ['nameField']
590
+ }], dialogContainer: [{
591
+ type: ViewChild,
592
+ args: ['dialogContainer']
593
+ }] }); })();
594
+ (() => { (typeof ngDevMode === "undefined" || ngDevMode) && i0.ɵsetClassDebugInfo(ViewPropertiesDialogComponent, { className: "ViewPropertiesDialogComponent", filePath: "src\\lib\\user-view-properties\\view-properties-dialog.component.ts", lineNumber: 23 }); })();