@memberjunction/ng-explorer-settings 0.9.10 → 0.9.13

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 (25) hide show
  1. package/dist/lib/application-entities-grid/application-entities-grid.component.d.ts +51 -0
  2. package/dist/lib/application-entities-grid/application-entities-grid.component.js +348 -0
  3. package/dist/lib/entity-form-dialog/entity-form-dialog.component.d.ts +33 -0
  4. package/dist/lib/entity-form-dialog/entity-form-dialog.component.js +183 -0
  5. package/dist/lib/entity-form-window/entity-form-window.component.d.ts +17 -0
  6. package/dist/lib/entity-form-window/entity-form-window.component.js +99 -0
  7. package/dist/lib/module.d.ts +21 -14
  8. package/dist/lib/module.js +50 -8
  9. package/dist/lib/record-list/record-list.component.d.ts +41 -0
  10. package/dist/lib/record-list/record-list.component.js +324 -0
  11. package/dist/lib/roles-list/roles-list.component.d.ts +11 -1
  12. package/dist/lib/roles-list/roles-list.component.js +125 -26
  13. package/dist/lib/settings/settings.component.d.ts +26 -2
  14. package/dist/lib/settings/settings.component.js +136 -66
  15. package/dist/lib/single-application/single-application.component.d.ts +22 -0
  16. package/dist/lib/single-application/single-application.component.js +144 -0
  17. package/dist/lib/single-role/single-role.component.d.ts +16 -13
  18. package/dist/lib/single-role/single-role.component.js +112 -182
  19. package/dist/lib/single-user/single-user.component.d.ts +24 -0
  20. package/dist/lib/single-user/single-user.component.js +191 -0
  21. package/dist/lib/user-roles-grid/user-roles-grid.component.d.ts +41 -0
  22. package/dist/lib/user-roles-grid/user-roles-grid.component.js +320 -0
  23. package/dist/public-api.d.ts +4 -1
  24. package/dist/public-api.js +4 -1
  25. package/package.json +9 -4
