@memberjunction/ng-explorer-settings 0.9.10 → 0.9.11

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.
@@ -4,32 +4,53 @@ import { filter } from 'rxjs/operators';
4
4
  import * as i0 from "@angular/core";
5
5
  import * as i1 from "@angular/router";
6
6
  import * as i2 from "@angular/common";
7
- import * as i3 from "@memberjunction/ng-entity-permissions";
8
- import * as i4 from "../single-role/single-role.component";
9
- import * as i5 from "../roles-list/roles-list.component";
7
+ import * as i3 from "@memberjunction/ng-container-directives";
8
+ import * as i4 from "@memberjunction/ng-entity-permissions";
9
+ import * as i5 from "@memberjunction/ng-simple-record-list";
10
+ import * as i6 from "../single-role/single-role.component";
11
+ import * as i7 from "../single-user/single-user.component";
10
12
  function SettingsComponent_div_9_Template(rf, ctx) { if (rf & 1) {
11
13
  i0.ɵɵelementStart(0, "div");
12
14
  i0.ɵɵelement(1, "mj-entity-permissions-selector-with-grid");
13
15
  i0.ɵɵelementEnd();
14
16
  } }
17
+ const _c0 = () => ["Name", "Email", "IsActive", "Type"];
15
18
  function SettingsComponent_div_10_Template(rf, ctx) { if (rf & 1) {
16
- i0.ɵɵelementStart(0, "div");
17
- i0.ɵɵtext(1, " Users Component Goes Here ");
18
- i0.ɵɵelementEnd();
19
+ const _r6 = i0.ɵɵgetCurrentView();
20
+ i0.ɵɵelementStart(0, "div")(1, "mj-simple-record-list", 5);
21
+ i0.ɵɵlistener("RecordSelected", function SettingsComponent_div_10_Template_mj_simple_record_list_RecordSelected_1_listener($event) { i0.ɵɵrestoreView(_r6); const ctx_r5 = i0.ɵɵnextContext(); return i0.ɵɵresetView(ctx_r5.selectUser($event)); });
22
+ i0.ɵɵelementEnd()();
23
+ } if (rf & 2) {
24
+ i0.ɵɵadvance();
25
+ i0.ɵɵproperty("Columns", i0.ɵɵpureFunction0(1, _c0));
19
26
  } }
20
27
  function SettingsComponent_div_11_Template(rf, ctx) { if (rf & 1) {
21
28
  i0.ɵɵelementStart(0, "div");
22
- i0.ɵɵelement(1, "mj-roles-list");
29
+ i0.ɵɵelement(1, "mj-single-user", 6);
23
30
  i0.ɵɵelementEnd();
31
+ } if (rf & 2) {
32
+ const ctx_r2 = i0.ɵɵnextContext();
33
+ i0.ɵɵadvance();
34
+ i0.ɵɵproperty("UserID", ctx_r2.selectedUserID);
24
35
  } }
36
+ const _c1 = () => ["Name", "Description"];
25
37
  function SettingsComponent_div_12_Template(rf, ctx) { if (rf & 1) {
38
+ const _r8 = i0.ɵɵgetCurrentView();
39
+ i0.ɵɵelementStart(0, "div")(1, "mj-simple-record-list", 7);
40
+ i0.ɵɵlistener("RecordSelected", function SettingsComponent_div_12_Template_mj_simple_record_list_RecordSelected_1_listener($event) { i0.ɵɵrestoreView(_r8); const ctx_r7 = i0.ɵɵnextContext(); return i0.ɵɵresetView(ctx_r7.selectRole($event)); });
41
+ i0.ɵɵelementEnd()();
42
+ } if (rf & 2) {
43
+ i0.ɵɵadvance();
44
+ i0.ɵɵproperty("Columns", i0.ɵɵpureFunction0(1, _c1));
45
+ } }
46
+ function SettingsComponent_div_13_Template(rf, ctx) { if (rf & 1) {
26
47
  i0.ɵɵelementStart(0, "div");
27
- i0.ɵɵelement(1, "mj-single-role", 5);
48
+ i0.ɵɵelement(1, "mj-single-role", 8);
28
49
  i0.ɵɵelementEnd();
29
50
  } if (rf & 2) {
30
- const ctx_r3 = i0.ɵɵnextContext();
51
+ const ctx_r4 = i0.ɵɵnextContext();
31
52
  i0.ɵɵadvance();
32
- i0.ɵɵproperty("RoleName", ctx_r3.selectedRoleName);
53
+ i0.ɵɵproperty("RoleName", ctx_r4.selectedRoleName);
33
54
  } }