@@ -0,0 +1,144 @@
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, Input, ViewChild } from '@angular/core';
11
+ import { Metadata } from '@memberjunction/core';
12
+ import { kendoSVGIcon } from '@memberjunction/ng-shared';
13
+ import * as i0 from "@angular/core";
14
+ import * as i1 from "@angular/common";
15
+ import * as i2 from "@memberjunction/ng-container-directives";
16
+ import * as i3 from "@progress/kendo-angular-icons";
17
+ import * as i4 from "@progress/kendo-angular-layout";
18
+ import * as i5 from "@memberjunction/ng-entity-form-dialog";
19
+ import * as i6 from "@progress/kendo-angular-indicators";
20
+ import * as i7 from "../application-entities-grid/application-entities-grid.component";
21
+ const _c0 = ["entityForm"];
22
+ function SingleApplicationComponent_div_1_Template(rf, ctx) { if (rf & 1) {
23
+ i0.ɵɵelementStart(0, "div");
24
+ i0.ɵɵelement(1, "kendo-loader");
25
+ i0.ɵɵelementEnd();
26
+ } }
27
+ function SingleApplicationComponent_div_2_ng_template_16_mj_application_entities_grid_0_Template(rf, ctx) { if (rf & 1) {
28
+ i0.ɵɵelement(0, "mj-application-entities-grid", 11);
29
+ } if (rf & 2) {
30
+ const ctx_r4 = i0.ɵɵnextContext(3);
31
+ i0.ɵɵproperty("ApplicationName", ctx_r4.ApplicationName)("ApplicationRecord", ctx_r4.Record);
32
+ } }
33
+ function SingleApplicationComponent_div_2_ng_template_16_Template(rf, ctx) { if (rf & 1) {
34
+ i0.ɵɵtemplate(0, SingleApplicationComponent_div_2_ng_template_16_mj_application_entities_grid_0_Template, 1, 2, "mj-application-entities-grid", 10);
35
+ } if (rf & 2) {
36
+ const ctx_r3 = i0.ɵɵnextContext(2);
37
+ i0.ɵɵproperty("ngIf", ctx_r3.ApplicationName && ctx_r3.Record);
38
+ } }
39
+ function SingleApplicationComponent_div_2_Template(rf, ctx) { if (rf & 1) {
40
+ const _r6 = i0.ɵɵgetCurrentView();
41
+ i0.ɵɵelementStart(0, "div")(1, "table", 4)(2, "tbody")(3, "tr")(4, "th", 5);
42
+ i0.ɵɵtext(5, "Application");
43
+ i0.ɵɵelementEnd();
44
+ i0.ɵɵelementStart(6, "td");
45
+ i0.ɵɵtext(7);
46
+ i0.ɵɵelementStart(8, "kendo-svgicon", 6);
47
+ i0.ɵɵlistener("click", function SingleApplicationComponent_div_2_Template_kendo_svgicon_click_8_listener() { i0.ɵɵrestoreView(_r6); const ctx_r5 = i0.ɵɵnextContext(); return i0.ɵɵresetView(ctx_r5.EditRecord()); });
48
+ i0.ɵɵelementEnd()()();
49
+ i0.ɵɵelementStart(9, "tr")(10, "th", 5);
50
+ i0.ɵɵtext(11, "Description");
51
+ i0.ɵɵelementEnd();
52
+ i0.ɵɵelementStart(12, "td");
53
+ i0.ɵɵtext(13);
54
+ i0.ɵɵelementEnd()()()();
55
+ i0.ɵɵelementStart(14, "kendo-tabstrip", 7)(15, "kendo-tabstrip-tab", 8);
56
+ i0.ɵɵtemplate(16, SingleApplicationComponent_div_2_ng_template_16_Template, 1, 1, "ng-template", 9);
57
+ i0.ɵɵelementEnd()()();
58
+ } if (rf & 2) {
59
+ const ctx_r1 = i0.ɵɵnextContext();
60
+ i0.ɵɵadvance(7);
61
+ i0.ɵɵtextInterpolate(ctx_r1.Record.Name);
62
+ i0.ɵɵadvance();
63
+ i0.ɵɵproperty("icon", ctx_r1.kendoSVGIcon("pencil"));
64
+ i0.ɵɵadvance(5);
65
+ i0.ɵɵtextInterpolate(ctx_r1.Record.Description);
66
+ i0.ɵɵadvance();
67
+ i0.ɵɵproperty("keepTabContent", true)("animate", false);
68
+ i0.ɵɵadvance();
69
+ i0.ɵɵproperty("selected", true);
70
+ } }
71
+ export class SingleApplicationComponent {
72
+ constructor(cdRef) {
73
+ this.cdRef = cdRef;
74
+ this.gridHeight = 750;
75
+ this.isLoading = false;
76
+ this.Record = null;
77
+ this.kendoSVGIcon = kendoSVGIcon;
78
+ this.showEntityEditingForm = false;
79
+ }
80
+ ngOnInit() {
81
+ this.Refresh();
82
+ }
83
+ Refresh() {
84
+ return __awaiter(this, void 0, void 0, function* () {
85
+ if (this.ApplicationName && this.ApplicationName.length > 0) {
86
+ this.isLoading = true;
87
+ const md = new Metadata();
88
+ let a = md.Applications.find(a => a.Name === this.ApplicationName);
89
+ if (!a) {
90
+ // sometime we are creating a new role, so attempt to refresh our metadata
91
+ yield md.Refresh();
92
+ a = md.Applications.find(aa => aa.Name === this.ApplicationName);
93
+ if (!a)
94
+ throw new Error(`Application ${this.ApplicationName} not found`);
95
+ }
96
+ this.Record = yield md.GetEntityObject('Applications');
97
+ yield this.Record.Load(a.ID);
98
+ }
99
+ this.isLoading = false;
100
+ });
101
+ }
102
+ EditRecord() {
103
+ return __awaiter(this, void 0, void 0, function* () {
104
+ // show the dialog
105
+ this.showEntityEditingForm = true;
106
+ });
107
+ }
108
+ onEntityFormClosed(result) {
109
+ return __awaiter(this, void 0, void 0, function* () {
110
+ this.showEntityEditingForm = false;
111
+ });
112
+ }
113
+ }
114
+ SingleApplicationComponent.ɵfac = function SingleApplicationComponent_Factory(t) { return new (t || SingleApplicationComponent)(i0.ɵɵdirectiveInject(i0.ChangeDetectorRef)); };
115
+ SingleApplicationComponent.ɵcmp = /*@__PURE__*/ i0.ɵɵdefineComponent({ type: SingleApplicationComponent, selectors: [["mj-single-application"]], viewQuery: function SingleApplicationComponent_Query(rf, ctx) { if (rf & 1) {
116
+ i0.ɵɵviewQuery(_c0, 5);
117
+ } if (rf & 2) {
118
+ let _t;
119
+ i0.ɵɵqueryRefresh(_t = i0.ɵɵloadQuery()) && (ctx.entityFormComponent = _t.first);
120
+ } }, inputs: { ApplicationName: "ApplicationName" }, decls: 5, vars: 8, consts: [["mjFillContainer", ""], [4, "ngIf"], ["SectionName", "details", "Mode", "section", 3, "Record", "Visible", "AutoRevertOnCancel", "HandleSave", "Width", "Height", "close"], ["entityForm", ""], [1, "info-table"], ["scope", "row"], [1, "edit-icon", 3, "icon", "click"], [3, "keepTabContent", "animate"], ["title", "Entities", 3, "selected"], ["kendoTabContent", ""], ["Mode", "Applications", 3, "ApplicationName", "ApplicationRecord", 4, "ngIf"], ["Mode", "Applications", 3, "ApplicationName", "ApplicationRecord"]], template: function SingleApplicationComponent_Template(rf, ctx) { if (rf & 1) {
121
+ i0.ɵɵelementStart(0, "div", 0);
122
+ i0.ɵɵtemplate(1, SingleApplicationComponent_div_1_Template, 2, 0, "div", 1)(2, SingleApplicationComponent_div_2_Template, 17, 6, "div", 1);
123
+ i0.ɵɵelementEnd();
124
+ i0.ɵɵelementStart(3, "mj-entity-form-dialog", 2, 3);
125
+ i0.ɵɵlistener("close", function SingleApplicationComponent_Template_mj_entity_form_dialog_close_3_listener($event) { return ctx.onEntityFormClosed($event); });
126
+ i0.ɵɵelementEnd();
127
+ } if (rf & 2) {
128
+ i0.ɵɵadvance();
129
+ i0.ɵɵproperty("ngIf", ctx.isLoading);
130
+ i0.ɵɵadvance();
131
+ i0.ɵɵproperty("ngIf", !ctx.isLoading && ctx.Record);
132
+ i0.ɵɵadvance();
133
+ i0.ɵɵproperty("Record", ctx.Record)("Visible", ctx.showEntityEditingForm)("AutoRevertOnCancel", true)("HandleSave", true)("Width", 550)("Height", 450);
134
+ } }, dependencies: [i1.NgIf, i2.FillContainer, i3.SVGIconComponent, i4.TabStripComponent, i4.TabStripTabComponent, i4.TabContentDirective, i5.EntityFormDialog, i6.LoaderComponent, i7.ApplicationEntitiesGridComponent], styles: ["button[_ngcontent-%COMP%] {\r\n margin-left: 5px;\r\n margin-top: 5px;\r\n width: 125px;\r\n}\r\n\r\n\r\n\r\n.name[_ngcontent-%COMP%] {\r\n font-weight: bold;\r\n font-size: 20px;\r\n margin-left: 5px;\r\n margin-top: 5px;\r\n}\r\n\r\n.info-table[_ngcontent-%COMP%] {\r\n width: 100%; \n\r\n border-collapse: collapse; \n\r\n margin-bottom: 10px;\r\n}\r\n\r\n.info-table[_ngcontent-%COMP%] th[_ngcontent-%COMP%] {\r\n width: 150px; \n\r\n font-weight: bold; \n\r\n text-align: left; \n\r\n padding: 8px; \n\r\n border: none; \n\r\n background-color: transparent; \n\r\n}\r\n\r\n.info-table[_ngcontent-%COMP%] td[_ngcontent-%COMP%] {\r\n text-align: left; \n\r\n padding: 8px; \n\r\n border: none; \n\r\n background-color: transparent; \n\r\n overflow: hidden; \n\r\n text-overflow: ellipsis; \n\r\n}\r\n\r\n\n\r\n.edit-icon[_ngcontent-%COMP%] {\r\n margin-left: 20px; \r\n vertical-align: middle;;\r\n cursor: pointer; \n\r\n}\r\n\r\n.edit-icon[_ngcontent-%COMP%]:hover {\r\n fill: #007bff; \n\r\n}"] });
135
+ (() => { (typeof ngDevMode === "undefined" || ngDevMode) && i0.ɵsetClassMetadata(SingleApplicationComponent, [{
136
+ type: Component,
137
+ args: [{ selector: 'mj-single-application', template: "<div mjFillContainer>\r\n <div *ngIf=\"isLoading\"><kendo-loader></kendo-loader></div>\r\n <div *ngIf=\"!isLoading && Record\">\r\n <table class=\"info-table\">\r\n <tbody>\r\n <tr>\r\n <th scope=\"row\">Application</th>\r\n <td>{{Record.Name}}<kendo-svgicon class='edit-icon' [icon]=\"kendoSVGIcon('pencil')\" (click)=\"EditRecord()\"></kendo-svgicon></td>\r\n </tr>\r\n <tr>\r\n <th scope=\"row\">Description</th>\r\n <td>{{Record.Description}}</td>\r\n </tr>\r\n </tbody>\r\n </table> \r\n <kendo-tabstrip\r\n [keepTabContent]=\"true\"\r\n [animate]=\"false\" \r\n > \r\n <kendo-tabstrip-tab title=\"Entities\" [selected]=\"true\">\r\n <ng-template kendoTabContent>\r\n <mj-application-entities-grid *ngIf=\"ApplicationName && Record\" Mode=\"Applications\" [ApplicationName]=\"ApplicationName\" [ApplicationRecord]=\"Record\"></mj-application-entities-grid>\r\n </ng-template>\r\n </kendo-tabstrip-tab>\r\n </kendo-tabstrip>\r\n </div>\r\n</div>\r\n\r\n\r\n<mj-entity-form-dialog #entityForm \r\n [Record]=\"Record\" \r\n SectionName=\"details\" \r\n Mode=\"section\" \r\n [Visible]=\"showEntityEditingForm\" \r\n [AutoRevertOnCancel]=\"true\"\r\n [HandleSave]=\"true\"\r\n [Width]=\"550\"\r\n [Height]=\"450\"\r\n (close)=\"onEntityFormClosed($event)\">\r\n</mj-entity-form-dialog>\r\n", styles: ["button {\r\n margin-left: 5px;\r\n margin-top: 5px;\r\n width: 125px;\r\n}\r\n\r\n\r\n\r\n.name {\r\n font-weight: bold;\r\n font-size: 20px;\r\n margin-left: 5px;\r\n margin-top: 5px;\r\n}\r\n\r\n.info-table {\r\n width: 100%; /* Take up the full width of the container */\r\n border-collapse: collapse; /* For a cleaner look */\r\n margin-bottom: 10px;\r\n}\r\n\r\n.info-table th {\r\n width: 150px; /* Adjust this fixed width as needed */\r\n font-weight: bold; /* Make header labels bold */\r\n text-align: left; /* Align text to the left */\r\n padding: 8px; /* Add some padding for spacing */\r\n border: none; /* Removes the borders */\r\n background-color: transparent; /* Removes any background color */\r\n}\r\n\r\n.info-table td {\r\n text-align: left; /* Align text to the left */\r\n padding: 8px; /* Add some padding for spacing */\r\n border: none; /* Removes the borders */\r\n background-color: transparent; /* Removes any background color */\r\n overflow: hidden; /* Prevents content from overflowing */\r\n text-overflow: ellipsis; /* Adds an ellipsis if the text overflows */\r\n}\r\n\r\n/* Style for SVG icon */\r\n.edit-icon {\r\n margin-left: 20px; \r\n vertical-align: middle;;\r\n cursor: pointer; /* Changes the cursor to a pointer */\r\n}\r\n\r\n.edit-icon:hover {\r\n fill: #007bff; /* Changes the color on hover, set to the color you prefer */\r\n}"] }]
138
+ }], () => [{ type: i0.ChangeDetectorRef }], { ApplicationName: [{
139
+ type: Input
140
+ }], entityFormComponent: [{
141
+ type: ViewChild,
142
+ args: ['entityForm']
143
+ }] }); })();
144
+ (() => { (typeof ngDevMode === "undefined" || ngDevMode) && i0.ɵsetClassDebugInfo(SingleApplicationComponent, { className: "SingleApplicationComponent", filePath: "src\\lib\\single-application\\single-application.component.ts", lineNumber: 14 }); })();
@@ -1,6 +1,7 @@
1
- import { OnInit, SimpleChanges, OnChanges } from '@angular/core';
1
+ import { OnInit, ChangeDetectorRef } from '@angular/core';
2
2
  import { kendoSVGIcon } from '@memberjunction/ng-shared';