34
55
  export class SettingsComponent {
35
56
  selectItem(item, changeRoute = true) {
@@ -47,6 +68,7 @@ export class SettingsComponent {
47
68
  this.currentItem = 'EntityPermissions';
48
69
  this.baseRoute = '/settings';
49
70
  this.selectedRoleName = '';
71
+ this.selectedUserID = 0;
50
72
  }
51
73
  ngOnInit() {
52
74
  // manually update the first time
@@ -55,31 +77,6 @@ export class SettingsComponent {
55
77
  this.router.events.pipe(filter(event => event instanceof NavigationEnd)).subscribe(() => {
56
78
  this.updateComponentStateBasedOnPath();
57
79
  });
58
- // this.activatedRoute.url.subscribe(urlSegments => {
59
- // const fullPath = window.location.pathname + window.location.search;
60
- // // Split the fullPath into segments and query string as needed
61
- // const [path, queryString] = fullPath.split('?');
62
- // const segments = path.split('/').filter(segment => segment.length > 0);
63
- // // Your logic to handle the segments and query string
64
- // const firstSegment = segments.length > 1 ? segments[1] : '';
65
- // switch (firstSegment.trim().toLowerCase()) {
66
- // case 'entitypermissions':
67
- // this.selectItem('EntityPermissions', false);
68
- // break;
69
- // case 'users':
70
- // this.selectItem('Users', false);
71
- // break;
72
- // case 'roles':
73
- // this.selectItem('Roles', false);
74
- // break;
75
- // case 'role':
76
- // this.selectedRoleName = segments.length > 2 ? segments[2] : '';
77
- // this.selectItem('Role', false);
78
- // break;
79
- // default:
80
- // break;
81
- // }
82
- // });
83
80
  }
84
81
  updateComponentStateBasedOnPath() {
85
82
  // On each navigation end, access the current URL from window.location
@@ -87,7 +84,6 @@ export class SettingsComponent {
87
84
  // Split the fullPath into segments and query string as needed
88
85
  const [path, queryString] = fullPath.split('?');
89
86
  const segments = path.split('/').filter(segment => segment.length > 0);
90
- // Place your switch-case logic here
91
87
  const firstSegment = segments.length > 1 ? segments[1] : '';
92
88
  switch (firstSegment.trim().toLowerCase()) {
93
89
  case 'entitypermissions':
@@ -103,13 +99,25 @@ export class SettingsComponent {
103
99
  this.selectedRoleName = segments.length > 2 ? segments[2] : '';
104
100
  this.selectItem('Role', false);
105
101
  break;
102
+ case 'user':
103
+ this.selectedUserID = segments.length > 2 ? parseInt(segments[2]) : 0;
104
+ this.selectItem('User', false);
105
+ break;
106
106
  default:
107
107
  break;
108
108
  }
109
109
  }
110
+ selectRole(r) {
111
+ // change the route to point to the /settings/role/{r.Name} route
112
+ this.router.navigate(['/settings/role', r.Name]);
113
+ }
114
+ selectUser(r) {
115
+ // change the route to point to the /settings/user/{r.ID} route
116
+ this.router.navigate(['/settings/user', r.ID]);
117
+ }
110
118
  }
111
119
  SettingsComponent.ɵfac = function SettingsComponent_Factory(t) { return new (t || SettingsComponent)(i0.ɵɵdirectiveInject(i1.Router), i0.ɵɵdirectiveInject(i1.ActivatedRoute)); };
112
- SettingsComponent.ɵcmp = /*@__PURE__*/ i0.ɵɵdefineComponent({ type: SettingsComponent, selectors: [["mj-settings"]], decls: 13, vars: 10, consts: [[1, "container"], [1, "options-container"], [1, "option-item", 3, "click"], [1, "display-container"], [4, "ngIf"], [3, "RoleName"]], template: function SettingsComponent_Template(rf, ctx) { if (rf & 1) {
120
+ SettingsComponent.ɵcmp = /*@__PURE__*/ i0.ɵɵdefineComponent({ type: SettingsComponent, selectors: [["mj-settings"]], decls: 14, vars: 13, consts: [["mjFillContainer", "", 1, "container", 3, "fillWidth", "bottomMargin"], [1, "options-container"], [1, "option-item", 3, "click"], [1, "display-container"], [4, "ngIf"], ["EntityName", "Users", "SortBy", "Name", 3, "Columns", "RecordSelected"], [3, "UserID"], ["EntityName", "Roles", "SortBy", "Name", 3, "Columns", "RecordSelected"], [3, "RoleName"]], template: function SettingsComponent_Template(rf, ctx) { if (rf & 1) {
113
121
  i0.ɵɵelementStart(0, "div", 0)(1, "div", 1)(2, "div", 2);
114
122
  i0.ɵɵlistener("click", function SettingsComponent_Template_div_click_2_listener() { return ctx.selectItem("Users"); });
115
123
  i0.ɵɵtext(3, "Users");
@@ -123,9 +131,10 @@ SettingsComponent.ɵcmp = /*@__PURE__*/ i0.ɵɵdefineComponent({ type: SettingsC
123
131
  i0.ɵɵtext(7, "Entity Permissions");
124
132
  i0.ɵɵelementEnd()();
125
133
  i0.ɵɵelementStart(8, "div", 3);
126
- i0.ɵɵtemplate(9, SettingsComponent_div_9_Template, 2, 0, "div", 4)(10, SettingsComponent_div_10_Template, 2, 0, "div", 4)(11, SettingsComponent_div_11_Template, 2, 0, "div", 4)(12, SettingsComponent_div_12_Template, 2, 1, "div", 4);
134
+ i0.ɵɵtemplate(9, SettingsComponent_div_9_Template, 2, 0, "div", 4)(10, SettingsComponent_div_10_Template, 2, 2, "div", 4)(11, SettingsComponent_div_11_Template, 2, 1, "div", 4)(12, SettingsComponent_div_12_Template, 2, 2, "div", 4)(13, SettingsComponent_div_13_Template, 2, 1, "div", 4);
127
135
  i0.ɵɵelementEnd()();
128
136
  } if (rf & 2) {
137
+ i0.ɵɵproperty("fillWidth", false)("bottomMargin", 5);
129
138
  i0.ɵɵadvance(2);
130
139
  i0.ɵɵclassProp("selected", ctx.currentItem === "Users");
131
140
  i0.ɵɵadvance(2);
@@ -137,12 +146,14 @@ SettingsComponent.ɵcmp = /*@__PURE__*/ i0.ɵɵdefineComponent({ type: SettingsC
137
146
  i0.ɵɵadvance();
138
147
  i0.ɵɵproperty("ngIf", ctx.currentItem === "Users");
139
148
  i0.ɵɵadvance();
149
+ i0.ɵɵproperty("ngIf", ctx.currentItem === "User");
150
+ i0.ɵɵadvance();
140
151
  i0.ɵɵproperty("ngIf", ctx.currentItem === "Roles");
141
152
  i0.ɵɵadvance();
142
153
  i0.ɵɵproperty("ngIf", ctx.currentItem === "Role");
143
- } }, dependencies: [i2.NgIf, i3.EntityPermissionsSelectorWithGridComponent, i4.SingleRoleComponent, i5.RolesListComponent], styles: [".container[_ngcontent-%COMP%] {\r\n display: flex;\r\n }\r\n \r\n .options-container[_ngcontent-%COMP%] {\r\n flex: 0 0 150px;\r\n padding: 10px;\r\n }\r\n \r\n .option-item[_ngcontent-%COMP%] {\r\n cursor: pointer;\r\n margin-bottom: 10px; \n\r\n padding: 5px 10px; \n\r\n border-radius: 4px; \n\r\n }\r\n \r\n .display-container[_ngcontent-%COMP%] {\r\n flex: 1;\r\n padding: 10px;\r\n }\r\n\r\n .selected[_ngcontent-%COMP%] {\r\n background-color: #007bff; \n\r\n color: white; \n\r\n padding: 5px 10px; \n\r\n border-radius: 4px; \n\r\n }"] });
154
+ } }, dependencies: [i2.NgIf, i3.FillContainer, i4.EntityPermissionsSelectorWithGridComponent, i5.SimpleRecordListComponent, i6.SingleRoleComponent, i7.SingleUserComponent], styles: [".container[_ngcontent-%COMP%] {\r\n display: flex;\r\n width: 100%;\r\n border: solid 1px lightgray;\r\n}\r\n\r\n.options-container[_ngcontent-%COMP%] {\r\n flex: 0 0 150px;\r\n padding: 10px;\r\n border-right: solid 1px lightgray;\r\n}\r\n\r\n.option-item[_ngcontent-%COMP%] {\r\n cursor: pointer;\r\n margin-bottom: 10px; \n\r\n padding: 5px 10px; \n\r\n border-radius: 4px; \n\r\n}\r\n\r\n.display-container[_ngcontent-%COMP%] {\r\n flex: 1;\r\n padding: 10px;\r\n}\r\n\r\n.selected[_ngcontent-%COMP%] {\r\n background-color: #007bff; \n\r\n color: white; \n\r\n padding: 5px 10px; \n\r\n border-radius: 4px; \n\r\n}"] });
144
155
  (() => { (typeof ngDevMode === "undefined" || ngDevMode) && i0.ɵsetClassMetadata(SettingsComponent, [{
145
156
  type: Component,
146
- args: [{ selector: 'mj-settings', template: "<div class=\"container\">\r\n <!-- Options container -->\r\n <div class=\"options-container\">\r\n <div class=\"option-item\" [class.selected]=\"currentItem === 'Users'\" (click)=\"selectItem('Users')\">Users</div>\r\n <div class=\"option-item\" [class.selected]=\"currentItem === 'Roles' || currentItem === 'Role'\" (click)=\"selectItem('Roles')\">Roles</div>\r\n <div class=\"option-item\" [class.selected]=\"currentItem === 'EntityPermissions'\" (click)=\"selectItem('EntityPermissions')\">Entity Permissions</div>\r\n </div>\r\n\r\n <!-- Display container -->\r\n <div class=\"display-container\">\r\n <div *ngIf=\"currentItem === 'EntityPermissions'\">\r\n <mj-entity-permissions-selector-with-grid></mj-entity-permissions-selector-with-grid>\r\n </div>\r\n <div *ngIf=\"currentItem === 'Users'\">\r\n Users Component Goes Here\r\n </div>\r\n <div *ngIf=\"currentItem === 'Roles'\">\r\n <mj-roles-list></mj-roles-list>\r\n </div>\r\n <div *ngIf=\"currentItem === 'Role'\">\r\n <mj-single-role [RoleName]=\"selectedRoleName\"></mj-single-role>\r\n </div>\r\n </div>\r\n</div>\r\n", styles: [".container {\r\n display: flex;\r\n }\r\n \r\n .options-container {\r\n flex: 0 0 150px;\r\n padding: 10px;\r\n }\r\n \r\n .option-item {\r\n cursor: pointer;\r\n margin-bottom: 10px; /* Adds space between the options for better readability */\r\n padding: 5px 10px; /* Optional: Adds some padding for a better visual appearance */\r\n border-radius: 4px; /* Optional: Adds rounded corners for a more polished look */\r\n }\r\n \r\n .display-container {\r\n flex: 1;\r\n padding: 10px;\r\n }\r\n\r\n .selected {\r\n background-color: #007bff; /* A blue background for selected item */\r\n color: white; /* White text color for better contrast */\r\n padding: 5px 10px; /* Optional: Adds some padding for a better visual appearance */\r\n border-radius: 4px; /* Optional: Adds rounded corners for a more polished look */\r\n }\r\n "] }]
157
+ args: [{ selector: 'mj-settings', template: "<div class=\"container\" mjFillContainer [fillWidth]=\"false\" [bottomMargin]=\"5\">\r\n <!-- Options container -->\r\n <div class=\"options-container\">\r\n <div class=\"option-item\" [class.selected]=\"currentItem === 'Users'\" (click)=\"selectItem('Users')\">Users</div>\r\n <div class=\"option-item\" [class.selected]=\"currentItem === 'Roles' || currentItem === 'Role'\" (click)=\"selectItem('Roles')\">Roles</div>\r\n <div class=\"option-item\" [class.selected]=\"currentItem === 'EntityPermissions'\" (click)=\"selectItem('EntityPermissions')\">Entity Permissions</div>\r\n </div>\r\n\r\n <!-- Display container -->\r\n <div class=\"display-container\">\r\n <div *ngIf=\"currentItem === 'EntityPermissions'\">\r\n <mj-entity-permissions-selector-with-grid></mj-entity-permissions-selector-with-grid>\r\n </div>\r\n <div *ngIf=\"currentItem === 'Users'\">\r\n <mj-simple-record-list\r\n EntityName=\"Users\"\r\n SortBy=\"Name\"\r\n [Columns]=\"['Name', 'Email', 'IsActive', 'Type']\"\r\n (RecordSelected)=\"selectUser($event)\"\r\n ></mj-simple-record-list>\r\n </div>\r\n <div *ngIf=\"currentItem === 'User'\">\r\n <mj-single-user [UserID]=\"selectedUserID\"></mj-single-user>\r\n </div>\r\n <div *ngIf=\"currentItem === 'Roles'\">\r\n <mj-simple-record-list\r\n EntityName=\"Roles\"\r\n SortBy=\"Name\"\r\n [Columns]=\"['Name', 'Description']\"\r\n (RecordSelected)=\"selectRole($event)\"\r\n ></mj-simple-record-list>\r\n </div>\r\n <div *ngIf=\"currentItem === 'Role'\">\r\n <mj-single-role [RoleName]=\"selectedRoleName\"></mj-single-role>\r\n </div>\r\n </div>\r\n</div>", styles: [".container {\r\n display: flex;\r\n width: 100%;\r\n border: solid 1px lightgray;\r\n}\r\n\r\n.options-container {\r\n flex: 0 0 150px;\r\n padding: 10px;\r\n border-right: solid 1px lightgray;\r\n}\r\n\r\n.option-item {\r\n cursor: pointer;\r\n margin-bottom: 10px; /* Adds space between the options for better readability */\r\n padding: 5px 10px; /* Optional: Adds some padding for a better visual appearance */\r\n border-radius: 4px; /* Optional: Adds rounded corners for a more polished look */\r\n}\r\n\r\n.display-container {\r\n flex: 1;\r\n padding: 10px;\r\n}\r\n\r\n.selected {\r\n background-color: #007bff; /* A blue background for selected item */\r\n color: white; /* White text color for better contrast */\r\n padding: 5px 10px; /* Optional: Adds some padding for a better visual appearance */\r\n border-radius: 4px; /* Optional: Adds rounded corners for a more polished look */\r\n}\r\n"] }]
147
158
  }], () => [{ type: i1.Router }, { type: i1.ActivatedRoute }], null); })();
148
- (() => { (typeof ngDevMode === "undefined" || ngDevMode) && i0.ɵsetClassDebugInfo(SettingsComponent, { className: "SettingsComponent", filePath: "src\\lib\\settings\\settings.component.ts", lineNumber: 10 }); })();
159
+ (() => { (typeof ngDevMode === "undefined" || ngDevMode) && i0.ɵsetClassDebugInfo(SettingsComponent, { className: "SettingsComponent", filePath: "src\\lib\\settings\\settings.component.ts", lineNumber: 12 }); })();
@@ -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
  }