3
- import { UserRoleEntity } from '@memberjunction/core-entities';
3
+ import { RoleEntity, UserRoleEntity } from '@memberjunction/core-entities';
4
+ import { EntityFormDialog } from '@memberjunction/ng-entity-form-dialog';
4
5
  import * as i0 from "@angular/core";
5
6
  export declare class UserRoleEntity_Ext extends UserRoleEntity {
6
7
  private _selected;
@@ -12,22 +13,24 @@ export declare class UserRoleEntity_Ext extends UserRoleEntity {
12
13
  private _userID;
13
14
  get SavedUserID(): number;
14
15
  set SavedUserID(value: number);
16
+ private _savedRoleName;
17
+ get SavedRoleName(): string;
18
+ set SavedRoleName(value: string);
15
19
  }
16
- export declare class SingleRoleComponent implements OnInit, OnChanges {
20
+ export declare class SingleRoleComponent implements OnInit {
21
+ private cdRef;
17
22
  RoleName: string;
18
- BottomMargin: number;
19
- userRoles: UserRoleEntity_Ext[];
23
+ entityFormComponent: EntityFormDialog;
20
24
  gridHeight: number;
21
25
  isLoading: boolean;
26
+ RoleRecord: RoleEntity | null;
22
27
  kendoSVGIcon: typeof kendoSVGIcon;
23
- constructor();
28
+ showEntityEditingForm: boolean;
29
+ constructor(cdRef: ChangeDetectorRef);
24
30
  ngOnInit(): void;
25
- ngOnChanges(changes: SimpleChanges): void;
26
- Refresh(): Promise<void>;
27
- saveUserRoles(): Promise<void>;
28
- get NumDirty(): number;
29
- protected IsReallyDirty(ur: UserRoleEntity_Ext): boolean;
30
- flipState($event: MouseEvent, ur: UserRoleEntity_Ext, flipState: boolean): void;
31
+ protected Refresh(): Promise<void>;
32
+ EditRecord(): Promise<void>;
33
+ onEntityFormClosed(result: 'Save' | 'Cancel'): Promise<void>;
31
34
  static ɵfac: i0.ɵɵFactoryDeclaration<SingleRoleComponent, never>;
32
- static ɵcmp: i0.ɵɵComponentDeclaration<SingleRoleComponent, "mj-single-role", never, { "RoleName": { "alias": "RoleName"; "required": false; }; "BottomMargin": { "alias": "BottomMargin"; "required": false; }; }, {}, never, never, false, never>;
35
+ static ɵcmp: i0.ɵɵComponentDeclaration<SingleRoleComponent, "mj-single-role", never, { "RoleName": { "alias": "RoleName"; "required": false; }; }, {}, never, never, false, never>;
33
36
  }
@@ -13,88 +13,89 @@ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, ge
13
13
  step((generator = generator.apply(thisArg, _arguments || [])).next());
14
14
  });
15
15
  };
16
- import { Component, Input } from '@angular/core';
17
- import { BaseEntity, Metadata, RunView } from '@memberjunction/core';
16
+ import { Component, Input, ViewChild } from '@angular/core';
17
+ import { BaseEntity, Metadata } from '@memberjunction/core';
18
18
  import { kendoSVGIcon } from '@memberjunction/ng-shared';
19
19
  import { UserRoleEntity } from '@memberjunction/core-entities';
20
20
  import { RegisterClass } from '@memberjunction/global';
21
21
  import * as i0 from "@angular/core";
22
- import * as i1 from "@angular/common";
23
- import * as i2 from "@angular/forms";
24
- import * as i3 from "@memberjunction/ng-container-directives";
25
- import * as i4 from "@progress/kendo-angular-buttons";
26
- import * as i5 from "@memberjunction/ng-entity-permissions";
27
- import * as i6 from "@progress/kendo-angular-layout";
22
+ const _c0 = ["entityForm"];
28
23
  function SingleRoleComponent_div_1_Template(rf, ctx) { if (rf & 1) {
29
24
  i0.ɵɵelementStart(0, "div");
30
- i0.ɵɵtext(1, "Loading...");
25
+ i0.ɵɵelement(1, "kendo-loader");
31
26
  i0.ɵɵelementEnd();
32
27
  } }
33
- function SingleRoleComponent_ng_template_4_table_5_tr_8_Template(rf, ctx) { if (rf & 1) {
34
- const _r7 = i0.ɵɵgetCurrentView();
35
- i0.ɵɵelementStart(0, "tr")(1, "td");
36
- i0.ɵɵtext(2);
28
+ function SingleRoleComponent_div_2_ng_template_26_Template(rf, ctx) { if (rf & 1) {
29
+ i0.ɵɵelement(0, "mj-user-roles-grid", 11);
30
+ } if (rf & 2) {
31
+ const ctx_r3 = i0.ɵɵnextContext(2);
32
+ i0.ɵɵproperty("RoleName", ctx_r3.RoleName)("RoleRecord", ctx_r3.RoleRecord);
33
+ } }
34
+ function SingleRoleComponent_div_2_ng_template_28_mj_entity_permissions_grid_1_Template(rf, ctx) { if (rf & 1) {
35
+ i0.ɵɵelement(0, "mj-entity-permissions-grid", 14);
36
+ } if (rf & 2) {
37
+ const ctx_r5 = i0.ɵɵnextContext(3);
38
+ i0.ɵɵproperty("RoleName", ctx_r5.RoleRecord.Name);
39
+ } }
40
+ function SingleRoleComponent_div_2_ng_template_28_Template(rf, ctx) { if (rf & 1) {
41
+ i0.ɵɵelementStart(0, "div", 12);
42
+ i0.ɵɵtemplate(1, SingleRoleComponent_div_2_ng_template_28_mj_entity_permissions_grid_1_Template, 1, 1, "mj-entity-permissions-grid", 13);
37
43
  i0.ɵɵelementEnd();
38
- i0.ɵɵelementStart(3, "td", 12);
39
- i0.ɵɵlistener("click", function SingleRoleComponent_ng_template_4_table_5_tr_8_Template_td_click_3_listener($event) { const restoredCtx = i0.ɵɵrestoreView(_r7); const ur_r5 = restoredCtx.$implicit; const ctx_r6 = i0.ɵɵnextContext(3); return i0.ɵɵresetView(ctx_r6.flipState($event, ur_r5, true)); });
40
- i0.ɵɵelementStart(4, "input", 13);
41
- i0.ɵɵtwoWayListener("ngModelChange", function SingleRoleComponent_ng_template_4_table_5_tr_8_Template_input_ngModelChange_4_listener($event) { const restoredCtx = i0.ɵɵrestoreView(_r7); const ur_r5 = restoredCtx.$implicit; i0.ɵɵtwoWayBindingSet(ur_r5.Selected, $event) || (ur_r5.Selected = $event); return i0.ɵɵresetView($event); });
42
- i0.ɵɵlistener("click", function SingleRoleComponent_ng_template_4_table_5_tr_8_Template_input_click_4_listener($event) { const restoredCtx = i0.ɵɵrestoreView(_r7); const ur_r5 = restoredCtx.$implicit; const ctx_r9 = i0.ɵɵnextContext(3); return i0.ɵɵresetView(ctx_r9.flipState($event, ur_r5, false)); });
43
- i0.ɵɵelementEnd()()();
44
44
  } if (rf & 2) {
45
- const ur_r5 = ctx.$implicit;
46
- i0.ɵɵadvance(2);
47
- i0.ɵɵtextInterpolate(ur_r5.User);
48
- i0.ɵɵadvance(2);
49
- i0.ɵɵtwoWayProperty("ngModel", ur_r5.Selected);
45
+ const ctx_r4 = i0.ɵɵnextContext(2);
46
+ i0.ɵɵadvance();
47
+ i0.ɵɵproperty("ngIf", ctx_r4.RoleRecord && ctx_r4.RoleRecord.Name);
50
48
  } }
51
- function SingleRoleComponent_ng_template_4_table_5_Template(rf, ctx) { if (rf & 1) {
52
- i0.ɵɵelementStart(0, "table", 10)(1, "thead")(2, "tr")(3, "th");
53
- i0.ɵɵtext(4, "User");
49
+ function SingleRoleComponent_div_2_Template(rf, ctx) { if (rf & 1) {
50
+ const _r7 = i0.ɵɵgetCurrentView();
51
+ i0.ɵɵelementStart(0, "div")(1, "table", 4)(2, "tbody")(3, "tr")(4, "th", 5);
52
+ i0.ɵɵtext(5, "Role");
54
53
  i0.ɵɵelementEnd();
55
- i0.ɵɵelementStart(5, "th");
56
- i0.ɵɵtext(6, "In Role");
54
+ i0.ɵɵelementStart(6, "td");
55
+ i0.ɵɵtext(7);
56
+ i0.ɵɵelementStart(8, "kendo-svgicon", 6);
57
+ i0.ɵɵlistener("click", function SingleRoleComponent_div_2_Template_kendo_svgicon_click_8_listener() { i0.ɵɵrestoreView(_r7); const ctx_r6 = i0.ɵɵnextContext(); return i0.ɵɵresetView(ctx_r6.EditRecord()); });
57
58
  i0.ɵɵelementEnd()()();
58
- i0.ɵɵelementStart(7, "tbody");
59
- i0.ɵɵtemplate(8, SingleRoleComponent_ng_template_4_table_5_tr_8_Template, 5, 2, "tr", 11);
59
+ i0.ɵɵelementStart(9, "tr")(10, "th", 5);
60
+ i0.ɵɵtext(11, "Description");
61
+ i0.ɵɵelementEnd();
62
+ i0.ɵɵelementStart(12, "td");
63
+ i0.ɵɵtext(13);
60
64
  i0.ɵɵelementEnd()();
61
- } if (rf & 2) {
62
- const ctx_r3 = i0.ɵɵnextContext(2);
63
- i0.ɵɵadvance(8);
64
- i0.ɵɵproperty("ngForOf", ctx_r3.userRoles);
65
- } }
66
- function SingleRoleComponent_ng_template_4_Template(rf, ctx) { if (rf & 1) {
67
- const _r11 = i0.ɵɵgetCurrentView();
68
- i0.ɵɵelementStart(0, "div", 6)(1, "div", 7);
69
- i0.ɵɵtext(2);
65
+ i0.ɵɵelementStart(14, "tr")(15, "th", 5);
66
+ i0.ɵɵtext(16, "Directory ID");
70
67
  i0.ɵɵelementEnd();
71
- i0.ɵɵelementStart(3, "button", 8);
72
- i0.ɵɵlistener("click", function SingleRoleComponent_ng_template_4_Template_button_click_3_listener() { i0.ɵɵrestoreView(_r11); const ctx_r10 = i0.ɵɵnextContext(); return i0.ɵɵresetView(ctx_r10.saveUserRoles()); });
73
- i0.ɵɵtext(4, "Save");
68
+ i0.ɵɵelementStart(17, "td");
69
+ i0.ɵɵtext(18);
70
+ i0.ɵɵelementEnd()();
71
+ i0.ɵɵelementStart(19, "tr")(20, "th", 5);
72
+ i0.ɵɵtext(21, "SQL Name");
74
73
  i0.ɵɵelementEnd();
75
- i0.ɵɵtemplate(5, SingleRoleComponent_ng_template_4_table_5_Template, 9, 1, "table", 9);
74
+ i0.ɵɵelementStart(22, "td");
75
+ i0.ɵɵtext(23);
76
+ i0.ɵɵelementEnd()()()();
77
+ i0.ɵɵelementStart(24, "kendo-tabstrip", 7)(25, "kendo-tabstrip-tab", 8);
78
+ i0.ɵɵtemplate(26, SingleRoleComponent_div_2_ng_template_26_Template, 1, 2, "ng-template", 9);
76
79
  i0.ɵɵelementEnd();
80
+ i0.ɵɵelementStart(27, "kendo-tabstrip-tab", 10);
81
+ i0.ɵɵtemplate(28, SingleRoleComponent_div_2_ng_template_28_Template, 2, 1, "ng-template", 9);
82
+ i0.ɵɵelementEnd()()();
77
83
  } if (rf & 2) {
78
84
  const ctx_r1 = i0.ɵɵnextContext();
79
- i0.ɵɵadvance(2);
80
- i0.ɵɵtextInterpolate1("Role: ", ctx_r1.RoleName, "");
85
+ i0.ɵɵadvance(7);
86
+ i0.ɵɵtextInterpolate(ctx_r1.RoleRecord.Name);
81
87
  i0.ɵɵadvance();
82
- i0.ɵɵproperty("disabled", ctx_r1.NumDirty === 0);
83
- i0.ɵɵadvance(2);
84
- i0.ɵɵproperty("ngIf", !ctx_r1.isLoading);
85
- } }
86
- function SingleRoleComponent_ng_template_6_Template(rf, ctx) { if (rf & 1) {
87
- i0.ɵɵelementStart(0, "div", 6)(1, "div", 7);
88
- i0.ɵɵtext(2);
89
- i0.ɵɵelementEnd();
90
- i0.ɵɵelement(3, "mj-entity-permissions-grid", 14);
91
- i0.ɵɵelementEnd();
92
- } if (rf & 2) {
93
- const ctx_r2 = i0.ɵɵnextContext();
94
- i0.ɵɵadvance(2);
95
- i0.ɵɵtextInterpolate1("Role: ", ctx_r2.RoleName, "");
88
+ i0.ɵɵproperty("icon", ctx_r1.kendoSVGIcon("pencil"));
89
+ i0.ɵɵadvance(5);
90
+ i0.ɵɵtextInterpolate(ctx_r1.RoleRecord.Description);
91
+ i0.ɵɵadvance(5);
92
+ i0.ɵɵtextInterpolate(ctx_r1.RoleRecord.DirectoryID);
93
+ i0.ɵɵadvance(5);
94
+ i0.ɵɵtextInterpolate(ctx_r1.RoleRecord.SQLName);
95
+ i0.ɵɵadvance();
96
+ i0.ɵɵproperty("keepTabContent", true)("animate", false);
96
97
  i0.ɵɵadvance();
97
- i0.ɵɵproperty("RoleName", ctx_r2.RoleName);
98
+ i0.ɵɵproperty("selected", true);
98
99
  } }
99
100
  let UserRoleEntity_Ext = class UserRoleEntity_Ext extends UserRoleEntity {
100
101
  constructor() {
@@ -102,6 +103,7 @@ let UserRoleEntity_Ext = class UserRoleEntity_Ext extends UserRoleEntity {
102
103
  this._selected = false;
103
104
  this._userName = '';
104
105
  this._userID = 0;
106
+ this._savedRoleName = '';
105
107
  }
106
108
  get Selected() {
107
109
  return this._selected;
@@ -121,158 +123,86 @@ let UserRoleEntity_Ext = class UserRoleEntity_Ext extends UserRoleEntity {
121
123
  set SavedUserID(value) {
122
124
  this._userID = value;
123
125
  }
126
+ get SavedRoleName() {
127
+ return this._savedRoleName;
128
+ }
129
+ set SavedRoleName(value) {
130
+ this._savedRoleName = value;
131
+ }
124
132
  };
125
133
  UserRoleEntity_Ext = __decorate([
126
134
  RegisterClass(BaseEntity, 'User Roles', 10) // register this with a high priority so we are used here, we just need to extend it to add a property as a flag to know if it's in the database or not
127
135
  ], UserRoleEntity_Ext);
128
136
  export { UserRoleEntity_Ext };
129
137
  export class SingleRoleComponent {
130
- constructor() {
131
- this.BottomMargin = 0;
132
- this.userRoles = [];
138
+ constructor(cdRef) {
139
+ this.cdRef = cdRef;
133
140
  this.gridHeight = 750;
134
141
  this.isLoading = false;
142
+ this.RoleRecord = null;
135
143
  this.kendoSVGIcon = kendoSVGIcon;
144
+ this.showEntityEditingForm = false;
136
145
  }
137
146
  ngOnInit() {
138
147
  this.Refresh();
139
148
  }
140
- ngOnChanges(changes) {
141
- if (changes.EntityName && !changes.EntityName.isFirstChange()) {
142
- // If EntityName has changed and it's not the first change (initialization)
143
- this.Refresh();
144
- }
145
- }
146
149
  Refresh() {
147
150
  return __awaiter(this, void 0, void 0, function* () {
148
- if (this.RoleName && this.RoleName.length > 0) {
149
- const startTime = new Date().getTime();
150
- this.isLoading = true;
151
- const md = new Metadata();
152
- const rv = new RunView();
153
- const result = yield rv.RunView({
154
- EntityName: 'User Roles',
155
- ExtraFilter: `RoleName='${this.RoleName}'`,
156
- ResultType: 'entity_object'
157
- });
158
- if (result.Success) {
159
- // we have all of the saved permissions now
160
- // the post-process we need to do now is to see if there are any roles that don't have any existing permissions and if so, we need to create
161
- // new permission records for them. We won't actually consider those "Dirty" and save those unless the user actually selects one or more
162
- // to turn on, we are just doing this to make the grid easy to manage from the user perspective.
163
- const existingUserRoles = result.Results;
164
- existingUserRoles.forEach(ur => {
165
- ur.Selected = true;
166
- ur.SavedUserID = ur.UserID; // stash this in an extra property so we can later set it if we have a delete operation
167
- ur.SavedUserName = ur.User; // stash this in an extra property so we can later set it if we have a delete operation
168
- }); // flip this on for all records that come from the DB
169
- const userResult = yield rv.RunView({
170
- EntityName: 'Users',
171
- ExtraFilter: 'IsActive=1',
172
- ResultType: 'entity_object'
173
- });
174
- if (userResult.Success) {
175
- const users = userResult.Results;
176
- const usersNotInRole = users.filter(u => !existingUserRoles.some(p => p.UserID === u.ID));
177
- for (const u of usersNotInRole) {
178
- const ur = yield md.GetEntityObject('User Roles');
179
- ur.NewRecord();
180
- ur.RoleName = this.RoleName;
181
- ur.UserID = u.ID;
182
- ur.Set('User', u.Name); // use weak typing to get around the readonly property
183
- ur.SavedUserName = u.Name; // stash this in an extra property so we can later set it if we have a delete operation
184
- ur.SavedUserID = u.ID; // stash this in an extra property so we can later set it if we have a delete operation
185
- ur.Selected = false;
186
- existingUserRoles.push(ur);
187
- }
188
- }
189
- this.userRoles = existingUserRoles.sort((a, b) => a.User.localeCompare(b.User));
190
- }
191
- else {
192
- throw new Error("Error loading user roles: " + result.ErrorMessage);
193
- }
194
- this.isLoading = false;
151
+ this.isLoading = true;
152
+ const md = new Metadata();
153
+ let r = md.Roles.find(r => r.Name === this.RoleName);
154
+ if (!r) {
155
+ // sometime we are creating a new role, so attempt to refresh our metadata
156
+ yield md.Refresh();
157
+ r = md.Roles.find(r => r.Name === this.RoleName);
158
+ if (!r)
159
+ throw new Error(`Role ${this.RoleName} not found`);
195
160
  }
161
+ this.RoleRecord = yield md.GetEntityObject('Roles');
162
+ yield this.RoleRecord.Load(r.ID);
163
+ this.isLoading = false;
196
164
  });
197
165
  }
198
- saveUserRoles() {
166
+ EditRecord() {
199
167
  return __awaiter(this, void 0, void 0, function* () {
200
- // iterate through each permisison and for the ones that are dirty, add to transaction group then commit at once
201
- const md = new Metadata();
202
- const tg = yield md.CreateTransactionGroup();
203
- let itemCount = 0;
204
- this.userRoles.forEach(ur => {
205
- if (this.IsReallyDirty(ur)) {
206
- ur.TransactionGroup = tg;
207
- itemCount++;
208
- // now, we have to determine if we are going to save the record or delete it
209
- // if ur.Selected === false and we are in the database, we need to delete
210
- // otherwise, we need to save
211
- if (ur.Selected)
212
- ur.Save();
213
- else
214
- ur.Delete();
215
- }
216
- });
217
- if (itemCount > 0) {
218
- if (yield tg.Submit()) {
219
- // for any items in the above that were deleted, we would have had the User property wiped out so we need to go check to see if we have a null ID and if so, copy the UserName back into the User property
220
- this.userRoles.forEach(ur => {
221
- if (ur.User === null) {
222
- ur.Set('User', ur.SavedUserName); // get around the read-only property
223
- ur.UserID = ur.SavedUserID;
224
- ur.RoleName = this.RoleName;
225
- }
226
- });
227
- }
228
- }
168
+ // show the dialog
169
+ this.showEntityEditingForm = true;
229
170
  });
230
171
  }
231
- get NumDirty() {
232
- return this.userRoles.filter(ur => this.IsReallyDirty(ur)).length;
233
- }
234
- IsReallyDirty(ur) {
235
- // logic is simple, if we are in the database, but the checkbox is not checked (or vice versa), then we are dirty
236
- if (ur.Selected && ur.ID > 0)
237
- return false; // if we are in the database and the checkbox is checked, we are not dirty
238
- else if (!ur.Selected && ur.ID > 0)
239
- return true; // if we are in the database and the checkbox is not checked, we are dirty because we'd have to be removed
240
- else if (ur.Selected)
241
- return true; // if we are NOT in the database and the checkbox is checked, we are dirty because we'd have to be added
242
- else
243
- return false;
244
- }
245
- flipState($event, ur, flipState) {
246
- if (flipState)
247
- ur.Selected = !ur.Selected;
248
- else
249
- $event.stopPropagation();
172
+ onEntityFormClosed(result) {
173
+ return __awaiter(this, void 0, void 0, function* () {
174
+ this.showEntityEditingForm = false;
175
+ });
250
176
  }
251
177
  }
252
- SingleRoleComponent.ɵfac = function SingleRoleComponent_Factory(t) { return new (t || SingleRoleComponent)(); };
253
- SingleRoleComponent.ɵcmp = /*@__PURE__*/ i0.ɵɵdefineComponent({ type: SingleRoleComponent, selectors: [["mj-single-role"]], inputs: { RoleName: "RoleName", BottomMargin: "BottomMargin" }, features: [i0.ɵɵNgOnChangesFeature], decls: 7, vars: 4, consts: [["mjFillContainer", ""], [4, "ngIf"], [3, "keepTabContent", "animate"], ["title", "Users", 3, "selected"], ["kendoTabContent", ""], ["title", "Entity Permissions"], [1, "content"], [1, "role-name"], ["kendoButton", "", 3, "disabled", "click"], ["class", "grid", 4, "ngIf"], [1, "grid"], [4, "ngFor", "ngForOf"], [3, "click"], ["type", "checkbox", "kendoCheckBox", "", 3, "ngModel", "ngModelChange", "click"], ["Mode", "Role", 3, "RoleName"]], template: function SingleRoleComponent_Template(rf, ctx) { if (rf & 1) {
178
+ SingleRoleComponent.ɵfac = function SingleRoleComponent_Factory(t) { return new (t || SingleRoleComponent)(i0.ɵɵdirectiveInject(i0.ChangeDetectorRef)); };
179
+ SingleRoleComponent.ɵcmp = /*@__PURE__*/ i0.ɵɵdefineComponent({ type: SingleRoleComponent, selectors: [["mj-single-role"]], viewQuery: function SingleRoleComponent_Query(rf, ctx) { if (rf & 1) {
180
+ i0.ɵɵviewQuery(_c0, 5);
181
+ } if (rf & 2) {
182
+ let _t;
183
+ i0.ɵɵqueryRefresh(_t = i0.ɵɵloadQuery()) && (ctx.entityFormComponent = _t.first);
184
+ } }, inputs: { RoleName: "RoleName" }, decls: 5, vars: 8, consts: [["mjFillContainer", ""], [4, "ngIf"], ["SectionName", "details", "Mode", "section", 3, "Record", "Visible", "AutoRevertOnCancel", "HandleSave", "Width", "Height", "close"], ["entityForm", ""], [1, "role-info-table"], ["scope", "row"], [1, "edit-icon", 3, "icon", "click"], [3, "keepTabContent", "animate"], ["title", "Users", 3, "selected"], ["kendoTabContent", ""], ["title", "Entity Permissions"], ["Mode", "Roles", 3, "RoleName", "RoleRecord"], [1, "content"], ["Mode", "Role", 3, "RoleName", 4, "ngIf"], ["Mode", "Role", 3, "RoleName"]], template: function SingleRoleComponent_Template(rf, ctx) { if (rf & 1) {
254
185
  i0.ɵɵelementStart(0, "div", 0);
255
- i0.ɵɵtemplate(1, SingleRoleComponent_div_1_Template, 2, 0, "div", 1);
256
- i0.ɵɵelementStart(2, "kendo-tabstrip", 2)(3, "kendo-tabstrip-tab", 3);
257
- i0.ɵɵtemplate(4, SingleRoleComponent_ng_template_4_Template, 6, 3, "ng-template", 4);
186
+ i0.ɵɵtemplate(1, SingleRoleComponent_div_1_Template, 2, 0, "div", 1)(2, SingleRoleComponent_div_2_Template, 29, 8, "div", 1);
187
+ i0.ɵɵelementEnd();
188
+ i0.ɵɵelementStart(3, "mj-entity-form-dialog", 2, 3);
189
+ i0.ɵɵlistener("close", function SingleRoleComponent_Template_mj_entity_form_dialog_close_3_listener($event) { return ctx.onEntityFormClosed($event); });
258
190
  i0.ɵɵelementEnd();
259
- i0.ɵɵelementStart(5, "kendo-tabstrip-tab", 5);
260
- i0.ɵɵtemplate(6, SingleRoleComponent_ng_template_6_Template, 4, 2, "ng-template", 4);
261
- i0.ɵɵelementEnd()()();
262
191
  } if (rf & 2) {
263
192
  i0.ɵɵadvance();
264
193
  i0.ɵɵproperty("ngIf", ctx.isLoading);
265
194
  i0.ɵɵadvance();
266
- i0.ɵɵproperty("keepTabContent", true)("animate", false);
195
+ i0.ɵɵproperty("ngIf", !ctx.isLoading && ctx.RoleRecord);
267
196
  i0.ɵɵadvance();
268
- i0.ɵɵproperty("selected", true);
269
- } }, dependencies: [i1.NgForOf, i1.NgIf, i2.CheckboxControlValueAccessor, i2.NgControlStatus, i2.NgModel, i3.FillContainer, i4.ButtonComponent, i5.EntityPermissionsGridComponent, i6.TabStripComponent, i6.TabStripTabComponent, i6.TabContentDirective], styles: ["\n\r\ntable[_ngcontent-%COMP%] {\r\n margin-left: 5px;\r\n margin-top: 5px;\r\n border-collapse: collapse; \n\r\n}\r\n\r\nbutton[_ngcontent-%COMP%] {\r\n margin-left: 5px;\r\n margin-top: 5px;\r\n width: 125px;\r\n}\r\n \r\ntable[_ngcontent-%COMP%] th[_ngcontent-%COMP%] {\r\n background-color: #f2f2f2; \n\r\n color: black; \n\r\n font-weight: bold; \n\r\n}\r\n\r\n\n\r\ntable[_ngcontent-%COMP%] th[_ngcontent-%COMP%], table[_ngcontent-%COMP%] td[_ngcontent-%COMP%] {\r\n border: 1px solid gray; \n\r\n height: 36px; \n\r\n text-align: center;\r\n padding: 0 8px; \n\r\n}\r\n\r\n\n\r\ntable[_ngcontent-%COMP%] th[_ngcontent-%COMP%]:first-child, table[_ngcontent-%COMP%] td[_ngcontent-%COMP%]:first-child {\r\n width: 150px; \n\r\n text-align: left;\r\n}\r\n\r\n\n\r\ntable[_ngcontent-%COMP%] th[_ngcontent-%COMP%]:not(:first-child), table[_ngcontent-%COMP%] td[_ngcontent-%COMP%]:not(:first-child) {\r\n width: 100px; \n\r\n}\r\n\r\n\n\r\ntable[_ngcontent-%COMP%] tr[_ngcontent-%COMP%]:nth-child(odd) {\r\n background-color: white; \n\r\n}\r\n\r\ntable[_ngcontent-%COMP%] tr[_ngcontent-%COMP%]:nth-child(even) {\r\n background-color: #e7f4ff; \n\r\n}\r\n\r\n.role-name[_ngcontent-%COMP%] {\r\n font-weight: bold;\r\n font-size: 20px;\r\n margin-left: 5px;\r\n margin-top: 5px;\r\n}"] });
197
+ i0.ɵɵproperty("Record", ctx.RoleRecord)("Visible", ctx.showEntityEditingForm)("AutoRevertOnCancel", true)("HandleSave", true)("Width", 550)("Height", 450);
198
+ } }, styles: ["button[_ngcontent-%COMP%] {\r\n margin-left: 5px;\r\n margin-top: 5px;\r\n width: 125px;\r\n}\r\n\r\n\r\n\r\n.role-name[_ngcontent-%COMP%] {\r\n font-weight: bold;\r\n font-size: 20px;\r\n margin-left: 5px;\r\n margin-top: 5px;\r\n}\r\n\r\n.role-info-table[_ngcontent-%COMP%] {\r\n width: 100%; \n\r\n border-collapse: collapse; \n\r\n margin-bottom: 10px;\r\n}\r\n\r\n.role-info-table[_ngcontent-%COMP%] th[_ngcontent-%COMP%] {\r\n width: 150px; \n\r\n font-weight: bold; \n\r\n text-align: left; \n\r\n padding: 8px; \n\r\n border: none; \n\r\n background-color: transparent; \n\r\n}\r\n\r\n.role-info-table[_ngcontent-%COMP%] td[_ngcontent-%COMP%] {\r\n text-align: left; \n\r\n padding: 8px; \n\r\n border: none; \n\r\n background-color: transparent; \n\r\n overflow: hidden; \n\r\n text-overflow: ellipsis; \n\r\n}\r\n\r\n\n\r\n.edit-icon[_ngcontent-%COMP%] {\r\n margin-left: 20px; \r\n vertical-align: middle;;\r\n cursor: pointer; \n\r\n}\r\n\r\n.edit-icon[_ngcontent-%COMP%]:hover {\r\n fill: #007bff; \n\r\n}"] });
270
199
  (() => { (typeof ngDevMode === "undefined" || ngDevMode) && i0.ɵsetClassMetadata(SingleRoleComponent, [{
271
200
  type: Component,
272
- args: [{ selector: 'mj-single-role', template: "<div mjFillContainer>\r\n <div *ngIf=\"isLoading\">Loading...</div>\r\n <kendo-tabstrip\r\n [keepTabContent]=\"true\"\r\n [animate]=\"false\"\r\n > \r\n <kendo-tabstrip-tab title=\"Users\" [selected]=\"true\">\r\n <ng-template kendoTabContent>\r\n <div class=\"content\">\r\n <div class=\"role-name\">Role: {{this.RoleName}}</div>\r\n <button [disabled]=\"NumDirty === 0\" kendoButton (click)=\"saveUserRoles()\">Save</button>\r\n <table *ngIf=\"!isLoading\" class=\"grid\">\r\n <thead>\r\n <tr>\r\n <th>User</th>\r\n <th>In Role</th>\r\n </tr>\r\n </thead>\r\n <tbody>\r\n <tr *ngFor=\"let ur of userRoles\">\r\n <td>{{ ur.User }}</td>\r\n <td (click)=\"flipState($event, ur, true)\">\r\n <input type=\"checkbox\" kendoCheckBox [(ngModel)]=\"ur.Selected\" (click)=\"flipState($event, ur, false)\">\r\n </td>\r\n </tr>\r\n </tbody>\r\n </table> \r\n </div>\r\n </ng-template>\r\n </kendo-tabstrip-tab>\r\n <kendo-tabstrip-tab title=\"Entity Permissions\">\r\n <ng-template kendoTabContent>\r\n <div class=\"content\">\r\n <div class=\"role-name\">Role: {{this.RoleName}}</div>\r\n <mj-entity-permissions-grid Mode=\"Role\" [RoleName]=\"this.RoleName\" ></mj-entity-permissions-grid>\r\n </div>\r\n </ng-template>\r\n </kendo-tabstrip-tab>\r\n </kendo-tabstrip>\r\n</div>\r\n ", styles: ["/* Style for the whole table */\r\ntable {\r\n margin-left: 5px;\r\n margin-top: 5px;\r\n border-collapse: collapse; /* Ensures border collapse for a cleaner look */\r\n}\r\n\r\nbutton {\r\n margin-left: 5px;\r\n margin-top: 5px;\r\n width: 125px;\r\n}\r\n \r\ntable th {\r\n background-color: #f2f2f2; /* Light gray background for headers */\r\n color: black; /* Black text color for headers */\r\n font-weight: bold; /* Bold font weight for headers */\r\n}\r\n\r\n/* Style for all table cells */\r\ntable th, table td {\r\n border: 1px solid gray; /* Gray border for cells */\r\n height: 36px; /* Fixed height for all rows */\r\n text-align: center;\r\n padding: 0 8px; /* Add some padding inside cells */\r\n}\r\n\r\n/* Specific styles for the first column */\r\ntable th:first-child, table td:first-child {\r\n width: 150px; /* Set width for the first column */\r\n text-align: left;\r\n}\r\n\r\n/* Specific styles for the \"Can\" columns */\r\ntable th:not(:first-child), table td:not(:first-child) {\r\n width: 100px; /* Set width for \"Can\" columns */\r\n}\r\n\r\n/* Alternating row background colors */\r\ntable tr:nth-child(odd) {\r\n background-color: white; /* Light color for odd rows */\r\n}\r\n\r\ntable tr:nth-child(even) {\r\n background-color: #e7f4ff; /* Light blue for even rows */\r\n}\r\n\r\n.role-name {\r\n font-weight: bold;\r\n font-size: 20px;\r\n margin-left: 5px;\r\n margin-top: 5px;\r\n}"] }]
273
- }], () => [], { RoleName: [{
274
- type: Input
275
- }], BottomMargin: [{
201
+ args: [{ selector: 'mj-single-role', template: "<div mjFillContainer>\r\n <div *ngIf=\"isLoading\"><kendo-loader></kendo-loader></div>\r\n <div *ngIf=\"!isLoading && RoleRecord\">\r\n <table class=\"role-info-table\">\r\n <tbody>\r\n <tr>\r\n <th scope=\"row\">Role</th>\r\n <td>{{RoleRecord.Name}}<kendo-svgicon class='edit-icon' [icon]=\"kendoSVGIcon('pencil')\" (click)=\"EditRecord()\"></kendo-svgicon></td>\r\n </tr>\r\n <tr>\r\n <th scope=\"row\">Description</th>\r\n <td>{{RoleRecord.Description}}</td>\r\n </tr>\r\n <tr>\r\n <th scope=\"row\">Directory ID</th>\r\n <td>{{RoleRecord.DirectoryID}}</td>\r\n </tr>\r\n <tr>\r\n <th scope=\"row\">SQL Name</th>\r\n <td>{{RoleRecord.SQLName}}</td>\r\n </tr>\r\n </tbody>\r\n </table> \r\n <kendo-tabstrip\r\n [keepTabContent]=\"true\"\r\n [animate]=\"false\" \r\n > \r\n <kendo-tabstrip-tab title=\"Users\" [selected]=\"true\">\r\n <ng-template kendoTabContent>\r\n <mj-user-roles-grid Mode=\"Roles\" [RoleName]=\"RoleName\" [RoleRecord]=\"RoleRecord\"></mj-user-roles-grid>\r\n </ng-template>\r\n </kendo-tabstrip-tab>\r\n <kendo-tabstrip-tab title=\"Entity Permissions\">\r\n <ng-template kendoTabContent>\r\n <div class=\"content\">\r\n <mj-entity-permissions-grid *ngIf=\"RoleRecord && RoleRecord.Name\" Mode=\"Role\" [RoleName]=\"RoleRecord.Name\" ></mj-entity-permissions-grid>\r\n </div>\r\n </ng-template>\r\n </kendo-tabstrip-tab>\r\n </kendo-tabstrip>\r\n </div>\r\n</div>\r\n \r\n<mj-entity-form-dialog #entityForm \r\n [Record]=\"RoleRecord\" \r\n SectionName=\"details\" \r\n Mode=\"section\" \r\n [Visible]=\"showEntityEditingForm\" \r\n [AutoRevertOnCancel]=\"true\"\r\n [HandleSave]=\"true\"\r\n [Width]=\"550\"\r\n [Height]=\"450\"\r\n (close)=\"onEntityFormClosed($event)\">\r\n</mj-entity-form-dialog>\r\n", styles: ["button {\r\n margin-left: 5px;\r\n margin-top: 5px;\r\n width: 125px;\r\n}\r\n\r\n\r\n\r\n.role-name {\r\n font-weight: bold;\r\n font-size: 20px;\r\n margin-left: 5px;\r\n margin-top: 5px;\r\n}\r\n\r\n.role-info-table {\r\n width: 100%; /* Take up the full width of the container */\r\n border-collapse: collapse; /* For a cleaner look */\r\n margin-bottom: 10px;\r\n}\r\n\r\n.role-info-table th {\r\n width: 150px; /* Adjust this fixed width as needed */\r\n font-weight: bold; /* Make header labels bold */\r\n text-align: left; /* Align text to the left */\r\n padding: 8px; /* Add some padding for spacing */\r\n border: none; /* Removes the borders */\r\n background-color: transparent; /* Removes any background color */\r\n}\r\n\r\n.role-info-table td {\r\n text-align: left; /* Align text to the left */\r\n padding: 8px; /* Add some padding for spacing */\r\n border: none; /* Removes the borders */\r\n background-color: transparent; /* Removes any background color */\r\n overflow: hidden; /* Prevents content from overflowing */\r\n text-overflow: ellipsis; /* Adds an ellipsis if the text overflows */\r\n}\r\n\r\n/* Style for SVG icon */\r\n.edit-icon {\r\n margin-left: 20px; \r\n vertical-align: middle;;\r\n cursor: pointer; /* Changes the cursor to a pointer */\r\n}\r\n\r\n.edit-icon:hover {\r\n fill: #007bff; /* Changes the color on hover, set to the color you prefer */\r\n}"] }]
202
+ }], () => [{ type: i0.ChangeDetectorRef }], { RoleName: [{
276
203
  type: Input
204
+ }], entityFormComponent: [{
205
+ type: ViewChild,
206
+ args: ['entityForm']
277
207
  }] }); })();
278
- (() => { (typeof ngDevMode === "undefined" || ngDevMode) && i0.ɵsetClassDebugInfo(SingleRoleComponent, { className: "SingleRoleComponent", filePath: "src\\lib\\single-role\\single-role.component.ts", lineNumber: 40 }); })();
208
+ (() => { (typeof ngDevMode === "undefined" || ngDevMode) && i0.ɵsetClassDebugInfo(SingleRoleComponent, { className: "SingleRoleComponent", filePath: "src\\lib\\single-role\\single-role.component.ts", lineNumber: 49 }); })();
@@ -0,0 +1,24 @@
1
+ import { OnInit, ChangeDetectorRef } from '@angular/core';
2
+ import { RunViewParams } from '@memberjunction/core';
3
+ import { kendoSVGIcon } from '@memberjunction/ng-shared';
4
+ import { UserEntity } from '@memberjunction/core-entities';
5
+ import { EntityFormDialog } from '@memberjunction/ng-entity-form-dialog';
6
+ import * as i0 from "@angular/core";
7
+ export declare class SingleUserComponent implements OnInit {
8
+ private cdRef;
9
+ UserID: number;
10
+ entityFormComponent: EntityFormDialog;
11
+ gridHeight: number;
12
+ isLoading: boolean;
13
+ UserRecord: UserEntity | null;
14
+ UserViewsParams: RunViewParams | undefined;
15
+ kendoSVGIcon: typeof kendoSVGIcon;
16
+ showEntityEditingForm: boolean;
17
+ constructor(cdRef: ChangeDetectorRef);
18
+ ngOnInit(): void;
19
+ protected Refresh(): Promise<void>;
20
+ EditRecord(): Promise<void>;
21
+ onEntityFormClosed(result: 'Save' | 'Cancel'): Promise<void>;
22
+ static ɵfac: i0.ɵɵFactoryDeclaration<SingleUserComponent, never>;
23
+ static ɵcmp: i0.ɵɵComponentDeclaration<SingleUserComponent, "mj-single-user", never, { "UserID": { "alias": "UserID"; "required": false; }; }, {}, never, never, false, never>;
24
+ }